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

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Cross-merge networking fixes after downstream PR (net-6.15-rc4).

This pull includes wireless and a fix to vxlan which isn't
in Linus's tree just yet. The latter creates with a silent conflict
/ build breakage, so merging it now to avoid causing problems.

drivers/net/vxlan/vxlan_vnifilter.c
094adad91310 ("vxlan: Use a single lock to protect the FDB table")
087a9eb9e597 ("vxlan: vnifilter: Fix unlocked deletion of default FDB entry")
https://lore.kernel.org/20250423145131.513029-1-idosch@nvidia.com

No "normal" conflicts, or adjacent changes.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+3641 -2126
+37 -4
.clang-format
··· 92 92 - '__rq_for_each_bio' 93 93 - '__shost_for_each_device' 94 94 - '__sym_for_each' 95 + - '_for_each_counter' 95 96 - 'apei_estatus_for_each_section' 96 97 - 'ata_for_each_dev' 97 98 - 'ata_for_each_link' ··· 142 141 - 'damon_for_each_target_safe' 143 142 - 'damos_for_each_filter' 144 143 - 'damos_for_each_filter_safe' 144 + - 'damos_for_each_ops_filter' 145 + - 'damos_for_each_ops_filter_safe' 145 146 - 'damos_for_each_quota_goal' 146 147 - 'damos_for_each_quota_goal_safe' 147 148 - 'data__for_each_file' 148 149 - 'data__for_each_file_new' 149 150 - 'data__for_each_file_start' 151 + - 'def_for_each_cpu' 150 152 - 'device_for_each_child_node' 151 153 - 'device_for_each_child_node_scoped' 152 154 - 'dma_fence_array_for_each' ··· 180 176 - 'drm_for_each_privobj' 181 177 - 'drm_gem_for_each_gpuvm_bo' 182 178 - 'drm_gem_for_each_gpuvm_bo_safe' 179 + - 'drm_gpusvm_for_each_range' 183 180 - 'drm_gpuva_for_each_op' 184 181 - 'drm_gpuva_for_each_op_from_reverse' 185 182 - 'drm_gpuva_for_each_op_reverse' ··· 221 216 - 'for_each_active_dev_scope' 222 217 - 'for_each_active_drhd_unit' 223 218 - 'for_each_active_iommu' 219 + - 'for_each_active_irq' 224 220 - 'for_each_active_route' 225 221 - 'for_each_aggr_pgid' 222 + - 'for_each_alloc_capable_rdt_resource' 226 223 - 'for_each_and_bit' 227 224 - 'for_each_andnot_bit' 228 225 - 'for_each_available_child_of_node' ··· 235 228 - 'for_each_btf_ext_rec' 236 229 - 'for_each_btf_ext_sec' 237 230 - 'for_each_bvec' 231 + - 'for_each_capable_rdt_resource' 238 232 - 'for_each_card_auxs' 239 233 - 'for_each_card_auxs_safe' 240 234 - 'for_each_card_components' ··· 249 241 - 'for_each_cgroup_storage_type' 250 242 - 'for_each_child_of_node' 251 243 - 'for_each_child_of_node_scoped' 244 + - 'for_each_child_of_node_with_prefix' 252 245 - 'for_each_clear_bit' 253 246 - 'for_each_clear_bit_from' 254 247 - 'for_each_clear_bitrange' ··· 305 296 - 'for_each_group_member_head' 306 297 - 'for_each_hstate' 307 298 - 'for_each_hwgpio' 299 + - 'for_each_hwgpio_in_range' 308 300 - 'for_each_if' 309 301 - 'for_each_inject_fn' 310 302 - 'for_each_insn' ··· 314 304 - 'for_each_intid' 315 305 - 'for_each_iommu' 316 306 - 'for_each_ip_tunnel_rcu' 307 + - 'for_each_irq_desc' 317 308 - 'for_each_irq_nr' 318 309 - 'for_each_lang' 319 310 - 'for_each_link_ch_maps' ··· 335 324 - 'for_each_missing_reg' 336 325 - 'for_each_mle_subelement' 337 326 - 'for_each_mod_mem_type' 327 + - 'for_each_mon_capable_rdt_resource' 328 + - 'for_each_mp_bvec' 338 329 - 'for_each_net' 339 330 - 'for_each_net_continue_reverse' 340 331 - 'for_each_net_rcu' ··· 364 351 - 'for_each_node_by_name' 365 352 - 'for_each_node_by_type' 366 353 - 'for_each_node_mask' 354 + - 'for_each_node_numadist' 367 355 - 'for_each_node_state' 368 356 - 'for_each_node_with_cpus' 369 357 - 'for_each_node_with_property' ··· 373 359 - 'for_each_of_allnodes' 374 360 - 'for_each_of_allnodes_from' 375 361 - 'for_each_of_cpu_node' 362 + - 'for_each_of_graph_port' 363 + - 'for_each_of_graph_port_endpoint' 376 364 - 'for_each_of_pci_range' 377 365 - 'for_each_old_connector_in_state' 378 366 - 'for_each_old_crtc_in_state' ··· 388 372 - 'for_each_oldnew_plane_in_state_reverse' 389 373 - 'for_each_oldnew_private_obj_in_state' 390 374 - 'for_each_online_cpu' 375 + - 'for_each_online_cpu_wrap' 391 376 - 'for_each_online_node' 392 377 - 'for_each_online_pgdat' 393 378 - 'for_each_or_bit' 379 + - 'for_each_page_ext' 394 380 - 'for_each_path' 395 381 - 'for_each_pci_bridge' 396 382 - 'for_each_pci_dev' ··· 400 382 - 'for_each_physmem_range' 401 383 - 'for_each_populated_zone' 402 384 - 'for_each_possible_cpu' 385 + - 'for_each_possible_cpu_wrap' 403 386 - 'for_each_present_blessed_reg' 404 387 - 'for_each_present_cpu' 388 + - 'for_each_present_section_nr' 405 389 - 'for_each_prime_number' 406 390 - 'for_each_prime_number_from' 407 391 - 'for_each_probe_cache_entry' ··· 416 396 - 'for_each_prop_dlc_cpus' 417 397 - 'for_each_prop_dlc_platforms' 418 398 - 'for_each_property_of_node' 399 + - 'for_each_rdt_resource' 419 400 - 'for_each_reg' 420 401 - 'for_each_reg_filtered' 421 402 - 'for_each_reloc' ··· 455 434 - 'for_each_subelement_id' 456 435 - 'for_each_sublist' 457 436 - 'for_each_subsystem' 437 + - 'for_each_suite' 458 438 - 'for_each_supported_activate_fn' 459 439 - 'for_each_supported_inject_fn' 460 440 - 'for_each_sym' 461 - - 'for_each_test' 462 441 - 'for_each_thread' 463 442 - 'for_each_token' 464 443 - 'for_each_unicast_dest_pgid' ··· 520 499 - 'idr_for_each_entry_continue' 521 500 - 'idr_for_each_entry_continue_ul' 522 501 - 'idr_for_each_entry_ul' 502 + - 'iio_for_each_active_channel' 523 503 - 'in_dev_for_each_ifa_rcu' 524 504 - 'in_dev_for_each_ifa_rtnl' 505 + - 'in_dev_for_each_ifa_rtnl_net' 525 506 - 'inet_bind_bucket_for_each' 526 507 - 'interval_tree_for_each_span' 527 508 - 'intlist__for_each_entry' ··· 565 542 - 'list_for_each_prev' 566 543 - 'list_for_each_prev_safe' 567 544 - 'list_for_each_rcu' 568 - - 'list_for_each_reverse' 569 545 - 'list_for_each_safe' 570 546 - 'llist_for_each' 571 547 - 'llist_for_each_entry' ··· 574 552 - 'map__for_each_symbol' 575 553 - 'map__for_each_symbol_by_name' 576 554 - 'mas_for_each' 555 + - 'mas_for_each_rev' 577 556 - 'mci_for_each_dimm' 578 557 - 'media_device_for_each_entity' 579 558 - 'media_device_for_each_intf' ··· 584 561 - 'media_pipeline_for_each_entity' 585 562 - 'media_pipeline_for_each_pad' 586 563 - 'mlx5_lag_for_each_peer_mdev' 564 + - 'mptcp_for_each_subflow' 587 565 - 'msi_domain_for_each_desc' 588 566 - 'msi_for_each_desc' 589 567 - 'mt_for_each' 568 + - 'nanddev_io_for_each_block' 590 569 - 'nanddev_io_for_each_page' 570 + - 'neigh_for_each_in_bucket' 571 + - 'neigh_for_each_in_bucket_rcu' 572 + - 'neigh_for_each_in_bucket_safe' 591 573 - 'netdev_for_each_lower_dev' 592 574 - 'netdev_for_each_lower_private' 593 575 - 'netdev_for_each_lower_private_rcu' ··· 632 604 - 'perf_evlist__for_each_entry_safe' 633 605 - 'perf_evlist__for_each_evsel' 634 606 - 'perf_evlist__for_each_mmap' 607 + - 'perf_evsel_for_each_per_thread_period_safe' 635 608 - 'perf_hpp_list__for_each_format' 636 609 - 'perf_hpp_list__for_each_format_safe' 637 610 - 'perf_hpp_list__for_each_sort_list' 638 611 - 'perf_hpp_list__for_each_sort_list_safe' 639 - - 'perf_tool_event__for_each_event' 640 612 - 'plist_for_each' 641 613 - 'plist_for_each_continue' 642 614 - 'plist_for_each_entry' ··· 655 627 - 'rdma_for_each_block' 656 628 - 'rdma_for_each_port' 657 629 - 'rdma_umem_for_each_dma_block' 658 - - 'resort_rb__for_each_entry' 659 630 - 'resource_list_for_each_entry' 660 631 - 'resource_list_for_each_entry_safe' 661 632 - 'rhl_for_each_entry_rcu' ··· 685 658 - 'shost_for_each_device' 686 659 - 'sk_for_each' 687 660 - 'sk_for_each_bound' 661 + - 'sk_for_each_bound_safe' 688 662 - 'sk_for_each_entry_offset_rcu' 689 663 - 'sk_for_each_from' 690 664 - 'sk_for_each_rcu' ··· 708 680 - 'tb_property_for_each' 709 681 - 'tcf_act_for_each_action' 710 682 - 'tcf_exts_for_each_action' 683 + - 'test_suite__for_each_test_case' 684 + - 'tool_pmu__for_each_event' 685 + - 'ttm_bo_lru_for_each_reserved_guarded' 711 686 - 'ttm_resource_manager_for_each_res' 687 + - 'udp_lrpa_for_each_entry_rcu' 712 688 - 'udp_portaddr_for_each_entry' 713 689 - 'udp_portaddr_for_each_entry_rcu' 714 690 - 'usb_hub_for_each_child' ··· 723 691 - 'v4l2_m2m_for_each_src_buf_safe' 724 692 - 'virtio_device_for_each_vq' 725 693 - 'while_for_each_ftrace_op' 694 + - 'workloads__for_each' 726 695 - 'xa_for_each' 727 696 - 'xa_for_each_marked' 728 697 - 'xa_for_each_range'
+4
CREDITS
··· 2071 2071 S: Santa Clara, CA 95051 2072 2072 S: USA 2073 2073 2074 + N: Joonsoo Kim 2075 + E: iamjoonsoo.kim@lge.com 2076 + D: Slab allocators 2077 + 2074 2078 N: Kukjin Kim 2075 2079 E: kgene@kernel.org 2076 2080 D: Samsung S3C, S5P and Exynos ARM architectures
+1 -1
Documentation/ABI/stable/sysfs-block
··· 77 77 78 78 What: /sys/block/<disk>/diskseq 79 79 Date: February 2021 80 - Contact: Matteo Croce <mcroce@microsoft.com> 80 + Contact: Matteo Croce <teknoraver@meta.com> 81 81 Description: 82 82 The /sys/block/<disk>/diskseq files reports the disk 83 83 sequence number, which is a monotonically increasing
+5 -5
Documentation/ABI/testing/sysfs-kernel-reboot
··· 1 1 What: /sys/kernel/reboot 2 2 Date: November 2020 3 3 KernelVersion: 5.11 4 - Contact: Matteo Croce <mcroce@microsoft.com> 4 + Contact: Matteo Croce <teknoraver@meta.com> 5 5 Description: Interface to set the kernel reboot behavior, similarly to 6 6 what can be done via the reboot= cmdline option. 7 7 (see Documentation/admin-guide/kernel-parameters.txt) ··· 9 9 What: /sys/kernel/reboot/mode 10 10 Date: November 2020 11 11 KernelVersion: 5.11 12 - Contact: Matteo Croce <mcroce@microsoft.com> 12 + Contact: Matteo Croce <teknoraver@meta.com> 13 13 Description: Reboot mode. Valid values are: cold warm hard soft gpio 14 14 15 15 What: /sys/kernel/reboot/type 16 16 Date: November 2020 17 17 KernelVersion: 5.11 18 - Contact: Matteo Croce <mcroce@microsoft.com> 18 + Contact: Matteo Croce <teknoraver@meta.com> 19 19 Description: Reboot type. Valid values are: bios acpi kbd triple efi pci 20 20 21 21 What: /sys/kernel/reboot/cpu 22 22 Date: November 2020 23 23 KernelVersion: 5.11 24 - Contact: Matteo Croce <mcroce@microsoft.com> 24 + Contact: Matteo Croce <teknoraver@meta.com> 25 25 Description: CPU number to use to reboot. 26 26 27 27 What: /sys/kernel/reboot/force 28 28 Date: November 2020 29 29 KernelVersion: 5.11 30 - Contact: Matteo Croce <mcroce@microsoft.com> 30 + Contact: Matteo Croce <teknoraver@meta.com> 31 31 Description: Don't wait for any other CPUs on reboot and 32 32 avoid anything that could hang. 33 33
+1 -1
Documentation/arch/riscv/hwprobe.rst
··· 51 51 * :c:macro:`RISCV_HWPROBE_KEY_MARCHID`: Contains the value of ``marchid``, as 52 52 defined by the RISC-V privileged architecture specification. 53 53 54 - * :c:macro:`RISCV_HWPROBE_KEY_MIMPLID`: Contains the value of ``mimplid``, as 54 + * :c:macro:`RISCV_HWPROBE_KEY_MIMPID`: Contains the value of ``mimpid``, as 55 55 defined by the RISC-V privileged architecture specification. 56 56 57 57 * :c:macro:`RISCV_HWPROBE_KEY_BASE_BEHAVIOR`: A bitmask containing the base
+1 -1
Documentation/power/runtime_pm.rst
··· 154 154 device in that case. If there is no idle callback, or if the callback returns 155 155 0, then the PM core will attempt to carry out a runtime suspend of the device, 156 156 also respecting devices configured for autosuspend. In essence this means a 157 - call to __pm_runtime_autosuspend() (do note that drivers needs to update the 157 + call to pm_runtime_autosuspend() (do note that drivers needs to update the 158 158 device last busy mark, pm_runtime_mark_last_busy(), to control the delay under 159 159 this circumstance). To prevent this (for example, if the callback routine has 160 160 started a delayed suspend), the routine must return a non-zero value. Negative
+57 -2
MAINTAINERS
··· 3191 3191 S: Maintained 3192 3192 F: drivers/clk/socfpga/ 3193 3193 3194 + ARM/SOCFPGA DWMAC GLUE LAYER 3195 + M: Maxime Chevallier <maxime.chevallier@bootlin.com> 3196 + S: Maintained 3197 + F: Documentation/devicetree/bindings/net/socfpga-dwmac.txt 3198 + F: drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c 3199 + 3194 3200 ARM/SOCFPGA EDAC BINDINGS 3195 3201 M: Matthew Gerlach <matthew.gerlach@altera.com> 3196 3202 S: Maintained ··· 7018 7012 S: Supported 7019 7013 W: https://rust-for-linux.com 7020 7014 T: git https://github.com/Rust-for-Linux/linux.git alloc-next 7015 + F: rust/helpers/dma.c 7021 7016 F: rust/kernel/dma.rs 7022 7017 F: samples/rust/rust_dma.rs 7023 7018 ··· 15514 15507 F: mm/numa_emulation.c 15515 15508 F: mm/numa_memblks.c 15516 15509 15510 + MEMORY MANAGEMENT - PAGE ALLOCATOR 15511 + M: Andrew Morton <akpm@linux-foundation.org> 15512 + R: Vlastimil Babka <vbabka@suse.cz> 15513 + R: Suren Baghdasaryan <surenb@google.com> 15514 + R: Michal Hocko <mhocko@suse.com> 15515 + R: Brendan Jackman <jackmanb@google.com> 15516 + R: Johannes Weiner <hannes@cmpxchg.org> 15517 + R: Zi Yan <ziy@nvidia.com> 15518 + L: linux-mm@kvack.org 15519 + S: Maintained 15520 + F: mm/compaction.c 15521 + F: mm/page_alloc.c 15522 + F: include/linux/gfp.h 15523 + F: include/linux/compaction.h 15524 + 15517 15525 MEMORY MANAGEMENT - SECRETMEM 15518 15526 M: Andrew Morton <akpm@linux-foundation.org> 15519 15527 M: Mike Rapoport <rppt@kernel.org> ··· 15556 15534 M: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> 15557 15535 R: Vlastimil Babka <vbabka@suse.cz> 15558 15536 R: Jann Horn <jannh@google.com> 15537 + R: Pedro Falcato <pfalcato@suse.de> 15559 15538 L: linux-mm@kvack.org 15560 15539 S: Maintained 15561 15540 W: http://www.linux-mm.org 15562 15541 T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 15542 + F: include/trace/events/mmap.h 15563 15543 F: mm/mlock.c 15564 15544 F: mm/mmap.c 15565 15545 F: mm/mprotect.c ··· 15571 15547 F: mm/vma.h 15572 15548 F: mm/vma_internal.h 15573 15549 F: tools/testing/vma/ 15550 + 15551 + MEMORY MAPPING - LOCKING 15552 + M: Andrew Morton <akpm@linux-foundation.org> 15553 + M: Suren Baghdasaryan <surenb@google.com> 15554 + M: Liam R. Howlett <Liam.Howlett@oracle.com> 15555 + M: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> 15556 + R: Vlastimil Babka <vbabka@suse.cz> 15557 + R: Shakeel Butt <shakeel.butt@linux.dev> 15558 + L: linux-mm@kvack.org 15559 + S: Maintained 15560 + W: http://www.linux-mm.org 15561 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 15562 + F: Documentation/mm/process_addrs.rst 15563 + F: include/linux/mmap_lock.h 15564 + F: include/trace/events/mmap_lock.h 15565 + F: mm/mmap_lock.c 15566 + 15567 + MEMORY MAPPING - MADVISE (MEMORY ADVICE) 15568 + M: Andrew Morton <akpm@linux-foundation.org> 15569 + M: Liam R. Howlett <Liam.Howlett@oracle.com> 15570 + M: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> 15571 + M: David Hildenbrand <david@redhat.com> 15572 + R: Vlastimil Babka <vbabka@suse.cz> 15573 + R: Jann Horn <jannh@google.com> 15574 + L: linux-mm@kvack.org 15575 + S: Maintained 15576 + W: http://www.linux-mm.org 15577 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 15578 + F: include/uapi/asm-generic/mman-common.h 15579 + F: mm/madvise.c 15574 15580 15575 15581 MEMORY TECHNOLOGY DEVICES (MTD) 15576 15582 M: Miquel Raynal <miquel.raynal@bootlin.com> ··· 16809 16755 F: drivers/connector/ 16810 16756 F: drivers/net/ 16811 16757 F: drivers/ptp/ 16758 + F: drivers/s390/net/ 16812 16759 F: include/dt-bindings/net/ 16813 16760 F: include/linux/cn_proc.h 16814 16761 F: include/linux/etherdevice.h ··· 16819 16764 F: include/linux/hippidevice.h 16820 16765 F: include/linux/if_* 16821 16766 F: include/linux/inetdevice.h 16767 + F: include/linux/ism.h 16822 16768 F: include/linux/netdev* 16823 16769 F: include/linux/platform_data/wiznet.h 16824 16770 F: include/uapi/linux/cn_proc.h ··· 21330 21274 L: netdev@vger.kernel.org 21331 21275 S: Supported 21332 21276 F: drivers/s390/net/ 21277 + F: include/linux/ism.h 21333 21278 21334 21279 S390 PCI SUBSYSTEM 21335 21280 M: Niklas Schnelle <schnelle@linux.ibm.com> ··· 22316 22259 22317 22260 SLAB ALLOCATOR 22318 22261 M: Christoph Lameter <cl@linux.com> 22319 - M: Pekka Enberg <penberg@kernel.org> 22320 22262 M: David Rientjes <rientjes@google.com> 22321 - M: Joonsoo Kim <iamjoonsoo.kim@lge.com> 22322 22263 M: Andrew Morton <akpm@linux-foundation.org> 22323 22264 M: Vlastimil Babka <vbabka@suse.cz> 22324 22265 R: Roman Gushchin <roman.gushchin@linux.dev>
+5 -3
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 15 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc2 5 + EXTRAVERSION = -rc3 6 6 NAME = Baby Opossum Posse 7 7 8 8 # *DOCUMENTATION* ··· 477 477 -Wclippy::ignored_unit_patterns \ 478 478 -Wclippy::mut_mut \ 479 479 -Wclippy::needless_bitwise_bool \ 480 - -Wclippy::needless_continue \ 481 480 -Aclippy::needless_lifetimes \ 482 481 -Wclippy::no_mangle_with_rust_abi \ 483 482 -Wclippy::undocumented_unsafe_blocks \ ··· 1053 1054 KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3) 1054 1055 1055 1056 #Currently, disable -Wstringop-overflow for GCC 11, globally. 1056 - KBUILD_CFLAGS-$(CONFIG_CC_NO_STRINGOP_OVERFLOW) += $(call cc-option, -Wno-stringop-overflow) 1057 + KBUILD_CFLAGS-$(CONFIG_CC_NO_STRINGOP_OVERFLOW) += $(call cc-disable-warning, stringop-overflow) 1057 1058 KBUILD_CFLAGS-$(CONFIG_CC_STRINGOP_OVERFLOW) += $(call cc-option, -Wstringop-overflow) 1059 + 1060 + #Currently, disable -Wunterminated-string-initialization as broken 1061 + KBUILD_CFLAGS += $(call cc-disable-warning, unterminated-string-initialization) 1058 1062 1059 1063 # disable invalid "can't wrap" optimizations for signed / pointers 1060 1064 KBUILD_CFLAGS += -fno-strict-overflow
+4 -4
arch/loongarch/kernel/Makefile
··· 21 21 22 22 obj-$(CONFIG_ARCH_STRICT_ALIGN) += unaligned.o 23 23 24 - CFLAGS_module.o += $(call cc-option,-Wno-override-init,) 25 - CFLAGS_syscall.o += $(call cc-option,-Wno-override-init,) 26 - CFLAGS_traps.o += $(call cc-option,-Wno-override-init,) 27 - CFLAGS_perf_event.o += $(call cc-option,-Wno-override-init,) 24 + CFLAGS_module.o += $(call cc-disable-warning, override-init) 25 + CFLAGS_syscall.o += $(call cc-disable-warning, override-init) 26 + CFLAGS_traps.o += $(call cc-disable-warning, override-init) 27 + CFLAGS_perf_event.o += $(call cc-disable-warning, override-init) 28 28 29 29 ifdef CONFIG_FUNCTION_TRACER 30 30 ifndef CONFIG_DYNAMIC_FTRACE
+1 -1
arch/loongarch/kvm/Makefile
··· 21 21 kvm-y += intc/pch_pic.o 22 22 kvm-y += irqfd.o 23 23 24 - CFLAGS_exit.o += $(call cc-option,-Wno-override-init,) 24 + CFLAGS_exit.o += $(call cc-disable-warning, override-init)
+8 -13
arch/riscv/include/asm/alternative-macros.h
··· 115 115 \old_c 116 116 .endm 117 117 118 - #define _ALTERNATIVE_CFG(old_c, ...) \ 119 - ALTERNATIVE_CFG old_c 120 - 121 - #define _ALTERNATIVE_CFG_2(old_c, ...) \ 122 - ALTERNATIVE_CFG old_c 118 + #define __ALTERNATIVE_CFG(old_c, ...) ALTERNATIVE_CFG old_c 119 + #define __ALTERNATIVE_CFG_2(old_c, ...) ALTERNATIVE_CFG old_c 123 120 124 121 #else /* !__ASSEMBLY__ */ 125 122 126 - #define __ALTERNATIVE_CFG(old_c) \ 127 - old_c "\n" 128 - 129 - #define _ALTERNATIVE_CFG(old_c, ...) \ 130 - __ALTERNATIVE_CFG(old_c) 131 - 132 - #define _ALTERNATIVE_CFG_2(old_c, ...) \ 133 - __ALTERNATIVE_CFG(old_c) 123 + #define __ALTERNATIVE_CFG(old_c, ...) old_c "\n" 124 + #define __ALTERNATIVE_CFG_2(old_c, ...) old_c "\n" 134 125 135 126 #endif /* __ASSEMBLY__ */ 127 + 128 + #define _ALTERNATIVE_CFG(old_c, ...) __ALTERNATIVE_CFG(old_c) 129 + #define _ALTERNATIVE_CFG_2(old_c, ...) __ALTERNATIVE_CFG_2(old_c) 130 + 136 131 #endif /* CONFIG_RISCV_ALTERNATIVE */ 137 132 138 133 /*
+1 -8
arch/riscv/include/asm/kgdb.h
··· 19 19 20 20 #ifndef __ASSEMBLY__ 21 21 22 + void arch_kgdb_breakpoint(void); 22 23 extern unsigned long kgdb_compiled_break; 23 - 24 - static inline void arch_kgdb_breakpoint(void) 25 - { 26 - asm(".global kgdb_compiled_break\n" 27 - ".option norvc\n" 28 - "kgdb_compiled_break: ebreak\n" 29 - ".option rvc\n"); 30 - } 31 24 32 25 #endif /* !__ASSEMBLY__ */ 33 26
+5 -2
arch/riscv/include/asm/syscall.h
··· 62 62 unsigned long *args) 63 63 { 64 64 args[0] = regs->orig_a0; 65 - args++; 66 - memcpy(args, &regs->a1, 5 * sizeof(args[0])); 65 + args[1] = regs->a1; 66 + args[2] = regs->a2; 67 + args[3] = regs->a3; 68 + args[4] = regs->a4; 69 + args[5] = regs->a5; 67 70 } 68 71 69 72 static inline int syscall_get_arch(struct task_struct *task)
+2 -2
arch/riscv/kernel/Makefile
··· 9 9 CFLAGS_REMOVE_sbi.o = $(CC_FLAGS_FTRACE) 10 10 CFLAGS_REMOVE_return_address.o = $(CC_FLAGS_FTRACE) 11 11 endif 12 - CFLAGS_syscall_table.o += $(call cc-option,-Wno-override-init,) 13 - CFLAGS_compat_syscall_table.o += $(call cc-option,-Wno-override-init,) 12 + CFLAGS_syscall_table.o += $(call cc-disable-warning, override-init) 13 + CFLAGS_compat_syscall_table.o += $(call cc-disable-warning, override-init) 14 14 15 15 ifdef CONFIG_KEXEC_CORE 16 16 AFLAGS_kexec_relocate.o := -mcmodel=medany $(call cc-option,-mno-relax)
+6
arch/riscv/kernel/kgdb.c
··· 254 254 regs->epc = pc; 255 255 } 256 256 257 + noinline void arch_kgdb_breakpoint(void) 258 + { 259 + asm(".global kgdb_compiled_break\n" 260 + "kgdb_compiled_break: ebreak\n"); 261 + } 262 + 257 263 void kgdb_arch_handle_qxfer_pkt(char *remcom_in_buffer, 258 264 char *remcom_out_buffer) 259 265 {
+7 -6
arch/riscv/kernel/module-sections.c
··· 73 73 static void count_max_entries(Elf_Rela *relas, int num, 74 74 unsigned int *plts, unsigned int *gots) 75 75 { 76 - unsigned int type, i; 77 - 78 - for (i = 0; i < num; i++) { 79 - type = ELF_RISCV_R_TYPE(relas[i].r_info); 80 - if (type == R_RISCV_CALL_PLT) { 76 + for (int i = 0; i < num; i++) { 77 + switch (ELF_R_TYPE(relas[i].r_info)) { 78 + case R_RISCV_CALL_PLT: 79 + case R_RISCV_PLT32: 81 80 if (!duplicate_rela(relas, i)) 82 81 (*plts)++; 83 - } else if (type == R_RISCV_GOT_HI20) { 82 + break; 83 + case R_RISCV_GOT_HI20: 84 84 if (!duplicate_rela(relas, i)) 85 85 (*gots)++; 86 + break; 86 87 } 87 88 } 88 89 }
+6 -5
arch/riscv/kernel/module.c
··· 648 648 kfree(bucket_iter); 649 649 } 650 650 651 - kfree(*relocation_hashtable); 651 + kvfree(*relocation_hashtable); 652 652 } 653 653 654 654 static int add_relocation_to_accumulate(struct module *me, int type, ··· 752 752 753 753 hashtable_size <<= should_double_size; 754 754 755 - *relocation_hashtable = kmalloc_array(hashtable_size, 756 - sizeof(**relocation_hashtable), 757 - GFP_KERNEL); 755 + /* Number of relocations may be large, so kvmalloc it */ 756 + *relocation_hashtable = kvmalloc_array(hashtable_size, 757 + sizeof(**relocation_hashtable), 758 + GFP_KERNEL); 758 759 if (!*relocation_hashtable) 759 760 return 0; 760 761 ··· 860 859 } 861 860 862 861 j++; 863 - if (j > sechdrs[relsec].sh_size / sizeof(*rel)) 862 + if (j == num_relocations) 864 863 j = 0; 865 864 866 865 } while (j_idx != j);
+35 -1
arch/riscv/kernel/setup.c
··· 66 66 static struct resource elfcorehdr_res = { .name = "ELF Core hdr", }; 67 67 #endif 68 68 69 + static int num_standard_resources; 70 + static struct resource *standard_resources; 71 + 69 72 static int __init add_resource(struct resource *parent, 70 73 struct resource *res) 71 74 { ··· 142 139 struct resource *res = NULL; 143 140 struct resource *mem_res = NULL; 144 141 size_t mem_res_sz = 0; 145 - int num_resources = 0, res_idx = 0; 142 + int num_resources = 0, res_idx = 0, non_resv_res = 0; 146 143 int ret = 0; 147 144 148 145 /* + 1 as memblock_alloc() might increase memblock.reserved.cnt */ ··· 196 193 /* Add /memory regions to the resource tree */ 197 194 for_each_mem_region(region) { 198 195 res = &mem_res[res_idx--]; 196 + non_resv_res++; 199 197 200 198 if (unlikely(memblock_is_nomap(region))) { 201 199 res->name = "Reserved"; ··· 214 210 goto error; 215 211 } 216 212 213 + num_standard_resources = non_resv_res; 214 + standard_resources = &mem_res[res_idx + 1]; 215 + 217 216 /* Clean-up any unused pre-allocated resources */ 218 217 if (res_idx >= 0) 219 218 memblock_free(mem_res, (res_idx + 1) * sizeof(*mem_res)); ··· 228 221 memblock_free(mem_res, mem_res_sz); 229 222 } 230 223 224 + static int __init reserve_memblock_reserved_regions(void) 225 + { 226 + u64 i, j; 227 + 228 + for (i = 0; i < num_standard_resources; i++) { 229 + struct resource *mem = &standard_resources[i]; 230 + phys_addr_t r_start, r_end, mem_size = resource_size(mem); 231 + 232 + if (!memblock_is_region_reserved(mem->start, mem_size)) 233 + continue; 234 + 235 + for_each_reserved_mem_range(j, &r_start, &r_end) { 236 + resource_size_t start, end; 237 + 238 + start = max(PFN_PHYS(PFN_DOWN(r_start)), mem->start); 239 + end = min(PFN_PHYS(PFN_UP(r_end)) - 1, mem->end); 240 + 241 + if (start > mem->end || end < mem->start) 242 + continue; 243 + 244 + reserve_region_with_split(mem, start, end, "Reserved"); 245 + } 246 + } 247 + 248 + return 0; 249 + } 250 + arch_initcall(reserve_memblock_reserved_regions); 231 251 232 252 static void __init parse_dtb(void) 233 253 {
+21 -14
arch/riscv/kernel/unaligned_access_speed.c
··· 439 439 { 440 440 int cpu; 441 441 442 - if (unaligned_scalar_speed_param == RISCV_HWPROBE_MISALIGNED_SCALAR_UNKNOWN && 443 - !check_unaligned_access_emulated_all_cpus()) { 444 - check_unaligned_access_speed_all_cpus(); 445 - } else { 446 - pr_info("scalar unaligned access speed set to '%s' by command line\n", 447 - speed_str[unaligned_scalar_speed_param]); 442 + if (unaligned_scalar_speed_param != RISCV_HWPROBE_MISALIGNED_SCALAR_UNKNOWN) { 443 + pr_info("scalar unaligned access speed set to '%s' (%lu) by command line\n", 444 + speed_str[unaligned_scalar_speed_param], unaligned_scalar_speed_param); 448 445 for_each_online_cpu(cpu) 449 446 per_cpu(misaligned_access_speed, cpu) = unaligned_scalar_speed_param; 447 + } else if (!check_unaligned_access_emulated_all_cpus()) { 448 + check_unaligned_access_speed_all_cpus(); 449 + } 450 + 451 + if (unaligned_vector_speed_param != RISCV_HWPROBE_MISALIGNED_VECTOR_UNKNOWN) { 452 + if (!has_vector() && 453 + unaligned_vector_speed_param != RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED) { 454 + pr_warn("vector support is not available, ignoring unaligned_vector_speed=%s\n", 455 + speed_str[unaligned_vector_speed_param]); 456 + } else { 457 + pr_info("vector unaligned access speed set to '%s' (%lu) by command line\n", 458 + speed_str[unaligned_vector_speed_param], unaligned_vector_speed_param); 459 + } 450 460 } 451 461 452 462 if (!has_vector()) 453 463 unaligned_vector_speed_param = RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED; 454 464 455 - if (unaligned_vector_speed_param == RISCV_HWPROBE_MISALIGNED_VECTOR_UNKNOWN && 456 - !check_vector_unaligned_access_emulated_all_cpus() && 457 - IS_ENABLED(CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS)) { 458 - kthread_run(vec_check_unaligned_access_speed_all_cpus, 459 - NULL, "vec_check_unaligned_access_speed_all_cpus"); 460 - } else { 461 - pr_info("vector unaligned access speed set to '%s' by command line\n", 462 - speed_str[unaligned_vector_speed_param]); 465 + if (unaligned_vector_speed_param != RISCV_HWPROBE_MISALIGNED_VECTOR_UNKNOWN) { 463 466 for_each_online_cpu(cpu) 464 467 per_cpu(vector_misaligned_access, cpu) = unaligned_vector_speed_param; 468 + } else if (!check_vector_unaligned_access_emulated_all_cpus() && 469 + IS_ENABLED(CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS)) { 470 + kthread_run(vec_check_unaligned_access_speed_all_cpus, 471 + NULL, "vec_check_unaligned_access_speed_all_cpus"); 465 472 } 466 473 467 474 /*
+4 -1
arch/x86/boot/compressed/mem.c
··· 34 34 35 35 void arch_accept_memory(phys_addr_t start, phys_addr_t end) 36 36 { 37 + static bool sevsnp; 38 + 37 39 /* Platform-specific memory-acceptance call goes here */ 38 40 if (early_is_tdx_guest()) { 39 41 if (!tdx_accept_memory(start, end)) 40 42 panic("TDX: Failed to accept memory\n"); 41 - } else if (sev_snp_enabled()) { 43 + } else if (sevsnp || (sev_get_status() & MSR_AMD64_SEV_SNP_ENABLED)) { 44 + sevsnp = true; 42 45 snp_accept_memory(start, end); 43 46 } else { 44 47 error("Cannot accept memory: unknown platform\n");
+15 -52
arch/x86/boot/compressed/sev.c
··· 164 164 165 165 static void __page_state_change(unsigned long paddr, enum psc_op op) 166 166 { 167 - u64 val; 168 - 169 - if (!sev_snp_enabled()) 170 - return; 167 + u64 val, msr; 171 168 172 169 /* 173 170 * If private -> shared then invalidate the page before requesting the ··· 172 175 */ 173 176 if (op == SNP_PAGE_STATE_SHARED) 174 177 pvalidate_4k_page(paddr, paddr, false); 178 + 179 + /* Save the current GHCB MSR value */ 180 + msr = sev_es_rd_ghcb_msr(); 175 181 176 182 /* Issue VMGEXIT to change the page state in RMP table. */ 177 183 sev_es_wr_ghcb_msr(GHCB_MSR_PSC_REQ_GFN(paddr >> PAGE_SHIFT, op)); ··· 184 184 val = sev_es_rd_ghcb_msr(); 185 185 if ((GHCB_RESP_CODE(val) != GHCB_MSR_PSC_RESP) || GHCB_MSR_PSC_RESP_VAL(val)) 186 186 sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_PSC); 187 + 188 + /* Restore the GHCB MSR value */ 189 + sev_es_wr_ghcb_msr(msr); 187 190 188 191 /* 189 192 * Now that page state is changed in the RMP table, validate it so that it is ··· 198 195 199 196 void snp_set_page_private(unsigned long paddr) 200 197 { 198 + if (!sev_snp_enabled()) 199 + return; 200 + 201 201 __page_state_change(paddr, SNP_PAGE_STATE_PRIVATE); 202 202 } 203 203 204 204 void snp_set_page_shared(unsigned long paddr) 205 205 { 206 + if (!sev_snp_enabled()) 207 + return; 208 + 206 209 __page_state_change(paddr, SNP_PAGE_STATE_SHARED); 207 210 } 208 211 ··· 232 223 return true; 233 224 } 234 225 235 - static phys_addr_t __snp_accept_memory(struct snp_psc_desc *desc, 236 - phys_addr_t pa, phys_addr_t pa_end) 237 - { 238 - struct psc_hdr *hdr; 239 - struct psc_entry *e; 240 - unsigned int i; 241 - 242 - hdr = &desc->hdr; 243 - memset(hdr, 0, sizeof(*hdr)); 244 - 245 - e = desc->entries; 246 - 247 - i = 0; 248 - while (pa < pa_end && i < VMGEXIT_PSC_MAX_ENTRY) { 249 - hdr->end_entry = i; 250 - 251 - e->gfn = pa >> PAGE_SHIFT; 252 - e->operation = SNP_PAGE_STATE_PRIVATE; 253 - if (IS_ALIGNED(pa, PMD_SIZE) && (pa_end - pa) >= PMD_SIZE) { 254 - e->pagesize = RMP_PG_SIZE_2M; 255 - pa += PMD_SIZE; 256 - } else { 257 - e->pagesize = RMP_PG_SIZE_4K; 258 - pa += PAGE_SIZE; 259 - } 260 - 261 - e++; 262 - i++; 263 - } 264 - 265 - if (vmgexit_psc(boot_ghcb, desc)) 266 - sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_PSC); 267 - 268 - pvalidate_pages(desc); 269 - 270 - return pa; 271 - } 272 - 273 226 void snp_accept_memory(phys_addr_t start, phys_addr_t end) 274 227 { 275 - struct snp_psc_desc desc = {}; 276 - unsigned int i; 277 - phys_addr_t pa; 278 - 279 - if (!boot_ghcb && !early_setup_ghcb()) 280 - sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_PSC); 281 - 282 - pa = start; 283 - while (pa < end) 284 - pa = __snp_accept_memory(&desc, pa, end); 228 + for (phys_addr_t pa = start; pa < end; pa += PAGE_SIZE) 229 + __page_state_change(pa, SNP_PAGE_STATE_PRIVATE); 285 230 } 286 231 287 232 void sev_es_shutdown_ghcb(void)
+2
arch/x86/boot/compressed/sev.h
··· 12 12 13 13 bool sev_snp_enabled(void); 14 14 void snp_accept_memory(phys_addr_t start, phys_addr_t end); 15 + u64 sev_get_status(void); 15 16 16 17 #else 17 18 18 19 static inline bool sev_snp_enabled(void) { return false; } 19 20 static inline void snp_accept_memory(phys_addr_t start, phys_addr_t end) { } 21 + static inline u64 sev_get_status(void) { return 0; } 20 22 21 23 #endif 22 24
+20 -4
arch/x86/events/intel/core.c
··· 3049 3049 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); 3050 3050 int bit; 3051 3051 int handled = 0; 3052 - u64 intel_ctrl = hybrid(cpuc->pmu, intel_ctrl); 3053 3052 3054 3053 inc_irq_stat(apic_perf_irqs); 3055 3054 ··· 3092 3093 handled++; 3093 3094 x86_pmu_handle_guest_pebs(regs, &data); 3094 3095 static_call(x86_pmu_drain_pebs)(regs, &data); 3095 - status &= intel_ctrl | GLOBAL_STATUS_TRACE_TOPAPMI; 3096 3096 3097 3097 /* 3098 3098 * PMI throttle may be triggered, which stops the PEBS event. ··· 3102 3104 */ 3103 3105 if (pebs_enabled != cpuc->pebs_enabled) 3104 3106 wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled); 3107 + 3108 + /* 3109 + * Above PEBS handler (PEBS counters snapshotting) has updated fixed 3110 + * counter 3 and perf metrics counts if they are in counter group, 3111 + * unnecessary to update again. 3112 + */ 3113 + if (cpuc->events[INTEL_PMC_IDX_FIXED_SLOTS] && 3114 + is_pebs_counter_event_group(cpuc->events[INTEL_PMC_IDX_FIXED_SLOTS])) 3115 + status &= ~GLOBAL_STATUS_PERF_METRICS_OVF_BIT; 3105 3116 } 3106 3117 3107 3118 /* ··· 3129 3122 handled++; 3130 3123 static_call(intel_pmu_update_topdown_event)(NULL, NULL); 3131 3124 } 3125 + 3126 + status &= hybrid(cpuc->pmu, intel_ctrl); 3132 3127 3133 3128 /* 3134 3129 * Checkpointed counters can lead to 'spurious' PMIs because the ··· 7314 7305 name = "meteorlake_hybrid"; 7315 7306 break; 7316 7307 7308 + case INTEL_PANTHERLAKE_L: 7309 + pr_cont("Pantherlake Hybrid events, "); 7310 + name = "pantherlake_hybrid"; 7311 + goto lnl_common; 7312 + 7317 7313 case INTEL_LUNARLAKE_M: 7318 7314 case INTEL_ARROWLAKE: 7315 + pr_cont("Lunarlake Hybrid events, "); 7316 + name = "lunarlake_hybrid"; 7317 + 7318 + lnl_common: 7319 7319 intel_pmu_init_hybrid(hybrid_big_small); 7320 7320 7321 7321 x86_pmu.pebs_latency_data = lnl_latency_data; ··· 7346 7328 intel_pmu_init_skt(&pmu->pmu); 7347 7329 7348 7330 intel_pmu_pebs_data_source_lnl(); 7349 - pr_cont("Lunarlake Hybrid events, "); 7350 - name = "lunarlake_hybrid"; 7351 7331 break; 7352 7332 7353 7333 case INTEL_ARROWLAKE_H:
+5 -3
arch/x86/events/intel/ds.c
··· 1399 1399 * + precise_ip < 2 for the non event IP 1400 1400 * + For RTM TSX weight we need GPRs for the abort code. 1401 1401 */ 1402 - gprs = (sample_type & PERF_SAMPLE_REGS_INTR) && 1403 - (attr->sample_regs_intr & PEBS_GP_REGS); 1402 + gprs = ((sample_type & PERF_SAMPLE_REGS_INTR) && 1403 + (attr->sample_regs_intr & PEBS_GP_REGS)) || 1404 + ((sample_type & PERF_SAMPLE_REGS_USER) && 1405 + (attr->sample_regs_user & PEBS_GP_REGS)); 1404 1406 1405 1407 tsx_weight = (sample_type & PERF_SAMPLE_WEIGHT_TYPE) && 1406 1408 ((attr->config & INTEL_ARCH_EVENT_MASK) == ··· 2125 2123 regs->flags &= ~PERF_EFLAGS_EXACT; 2126 2124 } 2127 2125 2128 - if (sample_type & PERF_SAMPLE_REGS_INTR) 2126 + if (sample_type & (PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER)) 2129 2127 adaptive_pebs_save_regs(regs, gprs); 2130 2128 } 2131 2129
+10 -97
arch/x86/events/intel/uncore_snbep.c
··· 4891 4891 INTEL_UNCORE_EVENT_DESC(ioclk, "event=0xff,umask=0x10"), 4892 4892 /* Free-Running IIO BANDWIDTH IN Counters */ 4893 4893 INTEL_UNCORE_EVENT_DESC(bw_in_port0, "event=0xff,umask=0x20"), 4894 - INTEL_UNCORE_EVENT_DESC(bw_in_port0.scale, "3.814697266e-6"), 4894 + INTEL_UNCORE_EVENT_DESC(bw_in_port0.scale, "3.0517578125e-5"), 4895 4895 INTEL_UNCORE_EVENT_DESC(bw_in_port0.unit, "MiB"), 4896 4896 INTEL_UNCORE_EVENT_DESC(bw_in_port1, "event=0xff,umask=0x21"), 4897 - INTEL_UNCORE_EVENT_DESC(bw_in_port1.scale, "3.814697266e-6"), 4897 + INTEL_UNCORE_EVENT_DESC(bw_in_port1.scale, "3.0517578125e-5"), 4898 4898 INTEL_UNCORE_EVENT_DESC(bw_in_port1.unit, "MiB"), 4899 4899 INTEL_UNCORE_EVENT_DESC(bw_in_port2, "event=0xff,umask=0x22"), 4900 - INTEL_UNCORE_EVENT_DESC(bw_in_port2.scale, "3.814697266e-6"), 4900 + INTEL_UNCORE_EVENT_DESC(bw_in_port2.scale, "3.0517578125e-5"), 4901 4901 INTEL_UNCORE_EVENT_DESC(bw_in_port2.unit, "MiB"), 4902 4902 INTEL_UNCORE_EVENT_DESC(bw_in_port3, "event=0xff,umask=0x23"), 4903 - INTEL_UNCORE_EVENT_DESC(bw_in_port3.scale, "3.814697266e-6"), 4903 + INTEL_UNCORE_EVENT_DESC(bw_in_port3.scale, "3.0517578125e-5"), 4904 4904 INTEL_UNCORE_EVENT_DESC(bw_in_port3.unit, "MiB"), 4905 4905 INTEL_UNCORE_EVENT_DESC(bw_in_port4, "event=0xff,umask=0x24"), 4906 - INTEL_UNCORE_EVENT_DESC(bw_in_port4.scale, "3.814697266e-6"), 4906 + INTEL_UNCORE_EVENT_DESC(bw_in_port4.scale, "3.0517578125e-5"), 4907 4907 INTEL_UNCORE_EVENT_DESC(bw_in_port4.unit, "MiB"), 4908 4908 INTEL_UNCORE_EVENT_DESC(bw_in_port5, "event=0xff,umask=0x25"), 4909 - INTEL_UNCORE_EVENT_DESC(bw_in_port5.scale, "3.814697266e-6"), 4909 + INTEL_UNCORE_EVENT_DESC(bw_in_port5.scale, "3.0517578125e-5"), 4910 4910 INTEL_UNCORE_EVENT_DESC(bw_in_port5.unit, "MiB"), 4911 4911 INTEL_UNCORE_EVENT_DESC(bw_in_port6, "event=0xff,umask=0x26"), 4912 - INTEL_UNCORE_EVENT_DESC(bw_in_port6.scale, "3.814697266e-6"), 4912 + INTEL_UNCORE_EVENT_DESC(bw_in_port6.scale, "3.0517578125e-5"), 4913 4913 INTEL_UNCORE_EVENT_DESC(bw_in_port6.unit, "MiB"), 4914 4914 INTEL_UNCORE_EVENT_DESC(bw_in_port7, "event=0xff,umask=0x27"), 4915 - INTEL_UNCORE_EVENT_DESC(bw_in_port7.scale, "3.814697266e-6"), 4915 + INTEL_UNCORE_EVENT_DESC(bw_in_port7.scale, "3.0517578125e-5"), 4916 4916 INTEL_UNCORE_EVENT_DESC(bw_in_port7.unit, "MiB"), 4917 4917 { /* end: all zeroes */ }, 4918 4918 }; ··· 5485 5485 [ICX_IIO_MSR_BW_IN] = { 0xaa0, 0x1, 0x10, 8, 48, icx_iio_bw_freerunning_box_offsets }, 5486 5486 }; 5487 5487 5488 - static struct uncore_event_desc icx_uncore_iio_freerunning_events[] = { 5489 - /* Free-Running IIO CLOCKS Counter */ 5490 - INTEL_UNCORE_EVENT_DESC(ioclk, "event=0xff,umask=0x10"), 5491 - /* Free-Running IIO BANDWIDTH IN Counters */ 5492 - INTEL_UNCORE_EVENT_DESC(bw_in_port0, "event=0xff,umask=0x20"), 5493 - INTEL_UNCORE_EVENT_DESC(bw_in_port0.scale, "3.814697266e-6"), 5494 - INTEL_UNCORE_EVENT_DESC(bw_in_port0.unit, "MiB"), 5495 - INTEL_UNCORE_EVENT_DESC(bw_in_port1, "event=0xff,umask=0x21"), 5496 - INTEL_UNCORE_EVENT_DESC(bw_in_port1.scale, "3.814697266e-6"), 5497 - INTEL_UNCORE_EVENT_DESC(bw_in_port1.unit, "MiB"), 5498 - INTEL_UNCORE_EVENT_DESC(bw_in_port2, "event=0xff,umask=0x22"), 5499 - INTEL_UNCORE_EVENT_DESC(bw_in_port2.scale, "3.814697266e-6"), 5500 - INTEL_UNCORE_EVENT_DESC(bw_in_port2.unit, "MiB"), 5501 - INTEL_UNCORE_EVENT_DESC(bw_in_port3, "event=0xff,umask=0x23"), 5502 - INTEL_UNCORE_EVENT_DESC(bw_in_port3.scale, "3.814697266e-6"), 5503 - INTEL_UNCORE_EVENT_DESC(bw_in_port3.unit, "MiB"), 5504 - INTEL_UNCORE_EVENT_DESC(bw_in_port4, "event=0xff,umask=0x24"), 5505 - INTEL_UNCORE_EVENT_DESC(bw_in_port4.scale, "3.814697266e-6"), 5506 - INTEL_UNCORE_EVENT_DESC(bw_in_port4.unit, "MiB"), 5507 - INTEL_UNCORE_EVENT_DESC(bw_in_port5, "event=0xff,umask=0x25"), 5508 - INTEL_UNCORE_EVENT_DESC(bw_in_port5.scale, "3.814697266e-6"), 5509 - INTEL_UNCORE_EVENT_DESC(bw_in_port5.unit, "MiB"), 5510 - INTEL_UNCORE_EVENT_DESC(bw_in_port6, "event=0xff,umask=0x26"), 5511 - INTEL_UNCORE_EVENT_DESC(bw_in_port6.scale, "3.814697266e-6"), 5512 - INTEL_UNCORE_EVENT_DESC(bw_in_port6.unit, "MiB"), 5513 - INTEL_UNCORE_EVENT_DESC(bw_in_port7, "event=0xff,umask=0x27"), 5514 - INTEL_UNCORE_EVENT_DESC(bw_in_port7.scale, "3.814697266e-6"), 5515 - INTEL_UNCORE_EVENT_DESC(bw_in_port7.unit, "MiB"), 5516 - { /* end: all zeroes */ }, 5517 - }; 5518 - 5519 5488 static struct intel_uncore_type icx_uncore_iio_free_running = { 5520 5489 .name = "iio_free_running", 5521 5490 .num_counters = 9, ··· 5492 5523 .num_freerunning_types = ICX_IIO_FREERUNNING_TYPE_MAX, 5493 5524 .freerunning = icx_iio_freerunning, 5494 5525 .ops = &skx_uncore_iio_freerunning_ops, 5495 - .event_descs = icx_uncore_iio_freerunning_events, 5526 + .event_descs = snr_uncore_iio_freerunning_events, 5496 5527 .format_group = &skx_uncore_iio_freerunning_format_group, 5497 5528 }; 5498 5529 ··· 6289 6320 [SPR_IIO_MSR_BW_OUT] = { 0x3808, 0x1, 0x10, 8, 48 }, 6290 6321 }; 6291 6322 6292 - static struct uncore_event_desc spr_uncore_iio_freerunning_events[] = { 6293 - /* Free-Running IIO CLOCKS Counter */ 6294 - INTEL_UNCORE_EVENT_DESC(ioclk, "event=0xff,umask=0x10"), 6295 - /* Free-Running IIO BANDWIDTH IN Counters */ 6296 - INTEL_UNCORE_EVENT_DESC(bw_in_port0, "event=0xff,umask=0x20"), 6297 - INTEL_UNCORE_EVENT_DESC(bw_in_port0.scale, "3.814697266e-6"), 6298 - INTEL_UNCORE_EVENT_DESC(bw_in_port0.unit, "MiB"), 6299 - INTEL_UNCORE_EVENT_DESC(bw_in_port1, "event=0xff,umask=0x21"), 6300 - INTEL_UNCORE_EVENT_DESC(bw_in_port1.scale, "3.814697266e-6"), 6301 - INTEL_UNCORE_EVENT_DESC(bw_in_port1.unit, "MiB"), 6302 - INTEL_UNCORE_EVENT_DESC(bw_in_port2, "event=0xff,umask=0x22"), 6303 - INTEL_UNCORE_EVENT_DESC(bw_in_port2.scale, "3.814697266e-6"), 6304 - INTEL_UNCORE_EVENT_DESC(bw_in_port2.unit, "MiB"), 6305 - INTEL_UNCORE_EVENT_DESC(bw_in_port3, "event=0xff,umask=0x23"), 6306 - INTEL_UNCORE_EVENT_DESC(bw_in_port3.scale, "3.814697266e-6"), 6307 - INTEL_UNCORE_EVENT_DESC(bw_in_port3.unit, "MiB"), 6308 - INTEL_UNCORE_EVENT_DESC(bw_in_port4, "event=0xff,umask=0x24"), 6309 - INTEL_UNCORE_EVENT_DESC(bw_in_port4.scale, "3.814697266e-6"), 6310 - INTEL_UNCORE_EVENT_DESC(bw_in_port4.unit, "MiB"), 6311 - INTEL_UNCORE_EVENT_DESC(bw_in_port5, "event=0xff,umask=0x25"), 6312 - INTEL_UNCORE_EVENT_DESC(bw_in_port5.scale, "3.814697266e-6"), 6313 - INTEL_UNCORE_EVENT_DESC(bw_in_port5.unit, "MiB"), 6314 - INTEL_UNCORE_EVENT_DESC(bw_in_port6, "event=0xff,umask=0x26"), 6315 - INTEL_UNCORE_EVENT_DESC(bw_in_port6.scale, "3.814697266e-6"), 6316 - INTEL_UNCORE_EVENT_DESC(bw_in_port6.unit, "MiB"), 6317 - INTEL_UNCORE_EVENT_DESC(bw_in_port7, "event=0xff,umask=0x27"), 6318 - INTEL_UNCORE_EVENT_DESC(bw_in_port7.scale, "3.814697266e-6"), 6319 - INTEL_UNCORE_EVENT_DESC(bw_in_port7.unit, "MiB"), 6320 - /* Free-Running IIO BANDWIDTH OUT Counters */ 6321 - INTEL_UNCORE_EVENT_DESC(bw_out_port0, "event=0xff,umask=0x30"), 6322 - INTEL_UNCORE_EVENT_DESC(bw_out_port0.scale, "3.814697266e-6"), 6323 - INTEL_UNCORE_EVENT_DESC(bw_out_port0.unit, "MiB"), 6324 - INTEL_UNCORE_EVENT_DESC(bw_out_port1, "event=0xff,umask=0x31"), 6325 - INTEL_UNCORE_EVENT_DESC(bw_out_port1.scale, "3.814697266e-6"), 6326 - INTEL_UNCORE_EVENT_DESC(bw_out_port1.unit, "MiB"), 6327 - INTEL_UNCORE_EVENT_DESC(bw_out_port2, "event=0xff,umask=0x32"), 6328 - INTEL_UNCORE_EVENT_DESC(bw_out_port2.scale, "3.814697266e-6"), 6329 - INTEL_UNCORE_EVENT_DESC(bw_out_port2.unit, "MiB"), 6330 - INTEL_UNCORE_EVENT_DESC(bw_out_port3, "event=0xff,umask=0x33"), 6331 - INTEL_UNCORE_EVENT_DESC(bw_out_port3.scale, "3.814697266e-6"), 6332 - INTEL_UNCORE_EVENT_DESC(bw_out_port3.unit, "MiB"), 6333 - INTEL_UNCORE_EVENT_DESC(bw_out_port4, "event=0xff,umask=0x34"), 6334 - INTEL_UNCORE_EVENT_DESC(bw_out_port4.scale, "3.814697266e-6"), 6335 - INTEL_UNCORE_EVENT_DESC(bw_out_port4.unit, "MiB"), 6336 - INTEL_UNCORE_EVENT_DESC(bw_out_port5, "event=0xff,umask=0x35"), 6337 - INTEL_UNCORE_EVENT_DESC(bw_out_port5.scale, "3.814697266e-6"), 6338 - INTEL_UNCORE_EVENT_DESC(bw_out_port5.unit, "MiB"), 6339 - INTEL_UNCORE_EVENT_DESC(bw_out_port6, "event=0xff,umask=0x36"), 6340 - INTEL_UNCORE_EVENT_DESC(bw_out_port6.scale, "3.814697266e-6"), 6341 - INTEL_UNCORE_EVENT_DESC(bw_out_port6.unit, "MiB"), 6342 - INTEL_UNCORE_EVENT_DESC(bw_out_port7, "event=0xff,umask=0x37"), 6343 - INTEL_UNCORE_EVENT_DESC(bw_out_port7.scale, "3.814697266e-6"), 6344 - INTEL_UNCORE_EVENT_DESC(bw_out_port7.unit, "MiB"), 6345 - { /* end: all zeroes */ }, 6346 - }; 6347 - 6348 6323 static struct intel_uncore_type spr_uncore_iio_free_running = { 6349 6324 .name = "iio_free_running", 6350 6325 .num_counters = 17, 6351 6326 .num_freerunning_types = SPR_IIO_FREERUNNING_TYPE_MAX, 6352 6327 .freerunning = spr_iio_freerunning, 6353 6328 .ops = &skx_uncore_iio_freerunning_ops, 6354 - .event_descs = spr_uncore_iio_freerunning_events, 6329 + .event_descs = snr_uncore_iio_freerunning_events, 6355 6330 .format_group = &skx_uncore_iio_freerunning_format_group, 6356 6331 }; 6357 6332
+2
arch/x86/include/asm/intel-family.h
··· 126 126 #define INTEL_GRANITERAPIDS_X IFM(6, 0xAD) /* Redwood Cove */ 127 127 #define INTEL_GRANITERAPIDS_D IFM(6, 0xAE) 128 128 129 + #define INTEL_BARTLETTLAKE IFM(6, 0xD7) /* Raptor Cove */ 130 + 129 131 /* "Hybrid" Processors (P-Core/E-Core) */ 130 132 131 133 #define INTEL_LAKEFIELD IFM(6, 0x8A) /* Sunny Cove / Tremont */
+12 -7
arch/x86/kernel/cpu/amd.c
··· 869 869 870 870 pr_notice_once("AMD Zen1 DIV0 bug detected. Disable SMT for full protection.\n"); 871 871 setup_force_cpu_bug(X86_BUG_DIV0); 872 + 873 + /* 874 + * Turn off the Instructions Retired free counter on machines that are 875 + * susceptible to erratum #1054 "Instructions Retired Performance 876 + * Counter May Be Inaccurate". 877 + */ 878 + if (c->x86_model < 0x30) { 879 + msr_clear_bit(MSR_K7_HWCR, MSR_K7_HWCR_IRPERF_EN_BIT); 880 + clear_cpu_cap(c, X86_FEATURE_IRPERF); 881 + } 872 882 } 873 883 874 884 static bool cpu_has_zenbleed_microcode(void) ··· 1062 1052 if (!cpu_feature_enabled(X86_FEATURE_XENPV)) 1063 1053 set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS); 1064 1054 1065 - /* 1066 - * Turn on the Instructions Retired free counter on machines not 1067 - * susceptible to erratum #1054 "Instructions Retired Performance 1068 - * Counter May Be Inaccurate". 1069 - */ 1070 - if (cpu_has(c, X86_FEATURE_IRPERF) && 1071 - (boot_cpu_has(X86_FEATURE_ZEN1) && c->x86_model > 0x2f)) 1055 + /* Enable the Instructions Retired free counter */ 1056 + if (cpu_has(c, X86_FEATURE_IRPERF)) 1072 1057 msr_set_bit(MSR_K7_HWCR, MSR_K7_HWCR_IRPERF_EN_BIT); 1073 1058 1074 1059 check_null_seg_clears_base(c);
+7 -2
arch/x86/kernel/cpu/microcode/amd.c
··· 199 199 case 0xa70c0: return cur_rev <= 0xa70C009; break; 200 200 case 0xaa001: return cur_rev <= 0xaa00116; break; 201 201 case 0xaa002: return cur_rev <= 0xaa00218; break; 202 + case 0xb0021: return cur_rev <= 0xb002146; break; 203 + case 0xb1010: return cur_rev <= 0xb101046; break; 204 + case 0xb2040: return cur_rev <= 0xb204031; break; 205 + case 0xb4040: return cur_rev <= 0xb404031; break; 206 + case 0xb6000: return cur_rev <= 0xb600031; break; 207 + case 0xb7000: return cur_rev <= 0xb700031; break; 202 208 default: break; 203 209 } 204 210 ··· 220 214 struct sha256_state s; 221 215 int i; 222 216 223 - if (x86_family(bsp_cpuid_1_eax) < 0x17 || 224 - x86_family(bsp_cpuid_1_eax) > 0x19) 217 + if (x86_family(bsp_cpuid_1_eax) < 0x17) 225 218 return true; 226 219 227 220 if (!need_sha_check(cur_rev))
+2 -1
arch/x86/kernel/i8253.c
··· 46 46 * VMMs otherwise steal CPU time just to pointlessly waggle 47 47 * the (masked) IRQ. 48 48 */ 49 - clockevent_i8253_disable(); 49 + scoped_guard(irq) 50 + clockevent_i8253_disable(); 50 51 return false; 51 52 } 52 53 clockevent_i8253_init(true);
+1 -6
arch/x86/xen/enlighten.c
··· 103 103 void (*func)(void); 104 104 105 105 /* 106 - * Xen is supported only on CPUs with CPUID, so testing for 107 - * X86_FEATURE_CPUID is a test for early_cpu_init() having been 108 - * run. 109 - * 110 106 * Note that __xen_hypercall_setfunc() is noinstr only due to a nasty 111 107 * dependency chain: it is being called via the xen_hypercall static 112 108 * call when running as a PVH or HVM guest. Hypercalls need to be ··· 114 118 */ 115 119 instrumentation_begin(); 116 120 117 - if (!boot_cpu_has(X86_FEATURE_CPUID)) 118 - xen_get_vendor(); 121 + xen_get_vendor(); 119 122 120 123 if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD || 121 124 boot_cpu_data.x86_vendor == X86_VENDOR_HYGON))
+1 -2
block/bdev.c
··· 1272 1272 /* 1273 1273 * Handle STATX_{DIOALIGN, WRITE_ATOMIC} for block devices. 1274 1274 */ 1275 - void bdev_statx(struct path *path, struct kstat *stat, 1276 - u32 request_mask) 1275 + void bdev_statx(const struct path *path, struct kstat *stat, u32 request_mask) 1277 1276 { 1278 1277 struct inode *backing_inode; 1279 1278 struct block_device *bdev;
+6 -11
block/bio-integrity.c
··· 66 66 } 67 67 EXPORT_SYMBOL(bio_integrity_alloc); 68 68 69 - static void bio_integrity_unpin_bvec(struct bio_vec *bv, int nr_vecs, 70 - bool dirty) 69 + static void bio_integrity_unpin_bvec(struct bio_vec *bv, int nr_vecs) 71 70 { 72 71 int i; 73 72 74 - for (i = 0; i < nr_vecs; i++) { 75 - if (dirty && !PageCompound(bv[i].bv_page)) 76 - set_page_dirty_lock(bv[i].bv_page); 73 + for (i = 0; i < nr_vecs; i++) 77 74 unpin_user_page(bv[i].bv_page); 78 - } 79 75 } 80 76 81 77 static void bio_integrity_uncopy_user(struct bio_integrity_payload *bip) ··· 87 91 ret = copy_to_iter(bvec_virt(bounce_bvec), bytes, &orig_iter); 88 92 WARN_ON_ONCE(ret != bytes); 89 93 90 - bio_integrity_unpin_bvec(orig_bvecs, orig_nr_vecs, true); 94 + bio_integrity_unpin_bvec(orig_bvecs, orig_nr_vecs); 91 95 } 92 96 93 97 /** ··· 107 111 return; 108 112 } 109 113 110 - bio_integrity_unpin_bvec(bip->bip_vec, bip->bip_max_vcnt, 111 - bio_data_dir(bio) == READ); 114 + bio_integrity_unpin_bvec(bip->bip_vec, bip->bip_max_vcnt); 112 115 } 113 116 114 117 /** ··· 193 198 } 194 199 195 200 if (write) 196 - bio_integrity_unpin_bvec(bvec, nr_vecs, false); 201 + bio_integrity_unpin_bvec(bvec, nr_vecs); 197 202 else 198 203 memcpy(&bip->bip_vec[1], bvec, nr_vecs * sizeof(*bvec)); 199 204 ··· 314 319 return 0; 315 320 316 321 release_pages: 317 - bio_integrity_unpin_bvec(bvec, nr_bvecs, false); 322 + bio_integrity_unpin_bvec(bvec, nr_bvecs); 318 323 free_bvec: 319 324 if (bvec != stack_vec) 320 325 kfree(bvec);
+2
block/blk-sysfs.c
··· 909 909 out_debugfs_remove: 910 910 blk_debugfs_remove(disk); 911 911 mutex_unlock(&q->sysfs_lock); 912 + if (queue_is_mq(q)) 913 + blk_mq_sysfs_unregister(disk); 912 914 out_put_queue_kobj: 913 915 kobject_put(&disk->queue_kobj); 914 916 return ret;
+1
block/blk-throttle.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 #ifndef BLK_THROTTLE_H 2 3 #define BLK_THROTTLE_H 3 4
+5 -5
crypto/scompress.c
··· 215 215 spage = nth_page(spage, soff / PAGE_SIZE); 216 216 soff = offset_in_page(soff); 217 217 218 - n = slen / PAGE_SIZE; 219 - n += (offset_in_page(slen) + soff - 1) / PAGE_SIZE; 218 + n = (slen - 1) / PAGE_SIZE; 219 + n += (offset_in_page(slen - 1) + soff) / PAGE_SIZE; 220 220 if (PageHighMem(nth_page(spage, n)) && 221 221 size_add(soff, slen) > PAGE_SIZE) 222 222 break; ··· 243 243 dpage = nth_page(dpage, doff / PAGE_SIZE); 244 244 doff = offset_in_page(doff); 245 245 246 - n = dlen / PAGE_SIZE; 247 - n += (offset_in_page(dlen) + doff - 1) / PAGE_SIZE; 248 - if (PageHighMem(dpage + n) && 246 + n = (dlen - 1) / PAGE_SIZE; 247 + n += (offset_in_page(dlen - 1) + doff) / PAGE_SIZE; 248 + if (PageHighMem(nth_page(dpage, n)) && 249 249 size_add(doff, dlen) > PAGE_SIZE) 250 250 break; 251 251 dst = kmap_local_page(dpage) + doff;
+63 -82
crypto/testmgr.c
··· 58 58 MODULE_PARM_DESC(fuzz_iterations, "number of fuzz test iterations"); 59 59 #endif 60 60 61 - /* Multibuffer is unlimited. Set arbitrary limit for testing. */ 62 - #define MAX_MB_MSGS 16 63 - 64 61 #ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS 65 62 66 63 /* a perfect nop */ ··· 3326 3329 int ctcount, int dtcount) 3327 3330 { 3328 3331 const char *algo = crypto_tfm_alg_driver_name(crypto_acomp_tfm(tfm)); 3329 - struct scatterlist *src = NULL, *dst = NULL; 3330 - struct acomp_req *reqs[MAX_MB_MSGS] = {}; 3331 - char *decomp_out[MAX_MB_MSGS] = {}; 3332 - char *output[MAX_MB_MSGS] = {}; 3333 - struct crypto_wait wait; 3334 - struct acomp_req *req; 3335 - int ret = -ENOMEM; 3336 3332 unsigned int i; 3333 + char *output, *decomp_out; 3334 + int ret; 3335 + struct scatterlist src, dst; 3336 + struct acomp_req *req; 3337 + struct crypto_wait wait; 3337 3338 3338 - src = kmalloc_array(MAX_MB_MSGS, sizeof(*src), GFP_KERNEL); 3339 - if (!src) 3340 - goto out; 3341 - dst = kmalloc_array(MAX_MB_MSGS, sizeof(*dst), GFP_KERNEL); 3342 - if (!dst) 3343 - goto out; 3339 + output = kmalloc(COMP_BUF_SIZE, GFP_KERNEL); 3340 + if (!output) 3341 + return -ENOMEM; 3344 3342 3345 - for (i = 0; i < MAX_MB_MSGS; i++) { 3346 - reqs[i] = acomp_request_alloc(tfm); 3347 - if (!reqs[i]) 3348 - goto out; 3349 - 3350 - acomp_request_set_callback(reqs[i], 3351 - CRYPTO_TFM_REQ_MAY_SLEEP | 3352 - CRYPTO_TFM_REQ_MAY_BACKLOG, 3353 - crypto_req_done, &wait); 3354 - if (i) 3355 - acomp_request_chain(reqs[i], reqs[0]); 3356 - 3357 - output[i] = kmalloc(COMP_BUF_SIZE, GFP_KERNEL); 3358 - if (!output[i]) 3359 - goto out; 3360 - 3361 - decomp_out[i] = kmalloc(COMP_BUF_SIZE, GFP_KERNEL); 3362 - if (!decomp_out[i]) 3363 - goto out; 3343 + decomp_out = kmalloc(COMP_BUF_SIZE, GFP_KERNEL); 3344 + if (!decomp_out) { 3345 + kfree(output); 3346 + return -ENOMEM; 3364 3347 } 3365 3348 3366 3349 for (i = 0; i < ctcount; i++) { 3367 3350 unsigned int dlen = COMP_BUF_SIZE; 3368 3351 int ilen = ctemplate[i].inlen; 3369 3352 void *input_vec; 3370 - int j; 3371 3353 3372 3354 input_vec = kmemdup(ctemplate[i].input, ilen, GFP_KERNEL); 3373 3355 if (!input_vec) { ··· 3354 3378 goto out; 3355 3379 } 3356 3380 3381 + memset(output, 0, dlen); 3357 3382 crypto_init_wait(&wait); 3358 - sg_init_one(src, input_vec, ilen); 3383 + sg_init_one(&src, input_vec, ilen); 3384 + sg_init_one(&dst, output, dlen); 3359 3385 3360 - for (j = 0; j < MAX_MB_MSGS; j++) { 3361 - sg_init_one(dst + j, output[j], dlen); 3362 - acomp_request_set_params(reqs[j], src, dst + j, ilen, dlen); 3386 + req = acomp_request_alloc(tfm); 3387 + if (!req) { 3388 + pr_err("alg: acomp: request alloc failed for %s\n", 3389 + algo); 3390 + kfree(input_vec); 3391 + ret = -ENOMEM; 3392 + goto out; 3363 3393 } 3364 3394 3365 - req = reqs[0]; 3395 + acomp_request_set_params(req, &src, &dst, ilen, dlen); 3396 + acomp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, 3397 + crypto_req_done, &wait); 3398 + 3366 3399 ret = crypto_wait_req(crypto_acomp_compress(req), &wait); 3367 3400 if (ret) { 3368 3401 pr_err("alg: acomp: compression failed on test %d for %s: ret=%d\n", 3369 3402 i + 1, algo, -ret); 3370 3403 kfree(input_vec); 3404 + acomp_request_free(req); 3371 3405 goto out; 3372 3406 } 3373 3407 3374 3408 ilen = req->dlen; 3375 3409 dlen = COMP_BUF_SIZE; 3410 + sg_init_one(&src, output, ilen); 3411 + sg_init_one(&dst, decomp_out, dlen); 3376 3412 crypto_init_wait(&wait); 3377 - for (j = 0; j < MAX_MB_MSGS; j++) { 3378 - sg_init_one(src + j, output[j], ilen); 3379 - sg_init_one(dst + j, decomp_out[j], dlen); 3380 - acomp_request_set_params(reqs[j], src + j, dst + j, ilen, dlen); 3413 + acomp_request_set_params(req, &src, &dst, ilen, dlen); 3414 + 3415 + ret = crypto_wait_req(crypto_acomp_decompress(req), &wait); 3416 + if (ret) { 3417 + pr_err("alg: acomp: compression failed on test %d for %s: ret=%d\n", 3418 + i + 1, algo, -ret); 3419 + kfree(input_vec); 3420 + acomp_request_free(req); 3421 + goto out; 3381 3422 } 3382 3423 3383 - crypto_wait_req(crypto_acomp_decompress(req), &wait); 3384 - for (j = 0; j < MAX_MB_MSGS; j++) { 3385 - ret = reqs[j]->base.err; 3386 - if (ret) { 3387 - pr_err("alg: acomp: compression failed on test %d (%d) for %s: ret=%d\n", 3388 - i + 1, j, algo, -ret); 3389 - kfree(input_vec); 3390 - goto out; 3391 - } 3424 + if (req->dlen != ctemplate[i].inlen) { 3425 + pr_err("alg: acomp: Compression test %d failed for %s: output len = %d\n", 3426 + i + 1, algo, req->dlen); 3427 + ret = -EINVAL; 3428 + kfree(input_vec); 3429 + acomp_request_free(req); 3430 + goto out; 3431 + } 3392 3432 3393 - if (reqs[j]->dlen != ctemplate[i].inlen) { 3394 - pr_err("alg: acomp: Compression test %d (%d) failed for %s: output len = %d\n", 3395 - i + 1, j, algo, reqs[j]->dlen); 3396 - ret = -EINVAL; 3397 - kfree(input_vec); 3398 - goto out; 3399 - } 3400 - 3401 - if (memcmp(input_vec, decomp_out[j], reqs[j]->dlen)) { 3402 - pr_err("alg: acomp: Compression test %d (%d) failed for %s\n", 3403 - i + 1, j, algo); 3404 - hexdump(output[j], reqs[j]->dlen); 3405 - ret = -EINVAL; 3406 - kfree(input_vec); 3407 - goto out; 3408 - } 3433 + if (memcmp(input_vec, decomp_out, req->dlen)) { 3434 + pr_err("alg: acomp: Compression test %d failed for %s\n", 3435 + i + 1, algo); 3436 + hexdump(output, req->dlen); 3437 + ret = -EINVAL; 3438 + kfree(input_vec); 3439 + acomp_request_free(req); 3440 + goto out; 3409 3441 } 3410 3442 3411 3443 kfree(input_vec); 3444 + acomp_request_free(req); 3412 3445 } 3413 3446 3414 3447 for (i = 0; i < dtcount; i++) { ··· 3431 3446 goto out; 3432 3447 } 3433 3448 3449 + memset(output, 0, dlen); 3434 3450 crypto_init_wait(&wait); 3435 - sg_init_one(src, input_vec, ilen); 3436 - sg_init_one(dst, output[0], dlen); 3451 + sg_init_one(&src, input_vec, ilen); 3452 + sg_init_one(&dst, output, dlen); 3437 3453 3438 3454 req = acomp_request_alloc(tfm); 3439 3455 if (!req) { ··· 3445 3459 goto out; 3446 3460 } 3447 3461 3448 - acomp_request_set_params(req, src, dst, ilen, dlen); 3462 + acomp_request_set_params(req, &src, &dst, ilen, dlen); 3449 3463 acomp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, 3450 3464 crypto_req_done, &wait); 3451 3465 ··· 3467 3481 goto out; 3468 3482 } 3469 3483 3470 - if (memcmp(output[0], dtemplate[i].output, req->dlen)) { 3484 + if (memcmp(output, dtemplate[i].output, req->dlen)) { 3471 3485 pr_err("alg: acomp: Decompression test %d failed for %s\n", 3472 3486 i + 1, algo); 3473 - hexdump(output[0], req->dlen); 3487 + hexdump(output, req->dlen); 3474 3488 ret = -EINVAL; 3475 3489 kfree(input_vec); 3476 3490 acomp_request_free(req); ··· 3484 3498 ret = 0; 3485 3499 3486 3500 out: 3487 - acomp_request_free(reqs[0]); 3488 - for (i = 0; i < MAX_MB_MSGS; i++) { 3489 - kfree(output[i]); 3490 - kfree(decomp_out[i]); 3491 - } 3492 - kfree(dst); 3493 - kfree(src); 3501 + kfree(decomp_out); 3502 + kfree(output); 3494 3503 return ret; 3495 3504 } 3496 3505
+5 -5
drivers/accel/ivpu/ivpu_drv.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * Copyright (C) 2020-2024 Intel Corporation 3 + * Copyright (C) 2020-2025 Intel Corporation 4 4 */ 5 5 6 6 #include <linux/firmware.h> ··· 164 164 args->value = vdev->platform; 165 165 break; 166 166 case DRM_IVPU_PARAM_CORE_CLOCK_RATE: 167 - args->value = ivpu_hw_ratio_to_freq(vdev, vdev->hw->pll.max_ratio); 167 + args->value = ivpu_hw_dpu_max_freq_get(vdev); 168 168 break; 169 169 case DRM_IVPU_PARAM_NUM_CONTEXTS: 170 170 args->value = ivpu_get_context_count(vdev); ··· 421 421 { 422 422 ivpu_hw_irq_disable(vdev); 423 423 disable_irq(vdev->irq); 424 - cancel_work_sync(&vdev->irq_ipc_work); 425 - cancel_work_sync(&vdev->irq_dct_work); 426 - cancel_work_sync(&vdev->context_abort_work); 424 + flush_work(&vdev->irq_ipc_work); 425 + flush_work(&vdev->irq_dct_work); 426 + flush_work(&vdev->context_abort_work); 427 427 ivpu_ipc_disable(vdev); 428 428 ivpu_mmu_disable(vdev); 429 429 }
+13 -4
drivers/accel/ivpu/ivpu_fw.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * Copyright (C) 2020-2024 Intel Corporation 3 + * Copyright (C) 2020-2025 Intel Corporation 4 4 */ 5 5 6 6 #include <linux/firmware.h> ··· 233 233 fw->dvfs_mode = 0; 234 234 235 235 fw->sched_mode = ivpu_fw_sched_mode_select(vdev, fw_hdr); 236 - fw->primary_preempt_buf_size = fw_hdr->preemption_buffer_1_size; 237 - fw->secondary_preempt_buf_size = fw_hdr->preemption_buffer_2_size; 238 236 ivpu_info(vdev, "Scheduler mode: %s\n", fw->sched_mode ? "HW" : "OS"); 237 + 238 + if (fw_hdr->preemption_buffer_1_max_size) 239 + fw->primary_preempt_buf_size = fw_hdr->preemption_buffer_1_max_size; 240 + else 241 + fw->primary_preempt_buf_size = fw_hdr->preemption_buffer_1_size; 242 + 243 + if (fw_hdr->preemption_buffer_2_max_size) 244 + fw->secondary_preempt_buf_size = fw_hdr->preemption_buffer_2_max_size; 245 + else 246 + fw->secondary_preempt_buf_size = fw_hdr->preemption_buffer_2_size; 247 + ivpu_dbg(vdev, FW_BOOT, "Preemption buffer sizes: primary %u, secondary %u\n", 248 + fw->primary_preempt_buf_size, fw->secondary_preempt_buf_size); 239 249 240 250 if (fw_hdr->ro_section_start_address && !is_within_range(fw_hdr->ro_section_start_address, 241 251 fw_hdr->ro_section_size, ··· 576 566 577 567 boot_params->magic = VPU_BOOT_PARAMS_MAGIC; 578 568 boot_params->vpu_id = to_pci_dev(vdev->drm.dev)->bus->number; 579 - boot_params->frequency = ivpu_hw_pll_freq_get(vdev); 580 569 581 570 /* 582 571 * This param is a debug firmware feature. It switches default clock
+8 -8
drivers/accel/ivpu/ivpu_hw.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 2 /* 3 - * Copyright (C) 2020-2024 Intel Corporation 3 + * Copyright (C) 2020-2025 Intel Corporation 4 4 */ 5 5 6 6 #ifndef __IVPU_HW_H__ ··· 82 82 return range->end - range->start; 83 83 } 84 84 85 - static inline u32 ivpu_hw_ratio_to_freq(struct ivpu_device *vdev, u32 ratio) 85 + static inline u32 ivpu_hw_dpu_max_freq_get(struct ivpu_device *vdev) 86 86 { 87 - return ivpu_hw_btrs_ratio_to_freq(vdev, ratio); 87 + return ivpu_hw_btrs_dpu_max_freq_get(vdev); 88 + } 89 + 90 + static inline u32 ivpu_hw_dpu_freq_get(struct ivpu_device *vdev) 91 + { 92 + return ivpu_hw_btrs_dpu_freq_get(vdev); 88 93 } 89 94 90 95 static inline void ivpu_hw_irq_clear(struct ivpu_device *vdev) 91 96 { 92 97 ivpu_hw_ip_irq_clear(vdev); 93 - } 94 - 95 - static inline u32 ivpu_hw_pll_freq_get(struct ivpu_device *vdev) 96 - { 97 - return ivpu_hw_btrs_pll_freq_get(vdev); 98 98 } 99 99 100 100 static inline u32 ivpu_hw_profiling_freq_get(struct ivpu_device *vdev)
+64 -70
drivers/accel/ivpu/ivpu_hw_btrs.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * Copyright (C) 2020-2024 Intel Corporation 3 + * Copyright (C) 2020-2025 Intel Corporation 4 4 */ 5 + 6 + #include <linux/units.h> 5 7 6 8 #include "ivpu_drv.h" 7 9 #include "ivpu_hw.h" ··· 30 28 31 29 #define BTRS_LNL_ALL_IRQ_MASK ((u32)-1) 32 30 33 - #define BTRS_MTL_WP_CONFIG_1_TILE_5_3_RATIO WP_CONFIG(MTL_CONFIG_1_TILE, MTL_PLL_RATIO_5_3) 34 - #define BTRS_MTL_WP_CONFIG_1_TILE_4_3_RATIO WP_CONFIG(MTL_CONFIG_1_TILE, MTL_PLL_RATIO_4_3) 35 - #define BTRS_MTL_WP_CONFIG_2_TILE_5_3_RATIO WP_CONFIG(MTL_CONFIG_2_TILE, MTL_PLL_RATIO_5_3) 36 - #define BTRS_MTL_WP_CONFIG_2_TILE_4_3_RATIO WP_CONFIG(MTL_CONFIG_2_TILE, MTL_PLL_RATIO_4_3) 37 - #define BTRS_MTL_WP_CONFIG_0_TILE_PLL_OFF WP_CONFIG(0, 0) 38 31 39 32 #define PLL_CDYN_DEFAULT 0x80 40 33 #define PLL_EPP_DEFAULT 0x80 41 34 #define PLL_CONFIG_DEFAULT 0x0 42 - #define PLL_SIMULATION_FREQ 10000000 43 - #define PLL_REF_CLK_FREQ 50000000 35 + #define PLL_REF_CLK_FREQ 50000000ull 36 + #define PLL_RATIO_TO_FREQ(x) ((x) * PLL_REF_CLK_FREQ) 37 + 44 38 #define PLL_TIMEOUT_US (1500 * USEC_PER_MSEC) 45 39 #define IDLE_TIMEOUT_US (5 * USEC_PER_MSEC) 46 40 #define TIMEOUT_US (150 * USEC_PER_MSEC) ··· 59 61 #define DCT_REQ 0x2 60 62 #define DCT_ENABLE 0x1 61 63 #define DCT_DISABLE 0x0 64 + 65 + static u32 pll_ratio_to_dpu_freq(struct ivpu_device *vdev, u32 ratio); 62 66 63 67 int ivpu_hw_btrs_irqs_clear_with_0_mtl(struct ivpu_device *vdev) 64 68 { ··· 156 156 157 157 hw->tile_fuse = BTRS_MTL_TILE_FUSE_ENABLE_BOTH; 158 158 hw->sku = BTRS_MTL_TILE_SKU_BOTH; 159 - hw->config = BTRS_MTL_WP_CONFIG_2_TILE_4_3_RATIO; 159 + hw->config = WP_CONFIG(MTL_CONFIG_2_TILE, MTL_PLL_RATIO_4_3); 160 160 161 161 return 0; 162 162 } ··· 334 334 335 335 prepare_wp_request(vdev, &wp, enable); 336 336 337 - ivpu_dbg(vdev, PM, "PLL workpoint request: %u Hz, config: 0x%x, epp: 0x%x, cdyn: 0x%x\n", 338 - PLL_RATIO_TO_FREQ(wp.target), wp.cfg, wp.epp, wp.cdyn); 337 + ivpu_dbg(vdev, PM, "PLL workpoint request: %lu MHz, config: 0x%x, epp: 0x%x, cdyn: 0x%x\n", 338 + pll_ratio_to_dpu_freq(vdev, wp.target) / HZ_PER_MHZ, wp.cfg, wp.epp, wp.cdyn); 339 339 340 340 ret = wp_request_send(vdev, &wp); 341 341 if (ret) { ··· 573 573 return REGB_POLL_FLD(VPU_HW_BTRS_LNL_VPU_STATUS, IDLE, 0x1, IDLE_TIMEOUT_US); 574 574 } 575 575 576 + static u32 pll_config_get_mtl(struct ivpu_device *vdev) 577 + { 578 + return REGB_RD32(VPU_HW_BTRS_MTL_CURRENT_PLL); 579 + } 580 + 581 + static u32 pll_config_get_lnl(struct ivpu_device *vdev) 582 + { 583 + return REGB_RD32(VPU_HW_BTRS_LNL_PLL_FREQ); 584 + } 585 + 586 + static u32 pll_ratio_to_dpu_freq_mtl(u16 ratio) 587 + { 588 + return (PLL_RATIO_TO_FREQ(ratio) * 2) / 3; 589 + } 590 + 591 + static u32 pll_ratio_to_dpu_freq_lnl(u16 ratio) 592 + { 593 + return PLL_RATIO_TO_FREQ(ratio) / 2; 594 + } 595 + 596 + static u32 pll_ratio_to_dpu_freq(struct ivpu_device *vdev, u32 ratio) 597 + { 598 + if (ivpu_hw_btrs_gen(vdev) == IVPU_HW_BTRS_MTL) 599 + return pll_ratio_to_dpu_freq_mtl(ratio); 600 + else 601 + return pll_ratio_to_dpu_freq_lnl(ratio); 602 + } 603 + 604 + u32 ivpu_hw_btrs_dpu_max_freq_get(struct ivpu_device *vdev) 605 + { 606 + return pll_ratio_to_dpu_freq(vdev, vdev->hw->pll.max_ratio); 607 + } 608 + 609 + u32 ivpu_hw_btrs_dpu_freq_get(struct ivpu_device *vdev) 610 + { 611 + if (ivpu_hw_btrs_gen(vdev) == IVPU_HW_BTRS_MTL) 612 + return pll_ratio_to_dpu_freq_mtl(pll_config_get_mtl(vdev)); 613 + else 614 + return pll_ratio_to_dpu_freq_lnl(pll_config_get_lnl(vdev)); 615 + } 616 + 576 617 /* Handler for IRQs from Buttress core (irqB) */ 577 618 bool ivpu_hw_btrs_irq_handler_mtl(struct ivpu_device *vdev, int irq) 578 619 { ··· 623 582 if (!status) 624 583 return false; 625 584 626 - if (REG_TEST_FLD(VPU_HW_BTRS_MTL_INTERRUPT_STAT, FREQ_CHANGE, status)) 627 - ivpu_dbg(vdev, IRQ, "FREQ_CHANGE irq: %08x", 628 - REGB_RD32(VPU_HW_BTRS_MTL_CURRENT_PLL)); 585 + if (REG_TEST_FLD(VPU_HW_BTRS_MTL_INTERRUPT_STAT, FREQ_CHANGE, status)) { 586 + u32 pll = pll_config_get_mtl(vdev); 587 + 588 + ivpu_dbg(vdev, IRQ, "FREQ_CHANGE irq, wp %08x, %lu MHz", 589 + pll, pll_ratio_to_dpu_freq_mtl(pll) / HZ_PER_MHZ); 590 + } 629 591 630 592 if (REG_TEST_FLD(VPU_HW_BTRS_MTL_INTERRUPT_STAT, ATS_ERR, status)) { 631 593 ivpu_err(vdev, "ATS_ERR irq 0x%016llx", REGB_RD64(VPU_HW_BTRS_MTL_ATS_ERR_LOG_0)); ··· 677 633 queue_work(system_wq, &vdev->irq_dct_work); 678 634 } 679 635 680 - if (REG_TEST_FLD(VPU_HW_BTRS_LNL_INTERRUPT_STAT, FREQ_CHANGE, status)) 681 - ivpu_dbg(vdev, IRQ, "FREQ_CHANGE irq: %08x", REGB_RD32(VPU_HW_BTRS_LNL_PLL_FREQ)); 636 + if (REG_TEST_FLD(VPU_HW_BTRS_LNL_INTERRUPT_STAT, FREQ_CHANGE, status)) { 637 + u32 pll = pll_config_get_lnl(vdev); 638 + 639 + ivpu_dbg(vdev, IRQ, "FREQ_CHANGE irq, wp %08x, %lu MHz", 640 + pll, pll_ratio_to_dpu_freq_lnl(pll) / HZ_PER_MHZ); 641 + } 682 642 683 643 if (REG_TEST_FLD(VPU_HW_BTRS_LNL_INTERRUPT_STAT, ATS_ERR, status)) { 684 644 ivpu_err(vdev, "ATS_ERR LOG1 0x%08x ATS_ERR_LOG2 0x%08x\n", ··· 763 715 val = REG_SET_FLD_NUM(VPU_HW_BTRS_LNL_PCODE_MAILBOX_STATUS, PARAM2, active_percent, val); 764 716 765 717 REGB_WR32(VPU_HW_BTRS_LNL_PCODE_MAILBOX_STATUS, val); 766 - } 767 - 768 - static u32 pll_ratio_to_freq_mtl(u32 ratio, u32 config) 769 - { 770 - u32 pll_clock = PLL_REF_CLK_FREQ * ratio; 771 - u32 cpu_clock; 772 - 773 - if ((config & 0xff) == MTL_PLL_RATIO_4_3) 774 - cpu_clock = pll_clock * 2 / 4; 775 - else 776 - cpu_clock = pll_clock * 2 / 5; 777 - 778 - return cpu_clock; 779 - } 780 - 781 - u32 ivpu_hw_btrs_ratio_to_freq(struct ivpu_device *vdev, u32 ratio) 782 - { 783 - struct ivpu_hw_info *hw = vdev->hw; 784 - 785 - if (ivpu_hw_btrs_gen(vdev) == IVPU_HW_BTRS_MTL) 786 - return pll_ratio_to_freq_mtl(ratio, hw->config); 787 - else 788 - return PLL_RATIO_TO_FREQ(ratio); 789 - } 790 - 791 - static u32 pll_freq_get_mtl(struct ivpu_device *vdev) 792 - { 793 - u32 pll_curr_ratio; 794 - 795 - pll_curr_ratio = REGB_RD32(VPU_HW_BTRS_MTL_CURRENT_PLL); 796 - pll_curr_ratio &= VPU_HW_BTRS_MTL_CURRENT_PLL_RATIO_MASK; 797 - 798 - if (!ivpu_is_silicon(vdev)) 799 - return PLL_SIMULATION_FREQ; 800 - 801 - return pll_ratio_to_freq_mtl(pll_curr_ratio, vdev->hw->config); 802 - } 803 - 804 - static u32 pll_freq_get_lnl(struct ivpu_device *vdev) 805 - { 806 - u32 pll_curr_ratio; 807 - 808 - pll_curr_ratio = REGB_RD32(VPU_HW_BTRS_LNL_PLL_FREQ); 809 - pll_curr_ratio &= VPU_HW_BTRS_LNL_PLL_FREQ_RATIO_MASK; 810 - 811 - return PLL_RATIO_TO_FREQ(pll_curr_ratio); 812 - } 813 - 814 - u32 ivpu_hw_btrs_pll_freq_get(struct ivpu_device *vdev) 815 - { 816 - if (ivpu_hw_btrs_gen(vdev) == IVPU_HW_BTRS_MTL) 817 - return pll_freq_get_mtl(vdev); 818 - else 819 - return pll_freq_get_lnl(vdev); 820 718 } 821 719 822 720 u32 ivpu_hw_btrs_telemetry_offset_get(struct ivpu_device *vdev)
+3 -4
drivers/accel/ivpu/ivpu_hw_btrs.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 2 /* 3 - * Copyright (C) 2020-2024 Intel Corporation 3 + * Copyright (C) 2020-2025 Intel Corporation 4 4 */ 5 5 6 6 #ifndef __IVPU_HW_BTRS_H__ ··· 13 13 14 14 #define PLL_PROFILING_FREQ_DEFAULT 38400000 15 15 #define PLL_PROFILING_FREQ_HIGH 400000000 16 - #define PLL_RATIO_TO_FREQ(x) ((x) * PLL_REF_CLK_FREQ) 17 16 18 17 #define DCT_DEFAULT_ACTIVE_PERCENT 15u 19 18 #define DCT_PERIOD_US 35300u ··· 31 32 void ivpu_hw_btrs_profiling_freq_reg_set_lnl(struct ivpu_device *vdev); 32 33 void ivpu_hw_btrs_ats_print_lnl(struct ivpu_device *vdev); 33 34 void ivpu_hw_btrs_clock_relinquish_disable_lnl(struct ivpu_device *vdev); 35 + u32 ivpu_hw_btrs_dpu_max_freq_get(struct ivpu_device *vdev); 36 + u32 ivpu_hw_btrs_dpu_freq_get(struct ivpu_device *vdev); 34 37 bool ivpu_hw_btrs_irq_handler_mtl(struct ivpu_device *vdev, int irq); 35 38 bool ivpu_hw_btrs_irq_handler_lnl(struct ivpu_device *vdev, int irq); 36 39 int ivpu_hw_btrs_dct_get_request(struct ivpu_device *vdev, bool *enable); 37 40 void ivpu_hw_btrs_dct_set_status(struct ivpu_device *vdev, bool enable, u32 dct_percent); 38 - u32 ivpu_hw_btrs_pll_freq_get(struct ivpu_device *vdev); 39 - u32 ivpu_hw_btrs_ratio_to_freq(struct ivpu_device *vdev, u32 ratio); 40 41 u32 ivpu_hw_btrs_telemetry_offset_get(struct ivpu_device *vdev); 41 42 u32 ivpu_hw_btrs_telemetry_size_get(struct ivpu_device *vdev); 42 43 u32 ivpu_hw_btrs_telemetry_enable_get(struct ivpu_device *vdev);
+8 -7
drivers/accel/ivpu/ivpu_job.c
··· 470 470 struct ivpu_device *vdev = job->vdev; 471 471 u32 i; 472 472 473 - ivpu_dbg(vdev, JOB, "Job destroyed: id %3u ctx %2d engine %d", 474 - job->job_id, job->file_priv->ctx.id, job->engine_idx); 473 + ivpu_dbg(vdev, JOB, "Job destroyed: id %3u ctx %2d cmdq_id %u engine %d", 474 + job->job_id, job->file_priv->ctx.id, job->cmdq_id, job->engine_idx); 475 475 476 476 for (i = 0; i < job->bo_count; i++) 477 477 if (job->bos[i]) ··· 564 564 dma_fence_signal(job->done_fence); 565 565 566 566 trace_job("done", job); 567 - ivpu_dbg(vdev, JOB, "Job complete: id %3u ctx %2d engine %d status 0x%x\n", 568 - job->job_id, job->file_priv->ctx.id, job->engine_idx, job_status); 567 + ivpu_dbg(vdev, JOB, "Job complete: id %3u ctx %2d cmdq_id %u engine %d status 0x%x\n", 568 + job->job_id, job->file_priv->ctx.id, job->cmdq_id, job->engine_idx, job_status); 569 569 570 570 ivpu_job_destroy(job); 571 571 ivpu_stop_job_timeout_detection(vdev); ··· 664 664 } 665 665 666 666 trace_job("submit", job); 667 - ivpu_dbg(vdev, JOB, "Job submitted: id %3u ctx %2d engine %d prio %d addr 0x%llx next %d\n", 668 - job->job_id, file_priv->ctx.id, job->engine_idx, cmdq->priority, 667 + ivpu_dbg(vdev, JOB, "Job submitted: id %3u ctx %2d cmdq_id %u engine %d prio %d addr 0x%llx next %d\n", 668 + job->job_id, file_priv->ctx.id, cmdq->id, job->engine_idx, cmdq->priority, 669 669 job->cmd_buf_vpu_addr, cmdq->jobq->header.tail); 670 670 671 671 mutex_unlock(&file_priv->lock); ··· 777 777 goto err_free_handles; 778 778 } 779 779 780 - ivpu_dbg(vdev, JOB, "Submit ioctl: ctx %u buf_count %u\n", file_priv->ctx.id, buffer_count); 780 + ivpu_dbg(vdev, JOB, "Submit ioctl: ctx %u cmdq_id %u buf_count %u\n", 781 + file_priv->ctx.id, cmdq_id, buffer_count); 781 782 782 783 job = ivpu_job_create(file_priv, engine, buffer_count); 783 784 if (!job) {
+48 -1
drivers/accel/ivpu/ivpu_sysfs.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * Copyright (C) 2024 Intel Corporation 3 + * Copyright (C) 2024-2025 Intel Corporation 4 4 */ 5 5 6 6 #include <linux/device.h> 7 7 #include <linux/err.h> 8 + #include <linux/pm_runtime.h> 9 + #include <linux/units.h> 8 10 9 11 #include "ivpu_drv.h" 10 12 #include "ivpu_gem.h" ··· 92 90 93 91 static DEVICE_ATTR_RO(sched_mode); 94 92 93 + /** 94 + * DOC: npu_max_frequency 95 + * 96 + * The npu_max_frequency shows maximum frequency in MHz of the NPU's data 97 + * processing unit 98 + */ 99 + static ssize_t 100 + npu_max_frequency_mhz_show(struct device *dev, struct device_attribute *attr, char *buf) 101 + { 102 + struct drm_device *drm = dev_get_drvdata(dev); 103 + struct ivpu_device *vdev = to_ivpu_device(drm); 104 + u32 freq = ivpu_hw_dpu_max_freq_get(vdev); 105 + 106 + return sysfs_emit(buf, "%lu\n", freq / HZ_PER_MHZ); 107 + } 108 + 109 + static DEVICE_ATTR_RO(npu_max_frequency_mhz); 110 + 111 + /** 112 + * DOC: npu_current_frequency_mhz 113 + * 114 + * The npu_current_frequency_mhz shows current frequency in MHz of the NPU's 115 + * data processing unit 116 + */ 117 + static ssize_t 118 + npu_current_frequency_mhz_show(struct device *dev, struct device_attribute *attr, char *buf) 119 + { 120 + struct drm_device *drm = dev_get_drvdata(dev); 121 + struct ivpu_device *vdev = to_ivpu_device(drm); 122 + u32 freq = 0; 123 + 124 + /* Read frequency only if device is active, otherwise frequency is 0 */ 125 + if (pm_runtime_get_if_active(vdev->drm.dev) > 0) { 126 + freq = ivpu_hw_dpu_freq_get(vdev); 127 + 128 + pm_runtime_put_autosuspend(vdev->drm.dev); 129 + } 130 + 131 + return sysfs_emit(buf, "%lu\n", freq / HZ_PER_MHZ); 132 + } 133 + 134 + static DEVICE_ATTR_RO(npu_current_frequency_mhz); 135 + 95 136 static struct attribute *ivpu_dev_attrs[] = { 96 137 &dev_attr_npu_busy_time_us.attr, 97 138 &dev_attr_npu_memory_utilization.attr, 98 139 &dev_attr_sched_mode.attr, 140 + &dev_attr_npu_max_frequency_mhz.attr, 141 + &dev_attr_npu_current_frequency_mhz.attr, 99 142 NULL, 100 143 }; 101 144
+10 -3
drivers/accel/ivpu/vpu_boot_api.h
··· 26 26 * Minor version changes when API backward compatibility is preserved. 27 27 * Resets to 0 if Major version is incremented. 28 28 */ 29 - #define VPU_BOOT_API_VER_MINOR 26 29 + #define VPU_BOOT_API_VER_MINOR 28 30 30 31 31 /* 32 32 * API header changed (field names, documentation, formatting) but API itself has not been changed ··· 76 76 * submission queue size and device capabilities. 77 77 */ 78 78 u32 preemption_buffer_2_size; 79 + /* 80 + * Maximum preemption buffer size that the FW can use: no need for the host 81 + * driver to allocate more space than that specified by these fields. 82 + * A value of 0 means no declared limit. 83 + */ 84 + u32 preemption_buffer_1_max_size; 85 + u32 preemption_buffer_2_max_size; 79 86 /* Space reserved for future preemption-related fields. */ 80 - u32 preemption_reserved[6]; 87 + u32 preemption_reserved[4]; 81 88 /* FW image read only section start address, 4KB aligned */ 82 89 u64 ro_section_start_address; 83 90 /* FW image read only section size, 4KB aligned */ ··· 141 134 /* 142 135 * Processor bit shifts (for loggable HW components). 143 136 */ 144 - #define VPU_TRACE_PROC_BIT_ARM 0 137 + #define VPU_TRACE_PROC_BIT_RESERVED 0 145 138 #define VPU_TRACE_PROC_BIT_LRT 1 146 139 #define VPU_TRACE_PROC_BIT_LNN 2 147 140 #define VPU_TRACE_PROC_BIT_SHV_0 3
+36 -17
drivers/accel/ivpu/vpu_jsm_api.h
··· 22 22 /* 23 23 * Minor version changes when API backward compatibility is preserved. 24 24 */ 25 - #define VPU_JSM_API_VER_MINOR 25 25 + #define VPU_JSM_API_VER_MINOR 29 26 26 27 27 /* 28 28 * API header changed (field names, documentation, formatting) but API itself has not been changed ··· 53 53 * Engine indexes. 54 54 */ 55 55 #define VPU_ENGINE_COMPUTE 0 56 - #define VPU_ENGINE_COPY 1 57 - #define VPU_ENGINE_NB 2 56 + #define VPU_ENGINE_NB 1 58 57 59 58 /* 60 59 * VPU status values. ··· 125 126 * When set, indicates that job queue uses native fences (as inline commands 126 127 * in job queue). Such queues may also use legacy fences (as commands in batch buffers). 127 128 * When cleared, indicates the job queue only uses legacy fences. 128 - * NOTE: For queues using native fences, VPU expects that all jobs in the queue 129 - * are immediately followed by an inline command object. This object is expected 130 - * to be a fence signal command in most cases, but can also be a NOP in case the host 131 - * does not need per-job fence signalling. Other inline commands objects can be 132 - * inserted between "job and inline command" pairs. 129 + * NOTES: 130 + * 1. For queues using native fences, VPU expects that all jobs in the queue 131 + * are immediately followed by an inline command object. This object is expected 132 + * to be a fence signal command in most cases, but can also be a NOP in case the host 133 + * does not need per-job fence signalling. Other inline commands objects can be 134 + * inserted between "job and inline command" pairs. 135 + * 2. Native fence queues are only supported on VPU 40xx onwards. 133 136 */ 134 137 VPU_JOB_QUEUE_FLAGS_USE_NATIVE_FENCE_MASK = (1 << 1U), 135 138 ··· 276 275 u64 value; 277 276 /* User VA of the log buffer in which to add log entry on completion. */ 278 277 u64 log_buffer_va; 278 + /* NPU private data. */ 279 + u64 npu_private_data; 279 280 } fence; 280 281 /* Other commands do not have a payload. */ 281 282 /* Payload definition for future inline commands can be inserted here. */ ··· 794 791 /** Metric group mask that identifies metric streamer instance. */ 795 792 u64 metric_group_mask; 796 793 /** 797 - * Address and size of the buffer where the VPU will write metric data. If 798 - * the buffer address is 0 or same as the currently used buffer the VPU will 799 - * continue writing metric data to the current buffer. In this case the 800 - * buffer size is ignored and the size of the current buffer is unchanged. 801 - * If the address is non-zero and differs from the current buffer address the 802 - * VPU will immediately switch data collection to the new buffer. 794 + * Address and size of the buffer where the VPU will write metric data. 795 + * This member dictates how the update operation should perform: 796 + * 1. client needs information about the number of collected samples and the 797 + * amount of data written to the current buffer 798 + * 2. client wants to switch to a new buffer 799 + * 800 + * Case 1. is identified by the buffer address being 0 or the same as the 801 + * currently used buffer address. In this case the buffer size is ignored and 802 + * the size of the current buffer is unchanged. The VPU will return an update 803 + * in the vpu_jsm_metric_streamer_done structure. The internal writing position 804 + * into the buffer is not changed. 805 + * 806 + * Case 2. is identified by the address being non-zero and differs from the 807 + * current buffer address. The VPU will immediately switch data collection to 808 + * the new buffer. Then the VPU will return an update in the 809 + * vpu_jsm_metric_streamer_done structure. 803 810 */ 804 811 u64 buffer_addr; 805 812 u64 buffer_size; ··· 947 934 /* 948 935 * Default quantum in 100ns units for scheduling across processes 949 936 * within a priority band 937 + * Minimum value supported by NPU is 1ms (10000 in 100ns units). 950 938 */ 951 939 u32 process_quantum[VPU_HWS_NUM_PRIORITY_BANDS]; 952 940 /* ··· 960 946 * in situations when it's starved by the focus band. 961 947 */ 962 948 u32 normal_band_percentage; 963 - /* Reserved */ 964 - u32 reserved_0; 949 + /* 950 + * TDR timeout value in milliseconds. Default value of 0 meaning no timeout. 951 + */ 952 + u32 tdr_timeout; 965 953 }; 966 954 967 955 /* ··· 1040 1024 s32 in_process_priority; 1041 1025 /* Zero padding / Reserved */ 1042 1026 u32 reserved_1; 1043 - /* Context quantum relative to other contexts of same priority in the same process */ 1027 + /* 1028 + * Context quantum relative to other contexts of same priority in the same process 1029 + * Minimum value supported by NPU is 1ms (10000 in 100ns units). 1030 + */ 1044 1031 u64 context_quantum; 1045 1032 /* Grace period when preempting context of the same priority within the same process */ 1046 1033 u64 grace_period_same_priority;
+2 -2
drivers/acpi/acpica/aclocal.h
··· 293 293 * expected_return_btypes - Allowed type(s) for the return value 294 294 */ 295 295 struct acpi_name_info { 296 - char name[ACPI_NAMESEG_SIZE]; 296 + char name[ACPI_NAMESEG_SIZE] __nonstring; 297 297 u16 argument_list; 298 298 u8 expected_btypes; 299 299 }; ··· 370 370 converted_object); 371 371 372 372 struct acpi_simple_repair_info { 373 - char name[ACPI_NAMESEG_SIZE]; 373 + char name[ACPI_NAMESEG_SIZE] __nonstring; 374 374 u32 unexpected_btypes; 375 375 u32 package_index; 376 376 acpi_object_converter object_converter;
+1 -1
drivers/acpi/acpica/nsrepair2.c
··· 25 25 return_object_ptr); 26 26 27 27 typedef struct acpi_repair_info { 28 - char name[ACPI_NAMESEG_SIZE]; 28 + char name[ACPI_NAMESEG_SIZE] __nonstring; 29 29 acpi_repair_function repair_function; 30 30 31 31 } acpi_repair_info;
-6
drivers/block/Kconfig
··· 388 388 definition isn't finalized yet, and might change according to future 389 389 requirement, so mark is as experimental now. 390 390 391 - Say Y if you want to get better performance because task_work_add() 392 - can be used in IO path for replacing io_uring cmd, which will become 393 - shared between IO tasks and ubq daemon, meantime task_work_add() can 394 - can handle batch more effectively, but task_work_add() isn't exported 395 - for module, so ublk has to be built to kernel. 396 - 397 391 config BLKDEV_UBLK_LEGACY_OPCODES 398 392 bool "Support legacy command opcode" 399 393 depends on BLK_DEV_UBLK
+22 -99
drivers/block/loop.c
··· 211 211 kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE); 212 212 } 213 213 214 - static int lo_write_bvec(struct file *file, struct bio_vec *bvec, loff_t *ppos) 215 - { 216 - struct iov_iter i; 217 - ssize_t bw; 218 - 219 - iov_iter_bvec(&i, ITER_SOURCE, bvec, 1, bvec->bv_len); 220 - 221 - bw = vfs_iter_write(file, &i, ppos, 0); 222 - 223 - if (likely(bw == bvec->bv_len)) 224 - return 0; 225 - 226 - printk_ratelimited(KERN_ERR 227 - "loop: Write error at byte offset %llu, length %i.\n", 228 - (unsigned long long)*ppos, bvec->bv_len); 229 - if (bw >= 0) 230 - bw = -EIO; 231 - return bw; 232 - } 233 - 234 - static int lo_write_simple(struct loop_device *lo, struct request *rq, 235 - loff_t pos) 236 - { 237 - struct bio_vec bvec; 238 - struct req_iterator iter; 239 - int ret = 0; 240 - 241 - rq_for_each_segment(bvec, rq, iter) { 242 - ret = lo_write_bvec(lo->lo_backing_file, &bvec, &pos); 243 - if (ret < 0) 244 - break; 245 - cond_resched(); 246 - } 247 - 248 - return ret; 249 - } 250 - 251 - static int lo_read_simple(struct loop_device *lo, struct request *rq, 252 - loff_t pos) 253 - { 254 - struct bio_vec bvec; 255 - struct req_iterator iter; 256 - struct iov_iter i; 257 - ssize_t len; 258 - 259 - rq_for_each_segment(bvec, rq, iter) { 260 - iov_iter_bvec(&i, ITER_DEST, &bvec, 1, bvec.bv_len); 261 - len = vfs_iter_read(lo->lo_backing_file, &i, &pos, 0); 262 - if (len < 0) 263 - return len; 264 - 265 - flush_dcache_page(bvec.bv_page); 266 - 267 - if (len != bvec.bv_len) { 268 - struct bio *bio; 269 - 270 - __rq_for_each_bio(bio, rq) 271 - zero_fill_bio(bio); 272 - break; 273 - } 274 - cond_resched(); 275 - } 276 - 277 - return 0; 278 - } 279 - 280 214 static void loop_clear_limits(struct loop_device *lo, int mode) 281 215 { 282 216 struct queue_limits lim = queue_limits_start_update(lo->lo_queue); ··· 276 342 struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq); 277 343 blk_status_t ret = BLK_STS_OK; 278 344 279 - if (!cmd->use_aio || cmd->ret < 0 || cmd->ret == blk_rq_bytes(rq) || 345 + if (cmd->ret < 0 || cmd->ret == blk_rq_bytes(rq) || 280 346 req_op(rq) != REQ_OP_READ) { 281 347 if (cmd->ret < 0) 282 348 ret = errno_to_blk_status(cmd->ret); ··· 292 358 cmd->ret = 0; 293 359 blk_mq_requeue_request(rq, true); 294 360 } else { 295 - if (cmd->use_aio) { 296 - struct bio *bio = rq->bio; 361 + struct bio *bio = rq->bio; 297 362 298 - while (bio) { 299 - zero_fill_bio(bio); 300 - bio = bio->bi_next; 301 - } 363 + while (bio) { 364 + zero_fill_bio(bio); 365 + bio = bio->bi_next; 302 366 } 367 + 303 368 ret = BLK_STS_IOERR; 304 369 end_io: 305 370 blk_mq_end_request(rq, ret); ··· 378 445 379 446 cmd->iocb.ki_pos = pos; 380 447 cmd->iocb.ki_filp = file; 381 - cmd->iocb.ki_complete = lo_rw_aio_complete; 382 - cmd->iocb.ki_flags = IOCB_DIRECT; 383 - cmd->iocb.ki_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0); 448 + cmd->iocb.ki_ioprio = req_get_ioprio(rq); 449 + if (cmd->use_aio) { 450 + cmd->iocb.ki_complete = lo_rw_aio_complete; 451 + cmd->iocb.ki_flags = IOCB_DIRECT; 452 + } else { 453 + cmd->iocb.ki_complete = NULL; 454 + cmd->iocb.ki_flags = 0; 455 + } 384 456 385 457 if (rw == ITER_SOURCE) 386 458 ret = file->f_op->write_iter(&cmd->iocb, &iter); ··· 396 458 397 459 if (ret != -EIOCBQUEUED) 398 460 lo_rw_aio_complete(&cmd->iocb, ret); 399 - return 0; 461 + return -EIOCBQUEUED; 400 462 } 401 463 402 464 static int do_req_filebacked(struct loop_device *lo, struct request *rq) ··· 404 466 struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq); 405 467 loff_t pos = ((loff_t) blk_rq_pos(rq) << 9) + lo->lo_offset; 406 468 407 - /* 408 - * lo_write_simple and lo_read_simple should have been covered 409 - * by io submit style function like lo_rw_aio(), one blocker 410 - * is that lo_read_simple() need to call flush_dcache_page after 411 - * the page is written from kernel, and it isn't easy to handle 412 - * this in io submit style function which submits all segments 413 - * of the req at one time. And direct read IO doesn't need to 414 - * run flush_dcache_page(). 415 - */ 416 469 switch (req_op(rq)) { 417 470 case REQ_OP_FLUSH: 418 471 return lo_req_flush(lo, rq); ··· 419 490 case REQ_OP_DISCARD: 420 491 return lo_fallocate(lo, rq, pos, FALLOC_FL_PUNCH_HOLE); 421 492 case REQ_OP_WRITE: 422 - if (cmd->use_aio) 423 - return lo_rw_aio(lo, cmd, pos, ITER_SOURCE); 424 - else 425 - return lo_write_simple(lo, rq, pos); 493 + return lo_rw_aio(lo, cmd, pos, ITER_SOURCE); 426 494 case REQ_OP_READ: 427 - if (cmd->use_aio) 428 - return lo_rw_aio(lo, cmd, pos, ITER_DEST); 429 - else 430 - return lo_read_simple(lo, rq, pos); 495 + return lo_rw_aio(lo, cmd, pos, ITER_DEST); 431 496 default: 432 497 WARN_ON_ONCE(1); 433 498 return -EIO; ··· 585 662 * dependency. 586 663 */ 587 664 fput(old_file); 665 + dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 0); 588 666 if (partscan) 589 667 loop_reread_partitions(lo); 590 668 591 669 error = 0; 592 670 done: 593 - /* enable and uncork uevent now that we are done */ 594 - dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 0); 671 + kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE); 595 672 return error; 596 673 597 674 out_err: 598 675 loop_global_unlock(lo, is_loop); 599 676 out_putf: 600 677 fput(file); 678 + dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 0); 601 679 goto done; 602 680 } 603 681 ··· 1053 1129 if (partscan) 1054 1130 clear_bit(GD_SUPPRESS_PART_SCAN, &lo->lo_disk->state); 1055 1131 1056 - /* enable and uncork uevent now that we are done */ 1057 1132 dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 0); 1133 + kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE); 1058 1134 1059 1135 loop_global_unlock(lo, is_loop); 1060 1136 if (partscan) ··· 1845 1921 struct loop_device *lo = rq->q->queuedata; 1846 1922 int ret = 0; 1847 1923 struct mem_cgroup *old_memcg = NULL; 1848 - const bool use_aio = cmd->use_aio; 1849 1924 1850 1925 if (write && (lo->lo_flags & LO_FLAGS_READ_ONLY)) { 1851 1926 ret = -EIO; ··· 1874 1951 } 1875 1952 failed: 1876 1953 /* complete non-aio request */ 1877 - if (!use_aio || ret) { 1954 + if (ret != -EIOCBQUEUED) { 1878 1955 if (ret == -EOPNOTSUPP) 1879 1956 cmd->ret = ret; 1880 1957 else
+271 -263
drivers/block/ublk_drv.c
··· 123 123 #define UBLK_IO_FLAG_OWNED_BY_SRV 0x02 124 124 125 125 /* 126 - * IO command is aborted, so this flag is set in case of 127 - * !UBLK_IO_FLAG_ACTIVE. 128 - * 129 - * After this flag is observed, any pending or new incoming request 130 - * associated with this io command will be failed immediately 131 - */ 132 - #define UBLK_IO_FLAG_ABORTED 0x04 133 - 134 - /* 135 126 * UBLK_IO_FLAG_NEED_GET_DATA is set because IO command requires 136 127 * get data buffer address from ublksrv. 137 128 * ··· 190 199 struct completion completion; 191 200 unsigned int nr_queues_ready; 192 201 unsigned int nr_privileged_daemon; 193 - 194 - struct work_struct nosrv_work; 195 202 }; 196 203 197 204 /* header of ublk_params */ ··· 198 209 __u32 types; 199 210 }; 200 211 201 - static bool ublk_abort_requests(struct ublk_device *ub, struct ublk_queue *ubq); 202 - 212 + static void ublk_stop_dev_unlocked(struct ublk_device *ub); 213 + static void ublk_abort_queue(struct ublk_device *ub, struct ublk_queue *ubq); 203 214 static inline struct request *__ublk_check_and_get_req(struct ublk_device *ub, 204 215 struct ublk_queue *ubq, int tag, size_t offset); 205 216 static inline unsigned int ublk_req_build_flags(struct request *req); ··· 1063 1074 1064 1075 static inline bool ubq_daemon_is_dying(struct ublk_queue *ubq) 1065 1076 { 1066 - return ubq->ubq_daemon->flags & PF_EXITING; 1077 + return !ubq->ubq_daemon || ubq->ubq_daemon->flags & PF_EXITING; 1067 1078 } 1068 1079 1069 1080 /* todo: handle partial completion */ ··· 1073 1084 struct ublk_io *io = &ubq->ios[req->tag]; 1074 1085 unsigned int unmapped_bytes; 1075 1086 blk_status_t res = BLK_STS_OK; 1076 - 1077 - /* called from ublk_abort_queue() code path */ 1078 - if (io->flags & UBLK_IO_FLAG_ABORTED) { 1079 - res = BLK_STS_IOERR; 1080 - goto exit; 1081 - } 1082 1087 1083 1088 /* failed read IO if nothing is read */ 1084 1089 if (!io->res && req_op(req) == REQ_OP_READ) ··· 1121 1138 struct request *req = blk_mq_rq_from_pdu(data); 1122 1139 1123 1140 __ublk_complete_rq(req); 1124 - } 1125 - 1126 - static void ublk_do_fail_rq(struct request *req) 1127 - { 1128 - struct ublk_queue *ubq = req->mq_hctx->driver_data; 1129 - 1130 - if (ublk_nosrv_should_reissue_outstanding(ubq->dev)) 1131 - blk_mq_requeue_request(req, false); 1132 - else 1133 - __ublk_complete_rq(req); 1134 - } 1135 - 1136 - static void ublk_fail_rq_fn(struct kref *ref) 1137 - { 1138 - struct ublk_rq_data *data = container_of(ref, struct ublk_rq_data, 1139 - ref); 1140 - struct request *req = blk_mq_rq_from_pdu(data); 1141 - 1142 - ublk_do_fail_rq(req); 1143 - } 1144 - 1145 - /* 1146 - * Since ublk_rq_task_work_cb always fails requests immediately during 1147 - * exiting, __ublk_fail_req() is only called from abort context during 1148 - * exiting. So lock is unnecessary. 1149 - * 1150 - * Also aborting may not be started yet, keep in mind that one failed 1151 - * request may be issued by block layer again. 1152 - */ 1153 - static void __ublk_fail_req(struct ublk_queue *ubq, struct ublk_io *io, 1154 - struct request *req) 1155 - { 1156 - WARN_ON_ONCE(io->flags & UBLK_IO_FLAG_ACTIVE); 1157 - 1158 - if (ublk_need_req_ref(ubq)) { 1159 - struct ublk_rq_data *data = blk_mq_rq_to_pdu(req); 1160 - 1161 - kref_put(&data->ref, ublk_fail_rq_fn); 1162 - } else { 1163 - ublk_do_fail_rq(req); 1164 - } 1165 1141 } 1166 1142 1167 1143 static void ubq_complete_io_cmd(struct ublk_io *io, int res, ··· 1278 1336 static enum blk_eh_timer_return ublk_timeout(struct request *rq) 1279 1337 { 1280 1338 struct ublk_queue *ubq = rq->mq_hctx->driver_data; 1281 - unsigned int nr_inflight = 0; 1282 - int i; 1283 1339 1284 1340 if (ubq->flags & UBLK_F_UNPRIVILEGED_DEV) { 1285 1341 if (!ubq->timeout) { ··· 1285 1345 ubq->timeout = true; 1286 1346 } 1287 1347 1288 - return BLK_EH_DONE; 1289 - } 1290 - 1291 - if (!ubq_daemon_is_dying(ubq)) 1292 - return BLK_EH_RESET_TIMER; 1293 - 1294 - for (i = 0; i < ubq->q_depth; i++) { 1295 - struct ublk_io *io = &ubq->ios[i]; 1296 - 1297 - if (!(io->flags & UBLK_IO_FLAG_ACTIVE)) 1298 - nr_inflight++; 1299 - } 1300 - 1301 - /* cancelable uring_cmd can't help us if all commands are in-flight */ 1302 - if (nr_inflight == ubq->q_depth) { 1303 - struct ublk_device *ub = ubq->dev; 1304 - 1305 - if (ublk_abort_requests(ub, ubq)) { 1306 - schedule_work(&ub->nosrv_work); 1307 - } 1308 1348 return BLK_EH_DONE; 1309 1349 } 1310 1350 ··· 1390 1470 .timeout = ublk_timeout, 1391 1471 }; 1392 1472 1473 + static void ublk_queue_reinit(struct ublk_device *ub, struct ublk_queue *ubq) 1474 + { 1475 + int i; 1476 + 1477 + /* All old ioucmds have to be completed */ 1478 + ubq->nr_io_ready = 0; 1479 + 1480 + /* 1481 + * old daemon is PF_EXITING, put it now 1482 + * 1483 + * It could be NULL in case of closing one quisced device. 1484 + */ 1485 + if (ubq->ubq_daemon) 1486 + put_task_struct(ubq->ubq_daemon); 1487 + /* We have to reset it to NULL, otherwise ub won't accept new FETCH_REQ */ 1488 + ubq->ubq_daemon = NULL; 1489 + ubq->timeout = false; 1490 + 1491 + for (i = 0; i < ubq->q_depth; i++) { 1492 + struct ublk_io *io = &ubq->ios[i]; 1493 + 1494 + /* 1495 + * UBLK_IO_FLAG_CANCELED is kept for avoiding to touch 1496 + * io->cmd 1497 + */ 1498 + io->flags &= UBLK_IO_FLAG_CANCELED; 1499 + io->cmd = NULL; 1500 + io->addr = 0; 1501 + } 1502 + } 1503 + 1393 1504 static int ublk_ch_open(struct inode *inode, struct file *filp) 1394 1505 { 1395 1506 struct ublk_device *ub = container_of(inode->i_cdev, ··· 1432 1481 return 0; 1433 1482 } 1434 1483 1484 + static void ublk_reset_ch_dev(struct ublk_device *ub) 1485 + { 1486 + int i; 1487 + 1488 + for (i = 0; i < ub->dev_info.nr_hw_queues; i++) 1489 + ublk_queue_reinit(ub, ublk_get_queue(ub, i)); 1490 + 1491 + /* set to NULL, otherwise new ubq_daemon cannot mmap the io_cmd_buf */ 1492 + ub->mm = NULL; 1493 + ub->nr_queues_ready = 0; 1494 + ub->nr_privileged_daemon = 0; 1495 + } 1496 + 1497 + static struct gendisk *ublk_get_disk(struct ublk_device *ub) 1498 + { 1499 + struct gendisk *disk; 1500 + 1501 + spin_lock(&ub->lock); 1502 + disk = ub->ub_disk; 1503 + if (disk) 1504 + get_device(disk_to_dev(disk)); 1505 + spin_unlock(&ub->lock); 1506 + 1507 + return disk; 1508 + } 1509 + 1510 + static void ublk_put_disk(struct gendisk *disk) 1511 + { 1512 + if (disk) 1513 + put_device(disk_to_dev(disk)); 1514 + } 1515 + 1435 1516 static int ublk_ch_release(struct inode *inode, struct file *filp) 1436 1517 { 1437 1518 struct ublk_device *ub = filp->private_data; 1519 + struct gendisk *disk; 1520 + int i; 1438 1521 1522 + /* 1523 + * disk isn't attached yet, either device isn't live, or it has 1524 + * been removed already, so we needn't to do anything 1525 + */ 1526 + disk = ublk_get_disk(ub); 1527 + if (!disk) 1528 + goto out; 1529 + 1530 + /* 1531 + * All uring_cmd are done now, so abort any request outstanding to 1532 + * the ublk server 1533 + * 1534 + * This can be done in lockless way because ublk server has been 1535 + * gone 1536 + * 1537 + * More importantly, we have to provide forward progress guarantee 1538 + * without holding ub->mutex, otherwise control task grabbing 1539 + * ub->mutex triggers deadlock 1540 + * 1541 + * All requests may be inflight, so ->canceling may not be set, set 1542 + * it now. 1543 + */ 1544 + for (i = 0; i < ub->dev_info.nr_hw_queues; i++) { 1545 + struct ublk_queue *ubq = ublk_get_queue(ub, i); 1546 + 1547 + ubq->canceling = true; 1548 + ublk_abort_queue(ub, ubq); 1549 + } 1550 + blk_mq_kick_requeue_list(disk->queue); 1551 + 1552 + /* 1553 + * All infligh requests have been completed or requeued and any new 1554 + * request will be failed or requeued via `->canceling` now, so it is 1555 + * fine to grab ub->mutex now. 1556 + */ 1557 + mutex_lock(&ub->mutex); 1558 + 1559 + /* double check after grabbing lock */ 1560 + if (!ub->ub_disk) 1561 + goto unlock; 1562 + 1563 + /* 1564 + * Transition the device to the nosrv state. What exactly this 1565 + * means depends on the recovery flags 1566 + */ 1567 + blk_mq_quiesce_queue(disk->queue); 1568 + if (ublk_nosrv_should_stop_dev(ub)) { 1569 + /* 1570 + * Allow any pending/future I/O to pass through quickly 1571 + * with an error. This is needed because del_gendisk 1572 + * waits for all pending I/O to complete 1573 + */ 1574 + for (i = 0; i < ub->dev_info.nr_hw_queues; i++) 1575 + ublk_get_queue(ub, i)->force_abort = true; 1576 + blk_mq_unquiesce_queue(disk->queue); 1577 + 1578 + ublk_stop_dev_unlocked(ub); 1579 + } else { 1580 + if (ublk_nosrv_dev_should_queue_io(ub)) { 1581 + /* ->canceling is set and all requests are aborted */ 1582 + ub->dev_info.state = UBLK_S_DEV_QUIESCED; 1583 + } else { 1584 + ub->dev_info.state = UBLK_S_DEV_FAIL_IO; 1585 + for (i = 0; i < ub->dev_info.nr_hw_queues; i++) 1586 + ublk_get_queue(ub, i)->fail_io = true; 1587 + } 1588 + blk_mq_unquiesce_queue(disk->queue); 1589 + } 1590 + unlock: 1591 + mutex_unlock(&ub->mutex); 1592 + ublk_put_disk(disk); 1593 + 1594 + /* all uring_cmd has been done now, reset device & ubq */ 1595 + ublk_reset_ch_dev(ub); 1596 + out: 1439 1597 clear_bit(UB_STATE_OPEN, &ub->state); 1440 1598 return 0; 1441 1599 } ··· 1611 1551 ublk_put_req_ref(ubq, req); 1612 1552 } 1613 1553 1554 + static void __ublk_fail_req(struct ublk_queue *ubq, struct ublk_io *io, 1555 + struct request *req) 1556 + { 1557 + WARN_ON_ONCE(io->flags & UBLK_IO_FLAG_ACTIVE); 1558 + 1559 + if (ublk_nosrv_should_reissue_outstanding(ubq->dev)) 1560 + blk_mq_requeue_request(req, false); 1561 + else { 1562 + io->res = -EIO; 1563 + __ublk_complete_rq(req); 1564 + } 1565 + } 1566 + 1614 1567 /* 1615 - * Called from ubq_daemon context via cancel fn, meantime quiesce ublk 1616 - * blk-mq queue, so we are called exclusively with blk-mq and ubq_daemon 1617 - * context, so everything is serialized. 1568 + * Called from ublk char device release handler, when any uring_cmd is 1569 + * done, meantime request queue is "quiesced" since all inflight requests 1570 + * can't be completed because ublk server is dead. 1571 + * 1572 + * So no one can hold our request IO reference any more, simply ignore the 1573 + * reference, and complete the request immediately 1618 1574 */ 1619 1575 static void ublk_abort_queue(struct ublk_device *ub, struct ublk_queue *ubq) 1620 1576 { ··· 1647 1571 * will do it 1648 1572 */ 1649 1573 rq = blk_mq_tag_to_rq(ub->tag_set.tags[ubq->q_id], i); 1650 - if (rq && blk_mq_request_started(rq)) { 1651 - io->flags |= UBLK_IO_FLAG_ABORTED; 1574 + if (rq && blk_mq_request_started(rq)) 1652 1575 __ublk_fail_req(ubq, io, rq); 1653 - } 1654 1576 } 1655 1577 } 1656 1578 } 1657 1579 1658 1580 /* Must be called when queue is frozen */ 1659 - static bool ublk_mark_queue_canceling(struct ublk_queue *ubq) 1581 + static void ublk_mark_queue_canceling(struct ublk_queue *ubq) 1660 1582 { 1661 - bool canceled; 1662 - 1663 1583 spin_lock(&ubq->cancel_lock); 1664 - canceled = ubq->canceling; 1665 - if (!canceled) 1584 + if (!ubq->canceling) 1666 1585 ubq->canceling = true; 1667 1586 spin_unlock(&ubq->cancel_lock); 1668 - 1669 - return canceled; 1670 1587 } 1671 1588 1672 - static bool ublk_abort_requests(struct ublk_device *ub, struct ublk_queue *ubq) 1589 + static void ublk_start_cancel(struct ublk_queue *ubq) 1673 1590 { 1674 - bool was_canceled = ubq->canceling; 1675 - struct gendisk *disk; 1676 - 1677 - if (was_canceled) 1678 - return false; 1679 - 1680 - spin_lock(&ub->lock); 1681 - disk = ub->ub_disk; 1682 - if (disk) 1683 - get_device(disk_to_dev(disk)); 1684 - spin_unlock(&ub->lock); 1591 + struct ublk_device *ub = ubq->dev; 1592 + struct gendisk *disk = ublk_get_disk(ub); 1685 1593 1686 1594 /* Our disk has been dead */ 1687 1595 if (!disk) 1688 - return false; 1689 - 1596 + return; 1690 1597 /* 1691 1598 * Now we are serialized with ublk_queue_rq() 1692 1599 * ··· 1678 1619 * touch completed uring_cmd 1679 1620 */ 1680 1621 blk_mq_quiesce_queue(disk->queue); 1681 - was_canceled = ublk_mark_queue_canceling(ubq); 1682 - if (!was_canceled) { 1683 - /* abort queue is for making forward progress */ 1684 - ublk_abort_queue(ub, ubq); 1685 - } 1622 + ublk_mark_queue_canceling(ubq); 1686 1623 blk_mq_unquiesce_queue(disk->queue); 1687 - put_device(disk_to_dev(disk)); 1688 - 1689 - return !was_canceled; 1624 + ublk_put_disk(disk); 1690 1625 } 1691 1626 1692 1627 static void ublk_cancel_cmd(struct ublk_queue *ubq, struct ublk_io *io, ··· 1704 1651 /* 1705 1652 * The ublk char device won't be closed when calling cancel fn, so both 1706 1653 * ublk device and queue are guaranteed to be live 1654 + * 1655 + * Two-stage cancel: 1656 + * 1657 + * - make every active uring_cmd done in ->cancel_fn() 1658 + * 1659 + * - aborting inflight ublk IO requests in ublk char device release handler, 1660 + * which depends on 1st stage because device can only be closed iff all 1661 + * uring_cmd are done 1662 + * 1663 + * Do _not_ try to acquire ub->mutex before all inflight requests are 1664 + * aborted, otherwise deadlock may be caused. 1707 1665 */ 1708 1666 static void ublk_uring_cmd_cancel_fn(struct io_uring_cmd *cmd, 1709 1667 unsigned int issue_flags) ··· 1722 1658 struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd); 1723 1659 struct ublk_queue *ubq = pdu->ubq; 1724 1660 struct task_struct *task; 1725 - struct ublk_device *ub; 1726 - bool need_schedule; 1727 1661 struct ublk_io *io; 1728 1662 1729 1663 if (WARN_ON_ONCE(!ubq)) ··· 1734 1672 if (WARN_ON_ONCE(task && task != ubq->ubq_daemon)) 1735 1673 return; 1736 1674 1737 - ub = ubq->dev; 1738 - need_schedule = ublk_abort_requests(ub, ubq); 1675 + if (!ubq->canceling) 1676 + ublk_start_cancel(ubq); 1739 1677 1740 1678 io = &ubq->ios[pdu->tag]; 1741 1679 WARN_ON_ONCE(io->cmd != cmd); 1742 1680 ublk_cancel_cmd(ubq, io, issue_flags); 1743 - 1744 - if (need_schedule) { 1745 - schedule_work(&ub->nosrv_work); 1746 - } 1747 1681 } 1748 1682 1749 1683 static inline bool ublk_queue_ready(struct ublk_queue *ubq) ··· 1790 1732 } 1791 1733 } 1792 1734 1793 - static void __ublk_quiesce_dev(struct ublk_device *ub) 1735 + static void ublk_force_abort_dev(struct ublk_device *ub) 1794 1736 { 1795 - pr_devel("%s: quiesce ub: dev_id %d state %s\n", 1737 + int i; 1738 + 1739 + pr_devel("%s: force abort ub: dev_id %d state %s\n", 1796 1740 __func__, ub->dev_info.dev_id, 1797 1741 ub->dev_info.state == UBLK_S_DEV_LIVE ? 1798 1742 "LIVE" : "QUIESCED"); 1799 1743 blk_mq_quiesce_queue(ub->ub_disk->queue); 1800 - ublk_wait_tagset_rqs_idle(ub); 1801 - ub->dev_info.state = UBLK_S_DEV_QUIESCED; 1802 - } 1744 + if (ub->dev_info.state == UBLK_S_DEV_LIVE) 1745 + ublk_wait_tagset_rqs_idle(ub); 1803 1746 1804 - static void ublk_unquiesce_dev(struct ublk_device *ub) 1805 - { 1806 - int i; 1807 - 1808 - pr_devel("%s: unquiesce ub: dev_id %d state %s\n", 1809 - __func__, ub->dev_info.dev_id, 1810 - ub->dev_info.state == UBLK_S_DEV_LIVE ? 1811 - "LIVE" : "QUIESCED"); 1812 - /* quiesce_work has run. We let requeued rqs be aborted 1813 - * before running fallback_wq. "force_abort" must be seen 1814 - * after request queue is unqiuesced. Then del_gendisk() 1815 - * can move on. 1816 - */ 1817 1747 for (i = 0; i < ub->dev_info.nr_hw_queues; i++) 1818 1748 ublk_get_queue(ub, i)->force_abort = true; 1819 - 1820 1749 blk_mq_unquiesce_queue(ub->ub_disk->queue); 1821 1750 /* We may have requeued some rqs in ublk_quiesce_queue() */ 1822 1751 blk_mq_kick_requeue_list(ub->ub_disk->queue); ··· 1824 1779 return disk; 1825 1780 } 1826 1781 1827 - static void ublk_stop_dev(struct ublk_device *ub) 1782 + static void ublk_stop_dev_unlocked(struct ublk_device *ub) 1783 + __must_hold(&ub->mutex) 1828 1784 { 1829 1785 struct gendisk *disk; 1830 1786 1831 - mutex_lock(&ub->mutex); 1832 1787 if (ub->dev_info.state == UBLK_S_DEV_DEAD) 1833 - goto unlock; 1834 - if (ublk_nosrv_dev_should_queue_io(ub)) { 1835 - if (ub->dev_info.state == UBLK_S_DEV_LIVE) 1836 - __ublk_quiesce_dev(ub); 1837 - ublk_unquiesce_dev(ub); 1838 - } 1788 + return; 1789 + 1790 + if (ublk_nosrv_dev_should_queue_io(ub)) 1791 + ublk_force_abort_dev(ub); 1839 1792 del_gendisk(ub->ub_disk); 1840 1793 disk = ublk_detach_disk(ub); 1841 1794 put_disk(disk); 1842 - unlock: 1795 + } 1796 + 1797 + static void ublk_stop_dev(struct ublk_device *ub) 1798 + { 1799 + mutex_lock(&ub->mutex); 1800 + ublk_stop_dev_unlocked(ub); 1843 1801 mutex_unlock(&ub->mutex); 1844 1802 ublk_cancel_dev(ub); 1845 1803 } 1846 1804 1847 - static void ublk_nosrv_work(struct work_struct *work) 1805 + /* reset ublk io_uring queue & io flags */ 1806 + static void ublk_reset_io_flags(struct ublk_device *ub) 1848 1807 { 1849 - struct ublk_device *ub = 1850 - container_of(work, struct ublk_device, nosrv_work); 1851 - int i; 1808 + int i, j; 1852 1809 1853 - if (ublk_nosrv_should_stop_dev(ub)) { 1854 - ublk_stop_dev(ub); 1855 - return; 1810 + for (i = 0; i < ub->dev_info.nr_hw_queues; i++) { 1811 + struct ublk_queue *ubq = ublk_get_queue(ub, i); 1812 + 1813 + /* UBLK_IO_FLAG_CANCELED can be cleared now */ 1814 + spin_lock(&ubq->cancel_lock); 1815 + for (j = 0; j < ubq->q_depth; j++) 1816 + ubq->ios[j].flags &= ~UBLK_IO_FLAG_CANCELED; 1817 + spin_unlock(&ubq->cancel_lock); 1818 + ubq->canceling = false; 1819 + ubq->fail_io = false; 1856 1820 } 1857 - 1858 - mutex_lock(&ub->mutex); 1859 - if (ub->dev_info.state != UBLK_S_DEV_LIVE) 1860 - goto unlock; 1861 - 1862 - if (ublk_nosrv_dev_should_queue_io(ub)) { 1863 - __ublk_quiesce_dev(ub); 1864 - } else { 1865 - blk_mq_quiesce_queue(ub->ub_disk->queue); 1866 - ub->dev_info.state = UBLK_S_DEV_FAIL_IO; 1867 - for (i = 0; i < ub->dev_info.nr_hw_queues; i++) { 1868 - ublk_get_queue(ub, i)->fail_io = true; 1869 - } 1870 - blk_mq_unquiesce_queue(ub->ub_disk->queue); 1871 - } 1872 - 1873 - unlock: 1874 - mutex_unlock(&ub->mutex); 1875 - ublk_cancel_dev(ub); 1876 1821 } 1877 1822 1878 1823 /* device can only be started after all IOs are ready */ 1879 1824 static void ublk_mark_io_ready(struct ublk_device *ub, struct ublk_queue *ubq) 1825 + __must_hold(&ub->mutex) 1880 1826 { 1881 - mutex_lock(&ub->mutex); 1882 1827 ubq->nr_io_ready++; 1883 1828 if (ublk_queue_ready(ubq)) { 1884 1829 ubq->ubq_daemon = current; ··· 1878 1843 if (capable(CAP_SYS_ADMIN)) 1879 1844 ub->nr_privileged_daemon++; 1880 1845 } 1881 - if (ub->nr_queues_ready == ub->dev_info.nr_hw_queues) 1846 + 1847 + if (ub->nr_queues_ready == ub->dev_info.nr_hw_queues) { 1848 + /* now we are ready for handling ublk io request */ 1849 + ublk_reset_io_flags(ub); 1882 1850 complete_all(&ub->completion); 1883 - mutex_unlock(&ub->mutex); 1851 + } 1884 1852 } 1885 1853 1886 1854 static void ublk_handle_need_get_data(struct ublk_device *ub, int q_id, ··· 1967 1929 return io_buffer_unregister_bvec(cmd, index, issue_flags); 1968 1930 } 1969 1931 1932 + static int ublk_fetch(struct io_uring_cmd *cmd, struct ublk_queue *ubq, 1933 + struct ublk_io *io, __u64 buf_addr) 1934 + { 1935 + struct ublk_device *ub = ubq->dev; 1936 + int ret = 0; 1937 + 1938 + /* 1939 + * When handling FETCH command for setting up ublk uring queue, 1940 + * ub->mutex is the innermost lock, and we won't block for handling 1941 + * FETCH, so it is fine even for IO_URING_F_NONBLOCK. 1942 + */ 1943 + mutex_lock(&ub->mutex); 1944 + /* UBLK_IO_FETCH_REQ is only allowed before queue is setup */ 1945 + if (ublk_queue_ready(ubq)) { 1946 + ret = -EBUSY; 1947 + goto out; 1948 + } 1949 + 1950 + /* allow each command to be FETCHed at most once */ 1951 + if (io->flags & UBLK_IO_FLAG_ACTIVE) { 1952 + ret = -EINVAL; 1953 + goto out; 1954 + } 1955 + 1956 + WARN_ON_ONCE(io->flags & UBLK_IO_FLAG_OWNED_BY_SRV); 1957 + 1958 + if (ublk_need_map_io(ubq)) { 1959 + /* 1960 + * FETCH_RQ has to provide IO buffer if NEED GET 1961 + * DATA is not enabled 1962 + */ 1963 + if (!buf_addr && !ublk_need_get_data(ubq)) 1964 + goto out; 1965 + } else if (buf_addr) { 1966 + /* User copy requires addr to be unset */ 1967 + ret = -EINVAL; 1968 + goto out; 1969 + } 1970 + 1971 + ublk_fill_io_cmd(io, cmd, buf_addr); 1972 + ublk_mark_io_ready(ub, ubq); 1973 + out: 1974 + mutex_unlock(&ub->mutex); 1975 + return ret; 1976 + } 1977 + 1970 1978 static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd, 1971 1979 unsigned int issue_flags, 1972 1980 const struct ublksrv_io_cmd *ub_cmd) ··· 2069 1985 case UBLK_IO_UNREGISTER_IO_BUF: 2070 1986 return ublk_unregister_io_buf(cmd, ub_cmd->addr, issue_flags); 2071 1987 case UBLK_IO_FETCH_REQ: 2072 - /* UBLK_IO_FETCH_REQ is only allowed before queue is setup */ 2073 - if (ublk_queue_ready(ubq)) { 2074 - ret = -EBUSY; 1988 + ret = ublk_fetch(cmd, ubq, io, ub_cmd->addr); 1989 + if (ret) 2075 1990 goto out; 2076 - } 2077 - /* 2078 - * The io is being handled by server, so COMMIT_RQ is expected 2079 - * instead of FETCH_REQ 2080 - */ 2081 - if (io->flags & UBLK_IO_FLAG_OWNED_BY_SRV) 2082 - goto out; 2083 - 2084 - if (ublk_need_map_io(ubq)) { 2085 - /* 2086 - * FETCH_RQ has to provide IO buffer if NEED GET 2087 - * DATA is not enabled 2088 - */ 2089 - if (!ub_cmd->addr && !ublk_need_get_data(ubq)) 2090 - goto out; 2091 - } else if (ub_cmd->addr) { 2092 - /* User copy requires addr to be unset */ 2093 - ret = -EINVAL; 2094 - goto out; 2095 - } 2096 - 2097 - ublk_fill_io_cmd(io, cmd, ub_cmd->addr); 2098 - ublk_mark_io_ready(ub, ubq); 2099 1991 break; 2100 1992 case UBLK_IO_COMMIT_AND_FETCH_REQ: 2101 1993 req = blk_mq_tag_to_rq(ub->tag_set.tags[ub_cmd->q_id], tag); ··· 2471 2411 bool unprivileged; 2472 2412 2473 2413 ublk_stop_dev(ub); 2474 - cancel_work_sync(&ub->nosrv_work); 2475 2414 cdev_device_del(&ub->cdev, &ub->cdev_dev); 2476 2415 unprivileged = ub->dev_info.flags & UBLK_F_UNPRIVILEGED_DEV; 2477 2416 ublk_put_device(ub); ··· 2755 2696 goto out_unlock; 2756 2697 mutex_init(&ub->mutex); 2757 2698 spin_lock_init(&ub->lock); 2758 - INIT_WORK(&ub->nosrv_work, ublk_nosrv_work); 2759 2699 2760 2700 ret = ublk_alloc_dev_number(ub, header->dev_id); 2761 2701 if (ret < 0) ··· 2886 2828 static int ublk_ctrl_stop_dev(struct ublk_device *ub) 2887 2829 { 2888 2830 ublk_stop_dev(ub); 2889 - cancel_work_sync(&ub->nosrv_work); 2890 2831 return 0; 2891 2832 } 2892 2833 ··· 2989 2932 return ret; 2990 2933 } 2991 2934 2992 - static void ublk_queue_reinit(struct ublk_device *ub, struct ublk_queue *ubq) 2993 - { 2994 - int i; 2995 - 2996 - WARN_ON_ONCE(!(ubq->ubq_daemon && ubq_daemon_is_dying(ubq))); 2997 - 2998 - /* All old ioucmds have to be completed */ 2999 - ubq->nr_io_ready = 0; 3000 - /* old daemon is PF_EXITING, put it now */ 3001 - put_task_struct(ubq->ubq_daemon); 3002 - /* We have to reset it to NULL, otherwise ub won't accept new FETCH_REQ */ 3003 - ubq->ubq_daemon = NULL; 3004 - ubq->timeout = false; 3005 - ubq->canceling = false; 3006 - 3007 - for (i = 0; i < ubq->q_depth; i++) { 3008 - struct ublk_io *io = &ubq->ios[i]; 3009 - 3010 - /* forget everything now and be ready for new FETCH_REQ */ 3011 - io->flags = 0; 3012 - io->cmd = NULL; 3013 - io->addr = 0; 3014 - } 3015 - } 3016 - 3017 2935 static int ublk_ctrl_start_recovery(struct ublk_device *ub, 3018 2936 const struct ublksrv_ctrl_cmd *header) 3019 2937 { 3020 2938 int ret = -EINVAL; 3021 - int i; 3022 2939 3023 2940 mutex_lock(&ub->mutex); 3024 2941 if (ublk_nosrv_should_stop_dev(ub)) 3025 - goto out_unlock; 3026 - if (!ub->nr_queues_ready) 3027 2942 goto out_unlock; 3028 2943 /* 3029 2944 * START_RECOVERY is only allowd after: ··· 3020 2991 goto out_unlock; 3021 2992 } 3022 2993 pr_devel("%s: start recovery for dev id %d.\n", __func__, header->dev_id); 3023 - for (i = 0; i < ub->dev_info.nr_hw_queues; i++) 3024 - ublk_queue_reinit(ub, ublk_get_queue(ub, i)); 3025 - /* set to NULL, otherwise new ubq_daemon cannot mmap the io_cmd_buf */ 3026 - ub->mm = NULL; 3027 - ub->nr_queues_ready = 0; 3028 - ub->nr_privileged_daemon = 0; 3029 2994 init_completion(&ub->completion); 3030 2995 ret = 0; 3031 2996 out_unlock: ··· 3032 3009 { 3033 3010 int ublksrv_pid = (int)header->data[0]; 3034 3011 int ret = -EINVAL; 3035 - int i; 3036 3012 3037 3013 pr_devel("%s: Waiting for new ubq_daemons(nr: %d) are ready, dev id %d...\n", 3038 3014 __func__, ub->dev_info.nr_hw_queues, header->dev_id); ··· 3051 3029 goto out_unlock; 3052 3030 } 3053 3031 ub->dev_info.ublksrv_pid = ublksrv_pid; 3032 + ub->dev_info.state = UBLK_S_DEV_LIVE; 3054 3033 pr_devel("%s: new ublksrv_pid %d, dev id %d\n", 3055 3034 __func__, ublksrv_pid, header->dev_id); 3056 - 3057 - if (ublk_nosrv_dev_should_queue_io(ub)) { 3058 - ub->dev_info.state = UBLK_S_DEV_LIVE; 3059 - blk_mq_unquiesce_queue(ub->ub_disk->queue); 3060 - pr_devel("%s: queue unquiesced, dev id %d.\n", 3061 - __func__, header->dev_id); 3062 - blk_mq_kick_requeue_list(ub->ub_disk->queue); 3063 - } else { 3064 - blk_mq_quiesce_queue(ub->ub_disk->queue); 3065 - ub->dev_info.state = UBLK_S_DEV_LIVE; 3066 - for (i = 0; i < ub->dev_info.nr_hw_queues; i++) { 3067 - ublk_get_queue(ub, i)->fail_io = false; 3068 - } 3069 - blk_mq_unquiesce_queue(ub->ub_disk->queue); 3070 - } 3071 - 3035 + blk_mq_kick_requeue_list(ub->ub_disk->queue); 3072 3036 ret = 0; 3073 3037 out_unlock: 3074 3038 mutex_unlock(&ub->mutex);
+4 -3
drivers/char/virtio_console.c
··· 1576 1576 break; 1577 1577 case VIRTIO_CONSOLE_RESIZE: { 1578 1578 struct { 1579 - __u16 rows; 1580 - __u16 cols; 1579 + __virtio16 cols; 1580 + __virtio16 rows; 1581 1581 } size; 1582 1582 1583 1583 if (!is_console_port(port)) ··· 1585 1585 1586 1586 memcpy(&size, buf->buf + buf->offset + sizeof(*cpkt), 1587 1587 sizeof(size)); 1588 - set_console_size(port, size.rows, size.cols); 1588 + set_console_size(port, virtio16_to_cpu(vdev, size.rows), 1589 + virtio16_to_cpu(vdev, size.cols)); 1589 1590 1590 1591 port->cons.hvc->irq_requested = 1; 1591 1592 resize_console(port);
+17 -23
drivers/cpufreq/amd-pstate.c
··· 607 607 union perf_cached perf = READ_ONCE(cpudata->perf); 608 608 609 609 perf.max_limit_perf = freq_to_perf(perf, cpudata->nominal_freq, policy->max); 610 - perf.min_limit_perf = freq_to_perf(perf, cpudata->nominal_freq, policy->min); 611 - 612 - if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) 613 - perf.min_limit_perf = min(perf.nominal_perf, perf.max_limit_perf); 614 - 615 610 WRITE_ONCE(cpudata->max_limit_freq, policy->max); 616 - WRITE_ONCE(cpudata->min_limit_freq, policy->min); 611 + 612 + if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) { 613 + perf.min_limit_perf = min(perf.nominal_perf, perf.max_limit_perf); 614 + WRITE_ONCE(cpudata->min_limit_freq, min(cpudata->nominal_freq, cpudata->max_limit_freq)); 615 + } else { 616 + perf.min_limit_perf = freq_to_perf(perf, cpudata->nominal_freq, policy->min); 617 + WRITE_ONCE(cpudata->min_limit_freq, policy->min); 618 + } 619 + 617 620 WRITE_ONCE(cpudata->perf, perf); 618 621 } 619 622 ··· 794 791 wrmsrl_on_cpu(cpu, MSR_AMD_PERF_CTL, 0); 795 792 } 796 793 797 - /* 798 - * Set amd-pstate preferred core enable can't be done directly from cpufreq callbacks 799 - * due to locking, so queue the work for later. 800 - */ 801 - static void amd_pstste_sched_prefcore_workfn(struct work_struct *work) 802 - { 803 - sched_set_itmt_support(); 804 - } 805 - static DECLARE_WORK(sched_prefcore_work, amd_pstste_sched_prefcore_workfn); 806 - 807 794 #define CPPC_MAX_PERF U8_MAX 808 795 809 796 static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata) ··· 804 811 805 812 cpudata->hw_prefcore = true; 806 813 807 - /* 808 - * The priorities can be set regardless of whether or not 809 - * sched_set_itmt_support(true) has been called and it is valid to 810 - * update them at any time after it has been called. 811 - */ 814 + /* Priorities must be initialized before ITMT support can be toggled on. */ 812 815 sched_set_itmt_core_prio((int)READ_ONCE(cpudata->prefcore_ranking), cpudata->cpu); 813 - 814 - schedule_work(&sched_prefcore_work); 815 816 } 816 817 817 818 static void amd_pstate_update_limits(unsigned int cpu) ··· 1180 1193 1181 1194 static void amd_pstate_driver_cleanup(void) 1182 1195 { 1196 + if (amd_pstate_prefcore) 1197 + sched_clear_itmt_support(); 1198 + 1183 1199 cppc_state = AMD_PSTATE_DISABLE; 1184 1200 current_pstate_driver = NULL; 1185 1201 } ··· 1224 1234 amd_pstate_driver_cleanup(); 1225 1235 return ret; 1226 1236 } 1237 + 1238 + /* Enable ITMT support once all CPUs have initialized their asym priorities. */ 1239 + if (amd_pstate_prefcore) 1240 + sched_set_itmt_support(); 1227 1241 1228 1242 return 0; 1229 1243 }
+25 -7
drivers/cpufreq/cpufreq.c
··· 540 540 { 541 541 unsigned int idx; 542 542 543 - target_freq = clamp_val(target_freq, policy->min, policy->max); 544 - 545 543 if (!policy->freq_table) 546 544 return target_freq; 547 545 ··· 563 565 unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy, 564 566 unsigned int target_freq) 565 567 { 566 - return __resolve_freq(policy, target_freq, CPUFREQ_RELATION_LE); 568 + unsigned int min = READ_ONCE(policy->min); 569 + unsigned int max = READ_ONCE(policy->max); 570 + 571 + /* 572 + * If this function runs in parallel with cpufreq_set_policy(), it may 573 + * read policy->min before the update and policy->max after the update 574 + * or the other way around, so there is no ordering guarantee. 575 + * 576 + * Resolve this by always honoring the max (in case it comes from 577 + * thermal throttling or similar). 578 + */ 579 + if (unlikely(min > max)) 580 + min = max; 581 + 582 + return __resolve_freq(policy, clamp_val(target_freq, min, max), 583 + CPUFREQ_RELATION_LE); 567 584 } 568 585 EXPORT_SYMBOL_GPL(cpufreq_driver_resolve_freq); 569 586 ··· 2397 2384 if (cpufreq_disabled()) 2398 2385 return -ENODEV; 2399 2386 2387 + target_freq = clamp_val(target_freq, policy->min, policy->max); 2400 2388 target_freq = __resolve_freq(policy, target_freq, relation); 2401 2389 2402 2390 pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n", ··· 2722 2708 * Resolve policy min/max to available frequencies. It ensures 2723 2709 * no frequency resolution will neither overshoot the requested maximum 2724 2710 * nor undershoot the requested minimum. 2711 + * 2712 + * Avoid storing intermediate values in policy->max or policy->min and 2713 + * compiler optimizations around them because they may be accessed 2714 + * concurrently by cpufreq_driver_resolve_freq() during the update. 2725 2715 */ 2726 - policy->min = new_data.min; 2727 - policy->max = new_data.max; 2728 - policy->min = __resolve_freq(policy, policy->min, CPUFREQ_RELATION_L); 2729 - policy->max = __resolve_freq(policy, policy->max, CPUFREQ_RELATION_H); 2716 + WRITE_ONCE(policy->max, __resolve_freq(policy, new_data.max, CPUFREQ_RELATION_H)); 2717 + new_data.min = __resolve_freq(policy, new_data.min, CPUFREQ_RELATION_L); 2718 + WRITE_ONCE(policy->min, new_data.min > policy->max ? policy->max : new_data.min); 2719 + 2730 2720 trace_cpu_frequency_limits(policy); 2731 2721 2732 2722 cpufreq_update_pressure(policy);
+1 -1
drivers/cpufreq/intel_pstate.c
··· 2209 2209 static int hwp_get_cpu_scaling(int cpu) 2210 2210 { 2211 2211 if (hybrid_scaling_factor) { 2212 - struct cpuinfo_x86 *c = &cpu_data(smp_processor_id()); 2212 + struct cpuinfo_x86 *c = &cpu_data(cpu); 2213 2213 u8 cpu_type = c->topo.intel_type; 2214 2214 2215 2215 /*
+6
drivers/crypto/atmel-sha204a.c
··· 163 163 i2c_priv->hwrng.name = dev_name(&client->dev); 164 164 i2c_priv->hwrng.read = atmel_sha204a_rng_read; 165 165 166 + /* 167 + * According to review by Bill Cox [1], this HWRNG has very low entropy. 168 + * [1] https://www.metzdowd.com/pipermail/cryptography/2014-December/023858.html 169 + */ 170 + i2c_priv->hwrng.quality = 1; 171 + 166 172 ret = devm_hwrng_register(&client->dev, &i2c_priv->hwrng); 167 173 if (ret) 168 174 dev_warn(&client->dev, "failed to register RNG (%d)\n", ret);
+14 -5
drivers/dma-buf/sw_sync.c
··· 438 438 return -EINVAL; 439 439 440 440 pt = dma_fence_to_sync_pt(fence); 441 - if (!pt) 442 - return -EINVAL; 441 + if (!pt) { 442 + ret = -EINVAL; 443 + goto put_fence; 444 + } 443 445 444 446 spin_lock_irqsave(fence->lock, flags); 445 - if (test_bit(SW_SYNC_HAS_DEADLINE_BIT, &fence->flags)) { 446 - data.deadline_ns = ktime_to_ns(pt->deadline); 447 - } else { 447 + if (!test_bit(SW_SYNC_HAS_DEADLINE_BIT, &fence->flags)) { 448 448 ret = -ENOENT; 449 + goto unlock; 449 450 } 451 + data.deadline_ns = ktime_to_ns(pt->deadline); 450 452 spin_unlock_irqrestore(fence->lock, flags); 451 453 452 454 dma_fence_put(fence); ··· 460 458 return -EFAULT; 461 459 462 460 return 0; 461 + 462 + unlock: 463 + spin_unlock_irqrestore(fence->lock, flags); 464 + put_fence: 465 + dma_fence_put(fence); 466 + 467 + return ret; 463 468 } 464 469 465 470 static long sw_sync_ioctl(struct file *file, unsigned int cmd,
+1 -1
drivers/gpio/gpiolib.c
··· 2879 2879 * output-only, but if there is then not even a .set() operation it 2880 2880 * is pretty tricky to drive the output line. 2881 2881 */ 2882 - if (!guard.gc->set && !guard.gc->direction_output) { 2882 + if (!guard.gc->set && !guard.gc->set_rv && !guard.gc->direction_output) { 2883 2883 gpiod_warn(desc, 2884 2884 "%s: missing set() and direction_output() operations\n", 2885 2885 __func__);
+1
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 1123 1123 bool in_s3; 1124 1124 bool in_s4; 1125 1125 bool in_s0ix; 1126 + suspend_state_t last_suspend_state; 1126 1127 1127 1128 enum pp_mp1_state mp1_state; 1128 1129 struct amdgpu_doorbell_index doorbell_index;
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 3510 3510 amdgpu_device_mem_scratch_fini(adev); 3511 3511 amdgpu_ib_pool_fini(adev); 3512 3512 amdgpu_seq64_fini(adev); 3513 + amdgpu_doorbell_fini(adev); 3513 3514 } 3514 3515 if (adev->ip_blocks[i].version->funcs->sw_fini) { 3515 3516 r = adev->ip_blocks[i].version->funcs->sw_fini(&adev->ip_blocks[i]); ··· 4859 4858 4860 4859 iounmap(adev->rmmio); 4861 4860 adev->rmmio = NULL; 4862 - amdgpu_doorbell_fini(adev); 4863 4861 drm_dev_exit(idx); 4864 4862 } 4865 4863
+13 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 2548 2548 adev->in_s0ix = true; 2549 2549 else if (amdgpu_acpi_is_s3_active(adev)) 2550 2550 adev->in_s3 = true; 2551 - if (!adev->in_s0ix && !adev->in_s3) 2551 + if (!adev->in_s0ix && !adev->in_s3) { 2552 + /* don't allow going deep first time followed by s2idle the next time */ 2553 + if (adev->last_suspend_state != PM_SUSPEND_ON && 2554 + adev->last_suspend_state != pm_suspend_target_state) { 2555 + drm_err_once(drm_dev, "Unsupported suspend state %d\n", 2556 + pm_suspend_target_state); 2557 + return -EINVAL; 2558 + } 2552 2559 return 0; 2560 + } 2561 + 2562 + /* cache the state last used for suspend */ 2563 + adev->last_suspend_state = pm_suspend_target_state; 2564 + 2553 2565 return amdgpu_device_suspend(drm_dev, true); 2554 2566 } 2555 2567
+11 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
··· 1438 1438 struct amdgpu_device *adev = ring->adev; 1439 1439 struct drm_gpu_scheduler *sched = &ring->sched; 1440 1440 struct drm_sched_entity entity; 1441 + static atomic_t counter; 1441 1442 struct dma_fence *f; 1442 1443 struct amdgpu_job *job; 1443 1444 struct amdgpu_ib *ib; 1445 + void *owner; 1444 1446 int i, r; 1445 1447 1446 1448 /* Initialize the scheduler entity */ ··· 1453 1451 goto err; 1454 1452 } 1455 1453 1456 - r = amdgpu_job_alloc_with_ib(ring->adev, &entity, NULL, 1457 - 64, 0, 1458 - &job); 1454 + /* 1455 + * Use some unique dummy value as the owner to make sure we execute 1456 + * the cleaner shader on each submission. The value just need to change 1457 + * for each submission and is otherwise meaningless. 1458 + */ 1459 + owner = (void *)(unsigned long)atomic_inc_return(&counter); 1460 + 1461 + r = amdgpu_job_alloc_with_ib(ring->adev, &entity, owner, 1462 + 64, 0, &job); 1459 1463 if (r) 1460 1464 goto err; 1461 1465
+4 -4
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
··· 6114 6114 } 6115 6115 6116 6116 if (amdgpu_emu_mode == 1) 6117 - adev->hdp.funcs->flush_hdp(adev, NULL); 6117 + amdgpu_device_flush_hdp(adev, NULL); 6118 6118 6119 6119 tmp = RREG32_SOC15(GC, 0, mmCP_PFP_IC_BASE_CNTL); 6120 6120 tmp = REG_SET_FIELD(tmp, CP_PFP_IC_BASE_CNTL, VMID, 0); ··· 6192 6192 } 6193 6193 6194 6194 if (amdgpu_emu_mode == 1) 6195 - adev->hdp.funcs->flush_hdp(adev, NULL); 6195 + amdgpu_device_flush_hdp(adev, NULL); 6196 6196 6197 6197 tmp = RREG32_SOC15(GC, 0, mmCP_CE_IC_BASE_CNTL); 6198 6198 tmp = REG_SET_FIELD(tmp, CP_CE_IC_BASE_CNTL, VMID, 0); ··· 6269 6269 } 6270 6270 6271 6271 if (amdgpu_emu_mode == 1) 6272 - adev->hdp.funcs->flush_hdp(adev, NULL); 6272 + amdgpu_device_flush_hdp(adev, NULL); 6273 6273 6274 6274 tmp = RREG32_SOC15(GC, 0, mmCP_ME_IC_BASE_CNTL); 6275 6275 tmp = REG_SET_FIELD(tmp, CP_ME_IC_BASE_CNTL, VMID, 0); ··· 6644 6644 } 6645 6645 6646 6646 if (amdgpu_emu_mode == 1) 6647 - adev->hdp.funcs->flush_hdp(adev, NULL); 6647 + amdgpu_device_flush_hdp(adev, NULL); 6648 6648 6649 6649 tmp = RREG32_SOC15(GC, 0, mmCP_CPC_IC_BASE_CNTL); 6650 6650 tmp = REG_SET_FIELD(tmp, CP_CPC_IC_BASE_CNTL, CACHE_POLICY, 0);
+6 -6
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
··· 2428 2428 } 2429 2429 2430 2430 if (amdgpu_emu_mode == 1) 2431 - adev->hdp.funcs->flush_hdp(adev, NULL); 2431 + amdgpu_device_flush_hdp(adev, NULL); 2432 2432 2433 2433 tmp = RREG32_SOC15(GC, 0, regCP_ME_IC_BASE_CNTL); 2434 2434 tmp = REG_SET_FIELD(tmp, CP_ME_IC_BASE_CNTL, VMID, 0); ··· 2472 2472 } 2473 2473 2474 2474 if (amdgpu_emu_mode == 1) 2475 - adev->hdp.funcs->flush_hdp(adev, NULL); 2475 + amdgpu_device_flush_hdp(adev, NULL); 2476 2476 2477 2477 tmp = RREG32_SOC15(GC, 0, regCP_PFP_IC_BASE_CNTL); 2478 2478 tmp = REG_SET_FIELD(tmp, CP_PFP_IC_BASE_CNTL, VMID, 0); ··· 2517 2517 } 2518 2518 2519 2519 if (amdgpu_emu_mode == 1) 2520 - adev->hdp.funcs->flush_hdp(adev, NULL); 2520 + amdgpu_device_flush_hdp(adev, NULL); 2521 2521 2522 2522 tmp = RREG32_SOC15(GC, 0, regCP_CPC_IC_BASE_CNTL); 2523 2523 tmp = REG_SET_FIELD(tmp, CP_CPC_IC_BASE_CNTL, CACHE_POLICY, 0); ··· 3153 3153 amdgpu_bo_unreserve(adev->gfx.pfp.pfp_fw_data_obj); 3154 3154 3155 3155 if (amdgpu_emu_mode == 1) 3156 - adev->hdp.funcs->flush_hdp(adev, NULL); 3156 + amdgpu_device_flush_hdp(adev, NULL); 3157 3157 3158 3158 WREG32_SOC15(GC, 0, regCP_PFP_IC_BASE_LO, 3159 3159 lower_32_bits(adev->gfx.pfp.pfp_fw_gpu_addr)); ··· 3371 3371 amdgpu_bo_unreserve(adev->gfx.me.me_fw_data_obj); 3372 3372 3373 3373 if (amdgpu_emu_mode == 1) 3374 - adev->hdp.funcs->flush_hdp(adev, NULL); 3374 + amdgpu_device_flush_hdp(adev, NULL); 3375 3375 3376 3376 WREG32_SOC15(GC, 0, regCP_ME_IC_BASE_LO, 3377 3377 lower_32_bits(adev->gfx.me.me_fw_gpu_addr)); ··· 4541 4541 if (r) 4542 4542 return r; 4543 4543 4544 - adev->hdp.funcs->flush_hdp(adev, NULL); 4544 + amdgpu_device_flush_hdp(adev, NULL); 4545 4545 4546 4546 value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ? 4547 4547 false : true;
+3 -3
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
··· 2324 2324 amdgpu_bo_unreserve(adev->gfx.pfp.pfp_fw_data_obj); 2325 2325 2326 2326 if (amdgpu_emu_mode == 1) 2327 - adev->hdp.funcs->flush_hdp(adev, NULL); 2327 + amdgpu_device_flush_hdp(adev, NULL); 2328 2328 2329 2329 WREG32_SOC15(GC, 0, regCP_PFP_IC_BASE_LO, 2330 2330 lower_32_bits(adev->gfx.pfp.pfp_fw_gpu_addr)); ··· 2468 2468 amdgpu_bo_unreserve(adev->gfx.me.me_fw_data_obj); 2469 2469 2470 2470 if (amdgpu_emu_mode == 1) 2471 - adev->hdp.funcs->flush_hdp(adev, NULL); 2471 + amdgpu_device_flush_hdp(adev, NULL); 2472 2472 2473 2473 WREG32_SOC15(GC, 0, regCP_ME_IC_BASE_LO, 2474 2474 lower_32_bits(adev->gfx.me.me_fw_gpu_addr)); ··· 3426 3426 if (r) 3427 3427 return r; 3428 3428 3429 - adev->hdp.funcs->flush_hdp(adev, NULL); 3429 + amdgpu_device_flush_hdp(adev, NULL); 3430 3430 3431 3431 value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ? 3432 3432 false : true;
+2 -2
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
··· 268 268 ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng; 269 269 270 270 /* flush hdp cache */ 271 - adev->hdp.funcs->flush_hdp(adev, NULL); 271 + amdgpu_device_flush_hdp(adev, NULL); 272 272 273 273 /* This is necessary for SRIOV as well as for GFXOFF to function 274 274 * properly under bare metal ··· 969 969 adev->hdp.funcs->init_registers(adev); 970 970 971 971 /* Flush HDP after it is initialized */ 972 - adev->hdp.funcs->flush_hdp(adev, NULL); 972 + amdgpu_device_flush_hdp(adev, NULL); 973 973 974 974 value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ? 975 975 false : true;
+2 -2
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
··· 229 229 ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng; 230 230 231 231 /* flush hdp cache */ 232 - adev->hdp.funcs->flush_hdp(adev, NULL); 232 + amdgpu_device_flush_hdp(adev, NULL); 233 233 234 234 /* This is necessary for SRIOV as well as for GFXOFF to function 235 235 * properly under bare metal ··· 899 899 return r; 900 900 901 901 /* Flush HDP after it is initialized */ 902 - adev->hdp.funcs->flush_hdp(adev, NULL); 902 + amdgpu_device_flush_hdp(adev, NULL); 903 903 904 904 value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ? 905 905 false : true;
+2 -2
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
··· 297 297 return; 298 298 299 299 /* flush hdp cache */ 300 - adev->hdp.funcs->flush_hdp(adev, NULL); 300 + amdgpu_device_flush_hdp(adev, NULL); 301 301 302 302 /* This is necessary for SRIOV as well as for GFXOFF to function 303 303 * properly under bare metal ··· 881 881 return r; 882 882 883 883 /* Flush HDP after it is initialized */ 884 - adev->hdp.funcs->flush_hdp(adev, NULL); 884 + amdgpu_device_flush_hdp(adev, NULL); 885 885 886 886 value = (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) ? 887 887 false : true;
+1 -1
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
··· 2435 2435 adev->hdp.funcs->init_registers(adev); 2436 2436 2437 2437 /* After HDP is initialized, flush HDP.*/ 2438 - adev->hdp.funcs->flush_hdp(adev, NULL); 2438 + amdgpu_device_flush_hdp(adev, NULL); 2439 2439 2440 2440 if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_ALWAYS) 2441 2441 value = false;
+1 -1
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
··· 533 533 } 534 534 535 535 memcpy_toio(adev->mman.aper_base_kaddr, buf, sz); 536 - adev->hdp.funcs->flush_hdp(adev, NULL); 536 + amdgpu_device_flush_hdp(adev, NULL); 537 537 vfree(buf); 538 538 drm_dev_exit(idx); 539 539 } else {
+1 -1
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c
··· 610 610 } 611 611 612 612 memcpy_toio(adev->mman.aper_base_kaddr, buf, sz); 613 - adev->hdp.funcs->flush_hdp(adev, NULL); 613 + amdgpu_device_flush_hdp(adev, NULL); 614 614 vfree(buf); 615 615 drm_dev_exit(idx); 616 616 } else {
+1 -1
drivers/gpu/drm/amd/amdgpu/psp_v14_0.c
··· 498 498 } 499 499 500 500 memcpy_toio(adev->mman.aper_base_kaddr, buf, sz); 501 - adev->hdp.funcs->flush_hdp(adev, NULL); 501 + amdgpu_device_flush_hdp(adev, NULL); 502 502 vfree(buf); 503 503 drm_dev_exit(idx); 504 504 } else {
+7
drivers/gpu/drm/amd/amdgpu/vi.c
··· 239 239 .max_pixels_per_frame = 4096 * 4096, 240 240 .max_level = 186, 241 241 }, 242 + { 243 + .codec_type = AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG, 244 + .max_width = 4096, 245 + .max_height = 4096, 246 + .max_pixels_per_frame = 4096 * 4096, 247 + .max_level = 0, 248 + }, 242 249 }; 243 250 244 251 static const struct amdgpu_video_codecs cz_video_codecs_decode =
+6 -5
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c
··· 2 2 // 3 3 // Copyright 2024 Advanced Micro Devices, Inc. 4 4 5 + #include <linux/vmalloc.h> 5 6 6 7 #include "dml2_internal_types.h" 7 8 #include "dml_top.h" ··· 14 13 15 14 static bool dml21_allocate_memory(struct dml2_context **dml_ctx) 16 15 { 17 - *dml_ctx = kzalloc(sizeof(struct dml2_context), GFP_KERNEL); 16 + *dml_ctx = vzalloc(sizeof(struct dml2_context)); 18 17 if (!(*dml_ctx)) 19 18 return false; 20 19 21 - (*dml_ctx)->v21.dml_init.dml2_instance = kzalloc(sizeof(struct dml2_instance), GFP_KERNEL); 20 + (*dml_ctx)->v21.dml_init.dml2_instance = vzalloc(sizeof(struct dml2_instance)); 22 21 if (!((*dml_ctx)->v21.dml_init.dml2_instance)) 23 22 return false; 24 23 ··· 28 27 (*dml_ctx)->v21.mode_support.display_config = &(*dml_ctx)->v21.display_config; 29 28 (*dml_ctx)->v21.mode_programming.display_config = (*dml_ctx)->v21.mode_support.display_config; 30 29 31 - (*dml_ctx)->v21.mode_programming.programming = kzalloc(sizeof(struct dml2_display_cfg_programming), GFP_KERNEL); 30 + (*dml_ctx)->v21.mode_programming.programming = vzalloc(sizeof(struct dml2_display_cfg_programming)); 32 31 if (!((*dml_ctx)->v21.mode_programming.programming)) 33 32 return false; 34 33 ··· 116 115 117 116 void dml21_destroy(struct dml2_context *dml2) 118 117 { 119 - kfree(dml2->v21.dml_init.dml2_instance); 120 - kfree(dml2->v21.mode_programming.programming); 118 + vfree(dml2->v21.dml_init.dml2_instance); 119 + vfree(dml2->v21.mode_programming.programming); 121 120 } 122 121 123 122 static void dml21_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *context, struct resource_context *out_new_hw_state,
+4 -2
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c
··· 24 24 * 25 25 */ 26 26 27 + #include <linux/vmalloc.h> 28 + 27 29 #include "display_mode_core.h" 28 30 #include "dml2_internal_types.h" 29 31 #include "dml2_utils.h" ··· 749 747 750 748 static inline struct dml2_context *dml2_allocate_memory(void) 751 749 { 752 - return (struct dml2_context *) kzalloc(sizeof(struct dml2_context), GFP_KERNEL); 750 + return (struct dml2_context *) vzalloc(sizeof(struct dml2_context)); 753 751 } 754 752 755 753 static void dml2_init(const struct dc *in_dc, const struct dml2_configuration_options *config, struct dml2_context **dml2) ··· 823 821 824 822 if (dml2->architecture == dml2_architecture_21) 825 823 dml21_destroy(dml2); 826 - kfree(dml2); 824 + vfree(dml2); 827 825 } 828 826 829 827 void dml2_extract_dram_and_fclk_change_support(struct dml2_context *dml2,
+1
drivers/gpu/drm/i915/display/intel_display_device.h
··· 161 161 #define HAS_DPT(__display) (DISPLAY_VER(__display) >= 13) 162 162 #define HAS_DSB(__display) (DISPLAY_INFO(__display)->has_dsb) 163 163 #define HAS_DSC(__display) (DISPLAY_RUNTIME_INFO(__display)->has_dsc) 164 + #define HAS_DSC_3ENGINES(__display) (DISPLAY_VERx100(__display) == 1401 && HAS_DSC(__display)) 164 165 #define HAS_DSC_MST(__display) (DISPLAY_VER(__display) >= 12 && HAS_DSC(__display)) 165 166 #define HAS_FBC(__display) (DISPLAY_RUNTIME_INFO(__display)->fbc_mask != 0) 166 167 #define HAS_FBC_DIRTY_RECT(__display) (DISPLAY_VER(__display) >= 30)
+4 -3
drivers/gpu/drm/i915/display/intel_dp.c
··· 1050 1050 u8 test_slice_count = valid_dsc_slicecount[i] * num_joined_pipes; 1051 1051 1052 1052 /* 1053 - * 3 DSC Slices per pipe need 3 DSC engines, 1054 - * which is supported only with Ultrajoiner. 1053 + * 3 DSC Slices per pipe need 3 DSC engines, which is supported only 1054 + * with Ultrajoiner only for some platforms. 1055 1055 */ 1056 - if (valid_dsc_slicecount[i] == 3 && num_joined_pipes != 4) 1056 + if (valid_dsc_slicecount[i] == 3 && 1057 + (!HAS_DSC_3ENGINES(display) || num_joined_pipes != 4)) 1057 1058 continue; 1058 1059 1059 1060 if (test_slice_count >
+1 -1
drivers/gpu/drm/mgag200/mgag200_mode.c
··· 223 223 vsyncstr = mode->crtc_vsync_start - 1; 224 224 vsyncend = mode->crtc_vsync_end - 1; 225 225 vtotal = mode->crtc_vtotal - 2; 226 - vblkstr = mode->crtc_vblank_start; 226 + vblkstr = mode->crtc_vblank_start - 1; 227 227 vblkend = vtotal + 1; 228 228 229 229 linecomp = vdispend;
+4 -4
drivers/gpu/drm/msm/adreno/a6xx_gpu.c
··· 242 242 break; 243 243 fallthrough; 244 244 case MSM_SUBMIT_CMD_BUF: 245 - OUT_PKT7(ring, CP_INDIRECT_BUFFER_PFE, 3); 245 + OUT_PKT7(ring, CP_INDIRECT_BUFFER, 3); 246 246 OUT_RING(ring, lower_32_bits(submit->cmd[i].iova)); 247 247 OUT_RING(ring, upper_32_bits(submit->cmd[i].iova)); 248 - OUT_RING(ring, submit->cmd[i].size); 248 + OUT_RING(ring, A5XX_CP_INDIRECT_BUFFER_2_IB_SIZE(submit->cmd[i].size)); 249 249 ibs++; 250 250 break; 251 251 } ··· 377 377 break; 378 378 fallthrough; 379 379 case MSM_SUBMIT_CMD_BUF: 380 - OUT_PKT7(ring, CP_INDIRECT_BUFFER_PFE, 3); 380 + OUT_PKT7(ring, CP_INDIRECT_BUFFER, 3); 381 381 OUT_RING(ring, lower_32_bits(submit->cmd[i].iova)); 382 382 OUT_RING(ring, upper_32_bits(submit->cmd[i].iova)); 383 - OUT_RING(ring, submit->cmd[i].size); 383 + OUT_RING(ring, A5XX_CP_INDIRECT_BUFFER_2_IB_SIZE(submit->cmd[i].size)); 384 384 ibs++; 385 385 break; 386 386 }
-2
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_1_14_msm8937.h
··· 132 132 .prog_fetch_lines_worst_case = 14, 133 133 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 26), 134 134 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 27), 135 - .intr_tear_rd_ptr = -1, 136 135 }, { 137 136 .name = "intf_2", .id = INTF_2, 138 137 .base = 0x6b000, .len = 0x268, ··· 140 141 .prog_fetch_lines_worst_case = 14, 141 142 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 28), 142 143 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 29), 143 - .intr_tear_rd_ptr = -1, 144 144 }, 145 145 }; 146 146
-1
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_1_15_msm8917.h
··· 118 118 .prog_fetch_lines_worst_case = 14, 119 119 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 26), 120 120 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 27), 121 - .intr_tear_rd_ptr = -1, 122 121 }, 123 122 }; 124 123
-3
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_1_16_msm8953.h
··· 131 131 .prog_fetch_lines_worst_case = 14, 132 132 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 24), 133 133 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 25), 134 - .intr_tear_rd_ptr = -1, 135 134 }, { 136 135 .name = "intf_1", .id = INTF_1, 137 136 .base = 0x6a800, .len = 0x268, ··· 139 140 .prog_fetch_lines_worst_case = 14, 140 141 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 26), 141 142 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 27), 142 - .intr_tear_rd_ptr = -1, 143 143 }, { 144 144 .name = "intf_2", .id = INTF_2, 145 145 .base = 0x6b000, .len = 0x268, ··· 147 149 .prog_fetch_lines_worst_case = 14, 148 150 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 28), 149 151 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 29), 150 - .intr_tear_rd_ptr = -1, 151 152 }, 152 153 }; 153 154
-4
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_1_7_msm8996.h
··· 241 241 .prog_fetch_lines_worst_case = 25, 242 242 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 24), 243 243 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 25), 244 - .intr_tear_rd_ptr = -1, 245 244 }, { 246 245 .name = "intf_1", .id = INTF_1, 247 246 .base = 0x6a800, .len = 0x268, ··· 249 250 .prog_fetch_lines_worst_case = 25, 250 251 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 26), 251 252 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 27), 252 - .intr_tear_rd_ptr = -1, 253 253 }, { 254 254 .name = "intf_2", .id = INTF_2, 255 255 .base = 0x6b000, .len = 0x268, ··· 257 259 .prog_fetch_lines_worst_case = 25, 258 260 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 28), 259 261 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 29), 260 - .intr_tear_rd_ptr = -1, 261 262 }, { 262 263 .name = "intf_3", .id = INTF_3, 263 264 .base = 0x6b800, .len = 0x268, ··· 264 267 .prog_fetch_lines_worst_case = 25, 265 268 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 30), 266 269 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 31), 267 - .intr_tear_rd_ptr = -1, 268 270 }, 269 271 }; 270 272
-3
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_2_sdm660.h
··· 202 202 .prog_fetch_lines_worst_case = 21, 203 203 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 24), 204 204 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 25), 205 - .intr_tear_rd_ptr = -1, 206 205 }, { 207 206 .name = "intf_1", .id = INTF_1, 208 207 .base = 0x6a800, .len = 0x280, ··· 210 211 .prog_fetch_lines_worst_case = 21, 211 212 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 26), 212 213 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 27), 213 - .intr_tear_rd_ptr = -1, 214 214 }, { 215 215 .name = "intf_2", .id = INTF_2, 216 216 .base = 0x6b000, .len = 0x280, ··· 218 220 .prog_fetch_lines_worst_case = 21, 219 221 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 28), 220 222 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 29), 221 - .intr_tear_rd_ptr = -1, 222 223 }, 223 224 }; 224 225
-2
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_3_sdm630.h
··· 147 147 .prog_fetch_lines_worst_case = 21, 148 148 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 24), 149 149 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 25), 150 - .intr_tear_rd_ptr = -1, 151 150 }, { 152 151 .name = "intf_1", .id = INTF_1, 153 152 .base = 0x6a800, .len = 0x280, ··· 155 156 .prog_fetch_lines_worst_case = 21, 156 157 .intr_underrun = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 26), 157 158 .intr_vsync = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 27), 158 - .intr_tear_rd_ptr = -1, 159 159 }, 160 160 }; 161 161
+3 -1
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
··· 1666 1666 */ 1667 1667 static void _dpu_encoder_trigger_start(struct dpu_encoder_phys *phys) 1668 1668 { 1669 - struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(phys->parent); 1669 + struct dpu_encoder_virt *dpu_enc; 1670 1670 1671 1671 if (!phys) { 1672 1672 DPU_ERROR("invalid argument(s)\n"); ··· 1677 1677 DPU_ERROR("invalid pingpong hw\n"); 1678 1678 return; 1679 1679 } 1680 + 1681 + dpu_enc = to_dpu_encoder_virt(phys->parent); 1680 1682 1681 1683 if (phys->parent->encoder_type == DRM_MODE_ENCODER_VIRTUAL && 1682 1684 dpu_enc->cwb_mask) {
+39 -35
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
··· 729 729 static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu, 730 730 struct dpu_sw_pipe *pipe, 731 731 struct dpu_sw_pipe_cfg *pipe_cfg, 732 - const struct msm_format *fmt, 733 - const struct drm_display_mode *mode) 732 + const struct drm_display_mode *mode, 733 + struct drm_plane_state *new_plane_state) 734 734 { 735 735 uint32_t min_src_size; 736 736 struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base); 737 737 int ret; 738 + const struct msm_format *fmt; 739 + uint32_t supported_rotations; 740 + const struct dpu_sspp_cfg *pipe_hw_caps; 741 + const struct dpu_sspp_sub_blks *sblk; 742 + 743 + pipe_hw_caps = pipe->sspp->cap; 744 + sblk = pipe->sspp->cap->sblk; 745 + 746 + /* 747 + * We already have verified scaling against platform limitations. 748 + * Now check if the SSPP supports scaling at all. 749 + */ 750 + if (!sblk->scaler_blk.len && 751 + ((drm_rect_width(&new_plane_state->src) >> 16 != 752 + drm_rect_width(&new_plane_state->dst)) || 753 + (drm_rect_height(&new_plane_state->src) >> 16 != 754 + drm_rect_height(&new_plane_state->dst)))) 755 + return -ERANGE; 756 + 757 + fmt = msm_framebuffer_format(new_plane_state->fb); 758 + 759 + supported_rotations = DRM_MODE_REFLECT_MASK | DRM_MODE_ROTATE_0; 760 + 761 + if (pipe_hw_caps->features & BIT(DPU_SSPP_INLINE_ROTATION)) 762 + supported_rotations |= DRM_MODE_ROTATE_90; 763 + 764 + pipe_cfg->rotation = drm_rotation_simplify(new_plane_state->rotation, 765 + supported_rotations); 738 766 739 767 min_src_size = MSM_FORMAT_IS_YUV(fmt) ? 2 : 1; 740 768 ··· 951 923 struct dpu_plane_state *pstate = to_dpu_plane_state(new_plane_state); 952 924 struct dpu_sw_pipe *pipe = &pstate->pipe; 953 925 struct dpu_sw_pipe *r_pipe = &pstate->r_pipe; 954 - const struct msm_format *fmt; 955 926 struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg; 956 927 struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->r_pipe_cfg; 957 - uint32_t supported_rotations; 958 - const struct dpu_sspp_cfg *pipe_hw_caps; 959 - const struct dpu_sspp_sub_blks *sblk; 960 928 int ret = 0; 961 929 962 - pipe_hw_caps = pipe->sspp->cap; 963 - sblk = pipe->sspp->cap->sblk; 964 - 965 - /* 966 - * We already have verified scaling against platform limitations. 967 - * Now check if the SSPP supports scaling at all. 968 - */ 969 - if (!sblk->scaler_blk.len && 970 - ((drm_rect_width(&new_plane_state->src) >> 16 != 971 - drm_rect_width(&new_plane_state->dst)) || 972 - (drm_rect_height(&new_plane_state->src) >> 16 != 973 - drm_rect_height(&new_plane_state->dst)))) 974 - return -ERANGE; 975 - 976 - fmt = msm_framebuffer_format(new_plane_state->fb); 977 - 978 - supported_rotations = DRM_MODE_REFLECT_MASK | DRM_MODE_ROTATE_0; 979 - 980 - if (pipe_hw_caps->features & BIT(DPU_SSPP_INLINE_ROTATION)) 981 - supported_rotations |= DRM_MODE_ROTATE_90; 982 - 983 - pipe_cfg->rotation = drm_rotation_simplify(new_plane_state->rotation, 984 - supported_rotations); 985 - r_pipe_cfg->rotation = pipe_cfg->rotation; 986 - 987 - ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, fmt, 988 - &crtc_state->adjusted_mode); 930 + ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, 931 + &crtc_state->adjusted_mode, 932 + new_plane_state); 989 933 if (ret) 990 934 return ret; 991 935 992 936 if (drm_rect_width(&r_pipe_cfg->src_rect) != 0) { 993 - ret = dpu_plane_atomic_check_pipe(pdpu, r_pipe, r_pipe_cfg, fmt, 994 - &crtc_state->adjusted_mode); 937 + ret = dpu_plane_atomic_check_pipe(pdpu, r_pipe, r_pipe_cfg, 938 + &crtc_state->adjusted_mode, 939 + new_plane_state); 995 940 if (ret) 996 941 return ret; 997 942 } ··· 1059 1058 struct dpu_plane_state *pstate = to_dpu_plane_state(plane_state); 1060 1059 struct drm_crtc_state *crtc_state; 1061 1060 int ret; 1061 + 1062 + if (IS_ERR(plane_state)) 1063 + return PTR_ERR(plane_state); 1062 1064 1063 1065 if (plane_state->crtc) 1064 1066 crtc_state = drm_atomic_get_new_crtc_state(state,
+7
drivers/gpu/drm/msm/registers/adreno/adreno_pm4.xml
··· 2259 2259 </reg32> 2260 2260 </domain> 2261 2261 2262 + <domain name="CP_INDIRECT_BUFFER" width="32" varset="chip" prefix="chip" variants="A5XX-"> 2263 + <reg64 offset="0" name="IB_BASE" type="address"/> 2264 + <reg32 offset="2" name="2"> 2265 + <bitfield name="IB_SIZE" low="0" high="19"/> 2266 + </reg32> 2267 + </domain> 2268 + 2262 2269 </database> 2263 2270
+13 -3
drivers/gpu/drm/v3d/v3d_sched.c
··· 428 428 struct v3d_bo *bo = to_v3d_bo(job->base.bo[0]); 429 429 struct v3d_bo *indirect = to_v3d_bo(indirect_csd->indirect); 430 430 struct drm_v3d_submit_csd *args = &indirect_csd->job->args; 431 - u32 *wg_counts; 431 + struct v3d_dev *v3d = job->base.v3d; 432 + u32 num_batches, *wg_counts; 432 433 433 434 v3d_get_bo_vaddr(bo); 434 435 v3d_get_bo_vaddr(indirect); ··· 442 441 args->cfg[0] = wg_counts[0] << V3D_CSD_CFG012_WG_COUNT_SHIFT; 443 442 args->cfg[1] = wg_counts[1] << V3D_CSD_CFG012_WG_COUNT_SHIFT; 444 443 args->cfg[2] = wg_counts[2] << V3D_CSD_CFG012_WG_COUNT_SHIFT; 445 - args->cfg[4] = DIV_ROUND_UP(indirect_csd->wg_size, 16) * 446 - (wg_counts[0] * wg_counts[1] * wg_counts[2]) - 1; 444 + 445 + num_batches = DIV_ROUND_UP(indirect_csd->wg_size, 16) * 446 + (wg_counts[0] * wg_counts[1] * wg_counts[2]); 447 + 448 + /* V3D 7.1.6 and later don't subtract 1 from the number of batches */ 449 + if (v3d->ver < 71 || (v3d->ver == 71 && v3d->rev < 6)) 450 + args->cfg[4] = num_batches - 1; 451 + else 452 + args->cfg[4] = num_batches; 453 + 454 + WARN_ON(args->cfg[4] == ~0); 447 455 448 456 for (int i = 0; i < 3; i++) { 449 457 /* 0xffffffff indicates that the uniform rewrite is not needed */
+9
drivers/gpu/drm/virtio/virtgpu_drv.c
··· 128 128 drm_dev_put(dev); 129 129 } 130 130 131 + static void virtio_gpu_shutdown(struct virtio_device *vdev) 132 + { 133 + /* 134 + * drm does its own synchronization on shutdown. 135 + * Do nothing here, opt out of device reset. 136 + */ 137 + } 138 + 131 139 static void virtio_gpu_config_changed(struct virtio_device *vdev) 132 140 { 133 141 struct drm_device *dev = vdev->priv; ··· 170 162 .id_table = id_table, 171 163 .probe = virtio_gpu_probe, 172 164 .remove = virtio_gpu_remove, 165 + .shutdown = virtio_gpu_shutdown, 173 166 .config_changed = virtio_gpu_config_changed 174 167 }; 175 168
+1 -4
drivers/gpu/drm/xe/xe_dma_buf.c
··· 145 145 struct sg_table *sgt, 146 146 enum dma_data_direction dir) 147 147 { 148 - struct dma_buf *dma_buf = attach->dmabuf; 149 - struct xe_bo *bo = gem_to_xe_bo(dma_buf->priv); 150 - 151 - if (!xe_bo_is_vram(bo)) { 148 + if (sg_page(sgt->sgl)) { 152 149 dma_unmap_sgtable(attach->dev, sgt, dir, 0); 153 150 sg_free_table(sgt); 154 151 kfree(sgt);
+45 -30
drivers/gpu/drm/xe/xe_guc_ads.c
··· 490 490 engine_enable_mask(gt, XE_ENGINE_CLASS_OTHER)); 491 491 } 492 492 493 - static void guc_prep_golden_lrc_null(struct xe_guc_ads *ads) 493 + /* 494 + * Write the offsets corresponding to the golden LRCs. The actual data is 495 + * populated later by guc_golden_lrc_populate() 496 + */ 497 + static void guc_golden_lrc_init(struct xe_guc_ads *ads) 494 498 { 495 499 struct xe_device *xe = ads_to_xe(ads); 500 + struct xe_gt *gt = ads_to_gt(ads); 496 501 struct iosys_map info_map = IOSYS_MAP_INIT_OFFSET(ads_to_map(ads), 497 502 offsetof(struct __guc_ads_blob, system_info)); 498 - u8 guc_class; 503 + size_t alloc_size, real_size; 504 + u32 addr_ggtt, offset; 505 + int class; 499 506 500 - for (guc_class = 0; guc_class <= GUC_MAX_ENGINE_CLASSES; ++guc_class) { 507 + offset = guc_ads_golden_lrc_offset(ads); 508 + addr_ggtt = xe_bo_ggtt_addr(ads->bo) + offset; 509 + 510 + for (class = 0; class < XE_ENGINE_CLASS_MAX; ++class) { 511 + u8 guc_class; 512 + 513 + guc_class = xe_engine_class_to_guc_class(class); 514 + 501 515 if (!info_map_read(xe, &info_map, 502 516 engine_enabled_masks[guc_class])) 503 517 continue; 504 518 519 + real_size = xe_gt_lrc_size(gt, class); 520 + alloc_size = PAGE_ALIGN(real_size); 521 + 522 + /* 523 + * This interface is slightly confusing. We need to pass the 524 + * base address of the full golden context and the size of just 525 + * the engine state, which is the section of the context image 526 + * that starts after the execlists LRC registers. This is 527 + * required to allow the GuC to restore just the engine state 528 + * when a watchdog reset occurs. 529 + * We calculate the engine state size by removing the size of 530 + * what comes before it in the context image (which is identical 531 + * on all engines). 532 + */ 505 533 ads_blob_write(ads, ads.eng_state_size[guc_class], 506 - guc_ads_golden_lrc_size(ads) - 507 - xe_lrc_skip_size(xe)); 534 + real_size - xe_lrc_skip_size(xe)); 508 535 ads_blob_write(ads, ads.golden_context_lrca[guc_class], 509 - xe_bo_ggtt_addr(ads->bo) + 510 - guc_ads_golden_lrc_offset(ads)); 536 + addr_ggtt); 537 + 538 + addr_ggtt += alloc_size; 511 539 } 512 540 } 513 541 ··· 885 857 886 858 xe_map_memset(ads_to_xe(ads), ads_to_map(ads), 0, 0, ads->bo->size); 887 859 guc_policies_init(ads); 888 - guc_prep_golden_lrc_null(ads); 860 + guc_golden_lrc_init(ads); 889 861 guc_mapping_table_init_invalid(gt, &info_map); 890 862 guc_doorbell_init(ads); 891 863 ··· 911 883 guc_policies_init(ads); 912 884 fill_engine_enable_masks(gt, &info_map); 913 885 guc_mmio_reg_state_init(ads); 914 - guc_prep_golden_lrc_null(ads); 886 + guc_golden_lrc_init(ads); 915 887 guc_mapping_table_init(gt, &info_map); 916 888 guc_capture_prep_lists(ads); 917 889 guc_doorbell_init(ads); ··· 931 903 guc_ads_private_data_offset(ads)); 932 904 } 933 905 934 - static void guc_populate_golden_lrc(struct xe_guc_ads *ads) 906 + /* 907 + * After the golden LRC's are recorded for each engine class by the first 908 + * submission, copy them to the ADS, as initialized earlier by 909 + * guc_golden_lrc_init(). 910 + */ 911 + static void guc_golden_lrc_populate(struct xe_guc_ads *ads) 935 912 { 936 913 struct xe_device *xe = ads_to_xe(ads); 937 914 struct xe_gt *gt = ads_to_gt(ads); 938 915 struct iosys_map info_map = IOSYS_MAP_INIT_OFFSET(ads_to_map(ads), 939 916 offsetof(struct __guc_ads_blob, system_info)); 940 917 size_t total_size = 0, alloc_size, real_size; 941 - u32 addr_ggtt, offset; 918 + u32 offset; 942 919 int class; 943 920 944 921 offset = guc_ads_golden_lrc_offset(ads); 945 - addr_ggtt = xe_bo_ggtt_addr(ads->bo) + offset; 946 922 947 923 for (class = 0; class < XE_ENGINE_CLASS_MAX; ++class) { 948 924 u8 guc_class; ··· 963 931 alloc_size = PAGE_ALIGN(real_size); 964 932 total_size += alloc_size; 965 933 966 - /* 967 - * This interface is slightly confusing. We need to pass the 968 - * base address of the full golden context and the size of just 969 - * the engine state, which is the section of the context image 970 - * that starts after the execlists LRC registers. This is 971 - * required to allow the GuC to restore just the engine state 972 - * when a watchdog reset occurs. 973 - * We calculate the engine state size by removing the size of 974 - * what comes before it in the context image (which is identical 975 - * on all engines). 976 - */ 977 - ads_blob_write(ads, ads.eng_state_size[guc_class], 978 - real_size - xe_lrc_skip_size(xe)); 979 - ads_blob_write(ads, ads.golden_context_lrca[guc_class], 980 - addr_ggtt); 981 - 982 934 xe_map_memcpy_to(xe, ads_to_map(ads), offset, 983 935 gt->default_lrc[class], real_size); 984 936 985 - addr_ggtt += alloc_size; 986 937 offset += alloc_size; 987 938 } 988 939 ··· 974 959 975 960 void xe_guc_ads_populate_post_load(struct xe_guc_ads *ads) 976 961 { 977 - guc_populate_golden_lrc(ads); 962 + guc_golden_lrc_populate(ads); 978 963 } 979 964 980 965 static int guc_ads_action_update_policies(struct xe_guc_ads *ads, u32 policy_offset)
-24
drivers/gpu/drm/xe/xe_hmm.c
··· 19 19 return (end - start) >> PAGE_SHIFT; 20 20 } 21 21 22 - /** 23 - * xe_mark_range_accessed() - mark a range is accessed, so core mm 24 - * have such information for memory eviction or write back to 25 - * hard disk 26 - * @range: the range to mark 27 - * @write: if write to this range, we mark pages in this range 28 - * as dirty 29 - */ 30 - static void xe_mark_range_accessed(struct hmm_range *range, bool write) 31 - { 32 - struct page *page; 33 - u64 i, npages; 34 - 35 - npages = xe_npages_in_range(range->start, range->end); 36 - for (i = 0; i < npages; i++) { 37 - page = hmm_pfn_to_page(range->hmm_pfns[i]); 38 - if (write) 39 - set_page_dirty_lock(page); 40 - 41 - mark_page_accessed(page); 42 - } 43 - } 44 - 45 22 static int xe_alloc_sg(struct xe_device *xe, struct sg_table *st, 46 23 struct hmm_range *range, struct rw_semaphore *notifier_sem) 47 24 { ··· 308 331 if (ret) 309 332 goto out_unlock; 310 333 311 - xe_mark_range_accessed(&hmm_range, write); 312 334 userptr->sg = &userptr->sgt; 313 335 xe_hmm_userptr_set_mapped(uvma); 314 336 userptr->notifier_seq = hmm_range.notifier_seq;
+11 -2
drivers/gpu/drm/xe/xe_pxp_debugfs.c
··· 66 66 { 67 67 struct xe_pxp *pxp = node_to_pxp(m->private); 68 68 struct drm_printer p = drm_seq_file_printer(m); 69 + int ready = xe_pxp_get_readiness_status(pxp); 69 70 70 - if (!xe_pxp_is_enabled(pxp)) 71 - return -ENODEV; 71 + if (ready < 0) 72 + return ready; /* disabled or error occurred */ 73 + else if (!ready) 74 + return -EBUSY; /* init still in progress */ 75 + 76 + /* no need for a termination if PXP is not active */ 77 + if (pxp->status != XE_PXP_ACTIVE) { 78 + drm_printf(&p, "PXP not active\n"); 79 + return 0; 80 + } 72 81 73 82 /* simulate a termination interrupt */ 74 83 spin_lock_irq(&pxp->xe->irq.lock);
+3
drivers/i2c/busses/i2c-cros-ec-tunnel.c
··· 247 247 u32 remote_bus; 248 248 int err; 249 249 250 + if (!ec) 251 + return dev_err_probe(dev, -EPROBE_DEFER, "couldn't find parent EC device\n"); 252 + 250 253 if (!ec->cmd_xfer) { 251 254 dev_err(dev, "Missing sendrecv\n"); 252 255 return -EINVAL;
+1 -1
drivers/i2c/i2c-atr.c
··· 8 8 * Originally based on i2c-mux.c 9 9 */ 10 10 11 - #include <linux/fwnode.h> 12 11 #include <linux/i2c-atr.h> 13 12 #include <linux/i2c.h> 14 13 #include <linux/kernel.h> 15 14 #include <linux/module.h> 16 15 #include <linux/mutex.h> 16 + #include <linux/property.h> 17 17 #include <linux/slab.h> 18 18 #include <linux/spinlock.h> 19 19
+2 -2
drivers/iio/magnetometer/ak8974.c
··· 535 535 fab_data2, sizeof(fab_data2)); 536 536 537 537 for (i = 0; i < 3; ++i) { 538 - static const char axis[3] = "XYZ"; 539 - static const char pgaxis[6] = "ZYZXYX"; 538 + static const char axis[] = "XYZ"; 539 + static const char pgaxis[] = "ZYZXYX"; 540 540 unsigned offz = le16_to_cpu(fab_data2[i]) & 0x7F; 541 541 unsigned fine = le16_to_cpu(fab_data1[i]); 542 542 unsigned sens = le16_to_cpu(fab_data1[i + 3]);
+1 -1
drivers/input/joystick/magellan.c
··· 48 48 49 49 static int magellan_crunch_nibbles(unsigned char *data, int count) 50 50 { 51 - static unsigned char nibbles[16] = "0AB3D56GH9:K<MN?"; 51 + static unsigned char nibbles[16] __nonstring = "0AB3D56GH9:K<MN?"; 52 52 53 53 do { 54 54 if (data[count] == nibbles[data[count] & 0xf])
+2 -2
drivers/irqchip/Kconfig
··· 114 114 115 115 config BCM2712_MIP 116 116 tristate "Broadcom BCM2712 MSI-X Interrupt Peripheral support" 117 - depends on ARCH_BRCMSTB || COMPILE_TEST 118 - default m if ARCH_BRCMSTB 117 + depends on ARCH_BRCMSTB || ARCH_BCM2835 || COMPILE_TEST 118 + default m if ARCH_BRCMSTB || ARCH_BCM2835 119 119 depends on ARM_GIC 120 120 select GENERIC_IRQ_CHIP 121 121 select IRQ_DOMAIN_HIERARCHY
+8
drivers/irqchip/irq-renesas-rzv2h.c
··· 170 170 else 171 171 tssr &= ~ICU_TSSR_TIEN(tssel_n, priv->info->field_width); 172 172 writel_relaxed(tssr, priv->base + priv->info->t_offs + ICU_TSSR(k)); 173 + 174 + /* 175 + * A glitch in the edge detection circuit can cause a spurious 176 + * interrupt. Clear the status flag after setting the ICU_TSSRk 177 + * registers, which is recommended by the hardware manual as a 178 + * countermeasure. 179 + */ 180 + writel_relaxed(BIT(tint_nr), priv->base + priv->info->t_offs + ICU_TSCLR); 173 181 } 174 182 175 183 static void rzv2h_icu_irq_disable(struct irq_data *d)
+1 -1
drivers/md/bcache/super.c
··· 546 546 547 547 static struct uuid_entry *uuid_find_empty(struct cache_set *c) 548 548 { 549 - static const char zero_uuid[16] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; 549 + static const char zero_uuid[16] = { 0 }; 550 550 551 551 return uuid_find(c, zero_uuid); 552 552 }
+2 -3
drivers/md/md-bitmap.c
··· 2357 2357 2358 2358 if (!bitmap) 2359 2359 return -ENOENT; 2360 - if (bitmap->mddev->bitmap_info.external) 2361 - return -ENOENT; 2362 - if (!bitmap->storage.sb_page) /* no superblock */ 2360 + if (!bitmap->mddev->bitmap_info.external && 2361 + !bitmap->storage.sb_page) 2363 2362 return -EINVAL; 2364 2363 sb = kmap_local_page(bitmap->storage.sb_page); 2365 2364 stats->sync_size = le64_to_cpu(sb->sync_size);
+16 -10
drivers/md/raid1.c
··· 2200 2200 if (!rdev_set_badblocks(rdev, sect, s, 0)) 2201 2201 abort = 1; 2202 2202 } 2203 - if (abort) { 2204 - conf->recovery_disabled = 2205 - mddev->recovery_disabled; 2206 - set_bit(MD_RECOVERY_INTR, &mddev->recovery); 2207 - md_done_sync(mddev, r1_bio->sectors, 0); 2208 - put_buf(r1_bio); 2203 + if (abort) 2209 2204 return 0; 2210 - } 2205 + 2211 2206 /* Try next page */ 2212 2207 sectors -= s; 2213 2208 sect += s; ··· 2341 2346 int disks = conf->raid_disks * 2; 2342 2347 struct bio *wbio; 2343 2348 2344 - if (!test_bit(R1BIO_Uptodate, &r1_bio->state)) 2345 - /* ouch - failed to read all of that. */ 2346 - if (!fix_sync_read_error(r1_bio)) 2349 + if (!test_bit(R1BIO_Uptodate, &r1_bio->state)) { 2350 + /* 2351 + * ouch - failed to read all of that. 2352 + * No need to fix read error for check/repair 2353 + * because all member disks are read. 2354 + */ 2355 + if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery) || 2356 + !fix_sync_read_error(r1_bio)) { 2357 + conf->recovery_disabled = mddev->recovery_disabled; 2358 + set_bit(MD_RECOVERY_INTR, &mddev->recovery); 2359 + md_done_sync(mddev, r1_bio->sectors, 0); 2360 + put_buf(r1_bio); 2347 2361 return; 2362 + } 2363 + } 2348 2364 2349 2365 if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) 2350 2366 process_checks(r1_bio);
+1
drivers/md/raid10.c
··· 1735 1735 * The discard bio returns only first r10bio finishes 1736 1736 */ 1737 1737 if (first_copy) { 1738 + md_account_bio(mddev, &bio); 1738 1739 r10_bio->master_bio = bio; 1739 1740 set_bit(R10BIO_Discard, &r10_bio->state); 1740 1741 first_copy = false;
+3 -3
drivers/net/dsa/mt7530.c
··· 2563 2563 struct mt7530_priv *priv = ds->priv; 2564 2564 int ret, i; 2565 2565 2566 + ds->assisted_learning_on_cpu_port = true; 2567 + ds->mtu_enforcement_ingress = true; 2568 + 2566 2569 mt753x_trap_frames(priv); 2567 2570 2568 2571 /* Enable and reset MIB counters */ ··· 2717 2714 ret = mt7531_setup_common(ds); 2718 2715 if (ret) 2719 2716 return ret; 2720 - 2721 - ds->assisted_learning_on_cpu_port = true; 2722 - ds->mtu_enforcement_ingress = true; 2723 2717 2724 2718 return 0; 2725 2719 }
+14 -22
drivers/net/ethernet/amd/pds_core/adminq.c
··· 5 5 6 6 #include "core.h" 7 7 8 - struct pdsc_wait_context { 9 - struct pdsc_qcq *qcq; 10 - struct completion wait_completion; 11 - }; 12 - 13 8 static int pdsc_process_notifyq(struct pdsc_qcq *qcq) 14 9 { 15 10 union pds_core_notifyq_comp *comp; ··· 104 109 q_info = &q->info[q->tail_idx]; 105 110 q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1); 106 111 107 - /* Copy out the completion data */ 108 - memcpy(q_info->dest, comp, sizeof(*comp)); 109 - 110 - complete_all(&q_info->wc->wait_completion); 112 + if (!completion_done(&q_info->completion)) { 113 + memcpy(q_info->dest, comp, sizeof(*comp)); 114 + complete(&q_info->completion); 115 + } 111 116 112 117 if (cq->tail_idx == cq->num_descs - 1) 113 118 cq->done_color = !cq->done_color; ··· 157 162 static int __pdsc_adminq_post(struct pdsc *pdsc, 158 163 struct pdsc_qcq *qcq, 159 164 union pds_core_adminq_cmd *cmd, 160 - union pds_core_adminq_comp *comp, 161 - struct pdsc_wait_context *wc) 165 + union pds_core_adminq_comp *comp) 162 166 { 163 167 struct pdsc_queue *q = &qcq->q; 164 168 struct pdsc_q_info *q_info; ··· 199 205 /* Post the request */ 200 206 index = q->head_idx; 201 207 q_info = &q->info[index]; 202 - q_info->wc = wc; 203 208 q_info->dest = comp; 204 209 memcpy(q_info->desc, cmd, sizeof(*cmd)); 210 + reinit_completion(&q_info->completion); 205 211 206 212 dev_dbg(pdsc->dev, "head_idx %d tail_idx %d\n", 207 213 q->head_idx, q->tail_idx); ··· 225 231 union pds_core_adminq_comp *comp, 226 232 bool fast_poll) 227 233 { 228 - struct pdsc_wait_context wc = { 229 - .wait_completion = 230 - COMPLETION_INITIALIZER_ONSTACK(wc.wait_completion), 231 - }; 232 234 unsigned long poll_interval = 1; 233 235 unsigned long poll_jiffies; 234 236 unsigned long time_limit; 235 237 unsigned long time_start; 236 238 unsigned long time_done; 237 239 unsigned long remaining; 240 + struct completion *wc; 238 241 int err = 0; 239 242 int index; 240 243 ··· 241 250 return -ENXIO; 242 251 } 243 252 244 - wc.qcq = &pdsc->adminqcq; 245 - index = __pdsc_adminq_post(pdsc, &pdsc->adminqcq, cmd, comp, &wc); 253 + index = __pdsc_adminq_post(pdsc, &pdsc->adminqcq, cmd, comp); 246 254 if (index < 0) { 247 255 err = index; 248 256 goto err_out; 249 257 } 250 258 259 + wc = &pdsc->adminqcq.q.info[index].completion; 251 260 time_start = jiffies; 252 261 time_limit = time_start + HZ * pdsc->devcmd_timeout; 253 262 do { 254 263 /* Timeslice the actual wait to catch IO errors etc early */ 255 264 poll_jiffies = msecs_to_jiffies(poll_interval); 256 - remaining = wait_for_completion_timeout(&wc.wait_completion, 257 - poll_jiffies); 265 + remaining = wait_for_completion_timeout(wc, poll_jiffies); 258 266 if (remaining) 259 267 break; 260 268 ··· 282 292 dev_dbg(pdsc->dev, "%s: elapsed %d msecs\n", 283 293 __func__, jiffies_to_msecs(time_done - time_start)); 284 294 285 - /* Check the results */ 286 - if (time_after_eq(time_done, time_limit)) 295 + /* Check the results and clear an un-completed timeout */ 296 + if (time_after_eq(time_done, time_limit) && !completion_done(wc)) { 287 297 err = -ETIMEDOUT; 298 + complete(wc); 299 + } 288 300 289 301 dev_dbg(pdsc->dev, "read admin queue completion idx %d:\n", index); 290 302 dynamic_hex_dump("comp ", DUMP_PREFIX_OFFSET, 16, 1,
-3
drivers/net/ethernet/amd/pds_core/auxbus.c
··· 107 107 dev_dbg(pf->dev, "%s: %s opcode %d\n", 108 108 __func__, dev_name(&padev->aux_dev.dev), req->opcode); 109 109 110 - if (pf->state) 111 - return -ENXIO; 112 - 113 110 /* Wrap the client's request */ 114 111 cmd.client_request.opcode = PDS_AQ_CMD_CLIENT_CMD; 115 112 cmd.client_request.client_id = cpu_to_le16(padev->client_id);
+4 -5
drivers/net/ethernet/amd/pds_core/core.c
··· 167 167 q->base = base; 168 168 q->base_pa = base_pa; 169 169 170 - for (i = 0, cur = q->info; i < q->num_descs; i++, cur++) 170 + for (i = 0, cur = q->info; i < q->num_descs; i++, cur++) { 171 171 cur->desc = base + (i * q->desc_size); 172 + init_completion(&cur->completion); 173 + } 172 174 } 173 175 174 176 static void pdsc_cq_map(struct pdsc_cq *cq, void *base, dma_addr_t base_pa) ··· 327 325 size_t sz; 328 326 int err; 329 327 330 - /* Scale the descriptor ring length based on number of CPUs and VFs */ 331 - numdescs = max_t(int, PDSC_ADMINQ_MIN_LENGTH, num_online_cpus()); 332 - numdescs += 2 * pci_sriov_get_totalvfs(pdsc->pdev); 333 - numdescs = roundup_pow_of_two(numdescs); 328 + numdescs = PDSC_ADMINQ_MAX_LENGTH; 334 329 err = pdsc_qcq_alloc(pdsc, PDS_CORE_QTYPE_ADMINQ, 0, "adminq", 335 330 PDS_CORE_QCQ_F_CORE | PDS_CORE_QCQ_F_INTR, 336 331 numdescs,
+2 -2
drivers/net/ethernet/amd/pds_core/core.h
··· 16 16 17 17 #define PDSC_WATCHDOG_SECS 5 18 18 #define PDSC_QUEUE_NAME_MAX_SZ 16 19 - #define PDSC_ADMINQ_MIN_LENGTH 16 /* must be a power of two */ 19 + #define PDSC_ADMINQ_MAX_LENGTH 16 /* must be a power of two */ 20 20 #define PDSC_NOTIFYQ_LENGTH 64 /* must be a power of two */ 21 21 #define PDSC_TEARDOWN_RECOVERY false 22 22 #define PDSC_TEARDOWN_REMOVING true ··· 96 96 unsigned int bytes; 97 97 unsigned int nbufs; 98 98 struct pdsc_buf_info bufs[PDS_CORE_MAX_FRAGS]; 99 - struct pdsc_wait_context *wc; 99 + struct completion completion; 100 100 void *dest; 101 101 }; 102 102
+1 -3
drivers/net/ethernet/amd/pds_core/devlink.c
··· 105 105 .fw_control.opcode = PDS_CORE_CMD_FW_CONTROL, 106 106 .fw_control.oper = PDS_CORE_FW_GET_LIST, 107 107 }; 108 - struct pds_core_fw_list_info fw_list; 108 + struct pds_core_fw_list_info fw_list = {}; 109 109 struct pdsc *pdsc = devlink_priv(dl); 110 110 union pds_core_dev_comp comp; 111 111 char buf[32]; ··· 118 118 if (!err) 119 119 memcpy_fromio(&fw_list, pdsc->cmd_regs->data, sizeof(fw_list)); 120 120 mutex_unlock(&pdsc->devcmd_lock); 121 - if (err && err != -EIO) 122 - return err; 123 121 124 122 listlen = min(fw_list.num_fw_slots, ARRAY_SIZE(fw_list.fw_names)); 125 123 for (i = 0; i < listlen; i++) {
+28 -17
drivers/net/ethernet/freescale/enetc/enetc.c
··· 1850 1850 } 1851 1851 } 1852 1852 1853 + static void enetc_bulk_flip_buff(struct enetc_bdr *rx_ring, int rx_ring_first, 1854 + int rx_ring_last) 1855 + { 1856 + while (rx_ring_first != rx_ring_last) { 1857 + enetc_flip_rx_buff(rx_ring, 1858 + &rx_ring->rx_swbd[rx_ring_first]); 1859 + enetc_bdr_idx_inc(rx_ring, &rx_ring_first); 1860 + } 1861 + } 1862 + 1853 1863 static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring, 1854 1864 struct napi_struct *napi, int work_limit, 1855 1865 struct bpf_prog *prog) ··· 1878 1868 1879 1869 while (likely(rx_frm_cnt < work_limit)) { 1880 1870 union enetc_rx_bd *rxbd, *orig_rxbd; 1881 - int orig_i, orig_cleaned_cnt; 1882 1871 struct xdp_buff xdp_buff; 1883 1872 struct sk_buff *skb; 1873 + int orig_i, err; 1884 1874 u32 bd_status; 1885 - int err; 1886 1875 1887 1876 rxbd = enetc_rxbd(rx_ring, i); 1888 1877 bd_status = le32_to_cpu(rxbd->r.lstatus); ··· 1896 1887 break; 1897 1888 1898 1889 orig_rxbd = rxbd; 1899 - orig_cleaned_cnt = cleaned_cnt; 1900 1890 orig_i = i; 1901 1891 1902 1892 enetc_build_xdp_buff(rx_ring, bd_status, &rxbd, &i, ··· 1923 1915 rx_ring->stats.xdp_drops++; 1924 1916 break; 1925 1917 case XDP_PASS: 1926 - rxbd = orig_rxbd; 1927 - cleaned_cnt = orig_cleaned_cnt; 1928 - i = orig_i; 1929 - 1930 - skb = enetc_build_skb(rx_ring, bd_status, &rxbd, 1931 - &i, &cleaned_cnt, 1932 - ENETC_RXB_DMA_SIZE_XDP); 1933 - if (unlikely(!skb)) 1918 + skb = xdp_build_skb_from_buff(&xdp_buff); 1919 + /* Probably under memory pressure, stop NAPI */ 1920 + if (unlikely(!skb)) { 1921 + enetc_xdp_drop(rx_ring, orig_i, i); 1922 + rx_ring->stats.xdp_drops++; 1934 1923 goto out; 1924 + } 1925 + 1926 + enetc_get_offloads(rx_ring, orig_rxbd, skb); 1927 + 1928 + /* These buffers are about to be owned by the stack. 1929 + * Update our buffer cache (the rx_swbd array elements) 1930 + * with their other page halves. 1931 + */ 1932 + enetc_bulk_flip_buff(rx_ring, orig_i, i); 1935 1933 1936 1934 napi_gro_receive(napi, skb); 1937 1935 break; ··· 1979 1965 enetc_xdp_drop(rx_ring, orig_i, i); 1980 1966 rx_ring->stats.xdp_redirect_failures++; 1981 1967 } else { 1982 - while (orig_i != i) { 1983 - enetc_flip_rx_buff(rx_ring, 1984 - &rx_ring->rx_swbd[orig_i]); 1985 - enetc_bdr_idx_inc(rx_ring, &orig_i); 1986 - } 1968 + enetc_bulk_flip_buff(rx_ring, orig_i, i); 1987 1969 xdp_redirect_frm_cnt++; 1988 1970 rx_ring->stats.xdp_redirect++; 1989 1971 } ··· 3372 3362 bdr->buffer_offset = ENETC_RXB_PAD; 3373 3363 priv->rx_ring[i] = bdr; 3374 3364 3375 - err = xdp_rxq_info_reg(&bdr->xdp.rxq, priv->ndev, i, 0); 3365 + err = __xdp_rxq_info_reg(&bdr->xdp.rxq, priv->ndev, i, 0, 3366 + ENETC_RXB_DMA_SIZE_XDP); 3376 3367 if (err) 3377 3368 goto free_vector; 3378 3369
+20 -4
drivers/net/ethernet/mediatek/mtk_eth_soc.c
··· 4043 4043 mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); 4044 4044 4045 4045 if (mtk_is_netsys_v3_or_greater(eth)) { 4046 - /* PSE should not drop port1, port8 and port9 packets */ 4047 - mtk_w32(eth, 0x00000302, PSE_DROP_CFG); 4046 + /* PSE dummy page mechanism */ 4047 + mtk_w32(eth, PSE_DUMMY_WORK_GDM(1) | PSE_DUMMY_WORK_GDM(2) | 4048 + PSE_DUMMY_WORK_GDM(3) | DUMMY_PAGE_THR, PSE_DUMY_REQ); 4049 + 4050 + /* PSE free buffer drop threshold */ 4051 + mtk_w32(eth, 0x00600009, PSE_IQ_REV(8)); 4052 + 4053 + /* PSE should not drop port8, port9 and port13 packets from 4054 + * WDMA Tx 4055 + */ 4056 + mtk_w32(eth, 0x00002300, PSE_DROP_CFG); 4057 + 4058 + /* PSE should drop packets to port8, port9 and port13 on WDMA Rx 4059 + * ring full 4060 + */ 4061 + mtk_w32(eth, 0x00002300, PSE_PPE_DROP(0)); 4062 + mtk_w32(eth, 0x00002300, PSE_PPE_DROP(1)); 4063 + mtk_w32(eth, 0x00002300, PSE_PPE_DROP(2)); 4048 4064 4049 4065 /* GDM and CDM Threshold */ 4050 - mtk_w32(eth, 0x00000707, MTK_CDMW0_THRES); 4066 + mtk_w32(eth, 0x08000707, MTK_CDMW0_THRES); 4051 4067 mtk_w32(eth, 0x00000077, MTK_CDMW1_THRES); 4052 4068 4053 4069 /* Disable GDM1 RX CRC stripping */ ··· 4080 4064 mtk_w32(eth, 0x00000300, PSE_DROP_CFG); 4081 4065 4082 4066 /* PSE should drop packets to port 8/9 on WDMA Rx ring full */ 4083 - mtk_w32(eth, 0x00000300, PSE_PPE0_DROP); 4067 + mtk_w32(eth, 0x00000300, PSE_PPE_DROP(0)); 4084 4068 4085 4069 /* PSE Free Queue Flow Control */ 4086 4070 mtk_w32(eth, 0x01fa01f4, PSE_FQFC_CFG2);
+9 -1
drivers/net/ethernet/mediatek/mtk_eth_soc.h
··· 151 151 #define PSE_FQFC_CFG1 0x100 152 152 #define PSE_FQFC_CFG2 0x104 153 153 #define PSE_DROP_CFG 0x108 154 - #define PSE_PPE0_DROP 0x110 154 + #define PSE_PPE_DROP(x) (0x110 + ((x) * 0x4)) 155 + 156 + /* PSE Last FreeQ Page Request Control */ 157 + #define PSE_DUMY_REQ 0x10C 158 + /* PSE_DUMY_REQ is not a typo but actually called like that also in 159 + * MediaTek's datasheet 160 + */ 161 + #define PSE_DUMMY_WORK_GDM(x) BIT(16 + (x)) 162 + #define DUMMY_PAGE_THR 0x1 155 163 156 164 /* PSE Input Queue Reservation Register*/ 157 165 #define PSE_IQ_REV(x) (0x140 + (((x) - 1) << 2))
+18 -8
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_ttc.c
··· 637 637 bool use_l4_type; 638 638 int err; 639 639 640 - ttc = kvzalloc(sizeof(*ttc), GFP_KERNEL); 641 - if (!ttc) 642 - return ERR_PTR(-ENOMEM); 643 - 644 640 switch (params->ns_type) { 645 641 case MLX5_FLOW_NAMESPACE_PORT_SEL: 646 642 use_l4_type = MLX5_CAP_GEN_2(dev, pcc_ifa2) && ··· 650 654 return ERR_PTR(-EINVAL); 651 655 } 652 656 657 + ttc = kvzalloc(sizeof(*ttc), GFP_KERNEL); 658 + if (!ttc) 659 + return ERR_PTR(-ENOMEM); 660 + 653 661 ns = mlx5_get_flow_namespace(dev, params->ns_type); 662 + if (!ns) { 663 + kvfree(ttc); 664 + return ERR_PTR(-EOPNOTSUPP); 665 + } 666 + 654 667 groups = use_l4_type ? &inner_ttc_groups[TTC_GROUPS_USE_L4_TYPE] : 655 668 &inner_ttc_groups[TTC_GROUPS_DEFAULT]; 656 669 ··· 715 710 bool use_l4_type; 716 711 int err; 717 712 718 - ttc = kvzalloc(sizeof(*ttc), GFP_KERNEL); 719 - if (!ttc) 720 - return ERR_PTR(-ENOMEM); 721 - 722 713 switch (params->ns_type) { 723 714 case MLX5_FLOW_NAMESPACE_PORT_SEL: 724 715 use_l4_type = MLX5_CAP_GEN_2(dev, pcc_ifa2) && ··· 728 727 return ERR_PTR(-EINVAL); 729 728 } 730 729 730 + ttc = kvzalloc(sizeof(*ttc), GFP_KERNEL); 731 + if (!ttc) 732 + return ERR_PTR(-ENOMEM); 733 + 731 734 ns = mlx5_get_flow_namespace(dev, params->ns_type); 735 + if (!ns) { 736 + kvfree(ttc); 737 + return ERR_PTR(-EOPNOTSUPP); 738 + } 739 + 732 740 groups = use_l4_type ? &ttc_groups[TTC_GROUPS_USE_L4_TYPE] : 733 741 &ttc_groups[TTC_GROUPS_DEFAULT]; 734 742
+2 -2
drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
··· 320 320 321 321 /* PTP and timestamping registers */ 322 322 323 - #define GMAC3_X_ATSNS GENMASK(19, 16) 324 - #define GMAC3_X_ATSNS_SHIFT 16 323 + #define GMAC3_X_ATSNS GENMASK(29, 25) 324 + #define GMAC3_X_ATSNS_SHIFT 25 325 325 326 326 #define GMAC_PTP_TCR_ATSFC BIT(24) 327 327 #define GMAC_PTP_TCR_ATSEN0 BIT(25)
+1 -1
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
··· 553 553 u64 ns; 554 554 555 555 ns = readl(ptpaddr + GMAC_PTP_ATNR); 556 - ns += readl(ptpaddr + GMAC_PTP_ATSR) * NSEC_PER_SEC; 556 + ns += (u64)readl(ptpaddr + GMAC_PTP_ATSR) * NSEC_PER_SEC; 557 557 558 558 *ptp_time = ns; 559 559 }
+1 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
··· 222 222 u64 ns; 223 223 224 224 ns = readl(ptpaddr + PTP_ATNR); 225 - ns += readl(ptpaddr + PTP_ATSR) * NSEC_PER_SEC; 225 + ns += (u64)readl(ptpaddr + PTP_ATSR) * NSEC_PER_SEC; 226 226 227 227 *ptp_time = ns; 228 228 }
+2
drivers/net/ethernet/sun/niu.c
··· 9064 9064 msi_vec[i].entry = i; 9065 9065 } 9066 9066 9067 + pdev->dev_flags |= PCI_DEV_FLAGS_MSIX_TOUCH_ENTRY_DATA_FIRST; 9068 + 9067 9069 num_irqs = pci_enable_msix_range(pdev, msi_vec, 1, num_irqs); 9068 9070 if (num_irqs < 0) { 9069 9071 np->flags &= ~NIU_FLAGS_MSIX;
+1 -1
drivers/net/phy/dp83822.c
··· 741 741 return phydev->drv->config_init(phydev); 742 742 } 743 743 744 - #ifdef CONFIG_OF_MDIO 744 + #if IS_ENABLED(CONFIG_OF_MDIO) 745 745 static const u32 tx_amplitude_100base_tx_gain[] = { 746 746 80, 82, 83, 85, 87, 88, 90, 92, 747 747 93, 95, 97, 98, 100, 102, 103, 105,
+3 -43
drivers/net/phy/microchip.c
··· 37 37 return __phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS, page); 38 38 } 39 39 40 - static int lan88xx_phy_config_intr(struct phy_device *phydev) 41 - { 42 - int rc; 43 - 44 - if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { 45 - /* unmask all source and clear them before enable */ 46 - rc = phy_write(phydev, LAN88XX_INT_MASK, 0x7FFF); 47 - rc = phy_read(phydev, LAN88XX_INT_STS); 48 - rc = phy_write(phydev, LAN88XX_INT_MASK, 49 - LAN88XX_INT_MASK_MDINTPIN_EN_ | 50 - LAN88XX_INT_MASK_LINK_CHANGE_); 51 - } else { 52 - rc = phy_write(phydev, LAN88XX_INT_MASK, 0); 53 - if (rc) 54 - return rc; 55 - 56 - /* Ack interrupts after they have been disabled */ 57 - rc = phy_read(phydev, LAN88XX_INT_STS); 58 - } 59 - 60 - return rc < 0 ? rc : 0; 61 - } 62 - 63 - static irqreturn_t lan88xx_handle_interrupt(struct phy_device *phydev) 64 - { 65 - int irq_status; 66 - 67 - irq_status = phy_read(phydev, LAN88XX_INT_STS); 68 - if (irq_status < 0) { 69 - phy_error(phydev); 70 - return IRQ_NONE; 71 - } 72 - 73 - if (!(irq_status & LAN88XX_INT_STS_LINK_CHANGE_)) 74 - return IRQ_NONE; 75 - 76 - phy_trigger_machine(phydev); 77 - 78 - return IRQ_HANDLED; 79 - } 80 - 81 40 static int lan88xx_suspend(struct phy_device *phydev) 82 41 { 83 42 struct lan88xx_priv *priv = phydev->priv; ··· 487 528 .config_aneg = lan88xx_config_aneg, 488 529 .link_change_notify = lan88xx_link_change_notify, 489 530 490 - .config_intr = lan88xx_phy_config_intr, 491 - .handle_interrupt = lan88xx_handle_interrupt, 531 + /* Interrupt handling is broken, do not define related 532 + * functions to force polling. 533 + */ 492 534 493 535 .suspend = lan88xx_suspend, 494 536 .resume = genphy_resume,
+13 -10
drivers/net/phy/phy_led_triggers.c
··· 93 93 if (!phy->phy_num_led_triggers) 94 94 return 0; 95 95 96 - phy->led_link_trigger = devm_kzalloc(&phy->mdio.dev, 97 - sizeof(*phy->led_link_trigger), 98 - GFP_KERNEL); 96 + phy->led_link_trigger = kzalloc(sizeof(*phy->led_link_trigger), 97 + GFP_KERNEL); 99 98 if (!phy->led_link_trigger) { 100 99 err = -ENOMEM; 101 100 goto out_clear; ··· 104 105 if (err) 105 106 goto out_free_link; 106 107 107 - phy->phy_led_triggers = devm_kcalloc(&phy->mdio.dev, 108 - phy->phy_num_led_triggers, 109 - sizeof(struct phy_led_trigger), 110 - GFP_KERNEL); 108 + phy->phy_led_triggers = kcalloc(phy->phy_num_led_triggers, 109 + sizeof(struct phy_led_trigger), 110 + GFP_KERNEL); 111 111 if (!phy->phy_led_triggers) { 112 112 err = -ENOMEM; 113 113 goto out_unreg_link; ··· 127 129 out_unreg: 128 130 while (i--) 129 131 phy_led_trigger_unregister(&phy->phy_led_triggers[i]); 130 - devm_kfree(&phy->mdio.dev, phy->phy_led_triggers); 132 + kfree(phy->phy_led_triggers); 131 133 out_unreg_link: 132 134 phy_led_trigger_unregister(phy->led_link_trigger); 133 135 out_free_link: 134 - devm_kfree(&phy->mdio.dev, phy->led_link_trigger); 136 + kfree(phy->led_link_trigger); 135 137 phy->led_link_trigger = NULL; 136 138 out_clear: 137 139 phy->phy_num_led_triggers = 0; ··· 145 147 146 148 for (i = 0; i < phy->phy_num_led_triggers; i++) 147 149 phy_led_trigger_unregister(&phy->phy_led_triggers[i]); 150 + kfree(phy->phy_led_triggers); 151 + phy->phy_led_triggers = NULL; 148 152 149 - if (phy->led_link_trigger) 153 + if (phy->led_link_trigger) { 150 154 phy_led_trigger_unregister(phy->led_link_trigger); 155 + kfree(phy->led_link_trigger); 156 + phy->led_link_trigger = NULL; 157 + } 151 158 } 152 159 EXPORT_SYMBOL_GPL(phy_led_triggers_unregister);
+22 -16
drivers/net/phy/phylink.c
··· 81 81 unsigned int pcs_state; 82 82 83 83 bool link_failed; 84 + bool suspend_link_up; 84 85 bool major_config_failed; 85 86 bool mac_supports_eee_ops; 86 87 bool mac_supports_eee; ··· 2546 2545 /* Stop the resolver bringing the link up */ 2547 2546 __set_bit(PHYLINK_DISABLE_MAC_WOL, &pl->phylink_disable_state); 2548 2547 2549 - /* Disable the carrier, to prevent transmit timeouts, 2550 - * but one would hope all packets have been sent. This 2551 - * also means phylink_resolve() will do nothing. 2552 - */ 2553 - if (pl->netdev) 2554 - netif_carrier_off(pl->netdev); 2555 - else 2548 + pl->suspend_link_up = phylink_link_is_up(pl); 2549 + if (pl->suspend_link_up) { 2550 + /* Disable the carrier, to prevent transmit timeouts, 2551 + * but one would hope all packets have been sent. This 2552 + * also means phylink_resolve() will do nothing. 2553 + */ 2554 + if (pl->netdev) 2555 + netif_carrier_off(pl->netdev); 2556 2556 pl->old_link_state = false; 2557 + } 2557 2558 2558 2559 /* We do not call mac_link_down() here as we want the 2559 2560 * link to remain up to receive the WoL packets. ··· 2606 2603 if (test_bit(PHYLINK_DISABLE_MAC_WOL, &pl->phylink_disable_state)) { 2607 2604 /* Wake-on-Lan enabled, MAC handling */ 2608 2605 2609 - /* Call mac_link_down() so we keep the overall state balanced. 2610 - * Do this under the state_mutex lock for consistency. This 2611 - * will cause a "Link Down" message to be printed during 2612 - * resume, which is harmless - the true link state will be 2613 - * printed when we run a resolve. 2614 - */ 2615 - mutex_lock(&pl->state_mutex); 2616 - phylink_link_down(pl); 2617 - mutex_unlock(&pl->state_mutex); 2606 + if (pl->suspend_link_up) { 2607 + /* Call mac_link_down() so we keep the overall state 2608 + * balanced. Do this under the state_mutex lock for 2609 + * consistency. This will cause a "Link Down" message 2610 + * to be printed during resume, which is harmless - 2611 + * the true link state will be printed when we run a 2612 + * resolve. 2613 + */ 2614 + mutex_lock(&pl->state_mutex); 2615 + phylink_link_down(pl); 2616 + mutex_unlock(&pl->state_mutex); 2617 + } 2618 2618 2619 2619 /* Re-apply the link parameters so that all the settings get 2620 2620 * restored to the MAC.
+57 -12
drivers/net/virtio_net.c
··· 3342 3342 return NETDEV_TX_OK; 3343 3343 } 3344 3344 3345 - static void virtnet_rx_pause(struct virtnet_info *vi, struct receive_queue *rq) 3345 + static void __virtnet_rx_pause(struct virtnet_info *vi, 3346 + struct receive_queue *rq) 3346 3347 { 3347 3348 bool running = netif_running(vi->dev); 3348 3349 ··· 3353 3352 } 3354 3353 } 3355 3354 3356 - static void virtnet_rx_resume(struct virtnet_info *vi, struct receive_queue *rq) 3355 + static void virtnet_rx_pause_all(struct virtnet_info *vi) 3356 + { 3357 + int i; 3358 + 3359 + /* 3360 + * Make sure refill_work does not run concurrently to 3361 + * avoid napi_disable race which leads to deadlock. 3362 + */ 3363 + disable_delayed_refill(vi); 3364 + cancel_delayed_work_sync(&vi->refill); 3365 + for (i = 0; i < vi->max_queue_pairs; i++) 3366 + __virtnet_rx_pause(vi, &vi->rq[i]); 3367 + } 3368 + 3369 + static void virtnet_rx_pause(struct virtnet_info *vi, struct receive_queue *rq) 3370 + { 3371 + /* 3372 + * Make sure refill_work does not run concurrently to 3373 + * avoid napi_disable race which leads to deadlock. 3374 + */ 3375 + disable_delayed_refill(vi); 3376 + cancel_delayed_work_sync(&vi->refill); 3377 + __virtnet_rx_pause(vi, rq); 3378 + } 3379 + 3380 + static void __virtnet_rx_resume(struct virtnet_info *vi, 3381 + struct receive_queue *rq, 3382 + bool refill) 3357 3383 { 3358 3384 bool running = netif_running(vi->dev); 3359 3385 3360 - if (!try_fill_recv(vi, rq, GFP_KERNEL)) 3386 + if (refill && !try_fill_recv(vi, rq, GFP_KERNEL)) 3361 3387 schedule_delayed_work(&vi->refill, 0); 3362 3388 3363 3389 if (running) 3364 3390 virtnet_napi_enable(rq); 3391 + } 3392 + 3393 + static void virtnet_rx_resume_all(struct virtnet_info *vi) 3394 + { 3395 + int i; 3396 + 3397 + enable_delayed_refill(vi); 3398 + for (i = 0; i < vi->max_queue_pairs; i++) { 3399 + if (i < vi->curr_queue_pairs) 3400 + __virtnet_rx_resume(vi, &vi->rq[i], true); 3401 + else 3402 + __virtnet_rx_resume(vi, &vi->rq[i], false); 3403 + } 3404 + } 3405 + 3406 + static void virtnet_rx_resume(struct virtnet_info *vi, struct receive_queue *rq) 3407 + { 3408 + enable_delayed_refill(vi); 3409 + __virtnet_rx_resume(vi, rq, true); 3365 3410 } 3366 3411 3367 3412 static int virtnet_rx_resize(struct virtnet_info *vi, ··· 6006 5959 if (prog) 6007 5960 bpf_prog_add(prog, vi->max_queue_pairs - 1); 6008 5961 5962 + virtnet_rx_pause_all(vi); 5963 + 6009 5964 /* Make sure NAPI is not using any XDP TX queues for RX. */ 6010 5965 if (netif_running(dev)) { 6011 - for (i = 0; i < vi->max_queue_pairs; i++) { 6012 - virtnet_napi_disable(&vi->rq[i]); 5966 + for (i = 0; i < vi->max_queue_pairs; i++) 6013 5967 virtnet_napi_tx_disable(&vi->sq[i]); 6014 - } 6015 5968 } 6016 5969 6017 5970 if (!prog) { ··· 6043 5996 vi->xdp_enabled = false; 6044 5997 } 6045 5998 5999 + virtnet_rx_resume_all(vi); 6046 6000 for (i = 0; i < vi->max_queue_pairs; i++) { 6047 6001 if (old_prog) 6048 6002 bpf_prog_put(old_prog); 6049 - if (netif_running(dev)) { 6050 - virtnet_napi_enable(&vi->rq[i]); 6003 + if (netif_running(dev)) 6051 6004 virtnet_napi_tx_enable(&vi->sq[i]); 6052 - } 6053 6005 } 6054 6006 6055 6007 return 0; ··· 6060 6014 rcu_assign_pointer(vi->rq[i].xdp_prog, old_prog); 6061 6015 } 6062 6016 6017 + virtnet_rx_resume_all(vi); 6063 6018 if (netif_running(dev)) { 6064 - for (i = 0; i < vi->max_queue_pairs; i++) { 6065 - virtnet_napi_enable(&vi->rq[i]); 6019 + for (i = 0; i < vi->max_queue_pairs; i++) 6066 6020 virtnet_napi_tx_enable(&vi->sq[i]); 6067 - } 6068 6021 } 6069 6022 if (prog) 6070 6023 bpf_prog_sub(prog, vi->max_queue_pairs - 1);
+4 -1
drivers/net/vxlan/vxlan_vnifilter.c
··· 624 624 * default dst remote_ip previously added for this vni 625 625 */ 626 626 if (!vxlan_addr_any(&vninode->remote_ip) || 627 - !vxlan_addr_any(&dst->remote_ip)) 627 + !vxlan_addr_any(&dst->remote_ip)) { 628 + spin_lock_bh(&vxlan->hash_lock); 628 629 __vxlan_fdb_delete(vxlan, all_zeros_mac, 629 630 (vxlan_addr_any(&vninode->remote_ip) ? 630 631 dst->remote_ip : vninode->remote_ip), ··· 633 632 vninode->vni, vninode->vni, 634 633 dst->remote_ifindex, 635 634 true); 635 + spin_unlock_bh(&vxlan->hash_lock); 636 + } 636 637 637 638 if (vxlan->dev->flags & IFF_UP) { 638 639 if (vxlan_addr_multicast(&vninode->remote_ip) &&
+1 -1
drivers/net/wireless/ath/carl9170/fw.c
··· 15 15 #include "fwcmd.h" 16 16 #include "version.h" 17 17 18 - static const u8 otus_magic[4] = { OTUS_MAGIC }; 18 + static const u8 otus_magic[4] __nonstring = { OTUS_MAGIC }; 19 19 20 20 static const void *carl9170_fw_find_desc(struct ar9170 *ar, const u8 descid[4], 21 21 const unsigned int len, const u8 compatible_revision)
+4 -2
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
··· 896 896 } 897 897 898 898 /* 1) Prepare USB boot loader for runtime image */ 899 - brcmf_usb_dl_cmd(devinfo, DL_START, &state, sizeof(state)); 899 + err = brcmf_usb_dl_cmd(devinfo, DL_START, &state, sizeof(state)); 900 + if (err) 901 + goto fail; 900 902 901 903 rdlstate = le32_to_cpu(state.state); 902 904 rdlbytes = le32_to_cpu(state.bytes); 903 905 904 906 /* 2) Check we are in the Waiting state */ 905 907 if (rdlstate != DL_WAITING) { 906 - brcmf_err("Failed to DL_START\n"); 908 + brcmf_err("Invalid DL state: %u\n", rdlstate); 907 909 err = -EINVAL; 908 910 goto fail; 909 911 }
-2
drivers/net/wireless/intel/iwlwifi/cfg/sc.c
··· 142 142 .ltr_delay = IWL_CFG_TRANS_LTR_DELAY_2500US, 143 143 }; 144 144 145 - const char iwl_sp_name[] = "Intel(R) Wi-Fi 7 BE213 160MHz"; 146 - 147 145 const struct iwl_cfg iwl_cfg_sc = { 148 146 .fw_name_mac = "sc", 149 147 IWL_DEVICE_SC,
+9 -7
drivers/net/wireless/intel/iwlwifi/iwl-config.h
··· 2 2 /* 3 3 * Copyright (C) 2005-2014, 2018-2021 Intel Corporation 4 4 * Copyright (C) 2016-2017 Intel Deutschland GmbH 5 - * Copyright (C) 2018-2025 Intel Corporation 5 + * Copyright (C) 2018-2024 Intel Corporation 6 6 */ 7 7 #ifndef __IWL_CONFIG_H__ 8 8 #define __IWL_CONFIG_H__ ··· 451 451 #define IWL_CFG_RF_ID_HR 0x7 452 452 #define IWL_CFG_RF_ID_HR1 0x4 453 453 454 - #define IWL_CFG_BW_NO_LIM (U16_MAX - 1) 455 - #define IWL_CFG_BW_ANY U16_MAX 454 + #define IWL_CFG_NO_160 0x1 455 + #define IWL_CFG_160 0x0 456 + 457 + #define IWL_CFG_NO_320 0x1 458 + #define IWL_CFG_320 0x0 456 459 457 460 #define IWL_CFG_CORES_BT 0x0 458 461 #define IWL_CFG_CORES_BT_GNSS 0x5 ··· 467 464 #define IWL_CFG_IS_JACKET 0x1 468 465 469 466 #define IWL_SUBDEVICE_RF_ID(subdevice) ((u16)((subdevice) & 0x00F0) >> 4) 470 - #define IWL_SUBDEVICE_BW_LIM(subdevice) ((u16)((subdevice) & 0x0200) >> 9) 467 + #define IWL_SUBDEVICE_NO_160(subdevice) ((u16)((subdevice) & 0x0200) >> 9) 471 468 #define IWL_SUBDEVICE_CORES(subdevice) ((u16)((subdevice) & 0x1C00) >> 10) 472 469 473 470 struct iwl_dev_info { ··· 475 472 u16 subdevice; 476 473 u16 mac_type; 477 474 u16 rf_type; 478 - u16 bw_limit; 479 475 u8 mac_step; 480 476 u8 rf_step; 481 477 u8 rf_id; 478 + u8 no_160; 482 479 u8 cores; 483 480 u8 cdb; 484 481 u8 jacket; ··· 492 489 const struct iwl_dev_info * 493 490 iwl_pci_find_dev_info(u16 device, u16 subsystem_device, 494 491 u16 mac_type, u8 mac_step, u16 rf_type, u8 cdb, 495 - u8 jacket, u8 rf_id, u8 bw_limit, u8 cores, u8 rf_step); 492 + u8 jacket, u8 rf_id, u8 no_160, u8 cores, u8 rf_step); 496 493 extern const struct pci_device_id iwl_hw_card_ids[]; 497 494 #endif 498 495 ··· 553 550 extern const char iwl_ax411_name[]; 554 551 extern const char iwl_fm_name[]; 555 552 extern const char iwl_wh_name[]; 556 - extern const char iwl_sp_name[]; 557 553 extern const char iwl_gl_name[]; 558 554 extern const char iwl_mtp_name[]; 559 555 extern const char iwl_dr_name[];
+1
drivers/net/wireless/intel/iwlwifi/iwl-csr.h
··· 148 148 * during a error FW error. 149 149 */ 150 150 #define CSR_FUNC_SCRATCH_INIT_VALUE (0x01010101) 151 + #define CSR_FUNC_SCRATCH_POWER_OFF_MASK 0xFFFF 151 152 152 153 /* Bits for CSR_HW_IF_CONFIG_REG */ 153 154 #define CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP_DASH (0x0000000F)
+6 -10
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2 2 /* 3 - * Copyright (C) 2005-2014, 2018-2023, 2025 Intel Corporation 3 + * Copyright (C) 2005-2014, 2018-2023 Intel Corporation 4 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 6 */ ··· 944 944 IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_MASK); 945 945 break; 946 946 case NL80211_BAND_6GHZ: 947 - if (!trans->reduced_cap_sku && 948 - trans->bw_limit >= 320) { 947 + if (!trans->reduced_cap_sku) { 949 948 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[0] |= 950 949 IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ; 951 950 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[1] |= ··· 1094 1095 iftype_data->eht_cap.eht_mcs_nss_supp.bw._320.rx_tx_mcs13_max_nss = 0; 1095 1096 } 1096 1097 1097 - if (trans->bw_limit < 160) 1098 + if (trans->no_160) 1098 1099 iftype_data->he_cap.he_cap_elem.phy_cap_info[0] &= 1099 1100 ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G; 1100 1101 1101 - if (trans->bw_limit < 320 || trans->reduced_cap_sku) { 1102 + if (trans->reduced_cap_sku) { 1102 1103 memset(&iftype_data->eht_cap.eht_mcs_nss_supp.bw._320, 0, 1103 1104 sizeof(iftype_data->eht_cap.eht_mcs_nss_supp.bw._320)); 1104 - iftype_data->eht_cap.eht_cap_elem.phy_cap_info[2] &= 1105 - ~IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_320MHZ_MASK; 1106 - } 1107 - 1108 - if (trans->reduced_cap_sku) { 1109 1105 iftype_data->eht_cap.eht_mcs_nss_supp.bw._80.rx_tx_mcs13_max_nss = 0; 1110 1106 iftype_data->eht_cap.eht_mcs_nss_supp.bw._160.rx_tx_mcs13_max_nss = 0; 1111 1107 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[8] &= 1112 1108 ~IEEE80211_EHT_PHY_CAP8_RX_4096QAM_WIDER_BW_DL_OFDMA; 1109 + iftype_data->eht_cap.eht_cap_elem.phy_cap_info[2] &= 1110 + ~IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_320MHZ_MASK; 1113 1111 } 1114 1112 } 1115 1113
+21 -7
drivers/net/wireless/intel/iwlwifi/iwl-trans.c
··· 21 21 struct list_head list; 22 22 unsigned int restart_count; 23 23 time64_t last_error; 24 + bool backoff; 24 25 char name[]; 25 26 }; 26 27 ··· 126 125 if (!data) 127 126 return at_least; 128 127 129 - if (ktime_get_boottime_seconds() - data->last_error >= 128 + if (!data->backoff && 129 + ktime_get_boottime_seconds() - data->last_error >= 130 130 IWL_TRANS_RESET_OK_TIME) 131 131 data->restart_count = 0; 132 132 133 133 index = data->restart_count; 134 - if (index >= ARRAY_SIZE(escalation_list)) 134 + if (index >= ARRAY_SIZE(escalation_list)) { 135 135 index = ARRAY_SIZE(escalation_list) - 1; 136 + if (!data->backoff) { 137 + data->backoff = true; 138 + return IWL_RESET_MODE_BACKOFF; 139 + } 140 + data->backoff = false; 141 + } 136 142 137 143 return max(at_least, escalation_list[index]); 138 144 } ··· 148 140 149 141 static void iwl_trans_restart_wk(struct work_struct *wk) 150 142 { 151 - struct iwl_trans *trans = container_of(wk, typeof(*trans), restart.wk); 143 + struct iwl_trans *trans = container_of(wk, typeof(*trans), 144 + restart.wk.work); 152 145 struct iwl_trans_reprobe *reprobe; 153 146 enum iwl_reset_mode mode; 154 147 ··· 177 168 return; 178 169 179 170 mode = iwl_trans_determine_restart_mode(trans); 171 + if (mode == IWL_RESET_MODE_BACKOFF) { 172 + IWL_ERR(trans, "Too many device errors - delay next reset\n"); 173 + queue_delayed_work(system_unbound_wq, &trans->restart.wk, 174 + IWL_TRANS_RESET_DELAY); 175 + return; 176 + } 180 177 181 178 iwl_trans_inc_restart_count(trans->dev); 182 179 ··· 242 227 trans->dev = dev; 243 228 trans->num_rx_queues = 1; 244 229 245 - INIT_WORK(&trans->restart.wk, iwl_trans_restart_wk); 230 + INIT_DELAYED_WORK(&trans->restart.wk, iwl_trans_restart_wk); 246 231 247 232 return trans; 248 233 } ··· 286 271 287 272 void iwl_trans_free(struct iwl_trans *trans) 288 273 { 289 - cancel_work_sync(&trans->restart.wk); 274 + cancel_delayed_work_sync(&trans->restart.wk); 290 275 kmem_cache_destroy(trans->dev_cmd_pool); 291 276 } 292 277 ··· 418 403 419 404 iwl_trans_pcie_op_mode_leave(trans); 420 405 421 - cancel_work_sync(&trans->restart.wk); 406 + cancel_delayed_work_sync(&trans->restart.wk); 422 407 423 408 trans->op_mode = NULL; 424 409 ··· 555 540 iwl_trans_release_nic_access(struct iwl_trans *trans) 556 541 { 557 542 iwl_trans_pcie_release_nic_access(trans); 558 - __release(nic_access); 559 543 } 560 544 IWL_EXPORT_SYMBOL(iwl_trans_release_nic_access); 561 545
+8 -6
drivers/net/wireless/intel/iwlwifi/iwl-trans.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 2 /* 3 - * Copyright (C) 2005-2014, 2018-2023, 2025 Intel Corporation 3 + * Copyright (C) 2005-2014, 2018-2023 Intel Corporation 4 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 6 */ ··· 876 876 * only valid for discrete (not integrated) NICs 877 877 * @invalid_tx_cmd: invalid TX command buffer 878 878 * @reduced_cap_sku: reduced capability supported SKU 879 - * @bw_limit: the max bandwidth 879 + * @no_160: device not supporting 160 MHz 880 880 * @step_urm: STEP is in URM, no support for MCS>9 in 320 MHz 881 881 * @restart: restart worker data 882 882 * @restart.wk: restart worker ··· 911 911 char hw_id_str[52]; 912 912 u32 sku_id[3]; 913 913 bool reduced_cap_sku; 914 - u16 bw_limit; 915 - bool step_urm; 914 + u8 no_160:1, step_urm:1; 916 915 917 916 u8 dsbr_urm_fw_dependent:1, 918 917 dsbr_urm_permanent:1; ··· 961 962 struct iwl_dma_ptr invalid_tx_cmd; 962 963 963 964 struct { 964 - struct work_struct wk; 965 + struct delayed_work wk; 965 966 struct iwl_fw_error_dump_mode mode; 966 967 bool during_reset; 967 968 } restart; ··· 1162 1163 */ 1163 1164 trans->restart.during_reset = test_bit(STATUS_IN_SW_RESET, 1164 1165 &trans->status); 1165 - queue_work(system_unbound_wq, &trans->restart.wk); 1166 + queue_delayed_work(system_unbound_wq, &trans->restart.wk, 0); 1166 1167 } 1167 1168 1168 1169 static inline void iwl_trans_fw_error(struct iwl_trans *trans, ··· 1261 1262 IWL_RESET_MODE_RESCAN, 1262 1263 IWL_RESET_MODE_FUNC_RESET, 1263 1264 IWL_RESET_MODE_PROD_RESET, 1265 + 1266 + /* keep last - special backoff value */ 1267 + IWL_RESET_MODE_BACKOFF, 1264 1268 }; 1265 1269 1266 1270 void iwl_trans_pcie_reset(struct iwl_trans *trans, enum iwl_reset_mode mode);
+3 -3
drivers/net/wireless/intel/iwlwifi/mld/agg.c
··· 124 124 125 125 rcu_read_lock(); 126 126 baid_data = rcu_dereference(mld->fw_id_to_ba[baid]); 127 - if (!IWL_FW_CHECK(mld, !baid_data, 128 - "Got valid BAID %d but not allocated, invalid BAR release!\n", 129 - baid)) 127 + if (IWL_FW_CHECK(mld, !baid_data, 128 + "Got valid BAID %d but not allocated, invalid BAR release!\n", 129 + baid)) 130 130 goto out_unlock; 131 131 132 132 if (IWL_FW_CHECK(mld, tid != baid_data->tid ||
+6 -3
drivers/net/wireless/intel/iwlwifi/mld/d3.c
··· 1099 1099 if (!match) 1100 1100 return; 1101 1101 1102 - netdetect_info->matches[netdetect_info->n_matches++] = match; 1102 + netdetect_info->matches[netdetect_info->n_matches] = match; 1103 + netdetect_info->n_matches++; 1103 1104 1104 1105 /* We inverted the order of the SSIDs in the scan 1105 1106 * request, so invert the index here. ··· 1117 1116 1118 1117 for_each_set_bit(j, 1119 1118 (unsigned long *)&matches[i].matching_channels[0], 1120 - sizeof(matches[i].matching_channels)) 1121 - match->channels[match->n_channels++] = 1119 + sizeof(matches[i].matching_channels)) { 1120 + match->channels[match->n_channels] = 1122 1121 netdetect_cfg->channels[j]->center_freq; 1122 + match->n_channels++; 1123 + } 1123 1124 } 1124 1125 } 1125 1126
+3 -2
drivers/net/wireless/intel/iwlwifi/mld/debugfs.c
··· 949 949 snprintf(name, sizeof(name), "%pd", vif->debugfs_dir); 950 950 snprintf(target, sizeof(target), "../../../%pd3/iwlmld", 951 951 vif->debugfs_dir); 952 - mld_vif->dbgfs_slink = 953 - debugfs_create_symlink(name, mld->debugfs_dir, target); 952 + if (!mld_vif->dbgfs_slink) 953 + mld_vif->dbgfs_slink = 954 + debugfs_create_symlink(name, mld->debugfs_dir, target); 954 955 955 956 if (iwlmld_mod_params.power_scheme != IWL_POWER_SCHEME_CAM && 956 957 vif->type == NL80211_IFTYPE_STATION) {
+10 -3
drivers/net/wireless/intel/iwlwifi/mld/fw.c
··· 333 333 334 334 ret = iwl_trans_start_hw(mld->trans); 335 335 if (ret) 336 - return ret; 336 + goto err; 337 337 338 338 ret = iwl_mld_run_fw_init_sequence(mld); 339 339 if (ret) 340 - return ret; 340 + goto err; 341 341 342 342 ret = iwl_mld_init_mcc(mld); 343 343 if (ret) 344 - return ret; 344 + goto err; 345 345 346 346 mld->fw_status.running = true; 347 347 348 348 return 0; 349 + err: 350 + iwl_mld_stop_fw(mld); 351 + return ret; 349 352 } 350 353 351 354 void iwl_mld_stop_fw(struct iwl_mld *mld) ··· 360 357 iwl_fw_dbg_stop_sync(&mld->fwrt); 361 358 362 359 iwl_trans_stop_device(mld->trans); 360 + 361 + wiphy_work_cancel(mld->wiphy, &mld->async_handlers_wk); 362 + 363 + iwl_mld_purge_async_handlers_list(mld); 363 364 364 365 mld->fw_status.running = false; 365 366 }
+1
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
··· 651 651 652 652 #ifdef CONFIG_IWLWIFI_DEBUGFS 653 653 debugfs_remove(iwl_mld_vif_from_mac80211(vif)->dbgfs_slink); 654 + iwl_mld_vif_from_mac80211(vif)->dbgfs_slink = NULL; 654 655 #endif 655 656 656 657 iwl_mld_rm_vif(mld, vif);
+9 -2
drivers/net/wireless/intel/iwlwifi/mld/mld.c
··· 75 75 76 76 /* Setup async RX handling */ 77 77 spin_lock_init(&mld->async_handlers_lock); 78 + INIT_LIST_HEAD(&mld->async_handlers_list); 78 79 wiphy_work_init(&mld->async_handlers_wk, 79 80 iwl_mld_async_handlers_wk); 80 81 ··· 415 414 wiphy_unlock(mld->wiphy); 416 415 rtnl_unlock(); 417 416 iwl_fw_flush_dumps(&mld->fwrt); 418 - goto free_hw; 417 + goto err; 419 418 } 419 + 420 + /* We are about to stop the FW. Notifications may require an 421 + * operational FW, so handle them all here before we stop. 422 + */ 423 + wiphy_work_flush(mld->wiphy, &mld->async_handlers_wk); 420 424 421 425 iwl_mld_stop_fw(mld); 422 426 ··· 461 455 iwl_mld_leds_exit(mld); 462 456 free_nvm: 463 457 kfree(mld->nvm_data); 464 - free_hw: 458 + err: 459 + iwl_trans_op_mode_leave(mld->trans); 465 460 ieee80211_free_hw(mld->hw); 466 461 return ERR_PTR(ret); 467 462 }
-5
drivers/net/wireless/intel/iwlwifi/mld/mld.h
··· 298 298 #endif 299 299 300 300 iwl_mld_low_latency_restart_cleanup(mld); 301 - 302 - /* Empty the list of async notification handlers so we won't process 303 - * notifications from the dead fw after the reconfig flow. 304 - */ 305 - iwl_mld_purge_async_handlers_list(mld); 306 301 } 307 302 308 303 enum iwl_power_scheme {
+119 -126
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2 2 /* 3 - * Copyright (C) 2005-2014, 2018-2025 Intel Corporation 3 + * Copyright (C) 2005-2014, 2018-2024 Intel Corporation 4 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 6 */ ··· 552 552 EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_hw_card_ids); 553 553 554 554 #define _IWL_DEV_INFO(_device, _subdevice, _mac_type, _mac_step, _rf_type, \ 555 - _rf_id, _rf_step, _bw_limit, _cores, _cdb, _cfg, _name) \ 555 + _rf_id, _rf_step, _no_160, _cores, _cdb, _cfg, _name) \ 556 556 { .device = (_device), .subdevice = (_subdevice), .cfg = &(_cfg), \ 557 557 .name = _name, .mac_type = _mac_type, .rf_type = _rf_type, .rf_step = _rf_step, \ 558 - .bw_limit = _bw_limit, .cores = _cores, .rf_id = _rf_id, \ 558 + .no_160 = _no_160, .cores = _cores, .rf_id = _rf_id, \ 559 559 .mac_step = _mac_step, .cdb = _cdb, .jacket = IWL_CFG_ANY } 560 560 561 561 #define IWL_DEV_INFO(_device, _subdevice, _cfg, _name) \ 562 562 _IWL_DEV_INFO(_device, _subdevice, IWL_CFG_ANY, IWL_CFG_ANY, \ 563 - IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, \ 564 - IWL_CFG_BW_NO_LIM, IWL_CFG_ANY, IWL_CFG_ANY, \ 565 - _cfg, _name) 563 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, \ 564 + IWL_CFG_ANY, _cfg, _name) 566 565 567 566 VISIBLE_IF_IWLWIFI_KUNIT const struct iwl_dev_info iwl_dev_info_table[] = { 568 567 #if IS_ENABLED(CONFIG_IWLMVM) ··· 724 725 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 725 726 IWL_CFG_MAC_TYPE_PU, IWL_CFG_ANY, 726 727 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1, IWL_CFG_ANY, 727 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 728 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 728 729 iwl9560_2ac_cfg_soc, iwl9461_160_name), 729 730 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 730 731 IWL_CFG_MAC_TYPE_PU, IWL_CFG_ANY, 731 732 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1, IWL_CFG_ANY, 732 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 733 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 733 734 iwl9560_2ac_cfg_soc, iwl9461_name), 734 735 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 735 736 IWL_CFG_MAC_TYPE_PU, IWL_CFG_ANY, 736 737 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1_DIV, IWL_CFG_ANY, 737 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 738 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 738 739 iwl9560_2ac_cfg_soc, iwl9462_160_name), 739 740 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 740 741 IWL_CFG_MAC_TYPE_PU, IWL_CFG_ANY, 741 742 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1_DIV, IWL_CFG_ANY, 742 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 743 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 743 744 iwl9560_2ac_cfg_soc, iwl9462_name), 744 745 745 746 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 746 747 IWL_CFG_MAC_TYPE_PU, IWL_CFG_ANY, 747 748 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 748 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 749 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 749 750 iwl9560_2ac_cfg_soc, iwl9560_160_name), 750 751 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 751 752 IWL_CFG_MAC_TYPE_PU, IWL_CFG_ANY, 752 753 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 753 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 754 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 754 755 iwl9560_2ac_cfg_soc, iwl9560_name), 755 756 756 757 _IWL_DEV_INFO(0x2526, IWL_CFG_ANY, 757 758 IWL_CFG_MAC_TYPE_TH, IWL_CFG_ANY, 758 759 IWL_CFG_RF_TYPE_TH, IWL_CFG_ANY, IWL_CFG_ANY, 759 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT_GNSS, IWL_CFG_NO_CDB, 760 + IWL_CFG_160, IWL_CFG_CORES_BT_GNSS, IWL_CFG_NO_CDB, 760 761 iwl9260_2ac_cfg, iwl9270_160_name), 761 762 _IWL_DEV_INFO(0x2526, IWL_CFG_ANY, 762 763 IWL_CFG_MAC_TYPE_TH, IWL_CFG_ANY, 763 764 IWL_CFG_RF_TYPE_TH, IWL_CFG_ANY, IWL_CFG_ANY, 764 - 80, IWL_CFG_CORES_BT_GNSS, IWL_CFG_NO_CDB, 765 + IWL_CFG_NO_160, IWL_CFG_CORES_BT_GNSS, IWL_CFG_NO_CDB, 765 766 iwl9260_2ac_cfg, iwl9270_name), 766 767 767 768 _IWL_DEV_INFO(0x271B, IWL_CFG_ANY, 768 769 IWL_CFG_MAC_TYPE_TH, IWL_CFG_ANY, 769 770 IWL_CFG_RF_TYPE_TH1, IWL_CFG_ANY, IWL_CFG_ANY, 770 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 771 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 771 772 iwl9260_2ac_cfg, iwl9162_160_name), 772 773 _IWL_DEV_INFO(0x271B, IWL_CFG_ANY, 773 774 IWL_CFG_MAC_TYPE_TH, IWL_CFG_ANY, 774 775 IWL_CFG_RF_TYPE_TH1, IWL_CFG_ANY, IWL_CFG_ANY, 775 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 776 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 776 777 iwl9260_2ac_cfg, iwl9162_name), 777 778 778 779 _IWL_DEV_INFO(0x2526, IWL_CFG_ANY, 779 780 IWL_CFG_MAC_TYPE_TH, IWL_CFG_ANY, 780 781 IWL_CFG_RF_TYPE_TH, IWL_CFG_ANY, IWL_CFG_ANY, 781 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 782 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 782 783 iwl9260_2ac_cfg, iwl9260_160_name), 783 784 _IWL_DEV_INFO(0x2526, IWL_CFG_ANY, 784 785 IWL_CFG_MAC_TYPE_TH, IWL_CFG_ANY, 785 786 IWL_CFG_RF_TYPE_TH, IWL_CFG_ANY, IWL_CFG_ANY, 786 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 787 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 787 788 iwl9260_2ac_cfg, iwl9260_name), 788 789 789 790 /* Qu with Jf */ ··· 791 792 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 792 793 IWL_CFG_MAC_TYPE_QU, SILICON_B_STEP, 793 794 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1, IWL_CFG_ANY, 794 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 795 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 795 796 iwl9560_qu_b0_jf_b0_cfg, iwl9461_160_name), 796 797 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 797 798 IWL_CFG_MAC_TYPE_QU, SILICON_B_STEP, 798 799 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1, IWL_CFG_ANY, 799 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 800 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 800 801 iwl9560_qu_b0_jf_b0_cfg, iwl9461_name), 801 802 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 802 803 IWL_CFG_MAC_TYPE_QU, SILICON_B_STEP, 803 804 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1_DIV, IWL_CFG_ANY, 804 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 805 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 805 806 iwl9560_qu_b0_jf_b0_cfg, iwl9462_160_name), 806 807 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 807 808 IWL_CFG_MAC_TYPE_QU, SILICON_B_STEP, 808 809 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1_DIV, IWL_CFG_ANY, 809 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 810 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 810 811 iwl9560_qu_b0_jf_b0_cfg, iwl9462_name), 811 812 812 813 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 813 814 IWL_CFG_MAC_TYPE_QU, SILICON_B_STEP, 814 815 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 815 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 816 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 816 817 iwl9560_qu_b0_jf_b0_cfg, iwl9560_160_name), 817 818 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 818 819 IWL_CFG_MAC_TYPE_QU, SILICON_B_STEP, 819 820 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 820 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 821 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 821 822 iwl9560_qu_b0_jf_b0_cfg, iwl9560_name), 822 823 823 824 _IWL_DEV_INFO(IWL_CFG_ANY, 0x1551, 824 825 IWL_CFG_MAC_TYPE_QU, SILICON_B_STEP, 825 826 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 826 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 827 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 827 828 iwl9560_qu_b0_jf_b0_cfg, iwl9560_killer_1550s_name), 828 829 _IWL_DEV_INFO(IWL_CFG_ANY, 0x1552, 829 830 IWL_CFG_MAC_TYPE_QU, SILICON_B_STEP, 830 831 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 831 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 832 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 832 833 iwl9560_qu_b0_jf_b0_cfg, iwl9560_killer_1550i_name), 833 834 834 835 /* Qu C step */ 835 836 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 836 837 IWL_CFG_MAC_TYPE_QU, SILICON_C_STEP, 837 838 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1, IWL_CFG_ANY, 838 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 839 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 839 840 iwl9560_qu_c0_jf_b0_cfg, iwl9461_160_name), 840 841 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 841 842 IWL_CFG_MAC_TYPE_QU, SILICON_C_STEP, 842 843 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1, IWL_CFG_ANY, 843 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 844 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 844 845 iwl9560_qu_c0_jf_b0_cfg, iwl9461_name), 845 846 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 846 847 IWL_CFG_MAC_TYPE_QU, SILICON_C_STEP, 847 848 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1_DIV, IWL_CFG_ANY, 848 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 849 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 849 850 iwl9560_qu_c0_jf_b0_cfg, iwl9462_160_name), 850 851 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 851 852 IWL_CFG_MAC_TYPE_QU, SILICON_C_STEP, 852 853 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1_DIV, IWL_CFG_ANY, 853 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 854 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 854 855 iwl9560_qu_c0_jf_b0_cfg, iwl9462_name), 855 856 856 857 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 857 858 IWL_CFG_MAC_TYPE_QU, SILICON_C_STEP, 858 859 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 859 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 860 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 860 861 iwl9560_qu_c0_jf_b0_cfg, iwl9560_160_name), 861 862 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 862 863 IWL_CFG_MAC_TYPE_QU, SILICON_C_STEP, 863 864 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 864 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 865 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 865 866 iwl9560_qu_c0_jf_b0_cfg, iwl9560_name), 866 867 867 868 _IWL_DEV_INFO(IWL_CFG_ANY, 0x1551, 868 869 IWL_CFG_MAC_TYPE_QU, SILICON_C_STEP, 869 870 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 870 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 871 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 871 872 iwl9560_qu_c0_jf_b0_cfg, iwl9560_killer_1550s_name), 872 873 _IWL_DEV_INFO(IWL_CFG_ANY, 0x1552, 873 874 IWL_CFG_MAC_TYPE_QU, SILICON_C_STEP, 874 875 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 875 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 876 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 876 877 iwl9560_qu_c0_jf_b0_cfg, iwl9560_killer_1550i_name), 877 878 878 879 /* QuZ */ 879 880 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 880 881 IWL_CFG_MAC_TYPE_QUZ, IWL_CFG_ANY, 881 882 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1, IWL_CFG_ANY, 882 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 883 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 883 884 iwl9560_quz_a0_jf_b0_cfg, iwl9461_160_name), 884 885 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 885 886 IWL_CFG_MAC_TYPE_QUZ, IWL_CFG_ANY, 886 887 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1, IWL_CFG_ANY, 887 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 888 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 888 889 iwl9560_quz_a0_jf_b0_cfg, iwl9461_name), 889 890 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 890 891 IWL_CFG_MAC_TYPE_QUZ, IWL_CFG_ANY, 891 892 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1_DIV, IWL_CFG_ANY, 892 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 893 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 893 894 iwl9560_quz_a0_jf_b0_cfg, iwl9462_160_name), 894 895 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 895 896 IWL_CFG_MAC_TYPE_QUZ, IWL_CFG_ANY, 896 897 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1_DIV, IWL_CFG_ANY, 897 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 898 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 898 899 iwl9560_quz_a0_jf_b0_cfg, iwl9462_name), 899 900 900 901 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 901 902 IWL_CFG_MAC_TYPE_QUZ, IWL_CFG_ANY, 902 903 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 903 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 904 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 904 905 iwl9560_quz_a0_jf_b0_cfg, iwl9560_160_name), 905 906 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 906 907 IWL_CFG_MAC_TYPE_QUZ, IWL_CFG_ANY, 907 908 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 908 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 909 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 909 910 iwl9560_quz_a0_jf_b0_cfg, iwl9560_name), 910 911 911 912 _IWL_DEV_INFO(IWL_CFG_ANY, 0x1551, 912 913 IWL_CFG_MAC_TYPE_QUZ, IWL_CFG_ANY, 913 914 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 914 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 915 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 915 916 iwl9560_quz_a0_jf_b0_cfg, iwl9560_killer_1550s_name), 916 917 _IWL_DEV_INFO(IWL_CFG_ANY, 0x1552, 917 918 IWL_CFG_MAC_TYPE_QUZ, IWL_CFG_ANY, 918 919 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 919 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 920 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 920 921 iwl9560_quz_a0_jf_b0_cfg, iwl9560_killer_1550i_name), 921 922 922 923 /* Qu with Hr */ ··· 924 925 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 925 926 IWL_CFG_MAC_TYPE_QU, SILICON_B_STEP, 926 927 IWL_CFG_RF_TYPE_HR1, IWL_CFG_ANY, IWL_CFG_ANY, 927 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB, 928 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB, 928 929 iwl_qu_b0_hr1_b0, iwl_ax101_name), 929 930 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 930 931 IWL_CFG_MAC_TYPE_QU, SILICON_B_STEP, 931 932 IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 932 - 80, IWL_CFG_ANY, IWL_CFG_NO_CDB, 933 + IWL_CFG_NO_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 933 934 iwl_qu_b0_hr_b0, iwl_ax203_name), 934 935 935 936 /* Qu C step */ 936 937 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 937 938 IWL_CFG_MAC_TYPE_QU, SILICON_C_STEP, 938 939 IWL_CFG_RF_TYPE_HR1, IWL_CFG_ANY, IWL_CFG_ANY, 939 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB, 940 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB, 940 941 iwl_qu_c0_hr1_b0, iwl_ax101_name), 941 942 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 942 943 IWL_CFG_MAC_TYPE_QU, SILICON_C_STEP, 943 944 IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 944 - 80, IWL_CFG_ANY, IWL_CFG_NO_CDB, 945 + IWL_CFG_NO_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 945 946 iwl_qu_c0_hr_b0, iwl_ax203_name), 946 947 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 947 948 IWL_CFG_MAC_TYPE_QU, SILICON_C_STEP, 948 949 IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 949 - IWL_CFG_BW_NO_LIM, IWL_CFG_ANY, IWL_CFG_NO_CDB, 950 + IWL_CFG_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 950 951 iwl_qu_c0_hr_b0, iwl_ax201_name), 951 952 952 953 /* QuZ */ 953 954 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 954 955 IWL_CFG_MAC_TYPE_QUZ, IWL_CFG_ANY, 955 956 IWL_CFG_RF_TYPE_HR1, IWL_CFG_ANY, IWL_CFG_ANY, 956 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB, 957 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB, 957 958 iwl_quz_a0_hr1_b0, iwl_ax101_name), 958 959 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 959 960 IWL_CFG_MAC_TYPE_QUZ, SILICON_B_STEP, 960 961 IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 961 - 80, IWL_CFG_ANY, IWL_CFG_NO_CDB, 962 + IWL_CFG_NO_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 962 963 iwl_cfg_quz_a0_hr_b0, iwl_ax203_name), 963 964 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 964 965 IWL_CFG_MAC_TYPE_QUZ, SILICON_B_STEP, 965 966 IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 966 - IWL_CFG_BW_NO_LIM, IWL_CFG_ANY, IWL_CFG_NO_CDB, 967 + IWL_CFG_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 967 968 iwl_cfg_quz_a0_hr_b0, iwl_ax201_name), 968 969 969 970 /* Ma */ 970 971 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 971 972 IWL_CFG_MAC_TYPE_MA, IWL_CFG_ANY, 972 973 IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 973 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB, 974 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB, 974 975 iwl_cfg_ma, iwl_ax201_name), 975 976 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 976 977 IWL_CFG_MAC_TYPE_MA, IWL_CFG_ANY, 977 978 IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY, IWL_CFG_ANY, 978 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 979 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 979 980 iwl_cfg_ma, iwl_ax211_name), 980 981 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 981 982 IWL_CFG_MAC_TYPE_MA, IWL_CFG_ANY, 982 983 IWL_CFG_RF_TYPE_FM, IWL_CFG_ANY, IWL_CFG_ANY, 983 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB, 984 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB, 984 985 iwl_cfg_ma, iwl_ax231_name), 985 986 986 987 /* So with Hr */ 987 988 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 988 989 IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY, 989 990 IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 990 - 80, IWL_CFG_ANY, IWL_CFG_NO_CDB, 991 + IWL_CFG_NO_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 991 992 iwl_cfg_so_a0_hr_a0, iwl_ax203_name), 992 993 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 993 994 IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY, 994 995 IWL_CFG_RF_TYPE_HR1, IWL_CFG_ANY, IWL_CFG_ANY, 995 - 80, IWL_CFG_ANY, IWL_CFG_NO_CDB, 996 + IWL_CFG_NO_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 996 997 iwl_cfg_so_a0_hr_a0, iwl_ax101_name), 997 998 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 998 999 IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY, 999 1000 IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 1000 - IWL_CFG_BW_NO_LIM, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1001 + IWL_CFG_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1001 1002 iwl_cfg_so_a0_hr_a0, iwl_ax201_name), 1002 1003 1003 1004 /* So-F with Hr */ 1004 1005 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1005 1006 IWL_CFG_MAC_TYPE_SOF, IWL_CFG_ANY, 1006 1007 IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 1007 - 80, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1008 + IWL_CFG_NO_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1008 1009 iwl_cfg_so_a0_hr_a0, iwl_ax203_name), 1009 1010 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1010 1011 IWL_CFG_MAC_TYPE_SOF, IWL_CFG_ANY, 1011 1012 IWL_CFG_RF_TYPE_HR1, IWL_CFG_ANY, IWL_CFG_ANY, 1012 - 80, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1013 + IWL_CFG_NO_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1013 1014 iwl_cfg_so_a0_hr_a0, iwl_ax101_name), 1014 1015 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1015 1016 IWL_CFG_MAC_TYPE_SOF, IWL_CFG_ANY, 1016 1017 IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 1017 - IWL_CFG_BW_NO_LIM, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1018 + IWL_CFG_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1018 1019 iwl_cfg_so_a0_hr_a0, iwl_ax201_name), 1019 1020 1020 1021 /* So-F with Gf */ 1021 1022 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1022 1023 IWL_CFG_MAC_TYPE_SOF, IWL_CFG_ANY, 1023 1024 IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY, IWL_CFG_ANY, 1024 - IWL_CFG_BW_NO_LIM, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1025 + IWL_CFG_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1025 1026 iwlax211_2ax_cfg_so_gf_a0, iwl_ax211_name), 1026 1027 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1027 1028 IWL_CFG_MAC_TYPE_SOF, IWL_CFG_ANY, 1028 1029 IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY, IWL_CFG_ANY, 1029 - IWL_CFG_BW_NO_LIM, IWL_CFG_ANY, IWL_CFG_CDB, 1030 + IWL_CFG_160, IWL_CFG_ANY, IWL_CFG_CDB, 1030 1031 iwlax411_2ax_cfg_so_gf4_a0, iwl_ax411_name), 1031 1032 1032 1033 /* SoF with JF2 */ 1033 1034 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1034 1035 IWL_CFG_MAC_TYPE_SOF, IWL_CFG_ANY, 1035 1036 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 1036 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1037 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1037 1038 iwlax210_2ax_cfg_so_jf_b0, iwl9560_160_name), 1038 1039 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1039 1040 IWL_CFG_MAC_TYPE_SOF, IWL_CFG_ANY, 1040 1041 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 1041 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1042 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1042 1043 iwlax210_2ax_cfg_so_jf_b0, iwl9560_name), 1043 1044 1044 1045 /* SoF with JF */ 1045 1046 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1046 1047 IWL_CFG_MAC_TYPE_SOF, IWL_CFG_ANY, 1047 1048 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1, IWL_CFG_ANY, 1048 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1049 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1049 1050 iwlax210_2ax_cfg_so_jf_b0, iwl9461_160_name), 1050 1051 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1051 1052 IWL_CFG_MAC_TYPE_SOF, IWL_CFG_ANY, 1052 1053 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1_DIV, IWL_CFG_ANY, 1053 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1054 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1054 1055 iwlax210_2ax_cfg_so_jf_b0, iwl9462_160_name), 1055 1056 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1056 1057 IWL_CFG_MAC_TYPE_SOF, IWL_CFG_ANY, 1057 1058 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1, IWL_CFG_ANY, 1058 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1059 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1059 1060 iwlax210_2ax_cfg_so_jf_b0, iwl9461_name), 1060 1061 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1061 1062 IWL_CFG_MAC_TYPE_SOF, IWL_CFG_ANY, 1062 1063 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1_DIV, IWL_CFG_ANY, 1063 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1064 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1064 1065 iwlax210_2ax_cfg_so_jf_b0, iwl9462_name), 1065 1066 1066 1067 /* So with GF */ 1067 1068 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1068 1069 IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY, 1069 1070 IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY, IWL_CFG_ANY, 1070 - IWL_CFG_BW_NO_LIM, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1071 + IWL_CFG_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1071 1072 iwlax211_2ax_cfg_so_gf_a0, iwl_ax211_name), 1072 1073 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1073 1074 IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY, 1074 1075 IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY, IWL_CFG_ANY, 1075 - IWL_CFG_BW_NO_LIM, IWL_CFG_ANY, IWL_CFG_CDB, 1076 + IWL_CFG_160, IWL_CFG_ANY, IWL_CFG_CDB, 1076 1077 iwlax411_2ax_cfg_so_gf4_a0, iwl_ax411_name), 1077 1078 1078 1079 /* So with JF2 */ 1079 1080 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1080 1081 IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY, 1081 1082 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 1082 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1083 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1083 1084 iwlax210_2ax_cfg_so_jf_b0, iwl9560_160_name), 1084 1085 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1085 1086 IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY, 1086 1087 IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF, IWL_CFG_ANY, 1087 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1088 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1088 1089 iwlax210_2ax_cfg_so_jf_b0, iwl9560_name), 1089 1090 1090 1091 /* So with JF */ 1091 1092 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1092 1093 IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY, 1093 1094 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1, IWL_CFG_ANY, 1094 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1095 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1095 1096 iwlax210_2ax_cfg_so_jf_b0, iwl9461_160_name), 1096 1097 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1097 1098 IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY, 1098 1099 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1_DIV, IWL_CFG_ANY, 1099 - IWL_CFG_BW_NO_LIM, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1100 + IWL_CFG_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1100 1101 iwlax210_2ax_cfg_so_jf_b0, iwl9462_160_name), 1101 1102 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1102 1103 IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY, 1103 1104 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1, IWL_CFG_ANY, 1104 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1105 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1105 1106 iwlax210_2ax_cfg_so_jf_b0, iwl9461_name), 1106 1107 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1107 1108 IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY, 1108 1109 IWL_CFG_RF_TYPE_JF1, IWL_CFG_RF_ID_JF1_DIV, IWL_CFG_ANY, 1109 - 80, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1110 + IWL_CFG_NO_160, IWL_CFG_CORES_BT, IWL_CFG_NO_CDB, 1110 1111 iwlax210_2ax_cfg_so_jf_b0, iwl9462_name), 1111 1112 1112 1113 #endif /* CONFIG_IWLMVM */ ··· 1115 1116 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1116 1117 IWL_CFG_MAC_TYPE_BZ, IWL_CFG_ANY, 1117 1118 IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 1118 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1119 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1119 1120 iwl_cfg_bz, iwl_ax201_name), 1120 1121 1121 1122 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1122 1123 IWL_CFG_MAC_TYPE_BZ, IWL_CFG_ANY, 1123 1124 IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY, IWL_CFG_ANY, 1124 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1125 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1125 1126 iwl_cfg_bz, iwl_ax211_name), 1126 1127 1127 1128 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, ··· 1133 1134 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1134 1135 IWL_CFG_MAC_TYPE_BZ, IWL_CFG_ANY, 1135 1136 IWL_CFG_RF_TYPE_WH, IWL_CFG_ANY, IWL_CFG_ANY, 1136 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1137 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1137 1138 iwl_cfg_bz, iwl_wh_name), 1138 1139 1139 1140 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1140 1141 IWL_CFG_MAC_TYPE_BZ_W, IWL_CFG_ANY, 1141 1142 IWL_CFG_RF_TYPE_HR2, IWL_CFG_ANY, IWL_CFG_ANY, 1142 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1143 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1143 1144 iwl_cfg_bz, iwl_ax201_name), 1144 1145 1145 1146 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1146 1147 IWL_CFG_MAC_TYPE_BZ_W, IWL_CFG_ANY, 1147 1148 IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY, IWL_CFG_ANY, 1148 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1149 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1149 1150 iwl_cfg_bz, iwl_ax211_name), 1150 1151 1151 1152 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1152 1153 IWL_CFG_MAC_TYPE_BZ_W, IWL_CFG_ANY, 1153 1154 IWL_CFG_RF_TYPE_FM, IWL_CFG_ANY, IWL_CFG_ANY, 1154 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1155 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1155 1156 iwl_cfg_bz, iwl_fm_name), 1156 1157 1157 1158 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1158 1159 IWL_CFG_MAC_TYPE_BZ_W, IWL_CFG_ANY, 1159 1160 IWL_CFG_RF_TYPE_WH, IWL_CFG_ANY, IWL_CFG_ANY, 1160 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1161 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1161 1162 iwl_cfg_bz, iwl_wh_name), 1162 1163 1163 1164 /* Ga (Gl) */ 1164 1165 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1165 1166 IWL_CFG_MAC_TYPE_GL, IWL_CFG_ANY, 1166 1167 IWL_CFG_RF_TYPE_FM, IWL_CFG_ANY, IWL_CFG_ANY, 1167 - IWL_CFG_BW_NO_LIM, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1168 + IWL_CFG_320, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1168 1169 iwl_cfg_gl, iwl_gl_name), 1169 1170 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1170 1171 IWL_CFG_MAC_TYPE_GL, IWL_CFG_ANY, 1171 1172 IWL_CFG_RF_TYPE_FM, IWL_CFG_ANY, IWL_CFG_ANY, 1172 - 160, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1173 + IWL_CFG_NO_320, IWL_CFG_ANY, IWL_CFG_NO_CDB, 1173 1174 iwl_cfg_gl, iwl_mtp_name), 1174 1175 1175 1176 /* Sc */ 1176 1177 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1177 1178 IWL_CFG_MAC_TYPE_SC, IWL_CFG_ANY, 1178 1179 IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY, IWL_CFG_ANY, 1179 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1180 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1180 1181 iwl_cfg_sc, iwl_ax211_name), 1181 1182 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1182 1183 IWL_CFG_MAC_TYPE_SC, IWL_CFG_ANY, 1183 1184 IWL_CFG_RF_TYPE_FM, IWL_CFG_ANY, IWL_CFG_ANY, 1184 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1185 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1185 1186 iwl_cfg_sc, iwl_fm_name), 1186 1187 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1187 1188 IWL_CFG_MAC_TYPE_SC, IWL_CFG_ANY, 1188 1189 IWL_CFG_RF_TYPE_WH, IWL_CFG_ANY, IWL_CFG_ANY, 1189 - IWL_CFG_BW_NO_LIM, IWL_CFG_ANY, IWL_CFG_ANY, 1190 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1190 1191 iwl_cfg_sc, iwl_wh_name), 1191 - _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1192 - IWL_CFG_MAC_TYPE_SC, IWL_CFG_ANY, 1193 - IWL_CFG_RF_TYPE_WH, IWL_CFG_ANY, IWL_CFG_ANY, 1194 - 160, IWL_CFG_ANY, IWL_CFG_ANY, 1195 - iwl_cfg_sc, iwl_sp_name), 1196 1192 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1197 1193 IWL_CFG_MAC_TYPE_SC2, IWL_CFG_ANY, 1198 1194 IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY, IWL_CFG_ANY, 1199 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1195 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1200 1196 iwl_cfg_sc2, iwl_ax211_name), 1201 1197 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1202 1198 IWL_CFG_MAC_TYPE_SC2, IWL_CFG_ANY, 1203 1199 IWL_CFG_RF_TYPE_FM, IWL_CFG_ANY, IWL_CFG_ANY, 1204 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1200 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1205 1201 iwl_cfg_sc2, iwl_fm_name), 1206 1202 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1207 1203 IWL_CFG_MAC_TYPE_SC2, IWL_CFG_ANY, 1208 1204 IWL_CFG_RF_TYPE_WH, IWL_CFG_ANY, IWL_CFG_ANY, 1209 - IWL_CFG_BW_NO_LIM, IWL_CFG_ANY, IWL_CFG_ANY, 1205 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1210 1206 iwl_cfg_sc2, iwl_wh_name), 1211 - _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1212 - IWL_CFG_MAC_TYPE_SC2, IWL_CFG_ANY, 1213 - IWL_CFG_RF_TYPE_WH, IWL_CFG_ANY, IWL_CFG_ANY, 1214 - 160, IWL_CFG_ANY, IWL_CFG_ANY, 1215 - iwl_cfg_sc2, iwl_sp_name), 1216 1207 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1217 1208 IWL_CFG_MAC_TYPE_SC2F, IWL_CFG_ANY, 1218 1209 IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY, IWL_CFG_ANY, 1219 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1210 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1220 1211 iwl_cfg_sc2f, iwl_ax211_name), 1221 1212 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1222 1213 IWL_CFG_MAC_TYPE_SC2F, IWL_CFG_ANY, 1223 1214 IWL_CFG_RF_TYPE_FM, IWL_CFG_ANY, IWL_CFG_ANY, 1224 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1215 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1225 1216 iwl_cfg_sc2f, iwl_fm_name), 1226 1217 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1227 1218 IWL_CFG_MAC_TYPE_SC2F, IWL_CFG_ANY, 1228 1219 IWL_CFG_RF_TYPE_WH, IWL_CFG_ANY, IWL_CFG_ANY, 1229 - IWL_CFG_BW_NO_LIM, IWL_CFG_ANY, IWL_CFG_ANY, 1220 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1230 1221 iwl_cfg_sc2f, iwl_wh_name), 1231 - _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1232 - IWL_CFG_MAC_TYPE_SC2F, IWL_CFG_ANY, 1233 - IWL_CFG_RF_TYPE_WH, IWL_CFG_ANY, IWL_CFG_ANY, 1234 - 160, IWL_CFG_ANY, IWL_CFG_ANY, 1235 - iwl_cfg_sc2f, iwl_sp_name), 1236 1222 1237 1223 /* Dr */ 1238 1224 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1239 1225 IWL_CFG_MAC_TYPE_DR, IWL_CFG_ANY, 1240 1226 IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1241 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1227 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1242 1228 iwl_cfg_dr, iwl_dr_name), 1243 1229 1244 1230 /* Br */ 1245 1231 _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, 1246 1232 IWL_CFG_MAC_TYPE_BR, IWL_CFG_ANY, 1247 1233 IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1248 - IWL_CFG_BW_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1234 + IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_ANY, 1249 1235 iwl_cfg_br, iwl_br_name), 1250 1236 #endif /* CONFIG_IWLMLD */ 1251 1237 }; ··· 1382 1398 VISIBLE_IF_IWLWIFI_KUNIT const struct iwl_dev_info * 1383 1399 iwl_pci_find_dev_info(u16 device, u16 subsystem_device, 1384 1400 u16 mac_type, u8 mac_step, u16 rf_type, u8 cdb, 1385 - u8 jacket, u8 rf_id, u8 bw_limit, u8 cores, u8 rf_step) 1401 + u8 jacket, u8 rf_id, u8 no_160, u8 cores, u8 rf_step) 1386 1402 { 1387 1403 int num_devices = ARRAY_SIZE(iwl_dev_info_table); 1388 1404 int i; ··· 1425 1441 dev_info->rf_id != rf_id) 1426 1442 continue; 1427 1443 1428 - /* 1429 - * Check that bw_limit have the same "boolean" value since 1430 - * IWL_SUBDEVICE_BW_LIM can only return a boolean value and 1431 - * dev_info->bw_limit encodes a non-boolean value. 1432 - * dev_info->bw_limit == IWL_CFG_BW_NO_LIM must be equal to 1433 - * !bw_limit to have a match. 1434 - */ 1435 - if (dev_info->bw_limit != IWL_CFG_BW_ANY && 1436 - (dev_info->bw_limit == IWL_CFG_BW_NO_LIM) == !!bw_limit) 1444 + if (dev_info->no_160 != (u8)IWL_CFG_ANY && 1445 + dev_info->no_160 != no_160) 1437 1446 continue; 1438 1447 1439 1448 if (dev_info->cores != (u8)IWL_CFG_ANY && ··· 1564 1587 CSR_HW_RFID_IS_CDB(iwl_trans->hw_rf_id), 1565 1588 CSR_HW_RFID_IS_JACKET(iwl_trans->hw_rf_id), 1566 1589 IWL_SUBDEVICE_RF_ID(pdev->subsystem_device), 1567 - IWL_SUBDEVICE_BW_LIM(pdev->subsystem_device), 1590 + IWL_SUBDEVICE_NO_160(pdev->subsystem_device), 1568 1591 IWL_SUBDEVICE_CORES(pdev->subsystem_device), 1569 1592 CSR_HW_RFID_STEP(iwl_trans->hw_rf_id)); 1570 1593 if (dev_info) { 1571 1594 iwl_trans->cfg = dev_info->cfg; 1572 1595 iwl_trans->name = dev_info->name; 1573 - iwl_trans->bw_limit = dev_info->bw_limit; 1596 + iwl_trans->no_160 = dev_info->no_160 == IWL_CFG_NO_160; 1574 1597 } 1575 1598 1576 1599 #if IS_ENABLED(CONFIG_IWLMVM) ··· 1736 1759 * Scratch value was altered, this means the device was powered off, we 1737 1760 * need to reset it completely. 1738 1761 * Note: MAC (bits 0:7) will be cleared upon suspend even with wowlan, 1739 - * so assume that any bits there mean that the device is usable. 1762 + * but not bits [15:8]. So if we have bits set in lower word, assume 1763 + * the device is alive. 1764 + * For older devices, just try silently to grab the NIC. 1740 1765 */ 1741 - if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ && 1742 - !iwl_read32(trans, CSR_FUNC_SCRATCH)) 1743 - device_was_powered_off = true; 1766 + if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) { 1767 + if (!(iwl_read32(trans, CSR_FUNC_SCRATCH) & 1768 + CSR_FUNC_SCRATCH_POWER_OFF_MASK)) 1769 + device_was_powered_off = true; 1770 + } else { 1771 + /* 1772 + * bh are re-enabled by iwl_trans_pcie_release_nic_access, 1773 + * so re-enable them if _iwl_trans_pcie_grab_nic_access fails. 1774 + */ 1775 + local_bh_disable(); 1776 + if (_iwl_trans_pcie_grab_nic_access(trans, true)) { 1777 + iwl_trans_pcie_release_nic_access(trans); 1778 + } else { 1779 + device_was_powered_off = true; 1780 + local_bh_enable(); 1781 + } 1782 + } 1744 1783 1745 1784 if (restore || device_was_powered_off) { 1746 1785 trans->state = IWL_TRANS_NO_FW;
+5 -4
drivers/net/wireless/intel/iwlwifi/pcie/internal.h
··· 558 558 void iwl_trans_pcie_free_pnvm_dram_regions(struct iwl_dram_regions *dram_regions, 559 559 struct device *dev); 560 560 561 - bool __iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans); 562 - #define _iwl_trans_pcie_grab_nic_access(trans) \ 561 + bool __iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans, bool silent); 562 + #define _iwl_trans_pcie_grab_nic_access(trans, silent) \ 563 563 __cond_lock(nic_access_nobh, \ 564 - likely(__iwl_trans_pcie_grab_nic_access(trans))) 564 + likely(__iwl_trans_pcie_grab_nic_access(trans, silent))) 565 565 566 566 void iwl_trans_pcie_check_product_reset_status(struct pci_dev *pdev); 567 567 void iwl_trans_pcie_check_product_reset_mode(struct pci_dev *pdev); ··· 1105 1105 int iwl_trans_pcie_read_config32(struct iwl_trans *trans, u32 ofs, 1106 1106 u32 *val); 1107 1107 bool iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans); 1108 - void iwl_trans_pcie_release_nic_access(struct iwl_trans *trans); 1108 + void __releases(nic_access_nobh) 1109 + iwl_trans_pcie_release_nic_access(struct iwl_trans *trans); 1109 1110 1110 1111 /* transport gen 1 exported functions */ 1111 1112 void iwl_trans_pcie_fw_alive(struct iwl_trans *trans, u32 scd_addr);
+12 -4
drivers/net/wireless/intel/iwlwifi/pcie/trans.c
··· 2351 2351 struct iwl_trans_pcie_removal *removal; 2352 2352 char _msg = 0, *msg = &_msg; 2353 2353 2354 - if (WARN_ON(mode < IWL_RESET_MODE_REMOVE_ONLY)) 2354 + if (WARN_ON(mode < IWL_RESET_MODE_REMOVE_ONLY || 2355 + mode == IWL_RESET_MODE_BACKOFF)) 2355 2356 return; 2356 2357 2357 2358 if (test_bit(STATUS_TRANS_DEAD, &trans->status)) ··· 2406 2405 * This version doesn't disable BHs but rather assumes they're 2407 2406 * already disabled. 2408 2407 */ 2409 - bool __iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans) 2408 + bool __iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans, bool silent) 2410 2409 { 2411 2410 int ret; 2412 2411 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); ··· 2458 2457 if (unlikely(ret < 0)) { 2459 2458 u32 cntrl = iwl_read32(trans, CSR_GP_CNTRL); 2460 2459 2460 + if (silent) { 2461 + spin_unlock(&trans_pcie->reg_lock); 2462 + return false; 2463 + } 2464 + 2461 2465 WARN_ONCE(1, 2462 2466 "Timeout waiting for hardware access (CSR_GP_CNTRL 0x%08x)\n", 2463 2467 cntrl); ··· 2494 2488 bool ret; 2495 2489 2496 2490 local_bh_disable(); 2497 - ret = __iwl_trans_pcie_grab_nic_access(trans); 2491 + ret = __iwl_trans_pcie_grab_nic_access(trans, false); 2498 2492 if (ret) { 2499 2493 /* keep BHs disabled until iwl_trans_pcie_release_nic_access */ 2500 2494 return ret; ··· 2503 2497 return false; 2504 2498 } 2505 2499 2506 - void iwl_trans_pcie_release_nic_access(struct iwl_trans *trans) 2500 + void __releases(nic_access_nobh) 2501 + iwl_trans_pcie_release_nic_access(struct iwl_trans *trans) 2507 2502 { 2508 2503 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 2509 2504 ··· 2531 2524 * scheduled on different CPUs (after we drop reg_lock). 2532 2525 */ 2533 2526 out: 2527 + __release(nic_access_nobh); 2534 2528 spin_unlock_bh(&trans_pcie->reg_lock); 2535 2529 } 2536 2530
+1 -1
drivers/net/wireless/intel/iwlwifi/pcie/tx.c
··· 1021 1021 * returned. This needs to be done only on NICs that have 1022 1022 * apmg_wake_up_wa set (see above.) 1023 1023 */ 1024 - if (!_iwl_trans_pcie_grab_nic_access(trans)) 1024 + if (!_iwl_trans_pcie_grab_nic_access(trans, false)) 1025 1025 return -EIO; 1026 1026 1027 1027 /*
+5 -10
drivers/net/wireless/intel/iwlwifi/tests/devinfo.c
··· 2 2 /* 3 3 * KUnit tests for the iwlwifi device info table 4 4 * 5 - * Copyright (C) 2023-2025 Intel Corporation 5 + * Copyright (C) 2023-2024 Intel Corporation 6 6 */ 7 7 #include <kunit/test.h> 8 8 #include <linux/pci.h> ··· 13 13 14 14 static void iwl_pci_print_dev_info(const char *pfx, const struct iwl_dev_info *di) 15 15 { 16 - printk(KERN_DEBUG "%sdev=%.4x,subdev=%.4x,mac_type=%.4x,mac_step=%.4x,rf_type=%.4x,cdb=%d,jacket=%d,rf_id=%.2x,bw_limit=%d,cores=%.2x\n", 16 + printk(KERN_DEBUG "%sdev=%.4x,subdev=%.4x,mac_type=%.4x,mac_step=%.4x,rf_type=%.4x,cdb=%d,jacket=%d,rf_id=%.2x,no_160=%d,cores=%.2x\n", 17 17 pfx, di->device, di->subdevice, di->mac_type, di->mac_step, 18 - di->rf_type, di->cdb, di->jacket, di->rf_id, di->bw_limit, 18 + di->rf_type, di->cdb, di->jacket, di->rf_id, di->no_160, 19 19 di->cores); 20 20 } 21 21 ··· 31 31 di->mac_type, di->mac_step, 32 32 di->rf_type, di->cdb, 33 33 di->jacket, di->rf_id, 34 - di->bw_limit != IWL_CFG_BW_NO_LIM, 35 - di->cores, di->rf_step); 36 - if (!ret) { 37 - iwl_pci_print_dev_info("No entry found for: ", di); 38 - KUNIT_FAIL(test, 39 - "No entry found for entry at index %d\n", idx); 40 - } else if (ret != di) { 34 + di->no_160, di->cores, di->rf_step); 35 + if (ret != di) { 41 36 iwl_pci_print_dev_info("searched: ", di); 42 37 iwl_pci_print_dev_info("found: ", ret); 43 38 KUNIT_FAIL(test,
-1
drivers/net/wireless/purelifi/plfxlc/mac.c
··· 102 102 void plfxlc_mac_release(struct plfxlc_mac *mac) 103 103 { 104 104 plfxlc_chip_release(&mac->chip); 105 - lockdep_assert_held(&mac->lock); 106 105 } 107 106 108 107 int plfxlc_op_start(struct ieee80211_hw *hw)
+13 -6
drivers/net/xen-netfront.c
··· 985 985 act = bpf_prog_run_xdp(prog, xdp); 986 986 switch (act) { 987 987 case XDP_TX: 988 - get_page(pdata); 989 988 xdpf = xdp_convert_buff_to_frame(xdp); 990 - err = xennet_xdp_xmit(queue->info->netdev, 1, &xdpf, 0); 991 - if (unlikely(!err)) 992 - xdp_return_frame_rx_napi(xdpf); 993 - else if (unlikely(err < 0)) 989 + if (unlikely(!xdpf)) { 994 990 trace_xdp_exception(queue->info->netdev, prog, act); 991 + break; 992 + } 993 + get_page(pdata); 994 + err = xennet_xdp_xmit(queue->info->netdev, 1, &xdpf, 0); 995 + if (unlikely(err <= 0)) { 996 + if (err < 0) 997 + trace_xdp_exception(queue->info->netdev, prog, act); 998 + xdp_return_frame_rx_napi(xdpf); 999 + } 995 1000 break; 996 1001 case XDP_REDIRECT: 997 1002 get_page(pdata); 998 1003 err = xdp_do_redirect(queue->info->netdev, xdp, prog); 999 1004 *need_xdp_flush = true; 1000 - if (unlikely(err)) 1005 + if (unlikely(err)) { 1001 1006 trace_xdp_exception(queue->info->netdev, prog, act); 1007 + xdp_return_buff(xdp); 1008 + } 1002 1009 break; 1003 1010 case XDP_PASS: 1004 1011 case XDP_DROP:
+1 -1
drivers/nvme/host/core.c
··· 4300 4300 if (test_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events)) 4301 4301 nvme_queue_scan(ctrl); 4302 4302 #ifdef CONFIG_NVME_MULTIPATH 4303 - else 4303 + else if (ctrl->ana_log_buf) 4304 4304 /* Re-read the ANA log page to not miss updates */ 4305 4305 queue_work(nvme_wq, &ctrl->ana_work); 4306 4306 #endif
+7 -7
drivers/nvme/host/multipath.c
··· 1051 1051 1052 1052 list_for_each_entry_rcu(ns, &head->list, siblings) { 1053 1053 /* 1054 + * Ensure that ns path disk node is already added otherwise we 1055 + * may get invalid kobj name for target 1056 + */ 1057 + if (!test_bit(GD_ADDED, &ns->disk->state)) 1058 + continue; 1059 + 1060 + /* 1054 1061 * Avoid creating link if it already exists for the given path. 1055 1062 * When path ana state transitions from optimized to non- 1056 1063 * optimized or vice-versa, the nvme_mpath_set_live() is ··· 1070 1063 * against multiple nvme paths being simultaneously added. 1071 1064 */ 1072 1065 if (test_and_set_bit(NVME_NS_SYSFS_ATTR_LINK, &ns->flags)) 1073 - continue; 1074 - 1075 - /* 1076 - * Ensure that ns path disk node is already added otherwise we 1077 - * may get invalid kobj name for target 1078 - */ 1079 - if (!test_bit(GD_ADDED, &ns->disk->state)) 1080 1066 continue; 1081 1067 1082 1068 target = disk_to_dev(ns->disk);
+1 -1
drivers/nvme/target/auth.c
··· 240 240 { 241 241 cancel_delayed_work(&sq->auth_expired_work); 242 242 #ifdef CONFIG_NVME_TARGET_TCP_TLS 243 - sq->tls_key = 0; 243 + sq->tls_key = NULL; 244 244 #endif 245 245 kfree(sq->dhchap_c1); 246 246 sq->dhchap_c1 = NULL;
+58 -30
drivers/nvme/target/pci-epf.c
··· 1648 1648 { 1649 1649 struct nvmet_pci_epf_iod *iod; 1650 1650 int ret, n = 0; 1651 + u16 head = sq->head; 1651 1652 1652 1653 sq->tail = nvmet_pci_epf_bar_read32(ctrl, sq->db); 1653 - while (sq->head != sq->tail && (!ctrl->sq_ab || n < ctrl->sq_ab)) { 1654 + while (head != sq->tail && (!ctrl->sq_ab || n < ctrl->sq_ab)) { 1654 1655 iod = nvmet_pci_epf_alloc_iod(sq); 1655 1656 if (!iod) 1656 1657 break; 1657 1658 1658 1659 /* Get the NVMe command submitted by the host. */ 1659 1660 ret = nvmet_pci_epf_transfer(ctrl, &iod->cmd, 1660 - sq->pci_addr + sq->head * sq->qes, 1661 + sq->pci_addr + head * sq->qes, 1661 1662 sq->qes, DMA_FROM_DEVICE); 1662 1663 if (ret) { 1663 1664 /* Not much we can do... */ ··· 1667 1666 } 1668 1667 1669 1668 dev_dbg(ctrl->dev, "SQ[%u]: head %u, tail %u, command %s\n", 1670 - sq->qid, sq->head, sq->tail, 1669 + sq->qid, head, sq->tail, 1671 1670 nvmet_pci_epf_iod_name(iod)); 1672 1671 1673 - sq->head++; 1674 - if (sq->head == sq->depth) 1675 - sq->head = 0; 1672 + head++; 1673 + if (head == sq->depth) 1674 + head = 0; 1675 + WRITE_ONCE(sq->head, head); 1676 1676 n++; 1677 1677 1678 1678 queue_work_on(WORK_CPU_UNBOUND, sq->iod_wq, &iod->work); ··· 1763 1761 if (!iod) 1764 1762 break; 1765 1763 1766 - /* Post the IOD completion entry. */ 1764 + /* 1765 + * Post the IOD completion entry. If the IOD request was 1766 + * executed (req->execute() called), the CQE is already 1767 + * initialized. However, the IOD may have been failed before 1768 + * that, leaving the CQE not properly initialized. So always 1769 + * initialize it here. 1770 + */ 1767 1771 cqe = &iod->cqe; 1772 + cqe->sq_head = cpu_to_le16(READ_ONCE(iod->sq->head)); 1773 + cqe->sq_id = cpu_to_le16(iod->sq->qid); 1774 + cqe->command_id = iod->cmd.common.command_id; 1768 1775 cqe->status = cpu_to_le16((iod->status << 1) | cq->phase); 1769 1776 1770 1777 dev_dbg(ctrl->dev, ··· 1809 1798 if (ret < 0) 1810 1799 queue_delayed_work(system_highpri_wq, &cq->work, 1811 1800 NVMET_PCI_EPF_CQ_RETRY_INTERVAL); 1801 + } 1802 + 1803 + static void nvmet_pci_epf_clear_ctrl_config(struct nvmet_pci_epf_ctrl *ctrl) 1804 + { 1805 + struct nvmet_ctrl *tctrl = ctrl->tctrl; 1806 + 1807 + /* Initialize controller status. */ 1808 + tctrl->csts = 0; 1809 + ctrl->csts = 0; 1810 + nvmet_pci_epf_bar_write32(ctrl, NVME_REG_CSTS, ctrl->csts); 1811 + 1812 + /* Initialize controller configuration and start polling. */ 1813 + tctrl->cc = 0; 1814 + ctrl->cc = 0; 1815 + nvmet_pci_epf_bar_write32(ctrl, NVME_REG_CC, ctrl->cc); 1812 1816 } 1813 1817 1814 1818 static int nvmet_pci_epf_enable_ctrl(struct nvmet_pci_epf_ctrl *ctrl) ··· 1891 1865 return 0; 1892 1866 1893 1867 err: 1894 - ctrl->csts = 0; 1868 + nvmet_pci_epf_clear_ctrl_config(ctrl); 1895 1869 return -EINVAL; 1896 1870 } 1897 1871 1898 - static void nvmet_pci_epf_disable_ctrl(struct nvmet_pci_epf_ctrl *ctrl) 1872 + static void nvmet_pci_epf_disable_ctrl(struct nvmet_pci_epf_ctrl *ctrl, 1873 + bool shutdown) 1899 1874 { 1900 1875 int qid; 1901 1876 1902 1877 if (!ctrl->enabled) 1903 1878 return; 1904 1879 1905 - dev_info(ctrl->dev, "Disabling controller\n"); 1880 + dev_info(ctrl->dev, "%s controller\n", 1881 + shutdown ? "Shutting down" : "Disabling"); 1906 1882 1907 1883 ctrl->enabled = false; 1908 1884 cancel_delayed_work_sync(&ctrl->poll_sqs); ··· 1921 1893 nvmet_pci_epf_delete_cq(ctrl->tctrl, 0); 1922 1894 1923 1895 ctrl->csts &= ~NVME_CSTS_RDY; 1896 + if (shutdown) { 1897 + ctrl->csts |= NVME_CSTS_SHST_CMPLT; 1898 + ctrl->cc &= ~NVME_CC_ENABLE; 1899 + nvmet_pci_epf_bar_write32(ctrl, NVME_REG_CC, ctrl->cc); 1900 + } 1924 1901 } 1925 1902 1926 1903 static void nvmet_pci_epf_poll_cc_work(struct work_struct *work) ··· 1952 1919 } 1953 1920 1954 1921 if (!nvmet_cc_en(new_cc) && nvmet_cc_en(old_cc)) 1955 - nvmet_pci_epf_disable_ctrl(ctrl); 1922 + nvmet_pci_epf_disable_ctrl(ctrl, false); 1956 1923 1957 - if (nvmet_cc_shn(new_cc) && !nvmet_cc_shn(old_cc)) { 1958 - nvmet_pci_epf_disable_ctrl(ctrl); 1959 - ctrl->csts |= NVME_CSTS_SHST_CMPLT; 1960 - } 1924 + if (nvmet_cc_shn(new_cc) && !nvmet_cc_shn(old_cc)) 1925 + nvmet_pci_epf_disable_ctrl(ctrl, true); 1961 1926 1962 1927 if (!nvmet_cc_shn(new_cc) && nvmet_cc_shn(old_cc)) 1963 1928 ctrl->csts &= ~NVME_CSTS_SHST_CMPLT; ··· 1994 1963 /* Clear Controller Memory Buffer Supported (CMBS). */ 1995 1964 ctrl->cap &= ~(0x1ULL << 57); 1996 1965 1997 - /* Controller configuration. */ 1998 - ctrl->cc = tctrl->cc & (~NVME_CC_ENABLE); 1999 - 2000 - /* Controller status. */ 2001 - ctrl->csts = ctrl->tctrl->csts; 2002 - 2003 1966 nvmet_pci_epf_bar_write64(ctrl, NVME_REG_CAP, ctrl->cap); 2004 1967 nvmet_pci_epf_bar_write32(ctrl, NVME_REG_VS, tctrl->subsys->ver); 2005 - nvmet_pci_epf_bar_write32(ctrl, NVME_REG_CSTS, ctrl->csts); 2006 - nvmet_pci_epf_bar_write32(ctrl, NVME_REG_CC, ctrl->cc); 1968 + 1969 + nvmet_pci_epf_clear_ctrl_config(ctrl); 2007 1970 } 2008 1971 2009 1972 static int nvmet_pci_epf_create_ctrl(struct nvmet_pci_epf *nvme_epf, ··· 2095 2070 2096 2071 static void nvmet_pci_epf_start_ctrl(struct nvmet_pci_epf_ctrl *ctrl) 2097 2072 { 2073 + 2074 + dev_info(ctrl->dev, "PCI link up\n"); 2075 + ctrl->link_up = true; 2076 + 2098 2077 schedule_delayed_work(&ctrl->poll_cc, NVMET_PCI_EPF_CC_POLL_INTERVAL); 2099 2078 } 2100 2079 2101 2080 static void nvmet_pci_epf_stop_ctrl(struct nvmet_pci_epf_ctrl *ctrl) 2102 2081 { 2082 + dev_info(ctrl->dev, "PCI link down\n"); 2083 + ctrl->link_up = false; 2084 + 2103 2085 cancel_delayed_work_sync(&ctrl->poll_cc); 2104 2086 2105 - nvmet_pci_epf_disable_ctrl(ctrl); 2087 + nvmet_pci_epf_disable_ctrl(ctrl, false); 2088 + nvmet_pci_epf_clear_ctrl_config(ctrl); 2106 2089 } 2107 2090 2108 2091 static void nvmet_pci_epf_destroy_ctrl(struct nvmet_pci_epf_ctrl *ctrl) ··· 2333 2300 if (ret) 2334 2301 goto out_clear_bar; 2335 2302 2336 - if (!epc_features->linkup_notifier) { 2337 - ctrl->link_up = true; 2303 + if (!epc_features->linkup_notifier) 2338 2304 nvmet_pci_epf_start_ctrl(&nvme_epf->ctrl); 2339 - } 2340 2305 2341 2306 return 0; 2342 2307 ··· 2350 2319 struct nvmet_pci_epf *nvme_epf = epf_get_drvdata(epf); 2351 2320 struct nvmet_pci_epf_ctrl *ctrl = &nvme_epf->ctrl; 2352 2321 2353 - ctrl->link_up = false; 2354 2322 nvmet_pci_epf_destroy_ctrl(ctrl); 2355 2323 2356 2324 nvmet_pci_epf_deinit_dma(nvme_epf); ··· 2361 2331 struct nvmet_pci_epf *nvme_epf = epf_get_drvdata(epf); 2362 2332 struct nvmet_pci_epf_ctrl *ctrl = &nvme_epf->ctrl; 2363 2333 2364 - ctrl->link_up = true; 2365 2334 nvmet_pci_epf_start_ctrl(ctrl); 2366 2335 2367 2336 return 0; ··· 2371 2342 struct nvmet_pci_epf *nvme_epf = epf_get_drvdata(epf); 2372 2343 struct nvmet_pci_epf_ctrl *ctrl = &nvme_epf->ctrl; 2373 2344 2374 - ctrl->link_up = false; 2375 2345 nvmet_pci_epf_stop_ctrl(ctrl); 2376 2346 2377 2347 return 0;
+3
drivers/pci/msi/msi.c
··· 615 615 void __iomem *addr = pci_msix_desc_addr(desc); 616 616 617 617 desc->pci.msi_attrib.can_mask = 1; 618 + /* Workaround for SUN NIU insanity, which requires write before read */ 619 + if (dev->dev_flags & PCI_DEV_FLAGS_MSIX_TOUCH_ENTRY_DATA_FIRST) 620 + writel(0, addr + PCI_MSIX_ENTRY_DATA); 618 621 desc->pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL); 619 622 } 620 623 }
-4
drivers/pci/pci.c
··· 5429 5429 return false; 5430 5430 5431 5431 list_for_each_entry(dev, &bus->devices, bus_list) { 5432 - if (!pci_reset_supported(dev)) 5433 - return false; 5434 5432 if (dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET || 5435 5433 (dev->subordinate && !pci_bus_resettable(dev->subordinate))) 5436 5434 return false; ··· 5505 5507 list_for_each_entry(dev, &slot->bus->devices, bus_list) { 5506 5508 if (!dev->slot || dev->slot != slot) 5507 5509 continue; 5508 - if (!pci_reset_supported(dev)) 5509 - return false; 5510 5510 if (dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET || 5511 5511 (dev->subordinate && !pci_bus_resettable(dev->subordinate))) 5512 5512 return false;
+1 -1
drivers/power/supply/power_supply_sysfs.c
··· 33 33 [POWER_SUPPLY_PROP_ ## _name] = \ 34 34 { \ 35 35 .prop_name = #_name, \ 36 - .attr_name = #_name "\0", \ 36 + .attr_name = #_name, \ 37 37 .text_values = _text, \ 38 38 .text_values_len = _len, \ 39 39 }
+4 -1
drivers/spi/spi-imx.c
··· 1695 1695 struct spi_device *spi, 1696 1696 struct spi_transfer *transfer) 1697 1697 { 1698 + int ret; 1698 1699 struct spi_imx_data *spi_imx = spi_controller_get_devdata(spi->controller); 1699 1700 1700 - spi_imx_setupxfer(spi, transfer); 1701 + ret = spi_imx_setupxfer(spi, transfer); 1702 + if (ret < 0) 1703 + return ret; 1701 1704 transfer->effective_speed_hz = spi_imx->spi_bus_clk; 1702 1705 1703 1706 /* flush rxfifo before transfer */
+1
drivers/spi/spi-sun4i.c
··· 462 462 sspi->host = host; 463 463 host->max_speed_hz = 100 * 1000 * 1000; 464 464 host->min_speed_hz = 3 * 1000; 465 + host->use_gpio_descriptors = true; 465 466 host->set_cs = sun4i_spi_set_cs; 466 467 host->transfer_one = sun4i_spi_transfer_one; 467 468 host->num_chipselect = 4;
+3 -3
drivers/spi/spi-tegra210-quad.c
··· 1117 1117 (&tqspi->xfer_completion, 1118 1118 QSPI_DMA_TIMEOUT); 1119 1119 1120 - if (WARN_ON(ret == 0)) { 1121 - dev_err(tqspi->dev, "QSPI Transfer failed with timeout: %d\n", 1122 - ret); 1120 + if (WARN_ON_ONCE(ret == 0)) { 1121 + dev_err_ratelimited(tqspi->dev, 1122 + "QSPI Transfer failed with timeout\n"); 1123 1123 if (tqspi->is_curr_dma_xfer && 1124 1124 (tqspi->cur_direction & DATA_DIR_TX)) 1125 1125 dmaengine_terminate_all
+4 -3
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
··· 485 485 { PCI_DEVICE_DATA(INTEL, ADL_THERMAL, PROC_THERMAL_FEATURE_RAPL | 486 486 PROC_THERMAL_FEATURE_FIVR | PROC_THERMAL_FEATURE_DVFS | PROC_THERMAL_FEATURE_WT_REQ) }, 487 487 { PCI_DEVICE_DATA(INTEL, LNLM_THERMAL, PROC_THERMAL_FEATURE_MSI_SUPPORT | 488 - PROC_THERMAL_FEATURE_RAPL | PROC_THERMAL_FEATURE_DLVR | 488 + PROC_THERMAL_FEATURE_RAPL | PROC_THERMAL_FEATURE_DLVR | PROC_THERMAL_FEATURE_DVFS | 489 489 PROC_THERMAL_FEATURE_WT_HINT | PROC_THERMAL_FEATURE_POWER_FLOOR) }, 490 490 { PCI_DEVICE_DATA(INTEL, MTLP_THERMAL, PROC_THERMAL_FEATURE_RAPL | 491 491 PROC_THERMAL_FEATURE_FIVR | PROC_THERMAL_FEATURE_DVFS | PROC_THERMAL_FEATURE_DLVR | ··· 495 495 { PCI_DEVICE_DATA(INTEL, RPL_THERMAL, PROC_THERMAL_FEATURE_RAPL | 496 496 PROC_THERMAL_FEATURE_FIVR | PROC_THERMAL_FEATURE_DVFS | PROC_THERMAL_FEATURE_WT_REQ) }, 497 497 { PCI_DEVICE_DATA(INTEL, PTL_THERMAL, PROC_THERMAL_FEATURE_RAPL | 498 - PROC_THERMAL_FEATURE_DLVR | PROC_THERMAL_FEATURE_MSI_SUPPORT | 499 - PROC_THERMAL_FEATURE_WT_HINT | PROC_THERMAL_FEATURE_POWER_FLOOR) }, 498 + PROC_THERMAL_FEATURE_DLVR | PROC_THERMAL_FEATURE_DVFS | 499 + PROC_THERMAL_FEATURE_MSI_SUPPORT | PROC_THERMAL_FEATURE_WT_HINT | 500 + PROC_THERMAL_FEATURE_POWER_FLOOR) }, 500 501 { }, 501 502 }; 502 503
+17 -16
drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c
··· 166 166 { 0, 0x5A40, 1, 0x1, 0}, /* rfi_disable */ 167 167 }; 168 168 169 + static const struct mapping_table *dlvr_mapping; 170 + static const struct mmio_reg *dlvr_mmio_regs_table; 171 + 169 172 #define RFIM_SHOW(suffix, table)\ 170 173 static ssize_t suffix##_show(struct device *dev,\ 171 174 struct device_attribute *attr,\ 172 175 char *buf)\ 173 176 {\ 174 - const struct mapping_table *mapping = NULL;\ 177 + const struct mmio_reg *mmio_regs = dlvr_mmio_regs_table;\ 178 + const struct mapping_table *mapping = dlvr_mapping;\ 175 179 struct proc_thermal_device *proc_priv;\ 176 180 struct pci_dev *pdev = to_pci_dev(dev);\ 177 - const struct mmio_reg *mmio_regs;\ 178 181 const char **match_strs;\ 179 182 int ret, err;\ 180 183 u32 reg_val;\ ··· 189 186 mmio_regs = adl_dvfs_mmio_regs;\ 190 187 } else if (table == 2) { \ 191 188 match_strs = (const char **)dlvr_strings;\ 192 - if (pdev->device == PCI_DEVICE_ID_INTEL_LNLM_THERMAL) {\ 193 - mmio_regs = lnl_dlvr_mmio_regs;\ 194 - mapping = lnl_dlvr_mapping;\ 195 - } else {\ 196 - mmio_regs = dlvr_mmio_regs;\ 197 - } \ 198 189 } else {\ 199 190 match_strs = (const char **)fivr_strings;\ 200 191 mmio_regs = tgl_fivr_mmio_regs;\ ··· 211 214 struct device_attribute *attr,\ 212 215 const char *buf, size_t count)\ 213 216 {\ 214 - const struct mapping_table *mapping = NULL;\ 217 + const struct mmio_reg *mmio_regs = dlvr_mmio_regs_table;\ 218 + const struct mapping_table *mapping = dlvr_mapping;\ 215 219 struct proc_thermal_device *proc_priv;\ 216 220 struct pci_dev *pdev = to_pci_dev(dev);\ 217 221 unsigned int input;\ 218 222 const char **match_strs;\ 219 - const struct mmio_reg *mmio_regs;\ 220 223 int ret, err;\ 221 224 u32 reg_val;\ 222 225 u32 mask;\ ··· 227 230 mmio_regs = adl_dvfs_mmio_regs;\ 228 231 } else if (table == 2) { \ 229 232 match_strs = (const char **)dlvr_strings;\ 230 - if (pdev->device == PCI_DEVICE_ID_INTEL_LNLM_THERMAL) {\ 231 - mmio_regs = lnl_dlvr_mmio_regs;\ 232 - mapping = lnl_dlvr_mapping;\ 233 - } else {\ 234 - mmio_regs = dlvr_mmio_regs;\ 235 - } \ 236 233 } else {\ 237 234 match_strs = (const char **)fivr_strings;\ 238 235 mmio_regs = tgl_fivr_mmio_regs;\ ··· 439 448 } 440 449 441 450 if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_DLVR) { 451 + switch (pdev->device) { 452 + case PCI_DEVICE_ID_INTEL_LNLM_THERMAL: 453 + case PCI_DEVICE_ID_INTEL_PTL_THERMAL: 454 + dlvr_mmio_regs_table = lnl_dlvr_mmio_regs; 455 + dlvr_mapping = lnl_dlvr_mapping; 456 + break; 457 + default: 458 + dlvr_mmio_regs_table = dlvr_mmio_regs; 459 + break; 460 + } 442 461 ret = sysfs_create_group(&pdev->dev.kobj, &dlvr_attribute_group); 443 462 if (ret) 444 463 return ret;
+1 -1
drivers/vfio/pci/vfio_pci_config.c
··· 1815 1815 } 1816 1816 1817 1817 if (!IS_ENABLED(CONFIG_VFIO_PCI_INTX) || vdev->nointx || 1818 - vdev->pdev->irq == IRQ_NOTCONNECTED) 1818 + !vdev->pdev->irq || vdev->pdev->irq == IRQ_NOTCONNECTED) 1819 1819 vconfig[PCI_INTERRUPT_PIN] = 0; 1820 1820 1821 1821 ret = vfio_cap_init(vdev);
+56 -18
drivers/vhost/scsi.c
··· 627 627 int ret; 628 628 629 629 llnode = llist_del_all(&svq->completion_list); 630 + 631 + mutex_lock(&svq->vq.mutex); 632 + 630 633 llist_for_each_entry_safe(cmd, t, llnode, tvc_completion_list) { 631 634 se_cmd = &cmd->tvc_se_cmd; 632 635 ··· 662 659 663 660 vhost_scsi_release_cmd_res(se_cmd); 664 661 } 662 + 663 + mutex_unlock(&svq->vq.mutex); 665 664 666 665 if (signal) 667 666 vhost_signal(&svq->vs->dev, &svq->vq); ··· 999 994 1000 995 static void 1001 996 vhost_scsi_send_status(struct vhost_scsi *vs, struct vhost_virtqueue *vq, 1002 - int head, unsigned int out, u8 status) 997 + struct vhost_scsi_ctx *vc, u8 status) 1003 998 { 1004 - struct virtio_scsi_cmd_resp __user *resp; 1005 999 struct virtio_scsi_cmd_resp rsp; 1000 + struct iov_iter iov_iter; 1006 1001 int ret; 1007 1002 1008 1003 memset(&rsp, 0, sizeof(rsp)); 1009 1004 rsp.status = status; 1010 - resp = vq->iov[out].iov_base; 1011 - ret = __copy_to_user(resp, &rsp, sizeof(rsp)); 1012 - if (!ret) 1013 - vhost_add_used_and_signal(&vs->dev, vq, head, 0); 1005 + 1006 + iov_iter_init(&iov_iter, ITER_DEST, &vq->iov[vc->out], vc->in, 1007 + sizeof(rsp)); 1008 + 1009 + ret = copy_to_iter(&rsp, sizeof(rsp), &iov_iter); 1010 + 1011 + if (likely(ret == sizeof(rsp))) 1012 + vhost_add_used_and_signal(&vs->dev, vq, vc->head, 0); 1014 1013 else 1015 1014 pr_err("Faulted on virtio_scsi_cmd_resp\n"); 1016 1015 } 1017 1016 1017 + #define TYPE_IO_CMD 0 1018 + #define TYPE_CTRL_TMF 1 1019 + #define TYPE_CTRL_AN 2 1020 + 1018 1021 static void 1019 1022 vhost_scsi_send_bad_target(struct vhost_scsi *vs, 1020 1023 struct vhost_virtqueue *vq, 1021 - int head, unsigned out) 1024 + struct vhost_scsi_ctx *vc, int type) 1022 1025 { 1023 - struct virtio_scsi_cmd_resp __user *resp; 1024 - struct virtio_scsi_cmd_resp rsp; 1026 + union { 1027 + struct virtio_scsi_cmd_resp cmd; 1028 + struct virtio_scsi_ctrl_tmf_resp tmf; 1029 + struct virtio_scsi_ctrl_an_resp an; 1030 + } rsp; 1031 + struct iov_iter iov_iter; 1032 + size_t rsp_size; 1025 1033 int ret; 1026 1034 1027 1035 memset(&rsp, 0, sizeof(rsp)); 1028 - rsp.response = VIRTIO_SCSI_S_BAD_TARGET; 1029 - resp = vq->iov[out].iov_base; 1030 - ret = __copy_to_user(resp, &rsp, sizeof(rsp)); 1031 - if (!ret) 1032 - vhost_add_used_and_signal(&vs->dev, vq, head, 0); 1036 + 1037 + if (type == TYPE_IO_CMD) { 1038 + rsp_size = sizeof(struct virtio_scsi_cmd_resp); 1039 + rsp.cmd.response = VIRTIO_SCSI_S_BAD_TARGET; 1040 + } else if (type == TYPE_CTRL_TMF) { 1041 + rsp_size = sizeof(struct virtio_scsi_ctrl_tmf_resp); 1042 + rsp.tmf.response = VIRTIO_SCSI_S_BAD_TARGET; 1043 + } else { 1044 + rsp_size = sizeof(struct virtio_scsi_ctrl_an_resp); 1045 + rsp.an.response = VIRTIO_SCSI_S_BAD_TARGET; 1046 + } 1047 + 1048 + iov_iter_init(&iov_iter, ITER_DEST, &vq->iov[vc->out], vc->in, 1049 + rsp_size); 1050 + 1051 + ret = copy_to_iter(&rsp, rsp_size, &iov_iter); 1052 + 1053 + if (likely(ret == rsp_size)) 1054 + vhost_add_used_and_signal(&vs->dev, vq, vc->head, 0); 1033 1055 else 1034 - pr_err("Faulted on virtio_scsi_cmd_resp\n"); 1056 + pr_err("Faulted on virtio scsi type=%d\n", type); 1035 1057 } 1036 1058 1037 1059 static int ··· 1422 1390 if (ret == -ENXIO) 1423 1391 break; 1424 1392 else if (ret == -EIO) 1425 - vhost_scsi_send_bad_target(vs, vq, vc.head, vc.out); 1393 + vhost_scsi_send_bad_target(vs, vq, &vc, TYPE_IO_CMD); 1426 1394 else if (ret == -ENOMEM) 1427 - vhost_scsi_send_status(vs, vq, vc.head, vc.out, 1395 + vhost_scsi_send_status(vs, vq, &vc, 1428 1396 SAM_STAT_TASK_SET_FULL); 1429 1397 } while (likely(!vhost_exceeds_weight(vq, ++c, 0))); 1430 1398 out: ··· 1464 1432 else 1465 1433 resp_code = VIRTIO_SCSI_S_FUNCTION_REJECTED; 1466 1434 1435 + mutex_lock(&tmf->svq->vq.mutex); 1467 1436 vhost_scsi_send_tmf_resp(tmf->vhost, &tmf->svq->vq, tmf->in_iovs, 1468 1437 tmf->vq_desc, &tmf->resp_iov, resp_code); 1438 + mutex_unlock(&tmf->svq->vq.mutex); 1439 + 1469 1440 vhost_scsi_release_tmf_res(tmf); 1470 1441 } 1471 1442 ··· 1658 1623 if (ret == -ENXIO) 1659 1624 break; 1660 1625 else if (ret == -EIO) 1661 - vhost_scsi_send_bad_target(vs, vq, vc.head, vc.out); 1626 + vhost_scsi_send_bad_target(vs, vq, &vc, 1627 + v_req.type == VIRTIO_SCSI_T_TMF ? 1628 + TYPE_CTRL_TMF : 1629 + TYPE_CTRL_AN); 1662 1630 } while (likely(!vhost_exceeds_weight(vq, ++c, 0))); 1663 1631 out: 1664 1632 mutex_unlock(&vq->mutex);
+6
drivers/virtio/virtio.c
··· 407 407 if (!drv) 408 408 return; 409 409 410 + /* If the driver has its own shutdown method, use that. */ 411 + if (drv->shutdown) { 412 + drv->shutdown(dev); 413 + return; 414 + } 415 + 410 416 /* 411 417 * Some devices get wedged if you kick them after they are 412 418 * reset. Mark all vqs as broken to make sure we don't.
+2 -2
drivers/virtio/virtio_pci_modern.c
··· 247 247 sg_init_one(&data_sg, get_data, sizeof(*get_data)); 248 248 sg_init_one(&result_sg, result, sizeof(*result)); 249 249 cmd.opcode = cpu_to_le16(VIRTIO_ADMIN_CMD_DEVICE_CAP_GET); 250 - cmd.group_type = cpu_to_le16(VIRTIO_ADMIN_GROUP_TYPE_SRIOV); 250 + cmd.group_type = cpu_to_le16(VIRTIO_ADMIN_GROUP_TYPE_SELF); 251 251 cmd.data_sg = &data_sg; 252 252 cmd.result_sg = &result_sg; 253 253 ret = vp_modern_admin_cmd_exec(virtio_dev, &cmd); ··· 305 305 306 306 sg_init_one(&result_sg, data, sizeof(*data)); 307 307 cmd.opcode = cpu_to_le16(VIRTIO_ADMIN_CMD_CAP_ID_LIST_QUERY); 308 - cmd.group_type = cpu_to_le16(VIRTIO_ADMIN_GROUP_TYPE_SRIOV); 308 + cmd.group_type = cpu_to_le16(VIRTIO_ADMIN_GROUP_TYPE_SELF); 309 309 cmd.result_sg = &result_sg; 310 310 311 311 ret = vp_modern_admin_cmd_exec(virtio_dev, &cmd);
+1 -1
drivers/virtio/virtio_ring.c
··· 2650 2650 struct vring_virtqueue *vq = to_vvq(_vq); 2651 2651 2652 2652 if (vq->event_triggered) 2653 - vq->event_triggered = false; 2653 + data_race(vq->event_triggered = false); 2654 2654 2655 2655 return vq->packed_ring ? virtqueue_enable_cb_delayed_packed(_vq) : 2656 2656 virtqueue_enable_cb_delayed_split(_vq);
+1
fs/Kconfig
··· 368 368 config LOCKD 369 369 tristate 370 370 depends on FILE_LOCKING 371 + select CRC32 371 372 select GRACE_PERIOD 372 373 373 374 config LOCKD_V4
+2
fs/bcachefs/bcachefs.h
··· 788 788 unsigned long errors_silent[BITS_TO_LONGS(BCH_FSCK_ERR_MAX)]; 789 789 u64 btrees_lost_data; 790 790 } sb; 791 + DARRAY(enum bcachefs_metadata_version) 792 + incompat_versions_requested; 791 793 792 794 #ifdef CONFIG_UNICODE 793 795 struct unicode_map *cf_encoding;
+1 -1
fs/bcachefs/btree_update_interior.c
··· 1221 1221 1222 1222 ret = bch2_disk_reservation_get(c, &as->disk_res, 1223 1223 (nr_nodes[0] + nr_nodes[1]) * btree_sectors(c), 1224 - c->opts.metadata_replicas, 1224 + READ_ONCE(c->opts.metadata_replicas), 1225 1225 disk_res_flags); 1226 1226 if (ret) 1227 1227 goto err;
+2 -1
fs/bcachefs/buckets.c
··· 37 37 void bch2_dev_usage_full_read_fast(struct bch_dev *ca, struct bch_dev_usage_full *usage) 38 38 { 39 39 memset(usage, 0, sizeof(*usage)); 40 - acc_u64s_percpu((u64 *) usage, (u64 __percpu *) ca->usage, dev_usage_u64s()); 40 + acc_u64s_percpu((u64 *) usage, (u64 __percpu *) ca->usage, 41 + sizeof(struct bch_dev_usage_full) / sizeof(u64)); 41 42 } 42 43 43 44 static u64 reserve_factor(u64 r)
-5
fs/bcachefs/buckets.h
··· 242 242 243 243 /* Filesystem usage: */ 244 244 245 - static inline unsigned dev_usage_u64s(void) 246 - { 247 - return sizeof(struct bch_dev_usage) / sizeof(u64); 248 - } 249 - 250 245 struct bch_fs_usage_short 251 246 bch2_fs_usage_read_short(struct bch_fs *); 252 247
+1 -1
fs/bcachefs/errcode.h
··· 287 287 x(EIO, mark_stripe) \ 288 288 x(EIO, stripe_reconstruct) \ 289 289 x(EIO, key_type_error) \ 290 - x(EIO, extent_poisened) \ 290 + x(EIO, extent_poisoned) \ 291 291 x(EIO, missing_indirect_extent) \ 292 292 x(EIO, invalidate_stripe_to_dev) \ 293 293 x(EIO, no_encryption_key) \
+1 -1
fs/bcachefs/extents.c
··· 139 139 struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); 140 140 141 141 if (bch2_bkey_extent_ptrs_flags(ptrs) & BIT_ULL(BCH_EXTENT_FLAG_poisoned)) 142 - return -BCH_ERR_extent_poisened; 142 + return -BCH_ERR_extent_poisoned; 143 143 144 144 rcu_read_lock(); 145 145 const union bch_extent_entry *entry;
+1 -1
fs/bcachefs/fs-ioctl.c
··· 69 69 if (ret < 0) 70 70 return ret; 71 71 72 - ret = bch2_request_incompat_feature(c,bcachefs_metadata_version_casefolding); 72 + ret = bch2_request_incompat_feature(c, bcachefs_metadata_version_casefolding); 73 73 if (ret) 74 74 return ret; 75 75
+43 -1
fs/bcachefs/fsck.c
··· 321 321 inode->bi_subvol == BCACHEFS_ROOT_SUBVOL) 322 322 return false; 323 323 324 + /* 325 + * Subvolume roots are special: older versions of subvolume roots may be 326 + * disconnected, it's only the newest version that matters. 327 + * 328 + * We only keep a single dirent pointing to a subvolume root, i.e. 329 + * older versions of snapshots will not have a different dirent pointing 330 + * to the same subvolume root. 331 + * 332 + * This is because dirents that point to subvolumes are only visible in 333 + * the parent subvolume - versioning is not needed - and keeping them 334 + * around would break fsck, because when we're crossing subvolumes we 335 + * don't have a consistent snapshot ID to do check the inode <-> dirent 336 + * relationships. 337 + * 338 + * Thus, a subvolume root that's been renamed after a snapshot will have 339 + * a disconnected older version - that's expected. 340 + * 341 + * Note that taking a snapshot always updates the root inode (to update 342 + * the dirent backpointer), so a subvolume root inode with 343 + * BCH_INODE_has_child_snapshot is never visible. 344 + */ 345 + if (inode->bi_subvol && 346 + (inode->bi_flags & BCH_INODE_has_child_snapshot)) 347 + return false; 348 + 324 349 return !inode->bi_dir && !(inode->bi_flags & BCH_INODE_unlinked); 325 350 } 326 351 ··· 1032 1007 if (ret && !bch2_err_matches(ret, ENOENT)) 1033 1008 return ret; 1034 1009 1010 + if ((ret || dirent_points_to_inode_nowarn(d, inode)) && 1011 + inode->bi_subvol && 1012 + (inode->bi_flags & BCH_INODE_has_child_snapshot)) { 1013 + /* Older version of a renamed subvolume root: we won't have a 1014 + * correct dirent for it. That's expected, see 1015 + * inode_should_reattach(). 1016 + * 1017 + * We don't clear the backpointer field when doing the rename 1018 + * because there might be arbitrarily many versions in older 1019 + * snapshots. 1020 + */ 1021 + inode->bi_dir = 0; 1022 + inode->bi_dir_offset = 0; 1023 + *write_inode = true; 1024 + goto out; 1025 + } 1026 + 1035 1027 if (fsck_err_on(ret, 1036 1028 trans, inode_points_to_missing_dirent, 1037 1029 "inode points to missing dirent\n%s", ··· 1069 1027 inode->bi_dir_offset = 0; 1070 1028 *write_inode = true; 1071 1029 } 1072 - 1030 + out: 1073 1031 ret = 0; 1074 1032 fsck_err: 1075 1033 bch2_trans_iter_exit(trans, &dirent_iter);
+15 -9
fs/bcachefs/io_read.c
··· 487 487 .inum = rbio->read_pos.inode, 488 488 }; 489 489 struct bch_io_failures failed = { .nr = 0 }; 490 + int orig_error = rbio->ret; 491 + 490 492 struct btree_trans *trans = bch2_trans_get(c); 491 493 492 494 trace_io_read_retry(&rbio->bio); ··· 521 519 if (ret) { 522 520 rbio->ret = ret; 523 521 rbio->bio.bi_status = BLK_STS_IOERR; 524 - } else { 522 + } else if (orig_error != -BCH_ERR_data_read_retry_csum_err_maybe_userspace && 523 + orig_error != -BCH_ERR_data_read_ptr_stale_race && 524 + !failed.nr) { 525 525 struct printbuf buf = PRINTBUF; 526 526 527 527 lockrestart_do(trans, ··· 1349 1345 1350 1346 bch2_trans_iter_exit(trans, &iter); 1351 1347 1352 - if (ret) { 1353 - struct printbuf buf = PRINTBUF; 1354 - lockrestart_do(trans, 1355 - bch2_inum_offset_err_msg_trans(trans, &buf, inum, 1356 - bvec_iter.bi_sector << 9)); 1357 - prt_printf(&buf, "read error: %s", bch2_err_str(ret)); 1358 - bch_err_ratelimited(c, "%s", buf.buf); 1359 - printbuf_exit(&buf); 1348 + if (unlikely(ret)) { 1349 + if (ret != -BCH_ERR_extent_poisoned) { 1350 + struct printbuf buf = PRINTBUF; 1351 + lockrestart_do(trans, 1352 + bch2_inum_offset_err_msg_trans(trans, &buf, inum, 1353 + bvec_iter.bi_sector << 9)); 1354 + prt_printf(&buf, "data read error: %s", bch2_err_str(ret)); 1355 + bch_err_ratelimited(c, "%s", buf.buf); 1356 + printbuf_exit(&buf); 1357 + } 1360 1358 1361 1359 rbio->bio.bi_status = BLK_STS_IOERR; 1362 1360 rbio->ret = ret;
+4 -1
fs/bcachefs/recovery.c
··· 1125 1125 * journal_res_get() will crash if called before this has 1126 1126 * set up the journal.pin FIFO and journal.cur pointer: 1127 1127 */ 1128 - bch2_fs_journal_start(&c->journal, 1); 1128 + ret = bch2_fs_journal_start(&c->journal, 1); 1129 + if (ret) 1130 + goto err; 1131 + 1129 1132 set_bit(BCH_FS_accounting_replay_done, &c->flags); 1130 1133 bch2_journal_set_replay_done(&c->journal); 1131 1134
+2 -2
fs/bcachefs/sb-errors_format.h
··· 290 290 x(btree_node_bkey_bad_u64s, 260, 0) \ 291 291 x(btree_node_topology_empty_interior_node, 261, 0) \ 292 292 x(btree_ptr_v2_min_key_bad, 262, 0) \ 293 - x(btree_root_unreadable_and_scan_found_nothing, 263, 0) \ 294 - x(snapshot_node_missing, 264, 0) \ 293 + x(btree_root_unreadable_and_scan_found_nothing, 263, FSCK_AUTOFIX) \ 294 + x(snapshot_node_missing, 264, FSCK_AUTOFIX) \ 295 295 x(dup_backpointer_to_bad_csum_extent, 265, 0) \ 296 296 x(btree_bitmap_not_marked, 266, FSCK_AUTOFIX) \ 297 297 x(sb_clean_entry_overrun, 267, 0) \
+18 -2
fs/bcachefs/super-io.c
··· 73 73 ? 0 74 74 : -BCH_ERR_may_not_use_incompat_feature; 75 75 76 + mutex_lock(&c->sb_lock); 76 77 if (!ret) { 77 - mutex_lock(&c->sb_lock); 78 78 SET_BCH_SB_VERSION_INCOMPAT(c->disk_sb.sb, 79 79 max(BCH_SB_VERSION_INCOMPAT(c->disk_sb.sb), version)); 80 80 bch2_write_super(c); 81 - mutex_unlock(&c->sb_lock); 81 + } else { 82 + darray_for_each(c->incompat_versions_requested, i) 83 + if (version == *i) 84 + goto out; 85 + 86 + darray_push(&c->incompat_versions_requested, version); 87 + struct printbuf buf = PRINTBUF; 88 + prt_str(&buf, "requested incompat feature "); 89 + bch2_version_to_text(&buf, version); 90 + prt_str(&buf, " currently not enabled"); 91 + prt_printf(&buf, "\n set version_upgrade=incompat to enable"); 92 + 93 + bch_notice(c, "%s", buf.buf); 94 + printbuf_exit(&buf); 82 95 } 96 + 97 + out: 98 + mutex_unlock(&c->sb_lock); 83 99 84 100 return ret; 85 101 }
+8 -1
fs/bcachefs/super.c
··· 589 589 free_percpu(c->online_reserved); 590 590 } 591 591 592 + darray_exit(&c->incompat_versions_requested); 592 593 darray_exit(&c->btree_roots_extra); 593 594 free_percpu(c->pcpu); 594 595 free_percpu(c->usage); ··· 1012 1011 prt_str(&p, first ? " opts=" : ","); 1013 1012 first = false; 1014 1013 bch2_opt_to_text(&p, c, c->disk_sb.sb, opt, v, OPT_SHOW_MOUNT_STYLE); 1014 + } 1015 + 1016 + if (c->sb.version_incompat_allowed != c->sb.version) { 1017 + prt_printf(&p, "\n allowing incompatible features above "); 1018 + bch2_version_to_text(&p, c->sb.version_incompat_allowed); 1015 1019 } 1016 1020 1017 1021 bch_info(c, "%s", p.buf); ··· 1763 1757 up_write(&c->state_lock); 1764 1758 return 0; 1765 1759 err: 1766 - if (ca->mi.state == BCH_MEMBER_STATE_rw && 1760 + if (test_bit(BCH_FS_rw, &c->flags) && 1761 + ca->mi.state == BCH_MEMBER_STATE_rw && 1767 1762 !percpu_ref_is_zero(&ca->io_ref[READ])) 1768 1763 __bch2_dev_read_write(c, ca); 1769 1764 up_write(&c->state_lock);
+7 -2
fs/btrfs/file.c
··· 2104 2104 * will always return true. 2105 2105 * So here we need to do extra page alignment for 2106 2106 * filemap_range_has_page(). 2107 + * 2108 + * And do not decrease page_lockend right now, as it can be 0. 2107 2109 */ 2108 2110 const u64 page_lockstart = round_up(lockstart, PAGE_SIZE); 2109 - const u64 page_lockend = round_down(lockend + 1, PAGE_SIZE) - 1; 2111 + const u64 page_lockend = round_down(lockend + 1, PAGE_SIZE); 2110 2112 2111 2113 while (1) { 2112 2114 truncate_pagecache_range(inode, lockstart, lockend); 2113 2115 2114 2116 lock_extent(&BTRFS_I(inode)->io_tree, lockstart, lockend, 2115 2117 cached_state); 2118 + /* The same page or adjacent pages. */ 2119 + if (page_lockend <= page_lockstart) 2120 + break; 2116 2121 /* 2117 2122 * We can't have ordered extents in the range, nor dirty/writeback 2118 2123 * pages, because we have locked the inode's VFS lock in exclusive ··· 2129 2124 * we do, unlock the range and retry. 2130 2125 */ 2131 2126 if (!filemap_range_has_page(inode->i_mapping, page_lockstart, 2132 - page_lockend)) 2127 + page_lockend - 1)) 2133 2128 break; 2134 2129 2135 2130 unlock_extent(&BTRFS_I(inode)->io_tree, lockstart, lockend,
+1 -1
fs/btrfs/relocation.c
··· 3803 3803 if (ret) { 3804 3804 if (inode) 3805 3805 iput(&inode->vfs_inode); 3806 - inode = ERR_PTR(ret); 3806 + return ERR_PTR(ret); 3807 3807 } 3808 3808 return &inode->vfs_inode; 3809 3809 }
+2 -2
fs/btrfs/subpage.c
··· 204 204 btrfs_blocks_per_folio(fs_info, folio); \ 205 205 \ 206 206 btrfs_subpage_assert(fs_info, folio, start, len); \ 207 - __start_bit = offset_in_page(start) >> fs_info->sectorsize_bits; \ 207 + __start_bit = offset_in_folio(folio, start) >> fs_info->sectorsize_bits; \ 208 208 __start_bit += blocks_per_folio * btrfs_bitmap_nr_##name; \ 209 209 __start_bit; \ 210 210 }) ··· 666 666 btrfs_blocks_per_folio(fs_info, folio); \ 667 667 const struct btrfs_subpage *subpage = folio_get_private(folio); \ 668 668 \ 669 - ASSERT(blocks_per_folio < BITS_PER_LONG); \ 669 + ASSERT(blocks_per_folio <= BITS_PER_LONG); \ 670 670 *dst = bitmap_read(subpage->bitmaps, \ 671 671 blocks_per_folio * btrfs_bitmap_nr_##name, \ 672 672 blocks_per_folio); \
+1 -1
fs/btrfs/tree-checker.c
··· 2235 2235 btrfs_err(fs_info, 2236 2236 "tree level mismatch detected, bytenr=%llu level expected=%u has=%u", 2237 2237 eb->start, check->level, found_level); 2238 - return -EIO; 2238 + return -EUCLEAN; 2239 2239 } 2240 2240 2241 2241 if (!check->has_first_key)
+16 -3
fs/btrfs/zoned.c
··· 1277 1277 1278 1278 static int btrfs_load_zone_info(struct btrfs_fs_info *fs_info, int zone_idx, 1279 1279 struct zone_info *info, unsigned long *active, 1280 - struct btrfs_chunk_map *map) 1280 + struct btrfs_chunk_map *map, bool new) 1281 1281 { 1282 1282 struct btrfs_dev_replace *dev_replace = &fs_info->dev_replace; 1283 1283 struct btrfs_device *device; ··· 1307 1307 return 0; 1308 1308 } 1309 1309 1310 + ASSERT(!new || btrfs_dev_is_empty_zone(device, info->physical)); 1311 + 1310 1312 /* This zone will be used for allocation, so mark this zone non-empty. */ 1311 1313 btrfs_dev_clear_zone_empty(device, info->physical); 1312 1314 ··· 1321 1319 * to determine the allocation offset within the zone. 1322 1320 */ 1323 1321 WARN_ON(!IS_ALIGNED(info->physical, fs_info->zone_size)); 1322 + 1323 + if (new) { 1324 + sector_t capacity; 1325 + 1326 + capacity = bdev_zone_capacity(device->bdev, info->physical >> SECTOR_SHIFT); 1327 + up_read(&dev_replace->rwsem); 1328 + info->alloc_offset = 0; 1329 + info->capacity = capacity << SECTOR_SHIFT; 1330 + 1331 + return 0; 1332 + } 1333 + 1324 1334 nofs_flag = memalloc_nofs_save(); 1325 1335 ret = btrfs_get_dev_zone(device, info->physical, &zone); 1326 1336 memalloc_nofs_restore(nofs_flag); ··· 1602 1588 } 1603 1589 1604 1590 for (i = 0; i < map->num_stripes; i++) { 1605 - ret = btrfs_load_zone_info(fs_info, i, &zone_info[i], active, map); 1591 + ret = btrfs_load_zone_info(fs_info, i, &zone_info[i], active, map, new); 1606 1592 if (ret) 1607 1593 goto out; 1608 1594 ··· 1673 1659 * stripe. 1674 1660 */ 1675 1661 cache->alloc_offset = cache->zone_capacity; 1676 - ret = 0; 1677 1662 } 1678 1663 1679 1664 out:
+1 -1
fs/cachefiles/key.c
··· 8 8 #include <linux/slab.h> 9 9 #include "internal.h" 10 10 11 - static const char cachefiles_charmap[64] = 11 + static const char cachefiles_charmap[64] __nonstring = 12 12 "0123456789" /* 0 - 9 */ 13 13 "abcdefghijklmnopqrstuvwxyz" /* 10 - 35 */ 14 14 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" /* 36 - 61 */
+1
fs/dax.c
··· 396 396 order = folio_order(folio); 397 397 if (!order) 398 398 return 0; 399 + folio_reset_order(folio); 399 400 400 401 for (i = 0; i < (1UL << order); i++) { 401 402 struct dev_pagemap *pgmap = page_pgmap(&folio->page);
+9 -1
fs/eventpoll.c
··· 1996 1996 return res; 1997 1997 } 1998 1998 1999 + static int ep_schedule_timeout(ktime_t *to) 2000 + { 2001 + if (to) 2002 + return ktime_after(*to, ktime_get()); 2003 + else 2004 + return 1; 2005 + } 2006 + 1999 2007 /** 2000 2008 * ep_poll - Retrieves ready events, and delivers them to the caller-supplied 2001 2009 * event buffer. ··· 2111 2103 2112 2104 write_unlock_irq(&ep->lock); 2113 2105 2114 - if (!eavail) 2106 + if (!eavail && ep_schedule_timeout(to)) 2115 2107 timed_out = !schedule_hrtimeout_range(to, slack, 2116 2108 HRTIMER_MODE_ABS); 2117 2109 __set_current_state(TASK_RUNNING);
+59 -24
fs/namei.c
··· 1665 1665 return dentry; 1666 1666 } 1667 1667 1668 - /* 1669 - * Parent directory has inode locked exclusive. This is one 1670 - * and only case when ->lookup() gets called on non in-lookup 1671 - * dentries - as the matter of fact, this only gets called 1672 - * when directory is guaranteed to have no in-lookup children 1673 - * at all. 1674 - * Will return -ENOENT if name isn't found and LOOKUP_CREATE wasn't passed. 1675 - * Will return -EEXIST if name is found and LOOKUP_EXCL was passed. 1676 - */ 1677 - struct dentry *lookup_one_qstr_excl(const struct qstr *name, 1678 - struct dentry *base, 1679 - unsigned int flags) 1668 + static struct dentry *lookup_one_qstr_excl_raw(const struct qstr *name, 1669 + struct dentry *base, 1670 + unsigned int flags) 1680 1671 { 1681 - struct dentry *dentry = lookup_dcache(name, base, flags); 1672 + struct dentry *dentry; 1682 1673 struct dentry *old; 1683 - struct inode *dir = base->d_inode; 1674 + struct inode *dir; 1684 1675 1676 + dentry = lookup_dcache(name, base, flags); 1685 1677 if (dentry) 1686 - goto found; 1678 + return dentry; 1687 1679 1688 1680 /* Don't create child dentry for a dead directory. */ 1681 + dir = base->d_inode; 1689 1682 if (unlikely(IS_DEADDIR(dir))) 1690 1683 return ERR_PTR(-ENOENT); 1691 1684 ··· 1691 1698 dput(dentry); 1692 1699 dentry = old; 1693 1700 } 1694 - found: 1701 + return dentry; 1702 + } 1703 + 1704 + /* 1705 + * Parent directory has inode locked exclusive. This is one 1706 + * and only case when ->lookup() gets called on non in-lookup 1707 + * dentries - as the matter of fact, this only gets called 1708 + * when directory is guaranteed to have no in-lookup children 1709 + * at all. 1710 + * Will return -ENOENT if name isn't found and LOOKUP_CREATE wasn't passed. 1711 + * Will return -EEXIST if name is found and LOOKUP_EXCL was passed. 1712 + */ 1713 + struct dentry *lookup_one_qstr_excl(const struct qstr *name, 1714 + struct dentry *base, unsigned int flags) 1715 + { 1716 + struct dentry *dentry; 1717 + 1718 + dentry = lookup_one_qstr_excl_raw(name, base, flags); 1695 1719 if (IS_ERR(dentry)) 1696 1720 return dentry; 1697 1721 if (d_is_negative(dentry) && !(flags & LOOKUP_CREATE)) { ··· 2752 2742 /* does lookup, returns the object with parent locked */ 2753 2743 static struct dentry *__kern_path_locked(int dfd, struct filename *name, struct path *path) 2754 2744 { 2745 + struct path parent_path __free(path_put) = {}; 2755 2746 struct dentry *d; 2756 2747 struct qstr last; 2757 2748 int type, error; 2758 2749 2759 - error = filename_parentat(dfd, name, 0, path, &last, &type); 2750 + error = filename_parentat(dfd, name, 0, &parent_path, &last, &type); 2760 2751 if (error) 2761 2752 return ERR_PTR(error); 2762 - if (unlikely(type != LAST_NORM)) { 2763 - path_put(path); 2753 + if (unlikely(type != LAST_NORM)) 2764 2754 return ERR_PTR(-EINVAL); 2765 - } 2766 - inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); 2767 - d = lookup_one_qstr_excl(&last, path->dentry, 0); 2755 + inode_lock_nested(parent_path.dentry->d_inode, I_MUTEX_PARENT); 2756 + d = lookup_one_qstr_excl(&last, parent_path.dentry, 0); 2768 2757 if (IS_ERR(d)) { 2769 - inode_unlock(path->dentry->d_inode); 2770 - path_put(path); 2758 + inode_unlock(parent_path.dentry->d_inode); 2759 + return d; 2771 2760 } 2761 + path->dentry = no_free_ptr(parent_path.dentry); 2762 + path->mnt = no_free_ptr(parent_path.mnt); 2763 + return d; 2764 + } 2765 + 2766 + struct dentry *kern_path_locked_negative(const char *name, struct path *path) 2767 + { 2768 + struct path parent_path __free(path_put) = {}; 2769 + struct filename *filename __free(putname) = getname_kernel(name); 2770 + struct dentry *d; 2771 + struct qstr last; 2772 + int type, error; 2773 + 2774 + error = filename_parentat(AT_FDCWD, filename, 0, &parent_path, &last, &type); 2775 + if (error) 2776 + return ERR_PTR(error); 2777 + if (unlikely(type != LAST_NORM)) 2778 + return ERR_PTR(-EINVAL); 2779 + inode_lock_nested(parent_path.dentry->d_inode, I_MUTEX_PARENT); 2780 + d = lookup_one_qstr_excl_raw(&last, parent_path.dentry, 0); 2781 + if (IS_ERR(d)) { 2782 + inode_unlock(parent_path.dentry->d_inode); 2783 + return d; 2784 + } 2785 + path->dentry = no_free_ptr(parent_path.dentry); 2786 + path->mnt = no_free_ptr(parent_path.mnt); 2772 2787 return d; 2773 2788 } 2774 2789
+1 -1
fs/netfs/fscache_cache.c
··· 372 372 EXPORT_SYMBOL(fscache_withdraw_cache); 373 373 374 374 #ifdef CONFIG_PROC_FS 375 - static const char fscache_cache_states[NR__FSCACHE_CACHE_STATE] = "-PAEW"; 375 + static const char fscache_cache_states[NR__FSCACHE_CACHE_STATE] __nonstring = "-PAEW"; 376 376 377 377 /* 378 378 * Generate a list of caches in /proc/fs/fscache/caches
+1 -1
fs/netfs/fscache_cookie.c
··· 29 29 static DEFINE_SPINLOCK(fscache_cookie_lru_lock); 30 30 DEFINE_TIMER(fscache_cookie_lru_timer, fscache_cookie_lru_timed_out); 31 31 static DECLARE_WORK(fscache_cookie_lru_work, fscache_cookie_lru_worker); 32 - static const char fscache_cookie_states[FSCACHE_COOKIE_STATE__NR] = "-LCAIFUWRD"; 32 + static const char fscache_cookie_states[FSCACHE_COOKIE_STATE__NR] __nonstring = "-LCAIFUWRD"; 33 33 static unsigned int fscache_lru_cookie_timeout = 10 * HZ; 34 34 35 35 void fscache_print_cookie(struct fscache_cookie *cookie, char prefix)
+1 -1
fs/nfs/Kconfig
··· 2 2 config NFS_FS 3 3 tristate "NFS client support" 4 4 depends on INET && FILE_LOCKING && MULTIUSER 5 + select CRC32 5 6 select LOCKD 6 7 select SUNRPC 7 8 select NFS_COMMON ··· 197 196 config NFS_DEBUG 198 197 bool 199 198 depends on NFS_FS && SUNRPC_DEBUG 200 - select CRC32 201 199 default y 202 200 203 201 config NFS_DISABLE_UDP_SUPPORT
-7
fs/nfs/internal.h
··· 899 899 return ((u64)ts->tv_sec << 30) + ts->tv_nsec; 900 900 } 901 901 902 - #ifdef CONFIG_CRC32 903 902 static inline u32 nfs_stateid_hash(const nfs4_stateid *stateid) 904 903 { 905 904 return ~crc32_le(0xFFFFFFFF, &stateid->other[0], 906 905 NFS4_STATEID_OTHER_SIZE); 907 906 } 908 - #else 909 - static inline u32 nfs_stateid_hash(nfs4_stateid *stateid) 910 - { 911 - return 0; 912 - } 913 - #endif 914 907 915 908 static inline bool nfs_current_task_exiting(void) 916 909 {
-4
fs/nfs/nfs4session.h
··· 148 148 memcpy(dst->data, src->data, NFS4_MAX_SESSIONID_LEN); 149 149 } 150 150 151 - #ifdef CONFIG_CRC32 152 151 /* 153 152 * nfs_session_id_hash - calculate the crc32 hash for the session id 154 153 * @session - pointer to session 155 154 */ 156 155 #define nfs_session_id_hash(sess_id) \ 157 156 (~crc32_le(0xFFFFFFFF, &(sess_id)->data[0], sizeof((sess_id)->data))) 158 - #else 159 - #define nfs_session_id_hash(session) (0) 160 - #endif 161 157 #else /* defined(CONFIG_NFS_V4_1) */ 162 158 163 159 static inline int nfs4_init_session(struct nfs_client *clp)
+1
fs/nfsd/Kconfig
··· 4 4 depends on INET 5 5 depends on FILE_LOCKING 6 6 depends on FSNOTIFY 7 + select CRC32 7 8 select LOCKD 8 9 select SUNRPC 9 10 select EXPORTFS
+1 -1
fs/nfsd/nfs4state.c
··· 5430 5430 queued = nfsd4_run_cb(&dp->dl_recall); 5431 5431 WARN_ON_ONCE(!queued); 5432 5432 if (!queued) 5433 - nfs4_put_stid(&dp->dl_stid); 5433 + refcount_dec(&dp->dl_stid.sc_count); 5434 5434 } 5435 5435 5436 5436 /* Called from break_lease() with flc_lock held. */
-7
fs/nfsd/nfsfh.h
··· 267 267 return true; 268 268 } 269 269 270 - #ifdef CONFIG_CRC32 271 270 /** 272 271 * knfsd_fh_hash - calculate the crc32 hash for the filehandle 273 272 * @fh - pointer to filehandle ··· 278 279 { 279 280 return ~crc32_le(0xFFFFFFFF, fh->fh_raw, fh->fh_size); 280 281 } 281 - #else 282 - static inline u32 knfsd_fh_hash(const struct knfsd_fh *fh) 283 - { 284 - return 0; 285 - } 286 - #endif 287 282 288 283 /** 289 284 * fh_clear_pre_post_attrs - Reset pre/post attributes
+2
fs/smb/client/cifsproto.h
··· 163 163 extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *, bool); 164 164 extern int cifs_get_readable_path(struct cifs_tcon *tcon, const char *name, 165 165 struct cifsFileInfo **ret_file); 166 + extern int cifs_get_hardlink_path(struct cifs_tcon *tcon, struct inode *inode, 167 + struct file *file); 166 168 extern unsigned int smbCalcSize(void *buf); 167 169 extern int decode_negTokenInit(unsigned char *security_blob, int length, 168 170 struct TCP_Server_Info *server);
+9 -25
fs/smb/client/connect.c
··· 300 300 server->ssocket->flags); 301 301 sock_release(server->ssocket); 302 302 server->ssocket = NULL; 303 - put_net(cifs_net_ns(server)); 304 303 } 305 304 server->sequence_number = 0; 306 305 server->session_estab = false; ··· 1073 1074 msleep(125); 1074 1075 if (cifs_rdma_enabled(server)) 1075 1076 smbd_destroy(server); 1076 - 1077 1077 if (server->ssocket) { 1078 1078 sock_release(server->ssocket); 1079 1079 server->ssocket = NULL; 1080 - 1081 - /* Release netns reference for the socket. */ 1082 - put_net(cifs_net_ns(server)); 1083 1080 } 1084 1081 1085 1082 if (!list_empty(&server->pending_mid_q)) { ··· 1123 1128 */ 1124 1129 } 1125 1130 1126 - /* Release netns reference for this server. */ 1127 1131 put_net(cifs_net_ns(server)); 1128 1132 kfree(server->leaf_fullpath); 1129 1133 kfree(server->hostname); ··· 1768 1774 1769 1775 tcp_ses->ops = ctx->ops; 1770 1776 tcp_ses->vals = ctx->vals; 1771 - 1772 - /* Grab netns reference for this server. */ 1773 1777 cifs_set_net_ns(tcp_ses, get_net(current->nsproxy->net_ns)); 1774 1778 1775 1779 tcp_ses->sign = ctx->sign; ··· 1895 1903 out_err_crypto_release: 1896 1904 cifs_crypto_secmech_release(tcp_ses); 1897 1905 1898 - /* Release netns reference for this server. */ 1899 1906 put_net(cifs_net_ns(tcp_ses)); 1900 1907 1901 1908 out_err: ··· 1903 1912 cifs_put_tcp_session(tcp_ses->primary_server, false); 1904 1913 kfree(tcp_ses->hostname); 1905 1914 kfree(tcp_ses->leaf_fullpath); 1906 - if (tcp_ses->ssocket) { 1915 + if (tcp_ses->ssocket) 1907 1916 sock_release(tcp_ses->ssocket); 1908 - put_net(cifs_net_ns(tcp_ses)); 1909 - } 1910 1917 kfree(tcp_ses); 1911 1918 } 1912 1919 return ERR_PTR(rc); ··· 3348 3359 socket = server->ssocket; 3349 3360 } else { 3350 3361 struct net *net = cifs_net_ns(server); 3362 + struct sock *sk; 3351 3363 3352 - rc = sock_create_kern(net, sfamily, SOCK_STREAM, IPPROTO_TCP, &server->ssocket); 3364 + rc = __sock_create(net, sfamily, SOCK_STREAM, 3365 + IPPROTO_TCP, &server->ssocket, 1); 3353 3366 if (rc < 0) { 3354 3367 cifs_server_dbg(VFS, "Error %d creating socket\n", rc); 3355 3368 return rc; 3356 3369 } 3357 3370 3358 - /* 3359 - * Grab netns reference for the socket. 3360 - * 3361 - * This reference will be released in several situations: 3362 - * - In the failure path before the cifsd thread is started. 3363 - * - In the all place where server->socket is released, it is 3364 - * also set to NULL. 3365 - * - Ultimately in clean_demultiplex_info(), during the final 3366 - * teardown. 3367 - */ 3368 - get_net(net); 3371 + sk = server->ssocket->sk; 3372 + __netns_tracker_free(net, &sk->ns_tracker, false); 3373 + sk->sk_net_refcnt = 1; 3374 + get_net_track(net, &sk->ns_tracker, GFP_KERNEL); 3375 + sock_inuse_add(net, 1); 3369 3376 3370 3377 /* BB other socket options to set KEEPALIVE, NODELAY? */ 3371 3378 cifs_dbg(FYI, "Socket created\n"); ··· 3413 3428 if (rc < 0) { 3414 3429 cifs_dbg(FYI, "Error %d connecting to server\n", rc); 3415 3430 trace_smb3_connect_err(server->hostname, server->conn_id, &server->dstaddr, rc); 3416 - put_net(cifs_net_ns(server)); 3417 3431 sock_release(socket); 3418 3432 server->ssocket = NULL; 3419 3433 return rc;
+28
fs/smb/client/file.c
··· 1007 1007 } else { 1008 1008 _cifsFileInfo_put(cfile, true, false); 1009 1009 } 1010 + } else { 1011 + /* hard link on the defeered close file */ 1012 + rc = cifs_get_hardlink_path(tcon, inode, file); 1013 + if (rc) 1014 + cifs_close_deferred_file(CIFS_I(inode)); 1010 1015 } 1011 1016 1012 1017 if (server->oplocks) ··· 2074 2069 struct list_head *li, *tmp; 2075 2070 list_for_each_safe(li, tmp, source) 2076 2071 list_move(li, dest); 2072 + } 2073 + 2074 + int 2075 + cifs_get_hardlink_path(struct cifs_tcon *tcon, struct inode *inode, 2076 + struct file *file) 2077 + { 2078 + struct cifsFileInfo *open_file = NULL; 2079 + struct cifsInodeInfo *cinode = CIFS_I(inode); 2080 + int rc = 0; 2081 + 2082 + spin_lock(&tcon->open_file_lock); 2083 + spin_lock(&cinode->open_file_lock); 2084 + 2085 + list_for_each_entry(open_file, &cinode->openFileList, flist) { 2086 + if (file->f_flags == open_file->f_flags) { 2087 + rc = -EINVAL; 2088 + break; 2089 + } 2090 + } 2091 + 2092 + spin_unlock(&cinode->open_file_lock); 2093 + spin_unlock(&tcon->open_file_lock); 2094 + return rc; 2077 2095 } 2078 2096 2079 2097 void
+3 -1
fs/smb/server/connection.c
··· 39 39 xa_destroy(&conn->sessions); 40 40 kvfree(conn->request_buf); 41 41 kfree(conn->preauth_info); 42 - if (atomic_dec_and_test(&conn->refcnt)) 42 + if (atomic_dec_and_test(&conn->refcnt)) { 43 + ksmbd_free_transport(conn->transport); 43 44 kfree(conn); 45 + } 44 46 } 45 47 46 48 /**
+9 -20
fs/smb/server/oplock.c
··· 129 129 kfree(opinfo); 130 130 } 131 131 132 - static inline void opinfo_free_rcu(struct rcu_head *rcu_head) 133 - { 134 - struct oplock_info *opinfo; 135 - 136 - opinfo = container_of(rcu_head, struct oplock_info, rcu_head); 137 - free_opinfo(opinfo); 138 - } 139 - 140 132 struct oplock_info *opinfo_get(struct ksmbd_file *fp) 141 133 { 142 134 struct oplock_info *opinfo; ··· 149 157 if (list_empty(&ci->m_op_list)) 150 158 return NULL; 151 159 152 - rcu_read_lock(); 153 - opinfo = list_first_or_null_rcu(&ci->m_op_list, struct oplock_info, 160 + down_read(&ci->m_lock); 161 + opinfo = list_first_entry(&ci->m_op_list, struct oplock_info, 154 162 op_entry); 155 163 if (opinfo) { 156 164 if (opinfo->conn == NULL || ··· 163 171 } 164 172 } 165 173 } 166 - 167 - rcu_read_unlock(); 174 + up_read(&ci->m_lock); 168 175 169 176 return opinfo; 170 177 } ··· 176 185 if (!atomic_dec_and_test(&opinfo->refcount)) 177 186 return; 178 187 179 - call_rcu(&opinfo->rcu_head, opinfo_free_rcu); 188 + free_opinfo(opinfo); 180 189 } 181 190 182 191 static void opinfo_add(struct oplock_info *opinfo) ··· 184 193 struct ksmbd_inode *ci = opinfo->o_fp->f_ci; 185 194 186 195 down_write(&ci->m_lock); 187 - list_add_rcu(&opinfo->op_entry, &ci->m_op_list); 196 + list_add(&opinfo->op_entry, &ci->m_op_list); 188 197 up_write(&ci->m_lock); 189 198 } 190 199 ··· 198 207 write_unlock(&lease_list_lock); 199 208 } 200 209 down_write(&ci->m_lock); 201 - list_del_rcu(&opinfo->op_entry); 210 + list_del(&opinfo->op_entry); 202 211 up_write(&ci->m_lock); 203 212 } 204 213 ··· 1338 1347 ci = fp->f_ci; 1339 1348 op = opinfo_get(fp); 1340 1349 1341 - rcu_read_lock(); 1342 - list_for_each_entry_rcu(brk_op, &ci->m_op_list, op_entry) { 1350 + down_read(&ci->m_lock); 1351 + list_for_each_entry(brk_op, &ci->m_op_list, op_entry) { 1343 1352 if (brk_op->conn == NULL) 1344 1353 continue; 1345 1354 ··· 1349 1358 if (ksmbd_conn_releasing(brk_op->conn)) 1350 1359 continue; 1351 1360 1352 - rcu_read_unlock(); 1353 1361 if (brk_op->is_lease && (brk_op->o_lease->state & 1354 1362 (~(SMB2_LEASE_READ_CACHING_LE | 1355 1363 SMB2_LEASE_HANDLE_CACHING_LE)))) { ··· 1378 1388 oplock_break(brk_op, SMB2_OPLOCK_LEVEL_NONE, NULL); 1379 1389 next: 1380 1390 opinfo_put(brk_op); 1381 - rcu_read_lock(); 1382 1391 } 1383 - rcu_read_unlock(); 1392 + up_read(&ci->m_lock); 1384 1393 1385 1394 if (op) 1386 1395 opinfo_put(op);
-1
fs/smb/server/oplock.h
··· 71 71 struct list_head lease_entry; 72 72 wait_queue_head_t oplock_q; /* Other server threads */ 73 73 wait_queue_head_t oplock_brk; /* oplock breaking wait */ 74 - struct rcu_head rcu_head; 75 74 }; 76 75 77 76 struct lease_break_info {
+3 -1
fs/smb/server/smb2pdu.c
··· 1602 1602 if (prev_sess_id && prev_sess_id != sess->id) 1603 1603 destroy_previous_session(conn, sess->user, prev_sess_id); 1604 1604 1605 - if (sess->state == SMB2_SESSION_VALID) 1605 + if (sess->state == SMB2_SESSION_VALID) { 1606 1606 ksmbd_free_user(sess->user); 1607 + sess->user = NULL; 1608 + } 1607 1609 1608 1610 retval = ksmbd_krb5_authenticate(sess, in_blob, in_len, 1609 1611 out_blob, &out_len);
+6 -1
fs/smb/server/transport_ipc.c
··· 310 310 server_conf.signing = req->signing; 311 311 server_conf.tcp_port = req->tcp_port; 312 312 server_conf.ipc_timeout = req->ipc_timeout * HZ; 313 - server_conf.deadtime = req->deadtime * SMB_ECHO_INTERVAL; 313 + if (check_mul_overflow(req->deadtime, SMB_ECHO_INTERVAL, 314 + &server_conf.deadtime)) { 315 + ret = -EINVAL; 316 + goto out; 317 + } 314 318 server_conf.share_fake_fscaps = req->share_fake_fscaps; 315 319 ksmbd_init_domain(req->sub_auth); 316 320 ··· 341 337 server_conf.bind_interfaces_only = req->bind_interfaces_only; 342 338 ret |= ksmbd_tcp_set_interfaces(KSMBD_STARTUP_CONFIG_INTERFACES(req), 343 339 req->ifc_list_sz); 340 + out: 344 341 if (ret) { 345 342 pr_err("Server configuration error: %s %s %s\n", 346 343 req->netbios_name, req->server_string,
+9 -5
fs/smb/server/transport_tcp.c
··· 93 93 return t; 94 94 } 95 95 96 + void ksmbd_free_transport(struct ksmbd_transport *kt) 97 + { 98 + struct tcp_transport *t = TCP_TRANS(kt); 99 + 100 + sock_release(t->sock); 101 + kfree(t->iov); 102 + kfree(t); 103 + } 104 + 96 105 static void free_transport(struct tcp_transport *t) 97 106 { 98 107 kernel_sock_shutdown(t->sock, SHUT_RDWR); 99 - sock_release(t->sock); 100 - t->sock = NULL; 101 - 102 108 ksmbd_conn_free(KSMBD_TRANS(t)->conn); 103 - kfree(t->iov); 104 - kfree(t); 105 109 } 106 110 107 111 /**
+1
fs/smb/server/transport_tcp.h
··· 8 8 9 9 int ksmbd_tcp_set_interfaces(char *ifc_list, int ifc_list_sz); 10 10 struct interface *ksmbd_find_netdev_name_iface_list(char *netdev_name); 11 + void ksmbd_free_transport(struct ksmbd_transport *kt); 11 12 int ksmbd_tcp_init(void); 12 13 void ksmbd_tcp_destroy(void); 13 14
+2 -1
fs/smb/server/vfs.c
··· 479 479 int err = 0; 480 480 481 481 if (work->conn->connection_type) { 482 - if (!(fp->daccess & (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE))) { 482 + if (!(fp->daccess & (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE)) || 483 + S_ISDIR(file_inode(fp->filp)->i_mode)) { 483 484 pr_err("no right to write(%pD)\n", fp->filp); 484 485 err = -EACCES; 485 486 goto out;
+1 -7
fs/smb/server/vfs_cache.c
··· 713 713 714 714 static bool ksmbd_durable_scavenger_alive(void) 715 715 { 716 - mutex_lock(&durable_scavenger_lock); 717 - if (!durable_scavenger_running) { 718 - mutex_unlock(&durable_scavenger_lock); 716 + if (!durable_scavenger_running) 719 717 return false; 720 - } 721 - mutex_unlock(&durable_scavenger_lock); 722 718 723 719 if (kthread_should_stop()) 724 720 return false; ··· 795 799 break; 796 800 } 797 801 798 - mutex_lock(&durable_scavenger_lock); 799 802 durable_scavenger_running = false; 800 - mutex_unlock(&durable_scavenger_lock); 801 803 802 804 module_put(THIS_MODULE); 803 805
+18 -14
fs/stat.c
··· 204 204 STATX_ATTR_DAX); 205 205 206 206 idmap = mnt_idmap(path->mnt); 207 - if (inode->i_op->getattr) 208 - return inode->i_op->getattr(idmap, path, stat, 209 - request_mask, 210 - query_flags); 207 + if (inode->i_op->getattr) { 208 + int ret; 211 209 212 - generic_fillattr(idmap, request_mask, inode, stat); 210 + ret = inode->i_op->getattr(idmap, path, stat, request_mask, 211 + query_flags); 212 + if (ret) 213 + return ret; 214 + } else { 215 + generic_fillattr(idmap, request_mask, inode, stat); 216 + } 217 + 218 + /* 219 + * If this is a block device inode, override the filesystem attributes 220 + * with the block device specific parameters that need to be obtained 221 + * from the bdev backing inode. 222 + */ 223 + if (S_ISBLK(stat->mode)) 224 + bdev_statx(path, stat, request_mask); 225 + 213 226 return 0; 214 227 } 215 228 EXPORT_SYMBOL(vfs_getattr_nosec); ··· 308 295 if (path_mounted(path)) 309 296 stat->attributes |= STATX_ATTR_MOUNT_ROOT; 310 297 stat->attributes_mask |= STATX_ATTR_MOUNT_ROOT; 311 - 312 - /* 313 - * If this is a block device inode, override the filesystem 314 - * attributes with the block device specific parameters that need to be 315 - * obtained from the bdev backing inode. 316 - */ 317 - if (S_ISBLK(stat->mode)) 318 - bdev_statx(path, stat, request_mask); 319 - 320 298 return 0; 321 299 } 322 300
+1 -1
include/acpi/actbl.h
··· 66 66 ******************************************************************************/ 67 67 68 68 struct acpi_table_header { 69 - char signature[ACPI_NAMESEG_SIZE]; /* ASCII table signature */ 69 + char signature[ACPI_NAMESEG_SIZE] __nonstring; /* ASCII table signature */ 70 70 u32 length; /* Length of table in bytes, including this header */ 71 71 u8 revision; /* ACPI Specification minor version number */ 72 72 u8 checksum; /* To make sum of entire table == 0 */
+1 -2
include/drm/drm_gem.h
··· 585 585 */ 586 586 static inline bool drm_gem_is_imported(const struct drm_gem_object *obj) 587 587 { 588 - /* The dma-buf's priv field points to the original GEM object. */ 589 - return obj->dma_buf && (obj->dma_buf->priv != obj); 588 + return !!obj->import_attach; 590 589 } 591 590 592 591 #ifdef CONFIG_LOCKDEP
+1
include/linux/backing-dev.h
··· 249 249 { 250 250 #ifdef CONFIG_LOCKDEP 251 251 WARN_ON_ONCE(debug_locks && 252 + (inode->i_sb->s_iflags & SB_I_CGROUPWB) && 252 253 (!lockdep_is_held(&inode->i_lock) && 253 254 !lockdep_is_held(&inode->i_mapping->i_pages.xa_lock) && 254 255 !lockdep_is_held(&inode->i_wb->list_lock)));
+48 -25
include/linux/blkdev.h
··· 712 712 (q->limits.features & BLK_FEAT_ZONED); 713 713 } 714 714 715 - #ifdef CONFIG_BLK_DEV_ZONED 716 - static inline unsigned int disk_nr_zones(struct gendisk *disk) 717 - { 718 - return disk->nr_zones; 719 - } 720 - bool blk_zone_plug_bio(struct bio *bio, unsigned int nr_segs); 721 - #else /* CONFIG_BLK_DEV_ZONED */ 722 - static inline unsigned int disk_nr_zones(struct gendisk *disk) 723 - { 724 - return 0; 725 - } 726 - static inline bool blk_zone_plug_bio(struct bio *bio, unsigned int nr_segs) 727 - { 728 - return false; 729 - } 730 - #endif /* CONFIG_BLK_DEV_ZONED */ 731 - 732 715 static inline unsigned int disk_zone_no(struct gendisk *disk, sector_t sector) 733 716 { 734 717 if (!blk_queue_is_zoned(disk->queue)) 735 718 return 0; 736 719 return sector >> ilog2(disk->queue->limits.chunk_sectors); 737 - } 738 - 739 - static inline unsigned int bdev_nr_zones(struct block_device *bdev) 740 - { 741 - return disk_nr_zones(bdev->bd_disk); 742 720 } 743 721 744 722 static inline unsigned int bdev_max_open_zones(struct block_device *bdev) ··· 823 845 { 824 846 return bdev_nr_sectors(sb->s_bdev) >> 825 847 (sb->s_blocksize_bits - SECTOR_SHIFT); 848 + } 849 + 850 + #ifdef CONFIG_BLK_DEV_ZONED 851 + static inline unsigned int disk_nr_zones(struct gendisk *disk) 852 + { 853 + return disk->nr_zones; 854 + } 855 + bool blk_zone_plug_bio(struct bio *bio, unsigned int nr_segs); 856 + 857 + /** 858 + * disk_zone_capacity - returns the zone capacity of zone containing @sector 859 + * @disk: disk to work with 860 + * @sector: sector number within the querying zone 861 + * 862 + * Returns the zone capacity of a zone containing @sector. @sector can be any 863 + * sector in the zone. 864 + */ 865 + static inline unsigned int disk_zone_capacity(struct gendisk *disk, 866 + sector_t sector) 867 + { 868 + sector_t zone_sectors = disk->queue->limits.chunk_sectors; 869 + 870 + if (sector + zone_sectors >= get_capacity(disk)) 871 + return disk->last_zone_capacity; 872 + return disk->zone_capacity; 873 + } 874 + static inline unsigned int bdev_zone_capacity(struct block_device *bdev, 875 + sector_t pos) 876 + { 877 + return disk_zone_capacity(bdev->bd_disk, pos); 878 + } 879 + #else /* CONFIG_BLK_DEV_ZONED */ 880 + static inline unsigned int disk_nr_zones(struct gendisk *disk) 881 + { 882 + return 0; 883 + } 884 + static inline bool blk_zone_plug_bio(struct bio *bio, unsigned int nr_segs) 885 + { 886 + return false; 887 + } 888 + #endif /* CONFIG_BLK_DEV_ZONED */ 889 + 890 + static inline unsigned int bdev_nr_zones(struct block_device *bdev) 891 + { 892 + return disk_nr_zones(bdev->bd_disk); 826 893 } 827 894 828 895 int bdev_disk_changed(struct gendisk *disk, bool invalidate); ··· 1708 1685 int sync_blockdev_range(struct block_device *bdev, loff_t lstart, loff_t lend); 1709 1686 int sync_blockdev_nowait(struct block_device *bdev); 1710 1687 void sync_bdevs(bool wait); 1711 - void bdev_statx(struct path *, struct kstat *, u32); 1688 + void bdev_statx(const struct path *path, struct kstat *stat, u32 request_mask); 1712 1689 void printk_all_partitions(void); 1713 1690 int __init early_lookup_bdev(const char *pathname, dev_t *dev); 1714 1691 #else ··· 1726 1703 static inline void sync_bdevs(bool wait) 1727 1704 { 1728 1705 } 1729 - static inline void bdev_statx(struct path *path, struct kstat *stat, 1730 - u32 request_mask) 1706 + static inline void bdev_statx(const struct path *path, struct kstat *stat, 1707 + u32 request_mask) 1731 1708 { 1732 1709 } 1733 1710 static inline void printk_all_partitions(void)
+4 -4
include/linux/local_lock_internal.h
··· 102 102 l = (local_lock_t *)this_cpu_ptr(lock); \ 103 103 tl = (local_trylock_t *)l; \ 104 104 _Generic((lock), \ 105 - local_trylock_t *: ({ \ 105 + __percpu local_trylock_t *: ({ \ 106 106 lockdep_assert(tl->acquired == 0); \ 107 107 WRITE_ONCE(tl->acquired, 1); \ 108 108 }), \ 109 - default:(void)0); \ 109 + __percpu local_lock_t *: (void)0); \ 110 110 local_lock_acquire(l); \ 111 111 } while (0) 112 112 ··· 171 171 tl = (local_trylock_t *)l; \ 172 172 local_lock_release(l); \ 173 173 _Generic((lock), \ 174 - local_trylock_t *: ({ \ 174 + __percpu local_trylock_t *: ({ \ 175 175 lockdep_assert(tl->acquired == 1); \ 176 176 WRITE_ONCE(tl->acquired, 0); \ 177 177 }), \ 178 - default:(void)0); \ 178 + __percpu local_lock_t *: (void)0); \ 179 179 } while (0) 180 180 181 181 #define __local_unlock(lock) \
+17
include/linux/mm.h
··· 1218 1218 return folio_large_order(folio); 1219 1219 } 1220 1220 1221 + /** 1222 + * folio_reset_order - Reset the folio order and derived _nr_pages 1223 + * @folio: The folio. 1224 + * 1225 + * Reset the order and derived _nr_pages to 0. Must only be used in the 1226 + * process of splitting large folios. 1227 + */ 1228 + static inline void folio_reset_order(struct folio *folio) 1229 + { 1230 + if (WARN_ON_ONCE(!folio_test_large(folio))) 1231 + return; 1232 + folio->_flags_1 &= ~0xffUL; 1233 + #ifdef NR_PAGES_IN_LARGE_FOLIO 1234 + folio->_nr_pages = 0; 1235 + #endif 1236 + } 1237 + 1221 1238 #include <linux/huge_mm.h> 1222 1239 1223 1240 /*
+3 -2
include/linux/mmzone.h
··· 967 967 #ifdef CONFIG_UNACCEPTED_MEMORY 968 968 /* Pages to be accepted. All pages on the list are MAX_PAGE_ORDER */ 969 969 struct list_head unaccepted_pages; 970 + 971 + /* To be called once the last page in the zone is accepted */ 972 + struct work_struct unaccepted_cleanup; 970 973 #endif 971 974 972 975 /* zone flags, see below */ ··· 1502 1499 bool zone_watermark_ok(struct zone *z, unsigned int order, 1503 1500 unsigned long mark, int highest_zoneidx, 1504 1501 unsigned int alloc_flags); 1505 - bool zone_watermark_ok_safe(struct zone *z, unsigned int order, 1506 - unsigned long mark, int highest_zoneidx); 1507 1502 /* 1508 1503 * Memory initialization context, use to differentiate memory added by 1509 1504 * the platform statically or via memory hotplug interface.
+1
include/linux/namei.h
··· 62 62 extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int); 63 63 extern void done_path_create(struct path *, struct dentry *); 64 64 extern struct dentry *kern_path_locked(const char *, struct path *); 65 + extern struct dentry *kern_path_locked_negative(const char *, struct path *); 65 66 extern struct dentry *user_path_locked_at(int , const char __user *, struct path *); 66 67 int vfs_path_parent_lookup(struct filename *filename, unsigned int flags, 67 68 struct path *parent, struct qstr *last, int *type,
-7
include/linux/nfs.h
··· 55 55 NFS_INVALID_STABLE_HOW = -1 56 56 }; 57 57 58 - #ifdef CONFIG_CRC32 59 58 /** 60 59 * nfs_fhandle_hash - calculate the crc32 hash for the filehandle 61 60 * @fh - pointer to filehandle ··· 66 67 { 67 68 return ~crc32_le(0xFFFFFFFF, &fh->data[0], fh->size); 68 69 } 69 - #else /* CONFIG_CRC32 */ 70 - static inline u32 nfs_fhandle_hash(const struct nfs_fh *fh) 71 - { 72 - return 0; 73 - } 74 - #endif /* CONFIG_CRC32 */ 75 70 #endif /* _LINUX_NFS_H */
+2
include/linux/pci.h
··· 245 245 PCI_DEV_FLAGS_NO_RELAXED_ORDERING = (__force pci_dev_flags_t) (1 << 11), 246 246 /* Device does honor MSI masking despite saying otherwise */ 247 247 PCI_DEV_FLAGS_HAS_MSI_MASKING = (__force pci_dev_flags_t) (1 << 12), 248 + /* Device requires write to PCI_MSIX_ENTRY_DATA before any MSIX reads */ 249 + PCI_DEV_FLAGS_MSIX_TOUCH_ENTRY_DATA_FIRST = (__force pci_dev_flags_t) (1 << 13), 248 250 }; 249 251 250 252 enum pci_irq_reroute_variant {
+20 -11
include/linux/phylink.h
··· 361 361 phy_interface_t iface); 362 362 363 363 /** 364 - * mac_link_down() - take the link down 364 + * mac_link_down() - notification that the link has gone down 365 365 * @config: a pointer to a &struct phylink_config. 366 366 * @mode: link autonegotiation mode 367 367 * @interface: link &typedef phy_interface_t mode 368 368 * 369 - * If @mode is not an in-band negotiation mode (as defined by 370 - * phylink_autoneg_inband()), force the link down and disable any 371 - * Energy Efficient Ethernet MAC configuration. Interface type 372 - * selection must be done in mac_config(). 369 + * Notifies the MAC that the link has gone down. This will not be called 370 + * unless mac_link_up() has been previously called. 371 + * 372 + * The MAC should stop processing packets for transmission and reception. 373 + * phylink will have called netif_carrier_off() to notify the networking 374 + * stack that the link has gone down, so MAC drivers should not make this 375 + * call. 376 + * 377 + * If @mode is %MLO_AN_INBAND, then this function must not prevent the 378 + * link coming up. 373 379 */ 374 380 void mac_link_down(struct phylink_config *config, unsigned int mode, 375 381 phy_interface_t interface); 376 382 377 383 /** 378 - * mac_link_up() - allow the link to come up 384 + * mac_link_up() - notification that the link has come up 379 385 * @config: a pointer to a &struct phylink_config. 380 - * @phy: any attached phy 386 + * @phy: any attached phy (deprecated - please use LPI interfaces) 381 387 * @mode: link autonegotiation mode 382 388 * @interface: link &typedef phy_interface_t mode 383 389 * @speed: link speed ··· 391 385 * @tx_pause: link transmit pause enablement status 392 386 * @rx_pause: link receive pause enablement status 393 387 * 394 - * Configure the MAC for an established link. 388 + * Notifies the MAC that the link has come up, and the parameters of the 389 + * link as seen from the MACs point of view. If mac_link_up() has been 390 + * called previously, there will be an intervening call to mac_link_down() 391 + * before this method will be subsequently called. 395 392 * 396 393 * @speed, @duplex, @tx_pause and @rx_pause indicate the finalised link 397 394 * settings, and should be used to configure the MAC block appropriately ··· 406 397 * that the user wishes to override the pause settings, and this should 407 398 * be allowed when considering the implementation of this method. 408 399 * 409 - * If in-band negotiation mode is disabled, allow the link to come up. If 410 - * @phy is non-%NULL, configure Energy Efficient Ethernet by calling 411 - * phy_init_eee() and perform appropriate MAC configuration for EEE. 400 + * Once configured, the MAC may begin to process packets for transmission 401 + * and reception. 402 + * 412 403 * Interface type selection must be done in mac_config(). 413 404 */ 414 405 void mac_link_up(struct phylink_config *config, struct phy_device *phy,
+3
include/linux/virtio.h
··· 220 220 * occurs. 221 221 * @reset_done: optional function to call after transport specific reset 222 222 * operation has finished. 223 + * @shutdown: synchronize with the device on shutdown. If provided, replaces 224 + * the virtio core implementation. 223 225 */ 224 226 struct virtio_driver { 225 227 struct device_driver driver; ··· 239 237 int (*restore)(struct virtio_device *dev); 240 238 int (*reset_prepare)(struct virtio_device *dev); 241 239 int (*reset_done)(struct virtio_device *dev); 240 + void (*shutdown)(struct virtio_device *dev); 242 241 }; 243 242 244 243 #define drv_to_virtio(__drv) container_of_const(__drv, struct virtio_driver, driver)
+2 -2
include/uapi/drm/ivpu_accel.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ 2 2 /* 3 - * Copyright (C) 2020-2024 Intel Corporation 3 + * Copyright (C) 2020-2025 Intel Corporation 4 4 */ 5 5 6 6 #ifndef __UAPI_IVPU_DRM_H__ ··· 147 147 * platform type when executing on a simulator or emulator (read-only) 148 148 * 149 149 * %DRM_IVPU_PARAM_CORE_CLOCK_RATE: 150 - * Current PLL frequency (read-only) 150 + * Maximum frequency of the NPU data processing unit clock (read-only) 151 151 * 152 152 * %DRM_IVPU_PARAM_NUM_CONTEXTS: 153 153 * Maximum number of simultaneously existing contexts (read-only)
+3 -1
include/uapi/linux/io_uring.h
··· 1010 1010 __u64 region_ptr; /* struct io_uring_region_desc * */ 1011 1011 1012 1012 struct io_uring_zcrx_offsets offsets; 1013 - __u64 __resv[4]; 1013 + __u32 zcrx_id; 1014 + __u32 __resv2; 1015 + __u64 __resv[3]; 1014 1016 }; 1015 1017 1016 1018 #ifdef __cplusplus
+2 -2
include/uapi/linux/vhost.h
··· 28 28 29 29 /* Set current process as the (exclusive) owner of this file descriptor. This 30 30 * must be called before any other vhost command. Further calls to 31 - * VHOST_OWNER_SET fail until VHOST_OWNER_RESET is called. */ 31 + * VHOST_SET_OWNER fail until VHOST_RESET_OWNER is called. */ 32 32 #define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01) 33 33 /* Give up ownership, and reset the device to default values. 34 - * Allows subsequent call to VHOST_OWNER_SET to succeed. */ 34 + * Allows subsequent call to VHOST_SET_OWNER to succeed. */ 35 35 #define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02) 36 36 37 37 /* Set up/modify memory layout */
+1
include/uapi/linux/virtio_pci.h
··· 246 246 #define VIRTIO_ADMIN_CMD_LIST_USE 0x1 247 247 248 248 /* Admin command group type. */ 249 + #define VIRTIO_ADMIN_GROUP_TYPE_SELF 0x0 249 250 #define VIRTIO_ADMIN_GROUP_TYPE_SRIOV 0x1 250 251 251 252 /* Transitional device admin command. */
+10 -10
init/Kconfig
··· 1555 1555 the unaligned access emulation. 1556 1556 see arch/parisc/kernel/unaligned.c for reference 1557 1557 1558 + config SYSFS_SYSCALL 1559 + bool "Sysfs syscall support" 1560 + default n 1561 + help 1562 + sys_sysfs is an obsolete system call no longer supported in libc. 1563 + Note that disabling this option is more secure but might break 1564 + compatibility with some systems. 1565 + 1566 + If unsure say N here. 1567 + 1558 1568 config HAVE_PCSPKR_PLATFORM 1559 1569 bool 1560 1570 ··· 1608 1598 architectures. 1609 1599 1610 1600 If unsure, leave the default option here. 1611 - 1612 - config SYSFS_SYSCALL 1613 - bool "Sysfs syscall support" if EXPERT 1614 - default y 1615 - help 1616 - sys_sysfs is an obsolete system call no longer supported in libc. 1617 - Note that disabling this option is more secure but might break 1618 - compatibility with some systems. 1619 - 1620 - If unsure say Y here. 1621 1601 1622 1602 config FHANDLE 1623 1603 bool "open by fhandle syscalls" if EXPERT
+47 -45
io_uring/rsrc.c
··· 1032 1032 return 0; 1033 1033 } 1034 1034 1035 + static int io_import_kbuf(int ddir, struct iov_iter *iter, 1036 + struct io_mapped_ubuf *imu, size_t len, size_t offset) 1037 + { 1038 + size_t count = len + offset; 1039 + 1040 + iov_iter_bvec(iter, ddir, imu->bvec, imu->nr_bvecs, count); 1041 + iov_iter_advance(iter, offset); 1042 + 1043 + if (count < imu->len) { 1044 + const struct bio_vec *bvec = iter->bvec; 1045 + 1046 + while (len > bvec->bv_len) { 1047 + len -= bvec->bv_len; 1048 + bvec++; 1049 + } 1050 + iter->nr_segs = 1 + bvec - iter->bvec; 1051 + } 1052 + return 0; 1053 + } 1054 + 1035 1055 static int io_import_fixed(int ddir, struct iov_iter *iter, 1036 1056 struct io_mapped_ubuf *imu, 1037 1057 u64 buf_addr, size_t len) 1038 1058 { 1059 + const struct bio_vec *bvec; 1060 + size_t folio_mask; 1061 + unsigned nr_segs; 1039 1062 size_t offset; 1040 1063 int ret; 1041 1064 ··· 1070 1047 if (!(imu->dir & (1 << ddir))) 1071 1048 return -EFAULT; 1072 1049 1073 - /* 1074 - * Might not be a start of buffer, set size appropriately 1075 - * and advance us to the beginning. 1076 - */ 1077 1050 offset = buf_addr - imu->ubuf; 1078 - iov_iter_bvec(iter, ddir, imu->bvec, imu->nr_bvecs, offset + len); 1079 1051 1080 - if (offset) { 1081 - /* 1082 - * Don't use iov_iter_advance() here, as it's really slow for 1083 - * using the latter parts of a big fixed buffer - it iterates 1084 - * over each segment manually. We can cheat a bit here for user 1085 - * registered nodes, because we know that: 1086 - * 1087 - * 1) it's a BVEC iter, we set it up 1088 - * 2) all bvecs are the same in size, except potentially the 1089 - * first and last bvec 1090 - * 1091 - * So just find our index, and adjust the iterator afterwards. 1092 - * If the offset is within the first bvec (or the whole first 1093 - * bvec, just use iov_iter_advance(). This makes it easier 1094 - * since we can just skip the first segment, which may not 1095 - * be folio_size aligned. 1096 - */ 1097 - const struct bio_vec *bvec = imu->bvec; 1052 + if (imu->is_kbuf) 1053 + return io_import_kbuf(ddir, iter, imu, len, offset); 1098 1054 1099 - /* 1100 - * Kernel buffer bvecs, on the other hand, don't necessarily 1101 - * have the size property of user registered ones, so we have 1102 - * to use the slow iter advance. 1103 - */ 1104 - if (offset < bvec->bv_len) { 1105 - iter->count -= offset; 1106 - iter->iov_offset = offset; 1107 - } else if (imu->is_kbuf) { 1108 - iov_iter_advance(iter, offset); 1109 - } else { 1110 - unsigned long seg_skip; 1055 + /* 1056 + * Don't use iov_iter_advance() here, as it's really slow for 1057 + * using the latter parts of a big fixed buffer - it iterates 1058 + * over each segment manually. We can cheat a bit here for user 1059 + * registered nodes, because we know that: 1060 + * 1061 + * 1) it's a BVEC iter, we set it up 1062 + * 2) all bvecs are the same in size, except potentially the 1063 + * first and last bvec 1064 + */ 1065 + folio_mask = (1UL << imu->folio_shift) - 1; 1066 + bvec = imu->bvec; 1067 + if (offset >= bvec->bv_len) { 1068 + unsigned long seg_skip; 1111 1069 1112 - /* skip first vec */ 1113 - offset -= bvec->bv_len; 1114 - seg_skip = 1 + (offset >> imu->folio_shift); 1115 - 1116 - iter->bvec += seg_skip; 1117 - iter->nr_segs -= seg_skip; 1118 - iter->count -= bvec->bv_len + offset; 1119 - iter->iov_offset = offset & ((1UL << imu->folio_shift) - 1); 1120 - } 1070 + /* skip first vec */ 1071 + offset -= bvec->bv_len; 1072 + seg_skip = 1 + (offset >> imu->folio_shift); 1073 + bvec += seg_skip; 1074 + offset &= folio_mask; 1121 1075 } 1122 - 1076 + nr_segs = (offset + len + bvec->bv_offset + folio_mask) >> imu->folio_shift; 1077 + iov_iter_bvec(iter, ddir, bvec, nr_segs, len); 1078 + iter->iov_offset = offset; 1123 1079 return 0; 1124 1080 } 1125 1081
+28 -9
io_uring/zcrx.c
··· 26 26 #include "zcrx.h" 27 27 #include "rsrc.h" 28 28 29 + static inline struct io_zcrx_ifq *io_pp_to_ifq(struct page_pool *pp) 30 + { 31 + return pp->mp_priv; 32 + } 33 + 29 34 #define IO_DMA_ATTR (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_WEAK_ORDERING) 30 35 31 36 static void __io_zcrx_unmap_area(struct io_zcrx_ifq *ifq, ··· 51 46 52 47 static void io_zcrx_unmap_area(struct io_zcrx_ifq *ifq, struct io_zcrx_area *area) 53 48 { 49 + guard(mutex)(&ifq->dma_lock); 50 + 54 51 if (area->is_mapped) 55 52 __io_zcrx_unmap_area(ifq, area, area->nia.num_niovs); 53 + area->is_mapped = false; 56 54 } 57 55 58 56 static int io_zcrx_map_area(struct io_zcrx_ifq *ifq, struct io_zcrx_area *area) 59 57 { 60 58 int i; 59 + 60 + guard(mutex)(&ifq->dma_lock); 61 + if (area->is_mapped) 62 + return 0; 61 63 62 64 for (i = 0; i < area->nia.num_niovs; i++) { 63 65 struct net_iov *niov = &area->nia.niovs[i]; ··· 287 275 ifq->ctx = ctx; 288 276 spin_lock_init(&ifq->lock); 289 277 spin_lock_init(&ifq->rq_lock); 278 + mutex_init(&ifq->dma_lock); 290 279 return ifq; 291 280 } 292 281 ··· 337 324 put_device(ifq->dev); 338 325 339 326 io_free_rbuf_ring(ifq); 327 + mutex_destroy(&ifq->dma_lock); 340 328 kfree(ifq); 341 329 } 342 330 ··· 368 354 return -EFAULT; 369 355 if (copy_from_user(&rd, u64_to_user_ptr(reg.region_ptr), sizeof(rd))) 370 356 return -EFAULT; 371 - if (memchr_inv(&reg.__resv, 0, sizeof(reg.__resv))) 357 + if (memchr_inv(&reg.__resv, 0, sizeof(reg.__resv)) || 358 + reg.__resv2 || reg.zcrx_id) 372 359 return -EINVAL; 373 360 if (reg.if_rxq == -1 || !reg.rq_entries || reg.flags) 374 361 return -EINVAL; ··· 408 393 if (!ifq->dev) 409 394 goto err; 410 395 get_device(ifq->dev); 411 - 412 - ret = io_zcrx_map_area(ifq, ifq->area); 413 - if (ret) 414 - goto err; 415 396 416 397 mp_param.mp_ops = &io_uring_pp_zc_ops; 417 398 mp_param.mp_priv = ifq; ··· 596 585 597 586 static netmem_ref io_pp_zc_alloc_netmems(struct page_pool *pp, gfp_t gfp) 598 587 { 599 - struct io_zcrx_ifq *ifq = pp->mp_priv; 588 + struct io_zcrx_ifq *ifq = io_pp_to_ifq(pp); 600 589 601 590 /* pp should already be ensuring that */ 602 591 if (unlikely(pp->alloc.count)) ··· 628 617 629 618 static int io_pp_zc_init(struct page_pool *pp) 630 619 { 631 - struct io_zcrx_ifq *ifq = pp->mp_priv; 620 + struct io_zcrx_ifq *ifq = io_pp_to_ifq(pp); 621 + int ret; 632 622 633 623 if (WARN_ON_ONCE(!ifq)) 634 624 return -EINVAL; ··· 642 630 if (pp->p.dma_dir != DMA_FROM_DEVICE) 643 631 return -EOPNOTSUPP; 644 632 633 + ret = io_zcrx_map_area(ifq, ifq->area); 634 + if (ret) 635 + return ret; 636 + 645 637 percpu_ref_get(&ifq->ctx->refs); 646 638 return 0; 647 639 } 648 640 649 641 static void io_pp_zc_destroy(struct page_pool *pp) 650 642 { 651 - struct io_zcrx_ifq *ifq = pp->mp_priv; 643 + struct io_zcrx_ifq *ifq = io_pp_to_ifq(pp); 652 644 struct io_zcrx_area *area = ifq->area; 653 645 654 646 if (WARN_ON_ONCE(area->free_count != area->nia.num_niovs)) ··· 681 665 struct io_zcrx_ifq *ifq = mp_priv; 682 666 683 667 io_zcrx_drop_netdev(ifq); 668 + if (ifq->area) 669 + io_zcrx_unmap_area(ifq, ifq->area); 670 + 684 671 p->mp_ops = NULL; 685 672 p->mp_priv = NULL; 686 673 } ··· 810 791 811 792 niov = netmem_to_net_iov(frag->netmem); 812 793 if (niov->pp->mp_ops != &io_uring_pp_zc_ops || 813 - niov->pp->mp_priv != ifq) 794 + io_pp_to_ifq(niov->pp) != ifq) 814 795 return -EFAULT; 815 796 816 797 if (!io_zcrx_queue_cqe(req, niov, ifq, off + skb_frag_off(frag), len))
+1
io_uring/zcrx.h
··· 38 38 struct net_device *netdev; 39 39 netdevice_tracker netdev_tracker; 40 40 spinlock_t lock; 41 + struct mutex dma_lock; 41 42 }; 42 43 43 44 #if defined(CONFIG_IO_URING_ZCRX)
+10 -6
kernel/audit_watch.c
··· 347 347 /* Get path information necessary for adding watches. */ 348 348 static int audit_get_nd(struct audit_watch *watch, struct path *parent) 349 349 { 350 - struct dentry *d = kern_path_locked(watch->path, parent); 350 + struct dentry *d; 351 + 352 + d = kern_path_locked_negative(watch->path, parent); 351 353 if (IS_ERR(d)) 352 354 return PTR_ERR(d); 353 - /* update watch filter fields */ 354 - watch->dev = d->d_sb->s_dev; 355 - watch->ino = d_backing_inode(d)->i_ino; 355 + 356 + if (d_is_positive(d)) { 357 + /* update watch filter fields */ 358 + watch->dev = d->d_sb->s_dev; 359 + watch->ino = d_backing_inode(d)->i_ino; 360 + } 356 361 357 362 inode_unlock(d_backing_inode(parent->dentry)); 358 363 dput(d); ··· 423 418 /* caller expects mutex locked */ 424 419 mutex_lock(&audit_filter_mutex); 425 420 426 - if (ret && ret != -ENOENT) { 421 + if (ret) { 427 422 audit_put_watch(watch); 428 423 return ret; 429 424 } 430 - ret = 0; 431 425 432 426 /* either find an old parent or attach a new one */ 433 427 parent = audit_find_parent(d_backing_inode(parent_path.dentry));
+30 -1
kernel/cgroup/cgroup.c
··· 90 90 DEFINE_MUTEX(cgroup_mutex); 91 91 DEFINE_SPINLOCK(css_set_lock); 92 92 93 - #ifdef CONFIG_PROVE_RCU 93 + #if (defined CONFIG_PROVE_RCU || defined CONFIG_LOCKDEP) 94 94 EXPORT_SYMBOL_GPL(cgroup_mutex); 95 95 EXPORT_SYMBOL_GPL(css_set_lock); 96 96 #endif ··· 2353 2353 }; 2354 2354 2355 2355 #ifdef CONFIG_CPUSETS_V1 2356 + enum cpuset_param { 2357 + Opt_cpuset_v2_mode, 2358 + }; 2359 + 2360 + static const struct fs_parameter_spec cpuset_fs_parameters[] = { 2361 + fsparam_flag ("cpuset_v2_mode", Opt_cpuset_v2_mode), 2362 + {} 2363 + }; 2364 + 2365 + static int cpuset_parse_param(struct fs_context *fc, struct fs_parameter *param) 2366 + { 2367 + struct cgroup_fs_context *ctx = cgroup_fc2context(fc); 2368 + struct fs_parse_result result; 2369 + int opt; 2370 + 2371 + opt = fs_parse(fc, cpuset_fs_parameters, param, &result); 2372 + if (opt < 0) 2373 + return opt; 2374 + 2375 + switch (opt) { 2376 + case Opt_cpuset_v2_mode: 2377 + ctx->flags |= CGRP_ROOT_CPUSET_V2_MODE; 2378 + return 0; 2379 + } 2380 + return -EINVAL; 2381 + } 2382 + 2356 2383 static const struct fs_context_operations cpuset_fs_context_ops = { 2357 2384 .get_tree = cgroup1_get_tree, 2358 2385 .free = cgroup_fs_context_free, 2386 + .parse_param = cpuset_parse_param, 2359 2387 }; 2360 2388 2361 2389 /* ··· 2420 2392 static struct file_system_type cpuset_fs_type = { 2421 2393 .name = "cpuset", 2422 2394 .init_fs_context = cpuset_init_fs_context, 2395 + .parameters = cpuset_fs_parameters, 2423 2396 .fs_flags = FS_USERNS_MOUNT, 2424 2397 }; 2425 2398 #endif
+42 -7
kernel/sched/cpufreq_schedutil.c
··· 81 81 if (!cpufreq_this_cpu_can_update(sg_policy->policy)) 82 82 return false; 83 83 84 - if (unlikely(sg_policy->limits_changed)) { 85 - sg_policy->limits_changed = false; 86 - sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS); 84 + if (unlikely(READ_ONCE(sg_policy->limits_changed))) { 85 + WRITE_ONCE(sg_policy->limits_changed, false); 86 + sg_policy->need_freq_update = true; 87 + 88 + /* 89 + * The above limits_changed update must occur before the reads 90 + * of policy limits in cpufreq_driver_resolve_freq() or a policy 91 + * limits update might be missed, so use a memory barrier to 92 + * ensure it. 93 + * 94 + * This pairs with the write memory barrier in sugov_limits(). 95 + */ 96 + smp_mb(); 97 + 98 + return true; 99 + } else if (sg_policy->need_freq_update) { 100 + /* ignore_dl_rate_limit() wants a new frequency to be found. */ 87 101 return true; 88 102 } 89 103 ··· 109 95 static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time, 110 96 unsigned int next_freq) 111 97 { 112 - if (sg_policy->need_freq_update) 98 + if (sg_policy->need_freq_update) { 113 99 sg_policy->need_freq_update = false; 114 - else if (sg_policy->next_freq == next_freq) 100 + /* 101 + * The policy limits have changed, but if the return value of 102 + * cpufreq_driver_resolve_freq() after applying the new limits 103 + * is still equal to the previously selected frequency, the 104 + * driver callback need not be invoked unless the driver 105 + * specifically wants that to happen on every update of the 106 + * policy limits. 107 + */ 108 + if (sg_policy->next_freq == next_freq && 109 + !cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS)) 110 + return false; 111 + } else if (sg_policy->next_freq == next_freq) { 115 112 return false; 113 + } 116 114 117 115 sg_policy->next_freq = next_freq; 118 116 sg_policy->last_freq_update_time = time; ··· 391 365 static inline void ignore_dl_rate_limit(struct sugov_cpu *sg_cpu) 392 366 { 393 367 if (cpu_bw_dl(cpu_rq(sg_cpu->cpu)) > sg_cpu->bw_min) 394 - sg_cpu->sg_policy->limits_changed = true; 368 + sg_cpu->sg_policy->need_freq_update = true; 395 369 } 396 370 397 371 static inline bool sugov_update_single_common(struct sugov_cpu *sg_cpu, ··· 897 871 mutex_unlock(&sg_policy->work_lock); 898 872 } 899 873 900 - sg_policy->limits_changed = true; 874 + /* 875 + * The limits_changed update below must take place before the updates 876 + * of policy limits in cpufreq_set_policy() or a policy limits update 877 + * might be missed, so use a memory barrier to ensure it. 878 + * 879 + * This pairs with the memory barrier in sugov_should_update_freq(). 880 + */ 881 + smp_wmb(); 882 + 883 + WRITE_ONCE(sg_policy->limits_changed, true); 901 884 } 902 885 903 886 struct cpufreq_governor schedutil_gov = {
+7 -43
kernel/sched/ext.c
··· 163 163 /* 164 164 * CPU cgroup support flags 165 165 */ 166 - SCX_OPS_HAS_CGROUP_WEIGHT = 1LLU << 16, /* cpu.weight */ 166 + SCX_OPS_HAS_CGROUP_WEIGHT = 1LLU << 16, /* DEPRECATED, will be removed on 6.18 */ 167 167 168 168 SCX_OPS_ALL_FLAGS = SCX_OPS_KEEP_BUILTIN_IDLE | 169 169 SCX_OPS_ENQ_LAST | ··· 3899 3899 3900 3900 DEFINE_STATIC_PERCPU_RWSEM(scx_cgroup_rwsem); 3901 3901 static bool scx_cgroup_enabled; 3902 - static bool cgroup_warned_missing_weight; 3903 - static bool cgroup_warned_missing_idle; 3904 - 3905 - static void scx_cgroup_warn_missing_weight(struct task_group *tg) 3906 - { 3907 - if (scx_ops_enable_state() == SCX_OPS_DISABLED || 3908 - cgroup_warned_missing_weight) 3909 - return; 3910 - 3911 - if ((scx_ops.flags & SCX_OPS_HAS_CGROUP_WEIGHT) || !tg->css.parent) 3912 - return; 3913 - 3914 - pr_warn("sched_ext: \"%s\" does not implement cgroup cpu.weight\n", 3915 - scx_ops.name); 3916 - cgroup_warned_missing_weight = true; 3917 - } 3918 - 3919 - static void scx_cgroup_warn_missing_idle(struct task_group *tg) 3920 - { 3921 - if (!scx_cgroup_enabled || cgroup_warned_missing_idle) 3922 - return; 3923 - 3924 - if (!tg->idle) 3925 - return; 3926 - 3927 - pr_warn("sched_ext: \"%s\" does not implement cgroup cpu.idle\n", 3928 - scx_ops.name); 3929 - cgroup_warned_missing_idle = true; 3930 - } 3931 3902 3932 3903 int scx_tg_online(struct task_group *tg) 3933 3904 { ··· 3907 3936 WARN_ON_ONCE(tg->scx_flags & (SCX_TG_ONLINE | SCX_TG_INITED)); 3908 3937 3909 3938 percpu_down_read(&scx_cgroup_rwsem); 3910 - 3911 - scx_cgroup_warn_missing_weight(tg); 3912 3939 3913 3940 if (scx_cgroup_enabled) { 3914 3941 if (SCX_HAS_OP(cgroup_init)) { ··· 4045 4076 4046 4077 void scx_group_set_idle(struct task_group *tg, bool idle) 4047 4078 { 4048 - percpu_down_read(&scx_cgroup_rwsem); 4049 - scx_cgroup_warn_missing_idle(tg); 4050 - percpu_up_read(&scx_cgroup_rwsem); 4079 + /* TODO: Implement ops->cgroup_set_idle() */ 4051 4080 } 4052 4081 4053 4082 static void scx_cgroup_lock(void) ··· 4239 4272 4240 4273 percpu_rwsem_assert_held(&scx_cgroup_rwsem); 4241 4274 4242 - cgroup_warned_missing_weight = false; 4243 - cgroup_warned_missing_idle = false; 4244 - 4245 4275 /* 4246 4276 * scx_tg_on/offline() are excluded through scx_cgroup_rwsem. If we walk 4247 4277 * cgroups and init, all online cgroups are initialized. ··· 4247 4283 css_for_each_descendant_pre(css, &root_task_group.css) { 4248 4284 struct task_group *tg = css_tg(css); 4249 4285 struct scx_cgroup_init_args args = { .weight = tg->scx_weight }; 4250 - 4251 - scx_cgroup_warn_missing_weight(tg); 4252 - scx_cgroup_warn_missing_idle(tg); 4253 4286 4254 4287 if ((tg->scx_flags & 4255 4288 (SCX_TG_ONLINE | SCX_TG_INITED)) != SCX_TG_ONLINE) ··· 4584 4623 4585 4624 static void free_exit_info(struct scx_exit_info *ei) 4586 4625 { 4587 - kfree(ei->dump); 4626 + kvfree(ei->dump); 4588 4627 kfree(ei->msg); 4589 4628 kfree(ei->bt); 4590 4629 kfree(ei); ··· 4600 4639 4601 4640 ei->bt = kcalloc(SCX_EXIT_BT_LEN, sizeof(ei->bt[0]), GFP_KERNEL); 4602 4641 ei->msg = kzalloc(SCX_EXIT_MSG_LEN, GFP_KERNEL); 4603 - ei->dump = kzalloc(exit_dump_len, GFP_KERNEL); 4642 + ei->dump = kvzalloc(exit_dump_len, GFP_KERNEL); 4604 4643 4605 4644 if (!ei->bt || !ei->msg || !ei->dump) { 4606 4645 free_exit_info(ei); ··· 5212 5251 scx_ops_error("SCX_OPS_BUILTIN_IDLE_PER_NODE requires CPU idle selection enabled"); 5213 5252 return -EINVAL; 5214 5253 } 5254 + 5255 + if (ops->flags & SCX_OPS_HAS_CGROUP_WEIGHT) 5256 + pr_warn("SCX_OPS_HAS_CGROUP_WEIGHT is deprecated and a noop\n"); 5215 5257 5216 5258 return 0; 5217 5259 }
+19 -8
kernel/trace/ftrace.c
··· 1297 1297 return; 1298 1298 free_ftrace_hash(ops->func_hash->filter_hash); 1299 1299 free_ftrace_hash(ops->func_hash->notrace_hash); 1300 + ops->func_hash->filter_hash = EMPTY_HASH; 1301 + ops->func_hash->notrace_hash = EMPTY_HASH; 1300 1302 } 1301 1303 EXPORT_SYMBOL_GPL(ftrace_free_filter); 1302 1304 ··· 3445 3443 size_bits); 3446 3444 if (ret < 0) { 3447 3445 free_ftrace_hash(*filter_hash); 3446 + *filter_hash = EMPTY_HASH; 3448 3447 return ret; 3449 3448 } 3450 3449 } ··· 3475 3472 subops_hash->notrace_hash); 3476 3473 if (ret < 0) { 3477 3474 free_ftrace_hash(*notrace_hash); 3475 + *notrace_hash = EMPTY_HASH; 3478 3476 return ret; 3479 3477 } 3480 3478 } ··· 3494 3490 */ 3495 3491 int ftrace_startup_subops(struct ftrace_ops *ops, struct ftrace_ops *subops, int command) 3496 3492 { 3497 - struct ftrace_hash *filter_hash; 3498 - struct ftrace_hash *notrace_hash; 3493 + struct ftrace_hash *filter_hash = EMPTY_HASH; 3494 + struct ftrace_hash *notrace_hash = EMPTY_HASH; 3499 3495 struct ftrace_hash *save_filter_hash; 3500 3496 struct ftrace_hash *save_notrace_hash; 3501 3497 int ret; ··· 3609 3605 } 3610 3606 } 3611 3607 3608 + free_ftrace_hash(temp_hash.filter_hash); 3609 + free_ftrace_hash(temp_hash.notrace_hash); 3610 + 3612 3611 temp_hash.filter_hash = *filter_hash; 3613 3612 temp_hash.notrace_hash = *notrace_hash; 3614 3613 } ··· 3632 3625 */ 3633 3626 int ftrace_shutdown_subops(struct ftrace_ops *ops, struct ftrace_ops *subops, int command) 3634 3627 { 3635 - struct ftrace_hash *filter_hash; 3636 - struct ftrace_hash *notrace_hash; 3628 + struct ftrace_hash *filter_hash = EMPTY_HASH; 3629 + struct ftrace_hash *notrace_hash = EMPTY_HASH; 3637 3630 int ret; 3638 3631 3639 3632 if (unlikely(ftrace_disabled)) ··· 3706 3699 } 3707 3700 3708 3701 ret = rebuild_hashes(&filter_hash, &notrace_hash, ops); 3709 - if (!ret) 3702 + if (!ret) { 3710 3703 ret = ftrace_update_ops(ops, filter_hash, notrace_hash); 3704 + free_ftrace_hash(filter_hash); 3705 + free_ftrace_hash(notrace_hash); 3706 + } 3711 3707 3712 3708 if (ret) { 3713 3709 /* Put back the original hash */ ··· 5964 5954 5965 5955 /* Make a copy hash to place the new and the old entries in */ 5966 5956 size = hash->count + direct_functions->count; 5967 - if (size > 32) 5968 - size = 32; 5969 - new_hash = alloc_ftrace_hash(fls(size)); 5957 + size = fls(size); 5958 + if (size > FTRACE_HASH_MAX_BITS) 5959 + size = FTRACE_HASH_MAX_BITS; 5960 + new_hash = alloc_ftrace_hash(size); 5970 5961 if (!new_hash) 5971 5962 goto out_unlock; 5972 5963
+2 -2
kernel/trace/trace_entries.h
··· 80 80 F_STRUCT( 81 81 __field_struct( struct ftrace_graph_ent, graph_ent ) 82 82 __field_packed( unsigned long, graph_ent, func ) 83 - __field_packed( unsigned long, graph_ent, depth ) 83 + __field_packed( unsigned int, graph_ent, depth ) 84 84 __dynamic_array(unsigned long, args ) 85 85 ), 86 86 87 - F_printk("--> %ps (%lu)", (void *)__entry->func, __entry->depth) 87 + F_printk("--> %ps (%u)", (void *)__entry->func, __entry->depth) 88 88 ); 89 89 90 90 #ifdef CONFIG_FUNCTION_GRAPH_RETADDR
+2 -2
kernel/trace/trace_events_filter.c
··· 808 808 kstr = ubuf->buffer; 809 809 810 810 /* For safety, do not trust the string pointer */ 811 - if (!strncpy_from_kernel_nofault(kstr, str, USTRING_BUF_SIZE)) 811 + if (strncpy_from_kernel_nofault(kstr, str, USTRING_BUF_SIZE) < 0) 812 812 return NULL; 813 813 return kstr; 814 814 } ··· 827 827 828 828 /* user space address? */ 829 829 ustr = (char __user *)str; 830 - if (!strncpy_from_user_nofault(kstr, ustr, USTRING_BUF_SIZE)) 830 + if (strncpy_from_user_nofault(kstr, ustr, USTRING_BUF_SIZE) < 0) 831 831 return NULL; 832 832 833 833 return kstr;
+1 -1
kernel/vhost_task.c
··· 111 111 * @arg: data to be passed to fn and handled_kill 112 112 * @name: the thread's name 113 113 * 114 - * This returns a specialized task for use by the vhost layer or NULL on 114 + * This returns a specialized task for use by the vhost layer or ERR_PTR() on 115 115 * failure. The returned task is inactive, and the caller must fire it up 116 116 * through vhost_task_start(). 117 117 */
+1 -1
lib/Kconfig.debug
··· 3290 3290 config PRIME_NUMBERS_KUNIT_TEST 3291 3291 tristate "Prime number generator test" if !KUNIT_ALL_TESTS 3292 3292 depends on KUNIT 3293 - select PRIME_NUMBERS 3293 + depends on PRIME_NUMBERS 3294 3294 default KUNIT_ALL_TESTS 3295 3295 help 3296 3296 This option enables the KUnit test suite for the {is,next}_prime_number
-1
lib/Kconfig.ubsan
··· 118 118 119 119 config UBSAN_INTEGER_WRAP 120 120 bool "Perform checking for integer arithmetic wrap-around" 121 - default UBSAN 122 121 depends on !COMPILE_TEST 123 122 depends on $(cc-option,-fsanitize-undefined-ignore-overflow-pattern=all) 124 123 depends on $(cc-option,-fsanitize=signed-integer-overflow)
+10 -3
lib/string.c
··· 119 119 if (count == 0 || WARN_ON_ONCE(count > INT_MAX)) 120 120 return -E2BIG; 121 121 122 + #ifndef CONFIG_DCACHE_WORD_ACCESS 122 123 #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 123 124 /* 124 125 * If src is unaligned, don't cross a page boundary, ··· 135 134 if (((long) dest | (long) src) & (sizeof(long) - 1)) 136 135 max = 0; 137 136 #endif 137 + #endif 138 138 139 139 /* 140 - * read_word_at_a_time() below may read uninitialized bytes after the 141 - * trailing zero and use them in comparisons. Disable this optimization 142 - * under KMSAN to prevent false positive reports. 140 + * load_unaligned_zeropad() or read_word_at_a_time() below may read 141 + * uninitialized bytes after the trailing zero and use them in 142 + * comparisons. Disable this optimization under KMSAN to prevent 143 + * false positive reports. 143 144 */ 144 145 if (IS_ENABLED(CONFIG_KMSAN)) 145 146 max = 0; ··· 149 146 while (max >= sizeof(unsigned long)) { 150 147 unsigned long c, data; 151 148 149 + #ifdef CONFIG_DCACHE_WORD_ACCESS 150 + c = load_unaligned_zeropad(src+res); 151 + #else 152 152 c = read_word_at_a_time(src+res); 153 + #endif 153 154 if (has_zero(c, &data, &constants)) { 154 155 data = prep_zero_mask(c, data, &constants); 155 156 data = create_zero_mask(data);
+11 -7
lib/test_ubsan.c
··· 77 77 78 78 static void test_ubsan_out_of_bounds(void) 79 79 { 80 - volatile int i = 4, j = 5, k = -1; 81 - volatile char above[4] = { }; /* Protect surrounding memory. */ 82 - volatile int arr[4]; 83 - volatile char below[4] = { }; /* Protect surrounding memory. */ 80 + int i = 4, j = 4, k = -1; 81 + volatile struct { 82 + char above[4]; /* Protect surrounding memory. */ 83 + int arr[4]; 84 + char below[4]; /* Protect surrounding memory. */ 85 + } data; 84 86 85 - above[0] = below[0]; 87 + OPTIMIZER_HIDE_VAR(i); 88 + OPTIMIZER_HIDE_VAR(j); 89 + OPTIMIZER_HIDE_VAR(k); 86 90 87 91 UBSAN_TEST(CONFIG_UBSAN_BOUNDS, "above"); 88 - arr[j] = i; 92 + data.arr[j] = i; 89 93 90 94 UBSAN_TEST(CONFIG_UBSAN_BOUNDS, "below"); 91 - arr[k] = i; 95 + data.arr[k] = i; 92 96 } 93 97 94 98 enum ubsan_test_enum {
+2 -2
mm/gup.c
··· 2207 2207 } while (start != end); 2208 2208 mmap_read_unlock(mm); 2209 2209 2210 - if (size > (unsigned long)uaddr - start) 2211 - return size - ((unsigned long)uaddr - start); 2210 + if (size > start - (unsigned long)uaddr) 2211 + return size - (start - (unsigned long)uaddr); 2212 2212 return 0; 2213 2213 } 2214 2214 EXPORT_SYMBOL(fault_in_safe_writeable);
+3 -3
mm/hugetlb_vmemmap.c
··· 238 238 * struct page, the special metadata (e.g. page->flags or page->mapping) 239 239 * cannot copy to the tail struct page structs. The invalid value will be 240 240 * checked in the free_tail_page_prepare(). In order to avoid the message 241 - * of "corrupted mapping in tail page". We need to reset at least 3 (one 242 - * head struct page struct and two tail struct page structs) struct page 241 + * of "corrupted mapping in tail page". We need to reset at least 4 (one 242 + * head struct page struct and three tail struct page structs) struct page 243 243 * structs. 244 244 */ 245 - #define NR_RESET_STRUCT_PAGE 3 245 + #define NR_RESET_STRUCT_PAGE 4 246 246 247 247 static inline void reset_struct_pages(struct page *start) 248 248 {
+1
mm/internal.h
··· 1595 1595 1596 1596 #ifdef CONFIG_UNACCEPTED_MEMORY 1597 1597 void accept_page(struct page *page); 1598 + void unaccepted_cleanup_work(struct work_struct *work); 1598 1599 #else /* CONFIG_UNACCEPTED_MEMORY */ 1599 1600 static inline void accept_page(struct page *page) 1600 1601 {
+20
mm/kasan/kasan_test_c.c
··· 1567 1567 static void kasan_strings(struct kunit *test) 1568 1568 { 1569 1569 char *ptr; 1570 + char *src; 1570 1571 size_t size = 24; 1571 1572 1572 1573 /* ··· 1579 1578 ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO); 1580 1579 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); 1581 1580 1581 + src = kmalloc(KASAN_GRANULE_SIZE, GFP_KERNEL | __GFP_ZERO); 1582 + strscpy(src, "f0cacc1a0000000", KASAN_GRANULE_SIZE); 1583 + 1584 + /* 1585 + * Make sure that strscpy() does not trigger KASAN if it overreads into 1586 + * poisoned memory. 1587 + * 1588 + * The expected size does not include the terminator '\0' 1589 + * so it is (KASAN_GRANULE_SIZE - 2) == 1590 + * KASAN_GRANULE_SIZE - ("initial removed character" + "\0"). 1591 + */ 1592 + KUNIT_EXPECT_EQ(test, KASAN_GRANULE_SIZE - 2, 1593 + strscpy(ptr, src + 1, KASAN_GRANULE_SIZE)); 1594 + 1595 + /* strscpy should fail if the first byte is unreadable. */ 1596 + KUNIT_EXPECT_KASAN_FAIL(test, strscpy(ptr, src + KASAN_GRANULE_SIZE, 1597 + KASAN_GRANULE_SIZE)); 1598 + 1599 + kfree(src); 1582 1600 kfree(ptr); 1583 1601 1584 1602 /*
+1 -1
mm/memcontrol-v1.c
··· 620 620 mem_cgroup_id_get_many(swap_memcg, nr_entries - 1); 621 621 mod_memcg_state(swap_memcg, MEMCG_SWAP, nr_entries); 622 622 623 - swap_cgroup_record(folio, mem_cgroup_id(memcg), entry); 623 + swap_cgroup_record(folio, mem_cgroup_id(swap_memcg), entry); 624 624 625 625 folio_unqueue_deferred_split(folio); 626 626 folio->memcg_data = 0;
+2 -2
mm/memory.c
··· 3734 3734 return false; 3735 3735 3736 3736 VM_WARN_ON_ONCE(folio_test_ksm(folio)); 3737 - VM_WARN_ON_ONCE(folio_mapcount(folio) > folio_nr_pages(folio)); 3738 - VM_WARN_ON_ONCE(folio_entire_mapcount(folio)); 3739 3737 3740 3738 if (unlikely(folio_test_swapcache(folio))) { 3741 3739 /* ··· 3758 3760 if (folio_large_mapcount(folio) != folio_ref_count(folio)) 3759 3761 goto unlock; 3760 3762 3763 + VM_WARN_ON_ONCE_FOLIO(folio_large_mapcount(folio) > folio_nr_pages(folio), folio); 3764 + VM_WARN_ON_ONCE_FOLIO(folio_entire_mapcount(folio), folio); 3761 3765 VM_WARN_ON_ONCE(folio_mm_id(folio, 0) != vma->vm_mm->mm_id && 3762 3766 folio_mm_id(folio, 1) != vma->vm_mm->mm_id); 3763 3767
+1
mm/mm_init.c
··· 1441 1441 1442 1442 #ifdef CONFIG_UNACCEPTED_MEMORY 1443 1443 INIT_LIST_HEAD(&zone->unaccepted_pages); 1444 + INIT_WORK(&zone->unaccepted_cleanup, unaccepted_cleanup_work); 1444 1445 #endif 1445 1446 } 1446 1447
+26 -14
mm/page_alloc.c
··· 3466 3466 return false; 3467 3467 } 3468 3468 3469 - bool zone_watermark_ok_safe(struct zone *z, unsigned int order, 3470 - unsigned long mark, int highest_zoneidx) 3471 - { 3472 - long free_pages = zone_page_state(z, NR_FREE_PAGES); 3473 - 3474 - if (z->percpu_drift_mark && free_pages < z->percpu_drift_mark) 3475 - free_pages = zone_page_state_snapshot(z, NR_FREE_PAGES); 3476 - 3477 - return __zone_watermark_ok(z, order, mark, highest_zoneidx, 0, 3478 - free_pages); 3479 - } 3480 - 3481 3469 #ifdef CONFIG_NUMA 3482 3470 int __read_mostly node_reclaim_distance = RECLAIM_DISTANCE; 3483 3471 ··· 7175 7187 7176 7188 static bool lazy_accept = true; 7177 7189 7190 + void unaccepted_cleanup_work(struct work_struct *work) 7191 + { 7192 + static_branch_dec(&zones_with_unaccepted_pages); 7193 + } 7194 + 7178 7195 static int __init accept_memory_parse(char *p) 7179 7196 { 7180 7197 if (!strcmp(p, "lazy")) { ··· 7218 7225 7219 7226 __free_pages_ok(page, MAX_PAGE_ORDER, FPI_TO_TAIL); 7220 7227 7221 - if (last) 7222 - static_branch_dec(&zones_with_unaccepted_pages); 7228 + if (last) { 7229 + /* 7230 + * There are two corner cases: 7231 + * 7232 + * - If allocation occurs during the CPU bring up, 7233 + * static_branch_dec() cannot be used directly as 7234 + * it causes a deadlock on cpu_hotplug_lock. 7235 + * 7236 + * Instead, use schedule_work() to prevent deadlock. 7237 + * 7238 + * - If allocation occurs before workqueues are initialized, 7239 + * static_branch_dec() should be called directly. 7240 + * 7241 + * Workqueues are initialized before CPU bring up, so this 7242 + * will not conflict with the first scenario. 7243 + */ 7244 + if (system_wq) 7245 + schedule_work(&zone->unaccepted_cleanup); 7246 + else 7247 + unaccepted_cleanup_work(&zone->unaccepted_cleanup); 7248 + } 7223 7249 } 7224 7250 7225 7251 void accept_page(struct page *page)
+26 -3
mm/vmscan.c
··· 6736 6736 * meet watermarks. 6737 6737 */ 6738 6738 for_each_managed_zone_pgdat(zone, pgdat, i, highest_zoneidx) { 6739 + enum zone_stat_item item; 6739 6740 unsigned long free_pages; 6740 6741 6741 6742 if (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) ··· 6747 6746 /* 6748 6747 * In defrag_mode, watermarks must be met in whole 6749 6748 * blocks to avoid polluting allocator fallbacks. 6749 + * 6750 + * However, kswapd usually cannot accomplish this on 6751 + * its own and needs kcompactd support. Once it's 6752 + * reclaimed a compaction gap, and kswapd_shrink_node 6753 + * has dropped order, simply ensure there are enough 6754 + * base pages for compaction, wake kcompactd & sleep. 6750 6755 */ 6751 - if (defrag_mode) 6752 - free_pages = zone_page_state(zone, NR_FREE_PAGES_BLOCKS); 6756 + if (defrag_mode && order) 6757 + item = NR_FREE_PAGES_BLOCKS; 6753 6758 else 6754 - free_pages = zone_page_state(zone, NR_FREE_PAGES); 6759 + item = NR_FREE_PAGES; 6760 + 6761 + /* 6762 + * When there is a high number of CPUs in the system, 6763 + * the cumulative error from the vmstat per-cpu cache 6764 + * can blur the line between the watermarks. In that 6765 + * case, be safe and get an accurate snapshot. 6766 + * 6767 + * TODO: NR_FREE_PAGES_BLOCKS moves in steps of 6768 + * pageblock_nr_pages, while the vmstat pcp threshold 6769 + * is limited to 125. On many configurations that 6770 + * counter won't actually be per-cpu cached. But keep 6771 + * things simple for now; revisit when somebody cares. 6772 + */ 6773 + free_pages = zone_page_state(zone, item); 6774 + if (zone->percpu_drift_mark && free_pages < zone->percpu_drift_mark) 6775 + free_pages = zone_page_state_snapshot(zone, item); 6755 6776 6756 6777 if (__zone_watermark_ok(zone, order, mark, highest_zoneidx, 6757 6778 0, free_pages))
+20 -6
net/core/lwtunnel.c
··· 333 333 struct dst_entry *dst; 334 334 int ret; 335 335 336 + local_bh_disable(); 337 + 336 338 if (dev_xmit_recursion()) { 337 339 net_crit_ratelimited("%s(): recursion limit reached on datapath\n", 338 340 __func__); ··· 350 348 lwtstate = dst->lwtstate; 351 349 352 350 if (lwtstate->type == LWTUNNEL_ENCAP_NONE || 353 - lwtstate->type > LWTUNNEL_ENCAP_MAX) 354 - return 0; 351 + lwtstate->type > LWTUNNEL_ENCAP_MAX) { 352 + ret = 0; 353 + goto out; 354 + } 355 355 356 356 ret = -EOPNOTSUPP; 357 357 rcu_read_lock(); ··· 368 364 if (ret == -EOPNOTSUPP) 369 365 goto drop; 370 366 371 - return ret; 367 + goto out; 372 368 373 369 drop: 374 370 kfree_skb(skb); 375 371 372 + out: 373 + local_bh_enable(); 376 374 return ret; 377 375 } 378 376 EXPORT_SYMBOL_GPL(lwtunnel_output); ··· 385 379 struct lwtunnel_state *lwtstate; 386 380 struct dst_entry *dst; 387 381 int ret; 382 + 383 + local_bh_disable(); 388 384 389 385 if (dev_xmit_recursion()) { 390 386 net_crit_ratelimited("%s(): recursion limit reached on datapath\n", ··· 404 396 lwtstate = dst->lwtstate; 405 397 406 398 if (lwtstate->type == LWTUNNEL_ENCAP_NONE || 407 - lwtstate->type > LWTUNNEL_ENCAP_MAX) 408 - return 0; 399 + lwtstate->type > LWTUNNEL_ENCAP_MAX) { 400 + ret = 0; 401 + goto out; 402 + } 409 403 410 404 ret = -EOPNOTSUPP; 411 405 rcu_read_lock(); ··· 422 412 if (ret == -EOPNOTSUPP) 423 413 goto drop; 424 414 425 - return ret; 415 + goto out; 426 416 427 417 drop: 428 418 kfree_skb(skb); 429 419 420 + out: 421 + local_bh_enable(); 430 422 return ret; 431 423 } 432 424 EXPORT_SYMBOL_GPL(lwtunnel_xmit); ··· 439 427 struct lwtunnel_state *lwtstate; 440 428 struct dst_entry *dst; 441 429 int ret; 430 + 431 + DEBUG_NET_WARN_ON_ONCE(!in_softirq()); 442 432 443 433 if (dev_xmit_recursion()) { 444 434 net_crit_ratelimited("%s(): recursion limit reached on datapath\n",
+6 -3
net/core/netdev-genl.c
··· 860 860 861 861 mutex_lock(&priv->lock); 862 862 863 + err = 0; 863 864 netdev = netdev_get_by_index_lock(genl_info_net(info), ifindex); 864 - if (!netdev || !netif_device_present(netdev)) { 865 + if (!netdev) { 865 866 err = -ENODEV; 866 867 goto err_unlock_sock; 867 868 } 868 - 869 - if (!netdev_need_ops_lock(netdev)) { 869 + if (!netif_device_present(netdev)) 870 + err = -ENODEV; 871 + else if (!netdev_need_ops_lock(netdev)) 870 872 err = -EOPNOTSUPP; 873 + if (err) { 871 874 NL_SET_BAD_ATTR(info->extack, 872 875 info->attrs[NETDEV_A_DEV_IFINDEX]); 873 876 goto err_unlock;
+13 -5
net/core/selftests.c
··· 100 100 ehdr->h_proto = htons(ETH_P_IP); 101 101 102 102 if (attr->tcp) { 103 + memset(thdr, 0, sizeof(*thdr)); 103 104 thdr->source = htons(attr->sport); 104 105 thdr->dest = htons(attr->dport); 105 106 thdr->doff = sizeof(struct tcphdr) / 4; 106 - thdr->check = 0; 107 107 } else { 108 108 uhdr->source = htons(attr->sport); 109 109 uhdr->dest = htons(attr->dport); ··· 144 144 attr->id = net_test_next_id; 145 145 shdr->id = net_test_next_id++; 146 146 147 - if (attr->size) 148 - skb_put(skb, attr->size); 149 - if (attr->max_size && attr->max_size > skb->len) 150 - skb_put(skb, attr->max_size - skb->len); 147 + if (attr->size) { 148 + void *payload = skb_put(skb, attr->size); 149 + 150 + memset(payload, 0, attr->size); 151 + } 152 + 153 + if (attr->max_size && attr->max_size > skb->len) { 154 + size_t pad_len = attr->max_size - skb->len; 155 + void *pad = skb_put(skb, pad_len); 156 + 157 + memset(pad, 0, pad_len); 158 + } 151 159 152 160 skb->csum = 0; 153 161 skb->ip_summed = CHECKSUM_PARTIAL;
+7 -1
net/mac80211/status.c
··· 1085 1085 1086 1086 ieee80211_report_used_skb(local, skb, false, status->ack_hwtstamp); 1087 1087 1088 - if (status->free_list) 1088 + /* 1089 + * This is a bit racy but we can avoid a lot of work 1090 + * with this test... 1091 + */ 1092 + if (local->tx_mntrs) 1093 + ieee80211_tx_monitor(local, skb, retry_count, status); 1094 + else if (status->free_list) 1089 1095 list_add_tail(&skb->list, status->free_list); 1090 1096 else 1091 1097 dev_kfree_skb(skb);
+5 -1
net/mptcp/pm_userspace.c
··· 337 337 338 338 release_sock(sk); 339 339 340 - sock_kfree_s(sk, match, sizeof(*match)); 340 + kfree_rcu_mightsleep(match); 341 + /* Adjust sk_omem_alloc like sock_kfree_s() does, to match 342 + * with allocation of this memory by sock_kmemdup() 343 + */ 344 + atomic_sub(sizeof(*match), &sk->sk_omem_alloc); 341 345 342 346 err = 0; 343 347 out:
+17 -6
net/sched/sch_hfsc.c
··· 961 961 962 962 if (cl != NULL) { 963 963 int old_flags; 964 + int len = 0; 964 965 965 966 if (parentid) { 966 967 if (cl->cl_parent && ··· 992 991 if (usc != NULL) 993 992 hfsc_change_usc(cl, usc, cur_time); 994 993 994 + if (cl->qdisc->q.qlen != 0) 995 + len = qdisc_peek_len(cl->qdisc); 996 + /* Check queue length again since some qdisc implementations 997 + * (e.g., netem/codel) might empty the queue during the peek 998 + * operation. 999 + */ 995 1000 if (cl->qdisc->q.qlen != 0) { 996 - int len = qdisc_peek_len(cl->qdisc); 997 - 998 1001 if (cl->cl_flags & HFSC_RSC) { 999 1002 if (old_flags & HFSC_RSC) 1000 1003 update_ed(cl, len); ··· 1641 1636 if (cl->qdisc->q.qlen != 0) { 1642 1637 /* update ed */ 1643 1638 next_len = qdisc_peek_len(cl->qdisc); 1644 - if (realtime) 1645 - update_ed(cl, next_len); 1646 - else 1647 - update_d(cl, next_len); 1639 + /* Check queue length again since some qdisc implementations 1640 + * (e.g., netem/codel) might empty the queue during the peek 1641 + * operation. 1642 + */ 1643 + if (cl->qdisc->q.qlen != 0) { 1644 + if (realtime) 1645 + update_ed(cl, next_len); 1646 + else 1647 + update_d(cl, next_len); 1648 + } 1648 1649 } else { 1649 1650 /* the class becomes passive */ 1650 1651 eltree_remove(cl);
+2 -1
net/tipc/monitor.c
··· 716 716 if (!mon) 717 717 continue; 718 718 write_lock_bh(&mon->lock); 719 - mon->self->addr = tipc_own_addr(net); 719 + if (mon->self) 720 + mon->self->addr = tipc_own_addr(net); 720 721 write_unlock_bh(&mon->lock); 721 722 } 722 723 }
+1 -1
rust/Makefile
··· 368 368 $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE 369 369 $(call if_changed_dep,bindgen) 370 370 371 - rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ && $$3!~/__odr_asan/ { printf $(2),$$3 }' 371 + rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__(pfx|cfi|odr_asan)/ { printf $(2),$$3 }' 372 372 373 373 quiet_cmd_exports = EXPORTS $@ 374 374 cmd_exports = \
+16
rust/helpers/dma.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/dma-mapping.h> 4 + 5 + void *rust_helper_dma_alloc_attrs(struct device *dev, size_t size, 6 + dma_addr_t *dma_handle, gfp_t flag, 7 + unsigned long attrs) 8 + { 9 + return dma_alloc_attrs(dev, size, dma_handle, flag, attrs); 10 + } 11 + 12 + void rust_helper_dma_free_attrs(struct device *dev, size_t size, void *cpu_addr, 13 + dma_addr_t dma_handle, unsigned long attrs) 14 + { 15 + dma_free_attrs(dev, size, cpu_addr, dma_handle, attrs); 16 + }
+1
rust/helpers/helpers.c
··· 14 14 #include "cpumask.c" 15 15 #include "cred.c" 16 16 #include "device.c" 17 + #include "dma.c" 17 18 #include "err.c" 18 19 #include "fs.c" 19 20 #include "io.c"
+17 -17
rust/helpers/io.c
··· 7 7 return ioremap(offset, size); 8 8 } 9 9 10 - void rust_helper_iounmap(volatile void __iomem *addr) 10 + void rust_helper_iounmap(void __iomem *addr) 11 11 { 12 12 iounmap(addr); 13 13 } 14 14 15 - u8 rust_helper_readb(const volatile void __iomem *addr) 15 + u8 rust_helper_readb(const void __iomem *addr) 16 16 { 17 17 return readb(addr); 18 18 } 19 19 20 - u16 rust_helper_readw(const volatile void __iomem *addr) 20 + u16 rust_helper_readw(const void __iomem *addr) 21 21 { 22 22 return readw(addr); 23 23 } 24 24 25 - u32 rust_helper_readl(const volatile void __iomem *addr) 25 + u32 rust_helper_readl(const void __iomem *addr) 26 26 { 27 27 return readl(addr); 28 28 } 29 29 30 30 #ifdef CONFIG_64BIT 31 - u64 rust_helper_readq(const volatile void __iomem *addr) 31 + u64 rust_helper_readq(const void __iomem *addr) 32 32 { 33 33 return readq(addr); 34 34 } 35 35 #endif 36 36 37 - void rust_helper_writeb(u8 value, volatile void __iomem *addr) 37 + void rust_helper_writeb(u8 value, void __iomem *addr) 38 38 { 39 39 writeb(value, addr); 40 40 } 41 41 42 - void rust_helper_writew(u16 value, volatile void __iomem *addr) 42 + void rust_helper_writew(u16 value, void __iomem *addr) 43 43 { 44 44 writew(value, addr); 45 45 } 46 46 47 - void rust_helper_writel(u32 value, volatile void __iomem *addr) 47 + void rust_helper_writel(u32 value, void __iomem *addr) 48 48 { 49 49 writel(value, addr); 50 50 } 51 51 52 52 #ifdef CONFIG_64BIT 53 - void rust_helper_writeq(u64 value, volatile void __iomem *addr) 53 + void rust_helper_writeq(u64 value, void __iomem *addr) 54 54 { 55 55 writeq(value, addr); 56 56 } 57 57 #endif 58 58 59 - u8 rust_helper_readb_relaxed(const volatile void __iomem *addr) 59 + u8 rust_helper_readb_relaxed(const void __iomem *addr) 60 60 { 61 61 return readb_relaxed(addr); 62 62 } 63 63 64 - u16 rust_helper_readw_relaxed(const volatile void __iomem *addr) 64 + u16 rust_helper_readw_relaxed(const void __iomem *addr) 65 65 { 66 66 return readw_relaxed(addr); 67 67 } 68 68 69 - u32 rust_helper_readl_relaxed(const volatile void __iomem *addr) 69 + u32 rust_helper_readl_relaxed(const void __iomem *addr) 70 70 { 71 71 return readl_relaxed(addr); 72 72 } 73 73 74 74 #ifdef CONFIG_64BIT 75 - u64 rust_helper_readq_relaxed(const volatile void __iomem *addr) 75 + u64 rust_helper_readq_relaxed(const void __iomem *addr) 76 76 { 77 77 return readq_relaxed(addr); 78 78 } 79 79 #endif 80 80 81 - void rust_helper_writeb_relaxed(u8 value, volatile void __iomem *addr) 81 + void rust_helper_writeb_relaxed(u8 value, void __iomem *addr) 82 82 { 83 83 writeb_relaxed(value, addr); 84 84 } 85 85 86 - void rust_helper_writew_relaxed(u16 value, volatile void __iomem *addr) 86 + void rust_helper_writew_relaxed(u16 value, void __iomem *addr) 87 87 { 88 88 writew_relaxed(value, addr); 89 89 } 90 90 91 - void rust_helper_writel_relaxed(u32 value, volatile void __iomem *addr) 91 + void rust_helper_writel_relaxed(u32 value, void __iomem *addr) 92 92 { 93 93 writel_relaxed(value, addr); 94 94 } 95 95 96 96 #ifdef CONFIG_64BIT 97 - void rust_helper_writeq_relaxed(u64 value, volatile void __iomem *addr) 97 + void rust_helper_writeq_relaxed(u64 value, void __iomem *addr) 98 98 { 99 99 writeq_relaxed(value, addr); 100 100 }
+1 -1
rust/pin-init/examples/pthread_mutex.rs
··· 1 1 // SPDX-License-Identifier: Apache-2.0 OR MIT 2 2 3 - // inspired by https://github.com/nbdd0121/pin-init/blob/trunk/examples/pthread_mutex.rs 3 + // inspired by <https://github.com/nbdd0121/pin-init/blob/trunk/examples/pthread_mutex.rs> 4 4 #![allow(clippy::undocumented_unsafe_blocks)] 5 5 #![cfg_attr(feature = "alloc", feature(allocator_api))] 6 6 #[cfg(not(windows))]
+3 -5
rust/pin-init/src/alloc.rs
··· 17 17 18 18 pub extern crate alloc; 19 19 20 - // SAFETY: All zeros is equivalent to `None` (option layout optimization guarantee). 21 - // 22 - // In this case we are allowed to use `T: ?Sized`, since all zeros is the `None` variant and there 23 - // is no problem with a VTABLE pointer being null. 24 - unsafe impl<T: ?Sized> ZeroableOption for Box<T> {} 20 + // SAFETY: All zeros is equivalent to `None` (option layout optimization guarantee: 21 + // <https://doc.rust-lang.org/stable/std/option/index.html#representation>). 22 + unsafe impl<T> ZeroableOption for Box<T> {} 25 23 26 24 /// Smart pointer that can initialize memory in-place. 27 25 pub trait InPlaceInit<T>: Sized {
+1 -1
rust/pin-init/src/lib.rs
··· 1447 1447 {<T: ?Sized + Zeroable>} UnsafeCell<T>, 1448 1448 1449 1449 // SAFETY: All zeros is equivalent to `None` (option layout optimization guarantee: 1450 - // https://doc.rust-lang.org/stable/std/option/index.html#representation). 1450 + // <https://doc.rust-lang.org/stable/std/option/index.html#representation>). 1451 1451 Option<NonZeroU8>, Option<NonZeroU16>, Option<NonZeroU32>, Option<NonZeroU64>, 1452 1452 Option<NonZeroU128>, Option<NonZeroUsize>, 1453 1453 Option<NonZeroI8>, Option<NonZeroI16>, Option<NonZeroI32>, Option<NonZeroI64>,
+2 -2
scripts/Makefile.compiler
··· 79 79 # Usage: MY_RUSTFLAGS += $(call __rustc-option,$(RUSTC),$(MY_RUSTFLAGS),-Cinstrument-coverage,-Zinstrument-coverage) 80 80 # TODO: remove RUSTC_BOOTSTRAP=1 when we raise the minimum GNU Make version to 4.4 81 81 __rustc-option = $(call try-run,\ 82 - echo '#![allow(missing_docs)]#![feature(no_core)]#![no_core]' | RUSTC_BOOTSTRAP=1\ 83 - $(1) --sysroot=/dev/null $(filter-out --sysroot=/dev/null,$(2)) $(3)\ 82 + echo '$(pound)![allow(missing_docs)]$(pound)![feature(no_core)]$(pound)![no_core]' | RUSTC_BOOTSTRAP=1\ 83 + $(1) --sysroot=/dev/null $(filter-out --sysroot=/dev/null --target=%,$(2)) $(3)\ 84 84 --crate-type=rlib --out-dir=$(TMPOUT) --emit=obj=- - >/dev/null,$(3),$(4)) 85 85 86 86 # rustc-option
+1 -1
scripts/Makefile.extrawarn
··· 15 15 KBUILD_CFLAGS += -Werror=strict-prototypes 16 16 KBUILD_CFLAGS += -Wno-format-security 17 17 KBUILD_CFLAGS += -Wno-trigraphs 18 - KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) 18 + KBUILD_CFLAGS += $(call cc-disable-warning, frame-address) 19 19 KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) 20 20 KBUILD_CFLAGS += -Wmissing-declarations 21 21 KBUILD_CFLAGS += -Wmissing-prototypes
+9 -3
scripts/generate_rust_analyzer.py
··· 112 112 cfg=["kernel"], 113 113 ) 114 114 115 + append_crate( 116 + "ffi", 117 + srctree / "rust" / "ffi.rs", 118 + ["core", "compiler_builtins"], 119 + ) 120 + 115 121 def append_crate_with_generated( 116 122 display_name, 117 123 deps, ··· 137 131 "exclude_dirs": [], 138 132 } 139 133 140 - append_crate_with_generated("bindings", ["core"]) 141 - append_crate_with_generated("uapi", ["core"]) 142 - append_crate_with_generated("kernel", ["core", "macros", "build_error", "pin_init", "bindings", "uapi"]) 134 + append_crate_with_generated("bindings", ["core", "ffi"]) 135 + append_crate_with_generated("uapi", ["core", "ffi"]) 136 + append_crate_with_generated("kernel", ["core", "macros", "build_error", "pin_init", "ffi", "bindings", "uapi"]) 143 137 144 138 def is_root_crate(build_file, target): 145 139 try:
+7
scripts/genksyms/keywords.c
··· 17 17 { "__signed__", SIGNED_KEYW }, 18 18 { "__typeof", TYPEOF_KEYW }, 19 19 { "__typeof__", TYPEOF_KEYW }, 20 + { "__typeof_unqual", TYPEOF_KEYW }, 21 + { "__typeof_unqual__", TYPEOF_KEYW }, 20 22 { "__volatile", VOLATILE_KEYW }, 21 23 { "__volatile__", VOLATILE_KEYW }, 22 24 { "__builtin_va_list", VA_LIST_KEYW }, ··· 42 40 // KAO. }, 43 41 // { "attribute", ATTRIBUTE_KEYW }, 44 42 43 + // X86 named address space qualifiers 44 + { "__seg_gs", X86_SEG_KEYW }, 45 + { "__seg_fs", X86_SEG_KEYW }, 46 + 45 47 { "auto", AUTO_KEYW }, 46 48 { "char", CHAR_KEYW }, 47 49 { "const", CONST_KEYW }, ··· 63 57 { "struct", STRUCT_KEYW }, 64 58 { "typedef", TYPEDEF_KEYW }, 65 59 { "typeof", TYPEOF_KEYW }, 60 + { "typeof_unqual", TYPEOF_KEYW }, 66 61 { "union", UNION_KEYW }, 67 62 { "unsigned", UNSIGNED_KEYW }, 68 63 { "void", VOID_KEYW },
+4 -1
scripts/genksyms/parse.y
··· 91 91 %token TYPEOF_KEYW 92 92 %token VA_LIST_KEYW 93 93 94 + %token X86_SEG_KEYW 95 + 94 96 %token EXPORT_SYMBOL_KEYW 95 97 96 98 %token ASM_PHRASE ··· 294 292 ; 295 293 296 294 type_qualifier: 297 - CONST_KEYW | VOLATILE_KEYW 295 + X86_SEG_KEYW 296 + | CONST_KEYW | VOLATILE_KEYW 298 297 | RESTRICT_KEYW 299 298 { /* restrict has no effect in prototypes so ignore it */ 300 299 remove_node($1);
+1 -1
security/Kconfig.hardening
··· 344 344 345 345 choice 346 346 prompt "Randomize layout of sensitive kernel structures" 347 - default RANDSTRUCT_FULL if COMPILE_TEST && (GCC_PLUGINS || CC_HAS_RANDSTRUCT) 347 + default RANDSTRUCT_FULL if COMPILE_TEST && CC_HAS_RANDSTRUCT 348 348 default RANDSTRUCT_NONE 349 349 help 350 350 If you enable this, the layouts of structures that are entirely
+3 -1
security/integrity/ima/ima_main.c
··· 245 245 &allowed_algos); 246 246 violation_check = ((func == FILE_CHECK || func == MMAP_CHECK || 247 247 func == MMAP_CHECK_REQPROT) && 248 - (ima_policy_flag & IMA_MEASURE)); 248 + (ima_policy_flag & IMA_MEASURE) && 249 + ((action & IMA_MEASURE) || 250 + (file->f_mode & FMODE_WRITE))); 249 251 if (!action && !violation_check) 250 252 return 0; 251 253
+1
tools/objtool/check.c
··· 225 225 str_ends_with(func->name, "_4core9panicking14panic_nounwind") || 226 226 str_ends_with(func->name, "_4core9panicking18panic_bounds_check") || 227 227 str_ends_with(func->name, "_4core9panicking19assert_failed_inner") || 228 + str_ends_with(func->name, "_4core9panicking30panic_null_pointer_dereference") || 228 229 str_ends_with(func->name, "_4core9panicking36panic_misaligned_pointer_dereference") || 229 230 strstr(func->name, "_4core9panicking13assert_failed") || 230 231 strstr(func->name, "_4core9panicking11panic_const24panic_const_") ||
+1 -1
tools/sched_ext/scx_flatcg.bpf.c
··· 950 950 .cgroup_move = (void *)fcg_cgroup_move, 951 951 .init = (void *)fcg_init, 952 952 .exit = (void *)fcg_exit, 953 - .flags = SCX_OPS_HAS_CGROUP_WEIGHT | SCX_OPS_ENQ_EXITING, 953 + .flags = SCX_OPS_ENQ_EXITING, 954 954 .name = "flatcg");
+3 -1
tools/testing/kunit/qemu_configs/sh.py
··· 7 7 CONFIG_MEMORY_START=0x0c000000 8 8 CONFIG_SH_RTS7751R2D=y 9 9 CONFIG_RTS7751R2D_PLUS=y 10 - CONFIG_SERIAL_SH_SCI=y''', 10 + CONFIG_SERIAL_SH_SCI=y 11 + CONFIG_CMDLINE_EXTEND=y 12 + ''', 11 13 qemu_arch='sh4', 12 14 kernel_path='arch/sh/boot/zImage', 13 15 kernel_command_line='console=ttySC1',
+22 -1
tools/testing/selftests/ftrace/test.d/dynevent/dynevent_limitations.tc
··· 7 7 MAX_ARGS=128 8 8 EXCEED_ARGS=$((MAX_ARGS + 1)) 9 9 10 + # bash and dash evaluate variables differently. 11 + # dash will evaluate '\\' every time it is read whereas bash does not. 12 + # 13 + # TEST_STRING="$TEST_STRING \\$i" 14 + # echo $TEST_STRING 15 + # 16 + # With i=123 17 + # On bash, that will print "\123" 18 + # but on dash, that will print the escape sequence of \123 as the \ will 19 + # be interpreted again in the echo. 20 + # 21 + # Set a variable "bs" to save a double backslash, then echo that 22 + # to "ts" to see if $ts changed or not. If it changed, it's dash, 23 + # if not, it's bash, and then bs can equal a single backslash. 24 + bs='\\' 25 + ts=`echo $bs` 26 + if [ "$ts" = '\\' ]; then 27 + # this is bash 28 + bs='\' 29 + fi 30 + 10 31 check_max_args() { # event_header 11 32 TEST_STRING=$1 12 33 # Acceptable 13 34 for i in `seq 1 $MAX_ARGS`; do 14 - TEST_STRING="$TEST_STRING \\$i" 35 + TEST_STRING="$TEST_STRING $bs$i" 15 36 done 16 37 echo "$TEST_STRING" >> dynamic_events 17 38 echo > dynamic_events
+20
tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc
··· 80 80 exit_fail 81 81 fi 82 82 83 + # Check strings too 84 + if [ -f events/syscalls/sys_enter_openat/filter ]; then 85 + DIRNAME=`basename $TMPDIR` 86 + echo "filename.ustring ~ \"*$DIRNAME*\"" > events/syscalls/sys_enter_openat/filter 87 + echo 1 > events/syscalls/sys_enter_openat/enable 88 + echo 1 > tracing_on 89 + ls /bin/sh 90 + nocnt=`grep openat trace | wc -l` 91 + ls $TMPDIR 92 + echo 0 > tracing_on 93 + hitcnt=`grep openat trace | wc -l`; 94 + echo 0 > events/syscalls/sys_enter_openat/enable 95 + if [ $nocnt -gt 0 ]; then 96 + exit_fail 97 + fi 98 + if [ $hitcnt -eq 0 ]; then 99 + exit_fail 100 + fi 101 + fi 102 + 83 103 reset_events_filter 84 104 85 105 exit 0
+1
tools/testing/selftests/lib/config
··· 1 1 CONFIG_TEST_BITMAP=m 2 + CONFIG_PRIME_NUMBERS=m 2 3 CONFIG_TEST_BITOPS=m
+2 -3
tools/testing/selftests/net/mptcp/diag.sh
··· 206 206 local token 207 207 local msg 208 208 209 - ss_token="$(ss -inmHMN $ns | grep 'token:' |\ 210 - head -n 1 |\ 211 - sed 's/.*token:\([0-9a-f]*\).*/\1/')" 209 + ss_token="$(ss -inmHMN $ns | 210 + mptcp_lib_get_info_value "token" "token")" 212 211 213 212 token="$(ip netns exec $ns ./mptcp_diag -t $ss_token |\ 214 213 awk -F':[ \t]+' '/^token/ {print $2}')"
+39
tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json
··· 313 313 "$TC qdisc del dev $DUMMY handle 1: root", 314 314 "$IP addr del 10.10.10.10/24 dev $DUMMY || true" 315 315 ] 316 + }, 317 + { 318 + "id": "a4c3", 319 + "name": "Test HFSC with netem/blackhole - queue emptying during peek operation", 320 + "category": [ 321 + "qdisc", 322 + "hfsc", 323 + "netem", 324 + "blackhole" 325 + ], 326 + "plugins": { 327 + "requires": "nsPlugin" 328 + }, 329 + "setup": [ 330 + "$IP link set dev $DUMMY up || true", 331 + "$IP addr add 10.10.10.10/24 dev $DUMMY || true", 332 + "$TC qdisc add dev $DUMMY handle 1:0 root drr", 333 + "$TC class add dev $DUMMY parent 1:0 classid 1:1 drr", 334 + "$TC class add dev $DUMMY parent 1:0 classid 1:2 drr", 335 + "$TC qdisc add dev $DUMMY parent 1:1 handle 2:0 plug limit 1024", 336 + "$TC qdisc add dev $DUMMY parent 1:2 handle 3:0 hfsc default 1", 337 + "$TC class add dev $DUMMY parent 3:0 classid 3:1 hfsc rt m1 5Mbit d 10ms m2 10Mbit", 338 + "$TC qdisc add dev $DUMMY parent 3:1 handle 4:0 netem delay 1ms", 339 + "$TC qdisc add dev $DUMMY parent 4:1 handle 5:0 blackhole", 340 + "ping -c 3 -W 0.01 -i 0.001 -s 1 10.10.10.10 -I $DUMMY > /dev/null 2>&1 || true", 341 + "$TC class change dev $DUMMY parent 3:0 classid 3:1 hfsc sc m1 5Mbit d 10ms m2 10Mbit", 342 + "$TC class del dev $DUMMY parent 3:0 classid 3:1", 343 + "$TC class add dev $DUMMY parent 3:0 classid 3:1 hfsc rt m1 5Mbit d 10ms m2 10Mbit", 344 + "ping -c 3 -W 0.01 -i 0.001 -s 1 10.10.10.10 -I $DUMMY > /dev/null 2>&1 || true" 345 + ], 346 + "cmdUnderTest": "$TC class change dev $DUMMY parent 3:0 classid 3:1 hfsc sc m1 5Mbit d 10ms m2 10Mbit", 347 + "expExitCode": "0", 348 + "verifyCmd": "$TC -s qdisc show dev $DUMMY", 349 + "matchPattern": "qdisc hfsc 3:.*parent 1:2.*default 1", 350 + "matchCount": "1", 351 + "teardown": [ 352 + "$TC qdisc del dev $DUMMY handle 1:0 root", 353 + "$IP addr del 10.10.10.10/24 dev $DUMMY || true" 354 + ] 316 355 } 317 356 ]
+8 -1
tools/testing/selftests/ublk/Makefile
··· 6 6 TEST_PROGS := test_generic_01.sh 7 7 TEST_PROGS += test_generic_02.sh 8 8 TEST_PROGS += test_generic_03.sh 9 + TEST_PROGS += test_generic_04.sh 10 + TEST_PROGS += test_generic_05.sh 11 + TEST_PROGS += test_generic_06.sh 9 12 10 13 TEST_PROGS += test_null_01.sh 11 14 TEST_PROGS += test_null_02.sh ··· 24 21 25 22 TEST_PROGS += test_stress_01.sh 26 23 TEST_PROGS += test_stress_02.sh 24 + TEST_PROGS += test_stress_03.sh 25 + TEST_PROGS += test_stress_04.sh 26 + TEST_PROGS += test_stress_05.sh 27 27 28 28 TEST_GEN_PROGS_EXTENDED = kublk 29 29 30 30 include ../lib.mk 31 31 32 - $(TEST_GEN_PROGS_EXTENDED): kublk.c null.c file_backed.c common.c stripe.c 32 + $(TEST_GEN_PROGS_EXTENDED): kublk.c null.c file_backed.c common.c stripe.c \ 33 + fault_inject.c 33 34 34 35 check: 35 36 shellcheck -x -f gcc *.sh
+98
tools/testing/selftests/ublk/fault_inject.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + /* 4 + * Fault injection ublk target. Hack this up however you like for 5 + * testing specific behaviors of ublk_drv. Currently is a null target 6 + * with a configurable delay before completing each I/O. This delay can 7 + * be used to test ublk_drv's handling of I/O outstanding to the ublk 8 + * server when it dies. 9 + */ 10 + 11 + #include "kublk.h" 12 + 13 + static int ublk_fault_inject_tgt_init(const struct dev_ctx *ctx, 14 + struct ublk_dev *dev) 15 + { 16 + const struct ublksrv_ctrl_dev_info *info = &dev->dev_info; 17 + unsigned long dev_size = 250UL << 30; 18 + 19 + dev->tgt.dev_size = dev_size; 20 + dev->tgt.params = (struct ublk_params) { 21 + .types = UBLK_PARAM_TYPE_BASIC, 22 + .basic = { 23 + .logical_bs_shift = 9, 24 + .physical_bs_shift = 12, 25 + .io_opt_shift = 12, 26 + .io_min_shift = 9, 27 + .max_sectors = info->max_io_buf_bytes >> 9, 28 + .dev_sectors = dev_size >> 9, 29 + }, 30 + }; 31 + 32 + dev->private_data = (void *)(unsigned long)(ctx->fault_inject.delay_us * 1000); 33 + return 0; 34 + } 35 + 36 + static int ublk_fault_inject_queue_io(struct ublk_queue *q, int tag) 37 + { 38 + const struct ublksrv_io_desc *iod = ublk_get_iod(q, tag); 39 + struct io_uring_sqe *sqe; 40 + struct __kernel_timespec ts = { 41 + .tv_nsec = (long long)q->dev->private_data, 42 + }; 43 + 44 + ublk_queue_alloc_sqes(q, &sqe, 1); 45 + io_uring_prep_timeout(sqe, &ts, 1, 0); 46 + sqe->user_data = build_user_data(tag, ublksrv_get_op(iod), 0, 1); 47 + 48 + ublk_queued_tgt_io(q, tag, 1); 49 + 50 + return 0; 51 + } 52 + 53 + static void ublk_fault_inject_tgt_io_done(struct ublk_queue *q, int tag, 54 + const struct io_uring_cqe *cqe) 55 + { 56 + const struct ublksrv_io_desc *iod = ublk_get_iod(q, tag); 57 + 58 + if (cqe->res != -ETIME) 59 + ublk_err("%s: unexpected cqe res %d\n", __func__, cqe->res); 60 + 61 + if (ublk_completed_tgt_io(q, tag)) 62 + ublk_complete_io(q, tag, iod->nr_sectors << 9); 63 + else 64 + ublk_err("%s: io not complete after 1 cqe\n", __func__); 65 + } 66 + 67 + static void ublk_fault_inject_cmd_line(struct dev_ctx *ctx, int argc, char *argv[]) 68 + { 69 + static const struct option longopts[] = { 70 + { "delay_us", 1, NULL, 0 }, 71 + { 0, 0, 0, 0 } 72 + }; 73 + int option_idx, opt; 74 + 75 + ctx->fault_inject.delay_us = 0; 76 + while ((opt = getopt_long(argc, argv, "", 77 + longopts, &option_idx)) != -1) { 78 + switch (opt) { 79 + case 0: 80 + if (!strcmp(longopts[option_idx].name, "delay_us")) 81 + ctx->fault_inject.delay_us = strtoll(optarg, NULL, 10); 82 + } 83 + } 84 + } 85 + 86 + static void ublk_fault_inject_usage(const struct ublk_tgt_ops *ops) 87 + { 88 + printf("\tfault_inject: [--delay_us us (default 0)]\n"); 89 + } 90 + 91 + const struct ublk_tgt_ops fault_inject_tgt_ops = { 92 + .name = "fault_inject", 93 + .init_tgt = ublk_fault_inject_tgt_init, 94 + .queue_io = ublk_fault_inject_queue_io, 95 + .tgt_io_done = ublk_fault_inject_tgt_io_done, 96 + .parse_cmd_line = ublk_fault_inject_cmd_line, 97 + .usage = ublk_fault_inject_usage, 98 + };
+314 -29
tools/testing/selftests/ublk/kublk.c
··· 5 5 6 6 #include "kublk.h" 7 7 8 + #define MAX_NR_TGT_ARG 64 9 + 8 10 unsigned int ublk_dbg_mask = UBLK_LOG; 9 11 static const struct ublk_tgt_ops *tgt_ops_list[] = { 10 12 &null_tgt_ops, 11 13 &loop_tgt_ops, 12 14 &stripe_tgt_ops, 15 + &fault_inject_tgt_ops, 13 16 }; 14 17 15 18 static const struct ublk_tgt_ops *ublk_find_tgt(const char *name) 16 19 { 17 - const struct ublk_tgt_ops *ops; 18 20 int i; 19 21 20 22 if (name == NULL) 21 23 return NULL; 22 24 23 - for (i = 0; sizeof(tgt_ops_list) / sizeof(ops); i++) 25 + for (i = 0; i < ARRAY_SIZE(tgt_ops_list); i++) 24 26 if (strcmp(tgt_ops_list[i]->name, name) == 0) 25 27 return tgt_ops_list[i]; 26 28 return NULL; ··· 120 118 return __ublk_ctrl_cmd(dev, &data); 121 119 } 122 120 121 + static int ublk_ctrl_start_user_recovery(struct ublk_dev *dev) 122 + { 123 + struct ublk_ctrl_cmd_data data = { 124 + .cmd_op = UBLK_U_CMD_START_USER_RECOVERY, 125 + }; 126 + 127 + return __ublk_ctrl_cmd(dev, &data); 128 + } 129 + 130 + static int ublk_ctrl_end_user_recovery(struct ublk_dev *dev, int daemon_pid) 131 + { 132 + struct ublk_ctrl_cmd_data data = { 133 + .cmd_op = UBLK_U_CMD_END_USER_RECOVERY, 134 + .flags = CTRL_CMD_HAS_DATA, 135 + }; 136 + 137 + dev->dev_info.ublksrv_pid = data.data[0] = daemon_pid; 138 + 139 + return __ublk_ctrl_cmd(dev, &data); 140 + } 141 + 123 142 static int ublk_ctrl_add_dev(struct ublk_dev *dev) 124 143 { 125 144 struct ublk_ctrl_cmd_data data = { ··· 230 207 }; 231 208 } 232 209 210 + static void ublk_print_cpu_set(const cpu_set_t *set, char *buf, unsigned len) 211 + { 212 + unsigned done = 0; 213 + int i; 214 + 215 + for (i = 0; i < CPU_SETSIZE; i++) { 216 + if (CPU_ISSET(i, set)) 217 + done += snprintf(&buf[done], len - done, "%d ", i); 218 + } 219 + } 220 + 221 + static void ublk_adjust_affinity(cpu_set_t *set) 222 + { 223 + int j, updated = 0; 224 + 225 + /* 226 + * Just keep the 1st CPU now. 227 + * 228 + * In future, auto affinity selection can be tried. 229 + */ 230 + for (j = 0; j < CPU_SETSIZE; j++) { 231 + if (CPU_ISSET(j, set)) { 232 + if (!updated) { 233 + updated = 1; 234 + continue; 235 + } 236 + CPU_CLR(j, set); 237 + } 238 + } 239 + } 240 + 241 + /* Caller must free the allocated buffer */ 242 + static int ublk_ctrl_get_affinity(struct ublk_dev *ctrl_dev, cpu_set_t **ptr_buf) 243 + { 244 + struct ublk_ctrl_cmd_data data = { 245 + .cmd_op = UBLK_U_CMD_GET_QUEUE_AFFINITY, 246 + .flags = CTRL_CMD_HAS_DATA | CTRL_CMD_HAS_BUF, 247 + }; 248 + cpu_set_t *buf; 249 + int i, ret; 250 + 251 + buf = malloc(sizeof(cpu_set_t) * ctrl_dev->dev_info.nr_hw_queues); 252 + if (!buf) 253 + return -ENOMEM; 254 + 255 + for (i = 0; i < ctrl_dev->dev_info.nr_hw_queues; i++) { 256 + data.data[0] = i; 257 + data.len = sizeof(cpu_set_t); 258 + data.addr = (__u64)&buf[i]; 259 + 260 + ret = __ublk_ctrl_cmd(ctrl_dev, &data); 261 + if (ret < 0) { 262 + free(buf); 263 + return ret; 264 + } 265 + ublk_adjust_affinity(&buf[i]); 266 + } 267 + 268 + *ptr_buf = buf; 269 + return 0; 270 + } 271 + 233 272 static void ublk_ctrl_dump(struct ublk_dev *dev) 234 273 { 235 274 struct ublksrv_ctrl_dev_info *info = &dev->dev_info; 236 275 struct ublk_params p; 276 + cpu_set_t *affinity; 237 277 int ret; 238 278 239 279 ret = ublk_ctrl_get_params(dev, &p); 240 280 if (ret < 0) { 241 281 ublk_err("failed to get params %d %s\n", ret, strerror(-ret)); 282 + return; 283 + } 284 + 285 + ret = ublk_ctrl_get_affinity(dev, &affinity); 286 + if (ret < 0) { 287 + ublk_err("failed to get affinity %m\n"); 242 288 return; 243 289 } 244 290 ··· 317 225 ublk_log("\tmax rq size %d daemon pid %d flags 0x%llx state %s\n", 318 226 info->max_io_buf_bytes, info->ublksrv_pid, info->flags, 319 227 ublk_dev_state_desc(dev)); 228 + 229 + if (affinity) { 230 + char buf[512]; 231 + int i; 232 + 233 + for (i = 0; i < info->nr_hw_queues; i++) { 234 + ublk_print_cpu_set(&affinity[i], buf, sizeof(buf)); 235 + printf("\tqueue %u: tid %d affinity(%s)\n", 236 + i, dev->q[i].tid, buf); 237 + } 238 + free(affinity); 239 + } 240 + 320 241 fflush(stdout); 321 242 } 322 243 ··· 452 347 } 453 348 454 349 ret = ublk_setup_ring(&q->ring, ring_depth, cq_depth, 455 - IORING_SETUP_COOP_TASKRUN); 350 + IORING_SETUP_COOP_TASKRUN | 351 + IORING_SETUP_SINGLE_ISSUER | 352 + IORING_SETUP_DEFER_TASKRUN); 456 353 if (ret < 0) { 457 354 ublk_err("ublk dev %d queue %d setup io_uring failed %d\n", 458 355 q->dev->dev_info.dev_id, q->q_id, ret); ··· 709 602 return reapped; 710 603 } 711 604 605 + static void ublk_queue_set_sched_affinity(const struct ublk_queue *q, 606 + cpu_set_t *cpuset) 607 + { 608 + if (sched_setaffinity(0, sizeof(*cpuset), cpuset) < 0) 609 + ublk_err("ublk dev %u queue %u set affinity failed", 610 + q->dev->dev_info.dev_id, q->q_id); 611 + } 612 + 613 + struct ublk_queue_info { 614 + struct ublk_queue *q; 615 + sem_t *queue_sem; 616 + cpu_set_t *affinity; 617 + }; 618 + 712 619 static void *ublk_io_handler_fn(void *data) 713 620 { 714 - struct ublk_queue *q = data; 621 + struct ublk_queue_info *info = data; 622 + struct ublk_queue *q = info->q; 715 623 int dev_id = q->dev->dev_info.dev_id; 716 624 int ret; 717 625 ··· 736 614 dev_id, q->q_id); 737 615 return NULL; 738 616 } 617 + /* IO perf is sensitive with queue pthread affinity on NUMA machine*/ 618 + ublk_queue_set_sched_affinity(q, info->affinity); 619 + sem_post(info->queue_sem); 620 + 739 621 ublk_dbg(UBLK_DBG_QUEUE, "tid %d: ublk dev %d queue %d started\n", 740 622 q->tid, dev_id, q->q_id); 741 623 ··· 765 639 dev->dev_info.dev_id, ret); 766 640 } 767 641 768 - static int ublk_send_dev_event(const struct dev_ctx *ctx, int dev_id) 642 + static int ublk_send_dev_event(const struct dev_ctx *ctx, struct ublk_dev *dev, int dev_id) 769 643 { 770 644 uint64_t id; 771 645 int evtfd = ctx->_evtfd; ··· 778 652 else 779 653 id = ERROR_EVTFD_DEVID; 780 654 655 + if (dev && ctx->shadow_dev) 656 + memcpy(&ctx->shadow_dev->q, &dev->q, sizeof(dev->q)); 657 + 781 658 if (write(evtfd, &id, sizeof(id)) != sizeof(id)) 782 659 return -EINVAL; 660 + 661 + close(evtfd); 662 + shmdt(ctx->shadow_dev); 783 663 784 664 return 0; 785 665 } ··· 793 661 794 662 static int ublk_start_daemon(const struct dev_ctx *ctx, struct ublk_dev *dev) 795 663 { 796 - int ret, i; 797 - void *thread_ret; 798 664 const struct ublksrv_ctrl_dev_info *dinfo = &dev->dev_info; 665 + struct ublk_queue_info *qinfo; 666 + cpu_set_t *affinity_buf; 667 + void *thread_ret; 668 + sem_t queue_sem; 669 + int ret, i; 799 670 800 671 ublk_dbg(UBLK_DBG_DEV, "%s enter\n", __func__); 801 672 673 + qinfo = (struct ublk_queue_info *)calloc(sizeof(struct ublk_queue_info), 674 + dinfo->nr_hw_queues); 675 + if (!qinfo) 676 + return -ENOMEM; 677 + 678 + sem_init(&queue_sem, 0, 0); 802 679 ret = ublk_dev_prep(ctx, dev); 680 + if (ret) 681 + return ret; 682 + 683 + ret = ublk_ctrl_get_affinity(dev, &affinity_buf); 803 684 if (ret) 804 685 return ret; 805 686 806 687 for (i = 0; i < dinfo->nr_hw_queues; i++) { 807 688 dev->q[i].dev = dev; 808 689 dev->q[i].q_id = i; 690 + 691 + qinfo[i].q = &dev->q[i]; 692 + qinfo[i].queue_sem = &queue_sem; 693 + qinfo[i].affinity = &affinity_buf[i]; 809 694 pthread_create(&dev->q[i].thread, NULL, 810 695 ublk_io_handler_fn, 811 - &dev->q[i]); 696 + &qinfo[i]); 812 697 } 813 698 699 + for (i = 0; i < dinfo->nr_hw_queues; i++) 700 + sem_wait(&queue_sem); 701 + free(qinfo); 702 + free(affinity_buf); 703 + 814 704 /* everything is fine now, start us */ 815 - ublk_set_parameters(dev); 816 - ret = ublk_ctrl_start_dev(dev, getpid()); 705 + if (ctx->recovery) 706 + ret = ublk_ctrl_end_user_recovery(dev, getpid()); 707 + else { 708 + ublk_set_parameters(dev); 709 + ret = ublk_ctrl_start_dev(dev, getpid()); 710 + } 817 711 if (ret < 0) { 818 712 ublk_err("%s: ublk_ctrl_start_dev failed: %d\n", __func__, ret); 819 713 goto fail; ··· 849 691 if (ctx->fg) 850 692 ublk_ctrl_dump(dev); 851 693 else 852 - ublk_send_dev_event(ctx, dev->dev_info.dev_id); 694 + ublk_send_dev_event(ctx, dev, dev->dev_info.dev_id); 853 695 854 696 /* wait until we are terminated */ 855 697 for (i = 0; i < dinfo->nr_hw_queues; i++) ··· 1014 856 } 1015 857 } 1016 858 1017 - ret = ublk_ctrl_add_dev(dev); 859 + if (ctx->recovery) 860 + ret = ublk_ctrl_start_user_recovery(dev); 861 + else 862 + ret = ublk_ctrl_add_dev(dev); 1018 863 if (ret < 0) { 1019 864 ublk_err("%s: can't add dev id %d, type %s ret %d\n", 1020 865 __func__, dev_id, tgt_type, ret); ··· 1031 870 1032 871 fail: 1033 872 if (ret < 0) 1034 - ublk_send_dev_event(ctx, -1); 873 + ublk_send_dev_event(ctx, dev, -1); 1035 874 ublk_ctrl_deinit(dev); 1036 875 return ret; 1037 876 } ··· 1045 884 if (ctx->fg) 1046 885 goto run; 1047 886 887 + ctx->_shmid = shmget(IPC_PRIVATE, sizeof(struct ublk_dev), IPC_CREAT | 0666); 888 + if (ctx->_shmid < 0) { 889 + ublk_err("%s: failed to shmget %s\n", __func__, strerror(errno)); 890 + exit(-1); 891 + } 892 + ctx->shadow_dev = (struct ublk_dev *)shmat(ctx->_shmid, NULL, 0); 893 + if (ctx->shadow_dev == (struct ublk_dev *)-1) { 894 + ublk_err("%s: failed to shmat %s\n", __func__, strerror(errno)); 895 + exit(-1); 896 + } 1048 897 ctx->_evtfd = eventfd(0, 0); 1049 898 if (ctx->_evtfd < 0) { 1050 899 ublk_err("%s: failed to create eventfd %s\n", __func__, strerror(errno)); 1051 900 exit(-1); 1052 901 } 1053 902 1054 - setsid(); 1055 903 res = fork(); 1056 904 if (res == 0) { 905 + int res2; 906 + 907 + setsid(); 908 + res2 = fork(); 909 + if (res2 == 0) { 910 + /* prepare for detaching */ 911 + close(STDIN_FILENO); 912 + close(STDOUT_FILENO); 913 + close(STDERR_FILENO); 1057 914 run: 1058 - res = __cmd_dev_add(ctx); 1059 - return res; 915 + res = __cmd_dev_add(ctx); 916 + return res; 917 + } else { 918 + /* detached from the foreground task */ 919 + exit(EXIT_SUCCESS); 920 + } 1060 921 } else if (res > 0) { 1061 922 uint64_t id; 923 + int exit_code = EXIT_FAILURE; 1062 924 1063 925 res = read(ctx->_evtfd, &id, sizeof(id)); 1064 926 close(ctx->_evtfd); 1065 927 if (res == sizeof(id) && id != ERROR_EVTFD_DEVID) { 1066 928 ctx->dev_id = id - 1; 1067 - return __cmd_dev_list(ctx); 929 + if (__cmd_dev_list(ctx) >= 0) 930 + exit_code = EXIT_SUCCESS; 1068 931 } 1069 - exit(EXIT_FAILURE); 932 + shmdt(ctx->shadow_dev); 933 + shmctl(ctx->_shmid, IPC_RMID, NULL); 934 + /* wait for child and detach from it */ 935 + wait(NULL); 936 + exit(exit_code); 1070 937 } else { 1071 - return res; 938 + exit(EXIT_FAILURE); 1072 939 } 1073 940 } 1074 941 ··· 1158 969 ublk_err("%s: can't get dev info from %d: %d\n", 1159 970 __func__, ctx->dev_id, ret); 1160 971 } else { 972 + if (ctx->shadow_dev) 973 + memcpy(&dev->q, ctx->shadow_dev->q, sizeof(dev->q)); 974 + 1161 975 ublk_ctrl_dump(dev); 1162 976 } 1163 977 ··· 1231 1039 return ret; 1232 1040 } 1233 1041 1042 + static void __cmd_create_help(char *exe, bool recovery) 1043 + { 1044 + int i; 1045 + 1046 + printf("%s %s -t [null|loop|stripe|fault_inject] [-q nr_queues] [-d depth] [-n dev_id]\n", 1047 + exe, recovery ? "recover" : "add"); 1048 + printf("\t[--foreground] [--quiet] [-z] [--debug_mask mask] [-r 0|1 ] [-g 0|1]\n"); 1049 + printf("\t[-e 0|1 ] [-i 0|1]\n"); 1050 + printf("\t[target options] [backfile1] [backfile2] ...\n"); 1051 + printf("\tdefault: nr_queues=2(max 32), depth=128(max 1024), dev_id=-1(auto allocation)\n"); 1052 + 1053 + for (i = 0; i < sizeof(tgt_ops_list) / sizeof(tgt_ops_list[0]); i++) { 1054 + const struct ublk_tgt_ops *ops = tgt_ops_list[i]; 1055 + 1056 + if (ops->usage) 1057 + ops->usage(ops); 1058 + } 1059 + } 1060 + 1061 + static void cmd_add_help(char *exe) 1062 + { 1063 + __cmd_create_help(exe, false); 1064 + printf("\n"); 1065 + } 1066 + 1067 + static void cmd_recover_help(char *exe) 1068 + { 1069 + __cmd_create_help(exe, true); 1070 + printf("\tPlease provide exact command line for creating this device with real dev_id\n"); 1071 + printf("\n"); 1072 + } 1073 + 1234 1074 static int cmd_dev_help(char *exe) 1235 1075 { 1236 - printf("%s add -t [null|loop] [-q nr_queues] [-d depth] [-n dev_id] [backfile1] [backfile2] ...\n", exe); 1237 - printf("\t default: nr_queues=2(max 4), depth=128(max 128), dev_id=-1(auto allocation)\n"); 1076 + cmd_add_help(exe); 1077 + cmd_recover_help(exe); 1078 + 1238 1079 printf("%s del [-n dev_id] -a \n", exe); 1239 - printf("\t -a delete all devices -n delete specified device\n"); 1080 + printf("\t -a delete all devices -n delete specified device\n\n"); 1240 1081 printf("%s list [-n dev_id] -a \n", exe); 1241 - printf("\t -a list all devices, -n list specified device, default -a \n"); 1082 + printf("\t -a list all devices, -n list specified device, default -a \n\n"); 1242 1083 printf("%s features\n", exe); 1243 1084 return 0; 1244 1085 } ··· 1288 1063 { "quiet", 0, NULL, 0 }, 1289 1064 { "zero_copy", 0, NULL, 'z' }, 1290 1065 { "foreground", 0, NULL, 0 }, 1291 - { "chunk_size", 1, NULL, 0 }, 1066 + { "recovery", 1, NULL, 'r' }, 1067 + { "recovery_fail_io", 1, NULL, 'e'}, 1068 + { "recovery_reissue", 1, NULL, 'i'}, 1069 + { "get_data", 1, NULL, 'g'}, 1292 1070 { 0, 0, 0, 0 } 1293 1071 }; 1072 + const struct ublk_tgt_ops *ops = NULL; 1294 1073 int option_idx, opt; 1295 1074 const char *cmd = argv[1]; 1296 1075 struct dev_ctx ctx = { ··· 1302 1073 .nr_hw_queues = 2, 1303 1074 .dev_id = -1, 1304 1075 .tgt_type = "unknown", 1305 - .chunk_size = 65536, /* def chunk size is 64K */ 1306 1076 }; 1307 1077 int ret = -EINVAL, i; 1078 + int tgt_argc = 1; 1079 + char *tgt_argv[MAX_NR_TGT_ARG] = { NULL }; 1080 + int value; 1308 1081 1309 1082 if (argc == 1) 1310 1083 return ret; 1311 1084 1085 + opterr = 0; 1312 1086 optind = 2; 1313 - while ((opt = getopt_long(argc, argv, "t:n:d:q:az", 1087 + while ((opt = getopt_long(argc, argv, "t:n:d:q:r:e:i:az", 1314 1088 longopts, &option_idx)) != -1) { 1315 1089 switch (opt) { 1316 1090 case 'a': ··· 1335 1103 case 'z': 1336 1104 ctx.flags |= UBLK_F_SUPPORT_ZERO_COPY | UBLK_F_USER_COPY; 1337 1105 break; 1106 + case 'r': 1107 + value = strtol(optarg, NULL, 10); 1108 + if (value) 1109 + ctx.flags |= UBLK_F_USER_RECOVERY; 1110 + break; 1111 + case 'e': 1112 + value = strtol(optarg, NULL, 10); 1113 + if (value) 1114 + ctx.flags |= UBLK_F_USER_RECOVERY | UBLK_F_USER_RECOVERY_FAIL_IO; 1115 + break; 1116 + case 'i': 1117 + value = strtol(optarg, NULL, 10); 1118 + if (value) 1119 + ctx.flags |= UBLK_F_USER_RECOVERY | UBLK_F_USER_RECOVERY_REISSUE; 1120 + break; 1121 + case 'g': 1122 + value = strtol(optarg, NULL, 10); 1123 + if (value) 1124 + ctx.flags |= UBLK_F_NEED_GET_DATA; 1338 1125 case 0: 1339 1126 if (!strcmp(longopts[option_idx].name, "debug_mask")) 1340 1127 ublk_dbg_mask = strtol(optarg, NULL, 16); ··· 1361 1110 ublk_dbg_mask = 0; 1362 1111 if (!strcmp(longopts[option_idx].name, "foreground")) 1363 1112 ctx.fg = 1; 1364 - if (!strcmp(longopts[option_idx].name, "chunk_size")) 1365 - ctx.chunk_size = strtol(optarg, NULL, 10); 1113 + break; 1114 + case '?': 1115 + /* 1116 + * target requires every option must have argument 1117 + */ 1118 + if (argv[optind][0] == '-' || argv[optind - 1][0] != '-') { 1119 + fprintf(stderr, "every target option requires argument: %s %s\n", 1120 + argv[optind - 1], argv[optind]); 1121 + exit(EXIT_FAILURE); 1122 + } 1123 + 1124 + if (tgt_argc < (MAX_NR_TGT_ARG - 1) / 2) { 1125 + tgt_argv[tgt_argc++] = argv[optind - 1]; 1126 + tgt_argv[tgt_argc++] = argv[optind]; 1127 + } else { 1128 + fprintf(stderr, "too many target options\n"); 1129 + exit(EXIT_FAILURE); 1130 + } 1131 + optind += 1; 1132 + break; 1366 1133 } 1367 1134 } 1368 1135 ··· 1389 1120 ctx.files[ctx.nr_files++] = argv[i++]; 1390 1121 } 1391 1122 1123 + ops = ublk_find_tgt(ctx.tgt_type); 1124 + if (ops && ops->parse_cmd_line) { 1125 + optind = 0; 1126 + 1127 + tgt_argv[0] = ctx.tgt_type; 1128 + ops->parse_cmd_line(&ctx, tgt_argc, tgt_argv); 1129 + } 1130 + 1392 1131 if (!strcmp(cmd, "add")) 1393 1132 ret = cmd_dev_add(&ctx); 1394 - else if (!strcmp(cmd, "del")) 1133 + else if (!strcmp(cmd, "recover")) { 1134 + if (ctx.dev_id < 0) { 1135 + fprintf(stderr, "device id isn't provided for recovering\n"); 1136 + ret = -EINVAL; 1137 + } else { 1138 + ctx.recovery = 1; 1139 + ret = cmd_dev_add(&ctx); 1140 + } 1141 + } else if (!strcmp(cmd, "del")) 1395 1142 ret = cmd_dev_del(&ctx); 1396 1143 else if (!strcmp(cmd, "list")) { 1397 1144 ctx.all = 1;
+42 -5
tools/testing/selftests/ublk/kublk.h
··· 20 20 #include <sys/wait.h> 21 21 #include <sys/eventfd.h> 22 22 #include <sys/uio.h> 23 + #include <sys/ipc.h> 24 + #include <sys/shm.h> 25 + #include <linux/io_uring.h> 23 26 #include <liburing.h> 24 - #include <linux/ublk_cmd.h> 27 + #include <semaphore.h> 28 + 29 + /* allow ublk_dep.h to override ublk_cmd.h */ 25 30 #include "ublk_dep.h" 31 + #include <linux/ublk_cmd.h> 26 32 27 33 #define __maybe_unused __attribute__((unused)) 28 34 #define MAX_BACK_FILES 4 29 35 #ifndef min 30 36 #define min(a, b) ((a) < (b) ? (a) : (b)) 31 37 #endif 38 + 39 + #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) 32 40 33 41 /****************** part 1: libublk ********************/ 34 42 ··· 50 42 #define UBLKSRV_IO_IDLE_SECS 20 51 43 52 44 #define UBLK_IO_MAX_BYTES (1 << 20) 53 - #define UBLK_MAX_QUEUES 4 54 - #define UBLK_QUEUE_DEPTH 128 45 + #define UBLK_MAX_QUEUES 32 46 + #define UBLK_QUEUE_DEPTH 1024 55 47 56 48 #define UBLK_DBG_DEV (1U << 0) 57 49 #define UBLK_DBG_QUEUE (1U << 1) ··· 62 54 63 55 struct ublk_dev; 64 56 struct ublk_queue; 57 + 58 + struct stripe_ctx { 59 + /* stripe */ 60 + unsigned int chunk_size; 61 + }; 62 + 63 + struct fault_inject_ctx { 64 + /* fault_inject */ 65 + unsigned long delay_us; 66 + }; 65 67 66 68 struct dev_ctx { 67 69 char tgt_type[16]; ··· 84 66 unsigned int logging:1; 85 67 unsigned int all:1; 86 68 unsigned int fg:1; 69 + unsigned int recovery:1; 87 70 88 - /* stripe */ 89 - unsigned int chunk_size; 71 + /* fault_inject */ 72 + long long delay_us; 90 73 91 74 int _evtfd; 75 + int _shmid; 76 + 77 + /* built from shmem, only for ublk_dump_dev() */ 78 + struct ublk_dev *shadow_dev; 79 + 80 + union { 81 + struct stripe_ctx stripe; 82 + struct fault_inject_ctx fault_inject; 83 + }; 92 84 }; 93 85 94 86 struct ublk_ctrl_cmd_data { ··· 135 107 int (*queue_io)(struct ublk_queue *, int tag); 136 108 void (*tgt_io_done)(struct ublk_queue *, 137 109 int tag, const struct io_uring_cqe *); 110 + 111 + /* 112 + * Target specific command line handling 113 + * 114 + * each option requires argument for target command line 115 + */ 116 + void (*parse_cmd_line)(struct dev_ctx *ctx, int argc, char *argv[]); 117 + void (*usage)(const struct ublk_tgt_ops *ops); 138 118 }; 139 119 140 120 struct ublk_tgt { ··· 393 357 extern const struct ublk_tgt_ops null_tgt_ops; 394 358 extern const struct ublk_tgt_ops loop_tgt_ops; 395 359 extern const struct ublk_tgt_ops stripe_tgt_ops; 360 + extern const struct ublk_tgt_ops fault_inject_tgt_ops; 396 361 397 362 void backing_file_tgt_deinit(struct ublk_dev *dev); 398 363 int backing_file_tgt_init(struct ublk_dev *dev);
+27 -1
tools/testing/selftests/ublk/stripe.c
··· 281 281 .max_sectors = dev->dev_info.max_io_buf_bytes >> 9, 282 282 }, 283 283 }; 284 - unsigned chunk_size = ctx->chunk_size; 284 + unsigned chunk_size = ctx->stripe.chunk_size; 285 285 struct stripe_conf *conf; 286 286 unsigned chunk_shift; 287 287 loff_t bytes = 0; ··· 344 344 backing_file_tgt_deinit(dev); 345 345 } 346 346 347 + static void ublk_stripe_cmd_line(struct dev_ctx *ctx, int argc, char *argv[]) 348 + { 349 + static const struct option longopts[] = { 350 + { "chunk_size", 1, NULL, 0 }, 351 + { 0, 0, 0, 0 } 352 + }; 353 + int option_idx, opt; 354 + 355 + ctx->stripe.chunk_size = 65536; 356 + while ((opt = getopt_long(argc, argv, "", 357 + longopts, &option_idx)) != -1) { 358 + switch (opt) { 359 + case 0: 360 + if (!strcmp(longopts[option_idx].name, "chunk_size")) 361 + ctx->stripe.chunk_size = strtol(optarg, NULL, 10); 362 + } 363 + } 364 + } 365 + 366 + static void ublk_stripe_usage(const struct ublk_tgt_ops *ops) 367 + { 368 + printf("\tstripe: [--chunk_size chunk_size (default 65536)]\n"); 369 + } 370 + 347 371 const struct ublk_tgt_ops stripe_tgt_ops = { 348 372 .name = "stripe", 349 373 .init_tgt = ublk_stripe_tgt_init, 350 374 .deinit_tgt = ublk_stripe_tgt_deinit, 351 375 .queue_io = ublk_stripe_queue_io, 352 376 .tgt_io_done = ublk_stripe_io_done, 377 + .parse_cmd_line = ublk_stripe_cmd_line, 378 + .usage = ublk_stripe_usage, 353 379 };
+119 -23
tools/testing/selftests/ublk/test_common.sh
··· 30 30 } 31 31 32 32 _create_backfile() { 33 - local my_size=$1 34 - local my_file 33 + local index=$1 34 + local new_size=$2 35 + local old_file 36 + local new_file 35 37 36 - my_file=$(mktemp ublk_file_"${my_size}"_XXXXX) 37 - truncate -s "${my_size}" "${my_file}" 38 - echo "$my_file" 38 + old_file="${UBLK_BACKFILES[$index]}" 39 + [ -f "$old_file" ] && rm -f "$old_file" 40 + 41 + new_file=$(mktemp ublk_file_"${new_size}"_XXXXX) 42 + truncate -s "${new_size}" "${new_file}" 43 + UBLK_BACKFILES["$index"]="$new_file" 39 44 } 40 45 41 - _remove_backfile() { 42 - local file=$1 46 + _remove_files() { 47 + local file 43 48 44 - [ -f "$file" ] && rm -f "$file" 49 + for file in "${UBLK_BACKFILES[@]}"; do 50 + [ -f "$file" ] && rm -f "$file" 51 + done 52 + [ -f "$UBLK_TMP" ] && rm -f "$UBLK_TMP" 45 53 } 46 54 47 55 _create_tmp_dir() { ··· 114 106 local type=$1 115 107 shift 1 116 108 modprobe ublk_drv > /dev/null 2>&1 109 + UBLK_TMP=$(mktemp ublk_test_XXXXX) 117 110 [ "$UBLK_TEST_QUIET" -eq 0 ] && echo "ublk $type: $*" 118 111 } 119 112 ··· 138 129 echo "$1 : [FAIL]" 139 130 fi 140 131 fi 141 - [ "$2" -ne 0 ] && exit "$2" 132 + if [ "$2" -ne 0 ]; then 133 + _remove_files 134 + exit "$2" 135 + fi 142 136 return 0 143 137 } 144 138 ··· 150 138 { 151 139 local tid=$1 152 140 local code=$2 153 - shift 2 141 + 154 142 if [ "${code}" -ne 0 ]; then 155 - _remove_test_files "$@" 156 143 _show_result "${tid}" "${code}" 157 144 fi 158 145 } 159 146 160 147 _cleanup_test() { 161 148 "${UBLK_PROG}" del -a 162 - rm -f "$UBLK_TMP" 149 + 150 + _remove_files 163 151 } 164 152 165 153 _have_feature() ··· 170 158 return 1 171 159 } 172 160 173 - _add_ublk_dev() { 174 - local kublk_temp; 161 + _create_ublk_dev() { 175 162 local dev_id; 163 + local cmd=$1 164 + 165 + shift 1 176 166 177 167 if [ ! -c /dev/ublk-control ]; then 178 168 return ${UBLK_SKIP_CODE} ··· 185 171 fi 186 172 fi 187 173 188 - kublk_temp=$(mktemp /tmp/kublk-XXXXXX) 189 - if ! "${UBLK_PROG}" add "$@" > "${kublk_temp}" 2>&1; then 174 + if ! dev_id=$("${UBLK_PROG}" "$cmd" "$@" | grep "dev id" | awk -F '[ :]' '{print $3}'); then 190 175 echo "fail to add ublk dev $*" 191 - rm -f "${kublk_temp}" 192 176 return 255 193 177 fi 194 - 195 - dev_id=$(grep "dev id" "${kublk_temp}" | awk -F '[ :]' '{print $3}') 196 178 udevadm settle 197 - rm -f "${kublk_temp}" 198 - echo "${dev_id}" 179 + 180 + if [[ "$dev_id" =~ ^[0-9]+$ ]]; then 181 + echo "${dev_id}" 182 + else 183 + return 255 184 + fi 185 + } 186 + 187 + _add_ublk_dev() { 188 + _create_ublk_dev "add" "$@" 189 + } 190 + 191 + _recover_ublk_dev() { 192 + local dev_id 193 + local state 194 + 195 + dev_id=$(_create_ublk_dev "recover" "$@") 196 + for ((j=0;j<20;j++)); do 197 + state=$(_get_ublk_dev_state "${dev_id}") 198 + [ "$state" == "LIVE" ] && break 199 + sleep 1 200 + done 201 + echo "$state" 199 202 } 200 203 201 204 # kill the ublk daemon and return ublk device state ··· 251 220 local kill_server=$3 252 221 253 222 fio --name=job1 --filename=/dev/ublkb"${dev_id}" --ioengine=libaio \ 254 - --rw=readwrite --iodepth=64 --size="${size}" --numjobs=4 \ 223 + --rw=readwrite --iodepth=256 --size="${size}" --numjobs=4 \ 255 224 --runtime=20 --time_based > /dev/null 2>&1 & 256 225 sleep 2 257 226 if [ "${kill_server}" = "yes" ]; then ··· 269 238 wait 270 239 } 271 240 241 + run_io_and_remove() 242 + { 243 + local size=$1 244 + local dev_id 245 + shift 1 246 + 247 + dev_id=$(_add_ublk_dev "$@") 248 + _check_add_dev "$TID" $? 249 + 250 + [ "$UBLK_TEST_QUIET" -eq 0 ] && echo "run ublk IO vs. remove device(ublk add $*)" 251 + if ! __run_io_and_remove "$dev_id" "${size}" "no"; then 252 + echo "/dev/ublkc$dev_id isn't removed" 253 + exit 255 254 + fi 255 + } 256 + 257 + run_io_and_kill_daemon() 258 + { 259 + local size=$1 260 + local dev_id 261 + shift 1 262 + 263 + dev_id=$(_add_ublk_dev "$@") 264 + _check_add_dev "$TID" $? 265 + 266 + [ "$UBLK_TEST_QUIET" -eq 0 ] && echo "run ublk IO vs kill ublk server(ublk add $*)" 267 + if ! __run_io_and_remove "$dev_id" "${size}" "yes"; then 268 + echo "/dev/ublkc$dev_id isn't removed res ${res}" 269 + exit 255 270 + fi 271 + } 272 + 273 + run_io_and_recover() 274 + { 275 + local state 276 + local dev_id 277 + 278 + dev_id=$(_add_ublk_dev "$@") 279 + _check_add_dev "$TID" $? 280 + 281 + fio --name=job1 --filename=/dev/ublkb"${dev_id}" --ioengine=libaio \ 282 + --rw=readwrite --iodepth=256 --size="${size}" --numjobs=4 \ 283 + --runtime=20 --time_based > /dev/null 2>&1 & 284 + sleep 4 285 + 286 + state=$(__ublk_kill_daemon "${dev_id}" "QUIESCED") 287 + if [ "$state" != "QUIESCED" ]; then 288 + echo "device isn't quiesced($state) after killing daemon" 289 + return 255 290 + fi 291 + 292 + state=$(_recover_ublk_dev -n "$dev_id" "$@") 293 + if [ "$state" != "LIVE" ]; then 294 + echo "faile to recover to LIVE($state)" 295 + return 255 296 + fi 297 + 298 + if ! __remove_ublk_dev_return "${dev_id}"; then 299 + echo "delete dev ${dev_id} failed" 300 + return 255 301 + fi 302 + wait 303 + } 304 + 305 + 272 306 _ublk_test_top_dir() 273 307 { 274 308 cd "$(dirname "$0")" && pwd 275 309 } 276 310 277 - UBLK_TMP=$(mktemp ublk_test_XXXXX) 278 311 UBLK_PROG=$(_ublk_test_top_dir)/kublk 279 312 UBLK_TEST_QUIET=1 280 313 UBLK_TEST_SHOW_RESULT=1 314 + UBLK_BACKFILES=() 281 315 export UBLK_PROG 282 316 export UBLK_TEST_QUIET 283 317 export UBLK_TEST_SHOW_RESULT
+40
tools/testing/selftests/ublk/test_generic_04.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + 6 + TID="generic_04" 7 + ERR_CODE=0 8 + 9 + ublk_run_recover_test() 10 + { 11 + run_io_and_recover "$@" 12 + ERR_CODE=$? 13 + if [ ${ERR_CODE} -ne 0 ]; then 14 + echo "$TID failure: $*" 15 + _show_result $TID $ERR_CODE 16 + fi 17 + } 18 + 19 + if ! _have_program fio; then 20 + exit "$UBLK_SKIP_CODE" 21 + fi 22 + 23 + _prep_test "recover" "basic recover function verification" 24 + 25 + _create_backfile 0 256M 26 + _create_backfile 1 128M 27 + _create_backfile 2 128M 28 + 29 + ublk_run_recover_test -t null -q 2 -r 1 & 30 + ublk_run_recover_test -t loop -q 2 -r 1 "${UBLK_BACKFILES[0]}" & 31 + ublk_run_recover_test -t stripe -q 2 -r 1 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 32 + wait 33 + 34 + ublk_run_recover_test -t null -q 2 -r 1 -i 1 & 35 + ublk_run_recover_test -t loop -q 2 -r 1 -i 1 "${UBLK_BACKFILES[0]}" & 36 + ublk_run_recover_test -t stripe -q 2 -r 1 -i 1 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 37 + wait 38 + 39 + _cleanup_test "recover" 40 + _show_result $TID $ERR_CODE
+44
tools/testing/selftests/ublk/test_generic_05.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + 6 + TID="generic_04" 7 + ERR_CODE=0 8 + 9 + ublk_run_recover_test() 10 + { 11 + run_io_and_recover "$@" 12 + ERR_CODE=$? 13 + if [ ${ERR_CODE} -ne 0 ]; then 14 + echo "$TID failure: $*" 15 + _show_result $TID $ERR_CODE 16 + fi 17 + } 18 + 19 + if ! _have_program fio; then 20 + exit "$UBLK_SKIP_CODE" 21 + fi 22 + 23 + if ! _have_feature "ZERO_COPY"; then 24 + exit "$UBLK_SKIP_CODE" 25 + fi 26 + 27 + _prep_test "recover" "basic recover function verification (zero copy)" 28 + 29 + _create_backfile 0 256M 30 + _create_backfile 1 128M 31 + _create_backfile 2 128M 32 + 33 + ublk_run_recover_test -t null -q 2 -r 1 -z & 34 + ublk_run_recover_test -t loop -q 2 -r 1 -z "${UBLK_BACKFILES[0]}" & 35 + ublk_run_recover_test -t stripe -q 2 -r 1 -z "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 36 + wait 37 + 38 + ublk_run_recover_test -t null -q 2 -r 1 -z -i 1 & 39 + ublk_run_recover_test -t loop -q 2 -r 1 -z -i 1 "${UBLK_BACKFILES[0]}" & 40 + ublk_run_recover_test -t stripe -q 2 -r 1 -z -i 1 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 41 + wait 42 + 43 + _cleanup_test "recover" 44 + _show_result $TID $ERR_CODE
+41
tools/testing/selftests/ublk/test_generic_06.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + 6 + TID="generic_06" 7 + ERR_CODE=0 8 + 9 + _prep_test "fault_inject" "fast cleanup when all I/Os of one hctx are in server" 10 + 11 + # configure ublk server to sleep 2s before completing each I/O 12 + dev_id=$(_add_ublk_dev -t fault_inject -q 2 -d 1 --delay_us 2000000) 13 + _check_add_dev $TID $? 14 + 15 + STARTTIME=${SECONDS} 16 + 17 + dd if=/dev/urandom of=/dev/ublkb${dev_id} oflag=direct bs=4k count=1 status=none > /dev/null 2>&1 & 18 + dd_pid=$! 19 + 20 + __ublk_kill_daemon ${dev_id} "DEAD" 21 + 22 + wait $dd_pid 23 + dd_exitcode=$? 24 + 25 + ENDTIME=${SECONDS} 26 + ELAPSED=$(($ENDTIME - $STARTTIME)) 27 + 28 + # assert that dd sees an error and exits quickly after ublk server is 29 + # killed. previously this relied on seeing an I/O timeout and so would 30 + # take ~30s 31 + if [ $dd_exitcode -eq 0 ]; then 32 + echo "dd unexpectedly exited successfully!" 33 + ERR_CODE=255 34 + fi 35 + if [ $ELAPSED -ge 5 ]; then 36 + echo "dd took $ELAPSED seconds to exit (>= 5s tolerance)!" 37 + ERR_CODE=255 38 + fi 39 + 40 + _cleanup_test "fault_inject" 41 + _show_result $TID $ERR_CODE
+3 -5
tools/testing/selftests/ublk/test_loop_01.sh
··· 12 12 13 13 _prep_test "loop" "write and verify test" 14 14 15 - backfile_0=$(_create_backfile 256M) 15 + _create_backfile 0 256M 16 16 17 - dev_id=$(_add_ublk_dev -t loop "$backfile_0") 18 - _check_add_dev $TID $? "${backfile_0}" 17 + dev_id=$(_add_ublk_dev -t loop "${UBLK_BACKFILES[0]}") 18 + _check_add_dev $TID $? 19 19 20 20 # run fio over the ublk disk 21 21 _run_fio_verify_io --filename=/dev/ublkb"${dev_id}" --size=256M 22 22 ERR_CODE=$? 23 23 24 24 _cleanup_test "loop" 25 - 26 - _remove_backfile "$backfile_0" 27 25 28 26 _show_result $TID $ERR_CODE
+3 -5
tools/testing/selftests/ublk/test_loop_02.sh
··· 8 8 9 9 _prep_test "loop" "mkfs & mount & umount" 10 10 11 - backfile_0=$(_create_backfile 256M) 12 - dev_id=$(_add_ublk_dev -t loop "$backfile_0") 13 - _check_add_dev $TID $? "$backfile_0" 11 + _create_backfile 0 256M 12 + dev_id=$(_add_ublk_dev -t loop "${UBLK_BACKFILES[0]}") 13 + _check_add_dev $TID $? 14 14 15 15 _mkfs_mount_test /dev/ublkb"${dev_id}" 16 16 ERR_CODE=$? 17 17 18 18 _cleanup_test "loop" 19 - 20 - _remove_backfile "$backfile_0" 21 19 22 20 _show_result $TID $ERR_CODE
+3 -5
tools/testing/selftests/ublk/test_loop_03.sh
··· 12 12 13 13 _prep_test "loop" "write and verify over zero copy" 14 14 15 - backfile_0=$(_create_backfile 256M) 16 - dev_id=$(_add_ublk_dev -t loop -z "$backfile_0") 17 - _check_add_dev $TID $? "$backfile_0" 15 + _create_backfile 0 256M 16 + dev_id=$(_add_ublk_dev -t loop -z "${UBLK_BACKFILES[0]}") 17 + _check_add_dev $TID $? 18 18 19 19 # run fio over the ublk disk 20 20 _run_fio_verify_io --filename=/dev/ublkb"${dev_id}" --size=256M 21 21 ERR_CODE=$? 22 22 23 23 _cleanup_test "loop" 24 - 25 - _remove_backfile "$backfile_0" 26 24 27 25 _show_result $TID $ERR_CODE
+4 -5
tools/testing/selftests/ublk/test_loop_04.sh
··· 8 8 9 9 _prep_test "loop" "mkfs & mount & umount with zero copy" 10 10 11 - backfile_0=$(_create_backfile 256M) 12 - dev_id=$(_add_ublk_dev -t loop -z "$backfile_0") 13 - _check_add_dev $TID $? "$backfile_0" 11 + _create_backfile 0 256M 12 + 13 + dev_id=$(_add_ublk_dev -t loop -z "${UBLK_BACKFILES[0]}") 14 + _check_add_dev $TID $? 14 15 15 16 _mkfs_mount_test /dev/ublkb"${dev_id}" 16 17 ERR_CODE=$? 17 18 18 19 _cleanup_test "loop" 19 - 20 - _remove_backfile "$backfile_0" 21 20 22 21 _show_result $TID $ERR_CODE
+3 -5
tools/testing/selftests/ublk/test_loop_05.sh
··· 12 12 13 13 _prep_test "loop" "write and verify test" 14 14 15 - backfile_0=$(_create_backfile 256M) 15 + _create_backfile 0 256M 16 16 17 - dev_id=$(_add_ublk_dev -q 2 -t loop "$backfile_0") 18 - _check_add_dev $TID $? "${backfile_0}" 17 + dev_id=$(_add_ublk_dev -q 2 -t loop "${UBLK_BACKFILES[0]}") 18 + _check_add_dev $TID $? 19 19 20 20 # run fio over the ublk disk 21 21 _run_fio_verify_io --filename=/dev/ublkb"${dev_id}" --size=256M 22 22 ERR_CODE=$? 23 23 24 24 _cleanup_test "loop" 25 - 26 - _remove_backfile "$backfile_0" 27 25 28 26 _show_result $TID $ERR_CODE
+16 -29
tools/testing/selftests/ublk/test_stress_01.sh
··· 4 4 . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 5 TID="stress_01" 6 6 ERR_CODE=0 7 - DEV_ID=-1 8 7 9 8 ublk_io_and_remove() 10 9 { 11 - local size=$1 12 - shift 1 13 - local backfile="" 14 - if echo "$@" | grep -q "loop"; then 15 - backfile=${*: -1} 16 - fi 17 - DEV_ID=$(_add_ublk_dev "$@") 18 - _check_add_dev $TID $? "${backfile}" 19 - 20 - [ "$UBLK_TEST_QUIET" -eq 0 ] && echo "run ublk IO vs. remove device(ublk add $*)" 21 - if ! __run_io_and_remove "${DEV_ID}" "${size}" "no"; then 22 - echo "/dev/ublkc${DEV_ID} isn't removed" 23 - _remove_backfile "${backfile}" 24 - exit 255 10 + run_io_and_remove "$@" 11 + ERR_CODE=$? 12 + if [ ${ERR_CODE} -ne 0 ]; then 13 + echo "$TID failure: $*" 14 + _show_result $TID $ERR_CODE 25 15 fi 26 16 } 27 17 18 + if ! _have_program fio; then 19 + exit "$UBLK_SKIP_CODE" 20 + fi 21 + 28 22 _prep_test "stress" "run IO and remove device" 29 23 30 - ublk_io_and_remove 8G -t null -q 4 31 - ERR_CODE=$? 32 - if [ ${ERR_CODE} -ne 0 ]; then 33 - _show_result $TID $ERR_CODE 34 - fi 24 + _create_backfile 0 256M 25 + _create_backfile 1 128M 26 + _create_backfile 2 128M 35 27 36 - BACK_FILE=$(_create_backfile 256M) 37 - ublk_io_and_remove 256M -t loop -q 4 "${BACK_FILE}" 38 - ERR_CODE=$? 39 - if [ ${ERR_CODE} -ne 0 ]; then 40 - _show_result $TID $ERR_CODE 41 - fi 28 + ublk_io_and_remove 8G -t null -q 4 & 29 + ublk_io_and_remove 256M -t loop -q 4 "${UBLK_BACKFILES[0]}" & 30 + ublk_io_and_remove 256M -t stripe -q 4 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 31 + wait 42 32 43 - ublk_io_and_remove 256M -t loop -q 4 -z "${BACK_FILE}" 44 - ERR_CODE=$? 45 33 _cleanup_test "stress" 46 - _remove_backfile "${BACK_FILE}" 47 34 _show_result $TID $ERR_CODE
+16 -29
tools/testing/selftests/ublk/test_stress_02.sh
··· 4 4 . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 5 TID="stress_02" 6 6 ERR_CODE=0 7 - DEV_ID=-1 7 + 8 + if ! _have_program fio; then 9 + exit "$UBLK_SKIP_CODE" 10 + fi 8 11 9 12 ublk_io_and_kill_daemon() 10 13 { 11 - local size=$1 12 - shift 1 13 - local backfile="" 14 - if echo "$@" | grep -q "loop"; then 15 - backfile=${*: -1} 16 - fi 17 - DEV_ID=$(_add_ublk_dev "$@") 18 - _check_add_dev $TID $? "${backfile}" 19 - 20 - [ "$UBLK_TEST_QUIET" -eq 0 ] && echo "run ublk IO vs kill ublk server(ublk add $*)" 21 - if ! __run_io_and_remove "${DEV_ID}" "${size}" "yes"; then 22 - echo "/dev/ublkc${DEV_ID} isn't removed res ${res}" 23 - _remove_backfile "${backfile}" 24 - exit 255 14 + run_io_and_kill_daemon "$@" 15 + ERR_CODE=$? 16 + if [ ${ERR_CODE} -ne 0 ]; then 17 + echo "$TID failure: $*" 18 + _show_result $TID $ERR_CODE 25 19 fi 26 20 } 27 21 28 22 _prep_test "stress" "run IO and kill ublk server" 29 23 30 - ublk_io_and_kill_daemon 8G -t null -q 4 31 - ERR_CODE=$? 32 - if [ ${ERR_CODE} -ne 0 ]; then 33 - _show_result $TID $ERR_CODE 34 - fi 24 + _create_backfile 0 256M 25 + _create_backfile 1 128M 26 + _create_backfile 2 128M 35 27 36 - BACK_FILE=$(_create_backfile 256M) 37 - ublk_io_and_kill_daemon 256M -t loop -q 4 "${BACK_FILE}" 38 - ERR_CODE=$? 39 - if [ ${ERR_CODE} -ne 0 ]; then 40 - _show_result $TID $ERR_CODE 41 - fi 28 + ublk_io_and_kill_daemon 8G -t null -q 4 & 29 + ublk_io_and_kill_daemon 256M -t loop -q 4 "${UBLK_BACKFILES[0]}" & 30 + ublk_io_and_kill_daemon 256M -t stripe -q 4 "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 31 + wait 42 32 43 - ublk_io_and_kill_daemon 256M -t loop -q 4 -z "${BACK_FILE}" 44 - ERR_CODE=$? 45 33 _cleanup_test "stress" 46 - _remove_backfile "${BACK_FILE}" 47 34 _show_result $TID $ERR_CODE
+38
tools/testing/selftests/ublk/test_stress_03.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + TID="stress_03" 6 + ERR_CODE=0 7 + 8 + ublk_io_and_remove() 9 + { 10 + run_io_and_remove "$@" 11 + ERR_CODE=$? 12 + if [ ${ERR_CODE} -ne 0 ]; then 13 + echo "$TID failure: $*" 14 + _show_result $TID $ERR_CODE 15 + fi 16 + } 17 + 18 + if ! _have_program fio; then 19 + exit "$UBLK_SKIP_CODE" 20 + fi 21 + 22 + if ! _have_feature "ZERO_COPY"; then 23 + exit "$UBLK_SKIP_CODE" 24 + fi 25 + 26 + _prep_test "stress" "run IO and remove device(zero copy)" 27 + 28 + _create_backfile 0 256M 29 + _create_backfile 1 128M 30 + _create_backfile 2 128M 31 + 32 + ublk_io_and_remove 8G -t null -q 4 -z & 33 + ublk_io_and_remove 256M -t loop -q 4 -z "${UBLK_BACKFILES[0]}" & 34 + ublk_io_and_remove 256M -t stripe -q 4 -z "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 35 + wait 36 + 37 + _cleanup_test "stress" 38 + _show_result $TID $ERR_CODE
+37
tools/testing/selftests/ublk/test_stress_04.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + TID="stress_04" 6 + ERR_CODE=0 7 + 8 + ublk_io_and_kill_daemon() 9 + { 10 + run_io_and_kill_daemon "$@" 11 + ERR_CODE=$? 12 + if [ ${ERR_CODE} -ne 0 ]; then 13 + echo "$TID failure: $*" 14 + _show_result $TID $ERR_CODE 15 + fi 16 + } 17 + 18 + if ! _have_program fio; then 19 + exit "$UBLK_SKIP_CODE" 20 + fi 21 + if ! _have_feature "ZERO_COPY"; then 22 + exit "$UBLK_SKIP_CODE" 23 + fi 24 + 25 + _prep_test "stress" "run IO and kill ublk server(zero copy)" 26 + 27 + _create_backfile 0 256M 28 + _create_backfile 1 128M 29 + _create_backfile 2 128M 30 + 31 + ublk_io_and_kill_daemon 8G -t null -q 4 -z & 32 + ublk_io_and_kill_daemon 256M -t loop -q 4 -z "${UBLK_BACKFILES[0]}" & 33 + ublk_io_and_kill_daemon 256M -t stripe -q 4 -z "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" & 34 + wait 35 + 36 + _cleanup_test "stress" 37 + _show_result $TID $ERR_CODE
+64
tools/testing/selftests/ublk/test_stress_05.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh 5 + TID="stress_05" 6 + ERR_CODE=0 7 + 8 + run_io_and_remove() 9 + { 10 + local size=$1 11 + local dev_id 12 + local dev_pid 13 + shift 1 14 + 15 + dev_id=$(_add_ublk_dev "$@") 16 + _check_add_dev $TID $? 17 + 18 + [ "$UBLK_TEST_QUIET" -eq 0 ] && echo "run ublk IO vs. remove device(ublk add $*)" 19 + 20 + fio --name=job1 --filename=/dev/ublkb"${dev_id}" --ioengine=libaio \ 21 + --rw=readwrite --iodepth=128 --size="${size}" --numjobs=4 \ 22 + --runtime=40 --time_based > /dev/null 2>&1 & 23 + sleep 4 24 + 25 + dev_pid=$(_get_ublk_daemon_pid "$dev_id") 26 + kill -9 "$dev_pid" 27 + 28 + if ! __remove_ublk_dev_return "${dev_id}"; then 29 + echo "delete dev ${dev_id} failed" 30 + return 255 31 + fi 32 + } 33 + 34 + ublk_io_and_remove() 35 + { 36 + run_io_and_remove "$@" 37 + ERR_CODE=$? 38 + if [ ${ERR_CODE} -ne 0 ]; then 39 + echo "$TID failure: $*" 40 + _show_result $TID $ERR_CODE 41 + fi 42 + } 43 + 44 + _prep_test "stress" "run IO and remove device with recovery enabled" 45 + 46 + _create_backfile 0 256M 47 + _create_backfile 1 256M 48 + 49 + for reissue in $(seq 0 1); do 50 + ublk_io_and_remove 8G -t null -q 4 -g 1 -r 1 -i "$reissue" & 51 + ublk_io_and_remove 256M -t loop -q 4 -g 1 -r 1 -i "$reissue" "${UBLK_BACKFILES[0]}" & 52 + wait 53 + done 54 + 55 + if _have_feature "ZERO_COPY"; then 56 + for reissue in $(seq 0 1); do 57 + ublk_io_and_remove 8G -t null -q 4 -g 1 -z -r 1 -i "$reissue" & 58 + ublk_io_and_remove 256M -t loop -q 4 -g 1 -z -r 1 -i "$reissue" "${UBLK_BACKFILES[1]}" & 59 + wait 60 + done 61 + fi 62 + 63 + _cleanup_test "stress" 64 + _show_result $TID $ERR_CODE
+4 -8
tools/testing/selftests/ublk/test_stripe_01.sh
··· 12 12 13 13 _prep_test "stripe" "write and verify test" 14 14 15 - backfile_0=$(_create_backfile 256M) 16 - backfile_1=$(_create_backfile 256M) 15 + _create_backfile 0 256M 16 + _create_backfile 1 256M 17 17 18 - dev_id=$(_add_ublk_dev -t stripe "$backfile_0" "$backfile_1") 19 - _check_add_dev $TID $? "${backfile_0}" 18 + dev_id=$(_add_ublk_dev -t stripe "${UBLK_BACKFILES[0]}" "${UBLK_BACKFILES[1]}") 19 + _check_add_dev $TID $? 20 20 21 21 # run fio over the ublk disk 22 22 _run_fio_verify_io --filename=/dev/ublkb"${dev_id}" --size=512M 23 23 ERR_CODE=$? 24 24 25 25 _cleanup_test "stripe" 26 - 27 - _remove_backfile "$backfile_0" 28 - _remove_backfile "$backfile_1" 29 - 30 26 _show_result $TID $ERR_CODE
+5 -8
tools/testing/selftests/ublk/test_stripe_02.sh
··· 8 8 9 9 _prep_test "stripe" "mkfs & mount & umount" 10 10 11 - backfile_0=$(_create_backfile 256M) 12 - backfile_1=$(_create_backfile 256M) 13 - dev_id=$(_add_ublk_dev -t stripe "$backfile_0" "$backfile_1") 14 - _check_add_dev $TID $? "$backfile_0" "$backfile_1" 11 + _create_backfile 0 256M 12 + _create_backfile 1 256M 13 + 14 + dev_id=$(_add_ublk_dev -t stripe "${UBLK_BACKFILES[0]}" "${UBLK_BACKFILES[1]}") 15 + _check_add_dev $TID $? 15 16 16 17 _mkfs_mount_test /dev/ublkb"${dev_id}" 17 18 ERR_CODE=$? 18 19 19 20 _cleanup_test "stripe" 20 - 21 - _remove_backfile "$backfile_0" 22 - _remove_backfile "$backfile_1" 23 - 24 21 _show_result $TID $ERR_CODE
+4 -8
tools/testing/selftests/ublk/test_stripe_03.sh
··· 12 12 13 13 _prep_test "stripe" "write and verify test" 14 14 15 - backfile_0=$(_create_backfile 256M) 16 - backfile_1=$(_create_backfile 256M) 15 + _create_backfile 0 256M 16 + _create_backfile 1 256M 17 17 18 - dev_id=$(_add_ublk_dev -q 2 -t stripe "$backfile_0" "$backfile_1") 19 - _check_add_dev $TID $? "${backfile_0}" 18 + dev_id=$(_add_ublk_dev -q 2 -t stripe "${UBLK_BACKFILES[0]}" "${UBLK_BACKFILES[1]}") 19 + _check_add_dev $TID $? 20 20 21 21 # run fio over the ublk disk 22 22 _run_fio_verify_io --filename=/dev/ublkb"${dev_id}" --size=512M 23 23 ERR_CODE=$? 24 24 25 25 _cleanup_test "stripe" 26 - 27 - _remove_backfile "$backfile_0" 28 - _remove_backfile "$backfile_1" 29 - 30 26 _show_result $TID $ERR_CODE
+5 -8
tools/testing/selftests/ublk/test_stripe_04.sh
··· 8 8 9 9 _prep_test "stripe" "mkfs & mount & umount on zero copy" 10 10 11 - backfile_0=$(_create_backfile 256M) 12 - backfile_1=$(_create_backfile 256M) 13 - dev_id=$(_add_ublk_dev -t stripe -z -q 2 "$backfile_0" "$backfile_1") 14 - _check_add_dev $TID $? "$backfile_0" "$backfile_1" 11 + _create_backfile 0 256M 12 + _create_backfile 1 256M 13 + 14 + dev_id=$(_add_ublk_dev -t stripe -z -q 2 "${UBLK_BACKFILES[0]}" "${UBLK_BACKFILES[1]}") 15 + _check_add_dev $TID $? 15 16 16 17 _mkfs_mount_test /dev/ublkb"${dev_id}" 17 18 ERR_CODE=$? 18 19 19 20 _cleanup_test "stripe" 20 - 21 - _remove_backfile "$backfile_0" 22 - _remove_backfile "$backfile_1" 23 - 24 21 _show_result $TID $ERR_CODE