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

Configure Feed

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

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

Cross-merge networking fixes after downstream PR.

Adjacent changes:

drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
23c93c3b6275 ("bnxt_en: do not map packet buffers twice")
6d1add95536b ("bnxt_en: Modify TX ring indexing logic.")

tools/testing/selftests/net/Makefile
2258b666482d ("selftests: add vlan hw filter tests")
a0bc96c0cd6e ("selftests: net: verify fq per-band packet limit")

Signed-off-by: Paolo Abeni <pabeni@redhat.com>

+2283 -2239
+4
.mailmap
··· 191 191 Gao Xiang <xiang@kernel.org> <hsiangkao@aol.com> 192 192 Gao Xiang <xiang@kernel.org> <hsiangkao@linux.alibaba.com> 193 193 Gao Xiang <xiang@kernel.org> <hsiangkao@redhat.com> 194 + Geliang Tang <geliang.tang@linux.dev> <geliang.tang@suse.com> 195 + Geliang Tang <geliang.tang@linux.dev> <geliangtang@xiaomi.com> 196 + Geliang Tang <geliang.tang@linux.dev> <geliangtang@gmail.com> 197 + Geliang Tang <geliang.tang@linux.dev> <geliangtang@163.com> 194 198 Georgi Djakov <djakov@kernel.org> <georgi.djakov@linaro.org> 195 199 Gerald Schaefer <gerald.schaefer@linux.ibm.com> <geraldsc@de.ibm.com> 196 200 Gerald Schaefer <gerald.schaefer@linux.ibm.com> <gerald.schaefer@de.ibm.com>
+2
Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
··· 42 42 - lg,acx467akm-7 43 43 # LG Corporation 7" WXGA TFT LCD panel 44 44 - lg,ld070wx3-sl01 45 + # LG Corporation 5" HD TFT LCD panel 46 + - lg,lh500wx1-sd03 45 47 # One Stop Displays OSD101T2587-53TS 10.1" 1920x1200 panel 46 48 - osddisplays,osd101t2587-53ts 47 49 # Panasonic 10" WUXGA TFT LCD panel
-2
Documentation/devicetree/bindings/display/panel/panel-simple.yaml
··· 208 208 - lemaker,bl035-rgb-002 209 209 # LG 7" (800x480 pixels) TFT LCD panel 210 210 - lg,lb070wv8 211 - # LG Corporation 5" HD TFT LCD panel 212 - - lg,lh500wx1-sd03 213 211 # LG LP079QX1-SP0V 7.9" (1536x2048 pixels) TFT LCD panel 214 212 - lg,lp079qx1-sp0v 215 213 # LG 9.7" (2048x1536 pixels) TFT LCD panel
+3 -2
MAINTAINERS
··· 6050 6050 M: dm-devel@lists.linux.dev 6051 6051 L: dm-devel@lists.linux.dev 6052 6052 S: Maintained 6053 - W: http://sources.redhat.com/dm 6054 6053 Q: http://patchwork.kernel.org/project/dm-devel/list/ 6055 6054 T: git git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git 6056 - T: quilt http://people.redhat.com/agk/patches/linux/editing/ 6057 6055 F: Documentation/admin-guide/device-mapper/ 6058 6056 F: drivers/md/Kconfig 6059 6057 F: drivers/md/Makefile ··· 9532 9534 HISILICON NETWORK SUBSYSTEM 3 DRIVER (HNS3) 9533 9535 M: Yisen Zhuang <yisen.zhuang@huawei.com> 9534 9536 M: Salil Mehta <salil.mehta@huawei.com> 9537 + M: Jijie Shao <shaojijie@huawei.com> 9535 9538 L: netdev@vger.kernel.org 9536 9539 S: Maintained 9537 9540 W: http://www.hisilicon.com ··· 12200 12201 M: Michael Ellerman <mpe@ellerman.id.au> 12201 12202 R: Nicholas Piggin <npiggin@gmail.com> 12202 12203 R: Christophe Leroy <christophe.leroy@csgroup.eu> 12204 + R: Aneesh Kumar K.V <aneesh.kumar@kernel.org> 12205 + R: Naveen N. Rao <naveen.n.rao@linux.ibm.com> 12203 12206 L: linuxppc-dev@lists.ozlabs.org 12204 12207 S: Supported 12205 12208 W: https://github.com/linuxppc/wiki/wiki
+1 -1
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 7 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc5 5 + EXTRAVERSION = -rc6 6 6 NAME = Hurr durr I'ma ninja sloth 7 7 8 8 # *DOCUMENTATION*
-5
arch/arc/Kconfig
··· 49 49 select OF 50 50 select OF_EARLY_FLATTREE 51 51 select PCI_SYSCALL if PCI 52 - select PERF_USE_VMALLOC if ARC_CACHE_VIPT_ALIASING 53 52 select HAVE_ARCH_JUMP_LABEL if ISA_ARCV2 && !CPU_ENDIAN_BE32 54 53 select TRACE_IRQFLAGS_SUPPORT 55 54 ··· 230 231 TLB entries have a per-page Cache Enable Bit. 231 232 Note that Global I/D ENABLE + Per Page DISABLE works but corollary 232 233 Global DISABLE + Per Page ENABLE won't work 233 - 234 - config ARC_CACHE_VIPT_ALIASING 235 - bool "Support VIPT Aliasing D$" 236 - depends on ARC_HAS_DCACHE && ISA_ARCOMPACT 237 234 238 235 endif #ARC_CACHE 239 236
-43
arch/arc/include/asm/cacheflush.h
··· 44 44 45 45 #define flush_cache_dup_mm(mm) /* called on fork (VIVT only) */ 46 46 47 - #ifndef CONFIG_ARC_CACHE_VIPT_ALIASING 48 - 49 47 #define flush_cache_mm(mm) /* called on munmap/exit */ 50 48 #define flush_cache_range(mm, u_vstart, u_vend) 51 49 #define flush_cache_page(vma, u_vaddr, pfn) /* PF handling/COW-break */ 52 - 53 - #else /* VIPT aliasing dcache */ 54 - 55 - /* To clear out stale userspace mappings */ 56 - void flush_cache_mm(struct mm_struct *mm); 57 - void flush_cache_range(struct vm_area_struct *vma, 58 - unsigned long start,unsigned long end); 59 - void flush_cache_page(struct vm_area_struct *vma, 60 - unsigned long user_addr, unsigned long page); 61 - 62 - /* 63 - * To make sure that userspace mapping is flushed to memory before 64 - * get_user_pages() uses a kernel mapping to access the page 65 - */ 66 - #define ARCH_HAS_FLUSH_ANON_PAGE 67 - void flush_anon_page(struct vm_area_struct *vma, 68 - struct page *page, unsigned long u_vaddr); 69 - 70 - #endif /* CONFIG_ARC_CACHE_VIPT_ALIASING */ 71 50 72 51 /* 73 52 * A new pagecache page has PG_arch_1 clear - thus dcache dirty by default ··· 54 75 * to record that they dirtied the dcache 55 76 */ 56 77 #define PG_dc_clean PG_arch_1 57 - 58 - #define CACHE_COLORS_NUM 4 59 - #define CACHE_COLORS_MSK (CACHE_COLORS_NUM - 1) 60 - #define CACHE_COLOR(addr) (((unsigned long)(addr) >> (PAGE_SHIFT)) & CACHE_COLORS_MSK) 61 - 62 - /* 63 - * Simple wrapper over config option 64 - * Bootup code ensures that hardware matches kernel configuration 65 - */ 66 - static inline int cache_is_vipt_aliasing(void) 67 - { 68 - return IS_ENABLED(CONFIG_ARC_CACHE_VIPT_ALIASING); 69 - } 70 - 71 - /* 72 - * checks if two addresses (after page aligning) index into same cache set 73 - */ 74 - #define addr_not_cache_congruent(addr1, addr2) \ 75 - ({ \ 76 - cache_is_vipt_aliasing() ? \ 77 - (CACHE_COLOR(addr1) != CACHE_COLOR(addr2)) : 0; \ 78 - }) 79 78 80 79 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 81 80 do { \
+32
arch/arc/include/asm/entry-arcv2.h
··· 291 291 /* M = 8-1 N = 8 */ 292 292 .endm 293 293 294 + .macro SAVE_ABI_CALLEE_REGS 295 + push r13 296 + push r14 297 + push r15 298 + push r16 299 + push r17 300 + push r18 301 + push r19 302 + push r20 303 + push r21 304 + push r22 305 + push r23 306 + push r24 307 + push r25 308 + .endm 309 + 310 + .macro RESTORE_ABI_CALLEE_REGS 311 + pop r25 312 + pop r24 313 + pop r23 314 + pop r22 315 + pop r21 316 + pop r20 317 + pop r19 318 + pop r18 319 + pop r17 320 + pop r16 321 + pop r15 322 + pop r14 323 + pop r13 324 + .endm 325 + 294 326 #endif
+86 -1
arch/arc/include/asm/entry-compact.h
··· 33 33 #include <asm/irqflags-compact.h> 34 34 #include <asm/thread_info.h> /* For THREAD_SIZE */ 35 35 36 + /* Note on the LD/ST addr modes with addr reg wback 37 + * 38 + * LD.a same as LD.aw 39 + * 40 + * LD.a reg1, [reg2, x] => Pre Incr 41 + * Eff Addr for load = [reg2 + x] 42 + * 43 + * LD.ab reg1, [reg2, x] => Post Incr 44 + * Eff Addr for load = [reg2] 45 + */ 46 + 47 + .macro PUSHAX aux 48 + lr r9, [\aux] 49 + push r9 50 + .endm 51 + 52 + .macro POPAX aux 53 + pop r9 54 + sr r9, [\aux] 55 + .endm 56 + 57 + .macro SAVE_R0_TO_R12 58 + push r0 59 + push r1 60 + push r2 61 + push r3 62 + push r4 63 + push r5 64 + push r6 65 + push r7 66 + push r8 67 + push r9 68 + push r10 69 + push r11 70 + push r12 71 + .endm 72 + 73 + .macro RESTORE_R12_TO_R0 74 + pop r12 75 + pop r11 76 + pop r10 77 + pop r9 78 + pop r8 79 + pop r7 80 + pop r6 81 + pop r5 82 + pop r4 83 + pop r3 84 + pop r2 85 + pop r1 86 + pop r0 87 + .endm 88 + 89 + .macro SAVE_ABI_CALLEE_REGS 90 + push r13 91 + push r14 92 + push r15 93 + push r16 94 + push r17 95 + push r18 96 + push r19 97 + push r20 98 + push r21 99 + push r22 100 + push r23 101 + push r24 102 + push r25 103 + .endm 104 + 105 + .macro RESTORE_ABI_CALLEE_REGS 106 + pop r25 107 + pop r24 108 + pop r23 109 + pop r22 110 + pop r21 111 + pop r20 112 + pop r19 113 + pop r18 114 + pop r17 115 + pop r16 116 + pop r15 117 + pop r14 118 + pop r13 119 + .endm 120 + 36 121 /*-------------------------------------------------------------- 37 122 * Switch to Kernel Mode stack if SP points to User Mode stack 38 123 * ··· 320 235 SWITCH_TO_KERNEL_STK 321 236 322 237 323 - PUSH 0x003\LVL\()abcd /* Dummy ECR */ 238 + st.a 0x003\LVL\()abcd, [sp, -4] /* Dummy ECR */ 324 239 sub sp, sp, 8 /* skip orig_r0 (not needed) 325 240 skip pt_regs->sp, already saved above */ 326 241
+4 -106
arch/arc/include/asm/entry.h
··· 21 21 #include <asm/entry-arcv2.h> 22 22 #endif 23 23 24 - /* Note on the LD/ST addr modes with addr reg wback 25 - * 26 - * LD.a same as LD.aw 27 - * 28 - * LD.a reg1, [reg2, x] => Pre Incr 29 - * Eff Addr for load = [reg2 + x] 30 - * 31 - * LD.ab reg1, [reg2, x] => Post Incr 32 - * Eff Addr for load = [reg2] 33 - */ 34 - 35 - .macro PUSH reg 36 - st.a \reg, [sp, -4] 37 - .endm 38 - 39 - .macro PUSHAX aux 40 - lr r9, [\aux] 41 - PUSH r9 42 - .endm 43 - 44 - .macro POP reg 45 - ld.ab \reg, [sp, 4] 46 - .endm 47 - 48 - .macro POPAX aux 49 - POP r9 50 - sr r9, [\aux] 51 - .endm 52 - 53 - /*-------------------------------------------------------------- 54 - * Helpers to save/restore Scratch Regs: 55 - * used by Interrupt/Exception Prologue/Epilogue 56 - *-------------------------------------------------------------*/ 57 - .macro SAVE_R0_TO_R12 58 - PUSH r0 59 - PUSH r1 60 - PUSH r2 61 - PUSH r3 62 - PUSH r4 63 - PUSH r5 64 - PUSH r6 65 - PUSH r7 66 - PUSH r8 67 - PUSH r9 68 - PUSH r10 69 - PUSH r11 70 - PUSH r12 71 - .endm 72 - 73 - .macro RESTORE_R12_TO_R0 74 - POP r12 75 - POP r11 76 - POP r10 77 - POP r9 78 - POP r8 79 - POP r7 80 - POP r6 81 - POP r5 82 - POP r4 83 - POP r3 84 - POP r2 85 - POP r1 86 - POP r0 87 - 88 - .endm 89 - 90 - /*-------------------------------------------------------------- 91 - * Helpers to save/restore callee-saved regs: 92 - * used by several macros below 93 - *-------------------------------------------------------------*/ 94 - .macro SAVE_R13_TO_R25 95 - PUSH r13 96 - PUSH r14 97 - PUSH r15 98 - PUSH r16 99 - PUSH r17 100 - PUSH r18 101 - PUSH r19 102 - PUSH r20 103 - PUSH r21 104 - PUSH r22 105 - PUSH r23 106 - PUSH r24 107 - PUSH r25 108 - .endm 109 - 110 - .macro RESTORE_R25_TO_R13 111 - POP r25 112 - POP r24 113 - POP r23 114 - POP r22 115 - POP r21 116 - POP r20 117 - POP r19 118 - POP r18 119 - POP r17 120 - POP r16 121 - POP r15 122 - POP r14 123 - POP r13 124 - .endm 125 - 126 24 /* 127 25 * save user mode callee regs as struct callee_regs 128 26 * - needed by fork/do_signal/unaligned-access-emulation. 129 27 */ 130 28 .macro SAVE_CALLEE_SAVED_USER 131 - SAVE_R13_TO_R25 29 + SAVE_ABI_CALLEE_REGS 132 30 .endm 133 31 134 32 /* ··· 34 136 * - could have been changed by ptrace tracer or unaligned-access fixup 35 137 */ 36 138 .macro RESTORE_CALLEE_SAVED_USER 37 - RESTORE_R25_TO_R13 139 + RESTORE_ABI_CALLEE_REGS 38 140 .endm 39 141 40 142 /* 41 143 * save/restore kernel mode callee regs at the time of context switch 42 144 */ 43 145 .macro SAVE_CALLEE_SAVED_KERNEL 44 - SAVE_R13_TO_R25 146 + SAVE_ABI_CALLEE_REGS 45 147 .endm 46 148 47 149 .macro RESTORE_CALLEE_SAVED_KERNEL 48 - RESTORE_R25_TO_R13 150 + RESTORE_ABI_CALLEE_REGS 49 151 .endm 50 152 51 153 /*--------------------------------------------------------------
+7
arch/arc/include/asm/hugepage.h
··· 10 10 #include <linux/types.h> 11 11 #include <asm-generic/pgtable-nopmd.h> 12 12 13 + /* 14 + * Hugetlb definitions. 15 + */ 16 + #define HPAGE_SHIFT PMD_SHIFT 17 + #define HPAGE_SIZE (_AC(1, UL) << HPAGE_SHIFT) 18 + #define HPAGE_MASK (~(HPAGE_SIZE - 1)) 19 + 13 20 static inline pte_t pmd_pte(pmd_t pmd) 14 21 { 15 22 return __pte(pmd_val(pmd));
+8 -6
arch/arc/include/asm/ptrace.h
··· 54 54 ecr_reg ecr; 55 55 }; 56 56 57 + struct callee_regs { 58 + unsigned long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13; 59 + }; 60 + 57 61 #define MAX_REG_OFFSET offsetof(struct pt_regs, ecr) 58 62 59 63 #else ··· 96 92 unsigned long status32; 97 93 }; 98 94 99 - #define MAX_REG_OFFSET offsetof(struct pt_regs, status32) 100 - 101 - #endif 102 - 103 - /* Callee saved registers - need to be saved only when you are scheduled out */ 104 - 105 95 struct callee_regs { 106 96 unsigned long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13; 107 97 }; 98 + 99 + #define MAX_REG_OFFSET offsetof(struct pt_regs, status32) 100 + 101 + #endif 108 102 109 103 #define instruction_pointer(regs) ((regs)->ret) 110 104 #define profile_pc(regs) instruction_pointer(regs)
+1 -3
arch/arc/kernel/setup.c
··· 153 153 { 154 154 int n = 0; 155 155 #ifdef CONFIG_ISA_ARCV2 156 - const char *release, *cpu_nm, *isa_nm = "ARCv2"; 156 + const char *release = "", *cpu_nm = "HS38", *isa_nm = "ARCv2"; 157 157 int dual_issue = 0, dual_enb = 0, mpy_opt, present; 158 158 int bpu_full, bpu_cache, bpu_pred, bpu_ret_stk; 159 159 char mpy_nm[16], lpb_nm[32]; ··· 171 171 * ARCVER 0x54 which introduced AUX MICRO_ARCH_BUILD and subsequent 172 172 * releases only update it. 173 173 */ 174 - 175 - cpu_nm = "HS38"; 176 174 177 175 if (info->arcver > 0x50 && info->arcver <= 0x53) { 178 176 release = arc_hs_rel[info->arcver - 0x51].str;
+3 -3
arch/arc/kernel/signal.c
··· 62 62 unsigned int sigret_magic; 63 63 }; 64 64 65 - static int save_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs) 65 + static int save_arcv2_regs(struct sigcontext __user *mctx, struct pt_regs *regs) 66 66 { 67 67 int err = 0; 68 68 #ifndef CONFIG_ISA_ARCOMPACT ··· 75 75 #else 76 76 v2abi.r58 = v2abi.r59 = 0; 77 77 #endif 78 - err = __copy_to_user(&mctx->v2abi, &v2abi, sizeof(v2abi)); 78 + err = __copy_to_user(&mctx->v2abi, (void const *)&v2abi, sizeof(v2abi)); 79 79 #endif 80 80 return err; 81 81 } 82 82 83 - static int restore_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs) 83 + static int restore_arcv2_regs(struct sigcontext __user *mctx, struct pt_regs *regs) 84 84 { 85 85 int err = 0; 86 86 #ifndef CONFIG_ISA_ARCOMPACT
+6 -130
arch/arc/mm/cache.c
··· 145 145 p_dc->sz_k = 1 << (dbcr.sz - 1); 146 146 147 147 n += scnprintf(buf + n, len - n, 148 - "D-Cache\t\t: %uK, %dway/set, %uB Line, %s%s%s\n", 148 + "D-Cache\t\t: %uK, %dway/set, %uB Line, %s%s\n", 149 149 p_dc->sz_k, assoc, p_dc->line_len, 150 150 vipt ? "VIPT" : "PIPT", 151 - p_dc->colors > 1 ? " aliasing" : "", 152 151 IS_USED_CFG(CONFIG_ARC_HAS_DCACHE)); 153 152 154 153 slc_chk: ··· 702 703 * Exported APIs 703 704 */ 704 705 705 - /* 706 - * Handle cache congruency of kernel and userspace mappings of page when kernel 707 - * writes-to/reads-from 708 - * 709 - * The idea is to defer flushing of kernel mapping after a WRITE, possible if: 710 - * -dcache is NOT aliasing, hence any U/K-mappings of page are congruent 711 - * -U-mapping doesn't exist yet for page (finalised in update_mmu_cache) 712 - * -In SMP, if hardware caches are coherent 713 - * 714 - * There's a corollary case, where kernel READs from a userspace mapped page. 715 - * If the U-mapping is not congruent to K-mapping, former needs flushing. 716 - */ 717 706 void flush_dcache_folio(struct folio *folio) 718 707 { 719 - struct address_space *mapping; 720 - 721 - if (!cache_is_vipt_aliasing()) { 722 - clear_bit(PG_dc_clean, &folio->flags); 723 - return; 724 - } 725 - 726 - /* don't handle anon pages here */ 727 - mapping = folio_flush_mapping(folio); 728 - if (!mapping) 729 - return; 730 - 731 - /* 732 - * pagecache page, file not yet mapped to userspace 733 - * Make a note that K-mapping is dirty 734 - */ 735 - if (!mapping_mapped(mapping)) { 736 - clear_bit(PG_dc_clean, &folio->flags); 737 - } else if (folio_mapped(folio)) { 738 - /* kernel reading from page with U-mapping */ 739 - phys_addr_t paddr = (unsigned long)folio_address(folio); 740 - unsigned long vaddr = folio_pos(folio); 741 - 742 - /* 743 - * vaddr is not actually the virtual address, but is 744 - * congruent to every user mapping. 745 - */ 746 - if (addr_not_cache_congruent(paddr, vaddr)) 747 - __flush_dcache_pages(paddr, vaddr, 748 - folio_nr_pages(folio)); 749 - } 708 + clear_bit(PG_dc_clean, &folio->flags); 709 + return; 750 710 } 751 711 EXPORT_SYMBOL(flush_dcache_folio); 752 712 ··· 879 921 880 922 } 881 923 882 - #ifdef CONFIG_ARC_CACHE_VIPT_ALIASING 883 - 884 - void flush_cache_mm(struct mm_struct *mm) 885 - { 886 - flush_cache_all(); 887 - } 888 - 889 - void flush_cache_page(struct vm_area_struct *vma, unsigned long u_vaddr, 890 - unsigned long pfn) 891 - { 892 - phys_addr_t paddr = pfn << PAGE_SHIFT; 893 - 894 - u_vaddr &= PAGE_MASK; 895 - 896 - __flush_dcache_pages(paddr, u_vaddr, 1); 897 - 898 - if (vma->vm_flags & VM_EXEC) 899 - __inv_icache_pages(paddr, u_vaddr, 1); 900 - } 901 - 902 - void flush_cache_range(struct vm_area_struct *vma, unsigned long start, 903 - unsigned long end) 904 - { 905 - flush_cache_all(); 906 - } 907 - 908 - void flush_anon_page(struct vm_area_struct *vma, struct page *page, 909 - unsigned long u_vaddr) 910 - { 911 - /* TBD: do we really need to clear the kernel mapping */ 912 - __flush_dcache_pages((phys_addr_t)page_address(page), u_vaddr, 1); 913 - __flush_dcache_pages((phys_addr_t)page_address(page), 914 - (phys_addr_t)page_address(page), 1); 915 - 916 - } 917 - 918 - #endif 919 - 920 924 void copy_user_highpage(struct page *to, struct page *from, 921 925 unsigned long u_vaddr, struct vm_area_struct *vma) 922 926 { ··· 886 966 struct folio *dst = page_folio(to); 887 967 void *kfrom = kmap_atomic(from); 888 968 void *kto = kmap_atomic(to); 889 - int clean_src_k_mappings = 0; 890 - 891 - /* 892 - * If SRC page was already mapped in userspace AND it's U-mapping is 893 - * not congruent with K-mapping, sync former to physical page so that 894 - * K-mapping in memcpy below, sees the right data 895 - * 896 - * Note that while @u_vaddr refers to DST page's userspace vaddr, it is 897 - * equally valid for SRC page as well 898 - * 899 - * For !VIPT cache, all of this gets compiled out as 900 - * addr_not_cache_congruent() is 0 901 - */ 902 - if (page_mapcount(from) && addr_not_cache_congruent(kfrom, u_vaddr)) { 903 - __flush_dcache_pages((unsigned long)kfrom, u_vaddr, 1); 904 - clean_src_k_mappings = 1; 905 - } 906 969 907 970 copy_page(kto, kfrom); 908 971 909 - /* 910 - * Mark DST page K-mapping as dirty for a later finalization by 911 - * update_mmu_cache(). Although the finalization could have been done 912 - * here as well (given that both vaddr/paddr are available). 913 - * But update_mmu_cache() already has code to do that for other 914 - * non copied user pages (e.g. read faults which wire in pagecache page 915 - * directly). 916 - */ 917 972 clear_bit(PG_dc_clean, &dst->flags); 918 - 919 - /* 920 - * if SRC was already usermapped and non-congruent to kernel mapping 921 - * sync the kernel mapping back to physical page 922 - */ 923 - if (clean_src_k_mappings) { 924 - __flush_dcache_pages((unsigned long)kfrom, 925 - (unsigned long)kfrom, 1); 926 - } else { 927 - clear_bit(PG_dc_clean, &src->flags); 928 - } 973 + clear_bit(PG_dc_clean, &src->flags); 929 974 930 975 kunmap_atomic(kto); 931 976 kunmap_atomic(kfrom); ··· 1025 1140 dc->line_len, L1_CACHE_BYTES); 1026 1141 1027 1142 /* check for D-Cache aliasing on ARCompact: ARCv2 has PIPT */ 1028 - if (is_isa_arcompact()) { 1029 - int handled = IS_ENABLED(CONFIG_ARC_CACHE_VIPT_ALIASING); 1030 - 1031 - if (dc->colors > 1) { 1032 - if (!handled) 1033 - panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n"); 1034 - if (CACHE_COLORS_NUM != dc->colors) 1035 - panic("CACHE_COLORS_NUM not optimized for config\n"); 1036 - } else if (handled && dc->colors == 1) { 1037 - panic("Disable CONFIG_ARC_CACHE_VIPT_ALIASING\n"); 1038 - } 1143 + if (is_isa_arcompact() && dc->colors > 1) { 1144 + panic("Aliasing VIPT cache not supported\n"); 1039 1145 } 1040 1146 } 1041 1147
+3 -18
arch/arc/mm/mmap.c
··· 14 14 15 15 #include <asm/cacheflush.h> 16 16 17 - #define COLOUR_ALIGN(addr, pgoff) \ 18 - ((((addr) + SHMLBA - 1) & ~(SHMLBA - 1)) + \ 19 - (((pgoff) << PAGE_SHIFT) & (SHMLBA - 1))) 20 - 21 17 /* 22 18 * Ensure that shared mappings are correctly aligned to 23 19 * avoid aliasing issues with VIPT caches. ··· 27 31 { 28 32 struct mm_struct *mm = current->mm; 29 33 struct vm_area_struct *vma; 30 - int do_align = 0; 31 - int aliasing = cache_is_vipt_aliasing(); 32 34 struct vm_unmapped_area_info info; 33 - 34 - /* 35 - * We only need to do colour alignment if D cache aliases. 36 - */ 37 - if (aliasing) 38 - do_align = filp || (flags & MAP_SHARED); 39 35 40 36 /* 41 37 * We enforce the MAP_FIXED case. 42 38 */ 43 39 if (flags & MAP_FIXED) { 44 - if (aliasing && flags & MAP_SHARED && 40 + if (flags & MAP_SHARED && 45 41 (addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1)) 46 42 return -EINVAL; 47 43 return addr; ··· 43 55 return -ENOMEM; 44 56 45 57 if (addr) { 46 - if (do_align) 47 - addr = COLOUR_ALIGN(addr, pgoff); 48 - else 49 - addr = PAGE_ALIGN(addr); 58 + addr = PAGE_ALIGN(addr); 50 59 51 60 vma = find_vma(mm, addr); 52 61 if (TASK_SIZE - len >= addr && ··· 55 70 info.length = len; 56 71 info.low_limit = mm->mmap_base; 57 72 info.high_limit = TASK_SIZE; 58 - info.align_mask = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0; 73 + info.align_mask = 0; 59 74 info.align_offset = pgoff << PAGE_SHIFT; 60 75 return vm_unmapped_area(&info); 61 76 }
+5 -11
arch/arc/mm/tlb.c
··· 478 478 479 479 create_tlb(vma, vaddr, ptep); 480 480 481 - if (page == ZERO_PAGE(0)) { 481 + if (page == ZERO_PAGE(0)) 482 482 return; 483 - } 484 483 485 484 /* 486 - * Exec page : Independent of aliasing/page-color considerations, 487 - * since icache doesn't snoop dcache on ARC, any dirty 488 - * K-mapping of a code page needs to be wback+inv so that 489 - * icache fetch by userspace sees code correctly. 490 - * !EXEC page: If K-mapping is NOT congruent to U-mapping, flush it 491 - * so userspace sees the right data. 492 - * (Avoids the flush for Non-exec + congruent mapping case) 485 + * For executable pages, since icache doesn't snoop dcache, any 486 + * dirty K-mapping of a code page needs to be wback+inv so that 487 + * icache fetch by userspace sees code correctly. 493 488 */ 494 - if ((vma->vm_flags & VM_EXEC) || 495 - addr_not_cache_congruent(paddr, vaddr)) { 489 + if (vma->vm_flags & VM_EXEC) { 496 490 struct folio *folio = page_folio(page); 497 491 int dirty = !test_and_set_bit(PG_dc_clean, &folio->flags); 498 492 if (dirty) {
+1
arch/arm/boot/dts/ti/omap/am33xx.dtsi
··· 359 359 <SYSC_IDLE_NO>, 360 360 <SYSC_IDLE_SMART>, 361 361 <SYSC_IDLE_SMART_WKUP>; 362 + ti,sysc-delay-us = <2>; 362 363 clocks = <&l3s_clkctrl AM3_L3S_USB_OTG_HS_CLKCTRL 0>; 363 364 clock-names = "fck"; 364 365 #address-cells = <1>;
+1 -1
arch/arm/boot/dts/ti/omap/dra7.dtsi
··· 147 147 148 148 l3-noc@44000000 { 149 149 compatible = "ti,dra7-l3-noc"; 150 - reg = <0x44000000 0x1000>, 150 + reg = <0x44000000 0x1000000>, 151 151 <0x45000000 0x1000>; 152 152 interrupts-extended = <&crossbar_mpu GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>, 153 153 <&wakeupgen GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
+5
arch/arm/mach-omap2/id.c
··· 793 793 794 794 soc_dev_attr->machine = soc_name; 795 795 soc_dev_attr->family = omap_get_family(); 796 + if (!soc_dev_attr->family) { 797 + kfree(soc_dev_attr); 798 + return; 799 + } 796 800 soc_dev_attr->revision = soc_rev; 797 801 soc_dev_attr->custom_attr_group = omap_soc_groups[0]; 798 802 799 803 soc_dev = soc_device_register(soc_dev_attr); 800 804 if (IS_ERR(soc_dev)) { 805 + kfree(soc_dev_attr->family); 801 806 kfree(soc_dev_attr); 802 807 return; 803 808 }
-3
arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero.dtsi
··· 68 68 &emac0 { 69 69 pinctrl-names = "default"; 70 70 pinctrl-0 = <&ext_rgmii_pins>; 71 - phy-mode = "rgmii"; 72 71 phy-handle = <&ext_rgmii_phy>; 73 - allwinner,rx-delay-ps = <3100>; 74 - allwinner,tx-delay-ps = <700>; 75 72 status = "okay"; 76 73 }; 77 74
+3
arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts
··· 13 13 }; 14 14 15 15 &emac0 { 16 + allwinner,rx-delay-ps = <3100>; 17 + allwinner,tx-delay-ps = <700>; 18 + phy-mode = "rgmii"; 16 19 phy-supply = <&reg_dcdce>; 17 20 }; 18 21
+2
arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero3.dts
··· 13 13 }; 14 14 15 15 &emac0 { 16 + allwinner,tx-delay-ps = <700>; 17 + phy-mode = "rgmii-rxid"; 16 18 phy-supply = <&reg_dldo1>; 17 19 }; 18 20
+1
arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts
··· 238 238 mt6360: pmic@34 { 239 239 compatible = "mediatek,mt6360"; 240 240 reg = <0x34>; 241 + interrupt-parent = <&pio>; 241 242 interrupts = <128 IRQ_TYPE_EDGE_FALLING>; 242 243 interrupt-names = "IRQB"; 243 244 interrupt-controller;
+6
arch/arm64/include/asm/pgtable.h
··· 834 834 pte = set_pte_bit(pte, __pgprot(PTE_DIRTY)); 835 835 836 836 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); 837 + /* 838 + * If we end up clearing hw dirtiness for a sw-dirty PTE, set hardware 839 + * dirtiness again. 840 + */ 841 + if (pte_sw_dirty(pte)) 842 + pte = pte_mkdirty(pte); 837 843 return pte; 838 844 } 839 845
-4
arch/arm64/include/asm/syscall_wrapper.h
··· 44 44 return sys_ni_syscall(); \ 45 45 } 46 46 47 - #define COMPAT_SYS_NI(name) \ 48 - SYSCALL_ALIAS(__arm64_compat_sys_##name, sys_ni_posix_timers); 49 - 50 47 #endif /* CONFIG_COMPAT */ 51 48 52 49 #define __SYSCALL_DEFINEx(x, name, ...) \ ··· 78 81 } 79 82 80 83 asmlinkage long __arm64_sys_ni_syscall(const struct pt_regs *__unused); 81 - #define SYS_NI(name) SYSCALL_ALIAS(__arm64_sys_##name, sys_ni_posix_timers); 82 84 83 85 #endif /* __ASM_SYSCALL_WRAPPER_H */
+1 -1
arch/loongarch/kernel/Makefile
··· 57 57 58 58 obj-$(CONFIG_RELOCATABLE) += relocate.o 59 59 60 - obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 60 + obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o 61 61 obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 62 62 63 63 obj-$(CONFIG_UNWINDER_GUESS) += unwind_guess.o
+2 -2
arch/m68k/include/asm/kexec.h
··· 2 2 #ifndef _ASM_M68K_KEXEC_H 3 3 #define _ASM_M68K_KEXEC_H 4 4 5 - #ifdef CONFIG_KEXEC 5 + #ifdef CONFIG_KEXEC_CORE 6 6 7 7 /* Maximum physical address we can use pages from */ 8 8 #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) ··· 25 25 26 26 #endif /* __ASSEMBLY__ */ 27 27 28 - #endif /* CONFIG_KEXEC */ 28 + #endif /* CONFIG_KEXEC_CORE */ 29 29 30 30 #endif /* _ASM_M68K_KEXEC_H */
+1 -1
arch/m68k/kernel/Makefile
··· 25 25 26 26 obj-$(CONFIG_M68K_NONCOHERENT_DMA) += dma.o 27 27 28 - obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 28 + obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o 29 29 obj-$(CONFIG_BOOTINFO_PROC) += bootinfo_proc.o 30 30 obj-$(CONFIG_UBOOT) += uboot.o 31 31
+2 -2
arch/mips/cavium-octeon/smp.c
··· 422 422 .cpu_disable = octeon_cpu_disable, 423 423 .cpu_die = octeon_cpu_die, 424 424 #endif 425 - #ifdef CONFIG_KEXEC 425 + #ifdef CONFIG_KEXEC_CORE 426 426 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump, 427 427 #endif 428 428 }; ··· 502 502 .cpu_disable = octeon_cpu_disable, 503 503 .cpu_die = octeon_cpu_die, 504 504 #endif 505 - #ifdef CONFIG_KEXEC 505 + #ifdef CONFIG_KEXEC_CORE 506 506 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump, 507 507 #endif 508 508 };
+1 -1
arch/mips/include/asm/kexec.h
··· 31 31 prepare_frametrace(newregs); 32 32 } 33 33 34 - #ifdef CONFIG_KEXEC 34 + #ifdef CONFIG_KEXEC_CORE 35 35 struct kimage; 36 36 extern unsigned long kexec_args[4]; 37 37 extern int (*_machine_kexec_prepare)(struct kimage *);
+1 -1
arch/mips/include/asm/smp-ops.h
··· 35 35 void (*cpu_die)(unsigned int cpu); 36 36 void (*cleanup_dead_cpu)(unsigned cpu); 37 37 #endif 38 - #ifdef CONFIG_KEXEC 38 + #ifdef CONFIG_KEXEC_CORE 39 39 void (*kexec_nonboot_cpu)(void); 40 40 #endif 41 41 };
+1 -1
arch/mips/include/asm/smp.h
··· 93 93 extern void __noreturn play_dead(void); 94 94 #endif 95 95 96 - #ifdef CONFIG_KEXEC 96 + #ifdef CONFIG_KEXEC_CORE 97 97 static inline void kexec_nonboot_cpu(void) 98 98 { 99 99 extern const struct plat_smp_ops *mp_ops; /* private */
+1 -1
arch/mips/kernel/Makefile
··· 90 90 91 91 obj-$(CONFIG_RELOCATABLE) += relocate.o 92 92 93 - obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o 93 + obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o crash.o 94 94 obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 95 95 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 96 96 obj-$(CONFIG_EARLY_PRINTK_8250) += early_printk_8250.o
+2 -2
arch/mips/kernel/smp-bmips.c
··· 434 434 .cpu_disable = bmips_cpu_disable, 435 435 .cpu_die = bmips_cpu_die, 436 436 #endif 437 - #ifdef CONFIG_KEXEC 437 + #ifdef CONFIG_KEXEC_CORE 438 438 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump, 439 439 #endif 440 440 }; ··· 451 451 .cpu_disable = bmips_cpu_disable, 452 452 .cpu_die = bmips_cpu_die, 453 453 #endif 454 - #ifdef CONFIG_KEXEC 454 + #ifdef CONFIG_KEXEC_CORE 455 455 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump, 456 456 #endif 457 457 };
+5 -5
arch/mips/kernel/smp-cps.c
··· 392 392 local_irq_enable(); 393 393 } 394 394 395 - #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_KEXEC) 395 + #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_KEXEC_CORE) 396 396 397 397 enum cpu_death { 398 398 CPU_DEATH_HALT, ··· 429 429 } 430 430 } 431 431 432 - #ifdef CONFIG_KEXEC 432 + #ifdef CONFIG_KEXEC_CORE 433 433 434 434 static void cps_kexec_nonboot_cpu(void) 435 435 { ··· 439 439 cps_shutdown_this_cpu(CPU_DEATH_POWER); 440 440 } 441 441 442 - #endif /* CONFIG_KEXEC */ 442 + #endif /* CONFIG_KEXEC_CORE */ 443 443 444 - #endif /* CONFIG_HOTPLUG_CPU || CONFIG_KEXEC */ 444 + #endif /* CONFIG_HOTPLUG_CPU || CONFIG_KEXEC_CORE */ 445 445 446 446 #ifdef CONFIG_HOTPLUG_CPU 447 447 ··· 610 610 .cpu_die = cps_cpu_die, 611 611 .cleanup_dead_cpu = cps_cleanup_dead_cpu, 612 612 #endif 613 - #ifdef CONFIG_KEXEC 613 + #ifdef CONFIG_KEXEC_CORE 614 614 .kexec_nonboot_cpu = cps_kexec_nonboot_cpu, 615 615 #endif 616 616 };
+2 -2
arch/mips/loongson64/reset.c
··· 53 53 } 54 54 } 55 55 56 - #ifdef CONFIG_KEXEC 56 + #ifdef CONFIG_KEXEC_CORE 57 57 58 58 /* 0X80000000~0X80200000 is safe */ 59 59 #define MAX_ARGS 64 ··· 158 158 _machine_halt = loongson_halt; 159 159 pm_power_off = loongson_poweroff; 160 160 161 - #ifdef CONFIG_KEXEC 161 + #ifdef CONFIG_KEXEC_CORE 162 162 kexec_argv = kmalloc(KEXEC_ARGV_SIZE, GFP_KERNEL); 163 163 if (WARN_ON(!kexec_argv)) 164 164 return -ENOMEM;
+1 -1
arch/mips/loongson64/smp.c
··· 864 864 .cpu_disable = loongson3_cpu_disable, 865 865 .cpu_die = loongson3_cpu_die, 866 866 #endif 867 - #ifdef CONFIG_KEXEC 867 + #ifdef CONFIG_KEXEC_CORE 868 868 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump, 869 869 #endif 870 870 };
-1
arch/powerpc/configs/skiroot_defconfig
··· 301 301 CONFIG_DEBUG_SG=y 302 302 CONFIG_DEBUG_NOTIFIERS=y 303 303 CONFIG_BUG_ON_DATA_CORRUPTION=y 304 - CONFIG_DEBUG_CREDENTIALS=y 305 304 # CONFIG_FTRACE is not set 306 305 CONFIG_XMON=y 307 306 # CONFIG_RUNTIME_TESTING_MENU is not set
+44 -7
arch/powerpc/platforms/pseries/vas.c
··· 385 385 * same fault IRQ is not freed by the OS before. 386 386 */ 387 387 mutex_lock(&vas_pseries_mutex); 388 - if (migration_in_progress) 388 + if (migration_in_progress) { 389 389 rc = -EBUSY; 390 - else 390 + } else { 391 391 rc = allocate_setup_window(txwin, (u64 *)&domain[0], 392 392 cop_feat_caps->win_type); 393 + if (!rc) 394 + caps->nr_open_wins_progress++; 395 + } 396 + 393 397 mutex_unlock(&vas_pseries_mutex); 394 398 if (rc) 395 399 goto out; ··· 408 404 goto out_free; 409 405 410 406 txwin->win_type = cop_feat_caps->win_type; 411 - mutex_lock(&vas_pseries_mutex); 407 + 412 408 /* 409 + * The migration SUSPEND thread sets migration_in_progress and 410 + * closes all open windows from the list. But the window is 411 + * added to the list after open and modify HCALLs. So possible 412 + * that migration_in_progress is set before modify HCALL which 413 + * may cause some windows are still open when the hypervisor 414 + * initiates the migration. 415 + * So checks the migration_in_progress flag again and close all 416 + * open windows. 417 + * 413 418 * Possible to lose the acquired credit with DLPAR core 414 419 * removal after the window is opened. So if there are any 415 420 * closed windows (means with lost credits), do not give new ··· 426 413 * after the existing windows are reopened when credits are 427 414 * available. 428 415 */ 429 - if (!caps->nr_close_wins) { 416 + mutex_lock(&vas_pseries_mutex); 417 + if (!caps->nr_close_wins && !migration_in_progress) { 430 418 list_add(&txwin->win_list, &caps->list); 431 419 caps->nr_open_windows++; 420 + caps->nr_open_wins_progress--; 432 421 mutex_unlock(&vas_pseries_mutex); 433 422 vas_user_win_add_mm_context(&txwin->vas_win.task_ref); 434 423 return &txwin->vas_win; ··· 448 433 */ 449 434 free_irq_setup(txwin); 450 435 h_deallocate_vas_window(txwin->vas_win.winid); 436 + /* 437 + * Hold mutex and reduce nr_open_wins_progress counter. 438 + */ 439 + mutex_lock(&vas_pseries_mutex); 440 + caps->nr_open_wins_progress--; 441 + mutex_unlock(&vas_pseries_mutex); 451 442 out: 452 443 atomic_dec(&cop_feat_caps->nr_used_credits); 453 444 kfree(txwin); ··· 958 937 struct vas_caps *vcaps; 959 938 int i, rc = 0; 960 939 940 + pr_info("VAS migration event %d\n", action); 941 + 961 942 /* 962 943 * NX-GZIP is not enabled. Nothing to do for migration. 963 944 */ 964 945 if (!copypaste_feat) 965 946 return rc; 966 - 967 - mutex_lock(&vas_pseries_mutex); 968 947 969 948 if (action == VAS_SUSPEND) 970 949 migration_in_progress = true; ··· 1011 990 1012 991 switch (action) { 1013 992 case VAS_SUSPEND: 993 + mutex_lock(&vas_pseries_mutex); 1014 994 rc = reconfig_close_windows(vcaps, vcaps->nr_open_windows, 1015 995 true); 996 + /* 997 + * Windows are included in the list after successful 998 + * open. So wait for closing these in-progress open 999 + * windows in vas_allocate_window() which will be 1000 + * done if the migration_in_progress is set. 1001 + */ 1002 + while (vcaps->nr_open_wins_progress) { 1003 + mutex_unlock(&vas_pseries_mutex); 1004 + msleep(10); 1005 + mutex_lock(&vas_pseries_mutex); 1006 + } 1007 + mutex_unlock(&vas_pseries_mutex); 1016 1008 break; 1017 1009 case VAS_RESUME: 1010 + mutex_lock(&vas_pseries_mutex); 1018 1011 atomic_set(&caps->nr_total_credits, new_nr_creds); 1019 1012 rc = reconfig_open_windows(vcaps, new_nr_creds, true); 1013 + mutex_unlock(&vas_pseries_mutex); 1020 1014 break; 1021 1015 default: 1022 1016 /* should not happen */ ··· 1047 1011 goto out; 1048 1012 } 1049 1013 1014 + pr_info("VAS migration event (%d) successful\n", action); 1015 + 1050 1016 out: 1051 - mutex_unlock(&vas_pseries_mutex); 1052 1017 return rc; 1053 1018 } 1054 1019
+2
arch/powerpc/platforms/pseries/vas.h
··· 91 91 struct vas_caps { 92 92 struct vas_cop_feat_caps caps; 93 93 struct list_head list; /* List of open windows */ 94 + int nr_open_wins_progress; /* Number of open windows in */ 95 + /* progress. Used in migration */ 94 96 int nr_close_wins; /* closed windows in the hypervisor for DLPAR */ 95 97 int nr_open_windows; /* Number of successful open windows */ 96 98 u8 feat; /* Feature type */
+2 -2
arch/riscv/Kconfig
··· 685 685 If unsure what to do here, say N. 686 686 687 687 config ARCH_SUPPORTS_KEXEC 688 - def_bool MMU 688 + def_bool y 689 689 690 690 config ARCH_SELECTS_KEXEC 691 691 def_bool y ··· 693 693 select HOTPLUG_CPU if SMP 694 694 695 695 config ARCH_SUPPORTS_KEXEC_FILE 696 - def_bool 64BIT && MMU 696 + def_bool 64BIT 697 697 698 698 config ARCH_SELECTS_KEXEC_FILE 699 699 def_bool y
+1 -1
arch/riscv/include/asm/pgtable.h
··· 899 899 #define PAGE_KERNEL __pgprot(0) 900 900 #define swapper_pg_dir NULL 901 901 #define TASK_SIZE 0xffffffffUL 902 - #define VMALLOC_START 0 902 + #define VMALLOC_START _AC(0, UL) 903 903 #define VMALLOC_END TASK_SIZE 904 904 905 905 #endif /* !CONFIG_MMU */
-5
arch/riscv/include/asm/syscall_wrapper.h
··· 46 46 return sys_ni_syscall(); \ 47 47 } 48 48 49 - #define COMPAT_SYS_NI(name) \ 50 - SYSCALL_ALIAS(__riscv_compat_sys_##name, sys_ni_posix_timers); 51 - 52 49 #endif /* CONFIG_COMPAT */ 53 50 54 51 #define __SYSCALL_DEFINEx(x, name, ...) \ ··· 78 81 { \ 79 82 return sys_ni_syscall(); \ 80 83 } 81 - 82 - #define SYS_NI(name) SYSCALL_ALIAS(__riscv_sys_##name, sys_ni_posix_timers); 83 84 84 85 #endif /* __ASM_SYSCALL_WRAPPER_H */
+3 -1
arch/riscv/kernel/crash_core.c
··· 5 5 6 6 void arch_crash_save_vmcoreinfo(void) 7 7 { 8 - VMCOREINFO_NUMBER(VA_BITS); 9 8 VMCOREINFO_NUMBER(phys_ram_base); 10 9 11 10 vmcoreinfo_append_str("NUMBER(PAGE_OFFSET)=0x%lx\n", PAGE_OFFSET); 12 11 vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START); 13 12 vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_END); 13 + #ifdef CONFIG_MMU 14 + VMCOREINFO_NUMBER(VA_BITS); 14 15 vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START); 15 16 vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END); 16 17 #ifdef CONFIG_64BIT 17 18 vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR); 18 19 vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END); 20 + #endif 19 21 #endif 20 22 vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR); 21 23 vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n",
+5 -5
arch/s390/configs/debug_defconfig
··· 44 44 CONFIG_KEXEC_SIG=y 45 45 CONFIG_CRASH_DUMP=y 46 46 CONFIG_LIVEPATCH=y 47 - CONFIG_MARCH_ZEC12=y 48 - CONFIG_TUNE_ZEC12=y 47 + CONFIG_MARCH_Z13=y 49 48 CONFIG_NR_CPUS=512 50 49 CONFIG_NUMA=y 51 50 CONFIG_HZ_100=y ··· 75 76 CONFIG_MODULE_UNLOAD_TAINT_TRACKING=y 76 77 CONFIG_MODVERSIONS=y 77 78 CONFIG_MODULE_SRCVERSION_ALL=y 78 - CONFIG_MODULE_SIG_SHA256=y 79 79 CONFIG_BLK_DEV_THROTTLING=y 80 80 CONFIG_BLK_WBT=y 81 81 CONFIG_BLK_CGROUP_IOLATENCY=y ··· 91 93 CONFIG_IOSCHED_BFQ=y 92 94 CONFIG_BINFMT_MISC=m 93 95 CONFIG_ZSWAP=y 96 + CONFIG_ZSWAP_ZPOOL_DEFAULT_ZBUD=y 94 97 CONFIG_ZSMALLOC_STAT=y 95 98 CONFIG_SLUB_STATS=y 96 99 # CONFIG_COMPAT_BRK is not set ··· 618 619 CONFIG_BTRFS_DEBUG=y 619 620 CONFIG_BTRFS_ASSERT=y 620 621 CONFIG_NILFS2_FS=m 622 + CONFIG_BCACHEFS_FS=y 623 + CONFIG_BCACHEFS_QUOTA=y 624 + CONFIG_BCACHEFS_POSIX_ACL=y 621 625 CONFIG_FS_DAX=y 622 626 CONFIG_EXPORTFS_BLOCK_OPS=y 623 627 CONFIG_FS_ENCRYPTION=y ··· 693 691 CONFIG_ENCRYPTED_KEYS=m 694 692 CONFIG_KEY_NOTIFICATIONS=y 695 693 CONFIG_SECURITY=y 696 - CONFIG_SECURITY_NETWORK=y 697 694 CONFIG_HARDENED_USERCOPY=y 698 695 CONFIG_FORTIFY_SOURCE=y 699 696 CONFIG_SECURITY_SELINUX=y ··· 835 834 CONFIG_DEBUG_LIST=y 836 835 CONFIG_DEBUG_SG=y 837 836 CONFIG_DEBUG_NOTIFIERS=y 838 - CONFIG_DEBUG_CREDENTIALS=y 839 837 CONFIG_RCU_TORTURE_TEST=m 840 838 CONFIG_RCU_REF_SCALE_TEST=m 841 839 CONFIG_RCU_CPU_STALL_TIMEOUT=300
+5 -4
arch/s390/configs/defconfig
··· 42 42 CONFIG_KEXEC_SIG=y 43 43 CONFIG_CRASH_DUMP=y 44 44 CONFIG_LIVEPATCH=y 45 - CONFIG_MARCH_ZEC12=y 46 - CONFIG_TUNE_ZEC12=y 45 + CONFIG_MARCH_Z13=y 47 46 CONFIG_NR_CPUS=512 48 47 CONFIG_NUMA=y 49 48 CONFIG_HZ_100=y ··· 70 71 CONFIG_MODULE_UNLOAD_TAINT_TRACKING=y 71 72 CONFIG_MODVERSIONS=y 72 73 CONFIG_MODULE_SRCVERSION_ALL=y 73 - CONFIG_MODULE_SIG_SHA256=y 74 74 CONFIG_BLK_DEV_THROTTLING=y 75 75 CONFIG_BLK_WBT=y 76 76 CONFIG_BLK_CGROUP_IOLATENCY=y ··· 86 88 CONFIG_IOSCHED_BFQ=y 87 89 CONFIG_BINFMT_MISC=m 88 90 CONFIG_ZSWAP=y 91 + CONFIG_ZSWAP_ZPOOL_DEFAULT_ZBUD=y 89 92 CONFIG_ZSMALLOC_STAT=y 90 93 # CONFIG_COMPAT_BRK is not set 91 94 CONFIG_MEMORY_HOTPLUG=y ··· 604 605 CONFIG_BTRFS_FS=y 605 606 CONFIG_BTRFS_FS_POSIX_ACL=y 606 607 CONFIG_NILFS2_FS=m 608 + CONFIG_BCACHEFS_FS=m 609 + CONFIG_BCACHEFS_QUOTA=y 610 + CONFIG_BCACHEFS_POSIX_ACL=y 607 611 CONFIG_FS_DAX=y 608 612 CONFIG_EXPORTFS_BLOCK_OPS=y 609 613 CONFIG_FS_ENCRYPTION=y ··· 679 677 CONFIG_ENCRYPTED_KEYS=m 680 678 CONFIG_KEY_NOTIFICATIONS=y 681 679 CONFIG_SECURITY=y 682 - CONFIG_SECURITY_NETWORK=y 683 680 CONFIG_SECURITY_SELINUX=y 684 681 CONFIG_SECURITY_SELINUX_BOOTPARAM=y 685 682 CONFIG_SECURITY_LOCKDOWN_LSM=y
+1 -2
arch/s390/configs/zfcpdump_defconfig
··· 9 9 CONFIG_BLK_DEV_INITRD=y 10 10 CONFIG_CC_OPTIMIZE_FOR_SIZE=y 11 11 CONFIG_CRASH_DUMP=y 12 - CONFIG_MARCH_ZEC12=y 13 - CONFIG_TUNE_ZEC12=y 12 + CONFIG_MARCH_Z13=y 14 13 # CONFIG_COMPAT is not set 15 14 CONFIG_NR_CPUS=2 16 15 CONFIG_HZ_100=y
+1 -1
arch/s390/include/asm/fpu/api.h
··· 79 79 #define KERNEL_VXR_HIGH (KERNEL_VXR_V16V23|KERNEL_VXR_V24V31) 80 80 81 81 #define KERNEL_VXR (KERNEL_VXR_LOW|KERNEL_VXR_HIGH) 82 - #define KERNEL_FPR (KERNEL_FPC|KERNEL_VXR_V0V7) 82 + #define KERNEL_FPR (KERNEL_FPC|KERNEL_VXR_LOW) 83 83 84 84 struct kernel_fpu; 85 85
+1 -12
arch/s390/include/asm/syscall_wrapper.h
··· 63 63 cond_syscall(__s390x_sys_##name); \ 64 64 cond_syscall(__s390_sys_##name) 65 65 66 - #define SYS_NI(name) \ 67 - SYSCALL_ALIAS(__s390x_sys_##name, sys_ni_posix_timers); \ 68 - SYSCALL_ALIAS(__s390_sys_##name, sys_ni_posix_timers) 69 - 70 66 #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ 71 67 long __s390_compat_sys##name(struct pt_regs *regs); \ 72 68 ALLOW_ERROR_INJECTION(__s390_compat_sys##name, ERRNO); \ ··· 81 85 82 86 /* 83 87 * As some compat syscalls may not be implemented, we need to expand 84 - * COND_SYSCALL_COMPAT in kernel/sys_ni.c and COMPAT_SYS_NI in 85 - * kernel/time/posix-stubs.c to cover this case as well. 88 + * COND_SYSCALL_COMPAT in kernel/sys_ni.c to cover this case as well. 86 89 */ 87 90 #define COND_SYSCALL_COMPAT(name) \ 88 91 cond_syscall(__s390_compat_sys_##name) 89 - 90 - #define COMPAT_SYS_NI(name) \ 91 - SYSCALL_ALIAS(__s390_compat_sys_##name, sys_ni_posix_timers) 92 92 93 93 #define __S390_SYS_STUBx(x, name, ...) \ 94 94 long __s390_sys##name(struct pt_regs *regs); \ ··· 115 123 116 124 #define COND_SYSCALL(name) \ 117 125 cond_syscall(__s390x_sys_##name) 118 - 119 - #define SYS_NI(name) \ 120 - SYSCALL_ALIAS(__s390x_sys_##name, sys_ni_posix_timers) 121 126 122 127 #define __S390_SYS_STUBx(x, fullname, name, ...) 123 128
+2 -2
arch/sh/include/asm/kexec.h
··· 28 28 /* The native architecture */ 29 29 #define KEXEC_ARCH KEXEC_ARCH_SH 30 30 31 - #ifdef CONFIG_KEXEC 31 + #ifdef CONFIG_KEXEC_CORE 32 32 /* arch/sh/kernel/machine_kexec.c */ 33 33 void reserve_crashkernel(void); 34 34 ··· 67 67 } 68 68 #else 69 69 static inline void reserve_crashkernel(void) { } 70 - #endif /* CONFIG_KEXEC */ 70 + #endif /* CONFIG_KEXEC_CORE */ 71 71 72 72 #endif /* __ASM_SH_KEXEC_H */
+1 -1
arch/sh/kernel/Makefile
··· 33 33 obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o 34 34 obj-$(CONFIG_KGDB) += kgdb.o 35 35 obj-$(CONFIG_MODULES) += sh_ksyms_32.o module.o 36 - obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 36 + obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o 37 37 obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 38 38 obj-$(CONFIG_STACKTRACE) += stacktrace.o 39 39 obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
+2 -2
arch/sh/kernel/reboot.c
··· 63 63 .shutdown = native_machine_shutdown, 64 64 .restart = native_machine_restart, 65 65 .halt = native_machine_halt, 66 - #ifdef CONFIG_KEXEC 66 + #ifdef CONFIG_KEXEC_CORE 67 67 .crash_shutdown = native_machine_crash_shutdown, 68 68 #endif 69 69 }; ··· 88 88 machine_ops.halt(); 89 89 } 90 90 91 - #ifdef CONFIG_KEXEC 91 + #ifdef CONFIG_KEXEC_CORE 92 92 void machine_crash_shutdown(struct pt_regs *regs) 93 93 { 94 94 machine_ops.crash_shutdown(regs);
+1 -1
arch/sh/kernel/setup.c
··· 220 220 request_resource(res, &code_resource); 221 221 request_resource(res, &data_resource); 222 222 request_resource(res, &bss_resource); 223 - #ifdef CONFIG_KEXEC 223 + #ifdef CONFIG_KEXEC_CORE 224 224 request_resource(res, &crashk_res); 225 225 #endif 226 226
+1 -1
arch/x86/boot/compressed/acpi.c
··· 178 178 { 179 179 unsigned long addr = 0; 180 180 181 - #ifdef CONFIG_KEXEC 181 + #ifdef CONFIG_KEXEC_CORE 182 182 char val[MAX_ADDR_LEN] = { }; 183 183 int ret; 184 184
+4 -30
arch/x86/include/asm/syscall_wrapper.h
··· 86 86 return sys_ni_syscall(); \ 87 87 } 88 88 89 - #define __SYS_NI(abi, name) \ 90 - SYSCALL_ALIAS(__##abi##_##name, sys_ni_posix_timers); 91 - 92 89 #ifdef CONFIG_X86_64 93 90 #define __X64_SYS_STUB0(name) \ 94 91 __SYS_STUB0(x64, sys_##name) ··· 97 100 #define __X64_COND_SYSCALL(name) \ 98 101 __COND_SYSCALL(x64, sys_##name) 99 102 100 - #define __X64_SYS_NI(name) \ 101 - __SYS_NI(x64, sys_##name) 102 103 #else /* CONFIG_X86_64 */ 103 104 #define __X64_SYS_STUB0(name) 104 105 #define __X64_SYS_STUBx(x, name, ...) 105 106 #define __X64_COND_SYSCALL(name) 106 - #define __X64_SYS_NI(name) 107 107 #endif /* CONFIG_X86_64 */ 108 108 109 109 #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) ··· 114 120 #define __IA32_COND_SYSCALL(name) \ 115 121 __COND_SYSCALL(ia32, sys_##name) 116 122 117 - #define __IA32_SYS_NI(name) \ 118 - __SYS_NI(ia32, sys_##name) 119 123 #else /* CONFIG_X86_32 || CONFIG_IA32_EMULATION */ 120 124 #define __IA32_SYS_STUB0(name) 121 125 #define __IA32_SYS_STUBx(x, name, ...) 122 126 #define __IA32_COND_SYSCALL(name) 123 - #define __IA32_SYS_NI(name) 124 127 #endif /* CONFIG_X86_32 || CONFIG_IA32_EMULATION */ 125 128 126 129 #ifdef CONFIG_IA32_EMULATION ··· 126 135 * additional wrappers (aptly named __ia32_sys_xyzzy) which decode the 127 136 * ia32 regs in the proper order for shared or "common" syscalls. As some 128 137 * syscalls may not be implemented, we need to expand COND_SYSCALL in 129 - * kernel/sys_ni.c and SYS_NI in kernel/time/posix-stubs.c to cover this 130 - * case as well. 138 + * kernel/sys_ni.c to cover this case as well. 131 139 */ 132 140 #define __IA32_COMPAT_SYS_STUB0(name) \ 133 141 __SYS_STUB0(ia32, compat_sys_##name) ··· 138 148 #define __IA32_COMPAT_COND_SYSCALL(name) \ 139 149 __COND_SYSCALL(ia32, compat_sys_##name) 140 150 141 - #define __IA32_COMPAT_SYS_NI(name) \ 142 - __SYS_NI(ia32, compat_sys_##name) 143 - 144 151 #else /* CONFIG_IA32_EMULATION */ 145 152 #define __IA32_COMPAT_SYS_STUB0(name) 146 153 #define __IA32_COMPAT_SYS_STUBx(x, name, ...) 147 154 #define __IA32_COMPAT_COND_SYSCALL(name) 148 - #define __IA32_COMPAT_SYS_NI(name) 149 155 #endif /* CONFIG_IA32_EMULATION */ 150 156 151 157 ··· 161 175 #define __X32_COMPAT_COND_SYSCALL(name) \ 162 176 __COND_SYSCALL(x64, compat_sys_##name) 163 177 164 - #define __X32_COMPAT_SYS_NI(name) \ 165 - __SYS_NI(x64, compat_sys_##name) 166 178 #else /* CONFIG_X86_X32_ABI */ 167 179 #define __X32_COMPAT_SYS_STUB0(name) 168 180 #define __X32_COMPAT_SYS_STUBx(x, name, ...) 169 181 #define __X32_COMPAT_COND_SYSCALL(name) 170 - #define __X32_COMPAT_SYS_NI(name) 171 182 #endif /* CONFIG_X86_X32_ABI */ 172 183 173 184 ··· 195 212 196 213 /* 197 214 * As some compat syscalls may not be implemented, we need to expand 198 - * COND_SYSCALL_COMPAT in kernel/sys_ni.c and COMPAT_SYS_NI in 199 - * kernel/time/posix-stubs.c to cover this case as well. 215 + * COND_SYSCALL_COMPAT in kernel/sys_ni.c to cover this case as well. 200 216 */ 201 217 #define COND_SYSCALL_COMPAT(name) \ 202 218 __IA32_COMPAT_COND_SYSCALL(name) \ 203 219 __X32_COMPAT_COND_SYSCALL(name) 204 - 205 - #define COMPAT_SYS_NI(name) \ 206 - __IA32_COMPAT_SYS_NI(name) \ 207 - __X32_COMPAT_SYS_NI(name) 208 220 209 221 #endif /* CONFIG_COMPAT */ 210 222 ··· 221 243 * As the generic SYSCALL_DEFINE0() macro does not decode any parameters for 222 244 * obvious reasons, and passing struct pt_regs *regs to it in %rdi does not 223 245 * hurt, we only need to re-define it here to keep the naming congruent to 224 - * SYSCALL_DEFINEx() -- which is essential for the COND_SYSCALL() and SYS_NI() 225 - * macros to work correctly. 246 + * SYSCALL_DEFINEx() -- which is essential for the COND_SYSCALL() macro 247 + * to work correctly. 226 248 */ 227 249 #define SYSCALL_DEFINE0(sname) \ 228 250 SYSCALL_METADATA(_##sname, 0); \ ··· 234 256 #define COND_SYSCALL(name) \ 235 257 __X64_COND_SYSCALL(name) \ 236 258 __IA32_COND_SYSCALL(name) 237 - 238 - #define SYS_NI(name) \ 239 - __X64_SYS_NI(name) \ 240 - __IA32_SYS_NI(name) 241 259 242 260 243 261 /*
+9 -3
drivers/accel/ivpu/ivpu_hw_37xx.c
··· 53 53 54 54 #define ICB_0_1_IRQ_MASK ((((u64)ICB_1_IRQ_MASK) << 32) | ICB_0_IRQ_MASK) 55 55 56 - #define BUTTRESS_IRQ_MASK ((REG_FLD(VPU_37XX_BUTTRESS_INTERRUPT_STAT, FREQ_CHANGE)) | \ 57 - (REG_FLD(VPU_37XX_BUTTRESS_INTERRUPT_STAT, ATS_ERR)) | \ 56 + #define BUTTRESS_IRQ_MASK ((REG_FLD(VPU_37XX_BUTTRESS_INTERRUPT_STAT, ATS_ERR)) | \ 58 57 (REG_FLD(VPU_37XX_BUTTRESS_INTERRUPT_STAT, UFI_ERR))) 58 + 59 + #define BUTTRESS_ALL_IRQ_MASK (BUTTRESS_IRQ_MASK | \ 60 + (REG_FLD(VPU_37XX_BUTTRESS_INTERRUPT_STAT, FREQ_CHANGE))) 59 61 60 62 #define BUTTRESS_IRQ_ENABLE_MASK ((u32)~BUTTRESS_IRQ_MASK) 61 63 #define BUTTRESS_IRQ_DISABLE_MASK ((u32)-1) ··· 76 74 vdev->wa.clear_runtime_mem = false; 77 75 vdev->wa.d3hot_after_power_off = true; 78 76 79 - if (ivpu_device_id(vdev) == PCI_DEVICE_ID_MTL && ivpu_revision(vdev) < 4) 77 + REGB_WR32(VPU_37XX_BUTTRESS_INTERRUPT_STAT, BUTTRESS_ALL_IRQ_MASK); 78 + if (REGB_RD32(VPU_37XX_BUTTRESS_INTERRUPT_STAT) == BUTTRESS_ALL_IRQ_MASK) { 79 + /* Writing 1s does not clear the interrupt status register */ 80 80 vdev->wa.interrupt_clear_with_0 = true; 81 + REGB_WR32(VPU_37XX_BUTTRESS_INTERRUPT_STAT, 0x0); 82 + } 81 83 82 84 IVPU_PRINT_WA(punit_disabled); 83 85 IVPU_PRINT_WA(clear_runtime_mem);
+6 -4
drivers/bluetooth/hci_vhci.c
··· 11 11 #include <linux/module.h> 12 12 #include <asm/unaligned.h> 13 13 14 + #include <linux/atomic.h> 14 15 #include <linux/kernel.h> 15 16 #include <linux/init.h> 16 17 #include <linux/slab.h> ··· 45 44 bool wakeup; 46 45 __u16 msft_opcode; 47 46 bool aosp_capable; 47 + atomic_t initialized; 48 48 }; 49 49 50 50 static int vhci_open_dev(struct hci_dev *hdev) ··· 77 75 78 76 memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1); 79 77 80 - mutex_lock(&data->open_mutex); 81 78 skb_queue_tail(&data->readq, skb); 82 - mutex_unlock(&data->open_mutex); 83 79 84 - wake_up_interruptible(&data->read_wait); 80 + if (atomic_read(&data->initialized)) 81 + wake_up_interruptible(&data->read_wait); 85 82 return 0; 86 83 } 87 84 ··· 465 464 skb_put_u8(skb, 0xff); 466 465 skb_put_u8(skb, opcode); 467 466 put_unaligned_le16(hdev->id, skb_put(skb, 2)); 468 - skb_queue_tail(&data->readq, skb); 467 + skb_queue_head(&data->readq, skb); 468 + atomic_inc(&data->initialized); 469 469 470 470 wake_up_interruptible(&data->read_wait); 471 471 return 0;
+14 -4
drivers/bus/ti-sysc.c
··· 2158 2158 sysc_val = sysc_read_sysconfig(ddata); 2159 2159 sysc_val |= sysc_mask; 2160 2160 sysc_write(ddata, sysc_offset, sysc_val); 2161 - /* Flush posted write */ 2161 + 2162 + /* 2163 + * Some devices need a delay before reading registers 2164 + * after reset. Presumably a srst_udelay is not needed 2165 + * for devices that use a rstctrl register reset. 2166 + */ 2167 + if (ddata->cfg.srst_udelay) 2168 + fsleep(ddata->cfg.srst_udelay); 2169 + 2170 + /* 2171 + * Flush posted write. For devices needing srst_udelay 2172 + * this should trigger an interconnect error if the 2173 + * srst_udelay value is needed but not configured. 2174 + */ 2162 2175 sysc_val = sysc_read_sysconfig(ddata); 2163 2176 } 2164 - 2165 - if (ddata->cfg.srst_udelay) 2166 - fsleep(ddata->cfg.srst_udelay); 2167 2177 2168 2178 if (ddata->post_reset_quirk) 2169 2179 ddata->post_reset_quirk(ddata);
+1
drivers/clk/qcom/Kconfig
··· 767 767 768 768 config SM_CAMCC_8550 769 769 tristate "SM8550 Camera Clock Controller" 770 + depends on ARM64 || COMPILE_TEST 770 771 select SM_GCC_8550 771 772 help 772 773 Support for the camera clock controller on SM8550 devices.
+9 -15
drivers/clk/rockchip/clk-rk3128.c
··· 138 138 PNAME(mux_pll_src_4plls_p) = { "cpll", "gpll", "gpll_div2", "usb480m" }; 139 139 PNAME(mux_pll_src_3plls_p) = { "cpll", "gpll", "gpll_div2" }; 140 140 141 - PNAME(mux_aclk_peri_src_p) = { "gpll_peri", "cpll_peri", "gpll_div2_peri", "gpll_div3_peri" }; 141 + PNAME(mux_clk_peri_src_p) = { "gpll", "cpll", "gpll_div2", "gpll_div3" }; 142 142 PNAME(mux_mmc_src_p) = { "cpll", "gpll", "gpll_div2", "xin24m" }; 143 143 PNAME(mux_clk_cif_out_src_p) = { "clk_cif_src", "xin24m" }; 144 144 PNAME(mux_sclk_vop_src_p) = { "cpll", "gpll", "gpll_div2", "gpll_div3" }; ··· 275 275 RK2928_CLKGATE_CON(0), 11, GFLAGS), 276 276 277 277 /* PD_PERI */ 278 - GATE(0, "gpll_peri", "gpll", CLK_IGNORE_UNUSED, 278 + COMPOSITE(0, "clk_peri_src", mux_clk_peri_src_p, 0, 279 + RK2928_CLKSEL_CON(10), 14, 2, MFLAGS, 0, 5, DFLAGS, 279 280 RK2928_CLKGATE_CON(2), 0, GFLAGS), 280 - GATE(0, "cpll_peri", "cpll", CLK_IGNORE_UNUSED, 281 - RK2928_CLKGATE_CON(2), 0, GFLAGS), 282 - GATE(0, "gpll_div2_peri", "gpll_div2", CLK_IGNORE_UNUSED, 283 - RK2928_CLKGATE_CON(2), 0, GFLAGS), 284 - GATE(0, "gpll_div3_peri", "gpll_div3", CLK_IGNORE_UNUSED, 285 - RK2928_CLKGATE_CON(2), 0, GFLAGS), 286 - COMPOSITE_NOGATE(0, "aclk_peri_src", mux_aclk_peri_src_p, 0, 287 - RK2928_CLKSEL_CON(10), 14, 2, MFLAGS, 0, 5, DFLAGS), 288 - COMPOSITE_NOMUX(PCLK_PERI, "pclk_peri", "aclk_peri_src", 0, 281 + 282 + COMPOSITE_NOMUX(PCLK_PERI, "pclk_peri", "clk_peri_src", 0, 289 283 RK2928_CLKSEL_CON(10), 12, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO, 290 284 RK2928_CLKGATE_CON(2), 3, GFLAGS), 291 - COMPOSITE_NOMUX(HCLK_PERI, "hclk_peri", "aclk_peri_src", 0, 285 + COMPOSITE_NOMUX(HCLK_PERI, "hclk_peri", "clk_peri_src", 0, 292 286 RK2928_CLKSEL_CON(10), 8, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO, 293 287 RK2928_CLKGATE_CON(2), 2, GFLAGS), 294 - GATE(ACLK_PERI, "aclk_peri", "aclk_peri_src", 0, 288 + GATE(ACLK_PERI, "aclk_peri", "clk_peri_src", 0, 295 289 RK2928_CLKGATE_CON(2), 1, GFLAGS), 296 290 297 291 GATE(SCLK_TIMER0, "sclk_timer0", "xin24m", 0, ··· 310 316 GATE(SCLK_MIPI_24M, "clk_mipi_24m", "xin24m", CLK_IGNORE_UNUSED, 311 317 RK2928_CLKGATE_CON(2), 15, GFLAGS), 312 318 313 - COMPOSITE(SCLK_SDMMC, "sclk_sdmmc0", mux_mmc_src_p, 0, 319 + COMPOSITE(SCLK_SDMMC, "sclk_sdmmc", mux_mmc_src_p, 0, 314 320 RK2928_CLKSEL_CON(11), 6, 2, MFLAGS, 0, 6, DFLAGS, 315 321 RK2928_CLKGATE_CON(2), 11, GFLAGS), 316 322 ··· 484 490 GATE(HCLK_I2S_2CH, "hclk_i2s_2ch", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 2, GFLAGS), 485 491 GATE(0, "hclk_usb_peri", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(9), 13, GFLAGS), 486 492 GATE(HCLK_HOST2, "hclk_host2", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 3, GFLAGS), 487 - GATE(HCLK_OTG, "hclk_otg", "hclk_peri", 0, RK2928_CLKGATE_CON(3), 13, GFLAGS), 493 + GATE(HCLK_OTG, "hclk_otg", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 13, GFLAGS), 488 494 GATE(0, "hclk_peri_ahb", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(9), 14, GFLAGS), 489 495 GATE(HCLK_SPDIF, "hclk_spdif", "hclk_peri", 0, RK2928_CLKGATE_CON(10), 9, GFLAGS), 490 496 GATE(HCLK_TSP, "hclk_tsp", "hclk_peri", 0, RK2928_CLKGATE_CON(10), 12, GFLAGS),
+1
drivers/clk/rockchip/clk-rk3568.c
··· 72 72 RK3036_PLL_RATE(408000000, 1, 68, 2, 2, 1, 0), 73 73 RK3036_PLL_RATE(312000000, 1, 78, 6, 1, 1, 0), 74 74 RK3036_PLL_RATE(297000000, 2, 99, 4, 1, 1, 0), 75 + RK3036_PLL_RATE(292500000, 1, 195, 4, 4, 1, 0), 75 76 RK3036_PLL_RATE(241500000, 2, 161, 4, 2, 1, 0), 76 77 RK3036_PLL_RATE(216000000, 1, 72, 4, 2, 1, 0), 77 78 RK3036_PLL_RATE(200000000, 1, 100, 3, 4, 1, 0),
+3 -2
drivers/cxl/core/hdm.c
··· 363 363 { 364 364 resource_size_t base = -1; 365 365 366 - down_read(&cxl_dpa_rwsem); 366 + lockdep_assert_held(&cxl_dpa_rwsem); 367 367 if (cxled->dpa_res) 368 368 base = cxled->dpa_res->start; 369 - up_read(&cxl_dpa_rwsem); 370 369 371 370 return base; 372 371 } ··· 838 839 cxld->target_type = CXL_DECODER_HOSTONLYMEM; 839 840 else 840 841 cxld->target_type = CXL_DECODER_DEVMEM; 842 + 843 + guard(rwsem_write)(&cxl_region_rwsem); 841 844 if (cxld->id != cxl_num_decoders_committed(port)) { 842 845 dev_warn(&port->dev, 843 846 "decoder%d.%d: Committed out of order\n",
+24 -3
drivers/cxl/core/memdev.c
··· 227 227 if (!port || !is_cxl_endpoint(port)) 228 228 return -EINVAL; 229 229 230 - rc = down_read_interruptible(&cxl_dpa_rwsem); 230 + rc = down_read_interruptible(&cxl_region_rwsem); 231 231 if (rc) 232 232 return rc; 233 + 234 + rc = down_read_interruptible(&cxl_dpa_rwsem); 235 + if (rc) { 236 + up_read(&cxl_region_rwsem); 237 + return rc; 238 + } 233 239 234 240 if (cxl_num_decoders_committed(port) == 0) { 235 241 /* No regions mapped to this memdev */ ··· 245 239 rc = cxl_get_poison_by_endpoint(port); 246 240 } 247 241 up_read(&cxl_dpa_rwsem); 242 + up_read(&cxl_region_rwsem); 248 243 249 244 return rc; 250 245 } ··· 331 324 if (!IS_ENABLED(CONFIG_DEBUG_FS)) 332 325 return 0; 333 326 334 - rc = down_read_interruptible(&cxl_dpa_rwsem); 327 + rc = down_read_interruptible(&cxl_region_rwsem); 335 328 if (rc) 336 329 return rc; 330 + 331 + rc = down_read_interruptible(&cxl_dpa_rwsem); 332 + if (rc) { 333 + up_read(&cxl_region_rwsem); 334 + return rc; 335 + } 337 336 338 337 rc = cxl_validate_poison_dpa(cxlmd, dpa); 339 338 if (rc) ··· 368 355 trace_cxl_poison(cxlmd, cxlr, &record, 0, 0, CXL_POISON_TRACE_INJECT); 369 356 out: 370 357 up_read(&cxl_dpa_rwsem); 358 + up_read(&cxl_region_rwsem); 371 359 372 360 return rc; 373 361 } ··· 386 372 if (!IS_ENABLED(CONFIG_DEBUG_FS)) 387 373 return 0; 388 374 389 - rc = down_read_interruptible(&cxl_dpa_rwsem); 375 + rc = down_read_interruptible(&cxl_region_rwsem); 390 376 if (rc) 391 377 return rc; 378 + 379 + rc = down_read_interruptible(&cxl_dpa_rwsem); 380 + if (rc) { 381 + up_read(&cxl_region_rwsem); 382 + return rc; 383 + } 392 384 393 385 rc = cxl_validate_poison_dpa(cxlmd, dpa); 394 386 if (rc) ··· 432 412 trace_cxl_poison(cxlmd, cxlr, &record, 0, 0, CXL_POISON_TRACE_CLEAR); 433 413 out: 434 414 up_read(&cxl_dpa_rwsem); 415 + up_read(&cxl_region_rwsem); 435 416 436 417 return rc; 437 418 }
+6 -7
drivers/cxl/core/pci.c
··· 620 620 struct pci_dev *pdev = NULL; 621 621 struct cxl_memdev *cxlmd; 622 622 size_t cdat_length; 623 - void *cdat_table; 623 + void *cdat_table, *cdat_buf; 624 624 int rc; 625 625 626 626 if (is_cxl_memdev(uport)) { ··· 651 651 return; 652 652 } 653 653 654 - cdat_table = devm_kzalloc(dev, cdat_length + sizeof(__le32), 655 - GFP_KERNEL); 656 - if (!cdat_table) 654 + cdat_buf = devm_kzalloc(dev, cdat_length + sizeof(__le32), GFP_KERNEL); 655 + if (!cdat_buf) 657 656 return; 658 657 659 - rc = cxl_cdat_read_table(dev, cdat_doe, cdat_table, &cdat_length); 658 + rc = cxl_cdat_read_table(dev, cdat_doe, cdat_buf, &cdat_length); 660 659 if (rc) 661 660 goto err; 662 661 663 - cdat_table = cdat_table + sizeof(__le32); 662 + cdat_table = cdat_buf + sizeof(__le32); 664 663 if (cdat_checksum(cdat_table, cdat_length)) 665 664 goto err; 666 665 ··· 669 670 670 671 err: 671 672 /* Don't leave table data allocated on error */ 672 - devm_kfree(dev, cdat_table); 673 + devm_kfree(dev, cdat_buf); 673 674 dev_err(dev, "Failed to read/validate CDAT.\n"); 674 675 } 675 676 EXPORT_SYMBOL_NS_GPL(read_cdat_data, CXL);
+1 -1
drivers/cxl/core/pmu.c
··· 23 23 24 24 static void remove_dev(void *dev) 25 25 { 26 - device_del(dev); 26 + device_unregister(dev); 27 27 } 28 28 29 29 int devm_cxl_pmu_add(struct device *parent, struct cxl_pmu_regs *regs,
+2 -2
drivers/cxl/core/port.c
··· 226 226 char *buf) 227 227 { 228 228 struct cxl_endpoint_decoder *cxled = to_cxl_endpoint_decoder(dev); 229 - u64 base = cxl_dpa_resource_start(cxled); 230 229 231 - return sysfs_emit(buf, "%#llx\n", base); 230 + guard(rwsem_read)(&cxl_dpa_rwsem); 231 + return sysfs_emit(buf, "%#llx\n", (u64)cxl_dpa_resource_start(cxled)); 232 232 } 233 233 static DEVICE_ATTR_RO(dpa_resource); 234 234
-5
drivers/cxl/core/region.c
··· 2467 2467 struct cxl_poison_context ctx; 2468 2468 int rc = 0; 2469 2469 2470 - rc = down_read_interruptible(&cxl_region_rwsem); 2471 - if (rc) 2472 - return rc; 2473 - 2474 2470 ctx = (struct cxl_poison_context) { 2475 2471 .port = port 2476 2472 }; ··· 2476 2480 rc = cxl_get_poison_unmapped(to_cxl_memdev(port->uport_dev), 2477 2481 &ctx); 2478 2482 2479 - up_read(&cxl_region_rwsem); 2480 2483 return rc; 2481 2484 } 2482 2485
+1
drivers/dma/fsl-edma-common.c
··· 828 828 dma_pool_destroy(fsl_chan->tcd_pool); 829 829 fsl_chan->tcd_pool = NULL; 830 830 fsl_chan->is_sw = false; 831 + fsl_chan->srcid = 0; 831 832 } 832 833 833 834 void fsl_edma_cleanup_vchan(struct dma_device *dmadev)
+8 -4
drivers/dma/fsl-edma-main.c
··· 396 396 link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS | 397 397 DL_FLAG_PM_RUNTIME | 398 398 DL_FLAG_RPM_ACTIVE); 399 - if (IS_ERR(link)) { 400 - dev_err(dev, "Failed to add device_link to %d: %ld\n", i, 401 - PTR_ERR(link)); 399 + if (!link) { 400 + dev_err(dev, "Failed to add device_link to %d\n", i); 402 401 return -EINVAL; 403 402 } 404 403 ··· 630 631 631 632 for (i = 0; i < fsl_edma->n_chans; i++) { 632 633 fsl_chan = &fsl_edma->chans[i]; 634 + if (fsl_edma->chan_masked & BIT(i)) 635 + continue; 633 636 spin_lock_irqsave(&fsl_chan->vchan.lock, flags); 634 637 /* Make sure chan is idle or will force disable. */ 635 638 if (unlikely(!fsl_chan->idle)) { ··· 656 655 657 656 for (i = 0; i < fsl_edma->n_chans; i++) { 658 657 fsl_chan = &fsl_edma->chans[i]; 658 + if (fsl_edma->chan_masked & BIT(i)) 659 + continue; 659 660 fsl_chan->pm_state = RUNNING; 660 661 edma_write_tcdreg(fsl_chan, 0, csr); 661 662 if (fsl_chan->slave_id != 0) 662 663 fsl_edma_chan_mux(fsl_chan, fsl_chan->slave_id, true); 663 664 } 664 665 665 - edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr); 666 + if (!(fsl_edma->drvdata->flags & FSL_EDMA_DRV_SPLIT_REG)) 667 + edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA, regs->cr); 666 668 667 669 return 0; 668 670 }
+7 -5
drivers/dma/idxd/registers.h
··· 440 440 /* 441 441 * This macro calculates the offset into the GRPCFG register 442 442 * idxd - struct idxd * 443 - * n - wq id 444 - * ofs - the index of the 32b dword for the config register 443 + * n - group id 444 + * ofs - the index of the 64b qword for the config register 445 445 * 446 - * The WQCFG register block is divided into groups per each wq. The n index 447 - * allows us to move to the register group that's for that particular wq. 448 - * Each register is 32bits. The ofs gives us the number of register to access. 446 + * The GRPCFG register block is divided into three sub-registers, which 447 + * are GRPWQCFG, GRPENGCFG and GRPFLGCFG. The n index allows us to move 448 + * to the register block that contains the three sub-registers. 449 + * Each register block is 64bits. And the ofs gives us the offset 450 + * within the GRPWQCFG register to access. 449 451 */ 450 452 #define GRPWQCFG_OFFSET(idxd_dev, n, ofs) ((idxd_dev)->grpcfg_offset +\ 451 453 (n) * GRPCFG_SIZE + sizeof(u64) * (ofs))
+7 -7
drivers/dma/idxd/submit.c
··· 183 183 portal = idxd_wq_portal_addr(wq); 184 184 185 185 /* 186 - * The wmb() flushes writes to coherent DMA data before 187 - * possibly triggering a DMA read. The wmb() is necessary 188 - * even on UP because the recipient is a device. 189 - */ 190 - wmb(); 191 - 192 - /* 193 186 * Pending the descriptor to the lockless list for the irq_entry 194 187 * that we designated the descriptor to. 195 188 */ ··· 191 198 desc->hw->int_handle = ie->int_handle; 192 199 llist_add(&desc->llnode, &ie->pending_llist); 193 200 } 201 + 202 + /* 203 + * The wmb() flushes writes to coherent DMA data before 204 + * possibly triggering a DMA read. The wmb() is necessary 205 + * even on UP because the recipient is a device. 206 + */ 207 + wmb(); 194 208 195 209 if (wq_dedicated(wq)) { 196 210 iosubmit_cmds512(portal, desc->hw, 1);
+6 -2
drivers/dma/stm32-dma.c
··· 1246 1246 enum dma_slave_buswidth max_width; 1247 1247 struct stm32_dma_desc *desc; 1248 1248 size_t xfer_count, offset; 1249 - u32 num_sgs, best_burst, dma_burst, threshold; 1250 - int i; 1249 + u32 num_sgs, best_burst, threshold; 1250 + int dma_burst, i; 1251 1251 1252 1252 num_sgs = DIV_ROUND_UP(len, STM32_DMA_ALIGNED_MAX_DATA_ITEMS); 1253 1253 desc = kzalloc(struct_size(desc, sg_req, num_sgs), GFP_NOWAIT); ··· 1266 1266 best_burst = stm32_dma_get_best_burst(len, STM32_DMA_MAX_BURST, 1267 1267 threshold, max_width); 1268 1268 dma_burst = stm32_dma_get_burst(chan, best_burst); 1269 + if (dma_burst < 0) { 1270 + kfree(desc); 1271 + return NULL; 1272 + } 1269 1273 1270 1274 stm32_dma_clear_reg(&desc->sg_req[i].chan_reg); 1271 1275 desc->sg_req[i].chan_reg.dma_scr =
+6 -6
drivers/dma/ti/k3-psil-am62.c
··· 74 74 PSIL_SAUL(0x7505, 21, 35, 8, 36, 0), 75 75 PSIL_SAUL(0x7506, 22, 43, 8, 43, 0), 76 76 PSIL_SAUL(0x7507, 23, 43, 8, 44, 0), 77 - /* PDMA_MAIN0 - SPI0-3 */ 77 + /* PDMA_MAIN0 - SPI0-2 */ 78 + PSIL_PDMA_XY_PKT(0x4300), 79 + PSIL_PDMA_XY_PKT(0x4301), 78 80 PSIL_PDMA_XY_PKT(0x4302), 79 81 PSIL_PDMA_XY_PKT(0x4303), 80 82 PSIL_PDMA_XY_PKT(0x4304), ··· 87 85 PSIL_PDMA_XY_PKT(0x4309), 88 86 PSIL_PDMA_XY_PKT(0x430a), 89 87 PSIL_PDMA_XY_PKT(0x430b), 90 - PSIL_PDMA_XY_PKT(0x430c), 91 - PSIL_PDMA_XY_PKT(0x430d), 92 88 /* PDMA_MAIN1 - UART0-6 */ 93 89 PSIL_PDMA_XY_PKT(0x4400), 94 90 PSIL_PDMA_XY_PKT(0x4401), ··· 141 141 /* SAUL */ 142 142 PSIL_SAUL(0xf500, 27, 83, 8, 83, 1), 143 143 PSIL_SAUL(0xf501, 28, 91, 8, 91, 1), 144 - /* PDMA_MAIN0 - SPI0-3 */ 144 + /* PDMA_MAIN0 - SPI0-2 */ 145 + PSIL_PDMA_XY_PKT(0xc300), 146 + PSIL_PDMA_XY_PKT(0xc301), 145 147 PSIL_PDMA_XY_PKT(0xc302), 146 148 PSIL_PDMA_XY_PKT(0xc303), 147 149 PSIL_PDMA_XY_PKT(0xc304), ··· 154 152 PSIL_PDMA_XY_PKT(0xc309), 155 153 PSIL_PDMA_XY_PKT(0xc30a), 156 154 PSIL_PDMA_XY_PKT(0xc30b), 157 - PSIL_PDMA_XY_PKT(0xc30c), 158 - PSIL_PDMA_XY_PKT(0xc30d), 159 155 /* PDMA_MAIN1 - UART0-6 */ 160 156 PSIL_PDMA_XY_PKT(0xc400), 161 157 PSIL_PDMA_XY_PKT(0xc401),
+6 -6
drivers/dma/ti/k3-psil-am62a.c
··· 84 84 PSIL_SAUL(0x7505, 21, 35, 8, 36, 0), 85 85 PSIL_SAUL(0x7506, 22, 43, 8, 43, 0), 86 86 PSIL_SAUL(0x7507, 23, 43, 8, 44, 0), 87 - /* PDMA_MAIN0 - SPI0-3 */ 87 + /* PDMA_MAIN0 - SPI0-2 */ 88 + PSIL_PDMA_XY_PKT(0x4300), 89 + PSIL_PDMA_XY_PKT(0x4301), 88 90 PSIL_PDMA_XY_PKT(0x4302), 89 91 PSIL_PDMA_XY_PKT(0x4303), 90 92 PSIL_PDMA_XY_PKT(0x4304), ··· 97 95 PSIL_PDMA_XY_PKT(0x4309), 98 96 PSIL_PDMA_XY_PKT(0x430a), 99 97 PSIL_PDMA_XY_PKT(0x430b), 100 - PSIL_PDMA_XY_PKT(0x430c), 101 - PSIL_PDMA_XY_PKT(0x430d), 102 98 /* PDMA_MAIN1 - UART0-6 */ 103 99 PSIL_PDMA_XY_PKT(0x4400), 104 100 PSIL_PDMA_XY_PKT(0x4401), ··· 151 151 /* SAUL */ 152 152 PSIL_SAUL(0xf500, 27, 83, 8, 83, 1), 153 153 PSIL_SAUL(0xf501, 28, 91, 8, 91, 1), 154 - /* PDMA_MAIN0 - SPI0-3 */ 154 + /* PDMA_MAIN0 - SPI0-2 */ 155 + PSIL_PDMA_XY_PKT(0xc300), 156 + PSIL_PDMA_XY_PKT(0xc301), 155 157 PSIL_PDMA_XY_PKT(0xc302), 156 158 PSIL_PDMA_XY_PKT(0xc303), 157 159 PSIL_PDMA_XY_PKT(0xc304), ··· 164 162 PSIL_PDMA_XY_PKT(0xc309), 165 163 PSIL_PDMA_XY_PKT(0xc30a), 166 164 PSIL_PDMA_XY_PKT(0xc30b), 167 - PSIL_PDMA_XY_PKT(0xc30c), 168 - PSIL_PDMA_XY_PKT(0xc30d), 169 165 /* PDMA_MAIN1 - UART0-6 */ 170 166 PSIL_PDMA_XY_PKT(0xc400), 171 167 PSIL_PDMA_XY_PKT(0xc401),
+2 -2
drivers/edac/versal_edac.c
··· 966 966 edac_mc_id = emif_get_id(pdev->dev.of_node); 967 967 968 968 regval = readl(ddrmc_baseaddr + XDDR_REG_CONFIG0_OFFSET); 969 - num_chans = FIELD_PREP(XDDR_REG_CONFIG0_NUM_CHANS_MASK, regval); 969 + num_chans = FIELD_GET(XDDR_REG_CONFIG0_NUM_CHANS_MASK, regval); 970 970 num_chans++; 971 971 972 - num_csrows = FIELD_PREP(XDDR_REG_CONFIG0_NUM_RANKS_MASK, regval); 972 + num_csrows = FIELD_GET(XDDR_REG_CONFIG0_NUM_RANKS_MASK, regval); 973 973 num_csrows *= 2; 974 974 if (!num_csrows) 975 975 num_csrows = 1;
-2
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 4516 4516 4517 4517 amdgpu_ras_suspend(adev); 4518 4518 4519 - amdgpu_ttm_set_buffer_funcs_status(adev, false); 4520 - 4521 4519 amdgpu_device_ip_suspend_phase1(adev); 4522 4520 4523 4521 if (!adev->in_s0ix)
+2
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
··· 1343 1343 1344 1344 abo = ttm_to_amdgpu_bo(bo); 1345 1345 1346 + WARN_ON(abo->vm_bo); 1347 + 1346 1348 if (abo->kfd_bo) 1347 1349 amdgpu_amdkfd_release_notify(abo); 1348 1350
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
··· 642 642 643 643 if (!entry->bo) 644 644 return; 645 + 646 + entry->bo->vm_bo = NULL; 645 647 shadow = amdgpu_bo_shadowed(entry->bo); 646 648 if (shadow) { 647 649 ttm_bo_set_bulk_move(&shadow->tbo, NULL); 648 650 amdgpu_bo_unref(&shadow); 649 651 } 650 652 ttm_bo_set_bulk_move(&entry->bo->tbo, NULL); 651 - entry->bo->vm_bo = NULL; 652 653 653 654 spin_lock(&entry->vm->status_lock); 654 655 list_del(&entry->vm_status);
+8 -7
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c
··· 155 155 struct amdgpu_ring *ring = adev->jpeg.inst->ring_dec; 156 156 int r; 157 157 158 - adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell, 159 - (adev->doorbell_index.vcn.vcn_ring0_1 << 1), 0); 160 - 161 - WREG32_SOC15(VCN, 0, regVCN_JPEG_DB_CTRL, 162 - ring->doorbell_index << VCN_JPEG_DB_CTRL__OFFSET__SHIFT | 163 - VCN_JPEG_DB_CTRL__EN_MASK); 164 - 165 158 r = amdgpu_ring_test_helper(ring); 166 159 if (r) 167 160 return r; ··· 328 335 329 336 if (adev->pm.dpm_enabled) 330 337 amdgpu_dpm_enable_jpeg(adev, true); 338 + 339 + /* doorbell programming is done for every playback */ 340 + adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell, 341 + (adev->doorbell_index.vcn.vcn_ring0_1 << 1), 0); 342 + 343 + WREG32_SOC15(VCN, 0, regVCN_JPEG_DB_CTRL, 344 + ring->doorbell_index << VCN_JPEG_DB_CTRL__OFFSET__SHIFT | 345 + VCN_JPEG_DB_CTRL__EN_MASK); 331 346 332 347 /* disable power gating */ 333 348 r = jpeg_v4_0_5_disable_static_power_gating(adev);
+2 -2
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
··· 813 813 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 814 814 int r; 815 815 816 + adev->sdma.num_instances = SDMA_MAX_INSTANCE; 817 + 816 818 r = sdma_v2_4_init_microcode(adev); 817 819 if (r) 818 820 return r; 819 - 820 - adev->sdma.num_instances = SDMA_MAX_INSTANCE; 821 821 822 822 sdma_v2_4_set_ring_funcs(adev); 823 823 sdma_v2_4_set_buffer_funcs(adev);
+28
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
··· 1643 1643 *flags |= AMD_CG_SUPPORT_SDMA_LS; 1644 1644 } 1645 1645 1646 + static void sdma_v5_2_ring_begin_use(struct amdgpu_ring *ring) 1647 + { 1648 + struct amdgpu_device *adev = ring->adev; 1649 + 1650 + /* SDMA 5.2.3 (RMB) FW doesn't seem to properly 1651 + * disallow GFXOFF in some cases leading to 1652 + * hangs in SDMA. Disallow GFXOFF while SDMA is active. 1653 + * We can probably just limit this to 5.2.3, 1654 + * but it shouldn't hurt for other parts since 1655 + * this GFXOFF will be disallowed anyway when SDMA is 1656 + * active, this just makes it explicit. 1657 + */ 1658 + amdgpu_gfx_off_ctrl(adev, false); 1659 + } 1660 + 1661 + static void sdma_v5_2_ring_end_use(struct amdgpu_ring *ring) 1662 + { 1663 + struct amdgpu_device *adev = ring->adev; 1664 + 1665 + /* SDMA 5.2.3 (RMB) FW doesn't seem to properly 1666 + * disallow GFXOFF in some cases leading to 1667 + * hangs in SDMA. Allow GFXOFF when SDMA is complete. 1668 + */ 1669 + amdgpu_gfx_off_ctrl(adev, true); 1670 + } 1671 + 1646 1672 const struct amd_ip_funcs sdma_v5_2_ip_funcs = { 1647 1673 .name = "sdma_v5_2", 1648 1674 .early_init = sdma_v5_2_early_init, ··· 1716 1690 .test_ib = sdma_v5_2_ring_test_ib, 1717 1691 .insert_nop = sdma_v5_2_ring_insert_nop, 1718 1692 .pad_ib = sdma_v5_2_ring_pad_ib, 1693 + .begin_use = sdma_v5_2_ring_begin_use, 1694 + .end_use = sdma_v5_2_ring_end_use, 1719 1695 .emit_wreg = sdma_v5_2_ring_emit_wreg, 1720 1696 .emit_reg_wait = sdma_v5_2_ring_emit_reg_wait, 1721 1697 .emit_reg_write_reg_wait = sdma_v5_2_ring_emit_reg_write_reg_wait,
+3
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 5182 5182 if (plane->type == DRM_PLANE_TYPE_CURSOR) 5183 5183 return; 5184 5184 5185 + if (new_plane_state->rotation != DRM_MODE_ROTATE_0) 5186 + goto ffu; 5187 + 5185 5188 num_clips = drm_plane_get_damage_clips_count(new_plane_state); 5186 5189 clips = drm_plane_get_damage_clips(new_plane_state); 5187 5190
+1
drivers/gpu/drm/amd/display/dc/dc_hw_types.h
··· 465 465 struct fixed31_32 v_scale_ratio; 466 466 enum dc_rotation_angle rotation; 467 467 bool mirror; 468 + struct dc_stream_state *stream; 468 469 }; 469 470 470 471 /* IPP related types */
+10 -2
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c
··· 1077 1077 if (src_y_offset < 0) 1078 1078 src_y_offset = 0; 1079 1079 /* Save necessary cursor info x, y position. w, h is saved in attribute func. */ 1080 - hubp->cur_rect.x = src_x_offset + param->viewport.x; 1081 - hubp->cur_rect.y = src_y_offset + param->viewport.y; 1080 + if (param->stream->link->psr_settings.psr_version >= DC_PSR_VERSION_SU_1 && 1081 + param->rotation != ROTATION_ANGLE_0) { 1082 + hubp->cur_rect.x = 0; 1083 + hubp->cur_rect.y = 0; 1084 + hubp->cur_rect.w = param->stream->timing.h_addressable; 1085 + hubp->cur_rect.h = param->stream->timing.v_addressable; 1086 + } else { 1087 + hubp->cur_rect.x = src_x_offset + param->viewport.x; 1088 + hubp->cur_rect.y = src_y_offset + param->viewport.y; 1089 + } 1082 1090 } 1083 1091 1084 1092 void hubp2_clk_cntl(struct hubp *hubp, bool enable)
+9 -5
drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c
··· 124 124 .phyclk_mhz = 600.0, 125 125 .phyclk_d18_mhz = 667.0, 126 126 .dscclk_mhz = 186.0, 127 - .dtbclk_mhz = 625.0, 127 + .dtbclk_mhz = 600.0, 128 128 }, 129 129 { 130 130 .state = 1, ··· 133 133 .phyclk_mhz = 810.0, 134 134 .phyclk_d18_mhz = 667.0, 135 135 .dscclk_mhz = 209.0, 136 - .dtbclk_mhz = 625.0, 136 + .dtbclk_mhz = 600.0, 137 137 }, 138 138 { 139 139 .state = 2, ··· 142 142 .phyclk_mhz = 810.0, 143 143 .phyclk_d18_mhz = 667.0, 144 144 .dscclk_mhz = 209.0, 145 - .dtbclk_mhz = 625.0, 145 + .dtbclk_mhz = 600.0, 146 146 }, 147 147 { 148 148 .state = 3, ··· 151 151 .phyclk_mhz = 810.0, 152 152 .phyclk_d18_mhz = 667.0, 153 153 .dscclk_mhz = 371.0, 154 - .dtbclk_mhz = 625.0, 154 + .dtbclk_mhz = 600.0, 155 155 }, 156 156 { 157 157 .state = 4, ··· 160 160 .phyclk_mhz = 810.0, 161 161 .phyclk_d18_mhz = 667.0, 162 162 .dscclk_mhz = 417.0, 163 - .dtbclk_mhz = 625.0, 163 + .dtbclk_mhz = 600.0, 164 164 }, 165 165 }, 166 166 .num_states = 5, ··· 348 348 clock_limits[i].socclk_mhz; 349 349 dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].memclk_mhz = 350 350 clk_table->entries[i].memclk_mhz * clk_table->entries[i].wck_ratio; 351 + dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dtbclk_mhz = 352 + clock_limits[i].dtbclk_mhz; 351 353 dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dcfclk_levels = 352 354 clk_table->num_entries; 353 355 dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_fclk_levels = ··· 361 359 dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_socclk_levels = 362 360 clk_table->num_entries; 363 361 dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_memclk_levels = 362 + clk_table->num_entries; 363 + dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dtbclk_levels = 364 364 clk_table->num_entries; 365 365 } 366 366 }
+8 -8
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c
··· 6329 6329 mode_lib->ms.NoOfDPPThisState, 6330 6330 mode_lib->ms.dpte_group_bytes, 6331 6331 s->HostVMInefficiencyFactor, 6332 - mode_lib->ms.soc.hostvm_min_page_size_kbytes * 1024, 6332 + mode_lib->ms.soc.hostvm_min_page_size_kbytes, 6333 6333 mode_lib->ms.cache_display_cfg.plane.HostVMMaxPageTableLevels); 6334 6334 6335 6335 s->NextMaxVStartup = s->MaxVStartupAllPlanes[j]; ··· 6542 6542 mode_lib->ms.cache_display_cfg.plane.HostVMEnable, 6543 6543 mode_lib->ms.cache_display_cfg.plane.HostVMMaxPageTableLevels, 6544 6544 mode_lib->ms.cache_display_cfg.plane.GPUVMEnable, 6545 - mode_lib->ms.soc.hostvm_min_page_size_kbytes * 1024, 6545 + mode_lib->ms.soc.hostvm_min_page_size_kbytes, 6546 6546 mode_lib->ms.PDEAndMetaPTEBytesPerFrame[j][k], 6547 6547 mode_lib->ms.MetaRowBytes[j][k], 6548 6548 mode_lib->ms.DPTEBytesPerRow[j][k], ··· 7687 7687 CalculateVMRowAndSwath_params->HostVMMaxNonCachedPageTableLevels = mode_lib->ms.cache_display_cfg.plane.HostVMMaxPageTableLevels; 7688 7688 CalculateVMRowAndSwath_params->GPUVMMaxPageTableLevels = mode_lib->ms.cache_display_cfg.plane.GPUVMMaxPageTableLevels; 7689 7689 CalculateVMRowAndSwath_params->GPUVMMinPageSizeKBytes = mode_lib->ms.cache_display_cfg.plane.GPUVMMinPageSizeKBytes; 7690 - CalculateVMRowAndSwath_params->HostVMMinPageSize = mode_lib->ms.soc.hostvm_min_page_size_kbytes * 1024; 7690 + CalculateVMRowAndSwath_params->HostVMMinPageSize = mode_lib->ms.soc.hostvm_min_page_size_kbytes; 7691 7691 CalculateVMRowAndSwath_params->PTEBufferModeOverrideEn = mode_lib->ms.cache_display_cfg.plane.PTEBufferModeOverrideEn; 7692 7692 CalculateVMRowAndSwath_params->PTEBufferModeOverrideVal = mode_lib->ms.cache_display_cfg.plane.PTEBufferMode; 7693 7693 CalculateVMRowAndSwath_params->PTEBufferSizeNotExceeded = mode_lib->ms.PTEBufferSizeNotExceededPerState; ··· 7957 7957 UseMinimumDCFCLK_params->GPUVMMaxPageTableLevels = mode_lib->ms.cache_display_cfg.plane.GPUVMMaxPageTableLevels; 7958 7958 UseMinimumDCFCLK_params->HostVMEnable = mode_lib->ms.cache_display_cfg.plane.HostVMEnable; 7959 7959 UseMinimumDCFCLK_params->NumberOfActiveSurfaces = mode_lib->ms.num_active_planes; 7960 - UseMinimumDCFCLK_params->HostVMMinPageSize = mode_lib->ms.soc.hostvm_min_page_size_kbytes * 1024; 7960 + UseMinimumDCFCLK_params->HostVMMinPageSize = mode_lib->ms.soc.hostvm_min_page_size_kbytes; 7961 7961 UseMinimumDCFCLK_params->HostVMMaxNonCachedPageTableLevels = mode_lib->ms.cache_display_cfg.plane.HostVMMaxPageTableLevels; 7962 7962 UseMinimumDCFCLK_params->DynamicMetadataVMEnabled = mode_lib->ms.ip.dynamic_metadata_vm_enabled; 7963 7963 UseMinimumDCFCLK_params->ImmediateFlipRequirement = s->ImmediateFlipRequiredFinal; ··· 8699 8699 CalculateVMRowAndSwath_params->HostVMMaxNonCachedPageTableLevels = mode_lib->ms.cache_display_cfg.plane.HostVMMaxPageTableLevels; 8700 8700 CalculateVMRowAndSwath_params->GPUVMMaxPageTableLevels = mode_lib->ms.cache_display_cfg.plane.GPUVMMaxPageTableLevels; 8701 8701 CalculateVMRowAndSwath_params->GPUVMMinPageSizeKBytes = mode_lib->ms.cache_display_cfg.plane.GPUVMMinPageSizeKBytes; 8702 - CalculateVMRowAndSwath_params->HostVMMinPageSize = mode_lib->ms.soc.hostvm_min_page_size_kbytes * 1024; 8702 + CalculateVMRowAndSwath_params->HostVMMinPageSize = mode_lib->ms.soc.hostvm_min_page_size_kbytes; 8703 8703 CalculateVMRowAndSwath_params->PTEBufferModeOverrideEn = mode_lib->ms.cache_display_cfg.plane.PTEBufferModeOverrideEn; 8704 8704 CalculateVMRowAndSwath_params->PTEBufferModeOverrideVal = mode_lib->ms.cache_display_cfg.plane.PTEBufferMode; 8705 8705 CalculateVMRowAndSwath_params->PTEBufferSizeNotExceeded = s->dummy_boolean_array[0]; ··· 8805 8805 mode_lib->ms.cache_display_cfg.hw.DPPPerSurface, 8806 8806 locals->dpte_group_bytes, 8807 8807 s->HostVMInefficiencyFactor, 8808 - mode_lib->ms.soc.hostvm_min_page_size_kbytes * 1024, 8808 + mode_lib->ms.soc.hostvm_min_page_size_kbytes, 8809 8809 mode_lib->ms.cache_display_cfg.plane.HostVMMaxPageTableLevels); 8810 8810 8811 8811 locals->TCalc = 24.0 / locals->DCFCLKDeepSleep; ··· 8995 8995 CalculatePrefetchSchedule_params->GPUVMEnable = mode_lib->ms.cache_display_cfg.plane.GPUVMEnable; 8996 8996 CalculatePrefetchSchedule_params->HostVMEnable = mode_lib->ms.cache_display_cfg.plane.HostVMEnable; 8997 8997 CalculatePrefetchSchedule_params->HostVMMaxNonCachedPageTableLevels = mode_lib->ms.cache_display_cfg.plane.HostVMMaxPageTableLevels; 8998 - CalculatePrefetchSchedule_params->HostVMMinPageSize = mode_lib->ms.soc.hostvm_min_page_size_kbytes * 1024; 8998 + CalculatePrefetchSchedule_params->HostVMMinPageSize = mode_lib->ms.soc.hostvm_min_page_size_kbytes; 8999 8999 CalculatePrefetchSchedule_params->DynamicMetadataEnable = mode_lib->ms.cache_display_cfg.plane.DynamicMetadataEnable[k]; 9000 9000 CalculatePrefetchSchedule_params->DynamicMetadataVMEnabled = mode_lib->ms.ip.dynamic_metadata_vm_enabled; 9001 9001 CalculatePrefetchSchedule_params->DynamicMetadataLinesBeforeActiveRequired = mode_lib->ms.cache_display_cfg.plane.DynamicMetadataLinesBeforeActiveRequired[k]; ··· 9240 9240 mode_lib->ms.cache_display_cfg.plane.HostVMEnable, 9241 9241 mode_lib->ms.cache_display_cfg.plane.HostVMMaxPageTableLevels, 9242 9242 mode_lib->ms.cache_display_cfg.plane.GPUVMEnable, 9243 - mode_lib->ms.soc.hostvm_min_page_size_kbytes * 1024, 9243 + mode_lib->ms.soc.hostvm_min_page_size_kbytes, 9244 9244 locals->PDEAndMetaPTEBytesFrame[k], 9245 9245 locals->MetaRowByte[k], 9246 9246 locals->PixelPTEBytesPerRow[k],
+3 -2
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c
··· 423 423 } 424 424 425 425 for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_dtbclk_levels; i++) { 426 - p->in_states->state_array[i].dtbclk_mhz = 427 - dml2->config.bbox_overrides.clks_table.clk_entries[i].dtbclk_mhz; 426 + if (dml2->config.bbox_overrides.clks_table.clk_entries[i].dtbclk_mhz > 0) 427 + p->in_states->state_array[i].dtbclk_mhz = 428 + dml2->config.bbox_overrides.clks_table.clk_entries[i].dtbclk_mhz; 428 429 } 429 430 430 431 for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_dispclk_levels; i++) {
+2 -1
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c
··· 3417 3417 .h_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.horz, 3418 3418 .v_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.vert, 3419 3419 .rotation = pipe_ctx->plane_state->rotation, 3420 - .mirror = pipe_ctx->plane_state->horizontal_mirror 3420 + .mirror = pipe_ctx->plane_state->horizontal_mirror, 3421 + .stream = pipe_ctx->stream, 3421 3422 }; 3422 3423 bool pipe_split_on = false; 3423 3424 bool odm_combine_on = (pipe_ctx->next_odm_pipe != NULL) ||
+2
drivers/gpu/drm/amd/display/modules/power/power_helpers.c
··· 839 839 ((dpcd_caps->sink_dev_id_str[1] == 0x08 && dpcd_caps->sink_dev_id_str[0] == 0x08) || 840 840 (dpcd_caps->sink_dev_id_str[1] == 0x08 && dpcd_caps->sink_dev_id_str[0] == 0x07))) 841 841 isPSRSUSupported = false; 842 + else if (dpcd_caps->sink_dev_id_str[1] == 0x08 && dpcd_caps->sink_dev_id_str[0] == 0x03) 843 + isPSRSUSupported = false; 842 844 else if (dpcd_caps->psr_info.force_psrsu_cap == 0x1) 843 845 isPSRSUSupported = true; 844 846 }
+2 -2
drivers/gpu/drm/amd/pm/amdgpu_pm.c
··· 2198 2198 } else if (DEVICE_ATTR_IS(xgmi_plpd_policy)) { 2199 2199 if (amdgpu_dpm_get_xgmi_plpd_mode(adev, NULL) == XGMI_PLPD_NONE) 2200 2200 *states = ATTR_STATE_UNSUPPORTED; 2201 - } else if (DEVICE_ATTR_IS(pp_dpm_mclk_od)) { 2201 + } else if (DEVICE_ATTR_IS(pp_mclk_od)) { 2202 2202 if (amdgpu_dpm_get_mclk_od(adev) == -EOPNOTSUPP) 2203 2203 *states = ATTR_STATE_UNSUPPORTED; 2204 - } else if (DEVICE_ATTR_IS(pp_dpm_sclk_od)) { 2204 + } else if (DEVICE_ATTR_IS(pp_sclk_od)) { 2205 2205 if (amdgpu_dpm_get_sclk_od(adev) == -EOPNOTSUPP) 2206 2206 *states = ATTR_STATE_UNSUPPORTED; 2207 2207 } else if (DEVICE_ATTR_IS(apu_thermal_cap)) {
+1 -1
drivers/gpu/drm/drm_auth.c
··· 236 236 drm_master_check_perm(struct drm_device *dev, struct drm_file *file_priv) 237 237 { 238 238 if (file_priv->was_master && 239 - rcu_access_pointer(file_priv->pid) == task_pid(current)) 239 + rcu_access_pointer(file_priv->pid) == task_tgid(current)) 240 240 return 0; 241 241 242 242 if (!capable(CAP_SYS_ADMIN))
+4 -4
drivers/gpu/drm/drm_crtc.c
··· 715 715 struct drm_mode_set set; 716 716 uint32_t __user *set_connectors_ptr; 717 717 struct drm_modeset_acquire_ctx ctx; 718 - int ret; 719 - int i; 718 + int ret, i, num_connectors = 0; 720 719 721 720 if (!drm_core_check_feature(dev, DRIVER_MODESET)) 722 721 return -EOPNOTSUPP; ··· 870 871 connector->name); 871 872 872 873 connector_set[i] = connector; 874 + num_connectors++; 873 875 } 874 876 } 875 877 ··· 879 879 set.y = crtc_req->y; 880 880 set.mode = mode; 881 881 set.connectors = connector_set; 882 - set.num_connectors = crtc_req->count_connectors; 882 + set.num_connectors = num_connectors; 883 883 set.fb = fb; 884 884 885 885 if (drm_drv_uses_atomic_modeset(dev)) ··· 892 892 drm_framebuffer_put(fb); 893 893 894 894 if (connector_set) { 895 - for (i = 0; i < crtc_req->count_connectors; i++) { 895 + for (i = 0; i < num_connectors; i++) { 896 896 if (connector_set[i]) 897 897 drm_connector_put(connector_set[i]); 898 898 }
+2 -1
drivers/gpu/drm/drm_edid.c
··· 2309 2309 2310 2310 override = drm_edid_override_get(connector); 2311 2311 if (override) { 2312 - num_modes = drm_edid_connector_update(connector, override); 2312 + if (drm_edid_connector_update(connector, override) == 0) 2313 + num_modes = drm_edid_connector_add_modes(connector); 2313 2314 2314 2315 drm_edid_free(override); 2315 2316
+16 -3
drivers/gpu/drm/i915/display/intel_fb.c
··· 1374 1374 struct drm_i915_private *i915 = to_i915(fb->base.dev); 1375 1375 unsigned int stride_tiles; 1376 1376 1377 - if (IS_ALDERLAKE_P(i915) || DISPLAY_VER(i915) >= 14) 1377 + if ((IS_ALDERLAKE_P(i915) || DISPLAY_VER(i915) >= 14) && 1378 + src_stride_tiles < dst_stride_tiles) 1378 1379 stride_tiles = src_stride_tiles; 1379 1380 else 1380 1381 stride_tiles = dst_stride_tiles; ··· 1502 1501 1503 1502 size += remap_info->size; 1504 1503 } else { 1505 - unsigned int dst_stride = plane_view_dst_stride_tiles(fb, color_plane, 1506 - remap_info->width); 1504 + unsigned int dst_stride; 1505 + 1506 + /* 1507 + * The hardware automagically calculates the CCS AUX surface 1508 + * stride from the main surface stride so can't really remap a 1509 + * smaller subset (unless we'd remap in whole AUX page units). 1510 + */ 1511 + if (intel_fb_needs_pot_stride_remap(fb) && 1512 + intel_fb_is_ccs_modifier(fb->base.modifier)) 1513 + dst_stride = remap_info->src_stride; 1514 + else 1515 + dst_stride = remap_info->width; 1516 + 1517 + dst_stride = plane_view_dst_stride_tiles(fb, color_plane, dst_stride); 1507 1518 1508 1519 assign_chk_ovf(i915, remap_info->dst_stride, dst_stride); 1509 1520 color_plane_info->mapping_stride = dst_stride *
+1 -1
drivers/gpu/drm/i915/display/skl_scaler.c
··· 504 504 { 505 505 struct drm_plane *plane = NULL; 506 506 struct intel_plane *intel_plane; 507 - struct intel_plane_state *plane_state = NULL; 508 507 struct intel_crtc_scaler_state *scaler_state = 509 508 &crtc_state->scaler_state; 510 509 struct drm_atomic_state *drm_state = crtc_state->uapi.state; ··· 535 536 536 537 /* walkthrough scaler_users bits and start assigning scalers */ 537 538 for (i = 0; i < sizeof(scaler_state->scaler_users) * 8; i++) { 539 + struct intel_plane_state *plane_state = NULL; 538 540 int *scaler_id; 539 541 const char *name; 540 542 int idx, ret;
+1 -1
drivers/gpu/drm/i915/gt/intel_reset.c
··· 1293 1293 if (msg) 1294 1294 drm_notice(&engine->i915->drm, 1295 1295 "Resetting %s for %s\n", engine->name, msg); 1296 - atomic_inc(&engine->i915->gpu_error.reset_engine_count[engine->uabi_class]); 1296 + i915_increase_reset_engine_count(&engine->i915->gpu_error, engine); 1297 1297 1298 1298 ret = intel_gt_reset_engine(engine); 1299 1299 if (ret) {
+3 -2
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
··· 5001 5001 if (match) { 5002 5002 intel_engine_set_hung_context(e, ce); 5003 5003 engine_mask |= e->mask; 5004 - atomic_inc(&i915->gpu_error.reset_engine_count[e->uabi_class]); 5004 + i915_increase_reset_engine_count(&i915->gpu_error, 5005 + e); 5005 5006 } 5006 5007 } 5007 5008 ··· 5014 5013 } else { 5015 5014 intel_engine_set_hung_context(ce->engine, ce); 5016 5015 engine_mask = ce->engine->mask; 5017 - atomic_inc(&i915->gpu_error.reset_engine_count[ce->engine->uabi_class]); 5016 + i915_increase_reset_engine_count(&i915->gpu_error, ce->engine); 5018 5017 } 5019 5018 5020 5019 with_intel_runtime_pm(&i915->runtime_pm, wakeref)
+10 -2
drivers/gpu/drm/i915/i915_gpu_error.h
··· 16 16 17 17 #include "display/intel_display_device.h" 18 18 #include "gt/intel_engine.h" 19 + #include "gt/intel_engine_types.h" 19 20 #include "gt/intel_gt_types.h" 20 21 #include "gt/uc/intel_uc_fw.h" 21 22 ··· 233 232 atomic_t reset_count; 234 233 235 234 /** Number of times an engine has been reset */ 236 - atomic_t reset_engine_count[I915_NUM_ENGINES]; 235 + atomic_t reset_engine_count[MAX_ENGINE_CLASS]; 237 236 }; 238 237 239 238 struct drm_i915_error_state_buf { ··· 256 255 static inline u32 i915_reset_engine_count(struct i915_gpu_error *error, 257 256 const struct intel_engine_cs *engine) 258 257 { 259 - return atomic_read(&error->reset_engine_count[engine->uabi_class]); 258 + return atomic_read(&error->reset_engine_count[engine->class]); 259 + } 260 + 261 + static inline void 262 + i915_increase_reset_engine_count(struct i915_gpu_error *error, 263 + const struct intel_engine_cs *engine) 264 + { 265 + atomic_inc(&error->reset_engine_count[engine->class]); 260 266 } 261 267 262 268 #define CORE_DUMP_FLAG_NONE 0x0
+5 -4
drivers/gpu/drm/i915/selftests/igt_live_test.c
··· 37 37 } 38 38 39 39 for_each_engine(engine, gt, id) 40 - t->reset_engine[id] = 41 - i915_reset_engine_count(&i915->gpu_error, engine); 40 + t->reset_engine[i][id] = 41 + i915_reset_engine_count(&i915->gpu_error, 42 + engine); 42 43 } 43 44 44 45 t->reset_global = i915_reset_count(&i915->gpu_error); ··· 67 66 68 67 for_each_gt(gt, i915, i) { 69 68 for_each_engine(engine, gt, id) { 70 - if (t->reset_engine[id] == 69 + if (t->reset_engine[i][id] == 71 70 i915_reset_engine_count(&i915->gpu_error, engine)) 72 71 continue; 73 72 74 73 gt_err(gt, "%s(%s): engine '%s' was reset %d times!\n", 75 74 t->func, t->name, engine->name, 76 75 i915_reset_engine_count(&i915->gpu_error, engine) - 77 - t->reset_engine[id]); 76 + t->reset_engine[i][id]); 78 77 return -EIO; 79 78 } 80 79 }
+2 -1
drivers/gpu/drm/i915/selftests/igt_live_test.h
··· 7 7 #ifndef IGT_LIVE_TEST_H 8 8 #define IGT_LIVE_TEST_H 9 9 10 + #include "gt/intel_gt_defines.h" /* for I915_MAX_GT */ 10 11 #include "gt/intel_engine.h" /* for I915_NUM_ENGINES */ 11 12 12 13 struct drm_i915_private; ··· 18 17 const char *name; 19 18 20 19 unsigned int reset_global; 21 - unsigned int reset_engine[I915_NUM_ENGINES]; 20 + unsigned int reset_engine[I915_MAX_GT][I915_NUM_ENGINES]; 22 21 }; 23 22 24 23 /*
+1 -1
drivers/gpu/drm/mediatek/mtk_disp_gamma.c
··· 203 203 /* Disable RELAY mode to pass the processed image */ 204 204 cfg_val &= ~GAMMA_RELAY_MODE; 205 205 206 - cfg_val = readl(gamma->regs + DISP_GAMMA_CFG); 206 + writel(cfg_val, gamma->regs + DISP_GAMMA_CFG); 207 207 } 208 208 209 209 void mtk_gamma_config(struct device *dev, unsigned int w,
+13 -1
drivers/gpu/drm/mediatek/mtk_drm_crtc.c
··· 788 788 crtc); 789 789 struct mtk_crtc_state *mtk_crtc_state = to_mtk_crtc_state(crtc_state); 790 790 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); 791 + unsigned long flags; 791 792 792 793 if (mtk_crtc->event && mtk_crtc_state->base.event) 793 794 DRM_ERROR("new event while there is still a pending event\n"); ··· 796 795 if (mtk_crtc_state->base.event) { 797 796 mtk_crtc_state->base.event->pipe = drm_crtc_index(crtc); 798 797 WARN_ON(drm_crtc_vblank_get(crtc) != 0); 798 + 799 + spin_lock_irqsave(&crtc->dev->event_lock, flags); 799 800 mtk_crtc->event = mtk_crtc_state->base.event; 801 + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); 802 + 800 803 mtk_crtc_state->base.event = NULL; 801 804 } 802 805 } ··· 926 921 927 922 struct device *mtk_drm_crtc_dma_dev_get(struct drm_crtc *crtc) 928 923 { 929 - struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); 924 + struct mtk_drm_crtc *mtk_crtc = NULL; 925 + 926 + if (!crtc) 927 + return NULL; 928 + 929 + mtk_crtc = to_mtk_crtc(crtc); 930 + if (!mtk_crtc) 931 + return NULL; 930 932 931 933 return mtk_crtc->dma_dev; 932 934 }
+4 -1
drivers/gpu/drm/mediatek/mtk_drm_drv.c
··· 443 443 struct mtk_drm_private *private = drm->dev_private; 444 444 struct mtk_drm_private *priv_n; 445 445 struct device *dma_dev = NULL; 446 + struct drm_crtc *crtc; 446 447 int ret, i, j; 447 448 448 449 if (drm_firmware_drivers_only()) ··· 520 519 } 521 520 522 521 /* Use OVL device for all DMA memory allocations */ 523 - dma_dev = mtk_drm_crtc_dma_dev_get(drm_crtc_from_index(drm, 0)); 522 + crtc = drm_crtc_from_index(drm, 0); 523 + if (crtc) 524 + dma_dev = mtk_drm_crtc_dma_dev_get(crtc); 524 525 if (!dma_dev) { 525 526 ret = -ENODEV; 526 527 dev_err(drm->dev, "Need at least one OVL device\n");
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c
··· 385 385 386 386 /* Ensure an ior is hooked up to this outp already */ 387 387 ior = outp->func->inherit(outp); 388 - if (!ior) 388 + if (!ior || !ior->arm.head) 389 389 return -ENODEV; 390 390 391 391 /* With iors, there will be a separate output path for each type of connector - and all of
+9 -9
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
··· 49 49 #include <subdev/mmu.h> 50 50 51 51 struct gk20a_instobj { 52 - struct nvkm_memory memory; 52 + struct nvkm_instobj base; 53 53 struct nvkm_mm_node *mn; 54 54 struct gk20a_instmem *imem; 55 55 56 56 /* CPU mapping */ 57 57 u32 *vaddr; 58 58 }; 59 - #define gk20a_instobj(p) container_of((p), struct gk20a_instobj, memory) 59 + #define gk20a_instobj(p) container_of((p), struct gk20a_instobj, base.memory) 60 60 61 61 /* 62 62 * Used for objects allocated using the DMA API ··· 148 148 list_del(&obj->vaddr_node); 149 149 vunmap(obj->base.vaddr); 150 150 obj->base.vaddr = NULL; 151 - imem->vaddr_use -= nvkm_memory_size(&obj->base.memory); 151 + imem->vaddr_use -= nvkm_memory_size(&obj->base.base.memory); 152 152 nvkm_debug(&imem->base.subdev, "vaddr used: %x/%x\n", imem->vaddr_use, 153 153 imem->vaddr_max); 154 154 } ··· 283 283 { 284 284 struct gk20a_instobj *node = gk20a_instobj(memory); 285 285 struct nvkm_vmm_map map = { 286 - .memory = &node->memory, 286 + .memory = &node->base.memory, 287 287 .offset = offset, 288 288 .mem = node->mn, 289 289 }; ··· 391 391 return -ENOMEM; 392 392 *_node = &node->base; 393 393 394 - nvkm_memory_ctor(&gk20a_instobj_func_dma, &node->base.memory); 395 - node->base.memory.ptrs = &gk20a_instobj_ptrs; 394 + nvkm_memory_ctor(&gk20a_instobj_func_dma, &node->base.base.memory); 395 + node->base.base.memory.ptrs = &gk20a_instobj_ptrs; 396 396 397 397 node->base.vaddr = dma_alloc_attrs(dev, npages << PAGE_SHIFT, 398 398 &node->handle, GFP_KERNEL, ··· 438 438 *_node = &node->base; 439 439 node->dma_addrs = (void *)(node->pages + npages); 440 440 441 - nvkm_memory_ctor(&gk20a_instobj_func_iommu, &node->base.memory); 442 - node->base.memory.ptrs = &gk20a_instobj_ptrs; 441 + nvkm_memory_ctor(&gk20a_instobj_func_iommu, &node->base.base.memory); 442 + node->base.base.memory.ptrs = &gk20a_instobj_ptrs; 443 443 444 444 /* Allocate backing memory */ 445 445 for (i = 0; i < npages; i++) { ··· 533 533 else 534 534 ret = gk20a_instobj_ctor_dma(imem, size >> PAGE_SHIFT, 535 535 align, &node); 536 - *pmemory = node ? &node->memory : NULL; 536 + *pmemory = node ? &node->base.memory : NULL; 537 537 if (ret) 538 538 return ret; 539 539
+1 -1
drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
··· 326 326 static const struct ltk050h3146w_desc ltk050h3148w_data = { 327 327 .mode = &ltk050h3148w_mode, 328 328 .init = ltk050h3148w_init_sequence, 329 - .mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE, 329 + .mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE | MIPI_DSI_MODE_VIDEO_BURST, 330 330 }; 331 331 332 332 static int ltk050h3146w_init_sequence(struct ltk050h3146w *ctx)
+42 -29
drivers/hid/hid-nintendo.c
··· 325 325 * All the controller's button values are stored in a u32. 326 326 * They can be accessed with bitwise ANDs. 327 327 */ 328 - static const u32 JC_BTN_Y = BIT(0); 329 - static const u32 JC_BTN_X = BIT(1); 330 - static const u32 JC_BTN_B = BIT(2); 331 - static const u32 JC_BTN_A = BIT(3); 332 - static const u32 JC_BTN_SR_R = BIT(4); 333 - static const u32 JC_BTN_SL_R = BIT(5); 334 - static const u32 JC_BTN_R = BIT(6); 335 - static const u32 JC_BTN_ZR = BIT(7); 336 - static const u32 JC_BTN_MINUS = BIT(8); 337 - static const u32 JC_BTN_PLUS = BIT(9); 338 - static const u32 JC_BTN_RSTICK = BIT(10); 339 - static const u32 JC_BTN_LSTICK = BIT(11); 340 - static const u32 JC_BTN_HOME = BIT(12); 341 - static const u32 JC_BTN_CAP = BIT(13); /* capture button */ 342 - static const u32 JC_BTN_DOWN = BIT(16); 343 - static const u32 JC_BTN_UP = BIT(17); 344 - static const u32 JC_BTN_RIGHT = BIT(18); 345 - static const u32 JC_BTN_LEFT = BIT(19); 346 - static const u32 JC_BTN_SR_L = BIT(20); 347 - static const u32 JC_BTN_SL_L = BIT(21); 348 - static const u32 JC_BTN_L = BIT(22); 349 - static const u32 JC_BTN_ZL = BIT(23); 328 + #define JC_BTN_Y BIT(0) 329 + #define JC_BTN_X BIT(1) 330 + #define JC_BTN_B BIT(2) 331 + #define JC_BTN_A BIT(3) 332 + #define JC_BTN_SR_R BIT(4) 333 + #define JC_BTN_SL_R BIT(5) 334 + #define JC_BTN_R BIT(6) 335 + #define JC_BTN_ZR BIT(7) 336 + #define JC_BTN_MINUS BIT(8) 337 + #define JC_BTN_PLUS BIT(9) 338 + #define JC_BTN_RSTICK BIT(10) 339 + #define JC_BTN_LSTICK BIT(11) 340 + #define JC_BTN_HOME BIT(12) 341 + #define JC_BTN_CAP BIT(13) /* capture button */ 342 + #define JC_BTN_DOWN BIT(16) 343 + #define JC_BTN_UP BIT(17) 344 + #define JC_BTN_RIGHT BIT(18) 345 + #define JC_BTN_LEFT BIT(19) 346 + #define JC_BTN_SR_L BIT(20) 347 + #define JC_BTN_SL_L BIT(21) 348 + #define JC_BTN_L BIT(22) 349 + #define JC_BTN_ZL BIT(23) 350 350 351 351 enum joycon_msg_type { 352 352 JOYCON_MSG_TYPE_NONE, ··· 927 927 */ 928 928 static void joycon_calc_imu_cal_divisors(struct joycon_ctlr *ctlr) 929 929 { 930 - int i; 930 + int i, divz = 0; 931 931 932 932 for (i = 0; i < 3; i++) { 933 933 ctlr->imu_cal_accel_divisor[i] = ctlr->accel_cal.scale[i] - 934 934 ctlr->accel_cal.offset[i]; 935 935 ctlr->imu_cal_gyro_divisor[i] = ctlr->gyro_cal.scale[i] - 936 936 ctlr->gyro_cal.offset[i]; 937 + 938 + if (ctlr->imu_cal_accel_divisor[i] == 0) { 939 + ctlr->imu_cal_accel_divisor[i] = 1; 940 + divz++; 941 + } 942 + 943 + if (ctlr->imu_cal_gyro_divisor[i] == 0) { 944 + ctlr->imu_cal_gyro_divisor[i] = 1; 945 + divz++; 946 + } 937 947 } 948 + 949 + if (divz) 950 + hid_warn(ctlr->hdev, "inaccurate IMU divisors (%d)\n", divz); 938 951 } 939 952 940 953 static const s16 DFLT_ACCEL_OFFSET /*= 0*/; ··· 1176 1163 JC_IMU_SAMPLES_PER_DELTA_AVG) { 1177 1164 ctlr->imu_avg_delta_ms = ctlr->imu_delta_samples_sum / 1178 1165 ctlr->imu_delta_samples_count; 1179 - /* don't ever want divide by zero shenanigans */ 1180 - if (ctlr->imu_avg_delta_ms == 0) { 1181 - ctlr->imu_avg_delta_ms = 1; 1182 - hid_warn(ctlr->hdev, 1183 - "calculated avg imu delta of 0\n"); 1184 - } 1185 1166 ctlr->imu_delta_samples_count = 0; 1186 1167 ctlr->imu_delta_samples_sum = 0; 1168 + } 1169 + 1170 + /* don't ever want divide by zero shenanigans */ 1171 + if (ctlr->imu_avg_delta_ms == 0) { 1172 + ctlr->imu_avg_delta_ms = 1; 1173 + hid_warn(ctlr->hdev, "calculated avg imu delta of 0\n"); 1187 1174 } 1188 1175 1189 1176 /* useful for debugging IMU sample rate */
+1
drivers/md/Kconfig
··· 660 660 661 661 config DM_AUDIT 662 662 bool "DM audit events" 663 + depends on BLK_DEV_DM 663 664 depends on AUDIT 664 665 help 665 666 Generate audit events for device-mapper.
+6 -5
drivers/md/dm-integrity.c
··· 1755 1755 sectors_to_process = dio->range.n_sectors; 1756 1756 1757 1757 __bio_for_each_segment(bv, bio, iter, dio->bio_details.bi_iter) { 1758 + struct bio_vec bv_copy = bv; 1758 1759 unsigned int pos; 1759 1760 char *mem, *checksums_ptr; 1760 1761 1761 1762 again: 1762 - mem = bvec_kmap_local(&bv); 1763 + mem = bvec_kmap_local(&bv_copy); 1763 1764 pos = 0; 1764 1765 checksums_ptr = checksums; 1765 1766 do { ··· 1769 1768 sectors_to_process -= ic->sectors_per_block; 1770 1769 pos += ic->sectors_per_block << SECTOR_SHIFT; 1771 1770 sector += ic->sectors_per_block; 1772 - } while (pos < bv.bv_len && sectors_to_process && checksums != checksums_onstack); 1771 + } while (pos < bv_copy.bv_len && sectors_to_process && checksums != checksums_onstack); 1773 1772 kunmap_local(mem); 1774 1773 1775 1774 r = dm_integrity_rw_tag(ic, checksums, &dio->metadata_block, &dio->metadata_offset, ··· 1794 1793 if (!sectors_to_process) 1795 1794 break; 1796 1795 1797 - if (unlikely(pos < bv.bv_len)) { 1798 - bv.bv_offset += pos; 1799 - bv.bv_len -= pos; 1796 + if (unlikely(pos < bv_copy.bv_len)) { 1797 + bv_copy.bv_offset += pos; 1798 + bv_copy.bv_len -= pos; 1800 1799 goto again; 1801 1800 } 1802 1801 }
+3
drivers/md/dm-raid.c
··· 3317 3317 mddev_lock_nointr(&rs->md); 3318 3318 md_stop(&rs->md); 3319 3319 mddev_unlock(&rs->md); 3320 + 3321 + if (work_pending(&rs->md.event_work)) 3322 + flush_work(&rs->md.event_work); 3320 3323 raid_set_free(rs); 3321 3324 } 3322 3325
+8 -3
drivers/md/md.c
··· 82 82 83 83 static DECLARE_WAIT_QUEUE_HEAD(resync_wait); 84 84 static struct workqueue_struct *md_wq; 85 + 86 + /* 87 + * This workqueue is used for sync_work to register new sync_thread, and for 88 + * del_work to remove rdev, and for event_work that is only set by dm-raid. 89 + * 90 + * Noted that sync_work will grab reconfig_mutex, hence never flush this 91 + * workqueue whith reconfig_mutex grabbed. 92 + */ 85 93 static struct workqueue_struct *md_misc_wq; 86 94 struct workqueue_struct *md_bitmap_wq; 87 95 ··· 6338 6330 struct md_personality *pers = mddev->pers; 6339 6331 md_bitmap_destroy(mddev); 6340 6332 mddev_detach(mddev); 6341 - /* Ensure ->event_work is done */ 6342 - if (mddev->event_work.func) 6343 - flush_workqueue(md_misc_wq); 6344 6333 spin_lock(&mddev->lock); 6345 6334 mddev->pers = NULL; 6346 6335 spin_unlock(&mddev->lock);
+4 -1
drivers/net/ethernet/atheros/atl1e/atl1e_main.c
··· 866 866 netdev_err(adapter->netdev, "offset(%d) > ring size(%d) !!\n", 867 867 offset, adapter->ring_size); 868 868 err = -1; 869 - goto failed; 869 + goto free_buffer; 870 870 } 871 871 872 872 return 0; 873 + free_buffer: 874 + kfree(tx_ring->tx_buffer); 875 + tx_ring->tx_buffer = NULL; 873 876 failed: 874 877 if (adapter->ring_vir_addr != NULL) { 875 878 dma_free_coherent(&pdev->dev, adapter->ring_size,
+2 -9
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
··· 59 59 for (i = 0; i < num_frags ; i++) { 60 60 skb_frag_t *frag = &sinfo->frags[i]; 61 61 struct bnxt_sw_tx_bd *frag_tx_buf; 62 - struct pci_dev *pdev = bp->pdev; 63 62 dma_addr_t frag_mapping; 64 63 int frag_len; 65 64 ··· 72 73 txbd = &txr->tx_desc_ring[TX_RING(bp, prod)][TX_IDX(prod)]; 73 74 74 75 frag_len = skb_frag_size(frag); 75 - frag_mapping = skb_frag_dma_map(&pdev->dev, frag, 0, 76 - frag_len, DMA_TO_DEVICE); 77 - 78 - if (unlikely(dma_mapping_error(&pdev->dev, frag_mapping))) 79 - return NULL; 80 - 81 - dma_unmap_addr_set(frag_tx_buf, mapping, frag_mapping); 82 - 83 76 flags = frag_len << TX_BD_LEN_SHIFT; 84 77 txbd->tx_bd_len_flags_type = cpu_to_le32(flags); 78 + frag_mapping = page_pool_get_dma_addr(skb_frag_page(frag)) + 79 + skb_frag_off(frag); 85 80 txbd->tx_bd_haddr = cpu_to_le64(frag_mapping); 86 81 87 82 len = frag_len;
+1 -1
drivers/net/ethernet/intel/i40e/i40e_register.h
··· 207 207 #define I40E_GLGEN_MSCA_OPCODE_SHIFT 26 208 208 #define I40E_GLGEN_MSCA_OPCODE_MASK(_i) I40E_MASK(_i, I40E_GLGEN_MSCA_OPCODE_SHIFT) 209 209 #define I40E_GLGEN_MSCA_STCODE_SHIFT 28 210 - #define I40E_GLGEN_MSCA_STCODE_MASK I40E_MASK(0x1, I40E_GLGEN_MSCA_STCODE_SHIFT) 210 + #define I40E_GLGEN_MSCA_STCODE_MASK(_i) I40E_MASK(_i, I40E_GLGEN_MSCA_STCODE_SHIFT) 211 211 #define I40E_GLGEN_MSCA_MDICMD_SHIFT 30 212 212 #define I40E_GLGEN_MSCA_MDICMD_MASK I40E_MASK(0x1, I40E_GLGEN_MSCA_MDICMD_SHIFT) 213 213 #define I40E_GLGEN_MSCA_MDIINPROGEN_SHIFT 31
+2 -2
drivers/net/ethernet/intel/i40e/i40e_type.h
··· 37 37 #define I40E_QTX_CTL_VM_QUEUE 0x1 38 38 #define I40E_QTX_CTL_PF_QUEUE 0x2 39 39 40 - #define I40E_MDIO_CLAUSE22_STCODE_MASK I40E_GLGEN_MSCA_STCODE_MASK 40 + #define I40E_MDIO_CLAUSE22_STCODE_MASK I40E_GLGEN_MSCA_STCODE_MASK(1) 41 41 #define I40E_MDIO_CLAUSE22_OPCODE_WRITE_MASK I40E_GLGEN_MSCA_OPCODE_MASK(1) 42 42 #define I40E_MDIO_CLAUSE22_OPCODE_READ_MASK I40E_GLGEN_MSCA_OPCODE_MASK(2) 43 43 44 - #define I40E_MDIO_CLAUSE45_STCODE_MASK I40E_GLGEN_MSCA_STCODE_MASK 44 + #define I40E_MDIO_CLAUSE45_STCODE_MASK I40E_GLGEN_MSCA_STCODE_MASK(0) 45 45 #define I40E_MDIO_CLAUSE45_OPCODE_ADDRESS_MASK I40E_GLGEN_MSCA_OPCODE_MASK(0) 46 46 #define I40E_MDIO_CLAUSE45_OPCODE_WRITE_MASK I40E_GLGEN_MSCA_OPCODE_MASK(1) 47 47 #define I40E_MDIO_CLAUSE45_OPCODE_READ_MASK I40E_GLGEN_MSCA_OPCODE_MASK(3)
+2 -2
drivers/net/ethernet/intel/ice/ice_ethtool.c
··· 1847 1847 linkmode_zero(ks->link_modes.supported); 1848 1848 linkmode_zero(ks->link_modes.advertising); 1849 1849 1850 - for (i = 0; i < BITS_PER_TYPE(u64); i++) { 1850 + for (i = 0; i < ARRAY_SIZE(phy_type_low_lkup); i++) { 1851 1851 if (phy_types_low & BIT_ULL(i)) 1852 1852 ice_linkmode_set_bit(&phy_type_low_lkup[i], ks, 1853 1853 req_speeds, advert_phy_type_lo, 1854 1854 i); 1855 1855 } 1856 1856 1857 - for (i = 0; i < BITS_PER_TYPE(u64); i++) { 1857 + for (i = 0; i < ARRAY_SIZE(phy_type_high_lkup); i++) { 1858 1858 if (phy_types_high & BIT_ULL(i)) 1859 1859 ice_linkmode_set_bit(&phy_type_high_lkup[i], ks, 1860 1860 req_speeds, advert_phy_type_hi,
+2
drivers/net/ethernet/intel/ice/ice_lag.c
··· 1981 1981 int n, err; 1982 1982 1983 1983 ice_lag_init_feature_support_flag(pf); 1984 + if (!ice_is_feature_supported(pf, ICE_F_SRIOV_LAG)) 1985 + return 0; 1984 1986 1985 1987 pf->lag = kzalloc(sizeof(*lag), GFP_KERNEL); 1986 1988 if (!pf->lag)
+3 -4
drivers/net/ethernet/intel/ice/ice_lib.c
··· 2358 2358 } else { 2359 2359 max_txqs[i] = vsi->alloc_txq; 2360 2360 } 2361 + 2362 + if (vsi->type == ICE_VSI_PF) 2363 + max_txqs[i] += vsi->num_xdp_txq; 2361 2364 } 2362 2365 2363 2366 dev_dbg(dev, "vsi->tc_cfg.ena_tc = %d\n", vsi->tc_cfg.ena_tc); ··· 2614 2611 if (vsi->type == ICE_VSI_VF && 2615 2612 vsi->agg_node && vsi->agg_node->valid) 2616 2613 vsi->agg_node->num_vsis--; 2617 - if (vsi->agg_node) { 2618 - vsi->agg_node->valid = false; 2619 - vsi->agg_node->agg_id = 0; 2620 - } 2621 2614 } 2622 2615 2623 2616 /**
+14 -3
drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c
··· 399 399 static int otx2_dcbnl_ieee_setpfc(struct net_device *dev, struct ieee_pfc *pfc) 400 400 { 401 401 struct otx2_nic *pfvf = netdev_priv(dev); 402 + u8 old_pfc_en; 402 403 int err; 403 404 404 - /* Save PFC configuration to interface */ 405 + old_pfc_en = pfvf->pfc_en; 405 406 pfvf->pfc_en = pfc->pfc_en; 406 407 407 408 if (pfvf->hw.tx_queues >= NIX_PF_PFC_PRIO_MAX) ··· 412 411 * supported by the tx queue configuration 413 412 */ 414 413 err = otx2_check_pfc_config(pfvf); 415 - if (err) 414 + if (err) { 415 + pfvf->pfc_en = old_pfc_en; 416 416 return err; 417 + } 417 418 418 419 process_pfc: 419 420 err = otx2_config_priority_flow_ctrl(pfvf); 420 - if (err) 421 + if (err) { 422 + pfvf->pfc_en = old_pfc_en; 421 423 return err; 424 + } 422 425 423 426 /* Request Per channel Bpids */ 424 427 if (pfc->pfc_en) ··· 430 425 431 426 err = otx2_pfc_txschq_update(pfvf); 432 427 if (err) { 428 + if (pfc->pfc_en) 429 + otx2_nix_config_bp(pfvf, false); 430 + 431 + otx2_pfc_txschq_stop(pfvf); 432 + pfvf->pfc_en = old_pfc_en; 433 + otx2_config_priority_flow_ctrl(pfvf); 433 434 dev_err(pfvf->dev, "%s failed to update TX schedulers\n", __func__); 434 435 return err; 435 436 }
+3
drivers/net/ethernet/mediatek/mtk_wed_wo.c
··· 292 292 for (i = 0; i < q->n_desc; i++) { 293 293 struct mtk_wed_wo_queue_entry *entry = &q->entry[i]; 294 294 295 + if (!entry->buf) 296 + continue; 297 + 295 298 dma_unmap_single(wo->hw->dev, entry->addr, entry->len, 296 299 DMA_TO_DEVICE); 297 300 skb_free_frag(entry->buf);
+7 -5
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
··· 156 156 return token; 157 157 } 158 158 159 - static int cmd_alloc_index(struct mlx5_cmd *cmd) 159 + static int cmd_alloc_index(struct mlx5_cmd *cmd, struct mlx5_cmd_work_ent *ent) 160 160 { 161 161 unsigned long flags; 162 162 int ret; 163 163 164 164 spin_lock_irqsave(&cmd->alloc_lock, flags); 165 165 ret = find_first_bit(&cmd->vars.bitmask, cmd->vars.max_reg_cmds); 166 - if (ret < cmd->vars.max_reg_cmds) 166 + if (ret < cmd->vars.max_reg_cmds) { 167 167 clear_bit(ret, &cmd->vars.bitmask); 168 + ent->idx = ret; 169 + cmd->ent_arr[ent->idx] = ent; 170 + } 168 171 spin_unlock_irqrestore(&cmd->alloc_lock, flags); 169 172 170 173 return ret < cmd->vars.max_reg_cmds ? ret : -ENOMEM; ··· 982 979 sem = ent->page_queue ? &cmd->vars.pages_sem : &cmd->vars.sem; 983 980 down(sem); 984 981 if (!ent->page_queue) { 985 - alloc_ret = cmd_alloc_index(cmd); 982 + alloc_ret = cmd_alloc_index(cmd, ent); 986 983 if (alloc_ret < 0) { 987 984 mlx5_core_err_rl(dev, "failed to allocate command entry\n"); 988 985 if (ent->callback) { ··· 997 994 up(sem); 998 995 return; 999 996 } 1000 - ent->idx = alloc_ret; 1001 997 } else { 1002 998 ent->idx = cmd->vars.max_reg_cmds; 1003 999 spin_lock_irqsave(&cmd->alloc_lock, flags); 1004 1000 clear_bit(ent->idx, &cmd->vars.bitmask); 1001 + cmd->ent_arr[ent->idx] = ent; 1005 1002 spin_unlock_irqrestore(&cmd->alloc_lock, flags); 1006 1003 } 1007 1004 1008 - cmd->ent_arr[ent->idx] = ent; 1009 1005 lay = get_inst(cmd, ent->idx); 1010 1006 ent->lay = lay; 1011 1007 memset(lay, 0, sizeof(*lay));
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c
··· 718 718 719 719 while (block_timestamp > tracer->last_timestamp) { 720 720 /* Check block override if it's not the first block */ 721 - if (!tracer->last_timestamp) { 721 + if (tracer->last_timestamp) { 722 722 u64 *ts_event; 723 723 /* To avoid block override be the HW in case of buffer 724 724 * wraparound, the time stamp of the previous block
+1
drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c
··· 154 154 in = kvzalloc(inlen, GFP_KERNEL); 155 155 if (!in || !ft->g) { 156 156 kfree(ft->g); 157 + ft->g = NULL; 157 158 kvfree(in); 158 159 return -ENOMEM; 159 160 }
+3 -2
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c
··· 197 197 } 198 198 esw_attr->dests[esw_attr->out_count].flags |= MLX5_ESW_DEST_ENCAP; 199 199 esw_attr->out_count++; 200 - /* attr->dests[].rep is resolved when we handle encap */ 200 + /* attr->dests[].vport is resolved when we handle encap */ 201 201 202 202 return 0; 203 203 } ··· 270 270 271 271 out_priv = netdev_priv(out_dev); 272 272 rpriv = out_priv->ppriv; 273 - esw_attr->dests[esw_attr->out_count].rep = rpriv->rep; 273 + esw_attr->dests[esw_attr->out_count].vport_valid = true; 274 + esw_attr->dests[esw_attr->out_count].vport = rpriv->rep->vport; 274 275 esw_attr->dests[esw_attr->out_count].mdev = out_priv->mdev; 275 276 276 277 esw_attr->out_count++;
+28 -22
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
··· 300 300 if (err) 301 301 goto destroy_neigh_entry; 302 302 303 + e->encap_size = ipv4_encap_size; 304 + e->encap_header = encap_header; 305 + encap_header = NULL; 306 + 303 307 if (!(nud_state & NUD_VALID)) { 304 308 neigh_event_send(attr.n, NULL); 305 309 /* the encap entry will be made valid on neigh update event ··· 314 310 315 311 memset(&reformat_params, 0, sizeof(reformat_params)); 316 312 reformat_params.type = e->reformat_type; 317 - reformat_params.size = ipv4_encap_size; 318 - reformat_params.data = encap_header; 313 + reformat_params.size = e->encap_size; 314 + reformat_params.data = e->encap_header; 319 315 e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params, 320 316 MLX5_FLOW_NAMESPACE_FDB); 321 317 if (IS_ERR(e->pkt_reformat)) { ··· 323 319 goto destroy_neigh_entry; 324 320 } 325 321 326 - e->encap_size = ipv4_encap_size; 327 - e->encap_header = encap_header; 328 322 e->flags |= MLX5_ENCAP_ENTRY_VALID; 329 323 mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev)); 330 324 mlx5e_route_lookup_ipv4_put(&attr); ··· 405 403 if (err) 406 404 goto free_encap; 407 405 406 + e->encap_size = ipv4_encap_size; 407 + kfree(e->encap_header); 408 + e->encap_header = encap_header; 409 + encap_header = NULL; 410 + 408 411 if (!(nud_state & NUD_VALID)) { 409 412 neigh_event_send(attr.n, NULL); 410 413 /* the encap entry will be made valid on neigh update event 411 414 * and not used before that. 412 415 */ 413 - goto free_encap; 416 + goto release_neigh; 414 417 } 415 418 416 419 memset(&reformat_params, 0, sizeof(reformat_params)); 417 420 reformat_params.type = e->reformat_type; 418 - reformat_params.size = ipv4_encap_size; 419 - reformat_params.data = encap_header; 421 + reformat_params.size = e->encap_size; 422 + reformat_params.data = e->encap_header; 420 423 e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params, 421 424 MLX5_FLOW_NAMESPACE_FDB); 422 425 if (IS_ERR(e->pkt_reformat)) { 423 426 err = PTR_ERR(e->pkt_reformat); 424 427 goto free_encap; 425 428 } 426 - 427 - e->encap_size = ipv4_encap_size; 428 - kfree(e->encap_header); 429 - e->encap_header = encap_header; 430 429 431 430 e->flags |= MLX5_ENCAP_ENTRY_VALID; 432 431 mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev)); ··· 570 567 if (err) 571 568 goto destroy_neigh_entry; 572 569 570 + e->encap_size = ipv6_encap_size; 571 + e->encap_header = encap_header; 572 + encap_header = NULL; 573 + 573 574 if (!(nud_state & NUD_VALID)) { 574 575 neigh_event_send(attr.n, NULL); 575 576 /* the encap entry will be made valid on neigh update event ··· 584 577 585 578 memset(&reformat_params, 0, sizeof(reformat_params)); 586 579 reformat_params.type = e->reformat_type; 587 - reformat_params.size = ipv6_encap_size; 588 - reformat_params.data = encap_header; 580 + reformat_params.size = e->encap_size; 581 + reformat_params.data = e->encap_header; 589 582 e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params, 590 583 MLX5_FLOW_NAMESPACE_FDB); 591 584 if (IS_ERR(e->pkt_reformat)) { ··· 593 586 goto destroy_neigh_entry; 594 587 } 595 588 596 - e->encap_size = ipv6_encap_size; 597 - e->encap_header = encap_header; 598 589 e->flags |= MLX5_ENCAP_ENTRY_VALID; 599 590 mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev)); 600 591 mlx5e_route_lookup_ipv6_put(&attr); ··· 674 669 if (err) 675 670 goto free_encap; 676 671 672 + e->encap_size = ipv6_encap_size; 673 + kfree(e->encap_header); 674 + e->encap_header = encap_header; 675 + encap_header = NULL; 676 + 677 677 if (!(nud_state & NUD_VALID)) { 678 678 neigh_event_send(attr.n, NULL); 679 679 /* the encap entry will be made valid on neigh update event 680 680 * and not used before that. 681 681 */ 682 - goto free_encap; 682 + goto release_neigh; 683 683 } 684 684 685 685 memset(&reformat_params, 0, sizeof(reformat_params)); 686 686 reformat_params.type = e->reformat_type; 687 - reformat_params.size = ipv6_encap_size; 688 - reformat_params.data = encap_header; 687 + reformat_params.size = e->encap_size; 688 + reformat_params.data = e->encap_header; 689 689 e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params, 690 690 MLX5_FLOW_NAMESPACE_FDB); 691 691 if (IS_ERR(e->pkt_reformat)) { 692 692 err = PTR_ERR(e->pkt_reformat); 693 693 goto free_encap; 694 694 } 695 - 696 - e->encap_size = ipv6_encap_size; 697 - kfree(e->encap_header); 698 - e->encap_header = encap_header; 699 695 700 696 e->flags |= MLX5_ENCAP_ENTRY_VALID; 701 697 mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev));
+2 -1
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
··· 1064 1064 1065 1065 out_priv = netdev_priv(encap_dev); 1066 1066 rpriv = out_priv->ppriv; 1067 - esw_attr->dests[out_index].rep = rpriv->rep; 1067 + esw_attr->dests[out_index].vport_valid = true; 1068 + esw_attr->dests[out_index].vport = rpriv->rep->vport; 1068 1069 esw_attr->dests[out_index].mdev = out_priv->mdev; 1069 1070 } 1070 1071
+3 -1
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
··· 540 540 dma_addr_t dma_addr = xdptxd->dma_addr; 541 541 u32 dma_len = xdptxd->len; 542 542 u16 ds_cnt, inline_hdr_sz; 543 + unsigned int frags_size; 543 544 u8 num_wqebbs = 1; 544 545 int num_frags = 0; 545 546 bool inline_ok; ··· 551 550 552 551 inline_ok = sq->min_inline_mode == MLX5_INLINE_MODE_NONE || 553 552 dma_len >= MLX5E_XDP_MIN_INLINE; 553 + frags_size = xdptxd->has_frags ? xdptxdf->sinfo->xdp_frags_size : 0; 554 554 555 - if (unlikely(!inline_ok || sq->hw_mtu < dma_len)) { 555 + if (unlikely(!inline_ok || sq->hw_mtu < dma_len + frags_size)) { 556 556 stats->err++; 557 557 return false; 558 558 }
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
··· 2142 2142 2143 2143 static void mlx5e_ipsec_unblock_tc_offload(struct mlx5_core_dev *mdev) 2144 2144 { 2145 - mdev->num_block_tc++; 2145 + mdev->num_block_tc--; 2146 2146 } 2147 2147 2148 2148 int mlx5e_accel_ipsec_fs_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry)
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
··· 49 49 count = snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), 50 50 "%d.%d.%04d (%.16s)", fw_rev_maj(mdev), 51 51 fw_rev_min(mdev), fw_rev_sub(mdev), mdev->board_id); 52 - if (count == sizeof(drvinfo->fw_version)) 52 + if (count >= sizeof(drvinfo->fw_version)) 53 53 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), 54 54 "%d.%d.%04d", fw_rev_maj(mdev), 55 55 fw_rev_min(mdev), fw_rev_sub(mdev));
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
··· 78 78 count = snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), 79 79 "%d.%d.%04d (%.16s)", fw_rev_maj(mdev), 80 80 fw_rev_min(mdev), fw_rev_sub(mdev), mdev->board_id); 81 - if (count == sizeof(drvinfo->fw_version)) 81 + if (count >= sizeof(drvinfo->fw_version)) 82 82 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), 83 83 "%d.%d.%04d", fw_rev_maj(mdev), 84 84 fw_rev_min(mdev), fw_rev_sub(mdev));
+7 -3
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 3778 3778 break; 3779 3779 case FLOW_ACTION_ACCEPT: 3780 3780 case FLOW_ACTION_PIPE: 3781 - if (set_branch_dest_ft(flow->priv, attr)) 3781 + err = set_branch_dest_ft(flow->priv, attr); 3782 + if (err) 3782 3783 goto out_err; 3783 3784 break; 3784 3785 case FLOW_ACTION_JUMP: ··· 3789 3788 goto out_err; 3790 3789 } 3791 3790 *jump_count = cond->extval; 3792 - if (set_branch_dest_ft(flow->priv, attr)) 3791 + err = set_branch_dest_ft(flow->priv, attr); 3792 + if (err) 3793 3793 goto out_err; 3794 3794 break; 3795 3795 default: ··· 5722 5720 5723 5721 esw = priv->mdev->priv.eswitch; 5724 5722 attr->act_id_restore_rule = esw_add_restore_rule(esw, *act_miss_mapping); 5725 - if (IS_ERR(attr->act_id_restore_rule)) 5723 + if (IS_ERR(attr->act_id_restore_rule)) { 5724 + err = PTR_ERR(attr->act_id_restore_rule); 5726 5725 goto err_rule; 5726 + } 5727 5727 5728 5728 return 0; 5729 5729
+2 -1
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
··· 526 526 u8 total_vlan; 527 527 struct { 528 528 u32 flags; 529 - struct mlx5_eswitch_rep *rep; 529 + bool vport_valid; 530 + u16 vport; 530 531 struct mlx5_pkt_reformat *pkt_reformat; 531 532 struct mlx5_core_dev *mdev; 532 533 struct mlx5_termtbl_handle *termtbl;
+19 -12
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 287 287 for (i = from; i < to; i++) 288 288 if (esw_attr->dests[i].flags & MLX5_ESW_DEST_CHAIN_WITH_SRC_PORT_CHANGE) 289 289 mlx5_chains_put_table(chains, 0, 1, 0); 290 - else if (mlx5_esw_indir_table_needed(esw, attr, esw_attr->dests[i].rep->vport, 290 + else if (mlx5_esw_indir_table_needed(esw, attr, esw_attr->dests[i].vport, 291 291 esw_attr->dests[i].mdev)) 292 - mlx5_esw_indir_table_put(esw, esw_attr->dests[i].rep->vport, 293 - false); 292 + mlx5_esw_indir_table_put(esw, esw_attr->dests[i].vport, false); 294 293 } 295 294 296 295 static bool ··· 357 358 * this criteria. 358 359 */ 359 360 for (i = esw_attr->split_count; i < esw_attr->out_count; i++) { 360 - if (esw_attr->dests[i].rep && 361 - mlx5_esw_indir_table_needed(esw, attr, esw_attr->dests[i].rep->vport, 361 + if (esw_attr->dests[i].vport_valid && 362 + mlx5_esw_indir_table_needed(esw, attr, esw_attr->dests[i].vport, 362 363 esw_attr->dests[i].mdev)) { 363 364 result = true; 364 365 } else { ··· 387 388 dest[*i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; 388 389 389 390 dest[*i].ft = mlx5_esw_indir_table_get(esw, attr, 390 - esw_attr->dests[j].rep->vport, false); 391 + esw_attr->dests[j].vport, false); 391 392 if (IS_ERR(dest[*i].ft)) { 392 393 err = PTR_ERR(dest[*i].ft); 393 394 goto err_indir_tbl_get; ··· 431 432 int attr_idx) 432 433 { 433 434 if (esw->offloads.ft_ipsec_tx_pol && 434 - esw_attr->dests[attr_idx].rep && 435 - esw_attr->dests[attr_idx].rep->vport == MLX5_VPORT_UPLINK && 435 + esw_attr->dests[attr_idx].vport_valid && 436 + esw_attr->dests[attr_idx].vport == MLX5_VPORT_UPLINK && 436 437 /* To be aligned with software, encryption is needed only for tunnel device */ 437 438 (esw_attr->dests[attr_idx].flags & MLX5_ESW_DEST_ENCAP_VALID) && 438 - esw_attr->dests[attr_idx].rep != esw_attr->in_rep && 439 + esw_attr->dests[attr_idx].vport != esw_attr->in_rep->vport && 439 440 esw_same_vhca_id(esw_attr->dests[attr_idx].mdev, esw->dev)) 440 441 return true; 441 442 ··· 468 469 int attr_idx, int dest_idx, bool pkt_reformat) 469 470 { 470 471 dest[dest_idx].type = MLX5_FLOW_DESTINATION_TYPE_VPORT; 471 - dest[dest_idx].vport.num = esw_attr->dests[attr_idx].rep->vport; 472 + dest[dest_idx].vport.num = esw_attr->dests[attr_idx].vport; 472 473 if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) { 473 474 dest[dest_idx].vport.vhca_id = 474 475 MLX5_CAP_GEN(esw_attr->dests[attr_idx].mdev, vhca_id); ··· 1176 1177 struct mlx5_flow_handle *flow; 1177 1178 struct mlx5_flow_spec *spec; 1178 1179 struct mlx5_vport *vport; 1180 + int err, pfindex; 1179 1181 unsigned long i; 1180 1182 void *misc; 1181 - int err; 1182 1183 1183 1184 if (!MLX5_VPORT_MANAGER(esw->dev) && !mlx5_core_is_ecpf_esw_manager(esw->dev)) 1184 1185 return 0; ··· 1254 1255 flows[vport->index] = flow; 1255 1256 } 1256 1257 } 1257 - esw->fdb_table.offloads.peer_miss_rules[mlx5_get_dev_index(peer_dev)] = flows; 1258 + 1259 + pfindex = mlx5_get_dev_index(peer_dev); 1260 + if (pfindex >= MLX5_MAX_PORTS) { 1261 + esw_warn(esw->dev, "Peer dev index(%d) is over the max num defined(%d)\n", 1262 + pfindex, MLX5_MAX_PORTS); 1263 + err = -EINVAL; 1264 + goto add_ec_vf_flow_err; 1265 + } 1266 + esw->fdb_table.offloads.peer_miss_rules[pfindex] = flows; 1258 1267 1259 1268 kvfree(spec); 1260 1269 return 0;
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c
··· 233 233 234 234 /* hairpin */ 235 235 for (i = esw_attr->split_count; i < esw_attr->out_count; i++) 236 - if (!esw_attr->dest_int_port && esw_attr->dests[i].rep && 237 - esw_attr->dests[i].rep->vport == MLX5_VPORT_UPLINK) 236 + if (!esw_attr->dest_int_port && esw_attr->dests[i].vport_valid && 237 + esw_attr->dests[i].vport == MLX5_VPORT_UPLINK) 238 238 return true; 239 239 240 240 return false;
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/vport.c
··· 277 277 req_list_size = max_list_size; 278 278 } 279 279 280 - out_sz = MLX5_ST_SZ_BYTES(query_nic_vport_context_in) + 280 + out_sz = MLX5_ST_SZ_BYTES(query_nic_vport_context_out) + 281 281 req_list_size * MLX5_ST_SZ_BYTES(mac_address_layout); 282 282 283 283 out = kvzalloc(out_sz, GFP_KERNEL);
+3
drivers/net/ethernet/micrel/ks8851.h
··· 350 350 * @rxd: Space for receiving SPI data, in DMA-able space. 351 351 * @txd: Space for transmitting SPI data, in DMA-able space. 352 352 * @msg_enable: The message flags controlling driver output (see ethtool). 353 + * @tx_space: Free space in the hardware TX buffer (cached copy of KS_TXMIR). 354 + * @queued_len: Space required in hardware TX buffer for queued packets in txq. 353 355 * @fid: Incrementing frame id tag. 354 356 * @rc_ier: Cached copy of KS_IER. 355 357 * @rc_ccr: Cached copy of KS_CCR. ··· 401 399 struct work_struct rxctrl_work; 402 400 403 401 struct sk_buff_head txq; 402 + unsigned int queued_len; 404 403 405 404 struct eeprom_93cx6 eeprom; 406 405 struct regulator *vdd_reg;
+11 -11
drivers/net/ethernet/micrel/ks8851_common.c
··· 362 362 handled |= IRQ_RXPSI; 363 363 364 364 if (status & IRQ_TXI) { 365 - handled |= IRQ_TXI; 366 - 367 - /* no lock here, tx queue should have been stopped */ 368 - 369 - /* update our idea of how much tx space is available to the 370 - * system */ 371 - ks->tx_space = ks8851_rdreg16(ks, KS_TXMIR); 365 + unsigned short tx_space = ks8851_rdreg16(ks, KS_TXMIR); 372 366 373 367 netif_dbg(ks, intr, ks->netdev, 374 - "%s: txspace %d\n", __func__, ks->tx_space); 368 + "%s: txspace %d\n", __func__, tx_space); 369 + 370 + spin_lock(&ks->statelock); 371 + ks->tx_space = tx_space; 372 + if (netif_queue_stopped(ks->netdev)) 373 + netif_wake_queue(ks->netdev); 374 + spin_unlock(&ks->statelock); 375 + 376 + handled |= IRQ_TXI; 375 377 } 376 378 377 379 if (status & IRQ_RXI) ··· 415 413 416 414 if (status & IRQ_LCI) 417 415 mii_check_link(&ks->mii); 418 - 419 - if (status & IRQ_TXI) 420 - netif_wake_queue(ks->netdev); 421 416 422 417 return IRQ_HANDLED; 423 418 } ··· 499 500 ks8851_wrreg16(ks, KS_ISR, ks->rc_ier); 500 501 ks8851_wrreg16(ks, KS_IER, ks->rc_ier); 501 502 503 + ks->queued_len = 0; 502 504 netif_start_queue(ks->netdev); 503 505 504 506 netif_dbg(ks, ifup, ks->netdev, "network device up\n");
+27 -15
drivers/net/ethernet/micrel/ks8851_spi.c
··· 287 287 } 288 288 289 289 /** 290 + * calc_txlen - calculate size of message to send packet 291 + * @len: Length of data 292 + * 293 + * Returns the size of the TXFIFO message needed to send 294 + * this packet. 295 + */ 296 + static unsigned int calc_txlen(unsigned int len) 297 + { 298 + return ALIGN(len + 4, 4); 299 + } 300 + 301 + /** 290 302 * ks8851_rx_skb_spi - receive skbuff 291 303 * @ks: The device state 292 304 * @skb: The skbuff ··· 317 305 */ 318 306 static void ks8851_tx_work(struct work_struct *work) 319 307 { 308 + unsigned int dequeued_len = 0; 320 309 struct ks8851_net_spi *kss; 310 + unsigned short tx_space; 321 311 struct ks8851_net *ks; 322 312 unsigned long flags; 323 313 struct sk_buff *txb; ··· 336 322 last = skb_queue_empty(&ks->txq); 337 323 338 324 if (txb) { 325 + dequeued_len += calc_txlen(txb->len); 326 + 339 327 ks8851_wrreg16_spi(ks, KS_RXQCR, 340 328 ks->rc_rxqcr | RXQCR_SDA); 341 329 ks8851_wrfifo_spi(ks, txb, last); ··· 347 331 ks8851_done_tx(ks, txb); 348 332 } 349 333 } 334 + 335 + tx_space = ks8851_rdreg16_spi(ks, KS_TXMIR); 336 + 337 + spin_lock(&ks->statelock); 338 + ks->queued_len -= dequeued_len; 339 + ks->tx_space = tx_space; 340 + spin_unlock(&ks->statelock); 350 341 351 342 ks8851_unlock_spi(ks, &flags); 352 343 } ··· 367 344 struct ks8851_net_spi *kss = to_ks8851_spi(ks); 368 345 369 346 flush_work(&kss->tx_work); 370 - } 371 - 372 - /** 373 - * calc_txlen - calculate size of message to send packet 374 - * @len: Length of data 375 - * 376 - * Returns the size of the TXFIFO message needed to send 377 - * this packet. 378 - */ 379 - static unsigned int calc_txlen(unsigned int len) 380 - { 381 - return ALIGN(len + 4, 4); 382 347 } 383 348 384 349 /** ··· 397 386 398 387 spin_lock(&ks->statelock); 399 388 400 - if (needed > ks->tx_space) { 389 + if (ks->queued_len + needed > ks->tx_space) { 401 390 netif_stop_queue(dev); 402 391 ret = NETDEV_TX_BUSY; 403 392 } else { 404 - ks->tx_space -= needed; 393 + ks->queued_len += needed; 405 394 skb_queue_tail(&ks->txq, skb); 406 395 } 407 396 408 397 spin_unlock(&ks->statelock); 409 - schedule_work(&kss->tx_work); 398 + if (ret == NETDEV_TX_OK) 399 + schedule_work(&kss->tx_work); 410 400 411 401 return ret; 412 402 }
+1
drivers/net/ethernet/microsoft/Kconfig
··· 20 20 depends on PCI_MSI && X86_64 21 21 depends on PCI_HYPERV 22 22 select AUXILIARY_BUS 23 + select PAGE_POOL 23 24 help 24 25 This driver supports Microsoft Azure Network Adapter (MANA). 25 26 So far, the driver is only supported on X86_64.
+8 -8
drivers/net/ethernet/mscc/ocelot_stats.c
··· 582 582 rmon_stats->hist_tx[0] = s[OCELOT_STAT_TX_64]; 583 583 rmon_stats->hist_tx[1] = s[OCELOT_STAT_TX_65_127]; 584 584 rmon_stats->hist_tx[2] = s[OCELOT_STAT_TX_128_255]; 585 - rmon_stats->hist_tx[3] = s[OCELOT_STAT_TX_128_255]; 586 - rmon_stats->hist_tx[4] = s[OCELOT_STAT_TX_256_511]; 587 - rmon_stats->hist_tx[5] = s[OCELOT_STAT_TX_512_1023]; 588 - rmon_stats->hist_tx[6] = s[OCELOT_STAT_TX_1024_1526]; 585 + rmon_stats->hist_tx[3] = s[OCELOT_STAT_TX_256_511]; 586 + rmon_stats->hist_tx[4] = s[OCELOT_STAT_TX_512_1023]; 587 + rmon_stats->hist_tx[5] = s[OCELOT_STAT_TX_1024_1526]; 588 + rmon_stats->hist_tx[6] = s[OCELOT_STAT_TX_1527_MAX]; 589 589 } 590 590 591 591 static void ocelot_port_pmac_rmon_stats_cb(struct ocelot *ocelot, int port, ··· 610 610 rmon_stats->hist_tx[0] = s[OCELOT_STAT_TX_PMAC_64]; 611 611 rmon_stats->hist_tx[1] = s[OCELOT_STAT_TX_PMAC_65_127]; 612 612 rmon_stats->hist_tx[2] = s[OCELOT_STAT_TX_PMAC_128_255]; 613 - rmon_stats->hist_tx[3] = s[OCELOT_STAT_TX_PMAC_128_255]; 614 - rmon_stats->hist_tx[4] = s[OCELOT_STAT_TX_PMAC_256_511]; 615 - rmon_stats->hist_tx[5] = s[OCELOT_STAT_TX_PMAC_512_1023]; 616 - rmon_stats->hist_tx[6] = s[OCELOT_STAT_TX_PMAC_1024_1526]; 613 + rmon_stats->hist_tx[3] = s[OCELOT_STAT_TX_PMAC_256_511]; 614 + rmon_stats->hist_tx[4] = s[OCELOT_STAT_TX_PMAC_512_1023]; 615 + rmon_stats->hist_tx[5] = s[OCELOT_STAT_TX_PMAC_1024_1526]; 616 + rmon_stats->hist_tx[6] = s[OCELOT_STAT_TX_PMAC_1527_MAX]; 617 617 } 618 618 619 619 void ocelot_port_get_rmon_stats(struct ocelot *ocelot, int port,
+1 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
··· 237 237 */ 238 238 ts_status = readl(priv->ioaddr + GMAC_TIMESTAMP_STATUS); 239 239 240 - if (priv->plat->flags & STMMAC_FLAG_EXT_SNAPSHOT_EN) 240 + if (!(priv->plat->flags & STMMAC_FLAG_EXT_SNAPSHOT_EN)) 241 241 return; 242 242 243 243 num_snapshot = (ts_status & GMAC_TIMESTAMP_ATSNS_MASK) >>
+6 -76
drivers/net/ethernet/wangxun/libwx/wx_lib.c
··· 160 160 return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits); 161 161 } 162 162 163 - static bool wx_can_reuse_rx_page(struct wx_rx_buffer *rx_buffer, 164 - int rx_buffer_pgcnt) 165 - { 166 - unsigned int pagecnt_bias = rx_buffer->pagecnt_bias; 167 - struct page *page = rx_buffer->page; 168 - 169 - /* avoid re-using remote and pfmemalloc pages */ 170 - if (!dev_page_is_reusable(page)) 171 - return false; 172 - 173 - #if (PAGE_SIZE < 8192) 174 - /* if we are only owner of page we can reuse it */ 175 - if (unlikely((rx_buffer_pgcnt - pagecnt_bias) > 1)) 176 - return false; 177 - #endif 178 - 179 - /* If we have drained the page fragment pool we need to update 180 - * the pagecnt_bias and page count so that we fully restock the 181 - * number of references the driver holds. 182 - */ 183 - if (unlikely(pagecnt_bias == 1)) { 184 - page_ref_add(page, USHRT_MAX - 1); 185 - rx_buffer->pagecnt_bias = USHRT_MAX; 186 - } 187 - 188 - return true; 189 - } 190 - 191 - /** 192 - * wx_reuse_rx_page - page flip buffer and store it back on the ring 193 - * @rx_ring: rx descriptor ring to store buffers on 194 - * @old_buff: donor buffer to have page reused 195 - * 196 - * Synchronizes page for reuse by the adapter 197 - **/ 198 - static void wx_reuse_rx_page(struct wx_ring *rx_ring, 199 - struct wx_rx_buffer *old_buff) 200 - { 201 - u16 nta = rx_ring->next_to_alloc; 202 - struct wx_rx_buffer *new_buff; 203 - 204 - new_buff = &rx_ring->rx_buffer_info[nta]; 205 - 206 - /* update, and store next to alloc */ 207 - nta++; 208 - rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0; 209 - 210 - /* transfer page from old buffer to new buffer */ 211 - new_buff->page = old_buff->page; 212 - new_buff->page_dma = old_buff->page_dma; 213 - new_buff->page_offset = old_buff->page_offset; 214 - new_buff->pagecnt_bias = old_buff->pagecnt_bias; 215 - } 216 - 217 163 static void wx_dma_sync_frag(struct wx_ring *rx_ring, 218 164 struct wx_rx_buffer *rx_buffer) 219 165 { ··· 216 270 size, 217 271 DMA_FROM_DEVICE); 218 272 skip_sync: 219 - rx_buffer->pagecnt_bias--; 220 - 221 273 return rx_buffer; 222 274 } 223 275 ··· 224 280 struct sk_buff *skb, 225 281 int rx_buffer_pgcnt) 226 282 { 227 - if (wx_can_reuse_rx_page(rx_buffer, rx_buffer_pgcnt)) { 228 - /* hand second half of page back to the ring */ 229 - wx_reuse_rx_page(rx_ring, rx_buffer); 230 - } else { 231 - if (!IS_ERR(skb) && WX_CB(skb)->dma == rx_buffer->dma) 232 - /* the page has been released from the ring */ 233 - WX_CB(skb)->page_released = true; 234 - else 235 - page_pool_put_full_page(rx_ring->page_pool, rx_buffer->page, false); 236 - 237 - __page_frag_cache_drain(rx_buffer->page, 238 - rx_buffer->pagecnt_bias); 239 - } 283 + if (!IS_ERR(skb) && WX_CB(skb)->dma == rx_buffer->dma) 284 + /* the page has been released from the ring */ 285 + WX_CB(skb)->page_released = true; 240 286 241 287 /* clear contents of rx_buffer */ 242 288 rx_buffer->page = NULL; ··· 269 335 if (size <= WX_RXBUFFER_256) { 270 336 memcpy(__skb_put(skb, size), page_addr, 271 337 ALIGN(size, sizeof(long))); 272 - rx_buffer->pagecnt_bias++; 273 - 338 + page_pool_put_full_page(rx_ring->page_pool, rx_buffer->page, true); 274 339 return skb; 275 340 } 341 + 342 + skb_mark_for_recycle(skb); 276 343 277 344 if (!wx_test_staterr(rx_desc, WX_RXD_STAT_EOP)) 278 345 WX_CB(skb)->dma = rx_buffer->dma; ··· 317 382 bi->page_dma = dma; 318 383 bi->page = page; 319 384 bi->page_offset = 0; 320 - page_ref_add(page, USHRT_MAX - 1); 321 - bi->pagecnt_bias = USHRT_MAX; 322 385 323 386 return true; 324 387 } ··· 656 723 /* exit if we failed to retrieve a buffer */ 657 724 if (!skb) { 658 725 rx_ring->rx_stats.alloc_rx_buff_failed++; 659 - rx_buffer->pagecnt_bias++; 660 726 break; 661 727 } 662 728 ··· 2180 2248 2181 2249 /* free resources associated with mapping */ 2182 2250 page_pool_put_full_page(rx_ring->page_pool, rx_buffer->page, false); 2183 - __page_frag_cache_drain(rx_buffer->page, 2184 - rx_buffer->pagecnt_bias); 2185 2251 2186 2252 i++; 2187 2253 rx_buffer++;
-1
drivers/net/ethernet/wangxun/libwx/wx_type.h
··· 787 787 dma_addr_t page_dma; 788 788 struct page *page; 789 789 unsigned int page_offset; 790 - u16 pagecnt_bias; 791 790 }; 792 791 793 792 struct wx_queue_stats {
+4 -2
drivers/net/phy/phy_device.c
··· 1550 1550 goto error; 1551 1551 1552 1552 phy_resume(phydev); 1553 - phy_led_triggers_register(phydev); 1553 + if (!phydev->is_on_sfp_module) 1554 + phy_led_triggers_register(phydev); 1554 1555 1555 1556 /** 1556 1557 * If the external phy used by current mac interface is managed by ··· 1823 1822 } 1824 1823 phydev->phylink = NULL; 1825 1824 1826 - phy_led_triggers_unregister(phydev); 1825 + if (!phydev->is_on_sfp_module) 1826 + phy_led_triggers_unregister(phydev); 1827 1827 1828 1828 if (phydev->mdio.dev.driver) 1829 1829 module_put(phydev->mdio.dev.driver->owner);
+1 -1
drivers/net/wireless/intel/iwlwifi/pcie/rx.c
··· 1384 1384 * if it is true then one of the handlers took the page. 1385 1385 */ 1386 1386 1387 - if (reclaim) { 1387 + if (reclaim && txq) { 1388 1388 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 1389 1389 int index = SEQ_TO_INDEX(sequence); 1390 1390 int cmd_index = iwl_txq_get_cmd_index(txq, index);
+2 -2
drivers/net/wireless/intel/iwlwifi/pcie/trans.c
··· 3092 3092 struct iwl_rxq *rxq = &trans_pcie->rxq[0]; 3093 3093 u32 i, r, j, rb_len = 0; 3094 3094 3095 - spin_lock(&rxq->lock); 3095 + spin_lock_bh(&rxq->lock); 3096 3096 3097 3097 r = iwl_get_closed_rb_stts(trans, rxq); 3098 3098 ··· 3116 3116 *data = iwl_fw_error_next_data(*data); 3117 3117 } 3118 3118 3119 - spin_unlock(&rxq->lock); 3119 + spin_unlock_bh(&rxq->lock); 3120 3120 3121 3121 return rb_len; 3122 3122 }
+6 -4
drivers/net/wireless/mediatek/mt76/dma.c
··· 878 878 879 879 static void 880 880 mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data, 881 - int len, bool more, u32 info) 881 + int len, bool more, u32 info, bool allow_direct) 882 882 { 883 883 struct sk_buff *skb = q->rx_head; 884 884 struct skb_shared_info *shinfo = skb_shinfo(skb); ··· 890 890 891 891 skb_add_rx_frag(skb, nr_frags, page, offset, len, q->buf_size); 892 892 } else { 893 - mt76_put_page_pool_buf(data, true); 893 + mt76_put_page_pool_buf(data, allow_direct); 894 894 } 895 895 896 896 if (more) ··· 910 910 struct sk_buff *skb; 911 911 unsigned char *data; 912 912 bool check_ddone = false; 913 + bool allow_direct = !mt76_queue_is_wed_rx(q); 913 914 bool more; 914 915 915 916 if (IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED) && ··· 951 950 } 952 951 953 952 if (q->rx_head) { 954 - mt76_add_fragment(dev, q, data, len, more, info); 953 + mt76_add_fragment(dev, q, data, len, more, info, 954 + allow_direct); 955 955 continue; 956 956 } 957 957 ··· 981 979 continue; 982 980 983 981 free_frag: 984 - mt76_put_page_pool_buf(data, true); 982 + mt76_put_page_pool_buf(data, allow_direct); 985 983 } 986 984 987 985 mt76_dma_rx_fill(dev, q, true);
+5 -2
drivers/pci/controller/dwc/pcie-qcom.c
··· 968 968 969 969 static int qcom_pcie_enable_aspm(struct pci_dev *pdev, void *userdata) 970 970 { 971 - /* Downstream devices need to be in D0 state before enabling PCI PM substates */ 971 + /* 972 + * Downstream devices need to be in D0 state before enabling PCI PM 973 + * substates. 974 + */ 972 975 pci_set_power_state(pdev, PCI_D0); 973 - pci_enable_link_state(pdev, PCIE_LINK_STATE_ALL); 976 + pci_enable_link_state_locked(pdev, PCIE_LINK_STATE_ALL); 974 977 975 978 return 0; 976 979 }
+41 -5
drivers/pci/controller/pci-loongson.c
··· 80 80 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, 81 81 DEV_LS7A_LPC, system_bus_quirk); 82 82 83 + /* 84 + * Some Loongson PCIe ports have hardware limitations on their Maximum Read 85 + * Request Size. They can't handle anything larger than this. Sane 86 + * firmware will set proper MRRS at boot, so we only need no_inc_mrrs for 87 + * bridges. However, some MIPS Loongson firmware doesn't set MRRS properly, 88 + * so we have to enforce maximum safe MRRS, which is 256 bytes. 89 + */ 90 + #ifdef CONFIG_MIPS 91 + static void loongson_set_min_mrrs_quirk(struct pci_dev *pdev) 92 + { 93 + struct pci_bus *bus = pdev->bus; 94 + struct pci_dev *bridge; 95 + static const struct pci_device_id bridge_devids[] = { 96 + { PCI_VDEVICE(LOONGSON, DEV_LS2K_PCIE_PORT0) }, 97 + { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT0) }, 98 + { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT1) }, 99 + { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT2) }, 100 + { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT3) }, 101 + { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT4) }, 102 + { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT5) }, 103 + { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT6) }, 104 + { 0, }, 105 + }; 106 + 107 + /* look for the matching bridge */ 108 + while (!pci_is_root_bus(bus)) { 109 + bridge = bus->self; 110 + bus = bus->parent; 111 + 112 + if (pci_match_id(bridge_devids, bridge)) { 113 + if (pcie_get_readrq(pdev) > 256) { 114 + pci_info(pdev, "limiting MRRS to 256\n"); 115 + pcie_set_readrq(pdev, 256); 116 + } 117 + break; 118 + } 119 + } 120 + } 121 + DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, loongson_set_min_mrrs_quirk); 122 + #endif 123 + 83 124 static void loongson_mrrs_quirk(struct pci_dev *pdev) 84 125 { 85 - /* 86 - * Some Loongson PCIe ports have h/w limitations of maximum read 87 - * request size. They can't handle anything larger than this. So 88 - * force this limit on any devices attached under these ports. 89 - */ 90 126 struct pci_host_bridge *bridge = pci_find_host_bridge(pdev->bus); 91 127 92 128 bridge->no_inc_mrrs = 1;
+1 -1
drivers/pci/controller/vmd.c
··· 751 751 if (!(features & VMD_FEAT_BIOS_PM_QUIRK)) 752 752 return 0; 753 753 754 - pci_enable_link_state(pdev, PCIE_LINK_STATE_ALL); 754 + pci_enable_link_state_locked(pdev, PCIE_LINK_STATE_ALL); 755 755 756 756 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_LTR); 757 757 if (!pos)
+3 -6
drivers/pci/hotplug/acpiphp_glue.c
··· 512 512 if (pass && dev->subordinate) { 513 513 check_hotplug_bridge(slot, dev); 514 514 pcibios_resource_survey_bus(dev->subordinate); 515 - if (pci_is_root_bus(bus)) 516 - __pci_bus_size_bridges(dev->subordinate, &add_list); 515 + __pci_bus_size_bridges(dev->subordinate, 516 + &add_list); 517 517 } 518 518 } 519 519 } 520 - if (pci_is_root_bus(bus)) 521 - __pci_bus_assign_resources(bus, &add_list, NULL); 522 - else 523 - pci_assign_unassigned_bridge_resources(bus->self); 520 + __pci_bus_assign_resources(bus, &add_list, NULL); 524 521 } 525 522 526 523 acpiphp_sanitize_bus(bus);
+47 -18
drivers/pci/pcie/aspm.c
··· 1041 1041 return bridge->link_state; 1042 1042 } 1043 1043 1044 - static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) 1044 + static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool locked) 1045 1045 { 1046 1046 struct pcie_link_state *link = pcie_aspm_get_link(pdev); 1047 1047 ··· 1060 1060 return -EPERM; 1061 1061 } 1062 1062 1063 - if (sem) 1063 + if (!locked) 1064 1064 down_read(&pci_bus_sem); 1065 1065 mutex_lock(&aspm_lock); 1066 1066 if (state & PCIE_LINK_STATE_L0S) ··· 1082 1082 link->clkpm_disable = 1; 1083 1083 pcie_set_clkpm(link, policy_to_clkpm_state(link)); 1084 1084 mutex_unlock(&aspm_lock); 1085 - if (sem) 1085 + if (!locked) 1086 1086 up_read(&pci_bus_sem); 1087 1087 1088 1088 return 0; ··· 1090 1090 1091 1091 int pci_disable_link_state_locked(struct pci_dev *pdev, int state) 1092 1092 { 1093 - return __pci_disable_link_state(pdev, state, false); 1093 + lockdep_assert_held_read(&pci_bus_sem); 1094 + 1095 + return __pci_disable_link_state(pdev, state, true); 1094 1096 } 1095 1097 EXPORT_SYMBOL(pci_disable_link_state_locked); 1096 1098 ··· 1107 1105 */ 1108 1106 int pci_disable_link_state(struct pci_dev *pdev, int state) 1109 1107 { 1110 - return __pci_disable_link_state(pdev, state, true); 1108 + return __pci_disable_link_state(pdev, state, false); 1111 1109 } 1112 1110 EXPORT_SYMBOL(pci_disable_link_state); 1113 1111 1114 - /** 1115 - * pci_enable_link_state - Clear and set the default device link state so that 1116 - * the link may be allowed to enter the specified states. Note that if the 1117 - * BIOS didn't grant ASPM control to the OS, this does nothing because we can't 1118 - * touch the LNKCTL register. Also note that this does not enable states 1119 - * disabled by pci_disable_link_state(). Return 0 or a negative errno. 1120 - * 1121 - * @pdev: PCI device 1122 - * @state: Mask of ASPM link states to enable 1123 - */ 1124 - int pci_enable_link_state(struct pci_dev *pdev, int state) 1112 + static int __pci_enable_link_state(struct pci_dev *pdev, int state, bool locked) 1125 1113 { 1126 1114 struct pcie_link_state *link = pcie_aspm_get_link(pdev); 1127 1115 ··· 1128 1136 return -EPERM; 1129 1137 } 1130 1138 1131 - down_read(&pci_bus_sem); 1139 + if (!locked) 1140 + down_read(&pci_bus_sem); 1132 1141 mutex_lock(&aspm_lock); 1133 1142 link->aspm_default = 0; 1134 1143 if (state & PCIE_LINK_STATE_L0S) ··· 1150 1157 link->clkpm_default = (state & PCIE_LINK_STATE_CLKPM) ? 1 : 0; 1151 1158 pcie_set_clkpm(link, policy_to_clkpm_state(link)); 1152 1159 mutex_unlock(&aspm_lock); 1153 - up_read(&pci_bus_sem); 1160 + if (!locked) 1161 + up_read(&pci_bus_sem); 1154 1162 1155 1163 return 0; 1156 1164 } 1165 + 1166 + /** 1167 + * pci_enable_link_state - Clear and set the default device link state so that 1168 + * the link may be allowed to enter the specified states. Note that if the 1169 + * BIOS didn't grant ASPM control to the OS, this does nothing because we can't 1170 + * touch the LNKCTL register. Also note that this does not enable states 1171 + * disabled by pci_disable_link_state(). Return 0 or a negative errno. 1172 + * 1173 + * @pdev: PCI device 1174 + * @state: Mask of ASPM link states to enable 1175 + */ 1176 + int pci_enable_link_state(struct pci_dev *pdev, int state) 1177 + { 1178 + return __pci_enable_link_state(pdev, state, false); 1179 + } 1157 1180 EXPORT_SYMBOL(pci_enable_link_state); 1181 + 1182 + /** 1183 + * pci_enable_link_state_locked - Clear and set the default device link state 1184 + * so that the link may be allowed to enter the specified states. Note that if 1185 + * the BIOS didn't grant ASPM control to the OS, this does nothing because we 1186 + * can't touch the LNKCTL register. Also note that this does not enable states 1187 + * disabled by pci_disable_link_state(). Return 0 or a negative errno. 1188 + * 1189 + * @pdev: PCI device 1190 + * @state: Mask of ASPM link states to enable 1191 + * 1192 + * Context: Caller holds pci_bus_sem read lock. 1193 + */ 1194 + int pci_enable_link_state_locked(struct pci_dev *pdev, int state) 1195 + { 1196 + lockdep_assert_held_read(&pci_bus_sem); 1197 + 1198 + return __pci_enable_link_state(pdev, state, true); 1199 + } 1200 + EXPORT_SYMBOL(pci_enable_link_state_locked); 1158 1201 1159 1202 static int pcie_aspm_set_policy(const char *val, 1160 1203 const struct kernel_param *kp)
+1 -1
drivers/perf/arm-cmn.c
··· 1816 1816 idx = 0; 1817 1817 while (cmn->dtc[j].counters[idx]) 1818 1818 if (++idx == CMN_DT_NUM_COUNTERS) 1819 - goto free_dtms; 1819 + return -ENOSPC; 1820 1820 } 1821 1821 hw->dtc_idx[j] = idx; 1822 1822 }
+1 -1
drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8183.c
··· 100 100 static long mtk_mipi_tx_pll_round_rate(struct clk_hw *hw, unsigned long rate, 101 101 unsigned long *prate) 102 102 { 103 - return clamp_val(rate, 50000000, 1600000000); 103 + return clamp_val(rate, 125000000, 1600000000); 104 104 } 105 105 106 106 static const struct clk_ops mtk_mipi_tx_pll_ops = {
+1 -1
drivers/phy/sunplus/phy-sunplus-usb2.c
··· 275 275 276 276 phy = devm_phy_create(&pdev->dev, NULL, &sp_uphy_ops); 277 277 if (IS_ERR(phy)) { 278 - ret = -PTR_ERR(phy); 278 + ret = PTR_ERR(phy); 279 279 return ret; 280 280 } 281 281
+4 -1
drivers/phy/ti/phy-gmii-sel.c
··· 64 64 u32 num_ports; 65 65 u32 reg_offset; 66 66 u32 qsgmii_main_ports; 67 + bool no_offset; 67 68 }; 68 69 69 70 static int phy_gmii_sel_mode(struct phy *phy, enum phy_mode mode, int submode) ··· 403 402 priv->num_ports = size / sizeof(u32); 404 403 if (!priv->num_ports) 405 404 return -EINVAL; 406 - priv->reg_offset = __be32_to_cpu(*offset); 405 + if (!priv->no_offset) 406 + priv->reg_offset = __be32_to_cpu(*offset); 407 407 } 408 408 409 409 if_phys = devm_kcalloc(dev, priv->num_ports, ··· 473 471 dev_err(dev, "Failed to get syscon %d\n", ret); 474 472 return ret; 475 473 } 474 + priv->no_offset = true; 476 475 } 477 476 478 477 ret = phy_gmii_sel_init_ports(priv);
+20
drivers/platform/x86/amd/pmc/pmc-quirks.c
··· 16 16 17 17 struct quirk_entry { 18 18 u32 s2idle_bug_mmio; 19 + bool spurious_8042; 19 20 }; 20 21 21 22 static struct quirk_entry quirk_s2idle_bug = { 22 23 .s2idle_bug_mmio = 0xfed80380, 24 + }; 25 + 26 + static struct quirk_entry quirk_spurious_8042 = { 27 + .spurious_8042 = true, 23 28 }; 24 29 25 30 static const struct dmi_system_id fwbug_list[] = { ··· 198 193 DMI_MATCH(DMI_PRODUCT_NAME, "HP Laptop 15s-eq2xxx"), 199 194 } 200 195 }, 196 + /* https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128 */ 197 + { 198 + .ident = "Framework Laptop 13 (Phoenix)", 199 + .driver_data = &quirk_spurious_8042, 200 + .matches = { 201 + DMI_MATCH(DMI_SYS_VENDOR, "Framework"), 202 + DMI_MATCH(DMI_PRODUCT_NAME, "Laptop 13 (AMD Ryzen 7040Series)"), 203 + DMI_MATCH(DMI_BIOS_VERSION, "03.03"), 204 + } 205 + }, 201 206 {} 202 207 }; 203 208 ··· 250 235 { 251 236 const struct dmi_system_id *dmi_id; 252 237 238 + if (dev->cpu_id == AMD_CPU_ID_CZN) 239 + dev->disable_8042_wakeup = true; 240 + 253 241 dmi_id = dmi_first_match(fwbug_list); 254 242 if (!dmi_id) 255 243 return; ··· 260 242 if (dev->quirks->s2idle_bug_mmio) 261 243 pr_info("Using s2idle quirk to avoid %s platform firmware bug\n", 262 244 dmi_id->ident); 245 + if (dev->quirks->spurious_8042) 246 + dev->disable_8042_wakeup = true; 263 247 }
+13 -20
drivers/platform/x86/amd/pmc/pmc.c
··· 91 91 #define SMU_MSG_LOG_RESET 0x07 92 92 #define SMU_MSG_LOG_DUMP_DATA 0x08 93 93 #define SMU_MSG_GET_SUP_CONSTRAINTS 0x09 94 - /* List of supported CPU ids */ 95 - #define AMD_CPU_ID_RV 0x15D0 96 - #define AMD_CPU_ID_RN 0x1630 97 - #define AMD_CPU_ID_PCO AMD_CPU_ID_RV 98 - #define AMD_CPU_ID_CZN AMD_CPU_ID_RN 99 - #define AMD_CPU_ID_YC 0x14B5 100 - #define AMD_CPU_ID_CB 0x14D8 101 - #define AMD_CPU_ID_PS 0x14E8 102 - #define AMD_CPU_ID_SP 0x14A4 103 - #define PCI_DEVICE_ID_AMD_1AH_M20H_ROOT 0x1507 104 94 105 95 #define PMC_MSG_DELAY_MIN_US 50 106 96 #define RESPONSE_REGISTER_LOOP_MAX 20000 ··· 756 766 return -EINVAL; 757 767 } 758 768 759 - static int amd_pmc_czn_wa_irq1(struct amd_pmc_dev *pdev) 769 + static int amd_pmc_wa_irq1(struct amd_pmc_dev *pdev) 760 770 { 761 771 struct device *d; 762 772 int rc; 763 773 764 - if (!pdev->major) { 765 - rc = amd_pmc_get_smu_version(pdev); 766 - if (rc) 767 - return rc; 768 - } 774 + /* cezanne platform firmware has a fix in 64.66.0 */ 775 + if (pdev->cpu_id == AMD_CPU_ID_CZN) { 776 + if (!pdev->major) { 777 + rc = amd_pmc_get_smu_version(pdev); 778 + if (rc) 779 + return rc; 780 + } 769 781 770 - if (pdev->major > 64 || (pdev->major == 64 && pdev->minor > 65)) 771 - return 0; 782 + if (pdev->major > 64 || (pdev->major == 64 && pdev->minor > 65)) 783 + return 0; 784 + } 772 785 773 786 d = bus_find_device_by_name(&serio_bus, NULL, "serio0"); 774 787 if (!d) ··· 930 937 { 931 938 struct amd_pmc_dev *pdev = dev_get_drvdata(dev); 932 939 933 - if (pdev->cpu_id == AMD_CPU_ID_CZN && !disable_workarounds) { 934 - int rc = amd_pmc_czn_wa_irq1(pdev); 940 + if (pdev->disable_8042_wakeup && !disable_workarounds) { 941 + int rc = amd_pmc_wa_irq1(pdev); 935 942 936 943 if (rc) { 937 944 dev_err(pdev->dev, "failed to adjust keyboard wakeup: %d\n", rc);
+12
drivers/platform/x86/amd/pmc/pmc.h
··· 36 36 struct mutex lock; /* generic mutex lock */ 37 37 struct dentry *dbgfs_dir; 38 38 struct quirk_entry *quirks; 39 + bool disable_8042_wakeup; 39 40 }; 40 41 41 42 void amd_pmc_process_restore_quirks(struct amd_pmc_dev *dev); 42 43 void amd_pmc_quirks_init(struct amd_pmc_dev *dev); 44 + 45 + /* List of supported CPU ids */ 46 + #define AMD_CPU_ID_RV 0x15D0 47 + #define AMD_CPU_ID_RN 0x1630 48 + #define AMD_CPU_ID_PCO AMD_CPU_ID_RV 49 + #define AMD_CPU_ID_CZN AMD_CPU_ID_RN 50 + #define AMD_CPU_ID_YC 0x14B5 51 + #define AMD_CPU_ID_CB 0x14D8 52 + #define AMD_CPU_ID_PS 0x14E8 53 + #define AMD_CPU_ID_SP 0x14A4 54 + #define PCI_DEVICE_ID_AMD_1AH_M20H_ROOT 0x1507 43 55 44 56 #endif /* PMC_H */
+1 -1
drivers/platform/x86/intel/pmc/core.c
··· 472 472 * is based on the contiguous indexes from ltr_show output. 473 473 * pmc index and ltr index needs to be calculated from it. 474 474 */ 475 - for (pmc_index = 0; pmc_index < ARRAY_SIZE(pmcdev->pmcs) && ltr_index > 0; pmc_index++) { 475 + for (pmc_index = 0; pmc_index < ARRAY_SIZE(pmcdev->pmcs) && ltr_index >= 0; pmc_index++) { 476 476 pmc = pmcdev->pmcs[pmc_index]; 477 477 478 478 if (!pmc)
+15 -4
drivers/platform/x86/intel/vbtn.c
··· 73 73 bool wakeup_mode; 74 74 }; 75 75 76 - static void detect_tablet_mode(struct platform_device *device) 76 + static void detect_tablet_mode(struct device *dev) 77 77 { 78 - struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev); 79 - acpi_handle handle = ACPI_HANDLE(&device->dev); 78 + struct intel_vbtn_priv *priv = dev_get_drvdata(dev); 79 + acpi_handle handle = ACPI_HANDLE(dev); 80 80 unsigned long long vgbs; 81 81 acpi_status status; 82 82 int m; ··· 89 89 input_report_switch(priv->switches_dev, SW_TABLET_MODE, m); 90 90 m = (vgbs & VGBS_DOCK_MODE_FLAG) ? 1 : 0; 91 91 input_report_switch(priv->switches_dev, SW_DOCK, m); 92 + 93 + input_sync(priv->switches_dev); 92 94 } 93 95 94 96 /* ··· 136 134 priv->switches_dev->id.bustype = BUS_HOST; 137 135 138 136 if (priv->has_switches) { 139 - detect_tablet_mode(device); 137 + detect_tablet_mode(&device->dev); 140 138 141 139 ret = input_register_device(priv->switches_dev); 142 140 if (ret) ··· 200 198 autorelease = val && (!ke_rel || ke_rel->type == KE_IGNORE); 201 199 202 200 sparse_keymap_report_event(input_dev, event, val, autorelease); 201 + 202 + /* Some devices need this to report further events */ 203 + acpi_evaluate_object(handle, "VBDL", NULL, NULL); 203 204 } 204 205 205 206 /* ··· 357 352 358 353 static int intel_vbtn_pm_resume(struct device *dev) 359 354 { 355 + struct intel_vbtn_priv *priv = dev_get_drvdata(dev); 356 + 360 357 intel_vbtn_pm_complete(dev); 358 + 359 + if (priv->has_switches) 360 + detect_tablet_mode(dev); 361 + 361 362 return 0; 362 363 } 363 364
+23 -7
drivers/platform/x86/intel_ips.c
··· 590 590 * @ips: IPS driver struct 591 591 * 592 592 * Check whether the MCP is over its thermal or power budget. 593 + * 594 + * Returns: %true if the temp or power has exceeded its maximum, else %false 593 595 */ 594 596 static bool mcp_exceeded(struct ips_driver *ips) 595 597 { ··· 621 619 * @cpu: CPU number to check 622 620 * 623 621 * Check a given CPU's average temp or power is over its limit. 622 + * 623 + * Returns: %true if the temp or power has exceeded its maximum, else %false 624 624 */ 625 625 static bool cpu_exceeded(struct ips_driver *ips, int cpu) 626 626 { ··· 649 645 * @ips: IPS driver struct 650 646 * 651 647 * Check the MCH temp & power against their maximums. 648 + * 649 + * Returns: %true if the temp or power has exceeded its maximum, else %false 652 650 */ 653 651 static bool mch_exceeded(struct ips_driver *ips) 654 652 { ··· 748 742 * - down (at TDP limit) 749 743 * - adjust both CPU and GPU down if possible 750 744 * 751 - cpu+ gpu+ cpu+gpu- cpu-gpu+ cpu-gpu- 752 - cpu < gpu < cpu+gpu+ cpu+ gpu+ nothing 753 - cpu < gpu >= cpu+gpu-(mcp<) cpu+gpu-(mcp<) gpu- gpu- 754 - cpu >= gpu < cpu-gpu+(mcp<) cpu- cpu-gpu+(mcp<) cpu- 755 - cpu >= gpu >= cpu-gpu- cpu-gpu- cpu-gpu- cpu-gpu- 745 + * |cpu+ gpu+ cpu+gpu- cpu-gpu+ cpu-gpu- 746 + * cpu < gpu < |cpu+gpu+ cpu+ gpu+ nothing 747 + * cpu < gpu >= |cpu+gpu-(mcp<) cpu+gpu-(mcp<) gpu- gpu- 748 + * cpu >= gpu < |cpu-gpu+(mcp<) cpu- cpu-gpu+(mcp<) cpu- 749 + * cpu >= gpu >=|cpu-gpu- cpu-gpu- cpu-gpu- cpu-gpu- 756 750 * 751 + * Returns: %0 757 752 */ 758 753 static int ips_adjust(void *data) 759 754 { ··· 942 935 * @data: ips driver structure 943 936 * 944 937 * This is the main function for the IPS driver. It monitors power and 945 - * tempurature in the MCP and adjusts CPU and GPU power clams accordingly. 938 + * temperature in the MCP and adjusts CPU and GPU power clamps accordingly. 946 939 * 947 - * We keep a 5s moving average of power consumption and tempurature. Using 940 + * We keep a 5s moving average of power consumption and temperature. Using 948 941 * that data, along with CPU vs GPU preference, we adjust the power clamps 949 942 * up or down. 943 + * 944 + * Returns: %0 on success or -errno on error 950 945 */ 951 946 static int ips_monitor(void *data) 952 947 { ··· 1155 1146 * Handle temperature limit trigger events, generally by lowering the clamps. 1156 1147 * If we're at a critical limit, we clamp back to the lowest possible value 1157 1148 * to prevent emergency shutdown. 1149 + * 1150 + * Returns: IRQ_NONE or IRQ_HANDLED 1158 1151 */ 1159 1152 static irqreturn_t ips_irq_handler(int irq, void *arg) 1160 1153 { ··· 1304 1293 1305 1294 /** 1306 1295 * ips_detect_cpu - detect whether CPU supports IPS 1296 + * @ips: IPS driver struct 1307 1297 * 1308 1298 * Walk our list and see if we're on a supported CPU. If we find one, 1309 1299 * return the limits for it. 1300 + * 1301 + * Returns: the &ips_mcp_limits struct that matches the boot CPU or %NULL 1310 1302 */ 1311 1303 static struct ips_mcp_limits *ips_detect_cpu(struct ips_driver *ips) 1312 1304 { ··· 1366 1352 * monitor and control graphics turbo mode. If we can find them, we can 1367 1353 * enable graphics turbo, otherwise we must disable it to avoid exceeding 1368 1354 * thermal and power limits in the MCP. 1355 + * 1356 + * Returns: %true if the required symbols are found, else %false 1369 1357 */ 1370 1358 static bool ips_get_i915_syms(struct ips_driver *ips) 1371 1359 {
+88 -16
drivers/platform/x86/thinkpad_acpi.c
··· 512 512 * Iterates over a quirks list until one is found that matches the 513 513 * ThinkPad's vendor, BIOS and EC model. 514 514 * 515 - * Returns 0 if nothing matches, otherwise returns the quirks field of 515 + * Returns: %0 if nothing matches, otherwise returns the quirks field of 516 516 * the matching &struct tpacpi_quirk entry. 517 517 * 518 - * The match criteria is: vendor, ec and bios much match. 518 + * The match criteria is: vendor, ec and bios must match. 519 519 */ 520 520 static unsigned long __init tpacpi_check_quirks( 521 521 const struct tpacpi_quirk *qlist, ··· 7948 7948 * TPACPI_FAN_WR_TPEC is also available and should be used to 7949 7949 * command the fan. The X31/X40/X41 seems to have 8 fan levels, 7950 7950 * but the ACPI tables just mention level 7. 7951 + * 7952 + * TPACPI_FAN_RD_TPEC_NS: 7953 + * This mode is used for a few ThinkPads (L13 Yoga Gen2, X13 Yoga Gen2 etc.) 7954 + * that are using non-standard EC locations for reporting fan speeds. 7955 + * Currently these platforms only provide fan rpm reporting. 7956 + * 7951 7957 */ 7958 + 7959 + #define FAN_RPM_CAL_CONST 491520 /* FAN RPM calculation offset for some non-standard ECFW */ 7960 + 7961 + #define FAN_NS_CTRL_STATUS BIT(2) /* Bit which determines control is enabled or not */ 7962 + #define FAN_NS_CTRL BIT(4) /* Bit which determines control is by host or EC */ 7952 7963 7953 7964 enum { /* Fan control constants */ 7954 7965 fan_status_offset = 0x2f, /* EC register 0x2f */ ··· 7967 7956 * 0x84 must be read before 0x85 */ 7968 7957 fan_select_offset = 0x31, /* EC register 0x31 (Firmware 7M) 7969 7958 bit 0 selects which fan is active */ 7959 + 7960 + fan_status_offset_ns = 0x93, /* Special status/control offset for non-standard EC Fan1 */ 7961 + fan2_status_offset_ns = 0x96, /* Special status/control offset for non-standard EC Fan2 */ 7962 + fan_rpm_status_ns = 0x95, /* Special offset for Fan1 RPM status for non-standard EC */ 7963 + fan2_rpm_status_ns = 0x98, /* Special offset for Fan2 RPM status for non-standard EC */ 7970 7964 7971 7965 TP_EC_FAN_FULLSPEED = 0x40, /* EC fan mode: full speed */ 7972 7966 TP_EC_FAN_AUTO = 0x80, /* EC fan mode: auto fan control */ ··· 7983 7967 TPACPI_FAN_NONE = 0, /* No fan status or control */ 7984 7968 TPACPI_FAN_RD_ACPI_GFAN, /* Use ACPI GFAN */ 7985 7969 TPACPI_FAN_RD_TPEC, /* Use ACPI EC regs 0x2f, 0x84-0x85 */ 7970 + TPACPI_FAN_RD_TPEC_NS, /* Use non-standard ACPI EC regs (eg: L13 Yoga gen2 etc.) */ 7986 7971 }; 7987 7972 7988 7973 enum fan_control_access_mode { ··· 8010 7993 static u8 fan_control_desired_level; 8011 7994 static u8 fan_control_resume_level; 8012 7995 static int fan_watchdog_maxinterval; 7996 + 7997 + static bool fan_with_ns_addr; 8013 7998 8014 7999 static struct mutex fan_mutex; 8015 8000 ··· 8142 8123 } 8143 8124 8144 8125 break; 8126 + case TPACPI_FAN_RD_TPEC_NS: 8127 + /* Default mode is AUTO which means controlled by EC */ 8128 + if (!acpi_ec_read(fan_status_offset_ns, &s)) 8129 + return -EIO; 8130 + 8131 + if (status) 8132 + *status = s; 8133 + 8134 + break; 8145 8135 8146 8136 default: 8147 8137 return -ENXIO; ··· 8167 8139 if (mutex_lock_killable(&fan_mutex)) 8168 8140 return -ERESTARTSYS; 8169 8141 rc = fan_get_status(&s); 8170 - if (!rc) 8142 + /* NS EC doesn't have register with level settings */ 8143 + if (!rc && !fan_with_ns_addr) 8171 8144 fan_update_desired_level(s); 8172 8145 mutex_unlock(&fan_mutex); 8173 8146 ··· 8195 8166 8196 8167 if (likely(speed)) 8197 8168 *speed = (hi << 8) | lo; 8169 + break; 8170 + case TPACPI_FAN_RD_TPEC_NS: 8171 + if (!acpi_ec_read(fan_rpm_status_ns, &lo)) 8172 + return -EIO; 8198 8173 8174 + if (speed) 8175 + *speed = lo ? FAN_RPM_CAL_CONST / lo : 0; 8199 8176 break; 8200 8177 8201 8178 default: ··· 8213 8178 8214 8179 static int fan2_get_speed(unsigned int *speed) 8215 8180 { 8216 - u8 hi, lo; 8181 + u8 hi, lo, status; 8217 8182 bool rc; 8218 8183 8219 8184 switch (fan_status_access_mode) { ··· 8229 8194 8230 8195 if (likely(speed)) 8231 8196 *speed = (hi << 8) | lo; 8197 + break; 8232 8198 8199 + case TPACPI_FAN_RD_TPEC_NS: 8200 + rc = !acpi_ec_read(fan2_status_offset_ns, &status); 8201 + if (rc) 8202 + return -EIO; 8203 + if (!(status & FAN_NS_CTRL_STATUS)) { 8204 + pr_info("secondary fan control not supported\n"); 8205 + return -EIO; 8206 + } 8207 + rc = !acpi_ec_read(fan2_rpm_status_ns, &lo); 8208 + if (rc) 8209 + return -EIO; 8210 + if (speed) 8211 + *speed = lo ? FAN_RPM_CAL_CONST / lo : 0; 8233 8212 break; 8234 8213 8235 8214 default: ··· 8746 8697 #define TPACPI_FAN_2FAN 0x0002 /* EC 0x31 bit 0 selects fan2 */ 8747 8698 #define TPACPI_FAN_2CTL 0x0004 /* selects fan2 control */ 8748 8699 #define TPACPI_FAN_NOFAN 0x0008 /* no fan available */ 8700 + #define TPACPI_FAN_NS 0x0010 /* For EC with non-Standard register addresses */ 8749 8701 8750 8702 static const struct tpacpi_quirk fan_quirk_table[] __initconst = { 8751 8703 TPACPI_QEC_IBM('1', 'Y', TPACPI_FAN_Q1), ··· 8765 8715 TPACPI_Q_LNV3('N', '2', 'O', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (2nd gen) */ 8766 8716 TPACPI_Q_LNV3('N', '3', '0', TPACPI_FAN_2CTL), /* P15 (1st gen) / P15v (1st gen) */ 8767 8717 TPACPI_Q_LNV3('N', '3', '7', TPACPI_FAN_2CTL), /* T15g (2nd gen) */ 8718 + TPACPI_Q_LNV3('R', '1', 'F', TPACPI_FAN_NS), /* L13 Yoga Gen 2 */ 8719 + TPACPI_Q_LNV3('N', '2', 'U', TPACPI_FAN_NS), /* X13 Yoga Gen 2*/ 8768 8720 TPACPI_Q_LNV3('N', '1', 'O', TPACPI_FAN_NOFAN), /* X1 Tablet (2nd gen) */ 8769 8721 }; 8770 8722 ··· 8801 8749 return -ENODEV; 8802 8750 } 8803 8751 8752 + if (quirks & TPACPI_FAN_NS) { 8753 + pr_info("ECFW with non-standard fan reg control found\n"); 8754 + fan_with_ns_addr = 1; 8755 + /* Fan ctrl support from host is undefined for now */ 8756 + tp_features.fan_ctrl_status_undef = 1; 8757 + } 8758 + 8804 8759 if (gfan_handle) { 8805 8760 /* 570, 600e/x, 770e, 770x */ 8806 8761 fan_status_access_mode = TPACPI_FAN_RD_ACPI_GFAN; 8807 8762 } else { 8808 8763 /* all other ThinkPads: note that even old-style 8809 8764 * ThinkPad ECs supports the fan control register */ 8810 - if (likely(acpi_ec_read(fan_status_offset, 8811 - &fan_control_initial_status))) { 8765 + if (fan_with_ns_addr || 8766 + likely(acpi_ec_read(fan_status_offset, &fan_control_initial_status))) { 8812 8767 int res; 8813 8768 unsigned int speed; 8814 8769 8815 - fan_status_access_mode = TPACPI_FAN_RD_TPEC; 8770 + fan_status_access_mode = fan_with_ns_addr ? 8771 + TPACPI_FAN_RD_TPEC_NS : TPACPI_FAN_RD_TPEC; 8772 + 8816 8773 if (quirks & TPACPI_FAN_Q1) 8817 8774 fan_quirk1_setup(); 8818 8775 /* Try and probe the 2nd fan */ ··· 8830 8769 if (res >= 0 && speed != FAN_NOT_PRESENT) { 8831 8770 /* It responded - so let's assume it's there */ 8832 8771 tp_features.second_fan = 1; 8833 - tp_features.second_fan_ctl = 1; 8772 + /* fan control not currently available for ns ECFW */ 8773 + tp_features.second_fan_ctl = !fan_with_ns_addr; 8834 8774 pr_info("secondary fan control detected & enabled\n"); 8835 8775 } else { 8836 8776 /* Fan not auto-detected */ ··· 9006 8944 str_enabled_disabled(status), status); 9007 8945 break; 9008 8946 8947 + case TPACPI_FAN_RD_TPEC_NS: 9009 8948 case TPACPI_FAN_RD_TPEC: 9010 8949 /* all except 570, 600e/x, 770e, 770x */ 9011 8950 rc = fan_get_status_safe(&status); ··· 9021 8958 9022 8959 seq_printf(m, "speed:\t\t%d\n", speed); 9023 8960 9024 - if (status & TP_EC_FAN_FULLSPEED) 9025 - /* Disengaged mode takes precedence */ 9026 - seq_printf(m, "level:\t\tdisengaged\n"); 9027 - else if (status & TP_EC_FAN_AUTO) 9028 - seq_printf(m, "level:\t\tauto\n"); 9029 - else 9030 - seq_printf(m, "level:\t\t%d\n", status); 8961 + if (fan_status_access_mode == TPACPI_FAN_RD_TPEC_NS) { 8962 + /* 8963 + * No full speed bit in NS EC 8964 + * EC Auto mode is set by default. 8965 + * No other levels settings available 8966 + */ 8967 + seq_printf(m, "level:\t\t%s\n", status & FAN_NS_CTRL ? "unknown" : "auto"); 8968 + } else { 8969 + if (status & TP_EC_FAN_FULLSPEED) 8970 + /* Disengaged mode takes precedence */ 8971 + seq_printf(m, "level:\t\tdisengaged\n"); 8972 + else if (status & TP_EC_FAN_AUTO) 8973 + seq_printf(m, "level:\t\tauto\n"); 8974 + else 8975 + seq_printf(m, "level:\t\t%d\n", status); 8976 + } 9031 8977 break; 9032 8978 9033 8979 case TPACPI_FAN_NONE: ··· 9375 9303 9376 9304 /* ACPI helpers/functions/probes */ 9377 9305 9378 - /** 9306 + /* 9379 9307 * This evaluates a ACPI method call specific to the battery 9380 9308 * ACPI extension. The specifics are that an error is marked 9381 9309 * in the 32rd bit of the response, so we just check that here.
+4 -4
drivers/reset/core.c
··· 807 807 { 808 808 lockdep_assert_held(&reset_list_mutex); 809 809 810 + if (IS_ERR_OR_NULL(rstc)) 811 + return; 812 + 810 813 kref_put(&rstc->refcnt, __reset_control_release); 811 814 } 812 815 ··· 1020 1017 void reset_control_bulk_put(int num_rstcs, struct reset_control_bulk_data *rstcs) 1021 1018 { 1022 1019 mutex_lock(&reset_list_mutex); 1023 - while (num_rstcs--) { 1024 - if (IS_ERR_OR_NULL(rstcs[num_rstcs].rstc)) 1025 - continue; 1020 + while (num_rstcs--) 1026 1021 __reset_control_put_internal(rstcs[num_rstcs].rstc); 1027 - } 1028 1022 mutex_unlock(&reset_list_mutex); 1029 1023 } 1030 1024 EXPORT_SYMBOL_GPL(reset_control_bulk_put);
+1 -1
drivers/reset/hisilicon/hi6220_reset.c
··· 163 163 if (!data) 164 164 return -ENOMEM; 165 165 166 - type = (enum hi6220_reset_ctrl_type)of_device_get_match_data(dev); 166 + type = (uintptr_t)of_device_get_match_data(dev); 167 167 168 168 regmap = syscon_node_to_regmap(np); 169 169 if (IS_ERR(regmap)) {
+4 -3
drivers/s390/block/scm_blk.c
··· 17 17 #include <linux/blk-mq.h> 18 18 #include <linux/slab.h> 19 19 #include <linux/list.h> 20 + #include <linux/io.h> 20 21 #include <asm/eadm.h> 21 22 #include "scm_blk.h" 22 23 ··· 131 130 132 131 for (i = 0; i < nr_requests_per_io && scmrq->request[i]; i++) { 133 132 msb = &scmrq->aob->msb[i]; 134 - aidaw = msb->data_addr; 133 + aidaw = (u64)phys_to_virt(msb->data_addr); 135 134 136 135 if ((msb->flags & MSB_FLAG_IDA) && aidaw && 137 136 IS_ALIGNED(aidaw, PAGE_SIZE)) ··· 196 195 msb->scm_addr = scmdev->address + ((u64) blk_rq_pos(req) << 9); 197 196 msb->oc = (rq_data_dir(req) == READ) ? MSB_OC_READ : MSB_OC_WRITE; 198 197 msb->flags |= MSB_FLAG_IDA; 199 - msb->data_addr = (u64) aidaw; 198 + msb->data_addr = (u64)virt_to_phys(aidaw); 200 199 201 200 rq_for_each_segment(bv, req, iter) { 202 201 WARN_ON(bv.bv_offset); 203 202 msb->blk_count += bv.bv_len >> 12; 204 - aidaw->data_addr = (u64) page_address(bv.bv_page); 203 + aidaw->data_addr = virt_to_phys(page_address(bv.bv_page)); 205 204 aidaw++; 206 205 } 207 206
-1
drivers/scsi/aacraid/aacraid.h
··· 1678 1678 u32 handle_pci_error; 1679 1679 bool init_reset; 1680 1680 u8 soft_reset_support; 1681 - u8 use_map_queue; 1682 1681 }; 1683 1682 1684 1683 #define aac_adapter_interrupt(dev) \
+1 -5
drivers/scsi/aacraid/commsup.c
··· 223 223 struct fib *aac_fib_alloc_tag(struct aac_dev *dev, struct scsi_cmnd *scmd) 224 224 { 225 225 struct fib *fibptr; 226 - u32 blk_tag; 227 - int i; 228 226 229 - blk_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd)); 230 - i = blk_mq_unique_tag_to_tag(blk_tag); 231 - fibptr = &dev->fibs[i]; 227 + fibptr = &dev->fibs[scsi_cmd_to_rq(scmd)->tag]; 232 228 /* 233 229 * Null out fields that depend on being zero at the start of 234 230 * each I/O
-14
drivers/scsi/aacraid/linit.c
··· 19 19 20 20 #include <linux/compat.h> 21 21 #include <linux/blkdev.h> 22 - #include <linux/blk-mq-pci.h> 23 22 #include <linux/completion.h> 24 23 #include <linux/init.h> 25 24 #include <linux/interrupt.h> ··· 502 503 sdev->tagged_supported = 1; 503 504 504 505 return 0; 505 - } 506 - 507 - static void aac_map_queues(struct Scsi_Host *shost) 508 - { 509 - struct aac_dev *aac = (struct aac_dev *)shost->hostdata; 510 - 511 - blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT], 512 - aac->pdev, 0); 513 - aac->use_map_queue = true; 514 506 } 515 507 516 508 /** ··· 1488 1498 .bios_param = aac_biosparm, 1489 1499 .shost_groups = aac_host_groups, 1490 1500 .slave_configure = aac_slave_configure, 1491 - .map_queues = aac_map_queues, 1492 1501 .change_queue_depth = aac_change_queue_depth, 1493 1502 .sdev_groups = aac_dev_groups, 1494 1503 .eh_abort_handler = aac_eh_abort, ··· 1775 1786 shost->max_lun = AAC_MAX_LUN; 1776 1787 1777 1788 pci_set_drvdata(pdev, shost); 1778 - shost->nr_hw_queues = aac->max_msix; 1779 - shost->host_tagset = 1; 1780 1789 1781 1790 error = scsi_add_host(shost, &pdev->dev); 1782 1791 if (error) ··· 1906 1919 struct aac_dev *aac = (struct aac_dev *)shost->hostdata; 1907 1920 1908 1921 aac_cancel_rescan_worker(aac); 1909 - aac->use_map_queue = false; 1910 1922 scsi_remove_host(shost); 1911 1923 1912 1924 __aac_shutdown(aac);
+2 -23
drivers/scsi/aacraid/src.c
··· 493 493 #endif 494 494 495 495 u16 vector_no; 496 - struct scsi_cmnd *scmd; 497 - u32 blk_tag; 498 - struct Scsi_Host *shost = dev->scsi_host_ptr; 499 - struct blk_mq_queue_map *qmap; 500 496 501 497 atomic_inc(&q->numpending); 502 498 ··· 505 509 if ((dev->comm_interface == AAC_COMM_MESSAGE_TYPE3) 506 510 && dev->sa_firmware) 507 511 vector_no = aac_get_vector(dev); 508 - else { 509 - if (!fib->vector_no || !fib->callback_data) { 510 - if (shost && dev->use_map_queue) { 511 - qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; 512 - vector_no = qmap->mq_map[raw_smp_processor_id()]; 513 - } 514 - /* 515 - * We hardcode the vector_no for 516 - * reserved commands as a valid shost is 517 - * absent during the init 518 - */ 519 - else 520 - vector_no = 0; 521 - } else { 522 - scmd = (struct scsi_cmnd *)fib->callback_data; 523 - blk_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd)); 524 - vector_no = blk_mq_unique_tag_to_hwq(blk_tag); 525 - } 526 - } 512 + else 513 + vector_no = fib->vector_no; 527 514 528 515 if (native_hba) { 529 516 if (fib->flags & FIB_CONTEXT_FLAG_NATIVE_HBA_TMF) {
+2 -1
drivers/soundwire/intel_ace2x.c
··· 23 23 static void intel_shim_vs_init(struct sdw_intel *sdw) 24 24 { 25 25 void __iomem *shim_vs = sdw->link_res->shim_vs; 26 - u16 act = 0; 26 + u16 act; 27 27 28 + act = intel_readw(shim_vs, SDW_SHIM2_INTEL_VS_ACTMCTL); 28 29 u16p_replace_bits(&act, 0x1, SDW_SHIM2_INTEL_VS_ACTMCTL_DOAIS); 29 30 act |= SDW_SHIM2_INTEL_VS_ACTMCTL_DACTQE; 30 31 act |= SDW_SHIM2_INTEL_VS_ACTMCTL_DODS;
+4 -3
drivers/soundwire/stream.c
··· 742 742 * sdw_ml_sync_bank_switch: Multilink register bank switch 743 743 * 744 744 * @bus: SDW bus instance 745 + * @multi_link: whether this is a multi-link stream with hardware-based sync 745 746 * 746 747 * Caller function should free the buffers on error 747 748 */ 748 - static int sdw_ml_sync_bank_switch(struct sdw_bus *bus) 749 + static int sdw_ml_sync_bank_switch(struct sdw_bus *bus, bool multi_link) 749 750 { 750 751 unsigned long time_left; 751 752 752 - if (!bus->multi_link) 753 + if (!multi_link) 753 754 return 0; 754 755 755 756 /* Wait for completion of transfer */ ··· 848 847 bus->bank_switch_timeout = DEFAULT_BANK_SWITCH_TIMEOUT; 849 848 850 849 /* Check if bank switch was successful */ 851 - ret = sdw_ml_sync_bank_switch(bus); 850 + ret = sdw_ml_sync_bank_switch(bus, multi_link); 852 851 if (ret < 0) { 853 852 dev_err(bus->dev, 854 853 "multi link bank switch failed: %d\n", ret);
+85 -10
drivers/spi/spi-atmel.c
··· 22 22 #include <linux/gpio/consumer.h> 23 23 #include <linux/pinctrl/consumer.h> 24 24 #include <linux/pm_runtime.h> 25 + #include <linux/iopoll.h> 25 26 #include <trace/events/spi.h> 26 27 27 28 /* SPI register offsets */ ··· 234 233 */ 235 234 #define DMA_MIN_BYTES 16 236 235 237 - #define SPI_DMA_MIN_TIMEOUT (msecs_to_jiffies(1000)) 238 - #define SPI_DMA_TIMEOUT_PER_10K (msecs_to_jiffies(4)) 239 - 240 236 #define AUTOSUSPEND_TIMEOUT 2000 241 237 242 238 struct atmel_spi_caps { ··· 277 279 bool keep_cs; 278 280 279 281 u32 fifo_size; 282 + bool last_polarity; 280 283 u8 native_cs_free; 281 284 u8 native_cs_for_gpio; 282 285 }; ··· 291 292 #define INVALID_DMA_ADDRESS 0xffffffff 292 293 293 294 /* 295 + * This frequency can be anything supported by the controller, but to avoid 296 + * unnecessary delay, the highest possible frequency is chosen. 297 + * 298 + * This frequency is the highest possible which is not interfering with other 299 + * chip select registers (see Note for Serial Clock Bit Rate configuration in 300 + * Atmel-11121F-ATARM-SAMA5D3-Series-Datasheet_02-Feb-16, page 1283) 301 + */ 302 + #define DUMMY_MSG_FREQUENCY 0x02 303 + /* 304 + * 8 bits is the minimum data the controller is capable of sending. 305 + * 306 + * This message can be anything as it should not be treated by any SPI device. 307 + */ 308 + #define DUMMY_MSG 0xAA 309 + 310 + /* 294 311 * Version 2 of the SPI controller has 295 312 * - CR.LASTXFER 296 313 * - SPI_MR.DIV32 may become FDIV or must-be-zero (here: always zero) ··· 318 303 { 319 304 return as->caps.is_spi2; 320 305 } 306 + 307 + /* 308 + * Send a dummy message. 309 + * 310 + * This is sometimes needed when using a CS GPIO to force clock transition when 311 + * switching between devices with different polarities. 312 + */ 313 + static void atmel_spi_send_dummy(struct atmel_spi *as, struct spi_device *spi, int chip_select) 314 + { 315 + u32 status; 316 + u32 csr; 317 + 318 + /* 319 + * Set a clock frequency to allow sending message on SPI bus. 320 + * The frequency here can be anything, but is needed for 321 + * the controller to send the data. 322 + */ 323 + csr = spi_readl(as, CSR0 + 4 * chip_select); 324 + csr = SPI_BFINS(SCBR, DUMMY_MSG_FREQUENCY, csr); 325 + spi_writel(as, CSR0 + 4 * chip_select, csr); 326 + 327 + /* 328 + * Read all data coming from SPI bus, needed to be able to send 329 + * the message. 330 + */ 331 + spi_readl(as, RDR); 332 + while (spi_readl(as, SR) & SPI_BIT(RDRF)) { 333 + spi_readl(as, RDR); 334 + cpu_relax(); 335 + } 336 + 337 + spi_writel(as, TDR, DUMMY_MSG); 338 + 339 + readl_poll_timeout_atomic(as->regs + SPI_SR, status, 340 + (status & SPI_BIT(TXEMPTY)), 1, 1000); 341 + } 342 + 321 343 322 344 /* 323 345 * Earlier SPI controllers (e.g. on at91rm9200) have a design bug whereby ··· 372 320 * Master on Chip Select 0.") No workaround exists for that ... so for 373 321 * nCS0 on that chip, we (a) don't use the GPIO, (b) can't support CS_HIGH, 374 322 * and (c) will trigger that first erratum in some cases. 323 + * 324 + * When changing the clock polarity, the SPI controller waits for the next 325 + * transmission to enforce the default clock state. This may be an issue when 326 + * using a GPIO as Chip Select: the clock level is applied only when the first 327 + * packet is sent, once the CS has already been asserted. The workaround is to 328 + * avoid this by sending a first (dummy) message before toggling the CS state. 375 329 */ 376 - 377 330 static void cs_activate(struct atmel_spi *as, struct spi_device *spi) 378 331 { 379 332 struct atmel_spi_device *asd = spi->controller_state; 333 + bool new_polarity; 380 334 int chip_select; 381 335 u32 mr; 382 336 ··· 411 353 } 412 354 413 355 mr = spi_readl(as, MR); 356 + 357 + /* 358 + * Ensures the clock polarity is valid before we actually 359 + * assert the CS to avoid spurious clock edges to be 360 + * processed by the spi devices. 361 + */ 362 + if (spi_get_csgpiod(spi, 0)) { 363 + new_polarity = (asd->csr & SPI_BIT(CPOL)) != 0; 364 + if (new_polarity != as->last_polarity) { 365 + /* 366 + * Need to disable the GPIO before sending the dummy 367 + * message because it is already set by the spi core. 368 + */ 369 + gpiod_set_value_cansleep(spi_get_csgpiod(spi, 0), 0); 370 + atmel_spi_send_dummy(as, spi, chip_select); 371 + as->last_polarity = new_polarity; 372 + gpiod_set_value_cansleep(spi_get_csgpiod(spi, 0), 1); 373 + } 374 + } 414 375 } else { 415 376 u32 cpol = (spi->mode & SPI_CPOL) ? SPI_BIT(CPOL) : 0; 416 377 int i; ··· 1413 1336 } 1414 1337 1415 1338 dma_timeout = msecs_to_jiffies(spi_controller_xfer_timeout(host, xfer)); 1416 - ret_timeout = wait_for_completion_interruptible_timeout(&as->xfer_completion, 1417 - dma_timeout); 1418 - if (ret_timeout <= 0) { 1419 - dev_err(&spi->dev, "spi transfer %s\n", 1420 - !ret_timeout ? "timeout" : "canceled"); 1421 - as->done_status = ret_timeout < 0 ? ret_timeout : -EIO; 1339 + ret_timeout = wait_for_completion_timeout(&as->xfer_completion, dma_timeout); 1340 + if (!ret_timeout) { 1341 + dev_err(&spi->dev, "spi transfer timeout\n"); 1342 + as->done_status = -EIO; 1422 1343 } 1423 1344 1424 1345 if (as->done_status)
-1
drivers/spi/spi-cadence.c
··· 451 451 udelay(10); 452 452 453 453 cdns_spi_process_fifo(xspi, xspi->tx_fifo_depth, 0); 454 - spi_transfer_delay_exec(transfer); 455 454 456 455 cdns_spi_write(xspi, CDNS_SPI_IER, CDNS_SPI_IXR_DEFAULT); 457 456 return transfer->len;
+11 -4
drivers/spi/spi-imx.c
··· 659 659 ctrl |= (spi_imx->target_burst * 8 - 1) 660 660 << MX51_ECSPI_CTRL_BL_OFFSET; 661 661 else { 662 - if (spi_imx->count >= 512) 663 - ctrl |= 0xFFF << MX51_ECSPI_CTRL_BL_OFFSET; 664 - else 665 - ctrl |= (spi_imx->count * spi_imx->bits_per_word - 1) 662 + if (spi_imx->usedma) { 663 + ctrl |= (spi_imx->bits_per_word * 664 + spi_imx_bytes_per_word(spi_imx->bits_per_word) - 1) 666 665 << MX51_ECSPI_CTRL_BL_OFFSET; 666 + } else { 667 + if (spi_imx->count >= MX51_ECSPI_CTRL_MAX_BURST) 668 + ctrl |= (MX51_ECSPI_CTRL_MAX_BURST - 1) 669 + << MX51_ECSPI_CTRL_BL_OFFSET; 670 + else 671 + ctrl |= (spi_imx->count * spi_imx->bits_per_word - 1) 672 + << MX51_ECSPI_CTRL_BL_OFFSET; 673 + } 667 674 } 668 675 669 676 /* set clock speed */
+54
drivers/ufs/host/ufshcd-pltfrm.c
··· 8 8 * Vinayak Holikatti <h.vinayak@samsung.com> 9 9 */ 10 10 11 + #include <linux/clk.h> 11 12 #include <linux/module.h> 12 13 #include <linux/platform_device.h> 13 14 #include <linux/pm_opp.h> ··· 214 213 } 215 214 } 216 215 216 + /** 217 + * ufshcd_parse_clock_min_max_freq - Parse MIN and MAX clocks freq 218 + * @hba: per adapter instance 219 + * 220 + * This function parses MIN and MAX frequencies of all clocks required 221 + * by the host drivers. 222 + * 223 + * Returns 0 for success and non-zero for failure 224 + */ 225 + static int ufshcd_parse_clock_min_max_freq(struct ufs_hba *hba) 226 + { 227 + struct list_head *head = &hba->clk_list_head; 228 + struct ufs_clk_info *clki; 229 + struct dev_pm_opp *opp; 230 + unsigned long freq; 231 + u8 idx = 0; 232 + 233 + list_for_each_entry(clki, head, list) { 234 + if (!clki->name) 235 + continue; 236 + 237 + clki->clk = devm_clk_get(hba->dev, clki->name); 238 + if (IS_ERR(clki->clk)) 239 + continue; 240 + 241 + /* Find Max Freq */ 242 + freq = ULONG_MAX; 243 + opp = dev_pm_opp_find_freq_floor_indexed(hba->dev, &freq, idx); 244 + if (IS_ERR(opp)) { 245 + dev_err(hba->dev, "Failed to find OPP for MAX frequency\n"); 246 + return PTR_ERR(opp); 247 + } 248 + clki->max_freq = dev_pm_opp_get_freq_indexed(opp, idx); 249 + dev_pm_opp_put(opp); 250 + 251 + /* Find Min Freq */ 252 + freq = 0; 253 + opp = dev_pm_opp_find_freq_ceil_indexed(hba->dev, &freq, idx); 254 + if (IS_ERR(opp)) { 255 + dev_err(hba->dev, "Failed to find OPP for MIN frequency\n"); 256 + return PTR_ERR(opp); 257 + } 258 + clki->min_freq = dev_pm_opp_get_freq_indexed(opp, idx++); 259 + dev_pm_opp_put(opp); 260 + } 261 + 262 + return 0; 263 + } 264 + 217 265 static int ufshcd_parse_operating_points(struct ufs_hba *hba) 218 266 { 219 267 struct device *dev = hba->dev; ··· 328 278 dev_err(dev, "Failed to add OPP table: %d\n", ret); 329 279 return ret; 330 280 } 281 + 282 + ret = ufshcd_parse_clock_min_max_freq(hba); 283 + if (ret) 284 + return ret; 331 285 332 286 hba->use_pm_opp = true; 333 287
+11 -3
fs/bcachefs/alloc_foreground.c
··· 1374 1374 goto alloc_done; 1375 1375 1376 1376 /* Don't retry from all devices if we're out of open buckets: */ 1377 - if (bch2_err_matches(ret, BCH_ERR_open_buckets_empty)) 1378 - goto allocate_blocking; 1377 + if (bch2_err_matches(ret, BCH_ERR_open_buckets_empty)) { 1378 + int ret = open_bucket_add_buckets(trans, &ptrs, wp, devs_have, 1379 + target, erasure_code, 1380 + nr_replicas, &nr_effective, 1381 + &have_cache, watermark, 1382 + flags, cl); 1383 + if (!ret || 1384 + bch2_err_matches(ret, BCH_ERR_transaction_restart) || 1385 + bch2_err_matches(ret, BCH_ERR_open_buckets_empty)) 1386 + goto alloc_done; 1387 + } 1379 1388 1380 1389 /* 1381 1390 * Only try to allocate cache (durability = 0 devices) from the ··· 1398 1389 &have_cache, watermark, 1399 1390 flags, cl); 1400 1391 } else { 1401 - allocate_blocking: 1402 1392 ret = open_bucket_add_buckets(trans, &ptrs, wp, devs_have, 1403 1393 target, erasure_code, 1404 1394 nr_replicas, &nr_effective,
+6 -2
fs/bcachefs/btree_iter.c
··· 3214 3214 mempool_exit(&c->btree_trans_pool); 3215 3215 } 3216 3216 3217 - int bch2_fs_btree_iter_init(struct bch_fs *c) 3217 + void bch2_fs_btree_iter_init_early(struct bch_fs *c) 3218 3218 { 3219 3219 struct btree_transaction_stats *s; 3220 - int ret; 3221 3220 3222 3221 for (s = c->btree_transaction_stats; 3223 3222 s < c->btree_transaction_stats + ARRAY_SIZE(c->btree_transaction_stats); ··· 3227 3228 3228 3229 INIT_LIST_HEAD(&c->btree_trans_list); 3229 3230 seqmutex_init(&c->btree_trans_lock); 3231 + } 3232 + 3233 + int bch2_fs_btree_iter_init(struct bch_fs *c) 3234 + { 3235 + int ret; 3230 3236 3231 3237 c->btree_trans_bufs = alloc_percpu(struct btree_trans_buf); 3232 3238 if (!c->btree_trans_bufs)
+1
fs/bcachefs/btree_iter.h
··· 938 938 void bch2_btree_trans_to_text(struct printbuf *, struct btree_trans *); 939 939 940 940 void bch2_fs_btree_iter_exit(struct bch_fs *); 941 + void bch2_fs_btree_iter_init_early(struct bch_fs *); 941 942 int bch2_fs_btree_iter_init(struct bch_fs *); 942 943 943 944 #endif /* _BCACHEFS_BTREE_ITER_H */
+26 -13
fs/bcachefs/btree_update_interior.c
··· 99 99 100 100 /* Calculate ideal packed bkey format for new btree nodes: */ 101 101 102 - void __bch2_btree_calc_format(struct bkey_format_state *s, struct btree *b) 102 + static void __bch2_btree_calc_format(struct bkey_format_state *s, struct btree *b) 103 103 { 104 104 struct bkey_packed *k; 105 105 struct bset_tree *t; ··· 125 125 return bch2_bkey_format_done(&s); 126 126 } 127 127 128 - static size_t btree_node_u64s_with_format(struct btree *b, 128 + static size_t btree_node_u64s_with_format(struct btree_nr_keys nr, 129 + struct bkey_format *old_f, 129 130 struct bkey_format *new_f) 130 131 { 131 - struct bkey_format *old_f = &b->format; 132 - 133 132 /* stupid integer promotion rules */ 134 133 ssize_t delta = 135 134 (((int) new_f->key_u64s - old_f->key_u64s) * 136 - (int) b->nr.packed_keys) + 135 + (int) nr.packed_keys) + 137 136 (((int) new_f->key_u64s - BKEY_U64s) * 138 - (int) b->nr.unpacked_keys); 137 + (int) nr.unpacked_keys); 139 138 140 - BUG_ON(delta + b->nr.live_u64s < 0); 139 + BUG_ON(delta + nr.live_u64s < 0); 141 140 142 - return b->nr.live_u64s + delta; 141 + return nr.live_u64s + delta; 143 142 } 144 143 145 144 /** ··· 146 147 * 147 148 * @c: filesystem handle 148 149 * @b: btree node to rewrite 150 + * @nr: number of keys for new node (i.e. b->nr) 149 151 * @new_f: bkey format to translate keys to 150 152 * 151 153 * Returns: true if all re-packed keys will be able to fit in a new node. 152 154 * 153 155 * Assumes all keys will successfully pack with the new format. 154 156 */ 155 - bool bch2_btree_node_format_fits(struct bch_fs *c, struct btree *b, 157 + static bool bch2_btree_node_format_fits(struct bch_fs *c, struct btree *b, 158 + struct btree_nr_keys nr, 156 159 struct bkey_format *new_f) 157 160 { 158 - size_t u64s = btree_node_u64s_with_format(b, new_f); 161 + size_t u64s = btree_node_u64s_with_format(nr, &b->format, new_f); 159 162 160 163 return __vstruct_bytes(struct btree_node, u64s) < btree_bytes(c); 161 164 } ··· 392 391 * The keys might expand with the new format - if they wouldn't fit in 393 392 * the btree node anymore, use the old format for now: 394 393 */ 395 - if (!bch2_btree_node_format_fits(as->c, b, &format)) 394 + if (!bch2_btree_node_format_fits(as->c, b, b->nr, &format)) 396 395 format = b->format; 397 396 398 397 SET_BTREE_NODE_SEQ(n->data, BTREE_NODE_SEQ(b->data) + 1); ··· 1346 1345 struct bkey_packed *out[2]; 1347 1346 struct bkey uk; 1348 1347 unsigned u64s, n1_u64s = (b->nr.live_u64s * 3) / 5; 1348 + struct { unsigned nr_keys, val_u64s; } nr_keys[2]; 1349 1349 int i; 1350 + 1351 + memset(&nr_keys, 0, sizeof(nr_keys)); 1350 1352 1351 1353 for (i = 0; i < 2; i++) { 1352 1354 BUG_ON(n[i]->nsets != 1); ··· 1372 1368 if (!i) 1373 1369 n1_pos = uk.p; 1374 1370 bch2_bkey_format_add_key(&format[i], &uk); 1371 + 1372 + nr_keys[i].nr_keys++; 1373 + nr_keys[i].val_u64s += bkeyp_val_u64s(&b->format, k); 1375 1374 } 1376 1375 1377 1376 btree_set_min(n[0], b->data->min_key); ··· 1387 1380 bch2_bkey_format_add_pos(&format[i], n[i]->data->max_key); 1388 1381 1389 1382 n[i]->data->format = bch2_bkey_format_done(&format[i]); 1383 + 1384 + unsigned u64s = nr_keys[i].nr_keys * n[i]->data->format.key_u64s + 1385 + nr_keys[i].val_u64s; 1386 + if (__vstruct_bytes(struct btree_node, u64s) > btree_bytes(as->c)) 1387 + n[i]->data->format = b->format; 1388 + 1390 1389 btree_node_set_format(n[i], n[i]->data->format); 1391 1390 } 1392 1391 ··· 1835 1822 bch2_bkey_format_add_pos(&new_s, next->data->max_key); 1836 1823 new_f = bch2_bkey_format_done(&new_s); 1837 1824 1838 - sib_u64s = btree_node_u64s_with_format(b, &new_f) + 1839 - btree_node_u64s_with_format(m, &new_f); 1825 + sib_u64s = btree_node_u64s_with_format(b->nr, &b->format, &new_f) + 1826 + btree_node_u64s_with_format(m->nr, &m->format, &new_f); 1840 1827 1841 1828 if (sib_u64s > BTREE_FOREGROUND_MERGE_HYSTERESIS(c)) { 1842 1829 sib_u64s -= BTREE_FOREGROUND_MERGE_HYSTERESIS(c);
-4
fs/bcachefs/btree_update_interior.h
··· 6 6 #include "btree_locking.h" 7 7 #include "btree_update.h" 8 8 9 - void __bch2_btree_calc_format(struct bkey_format_state *, struct btree *); 10 - bool bch2_btree_node_format_fits(struct bch_fs *c, struct btree *, 11 - struct bkey_format *); 12 - 13 9 #define BTREE_UPDATE_NODES_MAX ((BTREE_MAX_DEPTH - 2) * 2 + GC_MERGE_NODES) 14 10 15 11 #define BTREE_UPDATE_JOURNAL_RES (BTREE_UPDATE_NODES_MAX * (BKEY_BTREE_PTR_U64s_MAX + 1))
+2 -1
fs/bcachefs/data_update.c
··· 560 560 move_ctxt_wait_event(ctxt, 561 561 (locked = bch2_bucket_nocow_trylock(&c->nocow_locks, 562 562 PTR_BUCKET_POS(c, &p.ptr), 0)) || 563 - !atomic_read(&ctxt->read_sectors)); 563 + (!atomic_read(&ctxt->read_sectors) && 564 + !atomic_read(&ctxt->write_sectors))); 564 565 565 566 if (!locked) 566 567 bch2_bucket_nocow_lock(&c->nocow_locks,
+14 -5
fs/bcachefs/fs.c
··· 1143 1143 { 1144 1144 struct bch_inode_info *inode = to_bch_ei(vinode); 1145 1145 struct bch_inode_info *dir = to_bch_ei(vdir); 1146 - 1147 - if (*len < sizeof(struct bcachefs_fid_with_parent) / sizeof(u32)) 1148 - return FILEID_INVALID; 1146 + int min_len; 1149 1147 1150 1148 if (!S_ISDIR(inode->v.i_mode) && dir) { 1151 1149 struct bcachefs_fid_with_parent *fid = (void *) fh; 1152 1150 1151 + min_len = sizeof(*fid) / sizeof(u32); 1152 + if (*len < min_len) { 1153 + *len = min_len; 1154 + return FILEID_INVALID; 1155 + } 1156 + 1153 1157 fid->fid = bch2_inode_to_fid(inode); 1154 1158 fid->dir = bch2_inode_to_fid(dir); 1155 1159 1156 - *len = sizeof(*fid) / sizeof(u32); 1160 + *len = min_len; 1157 1161 return FILEID_BCACHEFS_WITH_PARENT; 1158 1162 } else { 1159 1163 struct bcachefs_fid *fid = (void *) fh; 1160 1164 1165 + min_len = sizeof(*fid) / sizeof(u32); 1166 + if (*len < min_len) { 1167 + *len = min_len; 1168 + return FILEID_INVALID; 1169 + } 1161 1170 *fid = bch2_inode_to_fid(inode); 1162 1171 1163 - *len = sizeof(*fid) / sizeof(u32); 1172 + *len = min_len; 1164 1173 return FILEID_BCACHEFS_WITHOUT_PARENT; 1165 1174 } 1166 1175 }
+3
fs/bcachefs/recovery.h
··· 10 10 static inline int bch2_run_explicit_recovery_pass(struct bch_fs *c, 11 11 enum bch_recovery_pass pass) 12 12 { 13 + if (c->recovery_passes_explicit & BIT_ULL(pass)) 14 + return 0; 15 + 13 16 bch_info(c, "running explicit recovery pass %s (%u), currently at %s (%u)", 14 17 bch2_recovery_passes[pass], pass, 15 18 bch2_recovery_passes[c->curr_recovery_pass], c->curr_recovery_pass);
+7
fs/bcachefs/super.c
··· 72 72 MODULE_LICENSE("GPL"); 73 73 MODULE_AUTHOR("Kent Overstreet <kent.overstreet@gmail.com>"); 74 74 MODULE_DESCRIPTION("bcachefs filesystem"); 75 + MODULE_SOFTDEP("pre: crc32c"); 76 + MODULE_SOFTDEP("pre: crc64"); 77 + MODULE_SOFTDEP("pre: sha256"); 78 + MODULE_SOFTDEP("pre: chacha20"); 79 + MODULE_SOFTDEP("pre: poly1305"); 80 + MODULE_SOFTDEP("pre: xxhash"); 75 81 76 82 #define KTYPE(type) \ 77 83 static const struct attribute_group type ## _group = { \ ··· 720 714 721 715 bch2_fs_copygc_init(c); 722 716 bch2_fs_btree_key_cache_init_early(&c->btree_key_cache); 717 + bch2_fs_btree_iter_init_early(c); 723 718 bch2_fs_btree_interior_update_init_early(c); 724 719 bch2_fs_allocator_background_init(c); 725 720 bch2_fs_allocator_foreground_init(c);
+9
fs/btrfs/ioctl.c
··· 1290 1290 * are limited to own subvolumes only 1291 1291 */ 1292 1292 ret = -EPERM; 1293 + } else if (btrfs_ino(BTRFS_I(src_inode)) != BTRFS_FIRST_FREE_OBJECTID) { 1294 + /* 1295 + * Snapshots must be made with the src_inode referring 1296 + * to the subvolume inode, otherwise the permission 1297 + * checking above is useless because we may have 1298 + * permission on a lower directory but not the subvol 1299 + * itself. 1300 + */ 1301 + ret = -EINVAL; 1293 1302 } else { 1294 1303 ret = btrfs_mksnapshot(&file->f_path, idmap, 1295 1304 name, namelen,
-4
fs/nfsd/auth.c
··· 26 26 int i; 27 27 int flags = nfsexp_flags(rqstp, exp); 28 28 29 - validate_process_creds(); 30 - 31 29 /* discard any old override before preparing the new set */ 32 30 revert_creds(get_cred(current_real_cred())); 33 31 new = prepare_creds(); ··· 79 81 else 80 82 new->cap_effective = cap_raise_nfsd_set(new->cap_effective, 81 83 new->cap_permitted); 82 - validate_process_creds(); 83 84 put_cred(override_creds(new)); 84 85 put_cred(new); 85 - validate_process_creds(); 86 86 return 0; 87 87 88 88 oom:
+1 -96
fs/nfsd/nfs4callback.c
··· 84 84 static void encode_bitmap4(struct xdr_stream *xdr, const __u32 *bitmap, 85 85 size_t len) 86 86 { 87 - xdr_stream_encode_uint32_array(xdr, bitmap, len); 88 - } 89 - 90 - static int decode_cb_fattr4(struct xdr_stream *xdr, uint32_t *bitmap, 91 - struct nfs4_cb_fattr *fattr) 92 - { 93 - fattr->ncf_cb_change = 0; 94 - fattr->ncf_cb_fsize = 0; 95 - if (bitmap[0] & FATTR4_WORD0_CHANGE) 96 - if (xdr_stream_decode_u64(xdr, &fattr->ncf_cb_change) < 0) 97 - return -NFSERR_BAD_XDR; 98 - if (bitmap[0] & FATTR4_WORD0_SIZE) 99 - if (xdr_stream_decode_u64(xdr, &fattr->ncf_cb_fsize) < 0) 100 - return -NFSERR_BAD_XDR; 101 - return 0; 87 + WARN_ON_ONCE(xdr_stream_encode_uint32_array(xdr, bitmap, len) < 0); 102 88 } 103 89 104 90 /* ··· 358 372 } 359 373 360 374 /* 361 - * CB_GETATTR4args 362 - * struct CB_GETATTR4args { 363 - * nfs_fh4 fh; 364 - * bitmap4 attr_request; 365 - * }; 366 - * 367 - * The size and change attributes are the only one 368 - * guaranteed to be serviced by the client. 369 - */ 370 - static void 371 - encode_cb_getattr4args(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr, 372 - struct nfs4_cb_fattr *fattr) 373 - { 374 - struct nfs4_delegation *dp = 375 - container_of(fattr, struct nfs4_delegation, dl_cb_fattr); 376 - struct knfsd_fh *fh = &dp->dl_stid.sc_file->fi_fhandle; 377 - 378 - encode_nfs_cb_opnum4(xdr, OP_CB_GETATTR); 379 - encode_nfs_fh4(xdr, fh); 380 - encode_bitmap4(xdr, fattr->ncf_cb_bmap, ARRAY_SIZE(fattr->ncf_cb_bmap)); 381 - hdr->nops++; 382 - } 383 - 384 - /* 385 375 * CB_SEQUENCE4args 386 376 * 387 377 * struct CB_SEQUENCE4args { ··· 493 531 } 494 532 495 533 /* 496 - * 20.1. Operation 3: CB_GETATTR - Get Attributes 497 - */ 498 - static void nfs4_xdr_enc_cb_getattr(struct rpc_rqst *req, 499 - struct xdr_stream *xdr, const void *data) 500 - { 501 - const struct nfsd4_callback *cb = data; 502 - struct nfs4_cb_fattr *ncf = 503 - container_of(cb, struct nfs4_cb_fattr, ncf_getattr); 504 - struct nfs4_cb_compound_hdr hdr = { 505 - .ident = cb->cb_clp->cl_cb_ident, 506 - .minorversion = cb->cb_clp->cl_minorversion, 507 - }; 508 - 509 - encode_cb_compound4args(xdr, &hdr); 510 - encode_cb_sequence4args(xdr, cb, &hdr); 511 - encode_cb_getattr4args(xdr, &hdr, ncf); 512 - encode_cb_nops(&hdr); 513 - } 514 - 515 - /* 516 534 * 20.2. Operation 4: CB_RECALL - Recall a Delegation 517 535 */ 518 536 static void nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, struct xdr_stream *xdr, ··· 545 603 void *__unused) 546 604 { 547 605 return 0; 548 - } 549 - 550 - /* 551 - * 20.1. Operation 3: CB_GETATTR - Get Attributes 552 - */ 553 - static int nfs4_xdr_dec_cb_getattr(struct rpc_rqst *rqstp, 554 - struct xdr_stream *xdr, 555 - void *data) 556 - { 557 - struct nfsd4_callback *cb = data; 558 - struct nfs4_cb_compound_hdr hdr; 559 - int status; 560 - u32 bitmap[3] = {0}; 561 - u32 attrlen; 562 - struct nfs4_cb_fattr *ncf = 563 - container_of(cb, struct nfs4_cb_fattr, ncf_getattr); 564 - 565 - status = decode_cb_compound4res(xdr, &hdr); 566 - if (unlikely(status)) 567 - return status; 568 - 569 - status = decode_cb_sequence4res(xdr, cb); 570 - if (unlikely(status || cb->cb_seq_status)) 571 - return status; 572 - 573 - status = decode_cb_op_status(xdr, OP_CB_GETATTR, &cb->cb_status); 574 - if (status) 575 - return status; 576 - if (xdr_stream_decode_uint32_array(xdr, bitmap, 3) < 0) 577 - return -NFSERR_BAD_XDR; 578 - if (xdr_stream_decode_u32(xdr, &attrlen) < 0) 579 - return -NFSERR_BAD_XDR; 580 - if (attrlen > (sizeof(ncf->ncf_cb_change) + sizeof(ncf->ncf_cb_fsize))) 581 - return -NFSERR_BAD_XDR; 582 - status = decode_cb_fattr4(xdr, bitmap, ncf); 583 - return status; 584 606 } 585 607 586 608 /* ··· 855 949 PROC(CB_NOTIFY_LOCK, COMPOUND, cb_notify_lock, cb_notify_lock), 856 950 PROC(CB_OFFLOAD, COMPOUND, cb_offload, cb_offload), 857 951 PROC(CB_RECALL_ANY, COMPOUND, cb_recall_any, cb_recall_any), 858 - PROC(CB_GETATTR, COMPOUND, cb_getattr, cb_getattr), 859 952 }; 860 953 861 954 static unsigned int nfs4_cb_counts[ARRAY_SIZE(nfs4_cb_procedures)];
+12 -104
fs/nfsd/nfs4state.c
··· 127 127 128 128 static const struct nfsd4_callback_ops nfsd4_cb_recall_ops; 129 129 static const struct nfsd4_callback_ops nfsd4_cb_notify_lock_ops; 130 - static const struct nfsd4_callback_ops nfsd4_cb_getattr_ops; 131 130 132 131 static struct workqueue_struct *laundry_wq; 133 132 ··· 1189 1190 dp->dl_recalled = false; 1190 1191 nfsd4_init_cb(&dp->dl_recall, dp->dl_stid.sc_client, 1191 1192 &nfsd4_cb_recall_ops, NFSPROC4_CLNT_CB_RECALL); 1192 - nfsd4_init_cb(&dp->dl_cb_fattr.ncf_getattr, dp->dl_stid.sc_client, 1193 - &nfsd4_cb_getattr_ops, NFSPROC4_CLNT_CB_GETATTR); 1194 - dp->dl_cb_fattr.ncf_file_modified = false; 1195 - dp->dl_cb_fattr.ncf_cb_bmap[0] = FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE; 1196 1193 get_nfs4_file(fp); 1197 1194 dp->dl_stid.sc_file = fp; 1198 1195 return dp; ··· 2896 2901 spin_unlock(&nn->client_lock); 2897 2902 } 2898 2903 2899 - static int 2900 - nfsd4_cb_getattr_done(struct nfsd4_callback *cb, struct rpc_task *task) 2901 - { 2902 - struct nfs4_cb_fattr *ncf = 2903 - container_of(cb, struct nfs4_cb_fattr, ncf_getattr); 2904 - 2905 - ncf->ncf_cb_status = task->tk_status; 2906 - switch (task->tk_status) { 2907 - case -NFS4ERR_DELAY: 2908 - rpc_delay(task, 2 * HZ); 2909 - return 0; 2910 - default: 2911 - return 1; 2912 - } 2913 - } 2914 - 2915 - static void 2916 - nfsd4_cb_getattr_release(struct nfsd4_callback *cb) 2917 - { 2918 - struct nfs4_cb_fattr *ncf = 2919 - container_of(cb, struct nfs4_cb_fattr, ncf_getattr); 2920 - struct nfs4_delegation *dp = 2921 - container_of(ncf, struct nfs4_delegation, dl_cb_fattr); 2922 - 2923 - nfs4_put_stid(&dp->dl_stid); 2924 - clear_bit(CB_GETATTR_BUSY, &ncf->ncf_cb_flags); 2925 - wake_up_bit(&ncf->ncf_cb_flags, CB_GETATTR_BUSY); 2926 - } 2927 - 2928 2904 static const struct nfsd4_callback_ops nfsd4_cb_recall_any_ops = { 2929 2905 .done = nfsd4_cb_recall_any_done, 2930 2906 .release = nfsd4_cb_recall_any_release, 2931 2907 }; 2932 - 2933 - static const struct nfsd4_callback_ops nfsd4_cb_getattr_ops = { 2934 - .done = nfsd4_cb_getattr_done, 2935 - .release = nfsd4_cb_getattr_release, 2936 - }; 2937 - 2938 - void nfs4_cb_getattr(struct nfs4_cb_fattr *ncf) 2939 - { 2940 - struct nfs4_delegation *dp = 2941 - container_of(ncf, struct nfs4_delegation, dl_cb_fattr); 2942 - 2943 - if (test_and_set_bit(CB_GETATTR_BUSY, &ncf->ncf_cb_flags)) 2944 - return; 2945 - refcount_inc(&dp->dl_stid.sc_count); 2946 - nfsd4_run_cb(&ncf->ncf_getattr); 2947 - } 2948 2908 2949 2909 static struct nfs4_client *create_client(struct xdr_netobj name, 2950 2910 struct svc_rqst *rqstp, nfs4_verifier *verf) ··· 5635 5685 struct svc_fh *parent = NULL; 5636 5686 int cb_up; 5637 5687 int status = 0; 5638 - struct kstat stat; 5639 - struct path path; 5640 5688 5641 5689 cb_up = nfsd4_cb_channel_good(oo->oo_owner.so_client); 5642 5690 open->op_recall = false; ··· 5672 5724 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) { 5673 5725 open->op_delegate_type = NFS4_OPEN_DELEGATE_WRITE; 5674 5726 trace_nfsd_deleg_write(&dp->dl_stid.sc_stateid); 5675 - path.mnt = currentfh->fh_export->ex_path.mnt; 5676 - path.dentry = currentfh->fh_dentry; 5677 - if (vfs_getattr(&path, &stat, 5678 - (STATX_SIZE | STATX_CTIME | STATX_CHANGE_COOKIE), 5679 - AT_STATX_SYNC_AS_STAT)) { 5680 - nfs4_put_stid(&dp->dl_stid); 5681 - destroy_delegation(dp); 5682 - goto out_no_deleg; 5683 - } 5684 - dp->dl_cb_fattr.ncf_cur_fsize = stat.size; 5685 - dp->dl_cb_fattr.ncf_initial_cinfo = 5686 - nfsd4_change_attribute(&stat, d_inode(currentfh->fh_dentry)); 5687 5727 } else { 5688 5728 open->op_delegate_type = NFS4_OPEN_DELEGATE_READ; 5689 5729 trace_nfsd_deleg_read(&dp->dl_stid.sc_stateid); ··· 8428 8492 * nfsd4_deleg_getattr_conflict - Recall if GETATTR causes conflict 8429 8493 * @rqstp: RPC transaction context 8430 8494 * @inode: file to be checked for a conflict 8431 - * @modified: return true if file was modified 8432 - * @size: new size of file if modified is true 8433 8495 * 8434 8496 * This function is called when there is a conflict between a write 8435 8497 * delegation and a change/size GETATTR from another client. The server ··· 8436 8502 * delegation before replying to the GETATTR. See RFC 8881 section 8437 8503 * 18.7.4. 8438 8504 * 8505 + * The current implementation does not support CB_GETATTR yet. However 8506 + * this can avoid recalling the delegation could be added in follow up 8507 + * work. 8508 + * 8439 8509 * Returns 0 if there is no conflict; otherwise an nfs_stat 8440 8510 * code is returned. 8441 8511 */ 8442 8512 __be32 8443 - nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp, struct inode *inode, 8444 - bool *modified, u64 *size) 8513 + nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp, struct inode *inode) 8445 8514 { 8446 - struct file_lock_context *ctx; 8447 - struct nfs4_delegation *dp; 8448 - struct nfs4_cb_fattr *ncf; 8449 - struct file_lock *fl; 8450 - struct iattr attrs; 8451 8515 __be32 status; 8516 + struct file_lock_context *ctx; 8517 + struct file_lock *fl; 8518 + struct nfs4_delegation *dp; 8452 8519 8453 - might_sleep(); 8454 - 8455 - *modified = false; 8456 8520 ctx = locks_inode_context(inode); 8457 8521 if (!ctx) 8458 8522 return 0; ··· 8477 8545 break_lease: 8478 8546 spin_unlock(&ctx->flc_lock); 8479 8547 nfsd_stats_wdeleg_getattr_inc(); 8480 - 8481 - dp = fl->fl_owner; 8482 - ncf = &dp->dl_cb_fattr; 8483 - nfs4_cb_getattr(&dp->dl_cb_fattr); 8484 - wait_on_bit(&ncf->ncf_cb_flags, CB_GETATTR_BUSY, TASK_INTERRUPTIBLE); 8485 - if (ncf->ncf_cb_status) { 8486 - status = nfserrno(nfsd_open_break_lease(inode, NFSD_MAY_READ)); 8487 - if (status != nfserr_jukebox || 8488 - !nfsd_wait_for_delegreturn(rqstp, inode)) 8489 - return status; 8490 - } 8491 - if (!ncf->ncf_file_modified && 8492 - (ncf->ncf_initial_cinfo != ncf->ncf_cb_change || 8493 - ncf->ncf_cur_fsize != ncf->ncf_cb_fsize)) 8494 - ncf->ncf_file_modified = true; 8495 - if (ncf->ncf_file_modified) { 8496 - /* 8497 - * The server would not update the file's metadata 8498 - * with the client's modified size. 8499 - */ 8500 - attrs.ia_mtime = attrs.ia_ctime = current_time(inode); 8501 - attrs.ia_valid = ATTR_MTIME | ATTR_CTIME; 8502 - setattr_copy(&nop_mnt_idmap, inode, &attrs); 8503 - mark_inode_dirty(inode); 8504 - ncf->ncf_cur_fsize = ncf->ncf_cb_fsize; 8505 - *size = ncf->ncf_cur_fsize; 8506 - *modified = true; 8507 - } 8548 + status = nfserrno(nfsd_open_break_lease(inode, NFSD_MAY_READ)); 8549 + if (status != nfserr_jukebox || 8550 + !nfsd_wait_for_delegreturn(rqstp, inode)) 8551 + return status; 8508 8552 return 0; 8509 8553 } 8510 8554 break;
+2 -5
fs/nfsd/nfs4xdr.c
··· 3505 3505 u32 attrmask[3]; 3506 3506 unsigned long mask[2]; 3507 3507 } u; 3508 - bool file_modified; 3509 3508 unsigned long bit; 3510 - u64 size = 0; 3511 3509 3512 3510 WARN_ON_ONCE(bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1); 3513 3511 WARN_ON_ONCE(!nfsd_attrs_supported(minorversion, bmval)); ··· 3532 3534 } 3533 3535 args.size = 0; 3534 3536 if (u.attrmask[0] & (FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE)) { 3535 - status = nfsd4_deleg_getattr_conflict(rqstp, d_inode(dentry), 3536 - &file_modified, &size); 3537 + status = nfsd4_deleg_getattr_conflict(rqstp, d_inode(dentry)); 3537 3538 if (status) 3538 3539 goto out; 3539 3540 } ··· 3542 3545 AT_STATX_SYNC_AS_STAT); 3543 3546 if (err) 3544 3547 goto out_nfserr; 3545 - args.size = file_modified ? size : args.stat.size; 3548 + args.size = args.stat.size; 3546 3549 3547 3550 if (!(args.stat.result_mask & STATX_BTIME)) 3548 3551 /* underlying FS does not offer btime so we can't share it */
+10 -8
fs/nfsd/nfsctl.c
··· 705 705 706 706 err = svc_addsock(nn->nfsd_serv, net, fd, buf, SIMPLE_TRANSACTION_LIMIT, cred); 707 707 708 - if (err >= 0 && 709 - !nn->nfsd_serv->sv_nrthreads && !xchg(&nn->keep_active, 1)) 708 + if (err < 0 && !nn->nfsd_serv->sv_nrthreads && !nn->keep_active) 709 + nfsd_last_thread(net); 710 + else if (err >= 0 && 711 + !nn->nfsd_serv->sv_nrthreads && !xchg(&nn->keep_active, 1)) 710 712 svc_get(nn->nfsd_serv); 711 713 712 714 nfsd_put(net); ··· 759 757 svc_xprt_put(xprt); 760 758 } 761 759 out_err: 760 + if (!nn->nfsd_serv->sv_nrthreads && !nn->keep_active) 761 + nfsd_last_thread(net); 762 + 762 763 nfsd_put(net); 763 764 return err; 764 765 } ··· 1515 1510 int ret = -ENODEV; 1516 1511 1517 1512 mutex_lock(&nfsd_mutex); 1518 - if (nn->nfsd_serv) { 1519 - svc_get(nn->nfsd_serv); 1513 + if (nn->nfsd_serv) 1520 1514 ret = 0; 1521 - } 1522 - mutex_unlock(&nfsd_mutex); 1515 + else 1516 + mutex_unlock(&nfsd_mutex); 1523 1517 1524 1518 return ret; 1525 1519 } ··· 1690 1686 */ 1691 1687 int nfsd_nl_rpc_status_get_done(struct netlink_callback *cb) 1692 1688 { 1693 - mutex_lock(&nfsd_mutex); 1694 - nfsd_put(sock_net(cb->skb->sk)); 1695 1689 mutex_unlock(&nfsd_mutex); 1696 1690 1697 1691 return 0;
+1
fs/nfsd/nfsd.h
··· 155 155 int nfsd_minorversion(struct nfsd_net *nn, u32 minorversion, enum vers_op change); 156 156 void nfsd_reset_versions(struct nfsd_net *nn); 157 157 int nfsd_create_serv(struct net *net); 158 + void nfsd_last_thread(struct net *net); 158 159 159 160 extern int nfsd_max_blksize; 160 161
+1 -2
fs/nfsd/nfssvc.c
··· 542 542 /* Only used under nfsd_mutex, so this atomic may be overkill: */ 543 543 static atomic_t nfsd_notifier_refcount = ATOMIC_INIT(0); 544 544 545 - static void nfsd_last_thread(struct net *net) 545 + void nfsd_last_thread(struct net *net) 546 546 { 547 547 struct nfsd_net *nn = net_generic(net, nfsd_net_id); 548 548 struct svc_serv *serv = nn->nfsd_serv; ··· 955 955 rqstp->rq_server->sv_maxconn = nn->max_connections; 956 956 957 957 svc_recv(rqstp); 958 - validate_process_creds(); 959 958 } 960 959 961 960 atomic_dec(&nfsdstats.th_cnt);
+1 -24
fs/nfsd/state.h
··· 117 117 time64_t cpntf_time; /* last time stateid used */ 118 118 }; 119 119 120 - struct nfs4_cb_fattr { 121 - struct nfsd4_callback ncf_getattr; 122 - u32 ncf_cb_status; 123 - u32 ncf_cb_bmap[1]; 124 - 125 - /* from CB_GETATTR reply */ 126 - u64 ncf_cb_change; 127 - u64 ncf_cb_fsize; 128 - 129 - unsigned long ncf_cb_flags; 130 - bool ncf_file_modified; 131 - u64 ncf_initial_cinfo; 132 - u64 ncf_cur_fsize; 133 - }; 134 - 135 - /* bits for ncf_cb_flags */ 136 - #define CB_GETATTR_BUSY 0 137 - 138 120 /* 139 121 * Represents a delegation stateid. The nfs4_client holds references to these 140 122 * and they are put when it is being destroyed or when the delegation is ··· 150 168 int dl_retries; 151 169 struct nfsd4_callback dl_recall; 152 170 bool dl_recalled; 153 - 154 - /* for CB_GETATTR */ 155 - struct nfs4_cb_fattr dl_cb_fattr; 156 171 }; 157 172 158 173 #define cb_to_delegation(cb) \ ··· 640 661 NFSPROC4_CLNT_CB_SEQUENCE, 641 662 NFSPROC4_CLNT_CB_NOTIFY_LOCK, 642 663 NFSPROC4_CLNT_CB_RECALL_ANY, 643 - NFSPROC4_CLNT_CB_GETATTR, 644 664 }; 645 665 646 666 /* Returns true iff a is later than b: */ ··· 732 754 } 733 755 734 756 extern __be32 nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp, 735 - struct inode *inode, bool *file_modified, u64 *size); 736 - extern void nfs4_cb_getattr(struct nfs4_cb_fattr *ncf); 757 + struct inode *inode); 737 758 #endif /* NFSD4_STATE_H */
+1 -8
fs/nfsd/vfs.c
··· 901 901 int host_err; 902 902 bool retried = false; 903 903 904 - validate_process_creds(); 905 904 /* 906 905 * If we get here, then the client has already done an "open", 907 906 * and (hopefully) checked permission - so allow OWNER_OVERRIDE ··· 925 926 } 926 927 err = nfserrno(host_err); 927 928 } 928 - validate_process_creds(); 929 929 return err; 930 930 } 931 931 ··· 941 943 nfsd_open_verified(struct svc_rqst *rqstp, struct svc_fh *fhp, int may_flags, 942 944 struct file **filp) 943 945 { 944 - int err; 945 - 946 - validate_process_creds(); 947 - err = __nfsd_open(rqstp, fhp, S_IFREG, may_flags, filp); 948 - validate_process_creds(); 949 - return err; 946 + return __nfsd_open(rqstp, fhp, S_IFREG, may_flags, filp); 950 947 } 951 948 952 949 /*
-18
fs/nfsd/xdr4cb.h
··· 54 54 #define NFS4_dec_cb_recall_any_sz (cb_compound_dec_hdr_sz + \ 55 55 cb_sequence_dec_sz + \ 56 56 op_dec_sz) 57 - 58 - /* 59 - * 1: CB_GETATTR opcode (32-bit) 60 - * N: file_handle 61 - * 1: number of entry in attribute array (32-bit) 62 - * 1: entry 0 in attribute array (32-bit) 63 - */ 64 - #define NFS4_enc_cb_getattr_sz (cb_compound_enc_hdr_sz + \ 65 - cb_sequence_enc_sz + \ 66 - 1 + enc_nfs4_fh_sz + 1 + 1) 67 - /* 68 - * 4: fattr_bitmap_maxsz 69 - * 1: attribute array len 70 - * 2: change attr (64-bit) 71 - * 2: size (64-bit) 72 - */ 73 - #define NFS4_dec_cb_getattr_sz (cb_compound_dec_hdr_sz + \ 74 - cb_sequence_dec_sz + 4 + 1 + 2 + 2 + op_dec_sz)
-3
fs/open.c
··· 1088 1088 int error; 1089 1089 struct file *f; 1090 1090 1091 - validate_creds(cred); 1092 - 1093 1091 /* We must always pass in a valid mount pointer. */ 1094 1092 BUG_ON(!path->mnt); 1095 1093 ··· 1126 1128 struct file *f; 1127 1129 int error; 1128 1130 1129 - validate_creds(cred); 1130 1131 f = alloc_empty_file(flags, cred); 1131 1132 if (IS_ERR(f)) 1132 1133 return f;
+3 -2
fs/overlayfs/copy_up.c
··· 753 753 path.dentry = temp; 754 754 err = ovl_copy_up_data(c, &path); 755 755 /* 756 - * We cannot hold lock_rename() throughout this helper, because or 756 + * We cannot hold lock_rename() throughout this helper, because of 757 757 * lock ordering with sb_writers, which shouldn't be held when calling 758 758 * ovl_copy_up_data(), so lock workdir and destdir and make sure that 759 759 * temp wasn't moved before copy up completion or cleanup. 760 - * If temp was moved, abort without the cleanup. 761 760 */ 762 761 ovl_start_write(c->dentry); 763 762 if (lock_rename(c->workdir, c->destdir) != NULL || 764 763 temp->d_parent != c->workdir) { 764 + /* temp or workdir moved underneath us? abort without cleanup */ 765 + dput(temp); 765 766 err = -EIO; 766 767 goto unlock; 767 768 } else if (err) {
+12 -5
fs/smb/client/cached_dir.c
··· 291 291 oparms.fid->mid = le64_to_cpu(o_rsp->hdr.MessageId); 292 292 #endif /* CIFS_DEBUG2 */ 293 293 294 - rc = -EINVAL; 294 + 295 295 if (o_rsp->OplockLevel != SMB2_OPLOCK_LEVEL_LEASE) { 296 + spin_unlock(&cfids->cfid_list_lock); 297 + rc = -EINVAL; 298 + goto oshr_free; 299 + } 300 + 301 + rc = smb2_parse_contexts(server, rsp_iov, 302 + &oparms.fid->epoch, 303 + oparms.fid->lease_key, 304 + &oplock, NULL, NULL); 305 + if (rc) { 296 306 spin_unlock(&cfids->cfid_list_lock); 297 307 goto oshr_free; 298 308 } 299 309 300 - smb2_parse_contexts(server, o_rsp, 301 - &oparms.fid->epoch, 302 - oparms.fid->lease_key, &oplock, 303 - NULL, NULL); 310 + rc = -EINVAL; 304 311 if (!(oplock & SMB2_LEASE_READ_CACHING_HE)) { 305 312 spin_unlock(&cfids->cfid_list_lock); 306 313 goto oshr_free;
+7 -5
fs/smb/client/cifs_debug.c
··· 40 40 #ifdef CONFIG_CIFS_DEBUG2 41 41 struct smb_hdr *smb = buf; 42 42 43 - cifs_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d\n", 44 - smb->Command, smb->Status.CifsError, 45 - smb->Flags, smb->Flags2, smb->Mid, smb->Pid); 46 - cifs_dbg(VFS, "smb buf %p len %u\n", smb, 47 - server->ops->calc_smb_size(smb)); 43 + cifs_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d Wct: %d\n", 44 + smb->Command, smb->Status.CifsError, smb->Flags, 45 + smb->Flags2, smb->Mid, smb->Pid, smb->WordCount); 46 + if (!server->ops->check_message(buf, server->total_read, server)) { 47 + cifs_dbg(VFS, "smb buf %p len %u\n", smb, 48 + server->ops->calc_smb_size(smb)); 49 + } 48 50 #endif /* CONFIG_CIFS_DEBUG2 */ 49 51 } 50 52
+2 -1
fs/smb/client/cifsglob.h
··· 532 532 struct mid_q_entry **, char **, int *); 533 533 enum securityEnum (*select_sectype)(struct TCP_Server_Info *, 534 534 enum securityEnum); 535 - int (*next_header)(char *); 535 + int (*next_header)(struct TCP_Server_Info *server, char *buf, 536 + unsigned int *noff); 536 537 /* ioctl passthrough for query_info */ 537 538 int (*ioctl_query_info)(const unsigned int xid, 538 539 struct cifs_tcon *tcon,
+6 -1
fs/smb/client/connect.c
··· 1201 1201 server->total_read += length; 1202 1202 1203 1203 if (server->ops->next_header) { 1204 - next_offset = server->ops->next_header(buf); 1204 + if (server->ops->next_header(server, buf, &next_offset)) { 1205 + cifs_dbg(VFS, "%s: malformed response (next_offset=%u)\n", 1206 + __func__, next_offset); 1207 + cifs_reconnect(server, true); 1208 + continue; 1209 + } 1205 1210 if (next_offset) 1206 1211 server->pdu_size = next_offset; 1207 1212 }
+1 -1
fs/smb/client/file.c
··· 4671 4671 /* we do not want atime to be less than mtime, it broke some apps */ 4672 4672 atime = inode_set_atime_to_ts(inode, current_time(inode)); 4673 4673 mtime = inode_get_mtime(inode); 4674 - if (timespec64_compare(&atime, &mtime)) 4674 + if (timespec64_compare(&atime, &mtime) < 0) 4675 4675 inode_set_atime_to_ts(inode, inode_get_mtime(inode)); 4676 4676 4677 4677 if (PAGE_SIZE > rc)
+4
fs/smb/client/misc.c
··· 363 363 cifs_dbg(VFS, "Length less than smb header size\n"); 364 364 } 365 365 return -EIO; 366 + } else if (total_read < sizeof(*smb) + 2 * smb->WordCount) { 367 + cifs_dbg(VFS, "%s: can't read BCC due to invalid WordCount(%u)\n", 368 + __func__, smb->WordCount); 369 + return -EIO; 366 370 } 367 371 368 372 /* otherwise, there is enough to get to the BCC */
+19 -31
fs/smb/client/sess.c
··· 439 439 cifs_dbg(FYI, "unable to find a suitable iface\n"); 440 440 } 441 441 442 - if (!chan_index && !iface) { 442 + if (!iface) { 443 443 cifs_dbg(FYI, "unable to get the interface matching: %pIS\n", 444 444 &ss); 445 445 spin_unlock(&ses->iface_lock); ··· 447 447 } 448 448 449 449 /* now drop the ref to the current iface */ 450 - if (old_iface && iface) { 450 + if (old_iface) { 451 451 cifs_dbg(FYI, "replacing iface: %pIS with %pIS\n", 452 452 &old_iface->sockaddr, 453 453 &iface->sockaddr); ··· 460 460 461 461 kref_put(&old_iface->refcount, release_iface); 462 462 } else if (old_iface) { 463 - cifs_dbg(FYI, "releasing ref to iface: %pIS\n", 463 + /* if a new candidate is not found, keep things as is */ 464 + cifs_dbg(FYI, "could not replace iface: %pIS\n", 464 465 &old_iface->sockaddr); 465 - 466 - old_iface->num_channels--; 467 - if (old_iface->weight_fulfilled) 468 - old_iface->weight_fulfilled--; 469 - 470 - kref_put(&old_iface->refcount, release_iface); 471 466 } else if (!chan_index) { 472 467 /* special case: update interface for primary channel */ 473 - cifs_dbg(FYI, "referencing primary channel iface: %pIS\n", 474 - &iface->sockaddr); 475 - iface->num_channels++; 476 - iface->weight_fulfilled++; 477 - } else { 478 - WARN_ON(!iface); 479 - cifs_dbg(FYI, "adding new iface: %pIS\n", &iface->sockaddr); 468 + if (iface) { 469 + cifs_dbg(FYI, "referencing primary channel iface: %pIS\n", 470 + &iface->sockaddr); 471 + iface->num_channels++; 472 + iface->weight_fulfilled++; 473 + } 480 474 } 481 475 spin_unlock(&ses->iface_lock); 482 476 483 - spin_lock(&ses->chan_lock); 484 - chan_index = cifs_ses_get_chan_index(ses, server); 485 - if (chan_index == CIFS_INVAL_CHAN_INDEX) { 477 + if (iface) { 478 + spin_lock(&ses->chan_lock); 479 + chan_index = cifs_ses_get_chan_index(ses, server); 480 + if (chan_index == CIFS_INVAL_CHAN_INDEX) { 481 + spin_unlock(&ses->chan_lock); 482 + return 0; 483 + } 484 + 485 + ses->chans[chan_index].iface = iface; 486 486 spin_unlock(&ses->chan_lock); 487 - return 0; 488 487 } 489 - 490 - ses->chans[chan_index].iface = iface; 491 - 492 - /* No iface is found. if secondary chan, drop connection */ 493 - if (!iface && SERVER_IS_CHAN(server)) 494 - ses->chans[chan_index].server = NULL; 495 - 496 - spin_unlock(&ses->chan_lock); 497 - 498 - if (!iface && SERVER_IS_CHAN(server)) 499 - cifs_put_tcp_session(server, false); 500 488 501 489 return rc; 502 490 }
+25 -31
fs/smb/client/smb2misc.c
··· 173 173 } 174 174 175 175 mid = le64_to_cpu(shdr->MessageId); 176 + if (check_smb2_hdr(shdr, mid)) 177 + return 1; 178 + 179 + if (shdr->StructureSize != SMB2_HEADER_STRUCTURE_SIZE) { 180 + cifs_dbg(VFS, "Invalid structure size %u\n", 181 + le16_to_cpu(shdr->StructureSize)); 182 + return 1; 183 + } 184 + 185 + command = le16_to_cpu(shdr->Command); 186 + if (command >= NUMBER_OF_SMB2_COMMANDS) { 187 + cifs_dbg(VFS, "Invalid SMB2 command %d\n", command); 188 + return 1; 189 + } 190 + 176 191 if (len < pdu_size) { 177 192 if ((len >= hdr_size) 178 193 && (shdr->Status != 0)) { ··· 205 190 if (len > CIFSMaxBufSize + MAX_SMB2_HDR_SIZE) { 206 191 cifs_dbg(VFS, "SMB length greater than maximum, mid=%llu\n", 207 192 mid); 208 - return 1; 209 - } 210 - 211 - if (check_smb2_hdr(shdr, mid)) 212 - return 1; 213 - 214 - if (shdr->StructureSize != SMB2_HEADER_STRUCTURE_SIZE) { 215 - cifs_dbg(VFS, "Invalid structure size %u\n", 216 - le16_to_cpu(shdr->StructureSize)); 217 - return 1; 218 - } 219 - 220 - command = le16_to_cpu(shdr->Command); 221 - if (command >= NUMBER_OF_SMB2_COMMANDS) { 222 - cifs_dbg(VFS, "Invalid SMB2 command %d\n", command); 223 193 return 1; 224 194 } 225 195 ··· 313 313 char * 314 314 smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *shdr) 315 315 { 316 + const int max_off = 4096; 317 + const int max_len = 128 * 1024; 318 + 316 319 *off = 0; 317 320 *len = 0; 318 321 ··· 387 384 * Invalid length or offset probably means data area is invalid, but 388 385 * we have little choice but to ignore the data area in this case. 389 386 */ 390 - if (*off > 4096) { 391 - cifs_dbg(VFS, "offset %d too large, data area ignored\n", *off); 392 - *len = 0; 393 - *off = 0; 394 - } else if (*off < 0) { 395 - cifs_dbg(VFS, "negative offset %d to data invalid ignore data area\n", 396 - *off); 387 + if (unlikely(*off < 0 || *off > max_off || 388 + *len < 0 || *len > max_len)) { 389 + cifs_dbg(VFS, "%s: invalid data area (off=%d len=%d)\n", 390 + __func__, *off, *len); 397 391 *off = 0; 398 392 *len = 0; 399 - } else if (*len < 0) { 400 - cifs_dbg(VFS, "negative data length %d invalid, data area ignored\n", 401 - *len); 402 - *len = 0; 403 - } else if (*len > 128 * 1024) { 404 - cifs_dbg(VFS, "data area larger than 128K: %d\n", *len); 393 + } else if (*off == 0) { 405 394 *len = 0; 406 395 } 407 396 408 397 /* return pointer to beginning of data area, ie offset from SMB start */ 409 - if ((*off != 0) && (*len != 0)) 398 + if (*off > 0 && *len > 0) 410 399 return (char *)shdr + *off; 411 - else 412 - return NULL; 400 + return NULL; 413 401 } 414 402 415 403 /*
+40 -25
fs/smb/client/smb2ops.c
··· 403 403 cifs_server_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Mid: %llu Pid: %d\n", 404 404 shdr->Command, shdr->Status, shdr->Flags, shdr->MessageId, 405 405 shdr->Id.SyncId.ProcessId); 406 - cifs_server_dbg(VFS, "smb buf %p len %u\n", buf, 407 - server->ops->calc_smb_size(buf)); 406 + if (!server->ops->check_message(buf, server->total_read, server)) { 407 + cifs_server_dbg(VFS, "smb buf %p len %u\n", buf, 408 + server->ops->calc_smb_size(buf)); 409 + } 408 410 #endif 409 411 } 410 412 ··· 3005 3003 struct kvec *rsp_iov; 3006 3004 struct smb2_ioctl_rsp *ioctl_rsp; 3007 3005 struct reparse_data_buffer *reparse_buf; 3008 - u32 plen; 3006 + u32 off, count, len; 3009 3007 3010 3008 cifs_dbg(FYI, "%s: path: %s\n", __func__, full_path); 3011 3009 ··· 3086 3084 */ 3087 3085 if (rc == 0) { 3088 3086 /* See MS-FSCC 2.3.23 */ 3087 + off = le32_to_cpu(ioctl_rsp->OutputOffset); 3088 + count = le32_to_cpu(ioctl_rsp->OutputCount); 3089 + if (check_add_overflow(off, count, &len) || 3090 + len > rsp_iov[1].iov_len) { 3091 + cifs_tcon_dbg(VFS, "%s: invalid ioctl: off=%d count=%d\n", 3092 + __func__, off, count); 3093 + rc = -EIO; 3094 + goto query_rp_exit; 3095 + } 3089 3096 3090 - reparse_buf = (struct reparse_data_buffer *) 3091 - ((char *)ioctl_rsp + 3092 - le32_to_cpu(ioctl_rsp->OutputOffset)); 3093 - plen = le32_to_cpu(ioctl_rsp->OutputCount); 3094 - 3095 - if (plen + le32_to_cpu(ioctl_rsp->OutputOffset) > 3096 - rsp_iov[1].iov_len) { 3097 - cifs_tcon_dbg(FYI, "srv returned invalid ioctl len: %d\n", 3098 - plen); 3097 + reparse_buf = (void *)((u8 *)ioctl_rsp + off); 3098 + len = sizeof(*reparse_buf); 3099 + if (count < len || 3100 + count < le16_to_cpu(reparse_buf->ReparseDataLength) + len) { 3101 + cifs_tcon_dbg(VFS, "%s: invalid ioctl: off=%d count=%d\n", 3102 + __func__, off, count); 3099 3103 rc = -EIO; 3100 3104 goto query_rp_exit; 3101 3105 } ··· 4951 4943 struct smb2_hdr *shdr; 4952 4944 unsigned int pdu_length = server->pdu_size; 4953 4945 unsigned int buf_size; 4946 + unsigned int next_cmd; 4954 4947 struct mid_q_entry *mid_entry; 4955 4948 int next_is_large; 4956 4949 char *next_buffer = NULL; ··· 4980 4971 next_is_large = server->large_buf; 4981 4972 one_more: 4982 4973 shdr = (struct smb2_hdr *)buf; 4983 - if (shdr->NextCommand) { 4974 + next_cmd = le32_to_cpu(shdr->NextCommand); 4975 + if (next_cmd) { 4976 + if (WARN_ON_ONCE(next_cmd > pdu_length)) 4977 + return -1; 4984 4978 if (next_is_large) 4985 4979 next_buffer = (char *)cifs_buf_get(); 4986 4980 else 4987 4981 next_buffer = (char *)cifs_small_buf_get(); 4988 - memcpy(next_buffer, 4989 - buf + le32_to_cpu(shdr->NextCommand), 4990 - pdu_length - le32_to_cpu(shdr->NextCommand)); 4982 + memcpy(next_buffer, buf + next_cmd, pdu_length - next_cmd); 4991 4983 } 4992 4984 4993 4985 mid_entry = smb2_find_mid(server, buf); ··· 5012 5002 else 5013 5003 ret = cifs_handle_standard(server, mid_entry); 5014 5004 5015 - if (ret == 0 && shdr->NextCommand) { 5016 - pdu_length -= le32_to_cpu(shdr->NextCommand); 5005 + if (ret == 0 && next_cmd) { 5006 + pdu_length -= next_cmd; 5017 5007 server->large_buf = next_is_large; 5018 5008 if (next_is_large) 5019 5009 server->bigbuf = buf = next_buffer; ··· 5076 5066 NULL, 0, false); 5077 5067 } 5078 5068 5079 - static int 5080 - smb2_next_header(char *buf) 5069 + static int smb2_next_header(struct TCP_Server_Info *server, char *buf, 5070 + unsigned int *noff) 5081 5071 { 5082 5072 struct smb2_hdr *hdr = (struct smb2_hdr *)buf; 5083 5073 struct smb2_transform_hdr *t_hdr = (struct smb2_transform_hdr *)buf; 5084 5074 5085 - if (hdr->ProtocolId == SMB2_TRANSFORM_PROTO_NUM) 5086 - return sizeof(struct smb2_transform_hdr) + 5087 - le32_to_cpu(t_hdr->OriginalMessageSize); 5088 - 5089 - return le32_to_cpu(hdr->NextCommand); 5075 + if (hdr->ProtocolId == SMB2_TRANSFORM_PROTO_NUM) { 5076 + *noff = le32_to_cpu(t_hdr->OriginalMessageSize); 5077 + if (unlikely(check_add_overflow(*noff, sizeof(*t_hdr), noff))) 5078 + return -EINVAL; 5079 + } else { 5080 + *noff = le32_to_cpu(hdr->NextCommand); 5081 + } 5082 + if (unlikely(*noff && *noff < MID_HEADER_SIZE(server))) 5083 + return -EINVAL; 5084 + return 0; 5090 5085 } 5091 5086 5092 5087 int cifs_sfu_make_node(unsigned int xid, struct inode *inode,
+80 -47
fs/smb/client/smb2pdu.c
··· 411 411 } 412 412 413 413 if (smb2_command != SMB2_INTERNAL_CMD) 414 - if (mod_delayed_work(cifsiod_wq, &server->reconnect, 0)) 415 - cifs_put_tcp_session(server, false); 414 + mod_delayed_work(cifsiod_wq, &server->reconnect, 0); 416 415 417 416 atomic_inc(&tconInfoReconnectCount); 418 417 out: ··· 470 471 void **request_buf, unsigned int *total_len) 471 472 { 472 473 /* BB eventually switch this to SMB2 specific small buf size */ 473 - if (smb2_command == SMB2_SET_INFO) 474 + switch (smb2_command) { 475 + case SMB2_SET_INFO: 476 + case SMB2_QUERY_INFO: 474 477 *request_buf = cifs_buf_get(); 475 - else 478 + break; 479 + default: 476 480 *request_buf = cifs_small_buf_get(); 481 + break; 482 + } 477 483 if (*request_buf == NULL) { 478 484 /* BB should we add a retry in here if not a writepage? */ 479 485 return -ENOMEM; ··· 2240 2236 posix->nlink, posix->mode, posix->reparse_tag); 2241 2237 } 2242 2238 2243 - void 2244 - smb2_parse_contexts(struct TCP_Server_Info *server, 2245 - struct smb2_create_rsp *rsp, 2246 - unsigned int *epoch, char *lease_key, __u8 *oplock, 2247 - struct smb2_file_all_info *buf, 2248 - struct create_posix_rsp *posix) 2239 + int smb2_parse_contexts(struct TCP_Server_Info *server, 2240 + struct kvec *rsp_iov, 2241 + unsigned int *epoch, 2242 + char *lease_key, __u8 *oplock, 2243 + struct smb2_file_all_info *buf, 2244 + struct create_posix_rsp *posix) 2249 2245 { 2250 - char *data_offset; 2246 + struct smb2_create_rsp *rsp = rsp_iov->iov_base; 2251 2247 struct create_context *cc; 2252 - unsigned int next; 2253 - unsigned int remaining; 2248 + size_t rem, off, len; 2249 + size_t doff, dlen; 2250 + size_t noff, nlen; 2254 2251 char *name; 2255 2252 static const char smb3_create_tag_posix[] = { 2256 2253 0x93, 0xAD, 0x25, 0x50, 0x9C, ··· 2260 2255 }; 2261 2256 2262 2257 *oplock = 0; 2263 - data_offset = (char *)rsp + le32_to_cpu(rsp->CreateContextsOffset); 2264 - remaining = le32_to_cpu(rsp->CreateContextsLength); 2265 - cc = (struct create_context *)data_offset; 2258 + 2259 + off = le32_to_cpu(rsp->CreateContextsOffset); 2260 + rem = le32_to_cpu(rsp->CreateContextsLength); 2261 + if (check_add_overflow(off, rem, &len) || len > rsp_iov->iov_len) 2262 + return -EINVAL; 2263 + cc = (struct create_context *)((u8 *)rsp + off); 2266 2264 2267 2265 /* Initialize inode number to 0 in case no valid data in qfid context */ 2268 2266 if (buf) 2269 2267 buf->IndexNumber = 0; 2270 2268 2271 - while (remaining >= sizeof(struct create_context)) { 2272 - name = le16_to_cpu(cc->NameOffset) + (char *)cc; 2273 - if (le16_to_cpu(cc->NameLength) == 4 && 2274 - strncmp(name, SMB2_CREATE_REQUEST_LEASE, 4) == 0) 2275 - *oplock = server->ops->parse_lease_buf(cc, epoch, 2276 - lease_key); 2277 - else if (buf && (le16_to_cpu(cc->NameLength) == 4) && 2278 - strncmp(name, SMB2_CREATE_QUERY_ON_DISK_ID, 4) == 0) 2279 - parse_query_id_ctxt(cc, buf); 2280 - else if ((le16_to_cpu(cc->NameLength) == 16)) { 2281 - if (posix && 2282 - memcmp(name, smb3_create_tag_posix, 16) == 0) 2283 - parse_posix_ctxt(cc, buf, posix); 2284 - } 2285 - /* else { 2286 - cifs_dbg(FYI, "Context not matched with len %d\n", 2287 - le16_to_cpu(cc->NameLength)); 2288 - cifs_dump_mem("Cctxt name: ", name, 4); 2289 - } */ 2269 + while (rem >= sizeof(*cc)) { 2270 + doff = le16_to_cpu(cc->DataOffset); 2271 + dlen = le32_to_cpu(cc->DataLength); 2272 + if (check_add_overflow(doff, dlen, &len) || len > rem) 2273 + return -EINVAL; 2290 2274 2291 - next = le32_to_cpu(cc->Next); 2292 - if (!next) 2275 + noff = le16_to_cpu(cc->NameOffset); 2276 + nlen = le16_to_cpu(cc->NameLength); 2277 + if (noff + nlen >= doff) 2278 + return -EINVAL; 2279 + 2280 + name = (char *)cc + noff; 2281 + switch (nlen) { 2282 + case 4: 2283 + if (!strncmp(name, SMB2_CREATE_REQUEST_LEASE, 4)) { 2284 + *oplock = server->ops->parse_lease_buf(cc, epoch, 2285 + lease_key); 2286 + } else if (buf && 2287 + !strncmp(name, SMB2_CREATE_QUERY_ON_DISK_ID, 4)) { 2288 + parse_query_id_ctxt(cc, buf); 2289 + } 2293 2290 break; 2294 - remaining -= next; 2295 - cc = (struct create_context *)((char *)cc + next); 2291 + case 16: 2292 + if (posix && !memcmp(name, smb3_create_tag_posix, 16)) 2293 + parse_posix_ctxt(cc, buf, posix); 2294 + break; 2295 + default: 2296 + cifs_dbg(FYI, "%s: unhandled context (nlen=%zu dlen=%zu)\n", 2297 + __func__, nlen, dlen); 2298 + if (IS_ENABLED(CONFIG_CIFS_DEBUG2)) 2299 + cifs_dump_mem("context data: ", cc, dlen); 2300 + break; 2301 + } 2302 + 2303 + off = le32_to_cpu(cc->Next); 2304 + if (!off) 2305 + break; 2306 + if (check_sub_overflow(rem, off, &rem)) 2307 + return -EINVAL; 2308 + cc = (struct create_context *)((u8 *)cc + off); 2296 2309 } 2297 2310 2298 2311 if (rsp->OplockLevel != SMB2_OPLOCK_LEVEL_LEASE) 2299 2312 *oplock = rsp->OplockLevel; 2300 2313 2301 - return; 2314 + return 0; 2302 2315 } 2303 2316 2304 2317 static int ··· 3147 3124 } 3148 3125 3149 3126 3150 - smb2_parse_contexts(server, rsp, &oparms->fid->epoch, 3151 - oparms->fid->lease_key, oplock, buf, posix); 3127 + rc = smb2_parse_contexts(server, &rsp_iov, &oparms->fid->epoch, 3128 + oparms->fid->lease_key, oplock, buf, posix); 3152 3129 creat_exit: 3153 3130 SMB2_open_free(&rqst); 3154 3131 free_rsp_buf(resp_buftype, rsp); ··· 3591 3568 struct smb2_query_info_req *req; 3592 3569 struct kvec *iov = rqst->rq_iov; 3593 3570 unsigned int total_len; 3571 + size_t len; 3594 3572 int rc; 3573 + 3574 + if (unlikely(check_add_overflow(input_len, sizeof(*req), &len) || 3575 + len > CIFSMaxBufSize)) 3576 + return -EINVAL; 3595 3577 3596 3578 rc = smb2_plain_req_init(SMB2_QUERY_INFO, tcon, server, 3597 3579 (void **) &req, &total_len); ··· 3619 3591 3620 3592 iov[0].iov_base = (char *)req; 3621 3593 /* 1 for Buffer */ 3622 - iov[0].iov_len = total_len - 1 + input_len; 3594 + iov[0].iov_len = len; 3623 3595 return 0; 3624 3596 } 3625 3597 ··· 3627 3599 SMB2_query_info_free(struct smb_rqst *rqst) 3628 3600 { 3629 3601 if (rqst && rqst->rq_iov) 3630 - cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request */ 3602 + cifs_buf_release(rqst->rq_iov[0].iov_base); /* request */ 3631 3603 } 3632 3604 3633 3605 static int ··· 5502 5474 return 0; 5503 5475 } 5504 5476 5477 + static inline void free_qfs_info_req(struct kvec *iov) 5478 + { 5479 + cifs_buf_release(iov->iov_base); 5480 + } 5481 + 5505 5482 int 5506 5483 SMB311_posix_qfs_info(const unsigned int xid, struct cifs_tcon *tcon, 5507 5484 u64 persistent_fid, u64 volatile_fid, struct kstatfs *fsdata) ··· 5538 5505 5539 5506 rc = cifs_send_recv(xid, ses, server, 5540 5507 &rqst, &resp_buftype, flags, &rsp_iov); 5541 - cifs_small_buf_release(iov.iov_base); 5508 + free_qfs_info_req(&iov); 5542 5509 if (rc) { 5543 5510 cifs_stats_fail_inc(tcon, SMB2_QUERY_INFO_HE); 5544 5511 goto posix_qfsinf_exit; ··· 5589 5556 5590 5557 rc = cifs_send_recv(xid, ses, server, 5591 5558 &rqst, &resp_buftype, flags, &rsp_iov); 5592 - cifs_small_buf_release(iov.iov_base); 5559 + free_qfs_info_req(&iov); 5593 5560 if (rc) { 5594 5561 cifs_stats_fail_inc(tcon, SMB2_QUERY_INFO_HE); 5595 5562 goto qfsinf_exit; ··· 5656 5623 5657 5624 rc = cifs_send_recv(xid, ses, server, 5658 5625 &rqst, &resp_buftype, flags, &rsp_iov); 5659 - cifs_small_buf_release(iov.iov_base); 5626 + free_qfs_info_req(&iov); 5660 5627 if (rc) { 5661 5628 cifs_stats_fail_inc(tcon, SMB2_QUERY_INFO_HE); 5662 5629 goto qfsattr_exit;
+7 -5
fs/smb/client/smb2proto.h
··· 251 251 252 252 extern enum securityEnum smb2_select_sectype(struct TCP_Server_Info *, 253 253 enum securityEnum); 254 - extern void smb2_parse_contexts(struct TCP_Server_Info *server, 255 - struct smb2_create_rsp *rsp, 256 - unsigned int *epoch, char *lease_key, 257 - __u8 *oplock, struct smb2_file_all_info *buf, 258 - struct create_posix_rsp *posix); 254 + int smb2_parse_contexts(struct TCP_Server_Info *server, 255 + struct kvec *rsp_iov, 256 + unsigned int *epoch, 257 + char *lease_key, __u8 *oplock, 258 + struct smb2_file_all_info *buf, 259 + struct create_posix_rsp *posix); 260 + 259 261 extern int smb3_encryption_required(const struct cifs_tcon *tcon); 260 262 extern int smb2_validate_iov(unsigned int offset, unsigned int buffer_length, 261 263 struct kvec *iov, unsigned int min_buf_size);
+4
fs/tracefs/event_inode.c
··· 546 546 if (strcmp(ei_child->name, name) != 0) 547 547 continue; 548 548 ret = simple_lookup(dir, dentry, flags); 549 + if (IS_ERR(ret)) 550 + goto out; 549 551 create_dir_dentry(ei, ei_child, ei_dentry, true); 550 552 created = true; 551 553 break; ··· 570 568 if (r <= 0) 571 569 continue; 572 570 ret = simple_lookup(dir, dentry, flags); 571 + if (IS_ERR(ret)) 572 + goto out; 573 573 create_file_dentry(ei, i, ei_dentry, name, mode, cdata, 574 574 fops, true); 575 575 break;
+4
include/linux/bpf_types.h
··· 142 142 #ifdef CONFIG_NET 143 143 BPF_LINK_TYPE(BPF_LINK_TYPE_NETNS, netns) 144 144 BPF_LINK_TYPE(BPF_LINK_TYPE_XDP, xdp) 145 + BPF_LINK_TYPE(BPF_LINK_TYPE_NETFILTER, netfilter) 146 + BPF_LINK_TYPE(BPF_LINK_TYPE_TCX, tcx) 147 + BPF_LINK_TYPE(BPF_LINK_TYPE_NETKIT, netkit) 145 148 #endif 146 149 #ifdef CONFIG_PERF_EVENTS 147 150 BPF_LINK_TYPE(BPF_LINK_TYPE_PERF_EVENT, perf) 148 151 #endif 149 152 BPF_LINK_TYPE(BPF_LINK_TYPE_KPROBE_MULTI, kprobe_multi) 150 153 BPF_LINK_TYPE(BPF_LINK_TYPE_STRUCT_OPS, struct_ops) 154 + BPF_LINK_TYPE(BPF_LINK_TYPE_UPROBE_MULTI, uprobe_multi)
+4 -54
include/linux/cred.h
··· 109 109 * same context as task->real_cred. 110 110 */ 111 111 struct cred { 112 - atomic_t usage; 113 - #ifdef CONFIG_DEBUG_CREDENTIALS 114 - atomic_t subscribers; /* number of processes subscribed */ 115 - void *put_addr; 116 - unsigned magic; 117 - #define CRED_MAGIC 0x43736564 118 - #define CRED_MAGIC_DEAD 0x44656144 119 - #endif 112 + atomic_long_t usage; 120 113 kuid_t uid; /* real UID of the task */ 121 114 kgid_t gid; /* real GID of the task */ 122 115 kuid_t suid; /* saved UID of the task */ ··· 165 172 extern void __init cred_init(void); 166 173 extern int set_cred_ucounts(struct cred *); 167 174 168 - /* 169 - * check for validity of credentials 170 - */ 171 - #ifdef CONFIG_DEBUG_CREDENTIALS 172 - extern void __noreturn __invalid_creds(const struct cred *, const char *, unsigned); 173 - extern void __validate_process_creds(struct task_struct *, 174 - const char *, unsigned); 175 - 176 - extern bool creds_are_invalid(const struct cred *cred); 177 - 178 - static inline void __validate_creds(const struct cred *cred, 179 - const char *file, unsigned line) 180 - { 181 - if (unlikely(creds_are_invalid(cred))) 182 - __invalid_creds(cred, file, line); 183 - } 184 - 185 - #define validate_creds(cred) \ 186 - do { \ 187 - __validate_creds((cred), __FILE__, __LINE__); \ 188 - } while(0) 189 - 190 - #define validate_process_creds() \ 191 - do { \ 192 - __validate_process_creds(current, __FILE__, __LINE__); \ 193 - } while(0) 194 - 195 - extern void validate_creds_for_do_exit(struct task_struct *); 196 - #else 197 - static inline void validate_creds(const struct cred *cred) 198 - { 199 - } 200 - static inline void validate_creds_for_do_exit(struct task_struct *tsk) 201 - { 202 - } 203 - static inline void validate_process_creds(void) 204 - { 205 - } 206 - #endif 207 - 208 175 static inline bool cap_ambient_invariant_ok(const struct cred *cred) 209 176 { 210 177 return cap_issubset(cred->cap_ambient, ··· 182 229 */ 183 230 static inline struct cred *get_new_cred_many(struct cred *cred, int nr) 184 231 { 185 - atomic_add(nr, &cred->usage); 232 + atomic_long_add(nr, &cred->usage); 186 233 return cred; 187 234 } 188 235 ··· 217 264 struct cred *nonconst_cred = (struct cred *) cred; 218 265 if (!cred) 219 266 return cred; 220 - validate_creds(cred); 221 267 nonconst_cred->non_rcu = 0; 222 268 return get_new_cred_many(nonconst_cred, nr); 223 269 } ··· 240 288 struct cred *nonconst_cred = (struct cred *) cred; 241 289 if (!cred) 242 290 return NULL; 243 - if (!atomic_inc_not_zero(&nonconst_cred->usage)) 291 + if (!atomic_long_inc_not_zero(&nonconst_cred->usage)) 244 292 return NULL; 245 - validate_creds(cred); 246 293 nonconst_cred->non_rcu = 0; 247 294 return cred; 248 295 } ··· 263 312 struct cred *cred = (struct cred *) _cred; 264 313 265 314 if (cred) { 266 - validate_creds(cred); 267 - if (atomic_sub_and_test(nr, &cred->usage)) 315 + if (atomic_long_sub_and_test(nr, &cred->usage)) 268 316 __put_cred(cred); 269 317 } 270 318 }
+2
include/linux/damon.h
··· 559 559 * update 560 560 */ 561 561 unsigned long next_ops_update_sis; 562 + /* for waiting until the execution of the kdamond_fn is started */ 563 + struct completion kdamond_started; 562 564 563 565 /* public: */ 564 566 struct task_struct *kdamond;
+2 -1
include/linux/ieee80211.h
··· 4447 4447 action != WLAN_PUB_ACTION_LOC_TRACK_NOTI && 4448 4448 action != WLAN_PUB_ACTION_FTM_REQUEST && 4449 4449 action != WLAN_PUB_ACTION_FTM_RESPONSE && 4450 - action != WLAN_PUB_ACTION_FILS_DISCOVERY; 4450 + action != WLAN_PUB_ACTION_FILS_DISCOVERY && 4451 + action != WLAN_PUB_ACTION_VENDOR_SPECIFIC; 4451 4452 } 4452 4453 4453 4454 /**
+3
include/linux/io_uring_types.h
··· 434 434 /* keep async read/write and isreg together and in order */ 435 435 REQ_F_SUPPORT_NOWAIT_BIT, 436 436 REQ_F_ISREG_BIT, 437 + REQ_F_POLL_NO_LAZY_BIT, 437 438 438 439 /* not a real bit, just to check we're not overflowing the space */ 439 440 __REQ_F_LAST_BIT, ··· 502 501 REQ_F_CLEAR_POLLIN = BIT(REQ_F_CLEAR_POLLIN_BIT), 503 502 /* hashed into ->cancel_hash_locked, protected by ->uring_lock */ 504 503 REQ_F_HASH_LOCKED = BIT(REQ_F_HASH_LOCKED_BIT), 504 + /* don't use lazy poll wake for this request */ 505 + REQ_F_POLL_NO_LAZY = BIT(REQ_F_POLL_NO_LAZY_BIT), 505 506 }; 506 507 507 508 typedef void (*io_req_tw_func_t)(struct io_kiocb *req, struct io_tw_state *ts);
+4 -4
include/linux/mm.h
··· 886 886 */ 887 887 static inline bool vma_is_initial_heap(const struct vm_area_struct *vma) 888 888 { 889 - return vma->vm_start <= vma->vm_mm->brk && 890 - vma->vm_end >= vma->vm_mm->start_brk; 889 + return vma->vm_start < vma->vm_mm->brk && 890 + vma->vm_end > vma->vm_mm->start_brk; 891 891 } 892 892 893 893 /* ··· 901 901 * its "stack". It's not even well-defined for programs written 902 902 * languages like Go. 903 903 */ 904 - return vma->vm_start <= vma->vm_mm->start_stack && 905 - vma->vm_end >= vma->vm_mm->start_stack; 904 + return vma->vm_start <= vma->vm_mm->start_stack && 905 + vma->vm_end >= vma->vm_mm->start_stack; 906 906 } 907 907 908 908 static inline bool vma_is_temporary_stack(struct vm_area_struct *vma)
+14 -9
include/linux/mm_inline.h
··· 232 232 if (folio_test_unevictable(folio) || !lrugen->enabled) 233 233 return false; 234 234 /* 235 - * There are three common cases for this page: 236 - * 1. If it's hot, e.g., freshly faulted in or previously hot and 237 - * migrated, add it to the youngest generation. 238 - * 2. If it's cold but can't be evicted immediately, i.e., an anon page 239 - * not in swapcache or a dirty page pending writeback, add it to the 240 - * second oldest generation. 241 - * 3. Everything else (clean, cold) is added to the oldest generation. 235 + * There are four common cases for this page: 236 + * 1. If it's hot, i.e., freshly faulted in, add it to the youngest 237 + * generation, and it's protected over the rest below. 238 + * 2. If it can't be evicted immediately, i.e., a dirty page pending 239 + * writeback, add it to the second youngest generation. 240 + * 3. If it should be evicted first, e.g., cold and clean from 241 + * folio_rotate_reclaimable(), add it to the oldest generation. 242 + * 4. Everything else falls between 2 & 3 above and is added to the 243 + * second oldest generation if it's considered inactive, or the 244 + * oldest generation otherwise. See lru_gen_is_active(). 242 245 */ 243 246 if (folio_test_active(folio)) 244 247 seq = lrugen->max_seq; 245 248 else if ((type == LRU_GEN_ANON && !folio_test_swapcache(folio)) || 246 249 (folio_test_reclaim(folio) && 247 250 (folio_test_dirty(folio) || folio_test_writeback(folio)))) 248 - seq = lrugen->min_seq[type] + 1; 249 - else 251 + seq = lrugen->max_seq - 1; 252 + else if (reclaiming || lrugen->min_seq[type] + MIN_NR_GENS >= lrugen->max_seq) 250 253 seq = lrugen->min_seq[type]; 254 + else 255 + seq = lrugen->min_seq[type] + 1; 251 256 252 257 gen = lru_gen_from_seq(seq); 253 258 flags = (gen + 1UL) << LRU_GEN_PGOFF;
+19 -15
include/linux/mmzone.h
··· 505 505 * the old generation, is incremented when all its bins become empty. 506 506 * 507 507 * There are four operations: 508 - * 1. MEMCG_LRU_HEAD, which moves an memcg to the head of a random bin in its 508 + * 1. MEMCG_LRU_HEAD, which moves a memcg to the head of a random bin in its 509 509 * current generation (old or young) and updates its "seg" to "head"; 510 - * 2. MEMCG_LRU_TAIL, which moves an memcg to the tail of a random bin in its 510 + * 2. MEMCG_LRU_TAIL, which moves a memcg to the tail of a random bin in its 511 511 * current generation (old or young) and updates its "seg" to "tail"; 512 - * 3. MEMCG_LRU_OLD, which moves an memcg to the head of a random bin in the old 512 + * 3. MEMCG_LRU_OLD, which moves a memcg to the head of a random bin in the old 513 513 * generation, updates its "gen" to "old" and resets its "seg" to "default"; 514 - * 4. MEMCG_LRU_YOUNG, which moves an memcg to the tail of a random bin in the 514 + * 4. MEMCG_LRU_YOUNG, which moves a memcg to the tail of a random bin in the 515 515 * young generation, updates its "gen" to "young" and resets its "seg" to 516 516 * "default". 517 517 * 518 518 * The events that trigger the above operations are: 519 519 * 1. Exceeding the soft limit, which triggers MEMCG_LRU_HEAD; 520 - * 2. The first attempt to reclaim an memcg below low, which triggers 520 + * 2. The first attempt to reclaim a memcg below low, which triggers 521 521 * MEMCG_LRU_TAIL; 522 - * 3. The first attempt to reclaim an memcg below reclaimable size threshold, 523 - * which triggers MEMCG_LRU_TAIL; 524 - * 4. The second attempt to reclaim an memcg below reclaimable size threshold, 525 - * which triggers MEMCG_LRU_YOUNG; 526 - * 5. Attempting to reclaim an memcg below min, which triggers MEMCG_LRU_YOUNG; 522 + * 3. The first attempt to reclaim a memcg offlined or below reclaimable size 523 + * threshold, which triggers MEMCG_LRU_TAIL; 524 + * 4. The second attempt to reclaim a memcg offlined or below reclaimable size 525 + * threshold, which triggers MEMCG_LRU_YOUNG; 526 + * 5. Attempting to reclaim a memcg below min, which triggers MEMCG_LRU_YOUNG; 527 527 * 6. Finishing the aging on the eviction path, which triggers MEMCG_LRU_YOUNG; 528 - * 7. Offlining an memcg, which triggers MEMCG_LRU_OLD. 528 + * 7. Offlining a memcg, which triggers MEMCG_LRU_OLD. 529 529 * 530 - * Note that memcg LRU only applies to global reclaim, and the round-robin 531 - * incrementing of their max_seq counters ensures the eventual fairness to all 532 - * eligible memcgs. For memcg reclaim, it still relies on mem_cgroup_iter(). 530 + * Notes: 531 + * 1. Memcg LRU only applies to global reclaim, and the round-robin incrementing 532 + * of their max_seq counters ensures the eventual fairness to all eligible 533 + * memcgs. For memcg reclaim, it still relies on mem_cgroup_iter(). 534 + * 2. There are only two valid generations: old (seq) and young (seq+1). 535 + * MEMCG_NR_GENS is set to three so that when reading the generation counter 536 + * locklessly, a stale value (seq-1) does not wraparound to young. 533 537 */ 534 - #define MEMCG_NR_GENS 2 538 + #define MEMCG_NR_GENS 3 535 539 #define MEMCG_NR_BINS 8 536 540 537 541 struct lru_gen_memcg {
+3
include/linux/pci.h
··· 1829 1829 int pci_disable_link_state(struct pci_dev *pdev, int state); 1830 1830 int pci_disable_link_state_locked(struct pci_dev *pdev, int state); 1831 1831 int pci_enable_link_state(struct pci_dev *pdev, int state); 1832 + int pci_enable_link_state_locked(struct pci_dev *pdev, int state); 1832 1833 void pcie_no_aspm(void); 1833 1834 bool pcie_aspm_support_enabled(void); 1834 1835 bool pcie_aspm_enabled(struct pci_dev *pdev); ··· 1839 1838 static inline int pci_disable_link_state_locked(struct pci_dev *pdev, int state) 1840 1839 { return 0; } 1841 1840 static inline int pci_enable_link_state(struct pci_dev *pdev, int state) 1841 + { return 0; } 1842 + static inline int pci_enable_link_state_locked(struct pci_dev *pdev, int state) 1842 1843 { return 0; } 1843 1844 static inline void pcie_no_aspm(void) { } 1844 1845 static inline bool pcie_aspm_support_enabled(void) { return false; }
+7 -2
include/net/bluetooth/hci_core.h
··· 189 189 struct smp_csrk { 190 190 bdaddr_t bdaddr; 191 191 u8 bdaddr_type; 192 + u8 link_type; 192 193 u8 type; 193 194 u8 val[16]; 194 195 }; ··· 199 198 struct rcu_head rcu; 200 199 bdaddr_t bdaddr; 201 200 u8 bdaddr_type; 201 + u8 link_type; 202 202 u8 authenticated; 203 203 u8 type; 204 204 u8 enc_size; ··· 214 212 bdaddr_t rpa; 215 213 bdaddr_t bdaddr; 216 214 u8 addr_type; 215 + u8 link_type; 217 216 u8 val[16]; 218 217 }; 219 218 ··· 222 219 struct list_head list; 223 220 struct rcu_head rcu; 224 221 bdaddr_t bdaddr; 222 + u8 bdaddr_type; 223 + u8 link_type; 225 224 u8 type; 226 225 u8 val[HCI_LINK_KEY_SIZE]; 227 226 u8 pin_len; ··· 1232 1227 continue; 1233 1228 1234 1229 /* Match CIG ID if set */ 1235 - if (cig != BT_ISO_QOS_CIG_UNSET && cig != c->iso_qos.ucast.cig) 1230 + if (cig != c->iso_qos.ucast.cig) 1236 1231 continue; 1237 1232 1238 1233 /* Match CIS ID if set */ 1239 - if (id != BT_ISO_QOS_CIS_UNSET && id != c->iso_qos.ucast.cis) 1234 + if (id != c->iso_qos.ucast.cis) 1240 1235 continue; 1241 1236 1242 1237 /* Match destination address if set */
+13 -51
include/net/ip6_fib.h
··· 179 179 180 180 refcount_t fib6_ref; 181 181 unsigned long expires; 182 - 183 - struct hlist_node gc_link; 184 - 185 182 struct dst_metrics *fib6_metrics; 186 183 #define fib6_pmtu fib6_metrics->metrics[RTAX_MTU-1] 187 184 ··· 247 250 return rt->fib6_src.plen > 0; 248 251 } 249 252 253 + static inline void fib6_clean_expires(struct fib6_info *f6i) 254 + { 255 + f6i->fib6_flags &= ~RTF_EXPIRES; 256 + f6i->expires = 0; 257 + } 258 + 259 + static inline void fib6_set_expires(struct fib6_info *f6i, 260 + unsigned long expires) 261 + { 262 + f6i->expires = expires; 263 + f6i->fib6_flags |= RTF_EXPIRES; 264 + } 265 + 250 266 static inline bool fib6_check_expired(const struct fib6_info *f6i) 251 267 { 252 268 if (f6i->fib6_flags & RTF_EXPIRES) 253 269 return time_after(jiffies, f6i->expires); 254 270 return false; 255 - } 256 - 257 - static inline bool fib6_has_expires(const struct fib6_info *f6i) 258 - { 259 - return f6i->fib6_flags & RTF_EXPIRES; 260 271 } 261 272 262 273 /* Function to safely get fn->fn_sernum for passed in rt ··· 388 383 struct inet_peer_base tb6_peers; 389 384 unsigned int flags; 390 385 unsigned int fib_seq; 391 - struct hlist_head tb6_gc_hlist; /* GC candidates */ 392 386 #define RT6_TABLE_HAS_DFLT_ROUTER BIT(0) 393 387 }; 394 388 ··· 503 499 void fib6_gc_cleanup(void); 504 500 505 501 int fib6_init(void); 506 - 507 - /* fib6_info must be locked by the caller, and fib6_info->fib6_table can be 508 - * NULL. 509 - */ 510 - static inline void fib6_set_expires_locked(struct fib6_info *f6i, 511 - unsigned long expires) 512 - { 513 - struct fib6_table *tb6; 514 - 515 - tb6 = f6i->fib6_table; 516 - f6i->expires = expires; 517 - if (tb6 && !fib6_has_expires(f6i)) 518 - hlist_add_head(&f6i->gc_link, &tb6->tb6_gc_hlist); 519 - f6i->fib6_flags |= RTF_EXPIRES; 520 - } 521 - 522 - /* fib6_info must be locked by the caller, and fib6_info->fib6_table can be 523 - * NULL. If fib6_table is NULL, the fib6_info will no be inserted into the 524 - * list of GC candidates until it is inserted into a table. 525 - */ 526 - static inline void fib6_set_expires(struct fib6_info *f6i, 527 - unsigned long expires) 528 - { 529 - spin_lock_bh(&f6i->fib6_table->tb6_lock); 530 - fib6_set_expires_locked(f6i, expires); 531 - spin_unlock_bh(&f6i->fib6_table->tb6_lock); 532 - } 533 - 534 - static inline void fib6_clean_expires_locked(struct fib6_info *f6i) 535 - { 536 - if (fib6_has_expires(f6i)) 537 - hlist_del_init(&f6i->gc_link); 538 - f6i->fib6_flags &= ~RTF_EXPIRES; 539 - f6i->expires = 0; 540 - } 541 - 542 - static inline void fib6_clean_expires(struct fib6_info *f6i) 543 - { 544 - spin_lock_bh(&f6i->fib6_table->tb6_lock); 545 - fib6_clean_expires_locked(f6i); 546 - spin_unlock_bh(&f6i->fib6_table->tb6_lock); 547 - } 548 502 549 503 struct ipv6_route_iter { 550 504 struct seq_net_private p;
+5
include/net/sock.h
··· 2799 2799 return sk->sk_type == SOCK_STREAM && sk->sk_protocol == IPPROTO_TCP; 2800 2800 } 2801 2801 2802 + static inline bool sk_is_stream_unix(const struct sock *sk) 2803 + { 2804 + return sk->sk_family == AF_UNIX && sk->sk_type == SOCK_STREAM; 2805 + } 2806 + 2802 2807 /** 2803 2808 * sk_eat_skb - Release a skb if it is no longer needed 2804 2809 * @sk: socket to eat this skb from
+17 -3
io_uring/poll.c
··· 366 366 367 367 static void __io_poll_execute(struct io_kiocb *req, int mask) 368 368 { 369 + unsigned flags = 0; 370 + 369 371 io_req_set_res(req, mask, 0); 370 372 req->io_task_work.func = io_poll_task_func; 371 373 372 374 trace_io_uring_task_add(req, mask); 373 - __io_req_task_work_add(req, IOU_F_TWQ_LAZY_WAKE); 375 + 376 + if (!(req->flags & REQ_F_POLL_NO_LAZY)) 377 + flags = IOU_F_TWQ_LAZY_WAKE; 378 + __io_req_task_work_add(req, flags); 374 379 } 375 380 376 381 static inline void io_poll_execute(struct io_kiocb *req, int res) ··· 531 526 poll->head = head; 532 527 poll->wait.private = (void *) wqe_private; 533 528 534 - if (poll->events & EPOLLEXCLUSIVE) 529 + if (poll->events & EPOLLEXCLUSIVE) { 530 + /* 531 + * Exclusive waits may only wake a limited amount of entries 532 + * rather than all of them, this may interfere with lazy 533 + * wake if someone does wait(events > 1). Ensure we don't do 534 + * lazy wake for those, as we need to process each one as they 535 + * come in. 536 + */ 537 + req->flags |= REQ_F_POLL_NO_LAZY; 535 538 add_wait_queue_exclusive(head, &poll->wait); 536 - else 539 + } else { 537 540 add_wait_queue(head, &poll->wait); 541 + } 538 542 } 539 543 540 544 static void io_poll_queue_proc(struct file *file, struct wait_queue_head *head,
+1 -1
io_uring/uring_cmd.c
··· 7 7 #include <linux/nospec.h> 8 8 9 9 #include <uapi/linux/io_uring.h> 10 - #include <uapi/asm-generic/ioctls.h> 10 + #include <asm/ioctls.h> 11 11 12 12 #include "io_uring.h" 13 13 #include "rsrc.h"
-1
kernel/Kconfig.kexec
··· 94 94 config CRASH_DUMP 95 95 bool "kernel crash dumps" 96 96 depends on ARCH_SUPPORTS_CRASH_DUMP 97 - depends on ARCH_SUPPORTS_KEXEC 98 97 select CRASH_CORE 99 98 select KEXEC_CORE 100 99 help
+5 -5
kernel/crash_core.c
··· 199 199 * It returns 0 on success and -EINVAL on failure. 200 200 */ 201 201 static int __init parse_crashkernel_suffix(char *cmdline, 202 - unsigned long long *crash_size, 202 + unsigned long long *crash_size, 203 203 const char *suffix) 204 204 { 205 205 char *cur = cmdline; ··· 268 268 unsigned long long *crash_base, 269 269 const char *suffix) 270 270 { 271 - char *first_colon, *first_space; 272 - char *ck_cmdline; 273 - char *name = "crashkernel="; 271 + char *first_colon, *first_space; 272 + char *ck_cmdline; 273 + char *name = "crashkernel="; 274 274 275 275 BUG_ON(!crash_size || !crash_base); 276 276 *crash_size = 0; ··· 440 440 return; 441 441 } 442 442 443 - if ((crash_base > CRASH_ADDR_LOW_MAX) && 443 + if ((crash_base >= CRASH_ADDR_LOW_MAX) && 444 444 crash_low_size && reserve_crashkernel_low(crash_low_size)) { 445 445 memblock_phys_free(crash_base, crash_size); 446 446 return;
+25 -224
kernel/cred.c
··· 43 43 */ 44 44 struct cred init_cred = { 45 45 .usage = ATOMIC_INIT(4), 46 - #ifdef CONFIG_DEBUG_CREDENTIALS 47 - .subscribers = ATOMIC_INIT(2), 48 - .magic = CRED_MAGIC, 49 - #endif 50 46 .uid = GLOBAL_ROOT_UID, 51 47 .gid = GLOBAL_ROOT_GID, 52 48 .suid = GLOBAL_ROOT_UID, ··· 62 66 .ucounts = &init_ucounts, 63 67 }; 64 68 65 - static inline void set_cred_subscribers(struct cred *cred, int n) 66 - { 67 - #ifdef CONFIG_DEBUG_CREDENTIALS 68 - atomic_set(&cred->subscribers, n); 69 - #endif 70 - } 71 - 72 - static inline int read_cred_subscribers(const struct cred *cred) 73 - { 74 - #ifdef CONFIG_DEBUG_CREDENTIALS 75 - return atomic_read(&cred->subscribers); 76 - #else 77 - return 0; 78 - #endif 79 - } 80 - 81 - static inline void alter_cred_subscribers(const struct cred *_cred, int n) 82 - { 83 - #ifdef CONFIG_DEBUG_CREDENTIALS 84 - struct cred *cred = (struct cred *) _cred; 85 - 86 - atomic_add(n, &cred->subscribers); 87 - #endif 88 - } 89 - 90 69 /* 91 70 * The RCU callback to actually dispose of a set of credentials 92 71 */ ··· 71 100 72 101 kdebug("put_cred_rcu(%p)", cred); 73 102 74 - #ifdef CONFIG_DEBUG_CREDENTIALS 75 - if (cred->magic != CRED_MAGIC_DEAD || 76 - atomic_read(&cred->usage) != 0 || 77 - read_cred_subscribers(cred) != 0) 78 - panic("CRED: put_cred_rcu() sees %p with" 79 - " mag %x, put %p, usage %d, subscr %d\n", 80 - cred, cred->magic, cred->put_addr, 81 - atomic_read(&cred->usage), 82 - read_cred_subscribers(cred)); 83 - #else 84 - if (atomic_read(&cred->usage) != 0) 85 - panic("CRED: put_cred_rcu() sees %p with usage %d\n", 86 - cred, atomic_read(&cred->usage)); 87 - #endif 103 + if (atomic_long_read(&cred->usage) != 0) 104 + panic("CRED: put_cred_rcu() sees %p with usage %ld\n", 105 + cred, atomic_long_read(&cred->usage)); 88 106 89 107 security_cred_free(cred); 90 108 key_put(cred->session_keyring); ··· 97 137 */ 98 138 void __put_cred(struct cred *cred) 99 139 { 100 - kdebug("__put_cred(%p{%d,%d})", cred, 101 - atomic_read(&cred->usage), 102 - read_cred_subscribers(cred)); 140 + kdebug("__put_cred(%p{%ld})", cred, 141 + atomic_long_read(&cred->usage)); 103 142 104 - BUG_ON(atomic_read(&cred->usage) != 0); 105 - #ifdef CONFIG_DEBUG_CREDENTIALS 106 - BUG_ON(read_cred_subscribers(cred) != 0); 107 - cred->magic = CRED_MAGIC_DEAD; 108 - cred->put_addr = __builtin_return_address(0); 109 - #endif 143 + BUG_ON(atomic_long_read(&cred->usage) != 0); 110 144 BUG_ON(cred == current->cred); 111 145 BUG_ON(cred == current->real_cred); 112 146 ··· 118 164 { 119 165 struct cred *real_cred, *cred; 120 166 121 - kdebug("exit_creds(%u,%p,%p,{%d,%d})", tsk->pid, tsk->real_cred, tsk->cred, 122 - atomic_read(&tsk->cred->usage), 123 - read_cred_subscribers(tsk->cred)); 167 + kdebug("exit_creds(%u,%p,%p,{%ld})", tsk->pid, tsk->real_cred, tsk->cred, 168 + atomic_long_read(&tsk->cred->usage)); 124 169 125 170 real_cred = (struct cred *) tsk->real_cred; 126 171 tsk->real_cred = NULL; ··· 127 174 cred = (struct cred *) tsk->cred; 128 175 tsk->cred = NULL; 129 176 130 - validate_creds(cred); 131 177 if (real_cred == cred) { 132 - alter_cred_subscribers(cred, -2); 133 178 put_cred_many(cred, 2); 134 179 } else { 135 - validate_creds(real_cred); 136 - alter_cred_subscribers(real_cred, -1); 137 180 put_cred(real_cred); 138 - alter_cred_subscribers(cred, -1); 139 181 put_cred(cred); 140 182 } 141 183 ··· 178 230 if (!new) 179 231 return NULL; 180 232 181 - atomic_set(&new->usage, 1); 182 - #ifdef CONFIG_DEBUG_CREDENTIALS 183 - new->magic = CRED_MAGIC; 184 - #endif 233 + atomic_long_set(&new->usage, 1); 185 234 if (security_cred_alloc_blank(new, GFP_KERNEL_ACCOUNT) < 0) 186 235 goto error; 187 236 ··· 209 264 const struct cred *old; 210 265 struct cred *new; 211 266 212 - validate_process_creds(); 213 - 214 267 new = kmem_cache_alloc(cred_jar, GFP_KERNEL); 215 268 if (!new) 216 269 return NULL; ··· 219 276 memcpy(new, old, sizeof(struct cred)); 220 277 221 278 new->non_rcu = 0; 222 - atomic_set(&new->usage, 1); 223 - set_cred_subscribers(new, 0); 279 + atomic_long_set(&new->usage, 1); 224 280 get_group_info(new->group_info); 225 281 get_uid(new->user); 226 282 get_user_ns(new->user_ns); ··· 242 300 if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) 243 301 goto error; 244 302 245 - validate_creds(new); 246 303 return new; 247 304 248 305 error: ··· 303 362 clone_flags & CLONE_THREAD 304 363 ) { 305 364 p->real_cred = get_cred_many(p->cred, 2); 306 - alter_cred_subscribers(p->cred, 2); 307 - kdebug("share_creds(%p{%d,%d})", 308 - p->cred, atomic_read(&p->cred->usage), 309 - read_cred_subscribers(p->cred)); 365 + kdebug("share_creds(%p{%ld})", 366 + p->cred, atomic_long_read(&p->cred->usage)); 310 367 inc_rlimit_ucounts(task_ucounts(p), UCOUNT_RLIMIT_NPROC, 1); 311 368 return 0; 312 369 } ··· 343 404 344 405 p->cred = p->real_cred = get_cred(new); 345 406 inc_rlimit_ucounts(task_ucounts(p), UCOUNT_RLIMIT_NPROC, 1); 346 - alter_cred_subscribers(new, 2); 347 - validate_creds(new); 348 407 return 0; 349 408 350 409 error_put: ··· 394 457 struct task_struct *task = current; 395 458 const struct cred *old = task->real_cred; 396 459 397 - kdebug("commit_creds(%p{%d,%d})", new, 398 - atomic_read(&new->usage), 399 - read_cred_subscribers(new)); 460 + kdebug("commit_creds(%p{%ld})", new, 461 + atomic_long_read(&new->usage)); 400 462 401 463 BUG_ON(task->cred != old); 402 - #ifdef CONFIG_DEBUG_CREDENTIALS 403 - BUG_ON(read_cred_subscribers(old) < 2); 404 - validate_creds(old); 405 - validate_creds(new); 406 - #endif 407 - BUG_ON(atomic_read(&new->usage) < 1); 464 + BUG_ON(atomic_long_read(&new->usage) < 1); 408 465 409 466 get_cred(new); /* we will require a ref for the subj creds too */ 410 467 ··· 433 502 * RLIMIT_NPROC limits on user->processes have already been checked 434 503 * in set_user(). 435 504 */ 436 - alter_cred_subscribers(new, 2); 437 505 if (new->user != old->user || new->user_ns != old->user_ns) 438 506 inc_rlimit_ucounts(new->ucounts, UCOUNT_RLIMIT_NPROC, 1); 439 507 rcu_assign_pointer(task->real_cred, new); 440 508 rcu_assign_pointer(task->cred, new); 441 509 if (new->user != old->user || new->user_ns != old->user_ns) 442 510 dec_rlimit_ucounts(old->ucounts, UCOUNT_RLIMIT_NPROC, 1); 443 - alter_cred_subscribers(old, -2); 444 511 445 512 /* send notifications */ 446 513 if (!uid_eq(new->uid, old->uid) || ··· 468 539 */ 469 540 void abort_creds(struct cred *new) 470 541 { 471 - kdebug("abort_creds(%p{%d,%d})", new, 472 - atomic_read(&new->usage), 473 - read_cred_subscribers(new)); 542 + kdebug("abort_creds(%p{%ld})", new, 543 + atomic_long_read(&new->usage)); 474 544 475 - #ifdef CONFIG_DEBUG_CREDENTIALS 476 - BUG_ON(read_cred_subscribers(new) != 0); 477 - #endif 478 - BUG_ON(atomic_read(&new->usage) < 1); 545 + BUG_ON(atomic_long_read(&new->usage) < 1); 479 546 put_cred(new); 480 547 } 481 548 EXPORT_SYMBOL(abort_creds); ··· 487 562 { 488 563 const struct cred *old = current->cred; 489 564 490 - kdebug("override_creds(%p{%d,%d})", new, 491 - atomic_read(&new->usage), 492 - read_cred_subscribers(new)); 493 - 494 - validate_creds(old); 495 - validate_creds(new); 565 + kdebug("override_creds(%p{%ld})", new, 566 + atomic_long_read(&new->usage)); 496 567 497 568 /* 498 569 * NOTE! This uses 'get_new_cred()' rather than 'get_cred()'. ··· 497 576 * we are only installing the cred into the thread-synchronous 498 577 * '->cred' pointer, not the '->real_cred' pointer that is 499 578 * visible to other threads under RCU. 500 - * 501 - * Also note that we did validate_creds() manually, not depending 502 - * on the validation in 'get_cred()'. 503 579 */ 504 580 get_new_cred((struct cred *)new); 505 - alter_cred_subscribers(new, 1); 506 581 rcu_assign_pointer(current->cred, new); 507 - alter_cred_subscribers(old, -1); 508 582 509 - kdebug("override_creds() = %p{%d,%d}", old, 510 - atomic_read(&old->usage), 511 - read_cred_subscribers(old)); 583 + kdebug("override_creds() = %p{%ld}", old, 584 + atomic_long_read(&old->usage)); 512 585 return old; 513 586 } 514 587 EXPORT_SYMBOL(override_creds); ··· 518 603 { 519 604 const struct cred *override = current->cred; 520 605 521 - kdebug("revert_creds(%p{%d,%d})", old, 522 - atomic_read(&old->usage), 523 - read_cred_subscribers(old)); 606 + kdebug("revert_creds(%p{%ld})", old, 607 + atomic_long_read(&old->usage)); 524 608 525 - validate_creds(old); 526 - validate_creds(override); 527 - alter_cred_subscribers(old, 1); 528 609 rcu_assign_pointer(current->cred, old); 529 - alter_cred_subscribers(override, -1); 530 610 put_cred(override); 531 611 } 532 612 EXPORT_SYMBOL(revert_creds); ··· 641 731 kdebug("prepare_kernel_cred() alloc %p", new); 642 732 643 733 old = get_task_cred(daemon); 644 - validate_creds(old); 645 734 646 735 *new = *old; 647 736 new->non_rcu = 0; 648 - atomic_set(&new->usage, 1); 649 - set_cred_subscribers(new, 0); 737 + atomic_long_set(&new->usage, 1); 650 738 get_uid(new->user); 651 739 get_user_ns(new->user_ns); 652 740 get_group_info(new->group_info); ··· 668 760 goto error; 669 761 670 762 put_cred(old); 671 - validate_creds(new); 672 763 return new; 673 764 674 765 error: ··· 732 825 return security_kernel_create_files_as(new, inode); 733 826 } 734 827 EXPORT_SYMBOL(set_create_files_as); 735 - 736 - #ifdef CONFIG_DEBUG_CREDENTIALS 737 - 738 - bool creds_are_invalid(const struct cred *cred) 739 - { 740 - if (cred->magic != CRED_MAGIC) 741 - return true; 742 - return false; 743 - } 744 - EXPORT_SYMBOL(creds_are_invalid); 745 - 746 - /* 747 - * dump invalid credentials 748 - */ 749 - static void dump_invalid_creds(const struct cred *cred, const char *label, 750 - const struct task_struct *tsk) 751 - { 752 - pr_err("%s credentials: %p %s%s%s\n", 753 - label, cred, 754 - cred == &init_cred ? "[init]" : "", 755 - cred == tsk->real_cred ? "[real]" : "", 756 - cred == tsk->cred ? "[eff]" : ""); 757 - pr_err("->magic=%x, put_addr=%p\n", 758 - cred->magic, cred->put_addr); 759 - pr_err("->usage=%d, subscr=%d\n", 760 - atomic_read(&cred->usage), 761 - read_cred_subscribers(cred)); 762 - pr_err("->*uid = { %d,%d,%d,%d }\n", 763 - from_kuid_munged(&init_user_ns, cred->uid), 764 - from_kuid_munged(&init_user_ns, cred->euid), 765 - from_kuid_munged(&init_user_ns, cred->suid), 766 - from_kuid_munged(&init_user_ns, cred->fsuid)); 767 - pr_err("->*gid = { %d,%d,%d,%d }\n", 768 - from_kgid_munged(&init_user_ns, cred->gid), 769 - from_kgid_munged(&init_user_ns, cred->egid), 770 - from_kgid_munged(&init_user_ns, cred->sgid), 771 - from_kgid_munged(&init_user_ns, cred->fsgid)); 772 - #ifdef CONFIG_SECURITY 773 - pr_err("->security is %p\n", cred->security); 774 - if ((unsigned long) cred->security >= PAGE_SIZE && 775 - (((unsigned long) cred->security & 0xffffff00) != 776 - (POISON_FREE << 24 | POISON_FREE << 16 | POISON_FREE << 8))) 777 - pr_err("->security {%x, %x}\n", 778 - ((u32*)cred->security)[0], 779 - ((u32*)cred->security)[1]); 780 - #endif 781 - } 782 - 783 - /* 784 - * report use of invalid credentials 785 - */ 786 - void __noreturn __invalid_creds(const struct cred *cred, const char *file, unsigned line) 787 - { 788 - pr_err("Invalid credentials\n"); 789 - pr_err("At %s:%u\n", file, line); 790 - dump_invalid_creds(cred, "Specified", current); 791 - BUG(); 792 - } 793 - EXPORT_SYMBOL(__invalid_creds); 794 - 795 - /* 796 - * check the credentials on a process 797 - */ 798 - void __validate_process_creds(struct task_struct *tsk, 799 - const char *file, unsigned line) 800 - { 801 - if (tsk->cred == tsk->real_cred) { 802 - if (unlikely(read_cred_subscribers(tsk->cred) < 2 || 803 - creds_are_invalid(tsk->cred))) 804 - goto invalid_creds; 805 - } else { 806 - if (unlikely(read_cred_subscribers(tsk->real_cred) < 1 || 807 - read_cred_subscribers(tsk->cred) < 1 || 808 - creds_are_invalid(tsk->real_cred) || 809 - creds_are_invalid(tsk->cred))) 810 - goto invalid_creds; 811 - } 812 - return; 813 - 814 - invalid_creds: 815 - pr_err("Invalid process credentials\n"); 816 - pr_err("At %s:%u\n", file, line); 817 - 818 - dump_invalid_creds(tsk->real_cred, "Real", tsk); 819 - if (tsk->cred != tsk->real_cred) 820 - dump_invalid_creds(tsk->cred, "Effective", tsk); 821 - else 822 - pr_err("Effective creds == Real creds\n"); 823 - BUG(); 824 - } 825 - EXPORT_SYMBOL(__validate_process_creds); 826 - 827 - /* 828 - * check creds for do_exit() 829 - */ 830 - void validate_creds_for_do_exit(struct task_struct *tsk) 831 - { 832 - kdebug("validate_creds_for_do_exit(%p,%p{%d,%d})", 833 - tsk->real_cred, tsk->cred, 834 - atomic_read(&tsk->cred->usage), 835 - read_cred_subscribers(tsk->cred)); 836 - 837 - __validate_process_creds(tsk, __FILE__, __LINE__); 838 - } 839 - 840 - #endif /* CONFIG_DEBUG_CREDENTIALS */
+10
kernel/events/core.c
··· 1947 1947 group_leader->nr_siblings + 1) > 16*1024) 1948 1948 return false; 1949 1949 1950 + /* 1951 + * When creating a new group leader, group_leader->ctx is initialized 1952 + * after the size has been validated, but we cannot safely use 1953 + * for_each_sibling_event() until group_leader->ctx is set. A new group 1954 + * leader cannot have any siblings yet, so we can safely skip checking 1955 + * the non-existent siblings. 1956 + */ 1957 + if (event == group_leader) 1958 + return true; 1959 + 1950 1960 for_each_sibling_event(sibling, group_leader) { 1951 1961 if (__perf_event_read_size(sibling->attr.read_format, 1952 1962 group_leader->nr_siblings + 1) > 16*1024)
-3
kernel/exit.c
··· 824 824 ptrace_event(PTRACE_EVENT_EXIT, code); 825 825 user_events_exit(tsk); 826 826 827 - validate_creds_for_do_exit(tsk); 828 - 829 827 io_uring_files_cancel(); 830 828 exit_signals(tsk); /* sets PF_EXITING */ 831 829 ··· 907 909 if (tsk->task_frag.page) 908 910 put_page(tsk->task_frag.page); 909 911 910 - validate_creds_for_do_exit(tsk); 911 912 exit_task_stack_account(tsk); 912 913 913 914 check_stack_usage();
+2 -2
kernel/resource.c
··· 1844 1844 1845 1845 write_lock(&resource_lock); 1846 1846 for (addr = gfr_start(base, size, align, flags); 1847 - gfr_continue(base, addr, size, flags); 1848 - addr = gfr_next(addr, size, flags)) { 1847 + gfr_continue(base, addr, align, flags); 1848 + addr = gfr_next(addr, align, flags)) { 1849 1849 if (__region_intersects(base, addr, size, 0, IORES_DESC_NONE) != 1850 1850 REGION_DISJOINT) 1851 1851 continue;
+14
kernel/sys_ni.c
··· 201 201 COND_SYSCALL_COMPAT(recvmmsg_time32); 202 202 COND_SYSCALL_COMPAT(recvmmsg_time64); 203 203 204 + /* Posix timer syscalls may be configured out */ 205 + COND_SYSCALL(timer_create); 206 + COND_SYSCALL(timer_gettime); 207 + COND_SYSCALL(timer_getoverrun); 208 + COND_SYSCALL(timer_settime); 209 + COND_SYSCALL(timer_delete); 210 + COND_SYSCALL(clock_adjtime); 211 + COND_SYSCALL(getitimer); 212 + COND_SYSCALL(setitimer); 213 + COND_SYSCALL(alarm); 214 + COND_SYSCALL_COMPAT(timer_create); 215 + COND_SYSCALL_COMPAT(getitimer); 216 + COND_SYSCALL_COMPAT(setitimer); 217 + 204 218 /* 205 219 * Architecture specific syscalls: see further below 206 220 */
-45
kernel/time/posix-stubs.c
··· 17 17 #include <linux/time_namespace.h> 18 18 #include <linux/compat.h> 19 19 20 - #ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER 21 - /* Architectures may override SYS_NI and COMPAT_SYS_NI */ 22 - #include <asm/syscall_wrapper.h> 23 - #endif 24 - 25 - asmlinkage long sys_ni_posix_timers(void) 26 - { 27 - pr_err_once("process %d (%s) attempted a POSIX timer syscall " 28 - "while CONFIG_POSIX_TIMERS is not set\n", 29 - current->pid, current->comm); 30 - return -ENOSYS; 31 - } 32 - 33 - #ifndef SYS_NI 34 - #define SYS_NI(name) SYSCALL_ALIAS(sys_##name, sys_ni_posix_timers) 35 - #endif 36 - 37 - #ifndef COMPAT_SYS_NI 38 - #define COMPAT_SYS_NI(name) SYSCALL_ALIAS(compat_sys_##name, sys_ni_posix_timers) 39 - #endif 40 - 41 - SYS_NI(timer_create); 42 - SYS_NI(timer_gettime); 43 - SYS_NI(timer_getoverrun); 44 - SYS_NI(timer_settime); 45 - SYS_NI(timer_delete); 46 - SYS_NI(clock_adjtime); 47 - SYS_NI(getitimer); 48 - SYS_NI(setitimer); 49 - SYS_NI(clock_adjtime32); 50 - #ifdef __ARCH_WANT_SYS_ALARM 51 - SYS_NI(alarm); 52 - #endif 53 - 54 20 /* 55 21 * We preserve minimal support for CLOCK_REALTIME and CLOCK_MONOTONIC 56 22 * as it is easy to remain compatible with little code. CLOCK_BOOTTIME ··· 124 158 which_clock); 125 159 } 126 160 127 - #ifdef CONFIG_COMPAT 128 - COMPAT_SYS_NI(timer_create); 129 - #endif 130 - 131 - #if defined(CONFIG_COMPAT) || defined(CONFIG_ALPHA) 132 - COMPAT_SYS_NI(getitimer); 133 - COMPAT_SYS_NI(setitimer); 134 - #endif 135 - 136 161 #ifdef CONFIG_COMPAT_32BIT_TIME 137 - SYS_NI(timer_settime32); 138 - SYS_NI(timer_gettime32); 139 162 140 163 SYSCALL_DEFINE2(clock_settime32, const clockid_t, which_clock, 141 164 struct old_timespec32 __user *, tp)
+61 -123
kernel/trace/ring_buffer.c
··· 644 644 645 645 *cnt = rb_time_cnt(top); 646 646 647 - /* If top and msb counts don't match, this interrupted a write */ 648 - if (*cnt != rb_time_cnt(msb)) 647 + /* If top, msb or bottom counts don't match, this interrupted a write */ 648 + if (*cnt != rb_time_cnt(msb) || *cnt != rb_time_cnt(bottom)) 649 649 return false; 650 650 651 651 /* The shift to msb will lose its cnt bits */ ··· 700 700 return local_try_cmpxchg(l, &expect, set); 701 701 } 702 702 703 - static bool rb_time_cmpxchg(rb_time_t *t, u64 expect, u64 set) 704 - { 705 - unsigned long cnt, top, bottom, msb; 706 - unsigned long cnt2, top2, bottom2, msb2; 707 - u64 val; 708 - 709 - /* The cmpxchg always fails if it interrupted an update */ 710 - if (!__rb_time_read(t, &val, &cnt2)) 711 - return false; 712 - 713 - if (val != expect) 714 - return false; 715 - 716 - cnt = local_read(&t->cnt); 717 - if ((cnt & 3) != cnt2) 718 - return false; 719 - 720 - cnt2 = cnt + 1; 721 - 722 - rb_time_split(val, &top, &bottom, &msb); 723 - top = rb_time_val_cnt(top, cnt); 724 - bottom = rb_time_val_cnt(bottom, cnt); 725 - 726 - rb_time_split(set, &top2, &bottom2, &msb2); 727 - top2 = rb_time_val_cnt(top2, cnt2); 728 - bottom2 = rb_time_val_cnt(bottom2, cnt2); 729 - 730 - if (!rb_time_read_cmpxchg(&t->cnt, cnt, cnt2)) 731 - return false; 732 - if (!rb_time_read_cmpxchg(&t->msb, msb, msb2)) 733 - return false; 734 - if (!rb_time_read_cmpxchg(&t->top, top, top2)) 735 - return false; 736 - if (!rb_time_read_cmpxchg(&t->bottom, bottom, bottom2)) 737 - return false; 738 - return true; 739 - } 740 - 741 703 #else /* 64 bits */ 742 704 743 705 /* local64_t always succeeds */ ··· 712 750 static void rb_time_set(rb_time_t *t, u64 val) 713 751 { 714 752 local64_set(&t->time, val); 715 - } 716 - 717 - static bool rb_time_cmpxchg(rb_time_t *t, u64 expect, u64 set) 718 - { 719 - return local64_try_cmpxchg(&t->time, &expect, set); 720 753 } 721 754 #endif 722 755 ··· 1744 1787 free_buffer_page(bpage); 1745 1788 } 1746 1789 1790 + free_page((unsigned long)cpu_buffer->free_page); 1791 + 1747 1792 kfree(cpu_buffer); 1748 1793 } 1749 1794 ··· 2366 2407 */ 2367 2408 barrier(); 2368 2409 2369 - if ((iter->head + length) > commit || length > BUF_MAX_DATA_SIZE) 2410 + if ((iter->head + length) > commit || length > BUF_PAGE_SIZE) 2370 2411 /* Writer corrupted the read? */ 2371 2412 goto reset; 2372 2413 ··· 2940 2981 return length; 2941 2982 } 2942 2983 2943 - static u64 rb_time_delta(struct ring_buffer_event *event) 2944 - { 2945 - switch (event->type_len) { 2946 - case RINGBUF_TYPE_PADDING: 2947 - return 0; 2948 - 2949 - case RINGBUF_TYPE_TIME_EXTEND: 2950 - return rb_event_time_stamp(event); 2951 - 2952 - case RINGBUF_TYPE_TIME_STAMP: 2953 - return 0; 2954 - 2955 - case RINGBUF_TYPE_DATA: 2956 - return event->time_delta; 2957 - default: 2958 - return 0; 2959 - } 2960 - } 2961 - 2962 2984 static inline bool 2963 2985 rb_try_to_discard(struct ring_buffer_per_cpu *cpu_buffer, 2964 2986 struct ring_buffer_event *event) ··· 2947 3007 unsigned long new_index, old_index; 2948 3008 struct buffer_page *bpage; 2949 3009 unsigned long addr; 2950 - u64 write_stamp; 2951 - u64 delta; 2952 3010 2953 3011 new_index = rb_event_index(event); 2954 3012 old_index = new_index + rb_event_ts_length(event); ··· 2955 3017 2956 3018 bpage = READ_ONCE(cpu_buffer->tail_page); 2957 3019 2958 - delta = rb_time_delta(event); 2959 - 2960 - if (!rb_time_read(&cpu_buffer->write_stamp, &write_stamp)) 2961 - return false; 2962 - 2963 - /* Make sure the write stamp is read before testing the location */ 2964 - barrier(); 2965 - 3020 + /* 3021 + * Make sure the tail_page is still the same and 3022 + * the next write location is the end of this event 3023 + */ 2966 3024 if (bpage->page == (void *)addr && rb_page_write(bpage) == old_index) { 2967 3025 unsigned long write_mask = 2968 3026 local_read(&bpage->write) & ~RB_WRITE_MASK; ··· 2969 3035 * to make sure that the next event adds an absolute 2970 3036 * value and does not rely on the saved write stamp, which 2971 3037 * is now going to be bogus. 3038 + * 3039 + * By setting the before_stamp to zero, the next event 3040 + * is not going to use the write_stamp and will instead 3041 + * create an absolute timestamp. This means there's no 3042 + * reason to update the wirte_stamp! 2972 3043 */ 2973 3044 rb_time_set(&cpu_buffer->before_stamp, 0); 2974 - 2975 - /* Something came in, can't discard */ 2976 - if (!rb_time_cmpxchg(&cpu_buffer->write_stamp, 2977 - write_stamp, write_stamp - delta)) 2978 - return false; 2979 3045 2980 3046 /* 2981 3047 * If an event were to come in now, it would see that the 2982 3048 * write_stamp and the before_stamp are different, and assume 2983 3049 * that this event just added itself before updating 2984 3050 * the write stamp. The interrupting event will fix the 2985 - * write stamp for us, and use the before stamp as its delta. 3051 + * write stamp for us, and use an absolute timestamp. 2986 3052 */ 2987 3053 2988 3054 /* ··· 3419 3485 return; 3420 3486 3421 3487 /* 3422 - * If this interrupted another event, 3488 + * If this interrupted another event, 3423 3489 */ 3424 3490 if (atomic_inc_return(this_cpu_ptr(&checking)) != 1) 3425 3491 goto out; ··· 3513 3579 * absolute timestamp. 3514 3580 * Don't bother if this is the start of a new page (w == 0). 3515 3581 */ 3516 - if (unlikely(!a_ok || !b_ok || (info->before != info->after && w))) { 3582 + if (!w) { 3583 + /* Use the sub-buffer timestamp */ 3584 + info->delta = 0; 3585 + } else if (unlikely(!a_ok || !b_ok || info->before != info->after)) { 3517 3586 info->add_timestamp |= RB_ADD_STAMP_FORCE | RB_ADD_STAMP_EXTEND; 3518 3587 info->length += RB_LEN_TIME_EXTEND; 3519 3588 } else { ··· 3539 3602 3540 3603 /* See if we shot pass the end of this buffer page */ 3541 3604 if (unlikely(write > BUF_PAGE_SIZE)) { 3542 - /* before and after may now different, fix it up*/ 3543 - b_ok = rb_time_read(&cpu_buffer->before_stamp, &info->before); 3544 - a_ok = rb_time_read(&cpu_buffer->write_stamp, &info->after); 3545 - if (a_ok && b_ok && info->before != info->after) 3546 - (void)rb_time_cmpxchg(&cpu_buffer->before_stamp, 3547 - info->before, info->after); 3548 - if (a_ok && b_ok) 3549 - check_buffer(cpu_buffer, info, CHECK_FULL_PAGE); 3605 + check_buffer(cpu_buffer, info, CHECK_FULL_PAGE); 3550 3606 return rb_move_tail(cpu_buffer, tail, info); 3551 3607 } 3552 3608 3553 3609 if (likely(tail == w)) { 3554 - u64 save_before; 3555 - bool s_ok; 3556 - 3557 3610 /* Nothing interrupted us between A and C */ 3558 3611 /*D*/ rb_time_set(&cpu_buffer->write_stamp, info->ts); 3559 - barrier(); 3560 - /*E*/ s_ok = rb_time_read(&cpu_buffer->before_stamp, &save_before); 3561 - RB_WARN_ON(cpu_buffer, !s_ok); 3612 + /* 3613 + * If something came in between C and D, the write stamp 3614 + * may now not be in sync. But that's fine as the before_stamp 3615 + * will be different and then next event will just be forced 3616 + * to use an absolute timestamp. 3617 + */ 3562 3618 if (likely(!(info->add_timestamp & 3563 3619 (RB_ADD_STAMP_FORCE | RB_ADD_STAMP_ABSOLUTE)))) 3564 3620 /* This did not interrupt any time update */ ··· 3559 3629 else 3560 3630 /* Just use full timestamp for interrupting event */ 3561 3631 info->delta = info->ts; 3562 - barrier(); 3563 3632 check_buffer(cpu_buffer, info, tail); 3564 - if (unlikely(info->ts != save_before)) { 3565 - /* SLOW PATH - Interrupted between C and E */ 3566 - 3567 - a_ok = rb_time_read(&cpu_buffer->write_stamp, &info->after); 3568 - RB_WARN_ON(cpu_buffer, !a_ok); 3569 - 3570 - /* Write stamp must only go forward */ 3571 - if (save_before > info->after) { 3572 - /* 3573 - * We do not care about the result, only that 3574 - * it gets updated atomically. 3575 - */ 3576 - (void)rb_time_cmpxchg(&cpu_buffer->write_stamp, 3577 - info->after, save_before); 3578 - } 3579 - } 3580 3633 } else { 3581 3634 u64 ts; 3582 3635 /* SLOW PATH - Interrupted between A and C */ 3583 - a_ok = rb_time_read(&cpu_buffer->write_stamp, &info->after); 3636 + 3637 + /* Save the old before_stamp */ 3638 + a_ok = rb_time_read(&cpu_buffer->before_stamp, &info->before); 3639 + RB_WARN_ON(cpu_buffer, !a_ok); 3640 + 3641 + /* 3642 + * Read a new timestamp and update the before_stamp to make 3643 + * the next event after this one force using an absolute 3644 + * timestamp. This is in case an interrupt were to come in 3645 + * between E and F. 3646 + */ 3647 + ts = rb_time_stamp(cpu_buffer->buffer); 3648 + rb_time_set(&cpu_buffer->before_stamp, ts); 3649 + 3650 + barrier(); 3651 + /*E*/ a_ok = rb_time_read(&cpu_buffer->write_stamp, &info->after); 3584 3652 /* Was interrupted before here, write_stamp must be valid */ 3585 3653 RB_WARN_ON(cpu_buffer, !a_ok); 3586 - ts = rb_time_stamp(cpu_buffer->buffer); 3587 3654 barrier(); 3588 - /*E*/ if (write == (local_read(&tail_page->write) & RB_WRITE_MASK) && 3589 - info->after < ts && 3590 - rb_time_cmpxchg(&cpu_buffer->write_stamp, 3591 - info->after, ts)) { 3592 - /* Nothing came after this event between C and E */ 3655 + /*F*/ if (write == (local_read(&tail_page->write) & RB_WRITE_MASK) && 3656 + info->after == info->before && info->after < ts) { 3657 + /* 3658 + * Nothing came after this event between C and F, it is 3659 + * safe to use info->after for the delta as it 3660 + * matched info->before and is still valid. 3661 + */ 3593 3662 info->delta = ts - info->after; 3594 3663 } else { 3595 3664 /* 3596 - * Interrupted between C and E: 3665 + * Interrupted between C and F: 3597 3666 * Lost the previous events time stamp. Just set the 3598 3667 * delta to zero, and this will be the same time as 3599 3668 * the event this event interrupted. And the events that ··· 3643 3714 int nr_loops = 0; 3644 3715 int add_ts_default; 3645 3716 3717 + /* ring buffer does cmpxchg, make sure it is safe in NMI context */ 3718 + if (!IS_ENABLED(CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG) && 3719 + (unlikely(in_nmi()))) { 3720 + return NULL; 3721 + } 3722 + 3646 3723 rb_start_commit(cpu_buffer); 3647 3724 /* The commit page can not change after this */ 3648 3725 ··· 3672 3737 if (ring_buffer_time_stamp_abs(cpu_buffer->buffer)) { 3673 3738 add_ts_default = RB_ADD_STAMP_ABSOLUTE; 3674 3739 info.length += RB_LEN_TIME_EXTEND; 3740 + if (info.length > BUF_MAX_DATA_SIZE) 3741 + goto out_fail; 3675 3742 } else { 3676 3743 add_ts_default = RB_ADD_STAMP_NONE; 3677 3744 } ··· 5055 5118 if (!iter) 5056 5119 return NULL; 5057 5120 5058 - iter->event = kmalloc(BUF_MAX_DATA_SIZE, flags); 5121 + /* Holds the entire event: data and meta data */ 5122 + iter->event = kmalloc(BUF_PAGE_SIZE, flags); 5059 5123 if (!iter->event) { 5060 5124 kfree(iter); 5061 5125 return NULL;
+13 -3
kernel/trace/trace.c
··· 4722 4722 iter->leftover = ret; 4723 4723 4724 4724 } else { 4725 - print_trace_line(iter); 4725 + ret = print_trace_line(iter); 4726 + if (ret == TRACE_TYPE_PARTIAL_LINE) { 4727 + iter->seq.full = 0; 4728 + trace_seq_puts(&iter->seq, "[LINE TOO BIG]\n"); 4729 + } 4726 4730 ret = trace_print_seq(m, &iter->seq); 4727 4731 /* 4728 4732 * If we overflow the seq_file buffer, then it will ··· 4966 4962 event_file_put(file); 4967 4963 4968 4964 return 0; 4965 + } 4966 + 4967 + int tracing_single_release_file_tr(struct inode *inode, struct file *filp) 4968 + { 4969 + tracing_release_file_tr(inode, filp); 4970 + return single_release(inode, filp); 4969 4971 } 4970 4972 4971 4973 static int tracing_mark_open(struct inode *inode, struct file *filp) ··· 6354 6344 if (!tr->array_buffer.buffer) 6355 6345 return 0; 6356 6346 6357 - /* Do not allow tracing while resizng ring buffer */ 6347 + /* Do not allow tracing while resizing ring buffer */ 6358 6348 tracing_stop_tr(tr); 6359 6349 6360 6350 ret = ring_buffer_resize(tr->array_buffer.buffer, size, cpu); ··· 6362 6352 goto out_start; 6363 6353 6364 6354 #ifdef CONFIG_TRACER_MAX_TRACE 6365 - if (!tr->current_trace->use_max_tr) 6355 + if (!tr->allocated_snapshot) 6366 6356 goto out; 6367 6357 6368 6358 ret = ring_buffer_resize(tr->max_buffer.buffer, size, cpu);
+1
kernel/trace/trace.h
··· 617 617 int tracing_open_generic_tr(struct inode *inode, struct file *filp); 618 618 int tracing_open_file_tr(struct inode *inode, struct file *filp); 619 619 int tracing_release_file_tr(struct inode *inode, struct file *filp); 620 + int tracing_single_release_file_tr(struct inode *inode, struct file *filp); 620 621 bool tracing_is_disabled(void); 621 622 bool tracer_tracing_is_on(struct trace_array *tr); 622 623 void tracer_tracing_on(struct trace_array *tr);
+8 -4
kernel/trace/trace_events_hist.c
··· 5623 5623 { 5624 5624 int ret; 5625 5625 5626 - ret = security_locked_down(LOCKDOWN_TRACEFS); 5626 + ret = tracing_open_file_tr(inode, file); 5627 5627 if (ret) 5628 5628 return ret; 5629 5629 5630 + /* Clear private_data to avoid warning in single_open() */ 5631 + file->private_data = NULL; 5630 5632 return single_open(file, hist_show, file); 5631 5633 } 5632 5634 ··· 5636 5634 .open = event_hist_open, 5637 5635 .read = seq_read, 5638 5636 .llseek = seq_lseek, 5639 - .release = single_release, 5637 + .release = tracing_single_release_file_tr, 5640 5638 }; 5641 5639 5642 5640 #ifdef CONFIG_HIST_TRIGGERS_DEBUG ··· 5902 5900 { 5903 5901 int ret; 5904 5902 5905 - ret = security_locked_down(LOCKDOWN_TRACEFS); 5903 + ret = tracing_open_file_tr(inode, file); 5906 5904 if (ret) 5907 5905 return ret; 5908 5906 5907 + /* Clear private_data to avoid warning in single_open() */ 5908 + file->private_data = NULL; 5909 5909 return single_open(file, hist_debug_show, file); 5910 5910 } 5911 5911 ··· 5915 5911 .open = event_hist_debug_open, 5916 5912 .read = seq_read, 5917 5913 .llseek = seq_lseek, 5918 - .release = single_release, 5914 + .release = tracing_single_release_file_tr, 5919 5915 }; 5920 5916 #endif 5921 5917
+4 -2
kernel/trace/trace_output.c
··· 1587 1587 { 1588 1588 struct print_entry *field; 1589 1589 struct trace_seq *s = &iter->seq; 1590 + int max = iter->ent_size - offsetof(struct print_entry, buf); 1590 1591 1591 1592 trace_assign_type(field, iter->ent); 1592 1593 1593 1594 seq_print_ip_sym(s, field->ip, flags); 1594 - trace_seq_printf(s, ": %s", field->buf); 1595 + trace_seq_printf(s, ": %.*s", max, field->buf); 1595 1596 1596 1597 return trace_handle_return(s); 1597 1598 } ··· 1601 1600 struct trace_event *event) 1602 1601 { 1603 1602 struct print_entry *field; 1603 + int max = iter->ent_size - offsetof(struct print_entry, buf); 1604 1604 1605 1605 trace_assign_type(field, iter->ent); 1606 1606 1607 - trace_seq_printf(&iter->seq, "# %lx %s", field->ip, field->buf); 1607 + trace_seq_printf(&iter->seq, "# %lx %.*s", field->ip, max, field->buf); 1608 1608 1609 1609 return trace_handle_return(&iter->seq); 1610 1610 }
-15
lib/Kconfig.debug
··· 1739 1739 1740 1740 endmenu 1741 1741 1742 - config DEBUG_CREDENTIALS 1743 - bool "Debug credential management" 1744 - depends on DEBUG_KERNEL 1745 - help 1746 - Enable this to turn on some debug checking for credential 1747 - management. The additional code keeps track of the number of 1748 - pointers from task_structs to any given cred struct, and checks to 1749 - see that this number never exceeds the usage count of the cred 1750 - struct. 1751 - 1752 - Furthermore, if SELinux is enabled, this also checks that the 1753 - security pointer in the cred struct is never seen to be invalid. 1754 - 1755 - If unsure, say N. 1756 - 1757 1742 source "kernel/rcu/Kconfig.debug" 1758 1743 1759 1744 config DEBUG_WQ_FORCE_RR_CPU
+6
mm/damon/core.c
··· 445 445 if (!ctx) 446 446 return NULL; 447 447 448 + init_completion(&ctx->kdamond_started); 449 + 448 450 ctx->attrs.sample_interval = 5 * 1000; 449 451 ctx->attrs.aggr_interval = 100 * 1000; 450 452 ctx->attrs.ops_update_interval = 60 * 1000 * 1000; ··· 670 668 mutex_lock(&ctx->kdamond_lock); 671 669 if (!ctx->kdamond) { 672 670 err = 0; 671 + reinit_completion(&ctx->kdamond_started); 673 672 ctx->kdamond = kthread_run(kdamond_fn, ctx, "kdamond.%d", 674 673 nr_running_ctxs); 675 674 if (IS_ERR(ctx->kdamond)) { 676 675 err = PTR_ERR(ctx->kdamond); 677 676 ctx->kdamond = NULL; 677 + } else { 678 + wait_for_completion(&ctx->kdamond_started); 678 679 } 679 680 } 680 681 mutex_unlock(&ctx->kdamond_lock); ··· 1438 1433 1439 1434 pr_debug("kdamond (%d) starts\n", current->pid); 1440 1435 1436 + complete(&ctx->kdamond_started); 1441 1437 kdamond_init_intervals_sis(ctx); 1442 1438 1443 1439 if (ctx->ops.init)
+18 -1
mm/shmem.c
··· 1080 1080 } 1081 1081 VM_BUG_ON_FOLIO(folio_test_writeback(folio), 1082 1082 folio); 1083 - truncate_inode_folio(mapping, folio); 1083 + 1084 + if (!folio_test_large(folio)) { 1085 + truncate_inode_folio(mapping, folio); 1086 + } else if (truncate_inode_partial_folio(folio, lstart, lend)) { 1087 + /* 1088 + * If we split a page, reset the loop so 1089 + * that we pick up the new sub pages. 1090 + * Otherwise the THP was entirely 1091 + * dropped or the target range was 1092 + * zeroed, so just continue the loop as 1093 + * is. 1094 + */ 1095 + if (!folio_test_large(folio)) { 1096 + folio_unlock(folio); 1097 + index = start; 1098 + break; 1099 + } 1100 + } 1084 1101 } 1085 1102 folio_unlock(folio); 1086 1103 }
+61 -31
mm/vmscan.c
··· 4089 4089 else 4090 4090 VM_WARN_ON_ONCE(true); 4091 4091 4092 + WRITE_ONCE(lruvec->lrugen.seg, seg); 4093 + WRITE_ONCE(lruvec->lrugen.gen, new); 4094 + 4092 4095 hlist_nulls_del_rcu(&lruvec->lrugen.list); 4093 4096 4094 4097 if (op == MEMCG_LRU_HEAD || op == MEMCG_LRU_OLD) ··· 4101 4098 4102 4099 pgdat->memcg_lru.nr_memcgs[old]--; 4103 4100 pgdat->memcg_lru.nr_memcgs[new]++; 4104 - 4105 - lruvec->lrugen.gen = new; 4106 - WRITE_ONCE(lruvec->lrugen.seg, seg); 4107 4101 4108 4102 if (!pgdat->memcg_lru.nr_memcgs[old] && old == get_memcg_gen(pgdat->memcg_lru.seq)) 4109 4103 WRITE_ONCE(pgdat->memcg_lru.seq, pgdat->memcg_lru.seq + 1); ··· 4124 4124 4125 4125 gen = get_memcg_gen(pgdat->memcg_lru.seq); 4126 4126 4127 + lruvec->lrugen.gen = gen; 4128 + 4127 4129 hlist_nulls_add_tail_rcu(&lruvec->lrugen.list, &pgdat->memcg_lru.fifo[gen][bin]); 4128 4130 pgdat->memcg_lru.nr_memcgs[gen]++; 4129 - 4130 - lruvec->lrugen.gen = gen; 4131 4131 4132 4132 spin_unlock_irq(&pgdat->memcg_lru.lock); 4133 4133 } ··· 4232 4232 } 4233 4233 4234 4234 /* protected */ 4235 - if (tier > tier_idx) { 4235 + if (tier > tier_idx || refs == BIT(LRU_REFS_WIDTH)) { 4236 4236 int hist = lru_hist_from_seq(lrugen->min_seq[type]); 4237 4237 4238 4238 gen = folio_inc_gen(lruvec, folio, false); ··· 4598 4598 } 4599 4599 4600 4600 /* try to scrape all its memory if this memcg was deleted */ 4601 - *nr_to_scan = mem_cgroup_online(memcg) ? (total >> sc->priority) : total; 4601 + if (!mem_cgroup_online(memcg)) { 4602 + *nr_to_scan = total; 4603 + return false; 4604 + } 4605 + 4606 + *nr_to_scan = total >> sc->priority; 4602 4607 4603 4608 /* 4604 4609 * The aging tries to be lazy to reduce the overhead, while the eviction ··· 4640 4635 DEFINE_MAX_SEQ(lruvec); 4641 4636 4642 4637 if (mem_cgroup_below_min(sc->target_mem_cgroup, memcg)) 4643 - return 0; 4638 + return -1; 4644 4639 4645 4640 if (!should_run_aging(lruvec, max_seq, sc, can_swap, &nr_to_scan)) 4646 4641 return nr_to_scan; ··· 4653 4648 return try_to_inc_max_seq(lruvec, max_seq, sc, can_swap, false) ? -1 : 0; 4654 4649 } 4655 4650 4656 - static unsigned long get_nr_to_reclaim(struct scan_control *sc) 4651 + static bool should_abort_scan(struct lruvec *lruvec, struct scan_control *sc) 4657 4652 { 4653 + int i; 4654 + enum zone_watermarks mark; 4655 + 4658 4656 /* don't abort memcg reclaim to ensure fairness */ 4659 4657 if (!root_reclaim(sc)) 4660 - return -1; 4658 + return false; 4661 4659 4662 - return max(sc->nr_to_reclaim, compact_gap(sc->order)); 4660 + if (sc->nr_reclaimed >= max(sc->nr_to_reclaim, compact_gap(sc->order))) 4661 + return true; 4662 + 4663 + /* check the order to exclude compaction-induced reclaim */ 4664 + if (!current_is_kswapd() || sc->order) 4665 + return false; 4666 + 4667 + mark = sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING ? 4668 + WMARK_PROMO : WMARK_HIGH; 4669 + 4670 + for (i = 0; i <= sc->reclaim_idx; i++) { 4671 + struct zone *zone = lruvec_pgdat(lruvec)->node_zones + i; 4672 + unsigned long size = wmark_pages(zone, mark) + MIN_LRU_BATCH; 4673 + 4674 + if (managed_zone(zone) && !zone_watermark_ok(zone, 0, size, sc->reclaim_idx, 0)) 4675 + return false; 4676 + } 4677 + 4678 + /* kswapd should abort if all eligible zones are safe */ 4679 + return true; 4663 4680 } 4664 4681 4665 4682 static bool try_to_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) 4666 4683 { 4667 4684 long nr_to_scan; 4668 4685 unsigned long scanned = 0; 4669 - unsigned long nr_to_reclaim = get_nr_to_reclaim(sc); 4670 4686 int swappiness = get_swappiness(lruvec, sc); 4671 4687 4672 4688 /* clean file folios are more likely to exist */ ··· 4709 4683 if (scanned >= nr_to_scan) 4710 4684 break; 4711 4685 4712 - if (sc->nr_reclaimed >= nr_to_reclaim) 4686 + if (should_abort_scan(lruvec, sc)) 4713 4687 break; 4714 4688 4715 4689 cond_resched(); 4716 4690 } 4717 4691 4718 - /* whether try_to_inc_max_seq() was successful */ 4692 + /* whether this lruvec should be rotated */ 4719 4693 return nr_to_scan < 0; 4720 4694 } 4721 4695 ··· 4724 4698 bool success; 4725 4699 unsigned long scanned = sc->nr_scanned; 4726 4700 unsigned long reclaimed = sc->nr_reclaimed; 4727 - int seg = lru_gen_memcg_seg(lruvec); 4728 4701 struct mem_cgroup *memcg = lruvec_memcg(lruvec); 4729 4702 struct pglist_data *pgdat = lruvec_pgdat(lruvec); 4730 - 4731 - /* see the comment on MEMCG_NR_GENS */ 4732 - if (!lruvec_is_sizable(lruvec, sc)) 4733 - return seg != MEMCG_LRU_TAIL ? MEMCG_LRU_TAIL : MEMCG_LRU_YOUNG; 4734 4703 4735 4704 mem_cgroup_calculate_protection(NULL, memcg); 4736 4705 ··· 4734 4713 4735 4714 if (mem_cgroup_below_low(NULL, memcg)) { 4736 4715 /* see the comment on MEMCG_NR_GENS */ 4737 - if (seg != MEMCG_LRU_TAIL) 4716 + if (lru_gen_memcg_seg(lruvec) != MEMCG_LRU_TAIL) 4738 4717 return MEMCG_LRU_TAIL; 4739 4718 4740 4719 memcg_memory_event(memcg, MEMCG_LOW); ··· 4750 4729 4751 4730 flush_reclaim_state(sc); 4752 4731 4753 - return success ? MEMCG_LRU_YOUNG : 0; 4732 + if (success && mem_cgroup_online(memcg)) 4733 + return MEMCG_LRU_YOUNG; 4734 + 4735 + if (!success && lruvec_is_sizable(lruvec, sc)) 4736 + return 0; 4737 + 4738 + /* one retry if offlined or too small */ 4739 + return lru_gen_memcg_seg(lruvec) != MEMCG_LRU_TAIL ? 4740 + MEMCG_LRU_TAIL : MEMCG_LRU_YOUNG; 4754 4741 } 4755 4742 4756 4743 #ifdef CONFIG_MEMCG ··· 4772 4743 struct lruvec *lruvec; 4773 4744 struct lru_gen_folio *lrugen; 4774 4745 struct mem_cgroup *memcg; 4775 - const struct hlist_nulls_node *pos; 4776 - unsigned long nr_to_reclaim = get_nr_to_reclaim(sc); 4746 + struct hlist_nulls_node *pos; 4777 4747 4748 + gen = get_memcg_gen(READ_ONCE(pgdat->memcg_lru.seq)); 4778 4749 bin = first_bin = get_random_u32_below(MEMCG_NR_BINS); 4779 4750 restart: 4780 4751 op = 0; 4781 4752 memcg = NULL; 4782 - gen = get_memcg_gen(READ_ONCE(pgdat->memcg_lru.seq)); 4783 4753 4784 4754 rcu_read_lock(); 4785 4755 ··· 4789 4761 } 4790 4762 4791 4763 mem_cgroup_put(memcg); 4764 + memcg = NULL; 4765 + 4766 + if (gen != READ_ONCE(lrugen->gen)) 4767 + continue; 4792 4768 4793 4769 lruvec = container_of(lrugen, struct lruvec, lrugen); 4794 4770 memcg = lruvec_memcg(lruvec); ··· 4809 4777 4810 4778 rcu_read_lock(); 4811 4779 4812 - if (sc->nr_reclaimed >= nr_to_reclaim) 4780 + if (should_abort_scan(lruvec, sc)) 4813 4781 break; 4814 4782 } 4815 4783 ··· 4820 4788 4821 4789 mem_cgroup_put(memcg); 4822 4790 4823 - if (sc->nr_reclaimed >= nr_to_reclaim) 4791 + if (!is_a_nulls(pos)) 4824 4792 return; 4825 4793 4826 4794 /* restart if raced with lru_gen_rotate_memcg() */ ··· 4877 4845 if (sc->priority != DEF_PRIORITY || sc->nr_to_reclaim < MIN_LRU_BATCH) 4878 4846 return; 4879 4847 /* 4880 - * Determine the initial priority based on ((total / MEMCG_NR_GENS) >> 4881 - * priority) * reclaimed_to_scanned_ratio = nr_to_reclaim, where the 4882 - * estimated reclaimed_to_scanned_ratio = inactive / total. 4848 + * Determine the initial priority based on 4849 + * (total >> priority) * reclaimed_to_scanned_ratio = nr_to_reclaim, 4850 + * where reclaimed_to_scanned_ratio = inactive / total. 4883 4851 */ 4884 4852 reclaimable = node_page_state(pgdat, NR_INACTIVE_FILE); 4885 4853 if (get_swappiness(lruvec, sc)) 4886 4854 reclaimable += node_page_state(pgdat, NR_INACTIVE_ANON); 4887 - 4888 - reclaimable /= MEMCG_NR_GENS; 4889 4855 4890 4856 /* round down reclaimable and round up sc->nr_to_reclaim */ 4891 4857 priority = fls_long(reclaimable) - 1 - fls_long(sc->nr_to_reclaim - 1);
+3 -3
mm/workingset.c
··· 313 313 * 1. For pages accessed through page tables, hotter pages pushed out 314 314 * hot pages which refaulted immediately. 315 315 * 2. For pages accessed multiple times through file descriptors, 316 - * numbers of accesses might have been out of the range. 316 + * they would have been protected by sort_folio(). 317 317 */ 318 - if (lru_gen_in_fault() || refs == BIT(LRU_REFS_WIDTH)) { 319 - folio_set_workingset(folio); 318 + if (lru_gen_in_fault() || refs >= BIT(LRU_REFS_WIDTH) - 1) { 319 + set_mask_bits(&folio->flags, 0, LRU_REFS_MASK | BIT(PG_workingset)); 320 320 mod_lruvec_state(lruvec, WORKINGSET_RESTORE_BASE + type, delta); 321 321 } 322 322 unlock:
+8 -1
net/8021q/vlan_core.c
··· 407 407 return 0; 408 408 409 409 list_for_each_entry(vid_info, &vlan_info->vid_list, list) { 410 + if (!vlan_hw_filter_capable(by_dev, vid_info->proto)) 411 + continue; 410 412 err = vlan_vid_add(dev, vid_info->proto, vid_info->vid); 411 413 if (err) 412 414 goto unwind; ··· 419 417 list_for_each_entry_continue_reverse(vid_info, 420 418 &vlan_info->vid_list, 421 419 list) { 420 + if (!vlan_hw_filter_capable(by_dev, vid_info->proto)) 421 + continue; 422 422 vlan_vid_del(dev, vid_info->proto, vid_info->vid); 423 423 } 424 424 ··· 440 436 if (!vlan_info) 441 437 return; 442 438 443 - list_for_each_entry(vid_info, &vlan_info->vid_list, list) 439 + list_for_each_entry(vid_info, &vlan_info->vid_list, list) { 440 + if (!vlan_hw_filter_capable(by_dev, vid_info->proto)) 441 + continue; 444 442 vlan_vid_del(dev, vid_info->proto, vid_info->vid); 443 + } 445 444 } 446 445 EXPORT_SYMBOL(vlan_vids_del_by_dev); 447 446
+6 -1
net/bluetooth/af_bluetooth.c
··· 309 309 if (flags & MSG_OOB) 310 310 return -EOPNOTSUPP; 311 311 312 + lock_sock(sk); 313 + 312 314 skb = skb_recv_datagram(sk, flags, &err); 313 315 if (!skb) { 314 316 if (sk->sk_shutdown & RCV_SHUTDOWN) 315 - return 0; 317 + err = 0; 316 318 319 + release_sock(sk); 317 320 return err; 318 321 } 319 322 ··· 345 342 } 346 343 347 344 skb_free_datagram(sk, skb); 345 + 346 + release_sock(sk); 348 347 349 348 if (flags & MSG_TRUNC) 350 349 copied = skblen;
+21 -9
net/bluetooth/hci_event.c
··· 516 516 { 517 517 struct hci_rp_read_class_of_dev *rp = data; 518 518 519 + if (WARN_ON(!hdev)) 520 + return HCI_ERROR_UNSPECIFIED; 521 + 519 522 bt_dev_dbg(hdev, "status 0x%2.2x", rp->status); 520 523 521 524 if (rp->status) ··· 750 747 } else { 751 748 conn->enc_key_size = rp->key_size; 752 749 status = 0; 750 + 751 + if (conn->enc_key_size < hdev->min_enc_key_size) { 752 + /* As slave role, the conn->state has been set to 753 + * BT_CONNECTED and l2cap conn req might not be received 754 + * yet, at this moment the l2cap layer almost does 755 + * nothing with the non-zero status. 756 + * So we also clear encrypt related bits, and then the 757 + * handler of l2cap conn req will get the right secure 758 + * state at a later time. 759 + */ 760 + status = HCI_ERROR_AUTH_FAILURE; 761 + clear_bit(HCI_CONN_ENCRYPT, &conn->flags); 762 + clear_bit(HCI_CONN_AES_CCM, &conn->flags); 763 + } 753 764 } 754 765 755 - hci_encrypt_cfm(conn, 0); 766 + hci_encrypt_cfm(conn, status); 756 767 757 768 done: 758 769 hci_dev_unlock(hdev); ··· 836 819 837 820 if (!rp->status) 838 821 conn->auth_payload_timeout = get_unaligned_le16(sent + 2); 839 - 840 - hci_encrypt_cfm(conn, 0); 841 822 842 823 unlock: 843 824 hci_dev_unlock(hdev); ··· 2319 2304 return; 2320 2305 } 2321 2306 2322 - set_bit(HCI_INQUIRY, &hdev->flags); 2307 + if (hci_sent_cmd_data(hdev, HCI_OP_INQUIRY)) 2308 + set_bit(HCI_INQUIRY, &hdev->flags); 2323 2309 } 2324 2310 2325 2311 static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status) ··· 3699 3683 cp.handle = cpu_to_le16(conn->handle); 3700 3684 cp.timeout = cpu_to_le16(hdev->auth_payload_timeout); 3701 3685 if (hci_send_cmd(conn->hdev, HCI_OP_WRITE_AUTH_PAYLOAD_TO, 3702 - sizeof(cp), &cp)) { 3686 + sizeof(cp), &cp)) 3703 3687 bt_dev_err(hdev, "write auth payload timeout failed"); 3704 - goto notify; 3705 - } 3706 - 3707 - goto unlock; 3708 3688 } 3709 3689 3710 3690 notify:
+15 -6
net/bluetooth/l2cap_core.c
··· 6492 6492 kfree_skb(skb); 6493 6493 } 6494 6494 6495 + static inline void l2cap_sig_send_rej(struct l2cap_conn *conn, u16 ident) 6496 + { 6497 + struct l2cap_cmd_rej_unk rej; 6498 + 6499 + rej.reason = cpu_to_le16(L2CAP_REJ_NOT_UNDERSTOOD); 6500 + l2cap_send_cmd(conn, ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej); 6501 + } 6502 + 6495 6503 static inline void l2cap_sig_channel(struct l2cap_conn *conn, 6496 6504 struct sk_buff *skb) 6497 6505 { ··· 6525 6517 6526 6518 if (len > skb->len || !cmd->ident) { 6527 6519 BT_DBG("corrupted command"); 6520 + l2cap_sig_send_rej(conn, cmd->ident); 6528 6521 break; 6529 6522 } 6530 6523 6531 6524 err = l2cap_bredr_sig_cmd(conn, cmd, len, skb->data); 6532 6525 if (err) { 6533 - struct l2cap_cmd_rej_unk rej; 6534 - 6535 6526 BT_ERR("Wrong link type (%d)", err); 6536 - 6537 - rej.reason = cpu_to_le16(L2CAP_REJ_NOT_UNDERSTOOD); 6538 - l2cap_send_cmd(conn, cmd->ident, L2CAP_COMMAND_REJ, 6539 - sizeof(rej), &rej); 6527 + l2cap_sig_send_rej(conn, cmd->ident); 6540 6528 } 6541 6529 6542 6530 skb_pull(skb, len); 6531 + } 6532 + 6533 + if (skb->len > 0) { 6534 + BT_DBG("corrupted command"); 6535 + l2cap_sig_send_rej(conn, 0); 6543 6536 } 6544 6537 6545 6538 drop:
+18 -7
net/bluetooth/mgmt.c
··· 2897 2897 for (i = 0; i < key_count; i++) { 2898 2898 struct mgmt_link_key_info *key = &cp->keys[i]; 2899 2899 2900 - if (key->addr.type != BDADDR_BREDR || key->type > 0x08) 2900 + /* Considering SMP over BREDR/LE, there is no need to check addr_type */ 2901 + if (key->type > 0x08) 2901 2902 return mgmt_cmd_status(sk, hdev->id, 2902 2903 MGMT_OP_LOAD_LINK_KEYS, 2903 2904 MGMT_STATUS_INVALID_PARAMS); ··· 7131 7130 7132 7131 for (i = 0; i < irk_count; i++) { 7133 7132 struct mgmt_irk_info *irk = &cp->irks[i]; 7133 + u8 addr_type = le_addr_type(irk->addr.type); 7134 7134 7135 7135 if (hci_is_blocked_key(hdev, 7136 7136 HCI_BLOCKED_KEY_TYPE_IRK, ··· 7141 7139 continue; 7142 7140 } 7143 7141 7142 + /* When using SMP over BR/EDR, the addr type should be set to BREDR */ 7143 + if (irk->addr.type == BDADDR_BREDR) 7144 + addr_type = BDADDR_BREDR; 7145 + 7144 7146 hci_add_irk(hdev, &irk->addr.bdaddr, 7145 - le_addr_type(irk->addr.type), irk->val, 7147 + addr_type, irk->val, 7146 7148 BDADDR_ANY); 7147 7149 } 7148 7150 ··· 7227 7221 for (i = 0; i < key_count; i++) { 7228 7222 struct mgmt_ltk_info *key = &cp->keys[i]; 7229 7223 u8 type, authenticated; 7224 + u8 addr_type = le_addr_type(key->addr.type); 7230 7225 7231 7226 if (hci_is_blocked_key(hdev, 7232 7227 HCI_BLOCKED_KEY_TYPE_LTK, ··· 7262 7255 continue; 7263 7256 } 7264 7257 7258 + /* When using SMP over BR/EDR, the addr type should be set to BREDR */ 7259 + if (key->addr.type == BDADDR_BREDR) 7260 + addr_type = BDADDR_BREDR; 7261 + 7265 7262 hci_add_ltk(hdev, &key->addr.bdaddr, 7266 - le_addr_type(key->addr.type), type, authenticated, 7263 + addr_type, type, authenticated, 7267 7264 key->val, key->enc_size, key->ediv, key->rand); 7268 7265 } 7269 7266 ··· 9534 9523 9535 9524 ev.store_hint = persistent; 9536 9525 bacpy(&ev.key.addr.bdaddr, &key->bdaddr); 9537 - ev.key.addr.type = BDADDR_BREDR; 9526 + ev.key.addr.type = link_to_bdaddr(key->link_type, key->bdaddr_type); 9538 9527 ev.key.type = key->type; 9539 9528 memcpy(ev.key.val, key->val, HCI_LINK_KEY_SIZE); 9540 9529 ev.key.pin_len = key->pin_len; ··· 9585 9574 ev.store_hint = persistent; 9586 9575 9587 9576 bacpy(&ev.key.addr.bdaddr, &key->bdaddr); 9588 - ev.key.addr.type = link_to_bdaddr(LE_LINK, key->bdaddr_type); 9577 + ev.key.addr.type = link_to_bdaddr(key->link_type, key->bdaddr_type); 9589 9578 ev.key.type = mgmt_ltk_type(key); 9590 9579 ev.key.enc_size = key->enc_size; 9591 9580 ev.key.ediv = key->ediv; ··· 9614 9603 9615 9604 bacpy(&ev.rpa, &irk->rpa); 9616 9605 bacpy(&ev.irk.addr.bdaddr, &irk->bdaddr); 9617 - ev.irk.addr.type = link_to_bdaddr(LE_LINK, irk->addr_type); 9606 + ev.irk.addr.type = link_to_bdaddr(irk->link_type, irk->addr_type); 9618 9607 memcpy(ev.irk.val, irk->val, sizeof(irk->val)); 9619 9608 9620 9609 mgmt_event(MGMT_EV_NEW_IRK, hdev, &ev, sizeof(ev), NULL); ··· 9643 9632 ev.store_hint = persistent; 9644 9633 9645 9634 bacpy(&ev.key.addr.bdaddr, &csrk->bdaddr); 9646 - ev.key.addr.type = link_to_bdaddr(LE_LINK, csrk->bdaddr_type); 9635 + ev.key.addr.type = link_to_bdaddr(csrk->link_type, csrk->bdaddr_type); 9647 9636 ev.key.type = csrk->type; 9648 9637 memcpy(ev.key.val, csrk->val, sizeof(csrk->val)); 9649 9638
+7
net/bluetooth/smp.c
··· 1059 1059 } 1060 1060 1061 1061 if (smp->remote_irk) { 1062 + smp->remote_irk->link_type = hcon->type; 1062 1063 mgmt_new_irk(hdev, smp->remote_irk, persistent); 1063 1064 1064 1065 /* Now that user space can be considered to know the ··· 1079 1078 } 1080 1079 1081 1080 if (smp->csrk) { 1081 + smp->csrk->link_type = hcon->type; 1082 1082 smp->csrk->bdaddr_type = hcon->dst_type; 1083 1083 bacpy(&smp->csrk->bdaddr, &hcon->dst); 1084 1084 mgmt_new_csrk(hdev, smp->csrk, persistent); 1085 1085 } 1086 1086 1087 1087 if (smp->responder_csrk) { 1088 + smp->responder_csrk->link_type = hcon->type; 1088 1089 smp->responder_csrk->bdaddr_type = hcon->dst_type; 1089 1090 bacpy(&smp->responder_csrk->bdaddr, &hcon->dst); 1090 1091 mgmt_new_csrk(hdev, smp->responder_csrk, persistent); 1091 1092 } 1092 1093 1093 1094 if (smp->ltk) { 1095 + smp->ltk->link_type = hcon->type; 1094 1096 smp->ltk->bdaddr_type = hcon->dst_type; 1095 1097 bacpy(&smp->ltk->bdaddr, &hcon->dst); 1096 1098 mgmt_new_ltk(hdev, smp->ltk, persistent); 1097 1099 } 1098 1100 1099 1101 if (smp->responder_ltk) { 1102 + smp->responder_ltk->link_type = hcon->type; 1100 1103 smp->responder_ltk->bdaddr_type = hcon->dst_type; 1101 1104 bacpy(&smp->responder_ltk->bdaddr, &hcon->dst); 1102 1105 mgmt_new_ltk(hdev, smp->responder_ltk, persistent); ··· 1120 1115 key = hci_add_link_key(hdev, smp->conn->hcon, &hcon->dst, 1121 1116 smp->link_key, type, 0, &persistent); 1122 1117 if (key) { 1118 + key->link_type = hcon->type; 1119 + key->bdaddr_type = hcon->dst_type; 1123 1120 mgmt_new_link_key(hdev, key, persistent); 1124 1121 1125 1122 /* Don't keep debug keys around if the relevant
+3
net/core/dev.c
··· 3471 3471 if (gso_segs > READ_ONCE(dev->gso_max_segs)) 3472 3472 return features & ~NETIF_F_GSO_MASK; 3473 3473 3474 + if (unlikely(skb->len >= READ_ONCE(dev->gso_max_size))) 3475 + return features & ~NETIF_F_GSO_MASK; 3476 + 3474 3477 if (!skb_shinfo(skb)->gso_type) { 3475 3478 skb_warn_bad_offload(skb); 3476 3479 return features & ~NETIF_F_GSO_MASK;
+2
net/core/skbuff.c
··· 4861 4861 static void skb_extensions_init(void) 4862 4862 { 4863 4863 BUILD_BUG_ON(SKB_EXT_NUM >= 8); 4864 + #if !IS_ENABLED(CONFIG_KCOV_INSTRUMENT_ALL) 4864 4865 BUILD_BUG_ON(skb_ext_total_length() > 255); 4866 + #endif 4865 4867 4866 4868 skbuff_ext_cache = kmem_cache_create("skbuff_ext_cache", 4867 4869 SKB_EXT_ALIGN_VALUE * skb_ext_total_length(),
+2
net/core/sock_map.c
··· 536 536 { 537 537 if (sk_is_tcp(sk)) 538 538 return (1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_LISTEN); 539 + if (sk_is_stream_unix(sk)) 540 + return (1 << sk->sk_state) & TCPF_ESTABLISHED; 539 541 return true; 540 542 } 541 543
+1 -1
net/core/stream.c
··· 79 79 remove_wait_queue(sk_sleep(sk), &wait); 80 80 sk->sk_write_pending--; 81 81 } while (!done); 82 - return 0; 82 + return done < 0 ? done : 0; 83 83 } 84 84 EXPORT_SYMBOL(sk_stream_wait_connect); 85 85
+1
net/ife/ife.c
··· 82 82 if (unlikely(!pskb_may_pull(skb, total_pull))) 83 83 return NULL; 84 84 85 + ifehdr = (struct ifeheadr *)(skb->data + skb->dev->hard_header_len); 85 86 skb_set_mac_header(skb, total_pull); 86 87 __skb_pull(skb, total_pull); 87 88 *metalen = ifehdrln - IFE_METAHDRLEN;
+6 -49
net/ipv6/ip6_fib.c
··· 160 160 INIT_LIST_HEAD(&f6i->fib6_siblings); 161 161 refcount_set(&f6i->fib6_ref, 1); 162 162 163 - INIT_HLIST_NODE(&f6i->gc_link); 164 - 165 163 return f6i; 166 164 } 167 165 ··· 246 248 net->ipv6.fib6_null_entry); 247 249 table->tb6_root.fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO; 248 250 inet_peer_base_init(&table->tb6_peers); 249 - INIT_HLIST_HEAD(&table->tb6_gc_hlist); 250 251 } 251 252 252 253 return table; ··· 1057 1060 lockdep_is_held(&table->tb6_lock)); 1058 1061 } 1059 1062 } 1060 - 1061 - fib6_clean_expires_locked(rt); 1062 1063 } 1063 1064 1064 1065 /* ··· 1118 1123 if (!(iter->fib6_flags & RTF_EXPIRES)) 1119 1124 return -EEXIST; 1120 1125 if (!(rt->fib6_flags & RTF_EXPIRES)) 1121 - fib6_clean_expires_locked(iter); 1126 + fib6_clean_expires(iter); 1122 1127 else 1123 - fib6_set_expires_locked(iter, 1124 - rt->expires); 1128 + fib6_set_expires(iter, rt->expires); 1125 1129 1126 1130 if (rt->fib6_pmtu) 1127 1131 fib6_metric_set(iter, RTAX_MTU, ··· 1479 1485 if (rt->nh) 1480 1486 list_add(&rt->nh_list, &rt->nh->f6i_list); 1481 1487 __fib6_update_sernum_upto_root(rt, fib6_new_sernum(info->nl_net)); 1482 - 1483 - if (fib6_has_expires(rt)) 1484 - hlist_add_head(&rt->gc_link, &table->tb6_gc_hlist); 1485 - 1486 1488 fib6_start_gc(info->nl_net, rt); 1487 1489 } 1488 1490 ··· 2281 2291 * Garbage collection 2282 2292 */ 2283 2293 2284 - static int fib6_age(struct fib6_info *rt, struct fib6_gc_args *gc_args) 2294 + static int fib6_age(struct fib6_info *rt, void *arg) 2285 2295 { 2296 + struct fib6_gc_args *gc_args = arg; 2286 2297 unsigned long now = jiffies; 2287 2298 2288 2299 /* ··· 2291 2300 * Routes are expired even if they are in use. 2292 2301 */ 2293 2302 2294 - if (fib6_has_expires(rt) && rt->expires) { 2303 + if (rt->fib6_flags & RTF_EXPIRES && rt->expires) { 2295 2304 if (time_after(now, rt->expires)) { 2296 2305 RT6_TRACE("expiring %p\n", rt); 2297 2306 return -1; ··· 2306 2315 rt6_age_exceptions(rt, gc_args, now); 2307 2316 2308 2317 return 0; 2309 - } 2310 - 2311 - static void fib6_gc_table(struct net *net, 2312 - struct fib6_table *tb6, 2313 - struct fib6_gc_args *gc_args) 2314 - { 2315 - struct fib6_info *rt; 2316 - struct hlist_node *n; 2317 - struct nl_info info = { 2318 - .nl_net = net, 2319 - .skip_notify = false, 2320 - }; 2321 - 2322 - hlist_for_each_entry_safe(rt, n, &tb6->tb6_gc_hlist, gc_link) 2323 - if (fib6_age(rt, gc_args) == -1) 2324 - fib6_del(rt, &info); 2325 - } 2326 - 2327 - static void fib6_gc_all(struct net *net, struct fib6_gc_args *gc_args) 2328 - { 2329 - struct fib6_table *table; 2330 - struct hlist_head *head; 2331 - unsigned int h; 2332 - 2333 - rcu_read_lock(); 2334 - for (h = 0; h < FIB6_TABLE_HASHSZ; h++) { 2335 - head = &net->ipv6.fib_table_hash[h]; 2336 - hlist_for_each_entry_rcu(table, head, tb6_hlist) { 2337 - spin_lock_bh(&table->tb6_lock); 2338 - fib6_gc_table(net, table, gc_args); 2339 - spin_unlock_bh(&table->tb6_lock); 2340 - } 2341 - } 2342 - rcu_read_unlock(); 2343 2318 } 2344 2319 2345 2320 void fib6_run_gc(unsigned long expires, struct net *net, bool force) ··· 2323 2366 net->ipv6.sysctl.ip6_rt_gc_interval; 2324 2367 gc_args.more = 0; 2325 2368 2326 - fib6_gc_all(net, &gc_args); 2369 + fib6_clean_all(net, fib6_age, &gc_args); 2327 2370 now = jiffies; 2328 2371 net->ipv6.ip6_rt_last_gc = now; 2329 2372
+3 -3
net/ipv6/route.c
··· 3763 3763 rt->dst_nocount = true; 3764 3764 3765 3765 if (cfg->fc_flags & RTF_EXPIRES) 3766 - fib6_set_expires_locked(rt, jiffies + 3767 - clock_t_to_jiffies(cfg->fc_expires)); 3766 + fib6_set_expires(rt, jiffies + 3767 + clock_t_to_jiffies(cfg->fc_expires)); 3768 3768 else 3769 - fib6_clean_expires_locked(rt); 3769 + fib6_clean_expires(rt); 3770 3770 3771 3771 if (cfg->fc_protocol == RTPROT_UNSPEC) 3772 3772 cfg->fc_protocol = RTPROT_BOOT;
+2 -2
net/mac80211/cfg.c
··· 1788 1788 lockdep_is_held(&local->hw.wiphy->mtx)); 1789 1789 1790 1790 /* 1791 - * If there are no changes, then accept a link that doesn't exist, 1791 + * If there are no changes, then accept a link that exist, 1792 1792 * unless it's a new link. 1793 1793 */ 1794 - if (params->link_id < 0 && !new_link && 1794 + if (params->link_id >= 0 && !new_link && 1795 1795 !params->link_mac && !params->txpwr_set && 1796 1796 !params->supported_rates_len && 1797 1797 !params->ht_capa && !params->vht_capa &&
+5 -1
net/mac80211/driver-ops.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 3 * Copyright 2015 Intel Deutschland GmbH 4 - * Copyright (C) 2022 Intel Corporation 4 + * Copyright (C) 2022-2023 Intel Corporation 5 5 */ 6 6 #include <net/mac80211.h> 7 7 #include "ieee80211_i.h" ··· 588 588 589 589 if (ret) 590 590 return ret; 591 + 592 + /* during reconfig don't add it to debugfs again */ 593 + if (local->in_reconfig) 594 + return 0; 591 595 592 596 for_each_set_bit(link_id, &links_to_add, IEEE80211_MLD_MAX_NUM_LINKS) { 593 597 link_sta = rcu_dereference_protected(info->link[link_id],
+9 -7
net/mac80211/mesh_plink.c
··· 1068 1068 case WLAN_SP_MESH_PEERING_OPEN: 1069 1069 if (!matches_local) 1070 1070 event = OPN_RJCT; 1071 - if (!mesh_plink_free_count(sdata) || 1072 - (sta->mesh->plid && sta->mesh->plid != plid)) 1071 + else if (!mesh_plink_free_count(sdata) || 1072 + (sta->mesh->plid && sta->mesh->plid != plid)) 1073 1073 event = OPN_IGNR; 1074 1074 else 1075 1075 event = OPN_ACPT; ··· 1077 1077 case WLAN_SP_MESH_PEERING_CONFIRM: 1078 1078 if (!matches_local) 1079 1079 event = CNF_RJCT; 1080 - if (!mesh_plink_free_count(sdata) || 1081 - sta->mesh->llid != llid || 1082 - (sta->mesh->plid && sta->mesh->plid != plid)) 1080 + else if (!mesh_plink_free_count(sdata) || 1081 + sta->mesh->llid != llid || 1082 + (sta->mesh->plid && sta->mesh->plid != plid)) 1083 1083 event = CNF_IGNR; 1084 1084 else 1085 1085 event = CNF_ACPT; ··· 1247 1247 return; 1248 1248 } 1249 1249 elems = ieee802_11_parse_elems(baseaddr, len - baselen, true, NULL); 1250 - mesh_process_plink_frame(sdata, mgmt, elems, rx_status); 1251 - kfree(elems); 1250 + if (elems) { 1251 + mesh_process_plink_frame(sdata, mgmt, elems, rx_status); 1252 + kfree(elems); 1253 + } 1252 1254 }
+3 -1
net/mac80211/mlme.c
··· 5800 5800 { 5801 5801 const struct ieee80211_multi_link_elem *ml; 5802 5802 const struct element *sub; 5803 - size_t ml_len; 5803 + ssize_t ml_len; 5804 5804 unsigned long removed_links = 0; 5805 5805 u16 link_removal_timeout[IEEE80211_MLD_MAX_NUM_LINKS] = {}; 5806 5806 u8 link_id; ··· 5816 5816 elems->scratch + elems->scratch_len - 5817 5817 elems->scratch_pos, 5818 5818 WLAN_EID_FRAGMENT); 5819 + if (ml_len < 0) 5820 + return; 5819 5821 5820 5822 elems->ml_reconf = (const void *)elems->scratch_pos; 5821 5823 elems->ml_reconf_len = ml_len;
+1
net/mptcp/crypto_test.c
··· 70 70 kunit_test_suite(mptcp_crypto_suite); 71 71 72 72 MODULE_LICENSE("GPL"); 73 + MODULE_DESCRIPTION("KUnit tests for MPTCP Crypto");
+3 -3
net/mptcp/protocol.c
··· 3402 3402 if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags)) 3403 3403 __mptcp_clean_una_wakeup(sk); 3404 3404 if (unlikely(msk->cb_flags)) { 3405 - /* be sure to set the current sk state before taking actions 3405 + /* be sure to sync the msk state before taking actions 3406 3406 * depending on sk_state (MPTCP_ERROR_REPORT) 3407 3407 * On sk release avoid actions depending on the first subflow 3408 3408 */ 3409 - if (__test_and_clear_bit(MPTCP_CONNECTED, &msk->cb_flags) && msk->first) 3410 - __mptcp_set_connected(sk); 3409 + if (__test_and_clear_bit(MPTCP_SYNC_STATE, &msk->cb_flags) && msk->first) 3410 + __mptcp_sync_state(sk, msk->pending_state); 3411 3411 if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags)) 3412 3412 __mptcp_error_report(sk); 3413 3413 if (__test_and_clear_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags))
+6 -3
net/mptcp/protocol.h
··· 124 124 #define MPTCP_ERROR_REPORT 3 125 125 #define MPTCP_RETRANSMIT 4 126 126 #define MPTCP_FLUSH_JOIN_LIST 5 127 - #define MPTCP_CONNECTED 6 127 + #define MPTCP_SYNC_STATE 6 128 128 #define MPTCP_SYNC_SNDBUF 7 129 129 130 130 struct mptcp_skb_cb { ··· 296 296 bool use_64bit_ack; /* Set when we received a 64-bit DSN */ 297 297 bool csum_enabled; 298 298 bool allow_infinite_fallback; 299 + u8 pending_state; /* A subflow asked to set this sk_state, 300 + * protected by the msk data lock 301 + */ 299 302 u8 mpc_endpoint_id; 300 303 u8 recvmsg_inq:1, 301 304 cork:1, ··· 731 728 struct mptcp_options_received *mp_opt); 732 729 733 730 void mptcp_finish_connect(struct sock *sk); 734 - void __mptcp_set_connected(struct sock *sk); 731 + void __mptcp_sync_state(struct sock *sk, int state); 735 732 void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout); 736 733 737 734 static inline void mptcp_stop_tout_timer(struct sock *sk) ··· 1127 1124 { 1128 1125 struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 1129 1126 1130 - return sk->sk_state == TCP_ESTABLISHED && 1127 + return (1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_FIN_WAIT1) && 1131 1128 is_active_ssk(subflow) && 1132 1129 !subflow->conn_finished; 1133 1130 }
+17 -11
net/mptcp/subflow.c
··· 419 419 return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport; 420 420 } 421 421 422 - void __mptcp_set_connected(struct sock *sk) 422 + void __mptcp_sync_state(struct sock *sk, int state) 423 423 { 424 - __mptcp_propagate_sndbuf(sk, mptcp_sk(sk)->first); 424 + struct mptcp_sock *msk = mptcp_sk(sk); 425 + 426 + __mptcp_propagate_sndbuf(sk, msk->first); 425 427 if (sk->sk_state == TCP_SYN_SENT) { 426 - inet_sk_state_store(sk, TCP_ESTABLISHED); 428 + inet_sk_state_store(sk, state); 427 429 sk->sk_state_change(sk); 428 430 } 429 431 } 430 432 431 - static void mptcp_set_connected(struct sock *sk) 433 + static void mptcp_propagate_state(struct sock *sk, struct sock *ssk) 432 434 { 435 + struct mptcp_sock *msk = mptcp_sk(sk); 436 + 433 437 mptcp_data_lock(sk); 434 - if (!sock_owned_by_user(sk)) 435 - __mptcp_set_connected(sk); 436 - else 437 - __set_bit(MPTCP_CONNECTED, &mptcp_sk(sk)->cb_flags); 438 + if (!sock_owned_by_user(sk)) { 439 + __mptcp_sync_state(sk, ssk->sk_state); 440 + } else { 441 + msk->pending_state = ssk->sk_state; 442 + __set_bit(MPTCP_SYNC_STATE, &msk->cb_flags); 443 + } 438 444 mptcp_data_unlock(sk); 439 445 } 440 446 ··· 502 496 subflow_set_remote_key(msk, subflow, &mp_opt); 503 497 MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVEACK); 504 498 mptcp_finish_connect(sk); 505 - mptcp_set_connected(parent); 499 + mptcp_propagate_state(parent, sk); 506 500 } else if (subflow->request_join) { 507 501 u8 hmac[SHA256_DIGEST_SIZE]; 508 502 ··· 546 540 } else if (mptcp_check_fallback(sk)) { 547 541 fallback: 548 542 mptcp_rcv_space_init(msk, sk); 549 - mptcp_set_connected(parent); 543 + mptcp_propagate_state(parent, sk); 550 544 } 551 545 return; 552 546 ··· 1746 1740 mptcp_rcv_space_init(msk, sk); 1747 1741 pr_fallback(msk); 1748 1742 subflow->conn_finished = 1; 1749 - mptcp_set_connected(parent); 1743 + mptcp_propagate_state(parent, sk); 1750 1744 } 1751 1745 1752 1746 /* as recvmsg() does not acquire the subflow socket for ssk selection
+1
net/mptcp/token_test.c
··· 143 143 kunit_test_suite(mptcp_token_suite); 144 144 145 145 MODULE_LICENSE("GPL"); 146 + MODULE_DESCRIPTION("KUnit tests for MPTCP Token");
+8
net/rfkill/rfkill-gpio.c
··· 126 126 return -EINVAL; 127 127 } 128 128 129 + ret = gpiod_direction_output(rfkill->reset_gpio, true); 130 + if (ret) 131 + return ret; 132 + 133 + ret = gpiod_direction_output(rfkill->shutdown_gpio, true); 134 + if (ret) 135 + return ret; 136 + 129 137 rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev, 130 138 rfkill->type, &rfkill_gpio_ops, 131 139 rfkill);
+35 -6
net/rose/af_rose.c
··· 182 182 */ 183 183 static void rose_kill_by_device(struct net_device *dev) 184 184 { 185 - struct sock *s; 185 + struct sock *sk, *array[16]; 186 + struct rose_sock *rose; 187 + bool rescan; 188 + int i, cnt; 186 189 190 + start: 191 + rescan = false; 192 + cnt = 0; 187 193 spin_lock_bh(&rose_list_lock); 188 - sk_for_each(s, &rose_list) { 189 - struct rose_sock *rose = rose_sk(s); 190 - 194 + sk_for_each(sk, &rose_list) { 195 + rose = rose_sk(sk); 191 196 if (rose->device == dev) { 192 - rose_disconnect(s, ENETUNREACH, ROSE_OUT_OF_ORDER, 0); 197 + if (cnt == ARRAY_SIZE(array)) { 198 + rescan = true; 199 + break; 200 + } 201 + sock_hold(sk); 202 + array[cnt++] = sk; 203 + } 204 + } 205 + spin_unlock_bh(&rose_list_lock); 206 + 207 + for (i = 0; i < cnt; i++) { 208 + sk = array[cnt]; 209 + rose = rose_sk(sk); 210 + lock_sock(sk); 211 + spin_lock_bh(&rose_list_lock); 212 + if (rose->device == dev) { 213 + rose_disconnect(sk, ENETUNREACH, ROSE_OUT_OF_ORDER, 0); 193 214 if (rose->neighbour) 194 215 rose->neighbour->use--; 195 216 netdev_put(rose->device, &rose->dev_tracker); 196 217 rose->device = NULL; 197 218 } 219 + spin_unlock_bh(&rose_list_lock); 220 + release_sock(sk); 221 + sock_put(sk); 222 + cond_resched(); 198 223 } 199 - spin_unlock_bh(&rose_list_lock); 224 + if (rescan) 225 + goto start; 200 226 } 201 227 202 228 /* ··· 682 656 break; 683 657 } 684 658 659 + spin_lock_bh(&rose_list_lock); 685 660 netdev_put(rose->device, &rose->dev_tracker); 661 + rose->device = NULL; 662 + spin_unlock_bh(&rose_list_lock); 686 663 sock->sk = NULL; 687 664 release_sock(sk); 688 665 sock_put(sk);
-3
net/sunrpc/auth.c
··· 40 40 41 41 static struct cred machine_cred = { 42 42 .usage = ATOMIC_INIT(1), 43 - #ifdef CONFIG_DEBUG_CREDENTIALS 44 - .magic = CRED_MAGIC, 45 - #endif 46 43 }; 47 44 48 45 /*
+2 -3
net/sunrpc/svc_xprt.c
··· 654 654 } 655 655 656 656 for (filled = 0; filled < pages; filled = ret) { 657 - ret = alloc_pages_bulk_array_node(GFP_KERNEL, 658 - rqstp->rq_pool->sp_id, 659 - pages, rqstp->rq_pages); 657 + ret = alloc_pages_bulk_array(GFP_KERNEL, pages, 658 + rqstp->rq_pages); 660 659 if (ret > filled) 661 660 /* Made progress, don't sleep yet */ 662 661 continue;
+87
net/wireless/certs/wens.hex
··· 1 + /* Chen-Yu Tsai's regdb certificate */ 2 + 0x30, 0x82, 0x02, 0xa7, 0x30, 0x82, 0x01, 0x8f, 3 + 0x02, 0x14, 0x61, 0xc0, 0x38, 0x65, 0x1a, 0xab, 4 + 0xdc, 0xf9, 0x4b, 0xd0, 0xac, 0x7f, 0xf0, 0x6c, 5 + 0x72, 0x48, 0xdb, 0x18, 0xc6, 0x00, 0x30, 0x0d, 6 + 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 7 + 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x0f, 0x31, 8 + 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x03, 9 + 0x0c, 0x04, 0x77, 0x65, 0x6e, 0x73, 0x30, 0x20, 10 + 0x17, 0x0d, 0x32, 0x33, 0x31, 0x32, 0x30, 0x31, 11 + 0x30, 0x37, 0x34, 0x31, 0x31, 0x34, 0x5a, 0x18, 12 + 0x0f, 0x32, 0x31, 0x32, 0x33, 0x31, 0x31, 0x30, 13 + 0x37, 0x30, 0x37, 0x34, 0x31, 0x31, 0x34, 0x5a, 14 + 0x30, 0x0f, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 15 + 0x55, 0x04, 0x03, 0x0c, 0x04, 0x77, 0x65, 0x6e, 16 + 0x73, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 17 + 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 18 + 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 19 + 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 20 + 0x01, 0x00, 0xa9, 0x7a, 0x2c, 0x78, 0x4d, 0xa7, 21 + 0x19, 0x2d, 0x32, 0x52, 0xa0, 0x2e, 0x6c, 0xef, 22 + 0x88, 0x7f, 0x15, 0xc5, 0xb6, 0x69, 0x54, 0x16, 23 + 0x43, 0x14, 0x79, 0x53, 0xb7, 0xae, 0x88, 0xfe, 24 + 0xc0, 0xb7, 0x5d, 0x47, 0x8e, 0x1a, 0xe1, 0xef, 25 + 0xb3, 0x90, 0x86, 0xda, 0xd3, 0x64, 0x81, 0x1f, 26 + 0xce, 0x5d, 0x9e, 0x4b, 0x6e, 0x58, 0x02, 0x3e, 27 + 0xb2, 0x6f, 0x5e, 0x42, 0x47, 0x41, 0xf4, 0x2c, 28 + 0xb8, 0xa8, 0xd4, 0xaa, 0xc0, 0x0e, 0xe6, 0x48, 29 + 0xf0, 0xa8, 0xce, 0xcb, 0x08, 0xae, 0x37, 0xaf, 30 + 0xf6, 0x40, 0x39, 0xcb, 0x55, 0x6f, 0x5b, 0x4f, 31 + 0x85, 0x34, 0xe6, 0x69, 0x10, 0x50, 0x72, 0x5e, 32 + 0x4e, 0x9d, 0x4c, 0xba, 0x38, 0x36, 0x0d, 0xce, 33 + 0x73, 0x38, 0xd7, 0x27, 0x02, 0x2a, 0x79, 0x03, 34 + 0xe1, 0xac, 0xcf, 0xb0, 0x27, 0x85, 0x86, 0x93, 35 + 0x17, 0xab, 0xec, 0x42, 0x77, 0x37, 0x65, 0x8a, 36 + 0x44, 0xcb, 0xd6, 0x42, 0x93, 0x92, 0x13, 0xe3, 37 + 0x39, 0x45, 0xc5, 0x6e, 0x00, 0x4a, 0x7f, 0xcb, 38 + 0x42, 0x17, 0x2b, 0x25, 0x8c, 0xb8, 0x17, 0x3b, 39 + 0x15, 0x36, 0x59, 0xde, 0x42, 0xce, 0x21, 0xe6, 40 + 0xb6, 0xc7, 0x6e, 0x5e, 0x26, 0x1f, 0xf7, 0x8a, 41 + 0x57, 0x9e, 0xa5, 0x96, 0x72, 0xb7, 0x02, 0x32, 42 + 0xeb, 0x07, 0x2b, 0x73, 0xe2, 0x4f, 0x66, 0x58, 43 + 0x9a, 0xeb, 0x0f, 0x07, 0xb6, 0xab, 0x50, 0x8b, 44 + 0xc3, 0x8f, 0x17, 0xfa, 0x0a, 0x99, 0xc2, 0x16, 45 + 0x25, 0xbf, 0x2d, 0x6b, 0x1a, 0xaa, 0xe6, 0x3e, 46 + 0x5f, 0xeb, 0x6d, 0x9b, 0x5d, 0x4d, 0x42, 0x83, 47 + 0x2d, 0x39, 0xb8, 0xc9, 0xac, 0xdb, 0x3a, 0x91, 48 + 0x50, 0xdf, 0xbb, 0xb1, 0x76, 0x6d, 0x15, 0x73, 49 + 0xfd, 0xc6, 0xe6, 0x6b, 0x71, 0x9e, 0x67, 0x36, 50 + 0x22, 0x83, 0x79, 0xb1, 0xd6, 0xb8, 0x84, 0x52, 51 + 0xaf, 0x96, 0x5b, 0xc3, 0x63, 0x02, 0x4e, 0x78, 52 + 0x70, 0x57, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 53 + 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 54 + 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 55 + 0x01, 0x01, 0x00, 0x24, 0x28, 0xee, 0x22, 0x74, 56 + 0x7f, 0x7c, 0xfa, 0x6c, 0x1f, 0xb3, 0x18, 0xd1, 57 + 0xc2, 0x3d, 0x7d, 0x29, 0x42, 0x88, 0xad, 0x82, 58 + 0xa5, 0xb1, 0x8a, 0x05, 0xd0, 0xec, 0x5c, 0x91, 59 + 0x20, 0xf6, 0x82, 0xfd, 0xd5, 0x67, 0x60, 0x5f, 60 + 0x31, 0xf5, 0xbd, 0x88, 0x91, 0x70, 0xbd, 0xb8, 61 + 0xb9, 0x8c, 0x88, 0xfe, 0x53, 0xc9, 0x54, 0x9b, 62 + 0x43, 0xc4, 0x7a, 0x43, 0x74, 0x6b, 0xdd, 0xb0, 63 + 0xb1, 0x3b, 0x33, 0x45, 0x46, 0x78, 0xa3, 0x1c, 64 + 0xef, 0x54, 0x68, 0xf7, 0x85, 0x9c, 0xe4, 0x51, 65 + 0x6f, 0x06, 0xaf, 0x81, 0xdb, 0x2a, 0x7b, 0x7b, 66 + 0x6f, 0xa8, 0x9c, 0x67, 0xd8, 0xcb, 0xc9, 0x91, 67 + 0x40, 0x00, 0xae, 0xd9, 0xa1, 0x9f, 0xdd, 0xa6, 68 + 0x43, 0x0e, 0x28, 0x7b, 0xaa, 0x1b, 0xe9, 0x84, 69 + 0xdb, 0x76, 0x64, 0x42, 0x70, 0xc9, 0xc0, 0xeb, 70 + 0xae, 0x84, 0x11, 0x16, 0x68, 0x4e, 0x84, 0x9e, 71 + 0x7e, 0x92, 0x36, 0xee, 0x1c, 0x3b, 0x08, 0x63, 72 + 0xeb, 0x79, 0x84, 0x15, 0x08, 0x9d, 0xaf, 0xc8, 73 + 0x9a, 0xc7, 0x34, 0xd3, 0x94, 0x4b, 0xd1, 0x28, 74 + 0x97, 0xbe, 0xd1, 0x45, 0x75, 0xdc, 0x35, 0x62, 75 + 0xac, 0x1d, 0x1f, 0xb7, 0xb7, 0x15, 0x87, 0xc8, 76 + 0x98, 0xc0, 0x24, 0x31, 0x56, 0x8d, 0xed, 0xdb, 77 + 0x06, 0xc6, 0x46, 0xbf, 0x4b, 0x6d, 0xa6, 0xd5, 78 + 0xab, 0xcc, 0x60, 0xfc, 0xe5, 0x37, 0xb6, 0x53, 79 + 0x7d, 0x58, 0x95, 0xa9, 0x56, 0xc7, 0xf7, 0xee, 80 + 0xc3, 0xa0, 0x76, 0xf7, 0x65, 0x4d, 0x53, 0xfa, 81 + 0xff, 0x5f, 0x76, 0x33, 0x5a, 0x08, 0xfa, 0x86, 82 + 0x92, 0x5a, 0x13, 0xfa, 0x1a, 0xfc, 0xf2, 0x1b, 83 + 0x8c, 0x7f, 0x42, 0x6d, 0xb7, 0x7e, 0xb7, 0xb4, 84 + 0xf0, 0xc7, 0x83, 0xbb, 0xa2, 0x81, 0x03, 0x2d, 85 + 0xd4, 0x2a, 0x63, 0x3f, 0xf7, 0x31, 0x2e, 0x40, 86 + 0x33, 0x5c, 0x46, 0xbc, 0x9b, 0xc1, 0x05, 0xa5, 87 + 0x45, 0x4e, 0xc3,
-6
security/selinux/hooks.c
··· 1660 1660 struct inode_security_struct *isec; 1661 1661 u32 sid; 1662 1662 1663 - validate_creds(cred); 1664 - 1665 1663 if (unlikely(IS_PRIVATE(inode))) 1666 1664 return 0; 1667 1665 ··· 3054 3056 struct inode_security_struct *isec; 3055 3057 u32 sid; 3056 3058 3057 - validate_creds(cred); 3058 - 3059 3059 ad.type = LSM_AUDIT_DATA_DENTRY; 3060 3060 ad.u.dentry = dentry; 3061 3061 sid = cred_sid(cred); ··· 3096 3100 /* No permission to check. Existence test. */ 3097 3101 if (!mask) 3098 3102 return 0; 3099 - 3100 - validate_creds(cred); 3101 3103 3102 3104 if (unlikely(IS_PRIVATE(inode))) 3103 3105 return 0;
+3
sound/pci/hda/patch_hdmi.c
··· 1993 1993 SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1), 1994 1994 SND_PCI_QUIRK(0x103c, 0x8711, "HP", 1), 1995 1995 SND_PCI_QUIRK(0x103c, 0x8715, "HP", 1), 1996 + SND_PCI_QUIRK(0x1043, 0x86ae, "ASUS", 1), /* Z170 PRO */ 1997 + SND_PCI_QUIRK(0x1043, 0x86c7, "ASUS", 1), /* Z170M PLUS */ 1996 1998 SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1), 1999 + SND_PCI_QUIRK(0x8086, 0x2060, "Intel NUC5CPYB", 1), 1997 2000 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", 1), 1998 2001 {} 1999 2002 };
+1
sound/pci/hda/patch_realtek.c
··· 9795 9795 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), 9796 9796 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3), 9797 9797 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), 9798 + SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2), 9798 9799 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN), 9799 9800 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), 9800 9801 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
+10 -11
sound/pci/hda/tas2781_hda_i2c.c
··· 455 455 status = efi.get_variable(efi_name, &efi_guid, &attr, 456 456 &tas_priv->cali_data.total_sz, 457 457 tas_priv->cali_data.data); 458 - if (status != EFI_SUCCESS) 459 - return -EINVAL; 460 458 } 459 + if (status != EFI_SUCCESS) 460 + return -EINVAL; 461 461 462 462 tmp_val = (unsigned int *)tas_priv->cali_data.data; 463 463 ··· 550 550 tas2781_save_calibration(tas_priv); 551 551 552 552 out: 553 - if (tas_priv->fw_state == TASDEVICE_DSP_FW_FAIL) { 554 - /*If DSP FW fail, kcontrol won't be created */ 555 - tasdevice_config_info_remove(tas_priv); 556 - tasdevice_dsp_remove(tas_priv); 557 - } 558 553 mutex_unlock(&tas_priv->codec_lock); 559 554 if (fmw) 560 555 release_firmware(fmw); ··· 607 612 { 608 613 struct tasdevice_priv *tas_priv = dev_get_drvdata(dev); 609 614 struct hda_component *comps = master_data; 615 + comps = &comps[tas_priv->index]; 610 616 611 - if (comps[tas_priv->index].dev == dev) 612 - memset(&comps[tas_priv->index], 0, sizeof(*comps)); 617 + if (comps->dev == dev) { 618 + comps->dev = NULL; 619 + memset(comps->name, 0, sizeof(comps->name)); 620 + comps->playback_hook = NULL; 621 + } 613 622 614 623 tasdevice_config_info_remove(tas_priv); 615 624 tasdevice_dsp_remove(tas_priv); ··· 674 675 675 676 pm_runtime_put_autosuspend(tas_priv->dev); 676 677 678 + tas2781_reset(tas_priv); 679 + 677 680 ret = component_add(tas_priv->dev, &tas2781_hda_comp_ops); 678 681 if (ret) { 679 682 dev_err(tas_priv->dev, "Register component failed: %d\n", ret); 680 683 pm_runtime_disable(tas_priv->dev); 681 - goto err; 682 684 } 683 685 684 - tas2781_reset(tas_priv); 685 686 err: 686 687 if (ret) 687 688 tas2781_hda_remove(&clt->dev);
-1
tools/objtool/noreturns.h
··· 6 6 * 7 7 * Yes, this is unfortunate. A better solution is in the works. 8 8 */ 9 - NORETURN(__invalid_creds) 10 9 NORETURN(__kunit_abort) 11 10 NORETURN(__module_put_and_kthread_exit) 12 11 NORETURN(__reiserfs_panic)
+1
tools/testing/cxl/Kbuild
··· 62 62 cxl_core-$(CONFIG_CXL_REGION) += $(CXL_CORE_SRC)/region.o 63 63 cxl_core-y += config_check.o 64 64 cxl_core-y += cxl_core_test.o 65 + cxl_core-y += cxl_core_exports.o 65 66 66 67 obj-m += test/
+7
tools/testing/cxl/cxl_core_exports.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* Copyright(c) 2022 Intel Corporation. All rights reserved. */ 3 + 4 + #include "cxl.h" 5 + 6 + /* Exporting of cxl_core symbols that are only used by cxl_test */ 7 + EXPORT_SYMBOL_NS_GPL(cxl_num_decoders_committed, CXL);
+3 -2
tools/testing/cxl/test/cxl.c
··· 669 669 return 0; 670 670 671 671 dev_dbg(&port->dev, "%s commit\n", dev_name(&cxld->dev)); 672 - if (port->commit_end + 1 != id) { 672 + if (cxl_num_decoders_committed(port) != id) { 673 673 dev_dbg(&port->dev, 674 674 "%s: out of order commit, expected decoder%d.%d\n", 675 - dev_name(&cxld->dev), port->id, port->commit_end + 1); 675 + dev_name(&cxld->dev), port->id, 676 + cxl_num_decoders_committed(port)); 676 677 return -EBUSY; 677 678 } 678 679
+1 -20
tools/testing/selftests/Makefile
··· 156 156 abs_objtree := $(realpath $(abs_objtree)) 157 157 BUILD := $(abs_objtree)/kselftest 158 158 KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include 159 - KHDR_DIR := ${abs_objtree}/usr/include 160 159 else 161 160 BUILD := $(CURDIR) 162 161 abs_srctree := $(shell cd $(top_srcdir) && pwd) 163 162 KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include 164 - KHDR_DIR := ${abs_srctree}/usr/include 165 163 DEFAULT_INSTALL_HDR_PATH := 1 166 164 endif 167 165 ··· 173 175 # all isn't the first target in the file. 174 176 .DEFAULT_GOAL := all 175 177 176 - all: kernel_header_files 178 + all: 177 179 @ret=1; \ 178 180 for TARGET in $(TARGETS); do \ 179 181 BUILD_TARGET=$$BUILD/$$TARGET; \ ··· 183 185 $(if $(FORCE_TARGETS),|| exit); \ 184 186 ret=$$((ret * $$?)); \ 185 187 done; exit $$ret; 186 - 187 - kernel_header_files: 188 - @ls $(KHDR_DIR)/linux/*.h >/dev/null 2>/dev/null; \ 189 - if [ $$? -ne 0 ]; then \ 190 - RED='\033[1;31m'; \ 191 - NOCOLOR='\033[0m'; \ 192 - echo; \ 193 - echo -e "$${RED}error$${NOCOLOR}: missing kernel header files."; \ 194 - echo "Please run this and try again:"; \ 195 - echo; \ 196 - echo " cd $(top_srcdir)"; \ 197 - echo " make headers"; \ 198 - echo; \ 199 - exit 1; \ 200 - fi 201 - 202 - .PHONY: kernel_header_files 203 188 204 189 run_tests: all 205 190 @for TARGET in $(TARGETS); do \
-1
tools/testing/selftests/bpf/config.x86_64
··· 46 46 CONFIG_CRYPTO_XXHASH=y 47 47 CONFIG_DCB=y 48 48 CONFIG_DEBUG_ATOMIC_SLEEP=y 49 - CONFIG_DEBUG_CREDENTIALS=y 50 49 CONFIG_DEBUG_INFO_BTF=y 51 50 CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y 52 51 CONFIG_DEBUG_MEMORY_INIT=y
+34
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
··· 524 524 test_sockmap_pass_prog__destroy(pass); 525 525 } 526 526 527 + static void test_sockmap_unconnected_unix(void) 528 + { 529 + int err, map, stream = 0, dgram = 0, zero = 0; 530 + struct test_sockmap_pass_prog *skel; 531 + 532 + skel = test_sockmap_pass_prog__open_and_load(); 533 + if (!ASSERT_OK_PTR(skel, "open_and_load")) 534 + return; 535 + 536 + map = bpf_map__fd(skel->maps.sock_map_rx); 537 + 538 + stream = xsocket(AF_UNIX, SOCK_STREAM, 0); 539 + if (stream < 0) 540 + return; 541 + 542 + dgram = xsocket(AF_UNIX, SOCK_DGRAM, 0); 543 + if (dgram < 0) { 544 + close(stream); 545 + return; 546 + } 547 + 548 + err = bpf_map_update_elem(map, &zero, &stream, BPF_ANY); 549 + ASSERT_ERR(err, "bpf_map_update_elem(stream)"); 550 + 551 + err = bpf_map_update_elem(map, &zero, &dgram, BPF_ANY); 552 + ASSERT_OK(err, "bpf_map_update_elem(dgram)"); 553 + 554 + close(stream); 555 + close(dgram); 556 + } 557 + 527 558 void test_sockmap_basic(void) 528 559 { 529 560 if (test__start_subtest("sockmap create_update_free")) ··· 597 566 test_sockmap_skb_verdict_fionread(false); 598 567 if (test__start_subtest("sockmap skb_verdict msg_f_peek")) 599 568 test_sockmap_skb_verdict_peek(); 569 + 570 + if (test__start_subtest("sockmap unconnected af_unix")) 571 + test_sockmap_unconnected_unix(); 600 572 }
-1
tools/testing/selftests/hid/config.common
··· 46 46 CONFIG_CRYPTO_XXHASH=y 47 47 CONFIG_DCB=y 48 48 CONFIG_DEBUG_ATOMIC_SLEEP=y 49 - CONFIG_DEBUG_CREDENTIALS=y 50 49 CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y 51 50 CONFIG_DEBUG_MEMORY_INIT=y 52 51 CONFIG_DEFAULT_FQ_CODEL=y
+3 -37
tools/testing/selftests/lib.mk
··· 44 44 selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST)))) 45 45 top_srcdir = $(selfdir)/../../.. 46 46 47 - ifeq ("$(origin O)", "command line") 48 - KBUILD_OUTPUT := $(O) 47 + ifeq ($(KHDR_INCLUDES),) 48 + KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include 49 49 endif 50 - 51 - ifneq ($(KBUILD_OUTPUT),) 52 - # Make's built-in functions such as $(abspath ...), $(realpath ...) cannot 53 - # expand a shell special character '~'. We use a somewhat tedious way here. 54 - abs_objtree := $(shell cd $(top_srcdir) && mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) && pwd) 55 - $(if $(abs_objtree),, \ 56 - $(error failed to create output directory "$(KBUILD_OUTPUT)")) 57 - # $(realpath ...) resolves symlinks 58 - abs_objtree := $(realpath $(abs_objtree)) 59 - KHDR_DIR := ${abs_objtree}/usr/include 60 - else 61 - abs_srctree := $(shell cd $(top_srcdir) && pwd) 62 - KHDR_DIR := ${abs_srctree}/usr/include 63 - endif 64 - 65 - KHDR_INCLUDES := -isystem $(KHDR_DIR) 66 50 67 51 # The following are built by lib.mk common compile rules. 68 52 # TEST_CUSTOM_PROGS should be used by tests that require ··· 58 74 TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) 59 75 TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) 60 76 61 - all: kernel_header_files $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) \ 62 - $(TEST_GEN_FILES) 63 - 64 - kernel_header_files: 65 - @ls $(KHDR_DIR)/linux/*.h >/dev/null 2>/dev/null; \ 66 - if [ $$? -ne 0 ]; then \ 67 - RED='\033[1;31m'; \ 68 - NOCOLOR='\033[0m'; \ 69 - echo; \ 70 - echo -e "$${RED}error$${NOCOLOR}: missing kernel header files."; \ 71 - echo "Please run this and try again:"; \ 72 - echo; \ 73 - echo " cd $(top_srcdir)"; \ 74 - echo " make headers"; \ 75 - echo; \ 76 - exit 1; \ 77 - fi 78 - 79 - .PHONY: kernel_header_files 77 + all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) 80 78 81 79 define RUN_TESTS 82 80 BASE_DIR="$(selfdir)"; \
+2 -1
tools/testing/selftests/mm/cow.c
··· 1680 1680 { 1681 1681 int err; 1682 1682 1683 + ksft_print_header(); 1684 + 1683 1685 pagesize = getpagesize(); 1684 1686 thpsize = read_pmd_pagesize(); 1685 1687 if (thpsize) ··· 1691 1689 ARRAY_SIZE(hugetlbsizes)); 1692 1690 detect_huge_zeropage(); 1693 1691 1694 - ksft_print_header(); 1695 1692 ksft_set_plan(ARRAY_SIZE(anon_test_cases) * tests_per_anon_test_case() + 1696 1693 ARRAY_SIZE(anon_thp_test_cases) * tests_per_anon_thp_test_case() + 1697 1694 ARRAY_SIZE(non_anon_test_cases) * tests_per_non_anon_test_case());
+1
tools/testing/selftests/net/Makefile
··· 92 92 TEST_PROGS += test_bridge_backup_port.sh 93 93 TEST_PROGS += fdb_flush.sh 94 94 TEST_PROGS += fq_band_pktlimit.sh 95 + TEST_PROGS += vlan_hw_filter.sh 95 96 96 97 TEST_FILES := settings 97 98
+4 -4
tools/testing/selftests/net/mptcp/mptcp_join.sh
··· 2756 2756 fi 2757 2757 2758 2758 if reset "mpc backup" && 2759 - continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then 2759 + continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then 2760 2760 pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup 2761 2761 speed=slow \ 2762 2762 run_tests $ns1 $ns2 10.0.1.1 ··· 2765 2765 fi 2766 2766 2767 2767 if reset "mpc backup both sides" && 2768 - continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then 2768 + continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then 2769 2769 pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow,backup 2770 2770 pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup 2771 2771 speed=slow \ ··· 2775 2775 fi 2776 2776 2777 2777 if reset "mpc switch to backup" && 2778 - continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then 2778 + continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then 2779 2779 pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow 2780 2780 sflags=backup speed=slow \ 2781 2781 run_tests $ns1 $ns2 10.0.1.1 ··· 2784 2784 fi 2785 2785 2786 2786 if reset "mpc switch to backup both sides" && 2787 - continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then 2787 + continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then 2788 2788 pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow 2789 2789 pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow 2790 2790 sflags=backup speed=slow \
+1 -1
tools/testing/selftests/net/rtnetlink.sh
··· 297 297 done 298 298 299 299 sleep 5 300 - run_cmd_grep "10.23.11." ip addr show dev "$devdummy" 300 + run_cmd_grep_fail "10.23.11." ip addr show dev "$devdummy" 301 301 if [ $? -eq 0 ]; then 302 302 check_err 1 303 303 end_test "FAIL: preferred_lft addresses remaining"
+29
tools/testing/selftests/net/vlan_hw_filter.sh
··· 1 + #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + readonly NETNS="ns-$(mktemp -u XXXXXX)" 5 + 6 + ret=0 7 + 8 + cleanup() { 9 + ip netns del $NETNS 10 + } 11 + 12 + trap cleanup EXIT 13 + 14 + fail() { 15 + echo "ERROR: ${1:-unexpected return code} (ret: $_)" >&2 16 + ret=1 17 + } 18 + 19 + ip netns add ${NETNS} 20 + ip netns exec ${NETNS} ip link add bond0 type bond mode 0 21 + ip netns exec ${NETNS} ip link add bond_slave_1 type veth peer veth2 22 + ip netns exec ${NETNS} ip link set bond_slave_1 master bond0 23 + ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter off 24 + ip netns exec ${NETNS} ip link add link bond_slave_1 name bond_slave_1.0 type vlan id 0 25 + ip netns exec ${NETNS} ip link add link bond0 name bond0.0 type vlan id 0 26 + ip netns exec ${NETNS} ip link set bond_slave_1 nomaster 27 + ip netns exec ${NETNS} ip link del veth2 || fail "Please check vlan HW filter function" 28 + 29 + exit $ret