We need the driver core fixes in here as well.
Unified · Split
| @@ -142,10 +142,13 @@ ForEachMacros: · 141 unmodified lines | |||
| 142 | - 'for_each_card_auxs' | 142 | - 'for_each_card_auxs' |
| 143 | - 'for_each_card_auxs_safe' | 143 | - 'for_each_card_auxs_safe' |
| 144 | - 'for_each_card_components' | 144 | - 'for_each_card_components' |
| 145 | - 'for_each_card_dapms' | ||
| 145 | - 'for_each_card_pre_auxs' | 146 | - 'for_each_card_pre_auxs' |
| 146 | - 'for_each_card_prelinks' | 147 | - 'for_each_card_prelinks' |
| 147 | - 'for_each_card_rtds' | 148 | - 'for_each_card_rtds' |
| 148 | - 'for_each_card_rtds_safe' | 149 | - 'for_each_card_rtds_safe' |
| 150 | - 'for_each_card_widgets' | ||
| 151 | - 'for_each_card_widgets_safe' | ||
| 149 | - 'for_each_cgroup_storage_type' | 152 | - 'for_each_cgroup_storage_type' |
| 150 | - 'for_each_child_of_node' | 153 | - 'for_each_child_of_node' |
| 151 | - 'for_each_clear_bit' | 154 | - 'for_each_clear_bit' |
| @@ -160,6 +163,7 @@ ForEachMacros: · 8 unmodified lines | |||
| 160 | - 'for_each_cpu_and' | 163 | - 'for_each_cpu_and' |
| 161 | - 'for_each_cpu_not' | 164 | - 'for_each_cpu_not' |
| 162 | - 'for_each_cpu_wrap' | 165 | - 'for_each_cpu_wrap' |
| 166 | - 'for_each_dapm_widgets' | ||
| 163 | - 'for_each_dev_addr' | 167 | - 'for_each_dev_addr' |
| 164 | - 'for_each_dev_scope' | 168 | - 'for_each_dev_scope' |
| 165 | - 'for_each_displayid_db' | 169 | - 'for_each_displayid_db' |
| @@ -170,7 +174,6 @@ ForEachMacros: · 4 unmodified lines | |||
| 170 | - 'for_each_dpcm_fe' | 174 | - 'for_each_dpcm_fe' |
| 171 | - 'for_each_drhd_unit' | 175 | - 'for_each_drhd_unit' |
| 172 | - 'for_each_dss_dev' | 176 | - 'for_each_dss_dev' |
| 173 | - 'for_each_efi_handle' | ||
| 174 | - 'for_each_efi_memory_desc' | 177 | - 'for_each_efi_memory_desc' |
| 175 | - 'for_each_efi_memory_desc_in_map' | 178 | - 'for_each_efi_memory_desc_in_map' |
| 176 | - 'for_each_element' | 179 | - 'for_each_element' |
| @@ -191,6 +194,7 @@ ForEachMacros: · 14 unmodified lines | |||
| 191 | - 'for_each_ip_tunnel_rcu' | 194 | - 'for_each_ip_tunnel_rcu' |
| 192 | - 'for_each_irq_nr' | 195 | - 'for_each_irq_nr' |
| 193 | - 'for_each_link_codecs' | 196 | - 'for_each_link_codecs' |
| 197 | - 'for_each_link_cpus' | ||
| 194 | - 'for_each_link_platforms' | 198 | - 'for_each_link_platforms' |
| 195 | - 'for_each_lru' | 199 | - 'for_each_lru' |
| 196 | - 'for_each_matching_node' | 200 | - 'for_each_matching_node' |
| @@ -250,6 +254,7 @@ ForEachMacros: · 53 unmodified lines | |||
| 250 | - 'for_each_pci_bridge' | 254 | - 'for_each_pci_bridge' |
| 251 | - 'for_each_pci_dev' | 255 | - 'for_each_pci_dev' |
| 252 | - 'for_each_pci_msi_entry' | 256 | - 'for_each_pci_msi_entry' |
| 257 | - 'for_each_pcm_streams' | ||
| 253 | - 'for_each_populated_zone' | 258 | - 'for_each_populated_zone' |
| 254 | - 'for_each_possible_cpu' | 259 | - 'for_each_possible_cpu' |
| 255 | - 'for_each_present_cpu' | 260 | - 'for_each_present_cpu' |
| @@ -260,9 +265,12 @@ ForEachMacros: · 4 unmodified lines | |||
| 260 | - 'for_each_property_of_node' | 265 | - 'for_each_property_of_node' |
| 261 | - 'for_each_registered_fb' | 266 | - 'for_each_registered_fb' |
| 262 | - 'for_each_reserved_mem_region' | 267 | - 'for_each_reserved_mem_region' |
| 263 | - 'for_each_rtd_codec_dai' | 268 | - 'for_each_rtd_codec_dais' |
| 264 | - 'for_each_rtd_codec_dai_rollback' | 269 | - 'for_each_rtd_codec_dais_rollback' |
| 265 | - 'for_each_rtd_components' | 270 | - 'for_each_rtd_components' |
| 271 | - 'for_each_rtd_cpu_dais' | ||
| 272 | - 'for_each_rtd_cpu_dais_rollback' | ||
| 273 | - 'for_each_rtd_dais' | ||
| 266 | - 'for_each_set_bit' | 274 | - 'for_each_set_bit' |
| 267 | - 'for_each_set_bit_from' | 275 | - 'for_each_set_bit_from' |
| 268 | - 'for_each_set_clump8' | 276 | - 'for_each_set_clump8' |
| @@ -334,6 +342,7 @@ ForEachMacros: · 65 unmodified lines | |||
| 334 | - 'klp_for_each_object' | 342 | - 'klp_for_each_object' |
| 335 | - 'klp_for_each_object_safe' | 343 | - 'klp_for_each_object_safe' |
| 336 | - 'klp_for_each_object_static' | 344 | - 'klp_for_each_object_static' |
| 345 | - 'kunit_suite_for_each_test_case' | ||
| 337 | - 'kvm_for_each_memslot' | 346 | - 'kvm_for_each_memslot' |
| 338 | - 'kvm_for_each_vcpu' | 347 | - 'kvm_for_each_vcpu' |
| 339 | - 'list_for_each' | 348 | - 'list_for_each' |
| @@ -387,6 +396,7 @@ ForEachMacros: · 47 unmodified lines | |||
| 387 | - 'of_property_for_each_string' | 396 | - 'of_property_for_each_string' |
| 388 | - 'of_property_for_each_u32' | 397 | - 'of_property_for_each_u32' |
| 389 | - 'pci_bus_for_each_resource' | 398 | - 'pci_bus_for_each_resource' |
| 399 | - 'pcm_for_each_format' | ||
| 390 | - 'ping_portaddr_for_each_entry' | 400 | - 'ping_portaddr_for_each_entry' |
| 391 | - 'plist_for_each' | 401 | - 'plist_for_each' |
| 392 | - 'plist_for_each_continue' | 402 | - 'plist_for_each_continue' |
| @@ -482,7 +492,7 @@ KeepEmptyLinesAtTheStartOfBlocks: false · 89 unmodified lines | |||
| 482 | MacroBlockBegin: '' | 492 | MacroBlockBegin: '' |
| 483 | MacroBlockEnd: '' | 493 | MacroBlockEnd: '' |
| 484 | MaxEmptyLinesToKeep: 1 | 494 | MaxEmptyLinesToKeep: 1 |
| 485 | NamespaceIndentation: Inner | 495 | NamespaceIndentation: None |
| 486 | #ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0 | 496 | #ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0 |
| 487 | ObjCBlockIndentWidth: 8 | 497 | ObjCBlockIndentWidth: 8 |
| 488 | ObjCSpaceAfterProperty: true | 498 | ObjCSpaceAfterProperty: true |
| @@ -5187,8 +5187,7 @@ · 5186 unmodified lines | |||
| 5187 | 5187 | ||
| 5188 | usbcore.old_scheme_first= | 5188 | usbcore.old_scheme_first= |
| 5189 | [USB] Start with the old device initialization | 5189 | [USB] Start with the old device initialization |
| 5190 | scheme, applies only to low and full-speed devices | 5190 | scheme (default 0 = off). |
| 5191 | (default 0 = off). | ||
| 5192 | 5191 | ||
| 5193 | usbcore.usbfs_memory_mb= | 5192 | usbcore.usbfs_memory_mb= |
| 5194 | [USB] Memory limit (in MB) for buffers allocated by | 5193 | [USB] Memory limit (in MB) for buffers allocated by |
| @@ -390,9 +390,17 @@ When ``kptr_restrict`` is set to 2, kernel pointers printed using · 389 unmodified lines | |||
| 390 | modprobe | 390 | modprobe |
| 391 | ======== | 391 | ======== |
| 392 | 392 | ||
| 393 | This gives the full path of the modprobe command which the kernel will | 393 | The full path to the usermode helper for autoloading kernel modules, |
| 394 | use to load modules. This can be used to debug module loading | 394 | by default "/sbin/modprobe". This binary is executed when the kernel |
| 395 | requests:: | 395 | requests a module. For example, if userspace passes an unknown |
| 396 | filesystem type to mount(), then the kernel will automatically request | ||
| 397 | the corresponding filesystem module by executing this usermode helper. | ||
| 398 | This usermode helper should insert the needed module into the kernel. | ||
| 399 | |||
| 400 | This sysctl only affects module autoloading. It has no effect on the | ||
| 401 | ability to explicitly insert modules. | ||
| 402 | |||
| 403 | This sysctl can be used to debug module loading requests:: | ||
| 396 | 404 | ||
| 397 | echo '#! /bin/sh' > /tmp/modprobe | 405 | echo '#! /bin/sh' > /tmp/modprobe |
| 398 | echo 'echo "$@" >> /tmp/modprobe.log' >> /tmp/modprobe | 406 | echo 'echo "$@" >> /tmp/modprobe.log' >> /tmp/modprobe |
| @@ -400,10 +408,15 @@ requests:: · 1 unmodified line | |||
| 400 | chmod a+x /tmp/modprobe | 408 | chmod a+x /tmp/modprobe |
| 401 | echo /tmp/modprobe > /proc/sys/kernel/modprobe | 409 | echo /tmp/modprobe > /proc/sys/kernel/modprobe |
| 402 | 410 | ||
| 403 | This only applies when the *kernel* is requesting that the module be | 411 | Alternatively, if this sysctl is set to the empty string, then module |
| 404 | loaded; it won't have any effect if the module is being loaded | 412 | autoloading is completely disabled. The kernel will not try to |
| 405 | explicitly using ``modprobe`` from userspace. | 413 | execute a usermode helper at all, nor will it call the |
| 414 | kernel_module_request LSM hook. | ||
| 406 | 415 | ||
| 416 | If CONFIG_STATIC_USERMODEHELPER=y is set in the kernel configuration, | ||
| 417 | then the configured static usermode helper overrides this sysctl, | ||
| 418 | except that the empty string is still accepted to completely disable | ||
| 419 | module autoloading as described above. | ||
| 407 | 420 | ||
| 408 | modules_disabled | 421 | modules_disabled |
| 409 | ================ | 422 | ================ |
| @@ -446,28 +459,6 @@ Notes: · 36 unmodified lines | |||
| 446 | successful IPC object allocation. If an IPC object allocation syscall | 459 | successful IPC object allocation. If an IPC object allocation syscall |
| 447 | fails, it is undefined if the value remains unmodified or is reset to -1. | 460 | fails, it is undefined if the value remains unmodified or is reset to -1. |
| 448 | 461 | ||
| 449 | modprobe: | ||
| 450 | ========= | ||
| 451 | |||
| 452 | The path to the usermode helper for autoloading kernel modules, by | ||
| 453 | default "/sbin/modprobe". This binary is executed when the kernel | ||
| 454 | requests a module. For example, if userspace passes an unknown | ||
| 455 | filesystem type to mount(), then the kernel will automatically request | ||
| 456 | the corresponding filesystem module by executing this usermode helper. | ||
| 457 | This usermode helper should insert the needed module into the kernel. | ||
| 458 | |||
| 459 | This sysctl only affects module autoloading. It has no effect on the | ||
| 460 | ability to explicitly insert modules. | ||
| 461 | |||
| 462 | If this sysctl is set to the empty string, then module autoloading is | ||
| 463 | completely disabled. The kernel will not try to execute a usermode | ||
| 464 | helper at all, nor will it call the kernel_module_request LSM hook. | ||
| 465 | |||
| 466 | If CONFIG_STATIC_USERMODEHELPER=y is set in the kernel configuration, | ||
| 467 | then the configured static usermode helper overrides this sysctl, | ||
| 468 | except that the empty string is still accepted to completely disable | ||
| 469 | module autoloading as described above. | ||
| 470 | |||
| 471 | nmi_watchdog | 462 | nmi_watchdog |
| 472 | ============ | 463 | ============ |
| 473 | 464 | ||
| @@ -23,13 +23,14 @@ optional external memory-mapped interface. · 22 unmodified lines | |||
| 23 | 23 | ||
| 24 | Version 1 of the Activity Monitors architecture implements a counter group | 24 | Version 1 of the Activity Monitors architecture implements a counter group |
| 25 | of four fixed and architecturally defined 64-bit event counters. | 25 | of four fixed and architecturally defined 64-bit event counters. |
| 26 | - CPU cycle counter: increments at the frequency of the CPU. | 26 | |
| 27 | - Constant counter: increments at the fixed frequency of the system | 27 | - CPU cycle counter: increments at the frequency of the CPU. |
| 28 | clock. | 28 | - Constant counter: increments at the fixed frequency of the system |
| 29 | - Instructions retired: increments with every architecturally executed | 29 | clock. |
| 30 | instruction. | 30 | - Instructions retired: increments with every architecturally executed |
| 31 | - Memory stall cycles: counts instruction dispatch stall cycles caused by | 31 | instruction. |
| 32 | misses in the last level cache within the clock domain. | 32 | - Memory stall cycles: counts instruction dispatch stall cycles caused by |
| 33 | misses in the last level cache within the clock domain. | ||
| 33 | 34 | ||
| 34 | When in WFI or WFE these counters do not increment. | 35 | When in WFI or WFE these counters do not increment. |
| 35 | 36 | ||
| @@ -57,11 +58,12 @@ counters, only the presence of the extension. · 21 unmodified lines | |||
| 57 | 58 | ||
| 58 | Firmware (code running at higher exception levels, e.g. arm-tf) support is | 59 | Firmware (code running at higher exception levels, e.g. arm-tf) support is |
| 59 | needed to: | 60 | needed to: |
| 60 | - Enable access for lower exception levels (EL2 and EL1) to the AMU | 61 | |
| 61 | registers. | 62 | - Enable access for lower exception levels (EL2 and EL1) to the AMU |
| 62 | - Enable the counters. If not enabled these will read as 0. | 63 | registers. |
| 63 | - Save/restore the counters before/after the CPU is being put/brought up | 64 | - Enable the counters. If not enabled these will read as 0. |
| 64 | from the 'off' power state. | 65 | - Save/restore the counters before/after the CPU is being put/brought up |
| 66 | from the 'off' power state. | ||
| 65 | 67 | ||
| 66 | When using kernels that have this feature enabled but boot with broken | 68 | When using kernels that have this feature enabled but boot with broken |
| 67 | firmware the user may experience panics or lockups when accessing the | 69 | firmware the user may experience panics or lockups when accessing the |
| @@ -78,10 +80,11 @@ are not trapped in EL2/EL3. · 10 unmodified lines | |||
| 78 | 80 | ||
| 79 | The fixed counters of AMUv1 are accessible though the following system | 81 | The fixed counters of AMUv1 are accessible though the following system |
| 80 | register definitions: | 82 | register definitions: |
| 81 | - SYS_AMEVCNTR0_CORE_EL0 | 83 | |
| 82 | - SYS_AMEVCNTR0_CONST_EL0 | 84 | - SYS_AMEVCNTR0_CORE_EL0 |
| 83 | - SYS_AMEVCNTR0_INST_RET_EL0 | 85 | - SYS_AMEVCNTR0_CONST_EL0 |
| 84 | - SYS_AMEVCNTR0_MEM_STALL_EL0 | 86 | - SYS_AMEVCNTR0_INST_RET_EL0 |
| 87 | - SYS_AMEVCNTR0_MEM_STALL_EL0 | ||
| 85 | 88 | ||
| 86 | Auxiliary platform specific counters can be accessed using | 89 | Auxiliary platform specific counters can be accessed using |
| 87 | SYS_AMEVCNTR1_EL0(n), where n is a value between 0 and 15. | 90 | SYS_AMEVCNTR1_EL0(n), where n is a value between 0 and 15. |
| @@ -93,9 +96,10 @@ Userspace access · 5 unmodified lines | |||
| 93 | ---------------- | 96 | ---------------- |
| 94 | 97 | ||
| 95 | Currently, access from userspace to the AMU registers is disabled due to: | 98 | Currently, access from userspace to the AMU registers is disabled due to: |
| 96 | - Security reasons: they might expose information about code executed in | 99 | |
| 97 | secure mode. | 100 | - Security reasons: they might expose information about code executed in |
| 98 | - Purpose: AMU counters are intended for system management use. | 101 | secure mode. |
| 102 | - Purpose: AMU counters are intended for system management use. | ||
| 99 | 103 | ||
| 100 | Also, the presence of the feature is not visible to userspace. | 104 | Also, the presence of the feature is not visible to userspace. |
| 101 | 105 | ||
| @@ -105,8 +109,9 @@ Virtualization · 3 unmodified lines | |||
| 105 | 109 | ||
| 106 | Currently, access from userspace (EL0) and kernelspace (EL1) on the KVM | 110 | Currently, access from userspace (EL0) and kernelspace (EL1) on the KVM |
| 107 | guest side is disabled due to: | 111 | guest side is disabled due to: |
| 108 | - Security reasons: they might expose information about code executed | 112 | |
| 109 | by other guests or the host. | 113 | - Security reasons: they might expose information about code executed |
| 114 | by other guests or the host. | ||
| 110 | 115 | ||
| 111 | Any attempt to access the AMU registers will result in an UNDEFINED | 116 | Any attempt to access the AMU registers will result in an UNDEFINED |
| 112 | exception being injected into the guest. | 117 | exception being injected into the guest. |
| @@ -154,9 +154,9 @@ architectures. These are the recommended replacements: · 153 unmodified lines | |||
| 154 | 154 | ||
| 155 | Use ktime_get() or ktime_get_ts64() instead. | 155 | Use ktime_get() or ktime_get_ts64() instead. |
| 156 | 156 | ||
| 157 | .. c:function:: struct timeval do_gettimeofday( void ) | 157 | .. c:function:: void do_gettimeofday( struct timeval * ) |
| 158 | struct timespec getnstimeofday( void ) | 158 | void getnstimeofday( struct timespec * ) |
| 159 | struct timespec64 getnstimeofday64( void ) | 159 | void getnstimeofday64( struct timespec64 * ) |
| 160 | void ktime_get_real_ts( struct timespec * ) | 160 | void ktime_get_real_ts( struct timespec * ) |
| 161 | 161 | ||
| 162 | ktime_get_real_ts64() is a direct replacement, but consider using | 162 | ktime_get_real_ts64() is a direct replacement, but consider using |
| @@ -2,6 +2,7 @@ · 1 unmodified line | |||
| 2 | DT_DOC_CHECKER ?= dt-doc-validate | 2 | DT_DOC_CHECKER ?= dt-doc-validate |
| 3 | DT_EXTRACT_EX ?= dt-extract-example | 3 | DT_EXTRACT_EX ?= dt-extract-example |
| 4 | DT_MK_SCHEMA ?= dt-mk-schema | 4 | DT_MK_SCHEMA ?= dt-mk-schema |
| 5 | DT_MK_SCHEMA_USERONLY_FLAG := $(if $(DT_SCHEMA_FILES), -u) | ||
| 5 | 6 | ||
| 6 | quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<) | 7 | quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<) |
| 7 | cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \ | 8 | cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \ |
| @@ -13,16 +14,18 @@ $(obj)/%.example.dts: $(src)/%.yaml FORCE · 5 unmodified lines | |||
| 13 | # Use full schemas when checking %.example.dts | 14 | # Use full schemas when checking %.example.dts |
| 14 | DT_TMP_SCHEMA := $(obj)/processed-schema-examples.yaml | 15 | DT_TMP_SCHEMA := $(obj)/processed-schema-examples.yaml |
| 15 | 16 | ||
| 17 | find_cmd = find $(srctree)/$(src) \( -name '*.yaml' ! \ | ||
| 18 | -name 'processed-schema*' ! \ | ||
| 19 | -name '*.example.dt.yaml' \) | ||
| 20 | |||
| 16 | quiet_cmd_mk_schema = SCHEMA $@ | 21 | quiet_cmd_mk_schema = SCHEMA $@ |
| 17 | cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs) | 22 | cmd_mk_schema = rm -f $@ ; \ |
| 23 | $(if $(DT_MK_SCHEMA_FLAGS), \ | ||
| 24 | echo $(real-prereqs), \ | ||
| 25 | $(find_cmd)) | \ | ||
| 26 | xargs $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) >> $@ | ||
| 18 | 27 | ||
| 19 | DT_DOCS = $(addprefix $(src)/, \ | 28 | DT_DOCS = $(shell $(find_cmd) | sed -e 's|^$(srctree)/||') |
| 20 | $(shell \ | ||
| 21 | cd $(srctree)/$(src) && \ | ||
| 22 | find * \( -name '*.yaml' ! \ | ||
| 23 | -name 'processed-schema*' ! \ | ||
| 24 | -name '*.example.dt.yaml' \) \ | ||
| 25 | )) | ||
| 26 | 29 | ||
| 27 | DT_SCHEMA_FILES ?= $(DT_DOCS) | 30 | DT_SCHEMA_FILES ?= $(DT_DOCS) |
| 28 | 31 | ||
| @@ -37,7 +40,7 @@ override DTC_FLAGS := \ · 8 unmodified lines | |||
| 37 | $(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE | 40 | $(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE |
| 38 | $(call if_changed,mk_schema) | 41 | $(call if_changed,mk_schema) |
| 39 | 42 | ||
| 40 | $(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := -u | 43 | $(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := $(DT_MK_SCHEMA_USERONLY_FLAG) |
| 41 | $(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE | 44 | $(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE |
| 42 | $(call if_changed,mk_schema) | 45 | $(call if_changed,mk_schema) |
| 43 | 46 | ||
| @@ -42,6 +42,10 @@ properties: · 41 unmodified lines | |||
| 42 | description: | 42 | description: |
| 43 | See section 2.3.9 of the DeviceTree Specification. | 43 | See section 2.3.9 of the DeviceTree Specification. |
| 44 | 44 | ||
| 45 | '#address-cells': true | ||
| 46 | |||
| 47 | '#size-cells': true | ||
| 48 | |||
| 45 | required: | 49 | required: |
| 46 | - "#interconnect-cells" | 50 | - "#interconnect-cells" |
| 47 | - compatible | 51 | - compatible |
| @@ -59,6 +63,8 @@ examples: · 11 unmodified lines | |||
| 59 | compatible = "allwinner,sun5i-a13-mbus"; | 63 | compatible = "allwinner,sun5i-a13-mbus"; |
| 60 | reg = <0x01c01000 0x1000>; | 64 | reg = <0x01c01000 0x1000>; |
| 61 | clocks = <&ccu CLK_MBUS>; | 65 | clocks = <&ccu CLK_MBUS>; |
| 66 | #address-cells = <1>; | ||
| 67 | #size-cells = <1>; | ||
| 62 | dma-ranges = <0x00000000 0x40000000 0x20000000>; | 68 | dma-ranges = <0x00000000 0x40000000 0x20000000>; |
| 63 | #interconnect-cells = <1>; | 69 | #interconnect-cells = <1>; |
| 64 | }; | 70 | }; |
| @@ -91,7 +91,7 @@ required: · 90 unmodified lines | |||
| 91 | 91 | ||
| 92 | examples: | 92 | examples: |
| 93 | - | | 93 | - | |
| 94 | vco1: clock@00 { | 94 | vco1: clock { |
| 95 | compatible = "arm,impd1-vco1"; | 95 | compatible = "arm,impd1-vco1"; |
| 96 | #clock-cells = <0>; | 96 | #clock-cells = <0>; |
| 97 | lock-offset = <0x08>; | 97 | lock-offset = <0x08>; |
| @@ -1,5 +1,5 @@ | |||
| 1 | Analog Device ADV7123 Video DAC | 1 | Analog Devices ADV7123 Video DAC |
| 2 | ------------------------------- | 2 | -------------------------------- |
| 3 | 3 | ||
| 4 | The ADV7123 is a digital-to-analog converter that outputs VGA signals from a | 4 | The ADV7123 is a digital-to-analog converter that outputs VGA signals from a |
| 5 | parallel video input. | 5 | parallel video input. |
| @@ -1,5 +1,5 @@ | |||
| 1 | Analog Device ADV7511(W)/13/33/35 HDMI Encoders | 1 | Analog Devices ADV7511(W)/13/33/35 HDMI Encoders |
| 2 | ----------------------------------------- | 2 | ------------------------------------------------ |
| 3 | 3 | ||
| 4 | The ADV7511, ADV7511W, ADV7513, ADV7533 and ADV7535 are HDMI audio and video | 4 | The ADV7511, ADV7511W, ADV7513, ADV7533 and ADV7535 are HDMI audio and video |
| 5 | transmitters compatible with HDMI 1.4 and DVI 1.0. They support color space | 5 | transmitters compatible with HDMI 1.4 and DVI 1.0. They support color space |
| @@ -37,7 +37,6 @@ examples: · 36 unmodified lines | |||
| 37 | dsi { | 37 | dsi { |
| 38 | #address-cells = <1>; | 38 | #address-cells = <1>; |
| 39 | #size-cells = <0>; | 39 | #size-cells = <0>; |
| 40 | reg = <0xff450000 0x1000>; | ||
| 41 | 40 | ||
| 42 | panel@0 { | 41 | panel@0 { |
| 43 | compatible = "leadtek,ltk500hd1829"; | 42 | compatible = "leadtek,ltk500hd1829"; |
| @@ -96,12 +96,20 @@ properties: · 95 unmodified lines | |||
| 96 | If set, reverse the bit order described in the data mappings below on all | 96 | If set, reverse the bit order described in the data mappings below on all |
| 97 | data lanes, transmitting bits for slots 6 to 0 instead of 0 to 6. | 97 | data lanes, transmitting bits for slots 6 to 0 instead of 0 to 6. |
| 98 | 98 | ||
| 99 | port: true | ||
| 100 | ports: true | ||
| 101 | |||
| 99 | required: | 102 | required: |
| 100 | - compatible | 103 | - compatible |
| 101 | - data-mapping | 104 | - data-mapping |
| 102 | - width-mm | 105 | - width-mm |
| 103 | - height-mm | 106 | - height-mm |
| 104 | - panel-timing | 107 | - panel-timing |
| 105 | - port | 108 | |
| 109 | oneOf: | ||
| 110 | - required: | ||
| 111 | - port | ||
| 112 | - required: | ||
| 113 | - ports | ||
| 106 | 114 | ||
| 107 | ... | 115 | ... |
| @@ -37,7 +37,6 @@ examples: · 36 unmodified lines | |||
| 37 | dsi { | 37 | dsi { |
| 38 | #address-cells = <1>; | 38 | #address-cells = <1>; |
| 39 | #size-cells = <0>; | 39 | #size-cells = <0>; |
| 40 | reg = <0xff450000 0x1000>; | ||
| 41 | 40 | ||
| 42 | panel@0 { | 41 | panel@0 { |
| 43 | compatible = "xinpeng,xpp055c272"; | 42 | compatible = "xinpeng,xpp055c272"; |
| @@ -1,4 +1,4 @@ | |||
| 1 | Analog Device AXI-DMAC DMA controller | 1 | Analog Devices AXI-DMAC DMA controller |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible: Must be "adi,axi-dmac-1.00.a". | 4 | - compatible: Must be "adi,axi-dmac-1.00.a". |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | # Copyright 2019 Analog Devices Inc. | 2 | # Copyright 2019 Analog Devices Inc. |
| 3 | %YAML 1.2 | 3 | %YAML 1.2 |
| 4 | --- | 4 | --- |
| 5 | $id: http://devicetree.org/schemas/bindings/hwmon/adi,axi-fan-control.yaml# | 5 | $id: http://devicetree.org/schemas/hwmon/adi,axi-fan-control.yaml# |
| 6 | $schema: http://devicetree.org/meta-schemas/core.yaml# | 6 | $schema: http://devicetree.org/meta-schemas/core.yaml# |
| 7 | 7 | ||
| 8 | title: Analog Devices AXI FAN Control Device Tree Bindings | 8 | title: Analog Devices AXI FAN Control Device Tree Bindings |
| @@ -47,7 +47,7 @@ required: · 38 unmodified lines | |||
| 47 | 47 | ||
| 48 | examples: | 48 | examples: |
| 49 | - | | 49 | - | |
| 50 | fpga_axi: fpga-axi@0 { | 50 | fpga_axi: fpga-axi { |
| 51 | #address-cells = <0x2>; | 51 | #address-cells = <0x2>; |
| 52 | #size-cells = <0x1>; | 52 | #size-cells = <0x1>; |
| 53 | 53 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) |
| 2 | %YAML 1.2 | 2 | %YAML 1.2 |
| 3 | --- | 3 | --- |
| 4 | $id: http://devicetree.org/schemas/adt7475.yaml# | 4 | $id: http://devicetree.org/schemas/hwmon/adt7475.yaml# |
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# |
| 6 | 6 | ||
| 7 | title: ADT7475 hwmon sensor | 7 | title: ADT7475 hwmon sensor |
| @@ -1,7 +1,7 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) |
| 2 | %YAML 1.2 | 2 | %YAML 1.2 |
| 3 | --- | 3 | --- |
| 4 | $id: "http://devicetree.org/schemas/bindings/iio/adc/st,stm32-adc.yaml#" | 4 | $id: "http://devicetree.org/schemas/iio/adc/st,stm32-adc.yaml#" |
| 5 | $schema: "http://devicetree.org/meta-schemas/core.yaml#" | 5 | $schema: "http://devicetree.org/meta-schemas/core.yaml#" |
| 6 | 6 | ||
| 7 | title: STMicroelectronics STM32 ADC bindings | 7 | title: STMicroelectronics STM32 ADC bindings |
| @@ -1,4 +1,4 @@ | |||
| 1 | * Analog Device AD5755 IIO Multi-Channel DAC Linux Driver | 1 | * Analog Devices AD5755 IIO Multi-Channel DAC Linux Driver |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible: Has to contain one of the following: | 4 | - compatible: Has to contain one of the following: |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | # Copyright 2020 Analog Devices Inc. | 2 | # Copyright 2020 Analog Devices Inc. |
| 3 | %YAML 1.2 | 3 | %YAML 1.2 |
| 4 | --- | 4 | --- |
| 5 | $id: http://devicetree.org/schemas/bindings/iio/dac/adi,ad5770r.yaml# | 5 | $id: http://devicetree.org/schemas/iio/dac/adi,ad5770r.yaml# |
| 6 | $schema: http://devicetree.org/meta-schemas/core.yaml# | 6 | $schema: http://devicetree.org/meta-schemas/core.yaml# |
| 7 | 7 | ||
| 8 | title: Analog Devices AD5770R DAC device driver | 8 | title: Analog Devices AD5770R DAC device driver |
| @@ -49,93 +49,86 @@ properties: · 40 unmodified lines | |||
| 49 | asserted during driver probe. | 49 | asserted during driver probe. |
| 50 | maxItems: 1 | 50 | maxItems: 1 |
| 51 | 51 | ||
| 52 | channel0: | 52 | channel@0: |
| 53 | description: Represents an external channel which are | 53 | description: Represents an external channel which are |
| 54 | connected to the DAC. Channel 0 can act both as a current | 54 | connected to the DAC. Channel 0 can act both as a current |
| 55 | source and sink. | 55 | source and sink. |
| 56 | type: object | 56 | type: object |
| 57 | 57 | ||
| 58 | properties: | 58 | properties: |
| 59 | num: | 59 | reg: |
| 60 | description: This represents the channel number. | 60 | description: This represents the channel number. |
| 61 | items: | 61 | const: 0 |
| 62 | const: 0 | ||
| 63 | 62 | ||
| 64 | adi,range-microamp: | 63 | adi,range-microamp: |
| 65 | description: Output range of the channel. | 64 | description: Output range of the channel. |
| 66 | oneOf: | 65 | oneOf: |
| 67 | - $ref: /schemas/types.yaml#/definitions/int32-array | ||
| 68 | - items: | 66 | - items: |
| 69 | - enum: [0 300000] | 67 | - const: 0 |
| 70 | - enum: [-60000 0] | 68 | - const: 300000 |
| 71 | - enum: [-60000 300000] | 69 | - items: |
| 70 | - const: -60000 | ||
| 71 | - const: 0 | ||
| 72 | - items: | ||
| 73 | - const: -60000 | ||
| 74 | - const: 300000 | ||
| 72 | 75 | ||
| 73 | channel1: | 76 | channel@1: |
| 74 | description: Represents an external channel which are | 77 | description: Represents an external channel which are |
| 75 | connected to the DAC. | 78 | connected to the DAC. |
| 76 | type: object | 79 | type: object |
| 77 | 80 | ||
| 78 | properties: | 81 | properties: |
| 79 | num: | 82 | reg: |
| 80 | description: This represents the channel number. | 83 | description: This represents the channel number. |
| 81 | items: | 84 | const: 1 |
| 82 | const: 1 | ||
| 83 | 85 | ||
| 84 | adi,range-microamp: | 86 | adi,range-microamp: |
| 85 | description: Output range of the channel. | 87 | description: Output range of the channel. |
| 86 | oneOf: | 88 | items: |
| 87 | - $ref: /schemas/types.yaml#/definitions/uint32-array | 89 | - const: 0 |
| 88 | - items: | 90 | - enum: [ 140000, 250000 ] |
| 89 | - enum: [0 140000] | ||
| 90 | - enum: [0 250000] | ||
| 91 | 91 | ||
| 92 | channel2: | 92 | channel@2: |
| 93 | description: Represents an external channel which are | 93 | description: Represents an external channel which are |
| 94 | connected to the DAC. | 94 | connected to the DAC. |
| 95 | type: object | 95 | type: object |
| 96 | 96 | ||
| 97 | properties: | 97 | properties: |
| 98 | num: | 98 | reg: |
| 99 | description: This represents the channel number. | 99 | description: This represents the channel number. |
| 100 | items: | 100 | const: 2 |
| 101 | const: 2 | ||
| 102 | 101 | ||
| 103 | adi,range-microamp: | 102 | adi,range-microamp: |
| 104 | description: Output range of the channel. | 103 | description: Output range of the channel. |
| 105 | oneOf: | 104 | items: |
| 106 | - $ref: /schemas/types.yaml#/definitions/uint32-array | 105 | - const: 0 |
| 107 | - items: | 106 | - enum: [ 55000, 150000 ] |
| 108 | - enum: [0 140000] | ||
| 109 | - enum: [0 250000] | ||
| 110 | 107 | ||
| 111 | patternProperties: | 108 | patternProperties: |
| 112 | "^channel@([3-5])$": | 109 | "^channel@([3-5])$": |
| 113 | type: object | 110 | type: object |
| 114 | description: Represents the external channels which are connected to the DAC. | 111 | description: Represents the external channels which are connected to the DAC. |
| 115 | properties: | 112 | properties: |
| 116 | num: | 113 | reg: |
| 117 | description: This represents the channel number. | 114 | description: This represents the channel number. |
| 118 | items: | 115 | minimum: 3 |
| 119 | minimum: 3 | 116 | maximum: 5 |
| 120 | maximum: 5 | ||
| 121 | 117 | ||
| 122 | adi,range-microamp: | 118 | adi,range-microamp: |
| 123 | description: Output range of the channel. | 119 | description: Output range of the channel. |
| 124 | oneOf: | 120 | items: |
| 125 | - $ref: /schemas/types.yaml#/definitions/uint32-array | 121 | - const: 0 |
| 126 | - items: | 122 | - enum: [ 45000, 100000 ] |
| 127 | - enum: [0 45000] | ||
| 128 | - enum: [0 100000] | ||
| 129 | 123 | ||
| 130 | required: | 124 | required: |
| 131 | - reg | 125 | - reg |
| 132 | - diff-channels | 126 | - channel@0 |
| 133 | - channel0 | 127 | - channel@1 |
| 134 | - channel1 | 128 | - channel@2 |
| 135 | - channel2 | 129 | - channel@3 |
| 136 | - channel3 | 130 | - channel@4 |
| 137 | - channel4 | 131 | - channel@5 |
| 138 | - channel5 | ||
| 139 | 132 | ||
| 140 | examples: | 133 | examples: |
| 141 | - | | 134 | - | |
| @@ -144,40 +137,42 @@ examples: · 2 unmodified lines | |||
| 144 | #size-cells = <0>; | 137 | #size-cells = <0>; |
| 145 | 138 | ||
| 146 | ad5770r@0 { | 139 | ad5770r@0 { |
| 147 | compatible = "ad5770r"; | 140 | compatible = "adi,ad5770r"; |
| 148 | reg = <0>; | 141 | reg = <0>; |
| 149 | spi-max-frequency = <1000000>; | 142 | spi-max-frequency = <1000000>; |
| 150 | vref-supply = <&vref>; | 143 | vref-supply = <&vref>; |
| 151 | adi,external-resistor; | 144 | adi,external-resistor; |
| 152 | reset-gpios = <&gpio 22 0>; | 145 | reset-gpios = <&gpio 22 0>; |
| 146 | #address-cells = <1>; | ||
| 147 | #size-cells = <0>; | ||
| 153 | 148 | ||
| 154 | channel@0 { | 149 | channel@0 { |
| 155 | num = <0>; | 150 | reg = <0>; |
| 156 | adi,range-microamp = <(-60000) 300000>; | 151 | adi,range-microamp = <0 300000>; |
| 157 | }; | 152 | }; |
| 158 | 153 | ||
| 159 | channel@1 { | 154 | channel@1 { |
| 160 | num = <1>; | 155 | reg = <1>; |
| 161 | adi,range-microamp = <0 140000>; | 156 | adi,range-microamp = <0 140000>; |
| 162 | }; | 157 | }; |
| 163 | 158 | ||
| 164 | channel@2 { | 159 | channel@2 { |
| 165 | num = <2>; | 160 | reg = <2>; |
| 166 | adi,range-microamp = <0 55000>; | 161 | adi,range-microamp = <0 55000>; |
| 167 | }; | 162 | }; |
| 168 | 163 | ||
| 169 | channel@3 { | 164 | channel@3 { |
| 170 | num = <3>; | 165 | reg = <3>; |
| 171 | adi,range-microamp = <0 45000>; | 166 | adi,range-microamp = <0 45000>; |
| 172 | }; | 167 | }; |
| 173 | 168 | ||
| 174 | channel@4 { | 169 | channel@4 { |
| 175 | num = <4>; | 170 | reg = <4>; |
| 176 | adi,range-microamp = <0 45000>; | 171 | adi,range-microamp = <0 45000>; |
| 177 | }; | 172 | }; |
| 178 | 173 | ||
| 179 | channel@5 { | 174 | channel@5 { |
| 180 | num = <5>; | 175 | reg = <5>; |
| 181 | adi,range-microamp = <0 45000>; | 176 | adi,range-microamp = <0 45000>; |
| 182 | }; | 177 | }; |
| 183 | }; | 178 | }; |
| @@ -109,7 +109,7 @@ examples: · 108 unmodified lines | |||
| 109 | - | | 109 | - | |
| 110 | #include <dt-bindings/gpio/gpio.h> | 110 | #include <dt-bindings/gpio/gpio.h> |
| 111 | #include <dt-bindings/interrupt-controller/arm-gic.h> | 111 | #include <dt-bindings/interrupt-controller/arm-gic.h> |
| 112 | i2c@00000000 { | 112 | i2c { |
| 113 | #address-cells = <1>; | 113 | #address-cells = <1>; |
| 114 | #size-cells = <0>; | 114 | #size-cells = <0>; |
| 115 | edt-ft5x06@38 { | 115 | edt-ft5x06@38 { |
| @@ -56,9 +56,8 @@ properties: · 55 unmodified lines | |||
| 56 | cell with zero. | 56 | cell with zero. |
| 57 | allOf: | 57 | allOf: |
| 58 | - $ref: /schemas/types.yaml#/definitions/uint32-array | 58 | - $ref: /schemas/types.yaml#/definitions/uint32-array |
| 59 | - items: | 59 | - minItems: 4 |
| 60 | minItems: 4 | 60 | maxItems: 4 |
| 61 | maxItems: 4 | ||
| 62 | 61 | ||
| 63 | 62 | ||
| 64 | required: | 63 | required: |
| @@ -97,30 +97,35 @@ examples: · 96 unmodified lines | |||
| 97 | #include <dt-bindings/clock/tegra186-clock.h> | 97 | #include <dt-bindings/clock/tegra186-clock.h> |
| 98 | #include <dt-bindings/interrupt-controller/arm-gic.h> | 98 | #include <dt-bindings/interrupt-controller/arm-gic.h> |
| 99 | 99 | ||
| 100 | memory-controller@2c00000 { | 100 | bus { |
| 101 | compatible = "nvidia,tegra186-mc"; | ||
| 102 | reg = <0x0 0x02c00000 0x0 0xb0000>; | ||
| 103 | interrupts = <GIC_SPI 223 IRQ_TYPE_LEVEL_HIGH>; | ||
| 104 | |||
| 105 | #address-cells = <2>; | 101 | #address-cells = <2>; |
| 106 | #size-cells = <2>; | 102 | #size-cells = <2>; |
| 107 | 103 | ||
| 108 | ranges = <0x0 0x02c00000 0x02c00000 0x0 0xb0000>; | 104 | memory-controller@2c00000 { |
| 105 | compatible = "nvidia,tegra186-mc"; | ||
| 106 | reg = <0x0 0x02c00000 0x0 0xb0000>; | ||
| 107 | interrupts = <GIC_SPI 223 IRQ_TYPE_LEVEL_HIGH>; | ||
| 108 | |||
| 109 | #address-cells = <2>; | ||
| 110 | #size-cells = <2>; | ||
| 111 | |||
| 112 | ranges = <0x0 0x02c00000 0x0 0x02c00000 0x0 0xb0000>; | ||
| 109 | 113 | ||
| 110 | /* | 114 | /* |
| 111 | * Memory clients have access to all 40 bits that the memory | 115 | * Memory clients have access to all 40 bits that the memory |
| 112 | * controller can address. | 116 | * controller can address. |
| 113 | */ | 117 | */ |
| 114 | dma-ranges = <0x0 0x0 0x0 0x0 0x100 0x0>; | 118 | dma-ranges = <0x0 0x0 0x0 0x0 0x100 0x0>; |
| 115 | 119 | ||
| 116 | external-memory-controller@2c60000 { | 120 | external-memory-controller@2c60000 { |
| 117 | compatible = "nvidia,tegra186-emc"; | 121 | compatible = "nvidia,tegra186-emc"; |
| 118 | reg = <0x0 0x02c60000 0x0 0x50000>; | 122 | reg = <0x0 0x02c60000 0x0 0x50000>; |
| 119 | interrupts = <GIC_SPI 224 IRQ_TYPE_LEVEL_HIGH>; | 123 | interrupts = <GIC_SPI 224 IRQ_TYPE_LEVEL_HIGH>; |
| 120 | clocks = <&bpmp TEGRA186_CLK_EMC>; | 124 | clocks = <&bpmp TEGRA186_CLK_EMC>; |
| 121 | clock-names = "emc"; | 125 | clock-names = "emc"; |
| 122 | 126 | ||
| 123 | nvidia,bpmp = <&bpmp>; | 127 | nvidia,bpmp = <&bpmp>; |
| 128 | }; | ||
| 124 | }; | 129 | }; |
| 125 | }; | 130 | }; |
| 126 | 131 | ||
| @@ -123,7 +123,9 @@ examples: · 122 unmodified lines | |||
| 123 | #include <dt-bindings/leds/common.h> | 123 | #include <dt-bindings/leds/common.h> |
| 124 | 124 | ||
| 125 | i2c { | 125 | i2c { |
| 126 | pmic: pmic@4b { | 126 | #address-cells = <1>; |
| 127 | #size-cells = <0>; | ||
| 128 | pmic: pmic@4b { | ||
| 127 | compatible = "rohm,bd71837"; | 129 | compatible = "rohm,bd71837"; |
| 128 | reg = <0x4b>; | 130 | reg = <0x4b>; |
| 129 | interrupt-parent = <&gpio1>; | 131 | interrupt-parent = <&gpio1>; |
| @@ -128,7 +128,9 @@ examples: · 127 unmodified lines | |||
| 128 | #include <dt-bindings/leds/common.h> | 128 | #include <dt-bindings/leds/common.h> |
| 129 | 129 | ||
| 130 | i2c { | 130 | i2c { |
| 131 | pmic: pmic@4b { | 131 | #address-cells = <1>; |
| 132 | #size-cells = <0>; | ||
| 133 | pmic: pmic@4b { | ||
| 132 | compatible = "rohm,bd71847"; | 134 | compatible = "rohm,bd71847"; |
| 133 | reg = <0x4b>; | 135 | reg = <0x4b>; |
| 134 | interrupt-parent = <&gpio1>; | 136 | interrupt-parent = <&gpio1>; |
| @@ -259,8 +259,6 @@ properties: · 258 unmodified lines | |||
| 259 | 259 | ||
| 260 | additionalProperties: false | 260 | additionalProperties: false |
| 261 | 261 | ||
| 262 | additionalProperties: false | ||
| 263 | |||
| 264 | additionalProperties: false | 262 | additionalProperties: false |
| 265 | 263 | ||
| 266 | required: | 264 | required: |
| @@ -274,7 +272,7 @@ examples: · 7 unmodified lines | |||
| 274 | - | | 272 | - | |
| 275 | #include <dt-bindings/mfd/st,stpmic1.h> | 273 | #include <dt-bindings/mfd/st,stpmic1.h> |
| 276 | #include <dt-bindings/interrupt-controller/arm-gic.h> | 274 | #include <dt-bindings/interrupt-controller/arm-gic.h> |
| 277 | i2c@0 { | 275 | i2c { |
| 278 | #address-cells = <1>; | 276 | #address-cells = <1>; |
| 279 | #size-cells = <0>; | 277 | #size-cells = <0>; |
| 280 | pmic@33 { | 278 | pmic@33 { |
| @@ -43,6 +43,9 @@ properties: · 42 unmodified lines | |||
| 43 | second group of digits is the Phy Identifier 2 register, | 43 | second group of digits is the Phy Identifier 2 register, |
| 44 | this is the chip vendor OUI bits 19:24, followed by 10 | 44 | this is the chip vendor OUI bits 19:24, followed by 10 |
| 45 | bits of a vendor specific ID. | 45 | bits of a vendor specific ID. |
| 46 | - items: | ||
| 47 | - pattern: "^ethernet-phy-id[a-f0-9]{4}\\.[a-f0-9]{4}$" | ||
| 48 | - const: ethernet-phy-ieee802.3-c22 | ||
| 46 | - items: | 49 | - items: |
| 47 | - pattern: "^ethernet-phy-id[a-f0-9]{4}\\.[a-f0-9]{4}$" | 50 | - pattern: "^ethernet-phy-id[a-f0-9]{4}\\.[a-f0-9]{4}$" |
| 48 | - const: ethernet-phy-ieee802.3-c45 | 51 | - const: ethernet-phy-ieee802.3-c45 |
| @@ -22,6 +22,8 @@ Optional properties: · 21 unmodified lines | |||
| 22 | - fsl,err006687-workaround-present: If present indicates that the system has | 22 | - fsl,err006687-workaround-present: If present indicates that the system has |
| 23 | the hardware workaround for ERR006687 applied and does not need a software | 23 | the hardware workaround for ERR006687 applied and does not need a software |
| 24 | workaround. | 24 | workaround. |
| 25 | - gpr: phandle of SoC general purpose register mode. Required for wake on LAN | ||
| 26 | on some SoCs | ||
| 25 | -interrupt-names: names of the interrupts listed in interrupts property in | 27 | -interrupt-names: names of the interrupts listed in interrupts property in |
| 26 | the same order. The defaults if not specified are | 28 | the same order. The defaults if not specified are |
| 27 | __Number of interrupts__ __Default__ | 29 | __Number of interrupts__ __Default__ |
| @@ -48,6 +48,7 @@ examples: · 47 unmodified lines | |||
| 48 | 48 | ||
| 49 | switch@10 { | 49 | switch@10 { |
| 50 | compatible = "qca,qca8337"; | 50 | compatible = "qca,qca8337"; |
| 51 | reg = <0x10>; | ||
| 51 | /* ... */ | 52 | /* ... */ |
| 52 | }; | 53 | }; |
| 53 | }; | 54 | }; |
| @@ -29,7 +29,7 @@ Required properties for compatible string qcom,wcn399x-bt: · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | Optional properties for compatible string qcom,wcn399x-bt: | 30 | Optional properties for compatible string qcom,wcn399x-bt: |
| 31 | 31 | ||
| 32 | - max-speed: see Documentation/devicetree/bindings/serial/slave-device.txt | 32 | - max-speed: see Documentation/devicetree/bindings/serial/serial.yaml |
| 33 | - firmware-name: specify the name of nvm firmware to load | 33 | - firmware-name: specify the name of nvm firmware to load |
| 34 | - clocks: clock provided to the controller | 34 | - clocks: clock provided to the controller |
| 35 | 35 | ||
| @@ -97,7 +97,7 @@ then: · 96 unmodified lines | |||
| 97 | - $ref: /schemas/types.yaml#/definitions/uint32 | 97 | - $ref: /schemas/types.yaml#/definitions/uint32 |
| 98 | - minimum: 0 | 98 | - minimum: 0 |
| 99 | maximum: 63 | 99 | maximum: 63 |
| 100 | default: 0 | 100 | default: 32 |
| 101 | 101 | ||
| 102 | qcom,charge-ctrl-value: | 102 | qcom,charge-ctrl-value: |
| 103 | description: | 103 | description: |
| @@ -130,7 +130,7 @@ then: · 26 unmodified lines | |||
| 130 | - $ref: /schemas/types.yaml#/definitions/uint32 | 130 | - $ref: /schemas/types.yaml#/definitions/uint32 |
| 131 | - minimum: 0 | 131 | - minimum: 0 |
| 132 | maximum: 3 | 132 | maximum: 3 |
| 133 | default: 2 | 133 | default: 0 |
| 134 | 134 | ||
| 135 | qcom,preemphasis-width: | 135 | qcom,preemphasis-width: |
| 136 | description: | 136 | description: |
| @@ -152,7 +152,7 @@ then: · 15 unmodified lines | |||
| 152 | - $ref: /schemas/types.yaml#/definitions/uint32 | 152 | - $ref: /schemas/types.yaml#/definitions/uint32 |
| 153 | - minimum: 0 | 153 | - minimum: 0 |
| 154 | maximum: 3 | 154 | maximum: 3 |
| 155 | default: 0 | 155 | default: 1 |
| 156 | 156 | ||
| 157 | required: | 157 | required: |
| 158 | - compatible | 158 | - compatible |
| @@ -146,7 +146,7 @@ patternProperties: · 145 unmodified lines | |||
| 146 | bindings specified in | 146 | bindings specified in |
| 147 | Documentation/devicetree/bindings/phy/phy-cadence-sierra.txt | 147 | Documentation/devicetree/bindings/phy/phy-cadence-sierra.txt |
| 148 | Torrent SERDES should follow the bindings specified in | 148 | Torrent SERDES should follow the bindings specified in |
| 149 | Documentation/devicetree/bindings/phy/phy-cadence-dp.txt | 149 | Documentation/devicetree/bindings/phy/phy-cadence-torrent.yaml |
| 150 | 150 | ||
| 151 | required: | 151 | required: |
| 152 | - compatible | 152 | - compatible |
| @@ -31,10 +31,17 @@ additionalProperties: false · 30 unmodified lines | |||
| 31 | 31 | ||
| 32 | examples: | 32 | examples: |
| 33 | - | | 33 | - | |
| 34 | cros-ec@0 { | 34 | spi { |
| 35 | compatible = "google,cros-ec-spi"; | 35 | #address-cells = <1>; |
| 36 | cros_ec_pwm: ec-pwm { | 36 | #size-cells = <0>; |
| 37 | compatible = "google,cros-ec-pwm"; | 37 | |
| 38 | #pwm-cells = <1>; | 38 | cros-ec@0 { |
| 39 | compatible = "google,cros-ec-spi"; | ||
| 40 | reg = <0>; | ||
| 41 | |||
| 42 | cros_ec_pwm: ec-pwm { | ||
| 43 | compatible = "google,cros-ec-pwm"; | ||
| 44 | #pwm-cells = <1>; | ||
| 45 | }; | ||
| 39 | }; | 46 | }; |
| 40 | }; | 47 | }; |
| @@ -37,7 +37,6 @@ properties: · 36 unmodified lines | |||
| 37 | type: object | 37 | type: object |
| 38 | 38 | ||
| 39 | additionalProperties: false | 39 | additionalProperties: false |
| 40 | additionalProperties: false | ||
| 41 | 40 | ||
| 42 | required: | 41 | required: |
| 43 | - compatible | 42 | - compatible |
| @@ -75,7 +75,8 @@ properties: · 74 unmodified lines | |||
| 75 | description: | | 75 | description: | |
| 76 | disables over voltage protection of this buck | 76 | disables over voltage protection of this buck |
| 77 | 77 | ||
| 78 | additionalProperties: false | 78 | unevaluatedProperties: false |
| 79 | |||
| 79 | additionalProperties: false | 80 | additionalProperties: false |
| 80 | 81 | ||
| 81 | required: | 82 | required: |
| @@ -35,6 +35,8 @@ patternProperties: · 34 unmodified lines | |||
| 35 | description: | 35 | description: |
| 36 | should be "ldo1", ..., "ldo7" | 36 | should be "ldo1", ..., "ldo7" |
| 37 | 37 | ||
| 38 | unevaluatedProperties: false | ||
| 39 | |||
| 38 | "^BUCK[1-7]$": | 40 | "^BUCK[1-7]$": |
| 39 | type: object | 41 | type: object |
| 40 | allOf: | 42 | allOf: |
| @@ -103,5 +105,7 @@ patternProperties: · 62 unmodified lines | |||
| 103 | 105 | ||
| 104 | required: | 106 | required: |
| 105 | - regulator-name | 107 | - regulator-name |
| 106 | additionalProperties: false | 108 | |
| 109 | unevaluatedProperties: false | ||
| 110 | |||
| 107 | additionalProperties: false | 111 | additionalProperties: false |
| @@ -41,6 +41,8 @@ patternProperties: · 40 unmodified lines | |||
| 41 | description: | 41 | description: |
| 42 | should be "ldo1", ..., "ldo7" | 42 | should be "ldo1", ..., "ldo7" |
| 43 | 43 | ||
| 44 | unevaluatedProperties: false | ||
| 45 | |||
| 44 | "^BUCK[1-8]$": | 46 | "^BUCK[1-8]$": |
| 45 | type: object | 47 | type: object |
| 46 | allOf: | 48 | allOf: |
| @@ -99,5 +101,7 @@ patternProperties: · 52 unmodified lines | |||
| 99 | 101 | ||
| 100 | required: | 102 | required: |
| 101 | - regulator-name | 103 | - regulator-name |
| 102 | additionalProperties: false | 104 | |
| 105 | unevaluatedProperties: false | ||
| 106 | |||
| 103 | additionalProperties: false | 107 | additionalProperties: false |
| @@ -40,6 +40,8 @@ patternProperties: · 39 unmodified lines | |||
| 40 | description: | 40 | description: |
| 41 | should be "ldo1", ..., "ldo6" | 41 | should be "ldo1", ..., "ldo6" |
| 42 | 42 | ||
| 43 | unevaluatedProperties: false | ||
| 44 | |||
| 43 | "^BUCK[1-6]$": | 45 | "^BUCK[1-6]$": |
| 44 | type: object | 46 | type: object |
| 45 | allOf: | 47 | allOf: |
| @@ -93,5 +95,7 @@ patternProperties: · 47 unmodified lines | |||
| 93 | 95 | ||
| 94 | required: | 96 | required: |
| 95 | - regulator-name | 97 | - regulator-name |
| 96 | additionalProperties: false | 98 | |
| 99 | unevaluatedProperties: false | ||
| 100 | |||
| 97 | additionalProperties: false | 101 | additionalProperties: false |
| @@ -39,7 +39,7 @@ additionalProperties: false · 38 unmodified lines | |||
| 39 | 39 | ||
| 40 | examples: | 40 | examples: |
| 41 | - | | 41 | - | |
| 42 | rng { | 42 | rng@7e104000 { |
| 43 | compatible = "brcm,bcm2835-rng"; | 43 | compatible = "brcm,bcm2835-rng"; |
| 44 | reg = <0x7e104000 0x10>; | 44 | reg = <0x7e104000 0x10>; |
| 45 | interrupts = <2 29>; | 45 | interrupts = <2 29>; |
| @@ -56,6 +56,9 @@ properties: · 55 unmodified lines | |||
| 56 | - const: tx | 56 | - const: tx |
| 57 | - const: rx | 57 | - const: rx |
| 58 | 58 | ||
| 59 | power-domains: | ||
| 60 | maxItems: 1 | ||
| 61 | |||
| 59 | rockchip,capture-channels: | 62 | rockchip,capture-channels: |
| 60 | allOf: | 63 | allOf: |
| 61 | - $ref: /schemas/types.yaml#/definitions/uint32 | 64 | - $ref: /schemas/types.yaml#/definitions/uint32 |
| @@ -1,45 +0,0 @@ | |||
| 1 | * Rockchip SPDIF transceiver | ||
| 2 | |||
| 3 | The S/PDIF audio block is a stereo transceiver that allows the | ||
| 4 | processor to receive and transmit digital audio via an coaxial cable or | ||
| 5 | a fibre cable. | ||
| 6 | |||
| 7 | Required properties: | ||
| 8 | |||
| 9 | - compatible: should be one of the following: | ||
| 10 | - "rockchip,rk3066-spdif" | ||
| 11 | - "rockchip,rk3188-spdif" | ||
| 12 | - "rockchip,rk3228-spdif" | ||
| 13 | - "rockchip,rk3288-spdif" | ||
| 14 | - "rockchip,rk3328-spdif" | ||
| 15 | - "rockchip,rk3366-spdif" | ||
| 16 | - "rockchip,rk3368-spdif" | ||
| 17 | - "rockchip,rk3399-spdif" | ||
| 18 | - reg: physical base address of the controller and length of memory mapped | ||
| 19 | region. | ||
| 20 | - interrupts: should contain the SPDIF interrupt. | ||
| 21 | - dmas: DMA specifiers for tx dma. See the DMA client binding, | ||
| 22 | Documentation/devicetree/bindings/dma/dma.txt | ||
| 23 | - dma-names: should be "tx" | ||
| 24 | - clocks: a list of phandle + clock-specifier pairs, one for each entry | ||
| 25 | in clock-names. | ||
| 26 | - clock-names: should contain following: | ||
| 27 | - "hclk": clock for SPDIF controller | ||
| 28 | - "mclk" : clock for SPDIF bus | ||
| 29 | |||
| 30 | Required properties on RK3288: | ||
| 31 | - rockchip,grf: the phandle of the syscon node for the general register | ||
| 32 | file (GRF) | ||
| 33 | |||
| 34 | Example for the rk3188 SPDIF controller: | ||
| 35 | |||
| 36 | spdif: spdif@1011e000 { | ||
| 37 | compatible = "rockchip,rk3188-spdif", "rockchip,rk3066-spdif"; | ||
| 38 | reg = <0x1011e000 0x2000>; | ||
| 39 | interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; | ||
| 40 | dmas = <&dmac1_s 8>; | ||
| 41 | dma-names = "tx"; | ||
| 42 | clock-names = "hclk", "mclk"; | ||
| 43 | clocks = <&cru HCLK_SPDIF>, <&cru SCLK_SPDIF>; | ||
| 44 | #sound-dai-cells = <0>; | ||
| 45 | }; | ||
| @@ -0,0 +1,101 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/rockchip-spdif.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: Rockchip SPDIF transceiver | ||
| 8 | |||
| 9 | description: | ||
| 10 | The S/PDIF audio block is a stereo transceiver that allows the | ||
| 11 | processor to receive and transmit digital audio via a coaxial or | ||
| 12 | fibre cable. | ||
| 13 | |||
| 14 | maintainers: | ||
| 15 | - Heiko Stuebner <heiko@sntech.de> | ||
| 16 | |||
| 17 | properties: | ||
| 18 | compatible: | ||
| 19 | oneOf: | ||
| 20 | - const: rockchip,rk3066-spdif | ||
| 21 | - const: rockchip,rk3228-spdif | ||
| 22 | - const: rockchip,rk3328-spdif | ||
| 23 | - const: rockchip,rk3366-spdif | ||
| 24 | - const: rockchip,rk3368-spdif | ||
| 25 | - const: rockchip,rk3399-spdif | ||
| 26 | - items: | ||
| 27 | - enum: | ||
| 28 | - rockchip,rk3188-spdif | ||
| 29 | - rockchip,rk3288-spdif | ||
| 30 | - const: rockchip,rk3066-spdif | ||
| 31 | |||
| 32 | reg: | ||
| 33 | maxItems: 1 | ||
| 34 | |||
| 35 | interrupts: | ||
| 36 | maxItems: 1 | ||
| 37 | |||
| 38 | clocks: | ||
| 39 | items: | ||
| 40 | - description: clock for SPDIF bus | ||
| 41 | - description: clock for SPDIF controller | ||
| 42 | |||
| 43 | clock-names: | ||
| 44 | items: | ||
| 45 | - const: mclk | ||
| 46 | - const: hclk | ||
| 47 | |||
| 48 | dmas: | ||
| 49 | maxItems: 1 | ||
| 50 | |||
| 51 | dma-names: | ||
| 52 | const: tx | ||
| 53 | |||
| 54 | power-domains: | ||
| 55 | maxItems: 1 | ||
| 56 | |||
| 57 | rockchip,grf: | ||
| 58 | $ref: /schemas/types.yaml#/definitions/phandle | ||
| 59 | description: | ||
| 60 | The phandle of the syscon node for the GRF register. | ||
| 61 | Required property on RK3288. | ||
| 62 | |||
| 63 | "#sound-dai-cells": | ||
| 64 | const: 0 | ||
| 65 | |||
| 66 | required: | ||
| 67 | - compatible | ||
| 68 | - reg | ||
| 69 | - interrupts | ||
| 70 | - clocks | ||
| 71 | - clock-names | ||
| 72 | - dmas | ||
| 73 | - dma-names | ||
| 74 | - "#sound-dai-cells" | ||
| 75 | |||
| 76 | if: | ||
| 77 | properties: | ||
| 78 | compatible: | ||
| 79 | contains: | ||
| 80 | const: rockchip,rk3288-spdif | ||
| 81 | |||
| 82 | then: | ||
| 83 | required: | ||
| 84 | - rockchip,grf | ||
| 85 | |||
| 86 | additionalProperties: false | ||
| 87 | |||
| 88 | examples: | ||
| 89 | - | | ||
| 90 | #include <dt-bindings/clock/rk3188-cru.h> | ||
| 91 | #include <dt-bindings/interrupt-controller/arm-gic.h> | ||
| 92 | spdif: spdif@1011e000 { | ||
| 93 | compatible = "rockchip,rk3188-spdif", "rockchip,rk3066-spdif"; | ||
| 94 | reg = <0x1011e000 0x2000>; | ||
| 95 | interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; | ||
| 96 | clocks = <&cru SCLK_SPDIF>, <&cru HCLK_SPDIF>; | ||
| 97 | clock-names = "mclk", "hclk"; | ||
| 98 | dmas = <&dmac1_s 8>; | ||
| 99 | dma-names = "tx"; | ||
| 100 | #sound-dai-cells = <0>; | ||
| 101 | }; | ||
| @@ -61,7 +61,7 @@ examples: · 60 unmodified lines | |||
| 61 | #include <dt-bindings/clock/qcom,gcc-sdm845.h> | 61 | #include <dt-bindings/clock/qcom,gcc-sdm845.h> |
| 62 | #include <dt-bindings/interrupt-controller/arm-gic.h> | 62 | #include <dt-bindings/interrupt-controller/arm-gic.h> |
| 63 | 63 | ||
| 64 | soc: soc@0 { | 64 | soc: soc { |
| 65 | #address-cells = <2>; | 65 | #address-cells = <2>; |
| 66 | #size-cells = <2>; | 66 | #size-cells = <2>; |
| 67 | 67 | ||
| @@ -56,7 +56,7 @@ additionalProperties: false · 55 unmodified lines | |||
| 56 | examples: | 56 | examples: |
| 57 | - | | 57 | - | |
| 58 | #include <dt-bindings/clock/jz4740-cgu.h> | 58 | #include <dt-bindings/clock/jz4740-cgu.h> |
| 59 | usb_phy: usb-phy@0 { | 59 | usb_phy: usb-phy { |
| 60 | compatible = "usb-nop-xceiv"; | 60 | compatible = "usb-nop-xceiv"; |
| 61 | #phy-cells = <0>; | 61 | #phy-cells = <0>; |
| 62 | }; | 62 | }; |
| @@ -52,8 +52,8 @@ A child node must exist to represent the core DWC3 IP block. The name of · 51 unmodified lines | |||
| 52 | the node is not important. The content of the node is defined in dwc3.txt. | 52 | the node is not important. The content of the node is defined in dwc3.txt. |
| 53 | 53 | ||
| 54 | Phy documentation is provided in the following places: | 54 | Phy documentation is provided in the following places: |
| 55 | Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt - USB3 QMP PHY | 55 | Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt - USB3 QMP PHY |
| 56 | Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt - USB2 QUSB2 PHY | 56 | Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml - USB2 QUSB2 PHY |
| 57 | 57 | ||
| 58 | Example device nodes: | 58 | Example device nodes: |
| 59 | 59 | ||
| @@ -18,6 +18,7 @@ properties: · 17 unmodified lines | |||
| 18 | - renesas,r8a774c0-usb3-peri # RZ/G2E | 18 | - renesas,r8a774c0-usb3-peri # RZ/G2E |
| 19 | - renesas,r8a7795-usb3-peri # R-Car H3 | 19 | - renesas,r8a7795-usb3-peri # R-Car H3 |
| 20 | - renesas,r8a7796-usb3-peri # R-Car M3-W | 20 | - renesas,r8a7796-usb3-peri # R-Car M3-W |
| 21 | - renesas,r8a77961-usb3-peri # R-Car M3-W+ | ||
| 21 | - renesas,r8a77965-usb3-peri # R-Car M3-N | 22 | - renesas,r8a77965-usb3-peri # R-Car M3-N |
| 22 | - renesas,r8a77990-usb3-peri # R-Car E3 | 23 | - renesas,r8a77990-usb3-peri # R-Car E3 |
| 23 | - const: renesas,rcar-gen3-usb3-peri | 24 | - const: renesas,rcar-gen3-usb3-peri |
| @@ -40,6 +40,7 @@ properties: · 39 unmodified lines | |||
| 40 | - renesas,usbhs-r8a774c0 # RZ/G2E | 40 | - renesas,usbhs-r8a774c0 # RZ/G2E |
| 41 | - renesas,usbhs-r8a7795 # R-Car H3 | 41 | - renesas,usbhs-r8a7795 # R-Car H3 |
| 42 | - renesas,usbhs-r8a7796 # R-Car M3-W | 42 | - renesas,usbhs-r8a7796 # R-Car M3-W |
| 43 | - renesas,usbhs-r8a77961 # R-Car M3-W+ | ||
| 43 | - renesas,usbhs-r8a77965 # R-Car M3-N | 44 | - renesas,usbhs-r8a77965 # R-Car M3-N |
| 44 | - renesas,usbhs-r8a77990 # R-Car E3 | 45 | - renesas,usbhs-r8a77990 # R-Car E3 |
| 45 | - renesas,usbhs-r8a77995 # R-Car D3 | 46 | - renesas,usbhs-r8a77995 # R-Car D3 |
| @@ -16,7 +16,7 @@ A child node must exist to represent the core DWC3 IP block. The name of · 15 unmodified lines | |||
| 16 | the node is not important. The content of the node is defined in dwc3.txt. | 16 | the node is not important. The content of the node is defined in dwc3.txt. |
| 17 | 17 | ||
| 18 | Phy documentation is provided in the following places: | 18 | Phy documentation is provided in the following places: |
| 19 | Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt - USB2.0 PHY | 19 | Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml - USB2.0 PHY |
| 20 | Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt - Type-C PHY | 20 | Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt - Type-C PHY |
| 21 | 21 | ||
| 22 | Example device nodes: | 22 | Example device nodes: |
| @@ -16,7 +16,8 @@ Required properties: · 15 unmodified lines | |||
| 16 | - "renesas,xhci-r8a7791" for r8a7791 SoC | 16 | - "renesas,xhci-r8a7791" for r8a7791 SoC |
| 17 | - "renesas,xhci-r8a7793" for r8a7793 SoC | 17 | - "renesas,xhci-r8a7793" for r8a7793 SoC |
| 18 | - "renesas,xhci-r8a7795" for r8a7795 SoC | 18 | - "renesas,xhci-r8a7795" for r8a7795 SoC |
| 19 | - "renesas,xhci-r8a7796" for r8a7796 SoC | 19 | - "renesas,xhci-r8a7796" for r8a77960 SoC |
| 20 | - "renesas,xhci-r8a77961" for r8a77961 SoC | ||
| 20 | - "renesas,xhci-r8a77965" for r8a77965 SoC | 21 | - "renesas,xhci-r8a77965" for r8a77965 SoC |
| 21 | - "renesas,xhci-r8a77990" for r8a77990 SoC | 22 | - "renesas,xhci-r8a77990" for r8a77990 SoC |
| 22 | - "renesas,rcar-gen2-xhci" for a generic R-Car Gen2 or RZ/G1 compatible | 23 | - "renesas,rcar-gen2-xhci" for a generic R-Car Gen2 or RZ/G1 compatible |
| @@ -79,8 +79,8 @@ created with any of:: · 78 unmodified lines | |||
| 79 | struct dentry *parent, u8 *value); | 79 | struct dentry *parent, u8 *value); |
| 80 | void debugfs_create_u16(const char *name, umode_t mode, | 80 | void debugfs_create_u16(const char *name, umode_t mode, |
| 81 | struct dentry *parent, u16 *value); | 81 | struct dentry *parent, u16 *value); |
| 82 | struct dentry *debugfs_create_u32(const char *name, umode_t mode, | 82 | void debugfs_create_u32(const char *name, umode_t mode, |
| 83 | struct dentry *parent, u32 *value); | 83 | struct dentry *parent, u32 *value); |
| 84 | void debugfs_create_u64(const char *name, umode_t mode, | 84 | void debugfs_create_u64(const char *name, umode_t mode, |
| 85 | struct dentry *parent, u64 *value); | 85 | struct dentry *parent, u64 *value); |
| 86 | 86 | ||
| @@ -16,7 +16,7 @@ Supported chips: · 15 unmodified lines | |||
| 16 | 16 | ||
| 17 | * Renesas ISL68220 | 17 | * Renesas ISL68220 |
| 18 | 18 | ||
| 19 | Prefix: 'raa_dmpvr2_2rail' | 19 | Prefix: 'isl68220' |
| 20 | 20 | ||
| 21 | Addresses scanned: - | 21 | Addresses scanned: - |
| 22 | 22 | ||
| @@ -26,7 +26,7 @@ Supported chips: · 3 unmodified lines | |||
| 26 | 26 | ||
| 27 | * Renesas ISL68221 | 27 | * Renesas ISL68221 |
| 28 | 28 | ||
| 29 | Prefix: 'raa_dmpvr2_3rail' | 29 | Prefix: 'isl68221' |
| 30 | 30 | ||
| 31 | Addresses scanned: - | 31 | Addresses scanned: - |
| 32 | 32 | ||
| @@ -36,7 +36,7 @@ Supported chips: · 3 unmodified lines | |||
| 36 | 36 | ||
| 37 | * Renesas ISL68222 | 37 | * Renesas ISL68222 |
| 38 | 38 | ||
| 39 | Prefix: 'raa_dmpvr2_2rail' | 39 | Prefix: 'isl68222' |
| 40 | 40 | ||
| 41 | Addresses scanned: - | 41 | Addresses scanned: - |
| 42 | 42 | ||
| @@ -46,7 +46,7 @@ Supported chips: · 3 unmodified lines | |||
| 46 | 46 | ||
| 47 | * Renesas ISL68223 | 47 | * Renesas ISL68223 |
| 48 | 48 | ||
| 49 | Prefix: 'raa_dmpvr2_2rail' | 49 | Prefix: 'isl68223' |
| 50 | 50 | ||
| 51 | Addresses scanned: - | 51 | Addresses scanned: - |
| 52 | 52 | ||
| @@ -56,7 +56,7 @@ Supported chips: · 3 unmodified lines | |||
| 56 | 56 | ||
| 57 | * Renesas ISL68224 | 57 | * Renesas ISL68224 |
| 58 | 58 | ||
| 59 | Prefix: 'raa_dmpvr2_3rail' | 59 | Prefix: 'isl68224' |
| 60 | 60 | ||
| 61 | Addresses scanned: - | 61 | Addresses scanned: - |
| 62 | 62 | ||
| @@ -66,7 +66,7 @@ Supported chips: · 3 unmodified lines | |||
| 66 | 66 | ||
| 67 | * Renesas ISL68225 | 67 | * Renesas ISL68225 |
| 68 | 68 | ||
| 69 | Prefix: 'raa_dmpvr2_2rail' | 69 | Prefix: 'isl68225' |
| 70 | 70 | ||
| 71 | Addresses scanned: - | 71 | Addresses scanned: - |
| 72 | 72 | ||
| @@ -76,7 +76,7 @@ Supported chips: · 3 unmodified lines | |||
| 76 | 76 | ||
| 77 | * Renesas ISL68226 | 77 | * Renesas ISL68226 |
| 78 | 78 | ||
| 79 | Prefix: 'raa_dmpvr2_3rail' | 79 | Prefix: 'isl68226' |
| 80 | 80 | ||
| 81 | Addresses scanned: - | 81 | Addresses scanned: - |
| 82 | 82 | ||
| @@ -86,7 +86,7 @@ Supported chips: · 3 unmodified lines | |||
| 86 | 86 | ||
| 87 | * Renesas ISL68227 | 87 | * Renesas ISL68227 |
| 88 | 88 | ||
| 89 | Prefix: 'raa_dmpvr2_1rail' | 89 | Prefix: 'isl68227' |
| 90 | 90 | ||
| 91 | Addresses scanned: - | 91 | Addresses scanned: - |
| 92 | 92 | ||
| @@ -96,7 +96,7 @@ Supported chips: · 3 unmodified lines | |||
| 96 | 96 | ||
| 97 | * Renesas ISL68229 | 97 | * Renesas ISL68229 |
| 98 | 98 | ||
| 99 | Prefix: 'raa_dmpvr2_3rail' | 99 | Prefix: 'isl68229' |
| 100 | 100 | ||
| 101 | Addresses scanned: - | 101 | Addresses scanned: - |
| 102 | 102 | ||
| @@ -106,7 +106,7 @@ Supported chips: · 3 unmodified lines | |||
| 106 | 106 | ||
| 107 | * Renesas ISL68233 | 107 | * Renesas ISL68233 |
| 108 | 108 | ||
| 109 | Prefix: 'raa_dmpvr2_2rail' | 109 | Prefix: 'isl68233' |
| 110 | 110 | ||
| 111 | Addresses scanned: - | 111 | Addresses scanned: - |
| 112 | 112 | ||
| @@ -116,7 +116,7 @@ Supported chips: · 3 unmodified lines | |||
| 116 | 116 | ||
| 117 | * Renesas ISL68239 | 117 | * Renesas ISL68239 |
| 118 | 118 | ||
| 119 | Prefix: 'raa_dmpvr2_3rail' | 119 | Prefix: 'isl68239' |
| 120 | 120 | ||
| 121 | Addresses scanned: - | 121 | Addresses scanned: - |
| 122 | 122 | ||
| @@ -126,7 +126,7 @@ Supported chips: · 3 unmodified lines | |||
| 126 | 126 | ||
| 127 | * Renesas ISL69222 | 127 | * Renesas ISL69222 |
| 128 | 128 | ||
| 129 | Prefix: 'raa_dmpvr2_2rail' | 129 | Prefix: 'isl69222' |
| 130 | 130 | ||
| 131 | Addresses scanned: - | 131 | Addresses scanned: - |
| 132 | 132 | ||
| @@ -136,7 +136,7 @@ Supported chips: · 3 unmodified lines | |||
| 136 | 136 | ||
| 137 | * Renesas ISL69223 | 137 | * Renesas ISL69223 |
| 138 | 138 | ||
| 139 | Prefix: 'raa_dmpvr2_3rail' | 139 | Prefix: 'isl69223' |
| 140 | 140 | ||
| 141 | Addresses scanned: - | 141 | Addresses scanned: - |
| 142 | 142 | ||
| @@ -146,7 +146,7 @@ Supported chips: · 3 unmodified lines | |||
| 146 | 146 | ||
| 147 | * Renesas ISL69224 | 147 | * Renesas ISL69224 |
| 148 | 148 | ||
| 149 | Prefix: 'raa_dmpvr2_2rail' | 149 | Prefix: 'isl69224' |
| 150 | 150 | ||
| 151 | Addresses scanned: - | 151 | Addresses scanned: - |
| 152 | 152 | ||
| @@ -156,7 +156,7 @@ Supported chips: · 3 unmodified lines | |||
| 156 | 156 | ||
| 157 | * Renesas ISL69225 | 157 | * Renesas ISL69225 |
| 158 | 158 | ||
| 159 | Prefix: 'raa_dmpvr2_2rail' | 159 | Prefix: 'isl69225' |
| 160 | 160 | ||
| 161 | Addresses scanned: - | 161 | Addresses scanned: - |
| 162 | 162 | ||
| @@ -166,7 +166,7 @@ Supported chips: · 3 unmodified lines | |||
| 166 | 166 | ||
| 167 | * Renesas ISL69227 | 167 | * Renesas ISL69227 |
| 168 | 168 | ||
| 169 | Prefix: 'raa_dmpvr2_3rail' | 169 | Prefix: 'isl69227' |
| 170 | 170 | ||
| 171 | Addresses scanned: - | 171 | Addresses scanned: - |
| 172 | 172 | ||
| @@ -176,7 +176,7 @@ Supported chips: · 3 unmodified lines | |||
| 176 | 176 | ||
| 177 | * Renesas ISL69228 | 177 | * Renesas ISL69228 |
| 178 | 178 | ||
| 179 | Prefix: 'raa_dmpvr2_3rail' | 179 | Prefix: 'isl69228' |
| 180 | 180 | ||
| 181 | Addresses scanned: - | 181 | Addresses scanned: - |
| 182 | 182 | ||
| @@ -186,7 +186,7 @@ Supported chips: · 3 unmodified lines | |||
| 186 | 186 | ||
| 187 | * Renesas ISL69234 | 187 | * Renesas ISL69234 |
| 188 | 188 | ||
| 189 | Prefix: 'raa_dmpvr2_2rail' | 189 | Prefix: 'isl69234' |
| 190 | 190 | ||
| 191 | Addresses scanned: - | 191 | Addresses scanned: - |
| 192 | 192 | ||
| @@ -196,7 +196,7 @@ Supported chips: · 3 unmodified lines | |||
| 196 | 196 | ||
| 197 | * Renesas ISL69236 | 197 | * Renesas ISL69236 |
| 198 | 198 | ||
| 199 | Prefix: 'raa_dmpvr2_2rail' | 199 | Prefix: 'isl69236' |
| 200 | 200 | ||
| 201 | Addresses scanned: - | 201 | Addresses scanned: - |
| 202 | 202 | ||
| @@ -206,7 +206,7 @@ Supported chips: · 3 unmodified lines | |||
| 206 | 206 | ||
| 207 | * Renesas ISL69239 | 207 | * Renesas ISL69239 |
| 208 | 208 | ||
| 209 | Prefix: 'raa_dmpvr2_3rail' | 209 | Prefix: 'isl69239' |
| 210 | 210 | ||
| 211 | Addresses scanned: - | 211 | Addresses scanned: - |
| 212 | 212 | ||
| @@ -216,7 +216,7 @@ Supported chips: · 3 unmodified lines | |||
| 216 | 216 | ||
| 217 | * Renesas ISL69242 | 217 | * Renesas ISL69242 |
| 218 | 218 | ||
| 219 | Prefix: 'raa_dmpvr2_2rail' | 219 | Prefix: 'isl69242' |
| 220 | 220 | ||
| 221 | Addresses scanned: - | 221 | Addresses scanned: - |
| 222 | 222 | ||
| @@ -226,7 +226,7 @@ Supported chips: · 3 unmodified lines | |||
| 226 | 226 | ||
| 227 | * Renesas ISL69243 | 227 | * Renesas ISL69243 |
| 228 | 228 | ||
| 229 | Prefix: 'raa_dmpvr2_1rail' | 229 | Prefix: 'isl69243' |
| 230 | 230 | ||
| 231 | Addresses scanned: - | 231 | Addresses scanned: - |
| 232 | 232 | ||
| @@ -236,7 +236,7 @@ Supported chips: · 3 unmodified lines | |||
| 236 | 236 | ||
| 237 | * Renesas ISL69247 | 237 | * Renesas ISL69247 |
| 238 | 238 | ||
| 239 | Prefix: 'raa_dmpvr2_2rail' | 239 | Prefix: 'isl69247' |
| 240 | 240 | ||
| 241 | Addresses scanned: - | 241 | Addresses scanned: - |
| 242 | 242 | ||
| @@ -246,7 +246,7 @@ Supported chips: · 3 unmodified lines | |||
| 246 | 246 | ||
| 247 | * Renesas ISL69248 | 247 | * Renesas ISL69248 |
| 248 | 248 | ||
| 249 | Prefix: 'raa_dmpvr2_2rail' | 249 | Prefix: 'isl69248' |
| 250 | 250 | ||
| 251 | Addresses scanned: - | 251 | Addresses scanned: - |
| 252 | 252 | ||
| @@ -256,7 +256,7 @@ Supported chips: · 3 unmodified lines | |||
| 256 | 256 | ||
| 257 | * Renesas ISL69254 | 257 | * Renesas ISL69254 |
| 258 | 258 | ||
| 259 | Prefix: 'raa_dmpvr2_2rail' | 259 | Prefix: 'isl69254' |
| 260 | 260 | ||
| 261 | Addresses scanned: - | 261 | Addresses scanned: - |
| 262 | 262 | ||
| @@ -266,7 +266,7 @@ Supported chips: · 3 unmodified lines | |||
| 266 | 266 | ||
| 267 | * Renesas ISL69255 | 267 | * Renesas ISL69255 |
| 268 | 268 | ||
| 269 | Prefix: 'raa_dmpvr2_2rail' | 269 | Prefix: 'isl69255' |
| 270 | 270 | ||
| 271 | Addresses scanned: - | 271 | Addresses scanned: - |
| 272 | 272 | ||
| @@ -276,7 +276,7 @@ Supported chips: · 3 unmodified lines | |||
| 276 | 276 | ||
| 277 | * Renesas ISL69256 | 277 | * Renesas ISL69256 |
| 278 | 278 | ||
| 279 | Prefix: 'raa_dmpvr2_2rail' | 279 | Prefix: 'isl69256' |
| 280 | 280 | ||
| 281 | Addresses scanned: - | 281 | Addresses scanned: - |
| 282 | 282 | ||
| @@ -286,7 +286,7 @@ Supported chips: · 3 unmodified lines | |||
| 286 | 286 | ||
| 287 | * Renesas ISL69259 | 287 | * Renesas ISL69259 |
| 288 | 288 | ||
| 289 | Prefix: 'raa_dmpvr2_2rail' | 289 | Prefix: 'isl69259' |
| 290 | 290 | ||
| 291 | Addresses scanned: - | 291 | Addresses scanned: - |
| 292 | 292 | ||
| @@ -296,7 +296,7 @@ Supported chips: · 3 unmodified lines | |||
| 296 | 296 | ||
| 297 | * Renesas ISL69260 | 297 | * Renesas ISL69260 |
| 298 | 298 | ||
| 299 | Prefix: 'raa_dmpvr2_2rail' | 299 | Prefix: 'isl69260' |
| 300 | 300 | ||
| 301 | Addresses scanned: - | 301 | Addresses scanned: - |
| 302 | 302 | ||
| @@ -306,7 +306,7 @@ Supported chips: · 3 unmodified lines | |||
| 306 | 306 | ||
| 307 | * Renesas ISL69268 | 307 | * Renesas ISL69268 |
| 308 | 308 | ||
| 309 | Prefix: 'raa_dmpvr2_2rail' | 309 | Prefix: 'isl69268' |
| 310 | 310 | ||
| 311 | Addresses scanned: - | 311 | Addresses scanned: - |
| 312 | 312 | ||
| @@ -316,7 +316,7 @@ Supported chips: · 3 unmodified lines | |||
| 316 | 316 | ||
| 317 | * Renesas ISL69269 | 317 | * Renesas ISL69269 |
| 318 | 318 | ||
| 319 | Prefix: 'raa_dmpvr2_3rail' | 319 | Prefix: 'isl69269' |
| 320 | 320 | ||
| 321 | Addresses scanned: - | 321 | Addresses scanned: - |
| 322 | 322 | ||
| @@ -326,7 +326,7 @@ Supported chips: · 3 unmodified lines | |||
| 326 | 326 | ||
| 327 | * Renesas ISL69298 | 327 | * Renesas ISL69298 |
| 328 | 328 | ||
| 329 | Prefix: 'raa_dmpvr2_2rail' | 329 | Prefix: 'isl69298' |
| 330 | 330 | ||
| 331 | Addresses scanned: - | 331 | Addresses scanned: - |
| 332 | 332 | ||
| @@ -336,7 +336,7 @@ Supported chips: · 3 unmodified lines | |||
| 336 | 336 | ||
| 337 | * Renesas RAA228000 | 337 | * Renesas RAA228000 |
| 338 | 338 | ||
| 339 | Prefix: 'raa_dmpvr2_hv' | 339 | Prefix: 'raa228000' |
| 340 | 340 | ||
| 341 | Addresses scanned: - | 341 | Addresses scanned: - |
| 342 | 342 | ||
| @@ -346,7 +346,7 @@ Supported chips: · 3 unmodified lines | |||
| 346 | 346 | ||
| 347 | * Renesas RAA228004 | 347 | * Renesas RAA228004 |
| 348 | 348 | ||
| 349 | Prefix: 'raa_dmpvr2_hv' | 349 | Prefix: 'raa228004' |
| 350 | 350 | ||
| 351 | Addresses scanned: - | 351 | Addresses scanned: - |
| 352 | 352 | ||
| @@ -356,7 +356,7 @@ Supported chips: · 3 unmodified lines | |||
| 356 | 356 | ||
| 357 | * Renesas RAA228006 | 357 | * Renesas RAA228006 |
| 358 | 358 | ||
| 359 | Prefix: 'raa_dmpvr2_hv' | 359 | Prefix: 'raa228006' |
| 360 | 360 | ||
| 361 | Addresses scanned: - | 361 | Addresses scanned: - |
| 362 | 362 | ||
| @@ -366,7 +366,7 @@ Supported chips: · 3 unmodified lines | |||
| 366 | 366 | ||
| 367 | * Renesas RAA228228 | 367 | * Renesas RAA228228 |
| 368 | 368 | ||
| 369 | Prefix: 'raa_dmpvr2_2rail' | 369 | Prefix: 'raa228228' |
| 370 | 370 | ||
| 371 | Addresses scanned: - | 371 | Addresses scanned: - |
| 372 | 372 | ||
| @@ -376,7 +376,7 @@ Supported chips: · 3 unmodified lines | |||
| 376 | 376 | ||
| 377 | * Renesas RAA229001 | 377 | * Renesas RAA229001 |
| 378 | 378 | ||
| 379 | Prefix: 'raa_dmpvr2_2rail' | 379 | Prefix: 'raa229001' |
| 380 | 380 | ||
| 381 | Addresses scanned: - | 381 | Addresses scanned: - |
| 382 | 382 | ||
| @@ -386,7 +386,7 @@ Supported chips: · 3 unmodified lines | |||
| 386 | 386 | ||
| 387 | * Renesas RAA229004 | 387 | * Renesas RAA229004 |
| 388 | 388 | ||
| 389 | Prefix: 'raa_dmpvr2_2rail' | 389 | Prefix: 'raa229004' |
| 390 | 390 | ||
| 391 | Addresses scanned: - | 391 | Addresses scanned: - |
| 392 | 392 | ||
| @@ -1241,7 +1241,8 @@ When kbuild executes, the following steps are followed (roughly): · 1240 unmodified lines | |||
| 1241 | will be displayed with "make KBUILD_VERBOSE=0". | 1241 | will be displayed with "make KBUILD_VERBOSE=0". |
| 1242 | 1242 | ||
| 1243 | 1243 | ||
| 1244 | --- 6.9 Preprocessing linker scripts | 1244 | 6.9 Preprocessing linker scripts |
| 1245 | -------------------------------- | ||
| 1245 | 1246 | ||
| 1246 | When the vmlinux image is built, the linker script | 1247 | When the vmlinux image is built, the linker script |
| 1247 | arch/$(ARCH)/kernel/vmlinux.lds is used. | 1248 | arch/$(ARCH)/kernel/vmlinux.lds is used. |
| @@ -257,6 +257,8 @@ drivers: · 256 unmodified lines | |||
| 257 | * :doc:`netdevsim` | 257 | * :doc:`netdevsim` |
| 258 | * :doc:`mlxsw` | 258 | * :doc:`mlxsw` |
| 259 | 259 | ||
| 260 | .. _Generic-Packet-Trap-Groups: | ||
| 261 | |||
| 260 | Generic Packet Trap Groups | 262 | Generic Packet Trap Groups |
| 261 | ========================== | 263 | ========================== |
| 262 | 264 | ||
| @@ -22,6 +22,7 @@ Contents: · 21 unmodified lines | |||
| 22 | z8530book | 22 | z8530book |
| 23 | msg_zerocopy | 23 | msg_zerocopy |
| 24 | failover | 24 | failover |
| 25 | net_dim | ||
| 25 | net_failover | 26 | net_failover |
| 26 | phy | 27 | phy |
| 27 | sfp-phylink | 28 | sfp-phylink |
| @@ -812,7 +812,7 @@ tcp_limit_output_bytes - INTEGER · 811 unmodified lines | |||
| 812 | tcp_challenge_ack_limit - INTEGER | 812 | tcp_challenge_ack_limit - INTEGER |
| 813 | Limits number of Challenge ACK sent per second, as recommended | 813 | Limits number of Challenge ACK sent per second, as recommended |
| 814 | in RFC 5961 (Improving TCP's Robustness to Blind In-Window Attacks) | 814 | in RFC 5961 (Improving TCP's Robustness to Blind In-Window Attacks) |
| 815 | Default: 100 | 815 | Default: 1000 |
| 816 | 816 | ||
| 817 | tcp_rx_skb_cache - BOOLEAN | 817 | tcp_rx_skb_cache - BOOLEAN |
| 818 | Controls a per TCP socket cache of one skb, that might help | 818 | Controls a per TCP socket cache of one skb, that might help |
| @@ -983,6 +983,13 @@ ip_early_demux - BOOLEAN · 164 unmodified lines | |||
| 983 | reduces overall throughput, in such case you should disable it. | 983 | reduces overall throughput, in such case you should disable it. |
| 984 | Default: 1 | 984 | Default: 1 |
| 985 | 985 | ||
| 986 | ping_group_range - 2 INTEGERS | ||
| 987 | Restrict ICMP_PROTO datagram sockets to users in the group range. | ||
| 988 | The default is "1 0", meaning, that nobody (not even root) may | ||
| 989 | create ping sockets. Setting it to "100 100" would grant permissions | ||
| 990 | to the single group. "0 4294967295" would enable it for the world, "100 | ||
| 991 | 4294967295" would enable it for the users, but not daemons. | ||
| 992 | |||
| 986 | tcp_early_demux - BOOLEAN | 993 | tcp_early_demux - BOOLEAN |
| 987 | Enable early demux for established TCP sockets. | 994 | Enable early demux for established TCP sockets. |
| 988 | Default: 1 | 995 | Default: 1 |
| @@ -1,28 +1,20 @@ | |||
| 1 | ====================================================== | ||
| 1 | Net DIM - Generic Network Dynamic Interrupt Moderation | 2 | Net DIM - Generic Network Dynamic Interrupt Moderation |
| 2 | ====================================================== | 3 | ====================================================== |
| 3 | 4 | ||
| 4 | Author: | 5 | :Author: Tal Gilboa <talgi@mellanox.com> |
| 5 | Tal Gilboa <talgi@mellanox.com> | ||
| 6 | |||
| 7 | |||
| 8 | Contents | ||
| 9 | ========= | ||
| 10 | 6 | ||
| 11 | - Assumptions | 7 | .. contents:: :depth: 2 |
| 12 | - Introduction | ||
| 13 | - The Net DIM Algorithm | ||
| 14 | - Registering a Network Device to DIM | ||
| 15 | - Example | ||
| 16 | 8 | ||
| 17 | Part 0: Assumptions | 9 | Assumptions |
| 18 | ====================== | 10 | =========== |
| 19 | 11 | ||
| 20 | This document assumes the reader has basic knowledge in network drivers | 12 | This document assumes the reader has basic knowledge in network drivers |
| 21 | and in general interrupt moderation. | 13 | and in general interrupt moderation. |
| 22 | 14 | ||
| 23 | 15 | ||
| 24 | Part I: Introduction | 16 | Introduction |
| 25 | ====================== | 17 | ============ |
| 26 | 18 | ||
| 27 | Dynamic Interrupt Moderation (DIM) (in networking) refers to changing the | 19 | Dynamic Interrupt Moderation (DIM) (in networking) refers to changing the |
| 28 | interrupt moderation configuration of a channel in order to optimize packet | 20 | interrupt moderation configuration of a channel in order to optimize packet |
| @@ -41,14 +33,15 @@ number of wanted packets per event. The Net DIM algorithm ascribes importance to · 12 unmodified lines | |||
| 41 | increase bandwidth over reducing interrupt rate. | 33 | increase bandwidth over reducing interrupt rate. |
| 42 | 34 | ||
| 43 | 35 | ||
| 44 | Part II: The Net DIM Algorithm | 36 | Net DIM Algorithm |
| 45 | =============================== | 37 | ================= |
| 46 | 38 | ||
| 47 | Each iteration of the Net DIM algorithm follows these steps: | 39 | Each iteration of the Net DIM algorithm follows these steps: |
| 48 | 1. Calculates new data sample. | 40 | |
| 49 | 2. Compares it to previous sample. | 41 | #. Calculates new data sample. |
| 50 | 3. Makes a decision - suggests interrupt moderation configuration fields. | 42 | #. Compares it to previous sample. |
| 51 | 4. Applies a schedule work function, which applies suggested configuration. | 43 | #. Makes a decision - suggests interrupt moderation configuration fields. |
| 44 | #. Applies a schedule work function, which applies suggested configuration. | ||
| 52 | 45 | ||
| 53 | The first two steps are straightforward, both the new and the previous data are | 46 | The first two steps are straightforward, both the new and the previous data are |
| 54 | supplied by the driver registered to Net DIM. The previous data is the new data | 47 | supplied by the driver registered to Net DIM. The previous data is the new data |
| @@ -89,19 +82,21 @@ manoeuvre as it may provide partial data or ignore the algorithm suggestion · 34 unmodified lines | |||
| 89 | under some conditions. | 82 | under some conditions. |
| 90 | 83 | ||
| 91 | 84 | ||
| 92 | Part III: Registering a Network Device to DIM | 85 | Registering a Network Device to DIM |
| 93 | ============================================== | 86 | =================================== |
| 94 | 87 | ||
| 95 | Net DIM API exposes the main function net_dim(struct dim *dim, | 88 | Net DIM API exposes the main function net_dim(). |
| 96 | struct dim_sample end_sample). This function is the entry point to the Net | 89 | This function is the entry point to the Net |
| 97 | DIM algorithm and has to be called every time the driver would like to check if | 90 | DIM algorithm and has to be called every time the driver would like to check if |
| 98 | it should change interrupt moderation parameters. The driver should provide two | 91 | it should change interrupt moderation parameters. The driver should provide two |
| 99 | data structures: struct dim and struct dim_sample. Struct dim | 92 | data structures: :c:type:`struct dim <dim>` and |
| 93 | :c:type:`struct dim_sample <dim_sample>`. :c:type:`struct dim <dim>` | ||
| 100 | describes the state of DIM for a specific object (RX queue, TX queue, | 94 | describes the state of DIM for a specific object (RX queue, TX queue, |
| 101 | other queues, etc.). This includes the current selected profile, previous data | 95 | other queues, etc.). This includes the current selected profile, previous data |
| 102 | samples, the callback function provided by the driver and more. | 96 | samples, the callback function provided by the driver and more. |
| 103 | Struct dim_sample describes a data sample, which will be compared to the | 97 | :c:type:`struct dim_sample <dim_sample>` describes a data sample, |
| 104 | data sample stored in struct dim in order to decide on the algorithm's next | 98 | which will be compared to the data sample stored in :c:type:`struct dim <dim>` |
| 99 | in order to decide on the algorithm's next | ||
| 105 | step. The sample should include bytes, packets and interrupts, measured by | 100 | step. The sample should include bytes, packets and interrupts, measured by |
| 106 | the driver. | 101 | the driver. |
| 107 | 102 | ||
| @@ -110,9 +105,10 @@ main net_dim() function. The recommended method is to call net_dim() on each · 2 unmodified lines | |||
| 110 | interrupt. Since Net DIM has a built-in moderation and it might decide to skip | 105 | interrupt. Since Net DIM has a built-in moderation and it might decide to skip |
| 111 | iterations under certain conditions, there is no need to moderate the net_dim() | 106 | iterations under certain conditions, there is no need to moderate the net_dim() |
| 112 | calls as well. As mentioned above, the driver needs to provide an object of type | 107 | calls as well. As mentioned above, the driver needs to provide an object of type |
| 113 | struct dim to the net_dim() function call. It is advised for each entity | 108 | :c:type:`struct dim <dim>` to the net_dim() function call. It is advised for |
| 114 | using Net DIM to hold a struct dim as part of its data structure and use it | 109 | each entity using Net DIM to hold a :c:type:`struct dim <dim>` as part of its |
| 115 | as the main Net DIM API object. The struct dim_sample should hold the latest | 110 | data structure and use it as the main Net DIM API object. |
| 111 | The :c:type:`struct dim_sample <dim_sample>` should hold the latest | ||
| 116 | bytes, packets and interrupts count. No need to perform any calculations, just | 112 | bytes, packets and interrupts count. No need to perform any calculations, just |
| 117 | include the raw data. | 113 | include the raw data. |
| 118 | 114 | ||
| @@ -124,19 +120,19 @@ the data flow. After the work is done, Net DIM algorithm needs to be set to · 5 unmodified lines | |||
| 124 | the proper state in order to move to the next iteration. | 120 | the proper state in order to move to the next iteration. |
| 125 | 121 | ||
| 126 | 122 | ||
| 127 | Part IV: Example | 123 | Example |
| 128 | ================= | 124 | ======= |
| 129 | 125 | ||
| 130 | The following code demonstrates how to register a driver to Net DIM. The actual | 126 | The following code demonstrates how to register a driver to Net DIM. The actual |
| 131 | usage is not complete but it should make the outline of the usage clear. | 127 | usage is not complete but it should make the outline of the usage clear. |
| 132 | 128 | ||
| 133 | my_driver.c: | 129 | .. code-block:: c |
| 134 | 130 | ||
| 135 | #include <linux/dim.h> | 131 | #include <linux/dim.h> |
| 136 | 132 | ||
| 137 | /* Callback for net DIM to schedule on a decision to change moderation */ | 133 | /* Callback for net DIM to schedule on a decision to change moderation */ |
| 138 | void my_driver_do_dim_work(struct work_struct *work) | 134 | void my_driver_do_dim_work(struct work_struct *work) |
| 139 | { | 135 | { |
| 140 | /* Get struct dim from struct work_struct */ | 136 | /* Get struct dim from struct work_struct */ |
| 141 | struct dim *dim = container_of(work, struct dim, | 137 | struct dim *dim = container_of(work, struct dim, |
| 142 | work); | 138 | work); |
| @@ -145,11 +141,11 @@ void my_driver_do_dim_work(struct work_struct *work) · 2 unmodified lines | |||
| 145 | 141 | ||
| 146 | /* Signal net DIM work is done and it should move to next iteration */ | 142 | /* Signal net DIM work is done and it should move to next iteration */ |
| 147 | dim->state = DIM_START_MEASURE; | 143 | dim->state = DIM_START_MEASURE; |
| 148 | } | 144 | } |
| 149 | 145 | ||
| 150 | /* My driver's interrupt handler */ | 146 | /* My driver's interrupt handler */ |
| 151 | int my_driver_handle_interrupt(struct my_driver_entity *my_entity, ...) | 147 | int my_driver_handle_interrupt(struct my_driver_entity *my_entity, ...) |
| 152 | { | 148 | { |
| 153 | ... | 149 | ... |
| 154 | /* A struct to hold current measured data */ | 150 | /* A struct to hold current measured data */ |
| 155 | struct dim_sample dim_sample; | 151 | struct dim_sample dim_sample; |
| @@ -162,13 +158,19 @@ int my_driver_handle_interrupt(struct my_driver_entity *my_entity, ...) · 6 unmodified lines | |||
| 162 | /* Call net DIM */ | 158 | /* Call net DIM */ |
| 163 | net_dim(&my_entity->dim, dim_sample); | 159 | net_dim(&my_entity->dim, dim_sample); |
| 164 | ... | 160 | ... |
| 165 | } | 161 | } |
| 166 | 162 | ||
| 167 | /* My entity's initialization function (my_entity was already allocated) */ | 163 | /* My entity's initialization function (my_entity was already allocated) */ |
| 168 | int my_driver_init_my_entity(struct my_driver_entity *my_entity, ...) | 164 | int my_driver_init_my_entity(struct my_driver_entity *my_entity, ...) |
| 169 | { | 165 | { |
| 170 | ... | 166 | ... |
| 171 | /* Initiate struct work_struct with my driver's callback function */ | 167 | /* Initiate struct work_struct with my driver's callback function */ |
| 172 | INIT_WORK(&my_entity->dim.work, my_driver_do_dim_work); | 168 | INIT_WORK(&my_entity->dim.work, my_driver_do_dim_work); |
| 173 | ... | 169 | ... |
| 174 | } | 170 | } |
| 171 | |||
| 172 | Dynamic Interrupt Moderation (DIM) library API | ||
| 173 | ============================================== | ||
| 174 | |||
| 175 | .. kernel-doc:: include/linux/dim.h | ||
| 176 | :internal: | ||
| @@ -1399,8 +1399,8 @@ must have read/write permission; CS must be __BOOT_CS and DS, ES, SS · 1398 unmodified lines | |||
| 1399 | must be __BOOT_DS; interrupt must be disabled; %rsi must hold the base | 1399 | must be __BOOT_DS; interrupt must be disabled; %rsi must hold the base |
| 1400 | address of the struct boot_params. | 1400 | address of the struct boot_params. |
| 1401 | 1401 | ||
| 1402 | EFI Handover Protocol | 1402 | EFI Handover Protocol (deprecated) |
| 1403 | ===================== | 1403 | ================================== |
| 1404 | 1404 | ||
| 1405 | This protocol allows boot loaders to defer initialisation to the EFI | 1405 | This protocol allows boot loaders to defer initialisation to the EFI |
| 1406 | boot stub. The boot loader is required to load the kernel/initrd(s) | 1406 | boot stub. The boot loader is required to load the kernel/initrd(s) |
| @@ -1408,6 +1408,12 @@ from the boot media and jump to the EFI handover protocol entry point · 1 unmodified line | |||
| 1408 | which is hdr->handover_offset bytes from the beginning of | 1408 | which is hdr->handover_offset bytes from the beginning of |
| 1409 | startup_{32,64}. | 1409 | startup_{32,64}. |
| 1410 | 1410 | ||
| 1411 | The boot loader MUST respect the kernel's PE/COFF metadata when it comes | ||
| 1412 | to section alignment, the memory footprint of the executable image beyond | ||
| 1413 | the size of the file itself, and any other aspect of the PE/COFF header | ||
| 1414 | that may affect correct operation of the image as a PE/COFF binary in the | ||
| 1415 | execution context provided by the EFI firmware. | ||
| 1416 | |||
| 1411 | The function prototype for the handover entry point looks like this:: | 1417 | The function prototype for the handover entry point looks like this:: |
| 1412 | 1418 | ||
| 1413 | efi_main(void *handle, efi_system_table_t *table, struct boot_params *bp) | 1419 | efi_main(void *handle, efi_system_table_t *table, struct boot_params *bp) |
| @@ -1419,9 +1425,18 @@ UEFI specification. 'bp' is the boot loader-allocated boot params. · 5 unmodified lines | |||
| 1419 | 1425 | ||
| 1420 | The boot loader *must* fill out the following fields in bp:: | 1426 | The boot loader *must* fill out the following fields in bp:: |
| 1421 | 1427 | ||
| 1422 | - hdr.code32_start | ||
| 1423 | - hdr.cmd_line_ptr | 1428 | - hdr.cmd_line_ptr |
| 1424 | - hdr.ramdisk_image (if applicable) | 1429 | - hdr.ramdisk_image (if applicable) |
| 1425 | - hdr.ramdisk_size (if applicable) | 1430 | - hdr.ramdisk_size (if applicable) |
| 1426 | 1431 | ||
| 1427 | All other fields should be zero. | 1432 | All other fields should be zero. |
| 1433 | |||
| 1434 | NOTE: The EFI Handover Protocol is deprecated in favour of the ordinary PE/COFF | ||
| 1435 | entry point, combined with the LINUX_EFI_INITRD_MEDIA_GUID based initrd | ||
| 1436 | loading protocol (refer to [0] for an example of the bootloader side of | ||
| 1437 | this), which removes the need for any knowledge on the part of the EFI | ||
| 1438 | bootloader regarding the internal representation of boot_params or any | ||
| 1439 | requirements/limitations regarding the placement of the command line | ||
| 1440 | and ramdisk in memory, or the placement of the kernel image itself. | ||
| 1441 | |||
| 1442 | [0] https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0 | ||
| @@ -189,7 +189,7 @@ F: drivers/net/hamradio/6pack.c · 188 unmodified lines | |||
| 189 | M: Johannes Berg <johannes@sipsolutions.net> | 189 | M: Johannes Berg <johannes@sipsolutions.net> |
| 190 | L: linux-wireless@vger.kernel.org | 190 | L: linux-wireless@vger.kernel.org |
| 191 | S: Maintained | 191 | S: Maintained |
| 192 | W: http://wireless.kernel.org/ | 192 | W: https://wireless.wiki.kernel.org/ |
| 193 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git | 193 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git |
| 194 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git | 194 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git |
| 195 | F: Documentation/driver-api/80211/cfg80211.rst | 195 | F: Documentation/driver-api/80211/cfg80211.rst |
| @@ -505,7 +505,7 @@ F: drivers/hwmon/adm1029.c · 309 unmodified lines | |||
| 505 | ADM8211 WIRELESS DRIVER | 505 | ADM8211 WIRELESS DRIVER |
| 506 | L: linux-wireless@vger.kernel.org | 506 | L: linux-wireless@vger.kernel.org |
| 507 | S: Orphan | 507 | S: Orphan |
| 508 | W: http://wireless.kernel.org/ | 508 | W: https://wireless.wiki.kernel.org/ |
| 509 | F: drivers/net/wireless/admtek/adm8211.* | 509 | F: drivers/net/wireless/admtek/adm8211.* |
| 510 | 510 | ||
| 511 | ADP1653 FLASH CONTROLLER DRIVER | 511 | ADP1653 FLASH CONTROLLER DRIVER |
| @@ -570,7 +570,7 @@ F: Documentation/devicetree/bindings/iio/accel/adi,adxl345.yaml · 58 unmodified lines | |||
| 570 | F: drivers/input/misc/adxl34x.c | 570 | F: drivers/input/misc/adxl34x.c |
| 571 | 571 | ||
| 572 | ADXL372 THREE-AXIS DIGITAL ACCELEROMETER DRIVER | 572 | ADXL372 THREE-AXIS DIGITAL ACCELEROMETER DRIVER |
| 573 | M: Stefan Popa <stefan.popa@analog.com> | 573 | M: Michael Hennerich <michael.hennerich@analog.com> |
| 574 | S: Supported | 574 | S: Supported |
| 575 | W: http://ez.analog.com/community/linux-device-drivers | 575 | W: http://ez.analog.com/community/linux-device-drivers |
| 576 | F: Documentation/devicetree/bindings/iio/accel/adi,adxl372.yaml | 576 | F: Documentation/devicetree/bindings/iio/accel/adi,adxl372.yaml |
| @@ -922,7 +922,7 @@ F: arch/arm64/boot/dts/amd/amd-seattle-xgbe*.dtsi · 345 unmodified lines | |||
| 922 | F: drivers/net/ethernet/amd/xgbe/ | 922 | F: drivers/net/ethernet/amd/xgbe/ |
| 923 | 923 | ||
| 924 | ANALOG DEVICES INC AD5686 DRIVER | 924 | ANALOG DEVICES INC AD5686 DRIVER |
| 925 | M: Stefan Popa <stefan.popa@analog.com> | 925 | M: Michael Hennerich <Michael.Hennerich@analog.com> |
| 926 | L: linux-pm@vger.kernel.org | 926 | L: linux-pm@vger.kernel.org |
| 927 | S: Supported | 927 | S: Supported |
| 928 | W: http://ez.analog.com/community/linux-device-drivers | 928 | W: http://ez.analog.com/community/linux-device-drivers |
| @@ -930,7 +930,7 @@ F: drivers/iio/dac/ad5686* · 1 unmodified line | |||
| 930 | F: drivers/iio/dac/ad5696* | 930 | F: drivers/iio/dac/ad5696* |
| 931 | 931 | ||
| 932 | ANALOG DEVICES INC AD5758 DRIVER | 932 | ANALOG DEVICES INC AD5758 DRIVER |
| 933 | M: Stefan Popa <stefan.popa@analog.com> | 933 | M: Michael Hennerich <Michael.Hennerich@analog.com> |
| 934 | L: linux-iio@vger.kernel.org | 934 | L: linux-iio@vger.kernel.org |
| 935 | S: Supported | 935 | S: Supported |
| 936 | W: http://ez.analog.com/community/linux-device-drivers | 936 | W: http://ez.analog.com/community/linux-device-drivers |
| @@ -946,7 +946,7 @@ F: Documentation/devicetree/bindings/iio/adc/adi,ad7091r5.yaml · 9 unmodified lines | |||
| 946 | F: drivers/iio/adc/ad7091r5.c | 946 | F: drivers/iio/adc/ad7091r5.c |
| 947 | 947 | ||
| 948 | ANALOG DEVICES INC AD7124 DRIVER | 948 | ANALOG DEVICES INC AD7124 DRIVER |
| 949 | M: Stefan Popa <stefan.popa@analog.com> | 949 | M: Michael Hennerich <Michael.Hennerich@analog.com> |
| 950 | L: linux-iio@vger.kernel.org | 950 | L: linux-iio@vger.kernel.org |
| 951 | S: Supported | 951 | S: Supported |
| 952 | W: http://ez.analog.com/community/linux-device-drivers | 952 | W: http://ez.analog.com/community/linux-device-drivers |
| @@ -970,7 +970,7 @@ F: Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml · 17 unmodified lines | |||
| 970 | F: drivers/iio/adc/ad7292.c | 970 | F: drivers/iio/adc/ad7292.c |
| 971 | 971 | ||
| 972 | ANALOG DEVICES INC AD7606 DRIVER | 972 | ANALOG DEVICES INC AD7606 DRIVER |
| 973 | M: Stefan Popa <stefan.popa@analog.com> | 973 | M: Michael Hennerich <Michael.Hennerich@analog.com> |
| 974 | M: Beniamin Bia <beniamin.bia@analog.com> | 974 | M: Beniamin Bia <beniamin.bia@analog.com> |
| 975 | L: linux-iio@vger.kernel.org | 975 | L: linux-iio@vger.kernel.org |
| 976 | S: Supported | 976 | S: Supported |
| @@ -979,7 +979,7 @@ F: Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml · 2 unmodified lines | |||
| 979 | F: drivers/iio/adc/ad7606.c | 979 | F: drivers/iio/adc/ad7606.c |
| 980 | 980 | ||
| 981 | ANALOG DEVICES INC AD7768-1 DRIVER | 981 | ANALOG DEVICES INC AD7768-1 DRIVER |
| 982 | M: Stefan Popa <stefan.popa@analog.com> | 982 | M: Michael Hennerich <Michael.Hennerich@analog.com> |
| 983 | L: linux-iio@vger.kernel.org | 983 | L: linux-iio@vger.kernel.org |
| 984 | S: Supported | 984 | S: Supported |
| 985 | W: http://ez.analog.com/community/linux-device-drivers | 985 | W: http://ez.analog.com/community/linux-device-drivers |
| @@ -1040,7 +1040,7 @@ F: Documentation/devicetree/bindings/hwmon/adi,adm1177.yaml · 54 unmodified lines | |||
| 1040 | F: drivers/hwmon/adm1177.c | 1040 | F: drivers/hwmon/adm1177.c |
| 1041 | 1041 | ||
| 1042 | ANALOG DEVICES INC ADP5061 DRIVER | 1042 | ANALOG DEVICES INC ADP5061 DRIVER |
| 1043 | M: Stefan Popa <stefan.popa@analog.com> | 1043 | M: Michael Hennerich <Michael.Hennerich@analog.com> |
| 1044 | L: linux-pm@vger.kernel.org | 1044 | L: linux-pm@vger.kernel.org |
| 1045 | S: Supported | 1045 | S: Supported |
| 1046 | W: http://ez.analog.com/community/linux-device-drivers | 1046 | W: http://ez.analog.com/community/linux-device-drivers |
| @@ -1109,7 +1109,6 @@ F: drivers/iio/amplifiers/hmc425a.c · 62 unmodified lines | |||
| 1109 | ANALOG DEVICES INC IIO DRIVERS | 1109 | ANALOG DEVICES INC IIO DRIVERS |
| 1110 | M: Lars-Peter Clausen <lars@metafoo.de> | 1110 | M: Lars-Peter Clausen <lars@metafoo.de> |
| 1111 | M: Michael Hennerich <Michael.Hennerich@analog.com> | 1111 | M: Michael Hennerich <Michael.Hennerich@analog.com> |
| 1112 | M: Stefan Popa <stefan.popa@analog.com> | ||
| 1113 | S: Supported | 1112 | S: Supported |
| 1114 | W: http://wiki.analog.com/ | 1113 | W: http://wiki.analog.com/ |
| 1115 | W: http://ez.analog.com/community/linux-device-drivers | 1114 | W: http://ez.analog.com/community/linux-device-drivers |
| @@ -1323,7 +1322,10 @@ ARM INTEGRATOR, VERSATILE AND REALVIEW SUPPORT · 207 unmodified lines | |||
| 1323 | M: Linus Walleij <linus.walleij@linaro.org> | 1322 | M: Linus Walleij <linus.walleij@linaro.org> |
| 1324 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1323 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 1325 | S: Maintained | 1324 | S: Maintained |
| 1326 | F: Documentation/devicetree/bindings/arm/arm-boards | 1325 | F: Documentation/devicetree/bindings/arm/arm,integrator.yaml |
| 1326 | F: Documentation/devicetree/bindings/arm/arm,realview.yaml | ||
| 1327 | F: Documentation/devicetree/bindings/arm/arm,versatile.yaml | ||
| 1328 | F: Documentation/devicetree/bindings/arm/arm,vexpress-juno.yaml | ||
| 1327 | F: Documentation/devicetree/bindings/auxdisplay/arm-charlcd.txt | 1329 | F: Documentation/devicetree/bindings/auxdisplay/arm-charlcd.txt |
| 1328 | F: Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml | 1330 | F: Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml |
| 1329 | F: Documentation/devicetree/bindings/i2c/i2c-versatile.txt | 1331 | F: Documentation/devicetree/bindings/i2c/i2c-versatile.txt |
| @@ -2847,14 +2849,14 @@ M: Nick Kossifidis <mickflemm@gmail.com> · 1517 unmodified lines | |||
| 2847 | M: Luis Chamberlain <mcgrof@kernel.org> | 2849 | M: Luis Chamberlain <mcgrof@kernel.org> |
| 2848 | L: linux-wireless@vger.kernel.org | 2850 | L: linux-wireless@vger.kernel.org |
| 2849 | S: Maintained | 2851 | S: Maintained |
| 2850 | W: http://wireless.kernel.org/en/users/Drivers/ath5k | 2852 | W: https://wireless.wiki.kernel.org/en/users/Drivers/ath5k |
| 2851 | F: drivers/net/wireless/ath/ath5k/ | 2853 | F: drivers/net/wireless/ath/ath5k/ |
| 2852 | 2854 | ||
| 2853 | ATHEROS ATH6KL WIRELESS DRIVER | 2855 | ATHEROS ATH6KL WIRELESS DRIVER |
| 2854 | M: Kalle Valo <kvalo@codeaurora.org> | 2856 | M: Kalle Valo <kvalo@codeaurora.org> |
| 2855 | L: linux-wireless@vger.kernel.org | 2857 | L: linux-wireless@vger.kernel.org |
| 2856 | S: Supported | 2858 | S: Supported |
| 2857 | W: http://wireless.kernel.org/en/users/Drivers/ath6kl | 2859 | W: https://wireless.wiki.kernel.org/en/users/Drivers/ath6kl |
| 2858 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git | 2860 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git |
| 2859 | F: drivers/net/wireless/ath/ath6kl/ | 2861 | F: drivers/net/wireless/ath/ath6kl/ |
| 2860 | 2862 | ||
| @@ -3017,7 +3019,7 @@ B43 WIRELESS DRIVER · 156 unmodified lines | |||
| 3017 | L: linux-wireless@vger.kernel.org | 3019 | L: linux-wireless@vger.kernel.org |
| 3018 | L: b43-dev@lists.infradead.org | 3020 | L: b43-dev@lists.infradead.org |
| 3019 | S: Odd Fixes | 3021 | S: Odd Fixes |
| 3020 | W: http://wireless.kernel.org/en/users/Drivers/b43 | 3022 | W: https://wireless.wiki.kernel.org/en/users/Drivers/b43 |
| 3021 | F: drivers/net/wireless/broadcom/b43/ | 3023 | F: drivers/net/wireless/broadcom/b43/ |
| 3022 | 3024 | ||
| 3023 | B43LEGACY WIRELESS DRIVER | 3025 | B43LEGACY WIRELESS DRIVER |
| @@ -3025,7 +3027,7 @@ M: Larry Finger <Larry.Finger@lwfinger.net> · 1 unmodified line | |||
| 3025 | L: linux-wireless@vger.kernel.org | 3027 | L: linux-wireless@vger.kernel.org |
| 3026 | L: b43-dev@lists.infradead.org | 3028 | L: b43-dev@lists.infradead.org |
| 3027 | S: Maintained | 3029 | S: Maintained |
| 3028 | W: http://wireless.kernel.org/en/users/Drivers/b43 | 3030 | W: https://wireless.wiki.kernel.org/en/users/Drivers/b43 |
| 3029 | F: drivers/net/wireless/broadcom/b43legacy/ | 3031 | F: drivers/net/wireless/broadcom/b43legacy/ |
| 3030 | 3032 | ||
| 3031 | BACKLIGHT CLASS/SUBSYSTEM | 3033 | BACKLIGHT CLASS/SUBSYSTEM |
| @@ -3840,7 +3842,7 @@ CARL9170 LINUX COMMUNITY WIRELESS DRIVER · 808 unmodified lines | |||
| 3840 | M: Christian Lamparter <chunkeey@googlemail.com> | 3842 | M: Christian Lamparter <chunkeey@googlemail.com> |
| 3841 | L: linux-wireless@vger.kernel.org | 3843 | L: linux-wireless@vger.kernel.org |
| 3842 | S: Maintained | 3844 | S: Maintained |
| 3843 | W: http://wireless.kernel.org/en/users/Drivers/carl9170 | 3845 | W: https://wireless.wiki.kernel.org/en/users/Drivers/carl9170 |
| 3844 | F: drivers/net/wireless/ath/carl9170/ | 3846 | F: drivers/net/wireless/ath/carl9170/ |
| 3845 | 3847 | ||
| 3846 | CAVIUM I2C DRIVER | 3848 | CAVIUM I2C DRIVER |
| @@ -5173,6 +5175,7 @@ S: Maintained · 1326 unmodified lines | |||
| 5173 | F: drivers/soc/fsl/dpio | 5175 | F: drivers/soc/fsl/dpio |
| 5174 | 5176 | ||
| 5175 | DPAA2 ETHERNET DRIVER | 5177 | DPAA2 ETHERNET DRIVER |
| 5178 | M: Ioana Ciornei <ioana.ciornei@nxp.com> | ||
| 5176 | M: Ioana Radulescu <ruxandra.radulescu@nxp.com> | 5179 | M: Ioana Radulescu <ruxandra.radulescu@nxp.com> |
| 5177 | L: netdev@vger.kernel.org | 5180 | L: netdev@vger.kernel.org |
| 5178 | S: Maintained | 5181 | S: Maintained |
| @@ -5552,7 +5555,7 @@ M: Chen-Yu Tsai <wens@csie.org> · 373 unmodified lines | |||
| 5552 | L: dri-devel@lists.freedesktop.org | 5555 | L: dri-devel@lists.freedesktop.org |
| 5553 | S: Supported | 5556 | S: Supported |
| 5554 | T: git git://anongit.freedesktop.org/drm/drm-misc | 5557 | T: git git://anongit.freedesktop.org/drm/drm-misc |
| 5555 | F: Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 5558 | F: Documentation/devicetree/bindings/display/allwinner* |
| 5556 | F: drivers/gpu/drm/sun4i/ | 5559 | F: drivers/gpu/drm/sun4i/ |
| 5557 | 5560 | ||
| 5558 | DRM DRIVERS FOR AMLOGIC SOCS | 5561 | DRM DRIVERS FOR AMLOGIC SOCS |
| @@ -5934,6 +5937,7 @@ M: Tal Gilboa <talgi@mellanox.com> · 375 unmodified lines | |||
| 5934 | S: Maintained | 5937 | S: Maintained |
| 5935 | F: include/linux/dim.h | 5938 | F: include/linux/dim.h |
| 5936 | F: lib/dim/ | 5939 | F: lib/dim/ |
| 5940 | F: Documentation/networking/net_dim.rst | ||
| 5937 | 5941 | ||
| 5938 | DZ DECSTATION DZ11 SERIAL DRIVER | 5942 | DZ DECSTATION DZ11 SERIAL DRIVER |
| 5939 | M: "Maciej W. Rozycki" <macro@linux-mips.org> | 5943 | M: "Maciej W. Rozycki" <macro@linux-mips.org> |
| @@ -9325,6 +9329,7 @@ M: Christian Borntraeger <borntraeger@de.ibm.com> · 3385 unmodified lines | |||
| 9325 | M: Janosch Frank <frankja@linux.ibm.com> | 9329 | M: Janosch Frank <frankja@linux.ibm.com> |
| 9326 | R: David Hildenbrand <david@redhat.com> | 9330 | R: David Hildenbrand <david@redhat.com> |
| 9327 | R: Cornelia Huck <cohuck@redhat.com> | 9331 | R: Cornelia Huck <cohuck@redhat.com> |
| 9332 | R: Claudio Imbrenda <imbrenda@linux.ibm.com> | ||
| 9328 | L: kvm@vger.kernel.org | 9333 | L: kvm@vger.kernel.org |
| 9329 | S: Supported | 9334 | S: Supported |
| 9330 | W: http://www.ibm.com/developerworks/linux/linux390/ | 9335 | W: http://www.ibm.com/developerworks/linux/linux390/ |
| @@ -9412,6 +9417,13 @@ F: include/linux/keyctl.h · 81 unmodified lines | |||
| 9412 | F: include/uapi/linux/keyctl.h | 9417 | F: include/uapi/linux/keyctl.h |
| 9413 | F: security/keys/ | 9418 | F: security/keys/ |
| 9414 | 9419 | ||
| 9420 | KFIFO | ||
| 9421 | M: Stefani Seibold <stefani@seibold.net> | ||
| 9422 | S: Maintained | ||
| 9423 | F: include/linux/kfifo.h | ||
| 9424 | F: lib/kfifo.c | ||
| 9425 | F: samples/kfifo/ | ||
| 9426 | |||
| 9415 | KGDB / KDB /debug_core | 9427 | KGDB / KDB /debug_core |
| 9416 | M: Jason Wessel <jason.wessel@windriver.com> | 9428 | M: Jason Wessel <jason.wessel@windriver.com> |
| 9417 | M: Daniel Thompson <daniel.thompson@linaro.org> | 9429 | M: Daniel Thompson <daniel.thompson@linaro.org> |
| @@ -10063,7 +10075,7 @@ MAC80211 · 645 unmodified lines | |||
| 10063 | M: Johannes Berg <johannes@sipsolutions.net> | 10075 | M: Johannes Berg <johannes@sipsolutions.net> |
| 10064 | L: linux-wireless@vger.kernel.org | 10076 | L: linux-wireless@vger.kernel.org |
| 10065 | S: Maintained | 10077 | S: Maintained |
| 10066 | W: http://wireless.kernel.org/ | 10078 | W: https://wireless.wiki.kernel.org/ |
| 10067 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git | 10079 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git |
| 10068 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git | 10080 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git |
| 10069 | F: Documentation/networking/mac80211-injection.txt | 10081 | F: Documentation/networking/mac80211-injection.txt |
| @@ -10693,7 +10705,6 @@ MEDIATEK MT76 WIRELESS LAN DRIVER · 623 unmodified lines | |||
| 10693 | M: Felix Fietkau <nbd@nbd.name> | 10705 | M: Felix Fietkau <nbd@nbd.name> |
| 10694 | M: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> | 10706 | M: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> |
| 10695 | R: Ryder Lee <ryder.lee@mediatek.com> | 10707 | R: Ryder Lee <ryder.lee@mediatek.com> |
| 10696 | R: Roy Luo <royluo@google.com> | ||
| 10697 | L: linux-wireless@vger.kernel.org | 10708 | L: linux-wireless@vger.kernel.org |
| 10698 | S: Maintained | 10709 | S: Maintained |
| 10699 | F: drivers/net/wireless/mediatek/mt76/ | 10710 | F: drivers/net/wireless/mediatek/mt76/ |
| @@ -12644,7 +12655,7 @@ F: fs/orangefs/ · 1944 unmodified lines | |||
| 12644 | ORINOCO DRIVER | 12655 | ORINOCO DRIVER |
| 12645 | L: linux-wireless@vger.kernel.org | 12656 | L: linux-wireless@vger.kernel.org |
| 12646 | S: Orphan | 12657 | S: Orphan |
| 12647 | W: http://wireless.kernel.org/en/users/Drivers/orinoco | 12658 | W: https://wireless.wiki.kernel.org/en/users/Drivers/orinoco |
| 12648 | W: http://www.nongnu.org/orinoco/ | 12659 | W: http://www.nongnu.org/orinoco/ |
| 12649 | F: drivers/net/wireless/intersil/orinoco/ | 12660 | F: drivers/net/wireless/intersil/orinoco/ |
| 12650 | 12661 | ||
| @@ -12670,7 +12681,7 @@ P54 WIRELESS DRIVER · 19 unmodified lines | |||
| 12670 | M: Christian Lamparter <chunkeey@googlemail.com> | 12681 | M: Christian Lamparter <chunkeey@googlemail.com> |
| 12671 | L: linux-wireless@vger.kernel.org | 12682 | L: linux-wireless@vger.kernel.org |
| 12672 | S: Maintained | 12683 | S: Maintained |
| 12673 | W: http://wireless.kernel.org/en/users/Drivers/p54 | 12684 | W: https://wireless.wiki.kernel.org/en/users/Drivers/p54 |
| 12674 | F: drivers/net/wireless/intersil/p54/ | 12685 | F: drivers/net/wireless/intersil/p54/ |
| 12675 | 12686 | ||
| 12676 | PACKING | 12687 | PACKING |
| @@ -13038,7 +13049,7 @@ F: drivers/pci/controller/pci-xgene-msi.c · 361 unmodified lines | |||
| 13038 | 13049 | ||
| 13039 | PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS | 13050 | PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS |
| 13040 | M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 13051 | M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> |
| 13041 | R: Andrew Murray <amurray@thegoodpenguin.co.uk> | 13052 | R: Rob Herring <robh@kernel.org> |
| 13042 | L: linux-pci@vger.kernel.org | 13053 | L: linux-pci@vger.kernel.org |
| 13043 | S: Supported | 13054 | S: Supported |
| 13044 | Q: http://patchwork.ozlabs.org/project/linux-pci/list/ | 13055 | Q: http://patchwork.ozlabs.org/project/linux-pci/list/ |
| @@ -13591,7 +13602,7 @@ PRISM54 WIRELESS DRIVER · 546 unmodified lines | |||
| 13591 | M: Luis Chamberlain <mcgrof@kernel.org> | 13602 | M: Luis Chamberlain <mcgrof@kernel.org> |
| 13592 | L: linux-wireless@vger.kernel.org | 13603 | L: linux-wireless@vger.kernel.org |
| 13593 | S: Obsolete | 13604 | S: Obsolete |
| 13594 | W: http://wireless.kernel.org/en/users/Drivers/p54 | 13605 | W: https://wireless.wiki.kernel.org/en/users/Drivers/p54 |
| 13595 | F: drivers/net/wireless/intersil/prism54/ | 13606 | F: drivers/net/wireless/intersil/prism54/ |
| 13596 | 13607 | ||
| 13597 | PROC FILESYSTEM | 13608 | PROC FILESYSTEM |
| @@ -13853,7 +13864,8 @@ S: Maintained · 255 unmodified lines | |||
| 13853 | F: drivers/scsi/qla1280.[ch] | 13864 | F: drivers/scsi/qla1280.[ch] |
| 13854 | 13865 | ||
| 13855 | QLOGIC QLA2XXX FC-SCSI DRIVER | 13866 | QLOGIC QLA2XXX FC-SCSI DRIVER |
| 13856 | M: hmadhani@marvell.com | 13867 | M: Nilesh Javali <njavali@marvell.com> |
| 13868 | M: GR-QLogic-Storage-Upstream@marvell.com | ||
| 13857 | L: linux-scsi@vger.kernel.org | 13869 | L: linux-scsi@vger.kernel.org |
| 13858 | S: Supported | 13870 | S: Supported |
| 13859 | F: Documentation/scsi/LICENSE.qla2xxx | 13871 | F: Documentation/scsi/LICENSE.qla2xxx |
| @@ -13931,7 +13943,7 @@ QUALCOMM ATHEROS ATH10K WIRELESS DRIVER · 71 unmodified lines | |||
| 13931 | M: Kalle Valo <kvalo@codeaurora.org> | 13943 | M: Kalle Valo <kvalo@codeaurora.org> |
| 13932 | L: ath10k@lists.infradead.org | 13944 | L: ath10k@lists.infradead.org |
| 13933 | S: Supported | 13945 | S: Supported |
| 13934 | W: http://wireless.kernel.org/en/users/Drivers/ath10k | 13946 | W: https://wireless.wiki.kernel.org/en/users/Drivers/ath10k |
| 13935 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git | 13947 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git |
| 13936 | F: drivers/net/wireless/ath/ath10k/ | 13948 | F: drivers/net/wireless/ath/ath10k/ |
| 13937 | 13949 | ||
| @@ -13946,7 +13958,7 @@ QUALCOMM ATHEROS ATH9K WIRELESS DRIVER · 8 unmodified lines | |||
| 13946 | M: QCA ath9k Development <ath9k-devel@qca.qualcomm.com> | 13958 | M: QCA ath9k Development <ath9k-devel@qca.qualcomm.com> |
| 13947 | L: linux-wireless@vger.kernel.org | 13959 | L: linux-wireless@vger.kernel.org |
| 13948 | S: Supported | 13960 | S: Supported |
| 13949 | W: http://wireless.kernel.org/en/users/Drivers/ath9k | 13961 | W: https://wireless.wiki.kernel.org/en/users/Drivers/ath9k |
| 13950 | F: drivers/net/wireless/ath/ath9k/ | 13962 | F: drivers/net/wireless/ath/ath9k/ |
| 13951 | 13963 | ||
| 13952 | QUALCOMM CAMERA SUBSYSTEM DRIVER | 13964 | QUALCOMM CAMERA SUBSYSTEM DRIVER |
| @@ -14043,13 +14055,12 @@ QUALCOMM WCN36XX WIRELESS DRIVER · 90 unmodified lines | |||
| 14043 | M: Kalle Valo <kvalo@codeaurora.org> | 14055 | M: Kalle Valo <kvalo@codeaurora.org> |
| 14044 | L: wcn36xx@lists.infradead.org | 14056 | L: wcn36xx@lists.infradead.org |
| 14045 | S: Supported | 14057 | S: Supported |
| 14046 | W: http://wireless.kernel.org/en/users/Drivers/wcn36xx | 14058 | W: https://wireless.wiki.kernel.org/en/users/Drivers/wcn36xx |
| 14047 | T: git git://github.com/KrasnikovEugene/wcn36xx.git | 14059 | T: git git://github.com/KrasnikovEugene/wcn36xx.git |
| 14048 | F: drivers/net/wireless/ath/wcn36xx/ | 14060 | F: drivers/net/wireless/ath/wcn36xx/ |
| 14049 | 14061 | ||
| 14050 | QUANTENNA QTNFMAC WIRELESS DRIVER | 14062 | QUANTENNA QTNFMAC WIRELESS DRIVER |
| 14051 | M: Igor Mitsyanko <imitsyanko@quantenna.com> | 14063 | M: Igor Mitsyanko <imitsyanko@quantenna.com> |
| 14052 | M: Avinash Patil <avinashp@quantenna.com> | ||
| 14053 | M: Sergey Matyukevich <smatyukevich@quantenna.com> | 14064 | M: Sergey Matyukevich <smatyukevich@quantenna.com> |
| 14054 | L: linux-wireless@vger.kernel.org | 14065 | L: linux-wireless@vger.kernel.org |
| 14055 | S: Maintained | 14066 | S: Maintained |
| @@ -14271,7 +14282,7 @@ REALTEK WIRELESS DRIVER (rtlwifi family) · 215 unmodified lines | |||
| 14271 | M: Ping-Ke Shih <pkshih@realtek.com> | 14282 | M: Ping-Ke Shih <pkshih@realtek.com> |
| 14272 | L: linux-wireless@vger.kernel.org | 14283 | L: linux-wireless@vger.kernel.org |
| 14273 | S: Maintained | 14284 | S: Maintained |
| 14274 | W: http://wireless.kernel.org/ | 14285 | W: https://wireless.wiki.kernel.org/ |
| 14275 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git | 14286 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git |
| 14276 | F: drivers/net/wireless/realtek/rtlwifi/ | 14287 | F: drivers/net/wireless/realtek/rtlwifi/ |
| 14277 | 14288 | ||
| @@ -14406,7 +14417,7 @@ RFKILL · 128 unmodified lines | |||
| 14406 | M: Johannes Berg <johannes@sipsolutions.net> | 14417 | M: Johannes Berg <johannes@sipsolutions.net> |
| 14407 | L: linux-wireless@vger.kernel.org | 14418 | L: linux-wireless@vger.kernel.org |
| 14408 | S: Maintained | 14419 | S: Maintained |
| 14409 | W: http://wireless.kernel.org/ | 14420 | W: https://wireless.wiki.kernel.org/ |
| 14410 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git | 14421 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git |
| 14411 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git | 14422 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git |
| 14412 | F: Documentation/ABI/stable/sysfs-class-rfkill | 14423 | F: Documentation/ABI/stable/sysfs-class-rfkill |
| @@ -14555,7 +14566,7 @@ F: drivers/media/dvb-frontends/rtl2832_sdr* · 142 unmodified lines | |||
| 14555 | RTL8180 WIRELESS DRIVER | 14566 | RTL8180 WIRELESS DRIVER |
| 14556 | L: linux-wireless@vger.kernel.org | 14567 | L: linux-wireless@vger.kernel.org |
| 14557 | S: Orphan | 14568 | S: Orphan |
| 14558 | W: http://wireless.kernel.org/ | 14569 | W: https://wireless.wiki.kernel.org/ |
| 14559 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git | 14570 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git |
| 14560 | F: drivers/net/wireless/realtek/rtl818x/rtl8180/ | 14571 | F: drivers/net/wireless/realtek/rtl818x/rtl8180/ |
| 14561 | 14572 | ||
| @@ -14565,7 +14576,7 @@ M: Hin-Tak Leung <htl10@users.sourceforge.net> · 3 unmodified lines | |||
| 14565 | M: Larry Finger <Larry.Finger@lwfinger.net> | 14576 | M: Larry Finger <Larry.Finger@lwfinger.net> |
| 14566 | L: linux-wireless@vger.kernel.org | 14577 | L: linux-wireless@vger.kernel.org |
| 14567 | S: Maintained | 14578 | S: Maintained |
| 14568 | W: http://wireless.kernel.org/ | 14579 | W: https://wireless.wiki.kernel.org/ |
| 14569 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git | 14580 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git |
| 14570 | F: drivers/net/wireless/realtek/rtl818x/rtl8187/ | 14581 | F: drivers/net/wireless/realtek/rtl818x/rtl8187/ |
| 14571 | 14582 | ||
| @@ -16920,8 +16931,8 @@ F: drivers/media/platform/ti-vpe/ · 2348 unmodified lines | |||
| 16920 | TI WILINK WIRELESS DRIVERS | 16931 | TI WILINK WIRELESS DRIVERS |
| 16921 | L: linux-wireless@vger.kernel.org | 16932 | L: linux-wireless@vger.kernel.org |
| 16922 | S: Orphan | 16933 | S: Orphan |
| 16923 | W: http://wireless.kernel.org/en/users/Drivers/wl12xx | 16934 | W: https://wireless.wiki.kernel.org/en/users/Drivers/wl12xx |
| 16924 | W: http://wireless.kernel.org/en/users/Drivers/wl1251 | 16935 | W: https://wireless.wiki.kernel.org/en/users/Drivers/wl1251 |
| 16925 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx.git | 16936 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx.git |
| 16926 | F: drivers/net/wireless/ti/ | 16937 | F: drivers/net/wireless/ti/ |
| 16927 | F: include/linux/wl12xx.h | 16938 | F: include/linux/wl12xx.h |
| @@ -18203,7 +18214,7 @@ M: Maya Erez <merez@codeaurora.org> · 1275 unmodified lines | |||
| 18203 | L: linux-wireless@vger.kernel.org | 18214 | L: linux-wireless@vger.kernel.org |
| 18204 | L: wil6210@qti.qualcomm.com | 18215 | L: wil6210@qti.qualcomm.com |
| 18205 | S: Supported | 18216 | S: Supported |
| 18206 | W: http://wireless.kernel.org/en/users/Drivers/wil6210 | 18217 | W: https://wireless.wiki.kernel.org/en/users/Drivers/wil6210 |
| 18207 | F: drivers/net/wireless/ath/wil6210/ | 18218 | F: drivers/net/wireless/ath/wil6210/ |
| 18208 | 18219 | ||
| 18209 | WIMAX STACK | 18220 | WIMAX STACK |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | VERSION = 5 | 2 | VERSION = 5 |
| 3 | PATCHLEVEL = 7 | 3 | PATCHLEVEL = 7 |
| 4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
| 5 | EXTRAVERSION = -rc1 | 5 | EXTRAVERSION = -rc3 |
| 6 | NAME = Kleptomaniac Octopus | 6 | NAME = Kleptomaniac Octopus |
| 7 | 7 | ||
| 8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
| @@ -3,7 +3,6 @@ · 2 unmodified lines | |||
| 3 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | 3 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) |
| 4 | * | 4 | * |
| 5 | * Amit Bhor, Sameer Dhavale: Codito Technologies 2004 | 5 | * Amit Bhor, Sameer Dhavale: Codito Technologies 2004 |
| 6 | |||
| 7 | */ | 6 | */ |
| 8 | 7 | ||
| 9 | #ifndef _ASM_ARC_MODULE_H | 8 | #ifndef _ASM_ARC_MODULE_H |
| @@ -19,8 +18,4 @@ struct mod_arch_specific { · 9 unmodified lines | |||
| 19 | const char *secstr; | 18 | const char *secstr; |
| 20 | }; | 19 | }; |
| 21 | 20 | ||
| 22 | #define MODULE_PROC_FAMILY "ARC700" | ||
| 23 | |||
| 24 | #define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY | ||
| 25 | |||
| 26 | #endif /* _ASM_ARC_MODULE_H */ | 21 | #endif /* _ASM_ARC_MODULE_H */ |
| @@ -0,0 +1,8 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | |||
| 3 | #ifndef _ASM_VERMAGIC_H | ||
| 4 | #define _ASM_VERMAGIC_H | ||
| 5 | |||
| 6 | #define MODULE_ARCH_VERMAGIC "ARC700" | ||
| 7 | |||
| 8 | #endif /* _ASM_VERMAGIC_H */ | ||
| @@ -1450,7 +1450,8 @@ ENTRY(efi_enter_kernel) · 1449 unmodified lines | |||
| 1450 | @ running beyond the PoU, and so calling cache_off below from | 1450 | @ running beyond the PoU, and so calling cache_off below from |
| 1451 | @ inside the PE/COFF loader allocated region is unsafe unless | 1451 | @ inside the PE/COFF loader allocated region is unsafe unless |
| 1452 | @ we explicitly clean it to the PoC. | 1452 | @ we explicitly clean it to the PoC. |
| 1453 | adr r0, call_cache_fn @ region of code we will | 1453 | ARM( adrl r0, call_cache_fn ) |
| 1454 | THUMB( adr r0, call_cache_fn ) @ region of code we will | ||
| 1454 | adr r1, 0f @ run with MMU off | 1455 | adr r1, 0f @ run with MMU off |
| 1455 | bl cache_clean_flush | 1456 | bl cache_clean_flush |
| 1456 | bl cache_off | 1457 | bl cache_off |
| @@ -14,6 +14,9 @@ · 13 unmodified lines | |||
| 14 | soc { | 14 | soc { |
| 15 | firmware: firmware { | 15 | firmware: firmware { |
| 16 | compatible = "raspberrypi,bcm2835-firmware", "simple-bus"; | 16 | compatible = "raspberrypi,bcm2835-firmware", "simple-bus"; |
| 17 | #address-cells = <1>; | ||
| 18 | #size-cells = <1>; | ||
| 19 | |||
| 17 | mboxes = <&mailbox>; | 20 | mboxes = <&mailbox>; |
| 18 | dma-ranges; | 21 | dma-ranges; |
| 19 | }; | 22 | }; |
| @@ -372,6 +372,7 @@ · 371 unmodified lines | |||
| 372 | "dsi0_ddr2", | 372 | "dsi0_ddr2", |
| 373 | "dsi0_ddr"; | 373 | "dsi0_ddr"; |
| 374 | 374 | ||
| 375 | status = "disabled"; | ||
| 375 | }; | 376 | }; |
| 376 | 377 | ||
| 377 | aux: aux@7e215000 { | 378 | aux: aux@7e215000 { |
| @@ -1039,13 +1039,13 @@ · 1038 unmodified lines | |||
| 1039 | compatible = "fsl,imx6q-fec"; | 1039 | compatible = "fsl,imx6q-fec"; |
| 1040 | reg = <0x02188000 0x4000>; | 1040 | reg = <0x02188000 0x4000>; |
| 1041 | interrupt-names = "int0", "pps"; | 1041 | interrupt-names = "int0", "pps"; |
| 1042 | interrupts-extended = | 1042 | interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>, |
| 1043 | <&intc 0 118 IRQ_TYPE_LEVEL_HIGH>, | 1043 | <0 119 IRQ_TYPE_LEVEL_HIGH>; |
| 1044 | <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; | ||
| 1045 | clocks = <&clks IMX6QDL_CLK_ENET>, | 1044 | clocks = <&clks IMX6QDL_CLK_ENET>, |
| 1046 | <&clks IMX6QDL_CLK_ENET>, | 1045 | <&clks IMX6QDL_CLK_ENET>, |
| 1047 | <&clks IMX6QDL_CLK_ENET_REF>; | 1046 | <&clks IMX6QDL_CLK_ENET_REF>; |
| 1048 | clock-names = "ipg", "ahb", "ptp"; | 1047 | clock-names = "ipg", "ahb", "ptp"; |
| 1048 | gpr = <&gpr>; | ||
| 1049 | status = "disabled"; | 1049 | status = "disabled"; |
| 1050 | }; | 1050 | }; |
| 1051 | 1051 | ||
| @@ -77,7 +77,6 @@ · 76 unmodified lines | |||
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| 79 | &fec { | 79 | &fec { |
| 80 | /delete-property/interrupts-extended; | ||
| 81 | interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>, | 80 | interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>, |
| 82 | <0 119 IRQ_TYPE_LEVEL_HIGH>; | 81 | <0 119 IRQ_TYPE_LEVEL_HIGH>; |
| 83 | }; | 82 | }; |
| @@ -341,6 +341,11 @@ · 340 unmodified lines | |||
| 341 | status = "disabled"; | 341 | status = "disabled"; |
| 342 | }; | 342 | }; |
| 343 | 343 | ||
| 344 | /* RNG not directly accessible on N950/N9. */ | ||
| 345 | &rng_target { | ||
| 346 | status = "disabled"; | ||
| 347 | }; | ||
| 348 | |||
| 344 | &usb_otg_hs { | 349 | &usb_otg_hs { |
| 345 | interface-type = <0>; | 350 | interface-type = <0>; |
| 346 | usb-phy = <&usb2_phy>; | 351 | usb-phy = <&usb2_phy>; |
| @@ -37,30 +37,6 @@ struct mod_arch_specific { · 36 unmodified lines | |||
| 37 | struct module; | 37 | struct module; |
| 38 | u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val); | 38 | u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val); |
| 39 | 39 | ||
| 40 | /* | ||
| 41 | * Add the ARM architecture version to the version magic string | ||
| 42 | */ | ||
| 43 | #define MODULE_ARCH_VERMAGIC_ARMVSN "ARMv" __stringify(__LINUX_ARM_ARCH__) " " | ||
| 44 | |||
| 45 | /* Add __virt_to_phys patching state as well */ | ||
| 46 | #ifdef CONFIG_ARM_PATCH_PHYS_VIRT | ||
| 47 | #define MODULE_ARCH_VERMAGIC_P2V "p2v8 " | ||
| 48 | #else | ||
| 49 | #define MODULE_ARCH_VERMAGIC_P2V "" | ||
| 50 | #endif | ||
| 51 | |||
| 52 | /* Add instruction set architecture tag to distinguish ARM/Thumb kernels */ | ||
| 53 | #ifdef CONFIG_THUMB2_KERNEL | ||
| 54 | #define MODULE_ARCH_VERMAGIC_ARMTHUMB "thumb2 " | ||
| 55 | #else | ||
| 56 | #define MODULE_ARCH_VERMAGIC_ARMTHUMB "" | ||
| 57 | #endif | ||
| 58 | |||
| 59 | #define MODULE_ARCH_VERMAGIC \ | ||
| 60 | MODULE_ARCH_VERMAGIC_ARMVSN \ | ||
| 61 | MODULE_ARCH_VERMAGIC_ARMTHUMB \ | ||
| 62 | MODULE_ARCH_VERMAGIC_P2V | ||
| 63 | |||
| 64 | #ifdef CONFIG_THUMB2_KERNEL | 40 | #ifdef CONFIG_THUMB2_KERNEL |
| 65 | #define HAVE_ARCH_KALLSYMS_SYMBOL_VALUE | 41 | #define HAVE_ARCH_KALLSYMS_SYMBOL_VALUE |
| 66 | static inline unsigned long kallsyms_symbol_value(const Elf_Sym *sym) | 42 | static inline unsigned long kallsyms_symbol_value(const Elf_Sym *sym) |
| @@ -0,0 +1,31 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _ASM_VERMAGIC_H | ||
| 3 | #define _ASM_VERMAGIC_H | ||
| 4 | |||
| 5 | #include <linux/stringify.h> | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Add the ARM architecture version to the version magic string | ||
| 9 | */ | ||
| 10 | #define MODULE_ARCH_VERMAGIC_ARMVSN "ARMv" __stringify(__LINUX_ARM_ARCH__) " " | ||
| 11 | |||
| 12 | /* Add __virt_to_phys patching state as well */ | ||
| 13 | #ifdef CONFIG_ARM_PATCH_PHYS_VIRT | ||
| 14 | #define MODULE_ARCH_VERMAGIC_P2V "p2v8 " | ||
| 15 | #else | ||
| 16 | #define MODULE_ARCH_VERMAGIC_P2V "" | ||
| 17 | #endif | ||
| 18 | |||
| 19 | /* Add instruction set architecture tag to distinguish ARM/Thumb kernels */ | ||
| 20 | #ifdef CONFIG_THUMB2_KERNEL | ||
| 21 | #define MODULE_ARCH_VERMAGIC_ARMTHUMB "thumb2 " | ||
| 22 | #else | ||
| 23 | #define MODULE_ARCH_VERMAGIC_ARMTHUMB "" | ||
| 24 | #endif | ||
| 25 | |||
| 26 | #define MODULE_ARCH_VERMAGIC \ | ||
| 27 | MODULE_ARCH_VERMAGIC_ARMVSN \ | ||
| 28 | MODULE_ARCH_VERMAGIC_ARMTHUMB \ | ||
| 29 | MODULE_ARCH_VERMAGIC_P2V | ||
| 30 | |||
| 31 | #endif /* _ASM_VERMAGIC_H */ | ||
| @@ -91,8 +91,10 @@ AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a · 90 unmodified lines | |||
| 91 | obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o | 91 | obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o |
| 92 | obj-$(CONFIG_SOC_IMX53) += suspend-imx53.o | 92 | obj-$(CONFIG_SOC_IMX53) += suspend-imx53.o |
| 93 | endif | 93 | endif |
| 94 | ifeq ($(CONFIG_ARM_CPU_SUSPEND),y) | ||
| 94 | AFLAGS_resume-imx6.o :=-Wa,-march=armv7-a | 95 | AFLAGS_resume-imx6.o :=-Wa,-march=armv7-a |
| 95 | obj-$(CONFIG_SOC_IMX6) += resume-imx6.o | 96 | obj-$(CONFIG_SOC_IMX6) += resume-imx6.o |
| 97 | endif | ||
| 96 | obj-$(CONFIG_SOC_IMX6) += pm-imx6.o | 98 | obj-$(CONFIG_SOC_IMX6) += pm-imx6.o |
| 97 | 99 | ||
| 98 | obj-$(CONFIG_SOC_IMX1) += mach-imx1.o | 100 | obj-$(CONFIG_SOC_IMX1) += mach-imx1.o |
| @@ -929,7 +929,11 @@ static inline void emit_a32_rsh_i64(const s8 dst[], · 928 unmodified lines | |||
| 929 | rd = arm_bpf_get_reg64(dst, tmp, ctx); | 929 | rd = arm_bpf_get_reg64(dst, tmp, ctx); |
| 930 | 930 | ||
| 931 | /* Do LSR operation */ | 931 | /* Do LSR operation */ |
| 932 | if (val < 32) { | 932 | if (val == 0) { |
| 933 | /* An immediate value of 0 encodes a shift amount of 32 | ||
| 934 | * for LSR. To shift by 0, don't do anything. | ||
| 935 | */ | ||
| 936 | } else if (val < 32) { | ||
| 933 | emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx); | 937 | emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx); |
| 934 | emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx); | 938 | emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx); |
| 935 | emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_LSR, val), ctx); | 939 | emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_LSR, val), ctx); |
| @@ -955,7 +959,11 @@ static inline void emit_a32_arsh_i64(const s8 dst[], · 19 unmodified lines | |||
| 955 | rd = arm_bpf_get_reg64(dst, tmp, ctx); | 959 | rd = arm_bpf_get_reg64(dst, tmp, ctx); |
| 956 | 960 | ||
| 957 | /* Do ARSH operation */ | 961 | /* Do ARSH operation */ |
| 958 | if (val < 32) { | 962 | if (val == 0) { |
| 963 | /* An immediate value of 0 encodes a shift amount of 32 | ||
| 964 | * for ASR. To shift by 0, don't do anything. | ||
| 965 | */ | ||
| 966 | } else if (val < 32) { | ||
| 959 | emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx); | 967 | emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx); |
| 960 | emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx); | 968 | emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx); |
| 961 | emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_ASR, val), ctx); | 969 | emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_ASR, val), ctx); |
| @@ -992,21 +1000,35 @@ static inline void emit_a32_mul_r64(const s8 dst[], const s8 src[], · 30 unmodified lines | |||
| 992 | arm_bpf_put_reg32(dst_hi, rd[0], ctx); | 1000 | arm_bpf_put_reg32(dst_hi, rd[0], ctx); |
| 993 | } | 1001 | } |
| 994 | 1002 | ||
| 1003 | static bool is_ldst_imm(s16 off, const u8 size) | ||
| 1004 | { | ||
| 1005 | s16 off_max = 0; | ||
| 1006 | |||
| 1007 | switch (size) { | ||
| 1008 | case BPF_B: | ||
| 1009 | case BPF_W: | ||
| 1010 | off_max = 0xfff; | ||
| 1011 | break; | ||
| 1012 | case BPF_H: | ||
| 1013 | off_max = 0xff; | ||
| 1014 | break; | ||
| 1015 | case BPF_DW: | ||
| 1016 | /* Need to make sure off+4 does not overflow. */ | ||
| 1017 | off_max = 0xfff - 4; | ||
| 1018 | break; | ||
| 1019 | } | ||
| 1020 | return -off_max <= off && off <= off_max; | ||
| 1021 | } | ||
| 1022 | |||
| 995 | /* *(size *)(dst + off) = src */ | 1023 | /* *(size *)(dst + off) = src */ |
| 996 | static inline void emit_str_r(const s8 dst, const s8 src[], | 1024 | static inline void emit_str_r(const s8 dst, const s8 src[], |
| 997 | s32 off, struct jit_ctx *ctx, const u8 sz){ | 1025 | s16 off, struct jit_ctx *ctx, const u8 sz){ |
| 998 | const s8 *tmp = bpf2a32[TMP_REG_1]; | 1026 | const s8 *tmp = bpf2a32[TMP_REG_1]; |
| 999 | s32 off_max; | ||
| 1000 | s8 rd; | 1027 | s8 rd; |
| 1001 | 1028 | ||
| 1002 | rd = arm_bpf_get_reg32(dst, tmp[1], ctx); | 1029 | rd = arm_bpf_get_reg32(dst, tmp[1], ctx); |
| 1003 | 1030 | ||
| 1004 | if (sz == BPF_H) | 1031 | if (!is_ldst_imm(off, sz)) { |
| 1005 | off_max = 0xff; | ||
| 1006 | else | ||
| 1007 | off_max = 0xfff; | ||
| 1008 | |||
| 1009 | if (off < 0 || off > off_max) { | ||
| 1010 | emit_a32_mov_i(tmp[0], off, ctx); | 1032 | emit_a32_mov_i(tmp[0], off, ctx); |
| 1011 | emit(ARM_ADD_R(tmp[0], tmp[0], rd), ctx); | 1033 | emit(ARM_ADD_R(tmp[0], tmp[0], rd), ctx); |
| 1012 | rd = tmp[0]; | 1034 | rd = tmp[0]; |
| @@ -1035,18 +1057,12 @@ static inline void emit_str_r(const s8 dst, const s8 src[], · 22 unmodified lines | |||
| 1035 | 1057 | ||
| 1036 | /* dst = *(size*)(src + off) */ | 1058 | /* dst = *(size*)(src + off) */ |
| 1037 | static inline void emit_ldx_r(const s8 dst[], const s8 src, | 1059 | static inline void emit_ldx_r(const s8 dst[], const s8 src, |
| 1038 | s32 off, struct jit_ctx *ctx, const u8 sz){ | 1060 | s16 off, struct jit_ctx *ctx, const u8 sz){ |
| 1039 | const s8 *tmp = bpf2a32[TMP_REG_1]; | 1061 | const s8 *tmp = bpf2a32[TMP_REG_1]; |
| 1040 | const s8 *rd = is_stacked(dst_lo) ? tmp : dst; | 1062 | const s8 *rd = is_stacked(dst_lo) ? tmp : dst; |
| 1041 | s8 rm = src; | 1063 | s8 rm = src; |
| 1042 | s32 off_max; | ||
| 1043 | |||
| 1044 | if (sz == BPF_H) | ||
| 1045 | off_max = 0xff; | ||
| 1046 | else | ||
| 1047 | off_max = 0xfff; | ||
| 1048 | 1064 | ||
| 1049 | if (off < 0 || off > off_max) { | 1065 | if (!is_ldst_imm(off, sz)) { |
| 1050 | emit_a32_mov_i(tmp[0], off, ctx); | 1066 | emit_a32_mov_i(tmp[0], off, ctx); |
| 1051 | emit(ARM_ADD_R(tmp[0], tmp[0], src), ctx); | 1067 | emit(ARM_ADD_R(tmp[0], tmp[0], src), ctx); |
| 1052 | rm = tmp[0]; | 1068 | rm = tmp[0]; |
| @@ -36,7 +36,7 @@ · 35 unmodified lines | |||
| 36 | 36 | ||
| 37 | #include <linux/mm.h> | 37 | #include <linux/mm.h> |
| 38 | 38 | ||
| 39 | struct start_info _xen_start_info; | 39 | static struct start_info _xen_start_info; |
| 40 | struct start_info *xen_start_info = &_xen_start_info; | 40 | struct start_info *xen_start_info = &_xen_start_info; |
| 41 | EXPORT_SYMBOL(xen_start_info); | 41 | EXPORT_SYMBOL(xen_start_info); |
| 42 | 42 | ||
| @@ -7,8 +7,6 @@ · 6 unmodified lines | |||
| 7 | 7 | ||
| 8 | #include <asm-generic/module.h> | 8 | #include <asm-generic/module.h> |
| 9 | 9 | ||
| 10 | #define MODULE_ARCH_VERMAGIC "aarch64" | ||
| 11 | |||
| 12 | #ifdef CONFIG_ARM64_MODULE_PLTS | 10 | #ifdef CONFIG_ARM64_MODULE_PLTS |
| 13 | struct mod_plt_sec { | 11 | struct mod_plt_sec { |
| 14 | int plt_shndx; | 12 | int plt_shndx; |
| @@ -47,7 +47,7 @@ static inline void ptrauth_keys_init_user(struct ptrauth_keys_user *keys) · 46 unmodified lines | |||
| 47 | get_random_bytes(&keys->apga, sizeof(keys->apga)); | 47 | get_random_bytes(&keys->apga, sizeof(keys->apga)); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | #define __ptrauth_key_install(k, v) \ | 50 | #define __ptrauth_key_install_nosync(k, v) \ |
| 51 | do { \ | 51 | do { \ |
| 52 | struct ptrauth_key __pki_v = (v); \ | 52 | struct ptrauth_key __pki_v = (v); \ |
| 53 | write_sysreg_s(__pki_v.lo, SYS_ ## k ## KEYLO_EL1); \ | 53 | write_sysreg_s(__pki_v.lo, SYS_ ## k ## KEYLO_EL1); \ |
| @@ -62,8 +62,11 @@ static __always_inline void ptrauth_keys_init_kernel(struct ptrauth_keys_kernel · 8 unmodified lines | |||
| 62 | 62 | ||
| 63 | static __always_inline void ptrauth_keys_switch_kernel(struct ptrauth_keys_kernel *keys) | 63 | static __always_inline void ptrauth_keys_switch_kernel(struct ptrauth_keys_kernel *keys) |
| 64 | { | 64 | { |
| 65 | if (system_supports_address_auth()) | 65 | if (!system_supports_address_auth()) |
| 66 | __ptrauth_key_install(APIA, keys->apia); | 66 | return; |
| 67 | |||
| 68 | __ptrauth_key_install_nosync(APIA, keys->apia); | ||
| 69 | isb(); | ||
| 67 | } | 70 | } |
| 68 | 71 | ||
| 69 | extern int ptrauth_prctl_reset_keys(struct task_struct *tsk, unsigned long arg); | 72 | extern int ptrauth_prctl_reset_keys(struct task_struct *tsk, unsigned long arg); |
| @@ -49,7 +49,9 @@ · 48 unmodified lines | |||
| 49 | #ifndef CONFIG_BROKEN_GAS_INST | 49 | #ifndef CONFIG_BROKEN_GAS_INST |
| 50 | 50 | ||
| 51 | #ifdef __ASSEMBLY__ | 51 | #ifdef __ASSEMBLY__ |
| 52 | #define __emit_inst(x) .inst (x) | 52 | // The space separator is omitted so that __emit_inst(x) can be parsed as |
| 53 | // either an assembler directive or an assembler macro argument. | ||
| 54 | #define __emit_inst(x) .inst(x) | ||
| 53 | #else | 55 | #else |
| 54 | #define __emit_inst(x) ".inst " __stringify((x)) "\n\t" | 56 | #define __emit_inst(x) ".inst " __stringify((x)) "\n\t" |
| 55 | #endif | 57 | #endif |
| @@ -0,0 +1,10 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2012 ARM Ltd. | ||
| 4 | */ | ||
| 5 | #ifndef _ASM_VERMAGIC_H | ||
| 6 | #define _ASM_VERMAGIC_H | ||
| 7 | |||
| 8 | #define MODULE_ARCH_VERMAGIC "aarch64" | ||
| 9 | |||
| 10 | #endif /* _ASM_VERMAGIC_H */ | ||
| @@ -260,18 +260,7 @@ static int __aarch32_alloc_vdso_pages(void) · 259 unmodified lines | |||
| 260 | if (ret) | 260 | if (ret) |
| 261 | return ret; | 261 | return ret; |
| 262 | 262 | ||
| 263 | ret = aarch32_alloc_kuser_vdso_page(); | 263 | return aarch32_alloc_kuser_vdso_page(); |
| 264 | if (ret) { | ||
| 265 | unsigned long c_vvar = | ||
| 266 | (unsigned long)page_to_virt(aarch32_vdso_pages[C_VVAR]); | ||
| 267 | unsigned long c_vdso = | ||
| 268 | (unsigned long)page_to_virt(aarch32_vdso_pages[C_VDSO]); | ||
| 269 | |||
| 270 | free_page(c_vvar); | ||
| 271 | free_page(c_vdso); | ||
| 272 | } | ||
| 273 | |||
| 274 | return ret; | ||
| 275 | } | 264 | } |
| 276 | #else | 265 | #else |
| 277 | static int __aarch32_alloc_vdso_pages(void) | 266 | static int __aarch32_alloc_vdso_pages(void) |
| @@ -0,0 +1,2 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 2 | vmlinux.lds | ||
| @@ -3,11 +3,11 @@ · 2 unmodified lines | |||
| 3 | * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. | 3 | * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #ifndef _ASM_MODULE_H | 6 | #ifndef _ASM_VERMAGIC_H |
| 7 | #define _ASM_MODULE_H | 7 | #define _ASM_VERMAGIC_H |
| 8 | 8 | ||
| 9 | #include <asm-generic/module.h> | 9 | #include <linux/stringify.h> |
| 10 | 10 | ||
| 11 | #define MODULE_ARCH_VERMAGIC __stringify(PROCESSOR_MODEL_NAME) " " | 11 | #define MODULE_ARCH_VERMAGIC __stringify(PROCESSOR_MODEL_NAME) " " |
| 12 | 12 | ||
| 13 | #endif | 13 | #endif /* _ASM_VERMAGIC_H */ |
| @@ -26,10 +26,6 @@ struct mod_arch_specific { · 25 unmodified lines | |||
| 26 | unsigned int next_got_entry; /* index of next available got entry */ | 26 | unsigned int next_got_entry; /* index of next available got entry */ |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | #define MODULE_PROC_FAMILY "ia64" | ||
| 30 | #define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY \ | ||
| 31 | "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__) | ||
| 32 | |||
| 33 | #define ARCH_SHF_SMALL SHF_IA_64_SHORT | 29 | #define ARCH_SHF_SMALL SHF_IA_64_SHORT |
| 34 | 30 | ||
| 35 | #endif /* _ASM_IA64_MODULE_H */ | 31 | #endif /* _ASM_IA64_MODULE_H */ |
| @@ -0,0 +1,15 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2003 Hewlett-Packard Co | ||
| 4 | * David Mosberger-Tang <davidm@hpl.hp.com> | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef _ASM_VERMAGIC_H | ||
| 8 | #define _ASM_VERMAGIC_H | ||
| 9 | |||
| 10 | #include <linux/stringify.h> | ||
| 11 | |||
| 12 | #define MODULE_ARCH_VERMAGIC "ia64" \ | ||
| 13 | "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__) | ||
| 14 | |||
| 15 | #endif /* _ASM_VERMAGIC_H */ | ||
| @@ -1,7 +1,6 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | generated-y += syscall_table.h | 2 | generated-y += syscall_table.h |
| 3 | generic-y += extable.h | 3 | generic-y += extable.h |
| 4 | generic-y += hardirq.h | ||
| 5 | generic-y += kvm_para.h | 4 | generic-y += kvm_para.h |
| 6 | generic-y += local64.h | 5 | generic-y += local64.h |
| 7 | generic-y += mcs_spinlock.h | 6 | generic-y += mcs_spinlock.h |
| @@ -83,65 +83,4 @@ search_module_dbetables(unsigned long addr) · 82 unmodified lines | |||
| 83 | } | 83 | } |
| 84 | #endif | 84 | #endif |
| 85 | 85 | ||
| 86 | #ifdef CONFIG_CPU_BMIPS | ||
| 87 | #define MODULE_PROC_FAMILY "BMIPS " | ||
| 88 | #elif defined CONFIG_CPU_MIPS32_R1 | ||
| 89 | #define MODULE_PROC_FAMILY "MIPS32_R1 " | ||
| 90 | #elif defined CONFIG_CPU_MIPS32_R2 | ||
| 91 | #define MODULE_PROC_FAMILY "MIPS32_R2 " | ||
| 92 | #elif defined CONFIG_CPU_MIPS32_R6 | ||
| 93 | #define MODULE_PROC_FAMILY "MIPS32_R6 " | ||
| 94 | #elif defined CONFIG_CPU_MIPS64_R1 | ||
| 95 | #define MODULE_PROC_FAMILY "MIPS64_R1 " | ||
| 96 | #elif defined CONFIG_CPU_MIPS64_R2 | ||
| 97 | #define MODULE_PROC_FAMILY "MIPS64_R2 " | ||
| 98 | #elif defined CONFIG_CPU_MIPS64_R6 | ||
| 99 | #define MODULE_PROC_FAMILY "MIPS64_R6 " | ||
| 100 | #elif defined CONFIG_CPU_R3000 | ||
| 101 | #define MODULE_PROC_FAMILY "R3000 " | ||
| 102 | #elif defined CONFIG_CPU_TX39XX | ||
| 103 | #define MODULE_PROC_FAMILY "TX39XX " | ||
| 104 | #elif defined CONFIG_CPU_VR41XX | ||
| 105 | #define MODULE_PROC_FAMILY "VR41XX " | ||
| 106 | #elif defined CONFIG_CPU_R4X00 | ||
| 107 | #define MODULE_PROC_FAMILY "R4X00 " | ||
| 108 | #elif defined CONFIG_CPU_TX49XX | ||
| 109 | #define MODULE_PROC_FAMILY "TX49XX " | ||
| 110 | #elif defined CONFIG_CPU_R5000 | ||
| 111 | #define MODULE_PROC_FAMILY "R5000 " | ||
| 112 | #elif defined CONFIG_CPU_R5500 | ||
| 113 | #define MODULE_PROC_FAMILY "R5500 " | ||
| 114 | #elif defined CONFIG_CPU_NEVADA | ||
| 115 | #define MODULE_PROC_FAMILY "NEVADA " | ||
| 116 | #elif defined CONFIG_CPU_R10000 | ||
| 117 | #define MODULE_PROC_FAMILY "R10000 " | ||
| 118 | #elif defined CONFIG_CPU_RM7000 | ||
| 119 | #define MODULE_PROC_FAMILY "RM7000 " | ||
| 120 | #elif defined CONFIG_CPU_SB1 | ||
| 121 | #define MODULE_PROC_FAMILY "SB1 " | ||
| 122 | #elif defined CONFIG_CPU_LOONGSON32 | ||
| 123 | #define MODULE_PROC_FAMILY "LOONGSON32 " | ||
| 124 | #elif defined CONFIG_CPU_LOONGSON2EF | ||
| 125 | #define MODULE_PROC_FAMILY "LOONGSON2EF " | ||
| 126 | #elif defined CONFIG_CPU_LOONGSON64 | ||
| 127 | #define MODULE_PROC_FAMILY "LOONGSON64 " | ||
| 128 | #elif defined CONFIG_CPU_CAVIUM_OCTEON | ||
| 129 | #define MODULE_PROC_FAMILY "OCTEON " | ||
| 130 | #elif defined CONFIG_CPU_XLR | ||
| 131 | #define MODULE_PROC_FAMILY "XLR " | ||
| 132 | #elif defined CONFIG_CPU_XLP | ||
| 133 | #define MODULE_PROC_FAMILY "XLP " | ||
| 134 | #else | ||
| 135 | #error MODULE_PROC_FAMILY undefined for your processor configuration | ||
| 136 | #endif | ||
| 137 | |||
| 138 | #ifdef CONFIG_32BIT | ||
| 139 | #define MODULE_KERNEL_TYPE "32BIT " | ||
| 140 | #elif defined CONFIG_64BIT | ||
| 141 | #define MODULE_KERNEL_TYPE "64BIT " | ||
| 142 | #endif | ||
| 143 | |||
| 144 | #define MODULE_ARCH_VERMAGIC \ | ||
| 145 | MODULE_PROC_FAMILY MODULE_KERNEL_TYPE | ||
| 146 | |||
| 147 | #endif /* _ASM_MODULE_H */ | 86 | #endif /* _ASM_MODULE_H */ |
| @@ -0,0 +1,66 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _ASM_VERMAGIC_H | ||
| 3 | #define _ASM_VERMAGIC_H | ||
| 4 | |||
| 5 | #ifdef CONFIG_CPU_BMIPS | ||
| 6 | #define MODULE_PROC_FAMILY "BMIPS " | ||
| 7 | #elif defined CONFIG_CPU_MIPS32_R1 | ||
| 8 | #define MODULE_PROC_FAMILY "MIPS32_R1 " | ||
| 9 | #elif defined CONFIG_CPU_MIPS32_R2 | ||
| 10 | #define MODULE_PROC_FAMILY "MIPS32_R2 " | ||
| 11 | #elif defined CONFIG_CPU_MIPS32_R6 | ||
| 12 | #define MODULE_PROC_FAMILY "MIPS32_R6 " | ||
| 13 | #elif defined CONFIG_CPU_MIPS64_R1 | ||
| 14 | #define MODULE_PROC_FAMILY "MIPS64_R1 " | ||
| 15 | #elif defined CONFIG_CPU_MIPS64_R2 | ||
| 16 | #define MODULE_PROC_FAMILY "MIPS64_R2 " | ||
| 17 | #elif defined CONFIG_CPU_MIPS64_R6 | ||
| 18 | #define MODULE_PROC_FAMILY "MIPS64_R6 " | ||
| 19 | #elif defined CONFIG_CPU_R3000 | ||
| 20 | #define MODULE_PROC_FAMILY "R3000 " | ||
| 21 | #elif defined CONFIG_CPU_TX39XX | ||
| 22 | #define MODULE_PROC_FAMILY "TX39XX " | ||
| 23 | #elif defined CONFIG_CPU_VR41XX | ||
| 24 | #define MODULE_PROC_FAMILY "VR41XX " | ||
| 25 | #elif defined CONFIG_CPU_R4X00 | ||
| 26 | #define MODULE_PROC_FAMILY "R4X00 " | ||
| 27 | #elif defined CONFIG_CPU_TX49XX | ||
| 28 | #define MODULE_PROC_FAMILY "TX49XX " | ||
| 29 | #elif defined CONFIG_CPU_R5000 | ||
| 30 | #define MODULE_PROC_FAMILY "R5000 " | ||
| 31 | #elif defined CONFIG_CPU_R5500 | ||
| 32 | #define MODULE_PROC_FAMILY "R5500 " | ||
| 33 | #elif defined CONFIG_CPU_NEVADA | ||
| 34 | #define MODULE_PROC_FAMILY "NEVADA " | ||
| 35 | #elif defined CONFIG_CPU_R10000 | ||
| 36 | #define MODULE_PROC_FAMILY "R10000 " | ||
| 37 | #elif defined CONFIG_CPU_RM7000 | ||
| 38 | #define MODULE_PROC_FAMILY "RM7000 " | ||
| 39 | #elif defined CONFIG_CPU_SB1 | ||
| 40 | #define MODULE_PROC_FAMILY "SB1 " | ||
| 41 | #elif defined CONFIG_CPU_LOONGSON32 | ||
| 42 | #define MODULE_PROC_FAMILY "LOONGSON32 " | ||
| 43 | #elif defined CONFIG_CPU_LOONGSON2EF | ||
| 44 | #define MODULE_PROC_FAMILY "LOONGSON2EF " | ||
| 45 | #elif defined CONFIG_CPU_LOONGSON64 | ||
| 46 | #define MODULE_PROC_FAMILY "LOONGSON64 " | ||
| 47 | #elif defined CONFIG_CPU_CAVIUM_OCTEON | ||
| 48 | #define MODULE_PROC_FAMILY "OCTEON " | ||
| 49 | #elif defined CONFIG_CPU_XLR | ||
| 50 | #define MODULE_PROC_FAMILY "XLR " | ||
| 51 | #elif defined CONFIG_CPU_XLP | ||
| 52 | #define MODULE_PROC_FAMILY "XLP " | ||
| 53 | #else | ||
| 54 | #error MODULE_PROC_FAMILY undefined for your processor configuration | ||
| 55 | #endif | ||
| 56 | |||
| 57 | #ifdef CONFIG_32BIT | ||
| 58 | #define MODULE_KERNEL_TYPE "32BIT " | ||
| 59 | #elif defined CONFIG_64BIT | ||
| 60 | #define MODULE_KERNEL_TYPE "64BIT " | ||
| 61 | #endif | ||
| 62 | |||
| 63 | #define MODULE_ARCH_VERMAGIC \ | ||
| 64 | MODULE_PROC_FAMILY MODULE_KERNEL_TYPE | ||
| 65 | |||
| 66 | #endif /* _ASM_VERMAGIC_H */ | ||
| @@ -1,11 +1,9 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | // Copyright (C) 2005-2017 Andes Technology Corporation | 2 | // Copyright (C) 2005-2017 Andes Technology Corporation |
| 3 | 3 | ||
| 4 | #ifndef _ASM_NDS32_MODULE_H | 4 | #ifndef _ASM_VERMAGIC_H |
| 5 | #define _ASM_NDS32_MODULE_H | 5 | #define _ASM_VERMAGIC_H |
| 6 | |||
| 7 | #include <asm-generic/module.h> | ||
| 8 | 6 | ||
| 9 | #define MODULE_ARCH_VERMAGIC "NDS32v3" | 7 | #define MODULE_ARCH_VERMAGIC "NDS32v3" |
| 10 | 8 | ||
| 11 | #endif /* _ASM_NDS32_MODULE_H */ | 9 | #endif /* _ASM_VERMAGIC_H */ |
| @@ -3,28 +3,10 @@ · 2 unmodified lines | |||
| 3 | #define _ASM_POWERPC_MODULE_H | 3 | #define _ASM_POWERPC_MODULE_H |
| 4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
| 5 | 5 | ||
| 6 | /* | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include <linux/list.h> | 6 | #include <linux/list.h> |
| 10 | #include <asm/bug.h> | 7 | #include <asm/bug.h> |
| 11 | #include <asm-generic/module.h> | 8 | #include <asm-generic/module.h> |
| 12 | 9 | ||
| 13 | |||
| 14 | #ifdef CONFIG_MPROFILE_KERNEL | ||
| 15 | #define MODULE_ARCH_VERMAGIC_FTRACE "mprofile-kernel " | ||
| 16 | #else | ||
| 17 | #define MODULE_ARCH_VERMAGIC_FTRACE "" | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #ifdef CONFIG_RELOCATABLE | ||
| 21 | #define MODULE_ARCH_VERMAGIC_RELOCATABLE "relocatable " | ||
| 22 | #else | ||
| 23 | #define MODULE_ARCH_VERMAGIC_RELOCATABLE "" | ||
| 24 | #endif | ||
| 25 | |||
| 26 | #define MODULE_ARCH_VERMAGIC MODULE_ARCH_VERMAGIC_FTRACE MODULE_ARCH_VERMAGIC_RELOCATABLE | ||
| 27 | |||
| 28 | #ifndef __powerpc64__ | 10 | #ifndef __powerpc64__ |
| 29 | /* | 11 | /* |
| 30 | * Thanks to Paul M for explaining this. | 12 | * Thanks to Paul M for explaining this. |
| @@ -0,0 +1,20 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _ASM_VERMAGIC_H | ||
| 3 | #define _ASM_VERMAGIC_H | ||
| 4 | |||
| 5 | #ifdef CONFIG_MPROFILE_KERNEL | ||
| 6 | #define MODULE_ARCH_VERMAGIC_FTRACE "mprofile-kernel " | ||
| 7 | #else | ||
| 8 | #define MODULE_ARCH_VERMAGIC_FTRACE "" | ||
| 9 | #endif | ||
| 10 | |||
| 11 | #ifdef CONFIG_RELOCATABLE | ||
| 12 | #define MODULE_ARCH_VERMAGIC_RELOCATABLE "relocatable " | ||
| 13 | #else | ||
| 14 | #define MODULE_ARCH_VERMAGIC_RELOCATABLE "" | ||
| 15 | #endif | ||
| 16 | |||
| 17 | #define MODULE_ARCH_VERMAGIC \ | ||
| 18 | MODULE_ARCH_VERMAGIC_FTRACE MODULE_ARCH_VERMAGIC_RELOCATABLE | ||
| 19 | |||
| 20 | #endif /* _ASM_VERMAGIC_H */ | ||
| @@ -732,7 +732,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_SPE) · 731 unmodified lines | |||
| 732 | stw r10,_CCR(r1) | 732 | stw r10,_CCR(r1) |
| 733 | stw r1,KSP(r3) /* Set old stack pointer */ | 733 | stw r1,KSP(r3) /* Set old stack pointer */ |
| 734 | 734 | ||
| 735 | kuap_check r2, r4 | 735 | kuap_check r2, r0 |
| 736 | #ifdef CONFIG_SMP | 736 | #ifdef CONFIG_SMP |
| 737 | /* We need a sync somewhere here to make sure that if the | 737 | /* We need a sync somewhere here to make sure that if the |
| 738 | * previous task gets rescheduled on another CPU, it sees all | 738 | * previous task gets rescheduled on another CPU, it sees all |
| @@ -534,6 +534,8 @@ static bool __init parse_cache_info(struct device_node *np, · 533 unmodified lines | |||
| 534 | lsizep = of_get_property(np, propnames[3], NULL); | 534 | lsizep = of_get_property(np, propnames[3], NULL); |
| 535 | if (bsizep == NULL) | 535 | if (bsizep == NULL) |
| 536 | bsizep = lsizep; | 536 | bsizep = lsizep; |
| 537 | if (lsizep == NULL) | ||
| 538 | lsizep = bsizep; | ||
| 537 | if (lsizep != NULL) | 539 | if (lsizep != NULL) |
| 538 | lsize = be32_to_cpu(*lsizep); | 540 | lsize = be32_to_cpu(*lsizep); |
| 539 | if (bsizep != NULL) | 541 | if (bsizep != NULL) |
| @@ -604,18 +604,19 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, · 603 unmodified lines | |||
| 604 | */ | 604 | */ |
| 605 | local_irq_disable(); | 605 | local_irq_disable(); |
| 606 | ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift); | 606 | ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift); |
| 607 | pte = __pte(0); | ||
| 608 | if (ptep) | ||
| 609 | pte = *ptep; | ||
| 610 | local_irq_enable(); | ||
| 607 | /* | 611 | /* |
| 608 | * If the PTE disappeared temporarily due to a THP | 612 | * If the PTE disappeared temporarily due to a THP |
| 609 | * collapse, just return and let the guest try again. | 613 | * collapse, just return and let the guest try again. |
| 610 | */ | 614 | */ |
| 611 | if (!ptep) { | 615 | if (!pte_present(pte)) { |
| 612 | local_irq_enable(); | ||
| 613 | if (page) | 616 | if (page) |
| 614 | put_page(page); | 617 | put_page(page); |
| 615 | return RESUME_GUEST; | 618 | return RESUME_GUEST; |
| 616 | } | 619 | } |
| 617 | pte = *ptep; | ||
| 618 | local_irq_enable(); | ||
| 619 | hpa = pte_pfn(pte) << PAGE_SHIFT; | 620 | hpa = pte_pfn(pte) << PAGE_SHIFT; |
| 620 | pte_size = PAGE_SIZE; | 621 | pte_size = PAGE_SIZE; |
| 621 | if (shift) | 622 | if (shift) |
| @@ -815,18 +815,19 @@ int kvmppc_book3s_instantiate_page(struct kvm_vcpu *vcpu, · 814 unmodified lines | |||
| 815 | */ | 815 | */ |
| 816 | local_irq_disable(); | 816 | local_irq_disable(); |
| 817 | ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift); | 817 | ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift); |
| 818 | pte = __pte(0); | ||
| 819 | if (ptep) | ||
| 820 | pte = *ptep; | ||
| 821 | local_irq_enable(); | ||
| 818 | /* | 822 | /* |
| 819 | * If the PTE disappeared temporarily due to a THP | 823 | * If the PTE disappeared temporarily due to a THP |
| 820 | * collapse, just return and let the guest try again. | 824 | * collapse, just return and let the guest try again. |
| 821 | */ | 825 | */ |
| 822 | if (!ptep) { | 826 | if (!pte_present(pte)) { |
| 823 | local_irq_enable(); | ||
| 824 | if (page) | 827 | if (page) |
| 825 | put_page(page); | 828 | put_page(page); |
| 826 | return RESUME_GUEST; | 829 | return RESUME_GUEST; |
| 827 | } | 830 | } |
| 828 | pte = *ptep; | ||
| 829 | local_irq_enable(); | ||
| 830 | 831 | ||
| 831 | /* If we're logging dirty pages, always map single pages */ | 832 | /* If we're logging dirty pages, always map single pages */ |
| 832 | large_enable = !(memslot->flags & KVM_MEM_LOG_DIRTY_PAGES); | 833 | large_enable = !(memslot->flags & KVM_MEM_LOG_DIRTY_PAGES); |
| @@ -185,6 +185,7 @@ void mmu_mark_initmem_nx(void) · 184 unmodified lines | |||
| 185 | mmu_mapin_ram_chunk(etext8, einittext8, PAGE_KERNEL); | 185 | mmu_mapin_ram_chunk(etext8, einittext8, PAGE_KERNEL); |
| 186 | } | 186 | } |
| 187 | } | 187 | } |
| 188 | _tlbil_all(); | ||
| 188 | } | 189 | } |
| 189 | 190 | ||
| 190 | #ifdef CONFIG_STRICT_KERNEL_RWX | 191 | #ifdef CONFIG_STRICT_KERNEL_RWX |
| @@ -199,6 +200,8 @@ void mmu_mark_rodata_ro(void) · 8 unmodified lines | |||
| 199 | ~(LARGE_PAGE_SIZE_8M - 1))); | 200 | ~(LARGE_PAGE_SIZE_8M - 1))); |
| 200 | mmu_patch_addis(&patch__dtlbmiss_romem_top, -__pa(_sinittext)); | 201 | mmu_patch_addis(&patch__dtlbmiss_romem_top, -__pa(_sinittext)); |
| 201 | 202 | ||
| 203 | _tlbil_all(); | ||
| 204 | |||
| 202 | /* Update page tables for PTDUMP and BDI */ | 205 | /* Update page tables for PTDUMP and BDI */ |
| 203 | mmu_mapin_ram_chunk(0, sinittext, __pgprot(0)); | 206 | mmu_mapin_ram_chunk(0, sinittext, __pgprot(0)); |
| 204 | mmu_mapin_ram_chunk(0, etext, PAGE_KERNEL_ROX); | 207 | mmu_mapin_ram_chunk(0, etext, PAGE_KERNEL_ROX); |
| @@ -397,7 +397,7 @@ config PPC_KUAP · 396 unmodified lines | |||
| 397 | 397 | ||
| 398 | config PPC_KUAP_DEBUG | 398 | config PPC_KUAP_DEBUG |
| 399 | bool "Extra debugging for Kernel Userspace Access Protection" | 399 | bool "Extra debugging for Kernel Userspace Access Protection" |
| 400 | depends on PPC_KUAP && (PPC_RADIX_MMU || PPC_32) | 400 | depends on PPC_KUAP && (PPC_RADIX_MMU || PPC32) |
| 401 | help | 401 | help |
| 402 | Add extra debugging for Kernel Userspace Access Protection (KUAP) | 402 | Add extra debugging for Kernel Userspace Access Protection (KUAP) |
| 403 | If you're unsure, say N. | 403 | If you're unsure, say N. |
| @@ -55,7 +55,7 @@ config RISCV · 54 unmodified lines | |||
| 55 | select ARCH_HAS_PTE_SPECIAL | 55 | select ARCH_HAS_PTE_SPECIAL |
| 56 | select ARCH_HAS_MMIOWB | 56 | select ARCH_HAS_MMIOWB |
| 57 | select ARCH_HAS_DEBUG_VIRTUAL | 57 | select ARCH_HAS_DEBUG_VIRTUAL |
| 58 | select HAVE_EBPF_JIT | 58 | select HAVE_EBPF_JIT if MMU |
| 59 | select EDAC_SUPPORT | 59 | select EDAC_SUPPORT |
| 60 | select ARCH_HAS_GIGANTIC_PAGE | 60 | select ARCH_HAS_GIGANTIC_PAGE |
| 61 | select ARCH_HAS_SET_DIRECT_MAP | 61 | select ARCH_HAS_SET_DIRECT_MAP |
| @@ -6,8 +6,6 @@ · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | #include <asm-generic/module.h> | 7 | #include <asm-generic/module.h> |
| 8 | 8 | ||
| 9 | #define MODULE_ARCH_VERMAGIC "riscv" | ||
| 10 | |||
| 11 | struct module; | 9 | struct module; |
| 12 | unsigned long module_emit_got_entry(struct module *mod, unsigned long val); | 10 | unsigned long module_emit_got_entry(struct module *mod, unsigned long val); |
| 13 | unsigned long module_emit_plt_entry(struct module *mod, unsigned long val); | 11 | unsigned long module_emit_plt_entry(struct module *mod, unsigned long val); |
| @@ -0,0 +1,9 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* Copyright (C) 2017 Andes Technology Corporation */ | ||
| 3 | |||
| 4 | #ifndef _ASM_VERMAGIC_H | ||
| 5 | #define _ASM_VERMAGIC_H | ||
| 6 | |||
| 7 | #define MODULE_ARCH_VERMAGIC "riscv" | ||
| 8 | |||
| 9 | #endif /* _ASM_VERMAGIC_H */ | ||
| @@ -110,6 +110,16 @@ static bool is_32b_int(s64 val) · 109 unmodified lines | |||
| 110 | return -(1L << 31) <= val && val < (1L << 31); | 110 | return -(1L << 31) <= val && val < (1L << 31); |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | static bool in_auipc_jalr_range(s64 val) | ||
| 114 | { | ||
| 115 | /* | ||
| 116 | * auipc+jalr can reach any signed PC-relative offset in the range | ||
| 117 | * [-2^31 - 2^11, 2^31 - 2^11). | ||
| 118 | */ | ||
| 119 | return (-(1L << 31) - (1L << 11)) <= val && | ||
| 120 | val < ((1L << 31) - (1L << 11)); | ||
| 121 | } | ||
| 122 | |||
| 113 | static void emit_imm(u8 rd, s64 val, struct rv_jit_context *ctx) | 123 | static void emit_imm(u8 rd, s64 val, struct rv_jit_context *ctx) |
| 114 | { | 124 | { |
| 115 | /* Note that the immediate from the add is sign-extended, | 125 | /* Note that the immediate from the add is sign-extended, |
| @@ -380,20 +390,24 @@ static void emit_sext_32_rd(u8 *rd, struct rv_jit_context *ctx) · 264 unmodified lines | |||
| 380 | *rd = RV_REG_T2; | 390 | *rd = RV_REG_T2; |
| 381 | } | 391 | } |
| 382 | 392 | ||
| 383 | static void emit_jump_and_link(u8 rd, s64 rvoff, bool force_jalr, | 393 | static int emit_jump_and_link(u8 rd, s64 rvoff, bool force_jalr, |
| 384 | struct rv_jit_context *ctx) | 394 | struct rv_jit_context *ctx) |
| 385 | { | 395 | { |
| 386 | s64 upper, lower; | 396 | s64 upper, lower; |
| 387 | 397 | ||
| 388 | if (rvoff && is_21b_int(rvoff) && !force_jalr) { | 398 | if (rvoff && is_21b_int(rvoff) && !force_jalr) { |
| 389 | emit(rv_jal(rd, rvoff >> 1), ctx); | 399 | emit(rv_jal(rd, rvoff >> 1), ctx); |
| 390 | return; | 400 | return 0; |
| 401 | } else if (in_auipc_jalr_range(rvoff)) { | ||
| 402 | upper = (rvoff + (1 << 11)) >> 12; | ||
| 403 | lower = rvoff & 0xfff; | ||
| 404 | emit(rv_auipc(RV_REG_T1, upper), ctx); | ||
| 405 | emit(rv_jalr(rd, RV_REG_T1, lower), ctx); | ||
| 406 | return 0; | ||
| 391 | } | 407 | } |
| 392 | 408 | ||
| 393 | upper = (rvoff + (1 << 11)) >> 12; | 409 | pr_err("bpf-jit: target offset 0x%llx is out of range\n", rvoff); |
| 394 | lower = rvoff & 0xfff; | 410 | return -ERANGE; |
| 395 | emit(rv_auipc(RV_REG_T1, upper), ctx); | ||
| 396 | emit(rv_jalr(rd, RV_REG_T1, lower), ctx); | ||
| 397 | } | 411 | } |
| 398 | 412 | ||
| 399 | static bool is_signed_bpf_cond(u8 cond) | 413 | static bool is_signed_bpf_cond(u8 cond) |
| @@ -407,18 +421,16 @@ static int emit_call(bool fixed, u64 addr, struct rv_jit_context *ctx) · 7 unmodified lines | |||
| 407 | s64 off = 0; | 421 | s64 off = 0; |
| 408 | u64 ip; | 422 | u64 ip; |
| 409 | u8 rd; | 423 | u8 rd; |
| 424 | int ret; | ||
| 410 | 425 | ||
| 411 | if (addr && ctx->insns) { | 426 | if (addr && ctx->insns) { |
| 412 | ip = (u64)(long)(ctx->insns + ctx->ninsns); | 427 | ip = (u64)(long)(ctx->insns + ctx->ninsns); |
| 413 | off = addr - ip; | 428 | off = addr - ip; |
| 414 | if (!is_32b_int(off)) { | ||
| 415 | pr_err("bpf-jit: target call addr %pK is out of range\n", | ||
| 416 | (void *)addr); | ||
| 417 | return -ERANGE; | ||
| 418 | } | ||
| 419 | } | 429 | } |
| 420 | 430 | ||
| 421 | emit_jump_and_link(RV_REG_RA, off, !fixed, ctx); | 431 | ret = emit_jump_and_link(RV_REG_RA, off, !fixed, ctx); |
| 432 | if (ret) | ||
| 433 | return ret; | ||
| 422 | rd = bpf_to_rv_reg(BPF_REG_0, ctx); | 434 | rd = bpf_to_rv_reg(BPF_REG_0, ctx); |
| 423 | emit(rv_addi(rd, RV_REG_A0, 0), ctx); | 435 | emit(rv_addi(rd, RV_REG_A0, 0), ctx); |
| 424 | return 0; | 436 | return 0; |
| @@ -429,7 +441,7 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn, struct rv_jit_context *ctx, · 4 unmodified lines | |||
| 429 | { | 441 | { |
| 430 | bool is64 = BPF_CLASS(insn->code) == BPF_ALU64 || | 442 | bool is64 = BPF_CLASS(insn->code) == BPF_ALU64 || |
| 431 | BPF_CLASS(insn->code) == BPF_JMP; | 443 | BPF_CLASS(insn->code) == BPF_JMP; |
| 432 | int s, e, rvoff, i = insn - ctx->prog->insnsi; | 444 | int s, e, rvoff, ret, i = insn - ctx->prog->insnsi; |
| 433 | struct bpf_prog_aux *aux = ctx->prog->aux; | 445 | struct bpf_prog_aux *aux = ctx->prog->aux; |
| 434 | u8 rd = -1, rs = -1, code = insn->code; | 446 | u8 rd = -1, rs = -1, code = insn->code; |
| 435 | s16 off = insn->off; | 447 | s16 off = insn->off; |
| @@ -699,7 +711,9 @@ out_be: · 263 unmodified lines | |||
| 699 | /* JUMP off */ | 711 | /* JUMP off */ |
| 700 | case BPF_JMP | BPF_JA: | 712 | case BPF_JMP | BPF_JA: |
| 701 | rvoff = rv_offset(i, off, ctx); | 713 | rvoff = rv_offset(i, off, ctx); |
| 702 | emit_jump_and_link(RV_REG_ZERO, rvoff, false, ctx); | 714 | ret = emit_jump_and_link(RV_REG_ZERO, rvoff, false, ctx); |
| 715 | if (ret) | ||
| 716 | return ret; | ||
| 703 | break; | 717 | break; |
| 704 | 718 | ||
| 705 | /* IF (dst COND src) JUMP off */ | 719 | /* IF (dst COND src) JUMP off */ |
| @@ -801,7 +815,6 @@ out_be: · 95 unmodified lines | |||
| 801 | case BPF_JMP | BPF_CALL: | 815 | case BPF_JMP | BPF_CALL: |
| 802 | { | 816 | { |
| 803 | bool fixed; | 817 | bool fixed; |
| 804 | int ret; | ||
| 805 | u64 addr; | 818 | u64 addr; |
| 806 | 819 | ||
| 807 | mark_call(ctx); | 820 | mark_call(ctx); |
| @@ -826,7 +839,9 @@ out_be: · 18 unmodified lines | |||
| 826 | break; | 839 | break; |
| 827 | 840 | ||
| 828 | rvoff = epilogue_offset(ctx); | 841 | rvoff = epilogue_offset(ctx); |
| 829 | emit_jump_and_link(RV_REG_ZERO, rvoff, false, ctx); | 842 | ret = emit_jump_and_link(RV_REG_ZERO, rvoff, false, ctx); |
| 843 | if (ret) | ||
| 844 | return ret; | ||
| 830 | break; | 845 | break; |
| 831 | 846 | ||
| 832 | /* dst = imm64 */ | 847 | /* dst = imm64 */ |
| @@ -7,9 +7,7 @@ · 6 unmodified lines | |||
| 7 | #ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST | 7 | #ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST |
| 8 | int __bootdata_preserved(prot_virt_guest); | 8 | int __bootdata_preserved(prot_virt_guest); |
| 9 | #endif | 9 | #endif |
| 10 | #if IS_ENABLED(CONFIG_KVM) | ||
| 11 | struct uv_info __bootdata_preserved(uv_info); | 10 | struct uv_info __bootdata_preserved(uv_info); |
| 12 | #endif | ||
| 13 | 11 | ||
| 14 | void uv_query_info(void) | 12 | void uv_query_info(void) |
| 15 | { | 13 | { |
| @@ -133,7 +133,7 @@ void diag_stat_inc(enum diag_stat_enum nr) · 132 unmodified lines | |||
| 133 | } | 133 | } |
| 134 | EXPORT_SYMBOL(diag_stat_inc); | 134 | EXPORT_SYMBOL(diag_stat_inc); |
| 135 | 135 | ||
| 136 | void diag_stat_inc_norecursion(enum diag_stat_enum nr) | 136 | void notrace diag_stat_inc_norecursion(enum diag_stat_enum nr) |
| 137 | { | 137 | { |
| 138 | this_cpu_inc(diag_stat.counter[nr]); | 138 | this_cpu_inc(diag_stat.counter[nr]); |
| 139 | trace_s390_diagnose_norecursion(diag_map[nr].code); | 139 | trace_s390_diagnose_norecursion(diag_map[nr].code); |
| @@ -403,7 +403,7 @@ int smp_find_processor_id(u16 address) · 402 unmodified lines | |||
| 403 | return -1; | 403 | return -1; |
| 404 | } | 404 | } |
| 405 | 405 | ||
| 406 | bool arch_vcpu_is_preempted(int cpu) | 406 | bool notrace arch_vcpu_is_preempted(int cpu) |
| 407 | { | 407 | { |
| 408 | if (test_cpu_flag_of(CIF_ENABLED_WAIT, cpu)) | 408 | if (test_cpu_flag_of(CIF_ENABLED_WAIT, cpu)) |
| 409 | return false; | 409 | return false; |
| @@ -413,7 +413,7 @@ bool arch_vcpu_is_preempted(int cpu) · 3 unmodified lines | |||
| 413 | } | 413 | } |
| 414 | EXPORT_SYMBOL(arch_vcpu_is_preempted); | 414 | EXPORT_SYMBOL(arch_vcpu_is_preempted); |
| 415 | 415 | ||
| 416 | void smp_yield_cpu(int cpu) | 416 | void notrace smp_yield_cpu(int cpu) |
| 417 | { | 417 | { |
| 418 | if (!MACHINE_HAS_DIAG9C) | 418 | if (!MACHINE_HAS_DIAG9C) |
| 419 | return; | 419 | return; |
| @@ -14,7 +14,7 @@ EXPORT_TRACEPOINT_SYMBOL(s390_diagnose); · 13 unmodified lines | |||
| 14 | 14 | ||
| 15 | static DEFINE_PER_CPU(unsigned int, diagnose_trace_depth); | 15 | static DEFINE_PER_CPU(unsigned int, diagnose_trace_depth); |
| 16 | 16 | ||
| 17 | void trace_s390_diagnose_norecursion(int diag_nr) | 17 | void notrace trace_s390_diagnose_norecursion(int diag_nr) |
| 18 | { | 18 | { |
| 19 | unsigned long flags; | 19 | unsigned long flags; |
| 20 | unsigned int *depth; | 20 | unsigned int *depth; |
| @@ -23,10 +23,11 @@ · 22 unmodified lines | |||
| 23 | int __bootdata_preserved(prot_virt_guest); | 23 | int __bootdata_preserved(prot_virt_guest); |
| 24 | #endif | 24 | #endif |
| 25 | 25 | ||
| 26 | struct uv_info __bootdata_preserved(uv_info); | ||
| 27 | |||
| 26 | #if IS_ENABLED(CONFIG_KVM) | 28 | #if IS_ENABLED(CONFIG_KVM) |
| 27 | int prot_virt_host; | 29 | int prot_virt_host; |
| 28 | EXPORT_SYMBOL(prot_virt_host); | 30 | EXPORT_SYMBOL(prot_virt_host); |
| 29 | struct uv_info __bootdata_preserved(uv_info); | ||
| 30 | EXPORT_SYMBOL(uv_info); | 31 | EXPORT_SYMBOL(uv_info); |
| 31 | 32 | ||
| 32 | static int __init prot_virt_setup(char *val) | 33 | static int __init prot_virt_setup(char *val) |
| @@ -393,7 +393,7 @@ static unsigned long deliverable_irqs(struct kvm_vcpu *vcpu) · 392 unmodified lines | |||
| 393 | if (psw_mchk_disabled(vcpu)) | 393 | if (psw_mchk_disabled(vcpu)) |
| 394 | active_mask &= ~IRQ_PEND_MCHK_MASK; | 394 | active_mask &= ~IRQ_PEND_MCHK_MASK; |
| 395 | /* PV guest cpus can have a single interruption injected at a time. */ | 395 | /* PV guest cpus can have a single interruption injected at a time. */ |
| 396 | if (kvm_s390_pv_cpu_is_protected(vcpu) && | 396 | if (kvm_s390_pv_cpu_get_handle(vcpu) && |
| 397 | vcpu->arch.sie_block->iictl != IICTL_CODE_NONE) | 397 | vcpu->arch.sie_block->iictl != IICTL_CODE_NONE) |
| 398 | active_mask &= ~(IRQ_PEND_EXT_II_MASK | | 398 | active_mask &= ~(IRQ_PEND_EXT_II_MASK | |
| 399 | IRQ_PEND_IO_MASK | | 399 | IRQ_PEND_IO_MASK | |
| @@ -1939,6 +1939,9 @@ static int gfn_to_memslot_approx(struct kvm_memslots *slots, gfn_t gfn) · 1938 unmodified lines | |||
| 1939 | start = slot + 1; | 1939 | start = slot + 1; |
| 1940 | } | 1940 | } |
| 1941 | 1941 | ||
| 1942 | if (start >= slots->used_slots) | ||
| 1943 | return slots->used_slots - 1; | ||
| 1944 | |||
| 1942 | if (gfn >= memslots[start].base_gfn && | 1945 | if (gfn >= memslots[start].base_gfn && |
| 1943 | gfn < memslots[start].base_gfn + memslots[start].npages) { | 1946 | gfn < memslots[start].base_gfn + memslots[start].npages) { |
| 1944 | atomic_set(&slots->lru_slot, start); | 1947 | atomic_set(&slots->lru_slot, start); |
| @@ -115,7 +115,6 @@ static struct irq_chip zpci_irq_chip = { · 114 unmodified lines | |||
| 115 | .name = "PCI-MSI", | 115 | .name = "PCI-MSI", |
| 116 | .irq_unmask = pci_msi_unmask_irq, | 116 | .irq_unmask = pci_msi_unmask_irq, |
| 117 | .irq_mask = pci_msi_mask_irq, | 117 | .irq_mask = pci_msi_mask_irq, |
| 118 | .irq_set_affinity = zpci_set_irq_affinity, | ||
| 119 | }; | 118 | }; |
| 120 | 119 | ||
| 121 | static void zpci_handle_cpu_local_irq(bool rescan) | 120 | static void zpci_handle_cpu_local_irq(bool rescan) |
| @@ -276,7 +275,9 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) · 154 unmodified lines | |||
| 276 | rc = -EIO; | 275 | rc = -EIO; |
| 277 | if (hwirq - bit >= msi_vecs) | 276 | if (hwirq - bit >= msi_vecs) |
| 278 | break; | 277 | break; |
| 279 | irq = __irq_alloc_descs(-1, 0, 1, 0, THIS_MODULE, msi->affinity); | 278 | irq = __irq_alloc_descs(-1, 0, 1, 0, THIS_MODULE, |
| 279 | (irq_delivery == DIRECTED) ? | ||
| 280 | msi->affinity : NULL); | ||
| 280 | if (irq < 0) | 281 | if (irq < 0) |
| 281 | return -ENOMEM; | 282 | return -ENOMEM; |
| 282 | rc = irq_set_msi_desc(irq, msi); | 283 | rc = irq_set_msi_desc(irq, msi); |
| @@ -11,32 +11,4 @@ struct mod_arch_specific { · 10 unmodified lines | |||
| 11 | }; | 11 | }; |
| 12 | #endif | 12 | #endif |
| 13 | 13 | ||
| 14 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | ||
| 15 | # ifdef CONFIG_CPU_SH2 | ||
| 16 | # define MODULE_PROC_FAMILY "SH2LE " | ||
| 17 | # elif defined CONFIG_CPU_SH3 | ||
| 18 | # define MODULE_PROC_FAMILY "SH3LE " | ||
| 19 | # elif defined CONFIG_CPU_SH4 | ||
| 20 | # define MODULE_PROC_FAMILY "SH4LE " | ||
| 21 | # elif defined CONFIG_CPU_SH5 | ||
| 22 | # define MODULE_PROC_FAMILY "SH5LE " | ||
| 23 | # else | ||
| 24 | # error unknown processor family | ||
| 25 | # endif | ||
| 26 | #else | ||
| 27 | # ifdef CONFIG_CPU_SH2 | ||
| 28 | # define MODULE_PROC_FAMILY "SH2BE " | ||
| 29 | # elif defined CONFIG_CPU_SH3 | ||
| 30 | # define MODULE_PROC_FAMILY "SH3BE " | ||
| 31 | # elif defined CONFIG_CPU_SH4 | ||
| 32 | # define MODULE_PROC_FAMILY "SH4BE " | ||
| 33 | # elif defined CONFIG_CPU_SH5 | ||
| 34 | # define MODULE_PROC_FAMILY "SH5BE " | ||
| 35 | # else | ||
| 36 | # error unknown processor family | ||
| 37 | # endif | ||
| 38 | #endif | ||
| 39 | |||
| 40 | #define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY | ||
| 41 | |||
| 42 | #endif /* _ASM_SH_MODULE_H */ | 14 | #endif /* _ASM_SH_MODULE_H */ |
| @@ -0,0 +1,34 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | |||
| 3 | #ifndef _ASM_VERMAGIC_H | ||
| 4 | #define _ASM_VERMAGIC_H | ||
| 5 | |||
| 6 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | ||
| 7 | # ifdef CONFIG_CPU_SH2 | ||
| 8 | # define MODULE_PROC_FAMILY "SH2LE " | ||
| 9 | # elif defined CONFIG_CPU_SH3 | ||
| 10 | # define MODULE_PROC_FAMILY "SH3LE " | ||
| 11 | # elif defined CONFIG_CPU_SH4 | ||
| 12 | # define MODULE_PROC_FAMILY "SH4LE " | ||
| 13 | # elif defined CONFIG_CPU_SH5 | ||
| 14 | # define MODULE_PROC_FAMILY "SH5LE " | ||
| 15 | # else | ||
| 16 | # error unknown processor family | ||
| 17 | # endif | ||
| 18 | #else | ||
| 19 | # ifdef CONFIG_CPU_SH2 | ||
| 20 | # define MODULE_PROC_FAMILY "SH2BE " | ||
| 21 | # elif defined CONFIG_CPU_SH3 | ||
| 22 | # define MODULE_PROC_FAMILY "SH3BE " | ||
| 23 | # elif defined CONFIG_CPU_SH4 | ||
| 24 | # define MODULE_PROC_FAMILY "SH4BE " | ||
| 25 | # elif defined CONFIG_CPU_SH5 | ||
| 26 | # define MODULE_PROC_FAMILY "SH5BE " | ||
| 27 | # else | ||
| 28 | # error unknown processor family | ||
| 29 | # endif | ||
| 30 | #endif | ||
| 31 | |||
| 32 | #define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY | ||
| 33 | |||
| 34 | #endif /* _ASM_VERMAGIC_H */ | ||
| @@ -412,7 +412,7 @@ int arch_add_memory(int nid, u64 start, u64 size, · 411 unmodified lines | |||
| 412 | unsigned long nr_pages = size >> PAGE_SHIFT; | 412 | unsigned long nr_pages = size >> PAGE_SHIFT; |
| 413 | int ret; | 413 | int ret; |
| 414 | 414 | ||
| 415 | if (WARN_ON_ONCE(params->pgprot.pgprot != PAGE_KERNEL.pgprot) | 415 | if (WARN_ON_ONCE(params->pgprot.pgprot != PAGE_KERNEL.pgprot)) |
| 416 | return -EINVAL; | 416 | return -EINVAL; |
| 417 | 417 | ||
| 418 | /* We only have ZONE_NORMAL, so this is easy.. */ | 418 | /* We only have ZONE_NORMAL, so this is easy.. */ |
| @@ -140,6 +140,7 @@ export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) · 139 unmodified lines | |||
| 140 | # When cleaning we don't include .config, so we don't include | 140 | # When cleaning we don't include .config, so we don't include |
| 141 | # TT or skas makefiles and don't clean skas_ptregs.h. | 141 | # TT or skas makefiles and don't clean skas_ptregs.h. |
| 142 | CLEAN_FILES += linux x.i gmon.out | 142 | CLEAN_FILES += linux x.i gmon.out |
| 143 | MRPROPER_DIRS += arch/$(SUBARCH)/include/generated | ||
| 143 | 144 | ||
| 144 | archclean: | 145 | archclean: |
| 145 | @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ | 146 | @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ |
| @@ -149,7 +149,7 @@ config X86 · 148 unmodified lines | |||
| 149 | select HAVE_ARCH_TRACEHOOK | 149 | select HAVE_ARCH_TRACEHOOK |
| 150 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE | 150 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE |
| 151 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD if X86_64 | 151 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD if X86_64 |
| 152 | select HAVE_ARCH_USERFAULTFD_WP if USERFAULTFD | 152 | select HAVE_ARCH_USERFAULTFD_WP if X86_64 && USERFAULTFD |
| 153 | select HAVE_ARCH_VMAP_STACK if X86_64 | 153 | select HAVE_ARCH_VMAP_STACK if X86_64 |
| 154 | select HAVE_ARCH_WITHIN_STACK_FRAMES | 154 | select HAVE_ARCH_WITHIN_STACK_FRAMES |
| 155 | select HAVE_ASM_MODVERSIONS | 155 | select HAVE_ASM_MODVERSIONS |
| @@ -643,6 +643,7 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = { · 642 unmodified lines | |||
| 643 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_PLUS, &glm_cstates), | 643 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_PLUS, &glm_cstates), |
| 644 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D, &glm_cstates), | 644 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D, &glm_cstates), |
| 645 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT, &glm_cstates), | 645 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT, &glm_cstates), |
| 646 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_L, &glm_cstates), | ||
| 646 | 647 | ||
| 647 | X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_L, &icl_cstates), | 648 | X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_L, &icl_cstates), |
| 648 | X86_MATCH_INTEL_FAM6_MODEL(ICELAKE, &icl_cstates), | 649 | X86_MATCH_INTEL_FAM6_MODEL(ICELAKE, &icl_cstates), |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | |||
| 20 | #include <linux/mm.h> | 20 | #include <linux/mm.h> |
| 21 | #include <linux/hyperv.h> | 21 | #include <linux/hyperv.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/kernel.h> | ||
| 23 | #include <linux/cpuhotplug.h> | 24 | #include <linux/cpuhotplug.h> |
| 24 | #include <linux/syscore_ops.h> | 25 | #include <linux/syscore_ops.h> |
| 25 | #include <clocksource/hyperv_timer.h> | 26 | #include <clocksource/hyperv_timer.h> |
| @@ -419,11 +420,14 @@ void hyperv_cleanup(void) · 393 unmodified lines | |||
| 419 | } | 420 | } |
| 420 | EXPORT_SYMBOL_GPL(hyperv_cleanup); | 421 | EXPORT_SYMBOL_GPL(hyperv_cleanup); |
| 421 | 422 | ||
| 422 | void hyperv_report_panic(struct pt_regs *regs, long err) | 423 | void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die) |
| 423 | { | 424 | { |
| 424 | static bool panic_reported; | 425 | static bool panic_reported; |
| 425 | u64 guest_id; | 426 | u64 guest_id; |
| 426 | 427 | ||
| 428 | if (in_die && !panic_on_oops) | ||
| 429 | return; | ||
| 430 | |||
| 427 | /* | 431 | /* |
| 428 | * We prefer to report panic on 'die' chain as we have proper | 432 | * We prefer to report panic on 'die' chain as we have proper |
| 429 | * registers to report, but if we miss it (e.g. on BUG()) we need | 433 | * registers to report, but if we miss it (e.g. on BUG()) we need |
| @@ -178,8 +178,10 @@ extern void efi_free_boot_services(void); · 177 unmodified lines | |||
| 178 | extern pgd_t * __init efi_uv1_memmap_phys_prolog(void); | 178 | extern pgd_t * __init efi_uv1_memmap_phys_prolog(void); |
| 179 | extern void __init efi_uv1_memmap_phys_epilog(pgd_t *save_pgd); | 179 | extern void __init efi_uv1_memmap_phys_epilog(pgd_t *save_pgd); |
| 180 | 180 | ||
| 181 | /* kexec external ABI */ | ||
| 181 | struct efi_setup_data { | 182 | struct efi_setup_data { |
| 182 | u64 fw_vendor; | 183 | u64 fw_vendor; |
| 184 | u64 __unused; | ||
| 183 | u64 tables; | 185 | u64 tables; |
| 184 | u64 smbios; | 186 | u64 smbios; |
| 185 | u64 reserved[8]; | 187 | u64 reserved[8]; |
| @@ -41,7 +41,7 @@ struct microcode_amd { · 40 unmodified lines | |||
| 41 | unsigned int mpb[0]; | 41 | unsigned int mpb[0]; |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | #define PATCH_MAX_SIZE PAGE_SIZE | 44 | #define PATCH_MAX_SIZE (3 * PAGE_SIZE) |
| 45 | 45 | ||
| 46 | #ifdef CONFIG_MICROCODE_AMD | 46 | #ifdef CONFIG_MICROCODE_AMD |
| 47 | extern void __init load_ucode_amd_bsp(unsigned int family); | 47 | extern void __init load_ucode_amd_bsp(unsigned int family); |
| @@ -13,64 +13,4 @@ struct mod_arch_specific { · 12 unmodified lines | |||
| 13 | #endif | 13 | #endif |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | #ifdef CONFIG_X86_64 | ||
| 17 | /* X86_64 does not define MODULE_PROC_FAMILY */ | ||
| 18 | #elif defined CONFIG_M486SX | ||
| 19 | #define MODULE_PROC_FAMILY "486SX " | ||
| 20 | #elif defined CONFIG_M486 | ||
| 21 | #define MODULE_PROC_FAMILY "486 " | ||
| 22 | #elif defined CONFIG_M586 | ||
| 23 | #define MODULE_PROC_FAMILY "586 " | ||
| 24 | #elif defined CONFIG_M586TSC | ||
| 25 | #define MODULE_PROC_FAMILY "586TSC " | ||
| 26 | #elif defined CONFIG_M586MMX | ||
| 27 | #define MODULE_PROC_FAMILY "586MMX " | ||
| 28 | #elif defined CONFIG_MCORE2 | ||
| 29 | #define MODULE_PROC_FAMILY "CORE2 " | ||
| 30 | #elif defined CONFIG_MATOM | ||
| 31 | #define MODULE_PROC_FAMILY "ATOM " | ||
| 32 | #elif defined CONFIG_M686 | ||
| 33 | #define MODULE_PROC_FAMILY "686 " | ||
| 34 | #elif defined CONFIG_MPENTIUMII | ||
| 35 | #define MODULE_PROC_FAMILY "PENTIUMII " | ||
| 36 | #elif defined CONFIG_MPENTIUMIII | ||
| 37 | #define MODULE_PROC_FAMILY "PENTIUMIII " | ||
| 38 | #elif defined CONFIG_MPENTIUMM | ||
| 39 | #define MODULE_PROC_FAMILY "PENTIUMM " | ||
| 40 | #elif defined CONFIG_MPENTIUM4 | ||
| 41 | #define MODULE_PROC_FAMILY "PENTIUM4 " | ||
| 42 | #elif defined CONFIG_MK6 | ||
| 43 | #define MODULE_PROC_FAMILY "K6 " | ||
| 44 | #elif defined CONFIG_MK7 | ||
| 45 | #define MODULE_PROC_FAMILY "K7 " | ||
| 46 | #elif defined CONFIG_MK8 | ||
| 47 | #define MODULE_PROC_FAMILY "K8 " | ||
| 48 | #elif defined CONFIG_MELAN | ||
| 49 | #define MODULE_PROC_FAMILY "ELAN " | ||
| 50 | #elif defined CONFIG_MCRUSOE | ||
| 51 | #define MODULE_PROC_FAMILY "CRUSOE " | ||
| 52 | #elif defined CONFIG_MEFFICEON | ||
| 53 | #define MODULE_PROC_FAMILY "EFFICEON " | ||
| 54 | #elif defined CONFIG_MWINCHIPC6 | ||
| 55 | #define MODULE_PROC_FAMILY "WINCHIPC6 " | ||
| 56 | #elif defined CONFIG_MWINCHIP3D | ||
| 57 | #define MODULE_PROC_FAMILY "WINCHIP3D " | ||
| 58 | #elif defined CONFIG_MCYRIXIII | ||
| 59 | #define MODULE_PROC_FAMILY "CYRIXIII " | ||
| 60 | #elif defined CONFIG_MVIAC3_2 | ||
| 61 | #define MODULE_PROC_FAMILY "VIAC3-2 " | ||
| 62 | #elif defined CONFIG_MVIAC7 | ||
| 63 | #define MODULE_PROC_FAMILY "VIAC7 " | ||
| 64 | #elif defined CONFIG_MGEODEGX1 | ||
| 65 | #define MODULE_PROC_FAMILY "GEODEGX1 " | ||
| 66 | #elif defined CONFIG_MGEODE_LX | ||
| 67 | #define MODULE_PROC_FAMILY "GEODE " | ||
| 68 | #else | ||
| 69 | #error unknown processor family | ||
| 70 | #endif | ||
| 71 | |||
| 72 | #ifdef CONFIG_X86_32 | ||
| 73 | # define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #endif /* _ASM_X86_MODULE_H */ | 16 | #endif /* _ASM_X86_MODULE_H */ |
| @@ -237,27 +237,6 @@ enum ssb_mitigation { · 236 unmodified lines | |||
| 237 | extern char __indirect_thunk_start[]; | 237 | extern char __indirect_thunk_start[]; |
| 238 | extern char __indirect_thunk_end[]; | 238 | extern char __indirect_thunk_end[]; |
| 239 | 239 | ||
| 240 | /* | ||
| 241 | * On VMEXIT we must ensure that no RSB predictions learned in the guest | ||
| 242 | * can be followed in the host, by overwriting the RSB completely. Both | ||
| 243 | * retpoline and IBRS mitigations for Spectre v2 need this; only on future | ||
| 244 | * CPUs with IBRS_ALL *might* it be avoided. | ||
| 245 | */ | ||
| 246 | static inline void vmexit_fill_RSB(void) | ||
| 247 | { | ||
| 248 | #ifdef CONFIG_RETPOLINE | ||
| 249 | unsigned long loops; | ||
| 250 | |||
| 251 | asm volatile (ANNOTATE_NOSPEC_ALTERNATIVE | ||
| 252 | ALTERNATIVE("jmp 910f", | ||
| 253 | __stringify(__FILL_RETURN_BUFFER(%0, RSB_CLEAR_LOOPS, %1)), | ||
| 254 | X86_FEATURE_RETPOLINE) | ||
| 255 | "910:" | ||
| 256 | : "=r" (loops), ASM_CALL_CONSTRAINT | ||
| 257 | : : "memory" ); | ||
| 258 | #endif | ||
| 259 | } | ||
| 260 | |||
| 261 | static __always_inline | 240 | static __always_inline |
| 262 | void alternative_msr_write(unsigned int msr, u64 val, unsigned int feature) | 241 | void alternative_msr_write(unsigned int msr, u64 val, unsigned int feature) |
| 263 | { | 242 | { |
| @@ -0,0 +1,68 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | |||
| 3 | #ifndef _ASM_VERMAGIC_H | ||
| 4 | #define _ASM_VERMAGIC_H | ||
| 5 | |||
| 6 | #ifdef CONFIG_X86_64 | ||
| 7 | /* X86_64 does not define MODULE_PROC_FAMILY */ | ||
| 8 | #elif defined CONFIG_M486SX | ||
| 9 | #define MODULE_PROC_FAMILY "486SX " | ||
| 10 | #elif defined CONFIG_M486 | ||
| 11 | #define MODULE_PROC_FAMILY "486 " | ||
| 12 | #elif defined CONFIG_M586 | ||
| 13 | #define MODULE_PROC_FAMILY "586 " | ||
| 14 | #elif defined CONFIG_M586TSC | ||
| 15 | #define MODULE_PROC_FAMILY "586TSC " | ||
| 16 | #elif defined CONFIG_M586MMX | ||
| 17 | #define MODULE_PROC_FAMILY "586MMX " | ||
| 18 | #elif defined CONFIG_MCORE2 | ||
| 19 | #define MODULE_PROC_FAMILY "CORE2 " | ||
| 20 | #elif defined CONFIG_MATOM | ||
| 21 | #define MODULE_PROC_FAMILY "ATOM " | ||
| 22 | #elif defined CONFIG_M686 | ||
| 23 | #define MODULE_PROC_FAMILY "686 " | ||
| 24 | #elif defined CONFIG_MPENTIUMII | ||
| 25 | #define MODULE_PROC_FAMILY "PENTIUMII " | ||
| 26 | #elif defined CONFIG_MPENTIUMIII | ||
| 27 | #define MODULE_PROC_FAMILY "PENTIUMIII " | ||
| 28 | #elif defined CONFIG_MPENTIUMM | ||
| 29 | #define MODULE_PROC_FAMILY "PENTIUMM " | ||
| 30 | #elif defined CONFIG_MPENTIUM4 | ||
| 31 | #define MODULE_PROC_FAMILY "PENTIUM4 " | ||
| 32 | #elif defined CONFIG_MK6 | ||
| 33 | #define MODULE_PROC_FAMILY "K6 " | ||
| 34 | #elif defined CONFIG_MK7 | ||
| 35 | #define MODULE_PROC_FAMILY "K7 " | ||
| 36 | #elif defined CONFIG_MK8 | ||
| 37 | #define MODULE_PROC_FAMILY "K8 " | ||
| 38 | #elif defined CONFIG_MELAN | ||
| 39 | #define MODULE_PROC_FAMILY "ELAN " | ||
| 40 | #elif defined CONFIG_MCRUSOE | ||
| 41 | #define MODULE_PROC_FAMILY "CRUSOE " | ||
| 42 | #elif defined CONFIG_MEFFICEON | ||
| 43 | #define MODULE_PROC_FAMILY "EFFICEON " | ||
| 44 | #elif defined CONFIG_MWINCHIPC6 | ||
| 45 | #define MODULE_PROC_FAMILY "WINCHIPC6 " | ||
| 46 | #elif defined CONFIG_MWINCHIP3D | ||
| 47 | #define MODULE_PROC_FAMILY "WINCHIP3D " | ||
| 48 | #elif defined CONFIG_MCYRIXIII | ||
| 49 | #define MODULE_PROC_FAMILY "CYRIXIII " | ||
| 50 | #elif defined CONFIG_MVIAC3_2 | ||
| 51 | #define MODULE_PROC_FAMILY "VIAC3-2 " | ||
| 52 | #elif defined CONFIG_MVIAC7 | ||
| 53 | #define MODULE_PROC_FAMILY "VIAC7 " | ||
| 54 | #elif defined CONFIG_MGEODEGX1 | ||
| 55 | #define MODULE_PROC_FAMILY "GEODEGX1 " | ||
| 56 | #elif defined CONFIG_MGEODE_LX | ||
| 57 | #define MODULE_PROC_FAMILY "GEODE " | ||
| 58 | #else | ||
| 59 | #error unknown processor family | ||
| 60 | #endif | ||
| 61 | |||
| 62 | #ifdef CONFIG_X86_32 | ||
| 63 | # define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY | ||
| 64 | #else | ||
| 65 | # define MODULE_ARCH_VERMAGIC "" | ||
| 66 | #endif | ||
| 67 | |||
| 68 | #endif /* _ASM_VERMAGIC_H */ | ||
| @@ -1119,35 +1119,53 @@ void switch_to_sld(unsigned long tifn) · 1118 unmodified lines | |||
| 1119 | sld_update_msr(!(tifn & _TIF_SLD)); | 1119 | sld_update_msr(!(tifn & _TIF_SLD)); |
| 1120 | } | 1120 | } |
| 1121 | 1121 | ||
| 1122 | #define SPLIT_LOCK_CPU(model) {X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY} | ||
| 1123 | |||
| 1124 | /* | 1122 | /* |
| 1125 | * The following processors have the split lock detection feature. But | 1123 | * Bits in the IA32_CORE_CAPABILITIES are not architectural, so they should |
| 1126 | * since they don't have the IA32_CORE_CAPABILITIES MSR, the feature cannot | 1124 | * only be trusted if it is confirmed that a CPU model implements a |
| 1127 | * be enumerated. Enable it by family and model matching on these | 1125 | * specific feature at a particular bit position. |
| 1128 | * processors. | 1126 | * |
| 1127 | * The possible driver data field values: | ||
| 1128 | * | ||
| 1129 | * - 0: CPU models that are known to have the per-core split-lock detection | ||
| 1130 | * feature even though they do not enumerate IA32_CORE_CAPABILITIES. | ||
| 1131 | * | ||
| 1132 | * - 1: CPU models which may enumerate IA32_CORE_CAPABILITIES and if so use | ||
| 1133 | * bit 5 to enumerate the per-core split-lock detection feature. | ||
| 1129 | */ | 1134 | */ |
| 1130 | static const struct x86_cpu_id split_lock_cpu_ids[] __initconst = { | 1135 | static const struct x86_cpu_id split_lock_cpu_ids[] __initconst = { |
| 1131 | SPLIT_LOCK_CPU(INTEL_FAM6_ICELAKE_X), | 1136 | X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, 0), |
| 1132 | SPLIT_LOCK_CPU(INTEL_FAM6_ICELAKE_L), | 1137 | X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_L, 0), |
| 1138 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT, 1), | ||
| 1139 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D, 1), | ||
| 1140 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_L, 1), | ||
| 1133 | {} | 1141 | {} |
| 1134 | }; | 1142 | }; |
| 1135 | 1143 | ||
| 1136 | void __init cpu_set_core_cap_bits(struct cpuinfo_x86 *c) | 1144 | void __init cpu_set_core_cap_bits(struct cpuinfo_x86 *c) |
| 1137 | { | 1145 | { |
| 1138 | u64 ia32_core_caps = 0; | 1146 | const struct x86_cpu_id *m; |
| 1147 | u64 ia32_core_caps; | ||
| 1148 | |||
| 1149 | if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) | ||
| 1150 | return; | ||
| 1139 | 1151 | ||
| 1140 | if (c->x86_vendor != X86_VENDOR_INTEL) | 1152 | m = x86_match_cpu(split_lock_cpu_ids); |
| 1153 | if (!m) | ||
| 1141 | return; | 1154 | return; |
| 1142 | if (cpu_has(c, X86_FEATURE_CORE_CAPABILITIES)) { | 1155 | |
| 1143 | /* Enumerate features reported in IA32_CORE_CAPABILITIES MSR. */ | 1156 | switch (m->driver_data) { |
| 1157 | case 0: | ||
| 1158 | break; | ||
| 1159 | case 1: | ||
| 1160 | if (!cpu_has(c, X86_FEATURE_CORE_CAPABILITIES)) | ||
| 1161 | return; | ||
| 1144 | rdmsrl(MSR_IA32_CORE_CAPS, ia32_core_caps); | 1162 | rdmsrl(MSR_IA32_CORE_CAPS, ia32_core_caps); |
| 1145 | } else if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) { | 1163 | if (!(ia32_core_caps & MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT)) |
| 1146 | /* Enumerate split lock detection by family and model. */ | 1164 | return; |
| 1147 | if (x86_match_cpu(split_lock_cpu_ids)) | 1165 | break; |
| 1148 | ia32_core_caps |= MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT; | 1166 | default: |
| 1167 | return; | ||
| 1149 | } | 1168 | } |
| 1150 | 1169 | ||
| 1151 | if (ia32_core_caps & MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT) | 1170 | split_lock_setup(); |
| 1152 | split_lock_setup(); | ||
| 1153 | } | 1171 | } |
| @@ -227,8 +227,8 @@ static void __init ms_hyperv_init_platform(void) · 226 unmodified lines | |||
| 227 | ms_hyperv.misc_features = cpuid_edx(HYPERV_CPUID_FEATURES); | 227 | ms_hyperv.misc_features = cpuid_edx(HYPERV_CPUID_FEATURES); |
| 228 | ms_hyperv.hints = cpuid_eax(HYPERV_CPUID_ENLIGHTMENT_INFO); | 228 | ms_hyperv.hints = cpuid_eax(HYPERV_CPUID_ENLIGHTMENT_INFO); |
| 229 | 229 | ||
| 230 | pr_info("Hyper-V: features 0x%x, hints 0x%x\n", | 230 | pr_info("Hyper-V: features 0x%x, hints 0x%x, misc 0x%x\n", |
| 231 | ms_hyperv.features, ms_hyperv.hints); | 231 | ms_hyperv.features, ms_hyperv.hints, ms_hyperv.misc_features); |
| 232 | 232 | ||
| 233 | ms_hyperv.max_vp_index = cpuid_eax(HYPERV_CPUID_IMPLEMENT_LIMITS); | 233 | ms_hyperv.max_vp_index = cpuid_eax(HYPERV_CPUID_IMPLEMENT_LIMITS); |
| 234 | ms_hyperv.max_lp_index = cpuid_ebx(HYPERV_CPUID_IMPLEMENT_LIMITS); | 234 | ms_hyperv.max_lp_index = cpuid_ebx(HYPERV_CPUID_IMPLEMENT_LIMITS); |
| @@ -263,6 +263,16 @@ static void __init ms_hyperv_init_platform(void) · 28 unmodified lines | |||
| 263 | cpuid_eax(HYPERV_CPUID_NESTED_FEATURES); | 263 | cpuid_eax(HYPERV_CPUID_NESTED_FEATURES); |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | /* | ||
| 267 | * Hyper-V expects to get crash register data or kmsg when | ||
| 268 | * crash enlightment is available and system crashes. Set | ||
| 269 | * crash_kexec_post_notifiers to be true to make sure that | ||
| 270 | * calling crash enlightment interface before running kdump | ||
| 271 | * kernel. | ||
| 272 | */ | ||
| 273 | if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) | ||
| 274 | crash_kexec_post_notifiers = true; | ||
| 275 | |||
| 266 | #ifdef CONFIG_X86_LOCAL_APIC | 276 | #ifdef CONFIG_X86_LOCAL_APIC |
| 267 | if (ms_hyperv.features & HV_X64_ACCESS_FREQUENCY_MSRS && | 277 | if (ms_hyperv.features & HV_X64_ACCESS_FREQUENCY_MSRS && |
| 268 | ms_hyperv.misc_features & HV_FEATURE_FREQUENCY_MSRS_AVAILABLE) { | 278 | ms_hyperv.misc_features & HV_FEATURE_FREQUENCY_MSRS_AVAILABLE) { |
| @@ -578,6 +578,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r) · 577 unmodified lines | |||
| 578 | d->id = id; | 578 | d->id = id; |
| 579 | cpumask_set_cpu(cpu, &d->cpu_mask); | 579 | cpumask_set_cpu(cpu, &d->cpu_mask); |
| 580 | 580 | ||
| 581 | rdt_domain_reconfigure_cdp(r); | ||
| 582 | |||
| 581 | if (r->alloc_capable && domain_setup_ctrlval(r, d)) { | 583 | if (r->alloc_capable && domain_setup_ctrlval(r, d)) { |
| 582 | kfree(d); | 584 | kfree(d); |
| 583 | return; | 585 | return; |
| @@ -601,5 +601,6 @@ bool has_busy_rmid(struct rdt_resource *r, struct rdt_domain *d); · 600 unmodified lines | |||
| 601 | void __check_limbo(struct rdt_domain *d, bool force_free); | 601 | void __check_limbo(struct rdt_domain *d, bool force_free); |
| 602 | bool cbm_validate_intel(char *buf, u32 *data, struct rdt_resource *r); | 602 | bool cbm_validate_intel(char *buf, u32 *data, struct rdt_resource *r); |
| 603 | bool cbm_validate_amd(char *buf, u32 *data, struct rdt_resource *r); | 603 | bool cbm_validate_amd(char *buf, u32 *data, struct rdt_resource *r); |
| 604 | void rdt_domain_reconfigure_cdp(struct rdt_resource *r); | ||
| 604 | 605 | ||
| 605 | #endif /* _ASM_X86_RESCTRL_INTERNAL_H */ | 606 | #endif /* _ASM_X86_RESCTRL_INTERNAL_H */ |
| @@ -1859,6 +1859,19 @@ static int set_cache_qos_cfg(int level, bool enable) · 1858 unmodified lines | |||
| 1859 | return 0; | 1859 | return 0; |
| 1860 | } | 1860 | } |
| 1861 | 1861 | ||
| 1862 | /* Restore the qos cfg state when a domain comes online */ | ||
| 1863 | void rdt_domain_reconfigure_cdp(struct rdt_resource *r) | ||
| 1864 | { | ||
| 1865 | if (!r->alloc_capable) | ||
| 1866 | return; | ||
| 1867 | |||
| 1868 | if (r == &rdt_resources_all[RDT_RESOURCE_L2DATA]) | ||
| 1869 | l2_qos_cfg_update(&r->alloc_enabled); | ||
| 1870 | |||
| 1871 | if (r == &rdt_resources_all[RDT_RESOURCE_L3DATA]) | ||
| 1872 | l3_qos_cfg_update(&r->alloc_enabled); | ||
| 1873 | } | ||
| 1874 | |||
| 1862 | /* | 1875 | /* |
| 1863 | * Enable or disable the MBA software controller | 1876 | * Enable or disable the MBA software controller |
| 1864 | * which helps user specify bandwidth in MBps. | 1877 | * which helps user specify bandwidth in MBps. |
| @@ -3072,7 +3085,8 @@ static int rdtgroup_rmdir(struct kernfs_node *kn) · 1207 unmodified lines | |||
| 3072 | * If the rdtgroup is a mon group and parent directory | 3085 | * If the rdtgroup is a mon group and parent directory |
| 3073 | * is a valid "mon_groups" directory, remove the mon group. | 3086 | * is a valid "mon_groups" directory, remove the mon group. |
| 3074 | */ | 3087 | */ |
| 3075 | if (rdtgrp->type == RDTCTRL_GROUP && parent_kn == rdtgroup_default.kn) { | 3088 | if (rdtgrp->type == RDTCTRL_GROUP && parent_kn == rdtgroup_default.kn && |
| 3089 | rdtgrp != &rdtgroup_default) { | ||
| 3076 | if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP || | 3090 | if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP || |
| 3077 | rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) { | 3091 | rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) { |
| 3078 | ret = rdtgroup_ctrl_remove(kn, rdtgrp); | 3092 | ret = rdtgroup_ctrl_remove(kn, rdtgrp); |
| @@ -147,7 +147,7 @@ static inline void smpboot_restore_warm_reset_vector(void) · 146 unmodified lines | |||
| 147 | *((volatile u32 *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = 0; | 147 | *((volatile u32 *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = 0; |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | static void init_freq_invariance(void); | 150 | static void init_freq_invariance(bool secondary); |
| 151 | 151 | ||
| 152 | /* | 152 | /* |
| 153 | * Report back to the Boot Processor during boot time or to the caller processor | 153 | * Report back to the Boot Processor during boot time or to the caller processor |
| @@ -185,7 +185,7 @@ static void smp_callin(void) · 31 unmodified lines | |||
| 185 | */ | 185 | */ |
| 186 | set_cpu_sibling_map(raw_smp_processor_id()); | 186 | set_cpu_sibling_map(raw_smp_processor_id()); |
| 187 | 187 | ||
| 188 | init_freq_invariance(); | 188 | init_freq_invariance(true); |
| 189 | 189 | ||
| 190 | /* | 190 | /* |
| 191 | * Get our bogomips. | 191 | * Get our bogomips. |
| @@ -1341,7 +1341,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) · 1149 unmodified lines | |||
| 1341 | set_sched_topology(x86_topology); | 1341 | set_sched_topology(x86_topology); |
| 1342 | 1342 | ||
| 1343 | set_cpu_sibling_map(0); | 1343 | set_cpu_sibling_map(0); |
| 1344 | init_freq_invariance(); | 1344 | init_freq_invariance(false); |
| 1345 | smp_sanity_check(); | 1345 | smp_sanity_check(); |
| 1346 | 1346 | ||
| 1347 | switch (apic_intr_mode) { | 1347 | switch (apic_intr_mode) { |
| @@ -1877,9 +1877,6 @@ static bool knl_set_max_freq_ratio(u64 *base_freq, u64 *turbo_freq, · 529 unmodified lines | |||
| 1877 | int err, i; | 1877 | int err, i; |
| 1878 | u64 msr; | 1878 | u64 msr; |
| 1879 | 1879 | ||
| 1880 | if (!x86_match_cpu(has_knl_turbo_ratio_limits)) | ||
| 1881 | return false; | ||
| 1882 | |||
| 1883 | err = rdmsrl_safe(MSR_PLATFORM_INFO, base_freq); | 1880 | err = rdmsrl_safe(MSR_PLATFORM_INFO, base_freq); |
| 1884 | if (err) | 1881 | if (err) |
| 1885 | return false; | 1882 | return false; |
| @@ -1945,18 +1942,23 @@ static bool skx_set_max_freq_ratio(u64 *base_freq, u64 *turbo_freq, int size) · 59 unmodified lines | |||
| 1945 | 1942 | ||
| 1946 | static bool core_set_max_freq_ratio(u64 *base_freq, u64 *turbo_freq) | 1943 | static bool core_set_max_freq_ratio(u64 *base_freq, u64 *turbo_freq) |
| 1947 | { | 1944 | { |
| 1945 | u64 msr; | ||
| 1948 | int err; | 1946 | int err; |
| 1949 | 1947 | ||
| 1950 | err = rdmsrl_safe(MSR_PLATFORM_INFO, base_freq); | 1948 | err = rdmsrl_safe(MSR_PLATFORM_INFO, base_freq); |
| 1951 | if (err) | 1949 | if (err) |
| 1952 | return false; | 1950 | return false; |
| 1953 | 1951 | ||
| 1954 | err = rdmsrl_safe(MSR_TURBO_RATIO_LIMIT, turbo_freq); | 1952 | err = rdmsrl_safe(MSR_TURBO_RATIO_LIMIT, &msr); |
| 1955 | if (err) | 1953 | if (err) |
| 1956 | return false; | 1954 | return false; |
| 1957 | 1955 | ||
| 1958 | *base_freq = (*base_freq >> 8) & 0xFF; /* max P state */ | 1956 | *base_freq = (*base_freq >> 8) & 0xFF; /* max P state */ |
| 1959 | *turbo_freq = (*turbo_freq >> 24) & 0xFF; /* 4C turbo */ | 1957 | *turbo_freq = (msr >> 24) & 0xFF; /* 4C turbo */ |
| 1958 | |||
| 1959 | /* The CPU may have less than 4 cores */ | ||
| 1960 | if (!*turbo_freq) | ||
| 1961 | *turbo_freq = msr & 0xFF; /* 1C turbo */ | ||
| 1960 | 1962 | ||
| 1961 | return true; | 1963 | return true; |
| 1962 | } | 1964 | } |
| @@ -1972,7 +1974,8 @@ static bool intel_set_max_freq_ratio(void) · 9 unmodified lines | |||
| 1972 | skx_set_max_freq_ratio(&base_freq, &turbo_freq, 1)) | 1974 | skx_set_max_freq_ratio(&base_freq, &turbo_freq, 1)) |
| 1973 | goto out; | 1975 | goto out; |
| 1974 | 1976 | ||
| 1975 | if (knl_set_max_freq_ratio(&base_freq, &turbo_freq, 1)) | 1977 | if (x86_match_cpu(has_knl_turbo_ratio_limits) && |
| 1978 | knl_set_max_freq_ratio(&base_freq, &turbo_freq, 1)) | ||
| 1976 | goto out; | 1979 | goto out; |
| 1977 | 1980 | ||
| 1978 | if (x86_match_cpu(has_skx_turbo_ratio_limits) && | 1981 | if (x86_match_cpu(has_skx_turbo_ratio_limits) && |
| @@ -1985,13 +1988,22 @@ static bool intel_set_max_freq_ratio(void) · 6 unmodified lines | |||
| 1985 | return false; | 1988 | return false; |
| 1986 | 1989 | ||
| 1987 | out: | 1990 | out: |
| 1991 | /* | ||
| 1992 | * Some hypervisors advertise X86_FEATURE_APERFMPERF | ||
| 1993 | * but then fill all MSR's with zeroes. | ||
| 1994 | */ | ||
| 1995 | if (!base_freq) { | ||
| 1996 | pr_debug("Couldn't determine cpu base frequency, necessary for scale-invariant accounting.\n"); | ||
| 1997 | return false; | ||
| 1998 | } | ||
| 1999 | |||
| 1988 | arch_turbo_freq_ratio = div_u64(turbo_freq * SCHED_CAPACITY_SCALE, | 2000 | arch_turbo_freq_ratio = div_u64(turbo_freq * SCHED_CAPACITY_SCALE, |
| 1989 | base_freq); | 2001 | base_freq); |
| 1990 | arch_set_max_freq_ratio(turbo_disabled()); | 2002 | arch_set_max_freq_ratio(turbo_disabled()); |
| 1991 | return true; | 2003 | return true; |
| 1992 | } | 2004 | } |
| 1993 | 2005 | ||
| 1994 | static void init_counter_refs(void *arg) | 2006 | static void init_counter_refs(void) |
| 1995 | { | 2007 | { |
| 1996 | u64 aperf, mperf; | 2008 | u64 aperf, mperf; |
| 1997 | 2009 | ||
| @@ -2002,18 +2014,25 @@ static void init_counter_refs(void *arg) · 4 unmodified lines | |||
| 2002 | this_cpu_write(arch_prev_mperf, mperf); | 2014 | this_cpu_write(arch_prev_mperf, mperf); |
| 2003 | } | 2015 | } |
| 2004 | 2016 | ||
| 2005 | static void init_freq_invariance(void) | 2017 | static void init_freq_invariance(bool secondary) |
| 2006 | { | 2018 | { |
| 2007 | bool ret = false; | 2019 | bool ret = false; |
| 2008 | 2020 | ||
| 2009 | if (smp_processor_id() != 0 || !boot_cpu_has(X86_FEATURE_APERFMPERF)) | 2021 | if (!boot_cpu_has(X86_FEATURE_APERFMPERF)) |
| 2010 | return; | 2022 | return; |
| 2011 | 2023 | ||
| 2024 | if (secondary) { | ||
| 2025 | if (static_branch_likely(&arch_scale_freq_key)) { | ||
| 2026 | init_counter_refs(); | ||
| 2027 | } | ||
| 2028 | return; | ||
| 2029 | } | ||
| 2030 | |||
| 2012 | if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) | 2031 | if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) |
| 2013 | ret = intel_set_max_freq_ratio(); | 2032 | ret = intel_set_max_freq_ratio(); |
| 2014 | 2033 | ||
| 2015 | if (ret) { | 2034 | if (ret) { |
| 2016 | on_each_cpu(init_counter_refs, NULL, 1); | 2035 | init_counter_refs(); |
| 2017 | static_branch_enable(&arch_scale_freq_key); | 2036 | static_branch_enable(&arch_scale_freq_key); |
| 2018 | } else { | 2037 | } else { |
| 2019 | pr_debug("Couldn't determine max cpu frequency, necessary for scale-invariant accounting.\n"); | 2038 | pr_debug("Couldn't determine max cpu frequency, necessary for scale-invariant accounting.\n"); |
| @@ -81,7 +81,7 @@ · 80 unmodified lines | |||
| 81 | #define UMIP_INST_SLDT 3 /* 0F 00 /0 */ | 81 | #define UMIP_INST_SLDT 3 /* 0F 00 /0 */ |
| 82 | #define UMIP_INST_STR 4 /* 0F 00 /1 */ | 82 | #define UMIP_INST_STR 4 /* 0F 00 /1 */ |
| 83 | 83 | ||
| 84 | const char * const umip_insns[5] = { | 84 | static const char * const umip_insns[5] = { |
| 85 | [UMIP_INST_SGDT] = "SGDT", | 85 | [UMIP_INST_SGDT] = "SGDT", |
| 86 | [UMIP_INST_SIDT] = "SIDT", | 86 | [UMIP_INST_SIDT] = "SIDT", |
| 87 | [UMIP_INST_SMSW] = "SMSW", | 87 | [UMIP_INST_SMSW] = "SMSW", |
| @@ -3,6 +3,10 @@ · 2 unmodified lines | |||
| 3 | ccflags-y += -Iarch/x86/kvm | 3 | ccflags-y += -Iarch/x86/kvm |
| 4 | ccflags-$(CONFIG_KVM_WERROR) += -Werror | 4 | ccflags-$(CONFIG_KVM_WERROR) += -Werror |
| 5 | 5 | ||
| 6 | ifeq ($(CONFIG_FRAME_POINTER),y) | ||
| 7 | OBJECT_FILES_NON_STANDARD_vmenter.o := y | ||
| 8 | endif | ||
| 9 | |||
| 6 | KVM := ../../../virt/kvm | 10 | KVM := ../../../virt/kvm |
| 7 | 11 | ||
| 8 | kvm-y += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \ | 12 | kvm-y += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \ |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | |||
| 12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
| 13 | #include <linux/highmem.h> | 13 | #include <linux/highmem.h> |
| 14 | #include <linux/psp-sev.h> | 14 | #include <linux/psp-sev.h> |
| 15 | #include <linux/pagemap.h> | ||
| 15 | #include <linux/swap.h> | 16 | #include <linux/swap.h> |
| 16 | 17 | ||
| 17 | #include "x86.h" | 18 | #include "x86.h" |
| @@ -1117,7 +1118,7 @@ int __init sev_hardware_setup(void) · 1099 unmodified lines | |||
| 1117 | /* Maximum number of encrypted guests supported simultaneously */ | 1118 | /* Maximum number of encrypted guests supported simultaneously */ |
| 1118 | max_sev_asid = cpuid_ecx(0x8000001F); | 1119 | max_sev_asid = cpuid_ecx(0x8000001F); |
| 1119 | 1120 | ||
| 1120 | if (!max_sev_asid) | 1121 | if (!svm_sev_enabled()) |
| 1121 | return 1; | 1122 | return 1; |
| 1122 | 1123 | ||
| 1123 | /* Minimum ASID value that should be used for SEV guest */ | 1124 | /* Minimum ASID value that should be used for SEV guest */ |
| @@ -1156,6 +1157,9 @@ err: · 32 unmodified lines | |||
| 1156 | 1157 | ||
| 1157 | void sev_hardware_teardown(void) | 1158 | void sev_hardware_teardown(void) |
| 1158 | { | 1159 | { |
| 1160 | if (!svm_sev_enabled()) | ||
| 1161 | return; | ||
| 1162 | |||
| 1159 | bitmap_free(sev_asid_bitmap); | 1163 | bitmap_free(sev_asid_bitmap); |
| 1160 | bitmap_free(sev_reclaim_asid_bitmap); | 1164 | bitmap_free(sev_reclaim_asid_bitmap); |
| 1161 | 1165 | ||
| @@ -3276,7 +3276,7 @@ static void svm_cancel_injection(struct kvm_vcpu *vcpu) · 3275 unmodified lines | |||
| 3276 | svm_complete_interrupts(svm); | 3276 | svm_complete_interrupts(svm); |
| 3277 | } | 3277 | } |
| 3278 | 3278 | ||
| 3279 | bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs); | 3279 | void __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs); |
| 3280 | 3280 | ||
| 3281 | static void svm_vcpu_run(struct kvm_vcpu *vcpu) | 3281 | static void svm_vcpu_run(struct kvm_vcpu *vcpu) |
| 3282 | { | 3282 | { |
| @@ -3330,13 +3330,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) · 47 unmodified lines | |||
| 3330 | */ | 3330 | */ |
| 3331 | x86_spec_ctrl_set_guest(svm->spec_ctrl, svm->virt_spec_ctrl); | 3331 | x86_spec_ctrl_set_guest(svm->spec_ctrl, svm->virt_spec_ctrl); |
| 3332 | 3332 | ||
| 3333 | local_irq_enable(); | ||
| 3334 | |||
| 3335 | __svm_vcpu_run(svm->vmcb_pa, (unsigned long *)&svm->vcpu.arch.regs); | 3333 | __svm_vcpu_run(svm->vmcb_pa, (unsigned long *)&svm->vcpu.arch.regs); |
| 3336 | 3334 | ||
| 3337 | /* Eliminate branch target predictions from guest mode */ | ||
| 3338 | vmexit_fill_RSB(); | ||
| 3339 | |||
| 3340 | #ifdef CONFIG_X86_64 | 3335 | #ifdef CONFIG_X86_64 |
| 3341 | wrmsrl(MSR_GS_BASE, svm->host.gs_base); | 3336 | wrmsrl(MSR_GS_BASE, svm->host.gs_base); |
| 3342 | #else | 3337 | #else |
| @@ -3366,8 +3361,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) · 23 unmodified lines | |||
| 3366 | 3361 | ||
| 3367 | reload_tss(vcpu); | 3362 | reload_tss(vcpu); |
| 3368 | 3363 | ||
| 3369 | local_irq_disable(); | ||
| 3370 | |||
| 3371 | x86_spec_ctrl_restore_host(svm->spec_ctrl, svm->virt_spec_ctrl); | 3364 | x86_spec_ctrl_restore_host(svm->spec_ctrl, svm->virt_spec_ctrl); |
| 3372 | 3365 | ||
| 3373 | vcpu->arch.cr2 = svm->vmcb->save.cr2; | 3366 | vcpu->arch.cr2 = svm->vmcb->save.cr2; |
| @@ -3411,7 +3404,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) · 37 unmodified lines | |||
| 3411 | 3404 | ||
| 3412 | mark_all_clean(svm->vmcb); | 3405 | mark_all_clean(svm->vmcb); |
| 3413 | } | 3406 | } |
| 3414 | STACK_FRAME_NON_STANDARD(svm_vcpu_run); | ||
| 3415 | 3407 | ||
| 3416 | static void svm_load_mmu_pgd(struct kvm_vcpu *vcpu, unsigned long root) | 3408 | static void svm_load_mmu_pgd(struct kvm_vcpu *vcpu, unsigned long root) |
| 3417 | { | 3409 | { |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | |||
| 3 | #include <asm/asm.h> | 3 | #include <asm/asm.h> |
| 4 | #include <asm/bitsperlong.h> | 4 | #include <asm/bitsperlong.h> |
| 5 | #include <asm/kvm_vcpu_regs.h> | 5 | #include <asm/kvm_vcpu_regs.h> |
| 6 | #include <asm/nospec-branch.h> | ||
| 6 | 7 | ||
| 7 | #define WORD_SIZE (BITS_PER_LONG / 8) | 8 | #define WORD_SIZE (BITS_PER_LONG / 8) |
| 8 | 9 | ||
| @@ -35,7 +36,6 @@ · 26 unmodified lines | |||
| 35 | */ | 36 | */ |
| 36 | SYM_FUNC_START(__svm_vcpu_run) | 37 | SYM_FUNC_START(__svm_vcpu_run) |
| 37 | push %_ASM_BP | 38 | push %_ASM_BP |
| 38 | mov %_ASM_SP, %_ASM_BP | ||
| 39 | #ifdef CONFIG_X86_64 | 39 | #ifdef CONFIG_X86_64 |
| 40 | push %r15 | 40 | push %r15 |
| 41 | push %r14 | 41 | push %r14 |
| @@ -78,6 +78,7 @@ SYM_FUNC_START(__svm_vcpu_run) · 36 unmodified lines | |||
| 78 | pop %_ASM_AX | 78 | pop %_ASM_AX |
| 79 | 79 | ||
| 80 | /* Enter guest mode */ | 80 | /* Enter guest mode */ |
| 81 | sti | ||
| 81 | 1: vmload %_ASM_AX | 82 | 1: vmload %_ASM_AX |
| 82 | jmp 3f | 83 | jmp 3f |
| 83 | 2: cmpb $0, kvm_rebooting | 84 | 2: cmpb $0, kvm_rebooting |
| @@ -99,6 +100,13 @@ SYM_FUNC_START(__svm_vcpu_run) · 15 unmodified lines | |||
| 99 | ud2 | 100 | ud2 |
| 100 | _ASM_EXTABLE(5b, 6b) | 101 | _ASM_EXTABLE(5b, 6b) |
| 101 | 7: | 102 | 7: |
| 103 | cli | ||
| 104 | |||
| 105 | #ifdef CONFIG_RETPOLINE | ||
| 106 | /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */ | ||
| 107 | FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE | ||
| 108 | #endif | ||
| 109 | |||
| 102 | /* "POP" @regs to RAX. */ | 110 | /* "POP" @regs to RAX. */ |
| 103 | pop %_ASM_AX | 111 | pop %_ASM_AX |
| 104 | 112 | ||
| @@ -5533,8 +5533,25 @@ static bool nested_vmx_exit_handled_vmcs_access(struct kvm_vcpu *vcpu, · 5532 unmodified lines | |||
| 5533 | return 1 & (b >> (field & 7)); | 5533 | return 1 & (b >> (field & 7)); |
| 5534 | } | 5534 | } |
| 5535 | 5535 | ||
| 5536 | static bool nested_vmx_exit_handled_mtf(struct vmcs12 *vmcs12) | ||
| 5537 | { | ||
| 5538 | u32 entry_intr_info = vmcs12->vm_entry_intr_info_field; | ||
| 5539 | |||
| 5540 | if (nested_cpu_has_mtf(vmcs12)) | ||
| 5541 | return true; | ||
| 5542 | |||
| 5543 | /* | ||
| 5544 | * An MTF VM-exit may be injected into the guest by setting the | ||
| 5545 | * interruption-type to 7 (other event) and the vector field to 0. Such | ||
| 5546 | * is the case regardless of the 'monitor trap flag' VM-execution | ||
| 5547 | * control. | ||
| 5548 | */ | ||
| 5549 | return entry_intr_info == (INTR_INFO_VALID_MASK | ||
| 5550 | | INTR_TYPE_OTHER_EVENT); | ||
| 5551 | } | ||
| 5552 | |||
| 5536 | /* | 5553 | /* |
| 5537 | * Return 1 if we should exit from L2 to L1 to handle an exit, or 0 if we | 5554 | * Return true if we should exit from L2 to L1 to handle an exit, or false if we |
| 5538 | * should handle it ourselves in L0 (and then continue L2). Only call this | 5555 | * should handle it ourselves in L0 (and then continue L2). Only call this |
| 5539 | * when in is_guest_mode (L2). | 5556 | * when in is_guest_mode (L2). |
| 5540 | */ | 5557 | */ |
| @@ -5633,7 +5650,7 @@ bool nested_vmx_exit_reflected(struct kvm_vcpu *vcpu, u32 exit_reason) · 92 unmodified lines | |||
| 5633 | case EXIT_REASON_MWAIT_INSTRUCTION: | 5650 | case EXIT_REASON_MWAIT_INSTRUCTION: |
| 5634 | return nested_cpu_has(vmcs12, CPU_BASED_MWAIT_EXITING); | 5651 | return nested_cpu_has(vmcs12, CPU_BASED_MWAIT_EXITING); |
| 5635 | case EXIT_REASON_MONITOR_TRAP_FLAG: | 5652 | case EXIT_REASON_MONITOR_TRAP_FLAG: |
| 5636 | return nested_cpu_has_mtf(vmcs12); | 5653 | return nested_vmx_exit_handled_mtf(vmcs12); |
| 5637 | case EXIT_REASON_MONITOR_INSTRUCTION: | 5654 | case EXIT_REASON_MONITOR_INSTRUCTION: |
| 5638 | return nested_cpu_has(vmcs12, CPU_BASED_MONITOR_EXITING); | 5655 | return nested_cpu_has(vmcs12, CPU_BASED_MONITOR_EXITING); |
| 5639 | case EXIT_REASON_PAUSE_INSTRUCTION: | 5656 | case EXIT_REASON_PAUSE_INSTRUCTION: |
| @@ -4572,7 +4572,7 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu, · 4571 unmodified lines | |||
| 4572 | */ | 4572 | */ |
| 4573 | static void kvm_machine_check(void) | 4573 | static void kvm_machine_check(void) |
| 4574 | { | 4574 | { |
| 4575 | #if defined(CONFIG_X86_MCE) && defined(CONFIG_X86_64) | 4575 | #if defined(CONFIG_X86_MCE) |
| 4576 | struct pt_regs regs = { | 4576 | struct pt_regs regs = { |
| 4577 | .cs = 3, /* Fake ring 3 no matter what the guest ran on */ | 4577 | .cs = 3, /* Fake ring 3 no matter what the guest ran on */ |
| 4578 | .flags = X86_EFLAGS_IF, | 4578 | .flags = X86_EFLAGS_IF, |
| @@ -3060,6 +3060,17 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 3059 unmodified lines | |||
| 3060 | case MSR_IA32_PERF_CTL: | 3060 | case MSR_IA32_PERF_CTL: |
| 3061 | case MSR_AMD64_DC_CFG: | 3061 | case MSR_AMD64_DC_CFG: |
| 3062 | case MSR_F15H_EX_CFG: | 3062 | case MSR_F15H_EX_CFG: |
| 3063 | /* | ||
| 3064 | * Intel Sandy Bridge CPUs must support the RAPL (running average power | ||
| 3065 | * limit) MSRs. Just return 0, as we do not want to expose the host | ||
| 3066 | * data here. Do not conditionalize this on CPUID, as KVM does not do | ||
| 3067 | * so for existing CPU-specific MSRs. | ||
| 3068 | */ | ||
| 3069 | case MSR_RAPL_POWER_UNIT: | ||
| 3070 | case MSR_PP0_ENERGY_STATUS: /* Power plane 0 (core) */ | ||
| 3071 | case MSR_PP1_ENERGY_STATUS: /* Power plane 1 (graphics uncore) */ | ||
| 3072 | case MSR_PKG_ENERGY_STATUS: /* Total package */ | ||
| 3073 | case MSR_DRAM_ENERGY_STATUS: /* DRAM controller */ | ||
| 3063 | msr_info->data = 0; | 3074 | msr_info->data = 0; |
| 3064 | break; | 3075 | break; |
| 3065 | case MSR_F15H_PERF_CTL0 ... MSR_F15H_PERF_CTR5: | 3076 | case MSR_F15H_PERF_CTL0 ... MSR_F15H_PERF_CTR5: |
| @@ -5049,10 +5060,13 @@ set_identity_unlock: · 1983 unmodified lines | |||
| 5049 | r = -EFAULT; | 5060 | r = -EFAULT; |
| 5050 | if (copy_from_user(&u.ps, argp, sizeof(u.ps))) | 5061 | if (copy_from_user(&u.ps, argp, sizeof(u.ps))) |
| 5051 | goto out; | 5062 | goto out; |
| 5063 | mutex_lock(&kvm->lock); | ||
| 5052 | r = -ENXIO; | 5064 | r = -ENXIO; |
| 5053 | if (!kvm->arch.vpit) | 5065 | if (!kvm->arch.vpit) |
| 5054 | goto out; | 5066 | goto set_pit_out; |
| 5055 | r = kvm_vm_ioctl_set_pit(kvm, &u.ps); | 5067 | r = kvm_vm_ioctl_set_pit(kvm, &u.ps); |
| 5068 | set_pit_out: | ||
| 5069 | mutex_unlock(&kvm->lock); | ||
| 5056 | break; | 5070 | break; |
| 5057 | } | 5071 | } |
| 5058 | case KVM_GET_PIT2: { | 5072 | case KVM_GET_PIT2: { |
| @@ -5072,10 +5086,13 @@ set_identity_unlock: · 13 unmodified lines | |||
| 5072 | r = -EFAULT; | 5086 | r = -EFAULT; |
| 5073 | if (copy_from_user(&u.ps2, argp, sizeof(u.ps2))) | 5087 | if (copy_from_user(&u.ps2, argp, sizeof(u.ps2))) |
| 5074 | goto out; | 5088 | goto out; |
| 5089 | mutex_lock(&kvm->lock); | ||
| 5075 | r = -ENXIO; | 5090 | r = -ENXIO; |
| 5076 | if (!kvm->arch.vpit) | 5091 | if (!kvm->arch.vpit) |
| 5077 | goto out; | 5092 | goto set_pit2_out; |
| 5078 | r = kvm_vm_ioctl_set_pit2(kvm, &u.ps2); | 5093 | r = kvm_vm_ioctl_set_pit2(kvm, &u.ps2); |
| 5094 | set_pit2_out: | ||
| 5095 | mutex_unlock(&kvm->lock); | ||
| 5079 | break; | 5096 | break; |
| 5080 | } | 5097 | } |
| 5081 | case KVM_REINJECT_CONTROL: { | 5098 | case KVM_REINJECT_CONTROL: { |
| @@ -158,6 +158,19 @@ static bool is_ereg(u32 reg) · 157 unmodified lines | |||
| 158 | BIT(BPF_REG_AX)); | 158 | BIT(BPF_REG_AX)); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | /* | ||
| 162 | * is_ereg_8l() == true if BPF register 'reg' is mapped to access x86-64 | ||
| 163 | * lower 8-bit registers dil,sil,bpl,spl,r8b..r15b, which need extra byte | ||
| 164 | * of encoding. al,cl,dl,bl have simpler encoding. | ||
| 165 | */ | ||
| 166 | static bool is_ereg_8l(u32 reg) | ||
| 167 | { | ||
| 168 | return is_ereg(reg) || | ||
| 169 | (1 << reg) & (BIT(BPF_REG_1) | | ||
| 170 | BIT(BPF_REG_2) | | ||
| 171 | BIT(BPF_REG_FP)); | ||
| 172 | } | ||
| 173 | |||
| 161 | static bool is_axreg(u32 reg) | 174 | static bool is_axreg(u32 reg) |
| 162 | { | 175 | { |
| 163 | return reg == BPF_REG_0; | 176 | return reg == BPF_REG_0; |
| @@ -598,9 +611,8 @@ static void emit_stx(u8 **pprog, u32 size, u32 dst_reg, u32 src_reg, int off) · 434 unmodified lines | |||
| 598 | switch (size) { | 611 | switch (size) { |
| 599 | case BPF_B: | 612 | case BPF_B: |
| 600 | /* Emit 'mov byte ptr [rax + off], al' */ | 613 | /* Emit 'mov byte ptr [rax + off], al' */ |
| 601 | if (is_ereg(dst_reg) || is_ereg(src_reg) || | 614 | if (is_ereg(dst_reg) || is_ereg_8l(src_reg)) |
| 602 | /* We have to add extra byte for x86 SIL, DIL regs */ | 615 | /* Add extra byte for eregs or SIL,DIL,BPL in src_reg */ |
| 603 | src_reg == BPF_REG_1 || src_reg == BPF_REG_2) | ||
| 604 | EMIT2(add_2mod(0x40, dst_reg, src_reg), 0x88); | 616 | EMIT2(add_2mod(0x40, dst_reg, src_reg), 0x88); |
| 605 | else | 617 | else |
| 606 | EMIT1(0x88); | 618 | EMIT1(0x88); |
| @@ -1847,14 +1847,16 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, · 1846 unmodified lines | |||
| 1847 | case BPF_B: | 1847 | case BPF_B: |
| 1848 | case BPF_H: | 1848 | case BPF_H: |
| 1849 | case BPF_W: | 1849 | case BPF_W: |
| 1850 | if (!bpf_prog->aux->verifier_zext) | 1850 | if (bpf_prog->aux->verifier_zext) |
| 1851 | break; | 1851 | break; |
| 1852 | if (dstk) { | 1852 | if (dstk) { |
| 1853 | EMIT3(0xC7, add_1reg(0x40, IA32_EBP), | 1853 | EMIT3(0xC7, add_1reg(0x40, IA32_EBP), |
| 1854 | STACK_VAR(dst_hi)); | 1854 | STACK_VAR(dst_hi)); |
| 1855 | EMIT(0x0, 4); | 1855 | EMIT(0x0, 4); |
| 1856 | } else { | 1856 | } else { |
| 1857 | EMIT3(0xC7, add_1reg(0xC0, dst_hi), 0); | 1857 | /* xor dst_hi,dst_hi */ |
| 1858 | EMIT2(0x33, | ||
| 1859 | add_2reg(0xC0, dst_hi, dst_hi)); | ||
| 1858 | } | 1860 | } |
| 1859 | break; | 1861 | break; |
| 1860 | case BPF_DW: | 1862 | case BPF_DW: |
| @@ -2013,8 +2015,8 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, · 152 unmodified lines | |||
| 2013 | case BPF_JMP | BPF_JSET | BPF_X: | 2015 | case BPF_JMP | BPF_JSET | BPF_X: |
| 2014 | case BPF_JMP32 | BPF_JSET | BPF_X: { | 2016 | case BPF_JMP32 | BPF_JSET | BPF_X: { |
| 2015 | bool is_jmp64 = BPF_CLASS(insn->code) == BPF_JMP; | 2017 | bool is_jmp64 = BPF_CLASS(insn->code) == BPF_JMP; |
| 2016 | u8 dreg_lo = dstk ? IA32_EAX : dst_lo; | 2018 | u8 dreg_lo = IA32_EAX; |
| 2017 | u8 dreg_hi = dstk ? IA32_EDX : dst_hi; | 2019 | u8 dreg_hi = IA32_EDX; |
| 2018 | u8 sreg_lo = sstk ? IA32_ECX : src_lo; | 2020 | u8 sreg_lo = sstk ? IA32_ECX : src_lo; |
| 2019 | u8 sreg_hi = sstk ? IA32_EBX : src_hi; | 2021 | u8 sreg_hi = sstk ? IA32_EBX : src_hi; |
| 2020 | 2022 | ||
| @@ -2026,6 +2028,13 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, · 5 unmodified lines | |||
| 2026 | add_2reg(0x40, IA32_EBP, | 2028 | add_2reg(0x40, IA32_EBP, |
| 2027 | IA32_EDX), | 2029 | IA32_EDX), |
| 2028 | STACK_VAR(dst_hi)); | 2030 | STACK_VAR(dst_hi)); |
| 2031 | } else { | ||
| 2032 | /* mov dreg_lo,dst_lo */ | ||
| 2033 | EMIT2(0x89, add_2reg(0xC0, dreg_lo, dst_lo)); | ||
| 2034 | if (is_jmp64) | ||
| 2035 | /* mov dreg_hi,dst_hi */ | ||
| 2036 | EMIT2(0x89, | ||
| 2037 | add_2reg(0xC0, dreg_hi, dst_hi)); | ||
| 2029 | } | 2038 | } |
| 2030 | 2039 | ||
| 2031 | if (sstk) { | 2040 | if (sstk) { |
| @@ -2050,8 +2059,8 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, · 18 unmodified lines | |||
| 2050 | case BPF_JMP | BPF_JSET | BPF_K: | 2059 | case BPF_JMP | BPF_JSET | BPF_K: |
| 2051 | case BPF_JMP32 | BPF_JSET | BPF_K: { | 2060 | case BPF_JMP32 | BPF_JSET | BPF_K: { |
| 2052 | bool is_jmp64 = BPF_CLASS(insn->code) == BPF_JMP; | 2061 | bool is_jmp64 = BPF_CLASS(insn->code) == BPF_JMP; |
| 2053 | u8 dreg_lo = dstk ? IA32_EAX : dst_lo; | 2062 | u8 dreg_lo = IA32_EAX; |
| 2054 | u8 dreg_hi = dstk ? IA32_EDX : dst_hi; | 2063 | u8 dreg_hi = IA32_EDX; |
| 2055 | u8 sreg_lo = IA32_ECX; | 2064 | u8 sreg_lo = IA32_ECX; |
| 2056 | u8 sreg_hi = IA32_EBX; | 2065 | u8 sreg_hi = IA32_EBX; |
| 2057 | u32 hi; | 2066 | u32 hi; |
| @@ -2064,6 +2073,13 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, · 6 unmodified lines | |||
| 2064 | add_2reg(0x40, IA32_EBP, | 2073 | add_2reg(0x40, IA32_EBP, |
| 2065 | IA32_EDX), | 2074 | IA32_EDX), |
| 2066 | STACK_VAR(dst_hi)); | 2075 | STACK_VAR(dst_hi)); |
| 2076 | } else { | ||
| 2077 | /* mov dreg_lo,dst_lo */ | ||
| 2078 | EMIT2(0x89, add_2reg(0xC0, dreg_lo, dst_lo)); | ||
| 2079 | if (is_jmp64) | ||
| 2080 | /* mov dreg_hi,dst_hi */ | ||
| 2081 | EMIT2(0x89, | ||
| 2082 | add_2reg(0xC0, dreg_hi, dst_hi)); | ||
| 2067 | } | 2083 | } |
| 2068 | 2084 | ||
| 2069 | /* mov ecx,imm32 */ | 2085 | /* mov ecx,imm32 */ |
| @@ -202,7 +202,7 @@ virt_to_phys_or_null_size(void *va, unsigned long size) · 201 unmodified lines | |||
| 202 | 202 | ||
| 203 | int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) | 203 | int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) |
| 204 | { | 204 | { |
| 205 | unsigned long pfn, text, pf; | 205 | unsigned long pfn, text, pf, rodata; |
| 206 | struct page *page; | 206 | struct page *page; |
| 207 | unsigned npages; | 207 | unsigned npages; |
| 208 | pgd_t *pgd = efi_mm.pgd; | 208 | pgd_t *pgd = efi_mm.pgd; |
| @@ -256,7 +256,7 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) · 47 unmodified lines | |||
| 256 | 256 | ||
| 257 | efi_scratch.phys_stack = page_to_phys(page + 1); /* stack grows down */ | 257 | efi_scratch.phys_stack = page_to_phys(page + 1); /* stack grows down */ |
| 258 | 258 | ||
| 259 | npages = (__end_rodata_aligned - _text) >> PAGE_SHIFT; | 259 | npages = (_etext - _text) >> PAGE_SHIFT; |
| 260 | text = __pa(_text); | 260 | text = __pa(_text); |
| 261 | pfn = text >> PAGE_SHIFT; | 261 | pfn = text >> PAGE_SHIFT; |
| 262 | 262 | ||
| @@ -266,6 +266,14 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) · 3 unmodified lines | |||
| 266 | return 1; | 266 | return 1; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | npages = (__end_rodata - __start_rodata) >> PAGE_SHIFT; | ||
| 270 | rodata = __pa(__start_rodata); | ||
| 271 | pfn = rodata >> PAGE_SHIFT; | ||
| 272 | if (kernel_map_pages_in_pgd(pgd, pfn, rodata, npages, pf)) { | ||
| 273 | pr_err("Failed to map kernel rodata 1:1\n"); | ||
| 274 | return 1; | ||
| 275 | } | ||
| 276 | |||
| 269 | return 0; | 277 | return 0; |
| 270 | } | 278 | } |
| 271 | 279 | ||
| @@ -638,7 +646,7 @@ efi_thunk_set_variable(efi_char16_t *name, efi_guid_t *vendor, · 366 unmodified lines | |||
| 638 | phys_vendor = virt_to_phys_or_null(vnd); | 646 | phys_vendor = virt_to_phys_or_null(vnd); |
| 639 | phys_data = virt_to_phys_or_null_size(data, data_size); | 647 | phys_data = virt_to_phys_or_null_size(data, data_size); |
| 640 | 648 | ||
| 641 | if (!phys_name || !phys_data) | 649 | if (!phys_name || (data && !phys_data)) |
| 642 | status = EFI_INVALID_PARAMETER; | 650 | status = EFI_INVALID_PARAMETER; |
| 643 | else | 651 | else |
| 644 | status = efi_thunk(set_variable, phys_name, phys_vendor, | 652 | status = efi_thunk(set_variable, phys_name, phys_vendor, |
| @@ -669,7 +677,7 @@ efi_thunk_set_variable_nonblocking(efi_char16_t *name, efi_guid_t *vendor, · 24 unmodified lines | |||
| 669 | phys_vendor = virt_to_phys_or_null(vnd); | 677 | phys_vendor = virt_to_phys_or_null(vnd); |
| 670 | phys_data = virt_to_phys_or_null_size(data, data_size); | 678 | phys_data = virt_to_phys_or_null_size(data, data_size); |
| 671 | 679 | ||
| 672 | if (!phys_name || !phys_data) | 680 | if (!phys_name || (data && !phys_data)) |
| 673 | status = EFI_INVALID_PARAMETER; | 681 | status = EFI_INVALID_PARAMETER; |
| 674 | else | 682 | else |
| 675 | status = efi_thunk(set_variable, phys_name, phys_vendor, | 683 | status = efi_thunk(set_variable, phys_name, phys_vendor, |
| @@ -1,8 +1,4 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * include/asm-xtensa/module.h | ||
| 3 | * | ||
| 4 | * This file contains the module code specific to the Xtensa architecture. | ||
| 5 | * | ||
| 6 | * This file is subject to the terms and conditions of the GNU General Public | 2 | * This file is subject to the terms and conditions of the GNU General Public |
| 7 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
| 8 | * for more details. | 4 | * for more details. |
| @@ -10,11 +6,12 @@ · 1 unmodified line | |||
| 10 | * Copyright (C) 2001 - 2005 Tensilica Inc. | 6 | * Copyright (C) 2001 - 2005 Tensilica Inc. |
| 11 | */ | 7 | */ |
| 12 | 8 | ||
| 13 | #ifndef _XTENSA_MODULE_H | 9 | #ifndef _ASM_VERMAGIC_H |
| 14 | #define _XTENSA_MODULE_H | 10 | #define _ASM_VERMAGIC_H |
| 15 | 11 | ||
| 16 | #define MODULE_ARCH_VERMAGIC "xtensa-" __stringify(XCHAL_CORE_ID) " " | 12 | #include <linux/stringify.h> |
| 13 | #include <variant/core.h> | ||
| 17 | 14 | ||
| 18 | #include <asm-generic/module.h> | 15 | #define MODULE_ARCH_VERMAGIC "xtensa-" __stringify(XCHAL_CORE_ID) " " |
| 19 | 16 | ||
| 20 | #endif /* _XTENSA_MODULE_H */ | 17 | #endif /* _ASM_VERMAGIC_H */ |
| @@ -1591,7 +1591,7 @@ skip_surplus_transfers: · 1590 unmodified lines | |||
| 1591 | vrate_min, vrate_max); | 1591 | vrate_min, vrate_max); |
| 1592 | } | 1592 | } |
| 1593 | 1593 | ||
| 1594 | trace_iocost_ioc_vrate_adj(ioc, vrate, &missed_ppm, rq_wait_pct, | 1594 | trace_iocost_ioc_vrate_adj(ioc, vrate, missed_ppm, rq_wait_pct, |
| 1595 | nr_lagging, nr_shortages, | 1595 | nr_lagging, nr_shortages, |
| 1596 | nr_surpluses); | 1596 | nr_surpluses); |
| 1597 | 1597 | ||
| @@ -1600,7 +1600,7 @@ skip_surplus_transfers: · 2 unmodified lines | |||
| 1600 | ioc->period_us * vrate * INUSE_MARGIN_PCT, 100); | 1600 | ioc->period_us * vrate * INUSE_MARGIN_PCT, 100); |
| 1601 | } else if (ioc->busy_level != prev_busy_level || nr_lagging) { | 1601 | } else if (ioc->busy_level != prev_busy_level || nr_lagging) { |
| 1602 | trace_iocost_ioc_vrate_adj(ioc, atomic64_read(&ioc->vtime_rate), | 1602 | trace_iocost_ioc_vrate_adj(ioc, atomic64_read(&ioc->vtime_rate), |
| 1603 | &missed_ppm, rq_wait_pct, nr_lagging, | 1603 | missed_ppm, rq_wait_pct, nr_lagging, |
| 1604 | nr_shortages, nr_surpluses); | 1604 | nr_shortages, nr_surpluses); |
| 1605 | } | 1605 | } |
| 1606 | 1606 | ||
| @@ -1222,8 +1222,10 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list, · 1221 unmodified lines | |||
| 1222 | rq = list_first_entry(list, struct request, queuelist); | 1222 | rq = list_first_entry(list, struct request, queuelist); |
| 1223 | 1223 | ||
| 1224 | hctx = rq->mq_hctx; | 1224 | hctx = rq->mq_hctx; |
| 1225 | if (!got_budget && !blk_mq_get_dispatch_budget(hctx)) | 1225 | if (!got_budget && !blk_mq_get_dispatch_budget(hctx)) { |
| 1226 | blk_mq_put_driver_tag(rq); | ||
| 1226 | break; | 1227 | break; |
| 1228 | } | ||
| 1227 | 1229 | ||
| 1228 | if (!blk_mq_get_driver_tag(rq)) { | 1230 | if (!blk_mq_get_driver_tag(rq)) { |
| 1229 | /* | 1231 | /* |
| @@ -313,7 +313,7 @@ static void scale_up(struct rq_wb *rwb) · 312 unmodified lines | |||
| 313 | calc_wb_limits(rwb); | 313 | calc_wb_limits(rwb); |
| 314 | rwb->unknown_cnt = 0; | 314 | rwb->unknown_cnt = 0; |
| 315 | rwb_wake_all(rwb); | 315 | rwb_wake_all(rwb); |
| 316 | rwb_trace_step(rwb, "scale up"); | 316 | rwb_trace_step(rwb, tracepoint_string("scale up")); |
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | static void scale_down(struct rq_wb *rwb, bool hard_throttle) | 319 | static void scale_down(struct rq_wb *rwb, bool hard_throttle) |
| @@ -322,7 +322,7 @@ static void scale_down(struct rq_wb *rwb, bool hard_throttle) · 2 unmodified lines | |||
| 322 | return; | 322 | return; |
| 323 | calc_wb_limits(rwb); | 323 | calc_wb_limits(rwb); |
| 324 | rwb->unknown_cnt = 0; | 324 | rwb->unknown_cnt = 0; |
| 325 | rwb_trace_step(rwb, "scale down"); | 325 | rwb_trace_step(rwb, tracepoint_string("scale down")); |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | static void rwb_arm_timer(struct rq_wb *rwb) | 328 | static void rwb_arm_timer(struct rq_wb *rwb) |
| @@ -87,18 +87,6 @@ static const struct dmi_system_id dmi_lid_quirks[] = { · 86 unmodified lines | |||
| 87 | }, | 87 | }, |
| 88 | .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_DISABLED, | 88 | .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_DISABLED, |
| 89 | }, | 89 | }, |
| 90 | { | ||
| 91 | /* | ||
| 92 | * Asus T200TA, _LID keeps reporting closed after every second | ||
| 93 | * openening of the lid. Causing immediate re-suspend after | ||
| 94 | * opening every other open. Using LID_INIT_OPEN fixes this. | ||
| 95 | */ | ||
| 96 | .matches = { | ||
| 97 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), | ||
| 98 | DMI_MATCH(DMI_PRODUCT_NAME, "T200TA"), | ||
| 99 | }, | ||
| 100 | .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN, | ||
| 101 | }, | ||
| 102 | { | 90 | { |
| 103 | /* GP-electronic T701, _LID method points to a floating GPIO */ | 91 | /* GP-electronic T701, _LID method points to a floating GPIO */ |
| 104 | .matches = { | 92 | .matches = { |
| @@ -322,10 +322,10 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) · 321 unmodified lines | |||
| 322 | resource->res.data.extended_irq.polarity = | 322 | resource->res.data.extended_irq.polarity = |
| 323 | link->irq.polarity; | 323 | link->irq.polarity; |
| 324 | if (link->irq.triggering == ACPI_EDGE_SENSITIVE) | 324 | if (link->irq.triggering == ACPI_EDGE_SENSITIVE) |
| 325 | resource->res.data.irq.shareable = | 325 | resource->res.data.extended_irq.shareable = |
| 326 | ACPI_EXCLUSIVE; | 326 | ACPI_EXCLUSIVE; |
| 327 | else | 327 | else |
| 328 | resource->res.data.irq.shareable = ACPI_SHARED; | 328 | resource->res.data.extended_irq.shareable = ACPI_SHARED; |
| 329 | resource->res.data.extended_irq.interrupt_count = 1; | 329 | resource->res.data.extended_irq.interrupt_count = 1; |
| 330 | resource->res.data.extended_irq.interrupts[0] = irq; | 330 | resource->res.data.extended_irq.interrupts[0] = irq; |
| 331 | /* ignore resource_source, it's optional */ | 331 | /* ignore resource_source, it's optional */ |
| @@ -410,6 +410,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { · 409 unmodified lines | |||
| 410 | { PCI_VDEVICE(INTEL, 0x22a3), board_ahci_mobile }, /* Cherry Tr. AHCI */ | 410 | { PCI_VDEVICE(INTEL, 0x22a3), board_ahci_mobile }, /* Cherry Tr. AHCI */ |
| 411 | { PCI_VDEVICE(INTEL, 0x5ae3), board_ahci_mobile }, /* ApolloLake AHCI */ | 411 | { PCI_VDEVICE(INTEL, 0x5ae3), board_ahci_mobile }, /* ApolloLake AHCI */ |
| 412 | { PCI_VDEVICE(INTEL, 0x34d3), board_ahci_mobile }, /* Ice Lake LP AHCI */ | 412 | { PCI_VDEVICE(INTEL, 0x34d3), board_ahci_mobile }, /* Ice Lake LP AHCI */ |
| 413 | { PCI_VDEVICE(INTEL, 0x02d3), board_ahci_mobile }, /* Comet Lake PCH-U AHCI */ | ||
| 413 | { PCI_VDEVICE(INTEL, 0x02d7), board_ahci_mobile }, /* Comet Lake PCH RAID */ | 414 | { PCI_VDEVICE(INTEL, 0x02d7), board_ahci_mobile }, /* Comet Lake PCH RAID */ |
| 414 | 415 | ||
| 415 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 416 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
| @@ -145,7 +145,7 @@ enum { · 144 unmodified lines | |||
| 145 | 145 | ||
| 146 | /* PORT_IDMA_CTL bits */ | 146 | /* PORT_IDMA_CTL bits */ |
| 147 | IDMA_CTL_RST_ATA = (1 << 2), /* hardreset ATA bus */ | 147 | IDMA_CTL_RST_ATA = (1 << 2), /* hardreset ATA bus */ |
| 148 | IDMA_CTL_RST_IDMA = (1 << 5), /* reset IDMA machinary */ | 148 | IDMA_CTL_RST_IDMA = (1 << 5), /* reset IDMA machinery */ |
| 149 | IDMA_CTL_GO = (1 << 7), /* IDMA mode go */ | 149 | IDMA_CTL_GO = (1 << 7), /* IDMA mode go */ |
| 150 | IDMA_CTL_ATA_NIEN = (1 << 8), /* ATA IRQ disable */ | 150 | IDMA_CTL_ATA_NIEN = (1 << 8), /* ATA IRQ disable */ |
| 151 | 151 | ||
| @@ -45,5 +45,4 @@ struct ctl_table firmware_config_table[] = { · 44 unmodified lines | |||
| 45 | }, | 45 | }, |
| 46 | { } | 46 | { } |
| 47 | }; | 47 | }; |
| 48 | EXPORT_SYMBOL_GPL(firmware_config_table); | ||
| 49 | #endif | 48 | #endif |
| @@ -730,7 +730,7 @@ static bool dpm_async_fn(struct device *dev, async_func_t func) · 729 unmodified lines | |||
| 730 | 730 | ||
| 731 | if (is_async(dev)) { | 731 | if (is_async(dev)) { |
| 732 | get_device(dev); | 732 | get_device(dev); |
| 733 | async_schedule(func, dev); | 733 | async_schedule_dev(func, dev); |
| 734 | return true; | 734 | return true; |
| 735 | } | 735 | } |
| 736 | 736 | ||
| @@ -85,26 +85,35 @@ struct nullb { · 84 unmodified lines | |||
| 85 | char disk_name[DISK_NAME_LEN]; | 85 | char disk_name[DISK_NAME_LEN]; |
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| 88 | blk_status_t null_process_cmd(struct nullb_cmd *cmd, | ||
| 89 | enum req_opf op, sector_t sector, | ||
| 90 | unsigned int nr_sectors); | ||
| 91 | |||
| 88 | #ifdef CONFIG_BLK_DEV_ZONED | 92 | #ifdef CONFIG_BLK_DEV_ZONED |
| 89 | int null_zone_init(struct nullb_device *dev); | 93 | int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q); |
| 90 | void null_zone_exit(struct nullb_device *dev); | 94 | int null_register_zoned_dev(struct nullb *nullb); |
| 95 | void null_free_zoned_dev(struct nullb_device *dev); | ||
| 91 | int null_report_zones(struct gendisk *disk, sector_t sector, | 96 | int null_report_zones(struct gendisk *disk, sector_t sector, |
| 92 | unsigned int nr_zones, report_zones_cb cb, void *data); | 97 | unsigned int nr_zones, report_zones_cb cb, void *data); |
| 93 | blk_status_t null_handle_zoned(struct nullb_cmd *cmd, | 98 | blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, |
| 94 | enum req_opf op, sector_t sector, | 99 | enum req_opf op, sector_t sector, |
| 95 | sector_t nr_sectors); | 100 | sector_t nr_sectors); |
| 96 | size_t null_zone_valid_read_len(struct nullb *nullb, | 101 | size_t null_zone_valid_read_len(struct nullb *nullb, |
| 97 | sector_t sector, unsigned int len); | 102 | sector_t sector, unsigned int len); |
| 98 | #else | 103 | #else |
| 99 | static inline int null_zone_init(struct nullb_device *dev) | 104 | static inline int null_init_zoned_dev(struct nullb_device *dev, |
| 105 | struct request_queue *q) | ||
| 100 | { | 106 | { |
| 101 | pr_err("CONFIG_BLK_DEV_ZONED not enabled\n"); | 107 | pr_err("CONFIG_BLK_DEV_ZONED not enabled\n"); |
| 102 | return -EINVAL; | 108 | return -EINVAL; |
| 103 | } | 109 | } |
| 104 | static inline void null_zone_exit(struct nullb_device *dev) {} | 110 | static inline int null_register_zoned_dev(struct nullb *nullb) |
| 105 | static inline blk_status_t null_handle_zoned(struct nullb_cmd *cmd, | 111 | { |
| 106 | enum req_opf op, sector_t sector, | 112 | return -ENODEV; |
| 107 | sector_t nr_sectors) | 113 | } |
| 114 | static inline void null_free_zoned_dev(struct nullb_device *dev) {} | ||
| 115 | static inline blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, | ||
| 116 | enum req_opf op, sector_t sector, sector_t nr_sectors) | ||
| 108 | { | 117 | { |
| 109 | return BLK_STS_NOTSUPP; | 118 | return BLK_STS_NOTSUPP; |
| 110 | } | 119 | } |
| @@ -580,7 +580,7 @@ static void null_free_dev(struct nullb_device *dev) · 579 unmodified lines | |||
| 580 | if (!dev) | 580 | if (!dev) |
| 581 | return; | 581 | return; |
| 582 | 582 | ||
| 583 | null_zone_exit(dev); | 583 | null_free_zoned_dev(dev); |
| 584 | badblocks_exit(&dev->badblocks); | 584 | badblocks_exit(&dev->badblocks); |
| 585 | kfree(dev); | 585 | kfree(dev); |
| 586 | } | 586 | } |
| @@ -1276,6 +1276,25 @@ static inline void nullb_complete_cmd(struct nullb_cmd *cmd) · 689 unmodified lines | |||
| 1276 | } | 1276 | } |
| 1277 | } | 1277 | } |
| 1278 | 1278 | ||
| 1279 | blk_status_t null_process_cmd(struct nullb_cmd *cmd, | ||
| 1280 | enum req_opf op, sector_t sector, | ||
| 1281 | unsigned int nr_sectors) | ||
| 1282 | { | ||
| 1283 | struct nullb_device *dev = cmd->nq->dev; | ||
| 1284 | blk_status_t ret; | ||
| 1285 | |||
| 1286 | if (dev->badblocks.shift != -1) { | ||
| 1287 | ret = null_handle_badblocks(cmd, sector, nr_sectors); | ||
| 1288 | if (ret != BLK_STS_OK) | ||
| 1289 | return ret; | ||
| 1290 | } | ||
| 1291 | |||
| 1292 | if (dev->memory_backed) | ||
| 1293 | return null_handle_memory_backed(cmd, op); | ||
| 1294 | |||
| 1295 | return BLK_STS_OK; | ||
| 1296 | } | ||
| 1297 | |||
| 1279 | static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector, | 1298 | static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector, |
| 1280 | sector_t nr_sectors, enum req_opf op) | 1299 | sector_t nr_sectors, enum req_opf op) |
| 1281 | { | 1300 | { |
| @@ -1294,17 +1313,11 @@ static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector, · 12 unmodified lines | |||
| 1294 | goto out; | 1313 | goto out; |
| 1295 | } | 1314 | } |
| 1296 | 1315 | ||
| 1297 | if (nullb->dev->badblocks.shift != -1) { | 1316 | if (dev->zoned) |
| 1298 | cmd->error = null_handle_badblocks(cmd, sector, nr_sectors); | 1317 | cmd->error = null_process_zoned_cmd(cmd, op, |
| 1299 | if (cmd->error != BLK_STS_OK) | 1318 | sector, nr_sectors); |
| 1300 | goto out; | 1319 | else |
| 1301 | } | 1320 | cmd->error = null_process_cmd(cmd, op, sector, nr_sectors); |
| 1302 | |||
| 1303 | if (dev->memory_backed) | ||
| 1304 | cmd->error = null_handle_memory_backed(cmd, op); | ||
| 1305 | |||
| 1306 | if (!cmd->error && dev->zoned) | ||
| 1307 | cmd->error = null_handle_zoned(cmd, op, sector, nr_sectors); | ||
| 1308 | 1321 | ||
| 1309 | out: | 1322 | out: |
| 1310 | nullb_complete_cmd(cmd); | 1323 | nullb_complete_cmd(cmd); |
| @@ -1605,19 +1618,12 @@ static int null_gendisk_register(struct nullb *nullb) · 294 unmodified lines | |||
| 1605 | disk->queue = nullb->q; | 1618 | disk->queue = nullb->q; |
| 1606 | strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN); | 1619 | strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN); |
| 1607 | 1620 | ||
| 1608 | #ifdef CONFIG_BLK_DEV_ZONED | ||
| 1609 | if (nullb->dev->zoned) { | 1621 | if (nullb->dev->zoned) { |
| 1610 | if (queue_is_mq(nullb->q)) { | 1622 | int ret = null_register_zoned_dev(nullb); |
| 1611 | int ret = blk_revalidate_disk_zones(disk); | 1623 | |
| 1612 | if (ret) | 1624 | if (ret) |
| 1613 | return ret; | 1625 | return ret; |
| 1614 | } else { | ||
| 1615 | blk_queue_chunk_sectors(nullb->q, | ||
| 1616 | nullb->dev->zone_size_sects); | ||
| 1617 | nullb->q->nr_zones = blkdev_nr_zones(disk); | ||
| 1618 | } | ||
| 1619 | } | 1626 | } |
| 1620 | #endif | ||
| 1621 | 1627 | ||
| 1622 | add_disk(disk); | 1628 | add_disk(disk); |
| 1623 | return 0; | 1629 | return 0; |
| @@ -1773,14 +1779,9 @@ static int null_add_dev(struct nullb_device *dev) · 149 unmodified lines | |||
| 1773 | } | 1779 | } |
| 1774 | 1780 | ||
| 1775 | if (dev->zoned) { | 1781 | if (dev->zoned) { |
| 1776 | rv = null_zone_init(dev); | 1782 | rv = null_init_zoned_dev(dev, nullb->q); |
| 1777 | if (rv) | 1783 | if (rv) |
| 1778 | goto out_cleanup_blk_queue; | 1784 | goto out_cleanup_blk_queue; |
| 1779 | |||
| 1780 | nullb->q->limits.zoned = BLK_ZONED_HM; | ||
| 1781 | blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, nullb->q); | ||
| 1782 | blk_queue_required_elevator_features(nullb->q, | ||
| 1783 | ELEVATOR_F_ZBD_SEQ_WRITE); | ||
| 1784 | } | 1785 | } |
| 1785 | 1786 | ||
| 1786 | nullb->q->queuedata = nullb; | 1787 | nullb->q->queuedata = nullb; |
| @@ -1809,8 +1810,7 @@ static int null_add_dev(struct nullb_device *dev) · 22 unmodified lines | |||
| 1809 | 1810 | ||
| 1810 | return 0; | 1811 | return 0; |
| 1811 | out_cleanup_zone: | 1812 | out_cleanup_zone: |
| 1812 | if (dev->zoned) | 1813 | null_free_zoned_dev(dev); |
| 1813 | null_zone_exit(dev); | ||
| 1814 | out_cleanup_blk_queue: | 1814 | out_cleanup_blk_queue: |
| 1815 | blk_cleanup_queue(nullb->q); | 1815 | blk_cleanup_queue(nullb->q); |
| 1816 | out_cleanup_tags: | 1816 | out_cleanup_tags: |
| @@ -13,7 +13,7 @@ static inline unsigned int null_zone_no(struct nullb_device *dev, sector_t sect) · 12 unmodified lines | |||
| 13 | return sect >> ilog2(dev->zone_size_sects); | 13 | return sect >> ilog2(dev->zone_size_sects); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | int null_zone_init(struct nullb_device *dev) | 16 | int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q) |
| 17 | { | 17 | { |
| 18 | sector_t dev_size = (sector_t)dev->size * 1024 * 1024; | 18 | sector_t dev_size = (sector_t)dev->size * 1024 * 1024; |
| 19 | sector_t sector = 0; | 19 | sector_t sector = 0; |
| @@ -61,10 +61,27 @@ int null_zone_init(struct nullb_device *dev) · 41 unmodified lines | |||
| 61 | sector += dev->zone_size_sects; | 61 | sector += dev->zone_size_sects; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | q->limits.zoned = BLK_ZONED_HM; | ||
| 65 | blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q); | ||
| 66 | blk_queue_required_elevator_features(q, ELEVATOR_F_ZBD_SEQ_WRITE); | ||
| 67 | |||
| 68 | return 0; | ||
| 69 | } | ||
| 70 | |||
| 71 | int null_register_zoned_dev(struct nullb *nullb) | ||
| 72 | { | ||
| 73 | struct request_queue *q = nullb->q; | ||
| 74 | |||
| 75 | if (queue_is_mq(q)) | ||
| 76 | return blk_revalidate_disk_zones(nullb->disk); | ||
| 77 | |||
| 78 | blk_queue_chunk_sectors(q, nullb->dev->zone_size_sects); | ||
| 79 | q->nr_zones = blkdev_nr_zones(nullb->disk); | ||
| 80 | |||
| 64 | return 0; | 81 | return 0; |
| 65 | } | 82 | } |
| 66 | 83 | ||
| 67 | void null_zone_exit(struct nullb_device *dev) | 84 | void null_free_zoned_dev(struct nullb_device *dev) |
| 68 | { | 85 | { |
| 69 | kvfree(dev->zones); | 86 | kvfree(dev->zones); |
| 70 | } | 87 | } |
| @@ -126,11 +143,16 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector, · 55 unmodified lines | |||
| 126 | struct nullb_device *dev = cmd->nq->dev; | 143 | struct nullb_device *dev = cmd->nq->dev; |
| 127 | unsigned int zno = null_zone_no(dev, sector); | 144 | unsigned int zno = null_zone_no(dev, sector); |
| 128 | struct blk_zone *zone = &dev->zones[zno]; | 145 | struct blk_zone *zone = &dev->zones[zno]; |
| 146 | blk_status_t ret; | ||
| 147 | |||
| 148 | trace_nullb_zone_op(cmd, zno, zone->cond); | ||
| 149 | |||
| 150 | if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL) | ||
| 151 | return null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors); | ||
| 129 | 152 | ||
| 130 | switch (zone->cond) { | 153 | switch (zone->cond) { |
| 131 | case BLK_ZONE_COND_FULL: | 154 | case BLK_ZONE_COND_FULL: |
| 132 | /* Cannot write to a full zone */ | 155 | /* Cannot write to a full zone */ |
| 133 | cmd->error = BLK_STS_IOERR; | ||
| 134 | return BLK_STS_IOERR; | 156 | return BLK_STS_IOERR; |
| 135 | case BLK_ZONE_COND_EMPTY: | 157 | case BLK_ZONE_COND_EMPTY: |
| 136 | case BLK_ZONE_COND_IMP_OPEN: | 158 | case BLK_ZONE_COND_IMP_OPEN: |
| @@ -143,19 +165,18 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector, · 6 unmodified lines | |||
| 143 | if (zone->cond != BLK_ZONE_COND_EXP_OPEN) | 165 | if (zone->cond != BLK_ZONE_COND_EXP_OPEN) |
| 144 | zone->cond = BLK_ZONE_COND_IMP_OPEN; | 166 | zone->cond = BLK_ZONE_COND_IMP_OPEN; |
| 145 | 167 | ||
| 168 | ret = null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors); | ||
| 169 | if (ret != BLK_STS_OK) | ||
| 170 | return ret; | ||
| 171 | |||
| 146 | zone->wp += nr_sectors; | 172 | zone->wp += nr_sectors; |
| 147 | if (zone->wp == zone->start + zone->len) | 173 | if (zone->wp == zone->start + zone->len) |
| 148 | zone->cond = BLK_ZONE_COND_FULL; | 174 | zone->cond = BLK_ZONE_COND_FULL; |
| 149 | break; | 175 | return BLK_STS_OK; |
| 150 | case BLK_ZONE_COND_NOT_WP: | ||
| 151 | break; | ||
| 152 | default: | 176 | default: |
| 153 | /* Invalid zone condition */ | 177 | /* Invalid zone condition */ |
| 154 | return BLK_STS_IOERR; | 178 | return BLK_STS_IOERR; |
| 155 | } | 179 | } |
| 156 | |||
| 157 | trace_nullb_zone_op(cmd, zno, zone->cond); | ||
| 158 | return BLK_STS_OK; | ||
| 159 | } | 180 | } |
| 160 | 181 | ||
| 161 | static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op, | 182 | static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op, |
| @@ -216,8 +237,8 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op, · 54 unmodified lines | |||
| 216 | return BLK_STS_OK; | 237 | return BLK_STS_OK; |
| 217 | } | 238 | } |
| 218 | 239 | ||
| 219 | blk_status_t null_handle_zoned(struct nullb_cmd *cmd, enum req_opf op, | 240 | blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, enum req_opf op, |
| 220 | sector_t sector, sector_t nr_sectors) | 241 | sector_t sector, sector_t nr_sectors) |
| 221 | { | 242 | { |
| 222 | switch (op) { | 243 | switch (op) { |
| 223 | case REQ_OP_WRITE: | 244 | case REQ_OP_WRITE: |
| @@ -229,6 +250,6 @@ blk_status_t null_handle_zoned(struct nullb_cmd *cmd, enum req_opf op, · 5 unmodified lines | |||
| 229 | case REQ_OP_ZONE_FINISH: | 250 | case REQ_OP_ZONE_FINISH: |
| 230 | return null_zone_mgmt(cmd, op, sector); | 251 | return null_zone_mgmt(cmd, op, sector); |
| 231 | default: | 252 | default: |
| 232 | return BLK_STS_OK; | 253 | return null_process_cmd(cmd, op, sector, nr_sectors); |
| 233 | } | 254 | } |
| 234 | } | 255 | } |
| @@ -3754,11 +3754,7 @@ static int __rbd_notify_op_lock(struct rbd_device *rbd_dev, · 3753 unmodified lines | |||
| 3754 | static void rbd_notify_op_lock(struct rbd_device *rbd_dev, | 3754 | static void rbd_notify_op_lock(struct rbd_device *rbd_dev, |
| 3755 | enum rbd_notify_op notify_op) | 3755 | enum rbd_notify_op notify_op) |
| 3756 | { | 3756 | { |
| 3757 | struct page **reply_pages; | 3757 | __rbd_notify_op_lock(rbd_dev, notify_op, NULL, NULL); |
| 3758 | size_t reply_len; | ||
| 3759 | |||
| 3760 | __rbd_notify_op_lock(rbd_dev, notify_op, &reply_pages, &reply_len); | ||
| 3761 | ceph_release_page_vector(reply_pages, calc_pages_for(0, reply_len)); | ||
| 3762 | } | 3758 | } |
| 3763 | 3759 | ||
| 3764 | static void rbd_notify_acquired_lock(struct work_struct *work) | 3760 | static void rbd_notify_acquired_lock(struct work_struct *work) |
| @@ -4527,6 +4523,10 @@ static void cancel_tasks_sync(struct rbd_device *rbd_dev) · 762 unmodified lines | |||
| 4527 | cancel_work_sync(&rbd_dev->unlock_work); | 4523 | cancel_work_sync(&rbd_dev->unlock_work); |
| 4528 | } | 4524 | } |
| 4529 | 4525 | ||
| 4526 | /* | ||
| 4527 | * header_rwsem must not be held to avoid a deadlock with | ||
| 4528 | * rbd_dev_refresh() when flushing notifies. | ||
| 4529 | */ | ||
| 4530 | static void rbd_unregister_watch(struct rbd_device *rbd_dev) | 4530 | static void rbd_unregister_watch(struct rbd_device *rbd_dev) |
| 4531 | { | 4531 | { |
| 4532 | cancel_tasks_sync(rbd_dev); | 4532 | cancel_tasks_sync(rbd_dev); |
| @@ -6894,9 +6894,10 @@ static void rbd_print_dne(struct rbd_device *rbd_dev, bool is_snap) · 2361 unmodified lines | |||
| 6894 | 6894 | ||
| 6895 | static void rbd_dev_image_release(struct rbd_device *rbd_dev) | 6895 | static void rbd_dev_image_release(struct rbd_device *rbd_dev) |
| 6896 | { | 6896 | { |
| 6897 | rbd_dev_unprobe(rbd_dev); | 6897 | if (!rbd_is_ro(rbd_dev)) |
| 6898 | if (rbd_dev->opts) | ||
| 6899 | rbd_unregister_watch(rbd_dev); | 6898 | rbd_unregister_watch(rbd_dev); |
| 6899 | |||
| 6900 | rbd_dev_unprobe(rbd_dev); | ||
| 6900 | rbd_dev->image_format = 0; | 6901 | rbd_dev->image_format = 0; |
| 6901 | kfree(rbd_dev->spec->image_id); | 6902 | kfree(rbd_dev->spec->image_id); |
| 6902 | rbd_dev->spec->image_id = NULL; | 6903 | rbd_dev->spec->image_id = NULL; |
| @@ -6907,6 +6908,9 @@ static void rbd_dev_image_release(struct rbd_device *rbd_dev) · 4 unmodified lines | |||
| 6907 | * device. If this image is the one being mapped (i.e., not a | 6908 | * device. If this image is the one being mapped (i.e., not a |
| 6908 | * parent), initiate a watch on its header object before using that | 6909 | * parent), initiate a watch on its header object before using that |
| 6909 | * object to get detailed information about the rbd image. | 6910 | * object to get detailed information about the rbd image. |
| 6911 | * | ||
| 6912 | * On success, returns with header_rwsem held for write if called | ||
| 6913 | * with @depth == 0. | ||
| 6910 | */ | 6914 | */ |
| 6911 | static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) | 6915 | static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) |
| 6912 | { | 6916 | { |
| @@ -6936,11 +6940,14 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) · 23 unmodified lines | |||
| 6936 | } | 6940 | } |
| 6937 | } | 6941 | } |
| 6938 | 6942 | ||
| 6943 | if (!depth) | ||
| 6944 | down_write(&rbd_dev->header_rwsem); | ||
| 6945 | |||
| 6939 | ret = rbd_dev_header_info(rbd_dev); | 6946 | ret = rbd_dev_header_info(rbd_dev); |
| 6940 | if (ret) { | 6947 | if (ret) { |
| 6941 | if (ret == -ENOENT && !need_watch) | 6948 | if (ret == -ENOENT && !need_watch) |
| 6942 | rbd_print_dne(rbd_dev, false); | 6949 | rbd_print_dne(rbd_dev, false); |
| 6943 | goto err_out_watch; | 6950 | goto err_out_probe; |
| 6944 | } | 6951 | } |
| 6945 | 6952 | ||
| 6946 | /* | 6953 | /* |
| @@ -6985,10 +6992,11 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) · 38 unmodified lines | |||
| 6985 | return 0; | 6992 | return 0; |
| 6986 | 6993 | ||
| 6987 | err_out_probe: | 6994 | err_out_probe: |
| 6988 | rbd_dev_unprobe(rbd_dev); | 6995 | if (!depth) |
| 6989 | err_out_watch: | 6996 | up_write(&rbd_dev->header_rwsem); |
| 6990 | if (need_watch) | 6997 | if (need_watch) |
| 6991 | rbd_unregister_watch(rbd_dev); | 6998 | rbd_unregister_watch(rbd_dev); |
| 6999 | rbd_dev_unprobe(rbd_dev); | ||
| 6992 | err_out_format: | 7000 | err_out_format: |
| 6993 | rbd_dev->image_format = 0; | 7001 | rbd_dev->image_format = 0; |
| 6994 | kfree(rbd_dev->spec->image_id); | 7002 | kfree(rbd_dev->spec->image_id); |
| @@ -7050,12 +7058,9 @@ static ssize_t do_rbd_add(struct bus_type *bus, · 55 unmodified lines | |||
| 7050 | goto err_out_rbd_dev; | 7058 | goto err_out_rbd_dev; |
| 7051 | } | 7059 | } |
| 7052 | 7060 | ||
| 7053 | down_write(&rbd_dev->header_rwsem); | ||
| 7054 | rc = rbd_dev_image_probe(rbd_dev, 0); | 7061 | rc = rbd_dev_image_probe(rbd_dev, 0); |
| 7055 | if (rc < 0) { | 7062 | if (rc < 0) |
| 7056 | up_write(&rbd_dev->header_rwsem); | ||
| 7057 | goto err_out_rbd_dev; | 7063 | goto err_out_rbd_dev; |
| 7058 | } | ||
| 7059 | 7064 | ||
| 7060 | if (rbd_dev->opts->alloc_size > rbd_dev->layout.object_size) { | 7065 | if (rbd_dev->opts->alloc_size > rbd_dev->layout.object_size) { |
| 7061 | rbd_warn(rbd_dev, "alloc_size adjusted to %u", | 7066 | rbd_warn(rbd_dev, "alloc_size adjusted to %u", |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | |||
| 15 | #include <linux/blk-mq.h> | 15 | #include <linux/blk-mq.h> |
| 16 | #include <linux/blk-mq-virtio.h> | 16 | #include <linux/blk-mq-virtio.h> |
| 17 | #include <linux/numa.h> | 17 | #include <linux/numa.h> |
| 18 | #include <uapi/linux/virtio_ring.h> | ||
| 18 | 19 | ||
| 19 | #define PART_BITS 4 | 20 | #define PART_BITS 4 |
| 20 | #define VQ_NAME_LEN 16 | 21 | #define VQ_NAME_LEN 16 |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | #include <linux/virtio.h> | 11 | #include <linux/virtio.h> |
| 12 | #include <linux/virtio_rng.h> | 12 | #include <linux/virtio_rng.h> |
| 13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| 14 | #include <linux/slab.h> | ||
| 14 | 15 | ||
| 15 | static DEFINE_IDA(rng_index_ida); | 16 | static DEFINE_IDA(rng_index_ida); |
| 16 | 17 | ||
| @@ -323,7 +323,7 @@ int tpm_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, · 322 unmodified lines | |||
| 323 | 323 | ||
| 324 | for (i = 0; i < chip->nr_allocated_banks; i++) { | 324 | for (i = 0; i < chip->nr_allocated_banks; i++) { |
| 325 | if (digests[i].alg_id != chip->allocated_banks[i].alg_id) { | 325 | if (digests[i].alg_id != chip->allocated_banks[i].alg_id) { |
| 326 | rc = EINVAL; | 326 | rc = -EINVAL; |
| 327 | goto out; | 327 | goto out; |
| 328 | } | 328 | } |
| 329 | } | 329 | } |
| @@ -681,6 +681,7 @@ out: · 680 unmodified lines | |||
| 681 | rc = -ENODEV; | 681 | rc = -ENODEV; |
| 682 | return rc; | 682 | return rc; |
| 683 | } | 683 | } |
| 684 | EXPORT_SYMBOL_GPL(tpm2_get_cc_attrs_tbl); | ||
| 684 | 685 | ||
| 685 | /** | 686 | /** |
| 686 | * tpm2_startup - turn on the TPM | 687 | * tpm2_startup - turn on the TPM |
| @@ -1,6 +1,6 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | /* | 2 | /* |
| 3 | * Copyright (C) 2012 IBM Corporation | 3 | * Copyright (C) 2012-2020 IBM Corporation |
| 4 | * | 4 | * |
| 5 | * Author: Ashley Lai <ashleydlai@gmail.com> | 5 | * Author: Ashley Lai <ashleydlai@gmail.com> |
| 6 | * | 6 | * |
| @@ -134,6 +134,64 @@ static int tpm_ibmvtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count) · 127 unmodified lines | |||
| 134 | return len; | 134 | return len; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | /** | ||
| 138 | * ibmvtpm_crq_send_init - Send a CRQ initialize message | ||
| 139 | * @ibmvtpm: vtpm device struct | ||
| 140 | * | ||
| 141 | * Return: | ||
| 142 | * 0 on success. | ||
| 143 | * Non-zero on failure. | ||
| 144 | */ | ||
| 145 | static int ibmvtpm_crq_send_init(struct ibmvtpm_dev *ibmvtpm) | ||
| 146 | { | ||
| 147 | int rc; | ||
| 148 | |||
| 149 | rc = ibmvtpm_send_crq_word(ibmvtpm->vdev, INIT_CRQ_CMD); | ||
| 150 | if (rc != H_SUCCESS) | ||
| 151 | dev_err(ibmvtpm->dev, | ||
| 152 | "%s failed rc=%d\n", __func__, rc); | ||
| 153 | |||
| 154 | return rc; | ||
| 155 | } | ||
| 156 | |||
| 157 | /** | ||
| 158 | * tpm_ibmvtpm_resume - Resume from suspend | ||
| 159 | * | ||
| 160 | * @dev: device struct | ||
| 161 | * | ||
| 162 | * Return: Always 0. | ||
| 163 | */ | ||
| 164 | static int tpm_ibmvtpm_resume(struct device *dev) | ||
| 165 | { | ||
| 166 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
| 167 | struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev); | ||
| 168 | int rc = 0; | ||
| 169 | |||
| 170 | do { | ||
| 171 | if (rc) | ||
| 172 | msleep(100); | ||
| 173 | rc = plpar_hcall_norets(H_ENABLE_CRQ, | ||
| 174 | ibmvtpm->vdev->unit_address); | ||
| 175 | } while (rc == H_IN_PROGRESS || rc == H_BUSY || H_IS_LONG_BUSY(rc)); | ||
| 176 | |||
| 177 | if (rc) { | ||
| 178 | dev_err(dev, "Error enabling ibmvtpm rc=%d\n", rc); | ||
| 179 | return rc; | ||
| 180 | } | ||
| 181 | |||
| 182 | rc = vio_enable_interrupts(ibmvtpm->vdev); | ||
| 183 | if (rc) { | ||
| 184 | dev_err(dev, "Error vio_enable_interrupts rc=%d\n", rc); | ||
| 185 | return rc; | ||
| 186 | } | ||
| 187 | |||
| 188 | rc = ibmvtpm_crq_send_init(ibmvtpm); | ||
| 189 | if (rc) | ||
| 190 | dev_err(dev, "Error send_init rc=%d\n", rc); | ||
| 191 | |||
| 192 | return rc; | ||
| 193 | } | ||
| 194 | |||
| 137 | /** | 195 | /** |
| 138 | * tpm_ibmvtpm_send() - Send a TPM command | 196 | * tpm_ibmvtpm_send() - Send a TPM command |
| 139 | * @chip: tpm chip struct | 197 | * @chip: tpm chip struct |
| @@ -147,6 +205,7 @@ static int tpm_ibmvtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count) · 7 unmodified lines | |||
| 147 | static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) | 205 | static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) |
| 148 | { | 206 | { |
| 149 | struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev); | 207 | struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev); |
| 208 | bool retry = true; | ||
| 150 | int rc, sig; | 209 | int rc, sig; |
| 151 | 210 | ||
| 152 | if (!ibmvtpm->rtce_buf) { | 211 | if (!ibmvtpm->rtce_buf) { |
| @@ -180,18 +239,27 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) · 27 unmodified lines | |||
| 180 | */ | 239 | */ |
| 181 | ibmvtpm->tpm_processing_cmd = true; | 240 | ibmvtpm->tpm_processing_cmd = true; |
| 182 | 241 | ||
| 242 | again: | ||
| 183 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, | 243 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, |
| 184 | IBMVTPM_VALID_CMD, VTPM_TPM_COMMAND, | 244 | IBMVTPM_VALID_CMD, VTPM_TPM_COMMAND, |
| 185 | count, ibmvtpm->rtce_dma_handle); | 245 | count, ibmvtpm->rtce_dma_handle); |
| 186 | if (rc != H_SUCCESS) { | 246 | if (rc != H_SUCCESS) { |
| 247 | /* | ||
| 248 | * H_CLOSED can be returned after LPM resume. Call | ||
| 249 | * tpm_ibmvtpm_resume() to re-enable the CRQ then retry | ||
| 250 | * ibmvtpm_send_crq() once before failing. | ||
| 251 | */ | ||
| 252 | if (rc == H_CLOSED && retry) { | ||
| 253 | tpm_ibmvtpm_resume(ibmvtpm->dev); | ||
| 254 | retry = false; | ||
| 255 | goto again; | ||
| 256 | } | ||
| 187 | dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); | 257 | dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); |
| 188 | rc = 0; | ||
| 189 | ibmvtpm->tpm_processing_cmd = false; | 258 | ibmvtpm->tpm_processing_cmd = false; |
| 190 | } else | 259 | } |
| 191 | rc = 0; | ||
| 192 | 260 | ||
| 193 | spin_unlock(&ibmvtpm->rtce_lock); | 261 | spin_unlock(&ibmvtpm->rtce_lock); |
| 194 | return rc; | 262 | return 0; |
| 195 | } | 263 | } |
| 196 | 264 | ||
| 197 | static void tpm_ibmvtpm_cancel(struct tpm_chip *chip) | 265 | static void tpm_ibmvtpm_cancel(struct tpm_chip *chip) |
| @@ -269,26 +337,6 @@ static int ibmvtpm_crq_send_init_complete(struct ibmvtpm_dev *ibmvtpm) · 71 unmodified lines | |||
| 269 | return rc; | 337 | return rc; |
| 270 | } | 338 | } |
| 271 | 339 | ||
| 272 | /** | ||
| 273 | * ibmvtpm_crq_send_init - Send a CRQ initialize message | ||
| 274 | * @ibmvtpm: vtpm device struct | ||
| 275 | * | ||
| 276 | * Return: | ||
| 277 | * 0 on success. | ||
| 278 | * Non-zero on failure. | ||
| 279 | */ | ||
| 280 | static int ibmvtpm_crq_send_init(struct ibmvtpm_dev *ibmvtpm) | ||
| 281 | { | ||
| 282 | int rc; | ||
| 283 | |||
| 284 | rc = ibmvtpm_send_crq_word(ibmvtpm->vdev, INIT_CRQ_CMD); | ||
| 285 | if (rc != H_SUCCESS) | ||
| 286 | dev_err(ibmvtpm->dev, | ||
| 287 | "ibmvtpm_crq_send_init failed rc=%d\n", rc); | ||
| 288 | |||
| 289 | return rc; | ||
| 290 | } | ||
| 291 | |||
| 292 | /** | 340 | /** |
| 293 | * tpm_ibmvtpm_remove - ibm vtpm remove entry point | 341 | * tpm_ibmvtpm_remove - ibm vtpm remove entry point |
| 294 | * @vdev: vio device struct | 342 | * @vdev: vio device struct |
| @@ -401,44 +449,6 @@ static int ibmvtpm_reset_crq(struct ibmvtpm_dev *ibmvtpm) · 106 unmodified lines | |||
| 401 | ibmvtpm->crq_dma_handle, CRQ_RES_BUF_SIZE); | 449 | ibmvtpm->crq_dma_handle, CRQ_RES_BUF_SIZE); |
| 402 | } | 450 | } |
| 403 | 451 | ||
| 404 | /** | ||
| 405 | * tpm_ibmvtpm_resume - Resume from suspend | ||
| 406 | * | ||
| 407 | * @dev: device struct | ||
| 408 | * | ||
| 409 | * Return: Always 0. | ||
| 410 | */ | ||
| 411 | static int tpm_ibmvtpm_resume(struct device *dev) | ||
| 412 | { | ||
| 413 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
| 414 | struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev); | ||
| 415 | int rc = 0; | ||
| 416 | |||
| 417 | do { | ||
| 418 | if (rc) | ||
| 419 | msleep(100); | ||
| 420 | rc = plpar_hcall_norets(H_ENABLE_CRQ, | ||
| 421 | ibmvtpm->vdev->unit_address); | ||
| 422 | } while (rc == H_IN_PROGRESS || rc == H_BUSY || H_IS_LONG_BUSY(rc)); | ||
| 423 | |||
| 424 | if (rc) { | ||
| 425 | dev_err(dev, "Error enabling ibmvtpm rc=%d\n", rc); | ||
| 426 | return rc; | ||
| 427 | } | ||
| 428 | |||
| 429 | rc = vio_enable_interrupts(ibmvtpm->vdev); | ||
| 430 | if (rc) { | ||
| 431 | dev_err(dev, "Error vio_enable_interrupts rc=%d\n", rc); | ||
| 432 | return rc; | ||
| 433 | } | ||
| 434 | |||
| 435 | rc = ibmvtpm_crq_send_init(ibmvtpm); | ||
| 436 | if (rc) | ||
| 437 | dev_err(dev, "Error send_init rc=%d\n", rc); | ||
| 438 | |||
| 439 | return rc; | ||
| 440 | } | ||
| 441 | |||
| 442 | static bool tpm_ibmvtpm_req_canceled(struct tpm_chip *chip, u8 status) | 452 | static bool tpm_ibmvtpm_req_canceled(struct tpm_chip *chip, u8 status) |
| 443 | { | 453 | { |
| 444 | return (status == 0); | 454 | return (status == 0); |
| @@ -433,6 +433,9 @@ static void disable_interrupts(struct tpm_chip *chip) · 432 unmodified lines | |||
| 433 | u32 intmask; | 433 | u32 intmask; |
| 434 | int rc; | 434 | int rc; |
| 435 | 435 | ||
| 436 | if (priv->irq == 0) | ||
| 437 | return; | ||
| 438 | |||
| 436 | rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask); | 439 | rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask); |
| 437 | if (rc < 0) | 440 | if (rc < 0) |
| 438 | intmask = 0; | 441 | intmask = 0; |
| @@ -1062,9 +1065,12 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · 623 unmodified lines | |||
| 1062 | if (irq) { | 1065 | if (irq) { |
| 1063 | tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED, | 1066 | tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED, |
| 1064 | irq); | 1067 | irq); |
| 1065 | if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) | 1068 | if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) { |
| 1066 | dev_err(&chip->dev, FW_BUG | 1069 | dev_err(&chip->dev, FW_BUG |
| 1067 | "TPM interrupt not working, polling instead\n"); | 1070 | "TPM interrupt not working, polling instead\n"); |
| 1071 | |||
| 1072 | disable_interrupts(chip); | ||
| 1073 | } | ||
| 1068 | } else { | 1074 | } else { |
| 1069 | tpm_tis_probe_irq(chip, intmask); | 1075 | tpm_tis_probe_irq(chip, intmask); |
| 1070 | } | 1076 | } |
| @@ -276,7 +276,7 @@ static void __init asm9260_acc_init(struct device_node *np) · 275 unmodified lines | |||
| 276 | 276 | ||
| 277 | /* TODO: Convert to DT parent scheme */ | 277 | /* TODO: Convert to DT parent scheme */ |
| 278 | ref_clk = of_clk_get_parent_name(np, 0); | 278 | ref_clk = of_clk_get_parent_name(np, 0); |
| 279 | hw = __clk_hw_register_fixed_rate_with_accuracy(NULL, NULL, pll_clk, | 279 | hw = __clk_hw_register_fixed_rate(NULL, NULL, pll_clk, |
| 280 | ref_clk, NULL, NULL, 0, rate, 0, | 280 | ref_clk, NULL, NULL, 0, rate, 0, |
| 281 | CLK_FIXED_RATE_PARENT_ACCURACY); | 281 | CLK_FIXED_RATE_PARENT_ACCURACY); |
| 282 | 282 | ||
| @@ -97,7 +97,7 @@ static const struct clk_ops mmp_clk_pll_ops = { · 96 unmodified lines | |||
| 97 | .recalc_rate = mmp_clk_pll_recalc_rate, | 97 | .recalc_rate = mmp_clk_pll_recalc_rate, |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | struct clk *mmp_clk_register_pll(char *name, | 100 | static struct clk *mmp_clk_register_pll(char *name, |
| 101 | unsigned long default_rate, | 101 | unsigned long default_rate, |
| 102 | void __iomem *enable_reg, u32 enable, | 102 | void __iomem *enable_reg, u32 enable, |
| 103 | void __iomem *reg, u8 shift, | 103 | void __iomem *reg, u8 shift, |
| @@ -137,3 +137,34 @@ struct clk *mmp_clk_register_pll(char *name, · 33 unmodified lines | |||
| 137 | 137 | ||
| 138 | return clk; | 138 | return clk; |
| 139 | } | 139 | } |
| 140 | |||
| 141 | void mmp_register_pll_clks(struct mmp_clk_unit *unit, | ||
| 142 | struct mmp_param_pll_clk *clks, | ||
| 143 | void __iomem *base, int size) | ||
| 144 | { | ||
| 145 | struct clk *clk; | ||
| 146 | int i; | ||
| 147 | |||
| 148 | for (i = 0; i < size; i++) { | ||
| 149 | void __iomem *reg = NULL; | ||
| 150 | |||
| 151 | if (clks[i].offset) | ||
| 152 | reg = base + clks[i].offset; | ||
| 153 | |||
| 154 | clk = mmp_clk_register_pll(clks[i].name, | ||
| 155 | clks[i].default_rate, | ||
| 156 | base + clks[i].enable_offset, | ||
| 157 | clks[i].enable, | ||
| 158 | reg, clks[i].shift, | ||
| 159 | clks[i].input_rate, | ||
| 160 | base + clks[i].postdiv_offset, | ||
| 161 | clks[i].postdiv_shift); | ||
| 162 | if (IS_ERR(clk)) { | ||
| 163 | pr_err("%s: failed to register clock %s\n", | ||
| 164 | __func__, clks[i].name); | ||
| 165 | continue; | ||
| 166 | } | ||
| 167 | if (clks[i].id) | ||
| 168 | unit->clk_table[clks[i].id] = clk; | ||
| 169 | } | ||
| 170 | } | ||
| @@ -176,37 +176,6 @@ void mmp_register_div_clks(struct mmp_clk_unit *unit, · 175 unmodified lines | |||
| 176 | } | 176 | } |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | void mmp_register_pll_clks(struct mmp_clk_unit *unit, | ||
| 180 | struct mmp_param_pll_clk *clks, | ||
| 181 | void __iomem *base, int size) | ||
| 182 | { | ||
| 183 | struct clk *clk; | ||
| 184 | int i; | ||
| 185 | |||
| 186 | for (i = 0; i < size; i++) { | ||
| 187 | void __iomem *reg = NULL; | ||
| 188 | |||
| 189 | if (clks[i].offset) | ||
| 190 | reg = base + clks[i].offset; | ||
| 191 | |||
| 192 | clk = mmp_clk_register_pll(clks[i].name, | ||
| 193 | clks[i].default_rate, | ||
| 194 | base + clks[i].enable_offset, | ||
| 195 | clks[i].enable, | ||
| 196 | reg, clks[i].shift, | ||
| 197 | clks[i].input_rate, | ||
| 198 | base + clks[i].postdiv_offset, | ||
| 199 | clks[i].postdiv_shift); | ||
| 200 | if (IS_ERR(clk)) { | ||
| 201 | pr_err("%s: failed to register clock %s\n", | ||
| 202 | __func__, clks[i].name); | ||
| 203 | continue; | ||
| 204 | } | ||
| 205 | if (clks[i].id) | ||
| 206 | unit->clk_table[clks[i].id] = clk; | ||
| 207 | } | ||
| 208 | } | ||
| 209 | |||
| 210 | void mmp_clk_add(struct mmp_clk_unit *unit, unsigned int id, | 179 | void mmp_clk_add(struct mmp_clk_unit *unit, unsigned int id, |
| 211 | struct clk *clk) | 180 | struct clk *clk) |
| 212 | { | 181 | { |
| @@ -238,13 +238,6 @@ void mmp_register_pll_clks(struct mmp_clk_unit *unit, · 237 unmodified lines | |||
| 238 | struct mmp_param_pll_clk *clks, | 238 | struct mmp_param_pll_clk *clks, |
| 239 | void __iomem *base, int size); | 239 | void __iomem *base, int size); |
| 240 | 240 | ||
| 241 | extern struct clk *mmp_clk_register_pll(char *name, | ||
| 242 | unsigned long default_rate, | ||
| 243 | void __iomem *enable_reg, u32 enable, | ||
| 244 | void __iomem *reg, u8 shift, | ||
| 245 | unsigned long input_rate, | ||
| 246 | void __iomem *postdiv_reg, u8 postdiv_shift); | ||
| 247 | |||
| 248 | #define DEFINE_MIX_REG_INFO(w_d, s_d, w_m, s_m, fc) \ | 241 | #define DEFINE_MIX_REG_INFO(w_d, s_d, w_m, s_m, fc) \ |
| 249 | { \ | 242 | { \ |
| 250 | .width_div = (w_d), \ | 243 | .width_div = (w_d), \ |
| @@ -1641,8 +1641,9 @@ static SPRD_SC_GATE_CLK_FW_NAME(i2c4_eb, "i2c4-eb", "ext-26m", 0x0, · 1640 unmodified lines | |||
| 1641 | 0x1000, BIT(12), 0, 0); | 1641 | 0x1000, BIT(12), 0, 0); |
| 1642 | static SPRD_SC_GATE_CLK_FW_NAME(uart0_eb, "uart0-eb", "ext-26m", 0x0, | 1642 | static SPRD_SC_GATE_CLK_FW_NAME(uart0_eb, "uart0-eb", "ext-26m", 0x0, |
| 1643 | 0x1000, BIT(13), 0, 0); | 1643 | 0x1000, BIT(13), 0, 0); |
| 1644 | /* uart1_eb is for console, don't gate even if unused */ | ||
| 1644 | static SPRD_SC_GATE_CLK_FW_NAME(uart1_eb, "uart1-eb", "ext-26m", 0x0, | 1645 | static SPRD_SC_GATE_CLK_FW_NAME(uart1_eb, "uart1-eb", "ext-26m", 0x0, |
| 1645 | 0x1000, BIT(14), 0, 0); | 1646 | 0x1000, BIT(14), CLK_IGNORE_UNUSED, 0); |
| 1646 | static SPRD_SC_GATE_CLK_FW_NAME(uart2_eb, "uart2-eb", "ext-26m", 0x0, | 1647 | static SPRD_SC_GATE_CLK_FW_NAME(uart2_eb, "uart2-eb", "ext-26m", 0x0, |
| 1647 | 0x1000, BIT(15), 0, 0); | 1648 | 0x1000, BIT(15), 0, 0); |
| 1648 | static SPRD_SC_GATE_CLK_FW_NAME(uart3_eb, "uart3-eb", "ext-26m", 0x0, | 1649 | static SPRD_SC_GATE_CLK_FW_NAME(uart3_eb, "uart3-eb", "ext-26m", 0x0, |
| @@ -44,6 +44,7 @@ MODULE_PARM_DESC(base, "ACCES 104-QUAD-8 base addresses"); · 43 unmodified lines | |||
| 44 | * @base: base port address of the IIO device | 44 | * @base: base port address of the IIO device |
| 45 | */ | 45 | */ |
| 46 | struct quad8_iio { | 46 | struct quad8_iio { |
| 47 | struct mutex lock; | ||
| 47 | struct counter_device counter; | 48 | struct counter_device counter; |
| 48 | unsigned int fck_prescaler[QUAD8_NUM_COUNTERS]; | 49 | unsigned int fck_prescaler[QUAD8_NUM_COUNTERS]; |
| 49 | unsigned int preset[QUAD8_NUM_COUNTERS]; | 50 | unsigned int preset[QUAD8_NUM_COUNTERS]; |
| @@ -123,6 +124,8 @@ static int quad8_read_raw(struct iio_dev *indio_dev, · 73 unmodified lines | |||
| 123 | /* Borrow XOR Carry effectively doubles count range */ | 124 | /* Borrow XOR Carry effectively doubles count range */ |
| 124 | *val = (borrow ^ carry) << 24; | 125 | *val = (borrow ^ carry) << 24; |
| 125 | 126 | ||
| 127 | mutex_lock(&priv->lock); | ||
| 128 | |||
| 126 | /* Reset Byte Pointer; transfer Counter to Output Latch */ | 129 | /* Reset Byte Pointer; transfer Counter to Output Latch */ |
| 127 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_CNTR_OUT, | 130 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_CNTR_OUT, |
| 128 | base_offset + 1); | 131 | base_offset + 1); |
| @@ -130,6 +133,8 @@ static int quad8_read_raw(struct iio_dev *indio_dev, · 1 unmodified line | |||
| 130 | for (i = 0; i < 3; i++) | 133 | for (i = 0; i < 3; i++) |
| 131 | *val |= (unsigned int)inb(base_offset) << (8 * i); | 134 | *val |= (unsigned int)inb(base_offset) << (8 * i); |
| 132 | 135 | ||
| 136 | mutex_unlock(&priv->lock); | ||
| 137 | |||
| 133 | return IIO_VAL_INT; | 138 | return IIO_VAL_INT; |
| 134 | case IIO_CHAN_INFO_ENABLE: | 139 | case IIO_CHAN_INFO_ENABLE: |
| 135 | *val = priv->ab_enable[chan->channel]; | 140 | *val = priv->ab_enable[chan->channel]; |
| @@ -160,6 +165,8 @@ static int quad8_write_raw(struct iio_dev *indio_dev, · 24 unmodified lines | |||
| 160 | if ((unsigned int)val > 0xFFFFFF) | 165 | if ((unsigned int)val > 0xFFFFFF) |
| 161 | return -EINVAL; | 166 | return -EINVAL; |
| 162 | 167 | ||
| 168 | mutex_lock(&priv->lock); | ||
| 169 | |||
| 163 | /* Reset Byte Pointer */ | 170 | /* Reset Byte Pointer */ |
| 164 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); | 171 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); |
| 165 | 172 | ||
| @@ -183,12 +190,16 @@ static int quad8_write_raw(struct iio_dev *indio_dev, · 17 unmodified lines | |||
| 183 | /* Reset Error flag */ | 190 | /* Reset Error flag */ |
| 184 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1); | 191 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1); |
| 185 | 192 | ||
| 193 | mutex_unlock(&priv->lock); | ||
| 194 | |||
| 186 | return 0; | 195 | return 0; |
| 187 | case IIO_CHAN_INFO_ENABLE: | 196 | case IIO_CHAN_INFO_ENABLE: |
| 188 | /* only boolean values accepted */ | 197 | /* only boolean values accepted */ |
| 189 | if (val < 0 || val > 1) | 198 | if (val < 0 || val > 1) |
| 190 | return -EINVAL; | 199 | return -EINVAL; |
| 191 | 200 | ||
| 201 | mutex_lock(&priv->lock); | ||
| 202 | |||
| 192 | priv->ab_enable[chan->channel] = val; | 203 | priv->ab_enable[chan->channel] = val; |
| 193 | 204 | ||
| 194 | ior_cfg = val | priv->preset_enable[chan->channel] << 1; | 205 | ior_cfg = val | priv->preset_enable[chan->channel] << 1; |
| @@ -196,11 +207,18 @@ static int quad8_write_raw(struct iio_dev *indio_dev, · 1 unmodified line | |||
| 196 | /* Load I/O control configuration */ | 207 | /* Load I/O control configuration */ |
| 197 | outb(QUAD8_CTR_IOR | ior_cfg, base_offset + 1); | 208 | outb(QUAD8_CTR_IOR | ior_cfg, base_offset + 1); |
| 198 | 209 | ||
| 210 | mutex_unlock(&priv->lock); | ||
| 211 | |||
| 199 | return 0; | 212 | return 0; |
| 200 | case IIO_CHAN_INFO_SCALE: | 213 | case IIO_CHAN_INFO_SCALE: |
| 214 | mutex_lock(&priv->lock); | ||
| 215 | |||
| 201 | /* Quadrature scaling only available in quadrature mode */ | 216 | /* Quadrature scaling only available in quadrature mode */ |
| 202 | if (!priv->quadrature_mode[chan->channel] && (val2 || val != 1)) | 217 | if (!priv->quadrature_mode[chan->channel] && |
| 218 | (val2 || val != 1)) { | ||
| 219 | mutex_unlock(&priv->lock); | ||
| 203 | return -EINVAL; | 220 | return -EINVAL; |
| 221 | } | ||
| 204 | 222 | ||
| 205 | /* Only three gain states (1, 0.5, 0.25) */ | 223 | /* Only three gain states (1, 0.5, 0.25) */ |
| 206 | if (val == 1 && !val2) | 224 | if (val == 1 && !val2) |
| @@ -214,11 +232,15 @@ static int quad8_write_raw(struct iio_dev *indio_dev, · 7 unmodified lines | |||
| 214 | priv->quadrature_scale[chan->channel] = 2; | 232 | priv->quadrature_scale[chan->channel] = 2; |
| 215 | break; | 233 | break; |
| 216 | default: | 234 | default: |
| 235 | mutex_unlock(&priv->lock); | ||
| 217 | return -EINVAL; | 236 | return -EINVAL; |
| 218 | } | 237 | } |
| 219 | else | 238 | else { |
| 239 | mutex_unlock(&priv->lock); | ||
| 220 | return -EINVAL; | 240 | return -EINVAL; |
| 241 | } | ||
| 221 | 242 | ||
| 243 | mutex_unlock(&priv->lock); | ||
| 222 | return 0; | 244 | return 0; |
| 223 | } | 245 | } |
| 224 | 246 | ||
| @@ -255,6 +277,8 @@ static ssize_t quad8_write_preset(struct iio_dev *indio_dev, uintptr_t private, · 30 unmodified lines | |||
| 255 | if (preset > 0xFFFFFF) | 277 | if (preset > 0xFFFFFF) |
| 256 | return -EINVAL; | 278 | return -EINVAL; |
| 257 | 279 | ||
| 280 | mutex_lock(&priv->lock); | ||
| 281 | |||
| 258 | priv->preset[chan->channel] = preset; | 282 | priv->preset[chan->channel] = preset; |
| 259 | 283 | ||
| 260 | /* Reset Byte Pointer */ | 284 | /* Reset Byte Pointer */ |
| @@ -264,6 +288,8 @@ static ssize_t quad8_write_preset(struct iio_dev *indio_dev, uintptr_t private, · 3 unmodified lines | |||
| 264 | for (i = 0; i < 3; i++) | 288 | for (i = 0; i < 3; i++) |
| 265 | outb(preset >> (8 * i), base_offset); | 289 | outb(preset >> (8 * i), base_offset); |
| 266 | 290 | ||
| 291 | mutex_unlock(&priv->lock); | ||
| 292 | |||
| 267 | return len; | 293 | return len; |
| 268 | } | 294 | } |
| 269 | 295 | ||
| @@ -293,6 +319,8 @@ static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev, · 23 unmodified lines | |||
| 293 | /* Preset enable is active low in Input/Output Control register */ | 319 | /* Preset enable is active low in Input/Output Control register */ |
| 294 | preset_enable = !preset_enable; | 320 | preset_enable = !preset_enable; |
| 295 | 321 | ||
| 322 | mutex_lock(&priv->lock); | ||
| 323 | |||
| 296 | priv->preset_enable[chan->channel] = preset_enable; | 324 | priv->preset_enable[chan->channel] = preset_enable; |
| 297 | 325 | ||
| 298 | ior_cfg = priv->ab_enable[chan->channel] | | 326 | ior_cfg = priv->ab_enable[chan->channel] | |
| @@ -301,6 +329,8 @@ static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev, · 2 unmodified lines | |||
| 301 | /* Load I/O control configuration to Input / Output Control Register */ | 329 | /* Load I/O control configuration to Input / Output Control Register */ |
| 302 | outb(QUAD8_CTR_IOR | ior_cfg, base_offset); | 330 | outb(QUAD8_CTR_IOR | ior_cfg, base_offset); |
| 303 | 331 | ||
| 332 | mutex_unlock(&priv->lock); | ||
| 333 | |||
| 304 | return len; | 334 | return len; |
| 305 | } | 335 | } |
| 306 | 336 | ||
| @@ -358,6 +388,8 @@ static int quad8_set_count_mode(struct iio_dev *indio_dev, · 51 unmodified lines | |||
| 358 | unsigned int mode_cfg = cnt_mode << 1; | 388 | unsigned int mode_cfg = cnt_mode << 1; |
| 359 | const int base_offset = priv->base + 2 * chan->channel + 1; | 389 | const int base_offset = priv->base + 2 * chan->channel + 1; |
| 360 | 390 | ||
| 391 | mutex_lock(&priv->lock); | ||
| 392 | |||
| 361 | priv->count_mode[chan->channel] = cnt_mode; | 393 | priv->count_mode[chan->channel] = cnt_mode; |
| 362 | 394 | ||
| 363 | /* Add quadrature mode configuration */ | 395 | /* Add quadrature mode configuration */ |
| @@ -367,6 +399,8 @@ static int quad8_set_count_mode(struct iio_dev *indio_dev, · 3 unmodified lines | |||
| 367 | /* Load mode configuration to Counter Mode Register */ | 399 | /* Load mode configuration to Counter Mode Register */ |
| 368 | outb(QUAD8_CTR_CMR | mode_cfg, base_offset); | 400 | outb(QUAD8_CTR_CMR | mode_cfg, base_offset); |
| 369 | 401 | ||
| 402 | mutex_unlock(&priv->lock); | ||
| 403 | |||
| 370 | return 0; | 404 | return 0; |
| 371 | } | 405 | } |
| 372 | 406 | ||
| @@ -394,19 +428,26 @@ static int quad8_set_synchronous_mode(struct iio_dev *indio_dev, · 21 unmodified lines | |||
| 394 | const struct iio_chan_spec *chan, unsigned int synchronous_mode) | 428 | const struct iio_chan_spec *chan, unsigned int synchronous_mode) |
| 395 | { | 429 | { |
| 396 | struct quad8_iio *const priv = iio_priv(indio_dev); | 430 | struct quad8_iio *const priv = iio_priv(indio_dev); |
| 397 | const unsigned int idr_cfg = synchronous_mode | | ||
| 398 | priv->index_polarity[chan->channel] << 1; | ||
| 399 | const int base_offset = priv->base + 2 * chan->channel + 1; | 431 | const int base_offset = priv->base + 2 * chan->channel + 1; |
| 432 | unsigned int idr_cfg = synchronous_mode; | ||
| 433 | |||
| 434 | mutex_lock(&priv->lock); | ||
| 435 | |||
| 436 | idr_cfg |= priv->index_polarity[chan->channel] << 1; | ||
| 400 | 437 | ||
| 401 | /* Index function must be non-synchronous in non-quadrature mode */ | 438 | /* Index function must be non-synchronous in non-quadrature mode */ |
| 402 | if (synchronous_mode && !priv->quadrature_mode[chan->channel]) | 439 | if (synchronous_mode && !priv->quadrature_mode[chan->channel]) { |
| 440 | mutex_unlock(&priv->lock); | ||
| 403 | return -EINVAL; | 441 | return -EINVAL; |
| 442 | } | ||
| 404 | 443 | ||
| 405 | priv->synchronous_mode[chan->channel] = synchronous_mode; | 444 | priv->synchronous_mode[chan->channel] = synchronous_mode; |
| 406 | 445 | ||
| 407 | /* Load Index Control configuration to Index Control Register */ | 446 | /* Load Index Control configuration to Index Control Register */ |
| 408 | outb(QUAD8_CTR_IDR | idr_cfg, base_offset); | 447 | outb(QUAD8_CTR_IDR | idr_cfg, base_offset); |
| 409 | 448 | ||
| 449 | mutex_unlock(&priv->lock); | ||
| 450 | |||
| 410 | return 0; | 451 | return 0; |
| 411 | } | 452 | } |
| 412 | 453 | ||
| @@ -434,8 +475,12 @@ static int quad8_set_quadrature_mode(struct iio_dev *indio_dev, · 21 unmodified lines | |||
| 434 | const struct iio_chan_spec *chan, unsigned int quadrature_mode) | 475 | const struct iio_chan_spec *chan, unsigned int quadrature_mode) |
| 435 | { | 476 | { |
| 436 | struct quad8_iio *const priv = iio_priv(indio_dev); | 477 | struct quad8_iio *const priv = iio_priv(indio_dev); |
| 437 | unsigned int mode_cfg = priv->count_mode[chan->channel] << 1; | ||
| 438 | const int base_offset = priv->base + 2 * chan->channel + 1; | 478 | const int base_offset = priv->base + 2 * chan->channel + 1; |
| 479 | unsigned int mode_cfg; | ||
| 480 | |||
| 481 | mutex_lock(&priv->lock); | ||
| 482 | |||
| 483 | mode_cfg = priv->count_mode[chan->channel] << 1; | ||
| 439 | 484 | ||
| 440 | if (quadrature_mode) | 485 | if (quadrature_mode) |
| 441 | mode_cfg |= (priv->quadrature_scale[chan->channel] + 1) << 3; | 486 | mode_cfg |= (priv->quadrature_scale[chan->channel] + 1) << 3; |
| @@ -453,6 +498,8 @@ static int quad8_set_quadrature_mode(struct iio_dev *indio_dev, · 11 unmodified lines | |||
| 453 | /* Load mode configuration to Counter Mode Register */ | 498 | /* Load mode configuration to Counter Mode Register */ |
| 454 | outb(QUAD8_CTR_CMR | mode_cfg, base_offset); | 499 | outb(QUAD8_CTR_CMR | mode_cfg, base_offset); |
| 455 | 500 | ||
| 501 | mutex_unlock(&priv->lock); | ||
| 502 | |||
| 456 | return 0; | 503 | return 0; |
| 457 | } | 504 | } |
| 458 | 505 | ||
| @@ -480,15 +527,20 @@ static int quad8_set_index_polarity(struct iio_dev *indio_dev, · 21 unmodified lines | |||
| 480 | const struct iio_chan_spec *chan, unsigned int index_polarity) | 527 | const struct iio_chan_spec *chan, unsigned int index_polarity) |
| 481 | { | 528 | { |
| 482 | struct quad8_iio *const priv = iio_priv(indio_dev); | 529 | struct quad8_iio *const priv = iio_priv(indio_dev); |
| 483 | const unsigned int idr_cfg = priv->synchronous_mode[chan->channel] | | ||
| 484 | index_polarity << 1; | ||
| 485 | const int base_offset = priv->base + 2 * chan->channel + 1; | 530 | const int base_offset = priv->base + 2 * chan->channel + 1; |
| 531 | unsigned int idr_cfg = index_polarity << 1; | ||
| 532 | |||
| 533 | mutex_lock(&priv->lock); | ||
| 534 | |||
| 535 | idr_cfg |= priv->synchronous_mode[chan->channel]; | ||
| 486 | 536 | ||
| 487 | priv->index_polarity[chan->channel] = index_polarity; | 537 | priv->index_polarity[chan->channel] = index_polarity; |
| 488 | 538 | ||
| 489 | /* Load Index Control configuration to Index Control Register */ | 539 | /* Load Index Control configuration to Index Control Register */ |
| 490 | outb(QUAD8_CTR_IDR | idr_cfg, base_offset); | 540 | outb(QUAD8_CTR_IDR | idr_cfg, base_offset); |
| 491 | 541 | ||
| 542 | mutex_unlock(&priv->lock); | ||
| 543 | |||
| 492 | return 0; | 544 | return 0; |
| 493 | } | 545 | } |
| 494 | 546 | ||
| @@ -589,7 +641,7 @@ static int quad8_signal_read(struct counter_device *counter, · 94 unmodified lines | |||
| 589 | static int quad8_count_read(struct counter_device *counter, | 641 | static int quad8_count_read(struct counter_device *counter, |
| 590 | struct counter_count *count, unsigned long *val) | 642 | struct counter_count *count, unsigned long *val) |
| 591 | { | 643 | { |
| 592 | const struct quad8_iio *const priv = counter->priv; | 644 | struct quad8_iio *const priv = counter->priv; |
| 593 | const int base_offset = priv->base + 2 * count->id; | 645 | const int base_offset = priv->base + 2 * count->id; |
| 594 | unsigned int flags; | 646 | unsigned int flags; |
| 595 | unsigned int borrow; | 647 | unsigned int borrow; |
| @@ -603,6 +655,8 @@ static int quad8_count_read(struct counter_device *counter, · 7 unmodified lines | |||
| 603 | /* Borrow XOR Carry effectively doubles count range */ | 655 | /* Borrow XOR Carry effectively doubles count range */ |
| 604 | *val = (unsigned long)(borrow ^ carry) << 24; | 656 | *val = (unsigned long)(borrow ^ carry) << 24; |
| 605 | 657 | ||
| 658 | mutex_lock(&priv->lock); | ||
| 659 | |||
| 606 | /* Reset Byte Pointer; transfer Counter to Output Latch */ | 660 | /* Reset Byte Pointer; transfer Counter to Output Latch */ |
| 607 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_CNTR_OUT, | 661 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_CNTR_OUT, |
| 608 | base_offset + 1); | 662 | base_offset + 1); |
| @@ -610,13 +664,15 @@ static int quad8_count_read(struct counter_device *counter, · 1 unmodified line | |||
| 610 | for (i = 0; i < 3; i++) | 664 | for (i = 0; i < 3; i++) |
| 611 | *val |= (unsigned long)inb(base_offset) << (8 * i); | 665 | *val |= (unsigned long)inb(base_offset) << (8 * i); |
| 612 | 666 | ||
| 667 | mutex_unlock(&priv->lock); | ||
| 668 | |||
| 613 | return 0; | 669 | return 0; |
| 614 | } | 670 | } |
| 615 | 671 | ||
| 616 | static int quad8_count_write(struct counter_device *counter, | 672 | static int quad8_count_write(struct counter_device *counter, |
| 617 | struct counter_count *count, unsigned long val) | 673 | struct counter_count *count, unsigned long val) |
| 618 | { | 674 | { |
| 619 | const struct quad8_iio *const priv = counter->priv; | 675 | struct quad8_iio *const priv = counter->priv; |
| 620 | const int base_offset = priv->base + 2 * count->id; | 676 | const int base_offset = priv->base + 2 * count->id; |
| 621 | int i; | 677 | int i; |
| 622 | 678 | ||
| @@ -624,6 +680,8 @@ static int quad8_count_write(struct counter_device *counter, · 1 unmodified line | |||
| 624 | if (val > 0xFFFFFF) | 680 | if (val > 0xFFFFFF) |
| 625 | return -EINVAL; | 681 | return -EINVAL; |
| 626 | 682 | ||
| 683 | mutex_lock(&priv->lock); | ||
| 684 | |||
| 627 | /* Reset Byte Pointer */ | 685 | /* Reset Byte Pointer */ |
| 628 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); | 686 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); |
| 629 | 687 | ||
| @@ -647,6 +705,8 @@ static int quad8_count_write(struct counter_device *counter, · 17 unmodified lines | |||
| 647 | /* Reset Error flag */ | 705 | /* Reset Error flag */ |
| 648 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1); | 706 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_E, base_offset + 1); |
| 649 | 707 | ||
| 708 | mutex_unlock(&priv->lock); | ||
| 709 | |||
| 650 | return 0; | 710 | return 0; |
| 651 | } | 711 | } |
| 652 | 712 | ||
| @@ -667,13 +727,13 @@ static enum counter_count_function quad8_count_functions_list[] = { · 14 unmodified lines | |||
| 667 | static int quad8_function_get(struct counter_device *counter, | 727 | static int quad8_function_get(struct counter_device *counter, |
| 668 | struct counter_count *count, size_t *function) | 728 | struct counter_count *count, size_t *function) |
| 669 | { | 729 | { |
| 670 | const struct quad8_iio *const priv = counter->priv; | 730 | struct quad8_iio *const priv = counter->priv; |
| 671 | const int id = count->id; | 731 | const int id = count->id; |
| 672 | const unsigned int quadrature_mode = priv->quadrature_mode[id]; | ||
| 673 | const unsigned int scale = priv->quadrature_scale[id]; | ||
| 674 | 732 | ||
| 675 | if (quadrature_mode) | 733 | mutex_lock(&priv->lock); |
| 676 | switch (scale) { | 734 | |
| 735 | if (priv->quadrature_mode[id]) | ||
| 736 | switch (priv->quadrature_scale[id]) { | ||
| 677 | case 0: | 737 | case 0: |
| 678 | *function = QUAD8_COUNT_FUNCTION_QUADRATURE_X1; | 738 | *function = QUAD8_COUNT_FUNCTION_QUADRATURE_X1; |
| 679 | break; | 739 | break; |
| @@ -687,6 +747,8 @@ static int quad8_function_get(struct counter_device *counter, · 7 unmodified lines | |||
| 687 | else | 747 | else |
| 688 | *function = QUAD8_COUNT_FUNCTION_PULSE_DIRECTION; | 748 | *function = QUAD8_COUNT_FUNCTION_PULSE_DIRECTION; |
| 689 | 749 | ||
| 750 | mutex_unlock(&priv->lock); | ||
| 751 | |||
| 690 | return 0; | 752 | return 0; |
| 691 | } | 753 | } |
| 692 | 754 | ||
| @@ -697,10 +759,15 @@ static int quad8_function_set(struct counter_device *counter, · 4 unmodified lines | |||
| 697 | const int id = count->id; | 759 | const int id = count->id; |
| 698 | unsigned int *const quadrature_mode = priv->quadrature_mode + id; | 760 | unsigned int *const quadrature_mode = priv->quadrature_mode + id; |
| 699 | unsigned int *const scale = priv->quadrature_scale + id; | 761 | unsigned int *const scale = priv->quadrature_scale + id; |
| 700 | unsigned int mode_cfg = priv->count_mode[id] << 1; | ||
| 701 | unsigned int *const synchronous_mode = priv->synchronous_mode + id; | 762 | unsigned int *const synchronous_mode = priv->synchronous_mode + id; |
| 702 | const unsigned int idr_cfg = priv->index_polarity[id] << 1; | ||
| 703 | const int base_offset = priv->base + 2 * id + 1; | 763 | const int base_offset = priv->base + 2 * id + 1; |
| 764 | unsigned int mode_cfg; | ||
| 765 | unsigned int idr_cfg; | ||
| 766 | |||
| 767 | mutex_lock(&priv->lock); | ||
| 768 | |||
| 769 | mode_cfg = priv->count_mode[id] << 1; | ||
| 770 | idr_cfg = priv->index_polarity[id] << 1; | ||
| 704 | 771 | ||
| 705 | if (function == QUAD8_COUNT_FUNCTION_PULSE_DIRECTION) { | 772 | if (function == QUAD8_COUNT_FUNCTION_PULSE_DIRECTION) { |
| 706 | *quadrature_mode = 0; | 773 | *quadrature_mode = 0; |
| @@ -736,6 +803,8 @@ static int quad8_function_set(struct counter_device *counter, · 29 unmodified lines | |||
| 736 | /* Load mode configuration to Counter Mode Register */ | 803 | /* Load mode configuration to Counter Mode Register */ |
| 737 | outb(QUAD8_CTR_CMR | mode_cfg, base_offset); | 804 | outb(QUAD8_CTR_CMR | mode_cfg, base_offset); |
| 738 | 805 | ||
| 806 | mutex_unlock(&priv->lock); | ||
| 807 | |||
| 739 | return 0; | 808 | return 0; |
| 740 | } | 809 | } |
| 741 | 810 | ||
| @@ -852,15 +921,20 @@ static int quad8_index_polarity_set(struct counter_device *counter, · 110 unmodified lines | |||
| 852 | { | 921 | { |
| 853 | struct quad8_iio *const priv = counter->priv; | 922 | struct quad8_iio *const priv = counter->priv; |
| 854 | const size_t channel_id = signal->id - 16; | 923 | const size_t channel_id = signal->id - 16; |
| 855 | const unsigned int idr_cfg = priv->synchronous_mode[channel_id] | | ||
| 856 | index_polarity << 1; | ||
| 857 | const int base_offset = priv->base + 2 * channel_id + 1; | 924 | const int base_offset = priv->base + 2 * channel_id + 1; |
| 925 | unsigned int idr_cfg = index_polarity << 1; | ||
| 926 | |||
| 927 | mutex_lock(&priv->lock); | ||
| 928 | |||
| 929 | idr_cfg |= priv->synchronous_mode[channel_id]; | ||
| 858 | 930 | ||
| 859 | priv->index_polarity[channel_id] = index_polarity; | 931 | priv->index_polarity[channel_id] = index_polarity; |
| 860 | 932 | ||
| 861 | /* Load Index Control configuration to Index Control Register */ | 933 | /* Load Index Control configuration to Index Control Register */ |
| 862 | outb(QUAD8_CTR_IDR | idr_cfg, base_offset); | 934 | outb(QUAD8_CTR_IDR | idr_cfg, base_offset); |
| 863 | 935 | ||
| 936 | mutex_unlock(&priv->lock); | ||
| 937 | |||
| 864 | return 0; | 938 | return 0; |
| 865 | } | 939 | } |
| 866 | 940 | ||
| @@ -887,19 +961,26 @@ static int quad8_synchronous_mode_set(struct counter_device *counter, · 20 unmodified lines | |||
| 887 | { | 961 | { |
| 888 | struct quad8_iio *const priv = counter->priv; | 962 | struct quad8_iio *const priv = counter->priv; |
| 889 | const size_t channel_id = signal->id - 16; | 963 | const size_t channel_id = signal->id - 16; |
| 890 | const unsigned int idr_cfg = synchronous_mode | | ||
| 891 | priv->index_polarity[channel_id] << 1; | ||
| 892 | const int base_offset = priv->base + 2 * channel_id + 1; | 964 | const int base_offset = priv->base + 2 * channel_id + 1; |
| 965 | unsigned int idr_cfg = synchronous_mode; | ||
| 966 | |||
| 967 | mutex_lock(&priv->lock); | ||
| 968 | |||
| 969 | idr_cfg |= priv->index_polarity[channel_id] << 1; | ||
| 893 | 970 | ||
| 894 | /* Index function must be non-synchronous in non-quadrature mode */ | 971 | /* Index function must be non-synchronous in non-quadrature mode */ |
| 895 | if (synchronous_mode && !priv->quadrature_mode[channel_id]) | 972 | if (synchronous_mode && !priv->quadrature_mode[channel_id]) { |
| 973 | mutex_unlock(&priv->lock); | ||
| 896 | return -EINVAL; | 974 | return -EINVAL; |
| 975 | } | ||
| 897 | 976 | ||
| 898 | priv->synchronous_mode[channel_id] = synchronous_mode; | 977 | priv->synchronous_mode[channel_id] = synchronous_mode; |
| 899 | 978 | ||
| 900 | /* Load Index Control configuration to Index Control Register */ | 979 | /* Load Index Control configuration to Index Control Register */ |
| 901 | outb(QUAD8_CTR_IDR | idr_cfg, base_offset); | 980 | outb(QUAD8_CTR_IDR | idr_cfg, base_offset); |
| 902 | 981 | ||
| 982 | mutex_unlock(&priv->lock); | ||
| 983 | |||
| 903 | return 0; | 984 | return 0; |
| 904 | } | 985 | } |
| 905 | 986 | ||
| @@ -964,6 +1045,8 @@ static int quad8_count_mode_set(struct counter_device *counter, · 58 unmodified lines | |||
| 964 | break; | 1045 | break; |
| 965 | } | 1046 | } |
| 966 | 1047 | ||
| 1048 | mutex_lock(&priv->lock); | ||
| 1049 | |||
| 967 | priv->count_mode[count->id] = cnt_mode; | 1050 | priv->count_mode[count->id] = cnt_mode; |
| 968 | 1051 | ||
| 969 | /* Set count mode configuration value */ | 1052 | /* Set count mode configuration value */ |
| @@ -976,6 +1059,8 @@ static int quad8_count_mode_set(struct counter_device *counter, · 6 unmodified lines | |||
| 976 | /* Load mode configuration to Counter Mode Register */ | 1059 | /* Load mode configuration to Counter Mode Register */ |
| 977 | outb(QUAD8_CTR_CMR | mode_cfg, base_offset); | 1060 | outb(QUAD8_CTR_CMR | mode_cfg, base_offset); |
| 978 | 1061 | ||
| 1062 | mutex_unlock(&priv->lock); | ||
| 1063 | |||
| 979 | return 0; | 1064 | return 0; |
| 980 | } | 1065 | } |
| 981 | 1066 | ||
| @@ -1017,6 +1102,8 @@ static ssize_t quad8_count_enable_write(struct counter_device *counter, · 35 unmodified lines | |||
| 1017 | if (err) | 1102 | if (err) |
| 1018 | return err; | 1103 | return err; |
| 1019 | 1104 | ||
| 1105 | mutex_lock(&priv->lock); | ||
| 1106 | |||
| 1020 | priv->ab_enable[count->id] = ab_enable; | 1107 | priv->ab_enable[count->id] = ab_enable; |
| 1021 | 1108 | ||
| 1022 | ior_cfg = ab_enable | priv->preset_enable[count->id] << 1; | 1109 | ior_cfg = ab_enable | priv->preset_enable[count->id] << 1; |
| @@ -1024,6 +1111,8 @@ static ssize_t quad8_count_enable_write(struct counter_device *counter, · 1 unmodified line | |||
| 1024 | /* Load I/O control configuration */ | 1111 | /* Load I/O control configuration */ |
| 1025 | outb(QUAD8_CTR_IOR | ior_cfg, base_offset + 1); | 1112 | outb(QUAD8_CTR_IOR | ior_cfg, base_offset + 1); |
| 1026 | 1113 | ||
| 1114 | mutex_unlock(&priv->lock); | ||
| 1115 | |||
| 1027 | return len; | 1116 | return len; |
| 1028 | } | 1117 | } |
| 1029 | 1118 | ||
| @@ -1052,14 +1141,28 @@ static ssize_t quad8_count_preset_read(struct counter_device *counter, · 22 unmodified lines | |||
| 1052 | return sprintf(buf, "%u\n", priv->preset[count->id]); | 1141 | return sprintf(buf, "%u\n", priv->preset[count->id]); |
| 1053 | } | 1142 | } |
| 1054 | 1143 | ||
| 1144 | static void quad8_preset_register_set(struct quad8_iio *quad8iio, int id, | ||
| 1145 | unsigned int preset) | ||
| 1146 | { | ||
| 1147 | const unsigned int base_offset = quad8iio->base + 2 * id; | ||
| 1148 | int i; | ||
| 1149 | |||
| 1150 | quad8iio->preset[id] = preset; | ||
| 1151 | |||
| 1152 | /* Reset Byte Pointer */ | ||
| 1153 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); | ||
| 1154 | |||
| 1155 | /* Set Preset Register */ | ||
| 1156 | for (i = 0; i < 3; i++) | ||
| 1157 | outb(preset >> (8 * i), base_offset); | ||
| 1158 | } | ||
| 1159 | |||
| 1055 | static ssize_t quad8_count_preset_write(struct counter_device *counter, | 1160 | static ssize_t quad8_count_preset_write(struct counter_device *counter, |
| 1056 | struct counter_count *count, void *private, const char *buf, size_t len) | 1161 | struct counter_count *count, void *private, const char *buf, size_t len) |
| 1057 | { | 1162 | { |
| 1058 | struct quad8_iio *const priv = counter->priv; | 1163 | struct quad8_iio *const priv = counter->priv; |
| 1059 | const int base_offset = priv->base + 2 * count->id; | ||
| 1060 | unsigned int preset; | 1164 | unsigned int preset; |
| 1061 | int ret; | 1165 | int ret; |
| 1062 | int i; | ||
| 1063 | 1166 | ||
| 1064 | ret = kstrtouint(buf, 0, &preset); | 1167 | ret = kstrtouint(buf, 0, &preset); |
| 1065 | if (ret) | 1168 | if (ret) |
| @@ -1069,14 +1172,11 @@ static ssize_t quad8_count_preset_write(struct counter_device *counter, · 3 unmodified lines | |||
| 1069 | if (preset > 0xFFFFFF) | 1172 | if (preset > 0xFFFFFF) |
| 1070 | return -EINVAL; | 1173 | return -EINVAL; |
| 1071 | 1174 | ||
| 1072 | priv->preset[count->id] = preset; | 1175 | mutex_lock(&priv->lock); |
| 1073 | 1176 | ||
| 1074 | /* Reset Byte Pointer */ | 1177 | quad8_preset_register_set(priv, count->id, preset); |
| 1075 | outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP, base_offset + 1); | ||
| 1076 | 1178 | ||
| 1077 | /* Set Preset Register */ | 1179 | mutex_unlock(&priv->lock); |
| 1078 | for (i = 0; i < 3; i++) | ||
| 1079 | outb(preset >> (8 * i), base_offset); | ||
| 1080 | 1180 | ||
| 1081 | return len; | 1181 | return len; |
| 1082 | } | 1182 | } |
| @@ -1084,15 +1184,20 @@ static ssize_t quad8_count_preset_write(struct counter_device *counter, · 1 unmodified line | |||
| 1084 | static ssize_t quad8_count_ceiling_read(struct counter_device *counter, | 1184 | static ssize_t quad8_count_ceiling_read(struct counter_device *counter, |
| 1085 | struct counter_count *count, void *private, char *buf) | 1185 | struct counter_count *count, void *private, char *buf) |
| 1086 | { | 1186 | { |
| 1087 | const struct quad8_iio *const priv = counter->priv; | 1187 | struct quad8_iio *const priv = counter->priv; |
| 1188 | |||
| 1189 | mutex_lock(&priv->lock); | ||
| 1088 | 1190 | ||
| 1089 | /* Range Limit and Modulo-N count modes use preset value as ceiling */ | 1191 | /* Range Limit and Modulo-N count modes use preset value as ceiling */ |
| 1090 | switch (priv->count_mode[count->id]) { | 1192 | switch (priv->count_mode[count->id]) { |
| 1091 | case 1: | 1193 | case 1: |
| 1092 | case 3: | 1194 | case 3: |
| 1093 | return quad8_count_preset_read(counter, count, private, buf); | 1195 | mutex_unlock(&priv->lock); |
| 1196 | return sprintf(buf, "%u\n", priv->preset[count->id]); | ||
| 1094 | } | 1197 | } |
| 1095 | 1198 | ||
| 1199 | mutex_unlock(&priv->lock); | ||
| 1200 | |||
| 1096 | /* By default 0x1FFFFFF (25 bits unsigned) is maximum count */ | 1201 | /* By default 0x1FFFFFF (25 bits unsigned) is maximum count */ |
| 1097 | return sprintf(buf, "33554431\n"); | 1202 | return sprintf(buf, "33554431\n"); |
| 1098 | } | 1203 | } |
| @@ -1101,15 +1206,29 @@ static ssize_t quad8_count_ceiling_write(struct counter_device *counter, · 2 unmodified lines | |||
| 1101 | struct counter_count *count, void *private, const char *buf, size_t len) | 1206 | struct counter_count *count, void *private, const char *buf, size_t len) |
| 1102 | { | 1207 | { |
| 1103 | struct quad8_iio *const priv = counter->priv; | 1208 | struct quad8_iio *const priv = counter->priv; |
| 1209 | unsigned int ceiling; | ||
| 1210 | int ret; | ||
| 1211 | |||
| 1212 | ret = kstrtouint(buf, 0, &ceiling); | ||
| 1213 | if (ret) | ||
| 1214 | return ret; | ||
| 1215 | |||
| 1216 | /* Only 24-bit values are supported */ | ||
| 1217 | if (ceiling > 0xFFFFFF) | ||
| 1218 | return -EINVAL; | ||
| 1219 | |||
| 1220 | mutex_lock(&priv->lock); | ||
| 1104 | 1221 | ||
| 1105 | /* Range Limit and Modulo-N count modes use preset value as ceiling */ | 1222 | /* Range Limit and Modulo-N count modes use preset value as ceiling */ |
| 1106 | switch (priv->count_mode[count->id]) { | 1223 | switch (priv->count_mode[count->id]) { |
| 1107 | case 1: | 1224 | case 1: |
| 1108 | case 3: | 1225 | case 3: |
| 1109 | return quad8_count_preset_write(counter, count, private, buf, | 1226 | quad8_preset_register_set(priv, count->id, ceiling); |
| 1110 | len); | 1227 | break; |
| 1111 | } | 1228 | } |
| 1112 | 1229 | ||
| 1230 | mutex_unlock(&priv->lock); | ||
| 1231 | |||
| 1113 | return len; | 1232 | return len; |
| 1114 | } | 1233 | } |
| 1115 | 1234 | ||
| @@ -1137,6 +1256,8 @@ static ssize_t quad8_count_preset_enable_write(struct counter_device *counter, · 21 unmodified lines | |||
| 1137 | /* Preset enable is active low in Input/Output Control register */ | 1256 | /* Preset enable is active low in Input/Output Control register */ |
| 1138 | preset_enable = !preset_enable; | 1257 | preset_enable = !preset_enable; |
| 1139 | 1258 | ||
| 1259 | mutex_lock(&priv->lock); | ||
| 1260 | |||
| 1140 | priv->preset_enable[count->id] = preset_enable; | 1261 | priv->preset_enable[count->id] = preset_enable; |
| 1141 | 1262 | ||
| 1142 | ior_cfg = priv->ab_enable[count->id] | (unsigned int)preset_enable << 1; | 1263 | ior_cfg = priv->ab_enable[count->id] | (unsigned int)preset_enable << 1; |
| @@ -1144,6 +1265,8 @@ static ssize_t quad8_count_preset_enable_write(struct counter_device *counter, · 1 unmodified line | |||
| 1144 | /* Load I/O control configuration to Input / Output Control Register */ | 1265 | /* Load I/O control configuration to Input / Output Control Register */ |
| 1145 | outb(QUAD8_CTR_IOR | ior_cfg, base_offset); | 1266 | outb(QUAD8_CTR_IOR | ior_cfg, base_offset); |
| 1146 | 1267 | ||
| 1268 | mutex_unlock(&priv->lock); | ||
| 1269 | |||
| 1147 | return len; | 1270 | return len; |
| 1148 | } | 1271 | } |
| 1149 | 1272 | ||
| @@ -1429,6 +1552,9 @@ static int quad8_probe(struct device *dev, unsigned int id) · 279 unmodified lines | |||
| 1429 | quad8iio->counter.priv = quad8iio; | 1552 | quad8iio->counter.priv = quad8iio; |
| 1430 | quad8iio->base = base[id]; | 1553 | quad8iio->base = base[id]; |
| 1431 | 1554 | ||
| 1555 | /* Initialize mutex */ | ||
| 1556 | mutex_init(&quad8iio->lock); | ||
| 1557 | |||
| 1432 | /* Reset all counters and disable interrupt function */ | 1558 | /* Reset all counters and disable interrupt function */ |
| 1433 | outb(QUAD8_CHAN_OP_RESET_COUNTERS, base[id] + QUAD8_REG_CHAN_OP); | 1559 | outb(QUAD8_CHAN_OP_RESET_COUNTERS, base[id] + QUAD8_REG_CHAN_OP); |
| 1434 | /* Set initial configuration for all counters */ | 1560 | /* Set initial configuration for all counters */ |
| @@ -120,12 +120,10 @@ out: · 119 unmodified lines | |||
| 120 | static int chcr_ktls_update_connection_state(struct chcr_ktls_info *tx_info, | 120 | static int chcr_ktls_update_connection_state(struct chcr_ktls_info *tx_info, |
| 121 | int new_state) | 121 | int new_state) |
| 122 | { | 122 | { |
| 123 | unsigned long flags; | ||
| 124 | |||
| 125 | /* This function can be called from both rx (interrupt context) and tx | 123 | /* This function can be called from both rx (interrupt context) and tx |
| 126 | * queue contexts. | 124 | * queue contexts. |
| 127 | */ | 125 | */ |
| 128 | spin_lock_irqsave(&tx_info->lock, flags); | 126 | spin_lock_bh(&tx_info->lock); |
| 129 | switch (tx_info->connection_state) { | 127 | switch (tx_info->connection_state) { |
| 130 | case KTLS_CONN_CLOSED: | 128 | case KTLS_CONN_CLOSED: |
| 131 | tx_info->connection_state = new_state; | 129 | tx_info->connection_state = new_state; |
| @@ -169,7 +167,7 @@ static int chcr_ktls_update_connection_state(struct chcr_ktls_info *tx_info, · 37 unmodified lines | |||
| 169 | pr_err("unknown KTLS connection state\n"); | 167 | pr_err("unknown KTLS connection state\n"); |
| 170 | break; | 168 | break; |
| 171 | } | 169 | } |
| 172 | spin_unlock_irqrestore(&tx_info->lock, flags); | 170 | spin_unlock_bh(&tx_info->lock); |
| 173 | 171 | ||
| 174 | return tx_info->connection_state; | 172 | return tx_info->connection_state; |
| 175 | } | 173 | } |
| @@ -101,7 +101,7 @@ void cper_print_bits(const char *pfx, unsigned int bits, · 100 unmodified lines | |||
| 101 | if (!len) | 101 | if (!len) |
| 102 | len = snprintf(buf, sizeof(buf), "%s%s", pfx, str); | 102 | len = snprintf(buf, sizeof(buf), "%s%s", pfx, str); |
| 103 | else | 103 | else |
| 104 | len += snprintf(buf+len, sizeof(buf)-len, ", %s", str); | 104 | len += scnprintf(buf+len, sizeof(buf)-len, ", %s", str); |
| 105 | } | 105 | } |
| 106 | if (len) | 106 | if (len) |
| 107 | printk("%s\n", buf); | 107 | printk("%s\n", buf); |
| @@ -25,7 +25,7 @@ · 24 unmodified lines | |||
| 25 | #define EFI_ALLOC_ALIGN EFI_PAGE_SIZE | 25 | #define EFI_ALLOC_ALIGN EFI_PAGE_SIZE |
| 26 | #endif | 26 | #endif |
| 27 | 27 | ||
| 28 | #ifdef CONFIG_ARM | 28 | #if defined(CONFIG_ARM) || defined(CONFIG_X86) |
| 29 | #define __efistub_global __section(.data) | 29 | #define __efistub_global __section(.data) |
| 30 | #else | 30 | #else |
| 31 | #define __efistub_global | 31 | #define __efistub_global |
| @@ -29,30 +29,31 @@ · 28 unmodified lines | |||
| 29 | */ | 29 | */ |
| 30 | #define EFI_READ_CHUNK_SIZE SZ_1M | 30 | #define EFI_READ_CHUNK_SIZE SZ_1M |
| 31 | 31 | ||
| 32 | struct finfo { | ||
| 33 | efi_file_info_t info; | ||
| 34 | efi_char16_t filename[MAX_FILENAME_SIZE]; | ||
| 35 | }; | ||
| 36 | |||
| 32 | static efi_status_t efi_open_file(efi_file_protocol_t *volume, | 37 | static efi_status_t efi_open_file(efi_file_protocol_t *volume, |
| 33 | efi_char16_t *filename_16, | 38 | struct finfo *fi, |
| 34 | efi_file_protocol_t **handle, | 39 | efi_file_protocol_t **handle, |
| 35 | unsigned long *file_size) | 40 | unsigned long *file_size) |
| 36 | { | 41 | { |
| 37 | struct { | ||
| 38 | efi_file_info_t info; | ||
| 39 | efi_char16_t filename[MAX_FILENAME_SIZE]; | ||
| 40 | } finfo; | ||
| 41 | efi_guid_t info_guid = EFI_FILE_INFO_ID; | 42 | efi_guid_t info_guid = EFI_FILE_INFO_ID; |
| 42 | efi_file_protocol_t *fh; | 43 | efi_file_protocol_t *fh; |
| 43 | unsigned long info_sz; | 44 | unsigned long info_sz; |
| 44 | efi_status_t status; | 45 | efi_status_t status; |
| 45 | 46 | ||
| 46 | status = volume->open(volume, &fh, filename_16, EFI_FILE_MODE_READ, 0); | 47 | status = volume->open(volume, &fh, fi->filename, EFI_FILE_MODE_READ, 0); |
| 47 | if (status != EFI_SUCCESS) { | 48 | if (status != EFI_SUCCESS) { |
| 48 | pr_efi_err("Failed to open file: "); | 49 | pr_efi_err("Failed to open file: "); |
| 49 | efi_char16_printk(filename_16); | 50 | efi_char16_printk(fi->filename); |
| 50 | efi_printk("\n"); | 51 | efi_printk("\n"); |
| 51 | return status; | 52 | return status; |
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | info_sz = sizeof(finfo); | 55 | info_sz = sizeof(struct finfo); |
| 55 | status = fh->get_info(fh, &info_guid, &info_sz, &finfo); | 56 | status = fh->get_info(fh, &info_guid, &info_sz, fi); |
| 56 | if (status != EFI_SUCCESS) { | 57 | if (status != EFI_SUCCESS) { |
| 57 | pr_efi_err("Failed to get file info\n"); | 58 | pr_efi_err("Failed to get file info\n"); |
| 58 | fh->close(fh); | 59 | fh->close(fh); |
| @@ -60,7 +61,7 @@ static efi_status_t efi_open_file(efi_file_protocol_t *volume, · 1 unmodified line | |||
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | *handle = fh; | 63 | *handle = fh; |
| 63 | *file_size = finfo.info.file_size; | 64 | *file_size = fi->info.file_size; |
| 64 | return EFI_SUCCESS; | 65 | return EFI_SUCCESS; |
| 65 | } | 66 | } |
| 66 | 67 | ||
| @@ -146,13 +147,13 @@ static efi_status_t handle_cmdline_files(efi_loaded_image_t *image, · 79 unmodified lines | |||
| 146 | 147 | ||
| 147 | alloc_addr = alloc_size = 0; | 148 | alloc_addr = alloc_size = 0; |
| 148 | do { | 149 | do { |
| 149 | efi_char16_t filename[MAX_FILENAME_SIZE]; | 150 | struct finfo fi; |
| 150 | unsigned long size; | 151 | unsigned long size; |
| 151 | void *addr; | 152 | void *addr; |
| 152 | 153 | ||
| 153 | offset = find_file_option(cmdline, cmdline_len, | 154 | offset = find_file_option(cmdline, cmdline_len, |
| 154 | optstr, optstr_size, | 155 | optstr, optstr_size, |
| 155 | filename, ARRAY_SIZE(filename)); | 156 | fi.filename, ARRAY_SIZE(fi.filename)); |
| 156 | 157 | ||
| 157 | if (!offset) | 158 | if (!offset) |
| 158 | break; | 159 | break; |
| @@ -166,7 +167,7 @@ static efi_status_t handle_cmdline_files(efi_loaded_image_t *image, · 7 unmodified lines | |||
| 166 | return status; | 167 | return status; |
| 167 | } | 168 | } |
| 168 | 169 | ||
| 169 | status = efi_open_file(volume, filename, &file, &size); | 170 | status = efi_open_file(volume, &fi, &file, &size); |
| 170 | if (status != EFI_SUCCESS) | 171 | if (status != EFI_SUCCESS) |
| 171 | goto err_close_volume; | 172 | goto err_close_volume; |
| 172 | 173 | ||
| @@ -20,7 +20,7 @@ · 19 unmodified lines | |||
| 20 | /* Maximum physical address for 64-bit kernel with 4-level paging */ | 20 | /* Maximum physical address for 64-bit kernel with 4-level paging */ |
| 21 | #define MAXMEM_X86_64_4LEVEL (1ull << 46) | 21 | #define MAXMEM_X86_64_4LEVEL (1ull << 46) |
| 22 | 22 | ||
| 23 | static efi_system_table_t *sys_table; | 23 | static efi_system_table_t *sys_table __efistub_global; |
| 24 | extern const bool efi_is64; | 24 | extern const bool efi_is64; |
| 25 | extern u32 image_offset; | 25 | extern u32 image_offset; |
| 26 | 26 | ||
| @@ -392,8 +392,6 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle, · 365 unmodified lines | |||
| 392 | image_base = efi_table_attr(image, image_base); | 392 | image_base = efi_table_attr(image, image_base); |
| 393 | image_offset = (void *)startup_32 - image_base; | 393 | image_offset = (void *)startup_32 - image_base; |
| 394 | 394 | ||
| 395 | hdr = &((struct boot_params *)image_base)->hdr; | ||
| 396 | |||
| 397 | status = efi_allocate_pages(0x4000, (unsigned long *)&boot_params, ULONG_MAX); | 395 | status = efi_allocate_pages(0x4000, (unsigned long *)&boot_params, ULONG_MAX); |
| 398 | if (status != EFI_SUCCESS) { | 396 | if (status != EFI_SUCCESS) { |
| 399 | efi_printk("Failed to allocate lowmem for boot params\n"); | 397 | efi_printk("Failed to allocate lowmem for boot params\n"); |
| @@ -742,8 +740,15 @@ unsigned long efi_main(efi_handle_t handle, · 342 unmodified lines | |||
| 742 | * now use KERNEL_IMAGE_SIZE, which will be 512MiB, the same as what | 740 | * now use KERNEL_IMAGE_SIZE, which will be 512MiB, the same as what |
| 743 | * KASLR uses. | 741 | * KASLR uses. |
| 744 | * | 742 | * |
| 745 | * Also relocate it if image_offset is zero, i.e. we weren't loaded by | 743 | * Also relocate it if image_offset is zero, i.e. the kernel wasn't |
| 746 | * LoadImage, but we are not aligned correctly. | 744 | * loaded by LoadImage, but rather by a bootloader that called the |
| 745 | * handover entry. The reason we must always relocate in this case is | ||
| 746 | * to handle the case of systemd-boot booting a unified kernel image, | ||
| 747 | * which is a PE executable that contains the bzImage and an initrd as | ||
| 748 | * COFF sections. The initrd section is placed after the bzImage | ||
| 749 | * without ensuring that there are at least init_size bytes available | ||
| 750 | * for the bzImage, and thus the compressed kernel's startup code may | ||
| 751 | * overwrite the initrd unless it is moved out of the way. | ||
| 747 | */ | 752 | */ |
| 748 | 753 | ||
| 749 | buffer_start = ALIGN(bzimage_addr - image_offset, | 754 | buffer_start = ALIGN(bzimage_addr - image_offset, |
| @@ -753,8 +758,7 @@ unsigned long efi_main(efi_handle_t handle, · 3 unmodified lines | |||
| 753 | if ((buffer_start < LOAD_PHYSICAL_ADDR) || | 758 | if ((buffer_start < LOAD_PHYSICAL_ADDR) || |
| 754 | (IS_ENABLED(CONFIG_X86_32) && buffer_end > KERNEL_IMAGE_SIZE) || | 759 | (IS_ENABLED(CONFIG_X86_32) && buffer_end > KERNEL_IMAGE_SIZE) || |
| 755 | (IS_ENABLED(CONFIG_X86_64) && buffer_end > MAXMEM_X86_64_4LEVEL) || | 760 | (IS_ENABLED(CONFIG_X86_64) && buffer_end > MAXMEM_X86_64_4LEVEL) || |
| 756 | (image_offset == 0 && !IS_ALIGNED(bzimage_addr, | 761 | (image_offset == 0)) { |
| 757 | hdr->kernel_alignment))) { | ||
| 758 | status = efi_relocate_kernel(&bzimage_addr, | 762 | status = efi_relocate_kernel(&bzimage_addr, |
| 759 | hdr->init_size, hdr->init_size, | 763 | hdr->init_size, hdr->init_size, |
| 760 | hdr->pref_address, | 764 | hdr->pref_address, |
| @@ -12,7 +12,7 @@ config IMX_DSP · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | config IMX_SCU | 13 | config IMX_SCU |
| 14 | bool "IMX SCU Protocol driver" | 14 | bool "IMX SCU Protocol driver" |
| 15 | depends on IMX_MBOX || COMPILE_TEST | 15 | depends on IMX_MBOX |
| 16 | help | 16 | help |
| 17 | The System Controller Firmware (SCFW) is a low-level system function | 17 | The System Controller Firmware (SCFW) is a low-level system function |
| 18 | which runs on a dedicated Cortex-M core to provide power, clock, and | 18 | which runs on a dedicated Cortex-M core to provide power, clock, and |
| @@ -24,6 +24,6 @@ config IMX_SCU · 5 unmodified lines | |||
| 24 | 24 | ||
| 25 | config IMX_SCU_PD | 25 | config IMX_SCU_PD |
| 26 | bool "IMX SCU Power Domain driver" | 26 | bool "IMX SCU Power Domain driver" |
| 27 | depends on IMX_SCU || COMPILE_TEST | 27 | depends on IMX_SCU |
| 28 | help | 28 | help |
| 29 | The System Controller Firmware (SCFW) based power domain driver. | 29 | The System Controller Firmware (SCFW) based power domain driver. |
| @@ -35,7 +35,7 @@ static struct pm_api_info pm_api_list[] = { · 34 unmodified lines | |||
| 35 | PM_API(PM_QUERY_DATA), | 35 | PM_API(PM_QUERY_DATA), |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | struct dentry *firmware_debugfs_root; | 38 | static struct dentry *firmware_debugfs_root; |
| 39 | 39 | ||
| 40 | /** | 40 | /** |
| 41 | * zynqmp_pm_argument_value() - Extract argument value from a PM-API request | 41 | * zynqmp_pm_argument_value() - Extract argument value from a PM-API request |
| @@ -248,11 +248,13 @@ static int cci_pci_sriov_configure(struct pci_dev *pcidev, int num_vfs) · 247 unmodified lines | |||
| 248 | return ret; | 248 | return ret; |
| 249 | 249 | ||
| 250 | ret = pci_enable_sriov(pcidev, num_vfs); | 250 | ret = pci_enable_sriov(pcidev, num_vfs); |
| 251 | if (ret) | 251 | if (ret) { |
| 252 | dfl_fpga_cdev_config_ports_pf(cdev); | 252 | dfl_fpga_cdev_config_ports_pf(cdev); |
| 253 | return ret; | ||
| 254 | } | ||
| 253 | } | 255 | } |
| 254 | 256 | ||
| 255 | return ret; | 257 | return num_vfs; |
| 256 | } | 258 | } |
| 257 | 259 | ||
| 258 | static void cci_pci_remove(struct pci_dev *pcidev) | 260 | static void cci_pci_remove(struct pci_dev *pcidev) |
| @@ -583,7 +583,8 @@ static int zynq_fpga_probe(struct platform_device *pdev) · 582 unmodified lines | |||
| 583 | 583 | ||
| 584 | priv->clk = devm_clk_get(dev, "ref_clk"); | 584 | priv->clk = devm_clk_get(dev, "ref_clk"); |
| 585 | if (IS_ERR(priv->clk)) { | 585 | if (IS_ERR(priv->clk)) { |
| 586 | dev_err(dev, "input clock not found\n"); | 586 | if (PTR_ERR(priv->clk) != -EPROBE_DEFER) |
| 587 | dev_err(dev, "input clock not found\n"); | ||
| 587 | return PTR_ERR(priv->clk); | 588 | return PTR_ERR(priv->clk); |
| 588 | } | 589 | } |
| 589 | 590 | ||
| @@ -2008,8 +2008,24 @@ static void amdgpu_device_fill_reset_magic(struct amdgpu_device *adev) · 2007 unmodified lines | |||
| 2008 | */ | 2008 | */ |
| 2009 | static bool amdgpu_device_check_vram_lost(struct amdgpu_device *adev) | 2009 | static bool amdgpu_device_check_vram_lost(struct amdgpu_device *adev) |
| 2010 | { | 2010 | { |
| 2011 | return !!memcmp(adev->gart.ptr, adev->reset_magic, | 2011 | if (memcmp(adev->gart.ptr, adev->reset_magic, |
| 2012 | AMDGPU_RESET_MAGIC_NUM); | 2012 | AMDGPU_RESET_MAGIC_NUM)) |
| 2013 | return true; | ||
| 2014 | |||
| 2015 | if (!adev->in_gpu_reset) | ||
| 2016 | return false; | ||
| 2017 | |||
| 2018 | /* | ||
| 2019 | * For all ASICs with baco/mode1 reset, the VRAM is | ||
| 2020 | * always assumed to be lost. | ||
| 2021 | */ | ||
| 2022 | switch (amdgpu_asic_reset_method(adev)) { | ||
| 2023 | case AMD_RESET_METHOD_BACO: | ||
| 2024 | case AMD_RESET_METHOD_MODE1: | ||
| 2025 | return true; | ||
| 2026 | default: | ||
| 2027 | return false; | ||
| 2028 | } | ||
| 2013 | } | 2029 | } |
| 2014 | 2030 | ||
| 2015 | /** | 2031 | /** |
| @@ -2340,6 +2356,8 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev) · 324 unmodified lines | |||
| 2340 | { | 2356 | { |
| 2341 | int i, r; | 2357 | int i, r; |
| 2342 | 2358 | ||
| 2359 | amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE); | ||
| 2360 | amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE); | ||
| 2343 | 2361 | ||
| 2344 | for (i = adev->num_ip_blocks - 1; i >= 0; i--) { | 2362 | for (i = adev->num_ip_blocks - 1; i >= 0; i--) { |
| 2345 | if (!adev->ip_blocks[i].status.valid) | 2363 | if (!adev->ip_blocks[i].status.valid) |
| @@ -1358,8 +1358,6 @@ static int cik_asic_reset(struct amdgpu_device *adev) · 1357 unmodified lines | |||
| 1358 | int r; | 1358 | int r; |
| 1359 | 1359 | ||
| 1360 | if (cik_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { | 1360 | if (cik_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { |
| 1361 | if (!adev->in_suspend) | ||
| 1362 | amdgpu_inc_vram_lost(adev); | ||
| 1363 | r = amdgpu_dpm_baco_reset(adev); | 1361 | r = amdgpu_dpm_baco_reset(adev); |
| 1364 | } else { | 1362 | } else { |
| 1365 | r = cik_asic_pci_config_reset(adev); | 1363 | r = cik_asic_pci_config_reset(adev); |
| @@ -279,7 +279,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_1_2_nv12[] = · 278 unmodified lines | |||
| 279 | 279 | ||
| 280 | #define DEFAULT_SH_MEM_CONFIG \ | 280 | #define DEFAULT_SH_MEM_CONFIG \ |
| 281 | ((SH_MEM_ADDRESS_MODE_64 << SH_MEM_CONFIG__ADDRESS_MODE__SHIFT) | \ | 281 | ((SH_MEM_ADDRESS_MODE_64 << SH_MEM_CONFIG__ADDRESS_MODE__SHIFT) | \ |
| 282 | (SH_MEM_ALIGNMENT_MODE_DWORD << SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) | \ | 282 | (SH_MEM_ALIGNMENT_MODE_UNALIGNED << SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) | \ |
| 283 | (SH_MEM_RETRY_MODE_ALL << SH_MEM_CONFIG__RETRY_MODE__SHIFT) | \ | 283 | (SH_MEM_RETRY_MODE_ALL << SH_MEM_CONFIG__RETRY_MODE__SHIFT) | \ |
| 284 | (3 << SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT)) | 284 | (3 << SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT)) |
| 285 | 285 | ||
| @@ -1234,6 +1234,8 @@ struct amdgpu_gfxoff_quirk { · 1233 unmodified lines | |||
| 1234 | static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = { | 1234 | static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = { |
| 1235 | /* https://bugzilla.kernel.org/show_bug.cgi?id=204689 */ | 1235 | /* https://bugzilla.kernel.org/show_bug.cgi?id=204689 */ |
| 1236 | { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 }, | 1236 | { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 }, |
| 1237 | /* https://bugzilla.kernel.org/show_bug.cgi?id=207171 */ | ||
| 1238 | { 0x1002, 0x15dd, 0x103c, 0x83e7, 0xd3 }, | ||
| 1237 | { 0, 0, 0, 0, 0 }, | 1239 | { 0, 0, 0, 0, 0 }, |
| 1238 | }; | 1240 | }; |
| 1239 | 1241 | ||
| @@ -351,8 +351,6 @@ static int nv_asic_reset(struct amdgpu_device *adev) · 350 unmodified lines | |||
| 351 | struct smu_context *smu = &adev->smu; | 351 | struct smu_context *smu = &adev->smu; |
| 352 | 352 | ||
| 353 | if (nv_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { | 353 | if (nv_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { |
| 354 | if (!adev->in_suspend) | ||
| 355 | amdgpu_inc_vram_lost(adev); | ||
| 356 | ret = smu_baco_enter(smu); | 354 | ret = smu_baco_enter(smu); |
| 357 | if (ret) | 355 | if (ret) |
| 358 | return ret; | 356 | return ret; |
| @@ -360,8 +358,6 @@ static int nv_asic_reset(struct amdgpu_device *adev) · 1 unmodified line | |||
| 360 | if (ret) | 358 | if (ret) |
| 361 | return ret; | 359 | return ret; |
| 362 | } else { | 360 | } else { |
| 363 | if (!adev->in_suspend) | ||
| 364 | amdgpu_inc_vram_lost(adev); | ||
| 365 | ret = nv_asic_mode1_reset(adev); | 361 | ret = nv_asic_mode1_reset(adev); |
| 366 | } | 362 | } |
| 367 | 363 | ||
| @@ -569,14 +569,10 @@ static int soc15_asic_reset(struct amdgpu_device *adev) · 568 unmodified lines | |||
| 569 | 569 | ||
| 570 | switch (soc15_asic_reset_method(adev)) { | 570 | switch (soc15_asic_reset_method(adev)) { |
| 571 | case AMD_RESET_METHOD_BACO: | 571 | case AMD_RESET_METHOD_BACO: |
| 572 | if (!adev->in_suspend) | ||
| 573 | amdgpu_inc_vram_lost(adev); | ||
| 574 | return soc15_asic_baco_reset(adev); | 572 | return soc15_asic_baco_reset(adev); |
| 575 | case AMD_RESET_METHOD_MODE2: | 573 | case AMD_RESET_METHOD_MODE2: |
| 576 | return amdgpu_dpm_mode2_reset(adev); | 574 | return amdgpu_dpm_mode2_reset(adev); |
| 577 | default: | 575 | default: |
| 578 | if (!adev->in_suspend) | ||
| 579 | amdgpu_inc_vram_lost(adev); | ||
| 580 | return soc15_asic_mode1_reset(adev); | 576 | return soc15_asic_mode1_reset(adev); |
| 581 | } | 577 | } |
| 582 | } | 578 | } |
| @@ -765,8 +765,6 @@ static int vi_asic_reset(struct amdgpu_device *adev) · 764 unmodified lines | |||
| 765 | int r; | 765 | int r; |
| 766 | 766 | ||
| 767 | if (vi_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { | 767 | if (vi_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { |
| 768 | if (!adev->in_suspend) | ||
| 769 | amdgpu_inc_vram_lost(adev); | ||
| 770 | r = amdgpu_dpm_baco_reset(adev); | 768 | r = amdgpu_dpm_baco_reset(adev); |
| 771 | } else { | 769 | } else { |
| 772 | r = vi_asic_pci_config_reset(adev); | 770 | r = vi_asic_pci_config_reset(adev); |
| @@ -4664,6 +4664,7 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector) · 4663 unmodified lines | |||
| 4664 | i2c_del_adapter(&aconnector->i2c->base); | 4664 | i2c_del_adapter(&aconnector->i2c->base); |
| 4665 | kfree(aconnector->i2c); | 4665 | kfree(aconnector->i2c); |
| 4666 | } | 4666 | } |
| 4667 | kfree(aconnector->dm_dp_aux.aux.name); | ||
| 4667 | 4668 | ||
| 4668 | kfree(connector); | 4669 | kfree(connector); |
| 4669 | } | 4670 | } |
| @@ -4723,10 +4724,19 @@ amdgpu_dm_connector_atomic_duplicate_state(struct drm_connector *connector) · 53 unmodified lines | |||
| 4723 | static int | 4724 | static int |
| 4724 | amdgpu_dm_connector_late_register(struct drm_connector *connector) | 4725 | amdgpu_dm_connector_late_register(struct drm_connector *connector) |
| 4725 | { | 4726 | { |
| 4726 | #if defined(CONFIG_DEBUG_FS) | ||
| 4727 | struct amdgpu_dm_connector *amdgpu_dm_connector = | 4727 | struct amdgpu_dm_connector *amdgpu_dm_connector = |
| 4728 | to_amdgpu_dm_connector(connector); | 4728 | to_amdgpu_dm_connector(connector); |
| 4729 | int r; | ||
| 4729 | 4730 | ||
| 4731 | if ((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) || | ||
| 4732 | (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) { | ||
| 4733 | amdgpu_dm_connector->dm_dp_aux.aux.dev = connector->kdev; | ||
| 4734 | r = drm_dp_aux_register(&amdgpu_dm_connector->dm_dp_aux.aux); | ||
| 4735 | if (r) | ||
| 4736 | return r; | ||
| 4737 | } | ||
| 4738 | |||
| 4739 | #if defined(CONFIG_DEBUG_FS) | ||
| 4730 | connector_debugfs_init(amdgpu_dm_connector); | 4740 | connector_debugfs_init(amdgpu_dm_connector); |
| 4731 | #endif | 4741 | #endif |
| 4732 | 4742 | ||
| @@ -6092,7 +6102,7 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm, · 1359 unmodified lines | |||
| 6092 | 6102 | ||
| 6093 | if (connector_type == DRM_MODE_CONNECTOR_DisplayPort | 6103 | if (connector_type == DRM_MODE_CONNECTOR_DisplayPort |
| 6094 | || connector_type == DRM_MODE_CONNECTOR_eDP) | 6104 | || connector_type == DRM_MODE_CONNECTOR_eDP) |
| 6095 | amdgpu_dm_initialize_dp_connector(dm, aconnector); | 6105 | amdgpu_dm_initialize_dp_connector(dm, aconnector, link->link_index); |
| 6096 | 6106 | ||
| 6097 | out_free: | 6107 | out_free: |
| 6098 | if (res) { | 6108 | if (res) { |
| @@ -156,16 +156,16 @@ amdgpu_dm_mst_connector_late_register(struct drm_connector *connector) · 155 unmodified lines | |||
| 156 | to_amdgpu_dm_connector(connector); | 156 | to_amdgpu_dm_connector(connector); |
| 157 | int r; | 157 | int r; |
| 158 | 158 | ||
| 159 | amdgpu_dm_connector->dm_dp_aux.aux.dev = connector->kdev; | 159 | r = drm_dp_mst_connector_late_register(connector, |
| 160 | r = drm_dp_aux_register(&amdgpu_dm_connector->dm_dp_aux.aux); | 160 | amdgpu_dm_connector->port); |
| 161 | if (r) | 161 | if (r < 0) |
| 162 | return r; | 162 | return r; |
| 163 | 163 | ||
| 164 | #if defined(CONFIG_DEBUG_FS) | 164 | #if defined(CONFIG_DEBUG_FS) |
| 165 | connector_debugfs_init(amdgpu_dm_connector); | 165 | connector_debugfs_init(amdgpu_dm_connector); |
| 166 | #endif | 166 | #endif |
| 167 | 167 | ||
| 168 | return r; | 168 | return 0; |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | static void | 171 | static void |
| @@ -472,9 +472,12 @@ static const struct drm_dp_mst_topology_cbs dm_mst_cbs = { · 300 unmodified lines | |||
| 472 | }; | 472 | }; |
| 473 | 473 | ||
| 474 | void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, | 474 | void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, |
| 475 | struct amdgpu_dm_connector *aconnector) | 475 | struct amdgpu_dm_connector *aconnector, |
| 476 | int link_index) | ||
| 476 | { | 477 | { |
| 477 | aconnector->dm_dp_aux.aux.name = "dmdc"; | 478 | aconnector->dm_dp_aux.aux.name = |
| 479 | kasprintf(GFP_KERNEL, "AMDGPU DM aux hw bus %d", | ||
| 480 | link_index); | ||
| 478 | aconnector->dm_dp_aux.aux.transfer = dm_dp_aux_transfer; | 481 | aconnector->dm_dp_aux.aux.transfer = dm_dp_aux_transfer; |
| 479 | aconnector->dm_dp_aux.ddc_service = aconnector->dc_link->ddc; | 482 | aconnector->dm_dp_aux.ddc_service = aconnector->dc_link->ddc; |
| 480 | 483 | ||
| @@ -32,7 +32,8 @@ struct amdgpu_dm_connector; · 31 unmodified lines | |||
| 32 | int dm_mst_get_pbn_divider(struct dc_link *link); | 32 | int dm_mst_get_pbn_divider(struct dc_link *link); |
| 33 | 33 | ||
| 34 | void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, | 34 | void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, |
| 35 | struct amdgpu_dm_connector *aconnector); | 35 | struct amdgpu_dm_connector *aconnector, |
| 36 | int link_index); | ||
| 36 | 37 | ||
| 37 | #if defined(CONFIG_DRM_AMD_DC_DCN) | 38 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 38 | bool compute_mst_dsc_configs_for_state(struct drm_atomic_state *state, | 39 | bool compute_mst_dsc_configs_for_state(struct drm_atomic_state *state, |
| @@ -984,6 +984,32 @@ static int init_thermal_controller( · 983 unmodified lines | |||
| 984 | struct pp_hwmgr *hwmgr, | 984 | struct pp_hwmgr *hwmgr, |
| 985 | const ATOM_PPLIB_POWERPLAYTABLE *powerplay_table) | 985 | const ATOM_PPLIB_POWERPLAYTABLE *powerplay_table) |
| 986 | { | 986 | { |
| 987 | hwmgr->thermal_controller.ucType = | ||
| 988 | powerplay_table->sThermalController.ucType; | ||
| 989 | hwmgr->thermal_controller.ucI2cLine = | ||
| 990 | powerplay_table->sThermalController.ucI2cLine; | ||
| 991 | hwmgr->thermal_controller.ucI2cAddress = | ||
| 992 | powerplay_table->sThermalController.ucI2cAddress; | ||
| 993 | |||
| 994 | hwmgr->thermal_controller.fanInfo.bNoFan = | ||
| 995 | (0 != (powerplay_table->sThermalController.ucFanParameters & | ||
| 996 | ATOM_PP_FANPARAMETERS_NOFAN)); | ||
| 997 | |||
| 998 | hwmgr->thermal_controller.fanInfo.ucTachometerPulsesPerRevolution = | ||
| 999 | powerplay_table->sThermalController.ucFanParameters & | ||
| 1000 | ATOM_PP_FANPARAMETERS_TACHOMETER_PULSES_PER_REVOLUTION_MASK; | ||
| 1001 | |||
| 1002 | hwmgr->thermal_controller.fanInfo.ulMinRPM | ||
| 1003 | = powerplay_table->sThermalController.ucFanMinRPM * 100UL; | ||
| 1004 | hwmgr->thermal_controller.fanInfo.ulMaxRPM | ||
| 1005 | = powerplay_table->sThermalController.ucFanMaxRPM * 100UL; | ||
| 1006 | |||
| 1007 | set_hw_cap(hwmgr, | ||
| 1008 | ATOM_PP_THERMALCONTROLLER_NONE != hwmgr->thermal_controller.ucType, | ||
| 1009 | PHM_PlatformCaps_ThermalController); | ||
| 1010 | |||
| 1011 | hwmgr->thermal_controller.use_hw_fan_control = 1; | ||
| 1012 | |||
| 987 | return 0; | 1013 | return 0; |
| 988 | } | 1014 | } |
| 989 | 1015 | ||
| @@ -3804,9 +3804,12 @@ static int smu7_trim_single_dpm_states(struct pp_hwmgr *hwmgr, · 3803 unmodified lines | |||
| 3804 | { | 3804 | { |
| 3805 | uint32_t i; | 3805 | uint32_t i; |
| 3806 | 3806 | ||
| 3807 | /* force the trim if mclk_switching is disabled to prevent flicker */ | ||
| 3808 | bool force_trim = (low_limit == high_limit); | ||
| 3807 | for (i = 0; i < dpm_table->count; i++) { | 3809 | for (i = 0; i < dpm_table->count; i++) { |
| 3808 | /*skip the trim if od is enabled*/ | 3810 | /*skip the trim if od is enabled*/ |
| 3809 | if (!hwmgr->od_enabled && (dpm_table->dpm_levels[i].value < low_limit | 3811 | if ((!hwmgr->od_enabled || force_trim) |
| 3812 | && (dpm_table->dpm_levels[i].value < low_limit | ||
| 3810 | || dpm_table->dpm_levels[i].value > high_limit)) | 3813 | || dpm_table->dpm_levels[i].value > high_limit)) |
| 3811 | dpm_table->dpm_levels[i].enabled = false; | 3814 | dpm_table->dpm_levels[i].enabled = false; |
| 3812 | else | 3815 | else |
| @@ -895,12 +895,17 @@ static int renoir_read_sensor(struct smu_context *smu, · 894 unmodified lines | |||
| 895 | 895 | ||
| 896 | static bool renoir_is_dpm_running(struct smu_context *smu) | 896 | static bool renoir_is_dpm_running(struct smu_context *smu) |
| 897 | { | 897 | { |
| 898 | struct amdgpu_device *adev = smu->adev; | ||
| 899 | |||
| 898 | /* | 900 | /* |
| 899 | * Util now, the pmfw hasn't exported the interface of SMU | 901 | * Util now, the pmfw hasn't exported the interface of SMU |
| 900 | * feature mask to APU SKU so just force on all the feature | 902 | * feature mask to APU SKU so just force on all the feature |
| 901 | * at early initial stage. | 903 | * at early initial stage. |
| 902 | */ | 904 | */ |
| 903 | return true; | 905 | if (adev->in_suspend) |
| 906 | return false; | ||
| 907 | else | ||
| 908 | return true; | ||
| 904 | 909 | ||
| 905 | } | 910 | } |
| 906 | 911 | ||
| @@ -1718,6 +1718,12 @@ int smu_v11_0_baco_set_state(struct smu_context *smu, enum smu_baco_state state) · 1717 unmodified lines | |||
| 1718 | if (ret) | 1718 | if (ret) |
| 1719 | goto out; | 1719 | goto out; |
| 1720 | 1720 | ||
| 1721 | if (ras && ras->supported) { | ||
| 1722 | ret = smu_send_smc_msg(smu, SMU_MSG_PrepareMp1ForUnload, NULL); | ||
| 1723 | if (ret) | ||
| 1724 | goto out; | ||
| 1725 | } | ||
| 1726 | |||
| 1721 | /* clear vbios scratch 6 and 7 for coming asic reinit */ | 1727 | /* clear vbios scratch 6 and 7 for coming asic reinit */ |
| 1722 | WREG32(adev->bios_scratch_reg_offset + 6, 0); | 1728 | WREG32(adev->bios_scratch_reg_offset + 6, 0); |
| 1723 | WREG32(adev->bios_scratch_reg_offset + 7, 0); | 1729 | WREG32(adev->bios_scratch_reg_offset + 7, 0); |
| @@ -485,6 +485,9 @@ static int anx6345_get_modes(struct drm_connector *connector) · 484 unmodified lines | |||
| 485 | 485 | ||
| 486 | num_modes += drm_add_edid_modes(connector, anx6345->edid); | 486 | num_modes += drm_add_edid_modes(connector, anx6345->edid); |
| 487 | 487 | ||
| 488 | /* Driver currently supports only 6bpc */ | ||
| 489 | connector->display_info.bpc = 6; | ||
| 490 | |||
| 488 | unlock: | 491 | unlock: |
| 489 | if (power_off) | 492 | if (power_off) |
| 490 | anx6345_poweroff(anx6345); | 493 | anx6345_poweroff(anx6345); |
| @@ -4295,6 +4295,7 @@ int drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state, · 4294 unmodified lines | |||
| 4295 | if (pos->vcpi) { | 4295 | if (pos->vcpi) { |
| 4296 | drm_dp_mst_put_port_malloc(port); | 4296 | drm_dp_mst_put_port_malloc(port); |
| 4297 | pos->vcpi = 0; | 4297 | pos->vcpi = 0; |
| 4298 | pos->pbn = 0; | ||
| 4298 | } | 4299 | } |
| 4299 | 4300 | ||
| 4300 | return 0; | 4301 | return 0; |
| @@ -3141,9 +3141,6 @@ static void hsw_ddi_pre_enable_dp(struct intel_encoder *encoder, · 3140 unmodified lines | |||
| 3141 | intel_dp_set_link_params(intel_dp, crtc_state->port_clock, | 3141 | intel_dp_set_link_params(intel_dp, crtc_state->port_clock, |
| 3142 | crtc_state->lane_count, is_mst); | 3142 | crtc_state->lane_count, is_mst); |
| 3143 | 3143 | ||
| 3144 | intel_dp->regs.dp_tp_ctl = DP_TP_CTL(port); | ||
| 3145 | intel_dp->regs.dp_tp_status = DP_TP_STATUS(port); | ||
| 3146 | |||
| 3147 | intel_edp_panel_on(intel_dp); | 3144 | intel_edp_panel_on(intel_dp); |
| 3148 | 3145 | ||
| 3149 | intel_ddi_clk_select(encoder, crtc_state); | 3146 | intel_ddi_clk_select(encoder, crtc_state); |
| @@ -3848,12 +3845,18 @@ void intel_ddi_get_config(struct intel_encoder *encoder, · 698 unmodified lines | |||
| 3848 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); | 3845 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
| 3849 | struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->uapi.crtc); | 3846 | struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->uapi.crtc); |
| 3850 | enum transcoder cpu_transcoder = pipe_config->cpu_transcoder; | 3847 | enum transcoder cpu_transcoder = pipe_config->cpu_transcoder; |
| 3848 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); | ||
| 3851 | u32 temp, flags = 0; | 3849 | u32 temp, flags = 0; |
| 3852 | 3850 | ||
| 3853 | /* XXX: DSI transcoder paranoia */ | 3851 | /* XXX: DSI transcoder paranoia */ |
| 3854 | if (drm_WARN_ON(&dev_priv->drm, transcoder_is_dsi(cpu_transcoder))) | 3852 | if (drm_WARN_ON(&dev_priv->drm, transcoder_is_dsi(cpu_transcoder))) |
| 3855 | return; | 3853 | return; |
| 3856 | 3854 | ||
| 3855 | if (INTEL_GEN(dev_priv) >= 12) { | ||
| 3856 | intel_dp->regs.dp_tp_ctl = TGL_DP_TP_CTL(cpu_transcoder); | ||
| 3857 | intel_dp->regs.dp_tp_status = TGL_DP_TP_STATUS(cpu_transcoder); | ||
| 3858 | } | ||
| 3859 | |||
| 3857 | intel_dsc_get_config(encoder, pipe_config); | 3860 | intel_dsc_get_config(encoder, pipe_config); |
| 3858 | 3861 | ||
| 3859 | temp = intel_de_read(dev_priv, TRANS_DDI_FUNC_CTL(cpu_transcoder)); | 3862 | temp = intel_de_read(dev_priv, TRANS_DDI_FUNC_CTL(cpu_transcoder)); |
| @@ -4173,6 +4176,7 @@ static const struct drm_encoder_funcs intel_ddi_funcs = { · 313 unmodified lines | |||
| 4173 | static struct intel_connector * | 4176 | static struct intel_connector * |
| 4174 | intel_ddi_init_dp_connector(struct intel_digital_port *intel_dig_port) | 4177 | intel_ddi_init_dp_connector(struct intel_digital_port *intel_dig_port) |
| 4175 | { | 4178 | { |
| 4179 | struct drm_i915_private *dev_priv = to_i915(intel_dig_port->base.base.dev); | ||
| 4176 | struct intel_connector *connector; | 4180 | struct intel_connector *connector; |
| 4177 | enum port port = intel_dig_port->base.port; | 4181 | enum port port = intel_dig_port->base.port; |
| 4178 | 4182 | ||
| @@ -4183,6 +4187,10 @@ intel_ddi_init_dp_connector(struct intel_digital_port *intel_dig_port) · 4 unmodified lines | |||
| 4183 | intel_dig_port->dp.output_reg = DDI_BUF_CTL(port); | 4187 | intel_dig_port->dp.output_reg = DDI_BUF_CTL(port); |
| 4184 | intel_dig_port->dp.prepare_link_retrain = | 4188 | intel_dig_port->dp.prepare_link_retrain = |
| 4185 | intel_ddi_prepare_link_retrain; | 4189 | intel_ddi_prepare_link_retrain; |
| 4190 | if (INTEL_GEN(dev_priv) < 12) { | ||
| 4191 | intel_dig_port->dp.regs.dp_tp_ctl = DP_TP_CTL(port); | ||
| 4192 | intel_dig_port->dp.regs.dp_tp_status = DP_TP_STATUS(port); | ||
| 4193 | } | ||
| 4186 | 4194 | ||
| 4187 | if (!intel_dp_init_connector(intel_dig_port, connector)) { | 4195 | if (!intel_dp_init_connector(intel_dig_port, connector)) { |
| 4188 | kfree(connector); | 4196 | kfree(connector); |
| @@ -4140,7 +4140,7 @@ static const struct i915_power_well_desc tgl_power_wells[] = { · 4139 unmodified lines | |||
| 4140 | { | 4140 | { |
| 4141 | .name = "AUX D TBT1", | 4141 | .name = "AUX D TBT1", |
| 4142 | .domains = TGL_AUX_D_TBT1_IO_POWER_DOMAINS, | 4142 | .domains = TGL_AUX_D_TBT1_IO_POWER_DOMAINS, |
| 4143 | .ops = &hsw_power_well_ops, | 4143 | .ops = &icl_tc_phy_aux_power_well_ops, |
| 4144 | .id = DISP_PW_ID_NONE, | 4144 | .id = DISP_PW_ID_NONE, |
| 4145 | { | 4145 | { |
| 4146 | .hsw.regs = &icl_aux_power_well_regs, | 4146 | .hsw.regs = &icl_aux_power_well_regs, |
| @@ -4151,7 +4151,7 @@ static const struct i915_power_well_desc tgl_power_wells[] = { · 4 unmodified lines | |||
| 4151 | { | 4151 | { |
| 4152 | .name = "AUX E TBT2", | 4152 | .name = "AUX E TBT2", |
| 4153 | .domains = TGL_AUX_E_TBT2_IO_POWER_DOMAINS, | 4153 | .domains = TGL_AUX_E_TBT2_IO_POWER_DOMAINS, |
| 4154 | .ops = &hsw_power_well_ops, | 4154 | .ops = &icl_tc_phy_aux_power_well_ops, |
| 4155 | .id = DISP_PW_ID_NONE, | 4155 | .id = DISP_PW_ID_NONE, |
| 4156 | { | 4156 | { |
| 4157 | .hsw.regs = &icl_aux_power_well_regs, | 4157 | .hsw.regs = &icl_aux_power_well_regs, |
| @@ -4162,7 +4162,7 @@ static const struct i915_power_well_desc tgl_power_wells[] = { · 4 unmodified lines | |||
| 4162 | { | 4162 | { |
| 4163 | .name = "AUX F TBT3", | 4163 | .name = "AUX F TBT3", |
| 4164 | .domains = TGL_AUX_F_TBT3_IO_POWER_DOMAINS, | 4164 | .domains = TGL_AUX_F_TBT3_IO_POWER_DOMAINS, |
| 4165 | .ops = &hsw_power_well_ops, | 4165 | .ops = &icl_tc_phy_aux_power_well_ops, |
| 4166 | .id = DISP_PW_ID_NONE, | 4166 | .id = DISP_PW_ID_NONE, |
| 4167 | { | 4167 | { |
| 4168 | .hsw.regs = &icl_aux_power_well_regs, | 4168 | .hsw.regs = &icl_aux_power_well_regs, |
| @@ -4173,7 +4173,7 @@ static const struct i915_power_well_desc tgl_power_wells[] = { · 4 unmodified lines | |||
| 4173 | { | 4173 | { |
| 4174 | .name = "AUX G TBT4", | 4174 | .name = "AUX G TBT4", |
| 4175 | .domains = TGL_AUX_G_TBT4_IO_POWER_DOMAINS, | 4175 | .domains = TGL_AUX_G_TBT4_IO_POWER_DOMAINS, |
| 4176 | .ops = &hsw_power_well_ops, | 4176 | .ops = &icl_tc_phy_aux_power_well_ops, |
| 4177 | .id = DISP_PW_ID_NONE, | 4177 | .id = DISP_PW_ID_NONE, |
| 4178 | { | 4178 | { |
| 4179 | .hsw.regs = &icl_aux_power_well_regs, | 4179 | .hsw.regs = &icl_aux_power_well_regs, |
| @@ -4184,7 +4184,7 @@ static const struct i915_power_well_desc tgl_power_wells[] = { · 4 unmodified lines | |||
| 4184 | { | 4184 | { |
| 4185 | .name = "AUX H TBT5", | 4185 | .name = "AUX H TBT5", |
| 4186 | .domains = TGL_AUX_H_TBT5_IO_POWER_DOMAINS, | 4186 | .domains = TGL_AUX_H_TBT5_IO_POWER_DOMAINS, |
| 4187 | .ops = &hsw_power_well_ops, | 4187 | .ops = &icl_tc_phy_aux_power_well_ops, |
| 4188 | .id = DISP_PW_ID_NONE, | 4188 | .id = DISP_PW_ID_NONE, |
| 4189 | { | 4189 | { |
| 4190 | .hsw.regs = &icl_aux_power_well_regs, | 4190 | .hsw.regs = &icl_aux_power_well_regs, |
| @@ -4195,7 +4195,7 @@ static const struct i915_power_well_desc tgl_power_wells[] = { · 4 unmodified lines | |||
| 4195 | { | 4195 | { |
| 4196 | .name = "AUX I TBT6", | 4196 | .name = "AUX I TBT6", |
| 4197 | .domains = TGL_AUX_I_TBT6_IO_POWER_DOMAINS, | 4197 | .domains = TGL_AUX_I_TBT6_IO_POWER_DOMAINS, |
| 4198 | .ops = &hsw_power_well_ops, | 4198 | .ops = &icl_tc_phy_aux_power_well_ops, |
| 4199 | .id = DISP_PW_ID_NONE, | 4199 | .id = DISP_PW_ID_NONE, |
| 4200 | { | 4200 | { |
| 4201 | .hsw.regs = &icl_aux_power_well_regs, | 4201 | .hsw.regs = &icl_aux_power_well_regs, |
| @@ -2517,9 +2517,6 @@ static void intel_dp_prepare(struct intel_encoder *encoder, · 2516 unmodified lines | |||
| 2517 | intel_crtc_has_type(pipe_config, | 2517 | intel_crtc_has_type(pipe_config, |
| 2518 | INTEL_OUTPUT_DP_MST)); | 2518 | INTEL_OUTPUT_DP_MST)); |
| 2519 | 2519 | ||
| 2520 | intel_dp->regs.dp_tp_ctl = DP_TP_CTL(port); | ||
| 2521 | intel_dp->regs.dp_tp_status = DP_TP_STATUS(port); | ||
| 2522 | |||
| 2523 | /* | 2520 | /* |
| 2524 | * There are four kinds of DP registers: | 2521 | * There are four kinds of DP registers: |
| 2525 | * | 2522 | * |
| @@ -7836,6 +7833,8 @@ bool intel_dp_init(struct drm_i915_private *dev_priv, · 5310 unmodified lines | |||
| 7836 | 7833 | ||
| 7837 | intel_dig_port->dp.output_reg = output_reg; | 7834 | intel_dig_port->dp.output_reg = output_reg; |
| 7838 | intel_dig_port->max_lanes = 4; | 7835 | intel_dig_port->max_lanes = 4; |
| 7836 | intel_dig_port->dp.regs.dp_tp_ctl = DP_TP_CTL(port); | ||
| 7837 | intel_dig_port->dp.regs.dp_tp_status = DP_TP_STATUS(port); | ||
| 7839 | 7838 | ||
| 7840 | intel_encoder->type = INTEL_OUTPUT_DP; | 7839 | intel_encoder->type = INTEL_OUTPUT_DP; |
| 7841 | intel_encoder->power_domain = intel_port_to_power_domain(port); | 7840 | intel_encoder->power_domain = intel_port_to_power_domain(port); |
| @@ -342,6 +342,7 @@ int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector) · 341 unmodified lines | |||
| 342 | */ | 342 | */ |
| 343 | if (dev_priv->vbt.backlight.type != | 343 | if (dev_priv->vbt.backlight.type != |
| 344 | INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE && | 344 | INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE && |
| 345 | i915_modparams.enable_dpcd_backlight != 1 && | ||
| 345 | !drm_dp_has_quirk(&intel_dp->desc, intel_dp->edid_quirks, | 346 | !drm_dp_has_quirk(&intel_dp->desc, intel_dp->edid_quirks, |
| 346 | DP_QUIRK_FORCE_DPCD_BACKLIGHT)) { | 347 | DP_QUIRK_FORCE_DPCD_BACKLIGHT)) { |
| 347 | DRM_DEV_INFO(dev->dev, | 348 | DRM_DEV_INFO(dev->dev, |
| @@ -1536,7 +1536,8 @@ bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port) · 1535 unmodified lines | |||
| 1536 | intel_de_write(i915, HDCP_RPRIME(i915, cpu_transcoder, port), ri.reg); | 1536 | intel_de_write(i915, HDCP_RPRIME(i915, cpu_transcoder, port), ri.reg); |
| 1537 | 1537 | ||
| 1538 | /* Wait for Ri prime match */ | 1538 | /* Wait for Ri prime match */ |
| 1539 | if (wait_for(intel_de_read(i915, HDCP_STATUS(i915, cpu_transcoder, port)) & | 1539 | if (wait_for((intel_de_read(i915, HDCP_STATUS(i915, cpu_transcoder, port)) & |
| 1540 | (HDCP_STATUS_RI_MATCH | HDCP_STATUS_ENC)) == | ||
| 1540 | (HDCP_STATUS_RI_MATCH | HDCP_STATUS_ENC), 1)) { | 1541 | (HDCP_STATUS_RI_MATCH | HDCP_STATUS_ENC), 1)) { |
| 1541 | DRM_ERROR("Ri' mismatch detected, link check failed (%x)\n", | 1542 | DRM_ERROR("Ri' mismatch detected, link check failed (%x)\n", |
| 1542 | intel_de_read(i915, HDCP_STATUS(i915, cpu_transcoder, port))); | 1543 | intel_de_read(i915, HDCP_STATUS(i915, cpu_transcoder, port))); |
| @@ -2817,19 +2817,25 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane, · 2816 unmodified lines | |||
| 2817 | } | 2817 | } |
| 2818 | } | 2818 | } |
| 2819 | 2819 | ||
| 2820 | static bool gen12_plane_supports_mc_ccs(enum plane_id plane_id) | 2820 | static bool gen12_plane_supports_mc_ccs(struct drm_i915_private *dev_priv, |
| 2821 | enum plane_id plane_id) | ||
| 2821 | { | 2822 | { |
| 2823 | /* Wa_14010477008:tgl[a0..c0] */ | ||
| 2824 | if (IS_TGL_REVID(dev_priv, TGL_REVID_A0, TGL_REVID_C0)) | ||
| 2825 | return false; | ||
| 2826 | |||
| 2822 | return plane_id < PLANE_SPRITE4; | 2827 | return plane_id < PLANE_SPRITE4; |
| 2823 | } | 2828 | } |
| 2824 | 2829 | ||
| 2825 | static bool gen12_plane_format_mod_supported(struct drm_plane *_plane, | 2830 | static bool gen12_plane_format_mod_supported(struct drm_plane *_plane, |
| 2826 | u32 format, u64 modifier) | 2831 | u32 format, u64 modifier) |
| 2827 | { | 2832 | { |
| 2833 | struct drm_i915_private *dev_priv = to_i915(_plane->dev); | ||
| 2828 | struct intel_plane *plane = to_intel_plane(_plane); | 2834 | struct intel_plane *plane = to_intel_plane(_plane); |
| 2829 | 2835 | ||
| 2830 | switch (modifier) { | 2836 | switch (modifier) { |
| 2831 | case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS: | 2837 | case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS: |
| 2832 | if (!gen12_plane_supports_mc_ccs(plane->id)) | 2838 | if (!gen12_plane_supports_mc_ccs(dev_priv, plane->id)) |
| 2833 | return false; | 2839 | return false; |
| 2834 | /* fall through */ | 2840 | /* fall through */ |
| 2835 | case DRM_FORMAT_MOD_LINEAR: | 2841 | case DRM_FORMAT_MOD_LINEAR: |
| @@ -2998,9 +3004,10 @@ static const u32 *icl_get_plane_formats(struct drm_i915_private *dev_priv, · 162 unmodified lines | |||
| 2998 | } | 3004 | } |
| 2999 | } | 3005 | } |
| 3000 | 3006 | ||
| 3001 | static const u64 *gen12_get_plane_modifiers(enum plane_id plane_id) | 3007 | static const u64 *gen12_get_plane_modifiers(struct drm_i915_private *dev_priv, |
| 3008 | enum plane_id plane_id) | ||
| 3002 | { | 3009 | { |
| 3003 | if (gen12_plane_supports_mc_ccs(plane_id)) | 3010 | if (gen12_plane_supports_mc_ccs(dev_priv, plane_id)) |
| 3004 | return gen12_plane_format_modifiers_mc_ccs; | 3011 | return gen12_plane_format_modifiers_mc_ccs; |
| 3005 | else | 3012 | else |
| 3006 | return gen12_plane_format_modifiers_rc_ccs; | 3013 | return gen12_plane_format_modifiers_rc_ccs; |
| @@ -3070,7 +3077,7 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv, · 63 unmodified lines | |||
| 3070 | 3077 | ||
| 3071 | plane->has_ccs = skl_plane_has_ccs(dev_priv, pipe, plane_id); | 3078 | plane->has_ccs = skl_plane_has_ccs(dev_priv, pipe, plane_id); |
| 3072 | if (INTEL_GEN(dev_priv) >= 12) { | 3079 | if (INTEL_GEN(dev_priv) >= 12) { |
| 3073 | modifiers = gen12_get_plane_modifiers(plane_id); | 3080 | modifiers = gen12_get_plane_modifiers(dev_priv, plane_id); |
| 3074 | plane_funcs = &gen12_plane_funcs; | 3081 | plane_funcs = &gen12_plane_funcs; |
| 3075 | } else { | 3082 | } else { |
| 3076 | if (plane->has_ccs) | 3083 | if (plane->has_ccs) |
| @@ -81,13 +81,14 @@ static void rps_enable_interrupts(struct intel_rps *rps) · 80 unmodified lines | |||
| 81 | events = (GEN6_PM_RP_UP_THRESHOLD | | 81 | events = (GEN6_PM_RP_UP_THRESHOLD | |
| 82 | GEN6_PM_RP_DOWN_THRESHOLD | | 82 | GEN6_PM_RP_DOWN_THRESHOLD | |
| 83 | GEN6_PM_RP_DOWN_TIMEOUT); | 83 | GEN6_PM_RP_DOWN_TIMEOUT); |
| 84 | |||
| 85 | WRITE_ONCE(rps->pm_events, events); | 84 | WRITE_ONCE(rps->pm_events, events); |
| 85 | |||
| 86 | spin_lock_irq(>->irq_lock); | 86 | spin_lock_irq(>->irq_lock); |
| 87 | gen6_gt_pm_enable_irq(gt, rps->pm_events); | 87 | gen6_gt_pm_enable_irq(gt, rps->pm_events); |
| 88 | spin_unlock_irq(>->irq_lock); | 88 | spin_unlock_irq(>->irq_lock); |
| 89 | 89 | ||
| 90 | set(gt->uncore, GEN6_PMINTRMSK, rps_pm_mask(rps, rps->cur_freq)); | 90 | intel_uncore_write(gt->uncore, |
| 91 | GEN6_PMINTRMSK, rps_pm_mask(rps, rps->last_freq)); | ||
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | static void gen6_rps_reset_interrupts(struct intel_rps *rps) | 94 | static void gen6_rps_reset_interrupts(struct intel_rps *rps) |
| @@ -120,7 +121,9 @@ static void rps_disable_interrupts(struct intel_rps *rps) · 26 unmodified lines | |||
| 120 | struct intel_gt *gt = rps_to_gt(rps); | 121 | struct intel_gt *gt = rps_to_gt(rps); |
| 121 | 122 | ||
| 122 | WRITE_ONCE(rps->pm_events, 0); | 123 | WRITE_ONCE(rps->pm_events, 0); |
| 123 | set(gt->uncore, GEN6_PMINTRMSK, rps_pm_sanitize_mask(rps, ~0u)); | 124 | |
| 125 | intel_uncore_write(gt->uncore, | ||
| 126 | GEN6_PMINTRMSK, rps_pm_sanitize_mask(rps, ~0u)); | ||
| 124 | 127 | ||
| 125 | spin_lock_irq(>->irq_lock); | 128 | spin_lock_irq(>->irq_lock); |
| 126 | gen6_gt_pm_disable_irq(gt, GEN6_PM_RPS_EVENTS); | 129 | gen6_gt_pm_disable_irq(gt, GEN6_PM_RPS_EVENTS); |
| @@ -131,6 +131,7 @@ struct kvmgt_vdev { · 130 unmodified lines | |||
| 131 | struct work_struct release_work; | 131 | struct work_struct release_work; |
| 132 | atomic_t released; | 132 | atomic_t released; |
| 133 | struct vfio_device *vfio_device; | 133 | struct vfio_device *vfio_device; |
| 134 | struct vfio_group *vfio_group; | ||
| 134 | }; | 135 | }; |
| 135 | 136 | ||
| 136 | static inline struct kvmgt_vdev *kvmgt_vdev(struct intel_vgpu *vgpu) | 137 | static inline struct kvmgt_vdev *kvmgt_vdev(struct intel_vgpu *vgpu) |
| @@ -151,6 +152,7 @@ static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, · 14 unmodified lines | |||
| 151 | unsigned long size) | 152 | unsigned long size) |
| 152 | { | 153 | { |
| 153 | struct drm_i915_private *i915 = vgpu->gvt->gt->i915; | 154 | struct drm_i915_private *i915 = vgpu->gvt->gt->i915; |
| 155 | struct kvmgt_vdev *vdev = kvmgt_vdev(vgpu); | ||
| 154 | int total_pages; | 156 | int total_pages; |
| 155 | int npage; | 157 | int npage; |
| 156 | int ret; | 158 | int ret; |
| @@ -160,7 +162,7 @@ static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, · 3 unmodified lines | |||
| 160 | for (npage = 0; npage < total_pages; npage++) { | 162 | for (npage = 0; npage < total_pages; npage++) { |
| 161 | unsigned long cur_gfn = gfn + npage; | 163 | unsigned long cur_gfn = gfn + npage; |
| 162 | 164 | ||
| 163 | ret = vfio_unpin_pages(mdev_dev(kvmgt_vdev(vgpu)->mdev), &cur_gfn, 1); | 165 | ret = vfio_group_unpin_pages(vdev->vfio_group, &cur_gfn, 1); |
| 164 | drm_WARN_ON(&i915->drm, ret != 1); | 166 | drm_WARN_ON(&i915->drm, ret != 1); |
| 165 | } | 167 | } |
| 166 | } | 168 | } |
| @@ -169,6 +171,7 @@ static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, · 2 unmodified lines | |||
| 169 | static int gvt_pin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, | 171 | static int gvt_pin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, |
| 170 | unsigned long size, struct page **page) | 172 | unsigned long size, struct page **page) |
| 171 | { | 173 | { |
| 174 | struct kvmgt_vdev *vdev = kvmgt_vdev(vgpu); | ||
| 172 | unsigned long base_pfn = 0; | 175 | unsigned long base_pfn = 0; |
| 173 | int total_pages; | 176 | int total_pages; |
| 174 | int npage; | 177 | int npage; |
| @@ -183,8 +186,8 @@ static int gvt_pin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, · 8 unmodified lines | |||
| 183 | unsigned long cur_gfn = gfn + npage; | 186 | unsigned long cur_gfn = gfn + npage; |
| 184 | unsigned long pfn; | 187 | unsigned long pfn; |
| 185 | 188 | ||
| 186 | ret = vfio_pin_pages(mdev_dev(kvmgt_vdev(vgpu)->mdev), &cur_gfn, 1, | 189 | ret = vfio_group_pin_pages(vdev->vfio_group, &cur_gfn, 1, |
| 187 | IOMMU_READ | IOMMU_WRITE, &pfn); | 190 | IOMMU_READ | IOMMU_WRITE, &pfn); |
| 188 | if (ret != 1) { | 191 | if (ret != 1) { |
| 189 | gvt_vgpu_err("vfio_pin_pages failed for gfn 0x%lx, ret %d\n", | 192 | gvt_vgpu_err("vfio_pin_pages failed for gfn 0x%lx, ret %d\n", |
| 190 | cur_gfn, ret); | 193 | cur_gfn, ret); |
| @@ -792,6 +795,7 @@ static int intel_vgpu_open(struct mdev_device *mdev) · 601 unmodified lines | |||
| 792 | struct kvmgt_vdev *vdev = kvmgt_vdev(vgpu); | 795 | struct kvmgt_vdev *vdev = kvmgt_vdev(vgpu); |
| 793 | unsigned long events; | 796 | unsigned long events; |
| 794 | int ret; | 797 | int ret; |
| 798 | struct vfio_group *vfio_group; | ||
| 795 | 799 | ||
| 796 | vdev->iommu_notifier.notifier_call = intel_vgpu_iommu_notifier; | 800 | vdev->iommu_notifier.notifier_call = intel_vgpu_iommu_notifier; |
| 797 | vdev->group_notifier.notifier_call = intel_vgpu_group_notifier; | 801 | vdev->group_notifier.notifier_call = intel_vgpu_group_notifier; |
| @@ -814,6 +818,14 @@ static int intel_vgpu_open(struct mdev_device *mdev) · 16 unmodified lines | |||
| 814 | goto undo_iommu; | 818 | goto undo_iommu; |
| 815 | } | 819 | } |
| 816 | 820 | ||
| 821 | vfio_group = vfio_group_get_external_user_from_dev(mdev_dev(mdev)); | ||
| 822 | if (IS_ERR_OR_NULL(vfio_group)) { | ||
| 823 | ret = !vfio_group ? -EFAULT : PTR_ERR(vfio_group); | ||
| 824 | gvt_vgpu_err("vfio_group_get_external_user_from_dev failed\n"); | ||
| 825 | goto undo_register; | ||
| 826 | } | ||
| 827 | vdev->vfio_group = vfio_group; | ||
| 828 | |||
| 817 | /* Take a module reference as mdev core doesn't take | 829 | /* Take a module reference as mdev core doesn't take |
| 818 | * a reference for vendor driver. | 830 | * a reference for vendor driver. |
| 819 | */ | 831 | */ |
| @@ -830,6 +842,10 @@ static int intel_vgpu_open(struct mdev_device *mdev) · 10 unmodified lines | |||
| 830 | return ret; | 842 | return ret; |
| 831 | 843 | ||
| 832 | undo_group: | 844 | undo_group: |
| 845 | vfio_group_put_external_user(vdev->vfio_group); | ||
| 846 | vdev->vfio_group = NULL; | ||
| 847 | |||
| 848 | undo_register: | ||
| 833 | vfio_unregister_notifier(mdev_dev(mdev), VFIO_GROUP_NOTIFY, | 849 | vfio_unregister_notifier(mdev_dev(mdev), VFIO_GROUP_NOTIFY, |
| 834 | &vdev->group_notifier); | 850 | &vdev->group_notifier); |
| 835 | 851 | ||
| @@ -884,6 +900,7 @@ static void __intel_vgpu_release(struct intel_vgpu *vgpu) · 48 unmodified lines | |||
| 884 | kvmgt_guest_exit(info); | 900 | kvmgt_guest_exit(info); |
| 885 | 901 | ||
| 886 | intel_vgpu_release_msi_eventfd_ctx(vgpu); | 902 | intel_vgpu_release_msi_eventfd_ctx(vgpu); |
| 903 | vfio_group_put_external_user(vdev->vfio_group); | ||
| 887 | 904 | ||
| 888 | vdev->kvm = NULL; | 905 | vdev->kvm = NULL; |
| 889 | vgpu->handle = 0; | 906 | vgpu->handle = 0; |
| @@ -2035,33 +2052,14 @@ static int kvmgt_rw_gpa(unsigned long handle, unsigned long gpa, · 1145 unmodified lines | |||
| 2035 | void *buf, unsigned long len, bool write) | 2052 | void *buf, unsigned long len, bool write) |
| 2036 | { | 2053 | { |
| 2037 | struct kvmgt_guest_info *info; | 2054 | struct kvmgt_guest_info *info; |
| 2038 | struct kvm *kvm; | ||
| 2039 | int idx, ret; | ||
| 2040 | bool kthread = current->mm == NULL; | ||
| 2041 | 2055 | ||
| 2042 | if (!handle_valid(handle)) | 2056 | if (!handle_valid(handle)) |
| 2043 | return -ESRCH; | 2057 | return -ESRCH; |
| 2044 | 2058 | ||
| 2045 | info = (struct kvmgt_guest_info *)handle; | 2059 | info = (struct kvmgt_guest_info *)handle; |
| 2046 | kvm = info->kvm; | ||
| 2047 | |||
| 2048 | if (kthread) { | ||
| 2049 | if (!mmget_not_zero(kvm->mm)) | ||
| 2050 | return -EFAULT; | ||
| 2051 | use_mm(kvm->mm); | ||
| 2052 | } | ||
| 2053 | |||
| 2054 | idx = srcu_read_lock(&kvm->srcu); | ||
| 2055 | ret = write ? kvm_write_guest(kvm, gpa, buf, len) : | ||
| 2056 | kvm_read_guest(kvm, gpa, buf, len); | ||
| 2057 | srcu_read_unlock(&kvm->srcu, idx); | ||
| 2058 | |||
| 2059 | if (kthread) { | ||
| 2060 | unuse_mm(kvm->mm); | ||
| 2061 | mmput(kvm->mm); | ||
| 2062 | } | ||
| 2063 | 2060 | ||
| 2064 | return ret; | 2061 | return vfio_dma_rw(kvmgt_vdev(info->vgpu)->vfio_group, |
| 2062 | gpa, buf, len, write); | ||
| 2065 | } | 2063 | } |
| 2066 | 2064 | ||
| 2067 | static int kvmgt_read_gpa(unsigned long handle, unsigned long gpa, | 2065 | static int kvmgt_read_gpa(unsigned long handle, unsigned long gpa, |
| @@ -1507,6 +1507,8 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915, · 1506 unmodified lines | |||
| 1507 | (IS_ICELAKE(p) && IS_REVID(p, since, until)) | 1507 | (IS_ICELAKE(p) && IS_REVID(p, since, until)) |
| 1508 | 1508 | ||
| 1509 | #define TGL_REVID_A0 0x0 | 1509 | #define TGL_REVID_A0 0x0 |
| 1510 | #define TGL_REVID_B0 0x1 | ||
| 1511 | #define TGL_REVID_C0 0x2 | ||
| 1510 | 1512 | ||
| 1511 | #define IS_TGL_REVID(p, since, until) \ | 1513 | #define IS_TGL_REVID(p, since, until) \ |
| 1512 | (IS_TIGERLAKE(p) && IS_REVID(p, since, until)) | 1514 | (IS_TIGERLAKE(p) && IS_REVID(p, since, until)) |
| @@ -2940,49 +2940,6 @@ void i915_oa_init_reg_state(const struct intel_context *ce, · 2939 unmodified lines | |||
| 2940 | gen8_update_reg_state_unlocked(ce, stream); | 2940 | gen8_update_reg_state_unlocked(ce, stream); |
| 2941 | } | 2941 | } |
| 2942 | 2942 | ||
| 2943 | /** | ||
| 2944 | * i915_perf_read_locked - &i915_perf_stream_ops->read with error normalisation | ||
| 2945 | * @stream: An i915 perf stream | ||
| 2946 | * @file: An i915 perf stream file | ||
| 2947 | * @buf: destination buffer given by userspace | ||
| 2948 | * @count: the number of bytes userspace wants to read | ||
| 2949 | * @ppos: (inout) file seek position (unused) | ||
| 2950 | * | ||
| 2951 | * Besides wrapping &i915_perf_stream_ops->read this provides a common place to | ||
| 2952 | * ensure that if we've successfully copied any data then reporting that takes | ||
| 2953 | * precedence over any internal error status, so the data isn't lost. | ||
| 2954 | * | ||
| 2955 | * For example ret will be -ENOSPC whenever there is more buffered data than | ||
| 2956 | * can be copied to userspace, but that's only interesting if we weren't able | ||
| 2957 | * to copy some data because it implies the userspace buffer is too small to | ||
| 2958 | * receive a single record (and we never split records). | ||
| 2959 | * | ||
| 2960 | * Another case with ret == -EFAULT is more of a grey area since it would seem | ||
| 2961 | * like bad form for userspace to ask us to overrun its buffer, but the user | ||
| 2962 | * knows best: | ||
| 2963 | * | ||
| 2964 | * http://yarchive.net/comp/linux/partial_reads_writes.html | ||
| 2965 | * | ||
| 2966 | * Returns: The number of bytes copied or a negative error code on failure. | ||
| 2967 | */ | ||
| 2968 | static ssize_t i915_perf_read_locked(struct i915_perf_stream *stream, | ||
| 2969 | struct file *file, | ||
| 2970 | char __user *buf, | ||
| 2971 | size_t count, | ||
| 2972 | loff_t *ppos) | ||
| 2973 | { | ||
| 2974 | /* Note we keep the offset (aka bytes read) separate from any | ||
| 2975 | * error status so that the final check for whether we return | ||
| 2976 | * the bytes read with a higher precedence than any error (see | ||
| 2977 | * comment below) doesn't need to be handled/duplicated in | ||
| 2978 | * stream->ops->read() implementations. | ||
| 2979 | */ | ||
| 2980 | size_t offset = 0; | ||
| 2981 | int ret = stream->ops->read(stream, buf, count, &offset); | ||
| 2982 | |||
| 2983 | return offset ?: (ret ?: -EAGAIN); | ||
| 2984 | } | ||
| 2985 | |||
| 2986 | /** | 2943 | /** |
| 2987 | * i915_perf_read - handles read() FOP for i915 perf stream FDs | 2944 | * i915_perf_read - handles read() FOP for i915 perf stream FDs |
| 2988 | * @file: An i915 perf stream file | 2945 | * @file: An i915 perf stream file |
| @@ -3008,7 +2965,8 @@ static ssize_t i915_perf_read(struct file *file, · 19 unmodified lines | |||
| 3008 | { | 2965 | { |
| 3009 | struct i915_perf_stream *stream = file->private_data; | 2966 | struct i915_perf_stream *stream = file->private_data; |
| 3010 | struct i915_perf *perf = stream->perf; | 2967 | struct i915_perf *perf = stream->perf; |
| 3011 | ssize_t ret; | 2968 | size_t offset = 0; |
| 2969 | int ret; | ||
| 3012 | 2970 | ||
| 3013 | /* To ensure it's handled consistently we simply treat all reads of a | 2971 | /* To ensure it's handled consistently we simply treat all reads of a |
| 3014 | * disabled stream as an error. In particular it might otherwise lead | 2972 | * disabled stream as an error. In particular it might otherwise lead |
| @@ -3031,13 +2989,12 @@ static ssize_t i915_perf_read(struct file *file, · 16 unmodified lines | |||
| 3031 | return ret; | 2989 | return ret; |
| 3032 | 2990 | ||
| 3033 | mutex_lock(&perf->lock); | 2991 | mutex_lock(&perf->lock); |
| 3034 | ret = i915_perf_read_locked(stream, file, | 2992 | ret = stream->ops->read(stream, buf, count, &offset); |
| 3035 | buf, count, ppos); | ||
| 3036 | mutex_unlock(&perf->lock); | 2993 | mutex_unlock(&perf->lock); |
| 3037 | } while (ret == -EAGAIN); | 2994 | } while (!offset && !ret); |
| 3038 | } else { | 2995 | } else { |
| 3039 | mutex_lock(&perf->lock); | 2996 | mutex_lock(&perf->lock); |
| 3040 | ret = i915_perf_read_locked(stream, file, buf, count, ppos); | 2997 | ret = stream->ops->read(stream, buf, count, &offset); |
| 3041 | mutex_unlock(&perf->lock); | 2998 | mutex_unlock(&perf->lock); |
| 3042 | } | 2999 | } |
| 3043 | 3000 | ||
| @@ -3048,15 +3005,15 @@ static ssize_t i915_perf_read(struct file *file, · 4 unmodified lines | |||
| 3048 | * and read() returning -EAGAIN. Clearing the oa.pollin state here | 3005 | * and read() returning -EAGAIN. Clearing the oa.pollin state here |
| 3049 | * effectively ensures we back off until the next hrtimer callback | 3006 | * effectively ensures we back off until the next hrtimer callback |
| 3050 | * before reporting another EPOLLIN event. | 3007 | * before reporting another EPOLLIN event. |
| 3008 | * The exception to this is if ops->read() returned -ENOSPC which means | ||
| 3009 | * that more OA data is available than could fit in the user provided | ||
| 3010 | * buffer. In this case we want the next poll() call to not block. | ||
| 3051 | */ | 3011 | */ |
| 3052 | if (ret >= 0 || ret == -EAGAIN) { | 3012 | if (ret != -ENOSPC) |
| 3053 | /* Maybe make ->pollin per-stream state if we support multiple | ||
| 3054 | * concurrent streams in the future. | ||
| 3055 | */ | ||
| 3056 | stream->pollin = false; | 3013 | stream->pollin = false; |
| 3057 | } | ||
| 3058 | 3014 | ||
| 3059 | return ret; | 3015 | /* Possible values for ret are 0, -EFAULT, -ENOSPC, -EIO, ... */ |
| 3016 | return offset ?: (ret ?: -EAGAIN); | ||
| 3060 | } | 3017 | } |
| 3061 | 3018 | ||
| 3062 | static enum hrtimer_restart oa_poll_check_timer_cb(struct hrtimer *hrtimer) | 3019 | static enum hrtimer_restart oa_poll_check_timer_cb(struct hrtimer *hrtimer) |
| @@ -34,8 +34,8 @@ · 33 unmodified lines | |||
| 34 | * Follow the style described here for new macros, and while changing existing | 34 | * Follow the style described here for new macros, and while changing existing |
| 35 | * macros. Do **not** mass change existing definitions just to update the style. | 35 | * macros. Do **not** mass change existing definitions just to update the style. |
| 36 | * | 36 | * |
| 37 | * Layout | 37 | * File Layout |
| 38 | * ~~~~~~ | 38 | * ~~~~~~~~~~~ |
| 39 | * | 39 | * |
| 40 | * Keep helper macros near the top. For example, _PIPE() and friends. | 40 | * Keep helper macros near the top. For example, _PIPE() and friends. |
| 41 | * | 41 | * |
| @@ -1034,10 +1034,8 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, · 1033 unmodified lines | |||
| 1034 | return PTR_ERR(dw_plat_data->regm); | 1034 | return PTR_ERR(dw_plat_data->regm); |
| 1035 | 1035 | ||
| 1036 | irq = platform_get_irq(pdev, 0); | 1036 | irq = platform_get_irq(pdev, 0); |
| 1037 | if (irq < 0) { | 1037 | if (irq < 0) |
| 1038 | dev_err(dev, "Failed to get hdmi top irq\n"); | ||
| 1039 | return irq; | 1038 | return irq; |
| 1040 | } | ||
| 1041 | 1039 | ||
| 1042 | ret = devm_request_threaded_irq(dev, irq, dw_hdmi_top_irq, | 1040 | ret = devm_request_threaded_irq(dev, irq, dw_hdmi_top_irq, |
| 1043 | dw_hdmi_top_thread_irq, IRQF_SHARED, | 1041 | dw_hdmi_top_thread_irq, IRQF_SHARED, |
| @@ -25,6 +25,9 @@ · 24 unmodified lines | |||
| 25 | MODULE_FIRMWARE("nvidia/gp108/sec2/desc.bin"); | 25 | MODULE_FIRMWARE("nvidia/gp108/sec2/desc.bin"); |
| 26 | MODULE_FIRMWARE("nvidia/gp108/sec2/image.bin"); | 26 | MODULE_FIRMWARE("nvidia/gp108/sec2/image.bin"); |
| 27 | MODULE_FIRMWARE("nvidia/gp108/sec2/sig.bin"); | 27 | MODULE_FIRMWARE("nvidia/gp108/sec2/sig.bin"); |
| 28 | MODULE_FIRMWARE("nvidia/gv100/sec2/desc.bin"); | ||
| 29 | MODULE_FIRMWARE("nvidia/gv100/sec2/image.bin"); | ||
| 30 | MODULE_FIRMWARE("nvidia/gv100/sec2/sig.bin"); | ||
| 28 | 31 | ||
| 29 | static const struct nvkm_sec2_fwif | 32 | static const struct nvkm_sec2_fwif |
| 30 | gp108_sec2_fwif[] = { | 33 | gp108_sec2_fwif[] = { |
| @@ -56,6 +56,22 @@ tu102_sec2_nofw(struct nvkm_sec2 *sec2, int ver, · 55 unmodified lines | |||
| 56 | return 0; | 56 | return 0; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | MODULE_FIRMWARE("nvidia/tu102/sec2/desc.bin"); | ||
| 60 | MODULE_FIRMWARE("nvidia/tu102/sec2/image.bin"); | ||
| 61 | MODULE_FIRMWARE("nvidia/tu102/sec2/sig.bin"); | ||
| 62 | MODULE_FIRMWARE("nvidia/tu104/sec2/desc.bin"); | ||
| 63 | MODULE_FIRMWARE("nvidia/tu104/sec2/image.bin"); | ||
| 64 | MODULE_FIRMWARE("nvidia/tu104/sec2/sig.bin"); | ||
| 65 | MODULE_FIRMWARE("nvidia/tu106/sec2/desc.bin"); | ||
| 66 | MODULE_FIRMWARE("nvidia/tu106/sec2/image.bin"); | ||
| 67 | MODULE_FIRMWARE("nvidia/tu106/sec2/sig.bin"); | ||
| 68 | MODULE_FIRMWARE("nvidia/tu116/sec2/desc.bin"); | ||
| 69 | MODULE_FIRMWARE("nvidia/tu116/sec2/image.bin"); | ||
| 70 | MODULE_FIRMWARE("nvidia/tu116/sec2/sig.bin"); | ||
| 71 | MODULE_FIRMWARE("nvidia/tu117/sec2/desc.bin"); | ||
| 72 | MODULE_FIRMWARE("nvidia/tu117/sec2/image.bin"); | ||
| 73 | MODULE_FIRMWARE("nvidia/tu117/sec2/sig.bin"); | ||
| 74 | |||
| 59 | static const struct nvkm_sec2_fwif | 75 | static const struct nvkm_sec2_fwif |
| 60 | tu102_sec2_fwif[] = { | 76 | tu102_sec2_fwif[] = { |
| 61 | { 0, gp102_sec2_load, &tu102_sec2, &gp102_sec2_acr_1 }, | 77 | { 0, gp102_sec2_load, &tu102_sec2, &gp102_sec2_acr_1 }, |
| @@ -676,7 +676,7 @@ drm_sched_get_cleanup_job(struct drm_gpu_scheduler *sched) · 675 unmodified lines | |||
| 676 | */ | 676 | */ |
| 677 | if ((sched->timeout != MAX_SCHEDULE_TIMEOUT && | 677 | if ((sched->timeout != MAX_SCHEDULE_TIMEOUT && |
| 678 | !cancel_delayed_work(&sched->work_tdr)) || | 678 | !cancel_delayed_work(&sched->work_tdr)) || |
| 679 | __kthread_should_park(sched->thread)) | 679 | kthread_should_park()) |
| 680 | return NULL; | 680 | return NULL; |
| 681 | 681 | ||
| 682 | spin_lock(&sched->job_list_lock); | 682 | spin_lock(&sched->job_list_lock); |
| @@ -379,9 +379,17 @@ static struct drm_crtc_state *tidss_crtc_duplicate_state(struct drm_crtc *crtc) · 378 unmodified lines | |||
| 379 | return &state->base; | 379 | return &state->base; |
| 380 | } | 380 | } |
| 381 | 381 | ||
| 382 | static void tidss_crtc_destroy(struct drm_crtc *crtc) | ||
| 383 | { | ||
| 384 | struct tidss_crtc *tcrtc = to_tidss_crtc(crtc); | ||
| 385 | |||
| 386 | drm_crtc_cleanup(crtc); | ||
| 387 | kfree(tcrtc); | ||
| 388 | } | ||
| 389 | |||
| 382 | static const struct drm_crtc_funcs tidss_crtc_funcs = { | 390 | static const struct drm_crtc_funcs tidss_crtc_funcs = { |
| 383 | .reset = tidss_crtc_reset, | 391 | .reset = tidss_crtc_reset, |
| 384 | .destroy = drm_crtc_cleanup, | 392 | .destroy = tidss_crtc_destroy, |
| 385 | .set_config = drm_atomic_helper_set_config, | 393 | .set_config = drm_atomic_helper_set_config, |
| 386 | .page_flip = drm_atomic_helper_page_flip, | 394 | .page_flip = drm_atomic_helper_page_flip, |
| 387 | .atomic_duplicate_state = tidss_crtc_duplicate_state, | 395 | .atomic_duplicate_state = tidss_crtc_duplicate_state, |
| @@ -400,7 +408,7 @@ struct tidss_crtc *tidss_crtc_create(struct tidss_device *tidss, · 12 unmodified lines | |||
| 400 | bool has_ctm = tidss->feat->vp_feat.color.has_ctm; | 408 | bool has_ctm = tidss->feat->vp_feat.color.has_ctm; |
| 401 | int ret; | 409 | int ret; |
| 402 | 410 | ||
| 403 | tcrtc = devm_kzalloc(tidss->dev, sizeof(*tcrtc), GFP_KERNEL); | 411 | tcrtc = kzalloc(sizeof(*tcrtc), GFP_KERNEL); |
| 404 | if (!tcrtc) | 412 | if (!tcrtc) |
| 405 | return ERR_PTR(-ENOMEM); | 413 | return ERR_PTR(-ENOMEM); |
| 406 | 414 | ||
| @@ -411,8 +419,10 @@ struct tidss_crtc *tidss_crtc_create(struct tidss_device *tidss, · 4 unmodified lines | |||
| 411 | 419 | ||
| 412 | ret = drm_crtc_init_with_planes(&tidss->ddev, crtc, primary, | 420 | ret = drm_crtc_init_with_planes(&tidss->ddev, crtc, primary, |
| 413 | NULL, &tidss_crtc_funcs, NULL); | 421 | NULL, &tidss_crtc_funcs, NULL); |
| 414 | if (ret < 0) | 422 | if (ret < 0) { |
| 423 | kfree(tcrtc); | ||
| 415 | return ERR_PTR(ret); | 424 | return ERR_PTR(ret); |
| 425 | } | ||
| 416 | 426 | ||
| 417 | drm_crtc_helper_add(crtc, &tidss_crtc_helper_funcs); | 427 | drm_crtc_helper_add(crtc, &tidss_crtc_helper_funcs); |
| 418 | 428 | ||
| @@ -55,12 +55,18 @@ static int tidss_encoder_atomic_check(struct drm_encoder *encoder, · 54 unmodified lines | |||
| 55 | return 0; | 55 | return 0; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | static void tidss_encoder_destroy(struct drm_encoder *encoder) | ||
| 59 | { | ||
| 60 | drm_encoder_cleanup(encoder); | ||
| 61 | kfree(encoder); | ||
| 62 | } | ||
| 63 | |||
| 58 | static const struct drm_encoder_helper_funcs encoder_helper_funcs = { | 64 | static const struct drm_encoder_helper_funcs encoder_helper_funcs = { |
| 59 | .atomic_check = tidss_encoder_atomic_check, | 65 | .atomic_check = tidss_encoder_atomic_check, |
| 60 | }; | 66 | }; |
| 61 | 67 | ||
| 62 | static const struct drm_encoder_funcs encoder_funcs = { | 68 | static const struct drm_encoder_funcs encoder_funcs = { |
| 63 | .destroy = drm_encoder_cleanup, | 69 | .destroy = tidss_encoder_destroy, |
| 64 | }; | 70 | }; |
| 65 | 71 | ||
| 66 | struct drm_encoder *tidss_encoder_create(struct tidss_device *tidss, | 72 | struct drm_encoder *tidss_encoder_create(struct tidss_device *tidss, |
| @@ -69,7 +75,7 @@ struct drm_encoder *tidss_encoder_create(struct tidss_device *tidss, · 2 unmodified lines | |||
| 69 | struct drm_encoder *enc; | 75 | struct drm_encoder *enc; |
| 70 | int ret; | 76 | int ret; |
| 71 | 77 | ||
| 72 | enc = devm_kzalloc(tidss->dev, sizeof(*enc), GFP_KERNEL); | 78 | enc = kzalloc(sizeof(*enc), GFP_KERNEL); |
| 73 | if (!enc) | 79 | if (!enc) |
| 74 | return ERR_PTR(-ENOMEM); | 80 | return ERR_PTR(-ENOMEM); |
| 75 | 81 | ||
| @@ -77,8 +83,10 @@ struct drm_encoder *tidss_encoder_create(struct tidss_device *tidss, · 1 unmodified line | |||
| 77 | 83 | ||
| 78 | ret = drm_encoder_init(&tidss->ddev, enc, &encoder_funcs, | 84 | ret = drm_encoder_init(&tidss->ddev, enc, &encoder_funcs, |
| 79 | encoder_type, NULL); | 85 | encoder_type, NULL); |
| 80 | if (ret < 0) | 86 | if (ret < 0) { |
| 87 | kfree(enc); | ||
| 81 | return ERR_PTR(ret); | 88 | return ERR_PTR(ret); |
| 89 | } | ||
| 82 | 90 | ||
| 83 | drm_encoder_helper_add(enc, &encoder_helper_funcs); | 91 | drm_encoder_helper_add(enc, &encoder_helper_funcs); |
| 84 | 92 | ||
| @@ -141,6 +141,14 @@ static void tidss_plane_atomic_disable(struct drm_plane *plane, · 140 unmodified lines | |||
| 141 | dispc_plane_enable(tidss->dispc, tplane->hw_plane_id, false); | 141 | dispc_plane_enable(tidss->dispc, tplane->hw_plane_id, false); |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | static void drm_plane_destroy(struct drm_plane *plane) | ||
| 145 | { | ||
| 146 | struct tidss_plane *tplane = to_tidss_plane(plane); | ||
| 147 | |||
| 148 | drm_plane_cleanup(plane); | ||
| 149 | kfree(tplane); | ||
| 150 | } | ||
| 151 | |||
| 144 | static const struct drm_plane_helper_funcs tidss_plane_helper_funcs = { | 152 | static const struct drm_plane_helper_funcs tidss_plane_helper_funcs = { |
| 145 | .atomic_check = tidss_plane_atomic_check, | 153 | .atomic_check = tidss_plane_atomic_check, |
| 146 | .atomic_update = tidss_plane_atomic_update, | 154 | .atomic_update = tidss_plane_atomic_update, |
| @@ -151,7 +159,7 @@ static const struct drm_plane_funcs tidss_plane_funcs = { · 4 unmodified lines | |||
| 151 | .update_plane = drm_atomic_helper_update_plane, | 159 | .update_plane = drm_atomic_helper_update_plane, |
| 152 | .disable_plane = drm_atomic_helper_disable_plane, | 160 | .disable_plane = drm_atomic_helper_disable_plane, |
| 153 | .reset = drm_atomic_helper_plane_reset, | 161 | .reset = drm_atomic_helper_plane_reset, |
| 154 | .destroy = drm_plane_cleanup, | 162 | .destroy = drm_plane_destroy, |
| 155 | .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, | 163 | .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, |
| 156 | .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, | 164 | .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, |
| 157 | }; | 165 | }; |
| @@ -175,7 +183,7 @@ struct tidss_plane *tidss_plane_create(struct tidss_device *tidss, · 17 unmodified lines | |||
| 175 | BIT(DRM_MODE_BLEND_COVERAGE)); | 183 | BIT(DRM_MODE_BLEND_COVERAGE)); |
| 176 | int ret; | 184 | int ret; |
| 177 | 185 | ||
| 178 | tplane = devm_kzalloc(tidss->dev, sizeof(*tplane), GFP_KERNEL); | 186 | tplane = kzalloc(sizeof(*tplane), GFP_KERNEL); |
| 179 | if (!tplane) | 187 | if (!tplane) |
| 180 | return ERR_PTR(-ENOMEM); | 188 | return ERR_PTR(-ENOMEM); |
| 181 | 189 | ||
| @@ -190,7 +198,7 @@ struct tidss_plane *tidss_plane_create(struct tidss_device *tidss, · 8 unmodified lines | |||
| 190 | formats, num_formats, | 198 | formats, num_formats, |
| 191 | NULL, type, NULL); | 199 | NULL, type, NULL); |
| 192 | if (ret < 0) | 200 | if (ret < 0) |
| 193 | return ERR_PTR(ret); | 201 | goto err; |
| 194 | 202 | ||
| 195 | drm_plane_helper_add(&tplane->plane, &tidss_plane_helper_funcs); | 203 | drm_plane_helper_add(&tplane->plane, &tidss_plane_helper_funcs); |
| 196 | 204 | ||
| @@ -203,15 +211,19 @@ struct tidss_plane *tidss_plane_create(struct tidss_device *tidss, · 6 unmodified lines | |||
| 203 | default_encoding, | 211 | default_encoding, |
| 204 | default_range); | 212 | default_range); |
| 205 | if (ret) | 213 | if (ret) |
| 206 | return ERR_PTR(ret); | 214 | goto err; |
| 207 | 215 | ||
| 208 | ret = drm_plane_create_alpha_property(&tplane->plane); | 216 | ret = drm_plane_create_alpha_property(&tplane->plane); |
| 209 | if (ret) | 217 | if (ret) |
| 210 | return ERR_PTR(ret); | 218 | goto err; |
| 211 | 219 | ||
| 212 | ret = drm_plane_create_blend_mode_property(&tplane->plane, blend_modes); | 220 | ret = drm_plane_create_blend_mode_property(&tplane->plane, blend_modes); |
| 213 | if (ret) | 221 | if (ret) |
| 214 | return ERR_PTR(ret); | 222 | goto err; |
| 215 | 223 | ||
| 216 | return tplane; | 224 | return tplane; |
| 225 | |||
| 226 | err: | ||
| 227 | kfree(tplane); | ||
| 228 | return ERR_PTR(ret); | ||
| 217 | } | 229 | } |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | |||
| 27 | 27 | ||
| 28 | #include <linux/file.h> | 28 | #include <linux/file.h> |
| 29 | #include <linux/sync_file.h> | 29 | #include <linux/sync_file.h> |
| 30 | #include <linux/uaccess.h> | ||
| 30 | 31 | ||
| 31 | #include <drm/drm_file.h> | 32 | #include <drm/drm_file.h> |
| 32 | #include <drm/virtgpu_drm.h> | 33 | #include <drm/virtgpu_drm.h> |
| @@ -25,6 +25,7 @@ · 24 unmodified lines | |||
| 25 | 25 | ||
| 26 | #include <linux/virtio.h> | 26 | #include <linux/virtio.h> |
| 27 | #include <linux/virtio_config.h> | 27 | #include <linux/virtio_config.h> |
| 28 | #include <linux/virtio_ring.h> | ||
| 28 | 29 | ||
| 29 | #include <drm/drm_file.h> | 30 | #include <drm/drm_file.h> |
| 30 | 31 | ||
| @@ -839,6 +839,9 @@ void vmbus_initiate_unload(bool crash) · 838 unmodified lines | |||
| 839 | { | 839 | { |
| 840 | struct vmbus_channel_message_header hdr; | 840 | struct vmbus_channel_message_header hdr; |
| 841 | 841 | ||
| 842 | if (xchg(&vmbus_connection.conn_state, DISCONNECTED) == DISCONNECTED) | ||
| 843 | return; | ||
| 844 | |||
| 842 | /* Pre-Win2012R2 hosts don't support reconnect */ | 845 | /* Pre-Win2012R2 hosts don't support reconnect */ |
| 843 | if (vmbus_proto_version < VERSION_WIN8_1) | 846 | if (vmbus_proto_version < VERSION_WIN8_1) |
| 844 | return; | 847 | return; |
| @@ -11,7 +11,7 @@ · 10 unmodified lines | |||
| 11 | 11 | ||
| 12 | #include "hyperv_vmbus.h" | 12 | #include "hyperv_vmbus.h" |
| 13 | 13 | ||
| 14 | struct dentry *hv_debug_root; | 14 | static struct dentry *hv_debug_root; |
| 15 | 15 | ||
| 16 | static int hv_debugfs_delay_get(void *data, u64 *val) | 16 | static int hv_debugfs_delay_get(void *data, u64 *val) |
| 17 | { | 17 | { |
| @@ -292,7 +292,7 @@ struct vmbus_msginfo { · 291 unmodified lines | |||
| 292 | struct list_head msglist_entry; | 292 | struct list_head msglist_entry; |
| 293 | 293 | ||
| 294 | /* The message itself */ | 294 | /* The message itself */ |
| 295 | unsigned char msg[0]; | 295 | unsigned char msg[]; |
| 296 | }; | 296 | }; |
| 297 | 297 | ||
| 298 | 298 | ||
| @@ -31,6 +31,7 @@ · 30 unmodified lines | |||
| 31 | #include <linux/kdebug.h> | 31 | #include <linux/kdebug.h> |
| 32 | #include <linux/efi.h> | 32 | #include <linux/efi.h> |
| 33 | #include <linux/random.h> | 33 | #include <linux/random.h> |
| 34 | #include <linux/kernel.h> | ||
| 34 | #include <linux/syscore_ops.h> | 35 | #include <linux/syscore_ops.h> |
| 35 | #include <clocksource/hyperv_timer.h> | 36 | #include <clocksource/hyperv_timer.h> |
| 36 | #include "hyperv_vmbus.h" | 37 | #include "hyperv_vmbus.h" |
| @@ -48,14 +49,35 @@ static int hyperv_cpuhp_online; · 11 unmodified lines | |||
| 48 | 49 | ||
| 49 | static void *hv_panic_page; | 50 | static void *hv_panic_page; |
| 50 | 51 | ||
| 52 | /* | ||
| 53 | * Boolean to control whether to report panic messages over Hyper-V. | ||
| 54 | * | ||
| 55 | * It can be set via /proc/sys/kernel/hyperv/record_panic_msg | ||
| 56 | */ | ||
| 57 | static int sysctl_record_panic_msg = 1; | ||
| 58 | |||
| 59 | static int hyperv_report_reg(void) | ||
| 60 | { | ||
| 61 | return !sysctl_record_panic_msg || !hv_panic_page; | ||
| 62 | } | ||
| 63 | |||
| 51 | static int hyperv_panic_event(struct notifier_block *nb, unsigned long val, | 64 | static int hyperv_panic_event(struct notifier_block *nb, unsigned long val, |
| 52 | void *args) | 65 | void *args) |
| 53 | { | 66 | { |
| 54 | struct pt_regs *regs; | 67 | struct pt_regs *regs; |
| 55 | 68 | ||
| 56 | regs = current_pt_regs(); | 69 | vmbus_initiate_unload(true); |
| 57 | 70 | ||
| 58 | hyperv_report_panic(regs, val); | 71 | /* |
| 72 | * Hyper-V should be notified only once about a panic. If we will be | ||
| 73 | * doing hyperv_report_panic_msg() later with kmsg data, don't do | ||
| 74 | * the notification here. | ||
| 75 | */ | ||
| 76 | if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE | ||
| 77 | && hyperv_report_reg()) { | ||
| 78 | regs = current_pt_regs(); | ||
| 79 | hyperv_report_panic(regs, val, false); | ||
| 80 | } | ||
| 59 | return NOTIFY_DONE; | 81 | return NOTIFY_DONE; |
| 60 | } | 82 | } |
| 61 | 83 | ||
| @@ -65,7 +87,13 @@ static int hyperv_die_event(struct notifier_block *nb, unsigned long val, · 3 unmodified lines | |||
| 65 | struct die_args *die = (struct die_args *)args; | 87 | struct die_args *die = (struct die_args *)args; |
| 66 | struct pt_regs *regs = die->regs; | 88 | struct pt_regs *regs = die->regs; |
| 67 | 89 | ||
| 68 | hyperv_report_panic(regs, val); | 90 | /* |
| 91 | * Hyper-V should be notified only once about a panic. If we will be | ||
| 92 | * doing hyperv_report_panic_msg() later with kmsg data, don't do | ||
| 93 | * the notification here. | ||
| 94 | */ | ||
| 95 | if (hyperv_report_reg()) | ||
| 96 | hyperv_report_panic(regs, val, true); | ||
| 69 | return NOTIFY_DONE; | 97 | return NOTIFY_DONE; |
| 70 | } | 98 | } |
| 71 | 99 | ||
| @@ -1252,13 +1280,6 @@ static void vmbus_isr(void) · 1180 unmodified lines | |||
| 1252 | add_interrupt_randomness(HYPERVISOR_CALLBACK_VECTOR, 0); | 1280 | add_interrupt_randomness(HYPERVISOR_CALLBACK_VECTOR, 0); |
| 1253 | } | 1281 | } |
| 1254 | 1282 | ||
| 1255 | /* | ||
| 1256 | * Boolean to control whether to report panic messages over Hyper-V. | ||
| 1257 | * | ||
| 1258 | * It can be set via /proc/sys/kernel/hyperv/record_panic_msg | ||
| 1259 | */ | ||
| 1260 | static int sysctl_record_panic_msg = 1; | ||
| 1261 | |||
| 1262 | /* | 1283 | /* |
| 1263 | * Callback from kmsg_dump. Grab as much as possible from the end of the kmsg | 1284 | * Callback from kmsg_dump. Grab as much as possible from the end of the kmsg |
| 1264 | * buffer and call into Hyper-V to transfer the data. | 1285 | * buffer and call into Hyper-V to transfer the data. |
| @@ -1382,19 +1403,29 @@ static int vmbus_bus_init(void) · 117 unmodified lines | |||
| 1382 | hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page(); | 1403 | hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page(); |
| 1383 | if (hv_panic_page) { | 1404 | if (hv_panic_page) { |
| 1384 | ret = kmsg_dump_register(&hv_kmsg_dumper); | 1405 | ret = kmsg_dump_register(&hv_kmsg_dumper); |
| 1385 | if (ret) | 1406 | if (ret) { |
| 1386 | pr_err("Hyper-V: kmsg dump register " | 1407 | pr_err("Hyper-V: kmsg dump register " |
| 1387 | "error 0x%x\n", ret); | 1408 | "error 0x%x\n", ret); |
| 1409 | hv_free_hyperv_page( | ||
| 1410 | (unsigned long)hv_panic_page); | ||
| 1411 | hv_panic_page = NULL; | ||
| 1412 | } | ||
| 1388 | } else | 1413 | } else |
| 1389 | pr_err("Hyper-V: panic message page memory " | 1414 | pr_err("Hyper-V: panic message page memory " |
| 1390 | "allocation failed"); | 1415 | "allocation failed"); |
| 1391 | } | 1416 | } |
| 1392 | 1417 | ||
| 1393 | register_die_notifier(&hyperv_die_block); | 1418 | register_die_notifier(&hyperv_die_block); |
| 1394 | atomic_notifier_chain_register(&panic_notifier_list, | ||
| 1395 | &hyperv_panic_block); | ||
| 1396 | } | 1419 | } |
| 1397 | 1420 | ||
| 1421 | /* | ||
| 1422 | * Always register the panic notifier because we need to unload | ||
| 1423 | * the VMbus channel connection to prevent any VMbus | ||
| 1424 | * activity after the VM panics. | ||
| 1425 | */ | ||
| 1426 | atomic_notifier_chain_register(&panic_notifier_list, | ||
| 1427 | &hyperv_panic_block); | ||
| 1428 | |||
| 1398 | vmbus_request_offers(); | 1429 | vmbus_request_offers(); |
| 1399 | 1430 | ||
| 1400 | return 0; | 1431 | return 0; |
| @@ -1407,7 +1438,6 @@ err_alloc: · 6 unmodified lines | |||
| 1407 | hv_remove_vmbus_irq(); | 1438 | hv_remove_vmbus_irq(); |
| 1408 | 1439 | ||
| 1409 | bus_unregister(&hv_bus); | 1440 | bus_unregister(&hv_bus); |
| 1410 | hv_free_hyperv_page((unsigned long)hv_panic_page); | ||
| 1411 | unregister_sysctl_table(hv_ctl_table_hdr); | 1441 | unregister_sysctl_table(hv_ctl_table_hdr); |
| 1412 | hv_ctl_table_hdr = NULL; | 1442 | hv_ctl_table_hdr = NULL; |
| 1413 | return ret; | 1443 | return ret; |
| @@ -2204,8 +2234,6 @@ static int vmbus_bus_suspend(struct device *dev) · 790 unmodified lines | |||
| 2204 | 2234 | ||
| 2205 | vmbus_initiate_unload(false); | 2235 | vmbus_initiate_unload(false); |
| 2206 | 2236 | ||
| 2207 | vmbus_connection.conn_state = DISCONNECTED; | ||
| 2208 | |||
| 2209 | /* Reset the event for the next resume. */ | 2237 | /* Reset the event for the next resume. */ |
| 2210 | reinit_completion(&vmbus_connection.ready_for_resume_event); | 2238 | reinit_completion(&vmbus_connection.ready_for_resume_event); |
| 2211 | 2239 | ||
| @@ -2289,7 +2317,6 @@ static void hv_kexec_handler(void) · 77 unmodified lines | |||
| 2289 | { | 2317 | { |
| 2290 | hv_stimer_global_cleanup(); | 2318 | hv_stimer_global_cleanup(); |
| 2291 | vmbus_initiate_unload(false); | 2319 | vmbus_initiate_unload(false); |
| 2292 | vmbus_connection.conn_state = DISCONNECTED; | ||
| 2293 | /* Make sure conn_state is set as hv_synic_cleanup checks for it */ | 2320 | /* Make sure conn_state is set as hv_synic_cleanup checks for it */ |
| 2294 | mb(); | 2321 | mb(); |
| 2295 | cpuhp_remove_state(hyperv_cpuhp_online); | 2322 | cpuhp_remove_state(hyperv_cpuhp_online); |
| @@ -2306,7 +2333,6 @@ static void hv_crash_handler(struct pt_regs *regs) · 10 unmodified lines | |||
| 2306 | * doing the cleanup for current CPU only. This should be sufficient | 2333 | * doing the cleanup for current CPU only. This should be sufficient |
| 2307 | * for kdump. | 2334 | * for kdump. |
| 2308 | */ | 2335 | */ |
| 2309 | vmbus_connection.conn_state = DISCONNECTED; | ||
| 2310 | cpu = smp_processor_id(); | 2336 | cpu = smp_processor_id(); |
| 2311 | hv_stimer_cleanup(cpu); | 2337 | hv_stimer_cleanup(cpu); |
| 2312 | hv_synic_disable_regs(cpu); | 2338 | hv_synic_disable_regs(cpu); |
| @@ -412,7 +412,7 @@ config SENSORS_DRIVETEMP · 411 unmodified lines | |||
| 412 | hard disk drives. | 412 | hard disk drives. |
| 413 | 413 | ||
| 414 | This driver can also be built as a module. If so, the module | 414 | This driver can also be built as a module. If so, the module |
| 415 | will be called satatemp. | 415 | will be called drivetemp. |
| 416 | 416 | ||
| 417 | config SENSORS_DS620 | 417 | config SENSORS_DS620 |
| 418 | tristate "Dallas Semiconductor DS620" | 418 | tristate "Dallas Semiconductor DS620" |
| @@ -264,12 +264,18 @@ static int drivetemp_get_scttemp(struct drivetemp_data *st, u32 attr, long *val) · 263 unmodified lines | |||
| 264 | return err; | 264 | return err; |
| 265 | switch (attr) { | 265 | switch (attr) { |
| 266 | case hwmon_temp_input: | 266 | case hwmon_temp_input: |
| 267 | if (!temp_is_valid(buf[SCT_STATUS_TEMP])) | ||
| 268 | return -ENODATA; | ||
| 267 | *val = temp_from_sct(buf[SCT_STATUS_TEMP]); | 269 | *val = temp_from_sct(buf[SCT_STATUS_TEMP]); |
| 268 | break; | 270 | break; |
| 269 | case hwmon_temp_lowest: | 271 | case hwmon_temp_lowest: |
| 272 | if (!temp_is_valid(buf[SCT_STATUS_TEMP_LOWEST])) | ||
| 273 | return -ENODATA; | ||
| 270 | *val = temp_from_sct(buf[SCT_STATUS_TEMP_LOWEST]); | 274 | *val = temp_from_sct(buf[SCT_STATUS_TEMP_LOWEST]); |
| 271 | break; | 275 | break; |
| 272 | case hwmon_temp_highest: | 276 | case hwmon_temp_highest: |
| 277 | if (!temp_is_valid(buf[SCT_STATUS_TEMP_HIGHEST])) | ||
| 278 | return -ENODATA; | ||
| 273 | *val = temp_from_sct(buf[SCT_STATUS_TEMP_HIGHEST]); | 279 | *val = temp_from_sct(buf[SCT_STATUS_TEMP_HIGHEST]); |
| 274 | break; | 280 | break; |
| 275 | default: | 281 | default: |
| @@ -506,7 +506,7 @@ static int jc42_probe(struct i2c_client *client, const struct i2c_device_id *id) · 505 unmodified lines | |||
| 506 | } | 506 | } |
| 507 | data->config = config; | 507 | data->config = config; |
| 508 | 508 | ||
| 509 | hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, | 509 | hwmon_dev = devm_hwmon_device_register_with_info(dev, "jc42", |
| 510 | data, &jc42_chip_info, | 510 | data, &jc42_chip_info, |
| 511 | NULL); | 511 | NULL); |
| 512 | return PTR_ERR_OR_ZERO(hwmon_dev); | 512 | return PTR_ERR_OR_ZERO(hwmon_dev); |
| @@ -186,7 +186,7 @@ static long get_raw_temp(struct k10temp_data *data) · 185 unmodified lines | |||
| 186 | return temp; | 186 | return temp; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | const char *k10temp_temp_label[] = { | 189 | static const char *k10temp_temp_label[] = { |
| 190 | "Tctl", | 190 | "Tctl", |
| 191 | "Tdie", | 191 | "Tdie", |
| 192 | "Tccd1", | 192 | "Tccd1", |
| @@ -199,12 +199,12 @@ const char *k10temp_temp_label[] = { · 6 unmodified lines | |||
| 199 | "Tccd8", | 199 | "Tccd8", |
| 200 | }; | 200 | }; |
| 201 | 201 | ||
| 202 | const char *k10temp_in_label[] = { | 202 | static const char *k10temp_in_label[] = { |
| 203 | "Vcore", | 203 | "Vcore", |
| 204 | "Vsoc", | 204 | "Vsoc", |
| 205 | }; | 205 | }; |
| 206 | 206 | ||
| 207 | const char *k10temp_curr_label[] = { | 207 | static const char *k10temp_curr_label[] = { |
| 208 | "Icore", | 208 | "Icore", |
| 209 | "Isoc", | 209 | "Isoc", |
| 210 | }; | 210 | }; |
| @@ -21,8 +21,50 @@ · 20 unmodified lines | |||
| 21 | #define ISL68137_VOUT_AVS 0x30 | 21 | #define ISL68137_VOUT_AVS 0x30 |
| 22 | #define RAA_DMPVR2_READ_VMON 0xc8 | 22 | #define RAA_DMPVR2_READ_VMON 0xc8 |
| 23 | 23 | ||
| 24 | enum versions { | 24 | enum chips { |
| 25 | isl68137, | 25 | isl68137, |
| 26 | isl68220, | ||
| 27 | isl68221, | ||
| 28 | isl68222, | ||
| 29 | isl68223, | ||
| 30 | isl68224, | ||
| 31 | isl68225, | ||
| 32 | isl68226, | ||
| 33 | isl68227, | ||
| 34 | isl68229, | ||
| 35 | isl68233, | ||
| 36 | isl68239, | ||
| 37 | isl69222, | ||
| 38 | isl69223, | ||
| 39 | isl69224, | ||
| 40 | isl69225, | ||
| 41 | isl69227, | ||
| 42 | isl69228, | ||
| 43 | isl69234, | ||
| 44 | isl69236, | ||
| 45 | isl69239, | ||
| 46 | isl69242, | ||
| 47 | isl69243, | ||
| 48 | isl69247, | ||
| 49 | isl69248, | ||
| 50 | isl69254, | ||
| 51 | isl69255, | ||
| 52 | isl69256, | ||
| 53 | isl69259, | ||
| 54 | isl69260, | ||
| 55 | isl69268, | ||
| 56 | isl69269, | ||
| 57 | isl69298, | ||
| 58 | raa228000, | ||
| 59 | raa228004, | ||
| 60 | raa228006, | ||
| 61 | raa228228, | ||
| 62 | raa229001, | ||
| 63 | raa229004, | ||
| 64 | }; | ||
| 65 | |||
| 66 | enum variants { | ||
| 67 | raa_dmpvr1_2rail, | ||
| 26 | raa_dmpvr2_1rail, | 68 | raa_dmpvr2_1rail, |
| 27 | raa_dmpvr2_2rail, | 69 | raa_dmpvr2_2rail, |
| 28 | raa_dmpvr2_3rail, | 70 | raa_dmpvr2_3rail, |
| @@ -186,7 +228,7 @@ static int isl68137_probe(struct i2c_client *client, · 157 unmodified lines | |||
| 186 | memcpy(info, &raa_dmpvr_info, sizeof(*info)); | 228 | memcpy(info, &raa_dmpvr_info, sizeof(*info)); |
| 187 | 229 | ||
| 188 | switch (id->driver_data) { | 230 | switch (id->driver_data) { |
| 189 | case isl68137: | 231 | case raa_dmpvr1_2rail: |
| 190 | info->pages = 2; | 232 | info->pages = 2; |
| 191 | info->R[PSC_VOLTAGE_IN] = 3; | 233 | info->R[PSC_VOLTAGE_IN] = 3; |
| 192 | info->func[0] &= ~PMBUS_HAVE_VMON; | 234 | info->func[0] &= ~PMBUS_HAVE_VMON; |
| @@ -224,11 +266,47 @@ static int isl68137_probe(struct i2c_client *client, · 31 unmodified lines | |||
| 224 | } | 266 | } |
| 225 | 267 | ||
| 226 | static const struct i2c_device_id raa_dmpvr_id[] = { | 268 | static const struct i2c_device_id raa_dmpvr_id[] = { |
| 227 | {"isl68137", isl68137}, | 269 | {"isl68137", raa_dmpvr1_2rail}, |
| 228 | {"raa_dmpvr2_1rail", raa_dmpvr2_1rail}, | 270 | {"isl68220", raa_dmpvr2_2rail}, |
| 229 | {"raa_dmpvr2_2rail", raa_dmpvr2_2rail}, | 271 | {"isl68221", raa_dmpvr2_3rail}, |
| 230 | {"raa_dmpvr2_3rail", raa_dmpvr2_3rail}, | 272 | {"isl68222", raa_dmpvr2_2rail}, |
| 231 | {"raa_dmpvr2_hv", raa_dmpvr2_hv}, | 273 | {"isl68223", raa_dmpvr2_2rail}, |
| 274 | {"isl68224", raa_dmpvr2_3rail}, | ||
| 275 | {"isl68225", raa_dmpvr2_2rail}, | ||
| 276 | {"isl68226", raa_dmpvr2_3rail}, | ||
| 277 | {"isl68227", raa_dmpvr2_1rail}, | ||
| 278 | {"isl68229", raa_dmpvr2_3rail}, | ||
| 279 | {"isl68233", raa_dmpvr2_2rail}, | ||
| 280 | {"isl68239", raa_dmpvr2_3rail}, | ||
| 281 | |||
| 282 | {"isl69222", raa_dmpvr2_2rail}, | ||
| 283 | {"isl69223", raa_dmpvr2_3rail}, | ||
| 284 | {"isl69224", raa_dmpvr2_2rail}, | ||
| 285 | {"isl69225", raa_dmpvr2_2rail}, | ||
| 286 | {"isl69227", raa_dmpvr2_3rail}, | ||
| 287 | {"isl69228", raa_dmpvr2_3rail}, | ||
| 288 | {"isl69234", raa_dmpvr2_2rail}, | ||
| 289 | {"isl69236", raa_dmpvr2_2rail}, | ||
| 290 | {"isl69239", raa_dmpvr2_3rail}, | ||
| 291 | {"isl69242", raa_dmpvr2_2rail}, | ||
| 292 | {"isl69243", raa_dmpvr2_1rail}, | ||
| 293 | {"isl69247", raa_dmpvr2_2rail}, | ||
| 294 | {"isl69248", raa_dmpvr2_2rail}, | ||
| 295 | {"isl69254", raa_dmpvr2_2rail}, | ||
| 296 | {"isl69255", raa_dmpvr2_2rail}, | ||
| 297 | {"isl69256", raa_dmpvr2_2rail}, | ||
| 298 | {"isl69259", raa_dmpvr2_2rail}, | ||
| 299 | {"isl69260", raa_dmpvr2_2rail}, | ||
| 300 | {"isl69268", raa_dmpvr2_2rail}, | ||
| 301 | {"isl69269", raa_dmpvr2_3rail}, | ||
| 302 | {"isl69298", raa_dmpvr2_2rail}, | ||
| 303 | |||
| 304 | {"raa228000", raa_dmpvr2_hv}, | ||
| 305 | {"raa228004", raa_dmpvr2_hv}, | ||
| 306 | {"raa228006", raa_dmpvr2_hv}, | ||
| 307 | {"raa228228", raa_dmpvr2_2rail}, | ||
| 308 | {"raa229001", raa_dmpvr2_2rail}, | ||
| 309 | {"raa229004", raa_dmpvr2_2rail}, | ||
| 232 | {} | 310 | {} |
| 233 | }; | 311 | }; |
| 234 | 312 | ||
| @@ -384,7 +384,6 @@ static int altr_i2c_probe(struct platform_device *pdev) · 383 unmodified lines | |||
| 384 | struct altr_i2c_dev *idev = NULL; | 384 | struct altr_i2c_dev *idev = NULL; |
| 385 | struct resource *res; | 385 | struct resource *res; |
| 386 | int irq, ret; | 386 | int irq, ret; |
| 387 | u32 val; | ||
| 388 | 387 | ||
| 389 | idev = devm_kzalloc(&pdev->dev, sizeof(*idev), GFP_KERNEL); | 388 | idev = devm_kzalloc(&pdev->dev, sizeof(*idev), GFP_KERNEL); |
| 390 | if (!idev) | 389 | if (!idev) |
| @@ -411,17 +410,17 @@ static int altr_i2c_probe(struct platform_device *pdev) · 20 unmodified lines | |||
| 411 | init_completion(&idev->msg_complete); | 410 | init_completion(&idev->msg_complete); |
| 412 | spin_lock_init(&idev->lock); | 411 | spin_lock_init(&idev->lock); |
| 413 | 412 | ||
| 414 | val = device_property_read_u32(idev->dev, "fifo-size", | 413 | ret = device_property_read_u32(idev->dev, "fifo-size", |
| 415 | &idev->fifo_size); | 414 | &idev->fifo_size); |
| 416 | if (val) { | 415 | if (ret) { |
| 417 | dev_err(&pdev->dev, "FIFO size set to default of %d\n", | 416 | dev_err(&pdev->dev, "FIFO size set to default of %d\n", |
| 418 | ALTR_I2C_DFLT_FIFO_SZ); | 417 | ALTR_I2C_DFLT_FIFO_SZ); |
| 419 | idev->fifo_size = ALTR_I2C_DFLT_FIFO_SZ; | 418 | idev->fifo_size = ALTR_I2C_DFLT_FIFO_SZ; |
| 420 | } | 419 | } |
| 421 | 420 | ||
| 422 | val = device_property_read_u32(idev->dev, "clock-frequency", | 421 | ret = device_property_read_u32(idev->dev, "clock-frequency", |
| 423 | &idev->bus_clk_rate); | 422 | &idev->bus_clk_rate); |
| 424 | if (val) { | 423 | if (ret) { |
| 425 | dev_err(&pdev->dev, "Default to 100kHz\n"); | 424 | dev_err(&pdev->dev, "Default to 100kHz\n"); |
| 426 | idev->bus_clk_rate = I2C_MAX_STANDARD_MODE_FREQ; /* default clock rate */ | 425 | idev->bus_clk_rate = I2C_MAX_STANDARD_MODE_FREQ; /* default clock rate */ |
| 427 | } | 426 | } |
| @@ -354,10 +354,16 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) · 353 unmodified lines | |||
| 354 | adap->dev.of_node = pdev->dev.of_node; | 354 | adap->dev.of_node = pdev->dev.of_node; |
| 355 | adap->nr = -1; | 355 | adap->nr = -1; |
| 356 | 356 | ||
| 357 | dev_pm_set_driver_flags(&pdev->dev, | 357 | if (dev->flags & ACCESS_NO_IRQ_SUSPEND) { |
| 358 | DPM_FLAG_SMART_PREPARE | | 358 | dev_pm_set_driver_flags(&pdev->dev, |
| 359 | DPM_FLAG_SMART_SUSPEND | | 359 | DPM_FLAG_SMART_PREPARE | |
| 360 | DPM_FLAG_LEAVE_SUSPENDED); | 360 | DPM_FLAG_LEAVE_SUSPENDED); |
| 361 | } else { | ||
| 362 | dev_pm_set_driver_flags(&pdev->dev, | ||
| 363 | DPM_FLAG_SMART_PREPARE | | ||
| 364 | DPM_FLAG_SMART_SUSPEND | | ||
| 365 | DPM_FLAG_LEAVE_SUSPENDED); | ||
| 366 | } | ||
| 361 | 367 | ||
| 362 | /* The code below assumes runtime PM to be disabled. */ | 368 | /* The code below assumes runtime PM to be disabled. */ |
| 363 | WARN_ON(pm_runtime_enabled(&pdev->dev)); | 369 | WARN_ON(pm_runtime_enabled(&pdev->dev)); |
| @@ -996,14 +996,13 @@ tegra_i2c_poll_completion_timeout(struct tegra_i2c_dev *i2c_dev, · 995 unmodified lines | |||
| 996 | do { | 996 | do { |
| 997 | u32 status = i2c_readl(i2c_dev, I2C_INT_STATUS); | 997 | u32 status = i2c_readl(i2c_dev, I2C_INT_STATUS); |
| 998 | 998 | ||
| 999 | if (status) { | 999 | if (status) |
| 1000 | tegra_i2c_isr(i2c_dev->irq, i2c_dev); | 1000 | tegra_i2c_isr(i2c_dev->irq, i2c_dev); |
| 1001 | 1001 | ||
| 1002 | if (completion_done(complete)) { | 1002 | if (completion_done(complete)) { |
| 1003 | s64 delta = ktime_ms_delta(ktimeout, ktime); | 1003 | s64 delta = ktime_ms_delta(ktimeout, ktime); |
| 1004 | 1004 | ||
| 1005 | return msecs_to_jiffies(delta) ?: 1; | 1005 | return msecs_to_jiffies(delta) ?: 1; |
| 1006 | } | ||
| 1007 | } | 1006 | } |
| 1008 | 1007 | ||
| 1009 | ktime = ktime_get(); | 1008 | ktime = ktime_get(); |
| @@ -1030,14 +1029,18 @@ tegra_i2c_wait_completion_timeout(struct tegra_i2c_dev *i2c_dev, · 20 unmodified lines | |||
| 1030 | disable_irq(i2c_dev->irq); | 1029 | disable_irq(i2c_dev->irq); |
| 1031 | 1030 | ||
| 1032 | /* | 1031 | /* |
| 1033 | * There is a chance that completion may happen after IRQ | 1032 | * Under some rare circumstances (like running KASAN + |
| 1034 | * synchronization, which is done by disable_irq(). | 1033 | * NFS root) CPU, which handles interrupt, may stuck in |
| 1034 | * uninterruptible state for a significant time. In this | ||
| 1035 | * case we will get timeout if I2C transfer is running on | ||
| 1036 | * a sibling CPU, despite of IRQ being raised. | ||
| 1037 | * | ||
| 1038 | * In order to handle this rare condition, the IRQ status | ||
| 1039 | * needs to be checked after timeout. | ||
| 1035 | */ | 1040 | */ |
| 1036 | if (ret == 0 && completion_done(complete)) { | 1041 | if (ret == 0) |
| 1037 | dev_warn(i2c_dev->dev, | 1042 | ret = tegra_i2c_poll_completion_timeout(i2c_dev, |
| 1038 | "completion done after timeout\n"); | 1043 | complete, 0); |
| 1039 | ret = 1; | ||
| 1040 | } | ||
| 1041 | } | 1044 | } |
| 1042 | 1045 | ||
| 1043 | return ret; | 1046 | return ret; |
| @@ -1216,6 +1219,15 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, · 172 unmodified lines | |||
| 1216 | time_left = tegra_i2c_wait_completion_timeout( | 1219 | time_left = tegra_i2c_wait_completion_timeout( |
| 1217 | i2c_dev, &i2c_dev->dma_complete, xfer_time); | 1220 | i2c_dev, &i2c_dev->dma_complete, xfer_time); |
| 1218 | 1221 | ||
| 1222 | /* | ||
| 1223 | * Synchronize DMA first, since dmaengine_terminate_sync() | ||
| 1224 | * performs synchronization after the transfer's termination | ||
| 1225 | * and we want to get a completion if transfer succeeded. | ||
| 1226 | */ | ||
| 1227 | dmaengine_synchronize(i2c_dev->msg_read ? | ||
| 1228 | i2c_dev->rx_dma_chan : | ||
| 1229 | i2c_dev->tx_dma_chan); | ||
| 1230 | |||
| 1219 | dmaengine_terminate_sync(i2c_dev->msg_read ? | 1231 | dmaengine_terminate_sync(i2c_dev->msg_read ? |
| 1220 | i2c_dev->rx_dma_chan : | 1232 | i2c_dev->rx_dma_chan : |
| 1221 | i2c_dev->tx_dma_chan); | 1233 | i2c_dev->tx_dma_chan); |
| @@ -2273,19 +2273,6 @@ i2c_new_scanned_device(struct i2c_adapter *adap, · 2272 unmodified lines | |||
| 2273 | } | 2273 | } |
| 2274 | EXPORT_SYMBOL_GPL(i2c_new_scanned_device); | 2274 | EXPORT_SYMBOL_GPL(i2c_new_scanned_device); |
| 2275 | 2275 | ||
| 2276 | struct i2c_client * | ||
| 2277 | i2c_new_probed_device(struct i2c_adapter *adap, | ||
| 2278 | struct i2c_board_info *info, | ||
| 2279 | unsigned short const *addr_list, | ||
| 2280 | int (*probe)(struct i2c_adapter *adap, unsigned short addr)) | ||
| 2281 | { | ||
| 2282 | struct i2c_client *client; | ||
| 2283 | |||
| 2284 | client = i2c_new_scanned_device(adap, info, addr_list, probe); | ||
| 2285 | return IS_ERR(client) ? NULL : client; | ||
| 2286 | } | ||
| 2287 | EXPORT_SYMBOL_GPL(i2c_new_probed_device); | ||
| 2288 | |||
| 2289 | struct i2c_adapter *i2c_get_adapter(int nr) | 2276 | struct i2c_adapter *i2c_get_adapter(int nr) |
| 2290 | { | 2277 | { |
| 2291 | struct i2c_adapter *adapter; | 2278 | struct i2c_adapter *adapter; |
| @@ -125,10 +125,10 @@ · 124 unmodified lines | |||
| 125 | #define AD7193_CH_AINCOM 0x600 /* AINCOM - AINCOM */ | 125 | #define AD7193_CH_AINCOM 0x600 /* AINCOM - AINCOM */ |
| 126 | 126 | ||
| 127 | /* ID Register Bit Designations (AD7192_REG_ID) */ | 127 | /* ID Register Bit Designations (AD7192_REG_ID) */ |
| 128 | #define ID_AD7190 0x4 | 128 | #define CHIPID_AD7190 0x4 |
| 129 | #define ID_AD7192 0x0 | 129 | #define CHIPID_AD7192 0x0 |
| 130 | #define ID_AD7193 0x2 | 130 | #define CHIPID_AD7193 0x2 |
| 131 | #define ID_AD7195 0x6 | 131 | #define CHIPID_AD7195 0x6 |
| 132 | #define AD7192_ID_MASK 0x0F | 132 | #define AD7192_ID_MASK 0x0F |
| 133 | 133 | ||
| 134 | /* GPOCON Register Bit Designations (AD7192_REG_GPOCON) */ | 134 | /* GPOCON Register Bit Designations (AD7192_REG_GPOCON) */ |
| @@ -161,7 +161,20 @@ enum { · 26 unmodified lines | |||
| 161 | AD7192_SYSCALIB_FULL_SCALE, | 161 | AD7192_SYSCALIB_FULL_SCALE, |
| 162 | }; | 162 | }; |
| 163 | 163 | ||
| 164 | enum { | ||
| 165 | ID_AD7190, | ||
| 166 | ID_AD7192, | ||
| 167 | ID_AD7193, | ||
| 168 | ID_AD7195, | ||
| 169 | }; | ||
| 170 | |||
| 171 | struct ad7192_chip_info { | ||
| 172 | unsigned int chip_id; | ||
| 173 | const char *name; | ||
| 174 | }; | ||
| 175 | |||
| 164 | struct ad7192_state { | 176 | struct ad7192_state { |
| 177 | const struct ad7192_chip_info *chip_info; | ||
| 165 | struct regulator *avdd; | 178 | struct regulator *avdd; |
| 166 | struct regulator *dvdd; | 179 | struct regulator *dvdd; |
| 167 | struct clk *mclk; | 180 | struct clk *mclk; |
| @@ -172,7 +185,6 @@ struct ad7192_state { · 4 unmodified lines | |||
| 172 | u32 conf; | 185 | u32 conf; |
| 173 | u32 scale_avail[8][2]; | 186 | u32 scale_avail[8][2]; |
| 174 | u8 gpocon; | 187 | u8 gpocon; |
| 175 | u8 devid; | ||
| 176 | u8 clock_sel; | 188 | u8 clock_sel; |
| 177 | struct mutex lock; /* protect sensor state */ | 189 | struct mutex lock; /* protect sensor state */ |
| 178 | u8 syscalib_mode[8]; | 190 | u8 syscalib_mode[8]; |
| @@ -348,7 +360,7 @@ static int ad7192_setup(struct ad7192_state *st, struct device_node *np) · 169 unmodified lines | |||
| 348 | 360 | ||
| 349 | id &= AD7192_ID_MASK; | 361 | id &= AD7192_ID_MASK; |
| 350 | 362 | ||
| 351 | if (id != st->devid) | 363 | if (id != st->chip_info->chip_id) |
| 352 | dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X)\n", | 364 | dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X)\n", |
| 353 | id); | 365 | id); |
| 354 | 366 | ||
| @@ -363,7 +375,7 @@ static int ad7192_setup(struct ad7192_state *st, struct device_node *np) · 8 unmodified lines | |||
| 363 | st->mode |= AD7192_MODE_REJ60; | 375 | st->mode |= AD7192_MODE_REJ60; |
| 364 | 376 | ||
| 365 | refin2_en = of_property_read_bool(np, "adi,refin2-pins-enable"); | 377 | refin2_en = of_property_read_bool(np, "adi,refin2-pins-enable"); |
| 366 | if (refin2_en && st->devid != ID_AD7195) | 378 | if (refin2_en && st->chip_info->chip_id != CHIPID_AD7195) |
| 367 | st->conf |= AD7192_CONF_REFSEL; | 379 | st->conf |= AD7192_CONF_REFSEL; |
| 368 | 380 | ||
| 369 | st->conf &= ~AD7192_CONF_CHOP; | 381 | st->conf &= ~AD7192_CONF_CHOP; |
| @@ -859,12 +871,31 @@ static const struct iio_chan_spec ad7193_channels[] = { · 489 unmodified lines | |||
| 859 | IIO_CHAN_SOFT_TIMESTAMP(14), | 871 | IIO_CHAN_SOFT_TIMESTAMP(14), |
| 860 | }; | 872 | }; |
| 861 | 873 | ||
| 874 | static const struct ad7192_chip_info ad7192_chip_info_tbl[] = { | ||
| 875 | [ID_AD7190] = { | ||
| 876 | .chip_id = CHIPID_AD7190, | ||
| 877 | .name = "ad7190", | ||
| 878 | }, | ||
| 879 | [ID_AD7192] = { | ||
| 880 | .chip_id = CHIPID_AD7192, | ||
| 881 | .name = "ad7192", | ||
| 882 | }, | ||
| 883 | [ID_AD7193] = { | ||
| 884 | .chip_id = CHIPID_AD7193, | ||
| 885 | .name = "ad7193", | ||
| 886 | }, | ||
| 887 | [ID_AD7195] = { | ||
| 888 | .chip_id = CHIPID_AD7195, | ||
| 889 | .name = "ad7195", | ||
| 890 | }, | ||
| 891 | }; | ||
| 892 | |||
| 862 | static int ad7192_channels_config(struct iio_dev *indio_dev) | 893 | static int ad7192_channels_config(struct iio_dev *indio_dev) |
| 863 | { | 894 | { |
| 864 | struct ad7192_state *st = iio_priv(indio_dev); | 895 | struct ad7192_state *st = iio_priv(indio_dev); |
| 865 | 896 | ||
| 866 | switch (st->devid) { | 897 | switch (st->chip_info->chip_id) { |
| 867 | case ID_AD7193: | 898 | case CHIPID_AD7193: |
| 868 | indio_dev->channels = ad7193_channels; | 899 | indio_dev->channels = ad7193_channels; |
| 869 | indio_dev->num_channels = ARRAY_SIZE(ad7193_channels); | 900 | indio_dev->num_channels = ARRAY_SIZE(ad7193_channels); |
| 870 | break; | 901 | break; |
| @@ -878,10 +909,10 @@ static int ad7192_channels_config(struct iio_dev *indio_dev) · 7 unmodified lines | |||
| 878 | } | 909 | } |
| 879 | 910 | ||
| 880 | static const struct of_device_id ad7192_of_match[] = { | 911 | static const struct of_device_id ad7192_of_match[] = { |
| 881 | { .compatible = "adi,ad7190", .data = (void *)ID_AD7190 }, | 912 | { .compatible = "adi,ad7190", .data = &ad7192_chip_info_tbl[ID_AD7190] }, |
| 882 | { .compatible = "adi,ad7192", .data = (void *)ID_AD7192 }, | 913 | { .compatible = "adi,ad7192", .data = &ad7192_chip_info_tbl[ID_AD7192] }, |
| 883 | { .compatible = "adi,ad7193", .data = (void *)ID_AD7193 }, | 914 | { .compatible = "adi,ad7193", .data = &ad7192_chip_info_tbl[ID_AD7193] }, |
| 884 | { .compatible = "adi,ad7195", .data = (void *)ID_AD7195 }, | 915 | { .compatible = "adi,ad7195", .data = &ad7192_chip_info_tbl[ID_AD7195] }, |
| 885 | {} | 916 | {} |
| 886 | }; | 917 | }; |
| 887 | MODULE_DEVICE_TABLE(of, ad7192_of_match); | 918 | MODULE_DEVICE_TABLE(of, ad7192_of_match); |
| @@ -938,16 +969,16 @@ static int ad7192_probe(struct spi_device *spi) · 50 unmodified lines | |||
| 938 | } | 969 | } |
| 939 | 970 | ||
| 940 | spi_set_drvdata(spi, indio_dev); | 971 | spi_set_drvdata(spi, indio_dev); |
| 941 | st->devid = (unsigned long)of_device_get_match_data(&spi->dev); | 972 | st->chip_info = of_device_get_match_data(&spi->dev); |
| 942 | indio_dev->dev.parent = &spi->dev; | 973 | indio_dev->dev.parent = &spi->dev; |
| 943 | indio_dev->name = spi_get_device_id(spi)->name; | 974 | indio_dev->name = st->chip_info->name; |
| 944 | indio_dev->modes = INDIO_DIRECT_MODE; | 975 | indio_dev->modes = INDIO_DIRECT_MODE; |
| 945 | 976 | ||
| 946 | ret = ad7192_channels_config(indio_dev); | 977 | ret = ad7192_channels_config(indio_dev); |
| 947 | if (ret < 0) | 978 | if (ret < 0) |
| 948 | goto error_disable_dvdd; | 979 | goto error_disable_dvdd; |
| 949 | 980 | ||
| 950 | if (st->devid == ID_AD7195) | 981 | if (st->chip_info->chip_id == CHIPID_AD7195) |
| 951 | indio_dev->info = &ad7195_info; | 982 | indio_dev->info = &ad7195_info; |
| 952 | else | 983 | else |
| 953 | indio_dev->info = &ad7192_info; | 984 | indio_dev->info = &ad7192_info; |
| @@ -542,7 +542,7 @@ static const struct iio_info ad7797_info = { · 541 unmodified lines | |||
| 542 | .read_raw = &ad7793_read_raw, | 542 | .read_raw = &ad7793_read_raw, |
| 543 | .write_raw = &ad7793_write_raw, | 543 | .write_raw = &ad7793_write_raw, |
| 544 | .write_raw_get_fmt = &ad7793_write_raw_get_fmt, | 544 | .write_raw_get_fmt = &ad7793_write_raw_get_fmt, |
| 545 | .attrs = &ad7793_attribute_group, | 545 | .attrs = &ad7797_attribute_group, |
| 546 | .validate_trigger = ad_sd_validate_trigger, | 546 | .validate_trigger = ad_sd_validate_trigger, |
| 547 | }; | 547 | }; |
| 548 | 548 | ||
| @@ -1418,8 +1418,30 @@ static unsigned int stm32_adc_dma_residue(struct stm32_adc *adc) · 1417 unmodified lines | |||
| 1418 | static void stm32_adc_dma_buffer_done(void *data) | 1418 | static void stm32_adc_dma_buffer_done(void *data) |
| 1419 | { | 1419 | { |
| 1420 | struct iio_dev *indio_dev = data; | 1420 | struct iio_dev *indio_dev = data; |
| 1421 | struct stm32_adc *adc = iio_priv(indio_dev); | ||
| 1422 | int residue = stm32_adc_dma_residue(adc); | ||
| 1423 | |||
| 1424 | /* | ||
| 1425 | * In DMA mode the trigger services of IIO are not used | ||
| 1426 | * (e.g. no call to iio_trigger_poll). | ||
| 1427 | * Calling irq handler associated to the hardware trigger is not | ||
| 1428 | * relevant as the conversions have already been done. Data | ||
| 1429 | * transfers are performed directly in DMA callback instead. | ||
| 1430 | * This implementation avoids to call trigger irq handler that | ||
| 1431 | * may sleep, in an atomic context (DMA irq handler context). | ||
| 1432 | */ | ||
| 1433 | dev_dbg(&indio_dev->dev, "%s bufi=%d\n", __func__, adc->bufi); | ||
| 1421 | 1434 | ||
| 1422 | iio_trigger_poll_chained(indio_dev->trig); | 1435 | while (residue >= indio_dev->scan_bytes) { |
| 1436 | u16 *buffer = (u16 *)&adc->rx_buf[adc->bufi]; | ||
| 1437 | |||
| 1438 | iio_push_to_buffers(indio_dev, buffer); | ||
| 1439 | |||
| 1440 | residue -= indio_dev->scan_bytes; | ||
| 1441 | adc->bufi += indio_dev->scan_bytes; | ||
| 1442 | if (adc->bufi >= adc->rx_buf_sz) | ||
| 1443 | adc->bufi = 0; | ||
| 1444 | } | ||
| 1423 | } | 1445 | } |
| 1424 | 1446 | ||
| 1425 | static int stm32_adc_dma_start(struct iio_dev *indio_dev) | 1447 | static int stm32_adc_dma_start(struct iio_dev *indio_dev) |
| @@ -1845,6 +1867,7 @@ static int stm32_adc_probe(struct platform_device *pdev) · 419 unmodified lines | |||
| 1845 | { | 1867 | { |
| 1846 | struct iio_dev *indio_dev; | 1868 | struct iio_dev *indio_dev; |
| 1847 | struct device *dev = &pdev->dev; | 1869 | struct device *dev = &pdev->dev; |
| 1870 | irqreturn_t (*handler)(int irq, void *p) = NULL; | ||
| 1848 | struct stm32_adc *adc; | 1871 | struct stm32_adc *adc; |
| 1849 | int ret; | 1872 | int ret; |
| 1850 | 1873 | ||
| @@ -1911,9 +1934,11 @@ static int stm32_adc_probe(struct platform_device *pdev) · 60 unmodified lines | |||
| 1911 | if (ret < 0) | 1934 | if (ret < 0) |
| 1912 | return ret; | 1935 | return ret; |
| 1913 | 1936 | ||
| 1937 | if (!adc->dma_chan) | ||
| 1938 | handler = &stm32_adc_trigger_handler; | ||
| 1939 | |||
| 1914 | ret = iio_triggered_buffer_setup(indio_dev, | 1940 | ret = iio_triggered_buffer_setup(indio_dev, |
| 1915 | &iio_pollfunc_store_time, | 1941 | &iio_pollfunc_store_time, handler, |
| 1916 | &stm32_adc_trigger_handler, | ||
| 1917 | &stm32_adc_buffer_setup_ops); | 1942 | &stm32_adc_buffer_setup_ops); |
| 1918 | if (ret) { | 1943 | if (ret) { |
| 1919 | dev_err(&pdev->dev, "buffer setup failed\n"); | 1944 | dev_err(&pdev->dev, "buffer setup failed\n"); |
| @@ -29,7 +29,7 @@ struct ads8344 { · 28 unmodified lines | |||
| 29 | struct mutex lock; | 29 | struct mutex lock; |
| 30 | 30 | ||
| 31 | u8 tx_buf ____cacheline_aligned; | 31 | u8 tx_buf ____cacheline_aligned; |
| 32 | u16 rx_buf; | 32 | u8 rx_buf[3]; |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | #define ADS8344_VOLTAGE_CHANNEL(chan, si) \ | 35 | #define ADS8344_VOLTAGE_CHANNEL(chan, si) \ |
| @@ -89,11 +89,11 @@ static int ads8344_adc_conversion(struct ads8344 *adc, int channel, · 53 unmodified lines | |||
| 89 | 89 | ||
| 90 | udelay(9); | 90 | udelay(9); |
| 91 | 91 | ||
| 92 | ret = spi_read(spi, &adc->rx_buf, 2); | 92 | ret = spi_read(spi, adc->rx_buf, sizeof(adc->rx_buf)); |
| 93 | if (ret) | 93 | if (ret) |
| 94 | return ret; | 94 | return ret; |
| 95 | 95 | ||
| 96 | return adc->rx_buf; | 96 | return adc->rx_buf[0] << 9 | adc->rx_buf[1] << 1 | adc->rx_buf[2] >> 7; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | static int ads8344_read_raw(struct iio_dev *iio, | 99 | static int ads8344_read_raw(struct iio_dev *iio, |
| @@ -102,6 +102,16 @@ static const unsigned int XADC_ZYNQ_UNMASK_TIMEOUT = 500; · 101 unmodified lines | |||
| 102 | 102 | ||
| 103 | #define XADC_FLAGS_BUFFERED BIT(0) | 103 | #define XADC_FLAGS_BUFFERED BIT(0) |
| 104 | 104 | ||
| 105 | /* | ||
| 106 | * The XADC hardware supports a samplerate of up to 1MSPS. Unfortunately it does | ||
| 107 | * not have a hardware FIFO. Which means an interrupt is generated for each | ||
| 108 | * conversion sequence. At 1MSPS sample rate the CPU in ZYNQ7000 is completely | ||
| 109 | * overloaded by the interrupts that it soft-lockups. For this reason the driver | ||
| 110 | * limits the maximum samplerate 150kSPS. At this rate the CPU is fairly busy, | ||
| 111 | * but still responsive. | ||
| 112 | */ | ||
| 113 | #define XADC_MAX_SAMPLERATE 150000 | ||
| 114 | |||
| 105 | static void xadc_write_reg(struct xadc *xadc, unsigned int reg, | 115 | static void xadc_write_reg(struct xadc *xadc, unsigned int reg, |
| 106 | uint32_t val) | 116 | uint32_t val) |
| 107 | { | 117 | { |
| @@ -674,7 +684,7 @@ static int xadc_trigger_set_state(struct iio_trigger *trigger, bool state) · 566 unmodified lines | |||
| 674 | 684 | ||
| 675 | spin_lock_irqsave(&xadc->lock, flags); | 685 | spin_lock_irqsave(&xadc->lock, flags); |
| 676 | xadc_read_reg(xadc, XADC_AXI_REG_IPIER, &val); | 686 | xadc_read_reg(xadc, XADC_AXI_REG_IPIER, &val); |
| 677 | xadc_write_reg(xadc, XADC_AXI_REG_IPISR, val & XADC_AXI_INT_EOS); | 687 | xadc_write_reg(xadc, XADC_AXI_REG_IPISR, XADC_AXI_INT_EOS); |
| 678 | if (state) | 688 | if (state) |
| 679 | val |= XADC_AXI_INT_EOS; | 689 | val |= XADC_AXI_INT_EOS; |
| 680 | else | 690 | else |
| @@ -722,13 +732,14 @@ static int xadc_power_adc_b(struct xadc *xadc, unsigned int seq_mode) · 41 unmodified lines | |||
| 722 | { | 732 | { |
| 723 | uint16_t val; | 733 | uint16_t val; |
| 724 | 734 | ||
| 735 | /* Powerdown the ADC-B when it is not needed. */ | ||
| 725 | switch (seq_mode) { | 736 | switch (seq_mode) { |
| 726 | case XADC_CONF1_SEQ_SIMULTANEOUS: | 737 | case XADC_CONF1_SEQ_SIMULTANEOUS: |
| 727 | case XADC_CONF1_SEQ_INDEPENDENT: | 738 | case XADC_CONF1_SEQ_INDEPENDENT: |
| 728 | val = XADC_CONF2_PD_ADC_B; | 739 | val = 0; |
| 729 | break; | 740 | break; |
| 730 | default: | 741 | default: |
| 731 | val = 0; | 742 | val = XADC_CONF2_PD_ADC_B; |
| 732 | break; | 743 | break; |
| 733 | } | 744 | } |
| 734 | 745 | ||
| @@ -797,6 +808,16 @@ static int xadc_preenable(struct iio_dev *indio_dev) · 62 unmodified lines | |||
| 797 | if (ret) | 808 | if (ret) |
| 798 | goto err; | 809 | goto err; |
| 799 | 810 | ||
| 811 | /* | ||
| 812 | * In simultaneous mode the upper and lower aux channels are samples at | ||
| 813 | * the same time. In this mode the upper 8 bits in the sequencer | ||
| 814 | * register are don't care and the lower 8 bits control two channels | ||
| 815 | * each. As such we must set the bit if either the channel in the lower | ||
| 816 | * group or the upper group is enabled. | ||
| 817 | */ | ||
| 818 | if (seq_mode == XADC_CONF1_SEQ_SIMULTANEOUS) | ||
| 819 | scan_mask = ((scan_mask >> 8) | scan_mask) & 0xff0000; | ||
| 820 | |||
| 800 | ret = xadc_write_adc_reg(xadc, XADC_REG_SEQ(1), scan_mask >> 16); | 821 | ret = xadc_write_adc_reg(xadc, XADC_REG_SEQ(1), scan_mask >> 16); |
| 801 | if (ret) | 822 | if (ret) |
| 802 | goto err; | 823 | goto err; |
| @@ -823,11 +844,27 @@ static const struct iio_buffer_setup_ops xadc_buffer_ops = { · 20 unmodified lines | |||
| 823 | .postdisable = &xadc_postdisable, | 844 | .postdisable = &xadc_postdisable, |
| 824 | }; | 845 | }; |
| 825 | 846 | ||
| 847 | static int xadc_read_samplerate(struct xadc *xadc) | ||
| 848 | { | ||
| 849 | unsigned int div; | ||
| 850 | uint16_t val16; | ||
| 851 | int ret; | ||
| 852 | |||
| 853 | ret = xadc_read_adc_reg(xadc, XADC_REG_CONF2, &val16); | ||
| 854 | if (ret) | ||
| 855 | return ret; | ||
| 856 | |||
| 857 | div = (val16 & XADC_CONF2_DIV_MASK) >> XADC_CONF2_DIV_OFFSET; | ||
| 858 | if (div < 2) | ||
| 859 | div = 2; | ||
| 860 | |||
| 861 | return xadc_get_dclk_rate(xadc) / div / 26; | ||
| 862 | } | ||
| 863 | |||
| 826 | static int xadc_read_raw(struct iio_dev *indio_dev, | 864 | static int xadc_read_raw(struct iio_dev *indio_dev, |
| 827 | struct iio_chan_spec const *chan, int *val, int *val2, long info) | 865 | struct iio_chan_spec const *chan, int *val, int *val2, long info) |
| 828 | { | 866 | { |
| 829 | struct xadc *xadc = iio_priv(indio_dev); | 867 | struct xadc *xadc = iio_priv(indio_dev); |
| 830 | unsigned int div; | ||
| 831 | uint16_t val16; | 868 | uint16_t val16; |
| 832 | int ret; | 869 | int ret; |
| 833 | 870 | ||
| @@ -880,41 +917,31 @@ static int xadc_read_raw(struct iio_dev *indio_dev, · 46 unmodified lines | |||
| 880 | *val = -((273150 << 12) / 503975); | 917 | *val = -((273150 << 12) / 503975); |
| 881 | return IIO_VAL_INT; | 918 | return IIO_VAL_INT; |
| 882 | case IIO_CHAN_INFO_SAMP_FREQ: | 919 | case IIO_CHAN_INFO_SAMP_FREQ: |
| 883 | ret = xadc_read_adc_reg(xadc, XADC_REG_CONF2, &val16); | 920 | ret = xadc_read_samplerate(xadc); |
| 884 | if (ret) | 921 | if (ret < 0) |
| 885 | return ret; | 922 | return ret; |
| 886 | 923 | ||
| 887 | div = (val16 & XADC_CONF2_DIV_MASK) >> XADC_CONF2_DIV_OFFSET; | 924 | *val = ret; |
| 888 | if (div < 2) | ||
| 889 | div = 2; | ||
| 890 | |||
| 891 | *val = xadc_get_dclk_rate(xadc) / div / 26; | ||
| 892 | |||
| 893 | return IIO_VAL_INT; | 925 | return IIO_VAL_INT; |
| 894 | default: | 926 | default: |
| 895 | return -EINVAL; | 927 | return -EINVAL; |
| 896 | } | 928 | } |
| 897 | } | 929 | } |
| 898 | 930 | ||
| 899 | static int xadc_write_raw(struct iio_dev *indio_dev, | 931 | static int xadc_write_samplerate(struct xadc *xadc, int val) |
| 900 | struct iio_chan_spec const *chan, int val, int val2, long info) | ||
| 901 | { | 932 | { |
| 902 | struct xadc *xadc = iio_priv(indio_dev); | ||
| 903 | unsigned long clk_rate = xadc_get_dclk_rate(xadc); | 933 | unsigned long clk_rate = xadc_get_dclk_rate(xadc); |
| 904 | unsigned int div; | 934 | unsigned int div; |
| 905 | 935 | ||
| 906 | if (!clk_rate) | 936 | if (!clk_rate) |
| 907 | return -EINVAL; | 937 | return -EINVAL; |
| 908 | 938 | ||
| 909 | if (info != IIO_CHAN_INFO_SAMP_FREQ) | ||
| 910 | return -EINVAL; | ||
| 911 | |||
| 912 | if (val <= 0) | 939 | if (val <= 0) |
| 913 | return -EINVAL; | 940 | return -EINVAL; |
| 914 | 941 | ||
| 915 | /* Max. 150 kSPS */ | 942 | /* Max. 150 kSPS */ |
| 916 | if (val > 150000) | 943 | if (val > XADC_MAX_SAMPLERATE) |
| 917 | val = 150000; | 944 | val = XADC_MAX_SAMPLERATE; |
| 918 | 945 | ||
| 919 | val *= 26; | 946 | val *= 26; |
| 920 | 947 | ||
| @@ -927,7 +954,7 @@ static int xadc_write_raw(struct iio_dev *indio_dev, · 6 unmodified lines | |||
| 927 | * limit. | 954 | * limit. |
| 928 | */ | 955 | */ |
| 929 | div = clk_rate / val; | 956 | div = clk_rate / val; |
| 930 | if (clk_rate / div / 26 > 150000) | 957 | if (clk_rate / div / 26 > XADC_MAX_SAMPLERATE) |
| 931 | div++; | 958 | div++; |
| 932 | if (div < 2) | 959 | if (div < 2) |
| 933 | div = 2; | 960 | div = 2; |
| @@ -938,6 +965,17 @@ static int xadc_write_raw(struct iio_dev *indio_dev, · 4 unmodified lines | |||
| 938 | div << XADC_CONF2_DIV_OFFSET); | 965 | div << XADC_CONF2_DIV_OFFSET); |
| 939 | } | 966 | } |
| 940 | 967 | ||
| 968 | static int xadc_write_raw(struct iio_dev *indio_dev, | ||
| 969 | struct iio_chan_spec const *chan, int val, int val2, long info) | ||
| 970 | { | ||
| 971 | struct xadc *xadc = iio_priv(indio_dev); | ||
| 972 | |||
| 973 | if (info != IIO_CHAN_INFO_SAMP_FREQ) | ||
| 974 | return -EINVAL; | ||
| 975 | |||
| 976 | return xadc_write_samplerate(xadc, val); | ||
| 977 | } | ||
| 978 | |||
| 941 | static const struct iio_event_spec xadc_temp_events[] = { | 979 | static const struct iio_event_spec xadc_temp_events[] = { |
| 942 | { | 980 | { |
| 943 | .type = IIO_EV_TYPE_THRESH, | 981 | .type = IIO_EV_TYPE_THRESH, |
| @@ -1223,6 +1261,21 @@ static int xadc_probe(struct platform_device *pdev) · 279 unmodified lines | |||
| 1223 | if (ret) | 1261 | if (ret) |
| 1224 | goto err_free_samplerate_trigger; | 1262 | goto err_free_samplerate_trigger; |
| 1225 | 1263 | ||
| 1264 | /* | ||
| 1265 | * Make sure not to exceed the maximum samplerate since otherwise the | ||
| 1266 | * resulting interrupt storm will soft-lock the system. | ||
| 1267 | */ | ||
| 1268 | if (xadc->ops->flags & XADC_FLAGS_BUFFERED) { | ||
| 1269 | ret = xadc_read_samplerate(xadc); | ||
| 1270 | if (ret < 0) | ||
| 1271 | goto err_free_samplerate_trigger; | ||
| 1272 | if (ret > XADC_MAX_SAMPLERATE) { | ||
| 1273 | ret = xadc_write_samplerate(xadc, XADC_MAX_SAMPLERATE); | ||
| 1274 | if (ret < 0) | ||
| 1275 | goto err_free_samplerate_trigger; | ||
| 1276 | } | ||
| 1277 | } | ||
| 1278 | |||
| 1226 | ret = request_irq(xadc->irq, xadc->ops->interrupt_handler, 0, | 1279 | ret = request_irq(xadc->irq, xadc->ops->interrupt_handler, 0, |
| 1227 | dev_name(&pdev->dev), indio_dev); | 1280 | dev_name(&pdev->dev), indio_dev); |
| 1228 | if (ret) | 1281 | if (ret) |
| @@ -79,7 +79,7 @@ int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr) · 78 unmodified lines | |||
| 79 | struct st_sensor_odr_avl odr_out = {0, 0}; | 79 | struct st_sensor_odr_avl odr_out = {0, 0}; |
| 80 | struct st_sensor_data *sdata = iio_priv(indio_dev); | 80 | struct st_sensor_data *sdata = iio_priv(indio_dev); |
| 81 | 81 | ||
| 82 | if (!sdata->sensor_settings->odr.addr) | 82 | if (!sdata->sensor_settings->odr.mask) |
| 83 | return 0; | 83 | return 0; |
| 84 | 84 | ||
| 85 | err = st_sensors_match_odr(sdata->sensor_settings, odr, &odr_out); | 85 | err = st_sensors_match_odr(sdata->sensor_settings, odr, &odr_out); |
| @@ -525,7 +525,7 @@ static int ad5770r_channel_config(struct ad5770r_state *st) · 524 unmodified lines | |||
| 525 | ret = fwnode_property_read_u32(child, "num", &num); | 525 | ret = fwnode_property_read_u32(child, "num", &num); |
| 526 | if (ret) | 526 | if (ret) |
| 527 | return ret; | 527 | return ret; |
| 528 | if (num > AD5770R_MAX_CHANNELS) | 528 | if (num >= AD5770R_MAX_CHANNELS) |
| 529 | return -EINVAL; | 529 | return -EINVAL; |
| 530 | 530 | ||
| 531 | ret = fwnode_property_read_u32_array(child, | 531 | ret = fwnode_property_read_u32_array(child, |
| @@ -1617,6 +1617,10 @@ static int __maybe_unused inv_mpu_resume(struct device *dev) · 1616 unmodified lines | |||
| 1617 | if (result) | 1617 | if (result) |
| 1618 | goto out_unlock; | 1618 | goto out_unlock; |
| 1619 | 1619 | ||
| 1620 | pm_runtime_disable(dev); | ||
| 1621 | pm_runtime_set_active(dev); | ||
| 1622 | pm_runtime_enable(dev); | ||
| 1623 | |||
| 1620 | result = inv_mpu6050_switch_engine(st, true, st->suspended_sensors); | 1624 | result = inv_mpu6050_switch_engine(st, true, st->suspended_sensors); |
| 1621 | if (result) | 1625 | if (result) |
| 1622 | goto out_unlock; | 1626 | goto out_unlock; |
| @@ -1638,13 +1642,18 @@ static int __maybe_unused inv_mpu_suspend(struct device *dev) · 15 unmodified lines | |||
| 1638 | 1642 | ||
| 1639 | mutex_lock(&st->lock); | 1643 | mutex_lock(&st->lock); |
| 1640 | 1644 | ||
| 1645 | st->suspended_sensors = 0; | ||
| 1646 | if (pm_runtime_suspended(dev)) { | ||
| 1647 | result = 0; | ||
| 1648 | goto out_unlock; | ||
| 1649 | } | ||
| 1650 | |||
| 1641 | if (iio_buffer_enabled(indio_dev)) { | 1651 | if (iio_buffer_enabled(indio_dev)) { |
| 1642 | result = inv_mpu6050_prepare_fifo(st, false); | 1652 | result = inv_mpu6050_prepare_fifo(st, false); |
| 1643 | if (result) | 1653 | if (result) |
| 1644 | goto out_unlock; | 1654 | goto out_unlock; |
| 1645 | } | 1655 | } |
| 1646 | 1656 | ||
| 1647 | st->suspended_sensors = 0; | ||
| 1648 | if (st->chip_config.accl_en) | 1657 | if (st->chip_config.accl_en) |
| 1649 | st->suspended_sensors |= INV_MPU6050_SENSOR_ACCL; | 1658 | st->suspended_sensors |= INV_MPU6050_SENSOR_ACCL; |
| 1650 | if (st->chip_config.gyro_en) | 1659 | if (st->chip_config.gyro_en) |
| @@ -337,6 +337,7 @@ enum st_lsm6dsx_fifo_mode { · 336 unmodified lines | |||
| 337 | * @gain: Configured sensor sensitivity. | 337 | * @gain: Configured sensor sensitivity. |
| 338 | * @odr: Output data rate of the sensor [Hz]. | 338 | * @odr: Output data rate of the sensor [Hz]. |
| 339 | * @watermark: Sensor watermark level. | 339 | * @watermark: Sensor watermark level. |
| 340 | * @decimator: Sensor decimation factor. | ||
| 340 | * @sip: Number of samples in a given pattern. | 341 | * @sip: Number of samples in a given pattern. |
| 341 | * @ts_ref: Sensor timestamp reference for hw one. | 342 | * @ts_ref: Sensor timestamp reference for hw one. |
| 342 | * @ext_info: Sensor settings if it is connected to i2c controller | 343 | * @ext_info: Sensor settings if it is connected to i2c controller |
| @@ -350,11 +351,13 @@ struct st_lsm6dsx_sensor { · 7 unmodified lines | |||
| 350 | u32 odr; | 351 | u32 odr; |
| 351 | 352 | ||
| 352 | u16 watermark; | 353 | u16 watermark; |
| 354 | u8 decimator; | ||
| 353 | u8 sip; | 355 | u8 sip; |
| 354 | s64 ts_ref; | 356 | s64 ts_ref; |
| 355 | 357 | ||
| 356 | struct { | 358 | struct { |
| 357 | const struct st_lsm6dsx_ext_dev_settings *settings; | 359 | const struct st_lsm6dsx_ext_dev_settings *settings; |
| 360 | u32 slv_odr; | ||
| 358 | u8 addr; | 361 | u8 addr; |
| 359 | } ext_info; | 362 | } ext_info; |
| 360 | }; | 363 | }; |
| @@ -93,6 +93,7 @@ st_lsm6dsx_get_decimator_val(struct st_lsm6dsx_sensor *sensor, u32 max_odr) · 92 unmodified lines | |||
| 93 | break; | 93 | break; |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | sensor->decimator = decimator; | ||
| 96 | return i == max_size ? 0 : st_lsm6dsx_decimator_table[i].val; | 97 | return i == max_size ? 0 : st_lsm6dsx_decimator_table[i].val; |
| 97 | } | 98 | } |
| 98 | 99 | ||
| @@ -337,7 +338,7 @@ static inline int st_lsm6dsx_read_block(struct st_lsm6dsx_hw *hw, u8 addr, · 238 unmodified lines | |||
| 337 | int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) | 338 | int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) |
| 338 | { | 339 | { |
| 339 | struct st_lsm6dsx_sensor *acc_sensor, *gyro_sensor, *ext_sensor = NULL; | 340 | struct st_lsm6dsx_sensor *acc_sensor, *gyro_sensor, *ext_sensor = NULL; |
| 340 | int err, acc_sip, gyro_sip, ts_sip, ext_sip, read_len, offset; | 341 | int err, sip, acc_sip, gyro_sip, ts_sip, ext_sip, read_len, offset; |
| 341 | u16 fifo_len, pattern_len = hw->sip * ST_LSM6DSX_SAMPLE_SIZE; | 342 | u16 fifo_len, pattern_len = hw->sip * ST_LSM6DSX_SAMPLE_SIZE; |
| 342 | u16 fifo_diff_mask = hw->settings->fifo_ops.fifo_diff.mask; | 343 | u16 fifo_diff_mask = hw->settings->fifo_ops.fifo_diff.mask; |
| 343 | u8 gyro_buff[ST_LSM6DSX_IIO_BUFF_SIZE]; | 344 | u8 gyro_buff[ST_LSM6DSX_IIO_BUFF_SIZE]; |
| @@ -399,19 +400,20 @@ int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) · 55 unmodified lines | |||
| 399 | acc_sip = acc_sensor->sip; | 400 | acc_sip = acc_sensor->sip; |
| 400 | ts_sip = hw->ts_sip; | 401 | ts_sip = hw->ts_sip; |
| 401 | offset = 0; | 402 | offset = 0; |
| 403 | sip = 0; | ||
| 402 | 404 | ||
| 403 | while (acc_sip > 0 || gyro_sip > 0 || ext_sip > 0) { | 405 | while (acc_sip > 0 || gyro_sip > 0 || ext_sip > 0) { |
| 404 | if (gyro_sip > 0) { | 406 | if (gyro_sip > 0 && !(sip % gyro_sensor->decimator)) { |
| 405 | memcpy(gyro_buff, &hw->buff[offset], | 407 | memcpy(gyro_buff, &hw->buff[offset], |
| 406 | ST_LSM6DSX_SAMPLE_SIZE); | 408 | ST_LSM6DSX_SAMPLE_SIZE); |
| 407 | offset += ST_LSM6DSX_SAMPLE_SIZE; | 409 | offset += ST_LSM6DSX_SAMPLE_SIZE; |
| 408 | } | 410 | } |
| 409 | if (acc_sip > 0) { | 411 | if (acc_sip > 0 && !(sip % acc_sensor->decimator)) { |
| 410 | memcpy(acc_buff, &hw->buff[offset], | 412 | memcpy(acc_buff, &hw->buff[offset], |
| 411 | ST_LSM6DSX_SAMPLE_SIZE); | 413 | ST_LSM6DSX_SAMPLE_SIZE); |
| 412 | offset += ST_LSM6DSX_SAMPLE_SIZE; | 414 | offset += ST_LSM6DSX_SAMPLE_SIZE; |
| 413 | } | 415 | } |
| 414 | if (ext_sip > 0) { | 416 | if (ext_sip > 0 && !(sip % ext_sensor->decimator)) { |
| 415 | memcpy(ext_buff, &hw->buff[offset], | 417 | memcpy(ext_buff, &hw->buff[offset], |
| 416 | ST_LSM6DSX_SAMPLE_SIZE); | 418 | ST_LSM6DSX_SAMPLE_SIZE); |
| 417 | offset += ST_LSM6DSX_SAMPLE_SIZE; | 419 | offset += ST_LSM6DSX_SAMPLE_SIZE; |
| @@ -441,18 +443,25 @@ int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) · 23 unmodified lines | |||
| 441 | offset += ST_LSM6DSX_SAMPLE_SIZE; | 443 | offset += ST_LSM6DSX_SAMPLE_SIZE; |
| 442 | } | 444 | } |
| 443 | 445 | ||
| 444 | if (gyro_sip-- > 0) | 446 | if (gyro_sip > 0 && !(sip % gyro_sensor->decimator)) { |
| 445 | iio_push_to_buffers_with_timestamp( | 447 | iio_push_to_buffers_with_timestamp( |
| 446 | hw->iio_devs[ST_LSM6DSX_ID_GYRO], | 448 | hw->iio_devs[ST_LSM6DSX_ID_GYRO], |
| 447 | gyro_buff, gyro_sensor->ts_ref + ts); | 449 | gyro_buff, gyro_sensor->ts_ref + ts); |
| 448 | if (acc_sip-- > 0) | 450 | gyro_sip--; |
| 451 | } | ||
| 452 | if (acc_sip > 0 && !(sip % acc_sensor->decimator)) { | ||
| 449 | iio_push_to_buffers_with_timestamp( | 453 | iio_push_to_buffers_with_timestamp( |
| 450 | hw->iio_devs[ST_LSM6DSX_ID_ACC], | 454 | hw->iio_devs[ST_LSM6DSX_ID_ACC], |
| 451 | acc_buff, acc_sensor->ts_ref + ts); | 455 | acc_buff, acc_sensor->ts_ref + ts); |
| 452 | if (ext_sip-- > 0) | 456 | acc_sip--; |
| 457 | } | ||
| 458 | if (ext_sip > 0 && !(sip % ext_sensor->decimator)) { | ||
| 453 | iio_push_to_buffers_with_timestamp( | 459 | iio_push_to_buffers_with_timestamp( |
| 454 | hw->iio_devs[ST_LSM6DSX_ID_EXT0], | 460 | hw->iio_devs[ST_LSM6DSX_ID_EXT0], |
| 455 | ext_buff, ext_sensor->ts_ref + ts); | 461 | ext_buff, ext_sensor->ts_ref + ts); |
| 462 | ext_sip--; | ||
| 463 | } | ||
| 464 | sip++; | ||
| 456 | } | 465 | } |
| 457 | } | 466 | } |
| 458 | 467 | ||
| @@ -2036,11 +2036,21 @@ static int st_lsm6dsx_init_hw_timer(struct st_lsm6dsx_hw *hw) · 2035 unmodified lines | |||
| 2036 | return 0; | 2036 | return 0; |
| 2037 | } | 2037 | } |
| 2038 | 2038 | ||
| 2039 | static int st_lsm6dsx_init_device(struct st_lsm6dsx_hw *hw) | 2039 | static int st_lsm6dsx_reset_device(struct st_lsm6dsx_hw *hw) |
| 2040 | { | 2040 | { |
| 2041 | const struct st_lsm6dsx_reg *reg; | 2041 | const struct st_lsm6dsx_reg *reg; |
| 2042 | int err; | 2042 | int err; |
| 2043 | 2043 | ||
| 2044 | /* | ||
| 2045 | * flush hw FIFO before device reset in order to avoid | ||
| 2046 | * possible races on interrupt line 1. If the first interrupt | ||
| 2047 | * line is asserted during hw reset the device will work in | ||
| 2048 | * I3C-only mode (if it is supported) | ||
| 2049 | */ | ||
| 2050 | err = st_lsm6dsx_flush_fifo(hw); | ||
| 2051 | if (err < 0 && err != -ENOTSUPP) | ||
| 2052 | return err; | ||
| 2053 | |||
| 2044 | /* device sw reset */ | 2054 | /* device sw reset */ |
| 2045 | reg = &hw->settings->reset; | 2055 | reg = &hw->settings->reset; |
| 2046 | err = regmap_update_bits(hw->regmap, reg->addr, reg->mask, | 2056 | err = regmap_update_bits(hw->regmap, reg->addr, reg->mask, |
| @@ -2059,6 +2069,18 @@ static int st_lsm6dsx_init_device(struct st_lsm6dsx_hw *hw) · 12 unmodified lines | |||
| 2059 | 2069 | ||
| 2060 | msleep(50); | 2070 | msleep(50); |
| 2061 | 2071 | ||
| 2072 | return 0; | ||
| 2073 | } | ||
| 2074 | |||
| 2075 | static int st_lsm6dsx_init_device(struct st_lsm6dsx_hw *hw) | ||
| 2076 | { | ||
| 2077 | const struct st_lsm6dsx_reg *reg; | ||
| 2078 | int err; | ||
| 2079 | |||
| 2080 | err = st_lsm6dsx_reset_device(hw); | ||
| 2081 | if (err < 0) | ||
| 2082 | return err; | ||
| 2083 | |||
| 2062 | /* enable Block Data Update */ | 2084 | /* enable Block Data Update */ |
| 2063 | reg = &hw->settings->bdu; | 2085 | reg = &hw->settings->bdu; |
| 2064 | err = regmap_update_bits(hw->regmap, reg->addr, reg->mask, | 2086 | err = regmap_update_bits(hw->regmap, reg->addr, reg->mask, |
| @@ -421,7 +421,8 @@ int st_lsm6dsx_shub_set_enable(struct st_lsm6dsx_sensor *sensor, bool enable) · 420 unmodified lines | |||
| 421 | 421 | ||
| 422 | settings = sensor->ext_info.settings; | 422 | settings = sensor->ext_info.settings; |
| 423 | if (enable) { | 423 | if (enable) { |
| 424 | err = st_lsm6dsx_shub_set_odr(sensor, sensor->odr); | 424 | err = st_lsm6dsx_shub_set_odr(sensor, |
| 425 | sensor->ext_info.slv_odr); | ||
| 425 | if (err < 0) | 426 | if (err < 0) |
| 426 | return err; | 427 | return err; |
| 427 | } else { | 428 | } else { |
| @@ -459,7 +460,7 @@ st_lsm6dsx_shub_read_oneshot(struct st_lsm6dsx_sensor *sensor, · 31 unmodified lines | |||
| 459 | if (err < 0) | 460 | if (err < 0) |
| 460 | return err; | 461 | return err; |
| 461 | 462 | ||
| 462 | delay = 1000000000 / sensor->odr; | 463 | delay = 1000000000 / sensor->ext_info.slv_odr; |
| 463 | usleep_range(delay, 2 * delay); | 464 | usleep_range(delay, 2 * delay); |
| 464 | 465 | ||
| 465 | len = min_t(int, sizeof(data), ch->scan_type.realbits >> 3); | 466 | len = min_t(int, sizeof(data), ch->scan_type.realbits >> 3); |
| @@ -500,8 +501,8 @@ st_lsm6dsx_shub_read_raw(struct iio_dev *iio_dev, · 34 unmodified lines | |||
| 500 | iio_device_release_direct_mode(iio_dev); | 501 | iio_device_release_direct_mode(iio_dev); |
| 501 | break; | 502 | break; |
| 502 | case IIO_CHAN_INFO_SAMP_FREQ: | 503 | case IIO_CHAN_INFO_SAMP_FREQ: |
| 503 | *val = sensor->odr / 1000; | 504 | *val = sensor->ext_info.slv_odr / 1000; |
| 504 | *val2 = (sensor->odr % 1000) * 1000; | 505 | *val2 = (sensor->ext_info.slv_odr % 1000) * 1000; |
| 505 | ret = IIO_VAL_INT_PLUS_MICRO; | 506 | ret = IIO_VAL_INT_PLUS_MICRO; |
| 506 | break; | 507 | break; |
| 507 | case IIO_CHAN_INFO_SCALE: | 508 | case IIO_CHAN_INFO_SCALE: |
| @@ -535,8 +536,20 @@ st_lsm6dsx_shub_write_raw(struct iio_dev *iio_dev, · 27 unmodified lines | |||
| 535 | 536 | ||
| 536 | val = val * 1000 + val2 / 1000; | 537 | val = val * 1000 + val2 / 1000; |
| 537 | err = st_lsm6dsx_shub_get_odr_val(sensor, val, &data); | 538 | err = st_lsm6dsx_shub_get_odr_val(sensor, val, &data); |
| 538 | if (!err) | 539 | if (!err) { |
| 539 | sensor->odr = val; | 540 | struct st_lsm6dsx_hw *hw = sensor->hw; |
| 541 | struct st_lsm6dsx_sensor *ref_sensor; | ||
| 542 | u8 odr_val; | ||
| 543 | int odr; | ||
| 544 | |||
| 545 | ref_sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_ACC]); | ||
| 546 | odr = st_lsm6dsx_check_odr(ref_sensor, val, &odr_val); | ||
| 547 | if (odr < 0) | ||
| 548 | return odr; | ||
| 549 | |||
| 550 | sensor->ext_info.slv_odr = val; | ||
| 551 | sensor->odr = odr; | ||
| 552 | } | ||
| 540 | break; | 553 | break; |
| 541 | } | 554 | } |
| 542 | default: | 555 | default: |
| @@ -613,6 +626,7 @@ st_lsm6dsx_shub_alloc_iiodev(struct st_lsm6dsx_hw *hw, · 70 unmodified lines | |||
| 613 | const struct st_lsm6dsx_ext_dev_settings *info, | 626 | const struct st_lsm6dsx_ext_dev_settings *info, |
| 614 | u8 i2c_addr, const char *name) | 627 | u8 i2c_addr, const char *name) |
| 615 | { | 628 | { |
| 629 | enum st_lsm6dsx_sensor_id ref_id = ST_LSM6DSX_ID_ACC; | ||
| 616 | struct iio_chan_spec *ext_channels; | 630 | struct iio_chan_spec *ext_channels; |
| 617 | struct st_lsm6dsx_sensor *sensor; | 631 | struct st_lsm6dsx_sensor *sensor; |
| 618 | struct iio_dev *iio_dev; | 632 | struct iio_dev *iio_dev; |
| @@ -628,7 +642,8 @@ st_lsm6dsx_shub_alloc_iiodev(struct st_lsm6dsx_hw *hw, · 9 unmodified lines | |||
| 628 | sensor = iio_priv(iio_dev); | 642 | sensor = iio_priv(iio_dev); |
| 629 | sensor->id = id; | 643 | sensor->id = id; |
| 630 | sensor->hw = hw; | 644 | sensor->hw = hw; |
| 631 | sensor->odr = info->odr_table.odr_avl[0].milli_hz; | 645 | sensor->odr = hw->settings->odr_table[ref_id].odr_avl[0].milli_hz; |
| 646 | sensor->ext_info.slv_odr = info->odr_table.odr_avl[0].milli_hz; | ||
| 632 | sensor->gain = info->fs_table.fs_avl[0].gain; | 647 | sensor->gain = info->fs_table.fs_avl[0].gain; |
| 633 | sensor->ext_info.settings = info; | 648 | sensor->ext_info.settings = info; |
| 634 | sensor->ext_info.addr = i2c_addr; | 649 | sensor->ext_info.addr = i2c_addr; |
| @@ -915,14 +915,11 @@ static ssize_t iio_write_channel_info(struct device *dev, · 914 unmodified lines | |||
| 915 | return -EINVAL; | 915 | return -EINVAL; |
| 916 | integer = ch; | 916 | integer = ch; |
| 917 | } else { | 917 | } else { |
| 918 | ret = iio_str_to_fixpoint(buf, fract_mult, &integer, &fract); | 918 | ret = __iio_str_to_fixpoint(buf, fract_mult, &integer, &fract, |
| 919 | scale_db); | ||
| 919 | if (ret) | 920 | if (ret) |
| 920 | return ret; | 921 | return ret; |
| 921 | } | 922 | } |
| 922 | ret = __iio_str_to_fixpoint(buf, fract_mult, &integer, &fract, | ||
| 923 | scale_db); | ||
| 924 | if (ret) | ||
| 925 | return ret; | ||
| 926 | 923 | ||
| 927 | ret = indio_dev->info->write_raw(indio_dev, this_attr->c, | 924 | ret = indio_dev->info->write_raw(indio_dev, this_attr->c, |
| 928 | integer, fract, this_attr->address); | 925 | integer, fract, this_attr->address); |
| @@ -96,6 +96,8 @@ static inline void tcs_cmd_gen(struct tcs_cmd *cmd, u64 vote_x, u64 vote_y, · 95 unmodified lines | |||
| 96 | if (!cmd) | 96 | if (!cmd) |
| 97 | return; | 97 | return; |
| 98 | 98 | ||
| 99 | memset(cmd, 0, sizeof(*cmd)); | ||
| 100 | |||
| 99 | if (vote_x == 0 && vote_y == 0) | 101 | if (vote_x == 0 && vote_y == 0) |
| 100 | valid = false; | 102 | valid = false; |
| 101 | 103 | ||
| @@ -112,8 +114,7 @@ static inline void tcs_cmd_gen(struct tcs_cmd *cmd, u64 vote_x, u64 vote_y, · 10 unmodified lines | |||
| 112 | * Set the wait for completion flag on command that need to be completed | 114 | * Set the wait for completion flag on command that need to be completed |
| 113 | * before the next command. | 115 | * before the next command. |
| 114 | */ | 116 | */ |
| 115 | if (commit) | 117 | cmd->wait = commit; |
| 116 | cmd->wait = true; | ||
| 117 | } | 118 | } |
| 118 | 119 | ||
| 119 | static void tcs_list_gen(struct list_head *bcm_list, int bucket, | 120 | static void tcs_list_gen(struct list_head *bcm_list, int bucket, |
| @@ -416,7 +416,7 @@ static const struct irq_domain_ops bcm7038_l1_domain_ops = { · 415 unmodified lines | |||
| 416 | .map = bcm7038_l1_map, | 416 | .map = bcm7038_l1_map, |
| 417 | }; | 417 | }; |
| 418 | 418 | ||
| 419 | int __init bcm7038_l1_of_init(struct device_node *dn, | 419 | static int __init bcm7038_l1_of_init(struct device_node *dn, |
| 420 | struct device_node *parent) | 420 | struct device_node *parent) |
| 421 | { | 421 | { |
| 422 | struct bcm7038_l1_chip *intc; | 422 | struct bcm7038_l1_chip *intc; |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | |||
| 14 | #include <linux/dma-iommu.h> | 14 | #include <linux/dma-iommu.h> |
| 15 | #include <linux/efi.h> | 15 | #include <linux/efi.h> |
| 16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
| 17 | #include <linux/iopoll.h> | ||
| 17 | #include <linux/irqdomain.h> | 18 | #include <linux/irqdomain.h> |
| 18 | #include <linux/list.h> | 19 | #include <linux/list.h> |
| 19 | #include <linux/log2.h> | 20 | #include <linux/log2.h> |
| @@ -3672,6 +3673,20 @@ out: · 3652 unmodified lines | |||
| 3672 | return IRQ_SET_MASK_OK_DONE; | 3673 | return IRQ_SET_MASK_OK_DONE; |
| 3673 | } | 3674 | } |
| 3674 | 3675 | ||
| 3676 | static void its_wait_vpt_parse_complete(void) | ||
| 3677 | { | ||
| 3678 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); | ||
| 3679 | u64 val; | ||
| 3680 | |||
| 3681 | if (!gic_rdists->has_vpend_valid_dirty) | ||
| 3682 | return; | ||
| 3683 | |||
| 3684 | WARN_ON_ONCE(readq_relaxed_poll_timeout(vlpi_base + GICR_VPENDBASER, | ||
| 3685 | val, | ||
| 3686 | !(val & GICR_VPENDBASER_Dirty), | ||
| 3687 | 10, 500)); | ||
| 3688 | } | ||
| 3689 | |||
| 3675 | static void its_vpe_schedule(struct its_vpe *vpe) | 3690 | static void its_vpe_schedule(struct its_vpe *vpe) |
| 3676 | { | 3691 | { |
| 3677 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); | 3692 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); |
| @@ -3702,6 +3717,8 @@ static void its_vpe_schedule(struct its_vpe *vpe) · 24 unmodified lines | |||
| 3702 | val |= vpe->idai ? GICR_VPENDBASER_IDAI : 0; | 3717 | val |= vpe->idai ? GICR_VPENDBASER_IDAI : 0; |
| 3703 | val |= GICR_VPENDBASER_Valid; | 3718 | val |= GICR_VPENDBASER_Valid; |
| 3704 | gicr_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); | 3719 | gicr_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); |
| 3720 | |||
| 3721 | its_wait_vpt_parse_complete(); | ||
| 3705 | } | 3722 | } |
| 3706 | 3723 | ||
| 3707 | static void its_vpe_deschedule(struct its_vpe *vpe) | 3724 | static void its_vpe_deschedule(struct its_vpe *vpe) |
| @@ -3910,6 +3927,8 @@ static void its_vpe_4_1_schedule(struct its_vpe *vpe, · 202 unmodified lines | |||
| 3910 | val |= FIELD_PREP(GICR_VPENDBASER_4_1_VPEID, vpe->vpe_id); | 3927 | val |= FIELD_PREP(GICR_VPENDBASER_4_1_VPEID, vpe->vpe_id); |
| 3911 | 3928 | ||
| 3912 | gicr_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); | 3929 | gicr_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); |
| 3930 | |||
| 3931 | its_wait_vpt_parse_complete(); | ||
| 3913 | } | 3932 | } |
| 3914 | 3933 | ||
| 3915 | static void its_vpe_4_1_deschedule(struct its_vpe *vpe, | 3934 | static void its_vpe_4_1_deschedule(struct its_vpe *vpe, |
| @@ -4035,6 +4054,7 @@ static int its_sgi_set_affinity(struct irq_data *d, · 119 unmodified lines | |||
| 4035 | * not on the host (since they can only be targetting a vPE). | 4054 | * not on the host (since they can only be targetting a vPE). |
| 4036 | * Tell the kernel we've done whatever it asked for. | 4055 | * Tell the kernel we've done whatever it asked for. |
| 4037 | */ | 4056 | */ |
| 4057 | irq_data_update_effective_affinity(d, mask_val); | ||
| 4038 | return IRQ_SET_MASK_OK; | 4058 | return IRQ_SET_MASK_OK; |
| 4039 | } | 4059 | } |
| 4040 | 4060 | ||
| @@ -873,6 +873,7 @@ static int __gic_update_rdist_properties(struct redist_region *region, · 872 unmodified lines | |||
| 873 | gic_data.rdists.has_rvpeid &= !!(typer & GICR_TYPER_RVPEID); | 873 | gic_data.rdists.has_rvpeid &= !!(typer & GICR_TYPER_RVPEID); |
| 874 | gic_data.rdists.has_direct_lpi &= (!!(typer & GICR_TYPER_DirectLPIS) | | 874 | gic_data.rdists.has_direct_lpi &= (!!(typer & GICR_TYPER_DirectLPIS) | |
| 875 | gic_data.rdists.has_rvpeid); | 875 | gic_data.rdists.has_rvpeid); |
| 876 | gic_data.rdists.has_vpend_valid_dirty &= !!(typer & GICR_TYPER_DIRTY); | ||
| 876 | 877 | ||
| 877 | /* Detect non-sensical configurations */ | 878 | /* Detect non-sensical configurations */ |
| 878 | if (WARN_ON_ONCE(gic_data.rdists.has_rvpeid && !gic_data.rdists.has_vlpis)) { | 879 | if (WARN_ON_ONCE(gic_data.rdists.has_rvpeid && !gic_data.rdists.has_vlpis)) { |
| @@ -893,10 +894,11 @@ static void gic_update_rdist_properties(void) · 14 unmodified lines | |||
| 893 | if (WARN_ON(gic_data.ppi_nr == UINT_MAX)) | 894 | if (WARN_ON(gic_data.ppi_nr == UINT_MAX)) |
| 894 | gic_data.ppi_nr = 0; | 895 | gic_data.ppi_nr = 0; |
| 895 | pr_info("%d PPIs implemented\n", gic_data.ppi_nr); | 896 | pr_info("%d PPIs implemented\n", gic_data.ppi_nr); |
| 896 | pr_info("%sVLPI support, %sdirect LPI support, %sRVPEID support\n", | 897 | if (gic_data.rdists.has_vlpis) |
| 897 | !gic_data.rdists.has_vlpis ? "no " : "", | 898 | pr_info("GICv4 features: %s%s%s\n", |
| 898 | !gic_data.rdists.has_direct_lpi ? "no " : "", | 899 | gic_data.rdists.has_direct_lpi ? "DirectLPI " : "", |
| 899 | !gic_data.rdists.has_rvpeid ? "no " : ""); | 900 | gic_data.rdists.has_rvpeid ? "RVPEID " : "", |
| 901 | gic_data.rdists.has_vpend_valid_dirty ? "Valid+Dirty " : ""); | ||
| 900 | } | 902 | } |
| 901 | 903 | ||
| 902 | /* Check whether it's single security state view */ | 904 | /* Check whether it's single security state view */ |
| @@ -1620,6 +1622,7 @@ static int __init gic_init_bases(void __iomem *dist_base, · 717 unmodified lines | |||
| 1620 | gic_data.rdists.has_rvpeid = true; | 1622 | gic_data.rdists.has_rvpeid = true; |
| 1621 | gic_data.rdists.has_vlpis = true; | 1623 | gic_data.rdists.has_vlpis = true; |
| 1622 | gic_data.rdists.has_direct_lpi = true; | 1624 | gic_data.rdists.has_direct_lpi = true; |
| 1625 | gic_data.rdists.has_vpend_valid_dirty = true; | ||
| 1623 | 1626 | ||
| 1624 | if (WARN_ON(!gic_data.domain) || WARN_ON(!gic_data.rdists.rdist)) { | 1627 | if (WARN_ON(!gic_data.domain) || WARN_ON(!gic_data.rdists.rdist)) { |
| 1625 | err = -ENOMEM; | 1628 | err = -ENOMEM; |
| @@ -220,10 +220,16 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain, · 219 unmodified lines | |||
| 220 | return 0; | 220 | return 0; |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq, | ||
| 224 | unsigned int nr_irqs) | ||
| 225 | { | ||
| 226 | platform_msi_domain_free(domain, virq, nr_irqs); | ||
| 227 | } | ||
| 228 | |||
| 223 | static const struct irq_domain_ops mbigen_domain_ops = { | 229 | static const struct irq_domain_ops mbigen_domain_ops = { |
| 224 | .translate = mbigen_domain_translate, | 230 | .translate = mbigen_domain_translate, |
| 225 | .alloc = mbigen_irq_domain_alloc, | 231 | .alloc = mbigen_irq_domain_alloc, |
| 226 | .free = irq_domain_free_irqs_common, | 232 | .free = mbigen_irq_domain_free, |
| 227 | }; | 233 | }; |
| 228 | 234 | ||
| 229 | static int mbigen_of_create_domain(struct platform_device *pdev, | 235 | static int mbigen_of_create_domain(struct platform_device *pdev, |
| @@ -144,12 +144,17 @@ struct meson_gpio_irq_controller { · 143 unmodified lines | |||
| 144 | static void meson_gpio_irq_update_bits(struct meson_gpio_irq_controller *ctl, | 144 | static void meson_gpio_irq_update_bits(struct meson_gpio_irq_controller *ctl, |
| 145 | unsigned int reg, u32 mask, u32 val) | 145 | unsigned int reg, u32 mask, u32 val) |
| 146 | { | 146 | { |
| 147 | unsigned long flags; | ||
| 147 | u32 tmp; | 148 | u32 tmp; |
| 148 | 149 | ||
| 150 | spin_lock_irqsave(&ctl->lock, flags); | ||
| 151 | |||
| 149 | tmp = readl_relaxed(ctl->base + reg); | 152 | tmp = readl_relaxed(ctl->base + reg); |
| 150 | tmp &= ~mask; | 153 | tmp &= ~mask; |
| 151 | tmp |= val; | 154 | tmp |= val; |
| 152 | writel_relaxed(tmp, ctl->base + reg); | 155 | writel_relaxed(tmp, ctl->base + reg); |
| 156 | |||
| 157 | spin_unlock_irqrestore(&ctl->lock, flags); | ||
| 153 | } | 158 | } |
| 154 | 159 | ||
| 155 | static void meson_gpio_irq_init_dummy(struct meson_gpio_irq_controller *ctl) | 160 | static void meson_gpio_irq_init_dummy(struct meson_gpio_irq_controller *ctl) |
| @@ -196,14 +201,15 @@ meson_gpio_irq_request_channel(struct meson_gpio_irq_controller *ctl, · 40 unmodified lines | |||
| 196 | unsigned long hwirq, | 201 | unsigned long hwirq, |
| 197 | u32 **channel_hwirq) | 202 | u32 **channel_hwirq) |
| 198 | { | 203 | { |
| 204 | unsigned long flags; | ||
| 199 | unsigned int idx; | 205 | unsigned int idx; |
| 200 | 206 | ||
| 201 | spin_lock(&ctl->lock); | 207 | spin_lock_irqsave(&ctl->lock, flags); |
| 202 | 208 | ||
| 203 | /* Find a free channel */ | 209 | /* Find a free channel */ |
| 204 | idx = find_first_zero_bit(ctl->channel_map, NUM_CHANNEL); | 210 | idx = find_first_zero_bit(ctl->channel_map, NUM_CHANNEL); |
| 205 | if (idx >= NUM_CHANNEL) { | 211 | if (idx >= NUM_CHANNEL) { |
| 206 | spin_unlock(&ctl->lock); | 212 | spin_unlock_irqrestore(&ctl->lock, flags); |
| 207 | pr_err("No channel available\n"); | 213 | pr_err("No channel available\n"); |
| 208 | return -ENOSPC; | 214 | return -ENOSPC; |
| 209 | } | 215 | } |
| @@ -211,6 +217,8 @@ meson_gpio_irq_request_channel(struct meson_gpio_irq_controller *ctl, · 1 unmodified line | |||
| 211 | /* Mark the channel as used */ | 217 | /* Mark the channel as used */ |
| 212 | set_bit(idx, ctl->channel_map); | 218 | set_bit(idx, ctl->channel_map); |
| 213 | 219 | ||
| 220 | spin_unlock_irqrestore(&ctl->lock, flags); | ||
| 221 | |||
| 214 | /* | 222 | /* |
| 215 | * Setup the mux of the channel to route the signal of the pad | 223 | * Setup the mux of the channel to route the signal of the pad |
| 216 | * to the appropriate input of the GIC | 224 | * to the appropriate input of the GIC |
| @@ -225,8 +233,6 @@ meson_gpio_irq_request_channel(struct meson_gpio_irq_controller *ctl, · 8 unmodified lines | |||
| 225 | */ | 233 | */ |
| 226 | *channel_hwirq = &(ctl->channel_irqs[idx]); | 234 | *channel_hwirq = &(ctl->channel_irqs[idx]); |
| 227 | 235 | ||
| 228 | spin_unlock(&ctl->lock); | ||
| 229 | |||
| 230 | pr_debug("hwirq %lu assigned to channel %d - irq %u\n", | 236 | pr_debug("hwirq %lu assigned to channel %d - irq %u\n", |
| 231 | hwirq, idx, **channel_hwirq); | 237 | hwirq, idx, **channel_hwirq); |
| 232 | 238 | ||
| @@ -287,13 +293,9 @@ static int meson_gpio_irq_type_setup(struct meson_gpio_irq_controller *ctl, · 54 unmodified lines | |||
| 287 | val |= REG_EDGE_POL_LOW(params, idx); | 293 | val |= REG_EDGE_POL_LOW(params, idx); |
| 288 | } | 294 | } |
| 289 | 295 | ||
| 290 | spin_lock(&ctl->lock); | ||
| 291 | |||
| 292 | meson_gpio_irq_update_bits(ctl, REG_EDGE_POL, | 296 | meson_gpio_irq_update_bits(ctl, REG_EDGE_POL, |
| 293 | REG_EDGE_POL_MASK(params, idx), val); | 297 | REG_EDGE_POL_MASK(params, idx), val); |
| 294 | 298 | ||
| 295 | spin_unlock(&ctl->lock); | ||
| 296 | |||
| 297 | return 0; | 299 | return 0; |
| 298 | } | 300 | } |
| 299 | 301 | ||
| @@ -66,7 +66,7 @@ struct mvebu_icu_irq_data { · 65 unmodified lines | |||
| 66 | unsigned int type; | 66 | unsigned int type; |
| 67 | }; | 67 | }; |
| 68 | 68 | ||
| 69 | DEFINE_STATIC_KEY_FALSE(legacy_bindings); | 69 | static DEFINE_STATIC_KEY_FALSE(legacy_bindings); |
| 70 | 70 | ||
| 71 | static void mvebu_icu_init(struct mvebu_icu *icu, | 71 | static void mvebu_icu_init(struct mvebu_icu *icu, |
| 72 | struct mvebu_icu_msi_data *msi_data, | 72 | struct mvebu_icu_msi_data *msi_data, |
| @@ -56,7 +56,7 @@ · 55 unmodified lines | |||
| 56 | #define CONTEXT_THRESHOLD 0x00 | 56 | #define CONTEXT_THRESHOLD 0x00 |
| 57 | #define CONTEXT_CLAIM 0x04 | 57 | #define CONTEXT_CLAIM 0x04 |
| 58 | 58 | ||
| 59 | #define PLIC_DISABLE_THRESHOLD 0xf | 59 | #define PLIC_DISABLE_THRESHOLD 0x7 |
| 60 | #define PLIC_ENABLE_THRESHOLD 0 | 60 | #define PLIC_ENABLE_THRESHOLD 0 |
| 61 | 61 | ||
| 62 | struct plic_priv { | 62 | struct plic_priv { |
| @@ -37,6 +37,7 @@ · 36 unmodified lines | |||
| 37 | #define VINT_ENABLE_SET_OFFSET 0x0 | 37 | #define VINT_ENABLE_SET_OFFSET 0x0 |
| 38 | #define VINT_ENABLE_CLR_OFFSET 0x8 | 38 | #define VINT_ENABLE_CLR_OFFSET 0x8 |
| 39 | #define VINT_STATUS_OFFSET 0x18 | 39 | #define VINT_STATUS_OFFSET 0x18 |
| 40 | #define VINT_STATUS_MASKED_OFFSET 0x20 | ||
| 40 | 41 | ||
| 41 | /** | 42 | /** |
| 42 | * struct ti_sci_inta_event_desc - Description of an event coming to | 43 | * struct ti_sci_inta_event_desc - Description of an event coming to |
| @@ -116,7 +117,7 @@ static void ti_sci_inta_irq_handler(struct irq_desc *desc) · 73 unmodified lines | |||
| 116 | chained_irq_enter(irq_desc_get_chip(desc), desc); | 117 | chained_irq_enter(irq_desc_get_chip(desc), desc); |
| 117 | 118 | ||
| 118 | val = readq_relaxed(inta->base + vint_desc->vint_id * 0x1000 + | 119 | val = readq_relaxed(inta->base + vint_desc->vint_id * 0x1000 + |
| 119 | VINT_STATUS_OFFSET); | 120 | VINT_STATUS_MASKED_OFFSET); |
| 120 | 121 | ||
| 121 | for_each_set_bit(bit, &val, MAX_EVENTS_PER_VINT) { | 122 | for_each_set_bit(bit, &val, MAX_EVENTS_PER_VINT) { |
| 122 | virq = irq_find_mapping(domain, vint_desc->events[bit].hwirq); | 123 | virq = irq_find_mapping(domain, vint_desc->events[bit].hwirq); |
| @@ -743,10 +743,10 @@ check_send(struct isar_hw *isar, u8 rdm) · 742 unmodified lines | |||
| 743 | } | 743 | } |
| 744 | } | 744 | } |
| 745 | 745 | ||
| 746 | const char *dmril[] = {"NO SPEED", "1200/75", "NODEF2", "75/1200", "NODEF4", | 746 | static const char *dmril[] = {"NO SPEED", "1200/75", "NODEF2", "75/1200", "NODEF4", |
| 747 | "300", "600", "1200", "2400", "4800", "7200", | 747 | "300", "600", "1200", "2400", "4800", "7200", |
| 748 | "9600nt", "9600t", "12000", "14400", "WRONG"}; | 748 | "9600nt", "9600t", "12000", "14400", "WRONG"}; |
| 749 | const char *dmrim[] = {"NO MOD", "NO DEF", "V32/V32b", "V22", "V21", | 749 | static const char *dmrim[] = {"NO MOD", "NO DEF", "V32/V32b", "V22", "V21", |
| 750 | "Bell103", "V23", "Bell202", "V17", "V29", "V27ter"}; | 750 | "Bell103", "V23", "Bell202", "V17", "V29", "V27ter"}; |
| 751 | 751 | ||
| 752 | static void | 752 | static void |
| @@ -203,11 +203,12 @@ static int mei_me_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 202 unmodified lines | |||
| 203 | } | 203 | } |
| 204 | hw = to_me_hw(dev); | 204 | hw = to_me_hw(dev); |
| 205 | hw->mem_addr = pcim_iomap_table(pdev)[0]; | 205 | hw->mem_addr = pcim_iomap_table(pdev)[0]; |
| 206 | hw->irq = pdev->irq; | ||
| 207 | hw->read_fws = mei_me_read_fws; | 206 | hw->read_fws = mei_me_read_fws; |
| 208 | 207 | ||
| 209 | pci_enable_msi(pdev); | 208 | pci_enable_msi(pdev); |
| 210 | 209 | ||
| 210 | hw->irq = pdev->irq; | ||
| 211 | |||
| 211 | /* request and enable interrupt */ | 212 | /* request and enable interrupt */ |
| 212 | irqflags = pci_dev_msi_enabled(pdev) ? IRQF_ONESHOT : IRQF_SHARED; | 213 | irqflags = pci_dev_msi_enabled(pdev) ? IRQF_ONESHOT : IRQF_SHARED; |
| 213 | 214 | ||
| @@ -116,7 +116,7 @@ config MIC_COSM · 115 unmodified lines | |||
| 116 | 116 | ||
| 117 | config VOP | 117 | config VOP |
| 118 | tristate "VOP Driver" | 118 | tristate "VOP Driver" |
| 119 | depends on VOP_BUS | 119 | depends on VOP_BUS && VHOST_DPN |
| 120 | select VHOST_RING | 120 | select VHOST_RING |
| 121 | select VIRTIO | 121 | select VIRTIO |
| 122 | help | 122 | help |
| @@ -18,3 +18,5 @@ spi-nor-objs += winbond.o · 17 unmodified lines | |||
| 18 | spi-nor-objs += xilinx.o | 18 | spi-nor-objs += xilinx.o |
| 19 | spi-nor-objs += xmc.o | 19 | spi-nor-objs += xmc.o |
| 20 | obj-$(CONFIG_MTD_SPI_NOR) += spi-nor.o | 20 | obj-$(CONFIG_MTD_SPI_NOR) += spi-nor.o |
| 21 | |||
| 22 | obj-$(CONFIG_MTD_SPI_NOR) += controllers/ | ||
| @@ -50,7 +50,7 @@ config CAIF_HSI · 49 unmodified lines | |||
| 50 | 50 | ||
| 51 | config CAIF_VIRTIO | 51 | config CAIF_VIRTIO |
| 52 | tristate "CAIF virtio transport driver" | 52 | tristate "CAIF virtio transport driver" |
| 53 | depends on CAIF && HAS_DMA | 53 | depends on CAIF && HAS_DMA && VHOST_DPN |
| 54 | select VHOST_RING | 54 | select VHOST_RING |
| 55 | select VIRTIO | 55 | select VIRTIO |
| 56 | select GENERIC_ALLOCATOR | 56 | select GENERIC_ALLOCATOR |
| @@ -1474,6 +1474,10 @@ static int b53_arl_rw_op(struct b53_device *dev, unsigned int op) · 1473 unmodified lines | |||
| 1474 | reg |= ARLTBL_RW; | 1474 | reg |= ARLTBL_RW; |
| 1475 | else | 1475 | else |
| 1476 | reg &= ~ARLTBL_RW; | 1476 | reg &= ~ARLTBL_RW; |
| 1477 | if (dev->vlan_enabled) | ||
| 1478 | reg &= ~ARLTBL_IVL_SVL_SELECT; | ||
| 1479 | else | ||
| 1480 | reg |= ARLTBL_IVL_SVL_SELECT; | ||
| 1477 | b53_write8(dev, B53_ARLIO_PAGE, B53_ARLTBL_RW_CTRL, reg); | 1481 | b53_write8(dev, B53_ARLIO_PAGE, B53_ARLTBL_RW_CTRL, reg); |
| 1478 | 1482 | ||
| 1479 | return b53_arl_op_wait(dev); | 1483 | return b53_arl_op_wait(dev); |
| @@ -1483,6 +1487,7 @@ static int b53_arl_read(struct b53_device *dev, u64 mac, · 3 unmodified lines | |||
| 1483 | u16 vid, struct b53_arl_entry *ent, u8 *idx, | 1487 | u16 vid, struct b53_arl_entry *ent, u8 *idx, |
| 1484 | bool is_valid) | 1488 | bool is_valid) |
| 1485 | { | 1489 | { |
| 1490 | DECLARE_BITMAP(free_bins, B53_ARLTBL_MAX_BIN_ENTRIES); | ||
| 1486 | unsigned int i; | 1491 | unsigned int i; |
| 1487 | int ret; | 1492 | int ret; |
| 1488 | 1493 | ||
| @@ -1490,6 +1495,8 @@ static int b53_arl_read(struct b53_device *dev, u64 mac, · 1 unmodified line | |||
| 1490 | if (ret) | 1495 | if (ret) |
| 1491 | return ret; | 1496 | return ret; |
| 1492 | 1497 | ||
| 1498 | bitmap_zero(free_bins, dev->num_arl_entries); | ||
| 1499 | |||
| 1493 | /* Read the bins */ | 1500 | /* Read the bins */ |
| 1494 | for (i = 0; i < dev->num_arl_entries; i++) { | 1501 | for (i = 0; i < dev->num_arl_entries; i++) { |
| 1495 | u64 mac_vid; | 1502 | u64 mac_vid; |
| @@ -1501,13 +1508,24 @@ static int b53_arl_read(struct b53_device *dev, u64 mac, · 5 unmodified lines | |||
| 1501 | B53_ARLTBL_DATA_ENTRY(i), &fwd_entry); | 1508 | B53_ARLTBL_DATA_ENTRY(i), &fwd_entry); |
| 1502 | b53_arl_to_entry(ent, mac_vid, fwd_entry); | 1509 | b53_arl_to_entry(ent, mac_vid, fwd_entry); |
| 1503 | 1510 | ||
| 1504 | if (!(fwd_entry & ARLTBL_VALID)) | 1511 | if (!(fwd_entry & ARLTBL_VALID)) { |
| 1512 | set_bit(i, free_bins); | ||
| 1505 | continue; | 1513 | continue; |
| 1514 | } | ||
| 1506 | if ((mac_vid & ARLTBL_MAC_MASK) != mac) | 1515 | if ((mac_vid & ARLTBL_MAC_MASK) != mac) |
| 1507 | continue; | 1516 | continue; |
| 1517 | if (dev->vlan_enabled && | ||
| 1518 | ((mac_vid >> ARLTBL_VID_S) & ARLTBL_VID_MASK) != vid) | ||
| 1519 | continue; | ||
| 1508 | *idx = i; | 1520 | *idx = i; |
| 1521 | return 0; | ||
| 1509 | } | 1522 | } |
| 1510 | 1523 | ||
| 1524 | if (bitmap_weight(free_bins, dev->num_arl_entries) == 0) | ||
| 1525 | return -ENOSPC; | ||
| 1526 | |||
| 1527 | *idx = find_first_bit(free_bins, dev->num_arl_entries); | ||
| 1528 | |||
| 1511 | return -ENOENT; | 1529 | return -ENOENT; |
| 1512 | } | 1530 | } |
| 1513 | 1531 | ||
| @@ -1537,10 +1555,21 @@ static int b53_arl_op(struct b53_device *dev, int op, int port, · 23 unmodified lines | |||
| 1537 | if (op) | 1555 | if (op) |
| 1538 | return ret; | 1556 | return ret; |
| 1539 | 1557 | ||
| 1540 | /* We could not find a matching MAC, so reset to a new entry */ | 1558 | switch (ret) { |
| 1541 | if (ret) { | 1559 | case -ENOSPC: |
| 1560 | dev_dbg(dev->dev, "{%pM,%.4d} no space left in ARL\n", | ||
| 1561 | addr, vid); | ||
| 1562 | return is_valid ? ret : 0; | ||
| 1563 | case -ENOENT: | ||
| 1564 | /* We could not find a matching MAC, so reset to a new entry */ | ||
| 1565 | dev_dbg(dev->dev, "{%pM,%.4d} not found, using idx: %d\n", | ||
| 1566 | addr, vid, idx); | ||
| 1542 | fwd_entry = 0; | 1567 | fwd_entry = 0; |
| 1543 | idx = 1; | 1568 | break; |
| 1569 | default: | ||
| 1570 | dev_dbg(dev->dev, "{%pM,%.4d} found, using idx: %d\n", | ||
| 1571 | addr, vid, idx); | ||
| 1572 | break; | ||
| 1544 | } | 1573 | } |
| 1545 | 1574 | ||
| 1546 | /* For multicast address, the port is a bitmask and the validity | 1575 | /* For multicast address, the port is a bitmask and the validity |
| @@ -1558,7 +1587,6 @@ static int b53_arl_op(struct b53_device *dev, int op, int port, · 11 unmodified lines | |||
| 1558 | ent.is_valid = !!(ent.port); | 1587 | ent.is_valid = !!(ent.port); |
| 1559 | } | 1588 | } |
| 1560 | 1589 | ||
| 1561 | ent.is_valid = is_valid; | ||
| 1562 | ent.vid = vid; | 1590 | ent.vid = vid; |
| 1563 | ent.is_static = true; | 1591 | ent.is_static = true; |
| 1564 | ent.is_age = false; | 1592 | ent.is_age = false; |
| @@ -292,6 +292,7 @@ · 291 unmodified lines | |||
| 292 | /* ARL Table Read/Write Register (8 bit) */ | 292 | /* ARL Table Read/Write Register (8 bit) */ |
| 293 | #define B53_ARLTBL_RW_CTRL 0x00 | 293 | #define B53_ARLTBL_RW_CTRL 0x00 |
| 294 | #define ARLTBL_RW BIT(0) | 294 | #define ARLTBL_RW BIT(0) |
| 295 | #define ARLTBL_IVL_SVL_SELECT BIT(6) | ||
| 295 | #define ARLTBL_START_DONE BIT(7) | 296 | #define ARLTBL_START_DONE BIT(7) |
| 296 | 297 | ||
| 297 | /* MAC Address Index Register (48 bit) */ | 298 | /* MAC Address Index Register (48 bit) */ |
| @@ -304,7 +305,7 @@ · 6 unmodified lines | |||
| 304 | * | 305 | * |
| 305 | * BCM5325 and BCM5365 share most definitions below | 306 | * BCM5325 and BCM5365 share most definitions below |
| 306 | */ | 307 | */ |
| 307 | #define B53_ARLTBL_MAC_VID_ENTRY(n) (0x10 * (n)) | 308 | #define B53_ARLTBL_MAC_VID_ENTRY(n) ((0x10 * (n)) + 0x10) |
| 308 | #define ARLTBL_MAC_MASK 0xffffffffffffULL | 309 | #define ARLTBL_MAC_MASK 0xffffffffffffULL |
| 309 | #define ARLTBL_VID_S 48 | 310 | #define ARLTBL_VID_S 48 |
| 310 | #define ARLTBL_VID_MASK_25 0xff | 311 | #define ARLTBL_VID_MASK_25 0xff |
| @@ -316,13 +317,16 @@ · 5 unmodified lines | |||
| 316 | #define ARLTBL_VALID_25 BIT(63) | 317 | #define ARLTBL_VALID_25 BIT(63) |
| 317 | 318 | ||
| 318 | /* ARL Table Data Entry N Registers (32 bit) */ | 319 | /* ARL Table Data Entry N Registers (32 bit) */ |
| 319 | #define B53_ARLTBL_DATA_ENTRY(n) ((0x10 * (n)) + 0x08) | 320 | #define B53_ARLTBL_DATA_ENTRY(n) ((0x10 * (n)) + 0x18) |
| 320 | #define ARLTBL_DATA_PORT_ID_MASK 0x1ff | 321 | #define ARLTBL_DATA_PORT_ID_MASK 0x1ff |
| 321 | #define ARLTBL_TC(tc) ((3 & tc) << 11) | 322 | #define ARLTBL_TC(tc) ((3 & tc) << 11) |
| 322 | #define ARLTBL_AGE BIT(14) | 323 | #define ARLTBL_AGE BIT(14) |
| 323 | #define ARLTBL_STATIC BIT(15) | 324 | #define ARLTBL_STATIC BIT(15) |
| 324 | #define ARLTBL_VALID BIT(16) | 325 | #define ARLTBL_VALID BIT(16) |
| 325 | 326 | ||
| 327 | /* Maximum number of bin entries in the ARL for all switches */ | ||
| 328 | #define B53_ARLTBL_MAX_BIN_ENTRIES 4 | ||
| 329 | |||
| 326 | /* ARL Search Control Register (8 bit) */ | 330 | /* ARL Search Control Register (8 bit) */ |
| 327 | #define B53_ARL_SRCH_CTL 0x50 | 331 | #define B53_ARL_SRCH_CTL 0x50 |
| 328 | #define B53_ARL_SRCH_CTL_25 0x20 | 332 | #define B53_ARL_SRCH_CTL_25 0x20 |
| @@ -66,58 +66,6 @@ static const struct mt7530_mib_desc mt7530_mib[] = { · 65 unmodified lines | |||
| 66 | MIB_DESC(1, 0xb8, "RxArlDrop"), | 66 | MIB_DESC(1, 0xb8, "RxArlDrop"), |
| 67 | }; | 67 | }; |
| 68 | 68 | ||
| 69 | static int | ||
| 70 | mt7623_trgmii_write(struct mt7530_priv *priv, u32 reg, u32 val) | ||
| 71 | { | ||
| 72 | int ret; | ||
| 73 | |||
| 74 | ret = regmap_write(priv->ethernet, TRGMII_BASE(reg), val); | ||
| 75 | if (ret < 0) | ||
| 76 | dev_err(priv->dev, | ||
| 77 | "failed to priv write register\n"); | ||
| 78 | return ret; | ||
| 79 | } | ||
| 80 | |||
| 81 | static u32 | ||
| 82 | mt7623_trgmii_read(struct mt7530_priv *priv, u32 reg) | ||
| 83 | { | ||
| 84 | int ret; | ||
| 85 | u32 val; | ||
| 86 | |||
| 87 | ret = regmap_read(priv->ethernet, TRGMII_BASE(reg), &val); | ||
| 88 | if (ret < 0) { | ||
| 89 | dev_err(priv->dev, | ||
| 90 | "failed to priv read register\n"); | ||
| 91 | return ret; | ||
| 92 | } | ||
| 93 | |||
| 94 | return val; | ||
| 95 | } | ||
| 96 | |||
| 97 | static void | ||
| 98 | mt7623_trgmii_rmw(struct mt7530_priv *priv, u32 reg, | ||
| 99 | u32 mask, u32 set) | ||
| 100 | { | ||
| 101 | u32 val; | ||
| 102 | |||
| 103 | val = mt7623_trgmii_read(priv, reg); | ||
| 104 | val &= ~mask; | ||
| 105 | val |= set; | ||
| 106 | mt7623_trgmii_write(priv, reg, val); | ||
| 107 | } | ||
| 108 | |||
| 109 | static void | ||
| 110 | mt7623_trgmii_set(struct mt7530_priv *priv, u32 reg, u32 val) | ||
| 111 | { | ||
| 112 | mt7623_trgmii_rmw(priv, reg, 0, val); | ||
| 113 | } | ||
| 114 | |||
| 115 | static void | ||
| 116 | mt7623_trgmii_clear(struct mt7530_priv *priv, u32 reg, u32 val) | ||
| 117 | { | ||
| 118 | mt7623_trgmii_rmw(priv, reg, val, 0); | ||
| 119 | } | ||
| 120 | |||
| 121 | static int | 69 | static int |
| 122 | core_read_mmd_indirect(struct mt7530_priv *priv, int prtad, int devad) | 70 | core_read_mmd_indirect(struct mt7530_priv *priv, int prtad, int devad) |
| 123 | { | 71 | { |
| @@ -530,27 +478,6 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, int mode) · 406 unmodified lines | |||
| 530 | for (i = 0 ; i < NUM_TRGMII_CTRL; i++) | 478 | for (i = 0 ; i < NUM_TRGMII_CTRL; i++) |
| 531 | mt7530_rmw(priv, MT7530_TRGMII_RD(i), | 479 | mt7530_rmw(priv, MT7530_TRGMII_RD(i), |
| 532 | RD_TAP_MASK, RD_TAP(16)); | 480 | RD_TAP_MASK, RD_TAP(16)); |
| 533 | else | ||
| 534 | if (priv->id != ID_MT7621) | ||
| 535 | mt7623_trgmii_set(priv, GSW_INTF_MODE, | ||
| 536 | INTF_MODE_TRGMII); | ||
| 537 | |||
| 538 | return 0; | ||
| 539 | } | ||
| 540 | |||
| 541 | static int | ||
| 542 | mt7623_pad_clk_setup(struct dsa_switch *ds) | ||
| 543 | { | ||
| 544 | struct mt7530_priv *priv = ds->priv; | ||
| 545 | int i; | ||
| 546 | |||
| 547 | for (i = 0 ; i < NUM_TRGMII_CTRL; i++) | ||
| 548 | mt7623_trgmii_write(priv, GSW_TRGMII_TD_ODT(i), | ||
| 549 | TD_DM_DRVP(8) | TD_DM_DRVN(8)); | ||
| 550 | |||
| 551 | mt7623_trgmii_set(priv, GSW_TRGMII_RCK_CTRL, RX_RST | RXC_DQSISEL); | ||
| 552 | mt7623_trgmii_clear(priv, GSW_TRGMII_RCK_CTRL, RX_RST); | ||
| 553 | |||
| 554 | return 0; | 481 | return 0; |
| 555 | } | 482 | } |
| 556 | 483 | ||
| @@ -846,8 +773,9 @@ mt7530_port_set_vlan_unaware(struct dsa_switch *ds, int port) · 289 unmodified lines | |||
| 846 | */ | 773 | */ |
| 847 | mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, | 774 | mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, |
| 848 | MT7530_PORT_MATRIX_MODE); | 775 | MT7530_PORT_MATRIX_MODE); |
| 849 | mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK, | 776 | mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK | PVC_EG_TAG_MASK, |
| 850 | VLAN_ATTR(MT7530_VLAN_TRANSPARENT)); | 777 | VLAN_ATTR(MT7530_VLAN_TRANSPARENT) | |
| 778 | PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); | ||
| 851 | 779 | ||
| 852 | for (i = 0; i < MT7530_NUM_PORTS; i++) { | 780 | for (i = 0; i < MT7530_NUM_PORTS; i++) { |
| 853 | if (dsa_is_user_port(ds, i) && | 781 | if (dsa_is_user_port(ds, i) && |
| @@ -863,8 +791,8 @@ mt7530_port_set_vlan_unaware(struct dsa_switch *ds, int port) · 9 unmodified lines | |||
| 863 | if (all_user_ports_removed) { | 791 | if (all_user_ports_removed) { |
| 864 | mt7530_write(priv, MT7530_PCR_P(MT7530_CPU_PORT), | 792 | mt7530_write(priv, MT7530_PCR_P(MT7530_CPU_PORT), |
| 865 | PCR_MATRIX(dsa_user_ports(priv->ds))); | 793 | PCR_MATRIX(dsa_user_ports(priv->ds))); |
| 866 | mt7530_write(priv, MT7530_PVC_P(MT7530_CPU_PORT), | 794 | mt7530_write(priv, MT7530_PVC_P(MT7530_CPU_PORT), PORT_SPEC_TAG |
| 867 | PORT_SPEC_TAG); | 795 | | PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); |
| 868 | } | 796 | } |
| 869 | } | 797 | } |
| 870 | 798 | ||
| @@ -890,8 +818,9 @@ mt7530_port_set_vlan_aware(struct dsa_switch *ds, int port) · 19 unmodified lines | |||
| 890 | /* Set the port as a user port which is to be able to recognize VID | 818 | /* Set the port as a user port which is to be able to recognize VID |
| 891 | * from incoming packets before fetching entry within the VLAN table. | 819 | * from incoming packets before fetching entry within the VLAN table. |
| 892 | */ | 820 | */ |
| 893 | mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK, | 821 | mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK | PVC_EG_TAG_MASK, |
| 894 | VLAN_ATTR(MT7530_VLAN_USER)); | 822 | VLAN_ATTR(MT7530_VLAN_USER) | |
| 823 | PVC_EG_TAG(MT7530_VLAN_EG_DISABLED)); | ||
| 895 | } | 824 | } |
| 896 | 825 | ||
| 897 | static void | 826 | static void |
| @@ -1303,10 +1232,6 @@ mt7530_setup(struct dsa_switch *ds) · 405 unmodified lines | |||
| 1303 | dn = dsa_to_port(ds, MT7530_CPU_PORT)->master->dev.of_node->parent; | 1232 | dn = dsa_to_port(ds, MT7530_CPU_PORT)->master->dev.of_node->parent; |
| 1304 | 1233 | ||
| 1305 | if (priv->id == ID_MT7530) { | 1234 | if (priv->id == ID_MT7530) { |
| 1306 | priv->ethernet = syscon_node_to_regmap(dn); | ||
| 1307 | if (IS_ERR(priv->ethernet)) | ||
| 1308 | return PTR_ERR(priv->ethernet); | ||
| 1309 | |||
| 1310 | regulator_set_voltage(priv->core_pwr, 1000000, 1000000); | 1235 | regulator_set_voltage(priv->core_pwr, 1000000, 1000000); |
| 1311 | ret = regulator_enable(priv->core_pwr); | 1236 | ret = regulator_enable(priv->core_pwr); |
| 1312 | if (ret < 0) { | 1237 | if (ret < 0) { |
| @@ -1380,6 +1305,10 @@ mt7530_setup(struct dsa_switch *ds) · 67 unmodified lines | |||
| 1380 | mt7530_cpu_port_enable(priv, i); | 1305 | mt7530_cpu_port_enable(priv, i); |
| 1381 | else | 1306 | else |
| 1382 | mt7530_port_disable(ds, i); | 1307 | mt7530_port_disable(ds, i); |
| 1308 | |||
| 1309 | /* Enable consistent egress tag */ | ||
| 1310 | mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK, | ||
| 1311 | PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); | ||
| 1383 | } | 1312 | } |
| 1384 | 1313 | ||
| 1385 | /* Setup port 5 */ | 1314 | /* Setup port 5 */ |
| @@ -1468,14 +1397,6 @@ static void mt7530_phylink_mac_config(struct dsa_switch *ds, int port, · 82 unmodified lines | |||
| 1468 | /* Setup TX circuit incluing relevant PAD and driving */ | 1397 | /* Setup TX circuit incluing relevant PAD and driving */ |
| 1469 | mt7530_pad_clk_setup(ds, state->interface); | 1398 | mt7530_pad_clk_setup(ds, state->interface); |
| 1470 | 1399 | ||
| 1471 | if (priv->id == ID_MT7530) { | ||
| 1472 | /* Setup RX circuit, relevant PAD and driving on the | ||
| 1473 | * host which must be placed after the setup on the | ||
| 1474 | * device side is all finished. | ||
| 1475 | */ | ||
| 1476 | mt7623_pad_clk_setup(ds); | ||
| 1477 | } | ||
| 1478 | |||
| 1479 | priv->p6_interface = state->interface; | 1400 | priv->p6_interface = state->interface; |
| 1480 | break; | 1401 | break; |
| 1481 | default: | 1402 | default: |
| @@ -172,9 +172,16 @@ enum mt7530_port_mode { · 171 unmodified lines | |||
| 172 | /* Register for port vlan control */ | 172 | /* Register for port vlan control */ |
| 173 | #define MT7530_PVC_P(x) (0x2010 + ((x) * 0x100)) | 173 | #define MT7530_PVC_P(x) (0x2010 + ((x) * 0x100)) |
| 174 | #define PORT_SPEC_TAG BIT(5) | 174 | #define PORT_SPEC_TAG BIT(5) |
| 175 | #define PVC_EG_TAG(x) (((x) & 0x7) << 8) | ||
| 176 | #define PVC_EG_TAG_MASK PVC_EG_TAG(7) | ||
| 175 | #define VLAN_ATTR(x) (((x) & 0x3) << 6) | 177 | #define VLAN_ATTR(x) (((x) & 0x3) << 6) |
| 176 | #define VLAN_ATTR_MASK VLAN_ATTR(3) | 178 | #define VLAN_ATTR_MASK VLAN_ATTR(3) |
| 177 | 179 | ||
| 180 | enum mt7530_vlan_port_eg_tag { | ||
| 181 | MT7530_VLAN_EG_DISABLED = 0, | ||
| 182 | MT7530_VLAN_EG_CONSISTENT = 1, | ||
| 183 | }; | ||
| 184 | |||
| 178 | enum mt7530_vlan_port_attr { | 185 | enum mt7530_vlan_port_attr { |
| 179 | MT7530_VLAN_USER = 0, | 186 | MT7530_VLAN_USER = 0, |
| 180 | MT7530_VLAN_TRANSPARENT = 3, | 187 | MT7530_VLAN_TRANSPARENT = 3, |
| @@ -277,7 +284,6 @@ enum mt7530_vlan_port_attr { · 96 unmodified lines | |||
| 277 | 284 | ||
| 278 | /* Registers for TRGMII on the both side */ | 285 | /* Registers for TRGMII on the both side */ |
| 279 | #define MT7530_TRGMII_RCK_CTRL 0x7a00 | 286 | #define MT7530_TRGMII_RCK_CTRL 0x7a00 |
| 280 | #define GSW_TRGMII_RCK_CTRL 0x300 | ||
| 281 | #define RX_RST BIT(31) | 287 | #define RX_RST BIT(31) |
| 282 | #define RXC_DQSISEL BIT(30) | 288 | #define RXC_DQSISEL BIT(30) |
| 283 | #define DQSI1_TAP_MASK (0x7f << 8) | 289 | #define DQSI1_TAP_MASK (0x7f << 8) |
| @@ -286,31 +292,24 @@ enum mt7530_vlan_port_attr { · 2 unmodified lines | |||
| 286 | #define DQSI0_TAP(x) ((x) & 0x7f) | 292 | #define DQSI0_TAP(x) ((x) & 0x7f) |
| 287 | 293 | ||
| 288 | #define MT7530_TRGMII_RCK_RTT 0x7a04 | 294 | #define MT7530_TRGMII_RCK_RTT 0x7a04 |
| 289 | #define GSW_TRGMII_RCK_RTT 0x304 | ||
| 290 | #define DQS1_GATE BIT(31) | 295 | #define DQS1_GATE BIT(31) |
| 291 | #define DQS0_GATE BIT(30) | 296 | #define DQS0_GATE BIT(30) |
| 292 | 297 | ||
| 293 | #define MT7530_TRGMII_RD(x) (0x7a10 + (x) * 8) | 298 | #define MT7530_TRGMII_RD(x) (0x7a10 + (x) * 8) |
| 294 | #define GSW_TRGMII_RD(x) (0x310 + (x) * 8) | ||
| 295 | #define BSLIP_EN BIT(31) | 299 | #define BSLIP_EN BIT(31) |
| 296 | #define EDGE_CHK BIT(30) | 300 | #define EDGE_CHK BIT(30) |
| 297 | #define RD_TAP_MASK 0x7f | 301 | #define RD_TAP_MASK 0x7f |
| 298 | #define RD_TAP(x) ((x) & 0x7f) | 302 | #define RD_TAP(x) ((x) & 0x7f) |
| 299 | 303 | ||
| 300 | #define GSW_TRGMII_TXCTRL 0x340 | ||
| 301 | #define MT7530_TRGMII_TXCTRL 0x7a40 | 304 | #define MT7530_TRGMII_TXCTRL 0x7a40 |
| 302 | #define TRAIN_TXEN BIT(31) | 305 | #define TRAIN_TXEN BIT(31) |
| 303 | #define TXC_INV BIT(30) | 306 | #define TXC_INV BIT(30) |
| 304 | #define TX_RST BIT(28) | 307 | #define TX_RST BIT(28) |
| 305 | 308 | ||
| 306 | #define MT7530_TRGMII_TD_ODT(i) (0x7a54 + 8 * (i)) | 309 | #define MT7530_TRGMII_TD_ODT(i) (0x7a54 + 8 * (i)) |
| 307 | #define GSW_TRGMII_TD_ODT(i) (0x354 + 8 * (i)) | ||
| 308 | #define TD_DM_DRVP(x) ((x) & 0xf) | 310 | #define TD_DM_DRVP(x) ((x) & 0xf) |
| 309 | #define TD_DM_DRVN(x) (((x) & 0xf) << 4) | 311 | #define TD_DM_DRVN(x) (((x) & 0xf) << 4) |
| 310 | 312 | ||
| 311 | #define GSW_INTF_MODE 0x390 | ||
| 312 | #define INTF_MODE_TRGMII BIT(1) | ||
| 313 | |||
| 314 | #define MT7530_TRGMII_TCK_CTRL 0x7a78 | 313 | #define MT7530_TRGMII_TCK_CTRL 0x7a78 |
| 315 | #define TCK_TAP(x) (((x) & 0xf) << 8) | 314 | #define TCK_TAP(x) (((x) & 0xf) << 8) |
| 316 | 315 | ||
| @@ -443,7 +442,6 @@ static const char *p5_intf_modes(unsigned int p5_interface) · 126 unmodified lines | |||
| 443 | * @ds: The pointer to the dsa core structure | 442 | * @ds: The pointer to the dsa core structure |
| 444 | * @bus: The bus used for the device and built-in PHY | 443 | * @bus: The bus used for the device and built-in PHY |
| 445 | * @rstc: The pointer to reset control used by MCM | 444 | * @rstc: The pointer to reset control used by MCM |
| 446 | * @ethernet: The regmap used for access TRGMII-based registers | ||
| 447 | * @core_pwr: The power supplied into the core | 445 | * @core_pwr: The power supplied into the core |
| 448 | * @io_pwr: The power supplied into the I/O | 446 | * @io_pwr: The power supplied into the I/O |
| 449 | * @reset: The descriptor for GPIO line tied to its reset pin | 447 | * @reset: The descriptor for GPIO line tied to its reset pin |
| @@ -460,7 +458,6 @@ struct mt7530_priv { · 10 unmodified lines | |||
| 460 | struct dsa_switch *ds; | 458 | struct dsa_switch *ds; |
| 461 | struct mii_bus *bus; | 459 | struct mii_bus *bus; |
| 462 | struct reset_control *rstc; | 460 | struct reset_control *rstc; |
| 463 | struct regmap *ethernet; | ||
| 464 | struct regulator *core_pwr; | 461 | struct regulator *core_pwr; |
| 465 | struct regulator *io_pwr; | 462 | struct regulator *io_pwr; |
| 466 | struct gpio_desc *reset; | 463 | struct gpio_desc *reset; |
| @@ -709,7 +709,8 @@ static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port, · 708 unmodified lines | |||
| 709 | ops = chip->info->ops; | 709 | ops = chip->info->ops; |
| 710 | 710 | ||
| 711 | mv88e6xxx_reg_lock(chip); | 711 | mv88e6xxx_reg_lock(chip); |
| 712 | if (!mv88e6xxx_port_ppu_updates(chip, port) && ops->port_set_link) | 712 | if ((!mv88e6xxx_port_ppu_updates(chip, port) || |
| 713 | mode == MLO_AN_FIXED) && ops->port_set_link) | ||
| 713 | err = ops->port_set_link(chip, port, LINK_FORCED_DOWN); | 714 | err = ops->port_set_link(chip, port, LINK_FORCED_DOWN); |
| 714 | mv88e6xxx_reg_unlock(chip); | 715 | mv88e6xxx_reg_unlock(chip); |
| 715 | 716 | ||
| @@ -731,7 +732,7 @@ static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port, · 15 unmodified lines | |||
| 731 | ops = chip->info->ops; | 732 | ops = chip->info->ops; |
| 732 | 733 | ||
| 733 | mv88e6xxx_reg_lock(chip); | 734 | mv88e6xxx_reg_lock(chip); |
| 734 | if (!mv88e6xxx_port_ppu_updates(chip, port)) { | 735 | if (!mv88e6xxx_port_ppu_updates(chip, port) || mode == MLO_AN_FIXED) { |
| 735 | /* FIXME: for an automedia port, should we force the link | 736 | /* FIXME: for an automedia port, should we force the link |
| 736 | * down here - what if the link comes up due to "other" media | 737 | * down here - what if the link comes up due to "other" media |
| 737 | * while we're bringing the port up, how is the exclusivity | 738 | * while we're bringing the port up, how is the exclusivity |
| @@ -46,11 +46,8 @@ static int felix_fdb_add(struct dsa_switch *ds, int port, · 45 unmodified lines | |||
| 46 | const unsigned char *addr, u16 vid) | 46 | const unsigned char *addr, u16 vid) |
| 47 | { | 47 | { |
| 48 | struct ocelot *ocelot = ds->priv; | 48 | struct ocelot *ocelot = ds->priv; |
| 49 | bool vlan_aware; | ||
| 50 | 49 | ||
| 51 | vlan_aware = dsa_port_is_vlan_filtering(dsa_to_port(ds, port)); | 50 | return ocelot_fdb_add(ocelot, port, addr, vid); |
| 52 | |||
| 53 | return ocelot_fdb_add(ocelot, port, addr, vid, vlan_aware); | ||
| 54 | } | 51 | } |
| 55 | 52 | ||
| 56 | static int felix_fdb_del(struct dsa_switch *ds, int port, | 53 | static int felix_fdb_del(struct dsa_switch *ds, int port, |
| @@ -514,7 +514,7 @@ static void xgbe_isr_task(unsigned long data) · 513 unmodified lines | |||
| 514 | xgbe_disable_rx_tx_ints(pdata); | 514 | xgbe_disable_rx_tx_ints(pdata); |
| 515 | 515 | ||
| 516 | /* Turn on polling */ | 516 | /* Turn on polling */ |
| 517 | __napi_schedule_irqoff(&pdata->napi); | 517 | __napi_schedule(&pdata->napi); |
| 518 | } | 518 | } |
| 519 | } else { | 519 | } else { |
| 520 | /* Don't clear Rx/Tx status if doing per channel DMA | 520 | /* Don't clear Rx/Tx status if doing per channel DMA |
| @@ -664,7 +664,8 @@ static struct sk_buff *bcm_sysport_rx_refill(struct bcm_sysport_priv *priv, · 663 unmodified lines | |||
| 664 | dma_addr_t mapping; | 664 | dma_addr_t mapping; |
| 665 | 665 | ||
| 666 | /* Allocate a new SKB for a new packet */ | 666 | /* Allocate a new SKB for a new packet */ |
| 667 | skb = netdev_alloc_skb(priv->netdev, RX_BUF_LENGTH); | 667 | skb = __netdev_alloc_skb(priv->netdev, RX_BUF_LENGTH, |
| 668 | GFP_ATOMIC | __GFP_NOWARN); | ||
| 668 | if (!skb) { | 669 | if (!skb) { |
| 669 | priv->mib.alloc_rx_buff_failed++; | 670 | priv->mib.alloc_rx_buff_failed++; |
| 670 | netif_err(priv, rx_err, ndev, "SKB alloc failed\n"); | 671 | netif_err(priv, rx_err, ndev, "SKB alloc failed\n"); |
| @@ -2475,7 +2476,6 @@ static int bcm_sysport_probe(struct platform_device *pdev) · 1804 unmodified lines | |||
| 2475 | priv->wol_irq = platform_get_irq(pdev, 1); | 2476 | priv->wol_irq = platform_get_irq(pdev, 1); |
| 2476 | } | 2477 | } |
| 2477 | if (priv->irq0 <= 0 || (priv->irq1 <= 0 && !priv->is_lite)) { | 2478 | if (priv->irq0 <= 0 || (priv->irq1 <= 0 && !priv->is_lite)) { |
| 2478 | dev_err(&pdev->dev, "invalid interrupts\n"); | ||
| 2479 | ret = -EINVAL; | 2479 | ret = -EINVAL; |
| 2480 | goto err_free_netdev; | 2480 | goto err_free_netdev; |
| 2481 | } | 2481 | } |
| @@ -172,7 +172,6 @@ static int bgmac_probe(struct platform_device *pdev) · 171 unmodified lines | |||
| 172 | { | 172 | { |
| 173 | struct device_node *np = pdev->dev.of_node; | 173 | struct device_node *np = pdev->dev.of_node; |
| 174 | struct bgmac *bgmac; | 174 | struct bgmac *bgmac; |
| 175 | struct resource *regs; | ||
| 176 | const u8 *mac_addr; | 175 | const u8 *mac_addr; |
| 177 | 176 | ||
| 178 | bgmac = bgmac_alloc(&pdev->dev); | 177 | bgmac = bgmac_alloc(&pdev->dev); |
| @@ -202,31 +201,21 @@ static int bgmac_probe(struct platform_device *pdev) · 23 unmodified lines | |||
| 202 | if (bgmac->irq < 0) | 201 | if (bgmac->irq < 0) |
| 203 | return bgmac->irq; | 202 | return bgmac->irq; |
| 204 | 203 | ||
| 205 | regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "amac_base"); | 204 | bgmac->plat.base = |
| 206 | if (!regs) { | 205 | devm_platform_ioremap_resource_byname(pdev, "amac_base"); |
| 207 | dev_err(&pdev->dev, "Unable to obtain base resource\n"); | ||
| 208 | return -EINVAL; | ||
| 209 | } | ||
| 210 | |||
| 211 | bgmac->plat.base = devm_ioremap_resource(&pdev->dev, regs); | ||
| 212 | if (IS_ERR(bgmac->plat.base)) | 206 | if (IS_ERR(bgmac->plat.base)) |
| 213 | return PTR_ERR(bgmac->plat.base); | 207 | return PTR_ERR(bgmac->plat.base); |
| 214 | 208 | ||
| 215 | regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base"); | 209 | bgmac->plat.idm_base = |
| 216 | if (regs) { | 210 | devm_platform_ioremap_resource_byname(pdev, "idm_base"); |
| 217 | bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs); | 211 | if (IS_ERR(bgmac->plat.idm_base)) |
| 218 | if (IS_ERR(bgmac->plat.idm_base)) | 212 | return PTR_ERR(bgmac->plat.idm_base); |
| 219 | return PTR_ERR(bgmac->plat.idm_base); | 213 | bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK; |
| 220 | bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK; | ||
| 221 | } | ||
| 222 | 214 | ||
| 223 | regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nicpm_base"); | 215 | bgmac->plat.nicpm_base = |
| 224 | if (regs) { | 216 | devm_platform_ioremap_resource_byname(pdev, "nicpm_base"); |
| 225 | bgmac->plat.nicpm_base = devm_ioremap_resource(&pdev->dev, | 217 | if (IS_ERR(bgmac->plat.nicpm_base)) |
| 226 | regs); | 218 | return PTR_ERR(bgmac->plat.nicpm_base); |
| 227 | if (IS_ERR(bgmac->plat.nicpm_base)) | ||
| 228 | return PTR_ERR(bgmac->plat.nicpm_base); | ||
| 229 | } | ||
| 230 | 219 | ||
| 231 | bgmac->read = platform_bgmac_read; | 220 | bgmac->read = platform_bgmac_read; |
| 232 | bgmac->write = platform_bgmac_write; | 221 | bgmac->write = platform_bgmac_write; |
| @@ -934,6 +934,8 @@ static void bcmgenet_get_ethtool_stats(struct net_device *dev, · 933 unmodified lines | |||
| 934 | if (netif_running(dev)) | 934 | if (netif_running(dev)) |
| 935 | bcmgenet_update_mib_counters(priv); | 935 | bcmgenet_update_mib_counters(priv); |
| 936 | 936 | ||
| 937 | dev->netdev_ops->ndo_get_stats(dev); | ||
| 938 | |||
| 937 | for (i = 0; i < BCMGENET_STATS_LEN; i++) { | 939 | for (i = 0; i < BCMGENET_STATS_LEN; i++) { |
| 938 | const struct bcmgenet_stats *s; | 940 | const struct bcmgenet_stats *s; |
| 939 | char *p; | 941 | char *p; |
| @@ -1622,7 +1624,8 @@ static struct sk_buff *bcmgenet_rx_refill(struct bcmgenet_priv *priv, · 682 unmodified lines | |||
| 1622 | dma_addr_t mapping; | 1624 | dma_addr_t mapping; |
| 1623 | 1625 | ||
| 1624 | /* Allocate a new Rx skb */ | 1626 | /* Allocate a new Rx skb */ |
| 1625 | skb = netdev_alloc_skb(priv->dev, priv->rx_buf_len + SKB_ALIGNMENT); | 1627 | skb = __netdev_alloc_skb(priv->dev, priv->rx_buf_len + SKB_ALIGNMENT, |
| 1628 | GFP_ATOMIC | __GFP_NOWARN); | ||
| 1626 | if (!skb) { | 1629 | if (!skb) { |
| 1627 | priv->mib.alloc_rx_buff_failed++; | 1630 | priv->mib.alloc_rx_buff_failed++; |
| 1628 | netif_err(priv, rx_err, priv->dev, | 1631 | netif_err(priv, rx_err, priv->dev, |
| @@ -3156,6 +3159,7 @@ static struct net_device_stats *bcmgenet_get_stats(struct net_device *dev) · 1527 unmodified lines | |||
| 3156 | dev->stats.rx_packets = rx_packets; | 3159 | dev->stats.rx_packets = rx_packets; |
| 3157 | dev->stats.rx_errors = rx_errors; | 3160 | dev->stats.rx_errors = rx_errors; |
| 3158 | dev->stats.rx_missed_errors = rx_errors; | 3161 | dev->stats.rx_missed_errors = rx_errors; |
| 3162 | dev->stats.rx_dropped = rx_dropped; | ||
| 3159 | return &dev->stats; | 3163 | return &dev->stats; |
| 3160 | } | 3164 | } |
| 3161 | 3165 | ||
| @@ -1049,9 +1049,9 @@ static void cudbg_t4_fwcache(struct cudbg_init *pdbg_init, · 1048 unmodified lines | |||
| 1049 | } | 1049 | } |
| 1050 | } | 1050 | } |
| 1051 | 1051 | ||
| 1052 | static unsigned long cudbg_mem_region_size(struct cudbg_init *pdbg_init, | 1052 | static int cudbg_mem_region_size(struct cudbg_init *pdbg_init, |
| 1053 | struct cudbg_error *cudbg_err, | 1053 | struct cudbg_error *cudbg_err, |
| 1054 | u8 mem_type) | 1054 | u8 mem_type, unsigned long *region_size) |
| 1055 | { | 1055 | { |
| 1056 | struct adapter *padap = pdbg_init->adap; | 1056 | struct adapter *padap = pdbg_init->adap; |
| 1057 | struct cudbg_meminfo mem_info; | 1057 | struct cudbg_meminfo mem_info; |
| @@ -1060,15 +1060,23 @@ static unsigned long cudbg_mem_region_size(struct cudbg_init *pdbg_init, · 2 unmodified lines | |||
| 1060 | 1060 | ||
| 1061 | memset(&mem_info, 0, sizeof(struct cudbg_meminfo)); | 1061 | memset(&mem_info, 0, sizeof(struct cudbg_meminfo)); |
| 1062 | rc = cudbg_fill_meminfo(padap, &mem_info); | 1062 | rc = cudbg_fill_meminfo(padap, &mem_info); |
| 1063 | if (rc) | 1063 | if (rc) { |
| 1064 | cudbg_err->sys_err = rc; | ||
| 1064 | return rc; | 1065 | return rc; |
| 1066 | } | ||
| 1065 | 1067 | ||
| 1066 | cudbg_t4_fwcache(pdbg_init, cudbg_err); | 1068 | cudbg_t4_fwcache(pdbg_init, cudbg_err); |
| 1067 | rc = cudbg_meminfo_get_mem_index(padap, &mem_info, mem_type, &mc_idx); | 1069 | rc = cudbg_meminfo_get_mem_index(padap, &mem_info, mem_type, &mc_idx); |
| 1068 | if (rc) | 1070 | if (rc) { |
| 1071 | cudbg_err->sys_err = rc; | ||
| 1069 | return rc; | 1072 | return rc; |
| 1073 | } | ||
| 1074 | |||
| 1075 | if (region_size) | ||
| 1076 | *region_size = mem_info.avail[mc_idx].limit - | ||
| 1077 | mem_info.avail[mc_idx].base; | ||
| 1070 | 1078 | ||
| 1071 | return mem_info.avail[mc_idx].limit - mem_info.avail[mc_idx].base; | 1079 | return 0; |
| 1072 | } | 1080 | } |
| 1073 | 1081 | ||
| 1074 | static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init, | 1082 | static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init, |
| @@ -1076,7 +1084,12 @@ static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init, · 1 unmodified line | |||
| 1076 | struct cudbg_error *cudbg_err, | 1084 | struct cudbg_error *cudbg_err, |
| 1077 | u8 mem_type) | 1085 | u8 mem_type) |
| 1078 | { | 1086 | { |
| 1079 | unsigned long size = cudbg_mem_region_size(pdbg_init, cudbg_err, mem_type); | 1087 | unsigned long size = 0; |
| 1088 | int rc; | ||
| 1089 | |||
| 1090 | rc = cudbg_mem_region_size(pdbg_init, cudbg_err, mem_type, &size); | ||
| 1091 | if (rc) | ||
| 1092 | return rc; | ||
| 1080 | 1093 | ||
| 1081 | return cudbg_read_fw_mem(pdbg_init, dbg_buff, mem_type, size, | 1094 | return cudbg_read_fw_mem(pdbg_init, dbg_buff, mem_type, size, |
| 1082 | cudbg_err); | 1095 | cudbg_err); |
| @@ -311,32 +311,17 @@ static int cxgb4_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) · 310 unmodified lines | |||
| 311 | */ | 311 | */ |
| 312 | static int cxgb4_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) | 312 | static int cxgb4_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) |
| 313 | { | 313 | { |
| 314 | struct adapter *adapter = (struct adapter *)container_of(ptp, | 314 | struct adapter *adapter = container_of(ptp, struct adapter, |
| 315 | struct adapter, ptp_clock_info); | 315 | ptp_clock_info); |
| 316 | struct fw_ptp_cmd c; | ||
| 317 | u64 ns; | 316 | u64 ns; |
| 318 | int err; | ||
| 319 | |||
| 320 | memset(&c, 0, sizeof(c)); | ||
| 321 | c.op_to_portid = cpu_to_be32(FW_CMD_OP_V(FW_PTP_CMD) | | ||
| 322 | FW_CMD_REQUEST_F | | ||
| 323 | FW_CMD_READ_F | | ||
| 324 | FW_PTP_CMD_PORTID_V(0)); | ||
| 325 | c.retval_len16 = cpu_to_be32(FW_CMD_LEN16_V(sizeof(c) / 16)); | ||
| 326 | c.u.ts.sc = FW_PTP_SC_GET_TIME; | ||
| 327 | 317 | ||
| 328 | err = t4_wr_mbox(adapter, adapter->mbox, &c, sizeof(c), &c); | 318 | ns = t4_read_reg(adapter, T5_PORT_REG(0, MAC_PORT_PTP_SUM_LO_A)); |
| 329 | if (err < 0) { | 319 | ns |= (u64)t4_read_reg(adapter, |
| 330 | dev_err(adapter->pdev_dev, | 320 | T5_PORT_REG(0, MAC_PORT_PTP_SUM_HI_A)) << 32; |
| 331 | "PTP: %s error %d\n", __func__, -err); | ||
| 332 | return err; | ||
| 333 | } | ||
| 334 | 321 | ||
| 335 | /* convert to timespec*/ | 322 | /* convert to timespec*/ |
| 336 | ns = be64_to_cpu(c.u.ts.tm); | ||
| 337 | *ts = ns_to_timespec64(ns); | 323 | *ts = ns_to_timespec64(ns); |
| 338 | 324 | return 0; | |
| 339 | return err; | ||
| 340 | } | 325 | } |
| 341 | 326 | ||
| 342 | /** | 327 | /** |
| @@ -3742,7 +3742,7 @@ int t4_phy_fw_ver(struct adapter *adap, int *phy_fw_ver) · 3741 unmodified lines | |||
| 3742 | FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_VERSION)); | 3742 | FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_VERSION)); |
| 3743 | ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, | 3743 | ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, |
| 3744 | ¶m, &val); | 3744 | ¶m, &val); |
| 3745 | if (ret < 0) | 3745 | if (ret) |
| 3746 | return ret; | 3746 | return ret; |
| 3747 | *phy_fw_ver = val; | 3747 | *phy_fw_ver = val; |
| 3748 | return 0; | 3748 | return 0; |
| @@ -1906,6 +1906,9 @@ · 1905 unmodified lines | |||
| 1906 | 1906 | ||
| 1907 | #define MAC_PORT_CFG2_A 0x818 | 1907 | #define MAC_PORT_CFG2_A 0x818 |
| 1908 | 1908 | ||
| 1909 | #define MAC_PORT_PTP_SUM_LO_A 0x990 | ||
| 1910 | #define MAC_PORT_PTP_SUM_HI_A 0x994 | ||
| 1911 | |||
| 1909 | #define MPS_CMN_CTL_A 0x9000 | 1912 | #define MPS_CMN_CTL_A 0x9000 |
| 1910 | 1913 | ||
| 1911 | #define COUNTPAUSEMCRX_S 5 | 1914 | #define COUNTPAUSEMCRX_S 5 |
| @@ -1277,7 +1277,7 @@ static const struct net_device_ops tulip_netdev_ops = { · 1276 unmodified lines | |||
| 1277 | #endif | 1277 | #endif |
| 1278 | }; | 1278 | }; |
| 1279 | 1279 | ||
| 1280 | const struct pci_device_id early_486_chipsets[] = { | 1280 | static const struct pci_device_id early_486_chipsets[] = { |
| 1281 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82424) }, | 1281 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82424) }, |
| 1282 | { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_496) }, | 1282 | { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_496) }, |
| 1283 | { }, | 1283 | { }, |
| @@ -488,6 +488,12 @@ struct fec_enet_priv_rx_q { · 487 unmodified lines | |||
| 488 | struct sk_buff *rx_skbuff[RX_RING_SIZE]; | 488 | struct sk_buff *rx_skbuff[RX_RING_SIZE]; |
| 489 | }; | 489 | }; |
| 490 | 490 | ||
| 491 | struct fec_stop_mode_gpr { | ||
| 492 | struct regmap *gpr; | ||
| 493 | u8 reg; | ||
| 494 | u8 bit; | ||
| 495 | }; | ||
| 496 | |||
| 491 | /* The FEC buffer descriptors track the ring buffers. The rx_bd_base and | 497 | /* The FEC buffer descriptors track the ring buffers. The rx_bd_base and |
| 492 | * tx_bd_base always point to the base of the buffer descriptors. The | 498 | * tx_bd_base always point to the base of the buffer descriptors. The |
| 493 | * cur_rx and cur_tx point to the currently available buffer. | 499 | * cur_rx and cur_tx point to the currently available buffer. |
| @@ -562,6 +568,7 @@ struct fec_enet_private { · 68 unmodified lines | |||
| 562 | int hwts_tx_en; | 568 | int hwts_tx_en; |
| 563 | struct delayed_work time_keep; | 569 | struct delayed_work time_keep; |
| 564 | struct regulator *reg_phy; | 570 | struct regulator *reg_phy; |
| 571 | struct fec_stop_mode_gpr stop_gpr; | ||
| 565 | 572 | ||
| 566 | unsigned int tx_align; | 573 | unsigned int tx_align; |
| 567 | unsigned int rx_align; | 574 | unsigned int rx_align; |
| @@ -62,6 +62,8 @@ · 61 unmodified lines | |||
| 62 | #include <linux/if_vlan.h> | 62 | #include <linux/if_vlan.h> |
| 63 | #include <linux/pinctrl/consumer.h> | 63 | #include <linux/pinctrl/consumer.h> |
| 64 | #include <linux/prefetch.h> | 64 | #include <linux/prefetch.h> |
| 65 | #include <linux/mfd/syscon.h> | ||
| 66 | #include <linux/regmap.h> | ||
| 65 | #include <soc/imx/cpuidle.h> | 67 | #include <soc/imx/cpuidle.h> |
| 66 | 68 | ||
| 67 | #include <asm/cacheflush.h> | 69 | #include <asm/cacheflush.h> |
| @@ -84,6 +86,56 @@ static void fec_enet_itr_coal_init(struct net_device *ndev); · 16 unmodified lines | |||
| 84 | #define FEC_ENET_OPD_V 0xFFF0 | 86 | #define FEC_ENET_OPD_V 0xFFF0 |
| 85 | #define FEC_MDIO_PM_TIMEOUT 100 /* ms */ | 87 | #define FEC_MDIO_PM_TIMEOUT 100 /* ms */ |
| 86 | 88 | ||
| 89 | struct fec_devinfo { | ||
| 90 | u32 quirks; | ||
| 91 | u8 stop_gpr_reg; | ||
| 92 | u8 stop_gpr_bit; | ||
| 93 | }; | ||
| 94 | |||
| 95 | static const struct fec_devinfo fec_imx25_info = { | ||
| 96 | .quirks = FEC_QUIRK_USE_GASKET | FEC_QUIRK_MIB_CLEAR | | ||
| 97 | FEC_QUIRK_HAS_FRREG, | ||
| 98 | }; | ||
| 99 | |||
| 100 | static const struct fec_devinfo fec_imx27_info = { | ||
| 101 | .quirks = FEC_QUIRK_MIB_CLEAR | FEC_QUIRK_HAS_FRREG, | ||
| 102 | }; | ||
| 103 | |||
| 104 | static const struct fec_devinfo fec_imx28_info = { | ||
| 105 | .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME | | ||
| 106 | FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC | | ||
| 107 | FEC_QUIRK_HAS_FRREG, | ||
| 108 | }; | ||
| 109 | |||
| 110 | static const struct fec_devinfo fec_imx6q_info = { | ||
| 111 | .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | ||
| 112 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | | ||
| 113 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 | | ||
| 114 | FEC_QUIRK_HAS_RACC, | ||
| 115 | .stop_gpr_reg = 0x34, | ||
| 116 | .stop_gpr_bit = 27, | ||
| 117 | }; | ||
| 118 | |||
| 119 | static const struct fec_devinfo fec_mvf600_info = { | ||
| 120 | .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_RACC, | ||
| 121 | }; | ||
| 122 | |||
| 123 | static const struct fec_devinfo fec_imx6x_info = { | ||
| 124 | .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | ||
| 125 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | | ||
| 126 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB | | ||
| 127 | FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE | | ||
| 128 | FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE, | ||
| 129 | }; | ||
| 130 | |||
| 131 | static const struct fec_devinfo fec_imx6ul_info = { | ||
| 132 | .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | ||
| 133 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | | ||
| 134 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR007885 | | ||
| 135 | FEC_QUIRK_BUG_CAPTURE | FEC_QUIRK_HAS_RACC | | ||
| 136 | FEC_QUIRK_HAS_COALESCE, | ||
| 137 | }; | ||
| 138 | |||
| 87 | static struct platform_device_id fec_devtype[] = { | 139 | static struct platform_device_id fec_devtype[] = { |
| 88 | { | 140 | { |
| 89 | /* keep it for coldfire */ | 141 | /* keep it for coldfire */ |
| @@ -91,39 +143,25 @@ static struct platform_device_id fec_devtype[] = { · 1 unmodified line | |||
| 91 | .driver_data = 0, | 143 | .driver_data = 0, |
| 92 | }, { | 144 | }, { |
| 93 | .name = "imx25-fec", | 145 | .name = "imx25-fec", |
| 94 | .driver_data = FEC_QUIRK_USE_GASKET | FEC_QUIRK_MIB_CLEAR | | 146 | .driver_data = (kernel_ulong_t)&fec_imx25_info, |
| 95 | FEC_QUIRK_HAS_FRREG, | ||
| 96 | }, { | 147 | }, { |
| 97 | .name = "imx27-fec", | 148 | .name = "imx27-fec", |
| 98 | .driver_data = FEC_QUIRK_MIB_CLEAR | FEC_QUIRK_HAS_FRREG, | 149 | .driver_data = (kernel_ulong_t)&fec_imx27_info, |
| 99 | }, { | 150 | }, { |
| 100 | .name = "imx28-fec", | 151 | .name = "imx28-fec", |
| 101 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME | | 152 | .driver_data = (kernel_ulong_t)&fec_imx28_info, |
| 102 | FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC | | ||
| 103 | FEC_QUIRK_HAS_FRREG, | ||
| 104 | }, { | 153 | }, { |
| 105 | .name = "imx6q-fec", | 154 | .name = "imx6q-fec", |
| 106 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | 155 | .driver_data = (kernel_ulong_t)&fec_imx6q_info, |
| 107 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | | ||
| 108 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 | | ||
| 109 | FEC_QUIRK_HAS_RACC, | ||
| 110 | }, { | 156 | }, { |
| 111 | .name = "mvf600-fec", | 157 | .name = "mvf600-fec", |
| 112 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_RACC, | 158 | .driver_data = (kernel_ulong_t)&fec_mvf600_info, |
| 113 | }, { | 159 | }, { |
| 114 | .name = "imx6sx-fec", | 160 | .name = "imx6sx-fec", |
| 115 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | 161 | .driver_data = (kernel_ulong_t)&fec_imx6x_info, |
| 116 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | | ||
| 117 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB | | ||
| 118 | FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE | | ||
| 119 | FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE, | ||
| 120 | }, { | 162 | }, { |
| 121 | .name = "imx6ul-fec", | 163 | .name = "imx6ul-fec", |
| 122 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | 164 | .driver_data = (kernel_ulong_t)&fec_imx6ul_info, |
| 123 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | | ||
| 124 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR007885 | | ||
| 125 | FEC_QUIRK_BUG_CAPTURE | FEC_QUIRK_HAS_RACC | | ||
| 126 | FEC_QUIRK_HAS_COALESCE, | ||
| 127 | }, { | 165 | }, { |
| 128 | /* sentinel */ | 166 | /* sentinel */ |
| 129 | } | 167 | } |
| @@ -1092,11 +1130,28 @@ fec_restart(struct net_device *ndev) · 962 unmodified lines | |||
| 1092 | 1130 | ||
| 1093 | } | 1131 | } |
| 1094 | 1132 | ||
| 1133 | static void fec_enet_stop_mode(struct fec_enet_private *fep, bool enabled) | ||
| 1134 | { | ||
| 1135 | struct fec_platform_data *pdata = fep->pdev->dev.platform_data; | ||
| 1136 | struct fec_stop_mode_gpr *stop_gpr = &fep->stop_gpr; | ||
| 1137 | |||
| 1138 | if (stop_gpr->gpr) { | ||
| 1139 | if (enabled) | ||
| 1140 | regmap_update_bits(stop_gpr->gpr, stop_gpr->reg, | ||
| 1141 | BIT(stop_gpr->bit), | ||
| 1142 | BIT(stop_gpr->bit)); | ||
| 1143 | else | ||
| 1144 | regmap_update_bits(stop_gpr->gpr, stop_gpr->reg, | ||
| 1145 | BIT(stop_gpr->bit), 0); | ||
| 1146 | } else if (pdata && pdata->sleep_mode_enable) { | ||
| 1147 | pdata->sleep_mode_enable(enabled); | ||
| 1148 | } | ||
| 1149 | } | ||
| 1150 | |||
| 1095 | static void | 1151 | static void |
| 1096 | fec_stop(struct net_device *ndev) | 1152 | fec_stop(struct net_device *ndev) |
| 1097 | { | 1153 | { |
| 1098 | struct fec_enet_private *fep = netdev_priv(ndev); | 1154 | struct fec_enet_private *fep = netdev_priv(ndev); |
| 1099 | struct fec_platform_data *pdata = fep->pdev->dev.platform_data; | ||
| 1100 | u32 rmii_mode = readl(fep->hwp + FEC_R_CNTRL) & (1 << 8); | 1155 | u32 rmii_mode = readl(fep->hwp + FEC_R_CNTRL) & (1 << 8); |
| 1101 | u32 val; | 1156 | u32 val; |
| 1102 | 1157 | ||
| @@ -1125,9 +1180,7 @@ fec_stop(struct net_device *ndev) · 22 unmodified lines | |||
| 1125 | val = readl(fep->hwp + FEC_ECNTRL); | 1180 | val = readl(fep->hwp + FEC_ECNTRL); |
| 1126 | val |= (FEC_ECR_MAGICEN | FEC_ECR_SLEEP); | 1181 | val |= (FEC_ECR_MAGICEN | FEC_ECR_SLEEP); |
| 1127 | writel(val, fep->hwp + FEC_ECNTRL); | 1182 | writel(val, fep->hwp + FEC_ECNTRL); |
| 1128 | 1183 | fec_enet_stop_mode(fep, true); | |
| 1129 | if (pdata && pdata->sleep_mode_enable) | ||
| 1130 | pdata->sleep_mode_enable(true); | ||
| 1131 | } | 1184 | } |
| 1132 | writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED); | 1185 | writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED); |
| 1133 | 1186 | ||
| @@ -3398,6 +3451,37 @@ static int fec_enet_get_irq_cnt(struct platform_device *pdev) · 2264 unmodified lines | |||
| 3398 | return irq_cnt; | 3451 | return irq_cnt; |
| 3399 | } | 3452 | } |
| 3400 | 3453 | ||
| 3454 | static int fec_enet_init_stop_mode(struct fec_enet_private *fep, | ||
| 3455 | struct fec_devinfo *dev_info, | ||
| 3456 | struct device_node *np) | ||
| 3457 | { | ||
| 3458 | struct device_node *gpr_np; | ||
| 3459 | int ret = 0; | ||
| 3460 | |||
| 3461 | if (!dev_info) | ||
| 3462 | return 0; | ||
| 3463 | |||
| 3464 | gpr_np = of_parse_phandle(np, "gpr", 0); | ||
| 3465 | if (!gpr_np) | ||
| 3466 | return 0; | ||
| 3467 | |||
| 3468 | fep->stop_gpr.gpr = syscon_node_to_regmap(gpr_np); | ||
| 3469 | if (IS_ERR(fep->stop_gpr.gpr)) { | ||
| 3470 | dev_err(&fep->pdev->dev, "could not find gpr regmap\n"); | ||
| 3471 | ret = PTR_ERR(fep->stop_gpr.gpr); | ||
| 3472 | fep->stop_gpr.gpr = NULL; | ||
| 3473 | goto out; | ||
| 3474 | } | ||
| 3475 | |||
| 3476 | fep->stop_gpr.reg = dev_info->stop_gpr_reg; | ||
| 3477 | fep->stop_gpr.bit = dev_info->stop_gpr_bit; | ||
| 3478 | |||
| 3479 | out: | ||
| 3480 | of_node_put(gpr_np); | ||
| 3481 | |||
| 3482 | return ret; | ||
| 3483 | } | ||
| 3484 | |||
| 3401 | static int | 3485 | static int |
| 3402 | fec_probe(struct platform_device *pdev) | 3486 | fec_probe(struct platform_device *pdev) |
| 3403 | { | 3487 | { |
| @@ -3413,6 +3497,7 @@ fec_probe(struct platform_device *pdev) · 9 unmodified lines | |||
| 3413 | int num_rx_qs; | 3497 | int num_rx_qs; |
| 3414 | char irq_name[8]; | 3498 | char irq_name[8]; |
| 3415 | int irq_cnt; | 3499 | int irq_cnt; |
| 3500 | struct fec_devinfo *dev_info; | ||
| 3416 | 3501 | ||
| 3417 | fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs); | 3502 | fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs); |
| 3418 | 3503 | ||
| @@ -3430,7 +3515,9 @@ fec_probe(struct platform_device *pdev) · 11 unmodified lines | |||
| 3430 | of_id = of_match_device(fec_dt_ids, &pdev->dev); | 3515 | of_id = of_match_device(fec_dt_ids, &pdev->dev); |
| 3431 | if (of_id) | 3516 | if (of_id) |
| 3432 | pdev->id_entry = of_id->data; | 3517 | pdev->id_entry = of_id->data; |
| 3433 | fep->quirks = pdev->id_entry->driver_data; | 3518 | dev_info = (struct fec_devinfo *)pdev->id_entry->driver_data; |
| 3519 | if (dev_info) | ||
| 3520 | fep->quirks = dev_info->quirks; | ||
| 3434 | 3521 | ||
| 3435 | fep->netdev = ndev; | 3522 | fep->netdev = ndev; |
| 3436 | fep->num_rx_queues = num_rx_qs; | 3523 | fep->num_rx_queues = num_rx_qs; |
| @@ -3464,6 +3551,10 @@ fec_probe(struct platform_device *pdev) · 27 unmodified lines | |||
| 3464 | if (of_get_property(np, "fsl,magic-packet", NULL)) | 3551 | if (of_get_property(np, "fsl,magic-packet", NULL)) |
| 3465 | fep->wol_flag |= FEC_WOL_HAS_MAGIC_PACKET; | 3552 | fep->wol_flag |= FEC_WOL_HAS_MAGIC_PACKET; |
| 3466 | 3553 | ||
| 3554 | ret = fec_enet_init_stop_mode(fep, dev_info, np); | ||
| 3555 | if (ret) | ||
| 3556 | goto failed_stop_mode; | ||
| 3557 | |||
| 3467 | phy_node = of_parse_phandle(np, "phy-handle", 0); | 3558 | phy_node = of_parse_phandle(np, "phy-handle", 0); |
| 3468 | if (!phy_node && of_phy_is_fixed_link(np)) { | 3559 | if (!phy_node && of_phy_is_fixed_link(np)) { |
| 3469 | ret = of_phy_register_fixed_link(np); | 3560 | ret = of_phy_register_fixed_link(np); |
| @@ -3632,6 +3723,7 @@ failed_clk: · 162 unmodified lines | |||
| 3632 | if (of_phy_is_fixed_link(np)) | 3723 | if (of_phy_is_fixed_link(np)) |
| 3633 | of_phy_deregister_fixed_link(np); | 3724 | of_phy_deregister_fixed_link(np); |
| 3634 | of_node_put(phy_node); | 3725 | of_node_put(phy_node); |
| 3726 | failed_stop_mode: | ||
| 3635 | failed_phy: | 3727 | failed_phy: |
| 3636 | dev_id--; | 3728 | dev_id--; |
| 3637 | failed_ioremap: | 3729 | failed_ioremap: |
| @@ -3709,7 +3801,6 @@ static int __maybe_unused fec_resume(struct device *dev) · 71 unmodified lines | |||
| 3709 | { | 3801 | { |
| 3710 | struct net_device *ndev = dev_get_drvdata(dev); | 3802 | struct net_device *ndev = dev_get_drvdata(dev); |
| 3711 | struct fec_enet_private *fep = netdev_priv(ndev); | 3803 | struct fec_enet_private *fep = netdev_priv(ndev); |
| 3712 | struct fec_platform_data *pdata = fep->pdev->dev.platform_data; | ||
| 3713 | int ret; | 3804 | int ret; |
| 3714 | int val; | 3805 | int val; |
| 3715 | 3806 | ||
| @@ -3727,8 +3818,8 @@ static int __maybe_unused fec_resume(struct device *dev) · 11 unmodified lines | |||
| 3727 | goto failed_clk; | 3818 | goto failed_clk; |
| 3728 | } | 3819 | } |
| 3729 | if (fep->wol_flag & FEC_WOL_FLAG_ENABLE) { | 3820 | if (fep->wol_flag & FEC_WOL_FLAG_ENABLE) { |
| 3730 | if (pdata && pdata->sleep_mode_enable) | 3821 | fec_enet_stop_mode(fep, false); |
| 3731 | pdata->sleep_mode_enable(false); | 3822 | |
| 3732 | val = readl(fep->hwp + FEC_ECNTRL); | 3823 | val = readl(fep->hwp + FEC_ECNTRL); |
| 3733 | val &= ~(FEC_ECR_MAGICEN | FEC_ECR_SLEEP); | 3824 | val &= ~(FEC_ECR_MAGICEN | FEC_ECR_SLEEP); |
| 3734 | writel(val, fep->hwp + FEC_ECNTRL); | 3825 | writel(val, fep->hwp + FEC_ECNTRL); |
| @@ -1476,7 +1476,7 @@ static bool e1000_check_64k_bound(struct e1000_adapter *adapter, void *start, · 1475 unmodified lines | |||
| 1476 | if (hw->mac_type == e1000_82545 || | 1476 | if (hw->mac_type == e1000_82545 || |
| 1477 | hw->mac_type == e1000_ce4100 || | 1477 | hw->mac_type == e1000_ce4100 || |
| 1478 | hw->mac_type == e1000_82546) { | 1478 | hw->mac_type == e1000_82546) { |
| 1479 | return ((begin ^ (end - 1)) >> 16) != 0 ? false : true; | 1479 | return ((begin ^ (end - 1)) >> 16) == 0; |
| 1480 | } | 1480 | } |
| 1481 | 1481 | ||
| 1482 | return true; | 1482 | return true; |
| @@ -1611,7 +1611,7 @@ static int i40e_config_rss_aq(struct i40e_vsi *vsi, const u8 *seed, · 1610 unmodified lines | |||
| 1611 | } | 1611 | } |
| 1612 | } | 1612 | } |
| 1613 | if (lut) { | 1613 | if (lut) { |
| 1614 | bool pf_lut = vsi->type == I40E_VSI_MAIN ? true : false; | 1614 | bool pf_lut = vsi->type == I40E_VSI_MAIN; |
| 1615 | 1615 | ||
| 1616 | ret = i40e_aq_set_rss_lut(hw, vsi->id, pf_lut, lut, lut_size); | 1616 | ret = i40e_aq_set_rss_lut(hw, vsi->id, pf_lut, lut, lut_size); |
| 1617 | if (ret) { | 1617 | if (ret) { |
| @@ -11436,7 +11436,7 @@ static int i40e_get_rss_aq(struct i40e_vsi *vsi, const u8 *seed, · 9818 unmodified lines | |||
| 11436 | } | 11436 | } |
| 11437 | 11437 | ||
| 11438 | if (lut) { | 11438 | if (lut) { |
| 11439 | bool pf_lut = vsi->type == I40E_VSI_MAIN ? true : false; | 11439 | bool pf_lut = vsi->type == I40E_VSI_MAIN; |
| 11440 | 11440 | ||
| 11441 | ret = i40e_aq_get_rss_lut(hw, vsi->id, pf_lut, lut, lut_size); | 11441 | ret = i40e_aq_get_rss_lut(hw, vsi->id, pf_lut, lut, lut_size); |
| 11442 | if (ret) { | 11442 | if (ret) { |
| @@ -5383,7 +5383,7 @@ static int __init mvneta_driver_init(void) · 5382 unmodified lines | |||
| 5383 | { | 5383 | { |
| 5384 | int ret; | 5384 | int ret; |
| 5385 | 5385 | ||
| 5386 | ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "net/mvmeta:online", | 5386 | ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "net/mvneta:online", |
| 5387 | mvneta_cpu_online, | 5387 | mvneta_cpu_online, |
| 5388 | mvneta_cpu_down_prepare); | 5388 | mvneta_cpu_down_prepare); |
| 5389 | if (ret < 0) | 5389 | if (ret < 0) |
| @@ -65,6 +65,17 @@ u32 mtk_r32(struct mtk_eth *eth, unsigned reg) · 64 unmodified lines | |||
| 65 | return __raw_readl(eth->base + reg); | 65 | return __raw_readl(eth->base + reg); |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | u32 mtk_m32(struct mtk_eth *eth, u32 mask, u32 set, unsigned reg) | ||
| 69 | { | ||
| 70 | u32 val; | ||
| 71 | |||
| 72 | val = mtk_r32(eth, reg); | ||
| 73 | val &= ~mask; | ||
| 74 | val |= set; | ||
| 75 | mtk_w32(eth, val, reg); | ||
| 76 | return reg; | ||
| 77 | } | ||
| 78 | |||
| 68 | static int mtk_mdio_busy_wait(struct mtk_eth *eth) | 79 | static int mtk_mdio_busy_wait(struct mtk_eth *eth) |
| 69 | { | 80 | { |
| 70 | unsigned long t_start = jiffies; | 81 | unsigned long t_start = jiffies; |
| @@ -193,7 +204,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode, · 122 unmodified lines | |||
| 193 | struct mtk_mac *mac = container_of(config, struct mtk_mac, | 204 | struct mtk_mac *mac = container_of(config, struct mtk_mac, |
| 194 | phylink_config); | 205 | phylink_config); |
| 195 | struct mtk_eth *eth = mac->hw; | 206 | struct mtk_eth *eth = mac->hw; |
| 196 | u32 mcr_cur, mcr_new, sid; | 207 | u32 mcr_cur, mcr_new, sid, i; |
| 197 | int val, ge_mode, err; | 208 | int val, ge_mode, err; |
| 198 | 209 | ||
| 199 | /* MT76x8 has no hardware settings between for the MAC */ | 210 | /* MT76x8 has no hardware settings between for the MAC */ |
| @@ -255,6 +266,17 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode, · 55 unmodified lines | |||
| 255 | PHY_INTERFACE_MODE_TRGMII) | 266 | PHY_INTERFACE_MODE_TRGMII) |
| 256 | mtk_gmac0_rgmii_adjust(mac->hw, | 267 | mtk_gmac0_rgmii_adjust(mac->hw, |
| 257 | state->speed); | 268 | state->speed); |
| 269 | |||
| 270 | /* mt7623_pad_clk_setup */ | ||
| 271 | for (i = 0 ; i < NUM_TRGMII_CTRL; i++) | ||
| 272 | mtk_w32(mac->hw, | ||
| 273 | TD_DM_DRVP(8) | TD_DM_DRVN(8), | ||
| 274 | TRGMII_TD_ODT(i)); | ||
| 275 | |||
| 276 | /* Assert/release MT7623 RXC reset */ | ||
| 277 | mtk_m32(mac->hw, 0, RXC_RST | RXC_DQSISEL, | ||
| 278 | TRGMII_RCK_CTRL); | ||
| 279 | mtk_m32(mac->hw, RXC_RST, 0, TRGMII_RCK_CTRL); | ||
| 258 | } | 280 | } |
| 259 | } | 281 | } |
| 260 | 282 | ||
| @@ -352,10 +352,13 @@ · 351 unmodified lines | |||
| 352 | #define DQSI0(x) ((x << 0) & GENMASK(6, 0)) | 352 | #define DQSI0(x) ((x << 0) & GENMASK(6, 0)) |
| 353 | #define DQSI1(x) ((x << 8) & GENMASK(14, 8)) | 353 | #define DQSI1(x) ((x << 8) & GENMASK(14, 8)) |
| 354 | #define RXCTL_DMWTLAT(x) ((x << 16) & GENMASK(18, 16)) | 354 | #define RXCTL_DMWTLAT(x) ((x << 16) & GENMASK(18, 16)) |
| 355 | #define RXC_RST BIT(31) | ||
| 355 | #define RXC_DQSISEL BIT(30) | 356 | #define RXC_DQSISEL BIT(30) |
| 356 | #define RCK_CTRL_RGMII_1000 (RXC_DQSISEL | RXCTL_DMWTLAT(2) | DQSI1(16)) | 357 | #define RCK_CTRL_RGMII_1000 (RXC_DQSISEL | RXCTL_DMWTLAT(2) | DQSI1(16)) |
| 357 | #define RCK_CTRL_RGMII_10_100 RXCTL_DMWTLAT(2) | 358 | #define RCK_CTRL_RGMII_10_100 RXCTL_DMWTLAT(2) |
| 358 | 359 | ||
| 360 | #define NUM_TRGMII_CTRL 5 | ||
| 361 | |||
| 359 | /* TRGMII RXC control register */ | 362 | /* TRGMII RXC control register */ |
| 360 | #define TRGMII_TCK_CTRL 0x10340 | 363 | #define TRGMII_TCK_CTRL 0x10340 |
| 361 | #define TXCTL_DMWTLAT(x) ((x << 16) & GENMASK(18, 16)) | 364 | #define TXCTL_DMWTLAT(x) ((x << 16) & GENMASK(18, 16)) |
| @@ -363,6 +366,11 @@ · 1 unmodified line | |||
| 363 | #define TCK_CTRL_RGMII_1000 TXCTL_DMWTLAT(2) | 366 | #define TCK_CTRL_RGMII_1000 TXCTL_DMWTLAT(2) |
| 364 | #define TCK_CTRL_RGMII_10_100 (TXC_INV | TXCTL_DMWTLAT(2)) | 367 | #define TCK_CTRL_RGMII_10_100 (TXC_INV | TXCTL_DMWTLAT(2)) |
| 365 | 368 | ||
| 369 | /* TRGMII TX Drive Strength */ | ||
| 370 | #define TRGMII_TD_ODT(i) (0x10354 + 8 * (i)) | ||
| 371 | #define TD_DM_DRVP(x) ((x) & 0xf) | ||
| 372 | #define TD_DM_DRVN(x) (((x) & 0xf) << 4) | ||
| 373 | |||
| 366 | /* TRGMII Interface mode register */ | 374 | /* TRGMII Interface mode register */ |
| 367 | #define INTF_MODE 0x10390 | 375 | #define INTF_MODE 0x10390 |
| 368 | #define TRGMII_INTF_DIS BIT(0) | 376 | #define TRGMII_INTF_DIS BIT(0) |
| @@ -43,6 +43,7 @@ · 42 unmodified lines | |||
| 43 | #include <linux/ip.h> | 43 | #include <linux/ip.h> |
| 44 | #include <linux/ipv6.h> | 44 | #include <linux/ipv6.h> |
| 45 | #include <linux/moduleparam.h> | 45 | #include <linux/moduleparam.h> |
| 46 | #include <linux/indirect_call_wrapper.h> | ||
| 46 | 47 | ||
| 47 | #include "mlx4_en.h" | 48 | #include "mlx4_en.h" |
| 48 | 49 | ||
| @@ -261,6 +262,10 @@ static void mlx4_en_stamp_wqe(struct mlx4_en_priv *priv, · 212 unmodified lines | |||
| 261 | } | 262 | } |
| 262 | } | 263 | } |
| 263 | 264 | ||
| 265 | INDIRECT_CALLABLE_DECLARE(u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv, | ||
| 266 | struct mlx4_en_tx_ring *ring, | ||
| 267 | int index, u64 timestamp, | ||
| 268 | int napi_mode)); | ||
| 264 | 269 | ||
| 265 | u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv, | 270 | u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv, |
| 266 | struct mlx4_en_tx_ring *ring, | 271 | struct mlx4_en_tx_ring *ring, |
| @@ -329,6 +334,11 @@ u32 mlx4_en_free_tx_desc(struct mlx4_en_priv *priv, · 62 unmodified lines | |||
| 329 | return tx_info->nr_txbb; | 334 | return tx_info->nr_txbb; |
| 330 | } | 335 | } |
| 331 | 336 | ||
| 337 | INDIRECT_CALLABLE_DECLARE(u32 mlx4_en_recycle_tx_desc(struct mlx4_en_priv *priv, | ||
| 338 | struct mlx4_en_tx_ring *ring, | ||
| 339 | int index, u64 timestamp, | ||
| 340 | int napi_mode)); | ||
| 341 | |||
| 332 | u32 mlx4_en_recycle_tx_desc(struct mlx4_en_priv *priv, | 342 | u32 mlx4_en_recycle_tx_desc(struct mlx4_en_priv *priv, |
| 333 | struct mlx4_en_tx_ring *ring, | 343 | struct mlx4_en_tx_ring *ring, |
| 334 | int index, u64 timestamp, | 344 | int index, u64 timestamp, |
| @@ -449,7 +459,9 @@ bool mlx4_en_process_tx_cq(struct net_device *dev, · 114 unmodified lines | |||
| 449 | timestamp = mlx4_en_get_cqe_ts(cqe); | 459 | timestamp = mlx4_en_get_cqe_ts(cqe); |
| 450 | 460 | ||
| 451 | /* free next descriptor */ | 461 | /* free next descriptor */ |
| 452 | last_nr_txbb = ring->free_tx_desc( | 462 | last_nr_txbb = INDIRECT_CALL_2(ring->free_tx_desc, |
| 463 | mlx4_en_free_tx_desc, | ||
| 464 | mlx4_en_recycle_tx_desc, | ||
| 453 | priv, ring, ring_index, | 465 | priv, ring, ring_index, |
| 454 | timestamp, napi_budget); | 466 | timestamp, napi_budget); |
| 455 | 467 | ||
| @@ -7,10 +7,10 @@ config MLX5_CORE · 6 unmodified lines | |||
| 7 | tristate "Mellanox 5th generation network adapters (ConnectX series) core driver" | 7 | tristate "Mellanox 5th generation network adapters (ConnectX series) core driver" |
| 8 | depends on PCI | 8 | depends on PCI |
| 9 | select NET_DEVLINK | 9 | select NET_DEVLINK |
| 10 | imply PTP_1588_CLOCK | 10 | depends on VXLAN || !VXLAN |
| 11 | imply VXLAN | 11 | depends on MLXFW || !MLXFW |
| 12 | imply MLXFW | 12 | depends on PTP_1588_CLOCK || !PTP_1588_CLOCK |
| 13 | imply PCI_HYPERV_INTERFACE | 13 | depends on PCI_HYPERV_INTERFACE || !PCI_HYPERV_INTERFACE |
| 14 | default n | 14 | default n |
| 15 | ---help--- | 15 | ---help--- |
| 16 | Core driver for low level functionality of the ConnectX-4 and | 16 | Core driver for low level functionality of the ConnectX-4 and |
| @@ -23,7 +23,10 @@ static int mlx5_devlink_flash_update(struct devlink *devlink, · 22 unmodified lines | |||
| 23 | if (err) | 23 | if (err) |
| 24 | return err; | 24 | return err; |
| 25 | 25 | ||
| 26 | return mlx5_firmware_flash(dev, fw, extack); | 26 | err = mlx5_firmware_flash(dev, fw, extack); |
| 27 | release_firmware(fw); | ||
| 28 | |||
| 29 | return err; | ||
| 27 | } | 30 | } |
| 28 | 31 | ||
| 29 | static u8 mlx5_fw_ver_major(u32 version) | 32 | static u8 mlx5_fw_ver_major(u32 version) |
| @@ -935,7 +935,7 @@ struct mlx5_fw_tracer *mlx5_fw_tracer_create(struct mlx5_core_dev *dev) · 934 unmodified lines | |||
| 935 | return NULL; | 935 | return NULL; |
| 936 | } | 936 | } |
| 937 | 937 | ||
| 938 | tracer = kzalloc(sizeof(*tracer), GFP_KERNEL); | 938 | tracer = kvzalloc(sizeof(*tracer), GFP_KERNEL); |
| 939 | if (!tracer) | 939 | if (!tracer) |
| 940 | return ERR_PTR(-ENOMEM); | 940 | return ERR_PTR(-ENOMEM); |
| 941 | 941 | ||
| @@ -982,7 +982,7 @@ destroy_workqueue: · 40 unmodified lines | |||
| 982 | tracer->dev = NULL; | 982 | tracer->dev = NULL; |
| 983 | destroy_workqueue(tracer->work_queue); | 983 | destroy_workqueue(tracer->work_queue); |
| 984 | free_tracer: | 984 | free_tracer: |
| 985 | kfree(tracer); | 985 | kvfree(tracer); |
| 986 | return ERR_PTR(err); | 986 | return ERR_PTR(err); |
| 987 | } | 987 | } |
| 988 | 988 | ||
| @@ -1061,7 +1061,7 @@ void mlx5_fw_tracer_destroy(struct mlx5_fw_tracer *tracer) · 72 unmodified lines | |||
| 1061 | mlx5_fw_tracer_destroy_log_buf(tracer); | 1061 | mlx5_fw_tracer_destroy_log_buf(tracer); |
| 1062 | flush_workqueue(tracer->work_queue); | 1062 | flush_workqueue(tracer->work_queue); |
| 1063 | destroy_workqueue(tracer->work_queue); | 1063 | destroy_workqueue(tracer->work_queue); |
| 1064 | kfree(tracer); | 1064 | kvfree(tracer); |
| 1065 | } | 1065 | } |
| 1066 | 1066 | ||
| 1067 | static int fw_tracer_event(struct notifier_block *nb, unsigned long action, void *data) | 1067 | static int fw_tracer_event(struct notifier_block *nb, unsigned long action, void *data) |
| @@ -367,6 +367,7 @@ enum { · 366 unmodified lines | |||
| 367 | MLX5E_SQ_STATE_AM, | 367 | MLX5E_SQ_STATE_AM, |
| 368 | MLX5E_SQ_STATE_TLS, | 368 | MLX5E_SQ_STATE_TLS, |
| 369 | MLX5E_SQ_STATE_VLAN_NEED_L2_INLINE, | 369 | MLX5E_SQ_STATE_VLAN_NEED_L2_INLINE, |
| 370 | MLX5E_SQ_STATE_PENDING_XSK_TX, | ||
| 370 | }; | 371 | }; |
| 371 | 372 | ||
| 372 | struct mlx5e_sq_wqe_info { | 373 | struct mlx5e_sq_wqe_info { |
| @@ -960,7 +961,7 @@ void mlx5e_page_release_dynamic(struct mlx5e_rq *rq, · 587 unmodified lines | |||
| 960 | void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); | 961 | void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); |
| 961 | void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); | 962 | void mlx5e_handle_rx_cqe_mpwrq(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe); |
| 962 | bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq); | 963 | bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq); |
| 963 | void mlx5e_poll_ico_cq(struct mlx5e_cq *cq); | 964 | int mlx5e_poll_ico_cq(struct mlx5e_cq *cq); |
| 964 | bool mlx5e_post_rx_mpwqes(struct mlx5e_rq *rq); | 965 | bool mlx5e_post_rx_mpwqes(struct mlx5e_rq *rq); |
| 965 | void mlx5e_dealloc_rx_wqe(struct mlx5e_rq *rq, u16 ix); | 966 | void mlx5e_dealloc_rx_wqe(struct mlx5e_rq *rq, u16 ix); |
| 966 | void mlx5e_dealloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix); | 967 | void mlx5e_dealloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix); |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | |||
| 12 | #include <net/flow_offload.h> | 12 | #include <net/flow_offload.h> |
| 13 | #include <net/netfilter/nf_flow_table.h> | 13 | #include <net/netfilter/nf_flow_table.h> |
| 14 | #include <linux/workqueue.h> | 14 | #include <linux/workqueue.h> |
| 15 | #include <linux/xarray.h> | ||
| 15 | 16 | ||
| 16 | #include "esw/chains.h" | 17 | #include "esw/chains.h" |
| 17 | #include "en/tc_ct.h" | 18 | #include "en/tc_ct.h" |
| @@ -35,7 +36,7 @@ struct mlx5_tc_ct_priv { · 17 unmodified lines | |||
| 35 | struct mlx5_eswitch *esw; | 36 | struct mlx5_eswitch *esw; |
| 36 | const struct net_device *netdev; | 37 | const struct net_device *netdev; |
| 37 | struct idr fte_ids; | 38 | struct idr fte_ids; |
| 38 | struct idr tuple_ids; | 39 | struct xarray tuple_ids; |
| 39 | struct rhashtable zone_ht; | 40 | struct rhashtable zone_ht; |
| 40 | struct mlx5_flow_table *ct; | 41 | struct mlx5_flow_table *ct; |
| 41 | struct mlx5_flow_table *ct_nat; | 42 | struct mlx5_flow_table *ct_nat; |
| @@ -67,11 +68,9 @@ struct mlx5_ct_ft { · 25 unmodified lines | |||
| 67 | struct nf_flowtable *nf_ft; | 68 | struct nf_flowtable *nf_ft; |
| 68 | struct mlx5_tc_ct_priv *ct_priv; | 69 | struct mlx5_tc_ct_priv *ct_priv; |
| 69 | struct rhashtable ct_entries_ht; | 70 | struct rhashtable ct_entries_ht; |
| 70 | struct list_head ct_entries_list; | ||
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | struct mlx5_ct_entry { | 73 | struct mlx5_ct_entry { |
| 74 | struct list_head list; | ||
| 75 | u16 zone; | 74 | u16 zone; |
| 76 | struct rhash_head node; | 75 | struct rhash_head node; |
| 77 | struct flow_rule *flow_rule; | 76 | struct flow_rule *flow_rule; |
| @@ -240,7 +239,7 @@ mlx5_tc_ct_entry_del_rule(struct mlx5_tc_ct_priv *ct_priv, · 162 unmodified lines | |||
| 240 | 239 | ||
| 241 | mlx5_eswitch_del_offloaded_rule(esw, zone_rule->rule, attr); | 240 | mlx5_eswitch_del_offloaded_rule(esw, zone_rule->rule, attr); |
| 242 | mlx5_modify_header_dealloc(esw->dev, attr->modify_hdr); | 241 | mlx5_modify_header_dealloc(esw->dev, attr->modify_hdr); |
| 243 | idr_remove(&ct_priv->tuple_ids, zone_rule->tupleid); | 242 | xa_erase(&ct_priv->tuple_ids, zone_rule->tupleid); |
| 244 | } | 243 | } |
| 245 | 244 | ||
| 246 | static void | 245 | static void |
| @@ -485,7 +484,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv, · 238 unmodified lines | |||
| 485 | struct mlx5_esw_flow_attr *attr = &zone_rule->attr; | 484 | struct mlx5_esw_flow_attr *attr = &zone_rule->attr; |
| 486 | struct mlx5_eswitch *esw = ct_priv->esw; | 485 | struct mlx5_eswitch *esw = ct_priv->esw; |
| 487 | struct mlx5_flow_spec *spec = NULL; | 486 | struct mlx5_flow_spec *spec = NULL; |
| 488 | u32 tupleid = 1; | 487 | u32 tupleid; |
| 489 | int err; | 488 | int err; |
| 490 | 489 | ||
| 491 | zone_rule->nat = nat; | 490 | zone_rule->nat = nat; |
| @@ -495,12 +494,12 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv, · 3 unmodified lines | |||
| 495 | return -ENOMEM; | 494 | return -ENOMEM; |
| 496 | 495 | ||
| 497 | /* Get tuple unique id */ | 496 | /* Get tuple unique id */ |
| 498 | err = idr_alloc_u32(&ct_priv->tuple_ids, zone_rule, &tupleid, | 497 | err = xa_alloc(&ct_priv->tuple_ids, &tupleid, zone_rule, |
| 499 | TUPLE_ID_MAX, GFP_KERNEL); | 498 | XA_LIMIT(1, TUPLE_ID_MAX), GFP_KERNEL); |
| 500 | if (err) { | 499 | if (err) { |
| 501 | netdev_warn(ct_priv->netdev, | 500 | netdev_warn(ct_priv->netdev, |
| 502 | "Failed to allocate tuple id, err: %d\n", err); | 501 | "Failed to allocate tuple id, err: %d\n", err); |
| 503 | goto err_idr_alloc; | 502 | goto err_xa_alloc; |
| 504 | } | 503 | } |
| 505 | zone_rule->tupleid = tupleid; | 504 | zone_rule->tupleid = tupleid; |
| 506 | 505 | ||
| @@ -541,8 +540,8 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv, · 34 unmodified lines | |||
| 541 | err_rule: | 540 | err_rule: |
| 542 | mlx5_modify_header_dealloc(esw->dev, attr->modify_hdr); | 541 | mlx5_modify_header_dealloc(esw->dev, attr->modify_hdr); |
| 543 | err_mod_hdr: | 542 | err_mod_hdr: |
| 544 | idr_remove(&ct_priv->tuple_ids, zone_rule->tupleid); | 543 | xa_erase(&ct_priv->tuple_ids, zone_rule->tupleid); |
| 545 | err_idr_alloc: | 544 | err_xa_alloc: |
| 546 | kfree(spec); | 545 | kfree(spec); |
| 547 | return err; | 546 | return err; |
| 548 | } | 547 | } |
| @@ -617,8 +616,6 @@ mlx5_tc_ct_block_flow_offload_add(struct mlx5_ct_ft *ft, · 68 unmodified lines | |||
| 617 | if (err) | 616 | if (err) |
| 618 | goto err_insert; | 617 | goto err_insert; |
| 619 | 618 | ||
| 620 | list_add(&entry->list, &ft->ct_entries_list); | ||
| 621 | |||
| 622 | return 0; | 619 | return 0; |
| 623 | 620 | ||
| 624 | err_insert: | 621 | err_insert: |
| @@ -646,7 +643,6 @@ mlx5_tc_ct_block_flow_offload_del(struct mlx5_ct_ft *ft, · 21 unmodified lines | |||
| 646 | WARN_ON(rhashtable_remove_fast(&ft->ct_entries_ht, | 643 | WARN_ON(rhashtable_remove_fast(&ft->ct_entries_ht, |
| 647 | &entry->node, | 644 | &entry->node, |
| 648 | cts_ht_params)); | 645 | cts_ht_params)); |
| 649 | list_del(&entry->list); | ||
| 650 | kfree(entry); | 646 | kfree(entry); |
| 651 | 647 | ||
| 652 | return 0; | 648 | return 0; |
| @@ -818,7 +814,6 @@ mlx5_tc_ct_add_ft_cb(struct mlx5_tc_ct_priv *ct_priv, u16 zone, · 165 unmodified lines | |||
| 818 | ft->zone = zone; | 814 | ft->zone = zone; |
| 819 | ft->nf_ft = nf_ft; | 815 | ft->nf_ft = nf_ft; |
| 820 | ft->ct_priv = ct_priv; | 816 | ft->ct_priv = ct_priv; |
| 821 | INIT_LIST_HEAD(&ft->ct_entries_list); | ||
| 822 | refcount_set(&ft->refcount, 1); | 817 | refcount_set(&ft->refcount, 1); |
| 823 | 818 | ||
| 824 | err = rhashtable_init(&ft->ct_entries_ht, &cts_ht_params); | 819 | err = rhashtable_init(&ft->ct_entries_ht, &cts_ht_params); |
| @@ -847,12 +842,12 @@ err_init: · 22 unmodified lines | |||
| 847 | } | 842 | } |
| 848 | 843 | ||
| 849 | static void | 844 | static void |
| 850 | mlx5_tc_ct_flush_ft(struct mlx5_tc_ct_priv *ct_priv, struct mlx5_ct_ft *ft) | 845 | mlx5_tc_ct_flush_ft_entry(void *ptr, void *arg) |
| 851 | { | 846 | { |
| 852 | struct mlx5_ct_entry *entry; | 847 | struct mlx5_tc_ct_priv *ct_priv = arg; |
| 848 | struct mlx5_ct_entry *entry = ptr; | ||
| 853 | 849 | ||
| 854 | list_for_each_entry(entry, &ft->ct_entries_list, list) | 850 | mlx5_tc_ct_entry_del_rules(ct_priv, entry); |
| 855 | mlx5_tc_ct_entry_del_rules(ft->ct_priv, entry); | ||
| 856 | } | 851 | } |
| 857 | 852 | ||
| 858 | static void | 853 | static void |
| @@ -863,9 +858,10 @@ mlx5_tc_ct_del_ft_cb(struct mlx5_tc_ct_priv *ct_priv, struct mlx5_ct_ft *ft) · 4 unmodified lines | |||
| 863 | 858 | ||
| 864 | nf_flow_table_offload_del_cb(ft->nf_ft, | 859 | nf_flow_table_offload_del_cb(ft->nf_ft, |
| 865 | mlx5_tc_ct_block_flow_offload, ft); | 860 | mlx5_tc_ct_block_flow_offload, ft); |
| 866 | mlx5_tc_ct_flush_ft(ct_priv, ft); | ||
| 867 | rhashtable_remove_fast(&ct_priv->zone_ht, &ft->node, zone_params); | 861 | rhashtable_remove_fast(&ct_priv->zone_ht, &ft->node, zone_params); |
| 868 | rhashtable_destroy(&ft->ct_entries_ht); | 862 | rhashtable_free_and_destroy(&ft->ct_entries_ht, |
| 863 | mlx5_tc_ct_flush_ft_entry, | ||
| 864 | ct_priv); | ||
| 869 | kfree(ft); | 865 | kfree(ft); |
| 870 | } | 866 | } |
| 871 | 867 | ||
| @@ -1304,7 +1300,7 @@ mlx5_tc_ct_init(struct mlx5_rep_uplink_priv *uplink_priv) · 432 unmodified lines | |||
| 1304 | } | 1300 | } |
| 1305 | 1301 | ||
| 1306 | idr_init(&ct_priv->fte_ids); | 1302 | idr_init(&ct_priv->fte_ids); |
| 1307 | idr_init(&ct_priv->tuple_ids); | 1303 | xa_init_flags(&ct_priv->tuple_ids, XA_FLAGS_ALLOC1); |
| 1308 | mutex_init(&ct_priv->control_lock); | 1304 | mutex_init(&ct_priv->control_lock); |
| 1309 | rhashtable_init(&ct_priv->zone_ht, &zone_params); | 1305 | rhashtable_init(&ct_priv->zone_ht, &zone_params); |
| 1310 | 1306 | ||
| @@ -1339,7 +1335,7 @@ mlx5_tc_ct_clean(struct mlx5_rep_uplink_priv *uplink_priv) · 28 unmodified lines | |||
| 1339 | 1335 | ||
| 1340 | rhashtable_destroy(&ct_priv->zone_ht); | 1336 | rhashtable_destroy(&ct_priv->zone_ht); |
| 1341 | mutex_destroy(&ct_priv->control_lock); | 1337 | mutex_destroy(&ct_priv->control_lock); |
| 1342 | idr_destroy(&ct_priv->tuple_ids); | 1338 | xa_destroy(&ct_priv->tuple_ids); |
| 1343 | idr_destroy(&ct_priv->fte_ids); | 1339 | idr_destroy(&ct_priv->fte_ids); |
| 1344 | kfree(ct_priv); | 1340 | kfree(ct_priv); |
| 1345 | 1341 | ||
| @@ -1357,7 +1353,7 @@ mlx5e_tc_ct_restore_flow(struct mlx5_rep_uplink_priv *uplink_priv, · 11 unmodified lines | |||
| 1357 | if (!ct_priv || !tupleid) | 1353 | if (!ct_priv || !tupleid) |
| 1358 | return true; | 1354 | return true; |
| 1359 | 1355 | ||
| 1360 | zone_rule = idr_find(&ct_priv->tuple_ids, tupleid); | 1356 | zone_rule = xa_load(&ct_priv->tuple_ids, tupleid); |
| 1361 | if (!zone_rule) | 1357 | if (!zone_rule) |
| 1362 | return false; | 1358 | return false; |
| 1363 | 1359 | ||
| @@ -33,6 +33,9 @@ int mlx5e_xsk_wakeup(struct net_device *dev, u32 qid, u32 flags) · 32 unmodified lines | |||
| 33 | if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &c->xskicosq.state))) | 33 | if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &c->xskicosq.state))) |
| 34 | return 0; | 34 | return 0; |
| 35 | 35 | ||
| 36 | if (test_and_set_bit(MLX5E_SQ_STATE_PENDING_XSK_TX, &c->xskicosq.state)) | ||
| 37 | return 0; | ||
| 38 | |||
| 36 | spin_lock(&c->xskicosq_lock); | 39 | spin_lock(&c->xskicosq_lock); |
| 37 | mlx5e_trigger_irq(&c->xskicosq); | 40 | mlx5e_trigger_irq(&c->xskicosq); |
| 38 | spin_unlock(&c->xskicosq_lock); | 41 | spin_unlock(&c->xskicosq_lock); |
| @@ -3583,7 +3583,12 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats) · 3582 unmodified lines | |||
| 3583 | struct mlx5e_vport_stats *vstats = &priv->stats.vport; | 3583 | struct mlx5e_vport_stats *vstats = &priv->stats.vport; |
| 3584 | struct mlx5e_pport_stats *pstats = &priv->stats.pport; | 3584 | struct mlx5e_pport_stats *pstats = &priv->stats.pport; |
| 3585 | 3585 | ||
| 3586 | if (!mlx5e_monitor_counter_supported(priv)) { | 3586 | /* In switchdev mode, monitor counters doesn't monitor |
| 3587 | * rx/tx stats of 802_3. The update stats mechanism | ||
| 3588 | * should keep the 802_3 layout counters updated | ||
| 3589 | */ | ||
| 3590 | if (!mlx5e_monitor_counter_supported(priv) || | ||
| 3591 | mlx5e_is_uplink_rep(priv)) { | ||
| 3587 | /* update HW stats in background for next time */ | 3592 | /* update HW stats in background for next time */ |
| 3588 | mlx5e_queue_update_stats(priv); | 3593 | mlx5e_queue_update_stats(priv); |
| 3589 | } | 3594 | } |
| @@ -5526,8 +5531,8 @@ static void mlx5e_remove(struct mlx5_core_dev *mdev, void *vpriv) · 1936 unmodified lines | |||
| 5526 | #ifdef CONFIG_MLX5_CORE_EN_DCB | 5531 | #ifdef CONFIG_MLX5_CORE_EN_DCB |
| 5527 | mlx5e_dcbnl_delete_app(priv); | 5532 | mlx5e_dcbnl_delete_app(priv); |
| 5528 | #endif | 5533 | #endif |
| 5529 | mlx5e_devlink_port_unregister(priv); | ||
| 5530 | unregister_netdev(priv->netdev); | 5534 | unregister_netdev(priv->netdev); |
| 5535 | mlx5e_devlink_port_unregister(priv); | ||
| 5531 | mlx5e_detach(mdev, vpriv); | 5536 | mlx5e_detach(mdev, vpriv); |
| 5532 | mlx5e_destroy_netdev(priv); | 5537 | mlx5e_destroy_netdev(priv); |
| 5533 | } | 5538 | } |
| @@ -2050,29 +2050,30 @@ static int register_devlink_port(struct mlx5_core_dev *dev, · 2049 unmodified lines | |||
| 2050 | struct mlx5_eswitch_rep *rep = rpriv->rep; | 2050 | struct mlx5_eswitch_rep *rep = rpriv->rep; |
| 2051 | struct netdev_phys_item_id ppid = {}; | 2051 | struct netdev_phys_item_id ppid = {}; |
| 2052 | unsigned int dl_port_index = 0; | 2052 | unsigned int dl_port_index = 0; |
| 2053 | u16 pfnum; | ||
| 2053 | 2054 | ||
| 2054 | if (!is_devlink_port_supported(dev, rpriv)) | 2055 | if (!is_devlink_port_supported(dev, rpriv)) |
| 2055 | return 0; | 2056 | return 0; |
| 2056 | 2057 | ||
| 2057 | mlx5e_rep_get_port_parent_id(rpriv->netdev, &ppid); | 2058 | mlx5e_rep_get_port_parent_id(rpriv->netdev, &ppid); |
| 2059 | pfnum = PCI_FUNC(dev->pdev->devfn); | ||
| 2058 | 2060 | ||
| 2059 | if (rep->vport == MLX5_VPORT_UPLINK) { | 2061 | if (rep->vport == MLX5_VPORT_UPLINK) { |
| 2060 | devlink_port_attrs_set(&rpriv->dl_port, | 2062 | devlink_port_attrs_set(&rpriv->dl_port, |
| 2061 | DEVLINK_PORT_FLAVOUR_PHYSICAL, | 2063 | DEVLINK_PORT_FLAVOUR_PHYSICAL, |
| 2062 | PCI_FUNC(dev->pdev->devfn), false, 0, | 2064 | pfnum, false, 0, |
| 2063 | &ppid.id[0], ppid.id_len); | 2065 | &ppid.id[0], ppid.id_len); |
| 2064 | dl_port_index = vport_to_devlink_port_index(dev, rep->vport); | 2066 | dl_port_index = vport_to_devlink_port_index(dev, rep->vport); |
| 2065 | } else if (rep->vport == MLX5_VPORT_PF) { | 2067 | } else if (rep->vport == MLX5_VPORT_PF) { |
| 2066 | devlink_port_attrs_pci_pf_set(&rpriv->dl_port, | 2068 | devlink_port_attrs_pci_pf_set(&rpriv->dl_port, |
| 2067 | &ppid.id[0], ppid.id_len, | 2069 | &ppid.id[0], ppid.id_len, |
| 2068 | dev->pdev->devfn); | 2070 | pfnum); |
| 2069 | dl_port_index = rep->vport; | 2071 | dl_port_index = rep->vport; |
| 2070 | } else if (mlx5_eswitch_is_vf_vport(dev->priv.eswitch, | 2072 | } else if (mlx5_eswitch_is_vf_vport(dev->priv.eswitch, |
| 2071 | rpriv->rep->vport)) { | 2073 | rpriv->rep->vport)) { |
| 2072 | devlink_port_attrs_pci_vf_set(&rpriv->dl_port, | 2074 | devlink_port_attrs_pci_vf_set(&rpriv->dl_port, |
| 2073 | &ppid.id[0], ppid.id_len, | 2075 | &ppid.id[0], ppid.id_len, |
| 2074 | dev->pdev->devfn, | 2076 | pfnum, rep->vport - 1); |
| 2075 | rep->vport - 1); | ||
| 2076 | dl_port_index = vport_to_devlink_port_index(dev, rep->vport); | 2077 | dl_port_index = vport_to_devlink_port_index(dev, rep->vport); |
| 2077 | } | 2078 | } |
| 2078 | 2079 | ||
| @@ -589,7 +589,7 @@ bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq) · 588 unmodified lines | |||
| 589 | return !!err; | 589 | return !!err; |
| 590 | } | 590 | } |
| 591 | 591 | ||
| 592 | void mlx5e_poll_ico_cq(struct mlx5e_cq *cq) | 592 | int mlx5e_poll_ico_cq(struct mlx5e_cq *cq) |
| 593 | { | 593 | { |
| 594 | struct mlx5e_icosq *sq = container_of(cq, struct mlx5e_icosq, cq); | 594 | struct mlx5e_icosq *sq = container_of(cq, struct mlx5e_icosq, cq); |
| 595 | struct mlx5_cqe64 *cqe; | 595 | struct mlx5_cqe64 *cqe; |
| @@ -597,11 +597,11 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq) · 1 unmodified line | |||
| 597 | int i; | 597 | int i; |
| 598 | 598 | ||
| 599 | if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &sq->state))) | 599 | if (unlikely(!test_bit(MLX5E_SQ_STATE_ENABLED, &sq->state))) |
| 600 | return; | 600 | return 0; |
| 601 | 601 | ||
| 602 | cqe = mlx5_cqwq_get_cqe(&cq->wq); | 602 | cqe = mlx5_cqwq_get_cqe(&cq->wq); |
| 603 | if (likely(!cqe)) | 603 | if (likely(!cqe)) |
| 604 | return; | 604 | return 0; |
| 605 | 605 | ||
| 606 | /* sq->cc must be updated only after mlx5_cqwq_update_db_record(), | 606 | /* sq->cc must be updated only after mlx5_cqwq_update_db_record(), |
| 607 | * otherwise a cq overrun may occur | 607 | * otherwise a cq overrun may occur |
| @@ -650,6 +650,8 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq) · 42 unmodified lines | |||
| 650 | sq->cc = sqcc; | 650 | sq->cc = sqcc; |
| 651 | 651 | ||
| 652 | mlx5_cqwq_update_db_record(&cq->wq); | 652 | mlx5_cqwq_update_db_record(&cq->wq); |
| 653 | |||
| 654 | return i; | ||
| 653 | } | 655 | } |
| 654 | 656 | ||
| 655 | bool mlx5e_post_rx_mpwqes(struct mlx5e_rq *rq) | 657 | bool mlx5e_post_rx_mpwqes(struct mlx5e_rq *rq) |
| @@ -1343,7 +1343,8 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, · 1342 unmodified lines | |||
| 1343 | if (err) | 1343 | if (err) |
| 1344 | return err; | 1344 | return err; |
| 1345 | 1345 | ||
| 1346 | if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) { | 1346 | if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR && |
| 1347 | !(attr->ct_attr.ct_action & TCA_CT_ACT_CLEAR)) { | ||
| 1347 | err = mlx5e_attach_mod_hdr(priv, flow, parse_attr); | 1348 | err = mlx5e_attach_mod_hdr(priv, flow, parse_attr); |
| 1348 | dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts); | 1349 | dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts); |
| 1349 | if (err) | 1350 | if (err) |
| @@ -3558,12 +3559,13 @@ static int add_vlan_pop_action(struct mlx5e_priv *priv, · 2208 unmodified lines | |||
| 3558 | struct mlx5_esw_flow_attr *attr, | 3559 | struct mlx5_esw_flow_attr *attr, |
| 3559 | u32 *action) | 3560 | u32 *action) |
| 3560 | { | 3561 | { |
| 3561 | int nest_level = attr->parse_attr->filter_dev->lower_level; | ||
| 3562 | struct flow_action_entry vlan_act = { | 3562 | struct flow_action_entry vlan_act = { |
| 3563 | .id = FLOW_ACTION_VLAN_POP, | 3563 | .id = FLOW_ACTION_VLAN_POP, |
| 3564 | }; | 3564 | }; |
| 3565 | int err = 0; | 3565 | int nest_level, err = 0; |
| 3566 | 3566 | ||
| 3567 | nest_level = attr->parse_attr->filter_dev->lower_level - | ||
| 3568 | priv->netdev->lower_level; | ||
| 3567 | while (nest_level--) { | 3569 | while (nest_level--) { |
| 3568 | err = parse_tc_vlan_action(priv, &vlan_act, attr, action); | 3570 | err = parse_tc_vlan_action(priv, &vlan_act, attr, action); |
| 3569 | if (err) | 3571 | if (err) |
| @@ -152,7 +152,11 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget) · 151 unmodified lines | |||
| 152 | mlx5e_post_rx_wqes, | 152 | mlx5e_post_rx_wqes, |
| 153 | rq); | 153 | rq); |
| 154 | if (xsk_open) { | 154 | if (xsk_open) { |
| 155 | mlx5e_poll_ico_cq(&c->xskicosq.cq); | 155 | if (mlx5e_poll_ico_cq(&c->xskicosq.cq)) |
| 156 | /* Don't clear the flag if nothing was polled to prevent | ||
| 157 | * queueing more WQEs and overflowing XSKICOSQ. | ||
| 158 | */ | ||
| 159 | clear_bit(MLX5E_SQ_STATE_PENDING_XSK_TX, &c->xskicosq.state); | ||
| 156 | busy |= mlx5e_poll_xdpsq_cq(&xsksq->cq); | 160 | busy |= mlx5e_poll_xdpsq_cq(&xsksq->cq); |
| 157 | busy_xsk |= mlx5e_napi_xsk_post(xsksq, xskrq); | 161 | busy_xsk |= mlx5e_napi_xsk_post(xsksq, xskrq); |
| 158 | } | 162 | } |
| @@ -403,7 +403,6 @@ enum { · 402 unmodified lines | |||
| 403 | MLX5_ESW_ATTR_FLAG_VLAN_HANDLED = BIT(0), | 403 | MLX5_ESW_ATTR_FLAG_VLAN_HANDLED = BIT(0), |
| 404 | MLX5_ESW_ATTR_FLAG_SLOW_PATH = BIT(1), | 404 | MLX5_ESW_ATTR_FLAG_SLOW_PATH = BIT(1), |
| 405 | MLX5_ESW_ATTR_FLAG_NO_IN_PORT = BIT(2), | 405 | MLX5_ESW_ATTR_FLAG_NO_IN_PORT = BIT(2), |
| 406 | MLX5_ESW_ATTR_FLAG_HAIRPIN = BIT(3), | ||
| 407 | }; | 406 | }; |
| 408 | 407 | ||
| 409 | struct mlx5_esw_flow_attr { | 408 | struct mlx5_esw_flow_attr { |
| @@ -300,7 +300,6 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw, · 299 unmodified lines | |||
| 300 | bool split = !!(attr->split_count); | 300 | bool split = !!(attr->split_count); |
| 301 | struct mlx5_flow_handle *rule; | 301 | struct mlx5_flow_handle *rule; |
| 302 | struct mlx5_flow_table *fdb; | 302 | struct mlx5_flow_table *fdb; |
| 303 | bool hairpin = false; | ||
| 304 | int j, i = 0; | 303 | int j, i = 0; |
| 305 | 304 | ||
| 306 | if (esw->mode != MLX5_ESWITCH_OFFLOADS) | 305 | if (esw->mode != MLX5_ESWITCH_OFFLOADS) |
| @@ -398,21 +397,16 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw, · 91 unmodified lines | |||
| 398 | goto err_esw_get; | 397 | goto err_esw_get; |
| 399 | } | 398 | } |
| 400 | 399 | ||
| 401 | if (mlx5_eswitch_termtbl_required(esw, attr, &flow_act, spec)) { | 400 | if (mlx5_eswitch_termtbl_required(esw, attr, &flow_act, spec)) |
| 402 | rule = mlx5_eswitch_add_termtbl_rule(esw, fdb, spec, attr, | 401 | rule = mlx5_eswitch_add_termtbl_rule(esw, fdb, spec, attr, |
| 403 | &flow_act, dest, i); | 402 | &flow_act, dest, i); |
| 404 | hairpin = true; | 403 | else |
| 405 | } else { | ||
| 406 | rule = mlx5_add_flow_rules(fdb, spec, &flow_act, dest, i); | 404 | rule = mlx5_add_flow_rules(fdb, spec, &flow_act, dest, i); |
| 407 | } | ||
| 408 | if (IS_ERR(rule)) | 405 | if (IS_ERR(rule)) |
| 409 | goto err_add_rule; | 406 | goto err_add_rule; |
| 410 | else | 407 | else |
| 411 | atomic64_inc(&esw->offloads.num_flows); | 408 | atomic64_inc(&esw->offloads.num_flows); |
| 412 | 409 | ||
| 413 | if (hairpin) | ||
| 414 | attr->flags |= MLX5_ESW_ATTR_FLAG_HAIRPIN; | ||
| 415 | |||
| 416 | return rule; | 410 | return rule; |
| 417 | 411 | ||
| 418 | err_add_rule: | 412 | err_add_rule: |
| @@ -501,7 +495,7 @@ __mlx5_eswitch_del_rule(struct mlx5_eswitch *esw, · 82 unmodified lines | |||
| 501 | 495 | ||
| 502 | mlx5_del_flow_rules(rule); | 496 | mlx5_del_flow_rules(rule); |
| 503 | 497 | ||
| 504 | if (attr->flags & MLX5_ESW_ATTR_FLAG_HAIRPIN) { | 498 | if (!(attr->flags & MLX5_ESW_ATTR_FLAG_SLOW_PATH)) { |
| 505 | /* unref the term table */ | 499 | /* unref the term table */ |
| 506 | for (i = 0; i < MLX5_MAX_FLOW_FWD_VPORTS; i++) { | 500 | for (i = 0; i < MLX5_MAX_FLOW_FWD_VPORTS; i++) { |
| 507 | if (attr->dests[i].termtbl) | 501 | if (attr->dests[i].termtbl) |
| @@ -243,7 +243,7 @@ recover_from_sw_reset: · 242 unmodified lines | |||
| 243 | if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED) | 243 | if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED) |
| 244 | break; | 244 | break; |
| 245 | 245 | ||
| 246 | cond_resched(); | 246 | msleep(20); |
| 247 | } while (!time_after(jiffies, end)); | 247 | } while (!time_after(jiffies, end)); |
| 248 | 248 | ||
| 249 | if (mlx5_get_nic_state(dev) != MLX5_NIC_IFC_DISABLED) { | 249 | if (mlx5_get_nic_state(dev) != MLX5_NIC_IFC_DISABLED) { |
| @@ -380,7 +380,7 @@ struct mlxsw_afa_block *mlxsw_afa_block_create(struct mlxsw_afa *mlxsw_afa) · 379 unmodified lines | |||
| 380 | 380 | ||
| 381 | block = kzalloc(sizeof(*block), GFP_KERNEL); | 381 | block = kzalloc(sizeof(*block), GFP_KERNEL); |
| 382 | if (!block) | 382 | if (!block) |
| 383 | return NULL; | 383 | return ERR_PTR(-ENOMEM); |
| 384 | INIT_LIST_HEAD(&block->resource_list); | 384 | INIT_LIST_HEAD(&block->resource_list); |
| 385 | block->afa = mlxsw_afa; | 385 | block->afa = mlxsw_afa; |
| 386 | 386 | ||
| @@ -408,7 +408,7 @@ err_second_set_create: · 21 unmodified lines | |||
| 408 | mlxsw_afa_set_destroy(block->first_set); | 408 | mlxsw_afa_set_destroy(block->first_set); |
| 409 | err_first_set_create: | 409 | err_first_set_create: |
| 410 | kfree(block); | 410 | kfree(block); |
| 411 | return NULL; | 411 | return ERR_PTR(-ENOMEM); |
| 412 | } | 412 | } |
| 413 | EXPORT_SYMBOL(mlxsw_afa_block_create); | 413 | EXPORT_SYMBOL(mlxsw_afa_block_create); |
| 414 | 414 | ||
| @@ -88,8 +88,8 @@ static int mlxsw_sp2_acl_tcam_init(struct mlxsw_sp *mlxsw_sp, void *priv, · 87 unmodified lines | |||
| 88 | * to be written using PEFA register to all indexes for all regions. | 88 | * to be written using PEFA register to all indexes for all regions. |
| 89 | */ | 89 | */ |
| 90 | afa_block = mlxsw_afa_block_create(mlxsw_sp->afa); | 90 | afa_block = mlxsw_afa_block_create(mlxsw_sp->afa); |
| 91 | if (!afa_block) { | 91 | if (IS_ERR(afa_block)) { |
| 92 | err = -ENOMEM; | 92 | err = PTR_ERR(afa_block); |
| 93 | goto err_afa_block; | 93 | goto err_afa_block; |
| 94 | } | 94 | } |
| 95 | err = mlxsw_afa_block_continue(afa_block); | 95 | err = mlxsw_afa_block_continue(afa_block); |
| @@ -464,7 +464,7 @@ mlxsw_sp_acl_rulei_create(struct mlxsw_sp_acl *acl, · 463 unmodified lines | |||
| 464 | 464 | ||
| 465 | rulei = kzalloc(sizeof(*rulei), GFP_KERNEL); | 465 | rulei = kzalloc(sizeof(*rulei), GFP_KERNEL); |
| 466 | if (!rulei) | 466 | if (!rulei) |
| 467 | return NULL; | 467 | return ERR_PTR(-ENOMEM); |
| 468 | 468 | ||
| 469 | if (afa_block) { | 469 | if (afa_block) { |
| 470 | rulei->act_block = afa_block; | 470 | rulei->act_block = afa_block; |
| @@ -199,8 +199,8 @@ mlxsw_sp_mr_tcam_afa_block_create(struct mlxsw_sp *mlxsw_sp, · 198 unmodified lines | |||
| 199 | int err; | 199 | int err; |
| 200 | 200 | ||
| 201 | afa_block = mlxsw_afa_block_create(mlxsw_sp->afa); | 201 | afa_block = mlxsw_afa_block_create(mlxsw_sp->afa); |
| 202 | if (!afa_block) | 202 | if (IS_ERR(afa_block)) |
| 203 | return ERR_PTR(-ENOMEM); | 203 | return afa_block; |
| 204 | 204 | ||
| 205 | err = mlxsw_afa_block_append_allocated_counter(afa_block, | 205 | err = mlxsw_afa_block_append_allocated_counter(afa_block, |
| 206 | counter_index); | 206 | counter_index); |
| @@ -183,44 +183,47 @@ static void ocelot_vlan_mode(struct ocelot *ocelot, int port, · 182 unmodified lines | |||
| 183 | ocelot_write(ocelot, val, ANA_VLANMASK); | 183 | ocelot_write(ocelot, val, ANA_VLANMASK); |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, | 186 | static int ocelot_port_set_native_vlan(struct ocelot *ocelot, int port, |
| 187 | bool vlan_aware) | 187 | u16 vid) |
| 188 | { | 188 | { |
| 189 | struct ocelot_port *ocelot_port = ocelot->ports[port]; | 189 | struct ocelot_port *ocelot_port = ocelot->ports[port]; |
| 190 | u32 val; | 190 | u32 val = 0; |
| 191 | 191 | ||
| 192 | if (vlan_aware) | 192 | if (ocelot_port->vid != vid) { |
| 193 | val = ANA_PORT_VLAN_CFG_VLAN_AWARE_ENA | | 193 | /* Always permit deleting the native VLAN (vid = 0) */ |
| 194 | ANA_PORT_VLAN_CFG_VLAN_POP_CNT(1); | 194 | if (ocelot_port->vid && vid) { |
| 195 | else | 195 | dev_err(ocelot->dev, |
| 196 | val = 0; | 196 | "Port already has a native VLAN: %d\n", |
| 197 | ocelot_rmw_gix(ocelot, val, | 197 | ocelot_port->vid); |
| 198 | ANA_PORT_VLAN_CFG_VLAN_AWARE_ENA | | 198 | return -EBUSY; |
| 199 | ANA_PORT_VLAN_CFG_VLAN_POP_CNT_M, | 199 | } |
| 200 | ANA_PORT_VLAN_CFG, port); | 200 | ocelot_port->vid = vid; |
| 201 | } | ||
| 202 | |||
| 203 | ocelot_rmw_gix(ocelot, REW_PORT_VLAN_CFG_PORT_VID(vid), | ||
| 204 | REW_PORT_VLAN_CFG_PORT_VID_M, | ||
| 205 | REW_PORT_VLAN_CFG, port); | ||
| 201 | 206 | ||
| 202 | if (vlan_aware && !ocelot_port->vid) | 207 | if (ocelot_port->vlan_aware && !ocelot_port->vid) |
| 203 | /* If port is vlan-aware and tagged, drop untagged and priority | 208 | /* If port is vlan-aware and tagged, drop untagged and priority |
| 204 | * tagged frames. | 209 | * tagged frames. |
| 205 | */ | 210 | */ |
| 206 | val = ANA_PORT_DROP_CFG_DROP_UNTAGGED_ENA | | 211 | val = ANA_PORT_DROP_CFG_DROP_UNTAGGED_ENA | |
| 207 | ANA_PORT_DROP_CFG_DROP_PRIO_S_TAGGED_ENA | | 212 | ANA_PORT_DROP_CFG_DROP_PRIO_S_TAGGED_ENA | |
| 208 | ANA_PORT_DROP_CFG_DROP_PRIO_C_TAGGED_ENA; | 213 | ANA_PORT_DROP_CFG_DROP_PRIO_C_TAGGED_ENA; |
| 209 | else | ||
| 210 | val = 0; | ||
| 211 | ocelot_rmw_gix(ocelot, val, | 214 | ocelot_rmw_gix(ocelot, val, |
| 212 | ANA_PORT_DROP_CFG_DROP_UNTAGGED_ENA | | 215 | ANA_PORT_DROP_CFG_DROP_UNTAGGED_ENA | |
| 213 | ANA_PORT_DROP_CFG_DROP_PRIO_S_TAGGED_ENA | | 216 | ANA_PORT_DROP_CFG_DROP_PRIO_S_TAGGED_ENA | |
| 214 | ANA_PORT_DROP_CFG_DROP_PRIO_C_TAGGED_ENA, | 217 | ANA_PORT_DROP_CFG_DROP_PRIO_C_TAGGED_ENA, |
| 215 | ANA_PORT_DROP_CFG, port); | 218 | ANA_PORT_DROP_CFG, port); |
| 216 | 219 | ||
| 217 | if (vlan_aware) { | 220 | if (ocelot_port->vlan_aware) { |
| 218 | if (ocelot_port->vid) | 221 | if (ocelot_port->vid) |
| 219 | /* Tag all frames except when VID == DEFAULT_VLAN */ | 222 | /* Tag all frames except when VID == DEFAULT_VLAN */ |
| 220 | val |= REW_TAG_CFG_TAG_CFG(1); | 223 | val = REW_TAG_CFG_TAG_CFG(1); |
| 221 | else | 224 | else |
| 222 | /* Tag all frames */ | 225 | /* Tag all frames */ |
| 223 | val |= REW_TAG_CFG_TAG_CFG(3); | 226 | val = REW_TAG_CFG_TAG_CFG(3); |
| 224 | } else { | 227 | } else { |
| 225 | /* Port tagging disabled. */ | 228 | /* Port tagging disabled. */ |
| 226 | val = REW_TAG_CFG_TAG_CFG(0); | 229 | val = REW_TAG_CFG_TAG_CFG(0); |
| @@ -228,31 +231,31 @@ void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, · 1 unmodified line | |||
| 228 | ocelot_rmw_gix(ocelot, val, | 231 | ocelot_rmw_gix(ocelot, val, |
| 229 | REW_TAG_CFG_TAG_CFG_M, | 232 | REW_TAG_CFG_TAG_CFG_M, |
| 230 | REW_TAG_CFG, port); | 233 | REW_TAG_CFG, port); |
| 234 | |||
| 235 | return 0; | ||
| 231 | } | 236 | } |
| 232 | EXPORT_SYMBOL(ocelot_port_vlan_filtering); | ||
| 233 | 237 | ||
| 234 | static int ocelot_port_set_native_vlan(struct ocelot *ocelot, int port, | 238 | void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, |
| 235 | u16 vid) | 239 | bool vlan_aware) |
| 236 | { | 240 | { |
| 237 | struct ocelot_port *ocelot_port = ocelot->ports[port]; | 241 | struct ocelot_port *ocelot_port = ocelot->ports[port]; |
| 242 | u32 val; | ||
| 238 | 243 | ||
| 239 | if (ocelot_port->vid != vid) { | 244 | ocelot_port->vlan_aware = vlan_aware; |
| 240 | /* Always permit deleting the native VLAN (vid = 0) */ | ||
| 241 | if (ocelot_port->vid && vid) { | ||
| 242 | dev_err(ocelot->dev, | ||
| 243 | "Port already has a native VLAN: %d\n", | ||
| 244 | ocelot_port->vid); | ||
| 245 | return -EBUSY; | ||
| 246 | } | ||
| 247 | ocelot_port->vid = vid; | ||
| 248 | } | ||
| 249 | 245 | ||
| 250 | ocelot_rmw_gix(ocelot, REW_PORT_VLAN_CFG_PORT_VID(vid), | 246 | if (vlan_aware) |
| 251 | REW_PORT_VLAN_CFG_PORT_VID_M, | 247 | val = ANA_PORT_VLAN_CFG_VLAN_AWARE_ENA | |
| 252 | REW_PORT_VLAN_CFG, port); | 248 | ANA_PORT_VLAN_CFG_VLAN_POP_CNT(1); |
| 249 | else | ||
| 250 | val = 0; | ||
| 251 | ocelot_rmw_gix(ocelot, val, | ||
| 252 | ANA_PORT_VLAN_CFG_VLAN_AWARE_ENA | | ||
| 253 | ANA_PORT_VLAN_CFG_VLAN_POP_CNT_M, | ||
| 254 | ANA_PORT_VLAN_CFG, port); | ||
| 253 | 255 | ||
| 254 | return 0; | 256 | ocelot_port_set_native_vlan(ocelot, port, ocelot_port->vid); |
| 255 | } | 257 | } |
| 258 | EXPORT_SYMBOL(ocelot_port_vlan_filtering); | ||
| 256 | 259 | ||
| 257 | /* Default vlan to clasify for untagged frames (may be zero) */ | 260 | /* Default vlan to clasify for untagged frames (may be zero) */ |
| 258 | static void ocelot_port_set_pvid(struct ocelot *ocelot, int port, u16 pvid) | 261 | static void ocelot_port_set_pvid(struct ocelot *ocelot, int port, u16 pvid) |
| @@ -873,12 +876,12 @@ static void ocelot_get_stats64(struct net_device *dev, · 614 unmodified lines | |||
| 873 | } | 876 | } |
| 874 | 877 | ||
| 875 | int ocelot_fdb_add(struct ocelot *ocelot, int port, | 878 | int ocelot_fdb_add(struct ocelot *ocelot, int port, |
| 876 | const unsigned char *addr, u16 vid, bool vlan_aware) | 879 | const unsigned char *addr, u16 vid) |
| 877 | { | 880 | { |
| 878 | struct ocelot_port *ocelot_port = ocelot->ports[port]; | 881 | struct ocelot_port *ocelot_port = ocelot->ports[port]; |
| 879 | 882 | ||
| 880 | if (!vid) { | 883 | if (!vid) { |
| 881 | if (!vlan_aware) | 884 | if (!ocelot_port->vlan_aware) |
| 882 | /* If the bridge is not VLAN aware and no VID was | 885 | /* If the bridge is not VLAN aware and no VID was |
| 883 | * provided, set it to pvid to ensure the MAC entry | 886 | * provided, set it to pvid to ensure the MAC entry |
| 884 | * matches incoming untagged packets | 887 | * matches incoming untagged packets |
| @@ -905,7 +908,7 @@ static int ocelot_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], · 20 unmodified lines | |||
| 905 | struct ocelot *ocelot = priv->port.ocelot; | 908 | struct ocelot *ocelot = priv->port.ocelot; |
| 906 | int port = priv->chip_port; | 909 | int port = priv->chip_port; |
| 907 | 910 | ||
| 908 | return ocelot_fdb_add(ocelot, port, addr, vid, priv->vlan_aware); | 911 | return ocelot_fdb_add(ocelot, port, addr, vid); |
| 909 | } | 912 | } |
| 910 | 913 | ||
| 911 | int ocelot_fdb_del(struct ocelot *ocelot, int port, | 914 | int ocelot_fdb_del(struct ocelot *ocelot, int port, |
| @@ -1496,8 +1499,8 @@ static int ocelot_port_attr_set(struct net_device *dev, · 584 unmodified lines | |||
| 1496 | ocelot_port_attr_ageing_set(ocelot, port, attr->u.ageing_time); | 1499 | ocelot_port_attr_ageing_set(ocelot, port, attr->u.ageing_time); |
| 1497 | break; | 1500 | break; |
| 1498 | case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING: | 1501 | case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING: |
| 1499 | priv->vlan_aware = attr->u.vlan_filtering; | 1502 | ocelot_port_vlan_filtering(ocelot, port, |
| 1500 | ocelot_port_vlan_filtering(ocelot, port, priv->vlan_aware); | 1503 | attr->u.vlan_filtering); |
| 1501 | break; | 1504 | break; |
| 1502 | case SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED: | 1505 | case SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED: |
| 1503 | ocelot_port_attr_mc_set(ocelot, port, !attr->u.mc_disabled); | 1506 | ocelot_port_attr_mc_set(ocelot, port, !attr->u.mc_disabled); |
| @@ -1868,7 +1871,6 @@ static int ocelot_netdevice_port_event(struct net_device *dev, · 364 unmodified lines | |||
| 1868 | } else { | 1871 | } else { |
| 1869 | err = ocelot_port_bridge_leave(ocelot, port, | 1872 | err = ocelot_port_bridge_leave(ocelot, port, |
| 1870 | info->upper_dev); | 1873 | info->upper_dev); |
| 1871 | priv->vlan_aware = false; | ||
| 1872 | } | 1874 | } |
| 1873 | } | 1875 | } |
| 1874 | if (netif_is_lag_master(info->upper_dev)) { | 1876 | if (netif_is_lag_master(info->upper_dev)) { |
| @@ -56,8 +56,6 @@ struct ocelot_port_private { · 55 unmodified lines | |||
| 56 | struct phy_device *phy; | 56 | struct phy_device *phy; |
| 57 | u8 chip_port; | 57 | u8 chip_port; |
| 58 | 58 | ||
| 59 | u8 vlan_aware; | ||
| 60 | |||
| 61 | struct phy *serdes; | 59 | struct phy *serdes; |
| 62 | 60 | ||
| 63 | struct ocelot_port_tc tc; | 61 | struct ocelot_port_tc tc; |
| @@ -5155,7 +5155,7 @@ static int do_s2io_delete_unicast_mc(struct s2io_nic *sp, u64 addr) · 5154 unmodified lines | |||
| 5155 | /* read mac entries from CAM */ | 5155 | /* read mac entries from CAM */ |
| 5156 | static u64 do_s2io_read_unicast_mc(struct s2io_nic *sp, int offset) | 5156 | static u64 do_s2io_read_unicast_mc(struct s2io_nic *sp, int offset) |
| 5157 | { | 5157 | { |
| 5158 | u64 tmp64 = 0xffffffffffff0000ULL, val64; | 5158 | u64 tmp64, val64; |
| 5159 | struct XENA_dev_config __iomem *bar0 = sp->bar0; | 5159 | struct XENA_dev_config __iomem *bar0 = sp->bar0; |
| 5160 | 5160 | ||
| 5161 | /* read mac addr */ | 5161 | /* read mac addr */ |
| @@ -2127,6 +2127,8 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif) · 2126 unmodified lines | |||
| 2127 | if (lif->registered) | 2127 | if (lif->registered) |
| 2128 | ionic_lif_set_netdev_info(lif); | 2128 | ionic_lif_set_netdev_info(lif); |
| 2129 | 2129 | ||
| 2130 | ionic_rx_filter_replay(lif); | ||
| 2131 | |||
| 2130 | if (netif_running(lif->netdev)) { | 2132 | if (netif_running(lif->netdev)) { |
| 2131 | err = ionic_txrx_alloc(lif); | 2133 | err = ionic_txrx_alloc(lif); |
| 2132 | if (err) | 2134 | if (err) |
| @@ -2206,9 +2208,9 @@ static void ionic_lif_deinit(struct ionic_lif *lif) · 73 unmodified lines | |||
| 2206 | if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state)) { | 2208 | if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state)) { |
| 2207 | cancel_work_sync(&lif->deferred.work); | 2209 | cancel_work_sync(&lif->deferred.work); |
| 2208 | cancel_work_sync(&lif->tx_timeout_work); | 2210 | cancel_work_sync(&lif->tx_timeout_work); |
| 2211 | ionic_rx_filters_deinit(lif); | ||
| 2209 | } | 2212 | } |
| 2210 | 2213 | ||
| 2211 | ionic_rx_filters_deinit(lif); | ||
| 2212 | if (lif->netdev->features & NETIF_F_RXHASH) | 2214 | if (lif->netdev->features & NETIF_F_RXHASH) |
| 2213 | ionic_lif_rss_deinit(lif); | 2215 | ionic_lif_rss_deinit(lif); |
| 2214 | 2216 | ||
| @@ -2339,24 +2341,30 @@ static int ionic_station_set(struct ionic_lif *lif) · 124 unmodified lines | |||
| 2339 | err = ionic_adminq_post_wait(lif, &ctx); | 2341 | err = ionic_adminq_post_wait(lif, &ctx); |
| 2340 | if (err) | 2342 | if (err) |
| 2341 | return err; | 2343 | return err; |
| 2342 | 2344 | netdev_dbg(lif->netdev, "found initial MAC addr %pM\n", | |
| 2345 | ctx.comp.lif_getattr.mac); | ||
| 2343 | if (is_zero_ether_addr(ctx.comp.lif_getattr.mac)) | 2346 | if (is_zero_ether_addr(ctx.comp.lif_getattr.mac)) |
| 2344 | return 0; | 2347 | return 0; |
| 2345 | 2348 | ||
| 2346 | memcpy(addr.sa_data, ctx.comp.lif_getattr.mac, netdev->addr_len); | 2349 | if (!ether_addr_equal(ctx.comp.lif_getattr.mac, netdev->dev_addr)) { |
| 2347 | addr.sa_family = AF_INET; | 2350 | memcpy(addr.sa_data, ctx.comp.lif_getattr.mac, netdev->addr_len); |
| 2348 | err = eth_prepare_mac_addr_change(netdev, &addr); | 2351 | addr.sa_family = AF_INET; |
| 2349 | if (err) { | 2352 | err = eth_prepare_mac_addr_change(netdev, &addr); |
| 2350 | netdev_warn(lif->netdev, "ignoring bad MAC addr from NIC %pM - err %d\n", | 2353 | if (err) { |
| 2351 | addr.sa_data, err); | 2354 | netdev_warn(lif->netdev, "ignoring bad MAC addr from NIC %pM - err %d\n", |
| 2352 | return 0; | 2355 | addr.sa_data, err); |
| 2353 | } | 2356 | return 0; |
| 2357 | } | ||
| 2354 | 2358 | ||
| 2355 | netdev_dbg(lif->netdev, "deleting station MAC addr %pM\n", | 2359 | if (!is_zero_ether_addr(netdev->dev_addr)) { |
| 2356 | netdev->dev_addr); | 2360 | netdev_dbg(lif->netdev, "deleting station MAC addr %pM\n", |
| 2357 | ionic_lif_addr(lif, netdev->dev_addr, false); | 2361 | netdev->dev_addr); |
| 2362 | ionic_lif_addr(lif, netdev->dev_addr, false); | ||
| 2363 | } | ||
| 2364 | |||
| 2365 | eth_commit_mac_addr_change(netdev, &addr); | ||
| 2366 | } | ||
| 2358 | 2367 | ||
| 2359 | eth_commit_mac_addr_change(netdev, &addr); | ||
| 2360 | netdev_dbg(lif->netdev, "adding station MAC addr %pM\n", | 2368 | netdev_dbg(lif->netdev, "adding station MAC addr %pM\n", |
| 2361 | netdev->dev_addr); | 2369 | netdev->dev_addr); |
| 2362 | ionic_lif_addr(lif, netdev->dev_addr, true); | 2370 | ionic_lif_addr(lif, netdev->dev_addr, true); |
| @@ -2421,9 +2429,11 @@ static int ionic_lif_init(struct ionic_lif *lif) · 58 unmodified lines | |||
| 2421 | if (err) | 2429 | if (err) |
| 2422 | goto err_out_notifyq_deinit; | 2430 | goto err_out_notifyq_deinit; |
| 2423 | 2431 | ||
| 2424 | err = ionic_rx_filters_init(lif); | 2432 | if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state)) { |
| 2425 | if (err) | 2433 | err = ionic_rx_filters_init(lif); |
| 2426 | goto err_out_notifyq_deinit; | 2434 | if (err) |
| 2435 | goto err_out_notifyq_deinit; | ||
| 2436 | } | ||
| 2427 | 2437 | ||
| 2428 | err = ionic_station_set(lif); | 2438 | err = ionic_station_set(lif); |
| 2429 | if (err) | 2439 | if (err) |
| @@ -2,6 +2,7 @@ · 1 unmodified line | |||
| 2 | /* Copyright(c) 2017 - 2019 Pensando Systems, Inc */ | 2 | /* Copyright(c) 2017 - 2019 Pensando Systems, Inc */ |
| 3 | 3 | ||
| 4 | #include <linux/netdevice.h> | 4 | #include <linux/netdevice.h> |
| 5 | #include <linux/dynamic_debug.h> | ||
| 5 | #include <linux/etherdevice.h> | 6 | #include <linux/etherdevice.h> |
| 6 | 7 | ||
| 7 | #include "ionic.h" | 8 | #include "ionic.h" |
| @@ -17,17 +18,49 @@ void ionic_rx_filter_free(struct ionic_lif *lif, struct ionic_rx_filter *f) · 9 unmodified lines | |||
| 17 | devm_kfree(dev, f); | 18 | devm_kfree(dev, f); |
| 18 | } | 19 | } |
| 19 | 20 | ||
| 20 | int ionic_rx_filter_del(struct ionic_lif *lif, struct ionic_rx_filter *f) | 21 | void ionic_rx_filter_replay(struct ionic_lif *lif) |
| 21 | { | 22 | { |
| 22 | struct ionic_admin_ctx ctx = { | 23 | struct ionic_rx_filter_add_cmd *ac; |
| 23 | .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), | 24 | struct ionic_admin_ctx ctx; |
| 24 | .cmd.rx_filter_del = { | 25 | struct ionic_rx_filter *f; |
| 25 | .opcode = IONIC_CMD_RX_FILTER_DEL, | 26 | struct hlist_head *head; |
| 26 | .filter_id = cpu_to_le32(f->filter_id), | 27 | struct hlist_node *tmp; |
| 27 | }, | 28 | unsigned int i; |
| 28 | }; | 29 | int err; |
| 29 | 30 | ||
| 30 | return ionic_adminq_post_wait(lif, &ctx); | 31 | ac = &ctx.cmd.rx_filter_add; |
| 32 | |||
| 33 | for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) { | ||
| 34 | head = &lif->rx_filters.by_id[i]; | ||
| 35 | hlist_for_each_entry_safe(f, tmp, head, by_id) { | ||
| 36 | ctx.work = COMPLETION_INITIALIZER_ONSTACK(ctx.work); | ||
| 37 | memcpy(ac, &f->cmd, sizeof(f->cmd)); | ||
| 38 | dev_dbg(&lif->netdev->dev, "replay filter command:\n"); | ||
| 39 | dynamic_hex_dump("cmd ", DUMP_PREFIX_OFFSET, 16, 1, | ||
| 40 | &ctx.cmd, sizeof(ctx.cmd), true); | ||
| 41 | |||
| 42 | err = ionic_adminq_post_wait(lif, &ctx); | ||
| 43 | if (err) { | ||
| 44 | switch (le16_to_cpu(ac->match)) { | ||
| 45 | case IONIC_RX_FILTER_MATCH_VLAN: | ||
| 46 | netdev_info(lif->netdev, "Replay failed - %d: vlan %d\n", | ||
| 47 | err, | ||
| 48 | le16_to_cpu(ac->vlan.vlan)); | ||
| 49 | break; | ||
| 50 | case IONIC_RX_FILTER_MATCH_MAC: | ||
| 51 | netdev_info(lif->netdev, "Replay failed - %d: mac %pM\n", | ||
| 52 | err, ac->mac.addr); | ||
| 53 | break; | ||
| 54 | case IONIC_RX_FILTER_MATCH_MAC_VLAN: | ||
| 55 | netdev_info(lif->netdev, "Replay failed - %d: vlan %d mac %pM\n", | ||
| 56 | err, | ||
| 57 | le16_to_cpu(ac->vlan.vlan), | ||
| 58 | ac->mac.addr); | ||
| 59 | break; | ||
| 60 | } | ||
| 61 | } | ||
| 62 | } | ||
| 63 | } | ||
| 31 | } | 64 | } |
| 32 | 65 | ||
| 33 | int ionic_rx_filters_init(struct ionic_lif *lif) | 66 | int ionic_rx_filters_init(struct ionic_lif *lif) |
| @@ -24,7 +24,7 @@ struct ionic_rx_filters { · 23 unmodified lines | |||
| 24 | }; | 24 | }; |
| 25 | 25 | ||
| 26 | void ionic_rx_filter_free(struct ionic_lif *lif, struct ionic_rx_filter *f); | 26 | void ionic_rx_filter_free(struct ionic_lif *lif, struct ionic_rx_filter *f); |
| 27 | int ionic_rx_filter_del(struct ionic_lif *lif, struct ionic_rx_filter *f); | 27 | void ionic_rx_filter_replay(struct ionic_lif *lif); |
| 28 | int ionic_rx_filters_init(struct ionic_lif *lif); | 28 | int ionic_rx_filters_init(struct ionic_lif *lif); |
| 29 | void ionic_rx_filters_deinit(struct ionic_lif *lif); | 29 | void ionic_rx_filters_deinit(struct ionic_lif *lif); |
| 30 | int ionic_rx_filter_save(struct ionic_lif *lif, u32 flow_id, u16 rxq_index, | 30 | int ionic_rx_filter_save(struct ionic_lif *lif, u32 flow_id, u16 rxq_index, |
| @@ -1,19 +1,3 @@ | |||
| 1 | |||
| 2 | /* | ||
| 3 | * snull.h -- definitions for the network module | ||
| 4 | * | ||
| 5 | * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet | ||
| 6 | * Copyright (C) 2001 O'Reilly & Associates | ||
| 7 | * | ||
| 8 | * The source code in this file can be freely used, adapted, | ||
| 9 | * and redistributed in source or binary form, so long as an | ||
| 10 | * acknowledgment appears in derived source files. The citation | ||
| 11 | * should list that the code comes from the book "Linux Device | ||
| 12 | * Drivers" by Alessandro Rubini and Jonathan Corbet, published | ||
| 13 | * by O'Reilly & Associates. No warranty is attached; | ||
| 14 | * we cannot take responsibility for errors or fitness for use. | ||
| 15 | */ | ||
| 16 | |||
| 17 | /* version dependencies have been confined to a separate file */ | 1 | /* version dependencies have been confined to a separate file */ |
| 18 | 2 | ||
| 19 | /* Tunable parameters */ | 3 | /* Tunable parameters */ |
| @@ -5,8 +5,13 @@ · 4 unmodified lines | |||
| 5 | #include <linux/clk-provider.h> | 5 | #include <linux/clk-provider.h> |
| 6 | #include <linux/pci.h> | 6 | #include <linux/pci.h> |
| 7 | #include <linux/dmi.h> | 7 | #include <linux/dmi.h> |
| 8 | #include "dwmac-intel.h" | ||
| 8 | #include "stmmac.h" | 9 | #include "stmmac.h" |
| 9 | 10 | ||
| 11 | struct intel_priv_data { | ||
| 12 | int mdio_adhoc_addr; /* mdio address for serdes & etc */ | ||
| 13 | }; | ||
| 14 | |||
| 10 | /* This struct is used to associate PCI Function of MAC controller on a board, | 15 | /* This struct is used to associate PCI Function of MAC controller on a board, |
| 11 | * discovered via DMI, with the address of PHY connected to the MAC. The | 16 | * discovered via DMI, with the address of PHY connected to the MAC. The |
| 12 | * negative value of the address means that MAC controller is not connected | 17 | * negative value of the address means that MAC controller is not connected |
| @@ -49,6 +54,172 @@ static int stmmac_pci_find_phy_addr(struct pci_dev *pdev, · 36 unmodified lines | |||
| 49 | return -ENODEV; | 54 | return -ENODEV; |
| 50 | } | 55 | } |
| 51 | 56 | ||
| 57 | static int serdes_status_poll(struct stmmac_priv *priv, int phyaddr, | ||
| 58 | int phyreg, u32 mask, u32 val) | ||
| 59 | { | ||
| 60 | unsigned int retries = 10; | ||
| 61 | int val_rd; | ||
| 62 | |||
| 63 | do { | ||
| 64 | val_rd = mdiobus_read(priv->mii, phyaddr, phyreg); | ||
| 65 | if ((val_rd & mask) == (val & mask)) | ||
| 66 | return 0; | ||
| 67 | udelay(POLL_DELAY_US); | ||
| 68 | } while (--retries); | ||
| 69 | |||
| 70 | return -ETIMEDOUT; | ||
| 71 | } | ||
| 72 | |||
| 73 | static int intel_serdes_powerup(struct net_device *ndev, void *priv_data) | ||
| 74 | { | ||
| 75 | struct intel_priv_data *intel_priv = priv_data; | ||
| 76 | struct stmmac_priv *priv = netdev_priv(ndev); | ||
| 77 | int serdes_phy_addr = 0; | ||
| 78 | u32 data = 0; | ||
| 79 | |||
| 80 | if (!intel_priv->mdio_adhoc_addr) | ||
| 81 | return 0; | ||
| 82 | |||
| 83 | serdes_phy_addr = intel_priv->mdio_adhoc_addr; | ||
| 84 | |||
| 85 | /* assert clk_req */ | ||
| 86 | data = mdiobus_read(priv->mii, serdes_phy_addr, | ||
| 87 | SERDES_GCR0); | ||
| 88 | |||
| 89 | data |= SERDES_PLL_CLK; | ||
| 90 | |||
| 91 | mdiobus_write(priv->mii, serdes_phy_addr, | ||
| 92 | SERDES_GCR0, data); | ||
| 93 | |||
| 94 | /* check for clk_ack assertion */ | ||
| 95 | data = serdes_status_poll(priv, serdes_phy_addr, | ||
| 96 | SERDES_GSR0, | ||
| 97 | SERDES_PLL_CLK, | ||
| 98 | SERDES_PLL_CLK); | ||
| 99 | |||
| 100 | if (data) { | ||
| 101 | dev_err(priv->device, "Serdes PLL clk request timeout\n"); | ||
| 102 | return data; | ||
| 103 | } | ||
| 104 | |||
| 105 | /* assert lane reset */ | ||
| 106 | data = mdiobus_read(priv->mii, serdes_phy_addr, | ||
| 107 | SERDES_GCR0); | ||
| 108 | |||
| 109 | data |= SERDES_RST; | ||
| 110 | |||
| 111 | mdiobus_write(priv->mii, serdes_phy_addr, | ||
| 112 | SERDES_GCR0, data); | ||
| 113 | |||
| 114 | /* check for assert lane reset reflection */ | ||
| 115 | data = serdes_status_poll(priv, serdes_phy_addr, | ||
| 116 | SERDES_GSR0, | ||
| 117 | SERDES_RST, | ||
| 118 | SERDES_RST); | ||
| 119 | |||
| 120 | if (data) { | ||
| 121 | dev_err(priv->device, "Serdes assert lane reset timeout\n"); | ||
| 122 | return data; | ||
| 123 | } | ||
| 124 | |||
| 125 | /* move power state to P0 */ | ||
| 126 | data = mdiobus_read(priv->mii, serdes_phy_addr, | ||
| 127 | SERDES_GCR0); | ||
| 128 | |||
| 129 | data &= ~SERDES_PWR_ST_MASK; | ||
| 130 | data |= SERDES_PWR_ST_P0 << SERDES_PWR_ST_SHIFT; | ||
| 131 | |||
| 132 | mdiobus_write(priv->mii, serdes_phy_addr, | ||
| 133 | SERDES_GCR0, data); | ||
| 134 | |||
| 135 | /* Check for P0 state */ | ||
| 136 | data = serdes_status_poll(priv, serdes_phy_addr, | ||
| 137 | SERDES_GSR0, | ||
| 138 | SERDES_PWR_ST_MASK, | ||
| 139 | SERDES_PWR_ST_P0 << SERDES_PWR_ST_SHIFT); | ||
| 140 | |||
| 141 | if (data) { | ||
| 142 | dev_err(priv->device, "Serdes power state P0 timeout.\n"); | ||
| 143 | return data; | ||
| 144 | } | ||
| 145 | |||
| 146 | return 0; | ||
| 147 | } | ||
| 148 | |||
| 149 | static void intel_serdes_powerdown(struct net_device *ndev, void *intel_data) | ||
| 150 | { | ||
| 151 | struct intel_priv_data *intel_priv = intel_data; | ||
| 152 | struct stmmac_priv *priv = netdev_priv(ndev); | ||
| 153 | int serdes_phy_addr = 0; | ||
| 154 | u32 data = 0; | ||
| 155 | |||
| 156 | if (!intel_priv->mdio_adhoc_addr) | ||
| 157 | return; | ||
| 158 | |||
| 159 | serdes_phy_addr = intel_priv->mdio_adhoc_addr; | ||
| 160 | |||
| 161 | /* move power state to P3 */ | ||
| 162 | data = mdiobus_read(priv->mii, serdes_phy_addr, | ||
| 163 | SERDES_GCR0); | ||
| 164 | |||
| 165 | data &= ~SERDES_PWR_ST_MASK; | ||
| 166 | data |= SERDES_PWR_ST_P3 << SERDES_PWR_ST_SHIFT; | ||
| 167 | |||
| 168 | mdiobus_write(priv->mii, serdes_phy_addr, | ||
| 169 | SERDES_GCR0, data); | ||
| 170 | |||
| 171 | /* Check for P3 state */ | ||
| 172 | data = serdes_status_poll(priv, serdes_phy_addr, | ||
| 173 | SERDES_GSR0, | ||
| 174 | SERDES_PWR_ST_MASK, | ||
| 175 | SERDES_PWR_ST_P3 << SERDES_PWR_ST_SHIFT); | ||
| 176 | |||
| 177 | if (data) { | ||
| 178 | dev_err(priv->device, "Serdes power state P3 timeout\n"); | ||
| 179 | return; | ||
| 180 | } | ||
| 181 | |||
| 182 | /* de-assert clk_req */ | ||
| 183 | data = mdiobus_read(priv->mii, serdes_phy_addr, | ||
| 184 | SERDES_GCR0); | ||
| 185 | |||
| 186 | data &= ~SERDES_PLL_CLK; | ||
| 187 | |||
| 188 | mdiobus_write(priv->mii, serdes_phy_addr, | ||
| 189 | SERDES_GCR0, data); | ||
| 190 | |||
| 191 | /* check for clk_ack de-assert */ | ||
| 192 | data = serdes_status_poll(priv, serdes_phy_addr, | ||
| 193 | SERDES_GSR0, | ||
| 194 | SERDES_PLL_CLK, | ||
| 195 | (u32)~SERDES_PLL_CLK); | ||
| 196 | |||
| 197 | if (data) { | ||
| 198 | dev_err(priv->device, "Serdes PLL clk de-assert timeout\n"); | ||
| 199 | return; | ||
| 200 | } | ||
| 201 | |||
| 202 | /* de-assert lane reset */ | ||
| 203 | data = mdiobus_read(priv->mii, serdes_phy_addr, | ||
| 204 | SERDES_GCR0); | ||
| 205 | |||
| 206 | data &= ~SERDES_RST; | ||
| 207 | |||
| 208 | mdiobus_write(priv->mii, serdes_phy_addr, | ||
| 209 | SERDES_GCR0, data); | ||
| 210 | |||
| 211 | /* check for de-assert lane reset reflection */ | ||
| 212 | data = serdes_status_poll(priv, serdes_phy_addr, | ||
| 213 | SERDES_GSR0, | ||
| 214 | SERDES_RST, | ||
| 215 | (u32)~SERDES_RST); | ||
| 216 | |||
| 217 | if (data) { | ||
| 218 | dev_err(priv->device, "Serdes de-assert lane reset timeout\n"); | ||
| 219 | return; | ||
| 220 | } | ||
| 221 | } | ||
| 222 | |||
| 52 | static void common_default_data(struct plat_stmmacenet_data *plat) | 223 | static void common_default_data(struct plat_stmmacenet_data *plat) |
| 53 | { | 224 | { |
| 54 | plat->clk_csr = 2; /* clk_csr_i = 20-35MHz & MDC = clk_csr_i/16 */ | 225 | plat->clk_csr = 2; /* clk_csr_i = 20-35MHz & MDC = clk_csr_i/16 */ |
| @@ -189,6 +360,9 @@ static int ehl_sgmii_data(struct pci_dev *pdev, · 134 unmodified lines | |||
| 189 | plat->phy_addr = 0; | 360 | plat->phy_addr = 0; |
| 190 | plat->phy_interface = PHY_INTERFACE_MODE_SGMII; | 361 | plat->phy_interface = PHY_INTERFACE_MODE_SGMII; |
| 191 | 362 | ||
| 363 | plat->serdes_powerup = intel_serdes_powerup; | ||
| 364 | plat->serdes_powerdown = intel_serdes_powerdown; | ||
| 365 | |||
| 192 | return ehl_common_data(pdev, plat); | 366 | return ehl_common_data(pdev, plat); |
| 193 | } | 367 | } |
| 194 | 368 | ||
| @@ -233,6 +407,8 @@ static int ehl_pse0_sgmii1g_data(struct pci_dev *pdev, · 38 unmodified lines | |||
| 233 | struct plat_stmmacenet_data *plat) | 407 | struct plat_stmmacenet_data *plat) |
| 234 | { | 408 | { |
| 235 | plat->phy_interface = PHY_INTERFACE_MODE_SGMII; | 409 | plat->phy_interface = PHY_INTERFACE_MODE_SGMII; |
| 410 | plat->serdes_powerup = intel_serdes_powerup; | ||
| 411 | plat->serdes_powerdown = intel_serdes_powerdown; | ||
| 236 | return ehl_pse0_common_data(pdev, plat); | 412 | return ehl_pse0_common_data(pdev, plat); |
| 237 | } | 413 | } |
| 238 | 414 | ||
| @@ -263,6 +439,8 @@ static int ehl_pse1_sgmii1g_data(struct pci_dev *pdev, · 24 unmodified lines | |||
| 263 | struct plat_stmmacenet_data *plat) | 439 | struct plat_stmmacenet_data *plat) |
| 264 | { | 440 | { |
| 265 | plat->phy_interface = PHY_INTERFACE_MODE_SGMII; | 441 | plat->phy_interface = PHY_INTERFACE_MODE_SGMII; |
| 442 | plat->serdes_powerup = intel_serdes_powerup; | ||
| 443 | plat->serdes_powerdown = intel_serdes_powerdown; | ||
| 266 | return ehl_pse1_common_data(pdev, plat); | 444 | return ehl_pse1_common_data(pdev, plat); |
| 267 | } | 445 | } |
| 268 | 446 | ||
| @@ -291,6 +469,8 @@ static int tgl_sgmii_data(struct pci_dev *pdev, · 22 unmodified lines | |||
| 291 | plat->bus_id = 1; | 469 | plat->bus_id = 1; |
| 292 | plat->phy_addr = 0; | 470 | plat->phy_addr = 0; |
| 293 | plat->phy_interface = PHY_INTERFACE_MODE_SGMII; | 471 | plat->phy_interface = PHY_INTERFACE_MODE_SGMII; |
| 472 | plat->serdes_powerup = intel_serdes_powerup; | ||
| 473 | plat->serdes_powerdown = intel_serdes_powerdown; | ||
| 294 | return tgl_common_data(pdev, plat); | 474 | return tgl_common_data(pdev, plat); |
| 295 | } | 475 | } |
| 296 | 476 | ||
| @@ -417,11 +597,17 @@ static int intel_eth_pci_probe(struct pci_dev *pdev, · 120 unmodified lines | |||
| 417 | const struct pci_device_id *id) | 597 | const struct pci_device_id *id) |
| 418 | { | 598 | { |
| 419 | struct stmmac_pci_info *info = (struct stmmac_pci_info *)id->driver_data; | 599 | struct stmmac_pci_info *info = (struct stmmac_pci_info *)id->driver_data; |
| 600 | struct intel_priv_data *intel_priv; | ||
| 420 | struct plat_stmmacenet_data *plat; | 601 | struct plat_stmmacenet_data *plat; |
| 421 | struct stmmac_resources res; | 602 | struct stmmac_resources res; |
| 422 | int i; | 603 | int i; |
| 423 | int ret; | 604 | int ret; |
| 424 | 605 | ||
| 606 | intel_priv = devm_kzalloc(&pdev->dev, sizeof(*intel_priv), | ||
| 607 | GFP_KERNEL); | ||
| 608 | if (!intel_priv) | ||
| 609 | return -ENOMEM; | ||
| 610 | |||
| 425 | plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); | 611 | plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); |
| 426 | if (!plat) | 612 | if (!plat) |
| 427 | return -ENOMEM; | 613 | return -ENOMEM; |
| @@ -457,6 +643,9 @@ static int intel_eth_pci_probe(struct pci_dev *pdev, · 29 unmodified lines | |||
| 457 | 643 | ||
| 458 | pci_set_master(pdev); | 644 | pci_set_master(pdev); |
| 459 | 645 | ||
| 646 | plat->bsp_priv = intel_priv; | ||
| 647 | intel_priv->mdio_adhoc_addr = 0x15; | ||
| 648 | |||
| 460 | ret = info->setup(pdev, plat); | 649 | ret = info->setup(pdev, plat); |
| 461 | if (ret) | 650 | if (ret) |
| 462 | return ret; | 651 | return ret; |
| @@ -0,0 +1,23 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* Copyright (c) 2020, Intel Corporation | ||
| 3 | * DWMAC Intel header file | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef __DWMAC_INTEL_H__ | ||
| 7 | #define __DWMAC_INTEL_H__ | ||
| 8 | |||
| 9 | #define POLL_DELAY_US 8 | ||
| 10 | |||
| 11 | /* SERDES Register */ | ||
| 12 | #define SERDES_GSR0 0x5 /* Global Status Reg0 */ | ||
| 13 | #define SERDES_GCR0 0xb /* Global Configuration Reg0 */ | ||
| 14 | |||
| 15 | /* SERDES defines */ | ||
| 16 | #define SERDES_PLL_CLK BIT(0) /* PLL clk valid signal */ | ||
| 17 | #define SERDES_RST BIT(2) /* Serdes Reset */ | ||
| 18 | #define SERDES_PWR_ST_MASK GENMASK(6, 4) /* Serdes Power state*/ | ||
| 19 | #define SERDES_PWR_ST_SHIFT 4 | ||
| 20 | #define SERDES_PWR_ST_P0 0x0 | ||
| 21 | #define SERDES_PWR_ST_P3 0x3 | ||
| 22 | |||
| 23 | #endif /* __DWMAC_INTEL_H__ */ | ||
| @@ -119,6 +119,7 @@ static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac) · 118 unmodified lines | |||
| 119 | { .div = 5, .val = 5, }, | 119 | { .div = 5, .val = 5, }, |
| 120 | { .div = 6, .val = 6, }, | 120 | { .div = 6, .val = 6, }, |
| 121 | { .div = 7, .val = 7, }, | 121 | { .div = 7, .val = 7, }, |
| 122 | { /* end of array */ } | ||
| 122 | }; | 123 | }; |
| 123 | 124 | ||
| 124 | clk_configs = devm_kzalloc(dev, sizeof(*clk_configs), GFP_KERNEL); | 125 | clk_configs = devm_kzalloc(dev, sizeof(*clk_configs), GFP_KERNEL); |
| @@ -241,6 +241,8 @@ static int socfpga_set_phy_mode_common(int phymode, u32 *val) · 240 unmodified lines | |||
| 241 | switch (phymode) { | 241 | switch (phymode) { |
| 242 | case PHY_INTERFACE_MODE_RGMII: | 242 | case PHY_INTERFACE_MODE_RGMII: |
| 243 | case PHY_INTERFACE_MODE_RGMII_ID: | 243 | case PHY_INTERFACE_MODE_RGMII_ID: |
| 244 | case PHY_INTERFACE_MODE_RGMII_RXID: | ||
| 245 | case PHY_INTERFACE_MODE_RGMII_TXID: | ||
| 244 | *val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII; | 246 | *val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII; |
| 245 | break; | 247 | break; |
| 246 | case PHY_INTERFACE_MODE_MII: | 248 | case PHY_INTERFACE_MODE_MII: |
| @@ -289,16 +291,19 @@ static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac) · 42 unmodified lines | |||
| 289 | phymode == PHY_INTERFACE_MODE_MII || | 291 | phymode == PHY_INTERFACE_MODE_MII || |
| 290 | phymode == PHY_INTERFACE_MODE_GMII || | 292 | phymode == PHY_INTERFACE_MODE_GMII || |
| 291 | phymode == PHY_INTERFACE_MODE_SGMII) { | 293 | phymode == PHY_INTERFACE_MODE_SGMII) { |
| 292 | ctrl |= SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK << (reg_shift / 2); | ||
| 293 | regmap_read(sys_mgr_base_addr, SYSMGR_FPGAGRP_MODULE_REG, | 294 | regmap_read(sys_mgr_base_addr, SYSMGR_FPGAGRP_MODULE_REG, |
| 294 | &module); | 295 | &module); |
| 295 | module |= (SYSMGR_FPGAGRP_MODULE_EMAC << (reg_shift / 2)); | 296 | module |= (SYSMGR_FPGAGRP_MODULE_EMAC << (reg_shift / 2)); |
| 296 | regmap_write(sys_mgr_base_addr, SYSMGR_FPGAGRP_MODULE_REG, | 297 | regmap_write(sys_mgr_base_addr, SYSMGR_FPGAGRP_MODULE_REG, |
| 297 | module); | 298 | module); |
| 298 | } else { | ||
| 299 | ctrl &= ~(SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK << (reg_shift / 2)); | ||
| 300 | } | 299 | } |
| 301 | 300 | ||
| 301 | if (dwmac->f2h_ptp_ref_clk) | ||
| 302 | ctrl |= SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK << (reg_shift / 2); | ||
| 303 | else | ||
| 304 | ctrl &= ~(SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK << | ||
| 305 | (reg_shift / 2)); | ||
| 306 | |||
| 302 | regmap_write(sys_mgr_base_addr, reg_offset, ctrl); | 307 | regmap_write(sys_mgr_base_addr, reg_offset, ctrl); |
| 303 | 308 | ||
| 304 | /* Deassert reset for the phy configuration to be sampled by | 309 | /* Deassert reset for the phy configuration to be sampled by |
| @@ -150,6 +150,8 @@ static int sun7i_gmac_probe(struct platform_device *pdev) · 149 unmodified lines | |||
| 150 | plat_dat->init = sun7i_gmac_init; | 150 | plat_dat->init = sun7i_gmac_init; |
| 151 | plat_dat->exit = sun7i_gmac_exit; | 151 | plat_dat->exit = sun7i_gmac_exit; |
| 152 | plat_dat->fix_mac_speed = sun7i_fix_speed; | 152 | plat_dat->fix_mac_speed = sun7i_fix_speed; |
| 153 | plat_dat->tx_fifo_size = 4096; | ||
| 154 | plat_dat->rx_fifo_size = 16384; | ||
| 153 | 155 | ||
| 154 | ret = sun7i_gmac_init(pdev, plat_dat->bsp_priv); | 156 | ret = sun7i_gmac_init(pdev, plat_dat->bsp_priv); |
| 155 | if (ret) | 157 | if (ret) |
| @@ -27,12 +27,16 @@ static void config_sub_second_increment(void __iomem *ioaddr, · 26 unmodified lines | |||
| 27 | unsigned long data; | 27 | unsigned long data; |
| 28 | u32 reg_value; | 28 | u32 reg_value; |
| 29 | 29 | ||
| 30 | /* For GMAC3.x, 4.x versions, convert the ptp_clock to nano second | 30 | /* For GMAC3.x, 4.x versions, in "fine adjustement mode" set sub-second |
| 31 | * formula = (1/ptp_clock) * 1000000000 | 31 | * increment to twice the number of nanoseconds of a clock cycle. |
| 32 | * where ptp_clock is 50MHz if fine method is used to update system | 32 | * The calculation of the default_addend value by the caller will set it |
| 33 | * to mid-range = 2^31 when the remainder of this division is zero, | ||
| 34 | * which will make the accumulator overflow once every 2 ptp_clock | ||
| 35 | * cycles, adding twice the number of nanoseconds of a clock cycle : | ||
| 36 | * 2000000000ULL / ptp_clock. | ||
| 33 | */ | 37 | */ |
| 34 | if (value & PTP_TCR_TSCFUPDT) | 38 | if (value & PTP_TCR_TSCFUPDT) |
| 35 | data = (1000000000ULL / 50000000); | 39 | data = (2000000000ULL / ptp_clock); |
| 36 | else | 40 | else |
| 37 | data = (1000000000ULL / ptp_clock); | 41 | data = (1000000000ULL / ptp_clock); |
| 38 | 42 | ||
| @@ -4986,6 +4986,14 @@ int stmmac_dvr_probe(struct device *device, · 4985 unmodified lines | |||
| 4986 | goto error_netdev_register; | 4986 | goto error_netdev_register; |
| 4987 | } | 4987 | } |
| 4988 | 4988 | ||
| 4989 | if (priv->plat->serdes_powerup) { | ||
| 4990 | ret = priv->plat->serdes_powerup(ndev, | ||
| 4991 | priv->plat->bsp_priv); | ||
| 4992 | |||
| 4993 | if (ret < 0) | ||
| 4994 | return ret; | ||
| 4995 | } | ||
| 4996 | |||
| 4989 | #ifdef CONFIG_DEBUG_FS | 4997 | #ifdef CONFIG_DEBUG_FS |
| 4990 | stmmac_init_fs(ndev); | 4998 | stmmac_init_fs(ndev); |
| 4991 | #endif | 4999 | #endif |
| @@ -5029,6 +5037,9 @@ int stmmac_dvr_remove(struct device *dev) · 37 unmodified lines | |||
| 5029 | 5037 | ||
| 5030 | stmmac_stop_all_dma(priv); | 5038 | stmmac_stop_all_dma(priv); |
| 5031 | 5039 | ||
| 5040 | if (priv->plat->serdes_powerdown) | ||
| 5041 | priv->plat->serdes_powerdown(ndev, priv->plat->bsp_priv); | ||
| 5042 | |||
| 5032 | stmmac_mac_set(priv, priv->ioaddr, false); | 5043 | stmmac_mac_set(priv, priv->ioaddr, false); |
| 5033 | netif_carrier_off(ndev); | 5044 | netif_carrier_off(ndev); |
| 5034 | unregister_netdev(ndev); | 5045 | unregister_netdev(ndev); |
| @@ -5081,6 +5092,9 @@ int stmmac_suspend(struct device *dev) · 46 unmodified lines | |||
| 5081 | /* Stop TX/RX DMA */ | 5092 | /* Stop TX/RX DMA */ |
| 5082 | stmmac_stop_all_dma(priv); | 5093 | stmmac_stop_all_dma(priv); |
| 5083 | 5094 | ||
| 5095 | if (priv->plat->serdes_powerdown) | ||
| 5096 | priv->plat->serdes_powerdown(ndev, priv->plat->bsp_priv); | ||
| 5097 | |||
| 5084 | /* Enable Power down mode by programming the PMT regs */ | 5098 | /* Enable Power down mode by programming the PMT regs */ |
| 5085 | if (device_may_wakeup(priv->device)) { | 5099 | if (device_may_wakeup(priv->device)) { |
| 5086 | stmmac_pmt(priv, priv->hw, priv->wolopts); | 5100 | stmmac_pmt(priv, priv->hw, priv->wolopts); |
| @@ -5143,6 +5157,7 @@ int stmmac_resume(struct device *dev) · 56 unmodified lines | |||
| 5143 | { | 5157 | { |
| 5144 | struct net_device *ndev = dev_get_drvdata(dev); | 5158 | struct net_device *ndev = dev_get_drvdata(dev); |
| 5145 | struct stmmac_priv *priv = netdev_priv(ndev); | 5159 | struct stmmac_priv *priv = netdev_priv(ndev); |
| 5160 | int ret; | ||
| 5146 | 5161 | ||
| 5147 | if (!netif_running(ndev)) | 5162 | if (!netif_running(ndev)) |
| 5148 | return 0; | 5163 | return 0; |
| @@ -5170,6 +5185,14 @@ int stmmac_resume(struct device *dev) · 21 unmodified lines | |||
| 5170 | stmmac_mdio_reset(priv->mii); | 5185 | stmmac_mdio_reset(priv->mii); |
| 5171 | } | 5186 | } |
| 5172 | 5187 | ||
| 5188 | if (priv->plat->serdes_powerup) { | ||
| 5189 | ret = priv->plat->serdes_powerup(ndev, | ||
| 5190 | priv->plat->bsp_priv); | ||
| 5191 | |||
| 5192 | if (ret < 0) | ||
| 5193 | return ret; | ||
| 5194 | } | ||
| 5195 | |||
| 5173 | netif_device_attach(ndev); | 5196 | netif_device_attach(ndev); |
| 5174 | 5197 | ||
| 5175 | mutex_lock(&priv->lock); | 5198 | mutex_lock(&priv->lock); |
| @@ -1372,7 +1372,7 @@ static int am65_cpsw_nuss_init_tx_chns(struct am65_cpsw_common *common) · 1371 unmodified lines | |||
| 1372 | err: | 1372 | err: |
| 1373 | i = devm_add_action(dev, am65_cpsw_nuss_free_tx_chns, common); | 1373 | i = devm_add_action(dev, am65_cpsw_nuss_free_tx_chns, common); |
| 1374 | if (i) { | 1374 | if (i) { |
| 1375 | dev_err(dev, "failed to add free_tx_chns action %d", i); | 1375 | dev_err(dev, "Failed to add free_tx_chns action %d\n", i); |
| 1376 | return i; | 1376 | return i; |
| 1377 | } | 1377 | } |
| 1378 | 1378 | ||
| @@ -1481,7 +1481,7 @@ static int am65_cpsw_nuss_init_rx_chns(struct am65_cpsw_common *common) · 102 unmodified lines | |||
| 1481 | err: | 1481 | err: |
| 1482 | i = devm_add_action(dev, am65_cpsw_nuss_free_rx_chns, common); | 1482 | i = devm_add_action(dev, am65_cpsw_nuss_free_rx_chns, common); |
| 1483 | if (i) { | 1483 | if (i) { |
| 1484 | dev_err(dev, "failed to add free_rx_chns action %d", i); | 1484 | dev_err(dev, "Failed to add free_rx_chns action %d\n", i); |
| 1485 | return i; | 1485 | return i; |
| 1486 | } | 1486 | } |
| 1487 | 1487 | ||
| @@ -1691,7 +1691,7 @@ static int am65_cpsw_nuss_init_ndev_2g(struct am65_cpsw_common *common) · 203 unmodified lines | |||
| 1691 | ret = devm_add_action_or_reset(dev, am65_cpsw_pcpu_stats_free, | 1691 | ret = devm_add_action_or_reset(dev, am65_cpsw_pcpu_stats_free, |
| 1692 | ndev_priv->stats); | 1692 | ndev_priv->stats); |
| 1693 | if (ret) { | 1693 | if (ret) { |
| 1694 | dev_err(dev, "failed to add percpu stat free action %d", ret); | 1694 | dev_err(dev, "Failed to add percpu stat free action %d\n", ret); |
| 1695 | return ret; | 1695 | return ret; |
| 1696 | } | 1696 | } |
| 1697 | 1697 | ||
| @@ -1387,6 +1387,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev) · 1386 unmodified lines | |||
| 1387 | return -ENODEV; | 1387 | return -ENODEV; |
| 1388 | regs_phys = res->start; | 1388 | regs_phys = res->start; |
| 1389 | port->regs = devm_ioremap_resource(dev, res); | 1389 | port->regs = devm_ioremap_resource(dev, res); |
| 1390 | if (IS_ERR(port->regs)) | ||
| 1391 | return PTR_ERR(port->regs); | ||
| 1390 | 1392 | ||
| 1391 | switch (port->id) { | 1393 | switch (port->id) { |
| 1392 | case IXP4XX_ETH_NPEA: | 1394 | case IXP4XX_ETH_NPEA: |
| @@ -1207,7 +1207,7 @@ static int geneve_validate(struct nlattr *tb[], struct nlattr *data[], · 1206 unmodified lines | |||
| 1207 | enum ifla_geneve_df df = nla_get_u8(data[IFLA_GENEVE_DF]); | 1207 | enum ifla_geneve_df df = nla_get_u8(data[IFLA_GENEVE_DF]); |
| 1208 | 1208 | ||
| 1209 | if (df < 0 || df > GENEVE_DF_MAX) { | 1209 | if (df < 0 || df > GENEVE_DF_MAX) { |
| 1210 | NL_SET_ERR_MSG_ATTR(extack, tb[IFLA_GENEVE_DF], | 1210 | NL_SET_ERR_MSG_ATTR(extack, data[IFLA_GENEVE_DF], |
| 1211 | "Invalid DF attribute"); | 1211 | "Invalid DF attribute"); |
| 1212 | return -EINVAL; | 1212 | return -EINVAL; |
| 1213 | } | 1213 | } |
| @@ -297,14 +297,13 @@ static void ipa_modem_crashed(struct ipa *ipa) · 296 unmodified lines | |||
| 297 | 297 | ||
| 298 | ret = ipa_endpoint_modem_exception_reset_all(ipa); | 298 | ret = ipa_endpoint_modem_exception_reset_all(ipa); |
| 299 | if (ret) | 299 | if (ret) |
| 300 | dev_err(dev, "error %d resetting exception endpoint", | 300 | dev_err(dev, "error %d resetting exception endpoint\n", ret); |
| 301 | ret); | ||
| 302 | 301 | ||
| 303 | ipa_endpoint_modem_pause_all(ipa, false); | 302 | ipa_endpoint_modem_pause_all(ipa, false); |
| 304 | 303 | ||
| 305 | ret = ipa_modem_stop(ipa); | 304 | ret = ipa_modem_stop(ipa); |
| 306 | if (ret) | 305 | if (ret) |
| 307 | dev_err(dev, "error %d stopping modem", ret); | 306 | dev_err(dev, "error %d stopping modem\n", ret); |
| 308 | 307 | ||
| 309 | /* Now prepare for the next modem boot */ | 308 | /* Now prepare for the next modem boot */ |
| 310 | ret = ipa_mem_zero_modem(ipa); | 309 | ret = ipa_mem_zero_modem(ipa); |
| @@ -3809,7 +3809,7 @@ static int macsec_changelink(struct net_device *dev, struct nlattr *tb[], · 3808 unmodified lines | |||
| 3809 | struct netlink_ext_ack *extack) | 3809 | struct netlink_ext_ack *extack) |
| 3810 | { | 3810 | { |
| 3811 | struct macsec_dev *macsec = macsec_priv(dev); | 3811 | struct macsec_dev *macsec = macsec_priv(dev); |
| 3812 | struct macsec_tx_sa tx_sc; | 3812 | struct macsec_tx_sc tx_sc; |
| 3813 | struct macsec_secy secy; | 3813 | struct macsec_secy secy; |
| 3814 | int ret; | 3814 | int ret; |
| 3815 | 3815 | ||
| @@ -4002,11 +4002,11 @@ static int macsec_newlink(struct net *net, struct net_device *dev, · 186 unmodified lines | |||
| 4002 | struct netlink_ext_ack *extack) | 4002 | struct netlink_ext_ack *extack) |
| 4003 | { | 4003 | { |
| 4004 | struct macsec_dev *macsec = macsec_priv(dev); | 4004 | struct macsec_dev *macsec = macsec_priv(dev); |
| 4005 | rx_handler_func_t *rx_handler; | ||
| 4006 | u8 icv_len = DEFAULT_ICV_LEN; | ||
| 4005 | struct net_device *real_dev; | 4007 | struct net_device *real_dev; |
| 4006 | int err; | 4008 | int err, mtu; |
| 4007 | sci_t sci; | 4009 | sci_t sci; |
| 4008 | u8 icv_len = DEFAULT_ICV_LEN; | ||
| 4009 | rx_handler_func_t *rx_handler; | ||
| 4010 | 4010 | ||
| 4011 | if (!tb[IFLA_LINK]) | 4011 | if (!tb[IFLA_LINK]) |
| 4012 | return -EINVAL; | 4012 | return -EINVAL; |
| @@ -4033,7 +4033,11 @@ static int macsec_newlink(struct net *net, struct net_device *dev, · 20 unmodified lines | |||
| 4033 | 4033 | ||
| 4034 | if (data && data[IFLA_MACSEC_ICV_LEN]) | 4034 | if (data && data[IFLA_MACSEC_ICV_LEN]) |
| 4035 | icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]); | 4035 | icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]); |
| 4036 | dev->mtu = real_dev->mtu - icv_len - macsec_extra_len(true); | 4036 | mtu = real_dev->mtu - icv_len - macsec_extra_len(true); |
| 4037 | if (mtu < 0) | ||
| 4038 | dev->mtu = 0; | ||
| 4039 | else | ||
| 4040 | dev->mtu = mtu; | ||
| 4037 | 4041 | ||
| 4038 | rx_handler = rtnl_dereference(real_dev->rx_handler); | 4042 | rx_handler = rtnl_dereference(real_dev->rx_handler); |
| 4039 | if (rx_handler && rx_handler != macsec_handle_frame) | 4043 | if (rx_handler && rx_handler != macsec_handle_frame) |
| @@ -1704,7 +1704,7 @@ static int macvlan_device_event(struct notifier_block *unused, · 1703 unmodified lines | |||
| 1704 | struct macvlan_dev, | 1704 | struct macvlan_dev, |
| 1705 | list); | 1705 | list); |
| 1706 | 1706 | ||
| 1707 | if (macvlan_sync_address(vlan->dev, dev->dev_addr)) | 1707 | if (vlan && macvlan_sync_address(vlan->dev, dev->dev_addr)) |
| 1708 | return NOTIFY_BAD; | 1708 | return NOTIFY_BAD; |
| 1709 | 1709 | ||
| 1710 | break; | 1710 | break; |
| @@ -155,9 +155,6 @@ static int bcm84881_read_status(struct phy_device *phydev) · 154 unmodified lines | |||
| 155 | if (phydev->autoneg == AUTONEG_ENABLE && !phydev->autoneg_complete) | 155 | if (phydev->autoneg == AUTONEG_ENABLE && !phydev->autoneg_complete) |
| 156 | phydev->link = false; | 156 | phydev->link = false; |
| 157 | 157 | ||
| 158 | if (!phydev->link) | ||
| 159 | return 0; | ||
| 160 | |||
| 161 | linkmode_zero(phydev->lp_advertising); | 158 | linkmode_zero(phydev->lp_advertising); |
| 162 | phydev->speed = SPEED_UNKNOWN; | 159 | phydev->speed = SPEED_UNKNOWN; |
| 163 | phydev->duplex = DUPLEX_UNKNOWN; | 160 | phydev->duplex = DUPLEX_UNKNOWN; |
| @@ -165,6 +162,9 @@ static int bcm84881_read_status(struct phy_device *phydev) · 1 unmodified line | |||
| 165 | phydev->asym_pause = 0; | 162 | phydev->asym_pause = 0; |
| 166 | phydev->mdix = 0; | 163 | phydev->mdix = 0; |
| 167 | 164 | ||
| 165 | if (!phydev->link) | ||
| 166 | return 0; | ||
| 167 | |||
| 168 | if (phydev->autoneg_complete) { | 168 | if (phydev->autoneg_complete) { |
| 169 | val = genphy_c45_read_lpa(phydev); | 169 | val = genphy_c45_read_lpa(phydev); |
| 170 | if (val < 0) | 170 | if (val < 0) |
| @@ -1263,6 +1263,30 @@ static int marvell_read_status_page_an(struct phy_device *phydev, · 1262 unmodified lines | |||
| 1263 | int lpa; | 1263 | int lpa; |
| 1264 | int err; | 1264 | int err; |
| 1265 | 1265 | ||
| 1266 | if (!(status & MII_M1011_PHY_STATUS_RESOLVED)) { | ||
| 1267 | phydev->link = 0; | ||
| 1268 | return 0; | ||
| 1269 | } | ||
| 1270 | |||
| 1271 | if (status & MII_M1011_PHY_STATUS_FULLDUPLEX) | ||
| 1272 | phydev->duplex = DUPLEX_FULL; | ||
| 1273 | else | ||
| 1274 | phydev->duplex = DUPLEX_HALF; | ||
| 1275 | |||
| 1276 | switch (status & MII_M1011_PHY_STATUS_SPD_MASK) { | ||
| 1277 | case MII_M1011_PHY_STATUS_1000: | ||
| 1278 | phydev->speed = SPEED_1000; | ||
| 1279 | break; | ||
| 1280 | |||
| 1281 | case MII_M1011_PHY_STATUS_100: | ||
| 1282 | phydev->speed = SPEED_100; | ||
| 1283 | break; | ||
| 1284 | |||
| 1285 | default: | ||
| 1286 | phydev->speed = SPEED_10; | ||
| 1287 | break; | ||
| 1288 | } | ||
| 1289 | |||
| 1266 | if (!fiber) { | 1290 | if (!fiber) { |
| 1267 | err = genphy_read_lpa(phydev); | 1291 | err = genphy_read_lpa(phydev); |
| 1268 | if (err < 0) | 1292 | if (err < 0) |
| @@ -1291,28 +1315,6 @@ static int marvell_read_status_page_an(struct phy_device *phydev, · 22 unmodified lines | |||
| 1291 | } | 1315 | } |
| 1292 | } | 1316 | } |
| 1293 | 1317 | ||
| 1294 | if (!(status & MII_M1011_PHY_STATUS_RESOLVED)) | ||
| 1295 | return 0; | ||
| 1296 | |||
| 1297 | if (status & MII_M1011_PHY_STATUS_FULLDUPLEX) | ||
| 1298 | phydev->duplex = DUPLEX_FULL; | ||
| 1299 | else | ||
| 1300 | phydev->duplex = DUPLEX_HALF; | ||
| 1301 | |||
| 1302 | switch (status & MII_M1011_PHY_STATUS_SPD_MASK) { | ||
| 1303 | case MII_M1011_PHY_STATUS_1000: | ||
| 1304 | phydev->speed = SPEED_1000; | ||
| 1305 | break; | ||
| 1306 | |||
| 1307 | case MII_M1011_PHY_STATUS_100: | ||
| 1308 | phydev->speed = SPEED_100; | ||
| 1309 | break; | ||
| 1310 | |||
| 1311 | default: | ||
| 1312 | phydev->speed = SPEED_10; | ||
| 1313 | break; | ||
| 1314 | } | ||
| 1315 | |||
| 1316 | return 0; | 1318 | return 0; |
| 1317 | } | 1319 | } |
| 1318 | 1320 | ||
| @@ -33,6 +33,8 @@ · 32 unmodified lines | |||
| 33 | #define MV_PHY_ALASKA_NBT_QUIRK_REV (MARVELL_PHY_ID_88X3310 | 0xa) | 33 | #define MV_PHY_ALASKA_NBT_QUIRK_REV (MARVELL_PHY_ID_88X3310 | 0xa) |
| 34 | 34 | ||
| 35 | enum { | 35 | enum { |
| 36 | MV_PMA_FW_VER0 = 0xc011, | ||
| 37 | MV_PMA_FW_VER1 = 0xc012, | ||
| 36 | MV_PMA_BOOT = 0xc050, | 38 | MV_PMA_BOOT = 0xc050, |
| 37 | MV_PMA_BOOT_FATAL = BIT(0), | 39 | MV_PMA_BOOT_FATAL = BIT(0), |
| 38 | 40 | ||
| @@ -73,7 +75,8 @@ enum { · 34 unmodified lines | |||
| 73 | 75 | ||
| 74 | /* Vendor2 MMD registers */ | 76 | /* Vendor2 MMD registers */ |
| 75 | MV_V2_PORT_CTRL = 0xf001, | 77 | MV_V2_PORT_CTRL = 0xf001, |
| 76 | MV_V2_PORT_CTRL_PWRDOWN = 0x0800, | 78 | MV_V2_PORT_CTRL_SWRST = BIT(15), |
| 79 | MV_V2_PORT_CTRL_PWRDOWN = BIT(11), | ||
| 77 | MV_V2_TEMP_CTRL = 0xf08a, | 80 | MV_V2_TEMP_CTRL = 0xf08a, |
| 78 | MV_V2_TEMP_CTRL_MASK = 0xc000, | 81 | MV_V2_TEMP_CTRL_MASK = 0xc000, |
| 79 | MV_V2_TEMP_CTRL_SAMPLE = 0x0000, | 82 | MV_V2_TEMP_CTRL_SAMPLE = 0x0000, |
| @@ -83,6 +86,8 @@ enum { · 3 unmodified lines | |||
| 83 | }; | 86 | }; |
| 84 | 87 | ||
| 85 | struct mv3310_priv { | 88 | struct mv3310_priv { |
| 89 | u32 firmware_ver; | ||
| 90 | |||
| 86 | struct device *hwmon_dev; | 91 | struct device *hwmon_dev; |
| 87 | char *hwmon_name; | 92 | char *hwmon_name; |
| 88 | }; | 93 | }; |
| @@ -235,8 +240,18 @@ static int mv3310_power_down(struct phy_device *phydev) · 146 unmodified lines | |||
| 235 | 240 | ||
| 236 | static int mv3310_power_up(struct phy_device *phydev) | 241 | static int mv3310_power_up(struct phy_device *phydev) |
| 237 | { | 242 | { |
| 238 | return phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL, | 243 | struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); |
| 239 | MV_V2_PORT_CTRL_PWRDOWN); | 244 | int ret; |
| 245 | |||
| 246 | ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL, | ||
| 247 | MV_V2_PORT_CTRL_PWRDOWN); | ||
| 248 | |||
| 249 | if (phydev->drv->phy_id != MARVELL_PHY_ID_88X3310 || | ||
| 250 | priv->firmware_ver < 0x00030000) | ||
| 251 | return ret; | ||
| 252 | |||
| 253 | return phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL, | ||
| 254 | MV_V2_PORT_CTRL_SWRST); | ||
| 240 | } | 255 | } |
| 241 | 256 | ||
| 242 | static int mv3310_reset(struct phy_device *phydev, u32 unit) | 257 | static int mv3310_reset(struct phy_device *phydev, u32 unit) |
| @@ -355,6 +370,22 @@ static int mv3310_probe(struct phy_device *phydev) · 112 unmodified lines | |||
| 355 | 370 | ||
| 356 | dev_set_drvdata(&phydev->mdio.dev, priv); | 371 | dev_set_drvdata(&phydev->mdio.dev, priv); |
| 357 | 372 | ||
| 373 | ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_FW_VER0); | ||
| 374 | if (ret < 0) | ||
| 375 | return ret; | ||
| 376 | |||
| 377 | priv->firmware_ver = ret << 16; | ||
| 378 | |||
| 379 | ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_FW_VER1); | ||
| 380 | if (ret < 0) | ||
| 381 | return ret; | ||
| 382 | |||
| 383 | priv->firmware_ver |= ret; | ||
| 384 | |||
| 385 | phydev_info(phydev, "Firmware version %u.%u.%u.%u\n", | ||
| 386 | priv->firmware_ver >> 24, (priv->firmware_ver >> 16) & 255, | ||
| 387 | (priv->firmware_ver >> 8) & 255, priv->firmware_ver & 255); | ||
| 388 | |||
| 358 | /* Powering down the port when not in use saves about 600mW */ | 389 | /* Powering down the port when not in use saves about 600mW */ |
| 359 | ret = mv3310_power_down(phydev); | 390 | ret = mv3310_power_down(phydev); |
| 360 | if (ret) | 391 | if (ret) |
| @@ -464,7 +464,7 @@ static struct class mdio_bus_class = { · 463 unmodified lines | |||
| 464 | 464 | ||
| 465 | /** | 465 | /** |
| 466 | * mdio_find_bus - Given the name of a mdiobus, find the mii_bus. | 466 | * mdio_find_bus - Given the name of a mdiobus, find the mii_bus. |
| 467 | * @mdio_bus_np: Pointer to the mii_bus. | 467 | * @mdio_name: The name of a mdiobus. |
| 468 | * | 468 | * |
| 469 | * Returns a reference to the mii_bus, or NULL if none found. The | 469 | * Returns a reference to the mii_bus, or NULL if none found. The |
| 470 | * embedded struct device will have its reference count incremented, | 470 | * embedded struct device will have its reference count incremented, |
| @@ -1204,7 +1204,7 @@ static struct phy_driver ksphy_driver[] = { · 1203 unmodified lines | |||
| 1204 | .driver_data = &ksz9021_type, | 1204 | .driver_data = &ksz9021_type, |
| 1205 | .probe = kszphy_probe, | 1205 | .probe = kszphy_probe, |
| 1206 | .config_init = ksz9131_config_init, | 1206 | .config_init = ksz9131_config_init, |
| 1207 | .read_status = ksz9031_read_status, | 1207 | .read_status = genphy_read_status, |
| 1208 | .ack_interrupt = kszphy_ack_interrupt, | 1208 | .ack_interrupt = kszphy_ack_interrupt, |
| 1209 | .config_intr = kszphy_config_intr, | 1209 | .config_intr = kszphy_config_intr, |
| 1210 | .get_sset_count = kszphy_get_sset_count, | 1210 | .get_sset_count = kszphy_get_sset_count, |
| @@ -3,9 +3,21 @@ · 2 unmodified lines | |||
| 3 | 3 | ||
| 4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
| 5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
| 6 | #include <linux/delay.h> | ||
| 6 | #include <linux/mii.h> | 7 | #include <linux/mii.h> |
| 7 | #include <linux/phy.h> | 8 | #include <linux/phy.h> |
| 8 | 9 | ||
| 10 | /* External Register Control Register */ | ||
| 11 | #define LAN87XX_EXT_REG_CTL (0x14) | ||
| 12 | #define LAN87XX_EXT_REG_CTL_RD_CTL (0x1000) | ||
| 13 | #define LAN87XX_EXT_REG_CTL_WR_CTL (0x0800) | ||
| 14 | |||
| 15 | /* External Register Read Data Register */ | ||
| 16 | #define LAN87XX_EXT_REG_RD_DATA (0x15) | ||
| 17 | |||
| 18 | /* External Register Write Data Register */ | ||
| 19 | #define LAN87XX_EXT_REG_WR_DATA (0x16) | ||
| 20 | |||
| 9 | /* Interrupt Source Register */ | 21 | /* Interrupt Source Register */ |
| 10 | #define LAN87XX_INTERRUPT_SOURCE (0x18) | 22 | #define LAN87XX_INTERRUPT_SOURCE (0x18) |
| 11 | 23 | ||
| @@ -14,9 +26,160 @@ · 2 unmodified lines | |||
| 14 | #define LAN87XX_MASK_LINK_UP (0x0004) | 26 | #define LAN87XX_MASK_LINK_UP (0x0004) |
| 15 | #define LAN87XX_MASK_LINK_DOWN (0x0002) | 27 | #define LAN87XX_MASK_LINK_DOWN (0x0002) |
| 16 | 28 | ||
| 29 | /* phyaccess nested types */ | ||
| 30 | #define PHYACC_ATTR_MODE_READ 0 | ||
| 31 | #define PHYACC_ATTR_MODE_WRITE 1 | ||
| 32 | #define PHYACC_ATTR_MODE_MODIFY 2 | ||
| 33 | |||
| 34 | #define PHYACC_ATTR_BANK_SMI 0 | ||
| 35 | #define PHYACC_ATTR_BANK_MISC 1 | ||
| 36 | #define PHYACC_ATTR_BANK_PCS 2 | ||
| 37 | #define PHYACC_ATTR_BANK_AFE 3 | ||
| 38 | #define PHYACC_ATTR_BANK_MAX 7 | ||
| 39 | |||
| 17 | #define DRIVER_AUTHOR "Nisar Sayed <nisar.sayed@microchip.com>" | 40 | #define DRIVER_AUTHOR "Nisar Sayed <nisar.sayed@microchip.com>" |
| 18 | #define DRIVER_DESC "Microchip LAN87XX T1 PHY driver" | 41 | #define DRIVER_DESC "Microchip LAN87XX T1 PHY driver" |
| 19 | 42 | ||
| 43 | struct access_ereg_val { | ||
| 44 | u8 mode; | ||
| 45 | u8 bank; | ||
| 46 | u8 offset; | ||
| 47 | u16 val; | ||
| 48 | u16 mask; | ||
| 49 | }; | ||
| 50 | |||
| 51 | static int access_ereg(struct phy_device *phydev, u8 mode, u8 bank, | ||
| 52 | u8 offset, u16 val) | ||
| 53 | { | ||
| 54 | u16 ereg = 0; | ||
| 55 | int rc = 0; | ||
| 56 | |||
| 57 | if (mode > PHYACC_ATTR_MODE_WRITE || bank > PHYACC_ATTR_BANK_MAX) | ||
| 58 | return -EINVAL; | ||
| 59 | |||
| 60 | if (bank == PHYACC_ATTR_BANK_SMI) { | ||
| 61 | if (mode == PHYACC_ATTR_MODE_WRITE) | ||
| 62 | rc = phy_write(phydev, offset, val); | ||
| 63 | else | ||
| 64 | rc = phy_read(phydev, offset); | ||
| 65 | return rc; | ||
| 66 | } | ||
| 67 | |||
| 68 | if (mode == PHYACC_ATTR_MODE_WRITE) { | ||
| 69 | ereg = LAN87XX_EXT_REG_CTL_WR_CTL; | ||
| 70 | rc = phy_write(phydev, LAN87XX_EXT_REG_WR_DATA, val); | ||
| 71 | if (rc < 0) | ||
| 72 | return rc; | ||
| 73 | } else { | ||
| 74 | ereg = LAN87XX_EXT_REG_CTL_RD_CTL; | ||
| 75 | } | ||
| 76 | |||
| 77 | ereg |= (bank << 8) | offset; | ||
| 78 | |||
| 79 | rc = phy_write(phydev, LAN87XX_EXT_REG_CTL, ereg); | ||
| 80 | if (rc < 0) | ||
| 81 | return rc; | ||
| 82 | |||
| 83 | if (mode == PHYACC_ATTR_MODE_READ) | ||
| 84 | rc = phy_read(phydev, LAN87XX_EXT_REG_RD_DATA); | ||
| 85 | |||
| 86 | return rc; | ||
| 87 | } | ||
| 88 | |||
| 89 | static int access_ereg_modify_changed(struct phy_device *phydev, | ||
| 90 | u8 bank, u8 offset, u16 val, u16 mask) | ||
| 91 | { | ||
| 92 | int new = 0, rc = 0; | ||
| 93 | |||
| 94 | if (bank > PHYACC_ATTR_BANK_MAX) | ||
| 95 | return -EINVAL; | ||
| 96 | |||
| 97 | rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, bank, offset, val); | ||
| 98 | if (rc < 0) | ||
| 99 | return rc; | ||
| 100 | |||
| 101 | new = val | (rc & (mask ^ 0xFFFF)); | ||
| 102 | rc = access_ereg(phydev, PHYACC_ATTR_MODE_WRITE, bank, offset, new); | ||
| 103 | |||
| 104 | return rc; | ||
| 105 | } | ||
| 106 | |||
| 107 | static int lan87xx_phy_init(struct phy_device *phydev) | ||
| 108 | { | ||
| 109 | static const struct access_ereg_val init[] = { | ||
| 110 | /* TX Amplitude = 5 */ | ||
| 111 | {PHYACC_ATTR_MODE_MODIFY, PHYACC_ATTR_BANK_AFE, 0x0B, | ||
| 112 | 0x000A, 0x001E}, | ||
| 113 | /* Clear SMI interrupts */ | ||
| 114 | {PHYACC_ATTR_MODE_READ, PHYACC_ATTR_BANK_SMI, 0x18, | ||
| 115 | 0, 0}, | ||
| 116 | /* Clear MISC interrupts */ | ||
| 117 | {PHYACC_ATTR_MODE_READ, PHYACC_ATTR_BANK_MISC, 0x08, | ||
| 118 | 0, 0}, | ||
| 119 | /* Turn on TC10 Ring Oscillator (ROSC) */ | ||
| 120 | {PHYACC_ATTR_MODE_MODIFY, PHYACC_ATTR_BANK_MISC, 0x20, | ||
| 121 | 0x0020, 0x0020}, | ||
| 122 | /* WUR Detect Length to 1.2uS, LPC Detect Length to 1.09uS */ | ||
| 123 | {PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_PCS, 0x20, | ||
| 124 | 0x283C, 0}, | ||
| 125 | /* Wake_In Debounce Length to 39uS, Wake_Out Length to 79uS */ | ||
| 126 | {PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_MISC, 0x21, | ||
| 127 | 0x274F, 0}, | ||
| 128 | /* Enable Auto Wake Forward to Wake_Out, ROSC on, Sleep, | ||
| 129 | * and Wake_In to wake PHY | ||
| 130 | */ | ||
| 131 | {PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_MISC, 0x20, | ||
| 132 | 0x80A7, 0}, | ||
| 133 | /* Enable WUP Auto Fwd, Enable Wake on MDI, Wakeup Debouncer | ||
| 134 | * to 128 uS | ||
| 135 | */ | ||
| 136 | {PHYACC_ATTR_MODE_WRITE, PHYACC_ATTR_BANK_MISC, 0x24, | ||
| 137 | 0xF110, 0}, | ||
| 138 | /* Enable HW Init */ | ||
| 139 | {PHYACC_ATTR_MODE_MODIFY, PHYACC_ATTR_BANK_SMI, 0x1A, | ||
| 140 | 0x0100, 0x0100}, | ||
| 141 | }; | ||
| 142 | int rc, i; | ||
| 143 | |||
| 144 | /* Start manual initialization procedures in Managed Mode */ | ||
| 145 | rc = access_ereg_modify_changed(phydev, PHYACC_ATTR_BANK_SMI, | ||
| 146 | 0x1a, 0x0000, 0x0100); | ||
| 147 | if (rc < 0) | ||
| 148 | return rc; | ||
| 149 | |||
| 150 | /* Soft Reset the SMI block */ | ||
| 151 | rc = access_ereg_modify_changed(phydev, PHYACC_ATTR_BANK_SMI, | ||
| 152 | 0x00, 0x8000, 0x8000); | ||
| 153 | if (rc < 0) | ||
| 154 | return rc; | ||
| 155 | |||
| 156 | /* Check to see if the self-clearing bit is cleared */ | ||
| 157 | usleep_range(1000, 2000); | ||
| 158 | rc = access_ereg(phydev, PHYACC_ATTR_MODE_READ, | ||
| 159 | PHYACC_ATTR_BANK_SMI, 0x00, 0); | ||
| 160 | if (rc < 0) | ||
| 161 | return rc; | ||
| 162 | if ((rc & 0x8000) != 0) | ||
| 163 | return -ETIMEDOUT; | ||
| 164 | |||
| 165 | /* PHY Initialization */ | ||
| 166 | for (i = 0; i < ARRAY_SIZE(init); i++) { | ||
| 167 | if (init[i].mode == PHYACC_ATTR_MODE_MODIFY) { | ||
| 168 | rc = access_ereg_modify_changed(phydev, init[i].bank, | ||
| 169 | init[i].offset, | ||
| 170 | init[i].val, | ||
| 171 | init[i].mask); | ||
| 172 | } else { | ||
| 173 | rc = access_ereg(phydev, init[i].mode, init[i].bank, | ||
| 174 | init[i].offset, init[i].val); | ||
| 175 | } | ||
| 176 | if (rc < 0) | ||
| 177 | return rc; | ||
| 178 | } | ||
| 179 | |||
| 180 | return 0; | ||
| 181 | } | ||
| 182 | |||
| 20 | static int lan87xx_phy_config_intr(struct phy_device *phydev) | 183 | static int lan87xx_phy_config_intr(struct phy_device *phydev) |
| 21 | { | 184 | { |
| 22 | int rc, val = 0; | 185 | int rc, val = 0; |
| @@ -40,6 +203,13 @@ static int lan87xx_phy_ack_interrupt(struct phy_device *phydev) · 17 unmodified lines | |||
| 40 | return rc < 0 ? rc : 0; | 203 | return rc < 0 ? rc : 0; |
| 41 | } | 204 | } |
| 42 | 205 | ||
| 206 | static int lan87xx_config_init(struct phy_device *phydev) | ||
| 207 | { | ||
| 208 | int rc = lan87xx_phy_init(phydev); | ||
| 209 | |||
| 210 | return rc < 0 ? rc : 0; | ||
| 211 | } | ||
| 212 | |||
| 43 | static struct phy_driver microchip_t1_phy_driver[] = { | 213 | static struct phy_driver microchip_t1_phy_driver[] = { |
| 44 | { | 214 | { |
| 45 | .phy_id = 0x0007c150, | 215 | .phy_id = 0x0007c150, |
| @@ -48,6 +218,7 @@ static struct phy_driver microchip_t1_phy_driver[] = { · 2 unmodified lines | |||
| 48 | 218 | ||
| 49 | .features = PHY_BASIC_T1_FEATURES, | 219 | .features = PHY_BASIC_T1_FEATURES, |
| 50 | 220 | ||
| 221 | .config_init = lan87xx_config_init, | ||
| 51 | .config_aneg = genphy_config_aneg, | 222 | .config_aneg = genphy_config_aneg, |
| 52 | 223 | ||
| 53 | .ack_interrupt = lan87xx_phy_ack_interrupt, | 224 | .ack_interrupt = lan87xx_phy_ack_interrupt, |
| @@ -468,6 +468,9 @@ static const struct team_mode *team_mode_get(const char *kind) · 467 unmodified lines | |||
| 468 | struct team_mode_item *mitem; | 468 | struct team_mode_item *mitem; |
| 469 | const struct team_mode *mode = NULL; | 469 | const struct team_mode *mode = NULL; |
| 470 | 470 | ||
| 471 | if (!try_module_get(THIS_MODULE)) | ||
| 472 | return NULL; | ||
| 473 | |||
| 471 | spin_lock(&mode_list_lock); | 474 | spin_lock(&mode_list_lock); |
| 472 | mitem = __find_mode(kind); | 475 | mitem = __find_mode(kind); |
| 473 | if (!mitem) { | 476 | if (!mitem) { |
| @@ -483,6 +486,7 @@ static const struct team_mode *team_mode_get(const char *kind) · 9 unmodified lines | |||
| 483 | } | 486 | } |
| 484 | 487 | ||
| 485 | spin_unlock(&mode_list_lock); | 488 | spin_unlock(&mode_list_lock); |
| 489 | module_put(THIS_MODULE); | ||
| 486 | return mode; | 490 | return mode; |
| 487 | } | 491 | } |
| 488 | 492 | ||
| @@ -1888,6 +1888,7 @@ drop: · 1887 unmodified lines | |||
| 1888 | 1888 | ||
| 1889 | skb_reset_network_header(skb); | 1889 | skb_reset_network_header(skb); |
| 1890 | skb_probe_transport_header(skb); | 1890 | skb_probe_transport_header(skb); |
| 1891 | skb_record_rx_queue(skb, tfile->queue_index); | ||
| 1891 | 1892 | ||
| 1892 | if (skb_xdp) { | 1893 | if (skb_xdp) { |
| 1893 | struct bpf_prog *xdp_prog; | 1894 | struct bpf_prog *xdp_prog; |
| @@ -2459,6 +2460,7 @@ build: · 565 unmodified lines | |||
| 2459 | skb->protocol = eth_type_trans(skb, tun->dev); | 2460 | skb->protocol = eth_type_trans(skb, tun->dev); |
| 2460 | skb_reset_network_header(skb); | 2461 | skb_reset_network_header(skb); |
| 2461 | skb_probe_transport_header(skb); | 2462 | skb_probe_transport_header(skb); |
| 2463 | skb_record_rx_queue(skb, tfile->queue_index); | ||
| 2462 | 2464 | ||
| 2463 | if (skb_xdp) { | 2465 | if (skb_xdp) { |
| 2464 | err = do_xdp_generic(xdp_prog, skb); | 2466 | err = do_xdp_generic(xdp_prog, skb); |
| @@ -2470,7 +2472,6 @@ build: · 5 unmodified lines | |||
| 2470 | !tfile->detached) | 2472 | !tfile->detached) |
| 2471 | rxhash = __skb_get_hash_symmetric(skb); | 2473 | rxhash = __skb_get_hash_symmetric(skb); |
| 2472 | 2474 | ||
| 2473 | skb_record_rx_queue(skb, tfile->queue_index); | ||
| 2474 | netif_receive_skb(skb); | 2475 | netif_receive_skb(skb); |
| 2475 | 2476 | ||
| 2476 | /* No need for get_cpu_ptr() here since this function is | 2477 | /* No need for get_cpu_ptr() here since this function is |
| @@ -188,8 +188,8 @@ static netdev_tx_t vrf_process_v6_outbound(struct sk_buff *skb, · 187 unmodified lines | |||
| 188 | fl6.flowi6_proto = iph->nexthdr; | 188 | fl6.flowi6_proto = iph->nexthdr; |
| 189 | fl6.flowi6_flags = FLOWI_FLAG_SKIP_NH_OIF; | 189 | fl6.flowi6_flags = FLOWI_FLAG_SKIP_NH_OIF; |
| 190 | 190 | ||
| 191 | dst = ip6_route_output(net, NULL, &fl6); | 191 | dst = ip6_dst_lookup_flow(net, NULL, &fl6, NULL); |
| 192 | if (dst == dst_null) | 192 | if (IS_ERR(dst) || dst == dst_null) |
| 193 | goto err; | 193 | goto err; |
| 194 | 194 | ||
| 195 | skb_dst_drop(skb); | 195 | skb_dst_drop(skb); |
| @@ -474,7 +474,8 @@ static struct sk_buff *vrf_ip6_out(struct net_device *vrf_dev, · 278 unmodified lines | |||
| 474 | if (rt6_need_strict(&ipv6_hdr(skb)->daddr)) | 474 | if (rt6_need_strict(&ipv6_hdr(skb)->daddr)) |
| 475 | return skb; | 475 | return skb; |
| 476 | 476 | ||
| 477 | if (qdisc_tx_is_default(vrf_dev)) | 477 | if (qdisc_tx_is_default(vrf_dev) || |
| 478 | IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) | ||
| 478 | return vrf_ip6_out_direct(vrf_dev, sk, skb); | 479 | return vrf_ip6_out_direct(vrf_dev, sk, skb); |
| 479 | 480 | ||
| 480 | return vrf_ip6_out_redirect(vrf_dev, skb); | 481 | return vrf_ip6_out_redirect(vrf_dev, skb); |
| @@ -686,7 +687,8 @@ static struct sk_buff *vrf_ip_out(struct net_device *vrf_dev, · 205 unmodified lines | |||
| 686 | ipv4_is_lbcast(ip_hdr(skb)->daddr)) | 687 | ipv4_is_lbcast(ip_hdr(skb)->daddr)) |
| 687 | return skb; | 688 | return skb; |
| 688 | 689 | ||
| 689 | if (qdisc_tx_is_default(vrf_dev)) | 690 | if (qdisc_tx_is_default(vrf_dev) || |
| 691 | IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) | ||
| 690 | return vrf_ip_out_direct(vrf_dev, sk, skb); | 692 | return vrf_ip_out_direct(vrf_dev, sk, skb); |
| 691 | 693 | ||
| 692 | return vrf_ip_out_redirect(vrf_dev, skb); | 694 | return vrf_ip_out_redirect(vrf_dev, skb); |
| @@ -3144,7 +3144,7 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[], · 3143 unmodified lines | |||
| 3144 | u32 id = nla_get_u32(data[IFLA_VXLAN_ID]); | 3144 | u32 id = nla_get_u32(data[IFLA_VXLAN_ID]); |
| 3145 | 3145 | ||
| 3146 | if (id >= VXLAN_N_VID) { | 3146 | if (id >= VXLAN_N_VID) { |
| 3147 | NL_SET_ERR_MSG_ATTR(extack, tb[IFLA_VXLAN_ID], | 3147 | NL_SET_ERR_MSG_ATTR(extack, data[IFLA_VXLAN_ID], |
| 3148 | "VXLAN ID must be lower than 16777216"); | 3148 | "VXLAN ID must be lower than 16777216"); |
| 3149 | return -ERANGE; | 3149 | return -ERANGE; |
| 3150 | } | 3150 | } |
| @@ -3155,7 +3155,7 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[], · 4 unmodified lines | |||
| 3155 | = nla_data(data[IFLA_VXLAN_PORT_RANGE]); | 3155 | = nla_data(data[IFLA_VXLAN_PORT_RANGE]); |
| 3156 | 3156 | ||
| 3157 | if (ntohs(p->high) < ntohs(p->low)) { | 3157 | if (ntohs(p->high) < ntohs(p->low)) { |
| 3158 | NL_SET_ERR_MSG_ATTR(extack, tb[IFLA_VXLAN_PORT_RANGE], | 3158 | NL_SET_ERR_MSG_ATTR(extack, data[IFLA_VXLAN_PORT_RANGE], |
| 3159 | "Invalid source port range"); | 3159 | "Invalid source port range"); |
| 3160 | return -EINVAL; | 3160 | return -EINVAL; |
| 3161 | } | 3161 | } |
| @@ -3165,7 +3165,7 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[], · 3 unmodified lines | |||
| 3165 | enum ifla_vxlan_df df = nla_get_u8(data[IFLA_VXLAN_DF]); | 3165 | enum ifla_vxlan_df df = nla_get_u8(data[IFLA_VXLAN_DF]); |
| 3166 | 3166 | ||
| 3167 | if (df < 0 || df > VXLAN_DF_MAX) { | 3167 | if (df < 0 || df > VXLAN_DF_MAX) { |
| 3168 | NL_SET_ERR_MSG_ATTR(extack, tb[IFLA_VXLAN_DF], | 3168 | NL_SET_ERR_MSG_ATTR(extack, data[IFLA_VXLAN_DF], |
| 3169 | "Invalid DF attribute"); | 3169 | "Invalid DF attribute"); |
| 3170 | return -EINVAL; | 3170 | return -EINVAL; |
| 3171 | } | 3171 | } |
| @@ -354,6 +354,7 @@ out: · 353 unmodified lines | |||
| 354 | usb_autopm_put_interface(i2400mu->usb_iface); | 354 | usb_autopm_put_interface(i2400mu->usb_iface); |
| 355 | d_fnend(8, dev, "(i2400m %p ack %p size %zu) = %ld\n", | 355 | d_fnend(8, dev, "(i2400m %p ack %p size %zu) = %ld\n", |
| 356 | i2400m, ack, ack_size, (long) result); | 356 | i2400m, ack, ack_size, (long) result); |
| 357 | usb_put_urb(¬if_urb); | ||
| 357 | return result; | 358 | return result; |
| 358 | 359 | ||
| 359 | error_exceeded: | 360 | error_exceeded: |
| @@ -36,12 +36,13 @@ static inline int ath11k_thermal_register(struct ath11k_base *sc) · 35 unmodified lines | |||
| 36 | return 0; | 36 | return 0; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | static inline void ath11k_thermal_unregister(struct ath11k *ar) | 39 | static inline void ath11k_thermal_unregister(struct ath11k_base *sc) |
| 40 | { | 40 | { |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | static inline int ath11k_thermal_set_throttling(struct ath11k *ar, u32 throttle_state) | 43 | static inline int ath11k_thermal_set_throttling(struct ath11k *ar, u32 throttle_state) |
| 44 | { | 44 | { |
| 45 | return 0; | ||
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | static inline void ath11k_thermal_event_temperature(struct ath11k *ar, | 48 | static inline void ath11k_thermal_event_temperature(struct ath11k *ar, |
| @@ -729,9 +729,18 @@ static int brcmf_net_mon_stop(struct net_device *ndev) · 728 unmodified lines | |||
| 729 | return err; | 729 | return err; |
| 730 | } | 730 | } |
| 731 | 731 | ||
| 732 | static netdev_tx_t brcmf_net_mon_start_xmit(struct sk_buff *skb, | ||
| 733 | struct net_device *ndev) | ||
| 734 | { | ||
| 735 | dev_kfree_skb_any(skb); | ||
| 736 | |||
| 737 | return NETDEV_TX_OK; | ||
| 738 | } | ||
| 739 | |||
| 732 | static const struct net_device_ops brcmf_netdev_ops_mon = { | 740 | static const struct net_device_ops brcmf_netdev_ops_mon = { |
| 733 | .ndo_open = brcmf_net_mon_open, | 741 | .ndo_open = brcmf_net_mon_open, |
| 734 | .ndo_stop = brcmf_net_mon_stop, | 742 | .ndo_stop = brcmf_net_mon_stop, |
| 743 | .ndo_start_xmit = brcmf_net_mon_start_xmit, | ||
| 735 | }; | 744 | }; |
| 736 | 745 | ||
| 737 | int brcmf_net_mon_attach(struct brcmf_if *ifp) | 746 | int brcmf_net_mon_attach(struct brcmf_if *ifp) |
| @@ -374,7 +374,7 @@ out: · 373 unmodified lines | |||
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | static void * | 376 | static void * |
| 377 | il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) | 377 | il3945_rs_alloc(struct ieee80211_hw *hw) |
| 378 | { | 378 | { |
| 379 | return hw->priv; | 379 | return hw->priv; |
| 380 | } | 380 | } |
| @@ -2474,7 +2474,7 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, · 2473 unmodified lines | |||
| 2474 | } | 2474 | } |
| 2475 | 2475 | ||
| 2476 | static void * | 2476 | static void * |
| 2477 | il4965_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) | 2477 | il4965_rs_alloc(struct ieee80211_hw *hw) |
| 2478 | { | 2478 | { |
| 2479 | return hw->priv; | 2479 | return hw->priv; |
| 2480 | } | 2480 | } |
| @@ -3019,7 +3019,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv, · 3018 unmodified lines | |||
| 3019 | cpu_to_le16(priv->lib->bt_params->agg_time_limit); | 3019 | cpu_to_le16(priv->lib->bt_params->agg_time_limit); |
| 3020 | } | 3020 | } |
| 3021 | 3021 | ||
| 3022 | static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) | 3022 | static void *rs_alloc(struct ieee80211_hw *hw) |
| 3023 | { | 3023 | { |
| 3024 | return hw->priv; | 3024 | return hw->priv; |
| 3025 | } | 3025 | } |
| @@ -296,9 +296,14 @@ int iwl_sar_select_profile(struct iwl_fw_runtime *fwrt, · 295 unmodified lines | |||
| 296 | if (!prof->enabled) { | 296 | if (!prof->enabled) { |
| 297 | IWL_DEBUG_RADIO(fwrt, "SAR profile %d is disabled.\n", | 297 | IWL_DEBUG_RADIO(fwrt, "SAR profile %d is disabled.\n", |
| 298 | profs[i]); | 298 | profs[i]); |
| 299 | /* if one of the profiles is disabled, we fail all */ | 299 | /* |
| 300 | return -ENOENT; | 300 | * if one of the profiles is disabled, we |
| 301 | * ignore all of them and return 1 to | ||
| 302 | * differentiate disabled from other failures. | ||
| 303 | */ | ||
| 304 | return 1; | ||
| 301 | } | 305 | } |
| 306 | |||
| 302 | IWL_DEBUG_INFO(fwrt, | 307 | IWL_DEBUG_INFO(fwrt, |
| 303 | "SAR EWRD: chain %d profile index %d\n", | 308 | "SAR EWRD: chain %d profile index %d\n", |
| 304 | i, profs[i]); | 309 | i, profs[i]); |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | |||
| 8 | * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. | 8 | * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. |
| 9 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH | 9 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
| 10 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH | 10 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
| 11 | * Copyright(c) 2019 Intel Corporation | 11 | * Copyright(c) 2019 - 2020 Intel Corporation |
| 12 | * | 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify | 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of version 2 of the GNU General Public License as | 14 | * it under the terms of version 2 of the GNU General Public License as |
| @@ -31,7 +31,7 @@ · 16 unmodified lines | |||
| 31 | * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. | 31 | * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. |
| 32 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH | 32 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
| 33 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH | 33 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
| 34 | * Copyright(c) 2019 Intel Corporation | 34 | * Copyright(c) 2019 - 2020 Intel Corporation |
| 35 | * All rights reserved. | 35 | * All rights reserved. |
| 36 | * | 36 | * |
| 37 | * Redistribution and use in source and binary forms, with or without | 37 | * Redistribution and use in source and binary forms, with or without |
| @@ -99,7 +99,7 @@ enum iwl_mvm_dqa_txq { · 61 unmodified lines | |||
| 99 | IWL_MVM_DQA_MAX_MGMT_QUEUE = 8, | 99 | IWL_MVM_DQA_MAX_MGMT_QUEUE = 8, |
| 100 | IWL_MVM_DQA_AP_PROBE_RESP_QUEUE = 9, | 100 | IWL_MVM_DQA_AP_PROBE_RESP_QUEUE = 9, |
| 101 | IWL_MVM_DQA_MIN_DATA_QUEUE = 10, | 101 | IWL_MVM_DQA_MIN_DATA_QUEUE = 10, |
| 102 | IWL_MVM_DQA_MAX_DATA_QUEUE = 31, | 102 | IWL_MVM_DQA_MAX_DATA_QUEUE = 30, |
| 103 | }; | 103 | }; |
| 104 | 104 | ||
| 105 | enum iwl_mvm_tx_fifo { | 105 | enum iwl_mvm_tx_fifo { |
| @@ -1467,7 +1467,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) · 1466 unmodified lines | |||
| 1467 | kmemdup(pieces->dbg_conf_tlv[i], | 1467 | kmemdup(pieces->dbg_conf_tlv[i], |
| 1468 | pieces->dbg_conf_tlv_len[i], | 1468 | pieces->dbg_conf_tlv_len[i], |
| 1469 | GFP_KERNEL); | 1469 | GFP_KERNEL); |
| 1470 | if (!pieces->dbg_conf_tlv[i]) | 1470 | if (!drv->fw.dbg.conf_tlv[i]) |
| 1471 | goto out_free_fw; | 1471 | goto out_free_fw; |
| 1472 | } | 1472 | } |
| 1473 | } | 1473 | } |
| @@ -532,8 +532,7 @@ static struct ieee80211_sband_iftype_data iwl_he_capa[] = { · 531 unmodified lines | |||
| 532 | IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US | | 532 | IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US | |
| 533 | IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8, | 533 | IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8, |
| 534 | .mac_cap_info[2] = | 534 | .mac_cap_info[2] = |
| 535 | IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP | | 535 | IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP, |
| 536 | IEEE80211_HE_MAC_CAP2_ACK_EN, | ||
| 537 | .mac_cap_info[3] = | 536 | .mac_cap_info[3] = |
| 538 | IEEE80211_HE_MAC_CAP3_OMI_CONTROL | | 537 | IEEE80211_HE_MAC_CAP3_OMI_CONTROL | |
| 539 | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, | 538 | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, |
| @@ -617,8 +616,7 @@ static struct ieee80211_sband_iftype_data iwl_he_capa[] = { · 77 unmodified lines | |||
| 617 | IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US | | 616 | IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US | |
| 618 | IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8, | 617 | IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8, |
| 619 | .mac_cap_info[2] = | 618 | .mac_cap_info[2] = |
| 620 | IEEE80211_HE_MAC_CAP2_BSR | | 619 | IEEE80211_HE_MAC_CAP2_BSR, |
| 621 | IEEE80211_HE_MAC_CAP2_ACK_EN, | ||
| 622 | .mac_cap_info[3] = | 620 | .mac_cap_info[3] = |
| 623 | IEEE80211_HE_MAC_CAP3_OMI_CONTROL | | 621 | IEEE80211_HE_MAC_CAP3_OMI_CONTROL | |
| 624 | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, | 622 | IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, |
| @@ -727,6 +727,7 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b) · 726 unmodified lines | |||
| 727 | struct iwl_dev_tx_power_cmd_v4 v4; | 727 | struct iwl_dev_tx_power_cmd_v4 v4; |
| 728 | } cmd; | 728 | } cmd; |
| 729 | 729 | ||
| 730 | int ret; | ||
| 730 | u16 len = 0; | 731 | u16 len = 0; |
| 731 | 732 | ||
| 732 | cmd.v5.v3.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_CHAINS); | 733 | cmd.v5.v3.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_CHAINS); |
| @@ -741,9 +742,14 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b) · 8 unmodified lines | |||
| 741 | len = sizeof(cmd.v4.v3); | 742 | len = sizeof(cmd.v4.v3); |
| 742 | 743 | ||
| 743 | 744 | ||
| 744 | if (iwl_sar_select_profile(&mvm->fwrt, cmd.v5.v3.per_chain_restriction, | 745 | ret = iwl_sar_select_profile(&mvm->fwrt, |
| 745 | prof_a, prof_b)) | 746 | cmd.v5.v3.per_chain_restriction, |
| 746 | return -ENOENT; | 747 | prof_a, prof_b); |
| 748 | |||
| 749 | /* return on error or if the profile is disabled (positive number) */ | ||
| 750 | if (ret) | ||
| 751 | return ret; | ||
| 752 | |||
| 747 | IWL_DEBUG_RADIO(mvm, "Sending REDUCE_TX_POWER_CMD per chain\n"); | 753 | IWL_DEBUG_RADIO(mvm, "Sending REDUCE_TX_POWER_CMD per chain\n"); |
| 748 | return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd); | 754 | return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd); |
| 749 | } | 755 | } |
| @@ -1034,16 +1040,7 @@ static int iwl_mvm_sar_init(struct iwl_mvm *mvm) · 284 unmodified lines | |||
| 1034 | "EWRD SAR BIOS table invalid or unavailable. (%d)\n", | 1040 | "EWRD SAR BIOS table invalid or unavailable. (%d)\n", |
| 1035 | ret); | 1041 | ret); |
| 1036 | 1042 | ||
| 1037 | ret = iwl_mvm_sar_select_profile(mvm, 1, 1); | 1043 | return iwl_mvm_sar_select_profile(mvm, 1, 1); |
| 1038 | /* | ||
| 1039 | * If we don't have profile 0 from BIOS, just skip it. This | ||
| 1040 | * means that SAR Geo will not be enabled either, even if we | ||
| 1041 | * have other valid profiles. | ||
| 1042 | */ | ||
| 1043 | if (ret == -ENOENT) | ||
| 1044 | return 1; | ||
| 1045 | |||
| 1046 | return ret; | ||
| 1047 | } | 1044 | } |
| 1048 | 1045 | ||
| 1049 | static int iwl_mvm_load_rt_fw(struct iwl_mvm *mvm) | 1046 | static int iwl_mvm_load_rt_fw(struct iwl_mvm *mvm) |
| @@ -1272,7 +1269,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm) · 222 unmodified lines | |||
| 1272 | ret = iwl_mvm_sar_init(mvm); | 1269 | ret = iwl_mvm_sar_init(mvm); |
| 1273 | if (ret == 0) { | 1270 | if (ret == 0) { |
| 1274 | ret = iwl_mvm_sar_geo_init(mvm); | 1271 | ret = iwl_mvm_sar_geo_init(mvm); |
| 1275 | } else if (ret > 0 && !iwl_sar_get_wgds_table(&mvm->fwrt)) { | 1272 | } else if (ret == -ENOENT && !iwl_sar_get_wgds_table(&mvm->fwrt)) { |
| 1276 | /* | 1273 | /* |
| 1277 | * If basic SAR is not available, we check for WGDS, | 1274 | * If basic SAR is not available, we check for WGDS, |
| 1278 | * which should *not* be available either. If it is | 1275 | * which should *not* be available either. If it is |
| @@ -3665,7 +3665,7 @@ static void rs_fill_lq_cmd(struct iwl_mvm *mvm, · 3664 unmodified lines | |||
| 3665 | cpu_to_le16(iwl_mvm_coex_agg_time_limit(mvm, sta)); | 3665 | cpu_to_le16(iwl_mvm_coex_agg_time_limit(mvm, sta)); |
| 3666 | } | 3666 | } |
| 3667 | 3667 | ||
| 3668 | static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) | 3668 | static void *rs_alloc(struct ieee80211_hw *hw) |
| 3669 | { | 3669 | { |
| 3670 | return hw->priv; | 3670 | return hw->priv; |
| 3671 | } | 3671 | } |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | |||
| 8 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. | 8 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
| 9 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH | 9 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
| 10 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH | 10 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
| 11 | * Copyright(c) 2018 - 2019 Intel Corporation | 11 | * Copyright(c) 2018 - 2020 Intel Corporation |
| 12 | * | 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify | 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of version 2 of the GNU General Public License as | 14 | * it under the terms of version 2 of the GNU General Public License as |
| @@ -31,7 +31,7 @@ · 16 unmodified lines | |||
| 31 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. | 31 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
| 32 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH | 32 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
| 33 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH | 33 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
| 34 | * Copyright(c) 2018 - 2019 Intel Corporation | 34 | * Copyright(c) 2018 - 2020 Intel Corporation |
| 35 | * All rights reserved. | 35 | * All rights reserved. |
| 36 | * | 36 | * |
| 37 | * Redistribution and use in source and binary forms, with or without | 37 | * Redistribution and use in source and binary forms, with or without |
| @@ -566,6 +566,7 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, · 528 unmodified lines | |||
| 566 | 566 | ||
| 567 | struct iwl_mvm_stat_data { | 567 | struct iwl_mvm_stat_data { |
| 568 | struct iwl_mvm *mvm; | 568 | struct iwl_mvm *mvm; |
| 569 | __le32 flags; | ||
| 569 | __le32 mac_id; | 570 | __le32 mac_id; |
| 570 | u8 beacon_filter_average_energy; | 571 | u8 beacon_filter_average_energy; |
| 571 | void *general; | 572 | void *general; |
| @@ -606,6 +607,13 @@ static void iwl_mvm_stat_iterator(void *_data, u8 *mac, · 34 unmodified lines | |||
| 606 | -general->beacon_average_energy[vif_id]; | 607 | -general->beacon_average_energy[vif_id]; |
| 607 | } | 608 | } |
| 608 | 609 | ||
| 610 | /* make sure that beacon statistics don't go backwards with TCM | ||
| 611 | * request to clear statistics | ||
| 612 | */ | ||
| 613 | if (le32_to_cpu(data->flags) & IWL_STATISTICS_REPLY_FLG_CLEAR) | ||
| 614 | mvmvif->beacon_stats.accu_num_beacons += | ||
| 615 | mvmvif->beacon_stats.num_beacons; | ||
| 616 | |||
| 609 | if (mvmvif->id != id) | 617 | if (mvmvif->id != id) |
| 610 | return; | 618 | return; |
| 611 | 619 | ||
| @@ -763,6 +771,7 @@ void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm, · 151 unmodified lines | |||
| 763 | 771 | ||
| 764 | flags = stats->flag; | 772 | flags = stats->flag; |
| 765 | } | 773 | } |
| 774 | data.flags = flags; | ||
| 766 | 775 | ||
| 767 | iwl_mvm_rx_stats_check_trigger(mvm, pkt); | 776 | iwl_mvm_rx_stats_check_trigger(mvm, pkt); |
| 768 | 777 | ||
| @@ -722,6 +722,11 @@ static int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id, · 721 unmodified lines | |||
| 722 | 722 | ||
| 723 | lockdep_assert_held(&mvm->mutex); | 723 | lockdep_assert_held(&mvm->mutex); |
| 724 | 724 | ||
| 725 | if (WARN(maxq >= mvm->trans->trans_cfg->base_params->num_of_queues, | ||
| 726 | "max queue %d >= num_of_queues (%d)", maxq, | ||
| 727 | mvm->trans->trans_cfg->base_params->num_of_queues)) | ||
| 728 | maxq = mvm->trans->trans_cfg->base_params->num_of_queues - 1; | ||
| 729 | |||
| 725 | /* This should not be hit with new TX path */ | 730 | /* This should not be hit with new TX path */ |
| 726 | if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) | 731 | if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) |
| 727 | return -ENOSPC; | 732 | return -ENOSPC; |
| @@ -1164,9 +1169,9 @@ static int iwl_mvm_inactivity_check(struct iwl_mvm *mvm, u8 alloc_for_sta) · 436 unmodified lines | |||
| 1164 | inactive_tid_bitmap, | 1169 | inactive_tid_bitmap, |
| 1165 | &unshare_queues, | 1170 | &unshare_queues, |
| 1166 | &changetid_queues); | 1171 | &changetid_queues); |
| 1167 | if (ret >= 0 && free_queue < 0) { | 1172 | if (ret && free_queue < 0) { |
| 1168 | queue_owner = sta; | 1173 | queue_owner = sta; |
| 1169 | free_queue = ret; | 1174 | free_queue = i; |
| 1170 | } | 1175 | } |
| 1171 | /* only unlock sta lock - we still need the queue info lock */ | 1176 | /* only unlock sta lock - we still need the queue info lock */ |
| 1172 | spin_unlock_bh(&mvmsta->lock); | 1177 | spin_unlock_bh(&mvmsta->lock); |
| @@ -129,6 +129,18 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, · 128 unmodified lines | |||
| 129 | int cmdq_size = max_t(u32, IWL_CMD_QUEUE_SIZE, | 129 | int cmdq_size = max_t(u32, IWL_CMD_QUEUE_SIZE, |
| 130 | trans->cfg->min_txq_size); | 130 | trans->cfg->min_txq_size); |
| 131 | 131 | ||
| 132 | switch (trans_pcie->rx_buf_size) { | ||
| 133 | case IWL_AMSDU_DEF: | ||
| 134 | return -EINVAL; | ||
| 135 | case IWL_AMSDU_2K: | ||
| 136 | break; | ||
| 137 | case IWL_AMSDU_4K: | ||
| 138 | case IWL_AMSDU_8K: | ||
| 139 | case IWL_AMSDU_12K: | ||
| 140 | control_flags |= IWL_PRPH_SCRATCH_RB_SIZE_4K; | ||
| 141 | break; | ||
| 142 | } | ||
| 143 | |||
| 132 | /* Allocate prph scratch */ | 144 | /* Allocate prph scratch */ |
| 133 | prph_scratch = dma_alloc_coherent(trans->dev, sizeof(*prph_scratch), | 145 | prph_scratch = dma_alloc_coherent(trans->dev, sizeof(*prph_scratch), |
| 134 | &trans_pcie->prph_scratch_dma_addr, | 146 | &trans_pcie->prph_scratch_dma_addr, |
| @@ -143,10 +155,8 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, · 8 unmodified lines | |||
| 143 | cpu_to_le16((u16)iwl_read32(trans, CSR_HW_REV)); | 155 | cpu_to_le16((u16)iwl_read32(trans, CSR_HW_REV)); |
| 144 | prph_sc_ctrl->version.size = cpu_to_le16(sizeof(*prph_scratch) / 4); | 156 | prph_sc_ctrl->version.size = cpu_to_le16(sizeof(*prph_scratch) / 4); |
| 145 | 157 | ||
| 146 | control_flags = IWL_PRPH_SCRATCH_RB_SIZE_4K | | 158 | control_flags |= IWL_PRPH_SCRATCH_MTR_MODE; |
| 147 | IWL_PRPH_SCRATCH_MTR_MODE | | 159 | control_flags |= IWL_PRPH_MTR_FORMAT_256B & IWL_PRPH_SCRATCH_MTR_FORMAT; |
| 148 | (IWL_PRPH_MTR_FORMAT_256B & | ||
| 149 | IWL_PRPH_SCRATCH_MTR_FORMAT); | ||
| 150 | 160 | ||
| 151 | /* initialize RX default queue */ | 161 | /* initialize RX default queue */ |
| 152 | prph_sc_ctrl->rbd_cfg.free_rbd_addr = | 162 | prph_sc_ctrl->rbd_cfg.free_rbd_addr = |
| @@ -1418,6 +1418,9 @@ void iwl_trans_pcie_dyn_txq_free(struct iwl_trans *trans, int queue) · 1417 unmodified lines | |||
| 1418 | 1418 | ||
| 1419 | iwl_pcie_gen2_txq_unmap(trans, queue); | 1419 | iwl_pcie_gen2_txq_unmap(trans, queue); |
| 1420 | 1420 | ||
| 1421 | iwl_pcie_gen2_txq_free_memory(trans, trans_pcie->txq[queue]); | ||
| 1422 | trans_pcie->txq[queue] = NULL; | ||
| 1423 | |||
| 1421 | IWL_DEBUG_TX_QUEUES(trans, "Deactivate queue %d\n", queue); | 1424 | IWL_DEBUG_TX_QUEUES(trans, "Deactivate queue %d\n", queue); |
| 1422 | } | 1425 | } |
| 1423 | 1426 | ||
| @@ -3669,9 +3669,9 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info) · 3668 unmodified lines | |||
| 3669 | } | 3669 | } |
| 3670 | 3670 | ||
| 3671 | if (info->attrs[HWSIM_ATTR_RADIO_NAME]) { | 3671 | if (info->attrs[HWSIM_ATTR_RADIO_NAME]) { |
| 3672 | hwname = kasprintf(GFP_KERNEL, "%.*s", | 3672 | hwname = kstrndup((char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]), |
| 3673 | nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]), | 3673 | nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]), |
| 3674 | (char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME])); | 3674 | GFP_KERNEL); |
| 3675 | if (!hwname) | 3675 | if (!hwname) |
| 3676 | return -ENOMEM; | 3676 | return -ENOMEM; |
| 3677 | param.hwname = hwname; | 3677 | param.hwname = hwname; |
| @@ -3691,9 +3691,9 @@ static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info) · 13 unmodified lines | |||
| 3691 | if (info->attrs[HWSIM_ATTR_RADIO_ID]) { | 3691 | if (info->attrs[HWSIM_ATTR_RADIO_ID]) { |
| 3692 | idx = nla_get_u32(info->attrs[HWSIM_ATTR_RADIO_ID]); | 3692 | idx = nla_get_u32(info->attrs[HWSIM_ATTR_RADIO_ID]); |
| 3693 | } else if (info->attrs[HWSIM_ATTR_RADIO_NAME]) { | 3693 | } else if (info->attrs[HWSIM_ATTR_RADIO_NAME]) { |
| 3694 | hwname = kasprintf(GFP_KERNEL, "%.*s", | 3694 | hwname = kstrndup((char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]), |
| 3695 | nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]), | 3695 | nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]), |
| 3696 | (char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME])); | 3696 | GFP_KERNEL); |
| 3697 | if (!hwname) | 3697 | if (!hwname) |
| 3698 | return -ENOMEM; | 3698 | return -ENOMEM; |
| 3699 | } else | 3699 | } else |
| @@ -4068,7 +4068,7 @@ static void hwsim_virtio_rx_work(struct work_struct *work) · 368 unmodified lines | |||
| 4068 | } | 4068 | } |
| 4069 | vq = hwsim_vqs[HWSIM_VQ_RX]; | 4069 | vq = hwsim_vqs[HWSIM_VQ_RX]; |
| 4070 | sg_init_one(sg, skb->head, skb_end_offset(skb)); | 4070 | sg_init_one(sg, skb->head, skb_end_offset(skb)); |
| 4071 | err = virtqueue_add_inbuf(vq, sg, 1, skb, GFP_KERNEL); | 4071 | err = virtqueue_add_inbuf(vq, sg, 1, skb, GFP_ATOMIC); |
| 4072 | if (WARN(err, "virtqueue_add_inbuf returned %d\n", err)) | 4072 | if (WARN(err, "virtqueue_add_inbuf returned %d\n", err)) |
| 4073 | nlmsg_free(skb); | 4073 | nlmsg_free(skb); |
| 4074 | else | 4074 | else |
| @@ -261,7 +261,7 @@ static void rtl_rate_update(void *ppriv, · 260 unmodified lines | |||
| 261 | { | 261 | { |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | static void *rtl_rate_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) | 264 | static void *rtl_rate_alloc(struct ieee80211_hw *hw) |
| 265 | { | 265 | { |
| 266 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 266 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| 267 | return rtlpriv; | 267 | return rtlpriv; |
| @@ -1338,22 +1338,17 @@ static void rtw_pci_phy_cfg(struct rtw_dev *rtwdev) · 1337 unmodified lines | |||
| 1338 | rtw_pci_link_cfg(rtwdev); | 1338 | rtw_pci_link_cfg(rtwdev); |
| 1339 | } | 1339 | } |
| 1340 | 1340 | ||
| 1341 | #ifdef CONFIG_PM | 1341 | static int __maybe_unused rtw_pci_suspend(struct device *dev) |
| 1342 | static int rtw_pci_suspend(struct device *dev) | ||
| 1343 | { | 1342 | { |
| 1344 | return 0; | 1343 | return 0; |
| 1345 | } | 1344 | } |
| 1346 | 1345 | ||
| 1347 | static int rtw_pci_resume(struct device *dev) | 1346 | static int __maybe_unused rtw_pci_resume(struct device *dev) |
| 1348 | { | 1347 | { |
| 1349 | return 0; | 1348 | return 0; |
| 1350 | } | 1349 | } |
| 1351 | 1350 | ||
| 1352 | static SIMPLE_DEV_PM_OPS(rtw_pm_ops, rtw_pci_suspend, rtw_pci_resume); | 1351 | static SIMPLE_DEV_PM_OPS(rtw_pm_ops, rtw_pci_suspend, rtw_pci_resume); |
| 1353 | #define RTW_PM_OPS (&rtw_pm_ops) | ||
| 1354 | #else | ||
| 1355 | #define RTW_PM_OPS NULL | ||
| 1356 | #endif | ||
| 1357 | 1352 | ||
| 1358 | static int rtw_pci_claim(struct rtw_dev *rtwdev, struct pci_dev *pdev) | 1353 | static int rtw_pci_claim(struct rtw_dev *rtwdev, struct pci_dev *pdev) |
| 1359 | { | 1354 | { |
| @@ -1582,7 +1577,7 @@ static struct pci_driver rtw_pci_driver = { · 222 unmodified lines | |||
| 1582 | .id_table = rtw_pci_id_table, | 1577 | .id_table = rtw_pci_id_table, |
| 1583 | .probe = rtw_pci_probe, | 1578 | .probe = rtw_pci_probe, |
| 1584 | .remove = rtw_pci_remove, | 1579 | .remove = rtw_pci_remove, |
| 1585 | .driver.pm = RTW_PM_OPS, | 1580 | .driver.pm = &rtw_pm_ops, |
| 1586 | }; | 1581 | }; |
| 1587 | module_pci_driver(rtw_pci_driver); | 1582 | module_pci_driver(rtw_pci_driver); |
| 1588 | 1583 | ||
| @@ -261,6 +261,8 @@ static struct property *dup_and_fixup_symbol_prop( · 260 unmodified lines | |||
| 261 | 261 | ||
| 262 | of_property_set_flag(new_prop, OF_DYNAMIC); | 262 | of_property_set_flag(new_prop, OF_DYNAMIC); |
| 263 | 263 | ||
| 264 | kfree(target_path); | ||
| 265 | |||
| 264 | return new_prop; | 266 | return new_prop; |
| 265 | 267 | ||
| 266 | err_free_new_prop: | 268 | err_free_new_prop: |
| @@ -3,22 +3,37 @@ · 2 unmodified lines | |||
| 3 | /plugin/; | 3 | /plugin/; |
| 4 | 4 | ||
| 5 | /* | 5 | /* |
| 6 | * &electric_1/motor-1 and &spin_ctrl_1 are the same node: | 6 | * &electric_1/motor-1/electric and &spin_ctrl_1/electric are the same node: |
| 7 | * /testcase-data-2/substation@100/motor-1 | 7 | * /testcase-data-2/substation@100/motor-1/electric |
| 8 | * | 8 | * |
| 9 | * Thus the property "rpm_avail" in each fragment will | 9 | * Thus the property "rpm_avail" in each fragment will |
| 10 | * result in an attempt to update the same property twice. | 10 | * result in an attempt to update the same property twice. |
| 11 | * This will result in an error and the overlay apply | 11 | * This will result in an error and the overlay apply |
| 12 | * will fail. | 12 | * will fail. |
| 13 | * | ||
| 14 | * The previous version of this test did not include the extra | ||
| 15 | * level of node 'electric'. That resulted in the 'rpm_avail' | ||
| 16 | * property being located in the pre-existing node 'motor-1'. | ||
| 17 | * Modifying a property results in a WARNING that a memory leak | ||
| 18 | * will occur if the overlay is removed. Since the overlay apply | ||
| 19 | * fails, the memory leak does actually occur, and kmemleak will | ||
| 20 | * further report the memory leak if CONFIG_DEBUG_KMEMLEAK is | ||
| 21 | * enabled. Adding the overlay node 'electric' avoids the | ||
| 22 | * memory leak and thus people who use kmemleak will not | ||
| 23 | * have to debug this non-problem again. | ||
| 13 | */ | 24 | */ |
| 14 | 25 | ||
| 15 | &electric_1 { | 26 | &electric_1 { |
| 16 | 27 | ||
| 17 | motor-1 { | 28 | motor-1 { |
| 18 | rpm_avail = < 100 >; | 29 | electric { |
| 30 | rpm_avail = < 100 >; | ||
| 31 | }; | ||
| 19 | }; | 32 | }; |
| 20 | }; | 33 | }; |
| 21 | 34 | ||
| 22 | &spin_ctrl_1 { | 35 | &spin_ctrl_1 { |
| 23 | rpm_avail = < 100 200 >; | 36 | electric { |
| 37 | rpm_avail = < 100 200 >; | ||
| 38 | }; | ||
| 24 | }; | 39 | }; |
| @@ -861,6 +861,10 @@ static void __init of_unittest_changeset(void) · 860 unmodified lines | |||
| 861 | unittest(!of_changeset_revert(&chgset), "revert failed\n"); | 861 | unittest(!of_changeset_revert(&chgset), "revert failed\n"); |
| 862 | 862 | ||
| 863 | of_changeset_destroy(&chgset); | 863 | of_changeset_destroy(&chgset); |
| 864 | |||
| 865 | of_node_put(n1); | ||
| 866 | of_node_put(n2); | ||
| 867 | of_node_put(n21); | ||
| 864 | #endif | 868 | #endif |
| 865 | } | 869 | } |
| 866 | 870 | ||
| @@ -1243,10 +1247,13 @@ static void __init of_unittest_platform_populate(void) · 376 unmodified lines | |||
| 1243 | 1247 | ||
| 1244 | of_platform_populate(np, match, NULL, &test_bus->dev); | 1248 | of_platform_populate(np, match, NULL, &test_bus->dev); |
| 1245 | for_each_child_of_node(np, child) { | 1249 | for_each_child_of_node(np, child) { |
| 1246 | for_each_child_of_node(child, grandchild) | 1250 | for_each_child_of_node(child, grandchild) { |
| 1247 | unittest(of_find_device_by_node(grandchild), | 1251 | pdev = of_find_device_by_node(grandchild); |
| 1252 | unittest(pdev, | ||
| 1248 | "Could not create device for node '%pOFn'\n", | 1253 | "Could not create device for node '%pOFn'\n", |
| 1249 | grandchild); | 1254 | grandchild); |
| 1255 | of_dev_put(pdev); | ||
| 1256 | } | ||
| 1250 | } | 1257 | } |
| 1251 | 1258 | ||
| 1252 | of_platform_depopulate(&test_bus->dev); | 1259 | of_platform_depopulate(&test_bus->dev); |
| @@ -3087,8 +3094,11 @@ static __init void of_unittest_overlay_high_level(void) · 1834 unmodified lines | |||
| 3087 | goto err_unlock; | 3094 | goto err_unlock; |
| 3088 | } | 3095 | } |
| 3089 | if (__of_add_property(of_symbols, new_prop)) { | 3096 | if (__of_add_property(of_symbols, new_prop)) { |
| 3097 | kfree(new_prop->name); | ||
| 3098 | kfree(new_prop->value); | ||
| 3099 | kfree(new_prop); | ||
| 3090 | /* "name" auto-generated by unflatten */ | 3100 | /* "name" auto-generated by unflatten */ |
| 3091 | if (!strcmp(new_prop->name, "name")) | 3101 | if (!strcmp(prop->name, "name")) |
| 3092 | continue; | 3102 | continue; |
| 3093 | unittest(0, "duplicate property '%s' in overlay_base node __symbols__", | 3103 | unittest(0, "duplicate property '%s' in overlay_base node __symbols__", |
| 3094 | prop->name); | 3104 | prop->name); |
| @@ -3171,21 +3181,21 @@ static __init void of_unittest_overlay_high_level(void) · 76 unmodified lines | |||
| 3171 | "OF: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/controller"); | 3181 | "OF: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/controller"); |
| 3172 | 3182 | ||
| 3173 | EXPECT_BEGIN(KERN_ERR, | 3183 | EXPECT_BEGIN(KERN_ERR, |
| 3174 | "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail"); | 3184 | "OF: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/electric"); |
| 3175 | EXPECT_BEGIN(KERN_ERR, | 3185 | EXPECT_BEGIN(KERN_ERR, |
| 3176 | "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail"); | 3186 | "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/electric/rpm_avail"); |
| 3177 | EXPECT_BEGIN(KERN_ERR, | 3187 | EXPECT_BEGIN(KERN_ERR, |
| 3178 | "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail"); | 3188 | "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/electric/name"); |
| 3179 | 3189 | ||
| 3180 | unittest(overlay_data_apply("overlay_bad_add_dup_prop", NULL), | 3190 | unittest(overlay_data_apply("overlay_bad_add_dup_prop", NULL), |
| 3181 | "Adding overlay 'overlay_bad_add_dup_prop' failed\n"); | 3191 | "Adding overlay 'overlay_bad_add_dup_prop' failed\n"); |
| 3182 | 3192 | ||
| 3183 | EXPECT_END(KERN_ERR, | 3193 | EXPECT_END(KERN_ERR, |
| 3184 | "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail"); | 3194 | "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/electric/name"); |
| 3185 | EXPECT_END(KERN_ERR, | 3195 | EXPECT_END(KERN_ERR, |
| 3186 | "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail"); | 3196 | "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/electric/rpm_avail"); |
| 3187 | EXPECT_END(KERN_ERR, | 3197 | EXPECT_END(KERN_ERR, |
| 3188 | "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail"); | 3198 | "OF: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/electric"); |
| 3189 | 3199 | ||
| 3190 | unittest(overlay_data_apply("overlay_bad_phandle", NULL), | 3200 | unittest(overlay_data_apply("overlay_bad_phandle", NULL), |
| 3191 | "Adding overlay 'overlay_bad_phandle' failed\n"); | 3201 | "Adding overlay 'overlay_bad_phandle' failed\n"); |
| @@ -819,6 +819,8 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) · 818 unmodified lines | |||
| 819 | if (unlikely(!target_freq)) { | 819 | if (unlikely(!target_freq)) { |
| 820 | if (opp_table->required_opp_tables) { | 820 | if (opp_table->required_opp_tables) { |
| 821 | ret = _set_required_opps(dev, opp_table, NULL); | 821 | ret = _set_required_opps(dev, opp_table, NULL); |
| 822 | } else if (!_get_opp_count(opp_table)) { | ||
| 823 | return 0; | ||
| 822 | } else { | 824 | } else { |
| 823 | dev_err(dev, "target frequency can't be 0\n"); | 825 | dev_err(dev, "target frequency can't be 0\n"); |
| 824 | ret = -EINVAL; | 826 | ret = -EINVAL; |
| @@ -849,6 +851,18 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) · 24 unmodified lines | |||
| 849 | goto put_opp_table; | 851 | goto put_opp_table; |
| 850 | } | 852 | } |
| 851 | 853 | ||
| 854 | /* | ||
| 855 | * For IO devices which require an OPP on some platforms/SoCs | ||
| 856 | * while just needing to scale the clock on some others | ||
| 857 | * we look for empty OPP tables with just a clock handle and | ||
| 858 | * scale only the clk. This makes dev_pm_opp_set_rate() | ||
| 859 | * equivalent to a clk_set_rate() | ||
| 860 | */ | ||
| 861 | if (!_get_opp_count(opp_table)) { | ||
| 862 | ret = _generic_set_opp_clk_only(dev, clk, freq); | ||
| 863 | goto put_opp_table; | ||
| 864 | } | ||
| 865 | |||
| 852 | temp_freq = old_freq; | 866 | temp_freq = old_freq; |
| 853 | old_opp = _find_freq_ceil(opp_table, &temp_freq); | 867 | old_opp = _find_freq_ceil(opp_table, &temp_freq); |
| 854 | if (IS_ERR(old_opp)) { | 868 | if (IS_ERR(old_opp)) { |
| @@ -5567,3 +5567,10 @@ static void pci_fixup_no_d0_pme(struct pci_dev *dev) · 5566 unmodified lines | |||
| 5567 | dev->pme_support &= ~(PCI_PM_CAP_PME_D0 >> PCI_PM_CAP_PME_SHIFT); | 5567 | dev->pme_support &= ~(PCI_PM_CAP_PME_D0 >> PCI_PM_CAP_PME_SHIFT); |
| 5568 | } | 5568 | } |
| 5569 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x2142, pci_fixup_no_d0_pme); | 5569 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x2142, pci_fixup_no_d0_pme); |
| 5570 | |||
| 5571 | static void apex_pci_fixup_class(struct pci_dev *pdev) | ||
| 5572 | { | ||
| 5573 | pdev->class = (PCI_CLASS_SYSTEM_OTHER << 8) | pdev->class; | ||
| 5574 | } | ||
| 5575 | DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a, | ||
| 5576 | PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class); | ||
| @@ -1,7 +1,8 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | config PHY_TEGRA_XUSB | 2 | config PHY_TEGRA_XUSB |
| 3 | tristate "NVIDIA Tegra XUSB pad controller driver" | 3 | tristate "NVIDIA Tegra XUSB pad controller driver" |
| 4 | depends on ARCH_TEGRA | 4 | depends on ARCH_TEGRA && USB_SUPPORT |
| 5 | select USB_COMMON | ||
| 5 | select USB_CONN_GPIO | 6 | select USB_CONN_GPIO |
| 6 | select USB_PHY | 7 | select USB_PHY |
| 7 | help | 8 | help |
| @@ -40,7 +40,7 @@ cros_sensorhub_send_sample(struct cros_ec_sensorhub *sensorhub, · 39 unmodified lines | |||
| 40 | int id = sample->sensor_id; | 40 | int id = sample->sensor_id; |
| 41 | struct iio_dev *indio_dev; | 41 | struct iio_dev *indio_dev; |
| 42 | 42 | ||
| 43 | if (id > sensorhub->sensor_num) | 43 | if (id >= sensorhub->sensor_num) |
| 44 | return -EINVAL; | 44 | return -EINVAL; |
| 45 | 45 | ||
| 46 | cb = sensorhub->push_data[id].push_data_cb; | 46 | cb = sensorhub->push_data[id].push_data_cb; |
| @@ -820,7 +820,7 @@ static void cros_ec_sensorhub_ring_handler(struct cros_ec_sensorhub *sensorhub) · 773 unmodified lines | |||
| 820 | if (fifo_info->count > sensorhub->fifo_size || | 820 | if (fifo_info->count > sensorhub->fifo_size || |
| 821 | fifo_info->size != sensorhub->fifo_size) { | 821 | fifo_info->size != sensorhub->fifo_size) { |
| 822 | dev_warn(sensorhub->dev, | 822 | dev_warn(sensorhub->dev, |
| 823 | "Mismatch EC data: count %d, size %d - expected %d", | 823 | "Mismatch EC data: count %d, size %d - expected %d\n", |
| 824 | fifo_info->count, fifo_info->size, | 824 | fifo_info->count, fifo_info->size, |
| 825 | sensorhub->fifo_size); | 825 | sensorhub->fifo_size); |
| 826 | goto error; | 826 | goto error; |
| @@ -851,14 +851,14 @@ static void cros_ec_sensorhub_ring_handler(struct cros_ec_sensorhub *sensorhub) · 24 unmodified lines | |||
| 851 | } | 851 | } |
| 852 | if (number_data > fifo_info->count - i) { | 852 | if (number_data > fifo_info->count - i) { |
| 853 | dev_warn(sensorhub->dev, | 853 | dev_warn(sensorhub->dev, |
| 854 | "Invalid EC data: too many entry received: %d, expected %d", | 854 | "Invalid EC data: too many entry received: %d, expected %d\n", |
| 855 | number_data, fifo_info->count - i); | 855 | number_data, fifo_info->count - i); |
| 856 | break; | 856 | break; |
| 857 | } | 857 | } |
| 858 | if (out + number_data > | 858 | if (out + number_data > |
| 859 | sensorhub->ring + fifo_info->count) { | 859 | sensorhub->ring + fifo_info->count) { |
| 860 | dev_warn(sensorhub->dev, | 860 | dev_warn(sensorhub->dev, |
| 861 | "Too many samples: %d (%zd data) to %d entries for expected %d entries", | 861 | "Too many samples: %d (%zd data) to %d entries for expected %d entries\n", |
| 862 | i, out - sensorhub->ring, i + number_data, | 862 | i, out - sensorhub->ring, i + number_data, |
| 863 | fifo_info->count); | 863 | fifo_info->count); |
| 864 | break; | 864 | break; |
| @@ -400,8 +400,8 @@ static int ines_hwtstamp(struct mii_timestamper *mii_ts, struct ifreq *ifr) · 399 unmodified lines | |||
| 400 | ines_write32(port, ts_stat_rx, ts_stat_rx); | 400 | ines_write32(port, ts_stat_rx, ts_stat_rx); |
| 401 | ines_write32(port, ts_stat_tx, ts_stat_tx); | 401 | ines_write32(port, ts_stat_tx, ts_stat_tx); |
| 402 | 402 | ||
| 403 | port->rxts_enabled = ts_stat_rx == TS_ENABLE ? true : false; | 403 | port->rxts_enabled = ts_stat_rx == TS_ENABLE; |
| 404 | port->txts_enabled = ts_stat_tx == TS_ENABLE ? true : false; | 404 | port->txts_enabled = ts_stat_tx == TS_ENABLE; |
| 405 | 405 | ||
| 406 | spin_unlock_irqrestore(&port->lock, flags); | 406 | spin_unlock_irqrestore(&port->lock, flags); |
| 407 | 407 | ||
| @@ -68,7 +68,7 @@ struct mtk_scp { · 67 unmodified lines | |||
| 68 | wait_queue_head_t ack_wq; | 68 | wait_queue_head_t ack_wq; |
| 69 | 69 | ||
| 70 | void __iomem *cpu_addr; | 70 | void __iomem *cpu_addr; |
| 71 | phys_addr_t phys_addr; | 71 | dma_addr_t dma_addr; |
| 72 | size_t dram_size; | 72 | size_t dram_size; |
| 73 | 73 | ||
| 74 | struct rproc_subdev *rpmsg_subdev; | 74 | struct rproc_subdev *rpmsg_subdev; |
| @@ -330,7 +330,7 @@ static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len) · 329 unmodified lines | |||
| 330 | if (offset >= 0 && (offset + len) < scp->sram_size) | 330 | if (offset >= 0 && (offset + len) < scp->sram_size) |
| 331 | return (void __force *)scp->sram_base + offset; | 331 | return (void __force *)scp->sram_base + offset; |
| 332 | } else { | 332 | } else { |
| 333 | offset = da - scp->phys_addr; | 333 | offset = da - scp->dma_addr; |
| 334 | if (offset >= 0 && (offset + len) < scp->dram_size) | 334 | if (offset >= 0 && (offset + len) < scp->dram_size) |
| 335 | return (void __force *)scp->cpu_addr + offset; | 335 | return (void __force *)scp->cpu_addr + offset; |
| 336 | } | 336 | } |
| @@ -451,7 +451,7 @@ static int scp_map_memory_region(struct mtk_scp *scp) · 114 unmodified lines | |||
| 451 | /* Reserved SCP code size */ | 451 | /* Reserved SCP code size */ |
| 452 | scp->dram_size = MAX_CODE_SIZE; | 452 | scp->dram_size = MAX_CODE_SIZE; |
| 453 | scp->cpu_addr = dma_alloc_coherent(scp->dev, scp->dram_size, | 453 | scp->cpu_addr = dma_alloc_coherent(scp->dev, scp->dram_size, |
| 454 | &scp->phys_addr, GFP_KERNEL); | 454 | &scp->dma_addr, GFP_KERNEL); |
| 455 | if (!scp->cpu_addr) | 455 | if (!scp->cpu_addr) |
| 456 | return -ENOMEM; | 456 | return -ENOMEM; |
| 457 | 457 | ||
| @@ -461,7 +461,7 @@ static int scp_map_memory_region(struct mtk_scp *scp) · 3 unmodified lines | |||
| 461 | static void scp_unmap_memory_region(struct mtk_scp *scp) | 461 | static void scp_unmap_memory_region(struct mtk_scp *scp) |
| 462 | { | 462 | { |
| 463 | dma_free_coherent(scp->dev, scp->dram_size, scp->cpu_addr, | 463 | dma_free_coherent(scp->dev, scp->dram_size, scp->cpu_addr, |
| 464 | scp->phys_addr); | 464 | scp->dma_addr); |
| 465 | of_reserved_mem_device_release(scp->dev); | 465 | of_reserved_mem_device_release(scp->dev); |
| 466 | } | 466 | } |
| 467 | 467 | ||
| @@ -367,7 +367,7 @@ unroll_pd_votes: · 366 unmodified lines | |||
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | return ret; | 369 | return ret; |
| 370 | }; | 370 | } |
| 371 | 371 | ||
| 372 | static void q6v5_pds_disable(struct q6v5 *qproc, struct device **pds, | 372 | static void q6v5_pds_disable(struct q6v5 *qproc, struct device **pds, |
| 373 | size_t pd_count) | 373 | size_t pd_count) |
| @@ -1527,7 +1527,7 @@ unroll_attach: · 1153 unmodified lines | |||
| 1527 | dev_pm_domain_detach(devs[i], false); | 1527 | dev_pm_domain_detach(devs[i], false); |
| 1528 | 1528 | ||
| 1529 | return ret; | 1529 | return ret; |
| 1530 | }; | 1530 | } |
| 1531 | 1531 | ||
| 1532 | static void q6v5_pds_detach(struct q6v5 *qproc, struct device **pds, | 1532 | static void q6v5_pds_detach(struct q6v5 *qproc, struct device **pds, |
| 1533 | size_t pd_count) | 1533 | size_t pd_count) |
| @@ -1675,7 +1675,7 @@ static int q6v5_probe(struct platform_device *pdev) · 141 unmodified lines | |||
| 1675 | ret = of_property_read_string_index(pdev->dev.of_node, "firmware-name", | 1675 | ret = of_property_read_string_index(pdev->dev.of_node, "firmware-name", |
| 1676 | 1, &qproc->hexagon_mdt_image); | 1676 | 1, &qproc->hexagon_mdt_image); |
| 1677 | if (ret < 0 && ret != -EINVAL) | 1677 | if (ret < 0 && ret != -EINVAL) |
| 1678 | return ret; | 1678 | goto free_rproc; |
| 1679 | 1679 | ||
| 1680 | platform_set_drvdata(pdev, qproc); | 1680 | platform_set_drvdata(pdev, qproc); |
| 1681 | 1681 | ||
| @@ -1766,17 +1766,23 @@ static int q6v5_probe(struct platform_device *pdev) · 84 unmodified lines | |||
| 1766 | qproc->sysmon = qcom_add_sysmon_subdev(rproc, "modem", 0x12); | 1766 | qproc->sysmon = qcom_add_sysmon_subdev(rproc, "modem", 0x12); |
| 1767 | if (IS_ERR(qproc->sysmon)) { | 1767 | if (IS_ERR(qproc->sysmon)) { |
| 1768 | ret = PTR_ERR(qproc->sysmon); | 1768 | ret = PTR_ERR(qproc->sysmon); |
| 1769 | goto detach_proxy_pds; | 1769 | goto remove_subdevs; |
| 1770 | } | 1770 | } |
| 1771 | 1771 | ||
| 1772 | ret = rproc_add(rproc); | 1772 | ret = rproc_add(rproc); |
| 1773 | if (ret) | 1773 | if (ret) |
| 1774 | goto detach_proxy_pds; | 1774 | goto remove_sysmon_subdev; |
| 1775 | 1775 | ||
| 1776 | return 0; | 1776 | return 0; |
| 1777 | 1777 | ||
| 1778 | detach_proxy_pds: | 1778 | remove_sysmon_subdev: |
| 1779 | qcom_remove_sysmon_subdev(qproc->sysmon); | ||
| 1780 | remove_subdevs: | ||
| 1779 | qcom_remove_ipa_notify_subdev(qproc->rproc, &qproc->ipa_notify_subdev); | 1781 | qcom_remove_ipa_notify_subdev(qproc->rproc, &qproc->ipa_notify_subdev); |
| 1782 | qcom_remove_ssr_subdev(rproc, &qproc->ssr_subdev); | ||
| 1783 | qcom_remove_smd_subdev(rproc, &qproc->smd_subdev); | ||
| 1784 | qcom_remove_glink_subdev(rproc, &qproc->glink_subdev); | ||
| 1785 | detach_proxy_pds: | ||
| 1780 | q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count); | 1786 | q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count); |
| 1781 | detach_active_pds: | 1787 | detach_active_pds: |
| 1782 | q6v5_pds_detach(qproc, qproc->active_pds, qproc->active_pd_count); | 1788 | q6v5_pds_detach(qproc, qproc->active_pds, qproc->active_pd_count); |
| @@ -1789,19 +1795,20 @@ free_rproc: · 6 unmodified lines | |||
| 1789 | static int q6v5_remove(struct platform_device *pdev) | 1795 | static int q6v5_remove(struct platform_device *pdev) |
| 1790 | { | 1796 | { |
| 1791 | struct q6v5 *qproc = platform_get_drvdata(pdev); | 1797 | struct q6v5 *qproc = platform_get_drvdata(pdev); |
| 1798 | struct rproc *rproc = qproc->rproc; | ||
| 1792 | 1799 | ||
| 1793 | rproc_del(qproc->rproc); | 1800 | rproc_del(rproc); |
| 1794 | 1801 | ||
| 1795 | qcom_remove_sysmon_subdev(qproc->sysmon); | 1802 | qcom_remove_sysmon_subdev(qproc->sysmon); |
| 1796 | qcom_remove_ipa_notify_subdev(qproc->rproc, &qproc->ipa_notify_subdev); | 1803 | qcom_remove_ipa_notify_subdev(rproc, &qproc->ipa_notify_subdev); |
| 1797 | qcom_remove_glink_subdev(qproc->rproc, &qproc->glink_subdev); | 1804 | qcom_remove_ssr_subdev(rproc, &qproc->ssr_subdev); |
| 1798 | qcom_remove_smd_subdev(qproc->rproc, &qproc->smd_subdev); | 1805 | qcom_remove_smd_subdev(rproc, &qproc->smd_subdev); |
| 1799 | qcom_remove_ssr_subdev(qproc->rproc, &qproc->ssr_subdev); | 1806 | qcom_remove_glink_subdev(rproc, &qproc->glink_subdev); |
| 1800 | 1807 | ||
| 1801 | q6v5_pds_detach(qproc, qproc->active_pds, qproc->active_pd_count); | ||
| 1802 | q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count); | 1808 | q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count); |
| 1809 | q6v5_pds_detach(qproc, qproc->active_pds, qproc->active_pd_count); | ||
| 1803 | 1810 | ||
| 1804 | rproc_free(qproc->rproc); | 1811 | rproc_free(rproc); |
| 1805 | 1812 | ||
| 1806 | return 0; | 1813 | return 0; |
| 1807 | } | 1814 | } |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | |||
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #include <linux/remoteproc.h> | 6 | #include <linux/remoteproc.h> |
| 7 | #include <linux/slab.h> | ||
| 7 | 8 | ||
| 8 | #include "remoteproc_internal.h" | 9 | #include "remoteproc_internal.h" |
| 9 | 10 | ||
| @@ -19,6 +19,7 @@ · 18 unmodified lines | |||
| 19 | #include <linux/regmap.h> | 19 | #include <linux/regmap.h> |
| 20 | #include <linux/remoteproc.h> | 20 | #include <linux/remoteproc.h> |
| 21 | #include <linux/reset.h> | 21 | #include <linux/reset.h> |
| 22 | #include <linux/slab.h> | ||
| 22 | #include <linux/workqueue.h> | 23 | #include <linux/workqueue.h> |
| 23 | 24 | ||
| 24 | #include "remoteproc_internal.h" | 25 | #include "remoteproc_internal.h" |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | |||
| 8 | #include <linux/platform_device.h> | 8 | #include <linux/platform_device.h> |
| 9 | #include <linux/remoteproc.h> | 9 | #include <linux/remoteproc.h> |
| 10 | #include <linux/rpmsg/mtk_rpmsg.h> | 10 | #include <linux/rpmsg/mtk_rpmsg.h> |
| 11 | #include <linux/slab.h> | ||
| 11 | #include <linux/workqueue.h> | 12 | #include <linux/workqueue.h> |
| 12 | 13 | ||
| 13 | #include "rpmsg_internal.h" | 14 | #include "rpmsg_internal.h" |
| @@ -26,7 +26,6 @@ config DASD · 25 unmodified lines | |||
| 26 | def_tristate y | 26 | def_tristate y |
| 27 | prompt "Support for DASD devices" | 27 | prompt "Support for DASD devices" |
| 28 | depends on CCW && BLOCK | 28 | depends on CCW && BLOCK |
| 29 | select IOSCHED_DEADLINE | ||
| 30 | help | 29 | help |
| 31 | Enable this option if you want to access DASDs directly utilizing | 30 | Enable this option if you want to access DASDs directly utilizing |
| 32 | S/390s channel subsystem commands. This is necessary for running | 31 | S/390s channel subsystem commands. This is necessary for running |
| @@ -127,7 +127,7 @@ config CHR_DEV_SG · 126 unmodified lines | |||
| 127 | 127 | ||
| 128 | For scanners, look at SANE (<http://www.sane-project.org/>). For CD | 128 | For scanners, look at SANE (<http://www.sane-project.org/>). For CD |
| 129 | writer software look at Cdrtools | 129 | writer software look at Cdrtools |
| 130 | (<http://cdrecord.berlios.de/private/cdrecord.html>) | 130 | (<http://cdrtools.sourceforge.net/>) |
| 131 | and for burning a "disk at once": CDRDAO | 131 | and for burning a "disk at once": CDRDAO |
| 132 | (<http://cdrdao.sourceforge.net/>). Cdparanoia is a high | 132 | (<http://cdrdao.sourceforge.net/>). Cdparanoia is a high |
| 133 | quality digital reader of audio CDs (<http://www.xiph.org/paranoia/>). | 133 | quality digital reader of audio CDs (<http://www.xiph.org/paranoia/>). |
| @@ -6,6 +6,7 @@ config SCSI_HISI_SAS · 5 unmodified lines | |||
| 6 | select SCSI_SAS_LIBSAS | 6 | select SCSI_SAS_LIBSAS |
| 7 | select BLK_DEV_INTEGRITY | 7 | select BLK_DEV_INTEGRITY |
| 8 | depends on ATA | 8 | depends on ATA |
| 9 | select SATA_HOST | ||
| 9 | help | 10 | help |
| 10 | This driver supports HiSilicon's SAS HBA, including support based | 11 | This driver supports HiSilicon's SAS HBA, including support based |
| 11 | on platform device | 12 | on platform device |
| @@ -2539,7 +2539,6 @@ ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...) · 2538 unmodified lines | |||
| 2539 | { | 2539 | { |
| 2540 | va_list va; | 2540 | va_list va; |
| 2541 | struct va_format vaf; | 2541 | struct va_format vaf; |
| 2542 | char pbuf[64]; | ||
| 2543 | 2542 | ||
| 2544 | va_start(va, fmt); | 2543 | va_start(va, fmt); |
| 2545 | 2544 | ||
| @@ -2547,6 +2546,8 @@ ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...) · 1 unmodified line | |||
| 2547 | vaf.va = &va; | 2546 | vaf.va = &va; |
| 2548 | 2547 | ||
| 2549 | if (!ql_mask_match(level)) { | 2548 | if (!ql_mask_match(level)) { |
| 2549 | char pbuf[64]; | ||
| 2550 | |||
| 2550 | if (vha != NULL) { | 2551 | if (vha != NULL) { |
| 2551 | const struct pci_dev *pdev = vha->hw->pdev; | 2552 | const struct pci_dev *pdev = vha->hw->pdev; |
| 2552 | /* <module-name> <msg-id>:<host> Message */ | 2553 | /* <module-name> <msg-id>:<host> Message */ |
| @@ -3611,8 +3611,6 @@ qla24xx_detect_sfp(scsi_qla_host_t *vha) · 3610 unmodified lines | |||
| 3611 | ha->lr_distance = LR_DISTANCE_5K; | 3611 | ha->lr_distance = LR_DISTANCE_5K; |
| 3612 | } | 3612 | } |
| 3613 | 3613 | ||
| 3614 | if (!vha->flags.init_done) | ||
| 3615 | rc = QLA_SUCCESS; | ||
| 3616 | out: | 3614 | out: |
| 3617 | ql_dbg(ql_dbg_async, vha, 0x507b, | 3615 | ql_dbg(ql_dbg_async, vha, 0x507b, |
| 3618 | "SFP detect: %s-Range SFP %s (nvr=%x ll=%x lr=%x lrd=%x).\n", | 3616 | "SFP detect: %s-Range SFP %s (nvr=%x ll=%x lr=%x lrd=%x).\n", |
| @@ -87,7 +87,6 @@ qla24xx_process_abts(struct scsi_qla_host *vha, void *pkt) · 86 unmodified lines | |||
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | /* terminate exchange */ | 89 | /* terminate exchange */ |
| 90 | memset(rsp_els, 0, sizeof(*rsp_els)); | ||
| 91 | rsp_els->entry_type = ELS_IOCB_TYPE; | 90 | rsp_els->entry_type = ELS_IOCB_TYPE; |
| 92 | rsp_els->entry_count = 1; | 91 | rsp_els->entry_count = 1; |
| 93 | rsp_els->nport_handle = ~0; | 92 | rsp_els->nport_handle = ~0; |
| @@ -4894,8 +4894,6 @@ qla25xx_set_els_cmds_supported(scsi_qla_host_t *vha) · 4893 unmodified lines | |||
| 4894 | return QLA_MEMORY_ALLOC_FAILED; | 4894 | return QLA_MEMORY_ALLOC_FAILED; |
| 4895 | } | 4895 | } |
| 4896 | 4896 | ||
| 4897 | memset(els_cmd_map, 0, ELS_CMD_MAP_SIZE); | ||
| 4898 | |||
| 4899 | els_cmd_map[index] |= 1 << bit; | 4897 | els_cmd_map[index] |= 1 << bit; |
| 4900 | 4898 | ||
| 4901 | mcp->mb[0] = MBC_SET_RNID_PARAMS; | 4899 | mcp->mb[0] = MBC_SET_RNID_PARAMS; |
| @@ -685,8 +685,10 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) · 684 unmodified lines | |||
| 685 | hp->flags = input_size; /* structure abuse ... */ | 685 | hp->flags = input_size; /* structure abuse ... */ |
| 686 | hp->pack_id = old_hdr.pack_id; | 686 | hp->pack_id = old_hdr.pack_id; |
| 687 | hp->usr_ptr = NULL; | 687 | hp->usr_ptr = NULL; |
| 688 | if (copy_from_user(cmnd, buf, cmd_size)) | 688 | if (copy_from_user(cmnd, buf, cmd_size)) { |
| 689 | sg_remove_request(sfp, srp); | ||
| 689 | return -EFAULT; | 690 | return -EFAULT; |
| 691 | } | ||
| 690 | /* | 692 | /* |
| 691 | * SG_DXFER_TO_FROM_DEV is functionally equivalent to SG_DXFER_FROM_DEV, | 693 | * SG_DXFER_TO_FROM_DEV is functionally equivalent to SG_DXFER_FROM_DEV, |
| 692 | * but is is possible that the app intended SG_DXFER_TO_DEV, because there | 694 | * but is is possible that the app intended SG_DXFER_TO_DEV, because there |
| @@ -793,8 +795,10 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, · 100 unmodified lines | |||
| 793 | "sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n", | 795 | "sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n", |
| 794 | (int) cmnd[0], (int) hp->cmd_len)); | 796 | (int) cmnd[0], (int) hp->cmd_len)); |
| 795 | 797 | ||
| 796 | if (hp->dxfer_len >= SZ_256M) | 798 | if (hp->dxfer_len >= SZ_256M) { |
| 799 | sg_remove_request(sfp, srp); | ||
| 797 | return -EINVAL; | 800 | return -EINVAL; |
| 801 | } | ||
| 798 | 802 | ||
| 799 | k = sg_start_req(srp, cmnd); | 803 | k = sg_start_req(srp, cmnd); |
| 800 | if (k) { | 804 | if (k) { |
| @@ -478,12 +478,18 @@ int dpaa2_io_service_enqueue_multiple_desc_fq(struct dpaa2_io *d, · 477 unmodified lines | |||
| 478 | const struct dpaa2_fd *fd, | 478 | const struct dpaa2_fd *fd, |
| 479 | int nb) | 479 | int nb) |
| 480 | { | 480 | { |
| 481 | int i; | 481 | struct qbman_eq_desc *ed; |
| 482 | struct qbman_eq_desc ed[32]; | 482 | int i, ret; |
| 483 | |||
| 484 | ed = kcalloc(sizeof(struct qbman_eq_desc), 32, GFP_KERNEL); | ||
| 485 | if (!ed) | ||
| 486 | return -ENOMEM; | ||
| 483 | 487 | ||
| 484 | d = service_select(d); | 488 | d = service_select(d); |
| 485 | if (!d) | 489 | if (!d) { |
| 486 | return -ENODEV; | 490 | ret = -ENODEV; |
| 491 | goto out; | ||
| 492 | } | ||
| 487 | 493 | ||
| 488 | for (i = 0; i < nb; i++) { | 494 | for (i = 0; i < nb; i++) { |
| 489 | qbman_eq_desc_clear(&ed[i]); | 495 | qbman_eq_desc_clear(&ed[i]); |
| @@ -491,7 +497,10 @@ int dpaa2_io_service_enqueue_multiple_desc_fq(struct dpaa2_io *d, · 1 unmodified line | |||
| 491 | qbman_eq_desc_set_fq(&ed[i], fqid[i]); | 497 | qbman_eq_desc_set_fq(&ed[i], fqid[i]); |
| 492 | } | 498 | } |
| 493 | 499 | ||
| 494 | return qbman_swp_enqueue_multiple_desc(d->swp, &ed[0], fd, nb); | 500 | ret = qbman_swp_enqueue_multiple_desc(d->swp, &ed[0], fd, nb); |
| 501 | out: | ||
| 502 | kfree(ed); | ||
| 503 | return ret; | ||
| 495 | } | 504 | } |
| 496 | EXPORT_SYMBOL(dpaa2_io_service_enqueue_multiple_desc_fq); | 505 | EXPORT_SYMBOL(dpaa2_io_service_enqueue_multiple_desc_fq); |
| 497 | 506 | ||
| @@ -753,7 +753,7 @@ int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s, · 752 unmodified lines | |||
| 753 | if (!s->eqcr.available) { | 753 | if (!s->eqcr.available) { |
| 754 | eqcr_ci = s->eqcr.ci; | 754 | eqcr_ci = s->eqcr.ci; |
| 755 | p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI_MEMBACK; | 755 | p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI_MEMBACK; |
| 756 | s->eqcr.ci = __raw_readl(p) & full_mask; | 756 | s->eqcr.ci = *p & full_mask; |
| 757 | s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size, | 757 | s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size, |
| 758 | eqcr_ci, s->eqcr.ci); | 758 | eqcr_ci, s->eqcr.ci); |
| 759 | if (!s->eqcr.available) { | 759 | if (!s->eqcr.available) { |
| @@ -823,7 +823,6 @@ int qbman_swp_enqueue_multiple_desc_direct(struct qbman_swp *s, · 63 unmodified lines | |||
| 823 | const uint32_t *cl; | 823 | const uint32_t *cl; |
| 824 | uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask; | 824 | uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask; |
| 825 | int i, num_enqueued = 0; | 825 | int i, num_enqueued = 0; |
| 826 | uint64_t addr_cena; | ||
| 827 | 826 | ||
| 828 | half_mask = (s->eqcr.pi_ci_mask>>1); | 827 | half_mask = (s->eqcr.pi_ci_mask>>1); |
| 829 | full_mask = s->eqcr.pi_ci_mask; | 828 | full_mask = s->eqcr.pi_ci_mask; |
| @@ -867,7 +866,6 @@ int qbman_swp_enqueue_multiple_desc_direct(struct qbman_swp *s, · 37 unmodified lines | |||
| 867 | 866 | ||
| 868 | /* Flush all the cacheline without load/store in between */ | 867 | /* Flush all the cacheline without load/store in between */ |
| 869 | eqcr_pi = s->eqcr.pi; | 868 | eqcr_pi = s->eqcr.pi; |
| 870 | addr_cena = (uint64_t)s->addr_cena; | ||
| 871 | for (i = 0; i < num_enqueued; i++) | 869 | for (i = 0; i < num_enqueued; i++) |
| 872 | eqcr_pi++; | 870 | eqcr_pi++; |
| 873 | s->eqcr.pi = eqcr_pi & full_mask; | 871 | s->eqcr.pi = eqcr_pi & full_mask; |
| @@ -901,7 +899,7 @@ int qbman_swp_enqueue_multiple_desc_mem_back(struct qbman_swp *s, · 27 unmodified lines | |||
| 901 | if (!s->eqcr.available) { | 899 | if (!s->eqcr.available) { |
| 902 | eqcr_ci = s->eqcr.ci; | 900 | eqcr_ci = s->eqcr.ci; |
| 903 | p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI_MEMBACK; | 901 | p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI_MEMBACK; |
| 904 | s->eqcr.ci = __raw_readl(p) & full_mask; | 902 | s->eqcr.ci = *p & full_mask; |
| 905 | s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size, | 903 | s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size, |
| 906 | eqcr_ci, s->eqcr.ci); | 904 | eqcr_ci, s->eqcr.ci); |
| 907 | if (!s->eqcr.available) | 905 | if (!s->eqcr.available) |
| @@ -21,6 +21,7 @@ config SOC_IMX8M · 20 unmodified lines | |||
| 21 | bool "i.MX8M SoC family support" | 21 | bool "i.MX8M SoC family support" |
| 22 | depends on ARCH_MXC || COMPILE_TEST | 22 | depends on ARCH_MXC || COMPILE_TEST |
| 23 | default ARCH_MXC && ARM64 | 23 | default ARCH_MXC && ARM64 |
| 24 | select SOC_BUS | ||
| 24 | help | 25 | help |
| 25 | If you say yes here you get support for the NXP i.MX8M family | 26 | If you say yes here you get support for the NXP i.MX8M family |
| 26 | support, it will provide the SoC info like SoC family, | 27 | support, it will provide the SoC info like SoC family, |
| @@ -19,7 +19,7 @@ config XILINX_VCU · 18 unmodified lines | |||
| 19 | 19 | ||
| 20 | config ZYNQMP_POWER | 20 | config ZYNQMP_POWER |
| 21 | bool "Enable Xilinx Zynq MPSoC Power Management driver" | 21 | bool "Enable Xilinx Zynq MPSoC Power Management driver" |
| 22 | depends on PM && ARCH_ZYNQMP | 22 | depends on PM && ZYNQMP_FIRMWARE |
| 23 | default y | 23 | default y |
| 24 | select MAILBOX | 24 | select MAILBOX |
| 25 | select ZYNQMP_IPI_MBOX | 25 | select ZYNQMP_IPI_MBOX |
| @@ -35,7 +35,7 @@ config ZYNQMP_POWER · 9 unmodified lines | |||
| 35 | config ZYNQMP_PM_DOMAINS | 35 | config ZYNQMP_PM_DOMAINS |
| 36 | bool "Enable Zynq MPSoC generic PM domains" | 36 | bool "Enable Zynq MPSoC generic PM domains" |
| 37 | default y | 37 | default y |
| 38 | depends on PM && ARCH_ZYNQMP && ZYNQMP_FIRMWARE | 38 | depends on PM && ZYNQMP_FIRMWARE |
| 39 | select PM_GENERIC_DOMAINS | 39 | select PM_GENERIC_DOMAINS |
| 40 | help | 40 | help |
| 41 | Say yes to enable device power management through PM domains | 41 | Say yes to enable device power management through PM domains |
| @@ -2725,8 +2725,10 @@ static int comedi_open(struct inode *inode, struct file *file) · 2724 unmodified lines | |||
| 2725 | } | 2725 | } |
| 2726 | 2726 | ||
| 2727 | cfp = kzalloc(sizeof(*cfp), GFP_KERNEL); | 2727 | cfp = kzalloc(sizeof(*cfp), GFP_KERNEL); |
| 2728 | if (!cfp) | 2728 | if (!cfp) { |
| 2729 | comedi_dev_put(dev); | ||
| 2729 | return -ENOMEM; | 2730 | return -ENOMEM; |
| 2731 | } | ||
| 2730 | 2732 | ||
| 2731 | cfp->dev = dev; | 2733 | cfp->dev = dev; |
| 2732 | 2734 | ||
| @@ -92,6 +92,7 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s, · 91 unmodified lines | |||
| 92 | int ret; | 92 | int ret; |
| 93 | 93 | ||
| 94 | for (i = 0; i < insn->n; i++) { | 94 | for (i = 0; i < insn->n; i++) { |
| 95 | /* FIXME: lo bit 0 chooses voltage output or current output */ | ||
| 95 | lo = ((data[i] & 0x0f) << 4) | (chan << 1) | 0x01; | 96 | lo = ((data[i] & 0x0f) << 4) | (chan << 1) | 0x01; |
| 96 | hi = (data[i] & 0xff0) >> 4; | 97 | hi = (data[i] & 0xff0) >> 4; |
| 97 | 98 | ||
| @@ -105,6 +106,8 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s, · 7 unmodified lines | |||
| 105 | if (ret) | 106 | if (ret) |
| 106 | return ret; | 107 | return ret; |
| 107 | 108 | ||
| 109 | outb(hi, dev->iobase + DT2815_DATA); | ||
| 110 | |||
| 108 | devpriv->ao_readback[chan] = data[i]; | 111 | devpriv->ao_readback[chan] = data[i]; |
| 109 | } | 112 | } |
| 110 | return i; | 113 | return i; |
| @@ -570,13 +570,6 @@ static const struct pci_device_id apex_pci_ids[] = { · 569 unmodified lines | |||
| 570 | { PCI_DEVICE(APEX_PCI_VENDOR_ID, APEX_PCI_DEVICE_ID) }, { 0 } | 570 | { PCI_DEVICE(APEX_PCI_VENDOR_ID, APEX_PCI_DEVICE_ID) }, { 0 } |
| 571 | }; | 571 | }; |
| 572 | 572 | ||
| 573 | static void apex_pci_fixup_class(struct pci_dev *pdev) | ||
| 574 | { | ||
| 575 | pdev->class = (PCI_CLASS_SYSTEM_OTHER << 8) | pdev->class; | ||
| 576 | } | ||
| 577 | DECLARE_PCI_FIXUP_CLASS_HEADER(APEX_PCI_VENDOR_ID, APEX_PCI_DEVICE_ID, | ||
| 578 | PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class); | ||
| 579 | |||
| 580 | static int apex_pci_probe(struct pci_dev *pci_dev, | 573 | static int apex_pci_probe(struct pci_dev *pci_dev, |
| 581 | const struct pci_device_id *id) | 574 | const struct pci_device_id *id) |
| 582 | { | 575 | { |
| @@ -228,8 +228,7 @@ int gasket_sysfs_create_entries(struct device *device, · 227 unmodified lines | |||
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | mutex_lock(&mapping->mutex); | 230 | mutex_lock(&mapping->mutex); |
| 231 | for (i = 0; strcmp(attrs[i].attr.attr.name, GASKET_ARRAY_END_MARKER); | 231 | for (i = 0; attrs[i].attr.attr.name != NULL; i++) { |
| 232 | i++) { | ||
| 233 | if (mapping->attribute_count == GASKET_SYSFS_MAX_NODES) { | 232 | if (mapping->attribute_count == GASKET_SYSFS_MAX_NODES) { |
| 234 | dev_err(device, | 233 | dev_err(device, |
| 235 | "Maximum number of sysfs nodes reached for device\n"); | 234 | "Maximum number of sysfs nodes reached for device\n"); |
| @@ -30,10 +30,6 @@ · 29 unmodified lines | |||
| 30 | */ | 30 | */ |
| 31 | #define GASKET_SYSFS_MAX_NODES 196 | 31 | #define GASKET_SYSFS_MAX_NODES 196 |
| 32 | 32 | ||
| 33 | /* End markers for sysfs struct arrays. */ | ||
| 34 | #define GASKET_ARRAY_END_TOKEN GASKET_RESERVED_ARRAY_END | ||
| 35 | #define GASKET_ARRAY_END_MARKER __stringify(GASKET_ARRAY_END_TOKEN) | ||
| 36 | |||
| 37 | /* | 33 | /* |
| 38 | * Terminator struct for a gasket_sysfs_attr array. Must be at the end of | 34 | * Terminator struct for a gasket_sysfs_attr array. Must be at the end of |
| 39 | * all gasket_sysfs_attribute arrays. | 35 | * all gasket_sysfs_attribute arrays. |
| @@ -83,9 +83,6 @@ static int vnt_set_keymode(struct ieee80211_hw *hw, u8 *mac_addr, · 82 unmodified lines | |||
| 83 | case VNT_KEY_PAIRWISE: | 83 | case VNT_KEY_PAIRWISE: |
| 84 | key_mode |= mode; | 84 | key_mode |= mode; |
| 85 | key_inx = 4; | 85 | key_inx = 4; |
| 86 | /* Don't save entry for pairwise key for station mode */ | ||
| 87 | if (priv->op_mode == NL80211_IFTYPE_STATION) | ||
| 88 | clear_bit(entry, &priv->key_entry_inuse); | ||
| 89 | break; | 86 | break; |
| 90 | default: | 87 | default: |
| 91 | return -EINVAL; | 88 | return -EINVAL; |
| @@ -109,7 +106,6 @@ static int vnt_set_keymode(struct ieee80211_hw *hw, u8 *mac_addr, · 17 unmodified lines | |||
| 109 | int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta, | 106 | int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta, |
| 110 | struct ieee80211_vif *vif, struct ieee80211_key_conf *key) | 107 | struct ieee80211_vif *vif, struct ieee80211_key_conf *key) |
| 111 | { | 108 | { |
| 112 | struct ieee80211_bss_conf *conf = &vif->bss_conf; | ||
| 113 | struct vnt_private *priv = hw->priv; | 109 | struct vnt_private *priv = hw->priv; |
| 114 | u8 *mac_addr = NULL; | 110 | u8 *mac_addr = NULL; |
| 115 | u8 key_dec_mode = 0; | 111 | u8 key_dec_mode = 0; |
| @@ -154,16 +150,12 @@ int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta, · 38 unmodified lines | |||
| 154 | return -EOPNOTSUPP; | 150 | return -EOPNOTSUPP; |
| 155 | } | 151 | } |
| 156 | 152 | ||
| 157 | if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { | 153 | if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) |
| 158 | vnt_set_keymode(hw, mac_addr, key, VNT_KEY_PAIRWISE, | 154 | vnt_set_keymode(hw, mac_addr, key, VNT_KEY_PAIRWISE, |
| 159 | key_dec_mode, true); | 155 | key_dec_mode, true); |
| 160 | } else { | 156 | else |
| 161 | vnt_set_keymode(hw, mac_addr, key, VNT_KEY_DEFAULTKEY, | 157 | vnt_set_keymode(hw, mac_addr, key, VNT_KEY_GROUP_ADDRESS, |
| 162 | key_dec_mode, true); | 158 | key_dec_mode, true); |
| 163 | 159 | ||
| 164 | vnt_set_keymode(hw, (u8 *)conf->bssid, key, | ||
| 165 | VNT_KEY_GROUP_ADDRESS, key_dec_mode, true); | ||
| 166 | } | ||
| 167 | |||
| 168 | return 0; | 160 | return 0; |
| 169 | } | 161 | } |
| @@ -625,8 +625,6 @@ static int vnt_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) · 624 unmodified lines | |||
| 625 | 625 | ||
| 626 | priv->op_mode = vif->type; | 626 | priv->op_mode = vif->type; |
| 627 | 627 | ||
| 628 | vnt_set_bss_mode(priv); | ||
| 629 | |||
| 630 | /* LED blink on TX */ | 628 | /* LED blink on TX */ |
| 631 | vnt_mac_set_led(priv, LEDSTS_STS, LEDSTS_INTER); | 629 | vnt_mac_set_led(priv, LEDSTS_STS, LEDSTS_INTER); |
| 632 | 630 | ||
| @@ -713,7 +711,6 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, · 80 unmodified lines | |||
| 713 | priv->basic_rates = conf->basic_rates; | 711 | priv->basic_rates = conf->basic_rates; |
| 714 | 712 | ||
| 715 | vnt_update_top_rates(priv); | 713 | vnt_update_top_rates(priv); |
| 716 | vnt_set_bss_mode(priv); | ||
| 717 | 714 | ||
| 718 | dev_dbg(&priv->usb->dev, "basic rates %x\n", conf->basic_rates); | 715 | dev_dbg(&priv->usb->dev, "basic rates %x\n", conf->basic_rates); |
| 719 | } | 716 | } |
| @@ -742,11 +739,14 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, · 22 unmodified lines | |||
| 742 | priv->short_slot_time = false; | 739 | priv->short_slot_time = false; |
| 743 | 740 | ||
| 744 | vnt_set_short_slot_time(priv); | 741 | vnt_set_short_slot_time(priv); |
| 745 | vnt_update_ifs(priv); | ||
| 746 | vnt_set_vga_gain_offset(priv, priv->bb_vga[0]); | 742 | vnt_set_vga_gain_offset(priv, priv->bb_vga[0]); |
| 747 | vnt_update_pre_ed_threshold(priv, false); | 743 | vnt_update_pre_ed_threshold(priv, false); |
| 748 | } | 744 | } |
| 749 | 745 | ||
| 746 | if (changed & (BSS_CHANGED_BASIC_RATES | BSS_CHANGED_ERP_PREAMBLE | | ||
| 747 | BSS_CHANGED_ERP_SLOT)) | ||
| 748 | vnt_set_bss_mode(priv); | ||
| 749 | |||
| 750 | if (changed & BSS_CHANGED_TXPOWER) | 750 | if (changed & BSS_CHANGED_TXPOWER) |
| 751 | vnt_rf_setpower(priv, priv->current_rate, | 751 | vnt_rf_setpower(priv, priv->current_rate, |
| 752 | conf->chandef.chan->hw_value); | 752 | conf->chandef.chan->hw_value); |
| @@ -770,12 +770,15 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, · 17 unmodified lines | |||
| 770 | vnt_mac_reg_bits_on(priv, MAC_REG_TFTCTL, | 770 | vnt_mac_reg_bits_on(priv, MAC_REG_TFTCTL, |
| 771 | TFTCTL_TSFCNTREN); | 771 | TFTCTL_TSFCNTREN); |
| 772 | 772 | ||
| 773 | vnt_adjust_tsf(priv, conf->beacon_rate->hw_value, | ||
| 774 | conf->sync_tsf, priv->current_tsf); | ||
| 775 | |||
| 776 | vnt_mac_set_beacon_interval(priv, conf->beacon_int); | 773 | vnt_mac_set_beacon_interval(priv, conf->beacon_int); |
| 777 | 774 | ||
| 778 | vnt_reset_next_tbtt(priv, conf->beacon_int); | 775 | vnt_reset_next_tbtt(priv, conf->beacon_int); |
| 776 | |||
| 777 | vnt_adjust_tsf(priv, conf->beacon_rate->hw_value, | ||
| 778 | conf->sync_tsf, priv->current_tsf); | ||
| 779 | |||
| 780 | vnt_update_next_tbtt(priv, | ||
| 781 | conf->sync_tsf, conf->beacon_int); | ||
| 779 | } else { | 782 | } else { |
| 780 | vnt_clear_current_tsf(priv); | 783 | vnt_clear_current_tsf(priv); |
| 781 | 784 | ||
| @@ -809,15 +812,11 @@ static void vnt_configure(struct ieee80211_hw *hw, · 27 unmodified lines | |||
| 809 | { | 812 | { |
| 810 | struct vnt_private *priv = hw->priv; | 813 | struct vnt_private *priv = hw->priv; |
| 811 | u8 rx_mode = 0; | 814 | u8 rx_mode = 0; |
| 812 | int rc; | ||
| 813 | 815 | ||
| 814 | *total_flags &= FIF_ALLMULTI | FIF_OTHER_BSS | FIF_BCN_PRBRESP_PROMISC; | 816 | *total_flags &= FIF_ALLMULTI | FIF_OTHER_BSS | FIF_BCN_PRBRESP_PROMISC; |
| 815 | 817 | ||
| 816 | rc = vnt_control_in(priv, MESSAGE_TYPE_READ, MAC_REG_RCR, | 818 | vnt_control_in(priv, MESSAGE_TYPE_READ, MAC_REG_RCR, |
| 817 | MESSAGE_REQUEST_MACREG, sizeof(u8), &rx_mode); | 819 | MESSAGE_REQUEST_MACREG, sizeof(u8), &rx_mode); |
| 818 | |||
| 819 | if (!rc) | ||
| 820 | rx_mode = RCR_MULTICAST | RCR_BROADCAST; | ||
| 821 | 820 | ||
| 822 | dev_dbg(&priv->usb->dev, "rx mode in = %x\n", rx_mode); | 821 | dev_dbg(&priv->usb->dev, "rx mode in = %x\n", rx_mode); |
| 823 | 822 | ||
| @@ -856,8 +855,12 @@ static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, · 32 unmodified lines | |||
| 856 | case SET_KEY: | 855 | case SET_KEY: |
| 857 | return vnt_set_keys(hw, sta, vif, key); | 856 | return vnt_set_keys(hw, sta, vif, key); |
| 858 | case DISABLE_KEY: | 857 | case DISABLE_KEY: |
| 859 | if (test_bit(key->hw_key_idx, &priv->key_entry_inuse)) | 858 | if (test_bit(key->hw_key_idx, &priv->key_entry_inuse)) { |
| 860 | clear_bit(key->hw_key_idx, &priv->key_entry_inuse); | 859 | clear_bit(key->hw_key_idx, &priv->key_entry_inuse); |
| 860 | |||
| 861 | vnt_mac_disable_keyentry(priv, key->hw_key_idx); | ||
| 862 | } | ||
| 863 | |||
| 861 | default: | 864 | default: |
| 862 | break; | 865 | break; |
| 863 | } | 866 | } |
| @@ -207,7 +207,8 @@ static void vnt_int_process_data(struct vnt_private *priv) · 206 unmodified lines | |||
| 207 | priv->wake_up_count = | 207 | priv->wake_up_count = |
| 208 | priv->hw->conf.listen_interval; | 208 | priv->hw->conf.listen_interval; |
| 209 | 209 | ||
| 210 | --priv->wake_up_count; | 210 | if (priv->wake_up_count) |
| 211 | --priv->wake_up_count; | ||
| 211 | 212 | ||
| 212 | /* Turn on wake up to listen next beacon */ | 213 | /* Turn on wake up to listen next beacon */ |
| 213 | if (priv->wake_up_count == 1) | 214 | if (priv->wake_up_count == 1) |
| @@ -63,7 +63,7 @@ static int fc_get_pr_transport_id( · 62 unmodified lines | |||
| 63 | * encoded TransportID. | 63 | * encoded TransportID. |
| 64 | */ | 64 | */ |
| 65 | ptr = &se_nacl->initiatorname[0]; | 65 | ptr = &se_nacl->initiatorname[0]; |
| 66 | for (i = 0; i < 24; ) { | 66 | for (i = 0; i < 23; ) { |
| 67 | if (!strncmp(&ptr[i], ":", 1)) { | 67 | if (!strncmp(&ptr[i], ":", 1)) { |
| 68 | i++; | 68 | i++; |
| 69 | continue; | 69 | continue; |
| @@ -341,7 +341,8 @@ static char *iscsi_parse_pr_out_transport_id( · 271 unmodified lines | |||
| 341 | *p = tolower(*p); | 341 | *p = tolower(*p); |
| 342 | p++; | 342 | p++; |
| 343 | } | 343 | } |
| 344 | } | 344 | } else |
| 345 | *port_nexus_ptr = NULL; | ||
| 345 | 346 | ||
| 346 | return &buf[4]; | 347 | return &buf[4]; |
| 347 | } | 348 | } |
| @@ -2073,6 +2073,7 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level) · 2072 unmodified lines | |||
| 2073 | mb->cmd_tail = 0; | 2073 | mb->cmd_tail = 0; |
| 2074 | mb->cmd_head = 0; | 2074 | mb->cmd_head = 0; |
| 2075 | tcmu_flush_dcache_range(mb, sizeof(*mb)); | 2075 | tcmu_flush_dcache_range(mb, sizeof(*mb)); |
| 2076 | clear_bit(TCMU_DEV_BIT_BROKEN, &udev->flags); | ||
| 2076 | 2077 | ||
| 2077 | del_timer(&udev->cmd_timer); | 2078 | del_timer(&udev->cmd_timer); |
| 2078 | 2079 | ||
| @@ -302,10 +302,6 @@ int hvc_instantiate(uint32_t vtermno, int index, const struct hv_ops *ops) · 301 unmodified lines | |||
| 302 | vtermnos[index] = vtermno; | 302 | vtermnos[index] = vtermno; |
| 303 | cons_ops[index] = ops; | 303 | cons_ops[index] = ops; |
| 304 | 304 | ||
| 305 | /* reserve all indices up to and including this index */ | ||
| 306 | if (last_hvc < index) | ||
| 307 | last_hvc = index; | ||
| 308 | |||
| 309 | /* check if we need to re-register the kernel console */ | 305 | /* check if we need to re-register the kernel console */ |
| 310 | hvc_check_console(index); | 306 | hvc_check_console(index); |
| 311 | 307 | ||
| @@ -960,13 +956,22 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data, · 648 unmodified lines | |||
| 960 | cons_ops[i] == hp->ops) | 956 | cons_ops[i] == hp->ops) |
| 961 | break; | 957 | break; |
| 962 | 958 | ||
| 963 | /* no matching slot, just use a counter */ | 959 | if (i >= MAX_NR_HVC_CONSOLES) { |
| 964 | if (i >= MAX_NR_HVC_CONSOLES) | 960 | |
| 965 | i = ++last_hvc; | 961 | /* find 'empty' slot for console */ |
| 962 | for (i = 0; i < MAX_NR_HVC_CONSOLES && vtermnos[i] != -1; i++) { | ||
| 963 | } | ||
| 964 | |||
| 965 | /* no matching slot, just use a counter */ | ||
| 966 | if (i == MAX_NR_HVC_CONSOLES) | ||
| 967 | i = ++last_hvc + MAX_NR_HVC_CONSOLES; | ||
| 968 | } | ||
| 966 | 969 | ||
| 967 | hp->index = i; | 970 | hp->index = i; |
| 968 | cons_ops[i] = ops; | 971 | if (i < MAX_NR_HVC_CONSOLES) { |
| 969 | vtermnos[i] = vtermno; | 972 | cons_ops[i] = ops; |
| 973 | vtermnos[i] = vtermno; | ||
| 974 | } | ||
| 970 | 975 | ||
| 971 | list_add_tail(&(hp->next), &hvc_structs); | 976 | list_add_tail(&(hp->next), &hvc_structs); |
| 972 | mutex_unlock(&hvc_structs_mutex); | 977 | mutex_unlock(&hvc_structs_mutex); |
| @@ -632,18 +632,21 @@ init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev) · 631 unmodified lines | |||
| 632 | tty_port_init(&info->port); | 632 | tty_port_init(&info->port); |
| 633 | info->port.ops = &rocket_port_ops; | 633 | info->port.ops = &rocket_port_ops; |
| 634 | info->flags &= ~ROCKET_MODE_MASK; | 634 | info->flags &= ~ROCKET_MODE_MASK; |
| 635 | switch (pc104[board][line]) { | 635 | if (board < ARRAY_SIZE(pc104) && line < ARRAY_SIZE(pc104_1)) |
| 636 | case 422: | 636 | switch (pc104[board][line]) { |
| 637 | info->flags |= ROCKET_MODE_RS422; | 637 | case 422: |
| 638 | break; | 638 | info->flags |= ROCKET_MODE_RS422; |
| 639 | case 485: | 639 | break; |
| 640 | info->flags |= ROCKET_MODE_RS485; | 640 | case 485: |
| 641 | break; | 641 | info->flags |= ROCKET_MODE_RS485; |
| 642 | case 232: | 642 | break; |
| 643 | default: | 643 | case 232: |
| 644 | default: | ||
| 645 | info->flags |= ROCKET_MODE_RS232; | ||
| 646 | break; | ||
| 647 | } | ||
| 648 | else | ||
| 644 | info->flags |= ROCKET_MODE_RS232; | 649 | info->flags |= ROCKET_MODE_RS232; |
| 645 | break; | ||
| 646 | } | ||
| 647 | 650 | ||
| 648 | info->intmask = RXF_TRIG | TXFIFO_MT | SRC_INT | DELTA_CD | DELTA_CTS | DELTA_DSR; | 651 | info->intmask = RXF_TRIG | TXFIFO_MT | SRC_INT | DELTA_CD | DELTA_CTS | DELTA_DSR; |
| 649 | if (sInitChan(ctlp, &info->channel, aiop, chan) == 0) { | 652 | if (sInitChan(ctlp, &info->channel, aiop, chan) == 0) { |
| @@ -843,8 +843,10 @@ static int bcm_uart_probe(struct platform_device *pdev) · 842 unmodified lines | |||
| 843 | if (IS_ERR(clk) && pdev->dev.of_node) | 843 | if (IS_ERR(clk) && pdev->dev.of_node) |
| 844 | clk = of_clk_get(pdev->dev.of_node, 0); | 844 | clk = of_clk_get(pdev->dev.of_node, 0); |
| 845 | 845 | ||
| 846 | if (IS_ERR(clk)) | 846 | if (IS_ERR(clk)) { |
| 847 | clk_put(clk); | ||
| 847 | return -ENODEV; | 848 | return -ENODEV; |
| 849 | } | ||
| 848 | 850 | ||
| 849 | port->iotype = UPIO_MEM; | 851 | port->iotype = UPIO_MEM; |
| 850 | port->irq = res_irq->start; | 852 | port->irq = res_irq->start; |
| @@ -680,6 +680,12 @@ static int owl_uart_probe(struct platform_device *pdev) · 679 unmodified lines | |||
| 680 | return PTR_ERR(owl_port->clk); | 680 | return PTR_ERR(owl_port->clk); |
| 681 | } | 681 | } |
| 682 | 682 | ||
| 683 | ret = clk_prepare_enable(owl_port->clk); | ||
| 684 | if (ret) { | ||
| 685 | dev_err(&pdev->dev, "could not enable clk\n"); | ||
| 686 | return ret; | ||
| 687 | } | ||
| 688 | |||
| 683 | owl_port->port.dev = &pdev->dev; | 689 | owl_port->port.dev = &pdev->dev; |
| 684 | owl_port->port.line = pdev->id; | 690 | owl_port->port.line = pdev->id; |
| 685 | owl_port->port.type = PORT_OWL; | 691 | owl_port->port.type = PORT_OWL; |
| @@ -712,6 +718,7 @@ static int owl_uart_remove(struct platform_device *pdev) · 26 unmodified lines | |||
| 712 | 718 | ||
| 713 | uart_remove_one_port(&owl_uart_driver, &owl_port->port); | 719 | uart_remove_one_port(&owl_uart_driver, &owl_port->port); |
| 714 | owl_uart_ports[pdev->id] = NULL; | 720 | owl_uart_ports[pdev->id] = NULL; |
| 721 | clk_disable_unprepare(owl_port->clk); | ||
| 715 | 722 | ||
| 716 | return 0; | 723 | return 0; |
| 717 | } | 724 | } |
| @@ -870,9 +870,16 @@ static void sci_receive_chars(struct uart_port *port) · 869 unmodified lines | |||
| 870 | tty_insert_flip_char(tport, c, TTY_NORMAL); | 870 | tty_insert_flip_char(tport, c, TTY_NORMAL); |
| 871 | } else { | 871 | } else { |
| 872 | for (i = 0; i < count; i++) { | 872 | for (i = 0; i < count; i++) { |
| 873 | char c = serial_port_in(port, SCxRDR); | 873 | char c; |
| 874 | 874 | ||
| 875 | status = serial_port_in(port, SCxSR); | 875 | if (port->type == PORT_SCIF || |
| 876 | port->type == PORT_HSCIF) { | ||
| 877 | status = serial_port_in(port, SCxSR); | ||
| 878 | c = serial_port_in(port, SCxRDR); | ||
| 879 | } else { | ||
| 880 | c = serial_port_in(port, SCxRDR); | ||
| 881 | status = serial_port_in(port, SCxSR); | ||
| 882 | } | ||
| 876 | if (uart_handle_sysrq_char(port, c)) { | 883 | if (uart_handle_sysrq_char(port, c)) { |
| 877 | count--; i--; | 884 | count--; i--; |
| 878 | continue; | 885 | continue; |
| @@ -567,6 +567,9 @@ static int hv_probe(struct platform_device *op) · 566 unmodified lines | |||
| 567 | sunserial_console_match(&sunhv_console, op->dev.of_node, | 567 | sunserial_console_match(&sunhv_console, op->dev.of_node, |
| 568 | &sunhv_reg, port->line, false); | 568 | &sunhv_reg, port->line, false); |
| 569 | 569 | ||
| 570 | /* We need to initialize lock even for non-registered console */ | ||
| 571 | spin_lock_init(&port->lock); | ||
| 572 | |||
| 570 | err = uart_add_one_port(&sunhv_reg, port); | 573 | err = uart_add_one_port(&sunhv_reg, port); |
| 571 | if (err) | 574 | if (err) |
| 572 | goto out_unregister_driver; | 575 | goto out_unregister_driver; |
| @@ -26,13 +26,15 @@ · 25 unmodified lines | |||
| 26 | 26 | ||
| 27 | #define CDNS_UART_TTY_NAME "ttyPS" | 27 | #define CDNS_UART_TTY_NAME "ttyPS" |
| 28 | #define CDNS_UART_NAME "xuartps" | 28 | #define CDNS_UART_NAME "xuartps" |
| 29 | #define CDNS_UART_MAJOR 0 /* use dynamic node allocation */ | ||
| 30 | #define CDNS_UART_MINOR 0 /* works best with devtmpfs */ | ||
| 31 | #define CDNS_UART_NR_PORTS 16 | ||
| 29 | #define CDNS_UART_FIFO_SIZE 64 /* FIFO size */ | 32 | #define CDNS_UART_FIFO_SIZE 64 /* FIFO size */ |
| 30 | #define CDNS_UART_REGISTER_SPACE 0x1000 | 33 | #define CDNS_UART_REGISTER_SPACE 0x1000 |
| 31 | #define TX_TIMEOUT 500000 | 34 | #define TX_TIMEOUT 500000 |
| 32 | 35 | ||
| 33 | /* Rx Trigger level */ | 36 | /* Rx Trigger level */ |
| 34 | static int rx_trigger_level = 56; | 37 | static int rx_trigger_level = 56; |
| 35 | static int uartps_major; | ||
| 36 | module_param(rx_trigger_level, uint, 0444); | 38 | module_param(rx_trigger_level, uint, 0444); |
| 37 | MODULE_PARM_DESC(rx_trigger_level, "Rx trigger level, 1-63 bytes"); | 39 | MODULE_PARM_DESC(rx_trigger_level, "Rx trigger level, 1-63 bytes"); |
| 38 | 40 | ||
| @@ -188,7 +190,6 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255"); · 149 unmodified lines | |||
| 188 | * @pclk: APB clock | 190 | * @pclk: APB clock |
| 189 | * @cdns_uart_driver: Pointer to UART driver | 191 | * @cdns_uart_driver: Pointer to UART driver |
| 190 | * @baud: Current baud rate | 192 | * @baud: Current baud rate |
| 191 | * @id: Port ID | ||
| 192 | * @clk_rate_change_nb: Notifier block for clock changes | 193 | * @clk_rate_change_nb: Notifier block for clock changes |
| 193 | * @quirks: Flags for RXBS support. | 194 | * @quirks: Flags for RXBS support. |
| 194 | */ | 195 | */ |
| @@ -198,7 +199,6 @@ struct cdns_uart { · 3 unmodified lines | |||
| 198 | struct clk *pclk; | 199 | struct clk *pclk; |
| 199 | struct uart_driver *cdns_uart_driver; | 200 | struct uart_driver *cdns_uart_driver; |
| 200 | unsigned int baud; | 201 | unsigned int baud; |
| 201 | int id; | ||
| 202 | struct notifier_block clk_rate_change_nb; | 202 | struct notifier_block clk_rate_change_nb; |
| 203 | u32 quirks; | 203 | u32 quirks; |
| 204 | bool cts_override; | 204 | bool cts_override; |
| @@ -1133,6 +1133,8 @@ static const struct uart_ops cdns_uart_ops = { · 928 unmodified lines | |||
| 1133 | #endif | 1133 | #endif |
| 1134 | }; | 1134 | }; |
| 1135 | 1135 | ||
| 1136 | static struct uart_driver cdns_uart_uart_driver; | ||
| 1137 | |||
| 1136 | #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE | 1138 | #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE |
| 1137 | /** | 1139 | /** |
| 1138 | * cdns_uart_console_putchar - write the character to the FIFO buffer | 1140 | * cdns_uart_console_putchar - write the character to the FIFO buffer |
| @@ -1272,6 +1274,16 @@ static int cdns_uart_console_setup(struct console *co, char *options) · 133 unmodified lines | |||
| 1272 | 1274 | ||
| 1273 | return uart_set_options(port, co, baud, parity, bits, flow); | 1275 | return uart_set_options(port, co, baud, parity, bits, flow); |
| 1274 | } | 1276 | } |
| 1277 | |||
| 1278 | static struct console cdns_uart_console = { | ||
| 1279 | .name = CDNS_UART_TTY_NAME, | ||
| 1280 | .write = cdns_uart_console_write, | ||
| 1281 | .device = uart_console_device, | ||
| 1282 | .setup = cdns_uart_console_setup, | ||
| 1283 | .flags = CON_PRINTBUFFER, | ||
| 1284 | .index = -1, /* Specified on the cmdline (e.g. console=ttyPS ) */ | ||
| 1285 | .data = &cdns_uart_uart_driver, | ||
| 1286 | }; | ||
| 1275 | #endif /* CONFIG_SERIAL_XILINX_PS_UART_CONSOLE */ | 1287 | #endif /* CONFIG_SERIAL_XILINX_PS_UART_CONSOLE */ |
| 1276 | 1288 | ||
| 1277 | #ifdef CONFIG_PM_SLEEP | 1289 | #ifdef CONFIG_PM_SLEEP |
| @@ -1403,89 +1415,8 @@ static const struct of_device_id cdns_uart_of_match[] = { · 125 unmodified lines | |||
| 1403 | }; | 1415 | }; |
| 1404 | MODULE_DEVICE_TABLE(of, cdns_uart_of_match); | 1416 | MODULE_DEVICE_TABLE(of, cdns_uart_of_match); |
| 1405 | 1417 | ||
| 1406 | /* | 1418 | /* Temporary variable for storing number of instances */ |
| 1407 | * Maximum number of instances without alias IDs but if there is alias | 1419 | static int instances; |
| 1408 | * which target "< MAX_UART_INSTANCES" range this ID can't be used. | ||
| 1409 | */ | ||
| 1410 | #define MAX_UART_INSTANCES 32 | ||
| 1411 | |||
| 1412 | /* Stores static aliases list */ | ||
| 1413 | static DECLARE_BITMAP(alias_bitmap, MAX_UART_INSTANCES); | ||
| 1414 | static int alias_bitmap_initialized; | ||
| 1415 | |||
| 1416 | /* Stores actual bitmap of allocated IDs with alias IDs together */ | ||
| 1417 | static DECLARE_BITMAP(bitmap, MAX_UART_INSTANCES); | ||
| 1418 | /* Protect bitmap operations to have unique IDs */ | ||
| 1419 | static DEFINE_MUTEX(bitmap_lock); | ||
| 1420 | |||
| 1421 | static int cdns_get_id(struct platform_device *pdev) | ||
| 1422 | { | ||
| 1423 | int id, ret; | ||
| 1424 | |||
| 1425 | mutex_lock(&bitmap_lock); | ||
| 1426 | |||
| 1427 | /* Alias list is stable that's why get alias bitmap only once */ | ||
| 1428 | if (!alias_bitmap_initialized) { | ||
| 1429 | ret = of_alias_get_alias_list(cdns_uart_of_match, "serial", | ||
| 1430 | alias_bitmap, MAX_UART_INSTANCES); | ||
| 1431 | if (ret && ret != -EOVERFLOW) { | ||
| 1432 | mutex_unlock(&bitmap_lock); | ||
| 1433 | return ret; | ||
| 1434 | } | ||
| 1435 | |||
| 1436 | alias_bitmap_initialized++; | ||
| 1437 | } | ||
| 1438 | |||
| 1439 | /* Make sure that alias ID is not taken by instance without alias */ | ||
| 1440 | bitmap_or(bitmap, bitmap, alias_bitmap, MAX_UART_INSTANCES); | ||
| 1441 | |||
| 1442 | dev_dbg(&pdev->dev, "Alias bitmap: %*pb\n", | ||
| 1443 | MAX_UART_INSTANCES, bitmap); | ||
| 1444 | |||
| 1445 | /* Look for a serialN alias */ | ||
| 1446 | id = of_alias_get_id(pdev->dev.of_node, "serial"); | ||
| 1447 | if (id < 0) { | ||
| 1448 | dev_warn(&pdev->dev, | ||
| 1449 | "No serial alias passed. Using the first free id\n"); | ||
| 1450 | |||
| 1451 | /* | ||
| 1452 | * Start with id 0 and check if there is no serial0 alias | ||
| 1453 | * which points to device which is compatible with this driver. | ||
| 1454 | * If alias exists then try next free position. | ||
| 1455 | */ | ||
| 1456 | id = 0; | ||
| 1457 | |||
| 1458 | for (;;) { | ||
| 1459 | dev_info(&pdev->dev, "Checking id %d\n", id); | ||
| 1460 | id = find_next_zero_bit(bitmap, MAX_UART_INSTANCES, id); | ||
| 1461 | |||
| 1462 | /* No free empty instance */ | ||
| 1463 | if (id == MAX_UART_INSTANCES) { | ||
| 1464 | dev_err(&pdev->dev, "No free ID\n"); | ||
| 1465 | mutex_unlock(&bitmap_lock); | ||
| 1466 | return -EINVAL; | ||
| 1467 | } | ||
| 1468 | |||
| 1469 | dev_dbg(&pdev->dev, "The empty id is %d\n", id); | ||
| 1470 | /* Check if ID is empty */ | ||
| 1471 | if (!test_and_set_bit(id, bitmap)) { | ||
| 1472 | /* Break the loop if bit is taken */ | ||
| 1473 | dev_dbg(&pdev->dev, | ||
| 1474 | "Selected ID %d allocation passed\n", | ||
| 1475 | id); | ||
| 1476 | break; | ||
| 1477 | } | ||
| 1478 | dev_dbg(&pdev->dev, | ||
| 1479 | "Selected ID %d allocation failed\n", id); | ||
| 1480 | /* if taking bit fails then try next one */ | ||
| 1481 | id++; | ||
| 1482 | } | ||
| 1483 | } | ||
| 1484 | |||
| 1485 | mutex_unlock(&bitmap_lock); | ||
| 1486 | |||
| 1487 | return id; | ||
| 1488 | } | ||
| 1489 | 1420 | ||
| 1490 | /** | 1421 | /** |
| 1491 | * cdns_uart_probe - Platform driver probe | 1422 | * cdns_uart_probe - Platform driver probe |
| @@ -1495,16 +1426,11 @@ static int cdns_get_id(struct platform_device *pdev) · 3 unmodified lines | |||
| 1495 | */ | 1426 | */ |
| 1496 | static int cdns_uart_probe(struct platform_device *pdev) | 1427 | static int cdns_uart_probe(struct platform_device *pdev) |
| 1497 | { | 1428 | { |
| 1498 | int rc, irq; | 1429 | int rc, id, irq; |
| 1499 | struct uart_port *port; | 1430 | struct uart_port *port; |
| 1500 | struct resource *res; | 1431 | struct resource *res; |
| 1501 | struct cdns_uart *cdns_uart_data; | 1432 | struct cdns_uart *cdns_uart_data; |
| 1502 | const struct of_device_id *match; | 1433 | const struct of_device_id *match; |
| 1503 | struct uart_driver *cdns_uart_uart_driver; | ||
| 1504 | char *driver_name; | ||
| 1505 | #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE | ||
| 1506 | struct console *cdns_uart_console; | ||
| 1507 | #endif | ||
| 1508 | 1434 | ||
| 1509 | cdns_uart_data = devm_kzalloc(&pdev->dev, sizeof(*cdns_uart_data), | 1435 | cdns_uart_data = devm_kzalloc(&pdev->dev, sizeof(*cdns_uart_data), |
| 1510 | GFP_KERNEL); | 1436 | GFP_KERNEL); |
| @@ -1514,64 +1440,35 @@ static int cdns_uart_probe(struct platform_device *pdev) · 3 unmodified lines | |||
| 1514 | if (!port) | 1440 | if (!port) |
| 1515 | return -ENOMEM; | 1441 | return -ENOMEM; |
| 1516 | 1442 | ||
| 1517 | cdns_uart_uart_driver = devm_kzalloc(&pdev->dev, | 1443 | /* Look for a serialN alias */ |
| 1518 | sizeof(*cdns_uart_uart_driver), | 1444 | id = of_alias_get_id(pdev->dev.of_node, "serial"); |
| 1519 | GFP_KERNEL); | 1445 | if (id < 0) |
| 1520 | if (!cdns_uart_uart_driver) | 1446 | id = 0; |
| 1521 | return -ENOMEM; | ||
| 1522 | |||
| 1523 | cdns_uart_data->id = cdns_get_id(pdev); | ||
| 1524 | if (cdns_uart_data->id < 0) | ||
| 1525 | return cdns_uart_data->id; | ||
| 1526 | 1447 | ||
| 1527 | /* There is a need to use unique driver name */ | 1448 | if (id >= CDNS_UART_NR_PORTS) { |
| 1528 | driver_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s%d", | 1449 | dev_err(&pdev->dev, "Cannot get uart_port structure\n"); |
| 1529 | CDNS_UART_NAME, cdns_uart_data->id); | 1450 | return -ENODEV; |
| 1530 | if (!driver_name) { | ||
| 1531 | rc = -ENOMEM; | ||
| 1532 | goto err_out_id; | ||
| 1533 | } | 1451 | } |
| 1534 | 1452 | ||
| 1535 | cdns_uart_uart_driver->owner = THIS_MODULE; | 1453 | if (!cdns_uart_uart_driver.state) { |
| 1536 | cdns_uart_uart_driver->driver_name = driver_name; | 1454 | cdns_uart_uart_driver.owner = THIS_MODULE; |
| 1537 | cdns_uart_uart_driver->dev_name = CDNS_UART_TTY_NAME; | 1455 | cdns_uart_uart_driver.driver_name = CDNS_UART_NAME; |
| 1538 | cdns_uart_uart_driver->major = uartps_major; | 1456 | cdns_uart_uart_driver.dev_name = CDNS_UART_TTY_NAME; |
| 1539 | cdns_uart_uart_driver->minor = cdns_uart_data->id; | 1457 | cdns_uart_uart_driver.major = CDNS_UART_MAJOR; |
| 1540 | cdns_uart_uart_driver->nr = 1; | 1458 | cdns_uart_uart_driver.minor = CDNS_UART_MINOR; |
| 1541 | 1459 | cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS; | |
| 1542 | #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE | 1460 | #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE |
| 1543 | cdns_uart_console = devm_kzalloc(&pdev->dev, sizeof(*cdns_uart_console), | 1461 | cdns_uart_uart_driver.cons = &cdns_uart_console; |
| 1544 | GFP_KERNEL); | ||
| 1545 | if (!cdns_uart_console) { | ||
| 1546 | rc = -ENOMEM; | ||
| 1547 | goto err_out_id; | ||
| 1548 | } | ||
| 1549 | |||
| 1550 | strncpy(cdns_uart_console->name, CDNS_UART_TTY_NAME, | ||
| 1551 | sizeof(cdns_uart_console->name)); | ||
| 1552 | cdns_uart_console->index = cdns_uart_data->id; | ||
| 1553 | cdns_uart_console->write = cdns_uart_console_write; | ||
| 1554 | cdns_uart_console->device = uart_console_device; | ||
| 1555 | cdns_uart_console->setup = cdns_uart_console_setup; | ||
| 1556 | cdns_uart_console->flags = CON_PRINTBUFFER; | ||
| 1557 | cdns_uart_console->data = cdns_uart_uart_driver; | ||
| 1558 | cdns_uart_uart_driver->cons = cdns_uart_console; | ||
| 1559 | #endif | 1462 | #endif |
| 1560 | 1463 | ||
| 1561 | rc = uart_register_driver(cdns_uart_uart_driver); | 1464 | rc = uart_register_driver(&cdns_uart_uart_driver); |
| 1562 | if (rc < 0) { | 1465 | if (rc < 0) { |
| 1563 | dev_err(&pdev->dev, "Failed to register driver\n"); | 1466 | dev_err(&pdev->dev, "Failed to register driver\n"); |
| 1564 | goto err_out_id; | 1467 | return rc; |
| 1468 | } | ||
| 1565 | } | 1469 | } |
| 1566 | 1470 | ||
| 1567 | cdns_uart_data->cdns_uart_driver = cdns_uart_uart_driver; | 1471 | cdns_uart_data->cdns_uart_driver = &cdns_uart_uart_driver; |
| 1568 | |||
| 1569 | /* | ||
| 1570 | * Setting up proper name_base needs to be done after uart | ||
| 1571 | * registration because tty_driver structure is not filled. | ||
| 1572 | * name_base is 0 by default. | ||
| 1573 | */ | ||
| 1574 | cdns_uart_uart_driver->tty_driver->name_base = cdns_uart_data->id; | ||
| 1575 | 1472 | ||
| 1576 | match = of_match_node(cdns_uart_of_match, pdev->dev.of_node); | 1473 | match = of_match_node(cdns_uart_of_match, pdev->dev.of_node); |
| 1577 | if (match && match->data) { | 1474 | if (match && match->data) { |
| @@ -1649,6 +1546,7 @@ static int cdns_uart_probe(struct platform_device *pdev) · 71 unmodified lines | |||
| 1649 | port->ops = &cdns_uart_ops; | 1546 | port->ops = &cdns_uart_ops; |
| 1650 | port->fifosize = CDNS_UART_FIFO_SIZE; | 1547 | port->fifosize = CDNS_UART_FIFO_SIZE; |
| 1651 | port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_XILINX_PS_UART_CONSOLE); | 1548 | port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_XILINX_PS_UART_CONSOLE); |
| 1549 | port->line = id; | ||
| 1652 | 1550 | ||
| 1653 | /* | 1551 | /* |
| 1654 | * Register the port. | 1552 | * Register the port. |
| @@ -1680,7 +1578,7 @@ static int cdns_uart_probe(struct platform_device *pdev) · 25 unmodified lines | |||
| 1680 | console_port = port; | 1578 | console_port = port; |
| 1681 | #endif | 1579 | #endif |
| 1682 | 1580 | ||
| 1683 | rc = uart_add_one_port(cdns_uart_uart_driver, port); | 1581 | rc = uart_add_one_port(&cdns_uart_uart_driver, port); |
| 1684 | if (rc) { | 1582 | if (rc) { |
| 1685 | dev_err(&pdev->dev, | 1583 | dev_err(&pdev->dev, |
| 1686 | "uart_add_one_port() failed; err=%i\n", rc); | 1584 | "uart_add_one_port() failed; err=%i\n", rc); |
| @@ -1690,13 +1588,15 @@ static int cdns_uart_probe(struct platform_device *pdev) · 3 unmodified lines | |||
| 1690 | #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE | 1588 | #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE |
| 1691 | /* This is not port which is used for console that's why clean it up */ | 1589 | /* This is not port which is used for console that's why clean it up */ |
| 1692 | if (console_port == port && | 1590 | if (console_port == port && |
| 1693 | !(cdns_uart_uart_driver->cons->flags & CON_ENABLED)) | 1591 | !(cdns_uart_uart_driver.cons->flags & CON_ENABLED)) |
| 1694 | console_port = NULL; | 1592 | console_port = NULL; |
| 1695 | #endif | 1593 | #endif |
| 1696 | 1594 | ||
| 1697 | uartps_major = cdns_uart_uart_driver->tty_driver->major; | ||
| 1698 | cdns_uart_data->cts_override = of_property_read_bool(pdev->dev.of_node, | 1595 | cdns_uart_data->cts_override = of_property_read_bool(pdev->dev.of_node, |
| 1699 | "cts-override"); | 1596 | "cts-override"); |
| 1597 | |||
| 1598 | instances++; | ||
| 1599 | |||
| 1700 | return 0; | 1600 | return 0; |
| 1701 | 1601 | ||
| 1702 | err_out_pm_disable: | 1602 | err_out_pm_disable: |
| @@ -1712,12 +1612,8 @@ err_out_clk_disable: · 9 unmodified lines | |||
| 1712 | err_out_clk_dis_pclk: | 1612 | err_out_clk_dis_pclk: |
| 1713 | clk_disable_unprepare(cdns_uart_data->pclk); | 1613 | clk_disable_unprepare(cdns_uart_data->pclk); |
| 1714 | err_out_unregister_driver: | 1614 | err_out_unregister_driver: |
| 1715 | uart_unregister_driver(cdns_uart_data->cdns_uart_driver); | 1615 | if (!instances) |
| 1716 | err_out_id: | 1616 | uart_unregister_driver(cdns_uart_data->cdns_uart_driver); |
| 1717 | mutex_lock(&bitmap_lock); | ||
| 1718 | if (cdns_uart_data->id < MAX_UART_INSTANCES) | ||
| 1719 | clear_bit(cdns_uart_data->id, bitmap); | ||
| 1720 | mutex_unlock(&bitmap_lock); | ||
| 1721 | return rc; | 1617 | return rc; |
| 1722 | } | 1618 | } |
| 1723 | 1619 | ||
| @@ -1740,10 +1636,6 @@ static int cdns_uart_remove(struct platform_device *pdev) · 16 unmodified lines | |||
| 1740 | #endif | 1636 | #endif |
| 1741 | rc = uart_remove_one_port(cdns_uart_data->cdns_uart_driver, port); | 1637 | rc = uart_remove_one_port(cdns_uart_data->cdns_uart_driver, port); |
| 1742 | port->mapbase = 0; | 1638 | port->mapbase = 0; |
| 1743 | mutex_lock(&bitmap_lock); | ||
| 1744 | if (cdns_uart_data->id < MAX_UART_INSTANCES) | ||
| 1745 | clear_bit(cdns_uart_data->id, bitmap); | ||
| 1746 | mutex_unlock(&bitmap_lock); | ||
| 1747 | clk_disable_unprepare(cdns_uart_data->uartclk); | 1639 | clk_disable_unprepare(cdns_uart_data->uartclk); |
| 1748 | clk_disable_unprepare(cdns_uart_data->pclk); | 1640 | clk_disable_unprepare(cdns_uart_data->pclk); |
| 1749 | pm_runtime_disable(&pdev->dev); | 1641 | pm_runtime_disable(&pdev->dev); |
| @@ -1756,13 +1648,8 @@ static int cdns_uart_remove(struct platform_device *pdev) · 6 unmodified lines | |||
| 1756 | console_port = NULL; | 1648 | console_port = NULL; |
| 1757 | #endif | 1649 | #endif |
| 1758 | 1650 | ||
| 1759 | /* If this is last instance major number should be initialized */ | 1651 | if (!--instances) |
| 1760 | mutex_lock(&bitmap_lock); | 1652 | uart_unregister_driver(cdns_uart_data->cdns_uart_driver); |
| 1761 | if (bitmap_empty(bitmap, MAX_UART_INSTANCES)) | ||
| 1762 | uartps_major = 0; | ||
| 1763 | mutex_unlock(&bitmap_lock); | ||
| 1764 | |||
| 1765 | uart_unregister_driver(cdns_uart_data->cdns_uart_driver); | ||
| 1766 | return rc; | 1653 | return rc; |
| 1767 | } | 1654 | } |
| 1768 | 1655 | ||
| @@ -74,6 +74,7 @@ int sysrq_mask(void) · 73 unmodified lines | |||
| 74 | return 1; | 74 | return 1; |
| 75 | return sysrq_enabled; | 75 | return sysrq_enabled; |
| 76 | } | 76 | } |
| 77 | EXPORT_SYMBOL_GPL(sysrq_mask); | ||
| 77 | 78 | ||
| 78 | /* | 79 | /* |
| 79 | * A value of 1 means 'all', other nonzero values are an op mask: | 80 | * A value of 1 means 'all', other nonzero values are an op mask: |
| @@ -1058,6 +1059,7 @@ int sysrq_toggle_support(int enable_mask) · 978 unmodified lines | |||
| 1058 | 1059 | ||
| 1059 | return 0; | 1060 | return 0; |
| 1060 | } | 1061 | } |
| 1062 | EXPORT_SYMBOL_GPL(sysrq_toggle_support); | ||
| 1061 | 1063 | ||
| 1062 | static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p, | 1064 | static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p, |
| 1063 | struct sysrq_key_op *remove_op_p) | 1065 | struct sysrq_key_op *remove_op_p) |
| @@ -81,6 +81,7 @@ · 80 unmodified lines | |||
| 81 | #include <linux/errno.h> | 81 | #include <linux/errno.h> |
| 82 | #include <linux/kd.h> | 82 | #include <linux/kd.h> |
| 83 | #include <linux/slab.h> | 83 | #include <linux/slab.h> |
| 84 | #include <linux/vmalloc.h> | ||
| 84 | #include <linux/major.h> | 85 | #include <linux/major.h> |
| 85 | #include <linux/mm.h> | 86 | #include <linux/mm.h> |
| 86 | #include <linux/console.h> | 87 | #include <linux/console.h> |
| @@ -350,7 +351,7 @@ static struct uni_screen *vc_uniscr_alloc(unsigned int cols, unsigned int rows) · 263 unmodified lines | |||
| 350 | /* allocate everything in one go */ | 351 | /* allocate everything in one go */ |
| 351 | memsize = cols * rows * sizeof(char32_t); | 352 | memsize = cols * rows * sizeof(char32_t); |
| 352 | memsize += rows * sizeof(char32_t *); | 353 | memsize += rows * sizeof(char32_t *); |
| 353 | p = kmalloc(memsize, GFP_KERNEL); | 354 | p = vmalloc(memsize); |
| 354 | if (!p) | 355 | if (!p) |
| 355 | return NULL; | 356 | return NULL; |
| 356 | 357 | ||
| @@ -366,7 +367,7 @@ static struct uni_screen *vc_uniscr_alloc(unsigned int cols, unsigned int rows) · 9 unmodified lines | |||
| 366 | 367 | ||
| 367 | static void vc_uniscr_set(struct vc_data *vc, struct uni_screen *new_uniscr) | 368 | static void vc_uniscr_set(struct vc_data *vc, struct uni_screen *new_uniscr) |
| 368 | { | 369 | { |
| 369 | kfree(vc->vc_uni_screen); | 370 | vfree(vc->vc_uni_screen); |
| 370 | vc->vc_uni_screen = new_uniscr; | 371 | vc->vc_uni_screen = new_uniscr; |
| 371 | } | 372 | } |
| 372 | 373 | ||
| @@ -1206,7 +1207,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, · 833 unmodified lines | |||
| 1206 | if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) | 1207 | if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) |
| 1207 | return 0; | 1208 | return 0; |
| 1208 | 1209 | ||
| 1209 | if (new_screen_size > (4 << 20)) | 1210 | if (new_screen_size > KMALLOC_MAX_SIZE) |
| 1210 | return -EINVAL; | 1211 | return -EINVAL; |
| 1211 | newscreen = kzalloc(new_screen_size, GFP_USER); | 1212 | newscreen = kzalloc(new_screen_size, GFP_USER); |
| 1212 | if (!newscreen) | 1213 | if (!newscreen) |
| @@ -412,9 +412,12 @@ static void acm_ctrl_irq(struct urb *urb) · 411 unmodified lines | |||
| 412 | 412 | ||
| 413 | exit: | 413 | exit: |
| 414 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 414 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
| 415 | if (retval && retval != -EPERM) | 415 | if (retval && retval != -EPERM && retval != -ENODEV) |
| 416 | dev_err(&acm->control->dev, | 416 | dev_err(&acm->control->dev, |
| 417 | "%s - usb_submit_urb failed: %d\n", __func__, retval); | 417 | "%s - usb_submit_urb failed: %d\n", __func__, retval); |
| 418 | else | ||
| 419 | dev_vdbg(&acm->control->dev, | ||
| 420 | "control resubmission terminated %d\n", retval); | ||
| 418 | } | 421 | } |
| 419 | 422 | ||
| 420 | static int acm_submit_read_urb(struct acm *acm, int index, gfp_t mem_flags) | 423 | static int acm_submit_read_urb(struct acm *acm, int index, gfp_t mem_flags) |
| @@ -430,6 +433,8 @@ static int acm_submit_read_urb(struct acm *acm, int index, gfp_t mem_flags) · 9 unmodified lines | |||
| 430 | dev_err(&acm->data->dev, | 433 | dev_err(&acm->data->dev, |
| 431 | "urb %d failed submission with %d\n", | 434 | "urb %d failed submission with %d\n", |
| 432 | index, res); | 435 | index, res); |
| 436 | } else { | ||
| 437 | dev_vdbg(&acm->data->dev, "intended failure %d\n", res); | ||
| 433 | } | 438 | } |
| 434 | set_bit(index, &acm->read_urbs_free); | 439 | set_bit(index, &acm->read_urbs_free); |
| 435 | return res; | 440 | return res; |
| @@ -471,6 +476,7 @@ static void acm_read_bulk_callback(struct urb *urb) · 35 unmodified lines | |||
| 471 | int status = urb->status; | 476 | int status = urb->status; |
| 472 | bool stopped = false; | 477 | bool stopped = false; |
| 473 | bool stalled = false; | 478 | bool stalled = false; |
| 479 | bool cooldown = false; | ||
| 474 | 480 | ||
| 475 | dev_vdbg(&acm->data->dev, "got urb %d, len %d, status %d\n", | 481 | dev_vdbg(&acm->data->dev, "got urb %d, len %d, status %d\n", |
| 476 | rb->index, urb->actual_length, status); | 482 | rb->index, urb->actual_length, status); |
| @@ -497,6 +503,14 @@ static void acm_read_bulk_callback(struct urb *urb) · 20 unmodified lines | |||
| 497 | __func__, status); | 503 | __func__, status); |
| 498 | stopped = true; | 504 | stopped = true; |
| 499 | break; | 505 | break; |
| 506 | case -EOVERFLOW: | ||
| 507 | case -EPROTO: | ||
| 508 | dev_dbg(&acm->data->dev, | ||
| 509 | "%s - cooling babbling device\n", __func__); | ||
| 510 | usb_mark_last_busy(acm->dev); | ||
| 511 | set_bit(rb->index, &acm->urbs_in_error_delay); | ||
| 512 | cooldown = true; | ||
| 513 | break; | ||
| 500 | default: | 514 | default: |
| 501 | dev_dbg(&acm->data->dev, | 515 | dev_dbg(&acm->data->dev, |
| 502 | "%s - nonzero urb status received: %d\n", | 516 | "%s - nonzero urb status received: %d\n", |
| @@ -518,9 +532,11 @@ static void acm_read_bulk_callback(struct urb *urb) · 15 unmodified lines | |||
| 518 | */ | 532 | */ |
| 519 | smp_mb__after_atomic(); | 533 | smp_mb__after_atomic(); |
| 520 | 534 | ||
| 521 | if (stopped || stalled) { | 535 | if (stopped || stalled || cooldown) { |
| 522 | if (stalled) | 536 | if (stalled) |
| 523 | schedule_work(&acm->work); | 537 | schedule_work(&acm->work); |
| 538 | else if (cooldown) | ||
| 539 | schedule_delayed_work(&acm->dwork, HZ / 2); | ||
| 524 | return; | 540 | return; |
| 525 | } | 541 | } |
| 526 | 542 | ||
| @@ -557,14 +573,20 @@ static void acm_softint(struct work_struct *work) · 30 unmodified lines | |||
| 557 | struct acm *acm = container_of(work, struct acm, work); | 573 | struct acm *acm = container_of(work, struct acm, work); |
| 558 | 574 | ||
| 559 | if (test_bit(EVENT_RX_STALL, &acm->flags)) { | 575 | if (test_bit(EVENT_RX_STALL, &acm->flags)) { |
| 560 | if (!(usb_autopm_get_interface(acm->data))) { | 576 | smp_mb(); /* against acm_suspend() */ |
| 577 | if (!acm->susp_count) { | ||
| 561 | for (i = 0; i < acm->rx_buflimit; i++) | 578 | for (i = 0; i < acm->rx_buflimit; i++) |
| 562 | usb_kill_urb(acm->read_urbs[i]); | 579 | usb_kill_urb(acm->read_urbs[i]); |
| 563 | usb_clear_halt(acm->dev, acm->in); | 580 | usb_clear_halt(acm->dev, acm->in); |
| 564 | acm_submit_read_urbs(acm, GFP_KERNEL); | 581 | acm_submit_read_urbs(acm, GFP_KERNEL); |
| 565 | usb_autopm_put_interface(acm->data); | 582 | clear_bit(EVENT_RX_STALL, &acm->flags); |
| 566 | } | 583 | } |
| 567 | clear_bit(EVENT_RX_STALL, &acm->flags); | 584 | } |
| 585 | |||
| 586 | if (test_and_clear_bit(ACM_ERROR_DELAY, &acm->flags)) { | ||
| 587 | for (i = 0; i < ACM_NR; i++) | ||
| 588 | if (test_and_clear_bit(i, &acm->urbs_in_error_delay)) | ||
| 589 | acm_submit_read_urb(acm, i, GFP_NOIO); | ||
| 568 | } | 590 | } |
| 569 | 591 | ||
| 570 | if (test_and_clear_bit(EVENT_TTY_WAKEUP, &acm->flags)) | 592 | if (test_and_clear_bit(EVENT_TTY_WAKEUP, &acm->flags)) |
| @@ -1333,6 +1355,7 @@ made_compressed_probe: · 762 unmodified lines | |||
| 1333 | acm->readsize = readsize; | 1355 | acm->readsize = readsize; |
| 1334 | acm->rx_buflimit = num_rx_buf; | 1356 | acm->rx_buflimit = num_rx_buf; |
| 1335 | INIT_WORK(&acm->work, acm_softint); | 1357 | INIT_WORK(&acm->work, acm_softint); |
| 1358 | INIT_DELAYED_WORK(&acm->dwork, acm_softint); | ||
| 1336 | init_waitqueue_head(&acm->wioctl); | 1359 | init_waitqueue_head(&acm->wioctl); |
| 1337 | spin_lock_init(&acm->write_lock); | 1360 | spin_lock_init(&acm->write_lock); |
| 1338 | spin_lock_init(&acm->read_lock); | 1361 | spin_lock_init(&acm->read_lock); |
| @@ -1542,6 +1565,7 @@ static void acm_disconnect(struct usb_interface *intf) · 203 unmodified lines | |||
| 1542 | 1565 | ||
| 1543 | acm_kill_urbs(acm); | 1566 | acm_kill_urbs(acm); |
| 1544 | cancel_work_sync(&acm->work); | 1567 | cancel_work_sync(&acm->work); |
| 1568 | cancel_delayed_work_sync(&acm->dwork); | ||
| 1545 | 1569 | ||
| 1546 | tty_unregister_device(acm_tty_driver, acm->minor); | 1570 | tty_unregister_device(acm_tty_driver, acm->minor); |
| 1547 | 1571 | ||
| @@ -1584,6 +1608,8 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message) · 36 unmodified lines | |||
| 1584 | 1608 | ||
| 1585 | acm_kill_urbs(acm); | 1609 | acm_kill_urbs(acm); |
| 1586 | cancel_work_sync(&acm->work); | 1610 | cancel_work_sync(&acm->work); |
| 1611 | cancel_delayed_work_sync(&acm->dwork); | ||
| 1612 | acm->urbs_in_error_delay = 0; | ||
| 1587 | 1613 | ||
| 1588 | return 0; | 1614 | return 0; |
| 1589 | } | 1615 | } |
| @@ -109,8 +109,11 @@ struct acm { · 108 unmodified lines | |||
| 109 | # define EVENT_TTY_WAKEUP 0 | 109 | # define EVENT_TTY_WAKEUP 0 |
| 110 | # define EVENT_RX_STALL 1 | 110 | # define EVENT_RX_STALL 1 |
| 111 | # define ACM_THROTTLED 2 | 111 | # define ACM_THROTTLED 2 |
| 112 | # define ACM_ERROR_DELAY 3 | ||
| 113 | unsigned long urbs_in_error_delay; /* these need to be restarted after a delay */ | ||
| 112 | struct usb_cdc_line_coding line; /* bits, stop, parity */ | 114 | struct usb_cdc_line_coding line; /* bits, stop, parity */ |
| 113 | struct work_struct work; /* work queue entry for line discipline waking up */ | 115 | struct work_struct work; /* work queue entry for various purposes*/ |
| 116 | struct delayed_work dwork; /* for cool downs needed in error recovery */ | ||
| 114 | unsigned int ctrlin; /* input control lines (DCD, DSR, RI, break, overruns) */ | 117 | unsigned int ctrlin; /* input control lines (DCD, DSR, RI, break, overruns) */ |
| 115 | unsigned int ctrlout; /* output control lines (DTR, RTS) */ | 118 | unsigned int ctrlout; /* output control lines (DTR, RTS) */ |
| 116 | struct async_icount iocount; /* counters for control line changes */ | 119 | struct async_icount iocount; /* counters for control line changes */ |
| @@ -1223,6 +1223,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) · 1222 unmodified lines | |||
| 1223 | #ifdef CONFIG_PM | 1223 | #ifdef CONFIG_PM |
| 1224 | udev->reset_resume = 1; | 1224 | udev->reset_resume = 1; |
| 1225 | #endif | 1225 | #endif |
| 1226 | /* Don't set the change_bits when the device | ||
| 1227 | * was powered off. | ||
| 1228 | */ | ||
| 1229 | if (test_bit(port1, hub->power_bits)) | ||
| 1230 | set_bit(port1, hub->change_bits); | ||
| 1226 | 1231 | ||
| 1227 | } else { | 1232 | } else { |
| 1228 | /* The power session is gone; tell hub_wq */ | 1233 | /* The power session is gone; tell hub_wq */ |
| @@ -2723,13 +2728,11 @@ static bool use_new_scheme(struct usb_device *udev, int retry, · 1494 unmodified lines | |||
| 2723 | { | 2728 | { |
| 2724 | int old_scheme_first_port = | 2729 | int old_scheme_first_port = |
| 2725 | port_dev->quirks & USB_PORT_QUIRK_OLD_SCHEME; | 2730 | port_dev->quirks & USB_PORT_QUIRK_OLD_SCHEME; |
| 2726 | int quick_enumeration = (udev->speed == USB_SPEED_HIGH); | ||
| 2727 | 2731 | ||
| 2728 | if (udev->speed >= USB_SPEED_SUPER) | 2732 | if (udev->speed >= USB_SPEED_SUPER) |
| 2729 | return false; | 2733 | return false; |
| 2730 | 2734 | ||
| 2731 | return USE_NEW_SCHEME(retry, old_scheme_first_port || old_scheme_first | 2735 | return USE_NEW_SCHEME(retry, old_scheme_first_port || old_scheme_first); |
| 2732 | || quick_enumeration); | ||
| 2733 | } | 2736 | } |
| 2734 | 2737 | ||
| 2735 | /* Is a USB 3.0 port in the Inactive or Compliance Mode state? | 2738 | /* Is a USB 3.0 port in the Inactive or Compliance Mode state? |
| @@ -3088,6 +3091,15 @@ static int check_port_resume_type(struct usb_device *udev, · 352 unmodified lines | |||
| 3088 | if (portchange & USB_PORT_STAT_C_ENABLE) | 3091 | if (portchange & USB_PORT_STAT_C_ENABLE) |
| 3089 | usb_clear_port_feature(hub->hdev, port1, | 3092 | usb_clear_port_feature(hub->hdev, port1, |
| 3090 | USB_PORT_FEAT_C_ENABLE); | 3093 | USB_PORT_FEAT_C_ENABLE); |
| 3094 | |||
| 3095 | /* | ||
| 3096 | * Whatever made this reset-resume necessary may have | ||
| 3097 | * turned on the port1 bit in hub->change_bits. But after | ||
| 3098 | * a successful reset-resume we want the bit to be clear; | ||
| 3099 | * if it was on it would indicate that something happened | ||
| 3100 | * following the reset-resume. | ||
| 3101 | */ | ||
| 3102 | clear_bit(port1, hub->change_bits); | ||
| 3091 | } | 3103 | } |
| 3092 | 3104 | ||
| 3093 | return status; | 3105 | return status; |
| @@ -589,12 +589,13 @@ void usb_sg_cancel(struct usb_sg_request *io) · 588 unmodified lines | |||
| 589 | int i, retval; | 589 | int i, retval; |
| 590 | 590 | ||
| 591 | spin_lock_irqsave(&io->lock, flags); | 591 | spin_lock_irqsave(&io->lock, flags); |
| 592 | if (io->status) { | 592 | if (io->status || io->count == 0) { |
| 593 | spin_unlock_irqrestore(&io->lock, flags); | 593 | spin_unlock_irqrestore(&io->lock, flags); |
| 594 | return; | 594 | return; |
| 595 | } | 595 | } |
| 596 | /* shut everything down */ | 596 | /* shut everything down */ |
| 597 | io->status = -ECONNRESET; | 597 | io->status = -ECONNRESET; |
| 598 | io->count++; /* Keep the request alive until we're done */ | ||
| 598 | spin_unlock_irqrestore(&io->lock, flags); | 599 | spin_unlock_irqrestore(&io->lock, flags); |
| 599 | 600 | ||
| 600 | for (i = io->entries - 1; i >= 0; --i) { | 601 | for (i = io->entries - 1; i >= 0; --i) { |
| @@ -608,6 +609,12 @@ void usb_sg_cancel(struct usb_sg_request *io) · 7 unmodified lines | |||
| 608 | dev_warn(&io->dev->dev, "%s, unlink --> %d\n", | 609 | dev_warn(&io->dev->dev, "%s, unlink --> %d\n", |
| 609 | __func__, retval); | 610 | __func__, retval); |
| 610 | } | 611 | } |
| 612 | |||
| 613 | spin_lock_irqsave(&io->lock, flags); | ||
| 614 | io->count--; | ||
| 615 | if (!io->count) | ||
| 616 | complete(&io->complete); | ||
| 617 | spin_unlock_irqrestore(&io->lock, flags); | ||
| 611 | } | 618 | } |
| 612 | EXPORT_SYMBOL_GPL(usb_sg_cancel); | 619 | EXPORT_SYMBOL_GPL(usb_sg_cancel); |
| 613 | 620 | ||
| @@ -430,6 +430,10 @@ static const struct usb_device_id usb_quirk_list[] = { · 429 unmodified lines | |||
| 430 | /* Corsair K70 LUX */ | 430 | /* Corsair K70 LUX */ |
| 431 | { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT }, | 431 | { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 432 | 432 | ||
| 433 | /* Corsair K70 RGB RAPDIFIRE */ | ||
| 434 | { USB_DEVICE(0x1b1c, 0x1b38), .driver_info = USB_QUIRK_DELAY_INIT | | ||
| 435 | USB_QUIRK_DELAY_CTRL_MSG }, | ||
| 436 | |||
| 433 | /* MIDI keyboard WORLDE MINI */ | 437 | /* MIDI keyboard WORLDE MINI */ |
| 434 | { USB_DEVICE(0x1c75, 0x0204), .driver_info = | 438 | { USB_DEVICE(0x1c75, 0x0204), .driver_info = |
| 435 | USB_QUIRK_CONFIG_INTF_STRINGS }, | 439 | USB_QUIRK_CONFIG_INTF_STRINGS }, |
| @@ -307,10 +307,14 @@ · 306 unmodified lines | |||
| 307 | 307 | ||
| 308 | /* Global TX Fifo Size Register */ | 308 | /* Global TX Fifo Size Register */ |
| 309 | #define DWC31_GTXFIFOSIZ_TXFRAMNUM BIT(15) /* DWC_usb31 only */ | 309 | #define DWC31_GTXFIFOSIZ_TXFRAMNUM BIT(15) /* DWC_usb31 only */ |
| 310 | #define DWC31_GTXFIFOSIZ_TXFDEF(n) ((n) & 0x7fff) /* DWC_usb31 only */ | 310 | #define DWC31_GTXFIFOSIZ_TXFDEP(n) ((n) & 0x7fff) /* DWC_usb31 only */ |
| 311 | #define DWC3_GTXFIFOSIZ_TXFDEF(n) ((n) & 0xffff) | 311 | #define DWC3_GTXFIFOSIZ_TXFDEP(n) ((n) & 0xffff) |
| 312 | #define DWC3_GTXFIFOSIZ_TXFSTADDR(n) ((n) & 0xffff0000) | 312 | #define DWC3_GTXFIFOSIZ_TXFSTADDR(n) ((n) & 0xffff0000) |
| 313 | 313 | ||
| 314 | /* Global RX Fifo Size Register */ | ||
| 315 | #define DWC31_GRXFIFOSIZ_RXFDEP(n) ((n) & 0x7fff) /* DWC_usb31 only */ | ||
| 316 | #define DWC3_GRXFIFOSIZ_RXFDEP(n) ((n) & 0xffff) | ||
| 317 | |||
| 314 | /* Global Event Size Registers */ | 318 | /* Global Event Size Registers */ |
| 315 | #define DWC3_GEVNTSIZ_INTMASK BIT(31) | 319 | #define DWC3_GEVNTSIZ_INTMASK BIT(31) |
| 316 | #define DWC3_GEVNTSIZ_SIZE(n) ((n) & 0xffff) | 320 | #define DWC3_GEVNTSIZ_SIZE(n) ((n) & 0xffff) |
| @@ -1728,7 +1728,6 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc) · 1727 unmodified lines | |||
| 1728 | u32 reg; | 1728 | u32 reg; |
| 1729 | 1729 | ||
| 1730 | u8 link_state; | 1730 | u8 link_state; |
| 1731 | u8 speed; | ||
| 1732 | 1731 | ||
| 1733 | /* | 1732 | /* |
| 1734 | * According to the Databook Remote wakeup request should | 1733 | * According to the Databook Remote wakeup request should |
| @@ -1738,16 +1737,13 @@ static int __dwc3_gadget_wakeup(struct dwc3 *dwc) · 3 unmodified lines | |||
| 1738 | */ | 1737 | */ |
| 1739 | reg = dwc3_readl(dwc->regs, DWC3_DSTS); | 1738 | reg = dwc3_readl(dwc->regs, DWC3_DSTS); |
| 1740 | 1739 | ||
| 1741 | speed = reg & DWC3_DSTS_CONNECTSPD; | ||
| 1742 | if ((speed == DWC3_DSTS_SUPERSPEED) || | ||
| 1743 | (speed == DWC3_DSTS_SUPERSPEED_PLUS)) | ||
| 1744 | return 0; | ||
| 1745 | |||
| 1746 | link_state = DWC3_DSTS_USBLNKST(reg); | 1740 | link_state = DWC3_DSTS_USBLNKST(reg); |
| 1747 | 1741 | ||
| 1748 | switch (link_state) { | 1742 | switch (link_state) { |
| 1743 | case DWC3_LINK_STATE_RESET: | ||
| 1749 | case DWC3_LINK_STATE_RX_DET: /* in HS, means Early Suspend */ | 1744 | case DWC3_LINK_STATE_RX_DET: /* in HS, means Early Suspend */ |
| 1750 | case DWC3_LINK_STATE_U3: /* in HS, means SUSPEND */ | 1745 | case DWC3_LINK_STATE_U3: /* in HS, means SUSPEND */ |
| 1746 | case DWC3_LINK_STATE_RESUME: | ||
| 1751 | break; | 1747 | break; |
| 1752 | default: | 1748 | default: |
| 1753 | return -EINVAL; | 1749 | return -EINVAL; |
| @@ -2227,7 +2223,6 @@ static int dwc3_gadget_init_in_endpoint(struct dwc3_ep *dep) · 473 unmodified lines | |||
| 2227 | { | 2223 | { |
| 2228 | struct dwc3 *dwc = dep->dwc; | 2224 | struct dwc3 *dwc = dep->dwc; |
| 2229 | int mdwidth; | 2225 | int mdwidth; |
| 2230 | int kbytes; | ||
| 2231 | int size; | 2226 | int size; |
| 2232 | 2227 | ||
| 2233 | mdwidth = DWC3_MDWIDTH(dwc->hwparams.hwparams0); | 2228 | mdwidth = DWC3_MDWIDTH(dwc->hwparams.hwparams0); |
| @@ -2236,24 +2231,24 @@ static int dwc3_gadget_init_in_endpoint(struct dwc3_ep *dep) · 2 unmodified lines | |||
| 2236 | 2231 | ||
| 2237 | size = dwc3_readl(dwc->regs, DWC3_GTXFIFOSIZ(dep->number >> 1)); | 2232 | size = dwc3_readl(dwc->regs, DWC3_GTXFIFOSIZ(dep->number >> 1)); |
| 2238 | if (dwc3_is_usb31(dwc)) | 2233 | if (dwc3_is_usb31(dwc)) |
| 2239 | size = DWC31_GTXFIFOSIZ_TXFDEF(size); | 2234 | size = DWC31_GTXFIFOSIZ_TXFDEP(size); |
| 2240 | else | 2235 | else |
| 2241 | size = DWC3_GTXFIFOSIZ_TXFDEF(size); | 2236 | size = DWC3_GTXFIFOSIZ_TXFDEP(size); |
| 2242 | 2237 | ||
| 2243 | /* FIFO Depth is in MDWDITH bytes. Multiply */ | 2238 | /* FIFO Depth is in MDWDITH bytes. Multiply */ |
| 2244 | size *= mdwidth; | 2239 | size *= mdwidth; |
| 2245 | 2240 | ||
| 2246 | kbytes = size / 1024; | ||
| 2247 | if (kbytes == 0) | ||
| 2248 | kbytes = 1; | ||
| 2249 | |||
| 2250 | /* | 2241 | /* |
| 2251 | * FIFO sizes account an extra MDWIDTH * (kbytes + 1) bytes for | 2242 | * To meet performance requirement, a minimum TxFIFO size of 3x |
| 2252 | * internal overhead. We don't really know how these are used, | 2243 | * MaxPacketSize is recommended for endpoints that support burst and a |
| 2253 | * but documentation say it exists. | 2244 | * minimum TxFIFO size of 2x MaxPacketSize for endpoints that don't |
| 2245 | * support burst. Use those numbers and we can calculate the max packet | ||
| 2246 | * limit as below. | ||
| 2254 | */ | 2247 | */ |
| 2255 | size -= mdwidth * (kbytes + 1); | 2248 | if (dwc->maximum_speed >= USB_SPEED_SUPER) |
| 2256 | size /= kbytes; | 2249 | size /= 3; |
| 2250 | else | ||
| 2251 | size /= 2; | ||
| 2257 | 2252 | ||
| 2258 | usb_ep_set_maxpacket_limit(&dep->endpoint, size); | 2253 | usb_ep_set_maxpacket_limit(&dep->endpoint, size); |
| 2259 | 2254 | ||
| @@ -2271,8 +2266,39 @@ static int dwc3_gadget_init_in_endpoint(struct dwc3_ep *dep) · 11 unmodified lines | |||
| 2271 | static int dwc3_gadget_init_out_endpoint(struct dwc3_ep *dep) | 2266 | static int dwc3_gadget_init_out_endpoint(struct dwc3_ep *dep) |
| 2272 | { | 2267 | { |
| 2273 | struct dwc3 *dwc = dep->dwc; | 2268 | struct dwc3 *dwc = dep->dwc; |
| 2269 | int mdwidth; | ||
| 2270 | int size; | ||
| 2271 | |||
| 2272 | mdwidth = DWC3_MDWIDTH(dwc->hwparams.hwparams0); | ||
| 2274 | 2273 | ||
| 2275 | usb_ep_set_maxpacket_limit(&dep->endpoint, 1024); | 2274 | /* MDWIDTH is represented in bits, convert to bytes */ |
| 2275 | mdwidth /= 8; | ||
| 2276 | |||
| 2277 | /* All OUT endpoints share a single RxFIFO space */ | ||
| 2278 | size = dwc3_readl(dwc->regs, DWC3_GRXFIFOSIZ(0)); | ||
| 2279 | if (dwc3_is_usb31(dwc)) | ||
| 2280 | size = DWC31_GRXFIFOSIZ_RXFDEP(size); | ||
| 2281 | else | ||
| 2282 | size = DWC3_GRXFIFOSIZ_RXFDEP(size); | ||
| 2283 | |||
| 2284 | /* FIFO depth is in MDWDITH bytes */ | ||
| 2285 | size *= mdwidth; | ||
| 2286 | |||
| 2287 | /* | ||
| 2288 | * To meet performance requirement, a minimum recommended RxFIFO size | ||
| 2289 | * is defined as follow: | ||
| 2290 | * RxFIFO size >= (3 x MaxPacketSize) + | ||
| 2291 | * (3 x 8 bytes setup packets size) + (16 bytes clock crossing margin) | ||
| 2292 | * | ||
| 2293 | * Then calculate the max packet limit as below. | ||
| 2294 | */ | ||
| 2295 | size -= (3 * 8) + 16; | ||
| 2296 | if (size < 0) | ||
| 2297 | size = 0; | ||
| 2298 | else | ||
| 2299 | size /= 3; | ||
| 2300 | |||
| 2301 | usb_ep_set_maxpacket_limit(&dep->endpoint, size); | ||
| 2276 | dep->endpoint.max_streams = 15; | 2302 | dep->endpoint.max_streams = 15; |
| 2277 | dep->endpoint.ops = &dwc3_gadget_ep_ops; | 2303 | dep->endpoint.ops = &dwc3_gadget_ep_ops; |
| 2278 | list_add_tail(&dep->endpoint.ep_list, | 2304 | list_add_tail(&dep->endpoint.ep_list, |
| @@ -2484,14 +2510,7 @@ static int dwc3_gadget_ep_reclaim_trb_linear(struct dwc3_ep *dep, · 205 unmodified lines | |||
| 2484 | 2510 | ||
| 2485 | static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req) | 2511 | static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req) |
| 2486 | { | 2512 | { |
| 2487 | /* | 2513 | return req->num_pending_sgs == 0; |
| 2488 | * For OUT direction, host may send less than the setup | ||
| 2489 | * length. Return true for all OUT requests. | ||
| 2490 | */ | ||
| 2491 | if (!req->direction) | ||
| 2492 | return true; | ||
| 2493 | |||
| 2494 | return req->request.actual == req->request.length; | ||
| 2495 | } | 2514 | } |
| 2496 | 2515 | ||
| 2497 | static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, | 2516 | static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, |
| @@ -2515,8 +2534,7 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, · 17 unmodified lines | |||
| 2515 | 2534 | ||
| 2516 | req->request.actual = req->request.length - req->remaining; | 2535 | req->request.actual = req->request.length - req->remaining; |
| 2517 | 2536 | ||
| 2518 | if (!dwc3_gadget_ep_request_completed(req) || | 2537 | if (!dwc3_gadget_ep_request_completed(req)) { |
| 2519 | req->num_pending_sgs) { | ||
| 2520 | __dwc3_gadget_kick_transfer(dep); | 2538 | __dwc3_gadget_kick_transfer(dep); |
| 2521 | goto out; | 2539 | goto out; |
| 2522 | } | 2540 | } |
| @@ -728,19 +728,19 @@ static void xdbc_handle_tx_event(struct xdbc_trb *evt_trb) · 727 unmodified lines | |||
| 728 | case COMP_USB_TRANSACTION_ERROR: | 728 | case COMP_USB_TRANSACTION_ERROR: |
| 729 | case COMP_STALL_ERROR: | 729 | case COMP_STALL_ERROR: |
| 730 | default: | 730 | default: |
| 731 | if (ep_id == XDBC_EPID_OUT) | 731 | if (ep_id == XDBC_EPID_OUT || ep_id == XDBC_EPID_OUT_INTEL) |
| 732 | xdbc.flags |= XDBC_FLAGS_OUT_STALL; | 732 | xdbc.flags |= XDBC_FLAGS_OUT_STALL; |
| 733 | if (ep_id == XDBC_EPID_IN) | 733 | if (ep_id == XDBC_EPID_IN || ep_id == XDBC_EPID_IN_INTEL) |
| 734 | xdbc.flags |= XDBC_FLAGS_IN_STALL; | 734 | xdbc.flags |= XDBC_FLAGS_IN_STALL; |
| 735 | 735 | ||
| 736 | xdbc_trace("endpoint %d stalled\n", ep_id); | 736 | xdbc_trace("endpoint %d stalled\n", ep_id); |
| 737 | break; | 737 | break; |
| 738 | } | 738 | } |
| 739 | 739 | ||
| 740 | if (ep_id == XDBC_EPID_IN) { | 740 | if (ep_id == XDBC_EPID_IN || ep_id == XDBC_EPID_IN_INTEL) { |
| 741 | xdbc.flags &= ~XDBC_FLAGS_IN_PROCESS; | 741 | xdbc.flags &= ~XDBC_FLAGS_IN_PROCESS; |
| 742 | xdbc_bulk_transfer(NULL, XDBC_MAX_PACKET, true); | 742 | xdbc_bulk_transfer(NULL, XDBC_MAX_PACKET, true); |
| 743 | } else if (ep_id == XDBC_EPID_OUT) { | 743 | } else if (ep_id == XDBC_EPID_OUT || ep_id == XDBC_EPID_OUT_INTEL) { |
| 744 | xdbc.flags &= ~XDBC_FLAGS_OUT_PROCESS; | 744 | xdbc.flags &= ~XDBC_FLAGS_OUT_PROCESS; |
| 745 | } else { | 745 | } else { |
| 746 | xdbc_trace("invalid endpoint id %d\n", ep_id); | 746 | xdbc_trace("invalid endpoint id %d\n", ep_id); |
| @@ -120,8 +120,22 @@ struct xdbc_ring { · 119 unmodified lines | |||
| 120 | u32 cycle_state; | 120 | u32 cycle_state; |
| 121 | }; | 121 | }; |
| 122 | 122 | ||
| 123 | #define XDBC_EPID_OUT 2 | 123 | /* |
| 124 | #define XDBC_EPID_IN 3 | 124 | * These are the "Endpoint ID" (also known as "Context Index") values for the |
| 125 | * OUT Transfer Ring and the IN Transfer Ring of a Debug Capability Context data | ||
| 126 | * structure. | ||
| 127 | * According to the "eXtensible Host Controller Interface for Universal Serial | ||
| 128 | * Bus (xHCI)" specification, section "7.6.3.2 Endpoint Contexts and Transfer | ||
| 129 | * Rings", these should be 0 and 1, and those are the values AMD machines give | ||
| 130 | * you; but Intel machines seem to use the formula from section "4.5.1 Device | ||
| 131 | * Context Index", which is supposed to be used for the Device Context only. | ||
| 132 | * Luckily the values from Intel don't overlap with those from AMD, so we can | ||
| 133 | * just test for both. | ||
| 134 | */ | ||
| 135 | #define XDBC_EPID_OUT 0 | ||
| 136 | #define XDBC_EPID_IN 1 | ||
| 137 | #define XDBC_EPID_OUT_INTEL 2 | ||
| 138 | #define XDBC_EPID_IN_INTEL 3 | ||
| 125 | 139 | ||
| 126 | struct xdbc_state { | 140 | struct xdbc_state { |
| 127 | u16 vendor; | 141 | u16 vendor; |
| @@ -1813,6 +1813,10 @@ static void ffs_data_reset(struct ffs_data *ffs) · 1812 unmodified lines | |||
| 1813 | ffs->state = FFS_READ_DESCRIPTORS; | 1813 | ffs->state = FFS_READ_DESCRIPTORS; |
| 1814 | ffs->setup_state = FFS_NO_SETUP; | 1814 | ffs->setup_state = FFS_NO_SETUP; |
| 1815 | ffs->flags = 0; | 1815 | ffs->flags = 0; |
| 1816 | |||
| 1817 | ffs->ms_os_descs_ext_prop_count = 0; | ||
| 1818 | ffs->ms_os_descs_ext_prop_name_len = 0; | ||
| 1819 | ffs->ms_os_descs_ext_prop_data_len = 0; | ||
| 1816 | } | 1820 | } |
| 1817 | 1821 | ||
| 1818 | 1822 | ||
| @@ -81,6 +81,7 @@ static int raw_event_queue_add(struct raw_event_queue *queue, · 80 unmodified lines | |||
| 81 | static struct usb_raw_event *raw_event_queue_fetch( | 81 | static struct usb_raw_event *raw_event_queue_fetch( |
| 82 | struct raw_event_queue *queue) | 82 | struct raw_event_queue *queue) |
| 83 | { | 83 | { |
| 84 | int ret; | ||
| 84 | unsigned long flags; | 85 | unsigned long flags; |
| 85 | struct usb_raw_event *event; | 86 | struct usb_raw_event *event; |
| 86 | 87 | ||
| @@ -89,11 +90,18 @@ static struct usb_raw_event *raw_event_queue_fetch( · 2 unmodified lines | |||
| 89 | * there's at least one event queued by decrementing the semaphore, | 90 | * there's at least one event queued by decrementing the semaphore, |
| 90 | * and then take the lock to protect queue struct fields. | 91 | * and then take the lock to protect queue struct fields. |
| 91 | */ | 92 | */ |
| 92 | if (down_interruptible(&queue->sema)) | 93 | ret = down_interruptible(&queue->sema); |
| 93 | return NULL; | 94 | if (ret) |
| 95 | return ERR_PTR(ret); | ||
| 94 | spin_lock_irqsave(&queue->lock, flags); | 96 | spin_lock_irqsave(&queue->lock, flags); |
| 95 | if (WARN_ON(!queue->size)) | 97 | /* |
| 96 | return NULL; | 98 | * queue->size must have the same value as queue->sema counter (before |
| 99 | * the down_interruptible() call above), so this check is a fail-safe. | ||
| 100 | */ | ||
| 101 | if (WARN_ON(!queue->size)) { | ||
| 102 | spin_unlock_irqrestore(&queue->lock, flags); | ||
| 103 | return ERR_PTR(-ENODEV); | ||
| 104 | } | ||
| 97 | event = queue->events[0]; | 105 | event = queue->events[0]; |
| 98 | queue->size--; | 106 | queue->size--; |
| 99 | memmove(&queue->events[0], &queue->events[1], | 107 | memmove(&queue->events[0], &queue->events[1], |
| @@ -392,9 +400,8 @@ static int raw_ioctl_init(struct raw_dev *dev, unsigned long value) · 292 unmodified lines | |||
| 392 | char *udc_device_name; | 400 | char *udc_device_name; |
| 393 | unsigned long flags; | 401 | unsigned long flags; |
| 394 | 402 | ||
| 395 | ret = copy_from_user(&arg, (void __user *)value, sizeof(arg)); | 403 | if (copy_from_user(&arg, (void __user *)value, sizeof(arg))) |
| 396 | if (ret) | 404 | return -EFAULT; |
| 397 | return ret; | ||
| 398 | 405 | ||
| 399 | switch (arg.speed) { | 406 | switch (arg.speed) { |
| 400 | case USB_SPEED_UNKNOWN: | 407 | case USB_SPEED_UNKNOWN: |
| @@ -501,15 +508,13 @@ out_unlock: · 100 unmodified lines | |||
| 501 | 508 | ||
| 502 | static int raw_ioctl_event_fetch(struct raw_dev *dev, unsigned long value) | 509 | static int raw_ioctl_event_fetch(struct raw_dev *dev, unsigned long value) |
| 503 | { | 510 | { |
| 504 | int ret = 0; | ||
| 505 | struct usb_raw_event arg; | 511 | struct usb_raw_event arg; |
| 506 | unsigned long flags; | 512 | unsigned long flags; |
| 507 | struct usb_raw_event *event; | 513 | struct usb_raw_event *event; |
| 508 | uint32_t length; | 514 | uint32_t length; |
| 509 | 515 | ||
| 510 | ret = copy_from_user(&arg, (void __user *)value, sizeof(arg)); | 516 | if (copy_from_user(&arg, (void __user *)value, sizeof(arg))) |
| 511 | if (ret) | 517 | return -EFAULT; |
| 512 | return ret; | ||
| 513 | 518 | ||
| 514 | spin_lock_irqsave(&dev->lock, flags); | 519 | spin_lock_irqsave(&dev->lock, flags); |
| 515 | if (dev->state != STATE_DEV_RUNNING) { | 520 | if (dev->state != STATE_DEV_RUNNING) { |
| @@ -525,25 +530,31 @@ static int raw_ioctl_event_fetch(struct raw_dev *dev, unsigned long value) · 9 unmodified lines | |||
| 525 | spin_unlock_irqrestore(&dev->lock, flags); | 530 | spin_unlock_irqrestore(&dev->lock, flags); |
| 526 | 531 | ||
| 527 | event = raw_event_queue_fetch(&dev->queue); | 532 | event = raw_event_queue_fetch(&dev->queue); |
| 528 | if (!event) { | 533 | if (PTR_ERR(event) == -EINTR) { |
| 529 | dev_dbg(&dev->gadget->dev, "event fetching interrupted\n"); | 534 | dev_dbg(&dev->gadget->dev, "event fetching interrupted\n"); |
| 530 | return -EINTR; | 535 | return -EINTR; |
| 531 | } | 536 | } |
| 537 | if (IS_ERR(event)) { | ||
| 538 | dev_err(&dev->gadget->dev, "failed to fetch event\n"); | ||
| 539 | spin_lock_irqsave(&dev->lock, flags); | ||
| 540 | dev->state = STATE_DEV_FAILED; | ||
| 541 | spin_unlock_irqrestore(&dev->lock, flags); | ||
| 542 | return -ENODEV; | ||
| 543 | } | ||
| 532 | length = min(arg.length, event->length); | 544 | length = min(arg.length, event->length); |
| 533 | ret = copy_to_user((void __user *)value, event, | 545 | if (copy_to_user((void __user *)value, event, sizeof(*event) + length)) |
| 534 | sizeof(*event) + length); | 546 | return -EFAULT; |
| 535 | return ret; | 547 | |
| 548 | return 0; | ||
| 536 | } | 549 | } |
| 537 | 550 | ||
| 538 | static void *raw_alloc_io_data(struct usb_raw_ep_io *io, void __user *ptr, | 551 | static void *raw_alloc_io_data(struct usb_raw_ep_io *io, void __user *ptr, |
| 539 | bool get_from_user) | 552 | bool get_from_user) |
| 540 | { | 553 | { |
| 541 | int ret; | ||
| 542 | void *data; | 554 | void *data; |
| 543 | 555 | ||
| 544 | ret = copy_from_user(io, ptr, sizeof(*io)); | 556 | if (copy_from_user(io, ptr, sizeof(*io))) |
| 545 | if (ret) | 557 | return ERR_PTR(-EFAULT); |
| 546 | return ERR_PTR(ret); | ||
| 547 | if (io->ep >= USB_RAW_MAX_ENDPOINTS) | 558 | if (io->ep >= USB_RAW_MAX_ENDPOINTS) |
| 548 | return ERR_PTR(-EINVAL); | 559 | return ERR_PTR(-EINVAL); |
| 549 | if (!usb_raw_io_flags_valid(io->flags)) | 560 | if (!usb_raw_io_flags_valid(io->flags)) |
| @@ -658,12 +669,13 @@ static int raw_ioctl_ep0_read(struct raw_dev *dev, unsigned long value) · 108 unmodified lines | |||
| 658 | if (IS_ERR(data)) | 669 | if (IS_ERR(data)) |
| 659 | return PTR_ERR(data); | 670 | return PTR_ERR(data); |
| 660 | ret = raw_process_ep0_io(dev, &io, data, false); | 671 | ret = raw_process_ep0_io(dev, &io, data, false); |
| 661 | if (ret < 0) { | 672 | if (ret) |
| 662 | kfree(data); | 673 | goto free; |
| 663 | return ret; | 674 | |
| 664 | } | ||
| 665 | length = min(io.length, (unsigned int)ret); | 675 | length = min(io.length, (unsigned int)ret); |
| 666 | ret = copy_to_user((void __user *)(value + sizeof(io)), data, length); | 676 | if (copy_to_user((void __user *)(value + sizeof(io)), data, length)) |
| 677 | ret = -EFAULT; | ||
| 678 | free: | ||
| 667 | kfree(data); | 679 | kfree(data); |
| 668 | return ret; | 680 | return ret; |
| 669 | } | 681 | } |
| @@ -952,12 +964,13 @@ static int raw_ioctl_ep_read(struct raw_dev *dev, unsigned long value) · 282 unmodified lines | |||
| 952 | if (IS_ERR(data)) | 964 | if (IS_ERR(data)) |
| 953 | return PTR_ERR(data); | 965 | return PTR_ERR(data); |
| 954 | ret = raw_process_ep_io(dev, &io, data, false); | 966 | ret = raw_process_ep_io(dev, &io, data, false); |
| 955 | if (ret < 0) { | 967 | if (ret) |
| 956 | kfree(data); | 968 | goto free; |
| 957 | return ret; | 969 | |
| 958 | } | ||
| 959 | length = min(io.length, (unsigned int)ret); | 970 | length = min(io.length, (unsigned int)ret); |
| 960 | ret = copy_to_user((void __user *)(value + sizeof(io)), data, length); | 971 | if (copy_to_user((void __user *)(value + sizeof(io)), data, length)) |
| 972 | ret = -EFAULT; | ||
| 973 | free: | ||
| 961 | kfree(data); | 974 | kfree(data); |
| 962 | return ret; | 975 | return ret; |
| 963 | } | 976 | } |
| @@ -1951,10 +1951,10 @@ static irqreturn_t usba_vbus_irq_thread(int irq, void *devid) · 1950 unmodified lines | |||
| 1951 | usba_start(udc); | 1951 | usba_start(udc); |
| 1952 | } else { | 1952 | } else { |
| 1953 | udc->suspended = false; | 1953 | udc->suspended = false; |
| 1954 | usba_stop(udc); | ||
| 1955 | |||
| 1956 | if (udc->driver->disconnect) | 1954 | if (udc->driver->disconnect) |
| 1957 | udc->driver->disconnect(&udc->gadget); | 1955 | udc->driver->disconnect(&udc->gadget); |
| 1956 | |||
| 1957 | usba_stop(udc); | ||
| 1958 | } | 1958 | } |
| 1959 | udc->vbus_prev = vbus; | 1959 | udc->vbus_prev = vbus; |
| 1960 | } | 1960 | } |
| @@ -540,7 +540,7 @@ static void bdc_req_complete(struct bdc_ep *ep, struct bdc_req *req, · 539 unmodified lines | |||
| 540 | { | 540 | { |
| 541 | struct bdc *bdc = ep->bdc; | 541 | struct bdc *bdc = ep->bdc; |
| 542 | 542 | ||
| 543 | if (req == NULL || &req->queue == NULL || &req->usb_req == NULL) | 543 | if (req == NULL) |
| 544 | return; | 544 | return; |
| 545 | 545 | ||
| 546 | dev_dbg(bdc->dev, "%s ep:%s status:%d\n", __func__, ep->name, status); | 546 | dev_dbg(bdc->dev, "%s ep:%s status:%d\n", __func__, ep->name, status); |
| @@ -1571,6 +1571,8 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) · 1570 unmodified lines | |||
| 1571 | } | 1571 | } |
| 1572 | if ((temp & PORT_RC)) | 1572 | if ((temp & PORT_RC)) |
| 1573 | reset_change = true; | 1573 | reset_change = true; |
| 1574 | if (temp & PORT_OC) | ||
| 1575 | status = 1; | ||
| 1574 | } | 1576 | } |
| 1575 | if (!status && !reset_change) { | 1577 | if (!status && !reset_change) { |
| 1576 | xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); | 1578 | xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); |
| @@ -1636,6 +1638,13 @@ retry: · 59 unmodified lines | |||
| 1636 | port_index); | 1638 | port_index); |
| 1637 | goto retry; | 1639 | goto retry; |
| 1638 | } | 1640 | } |
| 1641 | /* bail out if port detected a over-current condition */ | ||
| 1642 | if (t1 & PORT_OC) { | ||
| 1643 | bus_state->bus_suspended = 0; | ||
| 1644 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
| 1645 | xhci_dbg(xhci, "Bus suspend bailout, port over-current detected\n"); | ||
| 1646 | return -EBUSY; | ||
| 1647 | } | ||
| 1639 | /* suspend ports in U0, or bail out for new connect changes */ | 1648 | /* suspend ports in U0, or bail out for new connect changes */ |
| 1640 | if ((t1 & PORT_PE) && (t1 & PORT_PLS_MASK) == XDEV_U0) { | 1649 | if ((t1 & PORT_PE) && (t1 & PORT_PLS_MASK) == XDEV_U0) { |
| 1641 | if ((t1 & PORT_CSC) && wake_enabled) { | 1650 | if ((t1 & PORT_CSC) && wake_enabled) { |
| @@ -547,6 +547,23 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, · 546 unmodified lines | |||
| 547 | stream_id); | 547 | stream_id); |
| 548 | return; | 548 | return; |
| 549 | } | 549 | } |
| 550 | /* | ||
| 551 | * A cancelled TD can complete with a stall if HW cached the trb. | ||
| 552 | * In this case driver can't find cur_td, but if the ring is empty we | ||
| 553 | * can move the dequeue pointer to the current enqueue position. | ||
| 554 | */ | ||
| 555 | if (!cur_td) { | ||
| 556 | if (list_empty(&ep_ring->td_list)) { | ||
| 557 | state->new_deq_seg = ep_ring->enq_seg; | ||
| 558 | state->new_deq_ptr = ep_ring->enqueue; | ||
| 559 | state->new_cycle_state = ep_ring->cycle_state; | ||
| 560 | goto done; | ||
| 561 | } else { | ||
| 562 | xhci_warn(xhci, "Can't find new dequeue state, missing cur_td\n"); | ||
| 563 | return; | ||
| 564 | } | ||
| 565 | } | ||
| 566 | |||
| 550 | /* Dig out the cycle state saved by the xHC during the stop ep cmd */ | 567 | /* Dig out the cycle state saved by the xHC during the stop ep cmd */ |
| 551 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | 568 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
| 552 | "Finding endpoint context"); | 569 | "Finding endpoint context"); |
| @@ -592,6 +609,7 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, · 39 unmodified lines | |||
| 592 | state->new_deq_seg = new_seg; | 609 | state->new_deq_seg = new_seg; |
| 593 | state->new_deq_ptr = new_deq; | 610 | state->new_deq_ptr = new_deq; |
| 594 | 611 | ||
| 612 | done: | ||
| 595 | /* Don't update the ring cycle state for the producer (us). */ | 613 | /* Don't update the ring cycle state for the producer (us). */ |
| 596 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | 614 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
| 597 | "Cycle state = 0x%x", state->new_cycle_state); | 615 | "Cycle state = 0x%x", state->new_cycle_state); |
| @@ -1856,8 +1874,8 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci, · 1258 unmodified lines | |||
| 1856 | 1874 | ||
| 1857 | if (reset_type == EP_HARD_RESET) { | 1875 | if (reset_type == EP_HARD_RESET) { |
| 1858 | ep->ep_state |= EP_HARD_CLEAR_TOGGLE; | 1876 | ep->ep_state |= EP_HARD_CLEAR_TOGGLE; |
| 1859 | xhci_cleanup_stalled_ring(xhci, ep_index, stream_id, td); | 1877 | xhci_cleanup_stalled_ring(xhci, slot_id, ep_index, stream_id, |
| 1860 | xhci_clear_hub_tt_buffer(xhci, td, ep); | 1878 | td); |
| 1861 | } | 1879 | } |
| 1862 | xhci_ring_cmd_db(xhci); | 1880 | xhci_ring_cmd_db(xhci); |
| 1863 | } | 1881 | } |
| @@ -1978,11 +1996,18 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td, · 114 unmodified lines | |||
| 1978 | if (trb_comp_code == COMP_STALL_ERROR || | 1996 | if (trb_comp_code == COMP_STALL_ERROR || |
| 1979 | xhci_requires_manual_halt_cleanup(xhci, ep_ctx, | 1997 | xhci_requires_manual_halt_cleanup(xhci, ep_ctx, |
| 1980 | trb_comp_code)) { | 1998 | trb_comp_code)) { |
| 1981 | /* Issue a reset endpoint command to clear the host side | 1999 | /* |
| 1982 | * halt, followed by a set dequeue command to move the | 2000 | * xhci internal endpoint state will go to a "halt" state for |
| 1983 | * dequeue pointer past the TD. | 2001 | * any stall, including default control pipe protocol stall. |
| 1984 | * The class driver clears the device side halt later. | 2002 | * To clear the host side halt we need to issue a reset endpoint |
| 2003 | * command, followed by a set dequeue command to move past the | ||
| 2004 | * TD. | ||
| 2005 | * Class drivers clear the device side halt from a functional | ||
| 2006 | * stall later. Hub TT buffer should only be cleared for FS/LS | ||
| 2007 | * devices behind HS hubs for functional stalls. | ||
| 1985 | */ | 2008 | */ |
| 2009 | if ((ep_index != 0) || (trb_comp_code != COMP_STALL_ERROR)) | ||
| 2010 | xhci_clear_hub_tt_buffer(xhci, td, ep); | ||
| 1986 | xhci_cleanup_halted_endpoint(xhci, slot_id, ep_index, | 2011 | xhci_cleanup_halted_endpoint(xhci, slot_id, ep_index, |
| 1987 | ep_ring->stream_id, td, EP_HARD_RESET); | 2012 | ep_ring->stream_id, td, EP_HARD_RESET); |
| 1988 | } else { | 2013 | } else { |
| @@ -2539,6 +2564,15 @@ static int handle_tx_event(struct xhci_hcd *xhci, · 550 unmodified lines | |||
| 2539 | xhci_dbg(xhci, "td_list is empty while skip flag set. Clear skip flag for slot %u ep %u.\n", | 2564 | xhci_dbg(xhci, "td_list is empty while skip flag set. Clear skip flag for slot %u ep %u.\n", |
| 2540 | slot_id, ep_index); | 2565 | slot_id, ep_index); |
| 2541 | } | 2566 | } |
| 2567 | if (trb_comp_code == COMP_STALL_ERROR || | ||
| 2568 | xhci_requires_manual_halt_cleanup(xhci, ep_ctx, | ||
| 2569 | trb_comp_code)) { | ||
| 2570 | xhci_cleanup_halted_endpoint(xhci, slot_id, | ||
| 2571 | ep_index, | ||
| 2572 | ep_ring->stream_id, | ||
| 2573 | NULL, | ||
| 2574 | EP_HARD_RESET); | ||
| 2575 | } | ||
| 2542 | goto cleanup; | 2576 | goto cleanup; |
| 2543 | } | 2577 | } |
| 2544 | 2578 | ||
| @@ -3031,19 +3031,19 @@ static void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci, · 3030 unmodified lines | |||
| 3031 | added_ctxs, added_ctxs); | 3031 | added_ctxs, added_ctxs); |
| 3032 | } | 3032 | } |
| 3033 | 3033 | ||
| 3034 | void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int ep_index, | 3034 | void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int slot_id, |
| 3035 | unsigned int stream_id, struct xhci_td *td) | 3035 | unsigned int ep_index, unsigned int stream_id, |
| 3036 | struct xhci_td *td) | ||
| 3036 | { | 3037 | { |
| 3037 | struct xhci_dequeue_state deq_state; | 3038 | struct xhci_dequeue_state deq_state; |
| 3038 | struct usb_device *udev = td->urb->dev; | ||
| 3039 | 3039 | ||
| 3040 | xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, | 3040 | xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, |
| 3041 | "Cleaning up stalled endpoint ring"); | 3041 | "Cleaning up stalled endpoint ring"); |
| 3042 | /* We need to move the HW's dequeue pointer past this TD, | 3042 | /* We need to move the HW's dequeue pointer past this TD, |
| 3043 | * or it will attempt to resend it on the next doorbell ring. | 3043 | * or it will attempt to resend it on the next doorbell ring. |
| 3044 | */ | 3044 | */ |
| 3045 | xhci_find_new_dequeue_state(xhci, udev->slot_id, | 3045 | xhci_find_new_dequeue_state(xhci, slot_id, ep_index, stream_id, td, |
| 3046 | ep_index, stream_id, td, &deq_state); | 3046 | &deq_state); |
| 3047 | 3047 | ||
| 3048 | if (!deq_state.new_deq_ptr || !deq_state.new_deq_seg) | 3048 | if (!deq_state.new_deq_ptr || !deq_state.new_deq_seg) |
| 3049 | return; | 3049 | return; |
| @@ -3054,7 +3054,7 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int ep_index, · 4 unmodified lines | |||
| 3054 | if (!(xhci->quirks & XHCI_RESET_EP_QUIRK)) { | 3054 | if (!(xhci->quirks & XHCI_RESET_EP_QUIRK)) { |
| 3055 | xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, | 3055 | xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, |
| 3056 | "Queueing new dequeue state"); | 3056 | "Queueing new dequeue state"); |
| 3057 | xhci_queue_new_dequeue_state(xhci, udev->slot_id, | 3057 | xhci_queue_new_dequeue_state(xhci, slot_id, |
| 3058 | ep_index, &deq_state); | 3058 | ep_index, &deq_state); |
| 3059 | } else { | 3059 | } else { |
| 3060 | /* Better hope no one uses the input context between now and the | 3060 | /* Better hope no one uses the input context between now and the |
| @@ -3065,7 +3065,7 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int ep_index, · 4 unmodified lines | |||
| 3065 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | 3065 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
| 3066 | "Setting up input context for " | 3066 | "Setting up input context for " |
| 3067 | "configure endpoint command"); | 3067 | "configure endpoint command"); |
| 3068 | xhci_setup_input_ctx_for_quirk(xhci, udev->slot_id, | 3068 | xhci_setup_input_ctx_for_quirk(xhci, slot_id, |
| 3069 | ep_index, &deq_state); | 3069 | ep_index, &deq_state); |
| 3070 | } | 3070 | } |
| 3071 | } | 3071 | } |
| @@ -2116,8 +2116,9 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, · 2115 unmodified lines | |||
| 2116 | void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci, | 2116 | void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci, |
| 2117 | unsigned int slot_id, unsigned int ep_index, | 2117 | unsigned int slot_id, unsigned int ep_index, |
| 2118 | struct xhci_dequeue_state *deq_state); | 2118 | struct xhci_dequeue_state *deq_state); |
| 2119 | void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int ep_index, | 2119 | void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int slot_id, |
| 2120 | unsigned int stream_id, struct xhci_td *td); | 2120 | unsigned int ep_index, unsigned int stream_id, |
| 2121 | struct xhci_td *td); | ||
| 2121 | void xhci_stop_endpoint_command_watchdog(struct timer_list *t); | 2122 | void xhci_stop_endpoint_command_watchdog(struct timer_list *t); |
| 2122 | void xhci_handle_command_timeout(struct work_struct *work); | 2123 | void xhci_handle_command_timeout(struct work_struct *work); |
| 2123 | 2124 | ||
| @@ -1199,18 +1199,18 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, · 1198 unmodified lines | |||
| 1199 | /* High level: Gfx (indexed) register access */ | 1199 | /* High level: Gfx (indexed) register access */ |
| 1200 | 1200 | ||
| 1201 | #ifdef CONFIG_USB_SISUSBVGA_CON | 1201 | #ifdef CONFIG_USB_SISUSBVGA_CON |
| 1202 | int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data) | 1202 | int sisusb_setreg(struct sisusb_usb_data *sisusb, u32 port, u8 data) |
| 1203 | { | 1203 | { |
| 1204 | return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); | 1204 | return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); |
| 1205 | } | 1205 | } |
| 1206 | 1206 | ||
| 1207 | int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data) | 1207 | int sisusb_getreg(struct sisusb_usb_data *sisusb, u32 port, u8 *data) |
| 1208 | { | 1208 | { |
| 1209 | return sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); | 1209 | return sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); |
| 1210 | } | 1210 | } |
| 1211 | #endif | 1211 | #endif |
| 1212 | 1212 | ||
| 1213 | int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, | 1213 | int sisusb_setidxreg(struct sisusb_usb_data *sisusb, u32 port, |
| 1214 | u8 index, u8 data) | 1214 | u8 index, u8 data) |
| 1215 | { | 1215 | { |
| 1216 | int ret; | 1216 | int ret; |
| @@ -1220,7 +1220,7 @@ int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, · 3 unmodified lines | |||
| 1220 | return ret; | 1220 | return ret; |
| 1221 | } | 1221 | } |
| 1222 | 1222 | ||
| 1223 | int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, | 1223 | int sisusb_getidxreg(struct sisusb_usb_data *sisusb, u32 port, |
| 1224 | u8 index, u8 *data) | 1224 | u8 index, u8 *data) |
| 1225 | { | 1225 | { |
| 1226 | int ret; | 1226 | int ret; |
| @@ -1230,7 +1230,7 @@ int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, · 3 unmodified lines | |||
| 1230 | return ret; | 1230 | return ret; |
| 1231 | } | 1231 | } |
| 1232 | 1232 | ||
| 1233 | int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, | 1233 | int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, u32 port, u8 idx, |
| 1234 | u8 myand, u8 myor) | 1234 | u8 myand, u8 myor) |
| 1235 | { | 1235 | { |
| 1236 | int ret; | 1236 | int ret; |
| @@ -1245,7 +1245,7 @@ int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, · 8 unmodified lines | |||
| 1245 | } | 1245 | } |
| 1246 | 1246 | ||
| 1247 | static int sisusb_setidxregmask(struct sisusb_usb_data *sisusb, | 1247 | static int sisusb_setidxregmask(struct sisusb_usb_data *sisusb, |
| 1248 | int port, u8 idx, u8 data, u8 mask) | 1248 | u32 port, u8 idx, u8 data, u8 mask) |
| 1249 | { | 1249 | { |
| 1250 | int ret; | 1250 | int ret; |
| 1251 | u8 tmp; | 1251 | u8 tmp; |
| @@ -1258,13 +1258,13 @@ static int sisusb_setidxregmask(struct sisusb_usb_data *sisusb, · 6 unmodified lines | |||
| 1258 | return ret; | 1258 | return ret; |
| 1259 | } | 1259 | } |
| 1260 | 1260 | ||
| 1261 | int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, | 1261 | int sisusb_setidxregor(struct sisusb_usb_data *sisusb, u32 port, |
| 1262 | u8 index, u8 myor) | 1262 | u8 index, u8 myor) |
| 1263 | { | 1263 | { |
| 1264 | return sisusb_setidxregandor(sisusb, port, index, 0xff, myor); | 1264 | return sisusb_setidxregandor(sisusb, port, index, 0xff, myor); |
| 1265 | } | 1265 | } |
| 1266 | 1266 | ||
| 1267 | int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, | 1267 | int sisusb_setidxregand(struct sisusb_usb_data *sisusb, u32 port, |
| 1268 | u8 idx, u8 myand) | 1268 | u8 idx, u8 myand) |
| 1269 | { | 1269 | { |
| 1270 | return sisusb_setidxregandor(sisusb, port, idx, myand, 0x00); | 1270 | return sisusb_setidxregandor(sisusb, port, idx, myand, 0x00); |
| @@ -2785,8 +2785,8 @@ static loff_t sisusb_lseek(struct file *file, loff_t offset, int orig) · 1514 unmodified lines | |||
| 2785 | static int sisusb_handle_command(struct sisusb_usb_data *sisusb, | 2785 | static int sisusb_handle_command(struct sisusb_usb_data *sisusb, |
| 2786 | struct sisusb_command *y, unsigned long arg) | 2786 | struct sisusb_command *y, unsigned long arg) |
| 2787 | { | 2787 | { |
| 2788 | int retval, port, length; | 2788 | int retval, length; |
| 2789 | u32 address; | 2789 | u32 port, address; |
| 2790 | 2790 | ||
| 2791 | /* All our commands require the device | 2791 | /* All our commands require the device |
| 2792 | * to be initialized. | 2792 | * to be initialized. |
| @@ -812,17 +812,17 @@ static const struct SiS_VCLKData SiSUSB_VCLKData[] = { · 811 unmodified lines | |||
| 812 | int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); | 812 | int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); |
| 813 | int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo); | 813 | int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo); |
| 814 | 814 | ||
| 815 | extern int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data); | 815 | extern int sisusb_setreg(struct sisusb_usb_data *sisusb, u32 port, u8 data); |
| 816 | extern int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 * data); | 816 | extern int sisusb_getreg(struct sisusb_usb_data *sisusb, u32 port, u8 * data); |
| 817 | extern int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, | 817 | extern int sisusb_setidxreg(struct sisusb_usb_data *sisusb, u32 port, |
| 818 | u8 index, u8 data); | 818 | u8 index, u8 data); |
| 819 | extern int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, | 819 | extern int sisusb_getidxreg(struct sisusb_usb_data *sisusb, u32 port, |
| 820 | u8 index, u8 * data); | 820 | u8 index, u8 * data); |
| 821 | extern int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, | 821 | extern int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, u32 port, |
| 822 | u8 idx, u8 myand, u8 myor); | 822 | u8 idx, u8 myand, u8 myor); |
| 823 | extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, | 823 | extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, u32 port, |
| 824 | u8 index, u8 myor); | 824 | u8 index, u8 myor); |
| 825 | extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, | 825 | extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, u32 port, |
| 826 | u8 idx, u8 myand); | 826 | u8 idx, u8 myand); |
| 827 | 827 | ||
| 828 | void sisusb_delete(struct kref *kref); | 828 | void sisusb_delete(struct kref *kref); |
| @@ -81,6 +81,19 @@ static void uas_free_streams(struct uas_dev_info *devinfo); · 80 unmodified lines | |||
| 81 | static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, | 81 | static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, |
| 82 | int status); | 82 | int status); |
| 83 | 83 | ||
| 84 | /* | ||
| 85 | * This driver needs its own workqueue, as we need to control memory allocation. | ||
| 86 | * | ||
| 87 | * In the course of error handling and power management uas_wait_for_pending_cmnds() | ||
| 88 | * needs to flush pending work items. In these contexts we cannot allocate memory | ||
| 89 | * by doing block IO as we would deadlock. For the same reason we cannot wait | ||
| 90 | * for anything allocating memory not heeding these constraints. | ||
| 91 | * | ||
| 92 | * So we have to control all work items that can be on the workqueue we flush. | ||
| 93 | * Hence we cannot share a queue and need our own. | ||
| 94 | */ | ||
| 95 | static struct workqueue_struct *workqueue; | ||
| 96 | |||
| 84 | static void uas_do_work(struct work_struct *work) | 97 | static void uas_do_work(struct work_struct *work) |
| 85 | { | 98 | { |
| 86 | struct uas_dev_info *devinfo = | 99 | struct uas_dev_info *devinfo = |
| @@ -109,7 +122,7 @@ static void uas_do_work(struct work_struct *work) · 22 unmodified lines | |||
| 109 | if (!err) | 122 | if (!err) |
| 110 | cmdinfo->state &= ~IS_IN_WORK_LIST; | 123 | cmdinfo->state &= ~IS_IN_WORK_LIST; |
| 111 | else | 124 | else |
| 112 | schedule_work(&devinfo->work); | 125 | queue_work(workqueue, &devinfo->work); |
| 113 | } | 126 | } |
| 114 | out: | 127 | out: |
| 115 | spin_unlock_irqrestore(&devinfo->lock, flags); | 128 | spin_unlock_irqrestore(&devinfo->lock, flags); |
| @@ -134,7 +147,7 @@ static void uas_add_work(struct uas_cmd_info *cmdinfo) · 18 unmodified lines | |||
| 134 | 147 | ||
| 135 | lockdep_assert_held(&devinfo->lock); | 148 | lockdep_assert_held(&devinfo->lock); |
| 136 | cmdinfo->state |= IS_IN_WORK_LIST; | 149 | cmdinfo->state |= IS_IN_WORK_LIST; |
| 137 | schedule_work(&devinfo->work); | 150 | queue_work(workqueue, &devinfo->work); |
| 138 | } | 151 | } |
| 139 | 152 | ||
| 140 | static void uas_zap_pending(struct uas_dev_info *devinfo, int result) | 153 | static void uas_zap_pending(struct uas_dev_info *devinfo, int result) |
| @@ -190,6 +203,9 @@ static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, · 49 unmodified lines | |||
| 190 | struct uas_cmd_info *ci = (void *)&cmnd->SCp; | 203 | struct uas_cmd_info *ci = (void *)&cmnd->SCp; |
| 191 | struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; | 204 | struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; |
| 192 | 205 | ||
| 206 | if (status == -ENODEV) /* too late */ | ||
| 207 | return; | ||
| 208 | |||
| 193 | scmd_printk(KERN_INFO, cmnd, | 209 | scmd_printk(KERN_INFO, cmnd, |
| 194 | "%s %d uas-tag %d inflight:%s%s%s%s%s%s%s%s%s%s%s%s ", | 210 | "%s %d uas-tag %d inflight:%s%s%s%s%s%s%s%s%s%s%s%s ", |
| 195 | prefix, status, cmdinfo->uas_tag, | 211 | prefix, status, cmdinfo->uas_tag, |
| @@ -1226,7 +1242,31 @@ static struct usb_driver uas_driver = { · 1030 unmodified lines | |||
| 1226 | .id_table = uas_usb_ids, | 1242 | .id_table = uas_usb_ids, |
| 1227 | }; | 1243 | }; |
| 1228 | 1244 | ||
| 1229 | module_usb_driver(uas_driver); | 1245 | static int __init uas_init(void) |
| 1246 | { | ||
| 1247 | int rv; | ||
| 1248 | |||
| 1249 | workqueue = alloc_workqueue("uas", WQ_MEM_RECLAIM, 0); | ||
| 1250 | if (!workqueue) | ||
| 1251 | return -ENOMEM; | ||
| 1252 | |||
| 1253 | rv = usb_register(&uas_driver); | ||
| 1254 | if (rv) { | ||
| 1255 | destroy_workqueue(workqueue); | ||
| 1256 | return -ENOMEM; | ||
| 1257 | } | ||
| 1258 | |||
| 1259 | return 0; | ||
| 1260 | } | ||
| 1261 | |||
| 1262 | static void __exit uas_exit(void) | ||
| 1263 | { | ||
| 1264 | usb_deregister(&uas_driver); | ||
| 1265 | destroy_workqueue(workqueue); | ||
| 1266 | } | ||
| 1267 | |||
| 1268 | module_init(uas_init); | ||
| 1269 | module_exit(uas_exit); | ||
| 1230 | 1270 | ||
| 1231 | MODULE_LICENSE("GPL"); | 1271 | MODULE_LICENSE("GPL"); |
| 1232 | MODULE_IMPORT_NS(USB_STORAGE); | 1272 | MODULE_IMPORT_NS(USB_STORAGE); |
| @@ -2323,6 +2323,13 @@ UNUSUAL_DEV( 0x3340, 0xffff, 0x0000, 0x0000, · 2322 unmodified lines | |||
| 2323 | USB_SC_DEVICE,USB_PR_DEVICE,NULL, | 2323 | USB_SC_DEVICE,USB_PR_DEVICE,NULL, |
| 2324 | US_FL_MAX_SECTORS_64 ), | 2324 | US_FL_MAX_SECTORS_64 ), |
| 2325 | 2325 | ||
| 2326 | /* Reported by Cyril Roelandt <tipecaml@gmail.com> */ | ||
| 2327 | UNUSUAL_DEV( 0x357d, 0x7788, 0x0114, 0x0114, | ||
| 2328 | "JMicron", | ||
| 2329 | "USB to ATA/ATAPI Bridge", | ||
| 2330 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
| 2331 | US_FL_BROKEN_FUA ), | ||
| 2332 | |||
| 2326 | /* Reported by Andrey Rahmatullin <wrar@altlinux.org> */ | 2333 | /* Reported by Andrey Rahmatullin <wrar@altlinux.org> */ |
| 2327 | UNUSUAL_DEV( 0x4102, 0x1020, 0x0100, 0x0100, | 2334 | UNUSUAL_DEV( 0x4102, 0x1020, 0x0100, 0x0100, |
| 2328 | "iRiver", | 2335 | "iRiver", |
| @@ -198,7 +198,10 @@ EXPORT_SYMBOL_GPL(typec_altmode_vdm); · 197 unmodified lines | |||
| 198 | const struct typec_altmode * | 198 | const struct typec_altmode * |
| 199 | typec_altmode_get_partner(struct typec_altmode *adev) | 199 | typec_altmode_get_partner(struct typec_altmode *adev) |
| 200 | { | 200 | { |
| 201 | return adev ? &to_altmode(adev)->partner->adev : NULL; | 201 | if (!adev || !to_altmode(adev)->partner) |
| 202 | return NULL; | ||
| 203 | |||
| 204 | return &to_altmode(adev)->partner->adev; | ||
| 202 | } | 205 | } |
| 203 | EXPORT_SYMBOL_GPL(typec_altmode_get_partner); | 206 | EXPORT_SYMBOL_GPL(typec_altmode_get_partner); |
| 204 | 207 | ||
| @@ -114,8 +114,8 @@ pi3usb30532_mux_set(struct typec_mux *mux, struct typec_mux_state *state) · 113 unmodified lines | |||
| 114 | static int pi3usb30532_probe(struct i2c_client *client) | 114 | static int pi3usb30532_probe(struct i2c_client *client) |
| 115 | { | 115 | { |
| 116 | struct device *dev = &client->dev; | 116 | struct device *dev = &client->dev; |
| 117 | struct typec_switch_desc sw_desc; | 117 | struct typec_switch_desc sw_desc = { }; |
| 118 | struct typec_mux_desc mux_desc; | 118 | struct typec_mux_desc mux_desc = { }; |
| 119 | struct pi3usb30532 *pi; | 119 | struct pi3usb30532 *pi; |
| 120 | int ret; | 120 | int ret; |
| 121 | 121 | ||
| @@ -3794,6 +3794,14 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1, · 3793 unmodified lines | |||
| 3794 | */ | 3794 | */ |
| 3795 | break; | 3795 | break; |
| 3796 | 3796 | ||
| 3797 | case PORT_RESET: | ||
| 3798 | case PORT_RESET_WAIT_OFF: | ||
| 3799 | /* | ||
| 3800 | * State set back to default mode once the timer completes. | ||
| 3801 | * Ignore CC changes here. | ||
| 3802 | */ | ||
| 3803 | break; | ||
| 3804 | |||
| 3797 | default: | 3805 | default: |
| 3798 | if (tcpm_port_is_disconnected(port)) | 3806 | if (tcpm_port_is_disconnected(port)) |
| 3799 | tcpm_set_state(port, unattached_state(port), 0); | 3807 | tcpm_set_state(port, unattached_state(port), 0); |
| @@ -3855,6 +3863,15 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port) · 55 unmodified lines | |||
| 3855 | case SRC_TRY_DEBOUNCE: | 3863 | case SRC_TRY_DEBOUNCE: |
| 3856 | /* Do nothing, waiting for sink detection */ | 3864 | /* Do nothing, waiting for sink detection */ |
| 3857 | break; | 3865 | break; |
| 3866 | |||
| 3867 | case PORT_RESET: | ||
| 3868 | case PORT_RESET_WAIT_OFF: | ||
| 3869 | /* | ||
| 3870 | * State set back to default mode once the timer completes. | ||
| 3871 | * Ignore vbus changes here. | ||
| 3872 | */ | ||
| 3873 | break; | ||
| 3874 | |||
| 3858 | default: | 3875 | default: |
| 3859 | break; | 3876 | break; |
| 3860 | } | 3877 | } |
| @@ -3908,10 +3925,19 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port) · 47 unmodified lines | |||
| 3908 | case PORT_RESET_WAIT_OFF: | 3925 | case PORT_RESET_WAIT_OFF: |
| 3909 | tcpm_set_state(port, tcpm_default_state(port), 0); | 3926 | tcpm_set_state(port, tcpm_default_state(port), 0); |
| 3910 | break; | 3927 | break; |
| 3928 | |||
| 3911 | case SRC_TRY_WAIT: | 3929 | case SRC_TRY_WAIT: |
| 3912 | case SRC_TRY_DEBOUNCE: | 3930 | case SRC_TRY_DEBOUNCE: |
| 3913 | /* Do nothing, waiting for sink detection */ | 3931 | /* Do nothing, waiting for sink detection */ |
| 3914 | break; | 3932 | break; |
| 3933 | |||
| 3934 | case PORT_RESET: | ||
| 3935 | /* | ||
| 3936 | * State set back to default mode once the timer completes. | ||
| 3937 | * Ignore vbus changes here. | ||
| 3938 | */ | ||
| 3939 | break; | ||
| 3940 | |||
| 3915 | default: | 3941 | default: |
| 3916 | if (port->pwr_role == TYPEC_SINK && | 3942 | if (port->pwr_role == TYPEC_SINK && |
| 3917 | port->attached) | 3943 | port->attached) |
| @@ -1,21 +1,16 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | config VDPA | 2 | menuconfig VDPA |
| 3 | tristate | 3 | tristate "vDPA drivers" |
| 4 | help | 4 | help |
| 5 | Enable this module to support vDPA device that uses a | 5 | Enable this module to support vDPA device that uses a |
| 6 | datapath which complies with virtio specifications with | 6 | datapath which complies with virtio specifications with |
| 7 | vendor specific control path. | 7 | vendor specific control path. |
| 8 | 8 | ||
| 9 | menuconfig VDPA_MENU | 9 | if VDPA |
| 10 | bool "VDPA drivers" | ||
| 11 | default n | ||
| 12 | |||
| 13 | if VDPA_MENU | ||
| 14 | 10 | ||
| 15 | config VDPA_SIM | 11 | config VDPA_SIM |
| 16 | tristate "vDPA device simulator" | 12 | tristate "vDPA device simulator" |
| 17 | depends on RUNTIME_TESTING_MENU | 13 | depends on RUNTIME_TESTING_MENU && HAS_DMA && VHOST_DPN |
| 18 | select VDPA | ||
| 19 | select VHOST_RING | 14 | select VHOST_RING |
| 20 | default n | 15 | default n |
| 21 | help | 16 | help |
| @@ -24,9 +19,8 @@ config VDPA_SIM · 2 unmodified lines | |||
| 24 | development of vDPA. | 19 | development of vDPA. |
| 25 | 20 | ||
| 26 | config IFCVF | 21 | config IFCVF |
| 27 | tristate "Intel IFC VF VDPA driver" | 22 | tristate "Intel IFC VF vDPA driver" |
| 28 | depends on PCI_MSI | 23 | depends on PCI_MSI |
| 29 | select VDPA | ||
| 30 | default n | 24 | default n |
| 31 | help | 25 | help |
| 32 | This kernel module can drive Intel IFC VF NIC to offload | 26 | This kernel module can drive Intel IFC VF NIC to offload |
| @@ -34,4 +28,4 @@ config IFCVF · 1 unmodified line | |||
| 34 | To compile this driver as a module, choose M here: the module will | 28 | To compile this driver as a module, choose M here: the module will |
| 35 | be called ifcvf. | 29 | be called ifcvf. |
| 36 | 30 | ||
| 37 | endif # VDPA_MENU | 31 | endif # VDPA |
| @@ -301,12 +301,10 @@ int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u64 num) · 300 unmodified lines | |||
| 301 | 301 | ||
| 302 | static int ifcvf_hw_enable(struct ifcvf_hw *hw) | 302 | static int ifcvf_hw_enable(struct ifcvf_hw *hw) |
| 303 | { | 303 | { |
| 304 | struct ifcvf_lm_cfg __iomem *ifcvf_lm; | ||
| 305 | struct virtio_pci_common_cfg __iomem *cfg; | 304 | struct virtio_pci_common_cfg __iomem *cfg; |
| 306 | struct ifcvf_adapter *ifcvf; | 305 | struct ifcvf_adapter *ifcvf; |
| 307 | u32 i; | 306 | u32 i; |
| 308 | 307 | ||
| 309 | ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg; | ||
| 310 | ifcvf = vf_to_adapter(hw); | 308 | ifcvf = vf_to_adapter(hw); |
| 311 | cfg = hw->common_cfg; | 309 | cfg = hw->common_cfg; |
| 312 | ifc_iowrite16(IFCVF_MSI_CONFIG_OFF, &cfg->msix_config); | 310 | ifc_iowrite16(IFCVF_MSI_CONFIG_OFF, &cfg->msix_config); |
| @@ -31,11 +31,9 @@ static irqreturn_t ifcvf_intr_handler(int irq, void *arg) · 30 unmodified lines | |||
| 31 | static int ifcvf_start_datapath(void *private) | 31 | static int ifcvf_start_datapath(void *private) |
| 32 | { | 32 | { |
| 33 | struct ifcvf_hw *vf = ifcvf_private_to_vf(private); | 33 | struct ifcvf_hw *vf = ifcvf_private_to_vf(private); |
| 34 | struct ifcvf_adapter *ifcvf; | ||
| 35 | u8 status; | 34 | u8 status; |
| 36 | int ret; | 35 | int ret; |
| 37 | 36 | ||
| 38 | ifcvf = vf_to_adapter(vf); | ||
| 39 | vf->nr_vring = IFCVF_MAX_QUEUE_PAIRS * 2; | 37 | vf->nr_vring = IFCVF_MAX_QUEUE_PAIRS * 2; |
| 40 | ret = ifcvf_start_hw(vf); | 38 | ret = ifcvf_start_hw(vf); |
| 41 | if (ret < 0) { | 39 | if (ret < 0) { |
| @@ -228,7 +226,7 @@ static u32 ifcvf_vdpa_get_vendor_id(struct vdpa_device *vdpa_dev) · 186 unmodified lines | |||
| 228 | return IFCVF_SUBSYS_VENDOR_ID; | 226 | return IFCVF_SUBSYS_VENDOR_ID; |
| 229 | } | 227 | } |
| 230 | 228 | ||
| 231 | static u16 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev) | 229 | static u32 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev) |
| 232 | { | 230 | { |
| 233 | return IFCVF_QUEUE_ALIGNMENT; | 231 | return IFCVF_QUEUE_ALIGNMENT; |
| 234 | } | 232 | } |
| @@ -116,7 +116,7 @@ EXPORT_SYMBOL_GPL(__vdpa_alloc_device); · 115 unmodified lines | |||
| 116 | 116 | ||
| 117 | /** | 117 | /** |
| 118 | * vdpa_register_device - register a vDPA device | 118 | * vdpa_register_device - register a vDPA device |
| 119 | * Callers must have a succeed call of vdpa_init_device() before. | 119 | * Callers must have a succeed call of vdpa_alloc_device() before. |
| 120 | * @vdev: the vdpa device to be registered to vDPA bus | 120 | * @vdev: the vdpa device to be registered to vDPA bus |
| 121 | * | 121 | * |
| 122 | * Returns an error when fail to add to vDPA bus | 122 | * Returns an error when fail to add to vDPA bus |
| @@ -435,7 +435,7 @@ static u64 vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx) · 434 unmodified lines | |||
| 435 | return vrh->last_avail_idx; | 435 | return vrh->last_avail_idx; |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | static u16 vdpasim_get_vq_align(struct vdpa_device *vdpa) | 438 | static u32 vdpasim_get_vq_align(struct vdpa_device *vdpa) |
| 439 | { | 439 | { |
| 440 | return VDPASIM_QUEUE_ALIGN; | 440 | return VDPASIM_QUEUE_ALIGN; |
| 441 | } | 441 | } |
| @@ -488,7 +488,7 @@ static u8 vdpasim_get_status(struct vdpa_device *vdpa) · 46 unmodified lines | |||
| 488 | status = vdpasim->status; | 488 | status = vdpasim->status; |
| 489 | spin_unlock(&vdpasim->lock); | 489 | spin_unlock(&vdpasim->lock); |
| 490 | 490 | ||
| 491 | return vdpasim->status; | 491 | return status; |
| 492 | } | 492 | } |
| 493 | 493 | ||
| 494 | static void vdpasim_set_status(struct vdpa_device *vdpa, u8 status) | 494 | static void vdpasim_set_status(struct vdpa_device *vdpa, u8 status) |
| @@ -3,6 +3,8 @@ config VHOST_IOTLB · 2 unmodified lines | |||
| 3 | tristate | 3 | tristate |
| 4 | help | 4 | help |
| 5 | Generic IOTLB implementation for vhost and vringh. | 5 | Generic IOTLB implementation for vhost and vringh. |
| 6 | This option is selected by any driver which needs to support | ||
| 7 | an IOMMU in software. | ||
| 6 | 8 | ||
| 7 | config VHOST_RING | 9 | config VHOST_RING |
| 8 | tristate | 10 | tristate |
| @@ -11,6 +13,15 @@ config VHOST_RING · 2 unmodified lines | |||
| 11 | This option is selected by any driver which needs to access | 13 | This option is selected by any driver which needs to access |
| 12 | the host side of a virtio ring. | 14 | the host side of a virtio ring. |
| 13 | 15 | ||
| 16 | config VHOST_DPN | ||
| 17 | bool | ||
| 18 | depends on !ARM || AEABI | ||
| 19 | default y | ||
| 20 | help | ||
| 21 | Anything selecting VHOST or VHOST_RING must depend on VHOST_DPN. | ||
| 22 | This excludes the deprecated ARM ABI since that forces a 4 byte | ||
| 23 | alignment on all structs - incompatible with virtio spec requirements. | ||
| 24 | |||
| 14 | config VHOST | 25 | config VHOST |
| 15 | tristate | 26 | tristate |
| 16 | select VHOST_IOTLB | 27 | select VHOST_IOTLB |
| @@ -26,7 +37,7 @@ if VHOST_MENU · 9 unmodified lines | |||
| 26 | 37 | ||
| 27 | config VHOST_NET | 38 | config VHOST_NET |
| 28 | tristate "Host kernel accelerator for virtio net" | 39 | tristate "Host kernel accelerator for virtio net" |
| 29 | depends on NET && EVENTFD && (TUN || !TUN) && (TAP || !TAP) | 40 | depends on NET && EVENTFD && (TUN || !TUN) && (TAP || !TAP) && VHOST_DPN |
| 30 | select VHOST | 41 | select VHOST |
| 31 | ---help--- | 42 | ---help--- |
| 32 | This kernel module can be loaded in host kernel to accelerate | 43 | This kernel module can be loaded in host kernel to accelerate |
| @@ -38,7 +49,7 @@ config VHOST_NET · 5 unmodified lines | |||
| 38 | 49 | ||
| 39 | config VHOST_SCSI | 50 | config VHOST_SCSI |
| 40 | tristate "VHOST_SCSI TCM fabric driver" | 51 | tristate "VHOST_SCSI TCM fabric driver" |
| 41 | depends on TARGET_CORE && EVENTFD | 52 | depends on TARGET_CORE && EVENTFD && VHOST_DPN |
| 42 | select VHOST | 53 | select VHOST |
| 43 | default n | 54 | default n |
| 44 | ---help--- | 55 | ---help--- |
| @@ -47,7 +58,7 @@ config VHOST_SCSI · 2 unmodified lines | |||
| 47 | 58 | ||
| 48 | config VHOST_VSOCK | 59 | config VHOST_VSOCK |
| 49 | tristate "vhost virtio-vsock driver" | 60 | tristate "vhost virtio-vsock driver" |
| 50 | depends on VSOCKETS && EVENTFD | 61 | depends on VSOCKETS && EVENTFD && VHOST_DPN |
| 51 | select VHOST | 62 | select VHOST |
| 52 | select VIRTIO_VSOCKETS_COMMON | 63 | select VIRTIO_VSOCKETS_COMMON |
| 53 | default n | 64 | default n |
| @@ -61,9 +72,9 @@ config VHOST_VSOCK · 7 unmodified lines | |||
| 61 | 72 | ||
| 62 | config VHOST_VDPA | 73 | config VHOST_VDPA |
| 63 | tristate "Vhost driver for vDPA-based backend" | 74 | tristate "Vhost driver for vDPA-based backend" |
| 64 | depends on EVENTFD | 75 | depends on EVENTFD && VHOST_DPN |
| 65 | select VHOST | 76 | select VHOST |
| 66 | select VDPA | 77 | depends on VDPA |
| 67 | help | 78 | help |
| 68 | This kernel module can be loaded in host kernel to accelerate | 79 | This kernel module can be loaded in host kernel to accelerate |
| 69 | guest virtio devices with the vDPA-based backends. | 80 | guest virtio devices with the vDPA-based backends. |
| @@ -424,7 +424,7 @@ static void vhost_net_disable_vq(struct vhost_net *n, · 423 unmodified lines | |||
| 424 | struct vhost_net_virtqueue *nvq = | 424 | struct vhost_net_virtqueue *nvq = |
| 425 | container_of(vq, struct vhost_net_virtqueue, vq); | 425 | container_of(vq, struct vhost_net_virtqueue, vq); |
| 426 | struct vhost_poll *poll = n->poll + (nvq - n->vqs); | 426 | struct vhost_poll *poll = n->poll + (nvq - n->vqs); |
| 427 | if (!vq->private_data) | 427 | if (!vhost_vq_get_backend(vq)) |
| 428 | return; | 428 | return; |
| 429 | vhost_poll_stop(poll); | 429 | vhost_poll_stop(poll); |
| 430 | } | 430 | } |
| @@ -437,7 +437,7 @@ static int vhost_net_enable_vq(struct vhost_net *n, · 6 unmodified lines | |||
| 437 | struct vhost_poll *poll = n->poll + (nvq - n->vqs); | 437 | struct vhost_poll *poll = n->poll + (nvq - n->vqs); |
| 438 | struct socket *sock; | 438 | struct socket *sock; |
| 439 | 439 | ||
| 440 | sock = vq->private_data; | 440 | sock = vhost_vq_get_backend(vq); |
| 441 | if (!sock) | 441 | if (!sock) |
| 442 | return 0; | 442 | return 0; |
| 443 | 443 | ||
| @@ -524,7 +524,7 @@ static void vhost_net_busy_poll(struct vhost_net *net, · 80 unmodified lines | |||
| 524 | return; | 524 | return; |
| 525 | 525 | ||
| 526 | vhost_disable_notify(&net->dev, vq); | 526 | vhost_disable_notify(&net->dev, vq); |
| 527 | sock = rvq->private_data; | 527 | sock = vhost_vq_get_backend(rvq); |
| 528 | 528 | ||
| 529 | busyloop_timeout = poll_rx ? rvq->busyloop_timeout: | 529 | busyloop_timeout = poll_rx ? rvq->busyloop_timeout: |
| 530 | tvq->busyloop_timeout; | 530 | tvq->busyloop_timeout; |
| @@ -570,8 +570,10 @@ static int vhost_net_tx_get_vq_desc(struct vhost_net *net, · 39 unmodified lines | |||
| 570 | 570 | ||
| 571 | if (r == tvq->num && tvq->busyloop_timeout) { | 571 | if (r == tvq->num && tvq->busyloop_timeout) { |
| 572 | /* Flush batched packets first */ | 572 | /* Flush batched packets first */ |
| 573 | if (!vhost_sock_zcopy(tvq->private_data)) | 573 | if (!vhost_sock_zcopy(vhost_vq_get_backend(tvq))) |
| 574 | vhost_tx_batch(net, tnvq, tvq->private_data, msghdr); | 574 | vhost_tx_batch(net, tnvq, |
| 575 | vhost_vq_get_backend(tvq), | ||
| 576 | msghdr); | ||
| 575 | 577 | ||
| 576 | vhost_net_busy_poll(net, rvq, tvq, busyloop_intr, false); | 578 | vhost_net_busy_poll(net, rvq, tvq, busyloop_intr, false); |
| 577 | 579 | ||
| @@ -685,7 +687,7 @@ static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq, · 107 unmodified lines | |||
| 685 | struct vhost_virtqueue *vq = &nvq->vq; | 687 | struct vhost_virtqueue *vq = &nvq->vq; |
| 686 | struct vhost_net *net = container_of(vq->dev, struct vhost_net, | 688 | struct vhost_net *net = container_of(vq->dev, struct vhost_net, |
| 687 | dev); | 689 | dev); |
| 688 | struct socket *sock = vq->private_data; | 690 | struct socket *sock = vhost_vq_get_backend(vq); |
| 689 | struct page_frag *alloc_frag = &net->page_frag; | 691 | struct page_frag *alloc_frag = &net->page_frag; |
| 690 | struct virtio_net_hdr *gso; | 692 | struct virtio_net_hdr *gso; |
| 691 | struct xdp_buff *xdp = &nvq->xdp[nvq->batched_xdp]; | 693 | struct xdp_buff *xdp = &nvq->xdp[nvq->batched_xdp]; |
| @@ -952,7 +954,7 @@ static void handle_tx(struct vhost_net *net) · 260 unmodified lines | |||
| 952 | struct socket *sock; | 954 | struct socket *sock; |
| 953 | 955 | ||
| 954 | mutex_lock_nested(&vq->mutex, VHOST_NET_VQ_TX); | 956 | mutex_lock_nested(&vq->mutex, VHOST_NET_VQ_TX); |
| 955 | sock = vq->private_data; | 957 | sock = vhost_vq_get_backend(vq); |
| 956 | if (!sock) | 958 | if (!sock) |
| 957 | goto out; | 959 | goto out; |
| 958 | 960 | ||
| @@ -1121,7 +1123,7 @@ static void handle_rx(struct vhost_net *net) · 162 unmodified lines | |||
| 1121 | int recv_pkts = 0; | 1123 | int recv_pkts = 0; |
| 1122 | 1124 | ||
| 1123 | mutex_lock_nested(&vq->mutex, VHOST_NET_VQ_RX); | 1125 | mutex_lock_nested(&vq->mutex, VHOST_NET_VQ_RX); |
| 1124 | sock = vq->private_data; | 1126 | sock = vhost_vq_get_backend(vq); |
| 1125 | if (!sock) | 1127 | if (!sock) |
| 1126 | goto out; | 1128 | goto out; |
| 1127 | 1129 | ||
| @@ -1345,9 +1347,9 @@ static struct socket *vhost_net_stop_vq(struct vhost_net *n, · 217 unmodified lines | |||
| 1345 | container_of(vq, struct vhost_net_virtqueue, vq); | 1347 | container_of(vq, struct vhost_net_virtqueue, vq); |
| 1346 | 1348 | ||
| 1347 | mutex_lock(&vq->mutex); | 1349 | mutex_lock(&vq->mutex); |
| 1348 | sock = vq->private_data; | 1350 | sock = vhost_vq_get_backend(vq); |
| 1349 | vhost_net_disable_vq(n, vq); | 1351 | vhost_net_disable_vq(n, vq); |
| 1350 | vq->private_data = NULL; | 1352 | vhost_vq_set_backend(vq, NULL); |
| 1351 | vhost_net_buf_unproduce(nvq); | 1353 | vhost_net_buf_unproduce(nvq); |
| 1352 | nvq->rx_ring = NULL; | 1354 | nvq->rx_ring = NULL; |
| 1353 | mutex_unlock(&vq->mutex); | 1355 | mutex_unlock(&vq->mutex); |
| @@ -1521,7 +1523,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) · 167 unmodified lines | |||
| 1521 | } | 1523 | } |
| 1522 | 1524 | ||
| 1523 | /* start polling new socket */ | 1525 | /* start polling new socket */ |
| 1524 | oldsock = vq->private_data; | 1526 | oldsock = vhost_vq_get_backend(vq); |
| 1525 | if (sock != oldsock) { | 1527 | if (sock != oldsock) { |
| 1526 | ubufs = vhost_net_ubuf_alloc(vq, | 1528 | ubufs = vhost_net_ubuf_alloc(vq, |
| 1527 | sock && vhost_sock_zcopy(sock)); | 1529 | sock && vhost_sock_zcopy(sock)); |
| @@ -1531,7 +1533,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) · 3 unmodified lines | |||
| 1531 | } | 1533 | } |
| 1532 | 1534 | ||
| 1533 | vhost_net_disable_vq(n, vq); | 1535 | vhost_net_disable_vq(n, vq); |
| 1534 | vq->private_data = sock; | 1536 | vhost_vq_set_backend(vq, sock); |
| 1535 | vhost_net_buf_unproduce(nvq); | 1537 | vhost_net_buf_unproduce(nvq); |
| 1536 | r = vhost_vq_init_access(vq); | 1538 | r = vhost_vq_init_access(vq); |
| 1537 | if (r) | 1539 | if (r) |
| @@ -1568,7 +1570,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) · 30 unmodified lines | |||
| 1568 | return 0; | 1570 | return 0; |
| 1569 | 1571 | ||
| 1570 | err_used: | 1572 | err_used: |
| 1571 | vq->private_data = oldsock; | 1573 | vhost_vq_set_backend(vq, oldsock); |
| 1572 | vhost_net_enable_vq(n, vq); | 1574 | vhost_net_enable_vq(n, vq); |
| 1573 | if (ubufs) | 1575 | if (ubufs) |
| 1574 | vhost_net_ubuf_put_wait_and_free(ubufs); | 1576 | vhost_net_ubuf_put_wait_and_free(ubufs); |
| @@ -452,7 +452,7 @@ vhost_scsi_do_evt_work(struct vhost_scsi *vs, struct vhost_scsi_evt *evt) · 451 unmodified lines | |||
| 452 | unsigned out, in; | 452 | unsigned out, in; |
| 453 | int head, ret; | 453 | int head, ret; |
| 454 | 454 | ||
| 455 | if (!vq->private_data) { | 455 | if (!vhost_vq_get_backend(vq)) { |
| 456 | vs->vs_events_missed = true; | 456 | vs->vs_events_missed = true; |
| 457 | return; | 457 | return; |
| 458 | } | 458 | } |
| @@ -892,7 +892,7 @@ vhost_scsi_get_req(struct vhost_virtqueue *vq, struct vhost_scsi_ctx *vc, · 433 unmodified lines | |||
| 892 | } else { | 892 | } else { |
| 893 | struct vhost_scsi_tpg **vs_tpg, *tpg; | 893 | struct vhost_scsi_tpg **vs_tpg, *tpg; |
| 894 | 894 | ||
| 895 | vs_tpg = vq->private_data; /* validated at handler entry */ | 895 | vs_tpg = vhost_vq_get_backend(vq); /* validated at handler entry */ |
| 896 | 896 | ||
| 897 | tpg = READ_ONCE(vs_tpg[*vc->target]); | 897 | tpg = READ_ONCE(vs_tpg[*vc->target]); |
| 898 | if (unlikely(!tpg)) { | 898 | if (unlikely(!tpg)) { |
| @@ -929,7 +929,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) · 30 unmodified lines | |||
| 929 | * We can handle the vq only after the endpoint is setup by calling the | 929 | * We can handle the vq only after the endpoint is setup by calling the |
| 930 | * VHOST_SCSI_SET_ENDPOINT ioctl. | 930 | * VHOST_SCSI_SET_ENDPOINT ioctl. |
| 931 | */ | 931 | */ |
| 932 | vs_tpg = vq->private_data; | 932 | vs_tpg = vhost_vq_get_backend(vq); |
| 933 | if (!vs_tpg) | 933 | if (!vs_tpg) |
| 934 | goto out; | 934 | goto out; |
| 935 | 935 | ||
| @@ -1184,7 +1184,7 @@ vhost_scsi_ctl_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) · 248 unmodified lines | |||
| 1184 | * We can handle the vq only after the endpoint is setup by calling the | 1184 | * We can handle the vq only after the endpoint is setup by calling the |
| 1185 | * VHOST_SCSI_SET_ENDPOINT ioctl. | 1185 | * VHOST_SCSI_SET_ENDPOINT ioctl. |
| 1186 | */ | 1186 | */ |
| 1187 | if (!vq->private_data) | 1187 | if (!vhost_vq_get_backend(vq)) |
| 1188 | goto out; | 1188 | goto out; |
| 1189 | 1189 | ||
| 1190 | memset(&vc, 0, sizeof(vc)); | 1190 | memset(&vc, 0, sizeof(vc)); |
| @@ -1322,7 +1322,7 @@ static void vhost_scsi_evt_handle_kick(struct vhost_work *work) · 131 unmodified lines | |||
| 1322 | struct vhost_scsi *vs = container_of(vq->dev, struct vhost_scsi, dev); | 1322 | struct vhost_scsi *vs = container_of(vq->dev, struct vhost_scsi, dev); |
| 1323 | 1323 | ||
| 1324 | mutex_lock(&vq->mutex); | 1324 | mutex_lock(&vq->mutex); |
| 1325 | if (!vq->private_data) | 1325 | if (!vhost_vq_get_backend(vq)) |
| 1326 | goto out; | 1326 | goto out; |
| 1327 | 1327 | ||
| 1328 | if (vs->vs_events_missed) | 1328 | if (vs->vs_events_missed) |
| @@ -1460,7 +1460,7 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, · 131 unmodified lines | |||
| 1460 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { | 1460 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { |
| 1461 | vq = &vs->vqs[i].vq; | 1461 | vq = &vs->vqs[i].vq; |
| 1462 | mutex_lock(&vq->mutex); | 1462 | mutex_lock(&vq->mutex); |
| 1463 | vq->private_data = vs_tpg; | 1463 | vhost_vq_set_backend(vq, vs_tpg); |
| 1464 | vhost_vq_init_access(vq); | 1464 | vhost_vq_init_access(vq); |
| 1465 | mutex_unlock(&vq->mutex); | 1465 | mutex_unlock(&vq->mutex); |
| 1466 | } | 1466 | } |
| @@ -1547,7 +1547,7 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs, · 80 unmodified lines | |||
| 1547 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { | 1547 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { |
| 1548 | vq = &vs->vqs[i].vq; | 1548 | vq = &vs->vqs[i].vq; |
| 1549 | mutex_lock(&vq->mutex); | 1549 | mutex_lock(&vq->mutex); |
| 1550 | vq->private_data = NULL; | 1550 | vhost_vq_set_backend(vq, NULL); |
| 1551 | mutex_unlock(&vq->mutex); | 1551 | mutex_unlock(&vq->mutex); |
| 1552 | } | 1552 | } |
| 1553 | } | 1553 | } |
| @@ -49,7 +49,7 @@ static void handle_vq(struct vhost_test *n) · 48 unmodified lines | |||
| 49 | void *private; | 49 | void *private; |
| 50 | 50 | ||
| 51 | mutex_lock(&vq->mutex); | 51 | mutex_lock(&vq->mutex); |
| 52 | private = vq->private_data; | 52 | private = vhost_vq_get_backend(vq); |
| 53 | if (!private) { | 53 | if (!private) { |
| 54 | mutex_unlock(&vq->mutex); | 54 | mutex_unlock(&vq->mutex); |
| 55 | return; | 55 | return; |
| @@ -120,7 +120,7 @@ static int vhost_test_open(struct inode *inode, struct file *f) · 64 unmodified lines | |||
| 120 | vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ]; | 120 | vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ]; |
| 121 | n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick; | 121 | n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick; |
| 122 | vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV, | 122 | vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV, |
| 123 | VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT); | 123 | VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT, NULL); |
| 124 | 124 | ||
| 125 | f->private_data = n; | 125 | f->private_data = n; |
| 126 | 126 | ||
| @@ -133,8 +133,8 @@ static void *vhost_test_stop_vq(struct vhost_test *n, · 6 unmodified lines | |||
| 133 | void *private; | 133 | void *private; |
| 134 | 134 | ||
| 135 | mutex_lock(&vq->mutex); | 135 | mutex_lock(&vq->mutex); |
| 136 | private = vq->private_data; | 136 | private = vhost_vq_get_backend(vq); |
| 137 | vq->private_data = NULL; | 137 | vhost_vq_set_backend(vq, NULL); |
| 138 | mutex_unlock(&vq->mutex); | 138 | mutex_unlock(&vq->mutex); |
| 139 | return private; | 139 | return private; |
| 140 | } | 140 | } |
| @@ -198,8 +198,8 @@ static long vhost_test_run(struct vhost_test *n, int test) · 57 unmodified lines | |||
| 198 | priv = test ? n : NULL; | 198 | priv = test ? n : NULL; |
| 199 | 199 | ||
| 200 | /* start polling new socket */ | 200 | /* start polling new socket */ |
| 201 | oldpriv = vq->private_data; | 201 | oldpriv = vhost_vq_get_backend(vq); |
| 202 | vq->private_data = priv; | 202 | vhost_vq_set_backend(vq, priv); |
| 203 | 203 | ||
| 204 | r = vhost_vq_init_access(&n->vqs[index]); | 204 | r = vhost_vq_init_access(&n->vqs[index]); |
| 205 | 205 | ||
| @@ -225,7 +225,7 @@ static long vhost_test_reset_owner(struct vhost_test *n) · 19 unmodified lines | |||
| 225 | { | 225 | { |
| 226 | void *priv = NULL; | 226 | void *priv = NULL; |
| 227 | long err; | 227 | long err; |
| 228 | struct vhost_umem *umem; | 228 | struct vhost_iotlb *umem; |
| 229 | 229 | ||
| 230 | mutex_lock(&n->dev.mutex); | 230 | mutex_lock(&n->dev.mutex); |
| 231 | err = vhost_dev_check_owner(&n->dev); | 231 | err = vhost_dev_check_owner(&n->dev); |
| @@ -296,7 +296,6 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, · 295 unmodified lines | |||
| 296 | struct vdpa_callback cb; | 296 | struct vdpa_callback cb; |
| 297 | struct vhost_virtqueue *vq; | 297 | struct vhost_virtqueue *vq; |
| 298 | struct vhost_vring_state s; | 298 | struct vhost_vring_state s; |
| 299 | u8 status; | ||
| 300 | u32 idx; | 299 | u32 idx; |
| 301 | long r; | 300 | long r; |
| 302 | 301 | ||
| @@ -310,8 +309,6 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, · 7 unmodified lines | |||
| 310 | idx = array_index_nospec(idx, v->nvqs); | 309 | idx = array_index_nospec(idx, v->nvqs); |
| 311 | vq = &v->vqs[idx]; | 310 | vq = &v->vqs[idx]; |
| 312 | 311 | ||
| 313 | status = ops->get_status(vdpa); | ||
| 314 | |||
| 315 | if (cmd == VHOST_VDPA_SET_VRING_ENABLE) { | 312 | if (cmd == VHOST_VDPA_SET_VRING_ENABLE) { |
| 316 | if (copy_from_user(&s, argp, sizeof(s))) | 313 | if (copy_from_user(&s, argp, sizeof(s))) |
| 317 | return -EFAULT; | 314 | return -EFAULT; |
| @@ -678,8 +675,6 @@ static int vhost_vdpa_open(struct inode *inode, struct file *filep) · 360 unmodified lines | |||
| 678 | int nvqs, i, r, opened; | 675 | int nvqs, i, r, opened; |
| 679 | 676 | ||
| 680 | v = container_of(inode->i_cdev, struct vhost_vdpa, cdev); | 677 | v = container_of(inode->i_cdev, struct vhost_vdpa, cdev); |
| 681 | if (!v) | ||
| 682 | return -ENODEV; | ||
| 683 | 678 | ||
| 684 | opened = atomic_cmpxchg(&v->opened, 0, 1); | 679 | opened = atomic_cmpxchg(&v->opened, 0, 1); |
| 685 | if (opened) | 680 | if (opened) |
| @@ -231,6 +231,33 @@ enum { · 230 unmodified lines | |||
| 231 | (1ULL << VIRTIO_F_VERSION_1) | 231 | (1ULL << VIRTIO_F_VERSION_1) |
| 232 | }; | 232 | }; |
| 233 | 233 | ||
| 234 | /** | ||
| 235 | * vhost_vq_set_backend - Set backend. | ||
| 236 | * | ||
| 237 | * @vq Virtqueue. | ||
| 238 | * @private_data The private data. | ||
| 239 | * | ||
| 240 | * Context: Need to call with vq->mutex acquired. | ||
| 241 | */ | ||
| 242 | static inline void vhost_vq_set_backend(struct vhost_virtqueue *vq, | ||
| 243 | void *private_data) | ||
| 244 | { | ||
| 245 | vq->private_data = private_data; | ||
| 246 | } | ||
| 247 | |||
| 248 | /** | ||
| 249 | * vhost_vq_get_backend - Get backend. | ||
| 250 | * | ||
| 251 | * @vq Virtqueue. | ||
| 252 | * | ||
| 253 | * Context: Need to call with vq->mutex acquired. | ||
| 254 | * Return: Private data previously set with vhost_vq_set_backend. | ||
| 255 | */ | ||
| 256 | static inline void *vhost_vq_get_backend(struct vhost_virtqueue *vq) | ||
| 257 | { | ||
| 258 | return vq->private_data; | ||
| 259 | } | ||
| 260 | |||
| 234 | static inline bool vhost_has_feature(struct vhost_virtqueue *vq, int bit) | 261 | static inline bool vhost_has_feature(struct vhost_virtqueue *vq, int bit) |
| 235 | { | 262 | { |
| 236 | return vq->acked_features & (1ULL << bit); | 263 | return vq->acked_features & (1ULL << bit); |
| @@ -13,9 +13,11 @@ · 12 unmodified lines | |||
| 13 | #include <linux/uaccess.h> | 13 | #include <linux/uaccess.h> |
| 14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
| 15 | #include <linux/export.h> | 15 | #include <linux/export.h> |
| 16 | #if IS_REACHABLE(CONFIG_VHOST_IOTLB) | ||
| 16 | #include <linux/bvec.h> | 17 | #include <linux/bvec.h> |
| 17 | #include <linux/highmem.h> | 18 | #include <linux/highmem.h> |
| 18 | #include <linux/vhost_iotlb.h> | 19 | #include <linux/vhost_iotlb.h> |
| 20 | #endif | ||
| 19 | #include <uapi/linux/virtio_config.h> | 21 | #include <uapi/linux/virtio_config.h> |
| 20 | 22 | ||
| 21 | static __printf(1,2) __cold void vringh_bad(const char *fmt, ...) | 23 | static __printf(1,2) __cold void vringh_bad(const char *fmt, ...) |
| @@ -1059,6 +1061,8 @@ int vringh_need_notify_kern(struct vringh *vrh) · 1037 unmodified lines | |||
| 1059 | } | 1061 | } |
| 1060 | EXPORT_SYMBOL(vringh_need_notify_kern); | 1062 | EXPORT_SYMBOL(vringh_need_notify_kern); |
| 1061 | 1063 | ||
| 1064 | #if IS_REACHABLE(CONFIG_VHOST_IOTLB) | ||
| 1065 | |||
| 1062 | static int iotlb_translate(const struct vringh *vrh, | 1066 | static int iotlb_translate(const struct vringh *vrh, |
| 1063 | u64 addr, u64 len, struct bio_vec iov[], | 1067 | u64 addr, u64 len, struct bio_vec iov[], |
| 1064 | int iov_size, u32 perm) | 1068 | int iov_size, u32 perm) |
| @@ -1416,5 +1420,6 @@ int vringh_need_notify_iotlb(struct vringh *vrh) · 351 unmodified lines | |||
| 1416 | } | 1420 | } |
| 1417 | EXPORT_SYMBOL(vringh_need_notify_iotlb); | 1421 | EXPORT_SYMBOL(vringh_need_notify_iotlb); |
| 1418 | 1422 | ||
| 1423 | #endif | ||
| 1419 | 1424 | ||
| 1420 | MODULE_LICENSE("GPL"); | 1425 | MODULE_LICENSE("GPL"); |
| @@ -91,7 +91,7 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock, · 90 unmodified lines | |||
| 91 | 91 | ||
| 92 | mutex_lock(&vq->mutex); | 92 | mutex_lock(&vq->mutex); |
| 93 | 93 | ||
| 94 | if (!vq->private_data) | 94 | if (!vhost_vq_get_backend(vq)) |
| 95 | goto out; | 95 | goto out; |
| 96 | 96 | ||
| 97 | /* Avoid further vmexits, we're already processing the virtqueue */ | 97 | /* Avoid further vmexits, we're already processing the virtqueue */ |
| @@ -440,7 +440,7 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work) · 342 unmodified lines | |||
| 440 | 440 | ||
| 441 | mutex_lock(&vq->mutex); | 441 | mutex_lock(&vq->mutex); |
| 442 | 442 | ||
| 443 | if (!vq->private_data) | 443 | if (!vhost_vq_get_backend(vq)) |
| 444 | goto out; | 444 | goto out; |
| 445 | 445 | ||
| 446 | vhost_disable_notify(&vsock->dev, vq); | 446 | vhost_disable_notify(&vsock->dev, vq); |
| @@ -533,8 +533,8 @@ static int vhost_vsock_start(struct vhost_vsock *vsock) · 86 unmodified lines | |||
| 533 | goto err_vq; | 533 | goto err_vq; |
| 534 | } | 534 | } |
| 535 | 535 | ||
| 536 | if (!vq->private_data) { | 536 | if (!vhost_vq_get_backend(vq)) { |
| 537 | vq->private_data = vsock; | 537 | vhost_vq_set_backend(vq, vsock); |
| 538 | ret = vhost_vq_init_access(vq); | 538 | ret = vhost_vq_init_access(vq); |
| 539 | if (ret) | 539 | if (ret) |
| 540 | goto err_vq; | 540 | goto err_vq; |
| @@ -547,14 +547,14 @@ static int vhost_vsock_start(struct vhost_vsock *vsock) · 6 unmodified lines | |||
| 547 | return 0; | 547 | return 0; |
| 548 | 548 | ||
| 549 | err_vq: | 549 | err_vq: |
| 550 | vq->private_data = NULL; | 550 | vhost_vq_set_backend(vq, NULL); |
| 551 | mutex_unlock(&vq->mutex); | 551 | mutex_unlock(&vq->mutex); |
| 552 | 552 | ||
| 553 | for (i = 0; i < ARRAY_SIZE(vsock->vqs); i++) { | 553 | for (i = 0; i < ARRAY_SIZE(vsock->vqs); i++) { |
| 554 | vq = &vsock->vqs[i]; | 554 | vq = &vsock->vqs[i]; |
| 555 | 555 | ||
| 556 | mutex_lock(&vq->mutex); | 556 | mutex_lock(&vq->mutex); |
| 557 | vq->private_data = NULL; | 557 | vhost_vq_set_backend(vq, NULL); |
| 558 | mutex_unlock(&vq->mutex); | 558 | mutex_unlock(&vq->mutex); |
| 559 | } | 559 | } |
| 560 | err: | 560 | err: |
| @@ -577,7 +577,7 @@ static int vhost_vsock_stop(struct vhost_vsock *vsock) · 16 unmodified lines | |||
| 577 | struct vhost_virtqueue *vq = &vsock->vqs[i]; | 577 | struct vhost_virtqueue *vq = &vsock->vqs[i]; |
| 578 | 578 | ||
| 579 | mutex_lock(&vq->mutex); | 579 | mutex_lock(&vq->mutex); |
| 580 | vq->private_data = NULL; | 580 | vhost_vq_set_backend(vq, NULL); |
| 581 | mutex_unlock(&vq->mutex); | 581 | mutex_unlock(&vq->mutex); |
| 582 | } | 582 | } |
| 583 | 583 | ||
| @@ -45,7 +45,7 @@ config VIRTIO_PCI_LEGACY · 44 unmodified lines | |||
| 45 | 45 | ||
| 46 | config VIRTIO_VDPA | 46 | config VIRTIO_VDPA |
| 47 | tristate "vDPA driver for virtio devices" | 47 | tristate "vDPA driver for virtio devices" |
| 48 | select VDPA | 48 | depends on VDPA |
| 49 | select VIRTIO | 49 | select VIRTIO |
| 50 | help | 50 | help |
| 51 | This driver provides support for virtio based paravirtual | 51 | This driver provides support for virtio based paravirtual |
| @@ -165,7 +165,7 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) · 164 unmodified lines | |||
| 165 | 165 | ||
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | int virtballoon_free_page_report(struct page_reporting_dev_info *pr_dev_info, | 168 | static int virtballoon_free_page_report(struct page_reporting_dev_info *pr_dev_info, |
| 169 | struct scatterlist *sg, unsigned int nents) | 169 | struct scatterlist *sg, unsigned int nents) |
| 170 | { | 170 | { |
| 171 | struct virtio_balloon *vb = | 171 | struct virtio_balloon *vb = |
| @@ -580,7 +580,7 @@ static u32 virtio_balloon_cmd_id_received(struct virtio_balloon *vb) · 408 unmodified lines | |||
| 580 | if (test_and_clear_bit(VIRTIO_BALLOON_CONFIG_READ_CMD_ID, | 580 | if (test_and_clear_bit(VIRTIO_BALLOON_CONFIG_READ_CMD_ID, |
| 581 | &vb->config_read_bitmap)) | 581 | &vb->config_read_bitmap)) |
| 582 | virtio_cread(vb->vdev, struct virtio_balloon_config, | 582 | virtio_cread(vb->vdev, struct virtio_balloon_config, |
| 583 | free_page_report_cmd_id, | 583 | free_page_hint_cmd_id, |
| 584 | &vb->cmd_id_received_cache); | 584 | &vb->cmd_id_received_cache); |
| 585 | 585 | ||
| 586 | return vb->cmd_id_received_cache; | 586 | return vb->cmd_id_received_cache; |
| @@ -3,6 +3,7 @@ · 2 unmodified lines | |||
| 3 | #include <linux/virtio.h> | 3 | #include <linux/virtio.h> |
| 4 | #include <linux/virtio_config.h> | 4 | #include <linux/virtio_config.h> |
| 5 | #include <linux/input.h> | 5 | #include <linux/input.h> |
| 6 | #include <linux/slab.h> | ||
| 6 | 7 | ||
| 7 | #include <uapi/linux/virtio_ids.h> | 8 | #include <uapi/linux/virtio_ids.h> |
| 8 | #include <uapi/linux/virtio_input.h> | 9 | #include <uapi/linux/virtio_input.h> |
| @@ -137,10 +137,14 @@ wdt_restart(struct watchdog_device *wdd, unsigned long mode, void *cmd) · 136 unmodified lines | |||
| 137 | { | 137 | { |
| 138 | struct sp805_wdt *wdt = watchdog_get_drvdata(wdd); | 138 | struct sp805_wdt *wdt = watchdog_get_drvdata(wdd); |
| 139 | 139 | ||
| 140 | writel_relaxed(UNLOCK, wdt->base + WDTLOCK); | ||
| 140 | writel_relaxed(0, wdt->base + WDTCONTROL); | 141 | writel_relaxed(0, wdt->base + WDTCONTROL); |
| 141 | writel_relaxed(0, wdt->base + WDTLOAD); | 142 | writel_relaxed(0, wdt->base + WDTLOAD); |
| 142 | writel_relaxed(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL); | 143 | writel_relaxed(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL); |
| 143 | 144 | ||
| 145 | /* Flush posted writes. */ | ||
| 146 | readl_relaxed(wdt->base + WDTLOCK); | ||
| 147 | |||
| 144 | return 0; | 148 | return 0; |
| 145 | } | 149 | } |
| 146 | 150 | ||
| @@ -448,7 +448,14 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn); · 447 unmodified lines | |||
| 448 | int xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t *gnt_refs, | 448 | int xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t *gnt_refs, |
| 449 | unsigned int nr_grefs, void **vaddr) | 449 | unsigned int nr_grefs, void **vaddr) |
| 450 | { | 450 | { |
| 451 | return ring_ops->map(dev, gnt_refs, nr_grefs, vaddr); | 451 | int err; |
| 452 | |||
| 453 | err = ring_ops->map(dev, gnt_refs, nr_grefs, vaddr); | ||
| 454 | /* Some hypervisors are buggy and can return 1. */ | ||
| 455 | if (err > 0) | ||
| 456 | err = GNTST_general_error; | ||
| 457 | |||
| 458 | return err; | ||
| 452 | } | 459 | } |
| 453 | EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc); | 460 | EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc); |
| 454 | 461 | ||
| @@ -169,7 +169,7 @@ static int afs_record_cm_probe(struct afs_call *call, struct afs_server *server) · 168 unmodified lines | |||
| 169 | 169 | ||
| 170 | spin_lock(&server->probe_lock); | 170 | spin_lock(&server->probe_lock); |
| 171 | 171 | ||
| 172 | if (!test_bit(AFS_SERVER_FL_HAVE_EPOCH, &server->flags)) { | 172 | if (!test_and_set_bit(AFS_SERVER_FL_HAVE_EPOCH, &server->flags)) { |
| 173 | server->cm_epoch = call->epoch; | 173 | server->cm_epoch = call->epoch; |
| 174 | server->probe.cm_epoch = call->epoch; | 174 | server->probe.cm_epoch = call->epoch; |
| 175 | goto out; | 175 | goto out; |
| @@ -1032,7 +1032,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) · 1031 unmodified lines | |||
| 1032 | struct dentry *parent; | 1032 | struct dentry *parent; |
| 1033 | struct inode *inode; | 1033 | struct inode *inode; |
| 1034 | struct key *key; | 1034 | struct key *key; |
| 1035 | afs_dataversion_t dir_version; | 1035 | afs_dataversion_t dir_version, invalid_before; |
| 1036 | long de_version; | 1036 | long de_version; |
| 1037 | int ret; | 1037 | int ret; |
| 1038 | 1038 | ||
| @@ -1084,8 +1084,8 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) · 45 unmodified lines | |||
| 1084 | if (de_version == (long)dir_version) | 1084 | if (de_version == (long)dir_version) |
| 1085 | goto out_valid_noupdate; | 1085 | goto out_valid_noupdate; |
| 1086 | 1086 | ||
| 1087 | dir_version = dir->invalid_before; | 1087 | invalid_before = dir->invalid_before; |
| 1088 | if (de_version - (long)dir_version >= 0) | 1088 | if (de_version - (long)invalid_before >= 0) |
| 1089 | goto out_valid; | 1089 | goto out_valid; |
| 1090 | 1090 | ||
| 1091 | _debug("dir modified"); | 1091 | _debug("dir modified"); |
| @@ -1275,6 +1275,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) · 183 unmodified lines | |||
| 1275 | struct afs_fs_cursor fc; | 1275 | struct afs_fs_cursor fc; |
| 1276 | struct afs_vnode *dvnode = AFS_FS_I(dir); | 1276 | struct afs_vnode *dvnode = AFS_FS_I(dir); |
| 1277 | struct key *key; | 1277 | struct key *key; |
| 1278 | afs_dataversion_t data_version; | ||
| 1278 | int ret; | 1279 | int ret; |
| 1279 | 1280 | ||
| 1280 | mode |= S_IFDIR; | 1281 | mode |= S_IFDIR; |
| @@ -1295,7 +1296,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) · 14 unmodified lines | |||
| 1295 | 1296 | ||
| 1296 | ret = -ERESTARTSYS; | 1297 | ret = -ERESTARTSYS; |
| 1297 | if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { | 1298 | if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
| 1298 | afs_dataversion_t data_version = dvnode->status.data_version + 1; | 1299 | data_version = dvnode->status.data_version + 1; |
| 1299 | 1300 | ||
| 1300 | while (afs_select_fileserver(&fc)) { | 1301 | while (afs_select_fileserver(&fc)) { |
| 1301 | fc.cb_break = afs_calc_vnode_cb_break(dvnode); | 1302 | fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
| @@ -1316,10 +1317,14 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) · 14 unmodified lines | |||
| 1316 | goto error_key; | 1317 | goto error_key; |
| 1317 | } | 1318 | } |
| 1318 | 1319 | ||
| 1319 | if (ret == 0 && | 1320 | if (ret == 0) { |
| 1320 | test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) | 1321 | down_write(&dvnode->validate_lock); |
| 1321 | afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, | 1322 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
| 1322 | afs_edit_dir_for_create); | 1323 | dvnode->status.data_version == data_version) |
| 1324 | afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, | ||
| 1325 | afs_edit_dir_for_create); | ||
| 1326 | up_write(&dvnode->validate_lock); | ||
| 1327 | } | ||
| 1323 | 1328 | ||
| 1324 | key_put(key); | 1329 | key_put(key); |
| 1325 | kfree(scb); | 1330 | kfree(scb); |
| @@ -1360,6 +1365,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry) · 34 unmodified lines | |||
| 1360 | struct afs_fs_cursor fc; | 1365 | struct afs_fs_cursor fc; |
| 1361 | struct afs_vnode *dvnode = AFS_FS_I(dir), *vnode = NULL; | 1366 | struct afs_vnode *dvnode = AFS_FS_I(dir), *vnode = NULL; |
| 1362 | struct key *key; | 1367 | struct key *key; |
| 1368 | afs_dataversion_t data_version; | ||
| 1363 | int ret; | 1369 | int ret; |
| 1364 | 1370 | ||
| 1365 | _enter("{%llx:%llu},{%pd}", | 1371 | _enter("{%llx:%llu},{%pd}", |
| @@ -1391,7 +1397,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry) · 25 unmodified lines | |||
| 1391 | 1397 | ||
| 1392 | ret = -ERESTARTSYS; | 1398 | ret = -ERESTARTSYS; |
| 1393 | if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { | 1399 | if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
| 1394 | afs_dataversion_t data_version = dvnode->status.data_version + 1; | 1400 | data_version = dvnode->status.data_version + 1; |
| 1395 | 1401 | ||
| 1396 | while (afs_select_fileserver(&fc)) { | 1402 | while (afs_select_fileserver(&fc)) { |
| 1397 | fc.cb_break = afs_calc_vnode_cb_break(dvnode); | 1403 | fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
| @@ -1404,9 +1410,12 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry) · 6 unmodified lines | |||
| 1404 | ret = afs_end_vnode_operation(&fc); | 1410 | ret = afs_end_vnode_operation(&fc); |
| 1405 | if (ret == 0) { | 1411 | if (ret == 0) { |
| 1406 | afs_dir_remove_subdir(dentry); | 1412 | afs_dir_remove_subdir(dentry); |
| 1407 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) | 1413 | down_write(&dvnode->validate_lock); |
| 1414 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && | ||
| 1415 | dvnode->status.data_version == data_version) | ||
| 1408 | afs_edit_dir_remove(dvnode, &dentry->d_name, | 1416 | afs_edit_dir_remove(dvnode, &dentry->d_name, |
| 1409 | afs_edit_dir_for_rmdir); | 1417 | afs_edit_dir_for_rmdir); |
| 1418 | up_write(&dvnode->validate_lock); | ||
| 1410 | } | 1419 | } |
| 1411 | } | 1420 | } |
| 1412 | 1421 | ||
| @@ -1544,10 +1553,15 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry) · 131 unmodified lines | |||
| 1544 | ret = afs_end_vnode_operation(&fc); | 1553 | ret = afs_end_vnode_operation(&fc); |
| 1545 | if (ret == 0 && !(scb[1].have_status || scb[1].have_error)) | 1554 | if (ret == 0 && !(scb[1].have_status || scb[1].have_error)) |
| 1546 | ret = afs_dir_remove_link(dvnode, dentry, key); | 1555 | ret = afs_dir_remove_link(dvnode, dentry, key); |
| 1547 | if (ret == 0 && | 1556 | |
| 1548 | test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) | 1557 | if (ret == 0) { |
| 1549 | afs_edit_dir_remove(dvnode, &dentry->d_name, | 1558 | down_write(&dvnode->validate_lock); |
| 1550 | afs_edit_dir_for_unlink); | 1559 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
| 1560 | dvnode->status.data_version == data_version) | ||
| 1561 | afs_edit_dir_remove(dvnode, &dentry->d_name, | ||
| 1562 | afs_edit_dir_for_unlink); | ||
| 1563 | up_write(&dvnode->validate_lock); | ||
| 1564 | } | ||
| 1551 | } | 1565 | } |
| 1552 | 1566 | ||
| 1553 | if (need_rehash && ret < 0 && ret != -ENOENT) | 1567 | if (need_rehash && ret < 0 && ret != -ENOENT) |
| @@ -1573,6 +1587,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, · 19 unmodified lines | |||
| 1573 | struct afs_status_cb *scb; | 1587 | struct afs_status_cb *scb; |
| 1574 | struct afs_vnode *dvnode = AFS_FS_I(dir); | 1588 | struct afs_vnode *dvnode = AFS_FS_I(dir); |
| 1575 | struct key *key; | 1589 | struct key *key; |
| 1590 | afs_dataversion_t data_version; | ||
| 1576 | int ret; | 1591 | int ret; |
| 1577 | 1592 | ||
| 1578 | mode |= S_IFREG; | 1593 | mode |= S_IFREG; |
| @@ -1597,7 +1612,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, · 18 unmodified lines | |||
| 1597 | 1612 | ||
| 1598 | ret = -ERESTARTSYS; | 1613 | ret = -ERESTARTSYS; |
| 1599 | if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { | 1614 | if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
| 1600 | afs_dataversion_t data_version = dvnode->status.data_version + 1; | 1615 | data_version = dvnode->status.data_version + 1; |
| 1601 | 1616 | ||
| 1602 | while (afs_select_fileserver(&fc)) { | 1617 | while (afs_select_fileserver(&fc)) { |
| 1603 | fc.cb_break = afs_calc_vnode_cb_break(dvnode); | 1618 | fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
| @@ -1618,9 +1633,12 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, · 14 unmodified lines | |||
| 1618 | goto error_key; | 1633 | goto error_key; |
| 1619 | } | 1634 | } |
| 1620 | 1635 | ||
| 1621 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) | 1636 | down_write(&dvnode->validate_lock); |
| 1637 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && | ||
| 1638 | dvnode->status.data_version == data_version) | ||
| 1622 | afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, | 1639 | afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, |
| 1623 | afs_edit_dir_for_create); | 1640 | afs_edit_dir_for_create); |
| 1641 | up_write(&dvnode->validate_lock); | ||
| 1624 | 1642 | ||
| 1625 | kfree(scb); | 1643 | kfree(scb); |
| 1626 | key_put(key); | 1644 | key_put(key); |
| @@ -1648,6 +1666,7 @@ static int afs_link(struct dentry *from, struct inode *dir, · 21 unmodified lines | |||
| 1648 | struct afs_vnode *dvnode = AFS_FS_I(dir); | 1666 | struct afs_vnode *dvnode = AFS_FS_I(dir); |
| 1649 | struct afs_vnode *vnode = AFS_FS_I(d_inode(from)); | 1667 | struct afs_vnode *vnode = AFS_FS_I(d_inode(from)); |
| 1650 | struct key *key; | 1668 | struct key *key; |
| 1669 | afs_dataversion_t data_version; | ||
| 1651 | int ret; | 1670 | int ret; |
| 1652 | 1671 | ||
| 1653 | _enter("{%llx:%llu},{%llx:%llu},{%pd}", | 1672 | _enter("{%llx:%llu},{%llx:%llu},{%pd}", |
| @@ -1672,7 +1691,7 @@ static int afs_link(struct dentry *from, struct inode *dir, · 18 unmodified lines | |||
| 1672 | 1691 | ||
| 1673 | ret = -ERESTARTSYS; | 1692 | ret = -ERESTARTSYS; |
| 1674 | if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { | 1693 | if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
| 1675 | afs_dataversion_t data_version = dvnode->status.data_version + 1; | 1694 | data_version = dvnode->status.data_version + 1; |
| 1676 | 1695 | ||
| 1677 | if (mutex_lock_interruptible_nested(&vnode->io_lock, 1) < 0) { | 1696 | if (mutex_lock_interruptible_nested(&vnode->io_lock, 1) < 0) { |
| 1678 | afs_end_vnode_operation(&fc); | 1697 | afs_end_vnode_operation(&fc); |
| @@ -1702,9 +1721,12 @@ static int afs_link(struct dentry *from, struct inode *dir, · 23 unmodified lines | |||
| 1702 | goto error_key; | 1721 | goto error_key; |
| 1703 | } | 1722 | } |
| 1704 | 1723 | ||
| 1705 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) | 1724 | down_write(&dvnode->validate_lock); |
| 1725 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && | ||
| 1726 | dvnode->status.data_version == data_version) | ||
| 1706 | afs_edit_dir_add(dvnode, &dentry->d_name, &vnode->fid, | 1727 | afs_edit_dir_add(dvnode, &dentry->d_name, &vnode->fid, |
| 1707 | afs_edit_dir_for_link); | 1728 | afs_edit_dir_for_link); |
| 1729 | up_write(&dvnode->validate_lock); | ||
| 1708 | 1730 | ||
| 1709 | key_put(key); | 1731 | key_put(key); |
| 1710 | kfree(scb); | 1732 | kfree(scb); |
| @@ -1732,6 +1754,7 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry, · 21 unmodified lines | |||
| 1732 | struct afs_status_cb *scb; | 1754 | struct afs_status_cb *scb; |
| 1733 | struct afs_vnode *dvnode = AFS_FS_I(dir); | 1755 | struct afs_vnode *dvnode = AFS_FS_I(dir); |
| 1734 | struct key *key; | 1756 | struct key *key; |
| 1757 | afs_dataversion_t data_version; | ||
| 1735 | int ret; | 1758 | int ret; |
| 1736 | 1759 | ||
| 1737 | _enter("{%llx:%llu},{%pd},%s", | 1760 | _enter("{%llx:%llu},{%pd},%s", |
| @@ -1759,7 +1782,7 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry, · 21 unmodified lines | |||
| 1759 | 1782 | ||
| 1760 | ret = -ERESTARTSYS; | 1783 | ret = -ERESTARTSYS; |
| 1761 | if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { | 1784 | if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
| 1762 | afs_dataversion_t data_version = dvnode->status.data_version + 1; | 1785 | data_version = dvnode->status.data_version + 1; |
| 1763 | 1786 | ||
| 1764 | while (afs_select_fileserver(&fc)) { | 1787 | while (afs_select_fileserver(&fc)) { |
| 1765 | fc.cb_break = afs_calc_vnode_cb_break(dvnode); | 1788 | fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
| @@ -1780,9 +1803,12 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry, · 14 unmodified lines | |||
| 1780 | goto error_key; | 1803 | goto error_key; |
| 1781 | } | 1804 | } |
| 1782 | 1805 | ||
| 1783 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) | 1806 | down_write(&dvnode->validate_lock); |
| 1807 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && | ||
| 1808 | dvnode->status.data_version == data_version) | ||
| 1784 | afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, | 1809 | afs_edit_dir_add(dvnode, &dentry->d_name, &iget_data.fid, |
| 1785 | afs_edit_dir_for_symlink); | 1810 | afs_edit_dir_for_symlink); |
| 1811 | up_write(&dvnode->validate_lock); | ||
| 1786 | 1812 | ||
| 1787 | key_put(key); | 1813 | key_put(key); |
| 1788 | kfree(scb); | 1814 | kfree(scb); |
| @@ -1812,6 +1838,8 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, · 23 unmodified lines | |||
| 1812 | struct dentry *tmp = NULL, *rehash = NULL; | 1838 | struct dentry *tmp = NULL, *rehash = NULL; |
| 1813 | struct inode *new_inode; | 1839 | struct inode *new_inode; |
| 1814 | struct key *key; | 1840 | struct key *key; |
| 1841 | afs_dataversion_t orig_data_version; | ||
| 1842 | afs_dataversion_t new_data_version; | ||
| 1815 | bool new_negative = d_is_negative(new_dentry); | 1843 | bool new_negative = d_is_negative(new_dentry); |
| 1816 | int ret; | 1844 | int ret; |
| 1817 | 1845 | ||
| @@ -1890,10 +1918,6 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, · 72 unmodified lines | |||
| 1890 | 1918 | ||
| 1891 | ret = -ERESTARTSYS; | 1919 | ret = -ERESTARTSYS; |
| 1892 | if (afs_begin_vnode_operation(&fc, orig_dvnode, key, true)) { | 1920 | if (afs_begin_vnode_operation(&fc, orig_dvnode, key, true)) { |
| 1893 | afs_dataversion_t orig_data_version; | ||
| 1894 | afs_dataversion_t new_data_version; | ||
| 1895 | struct afs_status_cb *new_scb = &scb[1]; | ||
| 1896 | |||
| 1897 | orig_data_version = orig_dvnode->status.data_version + 1; | 1921 | orig_data_version = orig_dvnode->status.data_version + 1; |
| 1898 | 1922 | ||
| 1899 | if (orig_dvnode != new_dvnode) { | 1923 | if (orig_dvnode != new_dvnode) { |
| @@ -1904,7 +1928,6 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, · 4 unmodified lines | |||
| 1904 | new_data_version = new_dvnode->status.data_version + 1; | 1928 | new_data_version = new_dvnode->status.data_version + 1; |
| 1905 | } else { | 1929 | } else { |
| 1906 | new_data_version = orig_data_version; | 1930 | new_data_version = orig_data_version; |
| 1907 | new_scb = &scb[0]; | ||
| 1908 | } | 1931 | } |
| 1909 | 1932 | ||
| 1910 | while (afs_select_fileserver(&fc)) { | 1933 | while (afs_select_fileserver(&fc)) { |
| @@ -1912,7 +1935,7 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, · 1 unmodified line | |||
| 1912 | fc.cb_break_2 = afs_calc_vnode_cb_break(new_dvnode); | 1935 | fc.cb_break_2 = afs_calc_vnode_cb_break(new_dvnode); |
| 1913 | afs_fs_rename(&fc, old_dentry->d_name.name, | 1936 | afs_fs_rename(&fc, old_dentry->d_name.name, |
| 1914 | new_dvnode, new_dentry->d_name.name, | 1937 | new_dvnode, new_dentry->d_name.name, |
| 1915 | &scb[0], new_scb); | 1938 | &scb[0], &scb[1]); |
| 1916 | } | 1939 | } |
| 1917 | 1940 | ||
| 1918 | afs_vnode_commit_status(&fc, orig_dvnode, fc.cb_break, | 1941 | afs_vnode_commit_status(&fc, orig_dvnode, fc.cb_break, |
| @@ -1930,18 +1953,25 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, · 11 unmodified lines | |||
| 1930 | if (ret == 0) { | 1953 | if (ret == 0) { |
| 1931 | if (rehash) | 1954 | if (rehash) |
| 1932 | d_rehash(rehash); | 1955 | d_rehash(rehash); |
| 1933 | if (test_bit(AFS_VNODE_DIR_VALID, &orig_dvnode->flags)) | 1956 | down_write(&orig_dvnode->validate_lock); |
| 1934 | afs_edit_dir_remove(orig_dvnode, &old_dentry->d_name, | 1957 | if (test_bit(AFS_VNODE_DIR_VALID, &orig_dvnode->flags) && |
| 1935 | afs_edit_dir_for_rename_0); | 1958 | orig_dvnode->status.data_version == orig_data_version) |
| 1959 | afs_edit_dir_remove(orig_dvnode, &old_dentry->d_name, | ||
| 1960 | afs_edit_dir_for_rename_0); | ||
| 1961 | if (orig_dvnode != new_dvnode) { | ||
| 1962 | up_write(&orig_dvnode->validate_lock); | ||
| 1936 | 1963 | ||
| 1937 | if (!new_negative && | 1964 | down_write(&new_dvnode->validate_lock); |
| 1938 | test_bit(AFS_VNODE_DIR_VALID, &new_dvnode->flags)) | 1965 | } |
| 1939 | afs_edit_dir_remove(new_dvnode, &new_dentry->d_name, | 1966 | if (test_bit(AFS_VNODE_DIR_VALID, &new_dvnode->flags) && |
| 1940 | afs_edit_dir_for_rename_1); | 1967 | orig_dvnode->status.data_version == new_data_version) { |
| 1968 | if (!new_negative) | ||
| 1969 | afs_edit_dir_remove(new_dvnode, &new_dentry->d_name, | ||
| 1970 | afs_edit_dir_for_rename_1); | ||
| 1941 | 1971 | ||
| 1942 | if (test_bit(AFS_VNODE_DIR_VALID, &new_dvnode->flags)) | ||
| 1943 | afs_edit_dir_add(new_dvnode, &new_dentry->d_name, | 1972 | afs_edit_dir_add(new_dvnode, &new_dentry->d_name, |
| 1944 | &vnode->fid, afs_edit_dir_for_rename_2); | 1973 | &vnode->fid, afs_edit_dir_for_rename_2); |
| 1974 | } | ||
| 1945 | 1975 | ||
| 1946 | new_inode = d_inode(new_dentry); | 1976 | new_inode = d_inode(new_dentry); |
| 1947 | if (new_inode) { | 1977 | if (new_inode) { |
| @@ -1957,14 +1987,10 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, · 9 unmodified lines | |||
| 1957 | * Note that if we ever implement RENAME_EXCHANGE, we'll have | 1987 | * Note that if we ever implement RENAME_EXCHANGE, we'll have |
| 1958 | * to update both dentries with opposing dir versions. | 1988 | * to update both dentries with opposing dir versions. |
| 1959 | */ | 1989 | */ |
| 1960 | if (new_dvnode != orig_dvnode) { | 1990 | afs_update_dentry_version(&fc, old_dentry, &scb[1]); |
| 1961 | afs_update_dentry_version(&fc, old_dentry, &scb[1]); | 1991 | afs_update_dentry_version(&fc, new_dentry, &scb[1]); |
| 1962 | afs_update_dentry_version(&fc, new_dentry, &scb[1]); | ||
| 1963 | } else { | ||
| 1964 | afs_update_dentry_version(&fc, old_dentry, &scb[0]); | ||
| 1965 | afs_update_dentry_version(&fc, new_dentry, &scb[0]); | ||
| 1966 | } | ||
| 1967 | d_move(old_dentry, new_dentry); | 1992 | d_move(old_dentry, new_dentry); |
| 1993 | up_write(&new_dvnode->validate_lock); | ||
| 1968 | goto error_tmp; | 1994 | goto error_tmp; |
| 1969 | } | 1995 | } |
| 1970 | 1996 | ||
| @@ -21,6 +21,7 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode · 20 unmodified lines | |||
| 21 | { | 21 | { |
| 22 | struct afs_fs_cursor fc; | 22 | struct afs_fs_cursor fc; |
| 23 | struct afs_status_cb *scb; | 23 | struct afs_status_cb *scb; |
| 24 | afs_dataversion_t dir_data_version; | ||
| 24 | int ret = -ERESTARTSYS; | 25 | int ret = -ERESTARTSYS; |
| 25 | 26 | ||
| 26 | _enter("%pd,%pd", old, new); | 27 | _enter("%pd,%pd", old, new); |
| @@ -31,7 +32,7 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode · 4 unmodified lines | |||
| 31 | 32 | ||
| 32 | trace_afs_silly_rename(vnode, false); | 33 | trace_afs_silly_rename(vnode, false); |
| 33 | if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { | 34 | if (afs_begin_vnode_operation(&fc, dvnode, key, true)) { |
| 34 | afs_dataversion_t dir_data_version = dvnode->status.data_version + 1; | 35 | dir_data_version = dvnode->status.data_version + 1; |
| 35 | 36 | ||
| 36 | while (afs_select_fileserver(&fc)) { | 37 | while (afs_select_fileserver(&fc)) { |
| 37 | fc.cb_break = afs_calc_vnode_cb_break(dvnode); | 38 | fc.cb_break = afs_calc_vnode_cb_break(dvnode); |
| @@ -54,12 +55,15 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode · 16 unmodified lines | |||
| 54 | dvnode->silly_key = key_get(key); | 55 | dvnode->silly_key = key_get(key); |
| 55 | } | 56 | } |
| 56 | 57 | ||
| 57 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) | 58 | down_write(&dvnode->validate_lock); |
| 59 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && | ||
| 60 | dvnode->status.data_version == dir_data_version) { | ||
| 58 | afs_edit_dir_remove(dvnode, &old->d_name, | 61 | afs_edit_dir_remove(dvnode, &old->d_name, |
| 59 | afs_edit_dir_for_silly_0); | 62 | afs_edit_dir_for_silly_0); |
| 60 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) | ||
| 61 | afs_edit_dir_add(dvnode, &new->d_name, | 63 | afs_edit_dir_add(dvnode, &new->d_name, |
| 62 | &vnode->fid, afs_edit_dir_for_silly_1); | 64 | &vnode->fid, afs_edit_dir_for_silly_1); |
| 65 | } | ||
| 66 | up_write(&dvnode->validate_lock); | ||
| 63 | } | 67 | } |
| 64 | 68 | ||
| 65 | kfree(scb); | 69 | kfree(scb); |
| @@ -181,10 +185,14 @@ static int afs_do_silly_unlink(struct afs_vnode *dvnode, struct afs_vnode *vnode · 115 unmodified lines | |||
| 181 | clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags); | 185 | clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags); |
| 182 | } | 186 | } |
| 183 | } | 187 | } |
| 184 | if (ret == 0 && | 188 | if (ret == 0) { |
| 185 | test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) | 189 | down_write(&dvnode->validate_lock); |
| 186 | afs_edit_dir_remove(dvnode, &dentry->d_name, | 190 | if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags) && |
| 187 | afs_edit_dir_for_unlink); | 191 | dvnode->status.data_version == dir_data_version) |
| 192 | afs_edit_dir_remove(dvnode, &dentry->d_name, | ||
| 193 | afs_edit_dir_for_unlink); | ||
| 194 | up_write(&dvnode->validate_lock); | ||
| 195 | } | ||
| 188 | } | 196 | } |
| 189 | 197 | ||
| 190 | kfree(scb); | 198 | kfree(scb); |
| @@ -117,11 +117,8 @@ out: · 116 unmodified lines | |||
| 117 | (unsigned int)rtt, ret); | 117 | (unsigned int)rtt, ret); |
| 118 | 118 | ||
| 119 | have_result |= afs_fs_probe_done(server); | 119 | have_result |= afs_fs_probe_done(server); |
| 120 | if (have_result) { | 120 | if (have_result) |
| 121 | server->probe.have_result = true; | ||
| 122 | wake_up_var(&server->probe.have_result); | ||
| 123 | wake_up_all(&server->probe_wq); | 121 | wake_up_all(&server->probe_wq); |
| 124 | } | ||
| 125 | } | 122 | } |
| 126 | 123 | ||
| 127 | /* | 124 | /* |
| @@ -65,6 +65,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, · 64 unmodified lines | |||
| 65 | bool inline_error = (call->operation_ID == afs_FS_InlineBulkStatus); | 65 | bool inline_error = (call->operation_ID == afs_FS_InlineBulkStatus); |
| 66 | u64 data_version, size; | 66 | u64 data_version, size; |
| 67 | u32 type, abort_code; | 67 | u32 type, abort_code; |
| 68 | int ret; | ||
| 68 | 69 | ||
| 69 | abort_code = ntohl(xdr->abort_code); | 70 | abort_code = ntohl(xdr->abort_code); |
| 70 | 71 | ||
| @@ -78,7 +79,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, · 7 unmodified lines | |||
| 78 | */ | 79 | */ |
| 79 | status->abort_code = abort_code; | 80 | status->abort_code = abort_code; |
| 80 | scb->have_error = true; | 81 | scb->have_error = true; |
| 81 | return 0; | 82 | goto good; |
| 82 | } | 83 | } |
| 83 | 84 | ||
| 84 | pr_warn("Unknown AFSFetchStatus version %u\n", ntohl(xdr->if_version)); | 85 | pr_warn("Unknown AFSFetchStatus version %u\n", ntohl(xdr->if_version)); |
| @@ -87,7 +88,8 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, · 2 unmodified lines | |||
| 87 | 88 | ||
| 88 | if (abort_code != 0 && inline_error) { | 89 | if (abort_code != 0 && inline_error) { |
| 89 | status->abort_code = abort_code; | 90 | status->abort_code = abort_code; |
| 90 | return 0; | 91 | scb->have_error = true; |
| 92 | goto good; | ||
| 91 | } | 93 | } |
| 92 | 94 | ||
| 93 | type = ntohl(xdr->type); | 95 | type = ntohl(xdr->type); |
| @@ -123,13 +125,16 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, · 29 unmodified lines | |||
| 123 | data_version |= (u64)ntohl(xdr->data_version_hi) << 32; | 125 | data_version |= (u64)ntohl(xdr->data_version_hi) << 32; |
| 124 | status->data_version = data_version; | 126 | status->data_version = data_version; |
| 125 | scb->have_status = true; | 127 | scb->have_status = true; |
| 126 | 128 | good: | |
| 129 | ret = 0; | ||
| 130 | advance: | ||
| 127 | *_bp = (const void *)*_bp + sizeof(*xdr); | 131 | *_bp = (const void *)*_bp + sizeof(*xdr); |
| 128 | return 0; | 132 | return ret; |
| 129 | 133 | ||
| 130 | bad: | 134 | bad: |
| 131 | xdr_dump_bad(*_bp); | 135 | xdr_dump_bad(*_bp); |
| 132 | return afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); | 136 | ret = afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
| 137 | goto advance; | ||
| 133 | } | 138 | } |
| 134 | 139 | ||
| 135 | static time64_t xdr_decode_expiry(struct afs_call *call, u32 expiry) | 140 | static time64_t xdr_decode_expiry(struct afs_call *call, u32 expiry) |
| @@ -981,16 +986,16 @@ static int afs_deliver_fs_rename(struct afs_call *call) · 845 unmodified lines | |||
| 981 | if (ret < 0) | 986 | if (ret < 0) |
| 982 | return ret; | 987 | return ret; |
| 983 | 988 | ||
| 984 | /* unmarshall the reply once we've received all of it */ | 989 | /* If the two dirs are the same, we have two copies of the same status |
| 990 | * report, so we just decode it twice. | ||
| 991 | */ | ||
| 985 | bp = call->buffer; | 992 | bp = call->buffer; |
| 986 | ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); | 993 | ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_dir_scb); |
| 987 | if (ret < 0) | 994 | if (ret < 0) |
| 988 | return ret; | 995 | return ret; |
| 989 | if (call->out_dir_scb != call->out_scb) { | 996 | ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); |
| 990 | ret = xdr_decode_AFSFetchStatus(&bp, call, call->out_scb); | 997 | if (ret < 0) |
| 991 | if (ret < 0) | 998 | return ret; |
| 992 | return ret; | ||
| 993 | } | ||
| 994 | xdr_decode_AFSVolSync(&bp, call->out_volsync); | 999 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
| 995 | 1000 | ||
| 996 | _leave(" = 0 [done]"); | 1001 | _leave(" = 0 [done]"); |
| @@ -533,12 +533,10 @@ struct afs_server { · 532 unmodified lines | |||
| 533 | u32 abort_code; | 533 | u32 abort_code; |
| 534 | u32 cm_epoch; | 534 | u32 cm_epoch; |
| 535 | short error; | 535 | short error; |
| 536 | bool have_result; | ||
| 537 | bool responded:1; | 536 | bool responded:1; |
| 538 | bool is_yfs:1; | 537 | bool is_yfs:1; |
| 539 | bool not_yfs:1; | 538 | bool not_yfs:1; |
| 540 | bool local_failure:1; | 539 | bool local_failure:1; |
| 541 | bool no_epoch:1; | ||
| 542 | bool cm_probed:1; | 540 | bool cm_probed:1; |
| 543 | bool said_rebooted:1; | 541 | bool said_rebooted:1; |
| 544 | bool said_inconsistent:1; | 542 | bool said_inconsistent:1; |
| @@ -1335,7 +1333,7 @@ extern struct afs_volume *afs_create_volume(struct afs_fs_context *); · 790 unmodified lines | |||
| 1335 | extern void afs_activate_volume(struct afs_volume *); | 1333 | extern void afs_activate_volume(struct afs_volume *); |
| 1336 | extern void afs_deactivate_volume(struct afs_volume *); | 1334 | extern void afs_deactivate_volume(struct afs_volume *); |
| 1337 | extern void afs_put_volume(struct afs_cell *, struct afs_volume *); | 1335 | extern void afs_put_volume(struct afs_cell *, struct afs_volume *); |
| 1338 | extern int afs_check_volume_status(struct afs_volume *, struct key *); | 1336 | extern int afs_check_volume_status(struct afs_volume *, struct afs_fs_cursor *); |
| 1339 | 1337 | ||
| 1340 | /* | 1338 | /* |
| 1341 | * write.c | 1339 | * write.c |
| @@ -192,7 +192,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc) · 191 unmodified lines | |||
| 192 | write_unlock(&vnode->volume->servers_lock); | 192 | write_unlock(&vnode->volume->servers_lock); |
| 193 | 193 | ||
| 194 | set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags); | 194 | set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags); |
| 195 | error = afs_check_volume_status(vnode->volume, fc->key); | 195 | error = afs_check_volume_status(vnode->volume, fc); |
| 196 | if (error < 0) | 196 | if (error < 0) |
| 197 | goto failed_set_error; | 197 | goto failed_set_error; |
| 198 | 198 | ||
| @@ -281,7 +281,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc) · 82 unmodified lines | |||
| 281 | 281 | ||
| 282 | set_bit(AFS_VOLUME_WAIT, &vnode->volume->flags); | 282 | set_bit(AFS_VOLUME_WAIT, &vnode->volume->flags); |
| 283 | set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags); | 283 | set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags); |
| 284 | error = afs_check_volume_status(vnode->volume, fc->key); | 284 | error = afs_check_volume_status(vnode->volume, fc); |
| 285 | if (error < 0) | 285 | if (error < 0) |
| 286 | goto failed_set_error; | 286 | goto failed_set_error; |
| 287 | 287 | ||
| @@ -341,7 +341,7 @@ start: · 53 unmodified lines | |||
| 341 | /* See if we need to do an update of the volume record. Note that the | 341 | /* See if we need to do an update of the volume record. Note that the |
| 342 | * volume may have moved or even have been deleted. | 342 | * volume may have moved or even have been deleted. |
| 343 | */ | 343 | */ |
| 344 | error = afs_check_volume_status(vnode->volume, fc->key); | 344 | error = afs_check_volume_status(vnode->volume, fc); |
| 345 | if (error < 0) | 345 | if (error < 0) |
| 346 | goto failed_set_error; | 346 | goto failed_set_error; |
| 347 | 347 | ||
| @@ -594,12 +594,9 @@ retry: · 593 unmodified lines | |||
| 594 | } | 594 | } |
| 595 | 595 | ||
| 596 | ret = wait_on_bit(&server->flags, AFS_SERVER_FL_UPDATING, | 596 | ret = wait_on_bit(&server->flags, AFS_SERVER_FL_UPDATING, |
| 597 | TASK_INTERRUPTIBLE); | 597 | (fc->flags & AFS_FS_CURSOR_INTR) ? |
| 598 | TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); | ||
| 598 | if (ret == -ERESTARTSYS) { | 599 | if (ret == -ERESTARTSYS) { |
| 599 | if (!(fc->flags & AFS_FS_CURSOR_INTR) && server->addresses) { | ||
| 600 | _leave(" = t [intr]"); | ||
| 601 | return true; | ||
| 602 | } | ||
| 603 | fc->error = ret; | 600 | fc->error = ret; |
| 604 | _leave(" = f [intr]"); | 601 | _leave(" = f [intr]"); |
| 605 | return false; | 602 | return false; |
| @@ -302,8 +302,8 @@ static void afs_vl_dump_edestaddrreq(const struct afs_vl_cursor *vc) · 301 unmodified lines | |||
| 302 | pr_notice("VC: - nr=%u/%u/%u pf=%u\n", | 302 | pr_notice("VC: - nr=%u/%u/%u pf=%u\n", |
| 303 | a->nr_ipv4, a->nr_addrs, a->max_addrs, | 303 | a->nr_ipv4, a->nr_addrs, a->max_addrs, |
| 304 | a->preferred); | 304 | a->preferred); |
| 305 | pr_notice("VC: - pr=%lx R=%lx F=%lx\n", | 305 | pr_notice("VC: - R=%lx F=%lx\n", |
| 306 | a->probed, a->responded, a->failed); | 306 | a->responded, a->failed); |
| 307 | if (a == vc->ac.alist) | 307 | if (a == vc->ac.alist) |
| 308 | pr_notice("VC: - current\n"); | 308 | pr_notice("VC: - current\n"); |
| 309 | } | 309 | } |
| @@ -281,7 +281,7 @@ error: · 280 unmodified lines | |||
| 281 | /* | 281 | /* |
| 282 | * Make sure the volume record is up to date. | 282 | * Make sure the volume record is up to date. |
| 283 | */ | 283 | */ |
| 284 | int afs_check_volume_status(struct afs_volume *volume, struct key *key) | 284 | int afs_check_volume_status(struct afs_volume *volume, struct afs_fs_cursor *fc) |
| 285 | { | 285 | { |
| 286 | time64_t now = ktime_get_real_seconds(); | 286 | time64_t now = ktime_get_real_seconds(); |
| 287 | int ret, retries = 0; | 287 | int ret, retries = 0; |
| @@ -299,7 +299,7 @@ retry: · 11 unmodified lines | |||
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | if (!test_and_set_bit_lock(AFS_VOLUME_UPDATING, &volume->flags)) { | 301 | if (!test_and_set_bit_lock(AFS_VOLUME_UPDATING, &volume->flags)) { |
| 302 | ret = afs_update_volume_status(volume, key); | 302 | ret = afs_update_volume_status(volume, fc->key); |
| 303 | clear_bit_unlock(AFS_VOLUME_WAIT, &volume->flags); | 303 | clear_bit_unlock(AFS_VOLUME_WAIT, &volume->flags); |
| 304 | clear_bit_unlock(AFS_VOLUME_UPDATING, &volume->flags); | 304 | clear_bit_unlock(AFS_VOLUME_UPDATING, &volume->flags); |
| 305 | wake_up_bit(&volume->flags, AFS_VOLUME_WAIT); | 305 | wake_up_bit(&volume->flags, AFS_VOLUME_WAIT); |
| @@ -312,7 +312,9 @@ retry: · 6 unmodified lines | |||
| 312 | return 0; | 312 | return 0; |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | ret = wait_on_bit(&volume->flags, AFS_VOLUME_WAIT, TASK_INTERRUPTIBLE); | 315 | ret = wait_on_bit(&volume->flags, AFS_VOLUME_WAIT, |
| 316 | (fc->flags & AFS_FS_CURSOR_INTR) ? | ||
| 317 | TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); | ||
| 316 | if (ret == -ERESTARTSYS) { | 318 | if (ret == -ERESTARTSYS) { |
| 317 | _leave(" = %d", ret); | 319 | _leave(" = %d", ret); |
| 318 | return ret; | 320 | return ret; |
| @@ -165,15 +165,15 @@ static void xdr_dump_bad(const __be32 *bp) · 164 unmodified lines | |||
| 165 | int i; | 165 | int i; |
| 166 | 166 | ||
| 167 | pr_notice("YFS XDR: Bad status record\n"); | 167 | pr_notice("YFS XDR: Bad status record\n"); |
| 168 | for (i = 0; i < 5 * 4 * 4; i += 16) { | 168 | for (i = 0; i < 6 * 4 * 4; i += 16) { |
| 169 | memcpy(x, bp, 16); | 169 | memcpy(x, bp, 16); |
| 170 | bp += 4; | 170 | bp += 4; |
| 171 | pr_notice("%03x: %08x %08x %08x %08x\n", | 171 | pr_notice("%03x: %08x %08x %08x %08x\n", |
| 172 | i, ntohl(x[0]), ntohl(x[1]), ntohl(x[2]), ntohl(x[3])); | 172 | i, ntohl(x[0]), ntohl(x[1]), ntohl(x[2]), ntohl(x[3])); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | memcpy(x, bp, 4); | 175 | memcpy(x, bp, 8); |
| 176 | pr_notice("0x50: %08x\n", ntohl(x[0])); | 176 | pr_notice("0x60: %08x %08x\n", ntohl(x[0]), ntohl(x[1])); |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | /* | 179 | /* |
| @@ -186,13 +186,14 @@ static int xdr_decode_YFSFetchStatus(const __be32 **_bp, · 6 unmodified lines | |||
| 186 | const struct yfs_xdr_YFSFetchStatus *xdr = (const void *)*_bp; | 186 | const struct yfs_xdr_YFSFetchStatus *xdr = (const void *)*_bp; |
| 187 | struct afs_file_status *status = &scb->status; | 187 | struct afs_file_status *status = &scb->status; |
| 188 | u32 type; | 188 | u32 type; |
| 189 | int ret; | ||
| 189 | 190 | ||
| 190 | status->abort_code = ntohl(xdr->abort_code); | 191 | status->abort_code = ntohl(xdr->abort_code); |
| 191 | if (status->abort_code != 0) { | 192 | if (status->abort_code != 0) { |
| 192 | if (status->abort_code == VNOVNODE) | 193 | if (status->abort_code == VNOVNODE) |
| 193 | status->nlink = 0; | 194 | status->nlink = 0; |
| 194 | scb->have_error = true; | 195 | scb->have_error = true; |
| 195 | return 0; | 196 | goto good; |
| 196 | } | 197 | } |
| 197 | 198 | ||
| 198 | type = ntohl(xdr->type); | 199 | type = ntohl(xdr->type); |
| @@ -220,13 +221,16 @@ static int xdr_decode_YFSFetchStatus(const __be32 **_bp, · 21 unmodified lines | |||
| 220 | status->size = xdr_to_u64(xdr->size); | 221 | status->size = xdr_to_u64(xdr->size); |
| 221 | status->data_version = xdr_to_u64(xdr->data_version); | 222 | status->data_version = xdr_to_u64(xdr->data_version); |
| 222 | scb->have_status = true; | 223 | scb->have_status = true; |
| 223 | 224 | good: | |
| 225 | ret = 0; | ||
| 226 | advance: | ||
| 224 | *_bp += xdr_size(xdr); | 227 | *_bp += xdr_size(xdr); |
| 225 | return 0; | 228 | return ret; |
| 226 | 229 | ||
| 227 | bad: | 230 | bad: |
| 228 | xdr_dump_bad(*_bp); | 231 | xdr_dump_bad(*_bp); |
| 229 | return afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); | 232 | ret = afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status); |
| 233 | goto advance; | ||
| 230 | } | 234 | } |
| 231 | 235 | ||
| 232 | /* | 236 | /* |
| @@ -1153,11 +1157,9 @@ static int yfs_deliver_fs_rename(struct afs_call *call) · 920 unmodified lines | |||
| 1153 | ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); | 1157 | ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_dir_scb); |
| 1154 | if (ret < 0) | 1158 | if (ret < 0) |
| 1155 | return ret; | 1159 | return ret; |
| 1156 | if (call->out_dir_scb != call->out_scb) { | 1160 | ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); |
| 1157 | ret = xdr_decode_YFSFetchStatus(&bp, call, call->out_scb); | 1161 | if (ret < 0) |
| 1158 | if (ret < 0) | 1162 | return ret; |
| 1159 | return ret; | ||
| 1160 | } | ||
| 1161 | 1163 | ||
| 1162 | xdr_decode_YFSVolSync(&bp, call->out_volsync); | 1164 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
| 1163 | _leave(" = 0 [done]"); | 1165 | _leave(" = 0 [done]"); |
| @@ -19,7 +19,6 @@ · 18 unmodified lines | |||
| 19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
| 20 | #include <linux/blkpg.h> | 20 | #include <linux/blkpg.h> |
| 21 | #include <linux/magic.h> | 21 | #include <linux/magic.h> |
| 22 | #include <linux/dax.h> | ||
| 23 | #include <linux/buffer_head.h> | 22 | #include <linux/buffer_head.h> |
| 24 | #include <linux/swap.h> | 23 | #include <linux/swap.h> |
| 25 | #include <linux/pagevec.h> | 24 | #include <linux/pagevec.h> |
| @@ -1893,6 +1892,16 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part) · 1867 unmodified lines | |||
| 1893 | struct gendisk *disk = bdev->bd_disk; | 1892 | struct gendisk *disk = bdev->bd_disk; |
| 1894 | struct block_device *victim = NULL; | 1893 | struct block_device *victim = NULL; |
| 1895 | 1894 | ||
| 1895 | /* | ||
| 1896 | * Sync early if it looks like we're the last one. If someone else | ||
| 1897 | * opens the block device between now and the decrement of bd_openers | ||
| 1898 | * then we did a sync that we didn't need to, but that's not the end | ||
| 1899 | * of the world and we want to avoid long (could be several minute) | ||
| 1900 | * syncs while holding the mutex. | ||
| 1901 | */ | ||
| 1902 | if (bdev->bd_openers == 1) | ||
| 1903 | sync_blockdev(bdev); | ||
| 1904 | |||
| 1896 | mutex_lock_nested(&bdev->bd_mutex, for_part); | 1905 | mutex_lock_nested(&bdev->bd_mutex, for_part); |
| 1897 | if (for_part) | 1906 | if (for_part) |
| 1898 | bdev->bd_part_count--; | 1907 | bdev->bd_part_count--; |
| @@ -3370,6 +3370,7 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info) · 3369 unmodified lines | |||
| 3370 | space_info->bytes_reserved > 0 || | 3370 | space_info->bytes_reserved > 0 || |
| 3371 | space_info->bytes_may_use > 0)) | 3371 | space_info->bytes_may_use > 0)) |
| 3372 | btrfs_dump_space_info(info, space_info, 0, 0); | 3372 | btrfs_dump_space_info(info, space_info, 0, 0); |
| 3373 | WARN_ON(space_info->reclaim_size > 0); | ||
| 3373 | list_del(&space_info->list); | 3374 | list_del(&space_info->list); |
| 3374 | btrfs_sysfs_remove_space_info(space_info); | 3375 | btrfs_sysfs_remove_space_info(space_info); |
| 3375 | } | 3376 | } |
| @@ -2097,6 +2097,21 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) · 2096 unmodified lines | |||
| 2097 | 2097 | ||
| 2098 | atomic_inc(&root->log_batch); | 2098 | atomic_inc(&root->log_batch); |
| 2099 | 2099 | ||
| 2100 | /* | ||
| 2101 | * If the inode needs a full sync, make sure we use a full range to | ||
| 2102 | * avoid log tree corruption, due to hole detection racing with ordered | ||
| 2103 | * extent completion for adjacent ranges and races between logging and | ||
| 2104 | * completion of ordered extents for adjancent ranges - both races | ||
| 2105 | * could lead to file extent items in the log with overlapping ranges. | ||
| 2106 | * Do this while holding the inode lock, to avoid races with other | ||
| 2107 | * tasks. | ||
| 2108 | */ | ||
| 2109 | if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, | ||
| 2110 | &BTRFS_I(inode)->runtime_flags)) { | ||
| 2111 | start = 0; | ||
| 2112 | end = LLONG_MAX; | ||
| 2113 | } | ||
| 2114 | |||
| 2100 | /* | 2115 | /* |
| 2101 | * Before we acquired the inode's lock, someone may have dirtied more | 2116 | * Before we acquired the inode's lock, someone may have dirtied more |
| 2102 | * pages in the target range. We need to make sure that writeback for | 2117 | * pages in the target range. We need to make sure that writeback for |
| @@ -264,6 +264,7 @@ copy_inline_extent: · 263 unmodified lines | |||
| 264 | size); | 264 | size); |
| 265 | inode_add_bytes(dst, datal); | 265 | inode_add_bytes(dst, datal); |
| 266 | set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &BTRFS_I(dst)->runtime_flags); | 266 | set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &BTRFS_I(dst)->runtime_flags); |
| 267 | ret = btrfs_inode_set_file_extent_range(BTRFS_I(dst), 0, aligned_end); | ||
| 267 | out: | 268 | out: |
| 268 | if (!ret && !trans) { | 269 | if (!ret && !trans) { |
| 269 | /* | 270 | /* |
| @@ -611,8 +611,8 @@ static int should_ignore_root(struct btrfs_root *root) · 610 unmodified lines | |||
| 611 | if (!reloc_root) | 611 | if (!reloc_root) |
| 612 | return 0; | 612 | return 0; |
| 613 | 613 | ||
| 614 | if (btrfs_root_last_snapshot(&reloc_root->root_item) == | 614 | if (btrfs_header_generation(reloc_root->commit_root) == |
| 615 | root->fs_info->running_transaction->transid - 1) | 615 | root->fs_info->running_transaction->transid) |
| 616 | return 0; | 616 | return 0; |
| 617 | /* | 617 | /* |
| 618 | * if there is reloc tree and it was created in previous | 618 | * if there is reloc tree and it was created in previous |
| @@ -1527,8 +1527,7 @@ int btrfs_init_reloc_root(struct btrfs_trans_handle *trans, · 908 unmodified lines | |||
| 1527 | int clear_rsv = 0; | 1527 | int clear_rsv = 0; |
| 1528 | int ret; | 1528 | int ret; |
| 1529 | 1529 | ||
| 1530 | if (!rc || !rc->create_reloc_tree || | 1530 | if (!rc) |
| 1531 | root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) | ||
| 1532 | return 0; | 1531 | return 0; |
| 1533 | 1532 | ||
| 1534 | /* | 1533 | /* |
| @@ -1538,12 +1537,28 @@ int btrfs_init_reloc_root(struct btrfs_trans_handle *trans, · 3 unmodified lines | |||
| 1538 | if (reloc_root_is_dead(root)) | 1537 | if (reloc_root_is_dead(root)) |
| 1539 | return 0; | 1538 | return 0; |
| 1540 | 1539 | ||
| 1540 | /* | ||
| 1541 | * This is subtle but important. We do not do | ||
| 1542 | * record_root_in_transaction for reloc roots, instead we record their | ||
| 1543 | * corresponding fs root, and then here we update the last trans for the | ||
| 1544 | * reloc root. This means that we have to do this for the entire life | ||
| 1545 | * of the reloc root, regardless of which stage of the relocation we are | ||
| 1546 | * in. | ||
| 1547 | */ | ||
| 1541 | if (root->reloc_root) { | 1548 | if (root->reloc_root) { |
| 1542 | reloc_root = root->reloc_root; | 1549 | reloc_root = root->reloc_root; |
| 1543 | reloc_root->last_trans = trans->transid; | 1550 | reloc_root->last_trans = trans->transid; |
| 1544 | return 0; | 1551 | return 0; |
| 1545 | } | 1552 | } |
| 1546 | 1553 | ||
| 1554 | /* | ||
| 1555 | * We are merging reloc roots, we do not need new reloc trees. Also | ||
| 1556 | * reloc trees never need their own reloc tree. | ||
| 1557 | */ | ||
| 1558 | if (!rc->create_reloc_tree || | ||
| 1559 | root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) | ||
| 1560 | return 0; | ||
| 1561 | |||
| 1547 | if (!trans->reloc_reserved) { | 1562 | if (!trans->reloc_reserved) { |
| 1548 | rsv = trans->block_rsv; | 1563 | rsv = trans->block_rsv; |
| 1549 | trans->block_rsv = rc->block_rsv; | 1564 | trans->block_rsv = rc->block_rsv; |
| @@ -361,6 +361,16 @@ int btrfs_can_overcommit(struct btrfs_fs_info *fs_info, · 360 unmodified lines | |||
| 361 | return 0; | 361 | return 0; |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | static void remove_ticket(struct btrfs_space_info *space_info, | ||
| 365 | struct reserve_ticket *ticket) | ||
| 366 | { | ||
| 367 | if (!list_empty(&ticket->list)) { | ||
| 368 | list_del_init(&ticket->list); | ||
| 369 | ASSERT(space_info->reclaim_size >= ticket->bytes); | ||
| 370 | space_info->reclaim_size -= ticket->bytes; | ||
| 371 | } | ||
| 372 | } | ||
| 373 | |||
| 364 | /* | 374 | /* |
| 365 | * This is for space we already have accounted in space_info->bytes_may_use, so | 375 | * This is for space we already have accounted in space_info->bytes_may_use, so |
| 366 | * basically when we're returning space from block_rsv's. | 376 | * basically when we're returning space from block_rsv's. |
| @@ -388,9 +398,7 @@ again: · 21 unmodified lines | |||
| 388 | btrfs_space_info_update_bytes_may_use(fs_info, | 398 | btrfs_space_info_update_bytes_may_use(fs_info, |
| 389 | space_info, | 399 | space_info, |
| 390 | ticket->bytes); | 400 | ticket->bytes); |
| 391 | list_del_init(&ticket->list); | 401 | remove_ticket(space_info, ticket); |
| 392 | ASSERT(space_info->reclaim_size >= ticket->bytes); | ||
| 393 | space_info->reclaim_size -= ticket->bytes; | ||
| 394 | ticket->bytes = 0; | 402 | ticket->bytes = 0; |
| 395 | space_info->tickets_id++; | 403 | space_info->tickets_id++; |
| 396 | wake_up(&ticket->wait); | 404 | wake_up(&ticket->wait); |
| @@ -899,7 +907,7 @@ static bool maybe_fail_all_tickets(struct btrfs_fs_info *fs_info, · 502 unmodified lines | |||
| 899 | btrfs_info(fs_info, "failing ticket with %llu bytes", | 907 | btrfs_info(fs_info, "failing ticket with %llu bytes", |
| 900 | ticket->bytes); | 908 | ticket->bytes); |
| 901 | 909 | ||
| 902 | list_del_init(&ticket->list); | 910 | remove_ticket(space_info, ticket); |
| 903 | ticket->error = -ENOSPC; | 911 | ticket->error = -ENOSPC; |
| 904 | wake_up(&ticket->wait); | 912 | wake_up(&ticket->wait); |
| 905 | 913 | ||
| @@ -1063,7 +1071,7 @@ static void wait_reserve_ticket(struct btrfs_fs_info *fs_info, · 157 unmodified lines | |||
| 1063 | * despite getting an error, resulting in a space leak | 1071 | * despite getting an error, resulting in a space leak |
| 1064 | * (bytes_may_use counter of our space_info). | 1072 | * (bytes_may_use counter of our space_info). |
| 1065 | */ | 1073 | */ |
| 1066 | list_del_init(&ticket->list); | 1074 | remove_ticket(space_info, ticket); |
| 1067 | ticket->error = -EINTR; | 1075 | ticket->error = -EINTR; |
| 1068 | break; | 1076 | break; |
| 1069 | } | 1077 | } |
| @@ -1121,7 +1129,7 @@ static int handle_reserve_ticket(struct btrfs_fs_info *fs_info, · 51 unmodified lines | |||
| 1121 | * either the async reclaim job deletes the ticket from the list | 1129 | * either the async reclaim job deletes the ticket from the list |
| 1122 | * or we delete it ourselves at wait_reserve_ticket(). | 1130 | * or we delete it ourselves at wait_reserve_ticket(). |
| 1123 | */ | 1131 | */ |
| 1124 | list_del_init(&ticket->list); | 1132 | remove_ticket(space_info, ticket); |
| 1125 | if (!ret) | 1133 | if (!ret) |
| 1126 | ret = -ENOSPC; | 1134 | ret = -ENOSPC; |
| 1127 | } | 1135 | } |
| @@ -96,8 +96,8 @@ enum { · 95 unmodified lines | |||
| 96 | static int btrfs_log_inode(struct btrfs_trans_handle *trans, | 96 | static int btrfs_log_inode(struct btrfs_trans_handle *trans, |
| 97 | struct btrfs_root *root, struct btrfs_inode *inode, | 97 | struct btrfs_root *root, struct btrfs_inode *inode, |
| 98 | int inode_only, | 98 | int inode_only, |
| 99 | u64 start, | 99 | const loff_t start, |
| 100 | u64 end, | 100 | const loff_t end, |
| 101 | struct btrfs_log_ctx *ctx); | 101 | struct btrfs_log_ctx *ctx); |
| 102 | static int link_to_fixup_dir(struct btrfs_trans_handle *trans, | 102 | static int link_to_fixup_dir(struct btrfs_trans_handle *trans, |
| 103 | struct btrfs_root *root, | 103 | struct btrfs_root *root, |
| @@ -4533,15 +4533,13 @@ static int btrfs_log_all_xattrs(struct btrfs_trans_handle *trans, · 4429 unmodified lines | |||
| 4533 | static int btrfs_log_holes(struct btrfs_trans_handle *trans, | 4533 | static int btrfs_log_holes(struct btrfs_trans_handle *trans, |
| 4534 | struct btrfs_root *root, | 4534 | struct btrfs_root *root, |
| 4535 | struct btrfs_inode *inode, | 4535 | struct btrfs_inode *inode, |
| 4536 | struct btrfs_path *path, | 4536 | struct btrfs_path *path) |
| 4537 | const u64 start, | ||
| 4538 | const u64 end) | ||
| 4539 | { | 4537 | { |
| 4540 | struct btrfs_fs_info *fs_info = root->fs_info; | 4538 | struct btrfs_fs_info *fs_info = root->fs_info; |
| 4541 | struct btrfs_key key; | 4539 | struct btrfs_key key; |
| 4542 | const u64 ino = btrfs_ino(inode); | 4540 | const u64 ino = btrfs_ino(inode); |
| 4543 | const u64 i_size = i_size_read(&inode->vfs_inode); | 4541 | const u64 i_size = i_size_read(&inode->vfs_inode); |
| 4544 | u64 prev_extent_end = start; | 4542 | u64 prev_extent_end = 0; |
| 4545 | int ret; | 4543 | int ret; |
| 4546 | 4544 | ||
| 4547 | if (!btrfs_fs_incompat(fs_info, NO_HOLES) || i_size == 0) | 4545 | if (!btrfs_fs_incompat(fs_info, NO_HOLES) || i_size == 0) |
| @@ -4549,21 +4547,14 @@ static int btrfs_log_holes(struct btrfs_trans_handle *trans, · 1 unmodified line | |||
| 4549 | 4547 | ||
| 4550 | key.objectid = ino; | 4548 | key.objectid = ino; |
| 4551 | key.type = BTRFS_EXTENT_DATA_KEY; | 4549 | key.type = BTRFS_EXTENT_DATA_KEY; |
| 4552 | key.offset = start; | 4550 | key.offset = 0; |
| 4553 | 4551 | ||
| 4554 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); | 4552 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); |
| 4555 | if (ret < 0) | 4553 | if (ret < 0) |
| 4556 | return ret; | 4554 | return ret; |
| 4557 | 4555 | ||
| 4558 | if (ret > 0 && path->slots[0] > 0) { | ||
| 4559 | btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0] - 1); | ||
| 4560 | if (key.objectid == ino && key.type == BTRFS_EXTENT_DATA_KEY) | ||
| 4561 | path->slots[0]--; | ||
| 4562 | } | ||
| 4563 | |||
| 4564 | while (true) { | 4556 | while (true) { |
| 4565 | struct extent_buffer *leaf = path->nodes[0]; | 4557 | struct extent_buffer *leaf = path->nodes[0]; |
| 4566 | u64 extent_end; | ||
| 4567 | 4558 | ||
| 4568 | if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) { | 4559 | if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) { |
| 4569 | ret = btrfs_next_leaf(root, path); | 4560 | ret = btrfs_next_leaf(root, path); |
| @@ -4580,18 +4571,9 @@ static int btrfs_log_holes(struct btrfs_trans_handle *trans, · 10 unmodified lines | |||
| 4580 | if (key.objectid != ino || key.type != BTRFS_EXTENT_DATA_KEY) | 4571 | if (key.objectid != ino || key.type != BTRFS_EXTENT_DATA_KEY) |
| 4581 | break; | 4572 | break; |
| 4582 | 4573 | ||
| 4583 | extent_end = btrfs_file_extent_end(path); | ||
| 4584 | if (extent_end <= start) | ||
| 4585 | goto next_slot; | ||
| 4586 | |||
| 4587 | /* We have a hole, log it. */ | 4574 | /* We have a hole, log it. */ |
| 4588 | if (prev_extent_end < key.offset) { | 4575 | if (prev_extent_end < key.offset) { |
| 4589 | u64 hole_len; | 4576 | const u64 hole_len = key.offset - prev_extent_end; |
| 4590 | |||
| 4591 | if (key.offset >= end) | ||
| 4592 | hole_len = end - prev_extent_end; | ||
| 4593 | else | ||
| 4594 | hole_len = key.offset - prev_extent_end; | ||
| 4595 | 4577 | ||
| 4596 | /* | 4578 | /* |
| 4597 | * Release the path to avoid deadlocks with other code | 4579 | * Release the path to avoid deadlocks with other code |
| @@ -4621,20 +4603,16 @@ static int btrfs_log_holes(struct btrfs_trans_handle *trans, · 23 unmodified lines | |||
| 4621 | leaf = path->nodes[0]; | 4603 | leaf = path->nodes[0]; |
| 4622 | } | 4604 | } |
| 4623 | 4605 | ||
| 4624 | prev_extent_end = min(extent_end, end); | 4606 | prev_extent_end = btrfs_file_extent_end(path); |
| 4625 | if (extent_end >= end) | ||
| 4626 | break; | ||
| 4627 | next_slot: | ||
| 4628 | path->slots[0]++; | 4607 | path->slots[0]++; |
| 4629 | cond_resched(); | 4608 | cond_resched(); |
| 4630 | } | 4609 | } |
| 4631 | 4610 | ||
| 4632 | if (prev_extent_end < end && prev_extent_end < i_size) { | 4611 | if (prev_extent_end < i_size) { |
| 4633 | u64 hole_len; | 4612 | u64 hole_len; |
| 4634 | 4613 | ||
| 4635 | btrfs_release_path(path); | 4614 | btrfs_release_path(path); |
| 4636 | hole_len = min(ALIGN(i_size, fs_info->sectorsize), end); | 4615 | hole_len = ALIGN(i_size - prev_extent_end, fs_info->sectorsize); |
| 4637 | hole_len -= prev_extent_end; | ||
| 4638 | ret = btrfs_insert_file_extent(trans, root->log_root, | 4616 | ret = btrfs_insert_file_extent(trans, root->log_root, |
| 4639 | ino, prev_extent_end, 0, 0, | 4617 | ino, prev_extent_end, 0, 0, |
| 4640 | hole_len, 0, hole_len, | 4618 | hole_len, 0, hole_len, |
| @@ -4971,8 +4949,6 @@ static int copy_inode_items_to_log(struct btrfs_trans_handle *trans, · 330 unmodified lines | |||
| 4971 | const u64 logged_isize, | 4949 | const u64 logged_isize, |
| 4972 | const bool recursive_logging, | 4950 | const bool recursive_logging, |
| 4973 | const int inode_only, | 4951 | const int inode_only, |
| 4974 | const u64 start, | ||
| 4975 | const u64 end, | ||
| 4976 | struct btrfs_log_ctx *ctx, | 4952 | struct btrfs_log_ctx *ctx, |
| 4977 | bool *need_log_inode_item) | 4953 | bool *need_log_inode_item) |
| 4978 | { | 4954 | { |
| @@ -4981,21 +4957,6 @@ static int copy_inode_items_to_log(struct btrfs_trans_handle *trans, · 2 unmodified lines | |||
| 4981 | int ins_nr = 0; | 4957 | int ins_nr = 0; |
| 4982 | int ret; | 4958 | int ret; |
| 4983 | 4959 | ||
| 4984 | /* | ||
| 4985 | * We must make sure we don't copy extent items that are entirely out of | ||
| 4986 | * the range [start, end - 1]. This is not just an optimization to avoid | ||
| 4987 | * copying but also needed to avoid a corruption where we end up with | ||
| 4988 | * file extent items in the log tree that have overlapping ranges - this | ||
| 4989 | * can happen if we race with ordered extent completion for ranges that | ||
| 4990 | * are outside our target range. For example we copy an extent item and | ||
| 4991 | * when we move to the next leaf, that extent was trimmed and a new one | ||
| 4992 | * covering a subrange of it, but with a higher key, was inserted - we | ||
| 4993 | * would then copy this other extent too, resulting in a log tree with | ||
| 4994 | * 2 extent items that represent overlapping ranges. | ||
| 4995 | * | ||
| 4996 | * We can copy the entire extents at the range bondaries however, even | ||
| 4997 | * if they cover an area outside the target range. That's ok. | ||
| 4998 | */ | ||
| 4999 | while (1) { | 4960 | while (1) { |
| 5000 | ret = btrfs_search_forward(root, min_key, path, trans->transid); | 4961 | ret = btrfs_search_forward(root, min_key, path, trans->transid); |
| 5001 | if (ret < 0) | 4962 | if (ret < 0) |
| @@ -5063,29 +5024,6 @@ again: · 61 unmodified lines | |||
| 5063 | goto next_slot; | 5024 | goto next_slot; |
| 5064 | } | 5025 | } |
| 5065 | 5026 | ||
| 5066 | if (min_key->type == BTRFS_EXTENT_DATA_KEY) { | ||
| 5067 | const u64 extent_end = btrfs_file_extent_end(path); | ||
| 5068 | |||
| 5069 | if (extent_end <= start) { | ||
| 5070 | if (ins_nr > 0) { | ||
| 5071 | ret = copy_items(trans, inode, dst_path, | ||
| 5072 | path, ins_start_slot, | ||
| 5073 | ins_nr, inode_only, | ||
| 5074 | logged_isize); | ||
| 5075 | if (ret < 0) | ||
| 5076 | return ret; | ||
| 5077 | ins_nr = 0; | ||
| 5078 | } | ||
| 5079 | goto next_slot; | ||
| 5080 | } | ||
| 5081 | if (extent_end >= end) { | ||
| 5082 | ins_nr++; | ||
| 5083 | if (ins_nr == 1) | ||
| 5084 | ins_start_slot = path->slots[0]; | ||
| 5085 | break; | ||
| 5086 | } | ||
| 5087 | } | ||
| 5088 | |||
| 5089 | if (ins_nr && ins_start_slot + ins_nr == path->slots[0]) { | 5027 | if (ins_nr && ins_start_slot + ins_nr == path->slots[0]) { |
| 5090 | ins_nr++; | 5028 | ins_nr++; |
| 5091 | goto next_slot; | 5029 | goto next_slot; |
| @@ -5151,8 +5089,8 @@ next_key: · 59 unmodified lines | |||
| 5151 | static int btrfs_log_inode(struct btrfs_trans_handle *trans, | 5089 | static int btrfs_log_inode(struct btrfs_trans_handle *trans, |
| 5152 | struct btrfs_root *root, struct btrfs_inode *inode, | 5090 | struct btrfs_root *root, struct btrfs_inode *inode, |
| 5153 | int inode_only, | 5091 | int inode_only, |
| 5154 | u64 start, | 5092 | const loff_t start, |
| 5155 | u64 end, | 5093 | const loff_t end, |
| 5156 | struct btrfs_log_ctx *ctx) | 5094 | struct btrfs_log_ctx *ctx) |
| 5157 | { | 5095 | { |
| 5158 | struct btrfs_fs_info *fs_info = root->fs_info; | 5096 | struct btrfs_fs_info *fs_info = root->fs_info; |
| @@ -5180,9 +5118,6 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, · 21 unmodified lines | |||
| 5180 | return -ENOMEM; | 5118 | return -ENOMEM; |
| 5181 | } | 5119 | } |
| 5182 | 5120 | ||
| 5183 | start = ALIGN_DOWN(start, fs_info->sectorsize); | ||
| 5184 | end = ALIGN(end, fs_info->sectorsize); | ||
| 5185 | |||
| 5186 | min_key.objectid = ino; | 5121 | min_key.objectid = ino; |
| 5187 | min_key.type = BTRFS_INODE_ITEM_KEY; | 5122 | min_key.type = BTRFS_INODE_ITEM_KEY; |
| 5188 | min_key.offset = 0; | 5123 | min_key.offset = 0; |
| @@ -5298,8 +5233,8 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, · 109 unmodified lines | |||
| 5298 | 5233 | ||
| 5299 | err = copy_inode_items_to_log(trans, inode, &min_key, &max_key, | 5234 | err = copy_inode_items_to_log(trans, inode, &min_key, &max_key, |
| 5300 | path, dst_path, logged_isize, | 5235 | path, dst_path, logged_isize, |
| 5301 | recursive_logging, inode_only, | 5236 | recursive_logging, inode_only, ctx, |
| 5302 | start, end, ctx, &need_log_inode_item); | 5237 | &need_log_inode_item); |
| 5303 | if (err) | 5238 | if (err) |
| 5304 | goto out_unlock; | 5239 | goto out_unlock; |
| 5305 | 5240 | ||
| @@ -5312,7 +5247,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, · 6 unmodified lines | |||
| 5312 | if (max_key.type >= BTRFS_EXTENT_DATA_KEY && !fast_search) { | 5247 | if (max_key.type >= BTRFS_EXTENT_DATA_KEY && !fast_search) { |
| 5313 | btrfs_release_path(path); | 5248 | btrfs_release_path(path); |
| 5314 | btrfs_release_path(dst_path); | 5249 | btrfs_release_path(dst_path); |
| 5315 | err = btrfs_log_holes(trans, root, inode, path, start, end); | 5250 | err = btrfs_log_holes(trans, root, inode, path); |
| 5316 | if (err) | 5251 | if (err) |
| 5317 | goto out_unlock; | 5252 | goto out_unlock; |
| 5318 | } | 5253 | } |
| @@ -967,7 +967,7 @@ grow_dev_page(struct block_device *bdev, sector_t block, · 966 unmodified lines | |||
| 967 | struct page *page; | 967 | struct page *page; |
| 968 | struct buffer_head *bh; | 968 | struct buffer_head *bh; |
| 969 | sector_t end_block; | 969 | sector_t end_block; |
| 970 | int ret = 0; /* Will call free_more_memory() */ | 970 | int ret = 0; |
| 971 | gfp_t gfp_mask; | 971 | gfp_t gfp_mask; |
| 972 | 972 | ||
| 973 | gfp_mask = mapping_gfp_constraint(inode->i_mapping, ~__GFP_FS) | gfp; | 973 | gfp_mask = mapping_gfp_constraint(inode->i_mapping, ~__GFP_FS) | gfp; |
| @@ -1371,6 +1371,17 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size) · 397 unmodified lines | |||
| 1371 | } | 1371 | } |
| 1372 | EXPORT_SYMBOL(__breadahead); | 1372 | EXPORT_SYMBOL(__breadahead); |
| 1373 | 1373 | ||
| 1374 | void __breadahead_gfp(struct block_device *bdev, sector_t block, unsigned size, | ||
| 1375 | gfp_t gfp) | ||
| 1376 | { | ||
| 1377 | struct buffer_head *bh = __getblk_gfp(bdev, block, size, gfp); | ||
| 1378 | if (likely(bh)) { | ||
| 1379 | ll_rw_block(REQ_OP_READ, REQ_RAHEAD, 1, &bh); | ||
| 1380 | brelse(bh); | ||
| 1381 | } | ||
| 1382 | } | ||
| 1383 | EXPORT_SYMBOL(__breadahead_gfp); | ||
| 1384 | |||
| 1374 | /** | 1385 | /** |
| 1375 | * __bread_gfp() - reads a specified block and returns the bh | 1386 | * __bread_gfp() - reads a specified block and returns the bh |
| 1376 | * @bdev: the block_device to read from | 1387 | * @bdev: the block_device to read from |
| @@ -1051,8 +1051,8 @@ static void ceph_async_unlink_cb(struct ceph_mds_client *mdsc, · 1050 unmodified lines | |||
| 1051 | 1051 | ||
| 1052 | /* If op failed, mark everyone involved for errors */ | 1052 | /* If op failed, mark everyone involved for errors */ |
| 1053 | if (result) { | 1053 | if (result) { |
| 1054 | int pathlen; | 1054 | int pathlen = 0; |
| 1055 | u64 base; | 1055 | u64 base = 0; |
| 1056 | char *path = ceph_mdsc_build_path(req->r_dentry, &pathlen, | 1056 | char *path = ceph_mdsc_build_path(req->r_dentry, &pathlen, |
| 1057 | &base, 0); | 1057 | &base, 0); |
| 1058 | 1058 | ||
| @@ -527,8 +527,8 @@ static void ceph_async_create_cb(struct ceph_mds_client *mdsc, · 526 unmodified lines | |||
| 527 | 527 | ||
| 528 | if (result) { | 528 | if (result) { |
| 529 | struct dentry *dentry = req->r_dentry; | 529 | struct dentry *dentry = req->r_dentry; |
| 530 | int pathlen; | 530 | int pathlen = 0; |
| 531 | u64 base; | 531 | u64 base = 0; |
| 532 | char *path = ceph_mdsc_build_path(req->r_dentry, &pathlen, | 532 | char *path = ceph_mdsc_build_path(req->r_dentry, &pathlen, |
| 533 | &base, 0); | 533 | &base, 0); |
| 534 | 534 | ||
| @@ -521,7 +521,7 @@ extern void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc); · 520 unmodified lines | |||
| 521 | 521 | ||
| 522 | static inline void ceph_mdsc_free_path(char *path, int len) | 522 | static inline void ceph_mdsc_free_path(char *path, int len) |
| 523 | { | 523 | { |
| 524 | if (path) | 524 | if (!IS_ERR_OR_NULL(path)) |
| 525 | __putname(path - (PATH_MAX - 1 - len)); | 525 | __putname(path - (PATH_MAX - 1 - len)); |
| 526 | } | 526 | } |
| 527 | 527 | ||
| @@ -1891,7 +1891,8 @@ GLOBAL_EXTERN struct list_head cifs_tcp_ses_list; · 1890 unmodified lines | |||
| 1891 | /* | 1891 | /* |
| 1892 | * This lock protects the cifs_tcp_ses_list, the list of smb sessions per | 1892 | * This lock protects the cifs_tcp_ses_list, the list of smb sessions per |
| 1893 | * tcp session, and the list of tcon's per smb session. It also protects | 1893 | * tcp session, and the list of tcon's per smb session. It also protects |
| 1894 | * the reference counters for the server, smb session, and tcon. Finally, | 1894 | * the reference counters for the server, smb session, and tcon. It also |
| 1895 | * protects some fields in the TCP_Server_Info struct such as dstaddr. Finally, | ||
| 1895 | * changes to the tcon->tidStatus should be done while holding this lock. | 1896 | * changes to the tcon->tidStatus should be done while holding this lock. |
| 1896 | * generally the locks should be taken in order tcp_ses_lock before | 1897 | * generally the locks should be taken in order tcp_ses_lock before |
| 1897 | * tcon->open_file_lock and that before file->file_info_lock since the | 1898 | * tcon->open_file_lock and that before file->file_info_lock since the |
| @@ -594,6 +594,8 @@ decode_lanman_negprot_rsp(struct TCP_Server_Info *server, NEGOTIATE_RSP *pSMBr) · 593 unmodified lines | |||
| 594 | cifs_max_pending); | 594 | cifs_max_pending); |
| 595 | set_credits(server, server->maxReq); | 595 | set_credits(server, server->maxReq); |
| 596 | server->maxBuf = le16_to_cpu(rsp->MaxBufSize); | 596 | server->maxBuf = le16_to_cpu(rsp->MaxBufSize); |
| 597 | /* set up max_read for readpages check */ | ||
| 598 | server->max_read = server->maxBuf; | ||
| 597 | /* even though we do not use raw we might as well set this | 599 | /* even though we do not use raw we might as well set this |
| 598 | accurately, in case we ever find a need for it */ | 600 | accurately, in case we ever find a need for it */ |
| 599 | if ((le16_to_cpu(rsp->RawMode) & RAW_ENABLE) == RAW_ENABLE) { | 601 | if ((le16_to_cpu(rsp->RawMode) & RAW_ENABLE) == RAW_ENABLE) { |
| @@ -755,6 +757,8 @@ CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses) · 155 unmodified lines | |||
| 755 | set_credits(server, server->maxReq); | 757 | set_credits(server, server->maxReq); |
| 756 | /* probably no need to store and check maxvcs */ | 758 | /* probably no need to store and check maxvcs */ |
| 757 | server->maxBuf = le32_to_cpu(pSMBr->MaxBufferSize); | 759 | server->maxBuf = le32_to_cpu(pSMBr->MaxBufferSize); |
| 760 | /* set up max_read for readpages check */ | ||
| 761 | server->max_read = server->maxBuf; | ||
| 758 | server->max_rw = le32_to_cpu(pSMBr->MaxRawSize); | 762 | server->max_rw = le32_to_cpu(pSMBr->MaxRawSize); |
| 759 | cifs_dbg(NOISY, "Max buf = %d\n", ses->server->maxBuf); | 763 | cifs_dbg(NOISY, "Max buf = %d\n", ses->server->maxBuf); |
| 760 | server->capabilities = le32_to_cpu(pSMBr->Capabilities); | 764 | server->capabilities = le32_to_cpu(pSMBr->Capabilities); |
| @@ -375,8 +375,10 @@ static int reconn_set_ipaddr(struct TCP_Server_Info *server) · 374 unmodified lines | |||
| 375 | return rc; | 375 | return rc; |
| 376 | } | 376 | } |
| 377 | 377 | ||
| 378 | spin_lock(&cifs_tcp_ses_lock); | ||
| 378 | rc = cifs_convert_address((struct sockaddr *)&server->dstaddr, ipaddr, | 379 | rc = cifs_convert_address((struct sockaddr *)&server->dstaddr, ipaddr, |
| 379 | strlen(ipaddr)); | 380 | strlen(ipaddr)); |
| 381 | spin_unlock(&cifs_tcp_ses_lock); | ||
| 380 | kfree(ipaddr); | 382 | kfree(ipaddr); |
| 381 | 383 | ||
| 382 | return !rc ? -1 : 0; | 384 | return !rc ? -1 : 0; |
| @@ -3373,6 +3375,10 @@ cifs_find_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) · 2990 unmodified lines | |||
| 3373 | spin_lock(&cifs_tcp_ses_lock); | 3375 | spin_lock(&cifs_tcp_ses_lock); |
| 3374 | list_for_each(tmp, &ses->tcon_list) { | 3376 | list_for_each(tmp, &ses->tcon_list) { |
| 3375 | tcon = list_entry(tmp, struct cifs_tcon, tcon_list); | 3377 | tcon = list_entry(tmp, struct cifs_tcon, tcon_list); |
| 3378 | #ifdef CONFIG_CIFS_DFS_UPCALL | ||
| 3379 | if (tcon->dfs_path) | ||
| 3380 | continue; | ||
| 3381 | #endif | ||
| 3376 | if (!match_tcon(tcon, volume_info)) | 3382 | if (!match_tcon(tcon, volume_info)) |
| 3377 | continue; | 3383 | continue; |
| 3378 | ++tcon->tc_count; | 3384 | ++tcon->tc_count; |
| @@ -61,7 +61,7 @@ static void cifs_set_ops(struct inode *inode) · 60 unmodified lines | |||
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | /* check if server can support readpages */ | 63 | /* check if server can support readpages */ |
| 64 | if (cifs_sb_master_tcon(cifs_sb)->ses->server->maxBuf < | 64 | if (cifs_sb_master_tcon(cifs_sb)->ses->server->max_read < |
| 65 | PAGE_SIZE + MAX_CIFS_HDR_SIZE) | 65 | PAGE_SIZE + MAX_CIFS_HDR_SIZE) |
| 66 | inode->i_data.a_ops = &cifs_addr_ops_smallbuf; | 66 | inode->i_data.a_ops = &cifs_addr_ops_smallbuf; |
| 67 | else | 67 | else |
| @@ -1025,51 +1025,99 @@ int copy_path_name(char *dst, const char *src) · 1024 unmodified lines | |||
| 1025 | } | 1025 | } |
| 1026 | 1026 | ||
| 1027 | struct super_cb_data { | 1027 | struct super_cb_data { |
| 1028 | struct TCP_Server_Info *server; | 1028 | void *data; |
| 1029 | struct super_block *sb; | 1029 | struct super_block *sb; |
| 1030 | }; | 1030 | }; |
| 1031 | 1031 | ||
| 1032 | static void super_cb(struct super_block *sb, void *arg) | 1032 | static void tcp_super_cb(struct super_block *sb, void *arg) |
| 1033 | { | 1033 | { |
| 1034 | struct super_cb_data *d = arg; | 1034 | struct super_cb_data *sd = arg; |
| 1035 | struct TCP_Server_Info *server = sd->data; | ||
| 1035 | struct cifs_sb_info *cifs_sb; | 1036 | struct cifs_sb_info *cifs_sb; |
| 1036 | struct cifs_tcon *tcon; | 1037 | struct cifs_tcon *tcon; |
| 1037 | 1038 | ||
| 1038 | if (d->sb) | 1039 | if (sd->sb) |
| 1039 | return; | 1040 | return; |
| 1040 | 1041 | ||
| 1041 | cifs_sb = CIFS_SB(sb); | 1042 | cifs_sb = CIFS_SB(sb); |
| 1042 | tcon = cifs_sb_master_tcon(cifs_sb); | 1043 | tcon = cifs_sb_master_tcon(cifs_sb); |
| 1043 | if (tcon->ses->server == d->server) | 1044 | if (tcon->ses->server == server) |
| 1044 | d->sb = sb; | 1045 | sd->sb = sb; |
| 1045 | } | 1046 | } |
| 1046 | 1047 | ||
| 1047 | struct super_block *cifs_get_tcp_super(struct TCP_Server_Info *server) | 1048 | static struct super_block *__cifs_get_super(void (*f)(struct super_block *, void *), |
| 1049 | void *data) | ||
| 1048 | { | 1050 | { |
| 1049 | struct super_cb_data d = { | 1051 | struct super_cb_data sd = { |
| 1050 | .server = server, | 1052 | .data = data, |
| 1051 | .sb = NULL, | 1053 | .sb = NULL, |
| 1052 | }; | 1054 | }; |
| 1053 | 1055 | ||
| 1054 | iterate_supers_type(&cifs_fs_type, super_cb, &d); | 1056 | iterate_supers_type(&cifs_fs_type, f, &sd); |
| 1055 | 1057 | ||
| 1056 | if (unlikely(!d.sb)) | 1058 | if (!sd.sb) |
| 1057 | return ERR_PTR(-ENOENT); | 1059 | return ERR_PTR(-EINVAL); |
| 1058 | /* | 1060 | /* |
| 1059 | * Grab an active reference in order to prevent automounts (DFS links) | 1061 | * Grab an active reference in order to prevent automounts (DFS links) |
| 1060 | * of expiring and then freeing up our cifs superblock pointer while | 1062 | * of expiring and then freeing up our cifs superblock pointer while |
| 1061 | * we're doing failover. | 1063 | * we're doing failover. |
| 1062 | */ | 1064 | */ |
| 1063 | cifs_sb_active(d.sb); | 1065 | cifs_sb_active(sd.sb); |
| 1064 | return d.sb; | 1066 | return sd.sb; |
| 1065 | } | 1067 | } |
| 1066 | 1068 | ||
| 1067 | void cifs_put_tcp_super(struct super_block *sb) | 1069 | static void __cifs_put_super(struct super_block *sb) |
| 1068 | { | 1070 | { |
| 1069 | if (!IS_ERR_OR_NULL(sb)) | 1071 | if (!IS_ERR_OR_NULL(sb)) |
| 1070 | cifs_sb_deactive(sb); | 1072 | cifs_sb_deactive(sb); |
| 1071 | } | 1073 | } |
| 1072 | 1074 | ||
| 1075 | struct super_block *cifs_get_tcp_super(struct TCP_Server_Info *server) | ||
| 1076 | { | ||
| 1077 | return __cifs_get_super(tcp_super_cb, server); | ||
| 1078 | } | ||
| 1079 | |||
| 1080 | void cifs_put_tcp_super(struct super_block *sb) | ||
| 1081 | { | ||
| 1082 | __cifs_put_super(sb); | ||
| 1083 | } | ||
| 1084 | |||
| 1085 | #ifdef CONFIG_CIFS_DFS_UPCALL | ||
| 1086 | static void tcon_super_cb(struct super_block *sb, void *arg) | ||
| 1087 | { | ||
| 1088 | struct super_cb_data *sd = arg; | ||
| 1089 | struct cifs_tcon *tcon = sd->data; | ||
| 1090 | struct cifs_sb_info *cifs_sb; | ||
| 1091 | |||
| 1092 | if (sd->sb) | ||
| 1093 | return; | ||
| 1094 | |||
| 1095 | cifs_sb = CIFS_SB(sb); | ||
| 1096 | if (tcon->dfs_path && cifs_sb->origin_fullpath && | ||
| 1097 | !strcasecmp(tcon->dfs_path, cifs_sb->origin_fullpath)) | ||
| 1098 | sd->sb = sb; | ||
| 1099 | } | ||
| 1100 | |||
| 1101 | static inline struct super_block *cifs_get_tcon_super(struct cifs_tcon *tcon) | ||
| 1102 | { | ||
| 1103 | return __cifs_get_super(tcon_super_cb, tcon); | ||
| 1104 | } | ||
| 1105 | |||
| 1106 | static inline void cifs_put_tcon_super(struct super_block *sb) | ||
| 1107 | { | ||
| 1108 | __cifs_put_super(sb); | ||
| 1109 | } | ||
| 1110 | #else | ||
| 1111 | static inline struct super_block *cifs_get_tcon_super(struct cifs_tcon *tcon) | ||
| 1112 | { | ||
| 1113 | return ERR_PTR(-EOPNOTSUPP); | ||
| 1114 | } | ||
| 1115 | |||
| 1116 | static inline void cifs_put_tcon_super(struct super_block *sb) | ||
| 1117 | { | ||
| 1118 | } | ||
| 1119 | #endif | ||
| 1120 | |||
| 1073 | int update_super_prepath(struct cifs_tcon *tcon, const char *prefix, | 1121 | int update_super_prepath(struct cifs_tcon *tcon, const char *prefix, |
| 1074 | size_t prefix_len) | 1122 | size_t prefix_len) |
| 1075 | { | 1123 | { |
| @@ -1077,7 +1125,7 @@ int update_super_prepath(struct cifs_tcon *tcon, const char *prefix, · 1 unmodified line | |||
| 1077 | struct cifs_sb_info *cifs_sb; | 1125 | struct cifs_sb_info *cifs_sb; |
| 1078 | int rc = 0; | 1126 | int rc = 0; |
| 1079 | 1127 | ||
| 1080 | sb = cifs_get_tcp_super(tcon->ses->server); | 1128 | sb = cifs_get_tcon_super(tcon); |
| 1081 | if (IS_ERR(sb)) | 1129 | if (IS_ERR(sb)) |
| 1082 | return PTR_ERR(sb); | 1130 | return PTR_ERR(sb); |
| 1083 | 1131 | ||
| @@ -1099,6 +1147,6 @@ int update_super_prepath(struct cifs_tcon *tcon, const char *prefix, · 15 unmodified lines | |||
| 1099 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH; | 1147 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH; |
| 1100 | 1148 | ||
| 1101 | out: | 1149 | out: |
| 1102 | cifs_put_tcp_super(sb); | 1150 | cifs_put_tcon_super(sb); |
| 1103 | return rc; | 1151 | return rc; |
| 1104 | } | 1152 | } |
| @@ -687,6 +687,11 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon, · 686 unmodified lines | |||
| 687 | if (smb3_encryption_required(tcon)) | 687 | if (smb3_encryption_required(tcon)) |
| 688 | flags |= CIFS_TRANSFORM_REQ; | 688 | flags |= CIFS_TRANSFORM_REQ; |
| 689 | 689 | ||
| 690 | if (!server->ops->new_lease_key) | ||
| 691 | return -EIO; | ||
| 692 | |||
| 693 | server->ops->new_lease_key(pfid); | ||
| 694 | |||
| 690 | memset(rqst, 0, sizeof(rqst)); | 695 | memset(rqst, 0, sizeof(rqst)); |
| 691 | resp_buftype[0] = resp_buftype[1] = CIFS_NO_BUFFER; | 696 | resp_buftype[0] = resp_buftype[1] = CIFS_NO_BUFFER; |
| 692 | memset(rsp_iov, 0, sizeof(rsp_iov)); | 697 | memset(rsp_iov, 0, sizeof(rsp_iov)); |
| @@ -1552,6 +1552,21 @@ SMB2_sess_auth_rawntlmssp_authenticate(struct SMB2_sess_data *sess_data) · 1551 unmodified lines | |||
| 1552 | } | 1552 | } |
| 1553 | 1553 | ||
| 1554 | rc = SMB2_sess_establish_session(sess_data); | 1554 | rc = SMB2_sess_establish_session(sess_data); |
| 1555 | #ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS | ||
| 1556 | if (ses->server->dialect < SMB30_PROT_ID) { | ||
| 1557 | cifs_dbg(VFS, "%s: dumping generated SMB2 session keys\n", __func__); | ||
| 1558 | /* | ||
| 1559 | * The session id is opaque in terms of endianness, so we can't | ||
| 1560 | * print it as a long long. we dump it as we got it on the wire | ||
| 1561 | */ | ||
| 1562 | cifs_dbg(VFS, "Session Id %*ph\n", (int)sizeof(ses->Suid), | ||
| 1563 | &ses->Suid); | ||
| 1564 | cifs_dbg(VFS, "Session Key %*ph\n", | ||
| 1565 | SMB2_NTLMV2_SESSKEY_SIZE, ses->auth_key.response); | ||
| 1566 | cifs_dbg(VFS, "Signing Key %*ph\n", | ||
| 1567 | SMB3_SIGN_KEY_SIZE, ses->auth_key.response); | ||
| 1568 | } | ||
| 1569 | #endif | ||
| 1555 | out: | 1570 | out: |
| 1556 | kfree(ntlmssp_blob); | 1571 | kfree(ntlmssp_blob); |
| 1557 | SMB2_sess_free_buffer(sess_data); | 1572 | SMB2_sess_free_buffer(sess_data); |
| @@ -660,8 +660,8 @@ smb2_verify_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server) · 659 unmodified lines | |||
| 660 | return rc; | 660 | return rc; |
| 661 | 661 | ||
| 662 | if (memcmp(server_response_sig, shdr->Signature, SMB2_SIGNATURE_SIZE)) { | 662 | if (memcmp(server_response_sig, shdr->Signature, SMB2_SIGNATURE_SIZE)) { |
| 663 | dump_stack(); | 663 | cifs_dbg(VFS, "sign fail cmd 0x%x message id 0x%llx\n", |
| 664 | cifs_dbg(VFS, "sign fail cmd 0x%x message id 0x%llx\n", shdr->Command, shdr->MessageId); | 664 | shdr->Command, shdr->MessageId); |
| 665 | return -EACCES; | 665 | return -EACCES; |
| 666 | } else | 666 | } else |
| 667 | return 0; | 667 | return 0; |
| @@ -211,6 +211,8 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm, · 210 unmodified lines | |||
| 211 | return -ENOMEM; | 211 | return -ENOMEM; |
| 212 | (*argv)[(*argc)++] = 0; | 212 | (*argv)[(*argc)++] = 0; |
| 213 | ++pat_ptr; | 213 | ++pat_ptr; |
| 214 | if (!(*pat_ptr)) | ||
| 215 | return -ENOMEM; | ||
| 214 | } | 216 | } |
| 215 | 217 | ||
| 216 | /* Repeat as long as we have more pattern to process and more output | 218 | /* Repeat as long as we have more pattern to process and more output |
| @@ -506,20 +506,11 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_u32_wo, NULL, debugfs_u32_set, "%llu\n"); · 505 unmodified lines | |||
| 506 | * This function creates a file in debugfs with the given name that | 506 | * This function creates a file in debugfs with the given name that |
| 507 | * contains the value of the variable @value. If the @mode variable is so | 507 | * contains the value of the variable @value. If the @mode variable is so |
| 508 | * set, it can be read from, and written to. | 508 | * set, it can be read from, and written to. |
| 509 | * | ||
| 510 | * This function will return a pointer to a dentry if it succeeds. This | ||
| 511 | * pointer must be passed to the debugfs_remove() function when the file is | ||
| 512 | * to be removed (no automatic cleanup happens if your module is unloaded, | ||
| 513 | * you are responsible here.) If an error occurs, ERR_PTR(-ERROR) will be | ||
| 514 | * returned. | ||
| 515 | * | ||
| 516 | * If debugfs is not enabled in the kernel, the value ERR_PTR(-ENODEV) will | ||
| 517 | * be returned. | ||
| 518 | */ | 509 | */ |
| 519 | struct dentry *debugfs_create_u32(const char *name, umode_t mode, | 510 | void debugfs_create_u32(const char *name, umode_t mode, struct dentry *parent, |
| 520 | struct dentry *parent, u32 *value) | 511 | u32 *value) |
| 521 | { | 512 | { |
| 522 | return debugfs_create_mode_unsafe(name, mode, parent, value, &fops_u32, | 513 | debugfs_create_mode_unsafe(name, mode, parent, value, &fops_u32, |
| 523 | &fops_u32_ro, &fops_u32_wo); | 514 | &fops_u32_ro, &fops_u32_wo); |
| 524 | } | 515 | } |
| 525 | EXPORT_SYMBOL_GPL(debugfs_create_u32); | 516 | EXPORT_SYMBOL_GPL(debugfs_create_u32); |
| @@ -91,7 +91,6 @@ static int exfat_allocate_bitmap(struct super_block *sb, · 90 unmodified lines | |||
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | sbi->pbr_bh = NULL; | ||
| 95 | return 0; | 94 | return 0; |
| 96 | } | 95 | } |
| 97 | 96 | ||
| @@ -137,8 +136,6 @@ void exfat_free_bitmap(struct exfat_sb_info *sbi) · 39 unmodified lines | |||
| 137 | { | 136 | { |
| 138 | int i; | 137 | int i; |
| 139 | 138 | ||
| 140 | brelse(sbi->pbr_bh); | ||
| 141 | |||
| 142 | for (i = 0; i < sbi->map_sectors; i++) | 139 | for (i = 0; i < sbi->map_sectors; i++) |
| 143 | __brelse(sbi->vol_amap[i]); | 140 | __brelse(sbi->vol_amap[i]); |
| 144 | 141 | ||
| @@ -507,6 +507,7 @@ void exfat_msg(struct super_block *sb, const char *lv, const char *fmt, ...) · 506 unmodified lines | |||
| 507 | __printf(3, 4) __cold; | 507 | __printf(3, 4) __cold; |
| 508 | void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts, | 508 | void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts, |
| 509 | u8 tz, __le16 time, __le16 date, u8 time_ms); | 509 | u8 tz, __le16 time, __le16 date, u8 time_ms); |
| 510 | void exfat_truncate_atime(struct timespec64 *ts); | ||
| 510 | void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts, | 511 | void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts, |
| 511 | u8 *tz, __le16 *time, __le16 *date, u8 *time_ms); | 512 | u8 *tz, __le16 *time, __le16 *date, u8 *time_ms); |
| 512 | unsigned short exfat_calc_chksum_2byte(void *data, int len, | 513 | unsigned short exfat_calc_chksum_2byte(void *data, int len, |
| @@ -273,6 +273,7 @@ int exfat_getattr(const struct path *path, struct kstat *stat, · 272 unmodified lines | |||
| 273 | struct exfat_inode_info *ei = EXFAT_I(inode); | 273 | struct exfat_inode_info *ei = EXFAT_I(inode); |
| 274 | 274 | ||
| 275 | generic_fillattr(inode, stat); | 275 | generic_fillattr(inode, stat); |
| 276 | exfat_truncate_atime(&stat->atime); | ||
| 276 | stat->result_mask |= STATX_BTIME; | 277 | stat->result_mask |= STATX_BTIME; |
| 277 | stat->btime.tv_sec = ei->i_crtime.tv_sec; | 278 | stat->btime.tv_sec = ei->i_crtime.tv_sec; |
| 278 | stat->btime.tv_nsec = ei->i_crtime.tv_nsec; | 279 | stat->btime.tv_nsec = ei->i_crtime.tv_nsec; |
| @@ -339,6 +340,7 @@ int exfat_setattr(struct dentry *dentry, struct iattr *attr) · 60 unmodified lines | |||
| 339 | } | 340 | } |
| 340 | 341 | ||
| 341 | setattr_copy(inode, attr); | 342 | setattr_copy(inode, attr); |
| 343 | exfat_truncate_atime(&inode->i_atime); | ||
| 342 | mark_inode_dirty(inode); | 344 | mark_inode_dirty(inode); |
| 343 | 345 | ||
| 344 | out: | 346 | out: |
| @@ -88,7 +88,8 @@ void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts, · 87 unmodified lines | |||
| 88 | if (time_ms) { | 88 | if (time_ms) { |
| 89 | ts->tv_sec += time_ms / 100; | 89 | ts->tv_sec += time_ms / 100; |
| 90 | ts->tv_nsec = (time_ms % 100) * 10 * NSEC_PER_MSEC; | 90 | ts->tv_nsec = (time_ms % 100) * 10 * NSEC_PER_MSEC; |
| 91 | } | 91 | } else |
| 92 | ts->tv_nsec = 0; | ||
| 92 | 93 | ||
| 93 | if (tz & EXFAT_TZ_VALID) | 94 | if (tz & EXFAT_TZ_VALID) |
| 94 | /* Adjust timezone to UTC0. */ | 95 | /* Adjust timezone to UTC0. */ |
| @@ -124,6 +125,17 @@ void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts, · 29 unmodified lines | |||
| 124 | *tz = EXFAT_TZ_VALID; | 125 | *tz = EXFAT_TZ_VALID; |
| 125 | } | 126 | } |
| 126 | 127 | ||
| 128 | /* | ||
| 129 | * The timestamp for access_time has double seconds granularity. | ||
| 130 | * (There is no 10msIncrement field for access_time unlike create/modify_time) | ||
| 131 | * atime also has only a 2-second resolution. | ||
| 132 | */ | ||
| 133 | void exfat_truncate_atime(struct timespec64 *ts) | ||
| 134 | { | ||
| 135 | ts->tv_sec = round_down(ts->tv_sec, 2); | ||
| 136 | ts->tv_nsec = 0; | ||
| 137 | } | ||
| 138 | |||
| 127 | unsigned short exfat_calc_chksum_2byte(void *data, int len, | 139 | unsigned short exfat_calc_chksum_2byte(void *data, int len, |
| 128 | unsigned short chksum, int type) | 140 | unsigned short chksum, int type) |
| 129 | { | 141 | { |
| @@ -595,6 +595,7 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode, · 594 unmodified lines | |||
| 595 | inode_inc_iversion(inode); | 595 | inode_inc_iversion(inode); |
| 596 | inode->i_mtime = inode->i_atime = inode->i_ctime = | 596 | inode->i_mtime = inode->i_atime = inode->i_ctime = |
| 597 | EXFAT_I(inode)->i_crtime = current_time(inode); | 597 | EXFAT_I(inode)->i_crtime = current_time(inode); |
| 598 | exfat_truncate_atime(&inode->i_atime); | ||
| 598 | /* timestamp is already written, so mark_inode_dirty() is unneeded. */ | 599 | /* timestamp is already written, so mark_inode_dirty() is unneeded. */ |
| 599 | 600 | ||
| 600 | d_instantiate(dentry, inode); | 601 | d_instantiate(dentry, inode); |
| @@ -854,6 +855,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry) · 253 unmodified lines | |||
| 854 | 855 | ||
| 855 | inode_inc_iversion(dir); | 856 | inode_inc_iversion(dir); |
| 856 | dir->i_mtime = dir->i_atime = current_time(dir); | 857 | dir->i_mtime = dir->i_atime = current_time(dir); |
| 858 | exfat_truncate_atime(&dir->i_atime); | ||
| 857 | if (IS_DIRSYNC(dir)) | 859 | if (IS_DIRSYNC(dir)) |
| 858 | exfat_sync_inode(dir); | 860 | exfat_sync_inode(dir); |
| 859 | else | 861 | else |
| @@ -861,6 +863,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry) · 1 unmodified line | |||
| 861 | 863 | ||
| 862 | clear_nlink(inode); | 864 | clear_nlink(inode); |
| 863 | inode->i_mtime = inode->i_atime = current_time(inode); | 865 | inode->i_mtime = inode->i_atime = current_time(inode); |
| 866 | exfat_truncate_atime(&inode->i_atime); | ||
| 864 | exfat_unhash_inode(inode); | 867 | exfat_unhash_inode(inode); |
| 865 | exfat_d_version_set(dentry, inode_query_iversion(dir)); | 868 | exfat_d_version_set(dentry, inode_query_iversion(dir)); |
| 866 | unlock: | 869 | unlock: |
| @@ -903,6 +906,7 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) · 36 unmodified lines | |||
| 903 | inode_inc_iversion(inode); | 906 | inode_inc_iversion(inode); |
| 904 | inode->i_mtime = inode->i_atime = inode->i_ctime = | 907 | inode->i_mtime = inode->i_atime = inode->i_ctime = |
| 905 | EXFAT_I(inode)->i_crtime = current_time(inode); | 908 | EXFAT_I(inode)->i_crtime = current_time(inode); |
| 909 | exfat_truncate_atime(&inode->i_atime); | ||
| 906 | /* timestamp is already written, so mark_inode_dirty() is unneeded. */ | 910 | /* timestamp is already written, so mark_inode_dirty() is unneeded. */ |
| 907 | 911 | ||
| 908 | d_instantiate(dentry, inode); | 912 | d_instantiate(dentry, inode); |
| @@ -1019,6 +1023,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry) · 110 unmodified lines | |||
| 1019 | 1023 | ||
| 1020 | inode_inc_iversion(dir); | 1024 | inode_inc_iversion(dir); |
| 1021 | dir->i_mtime = dir->i_atime = current_time(dir); | 1025 | dir->i_mtime = dir->i_atime = current_time(dir); |
| 1026 | exfat_truncate_atime(&dir->i_atime); | ||
| 1022 | if (IS_DIRSYNC(dir)) | 1027 | if (IS_DIRSYNC(dir)) |
| 1023 | exfat_sync_inode(dir); | 1028 | exfat_sync_inode(dir); |
| 1024 | else | 1029 | else |
| @@ -1027,6 +1032,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry) · 2 unmodified lines | |||
| 1027 | 1032 | ||
| 1028 | clear_nlink(inode); | 1033 | clear_nlink(inode); |
| 1029 | inode->i_mtime = inode->i_atime = current_time(inode); | 1034 | inode->i_mtime = inode->i_atime = current_time(inode); |
| 1035 | exfat_truncate_atime(&inode->i_atime); | ||
| 1030 | exfat_unhash_inode(inode); | 1036 | exfat_unhash_inode(inode); |
| 1031 | exfat_d_version_set(dentry, inode_query_iversion(dir)); | 1037 | exfat_d_version_set(dentry, inode_query_iversion(dir)); |
| 1032 | unlock: | 1038 | unlock: |
| @@ -1387,6 +1393,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry, · 354 unmodified lines | |||
| 1387 | inode_inc_iversion(new_dir); | 1393 | inode_inc_iversion(new_dir); |
| 1388 | new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime = | 1394 | new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime = |
| 1389 | EXFAT_I(new_dir)->i_crtime = current_time(new_dir); | 1395 | EXFAT_I(new_dir)->i_crtime = current_time(new_dir); |
| 1396 | exfat_truncate_atime(&new_dir->i_atime); | ||
| 1390 | if (IS_DIRSYNC(new_dir)) | 1397 | if (IS_DIRSYNC(new_dir)) |
| 1391 | exfat_sync_inode(new_dir); | 1398 | exfat_sync_inode(new_dir); |
| 1392 | else | 1399 | else |
| @@ -49,6 +49,7 @@ static void exfat_put_super(struct super_block *sb) · 48 unmodified lines | |||
| 49 | sync_blockdev(sb->s_bdev); | 49 | sync_blockdev(sb->s_bdev); |
| 50 | exfat_set_vol_flags(sb, VOL_CLEAN); | 50 | exfat_set_vol_flags(sb, VOL_CLEAN); |
| 51 | exfat_free_bitmap(sbi); | 51 | exfat_free_bitmap(sbi); |
| 52 | brelse(sbi->pbr_bh); | ||
| 52 | mutex_unlock(&sbi->s_lock); | 53 | mutex_unlock(&sbi->s_lock); |
| 53 | 54 | ||
| 54 | call_rcu(&sbi->rcu, exfat_delayed_free); | 55 | call_rcu(&sbi->rcu, exfat_delayed_free); |
| @@ -100,7 +101,7 @@ static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf) · 45 unmodified lines | |||
| 100 | int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag) | 101 | int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag) |
| 101 | { | 102 | { |
| 102 | struct exfat_sb_info *sbi = EXFAT_SB(sb); | 103 | struct exfat_sb_info *sbi = EXFAT_SB(sb); |
| 103 | struct pbr64 *bpb; | 104 | struct pbr64 *bpb = (struct pbr64 *)sbi->pbr_bh->b_data; |
| 104 | bool sync = 0; | 105 | bool sync = 0; |
| 105 | 106 | ||
| 106 | /* flags are not changed */ | 107 | /* flags are not changed */ |
| @@ -115,15 +116,6 @@ int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag) · 8 unmodified lines | |||
| 115 | if (sb_rdonly(sb)) | 116 | if (sb_rdonly(sb)) |
| 116 | return 0; | 117 | return 0; |
| 117 | 118 | ||
| 118 | if (!sbi->pbr_bh) { | ||
| 119 | sbi->pbr_bh = sb_bread(sb, 0); | ||
| 120 | if (!sbi->pbr_bh) { | ||
| 121 | exfat_msg(sb, KERN_ERR, "failed to read boot sector"); | ||
| 122 | return -ENOMEM; | ||
| 123 | } | ||
| 124 | } | ||
| 125 | |||
| 126 | bpb = (struct pbr64 *)sbi->pbr_bh->b_data; | ||
| 127 | bpb->bsx.vol_flags = cpu_to_le16(new_flag); | 119 | bpb->bsx.vol_flags = cpu_to_le16(new_flag); |
| 128 | 120 | ||
| 129 | if (new_flag == VOL_DIRTY && !buffer_dirty(sbi->pbr_bh)) | 121 | if (new_flag == VOL_DIRTY && !buffer_dirty(sbi->pbr_bh)) |
| @@ -159,7 +151,6 @@ static int exfat_show_options(struct seq_file *m, struct dentry *root) · 29 unmodified lines | |||
| 159 | seq_puts(m, ",iocharset=utf8"); | 151 | seq_puts(m, ",iocharset=utf8"); |
| 160 | else if (sbi->nls_io) | 152 | else if (sbi->nls_io) |
| 161 | seq_printf(m, ",iocharset=%s", sbi->nls_io->charset); | 153 | seq_printf(m, ",iocharset=%s", sbi->nls_io->charset); |
| 162 | seq_printf(m, ",bps=%ld", sb->s_blocksize); | ||
| 163 | if (opts->errors == EXFAT_ERRORS_CONT) | 154 | if (opts->errors == EXFAT_ERRORS_CONT) |
| 164 | seq_puts(m, ",errors=continue"); | 155 | seq_puts(m, ",errors=continue"); |
| 165 | else if (opts->errors == EXFAT_ERRORS_PANIC) | 156 | else if (opts->errors == EXFAT_ERRORS_PANIC) |
| @@ -351,14 +342,15 @@ static int exfat_read_root(struct inode *inode) · 185 unmodified lines | |||
| 351 | exfat_save_attr(inode, ATTR_SUBDIR); | 342 | exfat_save_attr(inode, ATTR_SUBDIR); |
| 352 | inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime = | 343 | inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime = |
| 353 | current_time(inode); | 344 | current_time(inode); |
| 345 | exfat_truncate_atime(&inode->i_atime); | ||
| 354 | exfat_cache_init_inode(inode); | 346 | exfat_cache_init_inode(inode); |
| 355 | return 0; | 347 | return 0; |
| 356 | } | 348 | } |
| 357 | 349 | ||
| 358 | static struct pbr *exfat_read_pbr_with_logical_sector(struct super_block *sb, | 350 | static struct pbr *exfat_read_pbr_with_logical_sector(struct super_block *sb) |
| 359 | struct buffer_head **prev_bh) | ||
| 360 | { | 351 | { |
| 361 | struct pbr *p_pbr = (struct pbr *) (*prev_bh)->b_data; | 352 | struct exfat_sb_info *sbi = EXFAT_SB(sb); |
| 353 | struct pbr *p_pbr = (struct pbr *) (sbi->pbr_bh)->b_data; | ||
| 362 | unsigned short logical_sect = 0; | 354 | unsigned short logical_sect = 0; |
| 363 | 355 | ||
| 364 | logical_sect = 1 << p_pbr->bsx.f64.sect_size_bits; | 356 | logical_sect = 1 << p_pbr->bsx.f64.sect_size_bits; |
| @@ -378,26 +370,23 @@ static struct pbr *exfat_read_pbr_with_logical_sector(struct super_block *sb, · 13 unmodified lines | |||
| 378 | } | 370 | } |
| 379 | 371 | ||
| 380 | if (logical_sect > sb->s_blocksize) { | 372 | if (logical_sect > sb->s_blocksize) { |
| 381 | struct buffer_head *bh = NULL; | 373 | brelse(sbi->pbr_bh); |
| 382 | 374 | sbi->pbr_bh = NULL; | |
| 383 | __brelse(*prev_bh); | ||
| 384 | *prev_bh = NULL; | ||
| 385 | 375 | ||
| 386 | if (!sb_set_blocksize(sb, logical_sect)) { | 376 | if (!sb_set_blocksize(sb, logical_sect)) { |
| 387 | exfat_msg(sb, KERN_ERR, | 377 | exfat_msg(sb, KERN_ERR, |
| 388 | "unable to set blocksize %u", logical_sect); | 378 | "unable to set blocksize %u", logical_sect); |
| 389 | return NULL; | 379 | return NULL; |
| 390 | } | 380 | } |
| 391 | bh = sb_bread(sb, 0); | 381 | sbi->pbr_bh = sb_bread(sb, 0); |
| 392 | if (!bh) { | 382 | if (!sbi->pbr_bh) { |
| 393 | exfat_msg(sb, KERN_ERR, | 383 | exfat_msg(sb, KERN_ERR, |
| 394 | "unable to read boot sector (logical sector size = %lu)", | 384 | "unable to read boot sector (logical sector size = %lu)", |
| 395 | sb->s_blocksize); | 385 | sb->s_blocksize); |
| 396 | return NULL; | 386 | return NULL; |
| 397 | } | 387 | } |
| 398 | 388 | ||
| 399 | *prev_bh = bh; | 389 | p_pbr = (struct pbr *)sbi->pbr_bh->b_data; |
| 400 | p_pbr = (struct pbr *) bh->b_data; | ||
| 401 | } | 390 | } |
| 402 | return p_pbr; | 391 | return p_pbr; |
| 403 | } | 392 | } |
| @@ -408,21 +397,20 @@ static int __exfat_fill_super(struct super_block *sb) · 4 unmodified lines | |||
| 408 | int ret; | 397 | int ret; |
| 409 | struct pbr *p_pbr; | 398 | struct pbr *p_pbr; |
| 410 | struct pbr64 *p_bpb; | 399 | struct pbr64 *p_bpb; |
| 411 | struct buffer_head *bh; | ||
| 412 | struct exfat_sb_info *sbi = EXFAT_SB(sb); | 400 | struct exfat_sb_info *sbi = EXFAT_SB(sb); |
| 413 | 401 | ||
| 414 | /* set block size to read super block */ | 402 | /* set block size to read super block */ |
| 415 | sb_min_blocksize(sb, 512); | 403 | sb_min_blocksize(sb, 512); |
| 416 | 404 | ||
| 417 | /* read boot sector */ | 405 | /* read boot sector */ |
| 418 | bh = sb_bread(sb, 0); | 406 | sbi->pbr_bh = sb_bread(sb, 0); |
| 419 | if (!bh) { | 407 | if (!sbi->pbr_bh) { |
| 420 | exfat_msg(sb, KERN_ERR, "unable to read boot sector"); | 408 | exfat_msg(sb, KERN_ERR, "unable to read boot sector"); |
| 421 | return -EIO; | 409 | return -EIO; |
| 422 | } | 410 | } |
| 423 | 411 | ||
| 424 | /* PRB is read */ | 412 | /* PRB is read */ |
| 425 | p_pbr = (struct pbr *)bh->b_data; | 413 | p_pbr = (struct pbr *)sbi->pbr_bh->b_data; |
| 426 | 414 | ||
| 427 | /* check the validity of PBR */ | 415 | /* check the validity of PBR */ |
| 428 | if (le16_to_cpu((p_pbr->signature)) != PBR_SIGNATURE) { | 416 | if (le16_to_cpu((p_pbr->signature)) != PBR_SIGNATURE) { |
| @@ -433,7 +421,7 @@ static int __exfat_fill_super(struct super_block *sb) · 4 unmodified lines | |||
| 433 | 421 | ||
| 434 | 422 | ||
| 435 | /* check logical sector size */ | 423 | /* check logical sector size */ |
| 436 | p_pbr = exfat_read_pbr_with_logical_sector(sb, &bh); | 424 | p_pbr = exfat_read_pbr_with_logical_sector(sb); |
| 437 | if (!p_pbr) { | 425 | if (!p_pbr) { |
| 438 | ret = -EIO; | 426 | ret = -EIO; |
| 439 | goto free_bh; | 427 | goto free_bh; |
| @@ -514,7 +502,7 @@ free_alloc_bitmap: · 74 unmodified lines | |||
| 514 | free_upcase_table: | 502 | free_upcase_table: |
| 515 | exfat_free_upcase_table(sbi); | 503 | exfat_free_upcase_table(sbi); |
| 516 | free_bh: | 504 | free_bh: |
| 517 | brelse(bh); | 505 | brelse(sbi->pbr_bh); |
| 518 | return ret; | 506 | return ret; |
| 519 | } | 507 | } |
| 520 | 508 | ||
| @@ -531,17 +519,18 @@ static int exfat_fill_super(struct super_block *sb, struct fs_context *fc) · 10 unmodified lines | |||
| 531 | if (opts->discard) { | 519 | if (opts->discard) { |
| 532 | struct request_queue *q = bdev_get_queue(sb->s_bdev); | 520 | struct request_queue *q = bdev_get_queue(sb->s_bdev); |
| 533 | 521 | ||
| 534 | if (!blk_queue_discard(q)) | 522 | if (!blk_queue_discard(q)) { |
| 535 | exfat_msg(sb, KERN_WARNING, | 523 | exfat_msg(sb, KERN_WARNING, |
| 536 | "mounting with \"discard\" option, but the device does not support discard"); | 524 | "mounting with \"discard\" option, but the device does not support discard"); |
| 537 | opts->discard = 0; | 525 | opts->discard = 0; |
| 526 | } | ||
| 538 | } | 527 | } |
| 539 | 528 | ||
| 540 | sb->s_flags |= SB_NODIRATIME; | 529 | sb->s_flags |= SB_NODIRATIME; |
| 541 | sb->s_magic = EXFAT_SUPER_MAGIC; | 530 | sb->s_magic = EXFAT_SUPER_MAGIC; |
| 542 | sb->s_op = &exfat_sops; | 531 | sb->s_op = &exfat_sops; |
| 543 | 532 | ||
| 544 | sb->s_time_gran = 1; | 533 | sb->s_time_gran = 10 * NSEC_PER_MSEC; |
| 545 | sb->s_time_min = EXFAT_MIN_TIMESTAMP_SECS; | 534 | sb->s_time_min = EXFAT_MIN_TIMESTAMP_SECS; |
| 546 | sb->s_time_max = EXFAT_MAX_TIMESTAMP_SECS; | 535 | sb->s_time_max = EXFAT_MAX_TIMESTAMP_SECS; |
| 547 | 536 | ||
| @@ -605,6 +594,7 @@ put_inode: · 57 unmodified lines | |||
| 605 | free_table: | 594 | free_table: |
| 606 | exfat_free_upcase_table(sbi); | 595 | exfat_free_upcase_table(sbi); |
| 607 | exfat_free_bitmap(sbi); | 596 | exfat_free_bitmap(sbi); |
| 597 | brelse(sbi->pbr_bh); | ||
| 608 | 598 | ||
| 609 | check_nls_io: | 599 | check_nls_io: |
| 610 | unload_nls(sbi->nls_io); | 600 | unload_nls(sbi->nls_io); |
| @@ -717,6 +707,7 @@ static void __exit exit_exfat_fs(void) · 106 unmodified lines | |||
| 717 | module_init(init_exfat_fs); | 707 | module_init(init_exfat_fs); |
| 718 | module_exit(exit_exfat_fs); | 708 | module_exit(exit_exfat_fs); |
| 719 | 709 | ||
| 710 | MODULE_ALIAS_FS("exfat"); | ||
| 720 | MODULE_LICENSE("GPL"); | 711 | MODULE_LICENSE("GPL"); |
| 721 | MODULE_DESCRIPTION("exFAT filesystem support"); | 712 | MODULE_DESCRIPTION("exFAT filesystem support"); |
| 722 | MODULE_AUTHOR("Samsung Electronics Co., Ltd."); | 713 | MODULE_AUTHOR("Samsung Electronics Co., Ltd."); |
| @@ -410,7 +410,7 @@ verified: · 409 unmodified lines | |||
| 410 | * Read the bitmap for a given block_group,and validate the | 410 | * Read the bitmap for a given block_group,and validate the |
| 411 | * bits for block/inode/inode tables are set in the bitmaps | 411 | * bits for block/inode/inode tables are set in the bitmaps |
| 412 | * | 412 | * |
| 413 | * Return buffer_head on success or NULL in case of failure. | 413 | * Return buffer_head on success or an ERR_PTR in case of failure. |
| 414 | */ | 414 | */ |
| 415 | struct buffer_head * | 415 | struct buffer_head * |
| 416 | ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group) | 416 | ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group) |
| @@ -502,7 +502,7 @@ out: · 85 unmodified lines | |||
| 502 | return ERR_PTR(err); | 502 | return ERR_PTR(err); |
| 503 | } | 503 | } |
| 504 | 504 | ||
| 505 | /* Returns 0 on success, 1 on error */ | 505 | /* Returns 0 on success, -errno on error */ |
| 506 | int ext4_wait_block_bitmap(struct super_block *sb, ext4_group_t block_group, | 506 | int ext4_wait_block_bitmap(struct super_block *sb, ext4_group_t block_group, |
| 507 | struct buffer_head *bh) | 507 | struct buffer_head *bh) |
| 508 | { | 508 | { |
| @@ -338,9 +338,6 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line, · 337 unmodified lines | |||
| 338 | if (inode && inode_needs_sync(inode)) { | 338 | if (inode && inode_needs_sync(inode)) { |
| 339 | sync_dirty_buffer(bh); | 339 | sync_dirty_buffer(bh); |
| 340 | if (buffer_req(bh) && !buffer_uptodate(bh)) { | 340 | if (buffer_req(bh) && !buffer_uptodate(bh)) { |
| 341 | struct ext4_super_block *es; | ||
| 342 | |||
| 343 | es = EXT4_SB(inode->i_sb)->s_es; | ||
| 344 | ext4_error_inode_err(inode, where, line, | 341 | ext4_error_inode_err(inode, where, line, |
| 345 | bh->b_blocknr, EIO, | 342 | bh->b_blocknr, EIO, |
| 346 | "IO error syncing itable block"); | 343 | "IO error syncing itable block"); |
| @@ -3374,8 +3374,8 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, · 3373 unmodified lines | |||
| 3374 | (unsigned long long)map->m_lblk, map_len); | 3374 | (unsigned long long)map->m_lblk, map_len); |
| 3375 | 3375 | ||
| 3376 | sbi = EXT4_SB(inode->i_sb); | 3376 | sbi = EXT4_SB(inode->i_sb); |
| 3377 | eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >> | 3377 | eof_block = (EXT4_I(inode)->i_disksize + inode->i_sb->s_blocksize - 1) |
| 3378 | inode->i_sb->s_blocksize_bits; | 3378 | >> inode->i_sb->s_blocksize_bits; |
| 3379 | if (eof_block < map->m_lblk + map_len) | 3379 | if (eof_block < map->m_lblk + map_len) |
| 3380 | eof_block = map->m_lblk + map_len; | 3380 | eof_block = map->m_lblk + map_len; |
| 3381 | 3381 | ||
| @@ -3627,8 +3627,8 @@ static int ext4_split_convert_extents(handle_t *handle, · 245 unmodified lines | |||
| 3627 | __func__, inode->i_ino, | 3627 | __func__, inode->i_ino, |
| 3628 | (unsigned long long)map->m_lblk, map->m_len); | 3628 | (unsigned long long)map->m_lblk, map->m_len); |
| 3629 | 3629 | ||
| 3630 | eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >> | 3630 | eof_block = (EXT4_I(inode)->i_disksize + inode->i_sb->s_blocksize - 1) |
| 3631 | inode->i_sb->s_blocksize_bits; | 3631 | >> inode->i_sb->s_blocksize_bits; |
| 3632 | if (eof_block < map->m_lblk + map->m_len) | 3632 | if (eof_block < map->m_lblk + map->m_len) |
| 3633 | eof_block = map->m_lblk + map->m_len; | 3633 | eof_block = map->m_lblk + map->m_len; |
| 3634 | /* | 3634 | /* |
| @@ -113,7 +113,7 @@ verified: · 112 unmodified lines | |||
| 113 | * Read the inode allocation bitmap for a given block_group, reading | 113 | * Read the inode allocation bitmap for a given block_group, reading |
| 114 | * into the specified slot in the superblock's bitmap cache. | 114 | * into the specified slot in the superblock's bitmap cache. |
| 115 | * | 115 | * |
| 116 | * Return buffer_head of bitmap on success or NULL. | 116 | * Return buffer_head of bitmap on success, or an ERR_PTR on error. |
| 117 | */ | 117 | */ |
| 118 | static struct buffer_head * | 118 | static struct buffer_head * |
| 119 | ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) | 119 | ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) |
| @@ -662,7 +662,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent, · 542 unmodified lines | |||
| 662 | * block has been written back to disk. (Yes, these values are | 662 | * block has been written back to disk. (Yes, these values are |
| 663 | * somewhat arbitrary...) | 663 | * somewhat arbitrary...) |
| 664 | */ | 664 | */ |
| 665 | #define RECENTCY_MIN 5 | 665 | #define RECENTCY_MIN 60 |
| 666 | #define RECENTCY_DIRTY 300 | 666 | #define RECENTCY_DIRTY 300 |
| 667 | 667 | ||
| 668 | static int recently_deleted(struct super_block *sb, ext4_group_t group, int ino) | 668 | static int recently_deleted(struct super_block *sb, ext4_group_t group, int ino) |
| @@ -1973,7 +1973,7 @@ static int ext4_writepage(struct page *page, · 1972 unmodified lines | |||
| 1973 | bool keep_towrite = false; | 1973 | bool keep_towrite = false; |
| 1974 | 1974 | ||
| 1975 | if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) { | 1975 | if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) { |
| 1976 | ext4_invalidatepage(page, 0, PAGE_SIZE); | 1976 | inode->i_mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE); |
| 1977 | unlock_page(page); | 1977 | unlock_page(page); |
| 1978 | return -EIO; | 1978 | return -EIO; |
| 1979 | } | 1979 | } |
| @@ -4364,7 +4364,7 @@ make_io: · 2384 unmodified lines | |||
| 4364 | if (end > table) | 4364 | if (end > table) |
| 4365 | end = table; | 4365 | end = table; |
| 4366 | while (b <= end) | 4366 | while (b <= end) |
| 4367 | sb_breadahead(sb, b++); | 4367 | sb_breadahead_unmovable(sb, b++); |
| 4368 | } | 4368 | } |
| 4369 | 4369 | ||
| 4370 | /* | 4370 | /* |
| @@ -1943,7 +1943,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, · 1942 unmodified lines | |||
| 1943 | int free; | 1943 | int free; |
| 1944 | 1944 | ||
| 1945 | free = e4b->bd_info->bb_free; | 1945 | free = e4b->bd_info->bb_free; |
| 1946 | BUG_ON(free <= 0); | 1946 | if (WARN_ON(free <= 0)) |
| 1947 | return; | ||
| 1947 | 1948 | ||
| 1948 | i = e4b->bd_info->bb_first_free; | 1949 | i = e4b->bd_info->bb_first_free; |
| 1949 | 1950 | ||
| @@ -1966,7 +1967,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, · 16 unmodified lines | |||
| 1966 | } | 1967 | } |
| 1967 | 1968 | ||
| 1968 | mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex); | 1969 | mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex); |
| 1969 | BUG_ON(ex.fe_len <= 0); | 1970 | if (WARN_ON(ex.fe_len <= 0)) |
| 1971 | break; | ||
| 1970 | if (free < ex.fe_len) { | 1972 | if (free < ex.fe_len) { |
| 1971 | ext4_grp_locked_error(sb, e4b->bd_group, 0, 0, | 1973 | ext4_grp_locked_error(sb, e4b->bd_group, 0, 0, |
| 1972 | "%d free clusters as per " | 1974 | "%d free clusters as per " |
| @@ -596,7 +596,6 @@ void __ext4_error_file(struct file *file, const char *function, · 595 unmodified lines | |||
| 596 | { | 596 | { |
| 597 | va_list args; | 597 | va_list args; |
| 598 | struct va_format vaf; | 598 | struct va_format vaf; |
| 599 | struct ext4_super_block *es; | ||
| 600 | struct inode *inode = file_inode(file); | 599 | struct inode *inode = file_inode(file); |
| 601 | char pathname[80], *path; | 600 | char pathname[80], *path; |
| 602 | 601 | ||
| @@ -604,7 +603,6 @@ void __ext4_error_file(struct file *file, const char *function, · 1 unmodified line | |||
| 604 | return; | 603 | return; |
| 605 | 604 | ||
| 606 | trace_ext4_error(inode->i_sb, function, line); | 605 | trace_ext4_error(inode->i_sb, function, line); |
| 607 | es = EXT4_SB(inode->i_sb)->s_es; | ||
| 608 | if (ext4_error_ratelimit(inode->i_sb)) { | 606 | if (ext4_error_ratelimit(inode->i_sb)) { |
| 609 | path = file_path(file, pathname, sizeof(pathname)); | 607 | path = file_path(file, pathname, sizeof(pathname)); |
| 610 | if (IS_ERR(path)) | 608 | if (IS_ERR(path)) |
| @@ -4340,7 +4338,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) · 3729 unmodified lines | |||
| 4340 | /* Pre-read the descriptors into the buffer cache */ | 4338 | /* Pre-read the descriptors into the buffer cache */ |
| 4341 | for (i = 0; i < db_count; i++) { | 4339 | for (i = 0; i < db_count; i++) { |
| 4342 | block = descriptor_loc(sb, logical_sb_block, i); | 4340 | block = descriptor_loc(sb, logical_sb_block, i); |
| 4343 | sb_breadahead(sb, block); | 4341 | sb_breadahead_unmovable(sb, block); |
| 4344 | } | 4342 | } |
| 4345 | 4343 | ||
| 4346 | for (i = 0; i < db_count; i++) { | 4344 | for (i = 0; i < db_count; i++) { |
| @@ -357,7 +357,6 @@ struct io_timeout_data { · 356 unmodified lines | |||
| 357 | struct hrtimer timer; | 357 | struct hrtimer timer; |
| 358 | struct timespec64 ts; | 358 | struct timespec64 ts; |
| 359 | enum hrtimer_mode mode; | 359 | enum hrtimer_mode mode; |
| 360 | u32 seq_offset; | ||
| 361 | }; | 360 | }; |
| 362 | 361 | ||
| 363 | struct io_accept { | 362 | struct io_accept { |
| @@ -385,7 +384,7 @@ struct io_timeout { · 21 unmodified lines | |||
| 385 | struct file *file; | 384 | struct file *file; |
| 386 | u64 addr; | 385 | u64 addr; |
| 387 | int flags; | 386 | int flags; |
| 388 | unsigned count; | 387 | u32 count; |
| 389 | }; | 388 | }; |
| 390 | 389 | ||
| 391 | struct io_rw { | 390 | struct io_rw { |
| @@ -508,6 +507,7 @@ enum { · 116 unmodified lines | |||
| 508 | REQ_F_FORCE_ASYNC_BIT = IOSQE_ASYNC_BIT, | 507 | REQ_F_FORCE_ASYNC_BIT = IOSQE_ASYNC_BIT, |
| 509 | REQ_F_BUFFER_SELECT_BIT = IOSQE_BUFFER_SELECT_BIT, | 508 | REQ_F_BUFFER_SELECT_BIT = IOSQE_BUFFER_SELECT_BIT, |
| 510 | 509 | ||
| 510 | REQ_F_LINK_HEAD_BIT, | ||
| 511 | REQ_F_LINK_NEXT_BIT, | 511 | REQ_F_LINK_NEXT_BIT, |
| 512 | REQ_F_FAIL_LINK_BIT, | 512 | REQ_F_FAIL_LINK_BIT, |
| 513 | REQ_F_INFLIGHT_BIT, | 513 | REQ_F_INFLIGHT_BIT, |
| @@ -543,6 +543,8 @@ enum { · 29 unmodified lines | |||
| 543 | /* IOSQE_BUFFER_SELECT */ | 543 | /* IOSQE_BUFFER_SELECT */ |
| 544 | REQ_F_BUFFER_SELECT = BIT(REQ_F_BUFFER_SELECT_BIT), | 544 | REQ_F_BUFFER_SELECT = BIT(REQ_F_BUFFER_SELECT_BIT), |
| 545 | 545 | ||
| 546 | /* head of a link */ | ||
| 547 | REQ_F_LINK_HEAD = BIT(REQ_F_LINK_HEAD_BIT), | ||
| 546 | /* already grabbed next link */ | 548 | /* already grabbed next link */ |
| 547 | REQ_F_LINK_NEXT = BIT(REQ_F_LINK_NEXT_BIT), | 549 | REQ_F_LINK_NEXT = BIT(REQ_F_LINK_NEXT_BIT), |
| 548 | /* fail rest of links */ | 550 | /* fail rest of links */ |
| @@ -955,8 +957,8 @@ static inline bool __req_need_defer(struct io_kiocb *req) · 406 unmodified lines | |||
| 955 | { | 957 | { |
| 956 | struct io_ring_ctx *ctx = req->ctx; | 958 | struct io_ring_ctx *ctx = req->ctx; |
| 957 | 959 | ||
| 958 | return req->sequence != ctx->cached_cq_tail + ctx->cached_sq_dropped | 960 | return req->sequence != ctx->cached_cq_tail |
| 959 | + atomic_read(&ctx->cached_cq_overflow); | 961 | + atomic_read(&ctx->cached_cq_overflow); |
| 960 | } | 962 | } |
| 961 | 963 | ||
| 962 | static inline bool req_need_defer(struct io_kiocb *req) | 964 | static inline bool req_need_defer(struct io_kiocb *req) |
| @@ -1437,7 +1439,7 @@ static bool io_link_cancel_timeout(struct io_kiocb *req) · 474 unmodified lines | |||
| 1437 | if (ret != -1) { | 1439 | if (ret != -1) { |
| 1438 | io_cqring_fill_event(req, -ECANCELED); | 1440 | io_cqring_fill_event(req, -ECANCELED); |
| 1439 | io_commit_cqring(ctx); | 1441 | io_commit_cqring(ctx); |
| 1440 | req->flags &= ~REQ_F_LINK; | 1442 | req->flags &= ~REQ_F_LINK_HEAD; |
| 1441 | io_put_req(req); | 1443 | io_put_req(req); |
| 1442 | return true; | 1444 | return true; |
| 1443 | } | 1445 | } |
| @@ -1473,7 +1475,7 @@ static void io_req_link_next(struct io_kiocb *req, struct io_kiocb **nxtptr) · 29 unmodified lines | |||
| 1473 | 1475 | ||
| 1474 | list_del_init(&req->link_list); | 1476 | list_del_init(&req->link_list); |
| 1475 | if (!list_empty(&nxt->link_list)) | 1477 | if (!list_empty(&nxt->link_list)) |
| 1476 | nxt->flags |= REQ_F_LINK; | 1478 | nxt->flags |= REQ_F_LINK_HEAD; |
| 1477 | *nxtptr = nxt; | 1479 | *nxtptr = nxt; |
| 1478 | break; | 1480 | break; |
| 1479 | } | 1481 | } |
| @@ -1484,7 +1486,7 @@ static void io_req_link_next(struct io_kiocb *req, struct io_kiocb **nxtptr) · 4 unmodified lines | |||
| 1484 | } | 1486 | } |
| 1485 | 1487 | ||
| 1486 | /* | 1488 | /* |
| 1487 | * Called if REQ_F_LINK is set, and we fail the head request | 1489 | * Called if REQ_F_LINK_HEAD is set, and we fail the head request |
| 1488 | */ | 1490 | */ |
| 1489 | static void io_fail_links(struct io_kiocb *req) | 1491 | static void io_fail_links(struct io_kiocb *req) |
| 1490 | { | 1492 | { |
| @@ -1517,7 +1519,7 @@ static void io_fail_links(struct io_kiocb *req) · 26 unmodified lines | |||
| 1517 | 1519 | ||
| 1518 | static void io_req_find_next(struct io_kiocb *req, struct io_kiocb **nxt) | 1520 | static void io_req_find_next(struct io_kiocb *req, struct io_kiocb **nxt) |
| 1519 | { | 1521 | { |
| 1520 | if (likely(!(req->flags & REQ_F_LINK))) | 1522 | if (likely(!(req->flags & REQ_F_LINK_HEAD))) |
| 1521 | return; | 1523 | return; |
| 1522 | 1524 | ||
| 1523 | /* | 1525 | /* |
| @@ -1669,7 +1671,7 @@ static inline unsigned int io_sqring_entries(struct io_ring_ctx *ctx) · 145 unmodified lines | |||
| 1669 | 1671 | ||
| 1670 | static inline bool io_req_multi_free(struct req_batch *rb, struct io_kiocb *req) | 1672 | static inline bool io_req_multi_free(struct req_batch *rb, struct io_kiocb *req) |
| 1671 | { | 1673 | { |
| 1672 | if ((req->flags & REQ_F_LINK) || io_is_fallback_req(req)) | 1674 | if ((req->flags & REQ_F_LINK_HEAD) || io_is_fallback_req(req)) |
| 1673 | return false; | 1675 | return false; |
| 1674 | 1676 | ||
| 1675 | if (!(req->flags & REQ_F_FIXED_FILE) || req->io) | 1677 | if (!(req->flags & REQ_F_FIXED_FILE) || req->io) |
| @@ -2562,7 +2564,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock) · 886 unmodified lines | |||
| 2562 | 2564 | ||
| 2563 | req->result = 0; | 2565 | req->result = 0; |
| 2564 | io_size = ret; | 2566 | io_size = ret; |
| 2565 | if (req->flags & REQ_F_LINK) | 2567 | if (req->flags & REQ_F_LINK_HEAD) |
| 2566 | req->result = io_size; | 2568 | req->result = io_size; |
| 2567 | 2569 | ||
| 2568 | /* | 2570 | /* |
| @@ -2653,7 +2655,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock) · 84 unmodified lines | |||
| 2653 | 2655 | ||
| 2654 | req->result = 0; | 2656 | req->result = 0; |
| 2655 | io_size = ret; | 2657 | io_size = ret; |
| 2656 | if (req->flags & REQ_F_LINK) | 2658 | if (req->flags & REQ_F_LINK_HEAD) |
| 2657 | req->result = io_size; | 2659 | req->result = io_size; |
| 2658 | 2660 | ||
| 2659 | /* | 2661 | /* |
| @@ -2760,7 +2762,7 @@ static bool io_splice_punt(struct file *file) · 100 unmodified lines | |||
| 2760 | return false; | 2762 | return false; |
| 2761 | if (!io_file_supports_async(file)) | 2763 | if (!io_file_supports_async(file)) |
| 2762 | return true; | 2764 | return true; |
| 2763 | return !(file->f_mode & O_NONBLOCK); | 2765 | return !(file->f_flags & O_NONBLOCK); |
| 2764 | } | 2766 | } |
| 2765 | 2767 | ||
| 2766 | static int io_splice(struct io_kiocb *req, bool force_nonblock) | 2768 | static int io_splice(struct io_kiocb *req, bool force_nonblock) |
| @@ -4153,25 +4155,62 @@ static int __io_async_wake(struct io_kiocb *req, struct io_poll_iocb *poll, · 1386 unmodified lines | |||
| 4153 | return 1; | 4155 | return 1; |
| 4154 | } | 4156 | } |
| 4155 | 4157 | ||
| 4158 | static bool io_poll_rewait(struct io_kiocb *req, struct io_poll_iocb *poll) | ||
| 4159 | __acquires(&req->ctx->completion_lock) | ||
| 4160 | { | ||
| 4161 | struct io_ring_ctx *ctx = req->ctx; | ||
| 4162 | |||
| 4163 | if (!req->result && !READ_ONCE(poll->canceled)) { | ||
| 4164 | struct poll_table_struct pt = { ._key = poll->events }; | ||
| 4165 | |||
| 4166 | req->result = vfs_poll(req->file, &pt) & poll->events; | ||
| 4167 | } | ||
| 4168 | |||
| 4169 | spin_lock_irq(&ctx->completion_lock); | ||
| 4170 | if (!req->result && !READ_ONCE(poll->canceled)) { | ||
| 4171 | add_wait_queue(poll->head, &poll->wait); | ||
| 4172 | return true; | ||
| 4173 | } | ||
| 4174 | |||
| 4175 | return false; | ||
| 4176 | } | ||
| 4177 | |||
| 4156 | static void io_async_task_func(struct callback_head *cb) | 4178 | static void io_async_task_func(struct callback_head *cb) |
| 4157 | { | 4179 | { |
| 4158 | struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work); | 4180 | struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work); |
| 4159 | struct async_poll *apoll = req->apoll; | 4181 | struct async_poll *apoll = req->apoll; |
| 4160 | struct io_ring_ctx *ctx = req->ctx; | 4182 | struct io_ring_ctx *ctx = req->ctx; |
| 4183 | bool canceled; | ||
| 4161 | 4184 | ||
| 4162 | trace_io_uring_task_run(req->ctx, req->opcode, req->user_data); | 4185 | trace_io_uring_task_run(req->ctx, req->opcode, req->user_data); |
| 4163 | 4186 | ||
| 4164 | WARN_ON_ONCE(!list_empty(&req->apoll->poll.wait.entry)); | 4187 | if (io_poll_rewait(req, &apoll->poll)) { |
| 4188 | spin_unlock_irq(&ctx->completion_lock); | ||
| 4189 | return; | ||
| 4190 | } | ||
| 4165 | 4191 | ||
| 4166 | if (hash_hashed(&req->hash_node)) { | 4192 | if (hash_hashed(&req->hash_node)) |
| 4167 | spin_lock_irq(&ctx->completion_lock); | ||
| 4168 | hash_del(&req->hash_node); | 4193 | hash_del(&req->hash_node); |
| 4169 | spin_unlock_irq(&ctx->completion_lock); | 4194 | |
| 4195 | canceled = READ_ONCE(apoll->poll.canceled); | ||
| 4196 | if (canceled) { | ||
| 4197 | io_cqring_fill_event(req, -ECANCELED); | ||
| 4198 | io_commit_cqring(ctx); | ||
| 4170 | } | 4199 | } |
| 4171 | 4200 | ||
| 4201 | spin_unlock_irq(&ctx->completion_lock); | ||
| 4202 | |||
| 4172 | /* restore ->work in case we need to retry again */ | 4203 | /* restore ->work in case we need to retry again */ |
| 4173 | memcpy(&req->work, &apoll->work, sizeof(req->work)); | 4204 | memcpy(&req->work, &apoll->work, sizeof(req->work)); |
| 4174 | 4205 | ||
| 4206 | if (canceled) { | ||
| 4207 | kfree(apoll); | ||
| 4208 | io_cqring_ev_posted(ctx); | ||
| 4209 | req_set_fail_links(req); | ||
| 4210 | io_double_put_req(req); | ||
| 4211 | return; | ||
| 4212 | } | ||
| 4213 | |||
| 4175 | __set_current_state(TASK_RUNNING); | 4214 | __set_current_state(TASK_RUNNING); |
| 4176 | mutex_lock(&ctx->uring_lock); | 4215 | mutex_lock(&ctx->uring_lock); |
| 4177 | __io_queue_sqe(req, NULL); | 4216 | __io_queue_sqe(req, NULL); |
| @@ -4315,11 +4354,13 @@ static bool __io_poll_remove_one(struct io_kiocb *req, · 137 unmodified lines | |||
| 4315 | 4354 | ||
| 4316 | static bool io_poll_remove_one(struct io_kiocb *req) | 4355 | static bool io_poll_remove_one(struct io_kiocb *req) |
| 4317 | { | 4356 | { |
| 4357 | struct async_poll *apoll = NULL; | ||
| 4318 | bool do_complete; | 4358 | bool do_complete; |
| 4319 | 4359 | ||
| 4320 | if (req->opcode == IORING_OP_POLL_ADD) { | 4360 | if (req->opcode == IORING_OP_POLL_ADD) { |
| 4321 | do_complete = __io_poll_remove_one(req, &req->poll); | 4361 | do_complete = __io_poll_remove_one(req, &req->poll); |
| 4322 | } else { | 4362 | } else { |
| 4363 | apoll = req->apoll; | ||
| 4323 | /* non-poll requests have submit ref still */ | 4364 | /* non-poll requests have submit ref still */ |
| 4324 | do_complete = __io_poll_remove_one(req, &req->apoll->poll); | 4365 | do_complete = __io_poll_remove_one(req, &req->apoll->poll); |
| 4325 | if (do_complete) | 4366 | if (do_complete) |
| @@ -4328,6 +4369,14 @@ static bool io_poll_remove_one(struct io_kiocb *req) · 2 unmodified lines | |||
| 4328 | 4369 | ||
| 4329 | hash_del(&req->hash_node); | 4370 | hash_del(&req->hash_node); |
| 4330 | 4371 | ||
| 4372 | if (do_complete && apoll) { | ||
| 4373 | /* | ||
| 4374 | * restore ->work because we need to call io_req_work_drop_env. | ||
| 4375 | */ | ||
| 4376 | memcpy(&req->work, &apoll->work, sizeof(req->work)); | ||
| 4377 | kfree(apoll); | ||
| 4378 | } | ||
| 4379 | |||
| 4331 | if (do_complete) { | 4380 | if (do_complete) { |
| 4332 | io_cqring_fill_event(req, -ECANCELED); | 4381 | io_cqring_fill_event(req, -ECANCELED); |
| 4333 | io_commit_cqring(req->ctx); | 4382 | io_commit_cqring(req->ctx); |
| @@ -4342,7 +4391,7 @@ static void io_poll_remove_all(struct io_ring_ctx *ctx) · 8 unmodified lines | |||
| 4342 | { | 4391 | { |
| 4343 | struct hlist_node *tmp; | 4392 | struct hlist_node *tmp; |
| 4344 | struct io_kiocb *req; | 4393 | struct io_kiocb *req; |
| 4345 | int i; | 4394 | int posted = 0, i; |
| 4346 | 4395 | ||
| 4347 | spin_lock_irq(&ctx->completion_lock); | 4396 | spin_lock_irq(&ctx->completion_lock); |
| 4348 | for (i = 0; i < (1U << ctx->cancel_hash_bits); i++) { | 4397 | for (i = 0; i < (1U << ctx->cancel_hash_bits); i++) { |
| @@ -4350,11 +4399,12 @@ static void io_poll_remove_all(struct io_ring_ctx *ctx) · 1 unmodified line | |||
| 4350 | 4399 | ||
| 4351 | list = &ctx->cancel_hash[i]; | 4400 | list = &ctx->cancel_hash[i]; |
| 4352 | hlist_for_each_entry_safe(req, tmp, list, hash_node) | 4401 | hlist_for_each_entry_safe(req, tmp, list, hash_node) |
| 4353 | io_poll_remove_one(req); | 4402 | posted += io_poll_remove_one(req); |
| 4354 | } | 4403 | } |
| 4355 | spin_unlock_irq(&ctx->completion_lock); | 4404 | spin_unlock_irq(&ctx->completion_lock); |
| 4356 | 4405 | ||
| 4357 | io_cqring_ev_posted(ctx); | 4406 | if (posted) |
| 4407 | io_cqring_ev_posted(ctx); | ||
| 4358 | } | 4408 | } |
| 4359 | 4409 | ||
| 4360 | static int io_poll_cancel(struct io_ring_ctx *ctx, __u64 sqe_addr) | 4410 | static int io_poll_cancel(struct io_ring_ctx *ctx, __u64 sqe_addr) |
| @@ -4423,18 +4473,11 @@ static void io_poll_task_handler(struct io_kiocb *req, struct io_kiocb **nxt) · 62 unmodified lines | |||
| 4423 | struct io_ring_ctx *ctx = req->ctx; | 4473 | struct io_ring_ctx *ctx = req->ctx; |
| 4424 | struct io_poll_iocb *poll = &req->poll; | 4474 | struct io_poll_iocb *poll = &req->poll; |
| 4425 | 4475 | ||
| 4426 | if (!req->result && !READ_ONCE(poll->canceled)) { | 4476 | if (io_poll_rewait(req, poll)) { |
| 4427 | struct poll_table_struct pt = { ._key = poll->events }; | ||
| 4428 | |||
| 4429 | req->result = vfs_poll(req->file, &pt) & poll->events; | ||
| 4430 | } | ||
| 4431 | |||
| 4432 | spin_lock_irq(&ctx->completion_lock); | ||
| 4433 | if (!req->result && !READ_ONCE(poll->canceled)) { | ||
| 4434 | add_wait_queue(poll->head, &poll->wait); | ||
| 4435 | spin_unlock_irq(&ctx->completion_lock); | 4477 | spin_unlock_irq(&ctx->completion_lock); |
| 4436 | return; | 4478 | return; |
| 4437 | } | 4479 | } |
| 4480 | |||
| 4438 | hash_del(&req->hash_node); | 4481 | hash_del(&req->hash_node); |
| 4439 | io_poll_complete(req, req->result, 0); | 4482 | io_poll_complete(req, req->result, 0); |
| 4440 | req->flags |= REQ_F_COMP_LOCKED; | 4483 | req->flags |= REQ_F_COMP_LOCKED; |
| @@ -4665,11 +4708,12 @@ static int io_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe, · 224 unmodified lines | |||
| 4665 | 4708 | ||
| 4666 | static int io_timeout(struct io_kiocb *req) | 4709 | static int io_timeout(struct io_kiocb *req) |
| 4667 | { | 4710 | { |
| 4668 | unsigned count; | ||
| 4669 | struct io_ring_ctx *ctx = req->ctx; | 4711 | struct io_ring_ctx *ctx = req->ctx; |
| 4670 | struct io_timeout_data *data; | 4712 | struct io_timeout_data *data; |
| 4671 | struct list_head *entry; | 4713 | struct list_head *entry; |
| 4672 | unsigned span = 0; | 4714 | unsigned span = 0; |
| 4715 | u32 count = req->timeout.count; | ||
| 4716 | u32 seq = req->sequence; | ||
| 4673 | 4717 | ||
| 4674 | data = &req->io->timeout; | 4718 | data = &req->io->timeout; |
| 4675 | 4719 | ||
| @@ -4678,7 +4722,6 @@ static int io_timeout(struct io_kiocb *req) · 2 unmodified lines | |||
| 4678 | * timeout event to be satisfied. If it isn't set, then this is | 4722 | * timeout event to be satisfied. If it isn't set, then this is |
| 4679 | * a pure timeout request, sequence isn't used. | 4723 | * a pure timeout request, sequence isn't used. |
| 4680 | */ | 4724 | */ |
| 4681 | count = req->timeout.count; | ||
| 4682 | if (!count) { | 4725 | if (!count) { |
| 4683 | req->flags |= REQ_F_TIMEOUT_NOSEQ; | 4726 | req->flags |= REQ_F_TIMEOUT_NOSEQ; |
| 4684 | spin_lock_irq(&ctx->completion_lock); | 4727 | spin_lock_irq(&ctx->completion_lock); |
| @@ -4686,8 +4729,7 @@ static int io_timeout(struct io_kiocb *req) · 1 unmodified line | |||
| 4686 | goto add; | 4729 | goto add; |
| 4687 | } | 4730 | } |
| 4688 | 4731 | ||
| 4689 | req->sequence = ctx->cached_sq_head + count - 1; | 4732 | req->sequence = seq + count; |
| 4690 | data->seq_offset = count; | ||
| 4691 | 4733 | ||
| 4692 | /* | 4734 | /* |
| 4693 | * Insertion sort, ensuring the first entry in the list is always | 4735 | * Insertion sort, ensuring the first entry in the list is always |
| @@ -4696,26 +4738,26 @@ static int io_timeout(struct io_kiocb *req) · 2 unmodified lines | |||
| 4696 | spin_lock_irq(&ctx->completion_lock); | 4738 | spin_lock_irq(&ctx->completion_lock); |
| 4697 | list_for_each_prev(entry, &ctx->timeout_list) { | 4739 | list_for_each_prev(entry, &ctx->timeout_list) { |
| 4698 | struct io_kiocb *nxt = list_entry(entry, struct io_kiocb, list); | 4740 | struct io_kiocb *nxt = list_entry(entry, struct io_kiocb, list); |
| 4699 | unsigned nxt_sq_head; | 4741 | unsigned nxt_seq; |
| 4700 | long long tmp, tmp_nxt; | 4742 | long long tmp, tmp_nxt; |
| 4701 | u32 nxt_offset = nxt->io->timeout.seq_offset; | 4743 | u32 nxt_offset = nxt->timeout.count; |
| 4702 | 4744 | ||
| 4703 | if (nxt->flags & REQ_F_TIMEOUT_NOSEQ) | 4745 | if (nxt->flags & REQ_F_TIMEOUT_NOSEQ) |
| 4704 | continue; | 4746 | continue; |
| 4705 | 4747 | ||
| 4706 | /* | 4748 | /* |
| 4707 | * Since cached_sq_head + count - 1 can overflow, use type long | 4749 | * Since seq + count can overflow, use type long |
| 4708 | * long to store it. | 4750 | * long to store it. |
| 4709 | */ | 4751 | */ |
| 4710 | tmp = (long long)ctx->cached_sq_head + count - 1; | 4752 | tmp = (long long)seq + count; |
| 4711 | nxt_sq_head = nxt->sequence - nxt_offset + 1; | 4753 | nxt_seq = nxt->sequence - nxt_offset; |
| 4712 | tmp_nxt = (long long)nxt_sq_head + nxt_offset - 1; | 4754 | tmp_nxt = (long long)nxt_seq + nxt_offset; |
| 4713 | 4755 | ||
| 4714 | /* | 4756 | /* |
| 4715 | * cached_sq_head may overflow, and it will never overflow twice | 4757 | * cached_sq_head may overflow, and it will never overflow twice |
| 4716 | * once there is some timeout req still be valid. | 4758 | * once there is some timeout req still be valid. |
| 4717 | */ | 4759 | */ |
| 4718 | if (ctx->cached_sq_head < nxt_sq_head) | 4760 | if (seq < nxt_seq) |
| 4719 | tmp += UINT_MAX; | 4761 | tmp += UINT_MAX; |
| 4720 | 4762 | ||
| 4721 | if (tmp > tmp_nxt) | 4763 | if (tmp > tmp_nxt) |
| @@ -5476,7 +5518,7 @@ static struct io_kiocb *io_prep_linked_timeout(struct io_kiocb *req) · 754 unmodified lines | |||
| 5476 | { | 5518 | { |
| 5477 | struct io_kiocb *nxt; | 5519 | struct io_kiocb *nxt; |
| 5478 | 5520 | ||
| 5479 | if (!(req->flags & REQ_F_LINK)) | 5521 | if (!(req->flags & REQ_F_LINK_HEAD)) |
| 5480 | return NULL; | 5522 | return NULL; |
| 5481 | /* for polled retry, if flag is set, we already went through here */ | 5523 | /* for polled retry, if flag is set, we already went through here */ |
| 5482 | if (req->flags & REQ_F_POLLED) | 5524 | if (req->flags & REQ_F_POLLED) |
| @@ -5604,54 +5646,11 @@ static inline void io_queue_link_head(struct io_kiocb *req) · 121 unmodified lines | |||
| 5604 | io_queue_sqe(req, NULL); | 5646 | io_queue_sqe(req, NULL); |
| 5605 | } | 5647 | } |
| 5606 | 5648 | ||
| 5607 | #define SQE_VALID_FLAGS (IOSQE_FIXED_FILE|IOSQE_IO_DRAIN|IOSQE_IO_LINK| \ | 5649 | static int io_submit_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe, |
| 5608 | IOSQE_IO_HARDLINK | IOSQE_ASYNC | \ | ||
| 5609 | IOSQE_BUFFER_SELECT) | ||
| 5610 | |||
| 5611 | static bool io_submit_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe, | ||
| 5612 | struct io_submit_state *state, struct io_kiocb **link) | 5650 | struct io_submit_state *state, struct io_kiocb **link) |
| 5613 | { | 5651 | { |
| 5614 | struct io_ring_ctx *ctx = req->ctx; | 5652 | struct io_ring_ctx *ctx = req->ctx; |
| 5615 | unsigned int sqe_flags; | 5653 | int ret; |
| 5616 | int ret, id, fd; | ||
| 5617 | |||
| 5618 | sqe_flags = READ_ONCE(sqe->flags); | ||
| 5619 | |||
| 5620 | /* enforce forwards compatibility on users */ | ||
| 5621 | if (unlikely(sqe_flags & ~SQE_VALID_FLAGS)) { | ||
| 5622 | ret = -EINVAL; | ||
| 5623 | goto err_req; | ||
| 5624 | } | ||
| 5625 | |||
| 5626 | if ((sqe_flags & IOSQE_BUFFER_SELECT) && | ||
| 5627 | !io_op_defs[req->opcode].buffer_select) { | ||
| 5628 | ret = -EOPNOTSUPP; | ||
| 5629 | goto err_req; | ||
| 5630 | } | ||
| 5631 | |||
| 5632 | id = READ_ONCE(sqe->personality); | ||
| 5633 | if (id) { | ||
| 5634 | req->work.creds = idr_find(&ctx->personality_idr, id); | ||
| 5635 | if (unlikely(!req->work.creds)) { | ||
| 5636 | ret = -EINVAL; | ||
| 5637 | goto err_req; | ||
| 5638 | } | ||
| 5639 | get_cred(req->work.creds); | ||
| 5640 | } | ||
| 5641 | |||
| 5642 | /* same numerical values with corresponding REQ_F_*, safe to copy */ | ||
| 5643 | req->flags |= sqe_flags & (IOSQE_IO_DRAIN | IOSQE_IO_HARDLINK | | ||
| 5644 | IOSQE_ASYNC | IOSQE_FIXED_FILE | | ||
| 5645 | IOSQE_BUFFER_SELECT); | ||
| 5646 | |||
| 5647 | fd = READ_ONCE(sqe->fd); | ||
| 5648 | ret = io_req_set_file(state, req, fd, sqe_flags); | ||
| 5649 | if (unlikely(ret)) { | ||
| 5650 | err_req: | ||
| 5651 | io_cqring_add_event(req, ret); | ||
| 5652 | io_double_put_req(req); | ||
| 5653 | return false; | ||
| 5654 | } | ||
| 5655 | 5654 | ||
| 5656 | /* | 5655 | /* |
| 5657 | * If we already have a head request, queue this one for async | 5656 | * If we already have a head request, queue this one for async |
| @@ -5670,42 +5669,39 @@ err_req: · 12 unmodified lines | |||
| 5670 | * next after the link request. The last one is done via | 5669 | * next after the link request. The last one is done via |
| 5671 | * drain_next flag to persist the effect across calls. | 5670 | * drain_next flag to persist the effect across calls. |
| 5672 | */ | 5671 | */ |
| 5673 | if (sqe_flags & IOSQE_IO_DRAIN) { | 5672 | if (req->flags & REQ_F_IO_DRAIN) { |
| 5674 | head->flags |= REQ_F_IO_DRAIN; | 5673 | head->flags |= REQ_F_IO_DRAIN; |
| 5675 | ctx->drain_next = 1; | 5674 | ctx->drain_next = 1; |
| 5676 | } | 5675 | } |
| 5677 | if (io_alloc_async_ctx(req)) { | 5676 | if (io_alloc_async_ctx(req)) |
| 5678 | ret = -EAGAIN; | 5677 | return -EAGAIN; |
| 5679 | goto err_req; | ||
| 5680 | } | ||
| 5681 | 5678 | ||
| 5682 | ret = io_req_defer_prep(req, sqe); | 5679 | ret = io_req_defer_prep(req, sqe); |
| 5683 | if (ret) { | 5680 | if (ret) { |
| 5684 | /* fail even hard links since we don't submit */ | 5681 | /* fail even hard links since we don't submit */ |
| 5685 | head->flags |= REQ_F_FAIL_LINK; | 5682 | head->flags |= REQ_F_FAIL_LINK; |
| 5686 | goto err_req; | 5683 | return ret; |
| 5687 | } | 5684 | } |
| 5688 | trace_io_uring_link(ctx, req, head); | 5685 | trace_io_uring_link(ctx, req, head); |
| 5689 | list_add_tail(&req->link_list, &head->link_list); | 5686 | list_add_tail(&req->link_list, &head->link_list); |
| 5690 | 5687 | ||
| 5691 | /* last request of a link, enqueue the link */ | 5688 | /* last request of a link, enqueue the link */ |
| 5692 | if (!(sqe_flags & (IOSQE_IO_LINK|IOSQE_IO_HARDLINK))) { | 5689 | if (!(req->flags & (REQ_F_LINK | REQ_F_HARDLINK))) { |
| 5693 | io_queue_link_head(head); | 5690 | io_queue_link_head(head); |
| 5694 | *link = NULL; | 5691 | *link = NULL; |
| 5695 | } | 5692 | } |
| 5696 | } else { | 5693 | } else { |
| 5697 | if (unlikely(ctx->drain_next)) { | 5694 | if (unlikely(ctx->drain_next)) { |
| 5698 | req->flags |= REQ_F_IO_DRAIN; | 5695 | req->flags |= REQ_F_IO_DRAIN; |
| 5699 | req->ctx->drain_next = 0; | 5696 | ctx->drain_next = 0; |
| 5700 | } | 5697 | } |
| 5701 | if (sqe_flags & (IOSQE_IO_LINK|IOSQE_IO_HARDLINK)) { | 5698 | if (req->flags & (REQ_F_LINK | REQ_F_HARDLINK)) { |
| 5702 | req->flags |= REQ_F_LINK; | 5699 | req->flags |= REQ_F_LINK_HEAD; |
| 5703 | INIT_LIST_HEAD(&req->link_list); | 5700 | INIT_LIST_HEAD(&req->link_list); |
| 5704 | 5701 | ||
| 5705 | if (io_alloc_async_ctx(req)) { | 5702 | if (io_alloc_async_ctx(req)) |
| 5706 | ret = -EAGAIN; | 5703 | return -EAGAIN; |
| 5707 | goto err_req; | 5704 | |
| 5708 | } | ||
| 5709 | ret = io_req_defer_prep(req, sqe); | 5705 | ret = io_req_defer_prep(req, sqe); |
| 5710 | if (ret) | 5706 | if (ret) |
| 5711 | req->flags |= REQ_F_FAIL_LINK; | 5707 | req->flags |= REQ_F_FAIL_LINK; |
| @@ -5715,7 +5711,7 @@ err_req: · 3 unmodified lines | |||
| 5715 | } | 5711 | } |
| 5716 | } | 5712 | } |
| 5717 | 5713 | ||
| 5718 | return true; | 5714 | return 0; |
| 5719 | } | 5715 | } |
| 5720 | 5716 | ||
| 5721 | /* | 5717 | /* |
| @@ -5789,15 +5785,23 @@ static inline void io_consume_sqe(struct io_ring_ctx *ctx) · 67 unmodified lines | |||
| 5789 | ctx->cached_sq_head++; | 5785 | ctx->cached_sq_head++; |
| 5790 | } | 5786 | } |
| 5791 | 5787 | ||
| 5792 | static void io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, | 5788 | #define SQE_VALID_FLAGS (IOSQE_FIXED_FILE|IOSQE_IO_DRAIN|IOSQE_IO_LINK| \ |
| 5793 | const struct io_uring_sqe *sqe) | 5789 | IOSQE_IO_HARDLINK | IOSQE_ASYNC | \ |
| 5790 | IOSQE_BUFFER_SELECT) | ||
| 5791 | |||
| 5792 | static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, | ||
| 5793 | const struct io_uring_sqe *sqe, | ||
| 5794 | struct io_submit_state *state, bool async) | ||
| 5794 | { | 5795 | { |
| 5796 | unsigned int sqe_flags; | ||
| 5797 | int id, fd; | ||
| 5798 | |||
| 5795 | /* | 5799 | /* |
| 5796 | * All io need record the previous position, if LINK vs DARIN, | 5800 | * All io need record the previous position, if LINK vs DARIN, |
| 5797 | * it can be used to mark the position of the first IO in the | 5801 | * it can be used to mark the position of the first IO in the |
| 5798 | * link list. | 5802 | * link list. |
| 5799 | */ | 5803 | */ |
| 5800 | req->sequence = ctx->cached_sq_head; | 5804 | req->sequence = ctx->cached_sq_head - ctx->cached_sq_dropped; |
| 5801 | req->opcode = READ_ONCE(sqe->opcode); | 5805 | req->opcode = READ_ONCE(sqe->opcode); |
| 5802 | req->user_data = READ_ONCE(sqe->user_data); | 5806 | req->user_data = READ_ONCE(sqe->user_data); |
| 5803 | req->io = NULL; | 5807 | req->io = NULL; |
| @@ -5808,17 +5812,50 @@ static void io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, · 4 unmodified lines | |||
| 5808 | refcount_set(&req->refs, 2); | 5812 | refcount_set(&req->refs, 2); |
| 5809 | req->task = NULL; | 5813 | req->task = NULL; |
| 5810 | req->result = 0; | 5814 | req->result = 0; |
| 5815 | req->needs_fixed_file = async; | ||
| 5811 | INIT_IO_WORK(&req->work, io_wq_submit_work); | 5816 | INIT_IO_WORK(&req->work, io_wq_submit_work); |
| 5817 | |||
| 5818 | if (unlikely(req->opcode >= IORING_OP_LAST)) | ||
| 5819 | return -EINVAL; | ||
| 5820 | |||
| 5821 | if (io_op_defs[req->opcode].needs_mm && !current->mm) { | ||
| 5822 | if (unlikely(!mmget_not_zero(ctx->sqo_mm))) | ||
| 5823 | return -EFAULT; | ||
| 5824 | use_mm(ctx->sqo_mm); | ||
| 5825 | } | ||
| 5826 | |||
| 5827 | sqe_flags = READ_ONCE(sqe->flags); | ||
| 5828 | /* enforce forwards compatibility on users */ | ||
| 5829 | if (unlikely(sqe_flags & ~SQE_VALID_FLAGS)) | ||
| 5830 | return -EINVAL; | ||
| 5831 | |||
| 5832 | if ((sqe_flags & IOSQE_BUFFER_SELECT) && | ||
| 5833 | !io_op_defs[req->opcode].buffer_select) | ||
| 5834 | return -EOPNOTSUPP; | ||
| 5835 | |||
| 5836 | id = READ_ONCE(sqe->personality); | ||
| 5837 | if (id) { | ||
| 5838 | req->work.creds = idr_find(&ctx->personality_idr, id); | ||
| 5839 | if (unlikely(!req->work.creds)) | ||
| 5840 | return -EINVAL; | ||
| 5841 | get_cred(req->work.creds); | ||
| 5842 | } | ||
| 5843 | |||
| 5844 | /* same numerical values with corresponding REQ_F_*, safe to copy */ | ||
| 5845 | req->flags |= sqe_flags & (IOSQE_IO_DRAIN | IOSQE_IO_HARDLINK | | ||
| 5846 | IOSQE_ASYNC | IOSQE_FIXED_FILE | | ||
| 5847 | IOSQE_BUFFER_SELECT | IOSQE_IO_LINK); | ||
| 5848 | |||
| 5849 | fd = READ_ONCE(sqe->fd); | ||
| 5850 | return io_req_set_file(state, req, fd, sqe_flags); | ||
| 5812 | } | 5851 | } |
| 5813 | 5852 | ||
| 5814 | static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr, | 5853 | static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr, |
| 5815 | struct file *ring_file, int ring_fd, | 5854 | struct file *ring_file, int ring_fd, bool async) |
| 5816 | struct mm_struct **mm, bool async) | ||
| 5817 | { | 5855 | { |
| 5818 | struct io_submit_state state, *statep = NULL; | 5856 | struct io_submit_state state, *statep = NULL; |
| 5819 | struct io_kiocb *link = NULL; | 5857 | struct io_kiocb *link = NULL; |
| 5820 | int i, submitted = 0; | 5858 | int i, submitted = 0; |
| 5821 | bool mm_fault = false; | ||
| 5822 | 5859 | ||
| 5823 | /* if we have a backlog and couldn't flush it all, return BUSY */ | 5860 | /* if we have a backlog and couldn't flush it all, return BUSY */ |
| 5824 | if (test_bit(0, &ctx->sq_check_overflow)) { | 5861 | if (test_bit(0, &ctx->sq_check_overflow)) { |
| @@ -5858,34 +5895,23 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr, · 33 unmodified lines | |||
| 5858 | break; | 5895 | break; |
| 5859 | } | 5896 | } |
| 5860 | 5897 | ||
| 5861 | io_init_req(ctx, req, sqe); | 5898 | err = io_init_req(ctx, req, sqe, statep, async); |
| 5862 | io_consume_sqe(ctx); | 5899 | io_consume_sqe(ctx); |
| 5863 | /* will complete beyond this point, count as submitted */ | 5900 | /* will complete beyond this point, count as submitted */ |
| 5864 | submitted++; | 5901 | submitted++; |
| 5865 | 5902 | ||
| 5866 | if (unlikely(req->opcode >= IORING_OP_LAST)) { | 5903 | if (unlikely(err)) { |
| 5867 | err = -EINVAL; | ||
| 5868 | fail_req: | 5904 | fail_req: |
| 5869 | io_cqring_add_event(req, err); | 5905 | io_cqring_add_event(req, err); |
| 5870 | io_double_put_req(req); | 5906 | io_double_put_req(req); |
| 5871 | break; | 5907 | break; |
| 5872 | } | 5908 | } |
| 5873 | 5909 | ||
| 5874 | if (io_op_defs[req->opcode].needs_mm && !*mm) { | ||
| 5875 | mm_fault = mm_fault || !mmget_not_zero(ctx->sqo_mm); | ||
| 5876 | if (unlikely(mm_fault)) { | ||
| 5877 | err = -EFAULT; | ||
| 5878 | goto fail_req; | ||
| 5879 | } | ||
| 5880 | use_mm(ctx->sqo_mm); | ||
| 5881 | *mm = ctx->sqo_mm; | ||
| 5882 | } | ||
| 5883 | |||
| 5884 | req->needs_fixed_file = async; | ||
| 5885 | trace_io_uring_submit_sqe(ctx, req->opcode, req->user_data, | 5910 | trace_io_uring_submit_sqe(ctx, req->opcode, req->user_data, |
| 5886 | true, async); | 5911 | true, async); |
| 5887 | if (!io_submit_sqe(req, sqe, statep, &link)) | 5912 | err = io_submit_sqe(req, sqe, statep, &link); |
| 5888 | break; | 5913 | if (err) |
| 5914 | goto fail_req; | ||
| 5889 | } | 5915 | } |
| 5890 | 5916 | ||
| 5891 | if (unlikely(submitted != nr)) { | 5917 | if (unlikely(submitted != nr)) { |
| @@ -5904,10 +5930,19 @@ fail_req: · 12 unmodified lines | |||
| 5904 | return submitted; | 5930 | return submitted; |
| 5905 | } | 5931 | } |
| 5906 | 5932 | ||
| 5933 | static inline void io_sq_thread_drop_mm(struct io_ring_ctx *ctx) | ||
| 5934 | { | ||
| 5935 | struct mm_struct *mm = current->mm; | ||
| 5936 | |||
| 5937 | if (mm) { | ||
| 5938 | unuse_mm(mm); | ||
| 5939 | mmput(mm); | ||
| 5940 | } | ||
| 5941 | } | ||
| 5942 | |||
| 5907 | static int io_sq_thread(void *data) | 5943 | static int io_sq_thread(void *data) |
| 5908 | { | 5944 | { |
| 5909 | struct io_ring_ctx *ctx = data; | 5945 | struct io_ring_ctx *ctx = data; |
| 5910 | struct mm_struct *cur_mm = NULL; | ||
| 5911 | const struct cred *old_cred; | 5946 | const struct cred *old_cred; |
| 5912 | mm_segment_t old_fs; | 5947 | mm_segment_t old_fs; |
| 5913 | DEFINE_WAIT(wait); | 5948 | DEFINE_WAIT(wait); |
| @@ -5948,11 +5983,7 @@ static int io_sq_thread(void *data) · 34 unmodified lines | |||
| 5948 | * adding ourselves to the waitqueue, as the unuse/drop | 5983 | * adding ourselves to the waitqueue, as the unuse/drop |
| 5949 | * may sleep. | 5984 | * may sleep. |
| 5950 | */ | 5985 | */ |
| 5951 | if (cur_mm) { | 5986 | io_sq_thread_drop_mm(ctx); |
| 5952 | unuse_mm(cur_mm); | ||
| 5953 | mmput(cur_mm); | ||
| 5954 | cur_mm = NULL; | ||
| 5955 | } | ||
| 5956 | 5987 | ||
| 5957 | /* | 5988 | /* |
| 5958 | * We're polling. If we're within the defined idle | 5989 | * We're polling. If we're within the defined idle |
| @@ -6016,7 +6047,7 @@ static int io_sq_thread(void *data) · 57 unmodified lines | |||
| 6016 | } | 6047 | } |
| 6017 | 6048 | ||
| 6018 | mutex_lock(&ctx->uring_lock); | 6049 | mutex_lock(&ctx->uring_lock); |
| 6019 | ret = io_submit_sqes(ctx, to_submit, NULL, -1, &cur_mm, true); | 6050 | ret = io_submit_sqes(ctx, to_submit, NULL, -1, true); |
| 6020 | mutex_unlock(&ctx->uring_lock); | 6051 | mutex_unlock(&ctx->uring_lock); |
| 6021 | timeout = jiffies + ctx->sq_thread_idle; | 6052 | timeout = jiffies + ctx->sq_thread_idle; |
| 6022 | } | 6053 | } |
| @@ -6025,10 +6056,7 @@ static int io_sq_thread(void *data) · 2 unmodified lines | |||
| 6025 | task_work_run(); | 6056 | task_work_run(); |
| 6026 | 6057 | ||
| 6027 | set_fs(old_fs); | 6058 | set_fs(old_fs); |
| 6028 | if (cur_mm) { | 6059 | io_sq_thread_drop_mm(ctx); |
| 6029 | unuse_mm(cur_mm); | ||
| 6030 | mmput(cur_mm); | ||
| 6031 | } | ||
| 6032 | revert_creds(old_cred); | 6060 | revert_creds(old_cred); |
| 6033 | 6061 | ||
| 6034 | kthread_parkme(); | 6062 | kthread_parkme(); |
| @@ -7509,13 +7537,8 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, · 1474 unmodified lines | |||
| 7509 | wake_up(&ctx->sqo_wait); | 7537 | wake_up(&ctx->sqo_wait); |
| 7510 | submitted = to_submit; | 7538 | submitted = to_submit; |
| 7511 | } else if (to_submit) { | 7539 | } else if (to_submit) { |
| 7512 | struct mm_struct *cur_mm; | ||
| 7513 | |||
| 7514 | mutex_lock(&ctx->uring_lock); | 7540 | mutex_lock(&ctx->uring_lock); |
| 7515 | /* already have mm, so io_submit_sqes() won't try to grab it */ | 7541 | submitted = io_submit_sqes(ctx, to_submit, f.file, fd, false); |
| 7516 | cur_mm = ctx->sqo_mm; | ||
| 7517 | submitted = io_submit_sqes(ctx, to_submit, f.file, fd, | ||
| 7518 | &cur_mm, false); | ||
| 7519 | mutex_unlock(&ctx->uring_lock); | 7542 | mutex_unlock(&ctx->uring_lock); |
| 7520 | 7543 | ||
| 7521 | if (submitted != to_submit) | 7544 | if (submitted != to_submit) |
| @@ -2023,6 +2023,7 @@ lookup_again: · 2022 unmodified lines | |||
| 2023 | goto lookup_again; | 2023 | goto lookup_again; |
| 2024 | } | 2024 | } |
| 2025 | 2025 | ||
| 2026 | spin_unlock(&ino->i_lock); | ||
| 2026 | first = true; | 2027 | first = true; |
| 2027 | status = nfs4_select_rw_stateid(ctx->state, | 2028 | status = nfs4_select_rw_stateid(ctx->state, |
| 2028 | iomode == IOMODE_RW ? FMODE_WRITE : FMODE_READ, | 2029 | iomode == IOMODE_RW ? FMODE_WRITE : FMODE_READ, |
| @@ -2032,12 +2033,12 @@ lookup_again: · 3 unmodified lines | |||
| 2032 | trace_pnfs_update_layout(ino, pos, count, | 2033 | trace_pnfs_update_layout(ino, pos, count, |
| 2033 | iomode, lo, lseg, | 2034 | iomode, lo, lseg, |
| 2034 | PNFS_UPDATE_LAYOUT_INVALID_OPEN); | 2035 | PNFS_UPDATE_LAYOUT_INVALID_OPEN); |
| 2035 | spin_unlock(&ino->i_lock); | ||
| 2036 | nfs4_schedule_stateid_recovery(server, ctx->state); | 2036 | nfs4_schedule_stateid_recovery(server, ctx->state); |
| 2037 | pnfs_clear_first_layoutget(lo); | 2037 | pnfs_clear_first_layoutget(lo); |
| 2038 | pnfs_put_layout_hdr(lo); | 2038 | pnfs_put_layout_hdr(lo); |
| 2039 | goto lookup_again; | 2039 | goto lookup_again; |
| 2040 | } | 2040 | } |
| 2041 | spin_lock(&ino->i_lock); | ||
| 2041 | } else { | 2042 | } else { |
| 2042 | nfs4_stateid_copy(&stateid, &lo->plh_stateid); | 2043 | nfs4_stateid_copy(&stateid, &lo->plh_stateid); |
| 2043 | } | 2044 | } |
| @@ -1312,6 +1312,7 @@ nfsd4_run_cb_work(struct work_struct *work) · 1311 unmodified lines | |||
| 1312 | container_of(work, struct nfsd4_callback, cb_work); | 1312 | container_of(work, struct nfsd4_callback, cb_work); |
| 1313 | struct nfs4_client *clp = cb->cb_clp; | 1313 | struct nfs4_client *clp = cb->cb_clp; |
| 1314 | struct rpc_clnt *clnt; | 1314 | struct rpc_clnt *clnt; |
| 1315 | int flags; | ||
| 1315 | 1316 | ||
| 1316 | if (cb->cb_need_restart) { | 1317 | if (cb->cb_need_restart) { |
| 1317 | cb->cb_need_restart = false; | 1318 | cb->cb_need_restart = false; |
| @@ -1340,7 +1341,8 @@ nfsd4_run_cb_work(struct work_struct *work) · 22 unmodified lines | |||
| 1340 | } | 1341 | } |
| 1341 | 1342 | ||
| 1342 | cb->cb_msg.rpc_cred = clp->cl_cb_cred; | 1343 | cb->cb_msg.rpc_cred = clp->cl_cb_cred; |
| 1343 | rpc_call_async(clnt, &cb->cb_msg, RPC_TASK_SOFT | RPC_TASK_SOFTCONN, | 1344 | flags = clp->cl_minorversion ? RPC_TASK_NOCONNECT : RPC_TASK_SOFTCONN; |
| 1345 | rpc_call_async(clnt, &cb->cb_msg, RPC_TASK_SOFT | flags, | ||
| 1344 | cb->cb_ops ? &nfsd4_cb_ops : &nfsd4_cb_probe_ops, cb); | 1346 | cb->cb_ops ? &nfsd4_cb_ops : &nfsd4_cb_probe_ops, cb); |
| 1345 | } | 1347 | } |
| 1346 | 1348 | ||
| @@ -267,6 +267,8 @@ find_or_allocate_block(struct nfs4_lockowner *lo, struct knfsd_fh *fh, · 266 unmodified lines | |||
| 267 | if (!nbl) { | 267 | if (!nbl) { |
| 268 | nbl= kmalloc(sizeof(*nbl), GFP_KERNEL); | 268 | nbl= kmalloc(sizeof(*nbl), GFP_KERNEL); |
| 269 | if (nbl) { | 269 | if (nbl) { |
| 270 | INIT_LIST_HEAD(&nbl->nbl_list); | ||
| 271 | INIT_LIST_HEAD(&nbl->nbl_lru); | ||
| 270 | fh_copy_shallow(&nbl->nbl_fh, fh); | 272 | fh_copy_shallow(&nbl->nbl_fh, fh); |
| 271 | locks_init_lock(&nbl->nbl_lock); | 273 | locks_init_lock(&nbl->nbl_lock); |
| 272 | nfsd4_init_cb(&nbl->nbl_cb, lo->lo_owner.so_client, | 274 | nfsd4_init_cb(&nbl->nbl_cb, lo->lo_owner.so_client, |
| @@ -1573,6 +1573,7 @@ static ssize_t timens_offsets_write(struct file *file, const char __user *buf, · 1572 unmodified lines | |||
| 1573 | noffsets = 0; | 1573 | noffsets = 0; |
| 1574 | for (pos = kbuf; pos; pos = next_line) { | 1574 | for (pos = kbuf; pos; pos = next_line) { |
| 1575 | struct proc_timens_offset *off = &offsets[noffsets]; | 1575 | struct proc_timens_offset *off = &offsets[noffsets]; |
| 1576 | char clock[10]; | ||
| 1576 | int err; | 1577 | int err; |
| 1577 | 1578 | ||
| 1578 | /* Find the end of line and ensure we don't look past it */ | 1579 | /* Find the end of line and ensure we don't look past it */ |
| @@ -1584,10 +1585,21 @@ static ssize_t timens_offsets_write(struct file *file, const char __user *buf, · 5 unmodified lines | |||
| 1584 | next_line = NULL; | 1585 | next_line = NULL; |
| 1585 | } | 1586 | } |
| 1586 | 1587 | ||
| 1587 | err = sscanf(pos, "%u %lld %lu", &off->clockid, | 1588 | err = sscanf(pos, "%9s %lld %lu", clock, |
| 1588 | &off->val.tv_sec, &off->val.tv_nsec); | 1589 | &off->val.tv_sec, &off->val.tv_nsec); |
| 1589 | if (err != 3 || off->val.tv_nsec >= NSEC_PER_SEC) | 1590 | if (err != 3 || off->val.tv_nsec >= NSEC_PER_SEC) |
| 1590 | goto out; | 1591 | goto out; |
| 1592 | |||
| 1593 | clock[sizeof(clock) - 1] = 0; | ||
| 1594 | if (strcmp(clock, "monotonic") == 0 || | ||
| 1595 | strcmp(clock, __stringify(CLOCK_MONOTONIC)) == 0) | ||
| 1596 | off->clockid = CLOCK_MONOTONIC; | ||
| 1597 | else if (strcmp(clock, "boottime") == 0 || | ||
| 1598 | strcmp(clock, __stringify(CLOCK_BOOTTIME)) == 0) | ||
| 1599 | off->clockid = CLOCK_BOOTTIME; | ||
| 1600 | else | ||
| 1601 | goto out; | ||
| 1602 | |||
| 1591 | noffsets++; | 1603 | noffsets++; |
| 1592 | if (noffsets == ARRAY_SIZE(offsets)) { | 1604 | if (noffsets == ARRAY_SIZE(offsets)) { |
| 1593 | if (next_line) | 1605 | if (next_line) |
| @@ -3274,7 +3286,6 @@ static const struct inode_operations proc_tgid_base_inode_operations = { · 1680 unmodified lines | |||
| 3274 | void proc_flush_pid(struct pid *pid) | 3286 | void proc_flush_pid(struct pid *pid) |
| 3275 | { | 3287 | { |
| 3276 | proc_invalidate_siblings_dcache(&pid->inodes, &pid->lock); | 3288 | proc_invalidate_siblings_dcache(&pid->inodes, &pid->lock); |
| 3277 | put_pid(pid); | ||
| 3278 | } | 3289 | } |
| 3279 | 3290 | ||
| 3280 | static struct dentry *proc_pid_instantiate(struct dentry * dentry, | 3291 | static struct dentry *proc_pid_instantiate(struct dentry * dentry, |
| @@ -196,6 +196,13 @@ static void proc_kill_sb(struct super_block *sb) · 195 unmodified lines | |||
| 196 | if (ns->proc_thread_self) | 196 | if (ns->proc_thread_self) |
| 197 | dput(ns->proc_thread_self); | 197 | dput(ns->proc_thread_self); |
| 198 | kill_anon_super(sb); | 198 | kill_anon_super(sb); |
| 199 | |||
| 200 | /* Make the pid namespace safe for the next mount of proc */ | ||
| 201 | ns->proc_self = NULL; | ||
| 202 | ns->proc_thread_self = NULL; | ||
| 203 | ns->pid_gid = GLOBAL_ROOT_GID; | ||
| 204 | ns->hide_pid = 0; | ||
| 205 | |||
| 199 | put_pid_ns(ns); | 206 | put_pid_ns(ns); |
| 200 | } | 207 | } |
| 201 | 208 | ||
| @@ -266,7 +266,8 @@ static int vmcoredd_mmap_dumps(struct vm_area_struct *vma, unsigned long dst, · 265 unmodified lines | |||
| 266 | if (start < offset + dump->size) { | 266 | if (start < offset + dump->size) { |
| 267 | tsz = min(offset + (u64)dump->size - start, (u64)size); | 267 | tsz = min(offset + (u64)dump->size - start, (u64)size); |
| 268 | buf = dump->buf + start - offset; | 268 | buf = dump->buf + start - offset; |
| 269 | if (remap_vmalloc_range_partial(vma, dst, buf, tsz)) { | 269 | if (remap_vmalloc_range_partial(vma, dst, buf, 0, |
| 270 | tsz)) { | ||
| 270 | ret = -EFAULT; | 271 | ret = -EFAULT; |
| 271 | goto out_unlock; | 272 | goto out_unlock; |
| 272 | } | 273 | } |
| @@ -624,7 +625,7 @@ static int mmap_vmcore(struct file *file, struct vm_area_struct *vma) · 351 unmodified lines | |||
| 624 | tsz = min(elfcorebuf_sz + elfnotes_sz - (size_t)start, size); | 625 | tsz = min(elfcorebuf_sz + elfnotes_sz - (size_t)start, size); |
| 625 | kaddr = elfnotes_buf + start - elfcorebuf_sz - vmcoredd_orig_sz; | 626 | kaddr = elfnotes_buf + start - elfcorebuf_sz - vmcoredd_orig_sz; |
| 626 | if (remap_vmalloc_range_partial(vma, vma->vm_start + len, | 627 | if (remap_vmalloc_range_partial(vma, vma->vm_start + len, |
| 627 | kaddr, tsz)) | 628 | kaddr, 0, tsz)) |
| 628 | goto fail; | 629 | goto fail; |
| 629 | 630 | ||
| 630 | size -= tsz; | 631 | size -= tsz; |
| @@ -911,7 +911,12 @@ xfs_eofblocks_worker( · 910 unmodified lines | |||
| 911 | { | 911 | { |
| 912 | struct xfs_mount *mp = container_of(to_delayed_work(work), | 912 | struct xfs_mount *mp = container_of(to_delayed_work(work), |
| 913 | struct xfs_mount, m_eofblocks_work); | 913 | struct xfs_mount, m_eofblocks_work); |
| 914 | |||
| 915 | if (!sb_start_write_trylock(mp->m_super)) | ||
| 916 | return; | ||
| 914 | xfs_icache_free_eofblocks(mp, NULL); | 917 | xfs_icache_free_eofblocks(mp, NULL); |
| 918 | sb_end_write(mp->m_super); | ||
| 919 | |||
| 915 | xfs_queue_eofblocks(mp); | 920 | xfs_queue_eofblocks(mp); |
| 916 | } | 921 | } |
| 917 | 922 | ||
| @@ -938,7 +943,12 @@ xfs_cowblocks_worker( · 20 unmodified lines | |||
| 938 | { | 943 | { |
| 939 | struct xfs_mount *mp = container_of(to_delayed_work(work), | 944 | struct xfs_mount *mp = container_of(to_delayed_work(work), |
| 940 | struct xfs_mount, m_cowblocks_work); | 945 | struct xfs_mount, m_cowblocks_work); |
| 946 | |||
| 947 | if (!sb_start_write_trylock(mp->m_super)) | ||
| 948 | return; | ||
| 941 | xfs_icache_free_cowblocks(mp, NULL); | 949 | xfs_icache_free_cowblocks(mp, NULL); |
| 950 | sb_end_write(mp->m_super); | ||
| 951 | |||
| 942 | xfs_queue_cowblocks(mp); | 952 | xfs_queue_cowblocks(mp); |
| 943 | } | 953 | } |
| 944 | 954 | ||
| @@ -2363,7 +2363,10 @@ xfs_file_ioctl( · 2362 unmodified lines | |||
| 2363 | if (error) | 2363 | if (error) |
| 2364 | return error; | 2364 | return error; |
| 2365 | 2365 | ||
| 2366 | return xfs_icache_free_eofblocks(mp, &keofb); | 2366 | sb_start_write(mp->m_super); |
| 2367 | error = xfs_icache_free_eofblocks(mp, &keofb); | ||
| 2368 | sb_end_write(mp->m_super); | ||
| 2369 | return error; | ||
| 2367 | } | 2370 | } |
| 2368 | 2371 | ||
| 2369 | default: | 2372 | default: |
| @@ -167,8 +167,12 @@ typedef struct xfs_mount { · 166 unmodified lines | |||
| 167 | struct xfs_kobj m_error_meta_kobj; | 167 | struct xfs_kobj m_error_meta_kobj; |
| 168 | struct xfs_error_cfg m_error_cfg[XFS_ERR_CLASS_MAX][XFS_ERR_ERRNO_MAX]; | 168 | struct xfs_error_cfg m_error_cfg[XFS_ERR_CLASS_MAX][XFS_ERR_ERRNO_MAX]; |
| 169 | struct xstats m_stats; /* per-fs stats */ | 169 | struct xstats m_stats; /* per-fs stats */ |
| 170 | struct ratelimit_state m_flush_inodes_ratelimit; | ||
| 171 | 170 | ||
| 171 | /* | ||
| 172 | * Workqueue item so that we can coalesce multiple inode flush attempts | ||
| 173 | * into a single flush. | ||
| 174 | */ | ||
| 175 | struct work_struct m_flush_inodes_work; | ||
| 172 | struct workqueue_struct *m_buf_workqueue; | 176 | struct workqueue_struct *m_buf_workqueue; |
| 173 | struct workqueue_struct *m_unwritten_workqueue; | 177 | struct workqueue_struct *m_unwritten_workqueue; |
| 174 | struct workqueue_struct *m_cil_workqueue; | 178 | struct workqueue_struct *m_cil_workqueue; |
| @@ -1051,6 +1051,7 @@ xfs_reflink_remap_extent( · 1050 unmodified lines | |||
| 1051 | uirec.br_startblock = irec->br_startblock + rlen; | 1051 | uirec.br_startblock = irec->br_startblock + rlen; |
| 1052 | uirec.br_startoff = irec->br_startoff + rlen; | 1052 | uirec.br_startoff = irec->br_startoff + rlen; |
| 1053 | uirec.br_blockcount = unmap_len - rlen; | 1053 | uirec.br_blockcount = unmap_len - rlen; |
| 1054 | uirec.br_state = irec->br_state; | ||
| 1054 | unmap_len = rlen; | 1055 | unmap_len = rlen; |
| 1055 | 1056 | ||
| 1056 | /* If this isn't a real mapping, we're done. */ | 1057 | /* If this isn't a real mapping, we're done. */ |
| @@ -516,6 +516,20 @@ xfs_destroy_mount_workqueues( · 515 unmodified lines | |||
| 516 | destroy_workqueue(mp->m_buf_workqueue); | 516 | destroy_workqueue(mp->m_buf_workqueue); |
| 517 | } | 517 | } |
| 518 | 518 | ||
| 519 | static void | ||
| 520 | xfs_flush_inodes_worker( | ||
| 521 | struct work_struct *work) | ||
| 522 | { | ||
| 523 | struct xfs_mount *mp = container_of(work, struct xfs_mount, | ||
| 524 | m_flush_inodes_work); | ||
| 525 | struct super_block *sb = mp->m_super; | ||
| 526 | |||
| 527 | if (down_read_trylock(&sb->s_umount)) { | ||
| 528 | sync_inodes_sb(sb); | ||
| 529 | up_read(&sb->s_umount); | ||
| 530 | } | ||
| 531 | } | ||
| 532 | |||
| 519 | /* | 533 | /* |
| 520 | * Flush all dirty data to disk. Must not be called while holding an XFS_ILOCK | 534 | * Flush all dirty data to disk. Must not be called while holding an XFS_ILOCK |
| 521 | * or a page lock. We use sync_inodes_sb() here to ensure we block while waiting | 535 | * or a page lock. We use sync_inodes_sb() here to ensure we block while waiting |
| @@ -526,15 +540,15 @@ void · 4 unmodified lines | |||
| 526 | xfs_flush_inodes( | 540 | xfs_flush_inodes( |
| 527 | struct xfs_mount *mp) | 541 | struct xfs_mount *mp) |
| 528 | { | 542 | { |
| 529 | struct super_block *sb = mp->m_super; | 543 | /* |
| 530 | 544 | * If flush_work() returns true then that means we waited for a flush | |
| 531 | if (!__ratelimit(&mp->m_flush_inodes_ratelimit)) | 545 | * which was already in progress. Don't bother running another scan. |
| 546 | */ | ||
| 547 | if (flush_work(&mp->m_flush_inodes_work)) | ||
| 532 | return; | 548 | return; |
| 533 | 549 | ||
| 534 | if (down_read_trylock(&sb->s_umount)) { | 550 | queue_work(mp->m_sync_workqueue, &mp->m_flush_inodes_work); |
| 535 | sync_inodes_sb(sb); | 551 | flush_work(&mp->m_flush_inodes_work); |
| 536 | up_read(&sb->s_umount); | ||
| 537 | } | ||
| 538 | } | 552 | } |
| 539 | 553 | ||
| 540 | /* Catch misguided souls that try to use this interface on XFS */ | 554 | /* Catch misguided souls that try to use this interface on XFS */ |
| @@ -1369,17 +1383,6 @@ xfs_fc_fill_super( · 828 unmodified lines | |||
| 1369 | if (error) | 1383 | if (error) |
| 1370 | goto out_free_names; | 1384 | goto out_free_names; |
| 1371 | 1385 | ||
| 1372 | /* | ||
| 1373 | * Cap the number of invocations of xfs_flush_inodes to 16 for every | ||
| 1374 | * quarter of a second. The magic numbers here were determined by | ||
| 1375 | * observation neither to cause stalls in writeback when there are a | ||
| 1376 | * lot of IO threads and the fs is near ENOSPC, nor cause any fstest | ||
| 1377 | * regressions. YMMV. | ||
| 1378 | */ | ||
| 1379 | ratelimit_state_init(&mp->m_flush_inodes_ratelimit, HZ / 4, 16); | ||
| 1380 | ratelimit_set_flags(&mp->m_flush_inodes_ratelimit, | ||
| 1381 | RATELIMIT_MSG_ON_RELEASE); | ||
| 1382 | |||
| 1383 | error = xfs_init_mount_workqueues(mp); | 1386 | error = xfs_init_mount_workqueues(mp); |
| 1384 | if (error) | 1387 | if (error) |
| 1385 | goto out_close_devices; | 1388 | goto out_close_devices; |
| @@ -1752,6 +1755,7 @@ static int xfs_init_fs_context( · 366 unmodified lines | |||
| 1752 | spin_lock_init(&mp->m_perag_lock); | 1755 | spin_lock_init(&mp->m_perag_lock); |
| 1753 | mutex_init(&mp->m_growlock); | 1756 | mutex_init(&mp->m_growlock); |
| 1754 | atomic_set(&mp->m_active_trans, 0); | 1757 | atomic_set(&mp->m_active_trans, 0); |
| 1758 | INIT_WORK(&mp->m_flush_inodes_work, xfs_flush_inodes_worker); | ||
| 1755 | INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker); | 1759 | INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker); |
| 1756 | INIT_DELAYED_WORK(&mp->m_eofblocks_work, xfs_eofblocks_worker); | 1760 | INIT_DELAYED_WORK(&mp->m_eofblocks_work, xfs_eofblocks_worker); |
| 1757 | INIT_DELAYED_WORK(&mp->m_cowblocks_work, xfs_cowblocks_worker); | 1761 | INIT_DELAYED_WORK(&mp->m_cowblocks_work, xfs_cowblocks_worker); |
| @@ -56,6 +56,7 @@ mandatory-y += topology.h · 55 unmodified lines | |||
| 56 | mandatory-y += trace_clock.h | 56 | mandatory-y += trace_clock.h |
| 57 | mandatory-y += uaccess.h | 57 | mandatory-y += uaccess.h |
| 58 | mandatory-y += unaligned.h | 58 | mandatory-y += unaligned.h |
| 59 | mandatory-y += vermagic.h | ||
| 59 | mandatory-y += vga.h | 60 | mandatory-y += vga.h |
| 60 | mandatory-y += word-at-a-time.h | 61 | mandatory-y += word-at-a-time.h |
| 61 | mandatory-y += xor.h | 62 | mandatory-y += xor.h |
| @@ -163,7 +163,7 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset, · 162 unmodified lines | |||
| 163 | return nr_bank; | 163 | return nr_bank; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | void hyperv_report_panic(struct pt_regs *regs, long err); | 166 | void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die); |
| 167 | void hyperv_report_panic_msg(phys_addr_t pa, size_t size); | 167 | void hyperv_report_panic_msg(phys_addr_t pa, size_t size); |
| 168 | bool hv_is_hyperv_initialized(void); | 168 | bool hv_is_hyperv_initialized(void); |
| 169 | bool hv_is_hibernation_supported(void); | 169 | bool hv_is_hibernation_supported(void); |
| @@ -0,0 +1,7 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| 2 | #ifndef _ASM_GENERIC_VERMAGIC_H | ||
| 3 | #define _ASM_GENERIC_VERMAGIC_H | ||
| 4 | |||
| 5 | #define MODULE_ARCH_VERMAGIC "" | ||
| 6 | |||
| 7 | #endif /* _ASM_GENERIC_VERMAGIC_H */ | ||
| @@ -54,7 +54,6 @@ enum wb_reason { · 53 unmodified lines | |||
| 54 | WB_REASON_SYNC, | 54 | WB_REASON_SYNC, |
| 55 | WB_REASON_PERIODIC, | 55 | WB_REASON_PERIODIC, |
| 56 | WB_REASON_LAPTOP_TIMER, | 56 | WB_REASON_LAPTOP_TIMER, |
| 57 | WB_REASON_FREE_MORE_MEM, | ||
| 58 | WB_REASON_FS_FREE_SPACE, | 57 | WB_REASON_FS_FREE_SPACE, |
| 59 | /* | 58 | /* |
| 60 | * There is no bdi forker thread any more and works are done | 59 | * There is no bdi forker thread any more and works are done |
| @@ -319,7 +319,7 @@ struct bio_integrity_payload { · 318 unmodified lines | |||
| 319 | struct work_struct bip_work; /* I/O completion */ | 319 | struct work_struct bip_work; /* I/O completion */ |
| 320 | 320 | ||
| 321 | struct bio_vec *bip_vec; | 321 | struct bio_vec *bip_vec; |
| 322 | struct bio_vec bip_inline_vecs[0];/* embedded bvec array */ | 322 | struct bio_vec bip_inline_vecs[];/* embedded bvec array */ |
| 323 | }; | 323 | }; |
| 324 | 324 | ||
| 325 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | 325 | #if defined(CONFIG_BLK_DEV_INTEGRITY) |
| @@ -173,7 +173,7 @@ struct blk_mq_hw_ctx { · 172 unmodified lines | |||
| 173 | * blocking (BLK_MQ_F_BLOCKING). Must be the last member - see also | 173 | * blocking (BLK_MQ_F_BLOCKING). Must be the last member - see also |
| 174 | * blk_mq_hw_ctx_size(). | 174 | * blk_mq_hw_ctx_size(). |
| 175 | */ | 175 | */ |
| 176 | struct srcu_struct srcu[0]; | 176 | struct srcu_struct srcu[]; |
| 177 | }; | 177 | }; |
| 178 | 178 | ||
| 179 | /** | 179 | /** |
| @@ -198,7 +198,7 @@ struct bio { · 197 unmodified lines | |||
| 198 | * double allocations for a small number of bio_vecs. This member | 198 | * double allocations for a small number of bio_vecs. This member |
| 199 | * MUST obviously be kept at the very end of the bio. | 199 | * MUST obviously be kept at the very end of the bio. |
| 200 | */ | 200 | */ |
| 201 | struct bio_vec bi_inline_vecs[0]; | 201 | struct bio_vec bi_inline_vecs[]; |
| 202 | }; | 202 | }; |
| 203 | 203 | ||
| 204 | #define BIO_RESET_BYTES offsetof(struct bio, bi_max_vecs) | 204 | #define BIO_RESET_BYTES offsetof(struct bio, bi_max_vecs) |
| @@ -189,6 +189,8 @@ struct buffer_head *__getblk_gfp(struct block_device *bdev, sector_t block, · 188 unmodified lines | |||
| 189 | void __brelse(struct buffer_head *); | 189 | void __brelse(struct buffer_head *); |
| 190 | void __bforget(struct buffer_head *); | 190 | void __bforget(struct buffer_head *); |
| 191 | void __breadahead(struct block_device *, sector_t block, unsigned int size); | 191 | void __breadahead(struct block_device *, sector_t block, unsigned int size); |
| 192 | void __breadahead_gfp(struct block_device *, sector_t block, unsigned int size, | ||
| 193 | gfp_t gfp); | ||
| 192 | struct buffer_head *__bread_gfp(struct block_device *, | 194 | struct buffer_head *__bread_gfp(struct block_device *, |
| 193 | sector_t block, unsigned size, gfp_t gfp); | 195 | sector_t block, unsigned size, gfp_t gfp); |
| 194 | void invalidate_bh_lrus(void); | 196 | void invalidate_bh_lrus(void); |
| @@ -319,6 +321,12 @@ sb_breadahead(struct super_block *sb, sector_t block) · 124 unmodified lines | |||
| 319 | __breadahead(sb->s_bdev, block, sb->s_blocksize); | 321 | __breadahead(sb->s_bdev, block, sb->s_blocksize); |
| 320 | } | 322 | } |
| 321 | 323 | ||
| 324 | static inline void | ||
| 325 | sb_breadahead_unmovable(struct super_block *sb, sector_t block) | ||
| 326 | { | ||
| 327 | __breadahead_gfp(sb->s_bdev, block, sb->s_blocksize, 0); | ||
| 328 | } | ||
| 329 | |||
| 322 | static inline struct buffer_head * | 330 | static inline struct buffer_head * |
| 323 | sb_getblk(struct super_block *sb, sector_t block) | 331 | sb_getblk(struct super_block *sb, sector_t block) |
| 324 | { | 332 | { |
| @@ -189,7 +189,7 @@ struct __packed pucan_rx_msg { · 188 unmodified lines | |||
| 189 | u8 client; | 189 | u8 client; |
| 190 | __le16 flags; | 190 | __le16 flags; |
| 191 | __le32 can_id; | 191 | __le32 can_id; |
| 192 | u8 d[0]; | 192 | u8 d[]; |
| 193 | }; | 193 | }; |
| 194 | 194 | ||
| 195 | /* uCAN error types */ | 195 | /* uCAN error types */ |
| @@ -266,7 +266,7 @@ struct __packed pucan_tx_msg { · 70 unmodified lines | |||
| 266 | u8 client; | 266 | u8 client; |
| 267 | __le16 flags; | 267 | __le16 flags; |
| 268 | __le32 can_id; | 268 | __le32 can_id; |
| 269 | u8 d[0]; | 269 | u8 d[]; |
| 270 | }; | 270 | }; |
| 271 | 271 | ||
| 272 | /* build the cmd opcode_channel field with respect to the correct endianness */ | 272 | /* build the cmd opcode_channel field with respect to the correct endianness */ |
| @@ -28,7 +28,7 @@ struct cpu_rmap { · 27 unmodified lines | |||
| 28 | struct { | 28 | struct { |
| 29 | u16 index; | 29 | u16 index; |
| 30 | u16 dist; | 30 | u16 dist; |
| 31 | } near[0]; | 31 | } near[]; |
| 32 | }; | 32 | }; |
| 33 | #define CPU_RMAP_DIST_INF 0xffff | 33 | #define CPU_RMAP_DIST_INF 0xffff |
| 34 | 34 | ||
| @@ -103,8 +103,8 @@ void debugfs_create_u8(const char *name, umode_t mode, struct dentry *parent, · 102 unmodified lines | |||
| 103 | u8 *value); | 103 | u8 *value); |
| 104 | void debugfs_create_u16(const char *name, umode_t mode, struct dentry *parent, | 104 | void debugfs_create_u16(const char *name, umode_t mode, struct dentry *parent, |
| 105 | u16 *value); | 105 | u16 *value); |
| 106 | struct dentry *debugfs_create_u32(const char *name, umode_t mode, | 106 | void debugfs_create_u32(const char *name, umode_t mode, struct dentry *parent, |
| 107 | struct dentry *parent, u32 *value); | 107 | u32 *value); |
| 108 | void debugfs_create_u64(const char *name, umode_t mode, struct dentry *parent, | 108 | void debugfs_create_u64(const char *name, umode_t mode, struct dentry *parent, |
| 109 | u64 *value); | 109 | u64 *value); |
| 110 | struct dentry *debugfs_create_ulong(const char *name, umode_t mode, | 110 | struct dentry *debugfs_create_ulong(const char *name, umode_t mode, |
| @@ -250,12 +250,8 @@ static inline void debugfs_create_u8(const char *name, umode_t mode, · 139 unmodified lines | |||
| 250 | static inline void debugfs_create_u16(const char *name, umode_t mode, | 250 | static inline void debugfs_create_u16(const char *name, umode_t mode, |
| 251 | struct dentry *parent, u16 *value) { } | 251 | struct dentry *parent, u16 *value) { } |
| 252 | 252 | ||
| 253 | static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode, | 253 | static inline void debugfs_create_u32(const char *name, umode_t mode, |
| 254 | struct dentry *parent, | 254 | struct dentry *parent, u32 *value) { } |
| 255 | u32 *value) | ||
| 256 | { | ||
| 257 | return ERR_PTR(-ENODEV); | ||
| 258 | } | ||
| 259 | 255 | ||
| 260 | static inline void debugfs_create_u64(const char *name, umode_t mode, | 256 | static inline void debugfs_create_u64(const char *name, umode_t mode, |
| 261 | struct dentry *parent, u64 *value) { } | 257 | struct dentry *parent, u64 *value) { } |
| @@ -29,7 +29,7 @@ struct pubkey_hdr { · 28 unmodified lines | |||
| 29 | uint32_t timestamp; /* key made, always 0 for now */ | 29 | uint32_t timestamp; /* key made, always 0 for now */ |
| 30 | uint8_t algo; | 30 | uint8_t algo; |
| 31 | uint8_t nmpi; | 31 | uint8_t nmpi; |
| 32 | char mpi[0]; | 32 | char mpi[]; |
| 33 | } __packed; | 33 | } __packed; |
| 34 | 34 | ||
| 35 | struct signature_hdr { | 35 | struct signature_hdr { |
| @@ -39,7 +39,7 @@ struct signature_hdr { · 3 unmodified lines | |||
| 39 | uint8_t hash; | 39 | uint8_t hash; |
| 40 | uint8_t keyid[8]; | 40 | uint8_t keyid[8]; |
| 41 | uint8_t nmpi; | 41 | uint8_t nmpi; |
| 42 | char mpi[0]; | 42 | char mpi[]; |
| 43 | } __packed; | 43 | } __packed; |
| 44 | 44 | ||
| 45 | #if defined(CONFIG_SIGNATURE) || defined(CONFIG_SIGNATURE_MODULE) | 45 | #if defined(CONFIG_SIGNATURE) || defined(CONFIG_SIGNATURE_MODULE) |
| @@ -7,7 +7,7 @@ struct linux_dirent64 { · 6 unmodified lines | |||
| 7 | s64 d_off; | 7 | s64 d_off; |
| 8 | unsigned short d_reclen; | 8 | unsigned short d_reclen; |
| 9 | unsigned char d_type; | 9 | unsigned char d_type; |
| 10 | char d_name[0]; | 10 | char d_name[]; |
| 11 | }; | 11 | }; |
| 12 | 12 | ||
| 13 | #endif | 13 | #endif |
| @@ -101,7 +101,7 @@ struct enclosure_device { · 100 unmodified lines | |||
| 101 | struct device edev; | 101 | struct device edev; |
| 102 | struct enclosure_component_callbacks *cb; | 102 | struct enclosure_component_callbacks *cb; |
| 103 | int components; | 103 | int components; |
| 104 | struct enclosure_component component[0]; | 104 | struct enclosure_component component[]; |
| 105 | }; | 105 | }; |
| 106 | 106 | ||
| 107 | static inline struct enclosure_device * | 107 | static inline struct enclosure_device * |
| @@ -36,7 +36,7 @@ struct em_cap_state { · 35 unmodified lines | |||
| 36 | struct em_perf_domain { | 36 | struct em_perf_domain { |
| 37 | struct em_cap_state *table; | 37 | struct em_cap_state *table; |
| 38 | int nr_cap_states; | 38 | int nr_cap_states; |
| 39 | unsigned long cpus[0]; | 39 | unsigned long cpus[]; |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | #ifdef CONFIG_ENERGY_MODEL | 42 | #ifdef CONFIG_ENERGY_MODEL |
| @@ -35,7 +35,7 @@ struct compat_ethtool_rxnfc { · 34 unmodified lines | |||
| 35 | compat_u64 data; | 35 | compat_u64 data; |
| 36 | struct compat_ethtool_rx_flow_spec fs; | 36 | struct compat_ethtool_rx_flow_spec fs; |
| 37 | u32 rule_cnt; | 37 | u32 rule_cnt; |
| 38 | u32 rule_locs[0]; | 38 | u32 rule_locs[]; |
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | #endif /* CONFIG_COMPAT */ | 41 | #endif /* CONFIG_COMPAT */ |
| @@ -462,7 +462,7 @@ int ethtool_check_ops(const struct ethtool_ops *ops); · 420 unmodified lines | |||
| 462 | 462 | ||
| 463 | struct ethtool_rx_flow_rule { | 463 | struct ethtool_rx_flow_rule { |
| 464 | struct flow_rule *rule; | 464 | struct flow_rule *rule; |
| 465 | unsigned long priv[0]; | 465 | unsigned long priv[]; |
| 466 | }; | 466 | }; |
| 467 | 467 | ||
| 468 | struct ethtool_rx_flow_spec_input { | 468 | struct ethtool_rx_flow_spec_input { |
| @@ -76,7 +76,7 @@ struct gen_pool_chunk { · 75 unmodified lines | |||
| 76 | void *owner; /* private data to retrieve at alloc time */ | 76 | void *owner; /* private data to retrieve at alloc time */ |
| 77 | unsigned long start_addr; /* start address of memory chunk */ | 77 | unsigned long start_addr; /* start address of memory chunk */ |
| 78 | unsigned long end_addr; /* end address of memory chunk (inclusive) */ | 78 | unsigned long end_addr; /* end address of memory chunk (inclusive) */ |
| 79 | unsigned long bits[0]; /* bitmap for allocating memory chunk */ | 79 | unsigned long bits[]; /* bitmap for allocating memory chunk */ |
| 80 | }; | 80 | }; |
| 81 | 81 | ||
| 82 | /* | 82 | /* |
| @@ -461,12 +461,6 @@ i2c_new_scanned_device(struct i2c_adapter *adap, · 460 unmodified lines | |||
| 461 | unsigned short const *addr_list, | 461 | unsigned short const *addr_list, |
| 462 | int (*probe)(struct i2c_adapter *adap, unsigned short addr)); | 462 | int (*probe)(struct i2c_adapter *adap, unsigned short addr)); |
| 463 | 463 | ||
| 464 | struct i2c_client * | ||
| 465 | i2c_new_probed_device(struct i2c_adapter *adap, | ||
| 466 | struct i2c_board_info *info, | ||
| 467 | unsigned short const *addr_list, | ||
| 468 | int (*probe)(struct i2c_adapter *adap, unsigned short addr)); | ||
| 469 | |||
| 470 | /* Common custom probe functions */ | 464 | /* Common custom probe functions */ |
| 471 | int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr); | 465 | int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr); |
| 472 | 466 | ||
| @@ -38,7 +38,7 @@ struct ip_sf_socklist { · 37 unmodified lines | |||
| 38 | unsigned int sl_max; | 38 | unsigned int sl_max; |
| 39 | unsigned int sl_count; | 39 | unsigned int sl_count; |
| 40 | struct rcu_head rcu; | 40 | struct rcu_head rcu; |
| 41 | __be32 sl_addr[0]; | 41 | __be32 sl_addr[]; |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | #define IP_SFLSIZE(count) (sizeof(struct ip_sf_socklist) + \ | 44 | #define IP_SFLSIZE(count) (sizeof(struct ip_sf_socklist) + \ |
| @@ -18,7 +18,7 @@ · 17 unmodified lines | |||
| 18 | struct ihex_binrec { | 18 | struct ihex_binrec { |
| 19 | __be32 addr; | 19 | __be32 addr; |
| 20 | __be16 len; | 20 | __be16 len; |
| 21 | uint8_t data[0]; | 21 | uint8_t data[]; |
| 22 | } __attribute__((packed)); | 22 | } __attribute__((packed)); |
| 23 | 23 | ||
| 24 | static inline uint16_t ihex_binrec_size(const struct ihex_binrec *p) | 24 | static inline uint16_t ihex_binrec_size(const struct ihex_binrec *p) |
| @@ -600,7 +600,7 @@ void iio_device_unregister(struct iio_dev *indio_dev); · 599 unmodified lines | |||
| 600 | * 0 on success, negative error number on failure. | 600 | * 0 on success, negative error number on failure. |
| 601 | */ | 601 | */ |
| 602 | #define devm_iio_device_register(dev, indio_dev) \ | 602 | #define devm_iio_device_register(dev, indio_dev) \ |
| 603 | __devm_iio_device_register((dev), (indio_dev), THIS_MODULE); | 603 | __devm_iio_device_register((dev), (indio_dev), THIS_MODULE) |
| 604 | int __devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev, | 604 | int __devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev, |
| 605 | struct module *this_mod); | 605 | struct module *this_mod); |
| 606 | void devm_iio_device_unregister(struct device *dev, struct iio_dev *indio_dev); | 606 | void devm_iio_device_unregister(struct device *dev, struct iio_dev *indio_dev); |
| @@ -573,8 +573,6 @@ enum { · 572 unmodified lines | |||
| 573 | #define IRQ_DEFAULT_INIT_FLAGS ARCH_IRQ_INIT_FLAGS | 573 | #define IRQ_DEFAULT_INIT_FLAGS ARCH_IRQ_INIT_FLAGS |
| 574 | 574 | ||
| 575 | struct irqaction; | 575 | struct irqaction; |
| 576 | extern int setup_irq(unsigned int irq, struct irqaction *new); | ||
| 577 | extern void remove_irq(unsigned int irq, struct irqaction *act); | ||
| 578 | extern int setup_percpu_irq(unsigned int irq, struct irqaction *new); | 576 | extern int setup_percpu_irq(unsigned int irq, struct irqaction *new); |
| 579 | extern void remove_percpu_irq(unsigned int irq, struct irqaction *act); | 577 | extern void remove_percpu_irq(unsigned int irq, struct irqaction *act); |
| 580 | 578 | ||
| @@ -1043,7 +1041,7 @@ struct irq_chip_generic { · 462 unmodified lines | |||
| 1043 | unsigned long unused; | 1041 | unsigned long unused; |
| 1044 | struct irq_domain *domain; | 1042 | struct irq_domain *domain; |
| 1045 | struct list_head list; | 1043 | struct list_head list; |
| 1046 | struct irq_chip_type chip_types[0]; | 1044 | struct irq_chip_type chip_types[]; |
| 1047 | }; | 1045 | }; |
| 1048 | 1046 | ||
| 1049 | /** | 1047 | /** |
| @@ -1079,7 +1077,7 @@ struct irq_domain_chip_generic { · 29 unmodified lines | |||
| 1079 | unsigned int irq_flags_to_clear; | 1077 | unsigned int irq_flags_to_clear; |
| 1080 | unsigned int irq_flags_to_set; | 1078 | unsigned int irq_flags_to_set; |
| 1081 | enum irq_gc_flags gc_flags; | 1079 | enum irq_gc_flags gc_flags; |
| 1082 | struct irq_chip_generic *gc[0]; | 1080 | struct irq_chip_generic *gc[]; |
| 1083 | }; | 1081 | }; |
| 1084 | 1082 | ||
| 1085 | /* Generic chip callback functions */ | 1083 | /* Generic chip callback functions */ |
| @@ -243,6 +243,7 @@ · 242 unmodified lines | |||
| 243 | 243 | ||
| 244 | #define GICR_TYPER_PLPIS (1U << 0) | 244 | #define GICR_TYPER_PLPIS (1U << 0) |
| 245 | #define GICR_TYPER_VLPIS (1U << 1) | 245 | #define GICR_TYPER_VLPIS (1U << 1) |
| 246 | #define GICR_TYPER_DIRTY (1U << 2) | ||
| 246 | #define GICR_TYPER_DirectLPIS (1U << 3) | 247 | #define GICR_TYPER_DirectLPIS (1U << 3) |
| 247 | #define GICR_TYPER_LAST (1U << 4) | 248 | #define GICR_TYPER_LAST (1U << 4) |
| 248 | #define GICR_TYPER_RVPEID (1U << 7) | 249 | #define GICR_TYPER_RVPEID (1U << 7) |
| @@ -686,6 +687,7 @@ struct rdists { · 437 unmodified lines | |||
| 686 | bool has_vlpis; | 687 | bool has_vlpis; |
| 687 | bool has_rvpeid; | 688 | bool has_rvpeid; |
| 688 | bool has_direct_lpi; | 689 | bool has_direct_lpi; |
| 690 | bool has_vpend_valid_dirty; | ||
| 689 | }; | 691 | }; |
| 690 | 692 | ||
| 691 | struct irq_domain; | 693 | struct irq_domain; |
| @@ -1048,7 +1048,7 @@ search_memslots(struct kvm_memslots *slots, gfn_t gfn) · 1047 unmodified lines | |||
| 1048 | start = slot + 1; | 1048 | start = slot + 1; |
| 1049 | } | 1049 | } |
| 1050 | 1050 | ||
| 1051 | if (gfn >= memslots[start].base_gfn && | 1051 | if (start < slots->used_slots && gfn >= memslots[start].base_gfn && |
| 1052 | gfn < memslots[start].base_gfn + memslots[start].npages) { | 1052 | gfn < memslots[start].base_gfn + memslots[start].npages) { |
| 1053 | atomic_set(&slots->lru_slot, start); | 1053 | atomic_set(&slots->lru_slot, start); |
| 1054 | return &memslots[start]; | 1054 | return &memslots[start]; |
| @@ -34,7 +34,7 @@ struct list_lru_one { · 33 unmodified lines | |||
| 34 | struct list_lru_memcg { | 34 | struct list_lru_memcg { |
| 35 | struct rcu_head rcu; | 35 | struct rcu_head rcu; |
| 36 | /* array of per cgroup lists, indexed by memcg_cache_id */ | 36 | /* array of per cgroup lists, indexed by memcg_cache_id */ |
| 37 | struct list_lru_one *lru[0]; | 37 | struct list_lru_one *lru[]; |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | struct list_lru_node { | 40 | struct list_lru_node { |
| @@ -106,7 +106,7 @@ struct lruvec_stat { · 105 unmodified lines | |||
| 106 | */ | 106 | */ |
| 107 | struct memcg_shrinker_map { | 107 | struct memcg_shrinker_map { |
| 108 | struct rcu_head rcu; | 108 | struct rcu_head rcu; |
| 109 | unsigned long map[0]; | 109 | unsigned long map[]; |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | /* | 112 | /* |
| @@ -148,7 +148,7 @@ struct mem_cgroup_threshold_ary { · 35 unmodified lines | |||
| 148 | /* Size of entries[] */ | 148 | /* Size of entries[] */ |
| 149 | unsigned int size; | 149 | unsigned int size; |
| 150 | /* Array of thresholds */ | 150 | /* Array of thresholds */ |
| 151 | struct mem_cgroup_threshold entries[0]; | 151 | struct mem_cgroup_threshold entries[]; |
| 152 | }; | 152 | }; |
| 153 | 153 | ||
| 154 | struct mem_cgroup_thresholds { | 154 | struct mem_cgroup_thresholds { |
| @@ -83,7 +83,7 @@ struct wilco_ec_response { · 82 unmodified lines | |||
| 83 | u16 result; | 83 | u16 result; |
| 84 | u16 data_size; | 84 | u16 data_size; |
| 85 | u8 reserved[2]; | 85 | u8 reserved[2]; |
| 86 | u8 data[0]; | 86 | u8 data[]; |
| 87 | } __packed; | 87 | } __packed; |
| 88 | 88 | ||
| 89 | /** | 89 | /** |
| @@ -220,10 +220,8 @@ struct pnp_card { · 219 unmodified lines | |||
| 220 | #define global_to_pnp_card(n) list_entry(n, struct pnp_card, global_list) | 220 | #define global_to_pnp_card(n) list_entry(n, struct pnp_card, global_list) |
| 221 | #define protocol_to_pnp_card(n) list_entry(n, struct pnp_card, protocol_list) | 221 | #define protocol_to_pnp_card(n) list_entry(n, struct pnp_card, protocol_list) |
| 222 | #define to_pnp_card(n) container_of(n, struct pnp_card, dev) | 222 | #define to_pnp_card(n) container_of(n, struct pnp_card, dev) |
| 223 | #define pnp_for_each_card(card) \ | 223 | #define pnp_for_each_card(card) \ |
| 224 | for((card) = global_to_pnp_card(pnp_cards.next); \ | 224 | list_for_each_entry(card, &pnp_cards, global_list) |
| 225 | (card) != global_to_pnp_card(&pnp_cards); \ | ||
| 226 | (card) = global_to_pnp_card((card)->global_list.next)) | ||
| 227 | 225 | ||
| 228 | struct pnp_card_link { | 226 | struct pnp_card_link { |
| 229 | struct pnp_card *card; | 227 | struct pnp_card *card; |
| @@ -276,14 +274,9 @@ struct pnp_dev { · 46 unmodified lines | |||
| 276 | #define card_to_pnp_dev(n) list_entry(n, struct pnp_dev, card_list) | 274 | #define card_to_pnp_dev(n) list_entry(n, struct pnp_dev, card_list) |
| 277 | #define protocol_to_pnp_dev(n) list_entry(n, struct pnp_dev, protocol_list) | 275 | #define protocol_to_pnp_dev(n) list_entry(n, struct pnp_dev, protocol_list) |
| 278 | #define to_pnp_dev(n) container_of(n, struct pnp_dev, dev) | 276 | #define to_pnp_dev(n) container_of(n, struct pnp_dev, dev) |
| 279 | #define pnp_for_each_dev(dev) \ | 277 | #define pnp_for_each_dev(dev) list_for_each_entry(dev, &pnp_global, global_list) |
| 280 | for((dev) = global_to_pnp_dev(pnp_global.next); \ | 278 | #define card_for_each_dev(card, dev) \ |
| 281 | (dev) != global_to_pnp_dev(&pnp_global); \ | 279 | list_for_each_entry(dev, &(card)->devices, card_list) |
| 282 | (dev) = global_to_pnp_dev((dev)->global_list.next)) | ||
| 283 | #define card_for_each_dev(card,dev) \ | ||
| 284 | for((dev) = card_to_pnp_dev((card)->devices.next); \ | ||
| 285 | (dev) != card_to_pnp_dev(&(card)->devices); \ | ||
| 286 | (dev) = card_to_pnp_dev((dev)->card_list.next)) | ||
| 287 | #define pnp_dev_name(dev) (dev)->name | 280 | #define pnp_dev_name(dev) (dev)->name |
| 288 | 281 | ||
| 289 | static inline void *pnp_get_drvdata(struct pnp_dev *pdev) | 282 | static inline void *pnp_get_drvdata(struct pnp_dev *pdev) |
| @@ -437,14 +430,10 @@ struct pnp_protocol { · 147 unmodified lines | |||
| 437 | }; | 430 | }; |
| 438 | 431 | ||
| 439 | #define to_pnp_protocol(n) list_entry(n, struct pnp_protocol, protocol_list) | 432 | #define to_pnp_protocol(n) list_entry(n, struct pnp_protocol, protocol_list) |
| 440 | #define protocol_for_each_card(protocol,card) \ | 433 | #define protocol_for_each_card(protocol, card) \ |
| 441 | for((card) = protocol_to_pnp_card((protocol)->cards.next); \ | 434 | list_for_each_entry(card, &(protocol)->cards, protocol_list) |
| 442 | (card) != protocol_to_pnp_card(&(protocol)->cards); \ | 435 | #define protocol_for_each_dev(protocol, dev) \ |
| 443 | (card) = protocol_to_pnp_card((card)->protocol_list.next)) | 436 | list_for_each_entry(dev, &(protocol)->devices, protocol_list) |
| 444 | #define protocol_for_each_dev(protocol,dev) \ | ||
| 445 | for((dev) = protocol_to_pnp_dev((protocol)->devices.next); \ | ||
| 446 | (dev) != protocol_to_pnp_dev(&(protocol)->devices); \ | ||
| 447 | (dev) = protocol_to_pnp_dev((dev)->protocol_list.next)) | ||
| 448 | 437 | ||
| 449 | extern struct bus_type pnp_bus_type; | 438 | extern struct bus_type pnp_bus_type; |
| 450 | 439 | ||
| @@ -28,7 +28,7 @@ struct posix_acl { · 27 unmodified lines | |||
| 28 | refcount_t a_refcount; | 28 | refcount_t a_refcount; |
| 29 | struct rcu_head a_rcu; | 29 | struct rcu_head a_rcu; |
| 30 | unsigned int a_count; | 30 | unsigned int a_count; |
| 31 | struct posix_acl_entry a_entries[0]; | 31 | struct posix_acl_entry a_entries[]; |
| 32 | }; | 32 | }; |
| 33 | 33 | ||
| 34 | #define FOREACH_ACL_ENTRY(pa, acl, pe) \ | 34 | #define FOREACH_ACL_ENTRY(pa, acl, pe) \ |
| @@ -100,7 +100,7 @@ struct rio_switch { · 99 unmodified lines | |||
| 100 | u32 port_ok; | 100 | u32 port_ok; |
| 101 | struct rio_switch_ops *ops; | 101 | struct rio_switch_ops *ops; |
| 102 | spinlock_t lock; | 102 | spinlock_t lock; |
| 103 | struct rio_dev *nextdev[0]; | 103 | struct rio_dev *nextdev[]; |
| 104 | }; | 104 | }; |
| 105 | 105 | ||
| 106 | /** | 106 | /** |
| @@ -201,7 +201,7 @@ struct rio_dev { · 94 unmodified lines | |||
| 201 | u8 hopcount; | 201 | u8 hopcount; |
| 202 | struct rio_dev *prev; | 202 | struct rio_dev *prev; |
| 203 | atomic_t state; | 203 | atomic_t state; |
| 204 | struct rio_switch rswitch[0]; /* RIO switch info */ | 204 | struct rio_switch rswitch[]; /* RIO switch info */ |
| 205 | }; | 205 | }; |
| 206 | 206 | ||
| 207 | #define rio_dev_g(n) list_entry(n, struct rio_dev, global_list) | 207 | #define rio_dev_g(n) list_entry(n, struct rio_dev, global_list) |
| @@ -54,7 +54,7 @@ struct rs_codec { · 53 unmodified lines | |||
| 54 | */ | 54 | */ |
| 55 | struct rs_control { | 55 | struct rs_control { |
| 56 | struct rs_codec *codec; | 56 | struct rs_codec *codec; |
| 57 | uint16_t buffers[0]; | 57 | uint16_t buffers[]; |
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| 60 | /* General purpose RS codec, 8-bit data width, symbol width 1-15 bit */ | 60 | /* General purpose RS codec, 8-bit data width, symbol width 1-15 bit */ |
| @@ -142,7 +142,7 @@ struct sched_domain { · 141 unmodified lines | |||
| 142 | * by attaching extra space to the end of the structure, | 142 | * by attaching extra space to the end of the structure, |
| 143 | * depending on how many CPUs the kernel has booted up with) | 143 | * depending on how many CPUs the kernel has booted up with) |
| 144 | */ | 144 | */ |
| 145 | unsigned long span[0]; | 145 | unsigned long span[]; |
| 146 | }; | 146 | }; |
| 147 | 147 | ||
| 148 | static inline struct cpumask *sched_domain_span(struct sched_domain *sd) | 148 | static inline struct cpumask *sched_domain_span(struct sched_domain *sd) |
| @@ -4162,7 +4162,7 @@ struct skb_ext { · 4161 unmodified lines | |||
| 4162 | refcount_t refcnt; | 4162 | refcount_t refcnt; |
| 4163 | u8 offset[SKB_EXT_NUM]; /* in chunks of 8 bytes */ | 4163 | u8 offset[SKB_EXT_NUM]; /* in chunks of 8 bytes */ |
| 4164 | u8 chunks; /* same */ | 4164 | u8 chunks; /* same */ |
| 4165 | char data[0] __aligned(8); | 4165 | char data[] __aligned(8); |
| 4166 | }; | 4166 | }; |
| 4167 | 4167 | ||
| 4168 | struct skb_ext *__skb_ext_alloc(void); | 4168 | struct skb_ext *__skb_ext_alloc(void); |
| @@ -177,6 +177,8 @@ struct plat_stmmacenet_data { · 176 unmodified lines | |||
| 177 | struct stmmac_rxq_cfg rx_queues_cfg[MTL_MAX_RX_QUEUES]; | 177 | struct stmmac_rxq_cfg rx_queues_cfg[MTL_MAX_RX_QUEUES]; |
| 178 | struct stmmac_txq_cfg tx_queues_cfg[MTL_MAX_TX_QUEUES]; | 178 | struct stmmac_txq_cfg tx_queues_cfg[MTL_MAX_TX_QUEUES]; |
| 179 | void (*fix_mac_speed)(void *priv, unsigned int speed); | 179 | void (*fix_mac_speed)(void *priv, unsigned int speed); |
| 180 | int (*serdes_powerup)(struct net_device *ndev, void *priv); | ||
| 181 | void (*serdes_powerdown)(struct net_device *ndev, void *priv); | ||
| 180 | int (*init)(struct platform_device *pdev, void *priv); | 182 | int (*init)(struct platform_device *pdev, void *priv); |
| 181 | void (*exit)(struct platform_device *pdev, void *priv); | 183 | void (*exit)(struct platform_device *pdev, void *priv); |
| 182 | struct mac_device_info *(*setup)(void *priv); | 184 | struct mac_device_info *(*setup)(void *priv); |
| @@ -170,6 +170,7 @@ extern bool svc_rdma_post_recvs(struct svcxprt_rdma *rdma); · 169 unmodified lines | |||
| 170 | extern void svc_rdma_recv_ctxt_put(struct svcxprt_rdma *rdma, | 170 | extern void svc_rdma_recv_ctxt_put(struct svcxprt_rdma *rdma, |
| 171 | struct svc_rdma_recv_ctxt *ctxt); | 171 | struct svc_rdma_recv_ctxt *ctxt); |
| 172 | extern void svc_rdma_flush_recv_queues(struct svcxprt_rdma *rdma); | 172 | extern void svc_rdma_flush_recv_queues(struct svcxprt_rdma *rdma); |
| 173 | extern void svc_rdma_release_rqst(struct svc_rqst *rqstp); | ||
| 173 | extern int svc_rdma_recvfrom(struct svc_rqst *); | 174 | extern int svc_rdma_recvfrom(struct svc_rqst *); |
| 174 | 175 | ||
| 175 | /* svc_rdma_rw.c */ | 176 | /* svc_rdma_rw.c */ |
| @@ -275,7 +275,7 @@ struct swap_info_struct { · 274 unmodified lines | |||
| 275 | */ | 275 | */ |
| 276 | struct work_struct discard_work; /* discard worker */ | 276 | struct work_struct discard_work; /* discard worker */ |
| 277 | struct swap_cluster_list discard_clusters; /* discard clusters list */ | 277 | struct swap_cluster_list discard_clusters; /* discard clusters list */ |
| 278 | struct plist_node avail_lists[0]; /* | 278 | struct plist_node avail_lists[]; /* |
| 279 | * entries in swap_avail_heads, one | 279 | * entries in swap_avail_heads, one |
| 280 | * entry per node. | 280 | * entry per node. |
| 281 | * Must be last as the number of the | 281 | * Must be last as the number of the |
| @@ -295,7 +295,7 @@ struct bts_header { · 294 unmodified lines | |||
| 295 | u32 magic; | 295 | u32 magic; |
| 296 | u32 version; | 296 | u32 version; |
| 297 | u8 future[24]; | 297 | u8 future[24]; |
| 298 | u8 actions[0]; | 298 | u8 actions[]; |
| 299 | } __attribute__ ((packed)); | 299 | } __attribute__ ((packed)); |
| 300 | 300 | ||
| 301 | /** | 301 | /** |
| @@ -305,7 +305,7 @@ struct bts_header { · 3 unmodified lines | |||
| 305 | struct bts_action { | 305 | struct bts_action { |
| 306 | u16 type; | 306 | u16 type; |
| 307 | u16 size; | 307 | u16 size; |
| 308 | u8 data[0]; | 308 | u8 data[]; |
| 309 | } __attribute__ ((packed)); | 309 | } __attribute__ ((packed)); |
| 310 | 310 | ||
| 311 | struct bts_action_send { | 311 | struct bts_action_send { |
| @@ -315,7 +315,7 @@ struct bts_action_send { · 3 unmodified lines | |||
| 315 | struct bts_action_wait { | 315 | struct bts_action_wait { |
| 316 | u32 msec; | 316 | u32 msec; |
| 317 | u32 size; | 317 | u32 size; |
| 318 | u8 data[0]; | 318 | u8 data[]; |
| 319 | } __attribute__ ((packed)); | 319 | } __attribute__ ((packed)); |
| 320 | 320 | ||
| 321 | struct bts_action_delay { | 321 | struct bts_action_delay { |
| @@ -28,7 +28,7 @@ struct tcpa_event { · 27 unmodified lines | |||
| 28 | u32 event_type; | 28 | u32 event_type; |
| 29 | u8 pcr_value[20]; /* SHA1 */ | 29 | u8 pcr_value[20]; /* SHA1 */ |
| 30 | u32 event_size; | 30 | u32 event_size; |
| 31 | u8 event_data[0]; | 31 | u8 event_data[]; |
| 32 | }; | 32 | }; |
| 33 | 33 | ||
| 34 | enum tcpa_event_types { | 34 | enum tcpa_event_types { |
| @@ -55,7 +55,7 @@ enum tcpa_event_types { · 20 unmodified lines | |||
| 55 | struct tcpa_pc_event { | 55 | struct tcpa_pc_event { |
| 56 | u32 event_id; | 56 | u32 event_id; |
| 57 | u32 event_size; | 57 | u32 event_size; |
| 58 | u8 event_data[0]; | 58 | u8 event_data[]; |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | enum tcpa_pc_event_ids { | 61 | enum tcpa_pc_event_ids { |
| @@ -102,7 +102,7 @@ struct tcg_pcr_event { · 40 unmodified lines | |||
| 102 | 102 | ||
| 103 | struct tcg_event_field { | 103 | struct tcg_event_field { |
| 104 | u32 event_size; | 104 | u32 event_size; |
| 105 | u8 event[0]; | 105 | u8 event[]; |
| 106 | } __packed; | 106 | } __packed; |
| 107 | 107 | ||
| 108 | struct tcg_pcr_event2_head { | 108 | struct tcg_pcr_event2_head { |
| @@ -156,8 +156,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) · 155 unmodified lines | |||
| 156 | * Note, the proto and args passed in includes "__data" as the first parameter. | 156 | * Note, the proto and args passed in includes "__data" as the first parameter. |
| 157 | * The reason for this is to handle the "void" prototype. If a tracepoint | 157 | * The reason for this is to handle the "void" prototype. If a tracepoint |
| 158 | * has a "void" prototype, then it is invalid to declare a function | 158 | * has a "void" prototype, then it is invalid to declare a function |
| 159 | * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just | 159 | * as "(void *, void)". |
| 160 | * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". | ||
| 161 | */ | 160 | */ |
| 162 | #define __DO_TRACE(tp, proto, args, cond, rcuidle) \ | 161 | #define __DO_TRACE(tp, proto, args, cond, rcuidle) \ |
| 163 | do { \ | 162 | do { \ |
| @@ -373,25 +372,6 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) · 209 unmodified lines | |||
| 373 | # define __tracepoint_string | 372 | # define __tracepoint_string |
| 374 | #endif | 373 | #endif |
| 375 | 374 | ||
| 376 | /* | ||
| 377 | * The need for the DECLARE_TRACE_NOARGS() is to handle the prototype | ||
| 378 | * (void). "void" is a special value in a function prototype and can | ||
| 379 | * not be combined with other arguments. Since the DECLARE_TRACE() | ||
| 380 | * macro adds a data element at the beginning of the prototype, | ||
| 381 | * we need a way to differentiate "(void *data, proto)" from | ||
| 382 | * "(void *data, void)". The second prototype is invalid. | ||
| 383 | * | ||
| 384 | * DECLARE_TRACE_NOARGS() passes "void" as the tracepoint prototype | ||
| 385 | * and "void *__data" as the callback prototype. | ||
| 386 | * | ||
| 387 | * DECLARE_TRACE() passes "proto" as the tracepoint protoype and | ||
| 388 | * "void *__data, proto" as the callback prototype. | ||
| 389 | */ | ||
| 390 | #define DECLARE_TRACE_NOARGS(name) \ | ||
| 391 | __DECLARE_TRACE(name, void, , \ | ||
| 392 | cpu_online(raw_smp_processor_id()), \ | ||
| 393 | void *__data, __data) | ||
| 394 | |||
| 395 | #define DECLARE_TRACE(name, proto, args) \ | 375 | #define DECLARE_TRACE(name, proto, args) \ |
| 396 | __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \ | 376 | __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \ |
| 397 | cpu_online(raw_smp_processor_id()), \ | 377 | cpu_online(raw_smp_processor_id()), \ |
| @@ -164,7 +164,7 @@ struct vdpa_config_ops { · 163 unmodified lines | |||
| 164 | u64 (*get_vq_state)(struct vdpa_device *vdev, u16 idx); | 164 | u64 (*get_vq_state)(struct vdpa_device *vdev, u16 idx); |
| 165 | 165 | ||
| 166 | /* Device ops */ | 166 | /* Device ops */ |
| 167 | u16 (*get_vq_align)(struct vdpa_device *vdev); | 167 | u32 (*get_vq_align)(struct vdpa_device *vdev); |
| 168 | u64 (*get_features)(struct vdpa_device *vdev); | 168 | u64 (*get_features)(struct vdpa_device *vdev); |
| 169 | int (*set_features)(struct vdpa_device *vdev, u64 features); | 169 | int (*set_features)(struct vdpa_device *vdev, u64 features); |
| 170 | void (*set_config_cb)(struct vdpa_device *vdev, | 170 | void (*set_config_cb)(struct vdpa_device *vdev, |
| @@ -1,5 +1,9 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #ifndef _LINUX_VERMAGIC_H | ||
| 3 | #define _LINUX_VERMAGIC_H | ||
| 4 | |||
| 2 | #include <generated/utsrelease.h> | 5 | #include <generated/utsrelease.h> |
| 6 | #include <asm/vermagic.h> | ||
| 3 | 7 | ||
| 4 | /* Simply sanity version stamp for modules. */ | 8 | /* Simply sanity version stamp for modules. */ |
| 5 | #ifdef CONFIG_SMP | 9 | #ifdef CONFIG_SMP |
| @@ -24,9 +28,6 @@ · 18 unmodified lines | |||
| 24 | #else | 28 | #else |
| 25 | #define MODULE_VERMAGIC_MODVERSIONS "" | 29 | #define MODULE_VERMAGIC_MODVERSIONS "" |
| 26 | #endif | 30 | #endif |
| 27 | #ifndef MODULE_ARCH_VERMAGIC | ||
| 28 | #define MODULE_ARCH_VERMAGIC "" | ||
| 29 | #endif | ||
| 30 | #ifdef RANDSTRUCT_PLUGIN | 31 | #ifdef RANDSTRUCT_PLUGIN |
| 31 | #include <generated/randomize_layout_hash.h> | 32 | #include <generated/randomize_layout_hash.h> |
| 32 | #define MODULE_RANDSTRUCT_PLUGIN "RANDSTRUCT_PLUGIN_" RANDSTRUCT_HASHED_SEED | 33 | #define MODULE_RANDSTRUCT_PLUGIN "RANDSTRUCT_PLUGIN_" RANDSTRUCT_HASHED_SEED |
| @@ -41,3 +42,4 @@ · 8 unmodified lines | |||
| 41 | MODULE_ARCH_VERMAGIC \ | 42 | MODULE_ARCH_VERMAGIC \ |
| 42 | MODULE_RANDSTRUCT_PLUGIN | 43 | MODULE_RANDSTRUCT_PLUGIN |
| 43 | 44 | ||
| 45 | #endif /* _LINUX_VERMAGIC_H */ | ||
| @@ -9,7 +9,6 @@ · 8 unmodified lines | |||
| 9 | #include <linux/device.h> | 9 | #include <linux/device.h> |
| 10 | #include <linux/mod_devicetable.h> | 10 | #include <linux/mod_devicetable.h> |
| 11 | #include <linux/gfp.h> | 11 | #include <linux/gfp.h> |
| 12 | #include <linux/vringh.h> | ||
| 13 | 12 | ||
| 14 | /** | 13 | /** |
| 15 | * virtqueue - a queue to register buffers for sending or receiving. | 14 | * virtqueue - a queue to register buffers for sending or receiving. |
| @@ -137,7 +137,7 @@ extern void vunmap(const void *addr); · 136 unmodified lines | |||
| 137 | 137 | ||
| 138 | extern int remap_vmalloc_range_partial(struct vm_area_struct *vma, | 138 | extern int remap_vmalloc_range_partial(struct vm_area_struct *vma, |
| 139 | unsigned long uaddr, void *kaddr, | 139 | unsigned long uaddr, void *kaddr, |
| 140 | unsigned long size); | 140 | unsigned long pgoff, unsigned long size); |
| 141 | 141 | ||
| 142 | extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, | 142 | extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, |
| 143 | unsigned long pgoff); | 143 | unsigned long pgoff); |
| @@ -14,8 +14,10 @@ · 13 unmodified lines | |||
| 14 | #include <linux/virtio_byteorder.h> | 14 | #include <linux/virtio_byteorder.h> |
| 15 | #include <linux/uio.h> | 15 | #include <linux/uio.h> |
| 16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
| 17 | #if IS_REACHABLE(CONFIG_VHOST_IOTLB) | ||
| 17 | #include <linux/dma-direction.h> | 18 | #include <linux/dma-direction.h> |
| 18 | #include <linux/vhost_iotlb.h> | 19 | #include <linux/vhost_iotlb.h> |
| 20 | #endif | ||
| 19 | #include <asm/barrier.h> | 21 | #include <asm/barrier.h> |
| 20 | 22 | ||
| 21 | /* virtio_ring with information needed for host access. */ | 23 | /* virtio_ring with information needed for host access. */ |
| @@ -254,6 +256,8 @@ static inline __virtio64 cpu_to_vringh64(const struct vringh *vrh, u64 val) · 232 unmodified lines | |||
| 254 | return __cpu_to_virtio64(vringh_is_little_endian(vrh), val); | 256 | return __cpu_to_virtio64(vringh_is_little_endian(vrh), val); |
| 255 | } | 257 | } |
| 256 | 258 | ||
| 259 | #if IS_REACHABLE(CONFIG_VHOST_IOTLB) | ||
| 260 | |||
| 257 | void vringh_set_iotlb(struct vringh *vrh, struct vhost_iotlb *iotlb); | 261 | void vringh_set_iotlb(struct vringh *vrh, struct vhost_iotlb *iotlb); |
| 258 | 262 | ||
| 259 | int vringh_init_iotlb(struct vringh *vrh, u64 features, | 263 | int vringh_init_iotlb(struct vringh *vrh, u64 features, |
| @@ -284,4 +288,6 @@ void vringh_notify_disable_iotlb(struct vringh *vrh); · 24 unmodified lines | |||
| 284 | 288 | ||
| 285 | int vringh_need_notify_iotlb(struct vringh *vrh); | 289 | int vringh_need_notify_iotlb(struct vringh *vrh); |
| 286 | 290 | ||
| 291 | #endif /* CONFIG_VHOST_IOTLB */ | ||
| 292 | |||
| 287 | #endif /* _LINUX_VRINGH_H */ | 293 | #endif /* _LINUX_VRINGH_H */ |
| @@ -73,7 +73,7 @@ struct simple_xattr { · 72 unmodified lines | |||
| 73 | struct list_head list; | 73 | struct list_head list; |
| 74 | char *name; | 74 | char *name; |
| 75 | size_t size; | 75 | size_t size; |
| 76 | char value[0]; | 76 | char value[]; |
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| 79 | /* | 79 | /* |
| @@ -905,6 +905,8 @@ struct survey_info { · 904 unmodified lines | |||
| 905 | * protocol frames. | 905 | * protocol frames. |
| 906 | * @control_port_over_nl80211: TRUE if userspace expects to exchange control | 906 | * @control_port_over_nl80211: TRUE if userspace expects to exchange control |
| 907 | * port frames over NL80211 instead of the network interface. | 907 | * port frames over NL80211 instead of the network interface. |
| 908 | * @control_port_no_preauth: disables pre-auth rx over the nl80211 control | ||
| 909 | * port for mac80211 | ||
| 908 | * @wep_keys: static WEP keys, if not NULL points to an array of | 910 | * @wep_keys: static WEP keys, if not NULL points to an array of |
| 909 | * CFG80211_MAX_WEP_KEYS WEP keys | 911 | * CFG80211_MAX_WEP_KEYS WEP keys |
| 910 | * @wep_tx_key: key index (0..3) of the default TX static WEP key | 912 | * @wep_tx_key: key index (0..3) of the default TX static WEP key |
| @@ -1222,6 +1224,7 @@ struct sta_txpwr { · 311 unmodified lines | |||
| 1222 | * @he_capa: HE capabilities of station | 1224 | * @he_capa: HE capabilities of station |
| 1223 | * @he_capa_len: the length of the HE capabilities | 1225 | * @he_capa_len: the length of the HE capabilities |
| 1224 | * @airtime_weight: airtime scheduler weight for this station | 1226 | * @airtime_weight: airtime scheduler weight for this station |
| 1227 | * @txpwr: transmit power for an associated station | ||
| 1225 | */ | 1228 | */ |
| 1226 | struct station_parameters { | 1229 | struct station_parameters { |
| 1227 | const u8 *supported_rates; | 1230 | const u8 *supported_rates; |
| @@ -4666,6 +4669,9 @@ struct wiphy_iftype_akm_suites { · 3438 unmodified lines | |||
| 4666 | * @txq_memory_limit: configuration internal TX queue memory limit | 4669 | * @txq_memory_limit: configuration internal TX queue memory limit |
| 4667 | * @txq_quantum: configuration of internal TX queue scheduler quantum | 4670 | * @txq_quantum: configuration of internal TX queue scheduler quantum |
| 4668 | * | 4671 | * |
| 4672 | * @tx_queue_len: allow setting transmit queue len for drivers not using | ||
| 4673 | * wake_tx_queue | ||
| 4674 | * | ||
| 4669 | * @support_mbssid: can HW support association with nontransmitted AP | 4675 | * @support_mbssid: can HW support association with nontransmitted AP |
| 4670 | * @support_only_he_mbssid: don't parse MBSSID elements if it is not | 4676 | * @support_only_he_mbssid: don't parse MBSSID elements if it is not |
| 4671 | * HE AP, in order to avoid compatibility issues. | 4677 | * HE AP, in order to avoid compatibility issues. |
| @@ -4681,6 +4687,10 @@ struct wiphy_iftype_akm_suites { · 9 unmodified lines | |||
| 4681 | * supported by the driver for each peer | 4687 | * supported by the driver for each peer |
| 4682 | * @tid_config_support.max_retry: maximum supported retry count for | 4688 | * @tid_config_support.max_retry: maximum supported retry count for |
| 4683 | * long/short retry configuration | 4689 | * long/short retry configuration |
| 4690 | * | ||
| 4691 | * @max_data_retry_count: maximum supported per TID retry count for | ||
| 4692 | * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and | ||
| 4693 | * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes | ||
| 4684 | */ | 4694 | */ |
| 4685 | struct wiphy { | 4695 | struct wiphy { |
| 4686 | /* assign these fields before you register the wiphy */ | 4696 | /* assign these fields before you register the wiphy */ |
| @@ -254,6 +254,7 @@ static inline bool ipv6_anycast_destination(const struct dst_entry *dst, · 253 unmodified lines | |||
| 254 | 254 | ||
| 255 | return rt->rt6i_flags & RTF_ANYCAST || | 255 | return rt->rt6i_flags & RTF_ANYCAST || |
| 256 | (rt->rt6i_dst.plen < 127 && | 256 | (rt->rt6i_dst.plen < 127 && |
| 257 | !(rt->rt6i_flags & (RTF_GATEWAY | RTF_NONEXTHOP)) && | ||
| 257 | ipv6_addr_equal(&rt->rt6i_dst.addr, daddr)); | 258 | ipv6_addr_equal(&rt->rt6i_dst.addr, daddr)); |
| 258 | } | 259 | } |
| 259 | 260 | ||
| @@ -6007,7 +6007,9 @@ enum rate_control_capabilities { · 6006 unmodified lines | |||
| 6007 | struct rate_control_ops { | 6007 | struct rate_control_ops { |
| 6008 | unsigned long capa; | 6008 | unsigned long capa; |
| 6009 | const char *name; | 6009 | const char *name; |
| 6010 | void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); | 6010 | void *(*alloc)(struct ieee80211_hw *hw); |
| 6011 | void (*add_debugfs)(struct ieee80211_hw *hw, void *priv, | ||
| 6012 | struct dentry *debugfsdir); | ||
| 6011 | void (*free)(void *priv); | 6013 | void (*free)(void *priv); |
| 6012 | 6014 | ||
| 6013 | void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); | 6015 | void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); |
| @@ -41,7 +41,7 @@ enum { · 40 unmodified lines | |||
| 41 | ND_OPT_DNSSL = 31, /* RFC6106 */ | 41 | ND_OPT_DNSSL = 31, /* RFC6106 */ |
| 42 | ND_OPT_6CO = 34, /* RFC6775 */ | 42 | ND_OPT_6CO = 34, /* RFC6775 */ |
| 43 | ND_OPT_CAPTIVE_PORTAL = 37, /* RFC7710 */ | 43 | ND_OPT_CAPTIVE_PORTAL = 37, /* RFC7710 */ |
| 44 | ND_OPT_PREF64 = 38, /* RFC-ietf-6man-ra-pref64-09 */ | 44 | ND_OPT_PREF64 = 38, /* RFC8781 */ |
| 45 | __ND_OPT_MAX | 45 | __ND_OPT_MAX |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| @@ -901,7 +901,7 @@ static inline void nft_set_elem_update_expr(const struct nft_set_ext *ext, · 900 unmodified lines | |||
| 901 | { | 901 | { |
| 902 | struct nft_expr *expr; | 902 | struct nft_expr *expr; |
| 903 | 903 | ||
| 904 | if (nft_set_ext_exists(ext, NFT_SET_EXT_EXPR)) { | 904 | if (__nft_set_ext_exists(ext, NFT_SET_EXT_EXPR)) { |
| 905 | expr = nft_set_ext_expr(ext); | 905 | expr = nft_set_ext_expr(ext); |
| 906 | expr->ops->eval(expr, regs, pkt); | 906 | expr->ops->eval(expr, regs, pkt); |
| 907 | } | 907 | } |
| @@ -2553,9 +2553,9 @@ sk_is_refcounted(struct sock *sk) · 2552 unmodified lines | |||
| 2553 | } | 2553 | } |
| 2554 | 2554 | ||
| 2555 | /** | 2555 | /** |
| 2556 | * skb_steal_sock | 2556 | * skb_steal_sock - steal a socket from an sk_buff |
| 2557 | * @skb to steal the socket from | 2557 | * @skb: sk_buff to steal the socket from |
| 2558 | * @refcounted is set to true if the socket is reference-counted | 2558 | * @refcounted: is set to true if the socket is reference-counted |
| 2559 | */ | 2559 | */ |
| 2560 | static inline struct sock * | 2560 | static inline struct sock * |
| 2561 | skb_steal_sock(struct sk_buff *skb, bool *refcounted) | 2561 | skb_steal_sock(struct sk_buff *skb, bool *refcounted) |
| @@ -51,7 +51,7 @@ extern struct inet_hashinfo tcp_hashinfo; · 50 unmodified lines | |||
| 51 | extern struct percpu_counter tcp_orphan_count; | 51 | extern struct percpu_counter tcp_orphan_count; |
| 52 | void tcp_time_wait(struct sock *sk, int state, int timeo); | 52 | void tcp_time_wait(struct sock *sk, int state, int timeo); |
| 53 | 53 | ||
| 54 | #define MAX_TCP_HEADER (128 + MAX_HEADER) | 54 | #define MAX_TCP_HEADER L1_CACHE_ALIGN(128 + MAX_HEADER) |
| 55 | #define MAX_TCP_OPTION_SPACE 40 | 55 | #define MAX_TCP_OPTION_SPACE 40 |
| 56 | #define TCP_MIN_SND_MSS 48 | 56 | #define TCP_MIN_SND_MSS 48 |
| 57 | #define TCP_MIN_GSO_SIZE (TCP_MIN_SND_MSS - MAX_TCP_OPTION_SPACE) | 57 | #define TCP_MIN_GSO_SIZE (TCP_MIN_SND_MSS - MAX_TCP_OPTION_SPACE) |
| @@ -476,6 +476,8 @@ struct ocelot_port { · 475 unmodified lines | |||
| 476 | 476 | ||
| 477 | void __iomem *regs; | 477 | void __iomem *regs; |
| 478 | 478 | ||
| 479 | bool vlan_aware; | ||
| 480 | |||
| 479 | /* Ingress default VLAN (pvid) */ | 481 | /* Ingress default VLAN (pvid) */ |
| 480 | u16 pvid; | 482 | u16 pvid; |
| 481 | 483 | ||
| @@ -610,7 +612,7 @@ int ocelot_port_bridge_leave(struct ocelot *ocelot, int port, · 128 unmodified lines | |||
| 610 | int ocelot_fdb_dump(struct ocelot *ocelot, int port, | 612 | int ocelot_fdb_dump(struct ocelot *ocelot, int port, |
| 611 | dsa_fdb_dump_cb_t *cb, void *data); | 613 | dsa_fdb_dump_cb_t *cb, void *data); |
| 612 | int ocelot_fdb_add(struct ocelot *ocelot, int port, | 614 | int ocelot_fdb_add(struct ocelot *ocelot, int port, |
| 613 | const unsigned char *addr, u16 vid, bool vlan_aware); | 615 | const unsigned char *addr, u16 vid); |
| 614 | int ocelot_fdb_del(struct ocelot *ocelot, int port, | 616 | int ocelot_fdb_del(struct ocelot *ocelot, int port, |
| 615 | const unsigned char *addr, u16 vid); | 617 | const unsigned char *addr, u16 vid); |
| 616 | int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid, | 618 | int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid, |
| @@ -168,7 +168,6 @@ int tegra_io_pad_power_disable(enum tegra_io_pad id); · 167 unmodified lines | |||
| 168 | int tegra_io_rail_power_on(unsigned int id); | 168 | int tegra_io_rail_power_on(unsigned int id); |
| 169 | int tegra_io_rail_power_off(unsigned int id); | 169 | int tegra_io_rail_power_off(unsigned int id); |
| 170 | 170 | ||
| 171 | enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void); | ||
| 172 | void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode); | 171 | void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode); |
| 173 | void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode); | 172 | void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode); |
| 174 | 173 | ||
| @@ -220,11 +219,6 @@ static inline int tegra_io_rail_power_off(unsigned int id) · 45 unmodified lines | |||
| 220 | return -ENOSYS; | 219 | return -ENOSYS; |
| 221 | } | 220 | } |
| 222 | 221 | ||
| 223 | static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void) | ||
| 224 | { | ||
| 225 | return TEGRA_SUSPEND_NONE; | ||
| 226 | } | ||
| 227 | |||
| 228 | static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode) | 222 | static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode) |
| 229 | { | 223 | { |
| 230 | } | 224 | } |
| @@ -235,4 +229,13 @@ static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode) · 4 unmodified lines | |||
| 235 | 229 | ||
| 236 | #endif /* CONFIG_SOC_TEGRA_PMC */ | 230 | #endif /* CONFIG_SOC_TEGRA_PMC */ |
| 237 | 231 | ||
| 232 | #if defined(CONFIG_SOC_TEGRA_PMC) && defined(CONFIG_PM_SLEEP) | ||
| 233 | enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void); | ||
| 234 | #else | ||
| 235 | static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void) | ||
| 236 | { | ||
| 237 | return TEGRA_SUSPEND_NONE; | ||
| 238 | } | ||
| 239 | #endif | ||
| 240 | |||
| 238 | #endif /* __SOC_TEGRA_PMC_H__ */ | 241 | #endif /* __SOC_TEGRA_PMC_H__ */ |
| @@ -494,6 +494,11 @@ void snd_hda_update_power_acct(struct hda_codec *codec); · 493 unmodified lines | |||
| 494 | static inline void snd_hda_set_power_save(struct hda_bus *bus, int delay) {} | 494 | static inline void snd_hda_set_power_save(struct hda_bus *bus, int delay) {} |
| 495 | #endif | 495 | #endif |
| 496 | 496 | ||
| 497 | static inline bool hda_codec_need_resume(struct hda_codec *codec) | ||
| 498 | { | ||
| 499 | return !codec->relaxed_resume && codec->jacktbl.used; | ||
| 500 | } | ||
| 501 | |||
| 497 | #ifdef CONFIG_SND_HDA_PATCH_LOADER | 502 | #ifdef CONFIG_SND_HDA_PATCH_LOADER |
| 498 | /* | 503 | /* |
| 499 | * patch firmware | 504 | * patch firmware |
| @@ -351,7 +351,6 @@ struct snd_soc_dai { · 350 unmodified lines | |||
| 351 | 351 | ||
| 352 | /* bit field */ | 352 | /* bit field */ |
| 353 | unsigned int probed:1; | 353 | unsigned int probed:1; |
| 354 | unsigned int started[SNDRV_PCM_STREAM_LAST + 1]; | ||
| 355 | }; | 354 | }; |
| 356 | 355 | ||
| 357 | static inline struct snd_soc_pcm_stream * | 356 | static inline struct snd_soc_pcm_stream * |
| @@ -790,6 +790,9 @@ struct snd_soc_dai_link { · 789 unmodified lines | |||
| 790 | const struct snd_soc_pcm_stream *params; | 790 | const struct snd_soc_pcm_stream *params; |
| 791 | unsigned int num_params; | 791 | unsigned int num_params; |
| 792 | 792 | ||
| 793 | struct snd_soc_dapm_widget *playback_widget; | ||
| 794 | struct snd_soc_dapm_widget *capture_widget; | ||
| 795 | |||
| 793 | unsigned int dai_fmt; /* format to set on init */ | 796 | unsigned int dai_fmt; /* format to set on init */ |
| 794 | 797 | ||
| 795 | enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */ | 798 | enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */ |
| @@ -130,7 +130,7 @@ DEFINE_EVENT(iocg_inuse_update, iocost_inuse_reset, · 129 unmodified lines | |||
| 130 | 130 | ||
| 131 | TRACE_EVENT(iocost_ioc_vrate_adj, | 131 | TRACE_EVENT(iocost_ioc_vrate_adj, |
| 132 | 132 | ||
| 133 | TP_PROTO(struct ioc *ioc, u64 new_vrate, u32 (*missed_ppm)[2], | 133 | TP_PROTO(struct ioc *ioc, u64 new_vrate, u32 *missed_ppm, |
| 134 | u32 rq_wait_pct, int nr_lagging, int nr_shortages, | 134 | u32 rq_wait_pct, int nr_lagging, int nr_shortages, |
| 135 | int nr_surpluses), | 135 | int nr_surpluses), |
| 136 | 136 | ||
| @@ -155,8 +155,8 @@ TRACE_EVENT(iocost_ioc_vrate_adj, · 18 unmodified lines | |||
| 155 | __entry->old_vrate = atomic64_read(&ioc->vtime_rate);; | 155 | __entry->old_vrate = atomic64_read(&ioc->vtime_rate);; |
| 156 | __entry->new_vrate = new_vrate; | 156 | __entry->new_vrate = new_vrate; |
| 157 | __entry->busy_level = ioc->busy_level; | 157 | __entry->busy_level = ioc->busy_level; |
| 158 | __entry->read_missed_ppm = (*missed_ppm)[READ]; | 158 | __entry->read_missed_ppm = missed_ppm[READ]; |
| 159 | __entry->write_missed_ppm = (*missed_ppm)[WRITE]; | 159 | __entry->write_missed_ppm = missed_ppm[WRITE]; |
| 160 | __entry->rq_wait_pct = rq_wait_pct; | 160 | __entry->rq_wait_pct = rq_wait_pct; |
| 161 | __entry->nr_lagging = nr_lagging; | 161 | __entry->nr_lagging = nr_lagging; |
| 162 | __entry->nr_shortages = nr_shortages; | 162 | __entry->nr_shortages = nr_shortages; |
| @@ -1695,17 +1695,15 @@ DECLARE_EVENT_CLASS(svcrdma_sendcomp_event, · 1694 unmodified lines | |||
| 1695 | 1695 | ||
| 1696 | TRACE_EVENT(svcrdma_post_send, | 1696 | TRACE_EVENT(svcrdma_post_send, |
| 1697 | TP_PROTO( | 1697 | TP_PROTO( |
| 1698 | const struct ib_send_wr *wr, | 1698 | const struct ib_send_wr *wr |
| 1699 | int status | ||
| 1700 | ), | 1699 | ), |
| 1701 | 1700 | ||
| 1702 | TP_ARGS(wr, status), | 1701 | TP_ARGS(wr), |
| 1703 | 1702 | ||
| 1704 | TP_STRUCT__entry( | 1703 | TP_STRUCT__entry( |
| 1705 | __field(const void *, cqe) | 1704 | __field(const void *, cqe) |
| 1706 | __field(unsigned int, num_sge) | 1705 | __field(unsigned int, num_sge) |
| 1707 | __field(u32, inv_rkey) | 1706 | __field(u32, inv_rkey) |
| 1708 | __field(int, status) | ||
| 1709 | ), | 1707 | ), |
| 1710 | 1708 | ||
| 1711 | TP_fast_assign( | 1709 | TP_fast_assign( |
| @@ -1713,12 +1711,11 @@ TRACE_EVENT(svcrdma_post_send, · 1 unmodified line | |||
| 1713 | __entry->num_sge = wr->num_sge; | 1711 | __entry->num_sge = wr->num_sge; |
| 1714 | __entry->inv_rkey = (wr->opcode == IB_WR_SEND_WITH_INV) ? | 1712 | __entry->inv_rkey = (wr->opcode == IB_WR_SEND_WITH_INV) ? |
| 1715 | wr->ex.invalidate_rkey : 0; | 1713 | wr->ex.invalidate_rkey : 0; |
| 1716 | __entry->status = status; | ||
| 1717 | ), | 1714 | ), |
| 1718 | 1715 | ||
| 1719 | TP_printk("cqe=%p num_sge=%u inv_rkey=0x%08x status=%d", | 1716 | TP_printk("cqe=%p num_sge=%u inv_rkey=0x%08x", |
| 1720 | __entry->cqe, __entry->num_sge, | 1717 | __entry->cqe, __entry->num_sge, |
| 1721 | __entry->inv_rkey, __entry->status | 1718 | __entry->inv_rkey |
| 1722 | ) | 1719 | ) |
| 1723 | ); | 1720 | ); |
| 1724 | 1721 | ||
| @@ -1783,26 +1780,23 @@ TRACE_EVENT(svcrdma_wc_receive, · 58 unmodified lines | |||
| 1783 | TRACE_EVENT(svcrdma_post_rw, | 1780 | TRACE_EVENT(svcrdma_post_rw, |
| 1784 | TP_PROTO( | 1781 | TP_PROTO( |
| 1785 | const void *cqe, | 1782 | const void *cqe, |
| 1786 | int sqecount, | 1783 | int sqecount |
| 1787 | int status | ||
| 1788 | ), | 1784 | ), |
| 1789 | 1785 | ||
| 1790 | TP_ARGS(cqe, sqecount, status), | 1786 | TP_ARGS(cqe, sqecount), |
| 1791 | 1787 | ||
| 1792 | TP_STRUCT__entry( | 1788 | TP_STRUCT__entry( |
| 1793 | __field(const void *, cqe) | 1789 | __field(const void *, cqe) |
| 1794 | __field(int, sqecount) | 1790 | __field(int, sqecount) |
| 1795 | __field(int, status) | ||
| 1796 | ), | 1791 | ), |
| 1797 | 1792 | ||
| 1798 | TP_fast_assign( | 1793 | TP_fast_assign( |
| 1799 | __entry->cqe = cqe; | 1794 | __entry->cqe = cqe; |
| 1800 | __entry->sqecount = sqecount; | 1795 | __entry->sqecount = sqecount; |
| 1801 | __entry->status = status; | ||
| 1802 | ), | 1796 | ), |
| 1803 | 1797 | ||
| 1804 | TP_printk("cqe=%p sqecount=%d status=%d", | 1798 | TP_printk("cqe=%p sqecount=%d", |
| 1805 | __entry->cqe, __entry->sqecount, __entry->status | 1799 | __entry->cqe, __entry->sqecount |
| 1806 | ) | 1800 | ) |
| 1807 | ); | 1801 | ); |
| 1808 | 1802 | ||
| @@ -1870,6 +1864,34 @@ DECLARE_EVENT_CLASS(svcrdma_sendqueue_event, · 61 unmodified lines | |||
| 1870 | DEFINE_SQ_EVENT(full); | 1864 | DEFINE_SQ_EVENT(full); |
| 1871 | DEFINE_SQ_EVENT(retry); | 1865 | DEFINE_SQ_EVENT(retry); |
| 1872 | 1866 | ||
| 1867 | TRACE_EVENT(svcrdma_sq_post_err, | ||
| 1868 | TP_PROTO( | ||
| 1869 | const struct svcxprt_rdma *rdma, | ||
| 1870 | int status | ||
| 1871 | ), | ||
| 1872 | |||
| 1873 | TP_ARGS(rdma, status), | ||
| 1874 | |||
| 1875 | TP_STRUCT__entry( | ||
| 1876 | __field(int, avail) | ||
| 1877 | __field(int, depth) | ||
| 1878 | __field(int, status) | ||
| 1879 | __string(addr, rdma->sc_xprt.xpt_remotebuf) | ||
| 1880 | ), | ||
| 1881 | |||
| 1882 | TP_fast_assign( | ||
| 1883 | __entry->avail = atomic_read(&rdma->sc_sq_avail); | ||
| 1884 | __entry->depth = rdma->sc_sq_depth; | ||
| 1885 | __entry->status = status; | ||
| 1886 | __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); | ||
| 1887 | ), | ||
| 1888 | |||
| 1889 | TP_printk("addr=%s sc_sq_avail=%d/%d status=%d", | ||
| 1890 | __get_str(addr), __entry->avail, __entry->depth, | ||
| 1891 | __entry->status | ||
| 1892 | ) | ||
| 1893 | ); | ||
| 1894 | |||
| 1873 | #endif /* _TRACE_RPCRDMA_H */ | 1895 | #endif /* _TRACE_RPCRDMA_H */ |
| 1874 | 1896 | ||
| 1875 | #include <trace/define_trace.h> | 1897 | #include <trace/define_trace.h> |
| @@ -46,7 +46,7 @@ TRACE_EVENT(wbt_stat, · 45 unmodified lines | |||
| 46 | ), | 46 | ), |
| 47 | 47 | ||
| 48 | TP_printk("%s: rmean=%llu, rmin=%llu, rmax=%llu, rsamples=%llu, " | 48 | TP_printk("%s: rmean=%llu, rmin=%llu, rmax=%llu, rsamples=%llu, " |
| 49 | "wmean=%llu, wmin=%llu, wmax=%llu, wsamples=%llu\n", | 49 | "wmean=%llu, wmin=%llu, wmax=%llu, wsamples=%llu", |
| 50 | __entry->name, __entry->rmean, __entry->rmin, __entry->rmax, | 50 | __entry->name, __entry->rmean, __entry->rmin, __entry->rmax, |
| 51 | __entry->rnr_samples, __entry->wmean, __entry->wmin, | 51 | __entry->rnr_samples, __entry->wmean, __entry->wmin, |
| 52 | __entry->wmax, __entry->wnr_samples) | 52 | __entry->wmax, __entry->wnr_samples) |
| @@ -73,7 +73,7 @@ TRACE_EVENT(wbt_lat, · 20 unmodified lines | |||
| 73 | __entry->lat = div_u64(lat, 1000); | 73 | __entry->lat = div_u64(lat, 1000); |
| 74 | ), | 74 | ), |
| 75 | 75 | ||
| 76 | TP_printk("%s: latency %lluus\n", __entry->name, | 76 | TP_printk("%s: latency %lluus", __entry->name, |
| 77 | (unsigned long long) __entry->lat) | 77 | (unsigned long long) __entry->lat) |
| 78 | ); | 78 | ); |
| 79 | 79 | ||
| @@ -115,7 +115,7 @@ TRACE_EVENT(wbt_step, · 35 unmodified lines | |||
| 115 | __entry->max = max; | 115 | __entry->max = max; |
| 116 | ), | 116 | ), |
| 117 | 117 | ||
| 118 | TP_printk("%s: %s: step=%d, window=%luus, background=%u, normal=%u, max=%u\n", | 118 | TP_printk("%s: %s: step=%d, window=%luus, background=%u, normal=%u, max=%u", |
| 119 | __entry->name, __entry->msg, __entry->step, __entry->window, | 119 | __entry->name, __entry->msg, __entry->step, __entry->window, |
| 120 | __entry->bg, __entry->normal, __entry->max) | 120 | __entry->bg, __entry->normal, __entry->max) |
| 121 | ); | 121 | ); |
| @@ -148,7 +148,7 @@ TRACE_EVENT(wbt_timer, · 26 unmodified lines | |||
| 148 | __entry->inflight = inflight; | 148 | __entry->inflight = inflight; |
| 149 | ), | 149 | ), |
| 150 | 150 | ||
| 151 | TP_printk("%s: status=%u, step=%d, inflight=%u\n", __entry->name, | 151 | TP_printk("%s: status=%u, step=%d, inflight=%u", __entry->name, |
| 152 | __entry->status, __entry->step, __entry->inflight) | 152 | __entry->status, __entry->step, __entry->inflight) |
| 153 | ); | 153 | ); |
| 154 | 154 | ||
| @@ -36,7 +36,6 @@ · 35 unmodified lines | |||
| 36 | EM( WB_REASON_SYNC, "sync") \ | 36 | EM( WB_REASON_SYNC, "sync") \ |
| 37 | EM( WB_REASON_PERIODIC, "periodic") \ | 37 | EM( WB_REASON_PERIODIC, "periodic") \ |
| 38 | EM( WB_REASON_LAPTOP_TIMER, "laptop_timer") \ | 38 | EM( WB_REASON_LAPTOP_TIMER, "laptop_timer") \ |
| 39 | EM( WB_REASON_FREE_MORE_MEM, "free_more_memory") \ | ||
| 40 | EM( WB_REASON_FS_FREE_SPACE, "fs_free_space") \ | 39 | EM( WB_REASON_FS_FREE_SPACE, "fs_free_space") \ |
| 41 | EMe(WB_REASON_FORKER_THREAD, "forker_thread") | 40 | EMe(WB_REASON_FORKER_THREAD, "forker_thread") |
| 42 | 41 | ||
| @@ -1642,7 +1642,7 @@ union bpf_attr { · 1641 unmodified lines | |||
| 1642 | * ifindex, but doesn't require a map to do so. | 1642 | * ifindex, but doesn't require a map to do so. |
| 1643 | * Return | 1643 | * Return |
| 1644 | * **XDP_REDIRECT** on success, or the value of the two lower bits | 1644 | * **XDP_REDIRECT** on success, or the value of the two lower bits |
| 1645 | * of the **flags* argument on error. | 1645 | * of the *flags* argument on error. |
| 1646 | * | 1646 | * |
| 1647 | * int bpf_sk_redirect_map(struct sk_buff *skb, struct bpf_map *map, u32 key, u64 flags) | 1647 | * int bpf_sk_redirect_map(struct sk_buff *skb, struct bpf_map *map, u32 key, u64 flags) |
| 1648 | * Description | 1648 | * Description |
| @@ -36,12 +36,10 @@ struct btrfs_ioctl_vol_args { · 35 unmodified lines | |||
| 36 | #define BTRFS_DEVICE_PATH_NAME_MAX 1024 | 36 | #define BTRFS_DEVICE_PATH_NAME_MAX 1024 |
| 37 | #define BTRFS_SUBVOL_NAME_MAX 4039 | 37 | #define BTRFS_SUBVOL_NAME_MAX 4039 |
| 38 | 38 | ||
| 39 | /* | 39 | #ifndef __KERNEL__ |
| 40 | * Deprecated since 5.7: | 40 | /* Deprecated since 5.7 */ |
| 41 | * | 41 | # define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0) |
| 42 | * BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0) | 42 | #endif |
| 43 | */ | ||
| 44 | |||
| 45 | #define BTRFS_SUBVOL_RDONLY (1ULL << 1) | 43 | #define BTRFS_SUBVOL_RDONLY (1ULL << 1) |
| 46 | #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) | 44 | #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) |
| 47 | 45 | ||
| @@ -45,13 +45,13 @@ struct dlm_lock_params { · 44 unmodified lines | |||
| 45 | void __user *bastaddr; | 45 | void __user *bastaddr; |
| 46 | struct dlm_lksb __user *lksb; | 46 | struct dlm_lksb __user *lksb; |
| 47 | char lvb[DLM_USER_LVB_LEN]; | 47 | char lvb[DLM_USER_LVB_LEN]; |
| 48 | char name[0]; | 48 | char name[]; |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | struct dlm_lspace_params { | 51 | struct dlm_lspace_params { |
| 52 | __u32 flags; | 52 | __u32 flags; |
| 53 | __u32 minor; | 53 | __u32 minor; |
| 54 | char name[0]; | 54 | char name[]; |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | struct dlm_purge_params { | 57 | struct dlm_purge_params { |
| @@ -34,7 +34,7 @@ struct fiemap { · 33 unmodified lines | |||
| 34 | __u32 fm_mapped_extents;/* number of extents that were mapped (out) */ | 34 | __u32 fm_mapped_extents;/* number of extents that were mapped (out) */ |
| 35 | __u32 fm_extent_count; /* size of fm_extents array (in) */ | 35 | __u32 fm_extent_count; /* size of fm_extents array (in) */ |
| 36 | __u32 fm_reserved; | 36 | __u32 fm_reserved; |
| 37 | struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */ | 37 | struct fiemap_extent fm_extents[]; /* array of mapped extents (out) */ |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | #define FIEMAP_MAX_OFFSET (~0ULL) | 40 | #define FIEMAP_MAX_OFFSET (~0ULL) |
| @@ -276,6 +276,7 @@ enum nft_rule_compat_attributes { · 275 unmodified lines | |||
| 276 | * @NFT_SET_TIMEOUT: set uses timeouts | 276 | * @NFT_SET_TIMEOUT: set uses timeouts |
| 277 | * @NFT_SET_EVAL: set can be updated from the evaluation path | 277 | * @NFT_SET_EVAL: set can be updated from the evaluation path |
| 278 | * @NFT_SET_OBJECT: set contains stateful objects | 278 | * @NFT_SET_OBJECT: set contains stateful objects |
| 279 | * @NFT_SET_CONCAT: set contains a concatenation | ||
| 279 | */ | 280 | */ |
| 280 | enum nft_set_flags { | 281 | enum nft_set_flags { |
| 281 | NFT_SET_ANONYMOUS = 0x1, | 282 | NFT_SET_ANONYMOUS = 0x1, |
| @@ -285,6 +286,7 @@ enum nft_set_flags { · 3 unmodified lines | |||
| 285 | NFT_SET_TIMEOUT = 0x10, | 286 | NFT_SET_TIMEOUT = 0x10, |
| 286 | NFT_SET_EVAL = 0x20, | 287 | NFT_SET_EVAL = 0x20, |
| 287 | NFT_SET_OBJECT = 0x40, | 288 | NFT_SET_OBJECT = 0x40, |
| 289 | NFT_SET_CONCAT = 0x80, | ||
| 288 | }; | 290 | }; |
| 289 | 291 | ||
| 290 | /** | 292 | /** |
| @@ -48,6 +48,7 @@ struct idletimer_tg_info_v1 { · 47 unmodified lines | |||
| 48 | 48 | ||
| 49 | char label[MAX_IDLETIMER_LABEL_SIZE]; | 49 | char label[MAX_IDLETIMER_LABEL_SIZE]; |
| 50 | 50 | ||
| 51 | __u8 send_nl_msg; /* unused: for compatibility with Android */ | ||
| 51 | __u8 timer_type; | 52 | __u8 timer_type; |
| 52 | 53 | ||
| 53 | /* for kernel module internal use only */ | 54 | /* for kernel module internal use only */ |
| @@ -48,8 +48,15 @@ struct virtio_balloon_config { · 47 unmodified lines | |||
| 48 | __u32 num_pages; | 48 | __u32 num_pages; |
| 49 | /* Number of pages we've actually got in balloon. */ | 49 | /* Number of pages we've actually got in balloon. */ |
| 50 | __u32 actual; | 50 | __u32 actual; |
| 51 | /* Free page report command id, readonly by guest */ | 51 | /* |
| 52 | __u32 free_page_report_cmd_id; | 52 | * Free page hint command id, readonly by guest. |
| 53 | * Was previously named free_page_report_cmd_id so we | ||
| 54 | * need to carry that name for legacy support. | ||
| 55 | */ | ||
| 56 | union { | ||
| 57 | __u32 free_page_hint_cmd_id; | ||
| 58 | __u32 free_page_report_cmd_id; /* deprecated */ | ||
| 59 | }; | ||
| 53 | /* Stores PAGE_POISON if page poisoning is in use */ | 60 | /* Stores PAGE_POISON if page poisoning is in use */ |
| 54 | __u32 poison_val; | 61 | __u32 poison_val; |
| 55 | }; | 62 | }; |
| @@ -73,8 +73,8 @@ struct vdso_timestamp { · 72 unmodified lines | |||
| 73 | * | 73 | * |
| 74 | * @offset is used by the special time namespace VVAR pages which are | 74 | * @offset is used by the special time namespace VVAR pages which are |
| 75 | * installed instead of the real VVAR page. These namespace pages must set | 75 | * installed instead of the real VVAR page. These namespace pages must set |
| 76 | * @seq to 1 and @clock_mode to VLOCK_TIMENS to force the code into the | 76 | * @seq to 1 and @clock_mode to VDSO_CLOCKMODE_TIMENS to force the code into |
| 77 | * time namespace slow path. The namespace aware functions retrieve the | 77 | * the time namespace slow path. The namespace aware functions retrieve the |
| 78 | * real system wide VVAR page, read host time and add the per clock offset. | 78 | * real system wide VVAR page, read host time and add the per clock offset. |
| 79 | * For clocks which are not affected by time namespace adjustment the | 79 | * For clocks which are not affected by time namespace adjustment the |
| 80 | * offset must be zero. | 80 | * offset must be zero. |
| @@ -1326,6 +1326,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) · 1325 unmodified lines | |||
| 1326 | case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2: | 1326 | case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2: |
| 1327 | if (!audit_enabled && msg_type != AUDIT_USER_AVC) | 1327 | if (!audit_enabled && msg_type != AUDIT_USER_AVC) |
| 1328 | return 0; | 1328 | return 0; |
| 1329 | /* exit early if there isn't at least one character to print */ | ||
| 1330 | if (data_len < 2) | ||
| 1331 | return -EINVAL; | ||
| 1329 | 1332 | ||
| 1330 | err = audit_filter(msg_type, AUDIT_FILTER_USER); | 1333 | err = audit_filter(msg_type, AUDIT_FILTER_USER); |
| 1331 | if (err == 1) { /* match or error */ | 1334 | if (err == 1) { /* match or error */ |
| @@ -30,7 +30,7 @@ struct bpf_lru_node { · 29 unmodified lines | |||
| 30 | struct bpf_lru_list { | 30 | struct bpf_lru_list { |
| 31 | struct list_head lists[NR_BPF_LRU_LIST_T]; | 31 | struct list_head lists[NR_BPF_LRU_LIST_T]; |
| 32 | unsigned int counts[NR_BPF_LRU_LIST_COUNT]; | 32 | unsigned int counts[NR_BPF_LRU_LIST_COUNT]; |
| 33 | /* The next inacitve list rotation starts from here */ | 33 | /* The next inactive list rotation starts from here */ |
| 34 | struct list_head *next_inactive_rotation; | 34 | struct list_head *next_inactive_rotation; |
| 35 | 35 | ||
| 36 | raw_spinlock_t lock ____cacheline_aligned_in_smp; | 36 | raw_spinlock_t lock ____cacheline_aligned_in_smp; |
| @@ -469,7 +469,7 @@ static int cpu_map_update_elem(struct bpf_map *map, void *key, void *value, · 468 unmodified lines | |||
| 469 | return -EOVERFLOW; | 469 | return -EOVERFLOW; |
| 470 | 470 | ||
| 471 | /* Make sure CPU is a valid possible cpu */ | 471 | /* Make sure CPU is a valid possible cpu */ |
| 472 | if (!cpu_possible(key_cpu)) | 472 | if (key_cpu >= nr_cpumask_bits || !cpu_possible(key_cpu)) |
| 473 | return -ENODEV; | 473 | return -ENODEV; |
| 474 | 474 | ||
| 475 | if (qsize == 0) { | 475 | if (qsize == 0) { |
| @@ -586,9 +586,7 @@ static void bpf_map_mmap_open(struct vm_area_struct *vma) · 585 unmodified lines | |||
| 586 | { | 586 | { |
| 587 | struct bpf_map *map = vma->vm_file->private_data; | 587 | struct bpf_map *map = vma->vm_file->private_data; |
| 588 | 588 | ||
| 589 | bpf_map_inc_with_uref(map); | 589 | if (vma->vm_flags & VM_MAYWRITE) { |
| 590 | |||
| 591 | if (vma->vm_flags & VM_WRITE) { | ||
| 592 | mutex_lock(&map->freeze_mutex); | 590 | mutex_lock(&map->freeze_mutex); |
| 593 | map->writecnt++; | 591 | map->writecnt++; |
| 594 | mutex_unlock(&map->freeze_mutex); | 592 | mutex_unlock(&map->freeze_mutex); |
| @@ -600,13 +598,11 @@ static void bpf_map_mmap_close(struct vm_area_struct *vma) · 5 unmodified lines | |||
| 600 | { | 598 | { |
| 601 | struct bpf_map *map = vma->vm_file->private_data; | 599 | struct bpf_map *map = vma->vm_file->private_data; |
| 602 | 600 | ||
| 603 | if (vma->vm_flags & VM_WRITE) { | 601 | if (vma->vm_flags & VM_MAYWRITE) { |
| 604 | mutex_lock(&map->freeze_mutex); | 602 | mutex_lock(&map->freeze_mutex); |
| 605 | map->writecnt--; | 603 | map->writecnt--; |
| 606 | mutex_unlock(&map->freeze_mutex); | 604 | mutex_unlock(&map->freeze_mutex); |
| 607 | } | 605 | } |
| 608 | |||
| 609 | bpf_map_put_with_uref(map); | ||
| 610 | } | 606 | } |
| 611 | 607 | ||
| 612 | static const struct vm_operations_struct bpf_map_default_vmops = { | 608 | static const struct vm_operations_struct bpf_map_default_vmops = { |
| @@ -635,14 +631,16 @@ static int bpf_map_mmap(struct file *filp, struct vm_area_struct *vma) · 22 unmodified lines | |||
| 635 | /* set default open/close callbacks */ | 631 | /* set default open/close callbacks */ |
| 636 | vma->vm_ops = &bpf_map_default_vmops; | 632 | vma->vm_ops = &bpf_map_default_vmops; |
| 637 | vma->vm_private_data = map; | 633 | vma->vm_private_data = map; |
| 634 | vma->vm_flags &= ~VM_MAYEXEC; | ||
| 635 | if (!(vma->vm_flags & VM_WRITE)) | ||
| 636 | /* disallow re-mapping with PROT_WRITE */ | ||
| 637 | vma->vm_flags &= ~VM_MAYWRITE; | ||
| 638 | 638 | ||
| 639 | err = map->ops->map_mmap(map, vma); | 639 | err = map->ops->map_mmap(map, vma); |
| 640 | if (err) | 640 | if (err) |
| 641 | goto out; | 641 | goto out; |
| 642 | 642 | ||
| 643 | bpf_map_inc_with_uref(map); | 643 | if (vma->vm_flags & VM_MAYWRITE) |
| 644 | |||
| 645 | if (vma->vm_flags & VM_WRITE) | ||
| 646 | map->writecnt++; | 644 | map->writecnt++; |
| 647 | out: | 645 | out: |
| 648 | mutex_unlock(&map->freeze_mutex); | 646 | mutex_unlock(&map->freeze_mutex); |
| @@ -2285,7 +2283,7 @@ static void bpf_link_show_fdinfo(struct seq_file *m, struct file *filp) · 1636 unmodified lines | |||
| 2285 | } | 2283 | } |
| 2286 | #endif | 2284 | #endif |
| 2287 | 2285 | ||
| 2288 | const struct file_operations bpf_link_fops = { | 2286 | static const struct file_operations bpf_link_fops = { |
| 2289 | #ifdef CONFIG_PROC_FS | 2287 | #ifdef CONFIG_PROC_FS |
| 2290 | .show_fdinfo = bpf_link_show_fdinfo, | 2288 | .show_fdinfo = bpf_link_show_fdinfo, |
| 2291 | #endif | 2289 | #endif |
| @@ -3630,8 +3628,10 @@ static int link_update(union bpf_attr *attr) · 1338 unmodified lines | |||
| 3630 | return PTR_ERR(link); | 3628 | return PTR_ERR(link); |
| 3631 | 3629 | ||
| 3632 | new_prog = bpf_prog_get(attr->link_update.new_prog_fd); | 3630 | new_prog = bpf_prog_get(attr->link_update.new_prog_fd); |
| 3633 | if (IS_ERR(new_prog)) | 3631 | if (IS_ERR(new_prog)) { |
| 3634 | return PTR_ERR(new_prog); | 3632 | ret = PTR_ERR(new_prog); |
| 3633 | goto out_put_link; | ||
| 3634 | } | ||
| 3635 | 3635 | ||
| 3636 | if (flags & BPF_F_REPLACE) { | 3636 | if (flags & BPF_F_REPLACE) { |
| 3637 | old_prog = bpf_prog_get(attr->link_update.old_prog_fd); | 3637 | old_prog = bpf_prog_get(attr->link_update.old_prog_fd); |
| @@ -3640,6 +3640,9 @@ static int link_update(union bpf_attr *attr) · 2 unmodified lines | |||
| 3640 | old_prog = NULL; | 3640 | old_prog = NULL; |
| 3641 | goto out_put_progs; | 3641 | goto out_put_progs; |
| 3642 | } | 3642 | } |
| 3643 | } else if (attr->link_update.old_prog_fd) { | ||
| 3644 | ret = -EINVAL; | ||
| 3645 | goto out_put_progs; | ||
| 3643 | } | 3646 | } |
| 3644 | 3647 | ||
| 3645 | #ifdef CONFIG_CGROUP_BPF | 3648 | #ifdef CONFIG_CGROUP_BPF |
| @@ -3655,6 +3658,8 @@ out_put_progs: · 9 unmodified lines | |||
| 3655 | bpf_prog_put(old_prog); | 3658 | bpf_prog_put(old_prog); |
| 3656 | if (ret) | 3659 | if (ret) |
| 3657 | bpf_prog_put(new_prog); | 3660 | bpf_prog_put(new_prog); |
| 3661 | out_put_link: | ||
| 3662 | bpf_link_put(link); | ||
| 3658 | return ret; | 3663 | return ret; |
| 3659 | } | 3664 | } |
| 3660 | 3665 | ||
| @@ -1255,8 +1255,7 @@ static void __mark_reg_unknown(const struct bpf_verifier_env *env, · 1254 unmodified lines | |||
| 1255 | reg->type = SCALAR_VALUE; | 1255 | reg->type = SCALAR_VALUE; |
| 1256 | reg->var_off = tnum_unknown; | 1256 | reg->var_off = tnum_unknown; |
| 1257 | reg->frameno = 0; | 1257 | reg->frameno = 0; |
| 1258 | reg->precise = env->subprog_cnt > 1 || !env->allow_ptr_leaks ? | 1258 | reg->precise = env->subprog_cnt > 1 || !env->allow_ptr_leaks; |
| 1259 | true : false; | ||
| 1260 | __mark_reg_unbounded(reg); | 1259 | __mark_reg_unbounded(reg); |
| 1261 | } | 1260 | } |
| 1262 | 1261 | ||
| @@ -2119,6 +2118,15 @@ static bool register_is_const(struct bpf_reg_state *reg) · 856 unmodified lines | |||
| 2119 | return reg->type == SCALAR_VALUE && tnum_is_const(reg->var_off); | 2118 | return reg->type == SCALAR_VALUE && tnum_is_const(reg->var_off); |
| 2120 | } | 2119 | } |
| 2121 | 2120 | ||
| 2121 | static bool __is_pointer_value(bool allow_ptr_leaks, | ||
| 2122 | const struct bpf_reg_state *reg) | ||
| 2123 | { | ||
| 2124 | if (allow_ptr_leaks) | ||
| 2125 | return false; | ||
| 2126 | |||
| 2127 | return reg->type != SCALAR_VALUE; | ||
| 2128 | } | ||
| 2129 | |||
| 2122 | static void save_register_state(struct bpf_func_state *state, | 2130 | static void save_register_state(struct bpf_func_state *state, |
| 2123 | int spi, struct bpf_reg_state *reg) | 2131 | int spi, struct bpf_reg_state *reg) |
| 2124 | { | 2132 | { |
| @@ -2309,6 +2317,16 @@ static int check_stack_read(struct bpf_verifier_env *env, · 184 unmodified lines | |||
| 2309 | * which resets stack/reg liveness for state transitions | 2317 | * which resets stack/reg liveness for state transitions |
| 2310 | */ | 2318 | */ |
| 2311 | state->regs[value_regno].live |= REG_LIVE_WRITTEN; | 2319 | state->regs[value_regno].live |= REG_LIVE_WRITTEN; |
| 2320 | } else if (__is_pointer_value(env->allow_ptr_leaks, reg)) { | ||
| 2321 | /* If value_regno==-1, the caller is asking us whether | ||
| 2322 | * it is acceptable to use this value as a SCALAR_VALUE | ||
| 2323 | * (e.g. for XADD). | ||
| 2324 | * We must not allow unprivileged callers to do that | ||
| 2325 | * with spilled pointers. | ||
| 2326 | */ | ||
| 2327 | verbose(env, "leaking pointer from stack off %d\n", | ||
| 2328 | off); | ||
| 2329 | return -EACCES; | ||
| 2312 | } | 2330 | } |
| 2313 | mark_reg_read(env, reg, reg->parent, REG_LIVE_READ64); | 2331 | mark_reg_read(env, reg, reg->parent, REG_LIVE_READ64); |
| 2314 | } else { | 2332 | } else { |
| @@ -2674,15 +2692,6 @@ static int check_sock_access(struct bpf_verifier_env *env, int insn_idx, · 359 unmodified lines | |||
| 2674 | return -EACCES; | 2692 | return -EACCES; |
| 2675 | } | 2693 | } |
| 2676 | 2694 | ||
| 2677 | static bool __is_pointer_value(bool allow_ptr_leaks, | ||
| 2678 | const struct bpf_reg_state *reg) | ||
| 2679 | { | ||
| 2680 | if (allow_ptr_leaks) | ||
| 2681 | return false; | ||
| 2682 | |||
| 2683 | return reg->type != SCALAR_VALUE; | ||
| 2684 | } | ||
| 2685 | |||
| 2686 | static struct bpf_reg_state *reg_state(struct bpf_verifier_env *env, int regno) | 2695 | static struct bpf_reg_state *reg_state(struct bpf_verifier_env *env, int regno) |
| 2687 | { | 2696 | { |
| 2688 | return cur_regs(env) + regno; | 2697 | return cur_regs(env) + regno; |
| @@ -3090,7 +3099,7 @@ static int check_ptr_to_btf_access(struct bpf_verifier_env *env, · 401 unmodified lines | |||
| 3090 | if (ret < 0) | 3099 | if (ret < 0) |
| 3091 | return ret; | 3100 | return ret; |
| 3092 | 3101 | ||
| 3093 | if (atype == BPF_READ) { | 3102 | if (atype == BPF_READ && value_regno >= 0) { |
| 3094 | if (ret == SCALAR_VALUE) { | 3103 | if (ret == SCALAR_VALUE) { |
| 3095 | mark_reg_unknown(env, regs, value_regno); | 3104 | mark_reg_unknown(env, regs, value_regno); |
| 3096 | return 0; | 3105 | return 0; |
| @@ -10488,6 +10497,7 @@ static int check_attach_btf_id(struct bpf_verifier_env *env) · 7391 unmodified lines | |||
| 10488 | return -EINVAL; | 10497 | return -EINVAL; |
| 10489 | } | 10498 | } |
| 10490 | env->ops = bpf_verifier_ops[tgt_prog->type]; | 10499 | env->ops = bpf_verifier_ops[tgt_prog->type]; |
| 10500 | prog->expected_attach_type = tgt_prog->expected_attach_type; | ||
| 10491 | } | 10501 | } |
| 10492 | if (!tgt_prog->jited) { | 10502 | if (!tgt_prog->jited) { |
| 10493 | verbose(env, "Can attach to only JITed progs\n"); | 10503 | verbose(env, "Can attach to only JITed progs\n"); |
| @@ -10832,6 +10842,13 @@ err_release_maps: · 338 unmodified lines | |||
| 10832 | * them now. Otherwise free_used_maps() will release them. | 10842 | * them now. Otherwise free_used_maps() will release them. |
| 10833 | */ | 10843 | */ |
| 10834 | release_maps(env); | 10844 | release_maps(env); |
| 10845 | |||
| 10846 | /* extension progs temporarily inherit the attach_type of their targets | ||
| 10847 | for verification purposes, so set it back to zero before returning | ||
| 10848 | */ | ||
| 10849 | if (env->prog->type == BPF_PROG_TYPE_EXT) | ||
| 10850 | env->prog->expected_attach_type = 0; | ||
| 10851 | |||
| 10835 | *prog = env->prog; | 10852 | *prog = env->prog; |
| 10836 | err_unlock: | 10853 | err_unlock: |
| 10837 | if (!is_priv) | 10854 | if (!is_priv) |
| @@ -7491,10 +7491,17 @@ static void perf_event_task_output(struct perf_event *event, · 7490 unmodified lines | |||
| 7491 | goto out; | 7491 | goto out; |
| 7492 | 7492 | ||
| 7493 | task_event->event_id.pid = perf_event_pid(event, task); | 7493 | task_event->event_id.pid = perf_event_pid(event, task); |
| 7494 | task_event->event_id.ppid = perf_event_pid(event, current); | ||
| 7495 | |||
| 7496 | task_event->event_id.tid = perf_event_tid(event, task); | 7494 | task_event->event_id.tid = perf_event_tid(event, task); |
| 7497 | task_event->event_id.ptid = perf_event_tid(event, current); | 7495 | |
| 7496 | if (task_event->event_id.header.type == PERF_RECORD_EXIT) { | ||
| 7497 | task_event->event_id.ppid = perf_event_pid(event, | ||
| 7498 | task->real_parent); | ||
| 7499 | task_event->event_id.ptid = perf_event_pid(event, | ||
| 7500 | task->real_parent); | ||
| 7501 | } else { /* PERF_RECORD_FORK */ | ||
| 7502 | task_event->event_id.ppid = perf_event_pid(event, current); | ||
| 7503 | task_event->event_id.ptid = perf_event_tid(event, current); | ||
| 7504 | } | ||
| 7498 | 7505 | ||
| 7499 | task_event->event_id.time = perf_event_clock(event); | 7506 | task_event->event_id.time = perf_event_clock(event); |
| 7500 | 7507 | ||
| @@ -219,6 +219,7 @@ repeat: · 218 unmodified lines | |||
| 219 | 219 | ||
| 220 | write_unlock_irq(&tasklist_lock); | 220 | write_unlock_irq(&tasklist_lock); |
| 221 | proc_flush_pid(thread_pid); | 221 | proc_flush_pid(thread_pid); |
| 222 | put_pid(thread_pid); | ||
| 222 | release_thread(p); | 223 | release_thread(p); |
| 223 | put_task_struct_rcu_user(p); | 224 | put_task_struct_rcu_user(p); |
| 224 | 225 | ||
| @@ -2605,6 +2605,14 @@ noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs, · 2604 unmodified lines | |||
| 2605 | struct clone_args args; | 2605 | struct clone_args args; |
| 2606 | pid_t *kset_tid = kargs->set_tid; | 2606 | pid_t *kset_tid = kargs->set_tid; |
| 2607 | 2607 | ||
| 2608 | BUILD_BUG_ON(offsetofend(struct clone_args, tls) != | ||
| 2609 | CLONE_ARGS_SIZE_VER0); | ||
| 2610 | BUILD_BUG_ON(offsetofend(struct clone_args, set_tid_size) != | ||
| 2611 | CLONE_ARGS_SIZE_VER1); | ||
| 2612 | BUILD_BUG_ON(offsetofend(struct clone_args, cgroup) != | ||
| 2613 | CLONE_ARGS_SIZE_VER2); | ||
| 2614 | BUILD_BUG_ON(sizeof(struct clone_args) != CLONE_ARGS_SIZE_VER2); | ||
| 2615 | |||
| 2608 | if (unlikely(usize > PAGE_SIZE)) | 2616 | if (unlikely(usize > PAGE_SIZE)) |
| 2609 | return -E2BIG; | 2617 | return -E2BIG; |
| 2610 | if (unlikely(usize < CLONE_ARGS_SIZE_VER0)) | 2618 | if (unlikely(usize < CLONE_ARGS_SIZE_VER0)) |
| @@ -2631,7 +2639,8 @@ noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs, · 20 unmodified lines | |||
| 2631 | !valid_signal(args.exit_signal))) | 2639 | !valid_signal(args.exit_signal))) |
| 2632 | return -EINVAL; | 2640 | return -EINVAL; |
| 2633 | 2641 | ||
| 2634 | if ((args.flags & CLONE_INTO_CGROUP) && args.cgroup < 0) | 2642 | if ((args.flags & CLONE_INTO_CGROUP) && |
| 2643 | (args.cgroup > INT_MAX || usize < CLONE_ARGS_SIZE_VER2)) | ||
| 2635 | return -EINVAL; | 2644 | return -EINVAL; |
| 2636 | 2645 | ||
| 2637 | *kargs = (struct kernel_clone_args){ | 2646 | *kargs = (struct kernel_clone_args){ |
| @@ -1690,34 +1690,6 @@ out_mput: · 1689 unmodified lines | |||
| 1690 | return ret; | 1690 | return ret; |
| 1691 | } | 1691 | } |
| 1692 | 1692 | ||
| 1693 | /** | ||
| 1694 | * setup_irq - setup an interrupt | ||
| 1695 | * @irq: Interrupt line to setup | ||
| 1696 | * @act: irqaction for the interrupt | ||
| 1697 | * | ||
| 1698 | * Used to statically setup interrupts in the early boot process. | ||
| 1699 | */ | ||
| 1700 | int setup_irq(unsigned int irq, struct irqaction *act) | ||
| 1701 | { | ||
| 1702 | int retval; | ||
| 1703 | struct irq_desc *desc = irq_to_desc(irq); | ||
| 1704 | |||
| 1705 | if (!desc || WARN_ON(irq_settings_is_per_cpu_devid(desc))) | ||
| 1706 | return -EINVAL; | ||
| 1707 | |||
| 1708 | retval = irq_chip_pm_get(&desc->irq_data); | ||
| 1709 | if (retval < 0) | ||
| 1710 | return retval; | ||
| 1711 | |||
| 1712 | retval = __setup_irq(irq, desc, act); | ||
| 1713 | |||
| 1714 | if (retval) | ||
| 1715 | irq_chip_pm_put(&desc->irq_data); | ||
| 1716 | |||
| 1717 | return retval; | ||
| 1718 | } | ||
| 1719 | EXPORT_SYMBOL_GPL(setup_irq); | ||
| 1720 | |||
| 1721 | /* | 1693 | /* |
| 1722 | * Internal function to unregister an irqaction - used to free | 1694 | * Internal function to unregister an irqaction - used to free |
| 1723 | * regular and special interrupts that are part of the architecture. | 1695 | * regular and special interrupts that are part of the architecture. |
| @@ -1858,22 +1830,6 @@ static struct irqaction *__free_irq(struct irq_desc *desc, void *dev_id) · 134 unmodified lines | |||
| 1858 | return action; | 1830 | return action; |
| 1859 | } | 1831 | } |
| 1860 | 1832 | ||
| 1861 | /** | ||
| 1862 | * remove_irq - free an interrupt | ||
| 1863 | * @irq: Interrupt line to free | ||
| 1864 | * @act: irqaction for the interrupt | ||
| 1865 | * | ||
| 1866 | * Used to remove interrupts statically setup by the early boot process. | ||
| 1867 | */ | ||
| 1868 | void remove_irq(unsigned int irq, struct irqaction *act) | ||
| 1869 | { | ||
| 1870 | struct irq_desc *desc = irq_to_desc(irq); | ||
| 1871 | |||
| 1872 | if (desc && !WARN_ON(irq_settings_is_per_cpu_devid(desc))) | ||
| 1873 | __free_irq(desc, act->dev_id); | ||
| 1874 | } | ||
| 1875 | EXPORT_SYMBOL_GPL(remove_irq); | ||
| 1876 | |||
| 1877 | /** | 1833 | /** |
| 1878 | * free_irq - free an interrupt allocated with request_irq | 1834 | * free_irq - free an interrupt allocated with request_irq |
| 1879 | * @irq: Interrupt line to free | 1835 | * @irq: Interrupt line to free |
| @@ -825,7 +825,7 @@ static __always_inline void rcu_nmi_enter_common(bool irq) · 824 unmodified lines | |||
| 825 | rcu_cleanup_after_idle(); | 825 | rcu_cleanup_after_idle(); |
| 826 | 826 | ||
| 827 | incby = 1; | 827 | incby = 1; |
| 828 | } else if (tick_nohz_full_cpu(rdp->cpu) && | 828 | } else if (irq && tick_nohz_full_cpu(rdp->cpu) && |
| 829 | rdp->dynticks_nmi_nesting == DYNTICK_IRQ_NONIDLE && | 829 | rdp->dynticks_nmi_nesting == DYNTICK_IRQ_NONIDLE && |
| 830 | READ_ONCE(rdp->rcu_urgent_qs) && | 830 | READ_ONCE(rdp->rcu_urgent_qs) && |
| 831 | !READ_ONCE(rdp->rcu_forced_tick)) { | 831 | !READ_ONCE(rdp->rcu_forced_tick)) { |
| @@ -1232,13 +1232,8 @@ static void uclamp_fork(struct task_struct *p) · 1231 unmodified lines | |||
| 1232 | return; | 1232 | return; |
| 1233 | 1233 | ||
| 1234 | for_each_clamp_id(clamp_id) { | 1234 | for_each_clamp_id(clamp_id) { |
| 1235 | unsigned int clamp_value = uclamp_none(clamp_id); | 1235 | uclamp_se_set(&p->uclamp_req[clamp_id], |
| 1236 | 1236 | uclamp_none(clamp_id), false); | |
| 1237 | /* By default, RT tasks always get 100% boost */ | ||
| 1238 | if (unlikely(rt_task(p) && clamp_id == UCLAMP_MIN)) | ||
| 1239 | clamp_value = uclamp_none(UCLAMP_MAX); | ||
| 1240 | |||
| 1241 | uclamp_se_set(&p->uclamp_req[clamp_id], clamp_value, false); | ||
| 1242 | } | 1237 | } |
| 1243 | } | 1238 | } |
| 1244 | 1239 | ||
| @@ -1003,12 +1003,12 @@ u64 kcpustat_field(struct kernel_cpustat *kcpustat, · 1002 unmodified lines | |||
| 1003 | enum cpu_usage_stat usage, int cpu) | 1003 | enum cpu_usage_stat usage, int cpu) |
| 1004 | { | 1004 | { |
| 1005 | u64 *cpustat = kcpustat->cpustat; | 1005 | u64 *cpustat = kcpustat->cpustat; |
| 1006 | u64 val = cpustat[usage]; | ||
| 1006 | struct rq *rq; | 1007 | struct rq *rq; |
| 1007 | u64 val; | ||
| 1008 | int err; | 1008 | int err; |
| 1009 | 1009 | ||
| 1010 | if (!vtime_accounting_enabled_cpu(cpu)) | 1010 | if (!vtime_accounting_enabled_cpu(cpu)) |
| 1011 | return cpustat[usage]; | 1011 | return val; |
| 1012 | 1012 | ||
| 1013 | rq = cpu_rq(cpu); | 1013 | rq = cpu_rq(cpu); |
| 1014 | 1014 | ||
| @@ -149,6 +149,9 @@ __setup("nohz_full=", housekeeping_nohz_full_setup); · 148 unmodified lines | |||
| 149 | static int __init housekeeping_isolcpus_setup(char *str) | 149 | static int __init housekeeping_isolcpus_setup(char *str) |
| 150 | { | 150 | { |
| 151 | unsigned int flags = 0; | 151 | unsigned int flags = 0; |
| 152 | bool illegal = false; | ||
| 153 | char *par; | ||
| 154 | int len; | ||
| 152 | 155 | ||
| 153 | while (isalpha(*str)) { | 156 | while (isalpha(*str)) { |
| 154 | if (!strncmp(str, "nohz,", 5)) { | 157 | if (!strncmp(str, "nohz,", 5)) { |
| @@ -169,8 +172,22 @@ static int __init housekeeping_isolcpus_setup(char *str) · 14 unmodified lines | |||
| 169 | continue; | 172 | continue; |
| 170 | } | 173 | } |
| 171 | 174 | ||
| 172 | pr_warn("isolcpus: Error, unknown flag\n"); | 175 | /* |
| 173 | return 0; | 176 | * Skip unknown sub-parameter and validate that it is not |
| 177 | * containing an invalid character. | ||
| 178 | */ | ||
| 179 | for (par = str, len = 0; *str && *str != ','; str++, len++) { | ||
| 180 | if (!isalpha(*str) && *str != '_') | ||
| 181 | illegal = true; | ||
| 182 | } | ||
| 183 | |||
| 184 | if (illegal) { | ||
| 185 | pr_warn("isolcpus: Invalid flag %.*s\n", len, par); | ||
| 186 | return 0; | ||
| 187 | } | ||
| 188 | |||
| 189 | pr_info("isolcpus: Skipped unknown flag %.*s\n", len, par); | ||
| 190 | str++; | ||
| 174 | } | 191 | } |
| 175 | 192 | ||
| 176 | /* Default behaviour for isolcpus without flags */ | 193 | /* Default behaviour for isolcpus without flags */ |
| @@ -1510,15 +1510,15 @@ int kill_pid_usb_asyncio(int sig, int errno, sigval_t addr, · 1509 unmodified lines | |||
| 1510 | unsigned long flags; | 1510 | unsigned long flags; |
| 1511 | int ret = -EINVAL; | 1511 | int ret = -EINVAL; |
| 1512 | 1512 | ||
| 1513 | if (!valid_signal(sig)) | ||
| 1514 | return ret; | ||
| 1515 | |||
| 1513 | clear_siginfo(&info); | 1516 | clear_siginfo(&info); |
| 1514 | info.si_signo = sig; | 1517 | info.si_signo = sig; |
| 1515 | info.si_errno = errno; | 1518 | info.si_errno = errno; |
| 1516 | info.si_code = SI_ASYNCIO; | 1519 | info.si_code = SI_ASYNCIO; |
| 1517 | *((sigval_t *)&info.si_pid) = addr; | 1520 | *((sigval_t *)&info.si_pid) = addr; |
| 1518 | 1521 | ||
| 1519 | if (!valid_signal(sig)) | ||
| 1520 | return ret; | ||
| 1521 | |||
| 1522 | rcu_read_lock(); | 1522 | rcu_read_lock(); |
| 1523 | p = pid_task(pid, PIDTYPE_PID); | 1523 | p = pid_task(pid, PIDTYPE_PID); |
| 1524 | if (!p) { | 1524 | if (!p) { |
| @@ -1557,12 +1557,8 @@ static int kill_something_info(int sig, struct kernel_siginfo *info, pid_t pid) · 32 unmodified lines | |||
| 1557 | { | 1557 | { |
| 1558 | int ret; | 1558 | int ret; |
| 1559 | 1559 | ||
| 1560 | if (pid > 0) { | 1560 | if (pid > 0) |
| 1561 | rcu_read_lock(); | 1561 | return kill_proc_info(sig, info, pid); |
| 1562 | ret = kill_pid_info(sig, info, find_vpid(pid)); | ||
| 1563 | rcu_read_unlock(); | ||
| 1564 | return ret; | ||
| 1565 | } | ||
| 1566 | 1562 | ||
| 1567 | /* -INT_MIN is undefined. Exclude this case to avoid a UBSAN warning */ | 1563 | /* -INT_MIN is undefined. Exclude this case to avoid a UBSAN warning */ |
| 1568 | if (pid == INT_MIN) | 1564 | if (pid == INT_MIN) |
| @@ -1993,8 +1989,12 @@ bool do_notify_parent(struct task_struct *tsk, int sig) · 424 unmodified lines | |||
| 1993 | if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN) | 1989 | if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN) |
| 1994 | sig = 0; | 1990 | sig = 0; |
| 1995 | } | 1991 | } |
| 1992 | /* | ||
| 1993 | * Send with __send_signal as si_pid and si_uid are in the | ||
| 1994 | * parent's namespaces. | ||
| 1995 | */ | ||
| 1996 | if (valid_signal(sig) && sig) | 1996 | if (valid_signal(sig) && sig) |
| 1997 | __group_send_sig_info(sig, &info, tsk->parent); | 1997 | __send_signal(sig, &info, tsk->parent, PIDTYPE_TGID, false); |
| 1998 | __wake_up_parent(tsk, tsk->parent); | 1998 | __wake_up_parent(tsk, tsk->parent); |
| 1999 | spin_unlock_irqrestore(&psig->siglock, flags); | 1999 | spin_unlock_irqrestore(&psig->siglock, flags); |
| 2000 | 2000 | ||
| @@ -338,7 +338,20 @@ static struct user_namespace *timens_owner(struct ns_common *ns) · 337 unmodified lines | |||
| 338 | 338 | ||
| 339 | static void show_offset(struct seq_file *m, int clockid, struct timespec64 *ts) | 339 | static void show_offset(struct seq_file *m, int clockid, struct timespec64 *ts) |
| 340 | { | 340 | { |
| 341 | seq_printf(m, "%d %lld %ld\n", clockid, ts->tv_sec, ts->tv_nsec); | 341 | char *clock; |
| 342 | |||
| 343 | switch (clockid) { | ||
| 344 | case CLOCK_BOOTTIME: | ||
| 345 | clock = "boottime"; | ||
| 346 | break; | ||
| 347 | case CLOCK_MONOTONIC: | ||
| 348 | clock = "monotonic"; | ||
| 349 | break; | ||
| 350 | default: | ||
| 351 | clock = "unknown"; | ||
| 352 | break; | ||
| 353 | } | ||
| 354 | seq_printf(m, "%-10s %10lld %9ld\n", clock, ts->tv_sec, ts->tv_nsec); | ||
| 342 | } | 355 | } |
| 343 | 356 | ||
| 344 | void proc_timens_show_offsets(struct task_struct *p, struct seq_file *m) | 357 | void proc_timens_show_offsets(struct task_struct *p, struct seq_file *m) |
| @@ -5165,6 +5165,7 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr) · 5164 unmodified lines | |||
| 5165 | list_del_rcu(&direct->next); | 5165 | list_del_rcu(&direct->next); |
| 5166 | synchronize_rcu_tasks(); | 5166 | synchronize_rcu_tasks(); |
| 5167 | kfree(direct); | 5167 | kfree(direct); |
| 5168 | kfree(entry); | ||
| 5168 | ftrace_direct_func_count--; | 5169 | ftrace_direct_func_count--; |
| 5169 | } | 5170 | } |
| 5170 | } | 5171 | } |
| @@ -3320,6 +3320,9 @@ static void __destroy_hist_field(struct hist_field *hist_field) · 3319 unmodified lines | |||
| 3320 | kfree(hist_field->name); | 3320 | kfree(hist_field->name); |
| 3321 | kfree(hist_field->type); | 3321 | kfree(hist_field->type); |
| 3322 | 3322 | ||
| 3323 | kfree(hist_field->system); | ||
| 3324 | kfree(hist_field->event_name); | ||
| 3325 | |||
| 3323 | kfree(hist_field); | 3326 | kfree(hist_field); |
| 3324 | } | 3327 | } |
| 3325 | 3328 | ||
| @@ -4382,6 +4385,7 @@ static struct hist_field *create_var(struct hist_trigger_data *hist_data, · 1056 unmodified lines | |||
| 4382 | goto out; | 4385 | goto out; |
| 4383 | } | 4386 | } |
| 4384 | 4387 | ||
| 4388 | var->ref = 1; | ||
| 4385 | var->flags = HIST_FIELD_FL_VAR; | 4389 | var->flags = HIST_FIELD_FL_VAR; |
| 4386 | var->var.idx = idx; | 4390 | var->var.idx = idx; |
| 4387 | var->var.hist_data = var->hist_data = hist_data; | 4391 | var->var.hist_data = var->hist_data = hist_data; |
| @@ -5011,6 +5015,9 @@ static void destroy_field_vars(struct hist_trigger_data *hist_data) · 623 unmodified lines | |||
| 5011 | 5015 | ||
| 5012 | for (i = 0; i < hist_data->n_field_vars; i++) | 5016 | for (i = 0; i < hist_data->n_field_vars; i++) |
| 5013 | destroy_field_var(hist_data->field_vars[i]); | 5017 | destroy_field_var(hist_data->field_vars[i]); |
| 5018 | |||
| 5019 | for (i = 0; i < hist_data->n_save_vars; i++) | ||
| 5020 | destroy_field_var(hist_data->save_vars[i]); | ||
| 5014 | } | 5021 | } |
| 5015 | 5022 | ||
| 5016 | static void save_field_var(struct hist_trigger_data *hist_data, | 5023 | static void save_field_var(struct hist_trigger_data *hist_data, |
| @@ -1088,14 +1088,10 @@ register_snapshot_trigger(char *glob, struct event_trigger_ops *ops, · 1087 unmodified lines | |||
| 1088 | struct event_trigger_data *data, | 1088 | struct event_trigger_data *data, |
| 1089 | struct trace_event_file *file) | 1089 | struct trace_event_file *file) |
| 1090 | { | 1090 | { |
| 1091 | int ret = register_trigger(glob, ops, data, file); | 1091 | if (tracing_alloc_snapshot_instance(file->tr) != 0) |
| 1092 | 1092 | return 0; | |
| 1093 | if (ret > 0 && tracing_alloc_snapshot_instance(file->tr) != 0) { | ||
| 1094 | unregister_trigger(glob, ops, data, file); | ||
| 1095 | ret = 0; | ||
| 1096 | } | ||
| 1097 | 1093 | ||
| 1098 | return ret; | 1094 | return register_trigger(glob, ops, data, file); |
| 1099 | } | 1095 | } |
| 1100 | 1096 | ||
| 1101 | static int | 1097 | static int |
| @@ -283,7 +283,7 @@ int tracing_map_add_key_field(struct tracing_map *map, · 282 unmodified lines | |||
| 283 | return idx; | 283 | return idx; |
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | void tracing_map_array_clear(struct tracing_map_array *a) | 286 | static void tracing_map_array_clear(struct tracing_map_array *a) |
| 287 | { | 287 | { |
| 288 | unsigned int i; | 288 | unsigned int i; |
| 289 | 289 | ||
| @@ -294,7 +294,7 @@ void tracing_map_array_clear(struct tracing_map_array *a) · 4 unmodified lines | |||
| 294 | memset(a->pages[i], 0, PAGE_SIZE); | 294 | memset(a->pages[i], 0, PAGE_SIZE); |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | void tracing_map_array_free(struct tracing_map_array *a) | 297 | static void tracing_map_array_free(struct tracing_map_array *a) |
| 298 | { | 298 | { |
| 299 | unsigned int i; | 299 | unsigned int i; |
| 300 | 300 | ||
| @@ -316,7 +316,7 @@ void tracing_map_array_free(struct tracing_map_array *a) · 15 unmodified lines | |||
| 316 | kfree(a); | 316 | kfree(a); |
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | struct tracing_map_array *tracing_map_array_alloc(unsigned int n_elts, | 319 | static struct tracing_map_array *tracing_map_array_alloc(unsigned int n_elts, |
| 320 | unsigned int entry_size) | 320 | unsigned int entry_size) |
| 321 | { | 321 | { |
| 322 | struct tracing_map_array *a; | 322 | struct tracing_map_array *a; |
| @@ -242,6 +242,8 @@ config DEBUG_INFO_DWARF4 · 241 unmodified lines | |||
| 242 | config DEBUG_INFO_BTF | 242 | config DEBUG_INFO_BTF |
| 243 | bool "Generate BTF typeinfo" | 243 | bool "Generate BTF typeinfo" |
| 244 | depends on DEBUG_INFO | 244 | depends on DEBUG_INFO |
| 245 | depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED | ||
| 246 | depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST | ||
| 245 | help | 247 | help |
| 246 | Generate deduplicated BTF type information from DWARF debug info. | 248 | Generate deduplicated BTF type information from DWARF debug info. |
| 247 | Turning this on expects presence of pahole tool, which will convert | 249 | Turning this on expects presence of pahole tool, which will convert |
| @@ -722,22 +722,22 @@ do { \ · 721 unmodified lines | |||
| 722 | do { \ | 722 | do { \ |
| 723 | if (__builtin_constant_p(bh) && (bh) == 0) \ | 723 | if (__builtin_constant_p(bh) && (bh) == 0) \ |
| 724 | __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \ | 724 | __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \ |
| 725 | : "=r" ((USItype)(sh)), \ | 725 | : "=r" (sh), \ |
| 726 | "=&r" ((USItype)(sl)) \ | 726 | "=&r" (sl) \ |
| 727 | : "%r" ((USItype)(ah)), \ | 727 | : "%r" ((USItype)(ah)), \ |
| 728 | "%r" ((USItype)(al)), \ | 728 | "%r" ((USItype)(al)), \ |
| 729 | "rI" ((USItype)(bl))); \ | 729 | "rI" ((USItype)(bl))); \ |
| 730 | else if (__builtin_constant_p(bh) && (bh) == ~(USItype) 0) \ | 730 | else if (__builtin_constant_p(bh) && (bh) == ~(USItype) 0) \ |
| 731 | __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \ | 731 | __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \ |
| 732 | : "=r" ((USItype)(sh)), \ | 732 | : "=r" (sh), \ |
| 733 | "=&r" ((USItype)(sl)) \ | 733 | "=&r" (sl) \ |
| 734 | : "%r" ((USItype)(ah)), \ | 734 | : "%r" ((USItype)(ah)), \ |
| 735 | "%r" ((USItype)(al)), \ | 735 | "%r" ((USItype)(al)), \ |
| 736 | "rI" ((USItype)(bl))); \ | 736 | "rI" ((USItype)(bl))); \ |
| 737 | else \ | 737 | else \ |
| 738 | __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \ | 738 | __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \ |
| 739 | : "=r" ((USItype)(sh)), \ | 739 | : "=r" (sh), \ |
| 740 | "=&r" ((USItype)(sl)) \ | 740 | "=&r" (sl) \ |
| 741 | : "%r" ((USItype)(ah)), \ | 741 | : "%r" ((USItype)(ah)), \ |
| 742 | "r" ((USItype)(bh)), \ | 742 | "r" ((USItype)(bh)), \ |
| 743 | "%r" ((USItype)(al)), \ | 743 | "%r" ((USItype)(al)), \ |
| @@ -747,36 +747,36 @@ do { \ · 3 unmodified lines | |||
| 747 | do { \ | 747 | do { \ |
| 748 | if (__builtin_constant_p(ah) && (ah) == 0) \ | 748 | if (__builtin_constant_p(ah) && (ah) == 0) \ |
| 749 | __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \ | 749 | __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \ |
| 750 | : "=r" ((USItype)(sh)), \ | 750 | : "=r" (sh), \ |
| 751 | "=&r" ((USItype)(sl)) \ | 751 | "=&r" (sl) \ |
| 752 | : "r" ((USItype)(bh)), \ | 752 | : "r" ((USItype)(bh)), \ |
| 753 | "rI" ((USItype)(al)), \ | 753 | "rI" ((USItype)(al)), \ |
| 754 | "r" ((USItype)(bl))); \ | 754 | "r" ((USItype)(bl))); \ |
| 755 | else if (__builtin_constant_p(ah) && (ah) == ~(USItype) 0) \ | 755 | else if (__builtin_constant_p(ah) && (ah) == ~(USItype) 0) \ |
| 756 | __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \ | 756 | __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \ |
| 757 | : "=r" ((USItype)(sh)), \ | 757 | : "=r" (sh), \ |
| 758 | "=&r" ((USItype)(sl)) \ | 758 | "=&r" (sl) \ |
| 759 | : "r" ((USItype)(bh)), \ | 759 | : "r" ((USItype)(bh)), \ |
| 760 | "rI" ((USItype)(al)), \ | 760 | "rI" ((USItype)(al)), \ |
| 761 | "r" ((USItype)(bl))); \ | 761 | "r" ((USItype)(bl))); \ |
| 762 | else if (__builtin_constant_p(bh) && (bh) == 0) \ | 762 | else if (__builtin_constant_p(bh) && (bh) == 0) \ |
| 763 | __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \ | 763 | __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \ |
| 764 | : "=r" ((USItype)(sh)), \ | 764 | : "=r" (sh), \ |
| 765 | "=&r" ((USItype)(sl)) \ | 765 | "=&r" (sl) \ |
| 766 | : "r" ((USItype)(ah)), \ | 766 | : "r" ((USItype)(ah)), \ |
| 767 | "rI" ((USItype)(al)), \ | 767 | "rI" ((USItype)(al)), \ |
| 768 | "r" ((USItype)(bl))); \ | 768 | "r" ((USItype)(bl))); \ |
| 769 | else if (__builtin_constant_p(bh) && (bh) == ~(USItype) 0) \ | 769 | else if (__builtin_constant_p(bh) && (bh) == ~(USItype) 0) \ |
| 770 | __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \ | 770 | __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \ |
| 771 | : "=r" ((USItype)(sh)), \ | 771 | : "=r" (sh), \ |
| 772 | "=&r" ((USItype)(sl)) \ | 772 | "=&r" (sl) \ |
| 773 | : "r" ((USItype)(ah)), \ | 773 | : "r" ((USItype)(ah)), \ |
| 774 | "rI" ((USItype)(al)), \ | 774 | "rI" ((USItype)(al)), \ |
| 775 | "r" ((USItype)(bl))); \ | 775 | "r" ((USItype)(bl))); \ |
| 776 | else \ | 776 | else \ |
| 777 | __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \ | 777 | __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \ |
| 778 | : "=r" ((USItype)(sh)), \ | 778 | : "=r" (sh), \ |
| 779 | "=&r" ((USItype)(sl)) \ | 779 | "=&r" (sl) \ |
| 780 | : "r" ((USItype)(ah)), \ | 780 | : "r" ((USItype)(ah)), \ |
| 781 | "r" ((USItype)(bh)), \ | 781 | "r" ((USItype)(bh)), \ |
| 782 | "rI" ((USItype)(al)), \ | 782 | "rI" ((USItype)(al)), \ |
| @@ -787,7 +787,7 @@ do { \ · 4 unmodified lines | |||
| 787 | do { \ | 787 | do { \ |
| 788 | USItype __m0 = (m0), __m1 = (m1); \ | 788 | USItype __m0 = (m0), __m1 = (m1); \ |
| 789 | __asm__ ("mulhwu %0,%1,%2" \ | 789 | __asm__ ("mulhwu %0,%1,%2" \ |
| 790 | : "=r" ((USItype) ph) \ | 790 | : "=r" (ph) \ |
| 791 | : "%r" (__m0), \ | 791 | : "%r" (__m0), \ |
| 792 | "r" (__m1)); \ | 792 | "r" (__m1)); \ |
| 793 | (pl) = __m0 * __m1; \ | 793 | (pl) = __m0 * __m1; \ |
| @@ -1088,7 +1088,7 @@ retry: · 1087 unmodified lines | |||
| 1088 | * potentially allocating memory. | 1088 | * potentially allocating memory. |
| 1089 | */ | 1089 | */ |
| 1090 | if (fatal_signal_pending(current)) { | 1090 | if (fatal_signal_pending(current)) { |
| 1091 | ret = -ERESTARTSYS; | 1091 | ret = -EINTR; |
| 1092 | goto out; | 1092 | goto out; |
| 1093 | } | 1093 | } |
| 1094 | cond_resched(); | 1094 | cond_resched(); |
| @@ -5365,8 +5365,8 @@ pte_t *huge_pte_offset(struct mm_struct *mm, · 5364 unmodified lines | |||
| 5365 | { | 5365 | { |
| 5366 | pgd_t *pgd; | 5366 | pgd_t *pgd; |
| 5367 | p4d_t *p4d; | 5367 | p4d_t *p4d; |
| 5368 | pud_t *pud; | 5368 | pud_t *pud, pud_entry; |
| 5369 | pmd_t *pmd; | 5369 | pmd_t *pmd, pmd_entry; |
| 5370 | 5370 | ||
| 5371 | pgd = pgd_offset(mm, addr); | 5371 | pgd = pgd_offset(mm, addr); |
| 5372 | if (!pgd_present(*pgd)) | 5372 | if (!pgd_present(*pgd)) |
| @@ -5376,17 +5376,19 @@ pte_t *huge_pte_offset(struct mm_struct *mm, · 3 unmodified lines | |||
| 5376 | return NULL; | 5376 | return NULL; |
| 5377 | 5377 | ||
| 5378 | pud = pud_offset(p4d, addr); | 5378 | pud = pud_offset(p4d, addr); |
| 5379 | if (sz != PUD_SIZE && pud_none(*pud)) | 5379 | pud_entry = READ_ONCE(*pud); |
| 5380 | if (sz != PUD_SIZE && pud_none(pud_entry)) | ||
| 5380 | return NULL; | 5381 | return NULL; |
| 5381 | /* hugepage or swap? */ | 5382 | /* hugepage or swap? */ |
| 5382 | if (pud_huge(*pud) || !pud_present(*pud)) | 5383 | if (pud_huge(pud_entry) || !pud_present(pud_entry)) |
| 5383 | return (pte_t *)pud; | 5384 | return (pte_t *)pud; |
| 5384 | 5385 | ||
| 5385 | pmd = pmd_offset(pud, addr); | 5386 | pmd = pmd_offset(pud, addr); |
| 5386 | if (sz != PMD_SIZE && pmd_none(*pmd)) | 5387 | pmd_entry = READ_ONCE(*pmd); |
| 5388 | if (sz != PMD_SIZE && pmd_none(pmd_entry)) | ||
| 5387 | return NULL; | 5389 | return NULL; |
| 5388 | /* hugepage or swap? */ | 5390 | /* hugepage or swap? */ |
| 5389 | if (pmd_huge(*pmd) || !pmd_present(*pmd)) | 5391 | if (pmd_huge(pmd_entry) || !pmd_present(pmd_entry)) |
| 5390 | return (pte_t *)pmd; | 5392 | return (pte_t *)pmd; |
| 5391 | 5393 | ||
| 5392 | return NULL; | 5394 | return NULL; |
| @@ -2112,8 +2112,16 @@ static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item) · 2111 unmodified lines | |||
| 2112 | 2112 | ||
| 2113 | down_read(&mm->mmap_sem); | 2113 | down_read(&mm->mmap_sem); |
| 2114 | vma = find_mergeable_vma(mm, rmap_item->address); | 2114 | vma = find_mergeable_vma(mm, rmap_item->address); |
| 2115 | err = try_to_merge_one_page(vma, page, | 2115 | if (vma) { |
| 2116 | ZERO_PAGE(rmap_item->address)); | 2116 | err = try_to_merge_one_page(vma, page, |
| 2117 | ZERO_PAGE(rmap_item->address)); | ||
| 2118 | } else { | ||
| 2119 | /* | ||
| 2120 | * If the vma is out of date, we do not need to | ||
| 2121 | * continue. | ||
| 2122 | */ | ||
| 2123 | err = 0; | ||
| 2124 | } | ||
| 2117 | up_read(&mm->mmap_sem); | 2125 | up_read(&mm->mmap_sem); |
| 2118 | /* | 2126 | /* |
| 2119 | * In case of failure, the page was not really empty, so we | 2127 | * In case of failure, the page was not really empty, so we |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | |||
| 27 | #include <linux/swapops.h> | 27 | #include <linux/swapops.h> |
| 28 | #include <linux/shmem_fs.h> | 28 | #include <linux/shmem_fs.h> |
| 29 | #include <linux/mmu_notifier.h> | 29 | #include <linux/mmu_notifier.h> |
| 30 | #include <linux/sched/mm.h> | ||
| 30 | 31 | ||
| 31 | #include <asm/tlb.h> | 32 | #include <asm/tlb.h> |
| 32 | 33 | ||
| @@ -1090,6 +1091,23 @@ int do_madvise(unsigned long start, size_t len_in, int behavior) · 1057 unmodified lines | |||
| 1090 | if (write) { | 1091 | if (write) { |
| 1091 | if (down_write_killable(¤t->mm->mmap_sem)) | 1092 | if (down_write_killable(¤t->mm->mmap_sem)) |
| 1092 | return -EINTR; | 1093 | return -EINTR; |
| 1094 | |||
| 1095 | /* | ||
| 1096 | * We may have stolen the mm from another process | ||
| 1097 | * that is undergoing core dumping. | ||
| 1098 | * | ||
| 1099 | * Right now that's io_ring, in the future it may | ||
| 1100 | * be remote process management and not "current" | ||
| 1101 | * at all. | ||
| 1102 | * | ||
| 1103 | * We need to fix core dumping to not do this, | ||
| 1104 | * but for now we have the mmget_still_valid() | ||
| 1105 | * model. | ||
| 1106 | */ | ||
| 1107 | if (!mmget_still_valid(current->mm)) { | ||
| 1108 | up_write(¤t->mm->mmap_sem); | ||
| 1109 | return -EINTR; | ||
| 1110 | } | ||
| 1093 | } else { | 1111 | } else { |
| 1094 | down_read(¤t->mm->mmap_sem); | 1112 | down_read(¤t->mm->mmap_sem); |
| 1095 | } | 1113 | } |
| @@ -413,9 +413,20 @@ static unsigned long move_vma(struct vm_area_struct *vma, · 412 unmodified lines | |||
| 413 | /* Always put back VM_ACCOUNT since we won't unmap */ | 413 | /* Always put back VM_ACCOUNT since we won't unmap */ |
| 414 | vma->vm_flags |= VM_ACCOUNT; | 414 | vma->vm_flags |= VM_ACCOUNT; |
| 415 | 415 | ||
| 416 | vm_acct_memory(vma_pages(new_vma)); | 416 | vm_acct_memory(new_len >> PAGE_SHIFT); |
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | /* | ||
| 420 | * VMAs can actually be merged back together in copy_vma | ||
| 421 | * calling merge_vma. This can happen with anonymous vmas | ||
| 422 | * which have not yet been faulted, so if we were to consider | ||
| 423 | * this VMA split we'll end up adding VM_ACCOUNT on the | ||
| 424 | * next VMA, which is completely unrelated if this VMA | ||
| 425 | * was re-merged. | ||
| 426 | */ | ||
| 427 | if (split && new_vma == vma) | ||
| 428 | split = 0; | ||
| 429 | |||
| 419 | /* We always clear VM_LOCKED[ONFAULT] on the old vma */ | 430 | /* We always clear VM_LOCKED[ONFAULT] on the old vma */ |
| 420 | vma->vm_flags &= VM_LOCKED_CLEAR_MASK; | 431 | vma->vm_flags &= VM_LOCKED_CLEAR_MASK; |
| 421 | 432 | ||
| @@ -952,7 +952,7 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend, · 951 unmodified lines | |||
| 952 | VM_BUG_ON_PAGE(PageWriteback(page), page); | 952 | VM_BUG_ON_PAGE(PageWriteback(page), page); |
| 953 | if (shmem_punch_compound(page, start, end)) | 953 | if (shmem_punch_compound(page, start, end)) |
| 954 | truncate_inode_page(mapping, page); | 954 | truncate_inode_page(mapping, page); |
| 955 | else { | 955 | else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) { |
| 956 | /* Wipe the page and don't get stuck */ | 956 | /* Wipe the page and don't get stuck */ |
| 957 | clear_highpage(page); | 957 | clear_highpage(page); |
| 958 | flush_dcache_page(page); | 958 | flush_dcache_page(page); |
| @@ -2179,7 +2179,11 @@ int shmem_lock(struct file *file, int lock, struct user_struct *user) · 1220 unmodified lines | |||
| 2179 | struct shmem_inode_info *info = SHMEM_I(inode); | 2179 | struct shmem_inode_info *info = SHMEM_I(inode); |
| 2180 | int retval = -ENOMEM; | 2180 | int retval = -ENOMEM; |
| 2181 | 2181 | ||
| 2182 | spin_lock_irq(&info->lock); | 2182 | /* |
| 2183 | * What serializes the accesses to info->flags? | ||
| 2184 | * ipc_lock_object() when called from shmctl_do_lock(), | ||
| 2185 | * no serialization needed when called from shm_destroy(). | ||
| 2186 | */ | ||
| 2183 | if (lock && !(info->flags & VM_LOCKED)) { | 2187 | if (lock && !(info->flags & VM_LOCKED)) { |
| 2184 | if (!user_shm_lock(inode->i_size, user)) | 2188 | if (!user_shm_lock(inode->i_size, user)) |
| 2185 | goto out_nomem; | 2189 | goto out_nomem; |
| @@ -2194,7 +2198,6 @@ int shmem_lock(struct file *file, int lock, struct user_struct *user) · 8 unmodified lines | |||
| 2194 | retval = 0; | 2198 | retval = 0; |
| 2195 | 2199 | ||
| 2196 | out_nomem: | 2200 | out_nomem: |
| 2197 | spin_unlock_irq(&info->lock); | ||
| 2198 | return retval; | 2201 | return retval; |
| 2199 | } | 2202 | } |
| 2200 | 2203 | ||
| @@ -2399,11 +2402,11 @@ static int shmem_mfill_atomic_pte(struct mm_struct *dst_mm, · 198 unmodified lines | |||
| 2399 | 2402 | ||
| 2400 | lru_cache_add_anon(page); | 2403 | lru_cache_add_anon(page); |
| 2401 | 2404 | ||
| 2402 | spin_lock(&info->lock); | 2405 | spin_lock_irq(&info->lock); |
| 2403 | info->alloced++; | 2406 | info->alloced++; |
| 2404 | inode->i_blocks += BLOCKS_PER_PAGE; | 2407 | inode->i_blocks += BLOCKS_PER_PAGE; |
| 2405 | shmem_recalc_inode(inode); | 2408 | shmem_recalc_inode(inode); |
| 2406 | spin_unlock(&info->lock); | 2409 | spin_unlock_irq(&info->lock); |
| 2407 | 2410 | ||
| 2408 | inc_mm_counter(dst_mm, mm_counter_file(page)); | 2411 | inc_mm_counter(dst_mm, mm_counter_file(page)); |
| 2409 | page_add_file_rmap(page, false); | 2412 | page_add_file_rmap(page, false); |
| @@ -3533,6 +3533,7 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order) · 3532 unmodified lines | |||
| 3533 | { | 3533 | { |
| 3534 | slab_flags_t flags = s->flags; | 3534 | slab_flags_t flags = s->flags; |
| 3535 | unsigned int size = s->object_size; | 3535 | unsigned int size = s->object_size; |
| 3536 | unsigned int freepointer_area; | ||
| 3536 | unsigned int order; | 3537 | unsigned int order; |
| 3537 | 3538 | ||
| 3538 | /* | 3539 | /* |
| @@ -3541,6 +3542,13 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order) · 2 unmodified lines | |||
| 3541 | * the possible location of the free pointer. | 3542 | * the possible location of the free pointer. |
| 3542 | */ | 3543 | */ |
| 3543 | size = ALIGN(size, sizeof(void *)); | 3544 | size = ALIGN(size, sizeof(void *)); |
| 3545 | /* | ||
| 3546 | * This is the area of the object where a freepointer can be | ||
| 3547 | * safely written. If redzoning adds more to the inuse size, we | ||
| 3548 | * can't use that portion for writing the freepointer, so | ||
| 3549 | * s->offset must be limited within this for the general case. | ||
| 3550 | */ | ||
| 3551 | freepointer_area = size; | ||
| 3544 | 3552 | ||
| 3545 | #ifdef CONFIG_SLUB_DEBUG | 3553 | #ifdef CONFIG_SLUB_DEBUG |
| 3546 | /* | 3554 | /* |
| @@ -3582,13 +3590,13 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order) · 35 unmodified lines | |||
| 3582 | */ | 3590 | */ |
| 3583 | s->offset = size; | 3591 | s->offset = size; |
| 3584 | size += sizeof(void *); | 3592 | size += sizeof(void *); |
| 3585 | } else if (size > sizeof(void *)) { | 3593 | } else if (freepointer_area > sizeof(void *)) { |
| 3586 | /* | 3594 | /* |
| 3587 | * Store freelist pointer near middle of object to keep | 3595 | * Store freelist pointer near middle of object to keep |
| 3588 | * it away from the edges of the object to avoid small | 3596 | * it away from the edges of the object to avoid small |
| 3589 | * sized over/underflows from neighboring allocations. | 3597 | * sized over/underflows from neighboring allocations. |
| 3590 | */ | 3598 | */ |
| 3591 | s->offset = ALIGN(size / 2, sizeof(void *)); | 3599 | s->offset = ALIGN(freepointer_area / 2, sizeof(void *)); |
| 3592 | } | 3600 | } |
| 3593 | 3601 | ||
| 3594 | #ifdef CONFIG_SLUB_DEBUG | 3602 | #ifdef CONFIG_SLUB_DEBUG |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | |||
| 34 | #include <linux/llist.h> | 34 | #include <linux/llist.h> |
| 35 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
| 36 | #include <linux/rbtree_augmented.h> | 36 | #include <linux/rbtree_augmented.h> |
| 37 | #include <linux/overflow.h> | ||
| 37 | 38 | ||
| 38 | #include <linux/uaccess.h> | 39 | #include <linux/uaccess.h> |
| 39 | #include <asm/tlbflush.h> | 40 | #include <asm/tlbflush.h> |
| @@ -3054,6 +3055,7 @@ finished: · 3014 unmodified lines | |||
| 3054 | * @vma: vma to cover | 3055 | * @vma: vma to cover |
| 3055 | * @uaddr: target user address to start at | 3056 | * @uaddr: target user address to start at |
| 3056 | * @kaddr: virtual address of vmalloc kernel memory | 3057 | * @kaddr: virtual address of vmalloc kernel memory |
| 3058 | * @pgoff: offset from @kaddr to start at | ||
| 3057 | * @size: size of map area | 3059 | * @size: size of map area |
| 3058 | * | 3060 | * |
| 3059 | * Returns: 0 for success, -Exxx on failure | 3061 | * Returns: 0 for success, -Exxx on failure |
| @@ -3066,9 +3068,15 @@ finished: · 6 unmodified lines | |||
| 3066 | * Similar to remap_pfn_range() (see mm/memory.c) | 3068 | * Similar to remap_pfn_range() (see mm/memory.c) |
| 3067 | */ | 3069 | */ |
| 3068 | int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr, | 3070 | int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr, |
| 3069 | void *kaddr, unsigned long size) | 3071 | void *kaddr, unsigned long pgoff, |
| 3072 | unsigned long size) | ||
| 3070 | { | 3073 | { |
| 3071 | struct vm_struct *area; | 3074 | struct vm_struct *area; |
| 3075 | unsigned long off; | ||
| 3076 | unsigned long end_index; | ||
| 3077 | |||
| 3078 | if (check_shl_overflow(pgoff, PAGE_SHIFT, &off)) | ||
| 3079 | return -EINVAL; | ||
| 3072 | 3080 | ||
| 3073 | size = PAGE_ALIGN(size); | 3081 | size = PAGE_ALIGN(size); |
| 3074 | 3082 | ||
| @@ -3082,8 +3090,10 @@ int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr, · 7 unmodified lines | |||
| 3082 | if (!(area->flags & (VM_USERMAP | VM_DMA_COHERENT))) | 3090 | if (!(area->flags & (VM_USERMAP | VM_DMA_COHERENT))) |
| 3083 | return -EINVAL; | 3091 | return -EINVAL; |
| 3084 | 3092 | ||
| 3085 | if (kaddr + size > area->addr + get_vm_area_size(area)) | 3093 | if (check_add_overflow(size, off, &end_index) || |
| 3094 | end_index > get_vm_area_size(area)) | ||
| 3086 | return -EINVAL; | 3095 | return -EINVAL; |
| 3096 | kaddr += off; | ||
| 3087 | 3097 | ||
| 3088 | do { | 3098 | do { |
| 3089 | struct page *page = vmalloc_to_page(kaddr); | 3099 | struct page *page = vmalloc_to_page(kaddr); |
| @@ -3122,7 +3132,7 @@ int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, · 32 unmodified lines | |||
| 3122 | unsigned long pgoff) | 3132 | unsigned long pgoff) |
| 3123 | { | 3133 | { |
| 3124 | return remap_vmalloc_range_partial(vma, vma->vm_start, | 3134 | return remap_vmalloc_range_partial(vma, vma->vm_start, |
| 3125 | addr + (pgoff << PAGE_SHIFT), | 3135 | addr, pgoff, |
| 3126 | vma->vm_end - vma->vm_start); | 3136 | vma->vm_end - vma->vm_start); |
| 3127 | } | 3137 | } |
| 3128 | EXPORT_SYMBOL(remap_vmalloc_range); | 3138 | EXPORT_SYMBOL(remap_vmalloc_range); |
| @@ -4140,7 +4140,8 @@ EXPORT_SYMBOL(netdev_max_backlog); · 4139 unmodified lines | |||
| 4140 | 4140 | ||
| 4141 | int netdev_tstamp_prequeue __read_mostly = 1; | 4141 | int netdev_tstamp_prequeue __read_mostly = 1; |
| 4142 | int netdev_budget __read_mostly = 300; | 4142 | int netdev_budget __read_mostly = 300; |
| 4143 | unsigned int __read_mostly netdev_budget_usecs = 2000; | 4143 | /* Must be at least 2 jiffes to guarantee 1 jiffy timeout */ |
| 4144 | unsigned int __read_mostly netdev_budget_usecs = 2 * USEC_PER_SEC / HZ; | ||
| 4144 | int weight_p __read_mostly = 64; /* old backlog weight */ | 4145 | int weight_p __read_mostly = 64; /* old backlog weight */ |
| 4145 | int dev_weight_rx_bias __read_mostly = 1; /* bias for backlog weight */ | 4146 | int dev_weight_rx_bias __read_mostly = 1; /* bias for backlog weight */ |
| 4146 | int dev_weight_tx_bias __read_mostly = 1; /* bias for output_queue quota */ | 4147 | int dev_weight_tx_bias __read_mostly = 1; /* bias for output_queue quota */ |
| @@ -8666,8 +8667,8 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, · 4519 unmodified lines | |||
| 8666 | const struct net_device_ops *ops = dev->netdev_ops; | 8667 | const struct net_device_ops *ops = dev->netdev_ops; |
| 8667 | enum bpf_netdev_command query; | 8668 | enum bpf_netdev_command query; |
| 8668 | u32 prog_id, expected_id = 0; | 8669 | u32 prog_id, expected_id = 0; |
| 8669 | struct bpf_prog *prog = NULL; | ||
| 8670 | bpf_op_t bpf_op, bpf_chk; | 8670 | bpf_op_t bpf_op, bpf_chk; |
| 8671 | struct bpf_prog *prog; | ||
| 8671 | bool offload; | 8672 | bool offload; |
| 8672 | int err; | 8673 | int err; |
| 8673 | 8674 | ||
| @@ -8733,6 +8734,7 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, · 59 unmodified lines | |||
| 8733 | } else { | 8734 | } else { |
| 8734 | if (!prog_id) | 8735 | if (!prog_id) |
| 8735 | return 0; | 8736 | return 0; |
| 8737 | prog = NULL; | ||
| 8736 | } | 8738 | } |
| 8737 | 8739 | ||
| 8738 | err = dev_xdp_install(dev, bpf_op, extack, flags, prog); | 8740 | err = dev_xdp_install(dev, bpf_op, extack, flags, prog); |
| @@ -5925,7 +5925,7 @@ BPF_CALL_3(bpf_sk_assign, struct sk_buff *, skb, struct sock *, sk, u64, flags) · 5924 unmodified lines | |||
| 5925 | return -EOPNOTSUPP; | 5925 | return -EOPNOTSUPP; |
| 5926 | if (unlikely(dev_net(skb->dev) != sock_net(sk))) | 5926 | if (unlikely(dev_net(skb->dev) != sock_net(sk))) |
| 5927 | return -ENETUNREACH; | 5927 | return -ENETUNREACH; |
| 5928 | if (unlikely(sk->sk_reuseport)) | 5928 | if (unlikely(sk_fullsock(sk) && sk->sk_reuseport)) |
| 5929 | return -ESOCKTNOSUPPORT; | 5929 | return -ESOCKTNOSUPPORT; |
| 5930 | if (sk_is_refcounted(sk) && | 5930 | if (sk_is_refcounted(sk) && |
| 5931 | unlikely(!refcount_inc_not_zero(&sk->sk_refcnt))) | 5931 | unlikely(!refcount_inc_not_zero(&sk->sk_refcnt))) |
| @@ -80,7 +80,7 @@ static ssize_t netdev_store(struct device *dev, struct device_attribute *attr, · 79 unmodified lines | |||
| 80 | struct net_device *netdev = to_net_dev(dev); | 80 | struct net_device *netdev = to_net_dev(dev); |
| 81 | struct net *net = dev_net(netdev); | 81 | struct net *net = dev_net(netdev); |
| 82 | unsigned long new; | 82 | unsigned long new; |
| 83 | int ret = -EINVAL; | 83 | int ret; |
| 84 | 84 | ||
| 85 | if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) | 85 | if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) |
| 86 | return -EPERM; | 86 | return -EPERM; |
| @@ -127,10 +127,8 @@ static int write_classid(struct cgroup_subsys_state *css, struct cftype *cft, · 126 unmodified lines | |||
| 127 | cs->classid = (u32)value; | 127 | cs->classid = (u32)value; |
| 128 | 128 | ||
| 129 | css_task_iter_start(css, 0, &it); | 129 | css_task_iter_start(css, 0, &it); |
| 130 | while ((p = css_task_iter_next(&it))) { | 130 | while ((p = css_task_iter_next(&it))) |
| 131 | update_classid_task(p, cs->classid); | 131 | update_classid_task(p, cs->classid); |
| 132 | cond_resched(); | ||
| 133 | } | ||
| 134 | css_task_iter_end(&it); | 132 | css_task_iter_end(&it); |
| 135 | 133 | ||
| 136 | return 0; | 134 | return 0; |
| @@ -1872,7 +1872,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) · 1871 unmodified lines | |||
| 1872 | * as not suitable for copying when cloning. | 1872 | * as not suitable for copying when cloning. |
| 1873 | */ | 1873 | */ |
| 1874 | if (sk_user_data_is_nocopy(newsk)) | 1874 | if (sk_user_data_is_nocopy(newsk)) |
| 1875 | RCU_INIT_POINTER(newsk->sk_user_data, NULL); | 1875 | newsk->sk_user_data = NULL; |
| 1876 | 1876 | ||
| 1877 | newsk->sk_err = 0; | 1877 | newsk->sk_err = 0; |
| 1878 | newsk->sk_err_soft = 0; | 1878 | newsk->sk_err_soft = 0; |
| @@ -670,11 +670,16 @@ int dsa_port_link_register_of(struct dsa_port *dp) · 669 unmodified lines | |||
| 670 | { | 670 | { |
| 671 | struct dsa_switch *ds = dp->ds; | 671 | struct dsa_switch *ds = dp->ds; |
| 672 | struct device_node *phy_np; | 672 | struct device_node *phy_np; |
| 673 | int port = dp->index; | ||
| 673 | 674 | ||
| 674 | if (!ds->ops->adjust_link) { | 675 | if (!ds->ops->adjust_link) { |
| 675 | phy_np = of_parse_phandle(dp->dn, "phy-handle", 0); | 676 | phy_np = of_parse_phandle(dp->dn, "phy-handle", 0); |
| 676 | if (of_phy_is_fixed_link(dp->dn) || phy_np) | 677 | if (of_phy_is_fixed_link(dp->dn) || phy_np) { |
| 678 | if (ds->ops->phylink_mac_link_down) | ||
| 679 | ds->ops->phylink_mac_link_down(ds, port, | ||
| 680 | MLO_AN_FIXED, PHY_INTERFACE_MODE_NA); | ||
| 677 | return dsa_port_phylink_register(dp); | 681 | return dsa_port_phylink_register(dp); |
| 682 | } | ||
| 678 | return 0; | 683 | return 0; |
| 679 | } | 684 | } |
| 680 | 685 | ||
| @@ -1770,11 +1770,9 @@ int dsa_slave_create(struct dsa_port *port) · 1769 unmodified lines | |||
| 1770 | rtnl_lock(); | 1770 | rtnl_lock(); |
| 1771 | ret = dsa_slave_change_mtu(slave_dev, ETH_DATA_LEN); | 1771 | ret = dsa_slave_change_mtu(slave_dev, ETH_DATA_LEN); |
| 1772 | rtnl_unlock(); | 1772 | rtnl_unlock(); |
| 1773 | if (ret && ret != -EOPNOTSUPP) { | 1773 | if (ret) |
| 1774 | dev_err(ds->dev, "error %d setting MTU on port %d\n", | 1774 | dev_warn(ds->dev, "nonfatal error %d setting MTU on port %d\n", |
| 1775 | ret, port->index); | 1775 | ret, port->index); |
| 1776 | goto out_free; | ||
| 1777 | } | ||
| 1778 | 1776 | ||
| 1779 | netif_carrier_off(slave_dev); | 1777 | netif_carrier_off(slave_dev); |
| 1780 | 1778 | ||
| @@ -69,10 +69,16 @@ static int hsr_newlink(struct net *src_net, struct net_device *dev, · 68 unmodified lines | |||
| 69 | else | 69 | else |
| 70 | multicast_spec = nla_get_u8(data[IFLA_HSR_MULTICAST_SPEC]); | 70 | multicast_spec = nla_get_u8(data[IFLA_HSR_MULTICAST_SPEC]); |
| 71 | 71 | ||
| 72 | if (!data[IFLA_HSR_VERSION]) | 72 | if (!data[IFLA_HSR_VERSION]) { |
| 73 | hsr_version = 0; | 73 | hsr_version = 0; |
| 74 | else | 74 | } else { |
| 75 | hsr_version = nla_get_u8(data[IFLA_HSR_VERSION]); | 75 | hsr_version = nla_get_u8(data[IFLA_HSR_VERSION]); |
| 76 | if (hsr_version > 1) { | ||
| 77 | NL_SET_ERR_MSG_MOD(extack, | ||
| 78 | "Only versions 0..1 are supported"); | ||
| 79 | return -EINVAL; | ||
| 80 | } | ||
| 81 | } | ||
| 76 | 82 | ||
| 77 | return hsr_dev_finalize(dev, link, multicast_spec, hsr_version, extack); | 83 | return hsr_dev_finalize(dev, link, multicast_spec, hsr_version, extack); |
| 78 | } | 84 | } |
| @@ -614,12 +614,15 @@ struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, · 613 unmodified lines | |||
| 614 | return NULL; | 614 | return NULL; |
| 615 | } | 615 | } |
| 616 | 616 | ||
| 617 | static int ip_mc_config(struct sock *sk, bool join, const struct in_ifaddr *ifa) | 617 | static int ip_mc_autojoin_config(struct net *net, bool join, |
| 618 | const struct in_ifaddr *ifa) | ||
| 618 | { | 619 | { |
| 620 | #if defined(CONFIG_IP_MULTICAST) | ||
| 619 | struct ip_mreqn mreq = { | 621 | struct ip_mreqn mreq = { |
| 620 | .imr_multiaddr.s_addr = ifa->ifa_address, | 622 | .imr_multiaddr.s_addr = ifa->ifa_address, |
| 621 | .imr_ifindex = ifa->ifa_dev->dev->ifindex, | 623 | .imr_ifindex = ifa->ifa_dev->dev->ifindex, |
| 622 | }; | 624 | }; |
| 625 | struct sock *sk = net->ipv4.mc_autojoin_sk; | ||
| 623 | int ret; | 626 | int ret; |
| 624 | 627 | ||
| 625 | ASSERT_RTNL(); | 628 | ASSERT_RTNL(); |
| @@ -632,6 +635,9 @@ static int ip_mc_config(struct sock *sk, bool join, const struct in_ifaddr *ifa) · 6 unmodified lines | |||
| 632 | release_sock(sk); | 635 | release_sock(sk); |
| 633 | 636 | ||
| 634 | return ret; | 637 | return ret; |
| 638 | #else | ||
| 639 | return -EOPNOTSUPP; | ||
| 640 | #endif | ||
| 635 | } | 641 | } |
| 636 | 642 | ||
| 637 | static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, | 643 | static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, |
| @@ -675,7 +681,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, · 37 unmodified lines | |||
| 675 | continue; | 681 | continue; |
| 676 | 682 | ||
| 677 | if (ipv4_is_multicast(ifa->ifa_address)) | 683 | if (ipv4_is_multicast(ifa->ifa_address)) |
| 678 | ip_mc_config(net->ipv4.mc_autojoin_sk, false, ifa); | 684 | ip_mc_autojoin_config(net, false, ifa); |
| 679 | __inet_del_ifa(in_dev, ifap, 1, nlh, NETLINK_CB(skb).portid); | 685 | __inet_del_ifa(in_dev, ifap, 1, nlh, NETLINK_CB(skb).portid); |
| 680 | return 0; | 686 | return 0; |
| 681 | } | 687 | } |
| @@ -940,8 +946,7 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, · 258 unmodified lines | |||
| 940 | */ | 946 | */ |
| 941 | set_ifa_lifetime(ifa, valid_lft, prefered_lft); | 947 | set_ifa_lifetime(ifa, valid_lft, prefered_lft); |
| 942 | if (ifa->ifa_flags & IFA_F_MCAUTOJOIN) { | 948 | if (ifa->ifa_flags & IFA_F_MCAUTOJOIN) { |
| 943 | int ret = ip_mc_config(net->ipv4.mc_autojoin_sk, | 949 | int ret = ip_mc_autojoin_config(net, true, ifa); |
| 944 | true, ifa); | ||
| 945 | 950 | ||
| 946 | if (ret < 0) { | 951 | if (ret < 0) { |
| 947 | inet_free_ifa(ifa); | 952 | inet_free_ifa(ifa); |
| @@ -2014,7 +2014,7 @@ static void fib_select_default(const struct flowi4 *flp, struct fib_result *res) · 2013 unmodified lines | |||
| 2014 | 2014 | ||
| 2015 | hlist_for_each_entry_rcu(fa, fa_head, fa_list) { | 2015 | hlist_for_each_entry_rcu(fa, fa_head, fa_list) { |
| 2016 | struct fib_info *next_fi = fa->fa_info; | 2016 | struct fib_info *next_fi = fa->fa_info; |
| 2017 | struct fib_nh *nh; | 2017 | struct fib_nh_common *nhc; |
| 2018 | 2018 | ||
| 2019 | if (fa->fa_slen != slen) | 2019 | if (fa->fa_slen != slen) |
| 2020 | continue; | 2020 | continue; |
| @@ -2037,8 +2037,8 @@ static void fib_select_default(const struct flowi4 *flp, struct fib_result *res) · 16 unmodified lines | |||
| 2037 | fa->fa_type != RTN_UNICAST) | 2037 | fa->fa_type != RTN_UNICAST) |
| 2038 | continue; | 2038 | continue; |
| 2039 | 2039 | ||
| 2040 | nh = fib_info_nh(next_fi, 0); | 2040 | nhc = fib_info_nhc(next_fi, 0); |
| 2041 | if (!nh->fib_nh_gw4 || nh->fib_nh_scope != RT_SCOPE_LINK) | 2041 | if (!nhc->nhc_gw_family || nhc->nhc_scope != RT_SCOPE_LINK) |
| 2042 | continue; | 2042 | continue; |
| 2043 | 2043 | ||
| 2044 | fib_alias_accessed(fa); | 2044 | fib_alias_accessed(fa); |
| @@ -58,9 +58,7 @@ int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb) · 57 unmodified lines | |||
| 58 | { | 58 | { |
| 59 | memset(IPCB(skb), 0, sizeof(*IPCB(skb))); | 59 | memset(IPCB(skb), 0, sizeof(*IPCB(skb))); |
| 60 | 60 | ||
| 61 | #ifdef CONFIG_NETFILTER | ||
| 62 | IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED; | 61 | IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED; |
| 63 | #endif | ||
| 64 | 62 | ||
| 65 | return xfrm_output(sk, skb); | 63 | return xfrm_output(sk, skb); |
| 66 | } | 64 | } |
| @@ -229,6 +229,25 @@ static bool icmpv6_xrlim_allow(struct sock *sk, u8 type, · 228 unmodified lines | |||
| 229 | return res; | 229 | return res; |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | static bool icmpv6_rt_has_prefsrc(struct sock *sk, u8 type, | ||
| 233 | struct flowi6 *fl6) | ||
| 234 | { | ||
| 235 | struct net *net = sock_net(sk); | ||
| 236 | struct dst_entry *dst; | ||
| 237 | bool res = false; | ||
| 238 | |||
| 239 | dst = ip6_route_output(net, sk, fl6); | ||
| 240 | if (!dst->error) { | ||
| 241 | struct rt6_info *rt = (struct rt6_info *)dst; | ||
| 242 | struct in6_addr prefsrc; | ||
| 243 | |||
| 244 | rt6_get_prefsrc(rt, &prefsrc); | ||
| 245 | res = !ipv6_addr_any(&prefsrc); | ||
| 246 | } | ||
| 247 | dst_release(dst); | ||
| 248 | return res; | ||
| 249 | } | ||
| 250 | |||
| 232 | /* | 251 | /* |
| 233 | * an inline helper for the "simple" if statement below | 252 | * an inline helper for the "simple" if statement below |
| 234 | * checks if parameter problem report is caused by an | 253 | * checks if parameter problem report is caused by an |
| @@ -527,7 +546,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, · 292 unmodified lines | |||
| 527 | saddr = force_saddr; | 546 | saddr = force_saddr; |
| 528 | if (saddr) { | 547 | if (saddr) { |
| 529 | fl6.saddr = *saddr; | 548 | fl6.saddr = *saddr; |
| 530 | } else { | 549 | } else if (!icmpv6_rt_has_prefsrc(sk, type, &fl6)) { |
| 531 | /* select a more meaningful saddr from input if */ | 550 | /* select a more meaningful saddr from input if */ |
| 532 | struct net_device *in_netdev; | 551 | struct net_device *in_netdev; |
| 533 | 552 | ||
| @@ -183,15 +183,14 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, · 182 unmodified lines | |||
| 183 | retv = -EBUSY; | 183 | retv = -EBUSY; |
| 184 | break; | 184 | break; |
| 185 | } | 185 | } |
| 186 | } else if (sk->sk_protocol == IPPROTO_TCP) { | 186 | } |
| 187 | if (sk->sk_prot != &tcpv6_prot) { | 187 | if (sk->sk_protocol == IPPROTO_TCP && |
| 188 | retv = -EBUSY; | 188 | sk->sk_prot != &tcpv6_prot) { |
| 189 | break; | 189 | retv = -EBUSY; |
| 190 | } | ||
| 191 | break; | ||
| 192 | } else { | ||
| 193 | break; | 190 | break; |
| 194 | } | 191 | } |
| 192 | if (sk->sk_protocol != IPPROTO_TCP) | ||
| 193 | break; | ||
| 195 | if (sk->sk_state != TCP_ESTABLISHED) { | 194 | if (sk->sk_state != TCP_ESTABLISHED) { |
| 196 | retv = -ENOTCONN; | 195 | retv = -ENOTCONN; |
| 197 | break; | 196 | break; |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | |||
| 8 | #include <net/rpl.h> | 8 | #include <net/rpl.h> |
| 9 | 9 | ||
| 10 | #define IPV6_PFXTAIL_LEN(x) (sizeof(struct in6_addr) - (x)) | 10 | #define IPV6_PFXTAIL_LEN(x) (sizeof(struct in6_addr) - (x)) |
| 11 | #define IPV6_RPL_BEST_ADDR_COMPRESSION 15 | ||
| 11 | 12 | ||
| 12 | static void ipv6_rpl_addr_decompress(struct in6_addr *dst, | 13 | static void ipv6_rpl_addr_decompress(struct in6_addr *dst, |
| 13 | const struct in6_addr *daddr, | 14 | const struct in6_addr *daddr, |
| @@ -73,7 +74,7 @@ static unsigned char ipv6_rpl_srh_calc_cmpri(const struct ipv6_rpl_sr_hdr *inhdr · 59 unmodified lines | |||
| 73 | } | 74 | } |
| 74 | } | 75 | } |
| 75 | 76 | ||
| 76 | return plen; | 77 | return IPV6_RPL_BEST_ADDR_COMPRESSION; |
| 77 | } | 78 | } |
| 78 | 79 | ||
| 79 | static unsigned char ipv6_rpl_srh_calc_cmpre(const struct in6_addr *daddr, | 80 | static unsigned char ipv6_rpl_srh_calc_cmpre(const struct in6_addr *daddr, |
| @@ -83,10 +84,10 @@ static unsigned char ipv6_rpl_srh_calc_cmpre(const struct in6_addr *daddr, · 3 unmodified lines | |||
| 83 | 84 | ||
| 84 | for (plen = 0; plen < sizeof(*daddr); plen++) { | 85 | for (plen = 0; plen < sizeof(*daddr); plen++) { |
| 85 | if (daddr->s6_addr[plen] != last_segment->s6_addr[plen]) | 86 | if (daddr->s6_addr[plen] != last_segment->s6_addr[plen]) |
| 86 | break; | 87 | return plen; |
| 87 | } | 88 | } |
| 88 | 89 | ||
| 89 | return plen; | 90 | return IPV6_RPL_BEST_ADDR_COMPRESSION; |
| 90 | } | 91 | } |
| 91 | 92 | ||
| 92 | void ipv6_rpl_srh_compress(struct ipv6_rpl_sr_hdr *outhdr, | 93 | void ipv6_rpl_srh_compress(struct ipv6_rpl_sr_hdr *outhdr, |
| @@ -434,7 +434,7 @@ static struct genl_family seg6_genl_family __ro_after_init = { · 433 unmodified lines | |||
| 434 | 434 | ||
| 435 | int __init seg6_init(void) | 435 | int __init seg6_init(void) |
| 436 | { | 436 | { |
| 437 | int err = -ENOMEM; | 437 | int err; |
| 438 | 438 | ||
| 439 | err = genl_register_family(&seg6_genl_family); | 439 | err = genl_register_family(&seg6_genl_family); |
| 440 | if (err) | 440 | if (err) |
| @@ -111,9 +111,7 @@ int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb) · 110 unmodified lines | |||
| 111 | { | 111 | { |
| 112 | memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); | 112 | memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); |
| 113 | 113 | ||
| 114 | #ifdef CONFIG_NETFILTER | ||
| 115 | IP6CB(skb)->flags |= IP6SKB_XFRM_TRANSFORMED; | 114 | IP6CB(skb)->flags |= IP6SKB_XFRM_TRANSFORMED; |
| 116 | #endif | ||
| 117 | 115 | ||
| 118 | return xfrm_output(sk, skb); | 116 | return xfrm_output(sk, skb); |
| 119 | } | 117 | } |
| @@ -920,51 +920,51 @@ static const struct genl_ops l2tp_nl_ops[] = { · 919 unmodified lines | |||
| 920 | .cmd = L2TP_CMD_TUNNEL_CREATE, | 920 | .cmd = L2TP_CMD_TUNNEL_CREATE, |
| 921 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | 921 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
| 922 | .doit = l2tp_nl_cmd_tunnel_create, | 922 | .doit = l2tp_nl_cmd_tunnel_create, |
| 923 | .flags = GENL_ADMIN_PERM, | 923 | .flags = GENL_UNS_ADMIN_PERM, |
| 924 | }, | 924 | }, |
| 925 | { | 925 | { |
| 926 | .cmd = L2TP_CMD_TUNNEL_DELETE, | 926 | .cmd = L2TP_CMD_TUNNEL_DELETE, |
| 927 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | 927 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
| 928 | .doit = l2tp_nl_cmd_tunnel_delete, | 928 | .doit = l2tp_nl_cmd_tunnel_delete, |
| 929 | .flags = GENL_ADMIN_PERM, | 929 | .flags = GENL_UNS_ADMIN_PERM, |
| 930 | }, | 930 | }, |
| 931 | { | 931 | { |
| 932 | .cmd = L2TP_CMD_TUNNEL_MODIFY, | 932 | .cmd = L2TP_CMD_TUNNEL_MODIFY, |
| 933 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | 933 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
| 934 | .doit = l2tp_nl_cmd_tunnel_modify, | 934 | .doit = l2tp_nl_cmd_tunnel_modify, |
| 935 | .flags = GENL_ADMIN_PERM, | 935 | .flags = GENL_UNS_ADMIN_PERM, |
| 936 | }, | 936 | }, |
| 937 | { | 937 | { |
| 938 | .cmd = L2TP_CMD_TUNNEL_GET, | 938 | .cmd = L2TP_CMD_TUNNEL_GET, |
| 939 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | 939 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
| 940 | .doit = l2tp_nl_cmd_tunnel_get, | 940 | .doit = l2tp_nl_cmd_tunnel_get, |
| 941 | .dumpit = l2tp_nl_cmd_tunnel_dump, | 941 | .dumpit = l2tp_nl_cmd_tunnel_dump, |
| 942 | .flags = GENL_ADMIN_PERM, | 942 | .flags = GENL_UNS_ADMIN_PERM, |
| 943 | }, | 943 | }, |
| 944 | { | 944 | { |
| 945 | .cmd = L2TP_CMD_SESSION_CREATE, | 945 | .cmd = L2TP_CMD_SESSION_CREATE, |
| 946 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | 946 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
| 947 | .doit = l2tp_nl_cmd_session_create, | 947 | .doit = l2tp_nl_cmd_session_create, |
| 948 | .flags = GENL_ADMIN_PERM, | 948 | .flags = GENL_UNS_ADMIN_PERM, |
| 949 | }, | 949 | }, |
| 950 | { | 950 | { |
| 951 | .cmd = L2TP_CMD_SESSION_DELETE, | 951 | .cmd = L2TP_CMD_SESSION_DELETE, |
| 952 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | 952 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
| 953 | .doit = l2tp_nl_cmd_session_delete, | 953 | .doit = l2tp_nl_cmd_session_delete, |
| 954 | .flags = GENL_ADMIN_PERM, | 954 | .flags = GENL_UNS_ADMIN_PERM, |
| 955 | }, | 955 | }, |
| 956 | { | 956 | { |
| 957 | .cmd = L2TP_CMD_SESSION_MODIFY, | 957 | .cmd = L2TP_CMD_SESSION_MODIFY, |
| 958 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | 958 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
| 959 | .doit = l2tp_nl_cmd_session_modify, | 959 | .doit = l2tp_nl_cmd_session_modify, |
| 960 | .flags = GENL_ADMIN_PERM, | 960 | .flags = GENL_UNS_ADMIN_PERM, |
| 961 | }, | 961 | }, |
| 962 | { | 962 | { |
| 963 | .cmd = L2TP_CMD_SESSION_GET, | 963 | .cmd = L2TP_CMD_SESSION_GET, |
| 964 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, | 964 | .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
| 965 | .doit = l2tp_nl_cmd_session_get, | 965 | .doit = l2tp_nl_cmd_session_get, |
| 966 | .dumpit = l2tp_nl_cmd_session_dump, | 966 | .dumpit = l2tp_nl_cmd_session_dump, |
| 967 | .flags = GENL_ADMIN_PERM, | 967 | .flags = GENL_UNS_ADMIN_PERM, |
| 968 | }, | 968 | }, |
| 969 | }; | 969 | }; |
| 970 | 970 | ||
| @@ -1069,7 +1069,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) · 1068 unmodified lines | |||
| 1069 | local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC; | 1069 | local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC; |
| 1070 | if (hw->max_signal <= 0) { | 1070 | if (hw->max_signal <= 0) { |
| 1071 | result = -EINVAL; | 1071 | result = -EINVAL; |
| 1072 | goto fail_wiphy_register; | 1072 | goto fail_workqueue; |
| 1073 | } | 1073 | } |
| 1074 | } | 1074 | } |
| 1075 | 1075 | ||
| @@ -1135,7 +1135,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) · 59 unmodified lines | |||
| 1135 | 1135 | ||
| 1136 | result = ieee80211_init_cipher_suites(local); | 1136 | result = ieee80211_init_cipher_suites(local); |
| 1137 | if (result < 0) | 1137 | if (result < 0) |
| 1138 | goto fail_wiphy_register; | 1138 | goto fail_workqueue; |
| 1139 | 1139 | ||
| 1140 | if (!local->ops->remain_on_channel) | 1140 | if (!local->ops->remain_on_channel) |
| 1141 | local->hw.wiphy->max_remain_on_channel_duration = 5000; | 1141 | local->hw.wiphy->max_remain_on_channel_duration = 5000; |
| @@ -1161,10 +1161,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) · 19 unmodified lines | |||
| 1161 | 1161 | ||
| 1162 | local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CSA_COUNTERS_NUM; | 1162 | local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CSA_COUNTERS_NUM; |
| 1163 | 1163 | ||
| 1164 | result = wiphy_register(local->hw.wiphy); | ||
| 1165 | if (result < 0) | ||
| 1166 | goto fail_wiphy_register; | ||
| 1167 | |||
| 1168 | /* | 1164 | /* |
| 1169 | * We use the number of queues for feature tests (QoS, HT) internally | 1165 | * We use the number of queues for feature tests (QoS, HT) internally |
| 1170 | * so restrict them appropriately. | 1166 | * so restrict them appropriately. |
| @@ -1187,8 +1183,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) · 16 unmodified lines | |||
| 1187 | local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, | 1183 | local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, |
| 1188 | IEEE80211_TX_STATUS_HEADROOM); | 1184 | IEEE80211_TX_STATUS_HEADROOM); |
| 1189 | 1185 | ||
| 1190 | debugfs_hw_add(local); | ||
| 1191 | |||
| 1192 | /* | 1186 | /* |
| 1193 | * if the driver doesn't specify a max listen interval we | 1187 | * if the driver doesn't specify a max listen interval we |
| 1194 | * use 5 which should be a safe default | 1188 | * use 5 which should be a safe default |
| @@ -1217,9 +1211,9 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) · 22 unmodified lines | |||
| 1217 | goto fail_flows; | 1211 | goto fail_flows; |
| 1218 | 1212 | ||
| 1219 | rtnl_lock(); | 1213 | rtnl_lock(); |
| 1220 | |||
| 1221 | result = ieee80211_init_rate_ctrl_alg(local, | 1214 | result = ieee80211_init_rate_ctrl_alg(local, |
| 1222 | hw->rate_control_algorithm); | 1215 | hw->rate_control_algorithm); |
| 1216 | rtnl_unlock(); | ||
| 1223 | if (result < 0) { | 1217 | if (result < 0) { |
| 1224 | wiphy_debug(local->hw.wiphy, | 1218 | wiphy_debug(local->hw.wiphy, |
| 1225 | "Failed to initialize rate control algorithm\n"); | 1219 | "Failed to initialize rate control algorithm\n"); |
| @@ -1273,6 +1267,15 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) · 47 unmodified lines | |||
| 1273 | local->sband_allocated |= BIT(band); | 1267 | local->sband_allocated |= BIT(band); |
| 1274 | } | 1268 | } |
| 1275 | 1269 | ||
| 1270 | result = wiphy_register(local->hw.wiphy); | ||
| 1271 | if (result < 0) | ||
| 1272 | goto fail_wiphy_register; | ||
| 1273 | |||
| 1274 | debugfs_hw_add(local); | ||
| 1275 | rate_control_add_debugfs(local); | ||
| 1276 | |||
| 1277 | rtnl_lock(); | ||
| 1278 | |||
| 1276 | /* add one default STA interface if supported */ | 1279 | /* add one default STA interface if supported */ |
| 1277 | if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) && | 1280 | if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) && |
| 1278 | !ieee80211_hw_check(hw, NO_AUTO_VIF)) { | 1281 | !ieee80211_hw_check(hw, NO_AUTO_VIF)) { |
| @@ -1312,17 +1315,17 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) · 33 unmodified lines | |||
| 1312 | #if defined(CONFIG_INET) || defined(CONFIG_IPV6) | 1315 | #if defined(CONFIG_INET) || defined(CONFIG_IPV6) |
| 1313 | fail_ifa: | 1316 | fail_ifa: |
| 1314 | #endif | 1317 | #endif |
| 1318 | wiphy_unregister(local->hw.wiphy); | ||
| 1319 | fail_wiphy_register: | ||
| 1315 | rtnl_lock(); | 1320 | rtnl_lock(); |
| 1316 | rate_control_deinitialize(local); | 1321 | rate_control_deinitialize(local); |
| 1317 | ieee80211_remove_interfaces(local); | 1322 | ieee80211_remove_interfaces(local); |
| 1318 | fail_rate: | ||
| 1319 | rtnl_unlock(); | 1323 | rtnl_unlock(); |
| 1324 | fail_rate: | ||
| 1320 | fail_flows: | 1325 | fail_flows: |
| 1321 | ieee80211_led_exit(local); | 1326 | ieee80211_led_exit(local); |
| 1322 | destroy_workqueue(local->workqueue); | 1327 | destroy_workqueue(local->workqueue); |
| 1323 | fail_workqueue: | 1328 | fail_workqueue: |
| 1324 | wiphy_unregister(local->hw.wiphy); | ||
| 1325 | fail_wiphy_register: | ||
| 1326 | if (local->wiphy_ciphers_allocated) | 1329 | if (local->wiphy_ciphers_allocated) |
| 1327 | kfree(local->hw.wiphy->cipher_suites); | 1330 | kfree(local->hw.wiphy->cipher_suites); |
| 1328 | kfree(local->int_scan_req); | 1331 | kfree(local->int_scan_req); |
| @@ -1372,8 +1375,8 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw) · 43 unmodified lines | |||
| 1372 | skb_queue_purge(&local->skb_queue_unreliable); | 1375 | skb_queue_purge(&local->skb_queue_unreliable); |
| 1373 | skb_queue_purge(&local->skb_queue_tdls_chsw); | 1376 | skb_queue_purge(&local->skb_queue_tdls_chsw); |
| 1374 | 1377 | ||
| 1375 | destroy_workqueue(local->workqueue); | ||
| 1376 | wiphy_unregister(local->hw.wiphy); | 1378 | wiphy_unregister(local->hw.wiphy); |
| 1379 | destroy_workqueue(local->workqueue); | ||
| 1377 | ieee80211_led_exit(local); | 1380 | ieee80211_led_exit(local); |
| 1378 | kfree(local->int_scan_req); | 1381 | kfree(local->int_scan_req); |
| 1379 | } | 1382 | } |
| @@ -1257,15 +1257,15 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, · 1256 unmodified lines | |||
| 1257 | sdata->u.mesh.mshcfg.rssi_threshold < rx_status->signal) | 1257 | sdata->u.mesh.mshcfg.rssi_threshold < rx_status->signal) |
| 1258 | mesh_neighbour_update(sdata, mgmt->sa, &elems, | 1258 | mesh_neighbour_update(sdata, mgmt->sa, &elems, |
| 1259 | rx_status); | 1259 | rx_status); |
| 1260 | |||
| 1261 | if (ifmsh->csa_role != IEEE80211_MESH_CSA_ROLE_INIT && | ||
| 1262 | !sdata->vif.csa_active) | ||
| 1263 | ieee80211_mesh_process_chnswitch(sdata, &elems, true); | ||
| 1260 | } | 1264 | } |
| 1261 | 1265 | ||
| 1262 | if (ifmsh->sync_ops) | 1266 | if (ifmsh->sync_ops) |
| 1263 | ifmsh->sync_ops->rx_bcn_presp(sdata, | 1267 | ifmsh->sync_ops->rx_bcn_presp(sdata, |
| 1264 | stype, mgmt, &elems, rx_status); | 1268 | stype, mgmt, &elems, rx_status); |
| 1265 | |||
| 1266 | if (ifmsh->csa_role != IEEE80211_MESH_CSA_ROLE_INIT && | ||
| 1267 | !sdata->vif.csa_active) | ||
| 1268 | ieee80211_mesh_process_chnswitch(sdata, &elems, true); | ||
| 1269 | } | 1269 | } |
| 1270 | 1270 | ||
| 1271 | int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata) | 1271 | int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata) |
| @@ -1373,6 +1373,9 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata, · 101 unmodified lines | |||
| 1373 | ieee802_11_parse_elems(pos, len - baselen, true, &elems, | 1373 | ieee802_11_parse_elems(pos, len - baselen, true, &elems, |
| 1374 | mgmt->bssid, NULL); | 1374 | mgmt->bssid, NULL); |
| 1375 | 1375 | ||
| 1376 | if (!mesh_matches_local(sdata, &elems)) | ||
| 1377 | return; | ||
| 1378 | |||
| 1376 | ifmsh->chsw_ttl = elems.mesh_chansw_params_ie->mesh_ttl; | 1379 | ifmsh->chsw_ttl = elems.mesh_chansw_params_ie->mesh_ttl; |
| 1377 | if (!--ifmsh->chsw_ttl) | 1380 | if (!--ifmsh->chsw_ttl) |
| 1378 | fwd_csa = false; | 1381 | fwd_csa = false; |
| @@ -214,17 +214,16 @@ static ssize_t rcname_read(struct file *file, char __user *userbuf, · 213 unmodified lines | |||
| 214 | ref->ops->name, len); | 214 | ref->ops->name, len); |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | static const struct file_operations rcname_ops = { | 217 | const struct file_operations rcname_ops = { |
| 218 | .read = rcname_read, | 218 | .read = rcname_read, |
| 219 | .open = simple_open, | 219 | .open = simple_open, |
| 220 | .llseek = default_llseek, | 220 | .llseek = default_llseek, |
| 221 | }; | 221 | }; |
| 222 | #endif | 222 | #endif |
| 223 | 223 | ||
| 224 | static struct rate_control_ref *rate_control_alloc(const char *name, | 224 | static struct rate_control_ref * |
| 225 | struct ieee80211_local *local) | 225 | rate_control_alloc(const char *name, struct ieee80211_local *local) |
| 226 | { | 226 | { |
| 227 | struct dentry *debugfsdir = NULL; | ||
| 228 | struct rate_control_ref *ref; | 227 | struct rate_control_ref *ref; |
| 229 | 228 | ||
| 230 | ref = kmalloc(sizeof(struct rate_control_ref), GFP_KERNEL); | 229 | ref = kmalloc(sizeof(struct rate_control_ref), GFP_KERNEL); |
| @@ -234,13 +233,7 @@ static struct rate_control_ref *rate_control_alloc(const char *name, · 3 unmodified lines | |||
| 234 | if (!ref->ops) | 233 | if (!ref->ops) |
| 235 | goto free; | 234 | goto free; |
| 236 | 235 | ||
| 237 | #ifdef CONFIG_MAC80211_DEBUGFS | 236 | ref->priv = ref->ops->alloc(&local->hw); |
| 238 | debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir); | ||
| 239 | local->debugfs.rcdir = debugfsdir; | ||
| 240 | debugfs_create_file("name", 0400, debugfsdir, ref, &rcname_ops); | ||
| 241 | #endif | ||
| 242 | |||
| 243 | ref->priv = ref->ops->alloc(&local->hw, debugfsdir); | ||
| 244 | if (!ref->priv) | 237 | if (!ref->priv) |
| 245 | goto free; | 238 | goto free; |
| 246 | return ref; | 239 | return ref; |
| @@ -60,6 +60,29 @@ static inline void rate_control_add_sta_debugfs(struct sta_info *sta) · 59 unmodified lines | |||
| 60 | #endif | 60 | #endif |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | extern const struct file_operations rcname_ops; | ||
| 64 | |||
| 65 | static inline void rate_control_add_debugfs(struct ieee80211_local *local) | ||
| 66 | { | ||
| 67 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
| 68 | struct dentry *debugfsdir; | ||
| 69 | |||
| 70 | if (!local->rate_ctrl) | ||
| 71 | return; | ||
| 72 | |||
| 73 | if (!local->rate_ctrl->ops->add_debugfs) | ||
| 74 | return; | ||
| 75 | |||
| 76 | debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir); | ||
| 77 | local->debugfs.rcdir = debugfsdir; | ||
| 78 | debugfs_create_file("name", 0400, debugfsdir, | ||
| 79 | local->rate_ctrl, &rcname_ops); | ||
| 80 | |||
| 81 | local->rate_ctrl->ops->add_debugfs(&local->hw, local->rate_ctrl->priv, | ||
| 82 | debugfsdir); | ||
| 83 | #endif | ||
| 84 | } | ||
| 85 | |||
| 63 | void ieee80211_check_rate_mask(struct ieee80211_sub_if_data *sdata); | 86 | void ieee80211_check_rate_mask(struct ieee80211_sub_if_data *sdata); |
| 64 | 87 | ||
| 65 | /* Get a reference to the rate control algorithm. If `name' is NULL, get the | 88 | /* Get a reference to the rate control algorithm. If `name' is NULL, get the |
| @@ -1635,7 +1635,7 @@ minstrel_ht_init_cck_rates(struct minstrel_priv *mp) · 1634 unmodified lines | |||
| 1635 | } | 1635 | } |
| 1636 | 1636 | ||
| 1637 | static void * | 1637 | static void * |
| 1638 | minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) | 1638 | minstrel_ht_alloc(struct ieee80211_hw *hw) |
| 1639 | { | 1639 | { |
| 1640 | struct minstrel_priv *mp; | 1640 | struct minstrel_priv *mp; |
| 1641 | 1641 | ||
| @@ -1673,7 +1673,17 @@ minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) · 31 unmodified lines | |||
| 1673 | mp->update_interval = HZ / 10; | 1673 | mp->update_interval = HZ / 10; |
| 1674 | mp->new_avg = true; | 1674 | mp->new_avg = true; |
| 1675 | 1675 | ||
| 1676 | minstrel_ht_init_cck_rates(mp); | ||
| 1677 | |||
| 1678 | return mp; | ||
| 1679 | } | ||
| 1680 | |||
| 1676 | #ifdef CONFIG_MAC80211_DEBUGFS | 1681 | #ifdef CONFIG_MAC80211_DEBUGFS |
| 1682 | static void minstrel_ht_add_debugfs(struct ieee80211_hw *hw, void *priv, | ||
| 1683 | struct dentry *debugfsdir) | ||
| 1684 | { | ||
| 1685 | struct minstrel_priv *mp = priv; | ||
| 1686 | |||
| 1677 | mp->fixed_rate_idx = (u32) -1; | 1687 | mp->fixed_rate_idx = (u32) -1; |
| 1678 | debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, | 1688 | debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, |
| 1679 | &mp->fixed_rate_idx); | 1689 | &mp->fixed_rate_idx); |
| @@ -1681,12 +1691,8 @@ minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) · 1 unmodified line | |||
| 1681 | &mp->sample_switch); | 1691 | &mp->sample_switch); |
| 1682 | debugfs_create_bool("new_avg", S_IRUGO | S_IWUSR, debugfsdir, | 1692 | debugfs_create_bool("new_avg", S_IRUGO | S_IWUSR, debugfsdir, |
| 1683 | &mp->new_avg); | 1693 | &mp->new_avg); |
| 1684 | #endif | ||
| 1685 | |||
| 1686 | minstrel_ht_init_cck_rates(mp); | ||
| 1687 | |||
| 1688 | return mp; | ||
| 1689 | } | 1694 | } |
| 1695 | #endif | ||
| 1690 | 1696 | ||
| 1691 | static void | 1697 | static void |
| 1692 | minstrel_ht_free(void *priv) | 1698 | minstrel_ht_free(void *priv) |
| @@ -1725,6 +1731,7 @@ static const struct rate_control_ops mac80211_minstrel_ht = { · 32 unmodified lines | |||
| 1725 | .alloc = minstrel_ht_alloc, | 1731 | .alloc = minstrel_ht_alloc, |
| 1726 | .free = minstrel_ht_free, | 1732 | .free = minstrel_ht_free, |
| 1727 | #ifdef CONFIG_MAC80211_DEBUGFS | 1733 | #ifdef CONFIG_MAC80211_DEBUGFS |
| 1734 | .add_debugfs = minstrel_ht_add_debugfs, | ||
| 1728 | .add_sta_debugfs = minstrel_ht_add_sta_debugfs, | 1735 | .add_sta_debugfs = minstrel_ht_add_sta_debugfs, |
| 1729 | #endif | 1736 | #endif |
| 1730 | .get_expected_throughput = minstrel_ht_get_expected_throughput, | 1737 | .get_expected_throughput = minstrel_ht_get_expected_throughput, |
| @@ -231,7 +231,8 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata, · 230 unmodified lines | |||
| 231 | struct sta_info *sta; | 231 | struct sta_info *sta; |
| 232 | int i = 0; | 232 | int i = 0; |
| 233 | 233 | ||
| 234 | list_for_each_entry_rcu(sta, &local->sta_list, list) { | 234 | list_for_each_entry_rcu(sta, &local->sta_list, list, |
| 235 | lockdep_is_held(&local->sta_mtx)) { | ||
| 235 | if (sdata != sta->sdata) | 236 | if (sdata != sta->sdata) |
| 236 | continue; | 237 | continue; |
| 237 | if (i < idx) { | 238 | if (i < idx) { |
| @@ -876,12 +876,11 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb, · 875 unmodified lines | |||
| 876 | mpext->data_seq = mp_opt->data_seq; | 876 | mpext->data_seq = mp_opt->data_seq; |
| 877 | mpext->subflow_seq = mp_opt->subflow_seq; | 877 | mpext->subflow_seq = mp_opt->subflow_seq; |
| 878 | mpext->dsn64 = mp_opt->dsn64; | 878 | mpext->dsn64 = mp_opt->dsn64; |
| 879 | mpext->data_fin = mp_opt->data_fin; | ||
| 879 | } | 880 | } |
| 880 | mpext->data_len = mp_opt->data_len; | 881 | mpext->data_len = mp_opt->data_len; |
| 881 | mpext->use_map = 1; | 882 | mpext->use_map = 1; |
| 882 | } | 883 | } |
| 883 | |||
| 884 | mpext->data_fin = mp_opt->data_fin; | ||
| 885 | } | 884 | } |
| 886 | 885 | ||
| 887 | void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) | 886 | void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) |
| @@ -599,12 +599,14 @@ static int mptcp_nl_fill_addr(struct sk_buff *skb, · 598 unmodified lines | |||
| 599 | nla_put_s32(skb, MPTCP_PM_ADDR_ATTR_IF_IDX, entry->ifindex)) | 599 | nla_put_s32(skb, MPTCP_PM_ADDR_ATTR_IF_IDX, entry->ifindex)) |
| 600 | goto nla_put_failure; | 600 | goto nla_put_failure; |
| 601 | 601 | ||
| 602 | if (addr->family == AF_INET) | 602 | if (addr->family == AF_INET && |
| 603 | nla_put_in_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR4, | 603 | nla_put_in_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR4, |
| 604 | addr->addr.s_addr); | 604 | addr->addr.s_addr)) |
| 605 | goto nla_put_failure; | ||
| 605 | #if IS_ENABLED(CONFIG_MPTCP_IPV6) | 606 | #if IS_ENABLED(CONFIG_MPTCP_IPV6) |
| 606 | else if (addr->family == AF_INET6) | 607 | else if (addr->family == AF_INET6 && |
| 607 | nla_put_in6_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR6, &addr->addr6); | 608 | nla_put_in6_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR6, &addr->addr6)) |
| 609 | goto nla_put_failure; | ||
| 608 | #endif | 610 | #endif |
| 609 | nla_nest_end(skb, attr); | 611 | nla_nest_end(skb, attr); |
| 610 | return 0; | 612 | return 0; |
| @@ -97,12 +97,7 @@ static struct socket *__mptcp_tcp_fallback(struct mptcp_sock *msk) · 96 unmodified lines | |||
| 97 | if (likely(!__mptcp_needs_tcp_fallback(msk))) | 97 | if (likely(!__mptcp_needs_tcp_fallback(msk))) |
| 98 | return NULL; | 98 | return NULL; |
| 99 | 99 | ||
| 100 | if (msk->subflow) { | 100 | return msk->subflow; |
| 101 | release_sock((struct sock *)msk); | ||
| 102 | return msk->subflow; | ||
| 103 | } | ||
| 104 | |||
| 105 | return NULL; | ||
| 106 | } | 101 | } |
| 107 | 102 | ||
| 108 | static bool __mptcp_can_create_subflow(const struct mptcp_sock *msk) | 103 | static bool __mptcp_can_create_subflow(const struct mptcp_sock *msk) |
| @@ -734,9 +729,10 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) · 625 unmodified lines | |||
| 734 | goto out; | 729 | goto out; |
| 735 | } | 730 | } |
| 736 | 731 | ||
| 732 | fallback: | ||
| 737 | ssock = __mptcp_tcp_fallback(msk); | 733 | ssock = __mptcp_tcp_fallback(msk); |
| 738 | if (unlikely(ssock)) { | 734 | if (unlikely(ssock)) { |
| 739 | fallback: | 735 | release_sock(sk); |
| 740 | pr_debug("fallback passthrough"); | 736 | pr_debug("fallback passthrough"); |
| 741 | ret = sock_sendmsg(ssock, msg); | 737 | ret = sock_sendmsg(ssock, msg); |
| 742 | return ret >= 0 ? ret + copied : (copied ? copied : ret); | 738 | return ret >= 0 ? ret + copied : (copied ? copied : ret); |
| @@ -769,8 +765,14 @@ fallback: · 26 unmodified lines | |||
| 769 | if (ret < 0) | 765 | if (ret < 0) |
| 770 | break; | 766 | break; |
| 771 | if (ret == 0 && unlikely(__mptcp_needs_tcp_fallback(msk))) { | 767 | if (ret == 0 && unlikely(__mptcp_needs_tcp_fallback(msk))) { |
| 768 | /* Can happen for passive sockets: | ||
| 769 | * 3WHS negotiated MPTCP, but first packet after is | ||
| 770 | * plain TCP (e.g. due to middlebox filtering unknown | ||
| 771 | * options). | ||
| 772 | * | ||
| 773 | * Fall back to TCP. | ||
| 774 | */ | ||
| 772 | release_sock(ssk); | 775 | release_sock(ssk); |
| 773 | ssock = __mptcp_tcp_fallback(msk); | ||
| 774 | goto fallback; | 776 | goto fallback; |
| 775 | } | 777 | } |
| 776 | 778 | ||
| @@ -883,6 +885,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, · 106 unmodified lines | |||
| 883 | ssock = __mptcp_tcp_fallback(msk); | 885 | ssock = __mptcp_tcp_fallback(msk); |
| 884 | if (unlikely(ssock)) { | 886 | if (unlikely(ssock)) { |
| 885 | fallback: | 887 | fallback: |
| 888 | release_sock(sk); | ||
| 886 | pr_debug("fallback-read subflow=%p", | 889 | pr_debug("fallback-read subflow=%p", |
| 887 | mptcp_subflow_ctx(ssock->sk)); | 890 | mptcp_subflow_ctx(ssock->sk)); |
| 888 | copied = sock_recvmsg(ssock, msg, flags); | 891 | copied = sock_recvmsg(ssock, msg, flags); |
| @@ -1329,7 +1332,9 @@ static struct ipv6_pinfo *mptcp_inet6_sk(const struct sock *sk) · 440 unmodified lines | |||
| 1329 | } | 1332 | } |
| 1330 | #endif | 1333 | #endif |
| 1331 | 1334 | ||
| 1332 | struct sock *mptcp_sk_clone(const struct sock *sk, struct request_sock *req) | 1335 | struct sock *mptcp_sk_clone(const struct sock *sk, |
| 1336 | const struct tcp_options_received *opt_rx, | ||
| 1337 | struct request_sock *req) | ||
| 1333 | { | 1338 | { |
| 1334 | struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); | 1339 | struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); |
| 1335 | struct sock *nsk = sk_clone_lock(sk, GFP_ATOMIC); | 1340 | struct sock *nsk = sk_clone_lock(sk, GFP_ATOMIC); |
| @@ -1352,26 +1357,30 @@ struct sock *mptcp_sk_clone(const struct sock *sk, struct request_sock *req) · 16 unmodified lines | |||
| 1352 | msk->subflow = NULL; | 1357 | msk->subflow = NULL; |
| 1353 | 1358 | ||
| 1354 | if (unlikely(mptcp_token_new_accept(subflow_req->token, nsk))) { | 1359 | if (unlikely(mptcp_token_new_accept(subflow_req->token, nsk))) { |
| 1360 | nsk->sk_state = TCP_CLOSE; | ||
| 1355 | bh_unlock_sock(nsk); | 1361 | bh_unlock_sock(nsk); |
| 1356 | 1362 | ||
| 1357 | /* we can't call into mptcp_close() here - possible BH context | 1363 | /* we can't call into mptcp_close() here - possible BH context |
| 1358 | * free the sock directly | 1364 | * free the sock directly. |
| 1365 | * sk_clone_lock() sets nsk refcnt to two, hence call sk_free() | ||
| 1366 | * too. | ||
| 1359 | */ | 1367 | */ |
| 1360 | nsk->sk_prot->destroy(nsk); | 1368 | sk_common_release(nsk); |
| 1361 | sk_free(nsk); | 1369 | sk_free(nsk); |
| 1362 | return NULL; | 1370 | return NULL; |
| 1363 | } | 1371 | } |
| 1364 | 1372 | ||
| 1365 | msk->write_seq = subflow_req->idsn + 1; | 1373 | msk->write_seq = subflow_req->idsn + 1; |
| 1366 | atomic64_set(&msk->snd_una, msk->write_seq); | 1374 | atomic64_set(&msk->snd_una, msk->write_seq); |
| 1367 | if (subflow_req->remote_key_valid) { | 1375 | if (opt_rx->mptcp.mp_capable) { |
| 1368 | msk->can_ack = true; | 1376 | msk->can_ack = true; |
| 1369 | msk->remote_key = subflow_req->remote_key; | 1377 | msk->remote_key = opt_rx->mptcp.sndr_key; |
| 1370 | mptcp_crypto_key_sha(msk->remote_key, NULL, &ack_seq); | 1378 | mptcp_crypto_key_sha(msk->remote_key, NULL, &ack_seq); |
| 1371 | ack_seq++; | 1379 | ack_seq++; |
| 1372 | msk->ack_seq = ack_seq; | 1380 | msk->ack_seq = ack_seq; |
| 1373 | } | 1381 | } |
| 1374 | 1382 | ||
| 1383 | sock_reset_flag(nsk, SOCK_RCU_FREE); | ||
| 1375 | /* will be fully established after successful MPC subflow creation */ | 1384 | /* will be fully established after successful MPC subflow creation */ |
| 1376 | inet_sk_state_store(nsk, TCP_SYN_RECV); | 1385 | inet_sk_state_store(nsk, TCP_SYN_RECV); |
| 1377 | bh_unlock_sock(nsk); | 1386 | bh_unlock_sock(nsk); |
| @@ -1428,6 +1437,7 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err, · 50 unmodified lines | |||
| 1428 | newsk = new_mptcp_sock; | 1437 | newsk = new_mptcp_sock; |
| 1429 | mptcp_copy_inaddrs(newsk, ssk); | 1438 | mptcp_copy_inaddrs(newsk, ssk); |
| 1430 | list_add(&subflow->node, &msk->conn_list); | 1439 | list_add(&subflow->node, &msk->conn_list); |
| 1440 | inet_sk_state_store(newsk, TCP_ESTABLISHED); | ||
| 1431 | 1441 | ||
| 1432 | bh_unlock_sock(new_mptcp_sock); | 1442 | bh_unlock_sock(new_mptcp_sock); |
| 1433 | 1443 | ||
| @@ -1467,12 +1477,11 @@ static int mptcp_setsockopt(struct sock *sk, int level, int optname, · 33 unmodified lines | |||
| 1467 | */ | 1477 | */ |
| 1468 | lock_sock(sk); | 1478 | lock_sock(sk); |
| 1469 | ssock = __mptcp_tcp_fallback(msk); | 1479 | ssock = __mptcp_tcp_fallback(msk); |
| 1480 | release_sock(sk); | ||
| 1470 | if (ssock) | 1481 | if (ssock) |
| 1471 | return tcp_setsockopt(ssock->sk, level, optname, optval, | 1482 | return tcp_setsockopt(ssock->sk, level, optname, optval, |
| 1472 | optlen); | 1483 | optlen); |
| 1473 | 1484 | ||
| 1474 | release_sock(sk); | ||
| 1475 | |||
| 1476 | return -EOPNOTSUPP; | 1485 | return -EOPNOTSUPP; |
| 1477 | } | 1486 | } |
| 1478 | 1487 | ||
| @@ -1492,12 +1501,11 @@ static int mptcp_getsockopt(struct sock *sk, int level, int optname, · 13 unmodified lines | |||
| 1492 | */ | 1501 | */ |
| 1493 | lock_sock(sk); | 1502 | lock_sock(sk); |
| 1494 | ssock = __mptcp_tcp_fallback(msk); | 1503 | ssock = __mptcp_tcp_fallback(msk); |
| 1504 | release_sock(sk); | ||
| 1495 | if (ssock) | 1505 | if (ssock) |
| 1496 | return tcp_getsockopt(ssock->sk, level, optname, optval, | 1506 | return tcp_getsockopt(ssock->sk, level, optname, optval, |
| 1497 | option); | 1507 | option); |
| 1498 | 1508 | ||
| 1499 | release_sock(sk); | ||
| 1500 | |||
| 1501 | return -EOPNOTSUPP; | 1509 | return -EOPNOTSUPP; |
| 1502 | } | 1510 | } |
| 1503 | 1511 | ||
| @@ -1774,6 +1782,8 @@ static int mptcp_listen(struct socket *sock, int backlog) · 270 unmodified lines | |||
| 1774 | goto unlock; | 1782 | goto unlock; |
| 1775 | } | 1783 | } |
| 1776 | 1784 | ||
| 1785 | sock_set_flag(sock->sk, SOCK_RCU_FREE); | ||
| 1786 | |||
| 1777 | err = ssock->ops->listen(ssock, backlog); | 1787 | err = ssock->ops->listen(ssock, backlog); |
| 1778 | inet_sk_state_store(sock->sk, inet_sk_state_load(ssock->sk)); | 1788 | inet_sk_state_store(sock->sk, inet_sk_state_load(ssock->sk)); |
| 1779 | if (!err) | 1789 | if (!err) |
| @@ -206,12 +206,10 @@ struct mptcp_subflow_request_sock { · 205 unmodified lines | |||
| 206 | struct tcp_request_sock sk; | 206 | struct tcp_request_sock sk; |
| 207 | u16 mp_capable : 1, | 207 | u16 mp_capable : 1, |
| 208 | mp_join : 1, | 208 | mp_join : 1, |
| 209 | backup : 1, | 209 | backup : 1; |
| 210 | remote_key_valid : 1; | ||
| 211 | u8 local_id; | 210 | u8 local_id; |
| 212 | u8 remote_id; | 211 | u8 remote_id; |
| 213 | u64 local_key; | 212 | u64 local_key; |
| 214 | u64 remote_key; | ||
| 215 | u64 idsn; | 213 | u64 idsn; |
| 216 | u32 token; | 214 | u32 token; |
| 217 | u32 ssn_offset; | 215 | u32 ssn_offset; |
| @@ -332,7 +330,9 @@ void mptcp_proto_init(void); · 114 unmodified lines | |||
| 332 | int mptcp_proto_v6_init(void); | 330 | int mptcp_proto_v6_init(void); |
| 333 | #endif | 331 | #endif |
| 334 | 332 | ||
| 335 | struct sock *mptcp_sk_clone(const struct sock *sk, struct request_sock *req); | 333 | struct sock *mptcp_sk_clone(const struct sock *sk, |
| 334 | const struct tcp_options_received *opt_rx, | ||
| 335 | struct request_sock *req); | ||
| 336 | void mptcp_get_options(const struct sk_buff *skb, | 336 | void mptcp_get_options(const struct sk_buff *skb, |
| 337 | struct tcp_options_received *opt_rx); | 337 | struct tcp_options_received *opt_rx); |
| 338 | 338 | ||
| @@ -133,7 +133,6 @@ static void subflow_init_req(struct request_sock *req, · 132 unmodified lines | |||
| 133 | 133 | ||
| 134 | subflow_req->mp_capable = 0; | 134 | subflow_req->mp_capable = 0; |
| 135 | subflow_req->mp_join = 0; | 135 | subflow_req->mp_join = 0; |
| 136 | subflow_req->remote_key_valid = 0; | ||
| 137 | 136 | ||
| 138 | #ifdef CONFIG_TCP_MD5SIG | 137 | #ifdef CONFIG_TCP_MD5SIG |
| 139 | /* no MPTCP if MD5SIG is enabled on this socket or we may run out of | 138 | /* no MPTCP if MD5SIG is enabled on this socket or we may run out of |
| @@ -347,6 +346,46 @@ static bool subflow_hmac_valid(const struct request_sock *req, · 207 unmodified lines | |||
| 347 | return ret; | 346 | return ret; |
| 348 | } | 347 | } |
| 349 | 348 | ||
| 349 | static void mptcp_sock_destruct(struct sock *sk) | ||
| 350 | { | ||
| 351 | /* if new mptcp socket isn't accepted, it is free'd | ||
| 352 | * from the tcp listener sockets request queue, linked | ||
| 353 | * from req->sk. The tcp socket is released. | ||
| 354 | * This calls the ULP release function which will | ||
| 355 | * also remove the mptcp socket, via | ||
| 356 | * sock_put(ctx->conn). | ||
| 357 | * | ||
| 358 | * Problem is that the mptcp socket will not be in | ||
| 359 | * SYN_RECV state and doesn't have SOCK_DEAD flag. | ||
| 360 | * Both result in warnings from inet_sock_destruct. | ||
| 361 | */ | ||
| 362 | |||
| 363 | if (sk->sk_state == TCP_SYN_RECV) { | ||
| 364 | sk->sk_state = TCP_CLOSE; | ||
| 365 | WARN_ON_ONCE(sk->sk_socket); | ||
| 366 | sock_orphan(sk); | ||
| 367 | } | ||
| 368 | |||
| 369 | inet_sock_destruct(sk); | ||
| 370 | } | ||
| 371 | |||
| 372 | static void mptcp_force_close(struct sock *sk) | ||
| 373 | { | ||
| 374 | inet_sk_state_store(sk, TCP_CLOSE); | ||
| 375 | sk_common_release(sk); | ||
| 376 | } | ||
| 377 | |||
| 378 | static void subflow_ulp_fallback(struct sock *sk, | ||
| 379 | struct mptcp_subflow_context *old_ctx) | ||
| 380 | { | ||
| 381 | struct inet_connection_sock *icsk = inet_csk(sk); | ||
| 382 | |||
| 383 | mptcp_subflow_tcp_fallback(sk, old_ctx); | ||
| 384 | icsk->icsk_ulp_ops = NULL; | ||
| 385 | rcu_assign_pointer(icsk->icsk_ulp_data, NULL); | ||
| 386 | tcp_sk(sk)->is_mptcp = 0; | ||
| 387 | } | ||
| 388 | |||
| 350 | static struct sock *subflow_syn_recv_sock(const struct sock *sk, | 389 | static struct sock *subflow_syn_recv_sock(const struct sock *sk, |
| 351 | struct sk_buff *skb, | 390 | struct sk_buff *skb, |
| 352 | struct request_sock *req, | 391 | struct request_sock *req, |
| @@ -359,10 +398,12 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, · 6 unmodified lines | |||
| 359 | struct tcp_options_received opt_rx; | 398 | struct tcp_options_received opt_rx; |
| 360 | bool fallback_is_fatal = false; | 399 | bool fallback_is_fatal = false; |
| 361 | struct sock *new_msk = NULL; | 400 | struct sock *new_msk = NULL; |
| 401 | bool fallback = false; | ||
| 362 | struct sock *child; | 402 | struct sock *child; |
| 363 | 403 | ||
| 364 | pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn); | 404 | pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn); |
| 365 | 405 | ||
| 406 | opt_rx.mptcp.mp_capable = 0; | ||
| 366 | if (tcp_rsk(req)->is_mptcp == 0) | 407 | if (tcp_rsk(req)->is_mptcp == 0) |
| 367 | goto create_child; | 408 | goto create_child; |
| 368 | 409 | ||
| @@ -377,20 +418,16 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, · 8 unmodified lines | |||
| 377 | goto create_msk; | 418 | goto create_msk; |
| 378 | } | 419 | } |
| 379 | 420 | ||
| 380 | opt_rx.mptcp.mp_capable = 0; | ||
| 381 | mptcp_get_options(skb, &opt_rx); | 421 | mptcp_get_options(skb, &opt_rx); |
| 382 | if (opt_rx.mptcp.mp_capable) { | 422 | if (!opt_rx.mptcp.mp_capable) { |
| 383 | subflow_req->remote_key = opt_rx.mptcp.sndr_key; | 423 | fallback = true; |
| 384 | subflow_req->remote_key_valid = 1; | ||
| 385 | } else { | ||
| 386 | subflow_req->mp_capable = 0; | ||
| 387 | goto create_child; | 424 | goto create_child; |
| 388 | } | 425 | } |
| 389 | 426 | ||
| 390 | create_msk: | 427 | create_msk: |
| 391 | new_msk = mptcp_sk_clone(listener->conn, req); | 428 | new_msk = mptcp_sk_clone(listener->conn, &opt_rx, req); |
| 392 | if (!new_msk) | 429 | if (!new_msk) |
| 393 | subflow_req->mp_capable = 0; | 430 | fallback = true; |
| 394 | } else if (subflow_req->mp_join) { | 431 | } else if (subflow_req->mp_join) { |
| 395 | fallback_is_fatal = true; | 432 | fallback_is_fatal = true; |
| 396 | opt_rx.mptcp.mp_join = 0; | 433 | opt_rx.mptcp.mp_join = 0; |
| @@ -409,12 +446,18 @@ create_child: · 12 unmodified lines | |||
| 409 | if (child && *own_req) { | 446 | if (child && *own_req) { |
| 410 | struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child); | 447 | struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child); |
| 411 | 448 | ||
| 412 | /* we have null ctx on TCP fallback, which is fatal on | 449 | /* we need to fallback on ctx allocation failure and on pre-reqs |
| 413 | * MPJ handshake | 450 | * checking above. In the latter scenario we additionally need |
| 451 | * to reset the context to non MPTCP status. | ||
| 414 | */ | 452 | */ |
| 415 | if (!ctx) { | 453 | if (!ctx || fallback) { |
| 416 | if (fallback_is_fatal) | 454 | if (fallback_is_fatal) |
| 417 | goto close_child; | 455 | goto close_child; |
| 456 | |||
| 457 | if (ctx) { | ||
| 458 | subflow_ulp_fallback(child, ctx); | ||
| 459 | kfree_rcu(ctx, rcu); | ||
| 460 | } | ||
| 418 | goto out; | 461 | goto out; |
| 419 | } | 462 | } |
| 420 | 463 | ||
| @@ -422,10 +465,17 @@ create_child: · 1 unmodified line | |||
| 422 | /* new mpc subflow takes ownership of the newly | 465 | /* new mpc subflow takes ownership of the newly |
| 423 | * created mptcp socket | 466 | * created mptcp socket |
| 424 | */ | 467 | */ |
| 425 | inet_sk_state_store(new_msk, TCP_ESTABLISHED); | 468 | new_msk->sk_destruct = mptcp_sock_destruct; |
| 426 | mptcp_pm_new_connection(mptcp_sk(new_msk), 1); | 469 | mptcp_pm_new_connection(mptcp_sk(new_msk), 1); |
| 427 | ctx->conn = new_msk; | 470 | ctx->conn = new_msk; |
| 428 | new_msk = NULL; | 471 | new_msk = NULL; |
| 472 | |||
| 473 | /* with OoO packets we can reach here without ingress | ||
| 474 | * mpc option | ||
| 475 | */ | ||
| 476 | ctx->remote_key = opt_rx.mptcp.sndr_key; | ||
| 477 | ctx->fully_established = opt_rx.mptcp.mp_capable; | ||
| 478 | ctx->can_ack = opt_rx.mptcp.mp_capable; | ||
| 429 | } else if (ctx->mp_join) { | 479 | } else if (ctx->mp_join) { |
| 430 | struct mptcp_sock *owner; | 480 | struct mptcp_sock *owner; |
| 431 | 481 | ||
| @@ -444,7 +494,14 @@ create_child: · 12 unmodified lines | |||
| 444 | out: | 494 | out: |
| 445 | /* dispose of the left over mptcp master, if any */ | 495 | /* dispose of the left over mptcp master, if any */ |
| 446 | if (unlikely(new_msk)) | 496 | if (unlikely(new_msk)) |
| 447 | sock_put(new_msk); | 497 | mptcp_force_close(new_msk); |
| 498 | |||
| 499 | /* check for expected invariant - should never trigger, just help | ||
| 500 | * catching eariler subtle bugs | ||
| 501 | */ | ||
| 502 | WARN_ON_ONCE(*own_req && child && tcp_sk(child)->is_mptcp && | ||
| 503 | (!mptcp_subflow_ctx(child) || | ||
| 504 | !mptcp_subflow_ctx(child)->conn)); | ||
| 448 | return child; | 505 | return child; |
| 449 | 506 | ||
| 450 | close_child: | 507 | close_child: |
| @@ -1047,17 +1104,6 @@ static void subflow_ulp_release(struct sock *sk) · 596 unmodified lines | |||
| 1047 | kfree_rcu(ctx, rcu); | 1104 | kfree_rcu(ctx, rcu); |
| 1048 | } | 1105 | } |
| 1049 | 1106 | ||
| 1050 | static void subflow_ulp_fallback(struct sock *sk, | ||
| 1051 | struct mptcp_subflow_context *old_ctx) | ||
| 1052 | { | ||
| 1053 | struct inet_connection_sock *icsk = inet_csk(sk); | ||
| 1054 | |||
| 1055 | mptcp_subflow_tcp_fallback(sk, old_ctx); | ||
| 1056 | icsk->icsk_ulp_ops = NULL; | ||
| 1057 | rcu_assign_pointer(icsk->icsk_ulp_data, NULL); | ||
| 1058 | tcp_sk(sk)->is_mptcp = 0; | ||
| 1059 | } | ||
| 1060 | |||
| 1061 | static void subflow_ulp_clone(const struct request_sock *req, | 1107 | static void subflow_ulp_clone(const struct request_sock *req, |
| 1062 | struct sock *newsk, | 1108 | struct sock *newsk, |
| 1063 | const gfp_t priority) | 1109 | const gfp_t priority) |
| @@ -1091,9 +1137,6 @@ static void subflow_ulp_clone(const struct request_sock *req, · 27 unmodified lines | |||
| 1091 | * is fully established only after we receive the remote key | 1137 | * is fully established only after we receive the remote key |
| 1092 | */ | 1138 | */ |
| 1093 | new_ctx->mp_capable = 1; | 1139 | new_ctx->mp_capable = 1; |
| 1094 | new_ctx->fully_established = subflow_req->remote_key_valid; | ||
| 1095 | new_ctx->can_ack = subflow_req->remote_key_valid; | ||
| 1096 | new_ctx->remote_key = subflow_req->remote_key; | ||
| 1097 | new_ctx->local_key = subflow_req->local_key; | 1140 | new_ctx->local_key = subflow_req->local_key; |
| 1098 | new_ctx->token = subflow_req->token; | 1141 | new_ctx->token = subflow_req->token; |
| 1099 | new_ctx->ssn_offset = subflow_req->ssn_offset; | 1142 | new_ctx->ssn_offset = subflow_req->ssn_offset; |
| @@ -86,7 +86,8 @@ find_set_type(const char *name, u8 family, u8 revision) · 85 unmodified lines | |||
| 86 | { | 86 | { |
| 87 | struct ip_set_type *type; | 87 | struct ip_set_type *type; |
| 88 | 88 | ||
| 89 | list_for_each_entry_rcu(type, &ip_set_type_list, list) | 89 | list_for_each_entry_rcu(type, &ip_set_type_list, list, |
| 90 | lockdep_is_held(&ip_set_type_mutex)) | ||
| 90 | if (STRNCMP(type->name, name) && | 91 | if (STRNCMP(type->name, name) && |
| 91 | (type->family == family || | 92 | (type->family == family || |
| 92 | type->family == NFPROTO_UNSPEC) && | 93 | type->family == NFPROTO_UNSPEC) && |
| @@ -421,10 +421,12 @@ void nf_flow_table_offload_del_cb(struct nf_flowtable *flow_table, · 420 unmodified lines | |||
| 421 | 421 | ||
| 422 | down_write(&flow_table->flow_block_lock); | 422 | down_write(&flow_table->flow_block_lock); |
| 423 | block_cb = flow_block_cb_lookup(block, cb, cb_priv); | 423 | block_cb = flow_block_cb_lookup(block, cb, cb_priv); |
| 424 | if (block_cb) | 424 | if (block_cb) { |
| 425 | list_del(&block_cb->list); | 425 | list_del(&block_cb->list); |
| 426 | else | 426 | flow_block_cb_free(block_cb); |
| 427 | } else { | ||
| 427 | WARN_ON(true); | 428 | WARN_ON(true); |
| 429 | } | ||
| 428 | up_write(&flow_table->flow_block_lock); | 430 | up_write(&flow_table->flow_block_lock); |
| 429 | } | 431 | } |
| 430 | EXPORT_SYMBOL_GPL(nf_flow_table_offload_del_cb); | 432 | EXPORT_SYMBOL_GPL(nf_flow_table_offload_del_cb); |
| @@ -1035,8 +1035,8 @@ int nf_nat_inet_register_fn(struct net *net, const struct nf_hook_ops *ops) · 1034 unmodified lines | |||
| 1035 | ret = nf_nat_register_fn(net, NFPROTO_IPV4, ops, nf_nat_ipv4_ops, | 1035 | ret = nf_nat_register_fn(net, NFPROTO_IPV4, ops, nf_nat_ipv4_ops, |
| 1036 | ARRAY_SIZE(nf_nat_ipv4_ops)); | 1036 | ARRAY_SIZE(nf_nat_ipv4_ops)); |
| 1037 | if (ret) | 1037 | if (ret) |
| 1038 | nf_nat_ipv6_unregister_fn(net, ops); | 1038 | nf_nat_unregister_fn(net, NFPROTO_IPV6, ops, |
| 1039 | 1039 | ARRAY_SIZE(nf_nat_ipv6_ops)); | |
| 1040 | return ret; | 1040 | return ret; |
| 1041 | } | 1041 | } |
| 1042 | EXPORT_SYMBOL_GPL(nf_nat_inet_register_fn); | 1042 | EXPORT_SYMBOL_GPL(nf_nat_inet_register_fn); |
| @@ -3542,6 +3542,7 @@ cont: · 3541 unmodified lines | |||
| 3542 | continue; | 3542 | continue; |
| 3543 | if (!strcmp(set->name, i->name)) { | 3543 | if (!strcmp(set->name, i->name)) { |
| 3544 | kfree(set->name); | 3544 | kfree(set->name); |
| 3545 | set->name = NULL; | ||
| 3545 | return -ENFILE; | 3546 | return -ENFILE; |
| 3546 | } | 3547 | } |
| 3547 | } | 3548 | } |
| @@ -3961,8 +3962,8 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk, · 413 unmodified lines | |||
| 3961 | if (flags & ~(NFT_SET_ANONYMOUS | NFT_SET_CONSTANT | | 3962 | if (flags & ~(NFT_SET_ANONYMOUS | NFT_SET_CONSTANT | |
| 3962 | NFT_SET_INTERVAL | NFT_SET_TIMEOUT | | 3963 | NFT_SET_INTERVAL | NFT_SET_TIMEOUT | |
| 3963 | NFT_SET_MAP | NFT_SET_EVAL | | 3964 | NFT_SET_MAP | NFT_SET_EVAL | |
| 3964 | NFT_SET_OBJECT)) | 3965 | NFT_SET_OBJECT | NFT_SET_CONCAT)) |
| 3965 | return -EINVAL; | 3966 | return -EOPNOTSUPP; |
| 3966 | /* Only one of these operations is supported */ | 3967 | /* Only one of these operations is supported */ |
| 3967 | if ((flags & (NFT_SET_MAP | NFT_SET_OBJECT)) == | 3968 | if ((flags & (NFT_SET_MAP | NFT_SET_OBJECT)) == |
| 3968 | (NFT_SET_MAP | NFT_SET_OBJECT)) | 3969 | (NFT_SET_MAP | NFT_SET_OBJECT)) |
| @@ -4000,7 +4001,7 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk, · 31 unmodified lines | |||
| 4000 | objtype = ntohl(nla_get_be32(nla[NFTA_SET_OBJ_TYPE])); | 4001 | objtype = ntohl(nla_get_be32(nla[NFTA_SET_OBJ_TYPE])); |
| 4001 | if (objtype == NFT_OBJECT_UNSPEC || | 4002 | if (objtype == NFT_OBJECT_UNSPEC || |
| 4002 | objtype > NFT_OBJECT_MAX) | 4003 | objtype > NFT_OBJECT_MAX) |
| 4003 | return -EINVAL; | 4004 | return -EOPNOTSUPP; |
| 4004 | } else if (flags & NFT_SET_OBJECT) | 4005 | } else if (flags & NFT_SET_OBJECT) |
| 4005 | return -EINVAL; | 4006 | return -EINVAL; |
| 4006 | else | 4007 | else |
| @@ -29,7 +29,7 @@ void nft_lookup_eval(const struct nft_expr *expr, · 28 unmodified lines | |||
| 29 | { | 29 | { |
| 30 | const struct nft_lookup *priv = nft_expr_priv(expr); | 30 | const struct nft_lookup *priv = nft_expr_priv(expr); |
| 31 | const struct nft_set *set = priv->set; | 31 | const struct nft_set *set = priv->set; |
| 32 | const struct nft_set_ext *ext; | 32 | const struct nft_set_ext *ext = NULL; |
| 33 | bool found; | 33 | bool found; |
| 34 | 34 | ||
| 35 | found = set->ops->lookup(nft_net(pkt), set, ®s->data[priv->sreg], | 35 | found = set->ops->lookup(nft_net(pkt), set, ®s->data[priv->sreg], |
| @@ -39,11 +39,13 @@ void nft_lookup_eval(const struct nft_expr *expr, · 3 unmodified lines | |||
| 39 | return; | 39 | return; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | if (set->flags & NFT_SET_MAP) | 42 | if (ext) { |
| 43 | nft_data_copy(®s->data[priv->dreg], | 43 | if (set->flags & NFT_SET_MAP) |
| 44 | nft_set_ext_data(ext), set->dlen); | 44 | nft_data_copy(®s->data[priv->dreg], |
| 45 | nft_set_ext_data(ext), set->dlen); | ||
| 45 | 46 | ||
| 46 | nft_set_elem_update_expr(ext, regs, pkt); | 47 | nft_set_elem_update_expr(ext, regs, pkt); |
| 48 | } | ||
| 47 | } | 49 | } |
| 48 | 50 | ||
| 49 | static const struct nla_policy nft_lookup_policy[NFTA_LOOKUP_MAX + 1] = { | 51 | static const struct nla_policy nft_lookup_policy[NFTA_LOOKUP_MAX + 1] = { |
| @@ -81,7 +81,6 @@ static bool nft_bitmap_lookup(const struct net *net, const struct nft_set *set, · 80 unmodified lines | |||
| 81 | u32 idx, off; | 81 | u32 idx, off; |
| 82 | 82 | ||
| 83 | nft_bitmap_location(set, key, &idx, &off); | 83 | nft_bitmap_location(set, key, &idx, &off); |
| 84 | *ext = NULL; | ||
| 85 | 84 | ||
| 86 | return nft_bitmap_active(priv->bitmap, idx, off, genmask); | 85 | return nft_bitmap_active(priv->bitmap, idx, off, genmask); |
| 87 | } | 86 | } |
| @@ -218,27 +218,26 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 217 unmodified lines | |||
| 218 | 218 | ||
| 219 | /* Detect overlaps as we descend the tree. Set the flag in these cases: | 219 | /* Detect overlaps as we descend the tree. Set the flag in these cases: |
| 220 | * | 220 | * |
| 221 | * a1. |__ _ _? >|__ _ _ (insert start after existing start) | 221 | * a1. _ _ __>| ?_ _ __| (insert end before existing end) |
| 222 | * a2. _ _ __>| ?_ _ __| (insert end before existing end) | 222 | * a2. _ _ ___| ?_ _ _>| (insert end after existing end) |
| 223 | * a3. _ _ ___| ?_ _ _>| (insert end after existing end) | 223 | * a3. _ _ ___? >|_ _ __| (insert start before existing end) |
| 224 | * a4. >|__ _ _ _ _ __| (insert start before existing end) | ||
| 225 | * | 224 | * |
| 226 | * and clear it later on, as we eventually reach the points indicated by | 225 | * and clear it later on, as we eventually reach the points indicated by |
| 227 | * '?' above, in the cases described below. We'll always meet these | 226 | * '?' above, in the cases described below. We'll always meet these |
| 228 | * later, locally, due to tree ordering, and overlaps for the intervals | 227 | * later, locally, due to tree ordering, and overlaps for the intervals |
| 229 | * that are the closest together are always evaluated last. | 228 | * that are the closest together are always evaluated last. |
| 230 | * | 229 | * |
| 231 | * b1. |__ _ _! >|__ _ _ (insert start after existing end) | 230 | * b1. _ _ __>| !_ _ __| (insert end before existing start) |
| 232 | * b2. _ _ __>| !_ _ __| (insert end before existing start) | 231 | * b2. _ _ ___| !_ _ _>| (insert end after existing start) |
| 233 | * b3. !_____>| (insert end after existing start) | 232 | * b3. _ _ ___! >|_ _ __| (insert start after existing end) |
| 234 | * | 233 | * |
| 235 | * Case a4. resolves to b1.: | 234 | * Case a3. resolves to b3.: |
| 236 | * - if the inserted start element is the leftmost, because the '0' | 235 | * - if the inserted start element is the leftmost, because the '0' |
| 237 | * element in the tree serves as end element | 236 | * element in the tree serves as end element |
| 238 | * - otherwise, if an existing end is found. Note that end elements are | 237 | * - otherwise, if an existing end is found. Note that end elements are |
| 239 | * always inserted after corresponding start elements. | 238 | * always inserted after corresponding start elements. |
| 240 | * | 239 | * |
| 241 | * For a new, rightmost pair of elements, we'll hit cases b1. and b3., | 240 | * For a new, rightmost pair of elements, we'll hit cases b3. and b2., |
| 242 | * in that order. | 241 | * in that order. |
| 243 | * | 242 | * |
| 244 | * The flag is also cleared in two special cases: | 243 | * The flag is also cleared in two special cases: |
| @@ -262,9 +261,9 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 17 unmodified lines | |||
| 262 | p = &parent->rb_left; | 261 | p = &parent->rb_left; |
| 263 | 262 | ||
| 264 | if (nft_rbtree_interval_start(new)) { | 263 | if (nft_rbtree_interval_start(new)) { |
| 265 | overlap = nft_rbtree_interval_start(rbe) && | 264 | if (nft_rbtree_interval_end(rbe) && |
| 266 | nft_set_elem_active(&rbe->ext, | 265 | nft_set_elem_active(&rbe->ext, genmask)) |
| 267 | genmask); | 266 | overlap = false; |
| 268 | } else { | 267 | } else { |
| 269 | overlap = nft_rbtree_interval_end(rbe) && | 268 | overlap = nft_rbtree_interval_end(rbe) && |
| 270 | nft_set_elem_active(&rbe->ext, | 269 | nft_set_elem_active(&rbe->ext, |
| @@ -346,6 +346,9 @@ static int idletimer_tg_checkentry_v1(const struct xt_tgchk_param *par) · 345 unmodified lines | |||
| 346 | 346 | ||
| 347 | pr_debug("checkentry targinfo%s\n", info->label); | 347 | pr_debug("checkentry targinfo%s\n", info->label); |
| 348 | 348 | ||
| 349 | if (info->send_nl_msg) | ||
| 350 | return -EOPNOTSUPP; | ||
| 351 | |||
| 349 | ret = idletimer_tg_helper((struct idletimer_tg_info *)info); | 352 | ret = idletimer_tg_helper((struct idletimer_tg_info *)info); |
| 350 | if(ret < 0) | 353 | if(ret < 0) |
| 351 | { | 354 | { |
| @@ -14,6 +14,6 @@ config NETLABEL · 13 unmodified lines | |||
| 14 | Documentation/netlabel as well as the NetLabel SourceForge project | 14 | Documentation/netlabel as well as the NetLabel SourceForge project |
| 15 | for configuration tools and additional documentation. | 15 | for configuration tools and additional documentation. |
| 16 | 16 | ||
| 17 | * http://netlabel.sf.net | 17 | * https://github.com/netlabel/netlabel_tools |
| 18 | 18 | ||
| 19 | If you are unsure, say N. | 19 | If you are unsure, say N. |
| @@ -208,6 +208,7 @@ static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic, · 207 unmodified lines | |||
| 208 | /* refcount initialized at 1 */ | 208 | /* refcount initialized at 1 */ |
| 209 | spin_unlock_bh(&nr_node_list_lock); | 209 | spin_unlock_bh(&nr_node_list_lock); |
| 210 | 210 | ||
| 211 | nr_neigh_put(nr_neigh); | ||
| 211 | return 0; | 212 | return 0; |
| 212 | } | 213 | } |
| 213 | nr_node_lock(nr_node); | 214 | nr_node_lock(nr_node); |
| @@ -1895,7 +1895,8 @@ static void ovs_ct_limit_exit(struct net *net, struct ovs_net *ovs_net) · 1894 unmodified lines | |||
| 1895 | struct hlist_head *head = &info->limits[i]; | 1895 | struct hlist_head *head = &info->limits[i]; |
| 1896 | struct ovs_ct_limit *ct_limit; | 1896 | struct ovs_ct_limit *ct_limit; |
| 1897 | 1897 | ||
| 1898 | hlist_for_each_entry_rcu(ct_limit, head, hlist_node) | 1898 | hlist_for_each_entry_rcu(ct_limit, head, hlist_node, |
| 1899 | lockdep_ovsl_is_held()) | ||
| 1899 | kfree_rcu(ct_limit, rcu); | 1900 | kfree_rcu(ct_limit, rcu); |
| 1900 | } | 1901 | } |
| 1901 | kfree(ovs_net->ct_limit_info->limits); | 1902 | kfree(ovs_net->ct_limit_info->limits); |
| @@ -2466,8 +2466,10 @@ static void __net_exit ovs_exit_net(struct net *dnet) · 2465 unmodified lines | |||
| 2466 | struct net *net; | 2466 | struct net *net; |
| 2467 | LIST_HEAD(head); | 2467 | LIST_HEAD(head); |
| 2468 | 2468 | ||
| 2469 | ovs_ct_exit(dnet); | ||
| 2470 | ovs_lock(); | 2469 | ovs_lock(); |
| 2470 | |||
| 2471 | ovs_ct_exit(dnet); | ||
| 2472 | |||
| 2471 | list_for_each_entry_safe(dp, dp_next, &ovs_net->dps, list_node) | 2473 | list_for_each_entry_safe(dp, dp_next, &ovs_net->dps, list_node) |
| 2472 | __dp_destroy(dp); | 2474 | __dp_destroy(dp); |
| 2473 | 2475 | ||
| @@ -906,20 +906,21 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) · 905 unmodified lines | |||
| 906 | 906 | ||
| 907 | node = NULL; | 907 | node = NULL; |
| 908 | if (addr->sq_node == QRTR_NODE_BCAST) { | 908 | if (addr->sq_node == QRTR_NODE_BCAST) { |
| 909 | enqueue_fn = qrtr_bcast_enqueue; | 909 | if (addr->sq_port != QRTR_PORT_CTRL && |
| 910 | if (addr->sq_port != QRTR_PORT_CTRL) { | 910 | qrtr_local_nid != QRTR_NODE_BCAST) { |
| 911 | release_sock(sk); | 911 | release_sock(sk); |
| 912 | return -ENOTCONN; | 912 | return -ENOTCONN; |
| 913 | } | 913 | } |
| 914 | enqueue_fn = qrtr_bcast_enqueue; | ||
| 914 | } else if (addr->sq_node == ipc->us.sq_node) { | 915 | } else if (addr->sq_node == ipc->us.sq_node) { |
| 915 | enqueue_fn = qrtr_local_enqueue; | 916 | enqueue_fn = qrtr_local_enqueue; |
| 916 | } else { | 917 | } else { |
| 917 | enqueue_fn = qrtr_node_enqueue; | ||
| 918 | node = qrtr_node_lookup(addr->sq_node); | 918 | node = qrtr_node_lookup(addr->sq_node); |
| 919 | if (!node) { | 919 | if (!node) { |
| 920 | release_sock(sk); | 920 | release_sock(sk); |
| 921 | return -ECONNRESET; | 921 | return -ECONNRESET; |
| 922 | } | 922 | } |
| 923 | enqueue_fn = qrtr_node_enqueue; | ||
| 923 | } | 924 | } |
| 924 | 925 | ||
| 925 | plen = (len + 3) & ~3; | 926 | plen = (len + 3) & ~3; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2006 Oracle. All rights reserved. | 2 | * Copyright (c) 2006, 2020 Oracle and/or its affiliates. |
| 3 | * | 3 | * |
| 4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
| 5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
| @@ -162,12 +162,12 @@ static void rds_message_purge(struct rds_message *rm) · 156 unmodified lines | |||
| 162 | if (rm->rdma.op_active) | 162 | if (rm->rdma.op_active) |
| 163 | rds_rdma_free_op(&rm->rdma); | 163 | rds_rdma_free_op(&rm->rdma); |
| 164 | if (rm->rdma.op_rdma_mr) | 164 | if (rm->rdma.op_rdma_mr) |
| 165 | rds_mr_put(rm->rdma.op_rdma_mr); | 165 | kref_put(&rm->rdma.op_rdma_mr->r_kref, __rds_put_mr_final); |
| 166 | 166 | ||
| 167 | if (rm->atomic.op_active) | 167 | if (rm->atomic.op_active) |
| 168 | rds_atomic_free_op(&rm->atomic); | 168 | rds_atomic_free_op(&rm->atomic); |
| 169 | if (rm->atomic.op_rdma_mr) | 169 | if (rm->atomic.op_rdma_mr) |
| 170 | rds_mr_put(rm->atomic.op_rdma_mr); | 170 | kref_put(&rm->atomic.op_rdma_mr->r_kref, __rds_put_mr_final); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | void rds_message_put(struct rds_message *rm) | 173 | void rds_message_put(struct rds_message *rm) |
| @@ -308,26 +308,20 @@ out: · 134 unmodified lines | |||
| 308 | /* | 308 | /* |
| 309 | * RDS ops use this to grab SG entries from the rm's sg pool. | 309 | * RDS ops use this to grab SG entries from the rm's sg pool. |
| 310 | */ | 310 | */ |
| 311 | struct scatterlist *rds_message_alloc_sgs(struct rds_message *rm, int nents, | 311 | struct scatterlist *rds_message_alloc_sgs(struct rds_message *rm, int nents) |
| 312 | int *ret) | ||
| 313 | { | 312 | { |
| 314 | struct scatterlist *sg_first = (struct scatterlist *) &rm[1]; | 313 | struct scatterlist *sg_first = (struct scatterlist *) &rm[1]; |
| 315 | struct scatterlist *sg_ret; | 314 | struct scatterlist *sg_ret; |
| 316 | 315 | ||
| 317 | if (WARN_ON(!ret)) | ||
| 318 | return NULL; | ||
| 319 | |||
| 320 | if (nents <= 0) { | 316 | if (nents <= 0) { |
| 321 | pr_warn("rds: alloc sgs failed! nents <= 0\n"); | 317 | pr_warn("rds: alloc sgs failed! nents <= 0\n"); |
| 322 | *ret = -EINVAL; | 318 | return ERR_PTR(-EINVAL); |
| 323 | return NULL; | ||
| 324 | } | 319 | } |
| 325 | 320 | ||
| 326 | if (rm->m_used_sgs + nents > rm->m_total_sgs) { | 321 | if (rm->m_used_sgs + nents > rm->m_total_sgs) { |
| 327 | pr_warn("rds: alloc sgs failed! total %d used %d nents %d\n", | 322 | pr_warn("rds: alloc sgs failed! total %d used %d nents %d\n", |
| 328 | rm->m_total_sgs, rm->m_used_sgs, nents); | 323 | rm->m_total_sgs, rm->m_used_sgs, nents); |
| 329 | *ret = -ENOMEM; | 324 | return ERR_PTR(-ENOMEM); |
| 330 | return NULL; | ||
| 331 | } | 325 | } |
| 332 | 326 | ||
| 333 | sg_ret = &sg_first[rm->m_used_sgs]; | 327 | sg_ret = &sg_first[rm->m_used_sgs]; |
| @@ -343,7 +337,6 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in · 9 unmodified lines | |||
| 343 | unsigned int i; | 337 | unsigned int i; |
| 344 | int num_sgs = DIV_ROUND_UP(total_len, PAGE_SIZE); | 338 | int num_sgs = DIV_ROUND_UP(total_len, PAGE_SIZE); |
| 345 | int extra_bytes = num_sgs * sizeof(struct scatterlist); | 339 | int extra_bytes = num_sgs * sizeof(struct scatterlist); |
| 346 | int ret; | ||
| 347 | 340 | ||
| 348 | rm = rds_message_alloc(extra_bytes, GFP_NOWAIT); | 341 | rm = rds_message_alloc(extra_bytes, GFP_NOWAIT); |
| 349 | if (!rm) | 342 | if (!rm) |
| @@ -352,10 +345,10 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in · 2 unmodified lines | |||
| 352 | set_bit(RDS_MSG_PAGEVEC, &rm->m_flags); | 345 | set_bit(RDS_MSG_PAGEVEC, &rm->m_flags); |
| 353 | rm->m_inc.i_hdr.h_len = cpu_to_be32(total_len); | 346 | rm->m_inc.i_hdr.h_len = cpu_to_be32(total_len); |
| 354 | rm->data.op_nents = DIV_ROUND_UP(total_len, PAGE_SIZE); | 347 | rm->data.op_nents = DIV_ROUND_UP(total_len, PAGE_SIZE); |
| 355 | rm->data.op_sg = rds_message_alloc_sgs(rm, num_sgs, &ret); | 348 | rm->data.op_sg = rds_message_alloc_sgs(rm, num_sgs); |
| 356 | if (!rm->data.op_sg) { | 349 | if (IS_ERR(rm->data.op_sg)) { |
| 357 | rds_message_put(rm); | 350 | rds_message_put(rm); |
| 358 | return ERR_PTR(ret); | 351 | return ERR_CAST(rm->data.op_sg); |
| 359 | } | 352 | } |
| 360 | 353 | ||
| 361 | for (i = 0; i < rm->data.op_nents; ++i) { | 354 | for (i = 0; i < rm->data.op_nents; ++i) { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2007, 2017 Oracle and/or its affiliates. All rights reserved. | 2 | * Copyright (c) 2007, 2020 Oracle and/or its affiliates. |
176 more lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 54 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 13 lines aren’t shown here.
This diff is large: its 27 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 18 lines aren’t shown here.
This diff is large: its 9 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 58 lines aren’t shown here.
This diff is large: its 19 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 25 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 12 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 19 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 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 255 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 15 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 12 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 70 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 27 lines aren’t shown here.
This diff is large: its 218 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 273 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 151 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 110 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 32 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 44 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 11 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 28 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 77 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 29 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 239 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 53 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 72 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 768 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 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 163 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 112 lines aren’t shown here.
This diff is large: its 1557 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 42 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 44 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 7 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 27 lines aren’t shown here.
This diff is large: its 11 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 29 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 13 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 19 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
Empty file added.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.