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

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

Conflicts:
drivers/net/ethernet/cavium/Kconfig

The cavium conflict was overlapping dependency
changes.

Signed-off-by: David S. Miller <davem@davemloft.net>

+3077 -1837
+1 -1
Documentation/devicetree/bindings/dma/apm-xgene-dma.txt
··· 35 35 device_type = "dma"; 36 36 reg = <0x0 0x1f270000 0x0 0x10000>, 37 37 <0x0 0x1f200000 0x0 0x10000>, 38 - <0x0 0x1b008000 0x0 0x2000>, 38 + <0x0 0x1b000000 0x0 0x400000>, 39 39 <0x0 0x1054a000 0x0 0x100>; 40 40 interrupts = <0x0 0x82 0x4>, 41 41 <0x0 0xb8 0x4>,
+16
Documentation/devicetree/bindings/phy/ti-phy.txt
··· 82 82 - id: If there are multiple instance of the same type, in order to 83 83 differentiate between each instance "id" can be used (e.g., multi-lane PCIe 84 84 PHY). If "id" is not provided, it is set to default value of '1'. 85 + - syscon-pllreset: Handle to system control region that contains the 86 + CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0 87 + register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy. 85 88 86 89 This is usually a subnode of ocp2scp to which it is connected. 87 90 ··· 102 99 clock-names = "wkupclk", 103 100 "sysclk", 104 101 "refclk"; 102 + }; 103 + 104 + sata_phy: phy@4A096000 { 105 + compatible = "ti,phy-pipe3-sata"; 106 + reg = <0x4A096000 0x80>, /* phy_rx */ 107 + <0x4A096400 0x64>, /* phy_tx */ 108 + <0x4A096800 0x40>; /* pll_ctrl */ 109 + reg-names = "phy_rx", "phy_tx", "pll_ctrl"; 110 + ctrl-module = <&omap_control_sata>; 111 + clocks = <&sys_clkin1>, <&sata_ref_clk>; 112 + clock-names = "sysclk", "refclk"; 113 + syscon-pllreset = <&scm_conf 0x3fc>; 114 + #phy-cells = <0>; 105 115 };
+4 -2
Documentation/input/alps.txt
··· 119 119 byte 5: 0 z6 z5 z4 z3 z2 z1 z0 120 120 121 121 Protocol Version 2 DualPoint devices send standard PS/2 mouse packets for 122 - the DualPoint Stick. For non interleaved dualpoint devices the pointingstick 123 - buttons get reported separately in the PSM, PSR and PSL bits. 122 + the DualPoint Stick. The M, R and L bits signal the combined status of both 123 + the pointingstick and touchpad buttons, except for Dell dualpoint devices 124 + where the pointingstick buttons get reported separately in the PSM, PSR 125 + and PSL bits. 124 126 125 127 Dualpoint device -- interleaved packet format 126 128 ---------------------------------------------
+5 -1
MAINTAINERS
··· 5600 5600 IRQCHIP DRIVERS 5601 5601 M: Thomas Gleixner <tglx@linutronix.de> 5602 5602 M: Jason Cooper <jason@lakedaemon.net> 5603 + M: Marc Zyngier <marc.zyngier@arm.com> 5603 5604 L: linux-kernel@vger.kernel.org 5604 5605 S: Maintained 5605 5606 T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core ··· 5609 5608 F: drivers/irqchip/ 5610 5609 5611 5610 IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY) 5612 - M: Benjamin Herrenschmidt <benh@kernel.crashing.org> 5611 + M: Jiang Liu <jiang.liu@linux.intel.com> 5612 + M: Marc Zyngier <marc.zyngier@arm.com> 5613 5613 S: Maintained 5614 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core 5614 5615 F: Documentation/IRQ-domain.txt 5615 5616 F: include/linux/irqdomain.h 5616 5617 F: kernel/irq/irqdomain.c 5618 + F: kernel/irq/msi.c 5617 5619 5618 5620 ISAPNP 5619 5621 M: Jaroslav Kysela <perex@perex.cz>
+8 -3
Makefile
··· 1 1 VERSION = 4 2 2 PATCHLEVEL = 2 3 3 SUBLEVEL = 0 4 - EXTRAVERSION = -rc4 4 + EXTRAVERSION = -rc6 5 5 NAME = Hurr durr I'ma sheep 6 6 7 7 # *DOCUMENTATION* ··· 597 597 # Defaults to vmlinux, but the arch makefile usually adds further targets 598 598 all: vmlinux 599 599 600 + # The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default 601 + # values of the respective KBUILD_* variables 602 + ARCH_CPPFLAGS := 603 + ARCH_AFLAGS := 604 + ARCH_CFLAGS := 600 605 include arch/$(SRCARCH)/Makefile 601 606 602 607 KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) ··· 853 848 mod_compress_cmd = true 854 849 ifdef CONFIG_MODULE_COMPRESS 855 850 ifdef CONFIG_MODULE_COMPRESS_GZIP 856 - mod_compress_cmd = gzip -n 851 + mod_compress_cmd = gzip -n -f 857 852 endif # CONFIG_MODULE_COMPRESS_GZIP 858 853 ifdef CONFIG_MODULE_COMPRESS_XZ 859 - mod_compress_cmd = xz 854 + mod_compress_cmd = xz -f 860 855 endif # CONFIG_MODULE_COMPRESS_XZ 861 856 endif # CONFIG_MODULE_COMPRESS 862 857 export mod_compress_cmd
+11 -2
arch/arc/Kconfig
··· 313 313 314 314 config ARC_PAGE_SIZE_16K 315 315 bool "16KB" 316 - depends on ARC_MMU_V3 316 + depends on ARC_MMU_V3 || ARC_MMU_V4 317 317 318 318 config ARC_PAGE_SIZE_4K 319 319 bool "4KB" 320 - depends on ARC_MMU_V3 320 + depends on ARC_MMU_V3 || ARC_MMU_V4 321 321 322 322 endchoice 323 323 ··· 365 365 default y 366 366 depends on !ARC_CANT_LLSC 367 367 368 + config ARC_STAR_9000923308 369 + bool "Workaround for llock/scond livelock" 370 + default y 371 + depends on ISA_ARCV2 && SMP && ARC_HAS_LLSC 372 + 368 373 config ARC_HAS_SWAPE 369 374 bool "Insn: SWAPE (endian-swap)" 370 375 default y ··· 382 377 Enable gcc to generate 64-bit load/store instructions 383 378 ISA mandates even/odd registers to allow encoding of two 384 379 dest operands with 2 possible source operands. 380 + default y 381 + 382 + config ARC_HAS_DIV_REM 383 + bool "Insn: div, divu, rem, remu" 385 384 default y 386 385 387 386 config ARC_HAS_RTC
+9 -1
arch/arc/Makefile
··· 36 36 cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock 37 37 cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape 38 38 39 + ifdef CONFIG_ISA_ARCV2 40 + 39 41 ifndef CONFIG_ARC_HAS_LL64 40 - cflags-$(CONFIG_ISA_ARCV2) += -mno-ll64 42 + cflags-y += -mno-ll64 43 + endif 44 + 45 + ifndef CONFIG_ARC_HAS_DIV_REM 46 + cflags-y += -mno-div-rem 47 + endif 48 + 41 49 endif 42 50 43 51 cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables
+3 -4
arch/arc/include/asm/arcregs.h
··· 89 89 #define ECR_C_BIT_DTLB_LD_MISS 8 90 90 #define ECR_C_BIT_DTLB_ST_MISS 9 91 91 92 - 93 92 /* Auxiliary registers */ 94 93 #define AUX_IDENTITY 4 95 94 #define AUX_INTR_VEC_BASE 0x25 96 - 95 + #define AUX_NON_VOL 0x5e 97 96 98 97 /* 99 98 * Floating Pt Registers ··· 239 240 240 241 struct bcr_perip { 241 242 #ifdef CONFIG_CPU_BIG_ENDIAN 242 - unsigned int start:8, pad2:8, sz:8, pad:8; 243 + unsigned int start:8, pad2:8, sz:8, ver:8; 243 244 #else 244 - unsigned int pad:8, sz:8, pad2:8, start:8; 245 + unsigned int ver:8, sz:8, pad2:8, start:8; 245 246 #endif 246 247 }; 247 248
+55 -23
arch/arc/include/asm/atomic.h
··· 23 23 24 24 #define atomic_set(v, i) (((v)->counter) = (i)) 25 25 26 - #ifdef CONFIG_ISA_ARCV2 27 - #define PREFETCHW " prefetchw [%1] \n" 28 - #else 29 - #define PREFETCHW 26 + #ifdef CONFIG_ARC_STAR_9000923308 27 + 28 + #define SCOND_FAIL_RETRY_VAR_DEF \ 29 + unsigned int delay = 1, tmp; \ 30 + 31 + #define SCOND_FAIL_RETRY_ASM \ 32 + " bz 4f \n" \ 33 + " ; --- scond fail delay --- \n" \ 34 + " mov %[tmp], %[delay] \n" /* tmp = delay */ \ 35 + "2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \ 36 + " sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \ 37 + " rol %[delay], %[delay] \n" /* delay *= 2 */ \ 38 + " b 1b \n" /* start over */ \ 39 + "4: ; --- success --- \n" \ 40 + 41 + #define SCOND_FAIL_RETRY_VARS \ 42 + ,[delay] "+&r" (delay),[tmp] "=&r" (tmp) \ 43 + 44 + #else /* !CONFIG_ARC_STAR_9000923308 */ 45 + 46 + #define SCOND_FAIL_RETRY_VAR_DEF 47 + 48 + #define SCOND_FAIL_RETRY_ASM \ 49 + " bnz 1b \n" \ 50 + 51 + #define SCOND_FAIL_RETRY_VARS 52 + 30 53 #endif 31 54 32 55 #define ATOMIC_OP(op, c_op, asm_op) \ 33 56 static inline void atomic_##op(int i, atomic_t *v) \ 34 57 { \ 35 - unsigned int temp; \ 58 + unsigned int val; \ 59 + SCOND_FAIL_RETRY_VAR_DEF \ 36 60 \ 37 61 __asm__ __volatile__( \ 38 - "1: \n" \ 39 - PREFETCHW \ 40 - " llock %0, [%1] \n" \ 41 - " " #asm_op " %0, %0, %2 \n" \ 42 - " scond %0, [%1] \n" \ 43 - " bnz 1b \n" \ 44 - : "=&r"(temp) /* Early clobber, to prevent reg reuse */ \ 45 - : "r"(&v->counter), "ir"(i) \ 62 + "1: llock %[val], [%[ctr]] \n" \ 63 + " " #asm_op " %[val], %[val], %[i] \n" \ 64 + " scond %[val], [%[ctr]] \n" \ 65 + " \n" \ 66 + SCOND_FAIL_RETRY_ASM \ 67 + \ 68 + : [val] "=&r" (val) /* Early clobber to prevent reg reuse */ \ 69 + SCOND_FAIL_RETRY_VARS \ 70 + : [ctr] "r" (&v->counter), /* Not "m": llock only supports reg direct addr mode */ \ 71 + [i] "ir" (i) \ 46 72 : "cc"); \ 47 73 } \ 48 74 49 75 #define ATOMIC_OP_RETURN(op, c_op, asm_op) \ 50 76 static inline int atomic_##op##_return(int i, atomic_t *v) \ 51 77 { \ 52 - unsigned int temp; \ 78 + unsigned int val; \ 79 + SCOND_FAIL_RETRY_VAR_DEF \ 53 80 \ 54 81 /* \ 55 82 * Explicit full memory barrier needed before/after as \ ··· 85 58 smp_mb(); \ 86 59 \ 87 60 __asm__ __volatile__( \ 88 - "1: \n" \ 89 - PREFETCHW \ 90 - " llock %0, [%1] \n" \ 91 - " " #asm_op " %0, %0, %2 \n" \ 92 - " scond %0, [%1] \n" \ 93 - " bnz 1b \n" \ 94 - : "=&r"(temp) \ 95 - : "r"(&v->counter), "ir"(i) \ 61 + "1: llock %[val], [%[ctr]] \n" \ 62 + " " #asm_op " %[val], %[val], %[i] \n" \ 63 + " scond %[val], [%[ctr]] \n" \ 64 + " \n" \ 65 + SCOND_FAIL_RETRY_ASM \ 66 + \ 67 + : [val] "=&r" (val) \ 68 + SCOND_FAIL_RETRY_VARS \ 69 + : [ctr] "r" (&v->counter), \ 70 + [i] "ir" (i) \ 96 71 : "cc"); \ 97 72 \ 98 73 smp_mb(); \ 99 74 \ 100 - return temp; \ 75 + return val; \ 101 76 } 102 77 103 78 #else /* !CONFIG_ARC_HAS_LLSC */ ··· 179 150 #undef ATOMIC_OPS 180 151 #undef ATOMIC_OP_RETURN 181 152 #undef ATOMIC_OP 153 + #undef SCOND_FAIL_RETRY_VAR_DEF 154 + #undef SCOND_FAIL_RETRY_ASM 155 + #undef SCOND_FAIL_RETRY_VARS 182 156 183 157 /** 184 158 * __atomic_add_unless - add unless the number is a given value
+27 -27
arch/arc/include/asm/ptrace.h
··· 20 20 struct pt_regs { 21 21 22 22 /* Real registers */ 23 - long bta; /* bta_l1, bta_l2, erbta */ 23 + unsigned long bta; /* bta_l1, bta_l2, erbta */ 24 24 25 - long lp_start, lp_end, lp_count; 25 + unsigned long lp_start, lp_end, lp_count; 26 26 27 - long status32; /* status32_l1, status32_l2, erstatus */ 28 - long ret; /* ilink1, ilink2 or eret */ 29 - long blink; 30 - long fp; 31 - long r26; /* gp */ 27 + unsigned long status32; /* status32_l1, status32_l2, erstatus */ 28 + unsigned long ret; /* ilink1, ilink2 or eret */ 29 + unsigned long blink; 30 + unsigned long fp; 31 + unsigned long r26; /* gp */ 32 32 33 - long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0; 33 + unsigned long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0; 34 34 35 - long sp; /* user/kernel sp depending on where we came from */ 36 - long orig_r0; 35 + unsigned long sp; /* User/Kernel depending on where we came from */ 36 + unsigned long orig_r0; 37 37 38 38 /* 39 39 * To distinguish bet excp, syscall, irq ··· 55 55 unsigned long event; 56 56 }; 57 57 58 - long user_r25; 58 + unsigned long user_r25; 59 59 }; 60 60 #else 61 61 62 62 struct pt_regs { 63 63 64 - long orig_r0; 64 + unsigned long orig_r0; 65 65 66 66 union { 67 67 struct { ··· 76 76 unsigned long event; 77 77 }; 78 78 79 - long bta; /* bta_l1, bta_l2, erbta */ 79 + unsigned long bta; /* bta_l1, bta_l2, erbta */ 80 80 81 - long user_r25; 81 + unsigned long user_r25; 82 82 83 - long r26; /* gp */ 84 - long fp; 85 - long sp; /* user/kernel sp depending on where we came from */ 83 + unsigned long r26; /* gp */ 84 + unsigned long fp; 85 + unsigned long sp; /* user/kernel sp depending on where we came from */ 86 86 87 - long r12; 87 + unsigned long r12; 88 88 89 89 /*------- Below list auto saved by h/w -----------*/ 90 - long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11; 90 + unsigned long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11; 91 91 92 - long blink; 93 - long lp_end, lp_start, lp_count; 92 + unsigned long blink; 93 + unsigned long lp_end, lp_start, lp_count; 94 94 95 - long ei, ldi, jli; 95 + unsigned long ei, ldi, jli; 96 96 97 - long ret; 98 - long status32; 97 + unsigned long ret; 98 + unsigned long status32; 99 99 }; 100 100 101 101 #endif ··· 103 103 /* Callee saved registers - need to be saved only when you are scheduled out */ 104 104 105 105 struct callee_regs { 106 - long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13; 106 + unsigned long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13; 107 107 }; 108 108 109 - #define instruction_pointer(regs) (unsigned long)((regs)->ret) 109 + #define instruction_pointer(regs) ((regs)->ret) 110 110 #define profile_pc(regs) instruction_pointer(regs) 111 111 112 112 /* return 1 if user mode or 0 if kernel mode */ ··· 142 142 143 143 static inline long regs_return_value(struct pt_regs *regs) 144 144 { 145 - return regs->r0; 145 + return (long)regs->r0; 146 146 } 147 147 148 148 #endif /* !__ASSEMBLY__ */
+523 -15
arch/arc/include/asm/spinlock.h
··· 18 18 #define arch_spin_unlock_wait(x) \ 19 19 do { while (arch_spin_is_locked(x)) cpu_relax(); } while (0) 20 20 21 + #ifdef CONFIG_ARC_HAS_LLSC 22 + 23 + /* 24 + * A normal LLOCK/SCOND based system, w/o need for livelock workaround 25 + */ 26 + #ifndef CONFIG_ARC_STAR_9000923308 27 + 21 28 static inline void arch_spin_lock(arch_spinlock_t *lock) 22 29 { 23 - unsigned int tmp = __ARCH_SPIN_LOCK_LOCKED__; 30 + unsigned int val; 31 + 32 + smp_mb(); 33 + 34 + __asm__ __volatile__( 35 + "1: llock %[val], [%[slock]] \n" 36 + " breq %[val], %[LOCKED], 1b \n" /* spin while LOCKED */ 37 + " scond %[LOCKED], [%[slock]] \n" /* acquire */ 38 + " bnz 1b \n" 39 + " \n" 40 + : [val] "=&r" (val) 41 + : [slock] "r" (&(lock->slock)), 42 + [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__) 43 + : "memory", "cc"); 44 + 45 + smp_mb(); 46 + } 47 + 48 + /* 1 - lock taken successfully */ 49 + static inline int arch_spin_trylock(arch_spinlock_t *lock) 50 + { 51 + unsigned int val, got_it = 0; 52 + 53 + smp_mb(); 54 + 55 + __asm__ __volatile__( 56 + "1: llock %[val], [%[slock]] \n" 57 + " breq %[val], %[LOCKED], 4f \n" /* already LOCKED, just bail */ 58 + " scond %[LOCKED], [%[slock]] \n" /* acquire */ 59 + " bnz 1b \n" 60 + " mov %[got_it], 1 \n" 61 + "4: \n" 62 + " \n" 63 + : [val] "=&r" (val), 64 + [got_it] "+&r" (got_it) 65 + : [slock] "r" (&(lock->slock)), 66 + [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__) 67 + : "memory", "cc"); 68 + 69 + smp_mb(); 70 + 71 + return got_it; 72 + } 73 + 74 + static inline void arch_spin_unlock(arch_spinlock_t *lock) 75 + { 76 + smp_mb(); 77 + 78 + lock->slock = __ARCH_SPIN_LOCK_UNLOCKED__; 79 + 80 + smp_mb(); 81 + } 82 + 83 + /* 84 + * Read-write spinlocks, allowing multiple readers but only one writer. 85 + * Unfair locking as Writers could be starved indefinitely by Reader(s) 86 + */ 87 + 88 + static inline void arch_read_lock(arch_rwlock_t *rw) 89 + { 90 + unsigned int val; 91 + 92 + smp_mb(); 93 + 94 + /* 95 + * zero means writer holds the lock exclusively, deny Reader. 96 + * Otherwise grant lock to first/subseq reader 97 + * 98 + * if (rw->counter > 0) { 99 + * rw->counter--; 100 + * ret = 1; 101 + * } 102 + */ 103 + 104 + __asm__ __volatile__( 105 + "1: llock %[val], [%[rwlock]] \n" 106 + " brls %[val], %[WR_LOCKED], 1b\n" /* <= 0: spin while write locked */ 107 + " sub %[val], %[val], 1 \n" /* reader lock */ 108 + " scond %[val], [%[rwlock]] \n" 109 + " bnz 1b \n" 110 + " \n" 111 + : [val] "=&r" (val) 112 + : [rwlock] "r" (&(rw->counter)), 113 + [WR_LOCKED] "ir" (0) 114 + : "memory", "cc"); 115 + 116 + smp_mb(); 117 + } 118 + 119 + /* 1 - lock taken successfully */ 120 + static inline int arch_read_trylock(arch_rwlock_t *rw) 121 + { 122 + unsigned int val, got_it = 0; 123 + 124 + smp_mb(); 125 + 126 + __asm__ __volatile__( 127 + "1: llock %[val], [%[rwlock]] \n" 128 + " brls %[val], %[WR_LOCKED], 4f\n" /* <= 0: already write locked, bail */ 129 + " sub %[val], %[val], 1 \n" /* counter-- */ 130 + " scond %[val], [%[rwlock]] \n" 131 + " bnz 1b \n" /* retry if collided with someone */ 132 + " mov %[got_it], 1 \n" 133 + " \n" 134 + "4: ; --- done --- \n" 135 + 136 + : [val] "=&r" (val), 137 + [got_it] "+&r" (got_it) 138 + : [rwlock] "r" (&(rw->counter)), 139 + [WR_LOCKED] "ir" (0) 140 + : "memory", "cc"); 141 + 142 + smp_mb(); 143 + 144 + return got_it; 145 + } 146 + 147 + static inline void arch_write_lock(arch_rwlock_t *rw) 148 + { 149 + unsigned int val; 150 + 151 + smp_mb(); 152 + 153 + /* 154 + * If reader(s) hold lock (lock < __ARCH_RW_LOCK_UNLOCKED__), 155 + * deny writer. Otherwise if unlocked grant to writer 156 + * Hence the claim that Linux rwlocks are unfair to writers. 157 + * (can be starved for an indefinite time by readers). 158 + * 159 + * if (rw->counter == __ARCH_RW_LOCK_UNLOCKED__) { 160 + * rw->counter = 0; 161 + * ret = 1; 162 + * } 163 + */ 164 + 165 + __asm__ __volatile__( 166 + "1: llock %[val], [%[rwlock]] \n" 167 + " brne %[val], %[UNLOCKED], 1b \n" /* while !UNLOCKED spin */ 168 + " mov %[val], %[WR_LOCKED] \n" 169 + " scond %[val], [%[rwlock]] \n" 170 + " bnz 1b \n" 171 + " \n" 172 + : [val] "=&r" (val) 173 + : [rwlock] "r" (&(rw->counter)), 174 + [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__), 175 + [WR_LOCKED] "ir" (0) 176 + : "memory", "cc"); 177 + 178 + smp_mb(); 179 + } 180 + 181 + /* 1 - lock taken successfully */ 182 + static inline int arch_write_trylock(arch_rwlock_t *rw) 183 + { 184 + unsigned int val, got_it = 0; 185 + 186 + smp_mb(); 187 + 188 + __asm__ __volatile__( 189 + "1: llock %[val], [%[rwlock]] \n" 190 + " brne %[val], %[UNLOCKED], 4f \n" /* !UNLOCKED, bail */ 191 + " mov %[val], %[WR_LOCKED] \n" 192 + " scond %[val], [%[rwlock]] \n" 193 + " bnz 1b \n" /* retry if collided with someone */ 194 + " mov %[got_it], 1 \n" 195 + " \n" 196 + "4: ; --- done --- \n" 197 + 198 + : [val] "=&r" (val), 199 + [got_it] "+&r" (got_it) 200 + : [rwlock] "r" (&(rw->counter)), 201 + [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__), 202 + [WR_LOCKED] "ir" (0) 203 + : "memory", "cc"); 204 + 205 + smp_mb(); 206 + 207 + return got_it; 208 + } 209 + 210 + static inline void arch_read_unlock(arch_rwlock_t *rw) 211 + { 212 + unsigned int val; 213 + 214 + smp_mb(); 215 + 216 + /* 217 + * rw->counter++; 218 + */ 219 + __asm__ __volatile__( 220 + "1: llock %[val], [%[rwlock]] \n" 221 + " add %[val], %[val], 1 \n" 222 + " scond %[val], [%[rwlock]] \n" 223 + " bnz 1b \n" 224 + " \n" 225 + : [val] "=&r" (val) 226 + : [rwlock] "r" (&(rw->counter)) 227 + : "memory", "cc"); 228 + 229 + smp_mb(); 230 + } 231 + 232 + static inline void arch_write_unlock(arch_rwlock_t *rw) 233 + { 234 + smp_mb(); 235 + 236 + rw->counter = __ARCH_RW_LOCK_UNLOCKED__; 237 + 238 + smp_mb(); 239 + } 240 + 241 + #else /* CONFIG_ARC_STAR_9000923308 */ 242 + 243 + /* 244 + * HS38x4 could get into a LLOCK/SCOND livelock in case of multiple overlapping 245 + * coherency transactions in the SCU. The exclusive line state keeps rotating 246 + * among contenting cores leading to a never ending cycle. So break the cycle 247 + * by deferring the retry of failed exclusive access (SCOND). The actual delay 248 + * needed is function of number of contending cores as well as the unrelated 249 + * coherency traffic from other cores. To keep the code simple, start off with 250 + * small delay of 1 which would suffice most cases and in case of contention 251 + * double the delay. Eventually the delay is sufficient such that the coherency 252 + * pipeline is drained, thus a subsequent exclusive access would succeed. 253 + */ 254 + 255 + #define SCOND_FAIL_RETRY_VAR_DEF \ 256 + unsigned int delay, tmp; \ 257 + 258 + #define SCOND_FAIL_RETRY_ASM \ 259 + " ; --- scond fail delay --- \n" \ 260 + " mov %[tmp], %[delay] \n" /* tmp = delay */ \ 261 + "2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \ 262 + " sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \ 263 + " rol %[delay], %[delay] \n" /* delay *= 2 */ \ 264 + " b 1b \n" /* start over */ \ 265 + " \n" \ 266 + "4: ; --- done --- \n" \ 267 + 268 + #define SCOND_FAIL_RETRY_VARS \ 269 + ,[delay] "=&r" (delay), [tmp] "=&r" (tmp) \ 270 + 271 + static inline void arch_spin_lock(arch_spinlock_t *lock) 272 + { 273 + unsigned int val; 274 + SCOND_FAIL_RETRY_VAR_DEF; 275 + 276 + smp_mb(); 277 + 278 + __asm__ __volatile__( 279 + "0: mov %[delay], 1 \n" 280 + "1: llock %[val], [%[slock]] \n" 281 + " breq %[val], %[LOCKED], 0b \n" /* spin while LOCKED */ 282 + " scond %[LOCKED], [%[slock]] \n" /* acquire */ 283 + " bz 4f \n" /* done */ 284 + " \n" 285 + SCOND_FAIL_RETRY_ASM 286 + 287 + : [val] "=&r" (val) 288 + SCOND_FAIL_RETRY_VARS 289 + : [slock] "r" (&(lock->slock)), 290 + [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__) 291 + : "memory", "cc"); 292 + 293 + smp_mb(); 294 + } 295 + 296 + /* 1 - lock taken successfully */ 297 + static inline int arch_spin_trylock(arch_spinlock_t *lock) 298 + { 299 + unsigned int val, got_it = 0; 300 + SCOND_FAIL_RETRY_VAR_DEF; 301 + 302 + smp_mb(); 303 + 304 + __asm__ __volatile__( 305 + "0: mov %[delay], 1 \n" 306 + "1: llock %[val], [%[slock]] \n" 307 + " breq %[val], %[LOCKED], 4f \n" /* already LOCKED, just bail */ 308 + " scond %[LOCKED], [%[slock]] \n" /* acquire */ 309 + " bz.d 4f \n" 310 + " mov.z %[got_it], 1 \n" /* got it */ 311 + " \n" 312 + SCOND_FAIL_RETRY_ASM 313 + 314 + : [val] "=&r" (val), 315 + [got_it] "+&r" (got_it) 316 + SCOND_FAIL_RETRY_VARS 317 + : [slock] "r" (&(lock->slock)), 318 + [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__) 319 + : "memory", "cc"); 320 + 321 + smp_mb(); 322 + 323 + return got_it; 324 + } 325 + 326 + static inline void arch_spin_unlock(arch_spinlock_t *lock) 327 + { 328 + smp_mb(); 329 + 330 + lock->slock = __ARCH_SPIN_LOCK_UNLOCKED__; 331 + 332 + smp_mb(); 333 + } 334 + 335 + /* 336 + * Read-write spinlocks, allowing multiple readers but only one writer. 337 + * Unfair locking as Writers could be starved indefinitely by Reader(s) 338 + */ 339 + 340 + static inline void arch_read_lock(arch_rwlock_t *rw) 341 + { 342 + unsigned int val; 343 + SCOND_FAIL_RETRY_VAR_DEF; 344 + 345 + smp_mb(); 346 + 347 + /* 348 + * zero means writer holds the lock exclusively, deny Reader. 349 + * Otherwise grant lock to first/subseq reader 350 + * 351 + * if (rw->counter > 0) { 352 + * rw->counter--; 353 + * ret = 1; 354 + * } 355 + */ 356 + 357 + __asm__ __volatile__( 358 + "0: mov %[delay], 1 \n" 359 + "1: llock %[val], [%[rwlock]] \n" 360 + " brls %[val], %[WR_LOCKED], 0b\n" /* <= 0: spin while write locked */ 361 + " sub %[val], %[val], 1 \n" /* reader lock */ 362 + " scond %[val], [%[rwlock]] \n" 363 + " bz 4f \n" /* done */ 364 + " \n" 365 + SCOND_FAIL_RETRY_ASM 366 + 367 + : [val] "=&r" (val) 368 + SCOND_FAIL_RETRY_VARS 369 + : [rwlock] "r" (&(rw->counter)), 370 + [WR_LOCKED] "ir" (0) 371 + : "memory", "cc"); 372 + 373 + smp_mb(); 374 + } 375 + 376 + /* 1 - lock taken successfully */ 377 + static inline int arch_read_trylock(arch_rwlock_t *rw) 378 + { 379 + unsigned int val, got_it = 0; 380 + SCOND_FAIL_RETRY_VAR_DEF; 381 + 382 + smp_mb(); 383 + 384 + __asm__ __volatile__( 385 + "0: mov %[delay], 1 \n" 386 + "1: llock %[val], [%[rwlock]] \n" 387 + " brls %[val], %[WR_LOCKED], 4f\n" /* <= 0: already write locked, bail */ 388 + " sub %[val], %[val], 1 \n" /* counter-- */ 389 + " scond %[val], [%[rwlock]] \n" 390 + " bz.d 4f \n" 391 + " mov.z %[got_it], 1 \n" /* got it */ 392 + " \n" 393 + SCOND_FAIL_RETRY_ASM 394 + 395 + : [val] "=&r" (val), 396 + [got_it] "+&r" (got_it) 397 + SCOND_FAIL_RETRY_VARS 398 + : [rwlock] "r" (&(rw->counter)), 399 + [WR_LOCKED] "ir" (0) 400 + : "memory", "cc"); 401 + 402 + smp_mb(); 403 + 404 + return got_it; 405 + } 406 + 407 + static inline void arch_write_lock(arch_rwlock_t *rw) 408 + { 409 + unsigned int val; 410 + SCOND_FAIL_RETRY_VAR_DEF; 411 + 412 + smp_mb(); 413 + 414 + /* 415 + * If reader(s) hold lock (lock < __ARCH_RW_LOCK_UNLOCKED__), 416 + * deny writer. Otherwise if unlocked grant to writer 417 + * Hence the claim that Linux rwlocks are unfair to writers. 418 + * (can be starved for an indefinite time by readers). 419 + * 420 + * if (rw->counter == __ARCH_RW_LOCK_UNLOCKED__) { 421 + * rw->counter = 0; 422 + * ret = 1; 423 + * } 424 + */ 425 + 426 + __asm__ __volatile__( 427 + "0: mov %[delay], 1 \n" 428 + "1: llock %[val], [%[rwlock]] \n" 429 + " brne %[val], %[UNLOCKED], 0b \n" /* while !UNLOCKED spin */ 430 + " mov %[val], %[WR_LOCKED] \n" 431 + " scond %[val], [%[rwlock]] \n" 432 + " bz 4f \n" 433 + " \n" 434 + SCOND_FAIL_RETRY_ASM 435 + 436 + : [val] "=&r" (val) 437 + SCOND_FAIL_RETRY_VARS 438 + : [rwlock] "r" (&(rw->counter)), 439 + [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__), 440 + [WR_LOCKED] "ir" (0) 441 + : "memory", "cc"); 442 + 443 + smp_mb(); 444 + } 445 + 446 + /* 1 - lock taken successfully */ 447 + static inline int arch_write_trylock(arch_rwlock_t *rw) 448 + { 449 + unsigned int val, got_it = 0; 450 + SCOND_FAIL_RETRY_VAR_DEF; 451 + 452 + smp_mb(); 453 + 454 + __asm__ __volatile__( 455 + "0: mov %[delay], 1 \n" 456 + "1: llock %[val], [%[rwlock]] \n" 457 + " brne %[val], %[UNLOCKED], 4f \n" /* !UNLOCKED, bail */ 458 + " mov %[val], %[WR_LOCKED] \n" 459 + " scond %[val], [%[rwlock]] \n" 460 + " bz.d 4f \n" 461 + " mov.z %[got_it], 1 \n" /* got it */ 462 + " \n" 463 + SCOND_FAIL_RETRY_ASM 464 + 465 + : [val] "=&r" (val), 466 + [got_it] "+&r" (got_it) 467 + SCOND_FAIL_RETRY_VARS 468 + : [rwlock] "r" (&(rw->counter)), 469 + [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__), 470 + [WR_LOCKED] "ir" (0) 471 + : "memory", "cc"); 472 + 473 + smp_mb(); 474 + 475 + return got_it; 476 + } 477 + 478 + static inline void arch_read_unlock(arch_rwlock_t *rw) 479 + { 480 + unsigned int val; 481 + 482 + smp_mb(); 483 + 484 + /* 485 + * rw->counter++; 486 + */ 487 + __asm__ __volatile__( 488 + "1: llock %[val], [%[rwlock]] \n" 489 + " add %[val], %[val], 1 \n" 490 + " scond %[val], [%[rwlock]] \n" 491 + " bnz 1b \n" 492 + " \n" 493 + : [val] "=&r" (val) 494 + : [rwlock] "r" (&(rw->counter)) 495 + : "memory", "cc"); 496 + 497 + smp_mb(); 498 + } 499 + 500 + static inline void arch_write_unlock(arch_rwlock_t *rw) 501 + { 502 + unsigned int val; 503 + 504 + smp_mb(); 505 + 506 + /* 507 + * rw->counter = __ARCH_RW_LOCK_UNLOCKED__; 508 + */ 509 + __asm__ __volatile__( 510 + "1: llock %[val], [%[rwlock]] \n" 511 + " scond %[UNLOCKED], [%[rwlock]]\n" 512 + " bnz 1b \n" 513 + " \n" 514 + : [val] "=&r" (val) 515 + : [rwlock] "r" (&(rw->counter)), 516 + [UNLOCKED] "r" (__ARCH_RW_LOCK_UNLOCKED__) 517 + : "memory", "cc"); 518 + 519 + smp_mb(); 520 + } 521 + 522 + #undef SCOND_FAIL_RETRY_VAR_DEF 523 + #undef SCOND_FAIL_RETRY_ASM 524 + #undef SCOND_FAIL_RETRY_VARS 525 + 526 + #endif /* CONFIG_ARC_STAR_9000923308 */ 527 + 528 + #else /* !CONFIG_ARC_HAS_LLSC */ 529 + 530 + static inline void arch_spin_lock(arch_spinlock_t *lock) 531 + { 532 + unsigned int val = __ARCH_SPIN_LOCK_LOCKED__; 24 533 25 534 /* 26 535 * This smp_mb() is technically superfluous, we only need the one ··· 542 33 __asm__ __volatile__( 543 34 "1: ex %0, [%1] \n" 544 35 " breq %0, %2, 1b \n" 545 - : "+&r" (tmp) 36 + : "+&r" (val) 546 37 : "r"(&(lock->slock)), "ir"(__ARCH_SPIN_LOCK_LOCKED__) 547 38 : "memory"); 548 39 ··· 557 48 smp_mb(); 558 49 } 559 50 51 + /* 1 - lock taken successfully */ 560 52 static inline int arch_spin_trylock(arch_spinlock_t *lock) 561 53 { 562 - unsigned int tmp = __ARCH_SPIN_LOCK_LOCKED__; 54 + unsigned int val = __ARCH_SPIN_LOCK_LOCKED__; 563 55 564 56 smp_mb(); 565 57 566 58 __asm__ __volatile__( 567 59 "1: ex %0, [%1] \n" 568 - : "+r" (tmp) 60 + : "+r" (val) 569 61 : "r"(&(lock->slock)) 570 62 : "memory"); 571 63 572 64 smp_mb(); 573 65 574 - return (tmp == __ARCH_SPIN_LOCK_UNLOCKED__); 66 + return (val == __ARCH_SPIN_LOCK_UNLOCKED__); 575 67 } 576 68 577 69 static inline void arch_spin_unlock(arch_spinlock_t *lock) 578 70 { 579 - unsigned int tmp = __ARCH_SPIN_LOCK_UNLOCKED__; 71 + unsigned int val = __ARCH_SPIN_LOCK_UNLOCKED__; 580 72 581 73 /* 582 74 * RELEASE barrier: given the instructions avail on ARCv2, full barrier ··· 587 77 588 78 __asm__ __volatile__( 589 79 " ex %0, [%1] \n" 590 - : "+r" (tmp) 80 + : "+r" (val) 591 81 : "r"(&(lock->slock)) 592 82 : "memory"); 593 83 ··· 600 90 601 91 /* 602 92 * Read-write spinlocks, allowing multiple readers but only one writer. 93 + * Unfair locking as Writers could be starved indefinitely by Reader(s) 603 94 * 604 95 * The spinlock itself is contained in @counter and access to it is 605 96 * serialized with @lock_mutex. 606 - * 607 - * Unfair locking as Writers could be starved indefinitely by Reader(s) 608 97 */ 609 - 610 - /* Would read_trylock() succeed? */ 611 - #define arch_read_can_lock(x) ((x)->counter > 0) 612 - 613 - /* Would write_trylock() succeed? */ 614 - #define arch_write_can_lock(x) ((x)->counter == __ARCH_RW_LOCK_UNLOCKED__) 615 98 616 99 /* 1 - lock taken successfully */ 617 100 static inline int arch_read_trylock(arch_rwlock_t *rw) ··· 675 172 rw->counter = __ARCH_RW_LOCK_UNLOCKED__; 676 173 arch_spin_unlock(&(rw->lock_mutex)); 677 174 } 175 + 176 + #endif 177 + 178 + #define arch_read_can_lock(x) ((x)->counter > 0) 179 + #define arch_write_can_lock(x) ((x)->counter == __ARCH_RW_LOCK_UNLOCKED__) 678 180 679 181 #define arch_read_lock_flags(lock, flags) arch_read_lock(lock) 680 182 #define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
+2
arch/arc/include/asm/spinlock_types.h
··· 26 26 */ 27 27 typedef struct { 28 28 volatile unsigned int counter; 29 + #ifndef CONFIG_ARC_HAS_LLSC 29 30 arch_spinlock_t lock_mutex; 31 + #endif 30 32 } arch_rwlock_t; 31 33 32 34 #define __ARCH_RW_LOCK_UNLOCKED__ 0x01000000
+10 -10
arch/arc/include/uapi/asm/ptrace.h
··· 32 32 */ 33 33 struct user_regs_struct { 34 34 35 - long pad; 35 + unsigned long pad; 36 36 struct { 37 - long bta, lp_start, lp_end, lp_count; 38 - long status32, ret, blink, fp, gp; 39 - long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0; 40 - long sp; 37 + unsigned long bta, lp_start, lp_end, lp_count; 38 + unsigned long status32, ret, blink, fp, gp; 39 + unsigned long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0; 40 + unsigned long sp; 41 41 } scratch; 42 - long pad2; 42 + unsigned long pad2; 43 43 struct { 44 - long r25, r24, r23, r22, r21, r20; 45 - long r19, r18, r17, r16, r15, r14, r13; 44 + unsigned long r25, r24, r23, r22, r21, r20; 45 + unsigned long r19, r18, r17, r16, r15, r14, r13; 46 46 } callee; 47 - long efa; /* break pt addr, for break points in delay slots */ 48 - long stop_pc; /* give dbg stop_pc after ensuring brkpt trap */ 47 + unsigned long efa; /* break pt addr, for break points in delay slots */ 48 + unsigned long stop_pc; /* give dbg stop_pc after ensuring brkpt trap */ 49 49 }; 50 50 #endif /* !__ASSEMBLY__ */ 51 51
+11 -1
arch/arc/kernel/setup.c
··· 47 47 struct bcr_perip uncached_space; 48 48 struct bcr_generic bcr; 49 49 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 50 + unsigned long perip_space; 50 51 FIX_PTR(cpu); 51 52 52 53 READ_BCR(AUX_IDENTITY, cpu->core); ··· 57 56 cpu->vec_base = read_aux_reg(AUX_INTR_VEC_BASE); 58 57 59 58 READ_BCR(ARC_REG_D_UNCACH_BCR, uncached_space); 60 - BUG_ON((uncached_space.start << 24) != ARC_UNCACHED_ADDR_SPACE); 59 + if (uncached_space.ver < 3) 60 + perip_space = uncached_space.start << 24; 61 + else 62 + perip_space = read_aux_reg(AUX_NON_VOL) & 0xF0000000; 63 + 64 + BUG_ON(perip_space != ARC_UNCACHED_ADDR_SPACE); 61 65 62 66 READ_BCR(ARC_REG_MUL_BCR, cpu->extn_mpy); 63 67 ··· 336 330 pr_warn("CONFIG_ARC_FPU_SAVE_RESTORE needed for working apps\n"); 337 331 else if (!cpu->extn.fpu_dp && fpu_enabled) 338 332 panic("FPU non-existent, disable CONFIG_ARC_FPU_SAVE_RESTORE\n"); 333 + 334 + if (is_isa_arcv2() && IS_ENABLED(CONFIG_SMP) && cpu->isa.atomic && 335 + !IS_ENABLED(CONFIG_ARC_STAR_9000923308)) 336 + panic("llock/scond livelock workaround missing\n"); 339 337 } 340 338 341 339 /*
+15 -25
arch/arc/kernel/time.c
··· 203 203 return 0; 204 204 } 205 205 206 - static void arc_clkevent_set_mode(enum clock_event_mode mode, 207 - struct clock_event_device *dev) 206 + static int arc_clkevent_set_periodic(struct clock_event_device *dev) 208 207 { 209 - switch (mode) { 210 - case CLOCK_EVT_MODE_PERIODIC: 211 - /* 212 - * At X Hz, 1 sec = 1000ms -> X cycles; 213 - * 10ms -> X / 100 cycles 214 - */ 215 - arc_timer_event_setup(arc_get_core_freq() / HZ); 216 - break; 217 - case CLOCK_EVT_MODE_ONESHOT: 218 - break; 219 - default: 220 - break; 221 - } 222 - 223 - return; 208 + /* 209 + * At X Hz, 1 sec = 1000ms -> X cycles; 210 + * 10ms -> X / 100 cycles 211 + */ 212 + arc_timer_event_setup(arc_get_core_freq() / HZ); 213 + return 0; 224 214 } 225 215 226 216 static DEFINE_PER_CPU(struct clock_event_device, arc_clockevent_device) = { 227 - .name = "ARC Timer0", 228 - .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, 229 - .mode = CLOCK_EVT_MODE_UNUSED, 230 - .rating = 300, 231 - .irq = TIMER0_IRQ, /* hardwired, no need for resources */ 232 - .set_next_event = arc_clkevent_set_next_event, 233 - .set_mode = arc_clkevent_set_mode, 217 + .name = "ARC Timer0", 218 + .features = CLOCK_EVT_FEAT_ONESHOT | 219 + CLOCK_EVT_FEAT_PERIODIC, 220 + .rating = 300, 221 + .irq = TIMER0_IRQ, /* hardwired, no need for resources */ 222 + .set_next_event = arc_clkevent_set_next_event, 223 + .set_state_periodic = arc_clkevent_set_periodic, 234 224 }; 235 225 236 226 static irqreturn_t timer_irq_handler(int irq, void *dev_id) ··· 230 240 * irq_set_chip_and_handler() asked for handle_percpu_devid_irq() 231 241 */ 232 242 struct clock_event_device *evt = this_cpu_ptr(&arc_clockevent_device); 233 - int irq_reenable = evt->mode == CLOCK_EVT_MODE_PERIODIC; 243 + int irq_reenable = clockevent_state_periodic(evt); 234 244 235 245 /* 236 246 * Any write to CTRL reg ACks the interrupt, we rewrite the
+1 -1
arch/arc/lib/memcpy-archs.S
··· 206 206 ld.ab r6, [r1, 4] 207 207 prefetch [r1, 28] ;Prefetch the next read location 208 208 ld.ab r8, [r1,4] 209 - prefetch [r3, 32] ;Prefetch the next write location 209 + prefetchw [r3, 32] ;Prefetch the next write location 210 210 211 211 SHIFT_1 (r7, r6, 8) 212 212 or r7, r7, r5
+36 -7
arch/arc/lib/memset-archs.S
··· 10 10 11 11 #undef PREALLOC_NOT_AVAIL 12 12 13 - #ifdef PREALLOC_NOT_AVAIL 14 - #define PREWRITE(A,B) prefetchw [(A),(B)] 15 - #else 16 - #define PREWRITE(A,B) prealloc [(A),(B)] 17 - #endif 18 - 19 13 ENTRY(memset) 20 14 prefetchw [r0] ; Prefetch the write location 21 15 mov.f 0, r2 ··· 45 51 46 52 ;;; Convert len to Dwords, unfold x8 47 53 lsr.f lp_count, lp_count, 6 54 + 48 55 lpnz @.Lset64bytes 49 56 ;; LOOP START 50 - PREWRITE(r3, 64) ;Prefetch the next write location 57 + #ifdef PREALLOC_NOT_AVAIL 58 + prefetchw [r3, 64] ;Prefetch the next write location 59 + #else 60 + prealloc [r3, 64] 61 + #endif 62 + #ifdef CONFIG_ARC_HAS_LL64 51 63 std.ab r4, [r3, 8] 52 64 std.ab r4, [r3, 8] 53 65 std.ab r4, [r3, 8] ··· 62 62 std.ab r4, [r3, 8] 63 63 std.ab r4, [r3, 8] 64 64 std.ab r4, [r3, 8] 65 + #else 66 + st.ab r4, [r3, 4] 67 + st.ab r4, [r3, 4] 68 + st.ab r4, [r3, 4] 69 + st.ab r4, [r3, 4] 70 + st.ab r4, [r3, 4] 71 + st.ab r4, [r3, 4] 72 + st.ab r4, [r3, 4] 73 + st.ab r4, [r3, 4] 74 + st.ab r4, [r3, 4] 75 + st.ab r4, [r3, 4] 76 + st.ab r4, [r3, 4] 77 + st.ab r4, [r3, 4] 78 + st.ab r4, [r3, 4] 79 + st.ab r4, [r3, 4] 80 + st.ab r4, [r3, 4] 81 + st.ab r4, [r3, 4] 82 + #endif 65 83 .Lset64bytes: 66 84 67 85 lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes 68 86 lpnz .Lset32bytes 69 87 ;; LOOP START 70 88 prefetchw [r3, 32] ;Prefetch the next write location 89 + #ifdef CONFIG_ARC_HAS_LL64 71 90 std.ab r4, [r3, 8] 72 91 std.ab r4, [r3, 8] 73 92 std.ab r4, [r3, 8] 74 93 std.ab r4, [r3, 8] 94 + #else 95 + st.ab r4, [r3, 4] 96 + st.ab r4, [r3, 4] 97 + st.ab r4, [r3, 4] 98 + st.ab r4, [r3, 4] 99 + st.ab r4, [r3, 4] 100 + st.ab r4, [r3, 4] 101 + st.ab r4, [r3, 4] 102 + st.ab r4, [r3, 4] 103 + #endif 75 104 .Lset32bytes: 76 105 77 106 and.f lp_count, r2, 0x1F ;Last remaining 31 bytes
+15
arch/arc/plat-axs10x/axs10x.c
··· 389 389 390 390 static void __init axs103_early_init(void) 391 391 { 392 + /* 393 + * AXS103 configurations for SMP/QUAD configurations share device tree 394 + * which defaults to 90 MHz. However recent failures of Quad config 395 + * revealed P&R timing violations so clamp it down to safe 50 MHz 396 + * Instead of duplicating defconfig/DT for SMP/QUAD, add a small hack 397 + * 398 + * This hack is really hacky as of now. Fix it properly by getting the 399 + * number of cores as return value of platform's early SMP callback 400 + */ 401 + #ifdef CONFIG_ARC_MCIP 402 + unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F; 403 + if (num_cores > 2) 404 + arc_set_core_freq(50 * 1000000); 405 + #endif 406 + 392 407 switch (arc_get_core_freq()/1000000) { 393 408 case 33: 394 409 axs103_set_freq(1, 1, 1);
+1
arch/arm/boot/dts/dra7.dtsi
··· 1140 1140 ctrl-module = <&omap_control_sata>; 1141 1141 clocks = <&sys_clkin1>, <&sata_ref_clk>; 1142 1142 clock-names = "sysclk", "refclk"; 1143 + syscon-pllreset = <&scm_conf 0x3fc>; 1143 1144 #phy-cells = <0>; 1144 1145 }; 1145 1146
+1 -1
arch/arm/boot/dts/exynos3250.dtsi
··· 138 138 139 139 mipi_phy: video-phy@10020710 { 140 140 compatible = "samsung,s5pv210-mipi-video-phy"; 141 - reg = <0x10020710 8>; 142 141 #phy-cells = <1>; 142 + syscon = <&pmu_system_controller>; 143 143 }; 144 144 145 145 pd_cam: cam-power-domain@10023C00 {
+4
arch/arm/boot/dts/exynos4210-origen.dts
··· 127 127 }; 128 128 }; 129 129 130 + &cpu0 { 131 + cpu0-supply = <&buck1_reg>; 132 + }; 133 + 130 134 &fimd { 131 135 pinctrl-0 = <&lcd_en &lcd_clk &lcd_data24 &pwm0_out>; 132 136 pinctrl-names = "default";
+4
arch/arm/boot/dts/exynos4210-trats.dts
··· 188 188 }; 189 189 }; 190 190 191 + &cpu0 { 192 + cpu0-supply = <&varm_breg>; 193 + }; 194 + 191 195 &dsi_0 { 192 196 vddcore-supply = <&vusb_reg>; 193 197 vddio-supply = <&vmipi_reg>;
+4
arch/arm/boot/dts/exynos4210-universal_c210.dts
··· 548 548 }; 549 549 }; 550 550 551 + &cpu0 { 552 + cpu0-supply = <&vdd_arm_reg>; 553 + }; 554 + 551 555 &pinctrl_1 { 552 556 hdmi_hpd: hdmi-hpd { 553 557 samsung,pins = "gpx3-7";
+12
arch/arm/boot/dts/exynos4210.dtsi
··· 40 40 device_type = "cpu"; 41 41 compatible = "arm,cortex-a9"; 42 42 reg = <0x900>; 43 + clocks = <&clock CLK_ARM_CLK>; 44 + clock-names = "cpu"; 45 + clock-latency = <160000>; 46 + 47 + operating-points = < 48 + 1200000 1250000 49 + 1000000 1150000 50 + 800000 1075000 51 + 500000 975000 52 + 400000 975000 53 + 200000 950000 54 + >; 43 55 cooling-min-level = <4>; 44 56 cooling-max-level = <2>; 45 57 #cooling-cells = <2>; /* min followed by max */
+4 -4
arch/arm/boot/dts/imx35.dtsi
··· 286 286 can1: can@53fe4000 { 287 287 compatible = "fsl,imx35-flexcan", "fsl,p1010-flexcan"; 288 288 reg = <0x53fe4000 0x1000>; 289 - clocks = <&clks 33>; 290 - clock-names = "ipg"; 289 + clocks = <&clks 33>, <&clks 33>; 290 + clock-names = "ipg", "per"; 291 291 interrupts = <43>; 292 292 status = "disabled"; 293 293 }; ··· 295 295 can2: can@53fe8000 { 296 296 compatible = "fsl,imx35-flexcan", "fsl,p1010-flexcan"; 297 297 reg = <0x53fe8000 0x1000>; 298 - clocks = <&clks 34>; 299 - clock-names = "ipg"; 298 + clocks = <&clks 34>, <&clks 34>; 299 + clock-names = "ipg", "per"; 300 300 interrupts = <44>; 301 301 status = "disabled"; 302 302 };
+2 -3
arch/arm/boot/dts/k2e-clocks.dtsi
··· 13 13 #clock-cells = <0>; 14 14 compatible = "ti,keystone,main-pll-clock"; 15 15 clocks = <&refclksys>; 16 - reg = <0x02620350 4>, <0x02310110 4>; 17 - reg-names = "control", "multiplier"; 18 - fixed-postdiv = <2>; 16 + reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>; 17 + reg-names = "control", "multiplier", "post-divider"; 19 18 }; 20 19 21 20 papllclk: papllclk@2620358 {
+2 -3
arch/arm/boot/dts/k2hk-clocks.dtsi
··· 22 22 #clock-cells = <0>; 23 23 compatible = "ti,keystone,main-pll-clock"; 24 24 clocks = <&refclksys>; 25 - reg = <0x02620350 4>, <0x02310110 4>; 26 - reg-names = "control", "multiplier"; 27 - fixed-postdiv = <2>; 25 + reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>; 26 + reg-names = "control", "multiplier", "post-divider"; 28 27 }; 29 28 30 29 papllclk: papllclk@2620358 {
+2 -3
arch/arm/boot/dts/k2l-clocks.dtsi
··· 22 22 #clock-cells = <0>; 23 23 compatible = "ti,keystone,main-pll-clock"; 24 24 clocks = <&refclksys>; 25 - reg = <0x02620350 4>, <0x02310110 4>; 26 - reg-names = "control", "multiplier"; 27 - fixed-postdiv = <2>; 25 + reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>; 26 + reg-names = "control", "multiplier", "post-divider"; 28 27 }; 29 28 30 29 papllclk: papllclk@2620358 {
+1
arch/arm/boot/dts/ste-nomadik-nhk15.dts
··· 17 17 }; 18 18 19 19 aliases { 20 + serial1 = &uart1; 20 21 stmpe-i2c0 = &stmpe0; 21 22 stmpe-i2c1 = &stmpe1; 22 23 };
+4
arch/arm/boot/dts/ste-nomadik-s8815.dts
··· 15 15 bootargs = "root=/dev/ram0 console=ttyAMA1,115200n8 earlyprintk"; 16 16 }; 17 17 18 + aliases { 19 + serial1 = &uart1; 20 + }; 21 + 18 22 src@101e0000 { 19 23 /* These chrystal drivers are not used on this board */ 20 24 disable-sxtalo;
+1
arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
··· 757 757 clock-names = "uartclk", "apb_pclk"; 758 758 pinctrl-names = "default"; 759 759 pinctrl-0 = <&uart0_default_mux>; 760 + status = "disabled"; 760 761 }; 761 762 762 763 uart1: uart@101fb000 {
+16 -8
arch/arm/mach-omap2/omap_hwmod.c
··· 2373 2373 * registers. This address is needed early so the OCP registers that 2374 2374 * are part of the device's address space can be ioremapped properly. 2375 2375 * 2376 + * If SYSC access is not needed, the registers will not be remapped 2377 + * and non-availability of MPU access is not treated as an error. 2378 + * 2376 2379 * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and 2377 2380 * -ENXIO on absent or invalid register target address space. 2378 2381 */ ··· 2390 2387 2391 2388 _save_mpu_port_index(oh); 2392 2389 2390 + /* if we don't need sysc access we don't need to ioremap */ 2391 + if (!oh->class->sysc) 2392 + return 0; 2393 + 2394 + /* we can't continue without MPU PORT if we need sysc access */ 2393 2395 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) 2394 2396 return -ENXIO; 2395 2397 ··· 2404 2396 oh->name); 2405 2397 2406 2398 /* Extract the IO space from device tree blob */ 2407 - if (!np) 2399 + if (!np) { 2400 + pr_err("omap_hwmod: %s: no dt node\n", oh->name); 2408 2401 return -ENXIO; 2402 + } 2409 2403 2410 2404 va_start = of_iomap(np, index + oh->mpu_rt_idx); 2411 2405 } else { ··· 2466 2456 oh->name, np->name); 2467 2457 } 2468 2458 2469 - if (oh->class->sysc) { 2470 - r = _init_mpu_rt_base(oh, NULL, index, np); 2471 - if (r < 0) { 2472 - WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n", 2473 - oh->name); 2474 - return 0; 2475 - } 2459 + r = _init_mpu_rt_base(oh, NULL, index, np); 2460 + if (r < 0) { 2461 + WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n", 2462 + oh->name); 2463 + return 0; 2476 2464 } 2477 2465 2478 2466 r = _init_clocks(oh, NULL);
+2 -3
arch/arm/mach-omap2/omap_hwmod_7xx_data.c
··· 827 827 .syss_offs = 0x0014, 828 828 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE | 829 829 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS), 830 - .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 831 - SIDLE_SMART_WKUP), 830 + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 832 831 .sysc_fields = &omap_hwmod_sysc_type1, 833 832 }; 834 833 ··· 843 844 .class = &dra7xx_gpmc_hwmod_class, 844 845 .clkdm_name = "l3main1_clkdm", 845 846 /* Skip reset for CONFIG_OMAP_GPMC_DEBUG for bootloader timings */ 846 - .flags = HWMOD_SWSUP_SIDLE | DEBUG_OMAP_GPMC_HWMOD_FLAGS, 847 + .flags = DEBUG_OMAP_GPMC_HWMOD_FLAGS, 847 848 .main_clk = "l3_iclk_div", 848 849 .prcm = { 849 850 .omap4 = {
+1 -1
arch/arm64/boot/dts/apm/apm-storm.dtsi
··· 823 823 device_type = "dma"; 824 824 reg = <0x0 0x1f270000 0x0 0x10000>, 825 825 <0x0 0x1f200000 0x0 0x10000>, 826 - <0x0 0x1b008000 0x0 0x2000>, 826 + <0x0 0x1b000000 0x0 0x400000>, 827 827 <0x0 0x1054a000 0x0 0x100>; 828 828 interrupts = <0x0 0x82 0x4>, 829 829 <0x0 0xb8 0x4>,
+2 -3
arch/arm64/kernel/signal32.c
··· 168 168 * Other callers might not initialize the si_lsb field, 169 169 * so check explicitely for the right codes here. 170 170 */ 171 - if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) 171 + if (from->si_signo == SIGBUS && 172 + (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)) 172 173 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); 173 174 #endif 174 175 break; ··· 202 201 203 202 int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) 204 203 { 205 - memset(to, 0, sizeof *to); 206 - 207 204 if (copy_from_user(to, from, __ARCH_SI_PREAMBLE_SIZE) || 208 205 copy_from_user(to->_sifields._pad, 209 206 from->_sifields._pad, SI_PAD_SIZE))
+3 -4
arch/arm64/kernel/vdso.c
··· 199 199 */ 200 200 void update_vsyscall(struct timekeeper *tk) 201 201 { 202 - struct timespec xtime_coarse; 203 202 u32 use_syscall = strcmp(tk->tkr_mono.clock->name, "arch_sys_counter"); 204 203 205 204 ++vdso_data->tb_seq_count; 206 205 smp_wmb(); 207 206 208 - xtime_coarse = __current_kernel_time(); 209 207 vdso_data->use_syscall = use_syscall; 210 - vdso_data->xtime_coarse_sec = xtime_coarse.tv_sec; 211 - vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec; 208 + vdso_data->xtime_coarse_sec = tk->xtime_sec; 209 + vdso_data->xtime_coarse_nsec = tk->tkr_mono.xtime_nsec >> 210 + tk->tkr_mono.shift; 212 211 vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; 213 212 vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; 214 213
-1
arch/mips/Kconfig
··· 151 151 select BCM7120_L2_IRQ 152 152 select BRCMSTB_L2_IRQ 153 153 select IRQ_MIPS_CPU 154 - select RAW_IRQ_ACCESSORS 155 154 select DMA_NONCOHERENT 156 155 select SYS_SUPPORTS_32BIT_KERNEL 157 156 select SYS_SUPPORTS_LITTLE_ENDIAN
+1
arch/mips/ath79/setup.c
··· 190 190 { 191 191 return ATH79_MISC_IRQ(5); 192 192 } 193 + EXPORT_SYMBOL_GPL(get_c0_perfcount_int); 193 194 194 195 unsigned int get_c0_compare_int(void) 195 196 {
+1 -1
arch/mips/cavium-octeon/smp.c
··· 42 42 cvmx_write_csr(CVMX_CIU_MBOX_CLRX(coreid), action); 43 43 44 44 if (action & SMP_CALL_FUNCTION) 45 - smp_call_function_interrupt(); 45 + generic_smp_call_function_interrupt(); 46 46 if (action & SMP_RESCHEDULE_YOURSELF) 47 47 scheduler_ipi(); 48 48
-10
arch/mips/include/asm/mach-bcm63xx/dma-coherence.h
··· 1 - #ifndef __ASM_MACH_BCM63XX_DMA_COHERENCE_H 2 - #define __ASM_MACH_BCM63XX_DMA_COHERENCE_H 3 - 4 - #include <asm/bmips.h> 5 - 6 - #define plat_post_dma_flush bmips_post_dma_flush 7 - 8 - #include <asm/mach-generic/dma-coherence.h> 9 - 10 - #endif /* __ASM_MACH_BCM63XX_DMA_COHERENCE_H */
+31
arch/mips/include/asm/pgtable.h
··· 182 182 * Make sure the buddy is global too (if it's !none, 183 183 * it better already be global) 184 184 */ 185 + #ifdef CONFIG_SMP 186 + /* 187 + * For SMP, multiple CPUs can race, so we need to do 188 + * this atomically. 189 + */ 190 + #ifdef CONFIG_64BIT 191 + #define LL_INSN "lld" 192 + #define SC_INSN "scd" 193 + #else /* CONFIG_32BIT */ 194 + #define LL_INSN "ll" 195 + #define SC_INSN "sc" 196 + #endif 197 + unsigned long page_global = _PAGE_GLOBAL; 198 + unsigned long tmp; 199 + 200 + __asm__ __volatile__ ( 201 + " .set push\n" 202 + " .set noreorder\n" 203 + "1: " LL_INSN " %[tmp], %[buddy]\n" 204 + " bnez %[tmp], 2f\n" 205 + " or %[tmp], %[tmp], %[global]\n" 206 + " " SC_INSN " %[tmp], %[buddy]\n" 207 + " beqz %[tmp], 1b\n" 208 + " nop\n" 209 + "2:\n" 210 + " .set pop" 211 + : [buddy] "+m" (buddy->pte), 212 + [tmp] "=&r" (tmp) 213 + : [global] "r" (page_global)); 214 + #else /* !CONFIG_SMP */ 185 215 if (pte_none(*buddy)) 186 216 pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL; 217 + #endif /* CONFIG_SMP */ 187 218 } 188 219 #endif 189 220 }
-2
arch/mips/include/asm/smp.h
··· 83 83 extern void play_dead(void); 84 84 #endif 85 85 86 - extern asmlinkage void smp_call_function_interrupt(void); 87 - 88 86 static inline void arch_send_call_function_single_ipi(int cpu) 89 87 { 90 88 extern struct plat_smp_ops *mp_ops; /* private */
+25
arch/mips/include/asm/stackframe.h
··· 152 152 .set noreorder 153 153 bltz k0, 8f 154 154 move k1, sp 155 + #ifdef CONFIG_EVA 156 + /* 157 + * Flush interAptiv's Return Prediction Stack (RPS) by writing 158 + * EntryHi. Toggling Config7.RPS is slower and less portable. 159 + * 160 + * The RPS isn't automatically flushed when exceptions are 161 + * taken, which can result in kernel mode speculative accesses 162 + * to user addresses if the RPS mispredicts. That's harmless 163 + * when user and kernel share the same address space, but with 164 + * EVA the same user segments may be unmapped to kernel mode, 165 + * even containing sensitive MMIO regions or invalid memory. 166 + * 167 + * This can happen when the kernel sets the return address to 168 + * ret_from_* and jr's to the exception handler, which looks 169 + * more like a tail call than a function call. If nested calls 170 + * don't evict the last user address in the RPS, it will 171 + * mispredict the return and fetch from a user controlled 172 + * address into the icache. 173 + * 174 + * More recent EVA-capable cores with MAAR to restrict 175 + * speculative accesses aren't affected. 176 + */ 177 + MFC0 k0, CP0_ENTRYHI 178 + MTC0 k0, CP0_ENTRYHI 179 + #endif 155 180 .set reorder 156 181 /* Called from user mode, new stack. */ 157 182 get_saved_sp
+3 -2
arch/mips/kernel/mips-mt-fpaff.c
··· 154 154 unsigned long __user *user_mask_ptr) 155 155 { 156 156 unsigned int real_len; 157 - cpumask_t mask; 157 + cpumask_t allowed, mask; 158 158 int retval; 159 159 struct task_struct *p; 160 160 ··· 173 173 if (retval) 174 174 goto out_unlock; 175 175 176 - cpumask_and(&mask, &p->thread.user_cpus_allowed, cpu_possible_mask); 176 + cpumask_or(&allowed, &p->thread.user_cpus_allowed, &p->cpus_allowed); 177 + cpumask_and(&mask, &allowed, cpu_active_mask); 177 178 178 179 out_unlock: 179 180 read_unlock(&tasklist_lock);
+1 -1
arch/mips/kernel/prom.c
··· 38 38 return mips_machine_name; 39 39 } 40 40 41 - #ifdef CONFIG_OF 41 + #ifdef CONFIG_USE_OF 42 42 void __init early_init_dt_add_memory_arch(u64 base, u64 size) 43 43 { 44 44 return add_memory_region(base, size, BOOT_MEM_RAM);
+4 -4
arch/mips/kernel/relocate_kernel.S
··· 24 24 25 25 process_entry: 26 26 PTR_L s2, (s0) 27 - PTR_ADD s0, s0, SZREG 27 + PTR_ADDIU s0, s0, SZREG 28 28 29 29 /* 30 30 * In case of a kdump/crash kernel, the indirection page is not ··· 61 61 /* copy page word by word */ 62 62 REG_L s5, (s2) 63 63 REG_S s5, (s4) 64 - PTR_ADD s4, s4, SZREG 65 - PTR_ADD s2, s2, SZREG 66 - LONG_SUB s6, s6, 1 64 + PTR_ADDIU s4, s4, SZREG 65 + PTR_ADDIU s2, s2, SZREG 66 + LONG_ADDIU s6, s6, -1 67 67 beq s6, zero, process_entry 68 68 b copy_word 69 69 b process_entry
-2
arch/mips/kernel/signal32.c
··· 409 409 410 410 int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) 411 411 { 412 - memset(to, 0, sizeof *to); 413 - 414 412 if (copy_from_user(to, from, 3*sizeof(int)) || 415 413 copy_from_user(to->_sifields._pad, 416 414 from->_sifields._pad, SI_PAD_SIZE32))
+2 -2
arch/mips/kernel/smp-bmips.c
··· 284 284 if (action == 0) 285 285 scheduler_ipi(); 286 286 else 287 - smp_call_function_interrupt(); 287 + generic_smp_call_function_interrupt(); 288 288 289 289 return IRQ_HANDLED; 290 290 } ··· 336 336 if (action & SMP_RESCHEDULE_YOURSELF) 337 337 scheduler_ipi(); 338 338 if (action & SMP_CALL_FUNCTION) 339 - smp_call_function_interrupt(); 339 + generic_smp_call_function_interrupt(); 340 340 341 341 return IRQ_HANDLED; 342 342 }
-10
arch/mips/kernel/smp.c
··· 192 192 cpu_startup_entry(CPUHP_ONLINE); 193 193 } 194 194 195 - /* 196 - * Call into both interrupt handlers, as we share the IPI for them 197 - */ 198 - void __irq_entry smp_call_function_interrupt(void) 199 - { 200 - irq_enter(); 201 - generic_smp_call_function_interrupt(); 202 - irq_exit(); 203 - } 204 - 205 195 static void stop_this_cpu(void *dummy) 206 196 { 207 197 /*
+13
arch/mips/kernel/traps.c
··· 192 192 void show_stack(struct task_struct *task, unsigned long *sp) 193 193 { 194 194 struct pt_regs regs; 195 + mm_segment_t old_fs = get_fs(); 195 196 if (sp) { 196 197 regs.regs[29] = (unsigned long)sp; 197 198 regs.regs[31] = 0; ··· 211 210 prepare_frametrace(&regs); 212 211 } 213 212 } 213 + /* 214 + * show_stack() deals exclusively with kernel mode, so be sure to access 215 + * the stack in the kernel (not user) address space. 216 + */ 217 + set_fs(KERNEL_DS); 214 218 show_stacktrace(task, &regs); 219 + set_fs(old_fs); 215 220 } 216 221 217 222 static void show_code(unsigned int __user *pc) ··· 1526 1519 const int field = 2 * sizeof(unsigned long); 1527 1520 int multi_match = regs->cp0_status & ST0_TS; 1528 1521 enum ctx_state prev_state; 1522 + mm_segment_t old_fs = get_fs(); 1529 1523 1530 1524 prev_state = exception_enter(); 1531 1525 show_regs(regs); ··· 1548 1540 dump_tlb_all(); 1549 1541 } 1550 1542 1543 + if (!user_mode(regs)) 1544 + set_fs(KERNEL_DS); 1545 + 1551 1546 show_code((unsigned int __user *) regs->cp0_epc); 1547 + 1548 + set_fs(old_fs); 1552 1549 1553 1550 /* 1554 1551 * Some chips may have other causes of machine check (e.g. SB1
+1 -1
arch/mips/kernel/unaligned.c
··· 438 438 : "memory"); \ 439 439 } while(0) 440 440 441 - #define StoreDW(addr, value, res) \ 441 + #define _StoreDW(addr, value, res) \ 442 442 do { \ 443 443 __asm__ __volatile__ ( \ 444 444 ".set\tpush\n\t" \
+2 -1
arch/mips/lantiq/irq.c
··· 293 293 294 294 static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) 295 295 { 296 - smp_call_function_interrupt(); 296 + generic_smp_call_function_interrupt(); 297 297 return IRQ_HANDLED; 298 298 } 299 299 ··· 466 466 { 467 467 return ltq_perfcount_irq; 468 468 } 469 + EXPORT_SYMBOL_GPL(get_c0_perfcount_int); 469 470 470 471 unsigned int get_c0_compare_int(void) 471 472 {
+5 -2
arch/mips/loongson64/loongson-3/smp.c
··· 266 266 if (action & SMP_RESCHEDULE_YOURSELF) 267 267 scheduler_ipi(); 268 268 269 - if (action & SMP_CALL_FUNCTION) 270 - smp_call_function_interrupt(); 269 + if (action & SMP_CALL_FUNCTION) { 270 + irq_enter(); 271 + generic_smp_call_function_interrupt(); 272 + irq_exit(); 273 + } 271 274 272 275 if (action & SMP_ASK_C0COUNT) { 273 276 BUG_ON(cpu != 0);
+4 -4
arch/mips/mm/cache.c
··· 160 160 protection_map[1] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC); 161 161 protection_map[2] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); 162 162 protection_map[3] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC); 163 - protection_map[4] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ); 163 + protection_map[4] = __pgprot(_page_cachable_default | _PAGE_PRESENT); 164 164 protection_map[5] = __pgprot(_page_cachable_default | _PAGE_PRESENT); 165 - protection_map[6] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ); 165 + protection_map[6] = __pgprot(_page_cachable_default | _PAGE_PRESENT); 166 166 protection_map[7] = __pgprot(_page_cachable_default | _PAGE_PRESENT); 167 167 168 168 protection_map[8] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); 169 169 protection_map[9] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC); 170 170 protection_map[10] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ); 171 171 protection_map[11] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE); 172 - protection_map[12] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ); 172 + protection_map[12] = __pgprot(_page_cachable_default | _PAGE_PRESENT); 173 173 protection_map[13] = __pgprot(_page_cachable_default | _PAGE_PRESENT); 174 - protection_map[14] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE | _PAGE_NO_READ); 174 + protection_map[14] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE); 175 175 protection_map[15] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE); 176 176 177 177 } else {
+2 -1
arch/mips/mm/fault.c
··· 133 133 #endif 134 134 goto bad_area; 135 135 } 136 - if (!(vma->vm_flags & VM_READ)) { 136 + if (!(vma->vm_flags & VM_READ) && 137 + exception_epc(regs) != address) { 137 138 #if 0 138 139 pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] RI violation\n", 139 140 raw_smp_processor_id(),
+1 -1
arch/mips/mti-malta/malta-int.c
··· 222 222 223 223 static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) 224 224 { 225 - smp_call_function_interrupt(); 225 + generic_smp_call_function_interrupt(); 226 226 227 227 return IRQ_HANDLED; 228 228 }
+10 -6
arch/mips/mti-malta/malta-time.c
··· 154 154 155 155 return mips_cpu_perf_irq; 156 156 } 157 + EXPORT_SYMBOL_GPL(get_c0_perfcount_int); 157 158 158 159 unsigned int get_c0_compare_int(void) 159 160 { ··· 172 171 173 172 static void __init init_rtc(void) 174 173 { 175 - /* stop the clock whilst setting it up */ 176 - CMOS_WRITE(RTC_SET | RTC_24H, RTC_CONTROL); 174 + unsigned char freq, ctrl; 177 175 178 - /* 32KHz time base */ 179 - CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT); 176 + /* Set 32KHz time base if not already set */ 177 + freq = CMOS_READ(RTC_FREQ_SELECT); 178 + if ((freq & RTC_DIV_CTL) != RTC_REF_CLCK_32KHZ) 179 + CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT); 180 180 181 - /* start the clock */ 182 - CMOS_WRITE(RTC_24H, RTC_CONTROL); 181 + /* Ensure SET bit is clear so RTC can run */ 182 + ctrl = CMOS_READ(RTC_CONTROL); 183 + if (ctrl & RTC_SET) 184 + CMOS_WRITE(ctrl & ~RTC_SET, RTC_CONTROL); 183 185 } 184 186 185 187 void __init plat_time_init(void)
+1
arch/mips/mti-sead3/sead3-time.c
··· 77 77 return MIPS_CPU_IRQ_BASE + cp0_perfcount_irq; 78 78 return -1; 79 79 } 80 + EXPORT_SYMBOL_GPL(get_c0_perfcount_int); 80 81 81 82 unsigned int get_c0_compare_int(void) 82 83 {
+1 -1
arch/mips/netlogic/common/smp.c
··· 86 86 { 87 87 clear_c0_eimr(irq); 88 88 ack_c0_eirr(irq); 89 - smp_call_function_interrupt(); 89 + generic_smp_call_function_interrupt(); 90 90 set_c0_eimr(irq); 91 91 } 92 92
+1 -1
arch/mips/paravirt/paravirt-smp.c
··· 114 114 115 115 static irqreturn_t paravirt_function_interrupt(int irq, void *dev_id) 116 116 { 117 - smp_call_function_interrupt(); 117 + generic_smp_call_function_interrupt(); 118 118 return IRQ_HANDLED; 119 119 } 120 120
+1
arch/mips/pistachio/time.c
··· 26 26 { 27 27 return gic_get_c0_perfcount_int(); 28 28 } 29 + EXPORT_SYMBOL_GPL(get_c0_perfcount_int); 29 30 30 31 int get_c0_fdc_int(void) 31 32 {
+1 -1
arch/mips/pmcs-msp71xx/msp_smp.c
··· 44 44 45 45 static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) 46 46 { 47 - smp_call_function_interrupt(); 47 + generic_smp_call_function_interrupt(); 48 48 49 49 return IRQ_HANDLED; 50 50 }
+1
arch/mips/ralink/irq.c
··· 89 89 { 90 90 return rt_perfcount_irq; 91 91 } 92 + EXPORT_SYMBOL_GPL(get_c0_perfcount_int); 92 93 93 94 unsigned int get_c0_compare_int(void) 94 95 {
+6 -2
arch/mips/sgi-ip27/ip27-irq.c
··· 107 107 scheduler_ipi(); 108 108 } else if (pend0 & (1UL << CPU_CALL_A_IRQ)) { 109 109 LOCAL_HUB_CLR_INTR(CPU_CALL_A_IRQ); 110 - smp_call_function_interrupt(); 110 + irq_enter(); 111 + generic_smp_call_function_interrupt(); 112 + irq_exit(); 111 113 } else if (pend0 & (1UL << CPU_CALL_B_IRQ)) { 112 114 LOCAL_HUB_CLR_INTR(CPU_CALL_B_IRQ); 113 - smp_call_function_interrupt(); 115 + irq_enter(); 116 + generic_smp_call_function_interrupt(); 117 + irq_exit(); 114 118 } else 115 119 #endif 116 120 {
+5 -4
arch/mips/sibyte/bcm1480/smp.c
··· 29 29 #include <asm/sibyte/bcm1480_regs.h> 30 30 #include <asm/sibyte/bcm1480_int.h> 31 31 32 - extern void smp_call_function_interrupt(void); 33 - 34 32 /* 35 33 * These are routines for dealing with the bcm1480 smp capabilities 36 34 * independent of board/firmware ··· 182 184 if (action & SMP_RESCHEDULE_YOURSELF) 183 185 scheduler_ipi(); 184 186 185 - if (action & SMP_CALL_FUNCTION) 186 - smp_call_function_interrupt(); 187 + if (action & SMP_CALL_FUNCTION) { 188 + irq_enter(); 189 + generic_smp_call_function_interrupt(); 190 + irq_exit(); 191 + } 187 192 }
+5 -2
arch/mips/sibyte/sb1250/smp.c
··· 172 172 if (action & SMP_RESCHEDULE_YOURSELF) 173 173 scheduler_ipi(); 174 174 175 - if (action & SMP_CALL_FUNCTION) 176 - smp_call_function_interrupt(); 175 + if (action & SMP_CALL_FUNCTION) { 176 + irq_enter(); 177 + generic_smp_call_function_interrupt(); 178 + irq_exit(); 179 + } 177 180 }
-2
arch/powerpc/kernel/signal_32.c
··· 966 966 967 967 int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from) 968 968 { 969 - memset(to, 0, sizeof *to); 970 - 971 969 if (copy_from_user(to, from, 3*sizeof(int)) || 972 970 copy_from_user(to->_sifields._pad, 973 971 from->_sifields._pad, SI_PAD_SIZE32))
+1 -1
arch/powerpc/platforms/powernv/eeh-powernv.c
··· 1478 1478 } 1479 1479 1480 1480 /* Unmask the event */ 1481 - if (eeh_enabled()) 1481 + if (ret == EEH_NEXT_ERR_NONE && eeh_enabled()) 1482 1482 enable_irq(eeh_event_irq); 1483 1483 1484 1484 return ret;
+6 -5
arch/powerpc/platforms/powernv/pci-ioda.c
··· 2220 2220 2221 2221 static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int nid, unsigned shift, 2222 2222 unsigned levels, unsigned long limit, 2223 - unsigned long *current_offset) 2223 + unsigned long *current_offset, unsigned long *total_allocated) 2224 2224 { 2225 2225 struct page *tce_mem = NULL; 2226 2226 __be64 *addr, *tmp; ··· 2236 2236 } 2237 2237 addr = page_address(tce_mem); 2238 2238 memset(addr, 0, allocated); 2239 + *total_allocated += allocated; 2239 2240 2240 2241 --levels; 2241 2242 if (!levels) { ··· 2246 2245 2247 2246 for (i = 0; i < entries; ++i) { 2248 2247 tmp = pnv_pci_ioda2_table_do_alloc_pages(nid, shift, 2249 - levels, limit, current_offset); 2248 + levels, limit, current_offset, total_allocated); 2250 2249 if (!tmp) 2251 2250 break; 2252 2251 ··· 2268 2267 struct iommu_table *tbl) 2269 2268 { 2270 2269 void *addr; 2271 - unsigned long offset = 0, level_shift; 2270 + unsigned long offset = 0, level_shift, total_allocated = 0; 2272 2271 const unsigned window_shift = ilog2(window_size); 2273 2272 unsigned entries_shift = window_shift - page_shift; 2274 2273 unsigned table_shift = max_t(unsigned, entries_shift + 3, PAGE_SHIFT); ··· 2287 2286 2288 2287 /* Allocate TCE table */ 2289 2288 addr = pnv_pci_ioda2_table_do_alloc_pages(nid, level_shift, 2290 - levels, tce_table_size, &offset); 2289 + levels, tce_table_size, &offset, &total_allocated); 2291 2290 2292 2291 /* addr==NULL means that the first level allocation failed */ 2293 2292 if (!addr) ··· 2309 2308 page_shift); 2310 2309 tbl->it_level_size = 1ULL << (level_shift - 3); 2311 2310 tbl->it_indirect_levels = levels - 1; 2312 - tbl->it_allocated_size = offset; 2311 + tbl->it_allocated_size = total_allocated; 2313 2312 2314 2313 pr_devel("Created TCE table: ws=%08llx ts=%lx @%08llx\n", 2315 2314 window_size, tce_table_size, bus_offset);
+2 -2
arch/s390/kvm/kvm-s390.c
··· 1742 1742 1743 1743 static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu) 1744 1744 { 1745 - if (!vcpu->requests) 1746 - return 0; 1747 1745 retry: 1748 1746 kvm_s390_vcpu_request_handled(vcpu); 1747 + if (!vcpu->requests) 1748 + return 0; 1749 1749 /* 1750 1750 * We use MMU_RELOAD just to re-arm the ipte notifier for the 1751 1751 * guest prefix page. gmap_ipte_notify will wait on the ptl lock.
+5 -11
arch/sparc/include/asm/visasm.h
··· 28 28 * Must preserve %o5 between VISEntryHalf and VISExitHalf */ 29 29 30 30 #define VISEntryHalf \ 31 - rd %fprs, %o5; \ 32 - andcc %o5, FPRS_FEF, %g0; \ 33 - be,pt %icc, 297f; \ 34 - sethi %hi(298f), %g7; \ 35 - sethi %hi(VISenterhalf), %g1; \ 36 - jmpl %g1 + %lo(VISenterhalf), %g0; \ 37 - or %g7, %lo(298f), %g7; \ 38 - clr %o5; \ 39 - 297: wr %o5, FPRS_FEF, %fprs; \ 40 - 298: 31 + VISEntry 32 + 33 + #define VISExitHalf \ 34 + VISExit 41 35 42 36 #define VISEntryHalfFast(fail_label) \ 43 37 rd %fprs, %o5; \ ··· 41 47 ba,a,pt %xcc, fail_label; \ 42 48 297: wr %o5, FPRS_FEF, %fprs; 43 49 44 - #define VISExitHalf \ 50 + #define VISExitHalfFast \ 45 51 wr %o5, 0, %fprs; 46 52 47 53 #ifndef __ASSEMBLY__
+4 -1
arch/sparc/lib/NG4memcpy.S
··· 240 240 add %o0, 0x40, %o0 241 241 bne,pt %icc, 1b 242 242 LOAD(prefetch, %g1 + 0x200, #n_reads_strong) 243 + #ifdef NON_USER_COPY 244 + VISExitHalfFast 245 + #else 243 246 VISExitHalf 244 - 247 + #endif 245 248 brz,pn %o2, .Lexit 246 249 cmp %o2, 19 247 250 ble,pn %icc, .Lsmall_unaligned
+2 -65
arch/sparc/lib/VISsave.S
··· 44 44 45 45 stx %g3, [%g6 + TI_GSR] 46 46 2: add %g6, %g1, %g3 47 - cmp %o5, FPRS_DU 48 - be,pn %icc, 6f 49 - sll %g1, 3, %g1 47 + mov FPRS_DU | FPRS_DL | FPRS_FEF, %o5 48 + sll %g1, 3, %g1 50 49 stb %o5, [%g3 + TI_FPSAVED] 51 50 rd %gsr, %g2 52 51 add %g6, %g1, %g3 ··· 79 80 .align 32 80 81 80: jmpl %g7 + %g0, %g0 81 82 nop 82 - 83 - 6: ldub [%g3 + TI_FPSAVED], %o5 84 - or %o5, FPRS_DU, %o5 85 - add %g6, TI_FPREGS+0x80, %g2 86 - stb %o5, [%g3 + TI_FPSAVED] 87 - 88 - sll %g1, 5, %g1 89 - add %g6, TI_FPREGS+0xc0, %g3 90 - wr %g0, FPRS_FEF, %fprs 91 - membar #Sync 92 - stda %f32, [%g2 + %g1] ASI_BLK_P 93 - stda %f48, [%g3 + %g1] ASI_BLK_P 94 - membar #Sync 95 - ba,pt %xcc, 80f 96 - nop 97 - 98 - .align 32 99 - 80: jmpl %g7 + %g0, %g0 100 - nop 101 - 102 - .align 32 103 - VISenterhalf: 104 - ldub [%g6 + TI_FPDEPTH], %g1 105 - brnz,a,pn %g1, 1f 106 - cmp %g1, 1 107 - stb %g0, [%g6 + TI_FPSAVED] 108 - stx %fsr, [%g6 + TI_XFSR] 109 - clr %o5 110 - jmpl %g7 + %g0, %g0 111 - wr %g0, FPRS_FEF, %fprs 112 - 113 - 1: bne,pn %icc, 2f 114 - srl %g1, 1, %g1 115 - ba,pt %xcc, vis1 116 - sub %g7, 8, %g7 117 - 2: addcc %g6, %g1, %g3 118 - sll %g1, 3, %g1 119 - andn %o5, FPRS_DU, %g2 120 - stb %g2, [%g3 + TI_FPSAVED] 121 - 122 - rd %gsr, %g2 123 - add %g6, %g1, %g3 124 - stx %g2, [%g3 + TI_GSR] 125 - add %g6, %g1, %g2 126 - stx %fsr, [%g2 + TI_XFSR] 127 - sll %g1, 5, %g1 128 - 3: andcc %o5, FPRS_DL, %g0 129 - be,pn %icc, 4f 130 - add %g6, TI_FPREGS, %g2 131 - 132 - add %g6, TI_FPREGS+0x40, %g3 133 - membar #Sync 134 - stda %f0, [%g2 + %g1] ASI_BLK_P 135 - stda %f16, [%g3 + %g1] ASI_BLK_P 136 - membar #Sync 137 - ba,pt %xcc, 4f 138 - nop 139 - 140 - .align 32 141 - 4: and %o5, FPRS_DU, %o5 142 - jmpl %g7 + %g0, %g0 143 - wr %o5, FPRS_FEF, %fprs
-4
arch/sparc/lib/ksyms.c
··· 135 135 void VISenter(void); 136 136 EXPORT_SYMBOL(VISenter); 137 137 138 - /* CRYPTO code needs this */ 139 - void VISenterhalf(void); 140 - EXPORT_SYMBOL(VISenterhalf); 141 - 142 138 extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *); 143 139 extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *, 144 140 unsigned long *);
-2
arch/tile/kernel/compat_signal.c
··· 113 113 if (!access_ok(VERIFY_READ, from, sizeof(struct compat_siginfo))) 114 114 return -EFAULT; 115 115 116 - memset(to, 0, sizeof(*to)); 117 - 118 116 err = __get_user(to->si_signo, &from->si_signo); 119 117 err |= __get_user(to->si_errno, &from->si_errno); 120 118 err |= __get_user(to->si_code, &from->si_code);
+4
arch/x86/boot/compressed/eboot.c
··· 1193 1193 unsigned int e820_type = 0; 1194 1194 unsigned long m = efi->efi_memmap; 1195 1195 1196 + #ifdef CONFIG_X86_64 1197 + m |= (u64)efi->efi_memmap_hi << 32; 1198 + #endif 1199 + 1196 1200 d = (efi_memory_desc_t *)(m + (i * efi->efi_memdesc_size)); 1197 1201 switch (d->type) { 1198 1202 case EFI_RESERVED_TYPE:
-15
arch/x86/include/asm/desc.h
··· 280 280 set_ldt(NULL, 0); 281 281 } 282 282 283 - /* 284 - * load one particular LDT into the current CPU 285 - */ 286 - static inline void load_LDT_nolock(mm_context_t *pc) 287 - { 288 - set_ldt(pc->ldt, pc->size); 289 - } 290 - 291 - static inline void load_LDT(mm_context_t *pc) 292 - { 293 - preempt_disable(); 294 - load_LDT_nolock(pc); 295 - preempt_enable(); 296 - } 297 - 298 283 static inline unsigned long get_desc_base(const struct desc_struct *desc) 299 284 { 300 285 return (unsigned)(desc->base0 | ((desc->base1) << 16) | ((desc->base2) << 24));
+1 -2
arch/x86/include/asm/mmu.h
··· 9 9 * we put the segment information here. 10 10 */ 11 11 typedef struct { 12 - void *ldt; 13 - int size; 12 + struct ldt_struct *ldt; 14 13 15 14 #ifdef CONFIG_X86_64 16 15 /* True if mm supports a task running in 32 bit compatibility mode. */
+49 -5
arch/x86/include/asm/mmu_context.h
··· 34 34 #endif 35 35 36 36 /* 37 + * ldt_structs can be allocated, used, and freed, but they are never 38 + * modified while live. 39 + */ 40 + struct ldt_struct { 41 + /* 42 + * Xen requires page-aligned LDTs with special permissions. This is 43 + * needed to prevent us from installing evil descriptors such as 44 + * call gates. On native, we could merge the ldt_struct and LDT 45 + * allocations, but it's not worth trying to optimize. 46 + */ 47 + struct desc_struct *entries; 48 + int size; 49 + }; 50 + 51 + static inline void load_mm_ldt(struct mm_struct *mm) 52 + { 53 + struct ldt_struct *ldt; 54 + 55 + /* lockless_dereference synchronizes with smp_store_release */ 56 + ldt = lockless_dereference(mm->context.ldt); 57 + 58 + /* 59 + * Any change to mm->context.ldt is followed by an IPI to all 60 + * CPUs with the mm active. The LDT will not be freed until 61 + * after the IPI is handled by all such CPUs. This means that, 62 + * if the ldt_struct changes before we return, the values we see 63 + * will be safe, and the new values will be loaded before we run 64 + * any user code. 65 + * 66 + * NB: don't try to convert this to use RCU without extreme care. 67 + * We would still need IRQs off, because we don't want to change 68 + * the local LDT after an IPI loaded a newer value than the one 69 + * that we can see. 70 + */ 71 + 72 + if (unlikely(ldt)) 73 + set_ldt(ldt->entries, ldt->size); 74 + else 75 + clear_LDT(); 76 + 77 + DEBUG_LOCKS_WARN_ON(preemptible()); 78 + } 79 + 80 + /* 37 81 * Used for LDT copy/destruction. 38 82 */ 39 83 int init_new_context(struct task_struct *tsk, struct mm_struct *mm); ··· 122 78 * was called and then modify_ldt changed 123 79 * prev->context.ldt but suppressed an IPI to this CPU. 124 80 * In this case, prev->context.ldt != NULL, because we 125 - * never free an LDT while the mm still exists. That 126 - * means that next->context.ldt != prev->context.ldt, 127 - * because mms never share an LDT. 81 + * never set context.ldt to NULL while the mm still 82 + * exists. That means that next->context.ldt != 83 + * prev->context.ldt, because mms never share an LDT. 128 84 */ 129 85 if (unlikely(prev->context.ldt != next->context.ldt)) 130 - load_LDT_nolock(&next->context); 86 + load_mm_ldt(next); 131 87 } 132 88 #ifdef CONFIG_SMP 133 89 else { ··· 150 106 load_cr3(next->pgd); 151 107 trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL); 152 108 load_mm_cr4(next); 153 - load_LDT_nolock(&next->context); 109 + load_mm_ldt(next); 154 110 } 155 111 } 156 112 #endif
+3 -3
arch/x86/include/asm/sigcontext.h
··· 57 57 unsigned long ip; 58 58 unsigned long flags; 59 59 unsigned short cs; 60 - unsigned short __pad2; /* Was called gs, but was always zero. */ 61 - unsigned short __pad1; /* Was called fs, but was always zero. */ 62 - unsigned short ss; 60 + unsigned short gs; 61 + unsigned short fs; 62 + unsigned short __pad0; 63 63 unsigned long err; 64 64 unsigned long trapno; 65 65 unsigned long oldmask;
+3 -18
arch/x86/include/uapi/asm/sigcontext.h
··· 177 177 __u64 rip; 178 178 __u64 eflags; /* RFLAGS */ 179 179 __u16 cs; 180 - 181 - /* 182 - * Prior to 2.5.64 ("[PATCH] x86-64 updates for 2.5.64-bk3"), 183 - * Linux saved and restored fs and gs in these slots. This 184 - * was counterproductive, as fsbase and gsbase were never 185 - * saved, so arch_prctl was presumably unreliable. 186 - * 187 - * If these slots are ever needed for any other purpose, there 188 - * is some risk that very old 64-bit binaries could get 189 - * confused. I doubt that many such binaries still work, 190 - * though, since the same patch in 2.5.64 also removed the 191 - * 64-bit set_thread_area syscall, so it appears that there is 192 - * no TLS API that works in both pre- and post-2.5.64 kernels. 193 - */ 194 - __u16 __pad2; /* Was gs. */ 195 - __u16 __pad1; /* Was fs. */ 196 - 197 - __u16 ss; 180 + __u16 gs; 181 + __u16 fs; 182 + __u16 __pad0; 198 183 __u64 err; 199 184 __u64 trapno; 200 185 __u64 oldmask;
+1 -1
arch/x86/kernel/apic/io_apic.c
··· 943 943 */ 944 944 if (irq < nr_legacy_irqs() && data->count == 1) { 945 945 if (info->ioapic_trigger != data->trigger) 946 - mp_register_handler(irq, data->trigger); 946 + mp_register_handler(irq, info->ioapic_trigger); 947 947 data->entry.trigger = data->trigger = info->ioapic_trigger; 948 948 data->entry.polarity = data->polarity = info->ioapic_polarity; 949 949 }
+2 -2
arch/x86/kernel/cpu/common.c
··· 1410 1410 load_sp0(t, &current->thread); 1411 1411 set_tss_desc(cpu, t); 1412 1412 load_TR_desc(); 1413 - load_LDT(&init_mm.context); 1413 + load_mm_ldt(&init_mm); 1414 1414 1415 1415 clear_all_debug_regs(); 1416 1416 dbg_restore_debug_regs(); ··· 1459 1459 load_sp0(t, thread); 1460 1460 set_tss_desc(cpu, t); 1461 1461 load_TR_desc(); 1462 - load_LDT(&init_mm.context); 1462 + load_mm_ldt(&init_mm); 1463 1463 1464 1464 t->x86_tss.io_bitmap_base = offsetof(struct tss_struct, io_bitmap); 1465 1465
+8 -4
arch/x86/kernel/cpu/perf_event.c
··· 2179 2179 int idx = segment >> 3; 2180 2180 2181 2181 if ((segment & SEGMENT_TI_MASK) == SEGMENT_LDT) { 2182 + struct ldt_struct *ldt; 2183 + 2182 2184 if (idx > LDT_ENTRIES) 2183 2185 return 0; 2184 2186 2185 - if (idx > current->active_mm->context.size) 2187 + /* IRQs are off, so this synchronizes with smp_store_release */ 2188 + ldt = lockless_dereference(current->active_mm->context.ldt); 2189 + if (!ldt || idx > ldt->size) 2186 2190 return 0; 2187 2191 2188 - desc = current->active_mm->context.ldt; 2192 + desc = &ldt->entries[idx]; 2189 2193 } else { 2190 2194 if (idx > GDT_ENTRIES) 2191 2195 return 0; 2192 2196 2193 - desc = raw_cpu_ptr(gdt_page.gdt); 2197 + desc = raw_cpu_ptr(gdt_page.gdt) + idx; 2194 2198 } 2195 2199 2196 - return get_desc_base(desc + idx); 2200 + return get_desc_base(desc); 2197 2201 } 2198 2202 2199 2203 #ifdef CONFIG_COMPAT
+142 -120
arch/x86/kernel/ldt.c
··· 12 12 #include <linux/string.h> 13 13 #include <linux/mm.h> 14 14 #include <linux/smp.h> 15 + #include <linux/slab.h> 15 16 #include <linux/vmalloc.h> 16 17 #include <linux/uaccess.h> 17 18 ··· 21 20 #include <asm/mmu_context.h> 22 21 #include <asm/syscalls.h> 23 22 24 - #ifdef CONFIG_SMP 23 + /* context.lock is held for us, so we don't need any locking. */ 25 24 static void flush_ldt(void *current_mm) 26 25 { 27 - if (current->active_mm == current_mm) 28 - load_LDT(&current->active_mm->context); 26 + mm_context_t *pc; 27 + 28 + if (current->active_mm != current_mm) 29 + return; 30 + 31 + pc = &current->active_mm->context; 32 + set_ldt(pc->ldt->entries, pc->ldt->size); 29 33 } 30 - #endif 31 34 32 - static int alloc_ldt(mm_context_t *pc, int mincount, int reload) 35 + /* The caller must call finalize_ldt_struct on the result. LDT starts zeroed. */ 36 + static struct ldt_struct *alloc_ldt_struct(int size) 33 37 { 34 - void *oldldt, *newldt; 35 - int oldsize; 38 + struct ldt_struct *new_ldt; 39 + int alloc_size; 36 40 37 - if (mincount <= pc->size) 38 - return 0; 39 - oldsize = pc->size; 40 - mincount = (mincount + (PAGE_SIZE / LDT_ENTRY_SIZE - 1)) & 41 - (~(PAGE_SIZE / LDT_ENTRY_SIZE - 1)); 42 - if (mincount * LDT_ENTRY_SIZE > PAGE_SIZE) 43 - newldt = vmalloc(mincount * LDT_ENTRY_SIZE); 41 + if (size > LDT_ENTRIES) 42 + return NULL; 43 + 44 + new_ldt = kmalloc(sizeof(struct ldt_struct), GFP_KERNEL); 45 + if (!new_ldt) 46 + return NULL; 47 + 48 + BUILD_BUG_ON(LDT_ENTRY_SIZE != sizeof(struct desc_struct)); 49 + alloc_size = size * LDT_ENTRY_SIZE; 50 + 51 + /* 52 + * Xen is very picky: it requires a page-aligned LDT that has no 53 + * trailing nonzero bytes in any page that contains LDT descriptors. 54 + * Keep it simple: zero the whole allocation and never allocate less 55 + * than PAGE_SIZE. 56 + */ 57 + if (alloc_size > PAGE_SIZE) 58 + new_ldt->entries = vzalloc(alloc_size); 44 59 else 45 - newldt = (void *)__get_free_page(GFP_KERNEL); 60 + new_ldt->entries = kzalloc(PAGE_SIZE, GFP_KERNEL); 46 61 47 - if (!newldt) 48 - return -ENOMEM; 49 - 50 - if (oldsize) 51 - memcpy(newldt, pc->ldt, oldsize * LDT_ENTRY_SIZE); 52 - oldldt = pc->ldt; 53 - memset(newldt + oldsize * LDT_ENTRY_SIZE, 0, 54 - (mincount - oldsize) * LDT_ENTRY_SIZE); 55 - 56 - paravirt_alloc_ldt(newldt, mincount); 57 - 58 - #ifdef CONFIG_X86_64 59 - /* CHECKME: Do we really need this ? */ 60 - wmb(); 61 - #endif 62 - pc->ldt = newldt; 63 - wmb(); 64 - pc->size = mincount; 65 - wmb(); 66 - 67 - if (reload) { 68 - #ifdef CONFIG_SMP 69 - preempt_disable(); 70 - load_LDT(pc); 71 - if (!cpumask_equal(mm_cpumask(current->mm), 72 - cpumask_of(smp_processor_id()))) 73 - smp_call_function(flush_ldt, current->mm, 1); 74 - preempt_enable(); 75 - #else 76 - load_LDT(pc); 77 - #endif 62 + if (!new_ldt->entries) { 63 + kfree(new_ldt); 64 + return NULL; 78 65 } 79 - if (oldsize) { 80 - paravirt_free_ldt(oldldt, oldsize); 81 - if (oldsize * LDT_ENTRY_SIZE > PAGE_SIZE) 82 - vfree(oldldt); 83 - else 84 - put_page(virt_to_page(oldldt)); 85 - } 86 - return 0; 66 + 67 + new_ldt->size = size; 68 + return new_ldt; 87 69 } 88 70 89 - static inline int copy_ldt(mm_context_t *new, mm_context_t *old) 71 + /* After calling this, the LDT is immutable. */ 72 + static void finalize_ldt_struct(struct ldt_struct *ldt) 90 73 { 91 - int err = alloc_ldt(new, old->size, 0); 92 - int i; 74 + paravirt_alloc_ldt(ldt->entries, ldt->size); 75 + } 93 76 94 - if (err < 0) 95 - return err; 77 + /* context.lock is held */ 78 + static void install_ldt(struct mm_struct *current_mm, 79 + struct ldt_struct *ldt) 80 + { 81 + /* Synchronizes with lockless_dereference in load_mm_ldt. */ 82 + smp_store_release(&current_mm->context.ldt, ldt); 96 83 97 - for (i = 0; i < old->size; i++) 98 - write_ldt_entry(new->ldt, i, old->ldt + i * LDT_ENTRY_SIZE); 99 - return 0; 84 + /* Activate the LDT for all CPUs using current_mm. */ 85 + on_each_cpu_mask(mm_cpumask(current_mm), flush_ldt, current_mm, true); 86 + } 87 + 88 + static void free_ldt_struct(struct ldt_struct *ldt) 89 + { 90 + if (likely(!ldt)) 91 + return; 92 + 93 + paravirt_free_ldt(ldt->entries, ldt->size); 94 + if (ldt->size * LDT_ENTRY_SIZE > PAGE_SIZE) 95 + vfree(ldt->entries); 96 + else 97 + kfree(ldt->entries); 98 + kfree(ldt); 100 99 } 101 100 102 101 /* ··· 105 104 */ 106 105 int init_new_context(struct task_struct *tsk, struct mm_struct *mm) 107 106 { 107 + struct ldt_struct *new_ldt; 108 108 struct mm_struct *old_mm; 109 109 int retval = 0; 110 110 111 111 mutex_init(&mm->context.lock); 112 - mm->context.size = 0; 113 112 old_mm = current->mm; 114 - if (old_mm && old_mm->context.size > 0) { 115 - mutex_lock(&old_mm->context.lock); 116 - retval = copy_ldt(&mm->context, &old_mm->context); 117 - mutex_unlock(&old_mm->context.lock); 113 + if (!old_mm) { 114 + mm->context.ldt = NULL; 115 + return 0; 118 116 } 117 + 118 + mutex_lock(&old_mm->context.lock); 119 + if (!old_mm->context.ldt) { 120 + mm->context.ldt = NULL; 121 + goto out_unlock; 122 + } 123 + 124 + new_ldt = alloc_ldt_struct(old_mm->context.ldt->size); 125 + if (!new_ldt) { 126 + retval = -ENOMEM; 127 + goto out_unlock; 128 + } 129 + 130 + memcpy(new_ldt->entries, old_mm->context.ldt->entries, 131 + new_ldt->size * LDT_ENTRY_SIZE); 132 + finalize_ldt_struct(new_ldt); 133 + 134 + mm->context.ldt = new_ldt; 135 + 136 + out_unlock: 137 + mutex_unlock(&old_mm->context.lock); 119 138 return retval; 120 139 } 121 140 ··· 146 125 */ 147 126 void destroy_context(struct mm_struct *mm) 148 127 { 149 - if (mm->context.size) { 150 - #ifdef CONFIG_X86_32 151 - /* CHECKME: Can this ever happen ? */ 152 - if (mm == current->active_mm) 153 - clear_LDT(); 154 - #endif 155 - paravirt_free_ldt(mm->context.ldt, mm->context.size); 156 - if (mm->context.size * LDT_ENTRY_SIZE > PAGE_SIZE) 157 - vfree(mm->context.ldt); 158 - else 159 - put_page(virt_to_page(mm->context.ldt)); 160 - mm->context.size = 0; 161 - } 128 + free_ldt_struct(mm->context.ldt); 129 + mm->context.ldt = NULL; 162 130 } 163 131 164 132 static int read_ldt(void __user *ptr, unsigned long bytecount) 165 133 { 166 - int err; 134 + int retval; 167 135 unsigned long size; 168 136 struct mm_struct *mm = current->mm; 169 137 170 - if (!mm->context.size) 171 - return 0; 138 + mutex_lock(&mm->context.lock); 139 + 140 + if (!mm->context.ldt) { 141 + retval = 0; 142 + goto out_unlock; 143 + } 144 + 172 145 if (bytecount > LDT_ENTRY_SIZE * LDT_ENTRIES) 173 146 bytecount = LDT_ENTRY_SIZE * LDT_ENTRIES; 174 147 175 - mutex_lock(&mm->context.lock); 176 - size = mm->context.size * LDT_ENTRY_SIZE; 148 + size = mm->context.ldt->size * LDT_ENTRY_SIZE; 177 149 if (size > bytecount) 178 150 size = bytecount; 179 151 180 - err = 0; 181 - if (copy_to_user(ptr, mm->context.ldt, size)) 182 - err = -EFAULT; 183 - mutex_unlock(&mm->context.lock); 184 - if (err < 0) 185 - goto error_return; 152 + if (copy_to_user(ptr, mm->context.ldt->entries, size)) { 153 + retval = -EFAULT; 154 + goto out_unlock; 155 + } 156 + 186 157 if (size != bytecount) { 187 - /* zero-fill the rest */ 188 - if (clear_user(ptr + size, bytecount - size) != 0) { 189 - err = -EFAULT; 190 - goto error_return; 158 + /* Zero-fill the rest and pretend we read bytecount bytes. */ 159 + if (clear_user(ptr + size, bytecount - size)) { 160 + retval = -EFAULT; 161 + goto out_unlock; 191 162 } 192 163 } 193 - return bytecount; 194 - error_return: 195 - return err; 164 + retval = bytecount; 165 + 166 + out_unlock: 167 + mutex_unlock(&mm->context.lock); 168 + return retval; 196 169 } 197 170 198 171 static int read_default_ldt(void __user *ptr, unsigned long bytecount) ··· 210 195 struct desc_struct ldt; 211 196 int error; 212 197 struct user_desc ldt_info; 198 + int oldsize, newsize; 199 + struct ldt_struct *new_ldt, *old_ldt; 213 200 214 201 error = -EINVAL; 215 202 if (bytecount != sizeof(ldt_info)) ··· 230 213 goto out; 231 214 } 232 215 233 - mutex_lock(&mm->context.lock); 234 - if (ldt_info.entry_number >= mm->context.size) { 235 - error = alloc_ldt(&current->mm->context, 236 - ldt_info.entry_number + 1, 1); 237 - if (error < 0) 238 - goto out_unlock; 239 - } 240 - 241 - /* Allow LDTs to be cleared by the user. */ 242 - if (ldt_info.base_addr == 0 && ldt_info.limit == 0) { 243 - if (oldmode || LDT_empty(&ldt_info)) { 244 - memset(&ldt, 0, sizeof(ldt)); 245 - goto install; 216 + if ((oldmode && !ldt_info.base_addr && !ldt_info.limit) || 217 + LDT_empty(&ldt_info)) { 218 + /* The user wants to clear the entry. */ 219 + memset(&ldt, 0, sizeof(ldt)); 220 + } else { 221 + if (!IS_ENABLED(CONFIG_X86_16BIT) && !ldt_info.seg_32bit) { 222 + error = -EINVAL; 223 + goto out; 246 224 } 225 + 226 + fill_ldt(&ldt, &ldt_info); 227 + if (oldmode) 228 + ldt.avl = 0; 247 229 } 248 230 249 - if (!IS_ENABLED(CONFIG_X86_16BIT) && !ldt_info.seg_32bit) { 250 - error = -EINVAL; 231 + mutex_lock(&mm->context.lock); 232 + 233 + old_ldt = mm->context.ldt; 234 + oldsize = old_ldt ? old_ldt->size : 0; 235 + newsize = max((int)(ldt_info.entry_number + 1), oldsize); 236 + 237 + error = -ENOMEM; 238 + new_ldt = alloc_ldt_struct(newsize); 239 + if (!new_ldt) 251 240 goto out_unlock; 252 - } 253 241 254 - fill_ldt(&ldt, &ldt_info); 255 - if (oldmode) 256 - ldt.avl = 0; 242 + if (old_ldt) 243 + memcpy(new_ldt->entries, old_ldt->entries, oldsize * LDT_ENTRY_SIZE); 244 + new_ldt->entries[ldt_info.entry_number] = ldt; 245 + finalize_ldt_struct(new_ldt); 257 246 258 - /* Install the new entry ... */ 259 - install: 260 - write_ldt_entry(mm->context.ldt, ldt_info.entry_number, &ldt); 247 + install_ldt(mm, new_ldt); 248 + free_ldt_struct(old_ldt); 261 249 error = 0; 262 250 263 251 out_unlock:
+2 -2
arch/x86/kernel/process_64.c
··· 121 121 void release_thread(struct task_struct *dead_task) 122 122 { 123 123 if (dead_task->mm) { 124 - if (dead_task->mm->context.size) { 124 + if (dead_task->mm->context.ldt) { 125 125 pr_warn("WARNING: dead process %s still has LDT? <%p/%d>\n", 126 126 dead_task->comm, 127 127 dead_task->mm->context.ldt, 128 - dead_task->mm->context.size); 128 + dead_task->mm->context.ldt->size); 129 129 BUG(); 130 130 } 131 131 }
+11 -15
arch/x86/kernel/signal.c
··· 93 93 COPY(r15); 94 94 #endif /* CONFIG_X86_64 */ 95 95 96 + #ifdef CONFIG_X86_32 96 97 COPY_SEG_CPL3(cs); 97 98 COPY_SEG_CPL3(ss); 99 + #else /* !CONFIG_X86_32 */ 100 + /* Kernel saves and restores only the CS segment register on signals, 101 + * which is the bare minimum needed to allow mixed 32/64-bit code. 102 + * App's signal handler can save/restore other segments if needed. */ 103 + COPY_SEG_CPL3(cs); 104 + #endif /* CONFIG_X86_32 */ 98 105 99 106 get_user_ex(tmpflags, &sc->flags); 100 107 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); ··· 161 154 #else /* !CONFIG_X86_32 */ 162 155 put_user_ex(regs->flags, &sc->flags); 163 156 put_user_ex(regs->cs, &sc->cs); 164 - put_user_ex(0, &sc->__pad2); 165 - put_user_ex(0, &sc->__pad1); 166 - put_user_ex(regs->ss, &sc->ss); 157 + put_user_ex(0, &sc->gs); 158 + put_user_ex(0, &sc->fs); 167 159 #endif /* CONFIG_X86_32 */ 168 160 169 161 put_user_ex(fpstate, &sc->fpstate); ··· 457 451 458 452 regs->sp = (unsigned long)frame; 459 453 460 - /* 461 - * Set up the CS and SS registers to run signal handlers in 462 - * 64-bit mode, even if the handler happens to be interrupting 463 - * 32-bit or 16-bit code. 464 - * 465 - * SS is subtle. In 64-bit mode, we don't need any particular 466 - * SS descriptor, but we do need SS to be valid. It's possible 467 - * that the old SS is entirely bogus -- this can happen if the 468 - * signal we're trying to deliver is #GP or #SS caused by a bad 469 - * SS value. 470 - */ 454 + /* Set up the CS register to run signal handlers in 64-bit mode, 455 + even if the handler happens to be interrupting 32-bit code. */ 471 456 regs->cs = __USER_CS; 472 - regs->ss = __USER_DS; 473 457 474 458 return 0; 475 459 }
+4 -2
arch/x86/kernel/step.c
··· 5 5 #include <linux/mm.h> 6 6 #include <linux/ptrace.h> 7 7 #include <asm/desc.h> 8 + #include <asm/mmu_context.h> 8 9 9 10 unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs) 10 11 { ··· 31 30 seg &= ~7UL; 32 31 33 32 mutex_lock(&child->mm->context.lock); 34 - if (unlikely((seg >> 3) >= child->mm->context.size)) 33 + if (unlikely(!child->mm->context.ldt || 34 + (seg >> 3) >= child->mm->context.ldt->size)) 35 35 addr = -1L; /* bogus selector, access would fault */ 36 36 else { 37 - desc = child->mm->context.ldt + seg; 37 + desc = &child->mm->context.ldt->entries[seg]; 38 38 base = get_desc_base(desc); 39 39 40 40 /* 16-bit code segment? */
+4 -4
arch/x86/kvm/mtrr.c
··· 672 672 if (iter.mtrr_disabled) 673 673 return mtrr_disabled_type(); 674 674 675 + /* not contained in any MTRRs. */ 676 + if (type == -1) 677 + return mtrr_default_type(mtrr_state); 678 + 675 679 /* 676 680 * We just check one page, partially covered by MTRRs is 677 681 * impossible. 678 682 */ 679 683 WARN_ON(iter.partial_map); 680 - 681 - /* not contained in any MTRRs. */ 682 - if (type == -1) 683 - return mtrr_default_type(mtrr_state); 684 684 685 685 return type; 686 686 }
+5
arch/x86/platform/efi/efi.c
··· 972 972 973 973 static int __init arch_parse_efi_cmdline(char *str) 974 974 { 975 + if (!str) { 976 + pr_warn("need at least one option\n"); 977 + return -EINVAL; 978 + } 979 + 975 980 if (parse_option_str(str, "old_map")) 976 981 set_bit(EFI_OLD_MEMMAP, &efi.flags); 977 982 if (parse_option_str(str, "debug"))
+2 -1
arch/x86/power/cpu.c
··· 22 22 #include <asm/fpu/internal.h> 23 23 #include <asm/debugreg.h> 24 24 #include <asm/cpu.h> 25 + #include <asm/mmu_context.h> 25 26 26 27 #ifdef CONFIG_X86_32 27 28 __visible unsigned long saved_context_ebx; ··· 154 153 syscall_init(); /* This sets MSR_*STAR and related */ 155 154 #endif 156 155 load_TR_desc(); /* This does ltr */ 157 - load_LDT(&current->active_mm->context); /* This does lldt */ 156 + load_mm_ldt(current->active_mm); /* This does lldt */ 158 157 159 158 fpu__resume_cpu(); 160 159 }
+2 -2
arch/x86/xen/Makefile
··· 13 13 obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \ 14 14 time.o xen-asm.o xen-asm_$(BITS).o \ 15 15 grant-table.o suspend.o platform-pci-unplug.o \ 16 - p2m.o 16 + p2m.o apic.o 17 17 18 18 obj-$(CONFIG_EVENT_TRACING) += trace.o 19 19 20 20 obj-$(CONFIG_SMP) += smp.o 21 21 obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o 22 22 obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o 23 - obj-$(CONFIG_XEN_DOM0) += apic.o vga.o 23 + obj-$(CONFIG_XEN_DOM0) += vga.o 24 24 obj-$(CONFIG_SWIOTLB_XEN) += pci-swiotlb-xen.o 25 25 obj-$(CONFIG_XEN_EFI) += efi.o
+40
arch/x86/xen/enlighten.c
··· 483 483 pte_t pte; 484 484 unsigned long pfn; 485 485 struct page *page; 486 + unsigned char dummy; 486 487 487 488 ptep = lookup_address((unsigned long)v, &level); 488 489 BUG_ON(ptep == NULL); ··· 492 491 page = pfn_to_page(pfn); 493 492 494 493 pte = pfn_pte(pfn, prot); 494 + 495 + /* 496 + * Careful: update_va_mapping() will fail if the virtual address 497 + * we're poking isn't populated in the page tables. We don't 498 + * need to worry about the direct map (that's always in the page 499 + * tables), but we need to be careful about vmap space. In 500 + * particular, the top level page table can lazily propagate 501 + * entries between processes, so if we've switched mms since we 502 + * vmapped the target in the first place, we might not have the 503 + * top-level page table entry populated. 504 + * 505 + * We disable preemption because we want the same mm active when 506 + * we probe the target and when we issue the hypercall. We'll 507 + * have the same nominal mm, but if we're a kernel thread, lazy 508 + * mm dropping could change our pgd. 509 + * 510 + * Out of an abundance of caution, this uses __get_user() to fault 511 + * in the target address just in case there's some obscure case 512 + * in which the target address isn't readable. 513 + */ 514 + 515 + preempt_disable(); 516 + 517 + pagefault_disable(); /* Avoid warnings due to being atomic. */ 518 + __get_user(dummy, (unsigned char __user __force *)v); 519 + pagefault_enable(); 495 520 496 521 if (HYPERVISOR_update_va_mapping((unsigned long)v, pte, 0)) 497 522 BUG(); ··· 530 503 BUG(); 531 504 } else 532 505 kmap_flush_unused(); 506 + 507 + preempt_enable(); 533 508 } 534 509 535 510 static void xen_alloc_ldt(struct desc_struct *ldt, unsigned entries) 536 511 { 537 512 const unsigned entries_per_page = PAGE_SIZE / LDT_ENTRY_SIZE; 538 513 int i; 514 + 515 + /* 516 + * We need to mark the all aliases of the LDT pages RO. We 517 + * don't need to call vm_flush_aliases(), though, since that's 518 + * only responsible for flushing aliases out the TLBs, not the 519 + * page tables, and Xen will flush the TLB for us if needed. 520 + * 521 + * To avoid confusing future readers: none of this is necessary 522 + * to load the LDT. The hypervisor only checks this when the 523 + * LDT is faulted in due to subsequent descriptor access. 524 + */ 539 525 540 526 for(i = 0; i < entries; i += entries_per_page) 541 527 set_aliased_prot(ldt + i, PAGE_KERNEL_RO);
+2 -4
arch/x86/xen/xen-ops.h
··· 101 101 102 102 #ifdef CONFIG_XEN_DOM0 103 103 void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size); 104 - void __init xen_init_apic(void); 105 104 #else 106 105 static inline void __init xen_init_vga(const struct dom0_vga_console_info *info, 107 106 size_t size) 108 107 { 109 108 } 110 - static inline void __init xen_init_apic(void) 111 - { 112 - } 113 109 #endif 110 + 111 + void __init xen_init_apic(void); 114 112 115 113 #ifdef CONFIG_XEN_EFI 116 114 extern void xen_efi_init(void);
+14 -5
drivers/base/regmap/regcache-rbtree.c
··· 296 296 if (!blk) 297 297 return -ENOMEM; 298 298 299 - present = krealloc(rbnode->cache_present, 300 - BITS_TO_LONGS(blklen) * sizeof(*present), GFP_KERNEL); 301 - if (!present) { 302 - kfree(blk); 303 - return -ENOMEM; 299 + if (BITS_TO_LONGS(blklen) > BITS_TO_LONGS(rbnode->blklen)) { 300 + present = krealloc(rbnode->cache_present, 301 + BITS_TO_LONGS(blklen) * sizeof(*present), 302 + GFP_KERNEL); 303 + if (!present) { 304 + kfree(blk); 305 + return -ENOMEM; 306 + } 307 + 308 + memset(present + BITS_TO_LONGS(rbnode->blklen), 0, 309 + (BITS_TO_LONGS(blklen) - BITS_TO_LONGS(rbnode->blklen)) 310 + * sizeof(*present)); 311 + } else { 312 + present = rbnode->cache_present; 304 313 } 305 314 306 315 /* insert the register value in the correct place in the rbnode block */
+17 -5
drivers/block/rbd.c
··· 523 523 # define rbd_assert(expr) ((void) 0) 524 524 #endif /* !RBD_DEBUG */ 525 525 526 + static void rbd_osd_copyup_callback(struct rbd_obj_request *obj_request); 526 527 static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request); 527 528 static void rbd_img_parent_read(struct rbd_obj_request *obj_request); 528 529 static void rbd_dev_remove_parent(struct rbd_device *rbd_dev); ··· 1819 1818 obj_request_done_set(obj_request); 1820 1819 } 1821 1820 1821 + static void rbd_osd_call_callback(struct rbd_obj_request *obj_request) 1822 + { 1823 + dout("%s: obj %p\n", __func__, obj_request); 1824 + 1825 + if (obj_request_img_data_test(obj_request)) 1826 + rbd_osd_copyup_callback(obj_request); 1827 + else 1828 + obj_request_done_set(obj_request); 1829 + } 1830 + 1822 1831 static void rbd_osd_req_callback(struct ceph_osd_request *osd_req, 1823 1832 struct ceph_msg *msg) 1824 1833 { ··· 1877 1866 rbd_osd_discard_callback(obj_request); 1878 1867 break; 1879 1868 case CEPH_OSD_OP_CALL: 1869 + rbd_osd_call_callback(obj_request); 1870 + break; 1880 1871 case CEPH_OSD_OP_NOTIFY_ACK: 1881 1872 case CEPH_OSD_OP_WATCH: 1882 1873 rbd_osd_trivial_callback(obj_request); ··· 2543 2530 } 2544 2531 2545 2532 static void 2546 - rbd_img_obj_copyup_callback(struct rbd_obj_request *obj_request) 2533 + rbd_osd_copyup_callback(struct rbd_obj_request *obj_request) 2547 2534 { 2548 2535 struct rbd_img_request *img_request; 2549 2536 struct rbd_device *rbd_dev; 2550 2537 struct page **pages; 2551 2538 u32 page_count; 2539 + 2540 + dout("%s: obj %p\n", __func__, obj_request); 2552 2541 2553 2542 rbd_assert(obj_request->type == OBJ_REQUEST_BIO || 2554 2543 obj_request->type == OBJ_REQUEST_NODATA); ··· 2578 2563 if (!obj_request->result) 2579 2564 obj_request->xferred = obj_request->length; 2580 2565 2581 - /* Finish up with the normal image object callback */ 2582 - 2583 - rbd_img_obj_callback(obj_request); 2566 + obj_request_done_set(obj_request); 2584 2567 } 2585 2568 2586 2569 static void ··· 2663 2650 2664 2651 /* All set, send it off. */ 2665 2652 2666 - orig_request->callback = rbd_img_obj_copyup_callback; 2667 2653 osdc = &rbd_dev->rbd_client->client->osdc; 2668 2654 img_result = rbd_obj_request_submit(osdc, orig_request); 2669 2655 if (!img_result)
+2 -2
drivers/block/xen-blkback/blkback.c
··· 369 369 return; 370 370 } 371 371 372 - if (work_pending(&blkif->persistent_purge_work)) { 373 - pr_alert_ratelimited("Scheduled work from previous purge is still pending, cannot purge list\n"); 372 + if (work_busy(&blkif->persistent_purge_work)) { 373 + pr_alert_ratelimited("Scheduled work from previous purge is still busy, cannot purge list\n"); 374 374 return; 375 375 } 376 376
+72 -56
drivers/block/xen-blkfront.c
··· 179 179 ((_segs + SEGS_PER_INDIRECT_FRAME - 1)/SEGS_PER_INDIRECT_FRAME) 180 180 181 181 static int blkfront_setup_indirect(struct blkfront_info *info); 182 + static int blkfront_gather_backend_features(struct blkfront_info *info); 182 183 183 184 static int get_id_from_freelist(struct blkfront_info *info) 184 185 { ··· 1129 1128 * Add the used indirect page back to the list of 1130 1129 * available pages for indirect grefs. 1131 1130 */ 1132 - indirect_page = pfn_to_page(s->indirect_grants[i]->pfn); 1133 - list_add(&indirect_page->lru, &info->indirect_pages); 1131 + if (!info->feature_persistent) { 1132 + indirect_page = pfn_to_page(s->indirect_grants[i]->pfn); 1133 + list_add(&indirect_page->lru, &info->indirect_pages); 1134 + } 1134 1135 s->indirect_grants[i]->gref = GRANT_INVALID_REF; 1135 1136 list_add_tail(&s->indirect_grants[i]->node, &info->grants); 1136 1137 } ··· 1522 1519 info->shadow_free = info->ring.req_prod_pvt; 1523 1520 info->shadow[BLK_RING_SIZE(info)-1].req.u.rw.id = 0x0fffffff; 1524 1521 1525 - rc = blkfront_setup_indirect(info); 1522 + rc = blkfront_gather_backend_features(info); 1526 1523 if (rc) { 1527 1524 kfree(copy); 1528 1525 return rc; ··· 1723 1720 1724 1721 static int blkfront_setup_indirect(struct blkfront_info *info) 1725 1722 { 1726 - unsigned int indirect_segments, segs; 1723 + unsigned int segs; 1727 1724 int err, i; 1728 1725 1729 - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 1730 - "feature-max-indirect-segments", "%u", &indirect_segments, 1731 - NULL); 1732 - if (err) { 1733 - info->max_indirect_segments = 0; 1726 + if (info->max_indirect_segments == 0) 1734 1727 segs = BLKIF_MAX_SEGMENTS_PER_REQUEST; 1735 - } else { 1736 - info->max_indirect_segments = min(indirect_segments, 1737 - xen_blkif_max_segments); 1728 + else 1738 1729 segs = info->max_indirect_segments; 1739 - } 1740 1730 1741 1731 err = fill_grant_buffer(info, (segs + INDIRECT_GREFS(segs)) * BLK_RING_SIZE(info)); 1742 1732 if (err) ··· 1793 1797 } 1794 1798 1795 1799 /* 1800 + * Gather all backend feature-* 1801 + */ 1802 + static int blkfront_gather_backend_features(struct blkfront_info *info) 1803 + { 1804 + int err; 1805 + int barrier, flush, discard, persistent; 1806 + unsigned int indirect_segments; 1807 + 1808 + info->feature_flush = 0; 1809 + 1810 + err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 1811 + "feature-barrier", "%d", &barrier, 1812 + NULL); 1813 + 1814 + /* 1815 + * If there's no "feature-barrier" defined, then it means 1816 + * we're dealing with a very old backend which writes 1817 + * synchronously; nothing to do. 1818 + * 1819 + * If there are barriers, then we use flush. 1820 + */ 1821 + if (!err && barrier) 1822 + info->feature_flush = REQ_FLUSH | REQ_FUA; 1823 + /* 1824 + * And if there is "feature-flush-cache" use that above 1825 + * barriers. 1826 + */ 1827 + err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 1828 + "feature-flush-cache", "%d", &flush, 1829 + NULL); 1830 + 1831 + if (!err && flush) 1832 + info->feature_flush = REQ_FLUSH; 1833 + 1834 + err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 1835 + "feature-discard", "%d", &discard, 1836 + NULL); 1837 + 1838 + if (!err && discard) 1839 + blkfront_setup_discard(info); 1840 + 1841 + err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 1842 + "feature-persistent", "%u", &persistent, 1843 + NULL); 1844 + if (err) 1845 + info->feature_persistent = 0; 1846 + else 1847 + info->feature_persistent = persistent; 1848 + 1849 + err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 1850 + "feature-max-indirect-segments", "%u", &indirect_segments, 1851 + NULL); 1852 + if (err) 1853 + info->max_indirect_segments = 0; 1854 + else 1855 + info->max_indirect_segments = min(indirect_segments, 1856 + xen_blkif_max_segments); 1857 + 1858 + return blkfront_setup_indirect(info); 1859 + } 1860 + 1861 + /* 1796 1862 * Invoked when the backend is finally 'ready' (and has told produced 1797 1863 * the details about the physical device - #sectors, size, etc). 1798 1864 */ ··· 1865 1807 unsigned int physical_sector_size; 1866 1808 unsigned int binfo; 1867 1809 int err; 1868 - int barrier, flush, discard, persistent; 1869 1810 1870 1811 switch (info->connected) { 1871 1812 case BLKIF_STATE_CONNECTED: ··· 1921 1864 if (err != 1) 1922 1865 physical_sector_size = sector_size; 1923 1866 1924 - info->feature_flush = 0; 1925 - 1926 - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 1927 - "feature-barrier", "%d", &barrier, 1928 - NULL); 1929 - 1930 - /* 1931 - * If there's no "feature-barrier" defined, then it means 1932 - * we're dealing with a very old backend which writes 1933 - * synchronously; nothing to do. 1934 - * 1935 - * If there are barriers, then we use flush. 1936 - */ 1937 - if (!err && barrier) 1938 - info->feature_flush = REQ_FLUSH | REQ_FUA; 1939 - /* 1940 - * And if there is "feature-flush-cache" use that above 1941 - * barriers. 1942 - */ 1943 - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 1944 - "feature-flush-cache", "%d", &flush, 1945 - NULL); 1946 - 1947 - if (!err && flush) 1948 - info->feature_flush = REQ_FLUSH; 1949 - 1950 - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 1951 - "feature-discard", "%d", &discard, 1952 - NULL); 1953 - 1954 - if (!err && discard) 1955 - blkfront_setup_discard(info); 1956 - 1957 - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, 1958 - "feature-persistent", "%u", &persistent, 1959 - NULL); 1960 - if (err) 1961 - info->feature_persistent = 0; 1962 - else 1963 - info->feature_persistent = persistent; 1964 - 1965 - err = blkfront_setup_indirect(info); 1867 + err = blkfront_gather_backend_features(info); 1966 1868 if (err) { 1967 1869 xenbus_dev_fatal(info->xbdev, err, "setup_indirect at %s", 1968 1870 info->xbdev->otherend);
+1 -1
drivers/char/hw_random/core.c
··· 429 429 static void start_khwrngd(void) 430 430 { 431 431 hwrng_fill = kthread_run(hwrng_fillfn, NULL, "hwrng"); 432 - if (hwrng_fill == ERR_PTR(-ENOMEM)) { 432 + if (IS_ERR(hwrng_fill)) { 433 433 pr_err("hwrng_fill thread creation failed"); 434 434 hwrng_fill = NULL; 435 435 }
+1 -1
drivers/cpufreq/loongson2_cpufreq.c
··· 20 20 #include <asm/clock.h> 21 21 #include <asm/idle.h> 22 22 23 - #include <asm/mach-loongson/loongson.h> 23 + #include <asm/mach-loongson64/loongson.h> 24 24 25 25 static uint nowait; 26 26
-1
drivers/crypto/ixp4xx_crypto.c
··· 905 905 crypt->mode |= NPE_OP_NOT_IN_PLACE; 906 906 /* This was never tested by Intel 907 907 * for more than one dst buffer, I think. */ 908 - BUG_ON(req->dst->length < nbytes); 909 908 req_ctx->dst = NULL; 910 909 if (!chainup_buffers(dev, req->dst, nbytes, &dst_hook, 911 910 flags, DMA_FROM_DEVICE))
+16 -8
drivers/crypto/qat/qat_common/qat_algs.c
··· 73 73 ICP_QAT_HW_CIPHER_KEY_CONVERT, \ 74 74 ICP_QAT_HW_CIPHER_DECRYPT) 75 75 76 - static atomic_t active_dev; 76 + static DEFINE_MUTEX(algs_lock); 77 + static unsigned int active_devs; 77 78 78 79 struct qat_alg_buf { 79 80 uint32_t len; ··· 1281 1280 1282 1281 int qat_algs_register(void) 1283 1282 { 1284 - if (atomic_add_return(1, &active_dev) == 1) { 1283 + int ret = 0; 1284 + 1285 + mutex_lock(&algs_lock); 1286 + if (++active_devs == 1) { 1285 1287 int i; 1286 1288 1287 1289 for (i = 0; i < ARRAY_SIZE(qat_algs); i++) ··· 1293 1289 CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC : 1294 1290 CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC; 1295 1291 1296 - return crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs)); 1292 + ret = crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs)); 1297 1293 } 1298 - return 0; 1294 + mutex_unlock(&algs_lock); 1295 + return ret; 1299 1296 } 1300 1297 1301 1298 int qat_algs_unregister(void) 1302 1299 { 1303 - if (atomic_sub_return(1, &active_dev) == 0) 1304 - return crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs)); 1305 - return 0; 1300 + int ret = 0; 1301 + 1302 + mutex_lock(&algs_lock); 1303 + if (--active_devs == 0) 1304 + ret = crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs)); 1305 + mutex_unlock(&algs_lock); 1306 + return ret; 1306 1307 } 1307 1308 1308 1309 int qat_algs_init(void) 1309 1310 { 1310 - atomic_set(&active_dev, 0); 1311 1311 crypto_get_default_rng(); 1312 1312 return 0; 1313 1313 }
+87 -45
drivers/dma/at_hdmac.c
··· 48 48 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |\ 49 49 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES)) 50 50 51 + #define ATC_MAX_DSCR_TRIALS 10 52 + 51 53 /* 52 54 * Initial number of descriptors to allocate for each channel. This could 53 55 * be increased during dma usage. ··· 287 285 * 288 286 * @current_len: the number of bytes left before reading CTRLA 289 287 * @ctrla: the value of CTRLA 290 - * @desc: the descriptor containing the transfer width 291 288 */ 292 - static inline int atc_calc_bytes_left(int current_len, u32 ctrla, 293 - struct at_desc *desc) 289 + static inline int atc_calc_bytes_left(int current_len, u32 ctrla) 294 290 { 295 - return current_len - ((ctrla & ATC_BTSIZE_MAX) << desc->tx_width); 296 - } 291 + u32 btsize = (ctrla & ATC_BTSIZE_MAX); 292 + u32 src_width = ATC_REG_TO_SRC_WIDTH(ctrla); 297 293 298 - /** 299 - * atc_calc_bytes_left_from_reg - calculates the number of bytes left according 300 - * to the current value of CTRLA. 301 - * 302 - * @current_len: the number of bytes left before reading CTRLA 303 - * @atchan: the channel to read CTRLA for 304 - * @desc: the descriptor containing the transfer width 305 - */ 306 - static inline int atc_calc_bytes_left_from_reg(int current_len, 307 - struct at_dma_chan *atchan, struct at_desc *desc) 308 - { 309 - u32 ctrla = channel_readl(atchan, CTRLA); 310 - 311 - return atc_calc_bytes_left(current_len, ctrla, desc); 294 + /* 295 + * According to the datasheet, when reading the Control A Register 296 + * (ctrla), the Buffer Transfer Size (btsize) bitfield refers to the 297 + * number of transfers completed on the Source Interface. 298 + * So btsize is always a number of source width transfers. 299 + */ 300 + return current_len - (btsize << src_width); 312 301 } 313 302 314 303 /** ··· 313 320 struct at_desc *desc_first = atc_first_active(atchan); 314 321 struct at_desc *desc; 315 322 int ret; 316 - u32 ctrla, dscr; 323 + u32 ctrla, dscr, trials; 317 324 318 325 /* 319 326 * If the cookie doesn't match to the currently running transfer then ··· 339 346 * the channel's DSCR register and compare it against the value 340 347 * of the hardware linked list structure of each child 341 348 * descriptor. 349 + * 350 + * The CTRLA register provides us with the amount of data 351 + * already read from the source for the current child 352 + * descriptor. So we can compute a more accurate residue by also 353 + * removing the number of bytes corresponding to this amount of 354 + * data. 355 + * 356 + * However, the DSCR and CTRLA registers cannot be read both 357 + * atomically. Hence a race condition may occur: the first read 358 + * register may refer to one child descriptor whereas the second 359 + * read may refer to a later child descriptor in the list 360 + * because of the DMA transfer progression inbetween the two 361 + * reads. 362 + * 363 + * One solution could have been to pause the DMA transfer, read 364 + * the DSCR and CTRLA then resume the DMA transfer. Nonetheless, 365 + * this approach presents some drawbacks: 366 + * - If the DMA transfer is paused, RX overruns or TX underruns 367 + * are more likey to occur depending on the system latency. 368 + * Taking the USART driver as an example, it uses a cyclic DMA 369 + * transfer to read data from the Receive Holding Register 370 + * (RHR) to avoid RX overruns since the RHR is not protected 371 + * by any FIFO on most Atmel SoCs. So pausing the DMA transfer 372 + * to compute the residue would break the USART driver design. 373 + * - The atc_pause() function masks interrupts but we'd rather 374 + * avoid to do so for system latency purpose. 375 + * 376 + * Then we'd rather use another solution: the DSCR is read a 377 + * first time, the CTRLA is read in turn, next the DSCR is read 378 + * a second time. If the two consecutive read values of the DSCR 379 + * are the same then we assume both refers to the very same 380 + * child descriptor as well as the CTRLA value read inbetween 381 + * does. For cyclic tranfers, the assumption is that a full loop 382 + * is "not so fast". 383 + * If the two DSCR values are different, we read again the CTRLA 384 + * then the DSCR till two consecutive read values from DSCR are 385 + * equal or till the maxium trials is reach. 386 + * This algorithm is very unlikely not to find a stable value for 387 + * DSCR. 342 388 */ 343 389 344 - ctrla = channel_readl(atchan, CTRLA); 345 - rmb(); /* ensure CTRLA is read before DSCR */ 346 390 dscr = channel_readl(atchan, DSCR); 391 + rmb(); /* ensure DSCR is read before CTRLA */ 392 + ctrla = channel_readl(atchan, CTRLA); 393 + for (trials = 0; trials < ATC_MAX_DSCR_TRIALS; ++trials) { 394 + u32 new_dscr; 395 + 396 + rmb(); /* ensure DSCR is read after CTRLA */ 397 + new_dscr = channel_readl(atchan, DSCR); 398 + 399 + /* 400 + * If the DSCR register value has not changed inside the 401 + * DMA controller since the previous read, we assume 402 + * that both the dscr and ctrla values refers to the 403 + * very same descriptor. 404 + */ 405 + if (likely(new_dscr == dscr)) 406 + break; 407 + 408 + /* 409 + * DSCR has changed inside the DMA controller, so the 410 + * previouly read value of CTRLA may refer to an already 411 + * processed descriptor hence could be outdated. 412 + * We need to update ctrla to match the current 413 + * descriptor. 414 + */ 415 + dscr = new_dscr; 416 + rmb(); /* ensure DSCR is read before CTRLA */ 417 + ctrla = channel_readl(atchan, CTRLA); 418 + } 419 + if (unlikely(trials >= ATC_MAX_DSCR_TRIALS)) 420 + return -ETIMEDOUT; 347 421 348 422 /* for the first descriptor we can be more accurate */ 349 423 if (desc_first->lli.dscr == dscr) 350 - return atc_calc_bytes_left(ret, ctrla, desc_first); 424 + return atc_calc_bytes_left(ret, ctrla); 351 425 352 426 ret -= desc_first->len; 353 427 list_for_each_entry(desc, &desc_first->tx_list, desc_node) { ··· 425 365 } 426 366 427 367 /* 428 - * For the last descriptor in the chain we can calculate 368 + * For the current descriptor in the chain we can calculate 429 369 * the remaining bytes using the channel's register. 430 - * Note that the transfer width of the first and last 431 - * descriptor may differ. 432 370 */ 433 - if (!desc->lli.dscr) 434 - ret = atc_calc_bytes_left_from_reg(ret, atchan, desc); 371 + ret = atc_calc_bytes_left(ret, ctrla); 435 372 } else { 436 373 /* single transfer */ 437 - ret = atc_calc_bytes_left_from_reg(ret, atchan, desc_first); 374 + ctrla = channel_readl(atchan, CTRLA); 375 + ret = atc_calc_bytes_left(ret, ctrla); 438 376 } 439 377 440 378 return ret; ··· 784 726 785 727 desc->txd.cookie = -EBUSY; 786 728 desc->total_len = desc->len = len; 787 - desc->tx_width = dwidth; 788 729 789 730 /* set end-of-link to the last link descriptor of list*/ 790 731 set_desc_eol(desc); ··· 860 803 /* First descriptor of the chain embedds additional information */ 861 804 first->txd.cookie = -EBUSY; 862 805 first->total_len = len; 863 - 864 - /* set transfer width for the calculation of the residue */ 865 - first->tx_width = src_width; 866 - prev->tx_width = src_width; 867 806 868 807 /* set end-of-link to the last link descriptor of list*/ 869 808 set_desc_eol(desc); ··· 1009 956 first->txd.cookie = -EBUSY; 1010 957 first->total_len = total_len; 1011 958 1012 - /* set transfer width for the calculation of the residue */ 1013 - first->tx_width = reg_width; 1014 - prev->tx_width = reg_width; 1015 - 1016 959 /* first link descriptor of list is responsible of flags */ 1017 960 first->txd.flags = flags; /* client is in control of this ack */ 1018 961 ··· 1125 1076 1126 1077 desc->txd.cookie = 0; 1127 1078 desc->len = len; 1128 - 1129 - /* 1130 - * Although we only need the transfer width for the first and 1131 - * the last descriptor, its easier to set it to all descriptors. 1132 - */ 1133 - desc->tx_width = src_width; 1134 1079 1135 1080 atc_desc_chain(&first, &prev, desc); 1136 1081 ··· 1299 1256 /* First descriptor of the chain embedds additional information */ 1300 1257 first->txd.cookie = -EBUSY; 1301 1258 first->total_len = buf_len; 1302 - first->tx_width = reg_width; 1303 1259 1304 1260 return &first->txd; 1305 1261
+1 -2
drivers/dma/at_hdmac_regs.h
··· 112 112 #define ATC_SRC_WIDTH_BYTE (0x0 << 24) 113 113 #define ATC_SRC_WIDTH_HALFWORD (0x1 << 24) 114 114 #define ATC_SRC_WIDTH_WORD (0x2 << 24) 115 + #define ATC_REG_TO_SRC_WIDTH(r) (((r) >> 24) & 0x3) 115 116 #define ATC_DST_WIDTH_MASK (0x3 << 28) /* Destination Single Transfer Size */ 116 117 #define ATC_DST_WIDTH(x) ((x) << 28) 117 118 #define ATC_DST_WIDTH_BYTE (0x0 << 28) ··· 183 182 * @txd: support for the async_tx api 184 183 * @desc_node: node on the channed descriptors list 185 184 * @len: descriptor byte count 186 - * @tx_width: transfer width 187 185 * @total_len: total transaction byte count 188 186 */ 189 187 struct at_desc { ··· 194 194 struct dma_async_tx_descriptor txd; 195 195 struct list_head desc_node; 196 196 size_t len; 197 - u32 tx_width; 198 197 size_t total_len; 199 198 200 199 /* Interleaved data */
+14 -12
drivers/dma/at_xdmac.c
··· 359 359 * descriptor view 2 since some fields of the configuration register 360 360 * depend on transfer size and src/dest addresses. 361 361 */ 362 - if (at_xdmac_chan_is_cyclic(atchan)) { 362 + if (at_xdmac_chan_is_cyclic(atchan)) 363 363 reg = AT_XDMAC_CNDC_NDVIEW_NDV1; 364 - at_xdmac_chan_write(atchan, AT_XDMAC_CC, first->lld.mbr_cfg); 365 - } else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3) { 364 + else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3) 366 365 reg = AT_XDMAC_CNDC_NDVIEW_NDV3; 367 - } else { 368 - /* 369 - * No need to write AT_XDMAC_CC reg, it will be done when the 370 - * descriptor is fecthed. 371 - */ 366 + else 372 367 reg = AT_XDMAC_CNDC_NDVIEW_NDV2; 373 - } 368 + /* 369 + * Even if the register will be updated from the configuration in the 370 + * descriptor when using view 2 or higher, the PROT bit won't be set 371 + * properly. This bit can be modified only by using the channel 372 + * configuration register. 373 + */ 374 + at_xdmac_chan_write(atchan, AT_XDMAC_CC, first->lld.mbr_cfg); 374 375 375 376 reg |= AT_XDMAC_CNDC_NDDUP 376 377 | AT_XDMAC_CNDC_NDSUP ··· 682 681 desc->lld.mbr_sa = mem; 683 682 desc->lld.mbr_da = atchan->sconfig.dst_addr; 684 683 } 685 - desc->lld.mbr_cfg = atchan->cfg; 686 - dwidth = at_xdmac_get_dwidth(desc->lld.mbr_cfg); 684 + dwidth = at_xdmac_get_dwidth(atchan->cfg); 687 685 fixed_dwidth = IS_ALIGNED(len, 1 << dwidth) 688 - ? at_xdmac_get_dwidth(desc->lld.mbr_cfg) 686 + ? dwidth 689 687 : AT_XDMAC_CC_DWIDTH_BYTE; 690 688 desc->lld.mbr_ubc = AT_XDMAC_MBR_UBC_NDV2 /* next descriptor view */ 691 689 | AT_XDMAC_MBR_UBC_NDEN /* next descriptor dst parameter update */ 692 690 | AT_XDMAC_MBR_UBC_NSEN /* next descriptor src parameter update */ 693 691 | (len >> fixed_dwidth); /* microblock length */ 692 + desc->lld.mbr_cfg = (atchan->cfg & ~AT_XDMAC_CC_DWIDTH_MASK) | 693 + AT_XDMAC_CC_DWIDTH(fixed_dwidth); 694 694 dev_dbg(chan2dev(chan), 695 695 "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n", 696 696 __func__, &desc->lld.mbr_sa, &desc->lld.mbr_da, desc->lld.mbr_ubc);
+5 -4
drivers/dma/mv_xor.c
··· 162 162 config &= ~0x7; 163 163 config |= op_mode; 164 164 165 - if (IS_ENABLED(__BIG_ENDIAN)) 166 - config |= XOR_DESCRIPTOR_SWAP; 167 - else 168 - config &= ~XOR_DESCRIPTOR_SWAP; 165 + #if defined(__BIG_ENDIAN) 166 + config |= XOR_DESCRIPTOR_SWAP; 167 + #else 168 + config &= ~XOR_DESCRIPTOR_SWAP; 169 + #endif 169 170 170 171 writel_relaxed(config, XOR_CONFIG(chan)); 171 172 chan->current_type = type;
+2 -1
drivers/dma/pl330.c
··· 2328 2328 desc->txd.callback = last->txd.callback; 2329 2329 desc->txd.callback_param = last->txd.callback_param; 2330 2330 } 2331 - last->last = false; 2331 + desc->last = false; 2332 2332 2333 2333 dma_cookie_assign(&desc->txd); 2334 2334 ··· 2623 2623 desc->rqcfg.brst_len = 1; 2624 2624 2625 2625 desc->rqcfg.brst_len = get_burst_len(desc, len); 2626 + desc->bytes_requested = len; 2626 2627 2627 2628 desc->txd.flags = flags; 2628 2629
+6 -13
drivers/dma/virt-dma.c
··· 29 29 spin_lock_irqsave(&vc->lock, flags); 30 30 cookie = dma_cookie_assign(tx); 31 31 32 - list_move_tail(&vd->node, &vc->desc_submitted); 32 + list_add_tail(&vd->node, &vc->desc_submitted); 33 33 spin_unlock_irqrestore(&vc->lock, flags); 34 34 35 35 dev_dbg(vc->chan.device->dev, "vchan %p: txd %p[%x]: submitted\n", ··· 83 83 cb_data = vd->tx.callback_param; 84 84 85 85 list_del(&vd->node); 86 - if (async_tx_test_ack(&vd->tx)) 87 - list_add(&vd->node, &vc->desc_allocated); 88 - else 89 - vc->desc_free(vd); 86 + 87 + vc->desc_free(vd); 90 88 91 89 if (cb) 92 90 cb(cb_data); ··· 96 98 while (!list_empty(head)) { 97 99 struct virt_dma_desc *vd = list_first_entry(head, 98 100 struct virt_dma_desc, node); 99 - if (async_tx_test_ack(&vd->tx)) { 100 - list_move_tail(&vd->node, &vc->desc_allocated); 101 - } else { 102 - dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd); 103 - list_del(&vd->node); 104 - vc->desc_free(vd); 105 - } 101 + list_del(&vd->node); 102 + dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd); 103 + vc->desc_free(vd); 106 104 } 107 105 } 108 106 EXPORT_SYMBOL_GPL(vchan_dma_desc_free_list); ··· 108 114 dma_cookie_init(&vc->chan); 109 115 110 116 spin_lock_init(&vc->lock); 111 - INIT_LIST_HEAD(&vc->desc_allocated); 112 117 INIT_LIST_HEAD(&vc->desc_submitted); 113 118 INIT_LIST_HEAD(&vc->desc_issued); 114 119 INIT_LIST_HEAD(&vc->desc_completed);
+1 -12
drivers/dma/virt-dma.h
··· 29 29 spinlock_t lock; 30 30 31 31 /* protected by vc.lock */ 32 - struct list_head desc_allocated; 33 32 struct list_head desc_submitted; 34 33 struct list_head desc_issued; 35 34 struct list_head desc_completed; ··· 55 56 struct virt_dma_desc *vd, unsigned long tx_flags) 56 57 { 57 58 extern dma_cookie_t vchan_tx_submit(struct dma_async_tx_descriptor *); 58 - unsigned long flags; 59 59 60 60 dma_async_tx_descriptor_init(&vd->tx, &vc->chan); 61 61 vd->tx.flags = tx_flags; 62 62 vd->tx.tx_submit = vchan_tx_submit; 63 - 64 - spin_lock_irqsave(&vc->lock, flags); 65 - list_add_tail(&vd->node, &vc->desc_allocated); 66 - spin_unlock_irqrestore(&vc->lock, flags); 67 63 68 64 return &vd->tx; 69 65 } ··· 122 128 } 123 129 124 130 /** 125 - * vchan_get_all_descriptors - obtain all allocated, submitted and issued 126 - * descriptors 131 + * vchan_get_all_descriptors - obtain all submitted and issued descriptors 127 132 * vc: virtual channel to get descriptors from 128 133 * head: list of descriptors found 129 134 * ··· 134 141 static inline void vchan_get_all_descriptors(struct virt_dma_chan *vc, 135 142 struct list_head *head) 136 143 { 137 - list_splice_tail_init(&vc->desc_allocated, head); 138 144 list_splice_tail_init(&vc->desc_submitted, head); 139 145 list_splice_tail_init(&vc->desc_issued, head); 140 146 list_splice_tail_init(&vc->desc_completed, head); ··· 141 149 142 150 static inline void vchan_free_chan_resources(struct virt_dma_chan *vc) 143 151 { 144 - struct virt_dma_desc *vd; 145 152 unsigned long flags; 146 153 LIST_HEAD(head); 147 154 148 155 spin_lock_irqsave(&vc->lock, flags); 149 156 vchan_get_all_descriptors(vc, &head); 150 - list_for_each_entry(vd, &head, node) 151 - async_tx_clear_ack(&vd->tx); 152 157 spin_unlock_irqrestore(&vc->lock, flags); 153 158 154 159 vchan_dma_desc_free_list(vc, &head);
+3
drivers/dma/xgene-dma.c
··· 111 111 #define XGENE_DMA_MEM_RAM_SHUTDOWN 0xD070 112 112 #define XGENE_DMA_BLK_MEM_RDY 0xD074 113 113 #define XGENE_DMA_BLK_MEM_RDY_VAL 0xFFFFFFFF 114 + #define XGENE_DMA_RING_CMD_SM_OFFSET 0x8000 114 115 115 116 /* X-Gene SoC EFUSE csr register and bit defination */ 116 117 #define XGENE_SOC_JTAG1_SHADOW 0x18 ··· 1887 1886 dev_err(&pdev->dev, "Failed to ioremap ring cmd csr region"); 1888 1887 return -ENOMEM; 1889 1888 } 1889 + 1890 + pdma->csr_ring_cmd += XGENE_DMA_RING_CMD_SM_OFFSET; 1890 1891 1891 1892 /* Get efuse csr region */ 1892 1893 res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
+1 -1
drivers/edac/ppc4xx_edac.c
··· 920 920 */ 921 921 922 922 for (row = 0; row < mci->nr_csrows; row++) { 923 - struct csrow_info *csi = &mci->csrows[row]; 923 + struct csrow_info *csi = mci->csrows[row]; 924 924 925 925 /* 926 926 * Get the configuration settings for this
-13
drivers/extcon/extcon-palmas.c
··· 200 200 status = devm_extcon_dev_register(&pdev->dev, palmas_usb->edev); 201 201 if (status) { 202 202 dev_err(&pdev->dev, "failed to register extcon device\n"); 203 - kfree(palmas_usb->edev->name); 204 203 return status; 205 204 } 206 205 ··· 213 214 if (status < 0) { 214 215 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", 215 216 palmas_usb->id_irq, status); 216 - kfree(palmas_usb->edev->name); 217 217 return status; 218 218 } 219 219 } ··· 227 229 if (status < 0) { 228 230 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", 229 231 palmas_usb->vbus_irq, status); 230 - kfree(palmas_usb->edev->name); 231 232 return status; 232 233 } 233 234 } 234 235 235 236 palmas_enable_irq(palmas_usb); 236 237 device_set_wakeup_capable(&pdev->dev, true); 237 - return 0; 238 - } 239 - 240 - static int palmas_usb_remove(struct platform_device *pdev) 241 - { 242 - struct palmas_usb *palmas_usb = platform_get_drvdata(pdev); 243 - 244 - kfree(palmas_usb->edev->name); 245 - 246 238 return 0; 247 239 } 248 240 ··· 276 288 277 289 static struct platform_driver palmas_usb_driver = { 278 290 .probe = palmas_usb_probe, 279 - .remove = palmas_usb_remove, 280 291 .driver = { 281 292 .name = "palmas-usb", 282 293 .of_match_table = of_palmas_match_tbl,
+44 -17
drivers/extcon/extcon.c
··· 124 124 return -EINVAL; 125 125 } 126 126 127 - static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) 127 + static int find_cable_id_by_name(struct extcon_dev *edev, const char *name) 128 128 { 129 - unsigned int id = EXTCON_NONE; 129 + unsigned int id = -EINVAL; 130 130 int i = 0; 131 131 132 - if (edev->max_supported == 0) 133 - return -EINVAL; 134 - 135 - /* Find the the number of extcon cable */ 132 + /* Find the id of extcon cable */ 136 133 while (extcon_name[i]) { 137 134 if (!strncmp(extcon_name[i], name, CABLE_NAME_MAX)) { 138 135 id = i; 139 136 break; 140 137 } 138 + i++; 141 139 } 142 140 143 - if (id == EXTCON_NONE) 141 + return id; 142 + } 143 + 144 + static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) 145 + { 146 + unsigned int id; 147 + 148 + if (edev->max_supported == 0) 144 149 return -EINVAL; 150 + 151 + /* Find the the number of extcon cable */ 152 + id = find_cable_id_by_name(edev, name); 153 + if (id < 0) 154 + return id; 145 155 146 156 return find_cable_index_by_id(edev, id); 147 157 } ··· 238 228 struct extcon_cable *cable = container_of(attr, struct extcon_cable, 239 229 attr_state); 240 230 231 + int i = cable->cable_index; 232 + 241 233 return sprintf(buf, "%d\n", 242 234 extcon_get_cable_state_(cable->edev, 243 - cable->cable_index)); 235 + cable->edev->supported_cable[i])); 244 236 } 245 237 246 238 /** ··· 275 263 spin_lock_irqsave(&edev->lock, flags); 276 264 277 265 if (edev->state != ((edev->state & ~mask) | (state & mask))) { 266 + u32 old_state; 267 + 278 268 if (check_mutually_exclusive(edev, (edev->state & ~mask) | 279 269 (state & mask))) { 280 270 spin_unlock_irqrestore(&edev->lock, flags); 281 271 return -EPERM; 282 272 } 283 273 284 - for (index = 0; index < edev->max_supported; index++) { 285 - if (is_extcon_changed(edev->state, state, index, &attached)) 286 - raw_notifier_call_chain(&edev->nh[index], attached, edev); 287 - } 288 - 274 + old_state = edev->state; 289 275 edev->state &= ~mask; 290 276 edev->state |= state & mask; 277 + 278 + for (index = 0; index < edev->max_supported; index++) { 279 + if (is_extcon_changed(old_state, edev->state, index, 280 + &attached)) 281 + raw_notifier_call_chain(&edev->nh[index], 282 + attached, edev); 283 + } 291 284 292 285 /* This could be in interrupt handler */ 293 286 prop_buf = (char *)get_zeroed_page(GFP_ATOMIC); ··· 378 361 */ 379 362 int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name) 380 363 { 381 - return extcon_get_cable_state_(edev, find_cable_index_by_name 382 - (edev, cable_name)); 364 + unsigned int id; 365 + 366 + id = find_cable_id_by_name(edev, cable_name); 367 + if (id < 0) 368 + return id; 369 + 370 + return extcon_get_cable_state_(edev, id); 383 371 } 384 372 EXPORT_SYMBOL_GPL(extcon_get_cable_state); 385 373 ··· 426 404 int extcon_set_cable_state(struct extcon_dev *edev, 427 405 const char *cable_name, bool cable_state) 428 406 { 429 - return extcon_set_cable_state_(edev, find_cable_index_by_name 430 - (edev, cable_name), cable_state); 407 + unsigned int id; 408 + 409 + id = find_cable_id_by_name(edev, cable_name); 410 + if (id < 0) 411 + return id; 412 + 413 + return extcon_set_cable_state_(edev, id, cable_state); 431 414 } 432 415 EXPORT_SYMBOL_GPL(extcon_set_cable_state); 433 416
+5
drivers/firmware/efi/efi.c
··· 58 58 59 59 static int __init parse_efi_cmdline(char *str) 60 60 { 61 + if (!str) { 62 + pr_warn("need at least one option\n"); 63 + return -EINVAL; 64 + } 65 + 61 66 if (parse_option_str(str, "noruntime")) 62 67 disable_runtime = true; 63 68
+4
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 1130 1130 uint32_t me_feature_version; 1131 1131 uint32_t ce_feature_version; 1132 1132 uint32_t pfp_feature_version; 1133 + uint32_t rlc_feature_version; 1134 + uint32_t mec_feature_version; 1135 + uint32_t mec2_feature_version; 1133 1136 struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS]; 1134 1137 unsigned num_gfx_rings; 1135 1138 struct amdgpu_ring compute_ring[AMDGPU_MAX_COMPUTE_RINGS]; ··· 1642 1639 /* SDMA firmware */ 1643 1640 const struct firmware *fw; 1644 1641 uint32_t fw_version; 1642 + uint32_t feature_version; 1645 1643 1646 1644 struct amdgpu_ring ring; 1647 1645 };
+7 -6
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
··· 317 317 break; 318 318 case AMDGPU_INFO_FW_GFX_RLC: 319 319 fw_info.ver = adev->gfx.rlc_fw_version; 320 - fw_info.feature = 0; 320 + fw_info.feature = adev->gfx.rlc_feature_version; 321 321 break; 322 322 case AMDGPU_INFO_FW_GFX_MEC: 323 - if (info->query_fw.index == 0) 323 + if (info->query_fw.index == 0) { 324 324 fw_info.ver = adev->gfx.mec_fw_version; 325 - else if (info->query_fw.index == 1) 325 + fw_info.feature = adev->gfx.mec_feature_version; 326 + } else if (info->query_fw.index == 1) { 326 327 fw_info.ver = adev->gfx.mec2_fw_version; 327 - else 328 + fw_info.feature = adev->gfx.mec2_feature_version; 329 + } else 328 330 return -EINVAL; 329 - fw_info.feature = 0; 330 331 break; 331 332 case AMDGPU_INFO_FW_SMC: 332 333 fw_info.ver = adev->pm.fw_version; ··· 337 336 if (info->query_fw.index >= 2) 338 337 return -EINVAL; 339 338 fw_info.ver = adev->sdma[info->query_fw.index].fw_version; 340 - fw_info.feature = 0; 339 + fw_info.feature = adev->sdma[info->query_fw.index].feature_version; 341 340 break; 342 341 default: 343 342 return -EINVAL;
+14 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
··· 374 374 unsigned height_in_mb = ALIGN(height / 16, 2); 375 375 unsigned fs_in_mb = width_in_mb * height_in_mb; 376 376 377 - unsigned image_size, tmp, min_dpb_size, num_dpb_buffer; 377 + unsigned image_size, tmp, min_dpb_size, num_dpb_buffer, min_ctx_size; 378 378 379 379 image_size = width * height; 380 380 image_size += image_size / 2; ··· 466 466 467 467 num_dpb_buffer = (le32_to_cpu(msg[59]) & 0xff) + 2; 468 468 min_dpb_size = image_size * num_dpb_buffer; 469 + min_ctx_size = ((width + 255) / 16) * ((height + 255) / 16) 470 + * 16 * num_dpb_buffer + 52 * 1024; 469 471 break; 470 472 471 473 default: ··· 488 486 489 487 buf_sizes[0x1] = dpb_size; 490 488 buf_sizes[0x2] = image_size; 489 + buf_sizes[0x4] = min_ctx_size; 491 490 return 0; 492 491 } 493 492 ··· 631 628 return -EINVAL; 632 629 } 633 630 631 + } else if (cmd == 0x206) { 632 + if ((end - start) < ctx->buf_sizes[4]) { 633 + DRM_ERROR("buffer (%d) to small (%d / %d)!\n", cmd, 634 + (unsigned)(end - start), 635 + ctx->buf_sizes[4]); 636 + return -EINVAL; 637 + } 634 638 } else if ((cmd != 0x100) && (cmd != 0x204)) { 635 639 DRM_ERROR("invalid UVD command %X!\n", cmd); 636 640 return -EINVAL; ··· 765 755 struct amdgpu_uvd_cs_ctx ctx = {}; 766 756 unsigned buf_sizes[] = { 767 757 [0x00000000] = 2048, 768 - [0x00000001] = 32 * 1024 * 1024, 769 - [0x00000002] = 2048 * 1152 * 3, 758 + [0x00000001] = 0xFFFFFFFF, 759 + [0x00000002] = 0xFFFFFFFF, 770 760 [0x00000003] = 2048, 761 + [0x00000004] = 0xFFFFFFFF, 771 762 }; 772 763 struct amdgpu_ib *ib = &parser->ibs[ib_idx]; 773 764 int r;
+1
drivers/gpu/drm/amd/amdgpu/cik_sdma.c
··· 500 500 amdgpu_ucode_print_sdma_hdr(&hdr->header); 501 501 fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; 502 502 adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); 503 + adev->sdma[i].feature_version = le32_to_cpu(hdr->ucode_feature_version); 503 504 fw_data = (const __le32 *) 504 505 (adev->sdma[i].fw->data + le32_to_cpu(hdr->header.ucode_array_offset_bytes)); 505 506 WREG32(mmSDMA0_UCODE_ADDR + sdma_offsets[i], 0);
+7 -1
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
··· 3080 3080 mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; 3081 3081 amdgpu_ucode_print_gfx_hdr(&mec_hdr->header); 3082 3082 adev->gfx.mec_fw_version = le32_to_cpu(mec_hdr->header.ucode_version); 3083 + adev->gfx.mec_feature_version = le32_to_cpu( 3084 + mec_hdr->ucode_feature_version); 3083 3085 3084 3086 gfx_v7_0_cp_compute_enable(adev, false); 3085 3087 ··· 3104 3102 mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data; 3105 3103 amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header); 3106 3104 adev->gfx.mec2_fw_version = le32_to_cpu(mec2_hdr->header.ucode_version); 3105 + adev->gfx.mec2_feature_version = le32_to_cpu( 3106 + mec2_hdr->ucode_feature_version); 3107 3107 3108 3108 /* MEC2 */ 3109 3109 fw_data = (const __le32 *) ··· 4070 4066 hdr = (const struct rlc_firmware_header_v1_0 *)adev->gfx.rlc_fw->data; 4071 4067 amdgpu_ucode_print_rlc_hdr(&hdr->header); 4072 4068 adev->gfx.rlc_fw_version = le32_to_cpu(hdr->header.ucode_version); 4069 + adev->gfx.rlc_feature_version = le32_to_cpu( 4070 + hdr->ucode_feature_version); 4073 4071 4074 4072 gfx_v7_0_rlc_stop(adev); 4075 4073 ··· 5128 5122 dev_info(adev->dev, " CP_HPD_EOP_CONTROL=0x%08X\n", 5129 5123 RREG32(mmCP_HPD_EOP_CONTROL)); 5130 5124 5131 - for (queue = 0; queue < 8; i++) { 5125 + for (queue = 0; queue < 8; queue++) { 5132 5126 cik_srbm_select(adev, me, pipe, queue, 0); 5133 5127 dev_info(adev->dev, " queue: %d\n", queue); 5134 5128 dev_info(adev->dev, " CP_PQ_WPTR_POLL_CNTL=0x%08X\n",
+24 -14
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
··· 587 587 int err; 588 588 struct amdgpu_firmware_info *info = NULL; 589 589 const struct common_firmware_header *header = NULL; 590 + const struct gfx_firmware_header_v1_0 *cp_hdr; 590 591 591 592 DRM_DEBUG("\n"); 592 593 ··· 612 611 err = amdgpu_ucode_validate(adev->gfx.pfp_fw); 613 612 if (err) 614 613 goto out; 614 + cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.pfp_fw->data; 615 + adev->gfx.pfp_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); 616 + adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); 615 617 616 618 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); 617 619 err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); ··· 623 619 err = amdgpu_ucode_validate(adev->gfx.me_fw); 624 620 if (err) 625 621 goto out; 622 + cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.me_fw->data; 623 + adev->gfx.me_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); 624 + adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); 626 625 627 626 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); 628 627 err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); ··· 634 627 err = amdgpu_ucode_validate(adev->gfx.ce_fw); 635 628 if (err) 636 629 goto out; 630 + cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.ce_fw->data; 631 + adev->gfx.ce_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); 632 + adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); 637 633 638 634 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); 639 635 err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); 640 636 if (err) 641 637 goto out; 642 638 err = amdgpu_ucode_validate(adev->gfx.rlc_fw); 639 + cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.rlc_fw->data; 640 + adev->gfx.rlc_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); 641 + adev->gfx.rlc_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); 643 642 644 643 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name); 645 644 err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); ··· 654 641 err = amdgpu_ucode_validate(adev->gfx.mec_fw); 655 642 if (err) 656 643 goto out; 644 + cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; 645 + adev->gfx.mec_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); 646 + adev->gfx.mec_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); 657 647 658 648 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); 659 649 err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); ··· 664 648 err = amdgpu_ucode_validate(adev->gfx.mec2_fw); 665 649 if (err) 666 650 goto out; 651 + cp_hdr = (const struct gfx_firmware_header_v1_0 *) 652 + adev->gfx.mec2_fw->data; 653 + adev->gfx.mec2_fw_version = le32_to_cpu( 654 + cp_hdr->header.ucode_version); 655 + adev->gfx.mec2_feature_version = le32_to_cpu( 656 + cp_hdr->ucode_feature_version); 667 657 } else { 668 658 err = 0; 669 659 adev->gfx.mec2_fw = NULL; ··· 2005 1983 adev->gfx.config.max_shader_engines = 1; 2006 1984 adev->gfx.config.max_tile_pipes = 2; 2007 1985 adev->gfx.config.max_sh_per_se = 1; 1986 + adev->gfx.config.max_backends_per_se = 2; 2008 1987 2009 1988 switch (adev->pdev->revision) { 2010 1989 case 0xc4: ··· 2014 1991 case 0xcc: 2015 1992 /* B10 */ 2016 1993 adev->gfx.config.max_cu_per_sh = 8; 2017 - adev->gfx.config.max_backends_per_se = 2; 2018 1994 break; 2019 1995 case 0xc5: 2020 1996 case 0x81: ··· 2022 2000 case 0xcd: 2023 2001 /* B8 */ 2024 2002 adev->gfx.config.max_cu_per_sh = 6; 2025 - adev->gfx.config.max_backends_per_se = 2; 2026 2003 break; 2027 2004 case 0xc6: 2028 2005 case 0xca: 2029 2006 case 0xce: 2030 2007 /* B6 */ 2031 2008 adev->gfx.config.max_cu_per_sh = 6; 2032 - adev->gfx.config.max_backends_per_se = 2; 2033 2009 break; 2034 2010 case 0xc7: 2035 2011 case 0x87: ··· 2035 2015 default: 2036 2016 /* B4 */ 2037 2017 adev->gfx.config.max_cu_per_sh = 4; 2038 - adev->gfx.config.max_backends_per_se = 1; 2039 2018 break; 2040 2019 } 2041 2020 ··· 2294 2275 2295 2276 hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; 2296 2277 amdgpu_ucode_print_rlc_hdr(&hdr->header); 2297 - adev->gfx.rlc_fw_version = le32_to_cpu(hdr->header.ucode_version); 2298 2278 2299 2279 fw_data = (const __le32 *)(adev->gfx.rlc_fw->data + 2300 2280 le32_to_cpu(hdr->header.ucode_array_offset_bytes)); ··· 2379 2361 amdgpu_ucode_print_gfx_hdr(&pfp_hdr->header); 2380 2362 amdgpu_ucode_print_gfx_hdr(&ce_hdr->header); 2381 2363 amdgpu_ucode_print_gfx_hdr(&me_hdr->header); 2382 - adev->gfx.pfp_fw_version = le32_to_cpu(pfp_hdr->header.ucode_version); 2383 - adev->gfx.ce_fw_version = le32_to_cpu(ce_hdr->header.ucode_version); 2384 - adev->gfx.me_fw_version = le32_to_cpu(me_hdr->header.ucode_version); 2385 - adev->gfx.me_feature_version = le32_to_cpu(me_hdr->ucode_feature_version); 2386 - adev->gfx.ce_feature_version = le32_to_cpu(ce_hdr->ucode_feature_version); 2387 - adev->gfx.pfp_feature_version = le32_to_cpu(pfp_hdr->ucode_feature_version); 2388 2364 2389 2365 gfx_v8_0_cp_gfx_enable(adev, false); 2390 2366 ··· 2634 2622 2635 2623 mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; 2636 2624 amdgpu_ucode_print_gfx_hdr(&mec_hdr->header); 2637 - adev->gfx.mec_fw_version = le32_to_cpu(mec_hdr->header.ucode_version); 2638 2625 2639 2626 fw_data = (const __le32 *) 2640 2627 (adev->gfx.mec_fw->data + ··· 2652 2641 2653 2642 mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data; 2654 2643 amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header); 2655 - adev->gfx.mec2_fw_version = le32_to_cpu(mec2_hdr->header.ucode_version); 2656 2644 2657 2645 fw_data = (const __le32 *) 2658 2646 (adev->gfx.mec2_fw->data + ··· 3135 3125 WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, 3136 3126 AMDGPU_DOORBELL_KIQ << 2); 3137 3127 WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER, 3138 - 0x7FFFF << 2); 3128 + AMDGPU_DOORBELL_MEC_RING7 << 2); 3139 3129 } 3140 3130 tmp = RREG32(mmCP_HQD_PQ_DOORBELL_CONTROL); 3141 3131 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_DOORBELL_CONTROL,
+4 -2
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
··· 121 121 int err, i; 122 122 struct amdgpu_firmware_info *info = NULL; 123 123 const struct common_firmware_header *header = NULL; 124 + const struct sdma_firmware_header_v1_0 *hdr; 124 125 125 126 DRM_DEBUG("\n"); 126 127 ··· 143 142 err = amdgpu_ucode_validate(adev->sdma[i].fw); 144 143 if (err) 145 144 goto out; 145 + hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; 146 + adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); 147 + adev->sdma[i].feature_version = le32_to_cpu(hdr->ucode_feature_version); 146 148 147 149 if (adev->firmware.smu_load) { 148 150 info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i]; ··· 545 541 hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; 546 542 amdgpu_ucode_print_sdma_hdr(&hdr->header); 547 543 fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; 548 - adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); 549 - 550 544 fw_data = (const __le32 *) 551 545 (adev->sdma[i].fw->data + 552 546 le32_to_cpu(hdr->header.ucode_array_offset_bytes));
+4 -2
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
··· 159 159 int err, i; 160 160 struct amdgpu_firmware_info *info = NULL; 161 161 const struct common_firmware_header *header = NULL; 162 + const struct sdma_firmware_header_v1_0 *hdr; 162 163 163 164 DRM_DEBUG("\n"); 164 165 ··· 184 183 err = amdgpu_ucode_validate(adev->sdma[i].fw); 185 184 if (err) 186 185 goto out; 186 + hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; 187 + adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); 188 + adev->sdma[i].feature_version = le32_to_cpu(hdr->ucode_feature_version); 187 189 188 190 if (adev->firmware.smu_load) { 189 191 info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i]; ··· 634 630 hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; 635 631 amdgpu_ucode_print_sdma_hdr(&hdr->header); 636 632 fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; 637 - adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); 638 - 639 633 fw_data = (const __le32 *) 640 634 (adev->sdma[i].fw->data + 641 635 le32_to_cpu(hdr->header.ucode_array_offset_bytes));
+9 -1
drivers/gpu/drm/drm_atomic_helper.c
··· 196 196 } 197 197 198 198 funcs = connector->helper_private; 199 - new_encoder = funcs->best_encoder(connector); 199 + 200 + if (funcs->atomic_best_encoder) 201 + new_encoder = funcs->atomic_best_encoder(connector, 202 + connector_state); 203 + else 204 + new_encoder = funcs->best_encoder(connector); 200 205 201 206 if (!new_encoder) { 202 207 DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n", ··· 233 228 return ret; 234 229 } 235 230 } 231 + 232 + if (WARN_ON(!connector_state->crtc)) 233 + return -EINVAL; 236 234 237 235 connector_state->best_encoder = new_encoder; 238 236 idx = drm_crtc_index(connector_state->crtc);
-1
drivers/gpu/drm/drm_dp_mst_topology.c
··· 1294 1294 goto retry; 1295 1295 } 1296 1296 DRM_DEBUG_KMS("failed to dpcd write %d %d\n", tosend, ret); 1297 - WARN(1, "fail\n"); 1298 1297 1299 1298 return -EIO; 1300 1299 }
+1 -1
drivers/gpu/drm/drm_irq.c
··· 75 75 module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600); 76 76 77 77 static void store_vblank(struct drm_device *dev, int crtc, 78 - unsigned vblank_count_inc, 78 + u32 vblank_count_inc, 79 79 struct timeval *t_vblank) 80 80 { 81 81 struct drm_vblank_crtc *vblank = &dev->vblank[crtc];
+2 -2
drivers/gpu/drm/i2c/tda998x_drv.c
··· 606 606 tda998x_write_if(struct tda998x_priv *priv, uint8_t bit, uint16_t addr, 607 607 uint8_t *buf, size_t size) 608 608 { 609 - buf[PB(0)] = tda998x_cksum(buf, size); 610 - 611 609 reg_clear(priv, REG_DIP_IF_FLAGS, bit); 612 610 reg_write_range(priv, addr, buf, size); 613 611 reg_set(priv, REG_DIP_IF_FLAGS, bit); ··· 624 626 buf[PB(2)] = p->audio_frame[2] & 0x1c; /* SF */ 625 627 buf[PB(4)] = p->audio_frame[4]; 626 628 buf[PB(5)] = p->audio_frame[5] & 0xf8; /* DM_INH + LSV */ 629 + 630 + buf[PB(0)] = tda998x_cksum(buf, sizeof(buf)); 627 631 628 632 tda998x_write_if(priv, DIP_IF_FLAGS_IF4, REG_IF4_HB0, buf, 629 633 sizeof(buf));
+23 -4
drivers/gpu/drm/i915/intel_bios.c
··· 1075 1075 const union child_device_config *p_child; 1076 1076 union child_device_config *child_dev_ptr; 1077 1077 int i, child_device_num, count; 1078 - u16 block_size; 1078 + u8 expected_size; 1079 + u16 block_size; 1079 1080 1080 1081 p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS); 1081 1082 if (!p_defs) { 1082 1083 DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n"); 1083 1084 return; 1084 1085 } 1085 - if (p_defs->child_dev_size < sizeof(*p_child)) { 1086 - DRM_ERROR("General definiton block child device size is too small.\n"); 1086 + if (bdb->version < 195) { 1087 + expected_size = 33; 1088 + } else if (bdb->version == 195) { 1089 + expected_size = 37; 1090 + } else if (bdb->version <= 197) { 1091 + expected_size = 38; 1092 + } else { 1093 + expected_size = 38; 1094 + DRM_DEBUG_DRIVER("Expected child_device_config size for BDB version %u not known; assuming %u\n", 1095 + expected_size, bdb->version); 1096 + } 1097 + 1098 + if (expected_size > sizeof(*p_child)) { 1099 + DRM_ERROR("child_device_config cannot fit in p_child\n"); 1100 + return; 1101 + } 1102 + 1103 + if (p_defs->child_dev_size != expected_size) { 1104 + DRM_ERROR("Size mismatch; child_device_config size=%u (expected %u); bdb->version: %u\n", 1105 + p_defs->child_dev_size, expected_size, bdb->version); 1087 1106 return; 1088 1107 } 1089 1108 /* get the block size of general definitions */ ··· 1149 1130 1150 1131 child_dev_ptr = dev_priv->vbt.child_dev + count; 1151 1132 count++; 1152 - memcpy(child_dev_ptr, p_child, sizeof(*p_child)); 1133 + memcpy(child_dev_ptr, p_child, p_defs->child_dev_size); 1153 1134 } 1154 1135 return; 1155 1136 }
+11
drivers/gpu/drm/i915/intel_dp_mst.c
··· 357 357 return MODE_OK; 358 358 } 359 359 360 + static struct drm_encoder *intel_mst_atomic_best_encoder(struct drm_connector *connector, 361 + struct drm_connector_state *state) 362 + { 363 + struct intel_connector *intel_connector = to_intel_connector(connector); 364 + struct intel_dp *intel_dp = intel_connector->mst_port; 365 + struct intel_crtc *crtc = to_intel_crtc(state->crtc); 366 + 367 + return &intel_dp->mst_encoders[crtc->pipe]->base.base; 368 + } 369 + 360 370 static struct drm_encoder *intel_mst_best_encoder(struct drm_connector *connector) 361 371 { 362 372 struct intel_connector *intel_connector = to_intel_connector(connector); ··· 377 367 static const struct drm_connector_helper_funcs intel_dp_mst_connector_helper_funcs = { 378 368 .get_modes = intel_dp_mst_get_modes, 379 369 .mode_valid = intel_dp_mst_mode_valid, 370 + .atomic_best_encoder = intel_mst_atomic_best_encoder, 380 371 .best_encoder = intel_mst_best_encoder, 381 372 }; 382 373
+5 -2
drivers/hid/hid-input.c
··· 462 462 463 463 static void hidinput_cleanup_battery(struct hid_device *dev) 464 464 { 465 + const struct power_supply_desc *psy_desc; 466 + 465 467 if (!dev->battery) 466 468 return; 467 469 470 + psy_desc = dev->battery->desc; 468 471 power_supply_unregister(dev->battery); 469 - kfree(dev->battery->desc->name); 470 - kfree(dev->battery->desc); 472 + kfree(psy_desc->name); 473 + kfree(psy_desc); 471 474 dev->battery = NULL; 472 475 } 473 476 #else /* !CONFIG_HID_BATTERY_STRENGTH */
+1 -1
drivers/hid/hid-uclogic.c
··· 858 858 for (p = drvdata->rdesc; 859 859 p <= drvdata->rdesc + drvdata->rsize - 4;) { 860 860 if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D && 861 - p[3] < sizeof(params)) { 861 + p[3] < ARRAY_SIZE(params)) { 862 862 v = params[p[3]]; 863 863 put_unaligned(cpu_to_le32(v), (s32 *)p); 864 864 p += 4;
+37 -33
drivers/hid/wacom_sys.c
··· 1284 1284 return error; 1285 1285 } 1286 1286 1287 + /* 1288 + * Not all devices report physical dimensions from HID. 1289 + * Compute the default from hardcoded logical dimension 1290 + * and resolution before driver overwrites them. 1291 + */ 1292 + static void wacom_set_default_phy(struct wacom_features *features) 1293 + { 1294 + if (features->x_resolution) { 1295 + features->x_phy = (features->x_max * 100) / 1296 + features->x_resolution; 1297 + features->y_phy = (features->y_max * 100) / 1298 + features->y_resolution; 1299 + } 1300 + } 1301 + 1302 + static void wacom_calculate_res(struct wacom_features *features) 1303 + { 1304 + /* set unit to "100th of a mm" for devices not reported by HID */ 1305 + if (!features->unit) { 1306 + features->unit = 0x11; 1307 + features->unitExpo = -3; 1308 + } 1309 + 1310 + features->x_resolution = wacom_calc_hid_res(features->x_max, 1311 + features->x_phy, 1312 + features->unit, 1313 + features->unitExpo); 1314 + features->y_resolution = wacom_calc_hid_res(features->y_max, 1315 + features->y_phy, 1316 + features->unit, 1317 + features->unitExpo); 1318 + } 1319 + 1287 1320 static void wacom_wireless_work(struct work_struct *work) 1288 1321 { 1289 1322 struct wacom *wacom = container_of(work, struct wacom, work); ··· 1374 1341 if (wacom_wac1->features.type != INTUOSHT && 1375 1342 wacom_wac1->features.type != BAMBOO_PT) 1376 1343 wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PAD; 1344 + wacom_set_default_phy(&wacom_wac1->features); 1345 + wacom_calculate_res(&wacom_wac1->features); 1377 1346 snprintf(wacom_wac1->pen_name, WACOM_NAME_MAX, "%s (WL) Pen", 1378 1347 wacom_wac1->features.name); 1379 1348 snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX, "%s (WL) Pad", ··· 1394 1359 wacom_wac2->features = 1395 1360 *((struct wacom_features *)id->driver_data); 1396 1361 wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; 1362 + wacom_set_default_phy(&wacom_wac2->features); 1397 1363 wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; 1364 + wacom_calculate_res(&wacom_wac2->features); 1398 1365 snprintf(wacom_wac2->touch_name, WACOM_NAME_MAX, 1399 1366 "%s (WL) Finger",wacom_wac2->features.name); 1400 1367 snprintf(wacom_wac2->pad_name, WACOM_NAME_MAX, ··· 1442 1405 wacom->battery) { 1443 1406 wacom_destroy_battery(wacom); 1444 1407 } 1445 - } 1446 - 1447 - /* 1448 - * Not all devices report physical dimensions from HID. 1449 - * Compute the default from hardcoded logical dimension 1450 - * and resolution before driver overwrites them. 1451 - */ 1452 - static void wacom_set_default_phy(struct wacom_features *features) 1453 - { 1454 - if (features->x_resolution) { 1455 - features->x_phy = (features->x_max * 100) / 1456 - features->x_resolution; 1457 - features->y_phy = (features->y_max * 100) / 1458 - features->y_resolution; 1459 - } 1460 - } 1461 - 1462 - static void wacom_calculate_res(struct wacom_features *features) 1463 - { 1464 - /* set unit to "100th of a mm" for devices not reported by HID */ 1465 - if (!features->unit) { 1466 - features->unit = 0x11; 1467 - features->unitExpo = -3; 1468 - } 1469 - 1470 - features->x_resolution = wacom_calc_hid_res(features->x_max, 1471 - features->x_phy, 1472 - features->unit, 1473 - features->unitExpo); 1474 - features->y_resolution = wacom_calc_hid_res(features->y_max, 1475 - features->y_phy, 1476 - features->unit, 1477 - features->unitExpo); 1478 1408 } 1479 1409 1480 1410 static size_t wacom_compute_pktlen(struct hid_device *hdev)
+17 -1
drivers/hwmon/dell-smm-hwmon.c
··· 929 929 930 930 MODULE_DEVICE_TABLE(dmi, i8k_dmi_table); 931 931 932 + static struct dmi_system_id i8k_blacklist_dmi_table[] __initdata = { 933 + { 934 + /* 935 + * CPU fan speed going up and down on Dell Studio XPS 8100 936 + * for unknown reasons. 937 + */ 938 + .ident = "Dell Studio XPS 8100", 939 + .matches = { 940 + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 941 + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Studio XPS 8100"), 942 + }, 943 + }, 944 + { } 945 + }; 946 + 932 947 /* 933 948 * Probe for the presence of a supported laptop. 934 949 */ ··· 955 940 /* 956 941 * Get DMI information 957 942 */ 958 - if (!dmi_check_system(i8k_dmi_table)) { 943 + if (!dmi_check_system(i8k_dmi_table) || 944 + dmi_check_system(i8k_blacklist_dmi_table)) { 959 945 if (!ignore_dmi && !force) 960 946 return -ENODEV; 961 947
+1
drivers/hwmon/g762.c
··· 582 582 { .compatible = "gmt,g763" }, 583 583 { }, 584 584 }; 585 + MODULE_DEVICE_TABLE(of, g762_dt_match); 585 586 586 587 /* 587 588 * Grab clock (a required property), enable it, get (fixed) clock frequency
+1
drivers/hwmon/nct7904.c
··· 575 575 {"nct7904", 0}, 576 576 {} 577 577 }; 578 + MODULE_DEVICE_TABLE(i2c, nct7904_id); 578 579 579 580 static struct i2c_driver nct7904_driver = { 580 581 .class = I2C_CLASS_HWMON,
+2 -2
drivers/i2c/busses/i2c-bfin-twi.c
··· 692 692 693 693 platform_set_drvdata(pdev, iface); 694 694 695 - dev_info(&pdev->dev, "Blackfin BF5xx on-chip I2C TWI Contoller, " 695 + dev_info(&pdev->dev, "Blackfin BF5xx on-chip I2C TWI Controller, " 696 696 "regs_base@%p\n", iface->regs_base); 697 697 698 698 return 0; ··· 735 735 module_exit(i2c_bfin_twi_exit); 736 736 737 737 MODULE_AUTHOR("Bryan Wu, Sonic Zhang"); 738 - MODULE_DESCRIPTION("Blackfin BF5xx on-chip I2C TWI Contoller Driver"); 738 + MODULE_DESCRIPTION("Blackfin BF5xx on-chip I2C TWI Controller Driver"); 739 739 MODULE_LICENSE("GPL"); 740 740 MODULE_ALIAS("platform:i2c-bfin-twi");
+11
drivers/i2c/busses/i2c-omap.c
··· 1247 1247 u32 reg; 1248 1248 1249 1249 reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG); 1250 + /* enable test mode */ 1250 1251 reg |= OMAP_I2C_SYSTEST_ST_EN; 1252 + /* select SDA/SCL IO mode */ 1253 + reg |= 3 << OMAP_I2C_SYSTEST_TMODE_SHIFT; 1254 + /* set SCL to high-impedance state (reset value is 0) */ 1255 + reg |= OMAP_I2C_SYSTEST_SCL_O; 1256 + /* set SDA to high-impedance state (reset value is 0) */ 1257 + reg |= OMAP_I2C_SYSTEST_SDA_O; 1251 1258 omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg); 1252 1259 } 1253 1260 ··· 1264 1257 u32 reg; 1265 1258 1266 1259 reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG); 1260 + /* restore reset values */ 1267 1261 reg &= ~OMAP_I2C_SYSTEST_ST_EN; 1262 + reg &= ~OMAP_I2C_SYSTEST_TMODE_MASK; 1263 + reg &= ~OMAP_I2C_SYSTEST_SCL_O; 1264 + reg &= ~OMAP_I2C_SYSTEST_SDA_O; 1268 1265 omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg); 1269 1266 } 1270 1267
+17 -7
drivers/i2c/i2c-core.c
··· 567 567 if (bri->prepare_recovery) 568 568 bri->prepare_recovery(adap); 569 569 570 + bri->set_scl(adap, val); 571 + ndelay(RECOVERY_NDELAY); 572 + 570 573 /* 571 574 * By this time SCL is high, as we need to give 9 falling-rising edges 572 575 */ ··· 600 597 601 598 int i2c_generic_scl_recovery(struct i2c_adapter *adap) 602 599 { 603 - adap->bus_recovery_info->set_scl(adap, 1); 604 600 return i2c_generic_recovery(adap); 605 601 } 606 602 EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery); ··· 1340 1338 struct i2c_client *of_find_i2c_device_by_node(struct device_node *node) 1341 1339 { 1342 1340 struct device *dev; 1341 + struct i2c_client *client; 1343 1342 1344 - dev = bus_find_device(&i2c_bus_type, NULL, node, 1345 - of_dev_node_match); 1343 + dev = bus_find_device(&i2c_bus_type, NULL, node, of_dev_node_match); 1346 1344 if (!dev) 1347 1345 return NULL; 1348 1346 1349 - return i2c_verify_client(dev); 1347 + client = i2c_verify_client(dev); 1348 + if (!client) 1349 + put_device(dev); 1350 + 1351 + return client; 1350 1352 } 1351 1353 EXPORT_SYMBOL(of_find_i2c_device_by_node); 1352 1354 ··· 1358 1352 struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node) 1359 1353 { 1360 1354 struct device *dev; 1355 + struct i2c_adapter *adapter; 1361 1356 1362 - dev = bus_find_device(&i2c_bus_type, NULL, node, 1363 - of_dev_node_match); 1357 + dev = bus_find_device(&i2c_bus_type, NULL, node, of_dev_node_match); 1364 1358 if (!dev) 1365 1359 return NULL; 1366 1360 1367 - return i2c_verify_adapter(dev); 1361 + adapter = i2c_verify_adapter(dev); 1362 + if (!adapter) 1363 + put_device(dev); 1364 + 1365 + return adapter; 1368 1366 } 1369 1367 EXPORT_SYMBOL(of_find_i2c_adapter_by_node); 1370 1368 #else
-6
drivers/i2c/i2c-slave-eeprom.c
··· 80 80 struct eeprom_data *eeprom; 81 81 unsigned long flags; 82 82 83 - if (off + count > attr->size) 84 - return -EFBIG; 85 - 86 83 eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj)); 87 84 88 85 spin_lock_irqsave(&eeprom->buffer_lock, flags); ··· 94 97 { 95 98 struct eeprom_data *eeprom; 96 99 unsigned long flags; 97 - 98 - if (off + count > attr->size) 99 - return -EFBIG; 100 100 101 101 eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj)); 102 102
+1 -1
drivers/input/joystick/turbografx.c
··· 196 196 if (n_buttons[i] < 1) 197 197 continue; 198 198 199 - if (n_buttons[i] > 6) { 199 + if (n_buttons[i] > ARRAY_SIZE(tgfx_buttons)) { 200 200 printk(KERN_ERR "turbografx.c: Invalid number of buttons %d\n", n_buttons[i]); 201 201 err = -EINVAL; 202 202 goto err_unreg_devs;
+1
drivers/input/misc/axp20x-pek.c
··· 292 292 MODULE_DESCRIPTION("axp20x Power Button"); 293 293 MODULE_AUTHOR("Carlo Caione <carlo@caione.org>"); 294 294 MODULE_LICENSE("GPL"); 295 + MODULE_ALIAS("platform:axp20x-pek");
+2 -1
drivers/input/misc/twl4030-vibra.c
··· 183 183 if (pdata && pdata->coexist) 184 184 return true; 185 185 186 - if (of_find_node_by_name(node, "codec")) { 186 + node = of_find_node_by_name(node, "codec"); 187 + if (node) { 187 188 of_node_put(node); 188 189 return true; 189 190 }
+6 -2
drivers/input/mouse/alps.c
··· 20 20 #include <linux/input/mt.h> 21 21 #include <linux/serio.h> 22 22 #include <linux/libps2.h> 23 + #include <linux/dmi.h> 23 24 24 25 #include "psmouse.h" 25 26 #include "alps.h" ··· 100 99 #define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */ 101 100 #define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with 102 101 6-byte ALPS packet */ 102 + #define ALPS_DELL 0x100 /* device is a Dell laptop */ 103 103 #define ALPS_BUTTONPAD 0x200 /* device is a clickpad */ 104 104 105 105 static const struct alps_model_info alps_model_data[] = { ··· 253 251 return; 254 252 } 255 253 256 - /* Non interleaved V2 dualpoint has separate stick button bits */ 254 + /* Dell non interleaved V2 dualpoint has separate stick button bits */ 257 255 if (priv->proto_version == ALPS_PROTO_V2 && 258 - priv->flags == (ALPS_PASS | ALPS_DUALPOINT)) { 256 + priv->flags == (ALPS_DELL | ALPS_PASS | ALPS_DUALPOINT)) { 259 257 left |= packet[0] & 1; 260 258 right |= packet[0] & 2; 261 259 middle |= packet[0] & 4; ··· 2552 2550 priv->byte0 = protocol->byte0; 2553 2551 priv->mask0 = protocol->mask0; 2554 2552 priv->flags = protocol->flags; 2553 + if (dmi_name_in_vendors("Dell")) 2554 + priv->flags |= ALPS_DELL; 2555 2555 2556 2556 priv->x_max = 2000; 2557 2557 priv->y_max = 1400;
+20 -2
drivers/input/mouse/elantech.c
··· 783 783 struct elantech_data *etd = psmouse->private; 784 784 unsigned char *packet = psmouse->packet; 785 785 unsigned char packet_type = packet[3] & 0x03; 786 + unsigned int ic_version; 786 787 bool sanity_check; 787 788 788 789 if (etd->tp_dev && (packet[3] & 0x0f) == 0x06) 789 790 return PACKET_TRACKPOINT; 790 791 792 + /* This represents the version of IC body. */ 793 + ic_version = (etd->fw_version & 0x0f0000) >> 16; 794 + 791 795 /* 792 796 * Sanity check based on the constant bits of a packet. 793 797 * The constant bits change depending on the value of 794 - * the hardware flag 'crc_enabled' but are the same for 795 - * every packet, regardless of the type. 798 + * the hardware flag 'crc_enabled' and the version of 799 + * the IC body, but are the same for every packet, 800 + * regardless of the type. 796 801 */ 797 802 if (etd->crc_enabled) 798 803 sanity_check = ((packet[3] & 0x08) == 0x00); 804 + else if (ic_version == 7 && etd->samples[1] == 0x2A) 805 + sanity_check = ((packet[3] & 0x1c) == 0x10); 799 806 else 800 807 sanity_check = ((packet[0] & 0x0c) == 0x04 && 801 808 (packet[3] & 0x1c) == 0x10); ··· 1123 1116 * Avatar AVIU-145A2 0x361f00 ? clickpad 1124 1117 * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons 1125 1118 * Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons 1119 + * Fujitsu T725 0x470f01 05, 12, 09 2 hw buttons 1126 1120 * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**) 1127 1121 * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons 1128 1122 * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*) ··· 1658 1650 "Synaptics capabilities query result 0x%02x, 0x%02x, 0x%02x.\n", 1659 1651 etd->capabilities[0], etd->capabilities[1], 1660 1652 etd->capabilities[2]); 1653 + 1654 + if (etd->hw_version != 1) { 1655 + if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY, etd->samples)) { 1656 + psmouse_err(psmouse, "failed to query sample data\n"); 1657 + goto init_fail; 1658 + } 1659 + psmouse_info(psmouse, 1660 + "Elan sample query result %02x, %02x, %02x\n", 1661 + etd->samples[0], etd->samples[1], etd->samples[2]); 1662 + } 1661 1663 1662 1664 if (elantech_set_absolute_mode(psmouse)) { 1663 1665 psmouse_err(psmouse,
+1
drivers/input/mouse/elantech.h
··· 129 129 unsigned char reg_26; 130 130 unsigned char debug; 131 131 unsigned char capabilities[3]; 132 + unsigned char samples[3]; 132 133 bool paritycheck; 133 134 bool jumpy_cursor; 134 135 bool reports_pressure;
+1 -1
drivers/irqchip/irq-mips-gic.c
··· 538 538 539 539 static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) 540 540 { 541 - smp_call_function_interrupt(); 541 + generic_smp_call_function_interrupt(); 542 542 543 543 return IRQ_HANDLED; 544 544 }
+1 -1
drivers/macintosh/ans-lcd.c
··· 7 7 #include <linux/kernel.h> 8 8 #include <linux/miscdevice.h> 9 9 #include <linux/fcntl.h> 10 - #include <linux/init.h> 10 + #include <linux/module.h> 11 11 #include <linux/delay.h> 12 12 #include <linux/fs.h> 13 13
-2
drivers/md/dm-cache-policy-mq.c
··· 1471 1471 MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); 1472 1472 MODULE_LICENSE("GPL"); 1473 1473 MODULE_DESCRIPTION("mq cache policy"); 1474 - 1475 - MODULE_ALIAS("dm-cache-default");
+2
drivers/md/dm-cache-policy-smq.c
··· 1789 1789 MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); 1790 1790 MODULE_LICENSE("GPL"); 1791 1791 MODULE_DESCRIPTION("smq cache policy"); 1792 + 1793 + MODULE_ALIAS("dm-cache-default");
+2 -2
drivers/md/dm-thin-metadata.c
··· 1293 1293 return r; 1294 1294 1295 1295 disk_super = dm_block_data(copy); 1296 - dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->data_mapping_root)); 1297 - dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->device_details_root)); 1296 + dm_btree_del(&pmd->info, le64_to_cpu(disk_super->data_mapping_root)); 1297 + dm_btree_del(&pmd->details_info, le64_to_cpu(disk_super->device_details_root)); 1298 1298 dm_sm_dec_block(pmd->metadata_sm, held_root); 1299 1299 1300 1300 return dm_tm_unlock(pmd->tm, copy);
+10 -17
drivers/md/dm.c
··· 1729 1729 struct mapped_device *md = q->queuedata; 1730 1730 struct dm_table *map = dm_get_live_table_fast(md); 1731 1731 struct dm_target *ti; 1732 - sector_t max_sectors, max_size = 0; 1732 + sector_t max_sectors; 1733 + int max_size = 0; 1733 1734 1734 1735 if (unlikely(!map)) 1735 1736 goto out; ··· 1743 1742 * Find maximum amount of I/O that won't need splitting 1744 1743 */ 1745 1744 max_sectors = min(max_io_len(bvm->bi_sector, ti), 1746 - (sector_t) queue_max_sectors(q)); 1745 + (sector_t) BIO_MAX_SECTORS); 1747 1746 max_size = (max_sectors << SECTOR_SHIFT) - bvm->bi_size; 1748 - 1749 - /* 1750 - * FIXME: this stop-gap fix _must_ be cleaned up (by passing a sector_t 1751 - * to the targets' merge function since it holds sectors not bytes). 1752 - * Just doing this as an interim fix for stable@ because the more 1753 - * comprehensive cleanup of switching to sector_t will impact every 1754 - * DM target that implements a ->merge hook. 1755 - */ 1756 - if (max_size > INT_MAX) 1757 - max_size = INT_MAX; 1747 + if (max_size < 0) 1748 + max_size = 0; 1758 1749 1759 1750 /* 1760 1751 * merge_bvec_fn() returns number of bytes ··· 1754 1761 * max is precomputed maximal io size 1755 1762 */ 1756 1763 if (max_size && ti->type->merge) 1757 - max_size = ti->type->merge(ti, bvm, biovec, (int) max_size); 1764 + max_size = ti->type->merge(ti, bvm, biovec, max_size); 1758 1765 /* 1759 1766 * If the target doesn't support merge method and some of the devices 1760 - * provided their merge_bvec method (we know this by looking for the 1761 - * max_hw_sectors that dm_set_device_limits may set), then we can't 1762 - * allow bios with multiple vector entries. So always set max_size 1763 - * to 0, and the code below allows just one page. 1767 + * provided their merge_bvec method (we know this by looking at 1768 + * queue_max_hw_sectors), then we can't allow bios with multiple vector 1769 + * entries. So always set max_size to 0, and the code below allows 1770 + * just one page. 1764 1771 */ 1765 1772 else if (queue_max_hw_sectors(q) <= PAGE_SIZE >> 9) 1766 1773 max_size = 0;
+1 -1
drivers/md/md.c
··· 5759 5759 char *ptr; 5760 5760 int err; 5761 5761 5762 - file = kmalloc(sizeof(*file), GFP_NOIO); 5762 + file = kzalloc(sizeof(*file), GFP_NOIO); 5763 5763 if (!file) 5764 5764 return -ENOMEM; 5765 5765
+6
drivers/md/persistent-data/dm-btree-internal.h
··· 138 138 139 139 extern struct dm_block_validator btree_node_validator; 140 140 141 + /* 142 + * Value type for upper levels of multi-level btrees. 143 + */ 144 + extern void init_le64_type(struct dm_transaction_manager *tm, 145 + struct dm_btree_value_type *vt); 146 + 141 147 #endif /* DM_BTREE_INTERNAL_H */
+7 -10
drivers/md/persistent-data/dm-btree-remove.c
··· 544 544 return r; 545 545 } 546 546 547 - static struct dm_btree_value_type le64_type = { 548 - .context = NULL, 549 - .size = sizeof(__le64), 550 - .inc = NULL, 551 - .dec = NULL, 552 - .equal = NULL 553 - }; 554 - 555 547 int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, 556 548 uint64_t *keys, dm_block_t *new_root) 557 549 { ··· 551 559 int index = 0, r = 0; 552 560 struct shadow_spine spine; 553 561 struct btree_node *n; 562 + struct dm_btree_value_type le64_vt; 554 563 564 + init_le64_type(info->tm, &le64_vt); 555 565 init_shadow_spine(&spine, info); 556 566 for (level = 0; level < info->levels; level++) { 557 567 r = remove_raw(&spine, info, 558 568 (level == last_level ? 559 - &info->value_type : &le64_type), 569 + &info->value_type : &le64_vt), 560 570 root, keys[level], (unsigned *)&index); 561 571 if (r < 0) 562 572 break; ··· 648 654 int index = 0, r = 0; 649 655 struct shadow_spine spine; 650 656 struct btree_node *n; 657 + struct dm_btree_value_type le64_vt; 651 658 uint64_t k; 652 659 660 + init_le64_type(info->tm, &le64_vt); 653 661 init_shadow_spine(&spine, info); 654 662 for (level = 0; level < last_level; level++) { 655 - r = remove_raw(&spine, info, &le64_type, 663 + r = remove_raw(&spine, info, &le64_vt, 656 664 root, keys[level], (unsigned *) &index); 657 665 if (r < 0) 658 666 goto out; ··· 685 689 value_ptr(n, index)); 686 690 687 691 delete_at(n, index); 692 + keys[last_level] = k + 1ull; 688 693 689 694 } else 690 695 r = -ENODATA;
+37
drivers/md/persistent-data/dm-btree-spine.c
··· 249 249 { 250 250 return s->root; 251 251 } 252 + 253 + static void le64_inc(void *context, const void *value_le) 254 + { 255 + struct dm_transaction_manager *tm = context; 256 + __le64 v_le; 257 + 258 + memcpy(&v_le, value_le, sizeof(v_le)); 259 + dm_tm_inc(tm, le64_to_cpu(v_le)); 260 + } 261 + 262 + static void le64_dec(void *context, const void *value_le) 263 + { 264 + struct dm_transaction_manager *tm = context; 265 + __le64 v_le; 266 + 267 + memcpy(&v_le, value_le, sizeof(v_le)); 268 + dm_tm_dec(tm, le64_to_cpu(v_le)); 269 + } 270 + 271 + static int le64_equal(void *context, const void *value1_le, const void *value2_le) 272 + { 273 + __le64 v1_le, v2_le; 274 + 275 + memcpy(&v1_le, value1_le, sizeof(v1_le)); 276 + memcpy(&v2_le, value2_le, sizeof(v2_le)); 277 + return v1_le == v2_le; 278 + } 279 + 280 + void init_le64_type(struct dm_transaction_manager *tm, 281 + struct dm_btree_value_type *vt) 282 + { 283 + vt->context = tm; 284 + vt->size = sizeof(__le64); 285 + vt->inc = le64_inc; 286 + vt->dec = le64_dec; 287 + vt->equal = le64_equal; 288 + }
+1 -6
drivers/md/persistent-data/dm-btree.c
··· 667 667 struct btree_node *n; 668 668 struct dm_btree_value_type le64_type; 669 669 670 - le64_type.context = NULL; 671 - le64_type.size = sizeof(__le64); 672 - le64_type.inc = NULL; 673 - le64_type.dec = NULL; 674 - le64_type.equal = NULL; 675 - 670 + init_le64_type(info->tm, &le64_type); 676 671 init_shadow_spine(&spine, info); 677 672 678 673 for (level = 0; level < (info->levels - 1); level++) {
+6 -4
drivers/md/raid1.c
··· 1476 1476 { 1477 1477 char b[BDEVNAME_SIZE]; 1478 1478 struct r1conf *conf = mddev->private; 1479 + unsigned long flags; 1479 1480 1480 1481 /* 1481 1482 * If it is not operational, then we have already marked it as dead ··· 1496 1495 return; 1497 1496 } 1498 1497 set_bit(Blocked, &rdev->flags); 1498 + spin_lock_irqsave(&conf->device_lock, flags); 1499 1499 if (test_and_clear_bit(In_sync, &rdev->flags)) { 1500 - unsigned long flags; 1501 - spin_lock_irqsave(&conf->device_lock, flags); 1502 1500 mddev->degraded++; 1503 1501 set_bit(Faulty, &rdev->flags); 1504 - spin_unlock_irqrestore(&conf->device_lock, flags); 1505 1502 } else 1506 1503 set_bit(Faulty, &rdev->flags); 1504 + spin_unlock_irqrestore(&conf->device_lock, flags); 1507 1505 /* 1508 1506 * if recovery is running, make sure it aborts. 1509 1507 */ ··· 1568 1568 * Find all failed disks within the RAID1 configuration 1569 1569 * and mark them readable. 1570 1570 * Called under mddev lock, so rcu protection not needed. 1571 + * device_lock used to avoid races with raid1_end_read_request 1572 + * which expects 'In_sync' flags and ->degraded to be consistent. 1571 1573 */ 1574 + spin_lock_irqsave(&conf->device_lock, flags); 1572 1575 for (i = 0; i < conf->raid_disks; i++) { 1573 1576 struct md_rdev *rdev = conf->mirrors[i].rdev; 1574 1577 struct md_rdev *repl = conf->mirrors[conf->raid_disks + i].rdev; ··· 1602 1599 sysfs_notify_dirent_safe(rdev->sysfs_state); 1603 1600 } 1604 1601 } 1605 - spin_lock_irqsave(&conf->device_lock, flags); 1606 1602 mddev->degraded -= count; 1607 1603 spin_unlock_irqrestore(&conf->device_lock, flags); 1608 1604
+3 -2
drivers/md/raid5.c
··· 2256 2256 static int drop_one_stripe(struct r5conf *conf) 2257 2257 { 2258 2258 struct stripe_head *sh; 2259 - int hash = (conf->max_nr_stripes - 1) % NR_STRIPE_HASH_LOCKS; 2259 + int hash = (conf->max_nr_stripes - 1) & STRIPE_HASH_LOCKS_MASK; 2260 2260 2261 2261 spin_lock_irq(conf->hash_locks + hash); 2262 2262 sh = get_free_stripe(conf, hash); ··· 6388 6388 6389 6389 if (mutex_trylock(&conf->cache_size_mutex)) { 6390 6390 ret= 0; 6391 - while (ret < sc->nr_to_scan) { 6391 + while (ret < sc->nr_to_scan && 6392 + conf->max_nr_stripes > conf->min_nr_stripes) { 6392 6393 if (drop_one_stripe(conf) == 0) { 6393 6394 ret = SHRINK_STOP; 6394 6395 break;
+1 -1
drivers/mfd/Kconfig
··· 115 115 116 116 config MFD_CROS_EC_SPI 117 117 tristate "ChromeOS Embedded Controller (SPI)" 118 - depends on MFD_CROS_EC && CROS_EC_PROTO && SPI && OF 118 + depends on MFD_CROS_EC && CROS_EC_PROTO && SPI 119 119 120 120 ---help--- 121 121 If you say Y here, you get support for talking to the ChromeOS EC
+7 -9
drivers/mfd/arizona-core.c
··· 651 651 652 652 arizona->has_fully_powered_off = true; 653 653 654 - disable_irq(arizona->irq); 654 + disable_irq_nosync(arizona->irq); 655 655 arizona_enable_reset(arizona); 656 656 regulator_bulk_disable(arizona->num_core_supplies, 657 657 arizona->core_supplies); ··· 1141 1141 arizona->pdata.gpio_defaults[i]); 1142 1142 } 1143 1143 1144 - pm_runtime_set_autosuspend_delay(arizona->dev, 100); 1145 - pm_runtime_use_autosuspend(arizona->dev); 1146 - pm_runtime_enable(arizona->dev); 1147 - 1148 1144 /* Chip default */ 1149 1145 if (!arizona->pdata.clk32k_src) 1150 1146 arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2; ··· 1241 1245 arizona->pdata.spk_fmt[i]); 1242 1246 } 1243 1247 1248 + pm_runtime_set_active(arizona->dev); 1249 + pm_runtime_enable(arizona->dev); 1250 + 1244 1251 /* Set up for interrupts */ 1245 1252 ret = arizona_irq_init(arizona); 1246 1253 if (ret != 0) 1247 1254 goto err_reset; 1255 + 1256 + pm_runtime_set_autosuspend_delay(arizona->dev, 100); 1257 + pm_runtime_use_autosuspend(arizona->dev); 1248 1258 1249 1259 arizona_request_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, "CLKGEN error", 1250 1260 arizona_clkgen_err, arizona); ··· 1279 1277 dev_err(arizona->dev, "Failed to add subdevices: %d\n", ret); 1280 1278 goto err_irq; 1281 1279 } 1282 - 1283 - #ifdef CONFIG_PM 1284 - regulator_disable(arizona->dcvdd); 1285 - #endif 1286 1280 1287 1281 return 0; 1288 1282
-3
drivers/misc/eeprom/at24.c
··· 438 438 { 439 439 struct at24_data *at24; 440 440 441 - if (unlikely(off >= attr->size)) 442 - return -EFBIG; 443 - 444 441 at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); 445 442 return at24_write(at24, buf, off, count); 446 443 }
+1
drivers/net/bonding/bond_main.c
··· 786 786 slave ? slave->dev->name : "NULL"); 787 787 788 788 if (!slave || !bond->send_peer_notif || 789 + !netif_carrier_ok(bond->dev) || 789 790 test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) 790 791 return false; 791 792
+8 -9
drivers/net/ethernet/3com/3c59x.c
··· 1763 1763 vp->rx_ring[i].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE)); 1764 1764 } 1765 1765 if (i != RX_RING_SIZE) { 1766 - int j; 1767 1766 pr_emerg("%s: no memory for rx ring\n", dev->name); 1768 - for (j = 0; j < i; j++) { 1769 - if (vp->rx_skbuff[j]) { 1770 - dev_kfree_skb(vp->rx_skbuff[j]); 1771 - vp->rx_skbuff[j] = NULL; 1772 - } 1773 - } 1774 1767 retval = -ENOMEM; 1775 - goto err_free_irq; 1768 + goto err_free_skb; 1776 1769 } 1777 1770 /* Wrap the ring. */ 1778 1771 vp->rx_ring[i-1].next = cpu_to_le32(vp->rx_ring_dma); ··· 1775 1782 if (!retval) 1776 1783 goto out; 1777 1784 1778 - err_free_irq: 1785 + err_free_skb: 1786 + for (i = 0; i < RX_RING_SIZE; i++) { 1787 + if (vp->rx_skbuff[i]) { 1788 + dev_kfree_skb(vp->rx_skbuff[i]); 1789 + vp->rx_skbuff[i] = NULL; 1790 + } 1791 + } 1779 1792 free_irq(dev->irq, dev); 1780 1793 err: 1781 1794 if (vortex_debug > 1)
+1 -1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
··· 264 264 if (likely(skb)) { 265 265 (*pkts_compl)++; 266 266 (*bytes_compl) += skb->len; 267 + dev_kfree_skb_any(skb); 267 268 } 268 269 269 - dev_kfree_skb_any(skb); 270 270 tx_buf->first_bd = 0; 271 271 tx_buf->skb = NULL; 272 272
+16
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
··· 1723 1723 offset += sizeof(u32); 1724 1724 data_buf += sizeof(u32); 1725 1725 written_so_far += sizeof(u32); 1726 + 1727 + /* At end of each 4Kb page, release nvram lock to allow MFW 1728 + * chance to take it for its own use. 1729 + */ 1730 + if ((cmd_flags & MCPR_NVM_COMMAND_LAST) && 1731 + (written_so_far < buf_size)) { 1732 + DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM, 1733 + "Releasing NVM lock after offset 0x%x\n", 1734 + (u32)(offset - sizeof(u32))); 1735 + bnx2x_release_nvram_lock(bp); 1736 + usleep_range(1000, 2000); 1737 + rc = bnx2x_acquire_nvram_lock(bp); 1738 + if (rc) 1739 + return rc; 1740 + } 1741 + 1726 1742 cmd_flags = 0; 1727 1743 } 1728 1744
+1 -1
drivers/net/ethernet/brocade/bna/bnad.c
··· 676 676 if (!next_cmpl->valid) 677 677 break; 678 678 } 679 + packets++; 679 680 680 681 /* TODO: BNA_CQ_EF_LOCAL ? */ 681 682 if (unlikely(flags & (BNA_CQ_EF_MAC_ERROR | ··· 693 692 else 694 693 bnad_cq_setup_skb_frags(rcb, skb, sop_ci, nvecs, len); 695 694 696 - packets++; 697 695 rcb->rxq->rx_packets++; 698 696 rcb->rxq->rx_bytes += totlen; 699 697 ccb->bytes_per_intr += totlen;
-3
drivers/net/ethernet/cavium/Kconfig
··· 16 16 config THUNDER_NIC_PF 17 17 tristate "Thunder Physical function driver" 18 18 depends on 64BIT 19 - default ARCH_THUNDER 20 19 select THUNDER_NIC_BGX 21 20 ---help--- 22 21 This driver supports Thunder's NIC physical function. ··· 28 29 config THUNDER_NIC_VF 29 30 tristate "Thunder Virtual function driver" 30 31 depends on 64BIT 31 - default ARCH_THUNDER 32 32 ---help--- 33 33 This driver supports Thunder's NIC virtual function 34 34 35 35 config THUNDER_NIC_BGX 36 36 tristate "Thunder MAC interface driver (BGX)" 37 37 depends on 64BIT 38 - default ARCH_THUNDER 39 38 select PHYLIB 40 39 select MDIO_OCTEON 41 40 ---help---
+2 -1
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
··· 2778 2778 EXT_MEM1_SIZE_G(size)); 2779 2779 } 2780 2780 } else { 2781 - if (i & EXT_MEM_ENABLE_F) 2781 + if (i & EXT_MEM_ENABLE_F) { 2782 2782 size = t4_read_reg(adap, MA_EXT_MEMORY_BAR_A); 2783 2783 add_debugfs_mem(adap, "mc", MEM_MC, 2784 2784 EXT_MEM_SIZE_G(size)); 2785 + } 2785 2786 } 2786 2787 2787 2788 de = debugfs_create_file_size("flash", S_IRUSR, adap->debugfs_root, adap,
+5
drivers/net/ethernet/emulex/benet/be_cmds.h
··· 620 620 BE_IF_FLAGS_VLAN_PROMISCUOUS |\ 621 621 BE_IF_FLAGS_MCAST_PROMISCUOUS) 622 622 623 + #define BE_IF_EN_FLAGS (BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_PASS_L3L4_ERRORS |\ 624 + BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_UNTAGGED) 625 + 626 + #define BE_IF_ALL_FILT_FLAGS (BE_IF_EN_FLAGS | BE_IF_FLAGS_ALL_PROMISCUOUS) 627 + 623 628 /* An RX interface is an object with one or more MAC addresses and 624 629 * filtering capabilities. */ 625 630 struct be_cmd_req_if_create {
+120 -67
drivers/net/ethernet/emulex/benet/be_main.c
··· 273 273 if (ether_addr_equal(addr->sa_data, netdev->dev_addr)) 274 274 return 0; 275 275 276 + /* if device is not running, copy MAC to netdev->dev_addr */ 277 + if (!netif_running(netdev)) 278 + goto done; 279 + 276 280 /* The PMAC_ADD cmd may fail if the VF doesn't have FILTMGMT 277 281 * privilege or if PF did not provision the new MAC address. 278 282 * On BE3, this cmd will always fail if the VF doesn't have the ··· 311 307 status = -EPERM; 312 308 goto err; 313 309 } 314 - 315 - memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); 316 - dev_info(dev, "MAC address changed to %pM\n", mac); 310 + done: 311 + ether_addr_copy(netdev->dev_addr, addr->sa_data); 312 + dev_info(dev, "MAC address changed to %pM\n", addr->sa_data); 317 313 return 0; 318 314 err: 319 315 dev_warn(dev, "MAC address change to %pM failed\n", addr->sa_data); ··· 2456 2452 be_eq_notify(eqo->adapter, eqo->q.id, false, true, num, 0); 2457 2453 } 2458 2454 2455 + /* Free posted rx buffers that were not used */ 2456 + static void be_rxq_clean(struct be_rx_obj *rxo) 2457 + { 2458 + struct be_queue_info *rxq = &rxo->q; 2459 + struct be_rx_page_info *page_info; 2460 + 2461 + while (atomic_read(&rxq->used) > 0) { 2462 + page_info = get_rx_page_info(rxo); 2463 + put_page(page_info->page); 2464 + memset(page_info, 0, sizeof(*page_info)); 2465 + } 2466 + BUG_ON(atomic_read(&rxq->used)); 2467 + rxq->tail = 0; 2468 + rxq->head = 0; 2469 + } 2470 + 2459 2471 static void be_rx_cq_clean(struct be_rx_obj *rxo) 2460 2472 { 2461 - struct be_rx_page_info *page_info; 2462 - struct be_queue_info *rxq = &rxo->q; 2463 2473 struct be_queue_info *rx_cq = &rxo->cq; 2464 2474 struct be_rx_compl_info *rxcp; 2465 2475 struct be_adapter *adapter = rxo->adapter; ··· 2510 2492 2511 2493 /* After cleanup, leave the CQ in unarmed state */ 2512 2494 be_cq_notify(adapter, rx_cq->id, false, 0); 2513 - 2514 - /* Then free posted rx buffers that were not used */ 2515 - while (atomic_read(&rxq->used) > 0) { 2516 - page_info = get_rx_page_info(rxo); 2517 - put_page(page_info->page); 2518 - memset(page_info, 0, sizeof(*page_info)); 2519 - } 2520 - BUG_ON(atomic_read(&rxq->used)); 2521 - rxq->tail = 0; 2522 - rxq->head = 0; 2523 2495 } 2524 2496 2525 2497 static void be_tx_compl_clean(struct be_adapter *adapter) ··· 2589 2581 be_cmd_q_destroy(adapter, &eqo->q, QTYPE_EQ); 2590 2582 napi_hash_del(&eqo->napi); 2591 2583 netif_napi_del(&eqo->napi); 2584 + free_cpumask_var(eqo->affinity_mask); 2592 2585 } 2593 - free_cpumask_var(eqo->affinity_mask); 2594 2586 be_queue_free(adapter, &eqo->q); 2595 2587 } 2596 2588 } ··· 2607 2599 2608 2600 for_all_evt_queues(adapter, eqo, i) { 2609 2601 int numa_node = dev_to_node(&adapter->pdev->dev); 2610 - if (!zalloc_cpumask_var(&eqo->affinity_mask, GFP_KERNEL)) 2611 - return -ENOMEM; 2612 - cpumask_set_cpu(cpumask_local_spread(i, numa_node), 2613 - eqo->affinity_mask); 2614 - netif_napi_add(adapter->netdev, &eqo->napi, be_poll, 2615 - BE_NAPI_WEIGHT); 2616 - napi_hash_add(&eqo->napi); 2602 + 2617 2603 aic = &adapter->aic_obj[i]; 2618 2604 eqo->adapter = adapter; 2619 2605 eqo->idx = i; ··· 2623 2621 rc = be_cmd_eq_create(adapter, eqo); 2624 2622 if (rc) 2625 2623 return rc; 2624 + 2625 + if (!zalloc_cpumask_var(&eqo->affinity_mask, GFP_KERNEL)) 2626 + return -ENOMEM; 2627 + cpumask_set_cpu(cpumask_local_spread(i, numa_node), 2628 + eqo->affinity_mask); 2629 + netif_napi_add(adapter->netdev, &eqo->napi, be_poll, 2630 + BE_NAPI_WEIGHT); 2631 + napi_hash_add(&eqo->napi); 2626 2632 } 2627 2633 return 0; 2628 2634 } ··· 3369 3359 for_all_rx_queues(adapter, rxo, i) { 3370 3360 q = &rxo->q; 3371 3361 if (q->created) { 3362 + /* If RXQs are destroyed while in an "out of buffer" 3363 + * state, there is a possibility of an HW stall on 3364 + * Lancer. So, post 64 buffers to each queue to relieve 3365 + * the "out of buffer" condition. 3366 + * Make sure there's space in the RXQ before posting. 3367 + */ 3368 + if (lancer_chip(adapter)) { 3369 + be_rx_cq_clean(rxo); 3370 + if (atomic_read(&q->used) == 0) 3371 + be_post_rx_frags(rxo, GFP_KERNEL, 3372 + MAX_RX_POST); 3373 + } 3374 + 3372 3375 be_cmd_rxq_destroy(adapter, q); 3373 3376 be_rx_cq_clean(rxo); 3377 + be_rxq_clean(rxo); 3374 3378 } 3375 3379 be_queue_free(adapter, q); 3380 + } 3381 + } 3382 + 3383 + static void be_disable_if_filters(struct be_adapter *adapter) 3384 + { 3385 + be_cmd_pmac_del(adapter, adapter->if_handle, 3386 + adapter->pmac_id[0], 0); 3387 + 3388 + be_clear_uc_list(adapter); 3389 + 3390 + /* The IFACE flags are enabled in the open path and cleared 3391 + * in the close path. When a VF gets detached from the host and 3392 + * assigned to a VM the following happens: 3393 + * - VF's IFACE flags get cleared in the detach path 3394 + * - IFACE create is issued by the VF in the attach path 3395 + * Due to a bug in the BE3/Skyhawk-R FW 3396 + * (Lancer FW doesn't have the bug), the IFACE capability flags 3397 + * specified along with the IFACE create cmd issued by a VF are not 3398 + * honoured by FW. As a consequence, if a *new* driver 3399 + * (that enables/disables IFACE flags in open/close) 3400 + * is loaded in the host and an *old* driver is * used by a VM/VF, 3401 + * the IFACE gets created *without* the needed flags. 3402 + * To avoid this, disable RX-filter flags only for Lancer. 3403 + */ 3404 + if (lancer_chip(adapter)) { 3405 + be_cmd_rx_filter(adapter, BE_IF_ALL_FILT_FLAGS, OFF); 3406 + adapter->if_flags &= ~BE_IF_ALL_FILT_FLAGS; 3376 3407 } 3377 3408 } 3378 3409 ··· 3428 3377 */ 3429 3378 if (!(adapter->flags & BE_FLAGS_SETUP_DONE)) 3430 3379 return 0; 3380 + 3381 + be_disable_if_filters(adapter); 3431 3382 3432 3383 be_roce_dev_close(adapter); 3433 3384 ··· 3450 3397 be_tx_compl_clean(adapter); 3451 3398 3452 3399 be_rx_qs_destroy(adapter); 3453 - be_clear_uc_list(adapter); 3454 3400 3455 3401 for_all_evt_queues(adapter, eqo, i) { 3456 3402 if (msix_enabled(adapter)) ··· 3534 3482 return 0; 3535 3483 } 3536 3484 3485 + static int be_enable_if_filters(struct be_adapter *adapter) 3486 + { 3487 + int status; 3488 + 3489 + status = be_cmd_rx_filter(adapter, BE_IF_EN_FLAGS, ON); 3490 + if (status) 3491 + return status; 3492 + 3493 + /* For BE3 VFs, the PF programs the initial MAC address */ 3494 + if (!(BEx_chip(adapter) && be_virtfn(adapter))) { 3495 + status = be_cmd_pmac_add(adapter, adapter->netdev->dev_addr, 3496 + adapter->if_handle, 3497 + &adapter->pmac_id[0], 0); 3498 + if (status) 3499 + return status; 3500 + } 3501 + 3502 + if (adapter->vlans_added) 3503 + be_vid_config(adapter); 3504 + 3505 + be_set_rx_mode(adapter->netdev); 3506 + 3507 + return 0; 3508 + } 3509 + 3537 3510 static int be_open(struct net_device *netdev) 3538 3511 { 3539 3512 struct be_adapter *adapter = netdev_priv(netdev); ··· 3569 3492 int status, i; 3570 3493 3571 3494 status = be_rx_qs_create(adapter); 3495 + if (status) 3496 + goto err; 3497 + 3498 + status = be_enable_if_filters(adapter); 3572 3499 if (status) 3573 3500 goto err; 3574 3501 ··· 3766 3685 } 3767 3686 } 3768 3687 3769 - static void be_mac_clear(struct be_adapter *adapter) 3770 - { 3771 - if (adapter->pmac_id) { 3772 - be_cmd_pmac_del(adapter, adapter->if_handle, 3773 - adapter->pmac_id[0], 0); 3774 - kfree(adapter->pmac_id); 3775 - adapter->pmac_id = NULL; 3776 - } 3777 - } 3778 - 3779 3688 #ifdef CONFIG_BE2NET_VXLAN 3780 3689 static void be_disable_vxlan_offloads(struct be_adapter *adapter) 3781 3690 { ··· 3840 3769 #ifdef CONFIG_BE2NET_VXLAN 3841 3770 be_disable_vxlan_offloads(adapter); 3842 3771 #endif 3843 - /* delete the primary mac along with the uc-mac list */ 3844 - be_mac_clear(adapter); 3772 + kfree(adapter->pmac_id); 3773 + adapter->pmac_id = NULL; 3845 3774 3846 3775 be_cmd_if_destroy(adapter, adapter->if_handle, 0); 3847 3776 ··· 3852 3781 return 0; 3853 3782 } 3854 3783 3855 - static int be_if_create(struct be_adapter *adapter, u32 *if_handle, 3856 - u32 cap_flags, u32 vf) 3857 - { 3858 - u32 en_flags; 3859 - 3860 - en_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | 3861 - BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_PASS_L3L4_ERRORS | 3862 - BE_IF_FLAGS_RSS | BE_IF_FLAGS_DEFQ_RSS; 3863 - 3864 - en_flags &= cap_flags; 3865 - 3866 - return be_cmd_if_create(adapter, cap_flags, en_flags, if_handle, vf); 3867 - } 3868 - 3869 3784 static int be_vfs_if_create(struct be_adapter *adapter) 3870 3785 { 3871 3786 struct be_resources res = {0}; 3787 + u32 cap_flags, en_flags, vf; 3872 3788 struct be_vf_cfg *vf_cfg; 3873 - u32 cap_flags, vf; 3874 3789 int status; 3875 3790 3876 3791 /* If a FW profile exists, then cap_flags are updated */ ··· 3877 3820 } 3878 3821 } 3879 3822 3880 - status = be_if_create(adapter, &vf_cfg->if_handle, 3881 - cap_flags, vf + 1); 3823 + en_flags = cap_flags & (BE_IF_FLAGS_UNTAGGED | 3824 + BE_IF_FLAGS_BROADCAST | 3825 + BE_IF_FLAGS_MULTICAST | 3826 + BE_IF_FLAGS_PASS_L3L4_ERRORS); 3827 + status = be_cmd_if_create(adapter, cap_flags, en_flags, 3828 + &vf_cfg->if_handle, vf + 1); 3882 3829 if (status) 3883 3830 return status; 3884 3831 } ··· 4254 4193 4255 4194 memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN); 4256 4195 memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN); 4257 - } else { 4258 - /* Maybe the HW was reset; dev_addr must be re-programmed */ 4259 - memcpy(mac, adapter->netdev->dev_addr, ETH_ALEN); 4260 4196 } 4261 4197 4262 - /* For BE3-R VFs, the PF programs the initial MAC address */ 4263 - if (!(BEx_chip(adapter) && be_virtfn(adapter))) 4264 - be_cmd_pmac_add(adapter, mac, adapter->if_handle, 4265 - &adapter->pmac_id[0], 0); 4266 4198 return 0; 4267 4199 } 4268 4200 ··· 4395 4341 static int be_setup(struct be_adapter *adapter) 4396 4342 { 4397 4343 struct device *dev = &adapter->pdev->dev; 4344 + u32 en_flags; 4398 4345 int status; 4399 4346 4400 4347 status = be_func_init(adapter); ··· 4418 4363 if (status) 4419 4364 goto err; 4420 4365 4421 - status = be_if_create(adapter, &adapter->if_handle, 4422 - be_if_cap_flags(adapter), 0); 4366 + /* will enable all the needed filter flags in be_open() */ 4367 + en_flags = BE_IF_FLAGS_RSS | BE_IF_FLAGS_DEFQ_RSS; 4368 + en_flags = en_flags & be_if_cap_flags(adapter); 4369 + status = be_cmd_if_create(adapter, be_if_cap_flags(adapter), en_flags, 4370 + &adapter->if_handle, 0); 4423 4371 if (status) 4424 4372 goto err; 4425 4373 ··· 4447 4389 adapter->fw_ver); 4448 4390 dev_err(dev, "Please upgrade firmware to version >= 4.0\n"); 4449 4391 } 4450 - 4451 - if (adapter->vlans_added) 4452 - be_vid_config(adapter); 4453 - 4454 - be_set_rx_mode(adapter->netdev); 4455 4392 4456 4393 status = be_cmd_set_flow_control(adapter, adapter->tx_fc, 4457 4394 adapter->rx_fc);
+1
drivers/net/ethernet/freescale/fec_main.c
··· 3438 3438 3439 3439 pm_runtime_set_autosuspend_delay(&pdev->dev, FEC_MDIO_PM_TIMEOUT); 3440 3440 pm_runtime_use_autosuspend(&pdev->dev); 3441 + pm_runtime_get_noresume(&pdev->dev); 3441 3442 pm_runtime_set_active(&pdev->dev); 3442 3443 pm_runtime_enable(&pdev->dev); 3443 3444
+2 -1
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
··· 586 586 frag = skb_shinfo(skb)->frags; 587 587 while (nr_frags) { 588 588 CBDC_SC(bdp, 589 - BD_ENET_TX_STATS | BD_ENET_TX_LAST | BD_ENET_TX_TC); 589 + BD_ENET_TX_STATS | BD_ENET_TX_INTR | BD_ENET_TX_LAST | 590 + BD_ENET_TX_TC); 590 591 CBDS_SC(bdp, BD_ENET_TX_READY); 591 592 592 593 if ((CBDR_SC(bdp) & BD_ENET_TX_WRAP) == 0)
+1 -1
drivers/net/ethernet/freescale/fs_enet/mac-fec.c
··· 110 110 } 111 111 112 112 #define FEC_NAPI_RX_EVENT_MSK (FEC_ENET_RXF | FEC_ENET_RXB) 113 - #define FEC_NAPI_TX_EVENT_MSK (FEC_ENET_TXF | FEC_ENET_TXB) 113 + #define FEC_NAPI_TX_EVENT_MSK (FEC_ENET_TXF) 114 114 #define FEC_RX_EVENT (FEC_ENET_RXF) 115 115 #define FEC_TX_EVENT (FEC_ENET_TXF) 116 116 #define FEC_ERR_EVENT_MSK (FEC_ENET_HBERR | FEC_ENET_BABR | \
+4 -341
drivers/net/ethernet/freescale/gianfar_ethtool.c
··· 902 902 return 0; 903 903 } 904 904 905 - static int gfar_comp_asc(const void *a, const void *b) 906 - { 907 - return memcmp(a, b, 4); 908 - } 909 - 910 - static int gfar_comp_desc(const void *a, const void *b) 911 - { 912 - return -memcmp(a, b, 4); 913 - } 914 - 915 - static void gfar_swap(void *a, void *b, int size) 916 - { 917 - u32 *_a = a; 918 - u32 *_b = b; 919 - 920 - swap(_a[0], _b[0]); 921 - swap(_a[1], _b[1]); 922 - swap(_a[2], _b[2]); 923 - swap(_a[3], _b[3]); 924 - } 925 - 926 905 /* Write a mask to filer cache */ 927 906 static void gfar_set_mask(u32 mask, struct filer_table *tab) 928 907 { ··· 1251 1272 return 0; 1252 1273 } 1253 1274 1254 - /* Copy size filer entries */ 1255 - static void gfar_copy_filer_entries(struct gfar_filer_entry dst[0], 1256 - struct gfar_filer_entry src[0], s32 size) 1257 - { 1258 - while (size > 0) { 1259 - size--; 1260 - dst[size].ctrl = src[size].ctrl; 1261 - dst[size].prop = src[size].prop; 1262 - } 1263 - } 1264 - 1265 - /* Delete the contents of the filer-table between start and end 1266 - * and collapse them 1267 - */ 1268 - static int gfar_trim_filer_entries(u32 begin, u32 end, struct filer_table *tab) 1269 - { 1270 - int length; 1271 - 1272 - if (end > MAX_FILER_CACHE_IDX || end < begin) 1273 - return -EINVAL; 1274 - 1275 - end++; 1276 - length = end - begin; 1277 - 1278 - /* Copy */ 1279 - while (end < tab->index) { 1280 - tab->fe[begin].ctrl = tab->fe[end].ctrl; 1281 - tab->fe[begin++].prop = tab->fe[end++].prop; 1282 - 1283 - } 1284 - /* Fill up with don't cares */ 1285 - while (begin < tab->index) { 1286 - tab->fe[begin].ctrl = 0x60; 1287 - tab->fe[begin].prop = 0xFFFFFFFF; 1288 - begin++; 1289 - } 1290 - 1291 - tab->index -= length; 1292 - return 0; 1293 - } 1294 - 1295 - /* Make space on the wanted location */ 1296 - static int gfar_expand_filer_entries(u32 begin, u32 length, 1297 - struct filer_table *tab) 1298 - { 1299 - if (length == 0 || length + tab->index > MAX_FILER_CACHE_IDX || 1300 - begin > MAX_FILER_CACHE_IDX) 1301 - return -EINVAL; 1302 - 1303 - gfar_copy_filer_entries(&(tab->fe[begin + length]), &(tab->fe[begin]), 1304 - tab->index - length + 1); 1305 - 1306 - tab->index += length; 1307 - return 0; 1308 - } 1309 - 1310 - static int gfar_get_next_cluster_start(int start, struct filer_table *tab) 1311 - { 1312 - for (; (start < tab->index) && (start < MAX_FILER_CACHE_IDX - 1); 1313 - start++) { 1314 - if ((tab->fe[start].ctrl & (RQFCR_AND | RQFCR_CLE)) == 1315 - (RQFCR_AND | RQFCR_CLE)) 1316 - return start; 1317 - } 1318 - return -1; 1319 - } 1320 - 1321 - static int gfar_get_next_cluster_end(int start, struct filer_table *tab) 1322 - { 1323 - for (; (start < tab->index) && (start < MAX_FILER_CACHE_IDX - 1); 1324 - start++) { 1325 - if ((tab->fe[start].ctrl & (RQFCR_AND | RQFCR_CLE)) == 1326 - (RQFCR_CLE)) 1327 - return start; 1328 - } 1329 - return -1; 1330 - } 1331 - 1332 - /* Uses hardwares clustering option to reduce 1333 - * the number of filer table entries 1334 - */ 1335 - static void gfar_cluster_filer(struct filer_table *tab) 1336 - { 1337 - s32 i = -1, j, iend, jend; 1338 - 1339 - while ((i = gfar_get_next_cluster_start(++i, tab)) != -1) { 1340 - j = i; 1341 - while ((j = gfar_get_next_cluster_start(++j, tab)) != -1) { 1342 - /* The cluster entries self and the previous one 1343 - * (a mask) must be identical! 1344 - */ 1345 - if (tab->fe[i].ctrl != tab->fe[j].ctrl) 1346 - break; 1347 - if (tab->fe[i].prop != tab->fe[j].prop) 1348 - break; 1349 - if (tab->fe[i - 1].ctrl != tab->fe[j - 1].ctrl) 1350 - break; 1351 - if (tab->fe[i - 1].prop != tab->fe[j - 1].prop) 1352 - break; 1353 - iend = gfar_get_next_cluster_end(i, tab); 1354 - jend = gfar_get_next_cluster_end(j, tab); 1355 - if (jend == -1 || iend == -1) 1356 - break; 1357 - 1358 - /* First we make some free space, where our cluster 1359 - * element should be. Then we copy it there and finally 1360 - * delete in from its old location. 1361 - */ 1362 - if (gfar_expand_filer_entries(iend, (jend - j), tab) == 1363 - -EINVAL) 1364 - break; 1365 - 1366 - gfar_copy_filer_entries(&(tab->fe[iend + 1]), 1367 - &(tab->fe[jend + 1]), jend - j); 1368 - 1369 - if (gfar_trim_filer_entries(jend - 1, 1370 - jend + (jend - j), 1371 - tab) == -EINVAL) 1372 - return; 1373 - 1374 - /* Mask out cluster bit */ 1375 - tab->fe[iend].ctrl &= ~(RQFCR_CLE); 1376 - } 1377 - } 1378 - } 1379 - 1380 - /* Swaps the masked bits of a1<>a2 and b1<>b2 */ 1381 - static void gfar_swap_bits(struct gfar_filer_entry *a1, 1382 - struct gfar_filer_entry *a2, 1383 - struct gfar_filer_entry *b1, 1384 - struct gfar_filer_entry *b2, u32 mask) 1385 - { 1386 - u32 temp[4]; 1387 - temp[0] = a1->ctrl & mask; 1388 - temp[1] = a2->ctrl & mask; 1389 - temp[2] = b1->ctrl & mask; 1390 - temp[3] = b2->ctrl & mask; 1391 - 1392 - a1->ctrl &= ~mask; 1393 - a2->ctrl &= ~mask; 1394 - b1->ctrl &= ~mask; 1395 - b2->ctrl &= ~mask; 1396 - 1397 - a1->ctrl |= temp[1]; 1398 - a2->ctrl |= temp[0]; 1399 - b1->ctrl |= temp[3]; 1400 - b2->ctrl |= temp[2]; 1401 - } 1402 - 1403 - /* Generate a list consisting of masks values with their start and 1404 - * end of validity and block as indicator for parts belonging 1405 - * together (glued by ANDs) in mask_table 1406 - */ 1407 - static u32 gfar_generate_mask_table(struct gfar_mask_entry *mask_table, 1408 - struct filer_table *tab) 1409 - { 1410 - u32 i, and_index = 0, block_index = 1; 1411 - 1412 - for (i = 0; i < tab->index; i++) { 1413 - 1414 - /* LSByte of control = 0 sets a mask */ 1415 - if (!(tab->fe[i].ctrl & 0xF)) { 1416 - mask_table[and_index].mask = tab->fe[i].prop; 1417 - mask_table[and_index].start = i; 1418 - mask_table[and_index].block = block_index; 1419 - if (and_index >= 1) 1420 - mask_table[and_index - 1].end = i - 1; 1421 - and_index++; 1422 - } 1423 - /* cluster starts and ends will be separated because they should 1424 - * hold their position 1425 - */ 1426 - if (tab->fe[i].ctrl & RQFCR_CLE) 1427 - block_index++; 1428 - /* A not set AND indicates the end of a depended block */ 1429 - if (!(tab->fe[i].ctrl & RQFCR_AND)) 1430 - block_index++; 1431 - } 1432 - 1433 - mask_table[and_index - 1].end = i - 1; 1434 - 1435 - return and_index; 1436 - } 1437 - 1438 - /* Sorts the entries of mask_table by the values of the masks. 1439 - * Important: The 0xFF80 flags of the first and last entry of a 1440 - * block must hold their position (which queue, CLusterEnable, ReJEct, 1441 - * AND) 1442 - */ 1443 - static void gfar_sort_mask_table(struct gfar_mask_entry *mask_table, 1444 - struct filer_table *temp_table, u32 and_index) 1445 - { 1446 - /* Pointer to compare function (_asc or _desc) */ 1447 - int (*gfar_comp)(const void *, const void *); 1448 - 1449 - u32 i, size = 0, start = 0, prev = 1; 1450 - u32 old_first, old_last, new_first, new_last; 1451 - 1452 - gfar_comp = &gfar_comp_desc; 1453 - 1454 - for (i = 0; i < and_index; i++) { 1455 - if (prev != mask_table[i].block) { 1456 - old_first = mask_table[start].start + 1; 1457 - old_last = mask_table[i - 1].end; 1458 - sort(mask_table + start, size, 1459 - sizeof(struct gfar_mask_entry), 1460 - gfar_comp, &gfar_swap); 1461 - 1462 - /* Toggle order for every block. This makes the 1463 - * thing more efficient! 1464 - */ 1465 - if (gfar_comp == gfar_comp_desc) 1466 - gfar_comp = &gfar_comp_asc; 1467 - else 1468 - gfar_comp = &gfar_comp_desc; 1469 - 1470 - new_first = mask_table[start].start + 1; 1471 - new_last = mask_table[i - 1].end; 1472 - 1473 - gfar_swap_bits(&temp_table->fe[new_first], 1474 - &temp_table->fe[old_first], 1475 - &temp_table->fe[new_last], 1476 - &temp_table->fe[old_last], 1477 - RQFCR_QUEUE | RQFCR_CLE | 1478 - RQFCR_RJE | RQFCR_AND); 1479 - 1480 - start = i; 1481 - size = 0; 1482 - } 1483 - size++; 1484 - prev = mask_table[i].block; 1485 - } 1486 - } 1487 - 1488 - /* Reduces the number of masks needed in the filer table to save entries 1489 - * This is done by sorting the masks of a depended block. A depended block is 1490 - * identified by gluing ANDs or CLE. The sorting order toggles after every 1491 - * block. Of course entries in scope of a mask must change their location with 1492 - * it. 1493 - */ 1494 - static int gfar_optimize_filer_masks(struct filer_table *tab) 1495 - { 1496 - struct filer_table *temp_table; 1497 - struct gfar_mask_entry *mask_table; 1498 - 1499 - u32 and_index = 0, previous_mask = 0, i = 0, j = 0, size = 0; 1500 - s32 ret = 0; 1501 - 1502 - /* We need a copy of the filer table because 1503 - * we want to change its order 1504 - */ 1505 - temp_table = kmemdup(tab, sizeof(*temp_table), GFP_KERNEL); 1506 - if (temp_table == NULL) 1507 - return -ENOMEM; 1508 - 1509 - mask_table = kcalloc(MAX_FILER_CACHE_IDX / 2 + 1, 1510 - sizeof(struct gfar_mask_entry), GFP_KERNEL); 1511 - 1512 - if (mask_table == NULL) { 1513 - ret = -ENOMEM; 1514 - goto end; 1515 - } 1516 - 1517 - and_index = gfar_generate_mask_table(mask_table, tab); 1518 - 1519 - gfar_sort_mask_table(mask_table, temp_table, and_index); 1520 - 1521 - /* Now we can copy the data from our duplicated filer table to 1522 - * the real one in the order the mask table says 1523 - */ 1524 - for (i = 0; i < and_index; i++) { 1525 - size = mask_table[i].end - mask_table[i].start + 1; 1526 - gfar_copy_filer_entries(&(tab->fe[j]), 1527 - &(temp_table->fe[mask_table[i].start]), size); 1528 - j += size; 1529 - } 1530 - 1531 - /* And finally we just have to check for duplicated masks and drop the 1532 - * second ones 1533 - */ 1534 - for (i = 0; i < tab->index && i < MAX_FILER_CACHE_IDX; i++) { 1535 - if (tab->fe[i].ctrl == 0x80) { 1536 - previous_mask = i++; 1537 - break; 1538 - } 1539 - } 1540 - for (; i < tab->index && i < MAX_FILER_CACHE_IDX; i++) { 1541 - if (tab->fe[i].ctrl == 0x80) { 1542 - if (tab->fe[i].prop == tab->fe[previous_mask].prop) { 1543 - /* Two identical ones found! 1544 - * So drop the second one! 1545 - */ 1546 - gfar_trim_filer_entries(i, i, tab); 1547 - } else 1548 - /* Not identical! */ 1549 - previous_mask = i; 1550 - } 1551 - } 1552 - 1553 - kfree(mask_table); 1554 - end: kfree(temp_table); 1555 - return ret; 1556 - } 1557 - 1558 1275 /* Write the bit-pattern from software's buffer to hardware registers */ 1559 1276 static int gfar_write_filer_table(struct gfar_private *priv, 1560 1277 struct filer_table *tab) ··· 1260 1585 return -EBUSY; 1261 1586 1262 1587 /* Fill regular entries */ 1263 - for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].prop); 1264 - i++) 1588 + for (; i < MAX_FILER_IDX && (tab->fe[i].ctrl | tab->fe[i].prop); i++) 1265 1589 gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop); 1266 1590 /* Fill the rest with fall-troughs */ 1267 - for (; i < MAX_FILER_IDX - 1; i++) 1591 + for (; i < MAX_FILER_IDX; i++) 1268 1592 gfar_write_filer(priv, i, 0x60, 0xFFFFFFFF); 1269 1593 /* Last entry must be default accept 1270 1594 * because that's what people expect ··· 1297 1623 { 1298 1624 struct ethtool_flow_spec_container *j; 1299 1625 struct filer_table *tab; 1300 - s32 i = 0; 1301 1626 s32 ret = 0; 1302 1627 1303 1628 /* So index is set to zero, too! */ ··· 1320 1647 goto end; 1321 1648 } 1322 1649 } 1323 - 1324 - i = tab->index; 1325 - 1326 - /* Optimizations to save entries */ 1327 - gfar_cluster_filer(tab); 1328 - gfar_optimize_filer_masks(tab); 1329 - 1330 - pr_debug("\tSummary:\n" 1331 - "\tData on hardware: %d\n" 1332 - "\tCompression rate: %d%%\n", 1333 - tab->index, 100 - (100 * tab->index) / i); 1334 1650 1335 1651 /* Write everything to hardware */ 1336 1652 ret = gfar_write_filer_table(priv, tab); ··· 1386 1724 } 1387 1725 1388 1726 process: 1727 + priv->rx_list.count++; 1389 1728 ret = gfar_process_filer_changes(priv); 1390 1729 if (ret) 1391 1730 goto clean_list; 1392 - priv->rx_list.count++; 1393 1731 return ret; 1394 1732 1395 1733 clean_list: 1734 + priv->rx_list.count--; 1396 1735 list_del(&temp->list); 1397 1736 clean_mem: 1398 1737 kfree(temp);
+167 -77
drivers/net/ethernet/marvell/mvpp2.c
··· 27 27 #include <linux/of_address.h> 28 28 #include <linux/phy.h> 29 29 #include <linux/clk.h> 30 + #include <linux/hrtimer.h> 31 + #include <linux/ktime.h> 30 32 #include <uapi/linux/ppp_defs.h> 31 33 #include <net/ip.h> 32 34 #include <net/ipv6.h> ··· 301 299 302 300 /* Coalescing */ 303 301 #define MVPP2_TXDONE_COAL_PKTS_THRESH 15 302 + #define MVPP2_TXDONE_HRTIMER_PERIOD_NS 1000000UL 304 303 #define MVPP2_RX_COAL_PKTS 32 305 304 #define MVPP2_RX_COAL_USEC 100 306 305 ··· 663 660 u64 tx_bytes; 664 661 }; 665 662 663 + /* Per-CPU port control */ 664 + struct mvpp2_port_pcpu { 665 + struct hrtimer tx_done_timer; 666 + bool timer_scheduled; 667 + /* Tasklet for egress finalization */ 668 + struct tasklet_struct tx_done_tasklet; 669 + }; 670 + 666 671 struct mvpp2_port { 667 672 u8 id; 668 673 ··· 689 678 690 679 u32 pending_cause_rx; 691 680 struct napi_struct napi; 681 + 682 + /* Per-CPU port control */ 683 + struct mvpp2_port_pcpu __percpu *pcpu; 692 684 693 685 /* Flags */ 694 686 unsigned long flags; ··· 789 775 790 776 /* Array of transmitted skb */ 791 777 struct sk_buff **tx_skb; 778 + 779 + /* Array of transmitted buffers' physical addresses */ 780 + dma_addr_t *tx_buffs; 792 781 793 782 /* Index of last TX DMA descriptor that was inserted */ 794 783 int txq_put_index; ··· 930 913 /* Occupied buffers indicator */ 931 914 atomic_t in_use; 932 915 int in_use_thresh; 933 - 934 - spinlock_t lock; 935 916 }; 936 917 937 918 struct mvpp2_buff_hdr { ··· 978 963 } 979 964 980 965 static void mvpp2_txq_inc_put(struct mvpp2_txq_pcpu *txq_pcpu, 981 - struct sk_buff *skb) 966 + struct sk_buff *skb, 967 + struct mvpp2_tx_desc *tx_desc) 982 968 { 983 969 txq_pcpu->tx_skb[txq_pcpu->txq_put_index] = skb; 970 + if (skb) 971 + txq_pcpu->tx_buffs[txq_pcpu->txq_put_index] = 972 + tx_desc->buf_phys_addr; 984 973 txq_pcpu->txq_put_index++; 985 974 if (txq_pcpu->txq_put_index == txq_pcpu->size) 986 975 txq_pcpu->txq_put_index = 0; ··· 3395 3376 bm_pool->pkt_size = 0; 3396 3377 bm_pool->buf_num = 0; 3397 3378 atomic_set(&bm_pool->in_use, 0); 3398 - spin_lock_init(&bm_pool->lock); 3399 3379 3400 3380 return 0; 3401 3381 } ··· 3665 3647 mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, 3666 3648 int pkt_size) 3667 3649 { 3668 - unsigned long flags = 0; 3669 3650 struct mvpp2_bm_pool *new_pool = &port->priv->bm_pools[pool]; 3670 3651 int num; 3671 3652 ··· 3672 3655 netdev_err(port->dev, "mixing pool types is forbidden\n"); 3673 3656 return NULL; 3674 3657 } 3675 - 3676 - spin_lock_irqsave(&new_pool->lock, flags); 3677 3658 3678 3659 if (new_pool->type == MVPP2_BM_FREE) 3679 3660 new_pool->type = type; ··· 3701 3686 if (num != pkts_num) { 3702 3687 WARN(1, "pool %d: %d of %d allocated\n", 3703 3688 new_pool->id, num, pkts_num); 3704 - /* We need to undo the bufs_add() allocations */ 3705 - spin_unlock_irqrestore(&new_pool->lock, flags); 3706 3689 return NULL; 3707 3690 } 3708 3691 } ··· 3708 3695 mvpp2_bm_pool_bufsize_set(port->priv, new_pool, 3709 3696 MVPP2_RX_BUF_SIZE(new_pool->pkt_size)); 3710 3697 3711 - spin_unlock_irqrestore(&new_pool->lock, flags); 3712 - 3713 3698 return new_pool; 3714 3699 } 3715 3700 3716 3701 /* Initialize pools for swf */ 3717 3702 static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port) 3718 3703 { 3719 - unsigned long flags = 0; 3720 3704 int rxq; 3721 3705 3722 3706 if (!port->pool_long) { ··· 3724 3714 if (!port->pool_long) 3725 3715 return -ENOMEM; 3726 3716 3727 - spin_lock_irqsave(&port->pool_long->lock, flags); 3728 3717 port->pool_long->port_map |= (1 << port->id); 3729 - spin_unlock_irqrestore(&port->pool_long->lock, flags); 3730 3718 3731 3719 for (rxq = 0; rxq < rxq_number; rxq++) 3732 3720 mvpp2_rxq_long_pool_set(port, rxq, port->pool_long->id); ··· 3738 3730 if (!port->pool_short) 3739 3731 return -ENOMEM; 3740 3732 3741 - spin_lock_irqsave(&port->pool_short->lock, flags); 3742 3733 port->pool_short->port_map |= (1 << port->id); 3743 - spin_unlock_irqrestore(&port->pool_short->lock, flags); 3744 3734 3745 3735 for (rxq = 0; rxq < rxq_number; rxq++) 3746 3736 mvpp2_rxq_short_pool_set(port, rxq, ··· 3812 3806 3813 3807 mvpp2_write(port->priv, MVPP2_ISR_RX_TX_MASK_REG(port->id), 3814 3808 (MVPP2_CAUSE_MISC_SUM_MASK | 3815 - MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK | 3816 3809 MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK)); 3817 3810 } 3818 3811 ··· 4387 4382 rxq->time_coal = usec; 4388 4383 } 4389 4384 4390 - /* Set threshold for TX_DONE pkts coalescing */ 4391 - static void mvpp2_tx_done_pkts_coal_set(void *arg) 4392 - { 4393 - struct mvpp2_port *port = arg; 4394 - int queue; 4395 - u32 val; 4396 - 4397 - for (queue = 0; queue < txq_number; queue++) { 4398 - struct mvpp2_tx_queue *txq = port->txqs[queue]; 4399 - 4400 - val = (txq->done_pkts_coal << MVPP2_TRANSMITTED_THRESH_OFFSET) & 4401 - MVPP2_TRANSMITTED_THRESH_MASK; 4402 - mvpp2_write(port->priv, MVPP2_TXQ_NUM_REG, txq->id); 4403 - mvpp2_write(port->priv, MVPP2_TXQ_THRESH_REG, val); 4404 - } 4405 - } 4406 - 4407 4385 /* Free Tx queue skbuffs */ 4408 4386 static void mvpp2_txq_bufs_free(struct mvpp2_port *port, 4409 4387 struct mvpp2_tx_queue *txq, ··· 4395 4407 int i; 4396 4408 4397 4409 for (i = 0; i < num; i++) { 4398 - struct mvpp2_tx_desc *tx_desc = txq->descs + 4399 - txq_pcpu->txq_get_index; 4410 + dma_addr_t buf_phys_addr = 4411 + txq_pcpu->tx_buffs[txq_pcpu->txq_get_index]; 4400 4412 struct sk_buff *skb = txq_pcpu->tx_skb[txq_pcpu->txq_get_index]; 4401 4413 4402 4414 mvpp2_txq_inc_get(txq_pcpu); ··· 4404 4416 if (!skb) 4405 4417 continue; 4406 4418 4407 - dma_unmap_single(port->dev->dev.parent, tx_desc->buf_phys_addr, 4408 - tx_desc->data_size, DMA_TO_DEVICE); 4419 + dma_unmap_single(port->dev->dev.parent, buf_phys_addr, 4420 + skb_headlen(skb), DMA_TO_DEVICE); 4409 4421 dev_kfree_skb_any(skb); 4410 4422 } 4411 4423 } ··· 4421 4433 static inline struct mvpp2_tx_queue *mvpp2_get_tx_queue(struct mvpp2_port *port, 4422 4434 u32 cause) 4423 4435 { 4424 - int queue = fls(cause >> 16) - 1; 4436 + int queue = fls(cause) - 1; 4425 4437 4426 4438 return port->txqs[queue]; 4427 4439 } ··· 4446 4458 if (netif_tx_queue_stopped(nq)) 4447 4459 if (txq_pcpu->size - txq_pcpu->count >= MAX_SKB_FRAGS + 1) 4448 4460 netif_tx_wake_queue(nq); 4461 + } 4462 + 4463 + static unsigned int mvpp2_tx_done(struct mvpp2_port *port, u32 cause) 4464 + { 4465 + struct mvpp2_tx_queue *txq; 4466 + struct mvpp2_txq_pcpu *txq_pcpu; 4467 + unsigned int tx_todo = 0; 4468 + 4469 + while (cause) { 4470 + txq = mvpp2_get_tx_queue(port, cause); 4471 + if (!txq) 4472 + break; 4473 + 4474 + txq_pcpu = this_cpu_ptr(txq->pcpu); 4475 + 4476 + if (txq_pcpu->count) { 4477 + mvpp2_txq_done(port, txq, txq_pcpu); 4478 + tx_todo += txq_pcpu->count; 4479 + } 4480 + 4481 + cause &= ~(1 << txq->log_id); 4482 + } 4483 + return tx_todo; 4449 4484 } 4450 4485 4451 4486 /* Rx/Tx queue initialization/cleanup methods */ ··· 4660 4649 txq_pcpu->tx_skb = kmalloc(txq_pcpu->size * 4661 4650 sizeof(*txq_pcpu->tx_skb), 4662 4651 GFP_KERNEL); 4663 - if (!txq_pcpu->tx_skb) { 4664 - dma_free_coherent(port->dev->dev.parent, 4665 - txq->size * MVPP2_DESC_ALIGNED_SIZE, 4666 - txq->descs, txq->descs_phys); 4667 - return -ENOMEM; 4668 - } 4652 + if (!txq_pcpu->tx_skb) 4653 + goto error; 4654 + 4655 + txq_pcpu->tx_buffs = kmalloc(txq_pcpu->size * 4656 + sizeof(dma_addr_t), GFP_KERNEL); 4657 + if (!txq_pcpu->tx_buffs) 4658 + goto error; 4669 4659 4670 4660 txq_pcpu->count = 0; 4671 4661 txq_pcpu->reserved_num = 0; ··· 4675 4663 } 4676 4664 4677 4665 return 0; 4666 + 4667 + error: 4668 + for_each_present_cpu(cpu) { 4669 + txq_pcpu = per_cpu_ptr(txq->pcpu, cpu); 4670 + kfree(txq_pcpu->tx_skb); 4671 + kfree(txq_pcpu->tx_buffs); 4672 + } 4673 + 4674 + dma_free_coherent(port->dev->dev.parent, 4675 + txq->size * MVPP2_DESC_ALIGNED_SIZE, 4676 + txq->descs, txq->descs_phys); 4677 + 4678 + return -ENOMEM; 4678 4679 } 4679 4680 4680 4681 /* Free allocated TXQ resources */ ··· 4700 4675 for_each_present_cpu(cpu) { 4701 4676 txq_pcpu = per_cpu_ptr(txq->pcpu, cpu); 4702 4677 kfree(txq_pcpu->tx_skb); 4678 + kfree(txq_pcpu->tx_buffs); 4703 4679 } 4704 4680 4705 4681 if (txq->descs) ··· 4831 4805 goto err_cleanup; 4832 4806 } 4833 4807 4834 - on_each_cpu(mvpp2_tx_done_pkts_coal_set, port, 1); 4835 4808 on_each_cpu(mvpp2_txq_sent_counter_clear, port, 1); 4836 4809 return 0; 4837 4810 ··· 4910 4885 } 4911 4886 phy_print_status(phydev); 4912 4887 } 4888 + } 4889 + 4890 + static void mvpp2_timer_set(struct mvpp2_port_pcpu *port_pcpu) 4891 + { 4892 + ktime_t interval; 4893 + 4894 + if (!port_pcpu->timer_scheduled) { 4895 + port_pcpu->timer_scheduled = true; 4896 + interval = ktime_set(0, MVPP2_TXDONE_HRTIMER_PERIOD_NS); 4897 + hrtimer_start(&port_pcpu->tx_done_timer, interval, 4898 + HRTIMER_MODE_REL_PINNED); 4899 + } 4900 + } 4901 + 4902 + static void mvpp2_tx_proc_cb(unsigned long data) 4903 + { 4904 + struct net_device *dev = (struct net_device *)data; 4905 + struct mvpp2_port *port = netdev_priv(dev); 4906 + struct mvpp2_port_pcpu *port_pcpu = this_cpu_ptr(port->pcpu); 4907 + unsigned int tx_todo, cause; 4908 + 4909 + if (!netif_running(dev)) 4910 + return; 4911 + port_pcpu->timer_scheduled = false; 4912 + 4913 + /* Process all the Tx queues */ 4914 + cause = (1 << txq_number) - 1; 4915 + tx_todo = mvpp2_tx_done(port, cause); 4916 + 4917 + /* Set the timer in case not all the packets were processed */ 4918 + if (tx_todo) 4919 + mvpp2_timer_set(port_pcpu); 4920 + } 4921 + 4922 + static enum hrtimer_restart mvpp2_hr_timer_cb(struct hrtimer *timer) 4923 + { 4924 + struct mvpp2_port_pcpu *port_pcpu = container_of(timer, 4925 + struct mvpp2_port_pcpu, 4926 + tx_done_timer); 4927 + 4928 + tasklet_schedule(&port_pcpu->tx_done_tasklet); 4929 + 4930 + return HRTIMER_NORESTART; 4913 4931 } 4914 4932 4915 4933 /* Main RX/TX processing routines */ ··· 5212 5144 if (i == (skb_shinfo(skb)->nr_frags - 1)) { 5213 5145 /* Last descriptor */ 5214 5146 tx_desc->command = MVPP2_TXD_L_DESC; 5215 - mvpp2_txq_inc_put(txq_pcpu, skb); 5147 + mvpp2_txq_inc_put(txq_pcpu, skb, tx_desc); 5216 5148 } else { 5217 5149 /* Descriptor in the middle: Not First, Not Last */ 5218 5150 tx_desc->command = 0; 5219 - mvpp2_txq_inc_put(txq_pcpu, NULL); 5151 + mvpp2_txq_inc_put(txq_pcpu, NULL, tx_desc); 5220 5152 } 5221 5153 } 5222 5154 ··· 5282 5214 /* First and Last descriptor */ 5283 5215 tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_L_DESC; 5284 5216 tx_desc->command = tx_cmd; 5285 - mvpp2_txq_inc_put(txq_pcpu, skb); 5217 + mvpp2_txq_inc_put(txq_pcpu, skb, tx_desc); 5286 5218 } else { 5287 5219 /* First but not Last */ 5288 5220 tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_PADDING_DISABLE; 5289 5221 tx_desc->command = tx_cmd; 5290 - mvpp2_txq_inc_put(txq_pcpu, NULL); 5222 + mvpp2_txq_inc_put(txq_pcpu, NULL, tx_desc); 5291 5223 5292 5224 /* Continue with other skb fragments */ 5293 5225 if (mvpp2_tx_frag_process(port, skb, aggr_txq, txq)) { ··· 5323 5255 dev_kfree_skb_any(skb); 5324 5256 } 5325 5257 5258 + /* Finalize TX processing */ 5259 + if (txq_pcpu->count >= txq->done_pkts_coal) 5260 + mvpp2_txq_done(port, txq, txq_pcpu); 5261 + 5262 + /* Set the timer in case not all frags were processed */ 5263 + if (txq_pcpu->count <= frags && txq_pcpu->count > 0) { 5264 + struct mvpp2_port_pcpu *port_pcpu = this_cpu_ptr(port->pcpu); 5265 + 5266 + mvpp2_timer_set(port_pcpu); 5267 + } 5268 + 5326 5269 return NETDEV_TX_OK; 5327 5270 } 5328 5271 ··· 5347 5268 netdev_err(dev, "tx fifo underrun error\n"); 5348 5269 } 5349 5270 5350 - static void mvpp2_txq_done_percpu(void *arg) 5271 + static int mvpp2_poll(struct napi_struct *napi, int budget) 5351 5272 { 5352 - struct mvpp2_port *port = arg; 5353 - u32 cause_rx_tx, cause_tx, cause_misc; 5273 + u32 cause_rx_tx, cause_rx, cause_misc; 5274 + int rx_done = 0; 5275 + struct mvpp2_port *port = netdev_priv(napi->dev); 5354 5276 5355 5277 /* Rx/Tx cause register 5356 5278 * ··· 5365 5285 */ 5366 5286 cause_rx_tx = mvpp2_read(port->priv, 5367 5287 MVPP2_ISR_RX_TX_CAUSE_REG(port->id)); 5368 - cause_tx = cause_rx_tx & MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK; 5288 + cause_rx_tx &= ~MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK; 5369 5289 cause_misc = cause_rx_tx & MVPP2_CAUSE_MISC_SUM_MASK; 5370 5290 5371 5291 if (cause_misc) { ··· 5377 5297 cause_rx_tx & ~MVPP2_CAUSE_MISC_SUM_MASK); 5378 5298 } 5379 5299 5380 - /* Release TX descriptors */ 5381 - if (cause_tx) { 5382 - struct mvpp2_tx_queue *txq = mvpp2_get_tx_queue(port, cause_tx); 5383 - struct mvpp2_txq_pcpu *txq_pcpu = this_cpu_ptr(txq->pcpu); 5384 - 5385 - if (txq_pcpu->count) 5386 - mvpp2_txq_done(port, txq, txq_pcpu); 5387 - } 5388 - } 5389 - 5390 - static int mvpp2_poll(struct napi_struct *napi, int budget) 5391 - { 5392 - u32 cause_rx_tx, cause_rx; 5393 - int rx_done = 0; 5394 - struct mvpp2_port *port = netdev_priv(napi->dev); 5395 - 5396 - on_each_cpu(mvpp2_txq_done_percpu, port, 1); 5397 - 5398 - cause_rx_tx = mvpp2_read(port->priv, 5399 - MVPP2_ISR_RX_TX_CAUSE_REG(port->id)); 5400 5300 cause_rx = cause_rx_tx & MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK; 5401 5301 5402 5302 /* Process RX packets */ ··· 5621 5561 static int mvpp2_stop(struct net_device *dev) 5622 5562 { 5623 5563 struct mvpp2_port *port = netdev_priv(dev); 5564 + struct mvpp2_port_pcpu *port_pcpu; 5565 + int cpu; 5624 5566 5625 5567 mvpp2_stop_dev(port); 5626 5568 mvpp2_phy_disconnect(port); ··· 5631 5569 on_each_cpu(mvpp2_interrupts_mask, port, 1); 5632 5570 5633 5571 free_irq(port->irq, port); 5572 + for_each_present_cpu(cpu) { 5573 + port_pcpu = per_cpu_ptr(port->pcpu, cpu); 5574 + 5575 + hrtimer_cancel(&port_pcpu->tx_done_timer); 5576 + port_pcpu->timer_scheduled = false; 5577 + tasklet_kill(&port_pcpu->tx_done_tasklet); 5578 + } 5634 5579 mvpp2_cleanup_rxqs(port); 5635 5580 mvpp2_cleanup_txqs(port); 5636 5581 ··· 5853 5784 txq->done_pkts_coal = c->tx_max_coalesced_frames; 5854 5785 } 5855 5786 5856 - on_each_cpu(mvpp2_tx_done_pkts_coal_set, port, 1); 5857 5787 return 0; 5858 5788 } 5859 5789 ··· 6103 6035 { 6104 6036 struct device_node *phy_node; 6105 6037 struct mvpp2_port *port; 6038 + struct mvpp2_port_pcpu *port_pcpu; 6106 6039 struct net_device *dev; 6107 6040 struct resource *res; 6108 6041 const char *dt_mac_addr; ··· 6113 6044 int features; 6114 6045 int phy_mode; 6115 6046 int priv_common_regs_num = 2; 6116 - int err, i; 6047 + int err, i, cpu; 6117 6048 6118 6049 dev = alloc_etherdev_mqs(sizeof(struct mvpp2_port), txq_number, 6119 6050 rxq_number); ··· 6204 6135 } 6205 6136 mvpp2_port_power_up(port); 6206 6137 6138 + port->pcpu = alloc_percpu(struct mvpp2_port_pcpu); 6139 + if (!port->pcpu) { 6140 + err = -ENOMEM; 6141 + goto err_free_txq_pcpu; 6142 + } 6143 + 6144 + for_each_present_cpu(cpu) { 6145 + port_pcpu = per_cpu_ptr(port->pcpu, cpu); 6146 + 6147 + hrtimer_init(&port_pcpu->tx_done_timer, CLOCK_MONOTONIC, 6148 + HRTIMER_MODE_REL_PINNED); 6149 + port_pcpu->tx_done_timer.function = mvpp2_hr_timer_cb; 6150 + port_pcpu->timer_scheduled = false; 6151 + 6152 + tasklet_init(&port_pcpu->tx_done_tasklet, mvpp2_tx_proc_cb, 6153 + (unsigned long)dev); 6154 + } 6155 + 6207 6156 netif_napi_add(dev, &port->napi, mvpp2_poll, NAPI_POLL_WEIGHT); 6208 6157 features = NETIF_F_SG | NETIF_F_IP_CSUM; 6209 6158 dev->features = features | NETIF_F_RXCSUM; ··· 6231 6144 err = register_netdev(dev); 6232 6145 if (err < 0) { 6233 6146 dev_err(&pdev->dev, "failed to register netdev\n"); 6234 - goto err_free_txq_pcpu; 6147 + goto err_free_port_pcpu; 6235 6148 } 6236 6149 netdev_info(dev, "Using %s mac address %pM\n", mac_from, dev->dev_addr); 6237 6150 ··· 6240 6153 priv->port_list[id] = port; 6241 6154 return 0; 6242 6155 6156 + err_free_port_pcpu: 6157 + free_percpu(port->pcpu); 6243 6158 err_free_txq_pcpu: 6244 6159 for (i = 0; i < txq_number; i++) 6245 6160 free_percpu(port->txqs[i]->pcpu); ··· 6260 6171 int i; 6261 6172 6262 6173 unregister_netdev(port->dev); 6174 + free_percpu(port->pcpu); 6263 6175 free_percpu(port->stats); 6264 6176 for (i = 0; i < txq_number; i++) 6265 6177 free_percpu(port->txqs[i]->pcpu);
+2
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 391 391 /* disable cmdif checksum */ 392 392 MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0); 393 393 394 + MLX5_SET(cmd_hca_cap, set_hca_cap, log_uar_page_sz, PAGE_SHIFT - 12); 395 + 394 396 err = set_caps(dev, set_ctx, set_sz); 395 397 396 398 query_ex:
+3 -1
drivers/net/ethernet/realtek/r8169.c
··· 4875 4875 case RTL_GIGA_MAC_VER_46: 4876 4876 case RTL_GIGA_MAC_VER_47: 4877 4877 case RTL_GIGA_MAC_VER_48: 4878 + RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF); 4879 + break; 4878 4880 case RTL_GIGA_MAC_VER_49: 4879 4881 case RTL_GIGA_MAC_VER_50: 4880 4882 case RTL_GIGA_MAC_VER_51: 4881 - RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF); 4883 + RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST | RX_EARLY_OFF); 4882 4884 break; 4883 4885 default: 4884 4886 RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST);
+1
drivers/net/ethernet/rocker/rocker.c
··· 4927 4927 rocker_port_ig_tbl(rocker_port, SWITCHDEV_TRANS_NONE, 4928 4928 ROCKER_OP_FLAG_REMOVE); 4929 4929 unregister_netdev(rocker_port->dev); 4930 + free_netdev(rocker_port->dev); 4930 4931 } 4931 4932 kfree(rocker->ports); 4932 4933 }
+2 -2
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
··· 42 42 #define NSS_COMMON_CLK_DIV_MASK 0x7f 43 43 44 44 #define NSS_COMMON_CLK_SRC_CTRL 0x14 45 - #define NSS_COMMON_CLK_SRC_CTRL_OFFSET(x) (1 << x) 45 + #define NSS_COMMON_CLK_SRC_CTRL_OFFSET(x) (x) 46 46 /* Mode is coded on 1 bit but is different depending on the MAC ID: 47 47 * MAC0: QSGMII=0 RGMII=1 48 48 * MAC1: QSGMII=0 SGMII=0 RGMII=1 ··· 308 308 309 309 /* Configure the clock src according to the mode */ 310 310 regmap_read(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, &val); 311 - val &= ~NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id); 311 + val &= ~(1 << NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id)); 312 312 switch (gmac->phy_mode) { 313 313 case PHY_INTERFACE_MODE_RGMII: 314 314 val |= NSS_COMMON_CLK_SRC_CTRL_RGMII(gmac->id) <<
-1
drivers/net/ethernet/ti/netcp.h
··· 85 85 struct list_head rxhook_list_head; 86 86 unsigned int rx_queue_id; 87 87 void *rx_fdq[KNAV_DMA_FDQ_PER_CHAN]; 88 - u32 rx_buffer_sizes[KNAV_DMA_FDQ_PER_CHAN]; 89 88 struct napi_struct rx_napi; 90 89 struct napi_struct tx_napi; 91 90
+13 -22
drivers/net/ethernet/ti/netcp_core.c
··· 34 34 #define NETCP_SOP_OFFSET (NET_IP_ALIGN + NET_SKB_PAD) 35 35 #define NETCP_NAPI_WEIGHT 64 36 36 #define NETCP_TX_TIMEOUT (5 * HZ) 37 + #define NETCP_PACKET_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN) 37 38 #define NETCP_MIN_PACKET_SIZE ETH_ZLEN 38 39 #define NETCP_MAX_MCAST_ADDR 16 39 40 ··· 816 815 if (likely(fdq == 0)) { 817 816 unsigned int primary_buf_len; 818 817 /* Allocate a primary receive queue entry */ 819 - buf_len = netcp->rx_buffer_sizes[0] + NETCP_SOP_OFFSET; 818 + buf_len = NETCP_PACKET_SIZE + NETCP_SOP_OFFSET; 820 819 primary_buf_len = SKB_DATA_ALIGN(buf_len) + 821 820 SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); 822 821 823 - if (primary_buf_len <= PAGE_SIZE) { 824 - bufptr = netdev_alloc_frag(primary_buf_len); 825 - pad[1] = primary_buf_len; 826 - } else { 827 - bufptr = kmalloc(primary_buf_len, GFP_ATOMIC | 828 - GFP_DMA32 | __GFP_COLD); 829 - pad[1] = 0; 830 - } 822 + bufptr = netdev_alloc_frag(primary_buf_len); 823 + pad[1] = primary_buf_len; 831 824 832 825 if (unlikely(!bufptr)) { 833 - dev_warn_ratelimited(netcp->ndev_dev, "Primary RX buffer alloc failed\n"); 826 + dev_warn_ratelimited(netcp->ndev_dev, 827 + "Primary RX buffer alloc failed\n"); 834 828 goto fail; 835 829 } 836 830 dma = dma_map_single(netcp->dev, bufptr, buf_len, 837 831 DMA_TO_DEVICE); 832 + if (unlikely(dma_mapping_error(netcp->dev, dma))) 833 + goto fail; 834 + 838 835 pad[0] = (u32)bufptr; 839 836 840 837 } else { 841 838 /* Allocate a secondary receive queue entry */ 842 - page = alloc_page(GFP_ATOMIC | GFP_DMA32 | __GFP_COLD); 839 + page = alloc_page(GFP_ATOMIC | GFP_DMA | __GFP_COLD); 843 840 if (unlikely(!page)) { 844 841 dev_warn_ratelimited(netcp->ndev_dev, "Secondary page alloc failed\n"); 845 842 goto fail; ··· 1020 1021 1021 1022 /* Map the linear buffer */ 1022 1023 dma_addr = dma_map_single(dev, skb->data, pkt_len, DMA_TO_DEVICE); 1023 - if (unlikely(!dma_addr)) { 1024 + if (unlikely(dma_mapping_error(dev, dma_addr))) { 1024 1025 dev_err(netcp->ndev_dev, "Failed to map skb buffer\n"); 1025 1026 return NULL; 1026 1027 } ··· 1556 1557 knav_queue_disable_notify(netcp->rx_queue); 1557 1558 1558 1559 /* open Rx FDQs */ 1559 - for (i = 0; i < KNAV_DMA_FDQ_PER_CHAN && 1560 - netcp->rx_queue_depths[i] && netcp->rx_buffer_sizes[i]; ++i) { 1560 + for (i = 0; i < KNAV_DMA_FDQ_PER_CHAN && netcp->rx_queue_depths[i]; 1561 + ++i) { 1561 1562 snprintf(name, sizeof(name), "rx-fdq-%s-%d", ndev->name, i); 1562 1563 netcp->rx_fdq[i] = knav_queue_open(name, KNAV_QUEUE_GP, 0); 1563 1564 if (IS_ERR_OR_NULL(netcp->rx_fdq[i])) { ··· 1949 1950 if (ret < 0) { 1950 1951 dev_err(dev, "missing \"rx-queue-depth\" parameter\n"); 1951 1952 netcp->rx_queue_depths[0] = 128; 1952 - } 1953 - 1954 - ret = of_property_read_u32_array(node_interface, "rx-buffer-size", 1955 - netcp->rx_buffer_sizes, 1956 - KNAV_DMA_FDQ_PER_CHAN); 1957 - if (ret) { 1958 - dev_err(dev, "missing \"rx-buffer-size\" parameter\n"); 1959 - netcp->rx_buffer_sizes[0] = 1536; 1960 1953 } 1961 1954 1962 1955 ret = of_property_read_u32_array(node_interface, "rx-pool", temp, 2);
+4 -3
drivers/net/hamradio/mkiss.c
··· 728 728 dev->type = ARPHRD_AX25; 729 729 730 730 /* Perform the low-level AX25 initialization. */ 731 - if ((err = ax_open(ax->dev))) { 731 + err = ax_open(ax->dev); 732 + if (err) 732 733 goto out_free_netdev; 733 - } 734 734 735 - if (register_netdev(dev)) 735 + err = register_netdev(dev); 736 + if (err) 736 737 goto out_free_buffers; 737 738 738 739 /* after register_netdev() - because else printk smashes the kernel */
+8 -1
drivers/net/ntb_netdev.c
··· 102 102 103 103 netdev_dbg(ndev, "%s: %d byte payload received\n", __func__, len); 104 104 105 + if (len < 0) { 106 + ndev->stats.rx_errors++; 107 + ndev->stats.rx_length_errors++; 108 + goto enqueue_again; 109 + } 110 + 105 111 skb_put(skb, len); 106 112 skb->protocol = eth_type_trans(skb, ndev); 107 113 skb->ip_summed = CHECKSUM_NONE; ··· 127 121 return; 128 122 } 129 123 124 + enqueue_again: 130 125 rc = ntb_transport_rx_enqueue(qp, skb, skb->data, ndev->mtu + ETH_HLEN); 131 126 if (rc) { 132 127 dev_kfree_skb(skb); ··· 191 184 192 185 rc = ntb_transport_rx_enqueue(dev->qp, skb, skb->data, 193 186 ndev->mtu + ETH_HLEN); 194 - if (rc == -EINVAL) { 187 + if (rc) { 195 188 dev_kfree_skb(skb); 196 189 goto err; 197 190 }
+2 -2
drivers/net/virtio_net.c
··· 1756 1756 /* Do we support "hardware" checksums? */ 1757 1757 if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) { 1758 1758 /* This opens up the world of extra features. */ 1759 - dev->hw_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; 1759 + dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_SG; 1760 1760 if (csum) 1761 - dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; 1761 + dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; 1762 1762 1763 1763 if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { 1764 1764 dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO
+2 -1
drivers/net/wan/cosa.c
··· 589 589 chan->netdev->base_addr = chan->cosa->datareg; 590 590 chan->netdev->irq = chan->cosa->irq; 591 591 chan->netdev->dma = chan->cosa->dma; 592 - if (register_hdlc_device(chan->netdev)) { 592 + err = register_hdlc_device(chan->netdev); 593 + if (err) { 593 594 netdev_warn(chan->netdev, 594 595 "register_hdlc_device() failed\n"); 595 596 free_netdev(chan->netdev);
+1 -1
drivers/net/wireless/b43/tables_nphy.c
··· 3728 3728 switch (phy->rev) { 3729 3729 case 6: 3730 3730 case 5: 3731 - if (sprom->fem.ghz5.extpa_gain == 3) 3731 + if (sprom->fem.ghz2.extpa_gain == 3) 3732 3732 return b43_ntab_tx_gain_epa_rev3_hi_pwr_2g; 3733 3733 /* fall through */ 3734 3734 case 4:
+1 -1
drivers/net/wireless/iwlwifi/mvm/scan.c
··· 1023 1023 cmd->scan_priority = 1024 1024 iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6); 1025 1025 1026 - if (iwl_mvm_scan_total_iterations(params) == 0) 1026 + if (iwl_mvm_scan_total_iterations(params) == 1) 1027 1027 cmd->ooc_priority = 1028 1028 iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6); 1029 1029 else
+19 -3
drivers/net/wireless/iwlwifi/pcie/trans.c
··· 478 478 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) 479 479 iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG, 480 480 APMG_PCIDEV_STT_VAL_WAKE_ME); 481 - else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) 481 + else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) { 482 + iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, 483 + CSR_RESET_LINK_PWR_MGMT_DISABLED); 482 484 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, 483 485 CSR_HW_IF_CONFIG_REG_PREPARE | 484 486 CSR_HW_IF_CONFIG_REG_ENABLE_PME); 487 + mdelay(1); 488 + iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, 489 + CSR_RESET_LINK_PWR_MGMT_DISABLED); 490 + } 485 491 mdelay(5); 486 492 } 487 493 ··· 581 575 if (ret >= 0) 582 576 return 0; 583 577 578 + iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, 579 + CSR_RESET_LINK_PWR_MGMT_DISABLED); 580 + msleep(1); 581 + 584 582 for (iter = 0; iter < 10; iter++) { 585 583 /* If HW is not ready, prepare the conditions to check again */ 586 584 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, ··· 592 582 593 583 do { 594 584 ret = iwl_pcie_set_hw_ready(trans); 595 - if (ret >= 0) 596 - return 0; 585 + if (ret >= 0) { 586 + ret = 0; 587 + goto out; 588 + } 597 589 598 590 usleep_range(200, 1000); 599 591 t += 200; ··· 604 592 } 605 593 606 594 IWL_ERR(trans, "Couldn't prepare the card\n"); 595 + 596 + out: 597 + iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, 598 + CSR_RESET_LINK_PWR_MGMT_DISABLED); 607 599 608 600 return ret; 609 601 }
+13 -2
drivers/net/wireless/iwlwifi/pcie/tx.c
··· 1875 1875 1876 1876 /* start timer if queue currently empty */ 1877 1877 if (q->read_ptr == q->write_ptr) { 1878 - if (txq->wd_timeout) 1879 - mod_timer(&txq->stuck_timer, jiffies + txq->wd_timeout); 1878 + if (txq->wd_timeout) { 1879 + /* 1880 + * If the TXQ is active, then set the timer, if not, 1881 + * set the timer in remainder so that the timer will 1882 + * be armed with the right value when the station will 1883 + * wake up. 1884 + */ 1885 + if (!txq->frozen) 1886 + mod_timer(&txq->stuck_timer, 1887 + jiffies + txq->wd_timeout); 1888 + else 1889 + txq->frozen_expiry_remainder = txq->wd_timeout; 1890 + } 1880 1891 IWL_DEBUG_RPM(trans, "Q: %d first tx - take ref\n", q->id); 1881 1892 iwl_trans_pcie_ref(trans); 1882 1893 }
+7 -1
drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
··· 172 172 (struct rsi_91x_sdiodev *)adapter->rsi_dev; 173 173 u32 len; 174 174 u32 num_blocks; 175 + const u8 *fw; 175 176 const struct firmware *fw_entry = NULL; 176 177 u32 block_size = dev->tx_blk_size; 177 178 int status = 0; ··· 201 200 return status; 202 201 } 203 202 203 + /* Copy firmware into DMA-accessible memory */ 204 + fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL); 205 + if (!fw) 206 + return -ENOMEM; 204 207 len = fw_entry->size; 205 208 206 209 if (len % 4) ··· 215 210 rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len); 216 211 rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks); 217 212 218 - status = rsi_copy_to_card(common, fw_entry->data, len, num_blocks); 213 + status = rsi_copy_to_card(common, fw, len, num_blocks); 214 + kfree(fw); 219 215 release_firmware(fw_entry); 220 216 return status; 221 217 }
+4
drivers/net/wireless/rsi/rsi_91x_usb_ops.c
··· 146 146 return status; 147 147 } 148 148 149 + /* Copy firmware into DMA-accessible memory */ 149 150 fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL); 151 + if (!fw) 152 + return -ENOMEM; 150 153 len = fw_entry->size; 151 154 152 155 if (len % 4) ··· 161 158 rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks); 162 159 163 160 status = rsi_copy_to_card(common, fw, len, num_blocks); 161 + kfree(fw); 164 162 release_firmware(fw_entry); 165 163 return status; 166 164 }
+5 -2
drivers/net/wireless/rtlwifi/core.c
··· 1015 1015 { 1016 1016 struct rtl_priv *rtlpriv = rtl_priv(hw); 1017 1017 struct sk_buff *skb = ieee80211_beacon_get(hw, vif); 1018 + struct rtl_tcb_desc tcb_desc; 1018 1019 1019 - if (skb) 1020 - rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, NULL); 1020 + if (skb) { 1021 + memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); 1022 + rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, &tcb_desc); 1023 + } 1021 1024 } 1022 1025 1023 1026 static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
+1
drivers/net/wireless/rtlwifi/rtl8723be/sw.c
··· 385 385 module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444); 386 386 module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444); 387 387 module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444); 388 + module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444); 388 389 module_param_named(disable_watchdog, rtl8723be_mod_params.disable_watchdog, 389 390 bool, 0444); 390 391 MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
+6
drivers/net/xen-netback/interface.c
··· 61 61 void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue) 62 62 { 63 63 atomic_dec(&queue->inflight_packets); 64 + 65 + /* Wake the dealloc thread _after_ decrementing inflight_packets so 66 + * that if kthread_stop() has already been called, the dealloc thread 67 + * does not wait forever with nothing to wake it. 68 + */ 69 + wake_up(&queue->dealloc_wq); 64 70 } 65 71 66 72 int xenvif_schedulable(struct xenvif *vif)
+33 -29
drivers/net/xen-netback/netback.c
··· 810 810 static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif_queue *queue, 811 811 struct sk_buff *skb, 812 812 struct xen_netif_tx_request *txp, 813 - struct gnttab_map_grant_ref *gop) 813 + struct gnttab_map_grant_ref *gop, 814 + unsigned int frag_overflow, 815 + struct sk_buff *nskb) 814 816 { 815 817 struct skb_shared_info *shinfo = skb_shinfo(skb); 816 818 skb_frag_t *frags = shinfo->frags; 817 819 u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx; 818 820 int start; 819 821 pending_ring_idx_t index; 820 - unsigned int nr_slots, frag_overflow = 0; 822 + unsigned int nr_slots; 821 823 822 - /* At this point shinfo->nr_frags is in fact the number of 823 - * slots, which can be as large as XEN_NETBK_LEGACY_SLOTS_MAX. 824 - */ 825 - if (shinfo->nr_frags > MAX_SKB_FRAGS) { 826 - frag_overflow = shinfo->nr_frags - MAX_SKB_FRAGS; 827 - BUG_ON(frag_overflow > MAX_SKB_FRAGS); 828 - shinfo->nr_frags = MAX_SKB_FRAGS; 829 - } 830 824 nr_slots = shinfo->nr_frags; 831 825 832 826 /* Skip first skb fragment if it is on same page as header fragment. */ ··· 835 841 } 836 842 837 843 if (frag_overflow) { 838 - struct sk_buff *nskb = xenvif_alloc_skb(0); 839 - if (unlikely(nskb == NULL)) { 840 - if (net_ratelimit()) 841 - netdev_err(queue->vif->dev, 842 - "Can't allocate the frag_list skb.\n"); 843 - return NULL; 844 - } 845 844 846 845 shinfo = skb_shinfo(nskb); 847 846 frags = shinfo->frags; ··· 1162 1175 unsigned *copy_ops, 1163 1176 unsigned *map_ops) 1164 1177 { 1165 - struct gnttab_map_grant_ref *gop = queue->tx_map_ops, *request_gop; 1166 - struct sk_buff *skb; 1178 + struct gnttab_map_grant_ref *gop = queue->tx_map_ops; 1179 + struct sk_buff *skb, *nskb; 1167 1180 int ret; 1181 + unsigned int frag_overflow; 1168 1182 1169 1183 while (skb_queue_len(&queue->tx_queue) < budget) { 1170 1184 struct xen_netif_tx_request txreq; ··· 1253 1265 break; 1254 1266 } 1255 1267 1268 + skb_shinfo(skb)->nr_frags = ret; 1269 + if (data_len < txreq.size) 1270 + skb_shinfo(skb)->nr_frags++; 1271 + /* At this point shinfo->nr_frags is in fact the number of 1272 + * slots, which can be as large as XEN_NETBK_LEGACY_SLOTS_MAX. 1273 + */ 1274 + frag_overflow = 0; 1275 + nskb = NULL; 1276 + if (skb_shinfo(skb)->nr_frags > MAX_SKB_FRAGS) { 1277 + frag_overflow = skb_shinfo(skb)->nr_frags - MAX_SKB_FRAGS; 1278 + BUG_ON(frag_overflow > MAX_SKB_FRAGS); 1279 + skb_shinfo(skb)->nr_frags = MAX_SKB_FRAGS; 1280 + nskb = xenvif_alloc_skb(0); 1281 + if (unlikely(nskb == NULL)) { 1282 + kfree_skb(skb); 1283 + xenvif_tx_err(queue, &txreq, idx); 1284 + if (net_ratelimit()) 1285 + netdev_err(queue->vif->dev, 1286 + "Can't allocate the frag_list skb.\n"); 1287 + break; 1288 + } 1289 + } 1290 + 1256 1291 if (extras[XEN_NETIF_EXTRA_TYPE_GSO - 1].type) { 1257 1292 struct xen_netif_extra_info *gso; 1258 1293 gso = &extras[XEN_NETIF_EXTRA_TYPE_GSO - 1]; ··· 1283 1272 if (xenvif_set_skb_gso(queue->vif, skb, gso)) { 1284 1273 /* Failure in xenvif_set_skb_gso is fatal. */ 1285 1274 kfree_skb(skb); 1275 + kfree_skb(nskb); 1286 1276 break; 1287 1277 } 1288 1278 } ··· 1306 1294 1307 1295 (*copy_ops)++; 1308 1296 1309 - skb_shinfo(skb)->nr_frags = ret; 1310 1297 if (data_len < txreq.size) { 1311 - skb_shinfo(skb)->nr_frags++; 1312 1298 frag_set_pending_idx(&skb_shinfo(skb)->frags[0], 1313 1299 pending_idx); 1314 1300 xenvif_tx_create_map_op(queue, pending_idx, &txreq, gop); ··· 1320 1310 1321 1311 queue->pending_cons++; 1322 1312 1323 - request_gop = xenvif_get_requests(queue, skb, txfrags, gop); 1324 - if (request_gop == NULL) { 1325 - kfree_skb(skb); 1326 - xenvif_tx_err(queue, &txreq, idx); 1327 - break; 1328 - } 1329 - gop = request_gop; 1313 + gop = xenvif_get_requests(queue, skb, txfrags, gop, 1314 + frag_overflow, nskb); 1330 1315 1331 1316 __skb_queue_tail(&queue->tx_queue, skb); 1332 1317 ··· 1541 1536 smp_wmb(); 1542 1537 queue->dealloc_prod++; 1543 1538 } while (ubuf); 1544 - wake_up(&queue->dealloc_wq); 1545 1539 spin_unlock_irqrestore(&queue->callback_lock, flags); 1546 1540 1547 1541 if (likely(zerocopy_success))
+1 -1
drivers/ntb/ntb.c
··· 114 114 ntb->dev.bus = &ntb_bus; 115 115 ntb->dev.parent = &ntb->pdev->dev; 116 116 ntb->dev.release = ntb_dev_release; 117 - dev_set_name(&ntb->dev, pci_name(ntb->pdev)); 117 + dev_set_name(&ntb->dev, "%s", pci_name(ntb->pdev)); 118 118 119 119 ntb->ctx = NULL; 120 120 ntb->ctx_ops = NULL;
+127 -80
drivers/ntb/ntb_transport.c
··· 142 142 143 143 void (*rx_handler)(struct ntb_transport_qp *qp, void *qp_data, 144 144 void *data, int len); 145 + struct list_head rx_post_q; 145 146 struct list_head rx_pend_q; 146 147 struct list_head rx_free_q; 147 - spinlock_t ntb_rx_pend_q_lock; 148 - spinlock_t ntb_rx_free_q_lock; 148 + /* ntb_rx_q_lock: synchronize access to rx_XXXX_q */ 149 + spinlock_t ntb_rx_q_lock; 149 150 void *rx_buff; 150 151 unsigned int rx_index; 151 152 unsigned int rx_max_entry; ··· 212 211 bool link_is_up; 213 212 struct delayed_work link_work; 214 213 struct work_struct link_cleanup; 214 + 215 + struct dentry *debugfs_node_dir; 215 216 }; 216 217 217 218 enum { ··· 439 436 char *buf; 440 437 ssize_t ret, out_offset, out_count; 441 438 439 + qp = filp->private_data; 440 + 441 + if (!qp || !qp->link_is_up) 442 + return 0; 443 + 442 444 out_count = 1000; 443 445 444 446 buf = kmalloc(out_count, GFP_KERNEL); 445 447 if (!buf) 446 448 return -ENOMEM; 447 449 448 - qp = filp->private_data; 449 450 out_offset = 0; 450 451 out_offset += snprintf(buf + out_offset, out_count - out_offset, 451 452 "NTB QP stats\n"); ··· 541 534 return entry; 542 535 } 543 536 537 + static struct ntb_queue_entry *ntb_list_mv(spinlock_t *lock, 538 + struct list_head *list, 539 + struct list_head *to_list) 540 + { 541 + struct ntb_queue_entry *entry; 542 + unsigned long flags; 543 + 544 + spin_lock_irqsave(lock, flags); 545 + 546 + if (list_empty(list)) { 547 + entry = NULL; 548 + } else { 549 + entry = list_first_entry(list, struct ntb_queue_entry, entry); 550 + list_move_tail(&entry->entry, to_list); 551 + } 552 + 553 + spin_unlock_irqrestore(lock, flags); 554 + 555 + return entry; 556 + } 557 + 544 558 static int ntb_transport_setup_qp_mw(struct ntb_transport_ctx *nt, 545 559 unsigned int qp_num) 546 560 { ··· 629 601 } 630 602 631 603 static int ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw, 632 - unsigned int size) 604 + resource_size_t size) 633 605 { 634 606 struct ntb_transport_mw *mw = &nt->mw_vec[num_mw]; 635 607 struct pci_dev *pdev = nt->ndev->pdev; 636 - unsigned int xlat_size, buff_size; 608 + size_t xlat_size, buff_size; 637 609 int rc; 610 + 611 + if (!size) 612 + return -EINVAL; 638 613 639 614 xlat_size = round_up(size, mw->xlat_align_size); 640 615 buff_size = round_up(size, mw->xlat_align); ··· 658 627 if (!mw->virt_addr) { 659 628 mw->xlat_size = 0; 660 629 mw->buff_size = 0; 661 - dev_err(&pdev->dev, "Unable to alloc MW buff of size %d\n", 630 + dev_err(&pdev->dev, "Unable to alloc MW buff of size %zu\n", 662 631 buff_size); 663 632 return -ENOMEM; 664 633 } ··· 898 867 899 868 if (qp->event_handler) 900 869 qp->event_handler(qp->cb_data, qp->link_is_up); 870 + 871 + tasklet_schedule(&qp->rxc_db_work); 901 872 } else if (nt->link_is_up) 902 873 schedule_delayed_work(&qp->link_work, 903 874 msecs_to_jiffies(NTB_LINK_DOWN_TIMEOUT)); ··· 956 923 qp->tx_max_frame = min(transport_mtu, tx_size / 2); 957 924 qp->tx_max_entry = tx_size / qp->tx_max_frame; 958 925 959 - if (nt_debugfs_dir) { 926 + if (nt->debugfs_node_dir) { 960 927 char debugfs_name[4]; 961 928 962 929 snprintf(debugfs_name, 4, "qp%d", qp_num); 963 930 qp->debugfs_dir = debugfs_create_dir(debugfs_name, 964 - nt_debugfs_dir); 931 + nt->debugfs_node_dir); 965 932 966 933 qp->debugfs_stats = debugfs_create_file("stats", S_IRUSR, 967 934 qp->debugfs_dir, qp, ··· 974 941 INIT_DELAYED_WORK(&qp->link_work, ntb_qp_link_work); 975 942 INIT_WORK(&qp->link_cleanup, ntb_qp_link_cleanup_work); 976 943 977 - spin_lock_init(&qp->ntb_rx_pend_q_lock); 978 - spin_lock_init(&qp->ntb_rx_free_q_lock); 944 + spin_lock_init(&qp->ntb_rx_q_lock); 979 945 spin_lock_init(&qp->ntb_tx_free_q_lock); 980 946 947 + INIT_LIST_HEAD(&qp->rx_post_q); 981 948 INIT_LIST_HEAD(&qp->rx_pend_q); 982 949 INIT_LIST_HEAD(&qp->rx_free_q); 983 950 INIT_LIST_HEAD(&qp->tx_free_q); ··· 1064 1031 goto err2; 1065 1032 } 1066 1033 1034 + if (nt_debugfs_dir) { 1035 + nt->debugfs_node_dir = 1036 + debugfs_create_dir(pci_name(ndev->pdev), 1037 + nt_debugfs_dir); 1038 + } 1039 + 1067 1040 for (i = 0; i < qp_count; i++) { 1068 1041 rc = ntb_transport_init_queue(nt, i); 1069 1042 if (rc) ··· 1146 1107 kfree(nt); 1147 1108 } 1148 1109 1110 + static void ntb_complete_rxc(struct ntb_transport_qp *qp) 1111 + { 1112 + struct ntb_queue_entry *entry; 1113 + void *cb_data; 1114 + unsigned int len; 1115 + unsigned long irqflags; 1116 + 1117 + spin_lock_irqsave(&qp->ntb_rx_q_lock, irqflags); 1118 + 1119 + while (!list_empty(&qp->rx_post_q)) { 1120 + entry = list_first_entry(&qp->rx_post_q, 1121 + struct ntb_queue_entry, entry); 1122 + if (!(entry->flags & DESC_DONE_FLAG)) 1123 + break; 1124 + 1125 + entry->rx_hdr->flags = 0; 1126 + iowrite32(entry->index, &qp->rx_info->entry); 1127 + 1128 + cb_data = entry->cb_data; 1129 + len = entry->len; 1130 + 1131 + list_move_tail(&entry->entry, &qp->rx_free_q); 1132 + 1133 + spin_unlock_irqrestore(&qp->ntb_rx_q_lock, irqflags); 1134 + 1135 + if (qp->rx_handler && qp->client_ready) 1136 + qp->rx_handler(qp, qp->cb_data, cb_data, len); 1137 + 1138 + spin_lock_irqsave(&qp->ntb_rx_q_lock, irqflags); 1139 + } 1140 + 1141 + spin_unlock_irqrestore(&qp->ntb_rx_q_lock, irqflags); 1142 + } 1143 + 1149 1144 static void ntb_rx_copy_callback(void *data) 1150 1145 { 1151 1146 struct ntb_queue_entry *entry = data; 1152 - struct ntb_transport_qp *qp = entry->qp; 1153 - void *cb_data = entry->cb_data; 1154 - unsigned int len = entry->len; 1155 - struct ntb_payload_header *hdr = entry->rx_hdr; 1156 1147 1157 - hdr->flags = 0; 1148 + entry->flags |= DESC_DONE_FLAG; 1158 1149 1159 - iowrite32(entry->index, &qp->rx_info->entry); 1160 - 1161 - ntb_list_add(&qp->ntb_rx_free_q_lock, &entry->entry, &qp->rx_free_q); 1162 - 1163 - if (qp->rx_handler && qp->client_ready) 1164 - qp->rx_handler(qp, qp->cb_data, cb_data, len); 1150 + ntb_complete_rxc(entry->qp); 1165 1151 } 1166 1152 1167 1153 static void ntb_memcpy_rx(struct ntb_queue_entry *entry, void *offset) ··· 1202 1138 ntb_rx_copy_callback(entry); 1203 1139 } 1204 1140 1205 - static void ntb_async_rx(struct ntb_queue_entry *entry, void *offset, 1206 - size_t len) 1141 + static void ntb_async_rx(struct ntb_queue_entry *entry, void *offset) 1207 1142 { 1208 1143 struct dma_async_tx_descriptor *txd; 1209 1144 struct ntb_transport_qp *qp = entry->qp; 1210 1145 struct dma_chan *chan = qp->dma_chan; 1211 1146 struct dma_device *device; 1212 - size_t pay_off, buff_off; 1147 + size_t pay_off, buff_off, len; 1213 1148 struct dmaengine_unmap_data *unmap; 1214 1149 dma_cookie_t cookie; 1215 1150 void *buf = entry->buf; 1216 1151 1217 - entry->len = len; 1152 + len = entry->len; 1218 1153 1219 1154 if (!chan) 1220 1155 goto err; ··· 1289 1226 struct ntb_payload_header *hdr; 1290 1227 struct ntb_queue_entry *entry; 1291 1228 void *offset; 1292 - int rc; 1293 1229 1294 1230 offset = qp->rx_buff + qp->rx_max_frame * qp->rx_index; 1295 1231 hdr = offset + qp->rx_max_frame - sizeof(struct ntb_payload_header); ··· 1317 1255 return -EIO; 1318 1256 } 1319 1257 1320 - entry = ntb_list_rm(&qp->ntb_rx_pend_q_lock, &qp->rx_pend_q); 1258 + entry = ntb_list_mv(&qp->ntb_rx_q_lock, &qp->rx_pend_q, &qp->rx_post_q); 1321 1259 if (!entry) { 1322 1260 dev_dbg(&qp->ndev->pdev->dev, "no receive buffer\n"); 1323 1261 qp->rx_err_no_buf++; 1324 - 1325 - rc = -ENOMEM; 1326 - goto err; 1262 + return -EAGAIN; 1327 1263 } 1264 + 1265 + entry->rx_hdr = hdr; 1266 + entry->index = qp->rx_index; 1328 1267 1329 1268 if (hdr->len > entry->len) { 1330 1269 dev_dbg(&qp->ndev->pdev->dev, ··· 1333 1270 hdr->len, entry->len); 1334 1271 qp->rx_err_oflow++; 1335 1272 1336 - rc = -EIO; 1337 - goto err; 1273 + entry->len = -EIO; 1274 + entry->flags |= DESC_DONE_FLAG; 1275 + 1276 + ntb_complete_rxc(qp); 1277 + } else { 1278 + dev_dbg(&qp->ndev->pdev->dev, 1279 + "RX OK index %u ver %u size %d into buf size %d\n", 1280 + qp->rx_index, hdr->ver, hdr->len, entry->len); 1281 + 1282 + qp->rx_bytes += hdr->len; 1283 + qp->rx_pkts++; 1284 + 1285 + entry->len = hdr->len; 1286 + 1287 + ntb_async_rx(entry, offset); 1338 1288 } 1339 - 1340 - dev_dbg(&qp->ndev->pdev->dev, 1341 - "RX OK index %u ver %u size %d into buf size %d\n", 1342 - qp->rx_index, hdr->ver, hdr->len, entry->len); 1343 - 1344 - qp->rx_bytes += hdr->len; 1345 - qp->rx_pkts++; 1346 - 1347 - entry->index = qp->rx_index; 1348 - entry->rx_hdr = hdr; 1349 - 1350 - ntb_async_rx(entry, offset, hdr->len); 1351 1289 1352 1290 qp->rx_index++; 1353 1291 qp->rx_index %= qp->rx_max_entry; 1354 1292 1355 1293 return 0; 1356 - 1357 - err: 1358 - /* FIXME: if this syncrhonous update of the rx_index gets ahead of 1359 - * asyncrhonous ntb_rx_copy_callback of previous entry, there are three 1360 - * scenarios: 1361 - * 1362 - * 1) The peer might miss this update, but observe the update 1363 - * from the memcpy completion callback. In this case, the buffer will 1364 - * not be freed on the peer to be reused for a different packet. The 1365 - * successful rx of a later packet would clear the condition, but the 1366 - * condition could persist if several rx fail in a row. 1367 - * 1368 - * 2) The peer may observe this update before the asyncrhonous copy of 1369 - * prior packets is completed. The peer may overwrite the buffers of 1370 - * the prior packets before they are copied. 1371 - * 1372 - * 3) Both: the peer may observe the update, and then observe the index 1373 - * decrement by the asynchronous completion callback. Who knows what 1374 - * badness that will cause. 1375 - */ 1376 - hdr->flags = 0; 1377 - iowrite32(qp->rx_index, &qp->rx_info->entry); 1378 - 1379 - return rc; 1380 1294 } 1381 1295 1382 1296 static void ntb_transport_rxc_db(unsigned long data) ··· 1373 1333 break; 1374 1334 } 1375 1335 1376 - if (qp->dma_chan) 1336 + if (i && qp->dma_chan) 1377 1337 dma_async_issue_pending(qp->dma_chan); 1378 1338 1379 1339 if (i == qp->rx_max_entry) { ··· 1649 1609 goto err1; 1650 1610 1651 1611 entry->qp = qp; 1652 - ntb_list_add(&qp->ntb_rx_free_q_lock, &entry->entry, 1612 + ntb_list_add(&qp->ntb_rx_q_lock, &entry->entry, 1653 1613 &qp->rx_free_q); 1654 1614 } 1655 1615 ··· 1674 1634 while ((entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q))) 1675 1635 kfree(entry); 1676 1636 err1: 1677 - while ((entry = ntb_list_rm(&qp->ntb_rx_free_q_lock, &qp->rx_free_q))) 1637 + while ((entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_free_q))) 1678 1638 kfree(entry); 1679 1639 if (qp->dma_chan) 1680 1640 dma_release_channel(qp->dma_chan); ··· 1692 1652 */ 1693 1653 void ntb_transport_free_queue(struct ntb_transport_qp *qp) 1694 1654 { 1695 - struct ntb_transport_ctx *nt = qp->transport; 1696 1655 struct pci_dev *pdev; 1697 1656 struct ntb_queue_entry *entry; 1698 1657 u64 qp_bit; ··· 1728 1689 qp->tx_handler = NULL; 1729 1690 qp->event_handler = NULL; 1730 1691 1731 - while ((entry = ntb_list_rm(&qp->ntb_rx_free_q_lock, &qp->rx_free_q))) 1692 + while ((entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_free_q))) 1732 1693 kfree(entry); 1733 1694 1734 - while ((entry = ntb_list_rm(&qp->ntb_rx_pend_q_lock, &qp->rx_pend_q))) { 1735 - dev_warn(&pdev->dev, "Freeing item from a non-empty queue\n"); 1695 + while ((entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_pend_q))) { 1696 + dev_warn(&pdev->dev, "Freeing item from non-empty rx_pend_q\n"); 1697 + kfree(entry); 1698 + } 1699 + 1700 + while ((entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_post_q))) { 1701 + dev_warn(&pdev->dev, "Freeing item from non-empty rx_post_q\n"); 1736 1702 kfree(entry); 1737 1703 } 1738 1704 1739 1705 while ((entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q))) 1740 1706 kfree(entry); 1741 1707 1742 - nt->qp_bitmap_free |= qp_bit; 1708 + qp->transport->qp_bitmap_free |= qp_bit; 1743 1709 1744 1710 dev_info(&pdev->dev, "NTB Transport QP %d freed\n", qp->qp_num); 1745 1711 } ··· 1768 1724 if (!qp || qp->client_ready) 1769 1725 return NULL; 1770 1726 1771 - entry = ntb_list_rm(&qp->ntb_rx_pend_q_lock, &qp->rx_pend_q); 1727 + entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_pend_q); 1772 1728 if (!entry) 1773 1729 return NULL; 1774 1730 1775 1731 buf = entry->cb_data; 1776 1732 *len = entry->len; 1777 1733 1778 - ntb_list_add(&qp->ntb_rx_free_q_lock, &entry->entry, &qp->rx_free_q); 1734 + ntb_list_add(&qp->ntb_rx_q_lock, &entry->entry, &qp->rx_free_q); 1779 1735 1780 1736 return buf; 1781 1737 } ··· 1801 1757 if (!qp) 1802 1758 return -EINVAL; 1803 1759 1804 - entry = ntb_list_rm(&qp->ntb_rx_free_q_lock, &qp->rx_free_q); 1760 + entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_free_q); 1805 1761 if (!entry) 1806 1762 return -ENOMEM; 1807 1763 1808 1764 entry->cb_data = cb; 1809 1765 entry->buf = data; 1810 1766 entry->len = len; 1767 + entry->flags = 0; 1811 1768 1812 - ntb_list_add(&qp->ntb_rx_pend_q_lock, &entry->entry, &qp->rx_pend_q); 1769 + ntb_list_add(&qp->ntb_rx_q_lock, &entry->entry, &qp->rx_pend_q); 1770 + 1771 + tasklet_schedule(&qp->rxc_db_work); 1813 1772 1814 1773 return 0; 1815 1774 }
+1
drivers/phy/phy-sun4i-usb.c
··· 212 212 213 213 sun4i_usb_phy_write(phy, PHY_SQUELCH_DETECT, enabled ? 0 : 2, 2); 214 214 } 215 + EXPORT_SYMBOL_GPL(sun4i_usb_phy_set_squelch_detect); 215 216 216 217 static struct phy_ops sun4i_usb_phy_ops = { 217 218 .init = sun4i_usb_phy_init,
+55 -6
drivers/phy/phy-ti-pipe3.c
··· 28 28 #include <linux/delay.h> 29 29 #include <linux/phy/omap_control_phy.h> 30 30 #include <linux/of_platform.h> 31 + #include <linux/mfd/syscon.h> 32 + #include <linux/regmap.h> 31 33 32 34 #define PLL_STATUS 0x00000004 33 35 #define PLL_GO 0x00000008 ··· 53 51 #define PLL_TICOPWDN BIT(16) 54 52 #define PLL_LOCK 0x2 55 53 #define PLL_IDLE 0x1 54 + 55 + #define SATA_PLL_SOFT_RESET BIT(18) 56 56 57 57 /* 58 58 * This is an Empirical value that works, need to confirm the actual ··· 86 82 struct clk *refclk; 87 83 struct clk *div_clk; 88 84 struct pipe3_dpll_map *dpll_map; 85 + struct regmap *dpll_reset_syscon; /* ctrl. reg. acces */ 86 + unsigned int dpll_reset_reg; /* reg. index within syscon */ 87 + bool sata_refclk_enabled; 89 88 }; 90 89 91 90 static struct pipe3_dpll_map dpll_map_usb[] = { ··· 256 249 u32 val; 257 250 unsigned long timeout; 258 251 259 - /* SATA DPLL can't be powered down due to Errata i783 */ 260 - if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata")) 252 + /* If dpll_reset_syscon is not present we wont power down SATA DPLL 253 + * due to Errata i783 254 + */ 255 + if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata") && 256 + !phy->dpll_reset_syscon) 261 257 return 0; 262 258 263 259 /* PCIe doesn't have internal DPLL */ ··· 284 274 val); 285 275 return -EBUSY; 286 276 } 277 + } 278 + 279 + /* i783: SATA needs control bit toggle after PLL unlock */ 280 + if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata")) { 281 + regmap_update_bits(phy->dpll_reset_syscon, phy->dpll_reset_reg, 282 + SATA_PLL_SOFT_RESET, SATA_PLL_SOFT_RESET); 283 + regmap_update_bits(phy->dpll_reset_syscon, phy->dpll_reset_reg, 284 + SATA_PLL_SOFT_RESET, 0); 287 285 } 288 286 289 287 ti_pipe3_disable_clocks(phy); ··· 368 350 } 369 351 } else { 370 352 phy->wkupclk = ERR_PTR(-ENODEV); 353 + phy->dpll_reset_syscon = syscon_regmap_lookup_by_phandle(node, 354 + "syscon-pllreset"); 355 + if (IS_ERR(phy->dpll_reset_syscon)) { 356 + dev_info(&pdev->dev, 357 + "can't get syscon-pllreset, sata dpll won't idle\n"); 358 + phy->dpll_reset_syscon = NULL; 359 + } else { 360 + if (of_property_read_u32_index(node, 361 + "syscon-pllreset", 1, 362 + &phy->dpll_reset_reg)) { 363 + dev_err(&pdev->dev, 364 + "couldn't get pllreset reg. offset\n"); 365 + return -EINVAL; 366 + } 367 + } 371 368 } 372 369 373 370 if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { ··· 435 402 436 403 platform_set_drvdata(pdev, phy); 437 404 pm_runtime_enable(phy->dev); 438 - /* Prevent auto-disable of refclk for SATA PHY due to Errata i783 */ 439 - if (of_device_is_compatible(node, "ti,phy-pipe3-sata")) 440 - if (!IS_ERR(phy->refclk)) 405 + 406 + /* 407 + * Prevent auto-disable of refclk for SATA PHY due to Errata i783 408 + */ 409 + if (of_device_is_compatible(node, "ti,phy-pipe3-sata")) { 410 + if (!IS_ERR(phy->refclk)) { 441 411 clk_prepare_enable(phy->refclk); 412 + phy->sata_refclk_enabled = true; 413 + } 414 + } 442 415 443 416 generic_phy = devm_phy_create(phy->dev, NULL, &ops); 444 417 if (IS_ERR(generic_phy)) ··· 511 472 { 512 473 if (!IS_ERR(phy->wkupclk)) 513 474 clk_disable_unprepare(phy->wkupclk); 514 - if (!IS_ERR(phy->refclk)) 475 + if (!IS_ERR(phy->refclk)) { 515 476 clk_disable_unprepare(phy->refclk); 477 + /* 478 + * SATA refclk needs an additional disable as we left it 479 + * on in probe to avoid Errata i783 480 + */ 481 + if (phy->sata_refclk_enabled) { 482 + clk_disable_unprepare(phy->refclk); 483 + phy->sata_refclk_enabled = false; 484 + } 485 + } 486 + 516 487 if (!IS_ERR(phy->div_clk)) 517 488 clk_disable_unprepare(phy->div_clk); 518 489 }
-1
drivers/platform/chrome/Kconfig
··· 4 4 5 5 menuconfig CHROME_PLATFORMS 6 6 bool "Platform support for Chrome hardware" 7 - depends on X86 || ARM 8 7 ---help--- 9 8 Say Y here to get to see options for platform support for 10 9 various Chromebooks and Chromeboxes. This option alone does
+18 -10
drivers/scsi/ipr.c
··· 599 599 { 600 600 struct ipr_trace_entry *trace_entry; 601 601 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; 602 + unsigned int trace_index; 602 603 603 - trace_entry = &ioa_cfg->trace[atomic_add_return 604 - (1, &ioa_cfg->trace_index)%IPR_NUM_TRACE_ENTRIES]; 604 + trace_index = atomic_add_return(1, &ioa_cfg->trace_index) & IPR_TRACE_INDEX_MASK; 605 + trace_entry = &ioa_cfg->trace[trace_index]; 605 606 trace_entry->time = jiffies; 606 607 trace_entry->op_code = ipr_cmd->ioarcb.cmd_pkt.cdb[0]; 607 608 trace_entry->type = type; ··· 1052 1051 1053 1052 static int ipr_get_hrrq_index(struct ipr_ioa_cfg *ioa_cfg) 1054 1053 { 1054 + unsigned int hrrq; 1055 + 1055 1056 if (ioa_cfg->hrrq_num == 1) 1056 - return 0; 1057 - else 1058 - return (atomic_add_return(1, &ioa_cfg->hrrq_index) % (ioa_cfg->hrrq_num - 1)) + 1; 1057 + hrrq = 0; 1058 + else { 1059 + hrrq = atomic_add_return(1, &ioa_cfg->hrrq_index); 1060 + hrrq = (hrrq % (ioa_cfg->hrrq_num - 1)) + 1; 1061 + } 1062 + return hrrq; 1059 1063 } 1060 1064 1061 1065 /** ··· 6269 6263 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; 6270 6264 struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; 6271 6265 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); 6272 - unsigned long hrrq_flags; 6266 + unsigned long lock_flags; 6273 6267 6274 6268 scsi_set_resid(scsi_cmd, be32_to_cpu(ipr_cmd->s.ioasa.hdr.residual_data_len)); 6275 6269 6276 6270 if (likely(IPR_IOASC_SENSE_KEY(ioasc) == 0)) { 6277 6271 scsi_dma_unmap(scsi_cmd); 6278 6272 6279 - spin_lock_irqsave(ipr_cmd->hrrq->lock, hrrq_flags); 6273 + spin_lock_irqsave(ipr_cmd->hrrq->lock, lock_flags); 6280 6274 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); 6281 6275 scsi_cmd->scsi_done(scsi_cmd); 6282 - spin_unlock_irqrestore(ipr_cmd->hrrq->lock, hrrq_flags); 6276 + spin_unlock_irqrestore(ipr_cmd->hrrq->lock, lock_flags); 6283 6277 } else { 6284 - spin_lock_irqsave(ipr_cmd->hrrq->lock, hrrq_flags); 6278 + spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); 6279 + spin_lock(&ipr_cmd->hrrq->_lock); 6285 6280 ipr_erp_start(ioa_cfg, ipr_cmd); 6286 - spin_unlock_irqrestore(ipr_cmd->hrrq->lock, hrrq_flags); 6281 + spin_unlock(&ipr_cmd->hrrq->_lock); 6282 + spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 6287 6283 } 6288 6284 } 6289 6285
+1
drivers/scsi/ipr.h
··· 1486 1486 1487 1487 #define IPR_NUM_TRACE_INDEX_BITS 8 1488 1488 #define IPR_NUM_TRACE_ENTRIES (1 << IPR_NUM_TRACE_INDEX_BITS) 1489 + #define IPR_TRACE_INDEX_MASK (IPR_NUM_TRACE_ENTRIES - 1) 1489 1490 #define IPR_TRACE_SIZE (sizeof(struct ipr_trace_entry) * IPR_NUM_TRACE_ENTRIES) 1490 1491 char trace_start[8]; 1491 1492 #define IPR_TRACE_START_LABEL "trace"
+1 -1
drivers/scsi/scsi_error.c
··· 944 944 scmd->sdb.length); 945 945 scmd->sdb.table.sgl = &ses->sense_sgl; 946 946 scmd->sc_data_direction = DMA_FROM_DEVICE; 947 - scmd->sdb.table.nents = 1; 947 + scmd->sdb.table.nents = scmd->sdb.table.orig_nents = 1; 948 948 scmd->cmnd[0] = REQUEST_SENSE; 949 949 scmd->cmnd[4] = scmd->sdb.length; 950 950 scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]);
+3 -3
drivers/scsi/scsi_lib.c
··· 583 583 584 584 static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq) 585 585 { 586 - if (mq && sdb->table.nents <= SCSI_MAX_SG_SEGMENTS) 586 + if (mq && sdb->table.orig_nents <= SCSI_MAX_SG_SEGMENTS) 587 587 return; 588 588 __sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, mq, scsi_sg_free); 589 589 } ··· 597 597 598 598 if (mq) { 599 599 if (nents <= SCSI_MAX_SG_SEGMENTS) { 600 - sdb->table.nents = nents; 601 - sg_init_table(sdb->table.sgl, sdb->table.nents); 600 + sdb->table.nents = sdb->table.orig_nents = nents; 601 + sg_init_table(sdb->table.sgl, nents); 602 602 return 0; 603 603 } 604 604 first_chunk = sdb->table.sgl;
+1
drivers/staging/comedi/drivers/das1800.c
··· 1266 1266 if (index == das1801hc || index == das1802hc) 1267 1267 return board; 1268 1268 index = das1801hc; 1269 + break; 1269 1270 default: 1270 1271 dev_err(dev->class_dev, 1271 1272 "Board model: probe returned 0x%x (unknown, please report)\n",
+1 -1
drivers/staging/lustre/lustre/obdclass/debug.c
··· 40 40 41 41 #define DEBUG_SUBSYSTEM D_OTHER 42 42 43 - #include <linux/unaligned/access_ok.h> 43 + #include <asm/unaligned.h> 44 44 45 45 #include "../include/obd_support.h" 46 46 #include "../include/lustre_debug.h"
+3 -2
drivers/staging/vt6655/device_main.c
··· 1483 1483 } 1484 1484 } 1485 1485 1486 - if (changed & BSS_CHANGED_ASSOC && priv->op_mode != NL80211_IFTYPE_AP) { 1487 - if (conf->assoc) { 1486 + if (changed & (BSS_CHANGED_ASSOC | BSS_CHANGED_BEACON_INFO) && 1487 + priv->op_mode != NL80211_IFTYPE_AP) { 1488 + if (conf->assoc && conf->beacon_rate) { 1488 1489 CARDbUpdateTSF(priv, conf->beacon_rate->hw_value, 1489 1490 conf->sync_tsf); 1490 1491
-1
drivers/thermal/hisi_thermal.c
··· 405 405 static struct platform_driver hisi_thermal_driver = { 406 406 .driver = { 407 407 .name = "hisi_thermal", 408 - .owner = THIS_MODULE, 409 408 .pm = &hisi_thermal_pm_ops, 410 409 .of_match_table = of_hisi_thermal_match, 411 410 },
+16 -10
drivers/thermal/power_allocator.c
··· 229 229 struct thermal_instance *instance; 230 230 struct power_allocator_params *params = tz->governor_data; 231 231 u32 *req_power, *max_power, *granted_power, *extra_actor_power; 232 - u32 total_req_power, max_allocatable_power; 232 + u32 *weighted_req_power; 233 + u32 total_req_power, max_allocatable_power, total_weighted_req_power; 233 234 u32 total_granted_power, power_range; 234 235 int i, num_actors, total_weight, ret = 0; 235 236 int trip_max_desired_temperature = params->trip_max_desired_temperature; ··· 248 247 } 249 248 250 249 /* 251 - * We need to allocate three arrays of the same size: 252 - * req_power, max_power and granted_power. They are going to 253 - * be needed until this function returns. Allocate them all 254 - * in one go to simplify the allocation and deallocation 255 - * logic. 250 + * We need to allocate five arrays of the same size: 251 + * req_power, max_power, granted_power, extra_actor_power and 252 + * weighted_req_power. They are going to be needed until this 253 + * function returns. Allocate them all in one go to simplify 254 + * the allocation and deallocation logic. 256 255 */ 257 256 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*max_power)); 258 257 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*granted_power)); 259 258 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*extra_actor_power)); 260 - req_power = devm_kcalloc(&tz->device, num_actors * 4, 259 + BUILD_BUG_ON(sizeof(*req_power) != sizeof(*weighted_req_power)); 260 + req_power = devm_kcalloc(&tz->device, num_actors * 5, 261 261 sizeof(*req_power), GFP_KERNEL); 262 262 if (!req_power) { 263 263 ret = -ENOMEM; ··· 268 266 max_power = &req_power[num_actors]; 269 267 granted_power = &req_power[2 * num_actors]; 270 268 extra_actor_power = &req_power[3 * num_actors]; 269 + weighted_req_power = &req_power[4 * num_actors]; 271 270 272 271 i = 0; 272 + total_weighted_req_power = 0; 273 273 total_req_power = 0; 274 274 max_allocatable_power = 0; 275 275 ··· 293 289 else 294 290 weight = instance->weight; 295 291 296 - req_power[i] = frac_to_int(weight * req_power[i]); 292 + weighted_req_power[i] = frac_to_int(weight * req_power[i]); 297 293 298 294 if (power_actor_get_max_power(cdev, tz, &max_power[i])) 299 295 continue; 300 296 301 297 total_req_power += req_power[i]; 302 298 max_allocatable_power += max_power[i]; 299 + total_weighted_req_power += weighted_req_power[i]; 303 300 304 301 i++; 305 302 } ··· 308 303 power_range = pid_controller(tz, current_temp, control_temp, 309 304 max_allocatable_power); 310 305 311 - divvy_up_power(req_power, max_power, num_actors, total_req_power, 312 - power_range, granted_power, extra_actor_power); 306 + divvy_up_power(weighted_req_power, max_power, num_actors, 307 + total_weighted_req_power, power_range, granted_power, 308 + extra_actor_power); 313 309 314 310 total_granted_power = 0; 315 311 i = 0;
+1 -1
drivers/thermal/samsung/Kconfig
··· 1 1 config EXYNOS_THERMAL 2 2 tristate "Exynos thermal management unit driver" 3 - depends on OF 3 + depends on THERMAL_OF 4 4 help 5 5 If you say yes here you get support for the TMU (Thermal Management 6 6 Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises
+2 -3
drivers/thermal/samsung/exynos_tmu.c
··· 1296 1296 1297 1297 static int exynos_tmu_probe(struct platform_device *pdev) 1298 1298 { 1299 - struct exynos_tmu_platform_data *pdata; 1300 1299 struct exynos_tmu_data *data; 1301 1300 int ret; 1302 1301 ··· 1316 1317 ret = exynos_map_dt_data(pdev); 1317 1318 if (ret) 1318 1319 goto err_sensor; 1319 - 1320 - pdata = data->pdata; 1321 1320 1322 1321 INIT_WORK(&data->irq_work, exynos_tmu_work); 1323 1322 ··· 1389 1392 if (!IS_ERR(data->clk_sec)) 1390 1393 clk_unprepare(data->clk_sec); 1391 1394 err_sensor: 1395 + if (!IS_ERR_OR_NULL(data->regulator)) 1396 + regulator_disable(data->regulator); 1392 1397 thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd); 1393 1398 1394 1399 return ret;
+1
drivers/thermal/thermal_core.c
··· 1333 1333 return -ENODEV; 1334 1334 1335 1335 unbind: 1336 + device_remove_file(&tz->device, &pos->weight_attr); 1336 1337 device_remove_file(&tz->device, &pos->attr); 1337 1338 sysfs_remove_link(&tz->device.kobj, pos->name); 1338 1339 release_idr(&tz->idr, &tz->lock, pos->id);
+12 -1
drivers/usb/chipidea/core.c
··· 1024 1024 }, 1025 1025 }; 1026 1026 1027 - module_platform_driver(ci_hdrc_driver); 1027 + static int __init ci_hdrc_platform_register(void) 1028 + { 1029 + ci_hdrc_host_driver_init(); 1030 + return platform_driver_register(&ci_hdrc_driver); 1031 + } 1032 + module_init(ci_hdrc_platform_register); 1033 + 1034 + static void __exit ci_hdrc_platform_unregister(void) 1035 + { 1036 + platform_driver_unregister(&ci_hdrc_driver); 1037 + } 1038 + module_exit(ci_hdrc_platform_unregister); 1028 1039 1029 1040 MODULE_ALIAS("platform:ci_hdrc"); 1030 1041 MODULE_LICENSE("GPL v2");
+5 -2
drivers/usb/chipidea/host.c
··· 249 249 rdrv->name = "host"; 250 250 ci->roles[CI_ROLE_HOST] = rdrv; 251 251 252 + return 0; 253 + } 254 + 255 + void ci_hdrc_host_driver_init(void) 256 + { 252 257 ehci_init_driver(&ci_ehci_hc_driver, &ehci_ci_overrides); 253 258 orig_bus_suspend = ci_ehci_hc_driver.bus_suspend; 254 259 ci_ehci_hc_driver.bus_suspend = ci_ehci_bus_suspend; 255 - 256 - return 0; 257 260 }
+6
drivers/usb/chipidea/host.h
··· 5 5 6 6 int ci_hdrc_host_init(struct ci_hdrc *ci); 7 7 void ci_hdrc_host_destroy(struct ci_hdrc *ci); 8 + void ci_hdrc_host_driver_init(void); 8 9 9 10 #else 10 11 ··· 15 14 } 16 15 17 16 static inline void ci_hdrc_host_destroy(struct ci_hdrc *ci) 17 + { 18 + 19 + } 20 + 21 + static void ci_hdrc_host_driver_init(void) 18 22 { 19 23 20 24 }
+4
drivers/usb/gadget/function/f_hid.c
··· 699 699 int ret; 700 700 701 701 ret = ida_simple_get(&hidg_ida, 0, 0, GFP_KERNEL); 702 + if (ret >= HIDG_MINORS) { 703 + ida_simple_remove(&hidg_ida, ret); 704 + ret = -ENODEV; 705 + } 702 706 703 707 return ret; 704 708 }
+9 -1
drivers/usb/gadget/function/f_printer.c
··· 1248 1248 1249 1249 static inline int gprinter_get_minor(void) 1250 1250 { 1251 - return ida_simple_get(&printer_ida, 0, 0, GFP_KERNEL); 1251 + int ret; 1252 + 1253 + ret = ida_simple_get(&printer_ida, 0, 0, GFP_KERNEL); 1254 + if (ret >= PRINTER_MINORS) { 1255 + ida_simple_remove(&printer_ida, ret); 1256 + ret = -ENODEV; 1257 + } 1258 + 1259 + return ret; 1252 1260 } 1253 1261 1254 1262 static inline void gprinter_put_minor(int minor)
+2 -2
drivers/usb/gadget/function/f_uac2.c
··· 1162 1162 factor = 1000; 1163 1163 } else { 1164 1164 ep_desc = &hs_epin_desc; 1165 - factor = 125; 1165 + factor = 8000; 1166 1166 } 1167 1167 1168 1168 /* pre-compute some values for iso_complete() */ 1169 1169 uac2->p_framesize = opts->p_ssize * 1170 1170 num_channels(opts->p_chmask); 1171 1171 rate = opts->p_srate * uac2->p_framesize; 1172 - uac2->p_interval = (1 << (ep_desc->bInterval - 1)) * factor; 1172 + uac2->p_interval = factor / (1 << (ep_desc->bInterval - 1)); 1173 1173 uac2->p_pktsize = min_t(unsigned int, rate / uac2->p_interval, 1174 1174 prm->max_psize); 1175 1175
+1 -1
drivers/usb/gadget/udc/bdc/bdc_ep.c
··· 779 779 /* The current hw dequeue pointer */ 780 780 tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(0)); 781 781 deq_ptr_64 = tmp_32; 782 - tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(1)); 782 + tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS1(0)); 783 783 deq_ptr_64 |= ((u64)tmp_32 << 32); 784 784 785 785 /* we have the dma addr of next bd that will be fetched by hardware */
+1
drivers/usb/gadget/udc/udc-core.c
··· 323 323 324 324 err3: 325 325 put_device(&udc->dev); 326 + device_del(&gadget->dev); 326 327 327 328 err2: 328 329 put_device(&gadget->dev);
+2 -1
drivers/usb/host/xhci-mem.c
··· 1792 1792 int size; 1793 1793 int i, j, num_ports; 1794 1794 1795 - del_timer_sync(&xhci->cmd_timer); 1795 + if (timer_pending(&xhci->cmd_timer)) 1796 + del_timer_sync(&xhci->cmd_timer); 1796 1797 1797 1798 /* Free the Event Ring Segment Table and the actual Event Ring */ 1798 1799 size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries);
+1 -1
drivers/usb/host/xhci-ring.c
··· 82 82 return 0; 83 83 /* offset in TRBs */ 84 84 segment_offset = trb - seg->trbs; 85 - if (segment_offset > TRBS_PER_SEGMENT) 85 + if (segment_offset >= TRBS_PER_SEGMENT) 86 86 return 0; 87 87 return seg->dma + (segment_offset * sizeof(*trb)); 88 88 }
+2
drivers/usb/serial/option.c
··· 1099 1099 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ 1100 1100 { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x68c0, 0xff), 1101 1101 .driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC73xx */ 1102 + { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x9041, 0xff), 1103 + .driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC7305/MC7355 */ 1102 1104 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, 1103 1105 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, 1104 1106 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),
+1 -1
drivers/usb/serial/qcserial.c
··· 145 145 {DEVICE_SWI(0x1199, 0x901c)}, /* Sierra Wireless EM7700 */ 146 146 {DEVICE_SWI(0x1199, 0x901f)}, /* Sierra Wireless EM7355 */ 147 147 {DEVICE_SWI(0x1199, 0x9040)}, /* Sierra Wireless Modem */ 148 - {DEVICE_SWI(0x1199, 0x9041)}, /* Sierra Wireless MC7305/MC7355 */ 149 148 {DEVICE_SWI(0x1199, 0x9051)}, /* Netgear AirCard 340U */ 150 149 {DEVICE_SWI(0x1199, 0x9053)}, /* Sierra Wireless Modem */ 151 150 {DEVICE_SWI(0x1199, 0x9054)}, /* Sierra Wireless Modem */ ··· 157 158 {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ 158 159 {DEVICE_SWI(0x413c, 0x81a8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ 159 160 {DEVICE_SWI(0x413c, 0x81a9)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ 161 + {DEVICE_SWI(0x413c, 0x81b1)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */ 160 162 161 163 /* Huawei devices */ 162 164 {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
+1
drivers/usb/serial/sierra.c
··· 289 289 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF), 290 290 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist 291 291 }, 292 + { USB_DEVICE(0x1199, 0x68AB) }, /* Sierra Wireless AR8550 */ 292 293 /* AT&T Direct IP LTE modems */ 293 294 { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), 294 295 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
+2 -1
drivers/video/console/fbcon.c
··· 1306 1306 int y; 1307 1307 int c = scr_readw((u16 *) vc->vc_pos); 1308 1308 1309 + ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); 1310 + 1309 1311 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) 1310 1312 return; 1311 1313 1312 - ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); 1313 1314 if (vc->vc_cursor_type & 0x10) 1314 1315 fbcon_del_cursor_timer(info); 1315 1316 else
+1 -1
drivers/video/fbdev/Kconfig
··· 298 298 299 299 # Helper logic selected only by the ARM Versatile platform family. 300 300 config PLAT_VERSATILE_CLCD 301 - def_bool ARCH_VERSATILE || ARCH_REALVIEW || ARCH_VEXPRESS 301 + def_bool ARCH_VERSATILE || ARCH_REALVIEW || ARCH_VEXPRESS || ARCH_INTEGRATOR 302 302 depends on ARM 303 303 depends on FB_ARMCLCD && FB=y 304 304
+3 -1
drivers/video/fbdev/omap2/dss/dss-of.c
··· 60 60 } 61 61 prev = port; 62 62 } while (of_node_cmp(port->name, "port") != 0); 63 + 64 + of_node_put(ports); 63 65 } 64 66 65 67 return port; ··· 96 94 if (!port) 97 95 return NULL; 98 96 99 - np = of_get_next_parent(port); 97 + np = of_get_parent(port); 100 98 101 99 for (i = 0; i < 2 && np; ++i) { 102 100 struct property *prop;
+2 -2
drivers/video/fbdev/pxa3xx-gcu.c
··· 653 653 goto err_free_dma; 654 654 } 655 655 656 - ret = clk_enable(priv->clk); 656 + ret = clk_prepare_enable(priv->clk); 657 657 if (ret < 0) { 658 658 dev_err(dev, "failed to enable clock\n"); 659 659 goto err_misc_deregister; ··· 685 685 misc_deregister(&priv->misc_dev); 686 686 687 687 err_disable_clk: 688 - clk_disable(priv->clk); 688 + clk_disable_unprepare(priv->clk); 689 689 690 690 return ret; 691 691 }
+1 -3
drivers/video/of_videomode.c
··· 44 44 index = disp->native_mode; 45 45 46 46 ret = videomode_from_timings(disp, vm, index); 47 - if (ret) 48 - return ret; 49 47 50 48 display_timings_release(disp); 51 49 52 - return 0; 50 + return ret; 53 51 } 54 52 EXPORT_SYMBOL_GPL(of_get_videomode);
+4
drivers/virtio/virtio_input.c
··· 313 313 static void virtinput_remove(struct virtio_device *vdev) 314 314 { 315 315 struct virtio_input *vi = vdev->priv; 316 + void *buf; 316 317 unsigned long flags; 317 318 318 319 spin_lock_irqsave(&vi->lock, flags); ··· 321 320 spin_unlock_irqrestore(&vi->lock, flags); 322 321 323 322 input_unregister_device(vi->idev); 323 + vdev->config->reset(vdev); 324 + while ((buf = virtqueue_detach_unused_buf(vi->sts)) != NULL) 325 + kfree(buf); 324 326 vdev->config->del_vqs(vdev); 325 327 kfree(vi); 326 328 }
+7 -8
drivers/xen/balloon.c
··· 472 472 } 473 473 474 474 /* 475 - * We avoid multiple worker processes conflicting via the balloon mutex. 475 + * As this is a work item it is guaranteed to run as a single instance only. 476 476 * We may of course race updates of the target counts (which are protected 477 477 * by the balloon lock), or with changes to the Xen hard limit, but we will 478 478 * recover from these in time. ··· 482 482 enum bp_state state = BP_DONE; 483 483 long credit; 484 484 485 - mutex_lock(&balloon_mutex); 486 485 487 486 do { 487 + mutex_lock(&balloon_mutex); 488 + 488 489 credit = current_credit(); 489 490 490 491 if (credit > 0) { ··· 500 499 501 500 state = update_schedule(state); 502 501 503 - #ifndef CONFIG_PREEMPT 504 - if (need_resched()) 505 - schedule(); 506 - #endif 502 + mutex_unlock(&balloon_mutex); 503 + 504 + cond_resched(); 505 + 507 506 } while (credit && state == BP_DONE); 508 507 509 508 /* Schedule more work if there is some still to be done. */ 510 509 if (state == BP_EAGAIN) 511 510 schedule_delayed_work(&balloon_worker, balloon_stats.schedule_delay * HZ); 512 - 513 - mutex_unlock(&balloon_mutex); 514 511 } 515 512 516 513 /* Resets the Xen limit, sets new target, and kicks off processing. */
+2
drivers/xen/gntdev.c
··· 568 568 569 569 pr_debug("priv %p\n", priv); 570 570 571 + mutex_lock(&priv->lock); 571 572 while (!list_empty(&priv->maps)) { 572 573 map = list_entry(priv->maps.next, struct grant_map, next); 573 574 list_del(&map->next); 574 575 gntdev_put_map(NULL /* already removed */, map); 575 576 } 576 577 WARN_ON(!list_empty(&priv->freeable_maps)); 578 + mutex_unlock(&priv->lock); 577 579 578 580 if (use_ptemod) 579 581 mmu_notifier_unregister(&priv->mn, priv->mm);
+3 -1
drivers/xen/xenbus/xenbus_client.c
··· 814 814 815 815 rv = xenbus_unmap_ring(dev, node->handles, node->nr_handles, 816 816 addrs); 817 - if (!rv) 817 + if (!rv) { 818 818 vunmap(vaddr); 819 + free_xenballooned_pages(node->nr_handles, node->hvm.pages); 820 + } 819 821 else 820 822 WARN(1, "Leaking %p, size %u page(s)\n", vaddr, 821 823 node->nr_handles);
+5
fs/btrfs/qgroup.c
··· 1651 1651 /* Exclusive -> exclusive, nothing changed */ 1652 1652 } 1653 1653 } 1654 + 1655 + /* For exclusive extent, free its reserved bytes too */ 1656 + if (nr_old_roots == 0 && nr_new_roots == 1 && 1657 + cur_new_count == nr_new_roots) 1658 + qg->reserved -= num_bytes; 1654 1659 if (dirty) 1655 1660 qgroup_dirty(fs_info, qg); 1656 1661 }
+5 -17
fs/ceph/caps.c
··· 1506 1506 1507 1507 swap(cf, ci->i_prealloc_cap_flush); 1508 1508 cf->caps = flushing; 1509 - cf->kick = false; 1510 1509 1511 1510 spin_lock(&mdsc->cap_dirty_lock); 1512 1511 list_del_init(&ci->i_dirty_item); ··· 2122 2123 2123 2124 static int __kick_flushing_caps(struct ceph_mds_client *mdsc, 2124 2125 struct ceph_mds_session *session, 2125 - struct ceph_inode_info *ci, 2126 - bool kick_all) 2126 + struct ceph_inode_info *ci) 2127 2127 { 2128 2128 struct inode *inode = &ci->vfs_inode; 2129 2129 struct ceph_cap *cap; ··· 2148 2150 2149 2151 for (n = rb_first(&ci->i_cap_flush_tree); n; n = rb_next(n)) { 2150 2152 cf = rb_entry(n, struct ceph_cap_flush, i_node); 2151 - if (cf->tid < first_tid) 2152 - continue; 2153 - if (kick_all || cf->kick) 2153 + if (cf->tid >= first_tid) 2154 2154 break; 2155 2155 } 2156 2156 if (!n) { ··· 2157 2161 } 2158 2162 2159 2163 cf = rb_entry(n, struct ceph_cap_flush, i_node); 2160 - cf->kick = false; 2161 2164 2162 2165 first_tid = cf->tid + 1; 2163 2166 ··· 2176 2181 { 2177 2182 struct ceph_inode_info *ci; 2178 2183 struct ceph_cap *cap; 2179 - struct ceph_cap_flush *cf; 2180 - struct rb_node *n; 2181 2184 2182 2185 dout("early_kick_flushing_caps mds%d\n", session->s_mds); 2183 2186 list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) { ··· 2198 2205 if ((cap->issued & ci->i_flushing_caps) != 2199 2206 ci->i_flushing_caps) { 2200 2207 spin_unlock(&ci->i_ceph_lock); 2201 - if (!__kick_flushing_caps(mdsc, session, ci, true)) 2208 + if (!__kick_flushing_caps(mdsc, session, ci)) 2202 2209 continue; 2203 2210 spin_lock(&ci->i_ceph_lock); 2204 - } 2205 - 2206 - for (n = rb_first(&ci->i_cap_flush_tree); n; n = rb_next(n)) { 2207 - cf = rb_entry(n, struct ceph_cap_flush, i_node); 2208 - cf->kick = true; 2209 2211 } 2210 2212 2211 2213 spin_unlock(&ci->i_ceph_lock); ··· 2216 2228 2217 2229 dout("kick_flushing_caps mds%d\n", session->s_mds); 2218 2230 list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) { 2219 - int delayed = __kick_flushing_caps(mdsc, session, ci, false); 2231 + int delayed = __kick_flushing_caps(mdsc, session, ci); 2220 2232 if (delayed) { 2221 2233 spin_lock(&ci->i_ceph_lock); 2222 2234 __cap_delay_requeue(mdsc, ci); ··· 2249 2261 2250 2262 spin_unlock(&ci->i_ceph_lock); 2251 2263 2252 - delayed = __kick_flushing_caps(mdsc, session, ci, true); 2264 + delayed = __kick_flushing_caps(mdsc, session, ci); 2253 2265 if (delayed) { 2254 2266 spin_lock(&ci->i_ceph_lock); 2255 2267 __cap_delay_requeue(mdsc, ci);
+1 -1
fs/ceph/locks.c
··· 287 287 return 0; 288 288 289 289 spin_lock(&ctx->flc_lock); 290 - list_for_each_entry(lock, &ctx->flc_flock, fl_list) { 290 + list_for_each_entry(lock, &ctx->flc_posix, fl_list) { 291 291 ++seen_fcntl; 292 292 if (seen_fcntl > num_fcntl_locks) { 293 293 err = -ENOSPC;
-1
fs/ceph/super.h
··· 189 189 struct ceph_cap_flush { 190 190 u64 tid; 191 191 int caps; 192 - bool kick; 193 192 struct rb_node g_node; // global 194 193 union { 195 194 struct rb_node i_node; // inode
+3 -10
fs/dcache.c
··· 3442 3442 inode_init_early(); 3443 3443 } 3444 3444 3445 - void __init vfs_caches_init(unsigned long mempages) 3445 + void __init vfs_caches_init(void) 3446 3446 { 3447 - unsigned long reserve; 3448 - 3449 - /* Base hash sizes on available memory, with a reserve equal to 3450 - 150% of current kernel size */ 3451 - 3452 - reserve = min((mempages - nr_free_pages()) * 3/2, mempages - 1); 3453 - mempages -= reserve; 3454 - 3455 3447 names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0, 3456 3448 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); 3457 3449 3458 3450 dcache_init(); 3459 3451 inode_init(); 3460 - files_init(mempages); 3452 + files_init(); 3453 + files_maxfiles_init(); 3461 3454 mnt_init(); 3462 3455 bdev_cache_init(); 3463 3456 chrdev_init();
+17 -11
fs/file_table.c
··· 25 25 #include <linux/hardirq.h> 26 26 #include <linux/task_work.h> 27 27 #include <linux/ima.h> 28 + #include <linux/swap.h> 28 29 29 30 #include <linux/atomic.h> 30 31 ··· 309 308 } 310 309 } 311 310 312 - void __init files_init(unsigned long mempages) 311 + void __init files_init(void) 313 312 { 314 - unsigned long n; 315 - 316 313 filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0, 317 314 SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); 318 - 319 - /* 320 - * One file with associated inode and dcache is very roughly 1K. 321 - * Per default don't use more than 10% of our memory for files. 322 - */ 323 - 324 - n = (mempages * (PAGE_SIZE / 1024)) / 10; 325 - files_stat.max_files = max_t(unsigned long, n, NR_FILE); 326 315 percpu_counter_init(&nr_files, 0, GFP_KERNEL); 316 + } 317 + 318 + /* 319 + * One file with associated inode and dcache is very roughly 1K. Per default 320 + * do not use more than 10% of our memory for files. 321 + */ 322 + void __init files_maxfiles_init(void) 323 + { 324 + unsigned long n; 325 + unsigned long memreserve = (totalram_pages - nr_free_pages()) * 3/2; 326 + 327 + memreserve = min(memreserve, totalram_pages - 1); 328 + n = ((totalram_pages - memreserve) * (PAGE_SIZE / 1024)) / 10; 329 + 330 + files_stat.max_files = max_t(unsigned long, n, NR_FILE); 327 331 }
+2
fs/hugetlbfs/inode.c
··· 1010 1010 inode = hugetlbfs_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0); 1011 1011 if (!inode) 1012 1012 goto out_dentry; 1013 + if (creat_flags == HUGETLB_SHMFS_INODE) 1014 + inode->i_flags |= S_PRIVATE; 1013 1015 1014 1016 file = ERR_PTR(-ENOMEM); 1015 1017 if (hugetlb_reserve_pages(inode, 0,
+7 -2
fs/namei.c
··· 879 879 return 0; 880 880 881 881 /* Allowed if parent directory not sticky and world-writable. */ 882 - parent = nd->path.dentry->d_inode; 882 + parent = nd->inode; 883 883 if ((parent->i_mode & (S_ISVTX|S_IWOTH)) != (S_ISVTX|S_IWOTH)) 884 884 return 0; 885 885 ··· 1954 1954 continue; 1955 1955 } 1956 1956 } 1957 - if (unlikely(!d_can_lookup(nd->path.dentry))) 1957 + if (unlikely(!d_can_lookup(nd->path.dentry))) { 1958 + if (nd->flags & LOOKUP_RCU) { 1959 + if (unlazy_walk(nd, NULL, 0)) 1960 + return -ECHILD; 1961 + } 1958 1962 return -ENOTDIR; 1963 + } 1959 1964 } 1960 1965 } 1961 1966
+1
fs/nfsd/nfs4layouts.c
··· 212 212 BUG_ON(!ls->ls_file); 213 213 214 214 if (nfsd4_layout_setlease(ls)) { 215 + fput(ls->ls_file); 215 216 put_nfs4_file(fp); 216 217 kmem_cache_free(nfs4_layout_stateid_cache, ls); 217 218 return NULL;
+6 -6
fs/nfsd/nfs4state.c
··· 4396 4396 queue_delayed_work(laundry_wq, &nn->laundromat_work, t*HZ); 4397 4397 } 4398 4398 4399 - static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_ol_stateid *stp) 4399 + static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stid *stp) 4400 4400 { 4401 - if (!fh_match(&fhp->fh_handle, &stp->st_stid.sc_file->fi_fhandle)) 4401 + if (!fh_match(&fhp->fh_handle, &stp->sc_file->fi_fhandle)) 4402 4402 return nfserr_bad_stateid; 4403 4403 return nfs_ok; 4404 4404 } ··· 4601 4601 { 4602 4602 __be32 status; 4603 4603 4604 - status = nfs4_check_fh(fhp, ols); 4605 - if (status) 4606 - return status; 4607 4604 status = nfsd4_check_openowner_confirmed(ols); 4608 4605 if (status) 4609 4606 return status; ··· 4687 4690 status = nfserr_bad_stateid; 4688 4691 break; 4689 4692 } 4693 + if (status) 4694 + goto out; 4695 + status = nfs4_check_fh(fhp, s); 4690 4696 4691 4697 done: 4692 4698 if (!status && filpp) ··· 4798 4798 status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate)); 4799 4799 if (status) 4800 4800 return status; 4801 - return nfs4_check_fh(current_fh, stp); 4801 + return nfs4_check_fh(current_fh, &stp->st_stid); 4802 4802 } 4803 4803 4804 4804 /*
+6 -5
fs/nfsd/nfs4xdr.c
··· 2143 2143 #define WORD0_ABSENT_FS_ATTRS (FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_FSID | \ 2144 2144 FATTR4_WORD0_RDATTR_ERROR) 2145 2145 #define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID 2146 + #define WORD2_ABSENT_FS_ATTRS 0 2146 2147 2147 2148 #ifdef CONFIG_NFSD_V4_SECURITY_LABEL 2148 2149 static inline __be32 ··· 2172 2171 { return 0; } 2173 2172 #endif 2174 2173 2175 - static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err) 2174 + static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *bmval2, u32 *rdattr_err) 2176 2175 { 2177 2176 /* As per referral draft: */ 2178 2177 if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS || ··· 2185 2184 } 2186 2185 *bmval0 &= WORD0_ABSENT_FS_ATTRS; 2187 2186 *bmval1 &= WORD1_ABSENT_FS_ATTRS; 2187 + *bmval2 &= WORD2_ABSENT_FS_ATTRS; 2188 2188 return 0; 2189 2189 } 2190 2190 ··· 2248 2246 BUG_ON(bmval2 & ~nfsd_suppattrs2(minorversion)); 2249 2247 2250 2248 if (exp->ex_fslocs.migrated) { 2251 - BUG_ON(bmval[2]); 2252 - status = fattr_handle_absent_fs(&bmval0, &bmval1, &rdattr_err); 2249 + status = fattr_handle_absent_fs(&bmval0, &bmval1, &bmval2, &rdattr_err); 2253 2250 if (status) 2254 2251 goto out; 2255 2252 } ··· 2287 2286 } 2288 2287 2289 2288 #ifdef CONFIG_NFSD_V4_SECURITY_LABEL 2290 - if ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) || 2291 - bmval[0] & FATTR4_WORD0_SUPPORTED_ATTRS) { 2289 + if ((bmval2 & FATTR4_WORD2_SECURITY_LABEL) || 2290 + bmval0 & FATTR4_WORD0_SUPPORTED_ATTRS) { 2292 2291 err = security_inode_getsecctx(d_inode(dentry), 2293 2292 &context, &contextlen); 2294 2293 contextsupport = (err == 0);
+25 -5
fs/notify/mark.c
··· 412 412 unsigned int flags) 413 413 { 414 414 struct fsnotify_mark *lmark, *mark; 415 + LIST_HEAD(to_free); 415 416 417 + /* 418 + * We have to be really careful here. Anytime we drop mark_mutex, e.g. 419 + * fsnotify_clear_marks_by_inode() can come and free marks. Even in our 420 + * to_free list so we have to use mark_mutex even when accessing that 421 + * list. And freeing mark requires us to drop mark_mutex. So we can 422 + * reliably free only the first mark in the list. That's why we first 423 + * move marks to free to to_free list in one go and then free marks in 424 + * to_free list one by one. 425 + */ 416 426 mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING); 417 427 list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) { 418 - if (mark->flags & flags) { 419 - fsnotify_get_mark(mark); 420 - fsnotify_destroy_mark_locked(mark, group); 421 - fsnotify_put_mark(mark); 422 - } 428 + if (mark->flags & flags) 429 + list_move(&mark->g_list, &to_free); 423 430 } 424 431 mutex_unlock(&group->mark_mutex); 432 + 433 + while (1) { 434 + mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING); 435 + if (list_empty(&to_free)) { 436 + mutex_unlock(&group->mark_mutex); 437 + break; 438 + } 439 + mark = list_first_entry(&to_free, struct fsnotify_mark, g_list); 440 + fsnotify_get_mark(mark); 441 + fsnotify_destroy_mark_locked(mark, group); 442 + mutex_unlock(&group->mark_mutex); 443 + fsnotify_put_mark(mark); 444 + } 425 445 } 426 446 427 447 /*
+2 -2
fs/ocfs2/aops.c
··· 685 685 686 686 if (p_cpos && !(ext_flags & OCFS2_EXT_UNWRITTEN)) { 687 687 u64 s = i_size_read(inode); 688 - sector_t sector = (p_cpos << (osb->s_clustersize_bits - 9)) + 688 + sector_t sector = ((u64)p_cpos << (osb->s_clustersize_bits - 9)) + 689 689 (do_div(s, osb->s_clustersize) >> 9); 690 690 691 691 ret = blkdev_issue_zeroout(osb->sb->s_bdev, sector, ··· 910 910 BUG_ON(!p_cpos || (ext_flags & OCFS2_EXT_UNWRITTEN)); 911 911 912 912 ret = blkdev_issue_zeroout(osb->sb->s_bdev, 913 - p_cpos << (osb->s_clustersize_bits - 9), 913 + (u64)p_cpos << (osb->s_clustersize_bits - 9), 914 914 zero_len_head >> 9, GFP_NOFS, false); 915 915 if (ret < 0) 916 916 mlog_errno(ret);
+7 -3
fs/ocfs2/dlmglue.c
··· 4025 4025 osb->dc_work_sequence = osb->dc_wake_sequence; 4026 4026 4027 4027 processed = osb->blocked_lock_count; 4028 - while (processed) { 4029 - BUG_ON(list_empty(&osb->blocked_lock_list)); 4030 - 4028 + /* 4029 + * blocked lock processing in this loop might call iput which can 4030 + * remove items off osb->blocked_lock_list. Downconvert up to 4031 + * 'processed' number of locks, but stop short if we had some 4032 + * removed in ocfs2_mark_lockres_freeing when downconverting. 4033 + */ 4034 + while (processed && !list_empty(&osb->blocked_lock_list)) { 4031 4035 lockres = list_entry(osb->blocked_lock_list.next, 4032 4036 struct ocfs2_lock_res, l_blocked_list); 4033 4037 list_del_init(&lockres->l_blocked_list);
+3 -2
fs/signalfd.c
··· 121 121 * Other callers might not initialize the si_lsb field, 122 122 * so check explicitly for the right codes here. 123 123 */ 124 - if (kinfo->si_code == BUS_MCEERR_AR || 125 - kinfo->si_code == BUS_MCEERR_AO) 124 + if (kinfo->si_signo == SIGBUS && 125 + (kinfo->si_code == BUS_MCEERR_AR || 126 + kinfo->si_code == BUS_MCEERR_AO)) 126 127 err |= __put_user((short) kinfo->si_addr_lsb, 127 128 &uinfo->ssi_addr_lsb); 128 129 #endif
+1 -1
include/drm/drmP.h
··· 691 691 struct timer_list disable_timer; /* delayed disable timer */ 692 692 693 693 /* vblank counter, protected by dev->vblank_time_lock for writes */ 694 - unsigned long count; 694 + u32 count; 695 695 /* vblank timestamps, protected by dev->vblank_time_lock for writes */ 696 696 struct timeval time[DRM_VBLANKTIME_RBSIZE]; 697 697
+3
include/drm/drm_crtc_helper.h
··· 168 168 * @get_modes: get mode list for this connector 169 169 * @mode_valid: is this mode valid on the given connector? (optional) 170 170 * @best_encoder: return the preferred encoder for this connector 171 + * @atomic_best_encoder: atomic version of @best_encoder 171 172 * 172 173 * The helper operations are called by the mid-layer CRTC helper. 173 174 */ ··· 177 176 enum drm_mode_status (*mode_valid)(struct drm_connector *connector, 178 177 struct drm_display_mode *mode); 179 178 struct drm_encoder *(*best_encoder)(struct drm_connector *connector); 179 + struct drm_encoder *(*atomic_best_encoder)(struct drm_connector *connector, 180 + struct drm_connector_state *connector_state); 180 181 }; 181 182 182 183 extern void drm_helper_disable_unused_functions(struct drm_device *dev);
+1
include/drm/drm_pciids.h
··· 172 172 {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ 173 173 {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ 174 174 {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ 175 + {0x1002, 0x6617, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 175 176 {0x1002, 0x6620, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 176 177 {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 177 178 {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+3 -2
include/linux/fs.h
··· 55 55 56 56 extern void __init inode_init(void); 57 57 extern void __init inode_init_early(void); 58 - extern void __init files_init(unsigned long); 58 + extern void __init files_init(void); 59 + extern void __init files_maxfiles_init(void); 59 60 60 61 extern struct files_stat_struct files_stat; 61 62 extern unsigned long get_max_files(void); ··· 2246 2245 2247 2246 /* fs/dcache.c */ 2248 2247 extern void __init vfs_caches_init_early(void); 2249 - extern void __init vfs_caches_init(unsigned long); 2248 + extern void __init vfs_caches_init(void); 2250 2249 2251 2250 extern struct kmem_cache *names_cachep; 2252 2251
+7 -3
include/linux/page-flags.h
··· 631 631 1 << PG_private | 1 << PG_private_2 | \ 632 632 1 << PG_writeback | 1 << PG_reserved | \ 633 633 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ 634 - 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON | \ 634 + 1 << PG_unevictable | __PG_MLOCKED | \ 635 635 __PG_COMPOUND_LOCK) 636 636 637 637 /* 638 638 * Flags checked when a page is prepped for return by the page allocator. 639 - * Pages being prepped should not have any flags set. It they are set, 639 + * Pages being prepped should not have these flags set. It they are set, 640 640 * there has been a kernel bug or struct page corruption. 641 + * 642 + * __PG_HWPOISON is exceptional because it needs to be kept beyond page's 643 + * alloc-free cycle to prevent from reusing the page. 641 644 */ 642 - #define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1) 645 + #define PAGE_FLAGS_CHECK_AT_PREP \ 646 + (((1 << NR_PAGEFLAGS) - 1) & ~__PG_HWPOISON) 643 647 644 648 #define PAGE_FLAGS_PRIVATE \ 645 649 (1 << PG_private | 1 << PG_private_2)
+3 -3
include/linux/skbuff.h
··· 2913 2913 * 2914 2914 * PHY drivers may accept clones of transmitted packets for 2915 2915 * timestamping via their phy_driver.txtstamp method. These drivers 2916 - * must call this function to return the skb back to the stack, with 2917 - * or without a timestamp. 2916 + * must call this function to return the skb back to the stack with a 2917 + * timestamp. 2918 2918 * 2919 2919 * @skb: clone of the the original outgoing packet 2920 - * @hwtstamps: hardware time stamps, may be NULL if not available 2920 + * @hwtstamps: hardware time stamps 2921 2921 * 2922 2922 */ 2923 2923 void skb_complete_tx_timestamp(struct sk_buff *skb,
+1
include/uapi/linux/pci_regs.h
··· 319 319 #define PCI_MSIX_PBA 8 /* Pending Bit Array offset */ 320 320 #define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */ 321 321 #define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */ 322 + #define PCI_MSIX_FLAGS_BIRMASK PCI_MSIX_PBA_BIR /* deprecated */ 322 323 #define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ 323 324 324 325 /* MSI-X Table entry format */
+24 -11
include/uapi/sound/asoc.h
··· 77 77 #define SND_SOC_TPLG_NUM_TEXTS 16 78 78 79 79 /* ABI version */ 80 - #define SND_SOC_TPLG_ABI_VERSION 0x2 80 + #define SND_SOC_TPLG_ABI_VERSION 0x3 81 81 82 82 /* Max size of TLV data */ 83 83 #define SND_SOC_TPLG_TLV_SIZE 32 ··· 97 97 #define SND_SOC_TPLG_TYPE_PCM 7 98 98 #define SND_SOC_TPLG_TYPE_MANIFEST 8 99 99 #define SND_SOC_TPLG_TYPE_CODEC_LINK 9 100 - #define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_CODEC_LINK 100 + #define SND_SOC_TPLG_TYPE_PDATA 10 101 + #define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_PDATA 101 102 102 103 /* vendor block IDs - please add new vendor types to end */ 103 104 #define SND_SOC_TPLG_TYPE_VENDOR_FW 1000 ··· 138 137 /* 139 138 * Kcontrol TLV data. 140 139 */ 140 + struct snd_soc_tplg_tlv_dbscale { 141 + __le32 min; 142 + __le32 step; 143 + __le32 mute; 144 + } __attribute__((packed)); 145 + 141 146 struct snd_soc_tplg_ctl_tlv { 142 - __le32 size; /* in bytes aligned to 4 */ 143 - __le32 numid; /* control element numeric identification */ 144 - __le32 count; /* number of elem in data array */ 145 - __le32 data[SND_SOC_TPLG_TLV_SIZE]; 147 + __le32 size; /* in bytes of this structure */ 148 + __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */ 149 + union { 150 + __le32 data[SND_SOC_TPLG_TLV_SIZE]; 151 + struct snd_soc_tplg_tlv_dbscale scale; 152 + }; 146 153 } __attribute__((packed)); 147 154 148 155 /* ··· 164 155 } __attribute__((packed)); 165 156 166 157 /* 167 - * Kcontrol Operations IDs 158 + * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops 159 + * Kcontrol ops need get/put/info. 160 + * Bytes ext ops need get/put. 168 161 */ 169 - struct snd_soc_tplg_kcontrol_ops_id { 162 + struct snd_soc_tplg_io_ops { 170 163 __le32 get; 171 164 __le32 put; 172 165 __le32 info; ··· 182 171 __le32 type; 183 172 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 184 173 __le32 access; 185 - struct snd_soc_tplg_kcontrol_ops_id ops; 186 - __le32 tlv_size; /* non zero means control has TLV data */ 174 + struct snd_soc_tplg_io_ops ops; 175 + struct snd_soc_tplg_ctl_tlv tlv; 187 176 } __attribute__((packed)); 188 177 189 178 /* ··· 249 238 __le32 graph_elems; /* number of graph elements */ 250 239 __le32 dai_elems; /* number of DAI elements */ 251 240 __le32 dai_link_elems; /* number of DAI link elements */ 241 + struct snd_soc_tplg_private priv; 252 242 } __attribute__((packed)); 253 243 254 244 /* ··· 271 259 __le32 invert; 272 260 __le32 num_channels; 273 261 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; 274 - struct snd_soc_tplg_ctl_tlv tlv; 275 262 struct snd_soc_tplg_private priv; 276 263 } __attribute__((packed)); 277 264 ··· 314 303 __le32 mask; 315 304 __le32 base; 316 305 __le32 num_regs; 306 + struct snd_soc_tplg_io_ops ext_ops; 317 307 struct snd_soc_tplg_private priv; 318 308 } __attribute__((packed)); 319 309 ··· 359 347 __le32 reg; /* negative reg = no direct dapm */ 360 348 __le32 shift; /* bits to shift */ 361 349 __le32 mask; /* non-shifted mask */ 350 + __le32 subseq; /* sort within widget type */ 362 351 __u32 invert; /* invert the power bit */ 363 352 __u32 ignore_suspend; /* kept enabled over suspend */ 364 353 __u16 event_flags;
+1 -1
init/main.c
··· 656 656 key_init(); 657 657 security_init(); 658 658 dbg_late_init(); 659 - vfs_caches_init(totalram_pages); 659 + vfs_caches_init(); 660 660 signals_init(); 661 661 /* rootfs populating might need page-writeback */ 662 662 page_writeback_init();
-5
ipc/mqueue.c
··· 142 142 if (!leaf) 143 143 return -ENOMEM; 144 144 INIT_LIST_HEAD(&leaf->msg_list); 145 - info->qsize += sizeof(*leaf); 146 145 } 147 146 leaf->priority = msg->m_type; 148 147 rb_link_node(&leaf->rb_node, parent, p); ··· 186 187 "lazy leaf delete!\n"); 187 188 rb_erase(&leaf->rb_node, &info->msg_tree); 188 189 if (info->node_cache) { 189 - info->qsize -= sizeof(*leaf); 190 190 kfree(leaf); 191 191 } else { 192 192 info->node_cache = leaf; ··· 198 200 if (list_empty(&leaf->msg_list)) { 199 201 rb_erase(&leaf->rb_node, &info->msg_tree); 200 202 if (info->node_cache) { 201 - info->qsize -= sizeof(*leaf); 202 203 kfree(leaf); 203 204 } else { 204 205 info->node_cache = leaf; ··· 1031 1034 /* Save our speculative allocation into the cache */ 1032 1035 INIT_LIST_HEAD(&new_leaf->msg_list); 1033 1036 info->node_cache = new_leaf; 1034 - info->qsize += sizeof(*new_leaf); 1035 1037 new_leaf = NULL; 1036 1038 } else { 1037 1039 kfree(new_leaf); ··· 1138 1142 /* Save our speculative allocation into the cache */ 1139 1143 INIT_LIST_HEAD(&new_leaf->msg_list); 1140 1144 info->node_cache = new_leaf; 1141 - info->qsize += sizeof(*new_leaf); 1142 1145 } else { 1143 1146 kfree(new_leaf); 1144 1147 }
+1 -1
ipc/shm.c
··· 545 545 if ((shmflg & SHM_NORESERVE) && 546 546 sysctl_overcommit_memory != OVERCOMMIT_NEVER) 547 547 acctflag = VM_NORESERVE; 548 - file = shmem_file_setup(name, size, acctflag); 548 + file = shmem_kernel_file_setup(name, size, acctflag); 549 549 } 550 550 error = PTR_ERR(file); 551 551 if (IS_ERR(file))
+4
kernel/kthread.c
··· 97 97 { 98 98 return test_bit(KTHREAD_SHOULD_PARK, &to_kthread(current)->flags); 99 99 } 100 + EXPORT_SYMBOL_GPL(kthread_should_park); 100 101 101 102 /** 102 103 * kthread_freezable_should_stop - should this freezable kthread return now? ··· 172 171 { 173 172 __kthread_parkme(to_kthread(current)); 174 173 } 174 + EXPORT_SYMBOL_GPL(kthread_parkme); 175 175 176 176 static int kthread(void *_create) 177 177 { ··· 413 411 if (kthread) 414 412 __kthread_unpark(k, kthread); 415 413 } 414 + EXPORT_SYMBOL_GPL(kthread_unpark); 416 415 417 416 /** 418 417 * kthread_park - park a thread created by kthread_create(). ··· 444 441 } 445 442 return ret; 446 443 } 444 + EXPORT_SYMBOL_GPL(kthread_park); 447 445 448 446 /** 449 447 * kthread_stop - stop a thread created by kthread_create().
+6 -2
kernel/module.c
··· 602 602 } 603 603 EXPORT_SYMBOL_GPL(find_symbol); 604 604 605 - /* Search for module by name: must hold module_mutex. */ 605 + /* 606 + * Search for module by name: must hold module_mutex (or preempt disabled 607 + * for read-only access). 608 + */ 606 609 static struct module *find_module_all(const char *name, size_t len, 607 610 bool even_unformed) 608 611 { 609 612 struct module *mod; 610 613 611 - module_assert_mutex(); 614 + module_assert_mutex_or_preempt(); 612 615 613 616 list_for_each_entry(mod, &modules, list) { 614 617 if (!even_unformed && mod->state == MODULE_STATE_UNFORMED) ··· 624 621 625 622 struct module *find_module(const char *name) 626 623 { 624 + module_assert_mutex(); 627 625 return find_module_all(name, strlen(name), false); 628 626 } 629 627 EXPORT_SYMBOL_GPL(find_module);
+8 -5
kernel/signal.c
··· 2748 2748 * Other callers might not initialize the si_lsb field, 2749 2749 * so check explicitly for the right codes here. 2750 2750 */ 2751 - if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) 2751 + if (from->si_signo == SIGBUS && 2752 + (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)) 2752 2753 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); 2753 2754 #endif 2754 2755 #ifdef SEGV_BNDERR 2755 - err |= __put_user(from->si_lower, &to->si_lower); 2756 - err |= __put_user(from->si_upper, &to->si_upper); 2756 + if (from->si_signo == SIGSEGV && from->si_code == SEGV_BNDERR) { 2757 + err |= __put_user(from->si_lower, &to->si_lower); 2758 + err |= __put_user(from->si_upper, &to->si_upper); 2759 + } 2757 2760 #endif 2758 2761 break; 2759 2762 case __SI_CHLD: ··· 3020 3017 int, sig, 3021 3018 struct compat_siginfo __user *, uinfo) 3022 3019 { 3023 - siginfo_t info; 3020 + siginfo_t info = {}; 3024 3021 int ret = copy_siginfo_from_user32(&info, uinfo); 3025 3022 if (unlikely(ret)) 3026 3023 return ret; ··· 3064 3061 int, sig, 3065 3062 struct compat_siginfo __user *, uinfo) 3066 3063 { 3067 - siginfo_t info; 3064 + siginfo_t info = {}; 3068 3065 3069 3066 if (copy_siginfo_from_user32(&info, uinfo)) 3070 3067 return -EFAULT;
+1 -1
lib/iommu-common.c
··· 119 119 unsigned long align_mask = 0; 120 120 121 121 if (align_order > 0) 122 - align_mask = 0xffffffffffffffffl >> (64 - align_order); 122 + align_mask = ~0ul >> (BITS_PER_LONG - align_order); 123 123 124 124 /* Sanity check */ 125 125 if (unlikely(npages == 0)) {
+1 -6
mm/huge_memory.c
··· 1676 1676 /* after clearing PageTail the gup refcount can be released */ 1677 1677 smp_mb__after_atomic(); 1678 1678 1679 - /* 1680 - * retain hwpoison flag of the poisoned tail page: 1681 - * fix for the unsuitable process killed on Guest Machine(KVM) 1682 - * by the memory-failure. 1683 - */ 1684 - page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP | __PG_HWPOISON; 1679 + page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP; 1685 1680 page_tail->flags |= (page->flags & 1686 1681 ((1L << PG_referenced) | 1687 1682 (1L << PG_swapbacked) |
+18 -14
mm/memory-failure.c
··· 909 909 * directly for tail pages. 910 910 */ 911 911 if (PageTransHuge(head)) { 912 + /* 913 + * Non anonymous thp exists only in allocation/free time. We 914 + * can't handle such a case correctly, so let's give it up. 915 + * This should be better than triggering BUG_ON when kernel 916 + * tries to touch the "partially handled" page. 917 + */ 918 + if (!PageAnon(head)) { 919 + pr_err("MCE: %#lx: non anonymous thp\n", 920 + page_to_pfn(page)); 921 + return 0; 922 + } 923 + 912 924 if (get_page_unless_zero(head)) { 913 925 if (PageTail(page)) 914 926 get_page(page); ··· 1146 1134 } 1147 1135 1148 1136 if (!PageHuge(p) && PageTransHuge(hpage)) { 1149 - if (!PageAnon(hpage)) { 1150 - pr_err("MCE: %#lx: non anonymous thp\n", pfn); 1151 - if (TestClearPageHWPoison(p)) 1152 - atomic_long_sub(nr_pages, &num_poisoned_pages); 1153 - put_page(p); 1154 - if (p != hpage) 1155 - put_page(hpage); 1156 - return -EBUSY; 1157 - } 1158 1137 if (unlikely(split_huge_page(hpage))) { 1159 1138 pr_err("MCE: %#lx: thp split failed\n", pfn); 1160 1139 if (TestClearPageHWPoison(p)) ··· 1212 1209 if (!PageHWPoison(p)) { 1213 1210 printk(KERN_ERR "MCE %#lx: just unpoisoned\n", pfn); 1214 1211 atomic_long_sub(nr_pages, &num_poisoned_pages); 1212 + unlock_page(hpage); 1215 1213 put_page(hpage); 1216 - res = 0; 1217 - goto out; 1214 + return 0; 1218 1215 } 1219 1216 if (hwpoison_filter(p)) { 1220 1217 if (TestClearPageHWPoison(p)) ··· 1659 1656 inc_zone_page_state(page, NR_ISOLATED_ANON + 1660 1657 page_is_file_cache(page)); 1661 1658 list_add(&page->lru, &pagelist); 1659 + if (!TestSetPageHWPoison(page)) 1660 + atomic_long_inc(&num_poisoned_pages); 1662 1661 ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL, 1663 1662 MIGRATE_SYNC, MR_MEMORY_FAILURE); 1664 1663 if (ret) { ··· 1675 1670 pfn, ret, page->flags); 1676 1671 if (ret > 0) 1677 1672 ret = -EIO; 1678 - } else { 1679 - SetPageHWPoison(page); 1680 - atomic_long_inc(&num_poisoned_pages); 1673 + if (TestClearPageHWPoison(page)) 1674 + atomic_long_dec(&num_poisoned_pages); 1681 1675 } 1682 1676 } else { 1683 1677 pr_info("soft offline: %#lx: isolation failed: %d, page count %d, type %lx\n",
+9 -1
mm/memory_hotplug.c
··· 446 446 int nr_pages = PAGES_PER_SECTION; 447 447 int nid = pgdat->node_id; 448 448 int zone_type; 449 - unsigned long flags; 449 + unsigned long flags, pfn; 450 450 int ret; 451 451 452 452 zone_type = zone - pgdat->node_zones; ··· 461 461 pgdat_resize_unlock(zone->zone_pgdat, &flags); 462 462 memmap_init_zone(nr_pages, nid, zone_type, 463 463 phys_start_pfn, MEMMAP_HOTPLUG); 464 + 465 + /* online_page_range is called later and expects pages reserved */ 466 + for (pfn = phys_start_pfn; pfn < phys_start_pfn + nr_pages; pfn++) { 467 + if (!pfn_valid(pfn)) 468 + continue; 469 + 470 + SetPageReserved(pfn_to_page(pfn)); 471 + } 464 472 return 0; 465 473 } 466 474
+6 -2
mm/migrate.c
··· 880 880 /* Establish migration ptes or remove ptes */ 881 881 if (page_mapped(page)) { 882 882 try_to_unmap(page, 883 - TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS); 883 + TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS| 884 + TTU_IGNORE_HWPOISON); 884 885 page_was_mapped = 1; 885 886 } 886 887 ··· 951 950 list_del(&page->lru); 952 951 dec_zone_page_state(page, NR_ISOLATED_ANON + 953 952 page_is_file_cache(page)); 954 - if (reason != MR_MEMORY_FAILURE) 953 + /* Soft-offlined page shouldn't go through lru cache list */ 954 + if (reason == MR_MEMORY_FAILURE) 955 + put_page(page); 956 + else 955 957 putback_lru_page(page); 956 958 } 957 959
+2 -2
mm/page-writeback.c
··· 2063 2063 */ 2064 2064 void __init page_writeback_init(void) 2065 2065 { 2066 + BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL)); 2067 + 2066 2068 writeback_set_ratelimit(); 2067 2069 register_cpu_notifier(&ratelimit_nb); 2068 - 2069 - BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL)); 2070 2070 } 2071 2071 2072 2072 /**
+30 -15
mm/page_alloc.c
··· 18 18 #include <linux/mm.h> 19 19 #include <linux/swap.h> 20 20 #include <linux/interrupt.h> 21 - #include <linux/rwsem.h> 22 21 #include <linux/pagemap.h> 23 22 #include <linux/jiffies.h> 24 23 #include <linux/bootmem.h> ··· 980 981 981 982 #if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) || \ 982 983 defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) 983 - /* Only safe to use early in boot when initialisation is single-threaded */ 984 + 984 985 static struct mminit_pfnnid_cache early_pfnnid_cache __meminitdata; 985 986 986 987 int __meminit early_pfn_to_nid(unsigned long pfn) 987 988 { 989 + static DEFINE_SPINLOCK(early_pfn_lock); 988 990 int nid; 989 991 990 - /* The system will behave unpredictably otherwise */ 991 - BUG_ON(system_state != SYSTEM_BOOTING); 992 - 992 + spin_lock(&early_pfn_lock); 993 993 nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache); 994 - if (nid >= 0) 995 - return nid; 996 - /* just returns 0 */ 997 - return 0; 994 + if (nid < 0) 995 + nid = 0; 996 + spin_unlock(&early_pfn_lock); 997 + 998 + return nid; 998 999 } 999 1000 #endif 1000 1001 ··· 1059 1060 __free_pages_boot_core(page, pfn, 0); 1060 1061 } 1061 1062 1062 - static __initdata DECLARE_RWSEM(pgdat_init_rwsem); 1063 + /* Completion tracking for deferred_init_memmap() threads */ 1064 + static atomic_t pgdat_init_n_undone __initdata; 1065 + static __initdata DECLARE_COMPLETION(pgdat_init_all_done_comp); 1066 + 1067 + static inline void __init pgdat_init_report_one_done(void) 1068 + { 1069 + if (atomic_dec_and_test(&pgdat_init_n_undone)) 1070 + complete(&pgdat_init_all_done_comp); 1071 + } 1063 1072 1064 1073 /* Initialise remaining memory on a node */ 1065 1074 static int __init deferred_init_memmap(void *data) ··· 1084 1077 const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id); 1085 1078 1086 1079 if (first_init_pfn == ULONG_MAX) { 1087 - up_read(&pgdat_init_rwsem); 1080 + pgdat_init_report_one_done(); 1088 1081 return 0; 1089 1082 } 1090 1083 ··· 1184 1177 1185 1178 pr_info("node %d initialised, %lu pages in %ums\n", nid, nr_pages, 1186 1179 jiffies_to_msecs(jiffies - start)); 1187 - up_read(&pgdat_init_rwsem); 1180 + 1181 + pgdat_init_report_one_done(); 1188 1182 return 0; 1189 1183 } 1190 1184 ··· 1193 1185 { 1194 1186 int nid; 1195 1187 1188 + /* There will be num_node_state(N_MEMORY) threads */ 1189 + atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY)); 1196 1190 for_each_node_state(nid, N_MEMORY) { 1197 - down_read(&pgdat_init_rwsem); 1198 1191 kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid); 1199 1192 } 1200 1193 1201 1194 /* Block until all are initialised */ 1202 - down_write(&pgdat_init_rwsem); 1203 - up_write(&pgdat_init_rwsem); 1195 + wait_for_completion(&pgdat_init_all_done_comp); 1196 + 1197 + /* Reinit limits that are based on free pages after the kernel is up */ 1198 + files_maxfiles_init(); 1204 1199 } 1205 1200 #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ 1206 1201 ··· 1296 1285 bad_reason = "non-NULL mapping"; 1297 1286 if (unlikely(atomic_read(&page->_count) != 0)) 1298 1287 bad_reason = "nonzero _count"; 1288 + if (unlikely(page->flags & __PG_HWPOISON)) { 1289 + bad_reason = "HWPoisoned (hardware-corrupted)"; 1290 + bad_flags = __PG_HWPOISON; 1291 + } 1299 1292 if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) { 1300 1293 bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set"; 1301 1294 bad_flags = PAGE_FLAGS_CHECK_AT_PREP;
+2 -2
mm/shmem.c
··· 3363 3363 * shmem_kernel_file_setup - get an unlinked file living in tmpfs which must be 3364 3364 * kernel internal. There will be NO LSM permission checks against the 3365 3365 * underlying inode. So users of this interface must do LSM checks at a 3366 - * higher layer. The one user is the big_key implementation. LSM checks 3367 - * are provided at the key level rather than the inode level. 3366 + * higher layer. The users are the big_key and shm implementations. LSM 3367 + * checks are provided at the key or shm level rather than the inode. 3368 3368 * @name: name for dentry (to be seen in /proc/<pid>/maps 3369 3369 * @size: size to be set for the file 3370 3370 * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size
+1 -2
mm/slab_common.c
··· 37 37 SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE | \ 38 38 SLAB_FAILSLAB) 39 39 40 - #define SLAB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \ 41 - SLAB_CACHE_DMA | SLAB_NOTRACK) 40 + #define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | SLAB_NOTRACK) 42 41 43 42 /* 44 43 * Merge control. If this is set then no merging of slab caches will occur.
+6 -10
mm/vmscan.c
··· 973 973 * caller can stall after page list has been processed. 974 974 * 975 975 * 2) Global or new memcg reclaim encounters a page that is 976 - * not marked for immediate reclaim or the caller does not 977 - * have __GFP_IO. In this case mark the page for immediate 976 + * not marked for immediate reclaim, or the caller does not 977 + * have __GFP_FS (or __GFP_IO if it's simply going to swap, 978 + * not to fs). In this case mark the page for immediate 978 979 * reclaim and continue scanning. 979 980 * 980 - * __GFP_IO is checked because a loop driver thread might 981 + * Require may_enter_fs because we would wait on fs, which 982 + * may not have submitted IO yet. And the loop driver might 981 983 * enter reclaim, and deadlock if it waits on a page for 982 984 * which it is needed to do the write (loop masks off 983 985 * __GFP_IO|__GFP_FS for this reason); but more thought 984 986 * would probably show more reasons. 985 - * 986 - * Don't require __GFP_FS, since we're not going into the 987 - * FS, just waiting on its writeback completion. Worryingly, 988 - * ext4 gfs2 and xfs allocate pages with 989 - * grab_cache_page_write_begin(,,AOP_FLAG_NOFS), so testing 990 - * may_enter_fs here is liable to OOM on them. 991 987 * 992 988 * 3) Legacy memcg encounters a page that is not already marked 993 989 * PageReclaim. memcg does not have any dirty pages ··· 1001 1005 1002 1006 /* Case 2 above */ 1003 1007 } else if (sane_reclaim(sc) || 1004 - !PageReclaim(page) || !(sc->gfp_mask & __GFP_IO)) { 1008 + !PageReclaim(page) || !may_enter_fs) { 1005 1009 /* 1006 1010 * This is slightly racy - end_page_writeback() 1007 1011 * might have just cleared PageReclaim, then
+13 -5
net/batman-adv/distributed-arp-table.c
··· 1138 1138 * @bat_priv: the bat priv with all the soft interface information 1139 1139 * @skb: packet to check 1140 1140 * @hdr_size: size of the encapsulation header 1141 + * 1142 + * Returns true if the packet was snooped and consumed by DAT. False if the 1143 + * packet has to be delivered to the interface 1141 1144 */ 1142 1145 bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, 1143 1146 struct sk_buff *skb, int hdr_size) ··· 1148 1145 uint16_t type; 1149 1146 __be32 ip_src, ip_dst; 1150 1147 uint8_t *hw_src, *hw_dst; 1151 - bool ret = false; 1148 + bool dropped = false; 1152 1149 unsigned short vid; 1153 1150 1154 1151 if (!atomic_read(&bat_priv->distributed_arp_table)) ··· 1177 1174 /* if this REPLY is directed to a client of mine, let's deliver the 1178 1175 * packet to the interface 1179 1176 */ 1180 - ret = !batadv_is_my_client(bat_priv, hw_dst, vid); 1177 + dropped = !batadv_is_my_client(bat_priv, hw_dst, vid); 1178 + 1179 + /* if this REPLY is sent on behalf of a client of mine, let's drop the 1180 + * packet because the client will reply by itself 1181 + */ 1182 + dropped |= batadv_is_my_client(bat_priv, hw_src, vid); 1181 1183 out: 1182 - if (ret) 1184 + if (dropped) 1183 1185 kfree_skb(skb); 1184 - /* if ret == false -> packet has to be delivered to the interface */ 1185 - return ret; 1186 + /* if dropped == false -> deliver to the interface */ 1187 + return dropped; 1186 1188 } 1187 1189 1188 1190 /**
+2
net/batman-adv/gateway_client.c
··· 439 439 440 440 INIT_HLIST_NODE(&gw_node->list); 441 441 gw_node->orig_node = orig_node; 442 + gw_node->bandwidth_down = ntohl(gateway->bandwidth_down); 443 + gw_node->bandwidth_up = ntohl(gateway->bandwidth_up); 442 444 atomic_set(&gw_node->refcount, 1); 443 445 444 446 spin_lock_bh(&bat_priv->gw.list_lock);
+3
net/batman-adv/soft-interface.c
··· 479 479 */ 480 480 void batadv_softif_vlan_free_ref(struct batadv_softif_vlan *vlan) 481 481 { 482 + if (!vlan) 483 + return; 484 + 482 485 if (atomic_dec_and_test(&vlan->refcount)) { 483 486 spin_lock_bh(&vlan->bat_priv->softif_vlan_list_lock); 484 487 hlist_del_rcu(&vlan->list);
+24 -5
net/batman-adv/translation-table.c
··· 594 594 595 595 /* increase the refcounter of the related vlan */ 596 596 vlan = batadv_softif_vlan_get(bat_priv, vid); 597 + if (WARN(!vlan, "adding TT local entry %pM to non-existent VLAN %d", 598 + addr, BATADV_PRINT_VID(vid))) 599 + goto out; 597 600 598 601 batadv_dbg(BATADV_DBG_TT, bat_priv, 599 602 "Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n", ··· 1037 1034 struct batadv_tt_local_entry *tt_local_entry; 1038 1035 uint16_t flags, curr_flags = BATADV_NO_FLAGS; 1039 1036 struct batadv_softif_vlan *vlan; 1037 + void *tt_entry_exists; 1040 1038 1041 1039 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); 1042 1040 if (!tt_local_entry) ··· 1065 1061 * immediately purge it 1066 1062 */ 1067 1063 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL); 1068 - hlist_del_rcu(&tt_local_entry->common.hash_entry); 1064 + 1065 + tt_entry_exists = batadv_hash_remove(bat_priv->tt.local_hash, 1066 + batadv_compare_tt, 1067 + batadv_choose_tt, 1068 + &tt_local_entry->common); 1069 + if (!tt_entry_exists) 1070 + goto out; 1071 + 1072 + /* extra call to free the local tt entry */ 1069 1073 batadv_tt_local_entry_free_ref(tt_local_entry); 1070 1074 1071 1075 /* decrease the reference held for this vlan */ 1072 1076 vlan = batadv_softif_vlan_get(bat_priv, vid); 1077 + if (!vlan) 1078 + goto out; 1079 + 1073 1080 batadv_softif_vlan_free_ref(vlan); 1074 1081 batadv_softif_vlan_free_ref(vlan); 1075 1082 ··· 1181 1166 /* decrease the reference held for this vlan */ 1182 1167 vlan = batadv_softif_vlan_get(bat_priv, 1183 1168 tt_common_entry->vid); 1184 - batadv_softif_vlan_free_ref(vlan); 1185 - batadv_softif_vlan_free_ref(vlan); 1169 + if (vlan) { 1170 + batadv_softif_vlan_free_ref(vlan); 1171 + batadv_softif_vlan_free_ref(vlan); 1172 + } 1186 1173 1187 1174 batadv_tt_local_entry_free_ref(tt_local); 1188 1175 } ··· 3224 3207 3225 3208 /* decrease the reference held for this vlan */ 3226 3209 vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid); 3227 - batadv_softif_vlan_free_ref(vlan); 3228 - batadv_softif_vlan_free_ref(vlan); 3210 + if (vlan) { 3211 + batadv_softif_vlan_free_ref(vlan); 3212 + batadv_softif_vlan_free_ref(vlan); 3213 + } 3229 3214 3230 3215 batadv_tt_local_entry_free_ref(tt_local); 3231 3216 }
+1 -1
net/bluetooth/mgmt.c
··· 7843 7843 /* Make sure we copy only the significant bytes based on the 7844 7844 * encryption key size, and set the rest of the value to zeroes. 7845 7845 */ 7846 - memcpy(ev.key.val, key->val, sizeof(key->enc_size)); 7846 + memcpy(ev.key.val, key->val, key->enc_size); 7847 7847 memset(ev.key.val + key->enc_size, 0, 7848 7848 sizeof(ev.key.val) - key->enc_size); 7849 7849
+4
net/bridge/br_netlink.c
··· 112 112 + nla_total_size(1) /* IFLA_BRPORT_FAST_LEAVE */ 113 113 + nla_total_size(1) /* IFLA_BRPORT_LEARNING */ 114 114 + nla_total_size(1) /* IFLA_BRPORT_UNICAST_FLOOD */ 115 + + nla_total_size(1) /* IFLA_BRPORT_PROXYARP */ 116 + + nla_total_size(1) /* IFLA_BRPORT_PROXYARP_WIFI */ 115 117 + 0; 116 118 } 117 119 ··· 506 504 [IFLA_BRPORT_FAST_LEAVE]= { .type = NLA_U8 }, 507 505 [IFLA_BRPORT_LEARNING] = { .type = NLA_U8 }, 508 506 [IFLA_BRPORT_UNICAST_FLOOD] = { .type = NLA_U8 }, 507 + [IFLA_BRPORT_PROXYARP] = { .type = NLA_U8 }, 508 + [IFLA_BRPORT_PROXYARP_WIFI] = { .type = NLA_U8 }, 509 509 }; 510 510 511 511 /* Change the state of the port and notify spanning tree */
+7 -6
net/core/datagram.c
··· 131 131 goto out; 132 132 } 133 133 134 - static int skb_set_peeked(struct sk_buff *skb) 134 + static struct sk_buff *skb_set_peeked(struct sk_buff *skb) 135 135 { 136 136 struct sk_buff *nskb; 137 137 138 138 if (skb->peeked) 139 - return 0; 139 + return skb; 140 140 141 141 /* We have to unshare an skb before modifying it. */ 142 142 if (!skb_shared(skb)) ··· 144 144 145 145 nskb = skb_clone(skb, GFP_ATOMIC); 146 146 if (!nskb) 147 - return -ENOMEM; 147 + return ERR_PTR(-ENOMEM); 148 148 149 149 skb->prev->next = nskb; 150 150 skb->next->prev = nskb; ··· 157 157 done: 158 158 skb->peeked = 1; 159 159 160 - return 0; 160 + return skb; 161 161 } 162 162 163 163 /** ··· 229 229 continue; 230 230 } 231 231 232 - error = skb_set_peeked(skb); 233 - if (error) 232 + skb = skb_set_peeked(skb); 233 + error = PTR_ERR(skb); 234 + if (IS_ERR(skb)) 234 235 goto unlock_err; 235 236 236 237 atomic_inc(&skb->users);
-3
net/core/pktgen.c
··· 3513 3513 3514 3514 set_freezable(); 3515 3515 3516 - __set_current_state(TASK_RUNNING); 3517 - 3518 3516 while (!kthread_should_stop()) { 3519 3517 pkt_dev = next_to_run(t); 3520 3518 ··· 3557 3559 3558 3560 try_to_freeze(); 3559 3561 } 3560 - set_current_state(TASK_INTERRUPTIBLE); 3561 3562 3562 3563 pr_debug("%s stopping all device\n", t->tsk->comm); 3563 3564 pktgen_stop(t);
+7 -1
net/core/request_sock.c
··· 103 103 spin_lock_bh(&queue->syn_wait_lock); 104 104 while ((req = lopt->syn_table[i]) != NULL) { 105 105 lopt->syn_table[i] = req->dl_next; 106 + /* Because of following del_timer_sync(), 107 + * we must release the spinlock here 108 + * or risk a dead lock. 109 + */ 110 + spin_unlock_bh(&queue->syn_wait_lock); 106 111 atomic_inc(&lopt->qlen_dec); 107 - if (del_timer(&req->rsk_timer)) 112 + if (del_timer_sync(&req->rsk_timer)) 108 113 reqsk_put(req); 109 114 reqsk_put(req); 115 + spin_lock_bh(&queue->syn_wait_lock); 110 116 } 111 117 spin_unlock_bh(&queue->syn_wait_lock); 112 118 }
+2 -1
net/dsa/slave.c
··· 856 856 return -ENODEV; 857 857 858 858 /* Use already configured phy mode */ 859 - p->phy_interface = p->phy->interface; 859 + if (p->phy_interface == PHY_INTERFACE_MODE_NA) 860 + p->phy_interface = p->phy->interface; 860 861 phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link, 861 862 p->phy_interface); 862 863
+1 -1
net/ipv4/inet_connection_sock.c
··· 593 593 } 594 594 595 595 spin_unlock(&queue->syn_wait_lock); 596 - if (del_timer(&req->rsk_timer)) 596 + if (del_timer_sync(&req->rsk_timer)) 597 597 reqsk_put(req); 598 598 return found; 599 599 }
+2 -1
net/ipv4/netfilter/ipt_SYNPROXY.c
··· 226 226 227 227 synproxy_build_options(nth, opts); 228 228 229 - synproxy_send_tcp(skb, nskb, NULL, 0, niph, nth, tcp_hdr_size); 229 + synproxy_send_tcp(skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY, 230 + niph, nth, tcp_hdr_size); 230 231 } 231 232 232 233 static bool
+1 -1
net/ipv4/tcp_ipv4.c
··· 1348 1348 req = inet_csk_search_req(sk, th->source, iph->saddr, iph->daddr); 1349 1349 if (req) { 1350 1350 nsk = tcp_check_req(sk, skb, req, false); 1351 - if (!nsk) 1351 + if (!nsk || nsk == sk) 1352 1352 reqsk_put(req); 1353 1353 return nsk; 1354 1354 }
+10 -3
net/ipv4/udp.c
··· 1995 1995 1996 1996 skb->sk = sk; 1997 1997 skb->destructor = sock_efree; 1998 - dst = sk->sk_rx_dst; 1998 + dst = READ_ONCE(sk->sk_rx_dst); 1999 1999 2000 2000 if (dst) 2001 2001 dst = dst_check(dst, 0); 2002 - if (dst) 2003 - skb_dst_set_noref(skb, dst); 2002 + if (dst) { 2003 + /* DST_NOCACHE can not be used without taking a reference */ 2004 + if (dst->flags & DST_NOCACHE) { 2005 + if (likely(atomic_inc_not_zero(&dst->__refcnt))) 2006 + skb_dst_set(skb, dst); 2007 + } else { 2008 + skb_dst_set_noref(skb, dst); 2009 + } 2010 + } 2004 2011 } 2005 2012 2006 2013 int udp_rcv(struct sk_buff *skb)
+11 -8
net/ipv6/netfilter/ip6t_SYNPROXY.c
··· 37 37 } 38 38 39 39 static void 40 - synproxy_send_tcp(const struct sk_buff *skb, struct sk_buff *nskb, 40 + synproxy_send_tcp(const struct synproxy_net *snet, 41 + const struct sk_buff *skb, struct sk_buff *nskb, 41 42 struct nf_conntrack *nfct, enum ip_conntrack_info ctinfo, 42 43 struct ipv6hdr *niph, struct tcphdr *nth, 43 44 unsigned int tcp_hdr_size) 44 45 { 45 - struct net *net = nf_ct_net((struct nf_conn *)nfct); 46 + struct net *net = nf_ct_net(snet->tmpl); 46 47 struct dst_entry *dst; 47 48 struct flowi6 fl6; 48 49 ··· 84 83 } 85 84 86 85 static void 87 - synproxy_send_client_synack(const struct sk_buff *skb, const struct tcphdr *th, 86 + synproxy_send_client_synack(const struct synproxy_net *snet, 87 + const struct sk_buff *skb, const struct tcphdr *th, 88 88 const struct synproxy_options *opts) 89 89 { 90 90 struct sk_buff *nskb; ··· 121 119 122 120 synproxy_build_options(nth, opts); 123 121 124 - synproxy_send_tcp(skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY, 122 + synproxy_send_tcp(snet, skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY, 125 123 niph, nth, tcp_hdr_size); 126 124 } 127 125 ··· 165 163 166 164 synproxy_build_options(nth, opts); 167 165 168 - synproxy_send_tcp(skb, nskb, &snet->tmpl->ct_general, IP_CT_NEW, 166 + synproxy_send_tcp(snet, skb, nskb, &snet->tmpl->ct_general, IP_CT_NEW, 169 167 niph, nth, tcp_hdr_size); 170 168 } 171 169 ··· 205 203 206 204 synproxy_build_options(nth, opts); 207 205 208 - synproxy_send_tcp(skb, nskb, NULL, 0, niph, nth, tcp_hdr_size); 206 + synproxy_send_tcp(snet, skb, nskb, NULL, 0, niph, nth, tcp_hdr_size); 209 207 } 210 208 211 209 static void ··· 243 241 244 242 synproxy_build_options(nth, opts); 245 243 246 - synproxy_send_tcp(skb, nskb, NULL, 0, niph, nth, tcp_hdr_size); 244 + synproxy_send_tcp(snet, skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY, 245 + niph, nth, tcp_hdr_size); 247 246 } 248 247 249 248 static bool ··· 304 301 XT_SYNPROXY_OPT_SACK_PERM | 305 302 XT_SYNPROXY_OPT_ECN); 306 303 307 - synproxy_send_client_synack(skb, th, &opts); 304 + synproxy_send_client_synack(snet, skb, th, &opts); 308 305 return NF_DROP; 309 306 310 307 } else if (th->ack && !(th->fin || th->rst || th->syn)) {
+4 -2
net/ipv6/route.c
··· 1844 1844 int gwa_type; 1845 1845 1846 1846 gw_addr = &cfg->fc_gateway; 1847 + gwa_type = ipv6_addr_type(gw_addr); 1847 1848 1848 1849 /* if gw_addr is local we will fail to detect this in case 1849 1850 * address is still TENTATIVE (DAD in progress). rt6_lookup() ··· 1852 1851 * prefix route was assigned to, which might be non-loopback. 1853 1852 */ 1854 1853 err = -EINVAL; 1855 - if (ipv6_chk_addr_and_flags(net, gw_addr, NULL, 0, 0)) 1854 + if (ipv6_chk_addr_and_flags(net, gw_addr, 1855 + gwa_type & IPV6_ADDR_LINKLOCAL ? 1856 + dev : NULL, 0, 0)) 1856 1857 goto out; 1857 1858 1858 1859 rt->rt6i_gateway = *gw_addr; 1859 - gwa_type = ipv6_addr_type(gw_addr); 1860 1860 1861 1861 if (gwa_type != (IPV6_ADDR_LINKLOCAL|IPV6_ADDR_UNICAST)) { 1862 1862 struct rt6_info *grt;
+1 -1
net/ipv6/tcp_ipv6.c
··· 943 943 &ipv6_hdr(skb)->daddr, tcp_v6_iif(skb)); 944 944 if (req) { 945 945 nsk = tcp_check_req(sk, skb, req, false); 946 - if (!nsk) 946 + if (!nsk || nsk == sk) 947 947 reqsk_put(req); 948 948 return nsk; 949 949 }
+3 -5
net/netfilter/nf_conntrack_core.c
··· 292 292 { 293 293 struct nf_conn *tmpl; 294 294 295 - tmpl = kzalloc(sizeof(struct nf_conn), GFP_KERNEL); 295 + tmpl = kzalloc(sizeof(*tmpl), flags); 296 296 if (tmpl == NULL) 297 297 return NULL; 298 298 ··· 303 303 if (zone) { 304 304 struct nf_conntrack_zone *nf_ct_zone; 305 305 306 - nf_ct_zone = nf_ct_ext_add(tmpl, NF_CT_EXT_ZONE, GFP_ATOMIC); 306 + nf_ct_zone = nf_ct_ext_add(tmpl, NF_CT_EXT_ZONE, flags); 307 307 if (!nf_ct_zone) 308 308 goto out_free; 309 309 nf_ct_zone->id = zone; ··· 1544 1544 sz = nr_slots * sizeof(struct hlist_nulls_head); 1545 1545 hash = (void *)__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, 1546 1546 get_order(sz)); 1547 - if (!hash) { 1548 - printk(KERN_WARNING "nf_conntrack: falling back to vmalloc.\n"); 1547 + if (!hash) 1549 1548 hash = vzalloc(sz); 1550 - } 1551 1549 1552 1550 if (hash && nulls) 1553 1551 for (i = 0; i < nr_slots; i++)
+1 -3
net/netfilter/nf_synproxy_core.c
··· 353 353 int err = -ENOMEM; 354 354 355 355 ct = nf_ct_tmpl_alloc(net, 0, GFP_KERNEL); 356 - if (IS_ERR(ct)) { 357 - err = PTR_ERR(ct); 356 + if (!ct) 358 357 goto err1; 359 - } 360 358 361 359 if (!nfct_seqadj_ext_add(ct)) 362 360 goto err2;
+3 -2
net/netfilter/xt_CT.c
··· 202 202 goto err1; 203 203 204 204 ct = nf_ct_tmpl_alloc(par->net, info->zone, GFP_KERNEL); 205 - ret = PTR_ERR(ct); 206 - if (IS_ERR(ct)) 205 + if (!ct) { 206 + ret = -ENOMEM; 207 207 goto err2; 208 + } 208 209 209 210 ret = 0; 210 211 if ((info->ct_events || info->exp_events) &&
+5
net/netlink/af_netlink.c
··· 1096 1096 1097 1097 err = __netlink_insert(table, sk); 1098 1098 if (err) { 1099 + /* In case the hashtable backend returns with -EBUSY 1100 + * from here, it must not escape to the caller. 1101 + */ 1102 + if (unlikely(err == -EBUSY)) 1103 + err = -EOVERFLOW; 1099 1104 if (err == -EEXIST) 1100 1105 err = -EADDRINUSE; 1101 1106 nlk_sk(sk)->portid = 0;
+12 -4
net/openvswitch/actions.c
··· 273 273 return 0; 274 274 } 275 275 276 - static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh, 277 - __be32 *addr, __be32 new_addr) 276 + static void update_ip_l4_checksum(struct sk_buff *skb, struct iphdr *nh, 277 + __be32 addr, __be32 new_addr) 278 278 { 279 279 int transport_len = skb->len - skb_transport_offset(skb); 280 + 281 + if (nh->frag_off & htons(IP_OFFSET)) 282 + return; 280 283 281 284 if (nh->protocol == IPPROTO_TCP) { 282 285 if (likely(transport_len >= sizeof(struct tcphdr))) 283 286 inet_proto_csum_replace4(&tcp_hdr(skb)->check, skb, 284 - *addr, new_addr, 1); 287 + addr, new_addr, 1); 285 288 } else if (nh->protocol == IPPROTO_UDP) { 286 289 if (likely(transport_len >= sizeof(struct udphdr))) { 287 290 struct udphdr *uh = udp_hdr(skb); 288 291 289 292 if (uh->check || skb->ip_summed == CHECKSUM_PARTIAL) { 290 293 inet_proto_csum_replace4(&uh->check, skb, 291 - *addr, new_addr, 1); 294 + addr, new_addr, 1); 292 295 if (!uh->check) 293 296 uh->check = CSUM_MANGLED_0; 294 297 } 295 298 } 296 299 } 300 + } 297 301 302 + static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh, 303 + __be32 *addr, __be32 new_addr) 304 + { 305 + update_ip_l4_checksum(skb, nh, *addr, new_addr); 298 306 csum_replace4(&nh->check, *addr, new_addr); 299 307 skb_clear_hash(skb); 300 308 *addr = new_addr;
+1 -1
net/rds/info.c
··· 176 176 177 177 /* check for all kinds of wrapping and the like */ 178 178 start = (unsigned long)optval; 179 - if (len < 0 || len + PAGE_SIZE - 1 < len || start + len < start) { 179 + if (len < 0 || len > INT_MAX - PAGE_SIZE + 1 || start + len < start) { 180 180 ret = -EINVAL; 181 181 goto out; 182 182 }
+2
net/sched/act_mirred.c
··· 101 101 return ret; 102 102 ret = ACT_P_CREATED; 103 103 } else { 104 + if (bind) 105 + return 0; 104 106 if (!ovr) { 105 107 tcf_hash_release(a, bind); 106 108 return -EEXIST;
+19 -3
net/sched/sch_fq_codel.c
··· 288 288 289 289 static void fq_codel_reset(struct Qdisc *sch) 290 290 { 291 - struct sk_buff *skb; 291 + struct fq_codel_sched_data *q = qdisc_priv(sch); 292 + int i; 292 293 293 - while ((skb = fq_codel_dequeue(sch)) != NULL) 294 - kfree_skb(skb); 294 + INIT_LIST_HEAD(&q->new_flows); 295 + INIT_LIST_HEAD(&q->old_flows); 296 + for (i = 0; i < q->flows_cnt; i++) { 297 + struct fq_codel_flow *flow = q->flows + i; 298 + 299 + while (flow->head) { 300 + struct sk_buff *skb = dequeue_head(flow); 301 + 302 + qdisc_qstats_backlog_dec(sch, skb); 303 + kfree_skb(skb); 304 + } 305 + 306 + INIT_LIST_HEAD(&flow->flowchain); 307 + codel_vars_init(&flow->cvars); 308 + } 309 + memset(q->backlogs, 0, q->flows_cnt * sizeof(u32)); 310 + sch->q.qlen = 0; 295 311 } 296 312 297 313 static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = {
+1 -1
scripts/kconfig/streamline_config.pl
··· 137 137 my $kconfig = $ARGV[1]; 138 138 my $lsmod_file = $ENV{'LSMOD'}; 139 139 140 - my @makefiles = `find $ksource -name Makefile 2>/dev/null`; 140 + my @makefiles = `find $ksource -name Makefile -or -name Kbuild 2>/dev/null`; 141 141 chomp @makefiles; 142 142 143 143 my %depends;
+1
security/yama/yama_lsm.c
··· 406 406 */ 407 407 if (!security_module_enable("yama")) 408 408 return 0; 409 + yama_add_hooks(); 409 410 #endif 410 411 pr_info("Yama: becoming mindful.\n"); 411 412
+3 -2
sound/firewire/amdtp.c
··· 740 740 s->data_block_counter != UINT_MAX) 741 741 data_block_counter = s->data_block_counter; 742 742 743 - if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) && data_block_counter == 0) || 744 - (s->data_block_counter == UINT_MAX)) { 743 + if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) && 744 + data_block_counter == s->tx_first_dbc) || 745 + s->data_block_counter == UINT_MAX) { 745 746 lost = false; 746 747 } else if (!(s->flags & CIP_DBC_IS_END_EVENT)) { 747 748 lost = data_block_counter != s->data_block_counter;
+2
sound/firewire/amdtp.h
··· 157 157 158 158 /* quirk: fixed interval of dbc between previos/current packets. */ 159 159 unsigned int tx_dbc_interval; 160 + /* quirk: indicate the value of dbc field in a first packet. */ 161 + unsigned int tx_first_dbc; 160 162 161 163 bool callbacked; 162 164 wait_queue_head_t callback_wait;
+8 -2
sound/firewire/fireworks/fireworks.c
··· 248 248 err = get_hardware_info(efw); 249 249 if (err < 0) 250 250 goto error; 251 - if (entry->model_id == MODEL_ECHO_AUDIOFIRE_2) 252 - efw->is_af2 = true; 251 + /* AudioFire8 (since 2009) and AudioFirePre8 */ 253 252 if (entry->model_id == MODEL_ECHO_AUDIOFIRE_9) 254 253 efw->is_af9 = true; 254 + /* These models uses the same firmware. */ 255 + if (entry->model_id == MODEL_ECHO_AUDIOFIRE_2 || 256 + entry->model_id == MODEL_ECHO_AUDIOFIRE_4 || 257 + entry->model_id == MODEL_ECHO_AUDIOFIRE_9 || 258 + entry->model_id == MODEL_GIBSON_RIP || 259 + entry->model_id == MODEL_GIBSON_GOLDTOP) 260 + efw->is_fireworks3 = true; 255 261 256 262 snd_efw_proc_init(efw); 257 263
+1 -1
sound/firewire/fireworks/fireworks.h
··· 70 70 bool resp_addr_changable; 71 71 72 72 /* for quirks */ 73 - bool is_af2; 74 73 bool is_af9; 74 + bool is_fireworks3; 75 75 u32 firmware_version; 76 76 77 77 unsigned int midi_in_ports;
+9 -3
sound/firewire/fireworks/fireworks_stream.c
··· 172 172 efw->tx_stream.flags |= CIP_DBC_IS_END_EVENT; 173 173 /* Fireworks reset dbc at bus reset. */ 174 174 efw->tx_stream.flags |= CIP_SKIP_DBC_ZERO_CHECK; 175 - /* AudioFire2 starts packets with non-zero dbc. */ 176 - if (efw->is_af2) 177 - efw->tx_stream.flags |= CIP_SKIP_INIT_DBC_CHECK; 175 + /* 176 + * But Recent firmwares starts packets with non-zero dbc. 177 + * Driver version 5.7.6 installs firmware version 5.7.3. 178 + */ 179 + if (efw->is_fireworks3 && 180 + (efw->firmware_version == 0x5070000 || 181 + efw->firmware_version == 0x5070300 || 182 + efw->firmware_version == 0x5080000)) 183 + efw->tx_stream.tx_first_dbc = 0x02; 178 184 /* AudioFire9 always reports wrong dbs. */ 179 185 if (efw->is_af9) 180 186 efw->tx_stream.flags |= CIP_WRONG_DBS;
-6
sound/hda/ext/hdac_ext_controller.c
··· 44 44 45 45 offset = snd_hdac_chip_readl(bus, LLCH); 46 46 47 - if (offset < 0) 48 - return -EIO; 49 - 50 47 /* Lets walk the linked capabilities list */ 51 48 do { 52 49 cur_cap = _snd_hdac_chip_read(l, bus, offset); 53 - 54 - if (cur_cap < 0) 55 - return -EIO; 56 50 57 51 dev_dbg(bus->dev, "Capability version: 0x%x\n", 58 52 ((cur_cap & AZX_CAP_HDR_VER_MASK) >> AZX_CAP_HDR_VER_OFF));
+1 -1
sound/hda/ext/hdac_ext_stream.c
··· 299 299 if (stream->direction != substream->stream) 300 300 continue; 301 301 302 - if (stream->opened) { 302 + if (!stream->opened) { 303 303 if (!hstream->decoupled) 304 304 snd_hdac_ext_stream_decouple(ebus, hstream, true); 305 305 res = hstream;
+1
sound/pci/hda/patch_realtek.c
··· 5189 5189 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 5190 5190 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5191 5191 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5192 + SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC292_FIXUP_DISABLE_AAMIX), 5192 5193 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5193 5194 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 5194 5195 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
+1 -1
sound/pci/oxygen/oxygen_mixer.c
··· 88 88 int changed; 89 89 90 90 mutex_lock(&chip->mutex); 91 - changed = !value->value.integer.value[0] != chip->dac_mute; 91 + changed = (!value->value.integer.value[0]) != chip->dac_mute; 92 92 if (changed) { 93 93 chip->dac_mute = !value->value.integer.value[0]; 94 94 chip->model.update_dac_mute(chip);
+5 -5
sound/soc/codecs/cs4265.c
··· 457 457 case SND_SOC_DAIFMT_RIGHT_J: 458 458 if (params_width(params) == 16) { 459 459 snd_soc_update_bits(codec, CS4265_DAC_CTL, 460 - CS4265_DAC_CTL_DIF, (1 << 5)); 460 + CS4265_DAC_CTL_DIF, (2 << 4)); 461 461 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, 462 - CS4265_SPDIF_CTL2_DIF, (1 << 7)); 462 + CS4265_SPDIF_CTL2_DIF, (2 << 6)); 463 463 } else { 464 464 snd_soc_update_bits(codec, CS4265_DAC_CTL, 465 - CS4265_DAC_CTL_DIF, (3 << 5)); 465 + CS4265_DAC_CTL_DIF, (3 << 4)); 466 466 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, 467 - CS4265_SPDIF_CTL2_DIF, (1 << 7)); 467 + CS4265_SPDIF_CTL2_DIF, (3 << 6)); 468 468 } 469 469 break; 470 470 case SND_SOC_DAIFMT_LEFT_J: ··· 473 473 snd_soc_update_bits(codec, CS4265_ADC_CTL, 474 474 CS4265_ADC_DIF, 0); 475 475 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, 476 - CS4265_SPDIF_CTL2_DIF, (1 << 6)); 476 + CS4265_SPDIF_CTL2_DIF, 0); 477 477 478 478 break; 479 479 default:
+2
sound/soc/codecs/rt5645.c
··· 3341 3341 break; 3342 3342 3343 3343 case RT5645_DMIC_DATA_GPIO5: 3344 + regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1, 3345 + RT5645_I2S2_DAC_PIN_MASK, RT5645_I2S2_DAC_PIN_GPIO); 3344 3346 regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1, 3345 3347 RT5645_DMIC_1_DP_MASK, RT5645_DMIC_1_DP_GPIO5); 3346 3348 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1,
+4
sound/soc/codecs/rt5645.h
··· 1693 1693 #define RT5645_GP6_PIN_SFT 6 1694 1694 #define RT5645_GP6_PIN_GPIO6 (0x0 << 6) 1695 1695 #define RT5645_GP6_PIN_DMIC2_SDA (0x1 << 6) 1696 + #define RT5645_I2S2_DAC_PIN_MASK (0x1 << 4) 1697 + #define RT5645_I2S2_DAC_PIN_SFT 4 1698 + #define RT5645_I2S2_DAC_PIN_I2S (0x0 << 4) 1699 + #define RT5645_I2S2_DAC_PIN_GPIO (0x1 << 4) 1696 1700 #define RT5645_GP8_PIN_MASK (0x1 << 3) 1697 1701 #define RT5645_GP8_PIN_SFT 3 1698 1702 #define RT5645_GP8_PIN_GPIO8 (0x0 << 3)
+2
sound/soc/intel/baytrail/sst-baytrail-ipc.c
··· 701 701 if (byt == NULL) 702 702 return -ENOMEM; 703 703 704 + byt->dev = dev; 705 + 704 706 ipc = &byt->ipc; 705 707 ipc->dev = dev; 706 708 ipc->ops.tx_msg = byt_tx_msg;
+2
sound/soc/intel/haswell/sst-haswell-ipc.c
··· 2119 2119 if (hsw == NULL) 2120 2120 return -ENOMEM; 2121 2121 2122 + hsw->dev = dev; 2123 + 2122 2124 ipc = &hsw->ipc; 2123 2125 ipc->dev = dev; 2124 2126 ipc->ops.tx_msg = hsw_tx_msg;
+44 -19
sound/soc/soc-topology.c
··· 33 33 #include <sound/soc.h> 34 34 #include <sound/soc-dapm.h> 35 35 #include <sound/soc-topology.h> 36 + #include <sound/tlv.h> 36 37 37 38 /* 38 39 * We make several passes over the data (since it wont necessarily be ordered) ··· 535 534 k->put = bops[i].put; 536 535 if (k->get == NULL && bops[i].id == hdr->ops.get) 537 536 k->get = bops[i].get; 538 - if (k->info == NULL && ops[i].id == hdr->ops.info) 537 + if (k->info == NULL && bops[i].id == hdr->ops.info) 539 538 k->info = bops[i].info; 540 539 } 541 540 ··· 580 579 return 0; 581 580 } 582 581 583 - static int soc_tplg_create_tlv(struct soc_tplg *tplg, 584 - struct snd_kcontrol_new *kc, struct snd_soc_tplg_ctl_tlv *tplg_tlv) 582 + 583 + static int soc_tplg_create_tlv_db_scale(struct soc_tplg *tplg, 584 + struct snd_kcontrol_new *kc, struct snd_soc_tplg_tlv_dbscale *scale) 585 585 { 586 - struct snd_ctl_tlv *tlv; 587 - int size; 586 + unsigned int item_len = 2 * sizeof(unsigned int); 587 + unsigned int *p; 588 588 589 - if (tplg_tlv->count == 0) 590 - return 0; 591 - 592 - size = ((tplg_tlv->count + (sizeof(unsigned int) - 1)) & 593 - ~(sizeof(unsigned int) - 1)); 594 - tlv = kzalloc(sizeof(*tlv) + size, GFP_KERNEL); 595 - if (tlv == NULL) 589 + p = kzalloc(item_len + 2 * sizeof(unsigned int), GFP_KERNEL); 590 + if (!p) 596 591 return -ENOMEM; 597 592 598 - dev_dbg(tplg->dev, " created TLV type %d size %d bytes\n", 599 - tplg_tlv->numid, size); 593 + p[0] = SNDRV_CTL_TLVT_DB_SCALE; 594 + p[1] = item_len; 595 + p[2] = scale->min; 596 + p[3] = (scale->step & TLV_DB_SCALE_MASK) 597 + | (scale->mute ? TLV_DB_SCALE_MUTE : 0); 600 598 601 - tlv->numid = tplg_tlv->numid; 602 - tlv->length = size; 603 - memcpy(&tlv->tlv[0], tplg_tlv->data, size); 604 - kc->tlv.p = (void *)tlv; 599 + kc->tlv.p = (void *)p; 600 + return 0; 601 + } 602 + 603 + static int soc_tplg_create_tlv(struct soc_tplg *tplg, 604 + struct snd_kcontrol_new *kc, struct snd_soc_tplg_ctl_hdr *tc) 605 + { 606 + struct snd_soc_tplg_ctl_tlv *tplg_tlv; 607 + 608 + if (!(tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE)) 609 + return 0; 610 + 611 + if (tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { 612 + kc->tlv.c = snd_soc_bytes_tlv_callback; 613 + } else { 614 + tplg_tlv = &tc->tlv; 615 + switch (tplg_tlv->type) { 616 + case SNDRV_CTL_TLVT_DB_SCALE: 617 + return soc_tplg_create_tlv_db_scale(tplg, kc, 618 + &tplg_tlv->scale); 619 + 620 + /* TODO: add support for other TLV types */ 621 + default: 622 + dev_dbg(tplg->dev, "Unsupported TLV type %d\n", 623 + tplg_tlv->type); 624 + return -EINVAL; 625 + } 626 + } 605 627 606 628 return 0; 607 629 } ··· 796 772 } 797 773 798 774 /* create any TLV data */ 799 - soc_tplg_create_tlv(tplg, &kc, &mc->tlv); 775 + soc_tplg_create_tlv(tplg, &kc, &mc->hdr); 800 776 801 777 /* register control here */ 802 778 err = soc_tplg_add_kcontrol(tplg, &kc, ··· 1374 1350 template.reg = w->reg; 1375 1351 template.shift = w->shift; 1376 1352 template.mask = w->mask; 1353 + template.subseq = w->subseq; 1377 1354 template.on_val = w->invert ? 0 : 1; 1378 1355 template.off_val = w->invert ? 1 : 0; 1379 1356 template.ignore_suspend = w->ignore_suspend;