···436436 encryption.437437 * ``tx_tls_ooo`` - number of TX packets which were part of a TLS stream438438 but did not arrive in the expected order.439439+ * ``tx_tls_skip_no_sync_data`` - number of TX packets which were part of440440+ a TLS stream and arrived out-of-order, but skipped the HW offload routine441441+ and went to the regular transmit flow as they were retransmissions of the442442+ connection handshake.439443 * ``tx_tls_drop_no_sync_data`` - number of TX packets which were part of440444 a TLS stream dropped, because they arrived out of order and associated441445 record could not be found.
+6
MAINTAINERS
···30603060R: Martin KaFai Lau <kafai@fb.com>30613061R: Song Liu <songliubraving@fb.com>30623062R: Yonghong Song <yhs@fb.com>30633063+R: Andrii Nakryiko <andriin@fb.com>30633064L: netdev@vger.kernel.org30643065L: bpf@vger.kernel.org30653066T: git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git···1053410533F: Documentation/core-api/boot-time-mm.rst10535105341053610535MEMORY MANAGEMENT1053610536+M: Andrew Morton <akpm@linux-foundation.org>1053710537L: linux-mm@kvack.org1053810538W: http://www.linux-mm.org1053910539+T: quilt https://ozlabs.org/~akpm/mmotm/1054010540+T: quilt https://ozlabs.org/~akpm/mmots/1054110541+T: git git://github.com/hnaz/linux-mm.git1053910542S: Maintained1054010543F: include/linux/mm.h1054110544F: include/linux/gfp.h···1805318048ZSWAP COMPRESSED SWAP CACHING1805418049M: Seth Jennings <sjenning@redhat.com>1805518050M: Dan Streetman <ddstreet@ieee.org>1805118051+M: Vitaly Wool <vitaly.wool@konsulko.com>1805618052L: linux-mm@kvack.org1805718053S: Maintained1805818054F: mm/zswap.c
···91919292static inline void kuap_update_sr(u32 sr, u32 addr, u32 end)9393{9494+ addr &= 0xf0000000; /* align addr to start of segment */9495 barrier(); /* make sure thread.kuap is updated before playing with SRs */9596 while (addr < end) {9697 mtsrin(sr, addr);
+3
arch/powerpc/include/asm/elf.h
···175175 ARCH_DLINFO_CACHE_GEOMETRY; \176176} while (0)177177178178+/* Relocate the kernel image to @final_address */179179+void relocate(unsigned long final_address);180180+178181#endif /* _ASM_POWERPC_ELF_H */
+13
arch/powerpc/kernel/prom_init.c
···32493249 /* Switch to secure mode. */32503250 prom_printf("Switching to secure mode.\n");3251325132523252+ /*32533253+ * The ultravisor will do an integrity check of the kernel image but we32543254+ * relocated it so the check will fail. Restore the original image by32553255+ * relocating it back to the kernel virtual base address.32563256+ */32573257+ if (IS_ENABLED(CONFIG_RELOCATABLE))32583258+ relocate(KERNELBASE);32593259+32523260 ret = enter_secure_mode(kbase, fdt);32613261+32623262+ /* Relocate the kernel again. */32633263+ if (IS_ENABLED(CONFIG_RELOCATABLE))32643264+ relocate(kbase);32653265+32533266 if (ret != U_SUCCESS) {32543267 prom_printf("Returned %d from switching to secure mode.\n", ret);32553268 prom_rtas_os_term("Switch to secure mode failed.\n");
···11421142 }1143114311441144 /*11451145+ * If we have seen a tail call, we need a second pass.11461146+ * This is because bpf_jit_emit_common_epilogue() is called11471147+ * from bpf_jit_emit_tail_call() with a not yet stable ctx->seen.11481148+ */11491149+ if (cgctx.seen & SEEN_TAILCALL) {11501150+ cgctx.idx = 0;11511151+ if (bpf_jit_build_body(fp, 0, &cgctx, addrs, false)) {11521152+ fp = org_fp;11531153+ goto out_addrs;11541154+ }11551155+ }11561156+11571157+ /*11451158 * Pretend to build prologue, given the features we've seen. This will11461159 * update ctgtx.idx as it pretends to output instructions, then we can11471160 * calculate total size from idx.
+1-1
arch/powerpc/platforms/powernv/eeh-powernv.c
···4242{4343 struct pci_dn *pdn = pci_get_pdn(pdev);44444545- if (eeh_has_flag(EEH_FORCE_DISABLED))4545+ if (!pdn || eeh_has_flag(EEH_FORCE_DISABLED))4646 return;47474848 dev_dbg(&pdev->dev, "EEH: Setting up device\n");
+37-16
arch/powerpc/platforms/powernv/smp.c
···146146 return 0;147147}148148149149+static void pnv_flush_interrupts(void)150150+{151151+ if (cpu_has_feature(CPU_FTR_ARCH_300)) {152152+ if (xive_enabled())153153+ xive_flush_interrupt();154154+ else155155+ icp_opal_flush_interrupt();156156+ } else {157157+ icp_native_flush_interrupt();158158+ }159159+}160160+149161static void pnv_smp_cpu_kill_self(void)150162{163163+ unsigned long srr1, unexpected_mask, wmask;151164 unsigned int cpu;152152- unsigned long srr1, wmask;153165 u64 lpcr_val;154166155167 /* Standard hot unplug procedure */156156- /*157157- * This hard disables local interurpts, ensuring we have no lazy158158- * irqs pending.159159- */160160- WARN_ON(irqs_disabled());161161- hard_irq_disable();162162- WARN_ON(lazy_irq_pending());163168164169 idle_task_exit();165170 current->active_mm = NULL; /* for sanity */···176171 wmask = SRR1_WAKEMASK;177172 if (cpu_has_feature(CPU_FTR_ARCH_207S))178173 wmask = SRR1_WAKEMASK_P8;174174+175175+ /*176176+ * This turns the irq soft-disabled state we're called with, into a177177+ * hard-disabled state with pending irq_happened interrupts cleared.178178+ *179179+ * PACA_IRQ_DEC - Decrementer should be ignored.180180+ * PACA_IRQ_HMI - Can be ignored, processing is done in real mode.181181+ * PACA_IRQ_DBELL, EE, PMI - Unexpected.182182+ */183183+ hard_irq_disable();184184+ if (generic_check_cpu_restart(cpu))185185+ goto out;186186+187187+ unexpected_mask = ~(PACA_IRQ_DEC | PACA_IRQ_HMI | PACA_IRQ_HARD_DIS);188188+ if (local_paca->irq_happened & unexpected_mask) {189189+ if (local_paca->irq_happened & PACA_IRQ_EE)190190+ pnv_flush_interrupts();191191+ DBG("CPU%d Unexpected exit while offline irq_happened=%lx!\n",192192+ cpu, local_paca->irq_happened);193193+ }194194+ local_paca->irq_happened = PACA_IRQ_HARD_DIS;179195180196 /*181197 * We don't want to take decrementer interrupts while we are···223197224198 srr1 = pnv_cpu_offline(cpu);225199200200+ WARN_ON_ONCE(!irqs_disabled());226201 WARN_ON(lazy_irq_pending());227202228203 /*···239212 */240213 if (((srr1 & wmask) == SRR1_WAKEEE) ||241214 ((srr1 & wmask) == SRR1_WAKEHVI)) {242242- if (cpu_has_feature(CPU_FTR_ARCH_300)) {243243- if (xive_enabled())244244- xive_flush_interrupt();245245- else246246- icp_opal_flush_interrupt();247247- } else248248- icp_native_flush_interrupt();215215+ pnv_flush_interrupts();249216 } else if ((srr1 & wmask) == SRR1_WAKEHDBELL) {250217 unsigned long msg = PPC_DBELL_TYPE(PPC_DBELL_SERVER);251218 asm volatile(PPC_MSGCLR(%0) : : "r" (msg));···287266 */288267 lpcr_val = mfspr(SPRN_LPCR) | (u64)LPCR_PECE1;289268 pnv_program_cpu_hotplug_lpcr(cpu, lpcr_val);290290-269269+out:291270 DBG("CPU%d coming online...\n", cpu);292271}293272
+1
arch/s390/include/asm/unwind.h
···3535 struct task_struct *task;3636 struct pt_regs *regs;3737 unsigned long sp, ip;3838+ bool reuse_sp;3839 int graph_idx;3940 bool reliable;4041 bool error;
+22-7
arch/s390/kernel/idle.c
···6969static ssize_t show_idle_time(struct device *dev,7070 struct device_attribute *attr, char *buf)7171{7272+ unsigned long long now, idle_time, idle_enter, idle_exit, in_idle;7273 struct s390_idle_data *idle = &per_cpu(s390_idle, dev->id);7373- unsigned long long now, idle_time, idle_enter, idle_exit;7474 unsigned int seq;75757676 do {7777- now = get_tod_clock();7877 seq = read_seqcount_begin(&idle->seqcount);7978 idle_time = READ_ONCE(idle->idle_time);8079 idle_enter = READ_ONCE(idle->clock_idle_enter);8180 idle_exit = READ_ONCE(idle->clock_idle_exit);8281 } while (read_seqcount_retry(&idle->seqcount, seq));8383- idle_time += idle_enter ? ((idle_exit ? : now) - idle_enter) : 0;8282+ in_idle = 0;8383+ now = get_tod_clock();8484+ if (idle_enter) {8585+ if (idle_exit) {8686+ in_idle = idle_exit - idle_enter;8787+ } else if (now > idle_enter) {8888+ in_idle = now - idle_enter;8989+ }9090+ }9191+ idle_time += in_idle;8492 return sprintf(buf, "%llu\n", idle_time >> 12);8593}8694DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL);···9688u64 arch_cpu_idle_time(int cpu)9789{9890 struct s390_idle_data *idle = &per_cpu(s390_idle, cpu);9999- unsigned long long now, idle_enter, idle_exit;9191+ unsigned long long now, idle_enter, idle_exit, in_idle;10092 unsigned int seq;1019310294 do {103103- now = get_tod_clock();10495 seq = read_seqcount_begin(&idle->seqcount);10596 idle_enter = READ_ONCE(idle->clock_idle_enter);10697 idle_exit = READ_ONCE(idle->clock_idle_exit);10798 } while (read_seqcount_retry(&idle->seqcount, seq));108108-109109- return cputime_to_nsecs(idle_enter ? ((idle_exit ?: now) - idle_enter) : 0);9999+ in_idle = 0;100100+ now = get_tod_clock();101101+ if (idle_enter) {102102+ if (idle_exit) {103103+ in_idle = idle_exit - idle_enter;104104+ } else if (now > idle_enter) {105105+ in_idle = now - idle_enter;106106+ }107107+ }108108+ return cputime_to_nsecs(in_idle);110109}111110112111void arch_cpu_idle_enter(void)
+13-5
arch/s390/kernel/unwind_bc.c
···46464747 regs = state->regs;4848 if (unlikely(regs)) {4949- sp = READ_ONCE_NOCHECK(regs->gprs[15]);5050- if (unlikely(outside_of_stack(state, sp))) {5151- if (!update_stack_info(state, sp))5252- goto out_err;4949+ if (state->reuse_sp) {5050+ sp = state->sp;5151+ state->reuse_sp = false;5252+ } else {5353+ sp = READ_ONCE_NOCHECK(regs->gprs[15]);5454+ if (unlikely(outside_of_stack(state, sp))) {5555+ if (!update_stack_info(state, sp))5656+ goto out_err;5757+ }5358 }5459 sf = (struct stack_frame *) sp;5560 ip = READ_ONCE_NOCHECK(sf->gprs[8]);···112107{113108 struct stack_info *info = &state->stack_info;114109 unsigned long *mask = &state->stack_mask;110110+ bool reliable, reuse_sp;115111 struct stack_frame *sf;116112 unsigned long ip;117117- bool reliable;118113119114 memset(state, 0, sizeof(*state));120115 state->task = task;···139134 if (regs) {140135 ip = READ_ONCE_NOCHECK(regs->psw.addr);141136 reliable = true;137137+ reuse_sp = true;142138 } else {143139 sf = (struct stack_frame *) sp;144140 ip = READ_ONCE_NOCHECK(sf->gprs[8]);145141 reliable = false;142142+ reuse_sp = false;146143 }147144148145#ifdef CONFIG_FUNCTION_GRAPH_TRACER···158151 state->sp = sp;159152 state->ip = ip;160153 state->reliable = reliable;154154+ state->reuse_sp = reuse_sp;161155}162156EXPORT_SYMBOL_GPL(__unwind_start);
+6-6
arch/s390/mm/cmm.c
···298298 }299299300300 if (write) {301301- len = *lenp;302302- if (copy_from_user(buf, buffer,303303- len > sizeof(buf) ? sizeof(buf) : len))301301+ len = min(*lenp, sizeof(buf));302302+ if (copy_from_user(buf, buffer, len))304303 return -EFAULT;305305- buf[sizeof(buf) - 1] = '\0';304304+ buf[len - 1] = '\0';306305 cmm_skip_blanks(buf, &p);307306 nr = simple_strtoul(p, &p, 0);308307 cmm_skip_blanks(p, &p);309308 seconds = simple_strtoul(p, &p, 0);310309 cmm_set_timeout(nr, seconds);310310+ *ppos += *lenp;311311 } else {312312 len = sprintf(buf, "%ld %ld\n",313313 cmm_timeout_pages, cmm_timeout_seconds);···315315 len = *lenp;316316 if (copy_to_user(buffer, buf, len))317317 return -EFAULT;318318+ *lenp = len;319319+ *ppos += len;318320 }319319- *lenp = len;320320- *ppos += len;321321 return 0;322322}323323
+8-5
block/blk-cgroup.c
···934934 int i;935935 bool has_stats = false;936936937937+ spin_lock_irq(&blkg->q->queue_lock);938938+939939+ if (!blkg->online)940940+ goto skip;941941+937942 dname = blkg_dev_name(blkg);938943 if (!dname)939939- continue;944944+ goto skip;940945941946 /*942947 * Hooray string manipulation, count is the size written NOT···950945 * the \0 so we only add count to buf.951946 */952947 off += scnprintf(buf+off, size-off, "%s ", dname);953953-954954- spin_lock_irq(&blkg->q->queue_lock);955948956949 blkg_rwstat_recursive_sum(blkg, NULL,957950 offsetof(struct blkcg_gq, stat_bytes), &rwstat);···962959 rios = rwstat.cnt[BLKG_RWSTAT_READ];963960 wios = rwstat.cnt[BLKG_RWSTAT_WRITE];964961 dios = rwstat.cnt[BLKG_RWSTAT_DISCARD];965965-966966- spin_unlock_irq(&blkg->q->queue_lock);967962968963 if (rbytes || wbytes || rios || wios) {969964 has_stats = true;···1000999 seq_commit(sf, -1);10011000 }10021001 }10021002+ skip:10031003+ spin_unlock_irq(&blkg->q->queue_lock);10031004 }1004100510051006 rcu_read_unlock();
-1
drivers/block/drbd/drbd_main.c
···786786787787 if (nc->tentative && connection->agreed_pro_version < 92) {788788 rcu_read_unlock();789789- mutex_unlock(&sock->mutex);790789 drbd_err(connection, "--dry-run is not supported by peer");791790 return -EOPNOTSUPP;792791 }
+4-1
drivers/clk/at91/clk-main.c
···297297 regmap_read(regmap, AT91_CKGR_MCFR, &mcfr);298298 if (mcfr & AT91_PMC_MAINRDY)299299 return 0;300300- usleep_range(MAINF_LOOP_MIN_WAIT, MAINF_LOOP_MAX_WAIT);300300+ if (system_state < SYSTEM_RUNNING)301301+ udelay(MAINF_LOOP_MIN_WAIT);302302+ else303303+ usleep_range(MAINF_LOOP_MIN_WAIT, MAINF_LOOP_MAX_WAIT);301304 } while (time_before(prep_time, timeout));302305303306 return -ETIMEDOUT;
···266266267267 /* Enable clock */268268 if (gate->flags & CLK_GATE_SET_TO_DISABLE) {269269- regmap_write(gate->map, get_clock_reg(gate), clk);270270- } else {271271- /* Use set to clear register */269269+ /* Clock is clear to enable, so use set to clear register */272270 regmap_write(gate->map, get_clock_reg(gate) + 0x04, clk);271271+ } else {272272+ /* Clock is set to enable, so use write to set register */273273+ regmap_write(gate->map, get_clock_reg(gate), clk);273274 }274275275276 if (gate->reset_idx >= 0) {
···174174 struct clk_init_data init = { NULL };175175 const char **parent_names = NULL;176176 struct clk *clk;177177- int ret;178177179178 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);180179 if (!clk_hw) {···206207 clk = ti_clk_register(NULL, &clk_hw->hw, node->name);207208208209 if (!IS_ERR(clk)) {209209- ret = ti_clk_add_alias(NULL, clk, node->name);210210- if (ret) {211211- clk_unregister(clk);212212- goto cleanup;213213- }214210 of_clk_add_provider(node, of_clk_src_simple_get, clk);215211 kfree(parent_names);216212 return;
+3-2
drivers/clk/ti/clkctrl.c
···100100 * can be from a timer that requires pm_runtime access, which101101 * will eventually bring us here with timekeeping_suspended,102102 * during both suspend entry and resume paths. This happens103103- * at least on am43xx platform.103103+ * at least on am43xx platform. Account for flakeyness104104+ * with udelay() by multiplying the timeout value by 2.104105 */105106 if (unlikely(_early_timeout || timekeeping_suspended)) {106107 if (time->cycles++ < timeout) {107107- udelay(1);108108+ udelay(1 * 2);108109 return false;109110 }110111 } else {
+1-3
drivers/cpufreq/intel_pstate.c
···847847 value |= HWP_MAX_PERF(min_perf);848848 value |= HWP_MIN_PERF(min_perf);849849850850- /* Set EPP/EPB to min */850850+ /* Set EPP to min */851851 if (boot_cpu_has(X86_FEATURE_HWP_EPP))852852 value |= HWP_ENERGY_PERF_PREFERENCE(HWP_EPP_POWERSAVE);853853- else854854- intel_pstate_set_epb(cpu, HWP_EPP_BALANCE_POWERSAVE);855853856854 wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value);857855}
···604604 continue;605605 }606606607607- for (i = 0; i < num_entities; i++)607607+ for (i = 0; i < num_entities; i++) {608608+ mutex_lock(&ctx->adev->lock_reset);608609 drm_sched_entity_fini(&ctx->entities[0][i].entity);610610+ mutex_unlock(&ctx->adev->lock_reset);611611+ }609612 }610613}611614
+7
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
···28852885 DRM_INFO("amdgpu: acceleration disabled, skipping benchmarks\n");28862886 }2887288728882888+ /*28892889+ * Register gpu instance before amdgpu_device_enable_mgpu_fan_boost.28902890+ * Otherwise the mgpu fan boost feature will be skipped due to the28912891+ * gpu instance is counted less.28922892+ */28932893+ amdgpu_register_gpu_instance(adev);28942894+28882895 /* enable clockgating, etc. after ib tests, etc. since some blocks require28892896 * explicit gating rather than handling it automatically.28902897 */
···27672767 CONTROLLER_DP_TEST_PATTERN_VIDEOMODE,27682768 COLOR_DEPTH_UNDEFINED);2769276927702770- /* This second call is needed to reconfigure the DIG27712771- * as a workaround for the incorrect value being applied27722772- * from transmitter control.27732773- */27742774- if (!dc_is_virtual_signal(pipe_ctx->stream->signal))27752775- stream->link->link_enc->funcs->setup(27762776- stream->link->link_enc,27772777- pipe_ctx->stream->signal);27782778-27792770#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT27802771 if (pipe_ctx->stream->timing.flags.DSC) {27812772 if (dc_is_dp_signal(pipe_ctx->stream->signal) ||
···15811581{15821582 struct drm_device *dev = old_state->dev;15831583 const struct drm_mode_config_helper_funcs *funcs;15841584+ struct drm_crtc_state *new_crtc_state;15851585+ struct drm_crtc *crtc;15841586 ktime_t start;15851587 s64 commit_time_ms;15881588+ unsigned int i, new_self_refresh_mask = 0;1586158915871590 funcs = dev->mode_config.helper_private;15881591···1605160216061603 drm_atomic_helper_wait_for_dependencies(old_state);1607160416051605+ /*16061606+ * We cannot safely access new_crtc_state after16071607+ * drm_atomic_helper_commit_hw_done() so figure out which crtc's have16081608+ * self-refresh active beforehand:16091609+ */16101610+ for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i)16111611+ if (new_crtc_state->self_refresh_active)16121612+ new_self_refresh_mask |= BIT(i);16131613+16081614 if (funcs && funcs->atomic_commit_tail)16091615 funcs->atomic_commit_tail(old_state);16101616 else···16221610 commit_time_ms = ktime_ms_delta(ktime_get(), start);16231611 if (commit_time_ms > 0)16241612 drm_self_refresh_helper_update_avg_times(old_state,16251625- (unsigned long)commit_time_ms);16131613+ (unsigned long)commit_time_ms,16141614+ new_self_refresh_mask);1626161516271616 drm_atomic_helper_commit_cleanup_done(old_state);16281617
+11-7
drivers/gpu/drm/drm_self_refresh_helper.c
···133133 * drm_self_refresh_helper_update_avg_times - Updates a crtc's SR time averages134134 * @state: the state which has just been applied to hardware135135 * @commit_time_ms: the amount of time in ms that this commit took to complete136136+ * @new_self_refresh_mask: bitmask of crtc's that have self_refresh_active in137137+ * new state136138 *137139 * Called after &drm_mode_config_funcs.atomic_commit_tail, this function will138140 * update the average entry/exit self refresh times on self refresh transitions.139141 * These averages will be used when calculating how long to delay before140142 * entering self refresh mode after activity.141143 */142142-void drm_self_refresh_helper_update_avg_times(struct drm_atomic_state *state,143143- unsigned int commit_time_ms)144144+void145145+drm_self_refresh_helper_update_avg_times(struct drm_atomic_state *state,146146+ unsigned int commit_time_ms,147147+ unsigned int new_self_refresh_mask)144148{145149 struct drm_crtc *crtc;146146- struct drm_crtc_state *old_crtc_state, *new_crtc_state;150150+ struct drm_crtc_state *old_crtc_state;147151 int i;148152149149- for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,150150- new_crtc_state, i) {153153+ for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) {154154+ bool new_self_refresh_active = new_self_refresh_mask & BIT(i);151155 struct drm_self_refresh_data *sr_data = crtc->self_refresh_data;152156 struct ewma_psr_time *time;153157154158 if (old_crtc_state->self_refresh_active ==155155- new_crtc_state->self_refresh_active)159159+ new_self_refresh_active)156160 continue;157161158158- if (new_crtc_state->self_refresh_active)162162+ if (new_self_refresh_active)159163 time = &sr_data->entry_avg_ms;160164 else161165 time = &sr_data->exit_avg_ms;
+7
drivers/gpu/drm/i915/display/intel_crt.c
···864864865865out:866866 intel_display_power_put(dev_priv, intel_encoder->power_domain, wakeref);867867+868868+ /*869869+ * Make sure the refs for power wells enabled during detect are870870+ * dropped to avoid a new detect cycle triggered by HPD polling.871871+ */872872+ intel_display_power_flush_work(dev_priv);873873+867874 return status;868875}869876
+11-1
drivers/gpu/drm/i915/display/intel_dp.c
···12561256 u32 unused)12571257{12581258 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);12591259+ struct drm_i915_private *i915 =12601260+ to_i915(intel_dig_port->base.base.dev);12611261+ enum phy phy = intel_port_to_phy(i915, intel_dig_port->base.port);12591262 u32 ret;1260126312611264 ret = DP_AUX_CH_CTL_SEND_BUSY |···12711268 DP_AUX_CH_CTL_FW_SYNC_PULSE_SKL(32) |12721269 DP_AUX_CH_CTL_SYNC_PULSE_SKL(32);1273127012741274- if (intel_dig_port->tc_mode == TC_PORT_TBT_ALT)12711271+ if (intel_phy_is_tc(i915, phy) &&12721272+ intel_dig_port->tc_mode == TC_PORT_TBT_ALT)12751273 ret |= DP_AUX_CH_CTL_TBT_IO;1276127412771275 return ret;···54395435out:54405436 if (status != connector_status_connected && !intel_dp->is_mst)54415437 intel_dp_unset_edid(intel_dp);54385438+54395439+ /*54405440+ * Make sure the refs for power wells enabled during detect are54415441+ * dropped to avoid a new detect cycle triggered by HPD polling.54425442+ */54435443+ intel_display_power_flush_work(dev_priv);5442544454435445 return status;54445446}
+6
drivers/gpu/drm/i915/display/intel_hdmi.c
···25652565 if (status != connector_status_connected)25662566 cec_notifier_phys_addr_invalidate(intel_hdmi->cec_notifier);2567256725682568+ /*25692569+ * Make sure the refs for power wells enabled during detect are25702570+ * dropped to avoid a new detect cycle triggered by HPD polling.25712571+ */25722572+ intel_display_power_flush_work(dev_priv);25732573+25682574 return status;25692575}25702576
+1
drivers/gpu/drm/radeon/si_dpm.c
···19581958 case 0x682C:19591959 si_pi->cac_weights = cac_weights_cape_verde_pro;19601960 si_pi->dte_data = dte_data_sun_xt;19611961+ update_dte_from_pl2 = true;19611962 break;19621963 case 0x6825:19631964 case 0x6827:
+4
drivers/hid/i2c-hid/i2c-hid-core.c
···447447 if (ret) {448448 dev_err(&client->dev, "failed to reset device.\n");449449 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);450450+ goto out_unlock;450451 }452452+453453+ /* At least some SIS devices need this after reset */454454+ ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);451455452456out_unlock:453457 mutex_unlock(&ihid->reset_lock);
+15
drivers/hid/wacom.h
···202202 }203203}204204205205+/*206206+ * Convert a signed 32-bit integer to an unsigned n-bit integer. Undoes207207+ * the normally-helpful work of 'hid_snto32' for fields that use signed208208+ * ranges for questionable reasons.209209+ */210210+static inline __u32 wacom_s32tou(s32 value, __u8 n)211211+{212212+ switch (n) {213213+ case 8: return ((__u8)value);214214+ case 16: return ((__u16)value);215215+ case 32: return ((__u32)value);216216+ }217217+ return value & (1 << (n - 1)) ? value & (~(~0U << n)) : value;218218+}219219+205220extern const struct hid_device_id wacom_ids[];206221207222void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
+6-4
drivers/hid/wacom_wac.c
···23032303 case HID_DG_TOOLSERIALNUMBER:23042304 if (value) {23052305 wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL);23062306- wacom_wac->serial[0] |= (__u32)value;23062306+ wacom_wac->serial[0] |= wacom_s32tou(value, field->report_size);23072307 }23082308 return;23092309 case HID_DG_TWIST:···23192319 return;23202320 case WACOM_HID_WD_SERIALHI:23212321 if (value) {23222322+ __u32 raw_value = wacom_s32tou(value, field->report_size);23232323+23222324 wacom_wac->serial[0] = (wacom_wac->serial[0] & 0xFFFFFFFF);23232323- wacom_wac->serial[0] |= ((__u64)value) << 32;23252325+ wacom_wac->serial[0] |= ((__u64)raw_value) << 32;23242326 /*23252327 * Non-USI EMR devices may contain additional tool type23262328 * information here. See WACOM_HID_WD_TOOLTYPE case for23272329 * more details.23282330 */23292331 if (value >> 20 == 1) {23302330- wacom_wac->id[0] |= value & 0xFFFFF;23322332+ wacom_wac->id[0] |= raw_value & 0xFFFFF;23312333 }23322334 }23332335 return;···23412339 * bitwise OR so the complete value can be built23422340 * up over time :(23432341 */23442344- wacom_wac->id[0] |= value;23422342+ wacom_wac->id[0] |= wacom_s32tou(value, field->report_size);23452343 return;23462344 case WACOM_HID_WD_OFFSETLEFT:23472345 if (features->offset_left && value != features->offset_left)
+1-1
drivers/hwmon/ina3221.c
···170170171171 /* Polling the CVRF bit to make sure read data is ready */172172 return regmap_field_read_poll_timeout(ina->fields[F_CVRF],173173- cvrf, cvrf, wait, 100000);173173+ cvrf, cvrf, wait, wait * 2);174174}175175176176static int ina3221_read_value(struct ina3221_data *ina, unsigned int reg,
+12-3
drivers/hwmon/nct7904.c
···8282#define FANCTL1_FMR_REG 0x00 /* Bank 3; 1 reg per channel */8383#define FANCTL1_OUT_REG 0x10 /* Bank 3; 1 reg per channel */84848585+#define VOLT_MONITOR_MODE 0x08686+#define THERMAL_DIODE_MODE 0x18787+#define THERMISTOR_MODE 0x38888+8589#define ENABLE_TSI BIT(1)86908791static const unsigned short normal_i2c[] = {···939935 for (i = 0; i < 4; i++) {940936 val = (ret >> (i * 2)) & 0x03;941937 bit = (1 << i);942942- if (val == 0) {938938+ if (val == VOLT_MONITOR_MODE) {943939 data->tcpu_mask &= ~bit;940940+ } else if (val == THERMAL_DIODE_MODE && i < 2) {941941+ data->temp_mode |= bit;942942+ data->vsen_mask &= ~(0x06 << (i * 2));943943+ } else if (val == THERMISTOR_MODE) {944944+ data->vsen_mask &= ~(0x02 << (i * 2));944945 } else {945945- if (val == 0x1 || val == 0x2)946946- data->temp_mode |= bit;946946+ /* Reserved */947947+ data->tcpu_mask &= ~bit;947948 data->vsen_mask &= ~(0x06 << (i * 2));948949 }949950 }
+22-22
drivers/net/bonding/bond_main.c
···21282128 ignore_updelay = !rcu_dereference(bond->curr_active_slave);2129212921302130 bond_for_each_slave_rcu(bond, slave, iter) {21312131- slave->new_link = BOND_LINK_NOCHANGE;21322132- slave->link_new_state = slave->link;21312131+ bond_propose_link_state(slave, BOND_LINK_NOCHANGE);2133213221342133 link_state = bond_check_dev_link(bond, slave->dev, 0);21352134···21622163 }2163216421642165 if (slave->delay <= 0) {21652165- slave->new_link = BOND_LINK_DOWN;21662166+ bond_propose_link_state(slave, BOND_LINK_DOWN);21662167 commit++;21672168 continue;21682169 }···21992200 slave->delay = 0;2200220122012202 if (slave->delay <= 0) {22022202- slave->new_link = BOND_LINK_UP;22032203+ bond_propose_link_state(slave, BOND_LINK_UP);22032204 commit++;22042205 ignore_updelay = false;22052206 continue;···22372238 struct slave *slave, *primary;2238223922392240 bond_for_each_slave(bond, slave, iter) {22402240- switch (slave->new_link) {22412241+ switch (slave->link_new_state) {22412242 case BOND_LINK_NOCHANGE:22422243 /* For 802.3ad mode, check current slave speed and22432244 * duplex again in case its port was disabled after···2309231023102311 default:23112312 slave_err(bond->dev, slave->dev, "invalid new link %d on slave\n",23122312- slave->new_link);23132313- slave->new_link = BOND_LINK_NOCHANGE;23132313+ slave->link_new_state);23142314+ bond_propose_link_state(slave, BOND_LINK_NOCHANGE);2314231523152316 continue;23162317 }···27182719 bond_for_each_slave_rcu(bond, slave, iter) {27192720 unsigned long trans_start = dev_trans_start(slave->dev);2720272127212721- slave->new_link = BOND_LINK_NOCHANGE;27222722+ bond_propose_link_state(slave, BOND_LINK_NOCHANGE);2722272327232724 if (slave->link != BOND_LINK_UP) {27242725 if (bond_time_in_interval(bond, trans_start, 1) &&27252726 bond_time_in_interval(bond, slave->last_rx, 1)) {2726272727272727- slave->new_link = BOND_LINK_UP;27282728+ bond_propose_link_state(slave, BOND_LINK_UP);27282729 slave_state_changed = 1;2729273027302731 /* primary_slave has no meaning in round-robin···27492750 if (!bond_time_in_interval(bond, trans_start, 2) ||27502751 !bond_time_in_interval(bond, slave->last_rx, 2)) {2751275227522752- slave->new_link = BOND_LINK_DOWN;27532753+ bond_propose_link_state(slave, BOND_LINK_DOWN);27532754 slave_state_changed = 1;2754275527552756 if (slave->link_failure_count < UINT_MAX)···27802781 goto re_arm;2781278227822783 bond_for_each_slave(bond, slave, iter) {27832783- if (slave->new_link != BOND_LINK_NOCHANGE)27842784- slave->link = slave->new_link;27842784+ if (slave->link_new_state != BOND_LINK_NOCHANGE)27852785+ slave->link = slave->link_new_state;27852786 }2786278727872788 if (slave_state_changed) {···28042805}2805280628062807/* Called to inspect slaves for active-backup mode ARP monitor link state28072807- * changes. Sets new_link in slaves to specify what action should take28082808- * place for the slave. Returns 0 if no changes are found, >0 if changes28092809- * to link states must be committed.28082808+ * changes. Sets proposed link state in slaves to specify what action28092809+ * should take place for the slave. Returns 0 if no changes are found, >028102810+ * if changes to link states must be committed.28102811 *28112812 * Called with rcu_read_lock held.28122813 */···28182819 int commit = 0;2819282028202821 bond_for_each_slave_rcu(bond, slave, iter) {28212821- slave->new_link = BOND_LINK_NOCHANGE;28222822+ bond_propose_link_state(slave, BOND_LINK_NOCHANGE);28222823 last_rx = slave_last_rx(bond, slave);2823282428242825 if (slave->link != BOND_LINK_UP) {28252826 if (bond_time_in_interval(bond, last_rx, 1)) {28262826- slave->new_link = BOND_LINK_UP;28272827+ bond_propose_link_state(slave, BOND_LINK_UP);28272828 commit++;28282829 }28292830 continue;···28512852 if (!bond_is_active_slave(slave) &&28522853 !rcu_access_pointer(bond->current_arp_slave) &&28532854 !bond_time_in_interval(bond, last_rx, 3)) {28542854- slave->new_link = BOND_LINK_DOWN;28552855+ bond_propose_link_state(slave, BOND_LINK_DOWN);28552856 commit++;28562857 }28572858···28642865 if (bond_is_active_slave(slave) &&28652866 (!bond_time_in_interval(bond, trans_start, 2) ||28662867 !bond_time_in_interval(bond, last_rx, 2))) {28672867- slave->new_link = BOND_LINK_DOWN;28682868+ bond_propose_link_state(slave, BOND_LINK_DOWN);28682869 commit++;28692870 }28702871 }···28842885 struct slave *slave;2885288628862887 bond_for_each_slave(bond, slave, iter) {28872887- switch (slave->new_link) {28882888+ switch (slave->link_new_state) {28882889 case BOND_LINK_NOCHANGE:28892890 continue;28902891···29342935 continue;2935293629362937 default:29372937- slave_err(bond->dev, slave->dev, "impossible: new_link %d on slave\n",29382938- slave->new_link);29382938+ slave_err(bond->dev, slave->dev,29392939+ "impossible: link_new_state %d on slave\n",29402940+ slave->link_new_state);29392941 continue;29402942 }29412943
+64-7
drivers/net/can/c_can/c_can.c
···5252#define CONTROL_EX_PDR BIT(8)53535454/* control register */5555+#define CONTROL_SWR BIT(15)5556#define CONTROL_TEST BIT(7)5657#define CONTROL_CCE BIT(6)5758#define CONTROL_DISABLE_AR BIT(5)···9796#define BTR_TSEG1_MASK (0xf << BTR_TSEG1_SHIFT)9897#define BTR_TSEG2_SHIFT 129998#define BTR_TSEG2_MASK (0x7 << BTR_TSEG2_SHIFT)9999+100100+/* interrupt register */101101+#define INT_STS_PENDING 0x8000100102101103/* brp extension register */102104#define BRP_EXT_BRPE_MASK 0x0f···573569 IF_MCONT_RCV_EOB);574570}575571572572+static int c_can_software_reset(struct net_device *dev)573573+{574574+ struct c_can_priv *priv = netdev_priv(dev);575575+ int retry = 0;576576+577577+ if (priv->type != BOSCH_D_CAN)578578+ return 0;579579+580580+ priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_SWR | CONTROL_INIT);581581+ while (priv->read_reg(priv, C_CAN_CTRL_REG) & CONTROL_SWR) {582582+ msleep(20);583583+ if (retry++ > 100) {584584+ netdev_err(dev, "CCTRL: software reset failed\n");585585+ return -EIO;586586+ }587587+ }588588+589589+ return 0;590590+}591591+576592/*577593 * Configure C_CAN chip:578594 * - enable/disable auto-retransmission···602578static int c_can_chip_config(struct net_device *dev)603579{604580 struct c_can_priv *priv = netdev_priv(dev);581581+ int err;582582+583583+ err = c_can_software_reset(dev);584584+ if (err)585585+ return err;605586606587 /* enable automatic retransmission */607588 priv->write_reg(priv, C_CAN_CTRL_REG, CONTROL_ENABLE_AR);···915886 struct can_berr_counter bec;916887917888 switch (error_type) {889889+ case C_CAN_NO_ERROR:890890+ priv->can.state = CAN_STATE_ERROR_ACTIVE;891891+ break;918892 case C_CAN_ERROR_WARNING:919893 /* error warning state */920894 priv->can.can_stats.error_warning++;···948916 ERR_CNT_RP_SHIFT;949917950918 switch (error_type) {919919+ case C_CAN_NO_ERROR:920920+ /* error warning state */921921+ cf->can_id |= CAN_ERR_CRTL;922922+ cf->data[1] = CAN_ERR_CRTL_ACTIVE;923923+ cf->data[6] = bec.txerr;924924+ cf->data[7] = bec.rxerr;925925+ break;951926 case C_CAN_ERROR_WARNING:952927 /* error warning state */953928 cf->can_id |= CAN_ERR_CRTL;···10681029 u16 curr, last = priv->last_status;10691030 int work_done = 0;1070103110711071- priv->last_status = curr = priv->read_reg(priv, C_CAN_STS_REG);10721072- /* Ack status on C_CAN. D_CAN is self clearing */10731073- if (priv->type != BOSCH_D_CAN)10741074- priv->write_reg(priv, C_CAN_STS_REG, LEC_UNUSED);10321032+ /* Only read the status register if a status interrupt was pending */10331033+ if (atomic_xchg(&priv->sie_pending, 0)) {10341034+ priv->last_status = curr = priv->read_reg(priv, C_CAN_STS_REG);10351035+ /* Ack status on C_CAN. D_CAN is self clearing */10361036+ if (priv->type != BOSCH_D_CAN)10371037+ priv->write_reg(priv, C_CAN_STS_REG, LEC_UNUSED);10381038+ } else {10391039+ /* no change detected ... */10401040+ curr = last;10411041+ }1075104210761043 /* handle state changes */10771044 if ((curr & STATUS_EWARN) && (!(last & STATUS_EWARN))) {···10991054 /* handle bus recovery events */11001055 if ((!(curr & STATUS_BOFF)) && (last & STATUS_BOFF)) {11011056 netdev_dbg(dev, "left bus off state\n");11021102- priv->can.state = CAN_STATE_ERROR_ACTIVE;10571057+ work_done += c_can_handle_state_change(dev, C_CAN_ERROR_PASSIVE);11031058 }10591059+11041060 if ((!(curr & STATUS_EPASS)) && (last & STATUS_EPASS)) {11051061 netdev_dbg(dev, "left error passive state\n");11061106- priv->can.state = CAN_STATE_ERROR_ACTIVE;10621062+ work_done += c_can_handle_state_change(dev, C_CAN_ERROR_WARNING);10631063+ }10641064+10651065+ if ((!(curr & STATUS_EWARN)) && (last & STATUS_EWARN)) {10661066+ netdev_dbg(dev, "left error warning state\n");10671067+ work_done += c_can_handle_state_change(dev, C_CAN_NO_ERROR);11071068 }1108106911091070 /* handle lec errors on the bus */···11341083{11351084 struct net_device *dev = (struct net_device *)dev_id;11361085 struct c_can_priv *priv = netdev_priv(dev);10861086+ int reg_int;1137108711381138- if (!priv->read_reg(priv, C_CAN_INT_REG))10881088+ reg_int = priv->read_reg(priv, C_CAN_INT_REG);10891089+ if (!reg_int)11391090 return IRQ_NONE;10911091+10921092+ /* save for later use */10931093+ if (reg_int & INT_STS_PENDING)10941094+ atomic_set(&priv->sie_pending, 1);1140109511411096 /* disable all interrupts and schedule the NAPI */11421097 c_can_irq_control(priv, false);
···848848 return;849849850850 ret = of_property_read_u32(dn, "max-bitrate", &priv->bitrate_max);851851+ of_node_put(dn);851852 if ((ret && ret != -EINVAL) || (!ret && !priv->bitrate_max))852853 netdev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit.\n");853854}
···107107 return cb_b->timestamp - cb_a->timestamp;108108}109109110110-static struct sk_buff *can_rx_offload_offload_one(struct can_rx_offload *offload, unsigned int n)110110+/**111111+ * can_rx_offload_offload_one() - Read one CAN frame from HW112112+ * @offload: pointer to rx_offload context113113+ * @n: number of mailbox to read114114+ *115115+ * The task of this function is to read a CAN frame from mailbox @n116116+ * from the device and return the mailbox's content as a struct117117+ * sk_buff.118118+ *119119+ * If the struct can_rx_offload::skb_queue exceeds the maximal queue120120+ * length (struct can_rx_offload::skb_queue_len_max) or no skb can be121121+ * allocated, the mailbox contents is discarded by reading it into an122122+ * overflow buffer. This way the mailbox is marked as free by the123123+ * driver.124124+ *125125+ * Return: A pointer to skb containing the CAN frame on success.126126+ *127127+ * NULL if the mailbox @n is empty.128128+ *129129+ * ERR_PTR() in case of an error130130+ */131131+static struct sk_buff *132132+can_rx_offload_offload_one(struct can_rx_offload *offload, unsigned int n)111133{112112- struct sk_buff *skb = NULL;134134+ struct sk_buff *skb = NULL, *skb_error = NULL;113135 struct can_rx_offload_cb *cb;114136 struct can_frame *cf;115137 int ret;116138117117- /* If queue is full or skb not available, read to discard mailbox */118118- if (likely(skb_queue_len(&offload->skb_queue) <=119119- offload->skb_queue_len_max))139139+ if (likely(skb_queue_len(&offload->skb_queue) <140140+ offload->skb_queue_len_max)) {120141 skb = alloc_can_skb(offload->dev, &cf);142142+ if (unlikely(!skb))143143+ skb_error = ERR_PTR(-ENOMEM); /* skb alloc failed */144144+ } else {145145+ skb_error = ERR_PTR(-ENOBUFS); /* skb_queue is full */146146+ }121147122122- if (!skb) {148148+ /* If queue is full or skb not available, drop by reading into149149+ * overflow buffer.150150+ */151151+ if (unlikely(skb_error)) {123152 struct can_frame cf_overflow;124153 u32 timestamp;125154126155 ret = offload->mailbox_read(offload, &cf_overflow,127156 ×tamp, n);128128- if (ret)129129- offload->dev->stats.rx_dropped++;130157131131- return NULL;158158+ /* Mailbox was empty. */159159+ if (unlikely(!ret))160160+ return NULL;161161+162162+ /* Mailbox has been read and we're dropping it or163163+ * there was a problem reading the mailbox.164164+ *165165+ * Increment error counters in any case.166166+ */167167+ offload->dev->stats.rx_dropped++;168168+ offload->dev->stats.rx_fifo_errors++;169169+170170+ /* There was a problem reading the mailbox, propagate171171+ * error value.172172+ */173173+ if (unlikely(ret < 0))174174+ return ERR_PTR(ret);175175+176176+ return skb_error;132177 }133178134179 cb = can_rx_offload_get_cb(skb);135180 ret = offload->mailbox_read(offload, cf, &cb->timestamp, n);136136- if (!ret) {181181+182182+ /* Mailbox was empty. */183183+ if (unlikely(!ret)) {137184 kfree_skb(skb);138185 return NULL;139186 }140187188188+ /* There was a problem reading the mailbox, propagate error value. */189189+ if (unlikely(ret < 0)) {190190+ kfree_skb(skb);191191+192192+ offload->dev->stats.rx_dropped++;193193+ offload->dev->stats.rx_fifo_errors++;194194+195195+ return ERR_PTR(ret);196196+ }197197+198198+ /* Mailbox was read. */141199 return skb;142200}143201···215157 continue;216158217159 skb = can_rx_offload_offload_one(offload, i);218218- if (!skb)219219- break;160160+ if (IS_ERR_OR_NULL(skb))161161+ continue;220162221163 __skb_queue_add_sort(&skb_queue, skb, can_rx_offload_compare);222164 }···246188 struct sk_buff *skb;247189 int received = 0;248190249249- while ((skb = can_rx_offload_offload_one(offload, 0))) {191191+ while (1) {192192+ skb = can_rx_offload_offload_one(offload, 0);193193+ if (IS_ERR(skb))194194+ continue;195195+ if (!skb)196196+ break;197197+250198 skb_queue_tail(&offload->skb_queue, skb);251199 received++;252200 }···271207 unsigned long flags;272208273209 if (skb_queue_len(&offload->skb_queue) >274274- offload->skb_queue_len_max)275275- return -ENOMEM;210210+ offload->skb_queue_len_max) {211211+ kfree_skb(skb);212212+ return -ENOBUFS;213213+ }276214277215 cb = can_rx_offload_get_cb(skb);278216 cb->timestamp = timestamp;···316250 struct sk_buff *skb)317251{318252 if (skb_queue_len(&offload->skb_queue) >319319- offload->skb_queue_len_max)320320- return -ENOMEM;253253+ offload->skb_queue_len_max) {254254+ kfree_skb(skb);255255+ return -ENOBUFS;256256+ }321257322258 skb_queue_tail(&offload->skb_queue, skb);323259 can_rx_offload_schedule(offload);
+1-1
drivers/net/can/spi/mcp251x.c
···717717 if (priv->after_suspend) {718718 mcp251x_hw_reset(spi);719719 mcp251x_setup(net, spi);720720+ priv->force_quit = 0;720721 if (priv->after_suspend & AFTER_SUSPEND_RESTART) {721722 mcp251x_set_normal_mode(spi);722723 } else if (priv->after_suspend & AFTER_SUSPEND_UP) {···729728 mcp251x_hw_sleep(spi);730729 }731730 priv->after_suspend = 0;732732- priv->force_quit = 0;733731 }734732735733 if (priv->restart_tx) {
+150-86
drivers/net/can/ti_hecc.c
···7373 */7474#define HECC_MAX_RX_MBOX (HECC_MAX_MAILBOXES - HECC_MAX_TX_MBOX)7575#define HECC_RX_FIRST_MBOX (HECC_MAX_MAILBOXES - 1)7676+#define HECC_RX_LAST_MBOX (HECC_MAX_TX_MBOX)76777778/* TI HECC module registers */7879#define HECC_CANME 0x0 /* Mailbox enable */···8382#define HECC_CANTA 0x10 /* Transmission acknowledge */8483#define HECC_CANAA 0x14 /* Abort acknowledge */8584#define HECC_CANRMP 0x18 /* Receive message pending */8686-#define HECC_CANRML 0x1C /* Remote message lost */8585+#define HECC_CANRML 0x1C /* Receive message lost */8786#define HECC_CANRFP 0x20 /* Remote frame pending */8887#define HECC_CANGAM 0x24 /* SECC only:Global acceptance mask */8988#define HECC_CANMC 0x28 /* Master control */···150149#define HECC_BUS_ERROR (HECC_CANES_FE | HECC_CANES_BE |\151150 HECC_CANES_CRCE | HECC_CANES_SE |\152151 HECC_CANES_ACKE)152152+#define HECC_CANES_FLAGS (HECC_BUS_ERROR | HECC_CANES_BO |\153153+ HECC_CANES_EP | HECC_CANES_EW)153154154155#define HECC_CANMCF_RTR BIT(4) /* Remote transmit request */155156···385382 hecc_set_bit(priv, HECC_CANMIM, mbx_mask);386383 }387384388388- /* Prevent message over-write & Enable interrupts */389389- hecc_write(priv, HECC_CANOPC, HECC_SET_REG);385385+ /* Enable tx interrupts */386386+ hecc_set_bit(priv, HECC_CANMIM, BIT(HECC_MAX_TX_MBOX) - 1);387387+388388+ /* Prevent message over-write to create a rx fifo, but not for389389+ * the lowest priority mailbox, since that allows detecting390390+ * overflows instead of the hardware silently dropping the391391+ * messages.392392+ */393393+ mbx_mask = ~BIT(HECC_RX_LAST_MBOX);394394+ hecc_write(priv, HECC_CANOPC, mbx_mask);395395+396396+ /* Enable interrupts */390397 if (priv->use_hecc1int) {391398 hecc_write(priv, HECC_CANMIL, HECC_SET_REG);392399 hecc_write(priv, HECC_CANGIM, HECC_CANGIM_DEF_MASK |···412399static void ti_hecc_stop(struct net_device *ndev)413400{414401 struct ti_hecc_priv *priv = netdev_priv(ndev);402402+403403+ /* Disable the CPK; stop sending, erroring and acking */404404+ hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_CCR);415405416406 /* Disable interrupts and disable mailboxes */417407 hecc_write(priv, HECC_CANGIM, 0);···524508 hecc_set_bit(priv, HECC_CANME, mbx_mask);525509 spin_unlock_irqrestore(&priv->mbx_lock, flags);526510527527- hecc_clear_bit(priv, HECC_CANMD, mbx_mask);528528- hecc_set_bit(priv, HECC_CANMIM, mbx_mask);529511 hecc_write(priv, HECC_CANTRS, mbx_mask);530512531513 return NETDEV_TX_OK;···540526 u32 *timestamp, unsigned int mbxno)541527{542528 struct ti_hecc_priv *priv = rx_offload_to_priv(offload);543543- u32 data;529529+ u32 data, mbx_mask;530530+ int ret = 1;544531532532+ mbx_mask = BIT(mbxno);545533 data = hecc_read_mbx(priv, mbxno, HECC_CANMID);546534 if (data & HECC_CANMID_IDE)547535 cf->can_id = (data & CAN_EFF_MASK) | CAN_EFF_FLAG;···564548565549 *timestamp = hecc_read_stamp(priv, mbxno);566550567567- return 1;551551+ /* Check for FIFO overrun.552552+ *553553+ * All but the last RX mailbox have activated overwrite554554+ * protection. So skip check for overrun, if we're not555555+ * handling the last RX mailbox.556556+ *557557+ * As the overwrite protection for the last RX mailbox is558558+ * disabled, the CAN core might update while we're reading559559+ * it. This means the skb might be inconsistent.560560+ *561561+ * Return an error to let rx-offload discard this CAN frame.562562+ */563563+ if (unlikely(mbxno == HECC_RX_LAST_MBOX &&564564+ hecc_read(priv, HECC_CANRML) & mbx_mask))565565+ ret = -ENOBUFS;566566+567567+ hecc_write(priv, HECC_CANRMP, mbx_mask);568568+569569+ return ret;568570}569571570572static int ti_hecc_error(struct net_device *ndev, int int_status,···592558 struct can_frame *cf;593559 struct sk_buff *skb;594560 u32 timestamp;595595-596596- /* propagate the error condition to the can stack */597597- skb = alloc_can_err_skb(ndev, &cf);598598- if (!skb) {599599- if (printk_ratelimit())600600- netdev_err(priv->ndev,601601- "%s: alloc_can_err_skb() failed\n",602602- __func__);603603- return -ENOMEM;604604- }605605-606606- if (int_status & HECC_CANGIF_WLIF) { /* warning level int */607607- if ((int_status & HECC_CANGIF_BOIF) == 0) {608608- priv->can.state = CAN_STATE_ERROR_WARNING;609609- ++priv->can.can_stats.error_warning;610610- cf->can_id |= CAN_ERR_CRTL;611611- if (hecc_read(priv, HECC_CANTEC) > 96)612612- cf->data[1] |= CAN_ERR_CRTL_TX_WARNING;613613- if (hecc_read(priv, HECC_CANREC) > 96)614614- cf->data[1] |= CAN_ERR_CRTL_RX_WARNING;615615- }616616- hecc_set_bit(priv, HECC_CANES, HECC_CANES_EW);617617- netdev_dbg(priv->ndev, "Error Warning interrupt\n");618618- hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);619619- }620620-621621- if (int_status & HECC_CANGIF_EPIF) { /* error passive int */622622- if ((int_status & HECC_CANGIF_BOIF) == 0) {623623- priv->can.state = CAN_STATE_ERROR_PASSIVE;624624- ++priv->can.can_stats.error_passive;625625- cf->can_id |= CAN_ERR_CRTL;626626- if (hecc_read(priv, HECC_CANTEC) > 127)627627- cf->data[1] |= CAN_ERR_CRTL_TX_PASSIVE;628628- if (hecc_read(priv, HECC_CANREC) > 127)629629- cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE;630630- }631631- hecc_set_bit(priv, HECC_CANES, HECC_CANES_EP);632632- netdev_dbg(priv->ndev, "Error passive interrupt\n");633633- hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);634634- }635635-636636- /* Need to check busoff condition in error status register too to637637- * ensure warning interrupts don't hog the system638638- */639639- if ((int_status & HECC_CANGIF_BOIF) || (err_status & HECC_CANES_BO)) {640640- priv->can.state = CAN_STATE_BUS_OFF;641641- cf->can_id |= CAN_ERR_BUSOFF;642642- hecc_set_bit(priv, HECC_CANES, HECC_CANES_BO);643643- hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);644644- /* Disable all interrupts in bus-off to avoid int hog */645645- hecc_write(priv, HECC_CANGIM, 0);646646- ++priv->can.can_stats.bus_off;647647- can_bus_off(ndev);648648- }561561+ int err;649562650563 if (err_status & HECC_BUS_ERROR) {564564+ /* propagate the error condition to the can stack */565565+ skb = alloc_can_err_skb(ndev, &cf);566566+ if (!skb) {567567+ if (net_ratelimit())568568+ netdev_err(priv->ndev,569569+ "%s: alloc_can_err_skb() failed\n",570570+ __func__);571571+ return -ENOMEM;572572+ }573573+651574 ++priv->can.can_stats.bus_error;652575 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;653653- if (err_status & HECC_CANES_FE) {654654- hecc_set_bit(priv, HECC_CANES, HECC_CANES_FE);576576+ if (err_status & HECC_CANES_FE)655577 cf->data[2] |= CAN_ERR_PROT_FORM;656656- }657657- if (err_status & HECC_CANES_BE) {658658- hecc_set_bit(priv, HECC_CANES, HECC_CANES_BE);578578+ if (err_status & HECC_CANES_BE)659579 cf->data[2] |= CAN_ERR_PROT_BIT;660660- }661661- if (err_status & HECC_CANES_SE) {662662- hecc_set_bit(priv, HECC_CANES, HECC_CANES_SE);580580+ if (err_status & HECC_CANES_SE)663581 cf->data[2] |= CAN_ERR_PROT_STUFF;664664- }665665- if (err_status & HECC_CANES_CRCE) {666666- hecc_set_bit(priv, HECC_CANES, HECC_CANES_CRCE);582582+ if (err_status & HECC_CANES_CRCE)667583 cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;668668- }669669- if (err_status & HECC_CANES_ACKE) {670670- hecc_set_bit(priv, HECC_CANES, HECC_CANES_ACKE);584584+ if (err_status & HECC_CANES_ACKE)671585 cf->data[3] = CAN_ERR_PROT_LOC_ACK;672672- }586586+587587+ timestamp = hecc_read(priv, HECC_CANLNT);588588+ err = can_rx_offload_queue_sorted(&priv->offload, skb,589589+ timestamp);590590+ if (err)591591+ ndev->stats.rx_fifo_errors++;592592+ }593593+594594+ hecc_write(priv, HECC_CANES, HECC_CANES_FLAGS);595595+596596+ return 0;597597+}598598+599599+static void ti_hecc_change_state(struct net_device *ndev,600600+ enum can_state rx_state,601601+ enum can_state tx_state)602602+{603603+ struct ti_hecc_priv *priv = netdev_priv(ndev);604604+ struct can_frame *cf;605605+ struct sk_buff *skb;606606+ u32 timestamp;607607+ int err;608608+609609+ skb = alloc_can_err_skb(priv->ndev, &cf);610610+ if (unlikely(!skb)) {611611+ priv->can.state = max(tx_state, rx_state);612612+ return;613613+ }614614+615615+ can_change_state(priv->ndev, cf, tx_state, rx_state);616616+617617+ if (max(tx_state, rx_state) != CAN_STATE_BUS_OFF) {618618+ cf->data[6] = hecc_read(priv, HECC_CANTEC);619619+ cf->data[7] = hecc_read(priv, HECC_CANREC);673620 }674621675622 timestamp = hecc_read(priv, HECC_CANLNT);676676- can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);677677-678678- return 0;623623+ err = can_rx_offload_queue_sorted(&priv->offload, skb, timestamp);624624+ if (err)625625+ ndev->stats.rx_fifo_errors++;679626}680627681628static irqreturn_t ti_hecc_interrupt(int irq, void *dev_id)···666651 struct net_device_stats *stats = &ndev->stats;667652 u32 mbxno, mbx_mask, int_status, err_status, stamp;668653 unsigned long flags, rx_pending;654654+ u32 handled = 0;669655670656 int_status = hecc_read(priv,671657 priv->use_hecc1int ?···676660 return IRQ_NONE;677661678662 err_status = hecc_read(priv, HECC_CANES);679679- if (err_status & (HECC_BUS_ERROR | HECC_CANES_BO |680680- HECC_CANES_EP | HECC_CANES_EW))663663+ if (unlikely(err_status & HECC_CANES_FLAGS))681664 ti_hecc_error(ndev, int_status, err_status);665665+666666+ if (unlikely(int_status & HECC_CANGIM_DEF_MASK)) {667667+ enum can_state rx_state, tx_state;668668+ u32 rec = hecc_read(priv, HECC_CANREC);669669+ u32 tec = hecc_read(priv, HECC_CANTEC);670670+671671+ if (int_status & HECC_CANGIF_WLIF) {672672+ handled |= HECC_CANGIF_WLIF;673673+ rx_state = rec >= tec ? CAN_STATE_ERROR_WARNING : 0;674674+ tx_state = rec <= tec ? CAN_STATE_ERROR_WARNING : 0;675675+ netdev_dbg(priv->ndev, "Error Warning interrupt\n");676676+ ti_hecc_change_state(ndev, rx_state, tx_state);677677+ }678678+679679+ if (int_status & HECC_CANGIF_EPIF) {680680+ handled |= HECC_CANGIF_EPIF;681681+ rx_state = rec >= tec ? CAN_STATE_ERROR_PASSIVE : 0;682682+ tx_state = rec <= tec ? CAN_STATE_ERROR_PASSIVE : 0;683683+ netdev_dbg(priv->ndev, "Error passive interrupt\n");684684+ ti_hecc_change_state(ndev, rx_state, tx_state);685685+ }686686+687687+ if (int_status & HECC_CANGIF_BOIF) {688688+ handled |= HECC_CANGIF_BOIF;689689+ rx_state = CAN_STATE_BUS_OFF;690690+ tx_state = CAN_STATE_BUS_OFF;691691+ netdev_dbg(priv->ndev, "Bus off interrupt\n");692692+693693+ /* Disable all interrupts */694694+ hecc_write(priv, HECC_CANGIM, 0);695695+ can_bus_off(ndev);696696+ ti_hecc_change_state(ndev, rx_state, tx_state);697697+ }698698+ } else if (unlikely(priv->can.state != CAN_STATE_ERROR_ACTIVE)) {699699+ enum can_state new_state, tx_state, rx_state;700700+ u32 rec = hecc_read(priv, HECC_CANREC);701701+ u32 tec = hecc_read(priv, HECC_CANTEC);702702+703703+ if (rec >= 128 || tec >= 128)704704+ new_state = CAN_STATE_ERROR_PASSIVE;705705+ else if (rec >= 96 || tec >= 96)706706+ new_state = CAN_STATE_ERROR_WARNING;707707+ else708708+ new_state = CAN_STATE_ERROR_ACTIVE;709709+710710+ if (new_state < priv->can.state) {711711+ rx_state = rec >= tec ? new_state : 0;712712+ tx_state = rec <= tec ? new_state : 0;713713+ ti_hecc_change_state(ndev, rx_state, tx_state);714714+ }715715+ }682716683717 if (int_status & HECC_CANGIF_GMIF) {684718 while (priv->tx_tail - priv->tx_head > 0) {···736670 mbx_mask = BIT(mbxno);737671 if (!(mbx_mask & hecc_read(priv, HECC_CANTA)))738672 break;739739- hecc_clear_bit(priv, HECC_CANMIM, mbx_mask);740673 hecc_write(priv, HECC_CANTA, mbx_mask);741674 spin_lock_irqsave(&priv->mbx_lock, flags);742675 hecc_clear_bit(priv, HECC_CANME, mbx_mask);···760695 while ((rx_pending = hecc_read(priv, HECC_CANRMP))) {761696 can_rx_offload_irq_offload_timestamp(&priv->offload,762697 rx_pending);763763- hecc_write(priv, HECC_CANRMP, rx_pending);764698 }765699 }766700767701 /* clear all interrupt conditions - read back to avoid spurious ints */768702 if (priv->use_hecc1int) {769769- hecc_write(priv, HECC_CANGIF1, HECC_SET_REG);703703+ hecc_write(priv, HECC_CANGIF1, handled);770704 int_status = hecc_read(priv, HECC_CANGIF1);771705 } else {772772- hecc_write(priv, HECC_CANGIF0, HECC_SET_REG);706706+ hecc_write(priv, HECC_CANGIF0, handled);773707 int_status = hecc_read(priv, HECC_CANGIF0);774708 }775709···941877942878 priv->offload.mailbox_read = ti_hecc_mailbox_read;943879 priv->offload.mb_first = HECC_RX_FIRST_MBOX;944944- priv->offload.mb_last = HECC_MAX_TX_MBOX;880880+ priv->offload.mb_last = HECC_RX_LAST_MBOX;945881 err = can_rx_offload_add_timestamp(ndev, &priv->offload);946882 if (err) {947883 dev_err(&pdev->dev, "can_rx_offload_add_timestamp() failed\n");
···100100 u8 *end;101101 u8 rec_cnt;102102 u8 rec_idx;103103- u8 rec_data_idx;103103+ u8 rec_ts_idx;104104 struct net_device *netdev;105105 struct pcan_usb *pdev;106106};···436436 }437437 if ((n & PCAN_USB_ERROR_BUS_LIGHT) == 0) {438438 /* no error (back to active state) */439439- mc->pdev->dev.can.state = CAN_STATE_ERROR_ACTIVE;440440- return 0;439439+ new_state = CAN_STATE_ERROR_ACTIVE;440440+ break;441441 }442442 break;443443···460460 }461461462462 if ((n & PCAN_USB_ERROR_BUS_HEAVY) == 0) {463463- /* no error (back to active state) */464464- mc->pdev->dev.can.state = CAN_STATE_ERROR_ACTIVE;465465- return 0;463463+ /* no error (back to warning state) */464464+ new_state = CAN_STATE_ERROR_WARNING;465465+ break;466466 }467467 break;468468···499499 cf->data[1] |= CAN_ERR_CRTL_TX_WARNING |500500 CAN_ERR_CRTL_RX_WARNING;501501 mc->pdev->dev.can.can_stats.error_warning++;502502+ break;503503+504504+ case CAN_STATE_ERROR_ACTIVE:505505+ cf->can_id |= CAN_ERR_CRTL;506506+ cf->data[1] = CAN_ERR_CRTL_ACTIVE;502507 break;503508504509 default:···552547 mc->ptr += PCAN_USB_CMD_ARGS;553548554549 if (status_len & PCAN_USB_STATUSLEN_TIMESTAMP) {555555- int err = pcan_usb_decode_ts(mc, !mc->rec_idx);550550+ int err = pcan_usb_decode_ts(mc, !mc->rec_ts_idx);556551557552 if (err)558553 return err;554554+555555+ /* Next packet in the buffer will have a timestamp on a single556556+ * byte557557+ */558558+ mc->rec_ts_idx++;559559 }560560561561 switch (f) {···642632643633 cf->can_dlc = get_can_dlc(rec_len);644634645645- /* first data packet timestamp is a word */646646- if (pcan_usb_decode_ts(mc, !mc->rec_data_idx))635635+ /* Only first packet timestamp is a word */636636+ if (pcan_usb_decode_ts(mc, !mc->rec_ts_idx))647637 goto decode_failed;638638+639639+ /* Next packet in the buffer will have a timestamp on a single byte */640640+ mc->rec_ts_idx++;648641649642 /* read data */650643 memset(cf->data, 0x0, sizeof(cf->data));···701688 /* handle normal can frames here */702689 } else {703690 err = pcan_usb_decode_data(&mc, sl);704704- mc.rec_data_idx++;705691 }706692 }707693
+1-1
drivers/net/can/usb/peak_usb/pcan_usb_core.c
···750750 dev = netdev_priv(netdev);751751752752 /* allocate a buffer large enough to send commands */753753- dev->cmd_buf = kmalloc(PCAN_USB_MAX_CMD_LEN, GFP_KERNEL);753753+ dev->cmd_buf = kzalloc(PCAN_USB_MAX_CMD_LEN, GFP_KERNEL);754754 if (!dev->cmd_buf) {755755 err = -ENOMEM;756756 goto lbl_free_candev;
···173173 bcmgenet_fixed_phy_link_update);174174}175175176176-int bcmgenet_mii_connect(struct net_device *dev)177177-{178178- struct bcmgenet_priv *priv = netdev_priv(dev);179179- struct device_node *dn = priv->pdev->dev.of_node;180180- struct phy_device *phydev;181181- u32 phy_flags = 0;182182- int ret;183183-184184- /* Communicate the integrated PHY revision */185185- if (priv->internal_phy)186186- phy_flags = priv->gphy_rev;187187-188188- /* Initialize link state variables that bcmgenet_mii_setup() uses */189189- priv->old_link = -1;190190- priv->old_speed = -1;191191- priv->old_duplex = -1;192192- priv->old_pause = -1;193193-194194- if (dn) {195195- phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup,196196- phy_flags, priv->phy_interface);197197- if (!phydev) {198198- pr_err("could not attach to PHY\n");199199- return -ENODEV;200200- }201201- } else {202202- phydev = dev->phydev;203203- phydev->dev_flags = phy_flags;204204-205205- ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup,206206- priv->phy_interface);207207- if (ret) {208208- pr_err("could not attach to PHY\n");209209- return -ENODEV;210210- }211211- }212212-213213- return 0;214214-}215215-216176int bcmgenet_mii_config(struct net_device *dev, bool init)217177{218178 struct bcmgenet_priv *priv = netdev_priv(dev);···181221 const char *phy_name = NULL;182222 u32 id_mode_dis = 0;183223 u32 port_ctrl;224224+ int bmcr = -1;225225+ int ret;184226 u32 reg;227227+228228+ /* MAC clocking workaround during reset of umac state machines */229229+ reg = bcmgenet_umac_readl(priv, UMAC_CMD);230230+ if (reg & CMD_SW_RESET) {231231+ /* An MII PHY must be isolated to prevent TXC contention */232232+ if (priv->phy_interface == PHY_INTERFACE_MODE_MII) {233233+ ret = phy_read(phydev, MII_BMCR);234234+ if (ret >= 0) {235235+ bmcr = ret;236236+ ret = phy_write(phydev, MII_BMCR,237237+ bmcr | BMCR_ISOLATE);238238+ }239239+ if (ret) {240240+ netdev_err(dev, "failed to isolate PHY\n");241241+ return ret;242242+ }243243+ }244244+ /* Switch MAC clocking to RGMII generated clock */245245+ bcmgenet_sys_writel(priv, PORT_MODE_EXT_GPHY, SYS_PORT_CTRL);246246+ /* Ensure 5 clks with Rx disabled247247+ * followed by 5 clks with Reset asserted248248+ */249249+ udelay(4);250250+ reg &= ~(CMD_SW_RESET | CMD_LCL_LOOP_EN);251251+ bcmgenet_umac_writel(priv, reg, UMAC_CMD);252252+ /* Ensure 5 more clocks before Rx is enabled */253253+ udelay(2);254254+ }185255186256 priv->ext_phy = !priv->internal_phy &&187257 (priv->phy_interface != PHY_INTERFACE_MODE_MOCA);···244254 phy_set_max_speed(phydev, SPEED_100);245255 bcmgenet_sys_writel(priv,246256 PORT_MODE_EXT_EPHY, SYS_PORT_CTRL);257257+ /* Restore the MII PHY after isolation */258258+ if (bmcr >= 0)259259+ phy_write(phydev, MII_BMCR, bmcr);247260 break;248261249262 case PHY_INTERFACE_MODE_REVMII:···299306 bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);300307 }301308302302- if (init) {303303- linkmode_copy(phydev->advertising, phydev->supported);304304-305305- /* The internal PHY has its link interrupts routed to the306306- * Ethernet MAC ISRs. On GENETv5 there is a hardware issue307307- * that prevents the signaling of link UP interrupts when308308- * the link operates at 10Mbps, so fallback to polling for309309- * those versions of GENET.310310- */311311- if (priv->internal_phy && !GENET_IS_V5(priv))312312- phydev->irq = PHY_IGNORE_INTERRUPT;313313-309309+ if (init)314310 dev_info(kdev, "configuring instance for %s\n", phy_name);311311+312312+ return 0;313313+}314314+315315+int bcmgenet_mii_probe(struct net_device *dev)316316+{317317+ struct bcmgenet_priv *priv = netdev_priv(dev);318318+ struct device_node *dn = priv->pdev->dev.of_node;319319+ struct phy_device *phydev;320320+ u32 phy_flags = 0;321321+ int ret;322322+323323+ /* Communicate the integrated PHY revision */324324+ if (priv->internal_phy)325325+ phy_flags = priv->gphy_rev;326326+327327+ /* Initialize link state variables that bcmgenet_mii_setup() uses */328328+ priv->old_link = -1;329329+ priv->old_speed = -1;330330+ priv->old_duplex = -1;331331+ priv->old_pause = -1;332332+333333+ if (dn) {334334+ phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup,335335+ phy_flags, priv->phy_interface);336336+ if (!phydev) {337337+ pr_err("could not attach to PHY\n");338338+ return -ENODEV;339339+ }340340+ } else {341341+ phydev = dev->phydev;342342+ phydev->dev_flags = phy_flags;343343+344344+ ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup,345345+ priv->phy_interface);346346+ if (ret) {347347+ pr_err("could not attach to PHY\n");348348+ return -ENODEV;349349+ }315350 }351351+352352+ /* Configure port multiplexer based on what the probed PHY device since353353+ * reading the 'max-speed' property determines the maximum supported354354+ * PHY speed which is needed for bcmgenet_mii_config() to configure355355+ * things appropriately.356356+ */357357+ ret = bcmgenet_mii_config(dev, true);358358+ if (ret) {359359+ phy_disconnect(dev->phydev);360360+ return ret;361361+ }362362+363363+ linkmode_copy(phydev->advertising, phydev->supported);364364+365365+ /* The internal PHY has its link interrupts routed to the366366+ * Ethernet MAC ISRs. On GENETv5 there is a hardware issue367367+ * that prevents the signaling of link UP interrupts when368368+ * the link operates at 10Mbps, so fallback to polling for369369+ * those versions of GENET.370370+ */371371+ if (priv->internal_phy && !GENET_IS_V5(priv))372372+ dev->phydev->irq = PHY_IGNORE_INTERRUPT;316373317374 return 0;318375}
···274274 /* statistic */275275 struct ring_stats stats;276276277277- /* ring lock for poll one */278278- spinlock_t lock;279279-280277 dma_addr_t desc_dma_addr;281278 u32 buf_size; /* size for hnae_desc->addr, preset by AE */282279 u16 desc_num; /* total number of desc */
+1-21
drivers/net/ethernet/hisilicon/hns/hns_enet.c
···943943 return u > c ? (h > c && h <= u) : (h > c || h <= u);944944}945945946946-/* netif_tx_lock will turn down the performance, set only when necessary */947947-#ifdef CONFIG_NET_POLL_CONTROLLER948948-#define NETIF_TX_LOCK(ring) spin_lock(&(ring)->lock)949949-#define NETIF_TX_UNLOCK(ring) spin_unlock(&(ring)->lock)950950-#else951951-#define NETIF_TX_LOCK(ring)952952-#define NETIF_TX_UNLOCK(ring)953953-#endif954954-955946/* reclaim all desc in one budget956947 * return error or number of desc left957948 */···956965 int head;957966 int bytes, pkts;958967959959- NETIF_TX_LOCK(ring);960960-961968 head = readl_relaxed(ring->io_base + RCB_REG_HEAD);962969 rmb(); /* make sure head is ready before touch any data */963970964964- if (is_ring_empty(ring) || head == ring->next_to_clean) {965965- NETIF_TX_UNLOCK(ring);971971+ if (is_ring_empty(ring) || head == ring->next_to_clean)966972 return 0; /* no data to poll */967967- }968973969974 if (!is_valid_clean_head(ring, head)) {970975 netdev_err(ndev, "wrong head (%d, %d-%d)\n", head,971976 ring->next_to_use, ring->next_to_clean);972977 ring->stats.io_err_cnt++;973973- NETIF_TX_UNLOCK(ring);974978 return -EIO;975979 }976980···979993 /* update tx ring statistics. */980994 ring->stats.tx_pkts += pkts;981995 ring->stats.tx_bytes += bytes;982982-983983- NETIF_TX_UNLOCK(ring);984996985997 dev_queue = netdev_get_tx_queue(ndev, ring_data->queue_index);986998 netdev_tx_completed_queue(dev_queue, pkts, bytes);···10391055 int head;10401056 int bytes, pkts;1041105710421042- NETIF_TX_LOCK(ring);10431043-10441058 head = ring->next_to_use; /* ntu :soft setted ring position*/10451059 bytes = 0;10461060 pkts = 0;10471061 while (head != ring->next_to_clean)10481062 hns_nic_reclaim_one_desc(ring, &bytes, &pkts);10491049-10501050- NETIF_TX_UNLOCK(ring);1051106310521064 dev_queue = netdev_get_tx_queue(ndev, ring_data->queue_index);10531065 netdev_tx_reset_queue(dev_queue);
···36793679{36803680 struct hclge_pf_rst_done_cmd *req;36813681 struct hclge_desc desc;36823682+ int ret;3682368336833684 req = (struct hclge_pf_rst_done_cmd *)desc.data;36843685 hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_PF_RST_DONE, false);36853686 req->pf_rst_done |= HCLGE_PF_RESET_DONE_BIT;3686368736873687- return hclge_cmd_send(&hdev->hw, &desc, 1);36883688+ ret = hclge_cmd_send(&hdev->hw, &desc, 1);36893689+ /* To be compatible with the old firmware, which does not support36903690+ * command HCLGE_OPC_PF_RST_DONE, just print a warning and36913691+ * return success36923692+ */36933693+ if (ret == -EOPNOTSUPP) {36943694+ dev_warn(&hdev->pdev->dev,36953695+ "current firmware does not support command(0x%x)!\n",36963696+ HCLGE_OPC_PF_RST_DONE);36973697+ return 0;36983698+ } else if (ret) {36993699+ dev_err(&hdev->pdev->dev, "assert PF reset done fail %d!\n",37003700+ ret);37013701+ }37023702+37033703+ return ret;36883704}3689370536903706static int hclge_reset_prepare_up(struct hclge_dev *hdev)
···20202121/* API version 1.7 implements additional link and PHY-specific APIs */2222#define I40E_MINOR_VER_GET_LINK_INFO_XL710 0x00072323+/* API version 1.9 for X722 implements additional link and PHY-specific APIs */2424+#define I40E_MINOR_VER_GET_LINK_INFO_X722 0x00092325/* API version 1.6 for X722 devices adds ability to stop FW LLDP agent */2426#define I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722 0x00062527
···56775677 * should have been handled by the upper layers.56785678 */56795679 if (tx_ring->launchtime_enable) {56805680- ts = ns_to_timespec64(first->skb->tstamp);56815681- first->skb->tstamp = 0;56805680+ ts = ktime_to_timespec64(first->skb->tstamp);56815681+ first->skb->tstamp = ktime_set(0, 0);56825682 context_desc->seqnum_seed = cpu_to_le32(ts.tv_nsec / 32);56835683 } else {56845684 context_desc->seqnum_seed = 0;
+2-2
drivers/net/ethernet/intel/igc/igc_main.c
···862862 * should have been handled by the upper layers.863863 */864864 if (tx_ring->launchtime_enable) {865865- ts = ns_to_timespec64(first->skb->tstamp);866866- first->skb->tstamp = 0;865865+ ts = ktime_to_timespec64(first->skb->tstamp);866866+ first->skb->tstamp = ktime_set(0, 0);867867 context_desc->launch_time = cpu_to_le32(ts.tv_nsec / 32);868868 } else {869869 context_desc->launch_time = 0;
+2-8
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
···622622 if (tx_desc) {623623 ixgbe_xdp_ring_update_tail(xdp_ring);624624 xsk_umem_consume_tx_done(xdp_ring->xsk_umem);625625- if (xsk_umem_uses_need_wakeup(xdp_ring->xsk_umem))626626- xsk_clear_tx_need_wakeup(xdp_ring->xsk_umem);627625 }628626629627 return !!budget && work_done;···689691 if (xsk_frames)690692 xsk_umem_complete_tx(umem, xsk_frames);691693692692- if (xsk_umem_uses_need_wakeup(tx_ring->xsk_umem)) {693693- if (tx_ring->next_to_clean == tx_ring->next_to_use)694694- xsk_set_tx_need_wakeup(tx_ring->xsk_umem);695695- else696696- xsk_clear_tx_need_wakeup(tx_ring->xsk_umem);697697- }694694+ if (xsk_umem_uses_need_wakeup(tx_ring->xsk_umem))695695+ xsk_set_tx_need_wakeup(tx_ring->xsk_umem);698696699697 return ixgbe_xmit_zc(tx_ring, q_vector->tx.work_limit);700698}
+1-2
drivers/net/ethernet/mellanox/mlx4/main.c
···514514 dev->caps.max_rq_desc_sz = dev_cap->max_rq_desc_sz;515515 /*516516 * Subtract 1 from the limit because we need to allocate a517517- * spare CQE so the HCA HW can tell the difference between an518518- * empty CQ and a full CQ.517517+ * spare CQE to enable resizing the CQ.519518 */520519 dev->caps.max_cqes = dev_cap->max_cq_sz - 1;521520 dev->caps.reserved_cqs = dev_cap->reserved_cqs;
···5757 if (port->nr_rmnet_devs)5858 return -EINVAL;59596060- kfree(port);6161-6260 netdev_rx_handler_unregister(real_dev);6161+6262+ kfree(port);63636464 /* release reference on real_dev */6565 dev_put(real_dev);
+3
drivers/net/ethernet/realtek/r8169_main.c
···910910911911static int r8168g_mdio_read(struct rtl8169_private *tp, int reg)912912{913913+ if (reg == 0x1f)914914+ return tp->ocp_base == OCP_STD_PHY_BASE ? 0 : tp->ocp_base >> 4;915915+913916 if (tp->ocp_base != OCP_STD_PHY_BASE)914917 reg -= 0x10;915918
+1-1
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
···432432 * bits used depends on the hardware configuration433433 * selected at core configuration time.434434 */435435- int bit_nr = bitrev32(~crc32_le(~0, ha->addr,435435+ u32 bit_nr = bitrev32(~crc32_le(~0, ha->addr,436436 ETH_ALEN)) >> (32 - mcbitslog2);437437 /* The most significant bit determines the register to438438 * use (H/L) while the other 5 bits determine the bit
···29962996 stmmac_set_desc_addr(priv, first, des);29972997 tmp_pay_len = pay_len;29982998 des += proto_hdr_len;29992999+ pay_len = 0;29993000 }3000300130013002 stmmac_tso_allocator(priv, des, tmp_pay_len, (nfrags == 0), queue);···30243023 /* Only the last descriptor gets to point to the skb. */30253024 tx_q->tx_skbuff[tx_q->cur_tx] = skb;3026302530263026+ /* Manage tx mitigation */30273027+ tx_q->tx_count_frames += nfrags + 1;30283028+ if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) &&30293029+ !((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&30303030+ priv->hwts_tx_en)) {30313031+ stmmac_tx_timer_arm(priv, queue);30323032+ } else {30333033+ desc = &tx_q->dma_tx[tx_q->cur_tx];30343034+ tx_q->tx_count_frames = 0;30353035+ stmmac_set_tx_ic(priv, desc);30363036+ priv->xstats.tx_set_ic_bit++;30373037+ }30383038+30273039 /* We've used all descriptors we need for this skb, however,30283040 * advance cur_tx so that it references a fresh descriptor.30293041 * ndo_start_xmit will fill this descriptor the next time it's···30533039 dev->stats.tx_bytes += skb->len;30543040 priv->xstats.tx_tso_frames++;30553041 priv->xstats.tx_tso_nfrags += nfrags;30563056-30573057- /* Manage tx mitigation */30583058- tx_q->tx_count_frames += nfrags + 1;30593059- if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) &&30603060- !(priv->synopsys_id >= DWMAC_CORE_4_00 &&30613061- (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&30623062- priv->hwts_tx_en)) {30633063- stmmac_tx_timer_arm(priv, queue);30643064- } else {30653065- tx_q->tx_count_frames = 0;30663066- stmmac_set_tx_ic(priv, desc);30673067- priv->xstats.tx_set_ic_bit++;30683068- }3069304230703043 if (priv->sarc_type)30713044 stmmac_set_desc_sarc(priv, first, priv->sarc_type);···32253224 /* Only the last descriptor gets to point to the skb. */32263225 tx_q->tx_skbuff[entry] = skb;3227322632273227+ /* According to the coalesce parameter the IC bit for the latest32283228+ * segment is reset and the timer re-started to clean the tx status.32293229+ * This approach takes care about the fragments: desc is the first32303230+ * element in case of no SG.32313231+ */32323232+ tx_q->tx_count_frames += nfrags + 1;32333233+ if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) &&32343234+ !((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&32353235+ priv->hwts_tx_en)) {32363236+ stmmac_tx_timer_arm(priv, queue);32373237+ } else {32383238+ if (likely(priv->extend_desc))32393239+ desc = &tx_q->dma_etx[entry].basic;32403240+ else32413241+ desc = &tx_q->dma_tx[entry];32423242+32433243+ tx_q->tx_count_frames = 0;32443244+ stmmac_set_tx_ic(priv, desc);32453245+ priv->xstats.tx_set_ic_bit++;32463246+ }32473247+32283248 /* We've used all descriptors we need for this skb, however,32293249 * advance cur_tx so that it references a fresh descriptor.32303250 * ndo_start_xmit will fill this descriptor the next time it's···32803258 }3281325932823260 dev->stats.tx_bytes += skb->len;32833283-32843284- /* According to the coalesce parameter the IC bit for the latest32853285- * segment is reset and the timer re-started to clean the tx status.32863286- * This approach takes care about the fragments: desc is the first32873287- * element in case of no SG.32883288- */32893289- tx_q->tx_count_frames += nfrags + 1;32903290- if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) &&32913291- !(priv->synopsys_id >= DWMAC_CORE_4_00 &&32923292- (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&32933293- priv->hwts_tx_en)) {32943294- stmmac_tx_timer_arm(priv, queue);32953295- } else {32963296- tx_q->tx_count_frames = 0;32973297- stmmac_set_tx_ic(priv, desc);32983298- priv->xstats.tx_set_ic_bit++;32993299- }3300326133013262 if (priv->sarc_type)33023263 stmmac_set_desc_sarc(priv, first, priv->sarc_type);···35113506 if (unlikely(status & dma_own))35123507 break;3513350835143514- count++;35153515-35163509 rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx, DMA_RX_SIZE);35173510 next_entry = rx_q->cur_rx;35183511···35373534 goto read_again;35383535 if (unlikely(error)) {35393536 dev_kfree_skb(skb);35373537+ count++;35403538 continue;35413539 }35423540···35773573 skb = napi_alloc_skb(&ch->rx_napi, len);35783574 if (!skb) {35793575 priv->dev->stats.rx_dropped++;35763576+ count++;35803577 continue;35813578 }35823579···3643363836443639 priv->dev->stats.rx_packets++;36453640 priv->dev->stats.rx_bytes += len;36413641+ count++;36463642 }3647364336483644 if (status & rx_not_ls) {
···708708 NFC_PROTO_FELICA_MASK;709709 } else {710710 kfree_skb(nfcid_skb);711711+ nfcid_skb = NULL;711712 /* P2P in type A */712713 r = nfc_hci_get_param(hdev, ST21NFCA_RF_READER_F_GATE,713714 ST21NFCA_RF_READER_F_NFCID1,
···472472 if (err)473473 return err;474474475475- /*476476- * .apply might have to round some values in *state, if possible477477- * read the actually implemented value back.478478- */479479- if (chip->ops->get_state)480480- chip->ops->get_state(chip, pwm, &pwm->state);481481- else482482- pwm->state = *state;475475+ pwm->state = *state;483476 } else {484477 /*485478 * FIXME: restore the initial state in case of error.
···1212#include <linux/platform_device.h>1313#include "core.h"1414#include "drd.h"1515+#include "host-export.h"15161617static int __cdns3_host_init(struct cdns3 *cdns)1718{
+5
drivers/usb/core/config.c
···348348349349 /* Validate the wMaxPacketSize field */350350 maxp = usb_endpoint_maxp(&endpoint->desc);351351+ if (maxp == 0) {352352+ dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has wMaxPacketSize 0, skipping\n",353353+ cfgno, inum, asnum, d->bEndpointAddress);354354+ goto skip_to_next_endpoint_or_interface_descriptor;355355+ }351356352357 /* Find the highest legal maxpacket size for this endpoint */353358 i = 0; /* additional transactions per microframe */
+1
drivers/usb/dwc3/Kconfig
···102102 depends on ARCH_MESON || COMPILE_TEST103103 default USB_DWC3104104 select USB_ROLE_SWITCH105105+ select REGMAP_MMIO105106 help106107 Support USB2/3 functionality in Amlogic G12A platforms.107108 Say 'Y' or 'M' if you have one such device.
+1-2
drivers/usb/dwc3/core.c
···312312313313 reg = dwc3_readl(dwc->regs, DWC3_GFLADJ);314314 dft = reg & DWC3_GFLADJ_30MHZ_MASK;315315- if (!dev_WARN_ONCE(dwc->dev, dft == dwc->fladj,316316- "request value same as default, ignoring\n")) {315315+ if (dft != dwc->fladj) {317316 reg &= ~DWC3_GFLADJ_30MHZ_MASK;318317 reg |= DWC3_GFLADJ_30MHZ_SDBND_SEL | dwc->fladj;319318 dwc3_writel(dwc->regs, DWC3_GFLADJ, reg);
+1-1
drivers/usb/dwc3/dwc3-pci.c
···258258259259 ret = platform_device_add_properties(dwc->dwc3, p);260260 if (ret < 0)261261- return ret;261261+ goto err;262262263263 ret = dwc3_pci_quirks(dwc);264264 if (ret)
···9898 if (ep->enabled)9999 goto out;100100101101+ /* UDC drivers can't handle endpoints with maxpacket size 0 */102102+ if (usb_endpoint_maxp(ep->desc) == 0) {103103+ /*104104+ * We should log an error message here, but we can't call105105+ * dev_err() because there's no way to find the gadget106106+ * given only ep.107107+ */108108+ ret = -EINVAL;109109+ goto out;110110+ }111111+101112 ret = ep->ops->enable(ep, ep->desc);102113 if (ret)103114 goto out;
+1-1
drivers/usb/gadget/udc/fsl_udc_core.c
···25762576 dma_pool_destroy(udc_controller->td_pool);25772577 free_irq(udc_controller->irq, udc_controller);25782578 iounmap(dr_regs);25792579- if (pdata->operating_mode == FSL_USB2_DR_DEVICE)25792579+ if (res && (pdata->operating_mode == FSL_USB2_DR_DEVICE))25802580 release_mem_region(res->start, resource_size(res));2581258125822582 /* free udc --wait for the release() finished */
···33303330 if (xhci_urb_suitable_for_idt(urb)) {33313331 memcpy(&send_addr, urb->transfer_buffer,33323332 trb_buff_len);33333333+ le64_to_cpus(&send_addr);33333334 field |= TRB_IDT;33343335 }33353336 }···34763475 if (xhci_urb_suitable_for_idt(urb)) {34773476 memcpy(&addr, urb->transfer_buffer,34783477 urb->transfer_buffer_length);34783478+ le64_to_cpus(&addr);34793479 field |= TRB_IDT;34803480 } else {34813481 addr = (u64) urb->transfer_dma;
+45-9
drivers/usb/host/xhci.c
···30713071 }30723072}3073307330743074+static void xhci_endpoint_disable(struct usb_hcd *hcd,30753075+ struct usb_host_endpoint *host_ep)30763076+{30773077+ struct xhci_hcd *xhci;30783078+ struct xhci_virt_device *vdev;30793079+ struct xhci_virt_ep *ep;30803080+ struct usb_device *udev;30813081+ unsigned long flags;30823082+ unsigned int ep_index;30833083+30843084+ xhci = hcd_to_xhci(hcd);30853085+rescan:30863086+ spin_lock_irqsave(&xhci->lock, flags);30873087+30883088+ udev = (struct usb_device *)host_ep->hcpriv;30893089+ if (!udev || !udev->slot_id)30903090+ goto done;30913091+30923092+ vdev = xhci->devs[udev->slot_id];30933093+ if (!vdev)30943094+ goto done;30953095+30963096+ ep_index = xhci_get_endpoint_index(&host_ep->desc);30973097+ ep = &vdev->eps[ep_index];30983098+ if (!ep)30993099+ goto done;31003100+31013101+ /* wait for hub_tt_work to finish clearing hub TT */31023102+ if (ep->ep_state & EP_CLEARING_TT) {31033103+ spin_unlock_irqrestore(&xhci->lock, flags);31043104+ schedule_timeout_uninterruptible(1);31053105+ goto rescan;31063106+ }31073107+31083108+ if (ep->ep_state)31093109+ xhci_dbg(xhci, "endpoint disable with ep_state 0x%x\n",31103110+ ep->ep_state);31113111+done:31123112+ host_ep->hcpriv = NULL;31133113+ spin_unlock_irqrestore(&xhci->lock, flags);31143114+}31153115+30743116/*30753117 * Called after usb core issues a clear halt control message.30763118 * The host side of the halt should already be cleared by a reset endpoint···52805238 unsigned int ep_index;52815239 unsigned long flags;5282524052835283- /*52845284- * udev might be NULL if tt buffer is cleared during a failed device52855285- * enumeration due to a halted control endpoint. Usb core might52865286- * have allocated a new udev for the next enumeration attempt.52875287- */52885288-52895241 xhci = hcd_to_xhci(hcd);52425242+52435243+ spin_lock_irqsave(&xhci->lock, flags);52905244 udev = (struct usb_device *)ep->hcpriv;52915291- if (!udev)52925292- return;52935245 slot_id = udev->slot_id;52945246 ep_index = xhci_get_endpoint_index(&ep->desc);5295524752965296- spin_lock_irqsave(&xhci->lock, flags);52975248 xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_CLEARING_TT;52985249 xhci_ring_doorbell_for_active_rings(xhci, slot_id, ep_index);52995250 spin_unlock_irqrestore(&xhci->lock, flags);···53235288 .free_streams = xhci_free_streams,53245289 .add_endpoint = xhci_add_endpoint,53255290 .drop_endpoint = xhci_drop_endpoint,52915291+ .endpoint_disable = xhci_endpoint_disable,53265292 .endpoint_reset = xhci_endpoint_reset,53275293 .check_bandwidth = xhci_check_bandwidth,53285294 .reset_bandwidth = xhci_reset_bandwidth,
···87878888struct whiteheat_port_settings {8989 __u8 port; /* port number (1 to N) */9090- __u32 baud; /* any value 7 - 460800, firmware calculates9090+ __le32 baud; /* any value 7 - 460800, firmware calculates9191 best fit; arrives little endian */9292 __u8 bits; /* 5, 6, 7, or 8 */9393 __u8 stop; /* 1 or 2, default 1 (2 = 1.5 if bits = 5) */
-10
drivers/usb/storage/scsiglue.c
···6868static int slave_alloc (struct scsi_device *sdev)6969{7070 struct us_data *us = host_to_us(sdev->host);7171- int maxp;72717372 /*7473 * Set the INQUIRY transfer length to 36. We don't use any of···7576 * less than 36 bytes.7677 */7778 sdev->inquiry_len = 36;7878-7979- /*8080- * USB has unusual scatter-gather requirements: the length of each8181- * scatterlist element except the last must be divisible by the8282- * Bulk maxpacket value. Fortunately this value is always a8383- * power of 2. Inform the block layer about this requirement.8484- */8585- maxp = usb_maxpacket(us->pusb_dev, us->recv_bulk_pipe, 0);8686- blk_queue_virt_boundary(sdev->request_queue, maxp - 1);87798880 /*8981 * Some host controllers may have alignment requirements.
-20
drivers/usb/storage/uas.c
···789789{790790 struct uas_dev_info *devinfo =791791 (struct uas_dev_info *)sdev->host->hostdata;792792- int maxp;793792794793 sdev->hostdata = devinfo;795795-796796- /*797797- * We have two requirements here. We must satisfy the requirements798798- * of the physical HC and the demands of the protocol, as we799799- * definitely want no additional memory allocation in this path800800- * ruling out using bounce buffers.801801- *802802- * For a transmission on USB to continue we must never send803803- * a package that is smaller than maxpacket. Hence the length of each804804- * scatterlist element except the last must be divisible by the805805- * Bulk maxpacket value.806806- * If the HC does not ensure that through SG,807807- * the upper layer must do that. We must assume nothing808808- * about the capabilities off the HC, so we use the most809809- * pessimistic requirement.810810- */811811-812812- maxp = usb_maxpacket(devinfo->udev, devinfo->data_in_pipe, 0);813813- blk_queue_virt_boundary(sdev->request_queue, maxp - 1);814794815795 /*816796 * The protocol has no requirements on alignment in the strict sense.
+3
drivers/usb/usbip/vhci_tx.c
···147147 }148148149149 kfree(iov);150150+ /* This is only for isochronous case */150151 kfree(iso_buffer);152152+ iso_buffer = NULL;153153+151154 usbip_dbg_vhci_tx("send txdata\n");152155153156 total_size += txsize;
+4-4
drivers/video/fbdev/c2p_core.h
···29293030extern void c2p_unsupported(void);31313232-static inline u32 get_mask(unsigned int n)3232+static __always_inline u32 get_mask(unsigned int n)3333{3434 switch (n) {3535 case 1:···5757 * Transpose operations on 8 32-bit words5858 */59596060-static inline void transp8(u32 d[], unsigned int n, unsigned int m)6060+static __always_inline void transp8(u32 d[], unsigned int n, unsigned int m)6161{6262 u32 mask = get_mask(n);6363···9999 * Transpose operations on 4 32-bit words100100 */101101102102-static inline void transp4(u32 d[], unsigned int n, unsigned int m)102102+static __always_inline void transp4(u32 d[], unsigned int n, unsigned int m)103103{104104 u32 mask = get_mask(n);105105···126126 * Transpose operations on 4 32-bit words (reverse order)127127 */128128129129-static inline void transp4x(u32 d[], unsigned int n, unsigned int m)129129+static __always_inline void transp4x(u32 d[], unsigned int n, unsigned int m)130130{131131 u32 mask = get_mask(n);132132
+5-5
fs/ceph/caps.c
···1058105810591059 dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode);1060106010611061+ /* remove from inode's cap rbtree, and clear auth cap */10621062+ rb_erase(&cap->ci_node, &ci->i_caps);10631063+ if (ci->i_auth_cap == cap)10641064+ ci->i_auth_cap = NULL;10651065+10611066 /* remove from session list */10621067 spin_lock(&session->s_cap_lock);10631068 if (session->s_cap_iterator == cap) {···10951090 cap->cap_ino = ci->i_vino.ino;1096109110971092 spin_unlock(&session->s_cap_lock);10981098-10991099- /* remove from inode list */11001100- rb_erase(&cap->ci_node, &ci->i_caps);11011101- if (ci->i_auth_cap == cap)11021102- ci->i_auth_cap = NULL;1103109311041094 if (removed)11051095 ceph_put_cap(mdsc, cap);
···576576 spin_unlock(&inode->i_lock);577577578578 /*579579- * A dying wb indicates that the memcg-blkcg mapping has changed580580- * and a new wb is already serving the memcg. Switch immediately.579579+ * A dying wb indicates that either the blkcg associated with the580580+ * memcg changed or the associated memcg is dying. In the first581581+ * case, a replacement wb should already be available and we should582582+ * refresh the wb immediately. In the second case, trying to583583+ * refresh will keep failing.581584 */582582- if (unlikely(wb_dying(wbc->wb)))585585+ if (unlikely(wb_dying(wbc->wb) && !css_is_dying(wbc->wb->memcg_css)))583586 inode_switch_wbs(inode, wbc->wb_id);584587}585588EXPORT_SYMBOL_GPL(wbc_attach_and_unlock_inode);
+91-45
fs/ocfs2/file.c
···20982098 return 0;20992099}2100210021012101-static int ocfs2_prepare_inode_for_refcount(struct inode *inode,21022102- struct file *file,21032103- loff_t pos, size_t count,21042104- int *meta_level)21012101+static int ocfs2_inode_lock_for_extent_tree(struct inode *inode,21022102+ struct buffer_head **di_bh,21032103+ int meta_level,21042104+ int overwrite_io,21052105+ int write_sem,21062106+ int wait)21052107{21062106- int ret;21072107- struct buffer_head *di_bh = NULL;21082108- u32 cpos = pos >> OCFS2_SB(inode->i_sb)->s_clustersize_bits;21092109- u32 clusters =21102110- ocfs2_clusters_for_bytes(inode->i_sb, pos + count) - cpos;21082108+ int ret = 0;2111210921122112- ret = ocfs2_inode_lock(inode, &di_bh, 1);21132113- if (ret) {21142114- mlog_errno(ret);21102110+ if (wait)21112111+ ret = ocfs2_inode_lock(inode, NULL, meta_level);21122112+ else21132113+ ret = ocfs2_try_inode_lock(inode,21142114+ overwrite_io ? NULL : di_bh, meta_level);21152115+ if (ret < 0)21152116 goto out;21172117+21182118+ if (wait) {21192119+ if (write_sem)21202120+ down_write(&OCFS2_I(inode)->ip_alloc_sem);21212121+ else21222122+ down_read(&OCFS2_I(inode)->ip_alloc_sem);21232123+ } else {21242124+ if (write_sem)21252125+ ret = down_write_trylock(&OCFS2_I(inode)->ip_alloc_sem);21262126+ else21272127+ ret = down_read_trylock(&OCFS2_I(inode)->ip_alloc_sem);21282128+21292129+ if (!ret) {21302130+ ret = -EAGAIN;21312131+ goto out_unlock;21322132+ }21162133 }2117213421182118- *meta_level = 1;21192119-21202120- ret = ocfs2_refcount_cow(inode, di_bh, cpos, clusters, UINT_MAX);21212121- if (ret)21222122- mlog_errno(ret);21232123-out:21242124- brelse(di_bh);21252135 return ret;21362136+21372137+out_unlock:21382138+ brelse(*di_bh);21392139+ ocfs2_inode_unlock(inode, meta_level);21402140+out:21412141+ return ret;21422142+}21432143+21442144+static void ocfs2_inode_unlock_for_extent_tree(struct inode *inode,21452145+ struct buffer_head **di_bh,21462146+ int meta_level,21472147+ int write_sem)21482148+{21492149+ if (write_sem)21502150+ up_write(&OCFS2_I(inode)->ip_alloc_sem);21512151+ else21522152+ up_read(&OCFS2_I(inode)->ip_alloc_sem);21532153+21542154+ brelse(*di_bh);21552155+ *di_bh = NULL;21562156+21572157+ if (meta_level >= 0)21582158+ ocfs2_inode_unlock(inode, meta_level);21262159}2127216021282161static int ocfs2_prepare_inode_for_write(struct file *file,21292162 loff_t pos, size_t count, int wait)21302163{21312164 int ret = 0, meta_level = 0, overwrite_io = 0;21652165+ int write_sem = 0;21322166 struct dentry *dentry = file->f_path.dentry;21332167 struct inode *inode = d_inode(dentry);21342168 struct buffer_head *di_bh = NULL;21692169+ u32 cpos;21702170+ u32 clusters;2135217121362172 /*21372173 * We start with a read level meta lock and only jump to an ex21382174 * if we need to make modifications here.21392175 */21402176 for(;;) {21412141- if (wait)21422142- ret = ocfs2_inode_lock(inode, NULL, meta_level);21432143- else21442144- ret = ocfs2_try_inode_lock(inode,21452145- overwrite_io ? NULL : &di_bh, meta_level);21772177+ ret = ocfs2_inode_lock_for_extent_tree(inode,21782178+ &di_bh,21792179+ meta_level,21802180+ overwrite_io,21812181+ write_sem,21822182+ wait);21462183 if (ret < 0) {21472147- meta_level = -1;21482184 if (ret != -EAGAIN)21492185 mlog_errno(ret);21502186 goto out;···21922156 */21932157 if (!wait && !overwrite_io) {21942158 overwrite_io = 1;21952195- if (!down_read_trylock(&OCFS2_I(inode)->ip_alloc_sem)) {21962196- ret = -EAGAIN;21972197- goto out_unlock;21982198- }2199215922002160 ret = ocfs2_overwrite_io(inode, di_bh, pos, count);22012201- brelse(di_bh);22022202- di_bh = NULL;22032203- up_read(&OCFS2_I(inode)->ip_alloc_sem);22042161 if (ret < 0) {22052162 if (ret != -EAGAIN)22062163 mlog_errno(ret);···22122183 * set inode->i_size at the end of a write. */22132184 if (should_remove_suid(dentry)) {22142185 if (meta_level == 0) {22152215- ocfs2_inode_unlock(inode, meta_level);21862186+ ocfs2_inode_unlock_for_extent_tree(inode,21872187+ &di_bh,21882188+ meta_level,21892189+ write_sem);22162190 meta_level = 1;22172191 continue;22182192 }···2229219722302198 ret = ocfs2_check_range_for_refcount(inode, pos, count);22312199 if (ret == 1) {22322232- ocfs2_inode_unlock(inode, meta_level);22332233- meta_level = -1;22002200+ ocfs2_inode_unlock_for_extent_tree(inode,22012201+ &di_bh,22022202+ meta_level,22032203+ write_sem);22042204+ ret = ocfs2_inode_lock_for_extent_tree(inode,22052205+ &di_bh,22062206+ meta_level,22072207+ overwrite_io,22082208+ 1,22092209+ wait);22102210+ write_sem = 1;22112211+ if (ret < 0) {22122212+ if (ret != -EAGAIN)22132213+ mlog_errno(ret);22142214+ goto out;22152215+ }2234221622352235- ret = ocfs2_prepare_inode_for_refcount(inode,22362236- file,22372237- pos,22382238- count,22392239- &meta_level);22172217+ cpos = pos >> OCFS2_SB(inode->i_sb)->s_clustersize_bits;22182218+ clusters =22192219+ ocfs2_clusters_for_bytes(inode->i_sb, pos + count) - cpos;22202220+ ret = ocfs2_refcount_cow(inode, di_bh, cpos, clusters, UINT_MAX);22402221 }2241222222422223 if (ret < 0) {22432243- mlog_errno(ret);22242224+ if (ret != -EAGAIN)22252225+ mlog_errno(ret);22442226 goto out_unlock;22452227 }22462228···22652219 trace_ocfs2_prepare_inode_for_write(OCFS2_I(inode)->ip_blkno,22662220 pos, count, wait);2267222122682268- brelse(di_bh);22692269-22702270- if (meta_level >= 0)22712271- ocfs2_inode_unlock(inode, meta_level);22222222+ ocfs2_inode_unlock_for_extent_tree(inode,22232223+ &di_bh,22242224+ meta_level,22252225+ write_sem);2272222622732227out:22742228 return ret;
+13
include/drm/drm_gem_shmem_helper.h
···4444 */4545 unsigned int pages_use_count;46464747+ /**4848+ * @madv: State for madvise4949+ *5050+ * 0 is active/inuse.5151+ * A negative value is the object is purged.5252+ * Positive values are driver specific and not used by the helpers.5353+ */4754 int madv;5555+5656+ /**5757+ * @madv_list: List entry for madvise tracking5858+ *5959+ * Typically used by drivers to track purgeable objects6060+ */4861 struct list_head madv_list;49625063 /**
+2-1
include/drm/drm_self_refresh_helper.h
···13131414void drm_self_refresh_helper_alter_state(struct drm_atomic_state *state);1515void drm_self_refresh_helper_update_avg_times(struct drm_atomic_state *state,1616- unsigned int commit_time_ms);1616+ unsigned int commit_time_ms,1717+ unsigned int new_self_refresh_mask);17181819int drm_self_refresh_helper_init(struct drm_crtc *crtc);1920void drm_self_refresh_helper_cleanup(struct drm_crtc *crtc);
···185185 * is convenient for a "not found" value.186186 */187187#define idr_for_each_entry(idr, entry, id) \188188- for (id = 0; ((entry) = idr_get_next(idr, &(id))) != NULL; ++id)188188+ for (id = 0; ((entry) = idr_get_next(idr, &(id))) != NULL; id += 1U)189189190190/**191191 * idr_for_each_entry_ul() - Iterate over an IDR's elements of a given type.
···221221#endif222222} _struct_page_alignment;223223224224+static inline atomic_t *compound_mapcount_ptr(struct page *page)225225+{226226+ return &page[1].compound_mapcount;227227+}228228+224229/*225230 * Used for sizing the vmemmap region on some architectures226231 */
+18-2
include/linux/page-flags.h
···622622 *623623 * Unlike PageTransCompound, this is safe to be called only while624624 * split_huge_pmd() cannot run from under us, like if protected by the625625- * MMU notifier, otherwise it may result in page->_mapcount < 0 false625625+ * MMU notifier, otherwise it may result in page->_mapcount check false626626 * positives.627627+ *628628+ * We have to treat page cache THP differently since every subpage of it629629+ * would get _mapcount inc'ed once it is PMD mapped. But, it may be PTE630630+ * mapped in the current process so comparing subpage's _mapcount to631631+ * compound_mapcount to filter out PTE mapped case.627632 */628633static inline int PageTransCompoundMap(struct page *page)629634{630630- return PageTransCompound(page) && atomic_read(&page->_mapcount) < 0;635635+ struct page *head;636636+637637+ if (!PageTransCompound(page))638638+ return 0;639639+640640+ if (PageAnon(page))641641+ return atomic_read(&page->_mapcount) < 0;642642+643643+ head = compound_head(page);644644+ /* File THP is PMD mapped and not PTE mapped */645645+ return atomic_read(&page->_mapcount) ==646646+ atomic_read(compound_mapcount_ptr(head));631647}632648633649/*
-18
include/linux/radix-tree.h
···316316}317317318318/**319319- * radix_tree_iter_find - find a present entry320320- * @root: radix tree root321321- * @iter: iterator state322322- * @index: start location323323- *324324- * This function returns the slot containing the entry with the lowest index325325- * which is at least @index. If @index is larger than any present entry, this326326- * function returns NULL. The @iter is updated to describe the entry found.327327- */328328-static inline void __rcu **329329-radix_tree_iter_find(const struct radix_tree_root *root,330330- struct radix_tree_iter *iter, unsigned long index)331331-{332332- radix_tree_iter_init(iter, index);333333- return radix_tree_next_chunk(root, iter, 0);334334-}335335-336336-/**337319 * radix_tree_iter_retry - retry this chunk of the iteration338320 * @iter: iterator state339321 *
+6-3
include/linux/skmsg.h
···140140 }141141}142142143143+static inline u32 sk_msg_iter_dist(u32 start, u32 end)144144+{145145+ return end >= start ? end - start : end + (MAX_MSG_FRAGS - start);146146+}147147+143148#define sk_msg_iter_var_prev(var) \144149 do { \145150 if (var == 0) \···204199 if (sk_msg_full(msg))205200 return MAX_MSG_FRAGS;206201207207- return msg->sg.end >= msg->sg.start ?208208- msg->sg.end - msg->sg.start :209209- msg->sg.end + (MAX_MSG_FRAGS - msg->sg.start);202202+ return sk_msg_iter_dist(msg->sg.start, msg->sg.end);210203}211204212205static inline struct scatterlist *sk_msg_elem(struct sk_msg *msg, int which)
+1-2
include/net/bonding.h
···159159 unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS];160160 s8 link; /* one of BOND_LINK_XXXX */161161 s8 link_new_state; /* one of BOND_LINK_XXXX */162162- s8 new_link;163162 u8 backup:1, /* indicates backup slave. Value corresponds with164163 BOND_STATE_ACTIVE and BOND_STATE_BACKUP */165164 inactive:1, /* indicates inactive slave */···548549549550static inline void bond_commit_link_state(struct slave *slave, bool notify)550551{551551- if (slave->link == slave->link_new_state)552552+ if (slave->link_new_state == BOND_LINK_NOCHANGE)552553 return;553554554555 slave->link = slave->link_new_state;
···11-/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */11+/* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */22/*33 * linux/can.h44 *
+1-1
include/uapi/linux/can/bcm.h
···11-/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */11+/* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */22/*33 * linux/can/bcm.h44 *
+1-1
include/uapi/linux/can/error.h
···11-/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */11+/* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */22/*33 * linux/can/error.h44 *
+1-1
include/uapi/linux/can/gw.h
···11-/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */11+/* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */22/*33 * linux/can/gw.h44 *
+1-1
include/uapi/linux/can/j1939.h
···11-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */11+/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */22/*33 * j1939.h44 *
+1-1
include/uapi/linux/can/netlink.h
···11-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */11+/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */22/*33 * linux/can/netlink.h44 *
+1-1
include/uapi/linux/can/raw.h
···11-/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */11+/* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */22/*33 * linux/can/raw.h44 *
+1-1
include/uapi/linux/can/vxcan.h
···11-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */11+/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */22#ifndef _UAPI_CAN_VXCAN_H33#define _UAPI_CAN_VXCAN_H44
···5151 * sent when the child exits.5252 * @stack: Specify the location of the stack for the5353 * child process.5454+ * Note, @stack is expected to point to the5555+ * lowest address. The stack direction will be5656+ * determined by the kernel and set up5757+ * appropriately based on @stack_size.5458 * @stack_size: The size of the stack for the child process.5559 * @tls: If CLONE_SETTLS is set, the tls descriptor5660 * is set to tls.
+2-2
kernel/bpf/cgroup.c
···13111311 return false;1312131213131313 switch (off) {13141314- case offsetof(struct bpf_sysctl, write):13141314+ case bpf_ctx_range(struct bpf_sysctl, write):13151315 if (type != BPF_READ)13161316 return false;13171317 bpf_ctx_record_field_size(info, size_default);13181318 return bpf_ctx_narrow_access_ok(off, size, size_default);13191319- case offsetof(struct bpf_sysctl, file_pos):13191319+ case bpf_ctx_range(struct bpf_sysctl, file_pos):13201320 if (type == BPF_READ) {13211321 bpf_ctx_record_field_size(info, size_default);13221322 return bpf_ctx_narrow_access_ok(off, size, size_default);
+5-2
kernel/bpf/syscall.c
···127127 return map;128128}129129130130-void *bpf_map_area_alloc(size_t size, int numa_node)130130+void *bpf_map_area_alloc(u64 size, int numa_node)131131{132132 /* We really just want to fail instead of triggering OOM killer133133 * under memory pressure, therefore we set __GFP_NORETRY to kmalloc,···141141142142 const gfp_t flags = __GFP_NOWARN | __GFP_ZERO;143143 void *area;144144+145145+ if (size >= SIZE_MAX)146146+ return NULL;144147145148 if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {146149 area = kmalloc_node(size, GFP_USER | __GFP_NORETRY | flags,···201198 atomic_long_sub(pages, &user->locked_vm);202199}203200204204-int bpf_map_charge_init(struct bpf_map_memory *mem, size_t size)201201+int bpf_map_charge_init(struct bpf_map_memory *mem, u64 size)205202{206203 u32 pages = round_up(size, PAGE_SIZE) >> PAGE_SHIFT;207204 struct user_struct *user;
+32-1
kernel/fork.c
···25612561 return 0;25622562}2563256325642564-static bool clone3_args_valid(const struct kernel_clone_args *kargs)25642564+/**25652565+ * clone3_stack_valid - check and prepare stack25662566+ * @kargs: kernel clone args25672567+ *25682568+ * Verify that the stack arguments userspace gave us are sane.25692569+ * In addition, set the stack direction for userspace since it's easy for us to25702570+ * determine.25712571+ */25722572+static inline bool clone3_stack_valid(struct kernel_clone_args *kargs)25732573+{25742574+ if (kargs->stack == 0) {25752575+ if (kargs->stack_size > 0)25762576+ return false;25772577+ } else {25782578+ if (kargs->stack_size == 0)25792579+ return false;25802580+25812581+ if (!access_ok((void __user *)kargs->stack, kargs->stack_size))25822582+ return false;25832583+25842584+#if !defined(CONFIG_STACK_GROWSUP) && !defined(CONFIG_IA64)25852585+ kargs->stack += kargs->stack_size;25862586+#endif25872587+ }25882588+25892589+ return true;25902590+}25912591+25922592+static bool clone3_args_valid(struct kernel_clone_args *kargs)25652593{25662594 /*25672595 * All lower bits of the flag word are taken.···2607257926082580 if ((kargs->flags & (CLONE_THREAD | CLONE_PARENT)) &&26092581 kargs->exit_signal)25822582+ return false;25832583+25842584+ if (!clone3_stack_valid(kargs))26102585 return false;2611258626122587 return true;
+6-1
lib/dump_stack.c
···106106 was_locked = 1;107107 } else {108108 local_irq_restore(flags);109109- cpu_relax();109109+ /*110110+ * Wait for the lock to release before jumping to111111+ * atomic_cmpxchg() in order to mitigate the thundering herd112112+ * problem.113113+ */114114+ do { cpu_relax(); } while (atomic_read(&dump_lock) != -1);110115 goto retry;111116 }112117
+11-20
lib/idr.c
···215215EXPORT_SYMBOL(idr_for_each);216216217217/**218218- * idr_get_next() - Find next populated entry.218218+ * idr_get_next_ul() - Find next populated entry.219219 * @idr: IDR handle.220220 * @nextid: Pointer to an ID.221221 *···224224 * to the ID of the found value. To use in a loop, the value pointed to by225225 * nextid must be incremented by the user.226226 */227227-void *idr_get_next(struct idr *idr, int *nextid)227227+void *idr_get_next_ul(struct idr *idr, unsigned long *nextid)228228{229229 struct radix_tree_iter iter;230230 void __rcu **slot;···245245 }246246 if (!slot)247247 return NULL;248248- id = iter.index + base;249248250250- if (WARN_ON_ONCE(id > INT_MAX))251251- return NULL;252252-253253- *nextid = id;249249+ *nextid = iter.index + base;254250 return entry;255251}256256-EXPORT_SYMBOL(idr_get_next);252252+EXPORT_SYMBOL(idr_get_next_ul);257253258254/**259259- * idr_get_next_ul() - Find next populated entry.255255+ * idr_get_next() - Find next populated entry.260256 * @idr: IDR handle.261257 * @nextid: Pointer to an ID.262258 *···261265 * to the ID of the found value. To use in a loop, the value pointed to by262266 * nextid must be incremented by the user.263267 */264264-void *idr_get_next_ul(struct idr *idr, unsigned long *nextid)268268+void *idr_get_next(struct idr *idr, int *nextid)265269{266266- struct radix_tree_iter iter;267267- void __rcu **slot;268268- unsigned long base = idr->idr_base;269270 unsigned long id = *nextid;271271+ void *entry = idr_get_next_ul(idr, &id);270272271271- id = (id < base) ? 0 : id - base;272272- slot = radix_tree_iter_find(&idr->idr_rt, &iter, id);273273- if (!slot)273273+ if (WARN_ON_ONCE(id > INT_MAX))274274 return NULL;275275-276276- *nextid = iter.index + base;277277- return rcu_dereference_raw(*slot);275275+ *nextid = id;276276+ return entry;278277}279279-EXPORT_SYMBOL(idr_get_next_ul);278278+EXPORT_SYMBOL(idr_get_next);280279281280/**282281 * idr_replace() - replace pointer for given ID.
+1-1
lib/radix-tree.c
···15291529 offset = radix_tree_find_next_bit(node, IDR_FREE,15301530 offset + 1);15311531 start = next_index(start, node, offset);15321532- if (start > max)15321532+ if (start > max || start == 0)15331533 return ERR_PTR(-ENOSPC);15341534 while (offset == RADIX_TREE_MAP_SIZE) {15351535 offset = node->offset + 1;
···994994995995 if (!xas_frozen(xas->xa_node))996996 xas->xa_index--;997997+ if (!xas->xa_node)998998+ return set_bounds(xas);997999 if (xas_not_node(xas->xa_node))9981000 return xas_load(xas);9991001···1033103110341032 if (!xas_frozen(xas->xa_node))10351033 xas->xa_index++;10341034+ if (!xas->xa_node)10351035+ return set_bounds(xas);10361036 if (xas_not_node(xas->xa_node))10371037 return xas_load(xas);10381038
+4-3
mm/khugepaged.c
···1028102810291029 anon_vma_lock_write(vma->anon_vma);1030103010311031- pte = pte_offset_map(pmd, address);10321032- pte_ptl = pte_lockptr(mm, pmd);10331033-10341031 mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL, mm,10351032 address, address + HPAGE_PMD_SIZE);10361033 mmu_notifier_invalidate_range_start(&range);10341034+10351035+ pte = pte_offset_map(pmd, address);10361036+ pte_ptl = pte_lockptr(mm, pmd);10371037+10371038 pmd_ptl = pmd_lock(mm, pmd); /* probably unnecessary */10381039 /*10391040 * After this gup_fast can't run anymore. This also removes
+16-7
mm/memcontrol.c
···484484 unsigned long ino = 0;485485486486 rcu_read_lock();487487- if (PageHead(page) && PageSlab(page))487487+ if (PageSlab(page) && !PageTail(page))488488 memcg = memcg_from_slab_page(page);489489 else490490 memcg = READ_ONCE(page->mem_cgroup);···25332533 batch = nr_pages;25342534 goto retry;25352535 }25362536+25372537+ /*25382538+ * Memcg doesn't have a dedicated reserve for atomic25392539+ * allocations. But like the global atomic pool, we need to25402540+ * put the burden of reclaim on regular allocation requests25412541+ * and let these go through as privileged allocations.25422542+ */25432543+ if (gfp_mask & __GFP_ATOMIC)25442544+ goto force;2536254525372546 /*25382547 * Unlike in global OOM situations, memcg is not in a physical···50235014{50245015 int node;5025501650265026- /*50275027- * Flush percpu vmstats and vmevents to guarantee the value correctness50285028- * on parent's and all ancestor levels.50295029- */50305030- memcg_flush_percpu_vmstats(memcg, false);50315031- memcg_flush_percpu_vmevents(memcg);50325017 for_each_node(node)50335018 free_mem_cgroup_per_node_info(memcg, node);50345019 free_percpu(memcg->vmstats_percpu);···50335030static void mem_cgroup_free(struct mem_cgroup *memcg)50345031{50355032 memcg_wb_domain_exit(memcg);50335033+ /*50345034+ * Flush percpu vmstats and vmevents to guarantee the value correctness50355035+ * on parent's and all ancestor levels.50365036+ */50375037+ memcg_flush_percpu_vmstats(memcg, false);50385038+ memcg_flush_percpu_vmevents(memcg);50365039 __mem_cgroup_free(memcg);50375040}50385041
+8
mm/memory_hotplug.c
···447447 zone->spanned_pages;448448449449 /* No need to lock the zones, they can't change. */450450+ if (!zone->spanned_pages)451451+ continue;452452+ if (!node_end_pfn) {453453+ node_start_pfn = zone->zone_start_pfn;454454+ node_end_pfn = zone_end_pfn;455455+ continue;456456+ }457457+450458 if (zone_end_pfn > node_end_pfn)451459 node_end_pfn = zone_end_pfn;452460 if (zone->zone_start_pfn < node_start_pfn)
···19481948 wait_for_completion(&pgdat_init_all_done_comp);1949194919501950 /*19511951+ * The number of managed pages has changed due to the initialisation19521952+ * so the pcpu batch and high limits needs to be updated or the limits19531953+ * will be artificially small.19541954+ */19551955+ for_each_populated_zone(zone)19561956+ zone_pcp_update(zone);19571957+19581958+ /*19511959 * We initialized the rest of the deferred pages. Permanently disable19521960 * on-demand struct page initialization.19531961 */···37283720static void warn_alloc_show_mem(gfp_t gfp_mask, nodemask_t *nodemask)37293721{37303722 unsigned int filter = SHOW_MEM_FILTER_NODES;37313731- static DEFINE_RATELIMIT_STATE(show_mem_rs, HZ, 1);37323732-37333733- if (!__ratelimit(&show_mem_rs))37343734- return;3735372337363724 /*37373725 * This documents exceptions given to allocations in certain···37483744{37493745 struct va_format vaf;37503746 va_list args;37513751- static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL,37523752- DEFAULT_RATELIMIT_BURST);37473747+ static DEFINE_RATELIMIT_STATE(nopage_rs, 10*HZ, 1);3753374837543749 if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs))37553750 return;···85178514 WARN(count != 0, "%d pages are still in use!\n", count);85188515}8519851685208520-#ifdef CONFIG_MEMORY_HOTPLUG85218517/*85228518 * The zone indicated has a new number of managed_pages; batch sizes and percpu85238519 * page high values need to be recalulated.···85308528 per_cpu_ptr(zone->pageset, cpu));85318529 mutex_unlock(&pcp_batch_high_lock);85328530}85338533-#endif8534853185358532void zone_pcp_reset(struct zone *zone)85368533{
+2-2
mm/slab.h
···323323 * Expects a pointer to a slab page. Please note, that PageSlab() check324324 * isn't sufficient, as it returns true also for tail compound slab pages,325325 * which do not have slab_cache pointer set.326326- * So this function assumes that the page can pass PageHead() and PageSlab()327327- * checks.326326+ * So this function assumes that the page can pass PageSlab() && !PageTail()327327+ * check.328328 *329329 * The kmem_cache can be reparented asynchronously. The caller must ensure330330 * the memcg lifetime, e.g. by taking rcu_read_lock() or cgroup_mutex.
+21-4
mm/vmstat.c
···13831383 unsigned long freecount = 0;13841384 struct free_area *area;13851385 struct list_head *curr;13861386+ bool overflow = false;1386138713871388 area = &(zone->free_area[order]);1388138913891389- list_for_each(curr, &area->free_list[mtype])13901390- freecount++;13911391- seq_printf(m, "%6lu ", freecount);13901390+ list_for_each(curr, &area->free_list[mtype]) {13911391+ /*13921392+ * Cap the free_list iteration because it might13931393+ * be really large and we are under a spinlock13941394+ * so a long time spent here could trigger a13951395+ * hard lockup detector. Anyway this is a13961396+ * debugging tool so knowing there is a handful13971397+ * of pages of this order should be more than13981398+ * sufficient.13991399+ */14001400+ if (++freecount >= 100000) {14011401+ overflow = true;14021402+ break;14031403+ }14041404+ }14051405+ seq_printf(m, "%s%6lu ", overflow ? ">" : "", freecount);14061406+ spin_unlock_irq(&zone->lock);14071407+ cond_resched();14081408+ spin_lock_irq(&zone->lock);13921409 }13931410 seq_putc(m, '\n');13941411 }···19891972#endif19901973#ifdef CONFIG_PROC_FS19911974 proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op);19921992- proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op);19751975+ proc_create_seq("pagetypeinfo", 0400, NULL, &pagetypeinfo_op);19931976 proc_create_seq("vmstat", 0444, NULL, &vmstat_op);19941977 proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);19951978#endif
+15-4
net/bridge/netfilter/ebt_dnat.c
···2020ebt_dnat_tg(struct sk_buff *skb, const struct xt_action_param *par)2121{2222 const struct ebt_nat_info *info = par->targinfo;2323- struct net_device *dev;24232524 if (skb_ensure_writable(skb, ETH_ALEN))2625 return EBT_DROP;···3233 else3334 skb->pkt_type = PACKET_MULTICAST;3435 } else {3535- if (xt_hooknum(par) != NF_BR_BROUTING)3636- dev = br_port_get_rcu(xt_in(par))->br->dev;3737- else3636+ const struct net_device *dev;3737+3838+ switch (xt_hooknum(par)) {3939+ case NF_BR_BROUTING:3840 dev = xt_in(par);4141+ break;4242+ case NF_BR_PRE_ROUTING:4343+ dev = br_port_get_rcu(xt_in(par))->br->dev;4444+ break;4545+ default:4646+ dev = NULL;4747+ break;4848+ }4949+5050+ if (!dev) /* NF_BR_LOCAL_OUT */5151+ return info->target;39524053 if (ether_addr_equal(info->mac, dev->dev_addr))4154 skb->pkt_type = PACKET_HOST;
+7-2
net/can/j1939/socket.c
···580580 j1939_netdev_stop(priv);581581 }582582583583+ kfree(jsk->filters);583584 sock_orphan(sk);584585 sock->sk = NULL;585586···910909 memset(serr, 0, sizeof(*serr));911910 switch (type) {912911 case J1939_ERRQUEUE_ACK:913913- if (!(sk->sk_tsflags & SOF_TIMESTAMPING_TX_ACK))912912+ if (!(sk->sk_tsflags & SOF_TIMESTAMPING_TX_ACK)) {913913+ kfree_skb(skb);914914 return;915915+ }915916916917 serr->ee.ee_errno = ENOMSG;917918 serr->ee.ee_origin = SO_EE_ORIGIN_TIMESTAMPING;···921918 state = "ACK";922919 break;923920 case J1939_ERRQUEUE_SCHED:924924- if (!(sk->sk_tsflags & SOF_TIMESTAMPING_TX_SCHED))921921+ if (!(sk->sk_tsflags & SOF_TIMESTAMPING_TX_SCHED)) {922922+ kfree_skb(skb);925923 return;924924+ }926925927926 serr->ee.ee_errno = ENOMSG;928927 serr->ee.ee_origin = SO_EE_ORIGIN_TIMESTAMPING;
···270270271271 msg->sg.data[i].length -= trim;272272 sk_mem_uncharge(sk, trim);273273+ /* Adjust copybreak if it falls into the trimmed part of last buf */274274+ if (msg->sg.curr == i && msg->sg.copybreak > msg->sg.data[i].length)275275+ msg->sg.copybreak = msg->sg.data[i].length;273276out:274274- /* If we trim data before curr pointer update copybreak and current275275- * so that any future copy operations start at new copy location.277277+ sk_msg_iter_var_next(i);278278+ msg->sg.end = i;279279+280280+ /* If we trim data a full sg elem before curr pointer update281281+ * copybreak and current so that any future copy operations282282+ * start at new copy location.276283 * However trimed data that has not yet been used in a copy op277284 * does not require an update.278285 */279279- if (msg->sg.curr >= i) {286286+ if (!msg->sg.size) {287287+ msg->sg.curr = msg->sg.start;288288+ msg->sg.copybreak = 0;289289+ } else if (sk_msg_iter_dist(msg->sg.start, msg->sg.curr) >=290290+ sk_msg_iter_dist(msg->sg.start, msg->sg.end)) {291291+ sk_msg_iter_var_prev(i);280292 msg->sg.curr = i;281293 msg->sg.copybreak = msg->sg.data[i].length;282294 }283283- sk_msg_iter_var_next(i);284284- msg->sg.end = i;285295}286296EXPORT_SYMBOL_GPL(sk_msg_trim);287297
···18141814 int ret = 0;18151815 unsigned int hash = fib_laddr_hashfn(local);18161816 struct hlist_head *head = &fib_info_laddrhash[hash];18171817+ int tb_id = l3mdev_fib_table(dev) ? : RT_TABLE_MAIN;18171818 struct net *net = dev_net(dev);18181818- int tb_id = l3mdev_fib_table(dev);18191819 struct fib_info *fi;1820182018211821 if (!fib_info_laddrhash || local == 0)
···9999 attrs[n]['name'].string(): attrs[n]['address']100100 for n in range(int(sect_attrs['nsections']))}101101 args = []102102- for section_name in [".data", ".data..read_mostly", ".rodata", ".bss"]:102102+ for section_name in [".data", ".data..read_mostly", ".rodata", ".bss",103103+ ".text", ".text.hot", ".text.unlikely"]:103104 address = section_name_to_address.get(section_name)104105 if address:105106 args.append(" -s {name} {addr}".format(
+3-3
scripts/nsdeps
···3131 local mod_file=`echo $@ | sed -e 's/\.ko/\.mod/'`3232 local ns_deps_file=`echo $@ | sed -e 's/\.ko/\.ns_deps/'`3333 if [ ! -f "$ns_deps_file" ]; then return; fi3434- local mod_source_files=`cat $mod_file | sed -n 1p \3434+ local mod_source_files="`cat $mod_file | sed -n 1p \3535 | sed -e 's/\.o/\.c/g' \3636- | sed "s|[^ ]* *|${srctree}/&|g"`3636+ | sed "s|[^ ]* *|${srctree}/&|g"`"3737 for ns in `cat $ns_deps_file`; do3838 echo "Adding namespace $ns to module $mod_name (if needed)."3939- generate_deps_for_ns $ns $mod_source_files3939+ generate_deps_for_ns $ns "$mod_source_files"4040 # sort the imports4141 for source_file in $mod_source_files; do4242 sed '/MODULE_IMPORT_NS/Q' $source_file > ${source_file}.tmp
···2727#define SAFFIRE_CLOCK_SOURCE_SPDIF 128282929/* clock sources as returned from register of Saffire Pro 10 and 26 */3030+#define SAFFIREPRO_CLOCK_SOURCE_SELECT_MASK 0x000000ff3131+#define SAFFIREPRO_CLOCK_SOURCE_DETECT_MASK 0x0000ff003032#define SAFFIREPRO_CLOCK_SOURCE_INTERNAL 03133#define SAFFIREPRO_CLOCK_SOURCE_SKIP 1 /* never used on hardware */3234#define SAFFIREPRO_CLOCK_SOURCE_SPDIF 2···191189 map = saffirepro_clk_maps[1];192190193191 /* In a case that this driver cannot handle the value of register. */192192+ value &= SAFFIREPRO_CLOCK_SOURCE_SELECT_MASK;194193 if (value >= SAFFIREPRO_CLOCK_SOURCE_COUNT || map[value] < 0) {195194 err = -EIO;196195 goto end;
+1-1
sound/pci/hda/patch_ca0132.c
···76047604 /* Delay enabling the HP amp, to let the mic-detection76057605 * state machine run.76067606 */76077607- cancel_delayed_work_sync(&spec->unsol_hp_work);76077607+ cancel_delayed_work(&spec->unsol_hp_work);76087608 schedule_delayed_work(&spec->unsol_hp_work, msecs_to_jiffies(500));76097609 tbl = snd_hda_jack_tbl_get(codec, cb->nid);76107610 if (tbl)
+13
sound/pci/hda/patch_hdmi.c
···28512851 return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map));28522852}2853285328542854+static int patch_i915_tgl_hdmi(struct hda_codec *codec)28552855+{28562856+ /*28572857+ * pin to port mapping table where the value indicate the pin number and28582858+ * the index indicate the port number with 1 base.28592859+ */28602860+ static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};28612861+28622862+ return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map));28632863+}28642864+28652865+28542866/* Intel Baytrail and Braswell; with eld notifier */28552867static int patch_i915_byt_hdmi(struct hda_codec *codec)28562868{···41654153HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi),41664154HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi),41674155HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi),41564156+HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi),41684157HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi),41694158HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi),41704159HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi),
···152152 */153153 dentry = file->f_path.dentry;154154 if (strcmp(dentry->d_name.name, "ipc_flood_count") &&155155- strcmp(dentry->d_name.name, "ipc_flood_duration_ms"))156156- return -EINVAL;155155+ strcmp(dentry->d_name.name, "ipc_flood_duration_ms")) {156156+ ret = -EINVAL;157157+ goto out;158158+ }157159158160 if (!strcmp(dentry->d_name.name, "ipc_flood_duration_ms"))159161 flood_duration_test = true;
+2-2
sound/soc/sof/intel/hda-stream.c
···190190 * Workaround to address a known issue with host DMA that results191191 * in xruns during pause/release in capture scenarios.192192 */193193- if (!IS_ENABLED(SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1))193193+ if (!IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1))194194 if (stream && direction == SNDRV_PCM_STREAM_CAPTURE)195195 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR,196196 HDA_VS_INTEL_EM2,···228228 spin_unlock_irq(&bus->reg_lock);229229230230 /* Enable DMI L1 entry if there are no capture streams open */231231- if (!IS_ENABLED(SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1))231231+ if (!IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1))232232 if (!active_capture_stream)233233 snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR,234234 HDA_VS_INTEL_EM2,
···3344bindir ?= /usr/bin5566-ifeq ($(srctree),)66+# This will work when gpio is built in tools env. where srctree77+# isn't set and when invoked from selftests build, where srctree88+# is set to ".". building_out_of_srctree is undefined for in srctree99+# builds1010+ifndef building_out_of_srctree711srctree := $(patsubst %/,%,$(dir $(CURDIR)))812srctree := $(patsubst %/,%,$(dir $(srctree)))913endif
+4-2
tools/perf/perf-sys.h
···1515void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,1616 int fd, int group_fd, unsigned long flags);17171818-#define HAVE_ATTR_TEST1818+#ifndef HAVE_ATTR_TEST1919+#define HAVE_ATTR_TEST 12020+#endif19212022static inline int2123sys_perf_event_open(struct perf_event_attr *attr,···2927 fd = syscall(__NR_perf_event_open, attr, pid, cpu,3028 group_fd, flags);31293232-#ifdef HAVE_ATTR_TEST3030+#if HAVE_ATTR_TEST3331 if (unlikely(test_attr__enabled))3432 test_attr__open(attr, pid, cpu, fd, group_fd, flags);3533#endif