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.

No conflicts.

Adjacent changes:

drivers/net/ethernet/pensando/ionic/ionic_txrx.c
d9c04209990b ("ionic: Mark error paths in the data path as unlikely")
491aee894a08 ("ionic: fix kernel panic in XDP_TX action")

net/ipv6/ip6_fib.c
b4cb4a1391dc ("net: use unrcu_pointer() helper")
b01e1c030770 ("ipv6: fix possible race in __fib6_drop_pcpu_from()")

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

+4054 -2306
+5 -4
.mailmap
··· 337 337 Karthikeyan Periyasamy <quic_periyasa@quicinc.com> <periyasa@codeaurora.org> 338 338 Kathiravan T <quic_kathirav@quicinc.com> <kathirav@codeaurora.org> 339 339 Kay Sievers <kay.sievers@vrfy.org> 340 - Kees Cook <keescook@chromium.org> <kees.cook@canonical.com> 341 - Kees Cook <keescook@chromium.org> <keescook@google.com> 342 - Kees Cook <keescook@chromium.org> <kees@outflux.net> 343 - Kees Cook <keescook@chromium.org> <kees@ubuntu.com> 340 + Kees Cook <kees@kernel.org> <kees.cook@canonical.com> 341 + Kees Cook <kees@kernel.org> <keescook@chromium.org> 342 + Kees Cook <kees@kernel.org> <keescook@google.com> 343 + Kees Cook <kees@kernel.org> <kees@outflux.net> 344 + Kees Cook <kees@kernel.org> <kees@ubuntu.com> 344 345 Keith Busch <kbusch@kernel.org> <keith.busch@intel.com> 345 346 Keith Busch <kbusch@kernel.org> <keith.busch@linux.intel.com> 346 347 Kenneth W Chen <kenneth.w.chen@intel.com>
+11 -24
Documentation/admin-guide/LSM/tomoyo.rst
··· 9 9 10 10 LiveCD-based tutorials are available at 11 11 12 - http://tomoyo.sourceforge.jp/1.8/ubuntu12.04-live.html 13 - http://tomoyo.sourceforge.jp/1.8/centos6-live.html 12 + https://tomoyo.sourceforge.net/1.8/ubuntu12.04-live.html 13 + https://tomoyo.sourceforge.net/1.8/centos6-live.html 14 14 15 15 Though these tutorials use non-LSM version of TOMOYO, they are useful for you 16 16 to know what TOMOYO is. ··· 21 21 Build the kernel with ``CONFIG_SECURITY_TOMOYO=y`` and pass ``security=tomoyo`` on 22 22 kernel's command line. 23 23 24 - Please see http://tomoyo.osdn.jp/2.5/ for details. 24 + Please see https://tomoyo.sourceforge.net/2.6/ for details. 25 25 26 26 Where is documentation? 27 27 ======================= 28 28 29 29 User <-> Kernel interface documentation is available at 30 - https://tomoyo.osdn.jp/2.5/policy-specification/index.html . 30 + https://tomoyo.sourceforge.net/2.6/policy-specification/index.html . 31 31 32 32 Materials we prepared for seminars and symposiums are available at 33 - https://osdn.jp/projects/tomoyo/docs/?category_id=532&language_id=1 . 33 + https://sourceforge.net/projects/tomoyo/files/docs/ . 34 34 Below lists are chosen from three aspects. 35 35 36 36 What is TOMOYO? 37 37 TOMOYO Linux Overview 38 - https://osdn.jp/projects/tomoyo/docs/lca2009-takeda.pdf 38 + https://sourceforge.net/projects/tomoyo/files/docs/lca2009-takeda.pdf 39 39 TOMOYO Linux: pragmatic and manageable security for Linux 40 - https://osdn.jp/projects/tomoyo/docs/freedomhectaipei-tomoyo.pdf 40 + https://sourceforge.net/projects/tomoyo/files/docs/freedomhectaipei-tomoyo.pdf 41 41 TOMOYO Linux: A Practical Method to Understand and Protect Your Own Linux Box 42 - https://osdn.jp/projects/tomoyo/docs/PacSec2007-en-no-demo.pdf 42 + https://sourceforge.net/projects/tomoyo/files/docs/PacSec2007-en-no-demo.pdf 43 43 44 44 What can TOMOYO do? 45 45 Deep inside TOMOYO Linux 46 - https://osdn.jp/projects/tomoyo/docs/lca2009-kumaneko.pdf 46 + https://sourceforge.net/projects/tomoyo/files/docs/lca2009-kumaneko.pdf 47 47 The role of "pathname based access control" in security. 48 - https://osdn.jp/projects/tomoyo/docs/lfj2008-bof.pdf 48 + https://sourceforge.net/projects/tomoyo/files/docs/lfj2008-bof.pdf 49 49 50 50 History of TOMOYO? 51 51 Realities of Mainlining 52 - https://osdn.jp/projects/tomoyo/docs/lfj2008.pdf 53 - 54 - What is future plan? 55 - ==================== 56 - 57 - We believe that inode based security and name based security are complementary 58 - and both should be used together. But unfortunately, so far, we cannot enable 59 - multiple LSM modules at the same time. We feel sorry that you have to give up 60 - SELinux/SMACK/AppArmor etc. when you want to use TOMOYO. 61 - 62 - We hope that LSM becomes stackable in future. Meanwhile, you can use non-LSM 63 - version of TOMOYO, available at http://tomoyo.osdn.jp/1.8/ . 64 - LSM version of TOMOYO is a subset of non-LSM version of TOMOYO. We are planning 65 - to port non-LSM version's functionalities to LSM versions. 52 + https://sourceforge.net/projects/tomoyo/files/docs/lfj2008.pdf
+22
Documentation/admin-guide/kernel-parameters.txt
··· 1921 1921 Format: 1922 1922 <bus_id>,<clkrate> 1923 1923 1924 + i2c_touchscreen_props= [HW,ACPI,X86] 1925 + Set device-properties for ACPI-enumerated I2C-attached 1926 + touchscreen, to e.g. fix coordinates of upside-down 1927 + mounted touchscreens. If you need this option please 1928 + submit a drivers/platform/x86/touchscreen_dmi.c patch 1929 + adding a DMI quirk for this. 1930 + 1931 + Format: 1932 + <ACPI_HW_ID>:<prop_name>=<val>[:prop_name=val][:...] 1933 + Where <val> is one of: 1934 + Omit "=<val>" entirely Set a boolean device-property 1935 + Unsigned number Set a u32 device-property 1936 + Anything else Set a string device-property 1937 + 1938 + Examples (split over multiple lines): 1939 + i2c_touchscreen_props=GDIX1001:touchscreen-inverted-x: 1940 + touchscreen-inverted-y 1941 + 1942 + i2c_touchscreen_props=MSSL1680:touchscreen-size-x=1920: 1943 + touchscreen-size-y=1080:touchscreen-inverted-y: 1944 + firmware-name=gsl1680-vendor-model.fw:silead,home-button 1945 + 1924 1946 i8042.debug [HW] Toggle i8042 debug mode 1925 1947 i8042.unmask_kbd_data 1926 1948 [HW] Enable printing of interrupt data from the KBD port
+3 -1
Documentation/arch/riscv/uabi.rst
··· 65 65 Misaligned accesses 66 66 ------------------- 67 67 68 - Misaligned accesses are supported in userspace, but they may perform poorly. 68 + Misaligned scalar accesses are supported in userspace, but they may perform 69 + poorly. Misaligned vector accesses are only supported if the Zicclsm extension 70 + is supported.
+1 -1
Documentation/core-api/swiotlb.rst
··· 192 192 193 193 Dynamic swiotlb 194 194 --------------- 195 - When CONFIG_DYNAMIC_SWIOTLB is enabled, swiotlb can do on-demand expansion of 195 + When CONFIG_SWIOTLB_DYNAMIC is enabled, swiotlb can do on-demand expansion of 196 196 the amount of memory available for allocation as bounce buffers. If a bounce 197 197 buffer request fails due to lack of available space, an asynchronous background 198 198 task is kicked off to allocate memory from general system memory and turn it
+1 -2
Documentation/devicetree/bindings/arm/stm32/st,mlahb.yaml
··· 54 54 55 55 examples: 56 56 - | 57 - mlahb: ahb@38000000 { 57 + ahb { 58 58 compatible = "st,mlahb", "simple-bus"; 59 59 #address-cells = <1>; 60 60 #size-cells = <1>; 61 - reg = <0x10000000 0x40000>; 62 61 ranges; 63 62 dma-ranges = <0x00000000 0x38000000 0x10000>, 64 63 <0x10000000 0x10000000 0x60000>,
+3 -3
Documentation/devicetree/bindings/arm/sunxi.yaml
··· 57 57 - const: allwinner,sun8i-v3s 58 58 59 59 - description: Anbernic RG35XX (2024) 60 - - items: 60 + items: 61 61 - const: anbernic,rg35xx-2024 62 62 - const: allwinner,sun50i-h700 63 63 64 64 - description: Anbernic RG35XX Plus 65 - - items: 65 + items: 66 66 - const: anbernic,rg35xx-plus 67 67 - const: allwinner,sun50i-h700 68 68 69 69 - description: Anbernic RG35XX H 70 - - items: 70 + items: 71 71 - const: anbernic,rg35xx-h 72 72 - const: allwinner,sun50i-h700 73 73
+13 -18
Documentation/networking/af_xdp.rst
··· 329 329 sxdp_shared_umem_fd field as you registered the UMEM on that 330 330 socket. These two sockets will now share one and the same UMEM. 331 331 332 - In this case, it is possible to use the NIC's packet steering 333 - capabilities to steer the packets to the right queue. This is not 334 - possible in the previous example as there is only one queue shared 335 - among sockets, so the NIC cannot do this steering as it can only steer 336 - between queues. 332 + There is no need to supply an XDP program like the one in the previous 333 + case where sockets were bound to the same queue id and 334 + device. Instead, use the NIC's packet steering capabilities to steer 335 + the packets to the right queue. In the previous example, there is only 336 + one queue shared among sockets, so the NIC cannot do this steering. It 337 + can only steer between queues. 337 338 338 - In libxdp (or libbpf prior to version 1.0), you need to use the 339 - xsk_socket__create_shared() API as it takes a reference to a FILL ring 340 - and a COMPLETION ring that will be created for you and bound to the 341 - shared UMEM. You can use this function for all the sockets you create, 342 - or you can use it for the second and following ones and use 343 - xsk_socket__create() for the first one. Both methods yield the same 344 - result. 339 + In libbpf, you need to use the xsk_socket__create_shared() API as it 340 + takes a reference to a FILL ring and a COMPLETION ring that will be 341 + created for you and bound to the shared UMEM. You can use this 342 + function for all the sockets you create, or you can use it for the 343 + second and following ones and use xsk_socket__create() for the first 344 + one. Both methods yield the same result. 345 345 346 346 Note that a UMEM can be shared between sockets on the same queue id 347 347 and device, as well as between queues on the same device and between 348 - devices at the same time. It is also possible to redirect to any 349 - socket as long as it is bound to the same umem with XDP_SHARED_UMEM. 348 + devices at the same time. 350 349 351 350 XDP_USE_NEED_WAKEUP bind flag 352 351 ----------------------------- ··· 821 822 to the same queue id Y. In zero-copy mode, you should use the 822 823 switch, or other distribution mechanism, in your NIC to direct 823 824 traffic to the correct queue id and socket. 824 - 825 - Note that if you are using the XDP_SHARED_UMEM option, it is 826 - possible to switch traffic between any socket bound to the same 827 - umem. 828 825 829 826 Q: My packets are sometimes corrupted. What is wrong? 830 827
+1 -4
MAINTAINERS
··· 1107 1107 S: Supported 1108 1108 F: Documentation/admin-guide/pm/amd-pstate.rst 1109 1109 F: drivers/cpufreq/amd-pstate* 1110 - F: include/linux/amd-pstate.h 1111 1110 F: tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py 1112 1111 1113 1112 AMD PTDMA DRIVER ··· 5187 5188 F: drivers/media/cec/i2c/ch7322.c 5188 5189 5189 5190 CIRRUS LOGIC AUDIO CODEC DRIVERS 5190 - M: James Schulman <james.schulman@cirrus.com> 5191 5191 M: David Rhodes <david.rhodes@cirrus.com> 5192 5192 M: Richard Fitzgerald <rf@opensource.cirrus.com> 5193 5193 L: alsa-devel@alsa-project.org (moderated for non-subscribers) ··· 15237 15239 F: include/linux/most.h 15238 15240 15239 15241 MOTORCOMM PHY DRIVER 15240 - M: Peter Geis <pgwipeout@gmail.com> 15241 15242 M: Frank <Frank.Sae@motor-comm.com> 15242 15243 L: netdev@vger.kernel.org 15243 15244 S: Maintained ··· 22677 22680 L: tomoyo-dev@lists.osdn.me (subscribers-only, for developers in Japanese) 22678 22681 L: tomoyo-users@lists.osdn.me (subscribers-only, for users in Japanese) 22679 22682 S: Maintained 22680 - W: https://tomoyo.osdn.jp/ 22683 + W: https://tomoyo.sourceforge.net/ 22681 22684 F: security/tomoyo/ 22682 22685 22683 22686 TOPSTAR LAPTOP EXTRAS DRIVER
+1 -1
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 10 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc1 5 + EXTRAVERSION = -rc2 6 6 NAME = Baby Opossum Posse 7 7 8 8 # *DOCUMENTATION*
+3 -3
arch/arm64/include/asm/el2_setup.h
··· 146 146 /* Coprocessor traps */ 147 147 .macro __init_el2_cptr 148 148 __check_hvhe .LnVHE_\@, x1 149 - mov x0, #(CPACR_EL1_FPEN_EL1EN | CPACR_EL1_FPEN_EL0EN) 149 + mov x0, #CPACR_ELx_FPEN 150 150 msr cpacr_el1, x0 151 151 b .Lskip_set_cptr_\@ 152 152 .LnVHE_\@: ··· 277 277 278 278 // (h)VHE case 279 279 mrs x0, cpacr_el1 // Disable SVE traps 280 - orr x0, x0, #(CPACR_EL1_ZEN_EL1EN | CPACR_EL1_ZEN_EL0EN) 280 + orr x0, x0, #CPACR_ELx_ZEN 281 281 msr cpacr_el1, x0 282 282 b .Lskip_set_cptr_\@ 283 283 ··· 298 298 299 299 // (h)VHE case 300 300 mrs x0, cpacr_el1 // Disable SME traps 301 - orr x0, x0, #(CPACR_EL1_SMEN_EL0EN | CPACR_EL1_SMEN_EL1EN) 301 + orr x0, x0, #CPACR_ELx_SMEN 302 302 msr cpacr_el1, x0 303 303 b .Lskip_set_cptr_sme_\@ 304 304
+6
arch/arm64/include/asm/kvm_arm.h
··· 305 305 GENMASK(19, 14) | \ 306 306 BIT(11)) 307 307 308 + #define CPTR_VHE_EL2_RES0 (GENMASK(63, 32) | \ 309 + GENMASK(27, 26) | \ 310 + GENMASK(23, 22) | \ 311 + GENMASK(19, 18) | \ 312 + GENMASK(15, 0)) 313 + 308 314 /* Hyp Debug Configuration Register bits */ 309 315 #define MDCR_EL2_E2TB_MASK (UL(0x3)) 310 316 #define MDCR_EL2_E2TB_SHIFT (UL(24))
+66 -5
arch/arm64/include/asm/kvm_emulate.h
··· 557 557 vcpu_set_flag((v), e); \ 558 558 } while (0) 559 559 560 + #define __build_check_all_or_none(r, bits) \ 561 + BUILD_BUG_ON(((r) & (bits)) && ((r) & (bits)) != (bits)) 562 + 563 + #define __cpacr_to_cptr_clr(clr, set) \ 564 + ({ \ 565 + u64 cptr = 0; \ 566 + \ 567 + if ((set) & CPACR_ELx_FPEN) \ 568 + cptr |= CPTR_EL2_TFP; \ 569 + if ((set) & CPACR_ELx_ZEN) \ 570 + cptr |= CPTR_EL2_TZ; \ 571 + if ((set) & CPACR_ELx_SMEN) \ 572 + cptr |= CPTR_EL2_TSM; \ 573 + if ((clr) & CPACR_ELx_TTA) \ 574 + cptr |= CPTR_EL2_TTA; \ 575 + if ((clr) & CPTR_EL2_TAM) \ 576 + cptr |= CPTR_EL2_TAM; \ 577 + if ((clr) & CPTR_EL2_TCPAC) \ 578 + cptr |= CPTR_EL2_TCPAC; \ 579 + \ 580 + cptr; \ 581 + }) 582 + 583 + #define __cpacr_to_cptr_set(clr, set) \ 584 + ({ \ 585 + u64 cptr = 0; \ 586 + \ 587 + if ((clr) & CPACR_ELx_FPEN) \ 588 + cptr |= CPTR_EL2_TFP; \ 589 + if ((clr) & CPACR_ELx_ZEN) \ 590 + cptr |= CPTR_EL2_TZ; \ 591 + if ((clr) & CPACR_ELx_SMEN) \ 592 + cptr |= CPTR_EL2_TSM; \ 593 + if ((set) & CPACR_ELx_TTA) \ 594 + cptr |= CPTR_EL2_TTA; \ 595 + if ((set) & CPTR_EL2_TAM) \ 596 + cptr |= CPTR_EL2_TAM; \ 597 + if ((set) & CPTR_EL2_TCPAC) \ 598 + cptr |= CPTR_EL2_TCPAC; \ 599 + \ 600 + cptr; \ 601 + }) 602 + 603 + #define cpacr_clear_set(clr, set) \ 604 + do { \ 605 + BUILD_BUG_ON((set) & CPTR_VHE_EL2_RES0); \ 606 + BUILD_BUG_ON((clr) & CPACR_ELx_E0POE); \ 607 + __build_check_all_or_none((clr), CPACR_ELx_FPEN); \ 608 + __build_check_all_or_none((set), CPACR_ELx_FPEN); \ 609 + __build_check_all_or_none((clr), CPACR_ELx_ZEN); \ 610 + __build_check_all_or_none((set), CPACR_ELx_ZEN); \ 611 + __build_check_all_or_none((clr), CPACR_ELx_SMEN); \ 612 + __build_check_all_or_none((set), CPACR_ELx_SMEN); \ 613 + \ 614 + if (has_vhe() || has_hvhe()) \ 615 + sysreg_clear_set(cpacr_el1, clr, set); \ 616 + else \ 617 + sysreg_clear_set(cptr_el2, \ 618 + __cpacr_to_cptr_clr(clr, set), \ 619 + __cpacr_to_cptr_set(clr, set));\ 620 + } while (0) 621 + 560 622 static __always_inline void kvm_write_cptr_el2(u64 val) 561 623 { 562 624 if (has_vhe() || has_hvhe()) ··· 632 570 u64 val; 633 571 634 572 if (has_vhe()) { 635 - val = (CPACR_EL1_FPEN_EL0EN | CPACR_EL1_FPEN_EL1EN | 636 - CPACR_EL1_ZEN_EL1EN); 573 + val = (CPACR_ELx_FPEN | CPACR_EL1_ZEN_EL1EN); 637 574 if (cpus_have_final_cap(ARM64_SME)) 638 575 val |= CPACR_EL1_SMEN_EL1EN; 639 576 } else if (has_hvhe()) { 640 - val = (CPACR_EL1_FPEN_EL0EN | CPACR_EL1_FPEN_EL1EN); 577 + val = CPACR_ELx_FPEN; 641 578 642 579 if (!vcpu_has_sve(vcpu) || !guest_owns_fp_regs()) 643 - val |= CPACR_EL1_ZEN_EL1EN | CPACR_EL1_ZEN_EL0EN; 580 + val |= CPACR_ELx_ZEN; 644 581 if (cpus_have_final_cap(ARM64_SME)) 645 - val |= CPACR_EL1_SMEN_EL1EN | CPACR_EL1_SMEN_EL0EN; 582 + val |= CPACR_ELx_SMEN; 646 583 } else { 647 584 val = CPTR_NVHE_EL2_RES1; 648 585
+24 -1
arch/arm64/include/asm/kvm_host.h
··· 76 76 DECLARE_STATIC_KEY_FALSE(userspace_irqchip_in_use); 77 77 78 78 extern unsigned int __ro_after_init kvm_sve_max_vl; 79 + extern unsigned int __ro_after_init kvm_host_sve_max_vl; 79 80 int __init kvm_arm_init_sve(void); 80 81 81 82 u32 __attribute_const__ kvm_target_cpu(void); ··· 522 521 u64 *vncr_array; 523 522 }; 524 523 524 + struct cpu_sve_state { 525 + __u64 zcr_el1; 526 + 527 + /* 528 + * Ordering is important since __sve_save_state/__sve_restore_state 529 + * relies on it. 530 + */ 531 + __u32 fpsr; 532 + __u32 fpcr; 533 + 534 + /* Must be SVE_VQ_BYTES (128 bit) aligned. */ 535 + __u8 sve_regs[]; 536 + }; 537 + 525 538 /* 526 539 * This structure is instantiated on a per-CPU basis, and contains 527 540 * data that is: ··· 549 534 */ 550 535 struct kvm_host_data { 551 536 struct kvm_cpu_context host_ctxt; 552 - struct user_fpsimd_state *fpsimd_state; /* hyp VA */ 537 + 538 + /* 539 + * All pointers in this union are hyp VA. 540 + * sve_state is only used in pKVM and if system_supports_sve(). 541 + */ 542 + union { 543 + struct user_fpsimd_state *fpsimd_state; 544 + struct cpu_sve_state *sve_state; 545 + }; 553 546 554 547 /* Ownership of the FP regs */ 555 548 enum {
+3 -1
arch/arm64/include/asm/kvm_hyp.h
··· 111 111 112 112 void __fpsimd_save_state(struct user_fpsimd_state *fp_regs); 113 113 void __fpsimd_restore_state(struct user_fpsimd_state *fp_regs); 114 - void __sve_restore_state(void *sve_pffr, u32 *fpsr); 114 + void __sve_save_state(void *sve_pffr, u32 *fpsr, int save_ffr); 115 + void __sve_restore_state(void *sve_pffr, u32 *fpsr, int restore_ffr); 115 116 116 117 u64 __guest_enter(struct kvm_vcpu *vcpu); 117 118 ··· 143 142 144 143 extern unsigned long kvm_nvhe_sym(__icache_flags); 145 144 extern unsigned int kvm_nvhe_sym(kvm_arm_vmid_bits); 145 + extern unsigned int kvm_nvhe_sym(kvm_host_sve_max_vl); 146 146 147 147 #endif /* __ARM64_KVM_HYP_H__ */
+9
arch/arm64/include/asm/kvm_pkvm.h
··· 128 128 return (2 * KVM_FFA_MBOX_NR_PAGES) + DIV_ROUND_UP(desc_max, PAGE_SIZE); 129 129 } 130 130 131 + static inline size_t pkvm_host_sve_state_size(void) 132 + { 133 + if (!system_supports_sve()) 134 + return 0; 135 + 136 + return size_add(sizeof(struct cpu_sve_state), 137 + SVE_SIG_REGS_SIZE(sve_vq_from_vl(kvm_host_sve_max_vl))); 138 + } 139 + 131 140 #endif /* __ARM64_KVM_PKVM_H__ */
+76
arch/arm64/kvm/arm.c
··· 1931 1931 return size ? get_order(size) : 0; 1932 1932 } 1933 1933 1934 + static size_t pkvm_host_sve_state_order(void) 1935 + { 1936 + return get_order(pkvm_host_sve_state_size()); 1937 + } 1938 + 1934 1939 /* A lookup table holding the hypervisor VA for each vector slot */ 1935 1940 static void *hyp_spectre_vector_selector[BP_HARDEN_EL2_SLOTS]; 1936 1941 ··· 2315 2310 2316 2311 static void __init teardown_hyp_mode(void) 2317 2312 { 2313 + bool free_sve = system_supports_sve() && is_protected_kvm_enabled(); 2318 2314 int cpu; 2319 2315 2320 2316 free_hyp_pgds(); 2321 2317 for_each_possible_cpu(cpu) { 2322 2318 free_page(per_cpu(kvm_arm_hyp_stack_page, cpu)); 2323 2319 free_pages(kvm_nvhe_sym(kvm_arm_hyp_percpu_base)[cpu], nvhe_percpu_order()); 2320 + 2321 + if (free_sve) { 2322 + struct cpu_sve_state *sve_state; 2323 + 2324 + sve_state = per_cpu_ptr_nvhe_sym(kvm_host_data, cpu)->sve_state; 2325 + free_pages((unsigned long) sve_state, pkvm_host_sve_state_order()); 2326 + } 2324 2327 } 2325 2328 } 2326 2329 ··· 2409 2396 free_hyp_pgds(); 2410 2397 2411 2398 return 0; 2399 + } 2400 + 2401 + static int init_pkvm_host_sve_state(void) 2402 + { 2403 + int cpu; 2404 + 2405 + if (!system_supports_sve()) 2406 + return 0; 2407 + 2408 + /* Allocate pages for host sve state in protected mode. */ 2409 + for_each_possible_cpu(cpu) { 2410 + struct page *page = alloc_pages(GFP_KERNEL, pkvm_host_sve_state_order()); 2411 + 2412 + if (!page) 2413 + return -ENOMEM; 2414 + 2415 + per_cpu_ptr_nvhe_sym(kvm_host_data, cpu)->sve_state = page_address(page); 2416 + } 2417 + 2418 + /* 2419 + * Don't map the pages in hyp since these are only used in protected 2420 + * mode, which will (re)create its own mapping when initialized. 2421 + */ 2422 + 2423 + return 0; 2424 + } 2425 + 2426 + /* 2427 + * Finalizes the initialization of hyp mode, once everything else is initialized 2428 + * and the initialziation process cannot fail. 2429 + */ 2430 + static void finalize_init_hyp_mode(void) 2431 + { 2432 + int cpu; 2433 + 2434 + if (system_supports_sve() && is_protected_kvm_enabled()) { 2435 + for_each_possible_cpu(cpu) { 2436 + struct cpu_sve_state *sve_state; 2437 + 2438 + sve_state = per_cpu_ptr_nvhe_sym(kvm_host_data, cpu)->sve_state; 2439 + per_cpu_ptr_nvhe_sym(kvm_host_data, cpu)->sve_state = 2440 + kern_hyp_va(sve_state); 2441 + } 2442 + } else { 2443 + for_each_possible_cpu(cpu) { 2444 + struct user_fpsimd_state *fpsimd_state; 2445 + 2446 + fpsimd_state = &per_cpu_ptr_nvhe_sym(kvm_host_data, cpu)->host_ctxt.fp_regs; 2447 + per_cpu_ptr_nvhe_sym(kvm_host_data, cpu)->fpsimd_state = 2448 + kern_hyp_va(fpsimd_state); 2449 + } 2450 + } 2412 2451 } 2413 2452 2414 2453 static void pkvm_hyp_init_ptrauth(void) ··· 2631 2566 goto out_err; 2632 2567 } 2633 2568 2569 + err = init_pkvm_host_sve_state(); 2570 + if (err) 2571 + goto out_err; 2572 + 2634 2573 err = kvm_hyp_init_protection(hyp_va_bits); 2635 2574 if (err) { 2636 2575 kvm_err("Failed to init hyp memory protection\n"); ··· 2798 2729 err = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE); 2799 2730 if (err) 2800 2731 goto out_subs; 2732 + 2733 + /* 2734 + * This should be called after initialization is done and failure isn't 2735 + * possible anymore. 2736 + */ 2737 + if (!in_hyp_mode) 2738 + finalize_init_hyp_mode(); 2801 2739 2802 2740 kvm_arm_initialised = true; 2803 2741
+11 -10
arch/arm64/kvm/emulate-nested.c
··· 2181 2181 if (forward_traps(vcpu, HCR_NV)) 2182 2182 return; 2183 2183 2184 + spsr = vcpu_read_sys_reg(vcpu, SPSR_EL2); 2185 + spsr = kvm_check_illegal_exception_return(vcpu, spsr); 2186 + 2184 2187 /* Check for an ERETAx */ 2185 2188 esr = kvm_vcpu_get_esr(vcpu); 2186 2189 if (esr_iss_is_eretax(esr) && !kvm_auth_eretax(vcpu, &elr)) { 2187 2190 /* 2188 - * Oh no, ERETAx failed to authenticate. If we have 2189 - * FPACCOMBINE, deliver an exception right away. If we 2190 - * don't, then let the mangled ELR value trickle down the 2191 + * Oh no, ERETAx failed to authenticate. 2192 + * 2193 + * If we have FPACCOMBINE and we don't have a pending 2194 + * Illegal Execution State exception (which has priority 2195 + * over FPAC), deliver an exception right away. 2196 + * 2197 + * Otherwise, let the mangled ELR value trickle down the 2191 2198 * ERET handling, and the guest will have a little surprise. 2192 2199 */ 2193 - if (kvm_has_pauth(vcpu->kvm, FPACCOMBINE)) { 2200 + if (kvm_has_pauth(vcpu->kvm, FPACCOMBINE) && !(spsr & PSR_IL_BIT)) { 2194 2201 esr &= ESR_ELx_ERET_ISS_ERETA; 2195 2202 esr |= FIELD_PREP(ESR_ELx_EC_MASK, ESR_ELx_EC_FPAC); 2196 2203 kvm_inject_nested_sync(vcpu, esr); ··· 2208 2201 preempt_disable(); 2209 2202 kvm_arch_vcpu_put(vcpu); 2210 2203 2211 - spsr = __vcpu_sys_reg(vcpu, SPSR_EL2); 2212 - spsr = kvm_check_illegal_exception_return(vcpu, spsr); 2213 2204 if (!esr_iss_is_eretax(esr)) 2214 2205 elr = __vcpu_sys_reg(vcpu, ELR_EL2); 2215 2206 2216 2207 trace_kvm_nested_eret(vcpu, elr, spsr); 2217 2208 2218 - /* 2219 - * Note that the current exception level is always the virtual EL2, 2220 - * since we set HCR_EL2.NV bit only when entering the virtual EL2. 2221 - */ 2222 2209 *vcpu_pc(vcpu) = elr; 2223 2210 *vcpu_cpsr(vcpu) = spsr; 2224 2211
+8 -3
arch/arm64/kvm/fpsimd.c
··· 90 90 fpsimd_save_and_flush_cpu_state(); 91 91 } 92 92 } 93 + 94 + /* 95 + * If normal guests gain SME support, maintain this behavior for pKVM 96 + * guests, which don't support SME. 97 + */ 98 + WARN_ON(is_protected_kvm_enabled() && system_supports_sme() && 99 + read_sysreg_s(SYS_SVCR)); 93 100 } 94 101 95 102 /* ··· 168 161 if (has_vhe() && system_supports_sme()) { 169 162 /* Also restore EL0 state seen on entry */ 170 163 if (vcpu_get_flag(vcpu, HOST_SME_ENABLED)) 171 - sysreg_clear_set(CPACR_EL1, 0, 172 - CPACR_EL1_SMEN_EL0EN | 173 - CPACR_EL1_SMEN_EL1EN); 164 + sysreg_clear_set(CPACR_EL1, 0, CPACR_ELx_SMEN); 174 165 else 175 166 sysreg_clear_set(CPACR_EL1, 176 167 CPACR_EL1_SMEN_EL0EN,
+2 -1
arch/arm64/kvm/guest.c
··· 251 251 case PSR_AA32_MODE_SVC: 252 252 case PSR_AA32_MODE_ABT: 253 253 case PSR_AA32_MODE_UND: 254 + case PSR_AA32_MODE_SYS: 254 255 if (!vcpu_el1_is_32bit(vcpu)) 255 256 return -EINVAL; 256 257 break; ··· 277 276 if (*vcpu_cpsr(vcpu) & PSR_MODE32_BIT) { 278 277 int i, nr_reg; 279 278 280 - switch (*vcpu_cpsr(vcpu)) { 279 + switch (*vcpu_cpsr(vcpu) & PSR_AA32_MODE_MASK) { 281 280 /* 282 281 * Either we are dealing with user mode, and only the 283 282 * first 15 registers (+ PC) must be narrowed to 32bit.
+16 -2
arch/arm64/kvm/hyp/aarch32.c
··· 50 50 u32 cpsr_cond; 51 51 int cond; 52 52 53 - /* Top two bits non-zero? Unconditional. */ 54 - if (kvm_vcpu_get_esr(vcpu) >> 30) 53 + /* 54 + * These are the exception classes that could fire with a 55 + * conditional instruction. 56 + */ 57 + switch (kvm_vcpu_trap_get_class(vcpu)) { 58 + case ESR_ELx_EC_CP15_32: 59 + case ESR_ELx_EC_CP15_64: 60 + case ESR_ELx_EC_CP14_MR: 61 + case ESR_ELx_EC_CP14_LS: 62 + case ESR_ELx_EC_FP_ASIMD: 63 + case ESR_ELx_EC_CP10_ID: 64 + case ESR_ELx_EC_CP14_64: 65 + case ESR_ELx_EC_SVC32: 66 + break; 67 + default: 55 68 return true; 69 + } 56 70 57 71 /* Is condition field valid? */ 58 72 cond = kvm_vcpu_get_condition(vcpu);
+6
arch/arm64/kvm/hyp/fpsimd.S
··· 25 25 sve_load 0, x1, x2, 3 26 26 ret 27 27 SYM_FUNC_END(__sve_restore_state) 28 + 29 + SYM_FUNC_START(__sve_save_state) 30 + mov x2, #1 31 + sve_save 0, x1, x2, 3 32 + ret 33 + SYM_FUNC_END(__sve_save_state)
+20 -16
arch/arm64/kvm/hyp/include/hyp/switch.h
··· 316 316 { 317 317 sve_cond_update_zcr_vq(vcpu_sve_max_vq(vcpu) - 1, SYS_ZCR_EL2); 318 318 __sve_restore_state(vcpu_sve_pffr(vcpu), 319 - &vcpu->arch.ctxt.fp_regs.fpsr); 319 + &vcpu->arch.ctxt.fp_regs.fpsr, 320 + true); 320 321 write_sysreg_el1(__vcpu_sys_reg(vcpu, ZCR_EL1), SYS_ZCR); 321 322 } 323 + 324 + static inline void __hyp_sve_save_host(void) 325 + { 326 + struct cpu_sve_state *sve_state = *host_data_ptr(sve_state); 327 + 328 + sve_state->zcr_el1 = read_sysreg_el1(SYS_ZCR); 329 + write_sysreg_s(ZCR_ELx_LEN_MASK, SYS_ZCR_EL2); 330 + __sve_save_state(sve_state->sve_regs + sve_ffr_offset(kvm_host_sve_max_vl), 331 + &sve_state->fpsr, 332 + true); 333 + } 334 + 335 + static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu); 322 336 323 337 /* 324 338 * We trap the first access to the FP/SIMD to save the host context and ··· 344 330 { 345 331 bool sve_guest; 346 332 u8 esr_ec; 347 - u64 reg; 348 333 349 334 if (!system_supports_fpsimd()) 350 335 return false; ··· 366 353 /* Valid trap. Switch the context: */ 367 354 368 355 /* First disable enough traps to allow us to update the registers */ 369 - if (has_vhe() || has_hvhe()) { 370 - reg = CPACR_EL1_FPEN_EL0EN | CPACR_EL1_FPEN_EL1EN; 371 - if (sve_guest) 372 - reg |= CPACR_EL1_ZEN_EL0EN | CPACR_EL1_ZEN_EL1EN; 373 - 374 - sysreg_clear_set(cpacr_el1, 0, reg); 375 - } else { 376 - reg = CPTR_EL2_TFP; 377 - if (sve_guest) 378 - reg |= CPTR_EL2_TZ; 379 - 380 - sysreg_clear_set(cptr_el2, reg, 0); 381 - } 356 + if (sve_guest || (is_protected_kvm_enabled() && system_supports_sve())) 357 + cpacr_clear_set(0, CPACR_ELx_FPEN | CPACR_ELx_ZEN); 358 + else 359 + cpacr_clear_set(0, CPACR_ELx_FPEN); 382 360 isb(); 383 361 384 362 /* Write out the host state if it's in the registers */ 385 363 if (host_owns_fp_regs()) 386 - __fpsimd_save_state(*host_data_ptr(fpsimd_state)); 364 + kvm_hyp_save_fpsimd_host(vcpu); 387 365 388 366 /* Restore the guest state */ 389 367 if (sve_guest)
-1
arch/arm64/kvm/hyp/include/nvhe/pkvm.h
··· 59 59 } 60 60 61 61 void pkvm_hyp_vm_table_init(void *tbl); 62 - void pkvm_host_fpsimd_state_init(void); 63 62 64 63 int __pkvm_init_vm(struct kvm *host_kvm, unsigned long vm_hva, 65 64 unsigned long pgd_hva);
+76 -8
arch/arm64/kvm/hyp/nvhe/hyp-main.c
··· 23 23 24 24 void __kvm_hyp_host_forward_smc(struct kvm_cpu_context *host_ctxt); 25 25 26 + static void __hyp_sve_save_guest(struct kvm_vcpu *vcpu) 27 + { 28 + __vcpu_sys_reg(vcpu, ZCR_EL1) = read_sysreg_el1(SYS_ZCR); 29 + /* 30 + * On saving/restoring guest sve state, always use the maximum VL for 31 + * the guest. The layout of the data when saving the sve state depends 32 + * on the VL, so use a consistent (i.e., the maximum) guest VL. 33 + */ 34 + sve_cond_update_zcr_vq(vcpu_sve_max_vq(vcpu) - 1, SYS_ZCR_EL2); 35 + __sve_save_state(vcpu_sve_pffr(vcpu), &vcpu->arch.ctxt.fp_regs.fpsr, true); 36 + write_sysreg_s(ZCR_ELx_LEN_MASK, SYS_ZCR_EL2); 37 + } 38 + 39 + static void __hyp_sve_restore_host(void) 40 + { 41 + struct cpu_sve_state *sve_state = *host_data_ptr(sve_state); 42 + 43 + /* 44 + * On saving/restoring host sve state, always use the maximum VL for 45 + * the host. The layout of the data when saving the sve state depends 46 + * on the VL, so use a consistent (i.e., the maximum) host VL. 47 + * 48 + * Setting ZCR_EL2 to ZCR_ELx_LEN_MASK sets the effective length 49 + * supported by the system (or limited at EL3). 50 + */ 51 + write_sysreg_s(ZCR_ELx_LEN_MASK, SYS_ZCR_EL2); 52 + __sve_restore_state(sve_state->sve_regs + sve_ffr_offset(kvm_host_sve_max_vl), 53 + &sve_state->fpsr, 54 + true); 55 + write_sysreg_el1(sve_state->zcr_el1, SYS_ZCR); 56 + } 57 + 58 + static void fpsimd_sve_flush(void) 59 + { 60 + *host_data_ptr(fp_owner) = FP_STATE_HOST_OWNED; 61 + } 62 + 63 + static void fpsimd_sve_sync(struct kvm_vcpu *vcpu) 64 + { 65 + if (!guest_owns_fp_regs()) 66 + return; 67 + 68 + cpacr_clear_set(0, CPACR_ELx_FPEN | CPACR_ELx_ZEN); 69 + isb(); 70 + 71 + if (vcpu_has_sve(vcpu)) 72 + __hyp_sve_save_guest(vcpu); 73 + else 74 + __fpsimd_save_state(&vcpu->arch.ctxt.fp_regs); 75 + 76 + if (system_supports_sve()) 77 + __hyp_sve_restore_host(); 78 + else 79 + __fpsimd_restore_state(*host_data_ptr(fpsimd_state)); 80 + 81 + *host_data_ptr(fp_owner) = FP_STATE_HOST_OWNED; 82 + } 83 + 26 84 static void flush_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu) 27 85 { 28 86 struct kvm_vcpu *host_vcpu = hyp_vcpu->host_vcpu; 29 87 88 + fpsimd_sve_flush(); 89 + 30 90 hyp_vcpu->vcpu.arch.ctxt = host_vcpu->arch.ctxt; 31 91 32 92 hyp_vcpu->vcpu.arch.sve_state = kern_hyp_va(host_vcpu->arch.sve_state); 33 - hyp_vcpu->vcpu.arch.sve_max_vl = host_vcpu->arch.sve_max_vl; 93 + /* Limit guest vector length to the maximum supported by the host. */ 94 + hyp_vcpu->vcpu.arch.sve_max_vl = min(host_vcpu->arch.sve_max_vl, kvm_host_sve_max_vl); 34 95 35 96 hyp_vcpu->vcpu.arch.hw_mmu = host_vcpu->arch.hw_mmu; 36 97 37 98 hyp_vcpu->vcpu.arch.hcr_el2 = host_vcpu->arch.hcr_el2; 38 99 hyp_vcpu->vcpu.arch.mdcr_el2 = host_vcpu->arch.mdcr_el2; 39 - hyp_vcpu->vcpu.arch.cptr_el2 = host_vcpu->arch.cptr_el2; 40 100 41 101 hyp_vcpu->vcpu.arch.iflags = host_vcpu->arch.iflags; 42 102 ··· 114 54 struct vgic_v3_cpu_if *host_cpu_if = &host_vcpu->arch.vgic_cpu.vgic_v3; 115 55 unsigned int i; 116 56 57 + fpsimd_sve_sync(&hyp_vcpu->vcpu); 58 + 117 59 host_vcpu->arch.ctxt = hyp_vcpu->vcpu.arch.ctxt; 118 60 119 61 host_vcpu->arch.hcr_el2 = hyp_vcpu->vcpu.arch.hcr_el2; 120 - host_vcpu->arch.cptr_el2 = hyp_vcpu->vcpu.arch.cptr_el2; 121 62 122 63 host_vcpu->arch.fault = hyp_vcpu->vcpu.arch.fault; 123 64 ··· 139 78 if (unlikely(is_protected_kvm_enabled())) { 140 79 struct pkvm_hyp_vcpu *hyp_vcpu; 141 80 struct kvm *host_kvm; 81 + 82 + /* 83 + * KVM (and pKVM) doesn't support SME guests for now, and 84 + * ensures that SME features aren't enabled in pstate when 85 + * loading a vcpu. Therefore, if SME features enabled the host 86 + * is misbehaving. 87 + */ 88 + if (unlikely(system_supports_sme() && read_sysreg_s(SYS_SVCR))) { 89 + ret = -EINVAL; 90 + goto out; 91 + } 142 92 143 93 host_kvm = kern_hyp_va(host_vcpu->kvm); 144 94 hyp_vcpu = pkvm_load_hyp_vcpu(host_kvm->arch.pkvm.handle, ··· 477 405 handle_host_smc(host_ctxt); 478 406 break; 479 407 case ESR_ELx_EC_SVE: 480 - if (has_hvhe()) 481 - sysreg_clear_set(cpacr_el1, 0, (CPACR_EL1_ZEN_EL1EN | 482 - CPACR_EL1_ZEN_EL0EN)); 483 - else 484 - sysreg_clear_set(cptr_el2, CPTR_EL2_TZ, 0); 408 + cpacr_clear_set(0, CPACR_ELx_ZEN); 485 409 isb(); 486 410 sve_cond_update_zcr_vq(ZCR_ELx_LEN_MASK, SYS_ZCR_EL2); 487 411 break;
+5 -12
arch/arm64/kvm/hyp/nvhe/pkvm.c
··· 18 18 /* Used by kvm_get_vttbr(). */ 19 19 unsigned int kvm_arm_vmid_bits; 20 20 21 + unsigned int kvm_host_sve_max_vl; 22 + 21 23 /* 22 24 * Set trap register values based on features in ID_AA64PFR0. 23 25 */ ··· 65 63 /* Trap SVE */ 66 64 if (!FIELD_GET(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_SVE), feature_ids)) { 67 65 if (has_hvhe()) 68 - cptr_clear |= CPACR_EL1_ZEN_EL0EN | CPACR_EL1_ZEN_EL1EN; 66 + cptr_clear |= CPACR_ELx_ZEN; 69 67 else 70 68 cptr_set |= CPTR_EL2_TZ; 71 69 } ··· 247 245 { 248 246 WARN_ON(vm_table); 249 247 vm_table = tbl; 250 - } 251 - 252 - void pkvm_host_fpsimd_state_init(void) 253 - { 254 - unsigned long i; 255 - 256 - for (i = 0; i < hyp_nr_cpus; i++) { 257 - struct kvm_host_data *host_data = per_cpu_ptr(&kvm_host_data, i); 258 - 259 - host_data->fpsimd_state = &host_data->host_ctxt.fp_regs; 260 - } 261 248 } 262 249 263 250 /* ··· 576 585 577 586 if (ret) 578 587 unmap_donated_memory(hyp_vcpu, sizeof(*hyp_vcpu)); 588 + 589 + hyp_vcpu->vcpu.arch.cptr_el2 = kvm_get_reset_cptr_el2(&hyp_vcpu->vcpu); 579 590 580 591 return ret; 581 592 }
+24 -1
arch/arm64/kvm/hyp/nvhe/setup.c
··· 67 67 return 0; 68 68 } 69 69 70 + static int pkvm_create_host_sve_mappings(void) 71 + { 72 + void *start, *end; 73 + int ret, i; 74 + 75 + if (!system_supports_sve()) 76 + return 0; 77 + 78 + for (i = 0; i < hyp_nr_cpus; i++) { 79 + struct kvm_host_data *host_data = per_cpu_ptr(&kvm_host_data, i); 80 + struct cpu_sve_state *sve_state = host_data->sve_state; 81 + 82 + start = kern_hyp_va(sve_state); 83 + end = start + PAGE_ALIGN(pkvm_host_sve_state_size()); 84 + ret = pkvm_create_mappings(start, end, PAGE_HYP); 85 + if (ret) 86 + return ret; 87 + } 88 + 89 + return 0; 90 + } 91 + 70 92 static int recreate_hyp_mappings(phys_addr_t phys, unsigned long size, 71 93 unsigned long *per_cpu_base, 72 94 u32 hyp_va_bits) ··· 146 124 if (ret) 147 125 return ret; 148 126 } 127 + 128 + pkvm_create_host_sve_mappings(); 149 129 150 130 /* 151 131 * Map the host sections RO in the hypervisor, but transfer the ··· 324 300 goto out; 325 301 326 302 pkvm_hyp_vm_table_init(vm_table_base); 327 - pkvm_host_fpsimd_state_init(); 328 303 out: 329 304 /* 330 305 * We tail-called to here from handle___pkvm_init() and will not return,
+21 -3
arch/arm64/kvm/hyp/nvhe/switch.c
··· 48 48 val |= has_hvhe() ? CPACR_EL1_TTA : CPTR_EL2_TTA; 49 49 if (cpus_have_final_cap(ARM64_SME)) { 50 50 if (has_hvhe()) 51 - val &= ~(CPACR_EL1_SMEN_EL1EN | CPACR_EL1_SMEN_EL0EN); 51 + val &= ~CPACR_ELx_SMEN; 52 52 else 53 53 val |= CPTR_EL2_TSM; 54 54 } 55 55 56 56 if (!guest_owns_fp_regs()) { 57 57 if (has_hvhe()) 58 - val &= ~(CPACR_EL1_FPEN_EL0EN | CPACR_EL1_FPEN_EL1EN | 59 - CPACR_EL1_ZEN_EL0EN | CPACR_EL1_ZEN_EL1EN); 58 + val &= ~(CPACR_ELx_FPEN | CPACR_ELx_ZEN); 60 59 else 61 60 val |= CPTR_EL2_TFP | CPTR_EL2_TZ; 62 61 ··· 179 180 */ 180 181 return (kvm_hyp_handle_sysreg(vcpu, exit_code) || 181 182 kvm_handle_pvm_sysreg(vcpu, exit_code)); 183 + } 184 + 185 + static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu) 186 + { 187 + /* 188 + * Non-protected kvm relies on the host restoring its sve state. 189 + * Protected kvm restores the host's sve state as not to reveal that 190 + * fpsimd was used by a guest nor leak upper sve bits. 191 + */ 192 + if (unlikely(is_protected_kvm_enabled() && system_supports_sve())) { 193 + __hyp_sve_save_host(); 194 + 195 + /* Re-enable SVE traps if not supported for the guest vcpu. */ 196 + if (!vcpu_has_sve(vcpu)) 197 + cpacr_clear_set(CPACR_ELx_ZEN, 0); 198 + 199 + } else { 200 + __fpsimd_save_state(*host_data_ptr(fpsimd_state)); 201 + } 182 202 } 183 203 184 204 static const exit_handler_fn hyp_exit_handlers[] = {
+8 -4
arch/arm64/kvm/hyp/vhe/switch.c
··· 93 93 94 94 val = read_sysreg(cpacr_el1); 95 95 val |= CPACR_ELx_TTA; 96 - val &= ~(CPACR_EL1_ZEN_EL0EN | CPACR_EL1_ZEN_EL1EN | 97 - CPACR_EL1_SMEN_EL0EN | CPACR_EL1_SMEN_EL1EN); 96 + val &= ~(CPACR_ELx_ZEN | CPACR_ELx_SMEN); 98 97 99 98 /* 100 99 * With VHE (HCR.E2H == 1), accesses to CPACR_EL1 are routed to ··· 108 109 109 110 if (guest_owns_fp_regs()) { 110 111 if (vcpu_has_sve(vcpu)) 111 - val |= CPACR_EL1_ZEN_EL0EN | CPACR_EL1_ZEN_EL1EN; 112 + val |= CPACR_ELx_ZEN; 112 113 } else { 113 - val &= ~(CPACR_EL1_FPEN_EL0EN | CPACR_EL1_FPEN_EL1EN); 114 + val &= ~CPACR_ELx_FPEN; 114 115 __activate_traps_fpsimd32(vcpu); 115 116 } 116 117 ··· 259 260 write_sysreg_el2(elr, SYS_ELR); 260 261 261 262 return true; 263 + } 264 + 265 + static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu) 266 + { 267 + __fpsimd_save_state(*host_data_ptr(fpsimd_state)); 262 268 } 263 269 264 270 static const exit_handler_fn hyp_exit_handlers[] = {
+4 -2
arch/arm64/kvm/nested.c
··· 58 58 break; 59 59 60 60 case SYS_ID_AA64PFR1_EL1: 61 - /* Only support SSBS */ 62 - val &= NV_FTR(PFR1, SSBS); 61 + /* Only support BTI, SSBS, CSV2_frac */ 62 + val &= (NV_FTR(PFR1, BT) | 63 + NV_FTR(PFR1, SSBS) | 64 + NV_FTR(PFR1, CSV2_frac)); 63 65 break; 64 66 65 67 case SYS_ID_AA64MMFR0_EL1:
+3
arch/arm64/kvm/reset.c
··· 32 32 33 33 /* Maximum phys_shift supported for any VM on this host */ 34 34 static u32 __ro_after_init kvm_ipa_limit; 35 + unsigned int __ro_after_init kvm_host_sve_max_vl; 35 36 36 37 /* 37 38 * ARMv8 Reset Values ··· 52 51 { 53 52 if (system_supports_sve()) { 54 53 kvm_sve_max_vl = sve_max_virtualisable_vl(); 54 + kvm_host_sve_max_vl = sve_max_vl(); 55 + kvm_nvhe_sym(kvm_host_sve_max_vl) = kvm_host_sve_max_vl; 55 56 56 57 /* 57 58 * The get_sve_reg()/set_sve_reg() ioctl interface will need
+2 -2
arch/loongarch/boot/dts/loongson-2k0500-ref.dts
··· 44 44 &gmac0 { 45 45 status = "okay"; 46 46 47 - phy-mode = "rgmii"; 47 + phy-mode = "rgmii-id"; 48 48 bus_id = <0x0>; 49 49 }; 50 50 51 51 &gmac1 { 52 52 status = "okay"; 53 53 54 - phy-mode = "rgmii"; 54 + phy-mode = "rgmii-id"; 55 55 bus_id = <0x1>; 56 56 }; 57 57
+2 -2
arch/loongarch/boot/dts/loongson-2k1000-ref.dts
··· 43 43 &gmac0 { 44 44 status = "okay"; 45 45 46 - phy-mode = "rgmii"; 46 + phy-mode = "rgmii-id"; 47 47 phy-handle = <&phy0>; 48 48 mdio { 49 49 compatible = "snps,dwmac-mdio"; ··· 58 58 &gmac1 { 59 59 status = "okay"; 60 60 61 - phy-mode = "rgmii"; 61 + phy-mode = "rgmii-id"; 62 62 phy-handle = <&phy1>; 63 63 mdio { 64 64 compatible = "snps,dwmac-mdio";
+1 -1
arch/loongarch/boot/dts/loongson-2k2000-ref.dts
··· 92 92 &gmac2 { 93 93 status = "okay"; 94 94 95 - phy-mode = "rgmii"; 95 + phy-mode = "rgmii-id"; 96 96 phy-handle = <&phy2>; 97 97 mdio { 98 98 compatible = "snps,dwmac-mdio";
+1
arch/loongarch/include/asm/numa.h
··· 56 56 static inline void early_numa_add_cpu(int cpuid, s16 node) { } 57 57 static inline void numa_add_cpu(unsigned int cpu) { } 58 58 static inline void numa_remove_cpu(unsigned int cpu) { } 59 + static inline void set_cpuid_to_node(int cpuid, s16 node) { } 59 60 60 61 static inline int early_cpu_to_node(int cpu) 61 62 {
+1 -1
arch/loongarch/include/asm/stackframe.h
··· 42 42 .macro JUMP_VIRT_ADDR temp1 temp2 43 43 li.d \temp1, CACHE_BASE 44 44 pcaddi \temp2, 0 45 - or \temp1, \temp1, \temp2 45 + bstrins.d \temp1, \temp2, (DMW_PABITS - 1), 0 46 46 jirl zero, \temp1, 0xc 47 47 .endm 48 48
+1 -1
arch/loongarch/kernel/head.S
··· 22 22 _head: 23 23 .word MZ_MAGIC /* "MZ", MS-DOS header */ 24 24 .org 0x8 25 - .dword kernel_entry /* Kernel entry point */ 25 + .dword _kernel_entry /* Kernel entry point (physical address) */ 26 26 .dword _kernel_asize /* Kernel image effective size */ 27 27 .quad PHYS_LINK_KADDR /* Kernel image load offset from start of RAM */ 28 28 .org 0x38 /* 0x20 ~ 0x37 reserved */
+2 -4
arch/loongarch/kernel/setup.c
··· 282 282 return; 283 283 284 284 /* Prefer to use built-in dtb, checking its legality first. */ 285 - if (!fdt_check_header(__dtb_start)) 285 + if (IS_ENABLED(CONFIG_BUILTIN_DTB) && !fdt_check_header(__dtb_start)) 286 286 fdt_pointer = __dtb_start; 287 287 else 288 288 fdt_pointer = efi_fdt_pointer(); /* Fallback to firmware dtb */ ··· 351 351 arch_reserve_vmcore(); 352 352 arch_reserve_crashkernel(); 353 353 354 - #ifdef CONFIG_ACPI_TABLE_UPGRADE 355 - acpi_table_upgrade(); 356 - #endif 357 354 #ifdef CONFIG_ACPI 355 + acpi_table_upgrade(); 358 356 acpi_gbl_use_default_register_widths = false; 359 357 acpi_boot_table_init(); 360 358 #endif
+4 -1
arch/loongarch/kernel/smp.c
··· 273 273 274 274 if (cpuid == loongson_sysconf.boot_cpu_id) { 275 275 cpu = 0; 276 - numa_add_cpu(cpu); 277 276 } else { 278 277 cpu = cpumask_next_zero(-1, cpu_present_mask); 279 278 } ··· 282 283 set_cpu_present(cpu, true); 283 284 __cpu_number_map[cpuid] = cpu; 284 285 __cpu_logical_map[cpu] = cpuid; 286 + 287 + early_numa_add_cpu(cpu, 0); 288 + set_cpuid_to_node(cpuid, 0); 285 289 } 286 290 287 291 loongson_sysconf.nr_cpus = num_processors; ··· 470 468 set_cpu_possible(0, true); 471 469 set_cpu_online(0, true); 472 470 set_my_cpu_offset(per_cpu_offset(0)); 471 + numa_add_cpu(0); 473 472 474 473 rr_node = first_node(node_online_map); 475 474 for_each_possible_cpu(cpu) {
+6 -4
arch/loongarch/kernel/vmlinux.lds.S
··· 6 6 7 7 #define PAGE_SIZE _PAGE_SIZE 8 8 #define RO_EXCEPTION_TABLE_ALIGN 4 9 + #define PHYSADDR_MASK 0xffffffffffff /* 48-bit */ 9 10 10 11 /* 11 12 * Put .bss..swapper_pg_dir as the first thing in .bss. This will ··· 143 142 144 143 #ifdef CONFIG_EFI_STUB 145 144 /* header symbols */ 146 - _kernel_asize = _end - _text; 147 - _kernel_fsize = _edata - _text; 148 - _kernel_vsize = _end - __initdata_begin; 149 - _kernel_rsize = _edata - __initdata_begin; 145 + _kernel_entry = ABSOLUTE(kernel_entry & PHYSADDR_MASK); 146 + _kernel_asize = ABSOLUTE(_end - _text); 147 + _kernel_fsize = ABSOLUTE(_edata - _text); 148 + _kernel_vsize = ABSOLUTE(_end - __initdata_begin); 149 + _kernel_rsize = ABSOLUTE(_edata - __initdata_begin); 150 150 #endif 151 151 152 152 .gptab.sdata : {
+1 -1
arch/powerpc/Kconfig
··· 137 137 select ARCH_HAS_GCOV_PROFILE_ALL 138 138 select ARCH_HAS_HUGEPD if HUGETLB_PAGE 139 139 select ARCH_HAS_KCOV 140 - select ARCH_HAS_KERNEL_FPU_SUPPORT if PPC_FPU 140 + select ARCH_HAS_KERNEL_FPU_SUPPORT if PPC64 && PPC_FPU 141 141 select ARCH_HAS_MEMBARRIER_CALLBACKS 142 142 select ARCH_HAS_MEMBARRIER_SYNC_CORE 143 143 select ARCH_HAS_MEMREMAP_COMPAT_ALIGN if PPC_64S_HASH_MMU
+27
arch/powerpc/include/asm/uaccess.h
··· 92 92 : label) 93 93 #endif 94 94 95 + #ifdef CONFIG_CC_IS_CLANG 96 + #define DS_FORM_CONSTRAINT "Z<>" 97 + #else 98 + #define DS_FORM_CONSTRAINT "YZ<>" 99 + #endif 100 + 95 101 #ifdef __powerpc64__ 102 + #ifdef CONFIG_PPC_KERNEL_PREFIXED 96 103 #define __put_user_asm2_goto(x, ptr, label) \ 97 104 __put_user_asm_goto(x, ptr, label, "std") 105 + #else 106 + #define __put_user_asm2_goto(x, addr, label) \ 107 + asm goto ("1: std%U1%X1 %0,%1 # put_user\n" \ 108 + EX_TABLE(1b, %l2) \ 109 + : \ 110 + : "r" (x), DS_FORM_CONSTRAINT (*addr) \ 111 + : \ 112 + : label) 113 + #endif // CONFIG_PPC_KERNEL_PREFIXED 98 114 #else /* __powerpc64__ */ 99 115 #define __put_user_asm2_goto(x, addr, label) \ 100 116 asm goto( \ ··· 181 165 #endif 182 166 183 167 #ifdef __powerpc64__ 168 + #ifdef CONFIG_PPC_KERNEL_PREFIXED 184 169 #define __get_user_asm2_goto(x, addr, label) \ 185 170 __get_user_asm_goto(x, addr, label, "ld") 171 + #else 172 + #define __get_user_asm2_goto(x, addr, label) \ 173 + asm_goto_output( \ 174 + "1: ld%U1%X1 %0, %1 # get_user\n" \ 175 + EX_TABLE(1b, %l2) \ 176 + : "=r" (x) \ 177 + : DS_FORM_CONSTRAINT (*addr) \ 178 + : \ 179 + : label) 180 + #endif // CONFIG_PPC_KERNEL_PREFIXED 186 181 #else /* __powerpc64__ */ 187 182 #define __get_user_asm2_goto(x, addr, label) \ 188 183 asm_goto_output( \
+12
arch/powerpc/net/bpf_jit_comp32.c
··· 900 900 901 901 /* Get offset into TMP_REG */ 902 902 EMIT(PPC_RAW_LI(tmp_reg, off)); 903 + /* 904 + * Enforce full ordering for operations with BPF_FETCH by emitting a 'sync' 905 + * before and after the operation. 906 + * 907 + * This is a requirement in the Linux Kernel Memory Model. 908 + * See __cmpxchg_u32() in asm/cmpxchg.h as an example. 909 + */ 910 + if ((imm & BPF_FETCH) && IS_ENABLED(CONFIG_SMP)) 911 + EMIT(PPC_RAW_SYNC()); 903 912 tmp_idx = ctx->idx * 4; 904 913 /* load value from memory into r0 */ 905 914 EMIT(PPC_RAW_LWARX(_R0, tmp_reg, dst_reg, 0)); ··· 962 953 963 954 /* For the BPF_FETCH variant, get old data into src_reg */ 964 955 if (imm & BPF_FETCH) { 956 + /* Emit 'sync' to enforce full ordering */ 957 + if (IS_ENABLED(CONFIG_SMP)) 958 + EMIT(PPC_RAW_SYNC()); 965 959 EMIT(PPC_RAW_MR(ret_reg, ax_reg)); 966 960 if (!fp->aux->verifier_zext) 967 961 EMIT(PPC_RAW_LI(ret_reg - 1, 0)); /* higher 32-bit */
+12
arch/powerpc/net/bpf_jit_comp64.c
··· 846 846 847 847 /* Get offset into TMP_REG_1 */ 848 848 EMIT(PPC_RAW_LI(tmp1_reg, off)); 849 + /* 850 + * Enforce full ordering for operations with BPF_FETCH by emitting a 'sync' 851 + * before and after the operation. 852 + * 853 + * This is a requirement in the Linux Kernel Memory Model. 854 + * See __cmpxchg_u64() in asm/cmpxchg.h as an example. 855 + */ 856 + if ((imm & BPF_FETCH) && IS_ENABLED(CONFIG_SMP)) 857 + EMIT(PPC_RAW_SYNC()); 849 858 tmp_idx = ctx->idx * 4; 850 859 /* load value from memory into TMP_REG_2 */ 851 860 if (size == BPF_DW) ··· 917 908 PPC_BCC_SHORT(COND_NE, tmp_idx); 918 909 919 910 if (imm & BPF_FETCH) { 911 + /* Emit 'sync' to enforce full ordering */ 912 + if (IS_ENABLED(CONFIG_SMP)) 913 + EMIT(PPC_RAW_SYNC()); 920 914 EMIT(PPC_RAW_MR(ret_reg, _R0)); 921 915 /* 922 916 * Skip unnecessary zero-extension for 32-bit cmpxchg.
+2 -2
arch/powerpc/platforms/pseries/lparcfg.c
··· 371 371 372 372 static void read_lpar_name(struct seq_file *m) 373 373 { 374 - if (read_rtas_lpar_name(m) && read_dt_lpar_name(m)) 375 - pr_err_once("Error can't get the LPAR name"); 374 + if (read_rtas_lpar_name(m)) 375 + read_dt_lpar_name(m); 376 376 } 377 377 378 378 #define SPLPAR_MAXLENGTH 1026*(sizeof(char))
+1 -1
arch/riscv/Kconfig
··· 106 106 select HAS_IOPORT if MMU 107 107 select HAVE_ARCH_AUDITSYSCALL 108 108 select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP 109 - select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT && !XIP_KERNEL 109 + select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT 110 110 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL 111 111 select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL 112 112 select HAVE_ARCH_KASAN if MMU && 64BIT
+12 -10
arch/riscv/include/asm/cmpxchg.h
··· 10 10 11 11 #include <asm/fence.h> 12 12 13 - #define __arch_xchg_masked(prepend, append, r, p, n) \ 13 + #define __arch_xchg_masked(sc_sfx, prepend, append, r, p, n) \ 14 14 ({ \ 15 15 u32 *__ptr32b = (u32 *)((ulong)(p) & ~0x3); \ 16 16 ulong __s = ((ulong)(p) & (0x4 - sizeof(*p))) * BITS_PER_BYTE; \ ··· 25 25 "0: lr.w %0, %2\n" \ 26 26 " and %1, %0, %z4\n" \ 27 27 " or %1, %1, %z3\n" \ 28 - " sc.w %1, %1, %2\n" \ 28 + " sc.w" sc_sfx " %1, %1, %2\n" \ 29 29 " bnez %1, 0b\n" \ 30 30 append \ 31 31 : "=&r" (__retx), "=&r" (__rc), "+A" (*(__ptr32b)) \ ··· 46 46 : "memory"); \ 47 47 }) 48 48 49 - #define _arch_xchg(ptr, new, sfx, prepend, append) \ 49 + #define _arch_xchg(ptr, new, sc_sfx, swap_sfx, prepend, \ 50 + sc_append, swap_append) \ 50 51 ({ \ 51 52 __typeof__(ptr) __ptr = (ptr); \ 52 53 __typeof__(*(__ptr)) __new = (new); \ ··· 56 55 switch (sizeof(*__ptr)) { \ 57 56 case 1: \ 58 57 case 2: \ 59 - __arch_xchg_masked(prepend, append, \ 58 + __arch_xchg_masked(sc_sfx, prepend, sc_append, \ 60 59 __ret, __ptr, __new); \ 61 60 break; \ 62 61 case 4: \ 63 - __arch_xchg(".w" sfx, prepend, append, \ 62 + __arch_xchg(".w" swap_sfx, prepend, swap_append, \ 64 63 __ret, __ptr, __new); \ 65 64 break; \ 66 65 case 8: \ 67 - __arch_xchg(".d" sfx, prepend, append, \ 66 + __arch_xchg(".d" swap_sfx, prepend, swap_append, \ 68 67 __ret, __ptr, __new); \ 69 68 break; \ 70 69 default: \ ··· 74 73 }) 75 74 76 75 #define arch_xchg_relaxed(ptr, x) \ 77 - _arch_xchg(ptr, x, "", "", "") 76 + _arch_xchg(ptr, x, "", "", "", "", "") 78 77 79 78 #define arch_xchg_acquire(ptr, x) \ 80 - _arch_xchg(ptr, x, "", "", RISCV_ACQUIRE_BARRIER) 79 + _arch_xchg(ptr, x, "", "", "", \ 80 + RISCV_ACQUIRE_BARRIER, RISCV_ACQUIRE_BARRIER) 81 81 82 82 #define arch_xchg_release(ptr, x) \ 83 - _arch_xchg(ptr, x, "", RISCV_RELEASE_BARRIER, "") 83 + _arch_xchg(ptr, x, "", "", RISCV_RELEASE_BARRIER, "", "") 84 84 85 85 #define arch_xchg(ptr, x) \ 86 - _arch_xchg(ptr, x, ".aqrl", "", "") 86 + _arch_xchg(ptr, x, ".rl", ".aqrl", "", RISCV_FULL_BARRIER, "") 87 87 88 88 #define xchg32(ptr, x) \ 89 89 ({ \
+1 -1
arch/riscv/kernel/cpu_ops_sbi.c
··· 72 72 /* Make sure tidle is updated */ 73 73 smp_mb(); 74 74 bdata->task_ptr = tidle; 75 - bdata->stack_ptr = task_stack_page(tidle) + THREAD_SIZE; 75 + bdata->stack_ptr = task_pt_regs(tidle); 76 76 /* Make sure boot data is updated */ 77 77 smp_mb(); 78 78 hsm_data = __pa(bdata);
+1 -2
arch/riscv/kernel/cpu_ops_spinwait.c
··· 34 34 35 35 /* Make sure tidle is updated */ 36 36 smp_mb(); 37 - WRITE_ONCE(__cpu_spinwait_stack_pointer[hartid], 38 - task_stack_page(tidle) + THREAD_SIZE); 37 + WRITE_ONCE(__cpu_spinwait_stack_pointer[hartid], task_pt_regs(tidle)); 39 38 WRITE_ONCE(__cpu_spinwait_task_pointer[hartid], tidle); 40 39 } 41 40
+4 -3
arch/riscv/kvm/aia_device.c
··· 237 237 238 238 static u32 aia_imsic_hart_index(struct kvm_aia *aia, gpa_t addr) 239 239 { 240 - u32 hart, group = 0; 240 + u32 hart = 0, group = 0; 241 241 242 - hart = (addr >> (aia->nr_guest_bits + IMSIC_MMIO_PAGE_SHIFT)) & 243 - GENMASK_ULL(aia->nr_hart_bits - 1, 0); 242 + if (aia->nr_hart_bits) 243 + hart = (addr >> (aia->nr_guest_bits + IMSIC_MMIO_PAGE_SHIFT)) & 244 + GENMASK_ULL(aia->nr_hart_bits - 1, 0); 244 245 if (aia->nr_group_bits) 245 246 group = (addr >> aia->nr_group_shift) & 246 247 GENMASK_ULL(aia->nr_group_bits - 1, 0);
+2 -2
arch/riscv/kvm/vcpu_onereg.c
··· 724 724 switch (reg_subtype) { 725 725 case KVM_REG_RISCV_ISA_SINGLE: 726 726 return riscv_vcpu_set_isa_ext_single(vcpu, reg_num, reg_val); 727 - case KVM_REG_RISCV_SBI_MULTI_EN: 727 + case KVM_REG_RISCV_ISA_MULTI_EN: 728 728 return riscv_vcpu_set_isa_ext_multi(vcpu, reg_num, reg_val, true); 729 - case KVM_REG_RISCV_SBI_MULTI_DIS: 729 + case KVM_REG_RISCV_ISA_MULTI_DIS: 730 730 return riscv_vcpu_set_isa_ext_multi(vcpu, reg_num, reg_val, false); 731 731 default: 732 732 return -ENOENT;
+1
arch/x86/events/intel/cstate.c
··· 114 114 #include "../perf_event.h" 115 115 #include "../probe.h" 116 116 117 + MODULE_DESCRIPTION("Support for Intel cstate performance events"); 117 118 MODULE_LICENSE("GPL"); 118 119 119 120 #define DEFINE_CSTATE_FORMAT_ATTR(_var, _name, _format) \
+1
arch/x86/events/intel/uncore.c
··· 34 34 struct event_constraint uncore_constraint_empty = 35 35 EVENT_CONSTRAINT(0, 0, 0); 36 36 37 + MODULE_DESCRIPTION("Support for Intel uncore performance events"); 37 38 MODULE_LICENSE("GPL"); 38 39 39 40 int uncore_pcibus_to_dieid(struct pci_bus *bus)
+1
arch/x86/events/rapl.c
··· 64 64 #include "perf_event.h" 65 65 #include "probe.h" 66 66 67 + MODULE_DESCRIPTION("Support Intel/AMD RAPL energy consumption counters"); 67 68 MODULE_LICENSE("GPL"); 68 69 69 70 /*
+1
arch/x86/include/asm/kvm_host.h
··· 2154 2154 2155 2155 int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, u64 error_code, 2156 2156 void *insn, int insn_len); 2157 + void kvm_mmu_print_sptes(struct kvm_vcpu *vcpu, gpa_t gpa, const char *msg); 2157 2158 void kvm_mmu_invlpg(struct kvm_vcpu *vcpu, gva_t gva); 2158 2159 void kvm_mmu_invalidate_addr(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, 2159 2160 u64 addr, unsigned long roots);
+1 -1
arch/x86/include/asm/vmxfeatures.h
··· 77 77 #define VMX_FEATURE_ENCLS_EXITING ( 2*32+ 15) /* "" VM-Exit on ENCLS (leaf dependent) */ 78 78 #define VMX_FEATURE_RDSEED_EXITING ( 2*32+ 16) /* "" VM-Exit on RDSEED */ 79 79 #define VMX_FEATURE_PAGE_MOD_LOGGING ( 2*32+ 17) /* "pml" Log dirty pages into buffer */ 80 - #define VMX_FEATURE_EPT_VIOLATION_VE ( 2*32+ 18) /* "" Conditionally reflect EPT violations as #VE exceptions */ 80 + #define VMX_FEATURE_EPT_VIOLATION_VE ( 2*32+ 18) /* Conditionally reflect EPT violations as #VE exceptions */ 81 81 #define VMX_FEATURE_PT_CONCEAL_VMX ( 2*32+ 19) /* "" Suppress VMX indicators in Processor Trace */ 82 82 #define VMX_FEATURE_XSAVES ( 2*32+ 20) /* "" Enable XSAVES and XRSTORS in guest */ 83 83 #define VMX_FEATURE_MODE_BASED_EPT_EXEC ( 2*32+ 22) /* "ept_mode_based_exec" Enable separate EPT EXEC bits for supervisor vs. user */
+1
arch/x86/kernel/cpu/aperfmperf.c
··· 345 345 disable_freq_invariance_workfn); 346 346 347 347 DEFINE_PER_CPU(unsigned long, arch_freq_scale) = SCHED_CAPACITY_SCALE; 348 + EXPORT_PER_CPU_SYMBOL_GPL(arch_freq_scale); 348 349 349 350 static void scale_freq_tick(u64 acnt, u64 mcnt) 350 351 {
+6 -1
arch/x86/kernel/cpu/common.c
··· 1075 1075 1076 1076 c->x86_virt_bits = (eax >> 8) & 0xff; 1077 1077 c->x86_phys_bits = eax & 0xff; 1078 + 1079 + /* Provide a sane default if not enumerated: */ 1080 + if (!c->x86_clflush_size) 1081 + c->x86_clflush_size = 32; 1078 1082 } 1079 1083 1080 1084 c->x86_cache_bits = c->x86_phys_bits; ··· 1589 1585 if (have_cpuid_p()) { 1590 1586 cpu_detect(c); 1591 1587 get_cpu_vendor(c); 1588 + intel_unlock_cpuid_leafs(c); 1592 1589 get_cpu_cap(c); 1593 1590 setup_force_cpu_cap(X86_FEATURE_CPUID); 1594 1591 get_cpu_address_sizes(c); ··· 1749 1744 cpu_detect(c); 1750 1745 1751 1746 get_cpu_vendor(c); 1752 - 1747 + intel_unlock_cpuid_leafs(c); 1753 1748 get_cpu_cap(c); 1754 1749 1755 1750 get_cpu_address_sizes(c);
+2
arch/x86/kernel/cpu/cpu.h
··· 61 61 62 62 extern void __init tsx_init(void); 63 63 void tsx_ap_init(void); 64 + void intel_unlock_cpuid_leafs(struct cpuinfo_x86 *c); 64 65 #else 65 66 static inline void tsx_init(void) { } 66 67 static inline void tsx_ap_init(void) { } 68 + static inline void intel_unlock_cpuid_leafs(struct cpuinfo_x86 *c) { } 67 69 #endif /* CONFIG_CPU_SUP_INTEL */ 68 70 69 71 extern void init_spectral_chicken(struct cpuinfo_x86 *c);
+16 -9
arch/x86/kernel/cpu/intel.c
··· 269 269 c->x86_phys_bits -= keyid_bits; 270 270 } 271 271 272 + void intel_unlock_cpuid_leafs(struct cpuinfo_x86 *c) 273 + { 274 + if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) 275 + return; 276 + 277 + if (c->x86 < 6 || (c->x86 == 6 && c->x86_model < 0xd)) 278 + return; 279 + 280 + /* 281 + * The BIOS can have limited CPUID to leaf 2, which breaks feature 282 + * enumeration. Unlock it and update the maximum leaf info. 283 + */ 284 + if (msr_clear_bit(MSR_IA32_MISC_ENABLE, MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT) > 0) 285 + c->cpuid_level = cpuid_eax(0); 286 + } 287 + 272 288 static void early_init_intel(struct cpuinfo_x86 *c) 273 289 { 274 290 u64 misc_enable; 275 - 276 - /* Unmask CPUID levels if masked: */ 277 - if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) { 278 - if (msr_clear_bit(MSR_IA32_MISC_ENABLE, 279 - MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT) > 0) { 280 - c->cpuid_level = cpuid_eax(0); 281 - get_cpu_cap(c); 282 - } 283 - } 284 291 285 292 if ((c->x86 == 0xf && c->x86_model >= 0x03) || 286 293 (c->x86 == 0x6 && c->x86_model >= 0x0e))
+2 -2
arch/x86/kernel/cpu/topology_amd.c
··· 84 84 85 85 /* 86 86 * If leaf 0xb is available, then the domain shifts are set 87 - * already and nothing to do here. 87 + * already and nothing to do here. Only valid for family >= 0x17. 88 88 */ 89 - if (!has_topoext) { 89 + if (!has_topoext && tscan->c->x86 >= 0x17) { 90 90 /* 91 91 * Leaf 0x80000008 set the CORE domain shift already. 92 92 * Update the SMT domain, but do not propagate it.
+7 -4
arch/x86/kvm/Kconfig
··· 44 44 select KVM_VFIO 45 45 select HAVE_KVM_PM_NOTIFIER if PM 46 46 select KVM_GENERIC_HARDWARE_ENABLING 47 + select KVM_WERROR if WERROR 47 48 help 48 49 Support hosting fully virtualized guest machines using hardware 49 50 virtualization extensions. You will need a fairly recent ··· 67 66 # FRAME_WARN, i.e. KVM_WERROR=y with KASAN=y requires special tuning. 68 67 # Building KVM with -Werror and KASAN is still doable via enabling 69 68 # the kernel-wide WERROR=y. 70 - depends on KVM && EXPERT && !KASAN 69 + depends on KVM && ((EXPERT && !KASAN) || WERROR) 71 70 help 72 71 Add -Werror to the build flags for KVM. 73 72 ··· 98 97 99 98 config KVM_INTEL_PROVE_VE 100 99 bool "Check that guests do not receive #VE exceptions" 101 - default KVM_PROVE_MMU || DEBUG_KERNEL 102 - depends on KVM_INTEL 100 + depends on KVM_INTEL && EXPERT 103 101 help 104 - 105 102 Checks that KVM's page table management code will not incorrectly 106 103 let guests receive a virtualization exception. Virtualization 107 104 exceptions will be trapped by the hypervisor rather than injected 108 105 in the guest. 106 + 107 + Note: some CPUs appear to generate spurious EPT Violations #VEs 108 + that trigger KVM's WARN, in particular with eptad=0 and/or nested 109 + virtualization. 109 110 110 111 If unsure, say N. 111 112
+21 -18
arch/x86/kvm/lapic.c
··· 59 59 #define MAX_APIC_VECTOR 256 60 60 #define APIC_VECTORS_PER_REG 32 61 61 62 - static bool lapic_timer_advance_dynamic __read_mostly; 62 + /* 63 + * Enable local APIC timer advancement (tscdeadline mode only) with adaptive 64 + * tuning. When enabled, KVM programs the host timer event to fire early, i.e. 65 + * before the deadline expires, to account for the delay between taking the 66 + * VM-Exit (to inject the guest event) and the subsequent VM-Enter to resume 67 + * the guest, i.e. so that the interrupt arrives in the guest with minimal 68 + * latency relative to the deadline programmed by the guest. 69 + */ 70 + static bool lapic_timer_advance __read_mostly = true; 71 + module_param(lapic_timer_advance, bool, 0444); 72 + 63 73 #define LAPIC_TIMER_ADVANCE_ADJUST_MIN 100 /* clock cycles */ 64 74 #define LAPIC_TIMER_ADVANCE_ADJUST_MAX 10000 /* clock cycles */ 65 75 #define LAPIC_TIMER_ADVANCE_NS_INIT 1000 ··· 1864 1854 guest_tsc = kvm_read_l1_tsc(vcpu, rdtsc()); 1865 1855 trace_kvm_wait_lapic_expire(vcpu->vcpu_id, guest_tsc - tsc_deadline); 1866 1856 1867 - if (lapic_timer_advance_dynamic) { 1868 - adjust_lapic_timer_advance(vcpu, guest_tsc - tsc_deadline); 1869 - /* 1870 - * If the timer fired early, reread the TSC to account for the 1871 - * overhead of the above adjustment to avoid waiting longer 1872 - * than is necessary. 1873 - */ 1874 - if (guest_tsc < tsc_deadline) 1875 - guest_tsc = kvm_read_l1_tsc(vcpu, rdtsc()); 1876 - } 1857 + adjust_lapic_timer_advance(vcpu, guest_tsc - tsc_deadline); 1858 + 1859 + /* 1860 + * If the timer fired early, reread the TSC to account for the overhead 1861 + * of the above adjustment to avoid waiting longer than is necessary. 1862 + */ 1863 + if (guest_tsc < tsc_deadline) 1864 + guest_tsc = kvm_read_l1_tsc(vcpu, rdtsc()); 1877 1865 1878 1866 if (guest_tsc < tsc_deadline) 1879 1867 __wait_lapic_expire(vcpu, tsc_deadline - guest_tsc); ··· 2820 2812 return HRTIMER_NORESTART; 2821 2813 } 2822 2814 2823 - int kvm_create_lapic(struct kvm_vcpu *vcpu, int timer_advance_ns) 2815 + int kvm_create_lapic(struct kvm_vcpu *vcpu) 2824 2816 { 2825 2817 struct kvm_lapic *apic; 2826 2818 ··· 2853 2845 hrtimer_init(&apic->lapic_timer.timer, CLOCK_MONOTONIC, 2854 2846 HRTIMER_MODE_ABS_HARD); 2855 2847 apic->lapic_timer.timer.function = apic_timer_fn; 2856 - if (timer_advance_ns == -1) { 2848 + if (lapic_timer_advance) 2857 2849 apic->lapic_timer.timer_advance_ns = LAPIC_TIMER_ADVANCE_NS_INIT; 2858 - lapic_timer_advance_dynamic = true; 2859 - } else { 2860 - apic->lapic_timer.timer_advance_ns = timer_advance_ns; 2861 - lapic_timer_advance_dynamic = false; 2862 - } 2863 2850 2864 2851 /* 2865 2852 * Stuff the APIC ENABLE bit in lieu of temporarily incrementing
+1 -1
arch/x86/kvm/lapic.h
··· 85 85 86 86 struct dest_map; 87 87 88 - int kvm_create_lapic(struct kvm_vcpu *vcpu, int timer_advance_ns); 88 + int kvm_create_lapic(struct kvm_vcpu *vcpu); 89 89 void kvm_free_lapic(struct kvm_vcpu *vcpu); 90 90 91 91 int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu);
+36 -12
arch/x86/kvm/mmu/mmu.c
··· 336 336 #ifdef CONFIG_X86_64 337 337 static void __set_spte(u64 *sptep, u64 spte) 338 338 { 339 + KVM_MMU_WARN_ON(is_ept_ve_possible(spte)); 339 340 WRITE_ONCE(*sptep, spte); 340 341 } 341 342 342 343 static void __update_clear_spte_fast(u64 *sptep, u64 spte) 343 344 { 345 + KVM_MMU_WARN_ON(is_ept_ve_possible(spte)); 344 346 WRITE_ONCE(*sptep, spte); 345 347 } 346 348 347 349 static u64 __update_clear_spte_slow(u64 *sptep, u64 spte) 348 350 { 351 + KVM_MMU_WARN_ON(is_ept_ve_possible(spte)); 349 352 return xchg(sptep, spte); 350 353 } 351 354 ··· 4104 4101 return leaf; 4105 4102 } 4106 4103 4104 + static int get_sptes_lockless(struct kvm_vcpu *vcpu, u64 addr, u64 *sptes, 4105 + int *root_level) 4106 + { 4107 + int leaf; 4108 + 4109 + walk_shadow_page_lockless_begin(vcpu); 4110 + 4111 + if (is_tdp_mmu_active(vcpu)) 4112 + leaf = kvm_tdp_mmu_get_walk(vcpu, addr, sptes, root_level); 4113 + else 4114 + leaf = get_walk(vcpu, addr, sptes, root_level); 4115 + 4116 + walk_shadow_page_lockless_end(vcpu); 4117 + return leaf; 4118 + } 4119 + 4107 4120 /* return true if reserved bit(s) are detected on a valid, non-MMIO SPTE. */ 4108 4121 static bool get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr, u64 *sptep) 4109 4122 { ··· 4128 4109 int root, leaf, level; 4129 4110 bool reserved = false; 4130 4111 4131 - walk_shadow_page_lockless_begin(vcpu); 4132 - 4133 - if (is_tdp_mmu_active(vcpu)) 4134 - leaf = kvm_tdp_mmu_get_walk(vcpu, addr, sptes, &root); 4135 - else 4136 - leaf = get_walk(vcpu, addr, sptes, &root); 4137 - 4138 - walk_shadow_page_lockless_end(vcpu); 4139 - 4112 + leaf = get_sptes_lockless(vcpu, addr, sptes, &root); 4140 4113 if (unlikely(leaf < 0)) { 4141 4114 *sptep = 0ull; 4142 4115 return reserved; ··· 4410 4399 if (!kvm_apicv_activated(vcpu->kvm)) 4411 4400 return RET_PF_EMULATE; 4412 4401 } 4413 - 4414 - fault->mmu_seq = vcpu->kvm->mmu_invalidate_seq; 4415 - smp_rmb(); 4416 4402 4417 4403 /* 4418 4404 * Check for a relevant mmu_notifier invalidation event before getting ··· 5928 5920 insn_len); 5929 5921 } 5930 5922 EXPORT_SYMBOL_GPL(kvm_mmu_page_fault); 5923 + 5924 + void kvm_mmu_print_sptes(struct kvm_vcpu *vcpu, gpa_t gpa, const char *msg) 5925 + { 5926 + u64 sptes[PT64_ROOT_MAX_LEVEL + 1]; 5927 + int root_level, leaf, level; 5928 + 5929 + leaf = get_sptes_lockless(vcpu, gpa, sptes, &root_level); 5930 + if (unlikely(leaf < 0)) 5931 + return; 5932 + 5933 + pr_err("%s %llx", msg, gpa); 5934 + for (level = root_level; level >= leaf; level--) 5935 + pr_cont(", spte[%d] = 0x%llx", level, sptes[level]); 5936 + pr_cont("\n"); 5937 + } 5938 + EXPORT_SYMBOL_GPL(kvm_mmu_print_sptes); 5931 5939 5932 5940 static void __kvm_mmu_invalidate_addr(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, 5933 5941 u64 addr, hpa_t root_hpa)
+9
arch/x86/kvm/mmu/spte.h
··· 3 3 #ifndef KVM_X86_MMU_SPTE_H 4 4 #define KVM_X86_MMU_SPTE_H 5 5 6 + #include <asm/vmx.h> 7 + 6 8 #include "mmu.h" 7 9 #include "mmu_internal.h" 8 10 ··· 276 274 static inline bool is_shadow_present_pte(u64 pte) 277 275 { 278 276 return !!(pte & SPTE_MMU_PRESENT_MASK); 277 + } 278 + 279 + static inline bool is_ept_ve_possible(u64 spte) 280 + { 281 + return (shadow_present_mask & VMX_EPT_SUPPRESS_VE_BIT) && 282 + !(spte & VMX_EPT_SUPPRESS_VE_BIT) && 283 + (spte & VMX_EPT_RWX_MASK) != VMX_EPT_MISCONFIG_WX_VALUE; 279 284 } 280 285 281 286 /*
+2
arch/x86/kvm/mmu/tdp_iter.h
··· 21 21 22 22 static inline u64 kvm_tdp_mmu_write_spte_atomic(tdp_ptep_t sptep, u64 new_spte) 23 23 { 24 + KVM_MMU_WARN_ON(is_ept_ve_possible(new_spte)); 24 25 return xchg(rcu_dereference(sptep), new_spte); 25 26 } 26 27 27 28 static inline void __kvm_tdp_mmu_write_spte(tdp_ptep_t sptep, u64 new_spte) 28 29 { 30 + KVM_MMU_WARN_ON(is_ept_ve_possible(new_spte)); 29 31 WRITE_ONCE(*rcu_dereference(sptep), new_spte); 30 32 } 31 33
+1 -1
arch/x86/kvm/mmu/tdp_mmu.c
··· 626 626 * SPTEs. 627 627 */ 628 628 handle_changed_spte(kvm, iter->as_id, iter->gfn, iter->old_spte, 629 - 0, iter->level, true); 629 + SHADOW_NONPRESENT_VALUE, iter->level, true); 630 630 631 631 return 0; 632 632 }
+14 -5
arch/x86/kvm/svm/sev.c
··· 779 779 */ 780 780 fpstate_set_confidential(&vcpu->arch.guest_fpu); 781 781 vcpu->arch.guest_state_protected = true; 782 + 783 + /* 784 + * SEV-ES guest mandates LBR Virtualization to be _always_ ON. Enable it 785 + * only after setting guest_state_protected because KVM_SET_MSRS allows 786 + * dynamic toggling of LBRV (for performance reason) on write access to 787 + * MSR_IA32_DEBUGCTLMSR when guest_state_protected is not set. 788 + */ 789 + svm_enable_lbrv(vcpu); 782 790 return 0; 783 791 } 784 792 ··· 2414 2406 if (!boot_cpu_has(X86_FEATURE_SEV_ES)) 2415 2407 goto out; 2416 2408 2409 + if (!lbrv) { 2410 + WARN_ONCE(!boot_cpu_has(X86_FEATURE_LBRV), 2411 + "LBRV must be present for SEV-ES support"); 2412 + goto out; 2413 + } 2414 + 2417 2415 /* Has the system been allocated ASIDs for SEV-ES? */ 2418 2416 if (min_sev_asid == 1) 2419 2417 goto out; ··· 3230 3216 struct kvm_vcpu *vcpu = &svm->vcpu; 3231 3217 3232 3218 svm->vmcb->control.nested_ctl |= SVM_NESTED_CTL_SEV_ES_ENABLE; 3233 - svm->vmcb->control.virt_ext |= LBR_CTL_ENABLE_MASK; 3234 3219 3235 3220 /* 3236 3221 * An SEV-ES guest requires a VMSA area that is a separate from the ··· 3281 3268 /* Clear intercepts on selected MSRs */ 3282 3269 set_msr_interception(vcpu, svm->msrpm, MSR_EFER, 1, 1); 3283 3270 set_msr_interception(vcpu, svm->msrpm, MSR_IA32_CR_PAT, 1, 1); 3284 - set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTBRANCHFROMIP, 1, 1); 3285 - set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTBRANCHTOIP, 1, 1); 3286 - set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTINTFROMIP, 1, 1); 3287 - set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTINTTOIP, 1, 1); 3288 3271 } 3289 3272 3290 3273 void sev_init_vmcb(struct vcpu_svm *svm)
+51 -18
arch/x86/kvm/svm/svm.c
··· 99 99 { .index = MSR_IA32_SPEC_CTRL, .always = false }, 100 100 { .index = MSR_IA32_PRED_CMD, .always = false }, 101 101 { .index = MSR_IA32_FLUSH_CMD, .always = false }, 102 + { .index = MSR_IA32_DEBUGCTLMSR, .always = false }, 102 103 { .index = MSR_IA32_LASTBRANCHFROMIP, .always = false }, 103 104 { .index = MSR_IA32_LASTBRANCHTOIP, .always = false }, 104 105 { .index = MSR_IA32_LASTINTFROMIP, .always = false }, ··· 216 215 module_param(vgif, int, 0444); 217 216 218 217 /* enable/disable LBR virtualization */ 219 - static int lbrv = true; 218 + int lbrv = true; 220 219 module_param(lbrv, int, 0444); 221 220 222 221 static int tsc_scaling = true; ··· 991 990 vmcb_mark_dirty(to_vmcb, VMCB_LBR); 992 991 } 993 992 994 - static void svm_enable_lbrv(struct kvm_vcpu *vcpu) 993 + void svm_enable_lbrv(struct kvm_vcpu *vcpu) 995 994 { 996 995 struct vcpu_svm *svm = to_svm(vcpu); 997 996 ··· 1001 1000 set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTINTFROMIP, 1, 1); 1002 1001 set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTINTTOIP, 1, 1); 1003 1002 1003 + if (sev_es_guest(vcpu->kvm)) 1004 + set_msr_interception(vcpu, svm->msrpm, MSR_IA32_DEBUGCTLMSR, 1, 1); 1005 + 1004 1006 /* Move the LBR msrs to the vmcb02 so that the guest can see them. */ 1005 1007 if (is_guest_mode(vcpu)) 1006 1008 svm_copy_lbrs(svm->vmcb, svm->vmcb01.ptr); ··· 1012 1008 static void svm_disable_lbrv(struct kvm_vcpu *vcpu) 1013 1009 { 1014 1010 struct vcpu_svm *svm = to_svm(vcpu); 1011 + 1012 + KVM_BUG_ON(sev_es_guest(vcpu->kvm), vcpu->kvm); 1015 1013 1016 1014 svm->vmcb->control.virt_ext &= ~LBR_CTL_ENABLE_MASK; 1017 1015 set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTBRANCHFROMIP, 0, 0); ··· 2828 2822 return 0; 2829 2823 } 2830 2824 2825 + static bool 2826 + sev_es_prevent_msr_access(struct kvm_vcpu *vcpu, struct msr_data *msr_info) 2827 + { 2828 + return sev_es_guest(vcpu->kvm) && 2829 + vcpu->arch.guest_state_protected && 2830 + svm_msrpm_offset(msr_info->index) != MSR_INVALID && 2831 + !msr_write_intercepted(vcpu, msr_info->index); 2832 + } 2833 + 2831 2834 static int svm_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) 2832 2835 { 2833 2836 struct vcpu_svm *svm = to_svm(vcpu); 2837 + 2838 + if (sev_es_prevent_msr_access(vcpu, msr_info)) { 2839 + msr_info->data = 0; 2840 + return -EINVAL; 2841 + } 2834 2842 2835 2843 switch (msr_info->index) { 2836 2844 case MSR_AMD64_TSC_RATIO: ··· 2996 2976 2997 2977 u32 ecx = msr->index; 2998 2978 u64 data = msr->data; 2979 + 2980 + if (sev_es_prevent_msr_access(vcpu, msr)) 2981 + return -EINVAL; 2982 + 2999 2983 switch (ecx) { 3000 2984 case MSR_AMD64_TSC_RATIO: 3001 2985 ··· 3870 3846 struct vcpu_svm *svm = to_svm(vcpu); 3871 3847 3872 3848 /* 3873 - * KVM should never request an NMI window when vNMI is enabled, as KVM 3874 - * allows at most one to-be-injected NMI and one pending NMI, i.e. if 3875 - * two NMIs arrive simultaneously, KVM will inject one and set 3876 - * V_NMI_PENDING for the other. WARN, but continue with the standard 3877 - * single-step approach to try and salvage the pending NMI. 3849 + * If NMIs are outright masked, i.e. the vCPU is already handling an 3850 + * NMI, and KVM has not yet intercepted an IRET, then there is nothing 3851 + * more to do at this time as KVM has already enabled IRET intercepts. 3852 + * If KVM has already intercepted IRET, then single-step over the IRET, 3853 + * as NMIs aren't architecturally unmasked until the IRET completes. 3854 + * 3855 + * If vNMI is enabled, KVM should never request an NMI window if NMIs 3856 + * are masked, as KVM allows at most one to-be-injected NMI and one 3857 + * pending NMI. If two NMIs arrive simultaneously, KVM will inject one 3858 + * NMI and set V_NMI_PENDING for the other, but if and only if NMIs are 3859 + * unmasked. KVM _will_ request an NMI window in some situations, e.g. 3860 + * if the vCPU is in an STI shadow or if GIF=0, KVM can't immediately 3861 + * inject the NMI. In those situations, KVM needs to single-step over 3862 + * the STI shadow or intercept STGI. 3878 3863 */ 3879 - WARN_ON_ONCE(is_vnmi_enabled(svm)); 3864 + if (svm_get_nmi_mask(vcpu)) { 3865 + WARN_ON_ONCE(is_vnmi_enabled(svm)); 3880 3866 3881 - if (svm_get_nmi_mask(vcpu) && !svm->awaiting_iret_completion) 3882 - return; /* IRET will cause a vm exit */ 3867 + if (!svm->awaiting_iret_completion) 3868 + return; /* IRET will cause a vm exit */ 3869 + } 3883 3870 3884 3871 /* 3885 3872 * SEV-ES guests are responsible for signaling when a vCPU is ready to ··· 5300 5265 5301 5266 nrips = nrips && boot_cpu_has(X86_FEATURE_NRIPS); 5302 5267 5268 + if (lbrv) { 5269 + if (!boot_cpu_has(X86_FEATURE_LBRV)) 5270 + lbrv = false; 5271 + else 5272 + pr_info("LBR virtualization supported\n"); 5273 + } 5303 5274 /* 5304 5275 * Note, SEV setup consumes npt_enabled and enable_mmio_caching (which 5305 5276 * may be modified by svm_adjust_mmio_mask()), as well as nrips. ··· 5357 5316 if (!vnmi) { 5358 5317 svm_x86_ops.is_vnmi_pending = NULL; 5359 5318 svm_x86_ops.set_vnmi_pending = NULL; 5360 - } 5361 - 5362 - 5363 - if (lbrv) { 5364 - if (!boot_cpu_has(X86_FEATURE_LBRV)) 5365 - lbrv = false; 5366 - else 5367 - pr_info("LBR virtualization supported\n"); 5368 5319 } 5369 5320 5370 5321 if (!enable_pmu)
+3 -1
arch/x86/kvm/svm/svm.h
··· 30 30 #define IOPM_SIZE PAGE_SIZE * 3 31 31 #define MSRPM_SIZE PAGE_SIZE * 2 32 32 33 - #define MAX_DIRECT_ACCESS_MSRS 47 33 + #define MAX_DIRECT_ACCESS_MSRS 48 34 34 #define MSRPM_OFFSETS 32 35 35 extern u32 msrpm_offsets[MSRPM_OFFSETS] __read_mostly; 36 36 extern bool npt_enabled; ··· 39 39 extern bool intercept_smi; 40 40 extern bool x2avic_enabled; 41 41 extern bool vnmi; 42 + extern int lbrv; 42 43 43 44 /* 44 45 * Clean bits in VMCB. ··· 553 552 void svm_vcpu_init_msrpm(struct kvm_vcpu *vcpu, u32 *msrpm); 554 553 void svm_vcpu_free_msrpm(u32 *msrpm); 555 554 void svm_copy_lbrs(struct vmcb *to_vmcb, struct vmcb *from_vmcb); 555 + void svm_enable_lbrv(struct kvm_vcpu *vcpu); 556 556 void svm_update_lbrv(struct kvm_vcpu *vcpu); 557 557 558 558 int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer);
+5
arch/x86/kvm/vmx/nested.c
··· 2242 2242 vmcs_write64(EPT_POINTER, 2243 2243 construct_eptp(&vmx->vcpu, 0, PT64_ROOT_4LEVEL)); 2244 2244 2245 + if (vmx->ve_info) 2246 + vmcs_write64(VE_INFORMATION_ADDRESS, __pa(vmx->ve_info)); 2247 + 2245 2248 /* All VMFUNCs are currently emulated through L0 vmexits. */ 2246 2249 if (cpu_has_vmx_vmfunc()) 2247 2250 vmcs_write64(VM_FUNCTION_CONTROL, 0); ··· 6232 6229 return true; 6233 6230 else if (is_alignment_check(intr_info) && 6234 6231 !vmx_guest_inject_ac(vcpu)) 6232 + return true; 6233 + else if (is_ve_fault(intr_info)) 6235 6234 return true; 6236 6235 return false; 6237 6236 case EXIT_REASON_EXTERNAL_INTERRUPT:
+9 -2
arch/x86/kvm/vmx/vmx.c
··· 5218 5218 if (is_invalid_opcode(intr_info)) 5219 5219 return handle_ud(vcpu); 5220 5220 5221 - if (KVM_BUG_ON(is_ve_fault(intr_info), vcpu->kvm)) 5222 - return -EIO; 5221 + if (WARN_ON_ONCE(is_ve_fault(intr_info))) { 5222 + struct vmx_ve_information *ve_info = vmx->ve_info; 5223 + 5224 + WARN_ONCE(ve_info->exit_reason != EXIT_REASON_EPT_VIOLATION, 5225 + "Unexpected #VE on VM-Exit reason 0x%x", ve_info->exit_reason); 5226 + dump_vmcs(vcpu); 5227 + kvm_mmu_print_sptes(vcpu, ve_info->guest_physical_address, "#VE"); 5228 + return 1; 5229 + } 5223 5230 5224 5231 error_code = 0; 5225 5232 if (intr_info & INTR_INFO_DELIVER_CODE_MASK)
+1 -10
arch/x86/kvm/x86.c
··· 164 164 static u32 __read_mostly tsc_tolerance_ppm = 250; 165 165 module_param(tsc_tolerance_ppm, uint, 0644); 166 166 167 - /* 168 - * lapic timer advance (tscdeadline mode only) in nanoseconds. '-1' enables 169 - * adaptive tuning starting from default advancement of 1000ns. '0' disables 170 - * advancement entirely. Any other value is used as-is and disables adaptive 171 - * tuning, i.e. allows privileged userspace to set an exact advancement time. 172 - */ 173 - static int __read_mostly lapic_timer_advance_ns = -1; 174 - module_param(lapic_timer_advance_ns, int, 0644); 175 - 176 167 static bool __read_mostly vector_hashing = true; 177 168 module_param(vector_hashing, bool, 0444); 178 169 ··· 12160 12169 if (r < 0) 12161 12170 return r; 12162 12171 12163 - r = kvm_create_lapic(vcpu, lapic_timer_advance_ns); 12172 + r = kvm_create_lapic(vcpu); 12164 12173 if (r < 0) 12165 12174 goto fail_mmu_destroy; 12166 12175
+8 -2
block/blk-settings.c
··· 104 104 static int blk_validate_limits(struct queue_limits *lim) 105 105 { 106 106 unsigned int max_hw_sectors; 107 + unsigned int logical_block_sectors; 107 108 108 109 /* 109 110 * Unless otherwise specified, default to 512 byte logical blocks and a ··· 135 134 lim->max_hw_sectors = BLK_SAFE_MAX_SECTORS; 136 135 if (WARN_ON_ONCE(lim->max_hw_sectors < PAGE_SECTORS)) 137 136 return -EINVAL; 137 + logical_block_sectors = lim->logical_block_size >> SECTOR_SHIFT; 138 + if (WARN_ON_ONCE(logical_block_sectors > lim->max_hw_sectors)) 139 + return -EINVAL; 138 140 lim->max_hw_sectors = round_down(lim->max_hw_sectors, 139 - lim->logical_block_size >> SECTOR_SHIFT); 141 + logical_block_sectors); 140 142 141 143 /* 142 144 * The actual max_sectors value is a complex beast and also takes the ··· 157 153 lim->max_sectors = min(max_hw_sectors, BLK_DEF_MAX_SECTORS_CAP); 158 154 } 159 155 lim->max_sectors = round_down(lim->max_sectors, 160 - lim->logical_block_size >> SECTOR_SHIFT); 156 + logical_block_sectors); 161 157 162 158 /* 163 159 * Random default for the maximum number of segments. Driver should not ··· 615 611 unsigned int top, bottom, alignment, ret = 0; 616 612 617 613 t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); 614 + t->max_user_sectors = min_not_zero(t->max_user_sectors, 615 + b->max_user_sectors); 618 616 t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors); 619 617 t->max_dev_sectors = min_not_zero(t->max_dev_sectors, b->max_dev_sectors); 620 618 t->max_write_zeroes_sectors = min(t->max_write_zeroes_sectors,
-1
block/blk-stat.h
··· 64 64 65 65 struct blk_queue_stats *blk_alloc_queue_stats(void); 66 66 void blk_free_queue_stats(struct blk_queue_stats *); 67 - bool blk_stats_alloc_enable(struct request_queue *q); 68 67 69 68 void blk_stat_add(struct request *rq, u64 now); 70 69
+12 -12
block/blk-throttle.c
··· 1399 1399 bps_dft = U64_MAX; 1400 1400 iops_dft = UINT_MAX; 1401 1401 1402 - if (tg->bps_conf[READ] == bps_dft && 1403 - tg->bps_conf[WRITE] == bps_dft && 1404 - tg->iops_conf[READ] == iops_dft && 1405 - tg->iops_conf[WRITE] == iops_dft) 1402 + if (tg->bps[READ] == bps_dft && 1403 + tg->bps[WRITE] == bps_dft && 1404 + tg->iops[READ] == iops_dft && 1405 + tg->iops[WRITE] == iops_dft) 1406 1406 return 0; 1407 1407 1408 1408 seq_printf(sf, "%s", dname); 1409 - if (tg->bps_conf[READ] == U64_MAX) 1409 + if (tg->bps[READ] == U64_MAX) 1410 1410 seq_printf(sf, " rbps=max"); 1411 1411 else 1412 - seq_printf(sf, " rbps=%llu", tg->bps_conf[READ]); 1412 + seq_printf(sf, " rbps=%llu", tg->bps[READ]); 1413 1413 1414 - if (tg->bps_conf[WRITE] == U64_MAX) 1414 + if (tg->bps[WRITE] == U64_MAX) 1415 1415 seq_printf(sf, " wbps=max"); 1416 1416 else 1417 - seq_printf(sf, " wbps=%llu", tg->bps_conf[WRITE]); 1417 + seq_printf(sf, " wbps=%llu", tg->bps[WRITE]); 1418 1418 1419 - if (tg->iops_conf[READ] == UINT_MAX) 1419 + if (tg->iops[READ] == UINT_MAX) 1420 1420 seq_printf(sf, " riops=max"); 1421 1421 else 1422 - seq_printf(sf, " riops=%u", tg->iops_conf[READ]); 1422 + seq_printf(sf, " riops=%u", tg->iops[READ]); 1423 1423 1424 - if (tg->iops_conf[WRITE] == UINT_MAX) 1424 + if (tg->iops[WRITE] == UINT_MAX) 1425 1425 seq_printf(sf, " wiops=max"); 1426 1426 else 1427 - seq_printf(sf, " wiops=%u", tg->iops_conf[WRITE]); 1427 + seq_printf(sf, " wiops=%u", tg->iops[WRITE]); 1428 1428 1429 1429 seq_printf(sf, "\n"); 1430 1430 return 0;
+2 -6
block/blk-throttle.h
··· 95 95 bool has_rules_bps[2]; 96 96 bool has_rules_iops[2]; 97 97 98 - /* internally used bytes per second rate limits */ 98 + /* bytes per second rate limits */ 99 99 uint64_t bps[2]; 100 - /* user configured bps limits */ 101 - uint64_t bps_conf[2]; 102 100 103 - /* internally used IOPS limits */ 101 + /* IOPS limits */ 104 102 unsigned int iops[2]; 105 - /* user configured IOPS limits */ 106 - unsigned int iops_conf[2]; 107 103 108 104 /* Number of bytes dispatched in current slice */ 109 105 uint64_t bytes_disp[2];
+36 -11
block/blk-zoned.c
··· 450 450 return test_bit(disk_zone_no(disk, sector), disk->conv_zones_bitmap); 451 451 } 452 452 453 + static bool disk_zone_is_last(struct gendisk *disk, struct blk_zone *zone) 454 + { 455 + return zone->start + zone->len >= get_capacity(disk); 456 + } 457 + 458 + static bool disk_zone_is_full(struct gendisk *disk, 459 + unsigned int zno, unsigned int offset_in_zone) 460 + { 461 + if (zno < disk->nr_zones - 1) 462 + return offset_in_zone >= disk->zone_capacity; 463 + return offset_in_zone >= disk->last_zone_capacity; 464 + } 465 + 466 + static bool disk_zone_wplug_is_full(struct gendisk *disk, 467 + struct blk_zone_wplug *zwplug) 468 + { 469 + return disk_zone_is_full(disk, zwplug->zone_no, zwplug->wp_offset); 470 + } 471 + 453 472 static bool disk_insert_zone_wplug(struct gendisk *disk, 454 473 struct blk_zone_wplug *zwplug) 455 474 { ··· 562 543 return false; 563 544 564 545 /* We can remove zone write plugs for zones that are empty or full. */ 565 - return !zwplug->wp_offset || zwplug->wp_offset >= disk->zone_capacity; 546 + return !zwplug->wp_offset || disk_zone_wplug_is_full(disk, zwplug); 566 547 } 567 548 568 549 static void disk_remove_zone_wplug(struct gendisk *disk, ··· 683 664 static void disk_zone_wplug_abort_unaligned(struct gendisk *disk, 684 665 struct blk_zone_wplug *zwplug) 685 666 { 686 - unsigned int zone_capacity = disk->zone_capacity; 687 667 unsigned int wp_offset = zwplug->wp_offset; 688 668 struct bio_list bl = BIO_EMPTY_LIST; 689 669 struct bio *bio; 690 670 691 671 while ((bio = bio_list_pop(&zwplug->bio_list))) { 692 - if (wp_offset >= zone_capacity || 672 + if (disk_zone_is_full(disk, zwplug->zone_no, wp_offset) || 693 673 (bio_op(bio) != REQ_OP_ZONE_APPEND && 694 674 bio_offset_from_zone_start(bio) != wp_offset)) { 695 675 blk_zone_wplug_bio_io_error(zwplug, bio); ··· 927 909 sector_t req_back_sector = blk_rq_pos(req) + blk_rq_sectors(req); 928 910 struct request_queue *q = req->q; 929 911 struct gendisk *disk = q->disk; 930 - unsigned int zone_capacity = disk->zone_capacity; 931 912 struct blk_zone_wplug *zwplug = 932 913 disk_get_zone_wplug(disk, blk_rq_pos(req)); 933 914 unsigned long flags; ··· 950 933 * into the back of the request. 951 934 */ 952 935 spin_lock_irqsave(&zwplug->lock, flags); 953 - while (zwplug->wp_offset < zone_capacity) { 936 + while (!disk_zone_wplug_is_full(disk, zwplug)) { 954 937 bio = bio_list_peek(&zwplug->bio_list); 955 938 if (!bio) 956 939 break; ··· 996 979 * We know such BIO will fail, and that would potentially overflow our 997 980 * write pointer offset beyond the end of the zone. 998 981 */ 999 - if (zwplug->wp_offset >= disk->zone_capacity) 982 + if (disk_zone_wplug_is_full(disk, zwplug)) 1000 983 goto err; 1001 984 1002 985 if (bio_op(bio) == REQ_OP_ZONE_APPEND) { ··· 1573 1556 kfree(disk->conv_zones_bitmap); 1574 1557 disk->conv_zones_bitmap = NULL; 1575 1558 disk->zone_capacity = 0; 1559 + disk->last_zone_capacity = 0; 1576 1560 disk->nr_zones = 0; 1577 1561 } 1578 1562 ··· 1618 1600 unsigned long *conv_zones_bitmap; 1619 1601 unsigned int nr_zones; 1620 1602 unsigned int zone_capacity; 1603 + unsigned int last_zone_capacity; 1621 1604 sector_t sector; 1622 1605 }; 1623 1606 ··· 1636 1617 1637 1618 disk->nr_zones = args->nr_zones; 1638 1619 disk->zone_capacity = args->zone_capacity; 1620 + disk->last_zone_capacity = args->last_zone_capacity; 1639 1621 swap(disk->conv_zones_bitmap, args->conv_zones_bitmap); 1640 1622 if (disk->conv_zones_bitmap) 1641 1623 nr_conv_zones = bitmap_weight(disk->conv_zones_bitmap, ··· 1688 1668 return -ENODEV; 1689 1669 } 1690 1670 1671 + if (disk_zone_is_last(disk, zone)) 1672 + args->last_zone_capacity = zone->capacity; 1673 + 1691 1674 if (!disk_need_zone_resources(disk)) 1692 1675 return 0; 1693 1676 ··· 1716 1693 1717 1694 /* 1718 1695 * Remember the capacity of the first sequential zone and check 1719 - * if it is constant for all zones. 1696 + * if it is constant for all zones, ignoring the last zone as it can be 1697 + * smaller. 1720 1698 */ 1721 1699 if (!args->zone_capacity) 1722 1700 args->zone_capacity = zone->capacity; 1723 - if (zone->capacity != args->zone_capacity) { 1701 + if (disk_zone_is_last(disk, zone)) { 1702 + args->last_zone_capacity = zone->capacity; 1703 + } else if (zone->capacity != args->zone_capacity) { 1724 1704 pr_warn("%s: Invalid variable zone capacity\n", 1725 1705 disk->disk_name); 1726 1706 return -ENODEV; ··· 1758 1732 { 1759 1733 struct blk_revalidate_zone_args *args = data; 1760 1734 struct gendisk *disk = args->disk; 1761 - sector_t capacity = get_capacity(disk); 1762 1735 sector_t zone_sectors = disk->queue->limits.chunk_sectors; 1763 1736 int ret; 1764 1737 ··· 1768 1743 return -ENODEV; 1769 1744 } 1770 1745 1771 - if (zone->start >= capacity || !zone->len) { 1746 + if (zone->start >= get_capacity(disk) || !zone->len) { 1772 1747 pr_warn("%s: Invalid zone start %llu, length %llu\n", 1773 1748 disk->disk_name, zone->start, zone->len); 1774 1749 return -ENODEV; ··· 1778 1753 * All zones must have the same size, with the exception on an eventual 1779 1754 * smaller last zone. 1780 1755 */ 1781 - if (zone->start + zone->len < capacity) { 1756 + if (!disk_zone_is_last(disk, zone)) { 1782 1757 if (zone->len != zone_sectors) { 1783 1758 pr_warn("%s: Invalid zoned device with non constant zone size\n", 1784 1759 disk->disk_name);
+2 -2
drivers/acpi/ac.c
··· 145 145 dev_name(&adev->dev), event, 146 146 (u32) ac->state); 147 147 acpi_notifier_call_chain(adev, event, (u32) ac->state); 148 - kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE); 148 + power_supply_changed(ac->charger); 149 149 } 150 150 } 151 151 ··· 268 268 if (acpi_ac_get_state(ac)) 269 269 return 0; 270 270 if (old_state != ac->state) 271 - kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE); 271 + power_supply_changed(ac->charger); 272 272 273 273 return 0; 274 274 }
+1 -1
drivers/acpi/apei/einj-core.c
··· 909 909 if (einj_initialized) 910 910 platform_driver_unregister(&einj_driver); 911 911 912 - platform_device_del(einj_dev); 912 + platform_device_unregister(einj_dev); 913 913 } 914 914 915 915 module_init(einj_init);
+7 -2
drivers/acpi/ec.c
··· 1333 1333 if (ec->busy_polling || bits > 8) 1334 1334 acpi_ec_burst_enable(ec); 1335 1335 1336 - for (i = 0; i < bytes; ++i, ++address, ++value) 1336 + for (i = 0; i < bytes; ++i, ++address, ++value) { 1337 1337 result = (function == ACPI_READ) ? 1338 1338 acpi_ec_read(ec, address, value) : 1339 1339 acpi_ec_write(ec, address, *value); 1340 + if (result < 0) 1341 + break; 1342 + } 1340 1343 1341 1344 if (ec->busy_polling || bits > 8) 1342 1345 acpi_ec_burst_disable(ec); ··· 1351 1348 return AE_NOT_FOUND; 1352 1349 case -ETIME: 1353 1350 return AE_TIME; 1354 - default: 1351 + case 0: 1355 1352 return AE_OK; 1353 + default: 1354 + return AE_ERROR; 1356 1355 } 1357 1356 } 1358 1357
+2 -2
drivers/acpi/sbs.c
··· 610 610 if (sbs->charger_exists) { 611 611 acpi_ac_get_present(sbs); 612 612 if (sbs->charger_present != saved_charger_state) 613 - kobject_uevent(&sbs->charger->dev.kobj, KOBJ_CHANGE); 613 + power_supply_changed(sbs->charger); 614 614 } 615 615 616 616 if (sbs->manager_present) { ··· 622 622 acpi_battery_read(bat); 623 623 if (saved_battery_state == bat->present) 624 624 continue; 625 - kobject_uevent(&bat->bat->dev.kobj, KOBJ_CHANGE); 625 + power_supply_changed(bat->bat); 626 626 } 627 627 } 628 628 }
-1
drivers/ata/ahci.c
··· 429 429 { PCI_VDEVICE(INTEL, 0x02d7), board_ahci_pcs_quirk }, /* Comet Lake PCH RAID */ 430 430 /* Elkhart Lake IDs 0x4b60 & 0x4b62 https://sata-io.org/product/8803 not tested yet */ 431 431 { PCI_VDEVICE(INTEL, 0x4b63), board_ahci_pcs_quirk }, /* Elkhart Lake AHCI */ 432 - { PCI_VDEVICE(INTEL, 0x7ae2), board_ahci_pcs_quirk }, /* Alder Lake-P AHCI */ 433 432 434 433 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 435 434 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+8 -1
drivers/ata/libata-core.c
··· 4136 4136 { "PIONEER BD-RW BDR-207M", NULL, ATA_HORKAGE_NOLPM }, 4137 4137 { "PIONEER BD-RW BDR-205", NULL, ATA_HORKAGE_NOLPM }, 4138 4138 4139 - /* Crucial BX100 SSD 500GB has broken LPM support */ 4139 + /* Crucial devices with broken LPM support */ 4140 4140 { "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM }, 4141 + { "CT240BX500SSD1", NULL, ATA_HORKAGE_NOLPM }, 4141 4142 4142 4143 /* 512GB MX100 with MU01 firmware has both queued TRIM and LPM issues */ 4143 4144 { "Crucial_CT512MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | ··· 4155 4154 { "Crucial_CT960M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | 4156 4155 ATA_HORKAGE_ZERO_AFTER_TRIM | 4157 4156 ATA_HORKAGE_NOLPM }, 4157 + 4158 + /* AMD Radeon devices with broken LPM support */ 4159 + { "R3SL240G", NULL, ATA_HORKAGE_NOLPM }, 4160 + 4161 + /* Apacer models with LPM issues */ 4162 + { "Apacer AS340*", NULL, ATA_HORKAGE_NOLPM }, 4158 4163 4159 4164 /* These specific Samsung models/firmware-revs do not handle LPM well */ 4160 4165 { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM },
+2 -1
drivers/base/regmap/regmap-i2c.c
··· 350 350 351 351 if (quirks->max_write_len && 352 352 (bus->max_raw_write == 0 || bus->max_raw_write > quirks->max_write_len)) 353 - max_write = quirks->max_write_len; 353 + max_write = quirks->max_write_len - 354 + (config->reg_bits + config->pad_bits) / BITS_PER_BYTE; 354 355 355 356 if (max_read || max_write) { 356 357 ret_bus = kmemdup(bus, sizeof(*bus), GFP_KERNEL);
+1
drivers/block/null_blk/main.c
··· 494 494 495 495 set_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags); 496 496 dev->power = newp; 497 + ret = count; 497 498 } else if (dev->power && !newp) { 498 499 if (test_and_clear_bit(NULLB_DEV_FL_UP, &dev->flags)) { 499 500 dev->power = newp;
+12 -1
drivers/block/null_blk/zoned.c
··· 74 74 return -EINVAL; 75 75 } 76 76 77 + /* 78 + * If a smaller zone capacity was requested, do not allow a smaller last 79 + * zone at the same time as such zone configuration does not correspond 80 + * to any real zoned device. 81 + */ 82 + if (dev->zone_capacity != dev->zone_size && 83 + dev->size & (dev->zone_size - 1)) { 84 + pr_err("A smaller last zone is not allowed with zone capacity smaller than zone size.\n"); 85 + return -EINVAL; 86 + } 87 + 77 88 zone_capacity_sects = mb_to_sects(dev->zone_capacity); 78 89 dev_capacity_sects = mb_to_sects(dev->size); 79 90 dev->zone_size_sects = mb_to_sects(dev->zone_size); ··· 119 108 if (dev->zone_max_active && dev->zone_max_open > dev->zone_max_active) { 120 109 dev->zone_max_open = dev->zone_max_active; 121 110 pr_info("changed the maximum number of open zones to %u\n", 122 - dev->nr_zones); 111 + dev->zone_max_open); 123 112 } else if (dev->zone_max_open >= dev->nr_zones - dev->zone_nr_conv) { 124 113 dev->zone_max_open = 0; 125 114 pr_info("zone_max_open limit disabled, limit >= zone count\n");
+1 -1
drivers/char/tpm/tpm.h
··· 28 28 #include <linux/tpm_eventlog.h> 29 29 30 30 #ifdef CONFIG_X86 31 - #include <asm/intel-family.h> 31 + #include <asm/cpu_device_id.h> 32 32 #endif 33 33 34 34 #define TPM_MINOR 224 /* officially assigned */
+2 -1
drivers/char/tpm/tpm_tis_core.c
··· 1020 1020 interrupt = 0; 1021 1021 1022 1022 tpm_tis_write32(priv, reg, ~TPM_GLOBAL_INT_ENABLE & interrupt); 1023 - flush_work(&priv->free_irq_work); 1023 + if (priv->free_irq_work.func) 1024 + flush_work(&priv->free_irq_work); 1024 1025 1025 1026 tpm_tis_clkrun_enable(chip, false); 1026 1027
+1 -1
drivers/char/tpm/tpm_tis_core.h
··· 210 210 static inline bool is_bsw(void) 211 211 { 212 212 #ifdef CONFIG_X86 213 - return ((boot_cpu_data.x86_model == INTEL_FAM6_ATOM_AIRMONT) ? 1 : 0); 213 + return (boot_cpu_data.x86_vfm == INTEL_ATOM_AIRMONT) ? 1 : 0; 214 214 #else 215 215 return false; 216 216 #endif
+2 -1
drivers/cpufreq/amd-pstate-ut.c
··· 26 26 #include <linux/module.h> 27 27 #include <linux/moduleparam.h> 28 28 #include <linux/fs.h> 29 - #include <linux/amd-pstate.h> 30 29 31 30 #include <acpi/cppc_acpi.h> 31 + 32 + #include "amd-pstate.h" 32 33 33 34 /* 34 35 * Abbreviations:
+34 -2
drivers/cpufreq/amd-pstate.c
··· 36 36 #include <linux/delay.h> 37 37 #include <linux/uaccess.h> 38 38 #include <linux/static_call.h> 39 - #include <linux/amd-pstate.h> 40 39 #include <linux/topology.h> 41 40 42 41 #include <acpi/processor.h> ··· 45 46 #include <asm/processor.h> 46 47 #include <asm/cpufeature.h> 47 48 #include <asm/cpu_device_id.h> 49 + 50 + #include "amd-pstate.h" 48 51 #include "amd-pstate-trace.h" 49 52 50 53 #define AMD_PSTATE_TRANSITION_LATENCY 20000 51 54 #define AMD_PSTATE_TRANSITION_DELAY 1000 52 55 #define CPPC_HIGHEST_PERF_PERFORMANCE 196 53 56 #define CPPC_HIGHEST_PERF_DEFAULT 166 57 + 58 + #define AMD_CPPC_EPP_PERFORMANCE 0x00 59 + #define AMD_CPPC_EPP_BALANCE_PERFORMANCE 0x80 60 + #define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF 61 + #define AMD_CPPC_EPP_POWERSAVE 0xFF 62 + 63 + /* 64 + * enum amd_pstate_mode - driver working mode of amd pstate 65 + */ 66 + enum amd_pstate_mode { 67 + AMD_PSTATE_UNDEFINED = 0, 68 + AMD_PSTATE_DISABLE, 69 + AMD_PSTATE_PASSIVE, 70 + AMD_PSTATE_ACTIVE, 71 + AMD_PSTATE_GUIDED, 72 + AMD_PSTATE_MAX, 73 + }; 74 + 75 + static const char * const amd_pstate_mode_string[] = { 76 + [AMD_PSTATE_UNDEFINED] = "undefined", 77 + [AMD_PSTATE_DISABLE] = "disable", 78 + [AMD_PSTATE_PASSIVE] = "passive", 79 + [AMD_PSTATE_ACTIVE] = "active", 80 + [AMD_PSTATE_GUIDED] = "guided", 81 + NULL, 82 + }; 83 + 84 + struct quirk_entry { 85 + u32 nominal_freq; 86 + u32 lowest_freq; 87 + }; 54 88 55 89 /* 56 90 * TODO: We need more time to fine tune processors with shared memory solution ··· 701 669 if (state) 702 670 policy->cpuinfo.max_freq = cpudata->max_freq; 703 671 else 704 - policy->cpuinfo.max_freq = cpudata->nominal_freq; 672 + policy->cpuinfo.max_freq = cpudata->nominal_freq * 1000; 705 673 706 674 policy->max = policy->cpuinfo.max_freq; 707 675
+2 -1
drivers/cpufreq/intel_pstate.c
··· 1153 1153 static void __intel_pstate_update_max_freq(struct cpudata *cpudata, 1154 1154 struct cpufreq_policy *policy) 1155 1155 { 1156 - intel_pstate_get_hwp_cap(cpudata); 1156 + if (hwp_active) 1157 + intel_pstate_get_hwp_cap(cpudata); 1157 1158 1158 1159 policy->cpuinfo.max_freq = READ_ONCE(global.no_turbo) ? 1159 1160 cpudata->pstate.max_freq : cpudata->pstate.turbo_freq;
+9 -9
drivers/cxl/core/region.c
··· 2352 2352 struct device *dev; 2353 2353 int rc; 2354 2354 2355 - switch (mode) { 2356 - case CXL_DECODER_RAM: 2357 - case CXL_DECODER_PMEM: 2358 - break; 2359 - default: 2360 - dev_err(&cxlrd->cxlsd.cxld.dev, "unsupported mode %d\n", mode); 2361 - return ERR_PTR(-EINVAL); 2362 - } 2363 - 2364 2355 cxlr = cxl_region_alloc(cxlrd, id); 2365 2356 if (IS_ERR(cxlr)) 2366 2357 return cxlr; ··· 2405 2414 enum cxl_decoder_mode mode, int id) 2406 2415 { 2407 2416 int rc; 2417 + 2418 + switch (mode) { 2419 + case CXL_DECODER_RAM: 2420 + case CXL_DECODER_PMEM: 2421 + break; 2422 + default: 2423 + dev_err(&cxlrd->cxlsd.cxld.dev, "unsupported mode %d\n", mode); 2424 + return ERR_PTR(-EINVAL); 2425 + } 2408 2426 2409 2427 rc = memregion_alloc(GFP_KERNEL); 2410 2428 if (rc < 0)
+6
drivers/dma-buf/st-dma-fence.c
··· 540 540 t[i].before = pass; 541 541 t[i].task = kthread_run(thread_signal_callback, &t[i], 542 542 "dma-fence:%d", i); 543 + if (IS_ERR(t[i].task)) { 544 + ret = PTR_ERR(t[i].task); 545 + while (--i >= 0) 546 + kthread_stop_put(t[i].task); 547 + return ret; 548 + } 543 549 get_task_struct(t[i].task); 544 550 } 545 551
+2 -2
drivers/dma-buf/sync_debug.c
··· 110 110 111 111 seq_printf(s, "%s: %d\n", obj->name, obj->value); 112 112 113 - spin_lock_irq(&obj->lock); 113 + spin_lock(&obj->lock); /* Caller already disabled IRQ. */ 114 114 list_for_each(pos, &obj->pt_list) { 115 115 struct sync_pt *pt = container_of(pos, struct sync_pt, link); 116 116 sync_print_fence(s, &pt->base, false); 117 117 } 118 - spin_unlock_irq(&obj->lock); 118 + spin_unlock(&obj->lock); 119 119 } 120 120 121 121 static void sync_print_sync_file(struct seq_file *s,
+1
drivers/firewire/packet-serdes-test.c
··· 579 579 }; 580 580 kunit_test_suite(packet_serdes_test_suite); 581 581 582 + MODULE_DESCRIPTION("FireWire packet serialization/deserialization unit test suite"); 582 583 MODULE_LICENSE("GPL");
+1
drivers/firewire/uapi-test.c
··· 86 86 }; 87 87 kunit_test_suite(structure_layout_test_suite); 88 88 89 + MODULE_DESCRIPTION("FireWire UAPI unit test suite"); 89 90 MODULE_LICENSE("GPL");
+4 -4
drivers/firmware/efi/efi-pstore.c
··· 136 136 &size, record->buf); 137 137 if (status != EFI_SUCCESS) { 138 138 kfree(record->buf); 139 - return -EIO; 139 + return efi_status_to_err(status); 140 140 } 141 141 142 142 /* ··· 189 189 return 0; 190 190 191 191 if (status != EFI_SUCCESS) 192 - return -EIO; 192 + return efi_status_to_err(status); 193 193 194 194 /* skip variables that don't concern us */ 195 195 if (efi_guidcmp(guid, LINUX_EFI_CRASH_GUID)) ··· 227 227 record->size, record->psi->buf, 228 228 true); 229 229 efivar_unlock(); 230 - return status == EFI_SUCCESS ? 0 : -EIO; 230 + return efi_status_to_err(status); 231 231 }; 232 232 233 233 static int efi_pstore_erase(struct pstore_record *record) ··· 238 238 PSTORE_EFI_ATTRIBUTES, 0, NULL); 239 239 240 240 if (status != EFI_SUCCESS && status != EFI_NOT_FOUND) 241 - return -EIO; 241 + return efi_status_to_err(status); 242 242 return 0; 243 243 } 244 244
+1 -1
drivers/firmware/efi/libstub/loongarch.c
··· 41 41 unsigned long __weak kernel_entry_address(unsigned long kernel_addr, 42 42 efi_loaded_image_t *image) 43 43 { 44 - return *(unsigned long *)(kernel_addr + 8) - VMLINUX_LOAD_ADDRESS + kernel_addr; 44 + return *(unsigned long *)(kernel_addr + 8) - PHYSADDR(VMLINUX_LOAD_ADDRESS) + kernel_addr; 45 45 } 46 46 47 47 efi_status_t efi_boot_kernel(void *handle, efi_loaded_image_t *image,
+1
drivers/firmware/efi/libstub/zboot.lds
··· 41 41 } 42 42 43 43 /DISCARD/ : { 44 + *(.discard .discard.*) 44 45 *(.modinfo .init.modinfo) 45 46 } 46 47 }
+6 -7
drivers/firmware/efi/runtime-wrappers.c
··· 213 213 * Calls the appropriate efi_runtime_service() with the appropriate 214 214 * arguments. 215 215 */ 216 - static void efi_call_rts(struct work_struct *work) 216 + static void __nocfi efi_call_rts(struct work_struct *work) 217 217 { 218 218 const union efi_rts_args *args = efi_rts_work.args; 219 219 efi_status_t status = EFI_NOT_FOUND; ··· 435 435 return status; 436 436 } 437 437 438 - static efi_status_t 438 + static efi_status_t __nocfi 439 439 virt_efi_set_variable_nb(efi_char16_t *name, efi_guid_t *vendor, u32 attr, 440 440 unsigned long data_size, void *data) 441 441 { ··· 469 469 return status; 470 470 } 471 471 472 - static efi_status_t 472 + static efi_status_t __nocfi 473 473 virt_efi_query_variable_info_nb(u32 attr, u64 *storage_space, 474 474 u64 *remaining_space, u64 *max_variable_size) 475 475 { ··· 499 499 return status; 500 500 } 501 501 502 - static void virt_efi_reset_system(int reset_type, 503 - efi_status_t status, 504 - unsigned long data_size, 505 - efi_char16_t *data) 502 + static void __nocfi 503 + virt_efi_reset_system(int reset_type, efi_status_t status, 504 + unsigned long data_size, efi_char16_t *data) 506 505 { 507 506 if (down_trylock(&efi_runtime_lock)) { 508 507 pr_warn("failed to invoke the reset_system() runtime service:\n"
+8 -8
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
··· 196 196 return -EINVAL; 197 197 198 198 vram_size = KFD_XCP_MEMORY_SIZE(adev, xcp_id); 199 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) { 199 + if (adev->flags & AMD_IS_APU) { 200 200 system_mem_needed = size; 201 201 ttm_mem_needed = size; 202 202 } ··· 233 233 if (adev && xcp_id >= 0) { 234 234 adev->kfd.vram_used[xcp_id] += vram_needed; 235 235 adev->kfd.vram_used_aligned[xcp_id] += 236 - (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) ? 236 + (adev->flags & AMD_IS_APU) ? 237 237 vram_needed : 238 238 ALIGN(vram_needed, VRAM_AVAILABLITY_ALIGN); 239 239 } ··· 261 261 262 262 if (adev) { 263 263 adev->kfd.vram_used[xcp_id] -= size; 264 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) { 264 + if (adev->flags & AMD_IS_APU) { 265 265 adev->kfd.vram_used_aligned[xcp_id] -= size; 266 266 kfd_mem_limit.system_mem_used -= size; 267 267 kfd_mem_limit.ttm_mem_used -= size; ··· 890 890 * if peer device has large BAR. In contrast, access over xGMI is 891 891 * allowed for both small and large BAR configurations of peer device 892 892 */ 893 - if ((adev != bo_adev && !(adev->gmc.is_app_apu || adev->flags & AMD_IS_APU)) && 893 + if ((adev != bo_adev && !(adev->flags & AMD_IS_APU)) && 894 894 ((mem->domain == AMDGPU_GEM_DOMAIN_VRAM) || 895 895 (mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL) || 896 896 (mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP))) { ··· 1658 1658 - atomic64_read(&adev->vram_pin_size) 1659 1659 - reserved_for_pt; 1660 1660 1661 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) { 1661 + if (adev->flags & AMD_IS_APU) { 1662 1662 system_mem_available = no_system_mem_limit ? 1663 1663 kfd_mem_limit.max_system_mem_limit : 1664 1664 kfd_mem_limit.max_system_mem_limit - ··· 1706 1706 if (flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM) { 1707 1707 domain = alloc_domain = AMDGPU_GEM_DOMAIN_VRAM; 1708 1708 1709 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) { 1709 + if (adev->flags & AMD_IS_APU) { 1710 1710 domain = AMDGPU_GEM_DOMAIN_GTT; 1711 1711 alloc_domain = AMDGPU_GEM_DOMAIN_GTT; 1712 1712 alloc_flags = 0; ··· 1953 1953 if (size) { 1954 1954 if (!is_imported && 1955 1955 (mem->bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM || 1956 - ((adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) && 1956 + ((adev->flags & AMD_IS_APU) && 1957 1957 mem->bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT))) 1958 1958 *size = bo_size; 1959 1959 else ··· 2376 2376 (*mem)->bo = bo; 2377 2377 (*mem)->va = va; 2378 2378 (*mem)->domain = (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) && 2379 - !(adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) ? 2379 + !(adev->flags & AMD_IS_APU) ? 2380 2380 AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT; 2381 2381 2382 2382 (*mem)->mapped_to_gpu_memory = 0;
+12 -7
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 5944 5944 *speed = PCI_SPEED_UNKNOWN; 5945 5945 *width = PCIE_LNK_WIDTH_UNKNOWN; 5946 5946 5947 - while ((parent = pci_upstream_bridge(parent))) { 5948 - /* skip upstream/downstream switches internal to dGPU*/ 5949 - if (parent->vendor == PCI_VENDOR_ID_ATI) 5950 - continue; 5951 - *speed = pcie_get_speed_cap(parent); 5952 - *width = pcie_get_width_cap(parent); 5953 - break; 5947 + if (amdgpu_device_pcie_dynamic_switching_supported(adev)) { 5948 + while ((parent = pci_upstream_bridge(parent))) { 5949 + /* skip upstream/downstream switches internal to dGPU*/ 5950 + if (parent->vendor == PCI_VENDOR_ID_ATI) 5951 + continue; 5952 + *speed = pcie_get_speed_cap(parent); 5953 + *width = pcie_get_width_cap(parent); 5954 + break; 5955 + } 5956 + } else { 5957 + /* use the current speeds rather than max if switching is not supported */ 5958 + pcie_bandwidth_available(adev->pdev, NULL, speed, width); 5954 5959 } 5955 5960 } 5956 5961
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
··· 46 46 #define AMDGPU_RAS_GPU_ERR_HBM_BIST_TEST(x) AMDGPU_GET_REG_FIELD(x, 7, 7) 47 47 #define AMDGPU_RAS_GPU_ERR_SOCKET_ID(x) AMDGPU_GET_REG_FIELD(x, 10, 8) 48 48 #define AMDGPU_RAS_GPU_ERR_AID_ID(x) AMDGPU_GET_REG_FIELD(x, 12, 11) 49 - #define AMDGPU_RAS_GPU_ERR_HBM_ID(x) AMDGPU_GET_REG_FIELD(x, 13, 13) 49 + #define AMDGPU_RAS_GPU_ERR_HBM_ID(x) AMDGPU_GET_REG_FIELD(x, 14, 13) 50 50 #define AMDGPU_RAS_GPU_ERR_BOOT_STATUS(x) AMDGPU_GET_REG_FIELD(x, 31, 31) 51 51 52 52 #define AMDGPU_RAS_BOOT_STATUS_POLLING_LIMIT 1000
+5 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
··· 706 706 struct amdgpu_vm_bo_base *entry) 707 707 { 708 708 struct amdgpu_vm_bo_base *parent = amdgpu_vm_pt_parent(entry); 709 - struct amdgpu_bo *bo = parent->bo, *pbo; 709 + struct amdgpu_bo *bo, *pbo; 710 710 struct amdgpu_vm *vm = params->vm; 711 711 uint64_t pde, pt, flags; 712 712 unsigned int level; 713 713 714 + if (WARN_ON(!parent)) 715 + return -EINVAL; 716 + 717 + bo = parent->bo; 714 718 for (level = 0, pbo = bo->parent; pbo; ++level) 715 719 pbo = pbo->parent; 716 720
+1 -1
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c
··· 422 422 423 423 if (adev->gmc.num_mem_partitions == num_xcc / 2) 424 424 return (adev->flags & AMD_IS_APU) ? AMDGPU_TPX_PARTITION_MODE : 425 - AMDGPU_QPX_PARTITION_MODE; 425 + AMDGPU_CPX_PARTITION_MODE; 426 426 427 427 if (adev->gmc.num_mem_partitions == 2 && !(adev->flags & AMD_IS_APU)) 428 428 return AMDGPU_DPX_PARTITION_MODE;
+2 -9
drivers/gpu/drm/amd/amdkfd/kfd_device.c
··· 408 408 f2g = &gfx_v11_kfd2kgd; 409 409 break; 410 410 case IP_VERSION(11, 0, 3): 411 - if ((adev->pdev->device == 0x7460 && 412 - adev->pdev->revision == 0x00) || 413 - (adev->pdev->device == 0x7461 && 414 - adev->pdev->revision == 0x00)) 415 - /* Note: Compiler version is 11.0.5 while HW version is 11.0.3 */ 416 - gfx_target_version = 110005; 417 - else 418 - /* Note: Compiler version is 11.0.1 while HW version is 11.0.3 */ 419 - gfx_target_version = 110001; 411 + /* Note: Compiler version is 11.0.1 while HW version is 11.0.3 */ 412 + gfx_target_version = 110001; 420 413 f2g = &gfx_v11_kfd2kgd; 421 414 break; 422 415 case IP_VERSION(11, 5, 0):
+1 -1
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
··· 1023 1023 if (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(9, 0, 1)) 1024 1024 return -EINVAL; 1025 1025 1026 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) 1026 + if (adev->flags & AMD_IS_APU) 1027 1027 return 0; 1028 1028 1029 1029 pgmap = &kfddev->pgmap;
+2 -4
drivers/gpu/drm/amd/amdkfd/kfd_svm.c
··· 2619 2619 return -1; 2620 2620 } 2621 2621 2622 - if (node->adev->gmc.is_app_apu || 2623 - node->adev->flags & AMD_IS_APU) 2622 + if (node->adev->flags & AMD_IS_APU) 2624 2623 return 0; 2625 2624 2626 2625 if (prange->preferred_loc == gpuid || ··· 3337 3338 goto out; 3338 3339 } 3339 3340 3340 - if (bo_node->adev->gmc.is_app_apu || 3341 - bo_node->adev->flags & AMD_IS_APU) { 3341 + if (bo_node->adev->flags & AMD_IS_APU) { 3342 3342 best_loc = 0; 3343 3343 goto out; 3344 3344 }
-1
drivers/gpu/drm/amd/amdkfd/kfd_svm.h
··· 201 201 * is initialized to not 0 when page migration register device memory. 202 202 */ 203 203 #define KFD_IS_SVM_API_SUPPORTED(adev) ((adev)->kfd.pgmap.type != 0 ||\ 204 - (adev)->gmc.is_app_apu ||\ 205 204 ((adev)->flags & AMD_IS_APU)) 206 205 207 206 void svm_range_bo_unref_async(struct svm_range_bo *svm_bo);
+3
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
··· 613 613 &connector->base, 614 614 dev->mode_config.tile_property, 615 615 0); 616 + connector->colorspace_property = master->base.colorspace_property; 617 + if (connector->colorspace_property) 618 + drm_connector_attach_colorspace_property(connector); 616 619 617 620 drm_connector_set_path_property(connector, pathprop); 618 621
+1 -1
drivers/gpu/drm/amd/include/atomfirmware.h
··· 3583 3583 uint8_t phase_delay_us; // phase delay in unit of micro second 3584 3584 uint8_t reserved; 3585 3585 uint32_t gpio_mask_val; // GPIO Mask value 3586 - struct atom_voltage_gpio_map_lut voltage_gpio_lut[1]; 3586 + struct atom_voltage_gpio_map_lut voltage_gpio_lut[] __counted_by(gpio_entry_num); 3587 3587 }; 3588 3588 3589 3589 struct atom_svid2_voltage_object_v4
-1
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
··· 1562 1562 smu_i2c->port = i; 1563 1563 mutex_init(&smu_i2c->mutex); 1564 1564 control->owner = THIS_MODULE; 1565 - control->class = I2C_CLASS_SPD; 1566 1565 control->dev.parent = &adev->pdev->dev; 1567 1566 control->algo = &smu_v14_0_2_i2c_algo; 1568 1567 snprintf(control->name, sizeof(control->name), "AMDGPU SMU %d", i);
+1 -1
drivers/gpu/drm/drm_buddy.c
··· 239 239 if (size < chunk_size) 240 240 return -EINVAL; 241 241 242 - if (chunk_size < PAGE_SIZE) 242 + if (chunk_size < SZ_4K) 243 243 return -EINVAL; 244 244 245 245 if (!is_power_of_2(chunk_size))
+5
drivers/gpu/drm/drm_gem_shmem_helper.c
··· 233 233 234 234 dma_resv_assert_held(shmem->base.resv); 235 235 236 + drm_WARN_ON(shmem->base.dev, shmem->base.import_attach); 237 + 236 238 ret = drm_gem_shmem_get_pages(shmem); 237 239 238 240 return ret; ··· 612 610 613 611 return ret; 614 612 } 613 + 614 + if (is_cow_mapping(vma->vm_flags)) 615 + return -EINVAL; 615 616 616 617 dma_resv_lock(shmem->base.resv, NULL); 617 618 ret = drm_gem_shmem_get_pages(shmem);
+21 -11
drivers/gpu/drm/i915/display/intel_audio.c
··· 1252 1252 static void i915_audio_component_init(struct drm_i915_private *i915) 1253 1253 { 1254 1254 u32 aud_freq, aud_freq_init; 1255 - int ret; 1256 - 1257 - ret = component_add_typed(i915->drm.dev, 1258 - &i915_audio_component_bind_ops, 1259 - I915_COMPONENT_AUDIO); 1260 - if (ret < 0) { 1261 - drm_err(&i915->drm, 1262 - "failed to add audio component (%d)\n", ret); 1263 - /* continue with reduced functionality */ 1264 - return; 1265 - } 1266 1255 1267 1256 if (DISPLAY_VER(i915) >= 9) { 1268 1257 aud_freq_init = intel_de_read(i915, AUD_FREQ_CNTRL); ··· 1274 1285 1275 1286 /* init with current cdclk */ 1276 1287 intel_audio_cdclk_change_post(i915); 1288 + } 1289 + 1290 + static void i915_audio_component_register(struct drm_i915_private *i915) 1291 + { 1292 + int ret; 1293 + 1294 + ret = component_add_typed(i915->drm.dev, 1295 + &i915_audio_component_bind_ops, 1296 + I915_COMPONENT_AUDIO); 1297 + if (ret < 0) { 1298 + drm_err(&i915->drm, 1299 + "failed to add audio component (%d)\n", ret); 1300 + /* continue with reduced functionality */ 1301 + return; 1302 + } 1277 1303 1278 1304 i915->display.audio.component_registered = true; 1279 1305 } ··· 1319 1315 { 1320 1316 if (intel_lpe_audio_init(i915) < 0) 1321 1317 i915_audio_component_init(i915); 1318 + } 1319 + 1320 + void intel_audio_register(struct drm_i915_private *i915) 1321 + { 1322 + if (!i915->display.audio.lpe.platdev) 1323 + i915_audio_component_register(i915); 1322 1324 } 1323 1325 1324 1326 /**
+1
drivers/gpu/drm/i915/display/intel_audio.h
··· 28 28 void intel_audio_cdclk_change_pre(struct drm_i915_private *dev_priv); 29 29 void intel_audio_cdclk_change_post(struct drm_i915_private *dev_priv); 30 30 void intel_audio_init(struct drm_i915_private *dev_priv); 31 + void intel_audio_register(struct drm_i915_private *i915); 31 32 void intel_audio_deinit(struct drm_i915_private *dev_priv); 32 33 void intel_audio_sdp_split_update(const struct intel_crtc_state *crtc_state); 33 34
+2
drivers/gpu/drm/i915/display/intel_display_driver.c
··· 540 540 541 541 intel_display_driver_enable_user_access(i915); 542 542 543 + intel_audio_register(i915); 544 + 543 545 intel_display_debugfs_register(i915); 544 546 545 547 /*
+18
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
··· 255 255 struct intel_context *context; /* logical state for the request */ 256 256 struct i915_gem_context *gem_context; /** caller's context */ 257 257 intel_wakeref_t wakeref; 258 + intel_wakeref_t wakeref_gt0; 258 259 259 260 /** our requests to build */ 260 261 struct i915_request *requests[MAX_ENGINE_INSTANCE + 1]; ··· 2686 2685 eb_select_engine(struct i915_execbuffer *eb) 2687 2686 { 2688 2687 struct intel_context *ce, *child; 2688 + struct intel_gt *gt; 2689 2689 unsigned int idx; 2690 2690 int err; 2691 2691 ··· 2710 2708 } 2711 2709 } 2712 2710 eb->num_batches = ce->parallel.number_children + 1; 2711 + gt = ce->engine->gt; 2713 2712 2714 2713 for_each_child(ce, child) 2715 2714 intel_context_get(child); 2716 2715 eb->wakeref = intel_gt_pm_get(ce->engine->gt); 2716 + /* 2717 + * Keep GT0 active on MTL so that i915_vma_parked() doesn't 2718 + * free VMAs while execbuf ioctl is validating VMAs. 2719 + */ 2720 + if (gt->info.id) 2721 + eb->wakeref_gt0 = intel_gt_pm_get(to_gt(gt->i915)); 2717 2722 2718 2723 if (!test_bit(CONTEXT_ALLOC_BIT, &ce->flags)) { 2719 2724 err = intel_context_alloc_state(ce); ··· 2759 2750 return err; 2760 2751 2761 2752 err: 2753 + if (gt->info.id) 2754 + intel_gt_pm_put(to_gt(gt->i915), eb->wakeref_gt0); 2755 + 2762 2756 intel_gt_pm_put(ce->engine->gt, eb->wakeref); 2763 2757 for_each_child(ce, child) 2764 2758 intel_context_put(child); ··· 2775 2763 struct intel_context *child; 2776 2764 2777 2765 i915_vm_put(eb->context->vm); 2766 + /* 2767 + * This works in conjunction with eb_select_engine() to prevent 2768 + * i915_vma_parked() from interfering while execbuf validates vmas. 2769 + */ 2770 + if (eb->gt->info.id) 2771 + intel_gt_pm_put(to_gt(eb->gt->i915), eb->wakeref_gt0); 2778 2772 intel_gt_pm_put(eb->context->engine->gt, eb->wakeref); 2779 2773 for_each_child(eb->context, child) 2780 2774 intel_context_put(child);
+3 -1
drivers/gpu/drm/i915/gem/i915_gem_object.h
··· 284 284 static inline bool 285 285 i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj) 286 286 { 287 - return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE); 287 + /* TODO: make DPT shrinkable when it has no bound vmas */ 288 + return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE) && 289 + !obj->is_dpt; 288 290 } 289 291 290 292 static inline bool
+1 -1
drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
··· 196 196 if (err) 197 197 goto out_file; 198 198 199 - mode = intel_gt_coherent_map_type(to_gt(i915), native_obj, true); 199 + mode = intel_gt_coherent_map_type(to_gt(i915), native_obj, false); 200 200 vaddr = i915_gem_object_pin_map_unlocked(native_obj, mode); 201 201 if (IS_ERR(vaddr)) { 202 202 err = PTR_ERR(vaddr);
+7 -8
drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
··· 263 263 i915_request_put(rq); 264 264 } 265 265 266 + /* Lazy irq enabling after HW submission */ 266 267 if (!READ_ONCE(b->irq_armed) && !list_empty(&b->signalers)) 267 268 intel_breadcrumbs_arm_irq(b); 269 + 270 + /* And confirm that we still want irqs enabled before we yield */ 271 + if (READ_ONCE(b->irq_armed) && !atomic_read(&b->active)) 272 + intel_breadcrumbs_disarm_irq(b); 268 273 } 269 274 270 275 struct intel_breadcrumbs * ··· 320 315 return; 321 316 322 317 /* Kick the work once more to drain the signalers, and disarm the irq */ 323 - irq_work_sync(&b->irq_work); 324 - while (READ_ONCE(b->irq_armed) && !atomic_read(&b->active)) { 325 - local_irq_disable(); 326 - signal_irq_work(&b->irq_work); 327 - local_irq_enable(); 328 - cond_resched(); 329 - } 318 + irq_work_queue(&b->irq_work); 330 319 } 331 320 332 321 void intel_breadcrumbs_free(struct kref *kref) ··· 403 404 * the request as it may have completed and raised the interrupt as 404 405 * we were attaching it into the lists. 405 406 */ 406 - if (!b->irq_armed || __i915_request_is_complete(rq)) 407 + if (!READ_ONCE(b->irq_armed) || __i915_request_is_complete(rq)) 407 408 irq_work_queue(&b->irq_work); 408 409 } 409 410
+6
drivers/gpu/drm/i915/gt/intel_engine_cs.c
··· 885 885 if (IS_DG2(gt->i915)) { 886 886 u8 first_ccs = __ffs(CCS_MASK(gt)); 887 887 888 + /* 889 + * Store the number of active cslices before 890 + * changing the CCS engine configuration 891 + */ 892 + gt->ccs.cslices = CCS_MASK(gt); 893 + 888 894 /* Mask off all the CCS engine */ 889 895 info->engine_mask &= ~GENMASK(CCS3, CCS0); 890 896 /* Put back in the first CCS engine */
+1 -1
drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c
··· 19 19 20 20 /* Build the value for the fixed CCS load balancing */ 21 21 for (cslice = 0; cslice < I915_MAX_CCS; cslice++) { 22 - if (CCS_MASK(gt) & BIT(cslice)) 22 + if (gt->ccs.cslices & BIT(cslice)) 23 23 /* 24 24 * If available, assign the cslice 25 25 * to the first available engine...
+8
drivers/gpu/drm/i915/gt/intel_gt_types.h
··· 207 207 [MAX_ENGINE_INSTANCE + 1]; 208 208 enum intel_submission_method submission_method; 209 209 210 + struct { 211 + /* 212 + * Mask of the non fused CCS slices 213 + * to be used for the load balancing 214 + */ 215 + intel_engine_mask_t cslices; 216 + } ccs; 217 + 210 218 /* 211 219 * Default address space (either GGTT or ppGTT depending on arch). 212 220 *
+3 -3
drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
··· 29 29 */ 30 30 31 31 #define GUC_KLV_LEN_MIN 1u 32 - #define GUC_KLV_0_KEY (0xffff << 16) 33 - #define GUC_KLV_0_LEN (0xffff << 0) 34 - #define GUC_KLV_n_VALUE (0xffffffff << 0) 32 + #define GUC_KLV_0_KEY (0xffffu << 16) 33 + #define GUC_KLV_0_LEN (0xffffu << 0) 34 + #define GUC_KLV_n_VALUE (0xffffffffu << 0) 35 35 36 36 /** 37 37 * DOC: GuC Self Config KLVs
+1 -1
drivers/gpu/drm/lima/lima_gem.c
··· 185 185 if (bo->heap_size) 186 186 return -EINVAL; 187 187 188 - return drm_gem_shmem_pin(&bo->base); 188 + return drm_gem_shmem_pin_locked(&bo->base); 189 189 } 190 190 191 191 static int lima_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map)
+3 -2
drivers/gpu/drm/msm/registers/gen_header.py
··· 538 538 self.variants.add(reg.domain) 539 539 540 540 def do_validate(self, schemafile): 541 - if self.validate == False: 541 + if not self.validate: 542 542 return 543 543 544 544 try: ··· 948 948 parser = argparse.ArgumentParser() 949 949 parser.add_argument('--rnn', type=str, required=True) 950 950 parser.add_argument('--xml', type=str, required=True) 951 - parser.add_argument('--validate', action=argparse.BooleanOptionalAction) 951 + parser.add_argument('--validate', default=False, action='store_true') 952 + parser.add_argument('--no-validate', dest='validate', action='store_false') 952 953 953 954 subparsers = parser.add_subparsers() 954 955 subparsers.required = True
+18 -6
drivers/gpu/drm/nouveau/nvif/object.c
··· 142 142 struct nvif_ioctl_v0 ioctl; 143 143 struct nvif_ioctl_mthd_v0 mthd; 144 144 } *args; 145 + u32 args_size; 145 146 u8 stack[128]; 146 147 int ret; 147 148 148 - if (sizeof(*args) + size > sizeof(stack)) { 149 - if (!(args = kmalloc(sizeof(*args) + size, GFP_KERNEL))) 149 + if (check_add_overflow(sizeof(*args), size, &args_size)) 150 + return -ENOMEM; 151 + 152 + if (args_size > sizeof(stack)) { 153 + args = kmalloc(args_size, GFP_KERNEL); 154 + if (!args) 150 155 return -ENOMEM; 151 156 } else { 152 157 args = (void *)stack; ··· 162 157 args->mthd.method = mthd; 163 158 164 159 memcpy(args->mthd.data, data, size); 165 - ret = nvif_object_ioctl(object, args, sizeof(*args) + size, NULL); 160 + ret = nvif_object_ioctl(object, args, args_size, NULL); 166 161 memcpy(data, args->mthd.data, size); 167 162 if (args != (void *)stack) 168 163 kfree(args); ··· 281 276 object->map.size = 0; 282 277 283 278 if (parent) { 284 - if (!(args = kmalloc(sizeof(*args) + size, GFP_KERNEL))) { 279 + u32 args_size; 280 + 281 + if (check_add_overflow(sizeof(*args), size, &args_size)) { 282 + nvif_object_dtor(object); 283 + return -ENOMEM; 284 + } 285 + 286 + args = kmalloc(args_size, GFP_KERNEL); 287 + if (!args) { 285 288 nvif_object_dtor(object); 286 289 return -ENOMEM; 287 290 } ··· 306 293 args->new.oclass = oclass; 307 294 308 295 memcpy(args->new.data, data, size); 309 - ret = nvif_object_ioctl(parent, args, sizeof(*args) + size, 310 - &object->priv); 296 + ret = nvif_object_ioctl(parent, args, args_size, &object->priv); 311 297 memcpy(data, args->new.data, size); 312 298 kfree(args); 313 299 if (ret == 0)
+2
drivers/gpu/drm/panel/Kconfig
··· 340 340 depends on OF 341 341 depends on DRM_MIPI_DSI 342 342 depends on BACKLIGHT_CLASS_DEVICE 343 + select DRM_DISPLAY_DP_HELPER 344 + select DRM_DISPLAY_HELPER 343 345 help 344 346 Say Y here if you want to enable support for LG sw43408 panel. 345 347 The panel has a 1080x2160@60Hz resolution and uses 24 bit RGB per
+1 -1
drivers/gpu/drm/panel/panel-lg-sw43408.c
··· 182 182 return mipi_dsi_dcs_set_display_brightness_large(dsi, brightness); 183 183 } 184 184 185 - const struct backlight_ops sw43408_backlight_ops = { 185 + static const struct backlight_ops sw43408_backlight_ops = { 186 186 .update_status = sw43408_backlight_update_status, 187 187 }; 188 188
+8 -8
drivers/gpu/drm/panel/panel-sitronix-st7789v.c
··· 282 282 static const struct drm_display_mode jt240mhqs_hwt_ek_e3_mode = { 283 283 .clock = 6000, 284 284 .hdisplay = 240, 285 - .hsync_start = 240 + 28, 286 - .hsync_end = 240 + 28 + 10, 287 - .htotal = 240 + 28 + 10 + 10, 285 + .hsync_start = 240 + 38, 286 + .hsync_end = 240 + 38 + 10, 287 + .htotal = 240 + 38 + 10 + 10, 288 288 .vdisplay = 280, 289 - .vsync_start = 280 + 8, 290 - .vsync_end = 280 + 8 + 4, 291 - .vtotal = 280 + 8 + 4 + 4, 292 - .width_mm = 43, 293 - .height_mm = 37, 289 + .vsync_start = 280 + 48, 290 + .vsync_end = 280 + 48 + 4, 291 + .vtotal = 280 + 48 + 4 + 4, 292 + .width_mm = 37, 293 + .height_mm = 43, 294 294 .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC, 295 295 }; 296 296
+1 -1
drivers/gpu/drm/panfrost/panfrost_gem.c
··· 192 192 if (bo->is_heap) 193 193 return -EINVAL; 194 194 195 - return drm_gem_shmem_pin(&bo->base); 195 + return drm_gem_shmem_pin_locked(&bo->base); 196 196 } 197 197 198 198 static enum drm_gem_object_status panfrost_gem_status(struct drm_gem_object *obj)
+21 -21
drivers/gpu/drm/tests/drm_buddy_test.c
··· 505 505 * Eventually we will have a fully 50% fragmented mm. 506 506 */ 507 507 508 - mm_size = PAGE_SIZE << max_order; 509 - KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE), 508 + mm_size = SZ_4K << max_order; 509 + KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, SZ_4K), 510 510 "buddy_init failed\n"); 511 511 512 512 KUNIT_EXPECT_EQ(test, mm.max_order, max_order); ··· 520 520 } 521 521 522 522 for (order = top; order--;) { 523 - size = get_size(order, PAGE_SIZE); 523 + size = get_size(order, mm.chunk_size); 524 524 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, 525 525 mm_size, size, size, 526 526 &tmp, flags), ··· 534 534 } 535 535 536 536 /* There should be one final page for this sub-allocation */ 537 - size = get_size(0, PAGE_SIZE); 537 + size = get_size(0, mm.chunk_size); 538 538 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 539 539 size, size, &tmp, flags), 540 540 "buddy_alloc hit -ENOMEM for hole\n"); ··· 544 544 545 545 list_move_tail(&block->link, &holes); 546 546 547 - size = get_size(top, PAGE_SIZE); 547 + size = get_size(top, mm.chunk_size); 548 548 KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 549 549 size, size, &tmp, flags), 550 550 "buddy_alloc unexpectedly succeeded at top-order %d/%d, it should be full!", ··· 555 555 556 556 /* Nothing larger than blocks of chunk_size now available */ 557 557 for (order = 1; order <= max_order; order++) { 558 - size = get_size(order, PAGE_SIZE); 558 + size = get_size(order, mm.chunk_size); 559 559 KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 560 560 size, size, &tmp, flags), 561 561 "buddy_alloc unexpectedly succeeded at order %d, it should be full!", ··· 584 584 * page left. 585 585 */ 586 586 587 - mm_size = PAGE_SIZE << max_order; 588 - KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE), 587 + mm_size = SZ_4K << max_order; 588 + KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, SZ_4K), 589 589 "buddy_init failed\n"); 590 590 591 591 KUNIT_EXPECT_EQ(test, mm.max_order, max_order); 592 592 593 593 for (order = 0; order < max_order; order++) { 594 - size = get_size(order, PAGE_SIZE); 594 + size = get_size(order, mm.chunk_size); 595 595 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 596 596 size, size, &tmp, flags), 597 597 "buddy_alloc hit -ENOMEM with order=%d\n", ··· 604 604 } 605 605 606 606 /* And now the last remaining block available */ 607 - size = get_size(0, PAGE_SIZE); 607 + size = get_size(0, mm.chunk_size); 608 608 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 609 609 size, size, &tmp, flags), 610 610 "buddy_alloc hit -ENOMEM on final alloc\n"); ··· 616 616 617 617 /* Should be completely full! */ 618 618 for (order = max_order; order--;) { 619 - size = get_size(order, PAGE_SIZE); 619 + size = get_size(order, mm.chunk_size); 620 620 KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 621 621 size, size, &tmp, flags), 622 622 "buddy_alloc unexpectedly succeeded, it should be full!"); ··· 632 632 list_del(&block->link); 633 633 drm_buddy_free_block(&mm, block); 634 634 635 - size = get_size(order, PAGE_SIZE); 635 + size = get_size(order, mm.chunk_size); 636 636 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 637 637 size, size, &tmp, flags), 638 638 "buddy_alloc hit -ENOMEM with order=%d\n", ··· 647 647 } 648 648 649 649 /* To confirm, now the whole mm should be available */ 650 - size = get_size(max_order, PAGE_SIZE); 650 + size = get_size(max_order, mm.chunk_size); 651 651 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 652 652 size, size, &tmp, flags), 653 653 "buddy_alloc (realloc) hit -ENOMEM with order=%d\n", ··· 678 678 * try to allocate them all. 679 679 */ 680 680 681 - mm_size = PAGE_SIZE * ((1 << (max_order + 1)) - 1); 681 + mm_size = SZ_4K * ((1 << (max_order + 1)) - 1); 682 682 683 - KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE), 683 + KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, SZ_4K), 684 684 "buddy_init failed\n"); 685 685 686 686 KUNIT_EXPECT_EQ(test, mm.max_order, max_order); 687 687 688 688 for (order = 0; order <= max_order; order++) { 689 - size = get_size(order, PAGE_SIZE); 689 + size = get_size(order, mm.chunk_size); 690 690 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 691 691 size, size, &tmp, flags), 692 692 "buddy_alloc hit -ENOMEM with order=%d\n", ··· 699 699 } 700 700 701 701 /* Should be completely full! */ 702 - size = get_size(0, PAGE_SIZE); 702 + size = get_size(0, mm.chunk_size); 703 703 KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 704 704 size, size, &tmp, flags), 705 705 "buddy_alloc unexpectedly succeeded, it should be full!"); ··· 716 716 LIST_HEAD(allocated); 717 717 struct drm_buddy mm; 718 718 719 - KUNIT_EXPECT_FALSE(test, drm_buddy_init(&mm, size, PAGE_SIZE)); 719 + KUNIT_EXPECT_FALSE(test, drm_buddy_init(&mm, size, SZ_4K)); 720 720 721 721 KUNIT_EXPECT_EQ_MSG(test, mm.max_order, DRM_BUDDY_MAX_ORDER, 722 722 "mm.max_order(%d) != %d\n", mm.max_order, ··· 724 724 725 725 size = mm.chunk_size << mm.max_order; 726 726 KUNIT_EXPECT_FALSE(test, drm_buddy_alloc_blocks(&mm, start, size, size, 727 - PAGE_SIZE, &allocated, flags)); 727 + mm.chunk_size, &allocated, flags)); 728 728 729 729 block = list_first_entry_or_null(&allocated, struct drm_buddy_block, link); 730 730 KUNIT_EXPECT_TRUE(test, block); ··· 734 734 drm_buddy_block_order(block), mm.max_order); 735 735 736 736 KUNIT_EXPECT_EQ_MSG(test, drm_buddy_block_size(&mm, block), 737 - BIT_ULL(mm.max_order) * PAGE_SIZE, 737 + BIT_ULL(mm.max_order) * mm.chunk_size, 738 738 "block size(%llu) != %llu\n", 739 739 drm_buddy_block_size(&mm, block), 740 - BIT_ULL(mm.max_order) * PAGE_SIZE); 740 + BIT_ULL(mm.max_order) * mm.chunk_size); 741 741 742 742 drm_buddy_free_list(&mm, &allocated, 0); 743 743 drm_buddy_fini(&mm);
+1
drivers/gpu/drm/xe/xe_guc_submit.c
··· 1240 1240 return 0; 1241 1241 1242 1242 err_entity: 1243 + mutex_unlock(&guc->submission_state.lock); 1243 1244 xe_sched_entity_fini(&ge->entity); 1244 1245 err_sched: 1245 1246 xe_sched_fini(&ge->sched);
+5 -7
drivers/gpu/drm/xe/xe_migrate.c
··· 34 34 #include "xe_sync.h" 35 35 #include "xe_trace.h" 36 36 #include "xe_vm.h" 37 - #include "xe_wa.h" 38 37 39 38 /** 40 39 * struct xe_migrate - migrate context. ··· 299 300 } 300 301 301 302 /* 302 - * Due to workaround 16017236439, odd instance hardware copy engines are 303 - * faster than even instance ones. 304 - * This function returns the mask involving all fast copy engines and the 305 - * reserved copy engine to be used as logical mask for migrate engine. 306 303 * Including the reserved copy engine is required to avoid deadlocks due to 307 304 * migrate jobs servicing the faults gets stuck behind the job that faulted. 308 305 */ ··· 312 317 if (hwe->class != XE_ENGINE_CLASS_COPY) 313 318 continue; 314 319 315 - if (!XE_WA(gt, 16017236439) || 316 - xe_gt_is_usm_hwe(gt, hwe) || hwe->instance & 1) 320 + if (xe_gt_is_usm_hwe(gt, hwe)) 317 321 logical_mask |= BIT(hwe->logical_instance); 318 322 } 319 323 ··· 363 369 if (!hwe || !logical_mask) 364 370 return ERR_PTR(-EINVAL); 365 371 372 + /* 373 + * XXX: Currently only reserving 1 (likely slow) BCS instance on 374 + * PVC, may want to revisit if performance is needed. 375 + */ 366 376 m->q = xe_exec_queue_create(xe, vm, logical_mask, 1, hwe, 367 377 EXEC_QUEUE_FLAG_KERNEL | 368 378 EXEC_QUEUE_FLAG_PERMANENT |
+1 -1
drivers/gpu/drm/xe/xe_pcode.c
··· 191 191 drm_WARN_ON_ONCE(&gt_to_xe(gt)->drm, timeout_base_ms > 1); 192 192 preempt_disable(); 193 193 ret = pcode_try_request(gt, mbox, request, reply_mask, reply, &status, 194 - true, timeout_base_ms * 1000, true); 194 + true, 50 * 1000, true); 195 195 preempt_enable(); 196 196 197 197 out:
+8
drivers/hwmon/dell-smm-hwmon.c
··· 1545 1545 }, 1546 1546 .driver_data = (void *)&i8k_fan_control_data[I8K_FAN_30A3_31A3], 1547 1547 }, 1548 + { 1549 + .ident = "Dell G15 5511", 1550 + .matches = { 1551 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1552 + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Dell G15 5511"), 1553 + }, 1554 + .driver_data = (void *)&i8k_fan_control_data[I8K_FAN_30A3_31A3], 1555 + }, 1548 1556 { } 1549 1557 }; 1550 1558
+1 -1
drivers/hwmon/intel-m10-bmc-hwmon.c
··· 429 429 }; 430 430 431 431 static const struct m10bmc_sdata n6000bmc_power_tbl[] = { 432 - { 0x724, 0x0, 0x0, 0x0, 0x0, 1, "Board Power" }, 432 + { 0x724, 0x0, 0x0, 0x0, 0x0, 1000, "Board Power" }, 433 433 }; 434 434 435 435 static const struct hwmon_channel_info * const n6000bmc_hinfo[] = {
+3 -1
drivers/hwmon/ltc2992.c
··· 876 876 877 877 ret = fwnode_property_read_u32(child, "shunt-resistor-micro-ohms", &val); 878 878 if (!ret) { 879 - if (!val) 879 + if (!val) { 880 + fwnode_handle_put(child); 880 881 return dev_err_probe(&st->client->dev, -EINVAL, 881 882 "shunt resistor value cannot be zero\n"); 883 + } 882 884 st->r_sense_uohm[addr] = val; 883 885 } 884 886 }
+1 -1
drivers/hwmon/shtc1.c
··· 238 238 239 239 if (np) { 240 240 data->setup.blocking_io = of_property_read_bool(np, "sensirion,blocking-io"); 241 - data->setup.high_precision = !of_property_read_bool(np, "sensicon,low-precision"); 241 + data->setup.high_precision = !of_property_read_bool(np, "sensirion,low-precision"); 242 242 } else { 243 243 if (client->dev.platform_data) 244 244 data->setup = *(struct shtc1_platform_data *)dev->platform_data;
+5 -6
drivers/i2c/busses/i2c-synquacer.c
··· 138 138 int irq; 139 139 struct device *dev; 140 140 void __iomem *base; 141 - struct clk *pclk; 142 141 u32 pclkrate; 143 142 u32 speed_khz; 144 143 u32 timeout_ms; ··· 534 535 static int synquacer_i2c_probe(struct platform_device *pdev) 535 536 { 536 537 struct synquacer_i2c *i2c; 538 + struct clk *pclk; 537 539 u32 bus_speed; 538 540 int ret; 539 541 ··· 550 550 device_property_read_u32(&pdev->dev, "socionext,pclk-rate", 551 551 &i2c->pclkrate); 552 552 553 - i2c->pclk = devm_clk_get_enabled(&pdev->dev, "pclk"); 554 - if (IS_ERR(i2c->pclk)) 555 - return dev_err_probe(&pdev->dev, PTR_ERR(i2c->pclk), 553 + pclk = devm_clk_get_enabled(&pdev->dev, "pclk"); 554 + if (IS_ERR(pclk)) 555 + return dev_err_probe(&pdev->dev, PTR_ERR(pclk), 556 556 "failed to get and enable clock\n"); 557 557 558 - dev_dbg(&pdev->dev, "clock source %p\n", i2c->pclk); 559 - i2c->pclkrate = clk_get_rate(i2c->pclk); 558 + i2c->pclkrate = clk_get_rate(pclk); 560 559 561 560 if (i2c->pclkrate < SYNQUACER_I2C_MIN_CLK_RATE || 562 561 i2c->pclkrate > SYNQUACER_I2C_MAX_CLK_RATE)
-1
drivers/mailbox/zynqmp-ipi-mailbox.c
··· 850 850 return ret; 851 851 } 852 852 853 - irq_to_desc(pdata->virq_sgi); 854 853 irq_set_status_flags(pdata->virq_sgi, IRQ_PER_CPU); 855 854 856 855 /* Setup function for the CPU hot-plug cases */
+7 -14
drivers/md/bcache/alloc.c
··· 129 129 130 130 bool bch_can_invalidate_bucket(struct cache *ca, struct bucket *b) 131 131 { 132 - BUG_ON(!ca->set->gc_mark_valid); 133 - 134 - return (!GC_MARK(b) || 135 - GC_MARK(b) == GC_MARK_RECLAIMABLE) && 136 - !atomic_read(&b->pin) && 137 - can_inc_bucket_gen(b); 132 + return (ca->set->gc_mark_valid || b->reclaimable_in_gc) && 133 + ((!GC_MARK(b) || GC_MARK(b) == GC_MARK_RECLAIMABLE) && 134 + !atomic_read(&b->pin) && can_inc_bucket_gen(b)); 138 135 } 139 136 140 137 void __bch_invalidate_one_bucket(struct cache *ca, struct bucket *b) ··· 145 148 bch_inc_gen(ca, b); 146 149 b->prio = INITIAL_PRIO; 147 150 atomic_inc(&b->pin); 151 + b->reclaimable_in_gc = 0; 148 152 } 149 153 150 154 static void bch_invalidate_one_bucket(struct cache *ca, struct bucket *b) ··· 350 352 */ 351 353 352 354 retry_invalidate: 353 - allocator_wait(ca, ca->set->gc_mark_valid && 354 - !ca->invalidate_needs_gc); 355 + allocator_wait(ca, !ca->invalidate_needs_gc); 355 356 invalidate_buckets(ca); 356 357 357 358 /* ··· 498 501 499 502 ca = c->cache; 500 503 b = bch_bucket_alloc(ca, reserve, wait); 501 - if (b == -1) 502 - goto err; 504 + if (b < 0) 505 + return -1; 503 506 504 507 k->ptr[0] = MAKE_PTR(ca->buckets[b].gen, 505 508 bucket_to_sector(c, b), ··· 508 511 SET_KEY_PTRS(k, 1); 509 512 510 513 return 0; 511 - err: 512 - bch_bucket_free(c, k); 513 - bkey_put(c, k); 514 - return -1; 515 514 } 516 515 517 516 int bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve,
+1
drivers/md/bcache/bcache.h
··· 200 200 uint8_t gen; 201 201 uint8_t last_gc; /* Most out of date gen in the btree */ 202 202 uint16_t gc_mark; /* Bitfield used by GC. See below for field */ 203 + uint16_t reclaimable_in_gc:1; 203 204 }; 204 205 205 206 /*
+6 -1
drivers/md/bcache/btree.c
··· 1741 1741 1742 1742 mutex_lock(&c->bucket_lock); 1743 1743 1744 - c->gc_mark_valid = 0; 1745 1744 c->gc_done = ZERO_KEY; 1746 1745 1747 1746 ca = c->cache; 1748 1747 for_each_bucket(b, ca) { 1749 1748 b->last_gc = b->gen; 1749 + if (bch_can_invalidate_bucket(ca, b)) 1750 + b->reclaimable_in_gc = 1; 1750 1751 if (!atomic_read(&b->pin)) { 1751 1752 SET_GC_MARK(b, 0); 1752 1753 SET_GC_SECTORS_USED(b, 0); 1753 1754 } 1754 1755 } 1755 1756 1757 + c->gc_mark_valid = 0; 1756 1758 mutex_unlock(&c->bucket_lock); 1757 1759 } 1758 1760 ··· 1810 1808 1811 1809 for_each_bucket(b, ca) { 1812 1810 c->need_gc = max(c->need_gc, bucket_gc_gen(b)); 1811 + 1812 + if (b->reclaimable_in_gc) 1813 + b->reclaimable_in_gc = 0; 1813 1814 1814 1815 if (atomic_read(&b->pin)) 1815 1816 continue;
+15 -1
drivers/md/bcache/request.c
··· 369 369 struct io *i; 370 370 371 371 if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) || 372 - c->gc_stats.in_use > CUTOFF_CACHE_ADD || 373 372 (bio_op(bio) == REQ_OP_DISCARD)) 374 373 goto skip; 374 + 375 + if (c->gc_stats.in_use > CUTOFF_CACHE_ADD) { 376 + /* 377 + * If cached buckets are all clean now, 'true' will be 378 + * returned and all requests will bypass the cache device. 379 + * Then c->sectors_to_gc has no chance to be negative, and 380 + * gc thread won't wake up and caching won't work forever. 381 + * Here call force_wake_up_gc() to avoid such aftermath. 382 + */ 383 + if (BDEV_STATE(&dc->sb) == BDEV_STATE_CLEAN && 384 + c->gc_mark_valid) 385 + force_wake_up_gc(c); 386 + 387 + goto skip; 388 + } 375 389 376 390 if (mode == CACHE_MODE_NONE || 377 391 (mode == CACHE_MODE_WRITEAROUND &&
+6 -9
drivers/md/dm-table.c
··· 1981 1981 if (!dm_table_supports_secure_erase(t)) 1982 1982 limits->max_secure_erase_sectors = 0; 1983 1983 1984 - r = queue_limits_set(q, limits); 1985 - if (r) 1986 - return r; 1987 - 1988 1984 if (dm_table_supports_flush(t, (1UL << QUEUE_FLAG_WC))) { 1989 1985 wc = true; 1990 1986 if (dm_table_supports_flush(t, (1UL << QUEUE_FLAG_FUA))) ··· 2032 2036 * For a zoned target, setup the zones related queue attributes 2033 2037 * and resources necessary for zone append emulation if necessary. 2034 2038 */ 2035 - if (blk_queue_is_zoned(q)) { 2036 - r = dm_set_zones_restrictions(t, q); 2039 + if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && limits->zoned) { 2040 + r = dm_set_zones_restrictions(t, q, limits); 2037 2041 if (r) 2038 2042 return r; 2039 - if (blk_queue_is_zoned(q) && 2040 - !static_key_enabled(&zoned_enabled.key)) 2041 - static_branch_enable(&zoned_enabled); 2042 2043 } 2044 + 2045 + r = queue_limits_set(q, limits); 2046 + if (r) 2047 + return r; 2043 2048 2044 2049 dm_update_crypto_profile(q, t); 2045 2050
+33 -39
drivers/md/dm-zone.c
··· 160 160 return 0; 161 161 } 162 162 163 - static int dm_check_zoned(struct mapped_device *md, struct dm_table *t) 164 - { 165 - struct gendisk *disk = md->disk; 166 - unsigned int nr_conv_zones = 0; 167 - int ret; 168 - 169 - /* Count conventional zones */ 170 - md->zone_revalidate_map = t; 171 - ret = dm_blk_report_zones(disk, 0, UINT_MAX, 172 - dm_check_zoned_cb, &nr_conv_zones); 173 - md->zone_revalidate_map = NULL; 174 - if (ret < 0) { 175 - DMERR("Check zoned failed %d", ret); 176 - return ret; 177 - } 178 - 179 - /* 180 - * If we only have conventional zones, expose the mapped device as 181 - * a regular device. 182 - */ 183 - if (nr_conv_zones >= ret) { 184 - disk->queue->limits.max_open_zones = 0; 185 - disk->queue->limits.max_active_zones = 0; 186 - disk->queue->limits.zoned = false; 187 - clear_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 188 - disk->nr_zones = 0; 189 - } 190 - 191 - return 0; 192 - } 193 - 194 163 /* 195 164 * Revalidate the zones of a mapped device to initialize resource necessary 196 165 * for zone append emulation. Note that we cannot simply use the block layer ··· 220 251 return true; 221 252 } 222 253 223 - int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q) 254 + int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q, 255 + struct queue_limits *lim) 224 256 { 225 257 struct mapped_device *md = t->md; 258 + struct gendisk *disk = md->disk; 259 + unsigned int nr_conv_zones = 0; 226 260 int ret; 227 261 228 262 /* ··· 237 265 clear_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 238 266 } else { 239 267 set_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 240 - blk_queue_max_zone_append_sectors(q, 0); 268 + lim->max_zone_append_sectors = 0; 241 269 } 242 270 243 271 if (!get_capacity(md->disk)) 244 272 return 0; 245 273 246 274 /* 247 - * Check that the mapped device will indeed be zoned, that is, that it 248 - * has sequential write required zones. 275 + * Count conventional zones to check that the mapped device will indeed 276 + * have sequential write required zones. 249 277 */ 250 - ret = dm_check_zoned(md, t); 251 - if (ret) 278 + md->zone_revalidate_map = t; 279 + ret = dm_blk_report_zones(disk, 0, UINT_MAX, 280 + dm_check_zoned_cb, &nr_conv_zones); 281 + md->zone_revalidate_map = NULL; 282 + if (ret < 0) { 283 + DMERR("Check zoned failed %d", ret); 252 284 return ret; 253 - if (!blk_queue_is_zoned(q)) 285 + } 286 + 287 + /* 288 + * If we only have conventional zones, expose the mapped device as 289 + * a regular device. 290 + */ 291 + if (nr_conv_zones >= ret) { 292 + lim->max_open_zones = 0; 293 + lim->max_active_zones = 0; 294 + lim->zoned = false; 295 + clear_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 296 + disk->nr_zones = 0; 254 297 return 0; 298 + } 255 299 256 300 if (!md->disk->nr_zones) { 257 301 DMINFO("%s using %s zone append", ··· 275 287 queue_emulates_zone_append(q) ? "emulated" : "native"); 276 288 } 277 289 278 - return dm_revalidate_zones(md, t); 290 + ret = dm_revalidate_zones(md, t); 291 + if (ret < 0) 292 + return ret; 293 + 294 + if (!static_key_enabled(&zoned_enabled.key)) 295 + static_branch_enable(&zoned_enabled); 296 + return 0; 279 297 } 280 298 281 299 /*
+2 -1
drivers/md/dm.h
··· 101 101 /* 102 102 * Zoned targets related functions. 103 103 */ 104 - int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q); 104 + int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q, 105 + struct queue_limits *lim); 105 106 void dm_zone_endio(struct dm_io *io, struct bio *clone); 106 107 #ifdef CONFIG_BLK_DEV_ZONED 107 108 int dm_blk_report_zones(struct gendisk *disk, sector_t sector,
+31 -13
drivers/net/ethernet/intel/ice/ice.h
··· 409 409 struct ice_tc_cfg tc_cfg; 410 410 struct bpf_prog *xdp_prog; 411 411 struct ice_tx_ring **xdp_rings; /* XDP ring array */ 412 - unsigned long *af_xdp_zc_qps; /* tracks AF_XDP ZC enabled qps */ 413 412 u16 num_xdp_txq; /* Used XDP queues */ 414 413 u8 xdp_mapping_mode; /* ICE_MAP_MODE_[CONTIG|SCATTER] */ 415 414 ··· 746 747 } 747 748 748 749 /** 750 + * ice_get_xp_from_qid - get ZC XSK buffer pool bound to a queue ID 751 + * @vsi: pointer to VSI 752 + * @qid: index of a queue to look at XSK buff pool presence 753 + * 754 + * Return: A pointer to xsk_buff_pool structure if there is a buffer pool 755 + * attached and configured as zero-copy, NULL otherwise. 756 + */ 757 + static inline struct xsk_buff_pool *ice_get_xp_from_qid(struct ice_vsi *vsi, 758 + u16 qid) 759 + { 760 + struct xsk_buff_pool *pool = xsk_get_pool_from_qid(vsi->netdev, qid); 761 + 762 + if (!ice_is_xdp_ena_vsi(vsi)) 763 + return NULL; 764 + 765 + return (pool && pool->dev) ? pool : NULL; 766 + } 767 + 768 + /** 749 769 * ice_xsk_pool - get XSK buffer pool bound to a ring 750 770 * @ring: Rx ring to use 751 771 * ··· 776 758 struct ice_vsi *vsi = ring->vsi; 777 759 u16 qid = ring->q_index; 778 760 779 - if (!ice_is_xdp_ena_vsi(vsi) || !test_bit(qid, vsi->af_xdp_zc_qps)) 780 - return NULL; 781 - 782 - return xsk_get_pool_from_qid(vsi->netdev, qid); 761 + return ice_get_xp_from_qid(vsi, qid); 783 762 } 784 763 785 764 /** ··· 801 786 if (!ring) 802 787 return; 803 788 804 - if (!ice_is_xdp_ena_vsi(vsi) || !test_bit(qid, vsi->af_xdp_zc_qps)) { 805 - ring->xsk_pool = NULL; 806 - return; 807 - } 808 - 809 - ring->xsk_pool = xsk_get_pool_from_qid(vsi->netdev, qid); 789 + ring->xsk_pool = ice_get_xp_from_qid(vsi, qid); 810 790 } 811 791 812 792 /** ··· 930 920 int ice_down_up(struct ice_vsi *vsi); 931 921 int ice_vsi_cfg_lan(struct ice_vsi *vsi); 932 922 struct ice_vsi *ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi); 923 + 924 + enum ice_xdp_cfg { 925 + ICE_XDP_CFG_FULL, /* Fully apply new config in .ndo_bpf() */ 926 + ICE_XDP_CFG_PART, /* Save/use part of config in VSI rebuild */ 927 + }; 928 + 933 929 int ice_vsi_determine_xdp_res(struct ice_vsi *vsi); 934 - int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog); 935 - int ice_destroy_xdp_rings(struct ice_vsi *vsi); 930 + int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog, 931 + enum ice_xdp_cfg cfg_type); 932 + int ice_destroy_xdp_rings(struct ice_vsi *vsi, enum ice_xdp_cfg cfg_type); 933 + void ice_map_xdp_rings(struct ice_vsi *vsi); 936 934 int 937 935 ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, 938 936 u32 flags);
+3
drivers/net/ethernet/intel/ice/ice_base.c
··· 842 842 } 843 843 rx_rings_rem -= rx_rings_per_v; 844 844 } 845 + 846 + if (ice_is_xdp_ena_vsi(vsi)) 847 + ice_map_xdp_rings(vsi); 845 848 } 846 849 847 850 /**
+11 -18
drivers/net/ethernet/intel/ice/ice_lib.c
··· 114 114 if (!vsi->q_vectors) 115 115 goto err_vectors; 116 116 117 - vsi->af_xdp_zc_qps = bitmap_zalloc(max_t(int, vsi->alloc_txq, vsi->alloc_rxq), GFP_KERNEL); 118 - if (!vsi->af_xdp_zc_qps) 119 - goto err_zc_qps; 120 - 121 117 return 0; 122 118 123 - err_zc_qps: 124 - devm_kfree(dev, vsi->q_vectors); 125 119 err_vectors: 126 120 devm_kfree(dev, vsi->rxq_map); 127 121 err_rxq_map: ··· 303 309 304 310 dev = ice_pf_to_dev(pf); 305 311 306 - bitmap_free(vsi->af_xdp_zc_qps); 307 - vsi->af_xdp_zc_qps = NULL; 308 312 /* free the ring and vector containers */ 309 313 devm_kfree(dev, vsi->q_vectors); 310 314 vsi->q_vectors = NULL; ··· 2274 2282 if (ret) 2275 2283 goto unroll_vector_base; 2276 2284 2285 + if (ice_is_xdp_ena_vsi(vsi)) { 2286 + ret = ice_vsi_determine_xdp_res(vsi); 2287 + if (ret) 2288 + goto unroll_vector_base; 2289 + ret = ice_prepare_xdp_rings(vsi, vsi->xdp_prog, 2290 + ICE_XDP_CFG_PART); 2291 + if (ret) 2292 + goto unroll_vector_base; 2293 + } 2294 + 2277 2295 ice_vsi_map_rings_to_vectors(vsi); 2278 2296 2279 2297 /* Associate q_vector rings to napi */ 2280 2298 ice_vsi_set_napi_queues(vsi); 2281 2299 2282 2300 vsi->stat_offsets_loaded = false; 2283 - 2284 - if (ice_is_xdp_ena_vsi(vsi)) { 2285 - ret = ice_vsi_determine_xdp_res(vsi); 2286 - if (ret) 2287 - goto unroll_vector_base; 2288 - ret = ice_prepare_xdp_rings(vsi, vsi->xdp_prog); 2289 - if (ret) 2290 - goto unroll_vector_base; 2291 - } 2292 2301 2293 2302 /* ICE_VSI_CTRL does not need RSS so skip RSS processing */ 2294 2303 if (vsi->type != ICE_VSI_CTRL) ··· 2430 2437 /* return value check can be skipped here, it always returns 2431 2438 * 0 if reset is in progress 2432 2439 */ 2433 - ice_destroy_xdp_rings(vsi); 2440 + ice_destroy_xdp_rings(vsi, ICE_XDP_CFG_PART); 2434 2441 2435 2442 ice_vsi_clear_rings(vsi); 2436 2443 ice_vsi_free_q_vectors(vsi);
+82 -62
drivers/net/ethernet/intel/ice/ice_main.c
··· 2707 2707 bpf_prog_put(old_prog); 2708 2708 } 2709 2709 2710 - /** 2711 - * ice_prepare_xdp_rings - Allocate, configure and setup Tx rings for XDP 2712 - * @vsi: VSI to bring up Tx rings used by XDP 2713 - * @prog: bpf program that will be assigned to VSI 2714 - * 2715 - * Return 0 on success and negative value on error 2716 - */ 2717 - int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog) 2710 + static struct ice_tx_ring *ice_xdp_ring_from_qid(struct ice_vsi *vsi, int qid) 2718 2711 { 2719 - u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 }; 2720 - int xdp_rings_rem = vsi->num_xdp_txq; 2721 - struct ice_pf *pf = vsi->back; 2722 - struct ice_qs_cfg xdp_qs_cfg = { 2723 - .qs_mutex = &pf->avail_q_mutex, 2724 - .pf_map = pf->avail_txqs, 2725 - .pf_map_size = pf->max_pf_txqs, 2726 - .q_count = vsi->num_xdp_txq, 2727 - .scatter_count = ICE_MAX_SCATTER_TXQS, 2728 - .vsi_map = vsi->txq_map, 2729 - .vsi_map_offset = vsi->alloc_txq, 2730 - .mapping_mode = ICE_VSI_MAP_CONTIG 2731 - }; 2732 - struct device *dev; 2733 - int i, v_idx; 2734 - int status; 2735 - 2736 - dev = ice_pf_to_dev(pf); 2737 - vsi->xdp_rings = devm_kcalloc(dev, vsi->num_xdp_txq, 2738 - sizeof(*vsi->xdp_rings), GFP_KERNEL); 2739 - if (!vsi->xdp_rings) 2740 - return -ENOMEM; 2741 - 2742 - vsi->xdp_mapping_mode = xdp_qs_cfg.mapping_mode; 2743 - if (__ice_vsi_get_qs(&xdp_qs_cfg)) 2744 - goto err_map_xdp; 2712 + struct ice_q_vector *q_vector; 2713 + struct ice_tx_ring *ring; 2745 2714 2746 2715 if (static_key_enabled(&ice_xdp_locking_key)) 2747 - netdev_warn(vsi->netdev, 2748 - "Could not allocate one XDP Tx ring per CPU, XDP_TX/XDP_REDIRECT actions will be slower\n"); 2716 + return vsi->xdp_rings[qid % vsi->num_xdp_txq]; 2749 2717 2750 - if (ice_xdp_alloc_setup_rings(vsi)) 2751 - goto clear_xdp_rings; 2718 + q_vector = vsi->rx_rings[qid]->q_vector; 2719 + ice_for_each_tx_ring(ring, q_vector->tx) 2720 + if (ice_ring_is_xdp(ring)) 2721 + return ring; 2722 + 2723 + return NULL; 2724 + } 2725 + 2726 + /** 2727 + * ice_map_xdp_rings - Map XDP rings to interrupt vectors 2728 + * @vsi: the VSI with XDP rings being configured 2729 + * 2730 + * Map XDP rings to interrupt vectors and perform the configuration steps 2731 + * dependent on the mapping. 2732 + */ 2733 + void ice_map_xdp_rings(struct ice_vsi *vsi) 2734 + { 2735 + int xdp_rings_rem = vsi->num_xdp_txq; 2736 + int v_idx, q_idx; 2752 2737 2753 2738 /* follow the logic from ice_vsi_map_rings_to_vectors */ 2754 2739 ice_for_each_q_vector(vsi, v_idx) { ··· 2754 2769 xdp_rings_rem -= xdp_rings_per_v; 2755 2770 } 2756 2771 2757 - ice_for_each_rxq(vsi, i) { 2758 - if (static_key_enabled(&ice_xdp_locking_key)) { 2759 - vsi->rx_rings[i]->xdp_ring = vsi->xdp_rings[i % vsi->num_xdp_txq]; 2760 - } else { 2761 - struct ice_q_vector *q_vector = vsi->rx_rings[i]->q_vector; 2762 - struct ice_tx_ring *ring; 2763 - 2764 - ice_for_each_tx_ring(ring, q_vector->tx) { 2765 - if (ice_ring_is_xdp(ring)) { 2766 - vsi->rx_rings[i]->xdp_ring = ring; 2767 - break; 2768 - } 2769 - } 2770 - } 2771 - ice_tx_xsk_pool(vsi, i); 2772 + ice_for_each_rxq(vsi, q_idx) { 2773 + vsi->rx_rings[q_idx]->xdp_ring = ice_xdp_ring_from_qid(vsi, 2774 + q_idx); 2775 + ice_tx_xsk_pool(vsi, q_idx); 2772 2776 } 2777 + } 2778 + 2779 + /** 2780 + * ice_prepare_xdp_rings - Allocate, configure and setup Tx rings for XDP 2781 + * @vsi: VSI to bring up Tx rings used by XDP 2782 + * @prog: bpf program that will be assigned to VSI 2783 + * @cfg_type: create from scratch or restore the existing configuration 2784 + * 2785 + * Return 0 on success and negative value on error 2786 + */ 2787 + int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog, 2788 + enum ice_xdp_cfg cfg_type) 2789 + { 2790 + u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 }; 2791 + struct ice_pf *pf = vsi->back; 2792 + struct ice_qs_cfg xdp_qs_cfg = { 2793 + .qs_mutex = &pf->avail_q_mutex, 2794 + .pf_map = pf->avail_txqs, 2795 + .pf_map_size = pf->max_pf_txqs, 2796 + .q_count = vsi->num_xdp_txq, 2797 + .scatter_count = ICE_MAX_SCATTER_TXQS, 2798 + .vsi_map = vsi->txq_map, 2799 + .vsi_map_offset = vsi->alloc_txq, 2800 + .mapping_mode = ICE_VSI_MAP_CONTIG 2801 + }; 2802 + struct device *dev; 2803 + int status, i; 2804 + 2805 + dev = ice_pf_to_dev(pf); 2806 + vsi->xdp_rings = devm_kcalloc(dev, vsi->num_xdp_txq, 2807 + sizeof(*vsi->xdp_rings), GFP_KERNEL); 2808 + if (!vsi->xdp_rings) 2809 + return -ENOMEM; 2810 + 2811 + vsi->xdp_mapping_mode = xdp_qs_cfg.mapping_mode; 2812 + if (__ice_vsi_get_qs(&xdp_qs_cfg)) 2813 + goto err_map_xdp; 2814 + 2815 + if (static_key_enabled(&ice_xdp_locking_key)) 2816 + netdev_warn(vsi->netdev, 2817 + "Could not allocate one XDP Tx ring per CPU, XDP_TX/XDP_REDIRECT actions will be slower\n"); 2818 + 2819 + if (ice_xdp_alloc_setup_rings(vsi)) 2820 + goto clear_xdp_rings; 2773 2821 2774 2822 /* omit the scheduler update if in reset path; XDP queues will be 2775 2823 * taken into account at the end of ice_vsi_rebuild, where 2776 2824 * ice_cfg_vsi_lan is being called 2777 2825 */ 2778 - if (ice_is_reset_in_progress(pf->state)) 2826 + if (cfg_type == ICE_XDP_CFG_PART) 2779 2827 return 0; 2828 + 2829 + ice_map_xdp_rings(vsi); 2780 2830 2781 2831 /* tell the Tx scheduler that right now we have 2782 2832 * additional queues ··· 2862 2842 /** 2863 2843 * ice_destroy_xdp_rings - undo the configuration made by ice_prepare_xdp_rings 2864 2844 * @vsi: VSI to remove XDP rings 2845 + * @cfg_type: disable XDP permanently or allow it to be restored later 2865 2846 * 2866 2847 * Detach XDP rings from irq vectors, clean up the PF bitmap and free 2867 2848 * resources 2868 2849 */ 2869 - int ice_destroy_xdp_rings(struct ice_vsi *vsi) 2850 + int ice_destroy_xdp_rings(struct ice_vsi *vsi, enum ice_xdp_cfg cfg_type) 2870 2851 { 2871 2852 u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 }; 2872 2853 struct ice_pf *pf = vsi->back; 2873 2854 int i, v_idx; 2874 2855 2875 2856 /* q_vectors are freed in reset path so there's no point in detaching 2876 - * rings; in case of rebuild being triggered not from reset bits 2877 - * in pf->state won't be set, so additionally check first q_vector 2878 - * against NULL 2857 + * rings 2879 2858 */ 2880 - if (ice_is_reset_in_progress(pf->state) || !vsi->q_vectors[0]) 2859 + if (cfg_type == ICE_XDP_CFG_PART) 2881 2860 goto free_qmap; 2882 2861 2883 2862 ice_for_each_q_vector(vsi, v_idx) { ··· 2917 2898 if (static_key_enabled(&ice_xdp_locking_key)) 2918 2899 static_branch_dec(&ice_xdp_locking_key); 2919 2900 2920 - if (ice_is_reset_in_progress(pf->state) || !vsi->q_vectors[0]) 2901 + if (cfg_type == ICE_XDP_CFG_PART) 2921 2902 return 0; 2922 2903 2923 2904 ice_vsi_assign_bpf_prog(vsi, NULL); ··· 3028 3009 if (xdp_ring_err) { 3029 3010 NL_SET_ERR_MSG_MOD(extack, "Not enough Tx resources for XDP"); 3030 3011 } else { 3031 - xdp_ring_err = ice_prepare_xdp_rings(vsi, prog); 3012 + xdp_ring_err = ice_prepare_xdp_rings(vsi, prog, 3013 + ICE_XDP_CFG_FULL); 3032 3014 if (xdp_ring_err) 3033 3015 NL_SET_ERR_MSG_MOD(extack, "Setting up XDP Tx resources failed"); 3034 3016 } ··· 3040 3020 NL_SET_ERR_MSG_MOD(extack, "Setting up XDP Rx resources failed"); 3041 3021 } else if (ice_is_xdp_ena_vsi(vsi) && !prog) { 3042 3022 xdp_features_clear_redirect_target(vsi->netdev); 3043 - xdp_ring_err = ice_destroy_xdp_rings(vsi); 3023 + xdp_ring_err = ice_destroy_xdp_rings(vsi, ICE_XDP_CFG_FULL); 3044 3024 if (xdp_ring_err) 3045 3025 NL_SET_ERR_MSG_MOD(extack, "Freeing XDP Tx resources failed"); 3046 3026 /* reallocate Rx queues that were used for zero-copy */
+108 -8
drivers/net/ethernet/intel/ice/ice_nvm.c
··· 374 374 * 375 375 * Read the specified word from the copy of the Shadow RAM found in the 376 376 * specified NVM module. 377 + * 378 + * Note that the Shadow RAM copy is always located after the CSS header, and 379 + * is aligned to 64-byte (32-word) offsets. 377 380 */ 378 381 static int 379 382 ice_read_nvm_sr_copy(struct ice_hw *hw, enum ice_bank_select bank, u32 offset, u16 *data) 380 383 { 381 - return ice_read_nvm_module(hw, bank, ICE_NVM_SR_COPY_WORD_OFFSET + offset, data); 384 + u32 sr_copy; 385 + 386 + switch (bank) { 387 + case ICE_ACTIVE_FLASH_BANK: 388 + sr_copy = roundup(hw->flash.banks.active_css_hdr_len, 32); 389 + break; 390 + case ICE_INACTIVE_FLASH_BANK: 391 + sr_copy = roundup(hw->flash.banks.inactive_css_hdr_len, 32); 392 + break; 393 + } 394 + 395 + return ice_read_nvm_module(hw, bank, sr_copy + offset, data); 382 396 } 383 397 384 398 /** ··· 454 440 ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len, 455 441 u16 module_type) 456 442 { 457 - u16 pfa_len, pfa_ptr; 458 - u16 next_tlv; 443 + u16 pfa_len, pfa_ptr, next_tlv, max_tlv; 459 444 int status; 460 445 461 446 status = ice_read_sr_word(hw, ICE_SR_PFA_PTR, &pfa_ptr); ··· 467 454 ice_debug(hw, ICE_DBG_INIT, "Failed to read PFA length.\n"); 468 455 return status; 469 456 } 457 + 458 + /* The Preserved Fields Area contains a sequence of Type-Length-Value 459 + * structures which define its contents. The PFA length includes all 460 + * of the TLVs, plus the initial length word itself, *and* one final 461 + * word at the end after all of the TLVs. 462 + */ 463 + if (check_add_overflow(pfa_ptr, pfa_len - 1, &max_tlv)) { 464 + dev_warn(ice_hw_to_dev(hw), "PFA starts at offset %u. PFA length of %u caused 16-bit arithmetic overflow.\n", 465 + pfa_ptr, pfa_len); 466 + return -EINVAL; 467 + } 468 + 470 469 /* Starting with first TLV after PFA length, iterate through the list 471 470 * of TLVs to find the requested one. 472 471 */ 473 472 next_tlv = pfa_ptr + 1; 474 - while (next_tlv < pfa_ptr + pfa_len) { 473 + while (next_tlv < max_tlv) { 475 474 u16 tlv_sub_module_type; 476 475 u16 tlv_len; 477 476 ··· 507 482 } 508 483 return -EINVAL; 509 484 } 510 - /* Check next TLV, i.e. current TLV pointer + length + 2 words 511 - * (for current TLV's type and length) 512 - */ 513 - next_tlv = next_tlv + tlv_len + 2; 485 + 486 + if (check_add_overflow(next_tlv, 2, &next_tlv) || 487 + check_add_overflow(next_tlv, tlv_len, &next_tlv)) { 488 + dev_warn(ice_hw_to_dev(hw), "TLV of type %u and length 0x%04x caused 16-bit arithmetic overflow. The PFA starts at 0x%04x and has length of 0x%04x\n", 489 + tlv_sub_module_type, tlv_len, pfa_ptr, pfa_len); 490 + return -EINVAL; 491 + } 514 492 } 515 493 /* Module does not exist */ 516 494 return -ENOENT; ··· 1038 1010 } 1039 1011 1040 1012 /** 1013 + * ice_get_nvm_css_hdr_len - Read the CSS header length from the NVM CSS header 1014 + * @hw: pointer to the HW struct 1015 + * @bank: whether to read from the active or inactive flash bank 1016 + * @hdr_len: storage for header length in words 1017 + * 1018 + * Read the CSS header length from the NVM CSS header and add the Authentication 1019 + * header size, and then convert to words. 1020 + * 1021 + * Return: zero on success, or a negative error code on failure. 1022 + */ 1023 + static int 1024 + ice_get_nvm_css_hdr_len(struct ice_hw *hw, enum ice_bank_select bank, 1025 + u32 *hdr_len) 1026 + { 1027 + u16 hdr_len_l, hdr_len_h; 1028 + u32 hdr_len_dword; 1029 + int status; 1030 + 1031 + status = ice_read_nvm_module(hw, bank, ICE_NVM_CSS_HDR_LEN_L, 1032 + &hdr_len_l); 1033 + if (status) 1034 + return status; 1035 + 1036 + status = ice_read_nvm_module(hw, bank, ICE_NVM_CSS_HDR_LEN_H, 1037 + &hdr_len_h); 1038 + if (status) 1039 + return status; 1040 + 1041 + /* CSS header length is in DWORD, so convert to words and add 1042 + * authentication header size 1043 + */ 1044 + hdr_len_dword = hdr_len_h << 16 | hdr_len_l; 1045 + *hdr_len = (hdr_len_dword * 2) + ICE_NVM_AUTH_HEADER_LEN; 1046 + 1047 + return 0; 1048 + } 1049 + 1050 + /** 1051 + * ice_determine_css_hdr_len - Discover CSS header length for the device 1052 + * @hw: pointer to the HW struct 1053 + * 1054 + * Determine the size of the CSS header at the start of the NVM module. This 1055 + * is useful for locating the Shadow RAM copy in the NVM, as the Shadow RAM is 1056 + * always located just after the CSS header. 1057 + * 1058 + * Return: zero on success, or a negative error code on failure. 1059 + */ 1060 + static int ice_determine_css_hdr_len(struct ice_hw *hw) 1061 + { 1062 + struct ice_bank_info *banks = &hw->flash.banks; 1063 + int status; 1064 + 1065 + status = ice_get_nvm_css_hdr_len(hw, ICE_ACTIVE_FLASH_BANK, 1066 + &banks->active_css_hdr_len); 1067 + if (status) 1068 + return status; 1069 + 1070 + status = ice_get_nvm_css_hdr_len(hw, ICE_INACTIVE_FLASH_BANK, 1071 + &banks->inactive_css_hdr_len); 1072 + if (status) 1073 + return status; 1074 + 1075 + return 0; 1076 + } 1077 + 1078 + /** 1041 1079 * ice_init_nvm - initializes NVM setting 1042 1080 * @hw: pointer to the HW struct 1043 1081 * ··· 1146 1052 status = ice_determine_active_flash_banks(hw); 1147 1053 if (status) { 1148 1054 ice_debug(hw, ICE_DBG_NVM, "Failed to determine active flash banks.\n"); 1055 + return status; 1056 + } 1057 + 1058 + status = ice_determine_css_hdr_len(hw); 1059 + if (status) { 1060 + ice_debug(hw, ICE_DBG_NVM, "Failed to determine Shadow RAM copy offsets.\n"); 1149 1061 return status; 1150 1062 } 1151 1063
+6 -8
drivers/net/ethernet/intel/ice/ice_type.h
··· 494 494 u32 orom_size; /* Size of OROM bank */ 495 495 u32 netlist_ptr; /* Pointer to 1st Netlist bank */ 496 496 u32 netlist_size; /* Size of Netlist bank */ 497 + u32 active_css_hdr_len; /* Active CSS header length */ 498 + u32 inactive_css_hdr_len; /* Inactive CSS header length */ 497 499 enum ice_flash_bank nvm_bank; /* Active NVM bank */ 498 500 enum ice_flash_bank orom_bank; /* Active OROM bank */ 499 501 enum ice_flash_bank netlist_bank; /* Active Netlist bank */ ··· 1127 1125 #define ICE_SR_SECTOR_SIZE_IN_WORDS 0x800 1128 1126 1129 1127 /* CSS Header words */ 1128 + #define ICE_NVM_CSS_HDR_LEN_L 0x02 1129 + #define ICE_NVM_CSS_HDR_LEN_H 0x03 1130 1130 #define ICE_NVM_CSS_SREV_L 0x14 1131 1131 #define ICE_NVM_CSS_SREV_H 0x15 1132 1132 1133 - /* Length of CSS header section in words */ 1134 - #define ICE_CSS_HEADER_LENGTH 330 1135 - 1136 - /* Offset of Shadow RAM copy in the NVM bank area. */ 1137 - #define ICE_NVM_SR_COPY_WORD_OFFSET roundup(ICE_CSS_HEADER_LENGTH, 32) 1138 - 1139 - /* Size in bytes of Option ROM trailer */ 1140 - #define ICE_NVM_OROM_TRAILER_LENGTH (2 * ICE_CSS_HEADER_LENGTH) 1133 + /* Length of Authentication header section in words */ 1134 + #define ICE_NVM_AUTH_HEADER_LEN 0x08 1141 1135 1142 1136 /* The Link Topology Netlist section is stored as a series of words. It is 1143 1137 * stored in the NVM as a TLV, with the first two words containing the type
+6 -7
drivers/net/ethernet/intel/ice/ice_xsk.c
··· 269 269 if (!pool) 270 270 return -EINVAL; 271 271 272 - clear_bit(qid, vsi->af_xdp_zc_qps); 273 272 xsk_pool_dma_unmap(pool, ICE_RX_DMA_ATTR); 274 273 275 274 return 0; ··· 298 299 ICE_RX_DMA_ATTR); 299 300 if (err) 300 301 return err; 301 - 302 - set_bit(qid, vsi->af_xdp_zc_qps); 303 302 304 303 return 0; 305 304 } ··· 346 349 int ice_realloc_zc_buf(struct ice_vsi *vsi, bool zc) 347 350 { 348 351 struct ice_rx_ring *rx_ring; 349 - unsigned long q; 352 + uint i; 350 353 351 - for_each_set_bit(q, vsi->af_xdp_zc_qps, 352 - max_t(int, vsi->alloc_txq, vsi->alloc_rxq)) { 353 - rx_ring = vsi->rx_rings[q]; 354 + ice_for_each_rxq(vsi, i) { 355 + rx_ring = vsi->rx_rings[i]; 356 + if (!rx_ring->xsk_pool) 357 + continue; 358 + 354 359 if (ice_realloc_rx_xdp_bufs(rx_ring, zc)) 355 360 return -ENOMEM; 356 361 }
+7 -2
drivers/net/ethernet/intel/igc/igc_ethtool.c
··· 1629 1629 struct igc_hw *hw = &adapter->hw; 1630 1630 u32 eeer; 1631 1631 1632 + linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, 1633 + edata->supported); 1634 + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, 1635 + edata->supported); 1636 + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, 1637 + edata->supported); 1638 + 1632 1639 if (hw->dev_spec._base.eee_enable) 1633 1640 mii_eee_cap1_mod_linkmode_t(edata->advertised, 1634 1641 adapter->eee_advert); 1635 - 1636 - *edata = adapter->eee; 1637 1642 1638 1643 eeer = rd32(IGC_EEER); 1639 1644
+4
drivers/net/ethernet/intel/igc/igc_main.c
··· 12 12 #include <linux/bpf_trace.h> 13 13 #include <net/xdp_sock_drv.h> 14 14 #include <linux/pci.h> 15 + #include <linux/mdio.h> 15 16 16 17 #include <net/ipv6.h> 17 18 ··· 4976 4975 /* start the watchdog. */ 4977 4976 hw->mac.get_link_status = true; 4978 4977 schedule_work(&adapter->watchdog_task); 4978 + 4979 + adapter->eee_advert = MDIO_EEE_100TX | MDIO_EEE_1000T | 4980 + MDIO_EEE_2_5GT; 4979 4981 } 4980 4982 4981 4983 /**
+22 -11
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
··· 2519 2519 * - when available free entries are less. 2520 2520 * Lower priority ones out of avaialble free entries are always 2521 2521 * chosen when 'high vs low' question arises. 2522 + * 2523 + * For a VF base MCAM match rule is set by its PF. And all the 2524 + * further MCAM rules installed by VF on its own are 2525 + * concatenated with the base rule set by its PF. Hence PF entries 2526 + * should be at lower priority compared to VF entries. Otherwise 2527 + * base rule is hit always and rules installed by VF will be of 2528 + * no use. Hence if the request is from PF then allocate low 2529 + * priority entries. 2522 2530 */ 2531 + if (!(pcifunc & RVU_PFVF_FUNC_MASK)) 2532 + goto lprio_alloc; 2523 2533 2524 2534 /* Get the search range for priority allocation request */ 2525 2535 if (req->priority) { ··· 2537 2527 &start, &end, &reverse); 2538 2528 goto alloc; 2539 2529 } 2540 - 2541 - /* For a VF base MCAM match rule is set by its PF. And all the 2542 - * further MCAM rules installed by VF on its own are 2543 - * concatenated with the base rule set by its PF. Hence PF entries 2544 - * should be at lower priority compared to VF entries. Otherwise 2545 - * base rule is hit always and rules installed by VF will be of 2546 - * no use. Hence if the request is from PF and NOT a priority 2547 - * allocation request then allocate low priority entries. 2548 - */ 2549 - if (!(pcifunc & RVU_PFVF_FUNC_MASK)) 2550 - goto lprio_alloc; 2551 2530 2552 2531 /* Find out the search range for non-priority allocation request 2553 2532 * ··· 2567 2568 reverse = true; 2568 2569 start = 0; 2569 2570 end = mcam->bmap_entries; 2571 + /* Ensure PF requests are always at bottom and if PF requests 2572 + * for higher/lower priority entry wrt reference entry then 2573 + * honour that criteria and start search for entries from bottom 2574 + * and not in mid zone. 2575 + */ 2576 + if (!(pcifunc & RVU_PFVF_FUNC_MASK) && 2577 + req->priority == NPC_MCAM_HIGHER_PRIO) 2578 + end = req->ref_entry; 2579 + 2580 + if (!(pcifunc & RVU_PFVF_FUNC_MASK) && 2581 + req->priority == NPC_MCAM_LOWER_PRIO) 2582 + start = req->ref_entry; 2570 2583 } 2571 2584 2572 2585 alloc:
+71 -35
drivers/net/ethernet/mediatek/mtk_eth_soc.c
··· 1131 1131 { 1132 1132 const struct mtk_soc_data *soc = eth->soc; 1133 1133 dma_addr_t phy_ring_tail; 1134 - int cnt = MTK_QDMA_RING_SIZE; 1134 + int cnt = soc->tx.fq_dma_size; 1135 1135 dma_addr_t dma_addr; 1136 - int i; 1136 + int i, j, len; 1137 1137 1138 1138 if (MTK_HAS_CAPS(eth->soc->caps, MTK_SRAM)) 1139 1139 eth->scratch_ring = eth->sram_base; ··· 1142 1142 cnt * soc->tx.desc_size, 1143 1143 &eth->phy_scratch_ring, 1144 1144 GFP_KERNEL); 1145 + 1145 1146 if (unlikely(!eth->scratch_ring)) 1146 - return -ENOMEM; 1147 - 1148 - eth->scratch_head = kcalloc(cnt, MTK_QDMA_PAGE_SIZE, GFP_KERNEL); 1149 - if (unlikely(!eth->scratch_head)) 1150 - return -ENOMEM; 1151 - 1152 - dma_addr = dma_map_single(eth->dma_dev, 1153 - eth->scratch_head, cnt * MTK_QDMA_PAGE_SIZE, 1154 - DMA_FROM_DEVICE); 1155 - if (unlikely(dma_mapping_error(eth->dma_dev, dma_addr))) 1156 1147 return -ENOMEM; 1157 1148 1158 1149 phy_ring_tail = eth->phy_scratch_ring + soc->tx.desc_size * (cnt - 1); 1159 1150 1160 - for (i = 0; i < cnt; i++) { 1161 - dma_addr_t addr = dma_addr + i * MTK_QDMA_PAGE_SIZE; 1162 - struct mtk_tx_dma_v2 *txd; 1151 + for (j = 0; j < DIV_ROUND_UP(soc->tx.fq_dma_size, MTK_FQ_DMA_LENGTH); j++) { 1152 + len = min_t(int, cnt - j * MTK_FQ_DMA_LENGTH, MTK_FQ_DMA_LENGTH); 1153 + eth->scratch_head[j] = kcalloc(len, MTK_QDMA_PAGE_SIZE, GFP_KERNEL); 1163 1154 1164 - txd = eth->scratch_ring + i * soc->tx.desc_size; 1165 - txd->txd1 = addr; 1166 - if (i < cnt - 1) 1167 - txd->txd2 = eth->phy_scratch_ring + 1168 - (i + 1) * soc->tx.desc_size; 1155 + if (unlikely(!eth->scratch_head[j])) 1156 + return -ENOMEM; 1169 1157 1170 - txd->txd3 = TX_DMA_PLEN0(MTK_QDMA_PAGE_SIZE); 1171 - if (MTK_HAS_CAPS(soc->caps, MTK_36BIT_DMA)) 1172 - txd->txd3 |= TX_DMA_PREP_ADDR64(addr); 1173 - txd->txd4 = 0; 1174 - if (mtk_is_netsys_v2_or_greater(eth)) { 1175 - txd->txd5 = 0; 1176 - txd->txd6 = 0; 1177 - txd->txd7 = 0; 1178 - txd->txd8 = 0; 1158 + dma_addr = dma_map_single(eth->dma_dev, 1159 + eth->scratch_head[j], len * MTK_QDMA_PAGE_SIZE, 1160 + DMA_FROM_DEVICE); 1161 + 1162 + if (unlikely(dma_mapping_error(eth->dma_dev, dma_addr))) 1163 + return -ENOMEM; 1164 + 1165 + for (i = 0; i < cnt; i++) { 1166 + struct mtk_tx_dma_v2 *txd; 1167 + 1168 + txd = eth->scratch_ring + (j * MTK_FQ_DMA_LENGTH + i) * soc->tx.desc_size; 1169 + txd->txd1 = dma_addr + i * MTK_QDMA_PAGE_SIZE; 1170 + if (j * MTK_FQ_DMA_LENGTH + i < cnt) 1171 + txd->txd2 = eth->phy_scratch_ring + 1172 + (j * MTK_FQ_DMA_LENGTH + i + 1) * soc->tx.desc_size; 1173 + 1174 + txd->txd3 = TX_DMA_PLEN0(MTK_QDMA_PAGE_SIZE); 1175 + if (MTK_HAS_CAPS(soc->caps, MTK_36BIT_DMA)) 1176 + txd->txd3 |= TX_DMA_PREP_ADDR64(dma_addr + i * MTK_QDMA_PAGE_SIZE); 1177 + 1178 + txd->txd4 = 0; 1179 + if (mtk_is_netsys_v2_or_greater(eth)) { 1180 + txd->txd5 = 0; 1181 + txd->txd6 = 0; 1182 + txd->txd7 = 0; 1183 + txd->txd8 = 0; 1184 + } 1179 1185 } 1180 1186 } 1181 1187 ··· 2463 2457 if (MTK_HAS_CAPS(soc->caps, MTK_QDMA)) 2464 2458 ring_size = MTK_QDMA_RING_SIZE; 2465 2459 else 2466 - ring_size = MTK_DMA_SIZE; 2460 + ring_size = soc->tx.dma_size; 2467 2461 2468 2462 ring->buf = kcalloc(ring_size, sizeof(*ring->buf), 2469 2463 GFP_KERNEL); ··· 2471 2465 goto no_tx_mem; 2472 2466 2473 2467 if (MTK_HAS_CAPS(soc->caps, MTK_SRAM)) { 2474 - ring->dma = eth->sram_base + ring_size * sz; 2475 - ring->phys = eth->phy_scratch_ring + ring_size * (dma_addr_t)sz; 2468 + ring->dma = eth->sram_base + soc->tx.fq_dma_size * sz; 2469 + ring->phys = eth->phy_scratch_ring + soc->tx.fq_dma_size * (dma_addr_t)sz; 2476 2470 } else { 2477 2471 ring->dma = dma_alloc_coherent(eth->dma_dev, ring_size * sz, 2478 2472 &ring->phys, GFP_KERNEL); ··· 2594 2588 static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag) 2595 2589 { 2596 2590 const struct mtk_reg_map *reg_map = eth->soc->reg_map; 2591 + const struct mtk_soc_data *soc = eth->soc; 2597 2592 struct mtk_rx_ring *ring; 2598 2593 int rx_data_len, rx_dma_size, tx_ring_size; 2599 2594 int i; ··· 2602 2595 if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) 2603 2596 tx_ring_size = MTK_QDMA_RING_SIZE; 2604 2597 else 2605 - tx_ring_size = MTK_DMA_SIZE; 2598 + tx_ring_size = soc->tx.dma_size; 2606 2599 2607 2600 if (rx_flag == MTK_RX_FLAGS_QDMA) { 2608 2601 if (ring_no) ··· 2617 2610 rx_dma_size = MTK_HW_LRO_DMA_SIZE; 2618 2611 } else { 2619 2612 rx_data_len = ETH_DATA_LEN; 2620 - rx_dma_size = MTK_DMA_SIZE; 2613 + rx_dma_size = soc->rx.dma_size; 2621 2614 } 2622 2615 2623 2616 ring->frag_size = mtk_max_frag_size(rx_data_len); ··· 3146 3139 mtk_rx_clean(eth, &eth->rx_ring[i], false); 3147 3140 } 3148 3141 3149 - kfree(eth->scratch_head); 3142 + for (i = 0; i < DIV_ROUND_UP(soc->tx.fq_dma_size, MTK_FQ_DMA_LENGTH); i++) { 3143 + kfree(eth->scratch_head[i]); 3144 + eth->scratch_head[i] = NULL; 3145 + } 3150 3146 } 3151 3147 3152 3148 static bool mtk_hw_reset_check(struct mtk_eth *eth) ··· 5062 5052 .desc_size = sizeof(struct mtk_tx_dma), 5063 5053 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5064 5054 .dma_len_offset = 16, 5055 + .dma_size = MTK_DMA_SIZE(2K), 5056 + .fq_dma_size = MTK_DMA_SIZE(2K), 5065 5057 }, 5066 5058 .rx = { 5067 5059 .desc_size = sizeof(struct mtk_rx_dma), 5068 5060 .irq_done_mask = MTK_RX_DONE_INT, 5069 5061 .dma_l4_valid = RX_DMA_L4_VALID, 5062 + .dma_size = MTK_DMA_SIZE(2K), 5070 5063 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5071 5064 .dma_len_offset = 16, 5072 5065 }, ··· 5089 5076 .desc_size = sizeof(struct mtk_tx_dma), 5090 5077 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5091 5078 .dma_len_offset = 16, 5079 + .dma_size = MTK_DMA_SIZE(2K), 5080 + .fq_dma_size = MTK_DMA_SIZE(2K), 5092 5081 }, 5093 5082 .rx = { 5094 5083 .desc_size = sizeof(struct mtk_rx_dma), 5095 5084 .irq_done_mask = MTK_RX_DONE_INT, 5096 5085 .dma_l4_valid = RX_DMA_L4_VALID, 5086 + .dma_size = MTK_DMA_SIZE(2K), 5097 5087 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5098 5088 .dma_len_offset = 16, 5099 5089 }, ··· 5118 5102 .desc_size = sizeof(struct mtk_tx_dma), 5119 5103 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5120 5104 .dma_len_offset = 16, 5105 + .dma_size = MTK_DMA_SIZE(2K), 5106 + .fq_dma_size = MTK_DMA_SIZE(2K), 5121 5107 }, 5122 5108 .rx = { 5123 5109 .desc_size = sizeof(struct mtk_rx_dma), 5124 5110 .irq_done_mask = MTK_RX_DONE_INT, 5125 5111 .dma_l4_valid = RX_DMA_L4_VALID, 5112 + .dma_size = MTK_DMA_SIZE(2K), 5126 5113 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5127 5114 .dma_len_offset = 16, 5128 5115 }, ··· 5146 5127 .desc_size = sizeof(struct mtk_tx_dma), 5147 5128 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5148 5129 .dma_len_offset = 16, 5130 + .dma_size = MTK_DMA_SIZE(2K), 5131 + .fq_dma_size = MTK_DMA_SIZE(2K), 5149 5132 }, 5150 5133 .rx = { 5151 5134 .desc_size = sizeof(struct mtk_rx_dma), 5152 5135 .irq_done_mask = MTK_RX_DONE_INT, 5153 5136 .dma_l4_valid = RX_DMA_L4_VALID, 5137 + .dma_size = MTK_DMA_SIZE(2K), 5154 5138 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5155 5139 .dma_len_offset = 16, 5156 5140 }, ··· 5172 5150 .desc_size = sizeof(struct mtk_tx_dma), 5173 5151 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5174 5152 .dma_len_offset = 16, 5153 + .dma_size = MTK_DMA_SIZE(2K), 5154 + .fq_dma_size = MTK_DMA_SIZE(2K), 5175 5155 }, 5176 5156 .rx = { 5177 5157 .desc_size = sizeof(struct mtk_rx_dma), 5178 5158 .irq_done_mask = MTK_RX_DONE_INT, 5179 5159 .dma_l4_valid = RX_DMA_L4_VALID, 5160 + .dma_size = MTK_DMA_SIZE(2K), 5180 5161 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5181 5162 .dma_len_offset = 16, 5182 5163 }, ··· 5201 5176 .desc_size = sizeof(struct mtk_tx_dma_v2), 5202 5177 .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, 5203 5178 .dma_len_offset = 8, 5179 + .dma_size = MTK_DMA_SIZE(2K), 5180 + .fq_dma_size = MTK_DMA_SIZE(2K), 5204 5181 }, 5205 5182 .rx = { 5206 5183 .desc_size = sizeof(struct mtk_rx_dma), ··· 5210 5183 .dma_l4_valid = RX_DMA_L4_VALID_V2, 5211 5184 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5212 5185 .dma_len_offset = 16, 5186 + .dma_size = MTK_DMA_SIZE(2K), 5213 5187 }, 5214 5188 }; 5215 5189 ··· 5230 5202 .desc_size = sizeof(struct mtk_tx_dma_v2), 5231 5203 .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, 5232 5204 .dma_len_offset = 8, 5205 + .dma_size = MTK_DMA_SIZE(2K), 5206 + .fq_dma_size = MTK_DMA_SIZE(2K), 5233 5207 }, 5234 5208 .rx = { 5235 5209 .desc_size = sizeof(struct mtk_rx_dma), ··· 5239 5209 .dma_l4_valid = RX_DMA_L4_VALID_V2, 5240 5210 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5241 5211 .dma_len_offset = 16, 5212 + .dma_size = MTK_DMA_SIZE(2K), 5242 5213 }, 5243 5214 }; 5244 5215 ··· 5259 5228 .desc_size = sizeof(struct mtk_tx_dma_v2), 5260 5229 .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, 5261 5230 .dma_len_offset = 8, 5231 + .dma_size = MTK_DMA_SIZE(2K), 5232 + .fq_dma_size = MTK_DMA_SIZE(4K), 5262 5233 }, 5263 5234 .rx = { 5264 5235 .desc_size = sizeof(struct mtk_rx_dma_v2), ··· 5268 5235 .dma_l4_valid = RX_DMA_L4_VALID_V2, 5269 5236 .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, 5270 5237 .dma_len_offset = 8, 5238 + .dma_size = MTK_DMA_SIZE(2K), 5271 5239 }, 5272 5240 }; 5273 5241 ··· 5283 5249 .desc_size = sizeof(struct mtk_tx_dma), 5284 5250 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5285 5251 .dma_len_offset = 16, 5252 + .dma_size = MTK_DMA_SIZE(2K), 5286 5253 }, 5287 5254 .rx = { 5288 5255 .desc_size = sizeof(struct mtk_rx_dma), ··· 5291 5256 .dma_l4_valid = RX_DMA_L4_VALID_PDMA, 5292 5257 .dma_max_len = MTK_TX_DMA_BUF_LEN, 5293 5258 .dma_len_offset = 16, 5259 + .dma_size = MTK_DMA_SIZE(2K), 5294 5260 }, 5295 5261 }; 5296 5262
+7 -2
drivers/net/ethernet/mediatek/mtk_eth_soc.h
··· 32 32 #define MTK_TX_DMA_BUF_LEN 0x3fff 33 33 #define MTK_TX_DMA_BUF_LEN_V2 0xffff 34 34 #define MTK_QDMA_RING_SIZE 2048 35 - #define MTK_DMA_SIZE 512 35 + #define MTK_DMA_SIZE(x) (SZ_##x) 36 + #define MTK_FQ_DMA_HEAD 32 37 + #define MTK_FQ_DMA_LENGTH 2048 36 38 #define MTK_RX_ETH_HLEN (ETH_HLEN + ETH_FCS_LEN) 37 39 #define MTK_RX_HLEN (NET_SKB_PAD + MTK_RX_ETH_HLEN + NET_IP_ALIGN) 38 40 #define MTK_DMA_DUMMY_DESC 0xffffffff ··· 1178 1176 u32 desc_size; 1179 1177 u32 dma_max_len; 1180 1178 u32 dma_len_offset; 1179 + u32 dma_size; 1180 + u32 fq_dma_size; 1181 1181 } tx; 1182 1182 struct { 1183 1183 u32 desc_size; ··· 1187 1183 u32 dma_l4_valid; 1188 1184 u32 dma_max_len; 1189 1185 u32 dma_len_offset; 1186 + u32 dma_size; 1190 1187 } rx; 1191 1188 }; 1192 1189 ··· 1269 1264 struct napi_struct rx_napi; 1270 1265 void *scratch_ring; 1271 1266 dma_addr_t phy_scratch_ring; 1272 - void *scratch_head; 1267 + void *scratch_head[MTK_FQ_DMA_HEAD]; 1273 1268 struct clk *clks[MTK_CLK_MAX]; 1274 1269 1275 1270 struct mii_bus *mii_bus;
+4
drivers/net/ethernet/mellanox/mlx5/core/fw.c
··· 373 373 do { 374 374 if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED) 375 375 break; 376 + if (pci_channel_offline(dev->pdev)) { 377 + mlx5_core_err(dev, "PCI channel offline, stop waiting for NIC IFC\n"); 378 + return -EACCES; 379 + } 376 380 377 381 cond_resched(); 378 382 } while (!time_after(jiffies, end));
+8
drivers/net/ethernet/mellanox/mlx5/core/health.c
··· 248 248 do { 249 249 if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED) 250 250 break; 251 + if (pci_channel_offline(dev->pdev)) { 252 + mlx5_core_err(dev, "PCI channel offline, stop waiting for NIC IFC\n"); 253 + goto unlock; 254 + } 251 255 252 256 msleep(20); 253 257 } while (!time_after(jiffies, end)); ··· 320 316 if (test_bit(MLX5_BREAK_FW_WAIT, &dev->intf_state)) { 321 317 mlx5_core_warn(dev, "device is being removed, stop waiting for PCI\n"); 322 318 return -ENODEV; 319 + } 320 + if (pci_channel_offline(dev->pdev)) { 321 + mlx5_core_err(dev, "PCI channel offline, stop waiting for PCI\n"); 322 + return -EACCES; 323 323 } 324 324 msleep(100); 325 325 }
+6 -2
drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c
··· 88 88 &dest, 1); 89 89 if (IS_ERR(lag_definer->rules[idx])) { 90 90 err = PTR_ERR(lag_definer->rules[idx]); 91 - while (i--) 92 - while (j--) 91 + do { 92 + while (j--) { 93 + idx = i * ldev->buckets + j; 93 94 mlx5_del_flow_rules(lag_definer->rules[idx]); 95 + } 96 + j = ldev->buckets; 97 + } while (i--); 94 98 goto destroy_fg; 95 99 } 96 100 }
+4
drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.c
··· 74 74 ret = -EBUSY; 75 75 goto pci_unlock; 76 76 } 77 + if (pci_channel_offline(dev->pdev)) { 78 + ret = -EACCES; 79 + goto pci_unlock; 80 + } 77 81 78 82 /* Check if semaphore is already locked */ 79 83 ret = vsc_read(dev, VSC_SEMAPHORE_OFFSET, &lock_val);
+3
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 1298 1298 1299 1299 if (!err) 1300 1300 mlx5_function_disable(dev, boot); 1301 + else 1302 + mlx5_stop_health_poll(dev, boot); 1303 + 1301 1304 return err; 1302 1305 } 1303 1306
+1
drivers/net/ethernet/pensando/ionic/ionic_txrx.c
··· 586 586 netdev_dbg(netdev, "tx ionic_xdp_post_frame err %d\n", err); 587 587 goto out_xdp_abort; 588 588 } 589 + buf_info->page = NULL; 589 590 stats->xdp_tx++; 590 591 591 592 /* the Tx completion will free the buffers */
+97 -7
drivers/net/phy/micrel.c
··· 866 866 { 867 867 int ret; 868 868 869 + /* Chip can be powered down by the bootstrap code. */ 870 + ret = phy_read(phydev, MII_BMCR); 871 + if (ret < 0) 872 + return ret; 873 + if (ret & BMCR_PDOWN) { 874 + ret = phy_write(phydev, MII_BMCR, ret & ~BMCR_PDOWN); 875 + if (ret < 0) 876 + return ret; 877 + usleep_range(1000, 2000); 878 + } 879 + 869 880 ret = phy_write_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_DEVID1, 0xB61A); 870 881 if (ret) 871 882 return ret; ··· 1950 1939 {0x1c, 0x20, 0xeeee}, 1951 1940 }; 1952 1941 1953 - static int ksz9477_config_init(struct phy_device *phydev) 1942 + static int ksz9477_phy_errata(struct phy_device *phydev) 1954 1943 { 1955 1944 int err; 1956 1945 int i; ··· 1978 1967 return err; 1979 1968 } 1980 1969 1970 + err = genphy_restart_aneg(phydev); 1971 + if (err) 1972 + return err; 1973 + 1974 + return err; 1975 + } 1976 + 1977 + static int ksz9477_config_init(struct phy_device *phydev) 1978 + { 1979 + int err; 1980 + 1981 + /* Only KSZ9897 family of switches needs this fix. */ 1982 + if ((phydev->phy_id & 0xf) == 1) { 1983 + err = ksz9477_phy_errata(phydev); 1984 + if (err) 1985 + return err; 1986 + } 1987 + 1981 1988 /* According to KSZ9477 Errata DS80000754C (Module 4) all EEE modes 1982 1989 * in this switch shall be regarded as broken. 1983 1990 */ 1984 1991 if (phydev->dev_flags & MICREL_NO_EEE) 1985 1992 phydev->eee_broken_modes = -1; 1986 - 1987 - err = genphy_restart_aneg(phydev); 1988 - if (err) 1989 - return err; 1990 1993 1991 1994 return kszphy_config_init(phydev); 1992 1995 } ··· 2097 2072 usleep_range(1000, 2000); 2098 2073 2099 2074 ret = kszphy_config_reset(phydev); 2075 + if (ret) 2076 + return ret; 2077 + 2078 + /* Enable PHY Interrupts */ 2079 + if (phy_interrupt_is_valid(phydev)) { 2080 + phydev->interrupts = PHY_INTERRUPT_ENABLED; 2081 + if (phydev->drv->config_intr) 2082 + phydev->drv->config_intr(phydev); 2083 + } 2084 + 2085 + return 0; 2086 + } 2087 + 2088 + static int ksz9477_resume(struct phy_device *phydev) 2089 + { 2090 + int ret; 2091 + 2092 + /* No need to initialize registers if not powered down. */ 2093 + ret = phy_read(phydev, MII_BMCR); 2094 + if (ret < 0) 2095 + return ret; 2096 + if (!(ret & BMCR_PDOWN)) 2097 + return 0; 2098 + 2099 + genphy_resume(phydev); 2100 + 2101 + /* After switching from power-down to normal mode, an internal global 2102 + * reset is automatically generated. Wait a minimum of 1 ms before 2103 + * read/write access to the PHY registers. 2104 + */ 2105 + usleep_range(1000, 2000); 2106 + 2107 + /* Only KSZ9897 family of switches needs this fix. */ 2108 + if ((phydev->phy_id & 0xf) == 1) { 2109 + ret = ksz9477_phy_errata(phydev); 2110 + if (ret) 2111 + return ret; 2112 + } 2113 + 2114 + /* Enable PHY Interrupts */ 2115 + if (phy_interrupt_is_valid(phydev)) { 2116 + phydev->interrupts = PHY_INTERRUPT_ENABLED; 2117 + if (phydev->drv->config_intr) 2118 + phydev->drv->config_intr(phydev); 2119 + } 2120 + 2121 + return 0; 2122 + } 2123 + 2124 + static int ksz8061_resume(struct phy_device *phydev) 2125 + { 2126 + int ret; 2127 + 2128 + /* This function can be called twice when the Ethernet device is on. */ 2129 + ret = phy_read(phydev, MII_BMCR); 2130 + if (ret < 0) 2131 + return ret; 2132 + if (!(ret & BMCR_PDOWN)) 2133 + return 0; 2134 + 2135 + genphy_resume(phydev); 2136 + usleep_range(1000, 2000); 2137 + 2138 + /* Re-program the value after chip is reset. */ 2139 + ret = phy_write_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_DEVID1, 0xB61A); 2100 2140 if (ret) 2101 2141 return ret; 2102 2142 ··· 5429 5339 .config_intr = kszphy_config_intr, 5430 5340 .handle_interrupt = kszphy_handle_interrupt, 5431 5341 .suspend = kszphy_suspend, 5432 - .resume = kszphy_resume, 5342 + .resume = ksz8061_resume, 5433 5343 }, { 5434 5344 .phy_id = PHY_ID_KSZ9021, 5435 5345 .phy_id_mask = 0x000ffffe, ··· 5583 5493 .config_intr = kszphy_config_intr, 5584 5494 .handle_interrupt = kszphy_handle_interrupt, 5585 5495 .suspend = genphy_suspend, 5586 - .resume = genphy_resume, 5496 + .resume = ksz9477_resume, 5587 5497 .get_features = ksz9477_get_features, 5588 5498 } }; 5589 5499
+20 -22
drivers/net/virtio_net.c
··· 2686 2686 { 2687 2687 struct scatterlist *sgs[5], hdr, stat; 2688 2688 u32 out_num = 0, tmp, in_num = 0; 2689 + bool ok; 2689 2690 int ret; 2690 2691 2691 2692 /* Caller should know better */ ··· 2732 2731 } 2733 2732 2734 2733 unlock: 2734 + ok = vi->ctrl->status == VIRTIO_NET_OK; 2735 2735 mutex_unlock(&vi->cvq_lock); 2736 - return vi->ctrl->status == VIRTIO_NET_OK; 2736 + return ok; 2737 2737 } 2738 2738 2739 2739 static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, ··· 4259 4257 struct virtio_net_ctrl_coal_rx *coal_rx __free(kfree) = NULL; 4260 4258 bool rx_ctrl_dim_on = !!ec->use_adaptive_rx_coalesce; 4261 4259 struct scatterlist sgs_rx; 4262 - int ret = 0; 4263 4260 int i; 4264 4261 4265 4262 if (rx_ctrl_dim_on && !virtio_has_feature(vi->vdev, VIRTIO_NET_F_VQ_NOTF_COAL)) ··· 4268 4267 ec->rx_max_coalesced_frames != vi->intr_coal_rx.max_packets)) 4269 4268 return -EINVAL; 4270 4269 4271 - /* Acquire all queues dim_locks */ 4272 - for (i = 0; i < vi->max_queue_pairs; i++) 4273 - mutex_lock(&vi->rq[i].dim_lock); 4274 - 4275 4270 if (rx_ctrl_dim_on && !vi->rx_dim_enabled) { 4276 4271 vi->rx_dim_enabled = true; 4277 - for (i = 0; i < vi->max_queue_pairs; i++) 4272 + for (i = 0; i < vi->max_queue_pairs; i++) { 4273 + mutex_lock(&vi->rq[i].dim_lock); 4278 4274 vi->rq[i].dim_enabled = true; 4279 - goto unlock; 4275 + mutex_unlock(&vi->rq[i].dim_lock); 4276 + } 4277 + return 0; 4280 4278 } 4281 4279 4282 4280 coal_rx = kzalloc(sizeof(*coal_rx), GFP_KERNEL); 4283 - if (!coal_rx) { 4284 - ret = -ENOMEM; 4285 - goto unlock; 4286 - } 4281 + if (!coal_rx) 4282 + return -ENOMEM; 4287 4283 4288 4284 if (!rx_ctrl_dim_on && vi->rx_dim_enabled) { 4289 4285 vi->rx_dim_enabled = false; 4290 - for (i = 0; i < vi->max_queue_pairs; i++) 4286 + for (i = 0; i < vi->max_queue_pairs; i++) { 4287 + mutex_lock(&vi->rq[i].dim_lock); 4291 4288 vi->rq[i].dim_enabled = false; 4289 + mutex_unlock(&vi->rq[i].dim_lock); 4290 + } 4292 4291 } 4293 4292 4294 4293 /* Since the per-queue coalescing params can be set, ··· 4301 4300 4302 4301 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_NOTF_COAL, 4303 4302 VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, 4304 - &sgs_rx)) { 4305 - ret = -EINVAL; 4306 - goto unlock; 4307 - } 4303 + &sgs_rx)) 4304 + return -EINVAL; 4308 4305 4309 4306 vi->intr_coal_rx.max_usecs = ec->rx_coalesce_usecs; 4310 4307 vi->intr_coal_rx.max_packets = ec->rx_max_coalesced_frames; 4311 4308 for (i = 0; i < vi->max_queue_pairs; i++) { 4309 + mutex_lock(&vi->rq[i].dim_lock); 4312 4310 vi->rq[i].intr_coal.max_usecs = ec->rx_coalesce_usecs; 4313 4311 vi->rq[i].intr_coal.max_packets = ec->rx_max_coalesced_frames; 4314 - } 4315 - unlock: 4316 - for (i = vi->max_queue_pairs - 1; i >= 0; i--) 4317 4312 mutex_unlock(&vi->rq[i].dim_lock); 4313 + } 4318 4314 4319 - return ret; 4315 + return 0; 4320 4316 } 4321 4317 4322 4318 static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi, ··· 4415 4417 if (err) 4416 4418 pr_debug("%s: Failed to send dim parameters on rxq%d\n", 4417 4419 dev->name, qnum); 4418 - dim->state = DIM_START_MEASURE; 4419 4420 } 4420 4421 out: 4422 + dim->state = DIM_START_MEASURE; 4421 4423 mutex_unlock(&rq->dim_lock); 4422 4424 } 4423 4425
+1 -1
drivers/net/vmxnet3/vmxnet3_drv.c
··· 2111 2111 rq->data_ring.base, 2112 2112 rq->data_ring.basePA); 2113 2113 rq->data_ring.base = NULL; 2114 - rq->data_ring.desc_size = 0; 2115 2114 } 2115 + rq->data_ring.desc_size = 0; 2116 2116 } 2117 2117 } 2118 2118
+4 -4
drivers/net/vxlan/vxlan_core.c
··· 1446 1446 struct vxlan_fdb *f; 1447 1447 u32 ifindex = 0; 1448 1448 1449 + /* Ignore packets from invalid src-address */ 1450 + if (!is_valid_ether_addr(src_mac)) 1451 + return true; 1452 + 1449 1453 #if IS_ENABLED(CONFIG_IPV6) 1450 1454 if (src_ip->sa.sa_family == AF_INET6 && 1451 1455 (ipv6_addr_type(&src_ip->sin6.sin6_addr) & IPV6_ADDR_LINKLOCAL)) ··· 1618 1614 1619 1615 /* Ignore packet loops (and multicast echo) */ 1620 1616 if (ether_addr_equal(eth_hdr(skb)->h_source, vxlan->dev->dev_addr)) 1621 - return false; 1622 - 1623 - /* Ignore packets from invalid src-address */ 1624 - if (!is_valid_ether_addr(eth_hdr(skb)->h_source)) 1625 1617 return false; 1626 1618 1627 1619 /* Get address from the outer IP header */
+1
drivers/net/wireless/ath/ath10k/Kconfig
··· 45 45 depends on ATH10K 46 46 depends on ARCH_QCOM || COMPILE_TEST 47 47 depends on QCOM_SMEM 48 + depends on QCOM_RPROC_COMMON || QCOM_RPROC_COMMON=n 48 49 select QCOM_SCM 49 50 select QCOM_QMI_HELPERS 50 51 help
+1 -1
drivers/net/wireless/ath/ath11k/core.c
··· 604 604 .coldboot_cal_ftm = true, 605 605 .cbcal_restart_fw = false, 606 606 .fw_mem_mode = 0, 607 - .num_vdevs = 16 + 1, 607 + .num_vdevs = 3, 608 608 .num_peers = 512, 609 609 .supports_suspend = false, 610 610 .hal_desc_sz = sizeof(struct hal_rx_desc_qcn9074),
+25 -13
drivers/net/wireless/ath/ath11k/mac.c
··· 7988 7988 struct ath11k_base *ab = ar->ab; 7989 7989 struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); 7990 7990 int ret; 7991 - struct cur_regulatory_info *reg_info; 7992 - enum ieee80211_ap_reg_power power_type; 7993 7991 7994 7992 mutex_lock(&ar->conf_mutex); 7995 7993 ··· 7998 8000 if (ath11k_wmi_supports_6ghz_cc_ext(ar) && 7999 8001 ctx->def.chan->band == NL80211_BAND_6GHZ && 8000 8002 arvif->vdev_type == WMI_VDEV_TYPE_STA) { 8001 - reg_info = &ab->reg_info_store[ar->pdev_idx]; 8002 - power_type = vif->bss_conf.power_type; 8003 - 8004 - ath11k_dbg(ab, ATH11K_DBG_MAC, "chanctx power type %d\n", power_type); 8005 - 8006 - if (power_type == IEEE80211_REG_UNSET_AP) { 8007 - ret = -EINVAL; 8008 - goto out; 8009 - } 8010 - 8011 - ath11k_reg_handle_chan_list(ab, reg_info, power_type); 8012 8003 arvif->chanctx = *ctx; 8013 8004 ath11k_mac_parse_tx_pwr_env(ar, vif, ctx); 8014 8005 } ··· 9613 9626 struct ath11k *ar = hw->priv; 9614 9627 struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); 9615 9628 struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); 9629 + enum ieee80211_ap_reg_power power_type; 9630 + struct cur_regulatory_info *reg_info; 9616 9631 struct ath11k_peer *peer; 9617 9632 int ret = 0; 9618 9633 ··· 9693 9704 if (ret) 9694 9705 ath11k_warn(ar->ab, "Unable to authorize peer %pM vdev %d: %d\n", 9695 9706 sta->addr, arvif->vdev_id, ret); 9707 + } 9708 + 9709 + if (!ret && 9710 + ath11k_wmi_supports_6ghz_cc_ext(ar) && 9711 + arvif->vdev_type == WMI_VDEV_TYPE_STA && 9712 + arvif->chanctx.def.chan && 9713 + arvif->chanctx.def.chan->band == NL80211_BAND_6GHZ) { 9714 + reg_info = &ar->ab->reg_info_store[ar->pdev_idx]; 9715 + power_type = vif->bss_conf.power_type; 9716 + 9717 + if (power_type == IEEE80211_REG_UNSET_AP) { 9718 + ath11k_warn(ar->ab, "invalid power type %d\n", 9719 + power_type); 9720 + ret = -EINVAL; 9721 + } else { 9722 + ret = ath11k_reg_handle_chan_list(ar->ab, 9723 + reg_info, 9724 + power_type); 9725 + if (ret) 9726 + ath11k_warn(ar->ab, 9727 + "failed to handle chan list with power type %d\n", 9728 + power_type); 9729 + } 9696 9730 } 9697 9731 } else if (old_state == IEEE80211_STA_AUTHORIZED && 9698 9732 new_state == IEEE80211_STA_ASSOC) {
+17 -8
drivers/net/wireless/ath/ath11k/pcic.c
··· 561 561 { 562 562 int i, j, n, ret, num_vectors = 0; 563 563 u32 user_base_data = 0, base_vector = 0; 564 + struct ath11k_ext_irq_grp *irq_grp; 564 565 unsigned long irq_flags; 565 566 566 567 ret = ath11k_pcic_get_user_msi_assignment(ab, "DP", &num_vectors, ··· 575 574 irq_flags |= IRQF_NOBALANCING; 576 575 577 576 for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { 578 - struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; 577 + irq_grp = &ab->ext_irq_grp[i]; 579 578 u32 num_irq = 0; 580 579 581 580 irq_grp->ab = ab; 582 581 irq_grp->grp_id = i; 583 582 irq_grp->napi_ndev = alloc_netdev_dummy(0); 584 - if (!irq_grp->napi_ndev) 585 - return -ENOMEM; 583 + if (!irq_grp->napi_ndev) { 584 + ret = -ENOMEM; 585 + goto fail_allocate; 586 + } 586 587 587 588 netif_napi_add(irq_grp->napi_ndev, &irq_grp->napi, 588 589 ath11k_pcic_ext_grp_napi_poll); ··· 609 606 int irq = ath11k_pcic_get_msi_irq(ab, vector); 610 607 611 608 if (irq < 0) { 612 - for (n = 0; n <= i; n++) { 613 - irq_grp = &ab->ext_irq_grp[n]; 614 - free_netdev(irq_grp->napi_ndev); 615 - } 616 - return irq; 609 + ret = irq; 610 + goto fail_irq; 617 611 } 618 612 619 613 ab->irq_num[irq_idx] = irq; ··· 635 635 } 636 636 637 637 return 0; 638 + fail_irq: 639 + /* i ->napi_ndev was properly allocated. Free it also */ 640 + i += 1; 641 + fail_allocate: 642 + for (n = 0; n < i; n++) { 643 + irq_grp = &ab->ext_irq_grp[n]; 644 + free_netdev(irq_grp->napi_ndev); 645 + } 646 + return ret; 638 647 } 639 648 640 649 int ath11k_pcic_config_irq(struct ath11k_base *ab)
+1 -1
drivers/net/wireless/intel/iwlwifi/iwl-drv.c
··· 1815 1815 err_fw: 1816 1816 #ifdef CONFIG_IWLWIFI_DEBUGFS 1817 1817 debugfs_remove_recursive(drv->dbgfs_drv); 1818 - iwl_dbg_tlv_free(drv->trans); 1819 1818 #endif 1819 + iwl_dbg_tlv_free(drv->trans); 1820 1820 kfree(drv); 1821 1821 err: 1822 1822 return ERR_PTR(ret);
+13 -3
drivers/net/wireless/intel/iwlwifi/mvm/d3.c
··· 595 595 void *_data) 596 596 { 597 597 struct wowlan_key_gtk_type_iter *data = _data; 598 + __le32 *cipher = NULL; 599 + 600 + if (key->keyidx == 4 || key->keyidx == 5) 601 + cipher = &data->kek_kck_cmd->igtk_cipher; 602 + if (key->keyidx == 6 || key->keyidx == 7) 603 + cipher = &data->kek_kck_cmd->bigtk_cipher; 598 604 599 605 switch (key->cipher) { 600 606 default: ··· 612 606 return; 613 607 case WLAN_CIPHER_SUITE_BIP_GMAC_256: 614 608 case WLAN_CIPHER_SUITE_BIP_GMAC_128: 615 - data->kek_kck_cmd->igtk_cipher = cpu_to_le32(STA_KEY_FLG_GCMP); 609 + if (cipher) 610 + *cipher = cpu_to_le32(STA_KEY_FLG_GCMP); 616 611 return; 617 612 case WLAN_CIPHER_SUITE_AES_CMAC: 618 - data->kek_kck_cmd->igtk_cipher = cpu_to_le32(STA_KEY_FLG_CCM); 613 + case WLAN_CIPHER_SUITE_BIP_CMAC_256: 614 + if (cipher) 615 + *cipher = cpu_to_le32(STA_KEY_FLG_CCM); 619 616 return; 620 617 case WLAN_CIPHER_SUITE_CCMP: 621 618 if (!sta) ··· 2350 2341 2351 2342 out: 2352 2343 if (iwl_fw_lookup_notif_ver(mvm->fw, LONG_GROUP, 2353 - WOWLAN_GET_STATUSES, 0) < 10) { 2344 + WOWLAN_GET_STATUSES, 2345 + IWL_FW_CMD_VER_UNKNOWN) < 10) { 2354 2346 mvmvif->seqno_valid = true; 2355 2347 /* +0x10 because the set API expects next-to-use, not last-used */ 2356 2348 mvmvif->seqno = status->non_qos_seq_ctr + 0x10;
+9
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
··· 1617 1617 &beacon_cmd.tim_size, 1618 1618 beacon->data, beacon->len); 1619 1619 1620 + if (iwl_fw_lookup_cmd_ver(mvm->fw, 1621 + BEACON_TEMPLATE_CMD, 0) >= 14) { 1622 + u32 offset = iwl_mvm_find_ie_offset(beacon->data, 1623 + WLAN_EID_S1G_TWT, 1624 + beacon->len); 1625 + 1626 + beacon_cmd.btwt_offset = cpu_to_le32(offset); 1627 + } 1628 + 1620 1629 iwl_mvm_mac_ctxt_send_beacon_cmd(mvm, beacon, &beacon_cmd, 1621 1630 sizeof(beacon_cmd)); 1622 1631 }
+2 -12
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
··· 94 94 { 95 95 struct iwl_rx_packet *pkt = rxb_addr(rxb); 96 96 struct iwl_mfu_assert_dump_notif *mfu_dump_notif = (void *)pkt->data; 97 - __le32 *dump_data = mfu_dump_notif->data; 98 - int n_words = le32_to_cpu(mfu_dump_notif->data_size) / sizeof(__le32); 99 - int i; 100 97 101 98 if (mfu_dump_notif->index_num == 0) 102 99 IWL_INFO(mvm, "MFUART assert id 0x%x occurred\n", 103 100 le32_to_cpu(mfu_dump_notif->assert_id)); 104 - 105 - for (i = 0; i < n_words; i++) 106 - IWL_DEBUG_INFO(mvm, 107 - "MFUART assert dump, dword %u: 0x%08x\n", 108 - le16_to_cpu(mfu_dump_notif->index_num) * 109 - n_words + i, 110 - le32_to_cpu(dump_data[i])); 111 101 } 112 102 113 103 static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait, ··· 885 895 int ret; 886 896 u16 len = 0; 887 897 u32 n_subbands; 888 - u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 889 - IWL_FW_CMD_VER_UNKNOWN); 898 + u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 3); 899 + 890 900 if (cmd_ver >= 7) { 891 901 len = sizeof(cmd.v7); 892 902 n_subbands = IWL_NUM_SUB_BANDS_V2;
+1 -1
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
··· 873 873 } 874 874 } 875 875 876 - static u32 iwl_mvm_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size) 876 + u32 iwl_mvm_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size) 877 877 { 878 878 struct ieee80211_mgmt *mgmt = (void *)beacon; 879 879 const u8 *ie;
+38 -1
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 1128 1128 RCU_INIT_POINTER(mvmvif->deflink.probe_resp_data, NULL); 1129 1129 } 1130 1130 1131 + static void iwl_mvm_cleanup_sta_iterator(void *data, struct ieee80211_sta *sta) 1132 + { 1133 + struct iwl_mvm *mvm = data; 1134 + struct iwl_mvm_sta *mvm_sta; 1135 + struct ieee80211_vif *vif; 1136 + int link_id; 1137 + 1138 + mvm_sta = iwl_mvm_sta_from_mac80211(sta); 1139 + vif = mvm_sta->vif; 1140 + 1141 + if (!sta->valid_links) 1142 + return; 1143 + 1144 + for (link_id = 0; link_id < ARRAY_SIZE((sta)->link); link_id++) { 1145 + struct iwl_mvm_link_sta *mvm_link_sta; 1146 + 1147 + mvm_link_sta = 1148 + rcu_dereference_check(mvm_sta->link[link_id], 1149 + lockdep_is_held(&mvm->mutex)); 1150 + if (mvm_link_sta && !(vif->active_links & BIT(link_id))) { 1151 + /* 1152 + * We have a link STA but the link is inactive in 1153 + * mac80211. This will happen if we failed to 1154 + * deactivate the link but mac80211 roll back the 1155 + * deactivation of the link. 1156 + * Delete the stale data to avoid issues later on. 1157 + */ 1158 + iwl_mvm_mld_free_sta_link(mvm, mvm_sta, mvm_link_sta, 1159 + link_id, false); 1160 + } 1161 + } 1162 + } 1163 + 1131 1164 static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) 1132 1165 { 1133 1166 iwl_mvm_stop_device(mvm); ··· 1182 1149 * gone down during the HW restart 1183 1150 */ 1184 1151 ieee80211_iterate_interfaces(mvm->hw, 0, iwl_mvm_cleanup_iterator, mvm); 1152 + 1153 + /* cleanup stations as links may be gone after restart */ 1154 + ieee80211_iterate_stations_atomic(mvm->hw, 1155 + iwl_mvm_cleanup_sta_iterator, mvm); 1185 1156 1186 1157 mvm->p2p_device_vif = NULL; 1187 1158 ··· 6385 6348 .len[0] = sizeof(cmd), 6386 6349 .data[1] = data, 6387 6350 .len[1] = size, 6388 - .flags = sync ? 0 : CMD_ASYNC, 6351 + .flags = CMD_SEND_IN_RFKILL | (sync ? 0 : CMD_ASYNC), 6389 6352 }; 6390 6353 int ret; 6391 6354
-2
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
··· 75 75 goto out_free_bf; 76 76 77 77 iwl_mvm_tcm_add_vif(mvm, vif); 78 - INIT_DELAYED_WORK(&mvmvif->csa_work, 79 - iwl_mvm_channel_switch_disconnect_wk); 80 78 81 79 if (vif->type == NL80211_IFTYPE_MONITOR) { 82 80 mvm->monitor_on = true;
+7 -6
drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
··· 515 515 return iwl_mvm_mld_send_sta_cmd(mvm, &cmd); 516 516 } 517 517 518 - static void iwl_mvm_mld_free_sta_link(struct iwl_mvm *mvm, 519 - struct iwl_mvm_sta *mvm_sta, 520 - struct iwl_mvm_link_sta *mvm_sta_link, 521 - unsigned int link_id, 522 - bool is_in_fw) 518 + void iwl_mvm_mld_free_sta_link(struct iwl_mvm *mvm, 519 + struct iwl_mvm_sta *mvm_sta, 520 + struct iwl_mvm_link_sta *mvm_sta_link, 521 + unsigned int link_id, 522 + bool is_in_fw) 523 523 { 524 524 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[mvm_sta_link->sta_id], 525 525 is_in_fw ? ERR_PTR(-EINVAL) : NULL); ··· 1014 1014 1015 1015 cmd.modify.tid = cpu_to_le32(data->tid); 1016 1016 1017 - ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, sizeof(cmd), &cmd); 1017 + ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, CMD_SEND_IN_RFKILL, 1018 + sizeof(cmd), &cmd); 1018 1019 data->sta_mask = new_sta_mask; 1019 1020 if (ret) 1020 1021 return ret;
+1
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
··· 1758 1758 void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, int clock_type, u32 *gp2, 1759 1759 u64 *boottime, ktime_t *realtime); 1760 1760 u32 iwl_mvm_get_systime(struct iwl_mvm *mvm); 1761 + u32 iwl_mvm_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size); 1761 1762 1762 1763 /* Tx / Host Commands */ 1763 1764 int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm,
+2 -7
drivers/net/wireless/intel/iwlwifi/mvm/rs.h
··· 122 122 123 123 #define LINK_QUAL_AGG_FRAME_LIMIT_DEF (63) 124 124 #define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63) 125 - /* 126 - * FIXME - various places in firmware API still use u8, 127 - * e.g. LQ command and SCD config command. 128 - * This should be 256 instead. 129 - */ 130 - #define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_DEF (255) 131 - #define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_MAX (255) 125 + #define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_DEF (64) 126 + #define LINK_QUAL_AGG_FRAME_LIMIT_GEN2_MAX (64) 132 127 #define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0) 133 128 134 129 #define LQ_SIZE 2 /* 2 mode tables: "Active" and "Search" */
+4 -1
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
··· 2450 2450 * 2451 2451 * We mark it as mac header, for upper layers to know where 2452 2452 * all radio tap header ends. 2453 + * 2454 + * Since data doesn't move data while putting data on skb and that is 2455 + * the only way we use, data + len is the next place that hdr would be put 2453 2456 */ 2454 - skb_reset_mac_header(skb); 2457 + skb_set_mac_header(skb, skb->len); 2455 2458 2456 2459 /* 2457 2460 * Override the nss from the rx_vec since the rate_n_flags has
+8 -4
drivers/net/wireless/intel/iwlwifi/mvm/scan.c
··· 1313 1313 if (IWL_MVM_ADWELL_MAX_BUDGET) 1314 1314 cmd->v7.adwell_max_budget = 1315 1315 cpu_to_le16(IWL_MVM_ADWELL_MAX_BUDGET); 1316 - else if (params->ssids && params->ssids[0].ssid_len) 1316 + else if (params->n_ssids && params->ssids[0].ssid_len) 1317 1317 cmd->v7.adwell_max_budget = 1318 1318 cpu_to_le16(IWL_SCAN_ADWELL_MAX_BUDGET_DIRECTED_SCAN); 1319 1319 else ··· 1418 1418 if (IWL_MVM_ADWELL_MAX_BUDGET) 1419 1419 general_params->adwell_max_budget = 1420 1420 cpu_to_le16(IWL_MVM_ADWELL_MAX_BUDGET); 1421 - else if (params->ssids && params->ssids[0].ssid_len) 1421 + else if (params->n_ssids && params->ssids[0].ssid_len) 1422 1422 general_params->adwell_max_budget = 1423 1423 cpu_to_le16(IWL_SCAN_ADWELL_MAX_BUDGET_DIRECTED_SCAN); 1424 1424 else ··· 1730 1730 break; 1731 1731 } 1732 1732 1733 - if (k == idex_b && idex_b < SCAN_BSSID_MAX_SIZE) { 1733 + if (k == idex_b && idex_b < SCAN_BSSID_MAX_SIZE && 1734 + !WARN_ONCE(!is_valid_ether_addr(scan_6ghz_params[j].bssid), 1735 + "scan: invalid BSSID at index %u, index_b=%u\n", 1736 + j, idex_b)) { 1734 1737 memcpy(&pp->bssid_array[idex_b++], 1735 1738 scan_6ghz_params[j].bssid, ETH_ALEN); 1736 1739 } ··· 3322 3319 3323 3320 ret = iwl_mvm_send_cmd_pdu(mvm, 3324 3321 WIDE_ID(IWL_ALWAYS_LONG_GROUP, SCAN_ABORT_UMAC), 3325 - 0, sizeof(cmd), &cmd); 3322 + CMD_SEND_IN_RFKILL, sizeof(cmd), &cmd); 3326 3323 if (!ret) 3327 3324 mvm->scan_uid_status[uid] = type << IWL_MVM_SCAN_STOPPING_SHIFT; 3328 3325 3326 + IWL_DEBUG_SCAN(mvm, "Scan abort: ret=%d\n", ret); 3329 3327 return ret; 3330 3328 } 3331 3329
+8 -4
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
··· 2848 2848 .action = start ? cpu_to_le32(IWL_RX_BAID_ACTION_ADD) : 2849 2849 cpu_to_le32(IWL_RX_BAID_ACTION_REMOVE), 2850 2850 }; 2851 - u32 cmd_id = WIDE_ID(DATA_PATH_GROUP, RX_BAID_ALLOCATION_CONFIG_CMD); 2851 + struct iwl_host_cmd hcmd = { 2852 + .id = WIDE_ID(DATA_PATH_GROUP, RX_BAID_ALLOCATION_CONFIG_CMD), 2853 + .flags = CMD_SEND_IN_RFKILL, 2854 + .len[0] = sizeof(cmd), 2855 + .data[0] = &cmd, 2856 + }; 2852 2857 int ret; 2853 2858 2854 2859 BUILD_BUG_ON(sizeof(struct iwl_rx_baid_cfg_resp) != sizeof(baid)); ··· 2865 2860 cmd.alloc.ssn = cpu_to_le16(ssn); 2866 2861 cmd.alloc.win_size = cpu_to_le16(buf_size); 2867 2862 baid = -EIO; 2868 - } else if (iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 1) == 1) { 2863 + } else if (iwl_fw_lookup_cmd_ver(mvm->fw, hcmd.id, 1) == 1) { 2869 2864 cmd.remove_v1.baid = cpu_to_le32(baid); 2870 2865 BUILD_BUG_ON(sizeof(cmd.remove_v1) > sizeof(cmd.remove)); 2871 2866 } else { ··· 2874 2869 cmd.remove.tid = cpu_to_le32(tid); 2875 2870 } 2876 2871 2877 - ret = iwl_mvm_send_cmd_pdu_status(mvm, cmd_id, sizeof(cmd), 2878 - &cmd, &baid); 2872 + ret = iwl_mvm_send_cmd_status(mvm, &hcmd, &baid); 2879 2873 if (ret) 2880 2874 return ret; 2881 2875
+5
drivers/net/wireless/intel/iwlwifi/mvm/sta.h
··· 662 662 struct ieee80211_sta *sta); 663 663 int iwl_mvm_mld_rm_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 664 664 struct ieee80211_sta *sta); 665 + void iwl_mvm_mld_free_sta_link(struct iwl_mvm *mvm, 666 + struct iwl_mvm_sta *mvm_sta, 667 + struct iwl_mvm_link_sta *mvm_sta_link, 668 + unsigned int link_id, 669 + bool is_in_fw); 665 670 int iwl_mvm_mld_rm_sta_id(struct iwl_mvm *mvm, u8 sta_id); 666 671 int iwl_mvm_mld_update_sta_links(struct iwl_mvm *mvm, 667 672 struct ieee80211_vif *vif,
+4
drivers/net/wireless/mediatek/mt76/mt7615/main.c
··· 1326 1326 #endif /* CONFIG_PM */ 1327 1327 1328 1328 const struct ieee80211_ops mt7615_ops = { 1329 + .add_chanctx = ieee80211_emulate_add_chanctx, 1330 + .remove_chanctx = ieee80211_emulate_remove_chanctx, 1331 + .change_chanctx = ieee80211_emulate_change_chanctx, 1332 + .switch_vif_chanctx = ieee80211_emulate_switch_vif_chanctx, 1329 1333 .tx = mt7615_tx, 1330 1334 .start = mt7615_start, 1331 1335 .stop = mt7615_stop,
+24 -17
drivers/net/wireless/microchip/wilc1000/cfg80211.c
··· 237 237 struct wilc_vif *vif; 238 238 u32 channelnum; 239 239 int result; 240 + int srcu_idx; 240 241 241 - rcu_read_lock(); 242 + srcu_idx = srcu_read_lock(&wl->srcu); 242 243 vif = wilc_get_wl_to_vif(wl); 243 244 if (IS_ERR(vif)) { 244 - rcu_read_unlock(); 245 + srcu_read_unlock(&wl->srcu, srcu_idx); 245 246 return PTR_ERR(vif); 246 247 } 247 248 ··· 253 252 if (result) 254 253 netdev_err(vif->ndev, "Error in setting channel\n"); 255 254 256 - rcu_read_unlock(); 255 + srcu_read_unlock(&wl->srcu, srcu_idx); 257 256 return result; 258 257 } 259 258 ··· 806 805 struct wilc *wl = wiphy_priv(wiphy); 807 806 struct wilc_vif *vif; 808 807 struct wilc_priv *priv; 808 + int srcu_idx; 809 809 810 - rcu_read_lock(); 810 + srcu_idx = srcu_read_lock(&wl->srcu); 811 811 vif = wilc_get_wl_to_vif(wl); 812 812 if (IS_ERR(vif)) 813 813 goto out; ··· 863 861 netdev_err(priv->dev, "Error in setting WIPHY PARAMS\n"); 864 862 865 863 out: 866 - rcu_read_unlock(); 864 + srcu_read_unlock(&wl->srcu, srcu_idx); 867 865 return ret; 868 866 } 869 867 ··· 1539 1537 1540 1538 if (type == NL80211_IFTYPE_MONITOR) { 1541 1539 struct net_device *ndev; 1540 + int srcu_idx; 1542 1541 1543 - rcu_read_lock(); 1542 + srcu_idx = srcu_read_lock(&wl->srcu); 1544 1543 vif = wilc_get_vif_from_type(wl, WILC_AP_MODE); 1545 1544 if (!vif) { 1546 1545 vif = wilc_get_vif_from_type(wl, WILC_GO_MODE); 1547 1546 if (!vif) { 1548 - rcu_read_unlock(); 1547 + srcu_read_unlock(&wl->srcu, srcu_idx); 1549 1548 goto validate_interface; 1550 1549 } 1551 1550 } 1552 1551 1553 1552 if (vif->monitor_flag) { 1554 - rcu_read_unlock(); 1553 + srcu_read_unlock(&wl->srcu, srcu_idx); 1555 1554 goto validate_interface; 1556 1555 } 1557 1556 ··· 1560 1557 if (ndev) { 1561 1558 vif->monitor_flag = 1; 1562 1559 } else { 1563 - rcu_read_unlock(); 1560 + srcu_read_unlock(&wl->srcu, srcu_idx); 1564 1561 return ERR_PTR(-EINVAL); 1565 1562 } 1566 1563 1567 1564 wdev = &vif->priv.wdev; 1568 - rcu_read_unlock(); 1565 + srcu_read_unlock(&wl->srcu, srcu_idx); 1569 1566 return wdev; 1570 1567 } 1571 1568 ··· 1613 1610 list_del_rcu(&vif->list); 1614 1611 wl->vif_num--; 1615 1612 mutex_unlock(&wl->vif_mutex); 1616 - synchronize_rcu(); 1613 + synchronize_srcu(&wl->srcu); 1617 1614 return 0; 1618 1615 } 1619 1616 ··· 1638 1635 { 1639 1636 struct wilc *wl = wiphy_priv(wiphy); 1640 1637 struct wilc_vif *vif; 1638 + int srcu_idx; 1641 1639 1642 - rcu_read_lock(); 1640 + srcu_idx = srcu_read_lock(&wl->srcu); 1643 1641 vif = wilc_get_wl_to_vif(wl); 1644 1642 if (IS_ERR(vif)) { 1645 - rcu_read_unlock(); 1643 + srcu_read_unlock(&wl->srcu, srcu_idx); 1646 1644 return; 1647 1645 } 1648 1646 1649 1647 netdev_info(vif->ndev, "cfg set wake up = %d\n", enabled); 1650 1648 wilc_set_wowlan_trigger(vif, enabled); 1651 - rcu_read_unlock(); 1649 + srcu_read_unlock(&wl->srcu, srcu_idx); 1652 1650 } 1653 1651 1654 1652 static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, 1655 1653 enum nl80211_tx_power_setting type, int mbm) 1656 1654 { 1657 1655 int ret; 1656 + int srcu_idx; 1658 1657 s32 tx_power = MBM_TO_DBM(mbm); 1659 1658 struct wilc *wl = wiphy_priv(wiphy); 1660 1659 struct wilc_vif *vif; ··· 1664 1659 if (!wl->initialized) 1665 1660 return -EIO; 1666 1661 1667 - rcu_read_lock(); 1662 + srcu_idx = srcu_read_lock(&wl->srcu); 1668 1663 vif = wilc_get_wl_to_vif(wl); 1669 1664 if (IS_ERR(vif)) { 1670 - rcu_read_unlock(); 1665 + srcu_read_unlock(&wl->srcu, srcu_idx); 1671 1666 return -EINVAL; 1672 1667 } 1673 1668 ··· 1679 1674 ret = wilc_set_tx_power(vif, tx_power); 1680 1675 if (ret) 1681 1676 netdev_err(vif->ndev, "Failed to set tx power\n"); 1682 - rcu_read_unlock(); 1677 + srcu_read_unlock(&wl->srcu, srcu_idx); 1683 1678 1684 1679 return ret; 1685 1680 } ··· 1762 1757 init_completion(&wl->cfg_event); 1763 1758 init_completion(&wl->sync_event); 1764 1759 init_completion(&wl->txq_thread_started); 1760 + init_srcu_struct(&wl->srcu); 1765 1761 } 1766 1762 1767 1763 void wlan_deinit_locks(struct wilc *wilc) ··· 1773 1767 mutex_destroy(&wilc->txq_add_to_head_cs); 1774 1768 mutex_destroy(&wilc->vif_mutex); 1775 1769 mutex_destroy(&wilc->deinit_lock); 1770 + cleanup_srcu_struct(&wilc->srcu); 1776 1771 } 1777 1772 1778 1773 int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
+10 -7
drivers/net/wireless/microchip/wilc1000/hif.c
··· 1570 1570 struct host_if_drv *hif_drv; 1571 1571 struct host_if_msg *msg; 1572 1572 struct wilc_vif *vif; 1573 + int srcu_idx; 1573 1574 int result; 1574 1575 int id; 1575 1576 1576 1577 id = get_unaligned_le32(&buffer[length - 4]); 1577 - rcu_read_lock(); 1578 + srcu_idx = srcu_read_lock(&wilc->srcu); 1578 1579 vif = wilc_get_vif_from_idx(wilc, id); 1579 1580 if (!vif) 1580 1581 goto out; ··· 1594 1593 msg->body.net_info.rssi = buffer[8]; 1595 1594 msg->body.net_info.mgmt = kmemdup(&buffer[9], 1596 1595 msg->body.net_info.frame_len, 1597 - GFP_ATOMIC); 1596 + GFP_KERNEL); 1598 1597 if (!msg->body.net_info.mgmt) { 1599 1598 kfree(msg); 1600 1599 goto out; ··· 1607 1606 kfree(msg); 1608 1607 } 1609 1608 out: 1610 - rcu_read_unlock(); 1609 + srcu_read_unlock(&wilc->srcu, srcu_idx); 1611 1610 } 1612 1611 1613 1612 void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length) ··· 1615 1614 struct host_if_drv *hif_drv; 1616 1615 struct host_if_msg *msg; 1617 1616 struct wilc_vif *vif; 1617 + int srcu_idx; 1618 1618 int result; 1619 1619 int id; 1620 1620 1621 1621 mutex_lock(&wilc->deinit_lock); 1622 1622 1623 1623 id = get_unaligned_le32(&buffer[length - 4]); 1624 - rcu_read_lock(); 1624 + srcu_idx = srcu_read_lock(&wilc->srcu); 1625 1625 vif = wilc_get_vif_from_idx(wilc, id); 1626 1626 if (!vif) 1627 1627 goto out; ··· 1649 1647 kfree(msg); 1650 1648 } 1651 1649 out: 1652 - rcu_read_unlock(); 1650 + srcu_read_unlock(&wilc->srcu, srcu_idx); 1653 1651 mutex_unlock(&wilc->deinit_lock); 1654 1652 } 1655 1653 ··· 1657 1655 { 1658 1656 struct host_if_drv *hif_drv; 1659 1657 struct wilc_vif *vif; 1658 + int srcu_idx; 1660 1659 int result; 1661 1660 int id; 1662 1661 1663 1662 id = get_unaligned_le32(&buffer[length - 4]); 1664 - rcu_read_lock(); 1663 + srcu_idx = srcu_read_lock(&wilc->srcu); 1665 1664 vif = wilc_get_vif_from_idx(wilc, id); 1666 1665 if (!vif) 1667 1666 goto out; ··· 1687 1684 } 1688 1685 } 1689 1686 out: 1690 - rcu_read_unlock(); 1687 + srcu_read_unlock(&wilc->srcu, srcu_idx); 1691 1688 } 1692 1689 1693 1690 int wilc_remain_on_channel(struct wilc_vif *vif, u64 cookie, u16 chan,
+25 -18
drivers/net/wireless/microchip/wilc1000/netdev.c
··· 127 127 128 128 int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc) 129 129 { 130 + int srcu_idx; 130 131 u8 ret_val = 0; 131 132 struct wilc_vif *vif; 132 133 133 - rcu_read_lock(); 134 + srcu_idx = srcu_read_lock(&wilc->srcu); 134 135 wilc_for_each_vif(wilc, vif) { 135 136 if (!is_zero_ether_addr(vif->bssid)) 136 137 ret_val++; 137 138 } 138 - rcu_read_unlock(); 139 + srcu_read_unlock(&wilc->srcu, srcu_idx); 139 140 return ret_val; 140 141 } 141 142 142 143 static void wilc_wake_tx_queues(struct wilc *wl) 143 144 { 145 + int srcu_idx; 144 146 struct wilc_vif *ifc; 145 147 146 - rcu_read_lock(); 148 + srcu_idx = srcu_read_lock(&wl->srcu); 147 149 wilc_for_each_vif(wl, ifc) { 148 150 if (ifc->mac_opened && netif_queue_stopped(ifc->ndev)) 149 151 netif_wake_queue(ifc->ndev); 150 152 } 151 - rcu_read_unlock(); 153 + srcu_read_unlock(&wl->srcu, srcu_idx); 152 154 } 153 155 154 156 static int wilc_txq_task(void *vp) ··· 655 653 struct sockaddr *addr = (struct sockaddr *)p; 656 654 unsigned char mac_addr[ETH_ALEN]; 657 655 struct wilc_vif *tmp_vif; 656 + int srcu_idx; 658 657 659 658 if (!is_valid_ether_addr(addr->sa_data)) 660 659 return -EADDRNOTAVAIL; ··· 667 664 668 665 /* Verify MAC Address is not already in use: */ 669 666 670 - rcu_read_lock(); 667 + srcu_idx = srcu_read_lock(&wilc->srcu); 671 668 wilc_for_each_vif(wilc, tmp_vif) { 672 669 wilc_get_mac_address(tmp_vif, mac_addr); 673 670 if (ether_addr_equal(addr->sa_data, mac_addr)) { 674 671 if (vif != tmp_vif) { 675 - rcu_read_unlock(); 672 + srcu_read_unlock(&wilc->srcu, srcu_idx); 676 673 return -EADDRNOTAVAIL; 677 674 } 678 - rcu_read_unlock(); 675 + srcu_read_unlock(&wilc->srcu, srcu_idx); 679 676 return 0; 680 677 } 681 678 } 682 - rcu_read_unlock(); 679 + srcu_read_unlock(&wilc->srcu, srcu_idx); 683 680 684 681 result = wilc_set_mac_address(vif, (u8 *)addr->sa_data); 685 682 if (result) ··· 767 764 wilc_tx_complete); 768 765 769 766 if (queue_count > FLOW_CONTROL_UPPER_THRESHOLD) { 767 + int srcu_idx; 770 768 struct wilc_vif *vif; 771 769 772 - rcu_read_lock(); 770 + srcu_idx = srcu_read_lock(&wilc->srcu); 773 771 wilc_for_each_vif(wilc, vif) { 774 772 if (vif->mac_opened) 775 773 netif_stop_queue(vif->ndev); 776 774 } 777 - rcu_read_unlock(); 775 + srcu_read_unlock(&wilc->srcu, srcu_idx); 778 776 } 779 777 780 778 return NETDEV_TX_OK; ··· 819 815 unsigned int frame_len = 0; 820 816 struct wilc_vif *vif; 821 817 struct sk_buff *skb; 818 + int srcu_idx; 822 819 int stats; 823 820 824 821 if (!wilc) 825 822 return; 826 823 827 - rcu_read_lock(); 824 + srcu_idx = srcu_read_lock(&wilc->srcu); 828 825 wilc_netdev = get_if_handler(wilc, buff); 829 826 if (!wilc_netdev) 830 827 goto out; ··· 853 848 netdev_dbg(wilc_netdev, "netif_rx ret value is: %d\n", stats); 854 849 } 855 850 out: 856 - rcu_read_unlock(); 851 + srcu_read_unlock(&wilc->srcu, srcu_idx); 857 852 } 858 853 859 854 void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size, bool is_auth) 860 855 { 856 + int srcu_idx; 861 857 struct wilc_vif *vif; 862 858 863 - rcu_read_lock(); 859 + srcu_idx = srcu_read_lock(&wilc->srcu); 864 860 wilc_for_each_vif(wilc, vif) { 865 861 struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buff; 866 862 u16 type = le16_to_cpup((__le16 *)buff); ··· 882 876 if (vif->monitor_flag) 883 877 wilc_wfi_monitor_rx(wilc->monitor_dev, buff, size); 884 878 } 885 - rcu_read_unlock(); 879 + srcu_read_unlock(&wilc->srcu, srcu_idx); 886 880 } 887 881 888 882 static const struct net_device_ops wilc_netdev_ops = { ··· 912 906 list_del_rcu(&vif->list); 913 907 wilc->vif_num--; 914 908 mutex_unlock(&wilc->vif_mutex); 915 - synchronize_rcu(); 909 + synchronize_srcu(&wilc->srcu); 916 910 if (vif->ndev) 917 911 unregister_netdev(vif->ndev); 918 912 } ··· 931 925 { 932 926 int idx = 0; 933 927 struct wilc_vif *vif; 928 + int srcu_idx; 934 929 935 - rcu_read_lock(); 930 + srcu_idx = srcu_read_lock(&wl->srcu); 936 931 wilc_for_each_vif(wl, vif) { 937 932 if (vif->idx == 0) 938 933 idx = 1; 939 934 else 940 935 idx = 0; 941 936 } 942 - rcu_read_unlock(); 937 + srcu_read_unlock(&wl->srcu, srcu_idx); 943 938 return idx; 944 939 } 945 940 ··· 990 983 list_add_tail_rcu(&vif->list, &wl->vif_list); 991 984 wl->vif_num += 1; 992 985 mutex_unlock(&wl->vif_mutex); 993 - synchronize_rcu(); 986 + synchronize_srcu(&wl->srcu); 994 987 995 988 return vif; 996 989
+10 -2
drivers/net/wireless/microchip/wilc1000/netdev.h
··· 32 32 33 33 #define wilc_for_each_vif(w, v) \ 34 34 struct wilc *_w = w; \ 35 - list_for_each_entry_rcu(v, &_w->vif_list, list, \ 36 - rcu_read_lock_held()) 35 + list_for_each_entry_srcu(v, &_w->vif_list, list, \ 36 + srcu_read_lock_held(&_w->srcu)) 37 37 38 38 struct wilc_wfi_stats { 39 39 unsigned long rx_packets; ··· 220 220 221 221 /* protect vif list */ 222 222 struct mutex vif_mutex; 223 + /* Sleepable RCU struct to manipulate vif list. Sleepable version is 224 + * needed over the classic RCU version because the driver's current 225 + * design involves some sleeping code while manipulating a vif 226 + * retrieved from vif list (so in a SRCU critical section), like: 227 + * - sending commands to the chip, using info from retrieved vif 228 + * - registering a new monitoring net device 229 + */ 230 + struct srcu_struct srcu; 223 231 u8 open_ifcs; 224 232 225 233 /* protect head of transmit queue */
+3 -2
drivers/net/wireless/microchip/wilc1000/wlan.c
··· 712 712 u32 *vmm_table = wilc->vmm_table; 713 713 u8 ac_pkt_num_to_chip[NQUEUES] = {0, 0, 0, 0}; 714 714 const struct wilc_hif_func *func; 715 + int srcu_idx; 715 716 u8 *txb = wilc->tx_buffer; 716 717 struct wilc_vif *vif; 717 718 ··· 724 723 725 724 mutex_lock(&wilc->txq_add_to_head_cs); 726 725 727 - rcu_read_lock(); 726 + srcu_idx = srcu_read_lock(&wilc->srcu); 728 727 wilc_for_each_vif(wilc, vif) 729 728 wilc_wlan_txq_filter_dup_tcp_ack(vif->ndev); 730 - rcu_read_unlock(); 729 + srcu_read_unlock(&wilc->srcu, srcu_idx); 731 730 732 731 for (ac = 0; ac < NQUEUES; ac++) 733 732 tqe_q[ac] = wilc_wlan_txq_get_first(wilc, ac);
-15
drivers/net/wireless/realtek/rtlwifi/core.c
··· 633 633 } 634 634 } 635 635 636 - if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) { 637 - rtl_dbg(rtlpriv, COMP_MAC80211, DBG_LOUD, 638 - "IEEE80211_CONF_CHANGE_RETRY_LIMITS %x\n", 639 - hw->conf.long_frame_max_tx_count); 640 - /* brought up everything changes (changed == ~0) indicates first 641 - * open, so use our default value instead of that of wiphy. 642 - */ 643 - if (changed != ~0) { 644 - mac->retry_long = hw->conf.long_frame_max_tx_count; 645 - mac->retry_short = hw->conf.long_frame_max_tx_count; 646 - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT, 647 - (u8 *)(&hw->conf.long_frame_max_tx_count)); 648 - } 649 - } 650 - 651 636 if (changed & IEEE80211_CONF_CHANGE_CHANNEL && 652 637 !rtlpriv->proximity.proxim_on) { 653 638 struct ieee80211_channel *channel = hw->conf.chandef.chan;
+1 -1
drivers/net/wwan/iosm/iosm_ipc_devlink.c
··· 211 211 rc = PTR_ERR(devlink->cd_regions[i]); 212 212 dev_err(devlink->dev, "Devlink region fail,err %d", rc); 213 213 /* Delete previously created regions */ 214 - for ( ; i >= 0; i--) 214 + for (i--; i >= 0; i--) 215 215 devlink_region_destroy(devlink->cd_regions[i]); 216 216 goto region_create_fail; 217 217 }
+70 -46
drivers/nvme/host/core.c
··· 414 414 } 415 415 } 416 416 417 - static inline void nvme_end_req(struct request *req) 417 + static inline void __nvme_end_req(struct request *req) 418 + { 419 + nvme_end_req_zoned(req); 420 + nvme_trace_bio_complete(req); 421 + if (req->cmd_flags & REQ_NVME_MPATH) 422 + nvme_mpath_end_request(req); 423 + } 424 + 425 + void nvme_end_req(struct request *req) 418 426 { 419 427 blk_status_t status = nvme_error_status(nvme_req(req)->status); 420 428 ··· 432 424 else 433 425 nvme_log_error(req); 434 426 } 435 - nvme_end_req_zoned(req); 436 - nvme_trace_bio_complete(req); 437 - if (req->cmd_flags & REQ_NVME_MPATH) 438 - nvme_mpath_end_request(req); 427 + __nvme_end_req(req); 439 428 blk_mq_end_request(req, status); 440 429 } 441 430 ··· 481 476 { 482 477 trace_nvme_complete_rq(req); 483 478 nvme_cleanup_cmd(req); 484 - nvme_end_req_zoned(req); 479 + __nvme_end_req(req); 485 480 } 486 481 EXPORT_SYMBOL_GPL(nvme_complete_batch_req); 487 482 ··· 678 673 kfree(ns); 679 674 } 680 675 681 - static inline bool nvme_get_ns(struct nvme_ns *ns) 676 + bool nvme_get_ns(struct nvme_ns *ns) 682 677 { 683 678 return kref_get_unless_zero(&ns->kref); 684 679 } ··· 3684 3679 struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) 3685 3680 { 3686 3681 struct nvme_ns *ns, *ret = NULL; 3682 + int srcu_idx; 3687 3683 3688 - down_read(&ctrl->namespaces_rwsem); 3689 - list_for_each_entry(ns, &ctrl->namespaces, list) { 3684 + srcu_idx = srcu_read_lock(&ctrl->srcu); 3685 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 3690 3686 if (ns->head->ns_id == nsid) { 3691 3687 if (!nvme_get_ns(ns)) 3692 3688 continue; ··· 3697 3691 if (ns->head->ns_id > nsid) 3698 3692 break; 3699 3693 } 3700 - up_read(&ctrl->namespaces_rwsem); 3694 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 3701 3695 return ret; 3702 3696 } 3703 3697 EXPORT_SYMBOL_NS_GPL(nvme_find_get_ns, NVME_TARGET_PASSTHRU); ··· 3711 3705 3712 3706 list_for_each_entry_reverse(tmp, &ns->ctrl->namespaces, list) { 3713 3707 if (tmp->head->ns_id < ns->head->ns_id) { 3714 - list_add(&ns->list, &tmp->list); 3708 + list_add_rcu(&ns->list, &tmp->list); 3715 3709 return; 3716 3710 } 3717 3711 } ··· 3777 3771 if (nvme_update_ns_info(ns, info)) 3778 3772 goto out_unlink_ns; 3779 3773 3780 - down_write(&ctrl->namespaces_rwsem); 3774 + mutex_lock(&ctrl->namespaces_lock); 3781 3775 /* 3782 3776 * Ensure that no namespaces are added to the ctrl list after the queues 3783 3777 * are frozen, thereby avoiding a deadlock between scan and reset. 3784 3778 */ 3785 3779 if (test_bit(NVME_CTRL_FROZEN, &ctrl->flags)) { 3786 - up_write(&ctrl->namespaces_rwsem); 3780 + mutex_unlock(&ctrl->namespaces_lock); 3787 3781 goto out_unlink_ns; 3788 3782 } 3789 3783 nvme_ns_add_to_ctrl_list(ns); 3790 - up_write(&ctrl->namespaces_rwsem); 3784 + mutex_unlock(&ctrl->namespaces_lock); 3785 + synchronize_srcu(&ctrl->srcu); 3791 3786 nvme_get_ctrl(ctrl); 3792 3787 3793 3788 if (device_add_disk(ctrl->device, ns->disk, nvme_ns_attr_groups)) ··· 3811 3804 3812 3805 out_cleanup_ns_from_list: 3813 3806 nvme_put_ctrl(ctrl); 3814 - down_write(&ctrl->namespaces_rwsem); 3815 - list_del_init(&ns->list); 3816 - up_write(&ctrl->namespaces_rwsem); 3807 + mutex_lock(&ctrl->namespaces_lock); 3808 + list_del_rcu(&ns->list); 3809 + mutex_unlock(&ctrl->namespaces_lock); 3810 + synchronize_srcu(&ctrl->srcu); 3817 3811 out_unlink_ns: 3818 3812 mutex_lock(&ctrl->subsys->lock); 3819 3813 list_del_rcu(&ns->siblings); ··· 3864 3856 nvme_cdev_del(&ns->cdev, &ns->cdev_device); 3865 3857 del_gendisk(ns->disk); 3866 3858 3867 - down_write(&ns->ctrl->namespaces_rwsem); 3868 - list_del_init(&ns->list); 3869 - up_write(&ns->ctrl->namespaces_rwsem); 3859 + mutex_lock(&ns->ctrl->namespaces_lock); 3860 + list_del_rcu(&ns->list); 3861 + mutex_unlock(&ns->ctrl->namespaces_lock); 3862 + synchronize_srcu(&ns->ctrl->srcu); 3870 3863 3871 3864 if (last_path) 3872 3865 nvme_mpath_shutdown_disk(ns->head); ··· 3957 3948 struct nvme_ns *ns, *next; 3958 3949 LIST_HEAD(rm_list); 3959 3950 3960 - down_write(&ctrl->namespaces_rwsem); 3951 + mutex_lock(&ctrl->namespaces_lock); 3961 3952 list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) { 3962 3953 if (ns->head->ns_id > nsid) 3963 - list_move_tail(&ns->list, &rm_list); 3954 + list_splice_init_rcu(&ns->list, &rm_list, 3955 + synchronize_rcu); 3964 3956 } 3965 - up_write(&ctrl->namespaces_rwsem); 3957 + mutex_unlock(&ctrl->namespaces_lock); 3958 + synchronize_srcu(&ctrl->srcu); 3966 3959 3967 3960 list_for_each_entry_safe(ns, next, &rm_list, list) 3968 3961 nvme_ns_remove(ns); 3969 - 3970 3962 } 3971 3963 3972 3964 static int nvme_scan_ns_list(struct nvme_ctrl *ctrl) ··· 4137 4127 /* this is a no-op when called from the controller reset handler */ 4138 4128 nvme_change_ctrl_state(ctrl, NVME_CTRL_DELETING_NOIO); 4139 4129 4140 - down_write(&ctrl->namespaces_rwsem); 4141 - list_splice_init(&ctrl->namespaces, &ns_list); 4142 - up_write(&ctrl->namespaces_rwsem); 4130 + mutex_lock(&ctrl->namespaces_lock); 4131 + list_splice_init_rcu(&ctrl->namespaces, &ns_list, synchronize_rcu); 4132 + mutex_unlock(&ctrl->namespaces_lock); 4133 + synchronize_srcu(&ctrl->srcu); 4143 4134 4144 4135 list_for_each_entry_safe(ns, next, &ns_list, list) 4145 4136 nvme_ns_remove(ns); ··· 4588 4577 key_put(ctrl->tls_key); 4589 4578 nvme_free_cels(ctrl); 4590 4579 nvme_mpath_uninit(ctrl); 4580 + cleanup_srcu_struct(&ctrl->srcu); 4591 4581 nvme_auth_stop(ctrl); 4592 4582 nvme_auth_free(ctrl); 4593 4583 __free_page(ctrl->discard_page); ··· 4621 4609 ctrl->passthru_err_log_enabled = false; 4622 4610 clear_bit(NVME_CTRL_FAILFAST_EXPIRED, &ctrl->flags); 4623 4611 spin_lock_init(&ctrl->lock); 4612 + mutex_init(&ctrl->namespaces_lock); 4613 + 4614 + ret = init_srcu_struct(&ctrl->srcu); 4615 + if (ret) 4616 + return ret; 4617 + 4624 4618 mutex_init(&ctrl->scan_lock); 4625 4619 INIT_LIST_HEAD(&ctrl->namespaces); 4626 4620 xa_init(&ctrl->cels); 4627 - init_rwsem(&ctrl->namespaces_rwsem); 4628 4621 ctrl->dev = dev; 4629 4622 ctrl->ops = ops; 4630 4623 ctrl->quirks = quirks; ··· 4709 4692 out: 4710 4693 if (ctrl->discard_page) 4711 4694 __free_page(ctrl->discard_page); 4695 + cleanup_srcu_struct(&ctrl->srcu); 4712 4696 return ret; 4713 4697 } 4714 4698 EXPORT_SYMBOL_GPL(nvme_init_ctrl); ··· 4718 4700 void nvme_mark_namespaces_dead(struct nvme_ctrl *ctrl) 4719 4701 { 4720 4702 struct nvme_ns *ns; 4703 + int srcu_idx; 4721 4704 4722 - down_read(&ctrl->namespaces_rwsem); 4723 - list_for_each_entry(ns, &ctrl->namespaces, list) 4705 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4706 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4724 4707 blk_mark_disk_dead(ns->disk); 4725 - up_read(&ctrl->namespaces_rwsem); 4708 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4726 4709 } 4727 4710 EXPORT_SYMBOL_GPL(nvme_mark_namespaces_dead); 4728 4711 4729 4712 void nvme_unfreeze(struct nvme_ctrl *ctrl) 4730 4713 { 4731 4714 struct nvme_ns *ns; 4715 + int srcu_idx; 4732 4716 4733 - down_read(&ctrl->namespaces_rwsem); 4734 - list_for_each_entry(ns, &ctrl->namespaces, list) 4717 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4718 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4735 4719 blk_mq_unfreeze_queue(ns->queue); 4736 - up_read(&ctrl->namespaces_rwsem); 4720 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4737 4721 clear_bit(NVME_CTRL_FROZEN, &ctrl->flags); 4738 4722 } 4739 4723 EXPORT_SYMBOL_GPL(nvme_unfreeze); ··· 4743 4723 int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) 4744 4724 { 4745 4725 struct nvme_ns *ns; 4726 + int srcu_idx; 4746 4727 4747 - down_read(&ctrl->namespaces_rwsem); 4748 - list_for_each_entry(ns, &ctrl->namespaces, list) { 4728 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4729 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 4749 4730 timeout = blk_mq_freeze_queue_wait_timeout(ns->queue, timeout); 4750 4731 if (timeout <= 0) 4751 4732 break; 4752 4733 } 4753 - up_read(&ctrl->namespaces_rwsem); 4734 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4754 4735 return timeout; 4755 4736 } 4756 4737 EXPORT_SYMBOL_GPL(nvme_wait_freeze_timeout); ··· 4759 4738 void nvme_wait_freeze(struct nvme_ctrl *ctrl) 4760 4739 { 4761 4740 struct nvme_ns *ns; 4741 + int srcu_idx; 4762 4742 4763 - down_read(&ctrl->namespaces_rwsem); 4764 - list_for_each_entry(ns, &ctrl->namespaces, list) 4743 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4744 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4765 4745 blk_mq_freeze_queue_wait(ns->queue); 4766 - up_read(&ctrl->namespaces_rwsem); 4746 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4767 4747 } 4768 4748 EXPORT_SYMBOL_GPL(nvme_wait_freeze); 4769 4749 4770 4750 void nvme_start_freeze(struct nvme_ctrl *ctrl) 4771 4751 { 4772 4752 struct nvme_ns *ns; 4753 + int srcu_idx; 4773 4754 4774 4755 set_bit(NVME_CTRL_FROZEN, &ctrl->flags); 4775 - down_read(&ctrl->namespaces_rwsem); 4776 - list_for_each_entry(ns, &ctrl->namespaces, list) 4756 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4757 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4777 4758 blk_freeze_queue_start(ns->queue); 4778 - up_read(&ctrl->namespaces_rwsem); 4759 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4779 4760 } 4780 4761 EXPORT_SYMBOL_GPL(nvme_start_freeze); 4781 4762 ··· 4820 4797 void nvme_sync_io_queues(struct nvme_ctrl *ctrl) 4821 4798 { 4822 4799 struct nvme_ns *ns; 4800 + int srcu_idx; 4823 4801 4824 - down_read(&ctrl->namespaces_rwsem); 4825 - list_for_each_entry(ns, &ctrl->namespaces, list) 4802 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4803 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4826 4804 blk_sync_queue(ns->queue); 4827 - up_read(&ctrl->namespaces_rwsem); 4805 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4828 4806 } 4829 4807 EXPORT_SYMBOL_GPL(nvme_sync_io_queues); 4830 4808
+9 -6
drivers/nvme/host/ioctl.c
··· 789 789 bool open_for_write) 790 790 { 791 791 struct nvme_ns *ns; 792 - int ret; 792 + int ret, srcu_idx; 793 793 794 - down_read(&ctrl->namespaces_rwsem); 794 + srcu_idx = srcu_read_lock(&ctrl->srcu); 795 795 if (list_empty(&ctrl->namespaces)) { 796 796 ret = -ENOTTY; 797 797 goto out_unlock; 798 798 } 799 799 800 - ns = list_first_entry(&ctrl->namespaces, struct nvme_ns, list); 800 + ns = list_first_or_null_rcu(&ctrl->namespaces, struct nvme_ns, list); 801 801 if (ns != list_last_entry(&ctrl->namespaces, struct nvme_ns, list)) { 802 802 dev_warn(ctrl->device, 803 803 "NVME_IOCTL_IO_CMD not supported when multiple namespaces present!\n"); ··· 807 807 808 808 dev_warn(ctrl->device, 809 809 "using deprecated NVME_IOCTL_IO_CMD ioctl on the char device!\n"); 810 - kref_get(&ns->kref); 811 - up_read(&ctrl->namespaces_rwsem); 810 + if (!nvme_get_ns(ns)) { 811 + ret = -ENXIO; 812 + goto out_unlock; 813 + } 814 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 812 815 813 816 ret = nvme_user_cmd(ctrl, ns, argp, 0, open_for_write); 814 817 nvme_put_ns(ns); 815 818 return ret; 816 819 817 820 out_unlock: 818 - up_read(&ctrl->namespaces_rwsem); 821 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 819 822 return ret; 820 823 } 821 824
+15 -11
drivers/nvme/host/multipath.c
··· 118 118 blk_steal_bios(&ns->head->requeue_list, req); 119 119 spin_unlock_irqrestore(&ns->head->requeue_lock, flags); 120 120 121 - blk_mq_end_request(req, 0); 121 + nvme_req(req)->status = 0; 122 + nvme_end_req(req); 122 123 kblockd_schedule_work(&ns->head->requeue_work); 123 124 } 124 125 ··· 151 150 void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl) 152 151 { 153 152 struct nvme_ns *ns; 153 + int srcu_idx; 154 154 155 - down_read(&ctrl->namespaces_rwsem); 156 - list_for_each_entry(ns, &ctrl->namespaces, list) { 155 + srcu_idx = srcu_read_lock(&ctrl->srcu); 156 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 157 157 if (!ns->head->disk) 158 158 continue; 159 159 kblockd_schedule_work(&ns->head->requeue_work); 160 160 if (nvme_ctrl_state(ns->ctrl) == NVME_CTRL_LIVE) 161 161 disk_uevent(ns->head->disk, KOBJ_CHANGE); 162 162 } 163 - up_read(&ctrl->namespaces_rwsem); 163 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 164 164 } 165 165 166 166 static const char *nvme_ana_state_names[] = { ··· 195 193 void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl) 196 194 { 197 195 struct nvme_ns *ns; 196 + int srcu_idx; 198 197 199 - down_read(&ctrl->namespaces_rwsem); 200 - list_for_each_entry(ns, &ctrl->namespaces, list) { 198 + srcu_idx = srcu_read_lock(&ctrl->srcu); 199 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 201 200 nvme_mpath_clear_current_path(ns); 202 201 kblockd_schedule_work(&ns->head->requeue_work); 203 202 } 204 - up_read(&ctrl->namespaces_rwsem); 203 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 205 204 } 206 205 207 206 void nvme_mpath_revalidate_paths(struct nvme_ns *ns) ··· 598 595 int node, srcu_idx; 599 596 600 597 srcu_idx = srcu_read_lock(&head->srcu); 601 - for_each_node(node) 598 + for_each_online_node(node) 602 599 __nvme_find_path(head, node); 603 600 srcu_read_unlock(&head->srcu, srcu_idx); 604 601 } ··· 683 680 u32 nr_nsids = le32_to_cpu(desc->nnsids), n = 0; 684 681 unsigned *nr_change_groups = data; 685 682 struct nvme_ns *ns; 683 + int srcu_idx; 686 684 687 685 dev_dbg(ctrl->device, "ANA group %d: %s.\n", 688 686 le32_to_cpu(desc->grpid), ··· 695 691 if (!nr_nsids) 696 692 return 0; 697 693 698 - down_read(&ctrl->namespaces_rwsem); 699 - list_for_each_entry(ns, &ctrl->namespaces, list) { 694 + srcu_idx = srcu_read_lock(&ctrl->srcu); 695 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 700 696 unsigned nsid; 701 697 again: 702 698 nsid = le32_to_cpu(desc->nsids[n]); ··· 709 705 if (ns->head->ns_id > nsid) 710 706 goto again; 711 707 } 712 - up_read(&ctrl->namespaces_rwsem); 708 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 713 709 return 0; 714 710 } 715 711
+4 -3
drivers/nvme/host/nvme.h
··· 282 282 struct blk_mq_tag_set *tagset; 283 283 struct blk_mq_tag_set *admin_tagset; 284 284 struct list_head namespaces; 285 - struct rw_semaphore namespaces_rwsem; 285 + struct mutex namespaces_lock; 286 + struct srcu_struct srcu; 286 287 struct device ctrl_device; 287 288 struct device *device; /* char device */ 288 289 #ifdef CONFIG_NVME_HWMON ··· 472 471 u8 pi_type; 473 472 u8 pi_offset; 474 473 u8 guard_type; 475 - u16 sgs; 476 - u32 sws; 477 474 #ifdef CONFIG_BLK_DEV_ZONED 478 475 u64 zsze; 479 476 #endif ··· 766 767 } 767 768 } 768 769 770 + void nvme_end_req(struct request *req); 769 771 void nvme_complete_rq(struct request *req); 770 772 void nvme_complete_batch_req(struct request *req); 771 773 ··· 1161 1161 struct nvme_command *cmd, int status); 1162 1162 struct nvme_ctrl *nvme_ctrl_from_file(struct file *file); 1163 1163 struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid); 1164 + bool nvme_get_ns(struct nvme_ns *ns); 1164 1165 void nvme_put_ns(struct nvme_ns *ns); 1165 1166 1166 1167 static inline bool nvme_multi_css(struct nvme_ctrl *ctrl)
+2 -1
drivers/nvme/host/pci.c
··· 778 778 struct bio_vec bv = req_bvec(req); 779 779 780 780 if (!is_pci_p2pdma_page(bv.bv_page)) { 781 - if (bv.bv_offset + bv.bv_len <= NVME_CTRL_PAGE_SIZE * 2) 781 + if ((bv.bv_offset & (NVME_CTRL_PAGE_SIZE - 1)) + 782 + bv.bv_len <= NVME_CTRL_PAGE_SIZE * 2) 782 783 return nvme_setup_prp_simple(dev, req, 783 784 &cmnd->rw, &bv); 784 785
+8
drivers/nvme/target/configfs.c
··· 676 676 if (kstrtobool(page, &enable)) 677 677 return -EINVAL; 678 678 679 + /* 680 + * take a global nvmet_config_sem because the disable routine has a 681 + * window where it releases the subsys-lock, giving a chance to 682 + * a parallel enable to concurrently execute causing the disable to 683 + * have a misaccounting of the ns percpu_ref. 684 + */ 685 + down_write(&nvmet_config_sem); 679 686 if (enable) 680 687 ret = nvmet_ns_enable(ns); 681 688 else 682 689 nvmet_ns_disable(ns); 690 + up_write(&nvmet_config_sem); 683 691 684 692 return ret ? ret : count; 685 693 }
+9
drivers/nvme/target/core.c
··· 818 818 percpu_ref_exit(&sq->ref); 819 819 nvmet_auth_sq_free(sq); 820 820 821 + /* 822 + * we must reference the ctrl again after waiting for inflight IO 823 + * to complete. Because admin connect may have sneaked in after we 824 + * store sq->ctrl locally, but before we killed the percpu_ref. the 825 + * admin connect allocates and assigns sq->ctrl, which now needs a 826 + * final ref put, as this ctrl is going away. 827 + */ 828 + ctrl = sq->ctrl; 829 + 821 830 if (ctrl) { 822 831 /* 823 832 * The teardown flow may take some time, and the host may not
+74 -51
drivers/of/irq.c
··· 25 25 #include <linux/string.h> 26 26 #include <linux/slab.h> 27 27 28 + #include "of_private.h" 29 + 28 30 /** 29 31 * irq_of_parse_and_map - Parse and map an interrupt into linux virq space 30 32 * @dev: Device node of the device whose interrupt is to be mapped ··· 98 96 NULL, 99 97 }; 100 98 99 + const __be32 *of_irq_parse_imap_parent(const __be32 *imap, int len, struct of_phandle_args *out_irq) 100 + { 101 + u32 intsize, addrsize; 102 + struct device_node *np; 103 + 104 + /* Get the interrupt parent */ 105 + if (of_irq_workarounds & OF_IMAP_NO_PHANDLE) 106 + np = of_node_get(of_irq_dflt_pic); 107 + else 108 + np = of_find_node_by_phandle(be32_to_cpup(imap)); 109 + imap++; 110 + 111 + /* Check if not found */ 112 + if (!np) { 113 + pr_debug(" -> imap parent not found !\n"); 114 + return NULL; 115 + } 116 + 117 + /* Get #interrupt-cells and #address-cells of new parent */ 118 + if (of_property_read_u32(np, "#interrupt-cells", 119 + &intsize)) { 120 + pr_debug(" -> parent lacks #interrupt-cells!\n"); 121 + of_node_put(np); 122 + return NULL; 123 + } 124 + if (of_property_read_u32(np, "#address-cells", 125 + &addrsize)) 126 + addrsize = 0; 127 + 128 + pr_debug(" -> intsize=%d, addrsize=%d\n", 129 + intsize, addrsize); 130 + 131 + /* Check for malformed properties */ 132 + if (WARN_ON(addrsize + intsize > MAX_PHANDLE_ARGS) 133 + || (len < (addrsize + intsize))) { 134 + of_node_put(np); 135 + return NULL; 136 + } 137 + 138 + pr_debug(" -> imaplen=%d\n", len); 139 + 140 + imap += addrsize + intsize; 141 + 142 + out_irq->np = np; 143 + for (int i = 0; i < intsize; i++) 144 + out_irq->args[i] = be32_to_cpup(imap - intsize + i); 145 + out_irq->args_count = intsize; 146 + 147 + return imap; 148 + } 149 + 101 150 /** 102 151 * of_irq_parse_raw - Low level interrupt tree parsing 103 152 * @addr: address specifier (start of "reg" property of the device) in be32 format ··· 165 112 */ 166 113 int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) 167 114 { 168 - struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; 115 + struct device_node *ipar, *tnode, *old = NULL; 169 116 __be32 initial_match_array[MAX_PHANDLE_ARGS]; 170 117 const __be32 *match_array = initial_match_array; 171 - const __be32 *tmp, *imap, *imask, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = cpu_to_be32(~0) }; 172 - u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; 173 - int imaplen, match, i, rc = -EINVAL; 118 + const __be32 *tmp, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = cpu_to_be32(~0) }; 119 + u32 intsize = 1, addrsize; 120 + int i, rc = -EINVAL; 174 121 175 122 #ifdef DEBUG 176 123 of_print_phandle_args("of_irq_parse_raw: ", out_irq); ··· 229 176 230 177 /* Now start the actual "proper" walk of the interrupt tree */ 231 178 while (ipar != NULL) { 179 + int imaplen, match; 180 + const __be32 *imap, *oldimap, *imask; 181 + struct device_node *newpar; 232 182 /* 233 183 * Now check if cursor is an interrupt-controller and 234 184 * if it is then we are done, unless there is an ··· 272 216 273 217 /* Parse interrupt-map */ 274 218 match = 0; 275 - while (imaplen > (addrsize + intsize + 1) && !match) { 219 + while (imaplen > (addrsize + intsize + 1)) { 276 220 /* Compare specifiers */ 277 221 match = 1; 278 222 for (i = 0; i < (addrsize + intsize); i++, imaplen--) ··· 280 224 281 225 pr_debug(" -> match=%d (imaplen=%d)\n", match, imaplen); 282 226 283 - /* Get the interrupt parent */ 284 - if (of_irq_workarounds & OF_IMAP_NO_PHANDLE) 285 - newpar = of_node_get(of_irq_dflt_pic); 286 - else 287 - newpar = of_find_node_by_phandle(be32_to_cpup(imap)); 288 - imap++; 289 - --imaplen; 290 - 291 - /* Check if not found */ 292 - if (newpar == NULL) { 293 - pr_debug(" -> imap parent not found !\n"); 227 + oldimap = imap; 228 + imap = of_irq_parse_imap_parent(oldimap, imaplen, out_irq); 229 + if (!imap) 294 230 goto fail; 295 - } 296 231 297 - if (!of_device_is_available(newpar)) 298 - match = 0; 232 + match &= of_device_is_available(out_irq->np); 233 + if (match) 234 + break; 299 235 300 - /* Get #interrupt-cells and #address-cells of new 301 - * parent 302 - */ 303 - if (of_property_read_u32(newpar, "#interrupt-cells", 304 - &newintsize)) { 305 - pr_debug(" -> parent lacks #interrupt-cells!\n"); 306 - goto fail; 307 - } 308 - if (of_property_read_u32(newpar, "#address-cells", 309 - &newaddrsize)) 310 - newaddrsize = 0; 311 - 312 - pr_debug(" -> newintsize=%d, newaddrsize=%d\n", 313 - newintsize, newaddrsize); 314 - 315 - /* Check for malformed properties */ 316 - if (WARN_ON(newaddrsize + newintsize > MAX_PHANDLE_ARGS) 317 - || (imaplen < (newaddrsize + newintsize))) { 318 - rc = -EFAULT; 319 - goto fail; 320 - } 321 - 322 - imap += newaddrsize + newintsize; 323 - imaplen -= newaddrsize + newintsize; 324 - 236 + of_node_put(out_irq->np); 237 + imaplen -= imap - oldimap; 325 238 pr_debug(" -> imaplen=%d\n", imaplen); 326 239 } 327 240 if (!match) { ··· 312 287 * Successfully parsed an interrupt-map translation; copy new 313 288 * interrupt specifier into the out_irq structure 314 289 */ 315 - match_array = imap - newaddrsize - newintsize; 316 - for (i = 0; i < newintsize; i++) 317 - out_irq->args[i] = be32_to_cpup(imap - newintsize + i); 318 - out_irq->args_count = intsize = newintsize; 319 - addrsize = newaddrsize; 290 + match_array = oldimap + 1; 291 + 292 + newpar = out_irq->np; 293 + intsize = out_irq->args_count; 294 + addrsize = (imap - match_array) - intsize; 320 295 321 296 if (ipar == newpar) { 322 297 pr_debug("%pOF interrupt-map entry to self\n", ipar); ··· 325 300 326 301 skiplevel: 327 302 /* Iterate again with new parent */ 328 - out_irq->np = newpar; 329 303 pr_debug(" -> new parent: %pOF\n", newpar); 330 304 of_node_put(ipar); 331 305 ipar = newpar; ··· 334 310 335 311 fail: 336 312 of_node_put(ipar); 337 - of_node_put(newpar); 338 313 339 314 return rc; 340 315 }
+3
drivers/of/of_private.h
··· 159 159 extern int of_bus_n_addr_cells(struct device_node *np); 160 160 extern int of_bus_n_size_cells(struct device_node *np); 161 161 162 + const __be32 *of_irq_parse_imap_parent(const __be32 *imap, int len, 163 + struct of_phandle_args *out_irq); 164 + 162 165 struct bus_dma_region; 163 166 #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_HAS_DMA) 164 167 int of_dma_get_range(struct device_node *np,
+1
drivers/of/of_test.c
··· 54 54 kunit_test_suites( 55 55 &of_dtb_suite, 56 56 ); 57 + MODULE_DESCRIPTION("KUnit tests for OF APIs"); 57 58 MODULE_LICENSE("GPL");
+10 -20
drivers/of/property.c
··· 1306 1306 static struct device_node *parse_interrupt_map(struct device_node *np, 1307 1307 const char *prop_name, int index) 1308 1308 { 1309 - const __be32 *imap, *imap_end, *addr; 1309 + const __be32 *imap, *imap_end; 1310 1310 struct of_phandle_args sup_args; 1311 1311 u32 addrcells, intcells; 1312 - int i, imaplen; 1312 + int imaplen; 1313 1313 1314 1314 if (!IS_ENABLED(CONFIG_OF_IRQ)) 1315 1315 return NULL; ··· 1322 1322 addrcells = of_bus_n_addr_cells(np); 1323 1323 1324 1324 imap = of_get_property(np, "interrupt-map", &imaplen); 1325 - if (!imap || imaplen <= (addrcells + intcells)) 1325 + imaplen /= sizeof(*imap); 1326 + if (!imap) 1326 1327 return NULL; 1328 + 1327 1329 imap_end = imap + imaplen; 1328 1330 1329 - while (imap < imap_end) { 1330 - addr = imap; 1331 - imap += addrcells; 1331 + for (int i = 0; imap + addrcells + intcells + 1 < imap_end; i++) { 1332 + imap += addrcells + intcells; 1332 1333 1333 - sup_args.np = np; 1334 - sup_args.args_count = intcells; 1335 - for (i = 0; i < intcells; i++) 1336 - sup_args.args[i] = be32_to_cpu(imap[i]); 1337 - imap += intcells; 1338 - 1339 - /* 1340 - * Upon success, the function of_irq_parse_raw() returns 1341 - * interrupt controller DT node pointer in sup_args.np. 1342 - */ 1343 - if (of_irq_parse_raw(addr, &sup_args)) 1334 + imap = of_irq_parse_imap_parent(imap, imap_end - imap, &sup_args); 1335 + if (!imap) 1344 1336 return NULL; 1345 1337 1346 - if (!index) 1338 + if (i == index) 1347 1339 return sup_args.np; 1348 1340 1349 1341 of_node_put(sup_args.np); 1350 - imap += sup_args.args_count + 1; 1351 - index--; 1352 1342 } 1353 1343 1354 1344 return NULL;
+1
drivers/platform/x86/Kconfig
··· 515 515 select NVRAM 516 516 select NEW_LEDS 517 517 select LEDS_CLASS 518 + select INPUT_SPARSEKMAP 518 519 help 519 520 This is a driver for the IBM and Lenovo ThinkPad laptops. It adds 520 521 support for Fn-Fx key combinations, Bluetooth control, video
+1 -1
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
··· 1610 1610 tpmi_sst->partition_mask_current &= ~BIT(plat_info->partition); 1611 1611 /* Free the package instance when the all partitions are removed */ 1612 1612 if (!tpmi_sst->partition_mask_current) { 1613 - kfree(tpmi_sst); 1614 1613 isst_common.sst_inst[tpmi_sst->package_id] = NULL; 1614 + kfree(tpmi_sst); 1615 1615 } 1616 1616 mutex_unlock(&isst_tpmi_dev_lock); 1617 1617 }
+113 -4
drivers/platform/x86/touchscreen_dmi.c
··· 9 9 */ 10 10 11 11 #include <linux/acpi.h> 12 + #include <linux/ctype.h> 12 13 #include <linux/device.h> 13 14 #include <linux/dmi.h> 14 15 #include <linux/efi_embedded_fw.h> 15 16 #include <linux/i2c.h> 17 + #include <linux/init.h> 18 + #include <linux/kstrtox.h> 16 19 #include <linux/notifier.h> 17 20 #include <linux/property.h> 18 21 #include <linux/string.h> ··· 900 897 .properties = schneider_sct101ctm_props, 901 898 }; 902 899 900 + static const struct property_entry globalspace_solt_ivw116_props[] = { 901 + PROPERTY_ENTRY_U32("touchscreen-min-x", 7), 902 + PROPERTY_ENTRY_U32("touchscreen-min-y", 22), 903 + PROPERTY_ENTRY_U32("touchscreen-size-x", 1723), 904 + PROPERTY_ENTRY_U32("touchscreen-size-y", 1077), 905 + PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-globalspace-solt-ivw116.fw"), 906 + PROPERTY_ENTRY_U32("silead,max-fingers", 10), 907 + PROPERTY_ENTRY_BOOL("silead,home-button"), 908 + { } 909 + }; 910 + 911 + static const struct ts_dmi_data globalspace_solt_ivw116_data = { 912 + .acpi_name = "MSSL1680:00", 913 + .properties = globalspace_solt_ivw116_props, 914 + }; 915 + 903 916 static const struct property_entry techbite_arc_11_6_props[] = { 904 917 PROPERTY_ENTRY_U32("touchscreen-min-x", 5), 905 918 PROPERTY_ENTRY_U32("touchscreen-min-y", 7), ··· 1405 1386 }, 1406 1387 }, 1407 1388 { 1389 + /* Jumper EZpad 6s Pro */ 1390 + .driver_data = (void *)&jumper_ezpad_6_pro_b_data, 1391 + .matches = { 1392 + DMI_MATCH(DMI_SYS_VENDOR, "Jumper"), 1393 + DMI_MATCH(DMI_PRODUCT_NAME, "Ezpad"), 1394 + /* Above matches are too generic, add bios match */ 1395 + DMI_MATCH(DMI_BIOS_VERSION, "E.WSA116_8.E1.042.bin"), 1396 + DMI_MATCH(DMI_BIOS_DATE, "01/08/2020"), 1397 + }, 1398 + }, 1399 + { 1408 1400 /* Jumper EZpad 6 m4 */ 1409 1401 .driver_data = (void *)&jumper_ezpad_6_m4_data, 1410 1402 .matches = { ··· 1655 1625 }, 1656 1626 }, 1657 1627 { 1628 + /* GlobalSpace SoLT IVW 11.6" */ 1629 + .driver_data = (void *)&globalspace_solt_ivw116_data, 1630 + .matches = { 1631 + DMI_MATCH(DMI_SYS_VENDOR, "Globalspace Tech Pvt Ltd"), 1632 + DMI_MATCH(DMI_PRODUCT_NAME, "SolTIVW"), 1633 + DMI_MATCH(DMI_PRODUCT_SKU, "PN20170413488"), 1634 + }, 1635 + }, 1636 + { 1658 1637 /* Techbite Arc 11.6 */ 1659 1638 .driver_data = (void *)&techbite_arc_11_6_data, 1660 1639 .matches = { ··· 1856 1817 { } 1857 1818 }; 1858 1819 1859 - static const struct ts_dmi_data *ts_data; 1820 + static struct ts_dmi_data *ts_data; 1860 1821 1861 1822 static void ts_dmi_add_props(struct i2c_client *client) 1862 1823 { ··· 1891 1852 return 0; 1892 1853 } 1893 1854 1855 + #define MAX_CMDLINE_PROPS 16 1856 + 1857 + static struct property_entry ts_cmdline_props[MAX_CMDLINE_PROPS + 1]; 1858 + 1859 + static struct ts_dmi_data ts_cmdline_data = { 1860 + .properties = ts_cmdline_props, 1861 + }; 1862 + 1863 + static int __init ts_parse_props(char *str) 1864 + { 1865 + /* Save the original str to show it on syntax errors */ 1866 + char orig_str[256]; 1867 + char *name, *value; 1868 + u32 u32val; 1869 + int i, ret; 1870 + 1871 + strscpy(orig_str, str, sizeof(orig_str)); 1872 + 1873 + /* 1874 + * str is part of the static_command_line from init/main.c and poking 1875 + * holes in that by writing 0 to it is allowed, as is taking long 1876 + * lasting references to it. 1877 + */ 1878 + ts_cmdline_data.acpi_name = strsep(&str, ":"); 1879 + 1880 + for (i = 0; i < MAX_CMDLINE_PROPS; i++) { 1881 + name = strsep(&str, ":"); 1882 + if (!name || !name[0]) 1883 + break; 1884 + 1885 + /* Replace '=' with 0 and make value point past '=' or NULL */ 1886 + value = name; 1887 + strsep(&value, "="); 1888 + if (!value) { 1889 + ts_cmdline_props[i] = PROPERTY_ENTRY_BOOL(name); 1890 + } else if (isdigit(value[0])) { 1891 + ret = kstrtou32(value, 0, &u32val); 1892 + if (ret) 1893 + goto syntax_error; 1894 + 1895 + ts_cmdline_props[i] = PROPERTY_ENTRY_U32(name, u32val); 1896 + } else { 1897 + ts_cmdline_props[i] = PROPERTY_ENTRY_STRING(name, value); 1898 + } 1899 + } 1900 + 1901 + if (!i || str) 1902 + goto syntax_error; 1903 + 1904 + ts_data = &ts_cmdline_data; 1905 + return 1; 1906 + 1907 + syntax_error: 1908 + pr_err("Invalid '%s' value for 'i2c_touchscreen_props='\n", orig_str); 1909 + return 1; /* "i2c_touchscreen_props=" is still a known parameter */ 1910 + } 1911 + __setup("i2c_touchscreen_props=", ts_parse_props); 1912 + 1894 1913 static struct notifier_block ts_dmi_notifier = { 1895 1914 .notifier_call = ts_dmi_notifier_call, 1896 1915 }; ··· 1956 1859 static int __init ts_dmi_init(void) 1957 1860 { 1958 1861 const struct dmi_system_id *dmi_id; 1862 + struct ts_dmi_data *ts_data_dmi; 1959 1863 int error; 1960 1864 1961 1865 dmi_id = dmi_first_match(touchscreen_dmi_table); 1962 - if (!dmi_id) 1963 - return 0; /* Not an error */ 1866 + ts_data_dmi = dmi_id ? dmi_id->driver_data : NULL; 1964 1867 1965 - ts_data = dmi_id->driver_data; 1868 + if (ts_data) { 1869 + /* 1870 + * Kernel cmdline provided data takes precedence, copy over 1871 + * DMI efi_embedded_fw info if available. 1872 + */ 1873 + if (ts_data_dmi) 1874 + ts_data->embedded_fw = ts_data_dmi->embedded_fw; 1875 + } else if (ts_data_dmi) { 1876 + ts_data = ts_data_dmi; 1877 + } else { 1878 + return 0; /* Not an error */ 1879 + } 1880 + 1966 1881 /* Some dmi table entries only provide an efi_embedded_fw_desc */ 1967 1882 if (!ts_data->properties) 1968 1883 return 0;
+2
drivers/platform/x86/x86-android-tablets/Kconfig
··· 6 6 config X86_ANDROID_TABLETS 7 7 tristate "X86 Android tablet support" 8 8 depends on I2C && SPI && SERIAL_DEV_BUS && ACPI && EFI && GPIOLIB && PMIC_OPREGION 9 + select NEW_LEDS 10 + select LEDS_CLASS 9 11 help 10 12 X86 tablets which ship with Android as (part of) the factory image 11 13 typically have various problems with their DSDTs. The factory kernels
+1
drivers/pnp/base.h
··· 6 6 7 7 extern struct mutex pnp_lock; 8 8 extern const struct attribute_group *pnp_dev_groups[]; 9 + extern const struct bus_type pnp_bus_type; 9 10 10 11 int pnp_register_protocol(struct pnp_protocol *protocol); 11 12 void pnp_unregister_protocol(struct pnp_protocol *protocol);
+6
drivers/pnp/driver.c
··· 266 266 .dev_groups = pnp_dev_groups, 267 267 }; 268 268 269 + bool dev_is_pnp(const struct device *dev) 270 + { 271 + return dev->bus == &pnp_bus_type; 272 + } 273 + EXPORT_SYMBOL_GPL(dev_is_pnp); 274 + 269 275 int pnp_register_driver(struct pnp_driver *drv) 270 276 { 271 277 drv->driver.name = drv->name;
+2 -1
drivers/ptp/ptp_chardev.c
··· 85 85 } 86 86 87 87 if (info->verify(info, pin, func, chan)) { 88 - pr_err("driver cannot use function %u on pin %u\n", func, chan); 88 + pr_err("driver cannot use function %u and channel %u on pin %u\n", 89 + func, chan, pin); 89 90 return -EOPNOTSUPP; 90 91 } 91 92
+12 -10
drivers/regulator/rtq2208-regulator.c
··· 228 228 .set_suspend_disable = rtq2208_set_suspend_disable, 229 229 }; 230 230 231 + static struct of_regulator_match rtq2208_ldo_match[] = { 232 + {.name = "ldo2", }, 233 + {.name = "ldo1", }, 234 + }; 235 + 231 236 static unsigned int rtq2208_of_map_mode(unsigned int mode) 232 237 { 233 238 switch (mode) { ··· 327 322 return IRQ_HANDLED; 328 323 } 329 324 330 - static int rtq2208_of_get_fixed_voltage(struct device *dev, 331 - struct of_regulator_match *rtq2208_ldo_match, int n_fixed) 325 + static int rtq2208_of_get_ldo_dvs_ability(struct device *dev) 332 326 { 333 327 struct device_node *np; 334 328 struct of_regulator_match *match; ··· 342 338 if (!np) 343 339 np = dev->of_node; 344 340 345 - ret = of_regulator_match(dev, np, rtq2208_ldo_match, n_fixed); 341 + ret = of_regulator_match(dev, np, rtq2208_ldo_match, ARRAY_SIZE(rtq2208_ldo_match)); 346 342 347 343 of_node_put(np); 348 344 349 345 if (ret < 0) 350 346 return ret; 351 347 352 - for (i = 0; i < n_fixed; i++) { 348 + for (i = 0; i < ARRAY_SIZE(rtq2208_ldo_match); i++) { 353 349 match = rtq2208_ldo_match + i; 354 350 init_data = match->init_data; 355 351 rdesc = (struct rtq2208_regulator_desc *)match->driver_data; ··· 392 388 REGULATOR_LINEAR_RANGE(1310000, 181, 255, 10000), 393 389 }; 394 390 395 - static void rtq2208_init_regulator_desc(struct rtq2208_regulator_desc *rdesc, int mtp_sel, 396 - int idx, struct of_regulator_match *rtq2208_ldo_match, int *ldo_idx) 391 + static void rtq2208_init_regulator_desc(struct rtq2208_regulator_desc *rdesc, int mtp_sel, int idx) 397 392 { 398 393 struct regulator_desc *desc; 399 394 static const struct { ··· 464 461 static int rtq2208_parse_regulator_dt_data(int n_regulator, const unsigned int *regulator_idx_table, 465 462 struct rtq2208_regulator_desc *rdesc[RTQ2208_LDO_MAX], struct device *dev) 466 463 { 467 - struct of_regulator_match rtq2208_ldo_match[2]; 468 - int mtp_sel, ret, i, idx, ldo_idx = 0; 464 + int mtp_sel, i, idx, ret; 469 465 470 466 /* get mtp_sel0 or mtp_sel1 */ 471 467 mtp_sel = device_property_read_bool(dev, "richtek,mtp-sel-high"); ··· 476 474 if (!rdesc[i]) 477 475 return -ENOMEM; 478 476 479 - rtq2208_init_regulator_desc(rdesc[i], mtp_sel, idx, rtq2208_ldo_match, &ldo_idx); 477 + rtq2208_init_regulator_desc(rdesc[i], mtp_sel, idx); 480 478 481 479 /* init ldo dvs ability */ 482 480 if (idx >= RTQ2208_LDO2) ··· 484 482 } 485 483 486 484 /* init ldo fixed_uV */ 487 - ret = rtq2208_of_get_fixed_voltage(dev, rtq2208_ldo_match, ldo_idx); 485 + ret = rtq2208_of_get_ldo_dvs_ability(dev); 488 486 if (ret) 489 487 return dev_err_probe(dev, ret, "Failed to get ldo fixed_uV\n"); 490 488
+1 -1
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 4774 4774 char desc[17] = {0}; 4775 4775 u32 iounit_pg1_flags; 4776 4776 4777 - strscpy(desc, ioc->manu_pg0.ChipName, sizeof(desc)); 4777 + memtostr(desc, ioc->manu_pg0.ChipName); 4778 4778 ioc_info(ioc, "%s: FWVersion(%02d.%02d.%02d.%02d), ChipRevision(0x%02x)\n", 4779 4779 desc, 4780 4780 (ioc->facts.FWVersion.Word & 0xFF000000) >> 24,
+5 -9
drivers/scsi/mpt3sas/mpt3sas_transport.c
··· 458 458 goto out; 459 459 460 460 manufacture_reply = data_out + sizeof(struct rep_manu_request); 461 - strscpy(edev->vendor_id, manufacture_reply->vendor_id, 462 - sizeof(edev->vendor_id)); 463 - strscpy(edev->product_id, manufacture_reply->product_id, 464 - sizeof(edev->product_id)); 465 - strscpy(edev->product_rev, manufacture_reply->product_rev, 466 - sizeof(edev->product_rev)); 461 + memtostr(edev->vendor_id, manufacture_reply->vendor_id); 462 + memtostr(edev->product_id, manufacture_reply->product_id); 463 + memtostr(edev->product_rev, manufacture_reply->product_rev); 467 464 edev->level = manufacture_reply->sas_format & 1; 468 465 if (edev->level) { 469 - strscpy(edev->component_vendor_id, 470 - manufacture_reply->component_vendor_id, 471 - sizeof(edev->component_vendor_id)); 466 + memtostr(edev->component_vendor_id, 467 + manufacture_reply->component_vendor_id); 472 468 tmp = (u8 *)&manufacture_reply->component_id; 473 469 edev->component_id = tmp[0] << 8 | tmp[1]; 474 470 edev->component_revision_id =
+3 -1
drivers/scsi/sd.c
··· 3700 3700 */ 3701 3701 if (sdkp->first_scan || 3702 3702 q->limits.max_sectors > q->limits.max_dev_sectors || 3703 - q->limits.max_sectors > q->limits.max_hw_sectors) 3703 + q->limits.max_sectors > q->limits.max_hw_sectors) { 3704 3704 q->limits.max_sectors = rw_max; 3705 + q->limits.max_user_sectors = rw_max; 3706 + } 3705 3707 3706 3708 sdkp->first_scan = 0; 3707 3709
+15 -5
drivers/spi/spi-cadence-xspi.c
··· 145 145 #define CDNS_XSPI_STIG_DONE_FLAG BIT(0) 146 146 #define CDNS_XSPI_TRD_STATUS 0x0104 147 147 148 + #define MODE_NO_OF_BYTES GENMASK(25, 24) 149 + #define MODEBYTES_COUNT 1 150 + 148 151 /* Helper macros for filling command registers */ 149 152 #define CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_1(op, data_phase) ( \ 150 153 FIELD_PREP(CDNS_XSPI_CMD_INSTR_TYPE, (data_phase) ? \ ··· 160 157 FIELD_PREP(CDNS_XSPI_CMD_P1_R2_ADDR3, ((op)->addr.val >> 24) & 0xFF) | \ 161 158 FIELD_PREP(CDNS_XSPI_CMD_P1_R2_ADDR4, ((op)->addr.val >> 32) & 0xFF)) 162 159 163 - #define CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_3(op) ( \ 160 + #define CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_3(op, modebytes) ( \ 164 161 FIELD_PREP(CDNS_XSPI_CMD_P1_R3_ADDR5, ((op)->addr.val >> 40) & 0xFF) | \ 165 162 FIELD_PREP(CDNS_XSPI_CMD_P1_R3_CMD, (op)->cmd.opcode) | \ 163 + FIELD_PREP(MODE_NO_OF_BYTES, modebytes) | \ 166 164 FIELD_PREP(CDNS_XSPI_CMD_P1_R3_NUM_ADDR_BYTES, (op)->addr.nbytes)) 167 165 168 166 #define CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_4(op, chipsel) ( \ ··· 177 173 #define CDNS_XSPI_CMD_FLD_DSEQ_CMD_2(op) \ 178 174 FIELD_PREP(CDNS_XSPI_CMD_DSEQ_R2_DCNT_L, (op)->data.nbytes & 0xFFFF) 179 175 180 - #define CDNS_XSPI_CMD_FLD_DSEQ_CMD_3(op) ( \ 176 + #define CDNS_XSPI_CMD_FLD_DSEQ_CMD_3(op, dummybytes) ( \ 181 177 FIELD_PREP(CDNS_XSPI_CMD_DSEQ_R3_DCNT_H, \ 182 178 ((op)->data.nbytes >> 16) & 0xffff) | \ 183 179 FIELD_PREP(CDNS_XSPI_CMD_DSEQ_R3_NUM_OF_DUMMY, \ 184 180 (op)->dummy.buswidth != 0 ? \ 185 - (((op)->dummy.nbytes * 8) / (op)->dummy.buswidth) : \ 181 + (((dummybytes) * 8) / (op)->dummy.buswidth) : \ 186 182 0)) 187 183 188 184 #define CDNS_XSPI_CMD_FLD_DSEQ_CMD_4(op, chipsel) ( \ ··· 355 351 u32 cmd_regs[6]; 356 352 u32 cmd_status; 357 353 int ret; 354 + int dummybytes = op->dummy.nbytes; 358 355 359 356 ret = cdns_xspi_wait_for_controller_idle(cdns_xspi); 360 357 if (ret < 0) ··· 370 365 memset(cmd_regs, 0, sizeof(cmd_regs)); 371 366 cmd_regs[1] = CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_1(op, data_phase); 372 367 cmd_regs[2] = CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_2(op); 373 - cmd_regs[3] = CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_3(op); 368 + if (dummybytes != 0) { 369 + cmd_regs[3] = CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_3(op, 1); 370 + dummybytes--; 371 + } else { 372 + cmd_regs[3] = CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_3(op, 0); 373 + } 374 374 cmd_regs[4] = CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_4(op, 375 375 cdns_xspi->cur_cs); 376 376 ··· 385 375 cmd_regs[0] = CDNS_XSPI_STIG_DONE_FLAG; 386 376 cmd_regs[1] = CDNS_XSPI_CMD_FLD_DSEQ_CMD_1(op); 387 377 cmd_regs[2] = CDNS_XSPI_CMD_FLD_DSEQ_CMD_2(op); 388 - cmd_regs[3] = CDNS_XSPI_CMD_FLD_DSEQ_CMD_3(op); 378 + cmd_regs[3] = CDNS_XSPI_CMD_FLD_DSEQ_CMD_3(op, dummybytes); 389 379 cmd_regs[4] = CDNS_XSPI_CMD_FLD_DSEQ_CMD_4(op, 390 380 cdns_xspi->cur_cs); 391 381
+13 -3
drivers/spi/spi-stm32.c
··· 1016 1016 static irqreturn_t stm32fx_spi_irq_thread(int irq, void *dev_id) 1017 1017 { 1018 1018 struct spi_controller *ctrl = dev_id; 1019 + struct stm32_spi *spi = spi_controller_get_devdata(ctrl); 1019 1020 1020 1021 spi_finalize_current_transfer(ctrl); 1022 + stm32fx_spi_disable(spi); 1021 1023 1022 1024 return IRQ_HANDLED; 1023 1025 } ··· 1057 1055 mask |= STM32H7_SPI_SR_TXP | STM32H7_SPI_SR_RXP; 1058 1056 1059 1057 if (!(sr & mask)) { 1060 - dev_warn(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n", 1058 + dev_vdbg(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n", 1061 1059 sr, ier); 1062 1060 spin_unlock_irqrestore(&spi->lock, flags); 1063 1061 return IRQ_NONE; ··· 1187 1185 ~clrb) | setb, 1188 1186 spi->base + spi->cfg->regs->cpol.reg); 1189 1187 1190 - stm32_spi_enable(spi); 1191 - 1192 1188 spin_unlock_irqrestore(&spi->lock, flags); 1193 1189 1194 1190 return 0; ··· 1204 1204 1205 1205 if (spi->cur_comm == SPI_SIMPLEX_TX || spi->cur_comm == SPI_3WIRE_TX) { 1206 1206 spi_finalize_current_transfer(spi->ctrl); 1207 + stm32fx_spi_disable(spi); 1207 1208 } 1208 1209 } 1209 1210 ··· 1219 1218 struct stm32_spi *spi = data; 1220 1219 1221 1220 spi_finalize_current_transfer(spi->ctrl); 1221 + spi->cfg->disable(spi); 1222 1222 } 1223 1223 1224 1224 /** ··· 1307 1305 1308 1306 stm32_spi_set_bits(spi, STM32FX_SPI_CR2, cr2); 1309 1307 1308 + stm32_spi_enable(spi); 1309 + 1310 1310 /* starting data transfer when buffer is loaded */ 1311 1311 if (spi->tx_buf) 1312 1312 spi->cfg->write_tx(spi); ··· 1345 1341 1346 1342 spin_lock_irqsave(&spi->lock, flags); 1347 1343 1344 + stm32_spi_enable(spi); 1345 + 1348 1346 /* Be sure to have data in fifo before starting data transfer */ 1349 1347 if (spi->tx_buf) 1350 1348 stm32h7_spi_write_txfifo(spi); ··· 1378 1372 */ 1379 1373 stm32_spi_set_bits(spi, STM32FX_SPI_CR2, STM32FX_SPI_CR2_ERRIE); 1380 1374 } 1375 + 1376 + stm32_spi_enable(spi); 1381 1377 } 1382 1378 1383 1379 /** ··· 1412 1404 ier |= STM32H7_SPI_IER_EOTIE | STM32H7_SPI_IER_TXTFIE; 1413 1405 1414 1406 stm32_spi_set_bits(spi, STM32H7_SPI_IER, ier); 1407 + 1408 + stm32_spi_enable(spi); 1415 1409 1416 1410 if (STM32_SPI_HOST_MODE(spi)) 1417 1411 stm32_spi_set_bits(spi, STM32H7_SPI_CR1, STM32H7_SPI_CR1_CSTART);
+26 -5
drivers/spi/spi.c
··· 1220 1220 spi_unmap_buf_attrs(ctlr, dev, sgt, dir, 0); 1221 1221 } 1222 1222 1223 + /* Dummy SG for unidirect transfers */ 1224 + static struct scatterlist dummy_sg = { 1225 + .page_link = SG_END, 1226 + }; 1227 + 1223 1228 static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg) 1224 1229 { 1225 1230 struct device *tx_dev, *rx_dev; ··· 1248 1243 else 1249 1244 rx_dev = ctlr->dev.parent; 1250 1245 1246 + ret = -ENOMSG; 1251 1247 list_for_each_entry(xfer, &msg->transfers, transfer_list) { 1252 1248 /* The sync is done before each transfer. */ 1253 1249 unsigned long attrs = DMA_ATTR_SKIP_CPU_SYNC; ··· 1263 1257 attrs); 1264 1258 if (ret != 0) 1265 1259 return ret; 1260 + } else { 1261 + xfer->tx_sg.sgl = &dummy_sg; 1266 1262 } 1267 1263 1268 1264 if (xfer->rx_buf != NULL) { ··· 1278 1270 1279 1271 return ret; 1280 1272 } 1273 + } else { 1274 + xfer->rx_sg.sgl = &dummy_sg; 1281 1275 } 1282 1276 } 1277 + /* No transfer has been mapped, bail out with success */ 1278 + if (ret) 1279 + return 0; 1283 1280 1284 1281 ctlr->cur_rx_dma_dev = rx_dev; 1285 1282 ctlr->cur_tx_dma_dev = tx_dev; ··· 1320 1307 return 0; 1321 1308 } 1322 1309 1323 - static void spi_dma_sync_for_device(struct spi_controller *ctlr, 1310 + static void spi_dma_sync_for_device(struct spi_controller *ctlr, struct spi_message *msg, 1324 1311 struct spi_transfer *xfer) 1325 1312 { 1326 1313 struct device *rx_dev = ctlr->cur_rx_dma_dev; ··· 1329 1316 if (!ctlr->cur_msg_mapped) 1330 1317 return; 1331 1318 1319 + if (!ctlr->can_dma(ctlr, msg->spi, xfer)) 1320 + return; 1321 + 1332 1322 dma_sync_sgtable_for_device(tx_dev, &xfer->tx_sg, DMA_TO_DEVICE); 1333 1323 dma_sync_sgtable_for_device(rx_dev, &xfer->rx_sg, DMA_FROM_DEVICE); 1334 1324 } 1335 1325 1336 - static void spi_dma_sync_for_cpu(struct spi_controller *ctlr, 1326 + static void spi_dma_sync_for_cpu(struct spi_controller *ctlr, struct spi_message *msg, 1337 1327 struct spi_transfer *xfer) 1338 1328 { 1339 1329 struct device *rx_dev = ctlr->cur_rx_dma_dev; 1340 1330 struct device *tx_dev = ctlr->cur_tx_dma_dev; 1341 1331 1342 1332 if (!ctlr->cur_msg_mapped) 1333 + return; 1334 + 1335 + if (!ctlr->can_dma(ctlr, msg->spi, xfer)) 1343 1336 return; 1344 1337 1345 1338 dma_sync_sgtable_for_cpu(rx_dev, &xfer->rx_sg, DMA_FROM_DEVICE); ··· 1365 1346 } 1366 1347 1367 1348 static void spi_dma_sync_for_device(struct spi_controller *ctrl, 1349 + struct spi_message *msg, 1368 1350 struct spi_transfer *xfer) 1369 1351 { 1370 1352 } 1371 1353 1372 1354 static void spi_dma_sync_for_cpu(struct spi_controller *ctrl, 1355 + struct spi_message *msg, 1373 1356 struct spi_transfer *xfer) 1374 1357 { 1375 1358 } ··· 1643 1622 reinit_completion(&ctlr->xfer_completion); 1644 1623 1645 1624 fallback_pio: 1646 - spi_dma_sync_for_device(ctlr, xfer); 1625 + spi_dma_sync_for_device(ctlr, msg, xfer); 1647 1626 ret = ctlr->transfer_one(ctlr, msg->spi, xfer); 1648 1627 if (ret < 0) { 1649 - spi_dma_sync_for_cpu(ctlr, xfer); 1628 + spi_dma_sync_for_cpu(ctlr, msg, xfer); 1650 1629 1651 1630 if (ctlr->cur_msg_mapped && 1652 1631 (xfer->error & SPI_TRANS_FAIL_NO_START)) { ··· 1671 1650 msg->status = ret; 1672 1651 } 1673 1652 1674 - spi_dma_sync_for_cpu(ctlr, xfer); 1653 + spi_dma_sync_for_cpu(ctlr, msg, xfer); 1675 1654 } else { 1676 1655 if (xfer->len) 1677 1656 dev_err(&msg->spi->dev,
+25 -10
drivers/thermal/thermal_core.c
··· 467 467 governor->trip_crossed(tz, trip, crossed_up); 468 468 } 469 469 470 + static void thermal_trip_crossed(struct thermal_zone_device *tz, 471 + const struct thermal_trip *trip, 472 + struct thermal_governor *governor, 473 + bool crossed_up) 474 + { 475 + if (crossed_up) { 476 + thermal_notify_tz_trip_up(tz, trip); 477 + thermal_debug_tz_trip_up(tz, trip); 478 + } else { 479 + thermal_notify_tz_trip_down(tz, trip); 480 + thermal_debug_tz_trip_down(tz, trip); 481 + } 482 + thermal_governor_trip_crossed(governor, tz, trip, crossed_up); 483 + } 484 + 470 485 static int thermal_trip_notify_cmp(void *ascending, const struct list_head *a, 471 486 const struct list_head *b) 472 487 { ··· 521 506 handle_thermal_trip(tz, td, &way_up_list, &way_down_list); 522 507 523 508 list_sort(&way_up_list, &way_up_list, thermal_trip_notify_cmp); 524 - list_for_each_entry(td, &way_up_list, notify_list_node) { 525 - thermal_notify_tz_trip_up(tz, &td->trip); 526 - thermal_debug_tz_trip_up(tz, &td->trip); 527 - thermal_governor_trip_crossed(governor, tz, &td->trip, true); 528 - } 509 + list_for_each_entry(td, &way_up_list, notify_list_node) 510 + thermal_trip_crossed(tz, &td->trip, governor, true); 529 511 530 512 list_sort(NULL, &way_down_list, thermal_trip_notify_cmp); 531 - list_for_each_entry(td, &way_down_list, notify_list_node) { 532 - thermal_notify_tz_trip_down(tz, &td->trip); 533 - thermal_debug_tz_trip_down(tz, &td->trip); 534 - thermal_governor_trip_crossed(governor, tz, &td->trip, false); 535 - } 513 + list_for_each_entry(td, &way_down_list, notify_list_node) 514 + thermal_trip_crossed(tz, &td->trip, governor, false); 536 515 537 516 if (governor->manage) 538 517 governor->manage(tz); ··· 601 592 mutex_unlock(&tz->lock); 602 593 } 603 594 EXPORT_SYMBOL_GPL(thermal_zone_device_update); 595 + 596 + void thermal_zone_trip_down(struct thermal_zone_device *tz, 597 + const struct thermal_trip *trip) 598 + { 599 + thermal_trip_crossed(tz, trip, thermal_get_tz_governor(tz), false); 600 + } 604 601 605 602 int for_each_thermal_governor(int (*cb)(struct thermal_governor *, void *), 606 603 void *data)
+2
drivers/thermal/thermal_core.h
··· 246 246 void thermal_zone_trip_updated(struct thermal_zone_device *tz, 247 247 const struct thermal_trip *trip); 248 248 int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp); 249 + void thermal_zone_trip_down(struct thermal_zone_device *tz, 250 + const struct thermal_trip *trip); 249 251 250 252 /* sysfs I/F */ 251 253 int thermal_zone_create_device_groups(struct thermal_zone_device *tz);
+11 -7
drivers/thermal/thermal_debugfs.c
··· 91 91 * 92 92 * @timestamp: the trip crossing timestamp 93 93 * @duration: total time when the zone temperature was above the trip point 94 + * @trip_temp: trip temperature at mitigation start 95 + * @trip_hyst: trip hysteresis at mitigation start 94 96 * @count: the number of times the zone temperature was above the trip point 95 97 * @max: maximum recorded temperature above the trip point 96 98 * @min: minimum recorded temperature above the trip point ··· 101 99 struct trip_stats { 102 100 ktime_t timestamp; 103 101 ktime_t duration; 102 + int trip_temp; 103 + int trip_hyst; 104 104 int count; 105 105 int max; 106 106 int min; ··· 578 574 struct thermal_debugfs *thermal_dbg = tz->debugfs; 579 575 int trip_id = thermal_zone_trip_id(tz, trip); 580 576 ktime_t now = ktime_get(); 577 + struct trip_stats *trip_stats; 581 578 582 579 if (!thermal_dbg) 583 580 return; ··· 644 639 tz_dbg->trips_crossed[tz_dbg->nr_trips++] = trip_id; 645 640 646 641 tze = list_first_entry(&tz_dbg->tz_episodes, struct tz_episode, node); 647 - tze->trip_stats[trip_id].timestamp = now; 642 + trip_stats = &tze->trip_stats[trip_id]; 643 + trip_stats->trip_temp = trip->temperature; 644 + trip_stats->trip_hyst = trip->hysteresis; 645 + trip_stats->timestamp = now; 648 646 649 647 unlock: 650 648 mutex_unlock(&thermal_dbg->lock); ··· 802 794 const struct thermal_trip *trip = &td->trip; 803 795 struct trip_stats *trip_stats; 804 796 805 - /* Skip invalid trips. */ 806 - if (trip->temperature == THERMAL_TEMP_INVALID) 807 - continue; 808 - 809 797 /* 810 798 * There is no possible mitigation happening at the 811 799 * critical trip point, so the stats will be always ··· 840 836 seq_printf(s, "| %*d | %*s | %*d | %*d | %c%*lld | %*d | %*d | %*d |\n", 841 837 4 , trip_id, 842 838 8, type, 843 - 9, trip->temperature, 844 - 9, trip->hysteresis, 839 + 9, trip_stats->trip_temp, 840 + 9, trip_stats->trip_hyst, 845 841 c, 10, duration_ms, 846 842 9, trip_stats->avg, 847 843 9, trip_stats->min,
+12 -8
drivers/thermal/thermal_trip.c
··· 152 152 if (trip->temperature == temp) 153 153 return; 154 154 155 + trip->temperature = temp; 156 + thermal_notify_tz_trip_change(tz, trip); 157 + 155 158 if (temp == THERMAL_TEMP_INVALID) { 156 159 struct thermal_trip_desc *td = trip_to_trip_desc(trip); 157 160 158 - if (trip->type == THERMAL_TRIP_PASSIVE && 159 - tz->temperature >= td->threshold) { 161 + if (tz->temperature >= td->threshold) { 160 162 /* 161 - * The trip has been crossed, so the thermal zone's 162 - * passive count needs to be adjusted. 163 + * The trip has been crossed on the way up, so some 164 + * adjustments are needed to compensate for the lack 165 + * of it going forward. 163 166 */ 164 - tz->passive--; 165 - WARN_ON_ONCE(tz->passive < 0); 167 + if (trip->type == THERMAL_TRIP_PASSIVE) { 168 + tz->passive--; 169 + WARN_ON_ONCE(tz->passive < 0); 170 + } 171 + thermal_zone_trip_down(tz, trip); 166 172 } 167 173 /* 168 174 * Invalidate the threshold to avoid triggering a spurious ··· 176 170 */ 177 171 td->threshold = INT_MAX; 178 172 } 179 - trip->temperature = temp; 180 - thermal_notify_tz_trip_change(tz, trip); 181 173 } 182 174 EXPORT_SYMBOL_GPL(thermal_zone_set_trip_temp);
+1 -1
fs/bcachefs/backpointers.c
··· 690 690 691 691 ptrs = bch2_bkey_ptrs_c(k); 692 692 bkey_for_each_ptr_decode(k.k, ptrs, p, entry) { 693 - struct bpos bucket_pos; 693 + struct bpos bucket_pos = POS_MIN; 694 694 struct bch_backpointer bp; 695 695 696 696 if (p.ptr.cached)
+1 -43
fs/bcachefs/bcachefs.h
··· 457 457 }; 458 458 459 459 #include "alloc_types.h" 460 + #include "btree_gc_types.h" 460 461 #include "btree_types.h" 461 462 #include "btree_node_scan_types.h" 462 463 #include "btree_write_buffer_types.h" ··· 488 487 #define BTREE_NODE_OPEN_BUCKET_RESERVE (BTREE_RESERVE_MAX * BCH_REPLICAS_MAX) 489 488 490 489 struct btree; 491 - 492 - enum gc_phase { 493 - GC_PHASE_NOT_RUNNING, 494 - GC_PHASE_START, 495 - GC_PHASE_SB, 496 - 497 - GC_PHASE_BTREE_stripes, 498 - GC_PHASE_BTREE_extents, 499 - GC_PHASE_BTREE_inodes, 500 - GC_PHASE_BTREE_dirents, 501 - GC_PHASE_BTREE_xattrs, 502 - GC_PHASE_BTREE_alloc, 503 - GC_PHASE_BTREE_quotas, 504 - GC_PHASE_BTREE_reflink, 505 - GC_PHASE_BTREE_subvolumes, 506 - GC_PHASE_BTREE_snapshots, 507 - GC_PHASE_BTREE_lru, 508 - GC_PHASE_BTREE_freespace, 509 - GC_PHASE_BTREE_need_discard, 510 - GC_PHASE_BTREE_backpointers, 511 - GC_PHASE_BTREE_bucket_gens, 512 - GC_PHASE_BTREE_snapshot_trees, 513 - GC_PHASE_BTREE_deleted_inodes, 514 - GC_PHASE_BTREE_logged_ops, 515 - GC_PHASE_BTREE_rebalance_work, 516 - GC_PHASE_BTREE_subvolume_children, 517 - 518 - GC_PHASE_PENDING_DELETE, 519 - }; 520 - 521 - struct gc_pos { 522 - enum gc_phase phase; 523 - u16 level; 524 - struct bpos pos; 525 - }; 526 - 527 - struct reflink_gc { 528 - u64 offset; 529 - u32 size; 530 - u32 refcount; 531 - }; 532 - 533 - typedef GENRADIX(struct reflink_gc) reflink_gc_table; 534 490 535 491 struct io_count { 536 492 u64 sectors[2][BCH_DATA_NR];
+10 -185
fs/bcachefs/bcachefs_format.h
··· 503 503 504 504 #include "alloc_background_format.h" 505 505 #include "extents_format.h" 506 - #include "reflink_format.h" 507 506 #include "ec_format.h" 508 - #include "inode_format.h" 509 507 #include "dirent_format.h" 510 - #include "xattr_format.h" 511 - #include "quota_format.h" 508 + #include "disk_groups_format.h" 509 + #include "inode_format.h" 510 + #include "journal_seq_blacklist_format.h" 512 511 #include "logged_ops_format.h" 512 + #include "quota_format.h" 513 + #include "reflink_format.h" 514 + #include "replicas_format.h" 513 515 #include "snapshot_format.h" 514 516 #include "subvolume_format.h" 515 517 #include "sb-counters_format.h" 518 + #include "sb-downgrade_format.h" 519 + #include "sb-errors_format.h" 520 + #include "sb-members_format.h" 521 + #include "xattr_format.h" 516 522 517 523 enum bch_sb_field_type { 518 524 #define x(f, nr) BCH_SB_FIELD_##f = nr, ··· 549 543 __le64 start; 550 544 __le64 nr; 551 545 } d[]; 552 - }; 553 - 554 - /* BCH_SB_FIELD_members_v1: */ 555 - 556 - #define BCH_MIN_NR_NBUCKETS (1 << 6) 557 - 558 - #define BCH_IOPS_MEASUREMENTS() \ 559 - x(seqread, 0) \ 560 - x(seqwrite, 1) \ 561 - x(randread, 2) \ 562 - x(randwrite, 3) 563 - 564 - enum bch_iops_measurement { 565 - #define x(t, n) BCH_IOPS_##t = n, 566 - BCH_IOPS_MEASUREMENTS() 567 - #undef x 568 - BCH_IOPS_NR 569 - }; 570 - 571 - #define BCH_MEMBER_ERROR_TYPES() \ 572 - x(read, 0) \ 573 - x(write, 1) \ 574 - x(checksum, 2) 575 - 576 - enum bch_member_error_type { 577 - #define x(t, n) BCH_MEMBER_ERROR_##t = n, 578 - BCH_MEMBER_ERROR_TYPES() 579 - #undef x 580 - BCH_MEMBER_ERROR_NR 581 - }; 582 - 583 - struct bch_member { 584 - __uuid_t uuid; 585 - __le64 nbuckets; /* device size */ 586 - __le16 first_bucket; /* index of first bucket used */ 587 - __le16 bucket_size; /* sectors */ 588 - __u8 btree_bitmap_shift; 589 - __u8 pad[3]; 590 - __le64 last_mount; /* time_t */ 591 - 592 - __le64 flags; 593 - __le32 iops[4]; 594 - __le64 errors[BCH_MEMBER_ERROR_NR]; 595 - __le64 errors_at_reset[BCH_MEMBER_ERROR_NR]; 596 - __le64 errors_reset_time; 597 - __le64 seq; 598 - __le64 btree_allocated_bitmap; 599 - /* 600 - * On recovery from a clean shutdown we don't normally read the journal, 601 - * but we still want to resume writing from where we left off so we 602 - * don't overwrite more than is necessary, for list journal debugging: 603 - */ 604 - __le32 last_journal_bucket; 605 - __le32 last_journal_bucket_offset; 606 - }; 607 - 608 - /* 609 - * This limit comes from the bucket_gens array - it's a single allocation, and 610 - * kernel allocation are limited to INT_MAX 611 - */ 612 - #define BCH_MEMBER_NBUCKETS_MAX (INT_MAX - 64) 613 - 614 - #define BCH_MEMBER_V1_BYTES 56 615 - 616 - LE64_BITMASK(BCH_MEMBER_STATE, struct bch_member, flags, 0, 4) 617 - /* 4-14 unused, was TIER, HAS_(META)DATA, REPLACEMENT */ 618 - LE64_BITMASK(BCH_MEMBER_DISCARD, struct bch_member, flags, 14, 15) 619 - LE64_BITMASK(BCH_MEMBER_DATA_ALLOWED, struct bch_member, flags, 15, 20) 620 - LE64_BITMASK(BCH_MEMBER_GROUP, struct bch_member, flags, 20, 28) 621 - LE64_BITMASK(BCH_MEMBER_DURABILITY, struct bch_member, flags, 28, 30) 622 - LE64_BITMASK(BCH_MEMBER_FREESPACE_INITIALIZED, 623 - struct bch_member, flags, 30, 31) 624 - 625 - #if 0 626 - LE64_BITMASK(BCH_MEMBER_NR_READ_ERRORS, struct bch_member, flags[1], 0, 20); 627 - LE64_BITMASK(BCH_MEMBER_NR_WRITE_ERRORS,struct bch_member, flags[1], 20, 40); 628 - #endif 629 - 630 - #define BCH_MEMBER_STATES() \ 631 - x(rw, 0) \ 632 - x(ro, 1) \ 633 - x(failed, 2) \ 634 - x(spare, 3) 635 - 636 - enum bch_member_state { 637 - #define x(t, n) BCH_MEMBER_STATE_##t = n, 638 - BCH_MEMBER_STATES() 639 - #undef x 640 - BCH_MEMBER_STATE_NR 641 - }; 642 - 643 - struct bch_sb_field_members_v1 { 644 - struct bch_sb_field field; 645 - struct bch_member _members[]; //Members are now variable size 646 - }; 647 - 648 - struct bch_sb_field_members_v2 { 649 - struct bch_sb_field field; 650 - __le16 member_bytes; //size of single member entry 651 - u8 pad[6]; 652 - struct bch_member _members[]; 653 546 }; 654 547 655 548 /* BCH_SB_FIELD_crypt: */ ··· 599 694 LE64_BITMASK(BCH_KDF_SCRYPT_R, struct bch_sb_field_crypt, kdf_flags, 16, 32); 600 695 LE64_BITMASK(BCH_KDF_SCRYPT_P, struct bch_sb_field_crypt, kdf_flags, 32, 48); 601 696 602 - /* BCH_SB_FIELD_replicas: */ 603 - 604 697 #define BCH_DATA_TYPES() \ 605 698 x(free, 0) \ 606 699 x(sb, 1) \ ··· 641 738 } 642 739 } 643 740 644 - struct bch_replicas_entry_v0 { 645 - __u8 data_type; 646 - __u8 nr_devs; 647 - __u8 devs[]; 648 - } __packed; 649 - 650 - struct bch_sb_field_replicas_v0 { 651 - struct bch_sb_field field; 652 - struct bch_replicas_entry_v0 entries[]; 653 - } __packed __aligned(8); 654 - 655 - struct bch_replicas_entry_v1 { 656 - __u8 data_type; 657 - __u8 nr_devs; 658 - __u8 nr_required; 659 - __u8 devs[]; 660 - } __packed; 661 - 662 - #define replicas_entry_bytes(_i) \ 663 - (offsetof(typeof(*(_i)), devs) + (_i)->nr_devs) 664 - 665 - struct bch_sb_field_replicas { 666 - struct bch_sb_field field; 667 - struct bch_replicas_entry_v1 entries[]; 668 - } __packed __aligned(8); 669 - 670 - /* BCH_SB_FIELD_disk_groups: */ 671 - 672 - #define BCH_SB_LABEL_SIZE 32 673 - 674 - struct bch_disk_group { 675 - __u8 label[BCH_SB_LABEL_SIZE]; 676 - __le64 flags[2]; 677 - } __packed __aligned(8); 678 - 679 - LE64_BITMASK(BCH_GROUP_DELETED, struct bch_disk_group, flags[0], 0, 1) 680 - LE64_BITMASK(BCH_GROUP_DATA_ALLOWED, struct bch_disk_group, flags[0], 1, 6) 681 - LE64_BITMASK(BCH_GROUP_PARENT, struct bch_disk_group, flags[0], 6, 24) 682 - 683 - struct bch_sb_field_disk_groups { 684 - struct bch_sb_field field; 685 - struct bch_disk_group entries[]; 686 - } __packed __aligned(8); 687 - 688 741 /* 689 742 * On clean shutdown, store btree roots and current journal sequence number in 690 743 * the superblock: ··· 668 809 __u64 _data[]; 669 810 }; 670 811 671 - struct journal_seq_blacklist_entry { 672 - __le64 start; 673 - __le64 end; 674 - }; 675 - 676 - struct bch_sb_field_journal_seq_blacklist { 677 - struct bch_sb_field field; 678 - struct journal_seq_blacklist_entry start[]; 679 - }; 680 - 681 - struct bch_sb_field_errors { 682 - struct bch_sb_field field; 683 - struct bch_sb_field_error_entry { 684 - __le64 v; 685 - __le64 last_error_time; 686 - } entries[]; 687 - }; 688 - 689 - LE64_BITMASK(BCH_SB_ERROR_ENTRY_ID, struct bch_sb_field_error_entry, v, 0, 16); 690 - LE64_BITMASK(BCH_SB_ERROR_ENTRY_NR, struct bch_sb_field_error_entry, v, 16, 64); 691 - 692 812 struct bch_sb_field_ext { 693 813 struct bch_sb_field field; 694 814 __le64 recovery_passes_required[2]; 695 815 __le64 errors_silent[8]; 696 816 __le64 btrees_lost_data; 697 - }; 698 - 699 - struct bch_sb_field_downgrade_entry { 700 - __le16 version; 701 - __le64 recovery_passes[2]; 702 - __le16 nr_errors; 703 - __le16 errors[] __counted_by(nr_errors); 704 - } __packed __aligned(2); 705 - 706 - struct bch_sb_field_downgrade { 707 - struct bch_sb_field field; 708 - struct bch_sb_field_downgrade_entry entries[]; 709 817 }; 710 818 711 819 /* Superblock: */ ··· 735 909 #define bcachefs_metadata_version_current (bcachefs_metadata_version_max - 1) 736 910 737 911 #define BCH_SB_SECTOR 8 738 - #define BCH_SB_MEMBERS_MAX 64 /* XXX kill */ 739 912 740 913 #define BCH_SB_LAYOUT_SIZE_BITS_MAX 16 /* 32 MB */ 741 914
+9 -9
fs/bcachefs/btree_gc.c
··· 585 585 586 586 if (fsck_err_on(k.k->version.lo > atomic64_read(&c->key_version), c, 587 587 bkey_version_in_future, 588 - "key version number higher than recorded: %llu > %llu", 589 - k.k->version.lo, 590 - atomic64_read(&c->key_version))) 588 + "key version number higher than recorded %llu\n %s", 589 + atomic64_read(&c->key_version), 590 + (bch2_bkey_val_to_text(&buf, c, k), buf.buf))) 591 591 atomic64_set(&c->key_version, k.k->version.lo); 592 592 } 593 593 594 594 if (mustfix_fsck_err_on(level && !bch2_dev_btree_bitmap_marked(c, k), 595 595 c, btree_bitmap_not_marked, 596 596 "btree ptr not marked in member info btree allocated bitmap\n %s", 597 - (bch2_bkey_val_to_text(&buf, c, k), 597 + (printbuf_reset(&buf), 598 + bch2_bkey_val_to_text(&buf, c, k), 598 599 buf.buf))) { 599 600 mutex_lock(&c->sb_lock); 600 601 bch2_dev_btree_bitmap_mark(c, k); ··· 674 673 675 674 static inline int btree_id_gc_phase_cmp(enum btree_id l, enum btree_id r) 676 675 { 677 - return (int) btree_id_to_gc_phase(l) - 678 - (int) btree_id_to_gc_phase(r); 676 + return cmp_int(gc_btree_order(l), gc_btree_order(r)); 679 677 } 680 678 681 679 static int bch2_gc_btrees(struct bch_fs *c) ··· 711 711 static int bch2_mark_superblocks(struct bch_fs *c) 712 712 { 713 713 mutex_lock(&c->sb_lock); 714 - gc_pos_set(c, gc_phase(GC_PHASE_SB)); 714 + gc_pos_set(c, gc_phase(GC_PHASE_sb)); 715 715 716 716 int ret = bch2_trans_mark_dev_sbs_flags(c, BTREE_TRIGGER_gc); 717 717 mutex_unlock(&c->sb_lock); ··· 1209 1209 if (ret) 1210 1210 goto out; 1211 1211 1212 - gc_pos_set(c, gc_phase(GC_PHASE_START)); 1212 + gc_pos_set(c, gc_phase(GC_PHASE_start)); 1213 1213 1214 1214 ret = bch2_mark_superblocks(c); 1215 1215 BUG_ON(ret); ··· 1231 1231 1232 1232 percpu_down_write(&c->mark_lock); 1233 1233 /* Indicates that gc is no longer in progress: */ 1234 - __gc_pos_set(c, gc_phase(GC_PHASE_NOT_RUNNING)); 1234 + __gc_pos_set(c, gc_phase(GC_PHASE_not_running)); 1235 1235 1236 1236 bch2_gc_free(c); 1237 1237 percpu_up_write(&c->mark_lock);
+20 -24
fs/bcachefs/btree_gc.h
··· 3 3 #define _BCACHEFS_BTREE_GC_H 4 4 5 5 #include "bkey.h" 6 + #include "btree_gc_types.h" 6 7 #include "btree_types.h" 7 8 8 9 int bch2_check_topology(struct bch_fs *); ··· 33 32 /* Position of (the start of) a gc phase: */ 34 33 static inline struct gc_pos gc_phase(enum gc_phase phase) 35 34 { 36 - return (struct gc_pos) { 37 - .phase = phase, 38 - .level = 0, 39 - .pos = POS_MIN, 40 - }; 41 - } 42 - 43 - static inline int gc_pos_cmp(struct gc_pos l, struct gc_pos r) 44 - { 45 - return cmp_int(l.phase, r.phase) ?: 46 - -cmp_int(l.level, r.level) ?: 47 - bpos_cmp(l.pos, r.pos); 48 - } 49 - 50 - static inline enum gc_phase btree_id_to_gc_phase(enum btree_id id) 51 - { 52 - switch (id) { 53 - #define x(name, v, ...) case BTREE_ID_##name: return GC_PHASE_BTREE_##name; 54 - BCH_BTREE_IDS() 55 - #undef x 56 - default: 57 - BUG(); 58 - } 35 + return (struct gc_pos) { .phase = phase, }; 59 36 } 60 37 61 38 static inline struct gc_pos gc_pos_btree(enum btree_id btree, unsigned level, 62 39 struct bpos pos) 63 40 { 64 41 return (struct gc_pos) { 65 - .phase = btree_id_to_gc_phase(btree), 42 + .phase = GC_PHASE_btree, 43 + .btree = btree, 66 44 .level = level, 67 45 .pos = pos, 68 46 }; ··· 54 74 static inline struct gc_pos gc_pos_btree_node(struct btree *b) 55 75 { 56 76 return gc_pos_btree(b->c.btree_id, b->c.level, b->key.k.p); 77 + } 78 + 79 + static inline int gc_btree_order(enum btree_id btree) 80 + { 81 + if (btree == BTREE_ID_stripes) 82 + return -1; 83 + return btree; 84 + } 85 + 86 + static inline int gc_pos_cmp(struct gc_pos l, struct gc_pos r) 87 + { 88 + return cmp_int(l.phase, r.phase) ?: 89 + cmp_int(gc_btree_order(l.btree), 90 + gc_btree_order(r.btree)) ?: 91 + -cmp_int(l.level, r.level) ?: 92 + bpos_cmp(l.pos, r.pos); 57 93 } 58 94 59 95 static inline bool gc_visited(struct bch_fs *c, struct gc_pos pos)
+29
fs/bcachefs/btree_gc_types.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_BTREE_GC_TYPES_H 3 + #define _BCACHEFS_BTREE_GC_TYPES_H 4 + 5 + #include <linux/generic-radix-tree.h> 6 + 7 + enum gc_phase { 8 + GC_PHASE_not_running, 9 + GC_PHASE_start, 10 + GC_PHASE_sb, 11 + GC_PHASE_btree, 12 + }; 13 + 14 + struct gc_pos { 15 + enum gc_phase phase:8; 16 + enum btree_id btree:8; 17 + u16 level; 18 + struct bpos pos; 19 + }; 20 + 21 + struct reflink_gc { 22 + u64 offset; 23 + u32 size; 24 + u32 refcount; 25 + }; 26 + 27 + typedef GENRADIX(struct reflink_gc) reflink_gc_table; 28 + 29 + #endif /* _BCACHEFS_BTREE_GC_TYPES_H */
+45 -40
fs/bcachefs/btree_io.c
··· 519 519 520 520 static void btree_err_msg(struct printbuf *out, struct bch_fs *c, 521 521 struct bch_dev *ca, 522 - struct btree *b, struct bset *i, 522 + struct btree *b, struct bset *i, struct bkey_packed *k, 523 523 unsigned offset, int write) 524 524 { 525 525 prt_printf(out, bch2_log_msg(c, "%s"), ··· 537 537 b->written, btree_ptr_sectors_written(&b->key)); 538 538 if (i) 539 539 prt_printf(out, " bset u64s %u", le16_to_cpu(i->u64s)); 540 + if (k) 541 + prt_printf(out, " bset byte offset %lu", 542 + (unsigned long)(void *)k - 543 + ((unsigned long)(void *)i & ~511UL)); 540 544 prt_str(out, ": "); 541 545 } 542 546 543 - __printf(9, 10) 547 + __printf(10, 11) 544 548 static int __btree_err(int ret, 545 549 struct bch_fs *c, 546 550 struct bch_dev *ca, 547 551 struct btree *b, 548 552 struct bset *i, 553 + struct bkey_packed *k, 549 554 int write, 550 555 bool have_retry, 551 556 enum bch_sb_error_id err_type, ··· 560 555 bool silent = c->curr_recovery_pass == BCH_RECOVERY_PASS_scan_for_btree_nodes; 561 556 va_list args; 562 557 563 - btree_err_msg(&out, c, ca, b, i, b->written, write); 558 + btree_err_msg(&out, c, ca, b, i, k, b->written, write); 564 559 565 560 va_start(args, fmt); 566 561 prt_vprintf(&out, fmt, args); ··· 616 611 return ret; 617 612 } 618 613 619 - #define btree_err(type, c, ca, b, i, _err_type, msg, ...) \ 614 + #define btree_err(type, c, ca, b, i, k, _err_type, msg, ...) \ 620 615 ({ \ 621 - int _ret = __btree_err(type, c, ca, b, i, write, have_retry, \ 616 + int _ret = __btree_err(type, c, ca, b, i, k, write, have_retry, \ 622 617 BCH_FSCK_ERR_##_err_type, \ 623 618 msg, ##__VA_ARGS__); \ 624 619 \ ··· 695 690 696 691 btree_err_on(!bch2_version_compatible(version), 697 692 -BCH_ERR_btree_node_read_err_incompatible, 698 - c, ca, b, i, 693 + c, ca, b, i, NULL, 699 694 btree_node_unsupported_version, 700 695 "unsupported bset version %u.%u", 701 696 BCH_VERSION_MAJOR(version), ··· 703 698 704 699 if (btree_err_on(version < c->sb.version_min, 705 700 -BCH_ERR_btree_node_read_err_fixable, 706 - c, NULL, b, i, 701 + c, NULL, b, i, NULL, 707 702 btree_node_bset_older_than_sb_min, 708 703 "bset version %u older than superblock version_min %u", 709 704 version, c->sb.version_min)) { ··· 716 711 if (btree_err_on(BCH_VERSION_MAJOR(version) > 717 712 BCH_VERSION_MAJOR(c->sb.version), 718 713 -BCH_ERR_btree_node_read_err_fixable, 719 - c, NULL, b, i, 714 + c, NULL, b, i, NULL, 720 715 btree_node_bset_newer_than_sb, 721 716 "bset version %u newer than superblock version %u", 722 717 version, c->sb.version)) { ··· 728 723 729 724 btree_err_on(BSET_SEPARATE_WHITEOUTS(i), 730 725 -BCH_ERR_btree_node_read_err_incompatible, 731 - c, ca, b, i, 726 + c, ca, b, i, NULL, 732 727 btree_node_unsupported_version, 733 728 "BSET_SEPARATE_WHITEOUTS no longer supported"); 734 729 735 730 if (btree_err_on(offset + sectors > btree_sectors(c), 736 731 -BCH_ERR_btree_node_read_err_fixable, 737 - c, ca, b, i, 732 + c, ca, b, i, NULL, 738 733 bset_past_end_of_btree_node, 739 734 "bset past end of btree node")) { 740 735 i->u64s = 0; ··· 744 739 745 740 btree_err_on(offset && !i->u64s, 746 741 -BCH_ERR_btree_node_read_err_fixable, 747 - c, ca, b, i, 742 + c, ca, b, i, NULL, 748 743 bset_empty, 749 744 "empty bset"); 750 745 751 746 btree_err_on(BSET_OFFSET(i) && BSET_OFFSET(i) != offset, 752 747 -BCH_ERR_btree_node_read_err_want_retry, 753 - c, ca, b, i, 748 + c, ca, b, i, NULL, 754 749 bset_wrong_sector_offset, 755 750 "bset at wrong sector offset"); 756 751 ··· 766 761 /* XXX endianness */ 767 762 btree_err_on(bp->seq != bn->keys.seq, 768 763 -BCH_ERR_btree_node_read_err_must_retry, 769 - c, ca, b, NULL, 764 + c, ca, b, NULL, NULL, 770 765 bset_bad_seq, 771 766 "incorrect sequence number (wrong btree node)"); 772 767 } 773 768 774 769 btree_err_on(BTREE_NODE_ID(bn) != b->c.btree_id, 775 770 -BCH_ERR_btree_node_read_err_must_retry, 776 - c, ca, b, i, 771 + c, ca, b, i, NULL, 777 772 btree_node_bad_btree, 778 773 "incorrect btree id"); 779 774 780 775 btree_err_on(BTREE_NODE_LEVEL(bn) != b->c.level, 781 776 -BCH_ERR_btree_node_read_err_must_retry, 782 - c, ca, b, i, 777 + c, ca, b, i, NULL, 783 778 btree_node_bad_level, 784 779 "incorrect level"); 785 780 ··· 798 793 799 794 btree_err_on(!bpos_eq(b->data->min_key, bp->min_key), 800 795 -BCH_ERR_btree_node_read_err_must_retry, 801 - c, ca, b, NULL, 796 + c, ca, b, NULL, NULL, 802 797 btree_node_bad_min_key, 803 798 "incorrect min_key: got %s should be %s", 804 799 (printbuf_reset(&buf1), ··· 809 804 810 805 btree_err_on(!bpos_eq(bn->max_key, b->key.k.p), 811 806 -BCH_ERR_btree_node_read_err_must_retry, 812 - c, ca, b, i, 807 + c, ca, b, i, NULL, 813 808 btree_node_bad_max_key, 814 809 "incorrect max key %s", 815 810 (printbuf_reset(&buf1), ··· 821 816 822 817 btree_err_on(bch2_bkey_format_invalid(c, &bn->format, write, &buf1), 823 818 -BCH_ERR_btree_node_read_err_bad_node, 824 - c, ca, b, i, 819 + c, ca, b, i, NULL, 825 820 btree_node_bad_format, 826 821 "invalid bkey format: %s\n %s", buf1.buf, 827 822 (printbuf_reset(&buf2), ··· 888 883 889 884 if (btree_err_on(bkey_p_next(k) > vstruct_last(i), 890 885 -BCH_ERR_btree_node_read_err_fixable, 891 - c, NULL, b, i, 886 + c, NULL, b, i, k, 892 887 btree_node_bkey_past_bset_end, 893 888 "key extends past end of bset")) { 894 889 i->u64s = cpu_to_le16((u64 *) k - i->_data); ··· 897 892 898 893 if (btree_err_on(k->format > KEY_FORMAT_CURRENT, 899 894 -BCH_ERR_btree_node_read_err_fixable, 900 - c, NULL, b, i, 895 + c, NULL, b, i, k, 901 896 btree_node_bkey_bad_format, 902 897 "invalid bkey format %u", k->format)) 903 898 goto drop_this_key; 904 899 905 900 if (btree_err_on(!bkeyp_u64s_valid(&b->format, k), 906 901 -BCH_ERR_btree_node_read_err_fixable, 907 - c, NULL, b, i, 902 + c, NULL, b, i, k, 908 903 btree_node_bkey_bad_u64s, 909 904 "bad k->u64s %u (min %u max %zu)", k->u64s, 910 905 bkeyp_key_u64s(&b->format, k), ··· 926 921 bch2_bkey_val_to_text(&buf, c, u.s_c); 927 922 928 923 btree_err(-BCH_ERR_btree_node_read_err_fixable, 929 - c, NULL, b, i, 924 + c, NULL, b, i, k, 930 925 btree_node_bad_bkey, 931 926 "invalid bkey: %s", buf.buf); 932 927 goto drop_this_key; ··· 947 942 bch2_bkey_to_text(&buf, u.k); 948 943 949 944 if (btree_err(-BCH_ERR_btree_node_read_err_fixable, 950 - c, NULL, b, i, 945 + c, NULL, b, i, k, 951 946 btree_node_bkey_out_of_order, 952 947 "%s", buf.buf)) 953 948 goto drop_this_key; ··· 1016 1011 1017 1012 if (bch2_meta_read_fault("btree")) 1018 1013 btree_err(-BCH_ERR_btree_node_read_err_must_retry, 1019 - c, ca, b, NULL, 1014 + c, ca, b, NULL, NULL, 1020 1015 btree_node_fault_injected, 1021 1016 "dynamic fault"); 1022 1017 1023 1018 btree_err_on(le64_to_cpu(b->data->magic) != bset_magic(c), 1024 1019 -BCH_ERR_btree_node_read_err_must_retry, 1025 - c, ca, b, NULL, 1020 + c, ca, b, NULL, NULL, 1026 1021 btree_node_bad_magic, 1027 1022 "bad magic: want %llx, got %llx", 1028 1023 bset_magic(c), le64_to_cpu(b->data->magic)); ··· 1037 1032 1038 1033 btree_err_on(b->data->keys.seq != bp->seq, 1039 1034 -BCH_ERR_btree_node_read_err_must_retry, 1040 - c, ca, b, NULL, 1035 + c, ca, b, NULL, NULL, 1041 1036 btree_node_bad_seq, 1042 1037 "got wrong btree node: got\n%s", 1043 1038 (printbuf_reset(&buf), ··· 1046 1041 } else { 1047 1042 btree_err_on(!b->data->keys.seq, 1048 1043 -BCH_ERR_btree_node_read_err_must_retry, 1049 - c, ca, b, NULL, 1044 + c, ca, b, NULL, NULL, 1050 1045 btree_node_bad_seq, 1051 1046 "bad btree header: seq 0\n%s", 1052 1047 (printbuf_reset(&buf), ··· 1065 1060 1066 1061 btree_err_on(!bch2_checksum_type_valid(c, BSET_CSUM_TYPE(i)), 1067 1062 -BCH_ERR_btree_node_read_err_want_retry, 1068 - c, ca, b, i, 1063 + c, ca, b, i, NULL, 1069 1064 bset_unknown_csum, 1070 1065 "unknown checksum type %llu", BSET_CSUM_TYPE(i)); 1071 1066 ··· 1078 1073 1079 1074 btree_err_on(csum_bad, 1080 1075 -BCH_ERR_btree_node_read_err_want_retry, 1081 - c, ca, b, i, 1076 + c, ca, b, i, NULL, 1082 1077 bset_bad_csum, 1083 1078 "%s", 1084 1079 (printbuf_reset(&buf), ··· 1093 1088 btree_err_on(btree_node_type_is_extents(btree_node_type(b)) && 1094 1089 !BTREE_NODE_NEW_EXTENT_OVERWRITE(b->data), 1095 1090 -BCH_ERR_btree_node_read_err_incompatible, 1096 - c, NULL, b, NULL, 1091 + c, NULL, b, NULL, NULL, 1097 1092 btree_node_unsupported_version, 1098 1093 "btree node does not have NEW_EXTENT_OVERWRITE set"); 1099 1094 ··· 1107 1102 1108 1103 btree_err_on(!bch2_checksum_type_valid(c, BSET_CSUM_TYPE(i)), 1109 1104 -BCH_ERR_btree_node_read_err_want_retry, 1110 - c, ca, b, i, 1105 + c, ca, b, i, NULL, 1111 1106 bset_unknown_csum, 1112 1107 "unknown checksum type %llu", BSET_CSUM_TYPE(i)); 1113 1108 ··· 1119 1114 1120 1115 btree_err_on(csum_bad, 1121 1116 -BCH_ERR_btree_node_read_err_want_retry, 1122 - c, ca, b, i, 1117 + c, ca, b, i, NULL, 1123 1118 bset_bad_csum, 1124 1119 "%s", 1125 1120 (printbuf_reset(&buf), ··· 1157 1152 1158 1153 btree_err_on(blacklisted && first, 1159 1154 -BCH_ERR_btree_node_read_err_fixable, 1160 - c, ca, b, i, 1155 + c, ca, b, i, NULL, 1161 1156 bset_blacklisted_journal_seq, 1162 1157 "first btree node bset has blacklisted journal seq (%llu)", 1163 1158 le64_to_cpu(i->journal_seq)); 1164 1159 1165 1160 btree_err_on(blacklisted && ptr_written, 1166 1161 -BCH_ERR_btree_node_read_err_fixable, 1167 - c, ca, b, i, 1162 + c, ca, b, i, NULL, 1168 1163 first_bset_blacklisted_journal_seq, 1169 1164 "found blacklisted bset (journal seq %llu) in btree node at offset %u-%u/%u", 1170 1165 le64_to_cpu(i->journal_seq), ··· 1183 1178 if (ptr_written) { 1184 1179 btree_err_on(b->written < ptr_written, 1185 1180 -BCH_ERR_btree_node_read_err_want_retry, 1186 - c, ca, b, NULL, 1181 + c, ca, b, NULL, NULL, 1187 1182 btree_node_data_missing, 1188 1183 "btree node data missing: expected %u sectors, found %u", 1189 1184 ptr_written, b->written); ··· 1196 1191 le64_to_cpu(bne->keys.journal_seq), 1197 1192 true), 1198 1193 -BCH_ERR_btree_node_read_err_want_retry, 1199 - c, ca, b, NULL, 1194 + c, ca, b, NULL, NULL, 1200 1195 btree_node_bset_after_end, 1201 1196 "found bset signature after last bset"); 1202 1197 } ··· 1240 1235 bch2_bkey_val_to_text(&buf, c, u.s_c); 1241 1236 1242 1237 btree_err(-BCH_ERR_btree_node_read_err_fixable, 1243 - c, NULL, b, i, 1238 + c, NULL, b, i, k, 1244 1239 btree_node_bad_bkey, 1245 1240 "%s", buf.buf); 1246 1241 ··· 1476 1471 1477 1472 written2 = btree_node_sectors_written(c, ra->buf[i]); 1478 1473 if (btree_err_on(written2 != written, -BCH_ERR_btree_node_read_err_fixable, 1479 - c, NULL, b, NULL, 1474 + c, NULL, b, NULL, NULL, 1480 1475 btree_node_replicas_sectors_written_mismatch, 1481 1476 "btree node sectors written mismatch: %u != %u", 1482 1477 written, written2) || 1483 1478 btree_err_on(btree_node_has_extra_bsets(c, written2, ra->buf[i]), 1484 1479 -BCH_ERR_btree_node_read_err_fixable, 1485 - c, NULL, b, NULL, 1480 + c, NULL, b, NULL, NULL, 1486 1481 btree_node_bset_after_end, 1487 1482 "found bset signature after last bset") || 1488 1483 btree_err_on(memcmp(ra->buf[best], ra->buf[i], written << 9), 1489 1484 -BCH_ERR_btree_node_read_err_fixable, 1490 - c, NULL, b, NULL, 1485 + c, NULL, b, NULL, NULL, 1491 1486 btree_node_replicas_data_mismatch, 1492 1487 "btree node replicas content mismatch")) 1493 1488 dump_bset_maps = true;
+6 -6
fs/bcachefs/btree_key_cache.c
··· 424 424 goto err; 425 425 } 426 426 427 + ret = bch2_trans_relock(trans); 428 + if (ret) { 429 + kfree(new_k); 430 + goto err; 431 + } 432 + 427 433 if (!bch2_btree_node_relock(trans, ck_path, 0)) { 428 434 kfree(new_k); 429 435 trace_and_count(trans->c, trans_restart_relock_key_cache_fill, trans, _THIS_IP_, ck_path); 430 436 ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_key_cache_fill); 431 - goto err; 432 - } 433 - 434 - ret = bch2_trans_relock(trans); 435 - if (ret) { 436 - kfree(new_k); 437 437 goto err; 438 438 } 439 439 }
+1
fs/bcachefs/btree_locking.c
··· 215 215 216 216 if (unlikely(!best)) { 217 217 struct printbuf buf = PRINTBUF; 218 + buf.atomic++; 218 219 219 220 prt_printf(&buf, bch2_fmt(g->g->trans->c, "cycle of nofail locks")); 220 221
+1 -1
fs/bcachefs/buckets.c
··· 1134 1134 r.e.nr_required = 1; 1135 1135 1136 1136 bkey_for_each_ptr_decode(k.k, ptrs, p, entry) { 1137 - s64 disk_sectors; 1137 + s64 disk_sectors = 0; 1138 1138 ret = bch2_trigger_pointer(trans, btree_id, level, k, p, entry, &disk_sectors, flags); 1139 1139 if (ret < 0) 1140 1140 return ret;
+21
fs/bcachefs/disk_groups_format.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_DISK_GROUPS_FORMAT_H 3 + #define _BCACHEFS_DISK_GROUPS_FORMAT_H 4 + 5 + #define BCH_SB_LABEL_SIZE 32 6 + 7 + struct bch_disk_group { 8 + __u8 label[BCH_SB_LABEL_SIZE]; 9 + __le64 flags[2]; 10 + } __packed __aligned(8); 11 + 12 + LE64_BITMASK(BCH_GROUP_DELETED, struct bch_disk_group, flags[0], 0, 1) 13 + LE64_BITMASK(BCH_GROUP_DATA_ALLOWED, struct bch_disk_group, flags[0], 1, 6) 14 + LE64_BITMASK(BCH_GROUP_PARENT, struct bch_disk_group, flags[0], 6, 24) 15 + 16 + struct bch_sb_field_disk_groups { 17 + struct bch_sb_field field; 18 + struct bch_disk_group entries[]; 19 + } __packed __aligned(8); 20 + 21 + #endif /* _BCACHEFS_DISK_GROUPS_FORMAT_H */
+1 -1
fs/bcachefs/ec.c
··· 908 908 if (!genradix_ptr_alloc(&c->stripes, idx, gfp)) 909 909 return -BCH_ERR_ENOMEM_ec_stripe_mem_alloc; 910 910 911 - if (c->gc_pos.phase != GC_PHASE_NOT_RUNNING && 911 + if (c->gc_pos.phase != GC_PHASE_not_running && 912 912 !genradix_ptr_alloc(&c->gc_stripes, idx, gfp)) 913 913 return -BCH_ERR_ENOMEM_ec_stripe_mem_alloc; 914 914
+3 -3
fs/bcachefs/fs-io-buffered.c
··· 437 437 */ 438 438 439 439 /* 440 - * PageWriteback is effectively our ref on the inode - fixup i_blocks 441 - * before calling end_page_writeback: 440 + * The writeback flag is effectively our ref on the inode - 441 + * fixup i_blocks before calling folio_end_writeback: 442 442 */ 443 443 bch2_i_sectors_acct(c, io->inode, NULL, io->op.i_sectors_delta); 444 444 ··· 898 898 darray_for_each(fs, fi) { 899 899 f = *fi; 900 900 f_len = min(end, folio_end_pos(f)) - f_pos; 901 - f_copied = copy_page_from_iter_atomic(&f->page, f_offset, f_len, iter); 901 + f_copied = copy_folio_from_iter_atomic(f, f_offset, f_len, iter); 902 902 if (!f_copied) { 903 903 folios_trunc(&fs, fi); 904 904 break;
+3 -1
fs/bcachefs/fs-io-direct.c
··· 609 609 if (unlikely(ret)) 610 610 goto err_put_write_ref; 611 611 612 - if (unlikely((req->ki_pos|iter->count) & (block_bytes(c) - 1))) 612 + if (unlikely((req->ki_pos|iter->count) & (block_bytes(c) - 1))) { 613 + ret = -EINVAL; 613 614 goto err_put_write_ref; 615 + } 614 616 615 617 inode_dio_begin(&inode->v); 616 618 bch2_pagecache_block_get(inode);
+10 -2
fs/bcachefs/fs.c
··· 1939 1939 1940 1940 if (IS_ERR(sb)) { 1941 1941 ret = PTR_ERR(sb); 1942 - ret = bch2_err_class(ret); 1943 - return ERR_PTR(ret); 1942 + goto err; 1944 1943 } 1945 1944 1946 1945 c = sb->s_fs_info; ··· 2015 2016 err_put_super: 2016 2017 __bch2_fs_stop(c); 2017 2018 deactivate_locked_super(sb); 2019 + err: 2020 + /* 2021 + * On an inconsistency error in recovery we might see an -EROFS derived 2022 + * errorcode (from the journal), but we don't want to return that to 2023 + * userspace as that causes util-linux to retry the mount RO - which is 2024 + * confusing: 2025 + */ 2026 + if (bch2_err_matches(ret, EROFS) && ret != -EROFS) 2027 + ret = -EIO; 2018 2028 return ERR_PTR(bch2_err_class(ret)); 2019 2029 } 2020 2030
+14 -37
fs/bcachefs/fsck.c
··· 77 77 struct bkey_s_c k; 78 78 int ret; 79 79 80 - bch2_trans_iter_init(trans, &iter, BTREE_ID_inodes, 81 - POS(0, inode_nr), 82 - BTREE_ITER_all_snapshots); 83 - k = bch2_btree_iter_peek(&iter); 84 - ret = bkey_err(k); 85 - if (ret) 86 - goto err; 87 - 88 - if (!k.k || !bkey_eq(k.k->p, POS(0, inode_nr))) { 89 - ret = -BCH_ERR_ENOENT_inode; 90 - goto err; 80 + for_each_btree_key_norestart(trans, iter, BTREE_ID_inodes, POS(0, inode_nr), 81 + BTREE_ITER_all_snapshots, k, ret) { 82 + if (k.k->p.offset != inode_nr) 83 + break; 84 + if (!bkey_is_inode(k.k)) 85 + continue; 86 + ret = bch2_inode_unpack(k, inode); 87 + goto found; 91 88 } 92 - 93 - ret = bch2_inode_unpack(k, inode); 94 - err: 89 + ret = -BCH_ERR_ENOENT_inode; 90 + found: 95 91 bch_err_msg(trans->c, ret, "fetching inode %llu", inode_nr); 96 92 bch2_trans_iter_exit(trans, &iter); 97 93 return ret; ··· 766 770 return ret; 767 771 } 768 772 769 - static int check_key_has_snapshot(struct btree_trans *trans, 770 - struct btree_iter *iter, 771 - struct bkey_s_c k) 772 - { 773 - struct bch_fs *c = trans->c; 774 - struct printbuf buf = PRINTBUF; 775 - int ret = 0; 776 - 777 - if (mustfix_fsck_err_on(!bch2_snapshot_equiv(c, k.k->p.snapshot), c, 778 - bkey_in_missing_snapshot, 779 - "key in missing snapshot: %s", 780 - (bch2_bkey_val_to_text(&buf, c, k), buf.buf))) 781 - ret = bch2_btree_delete_at(trans, iter, 782 - BTREE_UPDATE_internal_snapshot_node) ?: 1; 783 - fsck_err: 784 - printbuf_exit(&buf); 785 - return ret; 786 - } 787 - 788 773 static int hash_redo_key(struct btree_trans *trans, 789 774 const struct bch_hash_desc desc, 790 775 struct bch_hash_info *hash_info, ··· 960 983 bool do_update = false; 961 984 int ret; 962 985 963 - ret = check_key_has_snapshot(trans, iter, k); 986 + ret = bch2_check_key_has_snapshot(trans, iter, k); 964 987 if (ret < 0) 965 988 goto err; 966 989 if (ret) ··· 1464 1487 struct printbuf buf = PRINTBUF; 1465 1488 int ret = 0; 1466 1489 1467 - ret = check_key_has_snapshot(trans, iter, k); 1490 + ret = bch2_check_key_has_snapshot(trans, iter, k); 1468 1491 if (ret) { 1469 1492 ret = ret < 0 ? ret : 0; 1470 1493 goto out; ··· 1987 2010 struct printbuf buf = PRINTBUF; 1988 2011 int ret = 0; 1989 2012 1990 - ret = check_key_has_snapshot(trans, iter, k); 2013 + ret = bch2_check_key_has_snapshot(trans, iter, k); 1991 2014 if (ret) { 1992 2015 ret = ret < 0 ? ret : 0; 1993 2016 goto out; ··· 2142 2165 struct inode_walker_entry *i; 2143 2166 int ret; 2144 2167 2145 - ret = check_key_has_snapshot(trans, iter, k); 2168 + ret = bch2_check_key_has_snapshot(trans, iter, k); 2146 2169 if (ret < 0) 2147 2170 return ret; 2148 2171 if (ret)
+15
fs/bcachefs/journal_seq_blacklist_format.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_JOURNAL_SEQ_BLACKLIST_FORMAT_H 3 + #define _BCACHEFS_JOURNAL_SEQ_BLACKLIST_FORMAT_H 4 + 5 + struct journal_seq_blacklist_entry { 6 + __le64 start; 7 + __le64 end; 8 + }; 9 + 10 + struct bch_sb_field_journal_seq_blacklist { 11 + struct bch_sb_field field; 12 + struct journal_seq_blacklist_entry start[]; 13 + }; 14 + 15 + #endif /* _BCACHEFS_JOURNAL_SEQ_BLACKLIST_FORMAT_H */
+1
fs/bcachefs/mean_and_variance_test.c
··· 217 217 kunit_test_suite(mean_and_variance_test_suite); 218 218 219 219 MODULE_AUTHOR("Daniel B. Hill"); 220 + MODULE_DESCRIPTION("bcachefs filesystem mean and variance unit tests"); 220 221 MODULE_LICENSE("GPL");
+15 -1
fs/bcachefs/move.c
··· 547 547 ctxt->stats->pos = BBPOS(btree_id, start); 548 548 } 549 549 550 + bch2_trans_begin(trans); 550 551 bch2_trans_iter_init(trans, &iter, btree_id, start, 551 552 BTREE_ITER_prefetch| 552 553 BTREE_ITER_all_snapshots); ··· 921 920 ? c->opts.metadata_replicas 922 921 : io_opts->data_replicas; 923 922 924 - if (!nr_good || nr_good >= replicas) 923 + rcu_read_lock(); 924 + struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); 925 + unsigned i = 0; 926 + bkey_for_each_ptr(ptrs, ptr) { 927 + struct bch_dev *ca = bch2_dev_rcu(c, ptr->dev); 928 + if (!ptr->cached && 929 + (!ca || !ca->mi.durability)) 930 + data_opts->kill_ptrs |= BIT(i); 931 + i++; 932 + } 933 + rcu_read_unlock(); 934 + 935 + if (!data_opts->kill_ptrs && 936 + (!nr_good || nr_good >= replicas)) 925 937 return false; 926 938 927 939 data_opts->target = 0;
+31
fs/bcachefs/replicas_format.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_REPLICAS_FORMAT_H 3 + #define _BCACHEFS_REPLICAS_FORMAT_H 4 + 5 + struct bch_replicas_entry_v0 { 6 + __u8 data_type; 7 + __u8 nr_devs; 8 + __u8 devs[]; 9 + } __packed; 10 + 11 + struct bch_sb_field_replicas_v0 { 12 + struct bch_sb_field field; 13 + struct bch_replicas_entry_v0 entries[]; 14 + } __packed __aligned(8); 15 + 16 + struct bch_replicas_entry_v1 { 17 + __u8 data_type; 18 + __u8 nr_devs; 19 + __u8 nr_required; 20 + __u8 devs[]; 21 + } __packed; 22 + 23 + struct bch_sb_field_replicas { 24 + struct bch_sb_field field; 25 + struct bch_replicas_entry_v1 entries[]; 26 + } __packed __aligned(8); 27 + 28 + #define replicas_entry_bytes(_i) \ 29 + (offsetof(typeof(*(_i)), devs) + (_i)->nr_devs) 30 + 31 + #endif /* _BCACHEFS_REPLICAS_FORMAT_H */
+10 -3
fs/bcachefs/sb-downgrade.c
··· 146 146 for (const struct bch_sb_field_downgrade_entry *i = e->entries; 147 147 (void *) i < vstruct_end(&e->field); 148 148 i = downgrade_entry_next_c(i)) { 149 + /* 150 + * Careful: sb_field_downgrade_entry is only 2 byte aligned, but 151 + * section sizes are 8 byte aligned - an empty entry spanning 152 + * the end of the section is allowed (and ignored): 153 + */ 154 + if ((void *) &i->errors[0] > vstruct_end(&e->field)) 155 + break; 156 + 149 157 if (flags & BCH_VALIDATE_write && 150 - ((void *) &i->errors[0] > vstruct_end(&e->field) || 151 - (void *) downgrade_entry_next_c(i) > vstruct_end(&e->field))) { 152 - prt_printf(err, "downgrade entry overruns end of superblock section)"); 158 + (void *) downgrade_entry_next_c(i) > vstruct_end(&e->field)) { 159 + prt_printf(err, "downgrade entry overruns end of superblock section"); 153 160 return -BCH_ERR_invalid_sb_downgrade; 154 161 } 155 162
+17
fs/bcachefs/sb-downgrade_format.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_SB_DOWNGRADE_FORMAT_H 3 + #define _BCACHEFS_SB_DOWNGRADE_FORMAT_H 4 + 5 + struct bch_sb_field_downgrade_entry { 6 + __le16 version; 7 + __le64 recovery_passes[2]; 8 + __le16 nr_errors; 9 + __le16 errors[] __counted_by(nr_errors); 10 + } __packed __aligned(2); 11 + 12 + struct bch_sb_field_downgrade { 13 + struct bch_sb_field field; 14 + struct bch_sb_field_downgrade_entry entries[]; 15 + }; 16 + 17 + #endif /* _BCACHEFS_SB_DOWNGRADE_FORMAT_H */
+296
fs/bcachefs/sb-errors_format.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_SB_ERRORS_FORMAT_H 3 + #define _BCACHEFS_SB_ERRORS_FORMAT_H 4 + 5 + #define BCH_SB_ERRS() \ 6 + x(clean_but_journal_not_empty, 0) \ 7 + x(dirty_but_no_journal_entries, 1) \ 8 + x(dirty_but_no_journal_entries_post_drop_nonflushes, 2) \ 9 + x(sb_clean_journal_seq_mismatch, 3) \ 10 + x(sb_clean_btree_root_mismatch, 4) \ 11 + x(sb_clean_missing, 5) \ 12 + x(jset_unsupported_version, 6) \ 13 + x(jset_unknown_csum, 7) \ 14 + x(jset_last_seq_newer_than_seq, 8) \ 15 + x(jset_past_bucket_end, 9) \ 16 + x(jset_seq_blacklisted, 10) \ 17 + x(journal_entries_missing, 11) \ 18 + x(journal_entry_replicas_not_marked, 12) \ 19 + x(journal_entry_past_jset_end, 13) \ 20 + x(journal_entry_replicas_data_mismatch, 14) \ 21 + x(journal_entry_bkey_u64s_0, 15) \ 22 + x(journal_entry_bkey_past_end, 16) \ 23 + x(journal_entry_bkey_bad_format, 17) \ 24 + x(journal_entry_bkey_invalid, 18) \ 25 + x(journal_entry_btree_root_bad_size, 19) \ 26 + x(journal_entry_blacklist_bad_size, 20) \ 27 + x(journal_entry_blacklist_v2_bad_size, 21) \ 28 + x(journal_entry_blacklist_v2_start_past_end, 22) \ 29 + x(journal_entry_usage_bad_size, 23) \ 30 + x(journal_entry_data_usage_bad_size, 24) \ 31 + x(journal_entry_clock_bad_size, 25) \ 32 + x(journal_entry_clock_bad_rw, 26) \ 33 + x(journal_entry_dev_usage_bad_size, 27) \ 34 + x(journal_entry_dev_usage_bad_dev, 28) \ 35 + x(journal_entry_dev_usage_bad_pad, 29) \ 36 + x(btree_node_unreadable, 30) \ 37 + x(btree_node_fault_injected, 31) \ 38 + x(btree_node_bad_magic, 32) \ 39 + x(btree_node_bad_seq, 33) \ 40 + x(btree_node_unsupported_version, 34) \ 41 + x(btree_node_bset_older_than_sb_min, 35) \ 42 + x(btree_node_bset_newer_than_sb, 36) \ 43 + x(btree_node_data_missing, 37) \ 44 + x(btree_node_bset_after_end, 38) \ 45 + x(btree_node_replicas_sectors_written_mismatch, 39) \ 46 + x(btree_node_replicas_data_mismatch, 40) \ 47 + x(bset_unknown_csum, 41) \ 48 + x(bset_bad_csum, 42) \ 49 + x(bset_past_end_of_btree_node, 43) \ 50 + x(bset_wrong_sector_offset, 44) \ 51 + x(bset_empty, 45) \ 52 + x(bset_bad_seq, 46) \ 53 + x(bset_blacklisted_journal_seq, 47) \ 54 + x(first_bset_blacklisted_journal_seq, 48) \ 55 + x(btree_node_bad_btree, 49) \ 56 + x(btree_node_bad_level, 50) \ 57 + x(btree_node_bad_min_key, 51) \ 58 + x(btree_node_bad_max_key, 52) \ 59 + x(btree_node_bad_format, 53) \ 60 + x(btree_node_bkey_past_bset_end, 54) \ 61 + x(btree_node_bkey_bad_format, 55) \ 62 + x(btree_node_bad_bkey, 56) \ 63 + x(btree_node_bkey_out_of_order, 57) \ 64 + x(btree_root_bkey_invalid, 58) \ 65 + x(btree_root_read_error, 59) \ 66 + x(btree_root_bad_min_key, 60) \ 67 + x(btree_root_bad_max_key, 61) \ 68 + x(btree_node_read_error, 62) \ 69 + x(btree_node_topology_bad_min_key, 63) \ 70 + x(btree_node_topology_bad_max_key, 64) \ 71 + x(btree_node_topology_overwritten_by_prev_node, 65) \ 72 + x(btree_node_topology_overwritten_by_next_node, 66) \ 73 + x(btree_node_topology_interior_node_empty, 67) \ 74 + x(fs_usage_hidden_wrong, 68) \ 75 + x(fs_usage_btree_wrong, 69) \ 76 + x(fs_usage_data_wrong, 70) \ 77 + x(fs_usage_cached_wrong, 71) \ 78 + x(fs_usage_reserved_wrong, 72) \ 79 + x(fs_usage_persistent_reserved_wrong, 73) \ 80 + x(fs_usage_nr_inodes_wrong, 74) \ 81 + x(fs_usage_replicas_wrong, 75) \ 82 + x(dev_usage_buckets_wrong, 76) \ 83 + x(dev_usage_sectors_wrong, 77) \ 84 + x(dev_usage_fragmented_wrong, 78) \ 85 + x(dev_usage_buckets_ec_wrong, 79) \ 86 + x(bkey_version_in_future, 80) \ 87 + x(bkey_u64s_too_small, 81) \ 88 + x(bkey_invalid_type_for_btree, 82) \ 89 + x(bkey_extent_size_zero, 83) \ 90 + x(bkey_extent_size_greater_than_offset, 84) \ 91 + x(bkey_size_nonzero, 85) \ 92 + x(bkey_snapshot_nonzero, 86) \ 93 + x(bkey_snapshot_zero, 87) \ 94 + x(bkey_at_pos_max, 88) \ 95 + x(bkey_before_start_of_btree_node, 89) \ 96 + x(bkey_after_end_of_btree_node, 90) \ 97 + x(bkey_val_size_nonzero, 91) \ 98 + x(bkey_val_size_too_small, 92) \ 99 + x(alloc_v1_val_size_bad, 93) \ 100 + x(alloc_v2_unpack_error, 94) \ 101 + x(alloc_v3_unpack_error, 95) \ 102 + x(alloc_v4_val_size_bad, 96) \ 103 + x(alloc_v4_backpointers_start_bad, 97) \ 104 + x(alloc_key_data_type_bad, 98) \ 105 + x(alloc_key_empty_but_have_data, 99) \ 106 + x(alloc_key_dirty_sectors_0, 100) \ 107 + x(alloc_key_data_type_inconsistency, 101) \ 108 + x(alloc_key_to_missing_dev_bucket, 102) \ 109 + x(alloc_key_cached_inconsistency, 103) \ 110 + x(alloc_key_cached_but_read_time_zero, 104) \ 111 + x(alloc_key_to_missing_lru_entry, 105) \ 112 + x(alloc_key_data_type_wrong, 106) \ 113 + x(alloc_key_gen_wrong, 107) \ 114 + x(alloc_key_dirty_sectors_wrong, 108) \ 115 + x(alloc_key_cached_sectors_wrong, 109) \ 116 + x(alloc_key_stripe_wrong, 110) \ 117 + x(alloc_key_stripe_redundancy_wrong, 111) \ 118 + x(bucket_sector_count_overflow, 112) \ 119 + x(bucket_metadata_type_mismatch, 113) \ 120 + x(need_discard_key_wrong, 114) \ 121 + x(freespace_key_wrong, 115) \ 122 + x(freespace_hole_missing, 116) \ 123 + x(bucket_gens_val_size_bad, 117) \ 124 + x(bucket_gens_key_wrong, 118) \ 125 + x(bucket_gens_hole_wrong, 119) \ 126 + x(bucket_gens_to_invalid_dev, 120) \ 127 + x(bucket_gens_to_invalid_buckets, 121) \ 128 + x(bucket_gens_nonzero_for_invalid_buckets, 122) \ 129 + x(need_discard_freespace_key_to_invalid_dev_bucket, 123) \ 130 + x(need_discard_freespace_key_bad, 124) \ 131 + x(backpointer_bucket_offset_wrong, 125) \ 132 + x(backpointer_to_missing_device, 126) \ 133 + x(backpointer_to_missing_alloc, 127) \ 134 + x(backpointer_to_missing_ptr, 128) \ 135 + x(lru_entry_at_time_0, 129) \ 136 + x(lru_entry_to_invalid_bucket, 130) \ 137 + x(lru_entry_bad, 131) \ 138 + x(btree_ptr_val_too_big, 132) \ 139 + x(btree_ptr_v2_val_too_big, 133) \ 140 + x(btree_ptr_has_non_ptr, 134) \ 141 + x(extent_ptrs_invalid_entry, 135) \ 142 + x(extent_ptrs_no_ptrs, 136) \ 143 + x(extent_ptrs_too_many_ptrs, 137) \ 144 + x(extent_ptrs_redundant_crc, 138) \ 145 + x(extent_ptrs_redundant_stripe, 139) \ 146 + x(extent_ptrs_unwritten, 140) \ 147 + x(extent_ptrs_written_and_unwritten, 141) \ 148 + x(ptr_to_invalid_device, 142) \ 149 + x(ptr_to_duplicate_device, 143) \ 150 + x(ptr_after_last_bucket, 144) \ 151 + x(ptr_before_first_bucket, 145) \ 152 + x(ptr_spans_multiple_buckets, 146) \ 153 + x(ptr_to_missing_backpointer, 147) \ 154 + x(ptr_to_missing_alloc_key, 148) \ 155 + x(ptr_to_missing_replicas_entry, 149) \ 156 + x(ptr_to_missing_stripe, 150) \ 157 + x(ptr_to_incorrect_stripe, 151) \ 158 + x(ptr_gen_newer_than_bucket_gen, 152) \ 159 + x(ptr_too_stale, 153) \ 160 + x(stale_dirty_ptr, 154) \ 161 + x(ptr_bucket_data_type_mismatch, 155) \ 162 + x(ptr_cached_and_erasure_coded, 156) \ 163 + x(ptr_crc_uncompressed_size_too_small, 157) \ 164 + x(ptr_crc_csum_type_unknown, 158) \ 165 + x(ptr_crc_compression_type_unknown, 159) \ 166 + x(ptr_crc_redundant, 160) \ 167 + x(ptr_crc_uncompressed_size_too_big, 161) \ 168 + x(ptr_crc_nonce_mismatch, 162) \ 169 + x(ptr_stripe_redundant, 163) \ 170 + x(reservation_key_nr_replicas_invalid, 164) \ 171 + x(reflink_v_refcount_wrong, 165) \ 172 + x(reflink_p_to_missing_reflink_v, 166) \ 173 + x(stripe_pos_bad, 167) \ 174 + x(stripe_val_size_bad, 168) \ 175 + x(stripe_sector_count_wrong, 169) \ 176 + x(snapshot_tree_pos_bad, 170) \ 177 + x(snapshot_tree_to_missing_snapshot, 171) \ 178 + x(snapshot_tree_to_missing_subvol, 172) \ 179 + x(snapshot_tree_to_wrong_subvol, 173) \ 180 + x(snapshot_tree_to_snapshot_subvol, 174) \ 181 + x(snapshot_pos_bad, 175) \ 182 + x(snapshot_parent_bad, 176) \ 183 + x(snapshot_children_not_normalized, 177) \ 184 + x(snapshot_child_duplicate, 178) \ 185 + x(snapshot_child_bad, 179) \ 186 + x(snapshot_skiplist_not_normalized, 180) \ 187 + x(snapshot_skiplist_bad, 181) \ 188 + x(snapshot_should_not_have_subvol, 182) \ 189 + x(snapshot_to_bad_snapshot_tree, 183) \ 190 + x(snapshot_bad_depth, 184) \ 191 + x(snapshot_bad_skiplist, 185) \ 192 + x(subvol_pos_bad, 186) \ 193 + x(subvol_not_master_and_not_snapshot, 187) \ 194 + x(subvol_to_missing_root, 188) \ 195 + x(subvol_root_wrong_bi_subvol, 189) \ 196 + x(bkey_in_missing_snapshot, 190) \ 197 + x(inode_pos_inode_nonzero, 191) \ 198 + x(inode_pos_blockdev_range, 192) \ 199 + x(inode_unpack_error, 193) \ 200 + x(inode_str_hash_invalid, 194) \ 201 + x(inode_v3_fields_start_bad, 195) \ 202 + x(inode_snapshot_mismatch, 196) \ 203 + x(inode_unlinked_but_clean, 197) \ 204 + x(inode_unlinked_but_nlink_nonzero, 198) \ 205 + x(inode_checksum_type_invalid, 199) \ 206 + x(inode_compression_type_invalid, 200) \ 207 + x(inode_subvol_root_but_not_dir, 201) \ 208 + x(inode_i_size_dirty_but_clean, 202) \ 209 + x(inode_i_sectors_dirty_but_clean, 203) \ 210 + x(inode_i_sectors_wrong, 204) \ 211 + x(inode_dir_wrong_nlink, 205) \ 212 + x(inode_dir_multiple_links, 206) \ 213 + x(inode_multiple_links_but_nlink_0, 207) \ 214 + x(inode_wrong_backpointer, 208) \ 215 + x(inode_wrong_nlink, 209) \ 216 + x(inode_unreachable, 210) \ 217 + x(deleted_inode_but_clean, 211) \ 218 + x(deleted_inode_missing, 212) \ 219 + x(deleted_inode_is_dir, 213) \ 220 + x(deleted_inode_not_unlinked, 214) \ 221 + x(extent_overlapping, 215) \ 222 + x(extent_in_missing_inode, 216) \ 223 + x(extent_in_non_reg_inode, 217) \ 224 + x(extent_past_end_of_inode, 218) \ 225 + x(dirent_empty_name, 219) \ 226 + x(dirent_val_too_big, 220) \ 227 + x(dirent_name_too_long, 221) \ 228 + x(dirent_name_embedded_nul, 222) \ 229 + x(dirent_name_dot_or_dotdot, 223) \ 230 + x(dirent_name_has_slash, 224) \ 231 + x(dirent_d_type_wrong, 225) \ 232 + x(inode_bi_parent_wrong, 226) \ 233 + x(dirent_in_missing_dir_inode, 227) \ 234 + x(dirent_in_non_dir_inode, 228) \ 235 + x(dirent_to_missing_inode, 229) \ 236 + x(dirent_to_missing_subvol, 230) \ 237 + x(dirent_to_itself, 231) \ 238 + x(quota_type_invalid, 232) \ 239 + x(xattr_val_size_too_small, 233) \ 240 + x(xattr_val_size_too_big, 234) \ 241 + x(xattr_invalid_type, 235) \ 242 + x(xattr_name_invalid_chars, 236) \ 243 + x(xattr_in_missing_inode, 237) \ 244 + x(root_subvol_missing, 238) \ 245 + x(root_dir_missing, 239) \ 246 + x(root_inode_not_dir, 240) \ 247 + x(dir_loop, 241) \ 248 + x(hash_table_key_duplicate, 242) \ 249 + x(hash_table_key_wrong_offset, 243) \ 250 + x(unlinked_inode_not_on_deleted_list, 244) \ 251 + x(reflink_p_front_pad_bad, 245) \ 252 + x(journal_entry_dup_same_device, 246) \ 253 + x(inode_bi_subvol_missing, 247) \ 254 + x(inode_bi_subvol_wrong, 248) \ 255 + x(inode_points_to_missing_dirent, 249) \ 256 + x(inode_points_to_wrong_dirent, 250) \ 257 + x(inode_bi_parent_nonzero, 251) \ 258 + x(dirent_to_missing_parent_subvol, 252) \ 259 + x(dirent_not_visible_in_parent_subvol, 253) \ 260 + x(subvol_fs_path_parent_wrong, 254) \ 261 + x(subvol_root_fs_path_parent_nonzero, 255) \ 262 + x(subvol_children_not_set, 256) \ 263 + x(subvol_children_bad, 257) \ 264 + x(subvol_loop, 258) \ 265 + x(subvol_unreachable, 259) \ 266 + x(btree_node_bkey_bad_u64s, 260) \ 267 + x(btree_node_topology_empty_interior_node, 261) \ 268 + x(btree_ptr_v2_min_key_bad, 262) \ 269 + x(btree_root_unreadable_and_scan_found_nothing, 263) \ 270 + x(snapshot_node_missing, 264) \ 271 + x(dup_backpointer_to_bad_csum_extent, 265) \ 272 + x(btree_bitmap_not_marked, 266) \ 273 + x(sb_clean_entry_overrun, 267) \ 274 + x(btree_ptr_v2_written_0, 268) \ 275 + x(subvol_snapshot_bad, 269) \ 276 + x(subvol_inode_bad, 270) 277 + 278 + enum bch_sb_error_id { 279 + #define x(t, n) BCH_FSCK_ERR_##t = n, 280 + BCH_SB_ERRS() 281 + #undef x 282 + BCH_SB_ERR_MAX 283 + }; 284 + 285 + struct bch_sb_field_errors { 286 + struct bch_sb_field field; 287 + struct bch_sb_field_error_entry { 288 + __le64 v; 289 + __le64 last_error_time; 290 + } entries[]; 291 + }; 292 + 293 + LE64_BITMASK(BCH_SB_ERROR_ENTRY_ID, struct bch_sb_field_error_entry, v, 0, 16); 294 + LE64_BITMASK(BCH_SB_ERROR_ENTRY_NR, struct bch_sb_field_error_entry, v, 16, 64); 295 + 296 + #endif /* _BCACHEFS_SB_ERRORS_FORMAT_H */
-281
fs/bcachefs/sb-errors_types.h
··· 4 4 5 5 #include "darray.h" 6 6 7 - #define BCH_SB_ERRS() \ 8 - x(clean_but_journal_not_empty, 0) \ 9 - x(dirty_but_no_journal_entries, 1) \ 10 - x(dirty_but_no_journal_entries_post_drop_nonflushes, 2) \ 11 - x(sb_clean_journal_seq_mismatch, 3) \ 12 - x(sb_clean_btree_root_mismatch, 4) \ 13 - x(sb_clean_missing, 5) \ 14 - x(jset_unsupported_version, 6) \ 15 - x(jset_unknown_csum, 7) \ 16 - x(jset_last_seq_newer_than_seq, 8) \ 17 - x(jset_past_bucket_end, 9) \ 18 - x(jset_seq_blacklisted, 10) \ 19 - x(journal_entries_missing, 11) \ 20 - x(journal_entry_replicas_not_marked, 12) \ 21 - x(journal_entry_past_jset_end, 13) \ 22 - x(journal_entry_replicas_data_mismatch, 14) \ 23 - x(journal_entry_bkey_u64s_0, 15) \ 24 - x(journal_entry_bkey_past_end, 16) \ 25 - x(journal_entry_bkey_bad_format, 17) \ 26 - x(journal_entry_bkey_invalid, 18) \ 27 - x(journal_entry_btree_root_bad_size, 19) \ 28 - x(journal_entry_blacklist_bad_size, 20) \ 29 - x(journal_entry_blacklist_v2_bad_size, 21) \ 30 - x(journal_entry_blacklist_v2_start_past_end, 22) \ 31 - x(journal_entry_usage_bad_size, 23) \ 32 - x(journal_entry_data_usage_bad_size, 24) \ 33 - x(journal_entry_clock_bad_size, 25) \ 34 - x(journal_entry_clock_bad_rw, 26) \ 35 - x(journal_entry_dev_usage_bad_size, 27) \ 36 - x(journal_entry_dev_usage_bad_dev, 28) \ 37 - x(journal_entry_dev_usage_bad_pad, 29) \ 38 - x(btree_node_unreadable, 30) \ 39 - x(btree_node_fault_injected, 31) \ 40 - x(btree_node_bad_magic, 32) \ 41 - x(btree_node_bad_seq, 33) \ 42 - x(btree_node_unsupported_version, 34) \ 43 - x(btree_node_bset_older_than_sb_min, 35) \ 44 - x(btree_node_bset_newer_than_sb, 36) \ 45 - x(btree_node_data_missing, 37) \ 46 - x(btree_node_bset_after_end, 38) \ 47 - x(btree_node_replicas_sectors_written_mismatch, 39) \ 48 - x(btree_node_replicas_data_mismatch, 40) \ 49 - x(bset_unknown_csum, 41) \ 50 - x(bset_bad_csum, 42) \ 51 - x(bset_past_end_of_btree_node, 43) \ 52 - x(bset_wrong_sector_offset, 44) \ 53 - x(bset_empty, 45) \ 54 - x(bset_bad_seq, 46) \ 55 - x(bset_blacklisted_journal_seq, 47) \ 56 - x(first_bset_blacklisted_journal_seq, 48) \ 57 - x(btree_node_bad_btree, 49) \ 58 - x(btree_node_bad_level, 50) \ 59 - x(btree_node_bad_min_key, 51) \ 60 - x(btree_node_bad_max_key, 52) \ 61 - x(btree_node_bad_format, 53) \ 62 - x(btree_node_bkey_past_bset_end, 54) \ 63 - x(btree_node_bkey_bad_format, 55) \ 64 - x(btree_node_bad_bkey, 56) \ 65 - x(btree_node_bkey_out_of_order, 57) \ 66 - x(btree_root_bkey_invalid, 58) \ 67 - x(btree_root_read_error, 59) \ 68 - x(btree_root_bad_min_key, 60) \ 69 - x(btree_root_bad_max_key, 61) \ 70 - x(btree_node_read_error, 62) \ 71 - x(btree_node_topology_bad_min_key, 63) \ 72 - x(btree_node_topology_bad_max_key, 64) \ 73 - x(btree_node_topology_overwritten_by_prev_node, 65) \ 74 - x(btree_node_topology_overwritten_by_next_node, 66) \ 75 - x(btree_node_topology_interior_node_empty, 67) \ 76 - x(fs_usage_hidden_wrong, 68) \ 77 - x(fs_usage_btree_wrong, 69) \ 78 - x(fs_usage_data_wrong, 70) \ 79 - x(fs_usage_cached_wrong, 71) \ 80 - x(fs_usage_reserved_wrong, 72) \ 81 - x(fs_usage_persistent_reserved_wrong, 73) \ 82 - x(fs_usage_nr_inodes_wrong, 74) \ 83 - x(fs_usage_replicas_wrong, 75) \ 84 - x(dev_usage_buckets_wrong, 76) \ 85 - x(dev_usage_sectors_wrong, 77) \ 86 - x(dev_usage_fragmented_wrong, 78) \ 87 - x(dev_usage_buckets_ec_wrong, 79) \ 88 - x(bkey_version_in_future, 80) \ 89 - x(bkey_u64s_too_small, 81) \ 90 - x(bkey_invalid_type_for_btree, 82) \ 91 - x(bkey_extent_size_zero, 83) \ 92 - x(bkey_extent_size_greater_than_offset, 84) \ 93 - x(bkey_size_nonzero, 85) \ 94 - x(bkey_snapshot_nonzero, 86) \ 95 - x(bkey_snapshot_zero, 87) \ 96 - x(bkey_at_pos_max, 88) \ 97 - x(bkey_before_start_of_btree_node, 89) \ 98 - x(bkey_after_end_of_btree_node, 90) \ 99 - x(bkey_val_size_nonzero, 91) \ 100 - x(bkey_val_size_too_small, 92) \ 101 - x(alloc_v1_val_size_bad, 93) \ 102 - x(alloc_v2_unpack_error, 94) \ 103 - x(alloc_v3_unpack_error, 95) \ 104 - x(alloc_v4_val_size_bad, 96) \ 105 - x(alloc_v4_backpointers_start_bad, 97) \ 106 - x(alloc_key_data_type_bad, 98) \ 107 - x(alloc_key_empty_but_have_data, 99) \ 108 - x(alloc_key_dirty_sectors_0, 100) \ 109 - x(alloc_key_data_type_inconsistency, 101) \ 110 - x(alloc_key_to_missing_dev_bucket, 102) \ 111 - x(alloc_key_cached_inconsistency, 103) \ 112 - x(alloc_key_cached_but_read_time_zero, 104) \ 113 - x(alloc_key_to_missing_lru_entry, 105) \ 114 - x(alloc_key_data_type_wrong, 106) \ 115 - x(alloc_key_gen_wrong, 107) \ 116 - x(alloc_key_dirty_sectors_wrong, 108) \ 117 - x(alloc_key_cached_sectors_wrong, 109) \ 118 - x(alloc_key_stripe_wrong, 110) \ 119 - x(alloc_key_stripe_redundancy_wrong, 111) \ 120 - x(bucket_sector_count_overflow, 112) \ 121 - x(bucket_metadata_type_mismatch, 113) \ 122 - x(need_discard_key_wrong, 114) \ 123 - x(freespace_key_wrong, 115) \ 124 - x(freespace_hole_missing, 116) \ 125 - x(bucket_gens_val_size_bad, 117) \ 126 - x(bucket_gens_key_wrong, 118) \ 127 - x(bucket_gens_hole_wrong, 119) \ 128 - x(bucket_gens_to_invalid_dev, 120) \ 129 - x(bucket_gens_to_invalid_buckets, 121) \ 130 - x(bucket_gens_nonzero_for_invalid_buckets, 122) \ 131 - x(need_discard_freespace_key_to_invalid_dev_bucket, 123) \ 132 - x(need_discard_freespace_key_bad, 124) \ 133 - x(backpointer_bucket_offset_wrong, 125) \ 134 - x(backpointer_to_missing_device, 126) \ 135 - x(backpointer_to_missing_alloc, 127) \ 136 - x(backpointer_to_missing_ptr, 128) \ 137 - x(lru_entry_at_time_0, 129) \ 138 - x(lru_entry_to_invalid_bucket, 130) \ 139 - x(lru_entry_bad, 131) \ 140 - x(btree_ptr_val_too_big, 132) \ 141 - x(btree_ptr_v2_val_too_big, 133) \ 142 - x(btree_ptr_has_non_ptr, 134) \ 143 - x(extent_ptrs_invalid_entry, 135) \ 144 - x(extent_ptrs_no_ptrs, 136) \ 145 - x(extent_ptrs_too_many_ptrs, 137) \ 146 - x(extent_ptrs_redundant_crc, 138) \ 147 - x(extent_ptrs_redundant_stripe, 139) \ 148 - x(extent_ptrs_unwritten, 140) \ 149 - x(extent_ptrs_written_and_unwritten, 141) \ 150 - x(ptr_to_invalid_device, 142) \ 151 - x(ptr_to_duplicate_device, 143) \ 152 - x(ptr_after_last_bucket, 144) \ 153 - x(ptr_before_first_bucket, 145) \ 154 - x(ptr_spans_multiple_buckets, 146) \ 155 - x(ptr_to_missing_backpointer, 147) \ 156 - x(ptr_to_missing_alloc_key, 148) \ 157 - x(ptr_to_missing_replicas_entry, 149) \ 158 - x(ptr_to_missing_stripe, 150) \ 159 - x(ptr_to_incorrect_stripe, 151) \ 160 - x(ptr_gen_newer_than_bucket_gen, 152) \ 161 - x(ptr_too_stale, 153) \ 162 - x(stale_dirty_ptr, 154) \ 163 - x(ptr_bucket_data_type_mismatch, 155) \ 164 - x(ptr_cached_and_erasure_coded, 156) \ 165 - x(ptr_crc_uncompressed_size_too_small, 157) \ 166 - x(ptr_crc_csum_type_unknown, 158) \ 167 - x(ptr_crc_compression_type_unknown, 159) \ 168 - x(ptr_crc_redundant, 160) \ 169 - x(ptr_crc_uncompressed_size_too_big, 161) \ 170 - x(ptr_crc_nonce_mismatch, 162) \ 171 - x(ptr_stripe_redundant, 163) \ 172 - x(reservation_key_nr_replicas_invalid, 164) \ 173 - x(reflink_v_refcount_wrong, 165) \ 174 - x(reflink_p_to_missing_reflink_v, 166) \ 175 - x(stripe_pos_bad, 167) \ 176 - x(stripe_val_size_bad, 168) \ 177 - x(stripe_sector_count_wrong, 169) \ 178 - x(snapshot_tree_pos_bad, 170) \ 179 - x(snapshot_tree_to_missing_snapshot, 171) \ 180 - x(snapshot_tree_to_missing_subvol, 172) \ 181 - x(snapshot_tree_to_wrong_subvol, 173) \ 182 - x(snapshot_tree_to_snapshot_subvol, 174) \ 183 - x(snapshot_pos_bad, 175) \ 184 - x(snapshot_parent_bad, 176) \ 185 - x(snapshot_children_not_normalized, 177) \ 186 - x(snapshot_child_duplicate, 178) \ 187 - x(snapshot_child_bad, 179) \ 188 - x(snapshot_skiplist_not_normalized, 180) \ 189 - x(snapshot_skiplist_bad, 181) \ 190 - x(snapshot_should_not_have_subvol, 182) \ 191 - x(snapshot_to_bad_snapshot_tree, 183) \ 192 - x(snapshot_bad_depth, 184) \ 193 - x(snapshot_bad_skiplist, 185) \ 194 - x(subvol_pos_bad, 186) \ 195 - x(subvol_not_master_and_not_snapshot, 187) \ 196 - x(subvol_to_missing_root, 188) \ 197 - x(subvol_root_wrong_bi_subvol, 189) \ 198 - x(bkey_in_missing_snapshot, 190) \ 199 - x(inode_pos_inode_nonzero, 191) \ 200 - x(inode_pos_blockdev_range, 192) \ 201 - x(inode_unpack_error, 193) \ 202 - x(inode_str_hash_invalid, 194) \ 203 - x(inode_v3_fields_start_bad, 195) \ 204 - x(inode_snapshot_mismatch, 196) \ 205 - x(inode_unlinked_but_clean, 197) \ 206 - x(inode_unlinked_but_nlink_nonzero, 198) \ 207 - x(inode_checksum_type_invalid, 199) \ 208 - x(inode_compression_type_invalid, 200) \ 209 - x(inode_subvol_root_but_not_dir, 201) \ 210 - x(inode_i_size_dirty_but_clean, 202) \ 211 - x(inode_i_sectors_dirty_but_clean, 203) \ 212 - x(inode_i_sectors_wrong, 204) \ 213 - x(inode_dir_wrong_nlink, 205) \ 214 - x(inode_dir_multiple_links, 206) \ 215 - x(inode_multiple_links_but_nlink_0, 207) \ 216 - x(inode_wrong_backpointer, 208) \ 217 - x(inode_wrong_nlink, 209) \ 218 - x(inode_unreachable, 210) \ 219 - x(deleted_inode_but_clean, 211) \ 220 - x(deleted_inode_missing, 212) \ 221 - x(deleted_inode_is_dir, 213) \ 222 - x(deleted_inode_not_unlinked, 214) \ 223 - x(extent_overlapping, 215) \ 224 - x(extent_in_missing_inode, 216) \ 225 - x(extent_in_non_reg_inode, 217) \ 226 - x(extent_past_end_of_inode, 218) \ 227 - x(dirent_empty_name, 219) \ 228 - x(dirent_val_too_big, 220) \ 229 - x(dirent_name_too_long, 221) \ 230 - x(dirent_name_embedded_nul, 222) \ 231 - x(dirent_name_dot_or_dotdot, 223) \ 232 - x(dirent_name_has_slash, 224) \ 233 - x(dirent_d_type_wrong, 225) \ 234 - x(inode_bi_parent_wrong, 226) \ 235 - x(dirent_in_missing_dir_inode, 227) \ 236 - x(dirent_in_non_dir_inode, 228) \ 237 - x(dirent_to_missing_inode, 229) \ 238 - x(dirent_to_missing_subvol, 230) \ 239 - x(dirent_to_itself, 231) \ 240 - x(quota_type_invalid, 232) \ 241 - x(xattr_val_size_too_small, 233) \ 242 - x(xattr_val_size_too_big, 234) \ 243 - x(xattr_invalid_type, 235) \ 244 - x(xattr_name_invalid_chars, 236) \ 245 - x(xattr_in_missing_inode, 237) \ 246 - x(root_subvol_missing, 238) \ 247 - x(root_dir_missing, 239) \ 248 - x(root_inode_not_dir, 240) \ 249 - x(dir_loop, 241) \ 250 - x(hash_table_key_duplicate, 242) \ 251 - x(hash_table_key_wrong_offset, 243) \ 252 - x(unlinked_inode_not_on_deleted_list, 244) \ 253 - x(reflink_p_front_pad_bad, 245) \ 254 - x(journal_entry_dup_same_device, 246) \ 255 - x(inode_bi_subvol_missing, 247) \ 256 - x(inode_bi_subvol_wrong, 248) \ 257 - x(inode_points_to_missing_dirent, 249) \ 258 - x(inode_points_to_wrong_dirent, 250) \ 259 - x(inode_bi_parent_nonzero, 251) \ 260 - x(dirent_to_missing_parent_subvol, 252) \ 261 - x(dirent_not_visible_in_parent_subvol, 253) \ 262 - x(subvol_fs_path_parent_wrong, 254) \ 263 - x(subvol_root_fs_path_parent_nonzero, 255) \ 264 - x(subvol_children_not_set, 256) \ 265 - x(subvol_children_bad, 257) \ 266 - x(subvol_loop, 258) \ 267 - x(subvol_unreachable, 259) \ 268 - x(btree_node_bkey_bad_u64s, 260) \ 269 - x(btree_node_topology_empty_interior_node, 261) \ 270 - x(btree_ptr_v2_min_key_bad, 262) \ 271 - x(btree_root_unreadable_and_scan_found_nothing, 263) \ 272 - x(snapshot_node_missing, 264) \ 273 - x(dup_backpointer_to_bad_csum_extent, 265) \ 274 - x(btree_bitmap_not_marked, 266) \ 275 - x(sb_clean_entry_overrun, 267) \ 276 - x(btree_ptr_v2_written_0, 268) \ 277 - x(subvol_snapshot_bad, 269) \ 278 - x(subvol_inode_bad, 270) 279 - 280 - enum bch_sb_error_id { 281 - #define x(t, n) BCH_FSCK_ERR_##t = n, 282 - BCH_SB_ERRS() 283 - #undef x 284 - BCH_SB_ERR_MAX 285 - }; 286 - 287 7 struct bch_sb_error_entry_cpu { 288 8 u64 id:16, 289 9 nr:48; ··· 13 293 typedef DARRAY(struct bch_sb_error_entry_cpu) bch_sb_errors_cpu; 14 294 15 295 #endif /* _BCACHEFS_SB_ERRORS_TYPES_H */ 16 -
+110
fs/bcachefs/sb-members_format.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_SB_MEMBERS_FORMAT_H 3 + #define _BCACHEFS_SB_MEMBERS_FORMAT_H 4 + 5 + /* 6 + * We refer to members with bitmasks in various places - but we need to get rid 7 + * of this limit: 8 + */ 9 + #define BCH_SB_MEMBERS_MAX 64 10 + 11 + #define BCH_MIN_NR_NBUCKETS (1 << 6) 12 + 13 + #define BCH_IOPS_MEASUREMENTS() \ 14 + x(seqread, 0) \ 15 + x(seqwrite, 1) \ 16 + x(randread, 2) \ 17 + x(randwrite, 3) 18 + 19 + enum bch_iops_measurement { 20 + #define x(t, n) BCH_IOPS_##t = n, 21 + BCH_IOPS_MEASUREMENTS() 22 + #undef x 23 + BCH_IOPS_NR 24 + }; 25 + 26 + #define BCH_MEMBER_ERROR_TYPES() \ 27 + x(read, 0) \ 28 + x(write, 1) \ 29 + x(checksum, 2) 30 + 31 + enum bch_member_error_type { 32 + #define x(t, n) BCH_MEMBER_ERROR_##t = n, 33 + BCH_MEMBER_ERROR_TYPES() 34 + #undef x 35 + BCH_MEMBER_ERROR_NR 36 + }; 37 + 38 + struct bch_member { 39 + __uuid_t uuid; 40 + __le64 nbuckets; /* device size */ 41 + __le16 first_bucket; /* index of first bucket used */ 42 + __le16 bucket_size; /* sectors */ 43 + __u8 btree_bitmap_shift; 44 + __u8 pad[3]; 45 + __le64 last_mount; /* time_t */ 46 + 47 + __le64 flags; 48 + __le32 iops[4]; 49 + __le64 errors[BCH_MEMBER_ERROR_NR]; 50 + __le64 errors_at_reset[BCH_MEMBER_ERROR_NR]; 51 + __le64 errors_reset_time; 52 + __le64 seq; 53 + __le64 btree_allocated_bitmap; 54 + /* 55 + * On recovery from a clean shutdown we don't normally read the journal, 56 + * but we still want to resume writing from where we left off so we 57 + * don't overwrite more than is necessary, for list journal debugging: 58 + */ 59 + __le32 last_journal_bucket; 60 + __le32 last_journal_bucket_offset; 61 + }; 62 + 63 + /* 64 + * This limit comes from the bucket_gens array - it's a single allocation, and 65 + * kernel allocation are limited to INT_MAX 66 + */ 67 + #define BCH_MEMBER_NBUCKETS_MAX (INT_MAX - 64) 68 + 69 + #define BCH_MEMBER_V1_BYTES 56 70 + 71 + LE64_BITMASK(BCH_MEMBER_STATE, struct bch_member, flags, 0, 4) 72 + /* 4-14 unused, was TIER, HAS_(META)DATA, REPLACEMENT */ 73 + LE64_BITMASK(BCH_MEMBER_DISCARD, struct bch_member, flags, 14, 15) 74 + LE64_BITMASK(BCH_MEMBER_DATA_ALLOWED, struct bch_member, flags, 15, 20) 75 + LE64_BITMASK(BCH_MEMBER_GROUP, struct bch_member, flags, 20, 28) 76 + LE64_BITMASK(BCH_MEMBER_DURABILITY, struct bch_member, flags, 28, 30) 77 + LE64_BITMASK(BCH_MEMBER_FREESPACE_INITIALIZED, 78 + struct bch_member, flags, 30, 31) 79 + 80 + #if 0 81 + LE64_BITMASK(BCH_MEMBER_NR_READ_ERRORS, struct bch_member, flags[1], 0, 20); 82 + LE64_BITMASK(BCH_MEMBER_NR_WRITE_ERRORS,struct bch_member, flags[1], 20, 40); 83 + #endif 84 + 85 + #define BCH_MEMBER_STATES() \ 86 + x(rw, 0) \ 87 + x(ro, 1) \ 88 + x(failed, 2) \ 89 + x(spare, 3) 90 + 91 + enum bch_member_state { 92 + #define x(t, n) BCH_MEMBER_STATE_##t = n, 93 + BCH_MEMBER_STATES() 94 + #undef x 95 + BCH_MEMBER_STATE_NR 96 + }; 97 + 98 + struct bch_sb_field_members_v1 { 99 + struct bch_sb_field field; 100 + struct bch_member _members[]; //Members are now variable size 101 + }; 102 + 103 + struct bch_sb_field_members_v2 { 104 + struct bch_sb_field field; 105 + __le16 member_bytes; //size of single member entry 106 + u8 pad[6]; 107 + struct bch_member _members[]; 108 + }; 109 + 110 + #endif /* _BCACHEFS_SB_MEMBERS_FORMAT_H */
+48 -40
fs/bcachefs/snapshot.c
··· 1042 1042 return ret; 1043 1043 } 1044 1044 1045 + int bch2_check_key_has_snapshot(struct btree_trans *trans, 1046 + struct btree_iter *iter, 1047 + struct bkey_s_c k) 1048 + { 1049 + struct bch_fs *c = trans->c; 1050 + struct printbuf buf = PRINTBUF; 1051 + int ret = 0; 1052 + 1053 + if (fsck_err_on(!bch2_snapshot_equiv(c, k.k->p.snapshot), c, 1054 + bkey_in_missing_snapshot, 1055 + "key in missing snapshot %s, delete?", 1056 + (bch2_bkey_val_to_text(&buf, c, k), buf.buf))) 1057 + ret = bch2_btree_delete_at(trans, iter, 1058 + BTREE_UPDATE_internal_snapshot_node) ?: 1; 1059 + fsck_err: 1060 + printbuf_exit(&buf); 1061 + return ret; 1062 + } 1063 + 1045 1064 /* 1046 1065 * Mark a snapshot as deleted, for future cleanup: 1047 1066 */ ··· 1370 1351 * that key to snapshot leaf nodes, where we can mutate it 1371 1352 */ 1372 1353 1373 - static int snapshot_delete_key(struct btree_trans *trans, 1354 + static int delete_dead_snapshots_process_key(struct btree_trans *trans, 1374 1355 struct btree_iter *iter, 1375 1356 struct bkey_s_c k, 1376 1357 snapshot_id_list *deleted, 1377 1358 snapshot_id_list *equiv_seen, 1378 1359 struct bpos *last_pos) 1379 1360 { 1361 + int ret = bch2_check_key_has_snapshot(trans, iter, k); 1362 + if (ret) 1363 + return ret < 0 ? ret : 0; 1364 + 1380 1365 struct bch_fs *c = trans->c; 1381 1366 u32 equiv = bch2_snapshot_equiv(c, k.k->p.snapshot); 1367 + if (!equiv) /* key for invalid snapshot node, but we chose not to delete */ 1368 + return 0; 1382 1369 1383 1370 if (!bkey_eq(k.k->p, *last_pos)) 1384 1371 equiv_seen->nr = 0; 1385 - *last_pos = k.k->p; 1386 1372 1387 - if (snapshot_list_has_id(deleted, k.k->p.snapshot) || 1388 - snapshot_list_has_id(equiv_seen, equiv)) { 1373 + if (snapshot_list_has_id(deleted, k.k->p.snapshot)) 1389 1374 return bch2_btree_delete_at(trans, iter, 1390 1375 BTREE_UPDATE_internal_snapshot_node); 1391 - } else { 1392 - return snapshot_list_add(c, equiv_seen, equiv); 1393 - } 1394 - } 1395 1376 1396 - static int move_key_to_correct_snapshot(struct btree_trans *trans, 1397 - struct btree_iter *iter, 1398 - struct bkey_s_c k) 1399 - { 1400 - struct bch_fs *c = trans->c; 1401 - u32 equiv = bch2_snapshot_equiv(c, k.k->p.snapshot); 1377 + if (!bpos_eq(*last_pos, k.k->p) && 1378 + snapshot_list_has_id(equiv_seen, equiv)) 1379 + return bch2_btree_delete_at(trans, iter, 1380 + BTREE_UPDATE_internal_snapshot_node); 1381 + 1382 + *last_pos = k.k->p; 1383 + 1384 + ret = snapshot_list_add_nodup(c, equiv_seen, equiv); 1385 + if (ret) 1386 + return ret; 1402 1387 1403 1388 /* 1404 1389 * When we have a linear chain of snapshot nodes, we consider ··· 1412 1389 * 1413 1390 * If there are multiple keys in different snapshots at the same 1414 1391 * position, we're only going to keep the one in the newest 1415 - * snapshot - the rest have been overwritten and are redundant, 1416 - * and for the key we're going to keep we need to move it to the 1417 - * equivalance class ID if it's not there already. 1392 + * snapshot (we delete the others above) - the rest have been 1393 + * overwritten and are redundant, and for the key we're going to keep we 1394 + * need to move it to the equivalance class ID if it's not there 1395 + * already. 1418 1396 */ 1419 1397 if (equiv != k.k->p.snapshot) { 1420 1398 struct bkey_i *new = bch2_bkey_make_mut_noupdate(trans, k); 1421 - struct btree_iter new_iter; 1422 - int ret; 1423 - 1424 - ret = PTR_ERR_OR_ZERO(new); 1399 + int ret = PTR_ERR_OR_ZERO(new); 1425 1400 if (ret) 1426 1401 return ret; 1427 1402 1428 1403 new->k.p.snapshot = equiv; 1429 1404 1405 + struct btree_iter new_iter; 1430 1406 bch2_trans_iter_init(trans, &new_iter, iter->btree_id, new->k.p, 1431 1407 BTREE_ITER_all_snapshots| 1432 1408 BTREE_ITER_cached| ··· 1560 1538 struct btree_trans *trans; 1561 1539 snapshot_id_list deleted = { 0 }; 1562 1540 snapshot_id_list deleted_interior = { 0 }; 1563 - u32 id; 1564 1541 int ret = 0; 1565 1542 1566 1543 if (!test_and_clear_bit(BCH_FS_need_delete_dead_snapshots, &c->flags)) ··· 1606 1585 if (ret) 1607 1586 goto err; 1608 1587 1609 - for (id = 0; id < BTREE_ID_NR; id++) { 1588 + for (unsigned btree = 0; btree < BTREE_ID_NR; btree++) { 1610 1589 struct bpos last_pos = POS_MIN; 1611 1590 snapshot_id_list equiv_seen = { 0 }; 1612 1591 struct disk_reservation res = { 0 }; 1613 1592 1614 - if (!btree_type_has_snapshots(id)) 1615 - continue; 1616 - 1617 - /* 1618 - * deleted inodes btree is maintained by a trigger on the inodes 1619 - * btree - no work for us to do here, and it's not safe to scan 1620 - * it because we'll see out of date keys due to the btree write 1621 - * buffer: 1622 - */ 1623 - if (id == BTREE_ID_deleted_inodes) 1593 + if (!btree_type_has_snapshots(btree)) 1624 1594 continue; 1625 1595 1626 1596 ret = for_each_btree_key_commit(trans, iter, 1627 - id, POS_MIN, 1597 + btree, POS_MIN, 1628 1598 BTREE_ITER_prefetch|BTREE_ITER_all_snapshots, k, 1629 1599 &res, NULL, BCH_TRANS_COMMIT_no_enospc, 1630 - snapshot_delete_key(trans, &iter, k, &deleted, &equiv_seen, &last_pos)) ?: 1631 - for_each_btree_key_commit(trans, iter, 1632 - id, POS_MIN, 1633 - BTREE_ITER_prefetch|BTREE_ITER_all_snapshots, k, 1634 - &res, NULL, BCH_TRANS_COMMIT_no_enospc, 1635 - move_key_to_correct_snapshot(trans, &iter, k)); 1600 + delete_dead_snapshots_process_key(trans, &iter, k, &deleted, 1601 + &equiv_seen, &last_pos)); 1636 1602 1637 1603 bch2_disk_reservation_put(c, &res); 1638 1604 darray_exit(&equiv_seen);
+1
fs/bcachefs/snapshot.h
··· 242 242 int bch2_check_snapshot_trees(struct bch_fs *); 243 243 int bch2_check_snapshots(struct bch_fs *); 244 244 int bch2_reconstruct_snapshots(struct bch_fs *); 245 + int bch2_check_key_has_snapshot(struct btree_trans *, struct btree_iter *, struct bkey_s_c); 245 246 246 247 int bch2_snapshot_node_set_deleted(struct btree_trans *, u32); 247 248 void bch2_delete_dead_snapshots_work(struct work_struct *);
+3 -9
fs/bcachefs/super-io.c
··· 1132 1132 * c->sb will be checked before we write the superblock, so update it as 1133 1133 * well: 1134 1134 */ 1135 - if (BCH_SB_VERSION_UPGRADE_COMPLETE(c->disk_sb.sb) > bcachefs_metadata_version_current) { 1135 + if (BCH_SB_VERSION_UPGRADE_COMPLETE(c->disk_sb.sb) > bcachefs_metadata_version_current) 1136 1136 SET_BCH_SB_VERSION_UPGRADE_COMPLETE(c->disk_sb.sb, bcachefs_metadata_version_current); 1137 - c->sb.version_upgrade_complete = bcachefs_metadata_version_current; 1138 - } 1139 - if (c->sb.version > bcachefs_metadata_version_current) { 1137 + if (c->sb.version > bcachefs_metadata_version_current) 1140 1138 c->disk_sb.sb->version = cpu_to_le16(bcachefs_metadata_version_current); 1141 - c->sb.version = bcachefs_metadata_version_current; 1142 - } 1143 - if (c->sb.version_min > bcachefs_metadata_version_current) { 1139 + if (c->sb.version_min > bcachefs_metadata_version_current) 1144 1140 c->disk_sb.sb->version_min = cpu_to_le16(bcachefs_metadata_version_current); 1145 - c->sb.version_min = bcachefs_metadata_version_current; 1146 - } 1147 1141 c->disk_sb.sb->compat[0] &= cpu_to_le64((1ULL << BCH_COMPAT_NR) - 1); 1148 1142 return ret; 1149 1143 }
+1 -1
fs/bcachefs/super.c
··· 564 564 BUG_ON(atomic_read(&c->journal_keys.ref)); 565 565 bch2_fs_btree_write_buffer_exit(c); 566 566 percpu_free_rwsem(&c->mark_lock); 567 - EBUG_ON(percpu_u64_get(c->online_reserved)); 567 + EBUG_ON(c->online_reserved && percpu_u64_get(c->online_reserved)); 568 568 free_percpu(c->online_reserved); 569 569 570 570 darray_exit(&c->btree_roots_extra);
+10
fs/btrfs/btrfs_inode.h
··· 89 89 BTRFS_INODE_FREE_SPACE_INODE, 90 90 /* Set when there are no capabilities in XATTs for the inode. */ 91 91 BTRFS_INODE_NO_CAP_XATTR, 92 + /* 93 + * Set if an error happened when doing a COW write before submitting a 94 + * bio or during writeback. Used for both buffered writes and direct IO 95 + * writes. This is to signal a fast fsync that it has to wait for 96 + * ordered extents to complete and therefore not log extent maps that 97 + * point to unwritten extents (when an ordered extent completes and it 98 + * has the BTRFS_ORDERED_IOERR flag set, it drops extent maps in its 99 + * range). 100 + */ 101 + BTRFS_INODE_COW_WRITE_ERROR, 92 102 }; 93 103 94 104 /* in memory btrfs inode */
+16
fs/btrfs/file.c
··· 1885 1885 */ 1886 1886 if (full_sync || btrfs_is_zoned(fs_info)) { 1887 1887 ret = btrfs_wait_ordered_range(inode, start, len); 1888 + clear_bit(BTRFS_INODE_COW_WRITE_ERROR, &BTRFS_I(inode)->runtime_flags); 1888 1889 } else { 1889 1890 /* 1890 1891 * Get our ordered extents as soon as possible to avoid doing ··· 1895 1894 btrfs_get_ordered_extents_for_logging(BTRFS_I(inode), 1896 1895 &ctx.ordered_extents); 1897 1896 ret = filemap_fdatawait_range(inode->i_mapping, start, end); 1897 + if (ret) 1898 + goto out_release_extents; 1899 + 1900 + /* 1901 + * Check and clear the BTRFS_INODE_COW_WRITE_ERROR now after 1902 + * starting and waiting for writeback, because for buffered IO 1903 + * it may have been set during the end IO callback 1904 + * (end_bbio_data_write() -> btrfs_finish_ordered_extent()) in 1905 + * case an error happened and we need to wait for ordered 1906 + * extents to complete so that any extent maps that point to 1907 + * unwritten locations are dropped and we don't log them. 1908 + */ 1909 + if (test_and_clear_bit(BTRFS_INODE_COW_WRITE_ERROR, 1910 + &BTRFS_I(inode)->runtime_flags)) 1911 + ret = btrfs_wait_ordered_range(inode, start, len); 1898 1912 } 1899 1913 1900 1914 if (ret)
+31
fs/btrfs/ordered-data.c
··· 388 388 ret = can_finish_ordered_extent(ordered, page, file_offset, len, uptodate); 389 389 spin_unlock_irqrestore(&inode->ordered_tree_lock, flags); 390 390 391 + /* 392 + * If this is a COW write it means we created new extent maps for the 393 + * range and they point to unwritten locations if we got an error either 394 + * before submitting a bio or during IO. 395 + * 396 + * We have marked the ordered extent with BTRFS_ORDERED_IOERR, and we 397 + * are queuing its completion below. During completion, at 398 + * btrfs_finish_one_ordered(), we will drop the extent maps for the 399 + * unwritten extents. 400 + * 401 + * However because completion runs in a work queue we can end up having 402 + * a fast fsync running before that. In the case of direct IO, once we 403 + * unlock the inode the fsync might start, and we queue the completion 404 + * before unlocking the inode. In the case of buffered IO when writeback 405 + * finishes (end_bbio_data_write()) we queue the completion, so if the 406 + * writeback was triggered by a fast fsync, the fsync might start 407 + * logging before ordered extent completion runs in the work queue. 408 + * 409 + * The fast fsync will log file extent items based on the extent maps it 410 + * finds, so if by the time it collects extent maps the ordered extent 411 + * completion didn't happen yet, it will log file extent items that 412 + * point to unwritten extents, resulting in a corruption if a crash 413 + * happens and the log tree is replayed. Note that a fast fsync does not 414 + * wait for completion of ordered extents in order to reduce latency. 415 + * 416 + * Set a flag in the inode so that the next fast fsync will wait for 417 + * ordered extents to complete before starting to log. 418 + */ 419 + if (!uptodate && !test_bit(BTRFS_ORDERED_NOCOW, &ordered->flags)) 420 + set_bit(BTRFS_INODE_COW_WRITE_ERROR, &inode->runtime_flags); 421 + 391 422 if (ret) 392 423 btrfs_queue_ordered_fn(ordered); 393 424 return ret;
+1 -1
fs/smb/client/cifspdu.h
··· 2574 2574 2575 2575 2576 2576 struct win_dev { 2577 - unsigned char type[8]; /* IntxCHR or IntxBLK or LnxFIFO*/ 2577 + unsigned char type[8]; /* IntxCHR or IntxBLK or LnxFIFO or LnxSOCK */ 2578 2578 __le64 major; 2579 2579 __le64 minor; 2580 2580 } __attribute__((packed));
+4
fs/smb/client/inode.c
··· 606 606 mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); 607 607 fattr->cf_rdev = MKDEV(mjr, mnr); 608 608 } 609 + } else if (memcmp("LnxSOCK", pbuf, 8) == 0) { 610 + cifs_dbg(FYI, "Socket\n"); 611 + fattr->cf_mode |= S_IFSOCK; 612 + fattr->cf_dtype = DT_SOCK; 609 613 } else if (memcmp("IntxLNK", pbuf, 7) == 0) { 610 614 cifs_dbg(FYI, "Symlink\n"); 611 615 fattr->cf_mode |= S_IFLNK;
+3
fs/smb/client/smb2ops.c
··· 4997 4997 pdev.major = cpu_to_le64(MAJOR(dev)); 4998 4998 pdev.minor = cpu_to_le64(MINOR(dev)); 4999 4999 break; 5000 + case S_IFSOCK: 5001 + strscpy(pdev.type, "LnxSOCK"); 5002 + break; 5000 5003 case S_IFIFO: 5001 5004 strscpy(pdev.type, "LnxFIFO"); 5002 5005 break;
+1
fs/smb/common/cifs_arc4.c
··· 10 10 #include <linux/module.h> 11 11 #include "arc4.h" 12 12 13 + MODULE_DESCRIPTION("ARC4 Cipher Algorithm"); 13 14 MODULE_LICENSE("GPL"); 14 15 15 16 int cifs_arc4_setkey(struct arc4_ctx *ctx, const u8 *in_key, unsigned int key_len)
+1
fs/smb/common/cifs_md4.c
··· 24 24 #include <asm/byteorder.h> 25 25 #include "md4.h" 26 26 27 + MODULE_DESCRIPTION("MD4 Message Digest Algorithm (RFC1320)"); 27 28 MODULE_LICENSE("GPL"); 28 29 29 30 static inline u32 lshift(u32 x, unsigned int s)
+2 -4
fs/xfs/libxfs/xfs_alloc.c
··· 1008 1008 struct xfs_alloc_arg *args, 1009 1009 struct xfs_alloc_cur *acur) 1010 1010 { 1011 - struct xfs_agf __maybe_unused *agf = args->agbp->b_addr; 1012 1011 int error; 1013 1012 1014 1013 ASSERT(acur->cnt && acur->bnolt); 1015 1014 ASSERT(acur->bno >= acur->rec_bno); 1016 1015 ASSERT(acur->bno + acur->len <= acur->rec_bno + acur->rec_len); 1017 - ASSERT(acur->rec_bno + acur->rec_len <= be32_to_cpu(agf->agf_length)); 1016 + ASSERT(xfs_verify_agbext(args->pag, acur->rec_bno, acur->rec_len)); 1018 1017 1019 1018 error = xfs_alloc_fixup_trees(acur->cnt, acur->bnolt, acur->rec_bno, 1020 1019 acur->rec_len, acur->bno, acur->len, 0); ··· 1216 1217 xfs_alloc_ag_vextent_exact( 1217 1218 xfs_alloc_arg_t *args) /* allocation argument structure */ 1218 1219 { 1219 - struct xfs_agf __maybe_unused *agf = args->agbp->b_addr; 1220 1220 struct xfs_btree_cur *bno_cur;/* by block-number btree cursor */ 1221 1221 struct xfs_btree_cur *cnt_cur;/* by count btree cursor */ 1222 1222 int error; ··· 1295 1297 */ 1296 1298 cnt_cur = xfs_cntbt_init_cursor(args->mp, args->tp, args->agbp, 1297 1299 args->pag); 1298 - ASSERT(args->agbno + args->len <= be32_to_cpu(agf->agf_length)); 1300 + ASSERT(xfs_verify_agbext(args->pag, args->agbno, args->len)); 1299 1301 error = xfs_alloc_fixup_trees(cnt_cur, bno_cur, fbno, flen, args->agbno, 1300 1302 args->len, XFSA_FIXUP_BNO_OK); 1301 1303 if (error) {
+18 -20
fs/xfs/libxfs/xfs_attr.c
··· 329 329 return nblks; 330 330 } 331 331 332 - /* Initialize transaction reservation for attr operations */ 333 - void 334 - xfs_init_attr_trans( 335 - struct xfs_da_args *args, 336 - struct xfs_trans_res *tres, 337 - unsigned int *total) 332 + /* Initialize transaction reservation for an xattr set/replace/upsert */ 333 + inline struct xfs_trans_res 334 + xfs_attr_set_resv( 335 + const struct xfs_da_args *args) 338 336 { 339 - struct xfs_mount *mp = args->dp->i_mount; 337 + struct xfs_mount *mp = args->dp->i_mount; 338 + struct xfs_trans_res ret = { 339 + .tr_logres = M_RES(mp)->tr_attrsetm.tr_logres + 340 + M_RES(mp)->tr_attrsetrt.tr_logres * args->total, 341 + .tr_logcount = XFS_ATTRSET_LOG_COUNT, 342 + .tr_logflags = XFS_TRANS_PERM_LOG_RES, 343 + }; 340 344 341 - if (args->value) { 342 - tres->tr_logres = M_RES(mp)->tr_attrsetm.tr_logres + 343 - M_RES(mp)->tr_attrsetrt.tr_logres * 344 - args->total; 345 - tres->tr_logcount = XFS_ATTRSET_LOG_COUNT; 346 - tres->tr_logflags = XFS_TRANS_PERM_LOG_RES; 347 - *total = args->total; 348 - } else { 349 - *tres = M_RES(mp)->tr_attrrm; 350 - *total = XFS_ATTRRM_SPACE_RES(mp); 351 - } 345 + return ret; 352 346 } 353 347 354 348 /* ··· 1000 1006 struct xfs_trans_res tres; 1001 1007 int error, local; 1002 1008 int rmt_blks = 0; 1003 - unsigned int total; 1009 + unsigned int total = 0; 1004 1010 1005 1011 ASSERT(!args->trans); 1006 1012 ··· 1027 1033 1028 1034 if (!local) 1029 1035 rmt_blks = xfs_attr3_rmt_blocks(mp, args->valuelen); 1036 + 1037 + tres = xfs_attr_set_resv(args); 1038 + total = args->total; 1030 1039 break; 1031 1040 case XFS_ATTRUPDATE_REMOVE: 1032 1041 XFS_STATS_INC(mp, xs_attr_remove); 1033 1042 rmt_blks = xfs_attr3_max_rmt_blocks(mp); 1043 + tres = M_RES(mp)->tr_attrrm; 1044 + total = XFS_ATTRRM_SPACE_RES(mp); 1034 1045 break; 1035 1046 } 1036 1047 ··· 1043 1044 * Root fork attributes can use reserved data blocks for this 1044 1045 * operation if necessary 1045 1046 */ 1046 - xfs_init_attr_trans(args, &tres, &total); 1047 1047 error = xfs_trans_alloc_inode(dp, &tres, total, 0, rsvd, &args->trans); 1048 1048 if (error) 1049 1049 return error;
+1 -2
fs/xfs/libxfs/xfs_attr.h
··· 565 565 bool xfs_attr_namecheck(unsigned int attr_flags, const void *name, 566 566 size_t length); 567 567 int xfs_attr_calc_size(struct xfs_da_args *args, int *local); 568 - void xfs_init_attr_trans(struct xfs_da_args *args, struct xfs_trans_res *tres, 569 - unsigned int *total); 568 + struct xfs_trans_res xfs_attr_set_resv(const struct xfs_da_args *args); 570 569 571 570 /* 572 571 * Check to see if the attr should be upgraded from non-existent or shortform to
+1
fs/xfs/libxfs/xfs_bmap.c
··· 6383 6383 error = xfs_defer_finish(tpp); 6384 6384 if (error) 6385 6385 goto out; 6386 + cond_resched(); 6386 6387 } 6387 6388 out: 6388 6389 return error;
+24 -4
fs/xfs/libxfs/xfs_inode_buf.c
··· 374 374 /* 375 375 * For fork types that can contain local data, check that the fork 376 376 * format matches the size of local data contained within the fork. 377 - * 378 - * For all types, check that when the size says the should be in extent 379 - * or btree format, the inode isn't claiming it is in local format. 380 377 */ 381 378 if (whichfork == XFS_DATA_FORK) { 382 - if (S_ISDIR(mode) || S_ISLNK(mode)) { 379 + /* 380 + * A directory small enough to fit in the inode must be stored 381 + * in local format. The directory sf <-> extents conversion 382 + * code updates the directory size accordingly. 383 + */ 384 + if (S_ISDIR(mode)) { 383 385 if (be64_to_cpu(dip->di_size) <= fork_size && 384 386 fork_format != XFS_DINODE_FMT_LOCAL) 385 387 return __this_address; 386 388 } 387 389 390 + /* 391 + * A symlink with a target small enough to fit in the inode can 392 + * be stored in extents format if xattrs were added (thus 393 + * converting the data fork from shortform to remote format) 394 + * and then removed. 395 + */ 396 + if (S_ISLNK(mode)) { 397 + if (be64_to_cpu(dip->di_size) <= fork_size && 398 + fork_format != XFS_DINODE_FMT_EXTENTS && 399 + fork_format != XFS_DINODE_FMT_LOCAL) 400 + return __this_address; 401 + } 402 + 403 + /* 404 + * For all types, check that when the size says the fork should 405 + * be in extent or btree format, the inode isn't claiming to be 406 + * in local format. 407 + */ 388 408 if (be64_to_cpu(dip->di_size) > fork_size && 389 409 fork_format == XFS_DINODE_FMT_LOCAL) 390 410 return __this_address;
+1 -1
fs/xfs/scrub/scrub.c
··· 856 856 if (vec_bytes > PAGE_SIZE) 857 857 return -ENOMEM; 858 858 859 - uvectors = (void __user *)(uintptr_t)head.svh_vectors; 859 + uvectors = u64_to_user_ptr(head.svh_vectors); 860 860 vectors = memdup_user(uvectors, vec_bytes); 861 861 if (IS_ERR(vectors)) 862 862 return PTR_ERR(vectors);
+6 -3
fs/xfs/scrub/xfarray.c
··· 822 822 823 823 /* Grab the first folio that backs this array element. */ 824 824 if (!si->folio) { 825 + struct folio *folio; 825 826 loff_t next_pos; 826 827 827 - si->folio = xfile_get_folio(si->array->xfile, idx_pos, 828 + folio = xfile_get_folio(si->array->xfile, idx_pos, 828 829 si->array->obj_size, XFILE_ALLOC); 829 - if (IS_ERR(si->folio)) 830 - return PTR_ERR(si->folio); 830 + if (IS_ERR(folio)) 831 + return PTR_ERR(folio); 832 + si->folio = folio; 831 833 832 834 si->first_folio_idx = xfarray_idx(si->array, 833 835 folio_pos(si->folio) + si->array->obj_size - 1); ··· 1050 1048 1051 1049 out_free: 1052 1050 trace_xfarray_sort_stats(si, error); 1051 + xfarray_sort_scan_done(si); 1053 1052 kvfree(si); 1054 1053 return error; 1055 1054 }
+15 -2
fs/xfs/xfs_attr_item.c
··· 746 746 struct xfs_attri_log_format *attrp; 747 747 struct xfs_attri_log_nameval *nv = attrip->attri_nameval; 748 748 int error; 749 - int total; 749 + unsigned int total = 0; 750 750 751 751 /* 752 752 * First check the validity of the attr described by the ATTRI. If any ··· 763 763 return PTR_ERR(attr); 764 764 args = attr->xattri_da_args; 765 765 766 - xfs_init_attr_trans(args, &resv, &total); 766 + switch (xfs_attr_intent_op(attr)) { 767 + case XFS_ATTRI_OP_FLAGS_PPTR_SET: 768 + case XFS_ATTRI_OP_FLAGS_PPTR_REPLACE: 769 + case XFS_ATTRI_OP_FLAGS_SET: 770 + case XFS_ATTRI_OP_FLAGS_REPLACE: 771 + resv = xfs_attr_set_resv(args); 772 + total = args->total; 773 + break; 774 + case XFS_ATTRI_OP_FLAGS_PPTR_REMOVE: 775 + case XFS_ATTRI_OP_FLAGS_REMOVE: 776 + resv = M_RES(mp)->tr_attrrm; 777 + total = XFS_ATTRRM_SPACE_RES(mp); 778 + break; 779 + } 767 780 resv = xlog_recover_resv(&resv); 768 781 error = xfs_trans_alloc(mp, &resv, total, 0, XFS_TRANS_RESERVE, &tp); 769 782 if (error)
+1 -6
fs/xfs/xfs_handle.c
··· 773 773 trace_xfs_getparents_expand_lastrec(gpx->ip, gp, &gpx->context, gpr); 774 774 } 775 775 776 - static inline void __user *u64_to_uptr(u64 val) 777 - { 778 - return (void __user *)(uintptr_t)val; 779 - } 780 - 781 776 /* Retrieve the parent pointers for a given inode. */ 782 777 STATIC int 783 778 xfs_getparents( ··· 857 862 ASSERT(gpx->context.firstu <= gpx->gph.gph_request.gp_bufsize); 858 863 859 864 /* Copy the records to userspace. */ 860 - if (copy_to_user(u64_to_uptr(gpx->gph.gph_request.gp_buffer), 865 + if (copy_to_user(u64_to_user_ptr(gpx->gph.gph_request.gp_buffer), 861 866 gpx->krecords, gpx->context.firstu)) 862 867 error = -EFAULT; 863 868
+2 -3
fs/xfs/xfs_iwalk.c
··· 351 351 int *has_more) 352 352 { 353 353 struct xfs_mount *mp = iwag->mp; 354 - struct xfs_inobt_rec_incore *irec; 355 354 xfs_agino_t next_agino; 356 355 int error; 357 356 ··· 360 361 361 362 /* Delete cursor but remember the last record we cached... */ 362 363 xfs_iwalk_del_inobt(iwag->tp, curpp, agi_bpp, 0); 363 - irec = &iwag->recs[iwag->nr_recs - 1]; 364 - ASSERT(next_agino >= irec->ir_startino + XFS_INODES_PER_CHUNK); 364 + ASSERT(next_agino >= iwag->recs[iwag->nr_recs - 1].ir_startino + 365 + XFS_INODES_PER_CHUNK); 365 366 366 367 if (iwag->drop_trans) { 367 368 xfs_trans_cancel(iwag->tp);
+1
fs/xfs/xfs_reflink.c
··· 1387 1387 destoff += imap.br_blockcount; 1388 1388 len -= imap.br_blockcount; 1389 1389 remapped_len += imap.br_blockcount; 1390 + cond_resched(); 1390 1391 } 1391 1392 1392 1393 if (error)
+3 -3
include/drm/drm_buddy.h
··· 56 56 struct list_head tmp_link; 57 57 }; 58 58 59 - /* Order-zero must be at least PAGE_SIZE */ 60 - #define DRM_BUDDY_MAX_ORDER (63 - PAGE_SHIFT) 59 + /* Order-zero must be at least SZ_4K */ 60 + #define DRM_BUDDY_MAX_ORDER (63 - 12) 61 61 62 62 /* 63 63 * Binary Buddy System. ··· 85 85 unsigned int n_roots; 86 86 unsigned int max_order; 87 87 88 - /* Must be at least PAGE_SIZE */ 88 + /* Must be at least SZ_4K */ 89 89 u64 chunk_size; 90 90 u64 size; 91 91 u64 avail;
-33
include/linux/amd-pstate.h drivers/cpufreq/amd-pstate.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 2 /* 3 - * linux/include/linux/amd-pstate.h 4 - * 5 3 * Copyright (C) 2022 Advanced Micro Devices, Inc. 6 4 * 7 5 * Author: Meng Li <li.meng@amd.com> ··· 9 11 #define _LINUX_AMD_PSTATE_H 10 12 11 13 #include <linux/pm_qos.h> 12 - 13 - #define AMD_CPPC_EPP_PERFORMANCE 0x00 14 - #define AMD_CPPC_EPP_BALANCE_PERFORMANCE 0x80 15 - #define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF 16 - #define AMD_CPPC_EPP_POWERSAVE 0xFF 17 14 18 15 /********************************************************************* 19 16 * AMD P-state INTERFACE * ··· 99 106 u32 policy; 100 107 u64 cppc_cap1_cached; 101 108 bool suspended; 102 - }; 103 - 104 - /* 105 - * enum amd_pstate_mode - driver working mode of amd pstate 106 - */ 107 - enum amd_pstate_mode { 108 - AMD_PSTATE_UNDEFINED = 0, 109 - AMD_PSTATE_DISABLE, 110 - AMD_PSTATE_PASSIVE, 111 - AMD_PSTATE_ACTIVE, 112 - AMD_PSTATE_GUIDED, 113 - AMD_PSTATE_MAX, 114 - }; 115 - 116 - static const char * const amd_pstate_mode_string[] = { 117 - [AMD_PSTATE_UNDEFINED] = "undefined", 118 - [AMD_PSTATE_DISABLE] = "disable", 119 - [AMD_PSTATE_PASSIVE] = "passive", 120 - [AMD_PSTATE_ACTIVE] = "active", 121 - [AMD_PSTATE_GUIDED] = "guided", 122 - NULL, 123 - }; 124 - 125 - struct quirk_entry { 126 - u32 nominal_freq; 127 - u32 lowest_freq; 128 109 }; 129 110 130 111 #endif /* _LINUX_AMD_PSTATE_H */
-10
include/linux/blk-integrity.h
··· 66 66 return q->integrity.profile; 67 67 } 68 68 69 - static inline void blk_queue_max_integrity_segments(struct request_queue *q, 70 - unsigned int segs) 71 - { 72 - q->limits.max_integrity_segments = segs; 73 - } 74 - 75 69 static inline unsigned short 76 70 queue_max_integrity_segments(const struct request_queue *q) 77 71 { ··· 143 149 { 144 150 } 145 151 static inline void blk_integrity_unregister(struct gendisk *d) 146 - { 147 - } 148 - static inline void blk_queue_max_integrity_segments(struct request_queue *q, 149 - unsigned int segs) 150 152 { 151 153 } 152 154 static inline unsigned short
+1
include/linux/blkdev.h
··· 186 186 */ 187 187 unsigned int nr_zones; 188 188 unsigned int zone_capacity; 189 + unsigned int last_zone_capacity; 189 190 unsigned long *conv_zones_bitmap; 190 191 unsigned int zone_wplugs_hash_bits; 191 192 spinlock_t zone_wplugs_lock;
-1
include/linux/i2c.h
··· 852 852 853 853 /* i2c adapter classes (bitmask) */ 854 854 #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ 855 - #define I2C_CLASS_SPD (1<<7) /* Memory modules */ 856 855 /* Warn users that the adapter doesn't support classes anymore */ 857 856 #define I2C_CLASS_DEPRECATED (1<<8) 858 857
+2 -4
include/linux/pnp.h
··· 435 435 #define protocol_for_each_dev(protocol, dev) \ 436 436 list_for_each_entry(dev, &(protocol)->devices, protocol_list) 437 437 438 - extern const struct bus_type pnp_bus_type; 439 - 440 438 #if defined(CONFIG_PNP) 441 439 442 440 /* device management */ ··· 467 469 int pnp_register_driver(struct pnp_driver *drv); 468 470 void pnp_unregister_driver(struct pnp_driver *drv); 469 471 470 - #define dev_is_pnp(d) ((d)->bus == &pnp_bus_type) 472 + bool dev_is_pnp(const struct device *dev); 471 473 472 474 #else 473 475 ··· 500 502 static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; } 501 503 static inline void pnp_unregister_driver(struct pnp_driver *drv) { } 502 504 503 - #define dev_is_pnp(d) false 505 + static inline bool dev_is_pnp(const struct device *dev) { return false; } 504 506 505 507 #endif /* CONFIG_PNP */ 506 508
+1
include/net/rtnetlink.h
··· 13 13 RTNL_FLAG_DOIT_UNLOCKED = BIT(0), 14 14 RTNL_FLAG_BULK_DEL_SUPPORTED = BIT(1), 15 15 RTNL_FLAG_DUMP_UNLOCKED = BIT(2), 16 + RTNL_FLAG_DUMP_SPLIT_NLM_DONE = BIT(3), /* legacy behavior */ 16 17 }; 17 18 18 19 enum rtnl_kinds {
+4 -3
include/net/tcp_ao.h
··· 86 86 struct tcp_ao_info { 87 87 /* List of tcp_ao_key's */ 88 88 struct hlist_head head; 89 - /* current_key and rnext_key aren't maintained on listen sockets. 89 + /* current_key and rnext_key are maintained on sockets 90 + * in TCP_AO_ESTABLISHED states. 90 91 * Their purpose is to cache keys on established connections, 91 92 * saving needless lookups. Never dereference any of them from 92 93 * listen sockets. ··· 202 201 }; 203 202 204 203 struct tcp_sigpool; 204 + /* Established states are fast-path and there always is current_key/rnext_key */ 205 205 #define TCP_AO_ESTABLISHED (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | \ 206 - TCPF_CLOSE | TCPF_CLOSE_WAIT | \ 207 - TCPF_LAST_ACK | TCPF_CLOSING) 206 + TCPF_CLOSE_WAIT | TCPF_LAST_ACK | TCPF_CLOSING) 208 207 209 208 int tcp_ao_transmit_skb(struct sock *sk, struct sk_buff *skb, 210 209 struct tcp_ao_key *key, struct tcphdr *th,
+1 -1
include/sound/pcm.h
··· 124 124 #define SNDRV_PCM_RATE_768000 (1U<<16) /* 768000Hz */ 125 125 126 126 #define SNDRV_PCM_RATE_CONTINUOUS (1U<<30) /* continuous range */ 127 - #define SNDRV_PCM_RATE_KNOT (1U<<31) /* supports more non-continuos rates */ 127 + #define SNDRV_PCM_RATE_KNOT (1U<<31) /* supports more non-continuous rates */ 128 128 129 129 #define SNDRV_PCM_RATE_8000_44100 (SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_11025|\ 130 130 SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_22050|\
+47 -49
include/uapi/linux/kd.h
··· 5 5 #include <linux/compiler.h> 6 6 7 7 /* 0x4B is 'K', to avoid collision with termios and vt */ 8 - #define KD_IOCTL_BASE 'K' 9 8 10 - #define GIO_FONT _IO(KD_IOCTL_BASE, 0x60) /* gets font in expanded form */ 11 - #define PIO_FONT _IO(KD_IOCTL_BASE, 0x61) /* use font in expanded form */ 9 + #define GIO_FONT 0x4B60 /* gets font in expanded form */ 10 + #define PIO_FONT 0x4B61 /* use font in expanded form */ 12 11 13 - #define GIO_FONTX _IO(KD_IOCTL_BASE, 0x6B) /* get font using struct consolefontdesc */ 14 - #define PIO_FONTX _IO(KD_IOCTL_BASE, 0x6C) /* set font using struct consolefontdesc */ 12 + #define GIO_FONTX 0x4B6B /* get font using struct consolefontdesc */ 13 + #define PIO_FONTX 0x4B6C /* set font using struct consolefontdesc */ 15 14 struct consolefontdesc { 16 15 unsigned short charcount; /* characters in font (256 or 512) */ 17 16 unsigned short charheight; /* scan lines per character (1-32) */ 18 17 char __user *chardata; /* font data in expanded form */ 19 18 }; 20 19 21 - #define PIO_FONTRESET _IO(KD_IOCTL_BASE, 0x6D) /* reset to default font */ 20 + #define PIO_FONTRESET 0x4B6D /* reset to default font */ 22 21 23 - #define GIO_CMAP _IO(KD_IOCTL_BASE, 0x70) /* gets colour palette on VGA+ */ 24 - #define PIO_CMAP _IO(KD_IOCTL_BASE, 0x71) /* sets colour palette on VGA+ */ 22 + #define GIO_CMAP 0x4B70 /* gets colour palette on VGA+ */ 23 + #define PIO_CMAP 0x4B71 /* sets colour palette on VGA+ */ 25 24 26 - #define KIOCSOUND _IO(KD_IOCTL_BASE, 0x2F) /* start sound generation (0 for off) */ 27 - #define KDMKTONE _IO(KD_IOCTL_BASE, 0x30) /* generate tone */ 25 + #define KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 26 + #define KDMKTONE 0x4B30 /* generate tone */ 28 27 29 - #define KDGETLED _IO(KD_IOCTL_BASE, 0x31) /* return current led state */ 30 - #define KDSETLED _IO(KD_IOCTL_BASE, 0x32) /* set led state [lights, not flags] */ 28 + #define KDGETLED 0x4B31 /* return current led state */ 29 + #define KDSETLED 0x4B32 /* set led state [lights, not flags] */ 31 30 #define LED_SCR 0x01 /* scroll lock led */ 32 31 #define LED_NUM 0x02 /* num lock led */ 33 32 #define LED_CAP 0x04 /* caps lock led */ 34 33 35 - #define KDGKBTYPE _IO(KD_IOCTL_BASE, 0x33) /* get keyboard type */ 34 + #define KDGKBTYPE 0x4B33 /* get keyboard type */ 36 35 #define KB_84 0x01 37 36 #define KB_101 0x02 /* this is what we always answer */ 38 37 #define KB_OTHER 0x03 39 38 40 - #define KDADDIO _IO(KD_IOCTL_BASE, 0x34) /* add i/o port as valid */ 41 - #define KDDELIO _IO(KD_IOCTL_BASE, 0x35) /* del i/o port as valid */ 42 - #define KDENABIO _IO(KD_IOCTL_BASE, 0x36) /* enable i/o to video board */ 43 - #define KDDISABIO _IO(KD_IOCTL_BASE, 0x37) /* disable i/o to video board */ 39 + #define KDADDIO 0x4B34 /* add i/o port as valid */ 40 + #define KDDELIO 0x4B35 /* del i/o port as valid */ 41 + #define KDENABIO 0x4B36 /* enable i/o to video board */ 42 + #define KDDISABIO 0x4B37 /* disable i/o to video board */ 44 43 45 - #define KDSETMODE _IO(KD_IOCTL_BASE, 0x3A) /* set text/graphics mode */ 44 + #define KDSETMODE 0x4B3A /* set text/graphics mode */ 46 45 #define KD_TEXT 0x00 47 46 #define KD_GRAPHICS 0x01 48 47 #define KD_TEXT0 0x02 /* obsolete */ 49 48 #define KD_TEXT1 0x03 /* obsolete */ 50 - #define KDGETMODE _IO(KD_IOCTL_BASE, 0x3B) /* get current mode */ 49 + #define KDGETMODE 0x4B3B /* get current mode */ 51 50 52 - #define KDMAPDISP _IO(KD_IOCTL_BASE, 0x3C) /* map display into address space */ 53 - #define KDUNMAPDISP _IO(KD_IOCTL_BASE, 0x3D) /* unmap display from address space */ 51 + #define KDMAPDISP 0x4B3C /* map display into address space */ 52 + #define KDUNMAPDISP 0x4B3D /* unmap display from address space */ 54 53 55 54 typedef char scrnmap_t; 56 55 #define E_TABSZ 256 57 - #define GIO_SCRNMAP _IO(KD_IOCTL_BASE, 0x40) /* get screen mapping from kernel */ 58 - #define PIO_SCRNMAP _IO(KD_IOCTL_BASE, 0x41) /* put screen mapping table in kernel */ 59 - #define GIO_UNISCRNMAP _IO(KD_IOCTL_BASE, 0x69) /* get full Unicode screen mapping */ 60 - #define PIO_UNISCRNMAP _IO(KD_IOCTL_BASE, 0x6A) /* set full Unicode screen mapping */ 56 + #define GIO_SCRNMAP 0x4B40 /* get screen mapping from kernel */ 57 + #define PIO_SCRNMAP 0x4B41 /* put screen mapping table in kernel */ 58 + #define GIO_UNISCRNMAP 0x4B69 /* get full Unicode screen mapping */ 59 + #define PIO_UNISCRNMAP 0x4B6A /* set full Unicode screen mapping */ 61 60 62 - #define GIO_UNIMAP _IO(KD_IOCTL_BASE, 0x66) /* get unicode-to-font mapping from kernel */ 61 + #define GIO_UNIMAP 0x4B66 /* get unicode-to-font mapping from kernel */ 63 62 struct unipair { 64 63 unsigned short unicode; 65 64 unsigned short fontpos; ··· 67 68 unsigned short entry_ct; 68 69 struct unipair __user *entries; 69 70 }; 70 - #define PIO_UNIMAP _IO(KD_IOCTL_BASE, 0x67) /* put unicode-to-font mapping in kernel */ 71 - #define PIO_UNIMAPCLR _IO(KD_IOCTL_BASE, 0x68) /* clear table, possibly advise hash algorithm */ 71 + #define PIO_UNIMAP 0x4B67 /* put unicode-to-font mapping in kernel */ 72 + #define PIO_UNIMAPCLR 0x4B68 /* clear table, possibly advise hash algorithm */ 72 73 struct unimapinit { 73 74 unsigned short advised_hashsize; /* 0 if no opinion */ 74 75 unsigned short advised_hashstep; /* 0 if no opinion */ ··· 83 84 #define K_MEDIUMRAW 0x02 84 85 #define K_UNICODE 0x03 85 86 #define K_OFF 0x04 86 - #define KDGKBMODE _IO(KD_IOCTL_BASE, 0x44) /* gets current keyboard mode */ 87 - #define KDSKBMODE _IO(KD_IOCTL_BASE, 0x45) /* sets current keyboard mode */ 87 + #define KDGKBMODE 0x4B44 /* gets current keyboard mode */ 88 + #define KDSKBMODE 0x4B45 /* sets current keyboard mode */ 88 89 89 90 #define K_METABIT 0x03 90 91 #define K_ESCPREFIX 0x04 91 - #define KDGKBMETA _IO(KD_IOCTL_BASE, 0x62) /* gets meta key handling mode */ 92 - #define KDSKBMETA _IO(KD_IOCTL_BASE, 0x63) /* sets meta key handling mode */ 92 + #define KDGKBMETA 0x4B62 /* gets meta key handling mode */ 93 + #define KDSKBMETA 0x4B63 /* sets meta key handling mode */ 93 94 94 95 #define K_SCROLLLOCK 0x01 95 96 #define K_NUMLOCK 0x02 96 97 #define K_CAPSLOCK 0x04 97 - #define KDGKBLED _IO(KD_IOCTL_BASE, 0x64) /* get led flags (not lights) */ 98 - #define KDSKBLED _IO(KD_IOCTL_BASE, 0x65) /* set led flags (not lights) */ 98 + #define KDGKBLED 0x4B64 /* get led flags (not lights) */ 99 + #define KDSKBLED 0x4B65 /* set led flags (not lights) */ 99 100 100 101 struct kbentry { 101 102 unsigned char kb_table; ··· 107 108 #define K_ALTTAB 0x02 108 109 #define K_ALTSHIFTTAB 0x03 109 110 110 - #define KDGKBENT _IO(KD_IOCTL_BASE, 0x46) /* gets one entry in translation table */ 111 - #define KDSKBENT _IO(KD_IOCTL_BASE, 0x47) /* sets one entry in translation table */ 111 + #define KDGKBENT 0x4B46 /* gets one entry in translation table */ 112 + #define KDSKBENT 0x4B47 /* sets one entry in translation table */ 112 113 113 114 struct kbsentry { 114 115 unsigned char kb_func; 115 116 unsigned char kb_string[512]; 116 117 }; 117 - #define KDGKBSENT _IO(KD_IOCTL_BASE, 0x48) /* gets one function key string entry */ 118 - #define KDSKBSENT _IO(KD_IOCTL_BASE, 0x49) /* sets one function key string entry */ 118 + #define KDGKBSENT 0x4B48 /* gets one function key string entry */ 119 + #define KDSKBSENT 0x4B49 /* sets one function key string entry */ 119 120 120 121 struct kbdiacr { 121 122 unsigned char diacr, base, result; ··· 124 125 unsigned int kb_cnt; /* number of entries in following array */ 125 126 struct kbdiacr kbdiacr[256]; /* MAX_DIACR from keyboard.h */ 126 127 }; 127 - #define KDGKBDIACR _IO(KD_IOCTL_BASE, 0x4A) /* read kernel accent table */ 128 - #define KDSKBDIACR _IO(KD_IOCTL_BASE, 0x4B) /* write kernel accent table */ 128 + #define KDGKBDIACR 0x4B4A /* read kernel accent table */ 129 + #define KDSKBDIACR 0x4B4B /* write kernel accent table */ 129 130 130 131 struct kbdiacruc { 131 132 unsigned int diacr, base, result; ··· 134 135 unsigned int kb_cnt; /* number of entries in following array */ 135 136 struct kbdiacruc kbdiacruc[256]; /* MAX_DIACR from keyboard.h */ 136 137 }; 137 - #define KDGKBDIACRUC _IO(KD_IOCTL_BASE, 0xFA) /* read kernel accent table - UCS */ 138 - #define KDSKBDIACRUC _IO(KD_IOCTL_BASE, 0xFB) /* write kernel accent table - UCS */ 138 + #define KDGKBDIACRUC 0x4BFA /* read kernel accent table - UCS */ 139 + #define KDSKBDIACRUC 0x4BFB /* write kernel accent table - UCS */ 139 140 140 141 struct kbkeycode { 141 142 unsigned int scancode, keycode; 142 143 }; 143 - #define KDGETKEYCODE _IO(KD_IOCTL_BASE, 0x4C) /* read kernel keycode table entry */ 144 - #define KDSETKEYCODE _IO(KD_IOCTL_BASE, 0x4D) /* write kernel keycode table entry */ 144 + #define KDGETKEYCODE 0x4B4C /* read kernel keycode table entry */ 145 + #define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */ 145 146 146 - #define KDSIGACCEPT _IO(KD_IOCTL_BASE, 0x4E) /* accept kbd generated signals */ 147 + #define KDSIGACCEPT 0x4B4E /* accept kbd generated signals */ 147 148 148 149 struct kbd_repeat { 149 150 int delay; /* in msec; <= 0: don't change */ ··· 151 152 /* earlier this field was misnamed "rate" */ 152 153 }; 153 154 154 - #define KDKBDREP _IO(KD_IOCTL_BASE, 0x52) /* set keyboard delay/repeat rate; 155 - * actually used values are returned 156 - */ 155 + #define KDKBDREP 0x4B52 /* set keyboard delay/repeat rate; 156 + * actually used values are returned */ 157 157 158 - #define KDFONTOP _IO(KD_IOCTL_BASE, 0x72) /* font operations */ 158 + #define KDFONTOP 0x4B72 /* font operations */ 159 159 160 160 struct console_font_op { 161 161 unsigned int op; /* operation code KD_FONT_OP_* */
+3 -2
io_uring/memmap.c
··· 244 244 struct io_ring_ctx *ctx = file->private_data; 245 245 size_t sz = vma->vm_end - vma->vm_start; 246 246 long offset = vma->vm_pgoff << PAGE_SHIFT; 247 + unsigned int npages; 247 248 void *ptr; 248 249 249 250 ptr = io_uring_validate_mmap_request(file, vma->vm_pgoff, sz); ··· 254 253 switch (offset & IORING_OFF_MMAP_MASK) { 255 254 case IORING_OFF_SQ_RING: 256 255 case IORING_OFF_CQ_RING: 257 - return io_uring_mmap_pages(ctx, vma, ctx->ring_pages, 258 - ctx->n_ring_pages); 256 + npages = min(ctx->n_ring_pages, (sz + PAGE_SIZE - 1) >> PAGE_SHIFT); 257 + return io_uring_mmap_pages(ctx, vma, ctx->ring_pages, npages); 259 258 case IORING_OFF_SQES: 260 259 return io_uring_mmap_pages(ctx, vma, ctx->sqe_pages, 261 260 ctx->n_sqe_pages);
+3 -3
io_uring/net.c
··· 1127 1127 flags |= MSG_DONTWAIT; 1128 1128 1129 1129 retry_multishot: 1130 + kmsg->msg.msg_inq = -1; 1131 + kmsg->msg.msg_flags = 0; 1132 + 1130 1133 if (io_do_buffer_select(req)) { 1131 1134 ret = io_recv_buf_select(req, kmsg, &len, issue_flags); 1132 1135 if (unlikely(ret)) 1133 1136 goto out_free; 1134 1137 sr->buf = NULL; 1135 1138 } 1136 - 1137 - kmsg->msg.msg_inq = -1; 1138 - kmsg->msg.msg_flags = 0; 1139 1139 1140 1140 if (flags & MSG_WAITALL) 1141 1141 min_ret = iov_iter_count(&kmsg->msg.msg_iter);
+5
io_uring/opdef.c
··· 516 516 }, 517 517 [IORING_OP_READ_FIXED] = { 518 518 .name = "READ_FIXED", 519 + .cleanup = io_readv_writev_cleanup, 519 520 .fail = io_rw_fail, 520 521 }, 521 522 [IORING_OP_WRITE_FIXED] = { 522 523 .name = "WRITE_FIXED", 524 + .cleanup = io_readv_writev_cleanup, 523 525 .fail = io_rw_fail, 524 526 }, 525 527 [IORING_OP_POLL_ADD] = { ··· 584 582 }, 585 583 [IORING_OP_READ] = { 586 584 .name = "READ", 585 + .cleanup = io_readv_writev_cleanup, 587 586 .fail = io_rw_fail, 588 587 }, 589 588 [IORING_OP_WRITE] = { 590 589 .name = "WRITE", 590 + .cleanup = io_readv_writev_cleanup, 591 591 .fail = io_rw_fail, 592 592 }, 593 593 [IORING_OP_FADVISE] = { ··· 696 692 }, 697 693 [IORING_OP_READ_MULTISHOT] = { 698 694 .name = "READ_MULTISHOT", 695 + .cleanup = io_readv_writev_cleanup, 699 696 }, 700 697 [IORING_OP_WAITID] = { 701 698 .name = "WAITID",
-3
kernel/bpf/devmap.c
··· 760 760 for (i = 0; i < dtab->n_buckets; i++) { 761 761 head = dev_map_index_hash(dtab, i); 762 762 hlist_for_each_entry_safe(dst, next, head, index_hlist) { 763 - if (!dst) 764 - continue; 765 - 766 763 if (is_ifindex_excluded(excluded_devices, num_excluded, 767 764 dst->dev->ifindex)) 768 765 continue;
+6 -5
kernel/bpf/syscall.c
··· 2998 2998 void bpf_link_init(struct bpf_link *link, enum bpf_link_type type, 2999 2999 const struct bpf_link_ops *ops, struct bpf_prog *prog) 3000 3000 { 3001 + WARN_ON(ops->dealloc && ops->dealloc_deferred); 3001 3002 atomic64_set(&link->refcnt, 1); 3002 3003 link->type = type; 3003 3004 link->id = 0; ··· 3057 3056 /* bpf_link_free is guaranteed to be called from process context */ 3058 3057 static void bpf_link_free(struct bpf_link *link) 3059 3058 { 3059 + const struct bpf_link_ops *ops = link->ops; 3060 3060 bool sleepable = false; 3061 3061 3062 3062 bpf_link_free_id(link->id); 3063 3063 if (link->prog) { 3064 3064 sleepable = link->prog->sleepable; 3065 3065 /* detach BPF program, clean up used resources */ 3066 - link->ops->release(link); 3066 + ops->release(link); 3067 3067 bpf_prog_put(link->prog); 3068 3068 } 3069 - if (link->ops->dealloc_deferred) { 3069 + if (ops->dealloc_deferred) { 3070 3070 /* schedule BPF link deallocation; if underlying BPF program 3071 3071 * is sleepable, we need to first wait for RCU tasks trace 3072 3072 * sync, then go through "classic" RCU grace period ··· 3076 3074 call_rcu_tasks_trace(&link->rcu, bpf_link_defer_dealloc_mult_rcu_gp); 3077 3075 else 3078 3076 call_rcu(&link->rcu, bpf_link_defer_dealloc_rcu_gp); 3079 - } 3080 - if (link->ops->dealloc) 3081 - link->ops->dealloc(link); 3077 + } else if (ops->dealloc) 3078 + ops->dealloc(link); 3082 3079 } 3083 3080 3084 3081 static void bpf_link_put_deferred(struct work_struct *work)
+4
kernel/bpf/verifier.c
··· 11128 11128 #else 11129 11129 BTF_ID_UNUSED 11130 11130 #endif 11131 + #ifdef CONFIG_BPF_EVENTS 11131 11132 BTF_ID(func, bpf_session_cookie) 11133 + #else 11134 + BTF_ID_UNUSED 11135 + #endif 11132 11136 11133 11137 static bool is_kfunc_ret_null(struct bpf_kfunc_call_arg_meta *meta) 11134 11138 {
+16 -9
kernel/dma/map_benchmark.c
··· 101 101 struct task_struct **tsk; 102 102 int threads = map->bparam.threads; 103 103 int node = map->bparam.node; 104 - const cpumask_t *cpu_mask = cpumask_of_node(node); 105 104 u64 loops; 106 105 int ret = 0; 107 106 int i; ··· 117 118 if (IS_ERR(tsk[i])) { 118 119 pr_err("create dma_map thread failed\n"); 119 120 ret = PTR_ERR(tsk[i]); 121 + while (--i >= 0) 122 + kthread_stop(tsk[i]); 120 123 goto out; 121 124 } 122 125 123 126 if (node != NUMA_NO_NODE) 124 - kthread_bind_mask(tsk[i], cpu_mask); 127 + kthread_bind_mask(tsk[i], cpumask_of_node(node)); 125 128 } 126 129 127 130 /* clear the old value in the previous benchmark */ ··· 140 139 141 140 msleep_interruptible(map->bparam.seconds * 1000); 142 141 143 - /* wait for the completion of benchmark threads */ 142 + /* wait for the completion of all started benchmark threads */ 144 143 for (i = 0; i < threads; i++) { 145 - ret = kthread_stop(tsk[i]); 146 - if (ret) 147 - goto out; 144 + int kthread_ret = kthread_stop_put(tsk[i]); 145 + 146 + if (kthread_ret) 147 + ret = kthread_ret; 148 148 } 149 + 150 + if (ret) 151 + goto out; 149 152 150 153 loops = atomic64_read(&map->loops); 151 154 if (likely(loops > 0)) { ··· 175 170 } 176 171 177 172 out: 178 - for (i = 0; i < threads; i++) 179 - put_task_struct(tsk[i]); 180 173 put_device(map->dev); 181 174 kfree(tsk); 182 175 return ret; ··· 211 208 } 212 209 213 210 if (map->bparam.node != NUMA_NO_NODE && 214 - !node_possible(map->bparam.node)) { 211 + (map->bparam.node < 0 || map->bparam.node >= MAX_NUMNODES || 212 + !node_possible(map->bparam.node))) { 215 213 pr_err("invalid numa node\n"); 216 214 return -EINVAL; 217 215 } ··· 256 252 * dma_mask changed by benchmark 257 253 */ 258 254 dma_set_mask(map->dev, old_dma_mask); 255 + 256 + if (ret) 257 + return ret; 259 258 break; 260 259 default: 261 260 return -EINVAL;
+7 -2
kernel/gen_kheaders.sh
··· 14 14 arch/$SRCARCH/include/ 15 15 " 16 16 17 - type cpio > /dev/null 17 + if ! command -v cpio >/dev/null; then 18 + echo >&2 "***" 19 + echo >&2 "*** 'cpio' could not be found." 20 + echo >&2 "***" 21 + exit 1 22 + fi 18 23 19 24 # Support incremental builds by skipping archive generation 20 25 # if timestamps of files being archived are not changed. ··· 89 84 90 85 # Create archive and try to normalize metadata for reproducibility. 91 86 tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ 92 - --owner=0 --group=0 --sort=name --numeric-owner \ 87 + --owner=0 --group=0 --sort=name --numeric-owner --mode=u=rw,go=r,a+X \ 93 88 -I $XZ -cf $tarfile -C $cpio_dir/ . > /dev/null 94 89 95 90 echo $headers_md5 > kernel/kheaders.md5
-2
kernel/trace/bpf_trace.c
··· 3517 3517 } 3518 3518 #endif /* CONFIG_UPROBES */ 3519 3519 3520 - #ifdef CONFIG_FPROBE 3521 3520 __bpf_kfunc_start_defs(); 3522 3521 3523 3522 __bpf_kfunc bool bpf_session_is_return(void) ··· 3565 3566 } 3566 3567 3567 3568 late_initcall(bpf_kprobe_multi_kfuncs_init); 3568 - #endif
-3
lib/fortify_kunit.c
··· 236 236 kfree(p)); \ 237 237 checker(expected_size, __kmalloc(alloc_size, gfp), \ 238 238 kfree(p)); \ 239 - checker(expected_size, \ 240 - __kmalloc_node(alloc_size, gfp, NUMA_NO_NODE), \ 241 - kfree(p)); \ 242 239 \ 243 240 orig = kmalloc(alloc_size, gfp); \ 244 241 KUNIT_EXPECT_TRUE(test, orig != NULL); \
+1
lib/test_rhashtable.c
··· 811 811 module_init(test_rht_init); 812 812 module_exit(test_rht_exit); 813 813 814 + MODULE_DESCRIPTION("Resizable, Scalable, Concurrent Hash Table test module"); 814 815 MODULE_LICENSE("GPL v2");
+6
net/ax25/af_ax25.c
··· 1378 1378 { 1379 1379 struct sk_buff *skb; 1380 1380 struct sock *newsk; 1381 + ax25_dev *ax25_dev; 1381 1382 DEFINE_WAIT(wait); 1382 1383 struct sock *sk; 1384 + ax25_cb *ax25; 1383 1385 int err = 0; 1384 1386 1385 1387 if (sock->state != SS_UNCONNECTED) ··· 1436 1434 kfree_skb(skb); 1437 1435 sk_acceptq_removed(sk); 1438 1436 newsock->state = SS_CONNECTED; 1437 + ax25 = sk_to_ax25(newsk); 1438 + ax25_dev = ax25->ax25_dev; 1439 + netdev_hold(ax25_dev->dev, &ax25->dev_tracker, GFP_ATOMIC); 1440 + ax25_dev_hold(ax25_dev); 1439 1441 1440 1442 out: 1441 1443 release_sock(sk);
+1 -1
net/ax25/ax25_dev.c
··· 196 196 list_for_each_entry_safe(s, n, &ax25_dev_list, list) { 197 197 netdev_put(s->dev, &s->dev_tracker); 198 198 list_del(&s->list); 199 - kfree(s); 199 + ax25_dev_put(s); 200 200 } 201 201 spin_unlock_bh(&ax25_dev_lock); 202 202 }
+6
net/bpf/test_run.c
··· 727 727 __bpf_prog_test_run_raw_tp(void *data) 728 728 { 729 729 struct bpf_raw_tp_test_run_info *info = data; 730 + struct bpf_trace_run_ctx run_ctx = {}; 731 + struct bpf_run_ctx *old_run_ctx; 732 + 733 + old_run_ctx = bpf_set_run_ctx(&run_ctx.run_ctx); 730 734 731 735 rcu_read_lock(); 732 736 info->retval = bpf_prog_run(info->prog, info->ctx); 733 737 rcu_read_unlock(); 738 + 739 + bpf_reset_run_ctx(old_run_ctx); 734 740 } 735 741 736 742 int bpf_prog_test_run_raw_tp(struct bpf_prog *prog,
+2 -1
net/core/dev.c
··· 4516 4516 struct rps_dev_flow *rflow, u16 next_cpu) 4517 4517 { 4518 4518 if (next_cpu < nr_cpu_ids) { 4519 + u32 head; 4519 4520 #ifdef CONFIG_RFS_ACCEL 4520 4521 struct netdev_rx_queue *rxqueue; 4521 4522 struct rps_dev_flow_table *flow_table; 4522 4523 struct rps_dev_flow *old_rflow; 4523 - u32 flow_id, head; 4524 4524 u16 rxq_index; 4525 + u32 flow_id; 4525 4526 int rc; 4526 4527 4527 4528 /* Should we steer this flow to a different hardware queue? */
+2
net/core/dst_cache.c
··· 27 27 static void dst_cache_per_cpu_dst_set(struct dst_cache_pcpu *dst_cache, 28 28 struct dst_entry *dst, u32 cookie) 29 29 { 30 + DEBUG_NET_WARN_ON_ONCE(!in_softirq()); 30 31 dst_release(dst_cache->dst); 31 32 if (dst) 32 33 dst_hold(dst); ··· 41 40 { 42 41 struct dst_entry *dst; 43 42 43 + DEBUG_NET_WARN_ON_ONCE(!in_softirq()); 44 44 dst = idst->dst; 45 45 if (!dst) 46 46 goto fail;
+42 -2
net/core/rtnetlink.c
··· 6484 6484 6485 6485 /* Process one rtnetlink message. */ 6486 6486 6487 + static int rtnl_dumpit(struct sk_buff *skb, struct netlink_callback *cb) 6488 + { 6489 + rtnl_dumpit_func dumpit = cb->data; 6490 + int err; 6491 + 6492 + /* Previous iteration have already finished, avoid calling->dumpit() 6493 + * again, it may not expect to be called after it reached the end. 6494 + */ 6495 + if (!dumpit) 6496 + return 0; 6497 + 6498 + err = dumpit(skb, cb); 6499 + 6500 + /* Old dump handlers used to send NLM_DONE as in a separate recvmsg(). 6501 + * Some applications which parse netlink manually depend on this. 6502 + */ 6503 + if (cb->flags & RTNL_FLAG_DUMP_SPLIT_NLM_DONE) { 6504 + if (err < 0 && err != -EMSGSIZE) 6505 + return err; 6506 + if (!err) 6507 + cb->data = NULL; 6508 + 6509 + return skb->len; 6510 + } 6511 + return err; 6512 + } 6513 + 6514 + static int rtnetlink_dump_start(struct sock *ssk, struct sk_buff *skb, 6515 + const struct nlmsghdr *nlh, 6516 + struct netlink_dump_control *control) 6517 + { 6518 + if (control->flags & RTNL_FLAG_DUMP_SPLIT_NLM_DONE) { 6519 + WARN_ON(control->data); 6520 + control->data = control->dump; 6521 + control->dump = rtnl_dumpit; 6522 + } 6523 + 6524 + return netlink_dump_start(ssk, skb, nlh, control); 6525 + } 6526 + 6487 6527 static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, 6488 6528 struct netlink_ext_ack *extack) 6489 6529 { ··· 6588 6548 .module = owner, 6589 6549 .flags = flags, 6590 6550 }; 6591 - err = netlink_dump_start(rtnl, skb, nlh, &c); 6551 + err = rtnetlink_dump_start(rtnl, skb, nlh, &c); 6592 6552 /* netlink_dump_start() will keep a reference on 6593 6553 * module if dump is still in progress. 6594 6554 */ ··· 6734 6694 register_netdevice_notifier(&rtnetlink_dev_notifier); 6735 6695 6736 6696 rtnl_register(PF_UNSPEC, RTM_GETLINK, rtnl_getlink, 6737 - rtnl_dump_ifinfo, 0); 6697 + rtnl_dump_ifinfo, RTNL_FLAG_DUMP_SPLIT_NLM_DONE); 6738 6698 rtnl_register(PF_UNSPEC, RTM_SETLINK, rtnl_setlink, NULL, 0); 6739 6699 rtnl_register(PF_UNSPEC, RTM_NEWLINK, rtnl_newlink, NULL, 0); 6740 6700 rtnl_register(PF_UNSPEC, RTM_DELLINK, rtnl_dellink, NULL, 0);
+1 -1
net/ethtool/ioctl.c
··· 2220 2220 const struct ethtool_ops *ops = dev->ethtool_ops; 2221 2221 int n_stats, ret; 2222 2222 2223 - if (!ops || !ops->get_sset_count || ops->get_ethtool_phy_stats) 2223 + if (!ops || !ops->get_sset_count || !ops->get_ethtool_phy_stats) 2224 2224 return -EOPNOTSUPP; 2225 2225 2226 2226 n_stats = ops->get_sset_count(dev, ETH_SS_PHY_STATS);
+3 -3
net/ethtool/tsinfo.c
··· 38 38 ret = ethnl_ops_begin(dev); 39 39 if (ret < 0) 40 40 return ret; 41 - if (req_base->flags & ETHTOOL_FLAG_STATS && 42 - dev->ethtool_ops->get_ts_stats) { 41 + if (req_base->flags & ETHTOOL_FLAG_STATS) { 43 42 ethtool_stats_init((u64 *)&data->stats, 44 43 sizeof(data->stats) / sizeof(u64)); 45 - dev->ethtool_ops->get_ts_stats(dev, &data->stats); 44 + if (dev->ethtool_ops->get_ts_stats) 45 + dev->ethtool_ops->get_ts_stats(dev, &data->stats); 46 46 } 47 47 ret = __ethtool_get_ts_info(dev, &data->ts_info); 48 48 ethnl_ops_complete(dev);
+1 -1
net/ipv4/devinet.c
··· 2805 2805 rtnl_register(PF_INET, RTM_NEWADDR, inet_rtm_newaddr, NULL, 0); 2806 2806 rtnl_register(PF_INET, RTM_DELADDR, inet_rtm_deladdr, NULL, 0); 2807 2807 rtnl_register(PF_INET, RTM_GETADDR, NULL, inet_dump_ifaddr, 2808 - RTNL_FLAG_DUMP_UNLOCKED); 2808 + RTNL_FLAG_DUMP_UNLOCKED | RTNL_FLAG_DUMP_SPLIT_NLM_DONE); 2809 2809 rtnl_register(PF_INET, RTM_GETNETCONF, inet_netconf_get_devconf, 2810 2810 inet_netconf_dump_devconf, 2811 2811 RTNL_FLAG_DOIT_UNLOCKED | RTNL_FLAG_DUMP_UNLOCKED);
+1 -6
net/ipv4/fib_frontend.c
··· 1050 1050 e++; 1051 1051 } 1052 1052 } 1053 - 1054 - /* Don't let NLM_DONE coalesce into a message, even if it could. 1055 - * Some user space expects NLM_DONE in a separate recv(). 1056 - */ 1057 - err = skb->len; 1058 1053 out: 1059 1054 1060 1055 cb->args[1] = e; ··· 1660 1665 rtnl_register(PF_INET, RTM_NEWROUTE, inet_rtm_newroute, NULL, 0); 1661 1666 rtnl_register(PF_INET, RTM_DELROUTE, inet_rtm_delroute, NULL, 0); 1662 1667 rtnl_register(PF_INET, RTM_GETROUTE, NULL, inet_dump_fib, 1663 - RTNL_FLAG_DUMP_UNLOCKED); 1668 + RTNL_FLAG_DUMP_UNLOCKED | RTNL_FLAG_DUMP_SPLIT_NLM_DONE); 1664 1669 }
+8 -1
net/ipv4/tcp.c
··· 1167 1167 1168 1168 process_backlog++; 1169 1169 1170 + #ifdef CONFIG_SKB_DECRYPTED 1171 + skb->decrypted = !!(flags & MSG_SENDPAGE_DECRYPTED); 1172 + #endif 1170 1173 tcp_skb_entail(sk, skb); 1171 1174 copy = size_goal; 1172 1175 ··· 2651 2648 if (oldstate != TCP_ESTABLISHED) 2652 2649 TCP_INC_STATS(sock_net(sk), TCP_MIB_CURRESTAB); 2653 2650 break; 2651 + case TCP_CLOSE_WAIT: 2652 + if (oldstate == TCP_SYN_RECV) 2653 + TCP_INC_STATS(sock_net(sk), TCP_MIB_CURRESTAB); 2654 + break; 2654 2655 2655 2656 case TCP_CLOSE: 2656 2657 if (oldstate == TCP_CLOSE_WAIT || oldstate == TCP_ESTABLISHED) ··· 2666 2659 inet_put_port(sk); 2667 2660 fallthrough; 2668 2661 default: 2669 - if (oldstate == TCP_ESTABLISHED) 2662 + if (oldstate == TCP_ESTABLISHED || oldstate == TCP_CLOSE_WAIT) 2670 2663 TCP_DEC_STATS(sock_net(sk), TCP_MIB_CURRESTAB); 2671 2664 } 2672 2665
+9 -4
net/ipv4/tcp_ao.c
··· 933 933 struct tcp_ao_key *key; 934 934 __be32 sisn, disn; 935 935 u8 *traffic_key; 936 + int state; 936 937 u32 sne = 0; 937 938 938 939 info = rcu_dereference(tcp_sk(sk)->ao_info); ··· 949 948 disn = 0; 950 949 } 951 950 951 + state = READ_ONCE(sk->sk_state); 952 952 /* Fast-path */ 953 - if (likely((1 << sk->sk_state) & TCP_AO_ESTABLISHED)) { 953 + if (likely((1 << state) & TCP_AO_ESTABLISHED)) { 954 954 enum skb_drop_reason err; 955 955 struct tcp_ao_key *current_key; 956 956 ··· 990 988 return SKB_NOT_DROPPED_YET; 991 989 } 992 990 991 + if (unlikely(state == TCP_CLOSE)) 992 + return SKB_DROP_REASON_TCP_CLOSE; 993 + 993 994 /* Lookup key based on peer address and keyid. 994 995 * current_key and rnext_key must not be used on tcp listen 995 996 * sockets as otherwise: ··· 1006 1001 if (th->syn && !th->ack) 1007 1002 goto verify_hash; 1008 1003 1009 - if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV)) { 1004 + if ((1 << state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV)) { 1010 1005 /* Make the initial syn the likely case here */ 1011 1006 if (unlikely(req)) { 1012 1007 sne = tcp_ao_compute_sne(0, tcp_rsk(req)->rcv_isn, ··· 1023 1018 /* no way to figure out initial sisn/disn - drop */ 1024 1019 return SKB_DROP_REASON_TCP_FLAGS; 1025 1020 } 1026 - } else if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) { 1021 + } else if ((1 << state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) { 1027 1022 disn = info->lisn; 1028 1023 if (th->syn || th->rst) 1029 1024 sisn = th->seq; 1030 1025 else 1031 1026 sisn = info->risn; 1032 1027 } else { 1033 - WARN_ONCE(1, "TCP-AO: Unexpected sk_state %d", sk->sk_state); 1028 + WARN_ONCE(1, "TCP-AO: Unexpected sk_state %d", state); 1034 1029 return SKB_DROP_REASON_TCP_AOFAILURE; 1035 1030 } 1036 1031 verify_hash:
+6 -1
net/ipv6/ila/ila_lwt.c
··· 58 58 return orig_dst->lwtstate->orig_output(net, sk, skb); 59 59 } 60 60 61 + local_bh_disable(); 61 62 dst = dst_cache_get(&ilwt->dst_cache); 63 + local_bh_enable(); 62 64 if (unlikely(!dst)) { 63 65 struct ipv6hdr *ip6h = ipv6_hdr(skb); 64 66 struct flowi6 fl6; ··· 88 86 goto drop; 89 87 } 90 88 91 - if (ilwt->connected) 89 + if (ilwt->connected) { 90 + local_bh_disable(); 92 91 dst_cache_set_ip6(&ilwt->dst_cache, dst, &fl6.saddr); 92 + local_bh_enable(); 93 + } 93 94 } 94 95 95 96 skb_dst_set(skb, dst);
+4 -4
net/ipv6/ioam6_iptunnel.c
··· 351 351 goto drop; 352 352 353 353 if (!ipv6_addr_equal(&orig_daddr, &ipv6_hdr(skb)->daddr)) { 354 - preempt_disable(); 354 + local_bh_disable(); 355 355 dst = dst_cache_get(&ilwt->cache); 356 - preempt_enable(); 356 + local_bh_enable(); 357 357 358 358 if (unlikely(!dst)) { 359 359 struct ipv6hdr *hdr = ipv6_hdr(skb); ··· 373 373 goto drop; 374 374 } 375 375 376 - preempt_disable(); 376 + local_bh_disable(); 377 377 dst_cache_set_ip6(&ilwt->cache, dst, &fl6.saddr); 378 - preempt_enable(); 378 + local_bh_enable(); 379 379 } 380 380 381 381 skb_dst_drop(skb);
+5 -1
net/ipv6/ip6_fib.c
··· 966 966 if (!fib6_nh->rt6i_pcpu) 967 967 return; 968 968 969 + rcu_read_lock(); 969 970 /* release the reference to this fib entry from 970 971 * all of its cached pcpu routes 971 972 */ ··· 975 974 struct rt6_info *pcpu_rt; 976 975 977 976 ppcpu_rt = per_cpu_ptr(fib6_nh->rt6i_pcpu, cpu); 978 - pcpu_rt = *ppcpu_rt; 977 + 978 + /* Paired with xchg() in rt6_get_pcpu_route() */ 979 + pcpu_rt = READ_ONCE(*ppcpu_rt); 979 980 980 981 /* only dropping the 'from' reference if the cached route 981 982 * is using 'match'. The cached pcpu_rt->from only changes ··· 991 988 fib6_info_release(from); 992 989 } 993 990 } 991 + rcu_read_unlock(); 994 992 } 995 993 996 994 struct fib6_nh_pcpu_arg {
+1
net/ipv6/route.c
··· 1407 1407 struct rt6_info *prev, **p; 1408 1408 1409 1409 p = this_cpu_ptr(res->nh->rt6i_pcpu); 1410 + /* Paired with READ_ONCE() in __fib6_drop_pcpu_from() */ 1410 1411 prev = xchg(p, NULL); 1411 1412 if (prev) { 1412 1413 dst_dev_put(&prev->dst);
+6 -8
net/ipv6/rpl_iptunnel.c
··· 212 212 if (unlikely(err)) 213 213 goto drop; 214 214 215 - preempt_disable(); 215 + local_bh_disable(); 216 216 dst = dst_cache_get(&rlwt->cache); 217 - preempt_enable(); 217 + local_bh_enable(); 218 218 219 219 if (unlikely(!dst)) { 220 220 struct ipv6hdr *hdr = ipv6_hdr(skb); ··· 234 234 goto drop; 235 235 } 236 236 237 - preempt_disable(); 237 + local_bh_disable(); 238 238 dst_cache_set_ip6(&rlwt->cache, dst, &fl6.saddr); 239 - preempt_enable(); 239 + local_bh_enable(); 240 240 } 241 241 242 242 skb_dst_drop(skb); ··· 268 268 return err; 269 269 } 270 270 271 - preempt_disable(); 271 + local_bh_disable(); 272 272 dst = dst_cache_get(&rlwt->cache); 273 - preempt_enable(); 274 273 275 274 if (!dst) { 276 275 ip6_route_input(skb); 277 276 dst = skb_dst(skb); 278 277 if (!dst->error) { 279 - preempt_disable(); 280 278 dst_cache_set_ip6(&rlwt->cache, dst, 281 279 &ipv6_hdr(skb)->saddr); 282 - preempt_enable(); 283 280 } 284 281 } else { 285 282 skb_dst_drop(skb); 286 283 skb_dst_set(skb, dst); 287 284 } 285 + local_bh_enable(); 288 286 289 287 err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev)); 290 288 if (unlikely(err))
+6 -8
net/ipv6/seg6_iptunnel.c
··· 464 464 465 465 slwt = seg6_lwt_lwtunnel(orig_dst->lwtstate); 466 466 467 - preempt_disable(); 467 + local_bh_disable(); 468 468 dst = dst_cache_get(&slwt->cache); 469 - preempt_enable(); 470 469 471 470 if (!dst) { 472 471 ip6_route_input(skb); 473 472 dst = skb_dst(skb); 474 473 if (!dst->error) { 475 - preempt_disable(); 476 474 dst_cache_set_ip6(&slwt->cache, dst, 477 475 &ipv6_hdr(skb)->saddr); 478 - preempt_enable(); 479 476 } 480 477 } else { 481 478 skb_dst_drop(skb); 482 479 skb_dst_set(skb, dst); 483 480 } 481 + local_bh_enable(); 484 482 485 483 err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev)); 486 484 if (unlikely(err)) ··· 534 536 535 537 slwt = seg6_lwt_lwtunnel(orig_dst->lwtstate); 536 538 537 - preempt_disable(); 539 + local_bh_disable(); 538 540 dst = dst_cache_get(&slwt->cache); 539 - preempt_enable(); 541 + local_bh_enable(); 540 542 541 543 if (unlikely(!dst)) { 542 544 struct ipv6hdr *hdr = ipv6_hdr(skb); ··· 556 558 goto drop; 557 559 } 558 560 559 - preempt_disable(); 561 + local_bh_disable(); 560 562 dst_cache_set_ip6(&slwt->cache, dst, &fl6.saddr); 561 - preempt_enable(); 563 + local_bh_enable(); 562 564 } 563 565 564 566 skb_dst_drop(skb);
+5 -4
net/mac80211/cfg.c
··· 2958 2958 memcpy(sdata->vif.bss_conf.mcast_rate, rate, 2959 2959 sizeof(int) * NUM_NL80211_BANDS); 2960 2960 2961 - ieee80211_link_info_change_notify(sdata, &sdata->deflink, 2962 - BSS_CHANGED_MCAST_RATE); 2961 + if (ieee80211_sdata_running(sdata)) 2962 + ieee80211_link_info_change_notify(sdata, &sdata->deflink, 2963 + BSS_CHANGED_MCAST_RATE); 2963 2964 2964 2965 return 0; 2965 2966 } ··· 4017 4016 goto out; 4018 4017 } 4019 4018 4020 - link_data->csa_chanreq = chanreq; 4019 + link_data->csa_chanreq = chanreq; 4021 4020 link_conf->csa_active = true; 4022 4021 4023 4022 if (params->block_tx && ··· 4028 4027 } 4029 4028 4030 4029 cfg80211_ch_switch_started_notify(sdata->dev, 4031 - &link_data->csa_chanreq.oper, 0, 4030 + &link_data->csa_chanreq.oper, link_id, 4032 4031 params->count, params->block_tx); 4033 4032 4034 4033 if (changed) {
+8 -2
net/mac80211/he.c
··· 230 230 231 231 if (!he_spr_ie_elem) 232 232 return; 233 + 234 + he_obss_pd->sr_ctrl = he_spr_ie_elem->he_sr_control; 233 235 data = he_spr_ie_elem->optional; 234 236 235 237 if (he_spr_ie_elem->he_sr_control & 236 238 IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT) 237 - data++; 239 + he_obss_pd->non_srg_max_offset = *data++; 240 + 238 241 if (he_spr_ie_elem->he_sr_control & 239 242 IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT) { 240 - he_obss_pd->max_offset = *data++; 241 243 he_obss_pd->min_offset = *data++; 244 + he_obss_pd->max_offset = *data++; 245 + memcpy(he_obss_pd->bss_color_bitmap, data, 8); 246 + data += 8; 247 + memcpy(he_obss_pd->partial_bssid_bitmap, data, 8); 242 248 he_obss_pd->enable = true; 243 249 } 244 250 }
+2
net/mac80211/ieee80211_i.h
··· 1845 1845 void ieee80211_configure_filter(struct ieee80211_local *local); 1846 1846 u64 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); 1847 1847 1848 + void ieee80211_handle_queued_frames(struct ieee80211_local *local); 1849 + 1848 1850 u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local); 1849 1851 int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb, 1850 1852 u64 *cookie, gfp_t gfp);
+8 -2
net/mac80211/main.c
··· 423 423 BSS_CHANGED_ERP_SLOT; 424 424 } 425 425 426 - static void ieee80211_tasklet_handler(struct tasklet_struct *t) 426 + void ieee80211_handle_queued_frames(struct ieee80211_local *local) 427 427 { 428 - struct ieee80211_local *local = from_tasklet(local, t, tasklet); 429 428 struct sk_buff *skb; 430 429 431 430 while ((skb = skb_dequeue(&local->skb_queue)) || ··· 447 448 break; 448 449 } 449 450 } 451 + } 452 + 453 + static void ieee80211_tasklet_handler(struct tasklet_struct *t) 454 + { 455 + struct ieee80211_local *local = from_tasklet(local, t, tasklet); 456 + 457 + ieee80211_handle_queued_frames(local); 450 458 } 451 459 452 460 static void ieee80211_restart_work(struct work_struct *work)
+1
net/mac80211/mesh.c
··· 1776 1776 ifmsh->last_preq = jiffies; 1777 1777 ifmsh->next_perr = jiffies; 1778 1778 ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE; 1779 + ifmsh->nonpeer_pm = NL80211_MESH_POWER_ACTIVE; 1779 1780 /* Allocate all mesh structures when creating the first mesh interface. */ 1780 1781 if (!mesh_allocated) 1781 1782 ieee80211s_init();
+13
net/mac80211/mesh_pathtbl.c
··· 1017 1017 */ 1018 1018 void mesh_path_flush_pending(struct mesh_path *mpath) 1019 1019 { 1020 + struct ieee80211_sub_if_data *sdata = mpath->sdata; 1021 + struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 1022 + struct mesh_preq_queue *preq, *tmp; 1020 1023 struct sk_buff *skb; 1021 1024 1022 1025 while ((skb = skb_dequeue(&mpath->frame_queue)) != NULL) 1023 1026 mesh_path_discard_frame(mpath->sdata, skb); 1027 + 1028 + spin_lock_bh(&ifmsh->mesh_preq_queue_lock); 1029 + list_for_each_entry_safe(preq, tmp, &ifmsh->preq_queue.list, list) { 1030 + if (ether_addr_equal(mpath->dst, preq->dst)) { 1031 + list_del(&preq->list); 1032 + kfree(preq); 1033 + --ifmsh->preq_queue_len; 1034 + } 1035 + } 1036 + spin_unlock_bh(&ifmsh->mesh_preq_queue_lock); 1024 1037 } 1025 1038 1026 1039 /**
+1 -1
net/mac80211/parse.c
··· 111 111 if (params->mode < IEEE80211_CONN_MODE_HE) 112 112 break; 113 113 if (len >= sizeof(*elems->he_spr) && 114 - len >= ieee80211_he_spr_size(data)) 114 + len >= ieee80211_he_spr_size(data) - 1) 115 115 elems->he_spr = data; 116 116 break; 117 117 case WLAN_EID_EXT_HE_6GHZ_CAPA:
+10 -4
net/mac80211/scan.c
··· 744 744 local->hw_scan_ies_bufsize *= n_bands; 745 745 } 746 746 747 - local->hw_scan_req = kmalloc( 748 - sizeof(*local->hw_scan_req) + 749 - req->n_channels * sizeof(req->channels[0]) + 750 - local->hw_scan_ies_bufsize, GFP_KERNEL); 747 + local->hw_scan_req = kmalloc(struct_size(local->hw_scan_req, 748 + req.channels, 749 + req->n_channels) + 750 + local->hw_scan_ies_bufsize, 751 + GFP_KERNEL); 751 752 if (!local->hw_scan_req) 752 753 return -ENOMEM; 753 754 754 755 local->hw_scan_req->req.ssids = req->ssids; 755 756 local->hw_scan_req->req.n_ssids = req->n_ssids; 757 + /* None of the channels are actually set 758 + * up but let UBSAN know the boundaries. 759 + */ 760 + local->hw_scan_req->req.n_channels = req->n_channels; 761 + 756 762 ies = (u8 *)local->hw_scan_req + 757 763 sizeof(*local->hw_scan_req) + 758 764 req->n_channels * sizeof(req->channels[0]);
+2 -2
net/mac80211/sta_info.c
··· 1724 1724 skb_queue_head_init(&pending); 1725 1725 1726 1726 /* sync with ieee80211_tx_h_unicast_ps_buf */ 1727 - spin_lock(&sta->ps_lock); 1727 + spin_lock_bh(&sta->ps_lock); 1728 1728 /* Send all buffered frames to the station */ 1729 1729 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { 1730 1730 int count = skb_queue_len(&pending), tmp; ··· 1753 1753 */ 1754 1754 clear_sta_flag(sta, WLAN_STA_PSPOLL); 1755 1755 clear_sta_flag(sta, WLAN_STA_UAPSD); 1756 - spin_unlock(&sta->ps_lock); 1756 + spin_unlock_bh(&sta->ps_lock); 1757 1757 1758 1758 atomic_dec(&ps->num_sta_ps); 1759 1759
+2
net/mac80211/util.c
··· 1567 1567 1568 1568 void ieee80211_stop_device(struct ieee80211_local *local) 1569 1569 { 1570 + ieee80211_handle_queued_frames(local); 1571 + 1570 1572 ieee80211_led_radio(local, false); 1571 1573 ieee80211_mod_tpt_led_trig(local, 0, IEEE80211_TPT_LEDTRIG_FL_RADIO); 1572 1574
+7 -2
net/mptcp/protocol.c
··· 2916 2916 if (oldstate != TCP_ESTABLISHED) 2917 2917 MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); 2918 2918 break; 2919 - 2919 + case TCP_CLOSE_WAIT: 2920 + /* Unlike TCP, MPTCP sk would not have the TCP_SYN_RECV state: 2921 + * MPTCP "accepted" sockets will be created later on. So no 2922 + * transition from TCP_SYN_RECV to TCP_CLOSE_WAIT. 2923 + */ 2924 + break; 2920 2925 default: 2921 - if (oldstate == TCP_ESTABLISHED) 2926 + if (oldstate == TCP_ESTABLISHED || oldstate == TCP_CLOSE_WAIT) 2922 2927 MPTCP_DEC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); 2923 2928 } 2924 2929
+2
net/ncsi/internal.h
··· 325 325 spinlock_t lock; /* Protect the NCSI device */ 326 326 unsigned int package_probe_id;/* Current ID during probe */ 327 327 unsigned int package_num; /* Number of packages */ 328 + unsigned int channel_probe_id;/* Current cahnnel ID during probe */ 328 329 struct list_head packages; /* List of packages */ 329 330 struct ncsi_channel *hot_channel; /* Channel was ever active */ 330 331 struct ncsi_request requests[256]; /* Request table */ ··· 344 343 bool multi_package; /* Enable multiple packages */ 345 344 bool mlx_multi_host; /* Enable multi host Mellanox */ 346 345 u32 package_whitelist; /* Packages to configure */ 346 + unsigned char channel_count; /* Num of channels to probe */ 347 347 }; 348 348 349 349 struct ncsi_cmd_arg {
+37 -38
net/ncsi/ncsi-manage.c
··· 510 510 511 511 break; 512 512 case ncsi_dev_state_suspend_gls: 513 - ndp->pending_req_num = np->channel_num; 513 + ndp->pending_req_num = 1; 514 514 515 515 nca.type = NCSI_PKT_CMD_GLS; 516 516 nca.package = np->id; 517 + nca.channel = ndp->channel_probe_id; 518 + ret = ncsi_xmit_cmd(&nca); 519 + if (ret) 520 + goto error; 521 + ndp->channel_probe_id++; 517 522 518 - nd->state = ncsi_dev_state_suspend_dcnt; 519 - NCSI_FOR_EACH_CHANNEL(np, nc) { 520 - nca.channel = nc->id; 521 - ret = ncsi_xmit_cmd(&nca); 522 - if (ret) 523 - goto error; 523 + if (ndp->channel_probe_id == ndp->channel_count) { 524 + ndp->channel_probe_id = 0; 525 + nd->state = ncsi_dev_state_suspend_dcnt; 524 526 } 525 527 526 528 break; ··· 1347 1345 { 1348 1346 struct ncsi_dev *nd = &ndp->ndev; 1349 1347 struct ncsi_package *np; 1350 - struct ncsi_channel *nc; 1351 1348 struct ncsi_cmd_arg nca; 1352 1349 unsigned char index; 1353 1350 int ret; ··· 1424 1423 1425 1424 nd->state = ncsi_dev_state_probe_cis; 1426 1425 break; 1427 - case ncsi_dev_state_probe_cis: 1428 - ndp->pending_req_num = NCSI_RESERVED_CHANNEL; 1429 - 1430 - /* Clear initial state */ 1431 - nca.type = NCSI_PKT_CMD_CIS; 1432 - nca.package = ndp->active_package->id; 1433 - for (index = 0; index < NCSI_RESERVED_CHANNEL; index++) { 1434 - nca.channel = index; 1435 - ret = ncsi_xmit_cmd(&nca); 1436 - if (ret) 1437 - goto error; 1438 - } 1439 - 1440 - nd->state = ncsi_dev_state_probe_gvi; 1441 - if (IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY)) 1442 - nd->state = ncsi_dev_state_probe_keep_phy; 1443 - break; 1444 1426 case ncsi_dev_state_probe_keep_phy: 1445 1427 ndp->pending_req_num = 1; 1446 1428 ··· 1436 1452 1437 1453 nd->state = ncsi_dev_state_probe_gvi; 1438 1454 break; 1455 + case ncsi_dev_state_probe_cis: 1439 1456 case ncsi_dev_state_probe_gvi: 1440 1457 case ncsi_dev_state_probe_gc: 1441 1458 case ncsi_dev_state_probe_gls: 1442 1459 np = ndp->active_package; 1443 - ndp->pending_req_num = np->channel_num; 1460 + ndp->pending_req_num = 1; 1444 1461 1445 - /* Retrieve version, capability or link status */ 1446 - if (nd->state == ncsi_dev_state_probe_gvi) 1462 + /* Clear initial state Retrieve version, capability or link status */ 1463 + if (nd->state == ncsi_dev_state_probe_cis) 1464 + nca.type = NCSI_PKT_CMD_CIS; 1465 + else if (nd->state == ncsi_dev_state_probe_gvi) 1447 1466 nca.type = NCSI_PKT_CMD_GVI; 1448 1467 else if (nd->state == ncsi_dev_state_probe_gc) 1449 1468 nca.type = NCSI_PKT_CMD_GC; ··· 1454 1467 nca.type = NCSI_PKT_CMD_GLS; 1455 1468 1456 1469 nca.package = np->id; 1457 - NCSI_FOR_EACH_CHANNEL(np, nc) { 1458 - nca.channel = nc->id; 1459 - ret = ncsi_xmit_cmd(&nca); 1460 - if (ret) 1461 - goto error; 1470 + nca.channel = ndp->channel_probe_id; 1471 + 1472 + ret = ncsi_xmit_cmd(&nca); 1473 + if (ret) 1474 + goto error; 1475 + 1476 + if (nd->state == ncsi_dev_state_probe_cis) { 1477 + nd->state = ncsi_dev_state_probe_gvi; 1478 + if (IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY) && ndp->channel_probe_id == 0) 1479 + nd->state = ncsi_dev_state_probe_keep_phy; 1480 + } else if (nd->state == ncsi_dev_state_probe_gvi) { 1481 + nd->state = ncsi_dev_state_probe_gc; 1482 + } else if (nd->state == ncsi_dev_state_probe_gc) { 1483 + nd->state = ncsi_dev_state_probe_gls; 1484 + } else { 1485 + nd->state = ncsi_dev_state_probe_cis; 1486 + ndp->channel_probe_id++; 1462 1487 } 1463 1488 1464 - if (nd->state == ncsi_dev_state_probe_gvi) 1465 - nd->state = ncsi_dev_state_probe_gc; 1466 - else if (nd->state == ncsi_dev_state_probe_gc) 1467 - nd->state = ncsi_dev_state_probe_gls; 1468 - else 1489 + if (ndp->channel_probe_id == ndp->channel_count) { 1490 + ndp->channel_probe_id = 0; 1469 1491 nd->state = ncsi_dev_state_probe_dp; 1492 + } 1470 1493 break; 1471 1494 case ncsi_dev_state_probe_dp: 1472 1495 ndp->pending_req_num = 1; ··· 1777 1780 ndp->requests[i].ndp = ndp; 1778 1781 timer_setup(&ndp->requests[i].timer, ncsi_request_timeout, 0); 1779 1782 } 1783 + ndp->channel_count = NCSI_RESERVED_CHANNEL; 1780 1784 1781 1785 spin_lock_irqsave(&ncsi_dev_lock, flags); 1782 1786 list_add_tail_rcu(&ndp->node, &ncsi_dev_list); ··· 1811 1813 1812 1814 if (!(ndp->flags & NCSI_DEV_PROBED)) { 1813 1815 ndp->package_probe_id = 0; 1816 + ndp->channel_probe_id = 0; 1814 1817 nd->state = ncsi_dev_state_probe; 1815 1818 schedule_work(&ndp->work); 1816 1819 return 0;
+3 -1
net/ncsi/ncsi-rsp.c
··· 795 795 struct ncsi_rsp_gc_pkt *rsp; 796 796 struct ncsi_dev_priv *ndp = nr->ndp; 797 797 struct ncsi_channel *nc; 798 + struct ncsi_package *np; 798 799 size_t size; 799 800 800 801 /* Find the channel */ 801 802 rsp = (struct ncsi_rsp_gc_pkt *)skb_network_header(nr->rsp); 802 803 ncsi_find_package_and_channel(ndp, rsp->rsp.common.channel, 803 - NULL, &nc); 804 + &np, &nc); 804 805 if (!nc) 805 806 return -ENODEV; 806 807 ··· 836 835 */ 837 836 nc->vlan_filter.bitmap = U64_MAX; 838 837 nc->vlan_filter.n_vids = rsp->vlan_cnt; 838 + np->ndp->channel_count = rsp->channel_cnt; 839 839 840 840 return 0; 841 841 }
+1 -1
net/sched/sch_multiq.c
··· 185 185 186 186 qopt->bands = qdisc_dev(sch)->real_num_tx_queues; 187 187 188 - removed = kmalloc(sizeof(*removed) * (q->max_bands - q->bands), 188 + removed = kmalloc(sizeof(*removed) * (q->max_bands - qopt->bands), 189 189 GFP_KERNEL); 190 190 if (!removed) 191 191 return -ENOMEM;
+6 -9
net/sched/sch_taprio.c
··· 1176 1176 { 1177 1177 bool allow_overlapping_txqs = TXTIME_ASSIST_IS_ENABLED(taprio_flags); 1178 1178 1179 - if (!qopt && !dev->num_tc) { 1180 - NL_SET_ERR_MSG(extack, "'mqprio' configuration is necessary"); 1181 - return -EINVAL; 1182 - } 1183 - 1184 - /* If num_tc is already set, it means that the user already 1185 - * configured the mqprio part 1186 - */ 1187 - if (dev->num_tc) 1179 + if (!qopt) { 1180 + if (!dev->num_tc) { 1181 + NL_SET_ERR_MSG(extack, "'mqprio' configuration is necessary"); 1182 + return -EINVAL; 1183 + } 1188 1184 return 0; 1185 + } 1189 1186 1190 1187 /* taprio imposes that traffic classes map 1:n to tx queues */ 1191 1188 if (qopt->num_tc > dev->num_tx_queues) {
+2 -20
net/smc/af_smc.c
··· 459 459 static void smc_adjust_sock_bufsizes(struct sock *nsk, struct sock *osk, 460 460 unsigned long mask) 461 461 { 462 - struct net *nnet = sock_net(nsk); 463 - 464 462 nsk->sk_userlocks = osk->sk_userlocks; 465 - if (osk->sk_userlocks & SOCK_SNDBUF_LOCK) { 463 + if (osk->sk_userlocks & SOCK_SNDBUF_LOCK) 466 464 nsk->sk_sndbuf = osk->sk_sndbuf; 467 - } else { 468 - if (mask == SK_FLAGS_SMC_TO_CLC) 469 - WRITE_ONCE(nsk->sk_sndbuf, 470 - READ_ONCE(nnet->ipv4.sysctl_tcp_wmem[1])); 471 - else 472 - WRITE_ONCE(nsk->sk_sndbuf, 473 - 2 * READ_ONCE(nnet->smc.sysctl_wmem)); 474 - } 475 - if (osk->sk_userlocks & SOCK_RCVBUF_LOCK) { 465 + if (osk->sk_userlocks & SOCK_RCVBUF_LOCK) 476 466 nsk->sk_rcvbuf = osk->sk_rcvbuf; 477 - } else { 478 - if (mask == SK_FLAGS_SMC_TO_CLC) 479 - WRITE_ONCE(nsk->sk_rcvbuf, 480 - READ_ONCE(nnet->ipv4.sysctl_tcp_rmem[1])); 481 - else 482 - WRITE_ONCE(nsk->sk_rcvbuf, 483 - 2 * READ_ONCE(nnet->smc.sysctl_rmem)); 484 - } 485 467 } 486 468 487 469 static void smc_copy_sock_settings(struct sock *nsk, struct sock *osk,
+44 -46
net/unix/af_unix.c
··· 221 221 return unix_peer(osk) == NULL || unix_our_peer(sk, osk); 222 222 } 223 223 224 - static inline int unix_recvq_full(const struct sock *sk) 225 - { 226 - return skb_queue_len(&sk->sk_receive_queue) > sk->sk_max_ack_backlog; 227 - } 228 - 229 224 static inline int unix_recvq_full_lockless(const struct sock *sk) 230 225 { 231 - return skb_queue_len_lockless(&sk->sk_receive_queue) > 232 - READ_ONCE(sk->sk_max_ack_backlog); 226 + return skb_queue_len_lockless(&sk->sk_receive_queue) > sk->sk_max_ack_backlog; 233 227 } 234 228 235 229 struct sock *unix_peer_get(struct sock *s) ··· 524 530 return 0; 525 531 } 526 532 527 - static int unix_writable(const struct sock *sk) 533 + static int unix_writable(const struct sock *sk, unsigned char state) 528 534 { 529 - return sk->sk_state != TCP_LISTEN && 530 - (refcount_read(&sk->sk_wmem_alloc) << 2) <= sk->sk_sndbuf; 535 + return state != TCP_LISTEN && 536 + (refcount_read(&sk->sk_wmem_alloc) << 2) <= READ_ONCE(sk->sk_sndbuf); 531 537 } 532 538 533 539 static void unix_write_space(struct sock *sk) ··· 535 541 struct socket_wq *wq; 536 542 537 543 rcu_read_lock(); 538 - if (unix_writable(sk)) { 544 + if (unix_writable(sk, READ_ONCE(sk->sk_state))) { 539 545 wq = rcu_dereference(sk->sk_wq); 540 546 if (skwq_has_sleeper(wq)) 541 547 wake_up_interruptible_sync_poll(&wq->wait, ··· 564 570 sk_error_report(other); 565 571 } 566 572 } 567 - other->sk_state = TCP_CLOSE; 568 573 } 569 574 570 575 static void unix_sock_destructor(struct sock *sk) ··· 610 617 u->path.dentry = NULL; 611 618 u->path.mnt = NULL; 612 619 state = sk->sk_state; 613 - sk->sk_state = TCP_CLOSE; 620 + WRITE_ONCE(sk->sk_state, TCP_CLOSE); 614 621 615 622 skpair = unix_peer(sk); 616 623 unix_peer(sk) = NULL; ··· 631 638 unix_state_lock(skpair); 632 639 /* No more writes */ 633 640 WRITE_ONCE(skpair->sk_shutdown, SHUTDOWN_MASK); 634 - if (!skb_queue_empty(&sk->sk_receive_queue) || embrion) 641 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue) || embrion) 635 642 WRITE_ONCE(skpair->sk_err, ECONNRESET); 636 643 unix_state_unlock(skpair); 637 644 skpair->sk_state_change(skpair); ··· 732 739 if (backlog > sk->sk_max_ack_backlog) 733 740 wake_up_interruptible_all(&u->peer_wait); 734 741 sk->sk_max_ack_backlog = backlog; 735 - sk->sk_state = TCP_LISTEN; 742 + WRITE_ONCE(sk->sk_state, TCP_LISTEN); 743 + 736 744 /* set credentials so connect can copy them */ 737 745 init_peercred(sk); 738 746 err = 0; ··· 970 976 sk->sk_hash = unix_unbound_hash(sk); 971 977 sk->sk_allocation = GFP_KERNEL_ACCOUNT; 972 978 sk->sk_write_space = unix_write_space; 973 - sk->sk_max_ack_backlog = net->unx.sysctl_max_dgram_qlen; 979 + sk->sk_max_ack_backlog = READ_ONCE(net->unx.sysctl_max_dgram_qlen); 974 980 sk->sk_destruct = unix_sock_destructor; 975 981 u = unix_sk(sk); 976 982 u->listener = NULL; ··· 1396 1402 if (err) 1397 1403 goto out_unlock; 1398 1404 1399 - sk->sk_state = other->sk_state = TCP_ESTABLISHED; 1405 + WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED); 1406 + WRITE_ONCE(other->sk_state, TCP_ESTABLISHED); 1400 1407 } else { 1401 1408 /* 1402 1409 * 1003.1g breaking connected state with AF_UNSPEC ··· 1414 1419 1415 1420 unix_peer(sk) = other; 1416 1421 if (!other) 1417 - sk->sk_state = TCP_CLOSE; 1422 + WRITE_ONCE(sk->sk_state, TCP_CLOSE); 1418 1423 unix_dgram_peer_wake_disconnect_wakeup(sk, old_peer); 1419 1424 1420 1425 unix_state_double_unlock(sk, other); 1421 1426 1422 - if (other != old_peer) 1427 + if (other != old_peer) { 1423 1428 unix_dgram_disconnected(sk, old_peer); 1429 + 1430 + unix_state_lock(old_peer); 1431 + if (!unix_peer(old_peer)) 1432 + WRITE_ONCE(old_peer->sk_state, TCP_CLOSE); 1433 + unix_state_unlock(old_peer); 1434 + } 1435 + 1424 1436 sock_put(old_peer); 1425 1437 } else { 1426 1438 unix_peer(sk) = other; ··· 1475 1473 struct sk_buff *skb = NULL; 1476 1474 long timeo; 1477 1475 int err; 1478 - int st; 1479 1476 1480 1477 err = unix_validate_addr(sunaddr, addr_len); 1481 1478 if (err) ··· 1539 1538 if (other->sk_shutdown & RCV_SHUTDOWN) 1540 1539 goto out_unlock; 1541 1540 1542 - if (unix_recvq_full(other)) { 1541 + if (unix_recvq_full_lockless(other)) { 1543 1542 err = -EAGAIN; 1544 1543 if (!timeo) 1545 1544 goto out_unlock; ··· 1564 1563 1565 1564 Well, and we have to recheck the state after socket locked. 1566 1565 */ 1567 - st = sk->sk_state; 1568 - 1569 - switch (st) { 1566 + switch (READ_ONCE(sk->sk_state)) { 1570 1567 case TCP_CLOSE: 1571 1568 /* This is ok... continue with connect */ 1572 1569 break; ··· 1579 1580 1580 1581 unix_state_lock_nested(sk, U_LOCK_SECOND); 1581 1582 1582 - if (sk->sk_state != st) { 1583 + if (sk->sk_state != TCP_CLOSE) { 1583 1584 unix_state_unlock(sk); 1584 1585 unix_state_unlock(other); 1585 1586 sock_put(other); ··· 1632 1633 copy_peercred(sk, other); 1633 1634 1634 1635 sock->state = SS_CONNECTED; 1635 - sk->sk_state = TCP_ESTABLISHED; 1636 + WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED); 1636 1637 sock_hold(newsk); 1637 1638 1638 1639 smp_mb__after_atomic(); /* sock_hold() does an atomic_inc() */ ··· 1704 1705 goto out; 1705 1706 1706 1707 arg->err = -EINVAL; 1707 - if (sk->sk_state != TCP_LISTEN) 1708 + if (READ_ONCE(sk->sk_state) != TCP_LISTEN) 1708 1709 goto out; 1709 1710 1710 1711 /* If socket state is TCP_LISTEN it cannot change (for now...), ··· 1961 1962 } 1962 1963 1963 1964 err = -EMSGSIZE; 1964 - if (len > sk->sk_sndbuf - 32) 1965 + if (len > READ_ONCE(sk->sk_sndbuf) - 32) 1965 1966 goto out; 1966 1967 1967 1968 if (len > SKB_MAX_ALLOC) { ··· 2043 2044 unix_peer(sk) = NULL; 2044 2045 unix_dgram_peer_wake_disconnect_wakeup(sk, other); 2045 2046 2046 - sk->sk_state = TCP_CLOSE; 2047 + WRITE_ONCE(sk->sk_state, TCP_CLOSE); 2047 2048 unix_state_unlock(sk); 2048 2049 2049 2050 unix_dgram_disconnected(sk, other); ··· 2220 2221 } 2221 2222 2222 2223 if (msg->msg_namelen) { 2223 - err = sk->sk_state == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP; 2224 + err = READ_ONCE(sk->sk_state) == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP; 2224 2225 goto out_err; 2225 2226 } else { 2226 2227 err = -ENOTCONN; ··· 2241 2242 &err, 0); 2242 2243 } else { 2243 2244 /* Keep two messages in the pipe so it schedules better */ 2244 - size = min_t(int, size, (sk->sk_sndbuf >> 1) - 64); 2245 + size = min_t(int, size, (READ_ONCE(sk->sk_sndbuf) >> 1) - 64); 2245 2246 2246 2247 /* allow fallback to order-0 allocations */ 2247 2248 size = min_t(int, size, SKB_MAX_HEAD(0) + UNIX_SKB_FRAGS_SZ); ··· 2334 2335 if (err) 2335 2336 return err; 2336 2337 2337 - if (sk->sk_state != TCP_ESTABLISHED) 2338 + if (READ_ONCE(sk->sk_state) != TCP_ESTABLISHED) 2338 2339 return -ENOTCONN; 2339 2340 2340 2341 if (msg->msg_namelen) ··· 2348 2349 { 2349 2350 struct sock *sk = sock->sk; 2350 2351 2351 - if (sk->sk_state != TCP_ESTABLISHED) 2352 + if (READ_ONCE(sk->sk_state) != TCP_ESTABLISHED) 2352 2353 return -ENOTCONN; 2353 2354 2354 2355 return unix_dgram_recvmsg(sock, msg, size, flags); ··· 2653 2654 2654 2655 static int unix_stream_read_skb(struct sock *sk, skb_read_actor_t recv_actor) 2655 2656 { 2656 - if (unlikely(sk->sk_state != TCP_ESTABLISHED)) 2657 + if (unlikely(READ_ONCE(sk->sk_state) != TCP_ESTABLISHED)) 2657 2658 return -ENOTCONN; 2658 2659 2659 2660 return unix_read_skb(sk, recv_actor); ··· 2677 2678 size_t size = state->size; 2678 2679 unsigned int last_len; 2679 2680 2680 - if (unlikely(sk->sk_state != TCP_ESTABLISHED)) { 2681 + if (unlikely(READ_ONCE(sk->sk_state) != TCP_ESTABLISHED)) { 2681 2682 err = -EINVAL; 2682 2683 goto out; 2683 2684 } ··· 2991 2992 struct sk_buff *skb; 2992 2993 long amount = 0; 2993 2994 2994 - if (sk->sk_state == TCP_LISTEN) 2995 + if (READ_ONCE(sk->sk_state) == TCP_LISTEN) 2995 2996 return -EINVAL; 2996 2997 2997 2998 spin_lock(&sk->sk_receive_queue.lock); ··· 3103 3104 static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wait) 3104 3105 { 3105 3106 struct sock *sk = sock->sk; 3107 + unsigned char state; 3106 3108 __poll_t mask; 3107 3109 u8 shutdown; 3108 3110 3109 3111 sock_poll_wait(file, sock, wait); 3110 3112 mask = 0; 3111 3113 shutdown = READ_ONCE(sk->sk_shutdown); 3114 + state = READ_ONCE(sk->sk_state); 3112 3115 3113 3116 /* exceptional events? */ 3114 3117 if (READ_ONCE(sk->sk_err)) ··· 3132 3131 3133 3132 /* Connection-based need to check for termination and startup */ 3134 3133 if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) && 3135 - sk->sk_state == TCP_CLOSE) 3134 + state == TCP_CLOSE) 3136 3135 mask |= EPOLLHUP; 3137 3136 3138 3137 /* 3139 3138 * we set writable also when the other side has shut down the 3140 3139 * connection. This prevents stuck sockets. 3141 3140 */ 3142 - if (unix_writable(sk)) 3141 + if (unix_writable(sk, state)) 3143 3142 mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND; 3144 3143 3145 3144 return mask; ··· 3150 3149 { 3151 3150 struct sock *sk = sock->sk, *other; 3152 3151 unsigned int writable; 3152 + unsigned char state; 3153 3153 __poll_t mask; 3154 3154 u8 shutdown; 3155 3155 3156 3156 sock_poll_wait(file, sock, wait); 3157 3157 mask = 0; 3158 3158 shutdown = READ_ONCE(sk->sk_shutdown); 3159 + state = READ_ONCE(sk->sk_state); 3159 3160 3160 3161 /* exceptional events? */ 3161 3162 if (READ_ONCE(sk->sk_err) || ··· 3177 3174 mask |= EPOLLIN | EPOLLRDNORM; 3178 3175 3179 3176 /* Connection-based need to check for termination and startup */ 3180 - if (sk->sk_type == SOCK_SEQPACKET) { 3181 - if (sk->sk_state == TCP_CLOSE) 3182 - mask |= EPOLLHUP; 3183 - /* connection hasn't started yet? */ 3184 - if (sk->sk_state == TCP_SYN_SENT) 3185 - return mask; 3186 - } 3177 + if (sk->sk_type == SOCK_SEQPACKET && state == TCP_CLOSE) 3178 + mask |= EPOLLHUP; 3187 3179 3188 3180 /* No write status requested, avoid expensive OUT tests. */ 3189 3181 if (!(poll_requested_events(wait) & (EPOLLWRBAND|EPOLLWRNORM|EPOLLOUT))) 3190 3182 return mask; 3191 3183 3192 - writable = unix_writable(sk); 3184 + writable = unix_writable(sk, state); 3193 3185 if (writable) { 3194 3186 unix_state_lock(sk); 3195 3187
+6 -6
net/unix/diag.c
··· 65 65 u32 *buf; 66 66 int i; 67 67 68 - if (sk->sk_state == TCP_LISTEN) { 68 + if (READ_ONCE(sk->sk_state) == TCP_LISTEN) { 69 69 spin_lock(&sk->sk_receive_queue.lock); 70 70 71 71 attr = nla_reserve(nlskb, UNIX_DIAG_ICONS, ··· 103 103 { 104 104 struct unix_diag_rqlen rql; 105 105 106 - if (sk->sk_state == TCP_LISTEN) { 107 - rql.udiag_rqueue = sk->sk_receive_queue.qlen; 106 + if (READ_ONCE(sk->sk_state) == TCP_LISTEN) { 107 + rql.udiag_rqueue = skb_queue_len_lockless(&sk->sk_receive_queue); 108 108 rql.udiag_wqueue = sk->sk_max_ack_backlog; 109 109 } else { 110 110 rql.udiag_rqueue = (u32) unix_inq_len(sk); ··· 136 136 rep = nlmsg_data(nlh); 137 137 rep->udiag_family = AF_UNIX; 138 138 rep->udiag_type = sk->sk_type; 139 - rep->udiag_state = sk->sk_state; 139 + rep->udiag_state = READ_ONCE(sk->sk_state); 140 140 rep->pad = 0; 141 141 rep->udiag_ino = sk_ino; 142 142 sock_diag_save_cookie(sk, rep->udiag_cookie); ··· 165 165 sock_diag_put_meminfo(sk, skb, UNIX_DIAG_MEMINFO)) 166 166 goto out_nlmsg_trim; 167 167 168 - if (nla_put_u8(skb, UNIX_DIAG_SHUTDOWN, sk->sk_shutdown)) 168 + if (nla_put_u8(skb, UNIX_DIAG_SHUTDOWN, READ_ONCE(sk->sk_shutdown))) 169 169 goto out_nlmsg_trim; 170 170 171 171 if ((req->udiag_show & UDIAG_SHOW_UID) && ··· 215 215 sk_for_each(sk, &net->unx.table.buckets[slot]) { 216 216 if (num < s_num) 217 217 goto next; 218 - if (!(req->udiag_states & (1 << sk->sk_state))) 218 + if (!(req->udiag_states & (1 << READ_ONCE(sk->sk_state)))) 219 219 goto next; 220 220 if (sk_diag_dump(sk, skb, req, sk_user_ns(skb->sk), 221 221 NETLINK_CB(cb->skb).portid,
+1 -1
net/wireless/core.c
··· 431 431 if (wk) { 432 432 list_del_init(&wk->entry); 433 433 if (!list_empty(&rdev->wiphy_work_list)) 434 - schedule_work(work); 434 + queue_work(system_unbound_wq, work); 435 435 spin_unlock_irq(&rdev->wiphy_work_lock); 436 436 437 437 wk->func(&rdev->wiphy, wk);
+4 -4
net/wireless/pmsr.c
··· 56 56 out->ftm.burst_period = 0; 57 57 if (tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD]) 58 58 out->ftm.burst_period = 59 - nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD]); 59 + nla_get_u16(tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD]); 60 60 61 61 out->ftm.asap = !!tb[NL80211_PMSR_FTM_REQ_ATTR_ASAP]; 62 62 if (out->ftm.asap && !capa->ftm.asap) { ··· 75 75 out->ftm.num_bursts_exp = 0; 76 76 if (tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP]) 77 77 out->ftm.num_bursts_exp = 78 - nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP]); 78 + nla_get_u8(tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP]); 79 79 80 80 if (capa->ftm.max_bursts_exponent >= 0 && 81 81 out->ftm.num_bursts_exp > capa->ftm.max_bursts_exponent) { ··· 88 88 out->ftm.burst_duration = 15; 89 89 if (tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION]) 90 90 out->ftm.burst_duration = 91 - nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION]); 91 + nla_get_u8(tb[NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION]); 92 92 93 93 out->ftm.ftms_per_burst = 0; 94 94 if (tb[NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST]) ··· 107 107 out->ftm.ftmr_retries = 3; 108 108 if (tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES]) 109 109 out->ftm.ftmr_retries = 110 - nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES]); 110 + nla_get_u8(tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES]); 111 111 112 112 out->ftm.request_lci = !!tb[NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI]; 113 113 if (out->ftm.request_lci && !capa->ftm.request_lci) {
+5 -1
net/wireless/rdev-ops.h
··· 2 2 /* 3 3 * Portions of this file 4 4 * Copyright(c) 2016-2017 Intel Deutschland GmbH 5 - * Copyright (C) 2018, 2021-2023 Intel Corporation 5 + * Copyright (C) 2018, 2021-2024 Intel Corporation 6 6 */ 7 7 #ifndef __CFG80211_RDEV_OPS 8 8 #define __CFG80211_RDEV_OPS ··· 458 458 struct cfg80211_scan_request *request) 459 459 { 460 460 int ret; 461 + 462 + if (WARN_ON_ONCE(!request->n_ssids && request->ssids)) 463 + return -EINVAL; 464 + 461 465 trace_rdev_scan(&rdev->wiphy, request); 462 466 ret = rdev->ops->scan(&rdev->wiphy, request); 463 467 trace_rdev_return_int(&rdev->wiphy, ret);
+33 -17
net/wireless/scan.c
··· 812 812 LIST_HEAD(coloc_ap_list); 813 813 bool need_scan_psc = true; 814 814 const struct ieee80211_sband_iftype_data *iftd; 815 + size_t size, offs_ssids, offs_6ghz_params, offs_ies; 815 816 816 817 rdev_req->scan_6ghz = true; 817 818 ··· 878 877 spin_unlock_bh(&rdev->bss_lock); 879 878 } 880 879 881 - request = kzalloc(struct_size(request, channels, n_channels) + 882 - sizeof(*request->scan_6ghz_params) * count + 883 - sizeof(*request->ssids) * rdev_req->n_ssids, 884 - GFP_KERNEL); 880 + size = struct_size(request, channels, n_channels); 881 + offs_ssids = size; 882 + size += sizeof(*request->ssids) * rdev_req->n_ssids; 883 + offs_6ghz_params = size; 884 + size += sizeof(*request->scan_6ghz_params) * count; 885 + offs_ies = size; 886 + size += rdev_req->ie_len; 887 + 888 + request = kzalloc(size, GFP_KERNEL); 885 889 if (!request) { 886 890 cfg80211_free_coloc_ap_list(&coloc_ap_list); 887 891 return -ENOMEM; ··· 894 888 895 889 *request = *rdev_req; 896 890 request->n_channels = 0; 897 - request->scan_6ghz_params = 898 - (void *)&request->channels[n_channels]; 891 + request->n_6ghz_params = 0; 892 + if (rdev_req->n_ssids) { 893 + /* 894 + * Add the ssids from the parent scan request to the new 895 + * scan request, so the driver would be able to use them 896 + * in its probe requests to discover hidden APs on PSC 897 + * channels. 898 + */ 899 + request->ssids = (void *)request + offs_ssids; 900 + memcpy(request->ssids, rdev_req->ssids, 901 + sizeof(*request->ssids) * request->n_ssids); 902 + } 903 + request->scan_6ghz_params = (void *)request + offs_6ghz_params; 904 + 905 + if (rdev_req->ie_len) { 906 + void *ie = (void *)request + offs_ies; 907 + 908 + memcpy(ie, rdev_req->ie, rdev_req->ie_len); 909 + request->ie = ie; 910 + } 899 911 900 912 /* 901 913 * PSC channels should not be scanned in case of direct scan with 1 SSID ··· 1002 978 1003 979 if (request->n_channels) { 1004 980 struct cfg80211_scan_request *old = rdev->int_scan_req; 1005 - rdev->int_scan_req = request; 1006 981 1007 - /* 1008 - * Add the ssids from the parent scan request to the new scan 1009 - * request, so the driver would be able to use them in its 1010 - * probe requests to discover hidden APs on PSC channels. 1011 - */ 1012 - request->ssids = (void *)&request->channels[request->n_channels]; 1013 - request->n_ssids = rdev_req->n_ssids; 1014 - memcpy(request->ssids, rdev_req->ssids, sizeof(*request->ssids) * 1015 - request->n_ssids); 982 + rdev->int_scan_req = request; 1016 983 1017 984 /* 1018 985 * If this scan follows a previous scan, save the scan start ··· 2143 2128 struct ieee80211_he_operation *he_oper; 2144 2129 2145 2130 tmp = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_OPERATION, ie, ielen); 2146 - if (tmp && tmp->datalen >= sizeof(*he_oper) + 1) { 2131 + if (tmp && tmp->datalen >= sizeof(*he_oper) + 1 && 2132 + tmp->datalen >= ieee80211_he_oper_size(tmp->data + 1)) { 2147 2133 const struct ieee80211_he_6ghz_oper *he_6ghz_oper; 2148 2134 2149 2135 he_oper = (void *)&tmp->data[1];
+2 -2
net/wireless/sysfs.c
··· 5 5 * 6 6 * Copyright 2005-2006 Jiri Benc <jbenc@suse.cz> 7 7 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> 8 - * Copyright (C) 2020-2021, 2023 Intel Corporation 8 + * Copyright (C) 2020-2021, 2023-2024 Intel Corporation 9 9 */ 10 10 11 11 #include <linux/device.h> ··· 137 137 if (rdev->wiphy.registered && rdev->ops->resume) 138 138 ret = rdev_resume(rdev); 139 139 rdev->suspended = false; 140 - schedule_work(&rdev->wiphy_work); 140 + queue_work(system_unbound_wq, &rdev->wiphy_work); 141 141 wiphy_unlock(&rdev->wiphy); 142 142 143 143 if (ret)
+6 -1
net/wireless/util.c
··· 2549 2549 { 2550 2550 struct cfg80211_registered_device *rdev; 2551 2551 struct wireless_dev *wdev; 2552 + int ret; 2552 2553 2553 2554 wdev = dev->ieee80211_ptr; 2554 2555 if (!wdev) ··· 2561 2560 2562 2561 memset(sinfo, 0, sizeof(*sinfo)); 2563 2562 2564 - return rdev_get_station(rdev, dev, mac_addr, sinfo); 2563 + wiphy_lock(&rdev->wiphy); 2564 + ret = rdev_get_station(rdev, dev, mac_addr, sinfo); 2565 + wiphy_unlock(&rdev->wiphy); 2566 + 2567 + return ret; 2565 2568 } 2566 2569 EXPORT_SYMBOL(cfg80211_get_station); 2567 2570
+1 -4
net/xdp/xsk.c
··· 313 313 314 314 static int xsk_rcv_check(struct xdp_sock *xs, struct xdp_buff *xdp, u32 len) 315 315 { 316 - struct net_device *dev = xdp->rxq->dev; 317 - u32 qid = xdp->rxq->queue_index; 318 - 319 316 if (!xsk_is_bound(xs)) 320 317 return -ENXIO; 321 318 322 - if (!dev->_rx[qid].pool || xs->umem != dev->_rx[qid].pool->umem) 319 + if (xs->dev != xdp->rxq->dev || xs->queue_id != xdp->rxq->queue_index) 323 320 return -EINVAL; 324 321 325 322 if (len > xsk_pool_get_rx_frame_size(xs->pool) && !xs->sg) {
+1 -1
scripts/dtc/Makefile
··· 3 3 4 4 # *** Also keep .gitignore in sync when changing *** 5 5 hostprogs-always-$(CONFIG_DTC) += dtc fdtoverlay 6 - hostprogs-always-$(CHECK_DT_BINDING) += dtc 6 + hostprogs-always-$(CHECK_DTBS) += dtc 7 7 8 8 dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ 9 9 srcpos.o checks.o util.o
+1 -1
scripts/gdb/linux/Makefile
··· 5 5 symlinks := $(patsubst $(src)/%,%,$(wildcard $(src)/*.py)) 6 6 7 7 quiet_cmd_symlink = SYMLINK $@ 8 - cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(abspath $(srctree))/$(src)/%,$@) $@ 8 + cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(src)/%,$@) $@ 9 9 10 10 always-y += $(symlinks) 11 11 $(addprefix $(obj)/, $(symlinks)): FORCE
+1 -1
scripts/kconfig/expr.c
··· 476 476 return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_yes); 477 477 } 478 478 } 479 - if (sym1->type == S_BOOLEAN && sym1 == sym2) { 479 + if (sym1->type == S_BOOLEAN) { 480 480 if ((e1->type == E_NOT && e1->left.expr->type == E_SYMBOL && e2->type == E_SYMBOL) || 481 481 (e2->type == E_NOT && e2->left.expr->type == E_SYMBOL && e1->type == E_SYMBOL)) 482 482 return expr_alloc_symbol(&symbol_yes);
-5
scripts/kconfig/expr.h
··· 302 302 return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes); 303 303 } 304 304 305 - static inline int expr_is_no(struct expr *e) 306 - { 307 - return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no); 308 - } 309 - 310 305 #ifdef __cplusplus 311 306 } 312 307 #endif
+4 -2
scripts/kconfig/symbol.c
··· 14 14 15 15 struct symbol symbol_yes = { 16 16 .name = "y", 17 + .type = S_TRISTATE, 17 18 .curr = { "y", yes }, 18 19 .menus = LIST_HEAD_INIT(symbol_yes.menus), 19 20 .flags = SYMBOL_CONST|SYMBOL_VALID, ··· 22 21 23 22 struct symbol symbol_mod = { 24 23 .name = "m", 24 + .type = S_TRISTATE, 25 25 .curr = { "m", mod }, 26 26 .menus = LIST_HEAD_INIT(symbol_mod.menus), 27 27 .flags = SYMBOL_CONST|SYMBOL_VALID, ··· 30 28 31 29 struct symbol symbol_no = { 32 30 .name = "n", 31 + .type = S_TRISTATE, 33 32 .curr = { "n", no }, 34 33 .menus = LIST_HEAD_INIT(symbol_no.menus), 35 34 .flags = SYMBOL_CONST|SYMBOL_VALID, ··· 823 820 case no: 824 821 return "n"; 825 822 case mod: 826 - sym_calc_value(modules_sym); 827 - return (modules_sym->curr.tri == no) ? "n" : "m"; 823 + return "m"; 828 824 case yes: 829 825 return "y"; 830 826 }
+1 -2
scripts/make_fit.py
··· 190 190 Args: 191 191 fsw (libfdt.FdtSw): Object to use for writing 192 192 seq (int): Sequence number (1 for first) 193 - fmame (str): Filename containing the DTB 193 + fname (str): Filename containing the DTB 194 194 arch: FIT architecture, e.g. 'arm64' 195 195 compress (str): Compressed algorithm, e.g. 'gzip' 196 196 ··· 211 211 fsw.property_string('type', 'flat_dt') 212 212 fsw.property_string('arch', arch) 213 213 fsw.property_string('compression', compress) 214 - fsw.property('compatible', bytes(compat)) 215 214 216 215 with open(fname, 'rb') as inf: 217 216 compressed = compress_data(inf, compress)
+6 -22
scripts/mksysmap
··· 1 - #!/bin/sh -x 2 - # Based on the vmlinux file create the System.map file 1 + #!/bin/sed -f 2 + # SPDX-License-Identifier: GPL-2.0-only 3 + # 4 + # sed script to filter out symbols that are not needed for System.map, 5 + # or not suitable for kallsyms. The input should be 'nm -n <file>'. 6 + # 3 7 # System.map is used by module-init tools and some debugging 4 8 # tools to retrieve the actual addresses of symbols in the kernel. 5 9 # 6 - # Usage 7 - # mksysmap vmlinux System.map [exclude] 8 - 9 - 10 - ##### 11 - # Generate System.map (actual filename passed as second argument) 12 - # The following refers to the symbol type as per nm(1). 13 - 14 10 # readprofile starts reading symbols when _stext is found, and 15 11 # continue until it finds a symbol which is not either of 'T', 't', 16 12 # 'W' or 'w'. 17 13 # 18 - 19 - ${NM} -n ${1} | sed >${2} -e " 20 14 # --------------------------------------------------------------------------- 21 15 # Ignored symbol types 22 16 # ··· 86 92 # ppc stub 87 93 /\.long_branch\./d 88 94 /\.plt_branch\./d 89 - 90 - # --------------------------------------------------------------------------- 91 - # Ignored kallsyms symbols 92 - # 93 - # If the 3rd parameter exists, symbols from it will be omitted from the output. 94 - # This makes kallsyms have the identical symbol lists in the step 1 and 2. 95 - # Without this, the step2 would get new symbols generated by scripts/kallsyms.c 96 - # when CONFIG_KALLSYMS_ALL is enabled. That might require one more pass. 97 - $(if [ $# -ge 3 ]; then ${NM} ${3} | sed -n '/ U /!s:.* \([^ ]*\)$:/ \1$/d:p'; fi) 98 - "
+11 -2
security/landlock/fs.c
··· 1110 1110 bool allow_parent1, allow_parent2; 1111 1111 access_mask_t access_request_parent1, access_request_parent2; 1112 1112 struct path mnt_dir; 1113 + struct dentry *old_parent; 1113 1114 layer_mask_t layer_masks_parent1[LANDLOCK_NUM_ACCESS_FS] = {}, 1114 1115 layer_masks_parent2[LANDLOCK_NUM_ACCESS_FS] = {}; 1115 1116 ··· 1158 1157 mnt_dir.mnt = new_dir->mnt; 1159 1158 mnt_dir.dentry = new_dir->mnt->mnt_root; 1160 1159 1160 + /* 1161 + * old_dentry may be the root of the common mount point and 1162 + * !IS_ROOT(old_dentry) at the same time (e.g. with open_tree() and 1163 + * OPEN_TREE_CLONE). We do not need to call dget(old_parent) because 1164 + * we keep a reference to old_dentry. 1165 + */ 1166 + old_parent = (old_dentry == mnt_dir.dentry) ? old_dentry : 1167 + old_dentry->d_parent; 1168 + 1161 1169 /* new_dir->dentry is equal to new_dentry->d_parent */ 1162 - allow_parent1 = collect_domain_accesses(dom, mnt_dir.dentry, 1163 - old_dentry->d_parent, 1170 + allow_parent1 = collect_domain_accesses(dom, mnt_dir.dentry, old_parent, 1164 1171 &layer_masks_parent1); 1165 1172 allow_parent2 = collect_domain_accesses( 1166 1173 dom, mnt_dir.dentry, new_dir->dentry, &layer_masks_parent2);
+1 -1
security/tomoyo/Kconfig
··· 10 10 help 11 11 This selects TOMOYO Linux, pathname-based access control. 12 12 Required userspace tools and further information may be 13 - found at <https://tomoyo.osdn.jp/>. 13 + found at <https://tomoyo.sourceforge.net/>. 14 14 If you are unsure how to answer this question, answer N. 15 15 16 16 config SECURITY_TOMOYO_MAX_ACCEPT_ENTRY
+1 -1
security/tomoyo/common.c
··· 2787 2787 else 2788 2788 continue; 2789 2789 pr_err("Userland tools for TOMOYO 2.6 must be installed and policy must be initialized.\n"); 2790 - pr_err("Please see https://tomoyo.osdn.jp/2.6/ for more information.\n"); 2790 + pr_err("Please see https://tomoyo.sourceforge.net/2.6/ for more information.\n"); 2791 2791 panic("STOP!"); 2792 2792 } 2793 2793 tomoyo_read_unlock(idx);
+5 -4
sound/core/init.c
··· 537 537 synchronize_irq(card->sync_irq); 538 538 539 539 snd_info_card_disconnect(card); 540 + #ifdef CONFIG_SND_DEBUG 541 + debugfs_remove(card->debugfs_root); 542 + card->debugfs_root = NULL; 543 + #endif 544 + 540 545 if (card->registered) { 541 546 device_del(&card->card_dev); 542 547 card->registered = false; ··· 591 586 dev_warn(card->dev, "unable to free card info\n"); 592 587 /* Not fatal error */ 593 588 } 594 - #ifdef CONFIG_SND_DEBUG 595 - debugfs_remove(card->debugfs_root); 596 - card->debugfs_root = NULL; 597 - #endif 598 589 if (card->release_completion) 599 590 complete(card->release_completion); 600 591 if (!card->managed)
+14 -7
sound/core/jack.c
··· 37 37 }; 38 38 #endif /* CONFIG_SND_JACK_INPUT_DEV */ 39 39 40 + static void snd_jack_remove_debugfs(struct snd_jack *jack); 41 + 40 42 static int snd_jack_dev_disconnect(struct snd_device *device) 41 43 { 42 - #ifdef CONFIG_SND_JACK_INPUT_DEV 43 44 struct snd_jack *jack = device->device_data; 44 45 46 + snd_jack_remove_debugfs(jack); 47 + 48 + #ifdef CONFIG_SND_JACK_INPUT_DEV 45 49 guard(mutex)(&jack->input_dev_lock); 46 50 if (!jack->input_dev) 47 51 return 0; ··· 385 381 return 0; 386 382 } 387 383 388 - static void snd_jack_debugfs_clear_inject_node(struct snd_jack_kctl *jack_kctl) 384 + static void snd_jack_remove_debugfs(struct snd_jack *jack) 389 385 { 390 - debugfs_remove(jack_kctl->jack_debugfs_root); 391 - jack_kctl->jack_debugfs_root = NULL; 386 + struct snd_jack_kctl *jack_kctl; 387 + 388 + list_for_each_entry(jack_kctl, &jack->kctl_list, list) { 389 + debugfs_remove(jack_kctl->jack_debugfs_root); 390 + jack_kctl->jack_debugfs_root = NULL; 391 + } 392 392 } 393 393 #else /* CONFIG_SND_JACK_INJECTION_DEBUG */ 394 394 static int snd_jack_debugfs_add_inject_node(struct snd_jack *jack, ··· 401 393 return 0; 402 394 } 403 395 404 - static void snd_jack_debugfs_clear_inject_node(struct snd_jack_kctl *jack_kctl) 396 + static void snd_jack_remove_debugfs(struct snd_jack *jack) 405 397 { 406 398 } 407 399 #endif /* CONFIG_SND_JACK_INJECTION_DEBUG */ ··· 412 404 413 405 jack_kctl = kctl->private_data; 414 406 if (jack_kctl) { 415 - snd_jack_debugfs_clear_inject_node(jack_kctl); 416 407 list_del(&jack_kctl->list); 417 408 kfree(jack_kctl); 418 409 } ··· 504 497 .dev_free = snd_jack_dev_free, 505 498 #ifdef CONFIG_SND_JACK_INPUT_DEV 506 499 .dev_register = snd_jack_dev_register, 507 - .dev_disconnect = snd_jack_dev_disconnect, 508 500 #endif /* CONFIG_SND_JACK_INPUT_DEV */ 501 + .dev_disconnect = snd_jack_dev_disconnect, 509 502 }; 510 503 511 504 if (initial_kctl) {
+44 -4
sound/core/seq/seq_ump_convert.c
··· 157 157 static void ump_system_to_songpos_ev(const union snd_ump_midi1_msg *val, 158 158 struct snd_seq_event *ev) 159 159 { 160 - ev->data.control.value = (val->system.parm1 << 7) | val->system.parm2; 160 + ev->data.control.value = (val->system.parm2 << 7) | val->system.parm1; 161 161 } 162 162 163 163 /* Encoders for 0xf0 - 0xff */ ··· 368 368 struct snd_seq_ump_event ev_cvt; 369 369 const union snd_ump_midi1_msg *midi1 = (const union snd_ump_midi1_msg *)event->ump; 370 370 union snd_ump_midi2_msg *midi2 = (union snd_ump_midi2_msg *)ev_cvt.ump; 371 + struct snd_seq_ump_midi2_bank *cc; 371 372 372 373 ev_cvt = *event; 373 374 memset(&ev_cvt.ump, 0, sizeof(ev_cvt.ump)); ··· 388 387 midi2->paf.data = upscale_7_to_32bit(midi1->paf.data); 389 388 break; 390 389 case UMP_MSG_STATUS_CC: 390 + cc = &dest_port->midi2_bank[midi1->note.channel]; 391 + switch (midi1->cc.index) { 392 + case UMP_CC_BANK_SELECT: 393 + cc->bank_set = 1; 394 + cc->cc_bank_msb = midi1->cc.data; 395 + return 0; // skip 396 + case UMP_CC_BANK_SELECT_LSB: 397 + cc->bank_set = 1; 398 + cc->cc_bank_lsb = midi1->cc.data; 399 + return 0; // skip 400 + } 391 401 midi2->cc.index = midi1->cc.index; 392 402 midi2->cc.data = upscale_7_to_32bit(midi1->cc.data); 393 403 break; 394 404 case UMP_MSG_STATUS_PROGRAM: 395 405 midi2->pg.program = midi1->pg.program; 406 + cc = &dest_port->midi2_bank[midi1->note.channel]; 407 + if (cc->bank_set) { 408 + midi2->pg.bank_valid = 1; 409 + midi2->pg.bank_msb = cc->cc_bank_msb; 410 + midi2->pg.bank_lsb = cc->cc_bank_lsb; 411 + cc->bank_set = 0; 412 + } 396 413 break; 397 414 case UMP_MSG_STATUS_CHANNEL_PRESSURE: 398 415 midi2->caf.data = upscale_7_to_32bit(midi1->caf.data); ··· 438 419 struct snd_seq_ump_event ev_cvt; 439 420 union snd_ump_midi1_msg *midi1 = (union snd_ump_midi1_msg *)ev_cvt.ump; 440 421 const union snd_ump_midi2_msg *midi2 = (const union snd_ump_midi2_msg *)event->ump; 422 + int err; 441 423 u16 v; 442 424 443 425 ev_cvt = *event; ··· 463 443 midi1->cc.data = downscale_32_to_7bit(midi2->cc.data); 464 444 break; 465 445 case UMP_MSG_STATUS_PROGRAM: 446 + if (midi2->pg.bank_valid) { 447 + midi1->cc.status = UMP_MSG_STATUS_CC; 448 + midi1->cc.index = UMP_CC_BANK_SELECT; 449 + midi1->cc.data = midi2->pg.bank_msb; 450 + err = __snd_seq_deliver_single_event(dest, dest_port, 451 + (struct snd_seq_event *)&ev_cvt, 452 + atomic, hop); 453 + if (err < 0) 454 + return err; 455 + midi1->cc.index = UMP_CC_BANK_SELECT_LSB; 456 + midi1->cc.data = midi2->pg.bank_lsb; 457 + err = __snd_seq_deliver_single_event(dest, dest_port, 458 + (struct snd_seq_event *)&ev_cvt, 459 + atomic, hop); 460 + if (err < 0) 461 + return err; 462 + midi1->note.status = midi2->note.status; 463 + } 466 464 midi1->pg.program = midi2->pg.program; 467 465 break; 468 466 case UMP_MSG_STATUS_CHANNEL_PRESSURE: ··· 729 691 union snd_ump_midi1_msg *data, 730 692 unsigned char status) 731 693 { 694 + data->system.type = UMP_MSG_TYPE_SYSTEM; // override 732 695 data->system.status = status; 733 696 return 1; 734 697 } ··· 740 701 union snd_ump_midi1_msg *data, 741 702 unsigned char status) 742 703 { 704 + data->system.type = UMP_MSG_TYPE_SYSTEM; // override 743 705 data->system.status = status; 744 706 data->system.parm1 = event->data.control.value & 0x7f; 745 707 return 1; ··· 752 712 union snd_ump_midi1_msg *data, 753 713 unsigned char status) 754 714 { 715 + data->system.type = UMP_MSG_TYPE_SYSTEM; // override 755 716 data->system.status = status; 756 - data->system.parm1 = (event->data.control.value >> 7) & 0x7f; 757 - data->system.parm2 = event->data.control.value & 0x7f; 717 + data->system.parm1 = event->data.control.value & 0x7f; 718 + data->system.parm2 = (event->data.control.value >> 7) & 0x7f; 758 719 return 1; 759 720 } 760 721 ··· 895 854 data->pg.bank_msb = cc->cc_bank_msb; 896 855 data->pg.bank_lsb = cc->cc_bank_lsb; 897 856 cc->bank_set = 0; 898 - cc->cc_bank_msb = cc->cc_bank_lsb = 0; 899 857 } 900 858 return 1; 901 859 }
+15
sound/core/ump.c
··· 685 685 */ 686 686 int snd_ump_switch_protocol(struct snd_ump_endpoint *ump, unsigned int protocol) 687 687 { 688 + unsigned int type; 689 + 688 690 protocol &= ump->info.protocol_caps; 689 691 if (protocol == ump->info.protocol) 692 + return 0; 693 + 694 + type = protocol & SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK; 695 + if (type != SNDRV_UMP_EP_INFO_PROTO_MIDI1 && 696 + type != SNDRV_UMP_EP_INFO_PROTO_MIDI2) 690 697 return 0; 691 698 692 699 ump->info.protocol = protocol; ··· 966 959 UMP_STREAM_MSG_STATUS_STREAM_CFG); 967 960 if (err < 0) 968 961 ump_dbg(ump, "Unable to get UMP EP stream config\n"); 962 + 963 + /* If no protocol is set by some reason, assume the valid one */ 964 + if (!(ump->info.protocol & SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK)) { 965 + if (ump->info.protocol_caps & SNDRV_UMP_EP_INFO_PROTO_MIDI2) 966 + ump->info.protocol |= SNDRV_UMP_EP_INFO_PROTO_MIDI2; 967 + else if (ump->info.protocol_caps & SNDRV_UMP_EP_INFO_PROTO_MIDI1) 968 + ump->info.protocol |= SNDRV_UMP_EP_INFO_PROTO_MIDI1; 969 + } 969 970 970 971 /* Query and create blocks from Function Blocks */ 971 972 for (blk = 0; blk < ump->info.num_blocks; blk++) {
-1
sound/core/ump_convert.c
··· 404 404 midi2->pg.bank_msb = cc->cc_bank_msb; 405 405 midi2->pg.bank_lsb = cc->cc_bank_lsb; 406 406 cc->bank_set = 0; 407 - cc->cc_bank_msb = cc->cc_bank_lsb = 0; 408 407 } 409 408 break; 410 409 case UMP_MSG_STATUS_CHANNEL_PRESSURE:
+4 -4
sound/hda/intel-dsp-config.c
··· 668 668 return SND_INTEL_DSP_DRIVER_LEGACY; 669 669 } 670 670 671 - dev_info(&pci->dev, "DSP detected with PCI class/subclass/prog-if info 0x%06x\n", pci->class); 671 + dev_dbg(&pci->dev, "DSP detected with PCI class/subclass/prog-if info 0x%06x\n", pci->class); 672 672 673 673 /* find the configuration for the specific device */ 674 674 cfg = snd_intel_dsp_find_config(pci, config_table, ARRAY_SIZE(config_table)); ··· 678 678 if (cfg->flags & FLAG_SOF) { 679 679 if (cfg->flags & FLAG_SOF_ONLY_IF_SOUNDWIRE && 680 680 snd_intel_dsp_check_soundwire(pci) > 0) { 681 - dev_info(&pci->dev, "SoundWire enabled on CannonLake+ platform, using SOF driver\n"); 681 + dev_info_once(&pci->dev, "SoundWire enabled on CannonLake+ platform, using SOF driver\n"); 682 682 return SND_INTEL_DSP_DRIVER_SOF; 683 683 } 684 684 if (cfg->flags & FLAG_SOF_ONLY_IF_DMIC && 685 685 snd_intel_dsp_check_dmic(pci)) { 686 - dev_info(&pci->dev, "Digital mics found on Skylake+ platform, using SOF driver\n"); 686 + dev_info_once(&pci->dev, "Digital mics found on Skylake+ platform, using SOF driver\n"); 687 687 return SND_INTEL_DSP_DRIVER_SOF; 688 688 } 689 689 if (!(cfg->flags & FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE)) ··· 694 694 if (cfg->flags & FLAG_SST) { 695 695 if (cfg->flags & FLAG_SST_ONLY_IF_DMIC) { 696 696 if (snd_intel_dsp_check_dmic(pci)) { 697 - dev_info(&pci->dev, "Digital mics found on Skylake+ platform, using SST driver\n"); 697 + dev_info_once(&pci->dev, "Digital mics found on Skylake+ platform, using SST driver\n"); 698 698 return SND_INTEL_DSP_DRIVER_SST; 699 699 } 700 700 } else {
+1 -1
sound/pci/hda/patch_realtek.c
··· 10310 10310 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), 10311 10311 SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2), 10312 10312 SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2), 10313 - SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC245_FIXUP_CS35L41_SPI_2), 10313 + SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS), 10314 10314 SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2), 10315 10315 SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS), 10316 10316 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
+3 -2
sound/soc/codecs/cs42l43.c
··· 310 310 struct snd_soc_component *component = dai->component; 311 311 struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); 312 312 struct cs42l43 *cs42l43 = priv->core; 313 - int provider = !!regmap_test_bits(cs42l43->regmap, CS42L43_ASP_CLK_CONFIG2, 314 - CS42L43_ASP_MASTER_MODE_MASK); 313 + int provider = !dai->id || !!regmap_test_bits(cs42l43->regmap, 314 + CS42L43_ASP_CLK_CONFIG2, 315 + CS42L43_ASP_MASTER_MODE_MASK); 315 316 316 317 if (provider) 317 318 priv->constraint.mask = CS42L43_PROVIDER_RATE_MASK;
+1
sound/soc/codecs/wm_adsp.c
··· 2085 2085 .watchdog_expired = wm_adsp_fatal_error, 2086 2086 }; 2087 2087 2088 + MODULE_DESCRIPTION("Cirrus Logic ASoC DSP Support"); 2088 2089 MODULE_LICENSE("GPL v2"); 2089 2090 MODULE_IMPORT_NS(FW_CS_DSP);
+1 -1
sound/soc/intel/boards/Kconfig
··· 652 652 653 653 config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH 654 654 tristate "SoundWire generic machine driver" 655 - depends on I2C && ACPI 655 + depends on I2C && SPI_MASTER && ACPI 656 656 depends on MFD_INTEL_LPSS || COMPILE_TEST 657 657 depends on SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES || COMPILE_TEST 658 658 depends on SOUNDWIRE
+2 -2
sound/soc/sof/amd/acp-common.c
··· 258 258 }; 259 259 EXPORT_SYMBOL_NS(sof_acp_common_ops, SND_SOC_SOF_AMD_COMMON); 260 260 261 + MODULE_LICENSE("Dual BSD/GPL"); 262 + MODULE_DESCRIPTION("ACP SOF COMMON Driver"); 261 263 MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 262 264 MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 263 265 MODULE_IMPORT_NS(SOUNDWIRE_AMD_INIT); 264 - MODULE_DESCRIPTION("ACP SOF COMMON Driver"); 265 - MODULE_LICENSE("Dual BSD/GPL");
+1 -1
sound/soc/sof/amd/acp.c
··· 801 801 } 802 802 EXPORT_SYMBOL_NS(amd_sof_acp_remove, SND_SOC_SOF_AMD_COMMON); 803 803 804 + MODULE_LICENSE("Dual BSD/GPL"); 804 805 MODULE_DESCRIPTION("AMD ACP sof driver"); 805 806 MODULE_IMPORT_NS(SOUNDWIRE_AMD_INIT); 806 807 MODULE_IMPORT_NS(SND_AMD_SOUNDWIRE_ACPI); 807 - MODULE_LICENSE("Dual BSD/GPL");
-4
sound/soc/sof/amd/acp63.c
··· 140 140 141 141 return 0; 142 142 } 143 - 144 - MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 145 - MODULE_DESCRIPTION("ACP63 SOF Driver"); 146 - MODULE_LICENSE("Dual BSD/GPL");
+1
sound/soc/sof/amd/pci-acp63.c
··· 109 109 module_pci_driver(snd_sof_pci_amd_acp63_driver); 110 110 111 111 MODULE_LICENSE("Dual BSD/GPL"); 112 + MODULE_DESCRIPTION("ACP63 SOF Driver"); 112 113 MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 113 114 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/amd/pci-rmb.c
··· 99 99 module_pci_driver(snd_sof_pci_amd_rmb_driver); 100 100 101 101 MODULE_LICENSE("Dual BSD/GPL"); 102 + MODULE_DESCRIPTION("REMBRANDT SOF Driver"); 102 103 MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 103 104 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/amd/pci-rn.c
··· 103 103 module_pci_driver(snd_sof_pci_amd_rn_driver); 104 104 105 105 MODULE_LICENSE("Dual BSD/GPL"); 106 + MODULE_DESCRIPTION("RENOIR SOF Driver"); 106 107 MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 107 108 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/amd/pci-vangogh.c
··· 101 101 module_pci_driver(snd_sof_pci_amd_vgh_driver); 102 102 103 103 MODULE_LICENSE("Dual BSD/GPL"); 104 + MODULE_DESCRIPTION("VANGOGH SOF Driver"); 104 105 MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 105 106 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
-4
sound/soc/sof/amd/rembrandt.c
··· 140 140 141 141 return 0; 142 142 } 143 - 144 - MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 145 - MODULE_DESCRIPTION("REMBRANDT SOF Driver"); 146 - MODULE_LICENSE("Dual BSD/GPL");
-4
sound/soc/sof/amd/renoir.c
··· 115 115 116 116 return 0; 117 117 } 118 - 119 - MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 120 - MODULE_DESCRIPTION("RENOIR SOF Driver"); 121 - MODULE_LICENSE("Dual BSD/GPL");
-4
sound/soc/sof/amd/vangogh.c
··· 161 161 162 162 return 0; 163 163 } 164 - 165 - MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 166 - MODULE_DESCRIPTION("VANGOGH SOF Driver"); 167 - MODULE_LICENSE("Dual BSD/GPL");
+1 -1
sound/soc/sof/core.c
··· 769 769 EXPORT_SYMBOL(sof_machine_unregister); 770 770 771 771 MODULE_AUTHOR("Liam Girdwood"); 772 - MODULE_DESCRIPTION("Sound Open Firmware (SOF) Core"); 773 772 MODULE_LICENSE("Dual BSD/GPL"); 773 + MODULE_DESCRIPTION("Sound Open Firmware (SOF) Core"); 774 774 MODULE_ALIAS("platform:sof-audio"); 775 775 MODULE_IMPORT_NS(SND_SOC_SOF_CLIENT);
+1
sound/soc/sof/imx/imx-common.c
··· 75 75 EXPORT_SYMBOL(imx8_dump); 76 76 77 77 MODULE_LICENSE("Dual BSD/GPL"); 78 + MODULE_DESCRIPTION("SOF helpers for IMX platforms");
+2 -1
sound/soc/sof/imx/imx8.c
··· 667 667 }; 668 668 module_platform_driver(snd_sof_of_imx8_driver); 669 669 670 - MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 671 670 MODULE_LICENSE("Dual BSD/GPL"); 671 + MODULE_DESCRIPTION("SOF support for IMX8 platforms"); 672 + MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA);
+2 -1
sound/soc/sof/imx/imx8m.c
··· 514 514 }; 515 515 module_platform_driver(snd_sof_of_imx8m_driver); 516 516 517 - MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 518 517 MODULE_LICENSE("Dual BSD/GPL"); 518 + MODULE_DESCRIPTION("SOF support for IMX8M platforms"); 519 + MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA);
+2 -1
sound/soc/sof/imx/imx8ulp.c
··· 516 516 }; 517 517 module_platform_driver(snd_sof_of_imx8ulp_driver); 518 518 519 - MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 520 519 MODULE_LICENSE("Dual BSD/GPL"); 520 + MODULE_DESCRIPTION("SOF support for IMX8ULP platforms"); 521 + MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA);
+1
sound/soc/sof/intel/atom.c
··· 418 418 EXPORT_SYMBOL_NS(atom_set_mach_params, SND_SOC_SOF_INTEL_ATOM_HIFI_EP); 419 419 420 420 MODULE_LICENSE("Dual BSD/GPL"); 421 + MODULE_DESCRIPTION("SOF support for Atom platforms");
+1
sound/soc/sof/intel/bdw.c
··· 694 694 module_platform_driver(snd_sof_acpi_intel_bdw_driver); 695 695 696 696 MODULE_LICENSE("Dual BSD/GPL"); 697 + MODULE_DESCRIPTION("SOF support for Broadwell platforms"); 697 698 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HIFI_EP_IPC); 698 699 MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 699 700 MODULE_IMPORT_NS(SND_SOC_SOF_ACPI_DEV);
+1
sound/soc/sof/intel/byt.c
··· 475 475 module_platform_driver(snd_sof_acpi_intel_byt_driver); 476 476 477 477 MODULE_LICENSE("Dual BSD/GPL"); 478 + MODULE_DESCRIPTION("SOF support for Baytrail/Cherrytrail"); 478 479 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HIFI_EP_IPC); 479 480 MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 480 481 MODULE_IMPORT_NS(SND_SOC_SOF_ACPI_DEV);
+1
sound/soc/sof/intel/hda-codec.c
··· 457 457 #endif 458 458 459 459 MODULE_LICENSE("Dual BSD/GPL"); 460 + MODULE_DESCRIPTION("SOF support for HDaudio codecs");
+1
sound/soc/sof/intel/hda-ctrl.c
··· 328 328 } 329 329 330 330 MODULE_LICENSE("Dual BSD/GPL"); 331 + MODULE_DESCRIPTION("SOF helpers for HDaudio platforms"); 331 332 MODULE_IMPORT_NS(SND_SOC_SOF_HDA_MLINK); 332 333 MODULE_IMPORT_NS(SND_SOC_SOF_HDA_AUDIO_CODEC); 333 334 MODULE_IMPORT_NS(SND_SOC_SOF_HDA_AUDIO_CODEC_I915);
+1
sound/soc/sof/intel/hda-mlink.c
··· 972 972 #endif 973 973 974 974 MODULE_LICENSE("Dual BSD/GPL"); 975 + MODULE_DESCRIPTION("SOF support for HDaudio multi-link");
+1
sound/soc/sof/intel/hda.c
··· 1522 1522 } 1523 1523 1524 1524 MODULE_LICENSE("Dual BSD/GPL"); 1525 + MODULE_DESCRIPTION("SOF support for HDaudio platforms"); 1525 1526 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV); 1526 1527 MODULE_IMPORT_NS(SND_SOC_SOF_HDA_AUDIO_CODEC); 1527 1528 MODULE_IMPORT_NS(SND_SOC_SOF_HDA_AUDIO_CODEC_I915);
+1
sound/soc/sof/intel/pci-apl.c
··· 105 105 module_pci_driver(snd_sof_pci_intel_apl_driver); 106 106 107 107 MODULE_LICENSE("Dual BSD/GPL"); 108 + MODULE_DESCRIPTION("SOF support for ApolloLake platforms"); 108 109 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 109 110 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 110 111 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/intel/pci-cnl.c
··· 143 143 module_pci_driver(snd_sof_pci_intel_cnl_driver); 144 144 145 145 MODULE_LICENSE("Dual BSD/GPL"); 146 + MODULE_DESCRIPTION("SOF support for CannonLake platforms"); 146 147 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 147 148 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 148 149 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/intel/pci-icl.c
··· 108 108 module_pci_driver(snd_sof_pci_intel_icl_driver); 109 109 110 110 MODULE_LICENSE("Dual BSD/GPL"); 111 + MODULE_DESCRIPTION("SOF support for IceLake platforms"); 111 112 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 112 113 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 113 114 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_CNL);
+1
sound/soc/sof/intel/pci-lnl.c
··· 70 70 module_pci_driver(snd_sof_pci_intel_lnl_driver); 71 71 72 72 MODULE_LICENSE("Dual BSD/GPL"); 73 + MODULE_DESCRIPTION("SOF support for LunarLake platforms"); 73 74 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 74 75 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 75 76 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_MTL);
+1
sound/soc/sof/intel/pci-mtl.c
··· 133 133 module_pci_driver(snd_sof_pci_intel_mtl_driver); 134 134 135 135 MODULE_LICENSE("Dual BSD/GPL"); 136 + MODULE_DESCRIPTION("SOF support for MeteorLake platforms"); 136 137 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 137 138 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 138 139 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/intel/pci-skl.c
··· 89 89 module_pci_driver(snd_sof_pci_intel_skl_driver); 90 90 91 91 MODULE_LICENSE("Dual BSD/GPL"); 92 + MODULE_DESCRIPTION("SOF support for SkyLake platforms"); 92 93 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 93 94 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 94 95 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/intel/pci-tgl.c
··· 317 317 module_pci_driver(snd_sof_pci_intel_tgl_driver); 318 318 319 319 MODULE_LICENSE("Dual BSD/GPL"); 320 + MODULE_DESCRIPTION("SOF support for TigerLake platforms"); 320 321 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 321 322 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 322 323 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_CNL);
+1
sound/soc/sof/intel/pci-tng.c
··· 244 244 module_pci_driver(snd_sof_pci_intel_tng_driver); 245 245 246 246 MODULE_LICENSE("Dual BSD/GPL"); 247 + MODULE_DESCRIPTION("SOF support for Tangier platforms"); 247 248 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HIFI_EP_IPC); 248 249 MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 249 250 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+6 -6
sound/soc/sof/ipc4-pcm.c
··· 650 650 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 651 651 struct sof_ipc4_audio_format *ipc4_fmt; 652 652 struct sof_ipc4_copier *ipc4_copier; 653 - bool single_fmt = false; 653 + bool single_bitdepth = false; 654 654 u32 valid_bits = 0; 655 655 int dir, ret; 656 656 ··· 682 682 return 0; 683 683 684 684 if (dir == SNDRV_PCM_STREAM_PLAYBACK) { 685 - if (sof_ipc4_copier_is_single_format(sdev, 685 + if (sof_ipc4_copier_is_single_bitdepth(sdev, 686 686 available_fmt->output_pin_fmts, 687 687 available_fmt->num_output_formats)) { 688 688 ipc4_fmt = &available_fmt->output_pin_fmts->audio_fmt; 689 - single_fmt = true; 689 + single_bitdepth = true; 690 690 } 691 691 } else { 692 - if (sof_ipc4_copier_is_single_format(sdev, 692 + if (sof_ipc4_copier_is_single_bitdepth(sdev, 693 693 available_fmt->input_pin_fmts, 694 694 available_fmt->num_input_formats)) { 695 695 ipc4_fmt = &available_fmt->input_pin_fmts->audio_fmt; 696 - single_fmt = true; 696 + single_bitdepth = true; 697 697 } 698 698 } 699 699 } ··· 703 703 if (ret) 704 704 return ret; 705 705 706 - if (single_fmt) { 706 + if (single_bitdepth) { 707 707 snd_mask_none(fmt); 708 708 valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(ipc4_fmt->fmt_cfg); 709 709 dev_dbg(component->dev, "Set %s to %d bit format\n", dai->name, valid_bits);
+114 -49
sound/soc/sof/ipc4-topology.c
··· 195 195 for (i = 0; i < num_formats; i++) { 196 196 struct sof_ipc4_audio_format *fmt = &pin_fmt[i].audio_fmt; 197 197 dev_dbg(dev, 198 - "Pin index #%d: %uHz, %ubit (ch_map %#x ch_cfg %u interleaving_style %u fmt_cfg %#x) buffer size %d\n", 199 - pin_fmt[i].pin_index, fmt->sampling_frequency, fmt->bit_depth, fmt->ch_map, 200 - fmt->ch_cfg, fmt->interleaving_style, fmt->fmt_cfg, 198 + "Pin index #%d: %uHz, %ubit, %luch (ch_map %#x ch_cfg %u interleaving_style %u fmt_cfg %#x) buffer size %d\n", 199 + pin_fmt[i].pin_index, fmt->sampling_frequency, fmt->bit_depth, 200 + SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(fmt->fmt_cfg), 201 + fmt->ch_map, fmt->ch_cfg, fmt->interleaving_style, fmt->fmt_cfg, 201 202 pin_fmt[i].buffer_size); 202 203 } 203 204 } ··· 218 217 } 219 218 220 219 process = swidget->private; 220 + 221 + /* 222 + * For process modules without base config extension, base module config 223 + * format is used for all input pins 224 + */ 225 + if (process->init_config != SOF_IPC4_MODULE_INIT_CONFIG_TYPE_BASE_CFG_WITH_EXT) 226 + return &process->base_config.audio_fmt; 227 + 221 228 base_cfg_ext = process->base_config_ext; 222 229 223 230 /* ··· 1431 1422 1432 1423 static int 1433 1424 snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, 1434 - bool single_format, 1425 + bool single_bitdepth, 1435 1426 struct snd_pcm_hw_params *params, u32 dai_index, 1436 1427 u32 linktype, u8 dir, u32 **dst, u32 *len) 1437 1428 { ··· 1454 1445 * Look for 32-bit blob first instead of 16-bit if copier 1455 1446 * supports multiple formats 1456 1447 */ 1457 - if (bit_depth == 16 && !single_format) { 1448 + if (bit_depth == 16 && !single_bitdepth) { 1458 1449 dev_dbg(sdev->dev, "Looking for 32-bit blob first for DMIC\n"); 1459 1450 format_change = true; 1460 1451 bit_depth = 32; ··· 1492 1483 dir, dev_type); 1493 1484 1494 1485 if (!cfg) { 1486 + bool get_new_blob = false; 1487 + 1495 1488 if (format_change) { 1496 1489 /* 1497 1490 * The 32-bit blob was not found in NHLT table, try to ··· 1501 1490 */ 1502 1491 bit_depth = params_width(params); 1503 1492 format_change = false; 1493 + get_new_blob = true; 1494 + } else if (linktype == SOF_DAI_INTEL_DMIC && !single_bitdepth) { 1495 + /* 1496 + * The requested 32-bit blob (no format change for the 1497 + * blob request) was not found in NHLT table, try to 1498 + * look for 16-bit blob if the copier supports multiple 1499 + * formats 1500 + */ 1501 + bit_depth = 16; 1502 + format_change = true; 1503 + get_new_blob = true; 1504 + } 1504 1505 1506 + if (get_new_blob) { 1505 1507 cfg = intel_nhlt_get_endpoint_blob(sdev->dev, ipc4_data->nhlt, 1506 1508 dai_index, nhlt_type, 1507 1509 bit_depth, bit_depth, ··· 1537 1513 1538 1514 if (format_change) { 1539 1515 /* 1540 - * Update the params to reflect that we have loaded 32-bit blob 1541 - * instead of the 16-bit. 1516 + * Update the params to reflect that different blob was loaded 1517 + * instead of the requested bit depth (16 -> 32 or 32 -> 16). 1542 1518 * This information is going to be used by the caller to find 1543 1519 * matching copier format on the dai side. 1544 1520 */ ··· 1546 1522 1547 1523 m = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 1548 1524 snd_mask_none(m); 1549 - snd_mask_set_format(m, SNDRV_PCM_FORMAT_S32_LE); 1525 + if (bit_depth == 16) 1526 + snd_mask_set_format(m, SNDRV_PCM_FORMAT_S16_LE); 1527 + else 1528 + snd_mask_set_format(m, SNDRV_PCM_FORMAT_S32_LE); 1529 + 1550 1530 } 1551 1531 1552 1532 return 0; ··· 1558 1530 #else 1559 1531 static int 1560 1532 snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, 1561 - bool single_format, 1533 + bool single_bitdepth, 1562 1534 struct snd_pcm_hw_params *params, u32 dai_index, 1563 1535 u32 linktype, u8 dir, u32 **dst, u32 *len) 1564 1536 { ··· 1566 1538 } 1567 1539 #endif 1568 1540 1569 - bool sof_ipc4_copier_is_single_format(struct snd_sof_dev *sdev, 1570 - struct sof_ipc4_pin_format *pin_fmts, 1571 - u32 pin_fmts_size) 1541 + bool sof_ipc4_copier_is_single_bitdepth(struct snd_sof_dev *sdev, 1542 + struct sof_ipc4_pin_format *pin_fmts, 1543 + u32 pin_fmts_size) 1572 1544 { 1573 1545 struct sof_ipc4_audio_format *fmt; 1574 1546 u32 valid_bits; ··· 1592 1564 } 1593 1565 1594 1566 static int 1567 + sof_ipc4_adjust_params_to_dai_format(struct snd_sof_dev *sdev, 1568 + struct snd_pcm_hw_params *params, 1569 + struct sof_ipc4_pin_format *pin_fmts, 1570 + u32 pin_fmts_size) 1571 + { 1572 + u32 params_mask = BIT(SNDRV_PCM_HW_PARAM_RATE) | 1573 + BIT(SNDRV_PCM_HW_PARAM_CHANNELS) | 1574 + BIT(SNDRV_PCM_HW_PARAM_FORMAT); 1575 + struct sof_ipc4_audio_format *fmt; 1576 + u32 rate, channels, valid_bits; 1577 + int i; 1578 + 1579 + fmt = &pin_fmts[0].audio_fmt; 1580 + rate = fmt->sampling_frequency; 1581 + channels = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(fmt->fmt_cfg); 1582 + valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(fmt->fmt_cfg); 1583 + 1584 + /* check if parameters in topology defined formats are the same */ 1585 + for (i = 1; i < pin_fmts_size; i++) { 1586 + u32 val; 1587 + 1588 + fmt = &pin_fmts[i].audio_fmt; 1589 + 1590 + if (params_mask & BIT(SNDRV_PCM_HW_PARAM_RATE)) { 1591 + val = fmt->sampling_frequency; 1592 + if (val != rate) 1593 + params_mask &= ~BIT(SNDRV_PCM_HW_PARAM_RATE); 1594 + } 1595 + if (params_mask & BIT(SNDRV_PCM_HW_PARAM_CHANNELS)) { 1596 + val = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(fmt->fmt_cfg); 1597 + if (val != channels) 1598 + params_mask &= ~BIT(SNDRV_PCM_HW_PARAM_CHANNELS); 1599 + } 1600 + if (params_mask & BIT(SNDRV_PCM_HW_PARAM_FORMAT)) { 1601 + val = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(fmt->fmt_cfg); 1602 + if (val != valid_bits) 1603 + params_mask &= ~BIT(SNDRV_PCM_HW_PARAM_FORMAT); 1604 + } 1605 + } 1606 + 1607 + if (params_mask) 1608 + return sof_ipc4_update_hw_params(sdev, params, 1609 + &pin_fmts[0].audio_fmt, 1610 + params_mask); 1611 + 1612 + return 0; 1613 + } 1614 + 1615 + static int 1595 1616 sof_ipc4_prepare_dai_copier(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, 1596 1617 struct snd_pcm_hw_params *params, int dir) 1597 1618 { 1598 1619 struct sof_ipc4_available_audio_format *available_fmt; 1599 1620 struct snd_pcm_hw_params dai_params = *params; 1600 1621 struct sof_ipc4_copier_data *copier_data; 1622 + struct sof_ipc4_pin_format *pin_fmts; 1601 1623 struct sof_ipc4_copier *ipc4_copier; 1602 - bool single_format; 1624 + bool single_bitdepth; 1625 + u32 num_pin_fmts; 1603 1626 int ret; 1604 1627 1605 1628 ipc4_copier = dai->private; ··· 1658 1579 available_fmt = &ipc4_copier->available_fmt; 1659 1580 1660 1581 /* 1661 - * If the copier on the DAI side supports only single bit depth then 1662 - * this depth (format) should be used to look for the NHLT blob (if 1663 - * needed) and in case of capture this should be used for the input 1664 - * format lookup 1582 + * Fixup the params based on the format parameters of the DAI. If any 1583 + * of the RATE, CHANNELS, bit depth is static among the formats then 1584 + * narrow the params to only allow that specific parameter value. 1665 1585 */ 1666 1586 if (dir == SNDRV_PCM_STREAM_PLAYBACK) { 1667 - single_format = sof_ipc4_copier_is_single_format(sdev, 1668 - available_fmt->output_pin_fmts, 1669 - available_fmt->num_output_formats); 1670 - 1671 - /* Update the dai_params with the only supported format */ 1672 - if (single_format) { 1673 - ret = sof_ipc4_update_hw_params(sdev, &dai_params, 1674 - &available_fmt->output_pin_fmts[0].audio_fmt, 1675 - BIT(SNDRV_PCM_HW_PARAM_FORMAT)); 1676 - if (ret) 1677 - return ret; 1678 - } 1587 + pin_fmts = available_fmt->output_pin_fmts; 1588 + num_pin_fmts = available_fmt->num_output_formats; 1679 1589 } else { 1680 - single_format = sof_ipc4_copier_is_single_format(sdev, 1681 - available_fmt->input_pin_fmts, 1682 - available_fmt->num_input_formats); 1683 - 1684 - /* Update the dai_params with the only supported format */ 1685 - if (single_format) { 1686 - ret = sof_ipc4_update_hw_params(sdev, &dai_params, 1687 - &available_fmt->input_pin_fmts[0].audio_fmt, 1688 - BIT(SNDRV_PCM_HW_PARAM_FORMAT)); 1689 - if (ret) 1690 - return ret; 1691 - } 1590 + pin_fmts = available_fmt->input_pin_fmts; 1591 + num_pin_fmts = available_fmt->num_input_formats; 1692 1592 } 1693 1593 1694 - ret = snd_sof_get_nhlt_endpoint_data(sdev, dai, single_format, 1594 + ret = sof_ipc4_adjust_params_to_dai_format(sdev, &dai_params, pin_fmts, 1595 + num_pin_fmts); 1596 + if (ret) 1597 + return ret; 1598 + 1599 + single_bitdepth = sof_ipc4_copier_is_single_bitdepth(sdev, pin_fmts, 1600 + num_pin_fmts); 1601 + ret = snd_sof_get_nhlt_endpoint_data(sdev, dai, single_bitdepth, 1695 1602 &dai_params, 1696 1603 ipc4_copier->dai_index, 1697 1604 ipc4_copier->dai_type, dir, ··· 1712 1647 u32 out_ref_rate, out_ref_channels; 1713 1648 u32 deep_buffer_dma_ms = 0; 1714 1649 int output_fmt_index; 1715 - bool single_output_format; 1650 + bool single_output_bitdepth; 1716 1651 int i; 1717 1652 1718 1653 dev_dbg(sdev->dev, "copier %s, type %d", swidget->widget->name, swidget->id); ··· 1849 1784 return ret; 1850 1785 1851 1786 /* set the reference params for output format selection */ 1852 - single_output_format = sof_ipc4_copier_is_single_format(sdev, 1853 - available_fmt->output_pin_fmts, 1854 - available_fmt->num_output_formats); 1787 + single_output_bitdepth = sof_ipc4_copier_is_single_bitdepth(sdev, 1788 + available_fmt->output_pin_fmts, 1789 + available_fmt->num_output_formats); 1855 1790 switch (swidget->id) { 1856 1791 case snd_soc_dapm_aif_in: 1857 1792 case snd_soc_dapm_dai_out: ··· 1863 1798 out_ref_rate = in_fmt->sampling_frequency; 1864 1799 out_ref_channels = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(in_fmt->fmt_cfg); 1865 1800 1866 - if (!single_output_format) 1801 + if (!single_output_bitdepth) 1867 1802 out_ref_valid_bits = 1868 1803 SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(in_fmt->fmt_cfg); 1869 1804 break; ··· 1872 1807 case snd_soc_dapm_dai_in: 1873 1808 out_ref_rate = params_rate(fe_params); 1874 1809 out_ref_channels = params_channels(fe_params); 1875 - if (!single_output_format) { 1810 + if (!single_output_bitdepth) { 1876 1811 out_ref_valid_bits = sof_ipc4_get_valid_bits(sdev, fe_params); 1877 1812 if (out_ref_valid_bits < 0) 1878 1813 return out_ref_valid_bits; ··· 1890 1825 * if the output format is the same across all available output formats, choose 1891 1826 * that as the reference. 1892 1827 */ 1893 - if (single_output_format) { 1828 + if (single_output_bitdepth) { 1894 1829 struct sof_ipc4_audio_format *out_fmt; 1895 1830 1896 1831 out_fmt = &available_fmt->output_pin_fmts[0].audio_fmt;
+3 -3
sound/soc/sof/ipc4-topology.h
··· 476 476 u32 init_config; 477 477 }; 478 478 479 - bool sof_ipc4_copier_is_single_format(struct snd_sof_dev *sdev, 480 - struct sof_ipc4_pin_format *pin_fmts, 481 - u32 pin_fmts_size); 479 + bool sof_ipc4_copier_is_single_bitdepth(struct snd_sof_dev *sdev, 480 + struct sof_ipc4_pin_format *pin_fmts, 481 + u32 pin_fmts_size); 482 482 #endif
+2 -1
sound/soc/sof/mediatek/mt8186/mt8186.c
··· 666 666 }; 667 667 module_platform_driver(snd_sof_of_mt8186_driver); 668 668 669 + MODULE_LICENSE("Dual BSD/GPL"); 670 + MODULE_DESCRIPTION("SOF support for MT8186/MT8188 platforms"); 669 671 MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 670 672 MODULE_IMPORT_NS(SND_SOC_SOF_MTK_COMMON); 671 - MODULE_LICENSE("Dual BSD/GPL");
+2 -1
sound/soc/sof/mediatek/mt8195/mt8195.c
··· 619 619 }; 620 620 module_platform_driver(snd_sof_of_mt8195_driver); 621 621 622 + MODULE_LICENSE("Dual BSD/GPL"); 623 + MODULE_DESCRIPTION("SOF support for MTL 8195 platforms"); 622 624 MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 623 625 MODULE_IMPORT_NS(SND_SOC_SOF_MTK_COMMON); 624 - MODULE_LICENSE("Dual BSD/GPL");
+1
sound/soc/sof/mediatek/mtk-adsp-common.c
··· 82 82 EXPORT_SYMBOL(mtk_adsp_dump); 83 83 84 84 MODULE_LICENSE("Dual BSD/GPL"); 85 + MODULE_DESCRIPTION("SOF helpers for MTK ADSP platforms");
+1 -1
sound/soc/sof/nocodec.c
··· 110 110 }; 111 111 module_platform_driver(sof_nocodec_audio) 112 112 113 + MODULE_LICENSE("Dual BSD/GPL"); 113 114 MODULE_DESCRIPTION("ASoC sof nocodec"); 114 115 MODULE_AUTHOR("Liam Girdwood"); 115 - MODULE_LICENSE("Dual BSD/GPL"); 116 116 MODULE_ALIAS("platform:sof-nocodec");
+1
sound/soc/sof/sof-acpi-dev.c
··· 100 100 EXPORT_SYMBOL_NS(sof_acpi_remove, SND_SOC_SOF_ACPI_DEV); 101 101 102 102 MODULE_LICENSE("Dual BSD/GPL"); 103 + MODULE_DESCRIPTION("SOF support for ACPI platforms");
+1 -1
sound/soc/sof/sof-client-ipc-flood-test.c
··· 394 394 395 395 module_auxiliary_driver(sof_ipc_flood_client_drv); 396 396 397 - MODULE_DESCRIPTION("SOF IPC Flood Test Client Driver"); 398 397 MODULE_LICENSE("GPL"); 398 + MODULE_DESCRIPTION("SOF IPC Flood Test Client Driver"); 399 399 MODULE_IMPORT_NS(SND_SOC_SOF_CLIENT);
+1 -1
sound/soc/sof/sof-client-ipc-kernel-injector.c
··· 157 157 158 158 module_auxiliary_driver(sof_msg_inject_client_drv); 159 159 160 - MODULE_DESCRIPTION("SOF IPC Kernel Injector Client Driver"); 161 160 MODULE_LICENSE("GPL"); 161 + MODULE_DESCRIPTION("SOF IPC Kernel Injector Client Driver"); 162 162 MODULE_IMPORT_NS(SND_SOC_SOF_CLIENT);
+1 -1
sound/soc/sof/sof-client-ipc-msg-injector.c
··· 335 335 336 336 module_auxiliary_driver(sof_msg_inject_client_drv); 337 337 338 - MODULE_DESCRIPTION("SOF IPC Message Injector Client Driver"); 339 338 MODULE_LICENSE("GPL"); 339 + MODULE_DESCRIPTION("SOF IPC Message Injector Client Driver"); 340 340 MODULE_IMPORT_NS(SND_SOC_SOF_CLIENT);
+1 -1
sound/soc/sof/sof-client-probes.c
··· 540 540 541 541 module_auxiliary_driver(sof_probes_client_drv); 542 542 543 - MODULE_DESCRIPTION("SOF Probes Client Driver"); 544 543 MODULE_LICENSE("GPL v2"); 544 + MODULE_DESCRIPTION("SOF Probes Client Driver"); 545 545 MODULE_IMPORT_NS(SND_SOC_SOF_CLIENT);
+1
sound/soc/sof/sof-of-dev.c
··· 93 93 EXPORT_SYMBOL(sof_of_shutdown); 94 94 95 95 MODULE_LICENSE("Dual BSD/GPL"); 96 + MODULE_DESCRIPTION("SOF support for OF/DT platforms");
+1
sound/soc/sof/sof-pci-dev.c
··· 304 304 EXPORT_SYMBOL_NS(sof_pci_shutdown, SND_SOC_SOF_PCI_DEV); 305 305 306 306 MODULE_LICENSE("Dual BSD/GPL"); 307 + MODULE_DESCRIPTION("SOF support for PCI platforms");
+1
sound/soc/sof/sof-utils.c
··· 73 73 EXPORT_SYMBOL(snd_sof_create_page_table); 74 74 75 75 MODULE_LICENSE("Dual BSD/GPL"); 76 + MODULE_DESCRIPTION("SOF utils");
-2
sound/soc/sof/stream-ipc.c
··· 125 125 return 0; 126 126 } 127 127 EXPORT_SYMBOL(sof_stream_pcm_close); 128 - 129 - MODULE_LICENSE("Dual BSD/GPL");
+1 -1
sound/soc/sof/xtensa/core.c
··· 151 151 }; 152 152 EXPORT_SYMBOL_NS(sof_xtensa_arch_ops, SND_SOC_SOF_XTENSA); 153 153 154 - MODULE_DESCRIPTION("SOF Xtensa DSP support"); 155 154 MODULE_LICENSE("Dual BSD/GPL"); 155 + MODULE_DESCRIPTION("SOF Xtensa DSP support");
+2 -1
tools/lib/bpf/features.c
··· 393 393 err = -errno; /* close() can clobber errno */ 394 394 395 395 if (link_fd >= 0 || err != -EBADF) { 396 - close(link_fd); 396 + if (link_fd >= 0) 397 + close(link_fd); 397 398 close(prog_fd); 398 399 return 0; 399 400 }
+23 -3
tools/power/cpupower/utils/helpers/amd.c
··· 41 41 unsigned res1:31; 42 42 unsigned en:1; 43 43 } pstatedef; 44 + /* since fam 1Ah: */ 45 + struct { 46 + unsigned fid:12; 47 + unsigned res1:2; 48 + unsigned vid:8; 49 + unsigned iddval:8; 50 + unsigned idddiv:2; 51 + unsigned res2:31; 52 + unsigned en:1; 53 + } pstatedef2; 44 54 unsigned long long val; 45 55 }; 46 56 47 57 static int get_did(union core_pstate pstate) 48 58 { 49 59 int t; 60 + 61 + /* Fam 1Ah onward do not use did */ 62 + if (cpupower_cpu_info.family >= 0x1A) 63 + return 0; 50 64 51 65 if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATEDEF) 52 66 t = pstate.pstatedef.did; ··· 75 61 static int get_cof(union core_pstate pstate) 76 62 { 77 63 int t; 78 - int fid, did, cof; 64 + int fid, did, cof = 0; 79 65 80 66 did = get_did(pstate); 81 67 if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATEDEF) { 82 - fid = pstate.pstatedef.fid; 83 - cof = 200 * fid / did; 68 + if (cpupower_cpu_info.family >= 0x1A) { 69 + fid = pstate.pstatedef2.fid; 70 + if (fid > 0x0f) 71 + cof = (fid * 5); 72 + } else { 73 + fid = pstate.pstatedef.fid; 74 + cof = 200 * fid / did; 75 + } 84 76 } else { 85 77 t = 0x10; 86 78 fid = pstate.pstate.fid;
+1
tools/testing/cxl/test/mem.c
··· 3 3 4 4 #include <linux/platform_device.h> 5 5 #include <linux/mod_devicetable.h> 6 + #include <linux/vmalloc.h> 6 7 #include <linux/module.h> 7 8 #include <linux/delay.h> 8 9 #include <linux/sizes.h>
+1 -1
tools/testing/selftests/alsa/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # 3 3 4 - CFLAGS += $(shell pkg-config --cflags alsa) 4 + CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES) 5 5 LDLIBS += $(shell pkg-config --libs alsa) 6 6 ifeq ($(LDLIBS),) 7 7 LDLIBS += -lasound
+1 -1
tools/testing/selftests/bpf/progs/test_sk_storage_tracing.c
··· 84 84 } 85 85 86 86 SEC("fexit/inet_csk_accept") 87 - int BPF_PROG(inet_csk_accept, struct sock *sk, int flags, int *err, bool kern, 87 + int BPF_PROG(inet_csk_accept, struct sock *sk, struct proto_accept_arg *arg, 88 88 struct sock *accepted_sk) 89 89 { 90 90 set_task_info(accepted_sk);
+1
tools/testing/selftests/cachestat/test_cachestat.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #define _GNU_SOURCE 3 + #define __SANE_USERSPACE_TYPES__ // Use ll64 3 4 4 5 #include <stdio.h> 5 6 #include <stdbool.h>
+1
tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #define _GNU_SOURCE 3 + #define __SANE_USERSPACE_TYPES__ // Use ll64 3 4 4 5 #include <inttypes.h> 5 6 #include <unistd.h>
+19 -7
tools/testing/selftests/ftrace/config
··· 1 - CONFIG_KPROBES=y 1 + CONFIG_BPF_SYSCALL=y 2 + CONFIG_DEBUG_INFO_BTF=y 3 + CONFIG_DEBUG_INFO_DWARF4=y 4 + CONFIG_EPROBE_EVENTS=y 5 + CONFIG_FPROBE=y 6 + CONFIG_FPROBE_EVENTS=y 2 7 CONFIG_FTRACE=y 8 + CONFIG_FTRACE_SYSCALLS=y 9 + CONFIG_FUNCTION_GRAPH_RETVAL=y 3 10 CONFIG_FUNCTION_PROFILER=y 4 - CONFIG_TRACER_SNAPSHOT=y 5 - CONFIG_STACK_TRACER=y 6 11 CONFIG_HIST_TRIGGERS=y 7 - CONFIG_SCHED_TRACER=y 8 - CONFIG_PREEMPT_TRACER=y 9 12 CONFIG_IRQSOFF_TRACER=y 10 - CONFIG_PREEMPTIRQ_DELAY_TEST=m 13 + CONFIG_KALLSYMS_ALL=y 14 + CONFIG_KPROBES=y 15 + CONFIG_KPROBE_EVENTS=y 11 16 CONFIG_MODULES=y 12 17 CONFIG_MODULE_UNLOAD=y 18 + CONFIG_PREEMPTIRQ_DELAY_TEST=m 19 + CONFIG_PREEMPT_TRACER=y 20 + CONFIG_PROBE_EVENTS_BTF_ARGS=y 13 21 CONFIG_SAMPLES=y 14 22 CONFIG_SAMPLE_FTRACE_DIRECT=m 15 23 CONFIG_SAMPLE_TRACE_PRINTK=m 16 - CONFIG_KALLSYMS_ALL=y 24 + CONFIG_SCHED_TRACER=y 25 + CONFIG_STACK_TRACER=y 26 + CONFIG_TRACER_SNAPSHOT=y 27 + CONFIG_UPROBES=y 28 + CONFIG_UPROBE_EVENTS=y
+1 -1
tools/testing/selftests/ftrace/test.d/dynevent/test_duplicates.tc
··· 1 1 #!/bin/sh 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 # description: Generic dynamic event - check if duplicate events are caught 4 - # requires: dynamic_events "e[:[<group>/][<event>]] <attached-group>.<attached-event> [<args>]":README 4 + # requires: dynamic_events "e[:[<group>/][<event>]] <attached-group>.<attached-event> [<args>]":README events/syscalls/sys_enter_openat 5 5 6 6 echo 0 > events/enable 7 7
+19 -1
tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc
··· 10 10 } 11 11 12 12 sample_events() { 13 - echo > trace 14 13 echo 1 > events/kmem/kmem_cache_free/enable 15 14 echo 1 > tracing_on 16 15 ls > /dev/null ··· 21 22 echo 0 > events/enable 22 23 23 24 echo "Get the most frequently calling function" 25 + echo > trace 24 26 sample_events 25 27 26 28 target_func=`cat trace | grep -o 'call_site=\([^+]*\)' | sed 's/call_site=//' | sort | uniq -c | sort | tail -n 1 | sed 's/^[ 0-9]*//'` ··· 32 32 33 33 echo "Test event filter function name" 34 34 echo "call_site.function == $target_func" > events/kmem/kmem_cache_free/filter 35 + 35 36 sample_events 37 + max_retry=10 38 + while [ `grep kmem_cache_free trace| wc -l` -eq 0 ]; do 39 + sample_events 40 + max_retry=$((max_retry - 1)) 41 + if [ $max_retry -eq 0 ]; then 42 + exit_fail 43 + fi 44 + done 36 45 37 46 hitcnt=`grep kmem_cache_free trace| grep $target_func | wc -l` 38 47 misscnt=`grep kmem_cache_free trace| grep -v $target_func | wc -l` ··· 58 49 59 50 echo "Test event filter function address" 60 51 echo "call_site.function == 0x$address" > events/kmem/kmem_cache_free/filter 52 + echo > trace 61 53 sample_events 54 + max_retry=10 55 + while [ `grep kmem_cache_free trace| wc -l` -eq 0 ]; do 56 + sample_events 57 + max_retry=$((max_retry - 1)) 58 + if [ $max_retry -eq 0 ]; then 59 + exit_fail 60 + fi 61 + done 62 62 63 63 hitcnt=`grep kmem_cache_free trace| grep $target_func | wc -l` 64 64 misscnt=`grep kmem_cache_free trace| grep -v $target_func | wc -l`
+2 -1
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc
··· 30 30 fi 31 31 32 32 grep " [tT] .*\.isra\..*" /proc/kallsyms | cut -f 3 -d " " | while read f; do 33 - if grep -s $f available_filter_functions; then 33 + cnt=`grep -s $f available_filter_functions | wc -l`; 34 + if [ $cnt -eq 1 ]; then 34 35 echo $f 35 36 break 36 37 fi
-2
tools/testing/selftests/futex/Makefile
··· 3 3 4 4 TEST_PROGS := run.sh 5 5 6 - .PHONY: all clean 7 - 8 6 include ../lib.mk 9 7 10 8 all:
+1 -1
tools/testing/selftests/futex/functional/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 INCLUDES := -I../include -I../../ $(KHDR_INCLUDES) 3 - CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE -pthread $(INCLUDES) $(KHDR_INCLUDES) 3 + CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE= -pthread $(INCLUDES) $(KHDR_INCLUDES) 4 4 LDLIBS := -lpthread -lrt 5 5 6 6 LOCAL_HDRS := \
+1 -1
tools/testing/selftests/futex/functional/futex_requeue_pi.c
··· 360 360 361 361 int main(int argc, char *argv[]) 362 362 { 363 - const char *test_name; 363 + char *test_name; 364 364 int c, ret; 365 365 366 366 while ((c = getopt(argc, argv, "bchlot:v:")) != -1) {
+45
tools/testing/selftests/landlock/fs_test.c
··· 35 35 * See https://sourceware.org/glibc/wiki/Synchronizing_Headers. 36 36 */ 37 37 #include <linux/fs.h> 38 + #include <linux/mount.h> 38 39 39 40 #include "common.h" 40 41 ··· 45 44 { 46 45 return syscall(__NR_renameat2, olddirfd, oldpath, newdirfd, newpath, 47 46 flags); 47 + } 48 + #endif 49 + 50 + #ifndef open_tree 51 + int open_tree(int dfd, const char *filename, unsigned int flags) 52 + { 53 + return syscall(__NR_open_tree, dfd, filename, flags); 48 54 } 49 55 #endif 50 56 ··· 2406 2398 { 2407 2399 refer_denied_by_default(_metadata, layer_dir_s2d1_execute, EXDEV, 2408 2400 layer_dir_s1d1_refer); 2401 + } 2402 + 2403 + /* 2404 + * Tests walking through a denied root mount. 2405 + */ 2406 + TEST_F_FORK(layout1, refer_mount_root_deny) 2407 + { 2408 + const struct landlock_ruleset_attr ruleset_attr = { 2409 + .handled_access_fs = LANDLOCK_ACCESS_FS_MAKE_DIR, 2410 + }; 2411 + int root_fd, ruleset_fd; 2412 + 2413 + /* Creates a mount object from a non-mount point. */ 2414 + set_cap(_metadata, CAP_SYS_ADMIN); 2415 + root_fd = 2416 + open_tree(AT_FDCWD, dir_s1d1, 2417 + AT_EMPTY_PATH | OPEN_TREE_CLONE | OPEN_TREE_CLOEXEC); 2418 + clear_cap(_metadata, CAP_SYS_ADMIN); 2419 + ASSERT_LE(0, root_fd); 2420 + 2421 + ruleset_fd = 2422 + landlock_create_ruleset(&ruleset_attr, sizeof(ruleset_attr), 0); 2423 + ASSERT_LE(0, ruleset_fd); 2424 + 2425 + ASSERT_EQ(0, prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)); 2426 + ASSERT_EQ(0, landlock_restrict_self(ruleset_fd, 0)); 2427 + EXPECT_EQ(0, close(ruleset_fd)); 2428 + 2429 + /* Link denied by Landlock: EACCES. */ 2430 + EXPECT_EQ(-1, linkat(root_fd, ".", root_fd, "does_not_exist", 0)); 2431 + EXPECT_EQ(EACCES, errno); 2432 + 2433 + /* renameat2() always returns EBUSY. */ 2434 + EXPECT_EQ(-1, renameat2(root_fd, ".", root_fd, "does_not_exist", 0)); 2435 + EXPECT_EQ(EBUSY, errno); 2436 + 2437 + EXPECT_EQ(0, close(root_fd)); 2409 2438 } 2410 2439 2411 2440 TEST_F_FORK(layout1, reparent_link)
+1
tools/testing/selftests/net/hsr/config
··· 2 2 CONFIG_NET_SCH_NETEM=m 3 3 CONFIG_HSR=y 4 4 CONFIG_VETH=y 5 + CONFIG_BRIDGE=y
+9 -9
tools/testing/selftests/net/lib.sh
··· 15 15 ksft_skip=4 16 16 17 17 # namespace list created by setup_ns 18 - NS_LIST="" 18 + NS_LIST=() 19 19 20 20 ############################################################################## 21 21 # Helpers ··· 27 27 local -A weights 28 28 local weight=0 29 29 30 + local i 30 31 for i in "$@"; do 31 32 weights[$i]=$((weight++)) 32 33 done ··· 68 67 while true 69 68 do 70 69 local out 71 - out=$("$@") 72 - local ret=$? 73 - if ((!ret)); then 70 + if out=$("$@"); then 74 71 echo -n "$out" 75 72 return 0 76 73 fi ··· 138 139 fi 139 140 140 141 for ns in "$@"; do 142 + [ -z "${ns}" ] && continue 141 143 ip netns delete "${ns}" &> /dev/null 142 144 if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then 143 145 echo "Warn: Failed to remove namespace $ns" ··· 152 152 153 153 cleanup_all_ns() 154 154 { 155 - cleanup_ns $NS_LIST 155 + cleanup_ns "${NS_LIST[@]}" 156 156 } 157 157 158 158 # setup netns with given names as prefix. e.g ··· 161 161 { 162 162 local ns="" 163 163 local ns_name="" 164 - local ns_list="" 164 + local ns_list=() 165 165 local ns_exist= 166 166 for ns_name in "$@"; do 167 167 # Some test may setup/remove same netns multi times ··· 177 177 178 178 if ! ip netns add "$ns"; then 179 179 echo "Failed to create namespace $ns_name" 180 - cleanup_ns "$ns_list" 180 + cleanup_ns "${ns_list[@]}" 181 181 return $ksft_skip 182 182 fi 183 183 ip -n "$ns" link set lo up 184 - ! $ns_exist && ns_list="$ns_list $ns" 184 + ! $ns_exist && ns_list+=("$ns") 185 185 done 186 - NS_LIST="$NS_LIST $ns_list" 186 + NS_LIST+=("${ns_list[@]}") 187 187 } 188 188 189 189 tc_rule_stats_get()
+1
tools/testing/selftests/openat2/openat2_test.c
··· 5 5 */ 6 6 7 7 #define _GNU_SOURCE 8 + #define __SANE_USERSPACE_TYPES__ // Use ll64 8 9 #include <fcntl.h> 9 10 #include <sched.h> 10 11 #include <sys/stat.h>