···77disallowed-macros = [88 # The `clippy::dbg_macro` lint only works with `std::dbg!`, thus we simulate99 # it here, see: https://github.com/rust-lang/rust-clippy/issues/11303.1010- { path = "kernel::dbg", reason = "the `dbg!` macro is intended as a debugging tool" },1010+ { path = "kernel::dbg", reason = "the `dbg!` macro is intended as a debugging tool", allow-invalid = true },1111]
+4
.mailmap
···447447Luca Weiss <luca@lucaweiss.eu> <luca@z3ntu.xyz>448448Lukasz Luba <lukasz.luba@arm.com> <l.luba@partner.samsung.com>449449Luo Jie <quic_luoj@quicinc.com> <luoj@codeaurora.org>450450+Lance Yang <lance.yang@linux.dev> <ioworker0@gmail.com>451451+Lance Yang <lance.yang@linux.dev> <mingzhe.yang@ly.com>450452Maciej W. Rozycki <macro@mips.com> <macro@imgtec.com>451453Maciej W. Rozycki <macro@orcam.me.uk> <macro@linux-mips.org>452454Maharaja Kennadyrajan <quic_mkenna@quicinc.com> <mkenna@codeaurora.org>···485483Matthieu Baerts <matttbe@kernel.org> <matthieu.baerts@tessares.net>486484Matthieu CASTET <castet.matthieu@free.fr>487485Matti Vaittinen <mazziesaccount@gmail.com> <matti.vaittinen@fi.rohmeurope.com>486486+Mattijs Korpershoek <mkorpershoek@kernel.org> <mkorpershoek@baylibre.com>488487Matt Ranostay <matt@ranostay.sg> <matt.ranostay@konsulko.com>489488Matt Ranostay <matt@ranostay.sg> <matt@ranostay.consulting>490489Matt Ranostay <matt@ranostay.sg> Matthew Ranostay <mranostay@embeddedalley.com>···752749Tycho Andersen <tycho@tycho.pizza> <tycho@tycho.ws>753750Tzung-Bi Shih <tzungbi@kernel.org> <tzungbi@google.com>754751Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>752752+Uwe Kleine-König <u.kleine-koenig@baylibre.com> <ukleinek@baylibre.com>755753Uwe Kleine-König <u.kleine-koenig@pengutronix.de>756754Uwe Kleine-König <ukleinek@strlen.de>757755Uwe Kleine-König <ukl@pengutronix.de>
···7474 - rev-rmii7575 - moca76767777- # RX and TX delays are added by the MAC when required7777+ # RX and TX delays are provided by the PCB. See below7878 - rgmii79798080- # RGMII with internal RX and TX delays provided by the PHY,8181- # the MAC should not add the RX or TX delays in this case8080+ # RX and TX delays are not provided by the PCB. This is the most8181+ # frequent case. See below8282 - rgmii-id83838484- # RGMII with internal RX delay provided by the PHY, the MAC8585- # should not add an RX delay in this case8484+ # TX delay is provided by the PCB. See below8685 - rgmii-rxid87868888- # RGMII with internal TX delay provided by the PHY, the MAC8989- # should not add an TX delay in this case8787+ # RX delay is provided by the PCB. See below9088 - rgmii-txid9189 - rtbi9290 - smii···284286285287additionalProperties: true286288289289+# Informative290290+# ===========291291+#292292+# 'phy-modes' & 'phy-connection-type' properties 'rgmii', 'rgmii-id',293293+# 'rgmii-rxid', and 'rgmii-txid' are frequently used wrongly by294294+# developers. This informative section clarifies their usage.295295+#296296+# The RGMII specification requires a 2ns delay between the data and297297+# clock signals on the RGMII bus. How this delay is implemented is not298298+# specified.299299+#300300+# One option is to make the clock traces on the PCB longer than the301301+# data traces. A sufficiently difference in length can provide the 2ns302302+# delay. If both the RX and TX delays are implemented in this manner,303303+# 'rgmii' should be used, so indicating the PCB adds the delays.304304+#305305+# If the PCB does not add these delays via extra long traces,306306+# 'rgmii-id' should be used. Here, 'id' refers to 'internal delay',307307+# where either the MAC or PHY adds the delay.308308+#309309+# If only one of the two delays are implemented via extra long clock310310+# lines, either 'rgmii-rxid' or 'rgmii-txid' should be used,311311+# indicating the MAC or PHY should implement one of the delays312312+# internally, while the PCB implements the other delay.313313+#314314+# Device Tree describes hardware, and in this case, it describes the315315+# PCB between the MAC and the PHY, if the PCB implements delays or316316+# not.317317+#318318+# In practice, very few PCBs make use of extra long clock lines. Hence319319+# any RGMII phy mode other than 'rgmii-id' is probably wrong, and is320320+# unlikely to be accepted during review without details provided in321321+# the commit description and comments in the .dts file.322322+#323323+# When the PCB does not implement the delays, the MAC or PHY must. As324324+# such, this is software configuration, and so not described in Device325325+# Tree.326326+#327327+# The following describes how Linux implements the configuration of328328+# the MAC and PHY to add these delays when the PCB does not. As stated329329+# above, developers often get this wrong, and the aim of this section330330+# is reduce the frequency of these errors by Linux developers. Other331331+# users of the Device Tree may implement it differently, and still be332332+# consistent with both the normative and informative description333333+# above.334334+#335335+# By default in Linux, when using phylib/phylink, the MAC is expected336336+# to read the 'phy-mode' from Device Tree, not implement any delays,337337+# and pass the value to the PHY. The PHY will then implement delays as338338+# specified by the 'phy-mode'. The PHY should always be reconfigured339339+# to implement the needed delays, replacing any setting performed by340340+# strapping or the bootloader, etc.341341+#342342+# Experience to date is that all PHYs which implement RGMII also343343+# implement the ability to add or not add the needed delays. Hence344344+# this default is expected to work in all cases. Ignoring this default345345+# is likely to be questioned by Reviews, and require a strong argument346346+# to be accepted.347347+#348348+# There are a small number of cases where the MAC has hard coded349349+# delays which cannot be disabled. The 'phy-mode' only describes the350350+# PCB. The inability to disable the delays in the MAC does not change351351+# the meaning of 'phy-mode'. It does however mean that a 'phy-mode' of352352+# 'rgmii' is now invalid, it cannot be supported, since both the PCB353353+# and the MAC and PHY adding delays cannot result in a functional354354+# link. Thus the MAC should report a fatal error for any modes which355355+# cannot be supported. When the MAC implements the delay, it must356356+# ensure that the PHY does not also implement the same delay. So it357357+# must modify the phy-mode it passes to the PHY, removing the delay it358358+# has added. Failure to remove the delay will result in a359359+# non-functioning link.360360+#361361+# Sometimes there is a need to fine tune the delays. Often the MAC or362362+# PHY can perform this fine tuning. In the MAC node, the Device Tree363363+# properties 'rx-internal-delay-ps' and 'tx-internal-delay-ps' should364364+# be used to indicate fine tuning performed by the MAC. The values365365+# expected here are small. A value of 2000ps, i.e 2ns, and a phy-mode366366+# of 'rgmii' will not be accepted by Reviewers.367367+#368368+# If the PHY is to perform fine tuning, the properties369369+# 'rx-internal-delay-ps' and 'tx-internal-delay-ps' in the PHY node370370+# should be used. When the PHY is implementing delays, e.g. 'rgmii-id'371371+# these properties should have a value near to 2000ps. If the PCB is372372+# implementing delays, e.g. 'rgmii', a small value can be used to fine373373+# tune the delay added by the PCB.287374...
···114114115115DECLARE_BITMAP(boot_cpucaps, ARM64_NCAPS);116116117117-bool arm64_use_ng_mappings = false;117117+/*118118+ * arm64_use_ng_mappings must be placed in the .data section, otherwise it119119+ * ends up in the .bss section where it is initialized in early_map_kernel()120120+ * after the MMU (with the idmap) was enabled. create_init_idmap() - which121121+ * runs before early_map_kernel() and reads the variable via PTE_MAYBE_NG -122122+ * may end up generating an incorrect idmap page table attributes.123123+ */124124+bool arm64_use_ng_mappings __read_mostly = false;118125EXPORT_SYMBOL(arm64_use_ng_mappings);119126120127DEFINE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector) = vectors;
···503503{504504 int ret;505505506506- if (!addr_is_memory(addr))506506+ if (!range_is_memory(addr, addr + size))507507 return -EPERM;508508509509 ret = host_stage2_try(kvm_pgtable_stage2_set_owner, &host_mmu.pgt,
+21-15
arch/arm64/kvm/hyp/vgic-v3-sr.c
···429429 /*430430 * To check whether we have a MMIO-based (GICv2 compatible)431431 * CPU interface, we need to disable the system register432432- * view. To do that safely, we have to prevent any interrupt433433- * from firing (which would be deadly).432432+ * view.434433 *435435- * Note that this only makes sense on VHE, as interrupts are436436- * already masked for nVHE as part of the exception entry to437437- * EL2.438438- */439439- if (has_vhe())440440- flags = local_daif_save();441441-442442- /*443434 * Table 11-2 "Permitted ICC_SRE_ELx.SRE settings" indicates444435 * that to be able to set ICC_SRE_EL1.SRE to 0, all the445436 * interrupt overrides must be set. You've got to love this.437437+ *438438+ * As we always run VHE with HCR_xMO set, no extra xMO439439+ * manipulation is required in that case.440440+ *441441+ * To safely disable SRE, we have to prevent any interrupt442442+ * from firing (which would be deadly). This only makes sense443443+ * on VHE, as interrupts are already masked for nVHE as part444444+ * of the exception entry to EL2.446445 */447447- sysreg_clear_set(hcr_el2, 0, HCR_AMO | HCR_FMO | HCR_IMO);448448- isb();446446+ if (has_vhe()) {447447+ flags = local_daif_save();448448+ } else {449449+ sysreg_clear_set(hcr_el2, 0, HCR_AMO | HCR_FMO | HCR_IMO);450450+ isb();451451+ }452452+449453 write_gicreg(0, ICC_SRE_EL1);450454 isb();451455···457453458454 write_gicreg(sre, ICC_SRE_EL1);459455 isb();460460- sysreg_clear_set(hcr_el2, HCR_AMO | HCR_FMO | HCR_IMO, 0);461461- isb();462456463463- if (has_vhe())457457+ if (has_vhe()) {464458 local_daif_restore(flags);459459+ } else {460460+ sysreg_clear_set(hcr_el2, HCR_AMO | HCR_FMO | HCR_IMO, 0);461461+ isb();462462+ }465463466464 val = (val & ICC_SRE_EL1_SRE) ? 0 : (1ULL << 63);467465 val |= read_gicreg(ICH_VTR_EL2);
+8-5
arch/arm64/kvm/mmu.c
···15011501 return -EFAULT;15021502 }1503150315041504+ if (!is_protected_kvm_enabled())15051505+ memcache = &vcpu->arch.mmu_page_cache;15061506+ else15071507+ memcache = &vcpu->arch.pkvm_memcache;15081508+15041509 /*15051510 * Permission faults just need to update the existing leaf entry,15061511 * and so normally don't require allocations from the memcache. The···15151510 if (!fault_is_perm || (logging_active && write_fault)) {15161511 int min_pages = kvm_mmu_cache_min_pages(vcpu->arch.hw_mmu);1517151215181518- if (!is_protected_kvm_enabled()) {15191519- memcache = &vcpu->arch.mmu_page_cache;15131513+ if (!is_protected_kvm_enabled())15201514 ret = kvm_mmu_topup_memory_cache(memcache, min_pages);15211521- } else {15221522- memcache = &vcpu->arch.pkvm_memcache;15151515+ else15231516 ret = topup_hyp_memcache(memcache, min_pages);15241524- }15171517+15251518 if (ret)15261519 return ret;15271520 }
+6
arch/arm64/kvm/sys_regs.c
···19451945 if ((hw_val & mpam_mask) == (user_val & mpam_mask))19461946 user_val &= ~ID_AA64PFR0_EL1_MPAM_MASK;1947194719481948+ /* Fail the guest's request to disable the AA64 ISA at EL{0,1,2} */19491949+ if (!FIELD_GET(ID_AA64PFR0_EL1_EL0, user_val) ||19501950+ !FIELD_GET(ID_AA64PFR0_EL1_EL1, user_val) ||19511951+ (vcpu_has_nv(vcpu) && !FIELD_GET(ID_AA64PFR0_EL1_EL2, user_val)))19521952+ return -EINVAL;19531953+19481954 return set_id_reg(vcpu, rd, user_val);19491955}19501956
···65656666/* Query offset/name of register from its name/offset */6767extern int regs_query_register_offset(const char *name);6868-#define MAX_REG_OFFSET (offsetof(struct pt_regs, __last))6868+#define MAX_REG_OFFSET \6969+ (offsetof(struct pt_regs, __last) - sizeof(unsigned long))69707071/**7172 * regs_get_register() - get register value from its offset
+41-30
arch/mips/kernel/genex.S
···104104105105 __FINIT106106107107- .align 5 /* 32 byte rollback region */108108-LEAF(__r4k_wait)109109- .set push110110- .set noreorder111111- /* start of rollback region */112112- LONG_L t0, TI_FLAGS($28)113113- nop114114- andi t0, _TIF_NEED_RESCHED115115- bnez t0, 1f116116- nop117117- nop118118- nop119119-#ifdef CONFIG_CPU_MICROMIPS120120- nop121121- nop122122- nop123123- nop124124-#endif107107+ .section .cpuidle.text,"ax"108108+ /* Align to 32 bytes for the maximum idle interrupt region size. */109109+ .align 5110110+LEAF(r4k_wait)111111+ /* Keep the ISA bit clear for calculations on local labels here. */112112+0: .fill 0113113+ /* Start of idle interrupt region. */114114+ local_irq_enable115115+ /*116116+ * If an interrupt lands here, before going idle on the next117117+ * instruction, we must *NOT* go idle since the interrupt could118118+ * have set TIF_NEED_RESCHED or caused a timer to need resched.119119+ * Fall through -- see skipover_handler below -- and have the120120+ * idle loop take care of things.121121+ */122122+1: .fill 0123123+ /* The R2 EI/EHB sequence takes 8 bytes, otherwise pad up. */124124+ .if 1b - 0b > 32125125+ .error "overlong idle interrupt region"126126+ .elseif 1b - 0b > 8127127+ .align 4128128+ .endif129129+2: .fill 0130130+ .equ r4k_wait_idle_size, 2b - 0b131131+ /* End of idle interrupt region; size has to be a power of 2. */125132 .set MIPS_ISA_ARCH_LEVEL_RAW133133+r4k_wait_insn:126134 wait127127- /* end of rollback region (the region size must be power of two) */128128-1:135135+r4k_wait_exit:136136+ .set mips0137137+ local_irq_disable129138 jr ra130130- nop131131- .set pop132132- END(__r4k_wait)139139+ END(r4k_wait)140140+ .previous133141134134- .macro BUILD_ROLLBACK_PROLOGUE handler135135- FEXPORT(rollback_\handler)142142+ .macro BUILD_SKIPOVER_PROLOGUE handler143143+ FEXPORT(skipover_\handler)136144 .set push137145 .set noat138146 MFC0 k0, CP0_EPC139139- PTR_LA k1, __r4k_wait140140- ori k0, 0x1f /* 32 byte rollback region */141141- xori k0, 0x1f147147+ /* Subtract/add 2 to let the ISA bit propagate through the mask. */148148+ PTR_LA k1, r4k_wait_insn - 2149149+ ori k0, r4k_wait_idle_size - 2150150+ .set noreorder142151 bne k0, k1, \handler152152+ PTR_ADDIU k0, r4k_wait_exit - r4k_wait_insn + 2153153+ .set reorder143154 MTC0 k0, CP0_EPC144155 .set pop145156 .endm146157147158 .align 5148148-BUILD_ROLLBACK_PROLOGUE handle_int159159+BUILD_SKIPOVER_PROLOGUE handle_int149160NESTED(handle_int, PT_SIZE, sp)150161 .cfi_signal_frame151162#ifdef CONFIG_TRACE_IRQFLAGS···276265 * This prototype is copied to ebase + n*IntCtl.VS and patched277266 * to invoke the handler278267 */279279-BUILD_ROLLBACK_PROLOGUE except_vec_vi268268+BUILD_SKIPOVER_PROLOGUE except_vec_vi280269NESTED(except_vec_vi, 0, sp)281270 SAVE_SOME docfi=1282271 SAVE_AT docfi=1
-7
arch/mips/kernel/idle.c
···3535 write_c0_conf(cfg | R30XX_CONF_HALT);3636}37373838-void __cpuidle r4k_wait(void)3939-{4040- raw_local_irq_enable();4141- __r4k_wait();4242- raw_local_irq_disable();4343-}4444-4538/*4639 * This variant is preferable as it allows testing need_resched and going to4740 * sleep depending on the outcome atomically. Unfortunately the "It is
+4
arch/mips/kernel/smp-cps.c
···332332 mips_cps_cluster_bootcfg = kcalloc(nclusters,333333 sizeof(*mips_cps_cluster_bootcfg),334334 GFP_KERNEL);335335+ if (!mips_cps_cluster_bootcfg)336336+ goto err_out;335337336338 if (nclusters > 1)337339 mips_cm_update_property();···350348 mips_cps_cluster_bootcfg[cl].core_power =351349 kcalloc(BITS_TO_LONGS(ncores), sizeof(unsigned long),352350 GFP_KERNEL);351351+ if (!mips_cps_cluster_bootcfg[cl].core_power)352352+ goto err_out;353353354354 /* Allocate VPE boot configuration structs */355355 for (c = 0; c < ncores; c++) {
···275275 unsigned long pmm;276276 u8 pmlen;277277278278+ if (!riscv_has_extension_unlikely(RISCV_ISA_EXT_SUPM))279279+ return -EINVAL;280280+278281 if (is_compat_thread(ti))279282 return -EINVAL;280283···332329{333330 struct thread_info *ti = task_thread_info(task);334331 long ret = 0;332332+333333+ if (!riscv_has_extension_unlikely(RISCV_ISA_EXT_SUPM))334334+ return -EINVAL;335335336336 if (is_compat_thread(ti))337337 return -EINVAL;
···3838CONFIG_CHECKPOINT_RESTORE=y3939CONFIG_SCHED_AUTOGROUP=y4040CONFIG_EXPERT=y4141-# CONFIG_SYSFS_SYSCALL is not set4241CONFIG_PROFILING=y4342CONFIG_KEXEC=y4443CONFIG_KEXEC_FILE=y···9192CONFIG_IOSCHED_BFQ=y9293CONFIG_BINFMT_MISC=m9394CONFIG_ZSWAP=y9494-CONFIG_ZSMALLOC=y9595CONFIG_ZSMALLOC_STAT=y9696CONFIG_SLAB_BUCKETS=y9797CONFIG_SLUB_STATS=y···393395CONFIG_NET_CLS_FLOW=m394396CONFIG_NET_CLS_CGROUP=y395397CONFIG_NET_CLS_BPF=m398398+CONFIG_NET_CLS_FLOWER=m399399+CONFIG_NET_CLS_MATCHALL=m400400+CONFIG_NET_EMATCH=y396401CONFIG_NET_CLS_ACT=y397402CONFIG_NET_ACT_POLICE=m398403CONFIG_NET_ACT_GACT=m···406405CONFIG_NET_ACT_SIMP=m407406CONFIG_NET_ACT_SKBEDIT=m408407CONFIG_NET_ACT_CSUM=m408408+CONFIG_NET_ACT_VLAN=m409409+CONFIG_NET_ACT_TUNNEL_KEY=m410410+CONFIG_NET_ACT_CT=m409411CONFIG_NET_ACT_GATE=m410412CONFIG_NET_TC_SKB_EXT=y411413CONFIG_DNS_RESOLVER=y···632628CONFIG_VIRTIO_BALLOON=m633629CONFIG_VIRTIO_MEM=m634630CONFIG_VIRTIO_INPUT=y631631+CONFIG_VDPA=m632632+CONFIG_VDPA_SIM=m633633+CONFIG_VDPA_SIM_NET=m634634+CONFIG_VDPA_SIM_BLOCK=m635635+CONFIG_VDPA_USER=m636636+CONFIG_MLX5_VDPA_NET=m637637+CONFIG_VP_VDPA=m635638CONFIG_VHOST_NET=m636639CONFIG_VHOST_VSOCK=m640640+CONFIG_VHOST_VDPA=m637641CONFIG_EXT4_FS=y638642CONFIG_EXT4_FS_POSIX_ACL=y639643CONFIG_EXT4_FS_SECURITY=y···666654CONFIG_BCACHEFS_FS=y667655CONFIG_BCACHEFS_QUOTA=y668656CONFIG_BCACHEFS_POSIX_ACL=y669669-CONFIG_FS_DAX=y670657CONFIG_EXPORTFS_BLOCK_OPS=y671658CONFIG_FS_ENCRYPTION=y672659CONFIG_FS_VERITY=y···735724CONFIG_DLM=m736725CONFIG_UNICODE=y737726CONFIG_PERSISTENT_KEYRINGS=y727727+CONFIG_BIG_KEYS=y738728CONFIG_ENCRYPTED_KEYS=m739729CONFIG_KEY_NOTIFICATIONS=y740730CONFIG_SECURITY=y741741-CONFIG_HARDENED_USERCOPY=y742742-CONFIG_FORTIFY_SOURCE=y743731CONFIG_SECURITY_SELINUX=y744732CONFIG_SECURITY_SELINUX_BOOTPARAM=y745733CONFIG_SECURITY_LOCKDOWN_LSM=y···751741CONFIG_IMA_DEFAULT_HASH_SHA256=y752742CONFIG_IMA_WRITE_POLICY=y753743CONFIG_IMA_APPRAISE=y744744+CONFIG_FORTIFY_SOURCE=y745745+CONFIG_HARDENED_USERCOPY=y754746CONFIG_BUG_ON_DATA_CORRUPTION=y755747CONFIG_CRYPTO_USER=m756748# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set···768756CONFIG_CRYPTO_ANUBIS=m769757CONFIG_CRYPTO_ARIA=m770758CONFIG_CRYPTO_BLOWFISH=m771771-CONFIG_CRYPTO_CAMELLIA=m772759CONFIG_CRYPTO_CAST5=m773760CONFIG_CRYPTO_CAST6=m774761CONFIG_CRYPTO_DES=m···812801CONFIG_CRYPTO_GHASH_S390=m813802CONFIG_CRYPTO_AES_S390=m814803CONFIG_CRYPTO_DES_S390=m815815-CONFIG_CRYPTO_CHACHA_S390=m816804CONFIG_CRYPTO_HMAC_S390=m817805CONFIG_ZCRYPT=m818806CONFIG_PKEY=m···822812CONFIG_CRYPTO_PAES_S390=m823813CONFIG_CRYPTO_DEV_VIRTIO=m824814CONFIG_SYSTEM_BLACKLIST_KEYRING=y815815+CONFIG_CRYPTO_KRB5=m816816+CONFIG_CRYPTO_KRB5_SELFTESTS=y825817CONFIG_CORDIC=m826826-CONFIG_CRYPTO_LIB_CURVE25519=m827827-CONFIG_CRYPTO_LIB_CHACHA20POLY1305=m828818CONFIG_RANDOM32_SELFTEST=y829819CONFIG_XZ_DEC_MICROLZMA=y830820CONFIG_DMA_CMA=y
+17-7
arch/s390/configs/defconfig
···3636CONFIG_CHECKPOINT_RESTORE=y3737CONFIG_SCHED_AUTOGROUP=y3838CONFIG_EXPERT=y3939-# CONFIG_SYSFS_SYSCALL is not set4039CONFIG_PROFILING=y4140CONFIG_KEXEC=y4241CONFIG_KEXEC_FILE=y···8586CONFIG_IOSCHED_BFQ=y8687CONFIG_BINFMT_MISC=m8788CONFIG_ZSWAP=y8888-CONFIG_ZSMALLOC=y8989CONFIG_ZSMALLOC_STAT=y9090CONFIG_SLAB_BUCKETS=y9191# CONFIG_COMPAT_BRK is not set···383385CONFIG_NET_CLS_FLOW=m384386CONFIG_NET_CLS_CGROUP=y385387CONFIG_NET_CLS_BPF=m388388+CONFIG_NET_CLS_FLOWER=m389389+CONFIG_NET_CLS_MATCHALL=m390390+CONFIG_NET_EMATCH=y386391CONFIG_NET_CLS_ACT=y387392CONFIG_NET_ACT_POLICE=m388393CONFIG_NET_ACT_GACT=m···396395CONFIG_NET_ACT_SIMP=m397396CONFIG_NET_ACT_SKBEDIT=m398397CONFIG_NET_ACT_CSUM=m398398+CONFIG_NET_ACT_VLAN=m399399+CONFIG_NET_ACT_TUNNEL_KEY=m400400+CONFIG_NET_ACT_CT=m399401CONFIG_NET_ACT_GATE=m400402CONFIG_NET_TC_SKB_EXT=y401403CONFIG_DNS_RESOLVER=y···622618CONFIG_VIRTIO_BALLOON=m623619CONFIG_VIRTIO_MEM=m624620CONFIG_VIRTIO_INPUT=y621621+CONFIG_VDPA=m622622+CONFIG_VDPA_SIM=m623623+CONFIG_VDPA_SIM_NET=m624624+CONFIG_VDPA_SIM_BLOCK=m625625+CONFIG_VDPA_USER=m626626+CONFIG_MLX5_VDPA_NET=m627627+CONFIG_VP_VDPA=m625628CONFIG_VHOST_NET=m626629CONFIG_VHOST_VSOCK=m630630+CONFIG_VHOST_VDPA=m627631CONFIG_EXT4_FS=y628632CONFIG_EXT4_FS_POSIX_ACL=y629633CONFIG_EXT4_FS_SECURITY=y···653641CONFIG_BCACHEFS_FS=m654642CONFIG_BCACHEFS_QUOTA=y655643CONFIG_BCACHEFS_POSIX_ACL=y656656-CONFIG_FS_DAX=y657644CONFIG_EXPORTFS_BLOCK_OPS=y658645CONFIG_FS_ENCRYPTION=y659646CONFIG_FS_VERITY=y···722711CONFIG_DLM=m723712CONFIG_UNICODE=y724713CONFIG_PERSISTENT_KEYRINGS=y714714+CONFIG_BIG_KEYS=y725715CONFIG_ENCRYPTED_KEYS=m726716CONFIG_KEY_NOTIFICATIONS=y727717CONFIG_SECURITY=y···754742CONFIG_CRYPTO_ANUBIS=m755743CONFIG_CRYPTO_ARIA=m756744CONFIG_CRYPTO_BLOWFISH=m757757-CONFIG_CRYPTO_CAMELLIA=m758745CONFIG_CRYPTO_CAST5=m759746CONFIG_CRYPTO_CAST6=m760747CONFIG_CRYPTO_DES=m···799788CONFIG_CRYPTO_GHASH_S390=m800789CONFIG_CRYPTO_AES_S390=m801790CONFIG_CRYPTO_DES_S390=m802802-CONFIG_CRYPTO_CHACHA_S390=m803791CONFIG_CRYPTO_HMAC_S390=m804792CONFIG_ZCRYPT=m805793CONFIG_PKEY=m···809799CONFIG_CRYPTO_PAES_S390=m810800CONFIG_CRYPTO_DEV_VIRTIO=m811801CONFIG_SYSTEM_BLACKLIST_KEYRING=y802802+CONFIG_CRYPTO_KRB5=m803803+CONFIG_CRYPTO_KRB5_SELFTESTS=y812804CONFIG_CORDIC=m813805CONFIG_PRIME_NUMBERS=m814814-CONFIG_CRYPTO_LIB_CURVE25519=m815815-CONFIG_CRYPTO_LIB_CHACHA20POLY1305=m816806CONFIG_XZ_DEC_MICROLZMA=y817807CONFIG_DMA_CMA=y818808CONFIG_CMA_SIZE_MBYTES=0
-1
arch/s390/configs/zfcpdump_defconfig
···7070CONFIG_DEBUG_INFO_DWARF4=y7171CONFIG_DEBUG_FS=y7272CONFIG_PANIC_ON_OOPS=y7373-# CONFIG_SCHED_DEBUG is not set7473CONFIG_RCU_CPU_STALL_TIMEOUT=607574# CONFIG_RCU_TRACE is not set7675# CONFIG_FTRACE is not set
+2-1
arch/s390/kernel/entry.S
···602602 stmg %r0,%r7,__PT_R0(%r11)603603 stmg %r8,%r9,__PT_PSW(%r11)604604 mvc __PT_R8(64,%r11),0(%r14)605605- stg %r10,__PT_ORIG_GPR2(%r11) # store last break to orig_gpr2605605+ GET_LC %r2606606+ mvc __PT_ORIG_GPR2(8,%r11),__LC_PGM_LAST_BREAK(%r2)606607 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)607608 lgr %r2,%r11 # pass pointer to pt_regs608609 jg kernel_stack_invalid
···225225 panic("Failed to sync kernel TLBs: %d", err);226226 goto out;227227 }228228- else if (current->mm == NULL) {229229- if (current->pagefault_disabled) {230230- if (!mc) {231231- show_regs(container_of(regs, struct pt_regs, regs));232232- panic("Segfault with pagefaults disabled but no mcontext");233233- }234234- if (!current->thread.segv_continue) {235235- show_regs(container_of(regs, struct pt_regs, regs));236236- panic("Segfault without recovery target");237237- }238238- mc_set_rip(mc, current->thread.segv_continue);239239- current->thread.segv_continue = NULL;240240- goto out;228228+ else if (current->pagefault_disabled) {229229+ if (!mc) {230230+ show_regs(container_of(regs, struct pt_regs, regs));231231+ panic("Segfault with pagefaults disabled but no mcontext");241232 }233233+ if (!current->thread.segv_continue) {234234+ show_regs(container_of(regs, struct pt_regs, regs));235235+ panic("Segfault without recovery target");236236+ }237237+ mc_set_rip(mc, current->thread.segv_continue);238238+ current->thread.segv_continue = NULL;239239+ goto out;240240+ }241241+ else if (current->mm == NULL) {242242 show_regs(container_of(regs, struct pt_regs, regs));243243 panic("Segfault with no mm");244244 }
+1
arch/x86/Kconfig
···23682368config CFI_AUTO_DEFAULT23692369 bool "Attempt to use FineIBT by default at boot time"23702370 depends on FINEIBT23712371+ depends on !RUST || RUSTC_VERSION >= 10880023712372 default y23722373 help23732374 Attempt to use FineIBT by default at boot time. If enabled,
···1098109810991099static int __init save_microcode_in_initrd(void)11001100{11011101- unsigned int cpuid_1_eax = native_cpuid_eax(1);11021101 struct cpuinfo_x86 *c = &boot_cpu_data;11031102 struct cont_desc desc = { 0 };11031103+ unsigned int cpuid_1_eax;11041104 enum ucode_state ret;11051105 struct cpio_data cp;1106110611071107- if (dis_ucode_ldr || c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10)11071107+ if (microcode_loader_disabled() || c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10)11081108 return 0;11091109+11101110+ cpuid_1_eax = native_cpuid_eax(1);1109111111101112 if (!find_blobs_in_containers(&cp))11111113 return -EINVAL;
+35-25
arch/x86/kernel/cpu/microcode/core.c
···41414242#include "internal.h"43434444-static struct microcode_ops *microcode_ops;4545-bool dis_ucode_ldr = true;4444+static struct microcode_ops *microcode_ops;4545+static bool dis_ucode_ldr = false;46464747bool force_minrev = IS_ENABLED(CONFIG_MICROCODE_LATE_FORCE_MINREV);4848module_param(force_minrev, bool, S_IRUSR | S_IWUSR);···8484 u32 lvl, dummy, i;8585 u32 *levels;86868787+ if (x86_cpuid_vendor() != X86_VENDOR_AMD)8888+ return false;8989+8790 native_rdmsr(MSR_AMD64_PATCH_LEVEL, lvl, dummy);88918992 levels = final_levels;···9895 return false;9996}10097101101-static bool __init check_loader_disabled_bsp(void)9898+bool __init microcode_loader_disabled(void)10299{103103- static const char *__dis_opt_str = "dis_ucode_ldr";104104- const char *cmdline = boot_command_line;105105- const char *option = __dis_opt_str;106106-107107- /*108108- * CPUID(1).ECX[31]: reserved for hypervisor use. This is still not109109- * completely accurate as xen pv guests don't see that CPUID bit set but110110- * that's good enough as they don't land on the BSP path anyway.111111- */112112- if (native_cpuid_ecx(1) & BIT(31))100100+ if (dis_ucode_ldr)113101 return true;114102115115- if (x86_cpuid_vendor() == X86_VENDOR_AMD) {116116- if (amd_check_current_patch_level())117117- return true;118118- }119119-120120- if (cmdline_find_option_bool(cmdline, option) <= 0)121121- dis_ucode_ldr = false;103103+ /*104104+ * Disable when:105105+ *106106+ * 1) The CPU does not support CPUID.107107+ *108108+ * 2) Bit 31 in CPUID[1]:ECX is clear109109+ * The bit is reserved for hypervisor use. This is still not110110+ * completely accurate as XEN PV guests don't see that CPUID bit111111+ * set, but that's good enough as they don't land on the BSP112112+ * path anyway.113113+ *114114+ * 3) Certain AMD patch levels are not allowed to be115115+ * overwritten.116116+ */117117+ if (!have_cpuid_p() ||118118+ native_cpuid_ecx(1) & BIT(31) ||119119+ amd_check_current_patch_level())120120+ dis_ucode_ldr = true;122121123122 return dis_ucode_ldr;124123}···130125 unsigned int cpuid_1_eax;131126 bool intel = true;132127133133- if (!have_cpuid_p())128128+ if (cmdline_find_option_bool(boot_command_line, "dis_ucode_ldr") > 0)129129+ dis_ucode_ldr = true;130130+131131+ if (microcode_loader_disabled())134132 return;135133136134 cpuid_1_eax = native_cpuid_eax(1);···154146 return;155147 }156148157157- if (check_loader_disabled_bsp())158158- return;159159-160149 if (intel)161150 load_ucode_intel_bsp(&early_data);162151 else···164159{165160 unsigned int cpuid_1_eax;166161162162+ /*163163+ * Can't use microcode_loader_disabled() here - .init section164164+ * hell. It doesn't have to either - the BSP variant must've165165+ * parsed cmdline already anyway.166166+ */167167 if (dis_ucode_ldr)168168 return;169169···820810 struct cpuinfo_x86 *c = &boot_cpu_data;821811 int error;822812823823- if (dis_ucode_ldr)813813+ if (microcode_loader_disabled())824814 return -EINVAL;825815826816 if (c->x86_vendor == X86_VENDOR_INTEL)
+1-1
arch/x86/kernel/cpu/microcode/intel.c
···389389 if (xchg(&ucode_patch_va, NULL) != UCODE_BSP_LOADED)390390 return 0;391391392392- if (dis_ucode_ldr || boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)392392+ if (microcode_loader_disabled() || boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)393393 return 0;394394395395 uci.mc = get_microcode_blob(&uci, true);
···145145 *ptr = (unsigned long)ptep + PAGE_OFFSET;146146147147#ifdef CONFIG_MICROCODE_INITRD32148148- /* Running on a hypervisor? */149149- if (native_cpuid_ecx(1) & BIT(31))150150- return;151151-152148 params = (struct boot_params *)__pa_nodebug(&boot_params);153149 if (!params->hdr.ramdisk_size || !params->hdr.ramdisk_image)154150 return;
+9-1
arch/x86/kernel/vmlinux.lds.S
···466466}467467468468/*469469- * The ASSERT() sink to . is intentional, for binutils 2.14 compatibility:469469+ * COMPILE_TEST kernels can be large - CONFIG_KASAN, for example, can cause470470+ * this. Let's assume that nobody will be running a COMPILE_TEST kernel and471471+ * let's assert that fuller build coverage is more valuable than being able to472472+ * run a COMPILE_TEST kernel.473473+ */474474+#ifndef CONFIG_COMPILE_TEST475475+/*476476+ * The ASSERT() sync to . is intentional, for binutils 2.14 compatibility:470477 */471478. = ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),472479 "kernel image bigger than KERNEL_IMAGE_SIZE");480480+#endif473481474482/* needed for Clang - see arch/x86/entry/entry.S */475483PROVIDE(__ref_stack_chk_guard = __stack_chk_guard);
+3
arch/x86/kvm/mmu.h
···104104105105static inline int kvm_mmu_reload(struct kvm_vcpu *vcpu)106106{107107+ if (kvm_check_request(KVM_REQ_MMU_FREE_OBSOLETE_ROOTS, vcpu))108108+ kvm_mmu_free_obsolete_roots(vcpu);109109+107110 /*108111 * Checking root.hpa is sufficient even when KVM has mirror root.109112 * We can have either:
+64-26
arch/x86/kvm/mmu/mmu.c
···59745974 __kvm_mmu_free_obsolete_roots(vcpu->kvm, &vcpu->arch.root_mmu);59755975 __kvm_mmu_free_obsolete_roots(vcpu->kvm, &vcpu->arch.guest_mmu);59765976}59775977+EXPORT_SYMBOL_GPL(kvm_mmu_free_obsolete_roots);5977597859785979static u64 mmu_pte_write_fetch_gpte(struct kvm_vcpu *vcpu, gpa_t *gpa,59795980 int *bytes)···76707669}7671767076727671#ifdef CONFIG_KVM_GENERIC_MEMORY_ATTRIBUTES76737673-bool kvm_arch_pre_set_memory_attributes(struct kvm *kvm,76747674- struct kvm_gfn_range *range)76757675-{76767676- /*76777677- * Zap SPTEs even if the slot can't be mapped PRIVATE. KVM x86 only76787678- * supports KVM_MEMORY_ATTRIBUTE_PRIVATE, and so it *seems* like KVM76797679- * can simply ignore such slots. But if userspace is making memory76807680- * PRIVATE, then KVM must prevent the guest from accessing the memory76817681- * as shared. And if userspace is making memory SHARED and this point76827682- * is reached, then at least one page within the range was previously76837683- * PRIVATE, i.e. the slot's possible hugepage ranges are changing.76847684- * Zapping SPTEs in this case ensures KVM will reassess whether or not76857685- * a hugepage can be used for affected ranges.76867686- */76877687- if (WARN_ON_ONCE(!kvm_arch_has_private_mem(kvm)))76887688- return false;76897689-76907690- /* Unmap the old attribute page. */76917691- if (range->arg.attributes & KVM_MEMORY_ATTRIBUTE_PRIVATE)76927692- range->attr_filter = KVM_FILTER_SHARED;76937693- else76947694- range->attr_filter = KVM_FILTER_PRIVATE;76957695-76967696- return kvm_unmap_gfn_range(kvm, range);76977697-}76987698-76997672static bool hugepage_test_mixed(struct kvm_memory_slot *slot, gfn_t gfn,77007673 int level)77017674{···76877712{76887713 lpage_info_slot(gfn, slot, level)->disallow_lpage |= KVM_LPAGE_MIXED_FLAG;76897714}77157715+77167716+bool kvm_arch_pre_set_memory_attributes(struct kvm *kvm,77177717+ struct kvm_gfn_range *range)77187718+{77197719+ struct kvm_memory_slot *slot = range->slot;77207720+ int level;77217721+77227722+ /*77237723+ * Zap SPTEs even if the slot can't be mapped PRIVATE. KVM x86 only77247724+ * supports KVM_MEMORY_ATTRIBUTE_PRIVATE, and so it *seems* like KVM77257725+ * can simply ignore such slots. But if userspace is making memory77267726+ * PRIVATE, then KVM must prevent the guest from accessing the memory77277727+ * as shared. And if userspace is making memory SHARED and this point77287728+ * is reached, then at least one page within the range was previously77297729+ * PRIVATE, i.e. the slot's possible hugepage ranges are changing.77307730+ * Zapping SPTEs in this case ensures KVM will reassess whether or not77317731+ * a hugepage can be used for affected ranges.77327732+ */77337733+ if (WARN_ON_ONCE(!kvm_arch_has_private_mem(kvm)))77347734+ return false;77357735+77367736+ if (WARN_ON_ONCE(range->end <= range->start))77377737+ return false;77387738+77397739+ /*77407740+ * If the head and tail pages of the range currently allow a hugepage,77417741+ * i.e. reside fully in the slot and don't have mixed attributes, then77427742+ * add each corresponding hugepage range to the ongoing invalidation,77437743+ * e.g. to prevent KVM from creating a hugepage in response to a fault77447744+ * for a gfn whose attributes aren't changing. Note, only the range77457745+ * of gfns whose attributes are being modified needs to be explicitly77467746+ * unmapped, as that will unmap any existing hugepages.77477747+ */77487748+ for (level = PG_LEVEL_2M; level <= KVM_MAX_HUGEPAGE_LEVEL; level++) {77497749+ gfn_t start = gfn_round_for_level(range->start, level);77507750+ gfn_t end = gfn_round_for_level(range->end - 1, level);77517751+ gfn_t nr_pages = KVM_PAGES_PER_HPAGE(level);77527752+77537753+ if ((start != range->start || start + nr_pages > range->end) &&77547754+ start >= slot->base_gfn &&77557755+ start + nr_pages <= slot->base_gfn + slot->npages &&77567756+ !hugepage_test_mixed(slot, start, level))77577757+ kvm_mmu_invalidate_range_add(kvm, start, start + nr_pages);77587758+77597759+ if (end == start)77607760+ continue;77617761+77627762+ if ((end + nr_pages) > range->end &&77637763+ (end + nr_pages) <= (slot->base_gfn + slot->npages) &&77647764+ !hugepage_test_mixed(slot, end, level))77657765+ kvm_mmu_invalidate_range_add(kvm, end, end + nr_pages);77667766+ }77677767+77687768+ /* Unmap the old attribute page. */77697769+ if (range->arg.attributes & KVM_MEMORY_ATTRIBUTE_PRIVATE)77707770+ range->attr_filter = KVM_FILTER_SHARED;77717771+ else77727772+ range->attr_filter = KVM_FILTER_PRIVATE;77737773+77747774+ return kvm_unmap_gfn_range(kvm, range);77757775+}77767776+77777777+7690777876917779static bool hugepage_has_attrs(struct kvm *kvm, struct kvm_memory_slot *slot,76927780 gfn_t gfn, int level, unsigned long attrs)
···899899 cond_mitigation(tsk);900900901901 /*902902- * Let nmi_uaccess_okay() and finish_asid_transition()903903- * know that CR3 is changing.902902+ * Indicate that CR3 is about to change. nmi_uaccess_okay()903903+ * and others are sensitive to the window where mm_cpumask(),904904+ * CR3 and cpu_tlbstate.loaded_mm are not all in sync.904905 */905906 this_cpu_write(cpu_tlbstate.loaded_mm, LOADED_MM_SWITCHING);906907 barrier();···1205120412061205static bool should_flush_tlb(int cpu, void *data)12071206{12071207+ struct mm_struct *loaded_mm = per_cpu(cpu_tlbstate.loaded_mm, cpu);12081208 struct flush_tlb_info *info = data;12091209+12101210+ /*12111211+ * Order the 'loaded_mm' and 'is_lazy' against their12121212+ * write ordering in switch_mm_irqs_off(). Ensure12131213+ * 'is_lazy' is at least as new as 'loaded_mm'.12141214+ */12151215+ smp_rmb();1209121612101217 /* Lazy TLB will get flushed at the next context switch. */12111218 if (per_cpu(cpu_tlbstate_shared.is_lazy, cpu))···12231214 if (!info->mm)12241215 return true;1225121612171217+ /*12181218+ * While switching, the remote CPU could have state from12191219+ * either the prev or next mm. Assume the worst and flush.12201220+ */12211221+ if (loaded_mm == LOADED_MM_SWITCHING)12221222+ return true;12231223+12261224 /* The target mm is loaded, and the CPU is not lazy. */12271227- if (per_cpu(cpu_tlbstate.loaded_mm, cpu) == info->mm)12251225+ if (loaded_mm == info->mm)12281226 return true;1229122712301228 /* In cpumask, but not the loaded mm? Periodically remove by flushing. */
···480480 * the original BIO sector so that blk_zone_write_plug_bio_endio() can481481 * lookup the zone write plug.482482 */483483- if (req_op(rq) == REQ_OP_ZONE_APPEND || bio_zone_write_plugging(bio))483483+ if (req_op(rq) == REQ_OP_ZONE_APPEND ||484484+ bio_flagged(bio, BIO_EMULATES_ZONE_APPEND))484485 bio->bi_iter.bi_sector = rq->__sector;485486}486487void blk_zone_write_plug_bio_endio(struct bio *bio);
+1-5
block/ioprio.c
···4646 */4747 if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_NICE))4848 return -EPERM;4949- fallthrough;5050- /* rt has prio field too */5151- case IOPRIO_CLASS_BE:5252- if (level >= IOPRIO_NR_LEVELS)5353- return -EINVAL;5449 break;5050+ case IOPRIO_CLASS_BE:5551 case IOPRIO_CLASS_IDLE:5652 break;5753 case IOPRIO_CLASS_NONE:
···681681err_erase_xa:682682 xa_erase(&vdev->submitted_jobs_xa, job->job_id);683683err_unlock:684684- mutex_unlock(&vdev->submitted_jobs_lock);685684 mutex_unlock(&file_priv->lock);685685+ mutex_unlock(&vdev->submitted_jobs_lock);686686 ivpu_rpm_put(vdev);687687 return ret;688688}···874874int ivpu_cmdq_create_ioctl(struct drm_device *dev, void *data, struct drm_file *file)875875{876876 struct ivpu_file_priv *file_priv = file->driver_priv;877877+ struct ivpu_device *vdev = file_priv->vdev;877878 struct drm_ivpu_cmdq_create *args = data;878879 struct ivpu_cmdq *cmdq;880880+ int ret;879881880880- if (!ivpu_is_capable(file_priv->vdev, DRM_IVPU_CAP_MANAGE_CMDQ))882882+ if (!ivpu_is_capable(vdev, DRM_IVPU_CAP_MANAGE_CMDQ))881883 return -ENODEV;882884883885 if (args->priority > DRM_IVPU_JOB_PRIORITY_REALTIME)884886 return -EINVAL;887887+888888+ ret = ivpu_rpm_get(vdev);889889+ if (ret < 0)890890+ return ret;885891886892 mutex_lock(&file_priv->lock);887893···896890 args->cmdq_id = cmdq->id;897891898892 mutex_unlock(&file_priv->lock);893893+894894+ ivpu_rpm_put(vdev);899895900896 return cmdq ? 0 : -ENOMEM;901897}···908900 struct ivpu_device *vdev = file_priv->vdev;909901 struct drm_ivpu_cmdq_destroy *args = data;910902 struct ivpu_cmdq *cmdq;911911- u32 cmdq_id;903903+ u32 cmdq_id = 0;912904 int ret;913905914906 if (!ivpu_is_capable(vdev, DRM_IVPU_CAP_MANAGE_CMDQ))915907 return -ENODEV;908908+909909+ ret = ivpu_rpm_get(vdev);910910+ if (ret < 0)911911+ return ret;916912917913 mutex_lock(&file_priv->lock);918914919915 cmdq = xa_load(&file_priv->cmdq_xa, args->cmdq_id);920916 if (!cmdq || cmdq->is_legacy) {921917 ret = -ENOENT;922922- goto err_unlock;918918+ } else {919919+ cmdq_id = cmdq->id;920920+ ivpu_cmdq_destroy(file_priv, cmdq);921921+ ret = 0;923922 }924923925925- cmdq_id = cmdq->id;926926- ivpu_cmdq_destroy(file_priv, cmdq);927924 mutex_unlock(&file_priv->lock);928928- ivpu_cmdq_abort_all_jobs(vdev, file_priv->ctx.id, cmdq_id);929929- return 0;930925931931-err_unlock:932932- mutex_unlock(&file_priv->lock);926926+ /* Abort any pending jobs only if cmdq was destroyed */927927+ if (!ret)928928+ ivpu_cmdq_abort_all_jobs(vdev, file_priv->ctx.id, cmdq_id);929929+930930+ ivpu_rpm_put(vdev);931931+933932 return ret;934933}935934
+3-3
drivers/base/platform.c
···1440144014411441static int platform_dma_configure(struct device *dev)14421442{14431443- struct platform_driver *drv = to_platform_driver(dev->driver);14431443+ struct device_driver *drv = READ_ONCE(dev->driver);14441444 struct fwnode_handle *fwnode = dev_fwnode(dev);14451445 enum dev_dma_attr attr;14461446 int ret = 0;···14511451 attr = acpi_get_dma_attr(to_acpi_device_node(fwnode));14521452 ret = acpi_dma_configure(dev, attr);14531453 }14541454- /* @drv may not be valid when we're called from the IOMMU layer */14551455- if (ret || !dev->driver || drv->driver_managed_dma)14541454+ /* @dev->driver may not be valid when we're called from the IOMMU layer */14551455+ if (ret || !drv || to_platform_driver(drv)->driver_managed_dma)14561456 return ret;1457145714581458 ret = iommu_device_use_default_domain(dev);
+23
drivers/block/loop.c
···505505 lo->lo_min_dio_size = loop_query_min_dio_size(lo);506506}507507508508+static int loop_check_backing_file(struct file *file)509509+{510510+ if (!file->f_op->read_iter)511511+ return -EINVAL;512512+513513+ if ((file->f_mode & FMODE_WRITE) && !file->f_op->write_iter)514514+ return -EINVAL;515515+516516+ return 0;517517+}518518+508519/*509520 * loop_change_fd switched the backing store of a loopback device to510521 * a new file. This is useful for operating system installers to free up···536525537526 if (!file)538527 return -EBADF;528528+529529+ error = loop_check_backing_file(file);530530+ if (error)531531+ return error;539532540533 /* suppress uevents while reconfiguring the device */541534 dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 1);···978963979964 if (!file)980965 return -EBADF;966966+967967+ if ((mode & BLK_OPEN_WRITE) && !file->f_op->write_iter)968968+ return -EINVAL;969969+970970+ error = loop_check_backing_file(file);971971+ if (error)972972+ return error;973973+981974 is_loop = is_loop_device(file);982975983976 /* This is safe, since we have a reference from open(). */
+1-3
drivers/clocksource/i8253.c
···103103#ifdef CONFIG_CLKEVT_I8253104104void clockevent_i8253_disable(void)105105{106106- raw_spin_lock(&i8253_lock);106106+ guard(raw_spinlock_irqsave)(&i8253_lock);107107108108 /*109109 * Writing the MODE register should stop the counter, according to···132132 outb_p(0, PIT_CH0);133133134134 outb_p(0x30, PIT_MODE);135135-136136- raw_spin_unlock(&i8253_lock);137135}138136139137static int pit_shutdown(struct clock_event_device *evt)
···255255 if (!dev)256256 return NULL;257257258258+ /* Drop the refcnt bumped implicitly by device_find_child */259259+ put_device(dev);260260+258261 return to_scmi_dev(dev);259262}260263
+8-5
drivers/firmware/arm_scmi/driver.c
···12481248}1249124912501250static bool scmi_xfer_done_no_timeout(struct scmi_chan_info *cinfo,12511251- struct scmi_xfer *xfer, ktime_t stop)12511251+ struct scmi_xfer *xfer, ktime_t stop,12521252+ bool *ooo)12521253{12531254 struct scmi_info *info = handle_to_scmi_info(cinfo->handle);12541255···12581257 * in case of out-of-order receptions of delayed responses12591258 */12601259 return info->desc->ops->poll_done(cinfo, xfer) ||12611261- try_wait_for_completion(&xfer->done) ||12601260+ (*ooo = try_wait_for_completion(&xfer->done)) ||12621261 ktime_after(ktime_get(), stop);12631262}12641263···12751274 * itself to support synchronous commands replies.12761275 */12771276 if (!desc->sync_cmds_completed_on_ret) {12771277+ bool ooo = false;12781278+12781279 /*12791280 * Poll on xfer using transport provided .poll_done();12801281 * assumes no completion interrupt was available.12811282 */12821283 ktime_t stop = ktime_add_ms(ktime_get(), timeout_ms);1283128412841284- spin_until_cond(scmi_xfer_done_no_timeout(cinfo,12851285- xfer, stop));12861286- if (ktime_after(ktime_get(), stop)) {12851285+ spin_until_cond(scmi_xfer_done_no_timeout(cinfo, xfer,12861286+ stop, &ooo));12871287+ if (!ooo && !info->desc->ops->poll_done(cinfo, xfer)) {12871288 dev_err(dev,12881289 "timed out in resp(caller: %pS) - polling\n",12891290 (void *)_RET_IP_);
···15331533#endif /* CONFIG_AMD_PMC */15341534}1535153515361536-/**15371537- * amdgpu_choose_low_power_state15381538- *15391539- * @adev: amdgpu_device_pointer15401540- *15411541- * Choose the target low power state for the GPU15421542- */15431543-void amdgpu_choose_low_power_state(struct amdgpu_device *adev)15441544-{15451545- if (adev->in_runpm)15461546- return;15471547-15481548- if (amdgpu_acpi_is_s0ix_active(adev))15491549- adev->in_s0ix = true;15501550- else if (amdgpu_acpi_is_s3_active(adev))15511551- adev->in_s3 = true;15521552-}15531553-15541536#endif /* CONFIG_SUSPEND */
+7-22
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
···49074907 * @data: data49084908 *49094909 * This function is called when the system is about to suspend or hibernate.49104910- * It is used to evict resources from the device before the system goes to49114911- * sleep while there is still access to swap.49104910+ * It is used to set the appropriate flags so that eviction can be optimized49114911+ * in the pm prepare callback.49124912 */49134913static int amdgpu_device_pm_notifier(struct notifier_block *nb, unsigned long mode,49144914 void *data)49154915{49164916 struct amdgpu_device *adev = container_of(nb, struct amdgpu_device, pm_nb);49174917- int r;4918491749194918 switch (mode) {49204919 case PM_HIBERNATION_PREPARE:49214920 adev->in_s4 = true;49224922- fallthrough;49234923- case PM_SUSPEND_PREPARE:49244924- r = amdgpu_device_evict_resources(adev);49254925- /*49264926- * This is considered non-fatal at this time because49274927- * amdgpu_device_prepare() will also fatally evict resources.49284928- * See https://gitlab.freedesktop.org/drm/amd/-/issues/378149294929- */49304930- if (r)49314931- drm_warn(adev_to_drm(adev), "Failed to evict resources, freeze active processes if problems occur: %d\n", r);49214921+ break;49224922+ case PM_POST_HIBERNATION:49234923+ adev->in_s4 = false;49324924 break;49334925 }49344926···49414949 struct amdgpu_device *adev = drm_to_adev(dev);49424950 int i, r;4943495149444944- amdgpu_choose_low_power_state(adev);49454945-49464952 if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)49474953 return 0;4948495449494955 /* Evict the majority of BOs before starting suspend sequence */49504956 r = amdgpu_device_evict_resources(adev);49514957 if (r)49524952- goto unprepare;49584958+ return r;4953495949544960 flush_delayed_work(&adev->gfx.gfx_off_delay_work);49554961···49584968 continue;49594969 r = adev->ip_blocks[i].version->funcs->prepare_suspend(&adev->ip_blocks[i]);49604970 if (r)49614961- goto unprepare;49714971+ return r;49624972 }4963497349644974 return 0;49654965-49664966-unprepare:49674967- adev->in_s0ix = adev->in_s3 = adev->in_s4 = false;49684968-49694969- return r;49704975}4971497649724977/**
···4141{4242 if (!ring || !ring->funcs->emit_wreg) {4343 WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);4444- RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);4444+ /* We just need to read back a register to post the write.4545+ * Reading back the remapped register causes problems on4646+ * some platforms so just read back the memory size register.4747+ */4848+ if (adev->nbio.funcs->get_memsize)4949+ adev->nbio.funcs->get_memsize(adev);4550 } else {4651 amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);4752 }
+6-1
drivers/gpu/drm/amd/amdgpu/hdp_v5_0.c
···3232{3333 if (!ring || !ring->funcs->emit_wreg) {3434 WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);3535- RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);3535+ /* We just need to read back a register to post the write.3636+ * Reading back the remapped register causes problems on3737+ * some platforms so just read back the memory size register.3838+ */3939+ if (adev->nbio.funcs->get_memsize)4040+ adev->nbio.funcs->get_memsize(adev);3641 } else {3742 amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);3843 }
+11-1
drivers/gpu/drm/amd/amdgpu/hdp_v5_2.c
···3333 if (!ring || !ring->funcs->emit_wreg) {3434 WREG32_NO_KIQ((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2,3535 0);3636- RREG32_NO_KIQ((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);3636+ if (amdgpu_sriov_vf(adev)) {3737+ /* this is fine because SR_IOV doesn't remap the register */3838+ RREG32_NO_KIQ((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);3939+ } else {4040+ /* We just need to read back a register to post the write.4141+ * Reading back the remapped register causes problems on4242+ * some platforms so just read back the memory size register.4343+ */4444+ if (adev->nbio.funcs->get_memsize)4545+ adev->nbio.funcs->get_memsize(adev);4646+ }3747 } else {3848 amdgpu_ring_emit_wreg(ring,3949 (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2,
+6-1
drivers/gpu/drm/amd/amdgpu/hdp_v6_0.c
···3535{3636 if (!ring || !ring->funcs->emit_wreg) {3737 WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);3838- RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);3838+ /* We just need to read back a register to post the write.3939+ * Reading back the remapped register causes problems on4040+ * some platforms so just read back the memory size register.4141+ */4242+ if (adev->nbio.funcs->get_memsize)4343+ adev->nbio.funcs->get_memsize(adev);3944 } else {4045 amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);4146 }
+6-1
drivers/gpu/drm/amd/amdgpu/hdp_v7_0.c
···3232{3333 if (!ring || !ring->funcs->emit_wreg) {3434 WREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);3535- RREG32((adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2);3535+ /* We just need to read back a register to post the write.3636+ * Reading back the remapped register causes problems on3737+ * some platforms so just read back the memory size register.3838+ */3939+ if (adev->nbio.funcs->get_memsize)4040+ adev->nbio.funcs->get_memsize(adev);3641 } else {3742 amdgpu_ring_emit_wreg(ring, (adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL) >> 2, 0);3843 }
···673673 spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags);674674675675 if (acrtc->dm_irq_params.stream &&676676- acrtc->dm_irq_params.vrr_params.supported &&677677- acrtc->dm_irq_params.freesync_config.state ==678678- VRR_STATE_ACTIVE_VARIABLE) {676676+ acrtc->dm_irq_params.vrr_params.supported) {677677+ bool replay_en = acrtc->dm_irq_params.stream->link->replay_settings.replay_feature_enabled;678678+ bool psr_en = acrtc->dm_irq_params.stream->link->psr_settings.psr_feature_enabled;679679+ bool fs_active_var_en = acrtc->dm_irq_params.freesync_config.state == VRR_STATE_ACTIVE_VARIABLE;680680+679681 mod_freesync_handle_v_update(adev->dm.freesync_module,680682 acrtc->dm_irq_params.stream,681683 &acrtc->dm_irq_params.vrr_params);682684683683- dc_stream_adjust_vmin_vmax(adev->dm.dc, acrtc->dm_irq_params.stream,684684- &acrtc->dm_irq_params.vrr_params.adjust);685685+ /* update vmin_vmax only if freesync is enabled, or only if PSR and REPLAY are disabled */686686+ if (fs_active_var_en || (!fs_active_var_en && !replay_en && !psr_en)) {687687+ dc_stream_adjust_vmin_vmax(adev->dm.dc,688688+ acrtc->dm_irq_params.stream,689689+ &acrtc->dm_irq_params.vrr_params.adjust);690690+ }685691 }686692687693 /*···1274912743 * Transient states before tunneling is enabled could1275012744 * lead to this error. We can ignore this for now.1275112745 */1275212752- if (p_notify->result != AUX_RET_ERROR_PROTOCOL_ERROR) {1274612746+ if (p_notify->result == AUX_RET_ERROR_PROTOCOL_ERROR) {1275312747 DRM_WARN("DPIA AUX failed on 0x%x(%d), error %d\n",1275412748 payload->address, payload->length,1275512749 p_notify->result);···1275812752 goto out;1275912753 }12760127541275512755+ payload->reply[0] = adev->dm.dmub_notify->aux_reply.command & 0xF;1275612756+ if (adev->dm.dmub_notify->aux_reply.command & 0xF0)1275712757+ /* The reply is stored in the top nibble of the command. */1275812758+ payload->reply[0] = (adev->dm.dmub_notify->aux_reply.command >> 4) & 0xF;12761127591276212762- payload->reply[0] = adev->dm.dmub_notify->aux_reply.command;1276312763- if (!payload->write && p_notify->aux_reply.length &&1276412764- (payload->reply[0] == AUX_TRANSACTION_REPLY_AUX_ACK)) {1276512765-1276612766- if (payload->length != p_notify->aux_reply.length) {1276712767- DRM_WARN("invalid read length %d from DPIA AUX 0x%x(%d)!\n",1276812768- p_notify->aux_reply.length,1276912769- payload->address, payload->length);1277012770- *operation_result = AUX_RET_ERROR_INVALID_REPLY;1277112771- goto out;1277212772- }1277312773-1276012760+ if (!payload->write && p_notify->aux_reply.length)1277412761 memcpy(payload->data, p_notify->aux_reply.data,1277512762 p_notify->aux_reply.length);1277612776- }12777127631277812764 /* success */1277912765 ret = p_notify->aux_reply.length;
···51515252#define PEAK_FACTOR_X1000 100653535454+/*5555+ * This function handles both native AUX and I2C-Over-AUX transactions.5656+ */5457static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux,5558 struct drm_dp_aux_msg *msg)5659{···9087 if (adev->dm.aux_hpd_discon_quirk) {9188 if (msg->address == DP_SIDEBAND_MSG_DOWN_REQ_BASE &&9289 operation_result == AUX_RET_ERROR_HPD_DISCON) {9393- result = 0;9090+ result = msg->size;9491 operation_result = AUX_RET_SUCCESS;9592 }9693 }97949898- if (payload.write && result >= 0)9999- result = msg->size;9595+ /*9696+ * result equals to 0 includes the cases of AUX_DEFER/I2C_DEFER9797+ */9898+ if (payload.write && result >= 0) {9999+ if (result) {100100+ /*one byte indicating partially written bytes. Force 0 to retry*/101101+ drm_info(adev_to_drm(adev), "amdgpu: AUX partially written\n");102102+ result = 0;103103+ } else if (!payload.reply[0])104104+ /*I2C_ACK|AUX_ACK*/105105+ result = msg->size;106106+ }100107101101- if (result < 0)108108+ if (result < 0) {102109 switch (operation_result) {103110 case AUX_RET_SUCCESS:104111 break;···126113 result = -ETIMEDOUT;127114 break;128115 }116116+117117+ drm_info(adev_to_drm(adev), "amdgpu: DP AUX transfer fail:%d\n", operation_result);118118+ }119119+120120+ if (payload.reply[0])121121+ drm_info(adev_to_drm(adev), "amdgpu: AUX reply command not ACK: 0x%02x.",122122+ payload.reply[0]);129123130124 return result;131125}
···549549 if (drm_WARN_ONCE(dev, !recovery, "invalid recovery method %u\n", opt))550550 break;551551552552- len += scnprintf(event_string + len, sizeof(event_string), "%s,", recovery);552552+ len += scnprintf(event_string + len, sizeof(event_string) - len, "%s,", recovery);553553 }554554555555 if (recovery)
+1-1
drivers/gpu/drm/i915/display/intel_dp_mst.c
···242242 to_intel_connector(conn_state->connector);243243 const struct drm_display_mode *adjusted_mode =244244 &crtc_state->hw.adjusted_mode;245245- bool is_mst = intel_dp->is_mst;245245+ bool is_mst = intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST);246246 int bpp_x16, slots = -EINVAL;247247 int dsc_slice_count = 0;248248 int max_dpt_bpp_x16;
+11-3
drivers/gpu/drm/i915/gt/intel_rps.c
···10011001 if (rps_uses_slpc(rps)) {10021002 slpc = rps_to_slpc(rps);1003100310041004+ /* Don't decrement num_waiters for req where increment was skipped */10051005+ if (slpc->power_profile == SLPC_POWER_PROFILES_POWER_SAVING)10061006+ return;10071007+10041008 intel_guc_slpc_dec_waiters(slpc);10051009 } else {10061010 atomic_dec(&rps->num_waiters);···10331029 if (slpc->power_profile == SLPC_POWER_PROFILES_POWER_SAVING)10341030 return;1035103110361036- if (slpc->min_freq_softlimit >= slpc->boost_freq)10371037- return;10381038-10391032 /* Return if old value is non zero */10401033 if (!atomic_fetch_inc(&slpc->num_waiters)) {10341034+ /*10351035+ * Skip queuing boost work if frequency is already boosted,10361036+ * but still increment num_waiters.10371037+ */10381038+ if (slpc->min_freq_softlimit >= slpc->boost_freq)10391039+ return;10401040+10411041 GT_TRACE(rps_to_gt(rps), "boost fence:%llx:%llx\n",10421042 rq->fence.context, rq->fence.seqno);10431043 queue_work(rps_to_gt(rps)->i915->unordered_wq,
···88#include <linux/swap.h>991010/*1111- * Casting from randomized struct file * to struct ttm_backup * is fine since1212- * struct ttm_backup is never defined nor dereferenced.1313- */1414-static struct file *ttm_backup_to_file(struct ttm_backup *backup)1515-{1616- return (void *)backup;1717-}1818-1919-static struct ttm_backup *ttm_file_to_backup(struct file *file)2020-{2121- return (void *)file;2222-}2323-2424-/*2511 * Need to map shmem indices to handle since a handle value2612 * of 0 means error, following the swp_entry_t convention.2713 */···2640 * @backup: The struct backup pointer used to obtain the handle2741 * @handle: The handle obtained from the @backup_page function.2842 */2929-void ttm_backup_drop(struct ttm_backup *backup, pgoff_t handle)4343+void ttm_backup_drop(struct file *backup, pgoff_t handle)3044{3145 loff_t start = ttm_backup_handle_to_shmem_idx(handle);32463347 start <<= PAGE_SHIFT;3434- shmem_truncate_range(file_inode(ttm_backup_to_file(backup)), start,4848+ shmem_truncate_range(file_inode(backup), start,3549 start + PAGE_SIZE - 1);3650}3751···4155 * @backup: The struct backup pointer used to back up the page.4256 * @dst: The struct page to copy into.4357 * @handle: The handle returned when the page was backed up.4444- * @intr: Try to perform waits interruptable or at least killable.5858+ * @intr: Try to perform waits interruptible or at least killable.4559 *4660 * Return: 0 on success, Negative error code on failure, notably4761 * -EINTR if @intr was set to true and a signal is pending.4862 */4949-int ttm_backup_copy_page(struct ttm_backup *backup, struct page *dst,6363+int ttm_backup_copy_page(struct file *backup, struct page *dst,5064 pgoff_t handle, bool intr)5165{5252- struct file *filp = ttm_backup_to_file(backup);5353- struct address_space *mapping = filp->f_mapping;6666+ struct address_space *mapping = backup->f_mapping;5467 struct folio *from_folio;5568 pgoff_t idx = ttm_backup_handle_to_shmem_idx(handle);5669···91106 * the folio size- and usage.92107 */93108s649494-ttm_backup_backup_page(struct ttm_backup *backup, struct page *page,109109+ttm_backup_backup_page(struct file *backup, struct page *page,95110 bool writeback, pgoff_t idx, gfp_t page_gfp,96111 gfp_t alloc_gfp)97112{9898- struct file *filp = ttm_backup_to_file(backup);9999- struct address_space *mapping = filp->f_mapping;113113+ struct address_space *mapping = backup->f_mapping;100114 unsigned long handle = 0;101115 struct folio *to_folio;102116 int ret;···145161 *146162 * After a call to this function, it's illegal to use the @backup pointer.147163 */148148-void ttm_backup_fini(struct ttm_backup *backup)164164+void ttm_backup_fini(struct file *backup)149165{150150- fput(ttm_backup_to_file(backup));166166+ fput(backup);151167}152168153169/**···178194 *179195 * Create a backup utilizing shmem objects.180196 *181181- * Return: A pointer to a struct ttm_backup on success,197197+ * Return: A pointer to a struct file on success,182198 * an error pointer on error.183199 */184184-struct ttm_backup *ttm_backup_shmem_create(loff_t size)200200+struct file *ttm_backup_shmem_create(loff_t size)185201{186186- struct file *filp;187187-188188- filp = shmem_file_setup("ttm shmem backup", size, 0);189189-190190- return ttm_file_to_backup(filp);202202+ return shmem_file_setup("ttm shmem backup", size, 0);191203}
+3-3
drivers/gpu/drm/ttm/ttm_pool.c
···506506 * if successful, populate the page-table and dma-address arrays.507507 */508508static int ttm_pool_restore_commit(struct ttm_pool_tt_restore *restore,509509- struct ttm_backup *backup,509509+ struct file *backup,510510 const struct ttm_operation_ctx *ctx,511511 struct ttm_pool_alloc_state *alloc)512512···655655 pgoff_t start_page, pgoff_t end_page)656656{657657 struct page **pages = &tt->pages[start_page];658658- struct ttm_backup *backup = tt->backup;658658+ struct file *backup = tt->backup;659659 pgoff_t i, nr;660660661661 for (i = start_page; i < end_page; i += nr, pages += nr) {···963963long ttm_pool_backup(struct ttm_pool *pool, struct ttm_tt *tt,964964 const struct ttm_backup_flags *flags)965965{966966- struct ttm_backup *backup = tt->backup;966966+ struct file *backup = tt->backup;967967 struct page *page;968968 unsigned long handle;969969 gfp_t alloc_gfp;
···744744 return DRM_GPU_SCHED_STAT_NOMINAL;745745}746746747747-/* If the current address or return address have changed, then the GPU748748- * has probably made progress and we should delay the reset. This749749- * could fail if the GPU got in an infinite loop in the CL, but that750750- * is pretty unlikely outside of an i-g-t testcase.751751- */747747+static void748748+v3d_sched_skip_reset(struct drm_sched_job *sched_job)749749+{750750+ struct drm_gpu_scheduler *sched = sched_job->sched;751751+752752+ spin_lock(&sched->job_list_lock);753753+ list_add(&sched_job->list, &sched->pending_list);754754+ spin_unlock(&sched->job_list_lock);755755+}756756+752757static enum drm_gpu_sched_stat753758v3d_cl_job_timedout(struct drm_sched_job *sched_job, enum v3d_queue q,754759 u32 *timedout_ctca, u32 *timedout_ctra)···763758 u32 ctca = V3D_CORE_READ(0, V3D_CLE_CTNCA(q));764759 u32 ctra = V3D_CORE_READ(0, V3D_CLE_CTNRA(q));765760761761+ /* If the current address or return address have changed, then the GPU762762+ * has probably made progress and we should delay the reset. This763763+ * could fail if the GPU got in an infinite loop in the CL, but that764764+ * is pretty unlikely outside of an i-g-t testcase.765765+ */766766 if (*timedout_ctca != ctca || *timedout_ctra != ctra) {767767 *timedout_ctca = ctca;768768 *timedout_ctra = ctra;769769+770770+ v3d_sched_skip_reset(sched_job);769771 return DRM_GPU_SCHED_STAT_NOMINAL;770772 }771773···812800 struct v3d_dev *v3d = job->base.v3d;813801 u32 batches = V3D_CORE_READ(0, V3D_CSD_CURRENT_CFG4(v3d->ver));814802815815- /* If we've made progress, skip reset and let the timer get816816- * rearmed.803803+ /* If we've made progress, skip reset, add the job to the pending804804+ * list, and let the timer get rearmed.817805 */818806 if (job->timedout_batches != batches) {819807 job->timedout_batches = batches;808808+809809+ v3d_sched_skip_reset(sched_job);820810 return DRM_GPU_SCHED_STAT_NOMINAL;821811 }822812
+5-2
drivers/gpu/drm/xe/tests/xe_mocs.c
···4646 unsigned int fw_ref, i;4747 u32 reg_val;48484949- fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);5050- KUNIT_ASSERT_NE_MSG(test, fw_ref, 0, "Forcewake Failed.\n");4949+ fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);5050+ if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {5151+ xe_force_wake_put(gt_to_fw(gt), fw_ref);5252+ KUNIT_ASSERT_TRUE_MSG(test, true, "Forcewake Failed.\n");5353+ }51545255 for (i = 0; i < info->num_mocs_regs; i++) {5356 if (!(i & 1)) {
+22
drivers/gpu/drm/xe/xe_gsc.c
···555555 flush_work(&gsc->work);556556}557557558558+void xe_gsc_stop_prepare(struct xe_gsc *gsc)559559+{560560+ struct xe_gt *gt = gsc_to_gt(gsc);561561+ int ret;562562+563563+ if (!xe_uc_fw_is_loadable(&gsc->fw) || xe_uc_fw_is_in_error_state(&gsc->fw))564564+ return;565565+566566+ xe_force_wake_assert_held(gt_to_fw(gt), XE_FW_GSC);567567+568568+ /*569569+ * If the GSC FW load or the proxy init are interrupted, the only way570570+ * to recover it is to do an FLR and reload the GSC from scratch.571571+ * Therefore, let's wait for the init to complete before stopping572572+ * operations. The proxy init is the last step, so we can just wait on573573+ * that574574+ */575575+ ret = xe_gsc_wait_for_proxy_init_done(gsc);576576+ if (ret)577577+ xe_gt_err(gt, "failed to wait for GSC init completion before uc stop\n");578578+}579579+558580/*559581 * wa_14015076503: if the GSC FW is loaded, we need to alert it before doing a560582 * GSC engine reset by writing a notification bit in the GS1 register and then
···9292 struct xe_hw_engine *hwe;9393 enum xe_hw_engine_id id;9494 unsigned int fw_ref;9595+ int ret = 0;95969697 xe_pm_runtime_get(xe);9798 fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);9899 if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {9999- xe_pm_runtime_put(xe);100100- xe_force_wake_put(gt_to_fw(gt), fw_ref);101101- return -ETIMEDOUT;100100+ ret = -ETIMEDOUT;101101+ goto fw_put;102102 }103103104104 for_each_hw_engine(hwe, gt, id)105105 xe_hw_engine_print(hwe, p);106106107107+fw_put:107108 xe_force_wake_put(gt_to_fw(gt), fw_ref);108109 xe_pm_runtime_put(xe);109110110110- return 0;111111+ return ret;111112}112113113114static int powergate_info(struct xe_gt *gt, struct drm_printer *p)
+9-2
drivers/gpu/drm/xe/xe_gt_pagefault.c
···435435 num_eus = bitmap_weight(gt->fuse_topo.eu_mask_per_dss,436436 XE_MAX_EU_FUSE_BITS) * num_dss;437437438438- /* user can issue separate page faults per EU and per CS */438438+ /*439439+ * user can issue separate page faults per EU and per CS440440+ *441441+ * XXX: Multiplier required as compute UMD are getting PF queue errors442442+ * without it. Follow on why this multiplier is required.443443+ */444444+#define PF_MULTIPLIER 8439445 pf_queue->num_dw =440440- (num_eus + XE_NUM_HW_ENGINES) * PF_MSG_LEN_DW;446446+ (num_eus + XE_NUM_HW_ENGINES) * PF_MSG_LEN_DW * PF_MULTIPLIER;447447+#undef PF_MULTIPLIER441448442449 pf_queue->gt = gt;443450 pf_queue->data = devm_kcalloc(xe->drm.dev, pf_queue->num_dw,
+12
drivers/gpu/drm/xe/xe_svm.c
···947947 return 0;948948}949949#endif950950+951951+/**952952+ * xe_svm_flush() - SVM flush953953+ * @vm: The VM.954954+ *955955+ * Flush all SVM actions.956956+ */957957+void xe_svm_flush(struct xe_vm *vm)958958+{959959+ if (xe_vm_in_fault_mode(vm))960960+ flush_work(&vm->svm.garbage_collector.work);961961+}
···33123312 }3313331333143314 /* Ensure all UNMAPs visible */33153315- if (xe_vm_in_fault_mode(vm))33163316- flush_work(&vm->svm.garbage_collector.work);33153315+ xe_svm_flush(vm);3317331633183317 err = down_write_killable(&vm->lock);33193318 if (err)
+1-1
drivers/gpu/nova-core/gpu.rs
···9393// For now, redirect to fmt::Debug for convenience.9494impl fmt::Display for Chipset {9595 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {9696- write!(f, "{:?}", self)9696+ write!(f, "{self:?}")9797 }9898}9999
+6
drivers/hv/hyperv_vmbus.h
···477477478478#endif /* CONFIG_HYPERV_TESTING */479479480480+/* Create and remove sysfs entry for memory mapped ring buffers for a channel */481481+int hv_create_ring_sysfs(struct vmbus_channel *channel,482482+ int (*hv_mmap_ring_buffer)(struct vmbus_channel *channel,483483+ struct vm_area_struct *vma));484484+int hv_remove_ring_sysfs(struct vmbus_channel *channel);485485+480486#endif /* _HYPERV_VMBUS_H */
+108-1
drivers/hv/vmbus_drv.c
···18021802}18031803static VMBUS_CHAN_ATTR_RO(subchannel_id);1804180418051805+static int hv_mmap_ring_buffer_wrapper(struct file *filp, struct kobject *kobj,18061806+ const struct bin_attribute *attr,18071807+ struct vm_area_struct *vma)18081808+{18091809+ struct vmbus_channel *channel = container_of(kobj, struct vmbus_channel, kobj);18101810+18111811+ /*18121812+ * hv_(create|remove)_ring_sysfs implementation ensures that mmap_ring_buffer18131813+ * is not NULL.18141814+ */18151815+ return channel->mmap_ring_buffer(channel, vma);18161816+}18171817+18181818+static struct bin_attribute chan_attr_ring_buffer = {18191819+ .attr = {18201820+ .name = "ring",18211821+ .mode = 0600,18221822+ },18231823+ .mmap = hv_mmap_ring_buffer_wrapper,18241824+};18051825static struct attribute *vmbus_chan_attrs[] = {18061826 &chan_attr_out_mask.attr,18071827 &chan_attr_in_mask.attr,···18381818 &chan_attr_out_full_total.attr,18391819 &chan_attr_monitor_id.attr,18401820 &chan_attr_subchannel_id.attr,18211821+ NULL18221822+};18231823+18241824+static struct bin_attribute *vmbus_chan_bin_attrs[] = {18251825+ &chan_attr_ring_buffer,18411826 NULL18421827};18431828···18661841 return attr->mode;18671842}1868184318441844+static umode_t vmbus_chan_bin_attr_is_visible(struct kobject *kobj,18451845+ const struct bin_attribute *attr, int idx)18461846+{18471847+ const struct vmbus_channel *channel =18481848+ container_of(kobj, struct vmbus_channel, kobj);18491849+18501850+ /* Hide ring attribute if channel's ring_sysfs_visible is set to false */18511851+ if (attr == &chan_attr_ring_buffer && !channel->ring_sysfs_visible)18521852+ return 0;18531853+18541854+ return attr->attr.mode;18551855+}18561856+18571857+static size_t vmbus_chan_bin_size(struct kobject *kobj,18581858+ const struct bin_attribute *bin_attr, int a)18591859+{18601860+ const struct vmbus_channel *channel =18611861+ container_of(kobj, struct vmbus_channel, kobj);18621862+18631863+ return channel->ringbuffer_pagecount << PAGE_SHIFT;18641864+}18651865+18691866static const struct attribute_group vmbus_chan_group = {18701867 .attrs = vmbus_chan_attrs,18711871- .is_visible = vmbus_chan_attr_is_visible18681868+ .bin_attrs = vmbus_chan_bin_attrs,18691869+ .is_visible = vmbus_chan_attr_is_visible,18701870+ .is_bin_visible = vmbus_chan_bin_attr_is_visible,18711871+ .bin_size = vmbus_chan_bin_size,18721872};1873187318741874static const struct kobj_type vmbus_chan_ktype = {18751875 .sysfs_ops = &vmbus_chan_sysfs_ops,18761876 .release = vmbus_chan_release,18771877};18781878+18791879+/**18801880+ * hv_create_ring_sysfs() - create "ring" sysfs entry corresponding to ring buffers for a channel.18811881+ * @channel: Pointer to vmbus_channel structure18821882+ * @hv_mmap_ring_buffer: function pointer for initializing the function to be called on mmap of18831883+ * channel's "ring" sysfs node, which is for the ring buffer of that channel.18841884+ * Function pointer is of below type:18851885+ * int (*hv_mmap_ring_buffer)(struct vmbus_channel *channel,18861886+ * struct vm_area_struct *vma))18871887+ * This has a pointer to the channel and a pointer to vm_area_struct,18881888+ * used for mmap, as arguments.18891889+ *18901890+ * Sysfs node for ring buffer of a channel is created along with other fields, however its18911891+ * visibility is disabled by default. Sysfs creation needs to be controlled when the use-case18921892+ * is running.18931893+ * For example, HV_NIC device is used either by uio_hv_generic or hv_netvsc at any given point of18941894+ * time, and "ring" sysfs is needed only when uio_hv_generic is bound to that device. To avoid18951895+ * exposing the ring buffer by default, this function is reponsible to enable visibility of18961896+ * ring for userspace to use.18971897+ * Note: Race conditions can happen with userspace and it is not encouraged to create new18981898+ * use-cases for this. This was added to maintain backward compatibility, while solving18991899+ * one of the race conditions in uio_hv_generic while creating sysfs.19001900+ *19011901+ * Returns 0 on success or error code on failure.19021902+ */19031903+int hv_create_ring_sysfs(struct vmbus_channel *channel,19041904+ int (*hv_mmap_ring_buffer)(struct vmbus_channel *channel,19051905+ struct vm_area_struct *vma))19061906+{19071907+ struct kobject *kobj = &channel->kobj;19081908+19091909+ channel->mmap_ring_buffer = hv_mmap_ring_buffer;19101910+ channel->ring_sysfs_visible = true;19111911+19121912+ return sysfs_update_group(kobj, &vmbus_chan_group);19131913+}19141914+EXPORT_SYMBOL_GPL(hv_create_ring_sysfs);19151915+19161916+/**19171917+ * hv_remove_ring_sysfs() - remove ring sysfs entry corresponding to ring buffers for a channel.19181918+ * @channel: Pointer to vmbus_channel structure19191919+ *19201920+ * Hide "ring" sysfs for a channel by changing its is_visible attribute and updating sysfs group.19211921+ *19221922+ * Returns 0 on success or error code on failure.19231923+ */19241924+int hv_remove_ring_sysfs(struct vmbus_channel *channel)19251925+{19261926+ struct kobject *kobj = &channel->kobj;19271927+ int ret;19281928+19291929+ channel->ring_sysfs_visible = false;19301930+ ret = sysfs_update_group(kobj, &vmbus_chan_group);19311931+ channel->mmap_ring_buffer = NULL;19321932+ return ret;19331933+}19341934+EXPORT_SYMBOL_GPL(hv_remove_ring_sysfs);1878193518791936/*18801937 * vmbus_add_channel_kobj - setup a sub-directory under device/channels
···601601 if (ret)602602 return ret;603603604604+ st->odr = odr;605605+604606 /* Activity timers depend on ODR */605607 ret = _adxl367_set_act_time_ms(st, st->act_time_ms);606608 if (ret)607609 return ret;608610609609- ret = _adxl367_set_inact_time_ms(st, st->inact_time_ms);610610- if (ret)611611- return ret;612612-613613- st->odr = odr;614614-615615- return 0;611611+ return _adxl367_set_inact_time_ms(st, st->inact_time_ms);616612}617613618614static int adxl367_set_odr(struct iio_dev *indio_dev, enum adxl367_odr odr)
+5-2
drivers/iio/accel/fxls8962af-core.c
···12261226 if (ret)12271227 return ret;1228122812291229- if (device_property_read_bool(dev, "wakeup-source"))12301230- device_init_wakeup(dev, true);12291229+ if (device_property_read_bool(dev, "wakeup-source")) {12301230+ ret = devm_device_init_wakeup(dev);12311231+ if (ret)12321232+ return dev_err_probe(dev, ret, "Failed to init wakeup\n");12331233+ }1231123412321235 return devm_iio_device_register(dev, indio_dev);12331236}
···12111211 struct ad7380_state *st = iio_priv(indio_dev);12121212 int ret;1213121312141214+ spi_offload_trigger_disable(st->offload, st->offload_trigger);12151215+ spi_unoptimize_message(&st->offload_msg);12161216+12141217 if (st->seq) {12151218 ret = regmap_update_bits(st->regmap,12161219 AD7380_REG_ADDR_CONFIG1,···1224122112251222 st->seq = false;12261223 }12271227-12281228- spi_offload_trigger_disable(st->offload, st->offload_trigger);12291229-12301230- spi_unoptimize_message(&st->offload_msg);1231122412321225 return 0;12331226}···16101611 return ret;16111612}1612161316131613-static int ad7380_get_alert_th(struct ad7380_state *st,16141614+static int ad7380_get_alert_th(struct iio_dev *indio_dev,16151615+ const struct iio_chan_spec *chan,16141616 enum iio_event_direction dir,16151617 int *val)16161618{16171617- int ret, tmp;16191619+ struct ad7380_state *st = iio_priv(indio_dev);16201620+ const struct iio_scan_type *scan_type;16211621+ int ret, tmp, shift;16221622+16231623+ scan_type = iio_get_current_scan_type(indio_dev, chan);16241624+ if (IS_ERR(scan_type))16251625+ return PTR_ERR(scan_type);16261626+16271627+ /*16281628+ * The register value is 12-bits and is compared to the most significant16291629+ * bits of raw value, therefore a shift is required to convert this to16301630+ * the same scale as the raw value.16311631+ */16321632+ shift = scan_type->realbits - 12;1618163316191634 switch (dir) {16201635 case IIO_EV_DIR_RISING:···16381625 if (ret)16391626 return ret;1640162716411641- *val = FIELD_GET(AD7380_ALERT_HIGH_TH, tmp);16281628+ *val = FIELD_GET(AD7380_ALERT_HIGH_TH, tmp) << shift;16421629 return IIO_VAL_INT;16431630 case IIO_EV_DIR_FALLING:16441631 ret = regmap_read(st->regmap,···16471634 if (ret)16481635 return ret;1649163616501650- *val = FIELD_GET(AD7380_ALERT_LOW_TH, tmp);16371637+ *val = FIELD_GET(AD7380_ALERT_LOW_TH, tmp) << shift;16511638 return IIO_VAL_INT;16521639 default:16531640 return -EINVAL;···16611648 enum iio_event_info info,16621649 int *val, int *val2)16631650{16641664- struct ad7380_state *st = iio_priv(indio_dev);16651651 int ret;1666165216671653 switch (info) {···16681656 if (!iio_device_claim_direct(indio_dev))16691657 return -EBUSY;1670165816711671- ret = ad7380_get_alert_th(st, dir, val);16591659+ ret = ad7380_get_alert_th(indio_dev, chan, dir, val);1672166016731661 iio_device_release_direct(indio_dev);16741662 return ret;
+8-3
drivers/iio/adc/ad7606.c
···12361236 st->write_scale = ad7616_write_scale_sw;12371237 st->write_os = &ad7616_write_os_sw;1238123812391239- ret = st->bops->sw_mode_config(indio_dev);12401240- if (ret)12411241- return ret;12391239+ if (st->bops->sw_mode_config) {12401240+ ret = st->bops->sw_mode_config(indio_dev);12411241+ if (ret)12421242+ return ret;12431243+ }1242124412431245 /* Activate Burst mode and SEQEN MODE */12441246 return ad7606_write_mask(st, AD7616_CONFIGURATION_REGISTER,···1269126712701268 st->write_scale = ad7606_write_scale_sw;12711269 st->write_os = &ad7606_write_os_sw;12701270+12711271+ if (!st->bops->sw_mode_config)12721272+ return 0;1272127312731274 return st->bops->sw_mode_config(indio_dev);12741275}
···543543 else544544 return ret;545545 } else {546546- device_init_wakeup(iadc->dev, 1);546546+ ret = devm_device_init_wakeup(iadc->dev);547547+ if (ret)548548+ return dev_err_probe(iadc->dev, ret, "Failed to init wakeup\n");547549 }548550549551 ret = iadc_update_offset(iadc);
+8-9
drivers/iio/adc/rockchip_saradc.c
···520520 if (info->reset)521521 rockchip_saradc_reset_controller(info->reset);522522523523- /*524524- * Use a default value for the converter clock.525525- * This may become user-configurable in the future.526526- */527527- ret = clk_set_rate(info->clk, info->data->clk_rate);528528- if (ret < 0)529529- return dev_err_probe(&pdev->dev, ret,530530- "failed to set adc clk rate\n");531531-532523 ret = regulator_enable(info->vref);533524 if (ret < 0)534525 return dev_err_probe(&pdev->dev, ret,···546555 if (IS_ERR(info->clk))547556 return dev_err_probe(&pdev->dev, PTR_ERR(info->clk),548557 "failed to get adc clock\n");558558+ /*559559+ * Use a default value for the converter clock.560560+ * This may become user-configurable in the future.561561+ */562562+ ret = clk_set_rate(info->clk, info->data->clk_rate);563563+ if (ret < 0)564564+ return dev_err_probe(&pdev->dev, ret,565565+ "failed to set adc clk rate\n");549566550567 platform_set_drvdata(pdev, indio_dev);551568
+3-2
drivers/iio/chemical/pms7003.c
···55 * Copyright (c) Tomasz Duszynski <tduszyns@gmail.com>66 */7788-#include <linux/unaligned.h>98#include <linux/completion.h>109#include <linux/device.h>1110#include <linux/errno.h>···1819#include <linux/module.h>1920#include <linux/mutex.h>2021#include <linux/serdev.h>2222+#include <linux/types.h>2323+#include <linux/unaligned.h>21242225#define PMS7003_DRIVER_NAME "pms7003"2326···7776 /* Used to construct scan to push to the IIO buffer */7877 struct {7978 u16 data[3]; /* PM1, PM2P5, PM10 */8080- s64 ts;7979+ aligned_s64 ts;8180 } scan;8281};8382
···392392 if (fifo_status & cpu_to_le16(ST_LSM6DSX_FIFO_EMPTY_MASK))393393 return 0;394394395395+ if (!pattern_len)396396+ pattern_len = ST_LSM6DSX_SAMPLE_SIZE;397397+395398 fifo_len = (le16_to_cpu(fifo_status) & fifo_diff_mask) *396399 ST_LSM6DSX_CHAN_SIZE;397400 fifo_len = (fifo_len / pattern_len) * pattern_len;···625622 ST_LSM6DSX_TAGGED_SAMPLE_SIZE;626623 if (!fifo_len)627624 return 0;625625+626626+ if (!pattern_len)627627+ pattern_len = ST_LSM6DSX_TAGGED_SAMPLE_SIZE;628628629629 for (read_len = 0; read_len < fifo_len; read_len += pattern_len) {630630 err = st_lsm6dsx_read_block(hw,
+5-2
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
···27192719 }2720272027212721 if (device_property_read_bool(dev, "wakeup-source") ||27222722- (pdata && pdata->wakeup_source))27232723- device_init_wakeup(dev, true);27222722+ (pdata && pdata->wakeup_source)) {27232723+ err = devm_device_init_wakeup(dev);27242724+ if (err)27252725+ return dev_err_probe(dev, err, "Failed to init wakeup\n");27262726+ }2724272727252728 return 0;27262729}
+14-8
drivers/iio/light/hid-sensor-prox.c
···3434 struct iio_chan_spec channels[MAX_CHANNELS];3535 u32 channel2usage[MAX_CHANNELS];3636 u32 human_presence[MAX_CHANNELS];3737- int scale_pre_decml;3838- int scale_post_decml;3939- int scale_precision;3737+ int scale_pre_decml[MAX_CHANNELS];3838+ int scale_post_decml[MAX_CHANNELS];3939+ int scale_precision[MAX_CHANNELS];4040 unsigned long scan_mask[2]; /* One entry plus one terminator. */4141 int num_channels;4242};···116116 ret_type = IIO_VAL_INT;117117 break;118118 case IIO_CHAN_INFO_SCALE:119119- *val = prox_state->scale_pre_decml;120120- *val2 = prox_state->scale_post_decml;121121- ret_type = prox_state->scale_precision;119119+ if (chan->scan_index >= prox_state->num_channels)120120+ return -EINVAL;121121+122122+ *val = prox_state->scale_pre_decml[chan->scan_index];123123+ *val2 = prox_state->scale_post_decml[chan->scan_index];124124+ ret_type = prox_state->scale_precision[chan->scan_index];122125 break;123126 case IIO_CHAN_INFO_OFFSET:124124- *val = hid_sensor_convert_exponent(125125- prox_state->prox_attr[chan->scan_index].unit_expo);127127+ *val = 0;126128 ret_type = IIO_VAL_INT;127129 break;128130 case IIO_CHAN_INFO_SAMP_FREQ:···251249 st->prox_attr[index].size);252250 dev_dbg(&pdev->dev, "prox %x:%x\n", st->prox_attr[index].index,253251 st->prox_attr[index].report_id);252252+ st->scale_precision[index] =253253+ hid_sensor_format_scale(usage_id, &st->prox_attr[index],254254+ &st->scale_pre_decml[index],255255+ &st->scale_post_decml[index]);254256 index++;255257 }256258
+3-2
drivers/iio/light/opt3001.c
···788788 int ret;789789 bool wake_result_ready_queue = false;790790 enum iio_chan_type chan_type = opt->chip_info->chan_type;791791+ bool ok_to_ignore_lock = opt->ok_to_ignore_lock;791792792792- if (!opt->ok_to_ignore_lock)793793+ if (!ok_to_ignore_lock)793794 mutex_lock(&opt->lock);794795795796 ret = i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION);···827826 }828827829828out:830830- if (!opt->ok_to_ignore_lock)829829+ if (!ok_to_ignore_lock)831830 mutex_unlock(&opt->lock);832831833832 if (wake_result_ready_queue)
+6-11
drivers/iio/pressure/mprls0025pa.h
···3434struct mpr_data;3535struct mpr_ops;36363737-/**3838- * struct mpr_chan3939- * @pres: pressure value4040- * @ts: timestamp4141- */4242-struct mpr_chan {4343- s32 pres;4444- s64 ts;4545-};4646-4737enum mpr_func_id {4838 MPR_FUNCTION_A,4939 MPR_FUNCTION_B,···5969 * reading in a loop until data is ready6070 * @completion: handshake from irq to read6171 * @chan: channel values for buffered mode7272+ * @chan.pres: pressure value7373+ * @chan.ts: timestamp6274 * @buffer: raw conversion data6375 */6476struct mpr_data {···7987 struct gpio_desc *gpiod_reset;8088 int irq;8189 struct completion completion;8282- struct mpr_chan chan;9090+ struct {9191+ s32 pres;9292+ aligned_s64 ts;9393+ } chan;8394 u8 buffer[MPR_MEASUREMENT_RD_SIZE] __aligned(IIO_DMA_MINALIGN);8495};8596
···7474 return -1;75757676 switch (code) {7777- case SND_BELL: if (value) value = 1000;7878- case SND_TONE: break;7979- default: return -1;7777+ case SND_BELL:7878+ if (value)7979+ value = 1000;8080+ break;8181+ case SND_TONE:8282+ break;8383+ default:8484+ return -1;8085 }81868287 if (value > 20 && value < 32767)···114109 return -1;115110116111 switch (code) {117117- case SND_BELL: if (value) value = 1000;118118- case SND_TONE: break;119119- default: return -1;112112+ case SND_BELL:113113+ if (value)114114+ value = 1000;115115+ break;116116+ case SND_TONE:117117+ break;118118+ default:119119+ return -1;120120 }121121122122 if (value > 20 && value < 32767)
+5
drivers/input/mouse/synaptics.c
···164164#ifdef CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS165165static const char * const smbus_pnp_ids[] = {166166 /* all of the topbuttonpad_pnp_ids are valid, we just add some extras */167167+ "DLL060d", /* Dell Precision M3800 */167168 "LEN0048", /* X1 Carbon 3 */168169 "LEN0046", /* X250 */169170 "LEN0049", /* Yoga 11e */···191190 "LEN2054", /* E480 */192191 "LEN2055", /* E580 */193192 "LEN2068", /* T14 Gen 1 */193193+ "SYN1221", /* TUXEDO InfinityBook Pro 14 v5 */194194+ "SYN3003", /* HP EliteBook 850 G1 */194195 "SYN3015", /* HP EliteBook 840 G2 */195196 "SYN3052", /* HP EliteBook 840 G4 */196197 "SYN3221", /* HP 15-ay000 */197198 "SYN323d", /* HP Spectre X360 13-w013dx */198199 "SYN3257", /* HP Envy 13-ad105ng */200200+ "TOS01f6", /* Dynabook Portege X30L-G */201201+ "TOS0213", /* Dynabook Portege X30-D */199202 NULL200203};201204#endif
+5-2
drivers/input/touchscreen/cyttsp5.c
···580580 int rc;581581582582 SET_CMD_REPORT_TYPE(cmd[0], 0);583583- SET_CMD_REPORT_ID(cmd[0], HID_POWER_SLEEP);583583+ SET_CMD_REPORT_ID(cmd[0], state);584584 SET_CMD_OPCODE(cmd[1], HID_CMD_SET_POWER);585585586586 rc = cyttsp5_write(ts, HID_COMMAND_REG, cmd, sizeof(cmd));···870870 ts->input->phys = ts->phys;871871 input_set_drvdata(ts->input, ts);872872873873- /* Reset the gpio to be in a reset state */873873+ /* Assert gpio to be in a reset state */874874 ts->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);875875 if (IS_ERR(ts->reset_gpio)) {876876 error = PTR_ERR(ts->reset_gpio);877877 dev_err(dev, "Failed to request reset gpio, error %d\n", error);878878 return error;879879 }880880+881881+ fsleep(10); /* Ensure long-enough reset pulse (minimum 10us). */882882+880883 gpiod_set_value_cansleep(ts->reset_gpio, 0);881884882885 /* Need a delay to have device up */
···1717{1818 u32 desc_offset = FBNIC_IPC_MBX(mbx_idx, desc_idx);19192020+ /* Write the upper 32b and then the lower 32b. Doing this the2121+ * FW can then read lower, upper, lower to verify that the state2222+ * of the descriptor wasn't changed mid-transaction.2323+ */2024 fw_wr32(fbd, desc_offset + 1, upper_32_bits(desc));2125 fw_wrfl(fbd);2226 fw_wr32(fbd, desc_offset, lower_32_bits(desc));2727+}2828+2929+static void __fbnic_mbx_invalidate_desc(struct fbnic_dev *fbd, int mbx_idx,3030+ int desc_idx, u32 desc)3131+{3232+ u32 desc_offset = FBNIC_IPC_MBX(mbx_idx, desc_idx);3333+3434+ /* For initialization we write the lower 32b of the descriptor first.3535+ * This way we can set the state to mark it invalid before we clear the3636+ * upper 32b.3737+ */3838+ fw_wr32(fbd, desc_offset, desc);3939+ fw_wrfl(fbd);4040+ fw_wr32(fbd, desc_offset + 1, 0);2341}24422543static u64 __fbnic_mbx_rd_desc(struct fbnic_dev *fbd, int mbx_idx, int desc_idx)···5133 return desc;5234}53355454-static void fbnic_mbx_init_desc_ring(struct fbnic_dev *fbd, int mbx_idx)3636+static void fbnic_mbx_reset_desc_ring(struct fbnic_dev *fbd, int mbx_idx)5537{5638 int desc_idx;3939+4040+ /* Disable DMA transactions from the device,4141+ * and flush any transactions triggered during cleaning4242+ */4343+ switch (mbx_idx) {4444+ case FBNIC_IPC_MBX_RX_IDX:4545+ wr32(fbd, FBNIC_PUL_OB_TLP_HDR_AW_CFG,4646+ FBNIC_PUL_OB_TLP_HDR_AW_CFG_FLUSH);4747+ break;4848+ case FBNIC_IPC_MBX_TX_IDX:4949+ wr32(fbd, FBNIC_PUL_OB_TLP_HDR_AR_CFG,5050+ FBNIC_PUL_OB_TLP_HDR_AR_CFG_FLUSH);5151+ break;5252+ }5353+5454+ wrfl(fbd);57555856 /* Initialize first descriptor to all 0s. Doing this gives us a5957 * solid stop for the firmware to hit when it is done looping6058 * through the ring.6159 */6262- __fbnic_mbx_wr_desc(fbd, mbx_idx, 0, 0);6363-6464- fw_wrfl(fbd);6060+ __fbnic_mbx_invalidate_desc(fbd, mbx_idx, 0, 0);65616662 /* We then fill the rest of the ring starting at the end and moving6763 * back toward descriptor 0 with skip descriptors that have no6864 * length nor address, and tell the firmware that they can skip6965 * them and just move past them to the one we initialized to 0.7066 */7171- for (desc_idx = FBNIC_IPC_MBX_DESC_LEN; --desc_idx;) {7272- __fbnic_mbx_wr_desc(fbd, mbx_idx, desc_idx,7373- FBNIC_IPC_MBX_DESC_FW_CMPL |7474- FBNIC_IPC_MBX_DESC_HOST_CMPL);7575- fw_wrfl(fbd);7676- }6767+ for (desc_idx = FBNIC_IPC_MBX_DESC_LEN; --desc_idx;)6868+ __fbnic_mbx_invalidate_desc(fbd, mbx_idx, desc_idx,6969+ FBNIC_IPC_MBX_DESC_FW_CMPL |7070+ FBNIC_IPC_MBX_DESC_HOST_CMPL);7771}78727973void fbnic_mbx_init(struct fbnic_dev *fbd)···10676 wr32(fbd, FBNIC_INTR_CLEAR(0), 1u << FBNIC_FW_MSIX_ENTRY);1077710878 for (i = 0; i < FBNIC_IPC_MBX_INDICES; i++)109109- fbnic_mbx_init_desc_ring(fbd, i);7979+ fbnic_mbx_reset_desc_ring(fbd, i);11080}1118111282static int fbnic_mbx_map_msg(struct fbnic_dev *fbd, int mbx_idx,···171141{172142 int i;173143174174- fbnic_mbx_init_desc_ring(fbd, mbx_idx);144144+ fbnic_mbx_reset_desc_ring(fbd, mbx_idx);175145176146 for (i = FBNIC_IPC_MBX_DESC_LEN; i--;)177147 fbnic_mbx_unmap_and_free_msg(fbd, mbx_idx, i);···352322 return err;353323}354324355355-/**356356- * fbnic_fw_xmit_cap_msg - Allocate and populate a FW capabilities message357357- * @fbd: FBNIC device structure358358- *359359- * Return: NULL on failure to allocate, error pointer on error, or pointer360360- * to new TLV test message.361361- *362362- * Sends a single TLV header indicating the host wants the firmware to363363- * confirm the capabilities and version.364364- **/365365-static int fbnic_fw_xmit_cap_msg(struct fbnic_dev *fbd)366366-{367367- int err = fbnic_fw_xmit_simple_msg(fbd, FBNIC_TLV_MSG_ID_HOST_CAP_REQ);368368-369369- /* Return 0 if we are not calling this on ASIC */370370- return (err == -EOPNOTSUPP) ? 0 : err;371371-}372372-373373-static void fbnic_mbx_postinit_desc_ring(struct fbnic_dev *fbd, int mbx_idx)325325+static void fbnic_mbx_init_desc_ring(struct fbnic_dev *fbd, int mbx_idx)374326{375327 struct fbnic_fw_mbx *mbx = &fbd->mbx[mbx_idx];376376-377377- /* This is a one time init, so just exit if it is completed */378378- if (mbx->ready)379379- return;380328381329 mbx->ready = true;382330383331 switch (mbx_idx) {384332 case FBNIC_IPC_MBX_RX_IDX:333333+ /* Enable DMA writes from the device */334334+ wr32(fbd, FBNIC_PUL_OB_TLP_HDR_AW_CFG,335335+ FBNIC_PUL_OB_TLP_HDR_AW_CFG_BME);336336+385337 /* Make sure we have a page for the FW to write to */386338 fbnic_mbx_alloc_rx_msgs(fbd);387339 break;388340 case FBNIC_IPC_MBX_TX_IDX:389389- /* Force version to 1 if we successfully requested an update390390- * from the firmware. This should be overwritten once we get391391- * the actual version from the firmware in the capabilities392392- * request message.393393- */394394- if (!fbnic_fw_xmit_cap_msg(fbd) &&395395- !fbd->fw_cap.running.mgmt.version)396396- fbd->fw_cap.running.mgmt.version = 1;341341+ /* Enable DMA reads from the device */342342+ wr32(fbd, FBNIC_PUL_OB_TLP_HDR_AR_CFG,343343+ FBNIC_PUL_OB_TLP_HDR_AR_CFG_BME);397344 break;398345 }399346}400347401401-static void fbnic_mbx_postinit(struct fbnic_dev *fbd)348348+static bool fbnic_mbx_event(struct fbnic_dev *fbd)402349{403403- int i;404404-405405- /* We only need to do this on the first interrupt following init.350350+ /* We only need to do this on the first interrupt following reset.406351 * this primes the mailbox so that we will have cleared all the407352 * skip descriptors.408353 */409354 if (!(rd32(fbd, FBNIC_INTR_STATUS(0)) & (1u << FBNIC_FW_MSIX_ENTRY)))410410- return;355355+ return false;411356412357 wr32(fbd, FBNIC_INTR_CLEAR(0), 1u << FBNIC_FW_MSIX_ENTRY);413358414414- for (i = 0; i < FBNIC_IPC_MBX_INDICES; i++)415415- fbnic_mbx_postinit_desc_ring(fbd, i);359359+ return true;416360}417361418362/**···863859864860void fbnic_mbx_poll(struct fbnic_dev *fbd)865861{866866- fbnic_mbx_postinit(fbd);862862+ fbnic_mbx_event(fbd);867863868864 fbnic_mbx_process_tx_msgs(fbd);869865 fbnic_mbx_process_rx_msgs(fbd);···871867872868int fbnic_mbx_poll_tx_ready(struct fbnic_dev *fbd)873869{874874- struct fbnic_fw_mbx *tx_mbx;875875- int attempts = 50;870870+ unsigned long timeout = jiffies + 10 * HZ + 1;871871+ int err, i;876872877877- /* Immediate fail if BAR4 isn't there */878878- if (!fbnic_fw_present(fbd))879879- return -ENODEV;873873+ do {874874+ if (!time_is_after_jiffies(timeout))875875+ return -ETIMEDOUT;880876881881- tx_mbx = &fbd->mbx[FBNIC_IPC_MBX_TX_IDX];882882- while (!tx_mbx->ready && --attempts) {883877 /* Force the firmware to trigger an interrupt response to884878 * avoid the mailbox getting stuck closed if the interrupt885879 * is reset.886880 */887887- fbnic_mbx_init_desc_ring(fbd, FBNIC_IPC_MBX_TX_IDX);881881+ fbnic_mbx_reset_desc_ring(fbd, FBNIC_IPC_MBX_TX_IDX);888882889889- msleep(200);883883+ /* Immediate fail if BAR4 went away */884884+ if (!fbnic_fw_present(fbd))885885+ return -ENODEV;890886891891- fbnic_mbx_poll(fbd);887887+ msleep(20);888888+ } while (!fbnic_mbx_event(fbd));889889+890890+ /* FW has shown signs of life. Enable DMA and start Tx/Rx */891891+ for (i = 0; i < FBNIC_IPC_MBX_INDICES; i++)892892+ fbnic_mbx_init_desc_ring(fbd, i);893893+894894+ /* Request an update from the firmware. This should overwrite895895+ * mgmt.version once we get the actual version from the firmware896896+ * in the capabilities request message.897897+ */898898+ err = fbnic_fw_xmit_simple_msg(fbd, FBNIC_TLV_MSG_ID_HOST_CAP_REQ);899899+ if (err)900900+ goto clean_mbx;901901+902902+ /* Use "1" to indicate we entered the state waiting for a response */903903+ fbd->fw_cap.running.mgmt.version = 1;904904+905905+ return 0;906906+clean_mbx:907907+ /* Cleanup Rx buffers and disable mailbox */908908+ fbnic_mbx_clean(fbd);909909+ return err;910910+}911911+912912+static void __fbnic_fw_evict_cmpl(struct fbnic_fw_completion *cmpl_data)913913+{914914+ cmpl_data->result = -EPIPE;915915+ complete(&cmpl_data->done);916916+}917917+918918+static void fbnic_mbx_evict_all_cmpl(struct fbnic_dev *fbd)919919+{920920+ if (fbd->cmpl_data) {921921+ __fbnic_fw_evict_cmpl(fbd->cmpl_data);922922+ fbd->cmpl_data = NULL;892923 }893893-894894- return attempts ? 0 : -ETIMEDOUT;895924}896925897926void fbnic_mbx_flush_tx(struct fbnic_dev *fbd)898927{928928+ unsigned long timeout = jiffies + 10 * HZ + 1;899929 struct fbnic_fw_mbx *tx_mbx;900900- int attempts = 50;901901- u8 count = 0;902902-903903- /* Nothing to do if there is no mailbox */904904- if (!fbnic_fw_present(fbd))905905- return;930930+ u8 tail;906931907932 /* Record current Rx stats */908933 tx_mbx = &fbd->mbx[FBNIC_IPC_MBX_TX_IDX];909934910910- /* Nothing to do if mailbox never got to ready */911911- if (!tx_mbx->ready)912912- return;935935+ spin_lock_irq(&fbd->fw_tx_lock);936936+937937+ /* Clear ready to prevent any further attempts to transmit */938938+ tx_mbx->ready = false;939939+940940+ /* Read tail to determine the last tail state for the ring */941941+ tail = tx_mbx->tail;942942+943943+ /* Flush any completions as we are no longer processing Rx */944944+ fbnic_mbx_evict_all_cmpl(fbd);945945+946946+ spin_unlock_irq(&fbd->fw_tx_lock);913947914948 /* Give firmware time to process packet,915915- * we will wait up to 10 seconds which is 50 waits of 200ms.949949+ * we will wait up to 10 seconds which is 500 waits of 20ms.916950 */917951 do {918952 u8 head = tx_mbx->head;919953920920- if (head == tx_mbx->tail)954954+ /* Tx ring is empty once head == tail */955955+ if (head == tail)921956 break;922957923923- msleep(200);958958+ msleep(20);924959 fbnic_mbx_process_tx_msgs(fbd);925925-926926- count += (tx_mbx->head - head) % FBNIC_IPC_MBX_DESC_LEN;927927- } while (count < FBNIC_IPC_MBX_DESC_LEN && --attempts);960960+ } while (time_is_after_jiffies(timeout));928961}929962930963void fbnic_get_fw_ver_commit_str(struct fbnic_dev *fbd, char *fw_version,
+99-49
drivers/net/ethernet/meta/fbnic/fbnic_irq.c
···1919 return IRQ_HANDLED;2020}21212222-/**2323- * fbnic_fw_enable_mbx - Configure and initialize Firmware Mailbox2424- * @fbd: Pointer to device to initialize2525- *2626- * This function will initialize the firmware mailbox rings, enable the IRQ2727- * and initialize the communication between the Firmware and the host. The2828- * firmware is expected to respond to the initialization by sending an2929- * interrupt essentially notifying the host that it has seen the3030- * initialization and is now synced up.3131- *3232- * Return: non-zero on failure.3333- **/3434-int fbnic_fw_enable_mbx(struct fbnic_dev *fbd)2222+static int __fbnic_fw_enable_mbx(struct fbnic_dev *fbd, int vector)3523{3636- u32 vector = fbd->fw_msix_vector;3724 int err;3838-3939- /* Request the IRQ for FW Mailbox vector. */4040- err = request_threaded_irq(vector, NULL, &fbnic_fw_msix_intr,4141- IRQF_ONESHOT, dev_name(fbd->dev), fbd);4242- if (err)4343- return err;44254526 /* Initialize mailbox and attempt to poll it into ready state */4627 fbnic_mbx_init(fbd);4728 err = fbnic_mbx_poll_tx_ready(fbd);4829 if (err) {4930 dev_warn(fbd->dev, "FW mailbox did not enter ready state\n");5050- free_irq(vector, fbd);5131 return err;5232 }53335454- /* Enable interrupts */3434+ /* Enable interrupt and unmask the vector */3535+ enable_irq(vector);5536 fbnic_wr32(fbd, FBNIC_INTR_MASK_CLEAR(0), 1u << FBNIC_FW_MSIX_ENTRY);56375738 return 0;5839}59406041/**6161- * fbnic_fw_disable_mbx - Disable mailbox and place it in standby state6262- * @fbd: Pointer to device to disable4242+ * fbnic_fw_request_mbx - Configure and initialize Firmware Mailbox4343+ * @fbd: Pointer to device to initialize6344 *6464- * This function will disable the mailbox interrupt, free any messages still6565- * in the mailbox and place it into a standby state. The firmware is6666- * expected to see the update and assume that the host is in the reset state.4545+ * This function will allocate the IRQ and then reinitialize the mailbox4646+ * starting communication between the host and firmware.4747+ *4848+ * Return: non-zero on failure.6749 **/6868-void fbnic_fw_disable_mbx(struct fbnic_dev *fbd)5050+int fbnic_fw_request_mbx(struct fbnic_dev *fbd)6951{7070- /* Disable interrupt and free vector */7171- fbnic_wr32(fbd, FBNIC_INTR_MASK_SET(0), 1u << FBNIC_FW_MSIX_ENTRY);5252+ struct pci_dev *pdev = to_pci_dev(fbd->dev);5353+ int vector, err;72547373- /* Free the vector */7474- free_irq(fbd->fw_msix_vector, fbd);5555+ WARN_ON(fbd->fw_msix_vector);5656+5757+ vector = pci_irq_vector(pdev, FBNIC_FW_MSIX_ENTRY);5858+ if (vector < 0)5959+ return vector;6060+6161+ /* Request the IRQ for FW Mailbox vector. */6262+ err = request_threaded_irq(vector, NULL, &fbnic_fw_msix_intr,6363+ IRQF_ONESHOT | IRQF_NO_AUTOEN,6464+ dev_name(fbd->dev), fbd);6565+ if (err)6666+ return err;6767+6868+ /* Initialize mailbox and attempt to poll it into ready state */6969+ err = __fbnic_fw_enable_mbx(fbd, vector);7070+ if (err)7171+ free_irq(vector, fbd);7272+7373+ fbd->fw_msix_vector = vector;7474+7575+ return err;7676+}7777+7878+/**7979+ * fbnic_fw_disable_mbx - Temporarily place mailbox in standby state8080+ * @fbd: Pointer to device8181+ *8282+ * Shutdown the mailbox by notifying the firmware to stop sending us logs, mask8383+ * and synchronize the IRQ, and then clean up the rings.8484+ **/8585+static void fbnic_fw_disable_mbx(struct fbnic_dev *fbd)8686+{8787+ /* Disable interrupt and synchronize the IRQ */8888+ disable_irq(fbd->fw_msix_vector);8989+9090+ /* Mask the vector */9191+ fbnic_wr32(fbd, FBNIC_INTR_MASK_SET(0), 1u << FBNIC_FW_MSIX_ENTRY);75927693 /* Make sure disabling logs message is sent, must be done here to7794 * avoid risk of completing without a running interrupt.7895 */7996 fbnic_mbx_flush_tx(fbd);8080-8181- /* Reset the mailboxes to the initialized state */8297 fbnic_mbx_clean(fbd);9898+}9999+100100+/**101101+ * fbnic_fw_free_mbx - Disable mailbox and place it in standby state102102+ * @fbd: Pointer to device to disable103103+ *104104+ * This function will disable the mailbox interrupt, free any messages still105105+ * in the mailbox and place it into a disabled state. The firmware is106106+ * expected to see the update and assume that the host is in the reset state.107107+ **/108108+void fbnic_fw_free_mbx(struct fbnic_dev *fbd)109109+{110110+ /* Vector has already been freed */111111+ if (!fbd->fw_msix_vector)112112+ return;113113+114114+ fbnic_fw_disable_mbx(fbd);115115+116116+ /* Free the vector */117117+ free_irq(fbd->fw_msix_vector, fbd);118118+ fbd->fw_msix_vector = 0;83119}8412085121static irqreturn_t fbnic_pcs_msix_intr(int __always_unused irq, void *data)···137101}138102139103/**140140- * fbnic_pcs_irq_enable - Configure the MAC to enable it to advertise link104104+ * fbnic_pcs_request_irq - Configure the PCS to enable it to advertise link141105 * @fbd: Pointer to device to initialize142106 *143107 * This function provides basic bringup for the MAC/PCS IRQ. For now the IRQ···145109 *146110 * Return: non-zero on failure.147111 **/148148-int fbnic_pcs_irq_enable(struct fbnic_dev *fbd)112112+int fbnic_pcs_request_irq(struct fbnic_dev *fbd)149113{150150- u32 vector = fbd->pcs_msix_vector;151151- int err;114114+ struct pci_dev *pdev = to_pci_dev(fbd->dev);115115+ int vector, err;152116153153- /* Request the IRQ for MAC link vector.154154- * Map MAC cause to it, and unmask it117117+ WARN_ON(fbd->pcs_msix_vector);118118+119119+ vector = pci_irq_vector(pdev, FBNIC_PCS_MSIX_ENTRY);120120+ if (vector < 0)121121+ return vector;122122+123123+ /* Request the IRQ for PCS link vector.124124+ * Map PCS cause to it, and unmask it155125 */156126 err = request_irq(vector, &fbnic_pcs_msix_intr, 0,157127 fbd->netdev->name, fbd);158128 if (err)159129 return err;160130131131+ /* Map and enable interrupt, unmask vector after link is configured */161132 fbnic_wr32(fbd, FBNIC_INTR_MSIX_CTRL(FBNIC_INTR_MSIX_CTRL_PCS_IDX),162133 FBNIC_PCS_MSIX_ENTRY | FBNIC_INTR_MSIX_CTRL_ENABLE);134134+135135+ fbd->pcs_msix_vector = vector;163136164137 return 0;165138}166139167140/**168168- * fbnic_pcs_irq_disable - Teardown the MAC IRQ to prepare for stopping141141+ * fbnic_pcs_free_irq - Teardown the PCS IRQ to prepare for stopping169142 * @fbd: Pointer to device that is stopping170143 *171171- * This function undoes the work done in fbnic_pcs_irq_enable and prepares144144+ * This function undoes the work done in fbnic_pcs_request_irq and prepares172145 * the device to no longer receive traffic on the host interface.173146 **/174174-void fbnic_pcs_irq_disable(struct fbnic_dev *fbd)147147+void fbnic_pcs_free_irq(struct fbnic_dev *fbd)175148{149149+ /* Vector has already been freed */150150+ if (!fbd->pcs_msix_vector)151151+ return;152152+176153 /* Disable interrupt */177154 fbnic_wr32(fbd, FBNIC_INTR_MSIX_CTRL(FBNIC_INTR_MSIX_CTRL_PCS_IDX),178155 FBNIC_PCS_MSIX_ENTRY);156156+ fbnic_wrfl(fbd);157157+158158+ /* Synchronize IRQ to prevent race that would unmask vector */159159+ synchronize_irq(fbd->pcs_msix_vector);160160+161161+ /* Mask the vector */179162 fbnic_wr32(fbd, FBNIC_INTR_MASK_SET(0), 1u << FBNIC_PCS_MSIX_ENTRY);180163181164 /* Free the vector */182165 free_irq(fbd->pcs_msix_vector, fbd);166166+ fbd->pcs_msix_vector = 0;183167}184168185169void fbnic_synchronize_irq(struct fbnic_dev *fbd, int nr)···282226{283227 struct pci_dev *pdev = to_pci_dev(fbd->dev);284228285285- fbd->pcs_msix_vector = 0;286286- fbd->fw_msix_vector = 0;287287-288229 fbd->num_irqs = 0;289230290231 pci_free_irq_vectors(pdev);···306253 num_irqs, wanted_irqs);307254308255 fbd->num_irqs = num_irqs;309309-310310- fbd->pcs_msix_vector = pci_irq_vector(pdev, FBNIC_PCS_MSIX_ENTRY);311311- fbd->fw_msix_vector = pci_irq_vector(pdev, FBNIC_FW_MSIX_ENTRY);312256313257 return 0;314258}
···55config DCSSBLK66 def_tristate m77 prompt "DCSSBLK support"88- depends on S390 && BLOCK88+ depends on S390 && BLOCK && (DAX || DAX=n)99 help1010 Support for dcss block device1111···1414 depends on DCSSBLK1515 # requires S390 ZONE_DEVICE support1616 depends on BROKEN1717- select DAX1817 prompt "DCSSBLK DAX support"1918 help2019 Enable DAX operation for the dcss block device
+3-11
drivers/staging/axis-fifo/axis-fifo.c
···393393394394 bytes_available = ioread32(fifo->base_addr + XLLF_RLR_OFFSET);395395 if (!bytes_available) {396396- dev_err(fifo->dt_device, "received a packet of length 0 - fifo core will be reset\n");397397- reset_ip_core(fifo);396396+ dev_err(fifo->dt_device, "received a packet of length 0\n");398397 ret = -EIO;399398 goto end_unlock;400399 }401400402401 if (bytes_available > len) {403403- dev_err(fifo->dt_device, "user read buffer too small (available bytes=%zu user buffer bytes=%zu) - fifo core will be reset\n",402402+ dev_err(fifo->dt_device, "user read buffer too small (available bytes=%zu user buffer bytes=%zu)\n",404403 bytes_available, len);405405- reset_ip_core(fifo);406404 ret = -EINVAL;407405 goto end_unlock;408406 }···409411 /* this probably can't happen unless IP410412 * registers were previously mishandled411413 */412412- dev_err(fifo->dt_device, "received a packet that isn't word-aligned - fifo core will be reset\n");413413- reset_ip_core(fifo);414414+ dev_err(fifo->dt_device, "received a packet that isn't word-aligned\n");414415 ret = -EIO;415416 goto end_unlock;416417 }···430433431434 if (copy_to_user(buf + copied * sizeof(u32), tmp_buf,432435 copy * sizeof(u32))) {433433- reset_ip_core(fifo);434436 ret = -EFAULT;435437 goto end_unlock;436438 }···538542539543 if (copy_from_user(tmp_buf, buf + copied * sizeof(u32),540544 copy * sizeof(u32))) {541541- reset_ip_core(fifo);542545 ret = -EFAULT;543546 goto end_unlock;544547 }···769774 ret = -EIO;770775 goto end;771776 }772772-773773- /* IP sets TDFV to fifo depth - 4 so we will do the same */774774- fifo->tx_fifo_depth -= 4;775777776778 ret = get_dts_property(fifo, "xlnx,use-rx-data", &fifo->has_rx_fifo);777779 if (ret) {
···131131 vmbus_device_unregister(channel->device_obj);132132}133133134134-/* Sysfs API to allow mmap of the ring buffers134134+/* Function used for mmap of ring buffer sysfs interface.135135 * The ring buffer is allocated as contiguous memory by vmbus_open136136 */137137-static int hv_uio_ring_mmap(struct file *filp, struct kobject *kobj,138138- const struct bin_attribute *attr,139139- struct vm_area_struct *vma)137137+static int138138+hv_uio_ring_mmap(struct vmbus_channel *channel, struct vm_area_struct *vma)140139{141141- struct vmbus_channel *channel142142- = container_of(kobj, struct vmbus_channel, kobj);143140 void *ring_buffer = page_address(channel->ringbuffer_page);144141145142 if (channel->state != CHANNEL_OPENED_STATE)···145148 return vm_iomap_memory(vma, virt_to_phys(ring_buffer),146149 channel->ringbuffer_pagecount << PAGE_SHIFT);147150}148148-149149-static const struct bin_attribute ring_buffer_bin_attr = {150150- .attr = {151151- .name = "ring",152152- .mode = 0600,153153- },154154- .size = 2 * SZ_2M,155155- .mmap = hv_uio_ring_mmap,156156-};157151158152/* Callback from VMBUS subsystem when new channel created. */159153static void···166178 /* Disable interrupts on sub channel */167179 new_sc->inbound.ring_buffer->interrupt_mask = 1;168180 set_channel_read_mode(new_sc, HV_CALL_ISR);169169-170170- ret = sysfs_create_bin_file(&new_sc->kobj, &ring_buffer_bin_attr);181181+ ret = hv_create_ring_sysfs(new_sc, hv_uio_ring_mmap);171182 if (ret) {172183 dev_err(device, "sysfs create ring bin file failed; %d\n", ret);173184 vmbus_close(new_sc);···337350 goto fail_close;338351 }339352340340- ret = sysfs_create_bin_file(&channel->kobj, &ring_buffer_bin_attr);341341- if (ret)342342- dev_notice(&dev->device,343343- "sysfs create ring bin file failed; %d\n", ret);353353+ /*354354+ * This internally calls sysfs_update_group, which returns a non-zero value if it executes355355+ * before sysfs_create_group. This is expected as the 'ring' will be created later in356356+ * vmbus_device_register() -> vmbus_add_channel_kobj(). Thus, no need to check the return357357+ * value and print warning.358358+ *359359+ * Creating/exposing sysfs in driver probe is not encouraged as it can lead to race360360+ * conditions with userspace. For backward compatibility, "ring" sysfs could not be removed361361+ * or decoupled from uio_hv_generic probe. Userspace programs can make use of inotify362362+ * APIs to make sure that ring is created.363363+ */364364+ hv_create_ring_sysfs(channel, hv_uio_ring_mmap);344365345366 hv_set_drvdata(dev, pdata);346367···370375 if (!pdata)371376 return;372377373373- sysfs_remove_bin_file(&dev->channel->kobj, &ring_buffer_bin_attr);378378+ hv_remove_ring_sysfs(dev->channel);374379 uio_unregister_device(&pdata->info);375380 hv_uio_cleanup(dev, pdata);376381
+31
drivers/usb/cdns3/cdnsp-gadget.c
···139139 (portsc & PORT_CHANGE_BITS), port_regs);140140}141141142142+static void cdnsp_set_apb_timeout_value(struct cdnsp_device *pdev)143143+{144144+ struct cdns *cdns = dev_get_drvdata(pdev->dev);145145+ __le32 __iomem *reg;146146+ void __iomem *base;147147+ u32 offset = 0;148148+ u32 val;149149+150150+ if (!cdns->override_apb_timeout)151151+ return;152152+153153+ base = &pdev->cap_regs->hc_capbase;154154+ offset = cdnsp_find_next_ext_cap(base, offset, D_XEC_PRE_REGS_CAP);155155+ reg = base + offset + REG_CHICKEN_BITS_3_OFFSET;156156+157157+ val = le32_to_cpu(readl(reg));158158+ val = CHICKEN_APB_TIMEOUT_SET(val, cdns->override_apb_timeout);159159+ writel(cpu_to_le32(val), reg);160160+}161161+142162static void cdnsp_set_chicken_bits_2(struct cdnsp_device *pdev, u32 bit)143163{144164 __le32 __iomem *reg;···17931773 reg += cdnsp_find_next_ext_cap(reg, 0, RTL_REV_CAP);17941774 pdev->rev_cap = reg;1795177517761776+ pdev->rtl_revision = readl(&pdev->rev_cap->rtl_revision);17771777+17961778 dev_info(pdev->dev, "Rev: %08x/%08x, eps: %08x, buff: %08x/%08x\n",17971779 readl(&pdev->rev_cap->ctrl_revision),17981780 readl(&pdev->rev_cap->rtl_revision),···18191797 pdev->hcc_params = readl(&pdev->cap_regs->hc_capbase);18201798 pdev->hci_version = HC_VERSION(pdev->hcc_params);18211799 pdev->hcc_params = readl(&pdev->cap_regs->hcc_params);18001800+18011801+ /*18021802+ * Override the APB timeout value to give the controller more time for18031803+ * enabling UTMI clock and synchronizing APB and UTMI clock domains.18041804+ * This fix is platform specific and is required to fixes issue with18051805+ * reading incorrect value from PORTSC register after resuming18061806+ * from L1 state.18071807+ */18081808+ cdnsp_set_apb_timeout_value(pdev);1822180918231810 cdnsp_get_rev_cap(pdev);18241811
···2828#define PCI_DRIVER_NAME "cdns-pci-usbssp"2929#define PLAT_DRIVER_NAME "cdns-usbssp"30303131+#define CHICKEN_APB_TIMEOUT_VALUE 0x1C203232+3133static struct pci_dev *cdnsp_get_second_fun(struct pci_dev *pdev)3234{3335 /*···141139 cdnsp->otg_irq = pdev->irq;142140 }143141142142+ /*143143+ * Cadence PCI based platform require some longer timeout for APB144144+ * to fixes domain clock synchronization issue after resuming145145+ * controller from L1 state.146146+ */147147+ cdnsp->override_apb_timeout = CHICKEN_APB_TIMEOUT_VALUE;148148+ pci_set_drvdata(pdev, cdnsp);149149+144150 if (pci_is_enabled(func)) {145151 cdnsp->dev = dev;146152 cdnsp->gadget_init = cdnsp_gadget_init;···157147 if (ret)158148 goto free_cdnsp;159149 }160160-161161- pci_set_drvdata(pdev, cdnsp);162150163151 device_wakeup_enable(&pdev->dev);164152 if (pci_dev_run_wake(pdev))
+2-1
drivers/usb/cdns3/cdnsp-ring.c
···308308309309 writel(db_value, reg_addr);310310311311- cdnsp_force_l0_go(pdev);311311+ if (pdev->rtl_revision < RTL_REVISION_NEW_LPM)312312+ cdnsp_force_l0_go(pdev);312313313314 /* Doorbell was set. */314315 return true;
+3
drivers/usb/cdns3/core.h
···7979 * @pdata: platform data from glue layer8080 * @lock: spinlock structure8181 * @xhci_plat_data: xhci private data structure pointer8282+ * @override_apb_timeout: hold value of APB timeout. For value 0 the default8383+ * value in CHICKEN_BITS_3 will be preserved.8284 * @gadget_init: pointer to gadget initialization function8385 */8486struct cdns {···119117 struct cdns3_platform_data *pdata;120118 spinlock_t lock;121119 struct xhci_plat_priv *xhci_plat_data;120120+ u32 override_apb_timeout;122121123122 int (*gadget_init)(struct cdns *cdns);124123};
+36-23
drivers/usb/class/usbtmc.c
···482482 u8 *buffer;483483 u8 tag;484484 int rv;485485+ long wait_rv;485486486487 dev_dbg(dev, "Enter ioctl_read_stb iin_ep_present: %d\n",487488 data->iin_ep_present);···512511 }513512514513 if (data->iin_ep_present) {515515- rv = wait_event_interruptible_timeout(514514+ wait_rv = wait_event_interruptible_timeout(516515 data->waitq,517516 atomic_read(&data->iin_data_valid) != 0,518517 file_data->timeout);519519- if (rv < 0) {520520- dev_dbg(dev, "wait interrupted %d\n", rv);518518+ if (wait_rv < 0) {519519+ dev_dbg(dev, "wait interrupted %ld\n", wait_rv);520520+ rv = wait_rv;521521 goto exit;522522 }523523524524- if (rv == 0) {524524+ if (wait_rv == 0) {525525 dev_dbg(dev, "wait timed out\n");526526 rv = -ETIMEDOUT;527527 goto exit;···540538 }541539542540 dev_dbg(dev, "stb:0x%02x received %d\n", (unsigned int)*stb, rv);541541+542542+ rv = 0;543543544544 exit:545545 /* bump interrupt bTag */···606602{607603 struct usbtmc_device_data *data = file_data->data;608604 struct device *dev = &data->intf->dev;609609- int rv;610605 u32 timeout;611606 unsigned long expire;607607+ long wait_rv;612608613609 if (!data->iin_ep_present) {614610 dev_dbg(dev, "no interrupt endpoint present\n");···622618623619 mutex_unlock(&data->io_mutex);624620625625- rv = wait_event_interruptible_timeout(626626- data->waitq,627627- atomic_read(&file_data->srq_asserted) != 0 ||628628- atomic_read(&file_data->closing),629629- expire);621621+ wait_rv = wait_event_interruptible_timeout(622622+ data->waitq,623623+ atomic_read(&file_data->srq_asserted) != 0 ||624624+ atomic_read(&file_data->closing),625625+ expire);630626631627 mutex_lock(&data->io_mutex);632628633629 /* Note! disconnect or close could be called in the meantime */634630 if (atomic_read(&file_data->closing) || data->zombie)635635- rv = -ENODEV;631631+ return -ENODEV;636632637637- if (rv < 0) {638638- /* dev can be invalid now! */639639- pr_debug("%s - wait interrupted %d\n", __func__, rv);640640- return rv;633633+ if (wait_rv < 0) {634634+ dev_dbg(dev, "%s - wait interrupted %ld\n", __func__, wait_rv);635635+ return wait_rv;641636 }642637643643- if (rv == 0) {638638+ if (wait_rv == 0) {644639 dev_dbg(dev, "%s - wait timed out\n", __func__);645640 return -ETIMEDOUT;646641 }···833830 unsigned long expire;834831 int bufcount = 1;835832 int again = 0;833833+ long wait_rv;836834837835 /* mutex already locked */838836···946942 if (!(flags & USBTMC_FLAG_ASYNC)) {947943 dev_dbg(dev, "%s: before wait time %lu\n",948944 __func__, expire);949949- retval = wait_event_interruptible_timeout(945945+ wait_rv = wait_event_interruptible_timeout(950946 file_data->wait_bulk_in,951947 usbtmc_do_transfer(file_data),952948 expire);953949954954- dev_dbg(dev, "%s: wait returned %d\n",955955- __func__, retval);950950+ dev_dbg(dev, "%s: wait returned %ld\n",951951+ __func__, wait_rv);956952957957- if (retval <= 0) {958958- if (retval == 0)959959- retval = -ETIMEDOUT;953953+ if (wait_rv < 0) {954954+ retval = wait_rv;960955 goto error;961956 }957957+958958+ if (wait_rv == 0) {959959+ retval = -ETIMEDOUT;960960+ goto error;961961+ }962962+962963 }963964964965 urb = usb_get_from_anchor(&file_data->in_anchor);···13891380 if (!buffer)13901381 return -ENOMEM;1391138213921392- mutex_lock(&data->io_mutex);13831383+ retval = mutex_lock_interruptible(&data->io_mutex);13841384+ if (retval < 0)13851385+ goto exit_nolock;13861386+13931387 if (data->zombie) {13941388 retval = -ENODEV;13951389 goto exit;···1515150315161504exit:15171505 mutex_unlock(&data->io_mutex);15061506+exit_nolock:15181507 kfree(buffer);15191508 return retval;15201509}
+4
drivers/usb/dwc3/core.h
···11641164 * @gsbuscfg0_reqinfo: store GSBUSCFG0.DATRDREQINFO, DESRDREQINFO,11651165 * DATWRREQINFO, and DESWRREQINFO value passed from11661166 * glue driver.11671167+ * @wakeup_pending_funcs: Indicates whether any interface has requested for11681168+ * function wakeup in bitmap format where bit position11691169+ * represents interface_id.11671170 */11681171struct dwc3 {11691172 struct work_struct drd_work;···13971394 int num_ep_resized;13981395 struct dentry *debug_root;13991396 u32 gsbuscfg0_reqinfo;13971397+ u32 wakeup_pending_funcs;14001398};1401139914021400#define INCRX_BURST_MODE 0
+23-37
drivers/usb/dwc3/gadget.c
···276276 return ret;277277}278278279279-static int __dwc3_gadget_wakeup(struct dwc3 *dwc, bool async);280280-281279/**282280 * dwc3_send_gadget_ep_cmd - issue an endpoint command283281 * @dep: the endpoint to which the command is going to be issued···23572359 return __dwc3_gadget_get_frame(dwc);23582360}2359236123602360-static int __dwc3_gadget_wakeup(struct dwc3 *dwc, bool async)23622362+static int __dwc3_gadget_wakeup(struct dwc3 *dwc)23612363{23622362- int retries;23632363-23642364 int ret;23652365 u32 reg;23662366···23862390 return -EINVAL;23872391 }2388239223892389- if (async)23902390- dwc3_gadget_enable_linksts_evts(dwc, true);23932393+ dwc3_gadget_enable_linksts_evts(dwc, true);2391239423922395 ret = dwc3_gadget_set_link_state(dwc, DWC3_LINK_STATE_RECOV);23932396 if (ret < 0) {···2405241024062411 /*24072412 * Since link status change events are enabled we will receive24082408- * an U0 event when wakeup is successful. So bail out.24132413+ * an U0 event when wakeup is successful.24092414 */24102410- if (async)24112411- return 0;24122412-24132413- /* poll until Link State changes to ON */24142414- retries = 20000;24152415-24162416- while (retries--) {24172417- reg = dwc3_readl(dwc->regs, DWC3_DSTS);24182418-24192419- /* in HS, means ON */24202420- if (DWC3_DSTS_USBLNKST(reg) == DWC3_LINK_STATE_U0)24212421- break;24222422- }24232423-24242424- if (DWC3_DSTS_USBLNKST(reg) != DWC3_LINK_STATE_U0) {24252425- dev_err(dwc->dev, "failed to send remote wakeup\n");24262426- return -EINVAL;24272427- }24282428-24292415 return 0;24302416}24312417···24272451 spin_unlock_irqrestore(&dwc->lock, flags);24282452 return -EINVAL;24292453 }24302430- ret = __dwc3_gadget_wakeup(dwc, true);24542454+ ret = __dwc3_gadget_wakeup(dwc);2431245524322456 spin_unlock_irqrestore(&dwc->lock, flags);24332457···24552479 */24562480 link_state = dwc3_gadget_get_link_state(dwc);24572481 if (link_state == DWC3_LINK_STATE_U3) {24582458- ret = __dwc3_gadget_wakeup(dwc, false);24592459- if (ret) {24602460- spin_unlock_irqrestore(&dwc->lock, flags);24612461- return -EINVAL;24622462- }24632463- dwc3_resume_gadget(dwc);24642464- dwc->suspended = false;24652465- dwc->link_state = DWC3_LINK_STATE_U0;24822482+ dwc->wakeup_pending_funcs |= BIT(intf_id);24832483+ ret = __dwc3_gadget_wakeup(dwc);24842484+ spin_unlock_irqrestore(&dwc->lock, flags);24852485+ return ret;24662486 }2467248724682488 ret = dwc3_send_gadget_generic_command(dwc, DWC3_DGCMD_DEV_NOTIFICATION,···43254353{43264354 enum dwc3_link_state next = evtinfo & DWC3_LINK_STATE_MASK;43274355 unsigned int pwropt;43564356+ int ret;43574357+ int intf_id;4328435843294359 /*43304360 * WORKAROUND: DWC3 < 2.50a have an issue when configured without···4402442844034429 switch (next) {44044430 case DWC3_LINK_STATE_U0:44054405- if (dwc->gadget->wakeup_armed) {44314431+ if (dwc->gadget->wakeup_armed || dwc->wakeup_pending_funcs) {44064432 dwc3_gadget_enable_linksts_evts(dwc, false);44074433 dwc3_resume_gadget(dwc);44084434 dwc->suspended = false;···44254451 }4426445244274453 dwc->link_state = next;44544454+44554455+ /* Proceed with func wakeup if any interfaces that has requested */44564456+ while (dwc->wakeup_pending_funcs && (next == DWC3_LINK_STATE_U0)) {44574457+ intf_id = ffs(dwc->wakeup_pending_funcs) - 1;44584458+ ret = dwc3_send_gadget_generic_command(dwc, DWC3_DGCMD_DEV_NOTIFICATION,44594459+ DWC3_DGCMDPAR_DN_FUNC_WAKE |44604460+ DWC3_DGCMDPAR_INTF_SEL(intf_id));44614461+ if (ret)44624462+ dev_err(dwc->dev, "Failed to send DN wake for intf %d\n", intf_id);44634463+44644464+ dwc->wakeup_pending_funcs &= ~BIT(intf_id);44654465+ }44284466}4429446744304468static void dwc3_gadget_suspend_interrupt(struct dwc3 *dwc,
+5-7
drivers/usb/gadget/composite.c
···2011201120122012 if (f->get_status) {20132013 status = f->get_status(f);20142014+20142015 if (status < 0)20152016 break;20162016- } else {20172017- /* Set D0 and D1 bits based on func wakeup capability */20182018- if (f->config->bmAttributes & USB_CONFIG_ATT_WAKEUP) {20192019- status |= USB_INTRF_STAT_FUNC_RW_CAP;20202020- if (f->func_wakeup_armed)20212021- status |= USB_INTRF_STAT_FUNC_RW;20222022- }20172017+20182018+ /* if D5 is not set, then device is not wakeup capable */20192019+ if (!(f->config->bmAttributes & USB_CONFIG_ATT_WAKEUP))20202020+ status &= ~(USB_INTRF_STAT_FUNC_RW_CAP | USB_INTRF_STAT_FUNC_RW);20232021 }2024202220252023 put_unaligned_le16(status & 0x0000ffff, req->buf);
···17491749 val = xudc_readl(xudc, CTRL);17501750 val &= ~CTRL_RUN;17511751 xudc_writel(xudc, val, CTRL);17521752+17531753+ val = xudc_readl(xudc, ST);17541754+ if (val & ST_RC)17551755+ xudc_writel(xudc, ST_RC, ST);17521756 }1753175717541758 dev_info(xudc->dev, "ep %u disabled\n", ep->index);
+1-1
drivers/usb/host/uhci-platform.c
···121121 }122122123123 /* Get and enable clock if any specified */124124- uhci->clk = devm_clk_get(&pdev->dev, NULL);124124+ uhci->clk = devm_clk_get_optional(&pdev->dev, NULL);125125 if (IS_ERR(uhci->clk)) {126126 ret = PTR_ERR(uhci->clk);127127 goto err_rmr;
+16-3
drivers/usb/host/xhci-dbgcap.c
···823823{824824 dma_addr_t deq;825825 union xhci_trb *evt;826826+ enum evtreturn ret = EVT_DONE;826827 u32 ctrl, portsc;827828 bool update_erdp = false;828829···910909 break;911910 case TRB_TYPE(TRB_TRANSFER):912911 dbc_handle_xfer_event(dbc, evt);912912+ ret = EVT_XFER_DONE;913913 break;914914 default:915915 break;···929927 lo_hi_writeq(deq, &dbc->regs->erdp);930928 }931929932932- return EVT_DONE;930930+ return ret;933931}934932935933static void xhci_dbc_handle_events(struct work_struct *work)···938936 struct xhci_dbc *dbc;939937 unsigned long flags;940938 unsigned int poll_interval;939939+ unsigned long busypoll_timelimit;941940942941 dbc = container_of(to_delayed_work(work), struct xhci_dbc, event_work);943942 poll_interval = dbc->poll_interval;···957954 dbc->driver->disconnect(dbc);958955 break;959956 case EVT_DONE:960960- /* set fast poll rate if there are pending data transfers */957957+ /*958958+ * Set fast poll rate if there are pending out transfers, or959959+ * a transfer was recently processed960960+ */961961+ busypoll_timelimit = dbc->xfer_timestamp +962962+ msecs_to_jiffies(DBC_XFER_INACTIVITY_TIMEOUT);963963+961964 if (!list_empty(&dbc->eps[BULK_OUT].list_pending) ||962962- !list_empty(&dbc->eps[BULK_IN].list_pending))965965+ time_is_after_jiffies(busypoll_timelimit))963966 poll_interval = 0;967967+ break;968968+ case EVT_XFER_DONE:969969+ dbc->xfer_timestamp = jiffies;970970+ poll_interval = 0;964971 break;965972 default:966973 dev_info(dbc->dev, "stop handling dbc events\n");
···699699 int new_cycle;700700 dma_addr_t addr;701701 u64 hw_dequeue;702702- bool cycle_found = false;702702+ bool hw_dequeue_found = false;703703 bool td_last_trb_found = false;704704 u32 trb_sct = 0;705705 int ret;···715715 hw_dequeue = xhci_get_hw_deq(xhci, dev, ep_index, stream_id);716716 new_seg = ep_ring->deq_seg;717717 new_deq = ep_ring->dequeue;718718- new_cycle = hw_dequeue & 0x1;718718+ new_cycle = le32_to_cpu(td->end_trb->generic.field[3]) & TRB_CYCLE;719719720720 /*721721- * We want to find the pointer, segment and cycle state of the new trb722722- * (the one after current TD's end_trb). We know the cycle state at723723- * hw_dequeue, so walk the ring until both hw_dequeue and end_trb are724724- * found.721721+ * Walk the ring until both the next TRB and hw_dequeue are found (don't722722+ * move hw_dequeue back if it went forward due to a HW bug). Cycle state723723+ * is loaded from a known good TRB, track later toggles to maintain it.725724 */726725 do {727727- if (!cycle_found && xhci_trb_virt_to_dma(new_seg, new_deq)726726+ if (!hw_dequeue_found && xhci_trb_virt_to_dma(new_seg, new_deq)728727 == (dma_addr_t)(hw_dequeue & ~0xf)) {729729- cycle_found = true;728728+ hw_dequeue_found = true;730729 if (td_last_trb_found)731730 break;732731 }733732 if (new_deq == td->end_trb)734733 td_last_trb_found = true;735734736736- if (cycle_found && trb_is_link(new_deq) &&735735+ if (td_last_trb_found && trb_is_link(new_deq) &&737736 link_trb_toggles_cycle(new_deq))738737 new_cycle ^= 0x1;739738···744745 return -EINVAL;745746 }746747747747- } while (!cycle_found || !td_last_trb_found);748748+ } while (!hw_dequeue_found || !td_last_trb_found);748749749750 /* Don't update the ring cycle state for the producer (us). */750751 addr = xhci_trb_virt_to_dma(new_seg, new_deq);
+3
drivers/usb/host/xhci-tegra.c
···13641364 tegra->otg_usb3_port = tegra_xusb_padctl_get_usb3_companion(tegra->padctl,13651365 tegra->otg_usb2_port);1366136613671367+ pm_runtime_get_sync(tegra->dev);13671368 if (tegra->host_mode) {13681369 /* switch to host mode */13691370 if (tegra->otg_usb3_port >= 0) {···13941393 }1395139413961395 tegra_xhci_set_port_power(tegra, true, true);13961396+ pm_runtime_mark_last_busy(tegra->dev);1397139713981398 } else {13991399 if (tegra->otg_usb3_port >= 0)···1402140014031401 tegra_xhci_set_port_power(tegra, true, false);14041402 }14031403+ pm_runtime_put_autosuspend(tegra->dev);14051404}1406140514071406#if IS_ENABLED(CONFIG_PM) || IS_ENABLED(CONFIG_PM_SLEEP)
···2502250225032503 bch2_opts_apply(&c->opts, opts);2504250425052505- /*25062506- * need to initialise sb and set c->vfs_sb _before_ starting fs,25072507- * for blk_holder_ops25082508- */25052505+ ret = bch2_fs_start(c);25062506+ if (ret)25072507+ goto err_stop_fs;2509250825102509 sb = sget(fc->fs_type, NULL, bch2_set_super, fc->sb_flags|SB_NOSEC, c);25112510 ret = PTR_ERR_OR_ZERO(sb);···25652566#endif2566256725672568 sb->s_shrink->seeks = 0;25682568-25692569- ret = bch2_fs_start(c);25702570- if (ret)25712571- goto err_put_super;2572256925732570#ifdef CONFIG_UNICODE25742571 sb->s_encoding = c->cf_encoding;
···298298 */299299static inline int __pure num_extent_folios(const struct extent_buffer *eb)300300{301301+ if (!eb->folios[0])302302+ return 0;301303 if (folio_order(eb->folios[0]))302304 return 1;303305 return num_extent_pages(eb);
+2-2
fs/btrfs/scrub.c
···15411541 u64 extent_gen;15421542 int ret;1543154315441544- if (unlikely(!extent_root)) {15451545- btrfs_err(fs_info, "no valid extent root for scrub");15441544+ if (unlikely(!extent_root || !csum_root)) {15451545+ btrfs_err(fs_info, "no valid extent or csum root for scrub");15461546 return -EUCLEAN;15471547 }15481548 memset(stripe->sectors, 0, sizeof(struct scrub_sector_verification) *
+1-90
fs/btrfs/volumes.c
···733733 return has_metadata_uuid ? sb->metadata_uuid : sb->fsid;734734}735735736736-/*737737- * We can have very weird soft links passed in.738738- * One example is "/proc/self/fd/<fd>", which can be a soft link to739739- * a block device.740740- *741741- * But it's never a good idea to use those weird names.742742- * Here we check if the path (not following symlinks) is a good one inside743743- * "/dev/".744744- */745745-static bool is_good_dev_path(const char *dev_path)746746-{747747- struct path path = { .mnt = NULL, .dentry = NULL };748748- char *path_buf = NULL;749749- char *resolved_path;750750- bool is_good = false;751751- int ret;752752-753753- if (!dev_path)754754- goto out;755755-756756- path_buf = kmalloc(PATH_MAX, GFP_KERNEL);757757- if (!path_buf)758758- goto out;759759-760760- /*761761- * Do not follow soft link, just check if the original path is inside762762- * "/dev/".763763- */764764- ret = kern_path(dev_path, 0, &path);765765- if (ret)766766- goto out;767767- resolved_path = d_path(&path, path_buf, PATH_MAX);768768- if (IS_ERR(resolved_path))769769- goto out;770770- if (strncmp(resolved_path, "/dev/", strlen("/dev/")))771771- goto out;772772- is_good = true;773773-out:774774- kfree(path_buf);775775- path_put(&path);776776- return is_good;777777-}778778-779779-static int get_canonical_dev_path(const char *dev_path, char *canonical)780780-{781781- struct path path = { .mnt = NULL, .dentry = NULL };782782- char *path_buf = NULL;783783- char *resolved_path;784784- int ret;785785-786786- if (!dev_path) {787787- ret = -EINVAL;788788- goto out;789789- }790790-791791- path_buf = kmalloc(PATH_MAX, GFP_KERNEL);792792- if (!path_buf) {793793- ret = -ENOMEM;794794- goto out;795795- }796796-797797- ret = kern_path(dev_path, LOOKUP_FOLLOW, &path);798798- if (ret)799799- goto out;800800- resolved_path = d_path(&path, path_buf, PATH_MAX);801801- if (IS_ERR(resolved_path)) {802802- ret = PTR_ERR(resolved_path);803803- goto out;804804- }805805- ret = strscpy(canonical, resolved_path, PATH_MAX);806806-out:807807- kfree(path_buf);808808- path_put(&path);809809- return ret;810810-}811811-812736static bool is_same_device(struct btrfs_device *device, const char *new_path)813737{814738 struct path old = { .mnt = NULL, .dentry = NULL };···14371513 bool new_device_added = false;14381514 struct btrfs_device *device = NULL;14391515 struct file *bdev_file;14401440- char *canonical_path = NULL;14411516 u64 bytenr;14421517 dev_t devt;14431518 int ret;1444151914451520 lockdep_assert_held(&uuid_mutex);1446152114471447- if (!is_good_dev_path(path)) {14481448- canonical_path = kmalloc(PATH_MAX, GFP_KERNEL);14491449- if (canonical_path) {14501450- ret = get_canonical_dev_path(path, canonical_path);14511451- if (ret < 0) {14521452- kfree(canonical_path);14531453- canonical_path = NULL;14541454- }14551455- }14561456- }14571522 /*14581523 * Avoid an exclusive open here, as the systemd-udev may initiate the14591524 * device scan which may race with the user's mount or mkfs command,···14871574 goto free_disk_super;14881575 }1489157614901490- device = device_list_add(canonical_path ? : path, disk_super,14911491- &new_device_added);15771577+ device = device_list_add(path, disk_super, &new_device_added);14921578 if (!IS_ERR(device) && new_device_added)14931579 btrfs_free_stale_devices(device->devt, device);14941580···1496158414971585error_bdev_put:14981586 fput(bdev_file);14991499- kfree(canonical_path);1500158715011588 return device;15021589}
+2-2
fs/erofs/fileio.c
···150150 io->rq->bio.bi_iter.bi_sector = io->dev.m_pa >> 9;151151 attached = 0;152152 }153153- if (!attached++)154154- erofs_onlinefolio_split(folio);155153 if (!bio_add_folio(&io->rq->bio, folio, len, cur))156154 goto io_retry;155155+ if (!attached++)156156+ erofs_onlinefolio_split(folio);157157 io->dev.m_pa += len;158158 }159159 cur += len;
···174174 struct ocfs2_recovery_map *rm;175175176176 mutex_init(&osb->recovery_lock);177177- osb->disable_recovery = 0;177177+ osb->recovery_state = OCFS2_REC_ENABLED;178178 osb->recovery_thread_task = NULL;179179 init_waitqueue_head(&osb->recovery_event);180180···190190 return 0;191191}192192193193-/* we can't grab the goofy sem lock from inside wait_event, so we use194194- * memory barriers to make sure that we'll see the null task before195195- * being woken up */196193static int ocfs2_recovery_thread_running(struct ocfs2_super *osb)197194{198198- mb();199195 return osb->recovery_thread_task != NULL;196196+}197197+198198+static void ocfs2_recovery_disable(struct ocfs2_super *osb,199199+ enum ocfs2_recovery_state state)200200+{201201+ mutex_lock(&osb->recovery_lock);202202+ /*203203+ * If recovery thread is not running, we can directly transition to204204+ * final state.205205+ */206206+ if (!ocfs2_recovery_thread_running(osb)) {207207+ osb->recovery_state = state + 1;208208+ goto out_lock;209209+ }210210+ osb->recovery_state = state;211211+ /* Wait for recovery thread to acknowledge state transition */212212+ wait_event_cmd(osb->recovery_event,213213+ !ocfs2_recovery_thread_running(osb) ||214214+ osb->recovery_state >= state + 1,215215+ mutex_unlock(&osb->recovery_lock),216216+ mutex_lock(&osb->recovery_lock));217217+out_lock:218218+ mutex_unlock(&osb->recovery_lock);219219+220220+ /*221221+ * At this point we know that no more recovery work can be queued so222222+ * wait for any recovery completion work to complete.223223+ */224224+ if (osb->ocfs2_wq)225225+ flush_workqueue(osb->ocfs2_wq);226226+}227227+228228+void ocfs2_recovery_disable_quota(struct ocfs2_super *osb)229229+{230230+ ocfs2_recovery_disable(osb, OCFS2_REC_QUOTA_WANT_DISABLE);200231}201232202233void ocfs2_recovery_exit(struct ocfs2_super *osb)···236205237206 /* disable any new recovery threads and wait for any currently238207 * running ones to exit. Do this before setting the vol_state. */239239- mutex_lock(&osb->recovery_lock);240240- osb->disable_recovery = 1;241241- mutex_unlock(&osb->recovery_lock);242242- wait_event(osb->recovery_event, !ocfs2_recovery_thread_running(osb));243243-244244- /* At this point, we know that no more recovery threads can be245245- * launched, so wait for any recovery completion work to246246- * complete. */247247- if (osb->ocfs2_wq)248248- flush_workqueue(osb->ocfs2_wq);208208+ ocfs2_recovery_disable(osb, OCFS2_REC_WANT_DISABLE);249209250210 /*251211 * Now that recovery is shut down, and the osb is about to be···14941472 }14951473 }14961474restart:14751475+ if (quota_enabled) {14761476+ mutex_lock(&osb->recovery_lock);14771477+ /* Confirm that recovery thread will no longer recover quotas */14781478+ if (osb->recovery_state == OCFS2_REC_QUOTA_WANT_DISABLE) {14791479+ osb->recovery_state = OCFS2_REC_QUOTA_DISABLED;14801480+ wake_up(&osb->recovery_event);14811481+ }14821482+ if (osb->recovery_state >= OCFS2_REC_QUOTA_DISABLED)14831483+ quota_enabled = 0;14841484+ mutex_unlock(&osb->recovery_lock);14851485+ }14861486+14971487 status = ocfs2_super_lock(osb, 1);14981488 if (status < 0) {14991489 mlog_errno(status);···1603156916041570 ocfs2_free_replay_slots(osb);16051571 osb->recovery_thread_task = NULL;16061606- mb(); /* sync with ocfs2_recovery_thread_running */15721572+ if (osb->recovery_state == OCFS2_REC_WANT_DISABLE)15731573+ osb->recovery_state = OCFS2_REC_DISABLED;16071574 wake_up(&osb->recovery_event);1608157516091576 mutex_unlock(&osb->recovery_lock);1610157716111611- if (quota_enabled)16121612- kfree(rm_quota);15781578+ kfree(rm_quota);1613157916141580 return status;16151581}1616158216171583void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num)16181584{15851585+ int was_set = -1;15861586+16191587 mutex_lock(&osb->recovery_lock);15881588+ if (osb->recovery_state < OCFS2_REC_WANT_DISABLE)15891589+ was_set = ocfs2_recovery_map_set(osb, node_num);1620159016211591 trace_ocfs2_recovery_thread(node_num, osb->node_num,16221622- osb->disable_recovery, osb->recovery_thread_task,16231623- osb->disable_recovery ?16241624- -1 : ocfs2_recovery_map_set(osb, node_num));15921592+ osb->recovery_state, osb->recovery_thread_task, was_set);1625159316261626- if (osb->disable_recovery)15941594+ if (osb->recovery_state >= OCFS2_REC_WANT_DISABLE)16271595 goto out;1628159616291597 if (osb->recovery_thread_task)
···308308void ocfs2_initialize_journal_triggers(struct super_block *sb,309309 struct ocfs2_triggers triggers[]);310310311311+enum ocfs2_recovery_state {312312+ OCFS2_REC_ENABLED = 0,313313+ OCFS2_REC_QUOTA_WANT_DISABLE,314314+ /*315315+ * Must be OCFS2_REC_QUOTA_WANT_DISABLE + 1 for316316+ * ocfs2_recovery_disable_quota() to work.317317+ */318318+ OCFS2_REC_QUOTA_DISABLED,319319+ OCFS2_REC_WANT_DISABLE,320320+ /*321321+ * Must be OCFS2_REC_WANT_DISABLE + 1 for ocfs2_recovery_exit() to work322322+ */323323+ OCFS2_REC_DISABLED,324324+};325325+311326struct ocfs2_journal;312327struct ocfs2_slot_info;313328struct ocfs2_recovery_map;···385370 struct ocfs2_recovery_map *recovery_map;386371 struct ocfs2_replay_map *replay_map;387372 struct task_struct *recovery_thread_task;388388- int disable_recovery;373373+ enum ocfs2_recovery_state recovery_state;389374 wait_queue_head_t checkpoint_event;390375 struct ocfs2_journal *journal;391376 unsigned long osb_commit_interval;
+2-7
fs/ocfs2/quota_local.c
···453453454454/* Sync changes in local quota file into global quota file and455455 * reinitialize local quota file.456456- * The function expects local quota file to be already locked and457457- * s_umount locked in shared mode. */456456+ * The function expects local quota file to be already locked. */458457static int ocfs2_recover_local_quota_file(struct inode *lqinode,459458 int type,460459 struct ocfs2_quota_recovery *rec)···587588{588589 unsigned int ino[OCFS2_MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE,589590 LOCAL_GROUP_QUOTA_SYSTEM_INODE };590590- struct super_block *sb = osb->sb;591591 struct ocfs2_local_disk_dqinfo *ldinfo;592592 struct buffer_head *bh;593593 handle_t *handle;···598600 printk(KERN_NOTICE "ocfs2: Finishing quota recovery on device (%s) for "599601 "slot %u\n", osb->dev_str, slot_num);600602601601- down_read(&sb->s_umount);602603 for (type = 0; type < OCFS2_MAXQUOTAS; type++) {603604 if (list_empty(&(rec->r_list[type])))604605 continue;···674677 break;675678 }676679out:677677- up_read(&sb->s_umount);678680 kfree(rec);679681 return status;680682}···839843 ocfs2_release_local_quota_bitmaps(&oinfo->dqi_chunk);840844841845 /*842842- * s_umount held in exclusive mode protects us against racing with843843- * recovery thread...846846+ * ocfs2_dismount_volume() has already aborted quota recovery...844847 */845848 if (oinfo->dqi_rec) {846849 ocfs2_free_quota_recovery(oinfo->dqi_rec);
+32-6
fs/ocfs2/suballoc.c
···698698699699 bg_bh = ocfs2_block_group_alloc_contig(osb, handle, alloc_inode,700700 ac, cl);701701- if (PTR_ERR(bg_bh) == -ENOSPC)701701+ if (PTR_ERR(bg_bh) == -ENOSPC) {702702+ ac->ac_which = OCFS2_AC_USE_MAIN_DISCONTIG;702703 bg_bh = ocfs2_block_group_alloc_discontig(handle,703704 alloc_inode,704705 ac, cl);706706+ }705707 if (IS_ERR(bg_bh)) {706708 status = PTR_ERR(bg_bh);707709 bg_bh = NULL;···17961794{17971795 int status;17981796 u16 chain;17971797+ u32 contig_bits;17991798 u64 next_group;18001799 struct inode *alloc_inode = ac->ac_inode;18011800 struct buffer_head *group_bh = NULL;···18221819 status = -ENOSPC;18231820 /* for now, the chain search is a bit simplistic. We just use18241821 * the 1st group with any empty bits. */18251825- while ((status = ac->ac_group_search(alloc_inode, group_bh,18261826- bits_wanted, min_bits,18271827- ac->ac_max_block,18281828- res)) == -ENOSPC) {18221822+ while (1) {18231823+ if (ac->ac_which == OCFS2_AC_USE_MAIN_DISCONTIG) {18241824+ contig_bits = le16_to_cpu(bg->bg_contig_free_bits);18251825+ if (!contig_bits)18261826+ contig_bits = ocfs2_find_max_contig_free_bits(bg->bg_bitmap,18271827+ le16_to_cpu(bg->bg_bits), 0);18281828+ if (bits_wanted > contig_bits && contig_bits >= min_bits)18291829+ bits_wanted = contig_bits;18301830+ }18311831+18321832+ status = ac->ac_group_search(alloc_inode, group_bh,18331833+ bits_wanted, min_bits,18341834+ ac->ac_max_block, res);18351835+ if (status != -ENOSPC)18361836+ break;18291837 if (!bg->bg_next_group)18301838 break;18311839···19961982 victim = ocfs2_find_victim_chain(cl);19971983 ac->ac_chain = victim;1998198419851985+search:19991986 status = ocfs2_search_chain(ac, handle, bits_wanted, min_bits,20001987 res, &bits_left);20011988 if (!status) {···20352020 mlog_errno(status);20362021 goto bail;20372022 }20232023+ }20242024+20252025+ /* Chains can't supply the bits_wanted contiguous space.20262026+ * We should switch to using every single bit when allocating20272027+ * from the global bitmap. */20282028+ if (i == le16_to_cpu(cl->cl_next_free_rec) &&20292029+ status == -ENOSPC && ac->ac_which == OCFS2_AC_USE_MAIN) {20302030+ ac->ac_which = OCFS2_AC_USE_MAIN_DISCONTIG;20312031+ ac->ac_chain = victim;20322032+ goto search;20382033 }2039203420402035set_hint:···23902365 BUG_ON(ac->ac_bits_given >= ac->ac_bits_wanted);2391236623922367 BUG_ON(ac->ac_which != OCFS2_AC_USE_LOCAL23932393- && ac->ac_which != OCFS2_AC_USE_MAIN);23682368+ && ac->ac_which != OCFS2_AC_USE_MAIN23692369+ && ac->ac_which != OCFS2_AC_USE_MAIN_DISCONTIG);2394237023952371 if (ac->ac_which == OCFS2_AC_USE_LOCAL) {23962372 WARN_ON(min_clusters > 1);
+1
fs/ocfs2/suballoc.h
···2929#define OCFS2_AC_USE_MAIN 23030#define OCFS2_AC_USE_INODE 33131#define OCFS2_AC_USE_META 43232+#define OCFS2_AC_USE_MAIN_DISCONTIG 53233 u32 ac_which;33343435 /* these are used by the chain search */
+3
fs/ocfs2/super.c
···18121812 /* Orphan scan should be stopped as early as possible */18131813 ocfs2_orphan_scan_stop(osb);1814181418151815+ /* Stop quota recovery so that we can disable quotas */18161816+ ocfs2_recovery_disable_quota(osb);18171817+18151818 ocfs2_disable_quotas(osb);1816181918171820 /* All dquots should be freed by now */
+9-8
fs/pnode.c
···150150 struct mount *origin)151151{152152 /* are there any slaves of this mount? */153153- if (!IS_MNT_PROPAGATED(m) && !list_empty(&m->mnt_slave_list))153153+ if (!IS_MNT_NEW(m) && !list_empty(&m->mnt_slave_list))154154 return first_slave(m);155155156156 while (1) {···174174 * Advance m such that propagation_next will not return175175 * the slaves of m.176176 */177177- if (!IS_MNT_PROPAGATED(m) && !list_empty(&m->mnt_slave_list))177177+ if (!IS_MNT_NEW(m) && !list_empty(&m->mnt_slave_list))178178 m = last_slave(m);179179180180 return m;···185185 while (1) {186186 while (1) {187187 struct mount *next;188188- if (!IS_MNT_PROPAGATED(m) && !list_empty(&m->mnt_slave_list))188188+ if (!IS_MNT_NEW(m) && !list_empty(&m->mnt_slave_list))189189 return first_slave(m);190190 next = next_peer(m);191191 if (m->mnt_group_id == origin->mnt_group_id) {···226226 struct mount *child;227227 int type;228228 /* skip ones added by this propagate_mnt() */229229- if (IS_MNT_PROPAGATED(m))229229+ if (IS_MNT_NEW(m))230230 return 0;231231- /* skip if mountpoint isn't covered by it */231231+ /* skip if mountpoint isn't visible in m */232232 if (!is_subdir(dest_mp->m_dentry, m->mnt.mnt_root))233233 return 0;234234+ /* skip if m is in the anon_ns we are emptying */235235+ if (m->mnt_ns->mntns_flags & MNTNS_PROPAGATING)236236+ return 0;237237+234238 if (peers(m, last_dest)) {235239 type = CL_MAKE_SHARED;236240 } else {···382378 const struct mountpoint *mp)383379{384380 if (!IS_MNT_SHARED(from))385385- return false;386386-387387- if (IS_MNT_PROPAGATED(to))388381 return false;389382390383 if (to->mnt.mnt_root != mp->m_dentry)
···633633 return name;634634 }635635636636+ if (*name == '\0') {637637+ kfree(name);638638+ return ERR_PTR(-EINVAL);639639+ }640640+636641 if (*name == '\\') {637642 pr_err("not allow directory name included leading slash\n");638643 kfree(name);
+7
fs/smb/server/vfs.c
···426426 goto out;427427 }428428429429+ if (v_len <= *pos) {430430+ pr_err("stream write position %lld is out of bounds (stream length: %zd)\n",431431+ *pos, v_len);432432+ err = -EINVAL;433433+ goto out;434434+ }435435+429436 if (v_len < size) {430437 wbuf = kvzalloc(size, KSMBD_DEFAULT_GFP);431438 if (!wbuf) {
+26-7
fs/smb/server/vfs_cache.c
···661661 bool (*skip)(struct ksmbd_tree_connect *tcon,662662 struct ksmbd_file *fp))663663{664664- unsigned int id;665665- struct ksmbd_file *fp;666666- int num = 0;664664+ struct ksmbd_file *fp;665665+ unsigned int id = 0;666666+ int num = 0;667667668668- idr_for_each_entry(ft->idr, fp, id) {669669- if (skip(tcon, fp))668668+ while (1) {669669+ write_lock(&ft->lock);670670+ fp = idr_get_next(ft->idr, &id);671671+ if (!fp) {672672+ write_unlock(&ft->lock);673673+ break;674674+ }675675+676676+ if (skip(tcon, fp) ||677677+ !atomic_dec_and_test(&fp->refcount)) {678678+ id++;679679+ write_unlock(&ft->lock);670680 continue;681681+ }671682672683 set_close_state_blocked_works(fp);684684+ idr_remove(ft->idr, fp->volatile_id);685685+ fp->volatile_id = KSMBD_NO_FID;686686+ write_unlock(&ft->lock);673687674674- if (!atomic_dec_and_test(&fp->refcount))675675- continue;688688+ down_write(&fp->f_ci->m_lock);689689+ list_del_init(&fp->node);690690+ up_write(&fp->f_ci->m_lock);691691+676692 __ksmbd_close_fd(ft, fp);693693+677694 num++;695695+ id++;678696 }697697+679698 return num;680699}681700
+22-6
fs/userfaultfd.c
···15851585 user_uffdio_copy = (struct uffdio_copy __user *) arg;1586158615871587 ret = -EAGAIN;15881588- if (atomic_read(&ctx->mmap_changing))15881588+ if (unlikely(atomic_read(&ctx->mmap_changing))) {15891589+ if (unlikely(put_user(ret, &user_uffdio_copy->copy)))15901590+ return -EFAULT;15891591 goto out;15921592+ }1590159315911594 ret = -EFAULT;15921595 if (copy_from_user(&uffdio_copy, user_uffdio_copy,···16441641 user_uffdio_zeropage = (struct uffdio_zeropage __user *) arg;1645164216461643 ret = -EAGAIN;16471647- if (atomic_read(&ctx->mmap_changing))16441644+ if (unlikely(atomic_read(&ctx->mmap_changing))) {16451645+ if (unlikely(put_user(ret, &user_uffdio_zeropage->zeropage)))16461646+ return -EFAULT;16481647 goto out;16481648+ }1649164916501650 ret = -EFAULT;16511651 if (copy_from_user(&uffdio_zeropage, user_uffdio_zeropage,···17501744 user_uffdio_continue = (struct uffdio_continue __user *)arg;1751174517521746 ret = -EAGAIN;17531753- if (atomic_read(&ctx->mmap_changing))17471747+ if (unlikely(atomic_read(&ctx->mmap_changing))) {17481748+ if (unlikely(put_user(ret, &user_uffdio_continue->mapped)))17491749+ return -EFAULT;17541750 goto out;17511751+ }1755175217561753 ret = -EFAULT;17571754 if (copy_from_user(&uffdio_continue, user_uffdio_continue,···18101801 user_uffdio_poison = (struct uffdio_poison __user *)arg;1811180218121803 ret = -EAGAIN;18131813- if (atomic_read(&ctx->mmap_changing))18041804+ if (unlikely(atomic_read(&ctx->mmap_changing))) {18051805+ if (unlikely(put_user(ret, &user_uffdio_poison->updated)))18061806+ return -EFAULT;18141807 goto out;18081808+ }1815180918161810 ret = -EFAULT;18171811 if (copy_from_user(&uffdio_poison, user_uffdio_poison,···1882187018831871 user_uffdio_move = (struct uffdio_move __user *) arg;1884187218851885- if (atomic_read(&ctx->mmap_changing))18861886- return -EAGAIN;18731873+ ret = -EAGAIN;18741874+ if (unlikely(atomic_read(&ctx->mmap_changing))) {18751875+ if (unlikely(put_user(ret, &user_uffdio_move->move)))18761876+ return -EFAULT;18771877+ goto out;18781878+ }1887187918881880 if (copy_from_user(&uffdio_move, user_uffdio_move,18891881 /* don't copy "move" last field */
+8-10
include/drm/ttm/ttm_backup.h
···99#include <linux/mm_types.h>1010#include <linux/shmem_fs.h>11111212-struct ttm_backup;1313-1412/**1513 * ttm_backup_handle_to_page_ptr() - Convert handle to struct page pointer1614 * @handle: The handle to convert.1715 *1816 * Converts an opaque handle received from the1919- * struct ttm_backoup_ops::backup_page() function to an (invalid)1717+ * ttm_backup_backup_page() function to an (invalid)2018 * struct page pointer suitable for a struct page array.2119 *2220 * Return: An (invalid) struct page pointer.···4345 *4446 * Return: The handle that was previously used in4547 * ttm_backup_handle_to_page_ptr() to obtain a struct page pointer, suitable4646- * for use as argument in the struct ttm_backup_ops drop() or4747- * copy_backed_up_page() functions.4848+ * for use as argument in the struct ttm_backup_drop() or4949+ * ttm_backup_copy_page() functions.4850 */4951static inline unsigned long5052ttm_backup_page_ptr_to_handle(const struct page *page)···5355 return (unsigned long)page >> 1;5456}55575656-void ttm_backup_drop(struct ttm_backup *backup, pgoff_t handle);5858+void ttm_backup_drop(struct file *backup, pgoff_t handle);57595858-int ttm_backup_copy_page(struct ttm_backup *backup, struct page *dst,6060+int ttm_backup_copy_page(struct file *backup, struct page *dst,5961 pgoff_t handle, bool intr);60626163s646262-ttm_backup_backup_page(struct ttm_backup *backup, struct page *page,6464+ttm_backup_backup_page(struct file *backup, struct page *page,6365 bool writeback, pgoff_t idx, gfp_t page_gfp,6466 gfp_t alloc_gfp);65676666-void ttm_backup_fini(struct ttm_backup *backup);6868+void ttm_backup_fini(struct file *backup);67696870u64 ttm_backup_bytes_avail(void);69717070-struct ttm_backup *ttm_backup_shmem_create(loff_t size);7272+struct file *ttm_backup_shmem_create(loff_t size);71737274#endif
+1-1
include/drm/ttm/ttm_tt.h
···118118 * ttm_tt_create() callback is responsible for assigning119119 * this field.120120 */121121- struct ttm_backup *backup;121121+ struct file *backup;122122 /**123123 * @caching: The current caching state of the pages, see enum124124 * ttm_caching.
+6
include/linux/hyperv.h
···1002100210031003 /* The max size of a packet on this channel */10041004 u32 max_pkt_size;10051005+10061006+ /* function to mmap ring buffer memory to the channel's sysfs ring attribute */10071007+ int (*mmap_ring_buffer)(struct vmbus_channel *channel, struct vm_area_struct *vma);10081008+10091009+ /* boolean to control visibility of sysfs for ring buffer */10101010+ bool ring_sysfs_visible;10051011};1006101210071013#define lock_requestor(channel, flags) \
···4972497249734973/* Functions used for secondary unicast and multicast support */49744974void dev_set_rx_mode(struct net_device *dev);49754975+int netif_set_promiscuity(struct net_device *dev, int inc);49754976int dev_set_promiscuity(struct net_device *dev, int inc);49764977int netif_set_allmulti(struct net_device *dev, int inc, bool notify);49774978int dev_set_allmulti(struct net_device *dev, int inc);
+5-3
include/linux/timekeeper_internal.h
···5151 * @offs_real: Offset clock monotonic -> clock realtime5252 * @offs_boot: Offset clock monotonic -> clock boottime5353 * @offs_tai: Offset clock monotonic -> clock tai5454- * @tai_offset: The current UTC to TAI offset in seconds5454+ * @coarse_nsec: The nanoseconds part for coarse time getters5555 * @tkr_raw: The readout base structure for CLOCK_MONOTONIC_RAW5656 * @raw_sec: CLOCK_MONOTONIC_RAW time in seconds5757 * @clock_was_set_seq: The sequence number of clock was set events···7676 * ntp shifted nano seconds.7777 * @ntp_err_mult: Multiplication factor for scaled math conversion7878 * @skip_second_overflow: Flag used to avoid updating NTP twice with same second7979+ * @tai_offset: The current UTC to TAI offset in seconds7980 *8081 * Note: For timespec(64) based interfaces wall_to_monotonic is what8182 * we need to add to xtime (or xtime corrected for sub jiffy times)···101100 * which results in the following cacheline layout:102101 *103102 * 0: seqcount, tkr_mono104104- * 1: xtime_sec ... tai_offset103103+ * 1: xtime_sec ... coarse_nsec105104 * 2: tkr_raw, raw_sec106105 * 3,4: Internal variables107106 *···122121 ktime_t offs_real;123122 ktime_t offs_boot;124123 ktime_t offs_tai;125125- s32 tai_offset;124124+ u32 coarse_nsec;126125127126 /* Cacheline 2: */128127 struct tk_read_base tkr_raw;···145144 u32 ntp_error_shift;146145 u32 ntp_err_mult;147146 u32 skip_second_overflow;147147+ s32 tai_offset;148148};149149150150#ifdef CONFIG_GENERIC_TIME_VSYSCALL
+1
include/linux/vmalloc.h
···6161 unsigned int nr_pages;6262 phys_addr_t phys_addr;6363 const void *caller;6464+ unsigned long requested_size;6465};65666667struct vmap_area {
+6
include/net/netdev_queues.h
···103103 struct netdev_queue_stats_tx *tx);104104};105105106106+void netdev_stat_queue_sum(struct net_device *netdev,107107+ int rx_start, int rx_end,108108+ struct netdev_queue_stats_rx *rx_sum,109109+ int tx_start, int tx_end,110110+ struct netdev_queue_stats_tx *tx_sum);111111+106112/**107113 * struct netdev_queue_mgmt_ops - netdev ops for queue management108114 *
···49684968 * the netns switch takes place from ingress to ingress without49694969 * going through the CPU's backlog queue.49704970 *49714971+ * *skb*\ **->mark** and *skb*\ **->tstamp** are not cleared during49724972+ * the netns switch.49734973+ *49714974 * The *flags* argument is reserved and must be 0. The helper is49724975 * currently only supported for tc BPF program types at the49734976 * ingress hook and for veth and netkit target device types. The
···30753075void split_huge_pmd_locked(struct vm_area_struct *vma, unsigned long address,30763076 pmd_t *pmd, bool freeze, struct folio *folio)30773077{30783078+ bool pmd_migration = is_pmd_migration_entry(*pmd);30793079+30783080 VM_WARN_ON_ONCE(folio && !folio_test_pmd_mappable(folio));30793081 VM_WARN_ON_ONCE(!IS_ALIGNED(address, HPAGE_PMD_SIZE));30803082 VM_WARN_ON_ONCE(folio && !folio_test_locked(folio));···30873085 * require a folio to check the PMD against. Otherwise, there30883086 * is a risk of replacing the wrong folio.30893087 */30903090- if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd) ||30913091- is_pmd_migration_entry(*pmd)) {30923092- if (folio && folio != pmd_folio(*pmd))30883088+ if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd) || pmd_migration) {30893089+ /*30903090+ * Do not apply pmd_folio() to a migration entry; and folio lock30913091+ * guarantees that it must be of the wrong folio anyway.30923092+ */30933093+ if (folio && (pmd_migration || folio != pmd_folio(*pmd)))30933094 return;30943095 __split_huge_pmd_locked(vma, pmd, address, freeze);30953096 }
+6
mm/hugetlb.c
···4034403440354035 list_for_each_entry_safe(folio, next, src_list, lru) {40364036 int i;40374037+ bool cma;4037403840384039 if (folio_test_hugetlb_vmemmap_optimized(folio))40394040 continue;40414041+40424042+ cma = folio_test_hugetlb_cma(folio);4040404340414044 list_del(&folio->lru);40424045···4056405340574054 new_folio->mapping = NULL;40584055 init_new_hugetlb_folio(dst, new_folio);40564056+ /* Copy the CMA flag so that it is freed correctly */40574057+ if (cma)40584058+ folio_set_hugetlb_cma(new_folio);40594059 list_add(&new_folio->lru, &dst_list);40604060 }40614061 }
+11-16
mm/internal.h
···248248 pte_t *start_ptep, pte_t pte, int max_nr, fpb_t flags,249249 bool *any_writable, bool *any_young, bool *any_dirty)250250{251251- unsigned long folio_end_pfn = folio_pfn(folio) + folio_nr_pages(folio);252252- const pte_t *end_ptep = start_ptep + max_nr;253251 pte_t expected_pte, *ptep;254252 bool writable, young, dirty;255255- int nr;253253+ int nr, cur_nr;256254257255 if (any_writable)258256 *any_writable = false;···263265 VM_WARN_ON_FOLIO(!folio_test_large(folio) || max_nr < 1, folio);264266 VM_WARN_ON_FOLIO(page_folio(pfn_to_page(pte_pfn(pte))) != folio, folio);265267268268+ /* Limit max_nr to the actual remaining PFNs in the folio we could batch. */269269+ max_nr = min_t(unsigned long, max_nr,270270+ folio_pfn(folio) + folio_nr_pages(folio) - pte_pfn(pte));271271+266272 nr = pte_batch_hint(start_ptep, pte);267273 expected_pte = __pte_batch_clear_ignored(pte_advance_pfn(pte, nr), flags);268274 ptep = start_ptep + nr;269275270270- while (ptep < end_ptep) {276276+ while (nr < max_nr) {271277 pte = ptep_get(ptep);272278 if (any_writable)273279 writable = !!pte_write(pte);···284282 if (!pte_same(pte, expected_pte))285283 break;286284287287- /*288288- * Stop immediately once we reached the end of the folio. In289289- * corner cases the next PFN might fall into a different290290- * folio.291291- */292292- if (pte_pfn(pte) >= folio_end_pfn)293293- break;294294-295285 if (any_writable)296286 *any_writable |= writable;297287 if (any_young)···291297 if (any_dirty)292298 *any_dirty |= dirty;293299294294- nr = pte_batch_hint(ptep, pte);295295- expected_pte = pte_advance_pfn(expected_pte, nr);296296- ptep += nr;300300+ cur_nr = pte_batch_hint(ptep, pte);301301+ expected_pte = pte_advance_pfn(expected_pte, cur_nr);302302+ ptep += cur_nr;303303+ nr += cur_nr;297304 }298305299299- return min(ptep - start_ptep, max_nr);306306+ return min(nr, max_nr);300307}301308302309/**
+8-1
mm/memblock.c
···457457 min(new_area_start, memblock.current_limit),458458 new_alloc_size, PAGE_SIZE);459459460460- new_array = addr ? __va(addr) : NULL;460460+ if (addr) {461461+ /* The memory may not have been accepted, yet. */462462+ accept_memory(addr, new_alloc_size);463463+464464+ new_array = __va(addr);465465+ } else {466466+ new_array = NULL;467467+ }461468 }462469 if (!addr) {463470 pr_err("memblock: Failed to double %s array from %ld to %ld entries !\n",
···12721272 VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);12731273 VM_BUG_ON_FOLIO(!folio_test_uptodate(folio), folio);1274127412751275- /*12761276- * Should not even be attempting large allocations when huge12771277- * page swap is disabled. Warn and fail the allocation.12781278- */12791279- if (order && (!IS_ENABLED(CONFIG_THP_SWAP) || size > SWAPFILE_CLUSTER)) {12801280- VM_WARN_ON_ONCE(1);12811281- return -EINVAL;12751275+ if (order) {12761276+ /*12771277+ * Reject large allocation when THP_SWAP is disabled,12781278+ * the caller should split the folio and try again.12791279+ */12801280+ if (!IS_ENABLED(CONFIG_THP_SWAP))12811281+ return -EAGAIN;12821282+12831283+ /*12841284+ * Allocation size should never exceed cluster size12851285+ * (HPAGE_PMD_SIZE).12861286+ */12871287+ if (size > SWAPFILE_CLUSTER) {12881288+ VM_WARN_ON_ONCE(1);12891289+ return -EINVAL;12901290+ }12821291 }1283129212841293 local_lock(&percpu_swap_cluster.lock);
+24-7
mm/vmalloc.c
···19401940{19411941 vm->flags = flags;19421942 vm->addr = (void *)va->va_start;19431943- vm->size = va_size(va);19431943+ vm->size = vm->requested_size = va_size(va);19441944 vm->caller = caller;19451945 va->vm = vm;19461946}···3133313331343134 area->flags = flags;31353135 area->caller = caller;31363136+ area->requested_size = requested_size;3136313731373138 va = alloc_vmap_area(size, align, start, end, node, gfp_mask, 0, area);31383139 if (IS_ERR(va)) {···40644063 */40654064void *vrealloc_noprof(const void *p, size_t size, gfp_t flags)40664065{40664066+ struct vm_struct *vm = NULL;40674067+ size_t alloced_size = 0;40674068 size_t old_size = 0;40684069 void *n;40694070···40754072 }4076407340774074 if (p) {40784078- struct vm_struct *vm;40794079-40804075 vm = find_vm_area(p);40814076 if (unlikely(!vm)) {40824077 WARN(1, "Trying to vrealloc() nonexistent vm area (%p)\n", p);40834078 return NULL;40844079 }4085408040864086- old_size = get_vm_area_size(vm);40814081+ alloced_size = get_vm_area_size(vm);40824082+ old_size = vm->requested_size;40834083+ if (WARN(alloced_size < old_size,40844084+ "vrealloc() has mismatched area vs requested sizes (%p)\n", p))40854085+ return NULL;40874086 }4088408740894088 /*···40934088 * would be a good heuristic for when to shrink the vm_area?40944089 */40954090 if (size <= old_size) {40964096- /* Zero out spare memory. */40974097- if (want_init_on_alloc(flags))40914091+ /* Zero out "freed" memory. */40924092+ if (want_init_on_free())40984093 memset((void *)p + size, 0, old_size - size);40944094+ vm->requested_size = size;40994095 kasan_poison_vmalloc(p + size, old_size - size);41004100- kasan_unpoison_vmalloc(p, size, KASAN_VMALLOC_PROT_NORMAL);41014096 return (void *)p;40974097+ }40984098+40994099+ /*41004100+ * We already have the bytes available in the allocation; use them.41014101+ */41024102+ if (size <= alloced_size) {41034103+ kasan_unpoison_vmalloc(p + old_size, size - old_size,41044104+ KASAN_VMALLOC_PROT_NORMAL);41054105+ /* Zero out "alloced" memory. */41064106+ if (want_init_on_alloc(flags))41074107+ memset((void *)p + old_size, 0, size - old_size);41084108+ vm->requested_size = size;41024109 }4103411041044111 /* TODO: Grow the vm_area, i.e. allocate and map additional pages. */
+91-60
net/can/gw.c
···130130 u32 handled_frames;131131 u32 dropped_frames;132132 u32 deleted_frames;133133- struct cf_mod mod;133133+ struct cf_mod __rcu *cf_mod;134134 union {135135 /* CAN frame data source */136136 struct net_device *dev;···459459 struct cgw_job *gwj = (struct cgw_job *)data;460460 struct canfd_frame *cf;461461 struct sk_buff *nskb;462462+ struct cf_mod *mod;462463 int modidx = 0;463464464465 /* process strictly Classic CAN or CAN FD frames */···507506 * When there is at least one modification function activated,508507 * we need to copy the skb as we want to modify skb->data.509508 */510510- if (gwj->mod.modfunc[0])509509+ mod = rcu_dereference(gwj->cf_mod);510510+ if (mod->modfunc[0])511511 nskb = skb_copy(skb, GFP_ATOMIC);512512 else513513 nskb = skb_clone(skb, GFP_ATOMIC);···531529 cf = (struct canfd_frame *)nskb->data;532530533531 /* perform preprocessed modification functions if there are any */534534- while (modidx < MAX_MODFUNCTIONS && gwj->mod.modfunc[modidx])535535- (*gwj->mod.modfunc[modidx++])(cf, &gwj->mod);532532+ while (modidx < MAX_MODFUNCTIONS && mod->modfunc[modidx])533533+ (*mod->modfunc[modidx++])(cf, mod);536534537535 /* Has the CAN frame been modified? */538536 if (modidx) {···548546 }549547550548 /* check for checksum updates */551551- if (gwj->mod.csumfunc.crc8)552552- (*gwj->mod.csumfunc.crc8)(cf, &gwj->mod.csum.crc8);549549+ if (mod->csumfunc.crc8)550550+ (*mod->csumfunc.crc8)(cf, &mod->csum.crc8);553551554554- if (gwj->mod.csumfunc.xor)555555- (*gwj->mod.csumfunc.xor)(cf, &gwj->mod.csum.xor);552552+ if (mod->csumfunc.xor)553553+ (*mod->csumfunc.xor)(cf, &mod->csum.xor);556554 }557555558556 /* clear the skb timestamp if not configured the other way */···583581{584582 struct cgw_job *gwj = container_of(rcu_head, struct cgw_job, rcu);585583584584+ /* cgw_job::cf_mod is always accessed from the same cgw_job object within585585+ * the same RCU read section. Once cgw_job is scheduled for removal,586586+ * cf_mod can also be removed without mandating an additional grace period.587587+ */588588+ kfree(rcu_access_pointer(gwj->cf_mod));586589 kmem_cache_free(cgw_cache, gwj);590590+}591591+592592+/* Return cgw_job::cf_mod with RTNL protected section */593593+static struct cf_mod *cgw_job_cf_mod(struct cgw_job *gwj)594594+{595595+ return rcu_dereference_protected(gwj->cf_mod, rtnl_is_locked());587596}588597589598static int cgw_notifier(struct notifier_block *nb,···629616{630617 struct rtcanmsg *rtcan;631618 struct nlmsghdr *nlh;619619+ struct cf_mod *mod;632620633621 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*rtcan), flags);634622 if (!nlh)···664650 goto cancel;665651 }666652653653+ mod = cgw_job_cf_mod(gwj);667654 if (gwj->flags & CGW_FLAGS_CAN_FD) {668655 struct cgw_fdframe_mod mb;669656670670- if (gwj->mod.modtype.and) {671671- memcpy(&mb.cf, &gwj->mod.modframe.and, sizeof(mb.cf));672672- mb.modtype = gwj->mod.modtype.and;657657+ if (mod->modtype.and) {658658+ memcpy(&mb.cf, &mod->modframe.and, sizeof(mb.cf));659659+ mb.modtype = mod->modtype.and;673660 if (nla_put(skb, CGW_FDMOD_AND, sizeof(mb), &mb) < 0)674661 goto cancel;675662 }676663677677- if (gwj->mod.modtype.or) {678678- memcpy(&mb.cf, &gwj->mod.modframe.or, sizeof(mb.cf));679679- mb.modtype = gwj->mod.modtype.or;664664+ if (mod->modtype.or) {665665+ memcpy(&mb.cf, &mod->modframe.or, sizeof(mb.cf));666666+ mb.modtype = mod->modtype.or;680667 if (nla_put(skb, CGW_FDMOD_OR, sizeof(mb), &mb) < 0)681668 goto cancel;682669 }683670684684- if (gwj->mod.modtype.xor) {685685- memcpy(&mb.cf, &gwj->mod.modframe.xor, sizeof(mb.cf));686686- mb.modtype = gwj->mod.modtype.xor;671671+ if (mod->modtype.xor) {672672+ memcpy(&mb.cf, &mod->modframe.xor, sizeof(mb.cf));673673+ mb.modtype = mod->modtype.xor;687674 if (nla_put(skb, CGW_FDMOD_XOR, sizeof(mb), &mb) < 0)688675 goto cancel;689676 }690677691691- if (gwj->mod.modtype.set) {692692- memcpy(&mb.cf, &gwj->mod.modframe.set, sizeof(mb.cf));693693- mb.modtype = gwj->mod.modtype.set;678678+ if (mod->modtype.set) {679679+ memcpy(&mb.cf, &mod->modframe.set, sizeof(mb.cf));680680+ mb.modtype = mod->modtype.set;694681 if (nla_put(skb, CGW_FDMOD_SET, sizeof(mb), &mb) < 0)695682 goto cancel;696683 }697684 } else {698685 struct cgw_frame_mod mb;699686700700- if (gwj->mod.modtype.and) {701701- memcpy(&mb.cf, &gwj->mod.modframe.and, sizeof(mb.cf));702702- mb.modtype = gwj->mod.modtype.and;687687+ if (mod->modtype.and) {688688+ memcpy(&mb.cf, &mod->modframe.and, sizeof(mb.cf));689689+ mb.modtype = mod->modtype.and;703690 if (nla_put(skb, CGW_MOD_AND, sizeof(mb), &mb) < 0)704691 goto cancel;705692 }706693707707- if (gwj->mod.modtype.or) {708708- memcpy(&mb.cf, &gwj->mod.modframe.or, sizeof(mb.cf));709709- mb.modtype = gwj->mod.modtype.or;694694+ if (mod->modtype.or) {695695+ memcpy(&mb.cf, &mod->modframe.or, sizeof(mb.cf));696696+ mb.modtype = mod->modtype.or;710697 if (nla_put(skb, CGW_MOD_OR, sizeof(mb), &mb) < 0)711698 goto cancel;712699 }713700714714- if (gwj->mod.modtype.xor) {715715- memcpy(&mb.cf, &gwj->mod.modframe.xor, sizeof(mb.cf));716716- mb.modtype = gwj->mod.modtype.xor;701701+ if (mod->modtype.xor) {702702+ memcpy(&mb.cf, &mod->modframe.xor, sizeof(mb.cf));703703+ mb.modtype = mod->modtype.xor;717704 if (nla_put(skb, CGW_MOD_XOR, sizeof(mb), &mb) < 0)718705 goto cancel;719706 }720707721721- if (gwj->mod.modtype.set) {722722- memcpy(&mb.cf, &gwj->mod.modframe.set, sizeof(mb.cf));723723- mb.modtype = gwj->mod.modtype.set;708708+ if (mod->modtype.set) {709709+ memcpy(&mb.cf, &mod->modframe.set, sizeof(mb.cf));710710+ mb.modtype = mod->modtype.set;724711 if (nla_put(skb, CGW_MOD_SET, sizeof(mb), &mb) < 0)725712 goto cancel;726713 }727714 }728715729729- if (gwj->mod.uid) {730730- if (nla_put_u32(skb, CGW_MOD_UID, gwj->mod.uid) < 0)716716+ if (mod->uid) {717717+ if (nla_put_u32(skb, CGW_MOD_UID, mod->uid) < 0)731718 goto cancel;732719 }733720734734- if (gwj->mod.csumfunc.crc8) {721721+ if (mod->csumfunc.crc8) {735722 if (nla_put(skb, CGW_CS_CRC8, CGW_CS_CRC8_LEN,736736- &gwj->mod.csum.crc8) < 0)723723+ &mod->csum.crc8) < 0)737724 goto cancel;738725 }739726740740- if (gwj->mod.csumfunc.xor) {727727+ if (mod->csumfunc.xor) {741728 if (nla_put(skb, CGW_CS_XOR, CGW_CS_XOR_LEN,742742- &gwj->mod.csum.xor) < 0)729729+ &mod->csum.xor) < 0)743730 goto cancel;744731 }745732···10741059 struct net *net = sock_net(skb->sk);10751060 struct rtcanmsg *r;10761061 struct cgw_job *gwj;10771077- struct cf_mod mod;10621062+ struct cf_mod *mod;10781063 struct can_can_gw ccgw;10791064 u8 limhops = 0;10801065 int err = 0;···10931078 if (r->gwtype != CGW_TYPE_CAN_CAN)10941079 return -EINVAL;1095108010961096- err = cgw_parse_attr(nlh, &mod, CGW_TYPE_CAN_CAN, &ccgw, &limhops);10971097- if (err < 0)10981098- return err;10811081+ mod = kmalloc(sizeof(*mod), GFP_KERNEL);10821082+ if (!mod)10831083+ return -ENOMEM;1099108411001100- if (mod.uid) {10851085+ err = cgw_parse_attr(nlh, mod, CGW_TYPE_CAN_CAN, &ccgw, &limhops);10861086+ if (err < 0)10871087+ goto out_free_cf;10881088+10891089+ if (mod->uid) {11011090 ASSERT_RTNL();1102109111031092 /* check for updating an existing job with identical uid */11041093 hlist_for_each_entry(gwj, &net->can.cgw_list, list) {11051105- if (gwj->mod.uid != mod.uid)10941094+ struct cf_mod *old_cf;10951095+10961096+ old_cf = cgw_job_cf_mod(gwj);10971097+ if (old_cf->uid != mod->uid)11061098 continue;1107109911081100 /* interfaces & filters must be identical */11091109- if (memcmp(&gwj->ccgw, &ccgw, sizeof(ccgw)))11101110- return -EINVAL;11011101+ if (memcmp(&gwj->ccgw, &ccgw, sizeof(ccgw))) {11021102+ err = -EINVAL;11031103+ goto out_free_cf;11041104+ }1111110511121112- /* update modifications with disabled softirq & quit */11131113- local_bh_disable();11141114- memcpy(&gwj->mod, &mod, sizeof(mod));11151115- local_bh_enable();11061106+ rcu_assign_pointer(gwj->cf_mod, mod);11071107+ kfree_rcu_mightsleep(old_cf);11161108 return 0;11171109 }11181110 }1119111111201112 /* ifindex == 0 is not allowed for job creation */11211121- if (!ccgw.src_idx || !ccgw.dst_idx)11221122- return -ENODEV;11131113+ if (!ccgw.src_idx || !ccgw.dst_idx) {11141114+ err = -ENODEV;11151115+ goto out_free_cf;11161116+ }1123111711241118 gwj = kmem_cache_alloc(cgw_cache, GFP_KERNEL);11251125- if (!gwj)11261126- return -ENOMEM;11191119+ if (!gwj) {11201120+ err = -ENOMEM;11211121+ goto out_free_cf;11221122+ }1127112311281124 gwj->handled_frames = 0;11291125 gwj->dropped_frames = 0;···11441118 gwj->limit_hops = limhops;1145111911461120 /* insert already parsed information */11471147- memcpy(&gwj->mod, &mod, sizeof(mod));11211121+ RCU_INIT_POINTER(gwj->cf_mod, mod);11481122 memcpy(&gwj->ccgw, &ccgw, sizeof(ccgw));1149112311501124 err = -ENODEV;···11781152 if (!err)11791153 hlist_add_head_rcu(&gwj->list, &net->can.cgw_list);11801154out:11811181- if (err)11551155+ if (err) {11821156 kmem_cache_free(cgw_cache, gwj);11831183-11571157+out_free_cf:11581158+ kfree(mod);11591159+ }11841160 return err;11851161}11861162···1242121412431215 /* remove only the first matching entry */12441216 hlist_for_each_entry_safe(gwj, nx, &net->can.cgw_list, list) {12171217+ struct cf_mod *cf_mod;12181218+12451219 if (gwj->flags != r->flags)12461220 continue;1247122112481222 if (gwj->limit_hops != limhops)12491223 continue;1250122412251225+ cf_mod = cgw_job_cf_mod(gwj);12511226 /* we have a match when uid is enabled and identical */12521252- if (gwj->mod.uid || mod.uid) {12531253- if (gwj->mod.uid != mod.uid)12271227+ if (cf_mod->uid || mod.uid) {12281228+ if (cf_mod->uid != mod.uid)12541229 continue;12551230 } else {12561231 /* no uid => check for identical modifications */12571257- if (memcmp(&gwj->mod, &mod, sizeof(mod)))12321232+ if (memcmp(cf_mod, &mod, sizeof(mod)))12581233 continue;12591234 }12601235
+4-14
net/core/dev.c
···91939193 return 0;91949194}9195919591969196-/**91979197- * dev_set_promiscuity - update promiscuity count on a device91989198- * @dev: device91999199- * @inc: modifier92009200- *92019201- * Add or remove promiscuity from a device. While the count in the device92029202- * remains above zero the interface remains promiscuous. Once it hits zero92039203- * the device reverts back to normal filtering operation. A negative inc92049204- * value is used to drop promiscuity on the device.92059205- * Return 0 if successful or a negative errno code on error.92069206- */92079207-int dev_set_promiscuity(struct net_device *dev, int inc)91969196+int netif_set_promiscuity(struct net_device *dev, int inc)92089197{92099198 unsigned int old_flags = dev->flags;92109199 int err;···92059216 dev_set_rx_mode(dev);92069217 return err;92079218}92089208-EXPORT_SYMBOL(dev_set_promiscuity);9209921992109220int netif_set_allmulti(struct net_device *dev, int inc, bool notify)92119221{···1195411966 struct sk_buff *skb = NULL;11955119671195611968 /* Shutdown queueing discipline. */1196911969+ netdev_lock_ops(dev);1195711970 dev_shutdown(dev);1195811971 dev_tcx_uninstall(dev);1195911959- netdev_lock_ops(dev);1196011972 dev_xdp_uninstall(dev);1196111973 dev_memory_provider_uninstall(dev);1196211974 netdev_unlock_ops(dev);···1214912161 synchronize_net();12150121621215112163 /* Shutdown queueing discipline. */1216412164+ netdev_lock_ops(dev);1215212165 dev_shutdown(dev);1216612166+ netdev_unlock_ops(dev);12153121671215412168 /* Notify protocols, that we are about to destroy1215512169 * this device. They should clean all the things.
+23
net/core/dev_api.c
···268268EXPORT_SYMBOL(dev_disable_lro);269269270270/**271271+ * dev_set_promiscuity() - update promiscuity count on a device272272+ * @dev: device273273+ * @inc: modifier274274+ *275275+ * Add or remove promiscuity from a device. While the count in the device276276+ * remains above zero the interface remains promiscuous. Once it hits zero277277+ * the device reverts back to normal filtering operation. A negative inc278278+ * value is used to drop promiscuity on the device.279279+ * Return 0 if successful or a negative errno code on error.280280+ */281281+int dev_set_promiscuity(struct net_device *dev, int inc)282282+{283283+ int ret;284284+285285+ netdev_lock_ops(dev);286286+ ret = netif_set_promiscuity(dev, inc);287287+ netdev_unlock_ops(dev);288288+289289+ return ret;290290+}291291+EXPORT_SYMBOL(dev_set_promiscuity);292292+293293+/**271294 * dev_set_allmulti() - update allmulti count on a device272295 * @dev: device273296 * @inc: modifier
···708708 return 0;709709}710710711711+/**712712+ * netdev_stat_queue_sum() - add up queue stats from range of queues713713+ * @netdev: net_device714714+ * @rx_start: index of the first Rx queue to query715715+ * @rx_end: index after the last Rx queue (first *not* to query)716716+ * @rx_sum: output Rx stats, should be already initialized717717+ * @tx_start: index of the first Tx queue to query718718+ * @tx_end: index after the last Tx queue (first *not* to query)719719+ * @tx_sum: output Tx stats, should be already initialized720720+ *721721+ * Add stats from [start, end) range of queue IDs to *x_sum structs.722722+ * The sum structs must be already initialized. Usually this723723+ * helper is invoked from the .get_base_stats callbacks of drivers724724+ * to account for stats of disabled queues. In that case the ranges725725+ * are usually [netdev->real_num_*x_queues, netdev->num_*x_queues).726726+ */727727+void netdev_stat_queue_sum(struct net_device *netdev,728728+ int rx_start, int rx_end,729729+ struct netdev_queue_stats_rx *rx_sum,730730+ int tx_start, int tx_end,731731+ struct netdev_queue_stats_tx *tx_sum)732732+{733733+ const struct netdev_stat_ops *ops;734734+ struct netdev_queue_stats_rx rx;735735+ struct netdev_queue_stats_tx tx;736736+ int i;737737+738738+ ops = netdev->stat_ops;739739+740740+ for (i = rx_start; i < rx_end; i++) {741741+ memset(&rx, 0xff, sizeof(rx));742742+ if (ops->get_queue_stats_rx)743743+ ops->get_queue_stats_rx(netdev, i, &rx);744744+ netdev_nl_stats_add(rx_sum, &rx, sizeof(rx));745745+ }746746+ for (i = tx_start; i < tx_end; i++) {747747+ memset(&tx, 0xff, sizeof(tx));748748+ if (ops->get_queue_stats_tx)749749+ ops->get_queue_stats_tx(netdev, i, &tx);750750+ netdev_nl_stats_add(tx_sum, &tx, sizeof(tx));751751+ }752752+}753753+EXPORT_SYMBOL(netdev_stat_queue_sum);754754+711755static int712756netdev_nl_stats_by_netdev(struct net_device *netdev, struct sk_buff *rsp,713757 const struct genl_info *info)714758{715715- struct netdev_queue_stats_rx rx_sum, rx;716716- struct netdev_queue_stats_tx tx_sum, tx;717717- const struct netdev_stat_ops *ops;759759+ struct netdev_queue_stats_rx rx_sum;760760+ struct netdev_queue_stats_tx tx_sum;718761 void *hdr;719719- int i;720762721721- ops = netdev->stat_ops;722763 /* Netdev can't guarantee any complete counters */723723- if (!ops->get_base_stats)764764+ if (!netdev->stat_ops->get_base_stats)724765 return 0;725766726767 memset(&rx_sum, 0xff, sizeof(rx_sum));727768 memset(&tx_sum, 0xff, sizeof(tx_sum));728769729729- ops->get_base_stats(netdev, &rx_sum, &tx_sum);770770+ netdev->stat_ops->get_base_stats(netdev, &rx_sum, &tx_sum);730771731772 /* The op was there, but nothing reported, don't bother */732773 if (!memchr_inv(&rx_sum, 0xff, sizeof(rx_sum)) &&···780739 if (nla_put_u32(rsp, NETDEV_A_QSTATS_IFINDEX, netdev->ifindex))781740 goto nla_put_failure;782741783783- for (i = 0; i < netdev->real_num_rx_queues; i++) {784784- memset(&rx, 0xff, sizeof(rx));785785- if (ops->get_queue_stats_rx)786786- ops->get_queue_stats_rx(netdev, i, &rx);787787- netdev_nl_stats_add(&rx_sum, &rx, sizeof(rx));788788- }789789- for (i = 0; i < netdev->real_num_tx_queues; i++) {790790- memset(&tx, 0xff, sizeof(tx));791791- if (ops->get_queue_stats_tx)792792- ops->get_queue_stats_tx(netdev, i, &tx);793793- netdev_nl_stats_add(&tx_sum, &tx, sizeof(tx));794794- }742742+ netdev_stat_queue_sum(netdev, 0, netdev->real_num_rx_queues, &rx_sum,743743+ 0, netdev->real_num_tx_queues, &tx_sum);795744796745 if (netdev_nl_stats_write_rx(rsp, &rx_sum) ||797746 netdev_nl_stats_write_tx(rsp, &tx_sum))
+9-6
net/ipv6/addrconf.c
···32143214 struct in6_addr addr;32153215 struct net_device *dev;32163216 struct net *net = dev_net(idev->dev);32173217- int scope, plen, offset = 0;32173217+ int scope, plen;32183218 u32 pflags = 0;3219321932203220 ASSERT_RTNL();3221322132223222 memset(&addr, 0, sizeof(struct in6_addr));32233223- /* in case of IP6GRE the dev_addr is an IPv6 and therefore we use only the last 4 bytes */32243224- if (idev->dev->addr_len == sizeof(struct in6_addr))32253225- offset = sizeof(struct in6_addr) - 4;32263226- memcpy(&addr.s6_addr32[3], idev->dev->dev_addr + offset, 4);32233223+ memcpy(&addr.s6_addr32[3], idev->dev->dev_addr, 4);3227322432283225 if (!(idev->dev->flags & IFF_POINTOPOINT) && idev->dev->type == ARPHRD_SIT) {32293226 scope = IPV6_ADDR_COMPATv4;···35313534 return;35323535 }3533353635343534- if (dev->type == ARPHRD_ETHER) {35373537+ /* Generate the IPv6 link-local address using addrconf_addr_gen(),35383538+ * unless we have an IPv4 GRE device not bound to an IP address and35393539+ * which is in EUI64 mode (as __ipv6_isatap_ifid() would fail in this35403540+ * case). Such devices fall back to add_v4_addrs() instead.35413541+ */35423542+ if (!(dev->type == ARPHRD_IPGRE && *(__be32 *)dev->dev_addr == 0 &&35433543+ idev->cnf.addr_gen_mode == IN6_ADDR_GEN_MODE_EUI64)) {35353544 addrconf_addr_gen(idev, true);35363545 return;35373546 }
+6-6
net/mac80211/mlme.c
···76757675 int hdr_len = offsetofend(struct ieee80211_mgmt, u.action.u.ttlm_res);76767676 int ttlm_max_len = 2 + 1 + sizeof(struct ieee80211_ttlm_elem) + 1 +76777677 2 * 2 * IEEE80211_TTLM_NUM_TIDS;76787678+ u16 status_code;7678767976797680 skb = dev_alloc_skb(local->tx_headroom + hdr_len + ttlm_max_len);76807681 if (!skb)···76987697 WARN_ON(1);76997698 fallthrough;77007699 case NEG_TTLM_RES_REJECT:77017701- mgmt->u.action.u.ttlm_res.status_code =77027702- WLAN_STATUS_DENIED_TID_TO_LINK_MAPPING;77007700+ status_code = WLAN_STATUS_DENIED_TID_TO_LINK_MAPPING;77037701 break;77047702 case NEG_TTLM_RES_ACCEPT:77057705- mgmt->u.action.u.ttlm_res.status_code = WLAN_STATUS_SUCCESS;77037703+ status_code = WLAN_STATUS_SUCCESS;77067704 break;77077705 case NEG_TTLM_RES_SUGGEST_PREFERRED:77087708- mgmt->u.action.u.ttlm_res.status_code =77097709- WLAN_STATUS_PREF_TID_TO_LINK_MAPPING_SUGGESTED;77067706+ status_code = WLAN_STATUS_PREF_TID_TO_LINK_MAPPING_SUGGESTED;77107707 ieee80211_neg_ttlm_add_suggested_map(skb, neg_ttlm);77117708 break;77127709 }7713771077117711+ mgmt->u.action.u.ttlm_res.status_code = cpu_to_le16(status_code);77147712 ieee80211_tx_skb(sdata, skb);77157713}77167714···78757875 * This can be better implemented in the future, to handle request78767876 * rejections.78777877 */78787878- if (mgmt->u.action.u.ttlm_res.status_code != WLAN_STATUS_SUCCESS)78787878+ if (le16_to_cpu(mgmt->u.action.u.ttlm_res.status_code) != WLAN_STATUS_SUCCESS)78797879 __ieee80211_disconnect(sdata);78807880}78817881
···26262727#[allow(dead_code)]2828#[allow(clippy::undocumented_unsafe_blocks)]2929+#[cfg_attr(CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES, allow(unnecessary_transmutes))]2930mod bindings_raw {3031 // Manual definition for blocklisted types.3132 type __kernel_size_t = usize;
+3
rust/kernel/alloc/kvec.rs
···2233//! Implementation of [`Vec`].4455+// May not be needed in Rust 1.87.0 (pending beta backport).66+#![allow(clippy::ptr_eq)]77+58use super::{69 allocator::{KVmalloc, Kmalloc, Vmalloc},710 layout::ArrayLayout,
+3
rust/kernel/list.rs
···4455//! A linked list implementation.6677+// May not be needed in Rust 1.87.0 (pending beta backport).88+#![allow(clippy::ptr_eq)]99+710use crate::sync::ArcBorrow;811use crate::types::Opaque;912use core::iter::{DoubleEndedIterator, FusedIterator};
···1515 }16161717 if attr.len() > 255 {1818- panic!(1919- "The test suite name `{}` exceeds the maximum length of 255 bytes",2020- attr2121- )1818+ panic!("The test suite name `{attr}` exceeds the maximum length of 255 bytes")2219 }23202421 let mut tokens: Vec<_> = ts.into_iter().collect();···99102 let mut kunit_macros = "".to_owned();100103 let mut test_cases = "".to_owned();101104 for test in &tests {102102- let kunit_wrapper_fn_name = format!("kunit_rust_wrapper_{}", test);105105+ let kunit_wrapper_fn_name = format!("kunit_rust_wrapper_{test}");103106 let kunit_wrapper = format!(104104- "unsafe extern \"C\" fn {}(_test: *mut kernel::bindings::kunit) {{ {}(); }}",105105- kunit_wrapper_fn_name, test107107+ "unsafe extern \"C\" fn {kunit_wrapper_fn_name}(_test: *mut kernel::bindings::kunit) {{ {test}(); }}"106108 );107109 writeln!(kunit_macros, "{kunit_wrapper}").unwrap();108110 writeln!(109111 test_cases,110110- " kernel::kunit::kunit_case(kernel::c_str!(\"{}\"), {}),",111111- test, kunit_wrapper_fn_name112112+ " kernel::kunit::kunit_case(kernel::c_str!(\"{test}\"), {kunit_wrapper_fn_name}),"112113 )113114 .unwrap();114115 }
+5-14
rust/macros/module.rs
···4848 )4949 } else {5050 // Loadable modules' modinfo strings go as-is.5151- format!("{field}={content}\0", field = field, content = content)5151+ format!("{field}={content}\0")5252 };53535454 write!(···126126 };127127128128 if seen_keys.contains(&key) {129129- panic!(130130- "Duplicated key \"{}\". Keys can only be specified once.",131131- key132132- );129129+ panic!("Duplicated key \"{key}\". Keys can only be specified once.");133130 }134131135132 assert_eq!(expect_punct(it), ':');···140143 "license" => info.license = expect_string_ascii(it),141144 "alias" => info.alias = Some(expect_string_array(it)),142145 "firmware" => info.firmware = Some(expect_string_array(it)),143143- _ => panic!(144144- "Unknown key \"{}\". Valid keys are: {:?}.",145145- key, EXPECTED_KEYS146146- ),146146+ _ => panic!("Unknown key \"{key}\". Valid keys are: {EXPECTED_KEYS:?}."),147147 }148148149149 assert_eq!(expect_punct(it), ',');···152158153159 for key in REQUIRED_KEYS {154160 if !seen_keys.iter().any(|e| e == key) {155155- panic!("Missing required key \"{}\".", key);161161+ panic!("Missing required key \"{key}\".");156162 }157163 }158164···164170 }165171166172 if seen_keys != ordered_keys {167167- panic!(168168- "Keys are not ordered as expected. Order them like: {:?}.",169169- ordered_keys170170- );173173+ panic!("Keys are not ordered as expected. Order them like: {ordered_keys:?}.");171174 }172175173176 info
+1-1
rust/macros/paste.rs
···5050 let tokens = group.stream().into_iter().collect::<Vec<TokenTree>>();5151 segments.append(&mut concat_helper(tokens.as_slice()));5252 }5353- token => panic!("unexpected token in paste segments: {:?}", token),5353+ token => panic!("unexpected token in paste segments: {token:?}"),5454 };5555 }5656
+1-2
rust/pin-init/internal/src/pinned_drop.rs
···2828 // Found the end of the generics, this should be `PinnedDrop`.2929 assert!(3030 matches!(tt, TokenTree::Ident(i) if i.to_string() == "PinnedDrop"),3131- "expected 'PinnedDrop', found: '{:?}'",3232- tt3131+ "expected 'PinnedDrop', found: '{tt:?}'"3332 );3433 pinned_drop_idx = Some(i);3534 break;
···49684968 * the netns switch takes place from ingress to ingress without49694969 * going through the CPU's backlog queue.49704970 *49714971+ * *skb*\ **->mark** and *skb*\ **->tstamp** are not cleared during49724972+ * the netns switch.49734973+ *49714974 * The *flags* argument is reserved and must be 0. The helper is49724975 * currently only supported for tc BPF program types at the49734976 * ingress hook and for veth and netkit target device types. The
+1-1
tools/net/ynl/lib/ynl.c
···364364 "Invalid attribute (binary %s)", policy->name);365365 return -1;366366 case YNL_PT_NUL_STR:367367- if ((!policy->len || len <= policy->len) && !data[len - 1])367367+ if (len && (!policy->len || len <= policy->len) && !data[len - 1])368368 break;369369 yerr(yarg->ys, YNL_ERROR_ATTR_INVALID,370370 "Invalid attribute (string %s)", policy->name);
···99from lib.py import bkg, cmd, wait_port_listen, rand_port1010from lib.py import defer, ethtool, ip11111212-remote_ifname=""1312no_sleep=False14131514def _test_v4(cfg) -> None:1616- cfg.require_ipver("4")1515+ if not cfg.addr_v["4"]:1616+ return17171818 cmd("ping -c 1 -W0.5 " + cfg.remote_addr_v["4"])1919 cmd("ping -c 1 -W0.5 " + cfg.addr_v["4"], host=cfg.remote)···2121 cmd("ping -s 65000 -c 1 -W0.5 " + cfg.addr_v["4"], host=cfg.remote)22222323def _test_v6(cfg) -> None:2424- cfg.require_ipver("6")2424+ if not cfg.addr_v["6"]:2525+ return25262627 cmd("ping -c 1 -W5 " + cfg.remote_addr_v["6"])2728 cmd("ping -c 1 -W5 " + cfg.addr_v["6"], host=cfg.remote)···58575958def _set_xdp_generic_sb_on(cfg) -> None:6059 prog = cfg.net_lib_dir / "xdp_dummy.bpf.o"6161- cmd(f"ip link set dev {remote_ifname} mtu 1500", shell=True, host=cfg.remote)6060+ cmd(f"ip link set dev {cfg.remote_ifname} mtu 1500", shell=True, host=cfg.remote)6261 cmd(f"ip link set dev {cfg.ifname} mtu 1500 xdpgeneric obj {prog} sec xdp", shell=True)6362 defer(cmd, f"ip link set dev {cfg.ifname} xdpgeneric off")6463···67666867def _set_xdp_generic_mb_on(cfg) -> None:6968 prog = cfg.net_lib_dir / "xdp_dummy.bpf.o"7070- cmd(f"ip link set dev {remote_ifname} mtu 9000", shell=True, host=cfg.remote)7171- defer(ip, f"link set dev {remote_ifname} mtu 1500", host=cfg.remote)6969+ cmd(f"ip link set dev {cfg.remote_ifname} mtu 9000", shell=True, host=cfg.remote)7070+ defer(ip, f"link set dev {cfg.remote_ifname} mtu 1500", host=cfg.remote)7271 ip("link set dev %s mtu 9000 xdpgeneric obj %s sec xdp.frags" % (cfg.ifname, prog))7372 defer(ip, f"link set dev {cfg.ifname} mtu 1500 xdpgeneric off")7473···77767877def _set_xdp_native_sb_on(cfg) -> None:7978 prog = cfg.net_lib_dir / "xdp_dummy.bpf.o"8080- cmd(f"ip link set dev {remote_ifname} mtu 1500", shell=True, host=cfg.remote)7979+ cmd(f"ip link set dev {cfg.remote_ifname} mtu 1500", shell=True, host=cfg.remote)8180 cmd(f"ip -j link set dev {cfg.ifname} mtu 1500 xdp obj {prog} sec xdp", shell=True)8281 defer(ip, f"link set dev {cfg.ifname} mtu 1500 xdp off")8382 xdp_info = ip("-d link show %s" % (cfg.ifname), json=True)[0]···94939594def _set_xdp_native_mb_on(cfg) -> None:9695 prog = cfg.net_lib_dir / "xdp_dummy.bpf.o"9797- cmd(f"ip link set dev {remote_ifname} mtu 9000", shell=True, host=cfg.remote)9898- defer(ip, f"link set dev {remote_ifname} mtu 1500", host=cfg.remote)9696+ cmd(f"ip link set dev {cfg.remote_ifname} mtu 9000", shell=True, host=cfg.remote)9797+ defer(ip, f"link set dev {cfg.remote_ifname} mtu 1500", host=cfg.remote)9998 try:10099 cmd(f"ip link set dev {cfg.ifname} mtu 9000 xdp obj {prog} sec xdp.frags", shell=True)101100 defer(ip, f"link set dev {cfg.ifname} mtu 1500 xdp off")···113112 except Exception as e:114113 raise KsftSkipEx('device does not support offloaded XDP')115114 defer(ip, f"link set dev {cfg.ifname} xdpoffload off")116116- cmd(f"ip link set dev {remote_ifname} mtu 1500", shell=True, host=cfg.remote)115115+ cmd(f"ip link set dev {cfg.remote_ifname} mtu 1500", shell=True, host=cfg.remote)117116118117 if no_sleep != True:119118 time.sleep(10)120119121120def get_interface_info(cfg) -> None:122122- global remote_ifname123121 global no_sleep124122125125- remote_info = cmd(f"ip -4 -o addr show to {cfg.remote_addr_v['4']} | awk '{{print $2}}'", shell=True, host=cfg.remote).stdout126126- remote_ifname = remote_info.rstrip('\n')127127- if remote_ifname == "":123123+ if cfg.remote_ifname == "":128124 raise KsftFailEx('Can not get remote interface')129125 local_info = ip("-d link show %s" % (cfg.ifname), json=True)[0]130126 if 'parentbus' in local_info and local_info['parentbus'] == "netdevsim":···134136 cmd(f"ip link set dev {cfg.ifname} xdp off ", shell=True)135137 cmd(f"ip link set dev {cfg.ifname} xdpgeneric off ", shell=True)136138 cmd(f"ip link set dev {cfg.ifname} xdpoffload off", shell=True)137137- cmd(f"ip link set dev {remote_ifname} mtu 1500", shell=True, host=cfg.remote)139139+ cmd(f"ip link set dev {cfg.remote_ifname} mtu 1500", shell=True, host=cfg.remote)138140139139-def test_default(cfg, netnl) -> None:141141+def test_default_v4(cfg, netnl) -> None:142142+ cfg.require_ipver("4")143143+140144 _set_offload_checksum(cfg, netnl, "off")141145 _test_v4(cfg)142142- _test_v6(cfg)143146 _test_tcp(cfg)144147 _set_offload_checksum(cfg, netnl, "on")145148 _test_v4(cfg)149149+ _test_tcp(cfg)150150+151151+def test_default_v6(cfg, netnl) -> None:152152+ cfg.require_ipver("6")153153+154154+ _set_offload_checksum(cfg, netnl, "off")155155+ _test_v6(cfg)156156+ _test_tcp(cfg)157157+ _set_offload_checksum(cfg, netnl, "on")146158 _test_v6(cfg)147159 _test_tcp(cfg)148160···210202 with NetDrvEpEnv(__file__) as cfg:211203 get_interface_info(cfg)212204 set_interface_init(cfg)213213- ksft_run([test_default,205205+ ksft_run([test_default_v4,206206+ test_default_v6,214207 test_xdp_generic_sb,215208 test_xdp_generic_mb,216209 test_xdp_native_sb,
···9090 int compaction_index = 0;9191 char nr_hugepages[20] = {0};9292 char init_nr_hugepages[24] = {0};9393+ char target_nr_hugepages[24] = {0};9494+ int slen;93959496 snprintf(init_nr_hugepages, sizeof(init_nr_hugepages),9597 "%lu", initial_nr_hugepages);···108106 goto out;109107 }110108111111- /* Request a large number of huge pages. The Kernel will allocate112112- as much as it can */113113- if (write(fd, "100000", (6*sizeof(char))) != (6*sizeof(char))) {114114- ksft_print_msg("Failed to write 100000 to /proc/sys/vm/nr_hugepages: %s\n",115115- strerror(errno));109109+ /*110110+ * Request huge pages for about half of the free memory. The Kernel111111+ * will allocate as much as it can, and we expect it will get at least 1/3112112+ */113113+ nr_hugepages_ul = mem_free / hugepage_size / 2;114114+ snprintf(target_nr_hugepages, sizeof(target_nr_hugepages),115115+ "%lu", nr_hugepages_ul);116116+117117+ slen = strlen(target_nr_hugepages);118118+ if (write(fd, target_nr_hugepages, slen) != slen) {119119+ ksft_print_msg("Failed to write %lu to /proc/sys/vm/nr_hugepages: %s\n",120120+ nr_hugepages_ul, strerror(errno));116121 goto close_fd;117122 }118123
+10-6
tools/testing/selftests/mm/guard-regions.c
···271271 self->page_size = (unsigned long)sysconf(_SC_PAGESIZE);272272 setup_sighandler();273273274274- if (variant->backing == ANON_BACKED)274274+ switch (variant->backing) {275275+ case ANON_BACKED:275276 return;276276-277277- self->fd = open_file(278278- variant->backing == SHMEM_BACKED ? "/tmp/" : "",279279- self->path);277277+ case LOCAL_FILE_BACKED:278278+ self->fd = open_file("", self->path);279279+ break;280280+ case SHMEM_BACKED:281281+ self->fd = memfd_create(self->path, 0);282282+ break;283283+ }280284281285 /* We truncate file to at least 100 pages, tests can modify as needed. */282286 ASSERT_EQ(ftruncate(self->fd, 100 * self->page_size), 0);···17001696 char *ptr;17011697 int i;1702169817031703- if (variant->backing == ANON_BACKED)16991699+ if (variant->backing != LOCAL_FILE_BACKED)17041700 SKIP(return, "Read-only test specific to file-backed");1705170117061702 /* Map shared so we can populate with pattern, populate it, unmap. */
···11+#!/bin/bash22+# SPDX-License-Identifier: GPL-2.033+44+source ./lib.sh55+66+PAUSE_ON_FAIL="no"77+88+# The trap function handler99+#1010+exit_cleanup_all()1111+{1212+ cleanup_all_ns1313+1414+ exit "${EXIT_STATUS}"1515+}1616+1717+# Add fake IPv4 and IPv6 networks on the loopback device, to be used as1818+# underlay by future GRE devices.1919+#2020+setup_basenet()2121+{2222+ ip -netns "${NS0}" link set dev lo up2323+ ip -netns "${NS0}" address add dev lo 192.0.2.10/242424+ ip -netns "${NS0}" address add dev lo 2001:db8::10/64 nodad2525+}2626+2727+# Check if network device has an IPv6 link-local address assigned.2828+#2929+# Parameters:3030+#3131+# * $1: The network device to test3232+# * $2: An extra regular expression that should be matched (to verify the3333+# presence of extra attributes)3434+# * $3: The expected return code from grep (to allow checking the absence of3535+# a link-local address)3636+# * $4: The user visible name for the scenario being tested3737+#3838+check_ipv6_ll_addr()3939+{4040+ local DEV="$1"4141+ local EXTRA_MATCH="$2"4242+ local XRET="$3"4343+ local MSG="$4"4444+4545+ RET=04646+ set +e4747+ ip -netns "${NS0}" -6 address show dev "${DEV}" scope link | grep "fe80::" | grep -q "${EXTRA_MATCH}"4848+ check_err_fail "${XRET}" $? ""4949+ log_test "${MSG}"5050+ set -e5151+}5252+5353+# Create a GRE device and verify that it gets an IPv6 link-local address as5454+# expected.5555+#5656+# Parameters:5757+#5858+# * $1: The device type (gre, ip6gre, gretap or ip6gretap)5959+# * $2: The local underlay IP address (can be an IPv4, an IPv6 or "any")6060+# * $3: The remote underlay IP address (can be an IPv4, an IPv6 or "any")6161+# * $4: The IPv6 interface identifier generation mode to use for the GRE6262+# device (eui64, none, stable-privacy or random).6363+#6464+test_gre_device()6565+{6666+ local GRE_TYPE="$1"6767+ local LOCAL_IP="$2"6868+ local REMOTE_IP="$3"6969+ local MODE="$4"7070+ local ADDR_GEN_MODE7171+ local MATCH_REGEXP7272+ local MSG7373+7474+ ip link add netns "${NS0}" name gretest type "${GRE_TYPE}" local "${LOCAL_IP}" remote "${REMOTE_IP}"7575+7676+ case "${MODE}" in7777+ "eui64")7878+ ADDR_GEN_MODE=07979+ MATCH_REGEXP=""8080+ MSG="${GRE_TYPE}, mode: 0 (EUI64), ${LOCAL_IP} -> ${REMOTE_IP}"8181+ XRET=08282+ ;;8383+ "none")8484+ ADDR_GEN_MODE=18585+ MATCH_REGEXP=""8686+ MSG="${GRE_TYPE}, mode: 1 (none), ${LOCAL_IP} -> ${REMOTE_IP}"8787+ XRET=1 # No link-local address should be generated8888+ ;;8989+ "stable-privacy")9090+ ADDR_GEN_MODE=29191+ MATCH_REGEXP="stable-privacy"9292+ MSG="${GRE_TYPE}, mode: 2 (stable privacy), ${LOCAL_IP} -> ${REMOTE_IP}"9393+ XRET=09494+ # Initialise stable_secret (required for stable-privacy mode)9595+ ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.stable_secret="2001:db8::abcd"9696+ ;;9797+ "random")9898+ ADDR_GEN_MODE=39999+ MATCH_REGEXP="stable-privacy"100100+ MSG="${GRE_TYPE}, mode: 3 (random), ${LOCAL_IP} -> ${REMOTE_IP}"101101+ XRET=0102102+ ;;103103+ esac104104+105105+ # Check that IPv6 link-local address is generated when device goes up106106+ ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.addr_gen_mode="${ADDR_GEN_MODE}"107107+ ip -netns "${NS0}" link set dev gretest up108108+ check_ipv6_ll_addr gretest "${MATCH_REGEXP}" "${XRET}" "config: ${MSG}"109109+110110+ # Now disable link-local address generation111111+ ip -netns "${NS0}" link set dev gretest down112112+ ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.addr_gen_mode=1113113+ ip -netns "${NS0}" link set dev gretest up114114+115115+ # Check that link-local address generation works when re-enabled while116116+ # the device is already up117117+ ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.addr_gen_mode="${ADDR_GEN_MODE}"118118+ check_ipv6_ll_addr gretest "${MATCH_REGEXP}" "${XRET}" "update: ${MSG}"119119+120120+ ip -netns "${NS0}" link del dev gretest121121+}122122+123123+test_gre4()124124+{125125+ local GRE_TYPE126126+ local MODE127127+128128+ for GRE_TYPE in "gre" "gretap"; do129129+ printf "\n####\nTesting IPv6 link-local address generation on ${GRE_TYPE} devices\n####\n\n"130130+131131+ for MODE in "eui64" "none" "stable-privacy" "random"; do132132+ test_gre_device "${GRE_TYPE}" 192.0.2.10 192.0.2.11 "${MODE}"133133+ test_gre_device "${GRE_TYPE}" any 192.0.2.11 "${MODE}"134134+ test_gre_device "${GRE_TYPE}" 192.0.2.10 any "${MODE}"135135+ done136136+ done137137+}138138+139139+test_gre6()140140+{141141+ local GRE_TYPE142142+ local MODE143143+144144+ for GRE_TYPE in "ip6gre" "ip6gretap"; do145145+ printf "\n####\nTesting IPv6 link-local address generation on ${GRE_TYPE} devices\n####\n\n"146146+147147+ for MODE in "eui64" "none" "stable-privacy" "random"; do148148+ test_gre_device "${GRE_TYPE}" 2001:db8::10 2001:db8::11 "${MODE}"149149+ test_gre_device "${GRE_TYPE}" any 2001:db8::11 "${MODE}"150150+ test_gre_device "${GRE_TYPE}" 2001:db8::10 any "${MODE}"151151+ done152152+ done153153+}154154+155155+usage()156156+{157157+ echo "Usage: $0 [-p]"158158+ exit 1159159+}160160+161161+while getopts :p o162162+do163163+ case $o in164164+ p) PAUSE_ON_FAIL="yes";;165165+ *) usage;;166166+ esac167167+done168168+169169+setup_ns NS0170170+171171+set -e172172+trap exit_cleanup_all EXIT173173+174174+setup_basenet175175+176176+test_gre4177177+test_gre6