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

nfsd: merge stable fix into main nfsd branch

+1692 -1239
+1 -2
MAINTAINERS
··· 10195 10195 QUALCOMM ATHEROS ATH9K WIRELESS DRIVER 10196 10196 M: QCA ath9k Development <ath9k-devel@qca.qualcomm.com> 10197 10197 L: linux-wireless@vger.kernel.org 10198 - L: ath9k-devel@lists.ath9k.org 10199 10198 W: http://wireless.kernel.org/en/users/Drivers/ath9k 10200 10199 S: Supported 10201 10200 F: drivers/net/wireless/ath/ath9k/ ··· 13065 13066 F: include/uapi/linux/userio.h 13066 13067 13067 13068 VIRTIO CONSOLE DRIVER 13068 - M: Amit Shah <amit.shah@redhat.com> 13069 + M: Amit Shah <amit@kernel.org> 13069 13070 L: virtualization@lists.linux-foundation.org 13070 13071 S: Maintained 13071 13072 F: drivers/char/virtio_console.c
+2 -2
Makefile
··· 1 1 VERSION = 4 2 2 PATCHLEVEL = 10 3 3 SUBLEVEL = 0 4 - EXTRAVERSION = -rc6 4 + EXTRAVERSION = -rc7 5 5 NAME = Fearless Coyote 6 6 7 7 # *DOCUMENTATION* ··· 797 797 KBUILD_ARFLAGS := $(call ar-option,D) 798 798 799 799 # check for 'asm goto' 800 - ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y) 800 + ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y) 801 801 KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO 802 802 KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO 803 803 endif
+43 -47
arch/arm64/crypto/aes-modes.S
··· 193 193 cbz w6, .Lcbcencloop 194 194 195 195 ld1 {v0.16b}, [x5] /* get iv */ 196 - enc_prepare w3, x2, x5 196 + enc_prepare w3, x2, x6 197 197 198 198 .Lcbcencloop: 199 199 ld1 {v1.16b}, [x1], #16 /* get next pt block */ 200 200 eor v0.16b, v0.16b, v1.16b /* ..and xor with iv */ 201 - encrypt_block v0, w3, x2, x5, w6 201 + encrypt_block v0, w3, x2, x6, w7 202 202 st1 {v0.16b}, [x0], #16 203 203 subs w4, w4, #1 204 204 bne .Lcbcencloop 205 + st1 {v0.16b}, [x5] /* return iv */ 205 206 ret 206 207 AES_ENDPROC(aes_cbc_encrypt) 207 208 ··· 212 211 cbz w6, .LcbcdecloopNx 213 212 214 213 ld1 {v7.16b}, [x5] /* get iv */ 215 - dec_prepare w3, x2, x5 214 + dec_prepare w3, x2, x6 216 215 217 216 .LcbcdecloopNx: 218 217 #if INTERLEAVE >= 2 ··· 249 248 .Lcbcdecloop: 250 249 ld1 {v1.16b}, [x1], #16 /* get next ct block */ 251 250 mov v0.16b, v1.16b /* ...and copy to v0 */ 252 - decrypt_block v0, w3, x2, x5, w6 251 + decrypt_block v0, w3, x2, x6, w7 253 252 eor v0.16b, v0.16b, v7.16b /* xor with iv => pt */ 254 253 mov v7.16b, v1.16b /* ct is next iv */ 255 254 st1 {v0.16b}, [x0], #16 ··· 257 256 bne .Lcbcdecloop 258 257 .Lcbcdecout: 259 258 FRAME_POP 259 + st1 {v7.16b}, [x5] /* return iv */ 260 260 ret 261 261 AES_ENDPROC(aes_cbc_decrypt) 262 262 ··· 269 267 270 268 AES_ENTRY(aes_ctr_encrypt) 271 269 FRAME_PUSH 272 - cbnz w6, .Lctrfirst /* 1st time around? */ 273 - umov x5, v4.d[1] /* keep swabbed ctr in reg */ 274 - rev x5, x5 275 - #if INTERLEAVE >= 2 276 - cmn w5, w4 /* 32 bit overflow? */ 277 - bcs .Lctrinc 278 - add x5, x5, #1 /* increment BE ctr */ 279 - b .LctrincNx 280 - #else 281 - b .Lctrinc 282 - #endif 283 - .Lctrfirst: 270 + cbz w6, .Lctrnotfirst /* 1st time around? */ 284 271 enc_prepare w3, x2, x6 285 272 ld1 {v4.16b}, [x5] 286 - umov x5, v4.d[1] /* keep swabbed ctr in reg */ 287 - rev x5, x5 273 + 274 + .Lctrnotfirst: 275 + umov x8, v4.d[1] /* keep swabbed ctr in reg */ 276 + rev x8, x8 288 277 #if INTERLEAVE >= 2 289 - cmn w5, w4 /* 32 bit overflow? */ 278 + cmn w8, w4 /* 32 bit overflow? */ 290 279 bcs .Lctrloop 291 280 .LctrloopNx: 292 281 subs w4, w4, #INTERLEAVE ··· 285 292 #if INTERLEAVE == 2 286 293 mov v0.8b, v4.8b 287 294 mov v1.8b, v4.8b 288 - rev x7, x5 289 - add x5, x5, #1 295 + rev x7, x8 296 + add x8, x8, #1 290 297 ins v0.d[1], x7 291 - rev x7, x5 292 - add x5, x5, #1 298 + rev x7, x8 299 + add x8, x8, #1 293 300 ins v1.d[1], x7 294 301 ld1 {v2.16b-v3.16b}, [x1], #32 /* get 2 input blocks */ 295 302 do_encrypt_block2x ··· 298 305 st1 {v0.16b-v1.16b}, [x0], #32 299 306 #else 300 307 ldr q8, =0x30000000200000001 /* addends 1,2,3[,0] */ 301 - dup v7.4s, w5 308 + dup v7.4s, w8 302 309 mov v0.16b, v4.16b 303 310 add v7.4s, v7.4s, v8.4s 304 311 mov v1.16b, v4.16b ··· 316 323 eor v2.16b, v7.16b, v2.16b 317 324 eor v3.16b, v5.16b, v3.16b 318 325 st1 {v0.16b-v3.16b}, [x0], #64 319 - add x5, x5, #INTERLEAVE 326 + add x8, x8, #INTERLEAVE 320 327 #endif 321 - cbz w4, .LctroutNx 322 - .LctrincNx: 323 - rev x7, x5 328 + rev x7, x8 324 329 ins v4.d[1], x7 330 + cbz w4, .Lctrout 325 331 b .LctrloopNx 326 - .LctroutNx: 327 - sub x5, x5, #1 328 - rev x7, x5 329 - ins v4.d[1], x7 330 - b .Lctrout 331 332 .Lctr1x: 332 333 adds w4, w4, #INTERLEAVE 333 334 beq .Lctrout ··· 329 342 .Lctrloop: 330 343 mov v0.16b, v4.16b 331 344 encrypt_block v0, w3, x2, x6, w7 345 + 346 + adds x8, x8, #1 /* increment BE ctr */ 347 + rev x7, x8 348 + ins v4.d[1], x7 349 + bcs .Lctrcarry /* overflow? */ 350 + 351 + .Lctrcarrydone: 332 352 subs w4, w4, #1 333 353 bmi .Lctrhalfblock /* blocks < 0 means 1/2 block */ 334 354 ld1 {v3.16b}, [x1], #16 335 355 eor v3.16b, v0.16b, v3.16b 336 356 st1 {v3.16b}, [x0], #16 337 - beq .Lctrout 338 - .Lctrinc: 339 - adds x5, x5, #1 /* increment BE ctr */ 340 - rev x7, x5 341 - ins v4.d[1], x7 342 - bcc .Lctrloop /* no overflow? */ 357 + bne .Lctrloop 358 + 359 + .Lctrout: 360 + st1 {v4.16b}, [x5] /* return next CTR value */ 361 + FRAME_POP 362 + ret 363 + 364 + .Lctrhalfblock: 365 + ld1 {v3.8b}, [x1] 366 + eor v3.8b, v0.8b, v3.8b 367 + st1 {v3.8b}, [x0] 368 + FRAME_POP 369 + ret 370 + 371 + .Lctrcarry: 343 372 umov x7, v4.d[0] /* load upper word of ctr */ 344 373 rev x7, x7 /* ... to handle the carry */ 345 374 add x7, x7, #1 346 375 rev x7, x7 347 376 ins v4.d[0], x7 348 - b .Lctrloop 349 - .Lctrhalfblock: 350 - ld1 {v3.8b}, [x1] 351 - eor v3.8b, v0.8b, v3.8b 352 - st1 {v3.8b}, [x0] 353 - .Lctrout: 354 - FRAME_POP 355 - ret 377 + b .Lctrcarrydone 356 378 AES_ENDPROC(aes_ctr_encrypt) 357 379 .ltorg 358 380
+1 -1
arch/powerpc/Kconfig
··· 164 164 select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE 165 165 select HAVE_ARCH_HARDENED_USERCOPY 166 166 select HAVE_KERNEL_GZIP 167 - select HAVE_CC_STACKPROTECTOR 168 167 169 168 config GENERIC_CSUM 170 169 def_bool CPU_LITTLE_ENDIAN ··· 483 484 bool "Build a relocatable kernel" 484 485 depends on (PPC64 && !COMPILE_TEST) || (FLATMEM && (44x || FSL_BOOKE)) 485 486 select NONSTATIC_KERNEL 487 + select MODULE_REL_CRCS if MODVERSIONS 486 488 help 487 489 This builds a kernel image that is capable of running at the 488 490 location the kernel is loaded at. For ppc32, there is no any
+2
arch/powerpc/include/asm/cpu_has_feature.h
··· 23 23 { 24 24 int i; 25 25 26 + #ifndef __clang__ /* clang can't cope with this */ 26 27 BUILD_BUG_ON(!__builtin_constant_p(feature)); 28 + #endif 27 29 28 30 #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG 29 31 if (!static_key_initialized) {
+2
arch/powerpc/include/asm/mmu.h
··· 160 160 { 161 161 int i; 162 162 163 + #ifndef __clang__ /* clang can't cope with this */ 163 164 BUILD_BUG_ON(!__builtin_constant_p(feature)); 165 + #endif 164 166 165 167 #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG 166 168 if (!static_key_initialized) {
-4
arch/powerpc/include/asm/module.h
··· 90 90 } 91 91 #endif 92 92 93 - #if defined(CONFIG_MODVERSIONS) && defined(CONFIG_PPC64) 94 - #define ARCH_RELOCATES_KCRCTAB 95 - #define reloc_start PHYSICAL_START 96 - #endif 97 93 #endif /* __KERNEL__ */ 98 94 #endif /* _ASM_POWERPC_MODULE_H */
-40
arch/powerpc/include/asm/stackprotector.h
··· 1 - /* 2 - * GCC stack protector support. 3 - * 4 - * Stack protector works by putting predefined pattern at the start of 5 - * the stack frame and verifying that it hasn't been overwritten when 6 - * returning from the function. The pattern is called stack canary 7 - * and gcc expects it to be defined by a global variable called 8 - * "__stack_chk_guard" on PPC. This unfortunately means that on SMP 9 - * we cannot have a different canary value per task. 10 - */ 11 - 12 - #ifndef _ASM_STACKPROTECTOR_H 13 - #define _ASM_STACKPROTECTOR_H 14 - 15 - #include <linux/random.h> 16 - #include <linux/version.h> 17 - #include <asm/reg.h> 18 - 19 - extern unsigned long __stack_chk_guard; 20 - 21 - /* 22 - * Initialize the stackprotector canary value. 23 - * 24 - * NOTE: this must only be called from functions that never return, 25 - * and it must always be inlined. 26 - */ 27 - static __always_inline void boot_init_stack_canary(void) 28 - { 29 - unsigned long canary; 30 - 31 - /* Try to get a semi random initial value. */ 32 - get_random_bytes(&canary, sizeof(canary)); 33 - canary ^= mftb(); 34 - canary ^= LINUX_VERSION_CODE; 35 - 36 - current->stack_canary = canary; 37 - __stack_chk_guard = current->stack_canary; 38 - } 39 - 40 - #endif /* _ASM_STACKPROTECTOR_H */
-4
arch/powerpc/kernel/Makefile
··· 19 19 CFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) 20 20 CFLAGS_prom.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) 21 21 22 - # -fstack-protector triggers protection checks in this code, 23 - # but it is being used too early to link to meaningful stack_chk logic. 24 - CFLAGS_prom_init.o += $(call cc-option, -fno-stack-protector) 25 - 26 22 ifdef CONFIG_FUNCTION_TRACER 27 23 # Do not trace early boot code 28 24 CFLAGS_REMOVE_cputable.o = -mno-sched-epilog $(CC_FLAGS_FTRACE)
-3
arch/powerpc/kernel/asm-offsets.c
··· 91 91 DEFINE(TI_livepatch_sp, offsetof(struct thread_info, livepatch_sp)); 92 92 #endif 93 93 94 - #ifdef CONFIG_CC_STACKPROTECTOR 95 - DEFINE(TSK_STACK_CANARY, offsetof(struct task_struct, stack_canary)); 96 - #endif 97 94 DEFINE(KSP, offsetof(struct thread_struct, ksp)); 98 95 DEFINE(PT_REGS, offsetof(struct thread_struct, regs)); 99 96 #ifdef CONFIG_BOOKE
+1 -1
arch/powerpc/kernel/eeh_driver.c
··· 545 545 static void *__eeh_clear_pe_frozen_state(void *data, void *flag) 546 546 { 547 547 struct eeh_pe *pe = (struct eeh_pe *)data; 548 - bool *clear_sw_state = flag; 548 + bool clear_sw_state = *(bool *)flag; 549 549 int i, rc = 1; 550 550 551 551 for (i = 0; rc && i < 3; i++)
+1 -5
arch/powerpc/kernel/entry_32.S
··· 674 674 mtspr SPRN_SPEFSCR,r0 /* restore SPEFSCR reg */ 675 675 END_FTR_SECTION_IFSET(CPU_FTR_SPE) 676 676 #endif /* CONFIG_SPE */ 677 - #if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) 678 - lwz r0,TSK_STACK_CANARY(r2) 679 - lis r4,__stack_chk_guard@ha 680 - stw r0,__stack_chk_guard@l(r4) 681 - #endif 677 + 682 678 lwz r0,_CCR(r1) 683 679 mtcrf 0xFF,r0 684 680 /* r3-r12 are destroyed -- Cort */
-8
arch/powerpc/kernel/module_64.c
··· 286 286 for (end = (void *)vers + size; vers < end; vers++) 287 287 if (vers->name[0] == '.') { 288 288 memmove(vers->name, vers->name+1, strlen(vers->name)); 289 - #ifdef ARCH_RELOCATES_KCRCTAB 290 - /* The TOC symbol has no CRC computed. To avoid CRC 291 - * check failing, we must force it to the expected 292 - * value (see CRC check in module.c). 293 - */ 294 - if (!strcmp(vers->name, "TOC.")) 295 - vers->crc = -(unsigned long)reloc_start; 296 - #endif 297 289 } 298 290 } 299 291
-6
arch/powerpc/kernel/process.c
··· 64 64 #include <linux/kprobes.h> 65 65 #include <linux/kdebug.h> 66 66 67 - #ifdef CONFIG_CC_STACKPROTECTOR 68 - #include <linux/stackprotector.h> 69 - unsigned long __stack_chk_guard __read_mostly; 70 - EXPORT_SYMBOL(__stack_chk_guard); 71 - #endif 72 - 73 67 /* Transactional Memory debug */ 74 68 #ifdef TM_DEBUG_SW 75 69 #define TM_DEBUG(x...) printk(KERN_INFO x)
+3
arch/powerpc/kernel/prom_init.c
··· 2834 2834 2835 2835 cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu); 2836 2836 2837 + if (!PHANDLE_VALID(cpu_pkg)) 2838 + return; 2839 + 2837 2840 prom_getprop(cpu_pkg, "reg", &rval, sizeof(rval)); 2838 2841 prom.cpu = be32_to_cpu(rval); 2839 2842
+2 -2
arch/powerpc/mm/pgtable-radix.c
··· 65 65 if (!pmdp) 66 66 return -ENOMEM; 67 67 if (map_page_size == PMD_SIZE) { 68 - ptep = (pte_t *)pudp; 68 + ptep = pmdp_ptep(pmdp); 69 69 goto set_the_pte; 70 70 } 71 71 ptep = pte_alloc_kernel(pmdp, ea); ··· 90 90 } 91 91 pmdp = pmd_offset(pudp, ea); 92 92 if (map_page_size == PMD_SIZE) { 93 - ptep = (pte_t *)pudp; 93 + ptep = pmdp_ptep(pmdp); 94 94 goto set_the_pte; 95 95 } 96 96 if (!pmd_present(*pmdp)) {
+4 -4
arch/sparc/include/asm/mmu_context_64.h
··· 35 35 static inline void tsb_context_switch(struct mm_struct *mm) 36 36 { 37 37 __tsb_context_switch(__pa(mm->pgd), 38 - &mm->context.tsb_block[0], 38 + &mm->context.tsb_block[MM_TSB_BASE], 39 39 #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) 40 - (mm->context.tsb_block[1].tsb ? 41 - &mm->context.tsb_block[1] : 40 + (mm->context.tsb_block[MM_TSB_HUGE].tsb ? 41 + &mm->context.tsb_block[MM_TSB_HUGE] : 42 42 NULL) 43 43 #else 44 44 NULL 45 45 #endif 46 - , __pa(&mm->context.tsb_descr[0])); 46 + , __pa(&mm->context.tsb_descr[MM_TSB_BASE])); 47 47 } 48 48 49 49 void tsb_grow(struct mm_struct *mm,
+1 -1
arch/sparc/kernel/irq_64.c
··· 1021 1021 unsigned long order = get_order(size); 1022 1022 unsigned long p; 1023 1023 1024 - p = __get_free_pages(GFP_KERNEL, order); 1024 + p = __get_free_pages(GFP_KERNEL | __GFP_ZERO, order); 1025 1025 if (!p) { 1026 1026 prom_printf("SUN4V: Error, cannot allocate queue.\n"); 1027 1027 prom_halt();
+3 -3
arch/sparc/kernel/sstate.c
··· 43 43 "Linux powering off"; 44 44 static const char rebooting_msg[32] __attribute__((aligned(32))) = 45 45 "Linux rebooting"; 46 - static const char panicing_msg[32] __attribute__((aligned(32))) = 47 - "Linux panicing"; 46 + static const char panicking_msg[32] __attribute__((aligned(32))) = 47 + "Linux panicking"; 48 48 49 49 static int sstate_reboot_call(struct notifier_block *np, unsigned long type, void *_unused) 50 50 { ··· 76 76 77 77 static int sstate_panic_event(struct notifier_block *n, unsigned long event, void *ptr) 78 78 { 79 - do_set_sstate(HV_SOFT_STATE_TRANSITION, panicing_msg); 79 + do_set_sstate(HV_SOFT_STATE_TRANSITION, panicking_msg); 80 80 81 81 return NOTIFY_DONE; 82 82 }
+73
arch/sparc/kernel/traps_64.c
··· 2051 2051 atomic_inc(&sun4v_resum_oflow_cnt); 2052 2052 } 2053 2053 2054 + /* Given a set of registers, get the virtual addressi that was being accessed 2055 + * by the faulting instructions at tpc. 2056 + */ 2057 + static unsigned long sun4v_get_vaddr(struct pt_regs *regs) 2058 + { 2059 + unsigned int insn; 2060 + 2061 + if (!copy_from_user(&insn, (void __user *)regs->tpc, 4)) { 2062 + return compute_effective_address(regs, insn, 2063 + (insn >> 25) & 0x1f); 2064 + } 2065 + return 0; 2066 + } 2067 + 2068 + /* Attempt to handle non-resumable errors generated from userspace. 2069 + * Returns true if the signal was handled, false otherwise. 2070 + */ 2071 + bool sun4v_nonresum_error_user_handled(struct pt_regs *regs, 2072 + struct sun4v_error_entry *ent) { 2073 + 2074 + unsigned int attrs = ent->err_attrs; 2075 + 2076 + if (attrs & SUN4V_ERR_ATTRS_MEMORY) { 2077 + unsigned long addr = ent->err_raddr; 2078 + siginfo_t info; 2079 + 2080 + if (addr == ~(u64)0) { 2081 + /* This seems highly unlikely to ever occur */ 2082 + pr_emerg("SUN4V NON-RECOVERABLE ERROR: Memory error detected in unknown location!\n"); 2083 + } else { 2084 + unsigned long page_cnt = DIV_ROUND_UP(ent->err_size, 2085 + PAGE_SIZE); 2086 + 2087 + /* Break the unfortunate news. */ 2088 + pr_emerg("SUN4V NON-RECOVERABLE ERROR: Memory failed at %016lX\n", 2089 + addr); 2090 + pr_emerg("SUN4V NON-RECOVERABLE ERROR: Claiming %lu ages.\n", 2091 + page_cnt); 2092 + 2093 + while (page_cnt-- > 0) { 2094 + if (pfn_valid(addr >> PAGE_SHIFT)) 2095 + get_page(pfn_to_page(addr >> PAGE_SHIFT)); 2096 + addr += PAGE_SIZE; 2097 + } 2098 + } 2099 + info.si_signo = SIGKILL; 2100 + info.si_errno = 0; 2101 + info.si_trapno = 0; 2102 + force_sig_info(info.si_signo, &info, current); 2103 + 2104 + return true; 2105 + } 2106 + if (attrs & SUN4V_ERR_ATTRS_PIO) { 2107 + siginfo_t info; 2108 + 2109 + info.si_signo = SIGBUS; 2110 + info.si_code = BUS_ADRERR; 2111 + info.si_addr = (void __user *)sun4v_get_vaddr(regs); 2112 + force_sig_info(info.si_signo, &info, current); 2113 + 2114 + return true; 2115 + } 2116 + 2117 + /* Default to doing nothing */ 2118 + return false; 2119 + } 2120 + 2054 2121 /* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate. 2055 2122 * Log the event, clear the first word of the entry, and die. 2056 2123 */ ··· 2141 2074 wmb(); 2142 2075 2143 2076 put_cpu(); 2077 + 2078 + if (!(regs->tstate & TSTATE_PRIV) && 2079 + sun4v_nonresum_error_user_handled(regs, &local_copy)) { 2080 + /* DON'T PANIC: This userspace error was handled. */ 2081 + return; 2082 + } 2144 2083 2145 2084 #ifdef CONFIG_PCI 2146 2085 /* Check for the special PCI poke sequence. */
+26 -34
arch/x86/events/intel/rapl.c
··· 161 161 162 162 static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu) 163 163 { 164 - return rapl_pmus->pmus[topology_logical_package_id(cpu)]; 164 + unsigned int pkgid = topology_logical_package_id(cpu); 165 + 166 + /* 167 + * The unsigned check also catches the '-1' return value for non 168 + * existent mappings in the topology map. 169 + */ 170 + return pkgid < rapl_pmus->maxpkg ? rapl_pmus->pmus[pkgid] : NULL; 165 171 } 166 172 167 173 static inline u64 rapl_read_counter(struct perf_event *event) ··· 408 402 409 403 /* must be done before validate_group */ 410 404 pmu = cpu_to_rapl_pmu(event->cpu); 405 + if (!pmu) 406 + return -EINVAL; 411 407 event->cpu = pmu->cpu; 412 408 event->pmu_private = pmu; 413 409 event->hw.event_base = msr; ··· 593 585 struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); 594 586 int target; 595 587 588 + if (!pmu) { 589 + pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); 590 + if (!pmu) 591 + return -ENOMEM; 592 + 593 + raw_spin_lock_init(&pmu->lock); 594 + INIT_LIST_HEAD(&pmu->active_list); 595 + pmu->pmu = &rapl_pmus->pmu; 596 + pmu->timer_interval = ms_to_ktime(rapl_timer_ms); 597 + rapl_hrtimer_init(pmu); 598 + 599 + rapl_pmus->pmus[topology_logical_package_id(cpu)] = pmu; 600 + } 601 + 596 602 /* 597 603 * Check if there is an online cpu in the package which collects rapl 598 604 * events already. ··· 617 595 618 596 cpumask_set_cpu(cpu, &rapl_cpu_mask); 619 597 pmu->cpu = cpu; 620 - return 0; 621 - } 622 - 623 - static int rapl_cpu_prepare(unsigned int cpu) 624 - { 625 - struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); 626 - 627 - if (pmu) 628 - return 0; 629 - 630 - pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); 631 - if (!pmu) 632 - return -ENOMEM; 633 - 634 - raw_spin_lock_init(&pmu->lock); 635 - INIT_LIST_HEAD(&pmu->active_list); 636 - pmu->pmu = &rapl_pmus->pmu; 637 - pmu->timer_interval = ms_to_ktime(rapl_timer_ms); 638 - pmu->cpu = -1; 639 - rapl_hrtimer_init(pmu); 640 - rapl_pmus->pmus[topology_logical_package_id(cpu)] = pmu; 641 598 return 0; 642 599 } 643 600 ··· 804 803 /* 805 804 * Install callbacks. Core will call them for each online cpu. 806 805 */ 807 - 808 - ret = cpuhp_setup_state(CPUHP_PERF_X86_RAPL_PREP, "perf/x86/rapl:prepare", 809 - rapl_cpu_prepare, NULL); 810 - if (ret) 811 - goto out; 812 - 813 806 ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_RAPL_ONLINE, 814 807 "perf/x86/rapl:online", 815 808 rapl_cpu_online, rapl_cpu_offline); 816 809 if (ret) 817 - goto out1; 810 + goto out; 818 811 819 812 ret = perf_pmu_register(&rapl_pmus->pmu, "power", -1); 820 813 if (ret) 821 - goto out2; 814 + goto out1; 822 815 823 816 rapl_advertise(); 824 817 return 0; 825 818 826 - out2: 827 - cpuhp_remove_state(CPUHP_AP_PERF_X86_RAPL_ONLINE); 828 819 out1: 829 - cpuhp_remove_state(CPUHP_PERF_X86_RAPL_PREP); 820 + cpuhp_remove_state(CPUHP_AP_PERF_X86_RAPL_ONLINE); 830 821 out: 831 822 pr_warn("Initialization failed (%d), disabled\n", ret); 832 823 cleanup_rapl_pmus(); ··· 829 836 static void __exit intel_rapl_exit(void) 830 837 { 831 838 cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_RAPL_ONLINE); 832 - cpuhp_remove_state_nocalls(CPUHP_PERF_X86_RAPL_PREP); 833 839 perf_pmu_unregister(&rapl_pmus->pmu); 834 840 cleanup_rapl_pmus(); 835 841 }
+91 -141
arch/x86/events/intel/uncore.c
··· 100 100 101 101 struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu) 102 102 { 103 - return pmu->boxes[topology_logical_package_id(cpu)]; 103 + unsigned int pkgid = topology_logical_package_id(cpu); 104 + 105 + /* 106 + * The unsigned check also catches the '-1' return value for non 107 + * existent mappings in the topology map. 108 + */ 109 + return pkgid < max_packages ? pmu->boxes[pkgid] : NULL; 104 110 } 105 111 106 112 u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event) ··· 770 764 pmu->registered = false; 771 765 } 772 766 773 - static void __uncore_exit_boxes(struct intel_uncore_type *type, int cpu) 774 - { 775 - struct intel_uncore_pmu *pmu = type->pmus; 776 - struct intel_uncore_box *box; 777 - int i, pkg; 778 - 779 - if (pmu) { 780 - pkg = topology_physical_package_id(cpu); 781 - for (i = 0; i < type->num_boxes; i++, pmu++) { 782 - box = pmu->boxes[pkg]; 783 - if (box) 784 - uncore_box_exit(box); 785 - } 786 - } 787 - } 788 - 789 - static void uncore_exit_boxes(void *dummy) 790 - { 791 - struct intel_uncore_type **types; 792 - 793 - for (types = uncore_msr_uncores; *types; types++) 794 - __uncore_exit_boxes(*types++, smp_processor_id()); 795 - } 796 - 797 767 static void uncore_free_boxes(struct intel_uncore_pmu *pmu) 798 768 { 799 769 int pkg; ··· 1040 1058 } 1041 1059 } 1042 1060 1043 - static int uncore_cpu_dying(unsigned int cpu) 1044 - { 1045 - struct intel_uncore_type *type, **types = uncore_msr_uncores; 1046 - struct intel_uncore_pmu *pmu; 1047 - struct intel_uncore_box *box; 1048 - int i, pkg; 1049 - 1050 - pkg = topology_logical_package_id(cpu); 1051 - for (; *types; types++) { 1052 - type = *types; 1053 - pmu = type->pmus; 1054 - for (i = 0; i < type->num_boxes; i++, pmu++) { 1055 - box = pmu->boxes[pkg]; 1056 - if (box && atomic_dec_return(&box->refcnt) == 0) 1057 - uncore_box_exit(box); 1058 - } 1059 - } 1060 - return 0; 1061 - } 1062 - 1063 - static int first_init; 1064 - 1065 - static int uncore_cpu_starting(unsigned int cpu) 1066 - { 1067 - struct intel_uncore_type *type, **types = uncore_msr_uncores; 1068 - struct intel_uncore_pmu *pmu; 1069 - struct intel_uncore_box *box; 1070 - int i, pkg, ncpus = 1; 1071 - 1072 - if (first_init) { 1073 - /* 1074 - * On init we get the number of online cpus in the package 1075 - * and set refcount for all of them. 1076 - */ 1077 - ncpus = cpumask_weight(topology_core_cpumask(cpu)); 1078 - } 1079 - 1080 - pkg = topology_logical_package_id(cpu); 1081 - for (; *types; types++) { 1082 - type = *types; 1083 - pmu = type->pmus; 1084 - for (i = 0; i < type->num_boxes; i++, pmu++) { 1085 - box = pmu->boxes[pkg]; 1086 - if (!box) 1087 - continue; 1088 - /* The first cpu on a package activates the box */ 1089 - if (atomic_add_return(ncpus, &box->refcnt) == ncpus) 1090 - uncore_box_init(box); 1091 - } 1092 - } 1093 - 1094 - return 0; 1095 - } 1096 - 1097 - static int uncore_cpu_prepare(unsigned int cpu) 1098 - { 1099 - struct intel_uncore_type *type, **types = uncore_msr_uncores; 1100 - struct intel_uncore_pmu *pmu; 1101 - struct intel_uncore_box *box; 1102 - int i, pkg; 1103 - 1104 - pkg = topology_logical_package_id(cpu); 1105 - for (; *types; types++) { 1106 - type = *types; 1107 - pmu = type->pmus; 1108 - for (i = 0; i < type->num_boxes; i++, pmu++) { 1109 - if (pmu->boxes[pkg]) 1110 - continue; 1111 - /* First cpu of a package allocates the box */ 1112 - box = uncore_alloc_box(type, cpu_to_node(cpu)); 1113 - if (!box) 1114 - return -ENOMEM; 1115 - box->pmu = pmu; 1116 - box->pkgid = pkg; 1117 - pmu->boxes[pkg] = box; 1118 - } 1119 - } 1120 - return 0; 1121 - } 1122 - 1123 1061 static void uncore_change_type_ctx(struct intel_uncore_type *type, int old_cpu, 1124 1062 int new_cpu) 1125 1063 { ··· 1079 1177 1080 1178 static int uncore_event_cpu_offline(unsigned int cpu) 1081 1179 { 1082 - int target; 1180 + struct intel_uncore_type *type, **types = uncore_msr_uncores; 1181 + struct intel_uncore_pmu *pmu; 1182 + struct intel_uncore_box *box; 1183 + int i, pkg, target; 1083 1184 1084 1185 /* Check if exiting cpu is used for collecting uncore events */ 1085 1186 if (!cpumask_test_and_clear_cpu(cpu, &uncore_cpu_mask)) 1086 - return 0; 1087 - 1187 + goto unref; 1088 1188 /* Find a new cpu to collect uncore events */ 1089 1189 target = cpumask_any_but(topology_core_cpumask(cpu), cpu); 1090 1190 ··· 1098 1194 1099 1195 uncore_change_context(uncore_msr_uncores, cpu, target); 1100 1196 uncore_change_context(uncore_pci_uncores, cpu, target); 1197 + 1198 + unref: 1199 + /* Clear the references */ 1200 + pkg = topology_logical_package_id(cpu); 1201 + for (; *types; types++) { 1202 + type = *types; 1203 + pmu = type->pmus; 1204 + for (i = 0; i < type->num_boxes; i++, pmu++) { 1205 + box = pmu->boxes[pkg]; 1206 + if (box && atomic_dec_return(&box->refcnt) == 0) 1207 + uncore_box_exit(box); 1208 + } 1209 + } 1101 1210 return 0; 1211 + } 1212 + 1213 + static int allocate_boxes(struct intel_uncore_type **types, 1214 + unsigned int pkg, unsigned int cpu) 1215 + { 1216 + struct intel_uncore_box *box, *tmp; 1217 + struct intel_uncore_type *type; 1218 + struct intel_uncore_pmu *pmu; 1219 + LIST_HEAD(allocated); 1220 + int i; 1221 + 1222 + /* Try to allocate all required boxes */ 1223 + for (; *types; types++) { 1224 + type = *types; 1225 + pmu = type->pmus; 1226 + for (i = 0; i < type->num_boxes; i++, pmu++) { 1227 + if (pmu->boxes[pkg]) 1228 + continue; 1229 + box = uncore_alloc_box(type, cpu_to_node(cpu)); 1230 + if (!box) 1231 + goto cleanup; 1232 + box->pmu = pmu; 1233 + box->pkgid = pkg; 1234 + list_add(&box->active_list, &allocated); 1235 + } 1236 + } 1237 + /* Install them in the pmus */ 1238 + list_for_each_entry_safe(box, tmp, &allocated, active_list) { 1239 + list_del_init(&box->active_list); 1240 + box->pmu->boxes[pkg] = box; 1241 + } 1242 + return 0; 1243 + 1244 + cleanup: 1245 + list_for_each_entry_safe(box, tmp, &allocated, active_list) { 1246 + list_del_init(&box->active_list); 1247 + kfree(box); 1248 + } 1249 + return -ENOMEM; 1102 1250 } 1103 1251 1104 1252 static int uncore_event_cpu_online(unsigned int cpu) 1105 1253 { 1106 - int target; 1254 + struct intel_uncore_type *type, **types = uncore_msr_uncores; 1255 + struct intel_uncore_pmu *pmu; 1256 + struct intel_uncore_box *box; 1257 + int i, ret, pkg, target; 1258 + 1259 + pkg = topology_logical_package_id(cpu); 1260 + ret = allocate_boxes(types, pkg, cpu); 1261 + if (ret) 1262 + return ret; 1263 + 1264 + for (; *types; types++) { 1265 + type = *types; 1266 + pmu = type->pmus; 1267 + for (i = 0; i < type->num_boxes; i++, pmu++) { 1268 + box = pmu->boxes[pkg]; 1269 + if (!box && atomic_inc_return(&box->refcnt) == 1) 1270 + uncore_box_init(box); 1271 + } 1272 + } 1107 1273 1108 1274 /* 1109 1275 * Check if there is an online cpu in the package ··· 1363 1389 if (cret && pret) 1364 1390 return -ENODEV; 1365 1391 1366 - /* 1367 - * Install callbacks. Core will call them for each online cpu. 1368 - * 1369 - * The first online cpu of each package allocates and takes 1370 - * the refcounts for all other online cpus in that package. 1371 - * If msrs are not enabled no allocation is required and 1372 - * uncore_cpu_prepare() is not called for each online cpu. 1373 - */ 1374 - if (!cret) { 1375 - ret = cpuhp_setup_state(CPUHP_PERF_X86_UNCORE_PREP, 1376 - "perf/x86/intel/uncore:prepare", 1377 - uncore_cpu_prepare, NULL); 1378 - if (ret) 1379 - goto err; 1380 - } else { 1381 - cpuhp_setup_state_nocalls(CPUHP_PERF_X86_UNCORE_PREP, 1382 - "perf/x86/intel/uncore:prepare", 1383 - uncore_cpu_prepare, NULL); 1384 - } 1385 - first_init = 1; 1386 - cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_STARTING, 1387 - "perf/x86/uncore:starting", 1388 - uncore_cpu_starting, uncore_cpu_dying); 1389 - first_init = 0; 1390 - cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE, 1391 - "perf/x86/uncore:online", 1392 - uncore_event_cpu_online, uncore_event_cpu_offline); 1392 + /* Install hotplug callbacks to setup the targets for each package */ 1393 + ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE, 1394 + "perf/x86/intel/uncore:online", 1395 + uncore_event_cpu_online, 1396 + uncore_event_cpu_offline); 1397 + if (ret) 1398 + goto err; 1393 1399 return 0; 1394 1400 1395 1401 err: 1396 - /* Undo box->init_box() */ 1397 - on_each_cpu_mask(&uncore_cpu_mask, uncore_exit_boxes, NULL, 1); 1398 1402 uncore_types_exit(uncore_msr_uncores); 1399 1403 uncore_pci_exit(); 1400 1404 return ret; ··· 1381 1429 1382 1430 static void __exit intel_uncore_exit(void) 1383 1431 { 1384 - cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_UNCORE_ONLINE); 1385 - cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_UNCORE_STARTING); 1386 - cpuhp_remove_state_nocalls(CPUHP_PERF_X86_UNCORE_PREP); 1432 + cpuhp_remove_state(CPUHP_AP_PERF_X86_UNCORE_ONLINE); 1387 1433 uncore_types_exit(uncore_msr_uncores); 1388 1434 uncore_pci_exit(); 1389 1435 }
+1
arch/x86/include/asm/microcode.h
··· 140 140 extern void load_ucode_ap(void); 141 141 void reload_early_microcode(void); 142 142 extern bool get_builtin_firmware(struct cpio_data *cd, const char *name); 143 + extern bool initrd_gone; 143 144 #else 144 145 static inline int __init microcode_init(void) { return 0; }; 145 146 static inline void __init load_ucode_bsp(void) { }
+2
arch/x86/kernel/apic/io_apic.c
··· 2117 2117 if (idx != -1 && irq_trigger(idx)) 2118 2118 unmask_ioapic_irq(irq_get_chip_data(0)); 2119 2119 } 2120 + irq_domain_deactivate_irq(irq_data); 2120 2121 irq_domain_activate_irq(irq_data); 2121 2122 if (timer_irq_works()) { 2122 2123 if (disable_timer_pin_1 > 0) ··· 2139 2138 * legacy devices should be connected to IO APIC #0 2140 2139 */ 2141 2140 replace_pin_at_irq_node(data, node, apic1, pin1, apic2, pin2); 2141 + irq_domain_deactivate_irq(irq_data); 2142 2142 irq_domain_activate_irq(irq_data); 2143 2143 legacy_pic->unmask(0); 2144 2144 if (timer_irq_works()) {
+12 -19
arch/x86/kernel/cpu/mcheck/mce.c
··· 1373 1373 1374 1374 static unsigned long (*mce_adjust_timer)(unsigned long interval) = mce_adjust_timer_default; 1375 1375 1376 - static void __restart_timer(struct timer_list *t, unsigned long interval) 1376 + static void __start_timer(struct timer_list *t, unsigned long interval) 1377 1377 { 1378 1378 unsigned long when = jiffies + interval; 1379 1379 unsigned long flags; 1380 1380 1381 1381 local_irq_save(flags); 1382 1382 1383 - if (timer_pending(t)) { 1384 - if (time_before(when, t->expires)) 1385 - mod_timer(t, when); 1386 - } else { 1387 - t->expires = round_jiffies(when); 1388 - add_timer_on(t, smp_processor_id()); 1389 - } 1383 + if (!timer_pending(t) || time_before(when, t->expires)) 1384 + mod_timer(t, round_jiffies(when)); 1390 1385 1391 1386 local_irq_restore(flags); 1392 1387 } ··· 1416 1421 1417 1422 done: 1418 1423 __this_cpu_write(mce_next_interval, iv); 1419 - __restart_timer(t, iv); 1424 + __start_timer(t, iv); 1420 1425 } 1421 1426 1422 1427 /* ··· 1427 1432 struct timer_list *t = this_cpu_ptr(&mce_timer); 1428 1433 unsigned long iv = __this_cpu_read(mce_next_interval); 1429 1434 1430 - __restart_timer(t, interval); 1435 + __start_timer(t, interval); 1431 1436 1432 1437 if (interval < iv) 1433 1438 __this_cpu_write(mce_next_interval, interval); ··· 1774 1779 } 1775 1780 } 1776 1781 1777 - static void mce_start_timer(unsigned int cpu, struct timer_list *t) 1782 + static void mce_start_timer(struct timer_list *t) 1778 1783 { 1779 1784 unsigned long iv = check_interval * HZ; 1780 1785 1781 1786 if (mca_cfg.ignore_ce || !iv) 1782 1787 return; 1783 1788 1784 - per_cpu(mce_next_interval, cpu) = iv; 1785 - 1786 - t->expires = round_jiffies(jiffies + iv); 1787 - add_timer_on(t, cpu); 1789 + this_cpu_write(mce_next_interval, iv); 1790 + __start_timer(t, iv); 1788 1791 } 1789 1792 1790 1793 static void __mcheck_cpu_setup_timer(void) ··· 1799 1806 unsigned int cpu = smp_processor_id(); 1800 1807 1801 1808 setup_pinned_timer(t, mce_timer_fn, cpu); 1802 - mce_start_timer(cpu, t); 1809 + mce_start_timer(t); 1803 1810 } 1804 1811 1805 1812 /* Handle unconfigured int18 (should never happen) */ ··· 2559 2566 2560 2567 static int mce_cpu_online(unsigned int cpu) 2561 2568 { 2562 - struct timer_list *t = &per_cpu(mce_timer, cpu); 2569 + struct timer_list *t = this_cpu_ptr(&mce_timer); 2563 2570 int ret; 2564 2571 2565 2572 mce_device_create(cpu); ··· 2570 2577 return ret; 2571 2578 } 2572 2579 mce_reenable_cpu(); 2573 - mce_start_timer(cpu, t); 2580 + mce_start_timer(t); 2574 2581 return 0; 2575 2582 } 2576 2583 2577 2584 static int mce_cpu_pre_down(unsigned int cpu) 2578 2585 { 2579 - struct timer_list *t = &per_cpu(mce_timer, cpu); 2586 + struct timer_list *t = this_cpu_ptr(&mce_timer); 2580 2587 2581 2588 mce_disable_cpu(); 2582 2589 del_timer_sync(t);
+3 -2
arch/x86/kernel/cpu/microcode/amd.c
··· 384 384 reget: 385 385 if (!get_builtin_microcode(&cp, family)) { 386 386 #ifdef CONFIG_BLK_DEV_INITRD 387 - cp = find_cpio_data(ucode_path, (void *)initrd_start, 388 - initrd_end - initrd_start, NULL); 387 + if (!initrd_gone) 388 + cp = find_cpio_data(ucode_path, (void *)initrd_start, 389 + initrd_end - initrd_start, NULL); 389 390 #endif 390 391 if (!(cp.data && cp.size)) { 391 392 /*
+17 -5
arch/x86/kernel/cpu/microcode/core.c
··· 46 46 static struct microcode_ops *microcode_ops; 47 47 static bool dis_ucode_ldr = true; 48 48 49 + bool initrd_gone; 50 + 49 51 LIST_HEAD(microcode_cache); 50 52 51 53 /* ··· 192 190 static int __init save_microcode_in_initrd(void) 193 191 { 194 192 struct cpuinfo_x86 *c = &boot_cpu_data; 193 + int ret = -EINVAL; 195 194 196 195 switch (c->x86_vendor) { 197 196 case X86_VENDOR_INTEL: 198 197 if (c->x86 >= 6) 199 - return save_microcode_in_initrd_intel(); 198 + ret = save_microcode_in_initrd_intel(); 200 199 break; 201 200 case X86_VENDOR_AMD: 202 201 if (c->x86 >= 0x10) 203 - return save_microcode_in_initrd_amd(c->x86); 202 + ret = save_microcode_in_initrd_amd(c->x86); 204 203 break; 205 204 default: 206 205 break; 207 206 } 208 207 209 - return -EINVAL; 208 + initrd_gone = true; 209 + 210 + return ret; 210 211 } 211 212 212 213 struct cpio_data find_microcode_in_initrd(const char *path, bool use_pa) ··· 252 247 * has the virtual address of the beginning of the initrd. It also 253 248 * possibly relocates the ramdisk. In either case, initrd_start contains 254 249 * the updated address so use that instead. 250 + * 251 + * initrd_gone is for the hotplug case where we've thrown out initrd 252 + * already. 255 253 */ 256 - if (!use_pa && initrd_start) 257 - start = initrd_start; 254 + if (!use_pa) { 255 + if (initrd_gone) 256 + return (struct cpio_data){ NULL, 0, "" }; 257 + if (initrd_start) 258 + start = initrd_start; 259 + } 258 260 259 261 return find_cpio_data(path, (void *)start, size, NULL); 260 262 #else /* !CONFIG_BLK_DEV_INITRD */
+1 -8
arch/x86/kernel/cpu/microcode/intel.c
··· 41 41 42 42 static const char ucode_path[] = "kernel/x86/microcode/GenuineIntel.bin"; 43 43 44 - /* Current microcode patch used in early patching */ 44 + /* Current microcode patch used in early patching on the APs. */ 45 45 struct microcode_intel *intel_ucode_patch; 46 46 47 47 static inline bool cpu_signatures_match(unsigned int s1, unsigned int p1, ··· 607 607 struct ucode_cpu_info uci; 608 608 struct cpio_data cp; 609 609 610 - /* 611 - * AP loading didn't find any microcode patch, no need to save anything. 612 - */ 613 - if (!intel_ucode_patch || IS_ERR(intel_ucode_patch)) 614 - return 0; 615 - 616 610 if (!load_builtin_intel_microcode(&cp)) 617 611 cp = find_microcode_in_initrd(ucode_path, false); 618 612 ··· 621 627 622 628 return 0; 623 629 } 624 - 625 630 626 631 /* 627 632 * @res_patch, output: a pointer to the patch we found.
+3 -1
arch/x86/kernel/fpu/core.c
··· 9 9 #include <asm/fpu/regset.h> 10 10 #include <asm/fpu/signal.h> 11 11 #include <asm/fpu/types.h> 12 + #include <asm/fpu/xstate.h> 12 13 #include <asm/traps.h> 13 14 14 15 #include <linux/hardirq.h> ··· 184 183 * it will #GP. Make sure it is replaced after the memset(). 185 184 */ 186 185 if (static_cpu_has(X86_FEATURE_XSAVES)) 187 - state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT; 186 + state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT | 187 + xfeatures_mask; 188 188 189 189 if (static_cpu_has(X86_FEATURE_FXSR)) 190 190 fpstate_init_fxstate(&state->fxsave);
+1
arch/x86/kernel/hpet.c
··· 352 352 } else { 353 353 struct hpet_dev *hdev = EVT_TO_HPET_DEV(evt); 354 354 355 + irq_domain_deactivate_irq(irq_get_irq_data(hdev->irq)); 355 356 irq_domain_activate_irq(irq_get_irq_data(hdev->irq)); 356 357 disable_irq(hdev->irq); 357 358 irq_set_affinity(hdev->irq, cpumask_of(hdev->cpu));
+1
arch/x86/kvm/x86.c
··· 3182 3182 memcpy(dest, xsave, XSAVE_HDR_OFFSET); 3183 3183 3184 3184 /* Set XSTATE_BV */ 3185 + xstate_bv &= vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FPSSE; 3185 3186 *(u64 *)(dest + XSAVE_HDR_OFFSET) = xstate_bv; 3186 3187 3187 3188 /*
+16
arch/x86/platform/efi/efi_64.c
··· 269 269 efi_scratch.use_pgd = true; 270 270 271 271 /* 272 + * Certain firmware versions are way too sentimential and still believe 273 + * they are exclusive and unquestionable owners of the first physical page, 274 + * even though they explicitly mark it as EFI_CONVENTIONAL_MEMORY 275 + * (but then write-access it later during SetVirtualAddressMap()). 276 + * 277 + * Create a 1:1 mapping for this page, to avoid triple faults during early 278 + * boot with such firmware. We are free to hand this page to the BIOS, 279 + * as trim_bios_range() will reserve the first page and isolate it away 280 + * from memory allocators anyway. 281 + */ 282 + if (kernel_map_pages_in_pgd(pgd, 0x0, 0x0, 1, _PAGE_RW)) { 283 + pr_err("Failed to create 1:1 mapping for the first page!\n"); 284 + return 1; 285 + } 286 + 287 + /* 272 288 * When making calls to the firmware everything needs to be 1:1 273 289 * mapped and addressable with 32-bit pointers. Map the kernel 274 290 * text and allocate a new stack because we can't rely on the
+1 -1
arch/xtensa/kernel/setup.c
··· 419 419 420 420 void cpu_reset(void) 421 421 { 422 - #if XCHAL_HAVE_PTP_MMU 422 + #if XCHAL_HAVE_PTP_MMU && IS_ENABLED(CONFIG_MMU) 423 423 local_irq_disable(); 424 424 /* 425 425 * We have full MMU: all autoload ways, ways 7, 8 and 9 of DTLB must
+1
crypto/algapi.c
··· 356 356 struct crypto_larval *larval; 357 357 int err; 358 358 359 + alg->cra_flags &= ~CRYPTO_ALG_DEAD; 359 360 err = crypto_check_alg(alg); 360 361 if (err) 361 362 return err;
+4 -2
drivers/ata/libata-core.c
··· 1702 1702 1703 1703 if (qc->err_mask & ~AC_ERR_OTHER) 1704 1704 qc->err_mask &= ~AC_ERR_OTHER; 1705 + } else if (qc->tf.command == ATA_CMD_REQ_SENSE_DATA) { 1706 + qc->result_tf.command |= ATA_SENSE; 1705 1707 } 1706 1708 1707 1709 /* finish up */ ··· 4358 4356 { "ST380013AS", "3.20", ATA_HORKAGE_MAX_SEC_1024 }, 4359 4357 4360 4358 /* 4361 - * Device times out with higher max sects. 4359 + * These devices time out with higher max sects. 4362 4360 * https://bugzilla.kernel.org/show_bug.cgi?id=121671 4363 4361 */ 4364 - { "LITEON CX1-JB256-HP", NULL, ATA_HORKAGE_MAX_SEC_1024 }, 4362 + { "LITEON CX1-JB*-HP", NULL, ATA_HORKAGE_MAX_SEC_1024 }, 4365 4363 4366 4364 /* Devices we expect to fail diagnostics */ 4367 4365
+3
drivers/ata/sata_mv.c
··· 4132 4132 host->iomap = NULL; 4133 4133 hpriv->base = devm_ioremap(&pdev->dev, res->start, 4134 4134 resource_size(res)); 4135 + if (!hpriv->base) 4136 + return -ENOMEM; 4137 + 4135 4138 hpriv->base -= SATAHC0_REG_BASE; 4136 4139 4137 4140 hpriv->clk = clk_get(&pdev->dev, NULL);
+1 -4
drivers/base/firmware_class.c
··· 558 558 struct firmware_buf *buf = fw_priv->buf; 559 559 560 560 __fw_load_abort(buf); 561 - 562 - /* avoid user action after loading abort */ 563 - fw_priv->buf = NULL; 564 561 } 565 562 566 563 static LIST_HEAD(pending_fw_head); ··· 710 713 711 714 mutex_lock(&fw_lock); 712 715 fw_buf = fw_priv->buf; 713 - if (!fw_buf) 716 + if (fw_state_is_aborted(&fw_buf->fw_st)) 714 717 goto out; 715 718 716 719 switch (loading) {
+6 -6
drivers/base/memory.c
··· 389 389 { 390 390 struct memory_block *mem = to_memory_block(dev); 391 391 unsigned long start_pfn, end_pfn; 392 + unsigned long valid_start, valid_end, valid_pages; 392 393 unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block; 393 - struct page *first_page; 394 394 struct zone *zone; 395 395 int zone_shift = 0; 396 396 397 397 start_pfn = section_nr_to_pfn(mem->start_section_nr); 398 398 end_pfn = start_pfn + nr_pages; 399 - first_page = pfn_to_page(start_pfn); 400 399 401 400 /* The block contains more than one zone can not be offlined. */ 402 - if (!test_pages_in_a_zone(start_pfn, end_pfn)) 401 + if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start, &valid_end)) 403 402 return sprintf(buf, "none\n"); 404 403 405 - zone = page_zone(first_page); 404 + zone = page_zone(pfn_to_page(valid_start)); 405 + valid_pages = valid_end - valid_start; 406 406 407 407 /* MMOP_ONLINE_KEEP */ 408 408 sprintf(buf, "%s", zone->name); 409 409 410 410 /* MMOP_ONLINE_KERNEL */ 411 - zone_can_shift(start_pfn, nr_pages, ZONE_NORMAL, &zone_shift); 411 + zone_can_shift(valid_start, valid_pages, ZONE_NORMAL, &zone_shift); 412 412 if (zone_shift) { 413 413 strcat(buf, " "); 414 414 strcat(buf, (zone + zone_shift)->name); 415 415 } 416 416 417 417 /* MMOP_ONLINE_MOVABLE */ 418 - zone_can_shift(start_pfn, nr_pages, ZONE_MOVABLE, &zone_shift); 418 + zone_can_shift(valid_start, valid_pages, ZONE_MOVABLE, &zone_shift); 419 419 if (zone_shift) { 420 420 strcat(buf, " "); 421 421 strcat(buf, (zone + zone_shift)->name);
+3
drivers/bcma/bcma_private.h
··· 45 45 void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc); 46 46 void bcma_core_chipcommon_init(struct bcma_drv_cc *cc); 47 47 void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); 48 + #ifdef CONFIG_BCMA_DRIVER_MIPS 49 + void bcma_chipco_serial_init(struct bcma_drv_cc *cc); 50 + #endif /* CONFIG_BCMA_DRIVER_MIPS */ 48 51 49 52 /* driver_chipcommon_b.c */ 50 53 int bcma_core_chipcommon_b_init(struct bcma_drv_cc_b *ccb);
+3 -8
drivers/bcma/driver_chipcommon.c
··· 15 15 #include <linux/platform_device.h> 16 16 #include <linux/bcma/bcma.h> 17 17 18 - static void bcma_chipco_serial_init(struct bcma_drv_cc *cc); 19 - 20 18 static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset, 21 19 u32 mask, u32 value) 22 20 { ··· 183 185 184 186 if (cc->capabilities & BCMA_CC_CAP_PMU) 185 187 bcma_pmu_early_init(cc); 186 - 187 - if (IS_BUILTIN(CONFIG_BCM47XX) && bus->hosttype == BCMA_HOSTTYPE_SOC) 188 - bcma_chipco_serial_init(cc); 189 188 190 189 if (bus->hosttype == BCMA_HOSTTYPE_SOC) 191 190 bcma_core_chipcommon_flash_detect(cc); ··· 373 378 return res; 374 379 } 375 380 376 - static void bcma_chipco_serial_init(struct bcma_drv_cc *cc) 381 + #ifdef CONFIG_BCMA_DRIVER_MIPS 382 + void bcma_chipco_serial_init(struct bcma_drv_cc *cc) 377 383 { 378 - #if IS_BUILTIN(CONFIG_BCM47XX) 379 384 unsigned int irq; 380 385 u32 baud_base; 381 386 u32 i; ··· 417 422 ports[i].baud_base = baud_base; 418 423 ports[i].reg_shift = 0; 419 424 } 420 - #endif /* CONFIG_BCM47XX */ 421 425 } 426 + #endif /* CONFIG_BCMA_DRIVER_MIPS */
+3
drivers/bcma/driver_mips.c
··· 278 278 279 279 void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) 280 280 { 281 + struct bcma_bus *bus = mcore->core->bus; 282 + 281 283 if (mcore->early_setup_done) 282 284 return; 283 285 286 + bcma_chipco_serial_init(&bus->drv_cc); 284 287 bcma_core_mips_nvram_init(mcore); 285 288 286 289 mcore->early_setup_done = true;
+46 -23
drivers/dma/cppi41.c
··· 153 153 154 154 /* context for suspend/resume */ 155 155 unsigned int dma_tdfdq; 156 + 157 + bool is_suspended; 156 158 }; 157 159 158 160 #define FIST_COMPLETION_QUEUE 93 ··· 259 257 BUG_ON(desc_num >= ALLOC_DECS_NUM); 260 258 c = cdd->chan_busy[desc_num]; 261 259 cdd->chan_busy[desc_num] = NULL; 260 + 261 + /* Usecount for chan_busy[], paired with push_desc_queue() */ 262 + pm_runtime_put(cdd->ddev.dev); 263 + 262 264 return c; 263 265 } 264 266 ··· 323 317 324 318 while (val) { 325 319 u32 desc, len; 326 - int error; 327 320 328 - error = pm_runtime_get(cdd->ddev.dev); 329 - if (error < 0) 330 - dev_err(cdd->ddev.dev, "%s pm runtime get: %i\n", 331 - __func__, error); 321 + /* 322 + * This should never trigger, see the comments in 323 + * push_desc_queue() 324 + */ 325 + WARN_ON(cdd->is_suspended); 332 326 333 327 q_num = __fls(val); 334 328 val &= ~(1 << q_num); ··· 349 343 c->residue = pd_trans_len(c->desc->pd6) - len; 350 344 dma_cookie_complete(&c->txd); 351 345 dmaengine_desc_get_callback_invoke(&c->txd, NULL); 352 - 353 - pm_runtime_mark_last_busy(cdd->ddev.dev); 354 - pm_runtime_put_autosuspend(cdd->ddev.dev); 355 346 } 356 347 } 357 348 return IRQ_HANDLED; ··· 450 447 */ 451 448 __iowmb(); 452 449 450 + /* 451 + * DMA transfers can take at least 200ms to complete with USB mass 452 + * storage connected. To prevent autosuspend timeouts, we must use 453 + * pm_runtime_get/put() when chan_busy[] is modified. This will get 454 + * cleared in desc_to_chan() or cppi41_stop_chan() depending on the 455 + * outcome of the transfer. 456 + */ 457 + pm_runtime_get(cdd->ddev.dev); 458 + 453 459 desc_phys = lower_32_bits(c->desc_phys); 454 460 desc_num = (desc_phys - cdd->descs_phys) / sizeof(struct cppi41_desc); 455 461 WARN_ON(cdd->chan_busy[desc_num]); ··· 469 457 cppi_writel(reg, cdd->qmgr_mem + QMGR_QUEUE_D(c->q_num)); 470 458 } 471 459 472 - static void pending_desc(struct cppi41_channel *c) 460 + /* 461 + * Caller must hold cdd->lock to prevent push_desc_queue() 462 + * getting called out of order. We have both cppi41_dma_issue_pending() 463 + * and cppi41_runtime_resume() call this function. 464 + */ 465 + static void cppi41_run_queue(struct cppi41_dd *cdd) 473 466 { 474 - struct cppi41_dd *cdd = c->cdd; 475 - unsigned long flags; 467 + struct cppi41_channel *c, *_c; 476 468 477 - spin_lock_irqsave(&cdd->lock, flags); 478 - list_add_tail(&c->node, &cdd->pending); 479 - spin_unlock_irqrestore(&cdd->lock, flags); 469 + list_for_each_entry_safe(c, _c, &cdd->pending, node) { 470 + push_desc_queue(c); 471 + list_del(&c->node); 472 + } 480 473 } 481 474 482 475 static void cppi41_dma_issue_pending(struct dma_chan *chan) 483 476 { 484 477 struct cppi41_channel *c = to_cpp41_chan(chan); 485 478 struct cppi41_dd *cdd = c->cdd; 479 + unsigned long flags; 486 480 int error; 487 481 488 482 error = pm_runtime_get(cdd->ddev.dev); ··· 500 482 return; 501 483 } 502 484 503 - if (likely(pm_runtime_active(cdd->ddev.dev))) 504 - push_desc_queue(c); 505 - else 506 - pending_desc(c); 485 + spin_lock_irqsave(&cdd->lock, flags); 486 + list_add_tail(&c->node, &cdd->pending); 487 + if (!cdd->is_suspended) 488 + cppi41_run_queue(cdd); 489 + spin_unlock_irqrestore(&cdd->lock, flags); 507 490 508 491 pm_runtime_mark_last_busy(cdd->ddev.dev); 509 492 pm_runtime_put_autosuspend(cdd->ddev.dev); ··· 723 704 724 705 WARN_ON(!cdd->chan_busy[desc_num]); 725 706 cdd->chan_busy[desc_num] = NULL; 707 + 708 + /* Usecount for chan_busy[], paired with push_desc_queue() */ 709 + pm_runtime_put(cdd->ddev.dev); 726 710 727 711 return 0; 728 712 } ··· 1172 1150 static int __maybe_unused cppi41_runtime_suspend(struct device *dev) 1173 1151 { 1174 1152 struct cppi41_dd *cdd = dev_get_drvdata(dev); 1153 + unsigned long flags; 1175 1154 1155 + spin_lock_irqsave(&cdd->lock, flags); 1156 + cdd->is_suspended = true; 1176 1157 WARN_ON(!list_empty(&cdd->pending)); 1158 + spin_unlock_irqrestore(&cdd->lock, flags); 1177 1159 1178 1160 return 0; 1179 1161 } ··· 1185 1159 static int __maybe_unused cppi41_runtime_resume(struct device *dev) 1186 1160 { 1187 1161 struct cppi41_dd *cdd = dev_get_drvdata(dev); 1188 - struct cppi41_channel *c, *_c; 1189 1162 unsigned long flags; 1190 1163 1191 1164 spin_lock_irqsave(&cdd->lock, flags); 1192 - list_for_each_entry_safe(c, _c, &cdd->pending, node) { 1193 - push_desc_queue(c); 1194 - list_del(&c->node); 1195 - } 1165 + cdd->is_suspended = false; 1166 + cppi41_run_queue(cdd); 1196 1167 spin_unlock_irqrestore(&cdd->lock, flags); 1197 1168 1198 1169 return 0;
+6 -13
drivers/dma/pl330.c
··· 1699 1699 static struct pl330_thread *pl330_request_channel(struct pl330_dmac *pl330) 1700 1700 { 1701 1701 struct pl330_thread *thrd = NULL; 1702 - unsigned long flags; 1703 1702 int chans, i; 1704 1703 1705 1704 if (pl330->state == DYING) 1706 1705 return NULL; 1707 1706 1708 1707 chans = pl330->pcfg.num_chan; 1709 - 1710 - spin_lock_irqsave(&pl330->lock, flags); 1711 1708 1712 1709 for (i = 0; i < chans; i++) { 1713 1710 thrd = &pl330->channels[i]; ··· 1723 1726 thrd = NULL; 1724 1727 } 1725 1728 1726 - spin_unlock_irqrestore(&pl330->lock, flags); 1727 - 1728 1729 return thrd; 1729 1730 } 1730 1731 ··· 1740 1745 static void pl330_release_channel(struct pl330_thread *thrd) 1741 1746 { 1742 1747 struct pl330_dmac *pl330; 1743 - unsigned long flags; 1744 1748 1745 1749 if (!thrd || thrd->free) 1746 1750 return; ··· 1751 1757 1752 1758 pl330 = thrd->dmac; 1753 1759 1754 - spin_lock_irqsave(&pl330->lock, flags); 1755 1760 _free_event(thrd, thrd->ev); 1756 1761 thrd->free = true; 1757 - spin_unlock_irqrestore(&pl330->lock, flags); 1758 1762 } 1759 1763 1760 1764 /* Initialize the structure for PL330 configuration, that can be used ··· 2114 2122 struct pl330_dmac *pl330 = pch->dmac; 2115 2123 unsigned long flags; 2116 2124 2117 - spin_lock_irqsave(&pch->lock, flags); 2125 + spin_lock_irqsave(&pl330->lock, flags); 2118 2126 2119 2127 dma_cookie_init(chan); 2120 2128 pch->cyclic = false; 2121 2129 2122 2130 pch->thread = pl330_request_channel(pl330); 2123 2131 if (!pch->thread) { 2124 - spin_unlock_irqrestore(&pch->lock, flags); 2132 + spin_unlock_irqrestore(&pl330->lock, flags); 2125 2133 return -ENOMEM; 2126 2134 } 2127 2135 2128 2136 tasklet_init(&pch->task, pl330_tasklet, (unsigned long) pch); 2129 2137 2130 - spin_unlock_irqrestore(&pch->lock, flags); 2138 + spin_unlock_irqrestore(&pl330->lock, flags); 2131 2139 2132 2140 return 1; 2133 2141 } ··· 2230 2238 static void pl330_free_chan_resources(struct dma_chan *chan) 2231 2239 { 2232 2240 struct dma_pl330_chan *pch = to_pchan(chan); 2241 + struct pl330_dmac *pl330 = pch->dmac; 2233 2242 unsigned long flags; 2234 2243 2235 2244 tasklet_kill(&pch->task); 2236 2245 2237 2246 pm_runtime_get_sync(pch->dmac->ddma.dev); 2238 - spin_lock_irqsave(&pch->lock, flags); 2247 + spin_lock_irqsave(&pl330->lock, flags); 2239 2248 2240 2249 pl330_release_channel(pch->thread); 2241 2250 pch->thread = NULL; ··· 2244 2251 if (pch->cyclic) 2245 2252 list_splice_tail_init(&pch->work_list, &pch->dmac->desc_pool); 2246 2253 2247 - spin_unlock_irqrestore(&pch->lock, flags); 2254 + spin_unlock_irqrestore(&pl330->lock, flags); 2248 2255 pm_runtime_mark_last_busy(pch->dmac->ddma.dev); 2249 2256 pm_runtime_put_autosuspend(pch->dmac->ddma.dev); 2250 2257 }
+3 -11
drivers/firmware/efi/libstub/fdt.c
··· 187 187 struct exit_boot_struct { 188 188 efi_memory_desc_t *runtime_map; 189 189 int *runtime_entry_count; 190 + void *new_fdt_addr; 190 191 }; 191 192 192 193 static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, ··· 203 202 efi_get_virtmap(*map->map, *map->map_size, *map->desc_size, 204 203 p->runtime_map, p->runtime_entry_count); 205 204 206 - return EFI_SUCCESS; 205 + return update_fdt_memmap(p->new_fdt_addr, map); 207 206 } 208 207 209 208 /* ··· 301 300 302 301 priv.runtime_map = runtime_map; 303 302 priv.runtime_entry_count = &runtime_entry_count; 303 + priv.new_fdt_addr = (void *)*new_fdt_addr; 304 304 status = efi_exit_boot_services(sys_table, handle, &map, &priv, 305 305 exit_boot_func); 306 306 307 307 if (status == EFI_SUCCESS) { 308 308 efi_set_virtual_address_map_t *svam; 309 - 310 - status = update_fdt_memmap((void *)*new_fdt_addr, &map); 311 - if (status != EFI_SUCCESS) { 312 - /* 313 - * The kernel won't get far without the memory map, but 314 - * may still be able to print something meaningful so 315 - * return success here. 316 - */ 317 - return EFI_SUCCESS; 318 - } 319 309 320 310 /* Install the new virtual address map */ 321 311 svam = sys_table->runtime->set_virtual_address_map;
+3 -1
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
··· 254 254 } 255 255 WREG32(mmHDP_REG_COHERENCY_FLUSH_CNTL, 0); 256 256 257 + if (adev->mode_info.num_crtc) 258 + amdgpu_display_set_vga_render_state(adev, false); 259 + 257 260 gmc_v6_0_mc_stop(adev, &save); 258 261 259 262 if (gmc_v6_0_wait_for_idle((void *)adev)) { ··· 286 283 dev_warn(adev->dev, "Wait for MC idle timedout !\n"); 287 284 } 288 285 gmc_v6_0_mc_resume(adev, &save); 289 - amdgpu_display_set_vga_render_state(adev, false); 290 286 } 291 287 292 288 static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
+8 -5
drivers/gpu/drm/drm_atomic.c
··· 2032 2032 } 2033 2033 2034 2034 for_each_crtc_in_state(state, crtc, crtc_state, i) { 2035 + struct drm_pending_vblank_event *event = crtc_state->event; 2035 2036 /* 2036 - * TEST_ONLY and PAGE_FLIP_EVENT are mutually 2037 - * exclusive, if they weren't, this code should be 2038 - * called on success for TEST_ONLY too. 2037 + * Free the allocated event. drm_atomic_helper_setup_commit 2038 + * can allocate an event too, so only free it if it's ours 2039 + * to prevent a double free in drm_atomic_state_clear. 2039 2040 */ 2040 - if (crtc_state->event) 2041 - drm_event_cancel_free(dev, &crtc_state->event->base); 2041 + if (event && (event->base.fence || event->base.file_priv)) { 2042 + drm_event_cancel_free(dev, &event->base); 2043 + crtc_state->event = NULL; 2044 + } 2042 2045 } 2043 2046 2044 2047 if (!fence_state)
-9
drivers/gpu/drm/drm_atomic_helper.c
··· 1666 1666 1667 1667 funcs = plane->helper_private; 1668 1668 1669 - if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc)) 1670 - continue; 1671 - 1672 1669 if (funcs->prepare_fb) { 1673 1670 ret = funcs->prepare_fb(plane, plane_state); 1674 1671 if (ret) ··· 1680 1683 const struct drm_plane_helper_funcs *funcs; 1681 1684 1682 1685 if (j >= i) 1683 - continue; 1684 - 1685 - if (!drm_atomic_helper_framebuffer_changed(dev, state, plane_state->crtc)) 1686 1686 continue; 1687 1687 1688 1688 funcs = plane->helper_private; ··· 1947 1953 1948 1954 for_each_plane_in_state(old_state, plane, plane_state, i) { 1949 1955 const struct drm_plane_helper_funcs *funcs; 1950 - 1951 - if (!drm_atomic_helper_framebuffer_changed(dev, old_state, plane_state->crtc)) 1952 - continue; 1953 1956 1954 1957 funcs = plane->helper_private; 1955 1958
+18 -5
drivers/gpu/drm/drm_connector.c
··· 225 225 226 226 INIT_LIST_HEAD(&connector->probed_modes); 227 227 INIT_LIST_HEAD(&connector->modes); 228 + mutex_init(&connector->mutex); 228 229 connector->edid_blob_ptr = NULL; 229 230 connector->status = connector_status_unknown; 230 231 ··· 360 359 connector->funcs->atomic_destroy_state(connector, 361 360 connector->state); 362 361 362 + mutex_destroy(&connector->mutex); 363 + 363 364 memset(connector, 0, sizeof(*connector)); 364 365 } 365 366 EXPORT_SYMBOL(drm_connector_cleanup); ··· 377 374 */ 378 375 int drm_connector_register(struct drm_connector *connector) 379 376 { 380 - int ret; 377 + int ret = 0; 381 378 382 - if (connector->registered) 379 + if (!connector->dev->registered) 383 380 return 0; 381 + 382 + mutex_lock(&connector->mutex); 383 + if (connector->registered) 384 + goto unlock; 384 385 385 386 ret = drm_sysfs_connector_add(connector); 386 387 if (ret) 387 - return ret; 388 + goto unlock; 388 389 389 390 ret = drm_debugfs_connector_add(connector); 390 391 if (ret) { ··· 404 397 drm_mode_object_register(connector->dev, &connector->base); 405 398 406 399 connector->registered = true; 407 - return 0; 400 + goto unlock; 408 401 409 402 err_debugfs: 410 403 drm_debugfs_connector_remove(connector); 411 404 err_sysfs: 412 405 drm_sysfs_connector_remove(connector); 406 + unlock: 407 + mutex_unlock(&connector->mutex); 413 408 return ret; 414 409 } 415 410 EXPORT_SYMBOL(drm_connector_register); ··· 424 415 */ 425 416 void drm_connector_unregister(struct drm_connector *connector) 426 417 { 427 - if (!connector->registered) 418 + mutex_lock(&connector->mutex); 419 + if (!connector->registered) { 420 + mutex_unlock(&connector->mutex); 428 421 return; 422 + } 429 423 430 424 if (connector->funcs->early_unregister) 431 425 connector->funcs->early_unregister(connector); ··· 437 425 drm_debugfs_connector_remove(connector); 438 426 439 427 connector->registered = false; 428 + mutex_unlock(&connector->mutex); 440 429 } 441 430 EXPORT_SYMBOL(drm_connector_unregister); 442 431
+4
drivers/gpu/drm/drm_drv.c
··· 745 745 if (ret) 746 746 goto err_minors; 747 747 748 + dev->registered = true; 749 + 748 750 if (dev->driver->load) { 749 751 ret = dev->driver->load(dev, flags); 750 752 if (ret) ··· 786 784 struct drm_map_list *r_list, *list_temp; 787 785 788 786 drm_lastclose(dev); 787 + 788 + dev->registered = false; 789 789 790 790 if (drm_core_check_feature(dev, DRIVER_MODESET)) 791 791 drm_modeset_unregister_all(dev);
+4 -12
drivers/gpu/drm/i915/i915_drv.h
··· 1012 1012 struct work_struct underrun_work; 1013 1013 1014 1014 struct intel_fbc_state_cache { 1015 + struct i915_vma *vma; 1016 + 1015 1017 struct { 1016 1018 unsigned int mode_flags; 1017 1019 uint32_t hsw_bdw_pixel_rate; ··· 1027 1025 } plane; 1028 1026 1029 1027 struct { 1030 - u64 ilk_ggtt_offset; 1031 1028 uint32_t pixel_format; 1032 1029 unsigned int stride; 1033 - int fence_reg; 1034 - unsigned int tiling_mode; 1035 1030 } fb; 1036 1031 } state_cache; 1037 1032 1038 1033 struct intel_fbc_reg_params { 1034 + struct i915_vma *vma; 1035 + 1039 1036 struct { 1040 1037 enum pipe pipe; 1041 1038 enum plane plane; ··· 1042 1041 } crtc; 1043 1042 1044 1043 struct { 1045 - u64 ggtt_offset; 1046 1044 uint32_t pixel_format; 1047 1045 unsigned int stride; 1048 - int fence_reg; 1049 1046 } fb; 1050 1047 1051 1048 int cfb_size; ··· 3165 3166 const struct i915_ggtt_view *view) 3166 3167 { 3167 3168 return i915_gem_obj_to_vma(obj, &to_i915(obj->base.dev)->ggtt.base, view); 3168 - } 3169 - 3170 - static inline unsigned long 3171 - i915_gem_object_ggtt_offset(struct drm_i915_gem_object *o, 3172 - const struct i915_ggtt_view *view) 3173 - { 3174 - return i915_ggtt_offset(i915_gem_object_to_ggtt(o, view)); 3175 3169 } 3176 3170 3177 3171 /* i915_gem_fence_reg.c */
+20
drivers/gpu/drm/i915/intel_atomic_plane.c
··· 85 85 86 86 __drm_atomic_helper_plane_duplicate_state(plane, state); 87 87 88 + intel_state->vma = NULL; 89 + 88 90 return state; 89 91 } 90 92 ··· 102 100 intel_plane_destroy_state(struct drm_plane *plane, 103 101 struct drm_plane_state *state) 104 102 { 103 + struct i915_vma *vma; 104 + 105 + vma = fetch_and_zero(&to_intel_plane_state(state)->vma); 106 + 107 + /* 108 + * FIXME: Normally intel_cleanup_plane_fb handles destruction of vma. 109 + * We currently don't clear all planes during driver unload, so we have 110 + * to be able to unpin vma here for now. 111 + * 112 + * Normally this can only happen during unload when kmscon is disabled 113 + * and userspace doesn't attempt to set a framebuffer at all. 114 + */ 115 + if (vma) { 116 + mutex_lock(&plane->dev->struct_mutex); 117 + intel_unpin_fb_vma(vma); 118 + mutex_unlock(&plane->dev->struct_mutex); 119 + } 120 + 105 121 drm_atomic_helper_plane_destroy_state(plane, state); 106 122 } 107 123
+42 -83
drivers/gpu/drm/i915/intel_display.c
··· 2235 2235 i915_vma_pin_fence(vma); 2236 2236 } 2237 2237 2238 + i915_vma_get(vma); 2238 2239 err: 2239 2240 intel_runtime_pm_put(dev_priv); 2240 2241 return vma; 2241 2242 } 2242 2243 2243 - void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation) 2244 + void intel_unpin_fb_vma(struct i915_vma *vma) 2244 2245 { 2245 - struct drm_i915_gem_object *obj = intel_fb_obj(fb); 2246 - struct i915_ggtt_view view; 2247 - struct i915_vma *vma; 2248 - 2249 - WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex)); 2250 - 2251 - intel_fill_fb_ggtt_view(&view, fb, rotation); 2252 - vma = i915_gem_object_to_ggtt(obj, &view); 2246 + lockdep_assert_held(&vma->vm->dev->struct_mutex); 2253 2247 2254 2248 if (WARN_ON_ONCE(!vma)) 2255 2249 return; 2256 2250 2257 2251 i915_vma_unpin_fence(vma); 2258 2252 i915_gem_object_unpin_from_display_plane(vma); 2253 + i915_vma_put(vma); 2259 2254 } 2260 2255 2261 2256 static int intel_fb_pitch(const struct drm_framebuffer *fb, int plane, ··· 2745 2750 struct drm_device *dev = intel_crtc->base.dev; 2746 2751 struct drm_i915_private *dev_priv = to_i915(dev); 2747 2752 struct drm_crtc *c; 2748 - struct intel_crtc *i; 2749 2753 struct drm_i915_gem_object *obj; 2750 2754 struct drm_plane *primary = intel_crtc->base.primary; 2751 2755 struct drm_plane_state *plane_state = primary->state; ··· 2769 2775 * an fb with another CRTC instead 2770 2776 */ 2771 2777 for_each_crtc(dev, c) { 2772 - i = to_intel_crtc(c); 2778 + struct intel_plane_state *state; 2773 2779 2774 2780 if (c == &intel_crtc->base) 2775 2781 continue; 2776 2782 2777 - if (!i->active) 2783 + if (!to_intel_crtc(c)->active) 2778 2784 continue; 2779 2785 2780 - fb = c->primary->fb; 2781 - if (!fb) 2786 + state = to_intel_plane_state(c->primary->state); 2787 + if (!state->vma) 2782 2788 continue; 2783 2789 2784 - obj = intel_fb_obj(fb); 2785 - if (i915_gem_object_ggtt_offset(obj, NULL) == plane_config->base) { 2790 + if (intel_plane_ggtt_offset(state) == plane_config->base) { 2791 + fb = c->primary->fb; 2786 2792 drm_framebuffer_reference(fb); 2787 2793 goto valid_fb; 2788 2794 } ··· 2803 2809 return; 2804 2810 2805 2811 valid_fb: 2812 + mutex_lock(&dev->struct_mutex); 2813 + intel_state->vma = 2814 + intel_pin_and_fence_fb_obj(fb, primary->state->rotation); 2815 + mutex_unlock(&dev->struct_mutex); 2816 + if (IS_ERR(intel_state->vma)) { 2817 + DRM_ERROR("failed to pin boot fb on pipe %d: %li\n", 2818 + intel_crtc->pipe, PTR_ERR(intel_state->vma)); 2819 + 2820 + intel_state->vma = NULL; 2821 + drm_framebuffer_unreference(fb); 2822 + return; 2823 + } 2824 + 2806 2825 plane_state->src_x = 0; 2807 2826 plane_state->src_y = 0; 2808 2827 plane_state->src_w = fb->width << 16; ··· 3111 3104 I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); 3112 3105 if (INTEL_GEN(dev_priv) >= 4) { 3113 3106 I915_WRITE(DSPSURF(plane), 3114 - intel_fb_gtt_offset(fb, rotation) + 3107 + intel_plane_ggtt_offset(plane_state) + 3115 3108 intel_crtc->dspaddr_offset); 3116 3109 I915_WRITE(DSPTILEOFF(plane), (y << 16) | x); 3117 3110 I915_WRITE(DSPLINOFF(plane), linear_offset); 3118 3111 } else { 3119 3112 I915_WRITE(DSPADDR(plane), 3120 - intel_fb_gtt_offset(fb, rotation) + 3113 + intel_plane_ggtt_offset(plane_state) + 3121 3114 intel_crtc->dspaddr_offset); 3122 3115 } 3123 3116 POSTING_READ(reg); ··· 3214 3207 3215 3208 I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); 3216 3209 I915_WRITE(DSPSURF(plane), 3217 - intel_fb_gtt_offset(fb, rotation) + 3210 + intel_plane_ggtt_offset(plane_state) + 3218 3211 intel_crtc->dspaddr_offset); 3219 3212 if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) { 3220 3213 I915_WRITE(DSPOFFSET(plane), (y << 16) | x); ··· 3235 3228 3236 3229 return intel_tile_width_bytes(dev_priv, fb_modifier, cpp); 3237 3230 } 3238 - } 3239 - 3240 - u32 intel_fb_gtt_offset(struct drm_framebuffer *fb, 3241 - unsigned int rotation) 3242 - { 3243 - struct drm_i915_gem_object *obj = intel_fb_obj(fb); 3244 - struct i915_ggtt_view view; 3245 - struct i915_vma *vma; 3246 - 3247 - intel_fill_fb_ggtt_view(&view, fb, rotation); 3248 - 3249 - vma = i915_gem_object_to_ggtt(obj, &view); 3250 - if (WARN(!vma, "ggtt vma for display object not found! (view=%u)\n", 3251 - view.type)) 3252 - return -1; 3253 - 3254 - return i915_ggtt_offset(vma); 3255 3231 } 3256 3232 3257 3233 static void skl_detach_scaler(struct intel_crtc *intel_crtc, int id) ··· 3431 3441 } 3432 3442 3433 3443 I915_WRITE(PLANE_SURF(pipe, 0), 3434 - intel_fb_gtt_offset(fb, rotation) + surf_addr); 3444 + intel_plane_ggtt_offset(plane_state) + surf_addr); 3435 3445 3436 3446 POSTING_READ(PLANE_SURF(pipe, 0)); 3437 3447 } ··· 11526 11536 flush_work(&work->mmio_work); 11527 11537 11528 11538 mutex_lock(&dev->struct_mutex); 11529 - intel_unpin_fb_obj(work->old_fb, primary->state->rotation); 11539 + intel_unpin_fb_vma(work->old_vma); 11530 11540 i915_gem_object_put(work->pending_flip_obj); 11531 11541 mutex_unlock(&dev->struct_mutex); 11532 11542 ··· 12236 12246 goto cleanup_pending; 12237 12247 } 12238 12248 12239 - work->gtt_offset = intel_fb_gtt_offset(fb, primary->state->rotation); 12240 - work->gtt_offset += intel_crtc->dspaddr_offset; 12249 + work->old_vma = to_intel_plane_state(primary->state)->vma; 12250 + to_intel_plane_state(primary->state)->vma = vma; 12251 + 12252 + work->gtt_offset = i915_ggtt_offset(vma) + intel_crtc->dspaddr_offset; 12241 12253 work->rotation = crtc->primary->state->rotation; 12242 12254 12243 12255 /* ··· 12293 12301 cleanup_request: 12294 12302 i915_add_request_no_flush(request); 12295 12303 cleanup_unpin: 12296 - intel_unpin_fb_obj(fb, crtc->primary->state->rotation); 12304 + to_intel_plane_state(primary->state)->vma = work->old_vma; 12305 + intel_unpin_fb_vma(vma); 12297 12306 cleanup_pending: 12298 12307 atomic_dec(&intel_crtc->unpin_work_count); 12299 12308 unlock: ··· 14787 14794 DRM_DEBUG_KMS("failed to pin object\n"); 14788 14795 return PTR_ERR(vma); 14789 14796 } 14797 + 14798 + to_intel_plane_state(new_state)->vma = vma; 14790 14799 } 14791 14800 14792 14801 return 0; ··· 14807 14812 intel_cleanup_plane_fb(struct drm_plane *plane, 14808 14813 struct drm_plane_state *old_state) 14809 14814 { 14810 - struct drm_i915_private *dev_priv = to_i915(plane->dev); 14811 - struct intel_plane_state *old_intel_state; 14812 - struct drm_i915_gem_object *old_obj = intel_fb_obj(old_state->fb); 14813 - struct drm_i915_gem_object *obj = intel_fb_obj(plane->state->fb); 14815 + struct i915_vma *vma; 14814 14816 14815 - old_intel_state = to_intel_plane_state(old_state); 14816 - 14817 - if (!obj && !old_obj) 14818 - return; 14819 - 14820 - if (old_obj && (plane->type != DRM_PLANE_TYPE_CURSOR || 14821 - !INTEL_INFO(dev_priv)->cursor_needs_physical)) 14822 - intel_unpin_fb_obj(old_state->fb, old_state->rotation); 14817 + /* Should only be called after a successful intel_prepare_plane_fb()! */ 14818 + vma = fetch_and_zero(&to_intel_plane_state(old_state)->vma); 14819 + if (vma) 14820 + intel_unpin_fb_vma(vma); 14823 14821 } 14824 14822 14825 14823 int ··· 15154 15166 if (!obj) 15155 15167 addr = 0; 15156 15168 else if (!INTEL_INFO(dev_priv)->cursor_needs_physical) 15157 - addr = i915_gem_object_ggtt_offset(obj, NULL); 15169 + addr = intel_plane_ggtt_offset(state); 15158 15170 else 15159 15171 addr = obj->phys_handle->busaddr; 15160 15172 ··· 17054 17066 void intel_modeset_gem_init(struct drm_device *dev) 17055 17067 { 17056 17068 struct drm_i915_private *dev_priv = to_i915(dev); 17057 - struct drm_crtc *c; 17058 - struct drm_i915_gem_object *obj; 17059 17069 17060 17070 intel_init_gt_powersave(dev_priv); 17061 17071 17062 17072 intel_modeset_init_hw(dev); 17063 17073 17064 17074 intel_setup_overlay(dev_priv); 17065 - 17066 - /* 17067 - * Make sure any fbs we allocated at startup are properly 17068 - * pinned & fenced. When we do the allocation it's too early 17069 - * for this. 17070 - */ 17071 - for_each_crtc(dev, c) { 17072 - struct i915_vma *vma; 17073 - 17074 - obj = intel_fb_obj(c->primary->fb); 17075 - if (obj == NULL) 17076 - continue; 17077 - 17078 - mutex_lock(&dev->struct_mutex); 17079 - vma = intel_pin_and_fence_fb_obj(c->primary->fb, 17080 - c->primary->state->rotation); 17081 - mutex_unlock(&dev->struct_mutex); 17082 - if (IS_ERR(vma)) { 17083 - DRM_ERROR("failed to pin boot fb on pipe %d\n", 17084 - to_intel_crtc(c)->pipe); 17085 - drm_framebuffer_unreference(c->primary->fb); 17086 - c->primary->fb = NULL; 17087 - c->primary->crtc = c->primary->state->crtc = NULL; 17088 - update_state_fb(c->primary); 17089 - c->state->plane_mask &= ~(1 << drm_plane_index(c->primary)); 17090 - } 17091 - } 17092 17075 } 17093 17076 17094 17077 int intel_connector_register(struct drm_connector *connector)
+7 -2
drivers/gpu/drm/i915/intel_drv.h
··· 377 377 struct intel_plane_state { 378 378 struct drm_plane_state base; 379 379 struct drm_rect clip; 380 + struct i915_vma *vma; 380 381 381 382 struct { 382 383 u32 offset; ··· 1047 1046 struct work_struct mmio_work; 1048 1047 1049 1048 struct drm_crtc *crtc; 1049 + struct i915_vma *old_vma; 1050 1050 struct drm_framebuffer *old_fb; 1051 1051 struct drm_i915_gem_object *pending_flip_obj; 1052 1052 struct drm_pending_vblank_event *event; ··· 1275 1273 struct drm_modeset_acquire_ctx *ctx); 1276 1274 struct i915_vma * 1277 1275 intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb, unsigned int rotation); 1278 - void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation); 1276 + void intel_unpin_fb_vma(struct i915_vma *vma); 1279 1277 struct drm_framebuffer * 1280 1278 __intel_framebuffer_create(struct drm_device *dev, 1281 1279 struct drm_mode_fb_cmd2 *mode_cmd, ··· 1364 1362 int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state); 1365 1363 int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state); 1366 1364 1367 - u32 intel_fb_gtt_offset(struct drm_framebuffer *fb, unsigned int rotation); 1365 + static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state) 1366 + { 1367 + return i915_ggtt_offset(state->vma); 1368 + } 1368 1369 1369 1370 u32 skl_plane_ctl_format(uint32_t pixel_format); 1370 1371 u32 skl_plane_ctl_tiling(uint64_t fb_modifier);
+20 -32
drivers/gpu/drm/i915/intel_fbc.c
··· 173 173 if (IS_I945GM(dev_priv)) 174 174 fbc_ctl |= FBC_CTL_C3_IDLE; /* 945 needs special SR handling */ 175 175 fbc_ctl |= (cfb_pitch & 0xff) << FBC_CTL_STRIDE_SHIFT; 176 - fbc_ctl |= params->fb.fence_reg; 176 + fbc_ctl |= params->vma->fence->id; 177 177 I915_WRITE(FBC_CONTROL, fbc_ctl); 178 178 } 179 179 ··· 193 193 else 194 194 dpfc_ctl |= DPFC_CTL_LIMIT_1X; 195 195 196 - if (params->fb.fence_reg != I915_FENCE_REG_NONE) { 197 - dpfc_ctl |= DPFC_CTL_FENCE_EN | params->fb.fence_reg; 196 + if (params->vma->fence) { 197 + dpfc_ctl |= DPFC_CTL_FENCE_EN | params->vma->fence->id; 198 198 I915_WRITE(DPFC_FENCE_YOFF, params->crtc.fence_y_offset); 199 199 } else { 200 200 I915_WRITE(DPFC_FENCE_YOFF, 0); ··· 251 251 break; 252 252 } 253 253 254 - if (params->fb.fence_reg != I915_FENCE_REG_NONE) { 254 + if (params->vma->fence) { 255 255 dpfc_ctl |= DPFC_CTL_FENCE_EN; 256 256 if (IS_GEN5(dev_priv)) 257 - dpfc_ctl |= params->fb.fence_reg; 257 + dpfc_ctl |= params->vma->fence->id; 258 258 if (IS_GEN6(dev_priv)) { 259 259 I915_WRITE(SNB_DPFC_CTL_SA, 260 - SNB_CPU_FENCE_ENABLE | params->fb.fence_reg); 260 + SNB_CPU_FENCE_ENABLE | 261 + params->vma->fence->id); 261 262 I915_WRITE(DPFC_CPU_FENCE_OFFSET, 262 263 params->crtc.fence_y_offset); 263 264 } ··· 270 269 } 271 270 272 271 I915_WRITE(ILK_DPFC_FENCE_YOFF, params->crtc.fence_y_offset); 273 - I915_WRITE(ILK_FBC_RT_BASE, params->fb.ggtt_offset | ILK_FBC_RT_VALID); 272 + I915_WRITE(ILK_FBC_RT_BASE, 273 + i915_ggtt_offset(params->vma) | ILK_FBC_RT_VALID); 274 274 /* enable it... */ 275 275 I915_WRITE(ILK_DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN); 276 276 ··· 321 319 break; 322 320 } 323 321 324 - if (params->fb.fence_reg != I915_FENCE_REG_NONE) { 322 + if (params->vma->fence) { 325 323 dpfc_ctl |= IVB_DPFC_CTL_FENCE_EN; 326 324 I915_WRITE(SNB_DPFC_CTL_SA, 327 - SNB_CPU_FENCE_ENABLE | params->fb.fence_reg); 325 + SNB_CPU_FENCE_ENABLE | 326 + params->vma->fence->id); 328 327 I915_WRITE(DPFC_CPU_FENCE_OFFSET, params->crtc.fence_y_offset); 329 328 } else { 330 329 I915_WRITE(SNB_DPFC_CTL_SA,0); ··· 730 727 return effective_w <= max_w && effective_h <= max_h; 731 728 } 732 729 733 - /* XXX replace me when we have VMA tracking for intel_plane_state */ 734 - static int get_fence_id(struct drm_framebuffer *fb) 735 - { 736 - struct i915_vma *vma = i915_gem_object_to_ggtt(intel_fb_obj(fb), NULL); 737 - 738 - return vma && vma->fence ? vma->fence->id : I915_FENCE_REG_NONE; 739 - } 740 - 741 730 static void intel_fbc_update_state_cache(struct intel_crtc *crtc, 742 731 struct intel_crtc_state *crtc_state, 743 732 struct intel_plane_state *plane_state) ··· 738 743 struct intel_fbc *fbc = &dev_priv->fbc; 739 744 struct intel_fbc_state_cache *cache = &fbc->state_cache; 740 745 struct drm_framebuffer *fb = plane_state->base.fb; 741 - struct drm_i915_gem_object *obj; 746 + 747 + cache->vma = NULL; 742 748 743 749 cache->crtc.mode_flags = crtc_state->base.adjusted_mode.flags; 744 750 if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) ··· 754 758 if (!cache->plane.visible) 755 759 return; 756 760 757 - obj = intel_fb_obj(fb); 758 - 759 - /* FIXME: We lack the proper locking here, so only run this on the 760 - * platforms that need. */ 761 - if (IS_GEN(dev_priv, 5, 6)) 762 - cache->fb.ilk_ggtt_offset = i915_gem_object_ggtt_offset(obj, NULL); 763 761 cache->fb.pixel_format = fb->pixel_format; 764 762 cache->fb.stride = fb->pitches[0]; 765 - cache->fb.fence_reg = get_fence_id(fb); 766 - cache->fb.tiling_mode = i915_gem_object_get_tiling(obj); 763 + 764 + cache->vma = plane_state->vma; 767 765 } 768 766 769 767 static bool intel_fbc_can_activate(struct intel_crtc *crtc) ··· 774 784 return false; 775 785 } 776 786 777 - if (!cache->plane.visible) { 787 + if (!cache->vma) { 778 788 fbc->no_fbc_reason = "primary plane not visible"; 779 789 return false; 780 790 } ··· 797 807 * so have no fence associated with it) due to aperture constaints 798 808 * at the time of pinning. 799 809 */ 800 - if (cache->fb.tiling_mode != I915_TILING_X || 801 - cache->fb.fence_reg == I915_FENCE_REG_NONE) { 810 + if (!cache->vma->fence) { 802 811 fbc->no_fbc_reason = "framebuffer not tiled or fenced"; 803 812 return false; 804 813 } ··· 877 888 * zero. */ 878 889 memset(params, 0, sizeof(*params)); 879 890 891 + params->vma = cache->vma; 892 + 880 893 params->crtc.pipe = crtc->pipe; 881 894 params->crtc.plane = crtc->plane; 882 895 params->crtc.fence_y_offset = get_crtc_fence_y_offset(crtc); 883 896 884 897 params->fb.pixel_format = cache->fb.pixel_format; 885 898 params->fb.stride = cache->fb.stride; 886 - params->fb.fence_reg = cache->fb.fence_reg; 887 899 888 900 params->cfb_size = intel_fbc_calculate_cfb_size(dev_priv, cache); 889 - 890 - params->fb.ggtt_offset = cache->fb.ilk_ggtt_offset; 891 901 } 892 902 893 903 static bool intel_fbc_reg_params_equal(struct intel_fbc_reg_params *params1,
+2 -2
drivers/gpu/drm/i915/intel_fbdev.c
··· 284 284 out_destroy_fbi: 285 285 drm_fb_helper_release_fbi(helper); 286 286 out_unpin: 287 - intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0); 287 + intel_unpin_fb_vma(vma); 288 288 out_unlock: 289 289 mutex_unlock(&dev->struct_mutex); 290 290 return ret; ··· 549 549 550 550 if (ifbdev->fb) { 551 551 mutex_lock(&ifbdev->helper.dev->struct_mutex); 552 - intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0); 552 + intel_unpin_fb_vma(ifbdev->vma); 553 553 mutex_unlock(&ifbdev->helper.dev->struct_mutex); 554 554 555 555 drm_framebuffer_remove(&ifbdev->fb->base);
+4 -4
drivers/gpu/drm/i915/intel_sprite.c
··· 273 273 274 274 I915_WRITE(PLANE_CTL(pipe, plane), plane_ctl); 275 275 I915_WRITE(PLANE_SURF(pipe, plane), 276 - intel_fb_gtt_offset(fb, rotation) + surf_addr); 276 + intel_plane_ggtt_offset(plane_state) + surf_addr); 277 277 POSTING_READ(PLANE_SURF(pipe, plane)); 278 278 } 279 279 ··· 458 458 I915_WRITE(SPSIZE(pipe, plane), (crtc_h << 16) | crtc_w); 459 459 I915_WRITE(SPCNTR(pipe, plane), sprctl); 460 460 I915_WRITE(SPSURF(pipe, plane), 461 - intel_fb_gtt_offset(fb, rotation) + sprsurf_offset); 461 + intel_plane_ggtt_offset(plane_state) + sprsurf_offset); 462 462 POSTING_READ(SPSURF(pipe, plane)); 463 463 } 464 464 ··· 594 594 I915_WRITE(SPRSCALE(pipe), sprscale); 595 595 I915_WRITE(SPRCTL(pipe), sprctl); 596 596 I915_WRITE(SPRSURF(pipe), 597 - intel_fb_gtt_offset(fb, rotation) + sprsurf_offset); 597 + intel_plane_ggtt_offset(plane_state) + sprsurf_offset); 598 598 POSTING_READ(SPRSURF(pipe)); 599 599 } 600 600 ··· 721 721 I915_WRITE(DVSSCALE(pipe), dvsscale); 722 722 I915_WRITE(DVSCNTR(pipe), dvscntr); 723 723 I915_WRITE(DVSSURF(pipe), 724 - intel_fb_gtt_offset(fb, rotation) + dvssurf_offset); 724 + intel_plane_ggtt_offset(plane_state) + dvssurf_offset); 725 725 POSTING_READ(DVSSURF(pipe)); 726 726 } 727 727
+2 -1
drivers/gpu/drm/nouveau/dispnv04/hw.c
··· 222 222 uint32_t mpllP; 223 223 224 224 pci_read_config_dword(pci_get_bus_and_slot(0, 3), 0x6c, &mpllP); 225 + mpllP = (mpllP >> 8) & 0xf; 225 226 if (!mpllP) 226 227 mpllP = 4; 227 228 ··· 233 232 uint32_t clock; 234 233 235 234 pci_read_config_dword(pci_get_bus_and_slot(0, 5), 0x4c, &clock); 236 - return clock; 235 + return clock / 1000; 237 236 } 238 237 239 238 ret = nouveau_hw_get_pllvals(dev, plltype, &pllvals);
+1
drivers/gpu/drm/nouveau/nouveau_fence.h
··· 99 99 struct nouveau_bo *bo; 100 100 struct nouveau_bo *bo_gart; 101 101 u32 *suspend; 102 + struct mutex mutex; 102 103 }; 103 104 104 105 int nv84_fence_context_new(struct nouveau_channel *);
+1 -1
drivers/gpu/drm/nouveau/nouveau_led.h
··· 42 42 } 43 43 44 44 /* nouveau_led.c */ 45 - #if IS_ENABLED(CONFIG_LEDS_CLASS) 45 + #if IS_REACHABLE(CONFIG_LEDS_CLASS) 46 46 int nouveau_led_init(struct drm_device *dev); 47 47 void nouveau_led_suspend(struct drm_device *dev); 48 48 void nouveau_led_resume(struct drm_device *dev);
+2 -1
drivers/gpu/drm/nouveau/nouveau_usif.c
··· 313 313 if (!(ret = nvif_unpack(-ENOSYS, &data, &size, argv->v0, 0, 0, true))) { 314 314 /* block access to objects not created via this interface */ 315 315 owner = argv->v0.owner; 316 - if (argv->v0.object == 0ULL) 316 + if (argv->v0.object == 0ULL && 317 + argv->v0.type != NVIF_IOCTL_V0_DEL) 317 318 argv->v0.owner = NVDRM_OBJECT_ANY; /* except client */ 318 319 else 319 320 argv->v0.owner = NVDRM_OBJECT_USIF;
+6
drivers/gpu/drm/nouveau/nv50_display.c
··· 4052 4052 } 4053 4053 } 4054 4054 4055 + for_each_crtc_in_state(state, crtc, crtc_state, i) { 4056 + if (crtc->state->event) 4057 + drm_crtc_vblank_get(crtc); 4058 + } 4059 + 4055 4060 /* Update plane(s). */ 4056 4061 for_each_plane_in_state(state, plane, plane_state, i) { 4057 4062 struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state); ··· 4106 4101 drm_crtc_send_vblank_event(crtc, crtc->state->event); 4107 4102 spin_unlock_irqrestore(&crtc->dev->event_lock, flags); 4108 4103 crtc->state->event = NULL; 4104 + drm_crtc_vblank_put(crtc); 4109 4105 } 4110 4106 } 4111 4107
+6
drivers/gpu/drm/nouveau/nv84_fence.c
··· 107 107 struct nv84_fence_chan *fctx = chan->fence; 108 108 109 109 nouveau_bo_wr32(priv->bo, chan->chid * 16 / 4, fctx->base.sequence); 110 + mutex_lock(&priv->mutex); 110 111 nouveau_bo_vma_del(priv->bo, &fctx->vma_gart); 111 112 nouveau_bo_vma_del(priv->bo, &fctx->vma); 113 + mutex_unlock(&priv->mutex); 112 114 nouveau_fence_context_del(&fctx->base); 113 115 chan->fence = NULL; 114 116 nouveau_fence_context_free(&fctx->base); ··· 136 134 fctx->base.sync32 = nv84_fence_sync32; 137 135 fctx->base.sequence = nv84_fence_read(chan); 138 136 137 + mutex_lock(&priv->mutex); 139 138 ret = nouveau_bo_vma_add(priv->bo, cli->vm, &fctx->vma); 140 139 if (ret == 0) { 141 140 ret = nouveau_bo_vma_add(priv->bo_gart, cli->vm, 142 141 &fctx->vma_gart); 143 142 } 143 + mutex_unlock(&priv->mutex); 144 144 145 145 if (ret) 146 146 nv84_fence_context_del(chan); ··· 215 211 priv->base.contexts = fifo->nr; 216 212 priv->base.context_base = dma_fence_context_alloc(priv->base.contexts); 217 213 priv->base.uevent = true; 214 + 215 + mutex_init(&priv->mutex); 218 216 219 217 /* Use VRAM if there is any ; otherwise fallback to system memory */ 220 218 domain = drm->device.info.ram_size != 0 ? TTM_PL_FLAG_VRAM :
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdagt215.c
··· 59 59 ); 60 60 } 61 61 for (i = 0; i < size; i++) 62 - nvkm_wr32(device, 0x61c440 + soff, (i << 8) | args->v0.data[0]); 62 + nvkm_wr32(device, 0x61c440 + soff, (i << 8) | args->v0.data[i]); 63 63 for (; i < 0x60; i++) 64 64 nvkm_wr32(device, 0x61c440 + soff, (i << 8)); 65 65 nvkm_mask(device, 0x61c448 + soff, 0x80000003, 0x80000003);
-2
drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c
··· 433 433 case 0x94: 434 434 case 0x96: 435 435 case 0x98: 436 - case 0xaa: 437 - case 0xac: 438 436 return true; 439 437 default: 440 438 break;
+2 -1
drivers/gpu/drm/radeon/radeon_drv.c
··· 97 97 * 2.46.0 - Add PFP_SYNC_ME support on evergreen 98 98 * 2.47.0 - Add UVD_NO_OP register support 99 99 * 2.48.0 - TA_CS_BC_BASE_ADDR allowed on SI 100 + * 2.49.0 - DRM_RADEON_GEM_INFO ioctl returns correct vram_size/visible values 100 101 */ 101 102 #define KMS_DRIVER_MAJOR 2 102 - #define KMS_DRIVER_MINOR 48 103 + #define KMS_DRIVER_MINOR 49 103 104 #define KMS_DRIVER_PATCHLEVEL 0 104 105 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); 105 106 int radeon_driver_unload_kms(struct drm_device *dev);
+2 -2
drivers/gpu/drm/radeon/radeon_gem.c
··· 220 220 221 221 man = &rdev->mman.bdev.man[TTM_PL_VRAM]; 222 222 223 - args->vram_size = rdev->mc.real_vram_size; 224 - args->vram_visible = (u64)man->size << PAGE_SHIFT; 223 + args->vram_size = (u64)man->size << PAGE_SHIFT; 224 + args->vram_visible = rdev->mc.visible_vram_size; 225 225 args->vram_visible -= rdev->vram_pin_size; 226 226 args->gart_size = rdev->mc.gtt_size; 227 227 args->gart_size -= rdev->gart_pin_size;
+12 -16
drivers/hid/hid-cp2112.c
··· 168 168 atomic_t xfer_avail; 169 169 struct gpio_chip gc; 170 170 u8 *in_out_buffer; 171 - spinlock_t lock; 171 + struct mutex lock; 172 172 173 173 struct gpio_desc *desc[8]; 174 174 bool gpio_poll; ··· 186 186 struct cp2112_device *dev = gpiochip_get_data(chip); 187 187 struct hid_device *hdev = dev->hdev; 188 188 u8 *buf = dev->in_out_buffer; 189 - unsigned long flags; 190 189 int ret; 191 190 192 - spin_lock_irqsave(&dev->lock, flags); 191 + mutex_lock(&dev->lock); 193 192 194 193 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, 195 194 CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, ··· 212 213 ret = 0; 213 214 214 215 exit: 215 - spin_unlock_irqrestore(&dev->lock, flags); 216 - return ret <= 0 ? ret : -EIO; 216 + mutex_unlock(&dev->lock); 217 + return ret < 0 ? ret : -EIO; 217 218 } 218 219 219 220 static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) ··· 221 222 struct cp2112_device *dev = gpiochip_get_data(chip); 222 223 struct hid_device *hdev = dev->hdev; 223 224 u8 *buf = dev->in_out_buffer; 224 - unsigned long flags; 225 225 int ret; 226 226 227 - spin_lock_irqsave(&dev->lock, flags); 227 + mutex_lock(&dev->lock); 228 228 229 229 buf[0] = CP2112_GPIO_SET; 230 230 buf[1] = value ? 0xff : 0; ··· 235 237 if (ret < 0) 236 238 hid_err(hdev, "error setting GPIO values: %d\n", ret); 237 239 238 - spin_unlock_irqrestore(&dev->lock, flags); 240 + mutex_unlock(&dev->lock); 239 241 } 240 242 241 243 static int cp2112_gpio_get_all(struct gpio_chip *chip) ··· 243 245 struct cp2112_device *dev = gpiochip_get_data(chip); 244 246 struct hid_device *hdev = dev->hdev; 245 247 u8 *buf = dev->in_out_buffer; 246 - unsigned long flags; 247 248 int ret; 248 249 249 - spin_lock_irqsave(&dev->lock, flags); 250 + mutex_lock(&dev->lock); 250 251 251 252 ret = hid_hw_raw_request(hdev, CP2112_GPIO_GET, buf, 252 253 CP2112_GPIO_GET_LENGTH, HID_FEATURE_REPORT, ··· 259 262 ret = buf[1]; 260 263 261 264 exit: 262 - spin_unlock_irqrestore(&dev->lock, flags); 265 + mutex_unlock(&dev->lock); 263 266 264 267 return ret; 265 268 } ··· 281 284 struct cp2112_device *dev = gpiochip_get_data(chip); 282 285 struct hid_device *hdev = dev->hdev; 283 286 u8 *buf = dev->in_out_buffer; 284 - unsigned long flags; 285 287 int ret; 286 288 287 - spin_lock_irqsave(&dev->lock, flags); 289 + mutex_lock(&dev->lock); 288 290 289 291 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, 290 292 CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, ··· 304 308 goto fail; 305 309 } 306 310 307 - spin_unlock_irqrestore(&dev->lock, flags); 311 + mutex_unlock(&dev->lock); 308 312 309 313 /* 310 314 * Set gpio value when output direction is already set, ··· 315 319 return 0; 316 320 317 321 fail: 318 - spin_unlock_irqrestore(&dev->lock, flags); 322 + mutex_unlock(&dev->lock); 319 323 return ret < 0 ? ret : -EIO; 320 324 } 321 325 ··· 1231 1235 if (!dev->in_out_buffer) 1232 1236 return -ENOMEM; 1233 1237 1234 - spin_lock_init(&dev->lock); 1238 + mutex_init(&dev->lock); 1235 1239 1236 1240 ret = hid_parse(hdev); 1237 1241 if (ret) {
+3
drivers/hid/hid-ids.h
··· 76 76 #define USB_VENDOR_ID_ALPS_JP 0x044E 77 77 #define HID_DEVICE_ID_ALPS_U1_DUAL 0x120B 78 78 79 + #define USB_VENDOR_ID_AMI 0x046b 80 + #define USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE 0xff10 81 + 79 82 #define USB_VENDOR_ID_ANTON 0x1130 80 83 #define USB_DEVICE_ID_ANTON_TOUCH_PAD 0x3101 81 84
+1 -1
drivers/hid/hid-lg.c
··· 872 872 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG), 873 873 .driver_data = LG_NOGET | LG_FF4 }, 874 874 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2), 875 - .driver_data = LG_FF2 }, 875 + .driver_data = LG_NOGET | LG_FF2 }, 876 876 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940), 877 877 .driver_data = LG_FF3 }, 878 878 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR),
+1
drivers/hid/usbhid/hid-quirks.c
··· 57 57 { USB_VENDOR_ID_AIREN, USB_DEVICE_ID_AIREN_SLIMPLUS, HID_QUIRK_NOGET }, 58 58 { USB_VENDOR_ID_AKAI, USB_DEVICE_ID_AKAI_MPKMINI2, HID_QUIRK_NO_INIT_REPORTS }, 59 59 { USB_VENDOR_ID_AKAI_09E8, USB_DEVICE_ID_AKAI_09E8_MIDIMIX, HID_QUIRK_NO_INIT_REPORTS }, 60 + { USB_VENDOR_ID_AMI, USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE, HID_QUIRK_ALWAYS_POLL }, 60 61 { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET }, 61 62 { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET }, 62 63 { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET },
+13 -11
drivers/hid/wacom_wac.c
··· 166 166 wacom->id[0] = STYLUS_DEVICE_ID; 167 167 } 168 168 169 - pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); 170 - if (features->pressure_max > 255) 171 - pressure = (pressure << 1) | ((data[4] >> 6) & 1); 172 - pressure += (features->pressure_max + 1) / 2; 169 + if (prox) { 170 + pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); 171 + if (features->pressure_max > 255) 172 + pressure = (pressure << 1) | ((data[4] >> 6) & 1); 173 + pressure += (features->pressure_max + 1) / 2; 173 174 174 - input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); 175 - input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); 176 - input_report_abs(input, ABS_PRESSURE, pressure); 175 + input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); 176 + input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); 177 + input_report_abs(input, ABS_PRESSURE, pressure); 177 178 178 - input_report_key(input, BTN_TOUCH, data[4] & 0x08); 179 - input_report_key(input, BTN_STYLUS, data[4] & 0x10); 180 - /* Only allow the stylus2 button to be reported for the pen tool. */ 181 - input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20)); 179 + input_report_key(input, BTN_TOUCH, data[4] & 0x08); 180 + input_report_key(input, BTN_STYLUS, data[4] & 0x10); 181 + /* Only allow the stylus2 button to be reported for the pen tool. */ 182 + input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20)); 183 + } 182 184 183 185 if (!prox) 184 186 wacom->id[0] = 0;
+1
drivers/hv/ring_buffer.c
··· 383 383 return ret; 384 384 } 385 385 386 + init_cached_read_index(channel); 386 387 next_read_location = hv_get_next_read_location(inring_info); 387 388 next_read_location = hv_copyfrom_ringbuffer(inring_info, &desc, 388 389 sizeof(desc),
+2 -2
drivers/iio/adc/palmas_gpadc.c
··· 775 775 776 776 static int palmas_gpadc_suspend(struct device *dev) 777 777 { 778 - struct iio_dev *indio_dev = dev_to_iio_dev(dev); 778 + struct iio_dev *indio_dev = dev_get_drvdata(dev); 779 779 struct palmas_gpadc *adc = iio_priv(indio_dev); 780 780 int wakeup = adc->wakeup1_enable || adc->wakeup2_enable; 781 781 int ret; ··· 798 798 799 799 static int palmas_gpadc_resume(struct device *dev) 800 800 { 801 - struct iio_dev *indio_dev = dev_to_iio_dev(dev); 801 + struct iio_dev *indio_dev = dev_get_drvdata(dev); 802 802 struct palmas_gpadc *adc = iio_priv(indio_dev); 803 803 int wakeup = adc->wakeup1_enable || adc->wakeup2_enable; 804 804 int ret;
+2 -2
drivers/iio/health/afe4403.c
··· 422 422 423 423 static int __maybe_unused afe4403_suspend(struct device *dev) 424 424 { 425 - struct iio_dev *indio_dev = dev_to_iio_dev(dev); 425 + struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev)); 426 426 struct afe4403_data *afe = iio_priv(indio_dev); 427 427 int ret; 428 428 ··· 443 443 444 444 static int __maybe_unused afe4403_resume(struct device *dev) 445 445 { 446 - struct iio_dev *indio_dev = dev_to_iio_dev(dev); 446 + struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev)); 447 447 struct afe4403_data *afe = iio_priv(indio_dev); 448 448 int ret; 449 449
+2 -2
drivers/iio/health/afe4404.c
··· 428 428 429 429 static int __maybe_unused afe4404_suspend(struct device *dev) 430 430 { 431 - struct iio_dev *indio_dev = dev_to_iio_dev(dev); 431 + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); 432 432 struct afe4404_data *afe = iio_priv(indio_dev); 433 433 int ret; 434 434 ··· 449 449 450 450 static int __maybe_unused afe4404_resume(struct device *dev) 451 451 { 452 - struct iio_dev *indio_dev = dev_to_iio_dev(dev); 452 + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); 453 453 struct afe4404_data *afe = iio_priv(indio_dev); 454 454 int ret; 455 455
+1 -1
drivers/iio/health/max30100.c
··· 238 238 239 239 mutex_lock(&data->lock); 240 240 241 - while (cnt || (cnt = max30100_fifo_count(data) > 0)) { 241 + while (cnt || (cnt = max30100_fifo_count(data)) > 0) { 242 242 ret = max30100_read_measurement(data); 243 243 if (ret) 244 244 break;
+4 -2
drivers/iio/humidity/dht11.c
··· 71 71 * a) select an implementation using busy loop polling on those systems 72 72 * b) use the checksum to do some probabilistic decoding 73 73 */ 74 - #define DHT11_START_TRANSMISSION 18 /* ms */ 74 + #define DHT11_START_TRANSMISSION_MIN 18000 /* us */ 75 + #define DHT11_START_TRANSMISSION_MAX 20000 /* us */ 75 76 #define DHT11_MIN_TIMERES 34000 /* ns */ 76 77 #define DHT11_THRESHOLD 49000 /* ns */ 77 78 #define DHT11_AMBIG_LOW 23000 /* ns */ ··· 229 228 ret = gpio_direction_output(dht11->gpio, 0); 230 229 if (ret) 231 230 goto err; 232 - msleep(DHT11_START_TRANSMISSION); 231 + usleep_range(DHT11_START_TRANSMISSION_MIN, 232 + DHT11_START_TRANSMISSION_MAX); 233 233 ret = gpio_direction_input(dht11->gpio); 234 234 if (ret) 235 235 goto err;
+2 -2
drivers/input/rmi4/rmi_driver.c
··· 901 901 data->enabled = true; 902 902 if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) { 903 903 retval = disable_irq_wake(irq); 904 - if (!retval) 904 + if (retval) 905 905 dev_warn(&rmi_dev->dev, 906 906 "Failed to disable irq for wake: %d\n", 907 907 retval); ··· 936 936 disable_irq(irq); 937 937 if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) { 938 938 retval = enable_irq_wake(irq); 939 - if (!retval) 939 + if (retval) 940 940 dev_warn(&rmi_dev->dev, 941 941 "Failed to enable irq for wake: %d\n", 942 942 retval);
+1 -1
drivers/input/touchscreen/wm97xx-core.c
··· 682 682 } 683 683 platform_set_drvdata(wm->battery_dev, wm); 684 684 wm->battery_dev->dev.parent = dev; 685 - wm->battery_dev->dev.platform_data = pdata->batt_pdata; 685 + wm->battery_dev->dev.platform_data = pdata ? pdata->batt_pdata : NULL; 686 686 ret = platform_device_add(wm->battery_dev); 687 687 if (ret < 0) 688 688 goto batt_reg_err;
+2 -1
drivers/mmc/host/sdhci.c
··· 2733 2733 if (intmask & SDHCI_INT_RETUNE) 2734 2734 mmc_retune_needed(host->mmc); 2735 2735 2736 - if (intmask & SDHCI_INT_CARD_INT) { 2736 + if ((intmask & SDHCI_INT_CARD_INT) && 2737 + (host->ier & SDHCI_INT_CARD_INT)) { 2737 2738 sdhci_enable_sdio_irq_nolock(host, false); 2738 2739 host->thread_isr |= SDHCI_INT_CARD_INT; 2739 2740 result = IRQ_WAKE_THREAD;
+43 -2
drivers/net/ethernet/adaptec/starfire.c
··· 1152 1152 if (skb == NULL) 1153 1153 break; 1154 1154 np->rx_info[i].mapping = pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz, PCI_DMA_FROMDEVICE); 1155 + if (pci_dma_mapping_error(np->pci_dev, 1156 + np->rx_info[i].mapping)) { 1157 + dev_kfree_skb(skb); 1158 + np->rx_info[i].skb = NULL; 1159 + break; 1160 + } 1155 1161 /* Grrr, we cannot offset to correctly align the IP header. */ 1156 1162 np->rx_ring[i].rxaddr = cpu_to_dma(np->rx_info[i].mapping | RxDescValid); 1157 1163 } ··· 1188 1182 { 1189 1183 struct netdev_private *np = netdev_priv(dev); 1190 1184 unsigned int entry; 1185 + unsigned int prev_tx; 1191 1186 u32 status; 1192 - int i; 1187 + int i, j; 1193 1188 1194 1189 /* 1195 1190 * be cautious here, wrapping the queue has weird semantics ··· 1208 1201 } 1209 1202 #endif /* ZEROCOPY && HAS_BROKEN_FIRMWARE */ 1210 1203 1204 + prev_tx = np->cur_tx; 1211 1205 entry = np->cur_tx % TX_RING_SIZE; 1212 1206 for (i = 0; i < skb_num_frags(skb); i++) { 1213 1207 int wrap_ring = 0; ··· 1241 1233 skb_frag_address(this_frag), 1242 1234 skb_frag_size(this_frag), 1243 1235 PCI_DMA_TODEVICE); 1236 + } 1237 + if (pci_dma_mapping_error(np->pci_dev, 1238 + np->tx_info[entry].mapping)) { 1239 + dev->stats.tx_dropped++; 1240 + goto err_out; 1244 1241 } 1245 1242 1246 1243 np->tx_ring[entry].addr = cpu_to_dma(np->tx_info[entry].mapping); ··· 1281 1268 netif_stop_queue(dev); 1282 1269 1283 1270 return NETDEV_TX_OK; 1284 - } 1285 1271 1272 + err_out: 1273 + entry = prev_tx % TX_RING_SIZE; 1274 + np->tx_info[entry].skb = NULL; 1275 + if (i > 0) { 1276 + pci_unmap_single(np->pci_dev, 1277 + np->tx_info[entry].mapping, 1278 + skb_first_frag_len(skb), 1279 + PCI_DMA_TODEVICE); 1280 + np->tx_info[entry].mapping = 0; 1281 + entry = (entry + np->tx_info[entry].used_slots) % TX_RING_SIZE; 1282 + for (j = 1; j < i; j++) { 1283 + pci_unmap_single(np->pci_dev, 1284 + np->tx_info[entry].mapping, 1285 + skb_frag_size( 1286 + &skb_shinfo(skb)->frags[j-1]), 1287 + PCI_DMA_TODEVICE); 1288 + entry++; 1289 + } 1290 + } 1291 + dev_kfree_skb_any(skb); 1292 + np->cur_tx = prev_tx; 1293 + return NETDEV_TX_OK; 1294 + } 1286 1295 1287 1296 /* The interrupt handler does all of the Rx thread work and cleans up 1288 1297 after the Tx thread. */ ··· 1604 1569 break; /* Better luck next round. */ 1605 1570 np->rx_info[entry].mapping = 1606 1571 pci_map_single(np->pci_dev, skb->data, np->rx_buf_sz, PCI_DMA_FROMDEVICE); 1572 + if (pci_dma_mapping_error(np->pci_dev, 1573 + np->rx_info[entry].mapping)) { 1574 + dev_kfree_skb(skb); 1575 + np->rx_info[entry].skb = NULL; 1576 + break; 1577 + } 1607 1578 np->rx_ring[entry].rxaddr = 1608 1579 cpu_to_dma(np->rx_info[entry].mapping | RxDescValid); 1609 1580 }
+130 -58
drivers/net/ethernet/cadence/macb.c
··· 43 43 #define DEFAULT_RX_RING_SIZE 512 /* must be power of 2 */ 44 44 #define MIN_RX_RING_SIZE 64 45 45 #define MAX_RX_RING_SIZE 8192 46 - #define RX_RING_BYTES(bp) (sizeof(struct macb_dma_desc) \ 46 + #define RX_RING_BYTES(bp) (macb_dma_desc_get_size(bp) \ 47 47 * (bp)->rx_ring_size) 48 48 49 49 #define DEFAULT_TX_RING_SIZE 512 /* must be power of 2 */ 50 50 #define MIN_TX_RING_SIZE 64 51 51 #define MAX_TX_RING_SIZE 4096 52 - #define TX_RING_BYTES(bp) (sizeof(struct macb_dma_desc) \ 52 + #define TX_RING_BYTES(bp) (macb_dma_desc_get_size(bp) \ 53 53 * (bp)->tx_ring_size) 54 54 55 55 /* level of occupied TX descriptors under which we wake up TX process */ ··· 78 78 */ 79 79 #define MACB_HALT_TIMEOUT 1230 80 80 81 + /* DMA buffer descriptor might be different size 82 + * depends on hardware configuration. 83 + */ 84 + static unsigned int macb_dma_desc_get_size(struct macb *bp) 85 + { 86 + #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 87 + if (bp->hw_dma_cap == HW_DMA_CAP_64B) 88 + return sizeof(struct macb_dma_desc) + sizeof(struct macb_dma_desc_64); 89 + #endif 90 + return sizeof(struct macb_dma_desc); 91 + } 92 + 93 + static unsigned int macb_adj_dma_desc_idx(struct macb *bp, unsigned int idx) 94 + { 95 + #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 96 + /* Dma buffer descriptor is 4 words length (instead of 2 words) 97 + * for 64b GEM. 98 + */ 99 + if (bp->hw_dma_cap == HW_DMA_CAP_64B) 100 + idx <<= 1; 101 + #endif 102 + return idx; 103 + } 104 + 105 + #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 106 + static struct macb_dma_desc_64 *macb_64b_desc(struct macb *bp, struct macb_dma_desc *desc) 107 + { 108 + return (struct macb_dma_desc_64 *)((void *)desc + sizeof(struct macb_dma_desc)); 109 + } 110 + #endif 111 + 81 112 /* Ring buffer accessors */ 82 113 static unsigned int macb_tx_ring_wrap(struct macb *bp, unsigned int index) 83 114 { ··· 118 87 static struct macb_dma_desc *macb_tx_desc(struct macb_queue *queue, 119 88 unsigned int index) 120 89 { 121 - return &queue->tx_ring[macb_tx_ring_wrap(queue->bp, index)]; 90 + index = macb_tx_ring_wrap(queue->bp, index); 91 + index = macb_adj_dma_desc_idx(queue->bp, index); 92 + return &queue->tx_ring[index]; 122 93 } 123 94 124 95 static struct macb_tx_skb *macb_tx_skb(struct macb_queue *queue, ··· 134 101 dma_addr_t offset; 135 102 136 103 offset = macb_tx_ring_wrap(queue->bp, index) * 137 - sizeof(struct macb_dma_desc); 104 + macb_dma_desc_get_size(queue->bp); 138 105 139 106 return queue->tx_ring_dma + offset; 140 107 } ··· 146 113 147 114 static struct macb_dma_desc *macb_rx_desc(struct macb *bp, unsigned int index) 148 115 { 149 - return &bp->rx_ring[macb_rx_ring_wrap(bp, index)]; 116 + index = macb_rx_ring_wrap(bp, index); 117 + index = macb_adj_dma_desc_idx(bp, index); 118 + return &bp->rx_ring[index]; 150 119 } 151 120 152 121 static void *macb_rx_buffer(struct macb *bp, unsigned int index) ··· 595 560 } 596 561 } 597 562 598 - static inline void macb_set_addr(struct macb_dma_desc *desc, dma_addr_t addr) 563 + static void macb_set_addr(struct macb *bp, struct macb_dma_desc *desc, dma_addr_t addr) 599 564 { 600 - desc->addr = (u32)addr; 601 565 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 602 - desc->addrh = (u32)(addr >> 32); 566 + struct macb_dma_desc_64 *desc_64; 567 + 568 + if (bp->hw_dma_cap == HW_DMA_CAP_64B) { 569 + desc_64 = macb_64b_desc(bp, desc); 570 + desc_64->addrh = upper_32_bits(addr); 571 + } 603 572 #endif 573 + desc->addr = lower_32_bits(addr); 574 + } 575 + 576 + static dma_addr_t macb_get_addr(struct macb *bp, struct macb_dma_desc *desc) 577 + { 578 + dma_addr_t addr = 0; 579 + #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 580 + struct macb_dma_desc_64 *desc_64; 581 + 582 + if (bp->hw_dma_cap == HW_DMA_CAP_64B) { 583 + desc_64 = macb_64b_desc(bp, desc); 584 + addr = ((u64)(desc_64->addrh) << 32); 585 + } 586 + #endif 587 + addr |= MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, desc->addr)); 588 + return addr; 604 589 } 605 590 606 591 static void macb_tx_error_task(struct work_struct *work) ··· 704 649 705 650 /* Set end of TX queue */ 706 651 desc = macb_tx_desc(queue, 0); 707 - macb_set_addr(desc, 0); 652 + macb_set_addr(bp, desc, 0); 708 653 desc->ctrl = MACB_BIT(TX_USED); 709 654 710 655 /* Make descriptor updates visible to hardware */ 711 656 wmb(); 712 657 713 658 /* Reinitialize the TX desc queue */ 714 - queue_writel(queue, TBQP, (u32)(queue->tx_ring_dma)); 659 + queue_writel(queue, TBQP, lower_32_bits(queue->tx_ring_dma)); 715 660 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 716 - queue_writel(queue, TBQPH, (u32)(queue->tx_ring_dma >> 32)); 661 + if (bp->hw_dma_cap == HW_DMA_CAP_64B) 662 + queue_writel(queue, TBQPH, upper_32_bits(queue->tx_ring_dma)); 717 663 #endif 718 664 /* Make TX ring reflect state of hardware */ 719 665 queue->tx_head = 0; ··· 806 750 unsigned int entry; 807 751 struct sk_buff *skb; 808 752 dma_addr_t paddr; 753 + struct macb_dma_desc *desc; 809 754 810 755 while (CIRC_SPACE(bp->rx_prepared_head, bp->rx_tail, 811 756 bp->rx_ring_size) > 0) { ··· 816 759 rmb(); 817 760 818 761 bp->rx_prepared_head++; 762 + desc = macb_rx_desc(bp, entry); 819 763 820 764 if (!bp->rx_skbuff[entry]) { 821 765 /* allocate sk_buff for this free entry in ring */ ··· 840 782 841 783 if (entry == bp->rx_ring_size - 1) 842 784 paddr |= MACB_BIT(RX_WRAP); 843 - macb_set_addr(&(bp->rx_ring[entry]), paddr); 844 - bp->rx_ring[entry].ctrl = 0; 785 + macb_set_addr(bp, desc, paddr); 786 + desc->ctrl = 0; 845 787 846 788 /* properly align Ethernet header */ 847 789 skb_reserve(skb, NET_IP_ALIGN); 848 790 } else { 849 - bp->rx_ring[entry].addr &= ~MACB_BIT(RX_USED); 850 - bp->rx_ring[entry].ctrl = 0; 791 + desc->addr &= ~MACB_BIT(RX_USED); 792 + desc->ctrl = 0; 851 793 } 852 794 } 853 795 ··· 893 835 bool rxused; 894 836 895 837 entry = macb_rx_ring_wrap(bp, bp->rx_tail); 896 - desc = &bp->rx_ring[entry]; 838 + desc = macb_rx_desc(bp, entry); 897 839 898 840 /* Make hw descriptor updates visible to CPU */ 899 841 rmb(); 900 842 901 843 rxused = (desc->addr & MACB_BIT(RX_USED)) ? true : false; 902 - addr = MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, desc->addr)); 903 - #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 904 - addr |= ((u64)(desc->addrh) << 32); 905 - #endif 844 + addr = macb_get_addr(bp, desc); 906 845 ctrl = desc->ctrl; 907 846 908 847 if (!rxused) ··· 1042 987 static inline void macb_init_rx_ring(struct macb *bp) 1043 988 { 1044 989 dma_addr_t addr; 990 + struct macb_dma_desc *desc = NULL; 1045 991 int i; 1046 992 1047 993 addr = bp->rx_buffers_dma; 1048 994 for (i = 0; i < bp->rx_ring_size; i++) { 1049 - bp->rx_ring[i].addr = addr; 1050 - bp->rx_ring[i].ctrl = 0; 995 + desc = macb_rx_desc(bp, i); 996 + macb_set_addr(bp, desc, addr); 997 + desc->ctrl = 0; 1051 998 addr += bp->rx_buffer_size; 1052 999 } 1053 - bp->rx_ring[bp->rx_ring_size - 1].addr |= MACB_BIT(RX_WRAP); 1000 + desc->addr |= MACB_BIT(RX_WRAP); 1054 1001 bp->rx_tail = 0; 1055 1002 } 1056 1003 ··· 1065 1008 1066 1009 for (tail = bp->rx_tail; budget > 0; tail++) { 1067 1010 struct macb_dma_desc *desc = macb_rx_desc(bp, tail); 1068 - u32 addr, ctrl; 1011 + u32 ctrl; 1069 1012 1070 1013 /* Make hw descriptor updates visible to CPU */ 1071 1014 rmb(); 1072 1015 1073 - addr = desc->addr; 1074 1016 ctrl = desc->ctrl; 1075 1017 1076 - if (!(addr & MACB_BIT(RX_USED))) 1018 + if (!(desc->addr & MACB_BIT(RX_USED))) 1077 1019 break; 1078 1020 1079 1021 if (ctrl & MACB_BIT(RX_SOF)) { ··· 1392 1336 i = tx_head; 1393 1337 entry = macb_tx_ring_wrap(bp, i); 1394 1338 ctrl = MACB_BIT(TX_USED); 1395 - desc = &queue->tx_ring[entry]; 1339 + desc = macb_tx_desc(queue, entry); 1396 1340 desc->ctrl = ctrl; 1397 1341 1398 1342 if (lso_ctrl) { ··· 1414 1358 i--; 1415 1359 entry = macb_tx_ring_wrap(bp, i); 1416 1360 tx_skb = &queue->tx_skb[entry]; 1417 - desc = &queue->tx_ring[entry]; 1361 + desc = macb_tx_desc(queue, entry); 1418 1362 1419 1363 ctrl = (u32)tx_skb->size; 1420 1364 if (eof) { ··· 1435 1379 ctrl |= MACB_BF(MSS_MFS, mss_mfs); 1436 1380 1437 1381 /* Set TX buffer descriptor */ 1438 - macb_set_addr(desc, tx_skb->mapping); 1382 + macb_set_addr(bp, desc, tx_skb->mapping); 1439 1383 /* desc->addr must be visible to hardware before clearing 1440 1384 * 'TX_USED' bit in desc->ctrl. 1441 1385 */ ··· 1642 1586 if (!skb) 1643 1587 continue; 1644 1588 1645 - desc = &bp->rx_ring[i]; 1646 - addr = MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, desc->addr)); 1647 - #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 1648 - addr |= ((u64)(desc->addrh) << 32); 1649 - #endif 1589 + desc = macb_rx_desc(bp, i); 1590 + addr = macb_get_addr(bp, desc); 1591 + 1650 1592 dma_unmap_single(&bp->pdev->dev, addr, bp->rx_buffer_size, 1651 1593 DMA_FROM_DEVICE); 1652 1594 dev_kfree_skb_any(skb); ··· 1765 1711 static void gem_init_rings(struct macb *bp) 1766 1712 { 1767 1713 struct macb_queue *queue; 1714 + struct macb_dma_desc *desc = NULL; 1768 1715 unsigned int q; 1769 1716 int i; 1770 1717 1771 1718 for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { 1772 1719 for (i = 0; i < bp->tx_ring_size; i++) { 1773 - queue->tx_ring[i].addr = 0; 1774 - queue->tx_ring[i].ctrl = MACB_BIT(TX_USED); 1720 + desc = macb_tx_desc(queue, i); 1721 + macb_set_addr(bp, desc, 0); 1722 + desc->ctrl = MACB_BIT(TX_USED); 1775 1723 } 1776 - queue->tx_ring[bp->tx_ring_size - 1].ctrl |= MACB_BIT(TX_WRAP); 1724 + desc->ctrl |= MACB_BIT(TX_WRAP); 1777 1725 queue->tx_head = 0; 1778 1726 queue->tx_tail = 0; 1779 1727 } ··· 1789 1733 static void macb_init_rings(struct macb *bp) 1790 1734 { 1791 1735 int i; 1736 + struct macb_dma_desc *desc = NULL; 1792 1737 1793 1738 macb_init_rx_ring(bp); 1794 1739 1795 1740 for (i = 0; i < bp->tx_ring_size; i++) { 1796 - bp->queues[0].tx_ring[i].addr = 0; 1797 - bp->queues[0].tx_ring[i].ctrl = MACB_BIT(TX_USED); 1741 + desc = macb_tx_desc(&bp->queues[0], i); 1742 + macb_set_addr(bp, desc, 0); 1743 + desc->ctrl = MACB_BIT(TX_USED); 1798 1744 } 1799 1745 bp->queues[0].tx_head = 0; 1800 1746 bp->queues[0].tx_tail = 0; 1801 - bp->queues[0].tx_ring[bp->tx_ring_size - 1].ctrl |= MACB_BIT(TX_WRAP); 1747 + desc->ctrl |= MACB_BIT(TX_WRAP); 1802 1748 } 1803 1749 1804 1750 static void macb_reset_hw(struct macb *bp) ··· 1921 1863 dmacfg &= ~GEM_BIT(TXCOEN); 1922 1864 1923 1865 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 1924 - dmacfg |= GEM_BIT(ADDR64); 1866 + if (bp->hw_dma_cap == HW_DMA_CAP_64B) 1867 + dmacfg |= GEM_BIT(ADDR64); 1925 1868 #endif 1926 1869 netdev_dbg(bp->dev, "Cadence configure DMA with 0x%08x\n", 1927 1870 dmacfg); ··· 1969 1910 macb_configure_dma(bp); 1970 1911 1971 1912 /* Initialize TX and RX buffers */ 1972 - macb_writel(bp, RBQP, (u32)(bp->rx_ring_dma)); 1913 + macb_writel(bp, RBQP, lower_32_bits(bp->rx_ring_dma)); 1973 1914 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 1974 - macb_writel(bp, RBQPH, (u32)(bp->rx_ring_dma >> 32)); 1915 + if (bp->hw_dma_cap == HW_DMA_CAP_64B) 1916 + macb_writel(bp, RBQPH, upper_32_bits(bp->rx_ring_dma)); 1975 1917 #endif 1976 1918 for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { 1977 - queue_writel(queue, TBQP, (u32)(queue->tx_ring_dma)); 1919 + queue_writel(queue, TBQP, lower_32_bits(queue->tx_ring_dma)); 1978 1920 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 1979 - queue_writel(queue, TBQPH, (u32)(queue->tx_ring_dma >> 32)); 1921 + if (bp->hw_dma_cap == HW_DMA_CAP_64B) 1922 + queue_writel(queue, TBQPH, upper_32_bits(queue->tx_ring_dma)); 1980 1923 #endif 1981 1924 1982 1925 /* Enable interrupts */ ··· 2688 2627 queue->IMR = GEM_IMR(hw_q - 1); 2689 2628 queue->TBQP = GEM_TBQP(hw_q - 1); 2690 2629 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 2691 - queue->TBQPH = GEM_TBQPH(hw_q -1); 2630 + if (bp->hw_dma_cap == HW_DMA_CAP_64B) 2631 + queue->TBQPH = GEM_TBQPH(hw_q - 1); 2692 2632 #endif 2693 2633 } else { 2694 2634 /* queue0 uses legacy registers */ ··· 2699 2637 queue->IMR = MACB_IMR; 2700 2638 queue->TBQP = MACB_TBQP; 2701 2639 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 2702 - queue->TBQPH = MACB_TBQPH; 2640 + if (bp->hw_dma_cap == HW_DMA_CAP_64B) 2641 + queue->TBQPH = MACB_TBQPH; 2703 2642 #endif 2704 2643 } 2705 2644 ··· 2793 2730 static int at91ether_start(struct net_device *dev) 2794 2731 { 2795 2732 struct macb *lp = netdev_priv(dev); 2733 + struct macb_dma_desc *desc; 2796 2734 dma_addr_t addr; 2797 2735 u32 ctl; 2798 2736 int i; 2799 2737 2800 2738 lp->rx_ring = dma_alloc_coherent(&lp->pdev->dev, 2801 2739 (AT91ETHER_MAX_RX_DESCR * 2802 - sizeof(struct macb_dma_desc)), 2740 + macb_dma_desc_get_size(lp)), 2803 2741 &lp->rx_ring_dma, GFP_KERNEL); 2804 2742 if (!lp->rx_ring) 2805 2743 return -ENOMEM; ··· 2812 2748 if (!lp->rx_buffers) { 2813 2749 dma_free_coherent(&lp->pdev->dev, 2814 2750 AT91ETHER_MAX_RX_DESCR * 2815 - sizeof(struct macb_dma_desc), 2751 + macb_dma_desc_get_size(lp), 2816 2752 lp->rx_ring, lp->rx_ring_dma); 2817 2753 lp->rx_ring = NULL; 2818 2754 return -ENOMEM; ··· 2820 2756 2821 2757 addr = lp->rx_buffers_dma; 2822 2758 for (i = 0; i < AT91ETHER_MAX_RX_DESCR; i++) { 2823 - lp->rx_ring[i].addr = addr; 2824 - lp->rx_ring[i].ctrl = 0; 2759 + desc = macb_rx_desc(lp, i); 2760 + macb_set_addr(lp, desc, addr); 2761 + desc->ctrl = 0; 2825 2762 addr += AT91ETHER_MAX_RBUFF_SZ; 2826 2763 } 2827 2764 2828 2765 /* Set the Wrap bit on the last descriptor */ 2829 - lp->rx_ring[AT91ETHER_MAX_RX_DESCR - 1].addr |= MACB_BIT(RX_WRAP); 2766 + desc->addr |= MACB_BIT(RX_WRAP); 2830 2767 2831 2768 /* Reset buffer index */ 2832 2769 lp->rx_tail = 0; ··· 2899 2834 2900 2835 dma_free_coherent(&lp->pdev->dev, 2901 2836 AT91ETHER_MAX_RX_DESCR * 2902 - sizeof(struct macb_dma_desc), 2837 + macb_dma_desc_get_size(lp), 2903 2838 lp->rx_ring, lp->rx_ring_dma); 2904 2839 lp->rx_ring = NULL; 2905 2840 ··· 2950 2885 static void at91ether_rx(struct net_device *dev) 2951 2886 { 2952 2887 struct macb *lp = netdev_priv(dev); 2888 + struct macb_dma_desc *desc; 2953 2889 unsigned char *p_recv; 2954 2890 struct sk_buff *skb; 2955 2891 unsigned int pktlen; 2956 2892 2957 - while (lp->rx_ring[lp->rx_tail].addr & MACB_BIT(RX_USED)) { 2893 + desc = macb_rx_desc(lp, lp->rx_tail); 2894 + while (desc->addr & MACB_BIT(RX_USED)) { 2958 2895 p_recv = lp->rx_buffers + lp->rx_tail * AT91ETHER_MAX_RBUFF_SZ; 2959 - pktlen = MACB_BF(RX_FRMLEN, lp->rx_ring[lp->rx_tail].ctrl); 2896 + pktlen = MACB_BF(RX_FRMLEN, desc->ctrl); 2960 2897 skb = netdev_alloc_skb(dev, pktlen + 2); 2961 2898 if (skb) { 2962 2899 skb_reserve(skb, 2); ··· 2972 2905 lp->stats.rx_dropped++; 2973 2906 } 2974 2907 2975 - if (lp->rx_ring[lp->rx_tail].ctrl & MACB_BIT(RX_MHASH_MATCH)) 2908 + if (desc->ctrl & MACB_BIT(RX_MHASH_MATCH)) 2976 2909 lp->stats.multicast++; 2977 2910 2978 2911 /* reset ownership bit */ 2979 - lp->rx_ring[lp->rx_tail].addr &= ~MACB_BIT(RX_USED); 2912 + desc->addr &= ~MACB_BIT(RX_USED); 2980 2913 2981 2914 /* wrap after last buffer */ 2982 2915 if (lp->rx_tail == AT91ETHER_MAX_RX_DESCR - 1) 2983 2916 lp->rx_tail = 0; 2984 2917 else 2985 2918 lp->rx_tail++; 2919 + 2920 + desc = macb_rx_desc(lp, lp->rx_tail); 2986 2921 } 2987 2922 } 2988 2923 ··· 3280 3211 device_init_wakeup(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET); 3281 3212 3282 3213 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 3283 - if (GEM_BFEXT(DBWDEF, gem_readl(bp, DCFG1)) > GEM_DBW32) 3214 + if (GEM_BFEXT(DAW64, gem_readl(bp, DCFG6))) { 3284 3215 dma_set_mask(&pdev->dev, DMA_BIT_MASK(44)); 3216 + bp->hw_dma_cap = HW_DMA_CAP_64B; 3217 + } else 3218 + bp->hw_dma_cap = HW_DMA_CAP_32B; 3285 3219 #endif 3286 3220 3287 3221 spin_lock_init(&bp->lock);
+18 -4
drivers/net/ethernet/cadence/macb.h
··· 385 385 /* Bitfields in DCFG6. */ 386 386 #define GEM_PBUF_LSO_OFFSET 27 387 387 #define GEM_PBUF_LSO_SIZE 1 388 + #define GEM_DAW64_OFFSET 23 389 + #define GEM_DAW64_SIZE 1 388 390 389 391 /* Constants for CLK */ 390 392 #define MACB_CLK_DIV8 0 ··· 489 487 struct macb_dma_desc { 490 488 u32 addr; 491 489 u32 ctrl; 492 - #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 493 - u32 addrh; 494 - u32 resvd; 495 - #endif 496 490 }; 491 + 492 + #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 493 + enum macb_hw_dma_cap { 494 + HW_DMA_CAP_32B, 495 + HW_DMA_CAP_64B, 496 + }; 497 + 498 + struct macb_dma_desc_64 { 499 + u32 addrh; 500 + u32 resvd; 501 + }; 502 + #endif 497 503 498 504 /* DMA descriptor bitfields */ 499 505 #define MACB_RX_USED_OFFSET 0 ··· 884 874 unsigned int jumbo_max_len; 885 875 886 876 u32 wol; 877 + 878 + #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 879 + enum macb_hw_dma_cap hw_dma_cap; 880 + #endif 887 881 }; 888 882 889 883 static inline bool macb_is_gem(struct macb *bp)
+1 -2
drivers/net/ethernet/cavium/thunder/thunder_xcv.c
··· 116 116 int speed = 2; 117 117 118 118 if (!xcv) { 119 - dev_err(&xcv->pdev->dev, 120 - "XCV init not done, probe may have failed\n"); 119 + pr_err("XCV init not done, probe may have failed\n"); 121 120 return; 122 121 } 123 122
+28 -5
drivers/net/ethernet/emulex/benet/be_main.c
··· 362 362 status = -EPERM; 363 363 goto err; 364 364 } 365 - done: 365 + 366 + /* Remember currently programmed MAC */ 366 367 ether_addr_copy(adapter->dev_mac, addr->sa_data); 368 + done: 367 369 ether_addr_copy(netdev->dev_addr, addr->sa_data); 368 370 dev_info(dev, "MAC address changed to %pM\n", addr->sa_data); 369 371 return 0; ··· 3620 3618 { 3621 3619 /* Don't delete MAC on BE3 VFs without FILTMGMT privilege */ 3622 3620 if (!BEx_chip(adapter) || !be_virtfn(adapter) || 3623 - check_privilege(adapter, BE_PRIV_FILTMGMT)) 3621 + check_privilege(adapter, BE_PRIV_FILTMGMT)) { 3624 3622 be_dev_mac_del(adapter, adapter->pmac_id[0]); 3623 + eth_zero_addr(adapter->dev_mac); 3624 + } 3625 3625 3626 3626 be_clear_uc_list(adapter); 3627 3627 be_clear_mc_list(adapter); ··· 3777 3773 if (status) 3778 3774 return status; 3779 3775 3780 - /* Don't add MAC on BE3 VFs without FILTMGMT privilege */ 3781 - if (!BEx_chip(adapter) || !be_virtfn(adapter) || 3782 - check_privilege(adapter, BE_PRIV_FILTMGMT)) { 3776 + /* Normally this condition usually true as the ->dev_mac is zeroed. 3777 + * But on BE3 VFs the initial MAC is pre-programmed by PF and 3778 + * subsequent be_dev_mac_add() can fail (after fresh boot) 3779 + */ 3780 + if (!ether_addr_equal(adapter->dev_mac, adapter->netdev->dev_addr)) { 3781 + int old_pmac_id = -1; 3782 + 3783 + /* Remember old programmed MAC if any - can happen on BE3 VF */ 3784 + if (!is_zero_ether_addr(adapter->dev_mac)) 3785 + old_pmac_id = adapter->pmac_id[0]; 3786 + 3783 3787 status = be_dev_mac_add(adapter, adapter->netdev->dev_addr); 3784 3788 if (status) 3785 3789 return status; 3790 + 3791 + /* Delete the old programmed MAC as we successfully programmed 3792 + * a new MAC 3793 + */ 3794 + if (old_pmac_id >= 0 && old_pmac_id != adapter->pmac_id[0]) 3795 + be_dev_mac_del(adapter, old_pmac_id); 3796 + 3786 3797 ether_addr_copy(adapter->dev_mac, adapter->netdev->dev_addr); 3787 3798 } 3788 3799 ··· 4571 4552 4572 4553 memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN); 4573 4554 memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN); 4555 + 4556 + /* Initial MAC for BE3 VFs is already programmed by PF */ 4557 + if (BEx_chip(adapter) && be_virtfn(adapter)) 4558 + memcpy(adapter->dev_mac, mac, ETH_ALEN); 4574 4559 } 4575 4560 4576 4561 return 0;
+2 -2
drivers/net/ethernet/freescale/gianfar.c
··· 2010 2010 if (!rxb->page) 2011 2011 continue; 2012 2012 2013 - dma_unmap_single(rx_queue->dev, rxb->dma, 2014 - PAGE_SIZE, DMA_FROM_DEVICE); 2013 + dma_unmap_page(rx_queue->dev, rxb->dma, 2014 + PAGE_SIZE, DMA_FROM_DEVICE); 2015 2015 __free_page(rxb->page); 2016 2016 2017 2017 rxb->page = NULL;
+1 -1
drivers/net/ethernet/mellanox/mlx4/catas.c
··· 158 158 return -ETIMEDOUT; 159 159 } 160 160 161 - static int mlx4_comm_internal_err(u32 slave_read) 161 + int mlx4_comm_internal_err(u32 slave_read) 162 162 { 163 163 return (u32)COMM_CHAN_EVENT_INTERNAL_ERR == 164 164 (slave_read & (u32)COMM_CHAN_EVENT_INTERNAL_ERR) ? 1 : 0;
+12
drivers/net/ethernet/mellanox/mlx4/intf.c
··· 222 222 return; 223 223 224 224 mlx4_stop_catas_poll(dev); 225 + if (dev->persist->interface_state & MLX4_INTERFACE_STATE_DELETION && 226 + mlx4_is_slave(dev)) { 227 + /* In mlx4_remove_one on a VF */ 228 + u32 slave_read = 229 + swab32(readl(&mlx4_priv(dev)->mfunc.comm->slave_read)); 230 + 231 + if (mlx4_comm_internal_err(slave_read)) { 232 + mlx4_dbg(dev, "%s: comm channel is down, entering error state.\n", 233 + __func__); 234 + mlx4_enter_error_state(dev->persist); 235 + } 236 + } 225 237 mutex_lock(&intf_mutex); 226 238 227 239 list_for_each_entry(intf, &intf_list, list)
+1
drivers/net/ethernet/mellanox/mlx4/mlx4.h
··· 1220 1220 void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type); 1221 1221 1222 1222 void mlx4_enter_error_state(struct mlx4_dev_persistent *persist); 1223 + int mlx4_comm_internal_err(u32 slave_read); 1223 1224 1224 1225 int mlx4_SENSE_PORT(struct mlx4_dev *dev, int port, 1225 1226 enum mlx4_port_type *type);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
··· 1728 1728 if (cmd->cmdif_rev > CMD_IF_REV) { 1729 1729 dev_err(&dev->pdev->dev, "driver does not support command interface version. driver %d, firmware %d\n", 1730 1730 CMD_IF_REV, cmd->cmdif_rev); 1731 - err = -ENOTSUPP; 1731 + err = -EOPNOTSUPP; 1732 1732 goto err_free_page; 1733 1733 } 1734 1734
+4 -3
drivers/net/ethernet/mellanox/mlx5/core/en.h
··· 791 791 int mlx5e_modify_rqs_vsd(struct mlx5e_priv *priv, bool vsd); 792 792 793 793 int mlx5e_redirect_rqt(struct mlx5e_priv *priv, u32 rqtn, int sz, int ix); 794 - void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv); 794 + void mlx5e_build_indir_tir_ctx_hash(struct mlx5e_priv *priv, void *tirc, 795 + enum mlx5e_traffic_types tt); 795 796 796 797 int mlx5e_open_locked(struct net_device *netdev); 797 798 int mlx5e_close_locked(struct net_device *netdev); ··· 864 863 865 864 static inline int mlx5e_arfs_enable(struct mlx5e_priv *priv) 866 865 { 867 - return -ENOTSUPP; 866 + return -EOPNOTSUPP; 868 867 } 869 868 870 869 static inline int mlx5e_arfs_disable(struct mlx5e_priv *priv) 871 870 { 872 - return -ENOTSUPP; 871 + return -EOPNOTSUPP; 873 872 } 874 873 #else 875 874 int mlx5e_arfs_create_tables(struct mlx5e_priv *priv);
+8 -3
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
··· 89 89 int i; 90 90 91 91 if (!MLX5_CAP_GEN(priv->mdev, ets)) 92 - return -ENOTSUPP; 92 + return -EOPNOTSUPP; 93 93 94 94 ets->ets_cap = mlx5_max_tc(priv->mdev) + 1; 95 95 for (i = 0; i < ets->ets_cap; i++) { ··· 236 236 int err; 237 237 238 238 if (!MLX5_CAP_GEN(priv->mdev, ets)) 239 - return -ENOTSUPP; 239 + return -EOPNOTSUPP; 240 240 241 241 err = mlx5e_dbcnl_validate_ets(netdev, ets); 242 242 if (err) ··· 402 402 struct mlx5_core_dev *mdev = priv->mdev; 403 403 struct ieee_ets ets; 404 404 struct ieee_pfc pfc; 405 - int err = -ENOTSUPP; 405 + int err = -EOPNOTSUPP; 406 406 int i; 407 407 408 408 if (!MLX5_CAP_GEN(mdev, ets)) ··· 510 510 { 511 511 struct mlx5e_priv *priv = netdev_priv(netdev); 512 512 struct mlx5_core_dev *mdev = priv->mdev; 513 + 514 + if (!MLX5_CAP_GEN(priv->mdev, ets)) { 515 + netdev_err(netdev, "%s, ets is not supported\n", __func__); 516 + return; 517 + } 513 518 514 519 if (priority >= CEE_DCBX_MAX_PRIO) { 515 520 netdev_err(netdev,
+26 -15
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
··· 595 595 struct mlx5e_priv *priv = netdev_priv(netdev); 596 596 597 597 if (!MLX5_CAP_GEN(priv->mdev, cq_moderation)) 598 - return -ENOTSUPP; 598 + return -EOPNOTSUPP; 599 599 600 600 coal->rx_coalesce_usecs = priv->params.rx_cq_moderation.usec; 601 601 coal->rx_max_coalesced_frames = priv->params.rx_cq_moderation.pkts; ··· 620 620 int i; 621 621 622 622 if (!MLX5_CAP_GEN(mdev, cq_moderation)) 623 - return -ENOTSUPP; 623 + return -EOPNOTSUPP; 624 624 625 625 mutex_lock(&priv->state_lock); 626 626 ··· 980 980 981 981 static void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen) 982 982 { 983 - struct mlx5_core_dev *mdev = priv->mdev; 984 983 void *tirc = MLX5_ADDR_OF(modify_tir_in, in, ctx); 985 - int i; 984 + struct mlx5_core_dev *mdev = priv->mdev; 985 + int ctxlen = MLX5_ST_SZ_BYTES(tirc); 986 + int tt; 986 987 987 988 MLX5_SET(modify_tir_in, in, bitmask.hash, 1); 988 - mlx5e_build_tir_ctx_hash(tirc, priv); 989 989 990 - for (i = 0; i < MLX5E_NUM_INDIR_TIRS; i++) 991 - mlx5_core_modify_tir(mdev, priv->indir_tir[i].tirn, in, inlen); 990 + for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) { 991 + memset(tirc, 0, ctxlen); 992 + mlx5e_build_indir_tir_ctx_hash(priv, tirc, tt); 993 + mlx5_core_modify_tir(mdev, priv->indir_tir[tt].tirn, in, inlen); 994 + } 992 995 } 993 996 994 997 static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, ··· 999 996 { 1000 997 struct mlx5e_priv *priv = netdev_priv(dev); 1001 998 int inlen = MLX5_ST_SZ_BYTES(modify_tir_in); 999 + bool hash_changed = false; 1002 1000 void *in; 1003 1001 1004 1002 if ((hfunc != ETH_RSS_HASH_NO_CHANGE) && ··· 1021 1017 mlx5e_redirect_rqt(priv, rqtn, MLX5E_INDIR_RQT_SIZE, 0); 1022 1018 } 1023 1019 1024 - if (key) 1020 + if (hfunc != ETH_RSS_HASH_NO_CHANGE && 1021 + hfunc != priv->params.rss_hfunc) { 1022 + priv->params.rss_hfunc = hfunc; 1023 + hash_changed = true; 1024 + } 1025 + 1026 + if (key) { 1025 1027 memcpy(priv->params.toeplitz_hash_key, key, 1026 1028 sizeof(priv->params.toeplitz_hash_key)); 1029 + hash_changed = hash_changed || 1030 + priv->params.rss_hfunc == ETH_RSS_HASH_TOP; 1031 + } 1027 1032 1028 - if (hfunc != ETH_RSS_HASH_NO_CHANGE) 1029 - priv->params.rss_hfunc = hfunc; 1030 - 1031 - mlx5e_modify_tirs_hash(priv, in, inlen); 1033 + if (hash_changed) 1034 + mlx5e_modify_tirs_hash(priv, in, inlen); 1032 1035 1033 1036 mutex_unlock(&priv->state_lock); 1034 1037 ··· 1307 1296 u32 mlx5_wol_mode; 1308 1297 1309 1298 if (!wol_supported) 1310 - return -ENOTSUPP; 1299 + return -EOPNOTSUPP; 1311 1300 1312 1301 if (wol->wolopts & ~wol_supported) 1313 1302 return -EINVAL; ··· 1437 1426 1438 1427 if (rx_cq_period_mode == MLX5_CQ_PERIOD_MODE_START_FROM_CQE && 1439 1428 !MLX5_CAP_GEN(mdev, cq_period_start_from_cqe)) 1440 - return -ENOTSUPP; 1429 + return -EOPNOTSUPP; 1441 1430 1442 1431 if (!rx_mode_changed) 1443 1432 return 0; ··· 1463 1452 bool reset; 1464 1453 1465 1454 if (!MLX5_CAP_GEN(mdev, cqe_compression)) 1466 - return -ENOTSUPP; 1455 + return -EOPNOTSUPP; 1467 1456 1468 1457 if (enable && priv->tstamp.hwtstamp_config.rx_filter != HWTSTAMP_FILTER_NONE) { 1469 1458 netdev_err(netdev, "Can't enable cqe compression while timestamping is enabled.\n");
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
··· 1089 1089 MLX5_FLOW_NAMESPACE_KERNEL); 1090 1090 1091 1091 if (!priv->fs.ns) 1092 - return -EINVAL; 1092 + return -EOPNOTSUPP; 1093 1093 1094 1094 err = mlx5e_arfs_create_tables(priv); 1095 1095 if (err) {
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
··· 92 92 ns = mlx5_get_flow_namespace(priv->mdev, 93 93 MLX5_FLOW_NAMESPACE_ETHTOOL); 94 94 if (!ns) 95 - return ERR_PTR(-ENOTSUPP); 95 + return ERR_PTR(-EOPNOTSUPP); 96 96 97 97 table_size = min_t(u32, BIT(MLX5_CAP_FLOWTABLE(priv->mdev, 98 98 flow_table_properties_nic_receive.log_max_ft_size)),
+101 -101
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 2022 2022 MLX5_SET(tirc, tirc, lro_timeout_period_usecs, priv->params.lro_timeout); 2023 2023 } 2024 2024 2025 - void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv) 2025 + void mlx5e_build_indir_tir_ctx_hash(struct mlx5e_priv *priv, void *tirc, 2026 + enum mlx5e_traffic_types tt) 2026 2027 { 2028 + void *hfso = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_outer); 2029 + 2030 + #define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP |\ 2031 + MLX5_HASH_FIELD_SEL_DST_IP) 2032 + 2033 + #define MLX5_HASH_IP_L4PORTS (MLX5_HASH_FIELD_SEL_SRC_IP |\ 2034 + MLX5_HASH_FIELD_SEL_DST_IP |\ 2035 + MLX5_HASH_FIELD_SEL_L4_SPORT |\ 2036 + MLX5_HASH_FIELD_SEL_L4_DPORT) 2037 + 2038 + #define MLX5_HASH_IP_IPSEC_SPI (MLX5_HASH_FIELD_SEL_SRC_IP |\ 2039 + MLX5_HASH_FIELD_SEL_DST_IP |\ 2040 + MLX5_HASH_FIELD_SEL_IPSEC_SPI) 2041 + 2027 2042 MLX5_SET(tirc, tirc, rx_hash_fn, 2028 2043 mlx5e_rx_hash_fn(priv->params.rss_hfunc)); 2029 2044 if (priv->params.rss_hfunc == ETH_RSS_HASH_TOP) { ··· 2049 2034 2050 2035 MLX5_SET(tirc, tirc, rx_hash_symmetric, 1); 2051 2036 memcpy(rss_key, priv->params.toeplitz_hash_key, len); 2037 + } 2038 + 2039 + switch (tt) { 2040 + case MLX5E_TT_IPV4_TCP: 2041 + MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2042 + MLX5_L3_PROT_TYPE_IPV4); 2043 + MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, 2044 + MLX5_L4_PROT_TYPE_TCP); 2045 + MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2046 + MLX5_HASH_IP_L4PORTS); 2047 + break; 2048 + 2049 + case MLX5E_TT_IPV6_TCP: 2050 + MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2051 + MLX5_L3_PROT_TYPE_IPV6); 2052 + MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, 2053 + MLX5_L4_PROT_TYPE_TCP); 2054 + MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2055 + MLX5_HASH_IP_L4PORTS); 2056 + break; 2057 + 2058 + case MLX5E_TT_IPV4_UDP: 2059 + MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2060 + MLX5_L3_PROT_TYPE_IPV4); 2061 + MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, 2062 + MLX5_L4_PROT_TYPE_UDP); 2063 + MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2064 + MLX5_HASH_IP_L4PORTS); 2065 + break; 2066 + 2067 + case MLX5E_TT_IPV6_UDP: 2068 + MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2069 + MLX5_L3_PROT_TYPE_IPV6); 2070 + MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, 2071 + MLX5_L4_PROT_TYPE_UDP); 2072 + MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2073 + MLX5_HASH_IP_L4PORTS); 2074 + break; 2075 + 2076 + case MLX5E_TT_IPV4_IPSEC_AH: 2077 + MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2078 + MLX5_L3_PROT_TYPE_IPV4); 2079 + MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2080 + MLX5_HASH_IP_IPSEC_SPI); 2081 + break; 2082 + 2083 + case MLX5E_TT_IPV6_IPSEC_AH: 2084 + MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2085 + MLX5_L3_PROT_TYPE_IPV6); 2086 + MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2087 + MLX5_HASH_IP_IPSEC_SPI); 2088 + break; 2089 + 2090 + case MLX5E_TT_IPV4_IPSEC_ESP: 2091 + MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2092 + MLX5_L3_PROT_TYPE_IPV4); 2093 + MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2094 + MLX5_HASH_IP_IPSEC_SPI); 2095 + break; 2096 + 2097 + case MLX5E_TT_IPV6_IPSEC_ESP: 2098 + MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2099 + MLX5_L3_PROT_TYPE_IPV6); 2100 + MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2101 + MLX5_HASH_IP_IPSEC_SPI); 2102 + break; 2103 + 2104 + case MLX5E_TT_IPV4: 2105 + MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2106 + MLX5_L3_PROT_TYPE_IPV4); 2107 + MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2108 + MLX5_HASH_IP); 2109 + break; 2110 + 2111 + case MLX5E_TT_IPV6: 2112 + MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2113 + MLX5_L3_PROT_TYPE_IPV6); 2114 + MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2115 + MLX5_HASH_IP); 2116 + break; 2117 + default: 2118 + WARN_ONCE(true, "%s: bad traffic type!\n", __func__); 2052 2119 } 2053 2120 } 2054 2121 ··· 2501 2404 static void mlx5e_build_indir_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, 2502 2405 enum mlx5e_traffic_types tt) 2503 2406 { 2504 - void *hfso = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_outer); 2505 - 2506 2407 MLX5_SET(tirc, tirc, transport_domain, priv->mdev->mlx5e_res.td.tdn); 2507 - 2508 - #define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP |\ 2509 - MLX5_HASH_FIELD_SEL_DST_IP) 2510 - 2511 - #define MLX5_HASH_IP_L4PORTS (MLX5_HASH_FIELD_SEL_SRC_IP |\ 2512 - MLX5_HASH_FIELD_SEL_DST_IP |\ 2513 - MLX5_HASH_FIELD_SEL_L4_SPORT |\ 2514 - MLX5_HASH_FIELD_SEL_L4_DPORT) 2515 - 2516 - #define MLX5_HASH_IP_IPSEC_SPI (MLX5_HASH_FIELD_SEL_SRC_IP |\ 2517 - MLX5_HASH_FIELD_SEL_DST_IP |\ 2518 - MLX5_HASH_FIELD_SEL_IPSEC_SPI) 2519 2408 2520 2409 mlx5e_build_tir_ctx_lro(tirc, priv); 2521 2410 2522 2411 MLX5_SET(tirc, tirc, disp_type, MLX5_TIRC_DISP_TYPE_INDIRECT); 2523 2412 MLX5_SET(tirc, tirc, indirect_table, priv->indir_rqt.rqtn); 2524 - mlx5e_build_tir_ctx_hash(tirc, priv); 2525 - 2526 - switch (tt) { 2527 - case MLX5E_TT_IPV4_TCP: 2528 - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2529 - MLX5_L3_PROT_TYPE_IPV4); 2530 - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, 2531 - MLX5_L4_PROT_TYPE_TCP); 2532 - MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2533 - MLX5_HASH_IP_L4PORTS); 2534 - break; 2535 - 2536 - case MLX5E_TT_IPV6_TCP: 2537 - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2538 - MLX5_L3_PROT_TYPE_IPV6); 2539 - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, 2540 - MLX5_L4_PROT_TYPE_TCP); 2541 - MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2542 - MLX5_HASH_IP_L4PORTS); 2543 - break; 2544 - 2545 - case MLX5E_TT_IPV4_UDP: 2546 - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2547 - MLX5_L3_PROT_TYPE_IPV4); 2548 - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, 2549 - MLX5_L4_PROT_TYPE_UDP); 2550 - MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2551 - MLX5_HASH_IP_L4PORTS); 2552 - break; 2553 - 2554 - case MLX5E_TT_IPV6_UDP: 2555 - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2556 - MLX5_L3_PROT_TYPE_IPV6); 2557 - MLX5_SET(rx_hash_field_select, hfso, l4_prot_type, 2558 - MLX5_L4_PROT_TYPE_UDP); 2559 - MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2560 - MLX5_HASH_IP_L4PORTS); 2561 - break; 2562 - 2563 - case MLX5E_TT_IPV4_IPSEC_AH: 2564 - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2565 - MLX5_L3_PROT_TYPE_IPV4); 2566 - MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2567 - MLX5_HASH_IP_IPSEC_SPI); 2568 - break; 2569 - 2570 - case MLX5E_TT_IPV6_IPSEC_AH: 2571 - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2572 - MLX5_L3_PROT_TYPE_IPV6); 2573 - MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2574 - MLX5_HASH_IP_IPSEC_SPI); 2575 - break; 2576 - 2577 - case MLX5E_TT_IPV4_IPSEC_ESP: 2578 - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2579 - MLX5_L3_PROT_TYPE_IPV4); 2580 - MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2581 - MLX5_HASH_IP_IPSEC_SPI); 2582 - break; 2583 - 2584 - case MLX5E_TT_IPV6_IPSEC_ESP: 2585 - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2586 - MLX5_L3_PROT_TYPE_IPV6); 2587 - MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2588 - MLX5_HASH_IP_IPSEC_SPI); 2589 - break; 2590 - 2591 - case MLX5E_TT_IPV4: 2592 - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2593 - MLX5_L3_PROT_TYPE_IPV4); 2594 - MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2595 - MLX5_HASH_IP); 2596 - break; 2597 - 2598 - case MLX5E_TT_IPV6: 2599 - MLX5_SET(rx_hash_field_select, hfso, l3_prot_type, 2600 - MLX5_L3_PROT_TYPE_IPV6); 2601 - MLX5_SET(rx_hash_field_select, hfso, selected_fields, 2602 - MLX5_HASH_IP); 2603 - break; 2604 - default: 2605 - WARN_ONCE(true, 2606 - "mlx5e_build_indir_tir_ctx: bad traffic type!\n"); 2607 - } 2413 + mlx5e_build_indir_tir_ctx_hash(priv, tirc, tt); 2608 2414 } 2609 2415 2610 2416 static void mlx5e_build_direct_tir_ctx(struct mlx5e_priv *priv, u32 *tirc, ··· 3331 3331 static int mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev) 3332 3332 { 3333 3333 if (MLX5_CAP_GEN(mdev, port_type) != MLX5_CAP_PORT_TYPE_ETH) 3334 - return -ENOTSUPP; 3334 + return -EOPNOTSUPP; 3335 3335 if (!MLX5_CAP_GEN(mdev, eth_net_offloads) || 3336 3336 !MLX5_CAP_GEN(mdev, nic_flow_table) || 3337 3337 !MLX5_CAP_ETH(mdev, csum_cap) || ··· 3343 3343 < 3) { 3344 3344 mlx5_core_warn(mdev, 3345 3345 "Not creating net device, some required device capabilities are missing\n"); 3346 - return -ENOTSUPP; 3346 + return -EOPNOTSUPP; 3347 3347 } 3348 3348 if (!MLX5_CAP_ETH(mdev, self_lb_en_modifiable)) 3349 3349 mlx5_core_warn(mdev, "Self loop back prevention is not supported\n");
+6 -7
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 663 663 __be32 *saddr, 664 664 int *out_ttl) 665 665 { 666 + struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; 666 667 struct rtable *rt; 667 668 struct neighbour *n = NULL; 668 669 int ttl; ··· 678 677 #else 679 678 return -EOPNOTSUPP; 680 679 #endif 681 - 682 - if (!switchdev_port_same_parent_id(priv->netdev, rt->dst.dev)) { 683 - pr_warn("%s: can't offload, devices not on same HW e-switch\n", __func__); 684 - ip_rt_put(rt); 685 - return -EOPNOTSUPP; 686 - } 680 + /* if the egress device isn't on the same HW e-switch, we use the uplink */ 681 + if (!switchdev_port_same_parent_id(priv->netdev, rt->dst.dev)) 682 + *out_dev = mlx5_eswitch_get_uplink_netdev(esw); 683 + else 684 + *out_dev = rt->dst.dev; 687 685 688 686 ttl = ip4_dst_hoplimit(&rt->dst); 689 687 n = dst_neigh_lookup(&rt->dst, &fl4->daddr); ··· 693 693 *out_n = n; 694 694 *saddr = fl4->saddr; 695 695 *out_ttl = ttl; 696 - *out_dev = rt->dst.dev; 697 696 698 697 return 0; 699 698 }
+5 -5
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
··· 133 133 134 134 if (!MLX5_CAP_ESW(dev, vport_cvlan_strip) || 135 135 !MLX5_CAP_ESW(dev, vport_cvlan_insert_if_not_exist)) 136 - return -ENOTSUPP; 136 + return -EOPNOTSUPP; 137 137 138 138 esw_debug(dev, "Set Vport[%d] VLAN %d qos %d set=%x\n", 139 139 vport, vlan, qos, set_flags); ··· 353 353 root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_FDB); 354 354 if (!root_ns) { 355 355 esw_warn(dev, "Failed to get FDB flow namespace\n"); 356 - return -ENOMEM; 356 + return -EOPNOTSUPP; 357 357 } 358 358 359 359 flow_group_in = mlx5_vzalloc(inlen); ··· 962 962 root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_ESW_EGRESS); 963 963 if (!root_ns) { 964 964 esw_warn(dev, "Failed to get E-Switch egress flow namespace\n"); 965 - return -EIO; 965 + return -EOPNOTSUPP; 966 966 } 967 967 968 968 flow_group_in = mlx5_vzalloc(inlen); ··· 1079 1079 root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_ESW_INGRESS); 1080 1080 if (!root_ns) { 1081 1081 esw_warn(dev, "Failed to get E-Switch ingress flow namespace\n"); 1082 - return -EIO; 1082 + return -EOPNOTSUPP; 1083 1083 } 1084 1084 1085 1085 flow_group_in = mlx5_vzalloc(inlen); ··· 1630 1630 if (!MLX5_CAP_GEN(esw->dev, eswitch_flow_table) || 1631 1631 !MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, ft_support)) { 1632 1632 esw_warn(esw->dev, "E-Switch FDB is not supported, aborting ...\n"); 1633 - return -ENOTSUPP; 1633 + return -EOPNOTSUPP; 1634 1634 } 1635 1635 1636 1636 if (!MLX5_CAP_ESW_INGRESS_ACL(esw->dev, ft_support))
+22 -14
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 166 166 return 0; 167 167 168 168 out_notsupp: 169 - return -ENOTSUPP; 169 + return -EOPNOTSUPP; 170 170 } 171 171 172 172 int mlx5_eswitch_add_vlan_action(struct mlx5_eswitch *esw, ··· 424 424 root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_FDB); 425 425 if (!root_ns) { 426 426 esw_warn(dev, "Failed to get FDB flow namespace\n"); 427 + err = -EOPNOTSUPP; 427 428 goto ns_err; 428 429 } 429 430 ··· 536 535 ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_OFFLOADS); 537 536 if (!ns) { 538 537 esw_warn(esw->dev, "Failed to get offloads flow namespace\n"); 539 - return -ENOMEM; 538 + return -EOPNOTSUPP; 540 539 } 541 540 542 541 ft_offloads = mlx5_create_flow_table(ns, 0, dev->priv.sriov.num_vfs + 2, 0, 0); ··· 656 655 esw_warn(esw->dev, "Failed setting eswitch to offloads, err %d\n", err); 657 656 err1 = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); 658 657 if (err1) 659 - esw_warn(esw->dev, "Failed setting eswitch back to legacy, err %d\n", err); 658 + esw_warn(esw->dev, "Failed setting eswitch back to legacy, err %d\n", err1); 660 659 } 661 660 if (esw->offloads.inline_mode == MLX5_INLINE_MODE_NONE) { 662 661 if (mlx5_eswitch_inline_mode_get(esw, ··· 675 674 int vport; 676 675 int err; 677 676 677 + /* disable PF RoCE so missed packets don't go through RoCE steering */ 678 + mlx5_dev_list_lock(); 679 + mlx5_remove_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); 680 + mlx5_dev_list_unlock(); 681 + 678 682 err = esw_create_offloads_fdb_table(esw, nvports); 679 683 if (err) 680 - return err; 684 + goto create_fdb_err; 681 685 682 686 err = esw_create_offloads_table(esw); 683 687 if (err) ··· 702 696 goto err_reps; 703 697 } 704 698 705 - /* disable PF RoCE so missed packets don't go through RoCE steering */ 706 - mlx5_dev_list_lock(); 707 - mlx5_remove_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); 708 - mlx5_dev_list_unlock(); 709 - 710 699 return 0; 711 700 712 701 err_reps: ··· 718 717 719 718 create_ft_err: 720 719 esw_destroy_offloads_fdb_table(esw); 720 + 721 + create_fdb_err: 722 + /* enable back PF RoCE */ 723 + mlx5_dev_list_lock(); 724 + mlx5_add_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); 725 + mlx5_dev_list_unlock(); 726 + 721 727 return err; 722 728 } 723 729 724 730 static int esw_offloads_stop(struct mlx5_eswitch *esw) 725 731 { 726 732 int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs; 727 - 728 - /* enable back PF RoCE */ 729 - mlx5_dev_list_lock(); 730 - mlx5_add_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); 731 - mlx5_dev_list_unlock(); 732 733 733 734 mlx5_eswitch_disable_sriov(esw); 734 735 err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); ··· 740 737 if (err1) 741 738 esw_warn(esw->dev, "Failed setting eswitch back to offloads, err %d\n", err); 742 739 } 740 + 741 + /* enable back PF RoCE */ 742 + mlx5_dev_list_lock(); 743 + mlx5_add_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); 744 + mlx5_dev_list_unlock(); 743 745 744 746 return err; 745 747 }
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
··· 322 322 flow_table_properties_nic_receive. 323 323 flow_modify_en); 324 324 if (!atomic_mod_cap) 325 - return -ENOTSUPP; 325 + return -EOPNOTSUPP; 326 326 opmod = 1; 327 327 328 328 return mlx5_cmd_set_fte(dev, opmod, modify_mask, ft, group_id, fte);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
··· 1822 1822 struct mlx5_flow_table *ft; 1823 1823 1824 1824 ns = mlx5_get_flow_namespace(steering->dev, MLX5_FLOW_NAMESPACE_ANCHOR); 1825 - if (!ns) 1825 + if (WARN_ON(!ns)) 1826 1826 return -EINVAL; 1827 1827 ft = mlx5_create_flow_table(ns, ANCHOR_PRIO, ANCHOR_SIZE, ANCHOR_LEVEL, 0); 1828 1828 if (IS_ERR(ft)) {
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 807 807 return 0; 808 808 } 809 809 810 - return -ENOTSUPP; 810 + return -EOPNOTSUPP; 811 811 } 812 812 813 813
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/port.c
··· 620 620 u32 out[MLX5_ST_SZ_DW(qtct_reg)]; 621 621 622 622 if (!MLX5_CAP_GEN(mdev, ets)) 623 - return -ENOTSUPP; 623 + return -EOPNOTSUPP; 624 624 625 625 return mlx5_core_access_reg(mdev, in, inlen, out, sizeof(out), 626 626 MLX5_REG_QETCR, 0, 1); ··· 632 632 u32 in[MLX5_ST_SZ_DW(qtct_reg)]; 633 633 634 634 if (!MLX5_CAP_GEN(mdev, ets)) 635 - return -ENOTSUPP; 635 + return -EOPNOTSUPP; 636 636 637 637 memset(in, 0, sizeof(in)); 638 638 return mlx5_core_access_reg(mdev, in, sizeof(in), out, outlen,
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/vport.c
··· 532 532 if (!MLX5_CAP_GEN(mdev, vport_group_manager)) 533 533 return -EACCES; 534 534 if (!MLX5_CAP_ESW(mdev, nic_vport_node_guid_modify)) 535 - return -ENOTSUPP; 535 + return -EOPNOTSUPP; 536 536 537 537 in = mlx5_vzalloc(inlen); 538 538 if (!in)
+4
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
··· 305 305 { 306 306 void __iomem *ioaddr = hw->pcsr; 307 307 u32 intr_status = readl(ioaddr + GMAC_INT_STATUS); 308 + u32 intr_mask = readl(ioaddr + GMAC_INT_MASK); 308 309 int ret = 0; 310 + 311 + /* Discard masked bits */ 312 + intr_status &= ~intr_mask; 309 313 310 314 /* Not used events (e.g. MMC interrupts) are not handled. */ 311 315 if ((intr_status & GMAC_INT_STATUS_MMCTIS))
+6
drivers/net/hyperv/netvsc.c
··· 1295 1295 ndev = hv_get_drvdata(device); 1296 1296 buffer = get_per_channel_state(channel); 1297 1297 1298 + /* commit_rd_index() -> hv_signal_on_read() needs this. */ 1299 + init_cached_read_index(channel); 1300 + 1298 1301 do { 1299 1302 desc = get_next_pkt_raw(channel); 1300 1303 if (desc != NULL) { ··· 1350 1347 1351 1348 bufferlen = bytes_recvd; 1352 1349 } 1350 + 1351 + init_cached_read_index(channel); 1352 + 1353 1353 } while (1); 1354 1354 1355 1355 if (bufferlen > NETVSC_PACKET_SIZE)
+1 -1
drivers/net/phy/micrel.c
··· 1012 1012 .phy_id = PHY_ID_KSZ8795, 1013 1013 .phy_id_mask = MICREL_PHY_ID_MASK, 1014 1014 .name = "Micrel KSZ8795", 1015 - .features = (SUPPORTED_Pause | SUPPORTED_Asym_Pause), 1015 + .features = PHY_BASIC_FEATURES, 1016 1016 .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, 1017 1017 .config_init = kszphy_config_init, 1018 1018 .config_aneg = ksz8873mll_config_aneg,
+1 -1
drivers/net/wireless/intel/iwlwifi/iwl-8000.c
··· 91 91 92 92 #define IWL8000_FW_PRE "iwlwifi-8000C-" 93 93 #define IWL8000_MODULE_FIRMWARE(api) \ 94 - IWL8000_FW_PRE "-" __stringify(api) ".ucode" 94 + IWL8000_FW_PRE __stringify(api) ".ucode" 95 95 96 96 #define IWL8265_FW_PRE "iwlwifi-8265-" 97 97 #define IWL8265_MODULE_FIRMWARE(api) \
+4 -3
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
··· 1164 1164 .frame_limit = IWL_FRAME_LIMIT, 1165 1165 }; 1166 1166 1167 - /* Make sure reserved queue is still marked as such (or allocated) */ 1168 - mvm->queue_info[mvm_sta->reserved_queue].status = 1169 - IWL_MVM_QUEUE_RESERVED; 1167 + /* Make sure reserved queue is still marked as such (if allocated) */ 1168 + if (mvm_sta->reserved_queue != IEEE80211_INVAL_HW_QUEUE) 1169 + mvm->queue_info[mvm_sta->reserved_queue].status = 1170 + IWL_MVM_QUEUE_RESERVED; 1170 1171 1171 1172 for (i = 0; i <= IWL_MAX_TID_COUNT; i++) { 1172 1173 struct iwl_mvm_tid_data *tid_data = &mvm_sta->tid_data[i];
+8 -4
drivers/net/wireless/intel/iwlwifi/mvm/tt.c
··· 843 843 return; 844 844 845 845 IWL_DEBUG_TEMP(mvm, "Thermal zone device unregister\n"); 846 - thermal_zone_device_unregister(mvm->tz_device.tzone); 847 - mvm->tz_device.tzone = NULL; 846 + if (mvm->tz_device.tzone) { 847 + thermal_zone_device_unregister(mvm->tz_device.tzone); 848 + mvm->tz_device.tzone = NULL; 849 + } 848 850 } 849 851 850 852 static void iwl_mvm_cooling_device_unregister(struct iwl_mvm *mvm) ··· 855 853 return; 856 854 857 855 IWL_DEBUG_TEMP(mvm, "Cooling device unregister\n"); 858 - thermal_cooling_device_unregister(mvm->cooling_dev.cdev); 859 - mvm->cooling_dev.cdev = NULL; 856 + if (mvm->cooling_dev.cdev) { 857 + thermal_cooling_device_unregister(mvm->cooling_dev.cdev); 858 + mvm->cooling_dev.cdev = NULL; 859 + } 860 860 } 861 861 #endif /* CONFIG_THERMAL */ 862 862
+13 -6
drivers/pci/pcie/aspm.c
··· 532 532 link = kzalloc(sizeof(*link), GFP_KERNEL); 533 533 if (!link) 534 534 return NULL; 535 + 535 536 INIT_LIST_HEAD(&link->sibling); 536 537 INIT_LIST_HEAD(&link->children); 537 538 INIT_LIST_HEAD(&link->link); 538 539 link->pdev = pdev; 539 - if (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT) { 540 + 541 + /* 542 + * Root Ports and PCI/PCI-X to PCIe Bridges are roots of PCIe 543 + * hierarchies. 544 + */ 545 + if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT || 546 + pci_pcie_type(pdev) == PCI_EXP_TYPE_PCIE_BRIDGE) { 547 + link->root = link; 548 + } else { 540 549 struct pcie_link_state *parent; 550 + 541 551 parent = pdev->bus->parent->self->link_state; 542 552 if (!parent) { 543 553 kfree(link); 544 554 return NULL; 545 555 } 556 + 546 557 link->parent = parent; 558 + link->root = link->parent->root; 547 559 list_add(&link->link, &parent->children); 548 560 } 549 - /* Setup a pointer to the root port link */ 550 - if (!link->parent) 551 - link->root = link; 552 - else 553 - link->root = link->parent->root; 554 561 555 562 list_add(&link->sibling, &link_list); 556 563 pdev->link_state = link;
+1 -1
drivers/pinctrl/berlin/berlin-bg4ct.c
··· 217 217 BERLIN_PINCTRL_GROUP("SCRD0_CRD_PRES", 0xc, 0x3, 0x15, 218 218 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO20 */ 219 219 BERLIN_PINCTRL_FUNCTION(0x1, "scrd0"), /* crd pres */ 220 - BERLIN_PINCTRL_FUNCTION(0x1, "sd1a")), /* DAT3 */ 220 + BERLIN_PINCTRL_FUNCTION(0x3, "sd1a")), /* DAT3 */ 221 221 BERLIN_PINCTRL_GROUP("SPI1_SS0n", 0xc, 0x3, 0x18, 222 222 BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS0n */ 223 223 BERLIN_PINCTRL_FUNCTION(0x1, "gpio"), /* GPIO37 */
+20 -7
drivers/pinctrl/intel/pinctrl-baytrail.c
··· 731 731 int reg) 732 732 { 733 733 struct byt_community *comm = byt_get_community(vg, offset); 734 - u32 reg_offset = 0; 734 + u32 reg_offset; 735 735 736 736 if (!comm) 737 737 return NULL; 738 738 739 739 offset -= comm->pin_base; 740 - if (reg == BYT_INT_STAT_REG) 740 + switch (reg) { 741 + case BYT_INT_STAT_REG: 741 742 reg_offset = (offset / 32) * 4; 742 - else 743 + break; 744 + case BYT_DEBOUNCE_REG: 745 + reg_offset = 0; 746 + break; 747 + default: 743 748 reg_offset = comm->pad_map[offset] * 16; 749 + break; 750 + } 744 751 745 752 return comm->reg_base + reg_offset + reg; 746 753 } ··· 1250 1243 debounce = readl(db_reg); 1251 1244 debounce &= ~BYT_DEBOUNCE_PULSE_MASK; 1252 1245 1246 + if (arg) 1247 + conf |= BYT_DEBOUNCE_EN; 1248 + else 1249 + conf &= ~BYT_DEBOUNCE_EN; 1250 + 1253 1251 switch (arg) { 1254 - case 0: 1255 - conf &= BYT_DEBOUNCE_EN; 1256 - break; 1257 1252 case 375: 1258 1253 debounce |= BYT_DEBOUNCE_PULSE_375US; 1259 1254 break; ··· 1278 1269 debounce |= BYT_DEBOUNCE_PULSE_24MS; 1279 1270 break; 1280 1271 default: 1281 - ret = -EINVAL; 1272 + if (arg) 1273 + ret = -EINVAL; 1274 + break; 1282 1275 } 1283 1276 1284 1277 if (!ret) ··· 1623 1612 continue; 1624 1613 } 1625 1614 1615 + raw_spin_lock(&vg->lock); 1626 1616 pending = readl(reg); 1617 + raw_spin_unlock(&vg->lock); 1627 1618 for_each_set_bit(pin, &pending, 32) { 1628 1619 virq = irq_find_mapping(vg->chip.irqdomain, base + pin); 1629 1620 generic_handle_irq(virq);
+3
drivers/pinctrl/intel/pinctrl-merrifield.c
··· 794 794 unsigned int i; 795 795 int ret; 796 796 797 + if (!mrfld_buf_available(mp, pin)) 798 + return -ENOTSUPP; 799 + 797 800 for (i = 0; i < nconfigs; i++) { 798 801 switch (pinconf_to_config_param(configs[i])) { 799 802 case PIN_CONFIG_BIAS_DISABLE:
+1 -2
drivers/pinctrl/sunxi/pinctrl-sunxi.c
··· 564 564 val = arg / 10 - 1; 565 565 break; 566 566 case PIN_CONFIG_BIAS_DISABLE: 567 - val = 0; 568 - break; 567 + continue; 569 568 case PIN_CONFIG_BIAS_PULL_UP: 570 569 if (arg == 0) 571 570 return -EINVAL;
+1 -1
drivers/regulator/axp20x-regulator.c
··· 272 272 64, AXP806_DCDCD_V_CTRL, 0x3f, AXP806_PWR_OUT_CTRL1, 273 273 BIT(3)), 274 274 AXP_DESC(AXP806, DCDCE, "dcdce", "vine", 1100, 3400, 100, 275 - AXP806_DCDCB_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(4)), 275 + AXP806_DCDCE_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(4)), 276 276 AXP_DESC(AXP806, ALDO1, "aldo1", "aldoin", 700, 3300, 100, 277 277 AXP806_ALDO1_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(5)), 278 278 AXP_DESC(AXP806, ALDO2, "aldo2", "aldoin", 700, 3400, 100,
-46
drivers/regulator/fixed.c
··· 30 30 #include <linux/of_gpio.h> 31 31 #include <linux/regulator/of_regulator.h> 32 32 #include <linux/regulator/machine.h> 33 - #include <linux/acpi.h> 34 - #include <linux/property.h> 35 - #include <linux/gpio/consumer.h> 36 33 37 34 struct fixed_voltage_data { 38 35 struct regulator_desc desc; ··· 94 97 return config; 95 98 } 96 99 97 - /** 98 - * acpi_get_fixed_voltage_config - extract fixed_voltage_config structure info 99 - * @dev: device requesting for fixed_voltage_config 100 - * @desc: regulator description 101 - * 102 - * Populates fixed_voltage_config structure by extracting data through ACPI 103 - * interface, returns a pointer to the populated structure of NULL if memory 104 - * alloc fails. 105 - */ 106 - static struct fixed_voltage_config * 107 - acpi_get_fixed_voltage_config(struct device *dev, 108 - const struct regulator_desc *desc) 109 - { 110 - struct fixed_voltage_config *config; 111 - const char *supply_name; 112 - struct gpio_desc *gpiod; 113 - int ret; 114 - 115 - config = devm_kzalloc(dev, sizeof(*config), GFP_KERNEL); 116 - if (!config) 117 - return ERR_PTR(-ENOMEM); 118 - 119 - ret = device_property_read_string(dev, "supply-name", &supply_name); 120 - if (!ret) 121 - config->supply_name = supply_name; 122 - 123 - gpiod = gpiod_get(dev, "gpio", GPIOD_ASIS); 124 - if (IS_ERR(gpiod)) 125 - return ERR_PTR(-ENODEV); 126 - 127 - config->gpio = desc_to_gpio(gpiod); 128 - config->enable_high = device_property_read_bool(dev, 129 - "enable-active-high"); 130 - gpiod_put(gpiod); 131 - 132 - return config; 133 - } 134 - 135 100 static struct regulator_ops fixed_voltage_ops = { 136 101 }; 137 102 ··· 112 153 if (pdev->dev.of_node) { 113 154 config = of_get_fixed_voltage_config(&pdev->dev, 114 155 &drvdata->desc); 115 - if (IS_ERR(config)) 116 - return PTR_ERR(config); 117 - } else if (ACPI_HANDLE(&pdev->dev)) { 118 - config = acpi_get_fixed_voltage_config(&pdev->dev, 119 - &drvdata->desc); 120 156 if (IS_ERR(config)) 121 157 return PTR_ERR(config); 122 158 } else {
+1 -1
drivers/regulator/twl6030-regulator.c
··· 452 452 vsel = 62; 453 453 else if ((min_uV > 1800000) && (min_uV <= 1900000)) 454 454 vsel = 61; 455 - else if ((min_uV > 1350000) && (min_uV <= 1800000)) 455 + else if ((min_uV > 1500000) && (min_uV <= 1800000)) 456 456 vsel = 60; 457 457 else if ((min_uV > 1350000) && (min_uV <= 1500000)) 458 458 vsel = 59;
+4 -1
drivers/rtc/Kconfig
··· 1551 1551 will be called rtc-mpc5121. 1552 1552 1553 1553 config RTC_DRV_JZ4740 1554 - bool "Ingenic JZ4740 SoC" 1554 + tristate "Ingenic JZ4740 SoC" 1555 1555 depends on MACH_INGENIC || COMPILE_TEST 1556 1556 help 1557 1557 If you say yes here you get support for the Ingenic JZ47xx SoCs RTC 1558 1558 controllers. 1559 + 1560 + This driver can also be buillt as a module. If so, the module 1561 + will be called rtc-jz4740. 1559 1562 1560 1563 config RTC_DRV_LPC24XX 1561 1564 tristate "NXP RTC for LPC178x/18xx/408x/43xx"
+10 -2
drivers/rtc/rtc-jz4740.c
··· 17 17 #include <linux/clk.h> 18 18 #include <linux/io.h> 19 19 #include <linux/kernel.h> 20 + #include <linux/module.h> 20 21 #include <linux/of_device.h> 21 22 #include <linux/platform_device.h> 22 23 #include <linux/reboot.h> ··· 295 294 JZ_REG_RTC_RESET_COUNTER, reset_counter_ticks); 296 295 297 296 jz4740_rtc_poweroff(dev_for_power_off); 298 - machine_halt(); 297 + kernel_halt(); 299 298 } 300 299 301 300 static const struct of_device_id jz4740_rtc_of_match[] = { ··· 303 302 { .compatible = "ingenic,jz4780-rtc", .data = (void *)ID_JZ4780 }, 304 303 {}, 305 304 }; 305 + MODULE_DEVICE_TABLE(of, jz4740_rtc_of_match); 306 306 307 307 static int jz4740_rtc_probe(struct platform_device *pdev) 308 308 { ··· 431 429 { "jz4780-rtc", ID_JZ4780 }, 432 430 {} 433 431 }; 432 + MODULE_DEVICE_TABLE(platform, jz4740_rtc_ids); 434 433 435 434 static struct platform_driver jz4740_rtc_driver = { 436 435 .probe = jz4740_rtc_probe, ··· 443 440 .id_table = jz4740_rtc_ids, 444 441 }; 445 442 446 - builtin_platform_driver(jz4740_rtc_driver); 443 + module_platform_driver(jz4740_rtc_driver); 444 + 445 + MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 446 + MODULE_LICENSE("GPL"); 447 + MODULE_DESCRIPTION("RTC driver for the JZ4740 SoC\n"); 448 + MODULE_ALIAS("platform:jz4740-rtc");
+10 -1
drivers/scsi/virtio_scsi.c
··· 534 534 { 535 535 struct Scsi_Host *shost = virtio_scsi_host(vscsi->vdev); 536 536 struct virtio_scsi_cmd *cmd = scsi_cmd_priv(sc); 537 + unsigned long flags; 537 538 int req_size; 539 + int ret; 538 540 539 541 BUG_ON(scsi_sg_count(sc) > shost->sg_tablesize); 540 542 ··· 564 562 req_size = sizeof(cmd->req.cmd); 565 563 } 566 564 567 - if (virtscsi_kick_cmd(req_vq, cmd, req_size, sizeof(cmd->resp.cmd)) != 0) 565 + ret = virtscsi_kick_cmd(req_vq, cmd, req_size, sizeof(cmd->resp.cmd)); 566 + if (ret == -EIO) { 567 + cmd->resp.cmd.response = VIRTIO_SCSI_S_BAD_TARGET; 568 + spin_lock_irqsave(&req_vq->vq_lock, flags); 569 + virtscsi_complete_cmd(vscsi, cmd); 570 + spin_unlock_irqrestore(&req_vq->vq_lock, flags); 571 + } else if (ret != 0) { 568 572 return SCSI_MLQUEUE_HOST_BUSY; 573 + } 569 574 return 0; 570 575 } 571 576
+6
drivers/staging/greybus/timesync_platform.c
··· 45 45 46 46 int gb_timesync_platform_lock_bus(struct gb_timesync_svc *pdata) 47 47 { 48 + if (!arche_platform_change_state_cb) 49 + return 0; 50 + 48 51 return arche_platform_change_state_cb(ARCHE_PLATFORM_STATE_TIME_SYNC, 49 52 pdata); 50 53 } 51 54 52 55 void gb_timesync_platform_unlock_bus(void) 53 56 { 57 + if (!arche_platform_change_state_cb) 58 + return; 59 + 54 60 arche_platform_change_state_cb(ARCHE_PLATFORM_STATE_ACTIVE, NULL); 55 61 } 56 62
+4
drivers/usb/core/quirks.c
··· 37 37 /* CBM - Flash disk */ 38 38 { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME }, 39 39 40 + /* WORLDE easy key (easykey.25) MIDI controller */ 41 + { USB_DEVICE(0x0218, 0x0401), .driver_info = 42 + USB_QUIRK_CONFIG_INTF_STRINGS }, 43 + 40 44 /* HP 5300/5370C scanner */ 41 45 { USB_DEVICE(0x03f0, 0x0701), .driver_info = 42 46 USB_QUIRK_STRING_FETCH_255 },
+12 -1
drivers/usb/gadget/function/f_fs.c
··· 2269 2269 if (len < sizeof(*d) || h->interface >= ffs->interfaces_count) 2270 2270 return -EINVAL; 2271 2271 length = le32_to_cpu(d->dwSize); 2272 + if (len < length) 2273 + return -EINVAL; 2272 2274 type = le32_to_cpu(d->dwPropertyDataType); 2273 2275 if (type < USB_EXT_PROP_UNICODE || 2274 2276 type > USB_EXT_PROP_UNICODE_MULTI) { ··· 2279 2277 return -EINVAL; 2280 2278 } 2281 2279 pnl = le16_to_cpu(d->wPropertyNameLength); 2280 + if (length < 14 + pnl) { 2281 + pr_vdebug("invalid os descriptor length: %d pnl:%d (descriptor %d)\n", 2282 + length, pnl, type); 2283 + return -EINVAL; 2284 + } 2282 2285 pdl = le32_to_cpu(*(u32 *)((u8 *)data + 10 + pnl)); 2283 2286 if (length != 14 + pnl + pdl) { 2284 2287 pr_vdebug("invalid os descriptor length: %d pnl:%d pdl:%d (descriptor %d)\n", ··· 2370 2363 } 2371 2364 } 2372 2365 if (flags & (1 << i)) { 2366 + if (len < 4) { 2367 + goto error; 2368 + } 2373 2369 os_descs_count = get_unaligned_le32(data); 2374 2370 data += 4; 2375 2371 len -= 4; ··· 2445 2435 2446 2436 ENTER(); 2447 2437 2448 - if (unlikely(get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC || 2438 + if (unlikely(len < 16 || 2439 + get_unaligned_le32(data) != FUNCTIONFS_STRINGS_MAGIC || 2449 2440 get_unaligned_le32(data + 4) != len)) 2450 2441 goto error; 2451 2442 str_count = get_unaligned_le32(data + 8);
+13 -13
drivers/usb/musb/musb_core.c
··· 594 594 | MUSB_PORT_STAT_RESUME; 595 595 musb->rh_timer = jiffies 596 596 + msecs_to_jiffies(USB_RESUME_TIMEOUT); 597 - musb->need_finish_resume = 1; 598 - 599 597 musb->xceiv->otg->state = OTG_STATE_A_HOST; 600 598 musb->is_active = 1; 601 599 musb_host_resume_root_hub(musb); 600 + schedule_delayed_work(&musb->finish_resume_work, 601 + msecs_to_jiffies(USB_RESUME_TIMEOUT)); 602 602 break; 603 603 case OTG_STATE_B_WAIT_ACON: 604 604 musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL; ··· 1925 1925 static void musb_irq_work(struct work_struct *data) 1926 1926 { 1927 1927 struct musb *musb = container_of(data, struct musb, irq_work.work); 1928 + int error; 1929 + 1930 + error = pm_runtime_get_sync(musb->controller); 1931 + if (error < 0) { 1932 + dev_err(musb->controller, "Could not enable: %i\n", error); 1933 + 1934 + return; 1935 + } 1928 1936 1929 1937 musb_pm_runtime_check_session(musb); 1930 1938 ··· 1940 1932 musb->xceiv_old_state = musb->xceiv->otg->state; 1941 1933 sysfs_notify(&musb->controller->kobj, NULL, "mode"); 1942 1934 } 1935 + 1936 + pm_runtime_mark_last_busy(musb->controller); 1937 + pm_runtime_put_autosuspend(musb->controller); 1943 1938 } 1944 1939 1945 1940 static void musb_recover_from_babble(struct musb *musb) ··· 2721 2710 mask = MUSB_DEVCTL_BDEVICE | MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV; 2722 2711 if ((devctl & mask) != (musb->context.devctl & mask)) 2723 2712 musb->port1_status = 0; 2724 - if (musb->need_finish_resume) { 2725 - musb->need_finish_resume = 0; 2726 - schedule_delayed_work(&musb->finish_resume_work, 2727 - msecs_to_jiffies(USB_RESUME_TIMEOUT)); 2728 - } 2729 2713 2730 2714 /* 2731 2715 * The USB HUB code expects the device to be in RPM_ACTIVE once it came ··· 2771 2765 return 0; 2772 2766 2773 2767 musb_restore_context(musb); 2774 - 2775 - if (musb->need_finish_resume) { 2776 - musb->need_finish_resume = 0; 2777 - schedule_delayed_work(&musb->finish_resume_work, 2778 - msecs_to_jiffies(USB_RESUME_TIMEOUT)); 2779 - } 2780 2768 2781 2769 spin_lock_irqsave(&musb->lock, flags); 2782 2770 error = musb_run_resume_work(musb);
-1
drivers/usb/musb/musb_core.h
··· 410 410 411 411 /* is_suspended means USB B_PERIPHERAL suspend */ 412 412 unsigned is_suspended:1; 413 - unsigned need_finish_resume :1; 414 413 415 414 /* may_wakeup means remote wakeup is enabled */ 416 415 unsigned may_wakeup:1;
+1
drivers/usb/serial/option.c
··· 2007 2007 { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD200, 0xff, 0xff, 0xff) }, 2008 2008 { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_6802, 0xff, 0xff, 0xff) }, 2009 2009 { USB_DEVICE_AND_INTERFACE_INFO(WETELECOM_VENDOR_ID, WETELECOM_PRODUCT_WMD300, 0xff, 0xff, 0xff) }, 2010 + { USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x421d, 0xff, 0xff, 0xff) }, /* HP lt2523 (Novatel E371) */ 2010 2011 { } /* Terminating entry */ 2011 2012 }; 2012 2013 MODULE_DEVICE_TABLE(usb, option_ids);
+1
drivers/usb/serial/pl2303.c
··· 49 49 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, 50 50 { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, 51 51 { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, 52 + { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID2) }, 52 53 { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) }, 53 54 { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) }, 54 55 { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID_UCSGT) },
+1
drivers/usb/serial/pl2303.h
··· 27 27 #define ATEN_VENDOR_ID 0x0557 28 28 #define ATEN_VENDOR_ID2 0x0547 29 29 #define ATEN_PRODUCT_ID 0x2008 30 + #define ATEN_PRODUCT_ID2 0x2118 30 31 31 32 #define IODATA_VENDOR_ID 0x04bb 32 33 #define IODATA_PRODUCT_ID 0x0a03
+1
drivers/usb/serial/qcserial.c
··· 124 124 {USB_DEVICE(0x1410, 0xa021)}, /* Novatel Gobi 3000 Composite */ 125 125 {USB_DEVICE(0x413c, 0x8193)}, /* Dell Gobi 3000 QDL */ 126 126 {USB_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */ 127 + {USB_DEVICE(0x413c, 0x81a6)}, /* Dell DW5570 QDL (MC8805) */ 127 128 {USB_DEVICE(0x1199, 0x68a4)}, /* Sierra Wireless QDL */ 128 129 {USB_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */ 129 130 {USB_DEVICE(0x1199, 0x68a8)}, /* Sierra Wireless QDL */
+5 -6
drivers/vfio/vfio_iommu_spapr_tce.c
··· 1123 1123 mutex_lock(&container->lock); 1124 1124 1125 1125 ret = tce_iommu_create_default_window(container); 1126 - if (ret) 1127 - return ret; 1128 - 1129 - ret = tce_iommu_create_window(container, create.page_shift, 1130 - create.window_size, create.levels, 1131 - &create.start_addr); 1126 + if (!ret) 1127 + ret = tce_iommu_create_window(container, 1128 + create.page_shift, 1129 + create.window_size, create.levels, 1130 + &create.start_addr); 1132 1131 1133 1132 mutex_unlock(&container->lock); 1134 1133
+4 -6
drivers/vhost/vhost.c
··· 130 130 131 131 static void vhost_init_is_le(struct vhost_virtqueue *vq) 132 132 { 133 - if (vhost_has_feature(vq, VIRTIO_F_VERSION_1)) 134 - vq->is_le = true; 133 + vq->is_le = vhost_has_feature(vq, VIRTIO_F_VERSION_1) 134 + || virtio_legacy_is_little_endian(); 135 135 } 136 136 #endif /* CONFIG_VHOST_CROSS_ENDIAN_LEGACY */ 137 137 138 138 static void vhost_reset_is_le(struct vhost_virtqueue *vq) 139 139 { 140 - vq->is_le = virtio_legacy_is_little_endian(); 140 + vhost_init_is_le(vq); 141 141 } 142 142 143 143 struct vhost_flush_struct { ··· 1714 1714 int r; 1715 1715 bool is_le = vq->is_le; 1716 1716 1717 - if (!vq->private_data) { 1718 - vhost_reset_is_le(vq); 1717 + if (!vq->private_data) 1719 1718 return 0; 1720 - } 1721 1719 1722 1720 vhost_init_is_le(vq); 1723 1721
-7
drivers/virtio/virtio_ring.c
··· 159 159 if (xen_domain()) 160 160 return true; 161 161 162 - /* 163 - * On ARM-based machines, the DMA ops will do the right thing, 164 - * so always use them with legacy devices. 165 - */ 166 - if (IS_ENABLED(CONFIG_ARM) || IS_ENABLED(CONFIG_ARM64)) 167 - return !virtio_has_feature(vdev, VIRTIO_F_VERSION_1); 168 - 169 162 return false; 170 163 } 171 164
+1
fs/cifs/readdir.c
··· 285 285 rc = -ENOMEM; 286 286 goto error_exit; 287 287 } 288 + spin_lock_init(&cifsFile->file_info_lock); 288 289 file->private_data = cifsFile; 289 290 cifsFile->tlink = cifs_get_tlink(tlink); 290 291 tcon = tlink_tcon(tlink);
+5
fs/dax.c
··· 1031 1031 struct blk_dax_ctl dax = { 0 }; 1032 1032 ssize_t map_len; 1033 1033 1034 + if (fatal_signal_pending(current)) { 1035 + ret = -EINTR; 1036 + break; 1037 + } 1038 + 1034 1039 dax.sector = dax_iomap_sector(iomap, pos); 1035 1040 dax.size = (length + offset + PAGE_SIZE - 1) & PAGE_MASK; 1036 1041 map_len = dax_map_atomic(iomap->bdev, &dax);
+5
fs/fscache/cookie.c
··· 542 542 hlist_for_each_entry(object, &cookie->backing_objects, cookie_link) { 543 543 if (invalidate) 544 544 set_bit(FSCACHE_OBJECT_RETIRED, &object->flags); 545 + clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags); 545 546 fscache_raise_event(object, FSCACHE_OBJECT_EV_KILL); 546 547 } 547 548 } else { ··· 560 559 if (!atomic_dec_and_test(&cookie->n_active)) 561 560 wait_on_atomic_t(&cookie->n_active, fscache_wait_atomic_t, 562 561 TASK_UNINTERRUPTIBLE); 562 + 563 + /* Make sure any pending writes are cancelled. */ 564 + if (cookie->def->type != FSCACHE_COOKIE_TYPE_INDEX) 565 + fscache_invalidate_writes(cookie); 563 566 564 567 /* Reset the cookie state if it wasn't relinquished */ 565 568 if (!test_bit(FSCACHE_COOKIE_RELINQUISHED, &cookie->flags)) {
+1
fs/fscache/netfs.c
··· 48 48 cookie->flags = 1 << FSCACHE_COOKIE_ENABLED; 49 49 50 50 spin_lock_init(&cookie->lock); 51 + spin_lock_init(&cookie->stores_lock); 51 52 INIT_HLIST_HEAD(&cookie->backing_objects); 52 53 53 54 /* check the netfs type is not already present */
+30 -2
fs/fscache/object.c
··· 30 30 static const struct fscache_state *fscache_object_available(struct fscache_object *, int); 31 31 static const struct fscache_state *fscache_parent_ready(struct fscache_object *, int); 32 32 static const struct fscache_state *fscache_update_object(struct fscache_object *, int); 33 + static const struct fscache_state *fscache_object_dead(struct fscache_object *, int); 33 34 34 35 #define __STATE_NAME(n) fscache_osm_##n 35 36 #define STATE(n) (&__STATE_NAME(n)) ··· 92 91 static WORK_STATE(KILL_OBJECT, "KILL", fscache_kill_object); 93 92 static WORK_STATE(KILL_DEPENDENTS, "KDEP", fscache_kill_dependents); 94 93 static WORK_STATE(DROP_OBJECT, "DROP", fscache_drop_object); 95 - static WORK_STATE(OBJECT_DEAD, "DEAD", (void*)2UL); 94 + static WORK_STATE(OBJECT_DEAD, "DEAD", fscache_object_dead); 96 95 97 96 static WAIT_STATE(WAIT_FOR_INIT, "?INI", 98 97 TRANSIT_TO(INIT_OBJECT, 1 << FSCACHE_OBJECT_EV_NEW_CHILD)); ··· 230 229 event = -1; 231 230 if (new_state == NO_TRANSIT) { 232 231 _debug("{OBJ%x} %s notrans", object->debug_id, state->name); 232 + if (unlikely(state == STATE(OBJECT_DEAD))) { 233 + _leave(" [dead]"); 234 + return; 235 + } 233 236 fscache_enqueue_object(object); 234 237 event_mask = object->oob_event_mask; 235 238 goto unmask_events; ··· 244 239 object->state = state = new_state; 245 240 246 241 if (state->work) { 247 - if (unlikely(state->work == ((void *)2UL))) { 242 + if (unlikely(state == STATE(OBJECT_DEAD))) { 248 243 _leave(" [dead]"); 249 244 return; 250 245 } ··· 649 644 650 645 fscache_mark_object_dead(object); 651 646 object->oob_event_mask = 0; 647 + 648 + if (test_bit(FSCACHE_OBJECT_RETIRED, &object->flags)) { 649 + /* Reject any new read/write ops and abort any that are pending. */ 650 + clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags); 651 + fscache_cancel_all_ops(object); 652 + } 652 653 653 654 if (list_empty(&object->dependents) && 654 655 object->n_ops == 0 && ··· 1088 1077 } 1089 1078 } 1090 1079 EXPORT_SYMBOL(fscache_object_mark_killed); 1080 + 1081 + /* 1082 + * The object is dead. We can get here if an object gets queued by an event 1083 + * that would lead to its death (such as EV_KILL) when the dispatcher is 1084 + * already running (and so can be requeued) but hasn't yet cleared the event 1085 + * mask. 1086 + */ 1087 + static const struct fscache_state *fscache_object_dead(struct fscache_object *object, 1088 + int event) 1089 + { 1090 + if (!test_and_set_bit(FSCACHE_OBJECT_RUN_AFTER_DEAD, 1091 + &object->flags)) 1092 + return NO_TRANSIT; 1093 + 1094 + WARN(true, "FS-Cache object redispatched after death"); 1095 + return NO_TRANSIT; 1096 + }
+3
fs/iomap.c
··· 114 114 115 115 BUG_ON(pos + len > iomap->offset + iomap->length); 116 116 117 + if (fatal_signal_pending(current)) 118 + return -EINTR; 119 + 117 120 page = grab_cache_page_write_begin(inode->i_mapping, index, flags); 118 121 if (!page) 119 122 return -ENOMEM;
+60 -37
fs/nfsd/vfs.c
··· 332 332 } 333 333 } 334 334 335 + static __be32 336 + nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp, 337 + struct iattr *iap) 338 + { 339 + struct inode *inode = d_inode(fhp->fh_dentry); 340 + int host_err; 341 + 342 + if (iap->ia_size < inode->i_size) { 343 + __be32 err; 344 + 345 + err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry, 346 + NFSD_MAY_TRUNC | NFSD_MAY_OWNER_OVERRIDE); 347 + if (err) 348 + return err; 349 + } 350 + 351 + host_err = get_write_access(inode); 352 + if (host_err) 353 + goto out_nfserrno; 354 + 355 + host_err = locks_verify_truncate(inode, NULL, iap->ia_size); 356 + if (host_err) 357 + goto out_put_write_access; 358 + return 0; 359 + 360 + out_put_write_access: 361 + put_write_access(inode); 362 + out_nfserrno: 363 + return nfserrno(host_err); 364 + } 365 + 335 366 /* 336 367 * Set various file attributes. After this call fhp needs an fh_put. 337 368 */ ··· 377 346 __be32 err; 378 347 int host_err; 379 348 bool get_write_count; 349 + int size_change = 0; 380 350 381 351 if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) 382 352 accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE; ··· 390 358 /* Get inode */ 391 359 err = fh_verify(rqstp, fhp, ftype, accmode); 392 360 if (err) 393 - return err; 361 + goto out; 394 362 if (get_write_count) { 395 363 host_err = fh_want_write(fhp); 396 364 if (host_err) 397 - goto out_host_err; 365 + return nfserrno(host_err); 398 366 } 399 367 400 368 dentry = fhp->fh_dentry; ··· 405 373 iap->ia_valid &= ~ATTR_MODE; 406 374 407 375 if (!iap->ia_valid) 408 - return 0; 376 + goto out; 409 377 410 378 nfsd_sanitize_attrs(inode, iap); 411 379 412 - if (check_guard && guardtime != inode->i_ctime.tv_sec) 413 - return nfserr_notsync; 414 - 415 380 /* 416 381 * The size case is special, it changes the file in addition to the 417 - * attributes, and file systems don't expect it to be mixed with 418 - * "random" attribute changes. We thus split out the size change 419 - * into a separate call for vfs_truncate, and do the rest as a 420 - * a separate setattr call. 382 + * attributes. 421 383 */ 422 384 if (iap->ia_valid & ATTR_SIZE) { 423 - struct path path = { 424 - .mnt = fhp->fh_export->ex_path.mnt, 425 - .dentry = dentry, 426 - }; 427 - bool implicit_mtime = false; 385 + err = nfsd_get_write_access(rqstp, fhp, iap); 386 + if (err) 387 + goto out; 388 + size_change = 1; 428 389 429 390 /* 430 - * vfs_truncate implicity updates the mtime IFF the file size 431 - * actually changes. Avoid the additional seattr call below if 432 - * the only other attribute that the client sends is the mtime. 391 + * RFC5661, Section 18.30.4: 392 + * Changing the size of a file with SETATTR indirectly 393 + * changes the time_modify and change attributes. 394 + * 395 + * (and similar for the older RFCs) 433 396 */ 434 - if (iap->ia_size != i_size_read(inode) && 435 - ((iap->ia_valid & ~(ATTR_SIZE | ATTR_MTIME)) == 0)) 436 - implicit_mtime = true; 437 - 438 - host_err = vfs_truncate(&path, iap->ia_size); 439 - if (host_err) 440 - goto out_host_err; 441 - 442 - iap->ia_valid &= ~ATTR_SIZE; 443 - if (implicit_mtime) 444 - iap->ia_valid &= ~ATTR_MTIME; 445 - if (!iap->ia_valid) 446 - goto done; 397 + if (iap->ia_size != i_size_read(inode)) 398 + iap->ia_valid |= ATTR_MTIME; 447 399 } 448 400 449 401 iap->ia_valid |= ATTR_CTIME; 450 402 403 + if (check_guard && guardtime != inode->i_ctime.tv_sec) { 404 + err = nfserr_notsync; 405 + goto out_put_write_access; 406 + } 407 + 451 408 fh_lock(fhp); 452 409 host_err = notify_change(dentry, iap, NULL); 453 410 fh_unlock(fhp); 454 - if (host_err) 455 - goto out_host_err; 411 + err = nfserrno(host_err); 456 412 457 - done: 458 - host_err = commit_metadata(fhp); 459 - out_host_err: 460 - return nfserrno(host_err); 413 + out_put_write_access: 414 + if (size_change) 415 + put_write_access(inode); 416 + if (!err) 417 + err = nfserrno(commit_metadata(fhp)); 418 + out: 419 + return err; 461 420 } 462 421 463 422 #if defined(CONFIG_NFSD_V4)
+6 -5
include/asm-generic/export.h
··· 9 9 #ifndef KSYM_ALIGN 10 10 #define KSYM_ALIGN 8 11 11 #endif 12 - #ifndef KCRC_ALIGN 13 - #define KCRC_ALIGN 8 14 - #endif 15 12 #else 16 13 #define __put .long 17 14 #ifndef KSYM_ALIGN 18 15 #define KSYM_ALIGN 4 19 16 #endif 17 + #endif 20 18 #ifndef KCRC_ALIGN 21 19 #define KCRC_ALIGN 4 22 - #endif 23 20 #endif 24 21 25 22 #ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX ··· 49 52 .section ___kcrctab\sec+\name,"a" 50 53 .balign KCRC_ALIGN 51 54 KSYM(__kcrctab_\name): 52 - __put KSYM(__crc_\name) 55 + #if defined(CONFIG_MODULE_REL_CRCS) 56 + .long KSYM(__crc_\name) - . 57 + #else 58 + .long KSYM(__crc_\name) 59 + #endif 53 60 .weak KSYM(__crc_\name) 54 61 .previous 55 62 #endif
+1
include/drm/drmP.h
··· 517 517 struct drm_minor *control; /**< Control node */ 518 518 struct drm_minor *primary; /**< Primary node */ 519 519 struct drm_minor *render; /**< Render node */ 520 + bool registered; 520 521 521 522 /* currently active master for this device. Protected by master_mutex */ 522 523 struct drm_master *master;
+15 -1
include/drm/drm_connector.h
··· 381 381 * core drm connector interfaces. Everything added from this callback 382 382 * should be unregistered in the early_unregister callback. 383 383 * 384 + * This is called while holding drm_connector->mutex. 385 + * 384 386 * Returns: 385 387 * 386 388 * 0 on success, or a negative error code on failure. ··· 397 395 * late_register(). It is called from drm_connector_unregister(), 398 396 * early in the driver unload sequence to disable userspace access 399 397 * before data structures are torndown. 398 + * 399 + * This is called while holding drm_connector->mutex. 400 400 */ 401 401 void (*early_unregister)(struct drm_connector *connector); 402 402 ··· 563 559 * @interlace_allowed: can this connector handle interlaced modes? 564 560 * @doublescan_allowed: can this connector handle doublescan? 565 561 * @stereo_allowed: can this connector handle stereo modes? 566 - * @registered: is this connector exposed (registered) with userspace? 567 562 * @modes: modes available on this connector (from fill_modes() + user) 568 563 * @status: one of the drm_connector_status enums (connected, not, or unknown) 569 564 * @probed_modes: list of modes derived directly from the display ··· 611 608 char *name; 612 609 613 610 /** 611 + * @mutex: Lock for general connector state, but currently only protects 612 + * @registered. Most of the connector state is still protected by the 613 + * mutex in &drm_mode_config. 614 + */ 615 + struct mutex mutex; 616 + 617 + /** 614 618 * @index: Compacted connector index, which matches the position inside 615 619 * the mode_config.list for drivers not supporting hot-add/removing. Can 616 620 * be used as an array index. It is invariant over the lifetime of the ··· 630 620 bool interlace_allowed; 631 621 bool doublescan_allowed; 632 622 bool stereo_allowed; 623 + /** 624 + * @registered: Is this connector exposed (registered) with userspace? 625 + * Protected by @mutex. 626 + */ 633 627 bool registered; 634 628 struct list_head modes; /* list of modes on this connector */ 635 629
+3 -4
include/linux/can/core.h
··· 45 45 extern int can_proto_register(const struct can_proto *cp); 46 46 extern void can_proto_unregister(const struct can_proto *cp); 47 47 48 - extern int can_rx_register(struct net_device *dev, canid_t can_id, 49 - canid_t mask, 50 - void (*func)(struct sk_buff *, void *), 51 - void *data, char *ident); 48 + int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask, 49 + void (*func)(struct sk_buff *, void *), 50 + void *data, char *ident, struct sock *sk); 52 51 53 52 extern void can_rx_unregister(struct net_device *dev, canid_t can_id, 54 53 canid_t mask,
-3
include/linux/cpuhotplug.h
··· 8 8 CPUHP_CREATE_THREADS, 9 9 CPUHP_PERF_PREPARE, 10 10 CPUHP_PERF_X86_PREPARE, 11 - CPUHP_PERF_X86_UNCORE_PREP, 12 11 CPUHP_PERF_X86_AMD_UNCORE_PREP, 13 - CPUHP_PERF_X86_RAPL_PREP, 14 12 CPUHP_PERF_BFIN, 15 13 CPUHP_PERF_POWER, 16 14 CPUHP_PERF_SUPERH, ··· 84 86 CPUHP_AP_IRQ_ARMADA_XP_STARTING, 85 87 CPUHP_AP_IRQ_BCM2836_STARTING, 86 88 CPUHP_AP_ARM_MVEBU_COHERENCY, 87 - CPUHP_AP_PERF_X86_UNCORE_STARTING, 88 89 CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING, 89 90 CPUHP_AP_PERF_X86_STARTING, 90 91 CPUHP_AP_PERF_X86_AMD_IBS_STARTING,
+12 -5
include/linux/export.h
··· 43 43 #ifdef CONFIG_MODVERSIONS 44 44 /* Mark the CRC weak since genksyms apparently decides not to 45 45 * generate a checksums for some symbols */ 46 + #if defined(CONFIG_MODULE_REL_CRCS) 46 47 #define __CRC_SYMBOL(sym, sec) \ 47 - extern __visible void *__crc_##sym __attribute__((weak)); \ 48 - static const unsigned long __kcrctab_##sym \ 49 - __used \ 50 - __attribute__((section("___kcrctab" sec "+" #sym), used)) \ 51 - = (unsigned long) &__crc_##sym; 48 + asm(" .section \"___kcrctab" sec "+" #sym "\", \"a\" \n" \ 49 + " .weak " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \ 50 + " .long " VMLINUX_SYMBOL_STR(__crc_##sym) " - . \n" \ 51 + " .previous \n"); 52 + #else 53 + #define __CRC_SYMBOL(sym, sec) \ 54 + asm(" .section \"___kcrctab" sec "+" #sym "\", \"a\" \n" \ 55 + " .weak " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \ 56 + " .long " VMLINUX_SYMBOL_STR(__crc_##sym) " \n" \ 57 + " .previous \n"); 58 + #endif 52 59 #else 53 60 #define __CRC_SYMBOL(sym, sec) 54 61 #endif
+1
include/linux/fscache-cache.h
··· 360 360 #define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */ 361 361 #define FSCACHE_OBJECT_RETIRED 6 /* T if object was retired on relinquishment */ 362 362 #define FSCACHE_OBJECT_KILLED_BY_CACHE 7 /* T if object was killed by the cache */ 363 + #define FSCACHE_OBJECT_RUN_AFTER_DEAD 8 /* T if object has been dispatched after death */ 363 364 364 365 struct list_head cache_link; /* link in cache->object_list */ 365 366 struct hlist_node cookie_link; /* link in cookie->backing_objects */
+30 -2
include/linux/hyperv.h
··· 128 128 u32 ring_data_startoffset; 129 129 u32 priv_write_index; 130 130 u32 priv_read_index; 131 + u32 cached_read_index; 131 132 }; 132 133 133 134 /* ··· 181 180 return write; 182 181 } 183 182 183 + static inline u32 hv_get_cached_bytes_to_write( 184 + const struct hv_ring_buffer_info *rbi) 185 + { 186 + u32 read_loc, write_loc, dsize, write; 187 + 188 + dsize = rbi->ring_datasize; 189 + read_loc = rbi->cached_read_index; 190 + write_loc = rbi->ring_buffer->write_index; 191 + 192 + write = write_loc >= read_loc ? dsize - (write_loc - read_loc) : 193 + read_loc - write_loc; 194 + return write; 195 + } 184 196 /* 185 197 * VMBUS version is 32 bit entity broken up into 186 198 * two 16 bit quantities: major_number. minor_number. ··· 1502 1488 1503 1489 static inline void hv_signal_on_read(struct vmbus_channel *channel) 1504 1490 { 1505 - u32 cur_write_sz; 1491 + u32 cur_write_sz, cached_write_sz; 1506 1492 u32 pending_sz; 1507 1493 struct hv_ring_buffer_info *rbi = &channel->inbound; 1508 1494 ··· 1526 1512 1527 1513 cur_write_sz = hv_get_bytes_to_write(rbi); 1528 1514 1529 - if (cur_write_sz >= pending_sz) 1515 + if (cur_write_sz < pending_sz) 1516 + return; 1517 + 1518 + cached_write_sz = hv_get_cached_bytes_to_write(rbi); 1519 + if (cached_write_sz < pending_sz) 1530 1520 vmbus_setevent(channel); 1531 1521 1532 1522 return; 1523 + } 1524 + 1525 + static inline void 1526 + init_cached_read_index(struct vmbus_channel *channel) 1527 + { 1528 + struct hv_ring_buffer_info *rbi = &channel->inbound; 1529 + 1530 + rbi->cached_read_index = rbi->ring_buffer->read_index; 1533 1531 } 1534 1532 1535 1533 /* ··· 1594 1568 /* 1595 1569 * This call commits the read index and potentially signals the host. 1596 1570 * Here is the pattern for using the "in-place" consumption APIs: 1571 + * 1572 + * init_cached_read_index(); 1597 1573 * 1598 1574 * while (get_next_pkt_raw() { 1599 1575 * process the packet "in-place";
+17
include/linux/irq.h
··· 184 184 * 185 185 * IRQD_TRIGGER_MASK - Mask for the trigger type bits 186 186 * IRQD_SETAFFINITY_PENDING - Affinity setting is pending 187 + * IRQD_ACTIVATED - Interrupt has already been activated 187 188 * IRQD_NO_BALANCING - Balancing disabled for this IRQ 188 189 * IRQD_PER_CPU - Interrupt is per cpu 189 190 * IRQD_AFFINITY_SET - Interrupt affinity was set ··· 203 202 enum { 204 203 IRQD_TRIGGER_MASK = 0xf, 205 204 IRQD_SETAFFINITY_PENDING = (1 << 8), 205 + IRQD_ACTIVATED = (1 << 9), 206 206 IRQD_NO_BALANCING = (1 << 10), 207 207 IRQD_PER_CPU = (1 << 11), 208 208 IRQD_AFFINITY_SET = (1 << 12), ··· 312 310 static inline bool irqd_affinity_is_managed(struct irq_data *d) 313 311 { 314 312 return __irqd_to_state(d) & IRQD_AFFINITY_MANAGED; 313 + } 314 + 315 + static inline bool irqd_is_activated(struct irq_data *d) 316 + { 317 + return __irqd_to_state(d) & IRQD_ACTIVATED; 318 + } 319 + 320 + static inline void irqd_set_activated(struct irq_data *d) 321 + { 322 + __irqd_to_state(d) |= IRQD_ACTIVATED; 323 + } 324 + 325 + static inline void irqd_clr_activated(struct irq_data *d) 326 + { 327 + __irqd_to_state(d) &= ~IRQD_ACTIVATED; 315 328 } 316 329 317 330 #undef __irqd_to_state
+12 -1
include/linux/log2.h
··· 203 203 * ... and so on. 204 204 */ 205 205 206 - #define order_base_2(n) ilog2(roundup_pow_of_two(n)) 206 + static inline __attribute_const__ 207 + int __order_base_2(unsigned long n) 208 + { 209 + return n > 1 ? ilog2(n - 1) + 1 : 0; 210 + } 207 211 212 + #define order_base_2(n) \ 213 + ( \ 214 + __builtin_constant_p(n) ? ( \ 215 + ((n) == 0 || (n) == 1) ? 0 : \ 216 + ilog2((n) - 1) + 1) : \ 217 + __order_base_2(n) \ 218 + ) 208 219 #endif /* _LINUX_LOG2_H */
+2 -1
include/linux/memory_hotplug.h
··· 85 85 extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); 86 86 /* VM interface that may be used by firmware interface */ 87 87 extern int online_pages(unsigned long, unsigned long, int); 88 - extern int test_pages_in_a_zone(unsigned long, unsigned long); 88 + extern int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, 89 + unsigned long *valid_start, unsigned long *valid_end); 89 90 extern void __offline_isolated_pages(unsigned long, unsigned long); 90 91 91 92 typedef void (*online_page_callback_t)(struct page *page);
+7 -7
include/linux/module.h
··· 346 346 347 347 /* Exported symbols */ 348 348 const struct kernel_symbol *syms; 349 - const unsigned long *crcs; 349 + const s32 *crcs; 350 350 unsigned int num_syms; 351 351 352 352 /* Kernel parameters. */ ··· 359 359 /* GPL-only exported symbols. */ 360 360 unsigned int num_gpl_syms; 361 361 const struct kernel_symbol *gpl_syms; 362 - const unsigned long *gpl_crcs; 362 + const s32 *gpl_crcs; 363 363 364 364 #ifdef CONFIG_UNUSED_SYMBOLS 365 365 /* unused exported symbols. */ 366 366 const struct kernel_symbol *unused_syms; 367 - const unsigned long *unused_crcs; 367 + const s32 *unused_crcs; 368 368 unsigned int num_unused_syms; 369 369 370 370 /* GPL-only, unused exported symbols. */ 371 371 unsigned int num_unused_gpl_syms; 372 372 const struct kernel_symbol *unused_gpl_syms; 373 - const unsigned long *unused_gpl_crcs; 373 + const s32 *unused_gpl_crcs; 374 374 #endif 375 375 376 376 #ifdef CONFIG_MODULE_SIG ··· 382 382 383 383 /* symbols that will be GPL-only in the near future. */ 384 384 const struct kernel_symbol *gpl_future_syms; 385 - const unsigned long *gpl_future_crcs; 385 + const s32 *gpl_future_crcs; 386 386 unsigned int num_gpl_future_syms; 387 387 388 388 /* Exception table */ ··· 523 523 524 524 struct symsearch { 525 525 const struct kernel_symbol *start, *stop; 526 - const unsigned long *crcs; 526 + const s32 *crcs; 527 527 enum { 528 528 NOT_GPL_ONLY, 529 529 GPL_ONLY, ··· 539 539 */ 540 540 const struct kernel_symbol *find_symbol(const char *name, 541 541 struct module **owner, 542 - const unsigned long **crc, 542 + const s32 **crc, 543 543 bool gplok, 544 544 bool warn); 545 545
+15 -14
include/linux/netdevice.h
··· 866 866 * of useless work if you return NETDEV_TX_BUSY. 867 867 * Required; cannot be NULL. 868 868 * 869 - * netdev_features_t (*ndo_fix_features)(struct net_device *dev, 870 - * netdev_features_t features); 871 - * Adjusts the requested feature flags according to device-specific 872 - * constraints, and returns the resulting flags. Must not modify 873 - * the device state. 869 + * netdev_features_t (*ndo_features_check)(struct sk_buff *skb, 870 + * struct net_device *dev 871 + * netdev_features_t features); 872 + * Called by core transmit path to determine if device is capable of 873 + * performing offload operations on a given packet. This is to give 874 + * the device an opportunity to implement any restrictions that cannot 875 + * be otherwise expressed by feature flags. The check is called with 876 + * the set of features that the stack has calculated and it returns 877 + * those the driver believes to be appropriate. 874 878 * 875 879 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, 876 880 * void *accel_priv, select_queue_fallback_t fallback); ··· 1032 1028 * Called to release previously enslaved netdev. 1033 1029 * 1034 1030 * Feature/offload setting functions. 1031 + * netdev_features_t (*ndo_fix_features)(struct net_device *dev, 1032 + * netdev_features_t features); 1033 + * Adjusts the requested feature flags according to device-specific 1034 + * constraints, and returns the resulting flags. Must not modify 1035 + * the device state. 1036 + * 1035 1037 * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); 1036 1038 * Called to update device configuration to new features. Passed 1037 1039 * feature set might be less than what was returned by ndo_fix_features()). ··· 1110 1100 * Callback to use for xmit over the accelerated station. This 1111 1101 * is used in place of ndo_start_xmit on accelerated net 1112 1102 * devices. 1113 - * netdev_features_t (*ndo_features_check)(struct sk_buff *skb, 1114 - * struct net_device *dev 1115 - * netdev_features_t features); 1116 - * Called by core transmit path to determine if device is capable of 1117 - * performing offload operations on a given packet. This is to give 1118 - * the device an opportunity to implement any restrictions that cannot 1119 - * be otherwise expressed by feature flags. The check is called with 1120 - * the set of features that the stack has calculated and it returns 1121 - * those the driver believes to be appropriate. 1122 1103 * int (*ndo_set_tx_maxrate)(struct net_device *dev, 1123 1104 * int queue_index, u32 maxrate); 1124 1105 * Called when a user wants to set a max-rate limitation of specific
+2 -2
include/linux/percpu-refcount.h
··· 204 204 static inline bool percpu_ref_tryget(struct percpu_ref *ref) 205 205 { 206 206 unsigned long __percpu *percpu_count; 207 - int ret; 207 + bool ret; 208 208 209 209 rcu_read_lock_sched(); 210 210 ··· 238 238 static inline bool percpu_ref_tryget_live(struct percpu_ref *ref) 239 239 { 240 240 unsigned long __percpu *percpu_count; 241 - int ret = false; 241 + bool ret = false; 242 242 243 243 rcu_read_lock_sched(); 244 244
+5
include/net/ipv6.h
··· 776 776 { 777 777 u32 hash; 778 778 779 + /* @flowlabel may include more than a flow label, eg, the traffic class. 780 + * Here we want only the flow label value. 781 + */ 782 + flowlabel &= IPV6_FLOWLABEL_MASK; 783 + 779 784 if (flowlabel || 780 785 net->ipv6.sysctl.auto_flowlabels == IP6_AUTO_FLOW_LABEL_OFF || 781 786 (!autolabel &&
+3 -1
include/uapi/linux/ethtool.h
··· 1384 1384 ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44, 1385 1385 ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45, 1386 1386 ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46, 1387 + ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47, 1388 + ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48, 1387 1389 1388 1390 1389 1391 /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit ··· 1395 1393 */ 1396 1394 1397 1395 __ETHTOOL_LINK_MODE_LAST 1398 - = ETHTOOL_LINK_MODE_10000baseER_Full_BIT, 1396 + = ETHTOOL_LINK_MODE_5000baseT_Full_BIT, 1399 1397 }; 1400 1398 1401 1399 #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \
+4
init/Kconfig
··· 1987 1987 make them incompatible with the kernel you are running. If 1988 1988 unsure, say N. 1989 1989 1990 + config MODULE_REL_CRCS 1991 + bool 1992 + depends on MODVERSIONS 1993 + 1990 1994 config MODULE_SRCVERSION_ALL 1991 1995 bool "Source checksum for all modules" 1992 1996 help
+5 -8
kernel/cgroup.c
··· 5221 5221 return ERR_PTR(err); 5222 5222 } 5223 5223 5224 + /* 5225 + * The returned cgroup is fully initialized including its control mask, but 5226 + * it isn't associated with its kernfs_node and doesn't have the control 5227 + * mask applied. 5228 + */ 5224 5229 static struct cgroup *cgroup_create(struct cgroup *parent) 5225 5230 { 5226 5231 struct cgroup_root *root = parent->root; ··· 5293 5288 5294 5289 cgroup_propagate_control(cgrp); 5295 5290 5296 - /* @cgrp doesn't have dir yet so the following will only create csses */ 5297 - ret = cgroup_apply_control_enable(cgrp); 5298 - if (ret) 5299 - goto out_destroy; 5300 - 5301 5291 return cgrp; 5302 5292 5303 5293 out_cancel_ref: 5304 5294 percpu_ref_exit(&cgrp->self.refcnt); 5305 5295 out_free_cgrp: 5306 5296 kfree(cgrp); 5307 - return ERR_PTR(ret); 5308 - out_destroy: 5309 - cgroup_destroy_locked(cgrp); 5310 5297 return ERR_PTR(ret); 5311 5298 } 5312 5299
+46 -23
kernel/events/core.c
··· 1469 1469 static void 1470 1470 list_add_event(struct perf_event *event, struct perf_event_context *ctx) 1471 1471 { 1472 - 1473 1472 lockdep_assert_held(&ctx->lock); 1474 1473 1475 1474 WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT); ··· 1623 1624 { 1624 1625 struct perf_event *group_leader = event->group_leader, *pos; 1625 1626 1627 + lockdep_assert_held(&event->ctx->lock); 1628 + 1626 1629 /* 1627 1630 * We can have double attach due to group movement in perf_event_open. 1628 1631 */ ··· 1697 1696 { 1698 1697 struct perf_event *sibling, *tmp; 1699 1698 struct list_head *list = NULL; 1699 + 1700 + lockdep_assert_held(&event->ctx->lock); 1700 1701 1701 1702 /* 1702 1703 * We can have double detach due to exit/hot-unplug + close. ··· 1898 1895 */ 1899 1896 static void perf_remove_from_context(struct perf_event *event, unsigned long flags) 1900 1897 { 1901 - lockdep_assert_held(&event->ctx->mutex); 1898 + struct perf_event_context *ctx = event->ctx; 1899 + 1900 + lockdep_assert_held(&ctx->mutex); 1902 1901 1903 1902 event_function_call(event, __perf_remove_from_context, (void *)flags); 1903 + 1904 + /* 1905 + * The above event_function_call() can NO-OP when it hits 1906 + * TASK_TOMBSTONE. In that case we must already have been detached 1907 + * from the context (by perf_event_exit_event()) but the grouping 1908 + * might still be in-tact. 1909 + */ 1910 + WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT); 1911 + if ((flags & DETACH_GROUP) && 1912 + (event->attach_state & PERF_ATTACH_GROUP)) { 1913 + /* 1914 + * Since in that case we cannot possibly be scheduled, simply 1915 + * detach now. 1916 + */ 1917 + raw_spin_lock_irq(&ctx->lock); 1918 + perf_group_detach(event); 1919 + raw_spin_unlock_irq(&ctx->lock); 1920 + } 1904 1921 } 1905 1922 1906 1923 /* ··· 6632 6609 char *buf = NULL; 6633 6610 char *name; 6634 6611 6612 + if (vma->vm_flags & VM_READ) 6613 + prot |= PROT_READ; 6614 + if (vma->vm_flags & VM_WRITE) 6615 + prot |= PROT_WRITE; 6616 + if (vma->vm_flags & VM_EXEC) 6617 + prot |= PROT_EXEC; 6618 + 6619 + if (vma->vm_flags & VM_MAYSHARE) 6620 + flags = MAP_SHARED; 6621 + else 6622 + flags = MAP_PRIVATE; 6623 + 6624 + if (vma->vm_flags & VM_DENYWRITE) 6625 + flags |= MAP_DENYWRITE; 6626 + if (vma->vm_flags & VM_MAYEXEC) 6627 + flags |= MAP_EXECUTABLE; 6628 + if (vma->vm_flags & VM_LOCKED) 6629 + flags |= MAP_LOCKED; 6630 + if (vma->vm_flags & VM_HUGETLB) 6631 + flags |= MAP_HUGETLB; 6632 + 6635 6633 if (file) { 6636 6634 struct inode *inode; 6637 6635 dev_t dev; ··· 6678 6634 gen = inode->i_generation; 6679 6635 maj = MAJOR(dev); 6680 6636 min = MINOR(dev); 6681 - 6682 - if (vma->vm_flags & VM_READ) 6683 - prot |= PROT_READ; 6684 - if (vma->vm_flags & VM_WRITE) 6685 - prot |= PROT_WRITE; 6686 - if (vma->vm_flags & VM_EXEC) 6687 - prot |= PROT_EXEC; 6688 - 6689 - if (vma->vm_flags & VM_MAYSHARE) 6690 - flags = MAP_SHARED; 6691 - else 6692 - flags = MAP_PRIVATE; 6693 - 6694 - if (vma->vm_flags & VM_DENYWRITE) 6695 - flags |= MAP_DENYWRITE; 6696 - if (vma->vm_flags & VM_MAYEXEC) 6697 - flags |= MAP_EXECUTABLE; 6698 - if (vma->vm_flags & VM_LOCKED) 6699 - flags |= MAP_LOCKED; 6700 - if (vma->vm_flags & VM_HUGETLB) 6701 - flags |= MAP_HUGETLB; 6702 6637 6703 6638 goto got_name; 6704 6639 } else {
+30 -14
kernel/irq/irqdomain.c
··· 1346 1346 } 1347 1347 EXPORT_SYMBOL_GPL(irq_domain_free_irqs_parent); 1348 1348 1349 + static void __irq_domain_activate_irq(struct irq_data *irq_data) 1350 + { 1351 + if (irq_data && irq_data->domain) { 1352 + struct irq_domain *domain = irq_data->domain; 1353 + 1354 + if (irq_data->parent_data) 1355 + __irq_domain_activate_irq(irq_data->parent_data); 1356 + if (domain->ops->activate) 1357 + domain->ops->activate(domain, irq_data); 1358 + } 1359 + } 1360 + 1361 + static void __irq_domain_deactivate_irq(struct irq_data *irq_data) 1362 + { 1363 + if (irq_data && irq_data->domain) { 1364 + struct irq_domain *domain = irq_data->domain; 1365 + 1366 + if (domain->ops->deactivate) 1367 + domain->ops->deactivate(domain, irq_data); 1368 + if (irq_data->parent_data) 1369 + __irq_domain_deactivate_irq(irq_data->parent_data); 1370 + } 1371 + } 1372 + 1349 1373 /** 1350 1374 * irq_domain_activate_irq - Call domain_ops->activate recursively to activate 1351 1375 * interrupt ··· 1380 1356 */ 1381 1357 void irq_domain_activate_irq(struct irq_data *irq_data) 1382 1358 { 1383 - if (irq_data && irq_data->domain) { 1384 - struct irq_domain *domain = irq_data->domain; 1385 - 1386 - if (irq_data->parent_data) 1387 - irq_domain_activate_irq(irq_data->parent_data); 1388 - if (domain->ops->activate) 1389 - domain->ops->activate(domain, irq_data); 1359 + if (!irqd_is_activated(irq_data)) { 1360 + __irq_domain_activate_irq(irq_data); 1361 + irqd_set_activated(irq_data); 1390 1362 } 1391 1363 } 1392 1364 ··· 1396 1376 */ 1397 1377 void irq_domain_deactivate_irq(struct irq_data *irq_data) 1398 1378 { 1399 - if (irq_data && irq_data->domain) { 1400 - struct irq_domain *domain = irq_data->domain; 1401 - 1402 - if (domain->ops->deactivate) 1403 - domain->ops->deactivate(domain, irq_data); 1404 - if (irq_data->parent_data) 1405 - irq_domain_deactivate_irq(irq_data->parent_data); 1379 + if (irqd_is_activated(irq_data)) { 1380 + __irq_domain_deactivate_irq(irq_data); 1381 + irqd_clr_activated(irq_data); 1406 1382 } 1407 1383 } 1408 1384
+25 -28
kernel/module.c
··· 389 389 extern const struct kernel_symbol __stop___ksymtab_gpl[]; 390 390 extern const struct kernel_symbol __start___ksymtab_gpl_future[]; 391 391 extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; 392 - extern const unsigned long __start___kcrctab[]; 393 - extern const unsigned long __start___kcrctab_gpl[]; 394 - extern const unsigned long __start___kcrctab_gpl_future[]; 392 + extern const s32 __start___kcrctab[]; 393 + extern const s32 __start___kcrctab_gpl[]; 394 + extern const s32 __start___kcrctab_gpl_future[]; 395 395 #ifdef CONFIG_UNUSED_SYMBOLS 396 396 extern const struct kernel_symbol __start___ksymtab_unused[]; 397 397 extern const struct kernel_symbol __stop___ksymtab_unused[]; 398 398 extern const struct kernel_symbol __start___ksymtab_unused_gpl[]; 399 399 extern const struct kernel_symbol __stop___ksymtab_unused_gpl[]; 400 - extern const unsigned long __start___kcrctab_unused[]; 401 - extern const unsigned long __start___kcrctab_unused_gpl[]; 400 + extern const s32 __start___kcrctab_unused[]; 401 + extern const s32 __start___kcrctab_unused_gpl[]; 402 402 #endif 403 403 404 404 #ifndef CONFIG_MODVERSIONS ··· 497 497 498 498 /* Output */ 499 499 struct module *owner; 500 - const unsigned long *crc; 500 + const s32 *crc; 501 501 const struct kernel_symbol *sym; 502 502 }; 503 503 ··· 563 563 * (optional) module which owns it. Needs preempt disabled or module_mutex. */ 564 564 const struct kernel_symbol *find_symbol(const char *name, 565 565 struct module **owner, 566 - const unsigned long **crc, 566 + const s32 **crc, 567 567 bool gplok, 568 568 bool warn) 569 569 { ··· 1249 1249 } 1250 1250 1251 1251 #ifdef CONFIG_MODVERSIONS 1252 - /* If the arch applies (non-zero) relocations to kernel kcrctab, unapply it. */ 1253 - static unsigned long maybe_relocated(unsigned long crc, 1254 - const struct module *crc_owner) 1252 + 1253 + static u32 resolve_rel_crc(const s32 *crc) 1255 1254 { 1256 - #ifdef ARCH_RELOCATES_KCRCTAB 1257 - if (crc_owner == NULL) 1258 - return crc - (unsigned long)reloc_start; 1259 - #endif 1260 - return crc; 1255 + return *(u32 *)((void *)crc + *crc); 1261 1256 } 1262 1257 1263 1258 static int check_version(Elf_Shdr *sechdrs, 1264 1259 unsigned int versindex, 1265 1260 const char *symname, 1266 1261 struct module *mod, 1267 - const unsigned long *crc, 1268 - const struct module *crc_owner) 1262 + const s32 *crc) 1269 1263 { 1270 1264 unsigned int i, num_versions; 1271 1265 struct modversion_info *versions; ··· 1277 1283 / sizeof(struct modversion_info); 1278 1284 1279 1285 for (i = 0; i < num_versions; i++) { 1286 + u32 crcval; 1287 + 1280 1288 if (strcmp(versions[i].name, symname) != 0) 1281 1289 continue; 1282 1290 1283 - if (versions[i].crc == maybe_relocated(*crc, crc_owner)) 1291 + if (IS_ENABLED(CONFIG_MODULE_REL_CRCS)) 1292 + crcval = resolve_rel_crc(crc); 1293 + else 1294 + crcval = *crc; 1295 + if (versions[i].crc == crcval) 1284 1296 return 1; 1285 - pr_debug("Found checksum %lX vs module %lX\n", 1286 - maybe_relocated(*crc, crc_owner), versions[i].crc); 1297 + pr_debug("Found checksum %X vs module %lX\n", 1298 + crcval, versions[i].crc); 1287 1299 goto bad_version; 1288 1300 } 1289 1301 ··· 1307 1307 unsigned int versindex, 1308 1308 struct module *mod) 1309 1309 { 1310 - const unsigned long *crc; 1310 + const s32 *crc; 1311 1311 1312 1312 /* 1313 1313 * Since this should be found in kernel (which can't be removed), no ··· 1321 1321 } 1322 1322 preempt_enable(); 1323 1323 return check_version(sechdrs, versindex, 1324 - VMLINUX_SYMBOL_STR(module_layout), mod, crc, 1325 - NULL); 1324 + VMLINUX_SYMBOL_STR(module_layout), mod, crc); 1326 1325 } 1327 1326 1328 1327 /* First part is kernel version, which we ignore if module has crcs. */ ··· 1339 1340 unsigned int versindex, 1340 1341 const char *symname, 1341 1342 struct module *mod, 1342 - const unsigned long *crc, 1343 - const struct module *crc_owner) 1343 + const s32 *crc) 1344 1344 { 1345 1345 return 1; 1346 1346 } ··· 1366 1368 { 1367 1369 struct module *owner; 1368 1370 const struct kernel_symbol *sym; 1369 - const unsigned long *crc; 1371 + const s32 *crc; 1370 1372 int err; 1371 1373 1372 1374 /* ··· 1381 1383 if (!sym) 1382 1384 goto unlock; 1383 1385 1384 - if (!check_version(info->sechdrs, info->index.vers, name, mod, crc, 1385 - owner)) { 1386 + if (!check_version(info->sechdrs, info->index.vers, name, mod, crc)) { 1386 1387 sym = ERR_PTR(-EINVAL); 1387 1388 goto getname; 1388 1389 }
+5 -3
kernel/trace/trace_hwlat.c
··· 266 266 static struct cpumask save_cpumask; 267 267 static bool disable_migrate; 268 268 269 - static void move_to_next_cpu(void) 269 + static void move_to_next_cpu(bool initmask) 270 270 { 271 271 static struct cpumask *current_mask; 272 272 int next_cpu; ··· 275 275 return; 276 276 277 277 /* Just pick the first CPU on first iteration */ 278 - if (!current_mask) { 278 + if (initmask) { 279 279 current_mask = &save_cpumask; 280 280 get_online_cpus(); 281 281 cpumask_and(current_mask, cpu_online_mask, tracing_buffer_mask); ··· 330 330 static int kthread_fn(void *data) 331 331 { 332 332 u64 interval; 333 + bool initmask = true; 333 334 334 335 while (!kthread_should_stop()) { 335 336 336 - move_to_next_cpu(); 337 + move_to_next_cpu(initmask); 338 + initmask = false; 337 339 338 340 local_irq_disable(); 339 341 get_sample();
+1 -1
kernel/trace/trace_kprobe.c
··· 1372 1372 return a1 + a2 + a3 + a4 + a5 + a6; 1373 1373 } 1374 1374 1375 - static struct __init trace_event_file * 1375 + static __init struct trace_event_file * 1376 1376 find_trace_probe_file(struct trace_kprobe *tk, struct trace_array *tr) 1377 1377 { 1378 1378 struct trace_event_file *file;
+5
mm/filemap.c
··· 1791 1791 1792 1792 cond_resched(); 1793 1793 find_page: 1794 + if (fatal_signal_pending(current)) { 1795 + error = -EINTR; 1796 + goto out; 1797 + } 1798 + 1794 1799 page = find_get_page(mapping, index); 1795 1800 if (!page) { 1796 1801 page_cache_sync_readahead(mapping,
+3
mm/kasan/report.c
··· 13 13 * 14 14 */ 15 15 16 + #include <linux/ftrace.h> 16 17 #include <linux/kernel.h> 17 18 #include <linux/mm.h> 18 19 #include <linux/printk.h> ··· 300 299 301 300 if (likely(!kasan_report_enabled())) 302 301 return; 302 + 303 + disable_trace_on_warning(); 303 304 304 305 info.access_addr = (void *)addr; 305 306 info.access_size = size;
+21 -7
mm/memory_hotplug.c
··· 1483 1483 } 1484 1484 1485 1485 /* 1486 - * Confirm all pages in a range [start, end) is belongs to the same zone. 1486 + * Confirm all pages in a range [start, end) belong to the same zone. 1487 + * When true, return its valid [start, end). 1487 1488 */ 1488 - int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn) 1489 + int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, 1490 + unsigned long *valid_start, unsigned long *valid_end) 1489 1491 { 1490 1492 unsigned long pfn, sec_end_pfn; 1493 + unsigned long start, end; 1491 1494 struct zone *zone = NULL; 1492 1495 struct page *page; 1493 1496 int i; 1494 - for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn); 1497 + for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn + 1); 1495 1498 pfn < end_pfn; 1496 - pfn = sec_end_pfn + 1, sec_end_pfn += PAGES_PER_SECTION) { 1499 + pfn = sec_end_pfn, sec_end_pfn += PAGES_PER_SECTION) { 1497 1500 /* Make sure the memory section is present first */ 1498 1501 if (!present_section_nr(pfn_to_section_nr(pfn))) 1499 1502 continue; ··· 1512 1509 page = pfn_to_page(pfn + i); 1513 1510 if (zone && page_zone(page) != zone) 1514 1511 return 0; 1512 + if (!zone) 1513 + start = pfn + i; 1515 1514 zone = page_zone(page); 1515 + end = pfn + MAX_ORDER_NR_PAGES; 1516 1516 } 1517 1517 } 1518 - return 1; 1518 + 1519 + if (zone) { 1520 + *valid_start = start; 1521 + *valid_end = end; 1522 + return 1; 1523 + } else { 1524 + return 0; 1525 + } 1519 1526 } 1520 1527 1521 1528 /* ··· 1852 1839 long offlined_pages; 1853 1840 int ret, drain, retry_max, node; 1854 1841 unsigned long flags; 1842 + unsigned long valid_start, valid_end; 1855 1843 struct zone *zone; 1856 1844 struct memory_notify arg; 1857 1845 ··· 1863 1849 return -EINVAL; 1864 1850 /* This makes hotplug much easier...and readable. 1865 1851 we assume this for now. .*/ 1866 - if (!test_pages_in_a_zone(start_pfn, end_pfn)) 1852 + if (!test_pages_in_a_zone(start_pfn, end_pfn, &valid_start, &valid_end)) 1867 1853 return -EINVAL; 1868 1854 1869 - zone = page_zone(pfn_to_page(start_pfn)); 1855 + zone = page_zone(pfn_to_page(valid_start)); 1870 1856 node = zone_to_nid(zone); 1871 1857 nr_pages = end_pfn - start_pfn; 1872 1858
+9 -2
mm/shmem.c
··· 415 415 struct shrink_control *sc, unsigned long nr_to_split) 416 416 { 417 417 LIST_HEAD(list), *pos, *next; 418 + LIST_HEAD(to_remove); 418 419 struct inode *inode; 419 420 struct shmem_inode_info *info; 420 421 struct page *page; ··· 442 441 /* Check if there's anything to gain */ 443 442 if (round_up(inode->i_size, PAGE_SIZE) == 444 443 round_up(inode->i_size, HPAGE_PMD_SIZE)) { 445 - list_del_init(&info->shrinklist); 444 + list_move(&info->shrinklist, &to_remove); 446 445 removed++; 447 - iput(inode); 448 446 goto next; 449 447 } 450 448 ··· 453 453 break; 454 454 } 455 455 spin_unlock(&sbinfo->shrinklist_lock); 456 + 457 + list_for_each_safe(pos, next, &to_remove) { 458 + info = list_entry(pos, struct shmem_inode_info, shrinklist); 459 + inode = &info->vfs_inode; 460 + list_del_init(&info->shrinklist); 461 + iput(inode); 462 + } 456 463 457 464 list_for_each_safe(pos, next, &list) { 458 465 int ret;
+29 -1
mm/zswap.c
··· 78 78 79 79 /* Enable/disable zswap (disabled by default) */ 80 80 static bool zswap_enabled; 81 - module_param_named(enabled, zswap_enabled, bool, 0644); 81 + static int zswap_enabled_param_set(const char *, 82 + const struct kernel_param *); 83 + static struct kernel_param_ops zswap_enabled_param_ops = { 84 + .set = zswap_enabled_param_set, 85 + .get = param_get_bool, 86 + }; 87 + module_param_cb(enabled, &zswap_enabled_param_ops, &zswap_enabled, 0644); 82 88 83 89 /* Crypto compressor to use */ 84 90 #define ZSWAP_COMPRESSOR_DEFAULT "lzo" ··· 181 175 182 176 /* used by param callback function */ 183 177 static bool zswap_init_started; 178 + 179 + /* fatal error during init */ 180 + static bool zswap_init_failed; 184 181 185 182 /********************************* 186 183 * helpers and fwd declarations ··· 633 624 char *s = strstrip((char *)val); 634 625 int ret; 635 626 627 + if (zswap_init_failed) { 628 + pr_err("can't set param, initialization failed\n"); 629 + return -ENODEV; 630 + } 631 + 636 632 /* no change required */ 637 633 if (!strcmp(s, *(char **)kp->arg)) 638 634 return 0; ··· 715 701 const struct kernel_param *kp) 716 702 { 717 703 return __zswap_param_set(val, kp, NULL, zswap_compressor); 704 + } 705 + 706 + static int zswap_enabled_param_set(const char *val, 707 + const struct kernel_param *kp) 708 + { 709 + if (zswap_init_failed) { 710 + pr_err("can't enable, initialization failed\n"); 711 + return -ENODEV; 712 + } 713 + 714 + return param_set_bool(val, kp); 718 715 } 719 716 720 717 /********************************* ··· 1226 1201 dstmem_fail: 1227 1202 zswap_entry_cache_destroy(); 1228 1203 cache_fail: 1204 + /* if built-in, we aren't unloaded on failure; don't allow use */ 1205 + zswap_init_failed = true; 1206 + zswap_enabled = false; 1229 1207 return -ENOMEM; 1230 1208 } 1231 1209 /* must be late so crypto has time to come up */
+10 -2
net/can/af_can.c
··· 445 445 * @func: callback function on filter match 446 446 * @data: returned parameter for callback function 447 447 * @ident: string for calling module identification 448 + * @sk: socket pointer (might be NULL) 448 449 * 449 450 * Description: 450 451 * Invokes the callback function with the received sk_buff and the given ··· 469 468 */ 470 469 int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask, 471 470 void (*func)(struct sk_buff *, void *), void *data, 472 - char *ident) 471 + char *ident, struct sock *sk) 473 472 { 474 473 struct receiver *r; 475 474 struct hlist_head *rl; ··· 497 496 r->func = func; 498 497 r->data = data; 499 498 r->ident = ident; 499 + r->sk = sk; 500 500 501 501 hlist_add_head_rcu(&r->list, rl); 502 502 d->entries++; ··· 522 520 static void can_rx_delete_receiver(struct rcu_head *rp) 523 521 { 524 522 struct receiver *r = container_of(rp, struct receiver, rcu); 523 + struct sock *sk = r->sk; 525 524 526 525 kmem_cache_free(rcv_cache, r); 526 + if (sk) 527 + sock_put(sk); 527 528 } 528 529 529 530 /** ··· 601 596 spin_unlock(&can_rcvlists_lock); 602 597 603 598 /* schedule the receiver item for deletion */ 604 - if (r) 599 + if (r) { 600 + if (r->sk) 601 + sock_hold(r->sk); 605 602 call_rcu(&r->rcu, can_rx_delete_receiver); 603 + } 606 604 } 607 605 EXPORT_SYMBOL(can_rx_unregister); 608 606
+2 -1
net/can/af_can.h
··· 50 50 51 51 struct receiver { 52 52 struct hlist_node list; 53 - struct rcu_head rcu; 54 53 canid_t can_id; 55 54 canid_t mask; 56 55 unsigned long matches; 57 56 void (*func)(struct sk_buff *, void *); 58 57 void *data; 59 58 char *ident; 59 + struct sock *sk; 60 + struct rcu_head rcu; 60 61 }; 61 62 62 63 #define CAN_SFF_RCV_ARRAY_SZ (1 << CAN_SFF_ID_BITS)
+18 -9
net/can/bcm.c
··· 734 734 735 735 static void bcm_remove_op(struct bcm_op *op) 736 736 { 737 - hrtimer_cancel(&op->timer); 738 - hrtimer_cancel(&op->thrtimer); 737 + if (op->tsklet.func) { 738 + while (test_bit(TASKLET_STATE_SCHED, &op->tsklet.state) || 739 + test_bit(TASKLET_STATE_RUN, &op->tsklet.state) || 740 + hrtimer_active(&op->timer)) { 741 + hrtimer_cancel(&op->timer); 742 + tasklet_kill(&op->tsklet); 743 + } 744 + } 739 745 740 - if (op->tsklet.func) 741 - tasklet_kill(&op->tsklet); 742 - 743 - if (op->thrtsklet.func) 744 - tasklet_kill(&op->thrtsklet); 746 + if (op->thrtsklet.func) { 747 + while (test_bit(TASKLET_STATE_SCHED, &op->thrtsklet.state) || 748 + test_bit(TASKLET_STATE_RUN, &op->thrtsklet.state) || 749 + hrtimer_active(&op->thrtimer)) { 750 + hrtimer_cancel(&op->thrtimer); 751 + tasklet_kill(&op->thrtsklet); 752 + } 753 + } 745 754 746 755 if ((op->frames) && (op->frames != &op->sframe)) 747 756 kfree(op->frames); ··· 1225 1216 err = can_rx_register(dev, op->can_id, 1226 1217 REGMASK(op->can_id), 1227 1218 bcm_rx_handler, op, 1228 - "bcm"); 1219 + "bcm", sk); 1229 1220 1230 1221 op->rx_reg_dev = dev; 1231 1222 dev_put(dev); ··· 1234 1225 } else 1235 1226 err = can_rx_register(NULL, op->can_id, 1236 1227 REGMASK(op->can_id), 1237 - bcm_rx_handler, op, "bcm"); 1228 + bcm_rx_handler, op, "bcm", sk); 1238 1229 if (err) { 1239 1230 /* this bcm rx op is broken -> remove it */ 1240 1231 list_del(&op->list);
+1 -1
net/can/gw.c
··· 442 442 { 443 443 return can_rx_register(gwj->src.dev, gwj->ccgw.filter.can_id, 444 444 gwj->ccgw.filter.can_mask, can_can_gw_rcv, 445 - gwj, "gw"); 445 + gwj, "gw", NULL); 446 446 } 447 447 448 448 static inline void cgw_unregister_filter(struct cgw_job *gwj)
+2 -2
net/can/raw.c
··· 190 190 for (i = 0; i < count; i++) { 191 191 err = can_rx_register(dev, filter[i].can_id, 192 192 filter[i].can_mask, 193 - raw_rcv, sk, "raw"); 193 + raw_rcv, sk, "raw", sk); 194 194 if (err) { 195 195 /* clean up successfully registered filters */ 196 196 while (--i >= 0) ··· 211 211 212 212 if (err_mask) 213 213 err = can_rx_register(dev, 0, err_mask | CAN_ERR_FLAG, 214 - raw_rcv, sk, "raw"); 214 + raw_rcv, sk, "raw", sk); 215 215 216 216 return err; 217 217 }
+4 -2
net/ipv4/tcp_output.c
··· 2518 2518 int full_space = min_t(int, tp->window_clamp, allowed_space); 2519 2519 int window; 2520 2520 2521 - if (mss > full_space) 2521 + if (unlikely(mss > full_space)) { 2522 2522 mss = full_space; 2523 - 2523 + if (mss <= 0) 2524 + return 0; 2525 + } 2524 2526 if (free_space < (full_space >> 1)) { 2525 2527 icsk->icsk_ack.quick = 0; 2526 2528
+1 -1
net/ipv6/ip6_output.c
··· 1344 1344 */ 1345 1345 if (transhdrlen && sk->sk_protocol == IPPROTO_UDP && 1346 1346 headersize == sizeof(struct ipv6hdr) && 1347 - length < mtu - headersize && 1347 + length <= mtu - headersize && 1348 1348 !(flags & MSG_MORE) && 1349 1349 rt->dst.dev->features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM)) 1350 1350 csummode = CHECKSUM_PARTIAL;
+1 -1
net/ipv6/ip6_tunnel.c
··· 441 441 if (i + sizeof(*tel) > optlen) 442 442 break; 443 443 444 - tel = (struct ipv6_tlv_tnl_enc_lim *) skb->data + off + i; 444 + tel = (struct ipv6_tlv_tnl_enc_lim *)(skb->data + off + i); 445 445 /* return index of option if found and valid */ 446 446 if (tel->type == IPV6_TLV_TNL_ENCAP_LIMIT && 447 447 tel->length == 1)
+2 -2
net/sched/cls_flower.c
··· 568 568 &mask->icmp.type, 569 569 TCA_FLOWER_KEY_ICMPV6_TYPE_MASK, 570 570 sizeof(key->icmp.type)); 571 - fl_set_key_val(tb, &key->icmp.code, TCA_FLOWER_KEY_ICMPV4_CODE, 571 + fl_set_key_val(tb, &key->icmp.code, TCA_FLOWER_KEY_ICMPV6_CODE, 572 572 &mask->icmp.code, 573 - TCA_FLOWER_KEY_ICMPV4_CODE_MASK, 573 + TCA_FLOWER_KEY_ICMPV6_CODE_MASK, 574 574 sizeof(key->icmp.code)); 575 575 } 576 576
+45 -82
net/sched/cls_matchall.c
··· 16 16 #include <net/sch_generic.h> 17 17 #include <net/pkt_cls.h> 18 18 19 - struct cls_mall_filter { 19 + struct cls_mall_head { 20 20 struct tcf_exts exts; 21 21 struct tcf_result res; 22 22 u32 handle; 23 - struct rcu_head rcu; 24 23 u32 flags; 25 - }; 26 - 27 - struct cls_mall_head { 28 - struct cls_mall_filter *filter; 29 24 struct rcu_head rcu; 30 25 }; 31 26 ··· 28 33 struct tcf_result *res) 29 34 { 30 35 struct cls_mall_head *head = rcu_dereference_bh(tp->root); 31 - struct cls_mall_filter *f = head->filter; 32 36 33 - if (tc_skip_sw(f->flags)) 37 + if (tc_skip_sw(head->flags)) 34 38 return -1; 35 39 36 - return tcf_exts_exec(skb, &f->exts, res); 40 + return tcf_exts_exec(skb, &head->exts, res); 37 41 } 38 42 39 43 static int mall_init(struct tcf_proto *tp) 40 44 { 41 - struct cls_mall_head *head; 42 - 43 - head = kzalloc(sizeof(*head), GFP_KERNEL); 44 - if (!head) 45 - return -ENOBUFS; 46 - 47 - rcu_assign_pointer(tp->root, head); 48 - 49 45 return 0; 50 46 } 51 47 52 - static void mall_destroy_filter(struct rcu_head *head) 48 + static void mall_destroy_rcu(struct rcu_head *rcu) 53 49 { 54 - struct cls_mall_filter *f = container_of(head, struct cls_mall_filter, rcu); 50 + struct cls_mall_head *head = container_of(rcu, struct cls_mall_head, 51 + rcu); 55 52 56 - tcf_exts_destroy(&f->exts); 57 - 58 - kfree(f); 53 + tcf_exts_destroy(&head->exts); 54 + kfree(head); 59 55 } 60 56 61 57 static int mall_replace_hw_filter(struct tcf_proto *tp, 62 - struct cls_mall_filter *f, 58 + struct cls_mall_head *head, 63 59 unsigned long cookie) 64 60 { 65 61 struct net_device *dev = tp->q->dev_queue->dev; ··· 60 74 offload.type = TC_SETUP_MATCHALL; 61 75 offload.cls_mall = &mall_offload; 62 76 offload.cls_mall->command = TC_CLSMATCHALL_REPLACE; 63 - offload.cls_mall->exts = &f->exts; 77 + offload.cls_mall->exts = &head->exts; 64 78 offload.cls_mall->cookie = cookie; 65 79 66 80 return dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol, ··· 68 82 } 69 83 70 84 static void mall_destroy_hw_filter(struct tcf_proto *tp, 71 - struct cls_mall_filter *f, 85 + struct cls_mall_head *head, 72 86 unsigned long cookie) 73 87 { 74 88 struct net_device *dev = tp->q->dev_queue->dev; ··· 89 103 { 90 104 struct cls_mall_head *head = rtnl_dereference(tp->root); 91 105 struct net_device *dev = tp->q->dev_queue->dev; 92 - struct cls_mall_filter *f = head->filter; 93 106 94 - if (!force && f) 95 - return false; 107 + if (!head) 108 + return true; 96 109 97 - if (f) { 98 - if (tc_should_offload(dev, tp, f->flags)) 99 - mall_destroy_hw_filter(tp, f, (unsigned long) f); 110 + if (tc_should_offload(dev, tp, head->flags)) 111 + mall_destroy_hw_filter(tp, head, (unsigned long) head); 100 112 101 - call_rcu(&f->rcu, mall_destroy_filter); 102 - } 103 - kfree_rcu(head, rcu); 113 + call_rcu(&head->rcu, mall_destroy_rcu); 104 114 return true; 105 115 } 106 116 107 117 static unsigned long mall_get(struct tcf_proto *tp, u32 handle) 108 118 { 109 - struct cls_mall_head *head = rtnl_dereference(tp->root); 110 - struct cls_mall_filter *f = head->filter; 111 - 112 - if (f && f->handle == handle) 113 - return (unsigned long) f; 114 - return 0; 119 + return 0UL; 115 120 } 116 121 117 122 static const struct nla_policy mall_policy[TCA_MATCHALL_MAX + 1] = { ··· 111 134 }; 112 135 113 136 static int mall_set_parms(struct net *net, struct tcf_proto *tp, 114 - struct cls_mall_filter *f, 137 + struct cls_mall_head *head, 115 138 unsigned long base, struct nlattr **tb, 116 139 struct nlattr *est, bool ovr) 117 140 { ··· 124 147 return err; 125 148 126 149 if (tb[TCA_MATCHALL_CLASSID]) { 127 - f->res.classid = nla_get_u32(tb[TCA_MATCHALL_CLASSID]); 128 - tcf_bind_filter(tp, &f->res, base); 150 + head->res.classid = nla_get_u32(tb[TCA_MATCHALL_CLASSID]); 151 + tcf_bind_filter(tp, &head->res, base); 129 152 } 130 153 131 - tcf_exts_change(tp, &f->exts, &e); 154 + tcf_exts_change(tp, &head->exts, &e); 132 155 133 156 return 0; 134 157 } ··· 139 162 unsigned long *arg, bool ovr) 140 163 { 141 164 struct cls_mall_head *head = rtnl_dereference(tp->root); 142 - struct cls_mall_filter *fold = (struct cls_mall_filter *) *arg; 143 165 struct net_device *dev = tp->q->dev_queue->dev; 144 - struct cls_mall_filter *f; 145 166 struct nlattr *tb[TCA_MATCHALL_MAX + 1]; 167 + struct cls_mall_head *new; 146 168 u32 flags = 0; 147 169 int err; 148 170 149 171 if (!tca[TCA_OPTIONS]) 150 172 return -EINVAL; 151 173 152 - if (head->filter) 153 - return -EBUSY; 154 - 155 - if (fold) 156 - return -EINVAL; 174 + if (head) 175 + return -EEXIST; 157 176 158 177 err = nla_parse_nested(tb, TCA_MATCHALL_MAX, 159 178 tca[TCA_OPTIONS], mall_policy); ··· 162 189 return -EINVAL; 163 190 } 164 191 165 - f = kzalloc(sizeof(*f), GFP_KERNEL); 166 - if (!f) 192 + new = kzalloc(sizeof(*new), GFP_KERNEL); 193 + if (!new) 167 194 return -ENOBUFS; 168 195 169 - tcf_exts_init(&f->exts, TCA_MATCHALL_ACT, 0); 196 + tcf_exts_init(&new->exts, TCA_MATCHALL_ACT, 0); 170 197 171 198 if (!handle) 172 199 handle = 1; 173 - f->handle = handle; 174 - f->flags = flags; 200 + new->handle = handle; 201 + new->flags = flags; 175 202 176 - err = mall_set_parms(net, tp, f, base, tb, tca[TCA_RATE], ovr); 203 + err = mall_set_parms(net, tp, new, base, tb, tca[TCA_RATE], ovr); 177 204 if (err) 178 205 goto errout; 179 206 180 207 if (tc_should_offload(dev, tp, flags)) { 181 - err = mall_replace_hw_filter(tp, f, (unsigned long) f); 208 + err = mall_replace_hw_filter(tp, new, (unsigned long) new); 182 209 if (err) { 183 210 if (tc_skip_sw(flags)) 184 211 goto errout; ··· 187 214 } 188 215 } 189 216 190 - *arg = (unsigned long) f; 191 - rcu_assign_pointer(head->filter, f); 192 - 217 + *arg = (unsigned long) head; 218 + rcu_assign_pointer(tp->root, new); 219 + if (head) 220 + call_rcu(&head->rcu, mall_destroy_rcu); 193 221 return 0; 194 222 195 223 errout: 196 - kfree(f); 224 + kfree(new); 197 225 return err; 198 226 } 199 227 200 228 static int mall_delete(struct tcf_proto *tp, unsigned long arg) 201 229 { 202 - struct cls_mall_head *head = rtnl_dereference(tp->root); 203 - struct cls_mall_filter *f = (struct cls_mall_filter *) arg; 204 - struct net_device *dev = tp->q->dev_queue->dev; 205 - 206 - if (tc_should_offload(dev, tp, f->flags)) 207 - mall_destroy_hw_filter(tp, f, (unsigned long) f); 208 - 209 - RCU_INIT_POINTER(head->filter, NULL); 210 - tcf_unbind_filter(tp, &f->res); 211 - call_rcu(&f->rcu, mall_destroy_filter); 212 - return 0; 230 + return -EOPNOTSUPP; 213 231 } 214 232 215 233 static void mall_walk(struct tcf_proto *tp, struct tcf_walker *arg) 216 234 { 217 235 struct cls_mall_head *head = rtnl_dereference(tp->root); 218 - struct cls_mall_filter *f = head->filter; 219 236 220 237 if (arg->count < arg->skip) 221 238 goto skip; 222 - if (arg->fn(tp, (unsigned long) f, arg) < 0) 239 + if (arg->fn(tp, (unsigned long) head, arg) < 0) 223 240 arg->stop = 1; 224 241 skip: 225 242 arg->count++; ··· 218 255 static int mall_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, 219 256 struct sk_buff *skb, struct tcmsg *t) 220 257 { 221 - struct cls_mall_filter *f = (struct cls_mall_filter *) fh; 258 + struct cls_mall_head *head = (struct cls_mall_head *) fh; 222 259 struct nlattr *nest; 223 260 224 - if (!f) 261 + if (!head) 225 262 return skb->len; 226 263 227 - t->tcm_handle = f->handle; 264 + t->tcm_handle = head->handle; 228 265 229 266 nest = nla_nest_start(skb, TCA_OPTIONS); 230 267 if (!nest) 231 268 goto nla_put_failure; 232 269 233 - if (f->res.classid && 234 - nla_put_u32(skb, TCA_MATCHALL_CLASSID, f->res.classid)) 270 + if (head->res.classid && 271 + nla_put_u32(skb, TCA_MATCHALL_CLASSID, head->res.classid)) 235 272 goto nla_put_failure; 236 273 237 - if (tcf_exts_dump(skb, &f->exts)) 274 + if (tcf_exts_dump(skb, &head->exts)) 238 275 goto nla_put_failure; 239 276 240 277 nla_nest_end(skb, nest); 241 278 242 - if (tcf_exts_dump_stats(skb, &f->exts) < 0) 279 + if (tcf_exts_dump_stats(skb, &head->exts) < 0) 243 280 goto nla_put_failure; 244 281 245 282 return skb->len;
+2
scripts/Makefile.build
··· 164 164 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \ 165 165 $(GENKSYMS) $(if $(1), -T $(2)) \ 166 166 $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX)) \ 167 + $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \ 167 168 $(if $(KBUILD_PRESERVE),-p) \ 168 169 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) 169 170 ··· 338 337 $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \ 339 338 $(GENKSYMS) $(if $(1), -T $(2)) \ 340 339 $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX)) \ 340 + $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \ 341 341 $(if $(KBUILD_PRESERVE),-p) \ 342 342 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) 343 343
+14 -5
scripts/genksyms/genksyms.c
··· 44 44 int in_source_file; 45 45 46 46 static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, 47 - flag_preserve, flag_warnings; 47 + flag_preserve, flag_warnings, flag_rel_crcs; 48 48 static const char *mod_prefix = ""; 49 49 50 50 static int errors; ··· 693 693 fputs(">\n", debugfile); 694 694 695 695 /* Used as a linker script. */ 696 - printf("%s__crc_%s = 0x%08lx ;\n", mod_prefix, name, crc); 696 + printf(!flag_rel_crcs ? "%s__crc_%s = 0x%08lx;\n" : 697 + "SECTIONS { .rodata : ALIGN(4) { " 698 + "%s__crc_%s = .; LONG(0x%08lx); } }\n", 699 + mod_prefix, name, crc); 697 700 } 698 701 } 699 702 ··· 733 730 734 731 static void genksyms_usage(void) 735 732 { 736 - fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n" 733 + fputs("Usage:\n" "genksyms [-adDTwqhVR] > /path/to/.tmp_obj.ver\n" "\n" 737 734 #ifdef __GNU_LIBRARY__ 738 735 " -s, --symbol-prefix Select symbol prefix\n" 739 736 " -d, --debug Increment the debug level (repeatable)\n" ··· 745 742 " -q, --quiet Disable warnings (default)\n" 746 743 " -h, --help Print this message\n" 747 744 " -V, --version Print the release version\n" 745 + " -R, --relative-crc Emit section relative symbol CRCs\n" 748 746 #else /* __GNU_LIBRARY__ */ 749 747 " -s Select symbol prefix\n" 750 748 " -d Increment the debug level (repeatable)\n" ··· 757 753 " -q Disable warnings (default)\n" 758 754 " -h Print this message\n" 759 755 " -V Print the release version\n" 756 + " -R Emit section relative symbol CRCs\n" 760 757 #endif /* __GNU_LIBRARY__ */ 761 758 , stderr); 762 759 } ··· 779 774 {"preserve", 0, 0, 'p'}, 780 775 {"version", 0, 0, 'V'}, 781 776 {"help", 0, 0, 'h'}, 777 + {"relative-crc", 0, 0, 'R'}, 782 778 {0, 0, 0, 0} 783 779 }; 784 780 785 - while ((o = getopt_long(argc, argv, "s:dwqVDr:T:ph", 781 + while ((o = getopt_long(argc, argv, "s:dwqVDr:T:phR", 786 782 &long_opts[0], NULL)) != EOF) 787 783 #else /* __GNU_LIBRARY__ */ 788 - while ((o = getopt(argc, argv, "s:dwqVDr:T:ph")) != EOF) 784 + while ((o = getopt(argc, argv, "s:dwqVDr:T:phR")) != EOF) 789 785 #endif /* __GNU_LIBRARY__ */ 790 786 switch (o) { 791 787 case 's': ··· 829 823 case 'h': 830 824 genksyms_usage(); 831 825 return 0; 826 + case 'R': 827 + flag_rel_crcs = 1; 828 + break; 832 829 default: 833 830 genksyms_usage(); 834 831 return 1;
+12
scripts/kallsyms.c
··· 219 219 "_SDA2_BASE_", /* ppc */ 220 220 NULL }; 221 221 222 + static char *special_prefixes[] = { 223 + "__crc_", /* modversions */ 224 + NULL }; 225 + 222 226 static char *special_suffixes[] = { 223 227 "_veneer", /* arm */ 224 228 "_from_arm", /* arm */ ··· 262 258 for (i = 0; special_symbols[i]; i++) 263 259 if (strcmp(sym_name, special_symbols[i]) == 0) 264 260 return 0; 261 + 262 + for (i = 0; special_prefixes[i]; i++) { 263 + int l = strlen(special_prefixes[i]); 264 + 265 + if (l <= strlen(sym_name) && 266 + strncmp(sym_name, special_prefixes[i], l) == 0) 267 + return 0; 268 + } 265 269 266 270 for (i = 0; special_suffixes[i]; i++) { 267 271 int l = strlen(sym_name) - strlen(special_suffixes[i]);
+10
scripts/mod/modpost.c
··· 621 621 if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { 622 622 is_crc = true; 623 623 crc = (unsigned int) sym->st_value; 624 + if (sym->st_shndx != SHN_UNDEF && sym->st_shndx != SHN_ABS) { 625 + unsigned int *crcp; 626 + 627 + /* symbol points to the CRC in the ELF object */ 628 + crcp = (void *)info->hdr + sym->st_value + 629 + info->sechdrs[sym->st_shndx].sh_offset - 630 + (info->hdr->e_type != ET_REL ? 631 + info->sechdrs[sym->st_shndx].sh_addr : 0); 632 + crc = *crcp; 633 + } 624 634 sym_update_crc(symname + strlen(CRC_PFX), mod, crc, 625 635 export); 626 636 }
+1 -1
tools/objtool/arch/x86/decode.c
··· 150 150 *type = INSN_RETURN; 151 151 break; 152 152 153 - case 0xc5: /* iret */ 154 153 case 0xca: /* retf */ 155 154 case 0xcb: /* retf */ 155 + case 0xcf: /* iret */ 156 156 *type = INSN_CONTEXT_SWITCH; 157 157 break; 158 158