···8282 - id: If there are multiple instance of the same type, in order to8383 differentiate between each instance "id" can be used (e.g., multi-lane PCIe8484 PHY). If "id" is not provided, it is set to default value of '1'.8585+ - syscon-pllreset: Handle to system control region that contains the8686+ CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_08787+ register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.85888689This is usually a subnode of ocp2scp to which it is connected.8790···10299 clock-names = "wkupclk",103100 "sysclk",104101 "refclk";102102+};103103+104104+sata_phy: phy@4A096000 {105105+ compatible = "ti,phy-pipe3-sata";106106+ reg = <0x4A096000 0x80>, /* phy_rx */107107+ <0x4A096400 0x64>, /* phy_tx */108108+ <0x4A096800 0x40>; /* pll_ctrl */109109+ reg-names = "phy_rx", "phy_tx", "pll_ctrl";110110+ ctrl-module = <&omap_control_sata>;111111+ clocks = <&sys_clkin1>, <&sata_ref_clk>;112112+ clock-names = "sysclk", "refclk";113113+ syscon-pllreset = <&scm_conf 0x3fc>;114114+ #phy-cells = <0>;105115};
+4-2
Documentation/input/alps.txt
···119119 byte 5: 0 z6 z5 z4 z3 z2 z1 z0120120121121Protocol Version 2 DualPoint devices send standard PS/2 mouse packets for122122-the DualPoint Stick. For non interleaved dualpoint devices the pointingstick123123-buttons get reported separately in the PSM, PSR and PSL bits.122122+the DualPoint Stick. The M, R and L bits signal the combined status of both123123+the pointingstick and touchpad buttons, except for Dell dualpoint devices124124+where the pointingstick buttons get reported separately in the PSM, PSR125125+and PSL bits.124126125127Dualpoint device -- interleaved packet format126128---------------------------------------------
+5-1
MAINTAINERS
···56005600IRQCHIP DRIVERS56015601M: Thomas Gleixner <tglx@linutronix.de>56025602M: Jason Cooper <jason@lakedaemon.net>56035603+M: Marc Zyngier <marc.zyngier@arm.com>56035604L: linux-kernel@vger.kernel.org56045605S: Maintained56055606T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core···56095608F: drivers/irqchip/5610560956115610IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)56125612-M: Benjamin Herrenschmidt <benh@kernel.crashing.org>56115611+M: Jiang Liu <jiang.liu@linux.intel.com>56125612+M: Marc Zyngier <marc.zyngier@arm.com>56135613S: Maintained56145614+T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core56145615F: Documentation/IRQ-domain.txt56155616F: include/linux/irqdomain.h56165617F: kernel/irq/irqdomain.c56185618+F: kernel/irq/msi.c5617561956185620ISAPNP56195621M: Jaroslav Kysela <perex@perex.cz>
+8-3
Makefile
···11VERSION = 422PATCHLEVEL = 233SUBLEVEL = 044-EXTRAVERSION = -rc444+EXTRAVERSION = -rc655NAME = Hurr durr I'ma sheep6677# *DOCUMENTATION*···597597# Defaults to vmlinux, but the arch makefile usually adds further targets598598all: vmlinux599599600600+# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default601601+# values of the respective KBUILD_* variables602602+ARCH_CPPFLAGS :=603603+ARCH_AFLAGS :=604604+ARCH_CFLAGS :=600605include arch/$(SRCARCH)/Makefile601606602607KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)···853848mod_compress_cmd = true854849ifdef CONFIG_MODULE_COMPRESS855850 ifdef CONFIG_MODULE_COMPRESS_GZIP856856- mod_compress_cmd = gzip -n851851+ mod_compress_cmd = gzip -n -f857852 endif # CONFIG_MODULE_COMPRESS_GZIP858853 ifdef CONFIG_MODULE_COMPRESS_XZ859859- mod_compress_cmd = xz854854+ mod_compress_cmd = xz -f860855 endif # CONFIG_MODULE_COMPRESS_XZ861856endif # CONFIG_MODULE_COMPRESS862857export mod_compress_cmd
+11-2
arch/arc/Kconfig
···313313314314config ARC_PAGE_SIZE_16K315315 bool "16KB"316316- depends on ARC_MMU_V3316316+ depends on ARC_MMU_V3 || ARC_MMU_V4317317318318config ARC_PAGE_SIZE_4K319319 bool "4KB"320320- depends on ARC_MMU_V3320320+ depends on ARC_MMU_V3 || ARC_MMU_V4321321322322endchoice323323···365365 default y366366 depends on !ARC_CANT_LLSC367367368368+config ARC_STAR_9000923308369369+ bool "Workaround for llock/scond livelock"370370+ default y371371+ depends on ISA_ARCV2 && SMP && ARC_HAS_LLSC372372+368373config ARC_HAS_SWAPE369374 bool "Insn: SWAPE (endian-swap)"370375 default y···382377 Enable gcc to generate 64-bit load/store instructions383378 ISA mandates even/odd registers to allow encoding of two384379 dest operands with 2 possible source operands.380380+ default y381381+382382+config ARC_HAS_DIV_REM383383+ bool "Insn: div, divu, rem, remu"385384 default y386385387386config ARC_HAS_RTC
···2020struct pt_regs {21212222 /* Real registers */2323- long bta; /* bta_l1, bta_l2, erbta */2323+ unsigned long bta; /* bta_l1, bta_l2, erbta */24242525- long lp_start, lp_end, lp_count;2525+ unsigned long lp_start, lp_end, lp_count;26262727- long status32; /* status32_l1, status32_l2, erstatus */2828- long ret; /* ilink1, ilink2 or eret */2929- long blink;3030- long fp;3131- long r26; /* gp */2727+ unsigned long status32; /* status32_l1, status32_l2, erstatus */2828+ unsigned long ret; /* ilink1, ilink2 or eret */2929+ unsigned long blink;3030+ unsigned long fp;3131+ unsigned long r26; /* gp */32323333- long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;3333+ unsigned long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;34343535- long sp; /* user/kernel sp depending on where we came from */3636- long orig_r0;3535+ unsigned long sp; /* User/Kernel depending on where we came from */3636+ unsigned long orig_r0;37373838 /*3939 * To distinguish bet excp, syscall, irq···5555 unsigned long event;5656 };57575858- long user_r25;5858+ unsigned long user_r25;5959};6060#else61616262struct pt_regs {63636464- long orig_r0;6464+ unsigned long orig_r0;65656666 union {6767 struct {···7676 unsigned long event;7777 };78787979- long bta; /* bta_l1, bta_l2, erbta */7979+ unsigned long bta; /* bta_l1, bta_l2, erbta */80808181- long user_r25;8181+ unsigned long user_r25;82828383- long r26; /* gp */8484- long fp;8585- long sp; /* user/kernel sp depending on where we came from */8383+ unsigned long r26; /* gp */8484+ unsigned long fp;8585+ unsigned long sp; /* user/kernel sp depending on where we came from */86868787- long r12;8787+ unsigned long r12;88888989 /*------- Below list auto saved by h/w -----------*/9090- long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11;9090+ unsigned long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11;91919292- long blink;9393- long lp_end, lp_start, lp_count;9292+ unsigned long blink;9393+ unsigned long lp_end, lp_start, lp_count;94949595- long ei, ldi, jli;9595+ unsigned long ei, ldi, jli;96969797- long ret;9898- long status32;9797+ unsigned long ret;9898+ unsigned long status32;9999};100100101101#endif···103103/* Callee saved registers - need to be saved only when you are scheduled out */104104105105struct callee_regs {106106- long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13;106106+ unsigned long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13;107107};108108109109-#define instruction_pointer(regs) (unsigned long)((regs)->ret)109109+#define instruction_pointer(regs) ((regs)->ret)110110#define profile_pc(regs) instruction_pointer(regs)111111112112/* return 1 if user mode or 0 if kernel mode */···142142143143static inline long regs_return_value(struct pt_regs *regs)144144{145145- return regs->r0;145145+ return (long)regs->r0;146146}147147148148#endif /* !__ASSEMBLY__ */
+523-15
arch/arc/include/asm/spinlock.h
···1818#define arch_spin_unlock_wait(x) \1919 do { while (arch_spin_is_locked(x)) cpu_relax(); } while (0)20202121+#ifdef CONFIG_ARC_HAS_LLSC2222+2323+/*2424+ * A normal LLOCK/SCOND based system, w/o need for livelock workaround2525+ */2626+#ifndef CONFIG_ARC_STAR_90009233082727+2128static inline void arch_spin_lock(arch_spinlock_t *lock)2229{2323- unsigned int tmp = __ARCH_SPIN_LOCK_LOCKED__;3030+ unsigned int val;3131+3232+ smp_mb();3333+3434+ __asm__ __volatile__(3535+ "1: llock %[val], [%[slock]] \n"3636+ " breq %[val], %[LOCKED], 1b \n" /* spin while LOCKED */3737+ " scond %[LOCKED], [%[slock]] \n" /* acquire */3838+ " bnz 1b \n"3939+ " \n"4040+ : [val] "=&r" (val)4141+ : [slock] "r" (&(lock->slock)),4242+ [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__)4343+ : "memory", "cc");4444+4545+ smp_mb();4646+}4747+4848+/* 1 - lock taken successfully */4949+static inline int arch_spin_trylock(arch_spinlock_t *lock)5050+{5151+ unsigned int val, got_it = 0;5252+5353+ smp_mb();5454+5555+ __asm__ __volatile__(5656+ "1: llock %[val], [%[slock]] \n"5757+ " breq %[val], %[LOCKED], 4f \n" /* already LOCKED, just bail */5858+ " scond %[LOCKED], [%[slock]] \n" /* acquire */5959+ " bnz 1b \n"6060+ " mov %[got_it], 1 \n"6161+ "4: \n"6262+ " \n"6363+ : [val] "=&r" (val),6464+ [got_it] "+&r" (got_it)6565+ : [slock] "r" (&(lock->slock)),6666+ [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__)6767+ : "memory", "cc");6868+6969+ smp_mb();7070+7171+ return got_it;7272+}7373+7474+static inline void arch_spin_unlock(arch_spinlock_t *lock)7575+{7676+ smp_mb();7777+7878+ lock->slock = __ARCH_SPIN_LOCK_UNLOCKED__;7979+8080+ smp_mb();8181+}8282+8383+/*8484+ * Read-write spinlocks, allowing multiple readers but only one writer.8585+ * Unfair locking as Writers could be starved indefinitely by Reader(s)8686+ */8787+8888+static inline void arch_read_lock(arch_rwlock_t *rw)8989+{9090+ unsigned int val;9191+9292+ smp_mb();9393+9494+ /*9595+ * zero means writer holds the lock exclusively, deny Reader.9696+ * Otherwise grant lock to first/subseq reader9797+ *9898+ * if (rw->counter > 0) {9999+ * rw->counter--;100100+ * ret = 1;101101+ * }102102+ */103103+104104+ __asm__ __volatile__(105105+ "1: llock %[val], [%[rwlock]] \n"106106+ " brls %[val], %[WR_LOCKED], 1b\n" /* <= 0: spin while write locked */107107+ " sub %[val], %[val], 1 \n" /* reader lock */108108+ " scond %[val], [%[rwlock]] \n"109109+ " bnz 1b \n"110110+ " \n"111111+ : [val] "=&r" (val)112112+ : [rwlock] "r" (&(rw->counter)),113113+ [WR_LOCKED] "ir" (0)114114+ : "memory", "cc");115115+116116+ smp_mb();117117+}118118+119119+/* 1 - lock taken successfully */120120+static inline int arch_read_trylock(arch_rwlock_t *rw)121121+{122122+ unsigned int val, got_it = 0;123123+124124+ smp_mb();125125+126126+ __asm__ __volatile__(127127+ "1: llock %[val], [%[rwlock]] \n"128128+ " brls %[val], %[WR_LOCKED], 4f\n" /* <= 0: already write locked, bail */129129+ " sub %[val], %[val], 1 \n" /* counter-- */130130+ " scond %[val], [%[rwlock]] \n"131131+ " bnz 1b \n" /* retry if collided with someone */132132+ " mov %[got_it], 1 \n"133133+ " \n"134134+ "4: ; --- done --- \n"135135+136136+ : [val] "=&r" (val),137137+ [got_it] "+&r" (got_it)138138+ : [rwlock] "r" (&(rw->counter)),139139+ [WR_LOCKED] "ir" (0)140140+ : "memory", "cc");141141+142142+ smp_mb();143143+144144+ return got_it;145145+}146146+147147+static inline void arch_write_lock(arch_rwlock_t *rw)148148+{149149+ unsigned int val;150150+151151+ smp_mb();152152+153153+ /*154154+ * If reader(s) hold lock (lock < __ARCH_RW_LOCK_UNLOCKED__),155155+ * deny writer. Otherwise if unlocked grant to writer156156+ * Hence the claim that Linux rwlocks are unfair to writers.157157+ * (can be starved for an indefinite time by readers).158158+ *159159+ * if (rw->counter == __ARCH_RW_LOCK_UNLOCKED__) {160160+ * rw->counter = 0;161161+ * ret = 1;162162+ * }163163+ */164164+165165+ __asm__ __volatile__(166166+ "1: llock %[val], [%[rwlock]] \n"167167+ " brne %[val], %[UNLOCKED], 1b \n" /* while !UNLOCKED spin */168168+ " mov %[val], %[WR_LOCKED] \n"169169+ " scond %[val], [%[rwlock]] \n"170170+ " bnz 1b \n"171171+ " \n"172172+ : [val] "=&r" (val)173173+ : [rwlock] "r" (&(rw->counter)),174174+ [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__),175175+ [WR_LOCKED] "ir" (0)176176+ : "memory", "cc");177177+178178+ smp_mb();179179+}180180+181181+/* 1 - lock taken successfully */182182+static inline int arch_write_trylock(arch_rwlock_t *rw)183183+{184184+ unsigned int val, got_it = 0;185185+186186+ smp_mb();187187+188188+ __asm__ __volatile__(189189+ "1: llock %[val], [%[rwlock]] \n"190190+ " brne %[val], %[UNLOCKED], 4f \n" /* !UNLOCKED, bail */191191+ " mov %[val], %[WR_LOCKED] \n"192192+ " scond %[val], [%[rwlock]] \n"193193+ " bnz 1b \n" /* retry if collided with someone */194194+ " mov %[got_it], 1 \n"195195+ " \n"196196+ "4: ; --- done --- \n"197197+198198+ : [val] "=&r" (val),199199+ [got_it] "+&r" (got_it)200200+ : [rwlock] "r" (&(rw->counter)),201201+ [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__),202202+ [WR_LOCKED] "ir" (0)203203+ : "memory", "cc");204204+205205+ smp_mb();206206+207207+ return got_it;208208+}209209+210210+static inline void arch_read_unlock(arch_rwlock_t *rw)211211+{212212+ unsigned int val;213213+214214+ smp_mb();215215+216216+ /*217217+ * rw->counter++;218218+ */219219+ __asm__ __volatile__(220220+ "1: llock %[val], [%[rwlock]] \n"221221+ " add %[val], %[val], 1 \n"222222+ " scond %[val], [%[rwlock]] \n"223223+ " bnz 1b \n"224224+ " \n"225225+ : [val] "=&r" (val)226226+ : [rwlock] "r" (&(rw->counter))227227+ : "memory", "cc");228228+229229+ smp_mb();230230+}231231+232232+static inline void arch_write_unlock(arch_rwlock_t *rw)233233+{234234+ smp_mb();235235+236236+ rw->counter = __ARCH_RW_LOCK_UNLOCKED__;237237+238238+ smp_mb();239239+}240240+241241+#else /* CONFIG_ARC_STAR_9000923308 */242242+243243+/*244244+ * HS38x4 could get into a LLOCK/SCOND livelock in case of multiple overlapping245245+ * coherency transactions in the SCU. The exclusive line state keeps rotating246246+ * among contenting cores leading to a never ending cycle. So break the cycle247247+ * by deferring the retry of failed exclusive access (SCOND). The actual delay248248+ * needed is function of number of contending cores as well as the unrelated249249+ * coherency traffic from other cores. To keep the code simple, start off with250250+ * small delay of 1 which would suffice most cases and in case of contention251251+ * double the delay. Eventually the delay is sufficient such that the coherency252252+ * pipeline is drained, thus a subsequent exclusive access would succeed.253253+ */254254+255255+#define SCOND_FAIL_RETRY_VAR_DEF \256256+ unsigned int delay, tmp; \257257+258258+#define SCOND_FAIL_RETRY_ASM \259259+ " ; --- scond fail delay --- \n" \260260+ " mov %[tmp], %[delay] \n" /* tmp = delay */ \261261+ "2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \262262+ " sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \263263+ " rol %[delay], %[delay] \n" /* delay *= 2 */ \264264+ " b 1b \n" /* start over */ \265265+ " \n" \266266+ "4: ; --- done --- \n" \267267+268268+#define SCOND_FAIL_RETRY_VARS \269269+ ,[delay] "=&r" (delay), [tmp] "=&r" (tmp) \270270+271271+static inline void arch_spin_lock(arch_spinlock_t *lock)272272+{273273+ unsigned int val;274274+ SCOND_FAIL_RETRY_VAR_DEF;275275+276276+ smp_mb();277277+278278+ __asm__ __volatile__(279279+ "0: mov %[delay], 1 \n"280280+ "1: llock %[val], [%[slock]] \n"281281+ " breq %[val], %[LOCKED], 0b \n" /* spin while LOCKED */282282+ " scond %[LOCKED], [%[slock]] \n" /* acquire */283283+ " bz 4f \n" /* done */284284+ " \n"285285+ SCOND_FAIL_RETRY_ASM286286+287287+ : [val] "=&r" (val)288288+ SCOND_FAIL_RETRY_VARS289289+ : [slock] "r" (&(lock->slock)),290290+ [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__)291291+ : "memory", "cc");292292+293293+ smp_mb();294294+}295295+296296+/* 1 - lock taken successfully */297297+static inline int arch_spin_trylock(arch_spinlock_t *lock)298298+{299299+ unsigned int val, got_it = 0;300300+ SCOND_FAIL_RETRY_VAR_DEF;301301+302302+ smp_mb();303303+304304+ __asm__ __volatile__(305305+ "0: mov %[delay], 1 \n"306306+ "1: llock %[val], [%[slock]] \n"307307+ " breq %[val], %[LOCKED], 4f \n" /* already LOCKED, just bail */308308+ " scond %[LOCKED], [%[slock]] \n" /* acquire */309309+ " bz.d 4f \n"310310+ " mov.z %[got_it], 1 \n" /* got it */311311+ " \n"312312+ SCOND_FAIL_RETRY_ASM313313+314314+ : [val] "=&r" (val),315315+ [got_it] "+&r" (got_it)316316+ SCOND_FAIL_RETRY_VARS317317+ : [slock] "r" (&(lock->slock)),318318+ [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__)319319+ : "memory", "cc");320320+321321+ smp_mb();322322+323323+ return got_it;324324+}325325+326326+static inline void arch_spin_unlock(arch_spinlock_t *lock)327327+{328328+ smp_mb();329329+330330+ lock->slock = __ARCH_SPIN_LOCK_UNLOCKED__;331331+332332+ smp_mb();333333+}334334+335335+/*336336+ * Read-write spinlocks, allowing multiple readers but only one writer.337337+ * Unfair locking as Writers could be starved indefinitely by Reader(s)338338+ */339339+340340+static inline void arch_read_lock(arch_rwlock_t *rw)341341+{342342+ unsigned int val;343343+ SCOND_FAIL_RETRY_VAR_DEF;344344+345345+ smp_mb();346346+347347+ /*348348+ * zero means writer holds the lock exclusively, deny Reader.349349+ * Otherwise grant lock to first/subseq reader350350+ *351351+ * if (rw->counter > 0) {352352+ * rw->counter--;353353+ * ret = 1;354354+ * }355355+ */356356+357357+ __asm__ __volatile__(358358+ "0: mov %[delay], 1 \n"359359+ "1: llock %[val], [%[rwlock]] \n"360360+ " brls %[val], %[WR_LOCKED], 0b\n" /* <= 0: spin while write locked */361361+ " sub %[val], %[val], 1 \n" /* reader lock */362362+ " scond %[val], [%[rwlock]] \n"363363+ " bz 4f \n" /* done */364364+ " \n"365365+ SCOND_FAIL_RETRY_ASM366366+367367+ : [val] "=&r" (val)368368+ SCOND_FAIL_RETRY_VARS369369+ : [rwlock] "r" (&(rw->counter)),370370+ [WR_LOCKED] "ir" (0)371371+ : "memory", "cc");372372+373373+ smp_mb();374374+}375375+376376+/* 1 - lock taken successfully */377377+static inline int arch_read_trylock(arch_rwlock_t *rw)378378+{379379+ unsigned int val, got_it = 0;380380+ SCOND_FAIL_RETRY_VAR_DEF;381381+382382+ smp_mb();383383+384384+ __asm__ __volatile__(385385+ "0: mov %[delay], 1 \n"386386+ "1: llock %[val], [%[rwlock]] \n"387387+ " brls %[val], %[WR_LOCKED], 4f\n" /* <= 0: already write locked, bail */388388+ " sub %[val], %[val], 1 \n" /* counter-- */389389+ " scond %[val], [%[rwlock]] \n"390390+ " bz.d 4f \n"391391+ " mov.z %[got_it], 1 \n" /* got it */392392+ " \n"393393+ SCOND_FAIL_RETRY_ASM394394+395395+ : [val] "=&r" (val),396396+ [got_it] "+&r" (got_it)397397+ SCOND_FAIL_RETRY_VARS398398+ : [rwlock] "r" (&(rw->counter)),399399+ [WR_LOCKED] "ir" (0)400400+ : "memory", "cc");401401+402402+ smp_mb();403403+404404+ return got_it;405405+}406406+407407+static inline void arch_write_lock(arch_rwlock_t *rw)408408+{409409+ unsigned int val;410410+ SCOND_FAIL_RETRY_VAR_DEF;411411+412412+ smp_mb();413413+414414+ /*415415+ * If reader(s) hold lock (lock < __ARCH_RW_LOCK_UNLOCKED__),416416+ * deny writer. Otherwise if unlocked grant to writer417417+ * Hence the claim that Linux rwlocks are unfair to writers.418418+ * (can be starved for an indefinite time by readers).419419+ *420420+ * if (rw->counter == __ARCH_RW_LOCK_UNLOCKED__) {421421+ * rw->counter = 0;422422+ * ret = 1;423423+ * }424424+ */425425+426426+ __asm__ __volatile__(427427+ "0: mov %[delay], 1 \n"428428+ "1: llock %[val], [%[rwlock]] \n"429429+ " brne %[val], %[UNLOCKED], 0b \n" /* while !UNLOCKED spin */430430+ " mov %[val], %[WR_LOCKED] \n"431431+ " scond %[val], [%[rwlock]] \n"432432+ " bz 4f \n"433433+ " \n"434434+ SCOND_FAIL_RETRY_ASM435435+436436+ : [val] "=&r" (val)437437+ SCOND_FAIL_RETRY_VARS438438+ : [rwlock] "r" (&(rw->counter)),439439+ [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__),440440+ [WR_LOCKED] "ir" (0)441441+ : "memory", "cc");442442+443443+ smp_mb();444444+}445445+446446+/* 1 - lock taken successfully */447447+static inline int arch_write_trylock(arch_rwlock_t *rw)448448+{449449+ unsigned int val, got_it = 0;450450+ SCOND_FAIL_RETRY_VAR_DEF;451451+452452+ smp_mb();453453+454454+ __asm__ __volatile__(455455+ "0: mov %[delay], 1 \n"456456+ "1: llock %[val], [%[rwlock]] \n"457457+ " brne %[val], %[UNLOCKED], 4f \n" /* !UNLOCKED, bail */458458+ " mov %[val], %[WR_LOCKED] \n"459459+ " scond %[val], [%[rwlock]] \n"460460+ " bz.d 4f \n"461461+ " mov.z %[got_it], 1 \n" /* got it */462462+ " \n"463463+ SCOND_FAIL_RETRY_ASM464464+465465+ : [val] "=&r" (val),466466+ [got_it] "+&r" (got_it)467467+ SCOND_FAIL_RETRY_VARS468468+ : [rwlock] "r" (&(rw->counter)),469469+ [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__),470470+ [WR_LOCKED] "ir" (0)471471+ : "memory", "cc");472472+473473+ smp_mb();474474+475475+ return got_it;476476+}477477+478478+static inline void arch_read_unlock(arch_rwlock_t *rw)479479+{480480+ unsigned int val;481481+482482+ smp_mb();483483+484484+ /*485485+ * rw->counter++;486486+ */487487+ __asm__ __volatile__(488488+ "1: llock %[val], [%[rwlock]] \n"489489+ " add %[val], %[val], 1 \n"490490+ " scond %[val], [%[rwlock]] \n"491491+ " bnz 1b \n"492492+ " \n"493493+ : [val] "=&r" (val)494494+ : [rwlock] "r" (&(rw->counter))495495+ : "memory", "cc");496496+497497+ smp_mb();498498+}499499+500500+static inline void arch_write_unlock(arch_rwlock_t *rw)501501+{502502+ unsigned int val;503503+504504+ smp_mb();505505+506506+ /*507507+ * rw->counter = __ARCH_RW_LOCK_UNLOCKED__;508508+ */509509+ __asm__ __volatile__(510510+ "1: llock %[val], [%[rwlock]] \n"511511+ " scond %[UNLOCKED], [%[rwlock]]\n"512512+ " bnz 1b \n"513513+ " \n"514514+ : [val] "=&r" (val)515515+ : [rwlock] "r" (&(rw->counter)),516516+ [UNLOCKED] "r" (__ARCH_RW_LOCK_UNLOCKED__)517517+ : "memory", "cc");518518+519519+ smp_mb();520520+}521521+522522+#undef SCOND_FAIL_RETRY_VAR_DEF523523+#undef SCOND_FAIL_RETRY_ASM524524+#undef SCOND_FAIL_RETRY_VARS525525+526526+#endif /* CONFIG_ARC_STAR_9000923308 */527527+528528+#else /* !CONFIG_ARC_HAS_LLSC */529529+530530+static inline void arch_spin_lock(arch_spinlock_t *lock)531531+{532532+ unsigned int val = __ARCH_SPIN_LOCK_LOCKED__;2453325534 /*26535 * This smp_mb() is technically superfluous, we only need the one···54233 __asm__ __volatile__(54334 "1: ex %0, [%1] \n"54435 " breq %0, %2, 1b \n"545545- : "+&r" (tmp)3636+ : "+&r" (val)54637 : "r"(&(lock->slock)), "ir"(__ARCH_SPIN_LOCK_LOCKED__)54738 : "memory");54839···55748 smp_mb();55849}559505151+/* 1 - lock taken successfully */56052static inline int arch_spin_trylock(arch_spinlock_t *lock)56153{562562- unsigned int tmp = __ARCH_SPIN_LOCK_LOCKED__;5454+ unsigned int val = __ARCH_SPIN_LOCK_LOCKED__;5635556456 smp_mb();5655756658 __asm__ __volatile__(56759 "1: ex %0, [%1] \n"568568- : "+r" (tmp)6060+ : "+r" (val)56961 : "r"(&(lock->slock))57062 : "memory");5716357264 smp_mb();57365574574- return (tmp == __ARCH_SPIN_LOCK_UNLOCKED__);6666+ return (val == __ARCH_SPIN_LOCK_UNLOCKED__);57567}5766857769static inline void arch_spin_unlock(arch_spinlock_t *lock)57870{579579- unsigned int tmp = __ARCH_SPIN_LOCK_UNLOCKED__;7171+ unsigned int val = __ARCH_SPIN_LOCK_UNLOCKED__;5807258173 /*58274 * RELEASE barrier: given the instructions avail on ARCv2, full barrier···5877758878 __asm__ __volatile__(58979 " ex %0, [%1] \n"590590- : "+r" (tmp)8080+ : "+r" (val)59181 : "r"(&(lock->slock))59282 : "memory");59383···6009060191/*60292 * Read-write spinlocks, allowing multiple readers but only one writer.9393+ * Unfair locking as Writers could be starved indefinitely by Reader(s)60394 *60495 * The spinlock itself is contained in @counter and access to it is60596 * serialized with @lock_mutex.606606- *607607- * Unfair locking as Writers could be starved indefinitely by Reader(s)60897 */609609-610610-/* Would read_trylock() succeed? */611611-#define arch_read_can_lock(x) ((x)->counter > 0)612612-613613-/* Would write_trylock() succeed? */614614-#define arch_write_can_lock(x) ((x)->counter == __ARCH_RW_LOCK_UNLOCKED__)6159861699/* 1 - lock taken successfully */617100static inline int arch_read_trylock(arch_rwlock_t *rw)···675172 rw->counter = __ARCH_RW_LOCK_UNLOCKED__;676173 arch_spin_unlock(&(rw->lock_mutex));677174}175175+176176+#endif177177+178178+#define arch_read_can_lock(x) ((x)->counter > 0)179179+#define arch_write_can_lock(x) ((x)->counter == __ARCH_RW_LOCK_UNLOCKED__)678180679181#define arch_read_lock_flags(lock, flags) arch_read_lock(lock)680182#define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
···389389390390static void __init axs103_early_init(void)391391{392392+ /*393393+ * AXS103 configurations for SMP/QUAD configurations share device tree394394+ * which defaults to 90 MHz. However recent failures of Quad config395395+ * revealed P&R timing violations so clamp it down to safe 50 MHz396396+ * Instead of duplicating defconfig/DT for SMP/QUAD, add a small hack397397+ *398398+ * This hack is really hacky as of now. Fix it properly by getting the399399+ * number of cores as return value of platform's early SMP callback400400+ */401401+#ifdef CONFIG_ARC_MCIP402402+ unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F;403403+ if (num_cores > 2)404404+ arc_set_core_freq(50 * 1000000);405405+#endif406406+392407 switch (arc_get_core_freq()/1000000) {393408 case 33:394409 axs103_set_freq(1, 1, 1);
···1515 bootargs = "root=/dev/ram0 console=ttyAMA1,115200n8 earlyprintk";1616 };17171818+ aliases {1919+ serial1 = &uart1;2020+ };2121+1822 src@101e0000 {1923 /* These chrystal drivers are not used on this board */2024 disable-sxtalo;
···23732373 * registers. This address is needed early so the OCP registers that23742374 * are part of the device's address space can be ioremapped properly.23752375 *23762376+ * If SYSC access is not needed, the registers will not be remapped23772377+ * and non-availability of MPU access is not treated as an error.23782378+ *23762379 * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and23772380 * -ENXIO on absent or invalid register target address space.23782381 */···2390238723912388 _save_mpu_port_index(oh);2392238923902390+ /* if we don't need sysc access we don't need to ioremap */23912391+ if (!oh->class->sysc)23922392+ return 0;23932393+23942394+ /* we can't continue without MPU PORT if we need sysc access */23932395 if (oh->_int_flags & _HWMOD_NO_MPU_PORT)23942396 return -ENXIO;23952397···24042396 oh->name);2405239724062398 /* Extract the IO space from device tree blob */24072407- if (!np)23992399+ if (!np) {24002400+ pr_err("omap_hwmod: %s: no dt node\n", oh->name);24082401 return -ENXIO;24022402+ }2409240324102404 va_start = of_iomap(np, index + oh->mpu_rt_idx);24112405 } else {···24662456 oh->name, np->name);24672457 }2468245824692469- if (oh->class->sysc) {24702470- r = _init_mpu_rt_base(oh, NULL, index, np);24712471- if (r < 0) {24722472- WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n",24732473- oh->name);24742474- return 0;24752475- }24592459+ r = _init_mpu_rt_base(oh, NULL, index, np);24602460+ if (r < 0) {24612461+ WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n",24622462+ oh->name);24632463+ return 0;24762464 }2477246524782466 r = _init_clocks(oh, NULL);
···152152 .set noreorder153153 bltz k0, 8f154154 move k1, sp155155+#ifdef CONFIG_EVA156156+ /*157157+ * Flush interAptiv's Return Prediction Stack (RPS) by writing158158+ * EntryHi. Toggling Config7.RPS is slower and less portable.159159+ *160160+ * The RPS isn't automatically flushed when exceptions are161161+ * taken, which can result in kernel mode speculative accesses162162+ * to user addresses if the RPS mispredicts. That's harmless163163+ * when user and kernel share the same address space, but with164164+ * EVA the same user segments may be unmapped to kernel mode,165165+ * even containing sensitive MMIO regions or invalid memory.166166+ *167167+ * This can happen when the kernel sets the return address to168168+ * ret_from_* and jr's to the exception handler, which looks169169+ * more like a tail call than a function call. If nested calls170170+ * don't evict the last user address in the RPS, it will171171+ * mispredict the return and fetch from a user controlled172172+ * address into the icache.173173+ *174174+ * More recent EVA-capable cores with MAAR to restrict175175+ * speculative accesses aren't affected.176176+ */177177+ MFC0 k0, CP0_ENTRYHI178178+ MTC0 k0, CP0_ENTRYHI179179+#endif155180 .set reorder156181 /* Called from user mode, new stack. */157182 get_saved_sp
+3-2
arch/mips/kernel/mips-mt-fpaff.c
···154154 unsigned long __user *user_mask_ptr)155155{156156 unsigned int real_len;157157- cpumask_t mask;157157+ cpumask_t allowed, mask;158158 int retval;159159 struct task_struct *p;160160···173173 if (retval)174174 goto out_unlock;175175176176- cpumask_and(&mask, &p->thread.user_cpus_allowed, cpu_possible_mask);176176+ cpumask_or(&allowed, &p->thread.user_cpus_allowed, &p->cpus_allowed);177177+ cpumask_and(&mask, &allowed, cpu_active_mask);177178178179out_unlock:179180 read_unlock(&tasklist_lock);
···284284 if (action == 0)285285 scheduler_ipi();286286 else287287- smp_call_function_interrupt();287287+ generic_smp_call_function_interrupt();288288289289 return IRQ_HANDLED;290290}···336336 if (action & SMP_RESCHEDULE_YOURSELF)337337 scheduler_ipi();338338 if (action & SMP_CALL_FUNCTION)339339- smp_call_function_interrupt();339339+ generic_smp_call_function_interrupt();340340341341 return IRQ_HANDLED;342342}
-10
arch/mips/kernel/smp.c
···192192 cpu_startup_entry(CPUHP_ONLINE);193193}194194195195-/*196196- * Call into both interrupt handlers, as we share the IPI for them197197- */198198-void __irq_entry smp_call_function_interrupt(void)199199-{200200- irq_enter();201201- generic_smp_call_function_interrupt();202202- irq_exit();203203-}204204-205195static void stop_this_cpu(void *dummy)206196{207197 /*
+13
arch/mips/kernel/traps.c
···192192void show_stack(struct task_struct *task, unsigned long *sp)193193{194194 struct pt_regs regs;195195+ mm_segment_t old_fs = get_fs();195196 if (sp) {196197 regs.regs[29] = (unsigned long)sp;197198 regs.regs[31] = 0;···211210 prepare_frametrace(®s);212211 }213212 }213213+ /*214214+ * show_stack() deals exclusively with kernel mode, so be sure to access215215+ * the stack in the kernel (not user) address space.216216+ */217217+ set_fs(KERNEL_DS);214218 show_stacktrace(task, ®s);219219+ set_fs(old_fs);215220}216221217222static void show_code(unsigned int __user *pc)···15261519 const int field = 2 * sizeof(unsigned long);15271520 int multi_match = regs->cp0_status & ST0_TS;15281521 enum ctx_state prev_state;15221522+ mm_segment_t old_fs = get_fs();1529152315301524 prev_state = exception_enter();15311525 show_regs(regs);···15481540 dump_tlb_all();15491541 }1550154215431543+ if (!user_mode(regs))15441544+ set_fs(KERNEL_DS);15451545+15511546 show_code((unsigned int __user *) regs->cp0_epc);15471547+15481548+ set_fs(old_fs);1552154915531550 /*15541551 * Some chips may have other causes of machine check (e.g. SB1
···154154155155 return mips_cpu_perf_irq;156156}157157+EXPORT_SYMBOL_GPL(get_c0_perfcount_int);157158158159unsigned int get_c0_compare_int(void)159160{···172171173172static void __init init_rtc(void)174173{175175- /* stop the clock whilst setting it up */176176- CMOS_WRITE(RTC_SET | RTC_24H, RTC_CONTROL);174174+ unsigned char freq, ctrl;177175178178- /* 32KHz time base */179179- CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT);176176+ /* Set 32KHz time base if not already set */177177+ freq = CMOS_READ(RTC_FREQ_SELECT);178178+ if ((freq & RTC_DIV_CTL) != RTC_REF_CLCK_32KHZ)179179+ CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT);180180181181- /* start the clock */182182- CMOS_WRITE(RTC_24H, RTC_CONTROL);181181+ /* Ensure SET bit is clear so RTC can run */182182+ ctrl = CMOS_READ(RTC_CONTROL);183183+ if (ctrl & RTC_SET)184184+ CMOS_WRITE(ctrl & ~RTC_SET, RTC_CONTROL);183185}184186185187void __init plat_time_init(void)
+1
arch/mips/mti-sead3/sead3-time.c
···7777 return MIPS_CPU_IRQ_BASE + cp0_perfcount_irq;7878 return -1;7979}8080+EXPORT_SYMBOL_GPL(get_c0_perfcount_int);80818182unsigned int get_c0_compare_int(void)8283{
···2929#include <asm/sibyte/bcm1480_regs.h>3030#include <asm/sibyte/bcm1480_int.h>31313232-extern void smp_call_function_interrupt(void);3333-3432/*3533 * These are routines for dealing with the bcm1480 smp capabilities3634 * independent of board/firmware···182184 if (action & SMP_RESCHEDULE_YOURSELF)183185 scheduler_ipi();184186185185- if (action & SMP_CALL_FUNCTION)186186- smp_call_function_interrupt();187187+ if (action & SMP_CALL_FUNCTION) {188188+ irq_enter();189189+ generic_smp_call_function_interrupt();190190+ irq_exit();191191+ }187192}
+5-2
arch/mips/sibyte/sb1250/smp.c
···172172 if (action & SMP_RESCHEDULE_YOURSELF)173173 scheduler_ipi();174174175175- if (action & SMP_CALL_FUNCTION)176176- smp_call_function_interrupt();175175+ if (action & SMP_CALL_FUNCTION) {176176+ irq_enter();177177+ generic_smp_call_function_interrupt();178178+ irq_exit();179179+ }177180}
···2220222022212221static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int nid, unsigned shift,22222222 unsigned levels, unsigned long limit,22232223- unsigned long *current_offset)22232223+ unsigned long *current_offset, unsigned long *total_allocated)22242224{22252225 struct page *tce_mem = NULL;22262226 __be64 *addr, *tmp;···22362236 }22372237 addr = page_address(tce_mem);22382238 memset(addr, 0, allocated);22392239+ *total_allocated += allocated;2239224022402241 --levels;22412242 if (!levels) {···2246224522472246 for (i = 0; i < entries; ++i) {22482247 tmp = pnv_pci_ioda2_table_do_alloc_pages(nid, shift,22492249- levels, limit, current_offset);22482248+ levels, limit, current_offset, total_allocated);22502249 if (!tmp)22512250 break;22522251···22682267 struct iommu_table *tbl)22692268{22702269 void *addr;22712271- unsigned long offset = 0, level_shift;22702270+ unsigned long offset = 0, level_shift, total_allocated = 0;22722271 const unsigned window_shift = ilog2(window_size);22732272 unsigned entries_shift = window_shift - page_shift;22742273 unsigned table_shift = max_t(unsigned, entries_shift + 3, PAGE_SHIFT);···2287228622882287 /* Allocate TCE table */22892288 addr = pnv_pci_ioda2_table_do_alloc_pages(nid, level_shift,22902290- levels, tce_table_size, &offset);22892289+ levels, tce_table_size, &offset, &total_allocated);2291229022922291 /* addr==NULL means that the first level allocation failed */22932292 if (!addr)···23092308 page_shift);23102309 tbl->it_level_size = 1ULL << (level_shift - 3);23112310 tbl->it_indirect_levels = levels - 1;23122312- tbl->it_allocated_size = offset;23112311+ tbl->it_allocated_size = total_allocated;2313231223142313 pr_devel("Created TCE table: ws=%08llx ts=%lx @%08llx\n",23152314 window_size, tce_table_size, bus_offset);
+2-2
arch/s390/kvm/kvm-s390.c
···1742174217431743static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu)17441744{17451745- if (!vcpu->requests)17461746- return 0;17471745retry:17481746 kvm_s390_vcpu_request_handled(vcpu);17471747+ if (!vcpu->requests)17481748+ return 0;17491749 /*17501750 * We use MMU_RELOAD just to re-arm the ipte notifier for the17511751 * guest prefix page. gmap_ipte_notify will wait on the ptl lock.
···135135void VISenter(void);136136EXPORT_SYMBOL(VISenter);137137138138-/* CRYPTO code needs this */139139-void VISenterhalf(void);140140-EXPORT_SYMBOL(VISenterhalf);141141-142138extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *);143139extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *,144140 unsigned long *);
···11931193 unsigned int e820_type = 0;11941194 unsigned long m = efi->efi_memmap;1195119511961196+#ifdef CONFIG_X86_6411971197+ m |= (u64)efi->efi_memmap_hi << 32;11981198+#endif11991199+11961200 d = (efi_memory_desc_t *)(m + (i * efi->efi_memdesc_size));11971201 switch (d->type) {11981202 case EFI_RESERVED_TYPE:
-15
arch/x86/include/asm/desc.h
···280280 set_ldt(NULL, 0);281281}282282283283-/*284284- * load one particular LDT into the current CPU285285- */286286-static inline void load_LDT_nolock(mm_context_t *pc)287287-{288288- set_ldt(pc->ldt, pc->size);289289-}290290-291291-static inline void load_LDT(mm_context_t *pc)292292-{293293- preempt_disable();294294- load_LDT_nolock(pc);295295- preempt_enable();296296-}297297-298283static inline unsigned long get_desc_base(const struct desc_struct *desc)299284{300285 return (unsigned)(desc->base0 | ((desc->base1) << 16) | ((desc->base2) << 24));
+1-2
arch/x86/include/asm/mmu.h
···99 * we put the segment information here.1010 */1111typedef struct {1212- void *ldt;1313- int size;1212+ struct ldt_struct *ldt;14131514#ifdef CONFIG_X86_641615 /* True if mm supports a task running in 32 bit compatibility mode. */
+49-5
arch/x86/include/asm/mmu_context.h
···3434#endif35353636/*3737+ * ldt_structs can be allocated, used, and freed, but they are never3838+ * modified while live.3939+ */4040+struct ldt_struct {4141+ /*4242+ * Xen requires page-aligned LDTs with special permissions. This is4343+ * needed to prevent us from installing evil descriptors such as4444+ * call gates. On native, we could merge the ldt_struct and LDT4545+ * allocations, but it's not worth trying to optimize.4646+ */4747+ struct desc_struct *entries;4848+ int size;4949+};5050+5151+static inline void load_mm_ldt(struct mm_struct *mm)5252+{5353+ struct ldt_struct *ldt;5454+5555+ /* lockless_dereference synchronizes with smp_store_release */5656+ ldt = lockless_dereference(mm->context.ldt);5757+5858+ /*5959+ * Any change to mm->context.ldt is followed by an IPI to all6060+ * CPUs with the mm active. The LDT will not be freed until6161+ * after the IPI is handled by all such CPUs. This means that,6262+ * if the ldt_struct changes before we return, the values we see6363+ * will be safe, and the new values will be loaded before we run6464+ * any user code.6565+ *6666+ * NB: don't try to convert this to use RCU without extreme care.6767+ * We would still need IRQs off, because we don't want to change6868+ * the local LDT after an IPI loaded a newer value than the one6969+ * that we can see.7070+ */7171+7272+ if (unlikely(ldt))7373+ set_ldt(ldt->entries, ldt->size);7474+ else7575+ clear_LDT();7676+7777+ DEBUG_LOCKS_WARN_ON(preemptible());7878+}7979+8080+/*3781 * Used for LDT copy/destruction.3882 */3983int init_new_context(struct task_struct *tsk, struct mm_struct *mm);···12278 * was called and then modify_ldt changed12379 * prev->context.ldt but suppressed an IPI to this CPU.12480 * In this case, prev->context.ldt != NULL, because we125125- * never free an LDT while the mm still exists. That126126- * means that next->context.ldt != prev->context.ldt,127127- * because mms never share an LDT.8181+ * never set context.ldt to NULL while the mm still8282+ * exists. That means that next->context.ldt !=8383+ * prev->context.ldt, because mms never share an LDT.12884 */12985 if (unlikely(prev->context.ldt != next->context.ldt))130130- load_LDT_nolock(&next->context);8686+ load_mm_ldt(next);13187 }13288#ifdef CONFIG_SMP13389 else {···150106 load_cr3(next->pgd);151107 trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);152108 load_mm_cr4(next);153153- load_LDT_nolock(&next->context);109109+ load_mm_ldt(next);154110 }155111 }156112#endif
+3-3
arch/x86/include/asm/sigcontext.h
···5757 unsigned long ip;5858 unsigned long flags;5959 unsigned short cs;6060- unsigned short __pad2; /* Was called gs, but was always zero. */6161- unsigned short __pad1; /* Was called fs, but was always zero. */6262- unsigned short ss;6060+ unsigned short gs;6161+ unsigned short fs;6262+ unsigned short __pad0;6363 unsigned long err;6464 unsigned long trapno;6565 unsigned long oldmask;
+3-18
arch/x86/include/uapi/asm/sigcontext.h
···177177 __u64 rip;178178 __u64 eflags; /* RFLAGS */179179 __u16 cs;180180-181181- /*182182- * Prior to 2.5.64 ("[PATCH] x86-64 updates for 2.5.64-bk3"),183183- * Linux saved and restored fs and gs in these slots. This184184- * was counterproductive, as fsbase and gsbase were never185185- * saved, so arch_prctl was presumably unreliable.186186- *187187- * If these slots are ever needed for any other purpose, there188188- * is some risk that very old 64-bit binaries could get189189- * confused. I doubt that many such binaries still work,190190- * though, since the same patch in 2.5.64 also removed the191191- * 64-bit set_thread_area syscall, so it appears that there is192192- * no TLS API that works in both pre- and post-2.5.64 kernels.193193- */194194- __u16 __pad2; /* Was gs. */195195- __u16 __pad1; /* Was fs. */196196-197197- __u16 ss;180180+ __u16 gs;181181+ __u16 fs;182182+ __u16 __pad0;198183 __u64 err;199184 __u64 trapno;200185 __u64 oldmask;
···21792179 int idx = segment >> 3;2180218021812181 if ((segment & SEGMENT_TI_MASK) == SEGMENT_LDT) {21822182+ struct ldt_struct *ldt;21832183+21822184 if (idx > LDT_ENTRIES)21832185 return 0;2184218621852185- if (idx > current->active_mm->context.size)21872187+ /* IRQs are off, so this synchronizes with smp_store_release */21882188+ ldt = lockless_dereference(current->active_mm->context.ldt);21892189+ if (!ldt || idx > ldt->size)21862190 return 0;2187219121882188- desc = current->active_mm->context.ldt;21922192+ desc = &ldt->entries[idx];21892193 } else {21902194 if (idx > GDT_ENTRIES)21912195 return 0;2192219621932193- desc = raw_cpu_ptr(gdt_page.gdt);21972197+ desc = raw_cpu_ptr(gdt_page.gdt) + idx;21942198 }2195219921962196- return get_desc_base(desc + idx);22002200+ return get_desc_base(desc);21972201}2198220221992203#ifdef CONFIG_COMPAT
+142-120
arch/x86/kernel/ldt.c
···1212#include <linux/string.h>1313#include <linux/mm.h>1414#include <linux/smp.h>1515+#include <linux/slab.h>1516#include <linux/vmalloc.h>1617#include <linux/uaccess.h>1718···2120#include <asm/mmu_context.h>2221#include <asm/syscalls.h>23222424-#ifdef CONFIG_SMP2323+/* context.lock is held for us, so we don't need any locking. */2524static void flush_ldt(void *current_mm)2625{2727- if (current->active_mm == current_mm)2828- load_LDT(¤t->active_mm->context);2626+ mm_context_t *pc;2727+2828+ if (current->active_mm != current_mm)2929+ return;3030+3131+ pc = ¤t->active_mm->context;3232+ set_ldt(pc->ldt->entries, pc->ldt->size);2933}3030-#endif31343232-static int alloc_ldt(mm_context_t *pc, int mincount, int reload)3535+/* The caller must call finalize_ldt_struct on the result. LDT starts zeroed. */3636+static struct ldt_struct *alloc_ldt_struct(int size)3337{3434- void *oldldt, *newldt;3535- int oldsize;3838+ struct ldt_struct *new_ldt;3939+ int alloc_size;36403737- if (mincount <= pc->size)3838- return 0;3939- oldsize = pc->size;4040- mincount = (mincount + (PAGE_SIZE / LDT_ENTRY_SIZE - 1)) &4141- (~(PAGE_SIZE / LDT_ENTRY_SIZE - 1));4242- if (mincount * LDT_ENTRY_SIZE > PAGE_SIZE)4343- newldt = vmalloc(mincount * LDT_ENTRY_SIZE);4141+ if (size > LDT_ENTRIES)4242+ return NULL;4343+4444+ new_ldt = kmalloc(sizeof(struct ldt_struct), GFP_KERNEL);4545+ if (!new_ldt)4646+ return NULL;4747+4848+ BUILD_BUG_ON(LDT_ENTRY_SIZE != sizeof(struct desc_struct));4949+ alloc_size = size * LDT_ENTRY_SIZE;5050+5151+ /*5252+ * Xen is very picky: it requires a page-aligned LDT that has no5353+ * trailing nonzero bytes in any page that contains LDT descriptors.5454+ * Keep it simple: zero the whole allocation and never allocate less5555+ * than PAGE_SIZE.5656+ */5757+ if (alloc_size > PAGE_SIZE)5858+ new_ldt->entries = vzalloc(alloc_size);4459 else4545- newldt = (void *)__get_free_page(GFP_KERNEL);6060+ new_ldt->entries = kzalloc(PAGE_SIZE, GFP_KERNEL);46614747- if (!newldt)4848- return -ENOMEM;4949-5050- if (oldsize)5151- memcpy(newldt, pc->ldt, oldsize * LDT_ENTRY_SIZE);5252- oldldt = pc->ldt;5353- memset(newldt + oldsize * LDT_ENTRY_SIZE, 0,5454- (mincount - oldsize) * LDT_ENTRY_SIZE);5555-5656- paravirt_alloc_ldt(newldt, mincount);5757-5858-#ifdef CONFIG_X86_645959- /* CHECKME: Do we really need this ? */6060- wmb();6161-#endif6262- pc->ldt = newldt;6363- wmb();6464- pc->size = mincount;6565- wmb();6666-6767- if (reload) {6868-#ifdef CONFIG_SMP6969- preempt_disable();7070- load_LDT(pc);7171- if (!cpumask_equal(mm_cpumask(current->mm),7272- cpumask_of(smp_processor_id())))7373- smp_call_function(flush_ldt, current->mm, 1);7474- preempt_enable();7575-#else7676- load_LDT(pc);7777-#endif6262+ if (!new_ldt->entries) {6363+ kfree(new_ldt);6464+ return NULL;7865 }7979- if (oldsize) {8080- paravirt_free_ldt(oldldt, oldsize);8181- if (oldsize * LDT_ENTRY_SIZE > PAGE_SIZE)8282- vfree(oldldt);8383- else8484- put_page(virt_to_page(oldldt));8585- }8686- return 0;6666+6767+ new_ldt->size = size;6868+ return new_ldt;8769}88708989-static inline int copy_ldt(mm_context_t *new, mm_context_t *old)7171+/* After calling this, the LDT is immutable. */7272+static void finalize_ldt_struct(struct ldt_struct *ldt)9073{9191- int err = alloc_ldt(new, old->size, 0);9292- int i;7474+ paravirt_alloc_ldt(ldt->entries, ldt->size);7575+}93769494- if (err < 0)9595- return err;7777+/* context.lock is held */7878+static void install_ldt(struct mm_struct *current_mm,7979+ struct ldt_struct *ldt)8080+{8181+ /* Synchronizes with lockless_dereference in load_mm_ldt. */8282+ smp_store_release(¤t_mm->context.ldt, ldt);96839797- for (i = 0; i < old->size; i++)9898- write_ldt_entry(new->ldt, i, old->ldt + i * LDT_ENTRY_SIZE);9999- return 0;8484+ /* Activate the LDT for all CPUs using current_mm. */8585+ on_each_cpu_mask(mm_cpumask(current_mm), flush_ldt, current_mm, true);8686+}8787+8888+static void free_ldt_struct(struct ldt_struct *ldt)8989+{9090+ if (likely(!ldt))9191+ return;9292+9393+ paravirt_free_ldt(ldt->entries, ldt->size);9494+ if (ldt->size * LDT_ENTRY_SIZE > PAGE_SIZE)9595+ vfree(ldt->entries);9696+ else9797+ kfree(ldt->entries);9898+ kfree(ldt);10099}101100102101/*···105104 */106105int init_new_context(struct task_struct *tsk, struct mm_struct *mm)107106{107107+ struct ldt_struct *new_ldt;108108 struct mm_struct *old_mm;109109 int retval = 0;110110111111 mutex_init(&mm->context.lock);112112- mm->context.size = 0;113112 old_mm = current->mm;114114- if (old_mm && old_mm->context.size > 0) {115115- mutex_lock(&old_mm->context.lock);116116- retval = copy_ldt(&mm->context, &old_mm->context);117117- mutex_unlock(&old_mm->context.lock);113113+ if (!old_mm) {114114+ mm->context.ldt = NULL;115115+ return 0;118116 }117117+118118+ mutex_lock(&old_mm->context.lock);119119+ if (!old_mm->context.ldt) {120120+ mm->context.ldt = NULL;121121+ goto out_unlock;122122+ }123123+124124+ new_ldt = alloc_ldt_struct(old_mm->context.ldt->size);125125+ if (!new_ldt) {126126+ retval = -ENOMEM;127127+ goto out_unlock;128128+ }129129+130130+ memcpy(new_ldt->entries, old_mm->context.ldt->entries,131131+ new_ldt->size * LDT_ENTRY_SIZE);132132+ finalize_ldt_struct(new_ldt);133133+134134+ mm->context.ldt = new_ldt;135135+136136+out_unlock:137137+ mutex_unlock(&old_mm->context.lock);119138 return retval;120139}121140···146125 */147126void destroy_context(struct mm_struct *mm)148127{149149- if (mm->context.size) {150150-#ifdef CONFIG_X86_32151151- /* CHECKME: Can this ever happen ? */152152- if (mm == current->active_mm)153153- clear_LDT();154154-#endif155155- paravirt_free_ldt(mm->context.ldt, mm->context.size);156156- if (mm->context.size * LDT_ENTRY_SIZE > PAGE_SIZE)157157- vfree(mm->context.ldt);158158- else159159- put_page(virt_to_page(mm->context.ldt));160160- mm->context.size = 0;161161- }128128+ free_ldt_struct(mm->context.ldt);129129+ mm->context.ldt = NULL;162130}163131164132static int read_ldt(void __user *ptr, unsigned long bytecount)165133{166166- int err;134134+ int retval;167135 unsigned long size;168136 struct mm_struct *mm = current->mm;169137170170- if (!mm->context.size)171171- return 0;138138+ mutex_lock(&mm->context.lock);139139+140140+ if (!mm->context.ldt) {141141+ retval = 0;142142+ goto out_unlock;143143+ }144144+172145 if (bytecount > LDT_ENTRY_SIZE * LDT_ENTRIES)173146 bytecount = LDT_ENTRY_SIZE * LDT_ENTRIES;174147175175- mutex_lock(&mm->context.lock);176176- size = mm->context.size * LDT_ENTRY_SIZE;148148+ size = mm->context.ldt->size * LDT_ENTRY_SIZE;177149 if (size > bytecount)178150 size = bytecount;179151180180- err = 0;181181- if (copy_to_user(ptr, mm->context.ldt, size))182182- err = -EFAULT;183183- mutex_unlock(&mm->context.lock);184184- if (err < 0)185185- goto error_return;152152+ if (copy_to_user(ptr, mm->context.ldt->entries, size)) {153153+ retval = -EFAULT;154154+ goto out_unlock;155155+ }156156+186157 if (size != bytecount) {187187- /* zero-fill the rest */188188- if (clear_user(ptr + size, bytecount - size) != 0) {189189- err = -EFAULT;190190- goto error_return;158158+ /* Zero-fill the rest and pretend we read bytecount bytes. */159159+ if (clear_user(ptr + size, bytecount - size)) {160160+ retval = -EFAULT;161161+ goto out_unlock;191162 }192163 }193193- return bytecount;194194-error_return:195195- return err;164164+ retval = bytecount;165165+166166+out_unlock:167167+ mutex_unlock(&mm->context.lock);168168+ return retval;196169}197170198171static int read_default_ldt(void __user *ptr, unsigned long bytecount)···210195 struct desc_struct ldt;211196 int error;212197 struct user_desc ldt_info;198198+ int oldsize, newsize;199199+ struct ldt_struct *new_ldt, *old_ldt;213200214201 error = -EINVAL;215202 if (bytecount != sizeof(ldt_info))···230213 goto out;231214 }232215233233- mutex_lock(&mm->context.lock);234234- if (ldt_info.entry_number >= mm->context.size) {235235- error = alloc_ldt(¤t->mm->context,236236- ldt_info.entry_number + 1, 1);237237- if (error < 0)238238- goto out_unlock;239239- }240240-241241- /* Allow LDTs to be cleared by the user. */242242- if (ldt_info.base_addr == 0 && ldt_info.limit == 0) {243243- if (oldmode || LDT_empty(&ldt_info)) {244244- memset(&ldt, 0, sizeof(ldt));245245- goto install;216216+ if ((oldmode && !ldt_info.base_addr && !ldt_info.limit) ||217217+ LDT_empty(&ldt_info)) {218218+ /* The user wants to clear the entry. */219219+ memset(&ldt, 0, sizeof(ldt));220220+ } else {221221+ if (!IS_ENABLED(CONFIG_X86_16BIT) && !ldt_info.seg_32bit) {222222+ error = -EINVAL;223223+ goto out;246224 }225225+226226+ fill_ldt(&ldt, &ldt_info);227227+ if (oldmode)228228+ ldt.avl = 0;247229 }248230249249- if (!IS_ENABLED(CONFIG_X86_16BIT) && !ldt_info.seg_32bit) {250250- error = -EINVAL;231231+ mutex_lock(&mm->context.lock);232232+233233+ old_ldt = mm->context.ldt;234234+ oldsize = old_ldt ? old_ldt->size : 0;235235+ newsize = max((int)(ldt_info.entry_number + 1), oldsize);236236+237237+ error = -ENOMEM;238238+ new_ldt = alloc_ldt_struct(newsize);239239+ if (!new_ldt)251240 goto out_unlock;252252- }253241254254- fill_ldt(&ldt, &ldt_info);255255- if (oldmode)256256- ldt.avl = 0;242242+ if (old_ldt)243243+ memcpy(new_ldt->entries, old_ldt->entries, oldsize * LDT_ENTRY_SIZE);244244+ new_ldt->entries[ldt_info.entry_number] = ldt;245245+ finalize_ldt_struct(new_ldt);257246258258- /* Install the new entry ... */259259-install:260260- write_ldt_entry(mm->context.ldt, ldt_info.entry_number, &ldt);247247+ install_ldt(mm, new_ldt);248248+ free_ldt_struct(old_ldt);261249 error = 0;262250263251out_unlock:
+2-2
arch/x86/kernel/process_64.c
···121121void release_thread(struct task_struct *dead_task)122122{123123 if (dead_task->mm) {124124- if (dead_task->mm->context.size) {124124+ if (dead_task->mm->context.ldt) {125125 pr_warn("WARNING: dead process %s still has LDT? <%p/%d>\n",126126 dead_task->comm,127127 dead_task->mm->context.ldt,128128- dead_task->mm->context.size);128128+ dead_task->mm->context.ldt->size);129129 BUG();130130 }131131 }
+11-15
arch/x86/kernel/signal.c
···9393 COPY(r15);9494#endif /* CONFIG_X86_64 */95959696+#ifdef CONFIG_X86_329697 COPY_SEG_CPL3(cs);9798 COPY_SEG_CPL3(ss);9999+#else /* !CONFIG_X86_32 */100100+ /* Kernel saves and restores only the CS segment register on signals,101101+ * which is the bare minimum needed to allow mixed 32/64-bit code.102102+ * App's signal handler can save/restore other segments if needed. */103103+ COPY_SEG_CPL3(cs);104104+#endif /* CONFIG_X86_32 */9810599106 get_user_ex(tmpflags, &sc->flags);100107 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);···161154#else /* !CONFIG_X86_32 */162155 put_user_ex(regs->flags, &sc->flags);163156 put_user_ex(regs->cs, &sc->cs);164164- put_user_ex(0, &sc->__pad2);165165- put_user_ex(0, &sc->__pad1);166166- put_user_ex(regs->ss, &sc->ss);157157+ put_user_ex(0, &sc->gs);158158+ put_user_ex(0, &sc->fs);167159#endif /* CONFIG_X86_32 */168160169161 put_user_ex(fpstate, &sc->fpstate);···457451458452 regs->sp = (unsigned long)frame;459453460460- /*461461- * Set up the CS and SS registers to run signal handlers in462462- * 64-bit mode, even if the handler happens to be interrupting463463- * 32-bit or 16-bit code.464464- *465465- * SS is subtle. In 64-bit mode, we don't need any particular466466- * SS descriptor, but we do need SS to be valid. It's possible467467- * that the old SS is entirely bogus -- this can happen if the468468- * signal we're trying to deliver is #GP or #SS caused by a bad469469- * SS value.470470- */454454+ /* Set up the CS register to run signal handlers in 64-bit mode,455455+ even if the handler happens to be interrupting 32-bit code. */471456 regs->cs = __USER_CS;472472- regs->ss = __USER_DS;473457474458 return 0;475459}
+4-2
arch/x86/kernel/step.c
···55#include <linux/mm.h>66#include <linux/ptrace.h>77#include <asm/desc.h>88+#include <asm/mmu_context.h>89910unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs)1011{···3130 seg &= ~7UL;32313332 mutex_lock(&child->mm->context.lock);3434- if (unlikely((seg >> 3) >= child->mm->context.size))3333+ if (unlikely(!child->mm->context.ldt ||3434+ (seg >> 3) >= child->mm->context.ldt->size))3535 addr = -1L; /* bogus selector, access would fault */3636 else {3737- desc = child->mm->context.ldt + seg;3737+ desc = &child->mm->context.ldt->entries[seg];3838 base = get_desc_base(desc);39394040 /* 16-bit code segment? */
+4-4
arch/x86/kvm/mtrr.c
···672672 if (iter.mtrr_disabled)673673 return mtrr_disabled_type();674674675675+ /* not contained in any MTRRs. */676676+ if (type == -1)677677+ return mtrr_default_type(mtrr_state);678678+675679 /*676680 * We just check one page, partially covered by MTRRs is677681 * impossible.678682 */679683 WARN_ON(iter.partial_map);680680-681681- /* not contained in any MTRRs. */682682- if (type == -1)683683- return mtrr_default_type(mtrr_state);684684685685 return type;686686}
+5
arch/x86/platform/efi/efi.c
···972972973973static int __init arch_parse_efi_cmdline(char *str)974974{975975+ if (!str) {976976+ pr_warn("need at least one option\n");977977+ return -EINVAL;978978+ }979979+975980 if (parse_option_str(str, "old_map"))976981 set_bit(EFI_OLD_MEMMAP, &efi.flags);977982 if (parse_option_str(str, "debug"))
+2-1
arch/x86/power/cpu.c
···2222#include <asm/fpu/internal.h>2323#include <asm/debugreg.h>2424#include <asm/cpu.h>2525+#include <asm/mmu_context.h>25262627#ifdef CONFIG_X86_322728__visible unsigned long saved_context_ebx;···154153 syscall_init(); /* This sets MSR_*STAR and related */155154#endif156155 load_TR_desc(); /* This does ltr */157157- load_LDT(¤t->active_mm->context); /* This does lldt */156156+ load_mm_ldt(current->active_mm); /* This does lldt */158157159158 fpu__resume_cpu();160159}
···483483 pte_t pte;484484 unsigned long pfn;485485 struct page *page;486486+ unsigned char dummy;486487487488 ptep = lookup_address((unsigned long)v, &level);488489 BUG_ON(ptep == NULL);···492491 page = pfn_to_page(pfn);493492494493 pte = pfn_pte(pfn, prot);494494+495495+ /*496496+ * Careful: update_va_mapping() will fail if the virtual address497497+ * we're poking isn't populated in the page tables. We don't498498+ * need to worry about the direct map (that's always in the page499499+ * tables), but we need to be careful about vmap space. In500500+ * particular, the top level page table can lazily propagate501501+ * entries between processes, so if we've switched mms since we502502+ * vmapped the target in the first place, we might not have the503503+ * top-level page table entry populated.504504+ *505505+ * We disable preemption because we want the same mm active when506506+ * we probe the target and when we issue the hypercall. We'll507507+ * have the same nominal mm, but if we're a kernel thread, lazy508508+ * mm dropping could change our pgd.509509+ *510510+ * Out of an abundance of caution, this uses __get_user() to fault511511+ * in the target address just in case there's some obscure case512512+ * in which the target address isn't readable.513513+ */514514+515515+ preempt_disable();516516+517517+ pagefault_disable(); /* Avoid warnings due to being atomic. */518518+ __get_user(dummy, (unsigned char __user __force *)v);519519+ pagefault_enable();495520496521 if (HYPERVISOR_update_va_mapping((unsigned long)v, pte, 0))497522 BUG();···530503 BUG();531504 } else532505 kmap_flush_unused();506506+507507+ preempt_enable();533508}534509535510static void xen_alloc_ldt(struct desc_struct *ldt, unsigned entries)536511{537512 const unsigned entries_per_page = PAGE_SIZE / LDT_ENTRY_SIZE;538513 int i;514514+515515+ /*516516+ * We need to mark the all aliases of the LDT pages RO. We517517+ * don't need to call vm_flush_aliases(), though, since that's518518+ * only responsible for flushing aliases out the TLBs, not the519519+ * page tables, and Xen will flush the TLB for us if needed.520520+ *521521+ * To avoid confusing future readers: none of this is necessary522522+ * to load the LDT. The hypervisor only checks this when the523523+ * LDT is faulted in due to subsequent descriptor access.524524+ */539525540526 for(i = 0; i < entries; i += entries_per_page)541527 set_aliased_prot(ldt + i, PAGE_KERNEL_RO);
···296296 if (!blk)297297 return -ENOMEM;298298299299- present = krealloc(rbnode->cache_present,300300- BITS_TO_LONGS(blklen) * sizeof(*present), GFP_KERNEL);301301- if (!present) {302302- kfree(blk);303303- return -ENOMEM;299299+ if (BITS_TO_LONGS(blklen) > BITS_TO_LONGS(rbnode->blklen)) {300300+ present = krealloc(rbnode->cache_present,301301+ BITS_TO_LONGS(blklen) * sizeof(*present),302302+ GFP_KERNEL);303303+ if (!present) {304304+ kfree(blk);305305+ return -ENOMEM;306306+ }307307+308308+ memset(present + BITS_TO_LONGS(rbnode->blklen), 0,309309+ (BITS_TO_LONGS(blklen) - BITS_TO_LONGS(rbnode->blklen))310310+ * sizeof(*present));311311+ } else {312312+ present = rbnode->cache_present;304313 }305314306315 /* insert the register value in the correct place in the rbnode block */
+17-5
drivers/block/rbd.c
···523523# define rbd_assert(expr) ((void) 0)524524#endif /* !RBD_DEBUG */525525526526+static void rbd_osd_copyup_callback(struct rbd_obj_request *obj_request);526527static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request);527528static void rbd_img_parent_read(struct rbd_obj_request *obj_request);528529static void rbd_dev_remove_parent(struct rbd_device *rbd_dev);···18191818 obj_request_done_set(obj_request);18201819}1821182018211821+static void rbd_osd_call_callback(struct rbd_obj_request *obj_request)18221822+{18231823+ dout("%s: obj %p\n", __func__, obj_request);18241824+18251825+ if (obj_request_img_data_test(obj_request))18261826+ rbd_osd_copyup_callback(obj_request);18271827+ else18281828+ obj_request_done_set(obj_request);18291829+}18301830+18221831static void rbd_osd_req_callback(struct ceph_osd_request *osd_req,18231832 struct ceph_msg *msg)18241833{···18771866 rbd_osd_discard_callback(obj_request);18781867 break;18791868 case CEPH_OSD_OP_CALL:18691869+ rbd_osd_call_callback(obj_request);18701870+ break;18801871 case CEPH_OSD_OP_NOTIFY_ACK:18811872 case CEPH_OSD_OP_WATCH:18821873 rbd_osd_trivial_callback(obj_request);···25432530}2544253125452532static void25462546-rbd_img_obj_copyup_callback(struct rbd_obj_request *obj_request)25332533+rbd_osd_copyup_callback(struct rbd_obj_request *obj_request)25472534{25482535 struct rbd_img_request *img_request;25492536 struct rbd_device *rbd_dev;25502537 struct page **pages;25512538 u32 page_count;25392539+25402540+ dout("%s: obj %p\n", __func__, obj_request);2552254125532542 rbd_assert(obj_request->type == OBJ_REQUEST_BIO ||25542543 obj_request->type == OBJ_REQUEST_NODATA);···25782563 if (!obj_request->result)25792564 obj_request->xferred = obj_request->length;2580256525812581- /* Finish up with the normal image object callback */25822582-25832583- rbd_img_obj_callback(obj_request);25662566+ obj_request_done_set(obj_request);25842567}2585256825862569static void···2663265026642651 /* All set, send it off. */2665265226662666- orig_request->callback = rbd_img_obj_copyup_callback;26672653 osdc = &rbd_dev->rbd_client->client->osdc;26682654 img_result = rbd_obj_request_submit(osdc, orig_request);26692655 if (!img_result)
+2-2
drivers/block/xen-blkback/blkback.c
···369369 return;370370 }371371372372- if (work_pending(&blkif->persistent_purge_work)) {373373- pr_alert_ratelimited("Scheduled work from previous purge is still pending, cannot purge list\n");372372+ if (work_busy(&blkif->persistent_purge_work)) {373373+ pr_alert_ratelimited("Scheduled work from previous purge is still busy, cannot purge list\n");374374 return;375375 }376376
+72-56
drivers/block/xen-blkfront.c
···179179 ((_segs + SEGS_PER_INDIRECT_FRAME - 1)/SEGS_PER_INDIRECT_FRAME)180180181181static int blkfront_setup_indirect(struct blkfront_info *info);182182+static int blkfront_gather_backend_features(struct blkfront_info *info);182183183184static int get_id_from_freelist(struct blkfront_info *info)184185{···11291128 * Add the used indirect page back to the list of11301129 * available pages for indirect grefs.11311130 */11321132- indirect_page = pfn_to_page(s->indirect_grants[i]->pfn);11331133- list_add(&indirect_page->lru, &info->indirect_pages);11311131+ if (!info->feature_persistent) {11321132+ indirect_page = pfn_to_page(s->indirect_grants[i]->pfn);11331133+ list_add(&indirect_page->lru, &info->indirect_pages);11341134+ }11341135 s->indirect_grants[i]->gref = GRANT_INVALID_REF;11351136 list_add_tail(&s->indirect_grants[i]->node, &info->grants);11361137 }···15221519 info->shadow_free = info->ring.req_prod_pvt;15231520 info->shadow[BLK_RING_SIZE(info)-1].req.u.rw.id = 0x0fffffff;1524152115251525- rc = blkfront_setup_indirect(info);15221522+ rc = blkfront_gather_backend_features(info);15261523 if (rc) {15271524 kfree(copy);15281525 return rc;···1723172017241721static int blkfront_setup_indirect(struct blkfront_info *info)17251722{17261726- unsigned int indirect_segments, segs;17231723+ unsigned int segs;17271724 int err, i;1728172517291729- err = xenbus_gather(XBT_NIL, info->xbdev->otherend,17301730- "feature-max-indirect-segments", "%u", &indirect_segments,17311731- NULL);17321732- if (err) {17331733- info->max_indirect_segments = 0;17261726+ if (info->max_indirect_segments == 0)17341727 segs = BLKIF_MAX_SEGMENTS_PER_REQUEST;17351735- } else {17361736- info->max_indirect_segments = min(indirect_segments,17371737- xen_blkif_max_segments);17281728+ else17381729 segs = info->max_indirect_segments;17391739- }1740173017411731 err = fill_grant_buffer(info, (segs + INDIRECT_GREFS(segs)) * BLK_RING_SIZE(info));17421732 if (err)···17931797}1794179817951799/*18001800+ * Gather all backend feature-*18011801+ */18021802+static int blkfront_gather_backend_features(struct blkfront_info *info)18031803+{18041804+ int err;18051805+ int barrier, flush, discard, persistent;18061806+ unsigned int indirect_segments;18071807+18081808+ info->feature_flush = 0;18091809+18101810+ err = xenbus_gather(XBT_NIL, info->xbdev->otherend,18111811+ "feature-barrier", "%d", &barrier,18121812+ NULL);18131813+18141814+ /*18151815+ * If there's no "feature-barrier" defined, then it means18161816+ * we're dealing with a very old backend which writes18171817+ * synchronously; nothing to do.18181818+ *18191819+ * If there are barriers, then we use flush.18201820+ */18211821+ if (!err && barrier)18221822+ info->feature_flush = REQ_FLUSH | REQ_FUA;18231823+ /*18241824+ * And if there is "feature-flush-cache" use that above18251825+ * barriers.18261826+ */18271827+ err = xenbus_gather(XBT_NIL, info->xbdev->otherend,18281828+ "feature-flush-cache", "%d", &flush,18291829+ NULL);18301830+18311831+ if (!err && flush)18321832+ info->feature_flush = REQ_FLUSH;18331833+18341834+ err = xenbus_gather(XBT_NIL, info->xbdev->otherend,18351835+ "feature-discard", "%d", &discard,18361836+ NULL);18371837+18381838+ if (!err && discard)18391839+ blkfront_setup_discard(info);18401840+18411841+ err = xenbus_gather(XBT_NIL, info->xbdev->otherend,18421842+ "feature-persistent", "%u", &persistent,18431843+ NULL);18441844+ if (err)18451845+ info->feature_persistent = 0;18461846+ else18471847+ info->feature_persistent = persistent;18481848+18491849+ err = xenbus_gather(XBT_NIL, info->xbdev->otherend,18501850+ "feature-max-indirect-segments", "%u", &indirect_segments,18511851+ NULL);18521852+ if (err)18531853+ info->max_indirect_segments = 0;18541854+ else18551855+ info->max_indirect_segments = min(indirect_segments,18561856+ xen_blkif_max_segments);18571857+18581858+ return blkfront_setup_indirect(info);18591859+}18601860+18611861+/*17961862 * Invoked when the backend is finally 'ready' (and has told produced17971863 * the details about the physical device - #sectors, size, etc).17981864 */···18651807 unsigned int physical_sector_size;18661808 unsigned int binfo;18671809 int err;18681868- int barrier, flush, discard, persistent;1869181018701811 switch (info->connected) {18711812 case BLKIF_STATE_CONNECTED:···19211864 if (err != 1)19221865 physical_sector_size = sector_size;1923186619241924- info->feature_flush = 0;19251925-19261926- err = xenbus_gather(XBT_NIL, info->xbdev->otherend,19271927- "feature-barrier", "%d", &barrier,19281928- NULL);19291929-19301930- /*19311931- * If there's no "feature-barrier" defined, then it means19321932- * we're dealing with a very old backend which writes19331933- * synchronously; nothing to do.19341934- *19351935- * If there are barriers, then we use flush.19361936- */19371937- if (!err && barrier)19381938- info->feature_flush = REQ_FLUSH | REQ_FUA;19391939- /*19401940- * And if there is "feature-flush-cache" use that above19411941- * barriers.19421942- */19431943- err = xenbus_gather(XBT_NIL, info->xbdev->otherend,19441944- "feature-flush-cache", "%d", &flush,19451945- NULL);19461946-19471947- if (!err && flush)19481948- info->feature_flush = REQ_FLUSH;19491949-19501950- err = xenbus_gather(XBT_NIL, info->xbdev->otherend,19511951- "feature-discard", "%d", &discard,19521952- NULL);19531953-19541954- if (!err && discard)19551955- blkfront_setup_discard(info);19561956-19571957- err = xenbus_gather(XBT_NIL, info->xbdev->otherend,19581958- "feature-persistent", "%u", &persistent,19591959- NULL);19601960- if (err)19611961- info->feature_persistent = 0;19621962- else19631963- info->feature_persistent = persistent;19641964-19651965- err = blkfront_setup_indirect(info);18671867+ err = blkfront_gather_backend_features(info);19661868 if (err) {19671869 xenbus_dev_fatal(info->xbdev, err, "setup_indirect at %s",19681870 info->xbdev->otherend);
···905905 crypt->mode |= NPE_OP_NOT_IN_PLACE;906906 /* This was never tested by Intel907907 * for more than one dst buffer, I think. */908908- BUG_ON(req->dst->length < nbytes);909908 req_ctx->dst = NULL;910909 if (!chainup_buffers(dev, req->dst, nbytes, &dst_hook,911910 flags, DMA_FROM_DEVICE))
+16-8
drivers/crypto/qat/qat_common/qat_algs.c
···7373 ICP_QAT_HW_CIPHER_KEY_CONVERT, \7474 ICP_QAT_HW_CIPHER_DECRYPT)75757676-static atomic_t active_dev;7676+static DEFINE_MUTEX(algs_lock);7777+static unsigned int active_devs;77787879struct qat_alg_buf {7980 uint32_t len;···1281128012821281int qat_algs_register(void)12831282{12841284- if (atomic_add_return(1, &active_dev) == 1) {12831283+ int ret = 0;12841284+12851285+ mutex_lock(&algs_lock);12861286+ if (++active_devs == 1) {12851287 int i;1286128812871289 for (i = 0; i < ARRAY_SIZE(qat_algs); i++)···12931289 CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC :12941290 CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC;1295129112961296- return crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs));12921292+ ret = crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs));12971293 }12981298- return 0;12941294+ mutex_unlock(&algs_lock);12951295+ return ret;12991296}1300129713011298int qat_algs_unregister(void)13021299{13031303- if (atomic_sub_return(1, &active_dev) == 0)13041304- return crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs));13051305- return 0;13001300+ int ret = 0;13011301+13021302+ mutex_lock(&algs_lock);13031303+ if (--active_devs == 0)13041304+ ret = crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs));13051305+ mutex_unlock(&algs_lock);13061306+ return ret;13061307}1307130813081309int qat_algs_init(void)13091310{13101310- atomic_set(&active_dev, 0);13111311 crypto_get_default_rng();13121312 return 0;13131313}
+87-45
drivers/dma/at_hdmac.c
···4848 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |\4949 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES))50505151+#define ATC_MAX_DSCR_TRIALS 105252+5153/*5254 * Initial number of descriptors to allocate for each channel. This could5355 * be increased during dma usage.···287285 *288286 * @current_len: the number of bytes left before reading CTRLA289287 * @ctrla: the value of CTRLA290290- * @desc: the descriptor containing the transfer width291288 */292292-static inline int atc_calc_bytes_left(int current_len, u32 ctrla,293293- struct at_desc *desc)289289+static inline int atc_calc_bytes_left(int current_len, u32 ctrla)294290{295295- return current_len - ((ctrla & ATC_BTSIZE_MAX) << desc->tx_width);296296-}291291+ u32 btsize = (ctrla & ATC_BTSIZE_MAX);292292+ u32 src_width = ATC_REG_TO_SRC_WIDTH(ctrla);297293298298-/**299299- * atc_calc_bytes_left_from_reg - calculates the number of bytes left according300300- * to the current value of CTRLA.301301- *302302- * @current_len: the number of bytes left before reading CTRLA303303- * @atchan: the channel to read CTRLA for304304- * @desc: the descriptor containing the transfer width305305- */306306-static inline int atc_calc_bytes_left_from_reg(int current_len,307307- struct at_dma_chan *atchan, struct at_desc *desc)308308-{309309- u32 ctrla = channel_readl(atchan, CTRLA);310310-311311- return atc_calc_bytes_left(current_len, ctrla, desc);294294+ /*295295+ * According to the datasheet, when reading the Control A Register296296+ * (ctrla), the Buffer Transfer Size (btsize) bitfield refers to the297297+ * number of transfers completed on the Source Interface.298298+ * So btsize is always a number of source width transfers.299299+ */300300+ return current_len - (btsize << src_width);312301}313302314303/**···313320 struct at_desc *desc_first = atc_first_active(atchan);314321 struct at_desc *desc;315322 int ret;316316- u32 ctrla, dscr;323323+ u32 ctrla, dscr, trials;317324318325 /*319326 * If the cookie doesn't match to the currently running transfer then···339346 * the channel's DSCR register and compare it against the value340347 * of the hardware linked list structure of each child341348 * descriptor.349349+ *350350+ * The CTRLA register provides us with the amount of data351351+ * already read from the source for the current child352352+ * descriptor. So we can compute a more accurate residue by also353353+ * removing the number of bytes corresponding to this amount of354354+ * data.355355+ *356356+ * However, the DSCR and CTRLA registers cannot be read both357357+ * atomically. Hence a race condition may occur: the first read358358+ * register may refer to one child descriptor whereas the second359359+ * read may refer to a later child descriptor in the list360360+ * because of the DMA transfer progression inbetween the two361361+ * reads.362362+ *363363+ * One solution could have been to pause the DMA transfer, read364364+ * the DSCR and CTRLA then resume the DMA transfer. Nonetheless,365365+ * this approach presents some drawbacks:366366+ * - If the DMA transfer is paused, RX overruns or TX underruns367367+ * are more likey to occur depending on the system latency.368368+ * Taking the USART driver as an example, it uses a cyclic DMA369369+ * transfer to read data from the Receive Holding Register370370+ * (RHR) to avoid RX overruns since the RHR is not protected371371+ * by any FIFO on most Atmel SoCs. So pausing the DMA transfer372372+ * to compute the residue would break the USART driver design.373373+ * - The atc_pause() function masks interrupts but we'd rather374374+ * avoid to do so for system latency purpose.375375+ *376376+ * Then we'd rather use another solution: the DSCR is read a377377+ * first time, the CTRLA is read in turn, next the DSCR is read378378+ * a second time. If the two consecutive read values of the DSCR379379+ * are the same then we assume both refers to the very same380380+ * child descriptor as well as the CTRLA value read inbetween381381+ * does. For cyclic tranfers, the assumption is that a full loop382382+ * is "not so fast".383383+ * If the two DSCR values are different, we read again the CTRLA384384+ * then the DSCR till two consecutive read values from DSCR are385385+ * equal or till the maxium trials is reach.386386+ * This algorithm is very unlikely not to find a stable value for387387+ * DSCR.342388 */343389344344- ctrla = channel_readl(atchan, CTRLA);345345- rmb(); /* ensure CTRLA is read before DSCR */346390 dscr = channel_readl(atchan, DSCR);391391+ rmb(); /* ensure DSCR is read before CTRLA */392392+ ctrla = channel_readl(atchan, CTRLA);393393+ for (trials = 0; trials < ATC_MAX_DSCR_TRIALS; ++trials) {394394+ u32 new_dscr;395395+396396+ rmb(); /* ensure DSCR is read after CTRLA */397397+ new_dscr = channel_readl(atchan, DSCR);398398+399399+ /*400400+ * If the DSCR register value has not changed inside the401401+ * DMA controller since the previous read, we assume402402+ * that both the dscr and ctrla values refers to the403403+ * very same descriptor.404404+ */405405+ if (likely(new_dscr == dscr))406406+ break;407407+408408+ /*409409+ * DSCR has changed inside the DMA controller, so the410410+ * previouly read value of CTRLA may refer to an already411411+ * processed descriptor hence could be outdated.412412+ * We need to update ctrla to match the current413413+ * descriptor.414414+ */415415+ dscr = new_dscr;416416+ rmb(); /* ensure DSCR is read before CTRLA */417417+ ctrla = channel_readl(atchan, CTRLA);418418+ }419419+ if (unlikely(trials >= ATC_MAX_DSCR_TRIALS))420420+ return -ETIMEDOUT;347421348422 /* for the first descriptor we can be more accurate */349423 if (desc_first->lli.dscr == dscr)350350- return atc_calc_bytes_left(ret, ctrla, desc_first);424424+ return atc_calc_bytes_left(ret, ctrla);351425352426 ret -= desc_first->len;353427 list_for_each_entry(desc, &desc_first->tx_list, desc_node) {···425365 }426366427367 /*428428- * For the last descriptor in the chain we can calculate368368+ * For the current descriptor in the chain we can calculate429369 * the remaining bytes using the channel's register.430430- * Note that the transfer width of the first and last431431- * descriptor may differ.432370 */433433- if (!desc->lli.dscr)434434- ret = atc_calc_bytes_left_from_reg(ret, atchan, desc);371371+ ret = atc_calc_bytes_left(ret, ctrla);435372 } else {436373 /* single transfer */437437- ret = atc_calc_bytes_left_from_reg(ret, atchan, desc_first);374374+ ctrla = channel_readl(atchan, CTRLA);375375+ ret = atc_calc_bytes_left(ret, ctrla);438376 }439377440378 return ret;···784726785727 desc->txd.cookie = -EBUSY;786728 desc->total_len = desc->len = len;787787- desc->tx_width = dwidth;788729789730 /* set end-of-link to the last link descriptor of list*/790731 set_desc_eol(desc);···860803 /* First descriptor of the chain embedds additional information */861804 first->txd.cookie = -EBUSY;862805 first->total_len = len;863863-864864- /* set transfer width for the calculation of the residue */865865- first->tx_width = src_width;866866- prev->tx_width = src_width;867806868807 /* set end-of-link to the last link descriptor of list*/869808 set_desc_eol(desc);···1009956 first->txd.cookie = -EBUSY;1010957 first->total_len = total_len;101195810121012- /* set transfer width for the calculation of the residue */10131013- first->tx_width = reg_width;10141014- prev->tx_width = reg_width;10151015-1016959 /* first link descriptor of list is responsible of flags */1017960 first->txd.flags = flags; /* client is in control of this ack */1018961···1125107611261077 desc->txd.cookie = 0;11271078 desc->len = len;11281128-11291129- /*11301130- * Although we only need the transfer width for the first and11311131- * the last descriptor, its easier to set it to all descriptors.11321132- */11331133- desc->tx_width = src_width;1134107911351080 atc_desc_chain(&first, &prev, desc);11361081···12991256 /* First descriptor of the chain embedds additional information */13001257 first->txd.cookie = -EBUSY;13011258 first->total_len = buf_len;13021302- first->tx_width = reg_width;1303125913041260 return &first->txd;13051261
+1-2
drivers/dma/at_hdmac_regs.h
···112112#define ATC_SRC_WIDTH_BYTE (0x0 << 24)113113#define ATC_SRC_WIDTH_HALFWORD (0x1 << 24)114114#define ATC_SRC_WIDTH_WORD (0x2 << 24)115115+#define ATC_REG_TO_SRC_WIDTH(r) (((r) >> 24) & 0x3)115116#define ATC_DST_WIDTH_MASK (0x3 << 28) /* Destination Single Transfer Size */116117#define ATC_DST_WIDTH(x) ((x) << 28)117118#define ATC_DST_WIDTH_BYTE (0x0 << 28)···183182 * @txd: support for the async_tx api184183 * @desc_node: node on the channed descriptors list185184 * @len: descriptor byte count186186- * @tx_width: transfer width187185 * @total_len: total transaction byte count188186 */189187struct at_desc {···194194 struct dma_async_tx_descriptor txd;195195 struct list_head desc_node;196196 size_t len;197197- u32 tx_width;198197 size_t total_len;199198200199 /* Interleaved data */
+14-12
drivers/dma/at_xdmac.c
···359359 * descriptor view 2 since some fields of the configuration register360360 * depend on transfer size and src/dest addresses.361361 */362362- if (at_xdmac_chan_is_cyclic(atchan)) {362362+ if (at_xdmac_chan_is_cyclic(atchan))363363 reg = AT_XDMAC_CNDC_NDVIEW_NDV1;364364- at_xdmac_chan_write(atchan, AT_XDMAC_CC, first->lld.mbr_cfg);365365- } else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3) {364364+ else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3)366365 reg = AT_XDMAC_CNDC_NDVIEW_NDV3;367367- } else {368368- /*369369- * No need to write AT_XDMAC_CC reg, it will be done when the370370- * descriptor is fecthed.371371- */366366+ else372367 reg = AT_XDMAC_CNDC_NDVIEW_NDV2;373373- }368368+ /*369369+ * Even if the register will be updated from the configuration in the370370+ * descriptor when using view 2 or higher, the PROT bit won't be set371371+ * properly. This bit can be modified only by using the channel372372+ * configuration register.373373+ */374374+ at_xdmac_chan_write(atchan, AT_XDMAC_CC, first->lld.mbr_cfg);374375375376 reg |= AT_XDMAC_CNDC_NDDUP376377 | AT_XDMAC_CNDC_NDSUP···682681 desc->lld.mbr_sa = mem;683682 desc->lld.mbr_da = atchan->sconfig.dst_addr;684683 }685685- desc->lld.mbr_cfg = atchan->cfg;686686- dwidth = at_xdmac_get_dwidth(desc->lld.mbr_cfg);684684+ dwidth = at_xdmac_get_dwidth(atchan->cfg);687685 fixed_dwidth = IS_ALIGNED(len, 1 << dwidth)688688- ? at_xdmac_get_dwidth(desc->lld.mbr_cfg)686686+ ? dwidth689687 : AT_XDMAC_CC_DWIDTH_BYTE;690688 desc->lld.mbr_ubc = AT_XDMAC_MBR_UBC_NDV2 /* next descriptor view */691689 | AT_XDMAC_MBR_UBC_NDEN /* next descriptor dst parameter update */692690 | AT_XDMAC_MBR_UBC_NSEN /* next descriptor src parameter update */693691 | (len >> fixed_dwidth); /* microblock length */692692+ desc->lld.mbr_cfg = (atchan->cfg & ~AT_XDMAC_CC_DWIDTH_MASK) |693693+ AT_XDMAC_CC_DWIDTH(fixed_dwidth);694694 dev_dbg(chan2dev(chan),695695 "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n",696696 __func__, &desc->lld.mbr_sa, &desc->lld.mbr_da, desc->lld.mbr_ubc);
···124124 return -EINVAL;125125}126126127127-static int find_cable_index_by_name(struct extcon_dev *edev, const char *name)127127+static int find_cable_id_by_name(struct extcon_dev *edev, const char *name)128128{129129- unsigned int id = EXTCON_NONE;129129+ unsigned int id = -EINVAL;130130 int i = 0;131131132132- if (edev->max_supported == 0)133133- return -EINVAL;134134-135135- /* Find the the number of extcon cable */132132+ /* Find the id of extcon cable */136133 while (extcon_name[i]) {137134 if (!strncmp(extcon_name[i], name, CABLE_NAME_MAX)) {138135 id = i;139136 break;140137 }138138+ i++;141139 }142140143143- if (id == EXTCON_NONE)141141+ return id;142142+}143143+144144+static int find_cable_index_by_name(struct extcon_dev *edev, const char *name)145145+{146146+ unsigned int id;147147+148148+ if (edev->max_supported == 0)144149 return -EINVAL;150150+151151+ /* Find the the number of extcon cable */152152+ id = find_cable_id_by_name(edev, name);153153+ if (id < 0)154154+ return id;145155146156 return find_cable_index_by_id(edev, id);147157}···238228 struct extcon_cable *cable = container_of(attr, struct extcon_cable,239229 attr_state);240230231231+ int i = cable->cable_index;232232+241233 return sprintf(buf, "%d\n",242234 extcon_get_cable_state_(cable->edev,243243- cable->cable_index));235235+ cable->edev->supported_cable[i]));244236}245237246238/**···275263 spin_lock_irqsave(&edev->lock, flags);276264277265 if (edev->state != ((edev->state & ~mask) | (state & mask))) {266266+ u32 old_state;267267+278268 if (check_mutually_exclusive(edev, (edev->state & ~mask) |279269 (state & mask))) {280270 spin_unlock_irqrestore(&edev->lock, flags);281271 return -EPERM;282272 }283273284284- for (index = 0; index < edev->max_supported; index++) {285285- if (is_extcon_changed(edev->state, state, index, &attached))286286- raw_notifier_call_chain(&edev->nh[index], attached, edev);287287- }288288-274274+ old_state = edev->state;289275 edev->state &= ~mask;290276 edev->state |= state & mask;277277+278278+ for (index = 0; index < edev->max_supported; index++) {279279+ if (is_extcon_changed(old_state, edev->state, index,280280+ &attached))281281+ raw_notifier_call_chain(&edev->nh[index],282282+ attached, edev);283283+ }291284292285 /* This could be in interrupt handler */293286 prop_buf = (char *)get_zeroed_page(GFP_ATOMIC);···378361 */379362int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name)380363{381381- return extcon_get_cable_state_(edev, find_cable_index_by_name382382- (edev, cable_name));364364+ unsigned int id;365365+366366+ id = find_cable_id_by_name(edev, cable_name);367367+ if (id < 0)368368+ return id;369369+370370+ return extcon_get_cable_state_(edev, id);383371}384372EXPORT_SYMBOL_GPL(extcon_get_cable_state);385373···426404int extcon_set_cable_state(struct extcon_dev *edev,427405 const char *cable_name, bool cable_state)428406{429429- return extcon_set_cable_state_(edev, find_cable_index_by_name430430- (edev, cable_name), cable_state);407407+ unsigned int id;408408+409409+ id = find_cable_id_by_name(edev, cable_name);410410+ if (id < 0)411411+ return id;412412+413413+ return extcon_set_cable_state_(edev, id, cable_state);431414}432415EXPORT_SYMBOL_GPL(extcon_set_cable_state);433416
+5
drivers/firmware/efi/efi.c
···58585959static int __init parse_efi_cmdline(char *str)6060{6161+ if (!str) {6262+ pr_warn("need at least one option\n");6363+ return -EINVAL;6464+ }6565+6166 if (parse_option_str(str, "noruntime"))6267 disable_runtime = true;6368
···858858 for (p = drvdata->rdesc;859859 p <= drvdata->rdesc + drvdata->rsize - 4;) {860860 if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D &&861861- p[3] < sizeof(params)) {861861+ p[3] < ARRAY_SIZE(params)) {862862 v = params[p[3]];863863 put_unaligned(cpu_to_le32(v), (s32 *)p);864864 p += 4;
+37-33
drivers/hid/wacom_sys.c
···12841284 return error;12851285}1286128612871287+/*12881288+ * Not all devices report physical dimensions from HID.12891289+ * Compute the default from hardcoded logical dimension12901290+ * and resolution before driver overwrites them.12911291+ */12921292+static void wacom_set_default_phy(struct wacom_features *features)12931293+{12941294+ if (features->x_resolution) {12951295+ features->x_phy = (features->x_max * 100) /12961296+ features->x_resolution;12971297+ features->y_phy = (features->y_max * 100) /12981298+ features->y_resolution;12991299+ }13001300+}13011301+13021302+static void wacom_calculate_res(struct wacom_features *features)13031303+{13041304+ /* set unit to "100th of a mm" for devices not reported by HID */13051305+ if (!features->unit) {13061306+ features->unit = 0x11;13071307+ features->unitExpo = -3;13081308+ }13091309+13101310+ features->x_resolution = wacom_calc_hid_res(features->x_max,13111311+ features->x_phy,13121312+ features->unit,13131313+ features->unitExpo);13141314+ features->y_resolution = wacom_calc_hid_res(features->y_max,13151315+ features->y_phy,13161316+ features->unit,13171317+ features->unitExpo);13181318+}13191319+12871320static void wacom_wireless_work(struct work_struct *work)12881321{12891322 struct wacom *wacom = container_of(work, struct wacom, work);···13741341 if (wacom_wac1->features.type != INTUOSHT &&13751342 wacom_wac1->features.type != BAMBOO_PT)13761343 wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PAD;13441344+ wacom_set_default_phy(&wacom_wac1->features);13451345+ wacom_calculate_res(&wacom_wac1->features);13771346 snprintf(wacom_wac1->pen_name, WACOM_NAME_MAX, "%s (WL) Pen",13781347 wacom_wac1->features.name);13791348 snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX, "%s (WL) Pad",···13941359 wacom_wac2->features =13951360 *((struct wacom_features *)id->driver_data);13961361 wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;13621362+ wacom_set_default_phy(&wacom_wac2->features);13971363 wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096;13641364+ wacom_calculate_res(&wacom_wac2->features);13981365 snprintf(wacom_wac2->touch_name, WACOM_NAME_MAX,13991366 "%s (WL) Finger",wacom_wac2->features.name);14001367 snprintf(wacom_wac2->pad_name, WACOM_NAME_MAX,···14421405 wacom->battery) {14431406 wacom_destroy_battery(wacom);14441407 }14451445-}14461446-14471447-/*14481448- * Not all devices report physical dimensions from HID.14491449- * Compute the default from hardcoded logical dimension14501450- * and resolution before driver overwrites them.14511451- */14521452-static void wacom_set_default_phy(struct wacom_features *features)14531453-{14541454- if (features->x_resolution) {14551455- features->x_phy = (features->x_max * 100) /14561456- features->x_resolution;14571457- features->y_phy = (features->y_max * 100) /14581458- features->y_resolution;14591459- }14601460-}14611461-14621462-static void wacom_calculate_res(struct wacom_features *features)14631463-{14641464- /* set unit to "100th of a mm" for devices not reported by HID */14651465- if (!features->unit) {14661466- features->unit = 0x11;14671467- features->unitExpo = -3;14681468- }14691469-14701470- features->x_resolution = wacom_calc_hid_res(features->x_max,14711471- features->x_phy,14721472- features->unit,14731473- features->unitExpo);14741474- features->y_resolution = wacom_calc_hid_res(features->y_max,14751475- features->y_phy,14761476- features->unit,14771477- features->unitExpo);14781408}1479140914801410static size_t wacom_compute_pktlen(struct hid_device *hdev)
+17-1
drivers/hwmon/dell-smm-hwmon.c
···929929930930MODULE_DEVICE_TABLE(dmi, i8k_dmi_table);931931932932+static struct dmi_system_id i8k_blacklist_dmi_table[] __initdata = {933933+ {934934+ /*935935+ * CPU fan speed going up and down on Dell Studio XPS 8100936936+ * for unknown reasons.937937+ */938938+ .ident = "Dell Studio XPS 8100",939939+ .matches = {940940+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."),941941+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Studio XPS 8100"),942942+ },943943+ },944944+ { }945945+};946946+932947/*933948 * Probe for the presence of a supported laptop.934949 */···955940 /*956941 * Get DMI information957942 */958958- if (!dmi_check_system(i8k_dmi_table)) {943943+ if (!dmi_check_system(i8k_dmi_table) ||944944+ dmi_check_system(i8k_blacklist_dmi_table)) {959945 if (!ignore_dmi && !force)960946 return -ENODEV;961947
+1
drivers/hwmon/g762.c
···582582 { .compatible = "gmt,g763" },583583 { },584584};585585+MODULE_DEVICE_TABLE(of, g762_dt_match);585586586587/*587588 * Grab clock (a required property), enable it, get (fixed) clock frequency
···196196 if (n_buttons[i] < 1)197197 continue;198198199199- if (n_buttons[i] > 6) {199199+ if (n_buttons[i] > ARRAY_SIZE(tgfx_buttons)) {200200 printk(KERN_ERR "turbografx.c: Invalid number of buttons %d\n", n_buttons[i]);201201 err = -EINVAL;202202 goto err_unreg_devs;
+1
drivers/input/misc/axp20x-pek.c
···292292MODULE_DESCRIPTION("axp20x Power Button");293293MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");294294MODULE_LICENSE("GPL");295295+MODULE_ALIAS("platform:axp20x-pek");
+2-1
drivers/input/misc/twl4030-vibra.c
···183183 if (pdata && pdata->coexist)184184 return true;185185186186- if (of_find_node_by_name(node, "codec")) {186186+ node = of_find_node_by_name(node, "codec");187187+ if (node) {187188 of_node_put(node);188189 return true;189190 }
+6-2
drivers/input/mouse/alps.c
···2020#include <linux/input/mt.h>2121#include <linux/serio.h>2222#include <linux/libps2.h>2323+#include <linux/dmi.h>23242425#include "psmouse.h"2526#include "alps.h"···10099#define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */101100#define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with102101 6-byte ALPS packet */102102+#define ALPS_DELL 0x100 /* device is a Dell laptop */103103#define ALPS_BUTTONPAD 0x200 /* device is a clickpad */104104105105static const struct alps_model_info alps_model_data[] = {···253251 return;254252 }255253256256- /* Non interleaved V2 dualpoint has separate stick button bits */254254+ /* Dell non interleaved V2 dualpoint has separate stick button bits */257255 if (priv->proto_version == ALPS_PROTO_V2 &&258258- priv->flags == (ALPS_PASS | ALPS_DUALPOINT)) {256256+ priv->flags == (ALPS_DELL | ALPS_PASS | ALPS_DUALPOINT)) {259257 left |= packet[0] & 1;260258 right |= packet[0] & 2;261259 middle |= packet[0] & 4;···25522550 priv->byte0 = protocol->byte0;25532551 priv->mask0 = protocol->mask0;25542552 priv->flags = protocol->flags;25532553+ if (dmi_name_in_vendors("Dell"))25542554+ priv->flags |= ALPS_DELL;2555255525562556 priv->x_max = 2000;25572557 priv->y_max = 1400;
+20-2
drivers/input/mouse/elantech.c
···783783 struct elantech_data *etd = psmouse->private;784784 unsigned char *packet = psmouse->packet;785785 unsigned char packet_type = packet[3] & 0x03;786786+ unsigned int ic_version;786787 bool sanity_check;787788788789 if (etd->tp_dev && (packet[3] & 0x0f) == 0x06)789790 return PACKET_TRACKPOINT;790791792792+ /* This represents the version of IC body. */793793+ ic_version = (etd->fw_version & 0x0f0000) >> 16;794794+791795 /*792796 * Sanity check based on the constant bits of a packet.793797 * The constant bits change depending on the value of794794- * the hardware flag 'crc_enabled' but are the same for795795- * every packet, regardless of the type.798798+ * the hardware flag 'crc_enabled' and the version of799799+ * the IC body, but are the same for every packet,800800+ * regardless of the type.796801 */797802 if (etd->crc_enabled)798803 sanity_check = ((packet[3] & 0x08) == 0x00);804804+ else if (ic_version == 7 && etd->samples[1] == 0x2A)805805+ sanity_check = ((packet[3] & 0x1c) == 0x10);799806 else800807 sanity_check = ((packet[0] & 0x0c) == 0x04 &&801808 (packet[3] & 0x1c) == 0x10);···11231116 * Avatar AVIU-145A2 0x361f00 ? clickpad11241117 * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons11251118 * Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons11191119+ * Fujitsu T725 0x470f01 05, 12, 09 2 hw buttons11261120 * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**)11271121 * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons11281122 * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*)···16581650 "Synaptics capabilities query result 0x%02x, 0x%02x, 0x%02x.\n",16591651 etd->capabilities[0], etd->capabilities[1],16601652 etd->capabilities[2]);16531653+16541654+ if (etd->hw_version != 1) {16551655+ if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY, etd->samples)) {16561656+ psmouse_err(psmouse, "failed to query sample data\n");16571657+ goto init_fail;16581658+ }16591659+ psmouse_info(psmouse,16601660+ "Elan sample query result %02x, %02x, %02x\n",16611661+ etd->samples[0], etd->samples[1], etd->samples[2]);16621662+ }1661166316621664 if (elantech_set_absolute_mode(psmouse)) {16631665 psmouse_err(psmouse,
···17291729 struct mapped_device *md = q->queuedata;17301730 struct dm_table *map = dm_get_live_table_fast(md);17311731 struct dm_target *ti;17321732- sector_t max_sectors, max_size = 0;17321732+ sector_t max_sectors;17331733+ int max_size = 0;1733173417341735 if (unlikely(!map))17351736 goto out;···17431742 * Find maximum amount of I/O that won't need splitting17441743 */17451744 max_sectors = min(max_io_len(bvm->bi_sector, ti),17461746- (sector_t) queue_max_sectors(q));17451745+ (sector_t) BIO_MAX_SECTORS);17471746 max_size = (max_sectors << SECTOR_SHIFT) - bvm->bi_size;17481748-17491749- /*17501750- * FIXME: this stop-gap fix _must_ be cleaned up (by passing a sector_t17511751- * to the targets' merge function since it holds sectors not bytes).17521752- * Just doing this as an interim fix for stable@ because the more17531753- * comprehensive cleanup of switching to sector_t will impact every17541754- * DM target that implements a ->merge hook.17551755- */17561756- if (max_size > INT_MAX)17571757- max_size = INT_MAX;17471747+ if (max_size < 0)17481748+ max_size = 0;1758174917591750 /*17601751 * merge_bvec_fn() returns number of bytes···17541761 * max is precomputed maximal io size17551762 */17561763 if (max_size && ti->type->merge)17571757- max_size = ti->type->merge(ti, bvm, biovec, (int) max_size);17641764+ max_size = ti->type->merge(ti, bvm, biovec, max_size);17581765 /*17591766 * If the target doesn't support merge method and some of the devices17601760- * provided their merge_bvec method (we know this by looking for the17611761- * max_hw_sectors that dm_set_device_limits may set), then we can't17621762- * allow bios with multiple vector entries. So always set max_size17631763- * to 0, and the code below allows just one page.17671767+ * provided their merge_bvec method (we know this by looking at17681768+ * queue_max_hw_sectors), then we can't allow bios with multiple vector17691769+ * entries. So always set max_size to 0, and the code below allows17701770+ * just one page.17641771 */17651772 else if (queue_max_hw_sectors(q) <= PAGE_SIZE >> 9)17661773 max_size = 0;
···14761476{14771477 char b[BDEVNAME_SIZE];14781478 struct r1conf *conf = mddev->private;14791479+ unsigned long flags;1479148014801481 /*14811482 * If it is not operational, then we have already marked it as dead···14961495 return;14971496 }14981497 set_bit(Blocked, &rdev->flags);14981498+ spin_lock_irqsave(&conf->device_lock, flags);14991499 if (test_and_clear_bit(In_sync, &rdev->flags)) {15001500- unsigned long flags;15011501- spin_lock_irqsave(&conf->device_lock, flags);15021500 mddev->degraded++;15031501 set_bit(Faulty, &rdev->flags);15041504- spin_unlock_irqrestore(&conf->device_lock, flags);15051502 } else15061503 set_bit(Faulty, &rdev->flags);15041504+ spin_unlock_irqrestore(&conf->device_lock, flags);15071505 /*15081506 * if recovery is running, make sure it aborts.15091507 */···15681568 * Find all failed disks within the RAID1 configuration15691569 * and mark them readable.15701570 * Called under mddev lock, so rcu protection not needed.15711571+ * device_lock used to avoid races with raid1_end_read_request15721572+ * which expects 'In_sync' flags and ->degraded to be consistent.15711573 */15741574+ spin_lock_irqsave(&conf->device_lock, flags);15721575 for (i = 0; i < conf->raid_disks; i++) {15731576 struct md_rdev *rdev = conf->mirrors[i].rdev;15741577 struct md_rdev *repl = conf->mirrors[conf->raid_disks + i].rdev;···16021599 sysfs_notify_dirent_safe(rdev->sysfs_state);16031600 }16041601 }16051605- spin_lock_irqsave(&conf->device_lock, flags);16061602 mddev->degraded -= count;16071603 spin_unlock_irqrestore(&conf->device_lock, flags);16081604
+3-2
drivers/md/raid5.c
···22562256static int drop_one_stripe(struct r5conf *conf)22572257{22582258 struct stripe_head *sh;22592259- int hash = (conf->max_nr_stripes - 1) % NR_STRIPE_HASH_LOCKS;22592259+ int hash = (conf->max_nr_stripes - 1) & STRIPE_HASH_LOCKS_MASK;2260226022612261 spin_lock_irq(conf->hash_locks + hash);22622262 sh = get_free_stripe(conf, hash);···6388638863896389 if (mutex_trylock(&conf->cache_size_mutex)) {63906390 ret= 0;63916391- while (ret < sc->nr_to_scan) {63916391+ while (ret < sc->nr_to_scan &&63926392+ conf->max_nr_stripes > conf->min_nr_stripes) {63926393 if (drop_one_stripe(conf) == 0) {63936394 ret = SHRINK_STOP;63946395 break;
+1-1
drivers/mfd/Kconfig
···115115116116config MFD_CROS_EC_SPI117117 tristate "ChromeOS Embedded Controller (SPI)"118118- depends on MFD_CROS_EC && CROS_EC_PROTO && SPI && OF118118+ depends on MFD_CROS_EC && CROS_EC_PROTO && SPI119119120120 ---help---121121 If you say Y here, you get support for talking to the ChromeOS EC
+7-9
drivers/mfd/arizona-core.c
···651651652652 arizona->has_fully_powered_off = true;653653654654- disable_irq(arizona->irq);654654+ disable_irq_nosync(arizona->irq);655655 arizona_enable_reset(arizona);656656 regulator_bulk_disable(arizona->num_core_supplies,657657 arizona->core_supplies);···11411141 arizona->pdata.gpio_defaults[i]);11421142 }1143114311441144- pm_runtime_set_autosuspend_delay(arizona->dev, 100);11451145- pm_runtime_use_autosuspend(arizona->dev);11461146- pm_runtime_enable(arizona->dev);11471147-11481144 /* Chip default */11491145 if (!arizona->pdata.clk32k_src)11501146 arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;···12411245 arizona->pdata.spk_fmt[i]);12421246 }1243124712481248+ pm_runtime_set_active(arizona->dev);12491249+ pm_runtime_enable(arizona->dev);12501250+12441251 /* Set up for interrupts */12451252 ret = arizona_irq_init(arizona);12461253 if (ret != 0)12471254 goto err_reset;12551255+12561256+ pm_runtime_set_autosuspend_delay(arizona->dev, 100);12571257+ pm_runtime_use_autosuspend(arizona->dev);1248125812491259 arizona_request_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, "CLKGEN error",12501260 arizona_clkgen_err, arizona);···12791277 dev_err(arizona->dev, "Failed to add subdevices: %d\n", ret);12801278 goto err_irq;12811279 }12821282-12831283-#ifdef CONFIG_PM12841284- regulator_disable(arizona->dcvdd);12851285-#endif1286128012871281 return 0;12881282
···17231723 offset += sizeof(u32);17241724 data_buf += sizeof(u32);17251725 written_so_far += sizeof(u32);17261726+17271727+ /* At end of each 4Kb page, release nvram lock to allow MFW17281728+ * chance to take it for its own use.17291729+ */17301730+ if ((cmd_flags & MCPR_NVM_COMMAND_LAST) &&17311731+ (written_so_far < buf_size)) {17321732+ DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,17331733+ "Releasing NVM lock after offset 0x%x\n",17341734+ (u32)(offset - sizeof(u32)));17351735+ bnx2x_release_nvram_lock(bp);17361736+ usleep_range(1000, 2000);17371737+ rc = bnx2x_acquire_nvram_lock(bp);17381738+ if (rc)17391739+ return rc;17401740+ }17411741+17261742 cmd_flags = 0;17271743 }17281744
···27782778 EXT_MEM1_SIZE_G(size));27792779 }27802780 } else {27812781- if (i & EXT_MEM_ENABLE_F)27812781+ if (i & EXT_MEM_ENABLE_F) {27822782 size = t4_read_reg(adap, MA_EXT_MEMORY_BAR_A);27832783 add_debugfs_mem(adap, "mc", MEM_MC,27842784 EXT_MEM_SIZE_G(size));27852785+ }27852786 }2786278727872788 de = debugfs_create_file_size("flash", S_IRUSR, adap->debugfs_root, adap,
+5
drivers/net/ethernet/emulex/benet/be_cmds.h
···620620 BE_IF_FLAGS_VLAN_PROMISCUOUS |\621621 BE_IF_FLAGS_MCAST_PROMISCUOUS)622622623623+#define BE_IF_EN_FLAGS (BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_PASS_L3L4_ERRORS |\624624+ BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_UNTAGGED)625625+626626+#define BE_IF_ALL_FILT_FLAGS (BE_IF_EN_FLAGS | BE_IF_FLAGS_ALL_PROMISCUOUS)627627+623628/* An RX interface is an object with one or more MAC addresses and624629 * filtering capabilities. */625630struct be_cmd_req_if_create {
+120-67
drivers/net/ethernet/emulex/benet/be_main.c
···273273 if (ether_addr_equal(addr->sa_data, netdev->dev_addr))274274 return 0;275275276276+ /* if device is not running, copy MAC to netdev->dev_addr */277277+ if (!netif_running(netdev))278278+ goto done;279279+276280 /* The PMAC_ADD cmd may fail if the VF doesn't have FILTMGMT277281 * privilege or if PF did not provision the new MAC address.278282 * On BE3, this cmd will always fail if the VF doesn't have the···311307 status = -EPERM;312308 goto err;313309 }314314-315315- memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);316316- dev_info(dev, "MAC address changed to %pM\n", mac);310310+done:311311+ ether_addr_copy(netdev->dev_addr, addr->sa_data);312312+ dev_info(dev, "MAC address changed to %pM\n", addr->sa_data);317313 return 0;318314err:319315 dev_warn(dev, "MAC address change to %pM failed\n", addr->sa_data);···24562452 be_eq_notify(eqo->adapter, eqo->q.id, false, true, num, 0);24572453}2458245424552455+/* Free posted rx buffers that were not used */24562456+static void be_rxq_clean(struct be_rx_obj *rxo)24572457+{24582458+ struct be_queue_info *rxq = &rxo->q;24592459+ struct be_rx_page_info *page_info;24602460+24612461+ while (atomic_read(&rxq->used) > 0) {24622462+ page_info = get_rx_page_info(rxo);24632463+ put_page(page_info->page);24642464+ memset(page_info, 0, sizeof(*page_info));24652465+ }24662466+ BUG_ON(atomic_read(&rxq->used));24672467+ rxq->tail = 0;24682468+ rxq->head = 0;24692469+}24702470+24592471static void be_rx_cq_clean(struct be_rx_obj *rxo)24602472{24612461- struct be_rx_page_info *page_info;24622462- struct be_queue_info *rxq = &rxo->q;24632473 struct be_queue_info *rx_cq = &rxo->cq;24642474 struct be_rx_compl_info *rxcp;24652475 struct be_adapter *adapter = rxo->adapter;···2510249225112493 /* After cleanup, leave the CQ in unarmed state */25122494 be_cq_notify(adapter, rx_cq->id, false, 0);25132513-25142514- /* Then free posted rx buffers that were not used */25152515- while (atomic_read(&rxq->used) > 0) {25162516- page_info = get_rx_page_info(rxo);25172517- put_page(page_info->page);25182518- memset(page_info, 0, sizeof(*page_info));25192519- }25202520- BUG_ON(atomic_read(&rxq->used));25212521- rxq->tail = 0;25222522- rxq->head = 0;25232495}2524249625252497static void be_tx_compl_clean(struct be_adapter *adapter)···25892581 be_cmd_q_destroy(adapter, &eqo->q, QTYPE_EQ);25902582 napi_hash_del(&eqo->napi);25912583 netif_napi_del(&eqo->napi);25842584+ free_cpumask_var(eqo->affinity_mask);25922585 }25932593- free_cpumask_var(eqo->affinity_mask);25942586 be_queue_free(adapter, &eqo->q);25952587 }25962588}···2607259926082600 for_all_evt_queues(adapter, eqo, i) {26092601 int numa_node = dev_to_node(&adapter->pdev->dev);26102610- if (!zalloc_cpumask_var(&eqo->affinity_mask, GFP_KERNEL))26112611- return -ENOMEM;26122612- cpumask_set_cpu(cpumask_local_spread(i, numa_node),26132613- eqo->affinity_mask);26142614- netif_napi_add(adapter->netdev, &eqo->napi, be_poll,26152615- BE_NAPI_WEIGHT);26162616- napi_hash_add(&eqo->napi);26022602+26172603 aic = &adapter->aic_obj[i];26182604 eqo->adapter = adapter;26192605 eqo->idx = i;···26232621 rc = be_cmd_eq_create(adapter, eqo);26242622 if (rc)26252623 return rc;26242624+26252625+ if (!zalloc_cpumask_var(&eqo->affinity_mask, GFP_KERNEL))26262626+ return -ENOMEM;26272627+ cpumask_set_cpu(cpumask_local_spread(i, numa_node),26282628+ eqo->affinity_mask);26292629+ netif_napi_add(adapter->netdev, &eqo->napi, be_poll,26302630+ BE_NAPI_WEIGHT);26312631+ napi_hash_add(&eqo->napi);26262632 }26272633 return 0;26282634}···33693359 for_all_rx_queues(adapter, rxo, i) {33703360 q = &rxo->q;33713361 if (q->created) {33623362+ /* If RXQs are destroyed while in an "out of buffer"33633363+ * state, there is a possibility of an HW stall on33643364+ * Lancer. So, post 64 buffers to each queue to relieve33653365+ * the "out of buffer" condition.33663366+ * Make sure there's space in the RXQ before posting.33673367+ */33683368+ if (lancer_chip(adapter)) {33693369+ be_rx_cq_clean(rxo);33703370+ if (atomic_read(&q->used) == 0)33713371+ be_post_rx_frags(rxo, GFP_KERNEL,33723372+ MAX_RX_POST);33733373+ }33743374+33723375 be_cmd_rxq_destroy(adapter, q);33733376 be_rx_cq_clean(rxo);33773377+ be_rxq_clean(rxo);33743378 }33753379 be_queue_free(adapter, q);33803380+ }33813381+}33823382+33833383+static void be_disable_if_filters(struct be_adapter *adapter)33843384+{33853385+ be_cmd_pmac_del(adapter, adapter->if_handle,33863386+ adapter->pmac_id[0], 0);33873387+33883388+ be_clear_uc_list(adapter);33893389+33903390+ /* The IFACE flags are enabled in the open path and cleared33913391+ * in the close path. When a VF gets detached from the host and33923392+ * assigned to a VM the following happens:33933393+ * - VF's IFACE flags get cleared in the detach path33943394+ * - IFACE create is issued by the VF in the attach path33953395+ * Due to a bug in the BE3/Skyhawk-R FW33963396+ * (Lancer FW doesn't have the bug), the IFACE capability flags33973397+ * specified along with the IFACE create cmd issued by a VF are not33983398+ * honoured by FW. As a consequence, if a *new* driver33993399+ * (that enables/disables IFACE flags in open/close)34003400+ * is loaded in the host and an *old* driver is * used by a VM/VF,34013401+ * the IFACE gets created *without* the needed flags.34023402+ * To avoid this, disable RX-filter flags only for Lancer.34033403+ */34043404+ if (lancer_chip(adapter)) {34053405+ be_cmd_rx_filter(adapter, BE_IF_ALL_FILT_FLAGS, OFF);34063406+ adapter->if_flags &= ~BE_IF_ALL_FILT_FLAGS;33763407 }33773408}33783409···34283377 */34293378 if (!(adapter->flags & BE_FLAGS_SETUP_DONE))34303379 return 0;33803380+33813381+ be_disable_if_filters(adapter);3431338234323383 be_roce_dev_close(adapter);34333384···34503397 be_tx_compl_clean(adapter);3451339834523399 be_rx_qs_destroy(adapter);34533453- be_clear_uc_list(adapter);3454340034553401 for_all_evt_queues(adapter, eqo, i) {34563402 if (msix_enabled(adapter))···35343482 return 0;35353483}3536348434853485+static int be_enable_if_filters(struct be_adapter *adapter)34863486+{34873487+ int status;34883488+34893489+ status = be_cmd_rx_filter(adapter, BE_IF_EN_FLAGS, ON);34903490+ if (status)34913491+ return status;34923492+34933493+ /* For BE3 VFs, the PF programs the initial MAC address */34943494+ if (!(BEx_chip(adapter) && be_virtfn(adapter))) {34953495+ status = be_cmd_pmac_add(adapter, adapter->netdev->dev_addr,34963496+ adapter->if_handle,34973497+ &adapter->pmac_id[0], 0);34983498+ if (status)34993499+ return status;35003500+ }35013501+35023502+ if (adapter->vlans_added)35033503+ be_vid_config(adapter);35043504+35053505+ be_set_rx_mode(adapter->netdev);35063506+35073507+ return 0;35083508+}35093509+35373510static int be_open(struct net_device *netdev)35383511{35393512 struct be_adapter *adapter = netdev_priv(netdev);···35693492 int status, i;3570349335713494 status = be_rx_qs_create(adapter);34953495+ if (status)34963496+ goto err;34973497+34983498+ status = be_enable_if_filters(adapter);35723499 if (status)35733500 goto err;35743501···37663685 }37673686}3768368737693769-static void be_mac_clear(struct be_adapter *adapter)37703770-{37713771- if (adapter->pmac_id) {37723772- be_cmd_pmac_del(adapter, adapter->if_handle,37733773- adapter->pmac_id[0], 0);37743774- kfree(adapter->pmac_id);37753775- adapter->pmac_id = NULL;37763776- }37773777-}37783778-37793688#ifdef CONFIG_BE2NET_VXLAN37803689static void be_disable_vxlan_offloads(struct be_adapter *adapter)37813690{···38403769#ifdef CONFIG_BE2NET_VXLAN38413770 be_disable_vxlan_offloads(adapter);38423771#endif38433843- /* delete the primary mac along with the uc-mac list */38443844- be_mac_clear(adapter);37723772+ kfree(adapter->pmac_id);37733773+ adapter->pmac_id = NULL;3845377438463775 be_cmd_if_destroy(adapter, adapter->if_handle, 0);38473776···38523781 return 0;38533782}3854378338553855-static int be_if_create(struct be_adapter *adapter, u32 *if_handle,38563856- u32 cap_flags, u32 vf)38573857-{38583858- u32 en_flags;38593859-38603860- en_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST |38613861- BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_PASS_L3L4_ERRORS |38623862- BE_IF_FLAGS_RSS | BE_IF_FLAGS_DEFQ_RSS;38633863-38643864- en_flags &= cap_flags;38653865-38663866- return be_cmd_if_create(adapter, cap_flags, en_flags, if_handle, vf);38673867-}38683868-38693784static int be_vfs_if_create(struct be_adapter *adapter)38703785{38713786 struct be_resources res = {0};37873787+ u32 cap_flags, en_flags, vf;38723788 struct be_vf_cfg *vf_cfg;38733873- u32 cap_flags, vf;38743789 int status;3875379038763791 /* If a FW profile exists, then cap_flags are updated */···38773820 }38783821 }3879382238803880- status = be_if_create(adapter, &vf_cfg->if_handle,38813881- cap_flags, vf + 1);38233823+ en_flags = cap_flags & (BE_IF_FLAGS_UNTAGGED |38243824+ BE_IF_FLAGS_BROADCAST |38253825+ BE_IF_FLAGS_MULTICAST |38263826+ BE_IF_FLAGS_PASS_L3L4_ERRORS);38273827+ status = be_cmd_if_create(adapter, cap_flags, en_flags,38283828+ &vf_cfg->if_handle, vf + 1);38823829 if (status)38833830 return status;38843831 }···4254419342554194 memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN);42564195 memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN);42574257- } else {42584258- /* Maybe the HW was reset; dev_addr must be re-programmed */42594259- memcpy(mac, adapter->netdev->dev_addr, ETH_ALEN);42604196 }4261419742624262- /* For BE3-R VFs, the PF programs the initial MAC address */42634263- if (!(BEx_chip(adapter) && be_virtfn(adapter)))42644264- be_cmd_pmac_add(adapter, mac, adapter->if_handle,42654265- &adapter->pmac_id[0], 0);42664198 return 0;42674199}42684200···43954341static int be_setup(struct be_adapter *adapter)43964342{43974343 struct device *dev = &adapter->pdev->dev;43444344+ u32 en_flags;43984345 int status;4399434644004347 status = be_func_init(adapter);···44184363 if (status)44194364 goto err;4420436544214421- status = be_if_create(adapter, &adapter->if_handle,44224422- be_if_cap_flags(adapter), 0);43664366+ /* will enable all the needed filter flags in be_open() */43674367+ en_flags = BE_IF_FLAGS_RSS | BE_IF_FLAGS_DEFQ_RSS;43684368+ en_flags = en_flags & be_if_cap_flags(adapter);43694369+ status = be_cmd_if_create(adapter, be_if_cap_flags(adapter), en_flags,43704370+ &adapter->if_handle, 0);44234371 if (status)44244372 goto err;44254373···44474389 adapter->fw_ver);44484390 dev_err(dev, "Please upgrade firmware to version >= 4.0\n");44494391 }44504450-44514451- if (adapter->vlans_added)44524452- be_vid_config(adapter);44534453-44544454- be_set_rx_mode(adapter->netdev);4455439244564393 status = be_cmd_set_flow_control(adapter, adapter->tx_fc,44574394 adapter->rx_fc);
···902902 return 0;903903}904904905905-static int gfar_comp_asc(const void *a, const void *b)906906-{907907- return memcmp(a, b, 4);908908-}909909-910910-static int gfar_comp_desc(const void *a, const void *b)911911-{912912- return -memcmp(a, b, 4);913913-}914914-915915-static void gfar_swap(void *a, void *b, int size)916916-{917917- u32 *_a = a;918918- u32 *_b = b;919919-920920- swap(_a[0], _b[0]);921921- swap(_a[1], _b[1]);922922- swap(_a[2], _b[2]);923923- swap(_a[3], _b[3]);924924-}925925-926905/* Write a mask to filer cache */927906static void gfar_set_mask(u32 mask, struct filer_table *tab)928907{···12511272 return 0;12521273}1253127412541254-/* Copy size filer entries */12551255-static void gfar_copy_filer_entries(struct gfar_filer_entry dst[0],12561256- struct gfar_filer_entry src[0], s32 size)12571257-{12581258- while (size > 0) {12591259- size--;12601260- dst[size].ctrl = src[size].ctrl;12611261- dst[size].prop = src[size].prop;12621262- }12631263-}12641264-12651265-/* Delete the contents of the filer-table between start and end12661266- * and collapse them12671267- */12681268-static int gfar_trim_filer_entries(u32 begin, u32 end, struct filer_table *tab)12691269-{12701270- int length;12711271-12721272- if (end > MAX_FILER_CACHE_IDX || end < begin)12731273- return -EINVAL;12741274-12751275- end++;12761276- length = end - begin;12771277-12781278- /* Copy */12791279- while (end < tab->index) {12801280- tab->fe[begin].ctrl = tab->fe[end].ctrl;12811281- tab->fe[begin++].prop = tab->fe[end++].prop;12821282-12831283- }12841284- /* Fill up with don't cares */12851285- while (begin < tab->index) {12861286- tab->fe[begin].ctrl = 0x60;12871287- tab->fe[begin].prop = 0xFFFFFFFF;12881288- begin++;12891289- }12901290-12911291- tab->index -= length;12921292- return 0;12931293-}12941294-12951295-/* Make space on the wanted location */12961296-static int gfar_expand_filer_entries(u32 begin, u32 length,12971297- struct filer_table *tab)12981298-{12991299- if (length == 0 || length + tab->index > MAX_FILER_CACHE_IDX ||13001300- begin > MAX_FILER_CACHE_IDX)13011301- return -EINVAL;13021302-13031303- gfar_copy_filer_entries(&(tab->fe[begin + length]), &(tab->fe[begin]),13041304- tab->index - length + 1);13051305-13061306- tab->index += length;13071307- return 0;13081308-}13091309-13101310-static int gfar_get_next_cluster_start(int start, struct filer_table *tab)13111311-{13121312- for (; (start < tab->index) && (start < MAX_FILER_CACHE_IDX - 1);13131313- start++) {13141314- if ((tab->fe[start].ctrl & (RQFCR_AND | RQFCR_CLE)) ==13151315- (RQFCR_AND | RQFCR_CLE))13161316- return start;13171317- }13181318- return -1;13191319-}13201320-13211321-static int gfar_get_next_cluster_end(int start, struct filer_table *tab)13221322-{13231323- for (; (start < tab->index) && (start < MAX_FILER_CACHE_IDX - 1);13241324- start++) {13251325- if ((tab->fe[start].ctrl & (RQFCR_AND | RQFCR_CLE)) ==13261326- (RQFCR_CLE))13271327- return start;13281328- }13291329- return -1;13301330-}13311331-13321332-/* Uses hardwares clustering option to reduce13331333- * the number of filer table entries13341334- */13351335-static void gfar_cluster_filer(struct filer_table *tab)13361336-{13371337- s32 i = -1, j, iend, jend;13381338-13391339- while ((i = gfar_get_next_cluster_start(++i, tab)) != -1) {13401340- j = i;13411341- while ((j = gfar_get_next_cluster_start(++j, tab)) != -1) {13421342- /* The cluster entries self and the previous one13431343- * (a mask) must be identical!13441344- */13451345- if (tab->fe[i].ctrl != tab->fe[j].ctrl)13461346- break;13471347- if (tab->fe[i].prop != tab->fe[j].prop)13481348- break;13491349- if (tab->fe[i - 1].ctrl != tab->fe[j - 1].ctrl)13501350- break;13511351- if (tab->fe[i - 1].prop != tab->fe[j - 1].prop)13521352- break;13531353- iend = gfar_get_next_cluster_end(i, tab);13541354- jend = gfar_get_next_cluster_end(j, tab);13551355- if (jend == -1 || iend == -1)13561356- break;13571357-13581358- /* First we make some free space, where our cluster13591359- * element should be. Then we copy it there and finally13601360- * delete in from its old location.13611361- */13621362- if (gfar_expand_filer_entries(iend, (jend - j), tab) ==13631363- -EINVAL)13641364- break;13651365-13661366- gfar_copy_filer_entries(&(tab->fe[iend + 1]),13671367- &(tab->fe[jend + 1]), jend - j);13681368-13691369- if (gfar_trim_filer_entries(jend - 1,13701370- jend + (jend - j),13711371- tab) == -EINVAL)13721372- return;13731373-13741374- /* Mask out cluster bit */13751375- tab->fe[iend].ctrl &= ~(RQFCR_CLE);13761376- }13771377- }13781378-}13791379-13801380-/* Swaps the masked bits of a1<>a2 and b1<>b2 */13811381-static void gfar_swap_bits(struct gfar_filer_entry *a1,13821382- struct gfar_filer_entry *a2,13831383- struct gfar_filer_entry *b1,13841384- struct gfar_filer_entry *b2, u32 mask)13851385-{13861386- u32 temp[4];13871387- temp[0] = a1->ctrl & mask;13881388- temp[1] = a2->ctrl & mask;13891389- temp[2] = b1->ctrl & mask;13901390- temp[3] = b2->ctrl & mask;13911391-13921392- a1->ctrl &= ~mask;13931393- a2->ctrl &= ~mask;13941394- b1->ctrl &= ~mask;13951395- b2->ctrl &= ~mask;13961396-13971397- a1->ctrl |= temp[1];13981398- a2->ctrl |= temp[0];13991399- b1->ctrl |= temp[3];14001400- b2->ctrl |= temp[2];14011401-}14021402-14031403-/* Generate a list consisting of masks values with their start and14041404- * end of validity and block as indicator for parts belonging14051405- * together (glued by ANDs) in mask_table14061406- */14071407-static u32 gfar_generate_mask_table(struct gfar_mask_entry *mask_table,14081408- struct filer_table *tab)14091409-{14101410- u32 i, and_index = 0, block_index = 1;14111411-14121412- for (i = 0; i < tab->index; i++) {14131413-14141414- /* LSByte of control = 0 sets a mask */14151415- if (!(tab->fe[i].ctrl & 0xF)) {14161416- mask_table[and_index].mask = tab->fe[i].prop;14171417- mask_table[and_index].start = i;14181418- mask_table[and_index].block = block_index;14191419- if (and_index >= 1)14201420- mask_table[and_index - 1].end = i - 1;14211421- and_index++;14221422- }14231423- /* cluster starts and ends will be separated because they should14241424- * hold their position14251425- */14261426- if (tab->fe[i].ctrl & RQFCR_CLE)14271427- block_index++;14281428- /* A not set AND indicates the end of a depended block */14291429- if (!(tab->fe[i].ctrl & RQFCR_AND))14301430- block_index++;14311431- }14321432-14331433- mask_table[and_index - 1].end = i - 1;14341434-14351435- return and_index;14361436-}14371437-14381438-/* Sorts the entries of mask_table by the values of the masks.14391439- * Important: The 0xFF80 flags of the first and last entry of a14401440- * block must hold their position (which queue, CLusterEnable, ReJEct,14411441- * AND)14421442- */14431443-static void gfar_sort_mask_table(struct gfar_mask_entry *mask_table,14441444- struct filer_table *temp_table, u32 and_index)14451445-{14461446- /* Pointer to compare function (_asc or _desc) */14471447- int (*gfar_comp)(const void *, const void *);14481448-14491449- u32 i, size = 0, start = 0, prev = 1;14501450- u32 old_first, old_last, new_first, new_last;14511451-14521452- gfar_comp = &gfar_comp_desc;14531453-14541454- for (i = 0; i < and_index; i++) {14551455- if (prev != mask_table[i].block) {14561456- old_first = mask_table[start].start + 1;14571457- old_last = mask_table[i - 1].end;14581458- sort(mask_table + start, size,14591459- sizeof(struct gfar_mask_entry),14601460- gfar_comp, &gfar_swap);14611461-14621462- /* Toggle order for every block. This makes the14631463- * thing more efficient!14641464- */14651465- if (gfar_comp == gfar_comp_desc)14661466- gfar_comp = &gfar_comp_asc;14671467- else14681468- gfar_comp = &gfar_comp_desc;14691469-14701470- new_first = mask_table[start].start + 1;14711471- new_last = mask_table[i - 1].end;14721472-14731473- gfar_swap_bits(&temp_table->fe[new_first],14741474- &temp_table->fe[old_first],14751475- &temp_table->fe[new_last],14761476- &temp_table->fe[old_last],14771477- RQFCR_QUEUE | RQFCR_CLE |14781478- RQFCR_RJE | RQFCR_AND);14791479-14801480- start = i;14811481- size = 0;14821482- }14831483- size++;14841484- prev = mask_table[i].block;14851485- }14861486-}14871487-14881488-/* Reduces the number of masks needed in the filer table to save entries14891489- * This is done by sorting the masks of a depended block. A depended block is14901490- * identified by gluing ANDs or CLE. The sorting order toggles after every14911491- * block. Of course entries in scope of a mask must change their location with14921492- * it.14931493- */14941494-static int gfar_optimize_filer_masks(struct filer_table *tab)14951495-{14961496- struct filer_table *temp_table;14971497- struct gfar_mask_entry *mask_table;14981498-14991499- u32 and_index = 0, previous_mask = 0, i = 0, j = 0, size = 0;15001500- s32 ret = 0;15011501-15021502- /* We need a copy of the filer table because15031503- * we want to change its order15041504- */15051505- temp_table = kmemdup(tab, sizeof(*temp_table), GFP_KERNEL);15061506- if (temp_table == NULL)15071507- return -ENOMEM;15081508-15091509- mask_table = kcalloc(MAX_FILER_CACHE_IDX / 2 + 1,15101510- sizeof(struct gfar_mask_entry), GFP_KERNEL);15111511-15121512- if (mask_table == NULL) {15131513- ret = -ENOMEM;15141514- goto end;15151515- }15161516-15171517- and_index = gfar_generate_mask_table(mask_table, tab);15181518-15191519- gfar_sort_mask_table(mask_table, temp_table, and_index);15201520-15211521- /* Now we can copy the data from our duplicated filer table to15221522- * the real one in the order the mask table says15231523- */15241524- for (i = 0; i < and_index; i++) {15251525- size = mask_table[i].end - mask_table[i].start + 1;15261526- gfar_copy_filer_entries(&(tab->fe[j]),15271527- &(temp_table->fe[mask_table[i].start]), size);15281528- j += size;15291529- }15301530-15311531- /* And finally we just have to check for duplicated masks and drop the15321532- * second ones15331533- */15341534- for (i = 0; i < tab->index && i < MAX_FILER_CACHE_IDX; i++) {15351535- if (tab->fe[i].ctrl == 0x80) {15361536- previous_mask = i++;15371537- break;15381538- }15391539- }15401540- for (; i < tab->index && i < MAX_FILER_CACHE_IDX; i++) {15411541- if (tab->fe[i].ctrl == 0x80) {15421542- if (tab->fe[i].prop == tab->fe[previous_mask].prop) {15431543- /* Two identical ones found!15441544- * So drop the second one!15451545- */15461546- gfar_trim_filer_entries(i, i, tab);15471547- } else15481548- /* Not identical! */15491549- previous_mask = i;15501550- }15511551- }15521552-15531553- kfree(mask_table);15541554-end: kfree(temp_table);15551555- return ret;15561556-}15571557-15581275/* Write the bit-pattern from software's buffer to hardware registers */15591276static int gfar_write_filer_table(struct gfar_private *priv,15601277 struct filer_table *tab)···12601585 return -EBUSY;1261158612621587 /* Fill regular entries */12631263- for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].prop);12641264- i++)15881588+ for (; i < MAX_FILER_IDX && (tab->fe[i].ctrl | tab->fe[i].prop); i++)12651589 gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop);12661590 /* Fill the rest with fall-troughs */12671267- for (; i < MAX_FILER_IDX - 1; i++)15911591+ for (; i < MAX_FILER_IDX; i++)12681592 gfar_write_filer(priv, i, 0x60, 0xFFFFFFFF);12691593 /* Last entry must be default accept12701594 * because that's what people expect···12971623{12981624 struct ethtool_flow_spec_container *j;12991625 struct filer_table *tab;13001300- s32 i = 0;13011626 s32 ret = 0;1302162713031628 /* So index is set to zero, too! */···13201647 goto end;13211648 }13221649 }13231323-13241324- i = tab->index;13251325-13261326- /* Optimizations to save entries */13271327- gfar_cluster_filer(tab);13281328- gfar_optimize_filer_masks(tab);13291329-13301330- pr_debug("\tSummary:\n"13311331- "\tData on hardware: %d\n"13321332- "\tCompression rate: %d%%\n",13331333- tab->index, 100 - (100 * tab->index) / i);1334165013351651 /* Write everything to hardware */13361652 ret = gfar_write_filer_table(priv, tab);···13861724 }1387172513881726process:17271727+ priv->rx_list.count++;13891728 ret = gfar_process_filer_changes(priv);13901729 if (ret)13911730 goto clean_list;13921392- priv->rx_list.count++;13931731 return ret;1394173213951733clean_list:17341734+ priv->rx_list.count--;13961735 list_del(&temp->list);13971736clean_mem:13981737 kfree(temp);
+167-77
drivers/net/ethernet/marvell/mvpp2.c
···2727#include <linux/of_address.h>2828#include <linux/phy.h>2929#include <linux/clk.h>3030+#include <linux/hrtimer.h>3131+#include <linux/ktime.h>3032#include <uapi/linux/ppp_defs.h>3133#include <net/ip.h>3234#include <net/ipv6.h>···301299302300/* Coalescing */303301#define MVPP2_TXDONE_COAL_PKTS_THRESH 15302302+#define MVPP2_TXDONE_HRTIMER_PERIOD_NS 1000000UL304303#define MVPP2_RX_COAL_PKTS 32305304#define MVPP2_RX_COAL_USEC 100306305···663660 u64 tx_bytes;664661};665662663663+/* Per-CPU port control */664664+struct mvpp2_port_pcpu {665665+ struct hrtimer tx_done_timer;666666+ bool timer_scheduled;667667+ /* Tasklet for egress finalization */668668+ struct tasklet_struct tx_done_tasklet;669669+};670670+666671struct mvpp2_port {667672 u8 id;668673···689678690679 u32 pending_cause_rx;691680 struct napi_struct napi;681681+682682+ /* Per-CPU port control */683683+ struct mvpp2_port_pcpu __percpu *pcpu;692684693685 /* Flags */694686 unsigned long flags;···789775790776 /* Array of transmitted skb */791777 struct sk_buff **tx_skb;778778+779779+ /* Array of transmitted buffers' physical addresses */780780+ dma_addr_t *tx_buffs;792781793782 /* Index of last TX DMA descriptor that was inserted */794783 int txq_put_index;···930913 /* Occupied buffers indicator */931914 atomic_t in_use;932915 int in_use_thresh;933933-934934- spinlock_t lock;935916};936917937918struct mvpp2_buff_hdr {···978963}979964980965static void mvpp2_txq_inc_put(struct mvpp2_txq_pcpu *txq_pcpu,981981- struct sk_buff *skb)966966+ struct sk_buff *skb,967967+ struct mvpp2_tx_desc *tx_desc)982968{983969 txq_pcpu->tx_skb[txq_pcpu->txq_put_index] = skb;970970+ if (skb)971971+ txq_pcpu->tx_buffs[txq_pcpu->txq_put_index] =972972+ tx_desc->buf_phys_addr;984973 txq_pcpu->txq_put_index++;985974 if (txq_pcpu->txq_put_index == txq_pcpu->size)986975 txq_pcpu->txq_put_index = 0;···33953376 bm_pool->pkt_size = 0;33963377 bm_pool->buf_num = 0;33973378 atomic_set(&bm_pool->in_use, 0);33983398- spin_lock_init(&bm_pool->lock);3399337934003380 return 0;34013381}···36653647mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type,36663648 int pkt_size)36673649{36683668- unsigned long flags = 0;36693650 struct mvpp2_bm_pool *new_pool = &port->priv->bm_pools[pool];36703651 int num;36713652···36723655 netdev_err(port->dev, "mixing pool types is forbidden\n");36733656 return NULL;36743657 }36753675-36763676- spin_lock_irqsave(&new_pool->lock, flags);3677365836783659 if (new_pool->type == MVPP2_BM_FREE)36793660 new_pool->type = type;···37013686 if (num != pkts_num) {37023687 WARN(1, "pool %d: %d of %d allocated\n",37033688 new_pool->id, num, pkts_num);37043704- /* We need to undo the bufs_add() allocations */37053705- spin_unlock_irqrestore(&new_pool->lock, flags);37063689 return NULL;37073690 }37083691 }···37083695 mvpp2_bm_pool_bufsize_set(port->priv, new_pool,37093696 MVPP2_RX_BUF_SIZE(new_pool->pkt_size));3710369737113711- spin_unlock_irqrestore(&new_pool->lock, flags);37123712-37133698 return new_pool;37143699}3715370037163701/* Initialize pools for swf */37173702static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port)37183703{37193719- unsigned long flags = 0;37203704 int rxq;3721370537223706 if (!port->pool_long) {···37243714 if (!port->pool_long)37253715 return -ENOMEM;3726371637273727- spin_lock_irqsave(&port->pool_long->lock, flags);37283717 port->pool_long->port_map |= (1 << port->id);37293729- spin_unlock_irqrestore(&port->pool_long->lock, flags);3730371837313719 for (rxq = 0; rxq < rxq_number; rxq++)37323720 mvpp2_rxq_long_pool_set(port, rxq, port->pool_long->id);···37383730 if (!port->pool_short)37393731 return -ENOMEM;3740373237413741- spin_lock_irqsave(&port->pool_short->lock, flags);37423733 port->pool_short->port_map |= (1 << port->id);37433743- spin_unlock_irqrestore(&port->pool_short->lock, flags);3744373437453735 for (rxq = 0; rxq < rxq_number; rxq++)37463736 mvpp2_rxq_short_pool_set(port, rxq,···3812380638133807 mvpp2_write(port->priv, MVPP2_ISR_RX_TX_MASK_REG(port->id),38143808 (MVPP2_CAUSE_MISC_SUM_MASK |38153815- MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK |38163809 MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK));38173810}38183811···43874382 rxq->time_coal = usec;43884383}4389438443904390-/* Set threshold for TX_DONE pkts coalescing */43914391-static void mvpp2_tx_done_pkts_coal_set(void *arg)43924392-{43934393- struct mvpp2_port *port = arg;43944394- int queue;43954395- u32 val;43964396-43974397- for (queue = 0; queue < txq_number; queue++) {43984398- struct mvpp2_tx_queue *txq = port->txqs[queue];43994399-44004400- val = (txq->done_pkts_coal << MVPP2_TRANSMITTED_THRESH_OFFSET) &44014401- MVPP2_TRANSMITTED_THRESH_MASK;44024402- mvpp2_write(port->priv, MVPP2_TXQ_NUM_REG, txq->id);44034403- mvpp2_write(port->priv, MVPP2_TXQ_THRESH_REG, val);44044404- }44054405-}44064406-44074385/* Free Tx queue skbuffs */44084386static void mvpp2_txq_bufs_free(struct mvpp2_port *port,44094387 struct mvpp2_tx_queue *txq,···43954407 int i;4396440843974409 for (i = 0; i < num; i++) {43984398- struct mvpp2_tx_desc *tx_desc = txq->descs +43994399- txq_pcpu->txq_get_index;44104410+ dma_addr_t buf_phys_addr =44114411+ txq_pcpu->tx_buffs[txq_pcpu->txq_get_index];44004412 struct sk_buff *skb = txq_pcpu->tx_skb[txq_pcpu->txq_get_index];4401441344024414 mvpp2_txq_inc_get(txq_pcpu);···44044416 if (!skb)44054417 continue;4406441844074407- dma_unmap_single(port->dev->dev.parent, tx_desc->buf_phys_addr,44084408- tx_desc->data_size, DMA_TO_DEVICE);44194419+ dma_unmap_single(port->dev->dev.parent, buf_phys_addr,44204420+ skb_headlen(skb), DMA_TO_DEVICE);44094421 dev_kfree_skb_any(skb);44104422 }44114423}···44214433static inline struct mvpp2_tx_queue *mvpp2_get_tx_queue(struct mvpp2_port *port,44224434 u32 cause)44234435{44244424- int queue = fls(cause >> 16) - 1;44364436+ int queue = fls(cause) - 1;4425443744264438 return port->txqs[queue];44274439}···44464458 if (netif_tx_queue_stopped(nq))44474459 if (txq_pcpu->size - txq_pcpu->count >= MAX_SKB_FRAGS + 1)44484460 netif_tx_wake_queue(nq);44614461+}44624462+44634463+static unsigned int mvpp2_tx_done(struct mvpp2_port *port, u32 cause)44644464+{44654465+ struct mvpp2_tx_queue *txq;44664466+ struct mvpp2_txq_pcpu *txq_pcpu;44674467+ unsigned int tx_todo = 0;44684468+44694469+ while (cause) {44704470+ txq = mvpp2_get_tx_queue(port, cause);44714471+ if (!txq)44724472+ break;44734473+44744474+ txq_pcpu = this_cpu_ptr(txq->pcpu);44754475+44764476+ if (txq_pcpu->count) {44774477+ mvpp2_txq_done(port, txq, txq_pcpu);44784478+ tx_todo += txq_pcpu->count;44794479+ }44804480+44814481+ cause &= ~(1 << txq->log_id);44824482+ }44834483+ return tx_todo;44494484}4450448544514486/* Rx/Tx queue initialization/cleanup methods */···46604649 txq_pcpu->tx_skb = kmalloc(txq_pcpu->size *46614650 sizeof(*txq_pcpu->tx_skb),46624651 GFP_KERNEL);46634663- if (!txq_pcpu->tx_skb) {46644664- dma_free_coherent(port->dev->dev.parent,46654665- txq->size * MVPP2_DESC_ALIGNED_SIZE,46664666- txq->descs, txq->descs_phys);46674667- return -ENOMEM;46684668- }46524652+ if (!txq_pcpu->tx_skb)46534653+ goto error;46544654+46554655+ txq_pcpu->tx_buffs = kmalloc(txq_pcpu->size *46564656+ sizeof(dma_addr_t), GFP_KERNEL);46574657+ if (!txq_pcpu->tx_buffs)46584658+ goto error;4669465946704660 txq_pcpu->count = 0;46714661 txq_pcpu->reserved_num = 0;···46754663 }4676466446774665 return 0;46664666+46674667+error:46684668+ for_each_present_cpu(cpu) {46694669+ txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);46704670+ kfree(txq_pcpu->tx_skb);46714671+ kfree(txq_pcpu->tx_buffs);46724672+ }46734673+46744674+ dma_free_coherent(port->dev->dev.parent,46754675+ txq->size * MVPP2_DESC_ALIGNED_SIZE,46764676+ txq->descs, txq->descs_phys);46774677+46784678+ return -ENOMEM;46784679}4679468046804681/* Free allocated TXQ resources */···47004675 for_each_present_cpu(cpu) {47014676 txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);47024677 kfree(txq_pcpu->tx_skb);46784678+ kfree(txq_pcpu->tx_buffs);47034679 }4704468047054681 if (txq->descs)···48314805 goto err_cleanup;48324806 }4833480748344834- on_each_cpu(mvpp2_tx_done_pkts_coal_set, port, 1);48354808 on_each_cpu(mvpp2_txq_sent_counter_clear, port, 1);48364809 return 0;48374810···49104885 }49114886 phy_print_status(phydev);49124887 }48884888+}48894889+48904890+static void mvpp2_timer_set(struct mvpp2_port_pcpu *port_pcpu)48914891+{48924892+ ktime_t interval;48934893+48944894+ if (!port_pcpu->timer_scheduled) {48954895+ port_pcpu->timer_scheduled = true;48964896+ interval = ktime_set(0, MVPP2_TXDONE_HRTIMER_PERIOD_NS);48974897+ hrtimer_start(&port_pcpu->tx_done_timer, interval,48984898+ HRTIMER_MODE_REL_PINNED);48994899+ }49004900+}49014901+49024902+static void mvpp2_tx_proc_cb(unsigned long data)49034903+{49044904+ struct net_device *dev = (struct net_device *)data;49054905+ struct mvpp2_port *port = netdev_priv(dev);49064906+ struct mvpp2_port_pcpu *port_pcpu = this_cpu_ptr(port->pcpu);49074907+ unsigned int tx_todo, cause;49084908+49094909+ if (!netif_running(dev))49104910+ return;49114911+ port_pcpu->timer_scheduled = false;49124912+49134913+ /* Process all the Tx queues */49144914+ cause = (1 << txq_number) - 1;49154915+ tx_todo = mvpp2_tx_done(port, cause);49164916+49174917+ /* Set the timer in case not all the packets were processed */49184918+ if (tx_todo)49194919+ mvpp2_timer_set(port_pcpu);49204920+}49214921+49224922+static enum hrtimer_restart mvpp2_hr_timer_cb(struct hrtimer *timer)49234923+{49244924+ struct mvpp2_port_pcpu *port_pcpu = container_of(timer,49254925+ struct mvpp2_port_pcpu,49264926+ tx_done_timer);49274927+49284928+ tasklet_schedule(&port_pcpu->tx_done_tasklet);49294929+49304930+ return HRTIMER_NORESTART;49134931}4914493249154933/* Main RX/TX processing routines */···52125144 if (i == (skb_shinfo(skb)->nr_frags - 1)) {52135145 /* Last descriptor */52145146 tx_desc->command = MVPP2_TXD_L_DESC;52155215- mvpp2_txq_inc_put(txq_pcpu, skb);51475147+ mvpp2_txq_inc_put(txq_pcpu, skb, tx_desc);52165148 } else {52175149 /* Descriptor in the middle: Not First, Not Last */52185150 tx_desc->command = 0;52195219- mvpp2_txq_inc_put(txq_pcpu, NULL);51515151+ mvpp2_txq_inc_put(txq_pcpu, NULL, tx_desc);52205152 }52215153 }52225154···52825214 /* First and Last descriptor */52835215 tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_L_DESC;52845216 tx_desc->command = tx_cmd;52855285- mvpp2_txq_inc_put(txq_pcpu, skb);52175217+ mvpp2_txq_inc_put(txq_pcpu, skb, tx_desc);52865218 } else {52875219 /* First but not Last */52885220 tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_PADDING_DISABLE;52895221 tx_desc->command = tx_cmd;52905290- mvpp2_txq_inc_put(txq_pcpu, NULL);52225222+ mvpp2_txq_inc_put(txq_pcpu, NULL, tx_desc);5291522352925224 /* Continue with other skb fragments */52935225 if (mvpp2_tx_frag_process(port, skb, aggr_txq, txq)) {···53235255 dev_kfree_skb_any(skb);53245256 }5325525752585258+ /* Finalize TX processing */52595259+ if (txq_pcpu->count >= txq->done_pkts_coal)52605260+ mvpp2_txq_done(port, txq, txq_pcpu);52615261+52625262+ /* Set the timer in case not all frags were processed */52635263+ if (txq_pcpu->count <= frags && txq_pcpu->count > 0) {52645264+ struct mvpp2_port_pcpu *port_pcpu = this_cpu_ptr(port->pcpu);52655265+52665266+ mvpp2_timer_set(port_pcpu);52675267+ }52685268+53265269 return NETDEV_TX_OK;53275270}53285271···53475268 netdev_err(dev, "tx fifo underrun error\n");53485269}5349527053505350-static void mvpp2_txq_done_percpu(void *arg)52715271+static int mvpp2_poll(struct napi_struct *napi, int budget)53515272{53525352- struct mvpp2_port *port = arg;53535353- u32 cause_rx_tx, cause_tx, cause_misc;52735273+ u32 cause_rx_tx, cause_rx, cause_misc;52745274+ int rx_done = 0;52755275+ struct mvpp2_port *port = netdev_priv(napi->dev);5354527653555277 /* Rx/Tx cause register53565278 *···53655285 */53665286 cause_rx_tx = mvpp2_read(port->priv,53675287 MVPP2_ISR_RX_TX_CAUSE_REG(port->id));53685368- cause_tx = cause_rx_tx & MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK;52885288+ cause_rx_tx &= ~MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK;53695289 cause_misc = cause_rx_tx & MVPP2_CAUSE_MISC_SUM_MASK;5370529053715291 if (cause_misc) {···53775297 cause_rx_tx & ~MVPP2_CAUSE_MISC_SUM_MASK);53785298 }5379529953805380- /* Release TX descriptors */53815381- if (cause_tx) {53825382- struct mvpp2_tx_queue *txq = mvpp2_get_tx_queue(port, cause_tx);53835383- struct mvpp2_txq_pcpu *txq_pcpu = this_cpu_ptr(txq->pcpu);53845384-53855385- if (txq_pcpu->count)53865386- mvpp2_txq_done(port, txq, txq_pcpu);53875387- }53885388-}53895389-53905390-static int mvpp2_poll(struct napi_struct *napi, int budget)53915391-{53925392- u32 cause_rx_tx, cause_rx;53935393- int rx_done = 0;53945394- struct mvpp2_port *port = netdev_priv(napi->dev);53955395-53965396- on_each_cpu(mvpp2_txq_done_percpu, port, 1);53975397-53985398- cause_rx_tx = mvpp2_read(port->priv,53995399- MVPP2_ISR_RX_TX_CAUSE_REG(port->id));54005300 cause_rx = cause_rx_tx & MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK;5401530154025302 /* Process RX packets */···56215561static int mvpp2_stop(struct net_device *dev)56225562{56235563 struct mvpp2_port *port = netdev_priv(dev);55645564+ struct mvpp2_port_pcpu *port_pcpu;55655565+ int cpu;5624556656255567 mvpp2_stop_dev(port);56265568 mvpp2_phy_disconnect(port);···56315569 on_each_cpu(mvpp2_interrupts_mask, port, 1);5632557056335571 free_irq(port->irq, port);55725572+ for_each_present_cpu(cpu) {55735573+ port_pcpu = per_cpu_ptr(port->pcpu, cpu);55745574+55755575+ hrtimer_cancel(&port_pcpu->tx_done_timer);55765576+ port_pcpu->timer_scheduled = false;55775577+ tasklet_kill(&port_pcpu->tx_done_tasklet);55785578+ }56345579 mvpp2_cleanup_rxqs(port);56355580 mvpp2_cleanup_txqs(port);56365581···58535784 txq->done_pkts_coal = c->tx_max_coalesced_frames;58545785 }5855578658565856- on_each_cpu(mvpp2_tx_done_pkts_coal_set, port, 1);58575787 return 0;58585788}58595789···61036035{61046036 struct device_node *phy_node;61056037 struct mvpp2_port *port;60386038+ struct mvpp2_port_pcpu *port_pcpu;61066039 struct net_device *dev;61076040 struct resource *res;61086041 const char *dt_mac_addr;···61136044 int features;61146045 int phy_mode;61156046 int priv_common_regs_num = 2;61166116- int err, i;60476047+ int err, i, cpu;6117604861186049 dev = alloc_etherdev_mqs(sizeof(struct mvpp2_port), txq_number,61196050 rxq_number);···62046135 }62056136 mvpp2_port_power_up(port);6206613761386138+ port->pcpu = alloc_percpu(struct mvpp2_port_pcpu);61396139+ if (!port->pcpu) {61406140+ err = -ENOMEM;61416141+ goto err_free_txq_pcpu;61426142+ }61436143+61446144+ for_each_present_cpu(cpu) {61456145+ port_pcpu = per_cpu_ptr(port->pcpu, cpu);61466146+61476147+ hrtimer_init(&port_pcpu->tx_done_timer, CLOCK_MONOTONIC,61486148+ HRTIMER_MODE_REL_PINNED);61496149+ port_pcpu->tx_done_timer.function = mvpp2_hr_timer_cb;61506150+ port_pcpu->timer_scheduled = false;61516151+61526152+ tasklet_init(&port_pcpu->tx_done_tasklet, mvpp2_tx_proc_cb,61536153+ (unsigned long)dev);61546154+ }61556155+62076156 netif_napi_add(dev, &port->napi, mvpp2_poll, NAPI_POLL_WEIGHT);62086157 features = NETIF_F_SG | NETIF_F_IP_CSUM;62096158 dev->features = features | NETIF_F_RXCSUM;···62316144 err = register_netdev(dev);62326145 if (err < 0) {62336146 dev_err(&pdev->dev, "failed to register netdev\n");62346234- goto err_free_txq_pcpu;61476147+ goto err_free_port_pcpu;62356148 }62366149 netdev_info(dev, "Using %s mac address %pM\n", mac_from, dev->dev_addr);62376150···62406153 priv->port_list[id] = port;62416154 return 0;6242615561566156+err_free_port_pcpu:61576157+ free_percpu(port->pcpu);62436158err_free_txq_pcpu:62446159 for (i = 0; i < txq_number; i++)62456160 free_percpu(port->txqs[i]->pcpu);···62606171 int i;6261617262626173 unregister_netdev(port->dev);61746174+ free_percpu(port->pcpu);62636175 free_percpu(port->stats);62646176 for (i = 0; i < txq_number; i++)62656177 free_percpu(port->txqs[i]->pcpu);
···4242#define NSS_COMMON_CLK_DIV_MASK 0x7f43434444#define NSS_COMMON_CLK_SRC_CTRL 0x144545-#define NSS_COMMON_CLK_SRC_CTRL_OFFSET(x) (1 << x)4545+#define NSS_COMMON_CLK_SRC_CTRL_OFFSET(x) (x)4646/* Mode is coded on 1 bit but is different depending on the MAC ID:4747 * MAC0: QSGMII=0 RGMII=14848 * MAC1: QSGMII=0 SGMII=0 RGMII=1···308308309309 /* Configure the clock src according to the mode */310310 regmap_read(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, &val);311311- val &= ~NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id);311311+ val &= ~(1 << NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id));312312 switch (gmac->phy_mode) {313313 case PHY_INTERFACE_MODE_RGMII:314314 val |= NSS_COMMON_CLK_SRC_CTRL_RGMII(gmac->id) <<
···17561756 /* Do we support "hardware" checksums? */17571757 if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) {17581758 /* This opens up the world of extra features. */17591759- dev->hw_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;17591759+ dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_SG;17601760 if (csum)17611761- dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;17611761+ dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG;1762176217631763 if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) {17641764 dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO
···37283728 switch (phy->rev) {37293729 case 6:37303730 case 5:37313731- if (sprom->fem.ghz5.extpa_gain == 3)37313731+ if (sprom->fem.ghz2.extpa_gain == 3)37323732 return b43_ntab_tx_gain_epa_rev3_hi_pwr_2g;37333733 /* fall through */37343734 case 4:
+1-1
drivers/net/wireless/iwlwifi/mvm/scan.c
···10231023 cmd->scan_priority =10241024 iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6);1025102510261026- if (iwl_mvm_scan_total_iterations(params) == 0)10261026+ if (iwl_mvm_scan_total_iterations(params) == 1)10271027 cmd->ooc_priority =10281028 iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6);10291029 else
+19-3
drivers/net/wireless/iwlwifi/pcie/trans.c
···478478 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000)479479 iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG,480480 APMG_PCIDEV_STT_VAL_WAKE_ME);481481- else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000)481481+ else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) {482482+ iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,483483+ CSR_RESET_LINK_PWR_MGMT_DISABLED);482484 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,483485 CSR_HW_IF_CONFIG_REG_PREPARE |484486 CSR_HW_IF_CONFIG_REG_ENABLE_PME);487487+ mdelay(1);488488+ iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,489489+ CSR_RESET_LINK_PWR_MGMT_DISABLED);490490+ }485491 mdelay(5);486492 }487493···581575 if (ret >= 0)582576 return 0;583577578578+ iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,579579+ CSR_RESET_LINK_PWR_MGMT_DISABLED);580580+ msleep(1);581581+584582 for (iter = 0; iter < 10; iter++) {585583 /* If HW is not ready, prepare the conditions to check again */586584 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,···592582593583 do {594584 ret = iwl_pcie_set_hw_ready(trans);595595- if (ret >= 0)596596- return 0;585585+ if (ret >= 0) {586586+ ret = 0;587587+ goto out;588588+ }597589598590 usleep_range(200, 1000);599591 t += 200;···604592 }605593606594 IWL_ERR(trans, "Couldn't prepare the card\n");595595+596596+out:597597+ iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,598598+ CSR_RESET_LINK_PWR_MGMT_DISABLED);607599608600 return ret;609601}
+13-2
drivers/net/wireless/iwlwifi/pcie/tx.c
···1875187518761876 /* start timer if queue currently empty */18771877 if (q->read_ptr == q->write_ptr) {18781878- if (txq->wd_timeout)18791879- mod_timer(&txq->stuck_timer, jiffies + txq->wd_timeout);18781878+ if (txq->wd_timeout) {18791879+ /*18801880+ * If the TXQ is active, then set the timer, if not,18811881+ * set the timer in remainder so that the timer will18821882+ * be armed with the right value when the station will18831883+ * wake up.18841884+ */18851885+ if (!txq->frozen)18861886+ mod_timer(&txq->stuck_timer,18871887+ jiffies + txq->wd_timeout);18881888+ else18891889+ txq->frozen_expiry_remainder = txq->wd_timeout;18901890+ }18801891 IWL_DEBUG_RPM(trans, "Q: %d first tx - take ref\n", q->id);18811892 iwl_trans_pcie_ref(trans);18821893 }
+7-1
drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
···172172 (struct rsi_91x_sdiodev *)adapter->rsi_dev;173173 u32 len;174174 u32 num_blocks;175175+ const u8 *fw;175176 const struct firmware *fw_entry = NULL;176177 u32 block_size = dev->tx_blk_size;177178 int status = 0;···201200 return status;202201 }203202203203+ /* Copy firmware into DMA-accessible memory */204204+ fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);205205+ if (!fw)206206+ return -ENOMEM;204207 len = fw_entry->size;205208206209 if (len % 4)···215210 rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len);216211 rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);217212218218- status = rsi_copy_to_card(common, fw_entry->data, len, num_blocks);213213+ status = rsi_copy_to_card(common, fw, len, num_blocks);214214+ kfree(fw);219215 release_firmware(fw_entry);220216 return status;221217}
+4
drivers/net/wireless/rsi/rsi_91x_usb_ops.c
···146146 return status;147147 }148148149149+ /* Copy firmware into DMA-accessible memory */149150 fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);151151+ if (!fw)152152+ return -ENOMEM;150153 len = fw_entry->size;151154152155 if (len % 4)···161158 rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);162159163160 status = rsi_copy_to_card(common, fw, len, num_blocks);161161+ kfree(fw);164162 release_firmware(fw_entry);165163 return status;166164}
···6161void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue)6262{6363 atomic_dec(&queue->inflight_packets);6464+6565+ /* Wake the dealloc thread _after_ decrementing inflight_packets so6666+ * that if kthread_stop() has already been called, the dealloc thread6767+ * does not wait forever with nothing to wake it.6868+ */6969+ wake_up(&queue->dealloc_wq);6470}65716672int xenvif_schedulable(struct xenvif *vif)
+33-29
drivers/net/xen-netback/netback.c
···810810static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif_queue *queue,811811 struct sk_buff *skb,812812 struct xen_netif_tx_request *txp,813813- struct gnttab_map_grant_ref *gop)813813+ struct gnttab_map_grant_ref *gop,814814+ unsigned int frag_overflow,815815+ struct sk_buff *nskb)814816{815817 struct skb_shared_info *shinfo = skb_shinfo(skb);816818 skb_frag_t *frags = shinfo->frags;817819 u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx;818820 int start;819821 pending_ring_idx_t index;820820- unsigned int nr_slots, frag_overflow = 0;822822+ unsigned int nr_slots;821823822822- /* At this point shinfo->nr_frags is in fact the number of823823- * slots, which can be as large as XEN_NETBK_LEGACY_SLOTS_MAX.824824- */825825- if (shinfo->nr_frags > MAX_SKB_FRAGS) {826826- frag_overflow = shinfo->nr_frags - MAX_SKB_FRAGS;827827- BUG_ON(frag_overflow > MAX_SKB_FRAGS);828828- shinfo->nr_frags = MAX_SKB_FRAGS;829829- }830824 nr_slots = shinfo->nr_frags;831825832826 /* Skip first skb fragment if it is on same page as header fragment. */···835841 }836842837843 if (frag_overflow) {838838- struct sk_buff *nskb = xenvif_alloc_skb(0);839839- if (unlikely(nskb == NULL)) {840840- if (net_ratelimit())841841- netdev_err(queue->vif->dev,842842- "Can't allocate the frag_list skb.\n");843843- return NULL;844844- }845844846845 shinfo = skb_shinfo(nskb);847846 frags = shinfo->frags;···11621175 unsigned *copy_ops,11631176 unsigned *map_ops)11641177{11651165- struct gnttab_map_grant_ref *gop = queue->tx_map_ops, *request_gop;11661166- struct sk_buff *skb;11781178+ struct gnttab_map_grant_ref *gop = queue->tx_map_ops;11791179+ struct sk_buff *skb, *nskb;11671180 int ret;11811181+ unsigned int frag_overflow;1168118211691183 while (skb_queue_len(&queue->tx_queue) < budget) {11701184 struct xen_netif_tx_request txreq;···12531265 break;12541266 }1255126712681268+ skb_shinfo(skb)->nr_frags = ret;12691269+ if (data_len < txreq.size)12701270+ skb_shinfo(skb)->nr_frags++;12711271+ /* At this point shinfo->nr_frags is in fact the number of12721272+ * slots, which can be as large as XEN_NETBK_LEGACY_SLOTS_MAX.12731273+ */12741274+ frag_overflow = 0;12751275+ nskb = NULL;12761276+ if (skb_shinfo(skb)->nr_frags > MAX_SKB_FRAGS) {12771277+ frag_overflow = skb_shinfo(skb)->nr_frags - MAX_SKB_FRAGS;12781278+ BUG_ON(frag_overflow > MAX_SKB_FRAGS);12791279+ skb_shinfo(skb)->nr_frags = MAX_SKB_FRAGS;12801280+ nskb = xenvif_alloc_skb(0);12811281+ if (unlikely(nskb == NULL)) {12821282+ kfree_skb(skb);12831283+ xenvif_tx_err(queue, &txreq, idx);12841284+ if (net_ratelimit())12851285+ netdev_err(queue->vif->dev,12861286+ "Can't allocate the frag_list skb.\n");12871287+ break;12881288+ }12891289+ }12901290+12561291 if (extras[XEN_NETIF_EXTRA_TYPE_GSO - 1].type) {12571292 struct xen_netif_extra_info *gso;12581293 gso = &extras[XEN_NETIF_EXTRA_TYPE_GSO - 1];···12831272 if (xenvif_set_skb_gso(queue->vif, skb, gso)) {12841273 /* Failure in xenvif_set_skb_gso is fatal. */12851274 kfree_skb(skb);12751275+ kfree_skb(nskb);12861276 break;12871277 }12881278 }···1306129413071295 (*copy_ops)++;1308129613091309- skb_shinfo(skb)->nr_frags = ret;13101297 if (data_len < txreq.size) {13111311- skb_shinfo(skb)->nr_frags++;13121298 frag_set_pending_idx(&skb_shinfo(skb)->frags[0],13131299 pending_idx);13141300 xenvif_tx_create_map_op(queue, pending_idx, &txreq, gop);···1320131013211311 queue->pending_cons++;1322131213231323- request_gop = xenvif_get_requests(queue, skb, txfrags, gop);13241324- if (request_gop == NULL) {13251325- kfree_skb(skb);13261326- xenvif_tx_err(queue, &txreq, idx);13271327- break;13281328- }13291329- gop = request_gop;13131313+ gop = xenvif_get_requests(queue, skb, txfrags, gop,13141314+ frag_overflow, nskb);1330131513311316 __skb_queue_tail(&queue->tx_queue, skb);13321317···15411536 smp_wmb();15421537 queue->dealloc_prod++;15431538 } while (ubuf);15441544- wake_up(&queue->dealloc_wq);15451539 spin_unlock_irqrestore(&queue->callback_lock, flags);1546154015471541 if (likely(zerocopy_success))
···2828#include <linux/delay.h>2929#include <linux/phy/omap_control_phy.h>3030#include <linux/of_platform.h>3131+#include <linux/mfd/syscon.h>3232+#include <linux/regmap.h>31333234#define PLL_STATUS 0x000000043335#define PLL_GO 0x00000008···5351#define PLL_TICOPWDN BIT(16)5452#define PLL_LOCK 0x25553#define PLL_IDLE 0x15454+5555+#define SATA_PLL_SOFT_RESET BIT(18)56565757/*5858 * This is an Empirical value that works, need to confirm the actual···8682 struct clk *refclk;8783 struct clk *div_clk;8884 struct pipe3_dpll_map *dpll_map;8585+ struct regmap *dpll_reset_syscon; /* ctrl. reg. acces */8686+ unsigned int dpll_reset_reg; /* reg. index within syscon */8787+ bool sata_refclk_enabled;8988};90899190static struct pipe3_dpll_map dpll_map_usb[] = {···256249 u32 val;257250 unsigned long timeout;258251259259- /* SATA DPLL can't be powered down due to Errata i783 */260260- if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata"))252252+ /* If dpll_reset_syscon is not present we wont power down SATA DPLL253253+ * due to Errata i783254254+ */255255+ if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata") &&256256+ !phy->dpll_reset_syscon)261257 return 0;262258263259 /* PCIe doesn't have internal DPLL */···284274 val);285275 return -EBUSY;286276 }277277+ }278278+279279+ /* i783: SATA needs control bit toggle after PLL unlock */280280+ if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata")) {281281+ regmap_update_bits(phy->dpll_reset_syscon, phy->dpll_reset_reg,282282+ SATA_PLL_SOFT_RESET, SATA_PLL_SOFT_RESET);283283+ regmap_update_bits(phy->dpll_reset_syscon, phy->dpll_reset_reg,284284+ SATA_PLL_SOFT_RESET, 0);287285 }288286289287 ti_pipe3_disable_clocks(phy);···368350 }369351 } else {370352 phy->wkupclk = ERR_PTR(-ENODEV);353353+ phy->dpll_reset_syscon = syscon_regmap_lookup_by_phandle(node,354354+ "syscon-pllreset");355355+ if (IS_ERR(phy->dpll_reset_syscon)) {356356+ dev_info(&pdev->dev,357357+ "can't get syscon-pllreset, sata dpll won't idle\n");358358+ phy->dpll_reset_syscon = NULL;359359+ } else {360360+ if (of_property_read_u32_index(node,361361+ "syscon-pllreset", 1,362362+ &phy->dpll_reset_reg)) {363363+ dev_err(&pdev->dev,364364+ "couldn't get pllreset reg. offset\n");365365+ return -EINVAL;366366+ }367367+ }371368 }372369373370 if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) {···435402436403 platform_set_drvdata(pdev, phy);437404 pm_runtime_enable(phy->dev);438438- /* Prevent auto-disable of refclk for SATA PHY due to Errata i783 */439439- if (of_device_is_compatible(node, "ti,phy-pipe3-sata"))440440- if (!IS_ERR(phy->refclk))405405+406406+ /*407407+ * Prevent auto-disable of refclk for SATA PHY due to Errata i783408408+ */409409+ if (of_device_is_compatible(node, "ti,phy-pipe3-sata")) {410410+ if (!IS_ERR(phy->refclk)) {441411 clk_prepare_enable(phy->refclk);412412+ phy->sata_refclk_enabled = true;413413+ }414414+ }442415443416 generic_phy = devm_phy_create(phy->dev, NULL, &ops);444417 if (IS_ERR(generic_phy))···511472{512473 if (!IS_ERR(phy->wkupclk))513474 clk_disable_unprepare(phy->wkupclk);514514- if (!IS_ERR(phy->refclk))475475+ if (!IS_ERR(phy->refclk)) {515476 clk_disable_unprepare(phy->refclk);477477+ /*478478+ * SATA refclk needs an additional disable as we left it479479+ * on in probe to avoid Errata i783480480+ */481481+ if (phy->sata_refclk_enabled) {482482+ clk_disable_unprepare(phy->refclk);483483+ phy->sata_refclk_enabled = false;484484+ }485485+ }486486+516487 if (!IS_ERR(phy->div_clk))517488 clk_disable_unprepare(phy->div_clk);518489}
-1
drivers/platform/chrome/Kconfig
···4455menuconfig CHROME_PLATFORMS66 bool "Platform support for Chrome hardware"77- depends on X86 || ARM87 ---help---98 Say Y here to get to see options for platform support for109 various Chromebooks and Chromeboxes. This option alone does
···229229 struct thermal_instance *instance;230230 struct power_allocator_params *params = tz->governor_data;231231 u32 *req_power, *max_power, *granted_power, *extra_actor_power;232232- u32 total_req_power, max_allocatable_power;232232+ u32 *weighted_req_power;233233+ u32 total_req_power, max_allocatable_power, total_weighted_req_power;233234 u32 total_granted_power, power_range;234235 int i, num_actors, total_weight, ret = 0;235236 int trip_max_desired_temperature = params->trip_max_desired_temperature;···248247 }249248250249 /*251251- * We need to allocate three arrays of the same size:252252- * req_power, max_power and granted_power. They are going to253253- * be needed until this function returns. Allocate them all254254- * in one go to simplify the allocation and deallocation255255- * logic.250250+ * We need to allocate five arrays of the same size:251251+ * req_power, max_power, granted_power, extra_actor_power and252252+ * weighted_req_power. They are going to be needed until this253253+ * function returns. Allocate them all in one go to simplify254254+ * the allocation and deallocation logic.256255 */257256 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*max_power));258257 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*granted_power));259258 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*extra_actor_power));260260- req_power = devm_kcalloc(&tz->device, num_actors * 4,259259+ BUILD_BUG_ON(sizeof(*req_power) != sizeof(*weighted_req_power));260260+ req_power = devm_kcalloc(&tz->device, num_actors * 5,261261 sizeof(*req_power), GFP_KERNEL);262262 if (!req_power) {263263 ret = -ENOMEM;···268266 max_power = &req_power[num_actors];269267 granted_power = &req_power[2 * num_actors];270268 extra_actor_power = &req_power[3 * num_actors];269269+ weighted_req_power = &req_power[4 * num_actors];271270272271 i = 0;272272+ total_weighted_req_power = 0;273273 total_req_power = 0;274274 max_allocatable_power = 0;275275···293289 else294290 weight = instance->weight;295291296296- req_power[i] = frac_to_int(weight * req_power[i]);292292+ weighted_req_power[i] = frac_to_int(weight * req_power[i]);297293298294 if (power_actor_get_max_power(cdev, tz, &max_power[i]))299295 continue;300296301297 total_req_power += req_power[i];302298 max_allocatable_power += max_power[i];299299+ total_weighted_req_power += weighted_req_power[i];303300304301 i++;305302 }···308303 power_range = pid_controller(tz, current_temp, control_temp,309304 max_allocatable_power);310305311311- divvy_up_power(req_power, max_power, num_actors, total_req_power,312312- power_range, granted_power, extra_actor_power);306306+ divvy_up_power(weighted_req_power, max_power, num_actors,307307+ total_weighted_req_power, power_range, granted_power,308308+ extra_actor_power);313309314310 total_granted_power = 0;315311 i = 0;
+1-1
drivers/thermal/samsung/Kconfig
···11config EXYNOS_THERMAL22 tristate "Exynos thermal management unit driver"33- depends on OF33+ depends on THERMAL_OF44 help55 If you say yes here you get support for the TMU (Thermal Management66 Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises
+2-3
drivers/thermal/samsung/exynos_tmu.c
···1296129612971297static int exynos_tmu_probe(struct platform_device *pdev)12981298{12991299- struct exynos_tmu_platform_data *pdata;13001299 struct exynos_tmu_data *data;13011300 int ret;13021301···13161317 ret = exynos_map_dt_data(pdev);13171318 if (ret)13181319 goto err_sensor;13191319-13201320- pdata = data->pdata;1321132013221321 INIT_WORK(&data->irq_work, exynos_tmu_work);13231322···13891392 if (!IS_ERR(data->clk_sec))13901393 clk_unprepare(data->clk_sec);13911394err_sensor:13951395+ if (!IS_ERR_OR_NULL(data->regulator))13961396+ regulator_disable(data->regulator);13921397 thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);1393139813941399 return ret;
···779779 /* The current hw dequeue pointer */780780 tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(0));781781 deq_ptr_64 = tmp_32;782782- tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(1));782782+ tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS1(0));783783 deq_ptr_64 |= ((u64)tmp_32 << 32);784784785785 /* we have the dma addr of next bd that will be fetched by hardware */
···17921792 int size;17931793 int i, j, num_ports;1794179417951795- del_timer_sync(&xhci->cmd_timer);17951795+ if (timer_pending(&xhci->cmd_timer))17961796+ del_timer_sync(&xhci->cmd_timer);1796179717971798 /* Free the Event Ring Segment Table and the actual Event Ring */17981799 size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries);
+1-1
drivers/usb/host/xhci-ring.c
···8282 return 0;8383 /* offset in TRBs */8484 segment_offset = trb - seg->trbs;8585- if (segment_offset > TRBS_PER_SEGMENT)8585+ if (segment_offset >= TRBS_PER_SEGMENT)8686 return 0;8787 return seg->dma + (segment_offset * sizeof(*trb));8888}
···472472}473473474474/*475475- * We avoid multiple worker processes conflicting via the balloon mutex.475475+ * As this is a work item it is guaranteed to run as a single instance only.476476 * We may of course race updates of the target counts (which are protected477477 * by the balloon lock), or with changes to the Xen hard limit, but we will478478 * recover from these in time.···482482 enum bp_state state = BP_DONE;483483 long credit;484484485485- mutex_lock(&balloon_mutex);486485487486 do {487487+ mutex_lock(&balloon_mutex);488488+488489 credit = current_credit();489490490491 if (credit > 0) {···500499501500 state = update_schedule(state);502501503503-#ifndef CONFIG_PREEMPT504504- if (need_resched())505505- schedule();506506-#endif502502+ mutex_unlock(&balloon_mutex);503503+504504+ cond_resched();505505+507506 } while (credit && state == BP_DONE);508507509508 /* Schedule more work if there is some still to be done. */510509 if (state == BP_EAGAIN)511510 schedule_delayed_work(&balloon_worker, balloon_stats.schedule_delay * HZ);512512-513513- mutex_unlock(&balloon_mutex);514511}515512516513/* Resets the Xen limit, sets new target, and kicks off processing. */
···34423442 inode_init_early();34433443}3444344434453445-void __init vfs_caches_init(unsigned long mempages)34453445+void __init vfs_caches_init(void)34463446{34473447- unsigned long reserve;34483448-34493449- /* Base hash sizes on available memory, with a reserve equal to34503450- 150% of current kernel size */34513451-34523452- reserve = min((mempages - nr_free_pages()) * 3/2, mempages - 1);34533453- mempages -= reserve;34543454-34553447 names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0,34563448 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);3457344934583450 dcache_init();34593451 inode_init();34603460- files_init(mempages);34523452+ files_init();34533453+ files_maxfiles_init();34613454 mnt_init();34623455 bdev_cache_init();34633456 chrdev_init();
+17-11
fs/file_table.c
···2525#include <linux/hardirq.h>2626#include <linux/task_work.h>2727#include <linux/ima.h>2828+#include <linux/swap.h>28292930#include <linux/atomic.h>3031···309308 }310309}311310312312-void __init files_init(unsigned long mempages)311311+void __init files_init(void)313312{ 314314- unsigned long n;315315-316313 filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,317314 SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);318318-319319- /*320320- * One file with associated inode and dcache is very roughly 1K.321321- * Per default don't use more than 10% of our memory for files. 322322- */ 323323-324324- n = (mempages * (PAGE_SIZE / 1024)) / 10;325325- files_stat.max_files = max_t(unsigned long, n, NR_FILE);326315 percpu_counter_init(&nr_files, 0, GFP_KERNEL);316316+}317317+318318+/*319319+ * One file with associated inode and dcache is very roughly 1K. Per default320320+ * do not use more than 10% of our memory for files.321321+ */322322+void __init files_maxfiles_init(void)323323+{324324+ unsigned long n;325325+ unsigned long memreserve = (totalram_pages - nr_free_pages()) * 3/2;326326+327327+ memreserve = min(memreserve, totalram_pages - 1);328328+ n = ((totalram_pages - memreserve) * (PAGE_SIZE / 1024)) / 10;329329+330330+ files_stat.max_files = max_t(unsigned long, n, NR_FILE);327331}
+2
fs/hugetlbfs/inode.c
···10101010 inode = hugetlbfs_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0);10111011 if (!inode)10121012 goto out_dentry;10131013+ if (creat_flags == HUGETLB_SHMFS_INODE)10141014+ inode->i_flags |= S_PRIVATE;1013101510141016 file = ERR_PTR(-ENOMEM);10151017 if (hugetlb_reserve_pages(inode, 0,
+7-2
fs/namei.c
···879879 return 0;880880881881 /* Allowed if parent directory not sticky and world-writable. */882882- parent = nd->path.dentry->d_inode;882882+ parent = nd->inode;883883 if ((parent->i_mode & (S_ISVTX|S_IWOTH)) != (S_ISVTX|S_IWOTH))884884 return 0;885885···19541954 continue;19551955 }19561956 }19571957- if (unlikely(!d_can_lookup(nd->path.dentry)))19571957+ if (unlikely(!d_can_lookup(nd->path.dentry))) {19581958+ if (nd->flags & LOOKUP_RCU) {19591959+ if (unlazy_walk(nd, NULL, 0))19601960+ return -ECHILD;19611961+ }19581962 return -ENOTDIR;19631963+ }19591964 }19601965}19611966
···412412 unsigned int flags)413413{414414 struct fsnotify_mark *lmark, *mark;415415+ LIST_HEAD(to_free);415416417417+ /*418418+ * We have to be really careful here. Anytime we drop mark_mutex, e.g.419419+ * fsnotify_clear_marks_by_inode() can come and free marks. Even in our420420+ * to_free list so we have to use mark_mutex even when accessing that421421+ * list. And freeing mark requires us to drop mark_mutex. So we can422422+ * reliably free only the first mark in the list. That's why we first423423+ * move marks to free to to_free list in one go and then free marks in424424+ * to_free list one by one.425425+ */416426 mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);417427 list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) {418418- if (mark->flags & flags) {419419- fsnotify_get_mark(mark);420420- fsnotify_destroy_mark_locked(mark, group);421421- fsnotify_put_mark(mark);422422- }428428+ if (mark->flags & flags)429429+ list_move(&mark->g_list, &to_free);423430 }424431 mutex_unlock(&group->mark_mutex);432432+433433+ while (1) {434434+ mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);435435+ if (list_empty(&to_free)) {436436+ mutex_unlock(&group->mark_mutex);437437+ break;438438+ }439439+ mark = list_first_entry(&to_free, struct fsnotify_mark, g_list);440440+ fsnotify_get_mark(mark);441441+ fsnotify_destroy_mark_locked(mark, group);442442+ mutex_unlock(&group->mark_mutex);443443+ fsnotify_put_mark(mark);444444+ }425445}426446427447/*
···40254025 osb->dc_work_sequence = osb->dc_wake_sequence;4026402640274027 processed = osb->blocked_lock_count;40284028- while (processed) {40294029- BUG_ON(list_empty(&osb->blocked_lock_list));40304030-40284028+ /*40294029+ * blocked lock processing in this loop might call iput which can40304030+ * remove items off osb->blocked_lock_list. Downconvert up to40314031+ * 'processed' number of locks, but stop short if we had some40324032+ * removed in ocfs2_mark_lockres_freeing when downconverting.40334033+ */40344034+ while (processed && !list_empty(&osb->blocked_lock_list)) {40314035 lockres = list_entry(osb->blocked_lock_list.next,40324036 struct ocfs2_lock_res, l_blocked_list);40334037 list_del_init(&lockres->l_blocked_list);
+3-2
fs/signalfd.c
···121121 * Other callers might not initialize the si_lsb field,122122 * so check explicitly for the right codes here.123123 */124124- if (kinfo->si_code == BUS_MCEERR_AR ||125125- kinfo->si_code == BUS_MCEERR_AO)124124+ if (kinfo->si_signo == SIGBUS &&125125+ (kinfo->si_code == BUS_MCEERR_AR ||126126+ kinfo->si_code == BUS_MCEERR_AO))126127 err |= __put_user((short) kinfo->si_addr_lsb,127128 &uinfo->ssi_addr_lsb);128129#endif
+1-1
include/drm/drmP.h
···691691 struct timer_list disable_timer; /* delayed disable timer */692692693693 /* vblank counter, protected by dev->vblank_time_lock for writes */694694- unsigned long count;694694+ u32 count;695695 /* vblank timestamps, protected by dev->vblank_time_lock for writes */696696 struct timeval time[DRM_VBLANKTIME_RBSIZE];697697
+3
include/drm/drm_crtc_helper.h
···168168 * @get_modes: get mode list for this connector169169 * @mode_valid: is this mode valid on the given connector? (optional)170170 * @best_encoder: return the preferred encoder for this connector171171+ * @atomic_best_encoder: atomic version of @best_encoder171172 *172173 * The helper operations are called by the mid-layer CRTC helper.173174 */···177176 enum drm_mode_status (*mode_valid)(struct drm_connector *connector,178177 struct drm_display_mode *mode);179178 struct drm_encoder *(*best_encoder)(struct drm_connector *connector);179179+ struct drm_encoder *(*atomic_best_encoder)(struct drm_connector *connector,180180+ struct drm_connector_state *connector_state);180181};181182182183extern void drm_helper_disable_unused_functions(struct drm_device *dev);
···631631 1 << PG_private | 1 << PG_private_2 | \632632 1 << PG_writeback | 1 << PG_reserved | \633633 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \634634- 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON | \634634+ 1 << PG_unevictable | __PG_MLOCKED | \635635 __PG_COMPOUND_LOCK)636636637637/*638638 * Flags checked when a page is prepped for return by the page allocator.639639- * Pages being prepped should not have any flags set. It they are set,639639+ * Pages being prepped should not have these flags set. It they are set,640640 * there has been a kernel bug or struct page corruption.641641+ *642642+ * __PG_HWPOISON is exceptional because it needs to be kept beyond page's643643+ * alloc-free cycle to prevent from reusing the page.641644 */642642-#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1)645645+#define PAGE_FLAGS_CHECK_AT_PREP \646646+ (((1 << NR_PAGEFLAGS) - 1) & ~__PG_HWPOISON)643647644648#define PAGE_FLAGS_PRIVATE \645649 (1 << PG_private | 1 << PG_private_2)
+3-3
include/linux/skbuff.h
···29132913 *29142914 * PHY drivers may accept clones of transmitted packets for29152915 * timestamping via their phy_driver.txtstamp method. These drivers29162916- * must call this function to return the skb back to the stack, with29172917- * or without a timestamp.29162916+ * must call this function to return the skb back to the stack with a29172917+ * timestamp.29182918 *29192919 * @skb: clone of the the original outgoing packet29202920- * @hwtstamps: hardware time stamps, may be NULL if not available29202920+ * @hwtstamps: hardware time stamps29212921 *29222922 */29232923void skb_complete_tx_timestamp(struct sk_buff *skb,
+1
include/uapi/linux/pci_regs.h
···319319#define PCI_MSIX_PBA 8 /* Pending Bit Array offset */320320#define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */321321#define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */322322+#define PCI_MSIX_FLAGS_BIRMASK PCI_MSIX_PBA_BIR /* deprecated */322323#define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */323324324325/* MSI-X Table entry format */
+24-11
include/uapi/sound/asoc.h
···7777#define SND_SOC_TPLG_NUM_TEXTS 1678787979/* ABI version */8080-#define SND_SOC_TPLG_ABI_VERSION 0x28080+#define SND_SOC_TPLG_ABI_VERSION 0x381818282/* Max size of TLV data */8383#define SND_SOC_TPLG_TLV_SIZE 32···9797#define SND_SOC_TPLG_TYPE_PCM 79898#define SND_SOC_TPLG_TYPE_MANIFEST 89999#define SND_SOC_TPLG_TYPE_CODEC_LINK 9100100-#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_CODEC_LINK100100+#define SND_SOC_TPLG_TYPE_PDATA 10101101+#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_PDATA101102102103/* vendor block IDs - please add new vendor types to end */103104#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000···138137/*139138 * Kcontrol TLV data.140139 */140140+struct snd_soc_tplg_tlv_dbscale {141141+ __le32 min;142142+ __le32 step;143143+ __le32 mute;144144+} __attribute__((packed));145145+141146struct snd_soc_tplg_ctl_tlv {142142- __le32 size; /* in bytes aligned to 4 */143143- __le32 numid; /* control element numeric identification */144144- __le32 count; /* number of elem in data array */145145- __le32 data[SND_SOC_TPLG_TLV_SIZE];147147+ __le32 size; /* in bytes of this structure */148148+ __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */149149+ union {150150+ __le32 data[SND_SOC_TPLG_TLV_SIZE];151151+ struct snd_soc_tplg_tlv_dbscale scale;152152+ };146153} __attribute__((packed));147154148155/*···164155} __attribute__((packed));165156166157/*167167- * Kcontrol Operations IDs158158+ * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops159159+ * Kcontrol ops need get/put/info.160160+ * Bytes ext ops need get/put.168161 */169169-struct snd_soc_tplg_kcontrol_ops_id {162162+struct snd_soc_tplg_io_ops {170163 __le32 get;171164 __le32 put;172165 __le32 info;···182171 __le32 type;183172 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];184173 __le32 access;185185- struct snd_soc_tplg_kcontrol_ops_id ops;186186- __le32 tlv_size; /* non zero means control has TLV data */174174+ struct snd_soc_tplg_io_ops ops;175175+ struct snd_soc_tplg_ctl_tlv tlv;187176} __attribute__((packed));188177189178/*···249238 __le32 graph_elems; /* number of graph elements */250239 __le32 dai_elems; /* number of DAI elements */251240 __le32 dai_link_elems; /* number of DAI link elements */241241+ struct snd_soc_tplg_private priv;252242} __attribute__((packed));253243254244/*···271259 __le32 invert;272260 __le32 num_channels;273261 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];274274- struct snd_soc_tplg_ctl_tlv tlv;275262 struct snd_soc_tplg_private priv;276263} __attribute__((packed));277264···314303 __le32 mask;315304 __le32 base;316305 __le32 num_regs;306306+ struct snd_soc_tplg_io_ops ext_ops;317307 struct snd_soc_tplg_private priv;318308} __attribute__((packed));319309···359347 __le32 reg; /* negative reg = no direct dapm */360348 __le32 shift; /* bits to shift */361349 __le32 mask; /* non-shifted mask */350350+ __le32 subseq; /* sort within widget type */362351 __u32 invert; /* invert the power bit */363352 __u32 ignore_suspend; /* kept enabled over suspend */364353 __u16 event_flags;
···9797{9898 return test_bit(KTHREAD_SHOULD_PARK, &to_kthread(current)->flags);9999}100100+EXPORT_SYMBOL_GPL(kthread_should_park);100101101102/**102103 * kthread_freezable_should_stop - should this freezable kthread return now?···172171{173172 __kthread_parkme(to_kthread(current));174173}174174+EXPORT_SYMBOL_GPL(kthread_parkme);175175176176static int kthread(void *_create)177177{···413411 if (kthread)414412 __kthread_unpark(k, kthread);415413}414414+EXPORT_SYMBOL_GPL(kthread_unpark);416415417416/**418417 * kthread_park - park a thread created by kthread_create().···444441 }445442 return ret;446443}444444+EXPORT_SYMBOL_GPL(kthread_park);447445448446/**449447 * kthread_stop - stop a thread created by kthread_create().
+6-2
kernel/module.c
···602602}603603EXPORT_SYMBOL_GPL(find_symbol);604604605605-/* Search for module by name: must hold module_mutex. */605605+/*606606+ * Search for module by name: must hold module_mutex (or preempt disabled607607+ * for read-only access).608608+ */606609static struct module *find_module_all(const char *name, size_t len,607610 bool even_unformed)608611{609612 struct module *mod;610613611611- module_assert_mutex();614614+ module_assert_mutex_or_preempt();612615613616 list_for_each_entry(mod, &modules, list) {614617 if (!even_unformed && mod->state == MODULE_STATE_UNFORMED)···624621625622struct module *find_module(const char *name)626623{624624+ module_assert_mutex();627625 return find_module_all(name, strlen(name), false);628626}629627EXPORT_SYMBOL_GPL(find_module);
+8-5
kernel/signal.c
···27482748 * Other callers might not initialize the si_lsb field,27492749 * so check explicitly for the right codes here.27502750 */27512751- if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)27512751+ if (from->si_signo == SIGBUS &&27522752+ (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO))27522753 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);27532754#endif27542755#ifdef SEGV_BNDERR27552755- err |= __put_user(from->si_lower, &to->si_lower);27562756- err |= __put_user(from->si_upper, &to->si_upper);27562756+ if (from->si_signo == SIGSEGV && from->si_code == SEGV_BNDERR) {27572757+ err |= __put_user(from->si_lower, &to->si_lower);27582758+ err |= __put_user(from->si_upper, &to->si_upper);27592759+ }27572760#endif27582761 break;27592762 case __SI_CHLD:···30203017 int, sig,30213018 struct compat_siginfo __user *, uinfo)30223019{30233023- siginfo_t info;30203020+ siginfo_t info = {};30243021 int ret = copy_siginfo_from_user32(&info, uinfo);30253022 if (unlikely(ret))30263023 return ret;···30643061 int, sig,30653062 struct compat_siginfo __user *, uinfo)30663063{30673067- siginfo_t info;30643064+ siginfo_t info = {};3068306530693066 if (copy_siginfo_from_user32(&info, uinfo))30703067 return -EFAULT;
···16761676 /* after clearing PageTail the gup refcount can be released */16771677 smp_mb__after_atomic();1678167816791679- /*16801680- * retain hwpoison flag of the poisoned tail page:16811681- * fix for the unsuitable process killed on Guest Machine(KVM)16821682- * by the memory-failure.16831683- */16841684- page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP | __PG_HWPOISON;16791679+ page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;16851680 page_tail->flags |= (page->flags &16861681 ((1L << PG_referenced) |16871682 (1L << PG_swapbacked) |
+18-14
mm/memory-failure.c
···909909 * directly for tail pages.910910 */911911 if (PageTransHuge(head)) {912912+ /*913913+ * Non anonymous thp exists only in allocation/free time. We914914+ * can't handle such a case correctly, so let's give it up.915915+ * This should be better than triggering BUG_ON when kernel916916+ * tries to touch the "partially handled" page.917917+ */918918+ if (!PageAnon(head)) {919919+ pr_err("MCE: %#lx: non anonymous thp\n",920920+ page_to_pfn(page));921921+ return 0;922922+ }923923+912924 if (get_page_unless_zero(head)) {913925 if (PageTail(page))914926 get_page(page);···11461134 }1147113511481136 if (!PageHuge(p) && PageTransHuge(hpage)) {11491149- if (!PageAnon(hpage)) {11501150- pr_err("MCE: %#lx: non anonymous thp\n", pfn);11511151- if (TestClearPageHWPoison(p))11521152- atomic_long_sub(nr_pages, &num_poisoned_pages);11531153- put_page(p);11541154- if (p != hpage)11551155- put_page(hpage);11561156- return -EBUSY;11571157- }11581137 if (unlikely(split_huge_page(hpage))) {11591138 pr_err("MCE: %#lx: thp split failed\n", pfn);11601139 if (TestClearPageHWPoison(p))···12121209 if (!PageHWPoison(p)) {12131210 printk(KERN_ERR "MCE %#lx: just unpoisoned\n", pfn);12141211 atomic_long_sub(nr_pages, &num_poisoned_pages);12121212+ unlock_page(hpage);12151213 put_page(hpage);12161216- res = 0;12171217- goto out;12141214+ return 0;12181215 }12191216 if (hwpoison_filter(p)) {12201217 if (TestClearPageHWPoison(p))···16591656 inc_zone_page_state(page, NR_ISOLATED_ANON +16601657 page_is_file_cache(page));16611658 list_add(&page->lru, &pagelist);16591659+ if (!TestSetPageHWPoison(page))16601660+ atomic_long_inc(&num_poisoned_pages);16621661 ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL,16631662 MIGRATE_SYNC, MR_MEMORY_FAILURE);16641663 if (ret) {···16751670 pfn, ret, page->flags);16761671 if (ret > 0)16771672 ret = -EIO;16781678- } else {16791679- SetPageHWPoison(page);16801680- atomic_long_inc(&num_poisoned_pages);16731673+ if (TestClearPageHWPoison(page))16741674+ atomic_long_dec(&num_poisoned_pages);16811675 }16821676 } else {16831677 pr_info("soft offline: %#lx: isolation failed: %d, page count %d, type %lx\n",
+9-1
mm/memory_hotplug.c
···446446 int nr_pages = PAGES_PER_SECTION;447447 int nid = pgdat->node_id;448448 int zone_type;449449- unsigned long flags;449449+ unsigned long flags, pfn;450450 int ret;451451452452 zone_type = zone - pgdat->node_zones;···461461 pgdat_resize_unlock(zone->zone_pgdat, &flags);462462 memmap_init_zone(nr_pages, nid, zone_type,463463 phys_start_pfn, MEMMAP_HOTPLUG);464464+465465+ /* online_page_range is called later and expects pages reserved */466466+ for (pfn = phys_start_pfn; pfn < phys_start_pfn + nr_pages; pfn++) {467467+ if (!pfn_valid(pfn))468468+ continue;469469+470470+ SetPageReserved(pfn_to_page(pfn));471471+ }464472 return 0;465473}466474
+6-2
mm/migrate.c
···880880 /* Establish migration ptes or remove ptes */881881 if (page_mapped(page)) {882882 try_to_unmap(page,883883- TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS);883883+ TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS|884884+ TTU_IGNORE_HWPOISON);884885 page_was_mapped = 1;885886 }886887···951950 list_del(&page->lru);952951 dec_zone_page_state(page, NR_ISOLATED_ANON +953952 page_is_file_cache(page));954954- if (reason != MR_MEMORY_FAILURE)953953+ /* Soft-offlined page shouldn't go through lru cache list */954954+ if (reason == MR_MEMORY_FAILURE)955955+ put_page(page);956956+ else955957 putback_lru_page(page);956958 }957959
···1818#include <linux/mm.h>1919#include <linux/swap.h>2020#include <linux/interrupt.h>2121-#include <linux/rwsem.h>2221#include <linux/pagemap.h>2322#include <linux/jiffies.h>2423#include <linux/bootmem.h>···980981981982#if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) || \982983 defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)983983-/* Only safe to use early in boot when initialisation is single-threaded */984984+984985static struct mminit_pfnnid_cache early_pfnnid_cache __meminitdata;985986986987int __meminit early_pfn_to_nid(unsigned long pfn)987988{989989+ static DEFINE_SPINLOCK(early_pfn_lock);988990 int nid;989991990990- /* The system will behave unpredictably otherwise */991991- BUG_ON(system_state != SYSTEM_BOOTING);992992-992992+ spin_lock(&early_pfn_lock);993993 nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache);994994- if (nid >= 0)995995- return nid;996996- /* just returns 0 */997997- return 0;994994+ if (nid < 0)995995+ nid = 0;996996+ spin_unlock(&early_pfn_lock);997997+998998+ return nid;998999}9991000#endif10001001···10591060 __free_pages_boot_core(page, pfn, 0);10601061}1061106210621062-static __initdata DECLARE_RWSEM(pgdat_init_rwsem);10631063+/* Completion tracking for deferred_init_memmap() threads */10641064+static atomic_t pgdat_init_n_undone __initdata;10651065+static __initdata DECLARE_COMPLETION(pgdat_init_all_done_comp);10661066+10671067+static inline void __init pgdat_init_report_one_done(void)10681068+{10691069+ if (atomic_dec_and_test(&pgdat_init_n_undone))10701070+ complete(&pgdat_init_all_done_comp);10711071+}1063107210641073/* Initialise remaining memory on a node */10651074static int __init deferred_init_memmap(void *data)···10841077 const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id);1085107810861079 if (first_init_pfn == ULONG_MAX) {10871087- up_read(&pgdat_init_rwsem);10801080+ pgdat_init_report_one_done();10881081 return 0;10891082 }10901083···1184117711851178 pr_info("node %d initialised, %lu pages in %ums\n", nid, nr_pages,11861179 jiffies_to_msecs(jiffies - start));11871187- up_read(&pgdat_init_rwsem);11801180+11811181+ pgdat_init_report_one_done();11881182 return 0;11891183}11901184···11931185{11941186 int nid;1195118711881188+ /* There will be num_node_state(N_MEMORY) threads */11891189+ atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY));11961190 for_each_node_state(nid, N_MEMORY) {11971197- down_read(&pgdat_init_rwsem);11981191 kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid);11991192 }1200119312011194 /* Block until all are initialised */12021202- down_write(&pgdat_init_rwsem);12031203- up_write(&pgdat_init_rwsem);11951195+ wait_for_completion(&pgdat_init_all_done_comp);11961196+11971197+ /* Reinit limits that are based on free pages after the kernel is up */11981198+ files_maxfiles_init();12041199}12051200#endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */12061201···12961285 bad_reason = "non-NULL mapping";12971286 if (unlikely(atomic_read(&page->_count) != 0))12981287 bad_reason = "nonzero _count";12881288+ if (unlikely(page->flags & __PG_HWPOISON)) {12891289+ bad_reason = "HWPoisoned (hardware-corrupted)";12901290+ bad_flags = __PG_HWPOISON;12911291+ }12991292 if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) {13001293 bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set";13011294 bad_flags = PAGE_FLAGS_CHECK_AT_PREP;
+2-2
mm/shmem.c
···33633363 * shmem_kernel_file_setup - get an unlinked file living in tmpfs which must be33643364 * kernel internal. There will be NO LSM permission checks against the33653365 * underlying inode. So users of this interface must do LSM checks at a33663366- * higher layer. The one user is the big_key implementation. LSM checks33673367- * are provided at the key level rather than the inode level.33663366+ * higher layer. The users are the big_key and shm implementations. LSM33673367+ * checks are provided at the key or shm level rather than the inode.33683368 * @name: name for dentry (to be seen in /proc/<pid>/maps33693369 * @size: size to be set for the file33703370 * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size
+1-2
mm/slab_common.c
···3737 SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE | \3838 SLAB_FAILSLAB)39394040-#define SLAB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \4141- SLAB_CACHE_DMA | SLAB_NOTRACK)4040+#define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | SLAB_NOTRACK)42414342/*4443 * Merge control. If this is set then no merging of slab caches will occur.
+6-10
mm/vmscan.c
···973973 * caller can stall after page list has been processed.974974 *975975 * 2) Global or new memcg reclaim encounters a page that is976976- * not marked for immediate reclaim or the caller does not977977- * have __GFP_IO. In this case mark the page for immediate976976+ * not marked for immediate reclaim, or the caller does not977977+ * have __GFP_FS (or __GFP_IO if it's simply going to swap,978978+ * not to fs). In this case mark the page for immediate978979 * reclaim and continue scanning.979980 *980980- * __GFP_IO is checked because a loop driver thread might981981+ * Require may_enter_fs because we would wait on fs, which982982+ * may not have submitted IO yet. And the loop driver might981983 * enter reclaim, and deadlock if it waits on a page for982984 * which it is needed to do the write (loop masks off983985 * __GFP_IO|__GFP_FS for this reason); but more thought984986 * would probably show more reasons.985985- *986986- * Don't require __GFP_FS, since we're not going into the987987- * FS, just waiting on its writeback completion. Worryingly,988988- * ext4 gfs2 and xfs allocate pages with989989- * grab_cache_page_write_begin(,,AOP_FLAG_NOFS), so testing990990- * may_enter_fs here is liable to OOM on them.991987 *992988 * 3) Legacy memcg encounters a page that is not already marked993989 * PageReclaim. memcg does not have any dirty pages···1001100510021006 /* Case 2 above */10031007 } else if (sane_reclaim(sc) ||10041004- !PageReclaim(page) || !(sc->gfp_mask & __GFP_IO)) {10081008+ !PageReclaim(page) || !may_enter_fs) {10051009 /*10061010 * This is slightly racy - end_page_writeback()10071011 * might have just cleared PageReclaim, then
+13-5
net/batman-adv/distributed-arp-table.c
···11381138 * @bat_priv: the bat priv with all the soft interface information11391139 * @skb: packet to check11401140 * @hdr_size: size of the encapsulation header11411141+ *11421142+ * Returns true if the packet was snooped and consumed by DAT. False if the11431143+ * packet has to be delivered to the interface11411144 */11421145bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,11431146 struct sk_buff *skb, int hdr_size)···11481145 uint16_t type;11491146 __be32 ip_src, ip_dst;11501147 uint8_t *hw_src, *hw_dst;11511151- bool ret = false;11481148+ bool dropped = false;11521149 unsigned short vid;1153115011541151 if (!atomic_read(&bat_priv->distributed_arp_table))···11771174 /* if this REPLY is directed to a client of mine, let's deliver the11781175 * packet to the interface11791176 */11801180- ret = !batadv_is_my_client(bat_priv, hw_dst, vid);11771177+ dropped = !batadv_is_my_client(bat_priv, hw_dst, vid);11781178+11791179+ /* if this REPLY is sent on behalf of a client of mine, let's drop the11801180+ * packet because the client will reply by itself11811181+ */11821182+ dropped |= batadv_is_my_client(bat_priv, hw_src, vid);11811183out:11821182- if (ret)11841184+ if (dropped)11831185 kfree_skb(skb);11841184- /* if ret == false -> packet has to be delivered to the interface */11851185- return ret;11861186+ /* if dropped == false -> deliver to the interface */11871187+ return dropped;11861188}1187118911881190/**
···479479 */480480void batadv_softif_vlan_free_ref(struct batadv_softif_vlan *vlan)481481{482482+ if (!vlan)483483+ return;484484+482485 if (atomic_dec_and_test(&vlan->refcount)) {483486 spin_lock_bh(&vlan->bat_priv->softif_vlan_list_lock);484487 hlist_del_rcu(&vlan->list);
+24-5
net/batman-adv/translation-table.c
···594594595595 /* increase the refcounter of the related vlan */596596 vlan = batadv_softif_vlan_get(bat_priv, vid);597597+ if (WARN(!vlan, "adding TT local entry %pM to non-existent VLAN %d",598598+ addr, BATADV_PRINT_VID(vid)))599599+ goto out;597600598601 batadv_dbg(BATADV_DBG_TT, bat_priv,599602 "Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n",···10371034 struct batadv_tt_local_entry *tt_local_entry;10381035 uint16_t flags, curr_flags = BATADV_NO_FLAGS;10391036 struct batadv_softif_vlan *vlan;10371037+ void *tt_entry_exists;1040103810411039 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);10421040 if (!tt_local_entry)···10651061 * immediately purge it10661062 */10671063 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL);10681068- hlist_del_rcu(&tt_local_entry->common.hash_entry);10641064+10651065+ tt_entry_exists = batadv_hash_remove(bat_priv->tt.local_hash,10661066+ batadv_compare_tt,10671067+ batadv_choose_tt,10681068+ &tt_local_entry->common);10691069+ if (!tt_entry_exists)10701070+ goto out;10711071+10721072+ /* extra call to free the local tt entry */10691073 batadv_tt_local_entry_free_ref(tt_local_entry);1070107410711075 /* decrease the reference held for this vlan */10721076 vlan = batadv_softif_vlan_get(bat_priv, vid);10771077+ if (!vlan)10781078+ goto out;10791079+10731080 batadv_softif_vlan_free_ref(vlan);10741081 batadv_softif_vlan_free_ref(vlan);10751082···11811166 /* decrease the reference held for this vlan */11821167 vlan = batadv_softif_vlan_get(bat_priv,11831168 tt_common_entry->vid);11841184- batadv_softif_vlan_free_ref(vlan);11851185- batadv_softif_vlan_free_ref(vlan);11691169+ if (vlan) {11701170+ batadv_softif_vlan_free_ref(vlan);11711171+ batadv_softif_vlan_free_ref(vlan);11721172+ }1186117311871174 batadv_tt_local_entry_free_ref(tt_local);11881175 }···3224320732253208 /* decrease the reference held for this vlan */32263209 vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid);32273227- batadv_softif_vlan_free_ref(vlan);32283228- batadv_softif_vlan_free_ref(vlan);32103210+ if (vlan) {32113211+ batadv_softif_vlan_free_ref(vlan);32123212+ batadv_softif_vlan_free_ref(vlan);32133213+ }3229321432303215 batadv_tt_local_entry_free_ref(tt_local);32313216 }
+1-1
net/bluetooth/mgmt.c
···78437843 /* Make sure we copy only the significant bytes based on the78447844 * encryption key size, and set the rest of the value to zeroes.78457845 */78467846- memcpy(ev.key.val, key->val, sizeof(key->enc_size));78467846+ memcpy(ev.key.val, key->val, key->enc_size);78477847 memset(ev.key.val + key->enc_size, 0,78487848 sizeof(ev.key.val) - key->enc_size);78497849
···103103 spin_lock_bh(&queue->syn_wait_lock);104104 while ((req = lopt->syn_table[i]) != NULL) {105105 lopt->syn_table[i] = req->dl_next;106106+ /* Because of following del_timer_sync(),107107+ * we must release the spinlock here108108+ * or risk a dead lock.109109+ */110110+ spin_unlock_bh(&queue->syn_wait_lock);106111 atomic_inc(&lopt->qlen_dec);107107- if (del_timer(&req->rsk_timer))112112+ if (del_timer_sync(&req->rsk_timer))108113 reqsk_put(req);109114 reqsk_put(req);115115+ spin_lock_bh(&queue->syn_wait_lock);110116 }111117 spin_unlock_bh(&queue->syn_wait_lock);112118 }
···593593 }594594595595 spin_unlock(&queue->syn_wait_lock);596596- if (del_timer(&req->rsk_timer))596596+ if (del_timer_sync(&req->rsk_timer))597597 reqsk_put(req);598598 return found;599599}
···18441844 int gwa_type;1845184518461846 gw_addr = &cfg->fc_gateway;18471847+ gwa_type = ipv6_addr_type(gw_addr);1847184818481849 /* if gw_addr is local we will fail to detect this in case18491850 * address is still TENTATIVE (DAD in progress). rt6_lookup()···18521851 * prefix route was assigned to, which might be non-loopback.18531852 */18541853 err = -EINVAL;18551855- if (ipv6_chk_addr_and_flags(net, gw_addr, NULL, 0, 0))18541854+ if (ipv6_chk_addr_and_flags(net, gw_addr,18551855+ gwa_type & IPV6_ADDR_LINKLOCAL ?18561856+ dev : NULL, 0, 0))18561857 goto out;1857185818581859 rt->rt6i_gateway = *gw_addr;18591859- gwa_type = ipv6_addr_type(gw_addr);1860186018611861 if (gwa_type != (IPV6_ADDR_LINKLOCAL|IPV6_ADDR_UNICAST)) {18621862 struct rt6_info *grt;
+1-1
net/ipv6/tcp_ipv6.c
···943943 &ipv6_hdr(skb)->daddr, tcp_v6_iif(skb));944944 if (req) {945945 nsk = tcp_check_req(sk, skb, req, false);946946- if (!nsk)946946+ if (!nsk || nsk == sk)947947 reqsk_put(req);948948 return nsk;949949 }
+3-5
net/netfilter/nf_conntrack_core.c
···292292{293293 struct nf_conn *tmpl;294294295295- tmpl = kzalloc(sizeof(struct nf_conn), GFP_KERNEL);295295+ tmpl = kzalloc(sizeof(*tmpl), flags);296296 if (tmpl == NULL)297297 return NULL;298298···303303 if (zone) {304304 struct nf_conntrack_zone *nf_ct_zone;305305306306- nf_ct_zone = nf_ct_ext_add(tmpl, NF_CT_EXT_ZONE, GFP_ATOMIC);306306+ nf_ct_zone = nf_ct_ext_add(tmpl, NF_CT_EXT_ZONE, flags);307307 if (!nf_ct_zone)308308 goto out_free;309309 nf_ct_zone->id = zone;···15441544 sz = nr_slots * sizeof(struct hlist_nulls_head);15451545 hash = (void *)__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,15461546 get_order(sz));15471547- if (!hash) {15481548- printk(KERN_WARNING "nf_conntrack: falling back to vmalloc.\n");15471547+ if (!hash)15491548 hash = vzalloc(sz);15501550- }1551154915521550 if (hash && nulls)15531551 for (i = 0; i < nr_slots; i++)
+1-3
net/netfilter/nf_synproxy_core.c
···353353 int err = -ENOMEM;354354355355 ct = nf_ct_tmpl_alloc(net, 0, GFP_KERNEL);356356- if (IS_ERR(ct)) {357357- err = PTR_ERR(ct);356356+ if (!ct)358357 goto err1;359359- }360358361359 if (!nfct_seqadj_ext_add(ct))362360 goto err2;
+3-2
net/netfilter/xt_CT.c
···202202 goto err1;203203204204 ct = nf_ct_tmpl_alloc(par->net, info->zone, GFP_KERNEL);205205- ret = PTR_ERR(ct);206206- if (IS_ERR(ct))205205+ if (!ct) {206206+ ret = -ENOMEM;207207 goto err2;208208+ }208209209210 ret = 0;210211 if ((info->ct_events || info->exp_events) &&
+5
net/netlink/af_netlink.c
···1096109610971097 err = __netlink_insert(table, sk);10981098 if (err) {10991099+ /* In case the hashtable backend returns with -EBUSY11001100+ * from here, it must not escape to the caller.11011101+ */11021102+ if (unlikely(err == -EBUSY))11031103+ err = -EOVERFLOW;10991104 if (err == -EEXIST)11001105 err = -EADDRINUSE;11011106 nlk_sk(sk)->portid = 0;
···176176177177 /* check for all kinds of wrapping and the like */178178 start = (unsigned long)optval;179179- if (len < 0 || len + PAGE_SIZE - 1 < len || start + len < start) {179179+ if (len < 0 || len > INT_MAX - PAGE_SIZE + 1 || start + len < start) {180180 ret = -EINVAL;181181 goto out;182182 }
+2
net/sched/act_mirred.c
···101101 return ret;102102 ret = ACT_P_CREATED;103103 } else {104104+ if (bind)105105+ return 0;104106 if (!ovr) {105107 tcf_hash_release(a, bind);106108 return -EEXIST;
···406406 */407407 if (!security_module_enable("yama"))408408 return 0;409409+ yama_add_hooks();409410#endif410411 pr_info("Yama: becoming mindful.\n");411412
+3-2
sound/firewire/amdtp.c
···740740 s->data_block_counter != UINT_MAX)741741 data_block_counter = s->data_block_counter;742742743743- if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) && data_block_counter == 0) ||744744- (s->data_block_counter == UINT_MAX)) {743743+ if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) &&744744+ data_block_counter == s->tx_first_dbc) ||745745+ s->data_block_counter == UINT_MAX) {745746 lost = false;746747 } else if (!(s->flags & CIP_DBC_IS_END_EVENT)) {747748 lost = data_block_counter != s->data_block_counter;
+2
sound/firewire/amdtp.h
···157157158158 /* quirk: fixed interval of dbc between previos/current packets. */159159 unsigned int tx_dbc_interval;160160+ /* quirk: indicate the value of dbc field in a first packet. */161161+ unsigned int tx_first_dbc;160162161163 bool callbacked;162164 wait_queue_head_t callback_wait;
+8-2
sound/firewire/fireworks/fireworks.c
···248248 err = get_hardware_info(efw);249249 if (err < 0)250250 goto error;251251- if (entry->model_id == MODEL_ECHO_AUDIOFIRE_2)252252- efw->is_af2 = true;251251+ /* AudioFire8 (since 2009) and AudioFirePre8 */253252 if (entry->model_id == MODEL_ECHO_AUDIOFIRE_9)254253 efw->is_af9 = true;254254+ /* These models uses the same firmware. */255255+ if (entry->model_id == MODEL_ECHO_AUDIOFIRE_2 ||256256+ entry->model_id == MODEL_ECHO_AUDIOFIRE_4 ||257257+ entry->model_id == MODEL_ECHO_AUDIOFIRE_9 ||258258+ entry->model_id == MODEL_GIBSON_RIP ||259259+ entry->model_id == MODEL_GIBSON_GOLDTOP)260260+ efw->is_fireworks3 = true;255261256262 snd_efw_proc_init(efw);257263
+1-1
sound/firewire/fireworks/fireworks.h
···7070 bool resp_addr_changable;71717272 /* for quirks */7373- bool is_af2;7473 bool is_af9;7474+ bool is_fireworks3;7575 u32 firmware_version;76767777 unsigned int midi_in_ports;
+9-3
sound/firewire/fireworks/fireworks_stream.c
···172172 efw->tx_stream.flags |= CIP_DBC_IS_END_EVENT;173173 /* Fireworks reset dbc at bus reset. */174174 efw->tx_stream.flags |= CIP_SKIP_DBC_ZERO_CHECK;175175- /* AudioFire2 starts packets with non-zero dbc. */176176- if (efw->is_af2)177177- efw->tx_stream.flags |= CIP_SKIP_INIT_DBC_CHECK;175175+ /*176176+ * But Recent firmwares starts packets with non-zero dbc.177177+ * Driver version 5.7.6 installs firmware version 5.7.3.178178+ */179179+ if (efw->is_fireworks3 &&180180+ (efw->firmware_version == 0x5070000 ||181181+ efw->firmware_version == 0x5070300 ||182182+ efw->firmware_version == 0x5080000))183183+ efw->tx_stream.tx_first_dbc = 0x02;178184 /* AudioFire9 always reports wrong dbs. */179185 if (efw->is_af9)180186 efw->tx_stream.flags |= CIP_WRONG_DBS;
-6
sound/hda/ext/hdac_ext_controller.c
···44444545 offset = snd_hdac_chip_readl(bus, LLCH);46464747- if (offset < 0)4848- return -EIO;4949-5047 /* Lets walk the linked capabilities list */5148 do {5249 cur_cap = _snd_hdac_chip_read(l, bus, offset);5353-5454- if (cur_cap < 0)5555- return -EIO;56505751 dev_dbg(bus->dev, "Capability version: 0x%x\n",5852 ((cur_cap & AZX_CAP_HDR_VER_MASK) >> AZX_CAP_HDR_VER_OFF));
+1-1
sound/hda/ext/hdac_ext_stream.c
···299299 if (stream->direction != substream->stream)300300 continue;301301302302- if (stream->opened) {302302+ if (!stream->opened) {303303 if (!hstream->decoupled)304304 snd_hdac_ext_stream_decouple(ebus, hstream, true);305305 res = hstream;