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

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/hisilicon/hns3/hns3pf/hclge_main.c
35d92abfbad8 ("net: hns3: fix kernel crash when devlink reload during initialization")
2a1a1a7b5fd7 ("net: hns3: add command queue trace for hns3")

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

+2921 -1362
+3 -2
Documentation/admin-guide/kernel-parameters.txt
··· 4594 4594 norid [S390] ignore the RID field and force use of 4595 4595 one PCI domain per PCI function 4596 4596 4597 - pcie_aspm= [PCIE] Forcibly enable or disable PCIe Active State Power 4597 + pcie_aspm= [PCIE] Forcibly enable or ignore PCIe Active State Power 4598 4598 Management. 4599 - off Disable ASPM. 4599 + off Don't touch ASPM configuration at all. Leave any 4600 + configuration done by firmware unchanged. 4600 4601 force Enable ASPM even on devices that claim not to support it. 4601 4602 WARNING: Forcing ASPM on may cause system lockups. 4602 4603
+1 -1
Documentation/devicetree/bindings/iio/health/maxim,max30102.yaml
··· 42 42 properties: 43 43 compatible: 44 44 contains: 45 - const: maxim,max30100 45 + const: maxim,max30102 46 46 then: 47 47 properties: 48 48 maxim,green-led-current-microamp: false
+2 -20
Documentation/devicetree/bindings/net/mediatek,net.yaml
··· 337 337 minItems: 4 338 338 339 339 clocks: 340 - minItems: 34 341 - maxItems: 34 340 + minItems: 24 341 + maxItems: 24 342 342 343 343 clock-names: 344 344 items: ··· 351 351 - const: ethwarp_wocpu1 352 352 - const: ethwarp_wocpu0 353 353 - const: esw 354 - - const: netsys0 355 - - const: netsys1 356 - - const: sgmii_tx250m 357 - - const: sgmii_rx250m 358 - - const: sgmii2_tx250m 359 - - const: sgmii2_rx250m 360 - - const: top_usxgmii0_sel 361 - - const: top_usxgmii1_sel 362 - - const: top_sgm0_sel 363 - - const: top_sgm1_sel 364 - - const: top_xfi_phy0_xtal_sel 365 - - const: top_xfi_phy1_xtal_sel 366 354 - const: top_eth_gmii_sel 367 355 - const: top_eth_refck_50m_sel 368 356 - const: top_eth_sys_200m_sel ··· 363 375 - const: top_netsys_sync_250m_sel 364 376 - const: top_netsys_ppefb_250m_sel 365 377 - const: top_netsys_warp_sel 366 - - const: wocpu1 367 - - const: wocpu0 368 378 - const: xgp1 369 379 - const: xgp2 370 380 - const: xgp3 371 - 372 - mediatek,sgmiisys: 373 - minItems: 2 374 - maxItems: 2 375 381 376 382 patternProperties: 377 383 "^mac@[0-1]$":
+6
Documentation/devicetree/bindings/sound/rt5645.txt
··· 20 20 a GPIO spec for the external headphone detect pin. If jd-mode = 0, 21 21 we will get the JD status by getting the value of hp-detect-gpios. 22 22 23 + - cbj-sleeve-gpios: 24 + a GPIO spec to control the external combo jack circuit to tie the sleeve/ring2 25 + contacts to the ground or floating. It could avoid some electric noise from the 26 + active speaker jacks. 27 + 23 28 - realtek,in2-differential 24 29 Boolean. Indicate MIC2 input are differential, rather than single-ended. 25 30 ··· 73 68 compatible = "realtek,rt5650"; 74 69 reg = <0x1a>; 75 70 hp-detect-gpios = <&gpio 19 0>; 71 + cbj-sleeve-gpios = <&gpio 20 0>; 76 72 interrupt-parent = <&gpio>; 77 73 interrupts = <7 IRQ_TYPE_EDGE_FALLING>; 78 74 realtek,dmic-en = "true";
+6
Documentation/netlink/specs/rt_link.yaml
··· 1576 1576 - 1577 1577 name: mcast-querier-state 1578 1578 type: binary 1579 + - 1580 + name: fdb-n-learned 1581 + type: u32 1582 + - 1583 + name: fdb-max-learned 1584 + type: u32 1579 1585 - 1580 1586 name: linkinfo-brport-attrs 1581 1587 name-prefix: ifla-brport-
+3 -3
MAINTAINERS
··· 5717 5717 F: drivers/media/dvb-frontends/cxd2820r* 5718 5718 5719 5719 CXGB3 ETHERNET DRIVER (CXGB3) 5720 - M: Raju Rangoju <rajur@chelsio.com> 5720 + M: Potnuri Bharat Teja <bharat@chelsio.com> 5721 5721 L: netdev@vger.kernel.org 5722 5722 S: Supported 5723 5723 W: http://www.chelsio.com ··· 5738 5738 F: drivers/crypto/chelsio 5739 5739 5740 5740 CXGB4 ETHERNET DRIVER (CXGB4) 5741 - M: Raju Rangoju <rajur@chelsio.com> 5741 + M: Potnuri Bharat Teja <bharat@chelsio.com> 5742 5742 L: netdev@vger.kernel.org 5743 5743 S: Supported 5744 5744 W: http://www.chelsio.com ··· 5767 5767 F: include/uapi/rdma/cxgb4-abi.h 5768 5768 5769 5769 CXGB4VF ETHERNET DRIVER (CXGB4VF) 5770 - M: Raju Rangoju <rajur@chelsio.com> 5770 + M: Potnuri Bharat Teja <bharat@chelsio.com> 5771 5771 L: netdev@vger.kernel.org 5772 5772 S: Supported 5773 5773 W: http://www.chelsio.com
+1 -1
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 9 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc6 5 + EXTRAVERSION = -rc7 6 6 NAME = Hurr durr I'ma ninja sloth 7 7 8 8 # *DOCUMENTATION*
+4
arch/arm/kernel/sleep.S
··· 127 127 instr_sync 128 128 #endif 129 129 bl cpu_init @ restore the und/abt/irq banked regs 130 + #if defined(CONFIG_KASAN) && defined(CONFIG_KASAN_STACK) 131 + mov r0, sp 132 + bl kasan_unpoison_task_stack_below 133 + #endif 130 134 mov r0, #0 @ return zero on success 131 135 ldmfd sp!, {r4 - r11, pc} 132 136 ENDPROC(cpu_resume_after_mmu)
+2 -1
arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-pico6.dts
··· 82 82 }; 83 83 84 84 &mmc1 { 85 - bt_reset: bt-reset { 85 + bluetooth@2 { 86 + reg = <2>; 86 87 compatible = "mediatek,mt7921s-bluetooth"; 87 88 pinctrl-names = "default"; 88 89 pinctrl-0 = <&bt_pins_reset>;
+13 -17
arch/arm64/boot/dts/qcom/sa8155p-adp.dts
··· 367 367 }; 368 368 }; 369 369 370 + &pmm8155au_1_gpios { 371 + pmm8155au_1_sdc2_cd: sdc2-cd-default-state { 372 + pins = "gpio4"; 373 + function = "normal"; 374 + input-enable; 375 + bias-pull-up; 376 + power-source = <0>; 377 + }; 378 + }; 379 + 370 380 &qupv3_id_1 { 371 381 status = "okay"; 372 382 }; ··· 394 384 &sdhc_2 { 395 385 status = "okay"; 396 386 397 - cd-gpios = <&tlmm 4 GPIO_ACTIVE_LOW>; 387 + cd-gpios = <&pmm8155au_1_gpios 4 GPIO_ACTIVE_LOW>; 398 388 pinctrl-names = "default", "sleep"; 399 - pinctrl-0 = <&sdc2_on>; 400 - pinctrl-1 = <&sdc2_off>; 389 + pinctrl-0 = <&sdc2_on &pmm8155au_1_sdc2_cd>; 390 + pinctrl-1 = <&sdc2_off &pmm8155au_1_sdc2_cd>; 401 391 vqmmc-supply = <&vreg_l13c_2p96>; /* IO line power */ 402 392 vmmc-supply = <&vreg_l17a_2p96>; /* Card power line */ 403 393 bus-width = <4>; ··· 515 505 bias-pull-up; /* pull up */ 516 506 drive-strength = <16>; /* 16 MA */ 517 507 }; 518 - 519 - sd-cd-pins { 520 - pins = "gpio96"; 521 - function = "gpio"; 522 - bias-pull-up; /* pull up */ 523 - drive-strength = <2>; /* 2 MA */ 524 - }; 525 508 }; 526 509 527 510 sdc2_off: sdc2-off-state { ··· 532 529 533 530 data-pins { 534 531 pins = "sdc2_data"; 535 - bias-pull-up; /* pull up */ 536 - drive-strength = <2>; /* 2 MA */ 537 - }; 538 - 539 - sd-cd-pins { 540 - pins = "gpio96"; 541 - function = "gpio"; 542 532 bias-pull-up; /* pull up */ 543 533 drive-strength = <2>; /* 2 MA */ 544 534 };
+2 -3
arch/powerpc/include/asm/plpks.h
··· 44 44 #define PLPKS_MAX_DATA_SIZE 4000 45 45 46 46 // Timeouts for PLPKS operations 47 - #define PLPKS_MAX_TIMEOUT 5000 // msec 48 - #define PLPKS_FLUSH_SLEEP 10 // msec 49 - #define PLPKS_FLUSH_SLEEP_RANGE 400 47 + #define PLPKS_MAX_TIMEOUT (5 * USEC_PER_SEC) 48 + #define PLPKS_FLUSH_SLEEP 10000 // usec 50 49 51 50 struct plpks_var { 52 51 char *component;
+8
arch/powerpc/platforms/pseries/iommu.c
··· 786 786 * parent bus. During reboot, there will be ibm,dma-window property to 787 787 * define DMA window. For kdump, there will at least be default window or DDW 788 788 * or both. 789 + * There is an exception to the above. In case the PE goes into frozen 790 + * state, firmware may not provide ibm,dma-window property at the time 791 + * of LPAR boot up. 789 792 */ 793 + 794 + if (!pdn) { 795 + pr_debug(" no ibm,dma-window property !\n"); 796 + return; 797 + } 790 798 791 799 ppci = PCI_DN(pdn); 792 800
+5 -5
arch/powerpc/platforms/pseries/plpks.c
··· 415 415 break; 416 416 } 417 417 418 - usleep_range(PLPKS_FLUSH_SLEEP, 419 - PLPKS_FLUSH_SLEEP + PLPKS_FLUSH_SLEEP_RANGE); 418 + fsleep(PLPKS_FLUSH_SLEEP); 420 419 timeout = timeout + PLPKS_FLUSH_SLEEP; 421 420 } while (timeout < PLPKS_MAX_TIMEOUT); 422 421 ··· 463 464 464 465 continuetoken = retbuf[0]; 465 466 if (pseries_status_to_err(rc) == -EBUSY) { 466 - int delay_ms = get_longbusy_msecs(rc); 467 - mdelay(delay_ms); 468 - timeout += delay_ms; 467 + int delay_us = get_longbusy_msecs(rc) * 1000; 468 + 469 + fsleep(delay_us); 470 + timeout += delay_us; 469 471 } 470 472 rc = pseries_status_to_err(rc); 471 473 } while (rc == -EBUSY && timeout < PLPKS_MAX_TIMEOUT);
+13 -2
arch/s390/crypto/paes_s390.c
··· 125 125 static inline int __paes_keyblob2pkey(struct key_blob *kb, 126 126 struct pkey_protkey *pk) 127 127 { 128 - return pkey_keyblob2pkey(kb->key, kb->keylen, 129 - pk->protkey, &pk->len, &pk->type); 128 + int i, ret = -EIO; 129 + 130 + /* try three times in case of busy card */ 131 + for (i = 0; ret && i < 3; i++) { 132 + if (ret == -EBUSY && in_task()) { 133 + if (msleep_interruptible(1000)) 134 + return -EINTR; 135 + } 136 + ret = pkey_keyblob2pkey(kb->key, kb->keylen, 137 + pk->protkey, &pk->len, &pk->type); 138 + } 139 + 140 + return ret; 130 141 } 131 142 132 143 static inline int __paes_convert_key(struct s390_paes_ctx *ctx)
+1
arch/s390/include/asm/dwarf.h
··· 9 9 #define CFI_DEF_CFA_OFFSET .cfi_def_cfa_offset 10 10 #define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset 11 11 #define CFI_RESTORE .cfi_restore 12 + #define CFI_REL_OFFSET .cfi_rel_offset 12 13 13 14 #ifdef CONFIG_AS_CFI_VAL_OFFSET 14 15 #define CFI_VAL_OFFSET .cfi_val_offset
+2
arch/s390/kernel/vdso64/vdso_user_wrapper.S
··· 24 24 CFI_DEF_CFA_OFFSET (STACK_FRAME_OVERHEAD + WRAPPER_FRAME_SIZE) 25 25 CFI_VAL_OFFSET 15, -STACK_FRAME_OVERHEAD 26 26 stg %r14,STACK_FRAME_OVERHEAD(%r15) 27 + CFI_REL_OFFSET 14, STACK_FRAME_OVERHEAD 27 28 brasl %r14,__s390_vdso_\func 28 29 lg %r14,STACK_FRAME_OVERHEAD(%r15) 30 + CFI_RESTORE 14 29 31 aghi %r15,WRAPPER_FRAME_SIZE 30 32 CFI_DEF_CFA_OFFSET STACK_FRAME_OVERHEAD 31 33 CFI_RESTORE 15
+1 -1
arch/s390/mm/gmap.c
··· 2661 2661 return 0; 2662 2662 2663 2663 start = pmd_val(*pmd) & HPAGE_MASK; 2664 - end = start + HPAGE_SIZE - 1; 2664 + end = start + HPAGE_SIZE; 2665 2665 __storage_key_init_range(start, end); 2666 2666 set_bit(PG_arch_1, &page->flags); 2667 2667 cond_resched();
+1 -1
arch/s390/mm/hugetlbpage.c
··· 139 139 } 140 140 141 141 if (!test_and_set_bit(PG_arch_1, &page->flags)) 142 - __storage_key_init_range(paddr, paddr + size - 1); 142 + __storage_key_init_range(paddr, paddr + size); 143 143 } 144 144 145 145 void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
+2 -26
arch/x86/entry/vsyscall/vsyscall_64.c
··· 98 98 99 99 static bool write_ok_or_segv(unsigned long ptr, size_t size) 100 100 { 101 - /* 102 - * XXX: if access_ok, get_user, and put_user handled 103 - * sig_on_uaccess_err, this could go away. 104 - */ 105 - 106 101 if (!access_ok((void __user *)ptr, size)) { 107 102 struct thread_struct *thread = &current->thread; 108 103 ··· 115 120 bool emulate_vsyscall(unsigned long error_code, 116 121 struct pt_regs *regs, unsigned long address) 117 122 { 118 - struct task_struct *tsk; 119 123 unsigned long caller; 120 124 int vsyscall_nr, syscall_nr, tmp; 121 - int prev_sig_on_uaccess_err; 122 125 long ret; 123 126 unsigned long orig_dx; 124 127 ··· 164 171 "vsyscall with bad stack (exploit attempt?)"); 165 172 goto sigsegv; 166 173 } 167 - 168 - tsk = current; 169 174 170 175 /* 171 176 * Check for access_ok violations and find the syscall nr. ··· 225 234 goto do_ret; /* skip requested */ 226 235 227 236 /* 228 - * With a real vsyscall, page faults cause SIGSEGV. We want to 229 - * preserve that behavior to make writing exploits harder. 237 + * With a real vsyscall, page faults cause SIGSEGV. 230 238 */ 231 - prev_sig_on_uaccess_err = current->thread.sig_on_uaccess_err; 232 - current->thread.sig_on_uaccess_err = 1; 233 - 234 239 ret = -EFAULT; 235 240 switch (vsyscall_nr) { 236 241 case 0: ··· 249 262 break; 250 263 } 251 264 252 - current->thread.sig_on_uaccess_err = prev_sig_on_uaccess_err; 253 - 254 265 check_fault: 255 266 if (ret == -EFAULT) { 256 267 /* Bad news -- userspace fed a bad pointer to a vsyscall. */ 257 268 warn_bad_vsyscall(KERN_INFO, regs, 258 269 "vsyscall fault (exploit attempt?)"); 259 - 260 - /* 261 - * If we failed to generate a signal for any reason, 262 - * generate one here. (This should be impossible.) 263 - */ 264 - if (WARN_ON_ONCE(!sigismember(&tsk->pending.signal, SIGBUS) && 265 - !sigismember(&tsk->pending.signal, SIGSEGV))) 266 - goto sigsegv; 267 - 268 - return true; /* Don't emulate the ret. */ 270 + goto sigsegv; 269 271 } 270 272 271 273 regs->ax = ret;
+1
arch/x86/include/asm/e820/api.h
··· 17 17 extern void e820__range_add (u64 start, u64 size, enum e820_type type); 18 18 extern u64 e820__range_update(u64 start, u64 size, enum e820_type old_type, enum e820_type new_type); 19 19 extern u64 e820__range_remove(u64 start, u64 size, enum e820_type old_type, bool check_type); 20 + extern u64 e820__range_update_table(struct e820_table *t, u64 start, u64 size, enum e820_type old_type, enum e820_type new_type); 20 21 21 22 extern void e820__print_table(char *who); 22 23 extern int e820__update_table(struct e820_table *table);
-1
arch/x86/include/asm/processor.h
··· 472 472 unsigned long iopl_emul; 473 473 474 474 unsigned int iopl_warn:1; 475 - unsigned int sig_on_uaccess_err:1; 476 475 477 476 /* 478 477 * Protection Keys Register for Userspace. Loaded immediately on
+2
arch/x86/include/asm/sev.h
··· 269 269 int rmp_make_shared(u64 pfn, enum pg_level level); 270 270 void snp_leak_pages(u64 pfn, unsigned int npages); 271 271 void kdump_sev_callback(void); 272 + void snp_fixup_e820_tables(void); 272 273 #else 273 274 static inline bool snp_probe_rmptable_info(void) { return false; } 274 275 static inline int snp_lookup_rmpentry(u64 pfn, bool *assigned, int *level) { return -ENODEV; } ··· 283 282 static inline int rmp_make_shared(u64 pfn, enum pg_level level) { return -ENODEV; } 284 283 static inline void snp_leak_pages(u64 pfn, unsigned int npages) {} 285 284 static inline void kdump_sev_callback(void) { } 285 + static inline void snp_fixup_e820_tables(void) {} 286 286 #endif 287 287 288 288 #endif
+11 -5
arch/x86/kernel/apic/apic.c
··· 1771 1771 __x2apic_enable(); 1772 1772 } 1773 1773 1774 - static __init void apic_set_fixmap(void); 1774 + static __init void apic_set_fixmap(bool read_apic); 1775 1775 1776 1776 static __init void x2apic_disable(void) 1777 1777 { ··· 1793 1793 } 1794 1794 1795 1795 __x2apic_disable(); 1796 - apic_set_fixmap(); 1796 + /* 1797 + * Don't reread the APIC ID as it was already done from 1798 + * check_x2apic() and the APIC driver still is a x2APIC variant, 1799 + * which fails to do the read after x2APIC was disabled. 1800 + */ 1801 + apic_set_fixmap(false); 1797 1802 } 1798 1803 1799 1804 static __init void x2apic_enable(void) ··· 2062 2057 } 2063 2058 } 2064 2059 2065 - static __init void apic_set_fixmap(void) 2060 + static __init void apic_set_fixmap(bool read_apic) 2066 2061 { 2067 2062 set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); 2068 2063 apic_mmio_base = APIC_BASE; 2069 2064 apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n", 2070 2065 apic_mmio_base, mp_lapic_addr); 2071 - apic_read_boot_cpu_id(false); 2066 + if (read_apic) 2067 + apic_read_boot_cpu_id(false); 2072 2068 } 2073 2069 2074 2070 void __init register_lapic_address(unsigned long address) ··· 2079 2073 mp_lapic_addr = address; 2080 2074 2081 2075 if (!x2apic_mode) 2082 - apic_set_fixmap(); 2076 + apic_set_fixmap(true); 2083 2077 } 2084 2078 2085 2079 /*
+4 -3
arch/x86/kernel/e820.c
··· 532 532 return __e820__range_update(e820_table, start, size, old_type, new_type); 533 533 } 534 534 535 - static u64 __init e820__range_update_kexec(u64 start, u64 size, enum e820_type old_type, enum e820_type new_type) 535 + u64 __init e820__range_update_table(struct e820_table *t, u64 start, u64 size, 536 + enum e820_type old_type, enum e820_type new_type) 536 537 { 537 - return __e820__range_update(e820_table_kexec, start, size, old_type, new_type); 538 + return __e820__range_update(t, start, size, old_type, new_type); 538 539 } 539 540 540 541 /* Remove a range of memory from the E820 table: */ ··· 807 806 808 807 addr = memblock_phys_alloc(size, align); 809 808 if (addr) { 810 - e820__range_update_kexec(addr, size, E820_TYPE_RAM, E820_TYPE_RESERVED); 809 + e820__range_update_table(e820_table_kexec, addr, size, E820_TYPE_RAM, E820_TYPE_RESERVED); 811 810 pr_info("update e820_table_kexec for e820__memblock_alloc_reserved()\n"); 812 811 e820__update_table_kexec(); 813 812 }
+1 -32
arch/x86/mm/fault.c
··· 723 723 WARN_ON_ONCE(user_mode(regs)); 724 724 725 725 /* Are we prepared to handle this kernel fault? */ 726 - if (fixup_exception(regs, X86_TRAP_PF, error_code, address)) { 727 - /* 728 - * Any interrupt that takes a fault gets the fixup. This makes 729 - * the below recursive fault logic only apply to a faults from 730 - * task context. 731 - */ 732 - if (in_interrupt()) 733 - return; 734 - 735 - /* 736 - * Per the above we're !in_interrupt(), aka. task context. 737 - * 738 - * In this case we need to make sure we're not recursively 739 - * faulting through the emulate_vsyscall() logic. 740 - */ 741 - if (current->thread.sig_on_uaccess_err && signal) { 742 - sanitize_error_code(address, &error_code); 743 - 744 - set_signal_archinfo(address, error_code); 745 - 746 - if (si_code == SEGV_PKUERR) { 747 - force_sig_pkuerr((void __user *)address, pkey); 748 - } else { 749 - /* XXX: hwpoison faults will set the wrong code. */ 750 - force_sig_fault(signal, si_code, (void __user *)address); 751 - } 752 - } 753 - 754 - /* 755 - * Barring that, we can do the fixup and be happy. 756 - */ 726 + if (fixup_exception(regs, X86_TRAP_PF, error_code, address)) 757 727 return; 758 - } 759 728 760 729 /* 761 730 * AMD erratum #91 manifests as a spurious page fault on a PREFETCH
+7
arch/x86/mm/mem_encrypt.c
··· 102 102 phys_addr_t total_mem = memblock_phys_mem_size(); 103 103 unsigned long size; 104 104 105 + /* 106 + * Do RMP table fixups after the e820 tables have been setup by 107 + * e820__memory_setup(). 108 + */ 109 + if (cc_platform_has(CC_ATTR_HOST_SEV_SNP)) 110 + snp_fixup_e820_tables(); 111 + 105 112 if (!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) 106 113 return; 107 114
+36
arch/x86/virt/svm/sev.c
··· 163 163 return true; 164 164 } 165 165 166 + static void __init __snp_fixup_e820_tables(u64 pa) 167 + { 168 + if (IS_ALIGNED(pa, PMD_SIZE)) 169 + return; 170 + 171 + /* 172 + * Handle cases where the RMP table placement by the BIOS is not 173 + * 2M aligned and the kexec kernel could try to allocate 174 + * from within that chunk which then causes a fatal RMP fault. 175 + * 176 + * The e820_table needs to be updated as it is converted to 177 + * kernel memory resources and used by KEXEC_FILE_LOAD syscall 178 + * to load kexec segments. 179 + * 180 + * The e820_table_firmware needs to be updated as it is exposed 181 + * to sysfs and used by the KEXEC_LOAD syscall to load kexec 182 + * segments. 183 + * 184 + * The e820_table_kexec needs to be updated as it passed to 185 + * the kexec-ed kernel. 186 + */ 187 + pa = ALIGN_DOWN(pa, PMD_SIZE); 188 + if (e820__mapped_any(pa, pa + PMD_SIZE, E820_TYPE_RAM)) { 189 + pr_info("Reserving start/end of RMP table on a 2MB boundary [0x%016llx]\n", pa); 190 + e820__range_update(pa, PMD_SIZE, E820_TYPE_RAM, E820_TYPE_RESERVED); 191 + e820__range_update_table(e820_table_kexec, pa, PMD_SIZE, E820_TYPE_RAM, E820_TYPE_RESERVED); 192 + e820__range_update_table(e820_table_firmware, pa, PMD_SIZE, E820_TYPE_RAM, E820_TYPE_RESERVED); 193 + } 194 + } 195 + 196 + void __init snp_fixup_e820_tables(void) 197 + { 198 + __snp_fixup_e820_tables(probed_rmp_base); 199 + __snp_fixup_e820_tables(probed_rmp_base + probed_rmp_size); 200 + } 201 + 166 202 /* 167 203 * Do the necessary preparations which are verified by the firmware as 168 204 * described in the SNP_INIT_EX firmware command description in the SNP
+10 -1
arch/x86/xen/enlighten_pv.c
··· 219 219 static void xen_cpuid(unsigned int *ax, unsigned int *bx, 220 220 unsigned int *cx, unsigned int *dx) 221 221 { 222 - unsigned maskebx = ~0; 222 + unsigned int maskebx = ~0; 223 + unsigned int or_ebx = 0; 223 224 224 225 /* 225 226 * Mask out inconvenient features, to try and disable as many 226 227 * unsupported kernel subsystems as possible. 227 228 */ 228 229 switch (*ax) { 230 + case 0x1: 231 + /* Replace initial APIC ID in bits 24-31 of EBX. */ 232 + /* See xen_pv_smp_config() for related topology preparations. */ 233 + maskebx = 0x00ffffff; 234 + or_ebx = smp_processor_id() << 24; 235 + break; 236 + 229 237 case CPUID_MWAIT_LEAF: 230 238 /* Synthesize the values.. */ 231 239 *ax = 0; ··· 256 248 : "0" (*ax), "2" (*cx)); 257 249 258 250 *bx &= maskebx; 251 + *bx |= or_ebx; 259 252 } 260 253 261 254 static bool __init xen_check_mwait(void)
+2 -2
arch/x86/xen/smp_pv.c
··· 154 154 u32 apicid = 0; 155 155 int i; 156 156 157 - topology_register_boot_apic(apicid++); 157 + topology_register_boot_apic(apicid); 158 158 159 - for (i = 1; i < nr_cpu_ids; i++) 159 + for (i = 0; i < nr_cpu_ids; i++) 160 160 topology_register_apic(apicid++, CPU_ACPIID_INVALID, true); 161 161 162 162 /* Pretend to be a proper enumerated system */
+8 -16
arch/xtensa/include/asm/cacheflush.h
··· 100 100 void flush_icache_range(unsigned long start, unsigned long end); 101 101 void flush_cache_page(struct vm_area_struct*, 102 102 unsigned long, unsigned long); 103 + #define flush_cache_all flush_cache_all 104 + #define flush_cache_range flush_cache_range 105 + #define flush_icache_range flush_icache_range 106 + #define flush_cache_page flush_cache_page 103 107 #else 104 108 #define flush_cache_all local_flush_cache_all 105 109 #define flush_cache_range local_flush_cache_range ··· 140 136 141 137 #else 142 138 143 - #define flush_cache_all() do { } while (0) 144 - #define flush_cache_mm(mm) do { } while (0) 145 - #define flush_cache_dup_mm(mm) do { } while (0) 146 - 147 - #define flush_cache_vmap(start,end) do { } while (0) 148 - #define flush_cache_vmap_early(start,end) do { } while (0) 149 - #define flush_cache_vunmap(start,end) do { } while (0) 150 - 151 - #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 152 - #define flush_dcache_page(page) do { } while (0) 153 - 154 139 #define flush_icache_range local_flush_icache_range 155 - #define flush_cache_page(vma, addr, pfn) do { } while (0) 156 - #define flush_cache_range(vma, start, end) do { } while (0) 157 140 158 141 #endif 159 142 ··· 153 162 __invalidate_icache_range(start,(end) - (start)); \ 154 163 } while (0) 155 164 156 - #define flush_dcache_mmap_lock(mapping) do { } while (0) 157 - #define flush_dcache_mmap_unlock(mapping) do { } while (0) 158 - 159 165 #if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE) 160 166 161 167 extern void copy_to_user_page(struct vm_area_struct*, struct page*, 162 168 unsigned long, void*, const void*, unsigned long); 163 169 extern void copy_from_user_page(struct vm_area_struct*, struct page*, 164 170 unsigned long, void*, const void*, unsigned long); 171 + #define copy_to_user_page copy_to_user_page 172 + #define copy_from_user_page copy_from_user_page 165 173 166 174 #else 167 175 ··· 175 185 memcpy(dst, src, len) 176 186 177 187 #endif 188 + 189 + #include <asm-generic/cacheflush.h> 178 190 179 191 #endif /* _XTENSA_CACHEFLUSH_H */
+4 -4
arch/xtensa/include/asm/processor.h
··· 115 115 #define MAKE_RA_FOR_CALL(ra,ws) (((ra) & 0x3fffffff) | (ws) << 30) 116 116 117 117 /* Convert return address to a valid pc 118 - * Note: We assume that the stack pointer is in the same 1GB ranges as the ra 118 + * Note: 'text' is the address within the same 1GB range as the ra 119 119 */ 120 - #define MAKE_PC_FROM_RA(ra,sp) (((ra) & 0x3fffffff) | ((sp) & 0xc0000000)) 120 + #define MAKE_PC_FROM_RA(ra, text) (((ra) & 0x3fffffff) | ((unsigned long)(text) & 0xc0000000)) 121 121 122 122 #elif defined(__XTENSA_CALL0_ABI__) 123 123 ··· 127 127 #define MAKE_RA_FOR_CALL(ra, ws) (ra) 128 128 129 129 /* Convert return address to a valid pc 130 - * Note: We assume that the stack pointer is in the same 1GB ranges as the ra 130 + * Note: 'text' is not used as 'ra' is always the full address 131 131 */ 132 - #define MAKE_PC_FROM_RA(ra, sp) (ra) 132 + #define MAKE_PC_FROM_RA(ra, text) (ra) 133 133 134 134 #else 135 135 #error Unsupported Xtensa ABI
+1 -1
arch/xtensa/include/asm/ptrace.h
··· 87 87 # define user_mode(regs) (((regs)->ps & 0x00000020)!=0) 88 88 # define instruction_pointer(regs) ((regs)->pc) 89 89 # define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \ 90 - (regs)->areg[1])) 90 + (regs)->pc)) 91 91 92 92 # ifndef CONFIG_SMP 93 93 # define profile_pc(regs) instruction_pointer(regs)
+3 -2
arch/xtensa/kernel/process.c
··· 47 47 #include <asm/asm-offsets.h> 48 48 #include <asm/regs.h> 49 49 #include <asm/hw_breakpoint.h> 50 + #include <asm/sections.h> 50 51 #include <asm/traps.h> 51 52 52 53 extern void ret_from_fork(void); ··· 381 380 int count = 0; 382 381 383 382 sp = p->thread.sp; 384 - pc = MAKE_PC_FROM_RA(p->thread.ra, p->thread.sp); 383 + pc = MAKE_PC_FROM_RA(p->thread.ra, _text); 385 384 386 385 do { 387 386 if (sp < stack_page + sizeof(struct task_struct) || ··· 393 392 394 393 /* Stack layout: sp-4: ra, sp-3: sp' */ 395 394 396 - pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), sp); 395 + pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), _text); 397 396 sp = SPILL_SLOT(sp, 1); 398 397 } while (count++ < 16); 399 398 return 0;
+2 -1
arch/xtensa/kernel/stacktrace.c
··· 13 13 #include <linux/stacktrace.h> 14 14 15 15 #include <asm/ftrace.h> 16 + #include <asm/sections.h> 16 17 #include <asm/stacktrace.h> 17 18 #include <asm/traps.h> 18 19 #include <linux/uaccess.h> ··· 190 189 if (a1 <= (unsigned long)sp) 191 190 break; 192 191 193 - frame.pc = MAKE_PC_FROM_RA(a0, a1); 192 + frame.pc = MAKE_PC_FROM_RA(a0, _text); 194 193 frame.sp = a1; 195 194 196 195 if (fn(&frame, data))
+2 -4
arch/xtensa/platforms/iss/console.c
··· 166 166 167 167 static void iss_console_write(struct console *co, const char *s, unsigned count) 168 168 { 169 - if (s && *s != 0) { 170 - int len = strlen(s); 171 - simc_write(1, s, count < len ? count : len); 172 - } 169 + if (s && *s != 0) 170 + simc_write(1, s, min(count, strlen(s))); 173 171 } 174 172 175 173 static struct tty_driver* iss_console_device(struct console *c, int *index)
+179 -167
drivers/auxdisplay/Kconfig
··· 16 16 17 17 if AUXDISPLAY 18 18 19 + # 20 + # Character LCD section 21 + # 19 22 config CHARLCD 20 23 tristate "Character LCD core support" if COMPILE_TEST 21 24 help ··· 27 24 and if it needs the charlcd core, it will select it automatically. 28 25 This is some character LCD core interface that multiple drivers can 29 26 use. 30 - 31 - config LINEDISP 32 - tristate "Character line display core support" if COMPILE_TEST 33 - help 34 - This is the core support for single-line character displays, to be 35 - selected by drivers that use it. 36 27 37 28 config HD44780_COMMON 38 29 tristate "Common functions for HD44780 (and compatibles) LCD displays" if COMPILE_TEST ··· 49 52 kernel and started at boot. 50 53 If you don't understand what all this is about, say N. 51 54 52 - config KS0108 53 - tristate "KS0108 LCD Controller" 54 - depends on PARPORT_PC 55 - default n 56 - help 57 - If you have a LCD controlled by one or more KS0108 58 - controllers, say Y. You will need also another more specific 59 - driver for your LCD. 60 - 61 - Depends on Parallel Port support. If you say Y at 62 - parport, you will be able to compile this as a module (M) 63 - and built-in as well (Y). 64 - 65 - To compile this as a module, choose M here: 66 - the module will be called ks0108. 67 - 68 - If unsure, say N. 69 - 70 - config KS0108_PORT 71 - hex "Parallel port where the LCD is connected" 72 - depends on KS0108 73 - default 0x378 74 - help 75 - The address of the parallel port where the LCD is connected. 76 - 77 - The first standard parallel port address is 0x378. 78 - The second standard parallel port address is 0x278. 79 - The third standard parallel port address is 0x3BC. 80 - 81 - You can specify a different address if you need. 82 - 83 - If you don't know what I'm talking about, load the parport module, 84 - and execute "dmesg" or "cat /proc/ioports". You can see there how 85 - many parallel ports are present and which address each one has. 86 - 87 - Usually you only need to use 0x378. 88 - 89 - If you compile this as a module, you can still override this 90 - using the module parameters. 91 - 92 - config KS0108_DELAY 93 - int "Delay between each control writing (microseconds)" 94 - depends on KS0108 95 - default "2" 96 - help 97 - Amount of time the ks0108 should wait between each control write 98 - to the parallel port. 99 - 100 - If your LCD seems to miss random writings, increment this. 101 - 102 - If you don't know what I'm talking about, ignore it. 103 - 104 - If you compile this as a module, you can still override this 105 - value using the module parameters. 106 - 107 - config CFAG12864B 108 - tristate "CFAG12864B LCD" 109 - depends on X86 110 - depends on FB 111 - depends on KS0108 112 - select FB_SYSMEM_HELPERS 113 - default n 114 - help 115 - If you have a Crystalfontz 128x64 2-color LCD, cfag12864b Series, 116 - say Y. You also need the ks0108 LCD Controller driver. 117 - 118 - For help about how to wire your LCD to the parallel port, 119 - check Documentation/admin-guide/auxdisplay/cfag12864b.rst 120 - 121 - Depends on the x86 arch and the framebuffer support. 122 - 123 - The LCD framebuffer driver can be attached to a console. 124 - It will work fine. However, you can't attach it to the fbdev driver 125 - of the xorg server. 126 - 127 - To compile this as a module, choose M here: 128 - the modules will be called cfag12864b and cfag12864bfb. 129 - 130 - If unsure, say N. 131 - 132 - config CFAG12864B_RATE 133 - int "Refresh rate (hertz)" 134 - depends on CFAG12864B 135 - default "20" 136 - help 137 - Refresh rate of the LCD. 138 - 139 - As the LCD is not memory mapped, the driver has to make the work by 140 - software. This means you should be careful setting this value higher. 141 - If your CPUs are really slow or you feel the system is slowed down, 142 - decrease the value. 143 - 144 - Be careful modifying this value to a very high value: 145 - You can freeze the computer, or the LCD maybe can't draw as fast as you 146 - are requesting. 147 - 148 - If you don't know what I'm talking about, ignore it. 149 - 150 - If you compile this as a module, you can still override this 151 - value using the module parameters. 152 - 153 - config IMG_ASCII_LCD 154 - tristate "Imagination Technologies ASCII LCD Display" 155 - depends on HAS_IOMEM 156 - default y if MIPS_MALTA 157 - select MFD_SYSCON 158 - select LINEDISP 159 - help 160 - Enable this to support the simple ASCII LCD displays found on 161 - development boards such as the MIPS Boston, MIPS Malta & MIPS SEAD3 162 - from Imagination Technologies. 163 - 164 - config HT16K33 165 - tristate "Holtek Ht16K33 LED controller with keyscan" 166 - depends on FB && I2C && INPUT 167 - select FB_SYSMEM_HELPERS 168 - select INPUT_MATRIXKMAP 169 - select FB_BACKLIGHT 170 - select NEW_LEDS 171 - select LEDS_CLASS 172 - select LINEDISP 173 - help 174 - Say yes here to add support for Holtek HT16K33, RAM mapping 16*8 175 - LED controller driver with keyscan. 176 - 177 - config MAX6959 178 - tristate "Maxim MAX6958/6959 7-segment LED controller" 179 - depends on I2C 180 - select REGMAP_I2C 181 - select LINEDISP 182 - help 183 - If you say yes here you get support for the following Maxim chips 184 - (I2C 7-segment LED display controller): 185 - - MAX6958 186 - - MAX6959 (input support) 187 - 188 - This driver can also be built as a module. If so, the module 189 - will be called max6959. 190 - 191 55 config LCD2S 192 56 tristate "lcd2s 20x4 character display over I2C console" 193 57 depends on I2C ··· 58 200 from Modtronix engineering as a console output device. The display 59 201 is a simple single color character display. You have to connect it 60 202 to an I2C bus. 61 - 62 - config ARM_CHARLCD 63 - bool "ARM Ltd. Character LCD Driver" 64 - depends on PLAT_VERSATILE 65 - help 66 - This is a driver for the character LCD found on the ARM Ltd. 67 - Versatile and RealView Platform Baseboards. It doesn't do 68 - very much more than display the text "ARM Linux" on the first 69 - line and the Linux version on the second line, but that's 70 - still useful. 71 - 72 - config SEG_LED_GPIO 73 - tristate "Generic 7-segment LED display" 74 - depends on GPIOLIB || COMPILE_TEST 75 - select LINEDISP 76 - help 77 - This driver supports a generic 7-segment LED display made up 78 - of GPIO pins connected to the individual segments. 79 - 80 - This driver can also be built as a module. If so, the module 81 - will be called seg-led-gpio. 82 203 83 204 menuconfig PARPORT_PANEL 84 205 tristate "Parallel port LCD/Keypad Panel support" ··· 317 480 config PANEL_CHANGE_MESSAGE 318 481 bool "Change LCD initialization message ?" 319 482 depends on CHARLCD 320 - default "n" 321 483 help 322 484 This allows you to replace the boot message indicating the kernel version 323 485 and the driver version with a custom message. This is useful on appliances ··· 365 529 366 530 endchoice 367 531 532 + # 533 + # Samsung KS0108 LCD controller section 534 + # 535 + config KS0108 536 + tristate "KS0108 LCD Controller" 537 + depends on PARPORT_PC 538 + help 539 + If you have a LCD controlled by one or more KS0108 540 + controllers, say Y. You will need also another more specific 541 + driver for your LCD. 542 + 543 + Depends on Parallel Port support. If you say Y at 544 + parport, you will be able to compile this as a module (M) 545 + and built-in as well (Y). 546 + 547 + To compile this as a module, choose M here: 548 + the module will be called ks0108. 549 + 550 + If unsure, say N. 551 + 552 + config KS0108_PORT 553 + hex "Parallel port where the LCD is connected" 554 + depends on KS0108 555 + default 0x378 556 + help 557 + The address of the parallel port where the LCD is connected. 558 + 559 + The first standard parallel port address is 0x378. 560 + The second standard parallel port address is 0x278. 561 + The third standard parallel port address is 0x3BC. 562 + 563 + You can specify a different address if you need. 564 + 565 + If you don't know what I'm talking about, load the parport module, 566 + and execute "dmesg" or "cat /proc/ioports". You can see there how 567 + many parallel ports are present and which address each one has. 568 + 569 + Usually you only need to use 0x378. 570 + 571 + If you compile this as a module, you can still override this 572 + using the module parameters. 573 + 574 + config KS0108_DELAY 575 + int "Delay between each control writing (microseconds)" 576 + depends on KS0108 577 + default "2" 578 + help 579 + Amount of time the ks0108 should wait between each control write 580 + to the parallel port. 581 + 582 + If your LCD seems to miss random writings, increment this. 583 + 584 + If you don't know what I'm talking about, ignore it. 585 + 586 + If you compile this as a module, you can still override this 587 + value using the module parameters. 588 + 589 + config CFAG12864B 590 + tristate "CFAG12864B LCD" 591 + depends on X86 592 + depends on FB 593 + depends on KS0108 594 + select FB_SYSMEM_HELPERS 595 + help 596 + If you have a Crystalfontz 128x64 2-color LCD, cfag12864b Series, 597 + say Y. You also need the ks0108 LCD Controller driver. 598 + 599 + For help about how to wire your LCD to the parallel port, 600 + check Documentation/admin-guide/auxdisplay/cfag12864b.rst 601 + 602 + Depends on the x86 arch and the framebuffer support. 603 + 604 + The LCD framebuffer driver can be attached to a console. 605 + It will work fine. However, you can't attach it to the fbdev driver 606 + of the xorg server. 607 + 608 + To compile this as a module, choose M here: 609 + the modules will be called cfag12864b and cfag12864bfb. 610 + 611 + If unsure, say N. 612 + 613 + config CFAG12864B_RATE 614 + int "Refresh rate (hertz)" 615 + depends on CFAG12864B 616 + default "20" 617 + help 618 + Refresh rate of the LCD. 619 + 620 + As the LCD is not memory mapped, the driver has to make the work by 621 + software. This means you should be careful setting this value higher. 622 + If your CPUs are really slow or you feel the system is slowed down, 623 + decrease the value. 624 + 625 + Be careful modifying this value to a very high value: 626 + You can freeze the computer, or the LCD maybe can't draw as fast as you 627 + are requesting. 628 + 629 + If you don't know what I'm talking about, ignore it. 630 + 631 + If you compile this as a module, you can still override this 632 + value using the module parameters. 633 + 634 + # 635 + # Single character line display section 636 + # 637 + config LINEDISP 638 + tristate "Character line display core support" if COMPILE_TEST 639 + help 640 + This is the core support for single-line character displays, to be 641 + selected by drivers that use it. 642 + 643 + config IMG_ASCII_LCD 644 + tristate "Imagination Technologies ASCII LCD Display" 645 + depends on HAS_IOMEM 646 + default y if MIPS_MALTA 647 + select MFD_SYSCON 648 + select LINEDISP 649 + help 650 + Enable this to support the simple ASCII LCD displays found on 651 + development boards such as the MIPS Boston, MIPS Malta & MIPS SEAD3 652 + from Imagination Technologies. 653 + 654 + config HT16K33 655 + tristate "Holtek Ht16K33 LED controller with keyscan" 656 + depends on FB && I2C && INPUT 657 + select FB_SYSMEM_HELPERS 658 + select INPUT_MATRIXKMAP 659 + select FB_BACKLIGHT 660 + select NEW_LEDS 661 + select LEDS_CLASS 662 + select LINEDISP 663 + help 664 + Say yes here to add support for Holtek HT16K33, RAM mapping 16*8 665 + LED controller driver with keyscan. 666 + 667 + config MAX6959 668 + tristate "Maxim MAX6958/6959 7-segment LED controller" 669 + depends on I2C 670 + select REGMAP_I2C 671 + select LINEDISP 672 + help 673 + If you say yes here you get support for the following Maxim chips 674 + (I2C 7-segment LED display controller): 675 + - MAX6958 676 + - MAX6959 (input support) 677 + 678 + This driver can also be built as a module. If so, the module 679 + will be called max6959. 680 + 681 + config SEG_LED_GPIO 682 + tristate "Generic 7-segment LED display" 683 + depends on GPIOLIB || COMPILE_TEST 684 + select LINEDISP 685 + help 686 + This driver supports a generic 7-segment LED display made up 687 + of GPIO pins connected to the individual segments. 688 + 689 + This driver can also be built as a module. If so, the module 690 + will be called seg-led-gpio. 691 + 692 + # 693 + # Character LCD with non-conforming interface section 694 + # 695 + config ARM_CHARLCD 696 + bool "ARM Ltd. Character LCD Driver" 697 + depends on PLAT_VERSATILE 698 + help 699 + This is a driver for the character LCD found on the ARM Ltd. 700 + Versatile and RealView Platform Baseboards. It doesn't do 701 + very much more than display the text "ARM Linux" on the first 702 + line and the Linux version on the second line, but that's 703 + still useful. 704 + 368 705 endif # AUXDISPLAY 369 706 707 + # 708 + # Deprecated options 709 + # 370 710 config PANEL 371 711 tristate "Parallel port LCD/Keypad Panel support (OLD OPTION)" 372 712 depends on PARPORT
+5 -5
drivers/auxdisplay/Makefile
··· 3 3 # Makefile for the kernel auxiliary displays device drivers. 4 4 # 5 5 6 + obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o 7 + obj-$(CONFIG_CFAG12864B) += cfag12864b.o cfag12864bfb.o 6 8 obj-$(CONFIG_CHARLCD) += charlcd.o 7 9 obj-$(CONFIG_HD44780_COMMON) += hd44780_common.o 8 - obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o 9 - obj-$(CONFIG_KS0108) += ks0108.o 10 - obj-$(CONFIG_CFAG12864B) += cfag12864b.o cfag12864bfb.o 11 - obj-$(CONFIG_IMG_ASCII_LCD) += img-ascii-lcd.o 12 10 obj-$(CONFIG_HD44780) += hd44780.o 13 11 obj-$(CONFIG_HT16K33) += ht16k33.o 14 - obj-$(CONFIG_PARPORT_PANEL) += panel.o 12 + obj-$(CONFIG_IMG_ASCII_LCD) += img-ascii-lcd.o 13 + obj-$(CONFIG_KS0108) += ks0108.o 15 14 obj-$(CONFIG_LCD2S) += lcd2s.o 16 15 obj-$(CONFIG_LINEDISP) += line-display.o 17 16 obj-$(CONFIG_MAX6959) += max6959.o 17 + obj-$(CONFIG_PARPORT_PANEL) += panel.o 18 18 obj-$(CONFIG_SEG_LED_GPIO) += seg-led-gpio.o
+3
drivers/auxdisplay/charlcd.c
··· 17 17 #include <linux/uaccess.h> 18 18 #include <linux/workqueue.h> 19 19 20 + #ifndef CONFIG_PANEL_BOOT_MESSAGE 20 21 #include <generated/utsrelease.h> 22 + #endif 21 23 22 24 #include "charlcd.h" 23 25 ··· 680 678 } 681 679 EXPORT_SYMBOL_GPL(charlcd_unregister); 682 680 681 + MODULE_DESCRIPTION("Character LCD core support"); 683 682 MODULE_LICENSE("GPL");
+2 -4
drivers/auxdisplay/seg-led-gpio.c
··· 81 81 return linedisp_register(&priv->linedisp, dev, 1, &seg_led_linedisp_ops); 82 82 } 83 83 84 - static int seg_led_remove(struct platform_device *pdev) 84 + static void seg_led_remove(struct platform_device *pdev) 85 85 { 86 86 struct seg_led_priv *priv = platform_get_drvdata(pdev); 87 87 88 88 cancel_delayed_work_sync(&priv->work); 89 89 linedisp_unregister(&priv->linedisp); 90 - 91 - return 0; 92 90 } 93 91 94 92 static const struct of_device_id seg_led_of_match[] = { ··· 97 99 98 100 static struct platform_driver seg_led_driver = { 99 101 .probe = seg_led_probe, 100 - .remove = seg_led_remove, 102 + .remove_new = seg_led_remove, 101 103 .driver = { 102 104 .name = "seg-led-gpio", 103 105 .of_match_table = seg_led_of_match,
+37
drivers/base/regmap/regmap.c
··· 2839 2839 EXPORT_SYMBOL_GPL(regmap_read); 2840 2840 2841 2841 /** 2842 + * regmap_read_bypassed() - Read a value from a single register direct 2843 + * from the device, bypassing the cache 2844 + * 2845 + * @map: Register map to read from 2846 + * @reg: Register to be read from 2847 + * @val: Pointer to store read value 2848 + * 2849 + * A value of zero will be returned on success, a negative errno will 2850 + * be returned in error cases. 2851 + */ 2852 + int regmap_read_bypassed(struct regmap *map, unsigned int reg, unsigned int *val) 2853 + { 2854 + int ret; 2855 + bool bypass, cache_only; 2856 + 2857 + if (!IS_ALIGNED(reg, map->reg_stride)) 2858 + return -EINVAL; 2859 + 2860 + map->lock(map->lock_arg); 2861 + 2862 + bypass = map->cache_bypass; 2863 + cache_only = map->cache_only; 2864 + map->cache_bypass = true; 2865 + map->cache_only = false; 2866 + 2867 + ret = _regmap_read(map, reg, val); 2868 + 2869 + map->cache_bypass = bypass; 2870 + map->cache_only = cache_only; 2871 + 2872 + map->unlock(map->lock_arg); 2873 + 2874 + return ret; 2875 + } 2876 + EXPORT_SYMBOL_GPL(regmap_read_bypassed); 2877 + 2878 + /** 2842 2879 * regmap_raw_read() - Read raw data from the device 2843 2880 * 2844 2881 * @map: Register map to read from
+2 -1
drivers/block/ublk_drv.c
··· 2177 2177 .max_hw_sectors = p->max_sectors, 2178 2178 .chunk_sectors = p->chunk_sectors, 2179 2179 .virt_boundary_mask = p->virt_boundary_mask, 2180 - 2180 + .max_segments = USHRT_MAX, 2181 + .max_segment_size = UINT_MAX, 2181 2182 }; 2182 2183 struct gendisk *disk; 2183 2184 int ret = -EINVAL;
+93 -19
drivers/bluetooth/btqca.c
··· 15 15 16 16 #define VERSION "0.1" 17 17 18 - #define QCA_BDADDR_DEFAULT (&(bdaddr_t) {{ 0xad, 0x5a, 0x00, 0x00, 0x00, 0x00 }}) 19 - 20 18 int qca_read_soc_version(struct hci_dev *hdev, struct qca_btsoc_version *ver, 21 19 enum qca_btsoc_type soc_type) 22 20 { ··· 99 101 { 100 102 struct sk_buff *skb; 101 103 struct edl_event_hdr *edl; 102 - char cmd, build_label[QCA_FW_BUILD_VER_LEN]; 104 + char *build_label; 105 + char cmd; 103 106 int build_lbl_len, err = 0; 104 107 105 108 bt_dev_dbg(hdev, "QCA read fw build info"); ··· 113 114 bt_dev_err(hdev, "Reading QCA fw build info failed (%d)", 114 115 err); 115 116 return err; 117 + } 118 + 119 + if (skb->len < sizeof(*edl)) { 120 + err = -EILSEQ; 121 + goto out; 116 122 } 117 123 118 124 edl = (struct edl_event_hdr *)(skb->data); ··· 135 131 goto out; 136 132 } 137 133 138 - build_lbl_len = edl->data[0]; 139 - if (build_lbl_len <= QCA_FW_BUILD_VER_LEN - 1) { 140 - memcpy(build_label, edl->data + 1, build_lbl_len); 141 - *(build_label + build_lbl_len) = '\0'; 134 + if (skb->len < sizeof(*edl) + 1) { 135 + err = -EILSEQ; 136 + goto out; 142 137 } 138 + 139 + build_lbl_len = edl->data[0]; 140 + 141 + if (skb->len < sizeof(*edl) + 1 + build_lbl_len) { 142 + err = -EILSEQ; 143 + goto out; 144 + } 145 + 146 + build_label = kstrndup(&edl->data[1], build_lbl_len, GFP_KERNEL); 147 + if (!build_label) 148 + goto out; 143 149 144 150 hci_set_fw_info(hdev, "%s", build_label); 145 151 152 + kfree(build_label); 146 153 out: 147 154 kfree_skb(skb); 148 155 return err; ··· 252 237 goto out; 253 238 } 254 239 240 + if (skb->len < 3) { 241 + err = -EILSEQ; 242 + goto out; 243 + } 244 + 255 245 *bid = (edl->data[1] << 8) + edl->data[2]; 256 246 bt_dev_dbg(hdev, "%s: bid = %x", __func__, *bid); 257 247 ··· 287 267 } 288 268 EXPORT_SYMBOL_GPL(qca_send_pre_shutdown_cmd); 289 269 290 - static void qca_tlv_check_data(struct hci_dev *hdev, 270 + static int qca_tlv_check_data(struct hci_dev *hdev, 291 271 struct qca_fw_config *config, 292 - u8 *fw_data, enum qca_btsoc_type soc_type) 272 + u8 *fw_data, size_t fw_size, 273 + enum qca_btsoc_type soc_type) 293 274 { 294 275 const u8 *data; 295 276 u32 type_len; ··· 300 279 struct tlv_type_patch *tlv_patch; 301 280 struct tlv_type_nvm *tlv_nvm; 302 281 uint8_t nvm_baud_rate = config->user_baud_rate; 282 + u8 type; 303 283 304 284 config->dnld_mode = QCA_SKIP_EVT_NONE; 305 285 config->dnld_type = QCA_SKIP_EVT_NONE; 306 286 307 287 switch (config->type) { 308 288 case ELF_TYPE_PATCH: 289 + if (fw_size < 7) 290 + return -EINVAL; 291 + 309 292 config->dnld_mode = QCA_SKIP_EVT_VSE_CC; 310 293 config->dnld_type = QCA_SKIP_EVT_VSE_CC; 311 294 ··· 318 293 bt_dev_dbg(hdev, "File version : 0x%x", fw_data[6]); 319 294 break; 320 295 case TLV_TYPE_PATCH: 296 + if (fw_size < sizeof(struct tlv_type_hdr) + sizeof(struct tlv_type_patch)) 297 + return -EINVAL; 298 + 321 299 tlv = (struct tlv_type_hdr *)fw_data; 322 300 type_len = le32_to_cpu(tlv->type_len); 323 301 tlv_patch = (struct tlv_type_patch *)tlv->data; ··· 360 332 break; 361 333 362 334 case TLV_TYPE_NVM: 335 + if (fw_size < sizeof(struct tlv_type_hdr)) 336 + return -EINVAL; 337 + 363 338 tlv = (struct tlv_type_hdr *)fw_data; 364 339 365 340 type_len = le32_to_cpu(tlv->type_len); 366 - length = (type_len >> 8) & 0x00ffffff; 341 + length = type_len >> 8; 342 + type = type_len & 0xff; 367 343 368 - BT_DBG("TLV Type\t\t : 0x%x", type_len & 0x000000ff); 344 + /* Some NVM files have more than one set of tags, only parse 345 + * the first set when it has type 2 for now. When there is 346 + * more than one set there is an enclosing header of type 4. 347 + */ 348 + if (type == 4) { 349 + if (fw_size < 2 * sizeof(struct tlv_type_hdr)) 350 + return -EINVAL; 351 + 352 + tlv++; 353 + 354 + type_len = le32_to_cpu(tlv->type_len); 355 + length = type_len >> 8; 356 + type = type_len & 0xff; 357 + } 358 + 359 + BT_DBG("TLV Type\t\t : 0x%x", type); 369 360 BT_DBG("Length\t\t : %d bytes", length); 361 + 362 + if (type != 2) 363 + break; 364 + 365 + if (fw_size < length + (tlv->data - fw_data)) 366 + return -EINVAL; 370 367 371 368 idx = 0; 372 369 data = tlv->data; 373 - while (idx < length) { 370 + while (idx < length - sizeof(struct tlv_type_nvm)) { 374 371 tlv_nvm = (struct tlv_type_nvm *)(data + idx); 375 372 376 373 tag_id = le16_to_cpu(tlv_nvm->tag_id); 377 374 tag_len = le16_to_cpu(tlv_nvm->tag_len); 378 375 376 + if (length < idx + sizeof(struct tlv_type_nvm) + tag_len) 377 + return -EINVAL; 378 + 379 379 /* Update NVM tags as needed */ 380 380 switch (tag_id) { 381 + case EDL_TAG_ID_BD_ADDR: 382 + if (tag_len != sizeof(bdaddr_t)) 383 + return -EINVAL; 384 + 385 + memcpy(&config->bdaddr, tlv_nvm->data, sizeof(bdaddr_t)); 386 + 387 + break; 388 + 381 389 case EDL_TAG_ID_HCI: 390 + if (tag_len < 3) 391 + return -EINVAL; 392 + 382 393 /* HCI transport layer parameters 383 394 * enabling software inband sleep 384 395 * onto controller side. ··· 433 366 break; 434 367 435 368 case EDL_TAG_ID_DEEP_SLEEP: 369 + if (tag_len < 1) 370 + return -EINVAL; 371 + 436 372 /* Sleep enable mask 437 373 * enabling deep sleep feature on controller. 438 374 */ ··· 444 374 break; 445 375 } 446 376 447 - idx += (sizeof(u16) + sizeof(u16) + 8 + tag_len); 377 + idx += sizeof(struct tlv_type_nvm) + tag_len; 448 378 } 449 379 break; 450 380 451 381 default: 452 382 BT_ERR("Unknown TLV type %d", config->type); 453 - break; 383 + return -EINVAL; 454 384 } 385 + 386 + return 0; 455 387 } 456 388 457 389 static int qca_tlv_send_segment(struct hci_dev *hdev, int seg_size, ··· 603 531 memcpy(data, fw->data, size); 604 532 release_firmware(fw); 605 533 606 - qca_tlv_check_data(hdev, config, data, soc_type); 534 + ret = qca_tlv_check_data(hdev, config, data, size, soc_type); 535 + if (ret) 536 + goto out; 607 537 608 538 segment = data; 609 539 remain = size; ··· 688 614 } 689 615 EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome); 690 616 691 - static int qca_check_bdaddr(struct hci_dev *hdev) 617 + static int qca_check_bdaddr(struct hci_dev *hdev, const struct qca_fw_config *config) 692 618 { 693 619 struct hci_rp_read_bd_addr *bda; 694 620 struct sk_buff *skb; ··· 712 638 } 713 639 714 640 bda = (struct hci_rp_read_bd_addr *)skb->data; 715 - if (!bacmp(&bda->bdaddr, QCA_BDADDR_DEFAULT)) 641 + if (!bacmp(&bda->bdaddr, &config->bdaddr)) 716 642 set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); 717 643 718 644 kfree_skb(skb); ··· 741 667 enum qca_btsoc_type soc_type, struct qca_btsoc_version ver, 742 668 const char *firmware_name) 743 669 { 744 - struct qca_fw_config config; 670 + struct qca_fw_config config = {}; 745 671 int err; 746 672 u8 rom_ver = 0; 747 673 u32 soc_ver; ··· 926 852 break; 927 853 } 928 854 929 - err = qca_check_bdaddr(hdev); 855 + err = qca_check_bdaddr(hdev, &config); 930 856 if (err) 931 857 return err; 932 858
+2 -1
drivers/bluetooth/btqca.h
··· 29 29 #define EDL_PATCH_CONFIG_RES_EVT (0x00) 30 30 #define QCA_DISABLE_LOGGING_SUB_OP (0x14) 31 31 32 + #define EDL_TAG_ID_BD_ADDR 2 32 33 #define EDL_TAG_ID_HCI (17) 33 34 #define EDL_TAG_ID_DEEP_SLEEP (27) 34 35 ··· 48 47 #define get_soc_ver(soc_id, rom_ver) \ 49 48 ((le32_to_cpu(soc_id) << 16) | (le16_to_cpu(rom_ver))) 50 49 51 - #define QCA_FW_BUILD_VER_LEN 255 52 50 #define QCA_HSP_GF_SOC_ID 0x1200 53 51 #define QCA_HSP_GF_SOC_MASK 0x0000ff00 54 52 ··· 94 94 uint8_t user_baud_rate; 95 95 enum qca_tlv_dnld_mode dnld_mode; 96 96 enum qca_tlv_dnld_mode dnld_type; 97 + bdaddr_t bdaddr; 97 98 }; 98 99 99 100 struct edl_event_hdr {
+1 -1
drivers/cache/sifive_ccache.c
··· 290 290 struct device_node *np; 291 291 struct resource res; 292 292 const struct of_device_id *match; 293 - unsigned long quirks; 293 + unsigned long quirks __maybe_unused; 294 294 int rc; 295 295 296 296 np = of_find_matching_node_and_match(NULL, sifive_ccache_ids, &match);
+1
drivers/clk/qcom/clk-smd-rpm.c
··· 768 768 769 769 static const struct rpm_smd_clk_desc rpm_clk_msm8976 = { 770 770 .clks = msm8976_clks, 771 + .num_clks = ARRAY_SIZE(msm8976_clks), 771 772 .icc_clks = bimc_pcnoc_snoc_smmnoc_icc_clks, 772 773 .num_icc_clks = ARRAY_SIZE(bimc_pcnoc_snoc_smmnoc_icc_clks), 773 774 };
+8 -3
drivers/clk/qcom/gdsc.c
··· 487 487 if (!scs[i] || !scs[i]->supply) 488 488 continue; 489 489 490 - scs[i]->rsupply = devm_regulator_get(dev, scs[i]->supply); 491 - if (IS_ERR(scs[i]->rsupply)) 492 - return PTR_ERR(scs[i]->rsupply); 490 + scs[i]->rsupply = devm_regulator_get_optional(dev, scs[i]->supply); 491 + if (IS_ERR(scs[i]->rsupply)) { 492 + ret = PTR_ERR(scs[i]->rsupply); 493 + if (ret != -ENODEV) 494 + return ret; 495 + 496 + scs[i]->rsupply = NULL; 497 + } 493 498 } 494 499 495 500 data->num_domains = num;
+10 -3
drivers/clk/samsung/clk-exynos-clkout.c
··· 13 13 #include <linux/io.h> 14 14 #include <linux/of.h> 15 15 #include <linux/of_address.h> 16 + #include <linux/of_device.h> 16 17 #include <linux/platform_device.h> 17 18 #include <linux/pm.h> 18 - #include <linux/property.h> 19 19 20 20 #define EXYNOS_CLKOUT_NR_CLKS 1 21 21 #define EXYNOS_CLKOUT_PARENTS 32 ··· 84 84 static int exynos_clkout_match_parent_dev(struct device *dev, u32 *mux_mask) 85 85 { 86 86 const struct exynos_clkout_variant *variant; 87 + const struct of_device_id *match; 87 88 88 89 if (!dev->parent) { 89 90 dev_err(dev, "not instantiated from MFD\n"); 90 91 return -EINVAL; 91 92 } 92 93 93 - variant = device_get_match_data(dev->parent); 94 - if (!variant) { 94 + /* 95 + * 'exynos_clkout_ids' arrays is not the ids array matched by 96 + * the dev->parent driver, so of_device_get_match_data() or 97 + * device_get_match_data() cannot be used here. 98 + */ 99 + match = of_match_device(exynos_clkout_ids, dev->parent); 100 + if (!match) { 95 101 dev_err(dev, "cannot match parent device\n"); 96 102 return -EINVAL; 97 103 } 104 + variant = match->data; 98 105 99 106 *mux_mask = variant->mux_mask; 100 107
+2
drivers/clk/sunxi-ng/ccu-sun50i-a64.c
··· 182 182 &ccu_nkm_ops, 183 183 CLK_SET_RATE_UNGATE | CLK_SET_RATE_PARENT), 184 184 .features = CCU_FEATURE_CLOSEST_RATE, 185 + .min_rate = 500000000, 186 + .max_rate = 1400000000, 185 187 }, 186 188 }; 187 189
+17 -2
drivers/clk/sunxi-ng/ccu-sun50i-h6.c
··· 1181 1181 SUN50I_H6_USB3_CLK_REG, 1182 1182 }; 1183 1183 1184 + static struct ccu_mux_nb sun50i_h6_cpu_nb = { 1185 + .common = &cpux_clk.common, 1186 + .cm = &cpux_clk.mux, 1187 + .delay_us = 1, 1188 + .bypass_index = 0, /* index of 24 MHz oscillator */ 1189 + }; 1190 + 1184 1191 static int sun50i_h6_ccu_probe(struct platform_device *pdev) 1185 1192 { 1186 1193 void __iomem *reg; 1194 + int i, ret; 1187 1195 u32 val; 1188 - int i; 1189 1196 1190 1197 reg = devm_platform_ioremap_resource(pdev, 0); 1191 1198 if (IS_ERR(reg)) ··· 1259 1252 val |= BIT(24); 1260 1253 writel(val, reg + SUN50I_H6_HDMI_CEC_CLK_REG); 1261 1254 1262 - return devm_sunxi_ccu_probe(&pdev->dev, reg, &sun50i_h6_ccu_desc); 1255 + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun50i_h6_ccu_desc); 1256 + if (ret) 1257 + return ret; 1258 + 1259 + /* Reparent CPU during PLL CPUX rate changes */ 1260 + ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk, 1261 + &sun50i_h6_cpu_nb); 1262 + 1263 + return 0; 1263 1264 } 1264 1265 1265 1266 static const struct of_device_id sun50i_h6_ccu_ids[] = {
+19
drivers/clk/sunxi-ng/ccu_common.c
··· 44 44 unsigned long current_rate, 45 45 unsigned long best_rate) 46 46 { 47 + unsigned long min_rate, max_rate; 48 + 49 + clk_hw_get_rate_range(&common->hw, &min_rate, &max_rate); 50 + 51 + if (current_rate > max_rate) 52 + return false; 53 + 54 + if (current_rate < min_rate) 55 + return false; 56 + 47 57 if (common->features & CCU_FEATURE_CLOSEST_RATE) 48 58 return abs(current_rate - target_rate) < abs(best_rate - target_rate); 49 59 ··· 132 122 133 123 for (i = 0; i < desc->hw_clks->num ; i++) { 134 124 struct clk_hw *hw = desc->hw_clks->hws[i]; 125 + struct ccu_common *common = hw_to_ccu_common(hw); 135 126 const char *name; 136 127 137 128 if (!hw) ··· 147 136 pr_err("Couldn't register clock %d - %s\n", i, name); 148 137 goto err_clk_unreg; 149 138 } 139 + 140 + if (common->max_rate) 141 + clk_hw_set_rate_range(hw, common->min_rate, 142 + common->max_rate); 143 + else 144 + WARN(common->min_rate, 145 + "No max_rate, ignoring min_rate of clock %d - %s\n", 146 + i, name); 150 147 } 151 148 152 149 ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
+3
drivers/clk/sunxi-ng/ccu_common.h
··· 31 31 u16 lock_reg; 32 32 u32 prediv; 33 33 34 + unsigned long min_rate; 35 + unsigned long max_rate; 36 + 34 37 unsigned long features; 35 38 spinlock_t *lock; 36 39 struct clk_hw hw;
+14 -1
drivers/cxl/core/port.c
··· 2184 2184 int cxl_endpoint_get_perf_coordinates(struct cxl_port *port, 2185 2185 struct access_coordinate *coord) 2186 2186 { 2187 + struct cxl_memdev *cxlmd = to_cxl_memdev(port->uport_dev); 2187 2188 struct access_coordinate c[] = { 2188 2189 { 2189 2190 .read_bandwidth = UINT_MAX, ··· 2198 2197 struct cxl_port *iter = port; 2199 2198 struct cxl_dport *dport; 2200 2199 struct pci_dev *pdev; 2200 + struct device *dev; 2201 2201 unsigned int bw; 2202 2202 bool is_cxl_root; 2203 2203 2204 2204 if (!is_cxl_endpoint(port)) 2205 2205 return -EINVAL; 2206 + 2207 + /* 2208 + * Skip calculation for RCD. Expectation is HMAT already covers RCD case 2209 + * since RCH does not support hotplug. 2210 + */ 2211 + if (cxlmd->cxlds->rcd) 2212 + return 0; 2206 2213 2207 2214 /* 2208 2215 * Exit the loop when the parent port of the current iter port is cxl ··· 2241 2232 return -EINVAL; 2242 2233 cxl_coordinates_combine(c, c, dport->coord); 2243 2234 2235 + dev = port->uport_dev->parent; 2236 + if (!dev_is_pci(dev)) 2237 + return -ENODEV; 2238 + 2244 2239 /* Get the calculated PCI paths bandwidth */ 2245 - pdev = to_pci_dev(port->uport_dev->parent); 2240 + pdev = to_pci_dev(dev); 2246 2241 bw = pcie_bandwidth_available(pdev, NULL, NULL, NULL); 2247 2242 if (bw == 0) 2248 2243 return -ENXIO;
+6 -6
drivers/edac/versal_edac.c
··· 425 425 convert_to_physical(priv, pinf), pinf.burstpos); 426 426 427 427 edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 428 - priv->ce_cnt, 0, 0, 0, 0, 0, -1, 428 + 1, 0, 0, 0, 0, 0, -1, 429 429 priv->message, ""); 430 430 } 431 431 ··· 438 438 convert_to_physical(priv, pinf), pinf.burstpos); 439 439 440 440 edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 441 - priv->ue_cnt, 0, 0, 0, 0, 0, -1, 441 + 1, 0, 0, 0, 0, 0, -1, 442 442 priv->message, ""); 443 443 } 444 444 ··· 865 865 for (i = 0; i < NUM_UE_BITPOS; i++) 866 866 token[i] = strsep(&pbuf, ","); 867 867 868 + if (!token[0] || !token[1]) 869 + return -EFAULT; 870 + 868 871 ret = kstrtou8(token[0], 0, &ue0); 869 872 if (ret) 870 873 return ret; ··· 1138 1135 } 1139 1136 1140 1137 rc = xlnx_register_event(PM_NOTIFY_CB, VERSAL_EVENT_ERROR_PMC_ERR1, 1141 - XPM_EVENT_ERROR_MASK_DDRMC_CR | XPM_EVENT_ERROR_MASK_DDRMC_NCR | 1142 - XPM_EVENT_ERROR_MASK_NOC_CR | XPM_EVENT_ERROR_MASK_NOC_NCR, 1138 + XPM_EVENT_ERROR_MASK_DDRMC_CR | XPM_EVENT_ERROR_MASK_DDRMC_NCR, 1143 1139 false, err_callback, mci); 1144 1140 if (rc) { 1145 1141 if (rc == -EACCES) ··· 1175 1173 1176 1174 xlnx_unregister_event(PM_NOTIFY_CB, VERSAL_EVENT_ERROR_PMC_ERR1, 1177 1175 XPM_EVENT_ERROR_MASK_DDRMC_CR | 1178 - XPM_EVENT_ERROR_MASK_NOC_CR | 1179 - XPM_EVENT_ERROR_MASK_NOC_NCR | 1180 1176 XPM_EVENT_ERROR_MASK_DDRMC_NCR, err_callback, mci); 1181 1177 edac_mc_del_mc(&pdev->dev); 1182 1178 edac_mc_free(mci);
+4 -2
drivers/firewire/nosy.c
··· 148 148 if (atomic_read(&buffer->size) == 0) 149 149 return -ENODEV; 150 150 151 - /* FIXME: Check length <= user_length. */ 151 + length = buffer->head->length; 152 + 153 + if (length > user_length) 154 + return 0; 152 155 153 156 end = buffer->data + buffer->capacity; 154 - length = buffer->head->length; 155 157 156 158 if (&buffer->head->data[length] < end) { 157 159 if (copy_to_user(data, buffer->head->data, length))
+6 -2
drivers/firewire/ohci.c
··· 1556 1556 #define HEADER_GET_DATA_LENGTH(q) (((q) >> 16) & 0xffff) 1557 1557 #define HEADER_GET_EXTENDED_TCODE(q) (((q) >> 0) & 0xffff) 1558 1558 1559 + static u32 get_cycle_time(struct fw_ohci *ohci); 1560 + 1559 1561 static void handle_local_rom(struct fw_ohci *ohci, 1560 1562 struct fw_packet *packet, u32 csr) 1561 1563 { ··· 1582 1580 (void *) ohci->config_rom + i, length); 1583 1581 } 1584 1582 1583 + // Timestamping on behalf of the hardware. 1584 + response.timestamp = cycle_time_to_ohci_tstamp(get_cycle_time(ohci)); 1585 1585 fw_core_handle_response(&ohci->card, &response); 1586 1586 } 1587 1587 ··· 1632 1628 fw_fill_response(&response, packet->header, RCODE_BUSY, NULL, 0); 1633 1629 1634 1630 out: 1631 + // Timestamping on behalf of the hardware. 1632 + response.timestamp = cycle_time_to_ohci_tstamp(get_cycle_time(ohci)); 1635 1633 fw_core_handle_response(&ohci->card, &response); 1636 1634 } 1637 1635 ··· 1675 1669 packet->callback(packet, &ctx->ohci->card, packet->ack); 1676 1670 } 1677 1671 } 1678 - 1679 - static u32 get_cycle_time(struct fw_ohci *ohci); 1680 1672 1681 1673 static void at_context_transmit(struct context *ctx, struct fw_packet *packet) 1682 1674 {
+4
drivers/firmware/efi/unaccepted_memory.c
··· 4 4 #include <linux/memblock.h> 5 5 #include <linux/spinlock.h> 6 6 #include <linux/crash_dump.h> 7 + #include <linux/nmi.h> 7 8 #include <asm/unaccepted_memory.h> 8 9 9 10 /* Protects unaccepted memory bitmap and accepting_list */ ··· 150 149 } 151 150 152 151 list_del(&range.list); 152 + 153 + touch_softlockup_watchdog(); 154 + 153 155 spin_unlock_irqrestore(&unaccepted_memory_lock, flags); 154 156 } 155 157
+5 -3
drivers/firmware/microchip/mpfs-auto-update.c
··· 206 206 if (ret | response->resp_status) { 207 207 dev_warn(priv->dev, "Verification of Upgrade Image failed!\n"); 208 208 ret = ret ? ret : -EBADMSG; 209 + goto free_message; 209 210 } 210 211 211 212 dev_info(priv->dev, "Verification of Upgrade Image passed!\n"); 212 213 214 + free_message: 213 215 devm_kfree(priv->dev, message); 214 216 free_response: 215 217 devm_kfree(priv->dev, response); ··· 267 265 AUTO_UPDATE_DIRECTORY_WIDTH); 268 266 memset(buffer + AUTO_UPDATE_BLANK_DIRECTORY, 0x0, AUTO_UPDATE_DIRECTORY_WIDTH); 269 267 270 - dev_info(priv->dev, "Writing the image address (%x) to the flash directory (%llx)\n", 268 + dev_info(priv->dev, "Writing the image address (0x%x) to the flash directory (0x%llx)\n", 271 269 image_address, directory_address); 272 270 273 271 ret = mtd_write(priv->flash, 0x0, erase_size, &bytes_written, (u_char *)buffer); ··· 315 313 erase.len = round_up(size, (size_t)priv->flash->erasesize); 316 314 erase.addr = image_address; 317 315 318 - dev_info(priv->dev, "Erasing the flash at address (%x)\n", image_address); 316 + dev_info(priv->dev, "Erasing the flash at address (0x%x)\n", image_address); 319 317 ret = mtd_erase(priv->flash, &erase); 320 318 if (ret) 321 319 goto out; ··· 325 323 * will do all of that itself - including verifying that the bitstream 326 324 * is valid. 327 325 */ 328 - dev_info(priv->dev, "Writing the image to the flash at address (%x)\n", image_address); 326 + dev_info(priv->dev, "Writing the image to the flash at address (0x%x)\n", image_address); 329 327 ret = mtd_write(priv->flash, (loff_t)image_address, size, &bytes_written, data); 330 328 if (ret) 331 329 goto out;
+3
drivers/fpga/dfl-pci.c
··· 78 78 #define PCIE_DEVICE_ID_SILICOM_PAC_N5011 0x1001 79 79 #define PCIE_DEVICE_ID_INTEL_DFL 0xbcce 80 80 /* PCI Subdevice ID for PCIE_DEVICE_ID_INTEL_DFL */ 81 + #define PCIE_SUBDEVICE_ID_INTEL_D5005 0x138d 81 82 #define PCIE_SUBDEVICE_ID_INTEL_N6000 0x1770 82 83 #define PCIE_SUBDEVICE_ID_INTEL_N6001 0x1771 83 84 #define PCIE_SUBDEVICE_ID_INTEL_C6100 0x17d4 ··· 102 101 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_PAC_D5005_VF),}, 103 102 {PCI_DEVICE(PCI_VENDOR_ID_SILICOM_DENMARK, PCIE_DEVICE_ID_SILICOM_PAC_N5010),}, 104 103 {PCI_DEVICE(PCI_VENDOR_ID_SILICOM_DENMARK, PCIE_DEVICE_ID_SILICOM_PAC_N5011),}, 104 + {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL, 105 + PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_D5005),}, 105 106 {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL, 106 107 PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_N6000),}, 107 108 {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL_VF,
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
··· 220 220 (kfd_mem_limit.ttm_mem_used + ttm_mem_needed > 221 221 kfd_mem_limit.max_ttm_mem_limit) || 222 222 (adev && xcp_id >= 0 && adev->kfd.vram_used[xcp_id] + vram_needed > 223 - vram_size - reserved_for_pt)) { 223 + vram_size - reserved_for_pt - atomic64_read(&adev->vram_pin_size))) { 224 224 ret = -ENOMEM; 225 225 goto release; 226 226 }
+9 -5
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
··· 1243 1243 * amdgpu_bo_move_notify - notification about a memory move 1244 1244 * @bo: pointer to a buffer object 1245 1245 * @evict: if this move is evicting the buffer from the graphics address space 1246 + * @new_mem: new resource for backing the BO 1246 1247 * 1247 1248 * Marks the corresponding &amdgpu_bo buffer object as invalid, also performs 1248 1249 * bookkeeping. 1249 1250 * TTM driver callback which is called when ttm moves a buffer. 1250 1251 */ 1251 - void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict) 1252 + void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, 1253 + bool evict, 1254 + struct ttm_resource *new_mem) 1252 1255 { 1253 1256 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev); 1257 + struct ttm_resource *old_mem = bo->resource; 1254 1258 struct amdgpu_bo *abo; 1255 1259 1256 1260 if (!amdgpu_bo_is_amdgpu_bo(bo)) ··· 1266 1262 amdgpu_bo_kunmap(abo); 1267 1263 1268 1264 if (abo->tbo.base.dma_buf && !abo->tbo.base.import_attach && 1269 - bo->resource->mem_type != TTM_PL_SYSTEM) 1265 + old_mem && old_mem->mem_type != TTM_PL_SYSTEM) 1270 1266 dma_buf_move_notify(abo->tbo.base.dma_buf); 1271 1267 1272 - /* remember the eviction */ 1273 - if (evict) 1274 - atomic64_inc(&adev->num_evictions); 1268 + /* move_notify is called before move happens */ 1269 + trace_amdgpu_bo_move(abo, new_mem ? new_mem->mem_type : -1, 1270 + old_mem ? old_mem->mem_type : -1); 1275 1271 } 1276 1272 1277 1273 void amdgpu_bo_get_memory(struct amdgpu_bo *bo,
+3 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
··· 328 328 int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer, 329 329 size_t buffer_size, uint32_t *metadata_size, 330 330 uint64_t *flags); 331 - void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict); 331 + void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, 332 + bool evict, 333 + struct ttm_resource *new_mem); 332 334 void amdgpu_bo_release_notify(struct ttm_buffer_object *bo); 333 335 vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo); 334 336 void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence,
+29 -25
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
··· 419 419 return false; 420 420 421 421 if (res->mem_type == TTM_PL_SYSTEM || res->mem_type == TTM_PL_TT || 422 - res->mem_type == AMDGPU_PL_PREEMPT) 422 + res->mem_type == AMDGPU_PL_PREEMPT || res->mem_type == AMDGPU_PL_DOORBELL) 423 423 return true; 424 424 425 425 if (res->mem_type != TTM_PL_VRAM) ··· 481 481 482 482 if (!old_mem || (old_mem->mem_type == TTM_PL_SYSTEM && 483 483 bo->ttm == NULL)) { 484 + amdgpu_bo_move_notify(bo, evict, new_mem); 484 485 ttm_bo_move_null(bo, new_mem); 485 - goto out; 486 + return 0; 486 487 } 487 488 if (old_mem->mem_type == TTM_PL_SYSTEM && 488 489 (new_mem->mem_type == TTM_PL_TT || 489 490 new_mem->mem_type == AMDGPU_PL_PREEMPT)) { 491 + amdgpu_bo_move_notify(bo, evict, new_mem); 490 492 ttm_bo_move_null(bo, new_mem); 491 - goto out; 493 + return 0; 492 494 } 493 495 if ((old_mem->mem_type == TTM_PL_TT || 494 496 old_mem->mem_type == AMDGPU_PL_PREEMPT) && ··· 500 498 return r; 501 499 502 500 amdgpu_ttm_backend_unbind(bo->bdev, bo->ttm); 501 + amdgpu_bo_move_notify(bo, evict, new_mem); 503 502 ttm_resource_free(bo, &bo->resource); 504 503 ttm_bo_assign_mem(bo, new_mem); 505 - goto out; 504 + return 0; 506 505 } 507 506 508 507 if (old_mem->mem_type == AMDGPU_PL_GDS || ··· 515 512 new_mem->mem_type == AMDGPU_PL_OA || 516 513 new_mem->mem_type == AMDGPU_PL_DOORBELL) { 517 514 /* Nothing to save here */ 515 + amdgpu_bo_move_notify(bo, evict, new_mem); 518 516 ttm_bo_move_null(bo, new_mem); 519 - goto out; 517 + return 0; 520 518 } 521 519 522 520 if (bo->type == ttm_bo_type_device && ··· 529 525 abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED; 530 526 } 531 527 532 - if (adev->mman.buffer_funcs_enabled) { 533 - if (((old_mem->mem_type == TTM_PL_SYSTEM && 534 - new_mem->mem_type == TTM_PL_VRAM) || 535 - (old_mem->mem_type == TTM_PL_VRAM && 536 - new_mem->mem_type == TTM_PL_SYSTEM))) { 537 - hop->fpfn = 0; 538 - hop->lpfn = 0; 539 - hop->mem_type = TTM_PL_TT; 540 - hop->flags = TTM_PL_FLAG_TEMPORARY; 541 - return -EMULTIHOP; 542 - } 543 - 544 - r = amdgpu_move_blit(bo, evict, new_mem, old_mem); 545 - } else { 546 - r = -ENODEV; 528 + if (adev->mman.buffer_funcs_enabled && 529 + ((old_mem->mem_type == TTM_PL_SYSTEM && 530 + new_mem->mem_type == TTM_PL_VRAM) || 531 + (old_mem->mem_type == TTM_PL_VRAM && 532 + new_mem->mem_type == TTM_PL_SYSTEM))) { 533 + hop->fpfn = 0; 534 + hop->lpfn = 0; 535 + hop->mem_type = TTM_PL_TT; 536 + hop->flags = TTM_PL_FLAG_TEMPORARY; 537 + return -EMULTIHOP; 547 538 } 539 + 540 + amdgpu_bo_move_notify(bo, evict, new_mem); 541 + if (adev->mman.buffer_funcs_enabled) 542 + r = amdgpu_move_blit(bo, evict, new_mem, old_mem); 543 + else 544 + r = -ENODEV; 548 545 549 546 if (r) { 550 547 /* Check that all memory is CPU accessible */ ··· 560 555 return r; 561 556 } 562 557 563 - trace_amdgpu_bo_move(abo, new_mem->mem_type, old_mem->mem_type); 564 - out: 565 - /* update statistics */ 558 + /* update statistics after the move */ 559 + if (evict) 560 + atomic64_inc(&adev->num_evictions); 566 561 atomic64_add(bo->base.size, &adev->num_bytes_moved); 567 - amdgpu_bo_move_notify(bo, evict); 568 562 return 0; 569 563 } 570 564 ··· 1563 1559 static void 1564 1560 amdgpu_bo_delete_mem_notify(struct ttm_buffer_object *bo) 1565 1561 { 1566 - amdgpu_bo_move_notify(bo, false); 1562 + amdgpu_bo_move_notify(bo, false, NULL); 1567 1563 } 1568 1564 1569 1565 static struct ttm_device_funcs amdgpu_bo_driver = {
+8
drivers/gpu/drm/amd/amdkfd/kfd_process.c
··· 829 829 if (process) { 830 830 pr_debug("Process already found\n"); 831 831 } else { 832 + /* If the process just called exec(3), it is possible that the 833 + * cleanup of the kfd_process (following the release of the mm 834 + * of the old process image) is still in the cleanup work queue. 835 + * Make sure to drain any job before trying to recreate any 836 + * resource for this process. 837 + */ 838 + flush_workqueue(kfd_process_wq); 839 + 832 840 process = create_process(thread); 833 841 if (IS_ERR(process)) 834 842 goto out;
+12 -9
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 4537 4537 /* Determine whether to enable Replay support by default. */ 4538 4538 if (!(amdgpu_dc_debug_mask & DC_DISABLE_REPLAY)) { 4539 4539 switch (amdgpu_ip_version(adev, DCE_HWIP, 0)) { 4540 - case IP_VERSION(3, 1, 4): 4541 - case IP_VERSION(3, 1, 5): 4542 - case IP_VERSION(3, 1, 6): 4543 - case IP_VERSION(3, 2, 0): 4544 - case IP_VERSION(3, 2, 1): 4545 - case IP_VERSION(3, 5, 0): 4546 - case IP_VERSION(3, 5, 1): 4547 - replay_feature_enabled = true; 4548 - break; 4540 + /* 4541 + * Disabled by default due to https://gitlab.freedesktop.org/drm/amd/-/issues/3344 4542 + * case IP_VERSION(3, 1, 4): 4543 + * case IP_VERSION(3, 1, 5): 4544 + * case IP_VERSION(3, 1, 6): 4545 + * case IP_VERSION(3, 2, 0): 4546 + * case IP_VERSION(3, 2, 1): 4547 + * case IP_VERSION(3, 5, 0): 4548 + * case IP_VERSION(3, 5, 1): 4549 + * replay_feature_enabled = true; 4550 + * break; 4551 + */ 4549 4552 default: 4550 4553 replay_feature_enabled = amdgpu_dc_feature_mask & DC_REPLAY_MASK; 4551 4554 break;
+36 -12
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
··· 1495 1495 for (i = 0; i < MAX_PIPES; i++) { 1496 1496 pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; 1497 1497 if (pipe_ctx->stream && 1498 - pipe_ctx->stream->link == aconnector->dc_link) 1498 + pipe_ctx->stream->link == aconnector->dc_link && 1499 + pipe_ctx->stream->sink && 1500 + pipe_ctx->stream->sink == aconnector->dc_sink) 1499 1501 break; 1500 1502 } 1501 1503 ··· 1598 1596 for (i = 0; i < MAX_PIPES; i++) { 1599 1597 pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; 1600 1598 if (pipe_ctx->stream && 1601 - pipe_ctx->stream->link == aconnector->dc_link) 1599 + pipe_ctx->stream->link == aconnector->dc_link && 1600 + pipe_ctx->stream->sink && 1601 + pipe_ctx->stream->sink == aconnector->dc_sink) 1602 1602 break; 1603 1603 } 1604 1604 ··· 1685 1681 for (i = 0; i < MAX_PIPES; i++) { 1686 1682 pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; 1687 1683 if (pipe_ctx->stream && 1688 - pipe_ctx->stream->link == aconnector->dc_link) 1684 + pipe_ctx->stream->link == aconnector->dc_link && 1685 + pipe_ctx->stream->sink && 1686 + pipe_ctx->stream->sink == aconnector->dc_sink) 1689 1687 break; 1690 1688 } 1691 1689 ··· 1786 1780 for (i = 0; i < MAX_PIPES; i++) { 1787 1781 pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; 1788 1782 if (pipe_ctx->stream && 1789 - pipe_ctx->stream->link == aconnector->dc_link) 1783 + pipe_ctx->stream->link == aconnector->dc_link && 1784 + pipe_ctx->stream->sink && 1785 + pipe_ctx->stream->sink == aconnector->dc_sink) 1790 1786 break; 1791 1787 } 1792 1788 ··· 1873 1865 for (i = 0; i < MAX_PIPES; i++) { 1874 1866 pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; 1875 1867 if (pipe_ctx->stream && 1876 - pipe_ctx->stream->link == aconnector->dc_link) 1868 + pipe_ctx->stream->link == aconnector->dc_link && 1869 + pipe_ctx->stream->sink && 1870 + pipe_ctx->stream->sink == aconnector->dc_sink) 1877 1871 break; 1878 1872 } 1879 1873 ··· 1974 1964 for (i = 0; i < MAX_PIPES; i++) { 1975 1965 pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; 1976 1966 if (pipe_ctx->stream && 1977 - pipe_ctx->stream->link == aconnector->dc_link) 1967 + pipe_ctx->stream->link == aconnector->dc_link && 1968 + pipe_ctx->stream->sink && 1969 + pipe_ctx->stream->sink == aconnector->dc_sink) 1978 1970 break; 1979 1971 } 1980 1972 ··· 2057 2045 for (i = 0; i < MAX_PIPES; i++) { 2058 2046 pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; 2059 2047 if (pipe_ctx->stream && 2060 - pipe_ctx->stream->link == aconnector->dc_link) 2048 + pipe_ctx->stream->link == aconnector->dc_link && 2049 + pipe_ctx->stream->sink && 2050 + pipe_ctx->stream->sink == aconnector->dc_sink) 2061 2051 break; 2062 2052 } 2063 2053 ··· 2155 2141 for (i = 0; i < MAX_PIPES; i++) { 2156 2142 pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; 2157 2143 if (pipe_ctx->stream && 2158 - pipe_ctx->stream->link == aconnector->dc_link) 2144 + pipe_ctx->stream->link == aconnector->dc_link && 2145 + pipe_ctx->stream->sink && 2146 + pipe_ctx->stream->sink == aconnector->dc_sink) 2159 2147 break; 2160 2148 } 2161 2149 ··· 2236 2220 for (i = 0; i < MAX_PIPES; i++) { 2237 2221 pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; 2238 2222 if (pipe_ctx->stream && 2239 - pipe_ctx->stream->link == aconnector->dc_link) 2223 + pipe_ctx->stream->link == aconnector->dc_link && 2224 + pipe_ctx->stream->sink && 2225 + pipe_ctx->stream->sink == aconnector->dc_sink) 2240 2226 break; 2241 2227 } 2242 2228 ··· 2294 2276 for (i = 0; i < MAX_PIPES; i++) { 2295 2277 pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; 2296 2278 if (pipe_ctx->stream && 2297 - pipe_ctx->stream->link == aconnector->dc_link) 2279 + pipe_ctx->stream->link == aconnector->dc_link && 2280 + pipe_ctx->stream->sink && 2281 + pipe_ctx->stream->sink == aconnector->dc_sink) 2298 2282 break; 2299 2283 } 2300 2284 ··· 2367 2347 for (i = 0; i < MAX_PIPES; i++) { 2368 2348 pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; 2369 2349 if (pipe_ctx->stream && 2370 - pipe_ctx->stream->link == aconnector->dc_link) 2350 + pipe_ctx->stream->link == aconnector->dc_link && 2351 + pipe_ctx->stream->sink && 2352 + pipe_ctx->stream->sink == aconnector->dc_sink) 2371 2353 break; 2372 2354 } 2373 2355 ··· 2440 2418 for (i = 0; i < MAX_PIPES; i++) { 2441 2419 pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; 2442 2420 if (pipe_ctx->stream && 2443 - pipe_ctx->stream->link == aconnector->dc_link) 2421 + pipe_ctx->stream->link == aconnector->dc_link && 2422 + pipe_ctx->stream->sink && 2423 + pipe_ctx->stream->sink == aconnector->dc_sink) 2444 2424 break; 2445 2425 } 2446 2426
+1
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
··· 2948 2948 result = get_integrated_info_v2_1(bp, info); 2949 2949 break; 2950 2950 case 2: 2951 + case 3: 2951 2952 result = get_integrated_info_v2_2(bp, info); 2952 2953 break; 2953 2954 default:
+8
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c
··· 145 145 */ 146 146 clk_mgr_base->clks.zstate_support = new_clocks->zstate_support; 147 147 if (safe_to_lower) { 148 + if (clk_mgr_base->clks.dtbclk_en && !new_clocks->dtbclk_en) { 149 + dcn315_smu_set_dtbclk(clk_mgr, false); 150 + clk_mgr_base->clks.dtbclk_en = new_clocks->dtbclk_en; 151 + } 148 152 /* check that we're not already in lower */ 149 153 if (clk_mgr_base->clks.pwr_state != DCN_PWR_STATE_LOW_POWER) { 150 154 display_count = dcn315_get_active_display_cnt_wa(dc, context); ··· 164 160 } 165 161 } 166 162 } else { 163 + if (!clk_mgr_base->clks.dtbclk_en && new_clocks->dtbclk_en) { 164 + dcn315_smu_set_dtbclk(clk_mgr, true); 165 + clk_mgr_base->clks.dtbclk_en = new_clocks->dtbclk_en; 166 + } 167 167 /* check that we're not already in D0 */ 168 168 if (clk_mgr_base->clks.pwr_state != DCN_PWR_STATE_MISSION_MODE) { 169 169 union display_idle_optimization_u idle_info = { 0 };
+12 -3
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c
··· 712 712 * since we calculate mode support based on softmax being the max UCLK 713 713 * frequency. 714 714 */ 715 - dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, 716 - dc->clk_mgr->bw_params->dc_mode_softmax_memclk); 715 + if (dc->debug.disable_dc_mode_overwrite) { 716 + dcn30_smu_set_hard_max_by_freq(clk_mgr, PPCLK_UCLK, dc->clk_mgr->bw_params->max_memclk_mhz); 717 + dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, dc->clk_mgr->bw_params->max_memclk_mhz); 718 + } else 719 + dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, 720 + dc->clk_mgr->bw_params->dc_mode_softmax_memclk); 717 721 } else { 718 722 dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, dc->clk_mgr->bw_params->max_memclk_mhz); 719 723 } ··· 750 746 /* set UCLK to requested value if P-State switching is supported, or to re-enable P-State switching */ 751 747 if (clk_mgr_base->clks.p_state_change_support && 752 748 (update_uclk || !clk_mgr_base->clks.prev_p_state_change_support) && 753 - !dc->work_arounds.clock_update_disable_mask.uclk) 749 + !dc->work_arounds.clock_update_disable_mask.uclk) { 750 + if (dc->clk_mgr->dc_mode_softmax_enabled && dc->debug.disable_dc_mode_overwrite) 751 + dcn30_smu_set_hard_max_by_freq(clk_mgr, PPCLK_UCLK, 752 + max((int)dc->clk_mgr->bw_params->dc_mode_softmax_memclk, khz_to_mhz_ceil(clk_mgr_base->clks.dramclk_khz))); 753 + 754 754 dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, khz_to_mhz_ceil(clk_mgr_base->clks.dramclk_khz)); 755 + } 755 756 756 757 if (clk_mgr_base->clks.num_ways != new_clocks->num_ways && 757 758 clk_mgr_base->clks.num_ways > new_clocks->num_ways) {
+3
drivers/gpu/drm/amd/display/dc/core/dc.c
··· 1801 1801 return false; 1802 1802 } 1803 1803 1804 + if (link->dpcd_caps.channel_coding_cap.bits.DP_128b_132b_SUPPORTED) 1805 + return false; 1806 + 1804 1807 if (dc->link_srv->edp_is_ilr_optimization_required(link, crtc_timing)) { 1805 1808 DC_LOG_EVENT_LINK_TRAINING("Seamless boot disabled to optimize eDP link rate\n"); 1806 1809 return false;
+2
drivers/gpu/drm/amd/display/dc/dml/dcn31/dcn31_fpu.c
··· 291 291 .do_urgent_latency_adjustment = false, 292 292 .urgent_latency_adjustment_fabric_clock_component_us = 0, 293 293 .urgent_latency_adjustment_fabric_clock_reference_mhz = 0, 294 + .dispclk_dppclk_vco_speed_mhz = 2400.0, 294 295 .num_chans = 4, 295 296 .dummy_pstate_latency_us = 10.0 296 297 }; ··· 439 438 .do_urgent_latency_adjustment = false, 440 439 .urgent_latency_adjustment_fabric_clock_component_us = 0, 441 440 .urgent_latency_adjustment_fabric_clock_reference_mhz = 0, 441 + .dispclk_dppclk_vco_speed_mhz = 2500.0, 442 442 }; 443 443 444 444 void dcn31_zero_pipe_dcc_fraction(display_e2e_pipe_params_st *pipes,
+1
drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c
··· 2449 2449 dc->caps.post_blend_color_processing = true; 2450 2450 dc->caps.force_dp_tps4_for_cp2520 = true; 2451 2451 dc->caps.extended_aux_timeout_support = true; 2452 + dc->caps.dmcub_support = true; 2452 2453 2453 2454 /* Color pipeline capabilities */ 2454 2455 dc->caps.color.dpp.dcn_arch = 1;
+3 -2
drivers/gpu/drm/imagination/pvr_fw_mips.h
··· 7 7 #include "pvr_rogue_mips.h" 8 8 9 9 #include <asm/page.h> 10 + #include <linux/math.h> 10 11 #include <linux/types.h> 11 12 12 13 /* Forward declaration from pvr_gem.h. */ 13 14 struct pvr_gem_object; 14 15 15 - #define PVR_MIPS_PT_PAGE_COUNT ((ROGUE_MIPSFW_MAX_NUM_PAGETABLE_PAGES * ROGUE_MIPSFW_PAGE_SIZE_4K) \ 16 - >> PAGE_SHIFT) 16 + #define PVR_MIPS_PT_PAGE_COUNT DIV_ROUND_UP(ROGUE_MIPSFW_MAX_NUM_PAGETABLE_PAGES * ROGUE_MIPSFW_PAGE_SIZE_4K, PAGE_SIZE) 17 + 17 18 /** 18 19 * struct pvr_fw_mips_data - MIPS-specific data 19 20 */
+3 -1
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h
··· 15 15 }; 16 16 17 17 struct nvkm_gsp_radix3 { 18 - struct nvkm_gsp_mem mem[3]; 18 + struct nvkm_gsp_mem lvl0; 19 + struct nvkm_gsp_mem lvl1; 20 + struct sg_table lvl2; 19 21 }; 20 22 21 23 int nvkm_gsp_sg(struct nvkm_device *, u64 size, struct sg_table *);
+12 -7
drivers/gpu/drm/nouveau/nvkm/core/firmware.c
··· 205 205 break; 206 206 case NVKM_FIRMWARE_IMG_DMA: 207 207 nvkm_memory_unref(&memory); 208 - dma_free_coherent(fw->device->dev, sg_dma_len(&fw->mem.sgl), fw->img, fw->phys); 208 + dma_unmap_single(fw->device->dev, fw->phys, sg_dma_len(&fw->mem.sgl), 209 + DMA_TO_DEVICE); 210 + kfree(fw->img); 209 211 break; 210 212 case NVKM_FIRMWARE_IMG_SGT: 211 213 nvkm_memory_unref(&memory); ··· 237 235 fw->img = kmemdup(src, fw->len, GFP_KERNEL); 238 236 break; 239 237 case NVKM_FIRMWARE_IMG_DMA: { 240 - dma_addr_t addr; 241 - 242 238 len = ALIGN(fw->len, PAGE_SIZE); 243 239 244 - fw->img = dma_alloc_coherent(fw->device->dev, len, &addr, GFP_KERNEL); 245 - if (fw->img) { 246 - memcpy(fw->img, src, fw->len); 247 - fw->phys = addr; 240 + fw->img = kmalloc(len, GFP_KERNEL); 241 + if (!fw->img) 242 + return -ENOMEM; 243 + 244 + memcpy(fw->img, src, fw->len); 245 + fw->phys = dma_map_single(fw->device->dev, fw->img, len, DMA_TO_DEVICE); 246 + if (dma_mapping_error(fw->device->dev, fw->phys)) { 247 + kfree(fw->img); 248 + return -EFAULT; 248 249 } 249 250 250 251 sg_init_one(&fw->mem.sgl, fw->img, len);
+52 -27
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
··· 1624 1624 meta->magic = GSP_FW_WPR_META_MAGIC; 1625 1625 meta->revision = GSP_FW_WPR_META_REVISION; 1626 1626 1627 - meta->sysmemAddrOfRadix3Elf = gsp->radix3.mem[0].addr; 1627 + meta->sysmemAddrOfRadix3Elf = gsp->radix3.lvl0.addr; 1628 1628 meta->sizeOfRadix3Elf = gsp->fb.wpr2.elf.size; 1629 1629 1630 1630 meta->sysmemAddrOfBootloader = gsp->boot.fw.addr; ··· 1919 1919 static void 1920 1920 nvkm_gsp_radix3_dtor(struct nvkm_gsp *gsp, struct nvkm_gsp_radix3 *rx3) 1921 1921 { 1922 - for (int i = ARRAY_SIZE(rx3->mem) - 1; i >= 0; i--) 1923 - nvkm_gsp_mem_dtor(gsp, &rx3->mem[i]); 1922 + nvkm_gsp_sg_free(gsp->subdev.device, &rx3->lvl2); 1923 + nvkm_gsp_mem_dtor(gsp, &rx3->lvl1); 1924 + nvkm_gsp_mem_dtor(gsp, &rx3->lvl0); 1924 1925 } 1925 1926 1926 1927 /** ··· 1961 1960 nvkm_gsp_radix3_sg(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size, 1962 1961 struct nvkm_gsp_radix3 *rx3) 1963 1962 { 1964 - u64 addr; 1963 + struct sg_dma_page_iter sg_dma_iter; 1964 + struct scatterlist *sg; 1965 + size_t bufsize; 1966 + u64 *pte; 1967 + int ret, i, page_idx = 0; 1965 1968 1966 - for (int i = ARRAY_SIZE(rx3->mem) - 1; i >= 0; i--) { 1967 - u64 *ptes; 1968 - size_t bufsize; 1969 - int ret, idx; 1969 + ret = nvkm_gsp_mem_ctor(gsp, GSP_PAGE_SIZE, &rx3->lvl0); 1970 + if (ret) 1971 + return ret; 1970 1972 1971 - bufsize = ALIGN((size / GSP_PAGE_SIZE) * sizeof(u64), GSP_PAGE_SIZE); 1972 - ret = nvkm_gsp_mem_ctor(gsp, bufsize, &rx3->mem[i]); 1973 - if (ret) 1974 - return ret; 1973 + ret = nvkm_gsp_mem_ctor(gsp, GSP_PAGE_SIZE, &rx3->lvl1); 1974 + if (ret) 1975 + goto lvl1_fail; 1975 1976 1976 - ptes = rx3->mem[i].data; 1977 - if (i == 2) { 1978 - struct scatterlist *sgl; 1977 + // Allocate level 2 1978 + bufsize = ALIGN((size / GSP_PAGE_SIZE) * sizeof(u64), GSP_PAGE_SIZE); 1979 + ret = nvkm_gsp_sg(gsp->subdev.device, bufsize, &rx3->lvl2); 1980 + if (ret) 1981 + goto lvl2_fail; 1979 1982 1980 - for_each_sgtable_dma_sg(sgt, sgl, idx) { 1981 - for (int j = 0; j < sg_dma_len(sgl) / GSP_PAGE_SIZE; j++) 1982 - *ptes++ = sg_dma_address(sgl) + (GSP_PAGE_SIZE * j); 1983 - } 1984 - } else { 1985 - for (int j = 0; j < size / GSP_PAGE_SIZE; j++) 1986 - *ptes++ = addr + GSP_PAGE_SIZE * j; 1983 + // Write the bus address of level 1 to level 0 1984 + pte = rx3->lvl0.data; 1985 + *pte = rx3->lvl1.addr; 1986 + 1987 + // Write the bus address of each page in level 2 to level 1 1988 + pte = rx3->lvl1.data; 1989 + for_each_sgtable_dma_page(&rx3->lvl2, &sg_dma_iter, 0) 1990 + *pte++ = sg_page_iter_dma_address(&sg_dma_iter); 1991 + 1992 + // Finally, write the bus address of each page in sgt to level 2 1993 + for_each_sgtable_sg(&rx3->lvl2, sg, i) { 1994 + void *sgl_end; 1995 + 1996 + pte = sg_virt(sg); 1997 + sgl_end = (void *)pte + sg->length; 1998 + 1999 + for_each_sgtable_dma_page(sgt, &sg_dma_iter, page_idx) { 2000 + *pte++ = sg_page_iter_dma_address(&sg_dma_iter); 2001 + page_idx++; 2002 + 2003 + // Go to the next scatterlist for level 2 if we've reached the end 2004 + if ((void *)pte >= sgl_end) 2005 + break; 1987 2006 } 1988 - 1989 - size = rx3->mem[i].size; 1990 - addr = rx3->mem[i].addr; 1991 2007 } 1992 2008 1993 - return 0; 2009 + if (ret) { 2010 + lvl2_fail: 2011 + nvkm_gsp_mem_dtor(gsp, &rx3->lvl1); 2012 + lvl1_fail: 2013 + nvkm_gsp_mem_dtor(gsp, &rx3->lvl0); 2014 + } 2015 + 2016 + return ret; 1994 2017 } 1995 2018 1996 2019 int ··· 2046 2021 sr = gsp->sr.meta.data; 2047 2022 sr->magic = GSP_FW_SR_META_MAGIC; 2048 2023 sr->revision = GSP_FW_SR_META_REVISION; 2049 - sr->sysmemAddrOfSuspendResumeData = gsp->sr.radix3.mem[0].addr; 2024 + sr->sysmemAddrOfSuspendResumeData = gsp->sr.radix3.lvl0.addr; 2050 2025 sr->sizeOfSuspendResumeData = len; 2051 2026 2052 2027 mbox0 = lower_32_bits(gsp->sr.meta.addr);
+1 -1
drivers/gpu/drm/panel/Kconfig
··· 177 177 178 178 config DRM_PANEL_ILITEK_ILI9341 179 179 tristate "Ilitek ILI9341 240x320 QVGA panels" 180 - depends on OF && SPI 180 + depends on SPI 181 181 select DRM_KMS_HELPER 182 182 select DRM_GEM_DMA_HELPER 183 183 depends on BACKLIGHT_CLASS_DEVICE
+7 -6
drivers/gpu/drm/panel/panel-ilitek-ili9341.c
··· 22 22 #include <linux/bitops.h> 23 23 #include <linux/delay.h> 24 24 #include <linux/gpio/consumer.h> 25 + #include <linux/mod_devicetable.h> 25 26 #include <linux/module.h> 26 - #include <linux/of.h> 27 + #include <linux/property.h> 27 28 #include <linux/regulator/consumer.h> 28 29 #include <linux/spi/spi.h> 29 30 ··· 422 421 423 422 ili9341_dpi_init(ili); 424 423 425 - return ret; 424 + return 0; 426 425 } 427 426 428 427 static int ili9341_dpi_enable(struct drm_panel *panel) ··· 692 691 * Every new incarnation of this display must have a unique 693 692 * data entry for the system in this driver. 694 693 */ 695 - ili->conf = of_device_get_match_data(dev); 694 + ili->conf = device_get_match_data(dev); 696 695 if (!ili->conf) { 697 696 dev_err(dev, "missing device configuration\n"); 698 697 return -ENODEV; ··· 715 714 716 715 reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); 717 716 if (IS_ERR(reset)) 718 - dev_err(dev, "Failed to get gpio 'reset'\n"); 717 + return dev_err_probe(dev, PTR_ERR(reset), "Failed to get gpio 'reset'\n"); 719 718 720 719 dc = devm_gpiod_get_optional(dev, "dc", GPIOD_OUT_LOW); 721 720 if (IS_ERR(dc)) 722 - dev_err(dev, "Failed to get gpio 'dc'\n"); 721 + return dev_err_probe(dev, PTR_ERR(dc), "Failed to get gpio 'dc'\n"); 723 722 724 723 if (!strcmp(id->name, "sf-tc240t-9370-t")) 725 724 return ili9341_dpi_probe(spi, dc, reset); 726 725 else if (!strcmp(id->name, "yx240qv29")) 727 726 return ili9341_dbi_probe(spi, dc, reset); 728 727 729 - return -1; 728 + return -ENODEV; 730 729 } 731 730 732 731 static void ili9341_remove(struct spi_device *spi)
+5 -45
drivers/gpu/drm/qxl/qxl_release.c
··· 58 58 signed long timeout) 59 59 { 60 60 struct qxl_device *qdev; 61 - struct qxl_release *release; 62 - int count = 0, sc = 0; 63 - bool have_drawable_releases; 64 61 unsigned long cur, end = jiffies + timeout; 65 62 66 63 qdev = container_of(fence->lock, struct qxl_device, release_lock); 67 - release = container_of(fence, struct qxl_release, base); 68 - have_drawable_releases = release->type == QXL_RELEASE_DRAWABLE; 69 64 70 - retry: 71 - sc++; 65 + if (!wait_event_timeout(qdev->release_event, 66 + (dma_fence_is_signaled(fence) || 67 + (qxl_io_notify_oom(qdev), 0)), 68 + timeout)) 69 + return 0; 72 70 73 - if (dma_fence_is_signaled(fence)) 74 - goto signaled; 75 - 76 - qxl_io_notify_oom(qdev); 77 - 78 - for (count = 0; count < 11; count++) { 79 - if (!qxl_queue_garbage_collect(qdev, true)) 80 - break; 81 - 82 - if (dma_fence_is_signaled(fence)) 83 - goto signaled; 84 - } 85 - 86 - if (dma_fence_is_signaled(fence)) 87 - goto signaled; 88 - 89 - if (have_drawable_releases || sc < 4) { 90 - if (sc > 2) 91 - /* back off */ 92 - usleep_range(500, 1000); 93 - 94 - if (time_after(jiffies, end)) 95 - return 0; 96 - 97 - if (have_drawable_releases && sc > 300) { 98 - DMA_FENCE_WARN(fence, 99 - "failed to wait on release %llu after spincount %d\n", 100 - fence->context & ~0xf0000000, sc); 101 - goto signaled; 102 - } 103 - goto retry; 104 - } 105 - /* 106 - * yeah, original sync_obj_wait gave up after 3 spins when 107 - * have_drawable_releases is not set. 108 - */ 109 - 110 - signaled: 111 71 cur = jiffies; 112 72 if (time_after(cur, end)) 113 73 return 0;
+1 -1
drivers/gpu/drm/ttm/ttm_tt.c
··· 92 92 */ 93 93 if (bdev->pool.use_dma_alloc && cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) { 94 94 page_flags |= TTM_TT_FLAG_DECRYPTED; 95 - drm_info(ddev, "TT memory decryption enabled."); 95 + drm_info_once(ddev, "TT memory decryption enabled."); 96 96 } 97 97 98 98 bo->ttm = bdev->funcs->ttm_tt_create(bo, page_flags);
+1
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
··· 204 204 VMW_BO_DOMAIN_VRAM, 205 205 VMW_BO_DOMAIN_VRAM); 206 206 buf->places[0].lpfn = PFN_UP(bo->resource->size); 207 + buf->busy_places[0].lpfn = PFN_UP(bo->resource->size); 207 208 ret = ttm_bo_validate(bo, &buf->placement, &ctx); 208 209 209 210 /* For some reason we didn't end up at the start of vram */
+1 -1
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
··· 991 991 } 992 992 993 993 event->event.base.type = DRM_VMW_EVENT_FENCE_SIGNALED; 994 - event->event.base.length = sizeof(*event); 994 + event->event.base.length = sizeof(event->event); 995 995 event->event.user_data = user_data; 996 996 997 997 ret = drm_event_reserve_init(dev, file_priv, &event->base, &event->event.base);
+2 -1
drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
··· 84 84 #define IS_ROCKETLAKE(dev_priv) IS_PLATFORM(dev_priv, XE_ROCKETLAKE) 85 85 #define IS_DG1(dev_priv) IS_PLATFORM(dev_priv, XE_DG1) 86 86 #define IS_ALDERLAKE_S(dev_priv) IS_PLATFORM(dev_priv, XE_ALDERLAKE_S) 87 - #define IS_ALDERLAKE_P(dev_priv) IS_PLATFORM(dev_priv, XE_ALDERLAKE_P) 87 + #define IS_ALDERLAKE_P(dev_priv) (IS_PLATFORM(dev_priv, XE_ALDERLAKE_P) || \ 88 + IS_PLATFORM(dev_priv, XE_ALDERLAKE_N)) 88 89 #define IS_XEHPSDV(dev_priv) (dev_priv && 0) 89 90 #define IS_DG2(dev_priv) IS_PLATFORM(dev_priv, XE_DG2) 90 91 #define IS_PONTEVECCHIO(dev_priv) IS_PLATFORM(dev_priv, XE_PVC)
+3
drivers/gpu/drm/xe/xe_vm.c
··· 1606 1606 /* xe_vm_close_and_put was not called? */ 1607 1607 xe_assert(xe, !vm->size); 1608 1608 1609 + if (xe_vm_in_preempt_fence_mode(vm)) 1610 + flush_work(&vm->preempt.rebind_work); 1611 + 1609 1612 mutex_destroy(&vm->snap_mutex); 1610 1613 1611 1614 if (!(vm->flags & XE_VM_FLAG_MIGRATION))
+85 -7
drivers/iio/accel/mxc4005.c
··· 5 5 * Copyright (c) 2014, Intel Corporation. 6 6 */ 7 7 8 + #include <linux/delay.h> 8 9 #include <linux/module.h> 9 10 #include <linux/i2c.h> 10 11 #include <linux/iio/iio.h> ··· 28 27 #define MXC4005_REG_ZOUT_UPPER 0x07 29 28 #define MXC4005_REG_ZOUT_LOWER 0x08 30 29 30 + #define MXC4005_REG_INT_MASK0 0x0A 31 + 31 32 #define MXC4005_REG_INT_MASK1 0x0B 32 33 #define MXC4005_REG_INT_MASK1_BIT_DRDYE 0x01 33 34 35 + #define MXC4005_REG_INT_CLR0 0x00 36 + 34 37 #define MXC4005_REG_INT_CLR1 0x01 35 38 #define MXC4005_REG_INT_CLR1_BIT_DRDYC 0x01 39 + #define MXC4005_REG_INT_CLR1_SW_RST 0x10 36 40 37 41 #define MXC4005_REG_CONTROL 0x0D 38 42 #define MXC4005_REG_CONTROL_MASK_FSR GENMASK(6, 5) 39 43 #define MXC4005_CONTROL_FSR_SHIFT 5 40 44 41 45 #define MXC4005_REG_DEVICE_ID 0x0E 46 + 47 + /* Datasheet does not specify a reset time, this is a conservative guess */ 48 + #define MXC4005_RESET_TIME_US 2000 42 49 43 50 enum mxc4005_axis { 44 51 AXIS_X, ··· 71 62 s64 timestamp __aligned(8); 72 63 } scan; 73 64 bool trigger_enabled; 65 + unsigned int control; 66 + unsigned int int_mask1; 74 67 }; 75 68 76 69 /* ··· 124 113 static bool mxc4005_is_writeable_reg(struct device *dev, unsigned int reg) 125 114 { 126 115 switch (reg) { 116 + case MXC4005_REG_INT_CLR0: 127 117 case MXC4005_REG_INT_CLR1: 118 + case MXC4005_REG_INT_MASK0: 128 119 case MXC4005_REG_INT_MASK1: 129 120 case MXC4005_REG_CONTROL: 130 121 return true; ··· 343 330 { 344 331 struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); 345 332 struct mxc4005_data *data = iio_priv(indio_dev); 333 + unsigned int val; 346 334 int ret; 347 335 348 336 mutex_lock(&data->mutex); 349 - if (state) { 350 - ret = regmap_write(data->regmap, MXC4005_REG_INT_MASK1, 351 - MXC4005_REG_INT_MASK1_BIT_DRDYE); 352 - } else { 353 - ret = regmap_write(data->regmap, MXC4005_REG_INT_MASK1, 354 - ~MXC4005_REG_INT_MASK1_BIT_DRDYE); 355 - } 356 337 338 + val = state ? MXC4005_REG_INT_MASK1_BIT_DRDYE : 0; 339 + ret = regmap_write(data->regmap, MXC4005_REG_INT_MASK1, val); 357 340 if (ret < 0) { 358 341 mutex_unlock(&data->mutex); 359 342 dev_err(data->dev, "failed to update reg_int_mask1"); 360 343 return ret; 361 344 } 362 345 346 + data->int_mask1 = val; 363 347 data->trigger_enabled = state; 364 348 mutex_unlock(&data->mutex); 365 349 ··· 391 381 } 392 382 393 383 dev_dbg(data->dev, "MXC4005 chip id %02x\n", reg); 384 + 385 + ret = regmap_write(data->regmap, MXC4005_REG_INT_CLR1, 386 + MXC4005_REG_INT_CLR1_SW_RST); 387 + if (ret < 0) 388 + return dev_err_probe(data->dev, ret, "resetting chip\n"); 389 + 390 + fsleep(MXC4005_RESET_TIME_US); 391 + 392 + ret = regmap_write(data->regmap, MXC4005_REG_INT_MASK0, 0); 393 + if (ret < 0) 394 + return dev_err_probe(data->dev, ret, "writing INT_MASK0\n"); 395 + 396 + ret = regmap_write(data->regmap, MXC4005_REG_INT_MASK1, 0); 397 + if (ret < 0) 398 + return dev_err_probe(data->dev, ret, "writing INT_MASK1\n"); 394 399 395 400 return 0; 396 401 } ··· 494 469 return devm_iio_device_register(&client->dev, indio_dev); 495 470 } 496 471 472 + static int mxc4005_suspend(struct device *dev) 473 + { 474 + struct iio_dev *indio_dev = dev_get_drvdata(dev); 475 + struct mxc4005_data *data = iio_priv(indio_dev); 476 + int ret; 477 + 478 + /* Save control to restore it on resume */ 479 + ret = regmap_read(data->regmap, MXC4005_REG_CONTROL, &data->control); 480 + if (ret < 0) 481 + dev_err(data->dev, "failed to read reg_control\n"); 482 + 483 + return ret; 484 + } 485 + 486 + static int mxc4005_resume(struct device *dev) 487 + { 488 + struct iio_dev *indio_dev = dev_get_drvdata(dev); 489 + struct mxc4005_data *data = iio_priv(indio_dev); 490 + int ret; 491 + 492 + ret = regmap_write(data->regmap, MXC4005_REG_INT_CLR1, 493 + MXC4005_REG_INT_CLR1_SW_RST); 494 + if (ret) { 495 + dev_err(data->dev, "failed to reset chip: %d\n", ret); 496 + return ret; 497 + } 498 + 499 + fsleep(MXC4005_RESET_TIME_US); 500 + 501 + ret = regmap_write(data->regmap, MXC4005_REG_CONTROL, data->control); 502 + if (ret) { 503 + dev_err(data->dev, "failed to restore control register\n"); 504 + return ret; 505 + } 506 + 507 + ret = regmap_write(data->regmap, MXC4005_REG_INT_MASK0, 0); 508 + if (ret) { 509 + dev_err(data->dev, "failed to restore interrupt 0 mask\n"); 510 + return ret; 511 + } 512 + 513 + ret = regmap_write(data->regmap, MXC4005_REG_INT_MASK1, data->int_mask1); 514 + if (ret) { 515 + dev_err(data->dev, "failed to restore interrupt 1 mask\n"); 516 + return ret; 517 + } 518 + 519 + return 0; 520 + } 521 + 522 + static DEFINE_SIMPLE_DEV_PM_OPS(mxc4005_pm_ops, mxc4005_suspend, mxc4005_resume); 523 + 497 524 static const struct acpi_device_id mxc4005_acpi_match[] = { 498 525 {"MXC4005", 0}, 499 526 {"MXC6655", 0}, ··· 573 496 .name = MXC4005_DRV_NAME, 574 497 .acpi_match_table = mxc4005_acpi_match, 575 498 .of_match_table = mxc4005_of_match, 499 + .pm = pm_sleep_ptr(&mxc4005_pm_ops), 576 500 }, 577 501 .probe = mxc4005_probe, 578 502 .id_table = mxc4005_id,
+3 -1
drivers/iio/imu/adis16475.c
··· 1289 1289 struct device *dev = &st->adis.spi->dev; 1290 1290 const struct adis16475_sync *sync; 1291 1291 u32 sync_mode; 1292 + u16 val; 1292 1293 1293 1294 /* default to internal clk */ 1294 1295 st->clk_freq = st->info->int_clk * 1000; ··· 1351 1350 * I'm keeping this for simplicity and avoiding extra variables 1352 1351 * in chip_info. 1353 1352 */ 1353 + val = ADIS16475_SYNC_MODE(sync->sync_mode); 1354 1354 ret = __adis_update_bits(&st->adis, ADIS16475_REG_MSG_CTRL, 1355 - ADIS16475_SYNC_MODE_MASK, sync->sync_mode); 1355 + ADIS16475_SYNC_MODE_MASK, val); 1356 1356 if (ret) 1357 1357 return ret; 1358 1358
+1
drivers/iio/pressure/bmp280-core.c
··· 1233 1233 .chip_id = bmp380_chip_ids, 1234 1234 .num_chip_id = ARRAY_SIZE(bmp380_chip_ids), 1235 1235 .regmap_config = &bmp380_regmap_config, 1236 + .spi_read_extra_byte = true, 1236 1237 .start_up_time = 2000, 1237 1238 .channels = bmp380_channels, 1238 1239 .num_channels = 2,
+4 -9
drivers/iio/pressure/bmp280-spi.c
··· 96 96 97 97 chip_info = spi_get_device_match_data(spi); 98 98 99 - switch (chip_info->chip_id[0]) { 100 - case BMP380_CHIP_ID: 101 - case BMP390_CHIP_ID: 99 + if (chip_info->spi_read_extra_byte) 102 100 bmp_regmap_bus = &bmp380_regmap_bus; 103 - break; 104 - default: 101 + else 105 102 bmp_regmap_bus = &bmp280_regmap_bus; 106 - break; 107 - } 108 103 109 104 regmap = devm_regmap_init(&spi->dev, 110 105 bmp_regmap_bus, ··· 122 127 { .compatible = "bosch,bmp180", .data = &bmp180_chip_info }, 123 128 { .compatible = "bosch,bmp181", .data = &bmp180_chip_info }, 124 129 { .compatible = "bosch,bmp280", .data = &bmp280_chip_info }, 125 - { .compatible = "bosch,bme280", .data = &bmp280_chip_info }, 130 + { .compatible = "bosch,bme280", .data = &bme280_chip_info }, 126 131 { .compatible = "bosch,bmp380", .data = &bmp380_chip_info }, 127 132 { .compatible = "bosch,bmp580", .data = &bmp580_chip_info }, 128 133 { }, ··· 134 139 { "bmp180", (kernel_ulong_t)&bmp180_chip_info }, 135 140 { "bmp181", (kernel_ulong_t)&bmp180_chip_info }, 136 141 { "bmp280", (kernel_ulong_t)&bmp280_chip_info }, 137 - { "bme280", (kernel_ulong_t)&bmp280_chip_info }, 142 + { "bme280", (kernel_ulong_t)&bme280_chip_info }, 138 143 { "bmp380", (kernel_ulong_t)&bmp380_chip_info }, 139 144 { "bmp580", (kernel_ulong_t)&bmp580_chip_info }, 140 145 { }
+1
drivers/iio/pressure/bmp280.h
··· 423 423 int num_chip_id; 424 424 425 425 const struct regmap_config *regmap_config; 426 + bool spi_read_extra_byte; 426 427 427 428 const struct iio_chan_spec *channels; 428 429 int num_channels;
+1
drivers/infiniband/hw/qib/qib_fs.c
··· 439 439 return PTR_ERR(dir); 440 440 } 441 441 simple_recursive_removal(dir, NULL); 442 + dput(dir); 442 443 return 0; 443 444 } 444 445
+2
drivers/input/joystick/xpad.c
··· 208 208 { 0x0738, 0xcb29, "Saitek Aviator Stick AV8R02", 0, XTYPE_XBOX360 }, 209 209 { 0x0738, 0xf738, "Super SFIV FightStick TE S", 0, XTYPE_XBOX360 }, 210 210 { 0x07ff, 0xffff, "Mad Catz GamePad", 0, XTYPE_XBOX360 }, 211 + { 0x0b05, 0x1a38, "ASUS ROG RAIKIRI", 0, XTYPE_XBOXONE }, 211 212 { 0x0c12, 0x0005, "Intec wireless", 0, XTYPE_XBOX }, 212 213 { 0x0c12, 0x8801, "Nyko Xbox Controller", 0, XTYPE_XBOX }, 213 214 { 0x0c12, 0x8802, "Zeroplus Xbox Controller", 0, XTYPE_XBOX }, ··· 488 487 { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ 489 488 XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ 490 489 XPAD_XBOX360_VENDOR(0x07ff), /* Mad Catz Gamepad */ 490 + XPAD_XBOXONE_VENDOR(0x0b05), /* ASUS controllers */ 491 491 XPAD_XBOX360_VENDOR(0x0c12), /* Zeroplus X-Box 360 controllers */ 492 492 XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f Xbox 360 controllers */ 493 493 XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f Xbox One controllers */
+7 -1
drivers/input/mouse/amimouse.c
··· 132 132 input_unregister_device(dev); 133 133 } 134 134 135 - static struct platform_driver amimouse_driver = { 135 + /* 136 + * amimouse_remove() lives in .exit.text. For drivers registered via 137 + * module_platform_driver_probe() this is ok because they cannot get unbound at 138 + * runtime. So mark the driver struct with __refdata to prevent modpost 139 + * triggering a section mismatch warning. 140 + */ 141 + static struct platform_driver amimouse_driver __refdata = { 136 142 .remove_new = __exit_p(amimouse_remove), 137 143 .driver = { 138 144 .name = "amiga-mouse",
+2
drivers/misc/mei/hw-me-regs.h
··· 115 115 #define MEI_DEV_ID_ARL_S 0x7F68 /* Arrow Lake Point S */ 116 116 #define MEI_DEV_ID_ARL_H 0x7770 /* Arrow Lake Point H */ 117 117 118 + #define MEI_DEV_ID_LNL_M 0xA870 /* Lunar Lake Point M */ 119 + 118 120 /* 119 121 * MEI HW Section 120 122 */
+2
drivers/misc/mei/pci-me.c
··· 122 122 {MEI_PCI_DEVICE(MEI_DEV_ID_ARL_S, MEI_ME_PCH15_CFG)}, 123 123 {MEI_PCI_DEVICE(MEI_DEV_ID_ARL_H, MEI_ME_PCH15_CFG)}, 124 124 125 + {MEI_PCI_DEVICE(MEI_DEV_ID_LNL_M, MEI_ME_PCH15_CFG)}, 126 + 125 127 /* required last entry */ 126 128 {0, } 127 129 };
+5 -2
drivers/misc/mei/pxp/mei_pxp.c
··· 236 236 237 237 pdev = to_pci_dev(dev); 238 238 239 - if (pdev->class != (PCI_CLASS_DISPLAY_VGA << 8) || 240 - pdev->vendor != PCI_VENDOR_ID_INTEL) 239 + if (pdev->vendor != PCI_VENDOR_ID_INTEL) 240 + return 0; 241 + 242 + if (pdev->class != (PCI_CLASS_DISPLAY_VGA << 8) && 243 + pdev->class != (PCI_CLASS_DISPLAY_OTHER << 8)) 241 244 return 0; 242 245 243 246 if (subcomponent != I915_COMPONENT_PXP)
+1 -3
drivers/misc/pvpanic/pvpanic-pci.c
··· 44 44 .name = "pvpanic-pci", 45 45 .id_table = pvpanic_pci_id_tbl, 46 46 .probe = pvpanic_pci_probe, 47 - .driver = { 48 - .dev_groups = pvpanic_dev_groups, 49 - }, 47 + .dev_groups = pvpanic_dev_groups, 50 48 }; 51 49 module_pci_driver(pvpanic_pci_driver);
+31 -8
drivers/net/dsa/mv88e6xxx/chip.c
··· 637 637 MAC_1000FD; 638 638 } 639 639 640 - static int mv88e6352_get_port4_serdes_cmode(struct mv88e6xxx_chip *chip) 640 + static int mv88e63xx_get_port_serdes_cmode(struct mv88e6xxx_chip *chip, int port) 641 641 { 642 642 u16 reg, val; 643 643 int err; 644 644 645 - err = mv88e6xxx_port_read(chip, 4, MV88E6XXX_PORT_STS, &reg); 645 + err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, &reg); 646 646 if (err) 647 647 return err; 648 648 ··· 651 651 return 0xf; 652 652 653 653 val = reg & ~MV88E6XXX_PORT_STS_PHY_DETECT; 654 - err = mv88e6xxx_port_write(chip, 4, MV88E6XXX_PORT_STS, val); 654 + err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_STS, val); 655 655 if (err) 656 656 return err; 657 657 658 - err = mv88e6xxx_port_read(chip, 4, MV88E6XXX_PORT_STS, &val); 658 + err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, &val); 659 659 if (err) 660 660 return err; 661 661 662 662 /* Restore PHY_DETECT value */ 663 - err = mv88e6xxx_port_write(chip, 4, MV88E6XXX_PORT_STS, reg); 663 + err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_STS, reg); 664 664 if (err) 665 665 return err; 666 666 ··· 688 688 if (err <= 0) 689 689 return; 690 690 691 - cmode = mv88e6352_get_port4_serdes_cmode(chip); 691 + cmode = mv88e63xx_get_port_serdes_cmode(chip, port); 692 + if (cmode < 0) 693 + dev_err(chip->dev, "p%d: failed to read serdes cmode\n", 694 + port); 695 + else 696 + mv88e6xxx_translate_cmode(cmode, supported); 697 + } 698 + } 699 + 700 + static void mv88e632x_phylink_get_caps(struct mv88e6xxx_chip *chip, int port, 701 + struct phylink_config *config) 702 + { 703 + unsigned long *supported = config->supported_interfaces; 704 + int cmode; 705 + 706 + /* Translate the default cmode */ 707 + mv88e6xxx_translate_cmode(chip->ports[port].cmode, supported); 708 + 709 + config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100 | 710 + MAC_1000FD; 711 + 712 + /* Port 0/1 are serdes only ports */ 713 + if (port == 0 || port == 1) { 714 + cmode = mv88e63xx_get_port_serdes_cmode(chip, port); 692 715 if (cmode < 0) 693 716 dev_err(chip->dev, "p%d: failed to read serdes cmode\n", 694 717 port); ··· 5157 5134 .gpio_ops = &mv88e6352_gpio_ops, 5158 5135 .avb_ops = &mv88e6352_avb_ops, 5159 5136 .ptp_ops = &mv88e6352_ptp_ops, 5160 - .phylink_get_caps = mv88e6185_phylink_get_caps, 5137 + .phylink_get_caps = mv88e632x_phylink_get_caps, 5161 5138 }; 5162 5139 5163 5140 static const struct mv88e6xxx_ops mv88e6321_ops = { ··· 5205 5182 .gpio_ops = &mv88e6352_gpio_ops, 5206 5183 .avb_ops = &mv88e6352_avb_ops, 5207 5184 .ptp_ops = &mv88e6352_ptp_ops, 5208 - .phylink_get_caps = mv88e6185_phylink_get_caps, 5185 + .phylink_get_caps = mv88e632x_phylink_get_caps, 5209 5186 }; 5210 5187 5211 5188 static const struct mv88e6xxx_ops mv88e6341_ops = {
+1 -1
drivers/net/ethernet/hisilicon/hns3/hnae3.h
··· 910 910 struct hnae3_roce_private_info rinfo; 911 911 }; 912 912 913 - u32 numa_node_mask; /* for multi-chip support */ 913 + nodemask_t numa_node_mask; /* for multi-chip support */ 914 914 915 915 enum hnae3_port_base_vlan_state port_base_vlan_state; 916 916
+28 -24
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
··· 1581 1581 cfg.default_speed, ret); 1582 1582 return ret; 1583 1583 } 1584 + hdev->hw.mac.req_speed = hdev->hw.mac.speed; 1585 + hdev->hw.mac.req_autoneg = AUTONEG_ENABLE; 1586 + hdev->hw.mac.req_duplex = DUPLEX_FULL; 1584 1587 1585 1588 hclge_parse_link_mode(hdev, cfg.speed_ability); 1586 1589 ··· 1813 1810 1814 1811 nic->pdev = hdev->pdev; 1815 1812 nic->ae_algo = &ae_algo; 1816 - nic->numa_node_mask = hdev->numa_node_mask; 1813 + bitmap_copy(nic->numa_node_mask.bits, hdev->numa_node_mask.bits, 1814 + MAX_NUMNODES); 1817 1815 nic->kinfo.io_base = hdev->hw.hw.io_base; 1818 1816 1819 1817 ret = hclge_knic_setup(vport, num_tqps, ··· 2506 2502 2507 2503 roce->pdev = nic->pdev; 2508 2504 roce->ae_algo = nic->ae_algo; 2509 - roce->numa_node_mask = nic->numa_node_mask; 2505 + bitmap_copy(roce->numa_node_mask.bits, nic->numa_node_mask.bits, 2506 + MAX_NUMNODES); 2510 2507 2511 2508 return 0; 2512 2509 } ··· 3391 3386 return ret; 3392 3387 } 3393 3388 3394 - hdev->hw.mac.autoneg = cmd->base.autoneg; 3395 - hdev->hw.mac.speed = cmd->base.speed; 3396 - hdev->hw.mac.duplex = cmd->base.duplex; 3389 + hdev->hw.mac.req_autoneg = cmd->base.autoneg; 3390 + hdev->hw.mac.req_speed = cmd->base.speed; 3391 + hdev->hw.mac.req_duplex = cmd->base.duplex; 3397 3392 linkmode_copy(hdev->hw.mac.advertising, cmd->link_modes.advertising); 3398 3393 3399 3394 return 0; ··· 3426 3421 if (!hnae3_dev_phy_imp_supported(hdev)) 3427 3422 return 0; 3428 3423 3429 - cmd.base.autoneg = hdev->hw.mac.autoneg; 3430 - cmd.base.speed = hdev->hw.mac.speed; 3431 - cmd.base.duplex = hdev->hw.mac.duplex; 3424 + cmd.base.autoneg = hdev->hw.mac.req_autoneg; 3425 + cmd.base.speed = hdev->hw.mac.req_speed; 3426 + cmd.base.duplex = hdev->hw.mac.req_duplex; 3432 3427 linkmode_copy(cmd.link_modes.advertising, hdev->hw.mac.advertising); 3433 3428 3434 3429 return hclge_set_phy_link_ksettings(&hdev->vport->nic, &cmd); ··· 8013 8008 /* Set the DOWN flag here to disable link updating */ 8014 8009 set_bit(HCLGE_STATE_DOWN, &hdev->state); 8015 8010 8016 - /* flush memory to make sure DOWN is seen by service task */ 8017 - smp_mb__before_atomic(); 8011 + smp_mb__after_atomic(); /* flush memory to make sure DOWN is seen by service task */ 8018 8012 hclge_flush_link_update(hdev); 8019 8013 } 8020 8014 } ··· 9966 9962 static int hclge_init_vlan_filter(struct hclge_dev *hdev) 9967 9963 { 9968 9964 struct hclge_vport *vport; 9965 + bool enable = true; 9969 9966 int ret; 9970 9967 int i; 9971 9968 ··· 9986 9981 vport->cur_vlan_fltr_en = true; 9987 9982 } 9988 9983 9984 + if (test_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, hdev->ae_dev->caps) && 9985 + !test_bit(HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B, hdev->ae_dev->caps)) 9986 + enable = false; 9987 + 9989 9988 return hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_PORT, 9990 - HCLGE_FILTER_FE_INGRESS, true, 0); 9989 + HCLGE_FILTER_FE_INGRESS, enable, 0); 9991 9990 } 9992 9991 9993 9992 static int hclge_init_vlan_type(struct hclge_dev *hdev) ··· 11705 11696 if (ret) 11706 11697 goto out; 11707 11698 11708 - ret = hclge_devlink_init(hdev); 11709 - if (ret) 11710 - goto err_pci_uninit; 11711 - 11712 - devl_lock(hdev->devlink); 11713 - 11714 11699 /* Firmware command queue initialize */ 11715 11700 ret = hclge_comm_cmd_queue_init(hdev->pdev, &hdev->hw.hw); 11716 11701 if (ret) 11717 - goto err_devlink_uninit; 11702 + goto err_pci_uninit; 11718 11703 11719 11704 /* Firmware command initialize */ 11720 11705 hclge_comm_cmd_init_ops(&hdev->hw.hw, &hclge_cmq_ops); ··· 11837 11834 11838 11835 ret = hclge_update_port_info(hdev); 11839 11836 if (ret) 11840 - goto err_mdiobus_unreg; 11837 + goto err_ptp_uninit; 11841 11838 11842 11839 INIT_KFIFO(hdev->mac_tnl_log); 11843 11840 ··· 11877 11874 dev_warn(&pdev->dev, 11878 11875 "failed to wake on lan init, ret = %d\n", ret); 11879 11876 11877 + ret = hclge_devlink_init(hdev); 11878 + if (ret) 11879 + goto err_ptp_uninit; 11880 + 11880 11881 hclge_state_init(hdev); 11881 11882 hdev->last_reset_time = jiffies; 11882 11883 ··· 11888 11881 HCLGE_DRIVER_NAME); 11889 11882 11890 11883 hclge_task_schedule(hdev, round_jiffies_relative(HZ)); 11891 - 11892 - devl_unlock(hdev->devlink); 11893 11884 return 0; 11894 11885 11886 + err_ptp_uninit: 11887 + hclge_ptp_uninit(hdev); 11895 11888 err_mdiobus_unreg: 11896 11889 if (hdev->hw.mac.phydev) 11897 11890 mdiobus_unregister(hdev->hw.mac.mdio_bus); ··· 11901 11894 pci_free_irq_vectors(pdev); 11902 11895 err_cmd_uninit: 11903 11896 hclge_comm_cmd_uninit(hdev->ae_dev, &hdev->hw.hw); 11904 - err_devlink_uninit: 11905 - devl_unlock(hdev->devlink); 11906 - hclge_devlink_uninit(hdev); 11907 11897 err_pci_uninit: 11908 11898 pcim_iounmap(pdev, hdev->hw.hw.io_base); 11909 11899 pci_release_regions(pdev);
+4 -1
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
··· 279 279 u8 media_type; /* port media type, e.g. fibre/copper/backplane */ 280 280 u8 mac_addr[ETH_ALEN]; 281 281 u8 autoneg; 282 + u8 req_autoneg; 282 283 u8 duplex; 284 + u8 req_duplex; 283 285 u8 support_autoneg; 284 286 u8 speed_type; /* 0: sfp speed, 1: active speed */ 285 287 u8 lane_num; 286 288 u32 speed; 289 + u32 req_speed; 287 290 u32 max_speed; 288 291 u32 speed_ability; /* speed ability supported by current media */ 289 292 u32 module_type; /* sub media type, e.g. kr/cr/sr/lr */ ··· 894 891 895 892 u16 fdir_pf_filter_count; /* Num of guaranteed filters for this PF */ 896 893 u16 num_alloc_vport; /* Num vports this driver supports */ 897 - u32 numa_node_mask; 894 + nodemask_t numa_node_mask; 898 895 u16 rx_buf_len; 899 896 u16 num_tx_desc; /* desc num of per tx queue */ 900 897 u16 num_rx_desc; /* desc num of per rx queue */
+4 -3
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
··· 1077 1077 1078 1078 hdev = param->vport->back; 1079 1079 cmd_func = hclge_mbx_ops_list[param->req->msg.code]; 1080 - if (cmd_func) 1081 - ret = cmd_func(param); 1082 - else 1080 + if (!cmd_func) { 1083 1081 dev_err(&hdev->pdev->dev, 1084 1082 "un-supported mailbox message, code = %u\n", 1085 1083 param->req->msg.code); 1084 + return; 1085 + } 1086 + ret = cmd_func(param); 1086 1087 1087 1088 /* PF driver should not reply IMP */ 1088 1089 if (hnae3_get_bit(param->req->mbx_need_resp, HCLGE_MBX_NEED_RESP_B) &&
+9 -11
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
··· 449 449 450 450 nic->ae_algo = &ae_algovf; 451 451 nic->pdev = hdev->pdev; 452 - nic->numa_node_mask = hdev->numa_node_mask; 452 + bitmap_copy(nic->numa_node_mask.bits, hdev->numa_node_mask.bits, 453 + MAX_NUMNODES); 453 454 nic->flags |= HNAE3_SUPPORT_VF; 454 455 nic->kinfo.io_base = hdev->hw.hw.io_base; 455 456 ··· 2120 2119 2121 2120 roce->pdev = nic->pdev; 2122 2121 roce->ae_algo = nic->ae_algo; 2123 - roce->numa_node_mask = nic->numa_node_mask; 2124 - 2122 + bitmap_copy(roce->numa_node_mask.bits, nic->numa_node_mask.bits, 2123 + MAX_NUMNODES); 2125 2124 return 0; 2126 2125 } 2127 2126 ··· 2218 2217 } else { 2219 2218 set_bit(HCLGEVF_STATE_DOWN, &hdev->state); 2220 2219 2221 - /* flush memory to make sure DOWN is seen by service task */ 2222 - smp_mb__before_atomic(); 2220 + smp_mb__after_atomic(); /* flush memory to make sure DOWN is seen by service task */ 2223 2221 hclgevf_flush_link_update(hdev); 2224 2222 } 2225 2223 } ··· 2883 2883 if (ret) 2884 2884 return ret; 2885 2885 2886 - ret = hclgevf_devlink_init(hdev); 2887 - if (ret) 2888 - goto err_devlink_init; 2889 - 2890 2886 ret = hclge_comm_cmd_queue_init(hdev->pdev, &hdev->hw.hw); 2891 2887 if (ret) 2892 2888 goto err_cmd_queue_init; ··· 2977 2981 2978 2982 hclgevf_init_rxd_adv_layout(hdev); 2979 2983 2984 + ret = hclgevf_devlink_init(hdev); 2985 + if (ret) 2986 + goto err_config; 2987 + 2980 2988 set_bit(HCLGEVF_STATE_SERVICE_INITED, &hdev->state); 2981 2989 2982 2990 hdev->last_reset_time = jiffies; ··· 3000 3000 err_cmd_init: 3001 3001 hclge_comm_cmd_uninit(hdev->ae_dev, &hdev->hw.hw); 3002 3002 err_cmd_queue_init: 3003 - hclgevf_devlink_uninit(hdev); 3004 - err_devlink_init: 3005 3003 hclgevf_pci_uninit(hdev); 3006 3004 clear_bit(HCLGEVF_STATE_IRQ_INITED, &hdev->state); 3007 3005 return ret;
+1 -1
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h
··· 236 236 u16 rss_size_max; /* HW defined max RSS task queue */ 237 237 238 238 u16 num_alloc_vport; /* num vports this driver supports */ 239 - u32 numa_node_mask; 239 + nodemask_t numa_node_mask; 240 240 u16 rx_buf_len; 241 241 u16 num_tx_desc; /* desc num of per tx queue */ 242 242 u16 num_rx_desc; /* desc num of per rx queue */
+10 -6
drivers/net/ethernet/micrel/ks8851_common.c
··· 234 234 /** 235 235 * ks8851_rx_pkts - receive packets from the host 236 236 * @ks: The device information. 237 + * @rxq: Queue of packets received in this function. 237 238 * 238 239 * This is called from the IRQ work queue when the system detects that there 239 240 * are packets in the receive queue. Find out how many packets there are and 240 241 * read them from the FIFO. 241 242 */ 242 - static void ks8851_rx_pkts(struct ks8851_net *ks) 243 + static void ks8851_rx_pkts(struct ks8851_net *ks, struct sk_buff_head *rxq) 243 244 { 244 245 struct sk_buff *skb; 245 246 unsigned rxfc; ··· 300 299 ks8851_dbg_dumpkkt(ks, rxpkt); 301 300 302 301 skb->protocol = eth_type_trans(skb, ks->netdev); 303 - __netif_rx(skb); 302 + __skb_queue_tail(rxq, skb); 304 303 305 304 ks->netdev->stats.rx_packets++; 306 305 ks->netdev->stats.rx_bytes += rxlen; ··· 327 326 static irqreturn_t ks8851_irq(int irq, void *_ks) 328 327 { 329 328 struct ks8851_net *ks = _ks; 329 + struct sk_buff_head rxq; 330 330 unsigned handled = 0; 331 331 unsigned long flags; 332 332 unsigned int status; 333 - 334 - local_bh_disable(); 333 + struct sk_buff *skb; 335 334 336 335 ks8851_lock(ks, &flags); 337 336 ··· 385 384 * from the device so do not bother masking just the RX 386 385 * from the device. */ 387 386 388 - ks8851_rx_pkts(ks); 387 + __skb_queue_head_init(&rxq); 388 + ks8851_rx_pkts(ks, &rxq); 389 389 } 390 390 391 391 /* if something stopped the rx process, probably due to wanting ··· 410 408 if (status & IRQ_LCI) 411 409 mii_check_link(&ks->mii); 412 410 413 - local_bh_enable(); 411 + if (status & IRQ_RXI) 412 + while ((skb = __skb_dequeue(&rxq))) 413 + netif_rx(skb); 414 414 415 415 return IRQ_HANDLED; 416 416 }
+103 -16
drivers/net/phy/marvell-88q2xxx.c
··· 12 12 #include <linux/hwmon.h> 13 13 14 14 #define PHY_ID_88Q2220_REVB0 (MARVELL_PHY_ID_88Q2220 | 0x1) 15 + #define PHY_ID_88Q2220_REVB1 (MARVELL_PHY_ID_88Q2220 | 0x2) 16 + #define PHY_ID_88Q2220_REVB2 (MARVELL_PHY_ID_88Q2220 | 0x3) 15 17 16 18 #define MDIO_MMD_AN_MV_STAT 32769 17 19 #define MDIO_MMD_AN_MV_STAT_ANEG 0x0100 ··· 129 127 { MDIO_MMD_PCS, 0xfe79, 0x4 }, 130 128 { MDIO_MMD_PCS, 0xfe5f, 0xe8 }, 131 129 { MDIO_MMD_PCS, 0xfe05, 0x755c }, 130 + }; 131 + 132 + static const struct mmd_val mv88q222x_revb1_init_seq0[] = { 133 + { MDIO_MMD_PCS, 0xffe4, 0x0007 }, 134 + { MDIO_MMD_AN, MDIO_AN_T1_CTRL, 0x0 }, 135 + { MDIO_MMD_PCS, 0xffe3, 0x7000 }, 136 + { MDIO_MMD_PMAPMD, MDIO_CTRL1, 0x0840 }, 137 + }; 138 + 139 + static const struct mmd_val mv88q222x_revb2_init_seq0[] = { 140 + { MDIO_MMD_PCS, 0xffe4, 0x0007 }, 141 + { MDIO_MMD_AN, MDIO_AN_T1_CTRL, 0x0 }, 142 + { MDIO_MMD_PMAPMD, MDIO_CTRL1, 0x0840 }, 143 + }; 144 + 145 + static const struct mmd_val mv88q222x_revb1_revb2_init_seq1[] = { 146 + { MDIO_MMD_PCS, 0xfe07, 0x125a }, 147 + { MDIO_MMD_PCS, 0xfe09, 0x1288 }, 148 + { MDIO_MMD_PCS, 0xfe08, 0x2588 }, 149 + { MDIO_MMD_PCS, 0xfe72, 0x042c }, 150 + { MDIO_MMD_PCS, 0xffe4, 0x0071 }, 151 + { MDIO_MMD_PCS, 0xffe4, 0x0001 }, 152 + { MDIO_MMD_PCS, 0xfe1b, 0x0048 }, 153 + { MDIO_MMD_PMAPMD, 0x0000, 0x0000 }, 154 + { MDIO_MMD_PCS, 0x0000, 0x0000 }, 155 + { MDIO_MMD_PCS, 0xffdb, 0xfc10 }, 156 + { MDIO_MMD_PCS, 0xfe1b, 0x58 }, 157 + { MDIO_MMD_PCS, 0xfcad, 0x030c }, 158 + { MDIO_MMD_PCS, 0x8032, 0x6001 }, 159 + { MDIO_MMD_PCS, 0xfdff, 0x05a5 }, 160 + { MDIO_MMD_PCS, 0xfdec, 0xdbaf }, 161 + { MDIO_MMD_PCS, 0xfcab, 0x1054 }, 162 + { MDIO_MMD_PCS, 0xfcac, 0x1483 }, 163 + { MDIO_MMD_PCS, 0x8033, 0xc801 }, 164 + { MDIO_MMD_AN, 0x8032, 0x2020 }, 165 + { MDIO_MMD_AN, 0x8031, 0xa28 }, 166 + { MDIO_MMD_AN, 0x8031, 0xc28 }, 167 + { MDIO_MMD_PCS, 0xfbba, 0x0cb2 }, 168 + { MDIO_MMD_PCS, 0xfbbb, 0x0c4a }, 169 + { MDIO_MMD_PCS, 0xfe5f, 0xe8 }, 170 + { MDIO_MMD_PCS, 0xfe05, 0x755c }, 171 + { MDIO_MMD_PCS, 0xfa20, 0x002a }, 172 + { MDIO_MMD_PCS, 0xfe11, 0x1105 }, 132 173 }; 133 174 134 175 static int mv88q2xxx_soft_reset(struct phy_device *phydev) ··· 732 687 return 0; 733 688 } 734 689 735 - static int mv88q222x_revb0_config_init(struct phy_device *phydev) 690 + static int mv88q222x_write_mmd_vals(struct phy_device *phydev, 691 + const struct mmd_val *vals, size_t len) 736 692 { 737 - int ret, i; 693 + int ret; 738 694 739 - for (i = 0; i < ARRAY_SIZE(mv88q222x_revb0_init_seq0); i++) { 740 - ret = phy_write_mmd(phydev, mv88q222x_revb0_init_seq0[i].devad, 741 - mv88q222x_revb0_init_seq0[i].regnum, 742 - mv88q222x_revb0_init_seq0[i].val); 695 + for (; len; vals++, len--) { 696 + ret = phy_write_mmd(phydev, vals->devad, vals->regnum, 697 + vals->val); 743 698 if (ret < 0) 744 699 return ret; 745 700 } 701 + 702 + return 0; 703 + } 704 + 705 + static int mv88q222x_revb0_config_init(struct phy_device *phydev) 706 + { 707 + int ret; 708 + 709 + ret = mv88q222x_write_mmd_vals(phydev, mv88q222x_revb0_init_seq0, 710 + ARRAY_SIZE(mv88q222x_revb0_init_seq0)); 711 + if (ret < 0) 712 + return ret; 746 713 747 714 usleep_range(5000, 10000); 748 715 749 - for (i = 0; i < ARRAY_SIZE(mv88q222x_revb0_init_seq1); i++) { 750 - ret = phy_write_mmd(phydev, mv88q222x_revb0_init_seq1[i].devad, 751 - mv88q222x_revb0_init_seq1[i].regnum, 752 - mv88q222x_revb0_init_seq1[i].val); 753 - if (ret < 0) 754 - return ret; 755 - } 716 + ret = mv88q222x_write_mmd_vals(phydev, mv88q222x_revb0_init_seq1, 717 + ARRAY_SIZE(mv88q222x_revb0_init_seq1)); 718 + if (ret < 0) 719 + return ret; 756 720 757 721 return mv88q2xxx_config_init(phydev); 722 + } 723 + 724 + static int mv88q222x_revb1_revb2_config_init(struct phy_device *phydev) 725 + { 726 + bool is_rev_b1 = phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] == PHY_ID_88Q2220_REVB1; 727 + int ret; 728 + 729 + if (is_rev_b1) 730 + ret = mv88q222x_write_mmd_vals(phydev, mv88q222x_revb1_init_seq0, 731 + ARRAY_SIZE(mv88q222x_revb1_init_seq0)); 732 + else 733 + ret = mv88q222x_write_mmd_vals(phydev, mv88q222x_revb2_init_seq0, 734 + ARRAY_SIZE(mv88q222x_revb2_init_seq0)); 735 + if (ret < 0) 736 + return ret; 737 + 738 + usleep_range(3000, 5000); 739 + 740 + ret = mv88q222x_write_mmd_vals(phydev, mv88q222x_revb1_revb2_init_seq1, 741 + ARRAY_SIZE(mv88q222x_revb1_revb2_init_seq1)); 742 + if (ret < 0) 743 + return ret; 744 + 745 + return mv88q2xxx_config_init(phydev); 746 + } 747 + 748 + static int mv88q222x_config_init(struct phy_device *phydev) 749 + { 750 + if (phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] == PHY_ID_88Q2220_REVB0) 751 + return mv88q222x_revb0_config_init(phydev); 752 + else 753 + return mv88q222x_revb1_revb2_config_init(phydev); 758 754 } 759 755 760 756 static int mv88q222x_cable_test_start(struct phy_device *phydev) ··· 896 810 .get_sqi_max = mv88q2xxx_get_sqi_max, 897 811 }, 898 812 { 899 - PHY_ID_MATCH_EXACT(PHY_ID_88Q2220_REVB0), 813 + .phy_id = MARVELL_PHY_ID_88Q2220, 814 + .phy_id_mask = MARVELL_PHY_ID_MASK, 900 815 .name = "mv88q2220", 901 816 .flags = PHY_POLL_CABLE_TEST, 902 817 .probe = mv88q2xxx_probe, 903 818 .get_features = mv88q2xxx_get_features, 904 819 .config_aneg = mv88q2xxx_config_aneg, 905 820 .aneg_done = genphy_c45_aneg_done, 906 - .config_init = mv88q222x_revb0_config_init, 821 + .config_init = mv88q222x_config_init, 907 822 .read_status = mv88q2xxx_read_status, 908 823 .soft_reset = mv88q222x_soft_reset, 909 824 .config_intr = mv88q2xxx_config_intr, ··· 923 836 924 837 static struct mdio_device_id __maybe_unused mv88q2xxx_tbl[] = { 925 838 { MARVELL_PHY_ID_88Q2110, MARVELL_PHY_ID_MASK }, 926 - { PHY_ID_MATCH_EXACT(PHY_ID_88Q2220_REVB0), }, 839 + { MARVELL_PHY_ID_88Q2220, MARVELL_PHY_ID_MASK }, 927 840 { /*sentinel*/ } 928 841 }; 929 842 MODULE_DEVICE_TABLE(mdio, mv88q2xxx_tbl);
+1 -22
drivers/nvme/host/core.c
··· 629 629 EXPORT_SYMBOL_GPL(nvme_change_ctrl_state); 630 630 631 631 /* 632 - * Returns true for sink states that can't ever transition back to live. 633 - */ 634 - static bool nvme_state_terminal(struct nvme_ctrl *ctrl) 635 - { 636 - switch (nvme_ctrl_state(ctrl)) { 637 - case NVME_CTRL_NEW: 638 - case NVME_CTRL_LIVE: 639 - case NVME_CTRL_RESETTING: 640 - case NVME_CTRL_CONNECTING: 641 - return false; 642 - case NVME_CTRL_DELETING: 643 - case NVME_CTRL_DELETING_NOIO: 644 - case NVME_CTRL_DEAD: 645 - return true; 646 - default: 647 - WARN_ONCE(1, "Unhandled ctrl state:%d", ctrl->state); 648 - return true; 649 - } 650 - } 651 - 652 - /* 653 632 * Waits for the controller state to be resetting, or returns false if it is 654 633 * not possible to ever transition to that state. 655 634 */ ··· 3660 3681 "Found shared namespace %d, but multipathing not supported.\n", 3661 3682 info->nsid); 3662 3683 dev_warn_once(ctrl->device, 3663 - "Support for shared namespaces without CONFIG_NVME_MULTIPATH is deprecated and will be removed in Linux 6.0\n."); 3684 + "Support for shared namespaces without CONFIG_NVME_MULTIPATH is deprecated and will be removed in Linux 6.0.\n"); 3664 3685 } 3665 3686 } 3666 3687
+2 -1
drivers/nvme/host/multipath.c
··· 247 247 if (nvme_path_is_disabled(ns)) 248 248 continue; 249 249 250 - if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA) 250 + if (ns->ctrl->numa_node != NUMA_NO_NODE && 251 + READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA) 251 252 distance = node_distance(node, ns->ctrl->numa_node); 252 253 else 253 254 distance = LOCAL_DISTANCE;
+21
drivers/nvme/host/nvme.h
··· 741 741 nvme_tag_from_cid(command_id) >= NVME_AQ_BLK_MQ_DEPTH; 742 742 } 743 743 744 + /* 745 + * Returns true for sink states that can't ever transition back to live. 746 + */ 747 + static inline bool nvme_state_terminal(struct nvme_ctrl *ctrl) 748 + { 749 + switch (nvme_ctrl_state(ctrl)) { 750 + case NVME_CTRL_NEW: 751 + case NVME_CTRL_LIVE: 752 + case NVME_CTRL_RESETTING: 753 + case NVME_CTRL_CONNECTING: 754 + return false; 755 + case NVME_CTRL_DELETING: 756 + case NVME_CTRL_DELETING_NOIO: 757 + case NVME_CTRL_DEAD: 758 + return true; 759 + default: 760 + WARN_ONCE(1, "Unhandled ctrl state:%d", ctrl->state); 761 + return true; 762 + } 763 + } 764 + 744 765 void nvme_complete_rq(struct request *req); 745 766 void nvme_complete_batch_req(struct request *req); 746 767
+7 -1
drivers/nvme/host/pci.c
··· 1286 1286 u32 csts = readl(dev->bar + NVME_REG_CSTS); 1287 1287 u8 opcode; 1288 1288 1289 + if (nvme_state_terminal(&dev->ctrl)) 1290 + goto disable; 1291 + 1289 1292 /* If PCI error recovery process is happening, we cannot reset or 1290 1293 * the recovery mechanism will surely fail. 1291 1294 */ ··· 1393 1390 return BLK_EH_RESET_TIMER; 1394 1391 1395 1392 disable: 1396 - if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING)) 1393 + if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING)) { 1394 + if (nvme_state_terminal(&dev->ctrl)) 1395 + nvme_dev_disable(dev, true); 1397 1396 return BLK_EH_DONE; 1397 + } 1398 1398 1399 1399 nvme_dev_disable(dev, false); 1400 1400 if (nvme_try_sched_reset(&dev->ctrl))
+8 -2
drivers/nvme/host/tcp.c
··· 360 360 } while (ret > 0); 361 361 } 362 362 363 - static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue) 363 + static inline bool nvme_tcp_queue_has_pending(struct nvme_tcp_queue *queue) 364 364 { 365 365 return !list_empty(&queue->send_list) || 366 366 !llist_empty(&queue->req_list); 367 + } 368 + 369 + static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue) 370 + { 371 + return !nvme_tcp_tls(&queue->ctrl->ctrl) && 372 + nvme_tcp_queue_has_pending(queue); 367 373 } 368 374 369 375 static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req, ··· 392 386 mutex_unlock(&queue->send_mutex); 393 387 } 394 388 395 - if (last && nvme_tcp_queue_more(queue)) 389 + if (last && nvme_tcp_queue_has_pending(queue)) 396 390 queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work); 397 391 } 398 392
+4 -4
drivers/nvme/target/auth.c
··· 285 285 } 286 286 287 287 if (shash_len != crypto_shash_digestsize(shash_tfm)) { 288 - pr_debug("%s: hash len mismatch (len %d digest %d)\n", 289 - __func__, shash_len, 290 - crypto_shash_digestsize(shash_tfm)); 288 + pr_err("%s: hash len mismatch (len %d digest %d)\n", 289 + __func__, shash_len, 290 + crypto_shash_digestsize(shash_tfm)); 291 291 ret = -EINVAL; 292 292 goto out_free_tfm; 293 293 } ··· 370 370 nvme_auth_free_key(transformed_key); 371 371 out_free_tfm: 372 372 crypto_free_shash(shash_tfm); 373 - return 0; 373 + return ret; 374 374 } 375 375 376 376 int nvmet_auth_ctrl_hash(struct nvmet_req *req, u8 *response,
+13
drivers/nvme/target/configfs.c
··· 754 754 NULL, 755 755 }; 756 756 757 + bool nvmet_subsys_nsid_exists(struct nvmet_subsys *subsys, u32 nsid) 758 + { 759 + struct config_item *ns_item; 760 + char name[4] = {}; 761 + 762 + if (sprintf(name, "%u", nsid) <= 0) 763 + return false; 764 + mutex_lock(&subsys->namespaces_group.cg_subsys->su_mutex); 765 + ns_item = config_group_find_item(&subsys->namespaces_group, name); 766 + mutex_unlock(&subsys->namespaces_group.cg_subsys->su_mutex); 767 + return ns_item != NULL; 768 + } 769 + 757 770 static void nvmet_ns_release(struct config_item *item) 758 771 { 759 772 struct nvmet_ns *ns = to_nvmet_ns(item);
+4 -1
drivers/nvme/target/core.c
··· 437 437 u16 nvmet_req_find_ns(struct nvmet_req *req) 438 438 { 439 439 u32 nsid = le32_to_cpu(req->cmd->common.nsid); 440 + struct nvmet_subsys *subsys = nvmet_req_subsys(req); 440 441 441 - req->ns = xa_load(&nvmet_req_subsys(req)->namespaces, nsid); 442 + req->ns = xa_load(&subsys->namespaces, nsid); 442 443 if (unlikely(!req->ns)) { 443 444 req->error_loc = offsetof(struct nvme_common_command, nsid); 445 + if (nvmet_subsys_nsid_exists(subsys, nsid)) 446 + return NVME_SC_INTERNAL_PATH_ERROR; 444 447 return NVME_SC_INVALID_NS | NVME_SC_DNR; 445 448 } 446 449
+1
drivers/nvme/target/nvmet.h
··· 543 543 struct nvmet_host *host); 544 544 void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type, 545 545 u8 event_info, u8 log_page); 546 + bool nvmet_subsys_nsid_exists(struct nvmet_subsys *subsys, u32 nsid); 546 547 547 548 #define NVMET_MIN_QUEUE_SIZE 16 548 549 #define NVMET_MAX_QUEUE_SIZE 1024
+4 -7
drivers/nvme/target/tcp.c
··· 348 348 return 0; 349 349 } 350 350 351 + /* If cmd buffers are NULL, no operation is performed */ 351 352 static void nvmet_tcp_free_cmd_buffers(struct nvmet_tcp_cmd *cmd) 352 353 { 353 354 kfree(cmd->iov); ··· 1582 1581 struct nvmet_tcp_cmd *cmd = queue->cmds; 1583 1582 int i; 1584 1583 1585 - for (i = 0; i < queue->nr_cmds; i++, cmd++) { 1586 - if (nvmet_tcp_need_data_in(cmd)) 1587 - nvmet_tcp_free_cmd_buffers(cmd); 1588 - } 1589 - 1590 - if (!queue->nr_cmds && nvmet_tcp_need_data_in(&queue->connect)) 1591 - nvmet_tcp_free_cmd_buffers(&queue->connect); 1584 + for (i = 0; i < queue->nr_cmds; i++, cmd++) 1585 + nvmet_tcp_free_cmd_buffers(cmd); 1586 + nvmet_tcp_free_cmd_buffers(&queue->connect); 1592 1587 } 1593 1588 1594 1589 static void nvmet_tcp_release_queue_work(struct work_struct *w)
+2 -2
drivers/pci/pcie/aspm.c
··· 177 177 /* Restore L0s/L1 if they were enabled */ 178 178 if (FIELD_GET(PCI_EXP_LNKCTL_ASPMC, clnkctl) || 179 179 FIELD_GET(PCI_EXP_LNKCTL_ASPMC, plnkctl)) { 180 - pcie_capability_write_word(parent, PCI_EXP_LNKCTL, clnkctl); 181 - pcie_capability_write_word(pdev, PCI_EXP_LNKCTL, plnkctl); 180 + pcie_capability_write_word(parent, PCI_EXP_LNKCTL, plnkctl); 181 + pcie_capability_write_word(pdev, PCI_EXP_LNKCTL, clnkctl); 182 182 } 183 183 } 184 184
+4 -2
drivers/s390/char/raw3270.c
··· 162 162 /* 163 163 * Setup ccw. 164 164 */ 165 - rq->ccw.cda = virt_to_dma32(rq->buffer); 165 + if (rq->buffer) 166 + rq->ccw.cda = virt_to_dma32(rq->buffer); 166 167 rq->ccw.flags = CCW_FLAG_SLI; 167 168 168 169 return rq; ··· 189 188 return -EBUSY; 190 189 rq->ccw.cmd_code = 0; 191 190 rq->ccw.count = 0; 192 - rq->ccw.cda = virt_to_dma32(rq->buffer); 191 + if (rq->buffer) 192 + rq->ccw.cda = virt_to_dma32(rq->buffer); 193 193 rq->ccw.flags = CCW_FLAG_SLI; 194 194 rq->rescnt = 0; 195 195 rq->rc = 0;
+1 -1
drivers/s390/cio/cio_inject.c
··· 95 95 return -EINVAL; 96 96 } 97 97 98 - buffer = vmemdup_user(buf, lbuf); 98 + buffer = memdup_user_nul(buf, lbuf); 99 99 if (IS_ERR(buffer)) 100 100 return -ENOMEM; 101 101
+3 -3
drivers/s390/crypto/zcrypt_ccamisc.c
··· 658 658 (int)prepcblk->ccp_rtcode, 659 659 (int)prepcblk->ccp_rscode); 660 660 if (prepcblk->ccp_rtcode == 8 && prepcblk->ccp_rscode == 2290) 661 - rc = -EAGAIN; 661 + rc = -EBUSY; 662 662 else 663 663 rc = -EIO; 664 664 goto out; ··· 1263 1263 (int)prepcblk->ccp_rtcode, 1264 1264 (int)prepcblk->ccp_rscode); 1265 1265 if (prepcblk->ccp_rtcode == 8 && prepcblk->ccp_rscode == 2290) 1266 - rc = -EAGAIN; 1266 + rc = -EBUSY; 1267 1267 else 1268 1268 rc = -EIO; 1269 1269 goto out; ··· 1426 1426 (int)prepcblk->ccp_rtcode, 1427 1427 (int)prepcblk->ccp_rscode); 1428 1428 if (prepcblk->ccp_rtcode == 8 && prepcblk->ccp_rscode == 2290) 1429 - rc = -EAGAIN; 1429 + rc = -EBUSY; 1430 1430 else 1431 1431 rc = -EIO; 1432 1432 goto out;
+47 -1
drivers/s390/crypto/zcrypt_ep11misc.c
··· 556 556 pl += 2; 557 557 ret = *((u32 *)pl); 558 558 if (ret != 0) { 559 - ZCRYPT_DBF_ERR("%s return value 0x%04x != 0\n", func, ret); 559 + ZCRYPT_DBF_ERR("%s return value 0x%08x != 0\n", func, ret); 560 560 return -EIO; 561 + } 562 + 563 + return 0; 564 + } 565 + 566 + /* Check ep11 reply cprb, return 0 or suggested errno value. */ 567 + static int check_reply_cprb(const struct ep11_cprb *rep, const char *func) 568 + { 569 + /* check ep11 reply return code field */ 570 + if (rep->ret_code) { 571 + ZCRYPT_DBF_ERR("%s ep11 reply ret_code=0x%08x\n", __func__, 572 + rep->ret_code); 573 + if (rep->ret_code == 0x000c0003) 574 + return -EBUSY; 575 + else 576 + return -EIO; 561 577 } 562 578 563 579 return 0; ··· 643 627 goto out; 644 628 } 645 629 630 + /* check ep11 reply cprb */ 631 + rc = check_reply_cprb(rep, __func__); 632 + if (rc) 633 + goto out; 634 + 635 + /* check payload */ 646 636 rc = check_reply_pl((u8 *)rep_pl, __func__); 647 637 if (rc) 648 638 goto out; ··· 899 877 goto out; 900 878 } 901 879 880 + /* check ep11 reply cprb */ 881 + rc = check_reply_cprb(rep, __func__); 882 + if (rc) 883 + goto out; 884 + 885 + /* check payload */ 902 886 rc = check_reply_pl((u8 *)rep_pl, __func__); 903 887 if (rc) 904 888 goto out; ··· 1056 1028 goto out; 1057 1029 } 1058 1030 1031 + /* check ep11 reply cprb */ 1032 + rc = check_reply_cprb(rep, __func__); 1033 + if (rc) 1034 + goto out; 1035 + 1036 + /* check payload */ 1059 1037 rc = check_reply_pl((u8 *)rep_pl, __func__); 1060 1038 if (rc) 1061 1039 goto out; ··· 1219 1185 goto out; 1220 1186 } 1221 1187 1188 + /* check ep11 reply cprb */ 1189 + rc = check_reply_cprb(rep, __func__); 1190 + if (rc) 1191 + goto out; 1192 + 1193 + /* check payload */ 1222 1194 rc = check_reply_pl((u8 *)rep_pl, __func__); 1223 1195 if (rc) 1224 1196 goto out; ··· 1379 1339 goto out; 1380 1340 } 1381 1341 1342 + /* check ep11 reply cprb */ 1343 + rc = check_reply_cprb(rep, __func__); 1344 + if (rc) 1345 + goto out; 1346 + 1347 + /* check payload */ 1382 1348 rc = check_reply_pl((u8 *)rep_pl, __func__); 1383 1349 if (rc) 1384 1350 goto out;
+5 -1
drivers/slimbus/qcom-ngd-ctrl.c
··· 1451 1451 ctrl = container_of(work, struct qcom_slim_ngd_ctrl, ngd_up_work); 1452 1452 1453 1453 /* Make sure qmi service is up before continuing */ 1454 - wait_for_completion_interruptible(&ctrl->qmi_up); 1454 + if (!wait_for_completion_interruptible_timeout(&ctrl->qmi_up, 1455 + msecs_to_jiffies(MSEC_PER_SEC))) { 1456 + dev_err(ctrl->dev, "QMI wait timeout\n"); 1457 + return; 1458 + } 1455 1459 1456 1460 mutex_lock(&ctrl->ssr_lock); 1457 1461 qcom_slim_ngd_enable(ctrl, true);
+1 -1
drivers/spi/spi-axi-spi-engine.c
··· 623 623 624 624 version = readl(spi_engine->base + ADI_AXI_REG_VERSION); 625 625 if (ADI_AXI_PCORE_VER_MAJOR(version) != 1) { 626 - dev_err(&pdev->dev, "Unsupported peripheral version %u.%u.%c\n", 626 + dev_err(&pdev->dev, "Unsupported peripheral version %u.%u.%u\n", 627 627 ADI_AXI_PCORE_VER_MAJOR(version), 628 628 ADI_AXI_PCORE_VER_MINOR(version), 629 629 ADI_AXI_PCORE_VER_PATCH(version));
-2
drivers/spi/spi-hisi-kunpeng.c
··· 151 151 HISI_SPI_DBGFS_REG("ENR", HISI_SPI_ENR), 152 152 HISI_SPI_DBGFS_REG("FIFOC", HISI_SPI_FIFOC), 153 153 HISI_SPI_DBGFS_REG("IMR", HISI_SPI_IMR), 154 - HISI_SPI_DBGFS_REG("DIN", HISI_SPI_DIN), 155 - HISI_SPI_DBGFS_REG("DOUT", HISI_SPI_DOUT), 156 154 HISI_SPI_DBGFS_REG("SR", HISI_SPI_SR), 157 155 HISI_SPI_DBGFS_REG("RISR", HISI_SPI_RISR), 158 156 HISI_SPI_DBGFS_REG("ISR", HISI_SPI_ISR),
+1
drivers/spi/spi.c
··· 4523 4523 wait_for_completion(&done); 4524 4524 status = message->status; 4525 4525 } 4526 + message->complete = NULL; 4526 4527 message->context = NULL; 4527 4528 4528 4529 return status;
+45 -14
drivers/thermal/thermal_debugfs.c
··· 139 139 * we keep track of the current position in the history array. 140 140 * 141 141 * @tz_episodes: a list of thermal mitigation episodes 142 + * @tz: thermal zone this object belongs to 142 143 * @trips_crossed: an array of trip points crossed by id 143 144 * @nr_trips: the number of trip points currently being crossed 144 145 */ 145 146 struct tz_debugfs { 146 147 struct list_head tz_episodes; 148 + struct thermal_zone_device *tz; 147 149 int *trips_crossed; 148 150 int nr_trips; 149 151 }; ··· 505 503 */ 506 504 void thermal_debug_cdev_remove(struct thermal_cooling_device *cdev) 507 505 { 508 - struct thermal_debugfs *thermal_dbg = cdev->debugfs; 506 + struct thermal_debugfs *thermal_dbg; 509 507 510 - if (!thermal_dbg) 508 + mutex_lock(&cdev->lock); 509 + 510 + thermal_dbg = cdev->debugfs; 511 + if (!thermal_dbg) { 512 + mutex_unlock(&cdev->lock); 511 513 return; 514 + } 515 + 516 + cdev->debugfs = NULL; 517 + 518 + mutex_unlock(&cdev->lock); 512 519 513 520 mutex_lock(&thermal_dbg->lock); 514 521 515 522 thermal_debugfs_cdev_clear(&thermal_dbg->cdev_dbg); 516 - cdev->debugfs = NULL; 517 523 518 524 mutex_unlock(&thermal_dbg->lock); 519 525 ··· 726 716 727 717 static void *tze_seq_start(struct seq_file *s, loff_t *pos) 728 718 { 729 - struct thermal_zone_device *tz = s->private; 730 - struct thermal_debugfs *thermal_dbg = tz->debugfs; 719 + struct thermal_debugfs *thermal_dbg = s->private; 731 720 struct tz_debugfs *tz_dbg = &thermal_dbg->tz_dbg; 732 721 733 722 mutex_lock(&thermal_dbg->lock); ··· 736 727 737 728 static void *tze_seq_next(struct seq_file *s, void *v, loff_t *pos) 738 729 { 739 - struct thermal_zone_device *tz = s->private; 740 - struct thermal_debugfs *thermal_dbg = tz->debugfs; 730 + struct thermal_debugfs *thermal_dbg = s->private; 741 731 struct tz_debugfs *tz_dbg = &thermal_dbg->tz_dbg; 742 732 743 733 return seq_list_next(v, &tz_dbg->tz_episodes, pos); ··· 744 736 745 737 static void tze_seq_stop(struct seq_file *s, void *v) 746 738 { 747 - struct thermal_zone_device *tz = s->private; 748 - struct thermal_debugfs *thermal_dbg = tz->debugfs; 739 + struct thermal_debugfs *thermal_dbg = s->private; 749 740 750 741 mutex_unlock(&thermal_dbg->lock); 751 742 } 752 743 753 744 static int tze_seq_show(struct seq_file *s, void *v) 754 745 { 755 - struct thermal_zone_device *tz = s->private; 746 + struct thermal_debugfs *thermal_dbg = s->private; 747 + struct thermal_zone_device *tz = thermal_dbg->tz_dbg.tz; 756 748 struct thermal_trip *trip; 757 749 struct tz_episode *tze; 758 750 const char *type; ··· 818 810 819 811 tz_dbg = &thermal_dbg->tz_dbg; 820 812 813 + tz_dbg->tz = tz; 814 + 821 815 tz_dbg->trips_crossed = kzalloc(sizeof(int) * tz->num_trips, GFP_KERNEL); 822 816 if (!tz_dbg->trips_crossed) { 823 817 thermal_debugfs_remove_id(thermal_dbg); ··· 828 818 829 819 INIT_LIST_HEAD(&tz_dbg->tz_episodes); 830 820 831 - debugfs_create_file("mitigations", 0400, thermal_dbg->d_top, tz, &tze_fops); 821 + debugfs_create_file("mitigations", 0400, thermal_dbg->d_top, 822 + thermal_dbg, &tze_fops); 832 823 833 824 tz->debugfs = thermal_dbg; 834 825 } 835 826 836 827 void thermal_debug_tz_remove(struct thermal_zone_device *tz) 837 828 { 838 - struct thermal_debugfs *thermal_dbg = tz->debugfs; 829 + struct thermal_debugfs *thermal_dbg; 830 + struct tz_episode *tze, *tmp; 831 + struct tz_debugfs *tz_dbg; 832 + int *trips_crossed; 839 833 840 - if (!thermal_dbg) 834 + mutex_lock(&tz->lock); 835 + 836 + thermal_dbg = tz->debugfs; 837 + if (!thermal_dbg) { 838 + mutex_unlock(&tz->lock); 841 839 return; 840 + } 841 + 842 + tz->debugfs = NULL; 843 + 844 + mutex_unlock(&tz->lock); 845 + 846 + tz_dbg = &thermal_dbg->tz_dbg; 842 847 843 848 mutex_lock(&thermal_dbg->lock); 844 849 845 - tz->debugfs = NULL; 850 + trips_crossed = tz_dbg->trips_crossed; 851 + 852 + list_for_each_entry_safe(tze, tmp, &tz_dbg->tz_episodes, node) { 853 + list_del(&tze->node); 854 + kfree(tze); 855 + } 846 856 847 857 mutex_unlock(&thermal_dbg->lock); 848 858 849 859 thermal_debugfs_remove_id(thermal_dbg); 860 + kfree(trips_crossed); 850 861 }
+3 -2
drivers/usb/core/hub.c
··· 5110 5110 } 5111 5111 if (usb_endpoint_maxp(&udev->ep0.desc) == i) { 5112 5112 ; /* Initial ep0 maxpacket guess is right */ 5113 - } else if ((udev->speed == USB_SPEED_FULL || 5113 + } else if (((udev->speed == USB_SPEED_FULL || 5114 5114 udev->speed == USB_SPEED_HIGH) && 5115 - (i == 8 || i == 16 || i == 32 || i == 64)) { 5115 + (i == 8 || i == 16 || i == 32 || i == 64)) || 5116 + (udev->speed >= USB_SPEED_SUPER && i > 0)) { 5116 5117 /* Initial guess is wrong; use the descriptor's value */ 5117 5118 if (udev->speed == USB_SPEED_FULL) 5118 5119 dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i);
+6 -2
drivers/usb/core/port.c
··· 51 51 struct usb_port *port_dev = to_usb_port(dev); 52 52 struct usb_device *hdev = to_usb_device(dev->parent->parent); 53 53 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); 54 - struct usb_interface *intf = to_usb_interface(hub->intfdev); 54 + struct usb_interface *intf = to_usb_interface(dev->parent); 55 55 int port1 = port_dev->portnum; 56 56 u16 portstatus, unused; 57 57 bool disabled; 58 58 int rc; 59 59 struct kernfs_node *kn; 60 60 61 + if (!hub) 62 + return -ENODEV; 61 63 hub_get(hub); 62 64 rc = usb_autopm_get_interface(intf); 63 65 if (rc < 0) ··· 103 101 struct usb_port *port_dev = to_usb_port(dev); 104 102 struct usb_device *hdev = to_usb_device(dev->parent->parent); 105 103 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); 106 - struct usb_interface *intf = to_usb_interface(hub->intfdev); 104 + struct usb_interface *intf = to_usb_interface(dev->parent); 107 105 int port1 = port_dev->portnum; 108 106 bool disabled; 109 107 int rc; 110 108 struct kernfs_node *kn; 111 109 110 + if (!hub) 111 + return -ENODEV; 112 112 rc = kstrtobool(buf, &disabled); 113 113 if (rc) 114 114 return rc;
+38 -52
drivers/usb/dwc3/core.c
··· 104 104 return 0; 105 105 } 106 106 107 + void dwc3_enable_susphy(struct dwc3 *dwc, bool enable) 108 + { 109 + u32 reg; 110 + 111 + reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0)); 112 + if (enable && !dwc->dis_u3_susphy_quirk) 113 + reg |= DWC3_GUSB3PIPECTL_SUSPHY; 114 + else 115 + reg &= ~DWC3_GUSB3PIPECTL_SUSPHY; 116 + 117 + dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg); 118 + 119 + reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); 120 + if (enable && !dwc->dis_u2_susphy_quirk) 121 + reg |= DWC3_GUSB2PHYCFG_SUSPHY; 122 + else 123 + reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; 124 + 125 + dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); 126 + } 127 + 107 128 void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode) 108 129 { 109 130 u32 reg; ··· 606 585 */ 607 586 static int dwc3_phy_setup(struct dwc3 *dwc) 608 587 { 609 - unsigned int hw_mode; 610 588 u32 reg; 611 - 612 - hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0); 613 589 614 590 reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0)); 615 591 ··· 617 599 reg &= ~DWC3_GUSB3PIPECTL_UX_EXIT_PX; 618 600 619 601 /* 620 - * Above 1.94a, it is recommended to set DWC3_GUSB3PIPECTL_SUSPHY 621 - * to '0' during coreConsultant configuration. So default value 622 - * will be '0' when the core is reset. Application needs to set it 623 - * to '1' after the core initialization is completed. 602 + * Above DWC_usb3.0 1.94a, it is recommended to set 603 + * DWC3_GUSB3PIPECTL_SUSPHY to '0' during coreConsultant configuration. 604 + * So default value will be '0' when the core is reset. Application 605 + * needs to set it to '1' after the core initialization is completed. 606 + * 607 + * Similarly for DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be 608 + * cleared after power-on reset, and it can be set after core 609 + * initialization. 624 610 */ 625 - if (!DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) 626 - reg |= DWC3_GUSB3PIPECTL_SUSPHY; 627 - 628 - /* 629 - * For DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be cleared after 630 - * power-on reset, and it can be set after core initialization, which is 631 - * after device soft-reset during initialization. 632 - */ 633 - if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD) 634 - reg &= ~DWC3_GUSB3PIPECTL_SUSPHY; 611 + reg &= ~DWC3_GUSB3PIPECTL_SUSPHY; 635 612 636 613 if (dwc->u2ss_inp3_quirk) 637 614 reg |= DWC3_GUSB3PIPECTL_U2SSINP3OK; ··· 651 638 652 639 if (dwc->tx_de_emphasis_quirk) 653 640 reg |= DWC3_GUSB3PIPECTL_TX_DEEPH(dwc->tx_de_emphasis); 654 - 655 - if (dwc->dis_u3_susphy_quirk) 656 - reg &= ~DWC3_GUSB3PIPECTL_SUSPHY; 657 641 658 642 if (dwc->dis_del_phy_power_chg_quirk) 659 643 reg &= ~DWC3_GUSB3PIPECTL_DEPOCHANGE; ··· 699 689 } 700 690 701 691 /* 702 - * Above 1.94a, it is recommended to set DWC3_GUSB2PHYCFG_SUSPHY to 703 - * '0' during coreConsultant configuration. So default value will 704 - * be '0' when the core is reset. Application needs to set it to 705 - * '1' after the core initialization is completed. 692 + * Above DWC_usb3.0 1.94a, it is recommended to set 693 + * DWC3_GUSB2PHYCFG_SUSPHY to '0' during coreConsultant configuration. 694 + * So default value will be '0' when the core is reset. Application 695 + * needs to set it to '1' after the core initialization is completed. 696 + * 697 + * Similarly for DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared 698 + * after power-on reset, and it can be set after core initialization. 706 699 */ 707 - if (!DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) 708 - reg |= DWC3_GUSB2PHYCFG_SUSPHY; 709 - 710 - /* 711 - * For DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared after 712 - * power-on reset, and it can be set after core initialization, which is 713 - * after device soft-reset during initialization. 714 - */ 715 - if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD) 716 - reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; 717 - 718 - if (dwc->dis_u2_susphy_quirk) 719 - reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; 700 + reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; 720 701 721 702 if (dwc->dis_enblslpm_quirk) 722 703 reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM; ··· 1227 1226 ret = dwc3_core_soft_reset(dwc); 1228 1227 if (ret) 1229 1228 goto err_exit_phy; 1230 - 1231 - if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD && 1232 - !DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) { 1233 - if (!dwc->dis_u3_susphy_quirk) { 1234 - reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0)); 1235 - reg |= DWC3_GUSB3PIPECTL_SUSPHY; 1236 - dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg); 1237 - } 1238 - 1239 - if (!dwc->dis_u2_susphy_quirk) { 1240 - reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); 1241 - reg |= DWC3_GUSB2PHYCFG_SUSPHY; 1242 - dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); 1243 - } 1244 - } 1245 1229 1246 1230 dwc3_core_setup_global_control(dwc); 1247 1231 dwc3_core_num_eps(dwc);
+1
drivers/usb/dwc3/core.h
··· 1580 1580 void dwc3_event_buffers_cleanup(struct dwc3 *dwc); 1581 1581 1582 1582 int dwc3_core_soft_reset(struct dwc3 *dwc); 1583 + void dwc3_enable_susphy(struct dwc3 *dwc, bool enable); 1583 1584 1584 1585 #if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) 1585 1586 int dwc3_host_init(struct dwc3 *dwc);
+2
drivers/usb/dwc3/gadget.c
··· 2924 2924 dwc3_ep0_out_start(dwc); 2925 2925 2926 2926 dwc3_gadget_enable_irq(dwc); 2927 + dwc3_enable_susphy(dwc, true); 2927 2928 2928 2929 return 0; 2929 2930 ··· 4691 4690 if (!dwc->gadget) 4692 4691 return; 4693 4692 4693 + dwc3_enable_susphy(dwc, false); 4694 4694 usb_del_gadget(dwc->gadget); 4695 4695 dwc3_gadget_free_endpoints(dwc); 4696 4696 usb_put_gadget(dwc->gadget);
+27
drivers/usb/dwc3/host.c
··· 10 10 #include <linux/irq.h> 11 11 #include <linux/of.h> 12 12 #include <linux/platform_device.h> 13 + #include <linux/usb.h> 14 + #include <linux/usb/hcd.h> 13 15 14 16 #include "../host/xhci-port.h" 15 17 #include "../host/xhci-ext-caps.h" 16 18 #include "../host/xhci-caps.h" 19 + #include "../host/xhci-plat.h" 17 20 #include "core.h" 18 21 19 22 #define XHCI_HCSPARAMS1 0x4 ··· 59 56 dev_err(dwc->dev, "xhci base reg invalid\n"); 60 57 } 61 58 } 59 + 60 + static void dwc3_xhci_plat_start(struct usb_hcd *hcd) 61 + { 62 + struct platform_device *pdev; 63 + struct dwc3 *dwc; 64 + 65 + if (!usb_hcd_is_primary_hcd(hcd)) 66 + return; 67 + 68 + pdev = to_platform_device(hcd->self.controller); 69 + dwc = dev_get_drvdata(pdev->dev.parent); 70 + 71 + dwc3_enable_susphy(dwc, true); 72 + } 73 + 74 + static const struct xhci_plat_priv dwc3_xhci_plat_quirk = { 75 + .plat_start = dwc3_xhci_plat_start, 76 + }; 62 77 63 78 static void dwc3_host_fill_xhci_irq_res(struct dwc3 *dwc, 64 79 int irq, char *name) ··· 188 167 } 189 168 } 190 169 170 + ret = platform_device_add_data(xhci, &dwc3_xhci_plat_quirk, 171 + sizeof(struct xhci_plat_priv)); 172 + if (ret) 173 + goto err; 174 + 191 175 ret = platform_device_add(xhci); 192 176 if (ret) { 193 177 dev_err(dwc->dev, "failed to register xHCI device\n"); ··· 218 192 if (dwc->sys_wakeup) 219 193 device_init_wakeup(&dwc->xhci->dev, false); 220 194 195 + dwc3_enable_susphy(dwc, false); 221 196 platform_device_unregister(dwc->xhci); 222 197 dwc->xhci = NULL; 223 198 }
+3 -3
drivers/usb/gadget/composite.c
··· 2112 2112 buf[5] = 0x01; 2113 2113 switch (ctrl->bRequestType & USB_RECIP_MASK) { 2114 2114 case USB_RECIP_DEVICE: 2115 - if (w_index != 0x4 || (w_value >> 8)) 2115 + if (w_index != 0x4 || (w_value & 0xff)) 2116 2116 break; 2117 2117 buf[6] = w_index; 2118 2118 /* Number of ext compat interfaces */ ··· 2128 2128 } 2129 2129 break; 2130 2130 case USB_RECIP_INTERFACE: 2131 - if (w_index != 0x5 || (w_value >> 8)) 2131 + if (w_index != 0x5 || (w_value & 0xff)) 2132 2132 break; 2133 - interface = w_value & 0xFF; 2133 + interface = w_value >> 8; 2134 2134 if (interface >= MAX_CONFIG_INTERFACES || 2135 2135 !os_desc_cfg->interface[interface]) 2136 2136 break;
+7 -2
drivers/usb/gadget/function/f_fs.c
··· 852 852 work); 853 853 int ret = io_data->status; 854 854 bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD; 855 + unsigned long flags; 855 856 856 857 if (io_data->read && ret > 0) { 857 858 kthread_use_mm(io_data->mm); ··· 864 863 865 864 if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd) 866 865 eventfd_signal(io_data->ffs->ffs_eventfd); 866 + 867 + spin_lock_irqsave(&io_data->ffs->eps_lock, flags); 868 + usb_ep_free_request(io_data->ep, io_data->req); 869 + io_data->req = NULL; 870 + spin_unlock_irqrestore(&io_data->ffs->eps_lock, flags); 867 871 868 872 if (io_data->read) 869 873 kfree(io_data->to_free); ··· 883 877 struct ffs_data *ffs = io_data->ffs; 884 878 885 879 io_data->status = req->status ? req->status : req->actual; 886 - usb_ep_free_request(_ep, req); 887 880 888 881 INIT_WORK(&io_data->work, ffs_user_copy_worker); 889 882 queue_work(ffs->io_completion_wq, &io_data->work); ··· 3811 3806 __ffs_event_add(ffs, FUNCTIONFS_SETUP); 3812 3807 spin_unlock_irqrestore(&ffs->ev.waitq.lock, flags); 3813 3808 3814 - return creq->wLength == 0 ? USB_GADGET_DELAYED_STATUS : 0; 3809 + return ffs->ev.setup.wLength == 0 ? USB_GADGET_DELAYED_STATUS : 0; 3815 3810 } 3816 3811 3817 3812 static bool ffs_func_req_match(struct usb_function *f,
+2 -2
drivers/usb/gadget/function/uvc_configfs.c
··· 92 92 93 93 while (pg - page < len) { 94 94 i = 0; 95 - while (i < sizeof(buf) && (pg - page < len) && 95 + while (i < bufsize && (pg - page < len) && 96 96 *pg != '\0' && *pg != '\n') 97 97 buf[i++] = *pg++; 98 - if (i == sizeof(buf)) { 98 + if (i == bufsize) { 99 99 ret = -EINVAL; 100 100 goto out_free_buf; 101 101 }
+8
drivers/usb/host/ohci-hcd.c
··· 888 888 /* Check for an all 1's result which is a typical consequence 889 889 * of dead, unclocked, or unplugged (CardBus...) devices 890 890 */ 891 + again: 891 892 if (ints == ~(u32)0) { 892 893 ohci->rh_state = OHCI_RH_HALTED; 893 894 ohci_dbg (ohci, "device removed!\n"); ··· 982 981 (void) ohci_readl (ohci, &ohci->regs->control); 983 982 } 984 983 spin_unlock(&ohci->lock); 984 + 985 + /* repeat until all enabled interrupts are handled */ 986 + if (ohci->rh_state != OHCI_RH_HALTED) { 987 + ints = ohci_readl(ohci, &regs->intrstatus); 988 + if (ints && (ints & ohci_readl(ohci, &regs->intrenable))) 989 + goto again; 990 + } 985 991 986 992 return IRQ_HANDLED; 987 993 }
+3 -1
drivers/usb/host/xhci-plat.h
··· 8 8 #ifndef _XHCI_PLAT_H 9 9 #define _XHCI_PLAT_H 10 10 11 - #include "xhci.h" /* for hcd_to_xhci() */ 11 + struct device; 12 + struct platform_device; 13 + struct usb_hcd; 12 14 13 15 struct xhci_plat_priv { 14 16 const char *firmware_name;
+1
drivers/usb/host/xhci-rzv2m.c
··· 6 6 */ 7 7 8 8 #include <linux/usb/rzv2m_usb3drd.h> 9 + #include "xhci.h" 9 10 #include "xhci-plat.h" 10 11 #include "xhci-rzv2m.h" 11 12
+6 -2
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
··· 104 104 105 105 ret = tcpm->port_start(tcpm, tcpm->tcpm_port); 106 106 if (ret) 107 - goto fwnode_remove; 107 + goto port_unregister; 108 108 109 109 ret = tcpm->pdphy_start(tcpm, tcpm->tcpm_port); 110 110 if (ret) 111 - goto fwnode_remove; 111 + goto port_stop; 112 112 113 113 return 0; 114 114 115 + port_stop: 116 + tcpm->port_stop(tcpm); 117 + port_unregister: 118 + tcpm_unregister_port(tcpm->tcpm_port); 115 119 fwnode_remove: 116 120 fwnode_remove_software_node(tcpm->tcpc.fwnode); 117 121
+7 -4
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
··· 475 475 476 476 qcom_pmic_typec_pdphy_reset_off(pmic_typec_pdphy); 477 477 done: 478 - if (ret) { 479 - regulator_disable(pmic_typec_pdphy->vdd_pdphy); 478 + if (ret) 480 479 dev_err(dev, "pdphy_enable fail %d\n", ret); 481 - } 482 480 483 481 return ret; 484 482 } ··· 522 524 523 525 ret = pmic_typec_pdphy_reset(pmic_typec_pdphy); 524 526 if (ret) 525 - return ret; 527 + goto err_disable_vdd_pdhy; 526 528 527 529 for (i = 0; i < pmic_typec_pdphy->nr_irqs; i++) 528 530 enable_irq(pmic_typec_pdphy->irq_data[i].irq); 529 531 530 532 return 0; 533 + 534 + err_disable_vdd_pdhy: 535 + regulator_disable(pmic_typec_pdphy->vdd_pdphy); 536 + 537 + return ret; 531 538 } 532 539 533 540 static void qcom_pmic_typec_pdphy_stop(struct pmic_typec *tcpm)
+33 -9
drivers/usb/typec/tcpm/tcpm.c
··· 1564 1564 static void tcpm_queue_vdm_unlocked(struct tcpm_port *port, const u32 header, 1565 1565 const u32 *data, int cnt, enum tcpm_transmit_type tx_sop_type) 1566 1566 { 1567 + if (port->state != SRC_READY && port->state != SNK_READY && 1568 + port->state != SRC_VDM_IDENTITY_REQUEST) 1569 + return; 1570 + 1567 1571 mutex_lock(&port->lock); 1568 - tcpm_queue_vdm(port, header, data, cnt, TCPC_TX_SOP); 1572 + tcpm_queue_vdm(port, header, data, cnt, tx_sop_type); 1569 1573 mutex_unlock(&port->lock); 1570 1574 } 1571 1575 ··· 1584 1580 port->partner_ident.cert_stat = p[VDO_INDEX_CSTAT]; 1585 1581 port->partner_ident.product = product; 1586 1582 1587 - typec_partner_set_identity(port->partner); 1583 + if (port->partner) 1584 + typec_partner_set_identity(port->partner); 1588 1585 1589 1586 tcpm_log(port, "Identity: %04x:%04x.%04x", 1590 1587 PD_IDH_VID(vdo), ··· 1746 1741 struct pd_mode_data *modep = &port->mode_data; 1747 1742 struct typec_altmode *altmode; 1748 1743 int i; 1744 + 1745 + if (!port->partner) 1746 + return; 1749 1747 1750 1748 for (i = 0; i < modep->altmodes; i++) { 1751 1749 altmode = typec_partner_register_altmode(port->partner, ··· 3004 2996 { 3005 2997 struct usb_power_delivery_desc desc = { port->negotiated_rev }; 3006 2998 struct usb_power_delivery_capabilities_desc caps = { }; 3007 - struct usb_power_delivery_capabilities *cap; 2999 + struct usb_power_delivery_capabilities *cap = port->partner_source_caps; 3008 3000 3009 3001 if (!port->partner_pd) 3010 3002 port->partner_pd = usb_power_delivery_register(NULL, &desc); ··· 3013 3005 3014 3006 memcpy(caps.pdo, port->source_caps, sizeof(u32) * port->nr_source_caps); 3015 3007 caps.role = TYPEC_SOURCE; 3008 + 3009 + if (cap) 3010 + usb_power_delivery_unregister_capabilities(cap); 3016 3011 3017 3012 cap = usb_power_delivery_register_capabilities(port->partner_pd, &caps); 3018 3013 if (IS_ERR(cap)) ··· 4242 4231 4243 4232 static void tcpm_typec_connect(struct tcpm_port *port) 4244 4233 { 4234 + struct typec_partner *partner; 4235 + 4245 4236 if (!port->connected) { 4237 + port->connected = true; 4246 4238 /* Make sure we don't report stale identity information */ 4247 4239 memset(&port->partner_ident, 0, sizeof(port->partner_ident)); 4248 4240 port->partner_desc.usb_pd = port->pd_capable; ··· 4255 4241 port->partner_desc.accessory = TYPEC_ACCESSORY_AUDIO; 4256 4242 else 4257 4243 port->partner_desc.accessory = TYPEC_ACCESSORY_NONE; 4258 - port->partner = typec_register_partner(port->typec_port, 4259 - &port->partner_desc); 4260 - port->connected = true; 4244 + partner = typec_register_partner(port->typec_port, &port->partner_desc); 4245 + if (IS_ERR(partner)) { 4246 + dev_err(port->dev, "Failed to register partner (%ld)\n", PTR_ERR(partner)); 4247 + return; 4248 + } 4249 + 4250 + port->partner = partner; 4261 4251 typec_partner_set_usb_power_delivery(port->partner, port->partner_pd); 4262 4252 } 4263 4253 } ··· 4341 4323 port->plug_prime = NULL; 4342 4324 port->cable = NULL; 4343 4325 if (port->connected) { 4344 - typec_partner_set_usb_power_delivery(port->partner, NULL); 4345 - typec_unregister_partner(port->partner); 4346 - port->partner = NULL; 4326 + if (port->partner) { 4327 + typec_partner_set_usb_power_delivery(port->partner, NULL); 4328 + typec_unregister_partner(port->partner); 4329 + port->partner = NULL; 4330 + } 4347 4331 port->connected = false; 4348 4332 } 4349 4333 } ··· 4569 4549 4570 4550 static void tcpm_set_initial_svdm_version(struct tcpm_port *port) 4571 4551 { 4552 + if (!port->partner) 4553 + return; 4554 + 4572 4555 switch (port->negotiated_rev) { 4573 4556 case PD_REV30: 4574 4557 break; ··· 5628 5605 break; 5629 5606 case PORT_RESET: 5630 5607 tcpm_reset_port(port); 5608 + port->pd_events = 0; 5631 5609 if (port->self_powered) 5632 5610 tcpm_set_cc(port, TYPEC_CC_OPEN); 5633 5611 else
+2 -2
fs/bcachefs/alloc_background.c
··· 244 244 struct bkey_s_c_alloc_v4 a = bkey_s_c_to_alloc_v4(k); 245 245 int ret = 0; 246 246 247 - bkey_fsck_err_on(alloc_v4_u64s(a.v) > bkey_val_u64s(k.k), c, err, 247 + bkey_fsck_err_on(alloc_v4_u64s_noerror(a.v) > bkey_val_u64s(k.k), c, err, 248 248 alloc_v4_val_size_bad, 249 249 "bad val size (%u > %zu)", 250 - alloc_v4_u64s(a.v), bkey_val_u64s(k.k)); 250 + alloc_v4_u64s_noerror(a.v), bkey_val_u64s(k.k)); 251 251 252 252 bkey_fsck_err_on(!BCH_ALLOC_V4_BACKPOINTERS_START(a.v) && 253 253 BCH_ALLOC_V4_NR_BACKPOINTERS(a.v), c, err,
+6 -2
fs/bcachefs/alloc_background.h
··· 126 126 return pos; 127 127 } 128 128 129 - static inline unsigned alloc_v4_u64s(const struct bch_alloc_v4 *a) 129 + static inline unsigned alloc_v4_u64s_noerror(const struct bch_alloc_v4 *a) 130 130 { 131 - unsigned ret = (BCH_ALLOC_V4_BACKPOINTERS_START(a) ?: 131 + return (BCH_ALLOC_V4_BACKPOINTERS_START(a) ?: 132 132 BCH_ALLOC_V4_U64s_V0) + 133 133 BCH_ALLOC_V4_NR_BACKPOINTERS(a) * 134 134 (sizeof(struct bch_backpointer) / sizeof(u64)); 135 + } 135 136 137 + static inline unsigned alloc_v4_u64s(const struct bch_alloc_v4 *a) 138 + { 139 + unsigned ret = alloc_v4_u64s_noerror(a); 136 140 BUG_ON(ret > U8_MAX - BKEY_U64s); 137 141 return ret; 138 142 }
+1 -1
fs/bcachefs/backpointers.c
··· 54 54 int ret = 0; 55 55 56 56 bkey_fsck_err_on((bp.v->bucket_offset >> MAX_EXTENT_COMPRESS_RATIO_SHIFT) >= ca->mi.bucket_size || 57 - !bpos_eq(bp.k->p, bucket_pos_to_bp(c, bucket, bp.v->bucket_offset)), 57 + !bpos_eq(bp.k->p, bucket_pos_to_bp_noerror(ca, bucket, bp.v->bucket_offset)), 58 58 c, err, 59 59 backpointer_bucket_offset_wrong, 60 60 "backpointer bucket_offset wrong");
+10 -4
fs/bcachefs/backpointers.h
··· 45 45 return POS(bp_pos.inode, sector_to_bucket(ca, bucket_sector)); 46 46 } 47 47 48 + static inline struct bpos bucket_pos_to_bp_noerror(const struct bch_dev *ca, 49 + struct bpos bucket, 50 + u64 bucket_offset) 51 + { 52 + return POS(bucket.inode, 53 + (bucket_to_sector(ca, bucket.offset) << 54 + MAX_EXTENT_COMPRESS_RATIO_SHIFT) + bucket_offset); 55 + } 56 + 48 57 /* 49 58 * Convert from pos in alloc btree + bucket offset to pos in backpointer btree: 50 59 */ ··· 62 53 u64 bucket_offset) 63 54 { 64 55 struct bch_dev *ca = bch_dev_bkey_exists(c, bucket.inode); 65 - struct bpos ret = POS(bucket.inode, 66 - (bucket_to_sector(ca, bucket.offset) << 67 - MAX_EXTENT_COMPRESS_RATIO_SHIFT) + bucket_offset); 68 - 56 + struct bpos ret = bucket_pos_to_bp_noerror(ca, bucket, bucket_offset); 69 57 EBUG_ON(!bkey_eq(bucket, bp_pos_to_bucket(c, ret))); 70 58 return ret; 71 59 }
+8
fs/bcachefs/bcachefs_format.h
··· 591 591 __le64 btree_allocated_bitmap; 592 592 }; 593 593 594 + /* 595 + * This limit comes from the bucket_gens array - it's a single allocation, and 596 + * kernel allocation are limited to INT_MAX 597 + */ 598 + #define BCH_MEMBER_NBUCKETS_MAX (INT_MAX - 64) 599 + 594 600 #define BCH_MEMBER_V1_BYTES 56 595 601 596 602 LE64_BITMASK(BCH_MEMBER_STATE, struct bch_member, flags, 0, 4) ··· 902 896 903 897 #define BCH_SB_SECTOR 8 904 898 #define BCH_SB_MEMBERS_MAX 64 /* XXX kill */ 899 + 900 + #define BCH_SB_LAYOUT_SIZE_BITS_MAX 16 /* 32 MB */ 905 901 906 902 struct bch_sb_layout { 907 903 __uuid_t magic; /* bcachefs superblock UUID */
+2 -2
fs/bcachefs/bkey_methods.c
··· 171 171 if (type >= BKEY_TYPE_NR) 172 172 return 0; 173 173 174 - bkey_fsck_err_on((type == BKEY_TYPE_btree || 175 - (flags & BKEY_INVALID_COMMIT)) && 174 + bkey_fsck_err_on(k.k->type < KEY_TYPE_MAX && 175 + (type == BKEY_TYPE_btree || (flags & BKEY_INVALID_COMMIT)) && 176 176 !(bch2_key_types_allowed[type] & BIT_ULL(k.k->type)), c, err, 177 177 bkey_invalid_type_for_btree, 178 178 "invalid key type for btree %s (%s)",
+8 -6
fs/bcachefs/btree_key_cache.c
··· 956 956 } 957 957 958 958 #ifdef __KERNEL__ 959 - for_each_possible_cpu(cpu) { 960 - struct btree_key_cache_freelist *f = 961 - per_cpu_ptr(bc->pcpu_freed, cpu); 959 + if (bc->pcpu_freed) { 960 + for_each_possible_cpu(cpu) { 961 + struct btree_key_cache_freelist *f = 962 + per_cpu_ptr(bc->pcpu_freed, cpu); 962 963 963 - for (i = 0; i < f->nr; i++) { 964 - ck = f->objs[i]; 965 - list_add(&ck->list, &items); 964 + for (i = 0; i < f->nr; i++) { 965 + ck = f->objs[i]; 966 + list_add(&ck->list, &items); 967 + } 966 968 } 967 969 } 968 970 #endif
+1
fs/bcachefs/checksum.c
··· 102 102 int ret; 103 103 104 104 skcipher_request_set_sync_tfm(req, tfm); 105 + skcipher_request_set_callback(req, 0, NULL, NULL); 105 106 skcipher_request_set_crypt(req, sg, sg, len, nonce.d); 106 107 107 108 ret = crypto_skcipher_encrypt(req);
+1
fs/bcachefs/errcode.h
··· 175 175 x(EINVAL, block_size_too_small) \ 176 176 x(EINVAL, bucket_size_too_small) \ 177 177 x(EINVAL, device_size_too_small) \ 178 + x(EINVAL, device_size_too_big) \ 178 179 x(EINVAL, device_not_a_member_of_filesystem) \ 179 180 x(EINVAL, device_has_been_removed) \ 180 181 x(EINVAL, device_splitbrain) \
+1 -1
fs/bcachefs/fs.c
··· 964 964 struct btree_iter iter; 965 965 struct bkey_s_c k; 966 966 struct bkey_buf cur, prev; 967 - struct bpos end = POS(ei->v.i_ino, (start + len) >> 9); 968 967 unsigned offset_into_extent, sectors; 969 968 bool have_extent = false; 970 969 u32 snapshot; ··· 973 974 if (ret) 974 975 return ret; 975 976 977 + struct bpos end = POS(ei->v.i_ino, (start + len) >> 9); 976 978 if (start + len < start) 977 979 return -EINVAL; 978 980
+20 -10
fs/bcachefs/io_write.c
··· 199 199 u64 new_i_size, 200 200 s64 i_sectors_delta) 201 201 { 202 - struct btree_iter iter; 203 - struct bkey_i *k; 204 - struct bkey_i_inode_v3 *inode; 205 202 /* 206 203 * Crazy performance optimization: 207 204 * Every extent update needs to also update the inode: the inode trigger ··· 211 214 * lost, but that's fine. 212 215 */ 213 216 unsigned inode_update_flags = BTREE_UPDATE_NOJOURNAL; 214 - int ret; 215 217 216 - k = bch2_bkey_get_mut_noupdate(trans, &iter, BTREE_ID_inodes, 218 + struct btree_iter iter; 219 + struct bkey_s_c k = bch2_bkey_get_iter(trans, &iter, BTREE_ID_inodes, 217 220 SPOS(0, 218 221 extent_iter->pos.inode, 219 222 extent_iter->snapshot), 220 223 BTREE_ITER_CACHED); 221 - ret = PTR_ERR_OR_ZERO(k); 224 + int ret = bkey_err(k); 222 225 if (unlikely(ret)) 223 226 return ret; 224 227 225 - if (unlikely(k->k.type != KEY_TYPE_inode_v3)) { 226 - k = bch2_inode_to_v3(trans, k); 227 - ret = PTR_ERR_OR_ZERO(k); 228 + /* 229 + * varint_decode_fast(), in the inode .invalid method, reads up to 7 230 + * bytes past the end of the buffer: 231 + */ 232 + struct bkey_i *k_mut = bch2_trans_kmalloc_nomemzero(trans, bkey_bytes(k.k) + 8); 233 + ret = PTR_ERR_OR_ZERO(k_mut); 234 + if (unlikely(ret)) 235 + goto err; 236 + 237 + bkey_reassemble(k_mut, k); 238 + 239 + if (unlikely(k_mut->k.type != KEY_TYPE_inode_v3)) { 240 + k_mut = bch2_inode_to_v3(trans, k_mut); 241 + ret = PTR_ERR_OR_ZERO(k_mut); 228 242 if (unlikely(ret)) 229 243 goto err; 230 244 } 231 245 232 - inode = bkey_i_to_inode_v3(k); 246 + struct bkey_i_inode_v3 *inode = bkey_i_to_inode_v3(k_mut); 233 247 234 248 if (!(le64_to_cpu(inode->v.bi_flags) & BCH_INODE_i_size_dirty) && 235 249 new_i_size > le64_to_cpu(inode->v.bi_size)) { ··· 1512 1504 struct bkey_i_inline_data *id; 1513 1505 unsigned sectors; 1514 1506 int ret; 1507 + 1508 + memset(&op->failed, 0, sizeof(op->failed)); 1515 1509 1516 1510 op->flags |= BCH_WRITE_WROTE_DATA_INLINE; 1517 1511 op->flags |= BCH_WRITE_DONE;
+8
fs/bcachefs/journal.c
··· 706 706 707 707 spin_unlock(&j->lock); 708 708 709 + /* 710 + * We're called from bch2_journal_flush_seq() -> wait_event(); 711 + * but this might block. We won't usually block, so we won't 712 + * livelock: 713 + */ 714 + sched_annotate_sleep(); 709 715 ret = bch2_journal_res_get(j, &res, jset_u64s(0), 0); 710 716 if (ret) 711 717 return ret; ··· 876 870 { 877 871 struct journal_buf *ret = NULL; 878 872 873 + /* We're inside wait_event(), but using mutex_lock(: */ 874 + sched_annotate_sleep(); 879 875 mutex_lock(&j->buf_lock); 880 876 spin_lock(&j->lock); 881 877 max_seq = min(max_seq, journal_cur_seq(j));
+14 -8
fs/bcachefs/move.c
··· 968 968 return migrate_pred(c, arg, bkey_i_to_s_c(&b->key), io_opts, data_opts); 969 969 } 970 970 971 + /* 972 + * Ancient versions of bcachefs produced packed formats which could represent 973 + * keys that the in memory format cannot represent; this checks for those 974 + * formats so we can get rid of them. 975 + */ 971 976 static bool bformat_needs_redo(struct bkey_format *f) 972 977 { 973 - unsigned i; 974 - 975 - for (i = 0; i < f->nr_fields; i++) { 978 + for (unsigned i = 0; i < f->nr_fields; i++) { 979 + unsigned f_bits = f->bits_per_field[i]; 976 980 unsigned unpacked_bits = bch2_bkey_format_current.bits_per_field[i]; 977 981 u64 unpacked_mask = ~((~0ULL << 1) << (unpacked_bits - 1)); 978 982 u64 field_offset = le64_to_cpu(f->field_offset[i]); 979 983 980 - if (f->bits_per_field[i] > unpacked_bits) 984 + if (f_bits > unpacked_bits) 981 985 return true; 982 986 983 - if ((f->bits_per_field[i] == unpacked_bits) && field_offset) 987 + if ((f_bits == unpacked_bits) && field_offset) 984 988 return true; 985 989 986 - if (((field_offset + ((1ULL << f->bits_per_field[i]) - 1)) & 987 - unpacked_mask) < 988 - field_offset) 990 + u64 f_mask = f_bits 991 + ? ~((~0ULL << (f_bits - 1)) << 1) 992 + : 0; 993 + 994 + if (((field_offset + f_mask) & unpacked_mask) < field_offset) 989 995 return true; 990 996 } 991 997
+3 -5
fs/bcachefs/quota.c
··· 560 560 struct bch_fs *c = trans->c; 561 561 struct bch_inode_unpacked u; 562 562 struct bch_snapshot_tree s_t; 563 - int ret; 563 + u32 tree = bch2_snapshot_tree(c, k.k->p.snapshot); 564 564 565 - ret = bch2_snapshot_tree_lookup(trans, 566 - bch2_snapshot_tree(c, k.k->p.snapshot), &s_t); 565 + int ret = bch2_snapshot_tree_lookup(trans, tree, &s_t); 567 566 bch2_fs_inconsistent_on(bch2_err_matches(ret, ENOENT), c, 568 - "%s: snapshot tree %u not found", __func__, 569 - snapshot_t(c, k.k->p.snapshot)->tree); 567 + "%s: snapshot tree %u not found", __func__, tree); 570 568 if (ret) 571 569 return ret; 572 570
+2 -1
fs/bcachefs/recovery.c
··· 902 902 bch2_journal_keys_put_initial(c); 903 903 bch2_find_btree_nodes_exit(&c->found_btree_nodes); 904 904 } 905 - kfree(clean); 905 + if (!IS_ERR(clean)) 906 + kfree(clean); 906 907 907 908 if (!ret && 908 909 test_bit(BCH_FS_need_delete_dead_snapshots, &c->flags) &&
+14
fs/bcachefs/sb-clean.c
··· 278 278 return -BCH_ERR_invalid_sb_clean; 279 279 } 280 280 281 + for (struct jset_entry *entry = clean->start; 282 + entry != vstruct_end(&clean->field); 283 + entry = vstruct_next(entry)) { 284 + if ((void *) vstruct_next(entry) > vstruct_end(&clean->field)) { 285 + prt_str(err, "entry type "); 286 + bch2_prt_jset_entry_type(err, le16_to_cpu(entry->type)); 287 + prt_str(err, " overruns end of section"); 288 + return -BCH_ERR_invalid_sb_clean; 289 + } 290 + } 291 + 281 292 return 0; 282 293 } 283 294 ··· 306 295 for (entry = clean->start; 307 296 entry != vstruct_end(&clean->field); 308 297 entry = vstruct_next(entry)) { 298 + if ((void *) vstruct_next(entry) > vstruct_end(&clean->field)) 299 + break; 300 + 309 301 if (entry->type == BCH_JSET_ENTRY_btree_keys && 310 302 !entry->u64s) 311 303 continue;
+3 -3
fs/bcachefs/sb-members.c
··· 124 124 struct bch_sb *sb, 125 125 int i) 126 126 { 127 - if (le64_to_cpu(m.nbuckets) > LONG_MAX) { 128 - prt_printf(err, "device %u: too many buckets (got %llu, max %lu)", 129 - i, le64_to_cpu(m.nbuckets), LONG_MAX); 127 + if (le64_to_cpu(m.nbuckets) > BCH_MEMBER_NBUCKETS_MAX) { 128 + prt_printf(err, "device %u: too many buckets (got %llu, max %u)", 129 + i, le64_to_cpu(m.nbuckets), BCH_MEMBER_NBUCKETS_MAX); 130 130 return -BCH_ERR_invalid_sb_members; 131 131 } 132 132
+2 -2
fs/bcachefs/sb-members.h
··· 107 107 108 108 static inline struct bch_dev *bch2_get_next_dev(struct bch_fs *c, struct bch_dev *ca) 109 109 { 110 + rcu_read_lock(); 110 111 if (ca) 111 112 percpu_ref_put(&ca->ref); 112 113 113 - rcu_read_lock(); 114 114 if ((ca = __bch2_next_dev(c, ca, NULL))) 115 115 percpu_ref_get(&ca->ref); 116 116 rcu_read_unlock(); ··· 132 132 struct bch_dev *ca, 133 133 unsigned state_mask) 134 134 { 135 + rcu_read_lock(); 135 136 if (ca) 136 137 percpu_ref_put(&ca->io_ref); 137 138 138 - rcu_read_lock(); 139 139 while ((ca = __bch2_next_dev(c, ca, NULL)) && 140 140 (!((1 << ca->mi.state) & state_mask) || 141 141 !percpu_ref_tryget(&ca->io_ref)))
+34 -17
fs/bcachefs/super-io.c
··· 232 232 struct bch_sb_handle *dev_sb = &ca->disk_sb; 233 233 234 234 if (bch2_sb_realloc(dev_sb, le32_to_cpu(dev_sb->sb->u64s) + d)) { 235 - percpu_ref_put(&ca->ref); 235 + percpu_ref_put(&ca->io_ref); 236 236 return NULL; 237 237 } 238 238 } ··· 649 649 650 650 bytes = vstruct_bytes(sb->sb); 651 651 652 - if (bytes > 512 << sb->sb->layout.sb_max_size_bits) { 652 + if (bytes > 512ULL << min(BCH_SB_LAYOUT_SIZE_BITS_MAX, sb->sb->layout.sb_max_size_bits)) { 653 653 prt_printf(err, "Invalid superblock: too big (got %zu bytes, layout max %lu)", 654 654 bytes, 512UL << sb->sb->layout.sb_max_size_bits); 655 655 return -BCH_ERR_invalid_sb_too_big; ··· 923 923 struct bch_devs_mask sb_written; 924 924 bool wrote, can_mount_without_written, can_mount_with_written; 925 925 unsigned degraded_flags = BCH_FORCE_IF_DEGRADED; 926 + DARRAY(struct bch_dev *) online_devices = {}; 926 927 int ret = 0; 927 928 928 929 trace_and_count(c, write_super, c, _RET_IP_); ··· 936 935 closure_init_stack(cl); 937 936 memset(&sb_written, 0, sizeof(sb_written)); 938 937 938 + for_each_online_member(c, ca) { 939 + ret = darray_push(&online_devices, ca); 940 + if (bch2_fs_fatal_err_on(ret, c, "%s: error allocating online devices", __func__)) { 941 + percpu_ref_put(&ca->io_ref); 942 + goto out; 943 + } 944 + percpu_ref_get(&ca->io_ref); 945 + } 946 + 939 947 /* Make sure we're using the new magic numbers: */ 940 948 c->disk_sb.sb->magic = BCHFS_MAGIC; 941 949 c->disk_sb.sb->layout.magic = BCHFS_MAGIC; ··· 952 942 le64_add_cpu(&c->disk_sb.sb->seq, 1); 953 943 954 944 struct bch_sb_field_members_v2 *mi = bch2_sb_field_get(c->disk_sb.sb, members_v2); 955 - for_each_online_member(c, ca) 956 - __bch2_members_v2_get_mut(mi, ca->dev_idx)->seq = c->disk_sb.sb->seq; 945 + darray_for_each(online_devices, ca) 946 + __bch2_members_v2_get_mut(mi, (*ca)->dev_idx)->seq = c->disk_sb.sb->seq; 957 947 c->disk_sb.sb->write_time = cpu_to_le64(ktime_get_real_seconds()); 958 948 959 949 if (test_bit(BCH_FS_error, &c->flags)) ··· 969 959 bch2_sb_errors_from_cpu(c); 970 960 bch2_sb_downgrade_update(c); 971 961 972 - for_each_online_member(c, ca) 973 - bch2_sb_from_fs(c, ca); 962 + darray_for_each(online_devices, ca) 963 + bch2_sb_from_fs(c, (*ca)); 974 964 975 - for_each_online_member(c, ca) { 965 + darray_for_each(online_devices, ca) { 976 966 printbuf_reset(&err); 977 967 978 - ret = bch2_sb_validate(&ca->disk_sb, &err, WRITE); 968 + ret = bch2_sb_validate(&(*ca)->disk_sb, &err, WRITE); 979 969 if (ret) { 980 970 bch2_fs_inconsistent(c, "sb invalid before write: %s", err.buf); 981 - percpu_ref_put(&ca->io_ref); 982 971 goto out; 983 972 } 984 973 } ··· 1004 995 return -BCH_ERR_sb_not_downgraded; 1005 996 } 1006 997 1007 - for_each_online_member(c, ca) { 1008 - __set_bit(ca->dev_idx, sb_written.d); 1009 - ca->sb_write_error = 0; 998 + darray_for_each(online_devices, ca) { 999 + __set_bit((*ca)->dev_idx, sb_written.d); 1000 + (*ca)->sb_write_error = 0; 1010 1001 } 1011 1002 1012 - for_each_online_member(c, ca) 1013 - read_back_super(c, ca); 1003 + darray_for_each(online_devices, ca) 1004 + read_back_super(c, *ca); 1014 1005 closure_sync(cl); 1015 1006 1016 - for_each_online_member(c, ca) { 1007 + darray_for_each(online_devices, cap) { 1008 + struct bch_dev *ca = *cap; 1009 + 1017 1010 if (ca->sb_write_error) 1018 1011 continue; 1019 1012 ··· 1042 1031 1043 1032 do { 1044 1033 wrote = false; 1045 - for_each_online_member(c, ca) 1034 + darray_for_each(online_devices, cap) { 1035 + struct bch_dev *ca = *cap; 1046 1036 if (!ca->sb_write_error && 1047 1037 sb < ca->disk_sb.sb->layout.nr_superblocks) { 1048 1038 write_one_super(c, ca, sb); 1049 1039 wrote = true; 1050 1040 } 1041 + } 1051 1042 closure_sync(cl); 1052 1043 sb++; 1053 1044 } while (wrote); 1054 1045 1055 - for_each_online_member(c, ca) { 1046 + darray_for_each(online_devices, cap) { 1047 + struct bch_dev *ca = *cap; 1056 1048 if (ca->sb_write_error) 1057 1049 __clear_bit(ca->dev_idx, sb_written.d); 1058 1050 else ··· 1091 1077 out: 1092 1078 /* Make new options visible after they're persistent: */ 1093 1079 bch2_sb_update(c); 1080 + darray_for_each(online_devices, ca) 1081 + percpu_ref_put(&(*ca)->io_ref); 1082 + darray_exit(&online_devices); 1094 1083 printbuf_exit(&err); 1095 1084 return ret; 1096 1085 }
+9 -6
fs/bcachefs/super.c
··· 1959 1959 goto err; 1960 1960 } 1961 1961 1962 + if (nbuckets > BCH_MEMBER_NBUCKETS_MAX) { 1963 + bch_err(ca, "New device size too big (%llu greater than max %u)", 1964 + nbuckets, BCH_MEMBER_NBUCKETS_MAX); 1965 + ret = -BCH_ERR_device_size_too_big; 1966 + goto err; 1967 + } 1968 + 1962 1969 if (bch2_dev_is_online(ca) && 1963 1970 get_capacity(ca->disk_sb.bdev->bd_disk) < 1964 1971 ca->mi.bucket_size * nbuckets) { ··· 2011 2004 /* return with ref on ca->ref: */ 2012 2005 struct bch_dev *bch2_dev_lookup(struct bch_fs *c, const char *name) 2013 2006 { 2014 - rcu_read_lock(); 2015 - for_each_member_device_rcu(c, ca, NULL) 2016 - if (!strcmp(name, ca->name)) { 2017 - rcu_read_unlock(); 2007 + for_each_member_device(c, ca) 2008 + if (!strcmp(name, ca->name)) 2018 2009 return ca; 2019 - } 2020 - rcu_read_unlock(); 2021 2010 return ERR_PTR(-BCH_ERR_ENOENT_dev_not_found); 2022 2011 } 2023 2012
+30 -3
fs/btrfs/ioctl.c
··· 3758 3758 goto drop_write; 3759 3759 } 3760 3760 3761 - down_write(&fs_info->subvol_sem); 3762 - 3763 3761 switch (sa->cmd) { 3764 3762 case BTRFS_QUOTA_CTL_ENABLE: 3765 3763 case BTRFS_QUOTA_CTL_ENABLE_SIMPLE_QUOTA: 3764 + down_write(&fs_info->subvol_sem); 3766 3765 ret = btrfs_quota_enable(fs_info, sa); 3766 + up_write(&fs_info->subvol_sem); 3767 3767 break; 3768 3768 case BTRFS_QUOTA_CTL_DISABLE: 3769 + /* 3770 + * Lock the cleaner mutex to prevent races with concurrent 3771 + * relocation, because relocation may be building backrefs for 3772 + * blocks of the quota root while we are deleting the root. This 3773 + * is like dropping fs roots of deleted snapshots/subvolumes, we 3774 + * need the same protection. 3775 + * 3776 + * This also prevents races between concurrent tasks trying to 3777 + * disable quotas, because we will unlock and relock 3778 + * qgroup_ioctl_lock across BTRFS_FS_QUOTA_ENABLED changes. 3779 + * 3780 + * We take this here because we have the dependency of 3781 + * 3782 + * inode_lock -> subvol_sem 3783 + * 3784 + * because of rename. With relocation we can prealloc extents, 3785 + * so that makes the dependency chain 3786 + * 3787 + * cleaner_mutex -> inode_lock -> subvol_sem 3788 + * 3789 + * so we must take the cleaner_mutex here before we take the 3790 + * subvol_sem. The deadlock can't actually happen, but this 3791 + * quiets lockdep. 3792 + */ 3793 + mutex_lock(&fs_info->cleaner_mutex); 3794 + down_write(&fs_info->subvol_sem); 3769 3795 ret = btrfs_quota_disable(fs_info); 3796 + up_write(&fs_info->subvol_sem); 3797 + mutex_unlock(&fs_info->cleaner_mutex); 3770 3798 break; 3771 3799 default: 3772 3800 ret = -EINVAL; ··· 3802 3774 } 3803 3775 3804 3776 kfree(sa); 3805 - up_write(&fs_info->subvol_sem); 3806 3777 drop_write: 3807 3778 mnt_drop_write_file(file); 3808 3779 return ret;
+1
fs/btrfs/ordered-data.c
··· 1188 1188 ordered->disk_bytenr += len; 1189 1189 ordered->num_bytes -= len; 1190 1190 ordered->disk_num_bytes -= len; 1191 + ordered->ram_bytes -= len; 1191 1192 1192 1193 if (test_bit(BTRFS_ORDERED_IO_DONE, &ordered->flags)) { 1193 1194 ASSERT(ordered->bytes_left == 0);
+10 -13
fs/btrfs/qgroup.c
··· 1342 1342 lockdep_assert_held_write(&fs_info->subvol_sem); 1343 1343 1344 1344 /* 1345 - * Lock the cleaner mutex to prevent races with concurrent relocation, 1346 - * because relocation may be building backrefs for blocks of the quota 1347 - * root while we are deleting the root. This is like dropping fs roots 1348 - * of deleted snapshots/subvolumes, we need the same protection. 1349 - * 1350 - * This also prevents races between concurrent tasks trying to disable 1351 - * quotas, because we will unlock and relock qgroup_ioctl_lock across 1352 - * BTRFS_FS_QUOTA_ENABLED changes. 1345 + * Relocation will mess with backrefs, so make sure we have the 1346 + * cleaner_mutex held to protect us from relocate. 1353 1347 */ 1354 - mutex_lock(&fs_info->cleaner_mutex); 1348 + lockdep_assert_held(&fs_info->cleaner_mutex); 1355 1349 1356 1350 mutex_lock(&fs_info->qgroup_ioctl_lock); 1357 1351 if (!fs_info->quota_root) ··· 1367 1373 clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); 1368 1374 btrfs_qgroup_wait_for_completion(fs_info, false); 1369 1375 1376 + /* 1377 + * We have nothing held here and no trans handle, just return the error 1378 + * if there is one. 1379 + */ 1370 1380 ret = flush_reservations(fs_info); 1371 1381 if (ret) 1372 - goto out_unlock_cleaner; 1382 + return ret; 1373 1383 1374 1384 /* 1375 1385 * 1 For the root item ··· 1437 1439 btrfs_end_transaction(trans); 1438 1440 else if (trans) 1439 1441 ret = btrfs_commit_transaction(trans); 1440 - out_unlock_cleaner: 1441 - mutex_unlock(&fs_info->cleaner_mutex); 1442 - 1443 1442 return ret; 1444 1443 } 1445 1444 ··· 3045 3050 struct btrfs_qgroup_inherit *inherit, 3046 3051 size_t size) 3047 3052 { 3053 + if (!btrfs_qgroup_enabled(fs_info)) 3054 + return 0; 3048 3055 if (inherit->flags & ~BTRFS_QGROUP_INHERIT_FLAGS_SUPP) 3049 3056 return -EOPNOTSUPP; 3050 3057 if (size < sizeof(*inherit) || size > PAGE_SIZE)
+15 -15
fs/btrfs/tree-checker.c
··· 1797 1797 return BTRFS_TREE_BLOCK_INVALID_LEVEL; 1798 1798 } 1799 1799 1800 + if (unlikely(!btrfs_header_flag(leaf, BTRFS_HEADER_FLAG_WRITTEN))) { 1801 + generic_err(leaf, 0, "invalid flag for leaf, WRITTEN not set"); 1802 + return BTRFS_TREE_BLOCK_WRITTEN_NOT_SET; 1803 + } 1804 + 1800 1805 /* 1801 1806 * Extent buffers from a relocation tree have a owner field that 1802 1807 * corresponds to the subvolume tree they are based on. So just from an ··· 1863 1858 for (slot = 0; slot < nritems; slot++) { 1864 1859 u32 item_end_expected; 1865 1860 u64 item_data_end; 1861 + enum btrfs_tree_block_status ret; 1866 1862 1867 1863 btrfs_item_key_to_cpu(leaf, &key, slot); 1868 1864 ··· 1919 1913 return BTRFS_TREE_BLOCK_INVALID_OFFSETS; 1920 1914 } 1921 1915 1922 - /* 1923 - * We only want to do this if WRITTEN is set, otherwise the leaf 1924 - * may be in some intermediate state and won't appear valid. 1925 - */ 1926 - if (btrfs_header_flag(leaf, BTRFS_HEADER_FLAG_WRITTEN)) { 1927 - enum btrfs_tree_block_status ret; 1928 - 1929 - /* 1930 - * Check if the item size and content meet other 1931 - * criteria 1932 - */ 1933 - ret = check_leaf_item(leaf, &key, slot, &prev_key); 1934 - if (unlikely(ret != BTRFS_TREE_BLOCK_CLEAN)) 1935 - return ret; 1936 - } 1916 + /* Check if the item size and content meet other criteria. */ 1917 + ret = check_leaf_item(leaf, &key, slot, &prev_key); 1918 + if (unlikely(ret != BTRFS_TREE_BLOCK_CLEAN)) 1919 + return ret; 1937 1920 1938 1921 prev_key.objectid = key.objectid; 1939 1922 prev_key.type = key.type; ··· 1951 1956 int slot; 1952 1957 int level = btrfs_header_level(node); 1953 1958 u64 bytenr; 1959 + 1960 + if (unlikely(!btrfs_header_flag(node, BTRFS_HEADER_FLAG_WRITTEN))) { 1961 + generic_err(node, 0, "invalid flag for node, WRITTEN not set"); 1962 + return BTRFS_TREE_BLOCK_WRITTEN_NOT_SET; 1963 + } 1954 1964 1955 1965 if (unlikely(level <= 0 || level >= BTRFS_MAX_LEVEL)) { 1956 1966 generic_err(node, 0,
+1
fs/btrfs/tree-checker.h
··· 53 53 BTRFS_TREE_BLOCK_INVALID_BLOCKPTR, 54 54 BTRFS_TREE_BLOCK_INVALID_ITEM, 55 55 BTRFS_TREE_BLOCK_INVALID_OWNER, 56 + BTRFS_TREE_BLOCK_WRITTEN_NOT_SET, 56 57 }; 57 58 58 59 /*
+1
fs/btrfs/volumes.c
··· 3455 3455 * alignment and size). 3456 3456 */ 3457 3457 ret = -EUCLEAN; 3458 + mutex_unlock(&fs_info->reclaim_bgs_lock); 3458 3459 goto error; 3459 3460 } 3460 3461
+37 -1
fs/eventpoll.c
··· 980 980 } 981 981 982 982 /* 983 + * The ffd.file pointer may be in the process of being torn down due to 984 + * being closed, but we may not have finished eventpoll_release() yet. 985 + * 986 + * Normally, even with the atomic_long_inc_not_zero, the file may have 987 + * been free'd and then gotten re-allocated to something else (since 988 + * files are not RCU-delayed, they are SLAB_TYPESAFE_BY_RCU). 989 + * 990 + * But for epoll, users hold the ep->mtx mutex, and as such any file in 991 + * the process of being free'd will block in eventpoll_release_file() 992 + * and thus the underlying file allocation will not be free'd, and the 993 + * file re-use cannot happen. 994 + * 995 + * For the same reason we can avoid a rcu_read_lock() around the 996 + * operation - 'ffd.file' cannot go away even if the refcount has 997 + * reached zero (but we must still not call out to ->poll() functions 998 + * etc). 999 + */ 1000 + static struct file *epi_fget(const struct epitem *epi) 1001 + { 1002 + struct file *file; 1003 + 1004 + file = epi->ffd.file; 1005 + if (!atomic_long_inc_not_zero(&file->f_count)) 1006 + file = NULL; 1007 + return file; 1008 + } 1009 + 1010 + /* 983 1011 * Differs from ep_eventpoll_poll() in that internal callers already have 984 1012 * the ep->mtx so we need to start from depth=1, such that mutex_lock_nested() 985 1013 * is correctly annotated. ··· 1015 987 static __poll_t ep_item_poll(const struct epitem *epi, poll_table *pt, 1016 988 int depth) 1017 989 { 1018 - struct file *file = epi->ffd.file; 990 + struct file *file = epi_fget(epi); 1019 991 __poll_t res; 992 + 993 + /* 994 + * We could return EPOLLERR | EPOLLHUP or something, but let's 995 + * treat this more as "file doesn't exist, poll didn't happen". 996 + */ 997 + if (!file) 998 + return 0; 1020 999 1021 1000 pt->_key = epi->event.events; 1022 1001 if (!is_file_epoll(file)) 1023 1002 res = vfs_poll(file, pt); 1024 1003 else 1025 1004 res = __ep_eventpoll_poll(file, pt, depth); 1005 + fput(file); 1026 1006 return res & epi->event.events; 1027 1007 } 1028 1008
+2
fs/exfat/dir.c
··· 420 420 static void exfat_init_stream_entry(struct exfat_dentry *ep, 421 421 unsigned int start_clu, unsigned long long size) 422 422 { 423 + memset(ep, 0, sizeof(*ep)); 423 424 exfat_set_entry_type(ep, TYPE_STREAM); 424 425 if (size == 0) 425 426 ep->dentry.stream.flags = ALLOC_FAT_CHAIN; ··· 458 457 struct exfat_dentry *ep; 459 458 460 459 ep = exfat_get_dentry_cached(es, ES_IDX_FILE); 460 + memset(ep, 0, sizeof(*ep)); 461 461 exfat_set_entry_type(ep, type); 462 462 exfat_set_entry_time(sbi, ts, 463 463 &ep->dentry.file.create_tz,
+4 -5
fs/exfat/file.c
··· 51 51 clu.flags = ei->flags; 52 52 53 53 ret = exfat_alloc_cluster(inode, new_num_clusters - num_clusters, 54 - &clu, IS_DIRSYNC(inode)); 54 + &clu, inode_needs_sync(inode)); 55 55 if (ret) 56 56 return ret; 57 57 ··· 77 77 ei->i_size_aligned = round_up(size, sb->s_blocksize); 78 78 ei->i_size_ondisk = ei->i_size_aligned; 79 79 inode->i_blocks = round_up(size, sbi->cluster_size) >> 9; 80 - 81 - if (IS_DIRSYNC(inode)) 82 - return write_inode_now(inode, 1); 83 - 84 80 mark_inode_dirty(inode); 81 + 82 + if (IS_SYNC(inode)) 83 + return write_inode_now(inode, 1); 85 84 86 85 return 0; 87 86
+1 -1
fs/fuse/passthrough.c
··· 225 225 goto out; 226 226 227 227 res = -EINVAL; 228 - if (map->flags) 228 + if (map->flags || map->padding) 229 229 goto out; 230 230 231 231 file = fget(map->fd);
+1 -1
fs/fuse/virtio_fs.c
··· 170 170 { 171 171 struct virtio_fs *fs = container_of(kobj, struct virtio_fs, kobj); 172 172 173 - return sysfs_emit(buf, fs->tag); 173 + return sysfs_emit(buf, "%s\n", fs->tag); 174 174 } 175 175 176 176 static struct kobj_attribute virtio_fs_tag_attr = __ATTR_RO(tag);
+35 -30
fs/smb/server/oplock.c
··· 207 207 { 208 208 struct ksmbd_inode *ci = opinfo->o_fp->f_ci; 209 209 210 - write_lock(&ci->m_lock); 210 + down_write(&ci->m_lock); 211 211 list_add_rcu(&opinfo->op_entry, &ci->m_op_list); 212 - write_unlock(&ci->m_lock); 212 + up_write(&ci->m_lock); 213 213 } 214 214 215 215 static void opinfo_del(struct oplock_info *opinfo) ··· 221 221 lease_del_list(opinfo); 222 222 write_unlock(&lease_list_lock); 223 223 } 224 - write_lock(&ci->m_lock); 224 + down_write(&ci->m_lock); 225 225 list_del_rcu(&opinfo->op_entry); 226 - write_unlock(&ci->m_lock); 226 + up_write(&ci->m_lock); 227 227 } 228 228 229 229 static unsigned long opinfo_count(struct ksmbd_file *fp) ··· 526 526 * Compare lease key and client_guid to know request from same owner 527 527 * of same client 528 528 */ 529 - read_lock(&ci->m_lock); 529 + down_read(&ci->m_lock); 530 530 list_for_each_entry(opinfo, &ci->m_op_list, op_entry) { 531 531 if (!opinfo->is_lease || !opinfo->conn) 532 532 continue; 533 - read_unlock(&ci->m_lock); 534 533 lease = opinfo->o_lease; 535 534 536 535 ret = compare_guid_key(opinfo, client_guid, lctx->lease_key); 537 536 if (ret) { 538 537 m_opinfo = opinfo; 539 538 /* skip upgrading lease about breaking lease */ 540 - if (atomic_read(&opinfo->breaking_cnt)) { 541 - read_lock(&ci->m_lock); 539 + if (atomic_read(&opinfo->breaking_cnt)) 542 540 continue; 543 - } 544 541 545 542 /* upgrading lease */ 546 543 if ((atomic_read(&ci->op_count) + ··· 567 570 lease_none_upgrade(opinfo, lctx->req_state); 568 571 } 569 572 } 570 - read_lock(&ci->m_lock); 571 573 } 572 - read_unlock(&ci->m_lock); 574 + up_read(&ci->m_lock); 573 575 574 576 return m_opinfo; 575 577 } ··· 609 613 610 614 if (opinfo->op_state == OPLOCK_CLOSING) 611 615 return -ENOENT; 612 - else if (!opinfo->is_lease && opinfo->level <= req_op_level) 613 - return 1; 616 + else if (opinfo->level <= req_op_level) { 617 + if (opinfo->is_lease && 618 + opinfo->o_lease->state != 619 + (SMB2_LEASE_HANDLE_CACHING_LE | 620 + SMB2_LEASE_READ_CACHING_LE)) 621 + return 1; 622 + } 614 623 } 615 624 616 - if (!opinfo->is_lease && opinfo->level <= req_op_level) { 617 - wake_up_oplock_break(opinfo); 618 - return 1; 625 + if (opinfo->level <= req_op_level) { 626 + if (opinfo->is_lease && 627 + opinfo->o_lease->state != 628 + (SMB2_LEASE_HANDLE_CACHING_LE | 629 + SMB2_LEASE_READ_CACHING_LE)) { 630 + wake_up_oplock_break(opinfo); 631 + return 1; 632 + } 619 633 } 620 634 return 0; 621 635 } ··· 893 887 struct lease *lease = brk_opinfo->o_lease; 894 888 895 889 atomic_inc(&brk_opinfo->breaking_cnt); 896 - 897 890 err = oplock_break_pending(brk_opinfo, req_op_level); 898 891 if (err) 899 892 return err < 0 ? err : 0; ··· 1110 1105 if (!p_ci) 1111 1106 return; 1112 1107 1113 - read_lock(&p_ci->m_lock); 1108 + down_read(&p_ci->m_lock); 1114 1109 list_for_each_entry(opinfo, &p_ci->m_op_list, op_entry) { 1115 1110 if (opinfo->conn == NULL || !opinfo->is_lease) 1116 1111 continue; ··· 1128 1123 continue; 1129 1124 } 1130 1125 1131 - read_unlock(&p_ci->m_lock); 1132 1126 oplock_break(opinfo, SMB2_OPLOCK_LEVEL_NONE); 1133 1127 opinfo_conn_put(opinfo); 1134 - read_lock(&p_ci->m_lock); 1135 1128 } 1136 1129 } 1137 - read_unlock(&p_ci->m_lock); 1130 + up_read(&p_ci->m_lock); 1138 1131 1139 1132 ksmbd_inode_put(p_ci); 1140 1133 } ··· 1153 1150 if (!p_ci) 1154 1151 return; 1155 1152 1156 - read_lock(&p_ci->m_lock); 1153 + down_read(&p_ci->m_lock); 1157 1154 list_for_each_entry(opinfo, &p_ci->m_op_list, op_entry) { 1158 1155 if (opinfo->conn == NULL || !opinfo->is_lease) 1159 1156 continue; ··· 1167 1164 atomic_dec(&opinfo->conn->r_count); 1168 1165 continue; 1169 1166 } 1170 - read_unlock(&p_ci->m_lock); 1171 1167 oplock_break(opinfo, SMB2_OPLOCK_LEVEL_NONE); 1172 1168 opinfo_conn_put(opinfo); 1173 - read_lock(&p_ci->m_lock); 1174 1169 } 1175 1170 } 1176 - read_unlock(&p_ci->m_lock); 1171 + up_read(&p_ci->m_lock); 1177 1172 1178 1173 ksmbd_inode_put(p_ci); 1179 1174 } ··· 1201 1200 1202 1201 /* Only v2 leases handle the directory */ 1203 1202 if (S_ISDIR(file_inode(fp->filp)->i_mode)) { 1204 - if (!lctx || lctx->version != 2) 1203 + if (!lctx || lctx->version != 2 || 1204 + (lctx->flags != SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET_LE && 1205 + !lctx->epoch)) 1205 1206 return 0; 1206 1207 } 1207 1208 ··· 1468 1465 buf->lcontext.LeaseFlags = lease->flags; 1469 1466 buf->lcontext.Epoch = cpu_to_le16(lease->epoch); 1470 1467 buf->lcontext.LeaseState = lease->state; 1471 - memcpy(buf->lcontext.ParentLeaseKey, lease->parent_lease_key, 1472 - SMB2_LEASE_KEY_SIZE); 1468 + if (lease->flags == SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET_LE) 1469 + memcpy(buf->lcontext.ParentLeaseKey, lease->parent_lease_key, 1470 + SMB2_LEASE_KEY_SIZE); 1473 1471 buf->ccontext.DataOffset = cpu_to_le16(offsetof 1474 1472 (struct create_lease_v2, lcontext)); 1475 1473 buf->ccontext.DataLength = cpu_to_le32(sizeof(struct lease_context_v2)); ··· 1529 1525 lreq->flags = lc->lcontext.LeaseFlags; 1530 1526 lreq->epoch = lc->lcontext.Epoch; 1531 1527 lreq->duration = lc->lcontext.LeaseDuration; 1532 - memcpy(lreq->parent_lease_key, lc->lcontext.ParentLeaseKey, 1533 - SMB2_LEASE_KEY_SIZE); 1528 + if (lreq->flags == SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET_LE) 1529 + memcpy(lreq->parent_lease_key, lc->lcontext.ParentLeaseKey, 1530 + SMB2_LEASE_KEY_SIZE); 1534 1531 lreq->version = 2; 1535 1532 } else { 1536 1533 struct create_lease *lc = (struct create_lease *)cc;
+4 -4
fs/smb/server/smb2pdu.c
··· 1926 1926 struct ksmbd_session *sess = work->sess; 1927 1927 char *treename = NULL, *name = NULL; 1928 1928 struct ksmbd_tree_conn_status status; 1929 - struct ksmbd_share_config *share; 1929 + struct ksmbd_share_config *share = NULL; 1930 1930 int rc = -EINVAL; 1931 1931 1932 1932 WORK_BUFFERS(work, req, rsp); ··· 1988 1988 write_unlock(&sess->tree_conns_lock); 1989 1989 rsp->StructureSize = cpu_to_le16(16); 1990 1990 out_err1: 1991 - if (server_conf.flags & KSMBD_GLOBAL_FLAG_DURABLE_HANDLE && 1991 + if (server_conf.flags & KSMBD_GLOBAL_FLAG_DURABLE_HANDLE && share && 1992 1992 test_share_config_flag(share, 1993 1993 KSMBD_SHARE_FLAG_CONTINUOUS_AVAILABILITY)) 1994 1994 rsp->Capabilities = SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY; ··· 3376 3376 * after daccess, saccess, attrib_only, and stream are 3377 3377 * initialized. 3378 3378 */ 3379 - write_lock(&fp->f_ci->m_lock); 3379 + down_write(&fp->f_ci->m_lock); 3380 3380 list_add(&fp->node, &fp->f_ci->m_fp_list); 3381 - write_unlock(&fp->f_ci->m_lock); 3381 + up_write(&fp->f_ci->m_lock); 3382 3382 3383 3383 /* Check delete pending among previous fp before oplock break */ 3384 3384 if (ksmbd_inode_pending_delete(fp)) {
+2 -2
fs/smb/server/smb_common.c
··· 646 646 * Lookup fp in master fp list, and check desired access and 647 647 * shared mode between previous open and current open. 648 648 */ 649 - read_lock(&curr_fp->f_ci->m_lock); 649 + down_read(&curr_fp->f_ci->m_lock); 650 650 list_for_each_entry(prev_fp, &curr_fp->f_ci->m_fp_list, node) { 651 651 if (file_inode(filp) != file_inode(prev_fp->filp)) 652 652 continue; ··· 722 722 break; 723 723 } 724 724 } 725 - read_unlock(&curr_fp->f_ci->m_lock); 725 + up_read(&curr_fp->f_ci->m_lock); 726 726 727 727 return rc; 728 728 }
+4
fs/smb/server/transport_tcp.c
··· 448 448 sin6.sin6_family = PF_INET6; 449 449 sin6.sin6_addr = in6addr_any; 450 450 sin6.sin6_port = htons(server_conf.tcp_port); 451 + 452 + lock_sock(ksmbd_socket->sk); 453 + ksmbd_socket->sk->sk_ipv6only = false; 454 + release_sock(ksmbd_socket->sk); 451 455 } 452 456 453 457 ksmbd_tcp_nodelay(ksmbd_socket);
+14 -14
fs/smb/server/vfs_cache.c
··· 165 165 ci->m_fattr = 0; 166 166 INIT_LIST_HEAD(&ci->m_fp_list); 167 167 INIT_LIST_HEAD(&ci->m_op_list); 168 - rwlock_init(&ci->m_lock); 168 + init_rwsem(&ci->m_lock); 169 169 ci->m_de = fp->filp->f_path.dentry; 170 170 return 0; 171 171 } ··· 261 261 } 262 262 263 263 if (atomic_dec_and_test(&ci->m_count)) { 264 - write_lock(&ci->m_lock); 264 + down_write(&ci->m_lock); 265 265 if (ci->m_flags & (S_DEL_ON_CLS | S_DEL_PENDING)) { 266 266 ci->m_flags &= ~(S_DEL_ON_CLS | S_DEL_PENDING); 267 - write_unlock(&ci->m_lock); 267 + up_write(&ci->m_lock); 268 268 ksmbd_vfs_unlink(filp); 269 - write_lock(&ci->m_lock); 269 + down_write(&ci->m_lock); 270 270 } 271 - write_unlock(&ci->m_lock); 271 + up_write(&ci->m_lock); 272 272 273 273 ksmbd_inode_free(ci); 274 274 } ··· 289 289 if (!has_file_id(fp->volatile_id)) 290 290 return; 291 291 292 - write_lock(&fp->f_ci->m_lock); 292 + down_write(&fp->f_ci->m_lock); 293 293 list_del_init(&fp->node); 294 - write_unlock(&fp->f_ci->m_lock); 294 + up_write(&fp->f_ci->m_lock); 295 295 296 296 write_lock(&ft->lock); 297 297 idr_remove(ft->idr, fp->volatile_id); ··· 523 523 if (!ci) 524 524 return NULL; 525 525 526 - read_lock(&ci->m_lock); 526 + down_read(&ci->m_lock); 527 527 list_for_each_entry(lfp, &ci->m_fp_list, node) { 528 528 if (inode == file_inode(lfp->filp)) { 529 529 atomic_dec(&ci->m_count); 530 530 lfp = ksmbd_fp_get(lfp); 531 - read_unlock(&ci->m_lock); 531 + up_read(&ci->m_lock); 532 532 return lfp; 533 533 } 534 534 } 535 535 atomic_dec(&ci->m_count); 536 - read_unlock(&ci->m_lock); 536 + up_read(&ci->m_lock); 537 537 return NULL; 538 538 } 539 539 ··· 705 705 706 706 conn = fp->conn; 707 707 ci = fp->f_ci; 708 - write_lock(&ci->m_lock); 708 + down_write(&ci->m_lock); 709 709 list_for_each_entry_rcu(op, &ci->m_op_list, op_entry) { 710 710 if (op->conn != conn) 711 711 continue; 712 712 op->conn = NULL; 713 713 } 714 - write_unlock(&ci->m_lock); 714 + up_write(&ci->m_lock); 715 715 716 716 fp->conn = NULL; 717 717 fp->tcon = NULL; ··· 801 801 fp->tcon = work->tcon; 802 802 803 803 ci = fp->f_ci; 804 - write_lock(&ci->m_lock); 804 + down_write(&ci->m_lock); 805 805 list_for_each_entry_rcu(op, &ci->m_op_list, op_entry) { 806 806 if (op->conn) 807 807 continue; 808 808 op->conn = fp->conn; 809 809 } 810 - write_unlock(&ci->m_lock); 810 + up_write(&ci->m_lock); 811 811 812 812 __open_id(&work->sess->file_table, fp, OPEN_ID_TYPE_VOLATILE_ID); 813 813 if (!has_file_id(fp->volatile_id)) {
+1 -1
fs/smb/server/vfs_cache.h
··· 47 47 }; 48 48 49 49 struct ksmbd_inode { 50 - rwlock_t m_lock; 50 + struct rw_semaphore m_lock; 51 51 atomic_t m_count; 52 52 atomic_t op_count; 53 53 /* opinfo count for streams */
+97 -51
fs/tracefs/event_inode.c
··· 37 37 38 38 struct eventfs_root_inode { 39 39 struct eventfs_inode ei; 40 + struct inode *parent_inode; 40 41 struct dentry *events_dir; 41 42 }; 42 43 ··· 69 68 EVENTFS_SAVE_MODE = BIT(16), 70 69 EVENTFS_SAVE_UID = BIT(17), 71 70 EVENTFS_SAVE_GID = BIT(18), 72 - EVENTFS_TOPLEVEL = BIT(19), 73 71 }; 74 72 75 73 #define EVENTFS_MODE_MASK (EVENTFS_SAVE_MODE - 1) 74 + 75 + static void free_ei_rcu(struct rcu_head *rcu) 76 + { 77 + struct eventfs_inode *ei = container_of(rcu, struct eventfs_inode, rcu); 78 + struct eventfs_root_inode *rei; 79 + 80 + kfree(ei->entry_attrs); 81 + kfree_const(ei->name); 82 + if (ei->is_events) { 83 + rei = get_root_inode(ei); 84 + kfree(rei); 85 + } else { 86 + kfree(ei); 87 + } 88 + } 76 89 77 90 /* 78 91 * eventfs_inode reference count management. ··· 99 84 static void release_ei(struct kref *ref) 100 85 { 101 86 struct eventfs_inode *ei = container_of(ref, struct eventfs_inode, kref); 102 - struct eventfs_root_inode *rei; 87 + const struct eventfs_entry *entry; 103 88 104 89 WARN_ON_ONCE(!ei->is_freed); 105 90 106 - kfree(ei->entry_attrs); 107 - kfree_const(ei->name); 108 - if (ei->is_events) { 109 - rei = get_root_inode(ei); 110 - kfree_rcu(rei, ei.rcu); 111 - } else { 112 - kfree_rcu(ei, rcu); 91 + for (int i = 0; i < ei->nr_entries; i++) { 92 + entry = &ei->entries[i]; 93 + if (entry->release) 94 + entry->release(entry->name, ei->data); 113 95 } 96 + 97 + call_rcu(&ei->rcu, free_ei_rcu); 114 98 } 115 99 116 100 static inline void put_ei(struct eventfs_inode *ei) ··· 123 109 if (ei) { 124 110 ei->is_freed = 1; 125 111 put_ei(ei); 112 + } 113 + } 114 + 115 + /* 116 + * Called when creation of an ei fails, do not call release() functions. 117 + */ 118 + static inline void cleanup_ei(struct eventfs_inode *ei) 119 + { 120 + if (ei) { 121 + /* Set nr_entries to 0 to prevent release() function being called */ 122 + ei->nr_entries = 0; 123 + free_ei(ei); 126 124 } 127 125 } 128 126 ··· 207 181 * determined by the parent directory. 208 182 */ 209 183 if (dentry->d_inode->i_mode & S_IFDIR) { 210 - /* 211 - * The events directory dentry is never freed, unless its 212 - * part of an instance that is deleted. It's attr is the 213 - * default for its child files and directories. 214 - * Do not update it. It's not used for its own mode or ownership. 215 - */ 216 - if (ei->is_events) { 217 - /* But it still needs to know if it was modified */ 218 - if (iattr->ia_valid & ATTR_UID) 219 - ei->attr.mode |= EVENTFS_SAVE_UID; 220 - if (iattr->ia_valid & ATTR_GID) 221 - ei->attr.mode |= EVENTFS_SAVE_GID; 222 - } else { 223 - update_attr(&ei->attr, iattr); 224 - } 184 + update_attr(&ei->attr, iattr); 225 185 226 186 } else { 227 187 name = dentry->d_name.name; ··· 225 213 return ret; 226 214 } 227 215 228 - static void update_top_events_attr(struct eventfs_inode *ei, struct super_block *sb) 216 + static void update_events_attr(struct eventfs_inode *ei, struct super_block *sb) 229 217 { 230 - struct inode *root; 218 + struct eventfs_root_inode *rei; 219 + struct inode *parent; 231 220 232 - /* Only update if the "events" was on the top level */ 233 - if (!ei || !(ei->attr.mode & EVENTFS_TOPLEVEL)) 234 - return; 221 + rei = get_root_inode(ei); 235 222 236 - /* Get the tracefs root inode. */ 237 - root = d_inode(sb->s_root); 238 - ei->attr.uid = root->i_uid; 239 - ei->attr.gid = root->i_gid; 223 + /* Use the parent inode permissions unless root set its permissions */ 224 + parent = rei->parent_inode; 225 + 226 + if (rei->ei.attr.mode & EVENTFS_SAVE_UID) 227 + ei->attr.uid = rei->ei.attr.uid; 228 + else 229 + ei->attr.uid = parent->i_uid; 230 + 231 + if (rei->ei.attr.mode & EVENTFS_SAVE_GID) 232 + ei->attr.gid = rei->ei.attr.gid; 233 + else 234 + ei->attr.gid = parent->i_gid; 240 235 } 241 236 242 237 static void set_top_events_ownership(struct inode *inode) ··· 252 233 struct eventfs_inode *ei = ti->private; 253 234 254 235 /* The top events directory doesn't get automatically updated */ 255 - if (!ei || !ei->is_events || !(ei->attr.mode & EVENTFS_TOPLEVEL)) 236 + if (!ei || !ei->is_events) 256 237 return; 257 238 258 - update_top_events_attr(ei, inode->i_sb); 239 + update_events_attr(ei, inode->i_sb); 259 240 260 241 if (!(ei->attr.mode & EVENTFS_SAVE_UID)) 261 242 inode->i_uid = ei->attr.uid; ··· 284 265 return generic_permission(idmap, inode, mask); 285 266 } 286 267 287 - static const struct inode_operations eventfs_root_dir_inode_operations = { 268 + static const struct inode_operations eventfs_dir_inode_operations = { 288 269 .lookup = eventfs_root_lookup, 289 270 .setattr = eventfs_set_attr, 290 271 .getattr = eventfs_get_attr, ··· 300 281 .iterate_shared = eventfs_iterate, 301 282 .llseek = generic_file_llseek, 302 283 }; 284 + 285 + /* 286 + * On a remount of tracefs, if UID or GID options are set, then 287 + * the mount point inode permissions should be used. 288 + * Reset the saved permission flags appropriately. 289 + */ 290 + void eventfs_remount(struct tracefs_inode *ti, bool update_uid, bool update_gid) 291 + { 292 + struct eventfs_inode *ei = ti->private; 293 + 294 + if (!ei) 295 + return; 296 + 297 + if (update_uid) 298 + ei->attr.mode &= ~EVENTFS_SAVE_UID; 299 + 300 + if (update_gid) 301 + ei->attr.mode &= ~EVENTFS_SAVE_GID; 302 + 303 + if (!ei->entry_attrs) 304 + return; 305 + 306 + for (int i = 0; i < ei->nr_entries; i++) { 307 + if (update_uid) 308 + ei->entry_attrs[i].mode &= ~EVENTFS_SAVE_UID; 309 + if (update_gid) 310 + ei->entry_attrs[i].mode &= ~EVENTFS_SAVE_GID; 311 + } 312 + } 303 313 304 314 /* Return the evenfs_inode of the "events" directory */ 305 315 static struct eventfs_inode *eventfs_find_events(struct dentry *dentry) ··· 352 304 // Walk upwards until you find the events inode 353 305 } while (!ei->is_events); 354 306 355 - update_top_events_attr(ei, dentry->d_sb); 307 + update_events_attr(ei, dentry->d_sb); 356 308 357 309 return ei; 358 310 } ··· 458 410 update_inode_attr(dentry, inode, &ei->attr, 459 411 S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO); 460 412 461 - inode->i_op = &eventfs_root_dir_inode_operations; 413 + inode->i_op = &eventfs_dir_inode_operations; 462 414 inode->i_fop = &eventfs_file_operations; 463 415 464 416 /* All directories will have the same inode number */ ··· 782 734 783 735 /* Was the parent freed? */ 784 736 if (list_empty(&ei->list)) { 785 - free_ei(ei); 737 + cleanup_ei(ei); 786 738 ei = NULL; 787 739 } 788 740 return ei; ··· 829 781 // Note: we have a ref to the dentry from tracefs_start_creating() 830 782 rei = get_root_inode(ei); 831 783 rei->events_dir = dentry; 784 + rei->parent_inode = d_inode(dentry->d_sb->s_root); 832 785 833 786 ei->entries = entries; 834 787 ei->nr_entries = size; ··· 839 790 uid = d_inode(dentry->d_parent)->i_uid; 840 791 gid = d_inode(dentry->d_parent)->i_gid; 841 792 842 - /* 843 - * If the events directory is of the top instance, then parent 844 - * is NULL. Set the attr.mode to reflect this and its permissions will 845 - * default to the tracefs root dentry. 846 - */ 847 - if (!parent) 848 - ei->attr.mode = EVENTFS_TOPLEVEL; 849 - 850 - /* This is used as the default ownership of the files and directories */ 851 793 ei->attr.uid = uid; 852 794 ei->attr.gid = gid; 795 + 796 + /* 797 + * When the "events" directory is created, it takes on the 798 + * permissions of its parent. But can be reset on remount. 799 + */ 800 + ei->attr.mode |= EVENTFS_SAVE_UID | EVENTFS_SAVE_GID; 853 801 854 802 INIT_LIST_HEAD(&ei->children); 855 803 INIT_LIST_HEAD(&ei->list); 856 804 857 805 ti = get_tracefs(inode); 858 - ti->flags |= TRACEFS_EVENT_INODE | TRACEFS_EVENT_TOP_INODE; 806 + ti->flags |= TRACEFS_EVENT_INODE; 859 807 ti->private = ei; 860 808 861 809 inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; 862 810 inode->i_uid = uid; 863 811 inode->i_gid = gid; 864 - inode->i_op = &eventfs_root_dir_inode_operations; 812 + inode->i_op = &eventfs_dir_inode_operations; 865 813 inode->i_fop = &eventfs_file_operations; 866 814 867 815 dentry->d_fsdata = get_ei(ei); ··· 881 835 return ei; 882 836 883 837 fail: 884 - free_ei(ei); 838 + cleanup_ei(ei); 885 839 tracefs_failed_creating(dentry); 886 840 return ERR_PTR(-ENOMEM); 887 841 }
+89 -3
fs/tracefs/inode.c
··· 30 30 static int tracefs_mount_count; 31 31 static bool tracefs_registered; 32 32 33 + /* 34 + * Keep track of all tracefs_inodes in order to update their 35 + * flags if necessary on a remount. 36 + */ 37 + static DEFINE_SPINLOCK(tracefs_inode_lock); 38 + static LIST_HEAD(tracefs_inodes); 39 + 33 40 static struct inode *tracefs_alloc_inode(struct super_block *sb) 34 41 { 35 42 struct tracefs_inode *ti; 43 + unsigned long flags; 36 44 37 45 ti = kmem_cache_alloc(tracefs_inode_cachep, GFP_KERNEL); 38 46 if (!ti) 39 47 return NULL; 40 48 49 + spin_lock_irqsave(&tracefs_inode_lock, flags); 50 + list_add_rcu(&ti->list, &tracefs_inodes); 51 + spin_unlock_irqrestore(&tracefs_inode_lock, flags); 52 + 41 53 return &ti->vfs_inode; 54 + } 55 + 56 + static void tracefs_free_inode_rcu(struct rcu_head *rcu) 57 + { 58 + struct tracefs_inode *ti; 59 + 60 + ti = container_of(rcu, struct tracefs_inode, rcu); 61 + kmem_cache_free(tracefs_inode_cachep, ti); 42 62 } 43 63 44 64 static void tracefs_free_inode(struct inode *inode) 45 65 { 46 - kmem_cache_free(tracefs_inode_cachep, get_tracefs(inode)); 66 + struct tracefs_inode *ti = get_tracefs(inode); 67 + unsigned long flags; 68 + 69 + spin_lock_irqsave(&tracefs_inode_lock, flags); 70 + list_del_rcu(&ti->list); 71 + spin_unlock_irqrestore(&tracefs_inode_lock, flags); 72 + 73 + call_rcu(&ti->rcu, tracefs_free_inode_rcu); 47 74 } 48 75 49 76 static ssize_t default_read_file(struct file *file, char __user *buf, ··· 180 153 { 181 154 struct tracefs_inode *ti = get_tracefs(inode); 182 155 struct inode *root_inode = ti->private; 156 + kuid_t uid; 157 + kgid_t gid; 158 + 159 + uid = root_inode->i_uid; 160 + gid = root_inode->i_gid; 161 + 162 + /* 163 + * If the root is not the mount point, then check the root's 164 + * permissions. If it was never set, then default to the 165 + * mount point. 166 + */ 167 + if (root_inode != d_inode(root_inode->i_sb->s_root)) { 168 + struct tracefs_inode *rti; 169 + 170 + rti = get_tracefs(root_inode); 171 + root_inode = d_inode(root_inode->i_sb->s_root); 172 + 173 + if (!(rti->flags & TRACEFS_UID_PERM_SET)) 174 + uid = root_inode->i_uid; 175 + 176 + if (!(rti->flags & TRACEFS_GID_PERM_SET)) 177 + gid = root_inode->i_gid; 178 + } 183 179 184 180 /* 185 181 * If this inode has never been referenced, then update 186 182 * the permissions to the superblock. 187 183 */ 188 184 if (!(ti->flags & TRACEFS_UID_PERM_SET)) 189 - inode->i_uid = root_inode->i_uid; 185 + inode->i_uid = uid; 190 186 191 187 if (!(ti->flags & TRACEFS_GID_PERM_SET)) 192 - inode->i_gid = root_inode->i_gid; 188 + inode->i_gid = gid; 193 189 } 194 190 195 191 static int tracefs_permission(struct mnt_idmap *idmap, ··· 363 313 struct tracefs_fs_info *fsi = sb->s_fs_info; 364 314 struct inode *inode = d_inode(sb->s_root); 365 315 struct tracefs_mount_opts *opts = &fsi->mount_opts; 316 + struct tracefs_inode *ti; 317 + bool update_uid, update_gid; 366 318 umode_t tmp_mode; 367 319 368 320 /* ··· 383 331 384 332 if (!remount || opts->opts & BIT(Opt_gid)) 385 333 inode->i_gid = opts->gid; 334 + 335 + if (remount && (opts->opts & BIT(Opt_uid) || opts->opts & BIT(Opt_gid))) { 336 + 337 + update_uid = opts->opts & BIT(Opt_uid); 338 + update_gid = opts->opts & BIT(Opt_gid); 339 + 340 + rcu_read_lock(); 341 + list_for_each_entry_rcu(ti, &tracefs_inodes, list) { 342 + if (update_uid) 343 + ti->flags &= ~TRACEFS_UID_PERM_SET; 344 + 345 + if (update_gid) 346 + ti->flags &= ~TRACEFS_GID_PERM_SET; 347 + 348 + if (ti->flags & TRACEFS_EVENT_INODE) 349 + eventfs_remount(ti, update_uid, update_gid); 350 + } 351 + rcu_read_unlock(); 352 + } 386 353 387 354 return 0; 388 355 } ··· 469 398 return !(ei && ei->is_freed); 470 399 } 471 400 401 + static void tracefs_d_iput(struct dentry *dentry, struct inode *inode) 402 + { 403 + struct tracefs_inode *ti = get_tracefs(inode); 404 + 405 + /* 406 + * This inode is being freed and cannot be used for 407 + * eventfs. Clear the flag so that it doesn't call into 408 + * eventfs during the remount flag updates. The eventfs_inode 409 + * gets freed after an RCU cycle, so the content will still 410 + * be safe if the iteration is going on now. 411 + */ 412 + ti->flags &= ~TRACEFS_EVENT_INODE; 413 + } 414 + 472 415 static const struct dentry_operations tracefs_dentry_operations = { 416 + .d_iput = tracefs_d_iput, 473 417 .d_revalidate = tracefs_d_revalidate, 474 418 .d_release = tracefs_d_release, 475 419 };
+9 -5
fs/tracefs/internal.h
··· 4 4 5 5 enum { 6 6 TRACEFS_EVENT_INODE = BIT(1), 7 - TRACEFS_EVENT_TOP_INODE = BIT(2), 8 - TRACEFS_GID_PERM_SET = BIT(3), 9 - TRACEFS_UID_PERM_SET = BIT(4), 10 - TRACEFS_INSTANCE_INODE = BIT(5), 7 + TRACEFS_GID_PERM_SET = BIT(2), 8 + TRACEFS_UID_PERM_SET = BIT(3), 9 + TRACEFS_INSTANCE_INODE = BIT(4), 11 10 }; 12 11 13 12 struct tracefs_inode { 14 - struct inode vfs_inode; 13 + union { 14 + struct inode vfs_inode; 15 + struct rcu_head rcu; 16 + }; 15 17 /* The below gets initialized with memset_after(ti, 0, vfs_inode) */ 18 + struct list_head list; 16 19 unsigned long flags; 17 20 void *private; 18 21 }; ··· 76 73 struct dentry *tracefs_failed_creating(struct dentry *dentry); 77 74 struct inode *tracefs_get_inode(struct super_block *sb); 78 75 76 + void eventfs_remount(struct tracefs_inode *ti, bool update_uid, bool update_gid); 79 77 void eventfs_d_release(struct dentry *dentry); 80 78 81 79 #endif /* _TRACEFS_INTERNAL_H */
-7
include/linux/dma-fence.h
··· 682 682 return dma_fence_is_array(fence) || dma_fence_is_chain(fence); 683 683 } 684 684 685 - #define DMA_FENCE_WARN(f, fmt, args...) \ 686 - do { \ 687 - struct dma_fence *__ff = (f); \ 688 - pr_warn("f %llu#%llu: " fmt, __ff->context, __ff->seqno,\ 689 - ##args); \ 690 - } while (0) 691 - 692 685 #endif /* __LINUX_DMA_FENCE_H */
+8
include/linux/regmap.h
··· 1230 1230 int regmap_raw_write_async(struct regmap *map, unsigned int reg, 1231 1231 const void *val, size_t val_len); 1232 1232 int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); 1233 + int regmap_read_bypassed(struct regmap *map, unsigned int reg, unsigned int *val); 1233 1234 int regmap_raw_read(struct regmap *map, unsigned int reg, 1234 1235 void *val, size_t val_len); 1235 1236 int regmap_noinc_read(struct regmap *map, unsigned int reg, ··· 1735 1734 1736 1735 static inline int regmap_read(struct regmap *map, unsigned int reg, 1737 1736 unsigned int *val) 1737 + { 1738 + WARN_ONCE(1, "regmap API is disabled"); 1739 + return -EINVAL; 1740 + } 1741 + 1742 + static inline int regmap_read_bypassed(struct regmap *map, unsigned int reg, 1743 + unsigned int *val) 1738 1744 { 1739 1745 WARN_ONCE(1, "regmap API is disabled"); 1740 1746 return -EINVAL;
+15
include/linux/skbuff.h
··· 3034 3034 } 3035 3035 } 3036 3036 3037 + /* Move the full mac header up to current network_header. 3038 + * Leaves skb->data pointing at offset skb->mac_len into the mac_header. 3039 + * Must be provided the complete mac header length. 3040 + */ 3041 + static inline void skb_mac_header_rebuild_full(struct sk_buff *skb, u32 full_mac_len) 3042 + { 3043 + if (skb_mac_header_was_set(skb)) { 3044 + const unsigned char *old_mac = skb_mac_header(skb); 3045 + 3046 + skb_set_mac_header(skb, -full_mac_len); 3047 + memmove(skb_mac_header(skb), old_mac, full_mac_len); 3048 + __skb_push(skb, full_mac_len - skb->mac_len); 3049 + } 3050 + } 3051 + 3037 3052 static inline int skb_checksum_start_offset(const struct sk_buff *skb) 3038 3053 { 3039 3054 return skb->csum_start - skb_headroom(skb);
+2 -2
include/linux/slab.h
··· 266 266 void kfree_sensitive(const void *objp); 267 267 size_t __ksize(const void *objp); 268 268 269 - DEFINE_FREE(kfree, void *, if (_T) kfree(_T)) 269 + DEFINE_FREE(kfree, void *, if (!IS_ERR_OR_NULL(_T)) kfree(_T)) 270 270 271 271 /** 272 272 * ksize - Report actual allocation size of associated object ··· 805 805 extern void *kvrealloc(const void *p, size_t oldsize, size_t newsize, gfp_t flags) 806 806 __realloc_size(3); 807 807 extern void kvfree(const void *addr); 808 - DEFINE_FREE(kvfree, void *, if (_T) kvfree(_T)) 808 + DEFINE_FREE(kvfree, void *, if (!IS_ERR_OR_NULL(_T)) kvfree(_T)) 809 809 810 810 extern void kvfree_sensitive(const void *addr, size_t len); 811 811
+3
include/linux/tracefs.h
··· 62 62 typedef int (*eventfs_callback)(const char *name, umode_t *mode, void **data, 63 63 const struct file_operations **fops); 64 64 65 + typedef void (*eventfs_release)(const char *name, void *data); 66 + 65 67 /** 66 68 * struct eventfs_entry - dynamically created eventfs file call back handler 67 69 * @name: Then name of the dynamic file in an eventfs directory ··· 74 72 struct eventfs_entry { 75 73 const char *name; 76 74 eventfs_callback callback; 75 + eventfs_release release; 77 76 }; 78 77 79 78 struct eventfs_inode;
+3
include/net/xfrm.h
··· 1050 1050 #define CRYPTO_INVALID_PACKET_SYNTAX 64 1051 1051 #define CRYPTO_INVALID_PROTOCOL 128 1052 1052 1053 + /* Used to keep whole l2 header for transport mode GRO */ 1054 + __u32 orig_mac_len; 1055 + 1053 1056 __u8 proto; 1054 1057 __u8 inner_ipproto; 1055 1058 };
+2
include/sound/cs35l56.h
··· 267 267 bool fw_patched; 268 268 bool secured; 269 269 bool can_hibernate; 270 + bool fw_owns_asp1; 270 271 bool cal_data_valid; 271 272 s8 cal_index; 272 273 struct cirrus_amp_cal_data cal_data; ··· 284 283 extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC]; 285 284 286 285 int cs35l56_set_patch(struct cs35l56_base *cs35l56_base); 286 + int cs35l56_init_asp1_regs_for_driver_control(struct cs35l56_base *cs35l56_base); 287 287 int cs35l56_force_sync_asp1_registers_from_cache(struct cs35l56_base *cs35l56_base); 288 288 int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command); 289 289 int cs35l56_firmware_shutdown(struct cs35l56_base *cs35l56_base);
+5 -2
include/sound/emu10k1.h
··· 1684 1684 unsigned int clock_fallback; 1685 1685 unsigned int optical_in; /* 0:SPDIF, 1:ADAT */ 1686 1686 unsigned int optical_out; /* 0:SPDIF, 1:ADAT */ 1687 - struct work_struct firmware_work; 1688 - struct work_struct clock_work; 1687 + struct work_struct work; 1688 + struct mutex lock; 1689 1689 }; 1690 1690 1691 1691 struct snd_emu10k1 { ··· 1834 1834 void snd_emu10k1_ptr20_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data); 1835 1835 int snd_emu10k1_spi_write(struct snd_emu10k1 * emu, unsigned int data); 1836 1836 int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, u32 reg, u32 value); 1837 + static inline void snd_emu1010_fpga_lock(struct snd_emu10k1 *emu) { mutex_lock(&emu->emu1010.lock); }; 1838 + static inline void snd_emu1010_fpga_unlock(struct snd_emu10k1 *emu) { mutex_unlock(&emu->emu1010.lock); }; 1839 + void snd_emu1010_fpga_write_lock(struct snd_emu10k1 *emu, u32 reg, u32 value); 1837 1840 void snd_emu1010_fpga_write(struct snd_emu10k1 *emu, u32 reg, u32 value); 1838 1841 void snd_emu1010_fpga_read(struct snd_emu10k1 *emu, u32 reg, u32 *value); 1839 1842 void snd_emu1010_fpga_link_dst_src_write(struct snd_emu10k1 *emu, u32 dst, u32 src);
+1 -1
include/uapi/linux/xfrm.h
··· 233 233 #define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) 234 234 235 235 /* 236 - * Generic LSM security context for comunicating to user space 236 + * Generic LSM security context for communicating to user space 237 237 * NOTE: Same format as sadb_x_sec_ctx 238 238 */ 239 239 struct xfrm_user_sec_ctx {
+1
kernel/dma/swiotlb.c
··· 1798 1798 mem->for_alloc = true; 1799 1799 #ifdef CONFIG_SWIOTLB_DYNAMIC 1800 1800 spin_lock_init(&mem->lock); 1801 + INIT_LIST_HEAD_RCU(&mem->pools); 1801 1802 #endif 1802 1803 add_mem_pool(mem, pool); 1803 1804
+8 -4
kernel/softirq.c
··· 508 508 static inline void lockdep_softirq_end(bool in_hardirq) { } 509 509 #endif 510 510 511 - asmlinkage __visible void __softirq_entry __do_softirq(void) 511 + static void handle_softirqs(bool ksirqd) 512 512 { 513 513 unsigned long end = jiffies + MAX_SOFTIRQ_TIME; 514 514 unsigned long old_flags = current->flags; ··· 563 563 pending >>= softirq_bit; 564 564 } 565 565 566 - if (!IS_ENABLED(CONFIG_PREEMPT_RT) && 567 - __this_cpu_read(ksoftirqd) == current) 566 + if (!IS_ENABLED(CONFIG_PREEMPT_RT) && ksirqd) 568 567 rcu_softirq_qs(); 569 568 570 569 local_irq_disable(); ··· 581 582 lockdep_softirq_end(in_hardirq); 582 583 softirq_handle_end(); 583 584 current_restore_flags(old_flags, PF_MEMALLOC); 585 + } 586 + 587 + asmlinkage __visible void __softirq_entry __do_softirq(void) 588 + { 589 + handle_softirqs(false); 584 590 } 585 591 586 592 /** ··· 925 921 * We can safely run softirq on inline stack, as we are not deep 926 922 * in the task stack here. 927 923 */ 928 - __do_softirq(); 924 + handle_softirqs(true); 929 925 ksoftirqd_run_end(); 930 926 cond_resched(); 931 927 return;
+12
kernel/trace/trace_events.c
··· 2552 2552 return 0; 2553 2553 } 2554 2554 2555 + /* The file is incremented on creation and freeing the enable file decrements it */ 2556 + static void event_release(const char *name, void *data) 2557 + { 2558 + struct trace_event_file *file = data; 2559 + 2560 + event_file_put(file); 2561 + } 2562 + 2555 2563 static int 2556 2564 event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file) 2557 2565 { ··· 2574 2566 { 2575 2567 .name = "enable", 2576 2568 .callback = event_callback, 2569 + .release = event_release, 2577 2570 }, 2578 2571 { 2579 2572 .name = "filter", ··· 2642 2633 pr_warn("Could not initialize trace point events/%s\n", name); 2643 2634 return ret; 2644 2635 } 2636 + 2637 + /* Gets decremented on freeing of the "enable" file */ 2638 + event_file_get(file); 2645 2639 2646 2640 return 0; 2647 2641 }
+1 -1
kernel/trace/trace_probe.c
··· 1464 1464 parg->fmt = kmalloc(len, GFP_KERNEL); 1465 1465 if (!parg->fmt) { 1466 1466 ret = -ENOMEM; 1467 - goto out; 1467 + goto fail; 1468 1468 } 1469 1469 snprintf(parg->fmt, len, "%s[%d]", parg->type->fmttype, 1470 1470 parg->count);
+5 -1
lib/dynamic_debug.c
··· 302 302 } else { 303 303 for (end = buf; *end && !isspace(*end); end++) 304 304 ; 305 - BUG_ON(end == buf); 305 + if (end == buf) { 306 + pr_err("parse err after word:%d=%s\n", nwords, 307 + nwords ? words[nwords - 1] : "<none>"); 308 + return -EINVAL; 309 + } 306 310 } 307 311 308 312 /* `buf' is start of word, `end' is one past its end */
+29 -23
mm/slub.c
··· 557 557 *(freeptr_t *)freeptr_addr = freelist_ptr_encode(s, fp, freeptr_addr); 558 558 } 559 559 560 + /* 561 + * See comment in calculate_sizes(). 562 + */ 563 + static inline bool freeptr_outside_object(struct kmem_cache *s) 564 + { 565 + return s->offset >= s->inuse; 566 + } 567 + 568 + /* 569 + * Return offset of the end of info block which is inuse + free pointer if 570 + * not overlapping with object. 571 + */ 572 + static inline unsigned int get_info_end(struct kmem_cache *s) 573 + { 574 + if (freeptr_outside_object(s)) 575 + return s->inuse + sizeof(void *); 576 + else 577 + return s->inuse; 578 + } 579 + 560 580 /* Loop over all objects in a slab */ 561 581 #define for_each_object(__p, __s, __addr, __objects) \ 562 582 for (__p = fixup_red_left(__s, __addr); \ ··· 863 843 print_hex_dump(level, text, DUMP_PREFIX_ADDRESS, 864 844 16, 1, kasan_reset_tag((void *)addr), length, 1); 865 845 metadata_access_disable(); 866 - } 867 - 868 - /* 869 - * See comment in calculate_sizes(). 870 - */ 871 - static inline bool freeptr_outside_object(struct kmem_cache *s) 872 - { 873 - return s->offset >= s->inuse; 874 - } 875 - 876 - /* 877 - * Return offset of the end of info block which is inuse + free pointer if 878 - * not overlapping with object. 879 - */ 880 - static inline unsigned int get_info_end(struct kmem_cache *s) 881 - { 882 - if (freeptr_outside_object(s)) 883 - return s->inuse + sizeof(void *); 884 - else 885 - return s->inuse; 886 846 } 887 847 888 848 static struct track *get_track(struct kmem_cache *s, void *object, ··· 2092 2092 * 2093 2093 * The initialization memset's clear the object and the metadata, 2094 2094 * but don't touch the SLAB redzone. 2095 + * 2096 + * The object's freepointer is also avoided if stored outside the 2097 + * object. 2095 2098 */ 2096 2099 if (unlikely(init)) { 2097 2100 int rsize; 2101 + unsigned int inuse; 2098 2102 2103 + inuse = get_info_end(s); 2099 2104 if (!kasan_has_integrated_init()) 2100 2105 memset(kasan_reset_tag(x), 0, s->object_size); 2101 2106 rsize = (s->flags & SLAB_RED_ZONE) ? s->red_left_pad : 0; 2102 - memset((char *)kasan_reset_tag(x) + s->inuse, 0, 2103 - s->size - s->inuse - rsize); 2107 + memset((char *)kasan_reset_tag(x) + inuse, 0, 2108 + s->size - inuse - rsize); 2104 2109 } 2105 2110 /* KASAN might put x into memory quarantine, delaying its reuse. */ 2106 2111 return !kasan_slab_free(s, x, init); ··· 3727 3722 static __always_inline void maybe_wipe_obj_freeptr(struct kmem_cache *s, 3728 3723 void *obj) 3729 3724 { 3730 - if (unlikely(slab_want_init_on_free(s)) && obj) 3725 + if (unlikely(slab_want_init_on_free(s)) && obj && 3726 + !freeptr_outside_object(s)) 3731 3727 memset((void *)((char *)kasan_reset_tag(obj) + s->offset), 3732 3728 0, sizeof(void *)); 3733 3729 }
+16 -3
net/appletalk/ddp.c
··· 88 88 static struct sock *atalk_search_socket(struct sockaddr_at *to, 89 89 struct atalk_iface *atif) 90 90 { 91 + struct sock *def_socket = NULL; 91 92 struct sock *s; 92 93 93 94 read_lock_bh(&atalk_sockets_lock); ··· 99 98 continue; 100 99 101 100 if (to->sat_addr.s_net == ATADDR_ANYNET && 102 - to->sat_addr.s_node == ATADDR_BCAST) 103 - goto found; 101 + to->sat_addr.s_node == ATADDR_BCAST) { 102 + if (atif->address.s_node == at->src_node && 103 + atif->address.s_net == at->src_net) { 104 + /* This socket's address matches the address of the interface 105 + * that received the packet -- use it 106 + */ 107 + goto found; 108 + } 109 + 110 + /* Continue searching for a socket matching the interface address, 111 + * but use this socket by default if no other one is found 112 + */ 113 + def_socket = s; 114 + } 104 115 105 116 if (to->sat_addr.s_net == at->src_net && 106 117 (to->sat_addr.s_node == at->src_node || ··· 129 116 goto found; 130 117 } 131 118 } 132 - s = NULL; 119 + s = def_socket; 133 120 found: 134 121 read_unlock_bh(&atalk_sockets_lock); 135 122 return s;
+1 -2
net/bluetooth/hci_core.c
··· 2768 2768 2769 2769 hci_unregister_suspend_notifier(hdev); 2770 2770 2771 - msft_unregister(hdev); 2772 - 2773 2771 hci_dev_do_close(hdev); 2774 2772 2775 2773 if (!test_bit(HCI_INIT, &hdev->flags) && ··· 2821 2823 hci_discovery_filter_clear(hdev); 2822 2824 hci_blocked_keys_clear(hdev); 2823 2825 hci_codec_list_clear(&hdev->local_codecs); 2826 + msft_release(hdev); 2824 2827 hci_dev_unlock(hdev); 2825 2828 2826 2829 ida_destroy(&hdev->unset_handle_ida);
+2
net/bluetooth/hci_event.c
··· 7037 7037 u16 handle = le16_to_cpu(ev->bis[i]); 7038 7038 7039 7039 bis = hci_conn_hash_lookup_handle(hdev, handle); 7040 + if (!bis) 7041 + continue; 7040 7042 7041 7043 set_bit(HCI_CONN_BIG_SYNC_FAILED, &bis->flags); 7042 7044 hci_connect_cfm(bis, ev->status);
+13 -11
net/bluetooth/l2cap_core.c
··· 415 415 416 416 BT_DBG("chan %p state %s", chan, state_to_string(chan->state)); 417 417 418 + if (!conn) 419 + return; 420 + 418 421 mutex_lock(&conn->chan_lock); 419 422 /* __set_chan_timer() calls l2cap_chan_hold(chan) while scheduling 420 423 * this work. No need to call l2cap_chan_hold(chan) here again. ··· 3905 3902 return 0; 3906 3903 } 3907 3904 3908 - static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn, 3909 - struct l2cap_cmd_hdr *cmd, 3910 - u8 *data, u8 rsp_code, u8 amp_id) 3905 + static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, 3906 + u8 *data, u8 rsp_code, u8 amp_id) 3911 3907 { 3912 3908 struct l2cap_conn_req *req = (struct l2cap_conn_req *) data; 3913 3909 struct l2cap_conn_rsp rsp; 3914 - struct l2cap_chan *chan = NULL, *pchan; 3910 + struct l2cap_chan *chan = NULL, *pchan = NULL; 3915 3911 int result, status = L2CAP_CS_NO_INFO; 3916 3912 3917 3913 u16 dcid = 0, scid = __le16_to_cpu(req->scid); ··· 3923 3921 &conn->hcon->dst, ACL_LINK); 3924 3922 if (!pchan) { 3925 3923 result = L2CAP_CR_BAD_PSM; 3926 - goto sendresp; 3924 + goto response; 3927 3925 } 3928 3926 3929 3927 mutex_lock(&conn->chan_lock); ··· 4010 4008 } 4011 4009 4012 4010 response: 4013 - l2cap_chan_unlock(pchan); 4014 - mutex_unlock(&conn->chan_lock); 4015 - l2cap_chan_put(pchan); 4016 - 4017 - sendresp: 4018 4011 rsp.scid = cpu_to_le16(scid); 4019 4012 rsp.dcid = cpu_to_le16(dcid); 4020 4013 rsp.result = cpu_to_le16(result); 4021 4014 rsp.status = cpu_to_le16(status); 4022 4015 l2cap_send_cmd(conn, cmd->ident, rsp_code, sizeof(rsp), &rsp); 4016 + 4017 + if (!pchan) 4018 + return; 4023 4019 4024 4020 if (result == L2CAP_CR_PEND && status == L2CAP_CS_NO_INFO) { 4025 4021 struct l2cap_info_req info; ··· 4041 4041 chan->num_conf_req++; 4042 4042 } 4043 4043 4044 - return chan; 4044 + l2cap_chan_unlock(pchan); 4045 + mutex_unlock(&conn->chan_lock); 4046 + l2cap_chan_put(pchan); 4045 4047 } 4046 4048 4047 4049 static int l2cap_connect_req(struct l2cap_conn *conn,
+1 -1
net/bluetooth/msft.c
··· 769 769 mutex_init(&msft->filter_lock); 770 770 } 771 771 772 - void msft_unregister(struct hci_dev *hdev) 772 + void msft_release(struct hci_dev *hdev) 773 773 { 774 774 struct msft_data *msft = hdev->msft_data; 775 775
+2 -2
net/bluetooth/msft.h
··· 14 14 15 15 bool msft_monitor_supported(struct hci_dev *hdev); 16 16 void msft_register(struct hci_dev *hdev); 17 - void msft_unregister(struct hci_dev *hdev); 17 + void msft_release(struct hci_dev *hdev); 18 18 void msft_do_open(struct hci_dev *hdev); 19 19 void msft_do_close(struct hci_dev *hdev); 20 20 void msft_vendor_evt(struct hci_dev *hdev, void *data, struct sk_buff *skb); ··· 35 35 } 36 36 37 37 static inline void msft_register(struct hci_dev *hdev) {} 38 - static inline void msft_unregister(struct hci_dev *hdev) {} 38 + static inline void msft_release(struct hci_dev *hdev) {} 39 39 static inline void msft_do_open(struct hci_dev *hdev) {} 40 40 static inline void msft_do_close(struct hci_dev *hdev) {} 41 41 static inline void msft_vendor_evt(struct hci_dev *hdev, void *data,
+4
net/bluetooth/sco.c
··· 83 83 struct sock *sk; 84 84 85 85 sco_conn_lock(conn); 86 + if (!conn->hcon) { 87 + sco_conn_unlock(conn); 88 + return; 89 + } 86 90 sk = conn->sk; 87 91 if (sk) 88 92 sock_hold(sk);
+7 -2
net/bridge/br_forward.c
··· 258 258 { 259 259 struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev; 260 260 const unsigned char *src = eth_hdr(skb)->h_source; 261 + struct sk_buff *nskb; 261 262 262 263 if (!should_deliver(p, skb)) 263 264 return; ··· 267 266 if (skb->dev == p->dev && ether_addr_equal(src, addr)) 268 267 return; 269 268 270 - skb = pskb_copy(skb, GFP_ATOMIC); 271 - if (!skb) { 269 + __skb_push(skb, ETH_HLEN); 270 + nskb = pskb_copy(skb, GFP_ATOMIC); 271 + __skb_pull(skb, ETH_HLEN); 272 + if (!nskb) { 272 273 DEV_STATS_INC(dev, tx_dropped); 273 274 return; 274 275 } 275 276 277 + skb = nskb; 278 + __skb_pull(skb, ETH_HLEN); 276 279 if (!is_broadcast_ether_addr(addr)) 277 280 memcpy(eth_hdr(skb)->h_dest, addr, ETH_ALEN); 278 281
+10 -3
net/core/net_namespace.c
··· 69 69 70 70 static struct net_generic *net_alloc_generic(void) 71 71 { 72 + unsigned int gen_ptrs = READ_ONCE(max_gen_ptrs); 73 + unsigned int generic_size; 72 74 struct net_generic *ng; 73 - unsigned int generic_size = offsetof(struct net_generic, ptr[max_gen_ptrs]); 75 + 76 + generic_size = offsetof(struct net_generic, ptr[gen_ptrs]); 74 77 75 78 ng = kzalloc(generic_size, GFP_KERNEL); 76 79 if (ng) 77 - ng->s.len = max_gen_ptrs; 80 + ng->s.len = gen_ptrs; 78 81 79 82 return ng; 80 83 } ··· 1311 1308 if (error < 0) 1312 1309 return error; 1313 1310 *ops->id = error; 1314 - max_gen_ptrs = max(max_gen_ptrs, *ops->id + 1); 1311 + /* This does not require READ_ONCE as writers already hold 1312 + * pernet_ops_rwsem. But WRITE_ONCE is needed to protect 1313 + * net_alloc_generic. 1314 + */ 1315 + WRITE_ONCE(max_gen_ptrs, max(max_gen_ptrs, *ops->id + 1)); 1315 1316 } 1316 1317 error = __register_pernet_operations(list, ops); 1317 1318 if (error) {
+1 -1
net/core/rtnetlink.c
··· 2546 2546 2547 2547 nla_for_each_nested(attr, tb[IFLA_VF_VLAN_LIST], rem) { 2548 2548 if (nla_type(attr) != IFLA_VF_VLAN_INFO || 2549 - nla_len(attr) < NLA_HDRLEN) { 2549 + nla_len(attr) < sizeof(struct ifla_vf_vlan_info)) { 2550 2550 return -EINVAL; 2551 2551 } 2552 2552 if (len >= MAX_VLAN_LIST_LEN)
+12 -15
net/hsr/hsr_device.c
··· 61 61 return false; 62 62 } 63 63 64 - static void hsr_check_announce(struct net_device *hsr_dev, 65 - unsigned char old_operstate) 64 + static void hsr_check_announce(struct net_device *hsr_dev) 66 65 { 67 66 struct hsr_priv *hsr; 68 67 69 68 hsr = netdev_priv(hsr_dev); 70 - 71 - if (READ_ONCE(hsr_dev->operstate) == IF_OPER_UP && old_operstate != IF_OPER_UP) { 72 - /* Went up */ 73 - hsr->announce_count = 0; 74 - mod_timer(&hsr->announce_timer, 75 - jiffies + msecs_to_jiffies(HSR_ANNOUNCE_INTERVAL)); 69 + if (netif_running(hsr_dev) && netif_oper_up(hsr_dev)) { 70 + /* Enable announce timer and start sending supervisory frames */ 71 + if (!timer_pending(&hsr->announce_timer)) { 72 + hsr->announce_count = 0; 73 + mod_timer(&hsr->announce_timer, jiffies + 74 + msecs_to_jiffies(HSR_ANNOUNCE_INTERVAL)); 75 + } 76 + } else { 77 + /* Deactivate the announce timer */ 78 + timer_delete(&hsr->announce_timer); 76 79 } 77 - 78 - if (READ_ONCE(hsr_dev->operstate) != IF_OPER_UP && old_operstate == IF_OPER_UP) 79 - /* Went down */ 80 - del_timer(&hsr->announce_timer); 81 80 } 82 81 83 82 void hsr_check_carrier_and_operstate(struct hsr_priv *hsr) 84 83 { 85 84 struct hsr_port *master; 86 - unsigned char old_operstate; 87 85 bool has_carrier; 88 86 89 87 master = hsr_port_get_hsr(hsr, HSR_PT_MASTER); 90 88 /* netif_stacked_transfer_operstate() cannot be used here since 91 89 * it doesn't set IF_OPER_LOWERLAYERDOWN (?) 92 90 */ 93 - old_operstate = READ_ONCE(master->dev->operstate); 94 91 has_carrier = hsr_check_carrier(master); 95 92 hsr_set_operstate(master, has_carrier); 96 - hsr_check_announce(master->dev, old_operstate); 93 + hsr_check_announce(master->dev); 97 94 } 98 95 99 96 int hsr_get_max_mtu(struct hsr_priv *hsr)
+2 -2
net/ipv4/tcp.c
··· 2719 2719 /* If we've already sent a FIN, or it's a closed state, skip this. */ 2720 2720 if ((1 << sk->sk_state) & 2721 2721 (TCPF_ESTABLISHED | TCPF_SYN_SENT | 2722 - TCPF_SYN_RECV | TCPF_CLOSE_WAIT)) { 2722 + TCPF_CLOSE_WAIT)) { 2723 2723 /* Clear out any half completed packets. FIN if needed. */ 2724 2724 if (tcp_close_state(sk)) 2725 2725 tcp_send_fin(sk); ··· 2837 2837 * machine. State transitions: 2838 2838 * 2839 2839 * TCP_ESTABLISHED -> TCP_FIN_WAIT1 2840 - * TCP_SYN_RECV -> TCP_FIN_WAIT1 (forget it, it's impossible) 2840 + * TCP_SYN_RECV -> TCP_FIN_WAIT1 (it is difficult) 2841 2841 * TCP_CLOSE_WAIT -> TCP_LAST_ACK 2842 2842 * 2843 2843 * are legal only when FIN has been sent (i.e. in window),
+2
net/ipv4/tcp_input.c
··· 6769 6769 6770 6770 tcp_initialize_rcv_mss(sk); 6771 6771 tcp_fast_path_on(tp); 6772 + if (sk->sk_shutdown & SEND_SHUTDOWN) 6773 + tcp_shutdown(sk, SEND_SHUTDOWN); 6772 6774 break; 6773 6775 6774 6776 case TCP_FIN_WAIT1: {
+7 -1
net/ipv4/tcp_ipv4.c
··· 155 155 if (tcptw->tw_ts_recent_stamp && 156 156 (!twp || (reuse && time_after32(ktime_get_seconds(), 157 157 tcptw->tw_ts_recent_stamp)))) { 158 + /* inet_twsk_hashdance() sets sk_refcnt after putting twsk 159 + * and releasing the bucket lock. 160 + */ 161 + if (unlikely(!refcount_inc_not_zero(&sktw->sk_refcnt))) 162 + return 0; 163 + 158 164 /* In case of repair and re-using TIME-WAIT sockets we still 159 165 * want to be sure that it is safe as above but honor the 160 166 * sequence numbers and time stamps set as part of the repair ··· 181 175 tp->rx_opt.ts_recent = tcptw->tw_ts_recent; 182 176 tp->rx_opt.ts_recent_stamp = tcptw->tw_ts_recent_stamp; 183 177 } 184 - sock_hold(sktw); 178 + 185 179 return 1; 186 180 } 187 181
+3 -1
net/ipv4/tcp_output.c
··· 3601 3601 return; 3602 3602 } 3603 3603 } else { 3604 - skb = alloc_skb_fclone(MAX_TCP_HEADER, sk->sk_allocation); 3604 + skb = alloc_skb_fclone(MAX_TCP_HEADER, 3605 + sk_gfp_mask(sk, GFP_ATOMIC | 3606 + __GFP_NOWARN)); 3605 3607 if (unlikely(!skb)) 3606 3608 return; 3607 3609
+5 -1
net/ipv4/xfrm4_input.c
··· 63 63 ip_send_check(iph); 64 64 65 65 if (xo && (xo->flags & XFRM_GRO)) { 66 - skb_mac_header_rebuild(skb); 66 + /* The full l2 header needs to be preserved so that re-injecting the packet at l2 67 + * works correctly in the presence of vlan tags. 68 + */ 69 + skb_mac_header_rebuild_full(skb, xo->orig_mac_len); 70 + skb_reset_network_header(skb); 67 71 skb_reset_transport_header(skb); 68 72 return 0; 69 73 }
+5 -1
net/ipv6/fib6_rules.c
··· 233 233 rt = pol_lookup_func(lookup, 234 234 net, table, flp6, arg->lookup_data, flags); 235 235 if (rt != net->ipv6.ip6_null_entry) { 236 + struct inet6_dev *idev = ip6_dst_idev(&rt->dst); 237 + 238 + if (!idev) 239 + goto again; 236 240 err = fib6_rule_saddr(net, rule, flags, flp6, 237 - ip6_dst_idev(&rt->dst)->dev); 241 + idev->dev); 238 242 239 243 if (err == -EAGAIN) 240 244 goto again;
+2 -2
net/ipv6/ip6_output.c
··· 234 234 skb->protocol = htons(ETH_P_IPV6); 235 235 skb->dev = dev; 236 236 237 - if (unlikely(READ_ONCE(idev->cnf.disable_ipv6))) { 237 + if (unlikely(!idev || READ_ONCE(idev->cnf.disable_ipv6))) { 238 238 IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS); 239 239 kfree_skb_reason(skb, SKB_DROP_REASON_IPV6DISABLED); 240 240 return 0; ··· 1933 1933 u8 icmp6_type; 1934 1934 1935 1935 if (sk->sk_socket->type == SOCK_RAW && 1936 - !inet_test_bit(HDRINCL, sk)) 1936 + !(fl6->flowi6_flags & FLOWI_FLAG_KNOWN_NH)) 1937 1937 icmp6_type = fl6->fl6_icmp_type; 1938 1938 else 1939 1939 icmp6_type = icmp6_hdr(skb)->icmp6_type;
+5 -1
net/ipv6/xfrm6_input.c
··· 58 58 skb_postpush_rcsum(skb, skb_network_header(skb), nhlen); 59 59 60 60 if (xo && (xo->flags & XFRM_GRO)) { 61 - skb_mac_header_rebuild(skb); 61 + /* The full l2 header needs to be preserved so that re-injecting the packet at l2 62 + * works correctly in the presence of vlan tags. 63 + */ 64 + skb_mac_header_rebuild_full(skb, xo->orig_mac_len); 65 + skb_reset_network_header(skb); 62 66 skb_reset_transport_header(skb); 63 67 return 0; 64 68 }
+38 -1
net/mptcp/ctrl.c
··· 96 96 } 97 97 98 98 #ifdef CONFIG_SYSCTL 99 + static int mptcp_set_scheduler(const struct net *net, const char *name) 100 + { 101 + struct mptcp_pernet *pernet = mptcp_get_pernet(net); 102 + struct mptcp_sched_ops *sched; 103 + int ret = 0; 104 + 105 + rcu_read_lock(); 106 + sched = mptcp_sched_find(name); 107 + if (sched) 108 + strscpy(pernet->scheduler, name, MPTCP_SCHED_NAME_MAX); 109 + else 110 + ret = -ENOENT; 111 + rcu_read_unlock(); 112 + 113 + return ret; 114 + } 115 + 116 + static int proc_scheduler(struct ctl_table *ctl, int write, 117 + void *buffer, size_t *lenp, loff_t *ppos) 118 + { 119 + const struct net *net = current->nsproxy->net_ns; 120 + char val[MPTCP_SCHED_NAME_MAX]; 121 + struct ctl_table tbl = { 122 + .data = val, 123 + .maxlen = MPTCP_SCHED_NAME_MAX, 124 + }; 125 + int ret; 126 + 127 + strscpy(val, mptcp_get_scheduler(net), MPTCP_SCHED_NAME_MAX); 128 + 129 + ret = proc_dostring(&tbl, write, buffer, lenp, ppos); 130 + if (write && ret == 0) 131 + ret = mptcp_set_scheduler(net, val); 132 + 133 + return ret; 134 + } 135 + 99 136 static struct ctl_table mptcp_sysctl_table[] = { 100 137 { 101 138 .procname = "enabled", ··· 185 148 .procname = "scheduler", 186 149 .maxlen = MPTCP_SCHED_NAME_MAX, 187 150 .mode = 0644, 188 - .proc_handler = proc_dostring, 151 + .proc_handler = proc_scheduler, 189 152 }, 190 153 { 191 154 .procname = "close_timeout",
+1
net/nfc/nci/core.c
··· 1518 1518 1519 1519 if (!nci_plen(skb->data)) { 1520 1520 kfree_skb(skb); 1521 + kcov_remote_stop(); 1521 1522 break; 1522 1523 } 1523 1524
+1 -1
net/phonet/pn_netlink.c
··· 193 193 struct sk_buff *skb; 194 194 int err = -ENOBUFS; 195 195 196 - skb = nlmsg_new(NLMSG_ALIGN(sizeof(struct ifaddrmsg)) + 196 + skb = nlmsg_new(NLMSG_ALIGN(sizeof(struct rtmsg)) + 197 197 nla_total_size(1) + nla_total_size(4), GFP_KERNEL); 198 198 if (skb == NULL) 199 199 goto errout;
+1 -1
net/rxrpc/ar-internal.h
··· 697 697 * packets) rather than bytes. 698 698 */ 699 699 #define RXRPC_TX_SMSS RXRPC_JUMBO_DATALEN 700 - #define RXRPC_MIN_CWND (RXRPC_TX_SMSS > 2190 ? 2 : RXRPC_TX_SMSS > 1095 ? 3 : 4) 700 + #define RXRPC_MIN_CWND 4 701 701 u8 cong_cwnd; /* Congestion window size */ 702 702 u8 cong_extra; /* Extra to send for congestion management */ 703 703 u8 cong_ssthresh; /* Slow-start threshold */
+1 -6
net/rxrpc/call_object.c
··· 174 174 call->rx_winsize = rxrpc_rx_window_size; 175 175 call->tx_winsize = 16; 176 176 177 - if (RXRPC_TX_SMSS > 2190) 178 - call->cong_cwnd = 2; 179 - else if (RXRPC_TX_SMSS > 1095) 180 - call->cong_cwnd = 3; 181 - else 182 - call->cong_cwnd = 4; 177 + call->cong_cwnd = RXRPC_MIN_CWND; 183 178 call->cong_ssthresh = RXRPC_TX_MAX_WINDOW; 184 179 185 180 call->rxnet = rxnet;
+35 -14
net/rxrpc/input.c
··· 9 9 10 10 #include "ar-internal.h" 11 11 12 + /* Override priority when generating ACKs for received DATA */ 13 + static const u8 rxrpc_ack_priority[RXRPC_ACK__INVALID] = { 14 + [RXRPC_ACK_IDLE] = 1, 15 + [RXRPC_ACK_DELAY] = 2, 16 + [RXRPC_ACK_REQUESTED] = 3, 17 + [RXRPC_ACK_DUPLICATE] = 4, 18 + [RXRPC_ACK_EXCEEDS_WINDOW] = 5, 19 + [RXRPC_ACK_NOSPACE] = 6, 20 + [RXRPC_ACK_OUT_OF_SEQUENCE] = 7, 21 + }; 22 + 12 23 static void rxrpc_proto_abort(struct rxrpc_call *call, rxrpc_seq_t seq, 13 24 enum rxrpc_abort_reason why) 14 25 { ··· 376 365 * Process a DATA packet. 377 366 */ 378 367 static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb, 379 - bool *_notify) 368 + bool *_notify, rxrpc_serial_t *_ack_serial, int *_ack_reason) 380 369 { 381 370 struct rxrpc_skb_priv *sp = rxrpc_skb(skb); 382 371 struct sk_buff *oos; ··· 429 418 /* Send an immediate ACK if we fill in a hole */ 430 419 else if (!skb_queue_empty(&call->rx_oos_queue)) 431 420 ack_reason = RXRPC_ACK_DELAY; 432 - else 433 - call->ackr_nr_unacked++; 434 421 435 422 window++; 436 423 if (after(window, wtop)) { ··· 506 497 } 507 498 508 499 send_ack: 509 - if (ack_reason >= 0) 510 - rxrpc_send_ACK(call, ack_reason, serial, 511 - rxrpc_propose_ack_input_data); 512 - else 513 - rxrpc_propose_delay_ACK(call, serial, 514 - rxrpc_propose_ack_input_data); 500 + if (ack_reason >= 0) { 501 + if (rxrpc_ack_priority[ack_reason] > rxrpc_ack_priority[*_ack_reason]) { 502 + *_ack_serial = serial; 503 + *_ack_reason = ack_reason; 504 + } else if (rxrpc_ack_priority[ack_reason] == rxrpc_ack_priority[*_ack_reason] && 505 + ack_reason == RXRPC_ACK_REQUESTED) { 506 + *_ack_serial = serial; 507 + *_ack_reason = ack_reason; 508 + } 509 + } 515 510 } 516 511 517 512 /* ··· 526 513 struct rxrpc_jumbo_header jhdr; 527 514 struct rxrpc_skb_priv *sp = rxrpc_skb(skb), *jsp; 528 515 struct sk_buff *jskb; 516 + rxrpc_serial_t ack_serial = 0; 529 517 unsigned int offset = sizeof(struct rxrpc_wire_header); 530 518 unsigned int len = skb->len - offset; 531 519 bool notify = false; 520 + int ack_reason = 0; 532 521 533 522 while (sp->hdr.flags & RXRPC_JUMBO_PACKET) { 534 523 if (len < RXRPC_JUMBO_SUBPKTLEN) ··· 550 535 jsp = rxrpc_skb(jskb); 551 536 jsp->offset = offset; 552 537 jsp->len = RXRPC_JUMBO_DATALEN; 553 - rxrpc_input_data_one(call, jskb, &notify); 538 + rxrpc_input_data_one(call, jskb, &notify, &ack_serial, &ack_reason); 554 539 rxrpc_free_skb(jskb, rxrpc_skb_put_jumbo_subpacket); 555 540 556 541 sp->hdr.flags = jhdr.flags; ··· 563 548 564 549 sp->offset = offset; 565 550 sp->len = len; 566 - rxrpc_input_data_one(call, skb, &notify); 551 + rxrpc_input_data_one(call, skb, &notify, &ack_serial, &ack_reason); 552 + 553 + if (ack_reason > 0) { 554 + rxrpc_send_ACK(call, ack_reason, ack_serial, 555 + rxrpc_propose_ack_input_data); 556 + } else { 557 + call->ackr_nr_unacked++; 558 + rxrpc_propose_delay_ACK(call, sp->hdr.serial, 559 + rxrpc_propose_ack_input_data); 560 + } 567 561 if (notify) { 568 562 trace_rxrpc_notify_socket(call->debug_id, sp->hdr.serial); 569 563 rxrpc_notify_socket(call); ··· 708 684 trace_rxrpc_rx_rwind_change(call, sp->hdr.serial, rwind, wake); 709 685 call->tx_winsize = rwind; 710 686 } 711 - 712 - if (call->cong_ssthresh > rwind) 713 - call->cong_ssthresh = rwind; 714 687 715 688 mtu = min(ntohl(trailer->maxMTU), ntohl(trailer->ifMTU)); 716 689
+12 -7
net/smc/smc_ib.c
··· 209 209 if (IS_ERR(rt)) 210 210 goto out; 211 211 if (rt->rt_uses_gateway && rt->rt_gw_family != AF_INET) 212 - goto out; 213 - neigh = rt->dst.ops->neigh_lookup(&rt->dst, NULL, &fl4.daddr); 214 - if (neigh) { 215 - memcpy(nexthop_mac, neigh->ha, ETH_ALEN); 216 - *uses_gateway = rt->rt_uses_gateway; 217 - return 0; 218 - } 212 + goto out_rt; 213 + neigh = dst_neigh_lookup(&rt->dst, &fl4.daddr); 214 + if (!neigh) 215 + goto out_rt; 216 + memcpy(nexthop_mac, neigh->ha, ETH_ALEN); 217 + *uses_gateway = rt->rt_uses_gateway; 218 + neigh_release(neigh); 219 + ip_rt_put(rt); 220 + return 0; 221 + 222 + out_rt: 223 + ip_rt_put(rt); 219 224 out: 220 225 return -ENOENT; 221 226 }
+8
net/xfrm/xfrm_input.c
··· 389 389 */ 390 390 static int xfrm4_transport_input(struct xfrm_state *x, struct sk_buff *skb) 391 391 { 392 + struct xfrm_offload *xo = xfrm_offload(skb); 392 393 int ihl = skb->data - skb_transport_header(skb); 393 394 394 395 if (skb->transport_header != skb->network_header) { 395 396 memmove(skb_transport_header(skb), 396 397 skb_network_header(skb), ihl); 398 + if (xo) 399 + xo->orig_mac_len = 400 + skb_mac_header_was_set(skb) ? skb_mac_header_len(skb) : 0; 397 401 skb->network_header = skb->transport_header; 398 402 } 399 403 ip_hdr(skb)->tot_len = htons(skb->len + ihl); ··· 408 404 static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb) 409 405 { 410 406 #if IS_ENABLED(CONFIG_IPV6) 407 + struct xfrm_offload *xo = xfrm_offload(skb); 411 408 int ihl = skb->data - skb_transport_header(skb); 412 409 413 410 if (skb->transport_header != skb->network_header) { 414 411 memmove(skb_transport_header(skb), 415 412 skb_network_header(skb), ihl); 413 + if (xo) 414 + xo->orig_mac_len = 415 + skb_mac_header_was_set(skb) ? skb_mac_header_len(skb) : 0; 416 416 skb->network_header = skb->transport_header; 417 417 } 418 418 ipv6_hdr(skb)->payload_len = htons(skb->len + ihl -
+2
net/xfrm/xfrm_policy.c
··· 3598 3598 return pol; 3599 3599 3600 3600 pol = xfrm_policy_lookup(net, &fl1, family, XFRM_POLICY_FWD, if_id); 3601 + if (IS_ERR(pol)) 3602 + pol = NULL; 3601 3603 } 3602 3604 3603 3605 return pol;
+25 -2
sound/hda/intel-dsp-config.c
··· 557 557 if (table->codec_hid) { 558 558 int i; 559 559 560 - for (i = 0; i < table->codec_hid->num_codecs; i++) 561 - if (acpi_dev_present(table->codec_hid->codecs[i], NULL, -1)) 560 + for (i = 0; i < table->codec_hid->num_codecs; i++) { 561 + struct nhlt_acpi_table *nhlt; 562 + bool ssp_found = false; 563 + 564 + if (!acpi_dev_present(table->codec_hid->codecs[i], NULL, -1)) 565 + continue; 566 + 567 + nhlt = intel_nhlt_init(&pci->dev); 568 + if (!nhlt) { 569 + dev_warn(&pci->dev, "%s: NHLT table not found, skipped HID %s\n", 570 + __func__, table->codec_hid->codecs[i]); 571 + continue; 572 + } 573 + 574 + if (intel_nhlt_has_endpoint_type(nhlt, NHLT_LINK_SSP) && 575 + intel_nhlt_ssp_endpoint_mask(nhlt, NHLT_DEVICE_I2S)) 576 + ssp_found = true; 577 + 578 + intel_nhlt_free(nhlt); 579 + 580 + if (ssp_found) 562 581 break; 582 + 583 + dev_warn(&pci->dev, "%s: no valid SSP found for HID %s, skipped\n", 584 + __func__, table->codec_hid->codecs[i]); 585 + } 563 586 if (i == table->codec_hid->num_codecs) 564 587 continue; 565 588 }
+2
sound/hda/intel-sdw-acpi.c
··· 45 45 "intel-quirk-mask", 46 46 &quirk_mask); 47 47 48 + fwnode_handle_put(link); 49 + 48 50 if (quirk_mask & SDW_INTEL_QUIRK_MASK_BUS_DISABLE) 49 51 return false; 50 52
+1 -2
sound/pci/emu10k1/emu10k1.c
··· 189 189 190 190 emu->suspend = 1; 191 191 192 - cancel_work_sync(&emu->emu1010.firmware_work); 193 - cancel_work_sync(&emu->emu1010.clock_work); 192 + cancel_work_sync(&emu->emu1010.work); 194 193 195 194 snd_ac97_suspend(emu->ac97); 196 195
+92 -66
sound/pci/emu10k1/emu10k1_main.c
··· 732 732 return snd_emu1010_load_firmware_entry(emu, *fw); 733 733 } 734 734 735 - static void emu1010_firmware_work(struct work_struct *work) 735 + static void snd_emu1010_load_dock_firmware(struct snd_emu10k1 *emu) 736 736 { 737 - struct snd_emu10k1 *emu; 738 - u32 tmp, tmp2, reg; 737 + u32 tmp, tmp2; 739 738 int err; 740 739 741 - emu = container_of(work, struct snd_emu10k1, 742 - emu1010.firmware_work); 743 - if (emu->card->shutdown) 740 + // The docking events clearly arrive prematurely - while the 741 + // Dock's FPGA seems to be successfully programmed, the Dock 742 + // fails to initialize subsequently if we don't give it some 743 + // time to "warm up" here. 744 + msleep(200); 745 + 746 + dev_info(emu->card->dev, "emu1010: Loading Audio Dock Firmware\n"); 747 + /* Return to Audio Dock programming mode */ 748 + snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 749 + EMU_HANA_FPGA_CONFIG_AUDIODOCK); 750 + err = snd_emu1010_load_firmware(emu, 1, &emu->dock_fw); 751 + if (err < 0) 744 752 return; 745 - #ifdef CONFIG_PM_SLEEP 746 - if (emu->suspend) 753 + snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0); 754 + 755 + snd_emu1010_fpga_read(emu, EMU_HANA_ID, &tmp); 756 + dev_dbg(emu->card->dev, "emu1010: EMU_HANA+DOCK_ID = 0x%x\n", tmp); 757 + if ((tmp & 0x1f) != 0x15) { 758 + /* FPGA failed to be programmed */ 759 + dev_err(emu->card->dev, 760 + "emu1010: Loading Audio Dock Firmware failed, reg = 0x%x\n", 761 + tmp); 747 762 return; 748 - #endif 763 + } 764 + dev_info(emu->card->dev, "emu1010: Audio Dock Firmware loaded\n"); 765 + 766 + snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp); 767 + snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2); 768 + dev_info(emu->card->dev, "Audio Dock ver: %u.%u\n", tmp, tmp2); 769 + 770 + /* Allow DLL to settle, to sync clocking between 1010 and Dock */ 771 + msleep(10); 772 + } 773 + 774 + static void emu1010_dock_event(struct snd_emu10k1 *emu) 775 + { 776 + u32 reg; 777 + 749 778 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); /* OPTIONS: Which cards are attached to the EMU */ 750 779 if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) { 751 780 /* Audio Dock attached */ 752 - /* Return to Audio Dock programming mode */ 753 - dev_info(emu->card->dev, 754 - "emu1010: Loading Audio Dock Firmware\n"); 755 - snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 756 - EMU_HANA_FPGA_CONFIG_AUDIODOCK); 757 - err = snd_emu1010_load_firmware(emu, 1, &emu->dock_fw); 758 - if (err < 0) 759 - return; 760 - snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0); 761 - snd_emu1010_fpga_read(emu, EMU_HANA_ID, &tmp); 762 - dev_info(emu->card->dev, 763 - "emu1010: EMU_HANA+DOCK_ID = 0x%x\n", tmp); 764 - if ((tmp & 0x1f) != 0x15) { 765 - /* FPGA failed to be programmed */ 766 - dev_info(emu->card->dev, 767 - "emu1010: Loading Audio Dock Firmware file failed, reg = 0x%x\n", 768 - tmp); 769 - return; 770 - } 771 - dev_info(emu->card->dev, 772 - "emu1010: Audio Dock Firmware loaded\n"); 773 - snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp); 774 - snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2); 775 - dev_info(emu->card->dev, "Audio Dock ver: %u.%u\n", tmp, tmp2); 776 - /* Sync clocking between 1010 and Dock */ 777 - /* Allow DLL to settle */ 778 - msleep(10); 781 + snd_emu1010_load_dock_firmware(emu); 779 782 /* Unmute all. Default is muted after a firmware load */ 783 + snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE); 784 + } else if (!(reg & EMU_HANA_OPTION_DOCK_ONLINE)) { 785 + /* Audio Dock removed */ 786 + dev_info(emu->card->dev, "emu1010: Audio Dock detached\n"); 787 + /* The hardware auto-mutes all, so we unmute again */ 780 788 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE); 781 789 } 782 790 } 783 791 784 - static void emu1010_clock_work(struct work_struct *work) 792 + static void emu1010_clock_event(struct snd_emu10k1 *emu) 785 793 { 786 - struct snd_emu10k1 *emu; 787 794 struct snd_ctl_elem_id id; 788 - 789 - emu = container_of(work, struct snd_emu10k1, 790 - emu1010.clock_work); 791 - if (emu->card->shutdown) 792 - return; 793 - #ifdef CONFIG_PM_SLEEP 794 - if (emu->suspend) 795 - return; 796 - #endif 797 795 798 796 spin_lock_irq(&emu->reg_lock); 799 797 // This is the only thing that can actually happen. ··· 803 805 snd_ctl_notify(emu->card, SNDRV_CTL_EVENT_MASK_VALUE, &id); 804 806 } 805 807 806 - static void emu1010_interrupt(struct snd_emu10k1 *emu) 808 + static void emu1010_work(struct work_struct *work) 807 809 { 810 + struct snd_emu10k1 *emu; 808 811 u32 sts; 809 812 813 + emu = container_of(work, struct snd_emu10k1, emu1010.work); 814 + if (emu->card->shutdown) 815 + return; 816 + #ifdef CONFIG_PM_SLEEP 817 + if (emu->suspend) 818 + return; 819 + #endif 820 + 821 + snd_emu1010_fpga_lock(emu); 822 + 810 823 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &sts); 811 - if (sts & EMU_HANA_IRQ_DOCK_LOST) { 812 - /* Audio Dock removed */ 813 - dev_info(emu->card->dev, "emu1010: Audio Dock detached\n"); 814 - /* The hardware auto-mutes all, so we unmute again */ 815 - snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE); 816 - } else if (sts & EMU_HANA_IRQ_DOCK) { 817 - schedule_work(&emu->emu1010.firmware_work); 818 - } 824 + 825 + // The distinction of the IRQ status bits is unreliable, 826 + // so we dispatch later based on option card status. 827 + if (sts & (EMU_HANA_IRQ_DOCK | EMU_HANA_IRQ_DOCK_LOST)) 828 + emu1010_dock_event(emu); 829 + 819 830 if (sts & EMU_HANA_IRQ_WCLK_CHANGED) 820 - schedule_work(&emu->emu1010.clock_work); 831 + emu1010_clock_event(emu); 832 + 833 + snd_emu1010_fpga_unlock(emu); 834 + } 835 + 836 + static void emu1010_interrupt(struct snd_emu10k1 *emu) 837 + { 838 + // We get an interrupt on each GPIO input pin change, but we 839 + // care only about the ones triggered by the dedicated pin. 840 + u16 sts = inw(emu->port + A_GPIO); 841 + u16 bit = emu->card_capabilities->ca0108_chip ? 0x2000 : 0x8000; 842 + if (!(sts & bit)) 843 + return; 844 + 845 + schedule_work(&emu->emu1010.work); 821 846 } 822 847 823 848 /* ··· 861 840 /* Mute, and disable audio and lock cache, just in case. 862 841 * Proper init follows in snd_emu10k1_init(). */ 863 842 outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK, emu->port + HCFG); 843 + 844 + snd_emu1010_fpga_lock(emu); 864 845 865 846 /* Disable 48Volt power to Audio Dock */ 866 847 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0); ··· 889 866 err = snd_emu1010_load_firmware(emu, 0, &emu->firmware); 890 867 if (err < 0) { 891 868 dev_info(emu->card->dev, "emu1010: Loading Firmware failed\n"); 892 - return err; 869 + goto fail; 893 870 } 894 871 895 872 /* ID, should read & 0x7f = 0x55 when FPGA programmed. */ ··· 899 876 dev_info(emu->card->dev, 900 877 "emu1010: Loading Hana Firmware file failed, reg = 0x%x\n", 901 878 reg); 902 - return -ENODEV; 879 + err = -ENODEV; 880 + goto fail; 903 881 } 904 882 905 883 dev_info(emu->card->dev, "emu1010: Hana Firmware loaded\n"); ··· 913 889 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); 914 890 dev_info(emu->card->dev, "emu1010: Card options = 0x%x\n", reg); 915 891 if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) 916 - schedule_work(&emu->emu1010.firmware_work); 892 + snd_emu1010_load_dock_firmware(emu); 917 893 if (emu->card_capabilities->no_adat) { 918 894 emu->emu1010.optical_in = 0; /* IN_SPDIF */ 919 895 emu->emu1010.optical_out = 0; /* OUT_SPDIF */ ··· 960 936 // so it is safe to simply enable the outputs. 961 937 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE); 962 938 963 - return 0; 939 + fail: 940 + snd_emu1010_fpga_unlock(emu); 941 + return err; 964 942 } 965 943 /* 966 944 * Create the EMU10K1 instance ··· 984 958 } 985 959 if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1010) { 986 960 /* Disable 48Volt power to Audio Dock */ 987 - snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0); 961 + snd_emu1010_fpga_write_lock(emu, EMU_HANA_DOCK_PWR, 0); 988 962 } 989 - cancel_work_sync(&emu->emu1010.firmware_work); 990 - cancel_work_sync(&emu->emu1010.clock_work); 963 + cancel_work_sync(&emu->emu1010.work); 964 + mutex_destroy(&emu->emu1010.lock); 991 965 release_firmware(emu->firmware); 992 966 release_firmware(emu->dock_fw); 993 967 snd_util_memhdr_free(emu->memhdr); ··· 1566 1540 emu->irq = -1; 1567 1541 emu->synth = NULL; 1568 1542 emu->get_synth_voice = NULL; 1569 - INIT_WORK(&emu->emu1010.firmware_work, emu1010_firmware_work); 1570 - INIT_WORK(&emu->emu1010.clock_work, emu1010_clock_work); 1543 + INIT_WORK(&emu->emu1010.work, emu1010_work); 1544 + mutex_init(&emu->emu1010.lock); 1571 1545 /* read revision & serial */ 1572 1546 emu->revision = pci->revision; 1573 1547 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial);
+13 -5
sound/pci/emu10k1/emumixer.c
··· 661 661 change = (emu->emu1010.output_source[channel] != val); 662 662 if (change) { 663 663 emu->emu1010.output_source[channel] = val; 664 + snd_emu1010_fpga_lock(emu); 664 665 snd_emu1010_output_source_apply(emu, channel, val); 666 + snd_emu1010_fpga_unlock(emu); 665 667 } 666 668 return change; 667 669 } ··· 707 705 change = (emu->emu1010.input_source[channel] != val); 708 706 if (change) { 709 707 emu->emu1010.input_source[channel] = val; 708 + snd_emu1010_fpga_lock(emu); 710 709 snd_emu1010_input_source_apply(emu, channel, val); 710 + snd_emu1010_fpga_unlock(emu); 711 711 } 712 712 return change; 713 713 } ··· 778 774 cache = cache & ~mask; 779 775 change = (cache != emu->emu1010.adc_pads); 780 776 if (change) { 781 - snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, cache ); 777 + snd_emu1010_fpga_write_lock(emu, EMU_HANA_ADC_PADS, cache ); 782 778 emu->emu1010.adc_pads = cache; 783 779 } 784 780 ··· 836 832 cache = cache & ~mask; 837 833 change = (cache != emu->emu1010.dac_pads); 838 834 if (change) { 839 - snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, cache ); 835 + snd_emu1010_fpga_write_lock(emu, EMU_HANA_DAC_PADS, cache ); 840 836 emu->emu1010.dac_pads = cache; 841 837 } 842 838 ··· 984 980 val = ucontrol->value.enumerated.item[0] ; 985 981 if (val >= emu_ci->num) 986 982 return -EINVAL; 983 + snd_emu1010_fpga_lock(emu); 987 984 spin_lock_irq(&emu->reg_lock); 988 985 change = (emu->emu1010.clock_source != val); 989 986 if (change) { ··· 1001 996 } else { 1002 997 spin_unlock_irq(&emu->reg_lock); 1003 998 } 999 + snd_emu1010_fpga_unlock(emu); 1004 1000 return change; 1005 1001 } 1006 1002 ··· 1047 1041 change = (emu->emu1010.clock_fallback != val); 1048 1042 if (change) { 1049 1043 emu->emu1010.clock_fallback = val; 1050 - snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 1 - val); 1044 + snd_emu1010_fpga_write_lock(emu, EMU_HANA_DEFCLOCK, 1 - val); 1051 1045 } 1052 1046 return change; 1053 1047 } ··· 1099 1093 emu->emu1010.optical_out = val; 1100 1094 tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : EMU_HANA_OPTICAL_IN_SPDIF) | 1101 1095 (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : EMU_HANA_OPTICAL_OUT_SPDIF); 1102 - snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp); 1096 + snd_emu1010_fpga_write_lock(emu, EMU_HANA_OPTICAL_TYPE, tmp); 1103 1097 } 1104 1098 return change; 1105 1099 } ··· 1150 1144 emu->emu1010.optical_in = val; 1151 1145 tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : EMU_HANA_OPTICAL_IN_SPDIF) | 1152 1146 (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : EMU_HANA_OPTICAL_OUT_SPDIF); 1153 - snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp); 1147 + snd_emu1010_fpga_write_lock(emu, EMU_HANA_OPTICAL_TYPE, tmp); 1154 1148 } 1155 1149 return change; 1156 1150 } ··· 2329 2323 for (i = 0; i < emu_ri->n_outs; i++) 2330 2324 emu->emu1010.output_source[i] = 2331 2325 emu1010_map_source(emu_ri, emu_ri->out_dflts[i]); 2326 + snd_emu1010_fpga_lock(emu); 2332 2327 snd_emu1010_apply_sources(emu); 2328 + snd_emu1010_fpga_unlock(emu); 2333 2329 2334 2330 kctl = emu->ctl_clock_source = snd_ctl_new1(&snd_emu1010_clock_source, emu); 2335 2331 err = snd_ctl_add(card, kctl);
+9
sound/pci/emu10k1/emuproc.c
··· 165 165 u32 value2; 166 166 167 167 if (emu->card_capabilities->emu_model) { 168 + snd_emu1010_fpga_lock(emu); 169 + 168 170 // This represents the S/PDIF lock status on 0404b, which is 169 171 // kinda weird and unhelpful, because monitoring it via IRQ is 170 172 // impractical (one gets an IRQ flood as long as it is desynced). ··· 199 197 snd_iprintf(buffer, "\nS/PDIF mode: %s%s\n", 200 198 value & EMU_HANA_SPDIF_MODE_RX_PRO ? "professional" : "consumer", 201 199 value & EMU_HANA_SPDIF_MODE_RX_NOCOPY ? ", no copy" : ""); 200 + 201 + snd_emu1010_fpga_unlock(emu); 202 202 } else { 203 203 snd_emu10k1_proc_spdif_status(emu, buffer, "CD-ROM S/PDIF In", CDCS, CDSRCS); 204 204 snd_emu10k1_proc_spdif_status(emu, buffer, "Optical or Coax S/PDIF In", GPSCS, GPSRCS); ··· 462 458 struct snd_emu10k1 *emu = entry->private_data; 463 459 u32 value; 464 460 int i; 461 + 462 + snd_emu1010_fpga_lock(emu); 463 + 465 464 snd_iprintf(buffer, "EMU1010 Registers:\n\n"); 466 465 467 466 for(i = 0; i < 0x40; i+=1) { ··· 503 496 snd_emu_proc_emu1010_link_read(emu, buffer, 0x701); 504 497 } 505 498 } 499 + 500 + snd_emu1010_fpga_unlock(emu); 506 501 } 507 502 508 503 static void snd_emu_proc_io_reg_read(struct snd_info_entry *entry,
+22 -29
sound/pci/emu10k1/io.c
··· 285 285 outw(value, emu->port + A_GPIO); 286 286 udelay(10); 287 287 outw(value | 0x80 , emu->port + A_GPIO); /* High bit clocks the value into the fpga. */ 288 + udelay(10); 288 289 } 289 290 290 291 void snd_emu1010_fpga_write(struct snd_emu10k1 *emu, u32 reg, u32 value) 291 292 { 292 - unsigned long flags; 293 - 294 - spin_lock_irqsave(&emu->emu_lock, flags); 293 + if (snd_BUG_ON(!mutex_is_locked(&emu->emu1010.lock))) 294 + return; 295 295 snd_emu1010_fpga_write_locked(emu, reg, value); 296 - spin_unlock_irqrestore(&emu->emu_lock, flags); 297 296 } 298 297 299 - static void snd_emu1010_fpga_read_locked(struct snd_emu10k1 *emu, u32 reg, u32 *value) 298 + void snd_emu1010_fpga_write_lock(struct snd_emu10k1 *emu, u32 reg, u32 value) 299 + { 300 + snd_emu1010_fpga_lock(emu); 301 + snd_emu1010_fpga_write_locked(emu, reg, value); 302 + snd_emu1010_fpga_unlock(emu); 303 + } 304 + 305 + void snd_emu1010_fpga_read(struct snd_emu10k1 *emu, u32 reg, u32 *value) 300 306 { 301 307 // The higest input pin is used as the designated interrupt trigger, 302 308 // so it needs to be masked out. 303 309 // But note that any other input pin change will also cause an IRQ, 304 310 // so using this function often causes an IRQ as a side effect. 305 311 u32 mask = emu->card_capabilities->ca0108_chip ? 0x1f : 0x7f; 312 + 313 + if (snd_BUG_ON(!mutex_is_locked(&emu->emu1010.lock))) 314 + return; 306 315 if (snd_BUG_ON(reg > 0x3f)) 307 316 return; 308 317 reg += 0x40; /* 0x40 upwards are registers. */ ··· 322 313 *value = ((inw(emu->port + A_GPIO) >> 8) & mask); 323 314 } 324 315 325 - void snd_emu1010_fpga_read(struct snd_emu10k1 *emu, u32 reg, u32 *value) 326 - { 327 - unsigned long flags; 328 - 329 - spin_lock_irqsave(&emu->emu_lock, flags); 330 - snd_emu1010_fpga_read_locked(emu, reg, value); 331 - spin_unlock_irqrestore(&emu->emu_lock, flags); 332 - } 333 - 334 316 /* Each Destination has one and only one Source, 335 317 * but one Source can feed any number of Destinations simultaneously. 336 318 */ 337 319 void snd_emu1010_fpga_link_dst_src_write(struct snd_emu10k1 *emu, u32 dst, u32 src) 338 320 { 339 - unsigned long flags; 340 - 341 321 if (snd_BUG_ON(dst & ~0x71f)) 342 322 return; 343 323 if (snd_BUG_ON(src & ~0x71f)) 344 324 return; 345 - spin_lock_irqsave(&emu->emu_lock, flags); 346 - snd_emu1010_fpga_write_locked(emu, EMU_HANA_DESTHI, dst >> 8); 347 - snd_emu1010_fpga_write_locked(emu, EMU_HANA_DESTLO, dst & 0x1f); 348 - snd_emu1010_fpga_write_locked(emu, EMU_HANA_SRCHI, src >> 8); 349 - snd_emu1010_fpga_write_locked(emu, EMU_HANA_SRCLO, src & 0x1f); 350 - spin_unlock_irqrestore(&emu->emu_lock, flags); 325 + snd_emu1010_fpga_write(emu, EMU_HANA_DESTHI, dst >> 8); 326 + snd_emu1010_fpga_write(emu, EMU_HANA_DESTLO, dst & 0x1f); 327 + snd_emu1010_fpga_write(emu, EMU_HANA_SRCHI, src >> 8); 328 + snd_emu1010_fpga_write(emu, EMU_HANA_SRCLO, src & 0x1f); 351 329 } 352 330 353 331 u32 snd_emu1010_fpga_link_dst_src_read(struct snd_emu10k1 *emu, u32 dst) 354 332 { 355 - unsigned long flags; 356 333 u32 hi, lo; 357 334 358 335 if (snd_BUG_ON(dst & ~0x71f)) 359 336 return 0; 360 - spin_lock_irqsave(&emu->emu_lock, flags); 361 - snd_emu1010_fpga_write_locked(emu, EMU_HANA_DESTHI, dst >> 8); 362 - snd_emu1010_fpga_write_locked(emu, EMU_HANA_DESTLO, dst & 0x1f); 363 - snd_emu1010_fpga_read_locked(emu, EMU_HANA_SRCHI, &hi); 364 - snd_emu1010_fpga_read_locked(emu, EMU_HANA_SRCLO, &lo); 365 - spin_unlock_irqrestore(&emu->emu_lock, flags); 337 + snd_emu1010_fpga_write(emu, EMU_HANA_DESTHI, dst >> 8); 338 + snd_emu1010_fpga_write(emu, EMU_HANA_DESTLO, dst & 0x1f); 339 + snd_emu1010_fpga_read(emu, EMU_HANA_SRCHI, &hi); 340 + snd_emu1010_fpga_read(emu, EMU_HANA_SRCLO, &lo); 366 341 return (hi << 8) | lo; 367 342 } 368 343
+4
sound/pci/hda/cs35l56_hda.c
··· 644 644 ret = cs35l56_wait_for_firmware_boot(&cs35l56->base); 645 645 if (ret) 646 646 goto err_powered_up; 647 + 648 + regcache_cache_only(cs35l56->base.regmap, false); 647 649 } 648 650 649 651 /* Disable auto-hibernate so that runtime_pm has control */ ··· 1003 1001 ret = cs35l56_wait_for_firmware_boot(&cs35l56->base); 1004 1002 if (ret) 1005 1003 goto err; 1004 + 1005 + regcache_cache_only(cs35l56->base.regmap, false); 1006 1006 1007 1007 ret = cs35l56_set_patch(&cs35l56->base); 1008 1008 if (ret)
+76 -2
sound/pci/hda/patch_realtek.c
··· 920 920 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME) 921 921 #define is_s4_resume(codec) \ 922 922 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE) 923 + #define is_s4_suspend(codec) \ 924 + ((codec)->core.dev.power.power_state.event == PM_EVENT_FREEZE) 923 925 924 926 static int alc_init(struct hda_codec *codec) 925 927 { ··· 7185 7183 alc245_fixup_hp_gpio_led(codec, fix, action); 7186 7184 } 7187 7185 7186 + /* 7187 + * ALC287 PCM hooks 7188 + */ 7189 + static void alc287_alc1318_playback_pcm_hook(struct hda_pcm_stream *hinfo, 7190 + struct hda_codec *codec, 7191 + struct snd_pcm_substream *substream, 7192 + int action) 7193 + { 7194 + alc_write_coef_idx(codec, 0x10, 0x8806); /* Change MLK to GPIO3 */ 7195 + switch (action) { 7196 + case HDA_GEN_PCM_ACT_OPEN: 7197 + alc_write_coefex_idx(codec, 0x5a, 0x00, 0x954f); /* write gpio3 to high */ 7198 + break; 7199 + case HDA_GEN_PCM_ACT_CLOSE: 7200 + alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */ 7201 + break; 7202 + } 7203 + } 7204 + 7205 + static void __maybe_unused alc287_s4_power_gpio3_default(struct hda_codec *codec) 7206 + { 7207 + if (is_s4_suspend(codec)) { 7208 + alc_write_coef_idx(codec, 0x10, 0x8806); /* Change MLK to GPIO3 */ 7209 + alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */ 7210 + } 7211 + } 7212 + 7213 + static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec, 7214 + const struct hda_fixup *fix, int action) 7215 + { 7216 + struct alc_spec *spec = codec->spec; 7217 + 7218 + if (action != HDA_FIXUP_ACT_PRE_PROBE) 7219 + return; 7220 + #ifdef CONFIG_PM 7221 + spec->power_hook = alc287_s4_power_gpio3_default; 7222 + #endif 7223 + spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook; 7224 + } 7225 + 7188 7226 7189 7227 enum { 7190 7228 ALC269_FIXUP_GPIO2, ··· 7468 7426 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS, 7469 7427 ALC298_FIXUP_LENOVO_C940_DUET7, 7470 7428 ALC287_FIXUP_LENOVO_14IRP8_DUETITL, 7429 + ALC287_FIXUP_LENOVO_LEGION_7, 7471 7430 ALC287_FIXUP_13S_GEN2_SPEAKERS, 7472 7431 ALC256_FIXUP_SET_COEF_DEFAULTS, 7473 7432 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE, ··· 7513 7470 ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC, 7514 7471 ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1, 7515 7472 ALC285_FIXUP_ASUS_GU605_SPI_2_HEADSET_MIC, 7516 - ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1 7473 + ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1, 7474 + ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318, 7517 7475 }; 7518 7476 7519 7477 /* A special fixup for Lenovo C940 and Yoga Duet 7; ··· 7551 7507 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* DuetITL */ 7552 7508 else 7553 7509 id = ALC287_FIXUP_TAS2781_I2C; /* 14IRP8 */ 7510 + __snd_hda_apply_fixup(codec, id, action, 0); 7511 + } 7512 + 7513 + /* Another hilarious PCI SSID conflict with Lenovo Legion Pro 7 16ARX8H (with 7514 + * TAS2781 codec) and Legion 7i 16IAX7 (with CS35L41 codec); 7515 + * we apply a corresponding fixup depending on the codec SSID instead 7516 + */ 7517 + static void alc287_fixup_lenovo_legion_7(struct hda_codec *codec, 7518 + const struct hda_fixup *fix, 7519 + int action) 7520 + { 7521 + int id; 7522 + 7523 + if (codec->core.subsystem_id == 0x17aa38a8) 7524 + id = ALC287_FIXUP_TAS2781_I2C; /* Legion Pro 7 16ARX8H */ 7525 + else 7526 + id = ALC287_FIXUP_CS35L41_I2C_2; /* Legion 7i 16IAX7 */ 7554 7527 __snd_hda_apply_fixup(codec, id, action, 0); 7555 7528 } 7556 7529 ··· 9465 9404 .type = HDA_FIXUP_FUNC, 9466 9405 .v.func = alc287_fixup_lenovo_14irp8_duetitl, 9467 9406 }, 9407 + [ALC287_FIXUP_LENOVO_LEGION_7] = { 9408 + .type = HDA_FIXUP_FUNC, 9409 + .v.func = alc287_fixup_lenovo_legion_7, 9410 + }, 9468 9411 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = { 9469 9412 .type = HDA_FIXUP_VERBS, 9470 9413 .v.verbs = (const struct hda_verb[]) { ··· 9791 9726 .chained = true, 9792 9727 .chain_id = ALC285_FIXUP_ASUS_GA403U, 9793 9728 }, 9729 + [ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318] = { 9730 + .type = HDA_FIXUP_FUNC, 9731 + .v.func = alc287_fixup_lenovo_thinkpad_with_alc1318, 9732 + .chained = true, 9733 + .chain_id = ALC269_FIXUP_THINKPAD_ACPI 9734 + }, 9794 9735 }; 9795 9736 9796 9737 static const struct snd_pci_quirk alc269_fixup_tbl[] = { ··· 10008 9937 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT), 10009 9938 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT), 10010 9939 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), 9940 + SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2), 10011 9941 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO), 10012 9942 SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1), 10013 9943 SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1), ··· 10465 10393 SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD), 10466 10394 SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD), 10467 10395 SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD), 10396 + SND_PCI_QUIRK(0x17aa, 0x231e, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318), 10397 + SND_PCI_QUIRK(0x17aa, 0x231f, "Thinkpad", ALC287_FIXUP_LENOVO_THKPAD_WH_ALC1318), 10468 10398 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), 10469 10399 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), 10470 10400 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), ··· 10496 10422 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), 10497 10423 SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6), 10498 10424 SND_PCI_QUIRK(0x17aa, 0x3869, "Lenovo Yoga7 14IAL7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN), 10499 - SND_PCI_QUIRK(0x17aa, 0x386f, "Legion 7i 16IAX7", ALC287_FIXUP_CS35L41_I2C_2), 10425 + SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7/7i", ALC287_FIXUP_LENOVO_LEGION_7), 10500 10426 SND_PCI_QUIRK(0x17aa, 0x3870, "Lenovo Yoga 7 14ARB7", ALC287_FIXUP_YOGA7_14ARB7_I2C), 10501 10427 SND_PCI_QUIRK(0x17aa, 0x3877, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2), 10502 10428 SND_PCI_QUIRK(0x17aa, 0x3878, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
+7
sound/soc/amd/yc/acp6x-mach.c
··· 433 433 { 434 434 .driver_data = &acp6x_card, 435 435 .matches = { 436 + DMI_MATCH(DMI_BOARD_VENDOR, "MDC"), 437 + DMI_MATCH(DMI_BOARD_NAME, "Herbag_MDU"), 438 + } 439 + }, 440 + { 441 + .driver_data = &acp6x_card, 442 + .matches = { 436 443 DMI_MATCH(DMI_BOARD_VENDOR, "System76"), 437 444 DMI_MATCH(DMI_PRODUCT_VERSION, "pang12"), 438 445 }
+21 -7
sound/soc/codecs/cs35l41.c
··· 1094 1094 static int cs35l41_dsp_init(struct cs35l41_private *cs35l41) 1095 1095 { 1096 1096 struct wm_adsp *dsp; 1097 + uint32_t dsp1rx5_src; 1097 1098 int ret; 1098 1099 1099 1100 dsp = &cs35l41->dsp; ··· 1114 1113 return ret; 1115 1114 } 1116 1115 1117 - ret = regmap_write(cs35l41->regmap, CS35L41_DSP1_RX5_SRC, 1118 - CS35L41_INPUT_SRC_VPMON); 1119 - if (ret < 0) { 1120 - dev_err(cs35l41->dev, "Write INPUT_SRC_VPMON failed: %d\n", ret); 1116 + switch (cs35l41->hw_cfg.bst_type) { 1117 + case CS35L41_INT_BOOST: 1118 + case CS35L41_SHD_BOOST_ACTV: 1119 + dsp1rx5_src = CS35L41_INPUT_SRC_VPMON; 1120 + break; 1121 + case CS35L41_EXT_BOOST: 1122 + case CS35L41_SHD_BOOST_PASS: 1123 + dsp1rx5_src = CS35L41_INPUT_SRC_VBSTMON; 1124 + break; 1125 + default: 1126 + dev_err(cs35l41->dev, "wm_halo_init failed - Invalid Boost Type: %d\n", 1127 + cs35l41->hw_cfg.bst_type); 1121 1128 goto err_dsp; 1122 1129 } 1123 - ret = regmap_write(cs35l41->regmap, CS35L41_DSP1_RX6_SRC, 1124 - CS35L41_INPUT_SRC_CLASSH); 1130 + 1131 + ret = regmap_write(cs35l41->regmap, CS35L41_DSP1_RX5_SRC, dsp1rx5_src); 1125 1132 if (ret < 0) { 1126 - dev_err(cs35l41->dev, "Write INPUT_SRC_CLASSH failed: %d\n", ret); 1133 + dev_err(cs35l41->dev, "Write DSP1RX5_SRC: %d failed: %d\n", dsp1rx5_src, ret); 1134 + goto err_dsp; 1135 + } 1136 + ret = regmap_write(cs35l41->regmap, CS35L41_DSP1_RX6_SRC, CS35L41_INPUT_SRC_VBSTMON); 1137 + if (ret < 0) { 1138 + dev_err(cs35l41->dev, "Write CS35L41_INPUT_SRC_VBSTMON failed: %d\n", ret); 1127 1139 goto err_dsp; 1128 1140 } 1129 1141 ret = regmap_write(cs35l41->regmap, CS35L41_DSP1_RX7_SRC,
-2
sound/soc/codecs/cs35l56-sdw.c
··· 188 188 goto out; 189 189 } 190 190 191 - regcache_cache_only(cs35l56->base.regmap, false); 192 - 193 191 ret = cs35l56_init(cs35l56); 194 192 if (ret < 0) { 195 193 regcache_cache_only(cs35l56->base.regmap, true);
+55 -30
sound/soc/codecs/cs35l56-shared.c
··· 40 40 static const struct reg_default cs35l56_reg_defaults[] = { 41 41 /* no defaults for OTP_MEM - first read populates cache */ 42 42 43 - { CS35L56_ASP1_ENABLES1, 0x00000000 }, 44 - { CS35L56_ASP1_CONTROL1, 0x00000028 }, 45 - { CS35L56_ASP1_CONTROL2, 0x18180200 }, 46 - { CS35L56_ASP1_CONTROL3, 0x00000002 }, 47 - { CS35L56_ASP1_FRAME_CONTROL1, 0x03020100 }, 48 - { CS35L56_ASP1_FRAME_CONTROL5, 0x00020100 }, 49 - { CS35L56_ASP1_DATA_CONTROL1, 0x00000018 }, 50 - { CS35L56_ASP1_DATA_CONTROL5, 0x00000018 }, 51 - 52 - /* no defaults for ASP1TX mixer */ 43 + /* 44 + * No defaults for ASP1 control or ASP1TX mixer. See 45 + * cs35l56_populate_asp1_register_defaults() and 46 + * cs35l56_sync_asp1_mixer_widgets_with_firmware(). 47 + */ 53 48 54 49 { CS35L56_SWIRE_DP3_CH1_INPUT, 0x00000018 }, 55 50 { CS35L56_SWIRE_DP3_CH2_INPUT, 0x00000019 }, ··· 205 210 } 206 211 } 207 212 213 + static const struct reg_sequence cs35l56_asp1_defaults[] = { 214 + REG_SEQ0(CS35L56_ASP1_ENABLES1, 0x00000000), 215 + REG_SEQ0(CS35L56_ASP1_CONTROL1, 0x00000028), 216 + REG_SEQ0(CS35L56_ASP1_CONTROL2, 0x18180200), 217 + REG_SEQ0(CS35L56_ASP1_CONTROL3, 0x00000002), 218 + REG_SEQ0(CS35L56_ASP1_FRAME_CONTROL1, 0x03020100), 219 + REG_SEQ0(CS35L56_ASP1_FRAME_CONTROL5, 0x00020100), 220 + REG_SEQ0(CS35L56_ASP1_DATA_CONTROL1, 0x00000018), 221 + REG_SEQ0(CS35L56_ASP1_DATA_CONTROL5, 0x00000018), 222 + }; 223 + 224 + /* 225 + * The firmware can have control of the ASP so we don't provide regmap 226 + * with defaults for these registers, to prevent a regcache_sync() from 227 + * overwriting the firmware settings. But if the machine driver hooks up 228 + * the ASP it means the driver is taking control of the ASP, so then the 229 + * registers are populated with the defaults. 230 + */ 231 + int cs35l56_init_asp1_regs_for_driver_control(struct cs35l56_base *cs35l56_base) 232 + { 233 + if (!cs35l56_base->fw_owns_asp1) 234 + return 0; 235 + 236 + cs35l56_base->fw_owns_asp1 = false; 237 + 238 + return regmap_multi_reg_write(cs35l56_base->regmap, cs35l56_asp1_defaults, 239 + ARRAY_SIZE(cs35l56_asp1_defaults)); 240 + } 241 + EXPORT_SYMBOL_NS_GPL(cs35l56_init_asp1_regs_for_driver_control, SND_SOC_CS35L56_SHARED); 242 + 208 243 /* 209 244 * The firmware boot sequence can overwrite the ASP1 config registers so that 210 245 * they don't match regmap's view of their values. Rewrite the values from the ··· 242 217 */ 243 218 int cs35l56_force_sync_asp1_registers_from_cache(struct cs35l56_base *cs35l56_base) 244 219 { 245 - struct reg_sequence asp1_regs[] = { 246 - { .reg = CS35L56_ASP1_ENABLES1 }, 247 - { .reg = CS35L56_ASP1_CONTROL1 }, 248 - { .reg = CS35L56_ASP1_CONTROL2 }, 249 - { .reg = CS35L56_ASP1_CONTROL3 }, 250 - { .reg = CS35L56_ASP1_FRAME_CONTROL1 }, 251 - { .reg = CS35L56_ASP1_FRAME_CONTROL5 }, 252 - { .reg = CS35L56_ASP1_DATA_CONTROL1 }, 253 - { .reg = CS35L56_ASP1_DATA_CONTROL5 }, 254 - }; 220 + struct reg_sequence asp1_regs[ARRAY_SIZE(cs35l56_asp1_defaults)]; 255 221 int i, ret; 256 222 257 - /* Read values from regmap cache into a write sequence */ 223 + if (cs35l56_base->fw_owns_asp1) 224 + return 0; 225 + 226 + memcpy(asp1_regs, cs35l56_asp1_defaults, sizeof(asp1_regs)); 227 + 228 + /* Read current values from regmap cache into the write sequence */ 258 229 for (i = 0; i < ARRAY_SIZE(asp1_regs); ++i) { 259 230 ret = regmap_read(cs35l56_base->regmap, asp1_regs[i].reg, &asp1_regs[i].def); 260 231 if (ret) ··· 328 307 reg = CS35L56_DSP1_HALO_STATE; 329 308 330 309 /* 331 - * This can't be a regmap_read_poll_timeout() because cs35l56 will NAK 332 - * I2C until it has booted which would terminate the poll 310 + * The regmap must remain in cache-only until the chip has 311 + * booted, so use a bypassed read of the status register. 333 312 */ 334 - poll_ret = read_poll_timeout(regmap_read, read_ret, 313 + poll_ret = read_poll_timeout(regmap_read_bypassed, read_ret, 335 314 (val < 0xFFFF) && (val >= CS35L56_HALO_STATE_BOOT_DONE), 336 315 CS35L56_HALO_STATE_POLL_US, 337 316 CS35L56_HALO_STATE_TIMEOUT_US, ··· 383 362 return; 384 363 385 364 cs35l56_wait_control_port_ready(); 386 - regcache_cache_only(cs35l56_base->regmap, false); 365 + 366 + /* Leave in cache-only. This will be revoked when the chip has rebooted. */ 387 367 } 388 368 EXPORT_SYMBOL_NS_GPL(cs35l56_system_reset, SND_SOC_CS35L56_SHARED); 389 369 ··· 599 577 cs35l56_issue_wake_event(cs35l56_base); 600 578 601 579 out_sync: 602 - regcache_cache_only(cs35l56_base->regmap, false); 603 - 604 580 ret = cs35l56_wait_for_firmware_boot(cs35l56_base); 605 581 if (ret) { 606 582 dev_err(cs35l56_base->dev, "Hibernate wake failed: %d\n", ret); 607 583 goto err; 608 584 } 585 + 586 + regcache_cache_only(cs35l56_base->regmap, false); 609 587 610 588 ret = cs35l56_mbox_send(cs35l56_base, CS35L56_MBOX_CMD_PREVENT_AUTO_HIBERNATE); 611 589 if (ret) ··· 706 684 707 685 int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base) 708 686 { 709 - u64 silicon_uid; 687 + u64 silicon_uid = 0; 710 688 int ret; 711 689 712 690 /* Driver can't apply calibration to a secured part, so skip */ ··· 779 757 * devices so the REVID needs to be determined before waiting for the 780 758 * firmware to boot. 781 759 */ 782 - ret = regmap_read(cs35l56_base->regmap, CS35L56_REVID, &revid); 760 + ret = regmap_read_bypassed(cs35l56_base->regmap, CS35L56_REVID, &revid); 783 761 if (ret < 0) { 784 762 dev_err(cs35l56_base->dev, "Get Revision ID failed\n"); 785 763 return ret; ··· 790 768 if (ret) 791 769 return ret; 792 770 793 - ret = regmap_read(cs35l56_base->regmap, CS35L56_DEVID, &devid); 771 + ret = regmap_read_bypassed(cs35l56_base->regmap, CS35L56_DEVID, &devid); 794 772 if (ret < 0) { 795 773 dev_err(cs35l56_base->dev, "Get Device ID failed\n"); 796 774 return ret; ··· 808 786 } 809 787 810 788 cs35l56_base->type = devid & 0xFF; 789 + 790 + /* Silicon is now identified and booted so exit cache-only */ 791 + regcache_cache_only(cs35l56_base->regmap, false); 811 792 812 793 ret = regmap_read(cs35l56_base->regmap, CS35L56_DSP_RESTRICT_STS1, &secured); 813 794 if (ret) {
+36 -3
sound/soc/codecs/cs35l56.c
··· 454 454 { 455 455 struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(codec_dai->component); 456 456 unsigned int val; 457 + int ret; 457 458 458 459 dev_dbg(cs35l56->base.dev, "%s: %#x\n", __func__, fmt); 460 + 461 + ret = cs35l56_init_asp1_regs_for_driver_control(&cs35l56->base); 462 + if (ret) 463 + return ret; 459 464 460 465 switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { 461 466 case SND_SOC_DAIFMT_CBC_CFC: ··· 535 530 unsigned int rx_mask, int slots, int slot_width) 536 531 { 537 532 struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(dai->component); 533 + int ret; 534 + 535 + ret = cs35l56_init_asp1_regs_for_driver_control(&cs35l56->base); 536 + if (ret) 537 + return ret; 538 538 539 539 if ((slots == 0) || (slot_width == 0)) { 540 540 dev_dbg(cs35l56->base.dev, "tdm config cleared\n"); ··· 588 578 struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(dai->component); 589 579 unsigned int rate = params_rate(params); 590 580 u8 asp_width, asp_wl; 581 + int ret; 582 + 583 + ret = cs35l56_init_asp1_regs_for_driver_control(&cs35l56->base); 584 + if (ret) 585 + return ret; 591 586 592 587 asp_wl = params_width(params); 593 588 if (cs35l56->asp_slot_width) ··· 649 634 int clk_id, unsigned int freq, int dir) 650 635 { 651 636 struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(dai->component); 652 - int freq_id; 637 + int freq_id, ret; 638 + 639 + ret = cs35l56_init_asp1_regs_for_driver_control(&cs35l56->base); 640 + if (ret) 641 + return ret; 653 642 654 643 if (freq == 0) { 655 644 cs35l56->sysclk_set = false; ··· 1360 1341 "spk-id-gpios", ACPI_TYPE_PACKAGE, &obj); 1361 1342 if (ret) { 1362 1343 dev_dbg(cs35l56->base.dev, "Could not get spk-id-gpios package: %d\n", ret); 1344 + fwnode_handle_put(af01_fwnode); 1363 1345 return -ENOENT; 1364 1346 } 1365 1347 ··· 1368 1348 if (obj->package.count != 4) { 1369 1349 dev_warn(cs35l56->base.dev, "Unexpected spk-id element count %d\n", 1370 1350 obj->package.count); 1351 + fwnode_handle_put(af01_fwnode); 1371 1352 return -ENOENT; 1372 1353 } 1373 1354 ··· 1383 1362 */ 1384 1363 ret = acpi_dev_add_driver_gpios(adev, cs35l56_af01_spkid_gpios_mapping); 1385 1364 if (ret) { 1365 + fwnode_handle_put(af01_fwnode); 1386 1366 return dev_err_probe(cs35l56->base.dev, ret, 1387 1367 "Failed to add gpio mapping to AF01\n"); 1388 1368 } ··· 1391 1369 ret = devm_add_action_or_reset(cs35l56->base.dev, 1392 1370 cs35l56_acpi_dev_release_driver_gpios, 1393 1371 adev); 1394 - if (ret) 1372 + if (ret) { 1373 + fwnode_handle_put(af01_fwnode); 1395 1374 return ret; 1375 + } 1396 1376 1397 1377 dev_dbg(cs35l56->base.dev, "Added spk-id-gpios mapping to AF01\n"); 1398 1378 } 1399 1379 1400 1380 desc = fwnode_gpiod_get_index(af01_fwnode, "spk-id", 0, GPIOD_IN, NULL); 1401 1381 if (IS_ERR(desc)) { 1382 + fwnode_handle_put(af01_fwnode); 1402 1383 ret = PTR_ERR(desc); 1403 1384 return dev_err_probe(cs35l56->base.dev, ret, "Get GPIO from AF01 failed\n"); 1404 1385 } ··· 1410 1385 gpiod_put(desc); 1411 1386 1412 1387 if (ret < 0) { 1388 + fwnode_handle_put(af01_fwnode); 1413 1389 dev_err_probe(cs35l56->base.dev, ret, "Error reading spk-id GPIO\n"); 1414 1390 return ret; 1415 - } 1391 + } 1392 + 1393 + fwnode_handle_put(af01_fwnode); 1416 1394 1417 1395 dev_info(cs35l56->base.dev, "Got spk-id from AF01\n"); 1418 1396 ··· 1430 1402 mutex_init(&cs35l56->base.irq_lock); 1431 1403 cs35l56->base.cal_index = -1; 1432 1404 cs35l56->speaker_id = -ENOENT; 1405 + 1406 + /* Assume that the firmware owns ASP1 until we know different */ 1407 + cs35l56->base.fw_owns_asp1 = true; 1433 1408 1434 1409 dev_set_drvdata(cs35l56->base.dev, cs35l56); 1435 1410 ··· 1562 1531 return ret; 1563 1532 1564 1533 dev_dbg(cs35l56->base.dev, "Firmware rebooted after soft reset\n"); 1534 + 1535 + regcache_cache_only(cs35l56->base.regmap, false); 1565 1536 } 1566 1537 1567 1538 /* Disable auto-hibernate so that runtime_pm has control */
+5 -1
sound/soc/codecs/da7219-aad.c
··· 671 671 return NULL; 672 672 673 673 aad_pdata = devm_kzalloc(dev, sizeof(*aad_pdata), GFP_KERNEL); 674 - if (!aad_pdata) 674 + if (!aad_pdata) { 675 + fwnode_handle_put(aad_np); 675 676 return NULL; 677 + } 676 678 677 679 aad_pdata->irq = i2c->irq; 678 680 ··· 754 752 da7219_aad_fw_adc_1bit_rpt(dev, fw_val32); 755 753 else 756 754 aad_pdata->adc_1bit_rpt = DA7219_AAD_ADC_1BIT_RPT_1; 755 + 756 + fwnode_handle_put(aad_np); 757 757 758 758 return aad_pdata; 759 759 }
+25
sound/soc/codecs/rt5645.c
··· 444 444 struct regmap *regmap; 445 445 struct i2c_client *i2c; 446 446 struct gpio_desc *gpiod_hp_det; 447 + struct gpio_desc *gpiod_cbj_sleeve; 447 448 struct snd_soc_jack *hp_jack; 448 449 struct snd_soc_jack *mic_jack; 449 450 struct snd_soc_jack *btn_jack; ··· 3187 3186 regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL2, 3188 3187 RT5645_CBJ_MN_JD, 0); 3189 3188 3189 + if (rt5645->gpiod_cbj_sleeve) 3190 + gpiod_set_value(rt5645->gpiod_cbj_sleeve, 1); 3191 + 3190 3192 msleep(600); 3191 3193 regmap_read(rt5645->regmap, RT5645_IN1_CTRL3, &val); 3192 3194 val &= 0x7; ··· 3206 3202 snd_soc_dapm_disable_pin(dapm, "Mic Det Power"); 3207 3203 snd_soc_dapm_sync(dapm); 3208 3204 rt5645->jack_type = SND_JACK_HEADPHONE; 3205 + if (rt5645->gpiod_cbj_sleeve) 3206 + gpiod_set_value(rt5645->gpiod_cbj_sleeve, 0); 3209 3207 } 3210 3208 if (rt5645->pdata.level_trigger_irq) 3211 3209 regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2, ··· 3235 3229 if (rt5645->pdata.level_trigger_irq) 3236 3230 regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2, 3237 3231 RT5645_JD_1_1_MASK, RT5645_JD_1_1_INV); 3232 + 3233 + if (rt5645->gpiod_cbj_sleeve) 3234 + gpiod_set_value(rt5645->gpiod_cbj_sleeve, 0); 3238 3235 } 3239 3236 3240 3237 return rt5645->jack_type; ··· 4021 4012 return ret; 4022 4013 } 4023 4014 4015 + rt5645->gpiod_cbj_sleeve = devm_gpiod_get_optional(&i2c->dev, "cbj-sleeve", 4016 + GPIOD_OUT_LOW); 4017 + 4018 + if (IS_ERR(rt5645->gpiod_cbj_sleeve)) { 4019 + ret = PTR_ERR(rt5645->gpiod_cbj_sleeve); 4020 + dev_info(&i2c->dev, "failed to initialize gpiod, ret=%d\n", ret); 4021 + if (ret != -ENOENT) 4022 + return ret; 4023 + } 4024 + 4024 4025 for (i = 0; i < ARRAY_SIZE(rt5645->supplies); i++) 4025 4026 rt5645->supplies[i].supply = rt5645_supply_names[i]; 4026 4027 ··· 4278 4259 cancel_delayed_work_sync(&rt5645->jack_detect_work); 4279 4260 cancel_delayed_work_sync(&rt5645->rcclock_work); 4280 4261 4262 + if (rt5645->gpiod_cbj_sleeve) 4263 + gpiod_set_value(rt5645->gpiod_cbj_sleeve, 0); 4264 + 4281 4265 regulator_bulk_disable(ARRAY_SIZE(rt5645->supplies), rt5645->supplies); 4282 4266 } 4283 4267 ··· 4296 4274 0); 4297 4275 msleep(20); 4298 4276 regmap_write(rt5645->regmap, RT5645_RESET, 0); 4277 + 4278 + if (rt5645->gpiod_cbj_sleeve) 4279 + gpiod_set_value(rt5645->gpiod_cbj_sleeve, 0); 4299 4280 } 4300 4281 4301 4282 static int __maybe_unused rt5645_sys_suspend(struct device *dev)
+4 -4
sound/soc/codecs/rt715-sdca.c
··· 316 316 return 0; 317 317 } 318 318 319 - static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -17625, 375, 0); 319 + static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -1725, 75, 0); 320 320 static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, 0, 1000, 0); 321 321 322 322 static int rt715_sdca_get_volsw(struct snd_kcontrol *kcontrol, ··· 477 477 RT715_SDCA_FU_VOL_CTRL, CH_01), 478 478 SDW_SDCA_CTL(FUN_MIC_ARRAY, RT715_SDCA_FU_ADC7_27_VOL, 479 479 RT715_SDCA_FU_VOL_CTRL, CH_02), 480 - 0x2f, 0x7f, 0, 480 + 0x2f, 0x3f, 0, 481 481 rt715_sdca_set_amp_gain_get, rt715_sdca_set_amp_gain_put, 482 482 in_vol_tlv), 483 483 RT715_SDCA_EXT_TLV("FU02 Capture Volume", ··· 485 485 RT715_SDCA_FU_VOL_CTRL, CH_01), 486 486 rt715_sdca_set_amp_gain_4ch_get, 487 487 rt715_sdca_set_amp_gain_4ch_put, 488 - in_vol_tlv, 4, 0x7f), 488 + in_vol_tlv, 4, 0x3f), 489 489 RT715_SDCA_EXT_TLV("FU06 Capture Volume", 490 490 SDW_SDCA_CTL(FUN_MIC_ARRAY, RT715_SDCA_FU_ADC10_11_VOL, 491 491 RT715_SDCA_FU_VOL_CTRL, CH_01), 492 492 rt715_sdca_set_amp_gain_4ch_get, 493 493 rt715_sdca_set_amp_gain_4ch_put, 494 - in_vol_tlv, 4, 0x7f), 494 + in_vol_tlv, 4, 0x3f), 495 495 /* MIC Boost Control */ 496 496 RT715_SDCA_BOOST_EXT_TLV("FU0E Boost", 497 497 SDW_SDCA_CTL(FUN_MIC_ARRAY, RT715_SDCA_FU_DMIC_GAIN_EN,
+1
sound/soc/codecs/rt715-sdw.c
··· 111 111 case 0x839d: 112 112 case 0x83a7: 113 113 case 0x83a9: 114 + case 0x752001: 114 115 case 0x752039: 115 116 return true; 116 117 default:
+20 -7
sound/soc/codecs/rt722-sdca.c
··· 1330 1330 .capture = { 1331 1331 .stream_name = "DP6 DMic Capture", 1332 1332 .channels_min = 1, 1333 - .channels_max = 2, 1333 + .channels_max = 4, 1334 1334 .rates = RT722_STEREO_RATES, 1335 1335 .formats = RT722_FORMATS, 1336 1336 }, ··· 1439 1439 int loop_check, chk_cnt = 100, ret; 1440 1440 unsigned int calib_status = 0; 1441 1441 1442 - /* Read eFuse */ 1443 - rt722_sdca_index_write(rt722, RT722_VENDOR_SPK_EFUSE, RT722_DC_CALIB_CTRL, 1444 - 0x4808); 1442 + /* Config analog bias */ 1443 + rt722_sdca_index_write(rt722, RT722_VENDOR_REG, RT722_ANALOG_BIAS_CTL3, 1444 + 0xa081); 1445 + /* GE related settings */ 1446 + rt722_sdca_index_write(rt722, RT722_VENDOR_HDA_CTL, RT722_GE_RELATED_CTL2, 1447 + 0xa009); 1445 1448 /* Button A, B, C, D bypass mode */ 1446 1449 rt722_sdca_index_write(rt722, RT722_VENDOR_HDA_CTL, RT722_UMP_HID_CTL4, 1447 1450 0xcf00); ··· 1478 1475 if ((calib_status & 0x0040) == 0x0) 1479 1476 break; 1480 1477 } 1481 - /* Release HP-JD, EN_CBJ_TIE_GL/R open, en_osw gating auto done bit */ 1482 - rt722_sdca_index_write(rt722, RT722_VENDOR_REG, RT722_DIGITAL_MISC_CTRL4, 1483 - 0x0010); 1484 1478 /* Set ADC09 power entity floating control */ 1485 1479 rt722_sdca_index_write(rt722, RT722_VENDOR_HDA_CTL, RT722_ADC0A_08_PDE_FLOAT_CTL, 1486 1480 0x2a12); ··· 1490 1490 /* Set DAC03 and HP power entity floating control */ 1491 1491 rt722_sdca_index_write(rt722, RT722_VENDOR_HDA_CTL, RT722_DAC03_HP_PDE_FLOAT_CTL, 1492 1492 0x4040); 1493 + rt722_sdca_index_write(rt722, RT722_VENDOR_HDA_CTL, RT722_ENT_FLOAT_CTRL_1, 1494 + 0x4141); 1495 + rt722_sdca_index_write(rt722, RT722_VENDOR_HDA_CTL, RT722_FLOAT_CTRL_1, 1496 + 0x0101); 1493 1497 /* Fine tune PDE40 latency */ 1494 1498 regmap_write(rt722->regmap, 0x2f58, 0x07); 1499 + regmap_write(rt722->regmap, 0x2f03, 0x06); 1500 + /* MIC VRefo */ 1501 + rt722_sdca_index_update_bits(rt722, RT722_VENDOR_REG, 1502 + RT722_COMBO_JACK_AUTO_CTL1, 0x0200, 0x0200); 1503 + rt722_sdca_index_update_bits(rt722, RT722_VENDOR_REG, 1504 + RT722_VREFO_GAT, 0x4000, 0x4000); 1505 + /* Release HP-JD, EN_CBJ_TIE_GL/R open, en_osw gating auto done bit */ 1506 + rt722_sdca_index_write(rt722, RT722_VENDOR_REG, RT722_DIGITAL_MISC_CTRL4, 1507 + 0x0010); 1495 1508 } 1496 1509 1497 1510 int rt722_sdca_io_init(struct device *dev, struct sdw_slave *slave)
+3
sound/soc/codecs/rt722-sdca.h
··· 69 69 #define RT722_COMBO_JACK_AUTO_CTL2 0x46 70 70 #define RT722_COMBO_JACK_AUTO_CTL3 0x47 71 71 #define RT722_DIGITAL_MISC_CTRL4 0x4a 72 + #define RT722_VREFO_GAT 0x63 72 73 #define RT722_FSM_CTL 0x67 73 74 #define RT722_SDCA_INTR_REC 0x82 74 75 #define RT722_SW_CONFIG1 0x8a ··· 128 127 #define RT722_UMP_HID_CTL6 0x66 129 128 #define RT722_UMP_HID_CTL7 0x67 130 129 #define RT722_UMP_HID_CTL8 0x68 130 + #define RT722_FLOAT_CTRL_1 0x70 131 + #define RT722_ENT_FLOAT_CTRL_1 0x76 131 132 132 133 /* Parameter & Verb control 01 (0x1a)(NID:20h) */ 133 134 #define RT722_HIDDEN_REG_SW_RESET (0x1 << 14)
+1
sound/soc/codecs/wsa881x.c
··· 1155 1155 pdev->prop.sink_ports = GENMASK(WSA881X_MAX_SWR_PORTS, 0); 1156 1156 pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop; 1157 1157 pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; 1158 + pdev->prop.clk_stop_mode1 = true; 1158 1159 gpiod_direction_output(wsa881x->sd_n, !wsa881x->sd_n_val); 1159 1160 1160 1161 wsa881x->regmap = devm_regmap_init_sdw(pdev, &wsa881x_regmap_config);
+1 -1
sound/soc/intel/avs/icl.c
··· 64 64 struct avs_icl_memwnd2 { 65 65 union { 66 66 struct avs_icl_memwnd2_desc slot_desc[AVS_ICL_MEMWND2_SLOTS_COUNT]; 67 - u8 rsvd[PAGE_SIZE]; 67 + u8 rsvd[SZ_4K]; 68 68 }; 69 69 u8 slot_array[AVS_ICL_MEMWND2_SLOTS_COUNT][PAGE_SIZE]; 70 70 } __packed;
+2
sound/soc/intel/avs/topology.c
··· 1582 1582 if (!le32_to_cpu(dw->priv.size)) 1583 1583 return 0; 1584 1584 1585 + w->no_wname_in_kcontrol_name = true; 1586 + 1585 1587 if (w->ignore_suspend && !AVS_S0IX_SUPPORTED) { 1586 1588 dev_info_once(comp->dev, "Device does not support S0IX, check BIOS settings\n"); 1587 1589 w->ignore_suspend = false;
+13 -11
sound/soc/intel/boards/bytcr_rt5640.c
··· 636 636 BYT_RT5640_USE_AMCR0F28), 637 637 }, 638 638 { 639 - .matches = { 640 - DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 641 - DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100TA"), 642 - }, 643 - .driver_data = (void *)(BYT_RT5640_IN1_MAP | 644 - BYT_RT5640_JD_SRC_JD2_IN4N | 645 - BYT_RT5640_OVCD_TH_2000UA | 646 - BYT_RT5640_OVCD_SF_0P75 | 647 - BYT_RT5640_MCLK_EN), 648 - }, 649 - { 639 + /* Asus T100TAF, unlike other T100TA* models this one has a mono speaker */ 650 640 .matches = { 651 641 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 652 642 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100TAF"), ··· 648 658 BYT_RT5640_MONO_SPEAKER | 649 659 BYT_RT5640_DIFF_MIC | 650 660 BYT_RT5640_SSP0_AIF2 | 661 + BYT_RT5640_MCLK_EN), 662 + }, 663 + { 664 + /* Asus T100TA and T100TAM, must come after T100TAF (mono spk) match */ 665 + .matches = { 666 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 667 + DMI_MATCH(DMI_PRODUCT_NAME, "T100TA"), 668 + }, 669 + .driver_data = (void *)(BYT_RT5640_IN1_MAP | 670 + BYT_RT5640_JD_SRC_JD2_IN4N | 671 + BYT_RT5640_OVCD_TH_2000UA | 672 + BYT_RT5640_OVCD_SF_0P75 | 651 673 BYT_RT5640_MCLK_EN), 652 674 }, 653 675 {
+1
sound/soc/meson/Kconfig
··· 99 99 100 100 config SND_MESON_CARD_UTILS 101 101 tristate 102 + select SND_DYNAMIC_MINORS 102 103 103 104 config SND_MESON_CODEC_GLUE 104 105 tristate
+1
sound/soc/meson/axg-card.c
··· 318 318 319 319 dai_link->cpus = cpu; 320 320 dai_link->num_cpus = 1; 321 + dai_link->nonatomic = true; 321 322 322 323 ret = meson_card_parse_dai(card, np, dai_link->cpus); 323 324 if (ret)
+20 -11
sound/soc/meson/axg-fifo.c
··· 204 204 unsigned int status; 205 205 206 206 regmap_read(fifo->map, FIFO_STATUS1, &status); 207 - 208 207 status = FIELD_GET(STATUS1_INT_STS, status); 209 - if (status & FIFO_INT_COUNT_REPEAT) 210 - snd_pcm_period_elapsed(ss); 211 - else 212 - dev_dbg(axg_fifo_dev(ss), "unexpected irq - STS 0x%02x\n", 213 - status); 214 - 215 - /* Ack irqs */ 216 208 axg_fifo_ack_irq(fifo, status); 217 209 218 - return IRQ_RETVAL(status); 210 + /* Use the thread to call period elapsed on nonatomic links */ 211 + if (status & FIFO_INT_COUNT_REPEAT) 212 + return IRQ_WAKE_THREAD; 213 + 214 + dev_dbg(axg_fifo_dev(ss), "unexpected irq - STS 0x%02x\n", 215 + status); 216 + 217 + return IRQ_NONE; 218 + } 219 + 220 + static irqreturn_t axg_fifo_pcm_irq_block_thread(int irq, void *dev_id) 221 + { 222 + struct snd_pcm_substream *ss = dev_id; 223 + 224 + snd_pcm_period_elapsed(ss); 225 + 226 + return IRQ_HANDLED; 219 227 } 220 228 221 229 int axg_fifo_pcm_open(struct snd_soc_component *component, ··· 251 243 if (ret) 252 244 return ret; 253 245 254 - ret = request_irq(fifo->irq, axg_fifo_pcm_irq_block, 0, 255 - dev_name(dev), ss); 246 + ret = request_threaded_irq(fifo->irq, axg_fifo_pcm_irq_block, 247 + axg_fifo_pcm_irq_block_thread, 248 + IRQF_ONESHOT, dev_name(dev), ss); 256 249 if (ret) 257 250 return ret; 258 251
+40
sound/soc/meson/axg-tdm-formatter.c
··· 392 392 } 393 393 EXPORT_SYMBOL_GPL(axg_tdm_stream_free); 394 394 395 + int axg_tdm_stream_set_cont_clocks(struct axg_tdm_stream *ts, 396 + unsigned int fmt) 397 + { 398 + int ret = 0; 399 + 400 + if (fmt & SND_SOC_DAIFMT_CONT) { 401 + /* Clock are already enabled - skipping */ 402 + if (ts->clk_enabled) 403 + return 0; 404 + 405 + ret = clk_prepare_enable(ts->iface->mclk); 406 + if (ret) 407 + return ret; 408 + 409 + ret = clk_prepare_enable(ts->iface->sclk); 410 + if (ret) 411 + goto err_sclk; 412 + 413 + ret = clk_prepare_enable(ts->iface->lrclk); 414 + if (ret) 415 + goto err_lrclk; 416 + 417 + ts->clk_enabled = true; 418 + return 0; 419 + } 420 + 421 + /* Clocks are already disabled - skipping */ 422 + if (!ts->clk_enabled) 423 + return 0; 424 + 425 + clk_disable_unprepare(ts->iface->lrclk); 426 + err_lrclk: 427 + clk_disable_unprepare(ts->iface->sclk); 428 + err_sclk: 429 + clk_disable_unprepare(ts->iface->mclk); 430 + ts->clk_enabled = false; 431 + return ret; 432 + } 433 + EXPORT_SYMBOL_GPL(axg_tdm_stream_set_cont_clocks); 434 + 395 435 MODULE_DESCRIPTION("Amlogic AXG TDM formatter driver"); 396 436 MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>"); 397 437 MODULE_LICENSE("GPL v2");
+28 -10
sound/soc/meson/axg-tdm-interface.c
··· 309 309 struct snd_soc_dai *dai) 310 310 { 311 311 struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai); 312 + struct axg_tdm_stream *ts = snd_soc_dai_get_dma_data(dai, substream); 312 313 int ret; 313 314 314 315 switch (iface->fmt & SND_SOC_DAIFMT_FORMAT_MASK) { ··· 347 346 return ret; 348 347 } 349 348 350 - return 0; 349 + ret = axg_tdm_stream_set_cont_clocks(ts, iface->fmt); 350 + if (ret) 351 + dev_err(dai->dev, "failed to apply continuous clock setting\n"); 352 + 353 + return ret; 351 354 } 352 355 353 356 static int axg_tdm_iface_hw_free(struct snd_pcm_substream *substream, ··· 359 354 { 360 355 struct axg_tdm_stream *ts = snd_soc_dai_get_dma_data(dai, substream); 361 356 362 - /* Stop all attached formatters */ 363 - axg_tdm_stream_stop(ts); 364 - 365 - return 0; 357 + return axg_tdm_stream_set_cont_clocks(ts, 0); 366 358 } 367 359 368 - static int axg_tdm_iface_prepare(struct snd_pcm_substream *substream, 360 + static int axg_tdm_iface_trigger(struct snd_pcm_substream *substream, 361 + int cmd, 369 362 struct snd_soc_dai *dai) 370 363 { 371 - struct axg_tdm_stream *ts = snd_soc_dai_get_dma_data(dai, substream); 364 + struct axg_tdm_stream *ts = 365 + snd_soc_dai_get_dma_data(dai, substream); 372 366 373 - /* Force all attached formatters to update */ 374 - return axg_tdm_stream_reset(ts); 367 + switch (cmd) { 368 + case SNDRV_PCM_TRIGGER_START: 369 + case SNDRV_PCM_TRIGGER_RESUME: 370 + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 371 + axg_tdm_stream_start(ts); 372 + break; 373 + case SNDRV_PCM_TRIGGER_SUSPEND: 374 + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 375 + case SNDRV_PCM_TRIGGER_STOP: 376 + axg_tdm_stream_stop(ts); 377 + break; 378 + default: 379 + return -EINVAL; 380 + } 381 + 382 + return 0; 375 383 } 376 384 377 385 static int axg_tdm_iface_remove_dai(struct snd_soc_dai *dai) ··· 430 412 .set_fmt = axg_tdm_iface_set_fmt, 431 413 .startup = axg_tdm_iface_startup, 432 414 .hw_params = axg_tdm_iface_hw_params, 433 - .prepare = axg_tdm_iface_prepare, 434 415 .hw_free = axg_tdm_iface_hw_free, 416 + .trigger = axg_tdm_iface_trigger, 435 417 }; 436 418 437 419 /* TDM Backend DAIs */
+5
sound/soc/meson/axg-tdm.h
··· 58 58 unsigned int physical_width; 59 59 u32 *mask; 60 60 bool ready; 61 + 62 + /* For continuous clock tracking */ 63 + bool clk_enabled; 61 64 }; 62 65 63 66 struct axg_tdm_stream *axg_tdm_stream_alloc(struct axg_tdm_iface *iface); 64 67 void axg_tdm_stream_free(struct axg_tdm_stream *ts); 65 68 int axg_tdm_stream_start(struct axg_tdm_stream *ts); 66 69 void axg_tdm_stream_stop(struct axg_tdm_stream *ts); 70 + int axg_tdm_stream_set_cont_clocks(struct axg_tdm_stream *ts, 71 + unsigned int fmt); 67 72 68 73 static inline int axg_tdm_stream_reset(struct axg_tdm_stream *ts) 69 74 {
+3 -1
sound/soc/sof/core.c
··· 350 350 } 351 351 352 352 ret = sof_select_ipc_and_paths(sdev); 353 - if (!ret && plat_data->ipc_type != base_profile->ipc_type) { 353 + if (ret) { 354 + goto err_machine_check; 355 + } else if (plat_data->ipc_type != base_profile->ipc_type) { 354 356 /* IPC type changed, re-initialize the ops */ 355 357 sof_ops_free(sdev); 356 358
+18
sound/soc/sof/debug.c
··· 330 330 331 331 int snd_sof_dbg_init(struct snd_sof_dev *sdev) 332 332 { 333 + struct snd_sof_pdata *plat_data = sdev->pdata; 333 334 struct snd_sof_dsp_ops *ops = sof_ops(sdev); 334 335 const struct snd_sof_debugfs_map *map; 336 + struct dentry *fw_profile; 335 337 int i; 336 338 int err; 337 339 338 340 /* use "sof" as top level debugFS dir */ 339 341 sdev->debugfs_root = debugfs_create_dir("sof", NULL); 342 + 343 + /* expose firmware/topology prefix/names for test purposes */ 344 + fw_profile = debugfs_create_dir("fw_profile", sdev->debugfs_root); 345 + 346 + debugfs_create_str("fw_path", 0444, fw_profile, 347 + (char **)&plat_data->fw_filename_prefix); 348 + debugfs_create_str("fw_lib_path", 0444, fw_profile, 349 + (char **)&plat_data->fw_lib_prefix); 350 + debugfs_create_str("tplg_path", 0444, fw_profile, 351 + (char **)&plat_data->tplg_filename_prefix); 352 + debugfs_create_str("fw_name", 0444, fw_profile, 353 + (char **)&plat_data->fw_filename); 354 + debugfs_create_str("tplg_name", 0444, fw_profile, 355 + (char **)&plat_data->tplg_filename); 356 + debugfs_create_u32("ipc_type", 0444, fw_profile, 357 + (u32 *)&plat_data->ipc_type); 340 358 341 359 /* init dfsentry list */ 342 360 INIT_LIST_HEAD(&sdev->dfsentry_list);
+3
sound/soc/sof/intel/pci-lnl.c
··· 35 35 .default_fw_path = { 36 36 [SOF_IPC_TYPE_4] = "intel/sof-ipc4/lnl", 37 37 }, 38 + .default_lib_path = { 39 + [SOF_IPC_TYPE_4] = "intel/sof-ipc4-lib/lnl", 40 + }, 38 41 .default_tplg_path = { 39 42 [SOF_IPC_TYPE_4] = "intel/sof-ipc4-tplg", 40 43 },
+1
sound/soc/sof/ipc3-pcm.c
··· 434 434 .trigger = sof_ipc3_pcm_trigger, 435 435 .dai_link_fixup = sof_ipc3_pcm_dai_link_fixup, 436 436 .reset_hw_params_during_stop = true, 437 + .d0i3_supported_in_s0ix = true, 437 438 };
+82 -39
sound/soc/sof/ipc4-pcm.c
··· 37 37 snd_pcm_sframes_t delay; 38 38 }; 39 39 40 + /** 41 + * struct sof_ipc4_pcm_stream_priv - IPC4 specific private data 42 + * @time_info: pointer to time info struct if it is supported, otherwise NULL 43 + * @chain_dma_allocated: indicates the ChainDMA allocation state 44 + */ 45 + struct sof_ipc4_pcm_stream_priv { 46 + struct sof_ipc4_timestamp_info *time_info; 47 + 48 + bool chain_dma_allocated; 49 + }; 50 + 51 + static inline struct sof_ipc4_timestamp_info * 52 + sof_ipc4_sps_to_time_info(struct snd_sof_pcm_stream *sps) 53 + { 54 + struct sof_ipc4_pcm_stream_priv *stream_priv = sps->private; 55 + 56 + return stream_priv->time_info; 57 + } 58 + 40 59 static int sof_ipc4_set_multi_pipeline_state(struct snd_sof_dev *sdev, u32 state, 41 60 struct ipc4_pipeline_set_state_data *trigger_list) 42 61 { ··· 272 253 */ 273 254 274 255 static int sof_ipc4_chain_dma_trigger(struct snd_sof_dev *sdev, 275 - int direction, 256 + struct snd_sof_pcm *spcm, int direction, 276 257 struct snd_sof_pcm_stream_pipeline_list *pipeline_list, 277 258 int state, int cmd) 278 259 { 279 260 struct sof_ipc4_fw_data *ipc4_data = sdev->private; 261 + struct sof_ipc4_pcm_stream_priv *stream_priv; 280 262 bool allocate, enable, set_fifo_size; 281 263 struct sof_ipc4_msg msg = {{ 0 }}; 282 - int i; 264 + int ret, i; 265 + 266 + stream_priv = spcm->stream[direction].private; 283 267 284 268 switch (state) { 285 269 case SOF_IPC4_PIPE_RUNNING: /* Allocate and start chained dma */ ··· 303 281 set_fifo_size = false; 304 282 break; 305 283 case SOF_IPC4_PIPE_RESET: /* Disable and free chained DMA. */ 284 + 285 + /* ChainDMA can only be reset if it has been allocated */ 286 + if (!stream_priv->chain_dma_allocated) 287 + return 0; 288 + 306 289 allocate = false; 307 290 enable = false; 308 291 set_fifo_size = false; ··· 365 338 if (enable) 366 339 msg.primary |= SOF_IPC4_GLB_CHAIN_DMA_ENABLE_MASK; 367 340 368 - return sof_ipc_tx_message_no_reply(sdev->ipc, &msg, 0); 341 + ret = sof_ipc_tx_message_no_reply(sdev->ipc, &msg, 0); 342 + /* Update the ChainDMA allocation state */ 343 + if (!ret) 344 + stream_priv->chain_dma_allocated = allocate; 345 + 346 + return ret; 369 347 } 370 348 371 349 static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component, ··· 410 378 * trigger function that handles the rest for the substream. 411 379 */ 412 380 if (pipeline->use_chain_dma) 413 - return sof_ipc4_chain_dma_trigger(sdev, substream->stream, 381 + return sof_ipc4_chain_dma_trigger(sdev, spcm, substream->stream, 414 382 pipeline_list, state, cmd); 415 383 416 384 /* allocate memory for the pipeline data */ ··· 484 452 * Invalidate the stream_start_offset to make sure that it is 485 453 * going to be updated if the stream resumes 486 454 */ 487 - time_info = spcm->stream[substream->stream].private; 455 + time_info = sof_ipc4_sps_to_time_info(&spcm->stream[substream->stream]); 488 456 if (time_info) 489 457 time_info->stream_start_offset = SOF_IPC4_INVALID_STREAM_POSITION; 490 458 ··· 738 706 static void sof_ipc4_pcm_free(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm) 739 707 { 740 708 struct snd_sof_pcm_stream_pipeline_list *pipeline_list; 709 + struct sof_ipc4_pcm_stream_priv *stream_priv; 741 710 int stream; 742 711 743 712 for_each_pcm_streams(stream) { 744 713 pipeline_list = &spcm->stream[stream].pipeline_list; 745 714 kfree(pipeline_list->pipelines); 746 715 pipeline_list->pipelines = NULL; 716 + 717 + stream_priv = spcm->stream[stream].private; 718 + kfree(stream_priv->time_info); 747 719 kfree(spcm->stream[stream].private); 748 720 spcm->stream[stream].private = NULL; 749 721 } ··· 757 721 { 758 722 struct snd_sof_pcm_stream_pipeline_list *pipeline_list; 759 723 struct sof_ipc4_fw_data *ipc4_data = sdev->private; 760 - struct sof_ipc4_timestamp_info *stream_info; 724 + struct sof_ipc4_pcm_stream_priv *stream_priv; 725 + struct sof_ipc4_timestamp_info *time_info; 761 726 bool support_info = true; 762 727 u32 abi_version; 763 728 u32 abi_offset; ··· 786 749 return -ENOMEM; 787 750 } 788 751 789 - if (!support_info) 790 - continue; 791 - 792 - stream_info = kzalloc(sizeof(*stream_info), GFP_KERNEL); 793 - if (!stream_info) { 752 + stream_priv = kzalloc(sizeof(*stream_priv), GFP_KERNEL); 753 + if (!stream_priv) { 794 754 sof_ipc4_pcm_free(sdev, spcm); 795 755 return -ENOMEM; 796 756 } 797 757 798 - spcm->stream[stream].private = stream_info; 758 + spcm->stream[stream].private = stream_priv; 759 + 760 + if (!support_info) 761 + continue; 762 + 763 + time_info = kzalloc(sizeof(*time_info), GFP_KERNEL); 764 + if (!time_info) { 765 + sof_ipc4_pcm_free(sdev, spcm); 766 + return -ENOMEM; 767 + } 768 + 769 + stream_priv->time_info = time_info; 799 770 } 800 771 801 772 return 0; 802 773 } 803 774 804 - static void sof_ipc4_build_time_info(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *spcm) 775 + static void sof_ipc4_build_time_info(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *sps) 805 776 { 806 777 struct sof_ipc4_copier *host_copier = NULL; 807 778 struct sof_ipc4_copier *dai_copier = NULL; 808 779 struct sof_ipc4_llp_reading_slot llp_slot; 809 - struct sof_ipc4_timestamp_info *info; 780 + struct sof_ipc4_timestamp_info *time_info; 810 781 struct snd_soc_dapm_widget *widget; 811 782 struct snd_sof_dai *dai; 812 783 int i; 813 784 814 785 /* find host & dai to locate info in memory window */ 815 - for_each_dapm_widgets(spcm->list, i, widget) { 786 + for_each_dapm_widgets(sps->list, i, widget) { 816 787 struct snd_sof_widget *swidget = widget->dobj.private; 817 788 818 789 if (!swidget) ··· 840 795 return; 841 796 } 842 797 843 - info = spcm->private; 844 - info->host_copier = host_copier; 845 - info->dai_copier = dai_copier; 846 - info->llp_offset = offsetof(struct sof_ipc4_fw_registers, llp_gpdma_reading_slots) + 847 - sdev->fw_info_box.offset; 798 + time_info = sof_ipc4_sps_to_time_info(sps); 799 + time_info->host_copier = host_copier; 800 + time_info->dai_copier = dai_copier; 801 + time_info->llp_offset = offsetof(struct sof_ipc4_fw_registers, 802 + llp_gpdma_reading_slots) + sdev->fw_info_box.offset; 848 803 849 804 /* find llp slot used by current dai */ 850 805 for (i = 0; i < SOF_IPC4_MAX_LLP_GPDMA_READING_SLOTS; i++) { 851 - sof_mailbox_read(sdev, info->llp_offset, &llp_slot, sizeof(llp_slot)); 806 + sof_mailbox_read(sdev, time_info->llp_offset, &llp_slot, sizeof(llp_slot)); 852 807 if (llp_slot.node_id == dai_copier->data.gtw_cfg.node_id) 853 808 break; 854 809 855 - info->llp_offset += sizeof(llp_slot); 810 + time_info->llp_offset += sizeof(llp_slot); 856 811 } 857 812 858 813 if (i < SOF_IPC4_MAX_LLP_GPDMA_READING_SLOTS) 859 814 return; 860 815 861 816 /* if no llp gpdma slot is used, check aggregated sdw slot */ 862 - info->llp_offset = offsetof(struct sof_ipc4_fw_registers, llp_sndw_reading_slots) + 863 - sdev->fw_info_box.offset; 817 + time_info->llp_offset = offsetof(struct sof_ipc4_fw_registers, 818 + llp_sndw_reading_slots) + sdev->fw_info_box.offset; 864 819 for (i = 0; i < SOF_IPC4_MAX_LLP_SNDW_READING_SLOTS; i++) { 865 - sof_mailbox_read(sdev, info->llp_offset, &llp_slot, sizeof(llp_slot)); 820 + sof_mailbox_read(sdev, time_info->llp_offset, &llp_slot, sizeof(llp_slot)); 866 821 if (llp_slot.node_id == dai_copier->data.gtw_cfg.node_id) 867 822 break; 868 823 869 - info->llp_offset += sizeof(llp_slot); 824 + time_info->llp_offset += sizeof(llp_slot); 870 825 } 871 826 872 827 if (i < SOF_IPC4_MAX_LLP_SNDW_READING_SLOTS) 873 828 return; 874 829 875 830 /* check EVAD slot */ 876 - info->llp_offset = offsetof(struct sof_ipc4_fw_registers, llp_evad_reading_slot) + 877 - sdev->fw_info_box.offset; 878 - sof_mailbox_read(sdev, info->llp_offset, &llp_slot, sizeof(llp_slot)); 831 + time_info->llp_offset = offsetof(struct sof_ipc4_fw_registers, 832 + llp_evad_reading_slot) + sdev->fw_info_box.offset; 833 + sof_mailbox_read(sdev, time_info->llp_offset, &llp_slot, sizeof(llp_slot)); 879 834 if (llp_slot.node_id != dai_copier->data.gtw_cfg.node_id) 880 - info->llp_offset = 0; 835 + time_info->llp_offset = 0; 881 836 } 882 837 883 838 static int sof_ipc4_pcm_hw_params(struct snd_soc_component *component, ··· 894 849 if (!spcm) 895 850 return -EINVAL; 896 851 897 - time_info = spcm->stream[substream->stream].private; 852 + time_info = sof_ipc4_sps_to_time_info(&spcm->stream[substream->stream]); 898 853 /* delay calculation is not supported by current fw_reg ABI */ 899 854 if (!time_info) 900 855 return 0; ··· 909 864 910 865 static int sof_ipc4_get_stream_start_offset(struct snd_sof_dev *sdev, 911 866 struct snd_pcm_substream *substream, 912 - struct snd_sof_pcm_stream *stream, 867 + struct snd_sof_pcm_stream *sps, 913 868 struct sof_ipc4_timestamp_info *time_info) 914 869 { 915 870 struct sof_ipc4_copier *host_copier = time_info->host_copier; ··· 963 918 struct sof_ipc4_timestamp_info *time_info; 964 919 struct sof_ipc4_llp_reading_slot llp; 965 920 snd_pcm_uframes_t head_cnt, tail_cnt; 966 - struct snd_sof_pcm_stream *stream; 921 + struct snd_sof_pcm_stream *sps; 967 922 u64 dai_cnt, host_cnt, host_ptr; 968 923 struct snd_sof_pcm *spcm; 969 924 int ret; ··· 972 927 if (!spcm) 973 928 return -EOPNOTSUPP; 974 929 975 - stream = &spcm->stream[substream->stream]; 976 - time_info = stream->private; 930 + sps = &spcm->stream[substream->stream]; 931 + time_info = sof_ipc4_sps_to_time_info(sps); 977 932 if (!time_info) 978 933 return -EOPNOTSUPP; 979 934 ··· 983 938 * the statistics is complete. And it will not change after the first initiailization. 984 939 */ 985 940 if (time_info->stream_start_offset == SOF_IPC4_INVALID_STREAM_POSITION) { 986 - ret = sof_ipc4_get_stream_start_offset(sdev, substream, stream, time_info); 941 + ret = sof_ipc4_get_stream_start_offset(sdev, substream, sps, time_info); 987 942 if (ret < 0) 988 943 return -EOPNOTSUPP; 989 944 } ··· 1075 1030 { 1076 1031 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 1077 1032 struct sof_ipc4_timestamp_info *time_info; 1078 - struct snd_sof_pcm_stream *stream; 1079 1033 struct snd_sof_pcm *spcm; 1080 1034 1081 1035 spcm = snd_sof_find_spcm_dai(component, rtd); 1082 1036 if (!spcm) 1083 1037 return 0; 1084 1038 1085 - stream = &spcm->stream[substream->stream]; 1086 - time_info = stream->private; 1039 + time_info = sof_ipc4_sps_to_time_info(&spcm->stream[substream->stream]); 1087 1040 /* 1088 1041 * Report the stored delay value calculated in the pointer callback. 1089 1042 * In the unlikely event that the calculation was skipped/aborted, the
+6 -7
sound/soc/sof/pcm.c
··· 325 325 ipc_first = true; 326 326 break; 327 327 case SNDRV_PCM_TRIGGER_SUSPEND: 328 - if (sdev->system_suspend_target == SOF_SUSPEND_S0IX && 328 + /* 329 + * If DSP D0I3 is allowed during S0iX, set the suspend_ignored flag for 330 + * D0I3-compatible streams to keep the firmware pipeline running 331 + */ 332 + if (pcm_ops && pcm_ops->d0i3_supported_in_s0ix && 333 + sdev->system_suspend_target == SOF_SUSPEND_S0IX && 329 334 spcm->stream[substream->stream].d0i3_compatible) { 330 - /* 331 - * trap the event, not sending trigger stop to 332 - * prevent the FW pipelines from being stopped, 333 - * and mark the flag to ignore the upcoming DAPM 334 - * PM events. 335 - */ 336 335 spcm->stream[substream->stream].suspend_ignored = true; 337 336 return 0; 338 337 }
+2
sound/soc/sof/sof-audio.h
··· 116 116 * triggers. The FW keeps the host DMA running in this case and 117 117 * therefore the host must do the same and should stop the DMA during 118 118 * hw_free. 119 + * @d0i3_supported_in_s0ix: Allow DSP D0I3 during S0iX 119 120 */ 120 121 struct sof_ipc_pcm_ops { 121 122 int (*hw_params)(struct snd_soc_component *component, struct snd_pcm_substream *substream, ··· 136 135 bool reset_hw_params_during_stop; 137 136 bool ipc_first_on_start; 138 137 bool platform_stop_during_hw_free; 138 + bool d0i3_supported_in_s0ix; 139 139 }; 140 140 141 141 /**
+3 -4
sound/soc/tegra/tegra186_dspk.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 + // SPDX-FileCopyrightText: Copyright (c) 2020-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 2 3 // 3 4 // tegra186_dspk.c - Tegra186 DSPK driver 4 - // 5 - // Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved. 6 5 7 6 #include <linux/clk.h> 8 7 #include <linux/device.h> ··· 240 241 return -EINVAL; 241 242 } 242 243 243 - cif_conf.client_bits = TEGRA_ACIF_BITS_24; 244 - 245 244 switch (params_format(params)) { 246 245 case SNDRV_PCM_FORMAT_S16_LE: 247 246 cif_conf.audio_bits = TEGRA_ACIF_BITS_16; 247 + cif_conf.client_bits = TEGRA_ACIF_BITS_16; 248 248 break; 249 249 case SNDRV_PCM_FORMAT_S32_LE: 250 250 cif_conf.audio_bits = TEGRA_ACIF_BITS_32; 251 + cif_conf.client_bits = TEGRA_ACIF_BITS_24; 251 252 break; 252 253 default: 253 254 dev_err(dev, "unsupported format!\n");
+6 -6
sound/soc/ti/davinci-mcasp.c
··· 2417 2417 2418 2418 mcasp_reparent_fck(pdev); 2419 2419 2420 - ret = devm_snd_soc_register_component(&pdev->dev, &davinci_mcasp_component, 2421 - &davinci_mcasp_dai[mcasp->op_mode], 1); 2422 - 2423 - if (ret != 0) 2424 - goto err; 2425 - 2426 2420 ret = davinci_mcasp_get_dma_type(mcasp); 2427 2421 switch (ret) { 2428 2422 case PCM_EDMA: ··· 2442 2448 dev_err(&pdev->dev, "register PCM failed: %d\n", ret); 2443 2449 goto err; 2444 2450 } 2451 + 2452 + ret = devm_snd_soc_register_component(&pdev->dev, &davinci_mcasp_component, 2453 + &davinci_mcasp_dai[mcasp->op_mode], 1); 2454 + 2455 + if (ret != 0) 2456 + goto err; 2445 2457 2446 2458 no_audio: 2447 2459 ret = davinci_mcasp_init_gpiochip(mcasp);
+7
tools/testing/cxl/test/cxl.c
··· 1001 1001 struct cxl_memdev *cxlmd = to_cxl_memdev(port->uport_dev); 1002 1002 struct cxl_dev_state *cxlds = cxlmd->cxlds; 1003 1003 struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlds); 1004 + struct access_coordinate ep_c[ACCESS_COORDINATE_MAX]; 1004 1005 struct range pmem_range = { 1005 1006 .start = cxlds->pmem_res.start, 1006 1007 .end = cxlds->pmem_res.end, ··· 1021 1020 dpa_perf_setup(port, &pmem_range, &mds->pmem_perf); 1022 1021 1023 1022 cxl_memdev_update_perf(cxlmd); 1023 + 1024 + /* 1025 + * This function is here to only test the topology iterator. It serves 1026 + * no other purpose. 1027 + */ 1028 + cxl_endpoint_get_perf_coordinates(port, ep_c); 1024 1029 } 1025 1030 1026 1031 static struct cxl_mock_ops cxl_mock_ops = {
+3 -11
tools/testing/selftests/net/test_bridge_neigh_suppress.sh
··· 154 154 setup_topo_ns $ns 155 155 done 156 156 157 - ip link add name veth0 type veth peer name veth1 158 - ip link set dev veth0 netns $h1 name eth0 159 - ip link set dev veth1 netns $sw1 name swp1 160 - 161 - ip link add name veth0 type veth peer name veth1 162 - ip link set dev veth0 netns $sw1 name veth0 163 - ip link set dev veth1 netns $sw2 name veth0 164 - 165 - ip link add name veth0 type veth peer name veth1 166 - ip link set dev veth0 netns $h2 name eth0 167 - ip link set dev veth1 netns $sw2 name swp1 157 + ip -n $h1 link add name eth0 type veth peer name swp1 netns $sw1 158 + ip -n $sw1 link add name veth0 type veth peer name veth0 netns $sw2 159 + ip -n $h2 link add name eth0 type veth peer name swp1 netns $sw2 168 160 } 169 161 170 162 setup_host_common()