···3737 shadow stacks rather than GCS.38383939* Support for GCS is reported to userspace via HWCAP_GCS in the aux vector4040- AT_HWCAP2 entry.4040+ AT_HWCAP entry.41414242* GCS is enabled per thread. While there is support for disabling GCS4343 at runtime this should be done with great care.
···8899maintainers:1010 - Taniya Das <quic_tdas@quicinc.com>1111+ - Imran Shaik <quic_imrashai@quicinc.com>11121213description: |1314 Qualcomm camera clock control module provides the clocks, resets and power1415 domains on SA8775p.15161616- See also: include/dt-bindings/clock/qcom,sa8775p-camcc.h1717+ See also:1818+ include/dt-bindings/clock/qcom,qcs8300-camcc.h1919+ include/dt-bindings/clock/qcom,sa8775p-camcc.h17201821properties:1922 compatible:2023 enum:2424+ - qcom,qcs8300-camcc2125 - qcom,sa8775p-camcc22262327 clocks:
···2222 Each sub-node is identified using the node's name, with valid values listed2323 for each of the pmics below.24242525- For mp5496, s1, s22525+ For mp5496, s1, s2, l2, l526262727 For pm2250, s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,2828 l12, l13, l14, l15, l16, l17, l18, l19, l20, l21, l22
···308308309309 Google Kees Cook <keescook@chromium.org>310310311311- LLVM Nick Desaulniers <ndesaulniers@google.com>311311+ LLVM Nick Desaulniers <nick.desaulniers+lkml@gmail.com>312312 ============= ========================================================313313314314If you want your organization to be added to the ambassadors list, please
···287287288288 Google Kees Cook <keescook@chromium.org>289289290290- LLVM Nick Desaulniers <ndesaulniers@google.com>290290+ LLVM Nick Desaulniers <nick.desaulniers+lkml@gmail.com>291291 ============= ========================================================292292293293Si quiere que su organización se añada a la lista de embajadores, por
+20-11
MAINTAINERS
···38583858F: Documentation/devicetree/bindings/pwm/adi,axi-pwmgen.yaml38593859F: drivers/pwm/pwm-axi-pwmgen.c3860386038613861-AXXIA I2C CONTROLLER38623862-M: Krzysztof Adamski <krzysztof.adamski@nokia.com>38633863-L: linux-i2c@vger.kernel.org38643864-S: Maintained38653865-F: Documentation/devicetree/bindings/i2c/i2c-axxia.txt38663866-F: drivers/i2c/busses/i2c-axxia.c38673867-38683861AZ6007 DVB DRIVER38693862M: Mauro Carvalho Chehab <mchehab@kernel.org>38703863L: linux-media@vger.kernel.org···5655566256565663CLANG/LLVM BUILD SUPPORT56575664M: Nathan Chancellor <nathan@kernel.org>56585658-R: Nick Desaulniers <ndesaulniers@google.com>56655665+R: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>56595666R: Bill Wendling <morbo@google.com>56605667R: Justin Stitt <justinstitt@google.com>56615668L: llvm@lists.linux.dev···71087115F: rust/kernel/device_id.rs71097116F: rust/kernel/devres.rs71107117F: rust/kernel/driver.rs71187118+F: rust/kernel/faux.rs71117119F: rust/kernel/platform.rs71127120F: samples/rust/rust_driver_platform.rs71217121+F: samples/rust/rust_driver_faux.rs7113712271147123DRIVERS FOR OMAP ADAPTIVE VOLTAGE SCALING (AVS)71157124M: Nishanth Menon <nm@ti.com>···9829983498309835GOOGLE ETHERNET DRIVERS98319836M: Jeroen de Borst <jeroendb@google.com>98329832-M: Praveen Kaligineedi <pkaligineedi@google.com>98339833-R: Shailend Chand <shailend@google.com>98379837+M: Harshitha Ramamurthy <hramamurthy@google.com>98349838L: netdev@vger.kernel.org98359839S: Maintained98369840F: Documentation/networking/device_drivers/ethernet/google/gve.rst···1081510821F: drivers/tty/hvc/10816108221081710823I2C ACPI SUPPORT1081810818-M: Mika Westerberg <mika.westerberg@linux.intel.com>1082410824+M: Mika Westerberg <westeri@kernel.org>1081910825L: linux-i2c@vger.kernel.org1082010826L: linux-acpi@vger.kernel.org1082110827S: Maintained···1647116477F: tools/testing/selftests/drivers/net/*/ethtool*1647216478K: cable_test16473164791648016480+NETWORKING [ETHTOOL MAC MERGE]1648116481+M: Vladimir Oltean <vladimir.oltean@nxp.com>1648216482+F: net/ethtool/mm.c1648316483+F: tools/testing/selftests/drivers/net/hw/ethtool_mm.sh1648416484+K: ethtool_mm1648516485+1647416486NETWORKING [GENERAL]1647516487M: "David S. Miller" <davem@davemloft.net>1647616488M: Eric Dumazet <edumazet@google.com>···1950719507L: dmaengine@vger.kernel.org1950819508S: Supported1950919509F: drivers/dma/qcom/hidma*1951019510+1951119511+QUALCOMM I2C QCOM GENI DRIVER1951219512+M: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>1951319513+M: Viken Dadhaniya <quic_vdadhani@quicinc.com>1951419514+L: linux-i2c@vger.kernel.org1951519515+L: linux-arm-msm@vger.kernel.org1951619516+S: Maintained1951719517+F: Documentation/devicetree/bindings/i2c/qcom,i2c-geni-qcom.yaml1951819518+F: drivers/i2c/busses/i2c-qcom-geni.c19510195191951119520QUALCOMM I2C CCI DRIVER1951219521M: Loic Poulain <loic.poulain@linaro.org>
+5-10
Makefile
···22VERSION = 633PATCHLEVEL = 1444SUBLEVEL = 055-EXTRAVERSION = -rc255+EXTRAVERSION = -rc366NAME = Baby Opossum Posse7788# *DOCUMENTATION*···11201120endif1121112111221122# Align the bit size of userspace programs with the kernel11231123-KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS))11241124-KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS))11231123+KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))11241124+KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))1125112511261126# make the checker run with the right architecture11271127CHECKFLAGS += --arch=$(ARCH)···14211421 $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean14221422endif1423142314241424-# Clear a bunch of variables before executing the submake14251425-ifeq ($(quiet),silent_)14261426-tools_silent=s14271427-endif14281428-14291424tools/: FORCE14301425 $(Q)mkdir -p $(objtree)/tools14311431- $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/14261426+ $(Q)$(MAKE) LDFLAGS= O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/1432142714331428tools/%: FORCE14341429 $(Q)mkdir -p $(objtree)/tools14351435- $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*14301430+ $(Q)$(MAKE) LDFLAGS= O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*1436143114371432# ---------------------------------------------------------------------------14381433# Kernel selftest
+1-1
arch/alpha/include/asm/hwrpb.h
···135135 /* virtual->physical map */136136 unsigned long map_entries;137137 unsigned long map_pages;138138- struct vf_map_struct map[1];138138+ struct vf_map_struct map[];139139};140140141141struct memclust_struct {
+2
arch/alpha/include/uapi/asm/ptrace.h
···4242 unsigned long trap_a0;4343 unsigned long trap_a1;4444 unsigned long trap_a2;4545+/* This makes the stack 16-byte aligned as GCC expects */4646+ unsigned long __pad0;4547/* These are saved by PAL-code: */4648 unsigned long ps;4749 unsigned long pc;
···1313#include <linux/log2.h>1414#include <linux/dma-map-ops.h>1515#include <linux/iommu-helper.h>1616+#include <linux/string_choices.h>16171718#include <asm/io.h>1819#include <asm/hwrpb.h>···213212214213 /* If both conditions above are met, we are fine. */215214 DBGA("pci_dac_dma_supported %s from %ps\n",216216- ok ? "yes" : "no", __builtin_return_address(0));215215+ str_yes_no(ok), __builtin_return_address(0));217216218217 return ok;219218}
+1-1
arch/alpha/kernel/traps.c
···649649static int unauser_reg_offsets[32] = {650650 R(r0), R(r1), R(r2), R(r3), R(r4), R(r5), R(r6), R(r7), R(r8),651651 /* r9 ... r15 are stored in front of regs. */652652- -56, -48, -40, -32, -24, -16, -8,652652+ -64, -56, -48, -40, -32, -24, -16, /* padding at -8 */653653 R(r16), R(r17), R(r18),654654 R(r19), R(r20), R(r21), R(r22), R(r23), R(r24), R(r25), R(r26),655655 R(r27), R(r28), R(gp),
···605605 __cpacr_to_cptr_set(clr, set));\606606 } while (0)607607608608-static __always_inline void kvm_write_cptr_el2(u64 val)609609-{610610- if (has_vhe() || has_hvhe())611611- write_sysreg(val, cpacr_el1);612612- else613613- write_sysreg(val, cptr_el2);614614-}615615-616616-/* Resets the value of cptr_el2 when returning to the host. */617617-static __always_inline void __kvm_reset_cptr_el2(struct kvm *kvm)618618-{619619- u64 val;620620-621621- if (has_vhe()) {622622- val = (CPACR_EL1_FPEN | CPACR_EL1_ZEN_EL1EN);623623- if (cpus_have_final_cap(ARM64_SME))624624- val |= CPACR_EL1_SMEN_EL1EN;625625- } else if (has_hvhe()) {626626- val = CPACR_EL1_FPEN;627627-628628- if (!kvm_has_sve(kvm) || !guest_owns_fp_regs())629629- val |= CPACR_EL1_ZEN;630630- if (cpus_have_final_cap(ARM64_SME))631631- val |= CPACR_EL1_SMEN;632632- } else {633633- val = CPTR_NVHE_EL2_RES1;634634-635635- if (kvm_has_sve(kvm) && guest_owns_fp_regs())636636- val |= CPTR_EL2_TZ;637637- if (!cpus_have_final_cap(ARM64_SME))638638- val |= CPTR_EL2_TSM;639639- }640640-641641- kvm_write_cptr_el2(val);642642-}643643-644644-#ifdef __KVM_NVHE_HYPERVISOR__645645-#define kvm_reset_cptr_el2(v) __kvm_reset_cptr_el2(kern_hyp_va((v)->kvm))646646-#else647647-#define kvm_reset_cptr_el2(v) __kvm_reset_cptr_el2((v)->kvm)648648-#endif649649-650608/*651609 * Returns a 'sanitised' view of CPTR_EL2, translating from nVHE to the VHE652610 * format if E2H isn't set.
+5-17
arch/arm64/include/asm/kvm_host.h
···100100static inline void *pop_hyp_memcache(struct kvm_hyp_memcache *mc,101101 void *(*to_va)(phys_addr_t phys))102102{103103- phys_addr_t *p = to_va(mc->head);103103+ phys_addr_t *p = to_va(mc->head & PAGE_MASK);104104105105 if (!mc->nr_pages)106106 return NULL;···615615struct kvm_host_data {616616#define KVM_HOST_DATA_FLAG_HAS_SPE 0617617#define KVM_HOST_DATA_FLAG_HAS_TRBE 1618618-#define KVM_HOST_DATA_FLAG_HOST_SVE_ENABLED 2619619-#define KVM_HOST_DATA_FLAG_HOST_SME_ENABLED 3620618#define KVM_HOST_DATA_FLAG_TRBE_ENABLED 4621619#define KVM_HOST_DATA_FLAG_EL1_TRACING_CONFIGURED 5622620 unsigned long flags;···622624 struct kvm_cpu_context host_ctxt;623625624626 /*625625- * All pointers in this union are hyp VA.627627+ * Hyp VA.626628 * sve_state is only used in pKVM and if system_supports_sve().627629 */628628- union {629629- struct user_fpsimd_state *fpsimd_state;630630- struct cpu_sve_state *sve_state;631631- };630630+ struct cpu_sve_state *sve_state;632631633633- union {634634- /* HYP VA pointer to the host storage for FPMR */635635- u64 *fpmr_ptr;636636- /*637637- * Used by pKVM only, as it needs to provide storage638638- * for the host639639- */640640- u64 fpmr;641641- };632632+ /* Used by pKVM only. */633633+ u64 fpmr;642634643635 /* Ownership of the FP regs */644636 enum {
···16951695}1696169616971697/*16981698- * Called by KVM when entering the guest.16991699- */17001700-void fpsimd_kvm_prepare(void)17011701-{17021702- if (!system_supports_sve())17031703- return;17041704-17051705- /*17061706- * KVM does not save host SVE state since we can only enter17071707- * the guest from a syscall so the ABI means that only the17081708- * non-saved SVE state needs to be saved. If we have left17091709- * SVE enabled for performance reasons then update the task17101710- * state to be FPSIMD only.17111711- */17121712- get_cpu_fpsimd_context();17131713-17141714- if (test_and_clear_thread_flag(TIF_SVE)) {17151715- sve_to_fpsimd(current);17161716- current->thread.fp_type = FP_STATE_FPSIMD;17171717- }17181718-17191719- put_cpu_fpsimd_context();17201720-}17211721-17221722-/*17231698 * Associate current's FPSIMD context with this cpu17241699 * The caller must have ownership of the cpu FPSIMD context before calling17251700 * this function.
+10-12
arch/arm64/kernel/topology.c
···194194 int cpu;195195196196 /* We are already set since the last insmod of cpufreq driver */197197- if (unlikely(cpumask_subset(cpus, amu_fie_cpus)))197197+ if (cpumask_available(amu_fie_cpus) &&198198+ unlikely(cpumask_subset(cpus, amu_fie_cpus)))198199 return;199200200200- for_each_cpu(cpu, cpus) {201201+ for_each_cpu(cpu, cpus)201202 if (!freq_counters_valid(cpu))202203 return;204204+205205+ if (!cpumask_available(amu_fie_cpus) &&206206+ !zalloc_cpumask_var(&amu_fie_cpus, GFP_KERNEL)) {207207+ WARN_ONCE(1, "Failed to allocate FIE cpumask for CPUs[%*pbl]\n",208208+ cpumask_pr_args(cpus));209209+ return;203210 }204211205212 cpumask_or(amu_fie_cpus, amu_fie_cpus, cpus);···244237245238static int __init init_amu_fie(void)246239{247247- int ret;248248-249249- if (!zalloc_cpumask_var(&amu_fie_cpus, GFP_KERNEL))250250- return -ENOMEM;251251-252252- ret = cpufreq_register_notifier(&init_amu_fie_notifier,240240+ return cpufreq_register_notifier(&init_amu_fie_notifier,253241 CPUFREQ_POLICY_NOTIFIER);254254- if (ret)255255- free_cpumask_var(amu_fie_cpus);256256-257257- return ret;258242}259243core_initcall(init_amu_fie);260244
···5454 if (!system_supports_fpsimd())5555 return;56565757- fpsimd_kvm_prepare();5858-5957 /*6060- * We will check TIF_FOREIGN_FPSTATE just before entering the6161- * guest in kvm_arch_vcpu_ctxflush_fp() and override this to6262- * FP_STATE_FREE if the flag set.5858+ * Ensure that any host FPSIMD/SVE/SME state is saved and unbound such5959+ * that the host kernel is responsible for restoring this state upon6060+ * return to userspace, and the hyp code doesn't need to save anything.6161+ *6262+ * When the host may use SME, fpsimd_save_and_flush_cpu_state() ensures6363+ * that PSTATE.{SM,ZA} == {0,0}.6364 */6464- *host_data_ptr(fp_owner) = FP_STATE_HOST_OWNED;6565- *host_data_ptr(fpsimd_state) = kern_hyp_va(¤t->thread.uw.fpsimd_state);6666- *host_data_ptr(fpmr_ptr) = kern_hyp_va(¤t->thread.uw.fpmr);6565+ fpsimd_save_and_flush_cpu_state();6666+ *host_data_ptr(fp_owner) = FP_STATE_FREE;67676868- host_data_clear_flag(HOST_SVE_ENABLED);6969- if (read_sysreg(cpacr_el1) & CPACR_EL1_ZEN_EL0EN)7070- host_data_set_flag(HOST_SVE_ENABLED);7171-7272- if (system_supports_sme()) {7373- host_data_clear_flag(HOST_SME_ENABLED);7474- if (read_sysreg(cpacr_el1) & CPACR_EL1_SMEN_EL0EN)7575- host_data_set_flag(HOST_SME_ENABLED);7676-7777- /*7878- * If PSTATE.SM is enabled then save any pending FP7979- * state and disable PSTATE.SM. If we leave PSTATE.SM8080- * enabled and the guest does not enable SME via8181- * CPACR_EL1.SMEN then operations that should be valid8282- * may generate SME traps from EL1 to EL1 which we8383- * can't intercept and which would confuse the guest.8484- *8585- * Do the same for PSTATE.ZA in the case where there8686- * is state in the registers which has not already8787- * been saved, this is very unlikely to happen.8888- */8989- if (read_sysreg_s(SYS_SVCR) & (SVCR_SM_MASK | SVCR_ZA_MASK)) {9090- *host_data_ptr(fp_owner) = FP_STATE_FREE;9191- fpsimd_save_and_flush_cpu_state();9292- }9393- }9494-9595- /*9696- * If normal guests gain SME support, maintain this behavior for pKVM9797- * guests, which don't support SME.9898- */9999- WARN_ON(is_protected_kvm_enabled() && system_supports_sme() &&100100- read_sysreg_s(SYS_SVCR));6868+ WARN_ON_ONCE(system_supports_sme() && read_sysreg_s(SYS_SVCR));10169}1027010371/*···130162131163 local_irq_save(flags);132164133133- /*134134- * If we have VHE then the Hyp code will reset CPACR_EL1 to135135- * the default value and we need to reenable SME.136136- */137137- if (has_vhe() && system_supports_sme()) {138138- /* Also restore EL0 state seen on entry */139139- if (host_data_test_flag(HOST_SME_ENABLED))140140- sysreg_clear_set(CPACR_EL1, 0, CPACR_EL1_SMEN);141141- else142142- sysreg_clear_set(CPACR_EL1,143143- CPACR_EL1_SMEN_EL0EN,144144- CPACR_EL1_SMEN_EL1EN);145145- isb();146146- }147147-148165 if (guest_owns_fp_regs()) {149149- if (vcpu_has_sve(vcpu)) {150150- u64 zcr = read_sysreg_el1(SYS_ZCR);151151-152152- /*153153- * If the vCPU is in the hyp context then ZCR_EL1 is154154- * loaded with its vEL2 counterpart.155155- */156156- __vcpu_sys_reg(vcpu, vcpu_sve_zcr_elx(vcpu)) = zcr;157157-158158- /*159159- * Restore the VL that was saved when bound to the CPU,160160- * which is the maximum VL for the guest. Because the161161- * layout of the data when saving the sve state depends162162- * on the VL, we need to use a consistent (i.e., the163163- * maximum) VL.164164- * Note that this means that at guest exit ZCR_EL1 is165165- * not necessarily the same as on guest entry.166166- *167167- * ZCR_EL2 holds the guest hypervisor's VL when running168168- * a nested guest, which could be smaller than the169169- * max for the vCPU. Similar to above, we first need to170170- * switch to a VL consistent with the layout of the171171- * vCPU's SVE state. KVM support for NV implies VHE, so172172- * using the ZCR_EL1 alias is safe.173173- */174174- if (!has_vhe() || (vcpu_has_nv(vcpu) && !is_hyp_ctxt(vcpu)))175175- sve_cond_update_zcr_vq(vcpu_sve_max_vq(vcpu) - 1,176176- SYS_ZCR_EL1);177177- }178178-179166 /*180167 * Flush (save and invalidate) the fpsimd/sve state so that if181168 * the host tries to use fpsimd/sve, it's not using stale data···142219 * when needed.143220 */144221 fpsimd_save_and_flush_cpu_state();145145- } else if (has_vhe() && system_supports_sve()) {146146- /*147147- * The FPSIMD/SVE state in the CPU has not been touched, and we148148- * have SVE (and VHE): CPACR_EL1 (alias CPTR_EL2) has been149149- * reset by kvm_reset_cptr_el2() in the Hyp code, disabling SVE150150- * for EL0. To avoid spurious traps, restore the trap state151151- * seen by kvm_arch_vcpu_load_fp():152152- */153153- if (host_data_test_flag(HOST_SVE_ENABLED))154154- sysreg_clear_set(CPACR_EL1, 0, CPACR_EL1_ZEN_EL0EN);155155- else156156- sysreg_clear_set(CPACR_EL1, CPACR_EL1_ZEN_EL0EN, 0);157222 }158223159224 local_irq_restore(flags);
+5
arch/arm64/kvm/hyp/entry.S
···4444alternative_else_nop_endif4545 mrs x1, isr_el14646 cbz x1, 1f4747+4848+ // Ensure that __guest_enter() always provides a context4949+ // synchronization event so that callers don't need ISBs for anything5050+ // that would usually be synchonized by the ERET.5151+ isb4752 mov x0, #ARM_EXCEPTION_IRQ4853 ret4954
+111-37
arch/arm64/kvm/hyp/include/hyp/switch.h
···326326 return __get_fault_info(vcpu->arch.fault.esr_el2, &vcpu->arch.fault);327327}328328329329-static bool kvm_hyp_handle_mops(struct kvm_vcpu *vcpu, u64 *exit_code)329329+static inline bool kvm_hyp_handle_mops(struct kvm_vcpu *vcpu, u64 *exit_code)330330{331331 *vcpu_pc(vcpu) = read_sysreg_el2(SYS_ELR);332332 arm64_mops_reset_regs(vcpu_gp_regs(vcpu), vcpu->arch.fault.esr_el2);···375375 true);376376}377377378378-static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu);378378+static inline void fpsimd_lazy_switch_to_guest(struct kvm_vcpu *vcpu)379379+{380380+ u64 zcr_el1, zcr_el2;381381+382382+ if (!guest_owns_fp_regs())383383+ return;384384+385385+ if (vcpu_has_sve(vcpu)) {386386+ /* A guest hypervisor may restrict the effective max VL. */387387+ if (vcpu_has_nv(vcpu) && !is_hyp_ctxt(vcpu))388388+ zcr_el2 = __vcpu_sys_reg(vcpu, ZCR_EL2);389389+ else390390+ zcr_el2 = vcpu_sve_max_vq(vcpu) - 1;391391+392392+ write_sysreg_el2(zcr_el2, SYS_ZCR);393393+394394+ zcr_el1 = __vcpu_sys_reg(vcpu, vcpu_sve_zcr_elx(vcpu));395395+ write_sysreg_el1(zcr_el1, SYS_ZCR);396396+ }397397+}398398+399399+static inline void fpsimd_lazy_switch_to_host(struct kvm_vcpu *vcpu)400400+{401401+ u64 zcr_el1, zcr_el2;402402+403403+ if (!guest_owns_fp_regs())404404+ return;405405+406406+ /*407407+ * When the guest owns the FP regs, we know that guest+hyp traps for408408+ * any FPSIMD/SVE/SME features exposed to the guest have been disabled409409+ * by either fpsimd_lazy_switch_to_guest() or kvm_hyp_handle_fpsimd()410410+ * prior to __guest_entry(). As __guest_entry() guarantees a context411411+ * synchronization event, we don't need an ISB here to avoid taking412412+ * traps for anything that was exposed to the guest.413413+ */414414+ if (vcpu_has_sve(vcpu)) {415415+ zcr_el1 = read_sysreg_el1(SYS_ZCR);416416+ __vcpu_sys_reg(vcpu, vcpu_sve_zcr_elx(vcpu)) = zcr_el1;417417+418418+ /*419419+ * The guest's state is always saved using the guest's max VL.420420+ * Ensure that the host has the guest's max VL active such that421421+ * the host can save the guest's state lazily, but don't422422+ * artificially restrict the host to the guest's max VL.423423+ */424424+ if (has_vhe()) {425425+ zcr_el2 = vcpu_sve_max_vq(vcpu) - 1;426426+ write_sysreg_el2(zcr_el2, SYS_ZCR);427427+ } else {428428+ zcr_el2 = sve_vq_from_vl(kvm_host_sve_max_vl) - 1;429429+ write_sysreg_el2(zcr_el2, SYS_ZCR);430430+431431+ zcr_el1 = vcpu_sve_max_vq(vcpu) - 1;432432+ write_sysreg_el1(zcr_el1, SYS_ZCR);433433+ }434434+ }435435+}436436+437437+static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu)438438+{439439+ /*440440+ * Non-protected kvm relies on the host restoring its sve state.441441+ * Protected kvm restores the host's sve state as not to reveal that442442+ * fpsimd was used by a guest nor leak upper sve bits.443443+ */444444+ if (system_supports_sve()) {445445+ __hyp_sve_save_host();446446+447447+ /* Re-enable SVE traps if not supported for the guest vcpu. */448448+ if (!vcpu_has_sve(vcpu))449449+ cpacr_clear_set(CPACR_EL1_ZEN, 0);450450+451451+ } else {452452+ __fpsimd_save_state(host_data_ptr(host_ctxt.fp_regs));453453+ }454454+455455+ if (kvm_has_fpmr(kern_hyp_va(vcpu->kvm)))456456+ *host_data_ptr(fpmr) = read_sysreg_s(SYS_FPMR);457457+}458458+379459380460/*381461 * We trap the first access to the FP/SIMD to save the host context and···463383 * If FP/SIMD is not implemented, handle the trap and inject an undefined464384 * instruction exception to the guest. Similarly for trapped SVE accesses.465385 */466466-static bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code)386386+static inline bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code)467387{468388 bool sve_guest;469389 u8 esr_ec;···505425 isb();506426507427 /* Write out the host state if it's in the registers */508508- if (host_owns_fp_regs())428428+ if (is_protected_kvm_enabled() && host_owns_fp_regs())509429 kvm_hyp_save_fpsimd_host(vcpu);510430511431 /* Restore the guest state */···581501 return true;582502}583503504504+/* Open-coded version of timer_get_offset() to allow for kern_hyp_va() */505505+static inline u64 hyp_timer_get_offset(struct arch_timer_context *ctxt)506506+{507507+ u64 offset = 0;508508+509509+ if (ctxt->offset.vm_offset)510510+ offset += *kern_hyp_va(ctxt->offset.vm_offset);511511+ if (ctxt->offset.vcpu_offset)512512+ offset += *kern_hyp_va(ctxt->offset.vcpu_offset);513513+514514+ return offset;515515+}516516+584517static inline u64 compute_counter_value(struct arch_timer_context *ctxt)585518{586586- return arch_timer_read_cntpct_el0() - timer_get_offset(ctxt);519519+ return arch_timer_read_cntpct_el0() - hyp_timer_get_offset(ctxt);587520}588521589522static bool kvm_handle_cntxct(struct kvm_vcpu *vcpu)···680587 return true;681588}682589683683-static bool kvm_hyp_handle_sysreg(struct kvm_vcpu *vcpu, u64 *exit_code)590590+static inline bool kvm_hyp_handle_sysreg(struct kvm_vcpu *vcpu, u64 *exit_code)684591{685592 if (cpus_have_final_cap(ARM64_WORKAROUND_CAVIUM_TX2_219_TVM) &&686593 handle_tx2_tvm(vcpu))···700607 return false;701608}702609703703-static bool kvm_hyp_handle_cp15_32(struct kvm_vcpu *vcpu, u64 *exit_code)610610+static inline bool kvm_hyp_handle_cp15_32(struct kvm_vcpu *vcpu, u64 *exit_code)704611{705612 if (static_branch_unlikely(&vgic_v3_cpuif_trap) &&706613 __vgic_v3_perform_cpuif_access(vcpu) == 1)···709616 return false;710617}711618712712-static bool kvm_hyp_handle_memory_fault(struct kvm_vcpu *vcpu, u64 *exit_code)619619+static inline bool kvm_hyp_handle_memory_fault(struct kvm_vcpu *vcpu,620620+ u64 *exit_code)713621{714622 if (!__populate_fault_info(vcpu))715623 return true;716624717625 return false;718626}719719-static bool kvm_hyp_handle_iabt_low(struct kvm_vcpu *vcpu, u64 *exit_code)720720- __alias(kvm_hyp_handle_memory_fault);721721-static bool kvm_hyp_handle_watchpt_low(struct kvm_vcpu *vcpu, u64 *exit_code)722722- __alias(kvm_hyp_handle_memory_fault);627627+#define kvm_hyp_handle_iabt_low kvm_hyp_handle_memory_fault628628+#define kvm_hyp_handle_watchpt_low kvm_hyp_handle_memory_fault723629724724-static bool kvm_hyp_handle_dabt_low(struct kvm_vcpu *vcpu, u64 *exit_code)630630+static inline bool kvm_hyp_handle_dabt_low(struct kvm_vcpu *vcpu, u64 *exit_code)725631{726632 if (kvm_hyp_handle_memory_fault(vcpu, exit_code))727633 return true;···750658751659typedef bool (*exit_handler_fn)(struct kvm_vcpu *, u64 *);752660753753-static const exit_handler_fn *kvm_get_exit_handler_array(struct kvm_vcpu *vcpu);754754-755755-static void early_exit_filter(struct kvm_vcpu *vcpu, u64 *exit_code);756756-757661/*758662 * Allow the hypervisor to handle the exit with an exit handler if it has one.759663 *760664 * Returns true if the hypervisor handled the exit, and control should go back761665 * to the guest, or false if it hasn't.762666 */763763-static inline bool kvm_hyp_handle_exit(struct kvm_vcpu *vcpu, u64 *exit_code)667667+static inline bool kvm_hyp_handle_exit(struct kvm_vcpu *vcpu, u64 *exit_code,668668+ const exit_handler_fn *handlers)764669{765765- const exit_handler_fn *handlers = kvm_get_exit_handler_array(vcpu);766766- exit_handler_fn fn;767767-768768- fn = handlers[kvm_vcpu_trap_get_class(vcpu)];769769-670670+ exit_handler_fn fn = handlers[kvm_vcpu_trap_get_class(vcpu)];770671 if (fn)771672 return fn(vcpu, exit_code);772673···789704 * the guest, false when we should restore the host state and return to the790705 * main run loop.791706 */792792-static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)707707+static inline bool __fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code,708708+ const exit_handler_fn *handlers)793709{794794- /*795795- * Save PSTATE early so that we can evaluate the vcpu mode796796- * early on.797797- */798798- synchronize_vcpu_pstate(vcpu, exit_code);799799-800800- /*801801- * Check whether we want to repaint the state one way or802802- * another.803803- */804804- early_exit_filter(vcpu, exit_code);805805-806710 if (ARM_EXCEPTION_CODE(*exit_code) != ARM_EXCEPTION_IRQ)807711 vcpu->arch.fault.esr_el2 = read_sysreg_el2(SYS_ESR);808712···821747 goto exit;822748823749 /* Check if there's an exit handler and allow it to handle the exit. */824824- if (kvm_hyp_handle_exit(vcpu, exit_code))750750+ if (kvm_hyp_handle_exit(vcpu, exit_code, handlers))825751 goto guest;826752exit:827753 /* Return to the host kernel and handle the exit */
+7-8
arch/arm64/kvm/hyp/nvhe/hyp-main.c
···55 */6677#include <hyp/adjust_pc.h>88+#include <hyp/switch.h>89910#include <asm/pgtable-types.h>1011#include <asm/kvm_asm.h>···8483 if (system_supports_sve())8584 __hyp_sve_restore_host();8685 else8787- __fpsimd_restore_state(*host_data_ptr(fpsimd_state));8686+ __fpsimd_restore_state(host_data_ptr(host_ctxt.fp_regs));88878988 if (has_fpmr)9089 write_sysreg_s(*host_data_ptr(fpmr), SYS_FPMR);···225224226225 sync_hyp_vcpu(hyp_vcpu);227226 } else {227227+ struct kvm_vcpu *vcpu = kern_hyp_va(host_vcpu);228228+228229 /* The host is fully trusted, run its vCPU directly. */229229- ret = __kvm_vcpu_run(kern_hyp_va(host_vcpu));230230+ fpsimd_lazy_switch_to_guest(vcpu);231231+ ret = __kvm_vcpu_run(vcpu);232232+ fpsimd_lazy_switch_to_host(vcpu);230233 }231234out:232235 cpu_reg(host_ctxt, 1) = ret;···679674 break;680675 case ESR_ELx_EC_SMC64:681676 handle_host_smc(host_ctxt);682682- break;683683- case ESR_ELx_EC_SVE:684684- cpacr_clear_set(0, CPACR_EL1_ZEN);685685- isb();686686- sve_cond_update_zcr_vq(sve_vq_from_vl(kvm_host_sve_max_vl) - 1,687687- SYS_ZCR_EL2);688677 break;689678 case ESR_ELx_EC_IABT_LOW:690679 case ESR_ELx_EC_DABT_LOW:
+41-35
arch/arm64/kvm/hyp/nvhe/mem_protect.c
···943943 ret = kvm_pgtable_get_leaf(&vm->pgt, ipa, &pte, &level);944944 if (ret)945945 return ret;946946- if (level != KVM_PGTABLE_LAST_LEVEL)947947- return -E2BIG;948946 if (!kvm_pte_valid(pte))949947 return -ENOENT;948948+ if (level != KVM_PGTABLE_LAST_LEVEL)949949+ return -E2BIG;950950951951 state = guest_get_page_state(pte, ipa);952952 if (state != PKVM_PAGE_SHARED_BORROWED)···998998 return ret;999999}1000100010011001-int __pkvm_host_relax_perms_guest(u64 gfn, struct pkvm_hyp_vcpu *vcpu, enum kvm_pgtable_prot prot)10011001+static void assert_host_shared_guest(struct pkvm_hyp_vm *vm, u64 ipa)10021002{10031003- struct pkvm_hyp_vm *vm = pkvm_hyp_vcpu_to_hyp_vm(vcpu);10041004- u64 ipa = hyp_pfn_to_phys(gfn);10051003 u64 phys;10061004 int ret;1007100510081008- if (prot & ~KVM_PGTABLE_PROT_RWX)10091009- return -EINVAL;10061006+ if (!IS_ENABLED(CONFIG_NVHE_EL2_DEBUG))10071007+ return;1010100810111009 host_lock_component();10121010 guest_lock_component(vm);1013101110141012 ret = __check_host_shared_guest(vm, &phys, ipa);10151015- if (!ret)10161016- ret = kvm_pgtable_stage2_relax_perms(&vm->pgt, ipa, prot, 0);1017101310181014 guest_unlock_component(vm);10191015 host_unlock_component();10161016+10171017+ WARN_ON(ret && ret != -ENOENT);10181018+}10191019+10201020+int __pkvm_host_relax_perms_guest(u64 gfn, struct pkvm_hyp_vcpu *vcpu, enum kvm_pgtable_prot prot)10211021+{10221022+ struct pkvm_hyp_vm *vm = pkvm_hyp_vcpu_to_hyp_vm(vcpu);10231023+ u64 ipa = hyp_pfn_to_phys(gfn);10241024+ int ret;10251025+10261026+ if (pkvm_hyp_vm_is_protected(vm))10271027+ return -EPERM;10281028+10291029+ if (prot & ~KVM_PGTABLE_PROT_RWX)10301030+ return -EINVAL;10311031+10321032+ assert_host_shared_guest(vm, ipa);10331033+ guest_lock_component(vm);10341034+ ret = kvm_pgtable_stage2_relax_perms(&vm->pgt, ipa, prot, 0);10351035+ guest_unlock_component(vm);1020103610211037 return ret;10221038}···10401024int __pkvm_host_wrprotect_guest(u64 gfn, struct pkvm_hyp_vm *vm)10411025{10421026 u64 ipa = hyp_pfn_to_phys(gfn);10431043- u64 phys;10441027 int ret;1045102810461046- host_lock_component();10291029+ if (pkvm_hyp_vm_is_protected(vm))10301030+ return -EPERM;10311031+10321032+ assert_host_shared_guest(vm, ipa);10471033 guest_lock_component(vm);10481048-10491049- ret = __check_host_shared_guest(vm, &phys, ipa);10501050- if (!ret)10511051- ret = kvm_pgtable_stage2_wrprotect(&vm->pgt, ipa, PAGE_SIZE);10521052-10341034+ ret = kvm_pgtable_stage2_wrprotect(&vm->pgt, ipa, PAGE_SIZE);10531035 guest_unlock_component(vm);10541054- host_unlock_component();1055103610561037 return ret;10571038}···10561043int __pkvm_host_test_clear_young_guest(u64 gfn, bool mkold, struct pkvm_hyp_vm *vm)10571044{10581045 u64 ipa = hyp_pfn_to_phys(gfn);10591059- u64 phys;10601046 int ret;1061104710621062- host_lock_component();10481048+ if (pkvm_hyp_vm_is_protected(vm))10491049+ return -EPERM;10501050+10511051+ assert_host_shared_guest(vm, ipa);10631052 guest_lock_component(vm);10641064-10651065- ret = __check_host_shared_guest(vm, &phys, ipa);10661066- if (!ret)10671067- ret = kvm_pgtable_stage2_test_clear_young(&vm->pgt, ipa, PAGE_SIZE, mkold);10681068-10531053+ ret = kvm_pgtable_stage2_test_clear_young(&vm->pgt, ipa, PAGE_SIZE, mkold);10691054 guest_unlock_component(vm);10701070- host_unlock_component();1071105510721056 return ret;10731057}···10731063{10741064 struct pkvm_hyp_vm *vm = pkvm_hyp_vcpu_to_hyp_vm(vcpu);10751065 u64 ipa = hyp_pfn_to_phys(gfn);10761076- u64 phys;10771077- int ret;1078106610791079- host_lock_component();10671067+ if (pkvm_hyp_vm_is_protected(vm))10681068+ return -EPERM;10691069+10701070+ assert_host_shared_guest(vm, ipa);10801071 guest_lock_component(vm);10811081-10821082- ret = __check_host_shared_guest(vm, &phys, ipa);10831083- if (!ret)10841084- kvm_pgtable_stage2_mkyoung(&vm->pgt, ipa, 0);10851085-10721072+ kvm_pgtable_stage2_mkyoung(&vm->pgt, ipa, 0);10861073 guest_unlock_component(vm);10871087- host_unlock_component();1088107410891089- return ret;10751075+ return 0;10901076}
+45-44
arch/arm64/kvm/hyp/nvhe/switch.c
···3939{4040 u64 val = CPTR_EL2_TAM; /* Same bit irrespective of E2H */41414242+ if (!guest_owns_fp_regs())4343+ __activate_traps_fpsimd32(vcpu);4444+4245 if (has_hvhe()) {4346 val |= CPACR_EL1_TTA;4447···5047 if (vcpu_has_sve(vcpu))5148 val |= CPACR_EL1_ZEN;5249 }5050+5151+ write_sysreg(val, cpacr_el1);5352 } else {5453 val |= CPTR_EL2_TTA | CPTR_NVHE_EL2_RES1;5554···66616762 if (!guest_owns_fp_regs())6863 val |= CPTR_EL2_TFP;6464+6565+ write_sysreg(val, cptr_el2);6966 }6767+}70687171- if (!guest_owns_fp_regs())7272- __activate_traps_fpsimd32(vcpu);6969+static void __deactivate_cptr_traps(struct kvm_vcpu *vcpu)7070+{7171+ if (has_hvhe()) {7272+ u64 val = CPACR_EL1_FPEN;73737474- kvm_write_cptr_el2(val);7474+ if (cpus_have_final_cap(ARM64_SVE))7575+ val |= CPACR_EL1_ZEN;7676+ if (cpus_have_final_cap(ARM64_SME))7777+ val |= CPACR_EL1_SMEN;7878+7979+ write_sysreg(val, cpacr_el1);8080+ } else {8181+ u64 val = CPTR_NVHE_EL2_RES1;8282+8383+ if (!cpus_have_final_cap(ARM64_SVE))8484+ val |= CPTR_EL2_TZ;8585+ if (!cpus_have_final_cap(ARM64_SME))8686+ val |= CPTR_EL2_TSM;8787+8888+ write_sysreg(val, cptr_el2);8989+ }7590}76917792static void __activate_traps(struct kvm_vcpu *vcpu)···144119145120 write_sysreg(this_cpu_ptr(&kvm_init_params)->hcr_el2, hcr_el2);146121147147- kvm_reset_cptr_el2(vcpu);122122+ __deactivate_cptr_traps(vcpu);148123 write_sysreg(__kvm_hyp_host_vector, vbar_el2);149124}150125···217192 kvm_handle_pvm_sysreg(vcpu, exit_code));218193}219194220220-static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu)221221-{222222- /*223223- * Non-protected kvm relies on the host restoring its sve state.224224- * Protected kvm restores the host's sve state as not to reveal that225225- * fpsimd was used by a guest nor leak upper sve bits.226226- */227227- if (unlikely(is_protected_kvm_enabled() && system_supports_sve())) {228228- __hyp_sve_save_host();229229-230230- /* Re-enable SVE traps if not supported for the guest vcpu. */231231- if (!vcpu_has_sve(vcpu))232232- cpacr_clear_set(CPACR_EL1_ZEN, 0);233233-234234- } else {235235- __fpsimd_save_state(*host_data_ptr(fpsimd_state));236236- }237237-238238- if (kvm_has_fpmr(kern_hyp_va(vcpu->kvm))) {239239- u64 val = read_sysreg_s(SYS_FPMR);240240-241241- if (unlikely(is_protected_kvm_enabled()))242242- *host_data_ptr(fpmr) = val;243243- else244244- **host_data_ptr(fpmr_ptr) = val;245245- }246246-}247247-248195static const exit_handler_fn hyp_exit_handlers[] = {249196 [0 ... ESR_ELx_EC_MAX] = NULL,250197 [ESR_ELx_EC_CP15_32] = kvm_hyp_handle_cp15_32,···248251 return hyp_exit_handlers;249252}250253251251-/*252252- * Some guests (e.g., protected VMs) are not be allowed to run in AArch32.253253- * The ARMv8 architecture does not give the hypervisor a mechanism to prevent a254254- * guest from dropping to AArch32 EL0 if implemented by the CPU. If the255255- * hypervisor spots a guest in such a state ensure it is handled, and don't256256- * trust the host to spot or fix it. The check below is based on the one in257257- * kvm_arch_vcpu_ioctl_run().258258- *259259- * Returns false if the guest ran in AArch32 when it shouldn't have, and260260- * thus should exit to the host, or true if a the guest run loop can continue.261261- */262262-static void early_exit_filter(struct kvm_vcpu *vcpu, u64 *exit_code)254254+static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)263255{256256+ const exit_handler_fn *handlers = kvm_get_exit_handler_array(vcpu);257257+258258+ synchronize_vcpu_pstate(vcpu, exit_code);259259+260260+ /*261261+ * Some guests (e.g., protected VMs) are not be allowed to run in262262+ * AArch32. The ARMv8 architecture does not give the hypervisor a263263+ * mechanism to prevent a guest from dropping to AArch32 EL0 if264264+ * implemented by the CPU. If the hypervisor spots a guest in such a265265+ * state ensure it is handled, and don't trust the host to spot or fix266266+ * it. The check below is based on the one in267267+ * kvm_arch_vcpu_ioctl_run().268268+ */264269 if (unlikely(vcpu_is_protected(vcpu) && vcpu_mode_is_32bit(vcpu))) {265270 /*266271 * As we have caught the guest red-handed, decide that it isn't···275276 *exit_code &= BIT(ARM_EXIT_WITH_SERROR_BIT);276277 *exit_code |= ARM_EXCEPTION_IL;277278 }279279+280280+ return __fixup_guest_exit(vcpu, exit_code, handlers);278281}279282280283/* Switch to the guest for legacy non-VHE systems */
+19-14
arch/arm64/kvm/hyp/vhe/switch.c
···136136 write_sysreg(val, cpacr_el1);137137}138138139139+static void __deactivate_cptr_traps(struct kvm_vcpu *vcpu)140140+{141141+ u64 val = CPACR_EL1_FPEN | CPACR_EL1_ZEN_EL1EN;142142+143143+ if (cpus_have_final_cap(ARM64_SME))144144+ val |= CPACR_EL1_SMEN_EL1EN;145145+146146+ write_sysreg(val, cpacr_el1);147147+}148148+139149static void __activate_traps(struct kvm_vcpu *vcpu)140150{141151 u64 val;···217207 */218208 asm(ALTERNATIVE("nop", "isb", ARM64_WORKAROUND_SPECULATIVE_AT));219209220220- kvm_reset_cptr_el2(vcpu);210210+ __deactivate_cptr_traps(vcpu);221211222212 if (!arm64_kernel_unmapped_at_el0())223213 host_vectors = __this_cpu_read(this_cpu_vector);···423413 return true;424414}425415426426-static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu)427427-{428428- __fpsimd_save_state(*host_data_ptr(fpsimd_state));429429-430430- if (kvm_has_fpmr(vcpu->kvm))431431- **host_data_ptr(fpmr_ptr) = read_sysreg_s(SYS_FPMR);432432-}433433-434416static bool kvm_hyp_handle_tlbi_el2(struct kvm_vcpu *vcpu, u64 *exit_code)435417{436418 int ret = -EINVAL;···540538 [ESR_ELx_EC_MOPS] = kvm_hyp_handle_mops,541539};542540543543-static const exit_handler_fn *kvm_get_exit_handler_array(struct kvm_vcpu *vcpu)541541+static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)544542{545545- return hyp_exit_handlers;546546-}543543+ synchronize_vcpu_pstate(vcpu, exit_code);547544548548-static void early_exit_filter(struct kvm_vcpu *vcpu, u64 *exit_code)549549-{550545 /*551546 * If we were in HYP context on entry, adjust the PSTATE view552547 * so that the usual helpers work correctly.···563564 *vcpu_cpsr(vcpu) &= ~(PSR_MODE_MASK | PSR_MODE32_BIT);564565 *vcpu_cpsr(vcpu) |= mode;565566 }567567+568568+ return __fixup_guest_exit(vcpu, exit_code, hyp_exit_handlers);566569}567570568571/* Switch to the guest for VHE systems running in EL2 */···578577 guest_ctxt = &vcpu->arch.ctxt;579578580579 sysreg_save_host_state_vhe(host_ctxt);580580+581581+ fpsimd_lazy_switch_to_guest(vcpu);581582582583 /*583584 * Note that ARM erratum 1165522 requires us to configure both stage 1···604601 sysreg_save_guest_state_vhe(guest_ctxt);605602606603 __deactivate_traps(vcpu);604604+605605+ fpsimd_lazy_switch_to_host(vcpu);607606608607 sysreg_restore_host_state_vhe(host_ctxt);609608
+37-37
arch/arm64/kvm/vgic/vgic-init.c
···3434 *3535 * CPU Interface:3636 *3737- * - kvm_vgic_vcpu_init(): initialization of static data that3838- * doesn't depend on any sizing information or emulation type. No3939- * allocation is allowed there.3737+ * - kvm_vgic_vcpu_init(): initialization of static data that doesn't depend3838+ * on any sizing information. Private interrupts are allocated if not3939+ * already allocated at vgic-creation time.4040 */41414242/* EARLY INIT */···5757}58585959/* CREATION */6060+6161+static int vgic_allocate_private_irqs_locked(struct kvm_vcpu *vcpu, u32 type);60626163/**6264 * kvm_vgic_create: triggered by the instantiation of the VGIC device by···111109112110 if (atomic_read(&kvm->online_vcpus) > kvm->max_vcpus) {113111 ret = -E2BIG;112112+ goto out_unlock;113113+ }114114+115115+ kvm_for_each_vcpu(i, vcpu, kvm) {116116+ ret = vgic_allocate_private_irqs_locked(vcpu, type);117117+ if (ret)118118+ break;119119+ }120120+121121+ if (ret) {122122+ kvm_for_each_vcpu(i, vcpu, kvm) {123123+ struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;124124+ kfree(vgic_cpu->private_irqs);125125+ vgic_cpu->private_irqs = NULL;126126+ }127127+114128 goto out_unlock;115129 }116130···198180 return 0;199181}200182201201-static int vgic_allocate_private_irqs_locked(struct kvm_vcpu *vcpu)183183+static int vgic_allocate_private_irqs_locked(struct kvm_vcpu *vcpu, u32 type)202184{203185 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;204186 int i;···236218 /* PPIs */237219 irq->config = VGIC_CONFIG_LEVEL;238220 }221221+222222+ switch (type) {223223+ case KVM_DEV_TYPE_ARM_VGIC_V3:224224+ irq->group = 1;225225+ irq->mpidr = kvm_vcpu_get_mpidr_aff(vcpu);226226+ break;227227+ case KVM_DEV_TYPE_ARM_VGIC_V2:228228+ irq->group = 0;229229+ irq->targets = BIT(vcpu->vcpu_id);230230+ break;231231+ }239232 }240233241234 return 0;242235}243236244244-static int vgic_allocate_private_irqs(struct kvm_vcpu *vcpu)237237+static int vgic_allocate_private_irqs(struct kvm_vcpu *vcpu, u32 type)245238{246239 int ret;247240248241 mutex_lock(&vcpu->kvm->arch.config_lock);249249- ret = vgic_allocate_private_irqs_locked(vcpu);242242+ ret = vgic_allocate_private_irqs_locked(vcpu, type);250243 mutex_unlock(&vcpu->kvm->arch.config_lock);251244252245 return ret;···287258 if (!irqchip_in_kernel(vcpu->kvm))288259 return 0;289260290290- ret = vgic_allocate_private_irqs(vcpu);261261+ ret = vgic_allocate_private_irqs(vcpu, dist->vgic_model);291262 if (ret)292263 return ret;293264···324295{325296 struct vgic_dist *dist = &kvm->arch.vgic;326297 struct kvm_vcpu *vcpu;327327- int ret = 0, i;298298+ int ret = 0;328299 unsigned long idx;329300330301 lockdep_assert_held(&kvm->arch.config_lock);···343314 ret = kvm_vgic_dist_init(kvm, dist->nr_spis);344315 if (ret)345316 goto out;346346-347347- /* Initialize groups on CPUs created before the VGIC type was known */348348- kvm_for_each_vcpu(idx, vcpu, kvm) {349349- ret = vgic_allocate_private_irqs_locked(vcpu);350350- if (ret)351351- goto out;352352-353353- for (i = 0; i < VGIC_NR_PRIVATE_IRQS; i++) {354354- struct vgic_irq *irq = vgic_get_vcpu_irq(vcpu, i);355355-356356- switch (dist->vgic_model) {357357- case KVM_DEV_TYPE_ARM_VGIC_V3:358358- irq->group = 1;359359- irq->mpidr = kvm_vcpu_get_mpidr_aff(vcpu);360360- break;361361- case KVM_DEV_TYPE_ARM_VGIC_V2:362362- irq->group = 0;363363- irq->targets = 1U << idx;364364- break;365365- default:366366- ret = -EINVAL;367367- }368368-369369- vgic_put_irq(kvm, irq);370370-371371- if (ret)372372- goto out;373373- }374374- }375317376318 /*377319 * If we have GICv4.1 enabled, unconditionally request enable the
+7
arch/arm64/mm/trans_pgd.c
···162162 unsigned long next;163163 unsigned long addr = start;164164165165+ if (pgd_none(READ_ONCE(*dst_pgdp))) {166166+ dst_p4dp = trans_alloc(info);167167+ if (!dst_p4dp)168168+ return -ENOMEM;169169+ pgd_populate(NULL, dst_pgdp, dst_p4dp);170170+ }171171+165172 dst_p4dp = p4d_offset(dst_pgdp, start);166173 src_p4dp = p4d_offset(src_pgdp, start);167174 do {
+2-2
arch/mips/include/asm/ptrace.h
···2727 */2828struct pt_regs {2929#ifdef CONFIG_32BIT3030- /* Pad bytes for argument save space on the stack. */3131- unsigned long pad0[8];3030+ /* Saved syscall stack arguments; entries 0-3 unused. */3131+ unsigned long args[8];3232#endif33333434 /* Saved main processor registers. */
+8-24
arch/mips/include/asm/syscall.h
···5757static inline void mips_get_syscall_arg(unsigned long *arg,5858 struct task_struct *task, struct pt_regs *regs, unsigned int n)5959{6060- unsigned long usp __maybe_unused = regs->regs[29];6161-6060+#ifdef CONFIG_32BIT6261 switch (n) {6362 case 0: case 1: case 2: case 3:6463 *arg = regs->regs[4 + n];6565-6664 return;6767-6868-#ifdef CONFIG_32BIT6965 case 4: case 5: case 6: case 7:7070- get_user(*arg, (int *)usp + n);6666+ *arg = regs->args[n];7167 return;7272-#endif7373-7474-#ifdef CONFIG_64BIT7575- case 4: case 5: case 6: case 7:7676-#ifdef CONFIG_MIPS32_O327777- if (test_tsk_thread_flag(task, TIF_32BIT_REGS))7878- get_user(*arg, (int *)usp + n);7979- else8080-#endif8181- *arg = regs->regs[4 + n];8282-8383- return;8484-#endif8585-8686- default:8787- BUG();8868 }8989-9090- unreachable();6969+#else7070+ *arg = regs->regs[4 + n];7171+ if ((IS_ENABLED(CONFIG_MIPS32_O32) &&7272+ test_tsk_thread_flag(task, TIF_32BIT_REGS)))7373+ *arg = (unsigned int)*arg;7474+#endif9175}92769377static inline long syscall_get_error(struct task_struct *task,
···6464load_a7: user_lw(t8, 28(t0)) # argument #8 from usp6565loads_done:66666767- sw t5, 16(sp) # argument #5 to ksp6868- sw t6, 20(sp) # argument #6 to ksp6969- sw t7, 24(sp) # argument #7 to ksp7070- sw t8, 28(sp) # argument #8 to ksp6767+ sw t5, PT_ARG4(sp) # argument #5 to ksp6868+ sw t6, PT_ARG5(sp) # argument #6 to ksp6969+ sw t7, PT_ARG6(sp) # argument #7 to ksp7070+ sw t8, PT_ARG7(sp) # argument #8 to ksp7171 .set pop72727373 .section __ex_table,"a"
+10-2
arch/powerpc/include/asm/book3s/64/hash-4k.h
···7777/*7878 * With 4K page size the real_pte machinery is all nops.7979 */8080-#define __real_pte(e, p, o) ((real_pte_t){(e)})8080+static inline real_pte_t __real_pte(pte_t pte, pte_t *ptep, int offset)8181+{8282+ return (real_pte_t){pte};8383+}8484+8185#define __rpte_to_pte(r) ((r).pte)8282-#define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT)8686+8787+static inline unsigned long __rpte_to_hidx(real_pte_t rpte, unsigned long index)8888+{8989+ return pte_val(__rpte_to_pte(rpte)) >> H_PAGE_F_GIX_SHIFT;9090+}83918492#define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \8593 do { \
+3-1
arch/powerpc/lib/code-patching.c
···108108 unsigned long addr;109109 int err;110110111111- area = get_vm_area(PAGE_SIZE, VM_ALLOC);111111+ area = get_vm_area(PAGE_SIZE, 0);112112 if (!area) {113113 WARN_ONCE(1, "Failed to create text area for cpu %d\n",114114 cpu);···493493494494 orig_mm = start_using_temp_mm(patching_mm);495495496496+ kasan_disable_current();496497 err = __patch_instructions(patch_addr, code, len, repeat_instr);498498+ kasan_enable_current();497499498500 /* context synchronisation performed by __patch_instructions */499501 stop_using_temp_mm(patching_mm, orig_mm);
-1
arch/s390/configs/debug_defconfig
···740740CONFIG_IMA_DEFAULT_HASH_SHA256=y741741CONFIG_IMA_WRITE_POLICY=y742742CONFIG_IMA_APPRAISE=y743743-CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor"744743CONFIG_BUG_ON_DATA_CORRUPTION=y745744CONFIG_CRYPTO_USER=m746745# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
···6262# CONFIG_INOTIFY_USER is not set6363# CONFIG_MISC_FILESYSTEMS is not set6464# CONFIG_NETWORK_FILESYSTEMS is not set6565-CONFIG_LSM="yama,loadpin,safesetid,integrity"6665# CONFIG_ZLIB_DFLTCC is not set6766CONFIG_XZ_DEC_MICROLZMA=y6867CONFIG_PRINTK_TIME=y
+5-1
arch/s390/include/asm/bitops.h
···5353 unsigned long mask;5454 int cc;55555656- if (__builtin_constant_p(nr)) {5656+ /*5757+ * With CONFIG_PROFILE_ALL_BRANCHES enabled gcc fails to5858+ * handle __builtin_constant_p() in some cases.5959+ */6060+ if (!IS_ENABLED(CONFIG_PROFILE_ALL_BRANCHES) && __builtin_constant_p(nr)) {5761 addr = (const volatile unsigned char *)ptr;5862 addr += (nr ^ (BITS_PER_LONG - BITS_PER_BYTE)) / BITS_PER_BYTE;5963 mask = 1UL << (nr & (BITS_PER_BYTE - 1));
+20
arch/s390/pci/pci_bus.c
···331331 return rc;332332}333333334334+static bool zpci_bus_is_isolated_vf(struct zpci_bus *zbus, struct zpci_dev *zdev)335335+{336336+ struct pci_dev *pdev;337337+338338+ pdev = zpci_iov_find_parent_pf(zbus, zdev);339339+ if (!pdev)340340+ return true;341341+ pci_dev_put(pdev);342342+ return false;343343+}344344+334345int zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops)335346{336347 bool topo_is_tid = zdev->tid_avail;···356345357346 topo = topo_is_tid ? zdev->tid : zdev->pchid;358347 zbus = zpci_bus_get(topo, topo_is_tid);348348+ /*349349+ * An isolated VF gets its own domain/bus even if there exists350350+ * a matching domain/bus already351351+ */352352+ if (zbus && zpci_bus_is_isolated_vf(zbus, zdev)) {353353+ zpci_bus_put(zbus);354354+ zbus = NULL;355355+ }356356+359357 if (!zbus) {360358 zbus = zpci_bus_alloc(topo, topo_is_tid);361359 if (!zbus)
+42-14
arch/s390/pci/pci_iov.c
···6060 return 0;6161}62626363-int zpci_iov_setup_virtfn(struct zpci_bus *zbus, struct pci_dev *virtfn, int vfn)6363+/**6464+ * zpci_iov_find_parent_pf - Find the parent PF, if any, of the given function6565+ * @zbus: The bus that the PCI function is on, or would be added on6666+ * @zdev: The PCI function6767+ *6868+ * Finds the parent PF, if it exists and is configured, of the given PCI function6969+ * and increments its refcount. Th PF is searched for on the provided bus so the7070+ * caller has to ensure that this is the correct bus to search. This function may7171+ * be used before adding the PCI function to a zbus.7272+ *7373+ * Return: Pointer to the struct pci_dev of the parent PF or NULL if it not7474+ * found. If the function is not a VF or has no RequesterID information,7575+ * NULL is returned as well.7676+ */7777+struct pci_dev *zpci_iov_find_parent_pf(struct zpci_bus *zbus, struct zpci_dev *zdev)6478{6565- int i, cand_devfn;6666- struct zpci_dev *zdev;7979+ int i, vfid, devfn, cand_devfn;6780 struct pci_dev *pdev;6868- int vfid = vfn - 1; /* Linux' vfid's start at 0 vfn at 1*/6969- int rc = 0;70817182 if (!zbus->multifunction)7272- return 0;7373-7474- /* If the parent PF for the given VF is also configured in the8383+ return NULL;8484+ /* Non-VFs and VFs without RID available don't have a parent */8585+ if (!zdev->vfn || !zdev->rid_available)8686+ return NULL;8787+ /* Linux vfid starts at 0 vfn at 1 */8888+ vfid = zdev->vfn - 1;8989+ devfn = zdev->rid & ZPCI_RID_MASK_DEVFN;9090+ /*9191+ * If the parent PF for the given VF is also configured in the7592 * instance, it must be on the same zbus.7693 * We can then identify the parent PF by checking what7794 * devfn the VF would have if it belonged to that PF using the PF's···10285 if (!pdev)10386 continue;10487 cand_devfn = pci_iov_virtfn_devfn(pdev, vfid);105105- if (cand_devfn == virtfn->devfn) {106106- rc = zpci_iov_link_virtfn(pdev, virtfn, vfid);107107- /* balance pci_get_slot() */108108- pci_dev_put(pdev);109109- break;110110- }8888+ if (cand_devfn == devfn)8989+ return pdev;11190 /* balance pci_get_slot() */11291 pci_dev_put(pdev);11392 }9393+ }9494+ return NULL;9595+}9696+9797+int zpci_iov_setup_virtfn(struct zpci_bus *zbus, struct pci_dev *virtfn, int vfn)9898+{9999+ struct zpci_dev *zdev = to_zpci(virtfn);100100+ struct pci_dev *pdev_pf;101101+ int rc = 0;102102+103103+ pdev_pf = zpci_iov_find_parent_pf(zbus, zdev);104104+ if (pdev_pf) {105105+ /* Linux' vfids start at 0 while zdev->vfn starts at 1 */106106+ rc = zpci_iov_link_virtfn(pdev_pf, virtfn, zdev->vfn - 1);107107+ pci_dev_put(pdev_pf);114108 }115109 return rc;116110}
···181181182182static int stub_exe_fd;183183184184+#ifndef CLOSE_RANGE_CLOEXEC185185+#define CLOSE_RANGE_CLOEXEC (1U << 2)186186+#endif187187+184188static int userspace_tramp(void *stack)185189{186190 char *const argv[] = { "uml-userspace", NULL };···206202 init_data.stub_data_fd = phys_mapping(uml_to_phys(stack), &offset);207203 init_data.stub_data_offset = MMAP_OFFSET(offset);208204209209- /* Set CLOEXEC on all FDs and then unset on all memory related FDs */210210- close_range(0, ~0U, CLOSE_RANGE_CLOEXEC);205205+ /*206206+ * Avoid leaking unneeded FDs to the stub by setting CLOEXEC on all FDs207207+ * and then unsetting it on all memory related FDs.208208+ * This is not strictly necessary from a safety perspective.209209+ */210210+ syscall(__NR_close_range, 0, ~0U, CLOSE_RANGE_CLOEXEC);211211212212 fcntl(init_data.stub_data_fd, F_SETFD, 0);213213 for (iomem = iomem_regions; iomem; iomem = iomem->next)···232224 if (ret != sizeof(init_data))233225 exit(4);234226235235- execveat(stub_exe_fd, "", argv, NULL, AT_EMPTY_PATH);227227+ /* Raw execveat for compatibility with older libc versions */228228+ syscall(__NR_execveat, stub_exe_fd, (unsigned long)"",229229+ (unsigned long)argv, NULL, AT_EMPTY_PATH);236230237231 exit(5);238232}
+14-19
arch/x86/events/intel/core.c
···4905490549064906static void update_pmu_cap(struct x86_hybrid_pmu *pmu)49074907{49084908- unsigned int sub_bitmaps, eax, ebx, ecx, edx;49084908+ unsigned int cntr, fixed_cntr, ecx, edx;49094909+ union cpuid35_eax eax;49104910+ union cpuid35_ebx ebx;4909491149104910- cpuid(ARCH_PERFMON_EXT_LEAF, &sub_bitmaps, &ebx, &ecx, &edx);49124912+ cpuid(ARCH_PERFMON_EXT_LEAF, &eax.full, &ebx.full, &ecx, &edx);4911491349124912- if (ebx & ARCH_PERFMON_EXT_UMASK2)49144914+ if (ebx.split.umask2)49134915 pmu->config_mask |= ARCH_PERFMON_EVENTSEL_UMASK2;49144914- if (ebx & ARCH_PERFMON_EXT_EQ)49164916+ if (ebx.split.eq)49154917 pmu->config_mask |= ARCH_PERFMON_EVENTSEL_EQ;4916491849174917- if (sub_bitmaps & ARCH_PERFMON_NUM_COUNTER_LEAF_BIT) {49194919+ if (eax.split.cntr_subleaf) {49184920 cpuid_count(ARCH_PERFMON_EXT_LEAF, ARCH_PERFMON_NUM_COUNTER_LEAF,49194919- &eax, &ebx, &ecx, &edx);49204920- pmu->cntr_mask64 = eax;49214921- pmu->fixed_cntr_mask64 = ebx;49214921+ &cntr, &fixed_cntr, &ecx, &edx);49224922+ pmu->cntr_mask64 = cntr;49234923+ pmu->fixed_cntr_mask64 = fixed_cntr;49224924 }4923492549244926 if (!intel_pmu_broken_perf_cap()) {···49424940 pmu->intel_ctrl |= 1ULL << GLOBAL_CTRL_EN_PERF_METRICS;49434941 else49444942 pmu->intel_ctrl &= ~(1ULL << GLOBAL_CTRL_EN_PERF_METRICS);49454945-49464946- if (pmu->intel_cap.pebs_output_pt_available)49474947- pmu->pmu.capabilities |= PERF_PMU_CAP_AUX_OUTPUT;49484948- else49494949- pmu->pmu.capabilities &= ~PERF_PMU_CAP_AUX_OUTPUT;4950494349514944 intel_pmu_check_event_constraints(pmu->event_constraints,49524945 pmu->cntr_mask64,···5020502350215024 pr_info("%s PMU driver: ", pmu->name);5022502550235023- if (pmu->intel_cap.pebs_output_pt_available)50245024- pr_cont("PEBS-via-PT ");50255025-50265026 pr_cont("\n");5027502750285028 x86_pmu_show_pmu_cap(&pmu->pmu);···5042504850435049 init_debug_store_on_cpu(cpu);50445050 /*50455045- * Deal with CPUs that don't clear their LBRs on power-up.50515051+ * Deal with CPUs that don't clear their LBRs on power-up, and that may50525052+ * even boot with LBRs enabled.50465053 */50545054+ if (!static_cpu_has(X86_FEATURE_ARCH_LBR) && x86_pmu.lbr_nr)50555055+ msr_clear_bit(MSR_IA32_DEBUGCTLMSR, DEBUGCTLMSR_LBR_BIT);50475056 intel_pmu_lbr_reset();5048505750495058 cpuc->lbr_sel = NULL;···63676370 pmu->intel_cap.capabilities = x86_pmu.intel_cap.capabilities;63686371 if (pmu->pmu_type & hybrid_small_tiny) {63696372 pmu->intel_cap.perf_metrics = 0;63706370- pmu->intel_cap.pebs_output_pt_available = 1;63716373 pmu->mid_ack = true;63726374 } else if (pmu->pmu_type & hybrid_big) {63736375 pmu->intel_cap.perf_metrics = 1;63746374- pmu->intel_cap.pebs_output_pt_available = 0;63756376 pmu->late_ack = true;63766377 }63776378 }
+9-1
arch/x86/events/intel/ds.c
···25782578 }25792579 pr_cont("PEBS fmt4%c%s, ", pebs_type, pebs_qual);2580258025812581- if (!is_hybrid() && x86_pmu.intel_cap.pebs_output_pt_available) {25812581+ /*25822582+ * The PEBS-via-PT is not supported on hybrid platforms,25832583+ * because not all CPUs of a hybrid machine support it.25842584+ * The global x86_pmu.intel_cap, which only contains the25852585+ * common capabilities, is used to check the availability25862586+ * of the feature. The per-PMU pebs_output_pt_available25872587+ * in a hybrid machine should be ignored.25882588+ */25892589+ if (x86_pmu.intel_cap.pebs_output_pt_available) {25822590 pr_cont("PEBS-via-PT, ");25832591 x86_get_pmu(smp_processor_id())->capabilities |= PERF_PMU_CAP_AUX_OUTPUT;25842592 }
+4-8
arch/x86/events/rapl.c
···370370 unsigned int rapl_pmu_idx;371371 struct rapl_pmus *rapl_pmus;372372373373+ /* only look at RAPL events */374374+ if (event->attr.type != event->pmu->type)375375+ return -ENOENT;376376+373377 /* unsupported modes and filters */374378 if (event->attr.sample_period) /* no sampling */375379 return -EINVAL;···391387 rapl_pmus_scope = rapl_pmus->pmu.scope;392388393389 if (rapl_pmus_scope == PERF_PMU_SCOPE_PKG || rapl_pmus_scope == PERF_PMU_SCOPE_DIE) {394394- /* only look at RAPL package events */395395- if (event->attr.type != rapl_pmus_pkg->pmu.type)396396- return -ENOENT;397397-398390 cfg = array_index_nospec((long)cfg, NR_RAPL_PKG_DOMAINS + 1);399391 if (!cfg || cfg >= NR_RAPL_PKG_DOMAINS + 1)400392 return -EINVAL;···398398 bit = cfg - 1;399399 event->hw.event_base = rapl_model->rapl_pkg_msrs[bit].msr;400400 } else if (rapl_pmus_scope == PERF_PMU_SCOPE_CORE) {401401- /* only look at RAPL core events */402402- if (event->attr.type != rapl_pmus_core->pmu.type)403403- return -ENOENT;404404-405401 cfg = array_index_nospec((long)cfg, NR_RAPL_CORE_DOMAINS + 1);406402 if (!cfg || cfg >= NR_RAPL_PKG_DOMAINS + 1)407403 return -EINVAL;
···646646 u32 pause_count12;647647 u32 pause_thresh12;648648649649+ nested_svm_transition_tlb_flush(vcpu);650650+651651+ /* Enter Guest-Mode */652652+ enter_guest_mode(vcpu);653653+649654 /*650655 * Filled at exit: exit_code, exit_code_hi, exit_info_1, exit_info_2,651656 * exit_int_info, exit_int_info_err, next_rip, insn_len, insn_bytes.···766761 vmcb02->control.pause_filter_thresh = 0;767762 }768763 }769769-770770- nested_svm_transition_tlb_flush(vcpu);771771-772772- /* Enter Guest-Mode */773773- enter_guest_mode(vcpu);774764775765 /*776766 * Merge guest and host intercepts - must be called with vcpu in
+10
arch/x86/kvm/svm/sev.c
···29722972 WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_FLUSHBYASID)))29732973 goto out;2974297429752975+ /*29762976+ * The kernel's initcall infrastructure lacks the ability to express29772977+ * dependencies between initcalls, whereas the modules infrastructure29782978+ * automatically handles dependencies via symbol loading. Ensure the29792979+ * PSP SEV driver is initialized before proceeding if KVM is built-in,29802980+ * as the dependency isn't handled by the initcall infrastructure.29812981+ */29822982+ if (IS_BUILTIN(CONFIG_KVM_AMD) && sev_module_init())29832983+ goto out;29842984+29752985 /* Retrieve SEV CPUID information */29762986 cpuid(0x8000001f, &eax, &ebx, &ecx, &edx);29772987
+6-7
arch/x86/kvm/svm/svm.c
···19911991 svm->asid = sd->next_asid++;19921992}1993199319941994-static void svm_set_dr6(struct vcpu_svm *svm, unsigned long value)19941994+static void svm_set_dr6(struct kvm_vcpu *vcpu, unsigned long value)19951995{19961996- struct vmcb *vmcb = svm->vmcb;19961996+ struct vmcb *vmcb = to_svm(vcpu)->vmcb;1997199719981998- if (svm->vcpu.arch.guest_state_protected)19981998+ if (vcpu->arch.guest_state_protected)19991999 return;2000200020012001 if (unlikely(value != vmcb->save.dr6)) {···42474247 * Run with all-zero DR6 unless needed, so that we can get the exact cause42484248 * of a #DB.42494249 */42504250- if (unlikely(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT))42514251- svm_set_dr6(svm, vcpu->arch.dr6);42524252- else42534253- svm_set_dr6(svm, DR6_ACTIVE_LOW);42504250+ if (likely(!(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT)))42514251+ svm_set_dr6(vcpu, DR6_ACTIVE_LOW);4254425242554253 clgi();42564254 kvm_load_guest_xsave_state(vcpu);···50415043 .set_idt = svm_set_idt,50425044 .get_gdt = svm_get_gdt,50435045 .set_gdt = svm_set_gdt,50465046+ .set_dr6 = svm_set_dr6,50445047 .set_dr7 = svm_set_dr7,50455048 .sync_dirty_debug_regs = svm_sync_dirty_debug_regs,50465049 .cache_reg = svm_cache_reg,
···56485648 set_debugreg(DR6_RESERVED, 6);56495649}5650565056515651+void vmx_set_dr6(struct kvm_vcpu *vcpu, unsigned long val)56525652+{56535653+ lockdep_assert_irqs_disabled();56545654+ set_debugreg(vcpu->arch.dr6, 6);56555655+}56565656+56515657void vmx_set_dr7(struct kvm_vcpu *vcpu, unsigned long val)56525658{56535659 vmcs_writel(GUEST_DR7, val);···74227416 vmcs_writel(HOST_CR4, cr4);74237417 vmx->loaded_vmcs->host_state.cr4 = cr4;74247418 }74257425-74267426- /* When KVM_DEBUGREG_WONT_EXIT, dr6 is accessible in guest. */74277427- if (unlikely(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT))74287428- set_debugreg(vcpu->arch.dr6, 6);7429741974307420 /* When single-stepping over STI and MOV SS, we must clear the74317421 * corresponding interruptibility bits in the guest state. Otherwise
···1096110961 set_debugreg(vcpu->arch.eff_db[1], 1);1096210962 set_debugreg(vcpu->arch.eff_db[2], 2);1096310963 set_debugreg(vcpu->arch.eff_db[3], 3);1096410964+ /* When KVM_DEBUGREG_WONT_EXIT, dr6 is accessible in guest. */1096510965+ if (unlikely(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT))1096610966+ kvm_x86_call(set_dr6)(vcpu, vcpu->arch.dr6);1096410967 } else if (unlikely(hw_breakpoint_active())) {1096510968 set_debugreg(0, 7);1096610969 }
+18-3
arch/x86/um/os-Linux/registers.c
···1818#include <registers.h>1919#include <sys/mman.h>20202121+static unsigned long ptrace_regset;2122unsigned long host_fp_size;22232324int get_fp_registers(int pid, unsigned long *regs)···2827 .iov_len = host_fp_size,2928 };30293131- if (ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov) < 0)3030+ if (ptrace(PTRACE_GETREGSET, pid, ptrace_regset, &iov) < 0)3231 return -errno;3332 return 0;3433}···4039 .iov_len = host_fp_size,4140 };42414343- if (ptrace(PTRACE_SETREGSET, pid, NT_X86_XSTATE, &iov) < 0)4242+ if (ptrace(PTRACE_SETREGSET, pid, ptrace_regset, &iov) < 0)4443 return -errno;4544 return 0;4645}···5958 return -ENOMEM;60596160 /* GDB has x86_xsave_length, which uses x86_cpuid_count */6262- ret = ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov);6161+ ptrace_regset = NT_X86_XSTATE;6262+ ret = ptrace(PTRACE_GETREGSET, pid, ptrace_regset, &iov);6363 if (ret)6464 ret = -errno;6565+6666+ if (ret == -ENODEV) {6767+#ifdef CONFIG_X86_326868+ ptrace_regset = NT_PRXFPREG;6969+#else7070+ ptrace_regset = NT_PRFPREG;7171+#endif7272+ iov.iov_len = 2 * 1024 * 1024;7373+ ret = ptrace(PTRACE_GETREGSET, pid, ptrace_regset, &iov);7474+ if (ret)7575+ ret = -errno;7676+ }7777+6578 munmap(iov.iov_base, 2 * 1024 * 1024);66796780 host_fp_size = iov.iov_len;
+10-3
arch/x86/um/signal.c
···187187 * Put magic/size values for userspace. We do not bother to verify them188188 * later on, however, userspace needs them should it try to read the189189 * XSTATE data. And ptrace does not fill in these parts.190190+ *191191+ * Skip this if we do not have an XSTATE frame.190192 */193193+ if (host_fp_size <= sizeof(to_fp64->fpstate))194194+ return 0;195195+191196 BUILD_BUG_ON(sizeof(int) != FP_XSTATE_MAGIC2_SIZE);192197#ifdef CONFIG_X86_32193198 __put_user(offsetof(struct _fpstate_32, _fxsr_env) +···372367 int err = 0, sig = ksig->sig;373368 unsigned long fp_to;374369375375- frame = (struct rt_sigframe __user *)376376- round_down(stack_top - sizeof(struct rt_sigframe), 16);370370+ frame = (void __user *)stack_top - sizeof(struct rt_sigframe);377371378372 /* Add required space for math frame */379379- frame = (struct rt_sigframe __user *)((unsigned long)frame - math_size);373373+ frame = (void __user *)((unsigned long)frame - math_size);374374+375375+ /* ABI requires 16 byte boundary alignment */376376+ frame = (void __user *)round_down((unsigned long)frame, 16);380377381378 /* Subtract 128 for a red zone and 8 for proper alignment */382379 frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128 - 8);
+7-16
arch/x86/virt/svm/sev.c
···505505 * described in the SNP_INIT_EX firmware command description in the SNP506506 * firmware ABI spec.507507 */508508-static int __init snp_rmptable_init(void)508508+int __init snp_rmptable_init(void)509509{510510 unsigned int i;511511 u64 val;512512513513- if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP))514514- return 0;513513+ if (WARN_ON_ONCE(!cc_platform_has(CC_ATTR_HOST_SEV_SNP)))514514+ return -ENOSYS;515515516516- if (!amd_iommu_snp_en)517517- goto nosnp;516516+ if (WARN_ON_ONCE(!amd_iommu_snp_en))517517+ return -ENOSYS;518518519519 if (!setup_rmptable())520520- goto nosnp;520520+ return -ENOSYS;521521522522 /*523523 * Check if SEV-SNP is already enabled, this can happen in case of···530530 /* Zero out the RMP bookkeeping area */531531 if (!clear_rmptable_bookkeeping()) {532532 free_rmp_segment_table();533533- goto nosnp;533533+ return -ENOSYS;534534 }535535536536 /* Zero out the RMP entries */···562562 crash_kexec_post_notifiers = true;563563564564 return 0;565565-566566-nosnp:567567- cc_platform_clear(CC_ATTR_HOST_SEV_SNP);568568- return -ENOSYS;569565}570570-571571-/*572572- * This must be called after the IOMMU has been initialized.573573- */574574-device_initcall(snp_rmptable_init);575566576567static void set_rmp_segment_info(unsigned int segment_shift)577568{
+62-9
arch/x86/xen/mmu_pv.c
···111111 */112112static DEFINE_SPINLOCK(xen_reservation_lock);113113114114+/* Protected by xen_reservation_lock. */115115+#define MIN_CONTIG_ORDER 9 /* 2MB */116116+static unsigned int discontig_frames_order = MIN_CONTIG_ORDER;117117+static unsigned long discontig_frames_early[1UL << MIN_CONTIG_ORDER] __initdata;118118+static unsigned long *discontig_frames __refdata = discontig_frames_early;119119+static bool discontig_frames_dyn;120120+121121+static int alloc_discontig_frames(unsigned int order)122122+{123123+ unsigned long *new_array, *old_array;124124+ unsigned int old_order;125125+ unsigned long flags;126126+127127+ BUG_ON(order < MIN_CONTIG_ORDER);128128+ BUILD_BUG_ON(sizeof(discontig_frames_early) != PAGE_SIZE);129129+130130+ new_array = (unsigned long *)__get_free_pages(GFP_KERNEL,131131+ order - MIN_CONTIG_ORDER);132132+ if (!new_array)133133+ return -ENOMEM;134134+135135+ spin_lock_irqsave(&xen_reservation_lock, flags);136136+137137+ old_order = discontig_frames_order;138138+139139+ if (order > discontig_frames_order || !discontig_frames_dyn) {140140+ if (!discontig_frames_dyn)141141+ old_array = NULL;142142+ else143143+ old_array = discontig_frames;144144+145145+ discontig_frames = new_array;146146+ discontig_frames_order = order;147147+ discontig_frames_dyn = true;148148+ } else {149149+ old_array = new_array;150150+ }151151+152152+ spin_unlock_irqrestore(&xen_reservation_lock, flags);153153+154154+ free_pages((unsigned long)old_array, old_order - MIN_CONTIG_ORDER);155155+156156+ return 0;157157+}158158+114159/*115160 * Note about cr3 (pagetable base) values:116161 *···859814 SetPagePinned(virt_to_page(level3_user_vsyscall));860815#endif861816 xen_pgd_walk(&init_mm, xen_mark_pinned, FIXADDR_TOP);817817+818818+ if (alloc_discontig_frames(MIN_CONTIG_ORDER))819819+ BUG();862820}863821864822static void xen_unpin_page(struct mm_struct *mm, struct page *page,···22512203 memset(dummy_mapping, 0xff, PAGE_SIZE);22522204}2253220522542254-/* Protected by xen_reservation_lock. */22552255-#define MAX_CONTIG_ORDER 9 /* 2MB */22562256-static unsigned long discontig_frames[1<<MAX_CONTIG_ORDER];22572257-22582206#define VOID_PTE (mfn_pte(0, __pgprot(0)))22592207static void xen_zap_pfn_range(unsigned long vaddr, unsigned int order,22602208 unsigned long *in_frames,···23672323 unsigned int address_bits,23682324 dma_addr_t *dma_handle)23692325{23702370- unsigned long *in_frames = discontig_frames, out_frame;23262326+ unsigned long *in_frames, out_frame;23712327 unsigned long flags;23722328 int success;23732329 unsigned long vstart = (unsigned long)phys_to_virt(pstart);2374233023752375- if (unlikely(order > MAX_CONTIG_ORDER))23762376- return -ENOMEM;23312331+ if (unlikely(order > discontig_frames_order)) {23322332+ if (!discontig_frames_dyn)23332333+ return -ENOMEM;23342334+23352335+ if (alloc_discontig_frames(order))23362336+ return -ENOMEM;23372337+ }2377233823782339 memset((void *) vstart, 0, PAGE_SIZE << order);2379234023802341 spin_lock_irqsave(&xen_reservation_lock, flags);23422342+23432343+ in_frames = discontig_frames;2381234423822345 /* 1. Zap current PTEs, remembering MFNs. */23832346 xen_zap_pfn_range(vstart, order, in_frames, NULL);···2409235824102359void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order)24112360{24122412- unsigned long *out_frames = discontig_frames, in_frame;23612361+ unsigned long *out_frames, in_frame;24132362 unsigned long flags;24142363 int success;24152364 unsigned long vstart;2416236524172417- if (unlikely(order > MAX_CONTIG_ORDER))23662366+ if (unlikely(order > discontig_frames_order))24182367 return;2419236824202369 vstart = (unsigned long)phys_to_virt(pstart);24212370 memset((void *) vstart, 0, PAGE_SIZE << order);2422237124232372 spin_lock_irqsave(&xen_reservation_lock, flags);23732373+23742374+ out_frames = discontig_frames;2424237524252376 /* 1. Find start MFN of contiguous extent. */24262377 in_frame = virt_to_mfn((void *)vstart);
+15-3
block/partitions/mac.c
···5353 }5454 secsize = be16_to_cpu(md->block_size);5555 put_dev_sector(sect);5656+5757+ /*5858+ * If the "block size" is not a power of 2, things get weird - we might5959+ * end up with a partition straddling a sector boundary, so we wouldn't6060+ * be able to read a partition entry with read_part_sector().6161+ * Real block sizes are probably (?) powers of two, so just require6262+ * that.6363+ */6464+ if (!is_power_of_2(secsize))6565+ return -1;5666 datasize = round_down(secsize, 512);5767 data = read_part_sector(state, datasize / 512, §);5868 if (!data)5969 return -1;6070 partoffset = secsize % 512;6161- if (partoffset + sizeof(*part) > datasize)7171+ if (partoffset + sizeof(*part) > datasize) {7272+ put_dev_sector(sect);6273 return -1;7474+ }6375 part = (struct mac_partition *) (data + partoffset);6476 if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) {6577 put_dev_sector(sect);···124112 int i, l;125113126114 goodness++;127127- l = strlen(part->name);128128- if (strcmp(part->name, "/") == 0)115115+ l = strnlen(part->name, sizeof(part->name));116116+ if (strncmp(part->name, "/", sizeof(part->name)) == 0)129117 goodness++;130118 for (i = 0; i <= l - 4; ++i) {131119 if (strncasecmp(part->name + i, "root",
···11+// SPDX-License-Identifier: GPL-2.0-only22+/*33+ * Copyright (c) 2025 Greg Kroah-Hartman <gregkh@linuxfoundation.org>44+ * Copyright (c) 2025 The Linux Foundation55+ *66+ * A "simple" faux bus that allows devices to be created and added77+ * automatically to it. This is to be used whenever you need to create a88+ * device that is not associated with any "real" system resources, and do99+ * not want to have to deal with a bus/driver binding logic. It is1010+ * intended to be very simple, with only a create and a destroy function1111+ * available.1212+ */1313+#include <linux/err.h>1414+#include <linux/init.h>1515+#include <linux/slab.h>1616+#include <linux/string.h>1717+#include <linux/container_of.h>1818+#include <linux/device/faux.h>1919+#include "base.h"2020+2121+/*2222+ * Internal wrapper structure so we can hold a pointer to the2323+ * faux_device_ops for this device.2424+ */2525+struct faux_object {2626+ struct faux_device faux_dev;2727+ const struct faux_device_ops *faux_ops;2828+};2929+#define to_faux_object(dev) container_of_const(dev, struct faux_object, faux_dev.dev)3030+3131+static struct device faux_bus_root = {3232+ .init_name = "faux",3333+};3434+3535+static int faux_match(struct device *dev, const struct device_driver *drv)3636+{3737+ /* Match always succeeds, we only have one driver */3838+ return 1;3939+}4040+4141+static int faux_probe(struct device *dev)4242+{4343+ struct faux_object *faux_obj = to_faux_object(dev);4444+ struct faux_device *faux_dev = &faux_obj->faux_dev;4545+ const struct faux_device_ops *faux_ops = faux_obj->faux_ops;4646+ int ret = 0;4747+4848+ if (faux_ops && faux_ops->probe)4949+ ret = faux_ops->probe(faux_dev);5050+5151+ return ret;5252+}5353+5454+static void faux_remove(struct device *dev)5555+{5656+ struct faux_object *faux_obj = to_faux_object(dev);5757+ struct faux_device *faux_dev = &faux_obj->faux_dev;5858+ const struct faux_device_ops *faux_ops = faux_obj->faux_ops;5959+6060+ if (faux_ops && faux_ops->remove)6161+ faux_ops->remove(faux_dev);6262+}6363+6464+static const struct bus_type faux_bus_type = {6565+ .name = "faux",6666+ .match = faux_match,6767+ .probe = faux_probe,6868+ .remove = faux_remove,6969+};7070+7171+static struct device_driver faux_driver = {7272+ .name = "faux_driver",7373+ .bus = &faux_bus_type,7474+ .probe_type = PROBE_FORCE_SYNCHRONOUS,7575+};7676+7777+static void faux_device_release(struct device *dev)7878+{7979+ struct faux_object *faux_obj = to_faux_object(dev);8080+8181+ kfree(faux_obj);8282+}8383+8484+/**8585+ * faux_device_create_with_groups - Create and register with the driver8686+ * core a faux device and populate the device with an initial8787+ * set of sysfs attributes.8888+ * @name: The name of the device we are adding, must be unique for8989+ * all faux devices.9090+ * @parent: Pointer to a potential parent struct device. If set to9191+ * NULL, the device will be created in the "root" of the faux9292+ * device tree in sysfs.9393+ * @faux_ops: struct faux_device_ops that the new device will call back9494+ * into, can be NULL.9595+ * @groups: The set of sysfs attributes that will be created for this9696+ * device when it is registered with the driver core.9797+ *9898+ * Create a new faux device and register it in the driver core properly.9999+ * If present, callbacks in @faux_ops will be called with the device that100100+ * for the caller to do something with at the proper time given the101101+ * device's lifecycle.102102+ *103103+ * Note, when this function is called, the functions specified in struct104104+ * faux_ops can be called before the function returns, so be prepared for105105+ * everything to be properly initialized before that point in time.106106+ *107107+ * Return:108108+ * * NULL if an error happened with creating the device109109+ * * pointer to a valid struct faux_device that is registered with sysfs110110+ */111111+struct faux_device *faux_device_create_with_groups(const char *name,112112+ struct device *parent,113113+ const struct faux_device_ops *faux_ops,114114+ const struct attribute_group **groups)115115+{116116+ struct faux_object *faux_obj;117117+ struct faux_device *faux_dev;118118+ struct device *dev;119119+ int ret;120120+121121+ faux_obj = kzalloc(sizeof(*faux_obj), GFP_KERNEL);122122+ if (!faux_obj)123123+ return NULL;124124+125125+ /* Save off the callbacks so we can use them in the future */126126+ faux_obj->faux_ops = faux_ops;127127+128128+ /* Initialize the device portion and register it with the driver core */129129+ faux_dev = &faux_obj->faux_dev;130130+ dev = &faux_dev->dev;131131+132132+ device_initialize(dev);133133+ dev->release = faux_device_release;134134+ if (parent)135135+ dev->parent = parent;136136+ else137137+ dev->parent = &faux_bus_root;138138+ dev->bus = &faux_bus_type;139139+ dev->groups = groups;140140+ dev_set_name(dev, "%s", name);141141+142142+ ret = device_add(dev);143143+ if (ret) {144144+ pr_err("%s: device_add for faux device '%s' failed with %d\n",145145+ __func__, name, ret);146146+ put_device(dev);147147+ return NULL;148148+ }149149+150150+ return faux_dev;151151+}152152+EXPORT_SYMBOL_GPL(faux_device_create_with_groups);153153+154154+/**155155+ * faux_device_create - create and register with the driver core a faux device156156+ * @name: The name of the device we are adding, must be unique for all157157+ * faux devices.158158+ * @parent: Pointer to a potential parent struct device. If set to159159+ * NULL, the device will be created in the "root" of the faux160160+ * device tree in sysfs.161161+ * @faux_ops: struct faux_device_ops that the new device will call back162162+ * into, can be NULL.163163+ *164164+ * Create a new faux device and register it in the driver core properly.165165+ * If present, callbacks in @faux_ops will be called with the device that166166+ * for the caller to do something with at the proper time given the167167+ * device's lifecycle.168168+ *169169+ * Note, when this function is called, the functions specified in struct170170+ * faux_ops can be called before the function returns, so be prepared for171171+ * everything to be properly initialized before that point in time.172172+ *173173+ * Return:174174+ * * NULL if an error happened with creating the device175175+ * * pointer to a valid struct faux_device that is registered with sysfs176176+ */177177+struct faux_device *faux_device_create(const char *name,178178+ struct device *parent,179179+ const struct faux_device_ops *faux_ops)180180+{181181+ return faux_device_create_with_groups(name, parent, faux_ops, NULL);182182+}183183+EXPORT_SYMBOL_GPL(faux_device_create);184184+185185+/**186186+ * faux_device_destroy - destroy a faux device187187+ * @faux_dev: faux device to destroy188188+ *189189+ * Unregisters and cleans up a device that was created with a call to190190+ * faux_device_create()191191+ */192192+void faux_device_destroy(struct faux_device *faux_dev)193193+{194194+ struct device *dev = &faux_dev->dev;195195+196196+ if (!faux_dev)197197+ return;198198+199199+ device_del(dev);200200+201201+ /* The final put_device() will clean up the memory we allocated for this device. */202202+ put_device(dev);203203+}204204+EXPORT_SYMBOL_GPL(faux_device_destroy);205205+206206+int __init faux_bus_init(void)207207+{208208+ int ret;209209+210210+ ret = device_register(&faux_bus_root);211211+ if (ret) {212212+ put_device(&faux_bus_root);213213+ return ret;214214+ }215215+216216+ ret = bus_register(&faux_bus_type);217217+ if (ret)218218+ goto error_bus;219219+220220+ ret = driver_register(&faux_driver);221221+ if (ret)222222+ goto error_driver;223223+224224+ return ret;225225+226226+error_driver:227227+ bus_unregister(&faux_bus_type);228228+229229+error_bus:230230+ device_unregister(&faux_bus_root);231231+ return ret;232232+}
+1
drivers/base/init.c
···3232 /* These are also core pieces, but must come after the3333 * core core pieces.3434 */3535+ faux_bus_init();3536 of_core_init();3637 platform_bus_init();3738 auxiliary_bus_init();
+2
drivers/base/regmap/regmap-irq.c
···906906 kfree(d->wake_buf);907907 kfree(d->mask_buf_def);908908 kfree(d->mask_buf);909909+ kfree(d->main_status_buf);909910 kfree(d->status_buf);910911 kfree(d->status_reg_buf);911912 if (d->config_buf) {···982981 kfree(d->wake_buf);983982 kfree(d->mask_buf_def);984983 kfree(d->mask_buf);984984+ kfree(d->main_status_buf);985985 kfree(d->status_reg_buf);986986 kfree(d->status_buf);987987 if (d->config_buf) {
+14
drivers/crypto/ccp/sp-dev.c
···1919#include <linux/types.h>2020#include <linux/ccp.h>21212222+#include "sev-dev.h"2223#include "ccp-dev.h"2324#include "sp-dev.h"2425···254253static int __init sp_mod_init(void)255254{256255#ifdef CONFIG_X86256256+ static bool initialized;257257 int ret;258258+259259+ if (initialized)260260+ return 0;258261259262 ret = sp_pci_init();260263 if (ret)···267262#ifdef CONFIG_CRYPTO_DEV_SP_PSP268263 psp_pci_init();269264#endif265265+266266+ initialized = true;270267271268 return 0;272269#endif···285278286279 return -ENODEV;287280}281281+282282+#if IS_BUILTIN(CONFIG_KVM_AMD) && IS_ENABLED(CONFIG_KVM_AMD_SEV)283283+int __init sev_module_init(void)284284+{285285+ return sp_mod_init();286286+}287287+#endif288288289289static void __exit sp_mod_exit(void)290290{
+14-3
drivers/dma/tegra210-adma.c
···887887 const struct tegra_adma_chip_data *cdata;888888 struct tegra_adma *tdma;889889 struct resource *res_page, *res_base;890890- int ret, i, page_no;890890+ int ret, i;891891892892 cdata = of_device_get_match_data(&pdev->dev);893893 if (!cdata) {···914914915915 res_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "global");916916 if (res_base) {917917- page_no = (res_page->start - res_base->start) / cdata->ch_base_offset;918918- if (page_no <= 0)917917+ resource_size_t page_offset, page_no;918918+ unsigned int ch_base_offset;919919+920920+ if (res_page->start < res_base->start)919921 return -EINVAL;922922+ page_offset = res_page->start - res_base->start;923923+ ch_base_offset = cdata->ch_base_offset;924924+ if (!ch_base_offset)925925+ return -EINVAL;926926+927927+ page_no = div_u64(page_offset, ch_base_offset);928928+ if (!page_no || page_no > INT_MAX)929929+ return -EINVAL;930930+920931 tdma->ch_page_no = page_no - 1;921932 tdma->base_addr = devm_ioremap_resource(&pdev->dev, res_base);922933 if (IS_ERR(tdma->base_addr))
···2525 if (md->type != EFI_CONVENTIONAL_MEMORY)2626 return 0;27272828+ if (md->attribute & EFI_MEMORY_HOT_PLUGGABLE)2929+ return 0;3030+2831 if (efi_soft_reserve_enabled() &&2932 (md->attribute & EFI_MEMORY_SP))3033 return 0;
+3
drivers/firmware/efi/libstub/relocate.c
···5353 if (desc->type != EFI_CONVENTIONAL_MEMORY)5454 continue;55555656+ if (desc->attribute & EFI_MEMORY_HOT_PLUGGABLE)5757+ continue;5858+5659 if (efi_soft_reserve_enabled() &&5760 (desc->attribute & EFI_MEMORY_SP))5861 continue;
+58-13
drivers/gpio/gpio-bcm-kona.c
···6969struct bcm_kona_gpio_bank {7070 int id;7171 int irq;7272+ /*7373+ * Used to keep track of lock/unlock operations for each GPIO in the7474+ * bank.7575+ *7676+ * All GPIOs are locked by default (see bcm_kona_gpio_reset), and the7777+ * unlock count for all GPIOs is 0 by default. Each unlock increments7878+ * the counter, and each lock decrements the counter.7979+ *8080+ * The lock function only locks the GPIO once its unlock counter is8181+ * down to 0. This is necessary because the GPIO is unlocked in two8282+ * places in this driver: once for requested GPIOs, and once for8383+ * requested IRQs. Since it is possible for a GPIO to be requested8484+ * as both a GPIO and an IRQ, we need to ensure that we don't lock it8585+ * too early.8686+ */8787+ u8 gpio_unlock_count[GPIO_PER_BANK];7288 /* Used in the interrupt handler */7389 struct bcm_kona_gpio *kona_gpio;7490};···10286 u32 val;10387 unsigned long flags;10488 int bank_id = GPIO_BANK(gpio);8989+ int bit = GPIO_BIT(gpio);9090+ struct bcm_kona_gpio_bank *bank = &kona_gpio->banks[bank_id];10591106106- raw_spin_lock_irqsave(&kona_gpio->lock, flags);9292+ if (bank->gpio_unlock_count[bit] == 0) {9393+ dev_err(kona_gpio->gpio_chip.parent,9494+ "Unbalanced locks for GPIO %u\n", gpio);9595+ return;9696+ }10797108108- val = readl(kona_gpio->reg_base + GPIO_PWD_STATUS(bank_id));109109- val |= BIT(gpio);110110- bcm_kona_gpio_write_lock_regs(kona_gpio->reg_base, bank_id, val);9898+ if (--bank->gpio_unlock_count[bit] == 0) {9999+ raw_spin_lock_irqsave(&kona_gpio->lock, flags);111100112112- raw_spin_unlock_irqrestore(&kona_gpio->lock, flags);101101+ val = readl(kona_gpio->reg_base + GPIO_PWD_STATUS(bank_id));102102+ val |= BIT(bit);103103+ bcm_kona_gpio_write_lock_regs(kona_gpio->reg_base, bank_id, val);104104+105105+ raw_spin_unlock_irqrestore(&kona_gpio->lock, flags);106106+ }113107}114108115109static void bcm_kona_gpio_unlock_gpio(struct bcm_kona_gpio *kona_gpio,···128102 u32 val;129103 unsigned long flags;130104 int bank_id = GPIO_BANK(gpio);105105+ int bit = GPIO_BIT(gpio);106106+ struct bcm_kona_gpio_bank *bank = &kona_gpio->banks[bank_id];131107132132- raw_spin_lock_irqsave(&kona_gpio->lock, flags);108108+ if (bank->gpio_unlock_count[bit] == 0) {109109+ raw_spin_lock_irqsave(&kona_gpio->lock, flags);133110134134- val = readl(kona_gpio->reg_base + GPIO_PWD_STATUS(bank_id));135135- val &= ~BIT(gpio);136136- bcm_kona_gpio_write_lock_regs(kona_gpio->reg_base, bank_id, val);111111+ val = readl(kona_gpio->reg_base + GPIO_PWD_STATUS(bank_id));112112+ val &= ~BIT(bit);113113+ bcm_kona_gpio_write_lock_regs(kona_gpio->reg_base, bank_id, val);137114138138- raw_spin_unlock_irqrestore(&kona_gpio->lock, flags);115115+ raw_spin_unlock_irqrestore(&kona_gpio->lock, flags);116116+ }117117+118118+ ++bank->gpio_unlock_count[bit];139119}140120141121static int bcm_kona_gpio_get_dir(struct gpio_chip *chip, unsigned gpio)···392360393361 kona_gpio = irq_data_get_irq_chip_data(d);394362 reg_base = kona_gpio->reg_base;363363+395364 raw_spin_lock_irqsave(&kona_gpio->lock, flags);396365397366 val = readl(reg_base + GPIO_INT_MASK(bank_id));···415382416383 kona_gpio = irq_data_get_irq_chip_data(d);417384 reg_base = kona_gpio->reg_base;385385+418386 raw_spin_lock_irqsave(&kona_gpio->lock, flags);419387420388 val = readl(reg_base + GPIO_INT_MSKCLR(bank_id));···511477static int bcm_kona_gpio_irq_reqres(struct irq_data *d)512478{513479 struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d);480480+ unsigned int gpio = d->hwirq;514481515515- return gpiochip_reqres_irq(&kona_gpio->gpio_chip, d->hwirq);482482+ /*483483+ * We need to unlock the GPIO before any other operations are performed484484+ * on the relevant GPIO configuration registers485485+ */486486+ bcm_kona_gpio_unlock_gpio(kona_gpio, gpio);487487+488488+ return gpiochip_reqres_irq(&kona_gpio->gpio_chip, gpio);516489}517490518491static void bcm_kona_gpio_irq_relres(struct irq_data *d)519492{520493 struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d);494494+ unsigned int gpio = d->hwirq;521495522522- gpiochip_relres_irq(&kona_gpio->gpio_chip, d->hwirq);496496+ /* Once we no longer use it, lock the GPIO again */497497+ bcm_kona_gpio_lock_gpio(kona_gpio, gpio);498498+499499+ gpiochip_relres_irq(&kona_gpio->gpio_chip, gpio);523500}524501525502static struct irq_chip bcm_gpio_irq_chip = {···659614 bank->irq = platform_get_irq(pdev, i);660615 bank->kona_gpio = kona_gpio;661616 if (bank->irq < 0) {662662- dev_err(dev, "Couldn't get IRQ for bank %d", i);617617+ dev_err(dev, "Couldn't get IRQ for bank %d\n", i);663618 ret = -ENOENT;664619 goto err_irq_domain;665620 }
+12-3
drivers/gpio/gpio-stmpe.c
···191191 [REG_IE][CSB] = STMPE_IDX_IEGPIOR_CSB,192192 [REG_IE][MSB] = STMPE_IDX_IEGPIOR_MSB,193193 };194194- int i, j;194194+ int ret, i, j;195195196196 /*197197 * STMPE1600: to be able to get IRQ from pins,···199199 * GPSR or GPCR registers200200 */201201 if (stmpe->partnum == STMPE1600) {202202- stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB]);203203- stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB]);202202+ ret = stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB]);203203+ if (ret < 0) {204204+ dev_err(stmpe->dev, "Failed to read GPMR_LSB: %d\n", ret);205205+ goto err;206206+ }207207+ ret = stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB]);208208+ if (ret < 0) {209209+ dev_err(stmpe->dev, "Failed to read GPMR_CSB: %d\n", ret);210210+ goto err;211211+ }204212 }205213206214 for (i = 0; i < CACHE_NR_REGS; i++) {···230222 }231223 }232224225225+err:233226 mutex_unlock(&stmpe_gpio->irq_lock);234227}235228
···904904 }905905906906 if (gc->ngpio == 0) {907907- chip_err(gc, "tried to insert a GPIO chip with zero lines\n");907907+ dev_err(dev, "tried to insert a GPIO chip with zero lines\n");908908 return -EINVAL;909909 }910910911911 if (gc->ngpio > FASTPATH_NGPIO)912912- chip_warn(gc, "line cnt %u is greater than fast path cnt %u\n",913913- gc->ngpio, FASTPATH_NGPIO);912912+ dev_warn(dev, "line cnt %u is greater than fast path cnt %u\n",913913+ gc->ngpio, FASTPATH_NGPIO);914914915915 return 0;916916}
···38153815 if (err == -ENODEV) {38163816 dev_warn(adev->dev, "cap microcode does not exist, skip\n");38173817 err = 0;38183818- goto out;38183818+ } else {38193819+ dev_err(adev->dev, "fail to initialize cap microcode\n");38193820 }38203820- dev_err(adev->dev, "fail to initialize cap microcode\n");38213821+ goto out;38213822 }3822382338233824 info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CAP];
+34-2
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
···74377437 amdgpu_ring_write(ring, 0); /* RESERVED field, programmed to zero */74387438}7439743974407440+static void gfx_v9_0_ring_begin_use_compute(struct amdgpu_ring *ring)74417441+{74427442+ struct amdgpu_device *adev = ring->adev;74437443+ struct amdgpu_ip_block *gfx_block =74447444+ amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_GFX);74457445+74467446+ amdgpu_gfx_enforce_isolation_ring_begin_use(ring);74477447+74487448+ /* Raven and PCO APUs seem to have stability issues74497449+ * with compute and gfxoff and gfx pg. Disable gfx pg during74507450+ * submission and allow again afterwards.74517451+ */74527452+ if (gfx_block && amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 1, 0))74537453+ gfx_v9_0_set_powergating_state(gfx_block, AMD_PG_STATE_UNGATE);74547454+}74557455+74567456+static void gfx_v9_0_ring_end_use_compute(struct amdgpu_ring *ring)74577457+{74587458+ struct amdgpu_device *adev = ring->adev;74597459+ struct amdgpu_ip_block *gfx_block =74607460+ amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_GFX);74617461+74627462+ /* Raven and PCO APUs seem to have stability issues74637463+ * with compute and gfxoff and gfx pg. Disable gfx pg during74647464+ * submission and allow again afterwards.74657465+ */74667466+ if (gfx_block && amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 1, 0))74677467+ gfx_v9_0_set_powergating_state(gfx_block, AMD_PG_STATE_GATE);74687468+74697469+ amdgpu_gfx_enforce_isolation_ring_end_use(ring);74707470+}74717471+74407472static const struct amd_ip_funcs gfx_v9_0_ip_funcs = {74417473 .name = "gfx_v9_0",74427474 .early_init = gfx_v9_0_early_init,···76457613 .emit_wave_limit = gfx_v9_0_emit_wave_limit,76467614 .reset = gfx_v9_0_reset_kcq,76477615 .emit_cleaner_shader = gfx_v9_0_ring_emit_cleaner_shader,76487648- .begin_use = amdgpu_gfx_enforce_isolation_ring_begin_use,76497649- .end_use = amdgpu_gfx_enforce_isolation_ring_end_use,76167616+ .begin_use = gfx_v9_0_ring_begin_use_compute,76177617+ .end_use = gfx_v9_0_ring_end_use_compute,76507618};7651761976527620static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_kiq = {
···10491049 s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution1050105010511051L_END_PGM:10521052+ // Make sure that no wave of the workgroup can exit the trap handler10531053+ // before the workgroup barrier state is saved.10541054+ s_barrier_signal -210551055+ s_barrier_wait -210521056 s_endpgm_saved10531057end10541058
···168168 return PTR_ERR(ppgtt);169169170170 if (!ppgtt->vm.allocate_va_range)171171- goto err_ppgtt_cleanup;171171+ goto ppgtt_vm_put;172172173173 /*174174 * While we only allocate the page tables here and so we could···236236 goto retry;237237 }238238 i915_gem_ww_ctx_fini(&ww);239239-239239+ppgtt_vm_put:240240 i915_vm_put(&ppgtt->vm);241241 return err;242242}
+1
drivers/gpu/drm/panthor/panthor_drv.c
···802802{803803 int prio;804804805805+ memset(arg, 0, sizeof(*arg));805806 for (prio = PANTHOR_GROUP_PRIORITY_REALTIME; prio >= 0; prio--) {806807 if (!group_priority_permit(file, prio))807808 arg->allowed_mask |= BIT(prio);
···5757 return GRAPHICS_VERx100(xe) < 1270 && !IS_DGFX(xe);5858}59596060-static s64 detect_bar2_dgfx(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)6161-{6262- struct xe_tile *tile = xe_device_get_root_tile(xe);6363- struct xe_mmio *mmio = xe_root_tile_mmio(xe);6464- struct pci_dev *pdev = to_pci_dev(xe->drm.dev);6565- u64 stolen_size;6666- u64 tile_offset;6767- u64 tile_size;6868-6969- tile_offset = tile->mem.vram.io_start - xe->mem.vram.io_start;7070- tile_size = tile->mem.vram.actual_physical_size;7171-7272- /* Use DSM base address instead for stolen memory */7373- mgr->stolen_base = (xe_mmio_read64_2x32(mmio, DSMBASE) & BDSM_MASK) - tile_offset;7474- if (drm_WARN_ON(&xe->drm, tile_size < mgr->stolen_base))7575- return 0;7676-7777- stolen_size = tile_size - mgr->stolen_base;7878-7979- /* Verify usage fits in the actual resource available */8080- if (mgr->stolen_base + stolen_size <= pci_resource_len(pdev, LMEM_BAR))8181- mgr->io_base = tile->mem.vram.io_start + mgr->stolen_base;8282-8383- /*8484- * There may be few KB of platform dependent reserved memory at the end8585- * of vram which is not part of the DSM. Such reserved memory portion is8686- * always less then DSM granularity so align down the stolen_size to DSM8787- * granularity to accommodate such reserve vram portion.8888- */8989- return ALIGN_DOWN(stolen_size, SZ_1M);9090-}9191-9260static u32 get_wopcm_size(struct xe_device *xe)9361{9462 u32 wopcm_size;···78110 }7911180112 return wopcm_size;113113+}114114+115115+static s64 detect_bar2_dgfx(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)116116+{117117+ struct xe_tile *tile = xe_device_get_root_tile(xe);118118+ struct xe_mmio *mmio = xe_root_tile_mmio(xe);119119+ struct pci_dev *pdev = to_pci_dev(xe->drm.dev);120120+ u64 stolen_size, wopcm_size;121121+ u64 tile_offset;122122+ u64 tile_size;123123+124124+ tile_offset = tile->mem.vram.io_start - xe->mem.vram.io_start;125125+ tile_size = tile->mem.vram.actual_physical_size;126126+127127+ /* Use DSM base address instead for stolen memory */128128+ mgr->stolen_base = (xe_mmio_read64_2x32(mmio, DSMBASE) & BDSM_MASK) - tile_offset;129129+ if (drm_WARN_ON(&xe->drm, tile_size < mgr->stolen_base))130130+ return 0;131131+132132+ /* Carve out the top of DSM as it contains the reserved WOPCM region */133133+ wopcm_size = get_wopcm_size(xe);134134+ if (drm_WARN_ON(&xe->drm, !wopcm_size))135135+ return 0;136136+137137+ stolen_size = tile_size - mgr->stolen_base;138138+ stolen_size -= wopcm_size;139139+140140+ /* Verify usage fits in the actual resource available */141141+ if (mgr->stolen_base + stolen_size <= pci_resource_len(pdev, LMEM_BAR))142142+ mgr->io_base = tile->mem.vram.io_start + mgr->stolen_base;143143+144144+ /*145145+ * There may be few KB of platform dependent reserved memory at the end146146+ * of vram which is not part of the DSM. Such reserved memory portion is147147+ * always less then DSM granularity so align down the stolen_size to DSM148148+ * granularity to accommodate such reserve vram portion.149149+ */150150+ return ALIGN_DOWN(stolen_size, SZ_1M);81151}8215283153static u32 detect_bar2_integrated(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)
···104104 unsigned int id;105105 int i, err;106106107107- mutex_init(&host->intr_mutex);108108-109107 for (id = 0; id < host1x_syncpt_nb_pts(host); ++id) {110108 struct host1x_syncpt *syncpt = &host->syncpt[id];111109
···2653265326542654 /* Set IOTLB invalidation timeout to 1s */26552655 iommu_set_inv_tlb_timeout(iommu, CTRL_INV_TO_1S);26562656+26572657+ /* Enable Enhanced Peripheral Page Request Handling */26582658+ if (check_feature(FEATURE_EPHSUP))26592659+ iommu_feature_enable(iommu, CONTROL_EPH_EN);26562660}2657266126582662static void iommu_apply_resume_quirks(struct amd_iommu *iommu)···31983194 return true;31993195}3200319632013201-static void iommu_snp_enable(void)31973197+static __init void iommu_snp_enable(void)32023198{32033199#ifdef CONFIG_KVM_AMD_SEV32043200 if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP))···32203216 amd_iommu_snp_en = check_feature(FEATURE_SNP);32213217 if (!amd_iommu_snp_en) {32223218 pr_warn("SNP: IOMMU SNP feature not enabled, SNP cannot be supported.\n");32193219+ goto disable_snp;32203220+ }32213221+32223222+ /*32233223+ * Enable host SNP support once SNP support is checked on IOMMU.32243224+ */32253225+ if (snp_rmptable_init()) {32263226+ pr_warn("SNP: RMP initialization failed, SNP cannot be supported.\n");32233227 goto disable_snp;32243228 }32253229···33293317 break;33303318 ret = state_next();33313319 }33203320+33213321+ /*33223322+ * SNP platform initilazation requires IOMMUs to be fully configured.33233323+ * If the SNP support on IOMMUs has NOT been checked, simply mark SNP33243324+ * as unsupported. If the SNP support on IOMMUs has been checked and33253325+ * host SNP support enabled but RMP enforcement has not been enabled33263326+ * in IOMMUs, then the system is in a half-baked state, but can limp33273327+ * along as all memory should be Hypervisor-Owned in the RMP. WARN,33283328+ * but leave SNP as "supported" to avoid confusing the kernel.33293329+ */33303330+ if (ret && cc_platform_has(CC_ATTR_HOST_SEV_SNP) &&33313331+ !WARN_ON_ONCE(amd_iommu_snp_en))33323332+ cc_platform_clear(CC_ATTR_HOST_SEV_SNP);3332333333333334 return ret;33343335}···34513426 int ret;3452342734533428 if (no_iommu || (iommu_detected && !gart_iommu_aperture))34543454- return;34293429+ goto disable_snp;3455343034563431 if (!amd_iommu_sme_check())34573457- return;34323432+ goto disable_snp;3458343334593434 ret = iommu_go_to_state(IOMMU_IVRS_DETECTED);34603435 if (ret)34613461- return;34363436+ goto disable_snp;3462343734633438 amd_iommu_detected = true;34643439 iommu_detected = 1;34653440 x86_init.iommu.iommu_init = amd_iommu_init;34413441+ return;34423442+34433443+disable_snp:34443444+ if (cc_platform_has(CC_ATTR_HOST_SEV_SNP))34453445+ cc_platform_clear(CC_ATTR_HOST_SEV_SNP);34663446}3467344734683448/****************************************************************************
+3-3
drivers/iommu/exynos-iommu.c
···249249 struct list_head clients; /* list of sysmmu_drvdata.domain_node */250250 sysmmu_pte_t *pgtable; /* lv1 page table, 16KB */251251 short *lv2entcnt; /* free lv2 entry counter for each section */252252- spinlock_t lock; /* lock for modyfying list of clients */252252+ spinlock_t lock; /* lock for modifying list of clients */253253 spinlock_t pgtablelock; /* lock for modifying page table @ pgtable */254254 struct iommu_domain domain; /* generic domain data structure */255255};···292292 struct clk *aclk; /* SYSMMU's aclk clock */293293 struct clk *pclk; /* SYSMMU's pclk clock */294294 struct clk *clk_master; /* master's device clock */295295- spinlock_t lock; /* lock for modyfying state */295295+ spinlock_t lock; /* lock for modifying state */296296 bool active; /* current status */297297 struct exynos_iommu_domain *domain; /* domain we belong to */298298 struct list_head domain_node; /* node for domain clients list */···746746 ret = devm_request_irq(dev, irq, exynos_sysmmu_irq, 0,747747 dev_name(dev), data);748748 if (ret) {749749- dev_err(dev, "Unabled to register handler of irq %d\n", irq);749749+ dev_err(dev, "Unable to register handler of irq %d\n", irq);750750 return ret;751751 }752752
···17561756 group->id);1757175717581758 /*17591759- * Try to recover, drivers are allowed to force IDENITY or DMA, IDENTITY17591759+ * Try to recover, drivers are allowed to force IDENTITY or DMA, IDENTITY17601760 * takes precedence.17611761 */17621762 if (type == IOMMU_DOMAIN_IDENTITY)
···19021902{19031903 struct geneve_net *gn = net_generic(net, geneve_net_id);19041904 struct geneve_dev *geneve, *next;19051905- struct net_device *dev, *aux;1906190519071907- /* gather any geneve devices that were moved into this ns */19081908- for_each_netdev_safe(net, dev, aux)19091909- if (dev->rtnl_link_ops == &geneve_link_ops)19101910- unregister_netdevice_queue(dev, head);19111911-19121912- /* now gather any other geneve devices that were created in this ns */19131913- list_for_each_entry_safe(geneve, next, &gn->geneve_list, next) {19141914- /* If geneve->dev is in the same netns, it was already added19151915- * to the list by the previous loop.19161916- */19171917- if (!net_eq(dev_net(geneve->dev), net))19181918- unregister_netdevice_queue(geneve->dev, head);19191919- }19061906+ list_for_each_entry_safe(geneve, next, &gn->geneve_list, next)19071907+ geneve_dellink(geneve->dev, head);19201908}1921190919221910static void __net_exit geneve_exit_batch_rtnl(struct list_head *net_list,
···57745774 goto clean;57755775 }5776577657775777- if (config->init_data) {57785778- /*57795779- * Providing of_match means the framework is expected to parse57805780- * DT to get the init_data. This would conflict with provided57815781- * init_data, if set. Warn if it happens.57825782- */57835783- if (regulator_desc->of_match)57845784- dev_warn(dev, "Using provided init data - OF match ignored\n");57775777+ /*57785778+ * DT may override the config->init_data provided if the platform57795779+ * needs to do so. If so, config->init_data is completely ignored.57805780+ */57815781+ init_data = regulator_of_get_init_data(dev, regulator_desc, config,57825782+ &rdev->dev.of_node);5785578357845784+ /*57855785+ * Sometimes not all resources are probed already so we need to take57865786+ * that into account. This happens most the time if the ena_gpiod comes57875787+ * from a gpio extender or something else.57885788+ */57895789+ if (PTR_ERR(init_data) == -EPROBE_DEFER) {57905790+ ret = -EPROBE_DEFER;57915791+ goto clean;57925792+ }57935793+57945794+ /*57955795+ * We need to keep track of any GPIO descriptor coming from the57965796+ * device tree until we have handled it over to the core. If the57975797+ * config that was passed in to this function DOES NOT contain57985798+ * a descriptor, and the config after this call DOES contain57995799+ * a descriptor, we definitely got one from parsing the device58005800+ * tree.58015801+ */58025802+ if (!cfg->ena_gpiod && config->ena_gpiod)58035803+ dangling_of_gpiod = true;58045804+ if (!init_data) {57865805 init_data = config->init_data;57875806 rdev->dev.of_node = of_node_get(config->of_node);57885788-57895789- } else {57905790- init_data = regulator_of_get_init_data(dev, regulator_desc,57915791- config,57925792- &rdev->dev.of_node);57935793-57945794- /*57955795- * Sometimes not all resources are probed already so we need to57965796- * take that into account. This happens most the time if the57975797- * ena_gpiod comes from a gpio extender or something else.57985798- */57995799- if (PTR_ERR(init_data) == -EPROBE_DEFER) {58005800- ret = -EPROBE_DEFER;58015801- goto clean;58025802- }58035803-58045804- /*58055805- * We need to keep track of any GPIO descriptor coming from the58065806- * device tree until we have handled it over to the core. If the58075807- * config that was passed in to this function DOES NOT contain a58085808- * descriptor, and the config after this call DOES contain a58095809- * descriptor, we definitely got one from parsing the device58105810- * tree.58115811- */58125812- if (!cfg->ena_gpiod && config->ena_gpiod)58135813- dangling_of_gpiod = true;58145807 }5815580858165809 ww_mutex_init(&rdev->mutex, ®ulator_ww_class);
+2-1
drivers/s390/cio/chp.c
···695695 if (time_after(jiffies, chp_info_expires)) {696696 /* Data is too old, update. */697697 rc = sclp_chp_read_info(&chp_info);698698- chp_info_expires = jiffies + CHP_INFO_UPDATE_INTERVAL ;698698+ if (!rc)699699+ chp_info_expires = jiffies + CHP_INFO_UPDATE_INTERVAL;699700 }700701 mutex_unlock(&info_lock);701702
···5757 * @max_level: maximum cooling level. One less than total number of valid5858 * cpufreq frequencies.5959 * @em: Reference on the Energy Model of the device6060- * @cdev: thermal_cooling_device pointer to keep track of the6161- * registered cooling device.6260 * @policy: cpufreq policy.6361 * @cooling_ops: cpufreq callbacks to thermal cooling device ops6462 * @idle_time: idle time stats
+2
drivers/tty/serial/8250/8250.h
···374374375375#ifdef CONFIG_SERIAL_8250_DMA376376extern int serial8250_tx_dma(struct uart_8250_port *);377377+extern void serial8250_tx_dma_flush(struct uart_8250_port *);377378extern int serial8250_rx_dma(struct uart_8250_port *);378379extern void serial8250_rx_dma_flush(struct uart_8250_port *);379380extern int serial8250_request_dma(struct uart_8250_port *);···407406{408407 return -1;409408}409409+static inline void serial8250_tx_dma_flush(struct uart_8250_port *p) { }410410static inline int serial8250_rx_dma(struct uart_8250_port *p)411411{412412 return -1;
+16
drivers/tty/serial/8250/8250_dma.c
···149149 return ret;150150}151151152152+void serial8250_tx_dma_flush(struct uart_8250_port *p)153153+{154154+ struct uart_8250_dma *dma = p->dma;155155+156156+ if (!dma->tx_running)157157+ return;158158+159159+ /*160160+ * kfifo_reset() has been called by the serial core, avoid161161+ * advancing and underflowing in __dma_tx_complete().162162+ */163163+ dma->tx_size = 0;164164+165165+ dmaengine_terminate_async(dma->rxchan);166166+}167167+152168int serial8250_rx_dma(struct uart_8250_port *p)153169{154170 struct uart_8250_dma *dma = p->dma;
···15611561 /* Always ask for fixed clock rate from a property. */15621562 device_property_read_u32(dev, "clock-frequency", &uartclk);1563156315641564- s->polling = !!irq;15641564+ s->polling = (irq <= 0);15651565 if (s->polling)15661566 dev_dbg(dev,15671567 "No interrupt pin definition, falling back to polling mode\n");
+7-5
drivers/tty/serial/serial_port.c
···173173 * The caller is responsible to initialize the following fields of the @port174174 * ->dev (must be valid)175175 * ->flags176176+ * ->iobase176177 * ->mapbase177178 * ->mapsize178179 * ->regshift (if @use_defaults is false)···215214 /* Read the registers I/O access type (default: MMIO 8-bit) */216215 ret = device_property_read_u32(dev, "reg-io-width", &value);217216 if (ret) {218218- port->iotype = UPIO_MEM;217217+ port->iotype = port->iobase ? UPIO_PORT : UPIO_MEM;219218 } else {220219 switch (value) {221220 case 1:···228227 port->iotype = device_is_big_endian(dev) ? UPIO_MEM32BE : UPIO_MEM32;229228 break;230229 default:231231- if (!use_defaults) {232232- dev_err(dev, "Unsupported reg-io-width (%u)\n", value);233233- return -EINVAL;234234- }235230 port->iotype = UPIO_UNKNOWN;236231 break;237232 }233233+ }234234+235235+ if (!use_defaults && port->iotype == UPIO_UNKNOWN) {236236+ dev_err(dev, "Unsupported reg-io-width (%u)\n", value);237237+ return -EINVAL;238238 }239239240240 /* Read the address mapping base offset (default: no offset) */
+21-7
drivers/usb/class/cdc-acm.c
···371371static void acm_ctrl_irq(struct urb *urb)372372{373373 struct acm *acm = urb->context;374374- struct usb_cdc_notification *dr = urb->transfer_buffer;374374+ struct usb_cdc_notification *dr;375375 unsigned int current_size = urb->actual_length;376376 unsigned int expected_size, copy_size, alloc_size;377377 int retval;···398398399399 usb_mark_last_busy(acm->dev);400400401401- if (acm->nb_index)401401+ if (acm->nb_index == 0) {402402+ /*403403+ * The first chunk of a message must contain at least the404404+ * notification header with the length field, otherwise we405405+ * can't get an expected_size.406406+ */407407+ if (current_size < sizeof(struct usb_cdc_notification)) {408408+ dev_dbg(&acm->control->dev, "urb too short\n");409409+ goto exit;410410+ }411411+ dr = urb->transfer_buffer;412412+ } else {402413 dr = (struct usb_cdc_notification *)acm->notification_buffer;403403-414414+ }404415 /* size = notification-header + (optional) data */405416 expected_size = sizeof(struct usb_cdc_notification) +406417 le16_to_cpu(dr->wLength);407418408408- if (current_size < expected_size) {419419+ if (acm->nb_index != 0 || current_size < expected_size) {409420 /* notification is transmitted fragmented, reassemble */410421 if (acm->nb_size < expected_size) {411422 u8 *new_buffer;···17381727 { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */17391728 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */17401729 },17411741- { USB_DEVICE(0x045b, 0x023c), /* Renesas USB Download mode */17301730+ { USB_DEVICE(0x045b, 0x023c), /* Renesas R-Car H3 USB Download mode */17421731 .driver_info = DISABLE_ECHO, /* Don't echo banner */17431732 },17441744- { USB_DEVICE(0x045b, 0x0248), /* Renesas USB Download mode */17331733+ { USB_DEVICE(0x045b, 0x0247), /* Renesas R-Car D3 USB Download mode */17451734 .driver_info = DISABLE_ECHO, /* Don't echo banner */17461735 },17471747- { USB_DEVICE(0x045b, 0x024D), /* Renesas USB Download mode */17361736+ { USB_DEVICE(0x045b, 0x0248), /* Renesas R-Car M3-N USB Download mode */17371737+ .driver_info = DISABLE_ECHO, /* Don't echo banner */17381738+ },17391739+ { USB_DEVICE(0x045b, 0x024D), /* Renesas R-Car E3 USB Download mode */17481740 .driver_info = DISABLE_ECHO, /* Don't echo banner */17491741 },17501742 { USB_DEVICE(0x0e8d, 0x0003), /* FIREFLY, MediaTek Inc; andrey.arapov@gmail.com */
+12-2
drivers/usb/core/hub.c
···18491849 hdev = interface_to_usbdev(intf);1850185018511851 /*18521852+ * The USB 2.0 spec prohibits hubs from having more than one18531853+ * configuration or interface, and we rely on this prohibition.18541854+ * Refuse to accept a device that violates it.18551855+ */18561856+ if (hdev->descriptor.bNumConfigurations > 1 ||18571857+ hdev->actconfig->desc.bNumInterfaces > 1) {18581858+ dev_err(&intf->dev, "Invalid hub with more than one config or interface\n");18591859+ return -EINVAL;18601860+ }18611861+18621862+ /*18521863 * Set default autosuspend delay as 0 to speedup bus suspend,18531864 * based on the below considerations:18541865 *···47094698EXPORT_SYMBOL_GPL(usb_ep0_reinit);4710469947114700#define usb_sndaddr0pipe() (PIPE_CONTROL << 30)47124712-#define usb_rcvaddr0pipe() ((PIPE_CONTROL << 30) | USB_DIR_IN)4713470147144702static int hub_set_address(struct usb_device *udev, int devnum)47154703{···48144804 for (i = 0; i < GET_MAXPACKET0_TRIES; ++i) {48154805 /* Start with invalid values in case the transfer fails */48164806 buf->bDescriptorType = buf->bMaxPacketSize0 = 0;48174817- rc = usb_control_msg(udev, usb_rcvaddr0pipe(),48074807+ rc = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),48184808 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,48194809 USB_DT_DEVICE << 8, 0,48204810 buf, size,
···717717/**718718 * struct dwc3_ep - device side endpoint representation719719 * @endpoint: usb endpoint720720+ * @nostream_work: work for handling bulk NoStream720721 * @cancelled_list: list of cancelled requests for this endpoint721722 * @pending_list: list of pending requests for this endpoint722723 * @started_list: list of started requests on this endpoint
+34
drivers/usb/dwc3/gadget.c
···26292629{26302630 u32 reg;26312631 u32 timeout = 2000;26322632+ u32 saved_config = 0;2632263326332634 if (pm_runtime_suspended(dwc->dev))26342635 return 0;26362636+26372637+ /*26382638+ * When operating in USB 2.0 speeds (HS/FS), ensure that26392639+ * GUSB2PHYCFG.ENBLSLPM and GUSB2PHYCFG.SUSPHY are cleared before starting26402640+ * or stopping the controller. This resolves timeout issues that occur26412641+ * during frequent role switches between host and device modes.26422642+ *26432643+ * Save and clear these settings, then restore them after completing the26442644+ * controller start or stop sequence.26452645+ *26462646+ * This solution was discovered through experimentation as it is not26472647+ * mentioned in the dwc3 programming guide. It has been tested on an26482648+ * Exynos platforms.26492649+ */26502650+ reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));26512651+ if (reg & DWC3_GUSB2PHYCFG_SUSPHY) {26522652+ saved_config |= DWC3_GUSB2PHYCFG_SUSPHY;26532653+ reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;26542654+ }26552655+26562656+ if (reg & DWC3_GUSB2PHYCFG_ENBLSLPM) {26572657+ saved_config |= DWC3_GUSB2PHYCFG_ENBLSLPM;26582658+ reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM;26592659+ }26602660+26612661+ if (saved_config)26622662+ dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);2635266326362664 reg = dwc3_readl(dwc->regs, DWC3_DCTL);26372665 if (is_on) {···26872659 reg = dwc3_readl(dwc->regs, DWC3_DSTS);26882660 reg &= DWC3_DSTS_DEVCTRLHLT;26892661 } while (--timeout && !(!is_on ^ !reg));26622662+26632663+ if (saved_config) {26642664+ reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));26652665+ reg |= saved_config;26662666+ dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);26672667+ }2690266826912669 if (!timeout)26922670 return -ETIMEDOUT;
+14-5
drivers/usb/gadget/function/f_midi.c
···283283 /* Our transmit completed. See if there's more to go.284284 * f_midi_transmit eats req, don't queue it again. */285285 req->length = 0;286286- f_midi_transmit(midi);286286+ queue_work(system_highpri_wq, &midi->work);287287 return;288288 }289289 break;···907907908908 status = -ENODEV;909909910910+ /*911911+ * Reset wMaxPacketSize with maximum packet size of FS bulk transfer before912912+ * endpoint claim. This ensures that the wMaxPacketSize does not exceed the913913+ * limit during bind retries where configured dwc3 TX/RX FIFO's maxpacket914914+ * size of 512 bytes for IN/OUT endpoints in support HS speed only.915915+ */916916+ bulk_in_desc.wMaxPacketSize = cpu_to_le16(64);917917+ bulk_out_desc.wMaxPacketSize = cpu_to_le16(64);918918+910919 /* allocate instance-specific endpoints */911920 midi->in_ep = usb_ep_autoconfig(cdev->gadget, &bulk_in_desc);912921 if (!midi->in_ep)···10091000 }1010100110111002 /* configure the endpoint descriptors ... */10121012- ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports);10131013- ms_out_desc.bNumEmbMIDIJack = midi->in_ports;10031003+ ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports);10041004+ ms_out_desc.bNumEmbMIDIJack = midi->out_ports;1014100510151015- ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports);10161016- ms_in_desc.bNumEmbMIDIJack = midi->out_ports;10061006+ ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports);10071007+ ms_in_desc.bNumEmbMIDIJack = midi->in_ports;1017100810181009 /* ... and add them to the list */10191010 endpoint_descriptor_index = i;
+1-1
drivers/usb/gadget/function/uvc_video.c
···818818 return -EINVAL;819819820820 /* Allocate a kthread for asynchronous hw submit handler. */821821- video->kworker = kthread_create_worker(0, "UVCG");821821+ video->kworker = kthread_run_worker(0, "UVCG");822822 if (IS_ERR(video->kworker)) {823823 uvcg_err(&video->uvc->func, "failed to create UVCG kworker\n");824824 return PTR_ERR(video->kworker);
···958958 * booting from USB disk or using a usb keyboard959959 */960960 hcc_params = readl(base + EHCI_HCC_PARAMS);961961+962962+ /* LS7A EHCI controller doesn't have extended capabilities, the963963+ * EECP (EHCI Extended Capabilities Pointer) field of HCCPARAMS964964+ * register should be 0x0 but it reads as 0xa0. So clear it to965965+ * avoid error messages on boot.966966+ */967967+ if (pdev->vendor == PCI_VENDOR_ID_LOONGSON && pdev->device == 0x7a14)968968+ hcc_params &= ~(0xffL << 8);969969+961970 offset = (hcc_params >> 8) & 0xff;962971 while (offset && --count) {963972 pci_read_config_dword(pdev, offset, &cap);
+4-3
drivers/usb/host/xhci-pci.c
···653653}654654EXPORT_SYMBOL_NS_GPL(xhci_pci_common_probe, "xhci");655655656656-static const struct pci_device_id pci_ids_reject[] = {657657- /* handled by xhci-pci-renesas */656656+/* handled by xhci-pci-renesas if enabled */657657+static const struct pci_device_id pci_ids_renesas[] = {658658 { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, 0x0014) },659659 { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, 0x0015) },660660 { /* end: all zeroes */ }···662662663663static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)664664{665665- if (pci_match_id(pci_ids_reject, dev))665665+ if (IS_ENABLED(CONFIG_USB_XHCI_PCI_RENESAS) &&666666+ pci_match_id(pci_ids_renesas, dev))666667 return -ENODEV;667668668669 return xhci_pci_common_probe(dev, id);
···470470 */471471void netfs_wake_read_collector(struct netfs_io_request *rreq)472472{473473- if (test_bit(NETFS_RREQ_OFFLOAD_COLLECTION, &rreq->flags)) {473473+ if (test_bit(NETFS_RREQ_OFFLOAD_COLLECTION, &rreq->flags) &&474474+ !test_bit(NETFS_RREQ_RETRYING, &rreq->flags)) {474475 if (!work_pending(&rreq->work)) {475476 netfs_get_request(rreq, netfs_rreq_trace_get_work);476477 if (!queue_work(system_unbound_wq, &rreq->work))···587586 smp_mb__after_atomic(); /* Clear IN_PROGRESS before task state */588587589588 /* If we are at the head of the queue, wake up the collector. */590590- if (list_is_first(&subreq->rreq_link, &stream->subrequests))589589+ if (list_is_first(&subreq->rreq_link, &stream->subrequests) ||590590+ test_bit(NETFS_RREQ_RETRYING, &rreq->flags))591591 netfs_wake_read_collector(rreq);592592593593 netfs_put_subrequest(subreq, true, netfs_sreq_trace_put_terminated);
+33-10
fs/netfs/read_retry.c
···1414{1515 __clear_bit(NETFS_SREQ_MADE_PROGRESS, &subreq->flags);1616 __set_bit(NETFS_SREQ_IN_PROGRESS, &subreq->flags);1717- netfs_get_subrequest(subreq, netfs_sreq_trace_get_resubmit);1717+ netfs_stat(&netfs_n_rh_retry_read_subreq);1818 subreq->rreq->netfs_ops->issue_read(subreq);1919}2020···4848 __clear_bit(NETFS_SREQ_MADE_PROGRESS, &subreq->flags);4949 subreq->retry_count++;5050 netfs_reset_iter(subreq);5151+ netfs_get_subrequest(subreq, netfs_sreq_trace_get_resubmit);5152 netfs_reissue_read(rreq, subreq);5253 }5354 }···7675 struct iov_iter source;7776 unsigned long long start, len;7877 size_t part;7979- bool boundary = false;7878+ bool boundary = false, subreq_superfluous = false;80798180 /* Go through the subreqs and find the next span of contiguous8281 * buffer that we then rejig (cifs, for example, needs the···117116 /* Work through the sublist. */118117 subreq = from;119118 list_for_each_entry_from(subreq, &stream->subrequests, rreq_link) {120120- if (!len)119119+ if (!len) {120120+ subreq_superfluous = true;121121 break;122122+ }122123 subreq->source = NETFS_DOWNLOAD_FROM_SERVER;123124 subreq->start = start - subreq->transferred;124125 subreq->len = len + subreq->transferred;···157154158155 netfs_get_subrequest(subreq, netfs_sreq_trace_get_resubmit);159156 netfs_reissue_read(rreq, subreq);160160- if (subreq == to)157157+ if (subreq == to) {158158+ subreq_superfluous = false;161159 break;160160+ }162161 }163162164163 /* If we managed to use fewer subreqs, we can discard the165164 * excess; if we used the same number, then we're done.166165 */167166 if (!len) {168168- if (subreq == to)167167+ if (!subreq_superfluous)169168 continue;170169 list_for_each_entry_safe_from(subreq, tmp,171170 &stream->subrequests, rreq_link) {172172- trace_netfs_sreq(subreq, netfs_sreq_trace_discard);171171+ trace_netfs_sreq(subreq, netfs_sreq_trace_superfluous);173172 list_del(&subreq->rreq_link);174173 netfs_put_subrequest(subreq, false, netfs_sreq_trace_put_done);175174 if (subreq == to)···192187 subreq->source = NETFS_DOWNLOAD_FROM_SERVER;193188 subreq->start = start;194189 subreq->len = len;195195- subreq->debug_index = atomic_inc_return(&rreq->subreq_counter);196190 subreq->stream_nr = stream->stream_nr;197191 subreq->retry_count = 1;198192199193 trace_netfs_sreq_ref(rreq->debug_id, subreq->debug_index,200194 refcount_read(&subreq->ref),201195 netfs_sreq_trace_new);202202- netfs_get_subrequest(subreq, netfs_sreq_trace_get_resubmit);203196204197 list_add(&subreq->rreq_link, &to->rreq_link);205198 to = list_next_entry(to, rreq_link);···259256{260257 struct netfs_io_subrequest *subreq;261258 struct netfs_io_stream *stream = &rreq->io_streams[0];259259+ DEFINE_WAIT(myself);260260+261261+ netfs_stat(&netfs_n_rh_retry_read_req);262262+263263+ set_bit(NETFS_RREQ_RETRYING, &rreq->flags);262264263265 /* Wait for all outstanding I/O to quiesce before performing retries as264266 * we may need to renegotiate the I/O sizes.265267 */266268 list_for_each_entry(subreq, &stream->subrequests, rreq_link) {267267- wait_on_bit(&subreq->flags, NETFS_SREQ_IN_PROGRESS,268268- TASK_UNINTERRUPTIBLE);269269+ if (!test_bit(NETFS_SREQ_IN_PROGRESS, &subreq->flags))270270+ continue;271271+272272+ trace_netfs_rreq(rreq, netfs_rreq_trace_wait_queue);273273+ for (;;) {274274+ prepare_to_wait(&rreq->waitq, &myself, TASK_UNINTERRUPTIBLE);275275+276276+ if (!test_bit(NETFS_SREQ_IN_PROGRESS, &subreq->flags))277277+ break;278278+279279+ trace_netfs_sreq(subreq, netfs_sreq_trace_wait_for);280280+ schedule();281281+ trace_netfs_rreq(rreq, netfs_rreq_trace_woke_queue);282282+ }283283+284284+ finish_wait(&rreq->waitq, &myself);269285 }286286+ clear_bit(NETFS_RREQ_RETRYING, &rreq->flags);270287271288 trace_netfs_rreq(rreq, netfs_rreq_trace_resubmit);272289 netfs_retry_read_subrequests(rreq);
···203203 struct netfs_io_stream *stream;204204 int s;205205206206+ netfs_stat(&netfs_n_wh_retry_write_req);207207+206208 /* Wait for all outstanding I/O to quiesce before performing retries as207209 * we may need to renegotiate the I/O sizes.208210 */
···12151215 rc = server->ops->parse_reparse_point(cifs_sb,12161216 full_path,12171217 iov, data);12181218+ /*12191219+ * If the reparse point was not handled but it is the12201220+ * name surrogate which points to directory, then treat12211221+ * is as a new mount point. Name surrogate reparse point12221222+ * represents another named entity in the system.12231223+ */12241224+ if (rc == -EOPNOTSUPP &&12251225+ IS_REPARSE_TAG_NAME_SURROGATE(data->reparse.tag) &&12261226+ (le32_to_cpu(data->fi.Attributes) & ATTR_DIRECTORY)) {12271227+ rc = 0;12281228+ cifs_create_junction_fattr(fattr, sb);12291229+ goto out;12301230+ }12181231 }1219123212201233 if (data->reparse.tag == IO_REPARSE_TAG_SYMLINK && !rc) {···14211408 struct cifs_fattr fattr = {};14221409 int rc;1423141014241424- if (is_inode_cache_good(*inode)) {14111411+ if (!data && is_inode_cache_good(*inode)) {14251412 cifs_dbg(FYI, "No need to revalidate cached inode sizes\n");14261413 return 0;14271414 }···15201507 struct cifs_fattr fattr = {};15211508 int rc;1522150915231523- if (is_inode_cache_good(*inode)) {15101510+ if (!data && is_inode_cache_good(*inode)) {15241511 cifs_dbg(FYI, "No need to revalidate cached inode sizes\n");15251512 return 0;15261513 }
···17071707} __packed; /* level 6 Query */1708170817091709struct smb2_file_rename_info { /* encoding of request for level 10 */17101710- __u8 ReplaceIfExists; /* 1 = replace existing target with new */17111711- /* 0 = fail if target already exists */17121712- __u8 Reserved[7];17131713- __u64 RootDirectory; /* MBZ for network operations (why says spec?) */17141714- __le32 FileNameLength;17101710+ /* New members MUST be added within the struct_group() macro below. */17111711+ __struct_group(smb2_file_rename_info_hdr, __hdr, __packed,17121712+ __u8 ReplaceIfExists; /* 1 = replace existing target with new */17131713+ /* 0 = fail if target already exists */17141714+ __u8 Reserved[7];17151715+ __u64 RootDirectory; /* MBZ for network operations (why says spec?) */17161716+ __le32 FileNameLength;17171717+ );17151718 char FileName[]; /* New name to be assigned */17161719 /* padding - overall struct size must be >= 24 so filename + pad >= 6 */17171720} __packed; /* level 10 Set */17211721+static_assert(offsetof(struct smb2_file_rename_info, FileName) == sizeof(struct smb2_file_rename_info_hdr),17221722+ "struct member likely outside of __struct_group()");1718172317191724struct smb2_file_link_info { /* encoding of request for level 11 */17201720- __u8 ReplaceIfExists; /* 1 = replace existing link with new */17211721- /* 0 = fail if link already exists */17221722- __u8 Reserved[7];17231723- __u64 RootDirectory; /* MBZ for network operations (why says spec?) */17241724- __le32 FileNameLength;17251725+ /* New members MUST be added within the struct_group() macro below. */17261726+ __struct_group(smb2_file_link_info_hdr, __hdr, __packed,17271727+ __u8 ReplaceIfExists; /* 1 = replace existing link with new */17281728+ /* 0 = fail if link already exists */17291729+ __u8 Reserved[7];17301730+ __u64 RootDirectory; /* MBZ for network operations (why says spec?) */17311731+ __le32 FileNameLength;17321732+ );17251733 char FileName[]; /* Name to be assigned to new link */17261734} __packed; /* level 11 Set */17351735+static_assert(offsetof(struct smb2_file_link_info, FileName) == sizeof(struct smb2_file_link_info_hdr),17361736+ "struct member likely outside of __struct_group()");1727173717281738/*17291739 * This level 18, although with struct with same name is different from cifs
+3
fs/smb/common/smbfsctl.h
···159159#define IO_REPARSE_TAG_LX_CHR 0x80000025160160#define IO_REPARSE_TAG_LX_BLK 0x80000026161161162162+/* If Name Surrogate Bit is set, the file or directory represents another named entity in the system. */163163+#define IS_REPARSE_TAG_NAME_SURROGATE(tag) (!!((tag) & 0x20000000))164164+162165/* fsctl flags */163166/* If Flags is set to this value, the request is an FSCTL not ioctl request */164167#define SMB2_0_IOCTL_IS_FSCTL 0x00000001
···10551055 return true;10561056 break;10571057 case S_IFREG:10581058- if (fmt == XFS_DINODE_FMT_LOCAL)10581058+ switch (fmt) {10591059+ case XFS_DINODE_FMT_LOCAL:10591060 return true;10601060- fallthrough;10611061+ case XFS_DINODE_FMT_EXTENTS:10621062+ case XFS_DINODE_FMT_BTREE:10631063+ case XFS_DINODE_FMT_META_BTREE:10641064+ break;10651065+ default:10661066+ return true;10671067+ }10681068+ break;10611069 case S_IFLNK:10621070 case S_IFDIR:10631071 switch (fmt) {
+10-1
fs/xfs/scrub/repair.h
···191191#else192192193193#define xrep_ino_dqattach(sc) (0)194194-#define xrep_will_attempt(sc) (false)194194+195195+/*196196+ * When online repair is not built into the kernel, we still want to attempt197197+ * the repair so that the stub xrep_attempt below will return EOPNOTSUPP.198198+ */199199+static inline bool xrep_will_attempt(const struct xfs_scrub *sc)200200+{201201+ return (sc->sm->sm_flags & XFS_SCRUB_IFLAG_FORCE_REBUILD) ||202202+ xchk_needs_repair(sc->sm);203203+}195204196205static inline int197206xrep_attempt(
+12
fs/xfs/scrub/scrub.c
···149149 if (xchk_should_terminate(sc, &error))150150 return error;151151152152+ /*153153+ * If the caller is probing to see if repair works but repair isn't154154+ * built into the kernel, return EOPNOTSUPP because that's the signal155155+ * that userspace expects. If online repair is built in, set the156156+ * CORRUPT flag (without any of the usual tracing/logging) to force us157157+ * into xrep_probe.158158+ */159159+ if (xchk_could_repair(sc)) {160160+ if (!IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR))161161+ return -EOPNOTSUPP;162162+ sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;163163+ }152164 return 0;153165}154166
+37-4
fs/xfs/xfs_aops.c
···1919#include "xfs_reflink.h"2020#include "xfs_errortag.h"2121#include "xfs_error.h"2222+#include "xfs_icache.h"22232324struct xfs_writepage_ctx {2425 struct iomap_writepage_ctx ctx;···529528}530529531530static int532532-xfs_iomap_swapfile_activate(531531+xfs_vm_swap_activate(533532 struct swap_info_struct *sis,534533 struct file *swap_file,535534 sector_t *span)536535{537537- sis->bdev = xfs_inode_buftarg(XFS_I(file_inode(swap_file)))->bt_bdev;536536+ struct xfs_inode *ip = XFS_I(file_inode(swap_file));537537+538538+ /*539539+ * Swap file activation can race against concurrent shared extent540540+ * removal in files that have been cloned. If this happens,541541+ * iomap_swapfile_iter() can fail because it encountered a shared542542+ * extent even though an operation is in progress to remove those543543+ * shared extents.544544+ *545545+ * This race becomes problematic when we defer extent removal546546+ * operations beyond the end of a syscall (i.e. use async background547547+ * processing algorithms). Users think the extents are no longer548548+ * shared, but iomap_swapfile_iter() still sees them as shared549549+ * because the refcountbt entries for the extents being removed have550550+ * not yet been updated. Hence the swapon call fails unexpectedly.551551+ *552552+ * The race condition is currently most obvious from the unlink()553553+ * operation as extent removal is deferred until after the last554554+ * reference to the inode goes away. We then process the extent555555+ * removal asynchronously, hence triggers the "syscall completed but556556+ * work not done" condition mentioned above. To close this race557557+ * window, we need to flush any pending inodegc operations to ensure558558+ * they have updated the refcountbt records before we try to map the559559+ * swapfile.560560+ */561561+ xfs_inodegc_flush(ip->i_mount);562562+563563+ /*564564+ * Direct the swap code to the correct block device when this file565565+ * sits on the RT device.566566+ */567567+ sis->bdev = xfs_inode_buftarg(ip)->bt_bdev;568568+538569 return iomap_swapfile_activate(sis, swap_file, span,539570 &xfs_read_iomap_ops);540571}···582549 .migrate_folio = filemap_migrate_folio,583550 .is_partially_uptodate = iomap_is_partially_uptodate,584551 .error_remove_folio = generic_error_remove_folio,585585- .swap_activate = xfs_iomap_swapfile_activate,552552+ .swap_activate = xfs_vm_swap_activate,586553};587554588555const struct address_space_operations xfs_dax_aops = {589556 .writepages = xfs_dax_writepages,590557 .dirty_folio = noop_dirty_folio,591591- .swap_activate = xfs_iomap_swapfile_activate,558558+ .swap_activate = xfs_vm_swap_activate,592559};
+39-16
fs/xfs/xfs_qm_bhv.c
···7878 }7979}80808181+STATIC int8282+xfs_qm_validate_state_change(8383+ struct xfs_mount *mp,8484+ uint uqd,8585+ uint gqd,8686+ uint pqd)8787+{8888+ int state;8989+9090+ /* Is quota state changing? */9191+ state = ((uqd && !XFS_IS_UQUOTA_ON(mp)) ||9292+ (!uqd && XFS_IS_UQUOTA_ON(mp)) ||9393+ (gqd && !XFS_IS_GQUOTA_ON(mp)) ||9494+ (!gqd && XFS_IS_GQUOTA_ON(mp)) ||9595+ (pqd && !XFS_IS_PQUOTA_ON(mp)) ||9696+ (!pqd && XFS_IS_PQUOTA_ON(mp)));9797+9898+ return state &&9999+ (xfs_dev_is_read_only(mp, "changing quota state") ||100100+ xfs_has_norecovery(mp));101101+}102102+81103int82104xfs_qm_newmount(83105 xfs_mount_t *mp,···11997 }1209812199 /*122122- * If the device itself is read-only, we can't allow123123- * the user to change the state of quota on the mount -124124- * this would generate a transaction on the ro device,125125- * which would lead to an I/O error and shutdown100100+ * If the device itself is read-only and/or in norecovery101101+ * mode, we can't allow the user to change the state of102102+ * quota on the mount - this would generate a transaction103103+ * on the ro device, which would lead to an I/O error and104104+ * shutdown.126105 */127106128128- if (((uquotaondisk && !XFS_IS_UQUOTA_ON(mp)) ||129129- (!uquotaondisk && XFS_IS_UQUOTA_ON(mp)) ||130130- (gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) ||131131- (!gquotaondisk && XFS_IS_GQUOTA_ON(mp)) ||132132- (pquotaondisk && !XFS_IS_PQUOTA_ON(mp)) ||133133- (!pquotaondisk && XFS_IS_PQUOTA_ON(mp))) &&134134- xfs_dev_is_read_only(mp, "changing quota state")) {135135- xfs_warn(mp, "please mount with%s%s%s%s.",136136- (!quotaondisk ? "out quota" : ""),137137- (uquotaondisk ? " usrquota" : ""),138138- (gquotaondisk ? " grpquota" : ""),139139- (pquotaondisk ? " prjquota" : ""));107107+ if (xfs_qm_validate_state_change(mp, uquotaondisk,108108+ gquotaondisk, pquotaondisk)) {109109+110110+ if (xfs_has_metadir(mp))111111+ xfs_warn(mp,112112+ "metadir enabled, please mount without any quota mount options");113113+ else114114+ xfs_warn(mp, "please mount with%s%s%s%s.",115115+ (!quotaondisk ? "out quota" : ""),116116+ (uquotaondisk ? " usrquota" : ""),117117+ (gquotaondisk ? " grpquota" : ""),118118+ (pquotaondisk ? " prjquota" : ""));140119 return -EPERM;141120 }142121
+6-2
fs/xfs/xfs_super.c
···16611661#endif16621662 }1663166316641664- /* Filesystem claims it needs repair, so refuse the mount. */16651665- if (xfs_has_needsrepair(mp)) {16641664+ /*16651665+ * Filesystem claims it needs repair, so refuse the mount unless16661666+ * norecovery is also specified, in which case the filesystem can16671667+ * be mounted with no risk of further damage.16681668+ */16691669+ if (xfs_has_needsrepair(mp) && !xfs_has_norecovery(mp)) {16661670 xfs_warn(mp, "Filesystem needs repair. Please run xfs_repair.");16671671 error = -EFSCORRUPTED;16681672 goto out_free_sb;
···11+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */22+/*33+ * Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved.44+ */55+66+#ifndef _DT_BINDINGS_CLK_QCOM_QCS8300_CAM_CC_H77+#define _DT_BINDINGS_CLK_QCOM_QCS8300_CAM_CC_H88+99+#include "qcom,sa8775p-camcc.h"1010+1111+/* QCS8300 introduces below new clocks compared to SA8775P */1212+1313+/* CAM_CC clocks */1414+#define CAM_CC_TITAN_TOP_ACCU_SHIFT_CLK 861515+1616+#endif
+17
include/dt-bindings/clock/qcom,qcs8300-gpucc.h
···11+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */22+/*33+ * Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved.44+ */55+66+#ifndef _DT_BINDINGS_CLK_QCOM_GPUCC_QCS8300_H77+#define _DT_BINDINGS_CLK_QCOM_GPUCC_QCS8300_H88+99+#include "qcom,sa8775p-gpucc.h"1010+1111+/* QCS8300 introduces below new clocks compared to SA8775P */1212+1313+/* GPU_CC clocks */1414+#define GPU_CC_CX_ACCU_SHIFT_CLK 231515+#define GPU_CC_GX_ACCU_SHIFT_CLK 241616+1717+#endif
+14-4
include/linux/blk-mq.h
···861861 void (*complete)(struct io_comp_batch *))862862{863863 /*864864- * blk_mq_end_request_batch() can't end request allocated from865865- * sched tags864864+ * Check various conditions that exclude batch processing:865865+ * 1) No batch container866866+ * 2) Has scheduler data attached867867+ * 3) Not a passthrough request and end_io set868868+ * 4) Not a passthrough request and an ioerror866869 */867867- if (!iob || (req->rq_flags & RQF_SCHED_TAGS) || ioerror ||868868- (req->end_io && !blk_rq_is_passthrough(req)))870870+ if (!iob)869871 return false;872872+ if (req->rq_flags & RQF_SCHED_TAGS)873873+ return false;874874+ if (!blk_rq_is_passthrough(req)) {875875+ if (req->end_io)876876+ return false;877877+ if (ioerror < 0)878878+ return false;879879+ }870880871881 if (!iob->complete)872882 iob->complete = complete;
+3-3
include/linux/cgroup-defs.h
···71717272 /* Cgroup is frozen. */7373 CGRP_FROZEN,7474-7575- /* Control group has to be killed. */7676- CGRP_KILL,7774};78757976/* cgroup_root->flags */···457460 int nr_populated_threaded_children;458461459462 int nr_threaded_children; /* # of live threaded child cgroups */463463+464464+ /* sequence number for cgroup.kill, serialized by css_set_lock. */465465+ unsigned int kill_seq;460466461467 struct kernfs_node *kn; /* cgroup kernfs entry */462468 struct cgroup_file procs_file; /* handle for "cgroup.procs" */
+69
include/linux/device/faux.h
···11+/* SPDX-License-Identifier: GPL-2.0-only */22+/*33+ * Copyright (c) 2025 Greg Kroah-Hartman <gregkh@linuxfoundation.org>44+ * Copyright (c) 2025 The Linux Foundation55+ *66+ * A "simple" faux bus that allows devices to be created and added77+ * automatically to it. This is to be used whenever you need to create a88+ * device that is not associated with any "real" system resources, and do99+ * not want to have to deal with a bus/driver binding logic. It is1010+ * intended to be very simple, with only a create and a destroy function1111+ * available.1212+ */1313+#ifndef _FAUX_DEVICE_H_1414+#define _FAUX_DEVICE_H_1515+1616+#include <linux/container_of.h>1717+#include <linux/device.h>1818+1919+/**2020+ * struct faux_device - a "faux" device2121+ * @dev: internal struct device of the object2222+ *2323+ * A simple faux device that can be created/destroyed. To be used when a2424+ * driver only needs to have a device to "hang" something off. This can be2525+ * used for downloading firmware or other basic tasks. Use this instead of2626+ * a struct platform_device if the device has no resources assigned to2727+ * it at all.2828+ */2929+struct faux_device {3030+ struct device dev;3131+};3232+#define to_faux_device(x) container_of_const((x), struct faux_device, dev)3333+3434+/**3535+ * struct faux_device_ops - a set of callbacks for a struct faux_device3636+ * @probe: called when a faux device is probed by the driver core3737+ * before the device is fully bound to the internal faux bus3838+ * code. If probe succeeds, return 0, otherwise return a3939+ * negative error number to stop the probe sequence from4040+ * succeeding.4141+ * @remove: called when a faux device is removed from the system4242+ *4343+ * Both @probe and @remove are optional, if not needed, set to NULL.4444+ */4545+struct faux_device_ops {4646+ int (*probe)(struct faux_device *faux_dev);4747+ void (*remove)(struct faux_device *faux_dev);4848+};4949+5050+struct faux_device *faux_device_create(const char *name,5151+ struct device *parent,5252+ const struct faux_device_ops *faux_ops);5353+struct faux_device *faux_device_create_with_groups(const char *name,5454+ struct device *parent,5555+ const struct faux_device_ops *faux_ops,5656+ const struct attribute_group **groups);5757+void faux_device_destroy(struct faux_device *faux_dev);5858+5959+static inline void *faux_device_get_drvdata(const struct faux_device *faux_dev)6060+{6161+ return dev_get_drvdata(&faux_dev->dev);6262+}6363+6464+static inline void faux_device_set_drvdata(struct faux_device *faux_dev, void *data)6565+{6666+ dev_set_drvdata(&faux_dev->dev, data);6767+}6868+6969+#endif /* _FAUX_DEVICE_H_ */
···32763276}3277327732783278int netdev_boot_setup_check(struct net_device *dev);32793279+struct net_device *dev_getbyhwaddr(struct net *net, unsigned short type,32803280+ const char *hwaddr);32793281struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,32803282 const char *hwaddr);32813283struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);···41184116gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);41194117void napi_gro_flush(struct napi_struct *napi, bool flush_old);41204118struct sk_buff *napi_get_frags(struct napi_struct *napi);41214121-void napi_get_frags_check(struct napi_struct *napi);41224119gro_result_t napi_gro_frags(struct napi_struct *napi);4123412041244121static inline void napi_free_frags(struct napi_struct *napi)
+1-1
include/linux/netfs.h
···278278#define NETFS_RREQ_PAUSE 11 /* Pause subrequest generation */279279#define NETFS_RREQ_USE_IO_ITER 12 /* Use ->io_iter rather than ->i_pages */280280#define NETFS_RREQ_ALL_QUEUED 13 /* All subreqs are now queued */281281-#define NETFS_RREQ_NEED_RETRY 14 /* Need to try retrying */281281+#define NETFS_RREQ_RETRYING 14 /* Set if we're in the retry path */282282#define NETFS_RREQ_USE_PGPRIV2 31 /* [DEPRECATED] Use PG_private_2 to mark283283 * write to cache on read */284284 const struct netfs_request_ops *netfs_ops;
···815815#ifdef CONFIG_CRYPTO_DEV_SP_PSP816816817817/**818818+ * sev_module_init - perform PSP SEV module initialization819819+ *820820+ * Returns:821821+ * 0 if the PSP module is successfully initialized822822+ * negative value if the PSP module initialization fails823823+ */824824+int sev_module_init(void);825825+826826+/**818827 * sev_platform_init - perform SEV INIT command819828 *820829 * @args: struct sev_platform_init_args to pass in arguments
···1111#include <net/udp.h>1212#include <net/hotdata.h>13131414+/* This should be increased if a protocol with a bigger head is added. */1515+#define GRO_MAX_HEAD (MAX_HEADER + 128)1616+1417struct napi_gro_cb {1518 union {1619 struct {
+11
include/net/net_namespace.h
···297297}298298299299void net_drop_ns(void *);300300+void net_passive_dec(struct net *net);300301301302#else302303···327326}328327329328#define net_drop_ns NULL329329+330330+static inline void net_passive_dec(struct net *net)331331+{332332+ refcount_dec(&net->passive);333333+}330334#endif335335+336336+static inline void net_passive_inc(struct net *net)337337+{338338+ refcount_inc(&net->passive);339339+}331340332341/* Returns true if the netns initialization is completed successfully */333342static inline bool net_initialized(const struct net *net)
···2525 __le32 streams;2626 /* # of available channel maps */2727 __le32 chmaps;2828- /* # of available control elements */2828+ /* # of available control elements (if VIRTIO_SND_F_CTLS) */2929 __le32 controls;3030};3131
···5454 continue;55555656 if (cmd->flags & IORING_URING_CMD_CANCELABLE) {5757- /* ->sqe isn't available if no async data */5858- if (!req_has_async_data(req))5959- cmd->sqe = NULL;6057 file->f_op->uring_cmd(cmd, IO_URING_F_CANCEL |6158 IO_URING_F_COMPLETE_DEFER);6259 ret = true;···176179 return -ENOMEM;177180 cache->op_data = NULL;178181179179- if (!(req->flags & REQ_F_FORCE_ASYNC)) {180180- /* defer memcpy until we need it */181181- ioucmd->sqe = sqe;182182- return 0;183183- }184184-182182+ /*183183+ * Unconditionally cache the SQE for now - this is only needed for184184+ * requests that go async, but prep handlers must ensure that any185185+ * sqe data is stable beyond prep. Since uring_cmd is special in186186+ * that it doesn't read in per-op data, play it safe and ensure that187187+ * any SQE data is stable beyond prep. This can later get relaxed.188188+ */185189 memcpy(cache->sqes, sqe, uring_sqe_size(req->ctx));186190 ioucmd->sqe = cache->sqes;187191 return 0;···247249 }248250249251 ret = file->f_op->uring_cmd(ioucmd, issue_flags);250250- if (ret == -EAGAIN) {251251- struct io_uring_cmd_data *cache = req->async_data;252252-253253- if (ioucmd->sqe != (void *) cache)254254- memcpy(cache->sqes, ioucmd->sqe, uring_sqe_size(req->ctx));255255- return -EAGAIN;256256- } else if (ret == -EIOCBQUEUED) {257257- return -EIOCBQUEUED;258258- }259259-252252+ if (ret == -EAGAIN || ret == -EIOCBQUEUED)253253+ return ret;260254 if (ret < 0)261255 req_set_fail(req);262256 io_req_uring_cleanup(req, issue_flags);
···3131config GENERIC_PENDING_IRQ3232 bool33333434-# Deduce delayed migration from top-level interrupt chip flags3535-config GENERIC_PENDING_IRQ_CHIPFLAGS3636- bool3737-3834# Support for generic irq migrating off cpu before the cpu is offline.3935config GENERIC_IRQ_MIGRATION4036 bool
+2-2
kernel/sched/autogroup.c
···150150 * see this thread after that: we can no longer use signal->autogroup.151151 * See the PF_EXITING check in task_wants_autogroup().152152 */153153- sched_move_task(p);153153+ sched_move_task(p, true);154154}155155156156static void···182182 * sched_autogroup_exit_task().183183 */184184 for_each_thread(p, t)185185- sched_move_task(t);185185+ sched_move_task(t, true);186186187187 unlock_task_sighand(p, &flags);188188 autogroup_kref_put(prev);
+7-5
kernel/sched/core.c
···10631063 struct task_struct *task;1064106410651065 task = container_of(node, struct task_struct, wake_q);10661066- /* Task can safely be re-inserted now: */10671066 node = node->next;10681068- task->wake_q.next = NULL;10671067+ /* pairs with cmpxchg_relaxed() in __wake_q_add() */10681068+ WRITE_ONCE(task->wake_q.next, NULL);10691069+ /* Task can safely be re-inserted now. */1069107010701071 /*10711072 * wake_up_process() executes a full barrier, which pairs with···90519050 * now. This function just updates tsk->se.cfs_rq and tsk->se.parent to reflect90529051 * its new group.90539052 */90549054-void sched_move_task(struct task_struct *tsk)90539053+void sched_move_task(struct task_struct *tsk, bool for_autogroup)90559054{90569055 int queued, running, queue_flags =90579056 DEQUEUE_SAVE | DEQUEUE_MOVE | DEQUEUE_NOCLOCK;···90809079 put_prev_task(rq, tsk);9081908090829081 sched_change_group(tsk, group);90839083- scx_move_task(tsk);90829082+ if (!for_autogroup)90839083+ scx_cgroup_move_task(tsk);9084908490859085 if (queued)90869086 enqueue_task(rq, tsk, queue_flags);···91829180 struct cgroup_subsys_state *css;9183918191849182 cgroup_taskset_for_each(task, css, tset)91859185- sched_move_task(task);91839183+ sched_move_task(task, false);9186918491879185 scx_cgroup_finish_attach();91889186}
+76-37
kernel/sched/ext.c
···123123 SCX_OPS_SWITCH_PARTIAL = 1LLU << 3,124124125125 /*126126+ * A migration disabled task can only execute on its current CPU. By127127+ * default, such tasks are automatically put on the CPU's local DSQ with128128+ * the default slice on enqueue. If this ops flag is set, they also go129129+ * through ops.enqueue().130130+ *131131+ * A migration disabled task never invokes ops.select_cpu() as it can132132+ * only select the current CPU. Also, p->cpus_ptr will only contain its133133+ * current CPU while p->nr_cpus_allowed keeps tracking p->user_cpus_ptr134134+ * and thus may disagree with cpumask_weight(p->cpus_ptr).135135+ */136136+ SCX_OPS_ENQ_MIGRATION_DISABLED = 1LLU << 4,137137+138138+ /*126139 * CPU cgroup support flags127140 */128141 SCX_OPS_HAS_CGROUP_WEIGHT = 1LLU << 16, /* cpu.weight */···143130 SCX_OPS_ALL_FLAGS = SCX_OPS_KEEP_BUILTIN_IDLE |144131 SCX_OPS_ENQ_LAST |145132 SCX_OPS_ENQ_EXITING |133133+ SCX_OPS_ENQ_MIGRATION_DISABLED |146134 SCX_OPS_SWITCH_PARTIAL |147135 SCX_OPS_HAS_CGROUP_WEIGHT,148136};···430416431417 /**432418 * @update_idle: Update the idle state of a CPU433433- * @cpu: CPU to udpate the idle state for419419+ * @cpu: CPU to update the idle state for434420 * @idle: whether entering or exiting the idle state435421 *436422 * This operation is called when @rq's CPU goes or leaves the idle···896882897883static DEFINE_STATIC_KEY_FALSE(scx_ops_enq_last);898884static DEFINE_STATIC_KEY_FALSE(scx_ops_enq_exiting);885885+static DEFINE_STATIC_KEY_FALSE(scx_ops_enq_migration_disabled);899886static DEFINE_STATIC_KEY_FALSE(scx_ops_cpu_preempt);900887static DEFINE_STATIC_KEY_FALSE(scx_builtin_idle_enabled);901888···1229121412301215/**12311216 * nldsq_next_task - Iterate to the next task in a non-local DSQ12321232- * @dsq: user dsq being interated12171217+ * @dsq: user dsq being iterated12331218 * @cur: current position, %NULL to start iteration12341219 * @rev: walk backwards12351220 *···20292014 unlikely(p->flags & PF_EXITING))20302015 goto local;2031201620172017+ /* see %SCX_OPS_ENQ_MIGRATION_DISABLED */20182018+ if (!static_branch_unlikely(&scx_ops_enq_migration_disabled) &&20192019+ is_migration_disabled(p))20202020+ goto local;20212021+20322022 if (!SCX_HAS_OP(enqueue))20332023 goto global;20342024···2098207820992079 /*21002080 * list_add_tail() must be used. scx_ops_bypass() depends on tasks being21012101- * appened to the runnable_list.20812081+ * appended to the runnable_list.21022082 */21032083 list_add_tail(&p->scx.runnable_node, &rq->scx.runnable_list);21042084}···23332313 *23342314 * - The BPF scheduler is bypassed while the rq is offline and we can always say23352315 * no to the BPF scheduler initiated migrations while offline.23162316+ *23172317+ * The caller must ensure that @p and @rq are on different CPUs.23362318 */23372319static bool task_can_run_on_remote_rq(struct task_struct *p, struct rq *rq,23382320 bool trigger_error)23392321{23402322 int cpu = cpu_of(rq);23232323+23242324+ SCHED_WARN_ON(task_cpu(p) == cpu);23252325+23262326+ /*23272327+ * If @p has migration disabled, @p->cpus_ptr is updated to contain only23282328+ * the pinned CPU in migrate_disable_switch() while @p is being switched23292329+ * out. However, put_prev_task_scx() is called before @p->cpus_ptr is23302330+ * updated and thus another CPU may see @p on a DSQ inbetween leading to23312331+ * @p passing the below task_allowed_on_cpu() check while migration is23322332+ * disabled.23332333+ *23342334+ * Test the migration disabled state first as the race window is narrow23352335+ * and the BPF scheduler failing to check migration disabled state can23362336+ * easily be masked if task_allowed_on_cpu() is done first.23372337+ */23382338+ if (unlikely(is_migration_disabled(p))) {23392339+ if (trigger_error)23402340+ scx_ops_error("SCX_DSQ_LOCAL[_ON] cannot move migration disabled %s[%d] from CPU %d to %d",23412341+ p->comm, p->pid, task_cpu(p), cpu);23422342+ return false;23432343+ }2341234423422345 /*23432346 * We don't require the BPF scheduler to avoid dispatching to offline···23702327 */23712328 if (!task_allowed_on_cpu(p, cpu)) {23722329 if (trigger_error)23732373- scx_ops_error("SCX_DSQ_LOCAL[_ON] verdict target cpu %d not allowed for %s[%d]",23742374- cpu_of(rq), p->comm, p->pid);23302330+ scx_ops_error("SCX_DSQ_LOCAL[_ON] target CPU %d not allowed for %s[%d]",23312331+ cpu, p->comm, p->pid);23752332 return false;23762333 }23772377-23782378- if (unlikely(is_migration_disabled(p)))23792379- return false;2380233423812335 if (!scx_rq_online(rq))23822336 return false;···2477243724782438 if (dst_dsq->id == SCX_DSQ_LOCAL) {24792439 dst_rq = container_of(dst_dsq, struct rq, scx.local_dsq);24802480- if (!task_can_run_on_remote_rq(p, dst_rq, true)) {24402440+ if (src_rq != dst_rq &&24412441+ unlikely(!task_can_run_on_remote_rq(p, dst_rq, true))) {24812442 dst_dsq = find_global_dsq(p);24822443 dst_rq = src_rq;24832444 }···25212480/*25222481 * A poorly behaving BPF scheduler can live-lock the system by e.g. incessantly25232482 * banging on the same DSQ on a large NUMA system to the point where switching25242524- * to the bypass mode can take a long time. Inject artifical delays while the24832483+ * to the bypass mode can take a long time. Inject artificial delays while the25252484 * bypass mode is switching to guarantee timely completion.25262485 */25272486static void scx_ops_breather(struct rq *rq)···26162575{26172576 struct rq *src_rq = task_rq(p);26182577 struct rq *dst_rq = container_of(dst_dsq, struct rq, scx.local_dsq);25782578+#ifdef CONFIG_SMP25792579+ struct rq *locked_rq = rq;25802580+#endif2619258126202582 /*26212583 * We're synchronized against dequeue through DISPATCHING. As @p can't···26322588 }2633258926342590#ifdef CONFIG_SMP26352635- if (unlikely(!task_can_run_on_remote_rq(p, dst_rq, true))) {25912591+ if (src_rq != dst_rq &&25922592+ unlikely(!task_can_run_on_remote_rq(p, dst_rq, true))) {26362593 dispatch_enqueue(find_global_dsq(p), p,26372594 enq_flags | SCX_ENQ_CLEAR_OPSS);26382595 return;···26562611 atomic_long_set_release(&p->scx.ops_state, SCX_OPSS_NONE);2657261226582613 /* switch to @src_rq lock */26592659- if (rq != src_rq) {26602660- raw_spin_rq_unlock(rq);26142614+ if (locked_rq != src_rq) {26152615+ raw_spin_rq_unlock(locked_rq);26162616+ locked_rq = src_rq;26612617 raw_spin_rq_lock(src_rq);26622618 }26632619···26762630 } else {26772631 move_remote_task_to_local_dsq(p, enq_flags,26782632 src_rq, dst_rq);26332633+ /* task has been moved to dst_rq, which is now locked */26342634+ locked_rq = dst_rq;26792635 }2680263626812637 /* if the destination CPU is idle, wake it up */···26862638 }2687263926882640 /* switch back to @rq lock */26892689- if (rq != dst_rq) {26902690- raw_spin_rq_unlock(dst_rq);26412641+ if (locked_rq != rq) {26422642+ raw_spin_rq_unlock(locked_rq);26912643 raw_spin_rq_lock(rq);26922644 }26932645#else /* CONFIG_SMP */···31923144 *31933145 * Unless overridden by ops.core_sched_before(), @p->scx.core_sched_at is used31943146 * to implement the default task ordering. The older the timestamp, the higher31953195- * prority the task - the global FIFO ordering matching the default scheduling31473147+ * priority the task - the global FIFO ordering matching the default scheduling31963148 * behavior.31973149 *31983150 * When ops.core_sched_before() is enabled, @p->scx.core_sched_at is used to···38993851 curr->scx.slice = 0;39003852 touch_core_sched(rq, curr);39013853 } else if (SCX_HAS_OP(tick)) {39023902- SCX_CALL_OP(SCX_KF_REST, tick, curr);38543854+ SCX_CALL_OP_TASK(SCX_KF_REST, tick, curr);39033855 }3904385639053857 if (!curr->scx.slice)···40463998 WARN_ON_ONCE(scx_get_task_state(p) != SCX_TASK_ENABLED);4047399940484000 if (SCX_HAS_OP(disable))40494049- SCX_CALL_OP(SCX_KF_REST, disable, p);40014001+ SCX_CALL_OP_TASK(SCX_KF_REST, disable, p);40504002 scx_set_task_state(p, SCX_TASK_READY);40514003}40524004···40754027 }4076402840774029 if (SCX_HAS_OP(exit_task))40784078- SCX_CALL_OP(SCX_KF_REST, exit_task, p, &args);40304030+ SCX_CALL_OP_TASK(SCX_KF_REST, exit_task, p, &args);40794031 scx_set_task_state(p, SCX_TASK_NONE);40804032}40814033···43714323 return ops_sanitize_err("cgroup_prep_move", ret);43724324}4373432543744374-void scx_move_task(struct task_struct *p)43264326+void scx_cgroup_move_task(struct task_struct *p)43754327{43764328 if (!scx_cgroup_enabled)43774377- return;43784378-43794379- /*43804380- * We're called from sched_move_task() which handles both cgroup and43814381- * autogroup moves. Ignore the latter.43824382- *43834383- * Also ignore exiting tasks, because in the exit path tasks transition43844384- * from the autogroup to the root group, so task_group_is_autogroup()43854385- * alone isn't able to catch exiting autogroup tasks. This is safe for43864386- * cgroup_move(), because cgroup migrations never happen for PF_EXITING43874387- * tasks.43884388- */43894389- if (task_group_is_autogroup(task_group(p)) || (p->flags & PF_EXITING))43904329 return;4391433043924331 /*···46254590 cgroup_warned_missing_idle = false;4626459146274592 /*46284628- * scx_tg_on/offline() are excluded thorugh scx_cgroup_rwsem. If we walk45934593+ * scx_tg_on/offline() are excluded through scx_cgroup_rwsem. If we walk46294594 * cgroups and init, all online cgroups are initialized.46304595 */46314596 rcu_read_lock();···50945059 static_branch_disable(&scx_has_op[i]);50955060 static_branch_disable(&scx_ops_enq_last);50965061 static_branch_disable(&scx_ops_enq_exiting);50625062+ static_branch_disable(&scx_ops_enq_migration_disabled);50975063 static_branch_disable(&scx_ops_cpu_preempt);50985064 static_branch_disable(&scx_builtin_idle_enabled);50995065 synchronize_rcu();···53135277 scx_get_task_state(p), p->scx.flags & ~SCX_TASK_STATE_MASK,53145278 p->scx.dsq_flags, ops_state & SCX_OPSS_STATE_MASK,53155279 ops_state >> SCX_OPSS_QSEQ_SHIFT);53165316- dump_line(s, " sticky/holding_cpu=%d/%d dsq_id=%s dsq_vtime=%llu slice=%llu",53175317- p->scx.sticky_cpu, p->scx.holding_cpu, dsq_id_buf,53185318- p->scx.dsq_vtime, p->scx.slice);52805280+ dump_line(s, " sticky/holding_cpu=%d/%d dsq_id=%s",52815281+ p->scx.sticky_cpu, p->scx.holding_cpu, dsq_id_buf);52825282+ dump_line(s, " dsq_vtime=%llu slice=%llu weight=%u",52835283+ p->scx.dsq_vtime, p->scx.slice, p->scx.weight);53195284 dump_line(s, " cpus=%*pb", cpumask_pr_args(p->cpus_ptr));5320528553215286 if (SCX_HAS_OP(dump_task)) {···5704566757055668 if (ops->flags & SCX_OPS_ENQ_EXITING)57065669 static_branch_enable(&scx_ops_enq_exiting);56705670+ if (ops->flags & SCX_OPS_ENQ_MIGRATION_DISABLED)56715671+ static_branch_enable(&scx_ops_enq_migration_disabled);57075672 if (scx_ops.cpu_acquire || scx_ops.cpu_release)57085673 static_branch_enable(&scx_ops_cpu_preempt);57095674
···16721672 * must be the same.16731673 */16741674static bool rb_meta_valid(struct ring_buffer_meta *meta, int cpu,16751675- struct trace_buffer *buffer, int nr_pages)16751675+ struct trace_buffer *buffer, int nr_pages,16761676+ unsigned long *subbuf_mask)16761677{16771678 int subbuf_size = PAGE_SIZE;16781679 struct buffer_data_page *subbuf;16791680 unsigned long buffers_start;16801681 unsigned long buffers_end;16811682 int i;16831683+16841684+ if (!subbuf_mask)16851685+ return false;1682168616831687 /* Check the meta magic and meta struct size */16841688 if (meta->magic != RING_BUFFER_META_MAGIC ||···1716171217171713 subbuf = rb_subbufs_from_meta(meta);1718171417151715+ bitmap_clear(subbuf_mask, 0, meta->nr_subbufs);17161716+17191717 /* Is the meta buffers and the subbufs themselves have correct data? */17201718 for (i = 0; i < meta->nr_subbufs; i++) {17211719 if (meta->buffers[i] < 0 ||···17311725 return false;17321726 }1733172717281728+ if (test_bit(meta->buffers[i], subbuf_mask)) {17291729+ pr_info("Ring buffer boot meta [%d] array has duplicates\n", cpu);17301730+ return false;17311731+ }17321732+17331733+ set_bit(meta->buffers[i], subbuf_mask);17341734 subbuf = (void *)subbuf + subbuf_size;17351735 }17361736···18501838 cpu_buffer->cpu);18511839 goto invalid;18521840 }18411841+18421842+ /* If the buffer has content, update pages_touched */18431843+ if (ret)18441844+ local_inc(&cpu_buffer->pages_touched);18451845+18531846 entries += ret;18541847 entry_bytes += local_read(&head_page->page->commit);18551848 local_set(&cpu_buffer->head_page->entries, ret);···19061889static void rb_range_meta_init(struct trace_buffer *buffer, int nr_pages)19071890{19081891 struct ring_buffer_meta *meta;18921892+ unsigned long *subbuf_mask;19091893 unsigned long delta;19101894 void *subbuf;19111895 int cpu;19121896 int i;18971897+18981898+ /* Create a mask to test the subbuf array */18991899+ subbuf_mask = bitmap_alloc(nr_pages + 1, GFP_KERNEL);19001900+ /* If subbuf_mask fails to allocate, then rb_meta_valid() will return false */1913190119141902 for (cpu = 0; cpu < nr_cpu_ids; cpu++) {19151903 void *next_meta;1916190419171905 meta = rb_range_meta(buffer, nr_pages, cpu);1918190619191919- if (rb_meta_valid(meta, cpu, buffer, nr_pages)) {19071907+ if (rb_meta_valid(meta, cpu, buffer, nr_pages, subbuf_mask)) {19201908 /* Make the mappings match the current address */19211909 subbuf = rb_subbufs_from_meta(meta);19221910 delta = (unsigned long)subbuf - meta->first_buffer;···19651943 subbuf += meta->subbuf_size;19661944 }19671945 }19461946+ bitmap_free(subbuf_mask);19681947}1969194819701949static void *rbm_start(struct seq_file *m, loff_t *pos)···71497126 kfree(cpu_buffer->subbuf_ids);71507127 cpu_buffer->subbuf_ids = NULL;71517128 rb_free_meta_page(cpu_buffer);71297129+ atomic_dec(&cpu_buffer->resize_disabled);71527130 }7153713171547132unlock:
+5-7
kernel/trace/trace.c
···59775977ssize_t tracing_resize_ring_buffer(struct trace_array *tr,59785978 unsigned long size, int cpu_id)59795979{59805980- int ret;59815981-59825980 guard(mutex)(&trace_types_lock);5983598159845982 if (cpu_id != RING_BUFFER_ALL_CPUS) {···59855987 return -EINVAL;59865988 }5987598959885988- ret = __tracing_resize_ring_buffer(tr, size, cpu_id);59895989- if (ret < 0)59905990- ret = -ENOMEM;59915991-59925992- return ret;59905990+ return __tracing_resize_ring_buffer(tr, size, cpu_id);59935991}5994599259955993static void update_last_data(struct trace_array *tr)···82788284 struct ftrace_buffer_info *info = filp->private_data;82798285 struct trace_iterator *iter = &info->iter;82808286 int ret = 0;82878287+82888288+ /* Currently the boot mapped buffer is not supported for mmap */82898289+ if (iter->tr->flags & TRACE_ARRAY_FL_BOOT)82908290+ return -ENODEV;8281829182828292 ret = get_snapshot_map(iter->tr);82838293 if (ret)
+6-6
kernel/workqueue.c
···35173517 }3518351835193519 /*35203520- * Put the reference grabbed by send_mayday(). @pool won't35213521- * go away while we're still attached to it.35223522- */35233523- put_pwq(pwq);35243524-35253525- /*35263520 * Leave this pool. Notify regular workers; otherwise, we end up35273521 * with 0 concurrency and stalling the execution.35283522 */···35253531 raw_spin_unlock_irq(&pool->lock);3526353235273533 worker_detach_from_pool(rescuer);35343534+35353535+ /*35363536+ * Put the reference grabbed by send_mayday(). @pool might35373537+ * go away any time after it.35383538+ */35393539+ put_pwq_unlocked(pwq);3528354035293541 raw_spin_lock_irq(&wq_mayday_lock);35303542 }
···14181418{14191419 XA_STATE(xas, xa, 0);14201420 void *entry;14211421- unsigned int order;14211421+ int order;14221422 unsigned long index = 1;14231423 unsigned int count = 0;14241424···14501450 xa_destroy(xa);1451145114521452 index = 0;14531453- for (order = XA_CHUNK_SHIFT; order > 0; order--) {14531453+ for (order = order_limit - 1; order >= 0; order--) {14541454 XA_BUG_ON(xa, xa_store_order(xa, index, order,14551455 xa_mk_index(index), GFP_KERNEL));14561456 index += 1UL << order;···14621462 rcu_read_lock();14631463 xas_for_each(&xas, entry, ULONG_MAX) {14641464 XA_BUG_ON(xa, entry != xa_mk_index(index));14651465- index += 1UL << (XA_CHUNK_SHIFT - count);14651465+ index += 1UL << (order_limit - count - 1);14661466 count++;14671467 }14681468 rcu_read_unlock();14691469- XA_BUG_ON(xa, count != XA_CHUNK_SHIFT);14691469+ XA_BUG_ON(xa, count != order_limit);1470147014711471 index = 0;14721472 count = 0;14731473- xas_set(&xas, XA_CHUNK_SIZE / 2 + 1);14731473+ /* test unaligned index */14741474+ xas_set(&xas, 1 % (1UL << (order_limit - 1)));14741475 rcu_read_lock();14751476 xas_for_each(&xas, entry, ULONG_MAX) {14761477 XA_BUG_ON(xa, entry != xa_mk_index(index));14771477- index += 1UL << (XA_CHUNK_SHIFT - count);14781478+ index += 1UL << (order_limit - count - 1);14781479 count++;14791480 xas_pause(&xas);14801481 }14811482 rcu_read_unlock();14821482- XA_BUG_ON(xa, count != XA_CHUNK_SHIFT);14831483+ XA_BUG_ON(xa, count != order_limit);1483148414841485 xa_destroy(xa);14851486
+1-1
mm/hugetlb.c
···3145314531463146 /* do node specific alloc */31473147 if (nid != NUMA_NO_NODE) {31483148- m = memblock_alloc_try_nid_raw(huge_page_size(h), huge_page_size(h),31483148+ m = memblock_alloc_exact_nid_raw(huge_page_size(h), huge_page_size(h),31493149 0, MEMBLOCK_ALLOC_ACCESSIBLE, nid);31503150 if (!m)31513151 return 0;
+33-1
mm/kasan/report.c
···370370 sizeof(init_thread_union.stack));371371}372372373373+/*374374+ * This function is invoked with report_lock (a raw_spinlock) held. A375375+ * PREEMPT_RT kernel cannot call find_vm_area() as it will acquire a sleeping376376+ * rt_spinlock.377377+ *378378+ * For !RT kernel, the PROVE_RAW_LOCK_NESTING config option will print a379379+ * lockdep warning for this raw_spinlock -> spinlock dependency. This config380380+ * option is enabled by default to ensure better test coverage to expose this381381+ * kind of RT kernel problem. This lockdep splat, however, can be suppressed382382+ * by using DEFINE_WAIT_OVERRIDE_MAP() if it serves a useful purpose and the383383+ * invalid PREEMPT_RT case has been taken care of.384384+ */385385+static inline struct vm_struct *kasan_find_vm_area(void *addr)386386+{387387+ static DEFINE_WAIT_OVERRIDE_MAP(vmalloc_map, LD_WAIT_SLEEP);388388+ struct vm_struct *va;389389+390390+ if (IS_ENABLED(CONFIG_PREEMPT_RT))391391+ return NULL;392392+393393+ /*394394+ * Suppress lockdep warning and fetch vmalloc area of the395395+ * offending address.396396+ */397397+ lock_map_acquire_try(&vmalloc_map);398398+ va = find_vm_area(addr);399399+ lock_map_release(&vmalloc_map);400400+ return va;401401+}402402+373403static void print_address_description(void *addr, u8 tag,374404 struct kasan_report_info *info)375405{···429399 }430400431401 if (is_vmalloc_addr(addr)) {432432- struct vm_struct *va = find_vm_area(addr);402402+ struct vm_struct *va = kasan_find_vm_area(addr);433403434404 if (va) {435405 pr_err("The buggy address belongs to the virtual mapping at\n"···439409 pr_err("\n");440410441411 page = vmalloc_to_page(addr);412412+ } else {413413+ pr_err("The buggy address %px belongs to a vmalloc virtual mapping\n", addr);442414 }443415 }444416
+10-1
mm/madvise.c
···933933 */934934 end = vma->vm_end;935935 }936936- VM_WARN_ON(start >= end);936936+ /*937937+ * If the memory region between start and end was938938+ * originally backed by 4kB pages and then remapped to939939+ * be backed by hugepages while mmap_lock was dropped,940940+ * the adjustment for hugetlb vma above may have rounded941941+ * end down to the start address.942942+ */943943+ if (start == end)944944+ return 0;945945+ VM_WARN_ON(start > end);937946 }938947939948 if (behavior == MADV_DONTNEED || behavior == MADV_DONTNEED_LOCKED)
···17191719 pmd_t pmdval;17201720 unsigned long start = addr;17211721 bool can_reclaim_pt = reclaim_pt_is_enabled(start, end, details);17221722- bool direct_reclaim = false;17221722+ bool direct_reclaim = true;17231723 int nr;1724172417251725retry:···17341734 do {17351735 bool any_skipped = false;1736173617371737- if (need_resched())17371737+ if (need_resched()) {17381738+ direct_reclaim = false;17381739 break;17401740+ }1739174117401742 nr = do_zap_pte_range(tlb, vma, pte, addr, end, details, rss,17411743 &force_flush, &force_break, &any_skipped);···17451743 can_reclaim_pt = false;17461744 if (unlikely(force_break)) {17471745 addr += nr * PAGE_SIZE;17461746+ direct_reclaim = false;17481747 break;17491748 }17501749 } while (pte += nr, addr += PAGE_SIZE * nr, addr != end);1751175017521752- if (can_reclaim_pt && addr == end)17511751+ /*17521752+ * Fast path: try to hold the pmd lock and unmap the PTE page.17531753+ *17541754+ * If the pte lock was released midway (retry case), or if the attempt17551755+ * to hold the pmd lock failed, then we need to recheck all pte entries17561756+ * to ensure they are still none, thereby preventing the pte entries17571757+ * from being repopulated by another thread.17581758+ */17591759+ if (can_reclaim_pt && direct_reclaim && addr == end)17531760 direct_reclaim = try_get_and_clear_pmd(mm, pmd, &pmdval);1754176117551762 add_mm_rss_vec(mm, rss);
+4-9
mm/migrate_device.c
···840840 dst = src;841841 }842842843843+ if (!folio_is_zone_device(dst))844844+ folio_add_lru(dst);843845 remove_migration_ptes(src, dst, 0);844846 folio_unlock(src);845845-846846- if (folio_is_zone_device(src))847847- folio_put(src);848848- else849849- folio_putback_lru(src);847847+ folio_put(src);850848851849 if (dst != src) {852850 folio_unlock(dst);853853- if (folio_is_zone_device(dst))854854- folio_put(dst);855855- else856856- folio_putback_lru(dst);851851+ folio_put(dst);857852 }858853 }859854}
+16-19
mm/zswap.c
···14451445* main API14461446**********************************/1447144714481448-static ssize_t zswap_store_page(struct page *page,14491449- struct obj_cgroup *objcg,14501450- struct zswap_pool *pool)14481448+static bool zswap_store_page(struct page *page,14491449+ struct obj_cgroup *objcg,14501450+ struct zswap_pool *pool)14511451{14521452 swp_entry_t page_swpentry = page_swap_entry(page);14531453 struct zswap_entry *entry, *old;···14561456 entry = zswap_entry_cache_alloc(GFP_KERNEL, page_to_nid(page));14571457 if (!entry) {14581458 zswap_reject_kmemcache_fail++;14591459- return -EINVAL;14591459+ return false;14601460 }1461146114621462 if (!zswap_compress(page, entry, pool))···1483148314841484 /*14851485 * The entry is successfully compressed and stored in the tree, there is14861486- * no further possibility of failure. Grab refs to the pool and objcg.14871487- * These refs will be dropped by zswap_entry_free() when the entry is14881488- * removed from the tree.14861486+ * no further possibility of failure. Grab refs to the pool and objcg,14871487+ * charge zswap memory, and increment zswap_stored_pages.14881488+ * The opposite actions will be performed by zswap_entry_free()14891489+ * when the entry is removed from the tree.14891490 */14901491 zswap_pool_get(pool);14911491- if (objcg)14921492+ if (objcg) {14921493 obj_cgroup_get(objcg);14941494+ obj_cgroup_charge_zswap(objcg, entry->length);14951495+ }14961496+ atomic_long_inc(&zswap_stored_pages);1493149714941498 /*14951499 * We finish initializing the entry while it's already in xarray.···15141510 zswap_lru_add(&zswap_list_lru, entry);15151511 }1516151215171517- return entry->length;15131513+ return true;1518151415191515store_failed:15201516 zpool_free(pool->zpool, entry->handle);15211517compress_failed:15221518 zswap_entry_cache_free(entry);15231523- return -EINVAL;15191519+ return false;15241520}1525152115261522bool zswap_store(struct folio *folio)···15301526 struct obj_cgroup *objcg = NULL;15311527 struct mem_cgroup *memcg = NULL;15321528 struct zswap_pool *pool;15331533- size_t compressed_bytes = 0;15341529 bool ret = false;15351530 long index;15361531···1567156415681565 for (index = 0; index < nr_pages; ++index) {15691566 struct page *page = folio_page(folio, index);15701570- ssize_t bytes;1571156715721572- bytes = zswap_store_page(page, objcg, pool);15731573- if (bytes < 0)15681568+ if (!zswap_store_page(page, objcg, pool))15741569 goto put_pool;15751575- compressed_bytes += bytes;15761570 }1577157115781578- if (objcg) {15791579- obj_cgroup_charge_zswap(objcg, compressed_bytes);15721572+ if (objcg)15801573 count_objcg_events(objcg, ZSWPOUT, nr_pages);15811581- }1582157415831583- atomic_long_add(nr_pages, &zswap_stored_pages);15841575 count_vm_events(ZSWPOUT, nr_pages);1585157615861577 ret = true;
+97-11
net/core/dev.c
···11221122 return ret;11231123}1124112411251125+static bool dev_addr_cmp(struct net_device *dev, unsigned short type,11261126+ const char *ha)11271127+{11281128+ return dev->type == type && !memcmp(dev->dev_addr, ha, dev->addr_len);11291129+}11301130+11251131/**11261132 * dev_getbyhwaddr_rcu - find a device by its hardware address11271133 * @net: the applicable net namespace···11361130 *11371131 * Search for an interface by MAC address. Returns NULL if the device11381132 * is not found or a pointer to the device.11391139- * The caller must hold RCU or RTNL.11331133+ * The caller must hold RCU.11401134 * The returned device has not had its ref count increased11411135 * and the caller must therefore be careful about locking11421136 *···11481142 struct net_device *dev;1149114311501144 for_each_netdev_rcu(net, dev)11511151- if (dev->type == type &&11521152- !memcmp(dev->dev_addr, ha, dev->addr_len))11451145+ if (dev_addr_cmp(dev, type, ha))11531146 return dev;1154114711551148 return NULL;11561149}11571150EXPORT_SYMBOL(dev_getbyhwaddr_rcu);11511151+11521152+/**11531153+ * dev_getbyhwaddr() - find a device by its hardware address11541154+ * @net: the applicable net namespace11551155+ * @type: media type of device11561156+ * @ha: hardware address11571157+ *11581158+ * Similar to dev_getbyhwaddr_rcu(), but the owner needs to hold11591159+ * rtnl_lock.11601160+ *11611161+ * Context: rtnl_lock() must be held.11621162+ * Return: pointer to the net_device, or NULL if not found11631163+ */11641164+struct net_device *dev_getbyhwaddr(struct net *net, unsigned short type,11651165+ const char *ha)11661166+{11671167+ struct net_device *dev;11681168+11691169+ ASSERT_RTNL();11701170+ for_each_netdev(net, dev)11711171+ if (dev_addr_cmp(dev, type, ha))11721172+ return dev;11731173+11741174+ return NULL;11751175+}11761176+EXPORT_SYMBOL(dev_getbyhwaddr);1158117711591178struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type)11601179{···21022071 __register_netdevice_notifier_net(dst_net, nb, true);21032072}2104207320742074+static void rtnl_net_dev_lock(struct net_device *dev)20752075+{20762076+ bool again;20772077+20782078+ do {20792079+ struct net *net;20802080+20812081+ again = false;20822082+20832083+ /* netns might be being dismantled. */20842084+ rcu_read_lock();20852085+ net = dev_net_rcu(dev);20862086+ net_passive_inc(net);20872087+ rcu_read_unlock();20882088+20892089+ rtnl_net_lock(net);20902090+20912091+#ifdef CONFIG_NET_NS20922092+ /* dev might have been moved to another netns. */20932093+ if (!net_eq(net, rcu_access_pointer(dev->nd_net.net))) {20942094+ rtnl_net_unlock(net);20952095+ net_passive_dec(net);20962096+ again = true;20972097+ }20982098+#endif20992099+ } while (again);21002100+}21012101+21022102+static void rtnl_net_dev_unlock(struct net_device *dev)21032103+{21042104+ struct net *net = dev_net(dev);21052105+21062106+ rtnl_net_unlock(net);21072107+ net_passive_dec(net);21082108+}21092109+21052110int register_netdevice_notifier_dev_net(struct net_device *dev,21062111 struct notifier_block *nb,21072112 struct netdev_net_notifier *nn)21082113{21092114 struct net *net = dev_net(dev);21102115 int err;21162116+21172117+ /* rtnl_net_lock() assumes dev is not yet published by21182118+ * register_netdevice().21192119+ */21202120+ DEBUG_NET_WARN_ON_ONCE(!list_empty(&dev->dev_list));2111212121122122 rtnl_net_lock(net);21132123 err = __register_netdevice_notifier_net(net, nb, false);···21662094 struct notifier_block *nb,21672095 struct netdev_net_notifier *nn)21682096{21692169- struct net *net = dev_net(dev);21702097 int err;2171209821722172- rtnl_net_lock(net);20992099+ rtnl_net_dev_lock(dev);21732100 list_del(&nn->list);21742174- err = __unregister_netdevice_notifier_net(net, nb);21752175- rtnl_net_unlock(net);21012101+ err = __unregister_netdevice_notifier_net(dev_net(dev), nb);21022102+ rtnl_net_dev_unlock(dev);2176210321772104 return err;21782105}···69946923 higher = &pos->dev_list;69956924 }69966925 list_add_rcu(&napi->dev_list, higher); /* adds after higher */69266926+}69276927+69286928+/* Double check that napi_get_frags() allocates skbs with69296929+ * skb->head being backed by slab, not a page fragment.69306930+ * This is to make sure bug fixed in 3226b158e67c69316931+ * ("net: avoid 32 x truesize under-estimation for tiny skbs")69326932+ * does not accidentally come back.69336933+ */69346934+static void napi_get_frags_check(struct napi_struct *napi)69356935+{69366936+ struct sk_buff *skb;69376937+69386938+ local_bh_disable();69396939+ skb = napi_get_frags(napi);69406940+ WARN_ON_ONCE(skb && skb->head_frag);69416941+ napi_free_frags(napi);69426942+ local_bh_enable();69976943}6998694469996945void netif_napi_add_weight_locked(struct net_device *dev,···1198911901 */1199011902void unregister_netdev(struct net_device *dev)1199111903{1199211992- struct net *net = dev_net(dev);1199311993-1199411994- rtnl_net_lock(net);1190411904+ rtnl_net_dev_lock(dev);1199511905 unregister_netdevice(dev);1199611996- rtnl_net_unlock(net);1190611906+ rtnl_net_dev_unlock(dev);1199711907}1199811908EXPORT_SYMBOL(unregister_netdev);1199911909
+19-20
net/core/drop_monitor.c
···17341734 return -ENOSPC;17351735 }1736173617371737- rc = genl_register_family(&net_drop_monitor_family);17381738- if (rc) {17391739- pr_err("Could not create drop monitor netlink family\n");17401740- return rc;17411741- }17421742- WARN_ON(net_drop_monitor_family.mcgrp_offset != NET_DM_GRP_ALERT);17431743-17441744- rc = register_netdevice_notifier(&dropmon_net_notifier);17451745- if (rc < 0) {17461746- pr_crit("Failed to register netdevice notifier\n");17471747- goto out_unreg;17481748- }17491749-17501750- rc = 0;17511751-17521737 for_each_possible_cpu(cpu) {17531738 net_dm_cpu_data_init(cpu);17541739 net_dm_hw_cpu_data_init(cpu);17551740 }1756174117421742+ rc = register_netdevice_notifier(&dropmon_net_notifier);17431743+ if (rc < 0) {17441744+ pr_crit("Failed to register netdevice notifier\n");17451745+ return rc;17461746+ }17471747+17481748+ rc = genl_register_family(&net_drop_monitor_family);17491749+ if (rc) {17501750+ pr_err("Could not create drop monitor netlink family\n");17511751+ goto out_unreg;17521752+ }17531753+ WARN_ON(net_drop_monitor_family.mcgrp_offset != NET_DM_GRP_ALERT);17541754+17551755+ rc = 0;17561756+17571757 goto out;1758175817591759out_unreg:17601760- genl_unregister_family(&net_drop_monitor_family);17601760+ WARN_ON(unregister_netdevice_notifier(&dropmon_net_notifier));17611761out:17621762 return rc;17631763}···17661766{17671767 int cpu;1768176817691769- BUG_ON(unregister_netdevice_notifier(&dropmon_net_notifier));17701770-17711769 /*17721770 * Because of the module_get/put we do in the trace state change path17731771 * we are guaranteed not to have any current users when we get here17741772 */17731773+ BUG_ON(genl_unregister_family(&net_drop_monitor_family));17741774+17751775+ BUG_ON(unregister_netdevice_notifier(&dropmon_net_notifier));1775177617761777 for_each_possible_cpu(cpu) {17771778 net_dm_hw_cpu_data_fini(cpu);17781779 net_dm_cpu_data_fini(cpu);17791780 }17801780-17811781- BUG_ON(genl_unregister_family(&net_drop_monitor_family));17821781}1783178217841783module_init(init_net_drop_monitor);
···7788#define MAX_GRO_SKBS 8991010-/* This should be increased if a protocol with a bigger head is added. */1111-#define GRO_MAX_HEAD (MAX_HEADER + 128)1212-1310static DEFINE_SPINLOCK(offload_lock);14111512/**
+4-4
net/core/net_namespace.c
···464464465465}466466467467-static void net_free(struct net *net)467467+void net_passive_dec(struct net *net)468468{469469 if (refcount_dec_and_test(&net->passive)) {470470 kfree(rcu_access_pointer(net->gen));···482482 struct net *net = (struct net *)p;483483484484 if (net)485485- net_free(net);485485+ net_passive_dec(net);486486}487487488488struct net *copy_net_ns(unsigned long flags,···523523 key_remove_domain(net->key_domain);524524#endif525525 put_user_ns(user_ns);526526- net_free(net);526526+ net_passive_dec(net);527527dec_ucounts:528528 dec_net_namespaces(ucounts);529529 return ERR_PTR(rv);···672672 key_remove_domain(net->key_domain);673673#endif674674 put_user_ns(net->user_ns);675675- net_free(net);675675+ net_passive_dec(net);676676 }677677 cleanup_net_task = NULL;678678}
+10-100
net/core/skbuff.c
···6969#include <net/dst.h>7070#include <net/sock.h>7171#include <net/checksum.h>7272+#include <net/gro.h>7273#include <net/gso.h>7374#include <net/hotdata.h>7475#include <net/ip6_checksum.h>···9695static struct kmem_cache *skbuff_ext_cache __ro_after_init;9796#endif98979999-#define SKB_SMALL_HEAD_SIZE SKB_HEAD_ALIGN(MAX_TCP_HEADER)9898+#define GRO_MAX_HEAD_PAD (GRO_MAX_HEAD + NET_SKB_PAD + NET_IP_ALIGN)9999+#define SKB_SMALL_HEAD_SIZE SKB_HEAD_ALIGN(max(MAX_TCP_HEADER, \100100+ GRO_MAX_HEAD_PAD))100101101102/* We want SKB_SMALL_HEAD_CACHE_SIZE to not be a power of two.102103 * This should ensure that SKB_SMALL_HEAD_HEADROOM is a unique···223220#define NAPI_SKB_CACHE_BULK 16224221#define NAPI_SKB_CACHE_HALF (NAPI_SKB_CACHE_SIZE / 2)225222226226-#if PAGE_SIZE == SZ_4K227227-228228-#define NAPI_HAS_SMALL_PAGE_FRAG 1229229-#define NAPI_SMALL_PAGE_PFMEMALLOC(nc) ((nc).pfmemalloc)230230-231231-/* specialized page frag allocator using a single order 0 page232232- * and slicing it into 1K sized fragment. Constrained to systems233233- * with a very limited amount of 1K fragments fitting a single234234- * page - to avoid excessive truesize underestimation235235- */236236-237237-struct page_frag_1k {238238- void *va;239239- u16 offset;240240- bool pfmemalloc;241241-};242242-243243-static void *page_frag_alloc_1k(struct page_frag_1k *nc, gfp_t gfp)244244-{245245- struct page *page;246246- int offset;247247-248248- offset = nc->offset - SZ_1K;249249- if (likely(offset >= 0))250250- goto use_frag;251251-252252- page = alloc_pages_node(NUMA_NO_NODE, gfp, 0);253253- if (!page)254254- return NULL;255255-256256- nc->va = page_address(page);257257- nc->pfmemalloc = page_is_pfmemalloc(page);258258- offset = PAGE_SIZE - SZ_1K;259259- page_ref_add(page, offset / SZ_1K);260260-261261-use_frag:262262- nc->offset = offset;263263- return nc->va + offset;264264-}265265-#else266266-267267-/* the small page is actually unused in this build; add dummy helpers268268- * to please the compiler and avoid later preprocessor's conditionals269269- */270270-#define NAPI_HAS_SMALL_PAGE_FRAG 0271271-#define NAPI_SMALL_PAGE_PFMEMALLOC(nc) false272272-273273-struct page_frag_1k {274274-};275275-276276-static void *page_frag_alloc_1k(struct page_frag_1k *nc, gfp_t gfp_mask)277277-{278278- return NULL;279279-}280280-281281-#endif282282-283223struct napi_alloc_cache {284224 local_lock_t bh_lock;285225 struct page_frag_cache page;286286- struct page_frag_1k page_small;287226 unsigned int skb_count;288227 void *skb_cache[NAPI_SKB_CACHE_SIZE];289228};···234289static DEFINE_PER_CPU(struct napi_alloc_cache, napi_alloc_cache) = {235290 .bh_lock = INIT_LOCAL_LOCK(bh_lock),236291};237237-238238-/* Double check that napi_get_frags() allocates skbs with239239- * skb->head being backed by slab, not a page fragment.240240- * This is to make sure bug fixed in 3226b158e67c241241- * ("net: avoid 32 x truesize under-estimation for tiny skbs")242242- * does not accidentally come back.243243- */244244-void napi_get_frags_check(struct napi_struct *napi)245245-{246246- struct sk_buff *skb;247247-248248- local_bh_disable();249249- skb = napi_get_frags(napi);250250- WARN_ON_ONCE(!NAPI_HAS_SMALL_PAGE_FRAG && skb && skb->head_frag);251251- napi_free_frags(napi);252252- local_bh_enable();253253-}254292255293void *__napi_alloc_frag_align(unsigned int fragsz, unsigned int align_mask)256294{···664736 /* If requested length is either too small or too big,665737 * we use kmalloc() for skb->head allocation.666738 */667667- if (len <= SKB_WITH_OVERHEAD(1024) ||739739+ if (len <= SKB_WITH_OVERHEAD(SKB_SMALL_HEAD_CACHE_SIZE) ||668740 len > SKB_WITH_OVERHEAD(PAGE_SIZE) ||669741 (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) {670742 skb = __alloc_skb(len, gfp_mask, SKB_ALLOC_RX, NUMA_NO_NODE);···741813742814 /* If requested length is either too small or too big,743815 * we use kmalloc() for skb->head allocation.744744- * When the small frag allocator is available, prefer it over kmalloc745745- * for small fragments746816 */747747- if ((!NAPI_HAS_SMALL_PAGE_FRAG && len <= SKB_WITH_OVERHEAD(1024)) ||817817+ if (len <= SKB_WITH_OVERHEAD(SKB_SMALL_HEAD_CACHE_SIZE) ||748818 len > SKB_WITH_OVERHEAD(PAGE_SIZE) ||749819 (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) {750820 skb = __alloc_skb(len, gfp_mask, SKB_ALLOC_RX | SKB_ALLOC_NAPI,···752826 goto skb_success;753827 }754828829829+ len = SKB_HEAD_ALIGN(len);830830+755831 if (sk_memalloc_socks())756832 gfp_mask |= __GFP_MEMALLOC;757833758834 local_lock_nested_bh(&napi_alloc_cache.bh_lock);759835 nc = this_cpu_ptr(&napi_alloc_cache);760760- if (NAPI_HAS_SMALL_PAGE_FRAG && len <= SKB_WITH_OVERHEAD(1024)) {761761- /* we are artificially inflating the allocation size, but762762- * that is not as bad as it may look like, as:763763- * - 'len' less than GRO_MAX_HEAD makes little sense764764- * - On most systems, larger 'len' values lead to fragment765765- * size above 512 bytes766766- * - kmalloc would use the kmalloc-1k slab for such values767767- * - Builds with smaller GRO_MAX_HEAD will very likely do768768- * little networking, as that implies no WiFi and no769769- * tunnels support, and 32 bits arches.770770- */771771- len = SZ_1K;772836773773- data = page_frag_alloc_1k(&nc->page_small, gfp_mask);774774- pfmemalloc = NAPI_SMALL_PAGE_PFMEMALLOC(nc->page_small);775775- } else {776776- len = SKB_HEAD_ALIGN(len);777777-778778- data = page_frag_alloc(&nc->page, len, gfp_mask);779779- pfmemalloc = page_frag_cache_is_pfmemalloc(&nc->page);780780- }837837+ data = page_frag_alloc(&nc->page, len, gfp_mask);838838+ pfmemalloc = page_frag_cache_is_pfmemalloc(&nc->page);781839 local_unlock_nested_bh(&napi_alloc_cache.bh_lock);782840783841 if (unlikely(!data))
···97979898 err = xa_alloc_cyclic(&tcf_exts_miss_cookies_xa, &n->miss_cookie_base,9999 n, xa_limit_32b, &next, GFP_KERNEL);100100- if (err)100100+ if (err < 0)101101 goto err_xa_alloc;102102103103 exts->miss_cookie_node = n;
+1-1
net/sctp/stream.c
···735735 * value SHOULD be the smallest TSN not acknowledged by the736736 * receiver of the request plus 2^31.737737 */738738- init_tsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map) + (1 << 31);738738+ init_tsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map) + (1U << 31);739739 sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_INITIAL,740740 init_tsn, GFP_ATOMIC);741741
···11+// SPDX-License-Identifier: GPL-2.0-only22+33+//! Abstractions for the faux bus.44+//!55+//! This module provides bindings for working with faux devices in kernel modules.66+//!77+//! C header: [`include/linux/device/faux.h`]88+99+use crate::{bindings, device, error::code::*, prelude::*};1010+use core::ptr::{addr_of_mut, null, null_mut, NonNull};1111+1212+/// The registration of a faux device.1313+///1414+/// This type represents the registration of a [`struct faux_device`]. When an instance of this type1515+/// is dropped, its respective faux device will be unregistered from the system.1616+///1717+/// # Invariants1818+///1919+/// `self.0` always holds a valid pointer to an initialized and registered [`struct faux_device`].2020+///2121+/// [`struct faux_device`]: srctree/include/linux/device/faux.h2222+#[repr(transparent)]2323+pub struct Registration(NonNull<bindings::faux_device>);2424+2525+impl Registration {2626+ /// Create and register a new faux device with the given name.2727+ pub fn new(name: &CStr) -> Result<Self> {2828+ // SAFETY:2929+ // - `name` is copied by this function into its own storage3030+ // - `faux_ops` is safe to leave NULL according to the C API3131+ let dev = unsafe { bindings::faux_device_create(name.as_char_ptr(), null_mut(), null()) };3232+3333+ // The above function will return either a valid device, or NULL on failure3434+ // INVARIANT: The device will remain registered until faux_device_destroy() is called, which3535+ // happens in our Drop implementation.3636+ Ok(Self(NonNull::new(dev).ok_or(ENODEV)?))3737+ }3838+3939+ fn as_raw(&self) -> *mut bindings::faux_device {4040+ self.0.as_ptr()4141+ }4242+}4343+4444+impl AsRef<device::Device> for Registration {4545+ fn as_ref(&self) -> &device::Device {4646+ // SAFETY: The underlying `device` in `faux_device` is guaranteed by the C API to be4747+ // a valid initialized `device`.4848+ unsafe { device::Device::as_ref(addr_of_mut!((*self.as_raw()).dev)) }4949+ }5050+}5151+5252+impl Drop for Registration {5353+ fn drop(&mut self) {5454+ // SAFETY: `self.0` is a valid registered faux_device via our type invariants.5555+ unsafe { bindings::faux_device_destroy(self.as_raw()) }5656+ }5757+}5858+5959+// SAFETY: The faux device API is thread-safe as guaranteed by the device core, as long as6060+// faux_device_destroy() is guaranteed to only be called once - which is guaranteed by our type not6161+// having Copy/Clone.6262+unsafe impl Send for Registration {}6363+6464+// SAFETY: The faux device API is thread-safe as guaranteed by the device core, as long as6565+// faux_device_destroy() is guaranteed to only be called once - which is guaranteed by our type not6666+// having Copy/Clone.6767+unsafe impl Sync for Registration {}
+1
rust/kernel/lib.rs
···4646pub mod devres;4747pub mod driver;4848pub mod error;4949+pub mod faux;4950#[cfg(CONFIG_RUST_FW_LOADER_ABSTRACTIONS)]5051pub mod firmware;5152pub mod fs;
+1-1
rust/kernel/rbtree.rs
···11491149/// # Invariants11501150/// - `parent` may be null if the new node becomes the root.11511151/// - `child_field_of_parent` is a valid pointer to the left-child or right-child of `parent`. If `parent` is11521152-/// null, it is a pointer to the root of the [`RBTree`].11521152+/// null, it is a pointer to the root of the [`RBTree`].11531153struct RawVacantEntry<'a, K, V> {11541154 rbtree: *mut RBTree<K, V>,11551155 /// The node that will become the parent of the new node if we insert one.
+10
samples/rust/Kconfig
···61616262 If unsure, say N.63636464+config SAMPLE_RUST_DRIVER_FAUX6565+ tristate "Faux Driver"6666+ help6767+ This option builds the Rust Faux driver sample.6868+6969+ To compile this as a module, choose M here:7070+ the module will be called rust_driver_faux.7171+7272+ If unsure, say N.7373+6474config SAMPLE_RUST_HOSTPROGS6575 bool "Host programs"6676 help
···190190191191 /*192192 * Set mod->is_gpl_compatible to true by default. If MODULE_LICENSE()193193- * is missing, do not check the use for EXPORT_SYMBOL_GPL() becasue194194- * modpost will exit wiht error anyway.193193+ * is missing, do not check the use for EXPORT_SYMBOL_GPL() because194194+ * modpost will exit with an error anyway.195195 */196196 mod->is_gpl_compatible = true;197197
+2-2
scripts/package/install-extmod-build
···6262 #6363 # Clear VPATH and srcroot because the source files reside in the output6464 # directory.6565- # shellcheck disable=SC2016 # $(MAKE), $(CC), and $(build) will be expanded by Make6666- "${MAKE}" run-command KBUILD_RUN_COMMAND='+$(MAKE) HOSTCC="$(CC)" VPATH= srcroot=. $(build)='"${destdir}"/scripts6565+ # shellcheck disable=SC2016 # $(MAKE) and $(build) will be expanded by Make6666+ "${MAKE}" run-command KBUILD_RUN_COMMAND='+$(MAKE) HOSTCC='"${CC}"' VPATH= srcroot=. $(build)='"${destdir}"/scripts67676868 rm -f "${destdir}/scripts/Kbuild"6969fi
···967967 case ARIZONA_OUT3L_ENA_SHIFT:968968 case ARIZONA_OUT3R_ENA_SHIFT:969969 priv->out_up_pending++;970970- priv->out_up_delay += 17;970970+ priv->out_up_delay += 17000;971971 break;972972 case ARIZONA_OUT4L_ENA_SHIFT:973973 case ARIZONA_OUT4R_ENA_SHIFT:···977977 case WM8997:978978 break;979979 default:980980- priv->out_up_delay += 10;980980+ priv->out_up_delay += 10000;981981 break;982982 }983983 break;···999999 if (!priv->out_up_pending && priv->out_up_delay) {10001000 dev_dbg(component->dev, "Power up delay: %d\n",10011001 priv->out_up_delay);10021002- msleep(priv->out_up_delay);10021002+ fsleep(priv->out_up_delay);10031003 priv->out_up_delay = 0;10041004 }10051005 break;···10171017 case ARIZONA_OUT3L_ENA_SHIFT:10181018 case ARIZONA_OUT3R_ENA_SHIFT:10191019 priv->out_down_pending++;10201020- priv->out_down_delay++;10201020+ priv->out_down_delay += 1000;10211021 break;10221022 case ARIZONA_OUT4L_ENA_SHIFT:10231023 case ARIZONA_OUT4R_ENA_SHIFT:···10281028 break;10291029 case WM8998:10301030 case WM1814:10311031- priv->out_down_delay += 5;10311031+ priv->out_down_delay += 5000;10321032 break;10331033 default:10341034- priv->out_down_delay++;10341034+ priv->out_down_delay += 1000;10351035 break;10361036 }10371037 break;···10531053 if (!priv->out_down_pending && priv->out_down_delay) {10541054 dev_dbg(component->dev, "Power down delay: %d\n",10551055 priv->out_down_delay);10561056- msleep(priv->out_down_delay);10561056+ fsleep(priv->out_down_delay);10571057 priv->out_down_delay = 0;10581058 }10591059 break;
+23-7
sound/soc/codecs/cs35l41.c
···11481148 return ret;11491149}1150115011511151+#ifdef CONFIG_ACPI11511152static int cs35l41_acpi_get_name(struct cs35l41_private *cs35l41)11521153{11531153- acpi_handle handle = ACPI_HANDLE(cs35l41->dev);11541154+ struct acpi_device *adev = ACPI_COMPANION(cs35l41->dev);11551155+ acpi_handle handle = acpi_device_handle(adev);11561156+ const char *hid;11541157 const char *sub;1155115811561156- /* If there is no ACPI_HANDLE, there is no ACPI for this system, return 0 */11571157- if (!handle)11591159+ /* If there is no acpi_device, there is no ACPI for this system, return 0 */11601160+ if (!adev)11581161 return 0;1159116211601163 sub = acpi_get_subsystem_id(handle);11611164 if (IS_ERR(sub)) {11621162- /* If bad ACPI, return 0 and fallback to legacy firmware path, otherwise fail */11631163- if (PTR_ERR(sub) == -ENODATA)11641164- return 0;11651165- else11651165+ /* If no _SUB, fallback to _HID, otherwise fail */11661166+ if (PTR_ERR(sub) == -ENODATA) {11671167+ hid = acpi_device_hid(adev);11681168+ /* If dummy hid, return 0 and fallback to legacy firmware path */11691169+ if (!strcmp(hid, "device"))11701170+ return 0;11711171+ sub = kstrdup(hid, GFP_KERNEL);11721172+ if (!sub)11731173+ sub = ERR_PTR(-ENOMEM);11741174+11751175+ } else11661176 return PTR_ERR(sub);11671177 }11681178···1181117111821172 return 0;11831173}11741174+#else11751175+static int cs35l41_acpi_get_name(struct cs35l41_private *cs35l41)11761176+{11771177+ return 0;11781178+}11791179+#endif /* CONFIG_ACPI */1184118011851181int cs35l41_probe(struct cs35l41_private *cs35l41, const struct cs35l41_hw_cfg *hw_cfg)11861182{
···1111 * Hardware interface for Audio DSP on Vangogh platform1212 */13131414-#include <linux/platform_device.h>1414+#include <linux/delay.h>1515#include <linux/module.h>16161717-#include "../ops.h"1818-#include "../sof-audio.h"1917#include "acp.h"2020-#include "acp-dsp-offset.h"21182219#define I2S_HS_INSTANCE 02320#define I2S_BT_INSTANCE 1···133136 },134137};135138139139+static int sof_vangogh_post_fw_run_delay(struct snd_sof_dev *sdev)140140+{141141+ /*142142+ * Resuming from suspend in some cases my cause the DSP firmware143143+ * to enter an unrecoverable faulty state. Delaying a bit any host144144+ * to DSP transmission right after firmware boot completion seems145145+ * to resolve the issue.146146+ */147147+ if (!sdev->first_boot)148148+ usleep_range(100, 150);149149+150150+ return 0;151151+}152152+136153/* Vangogh ops */137154struct snd_sof_dsp_ops sof_vangogh_ops;138155EXPORT_SYMBOL_NS(sof_vangogh_ops, "SND_SOC_SOF_AMD_COMMON");···168157169158 if (quirks->signed_fw_image)170159 sof_vangogh_ops.load_firmware = acp_sof_load_signed_firmware;160160+161161+ if (quirks->post_fw_run_delay)162162+ sof_vangogh_ops.post_fw_run = sof_vangogh_post_fw_run_delay;171163 }172164173165 return 0;
···11-#!/bin/sh11+#!/bin/bash22# SPDX-License-Identifier: GPL-2.033#44# Test the special cpuset v1 hotplug case where a cpuset become empty of
+32-15
tools/testing/selftests/kvm/x86/hyperv_cpuid.c
···4141 return res;4242}43434444-static void test_hv_cpuid(const struct kvm_cpuid2 *hv_cpuid_entries,4545- bool evmcs_expected)4444+static void test_hv_cpuid(struct kvm_vcpu *vcpu, bool evmcs_expected)4645{4646+ const bool has_irqchip = !vcpu || vcpu->vm->has_irqchip;4747+ const struct kvm_cpuid2 *hv_cpuid_entries;4748 int i;4849 int nent_expected = 10;4950 u32 test_val;5151+5252+ if (vcpu)5353+ hv_cpuid_entries = vcpu_get_supported_hv_cpuid(vcpu);5454+ else5555+ hv_cpuid_entries = kvm_get_supported_hv_cpuid();50565157 TEST_ASSERT(hv_cpuid_entries->nent == nent_expected,5258 "KVM_GET_SUPPORTED_HV_CPUID should return %d entries"···8680 entry->eax, evmcs_expected8781 );8882 break;8383+ case 0x40000003:8484+ TEST_ASSERT(has_irqchip || !(entry->edx & BIT(19)),8585+ "\"Direct\" Synthetic Timers should require in-kernel APIC");8686+ break;8987 case 0x40000004:9088 test_val = entry->eax & (1UL << 18);91899290 TEST_ASSERT(!!test_val == !smt_possible(),9391 "NoNonArchitecturalCoreSharing bit"9492 " doesn't reflect SMT setting");9393+9494+ TEST_ASSERT(has_irqchip || !(entry->eax & BIT(10)),9595+ "Cluster IPI (i.e. SEND_IPI) should require in-kernel APIC");9596 break;9697 case 0x4000000A:9798 TEST_ASSERT(entry->eax & (1UL << 19),···122109 * entry->edx);123110 */124111 }112112+113113+ /*114114+ * Note, the CPUID array returned by the system-scoped helper is a one-115115+ * time allocation, i.e. must not be freed.116116+ */117117+ if (vcpu)118118+ free((void *)hv_cpuid_entries);125119}126120127127-void test_hv_cpuid_e2big(struct kvm_vm *vm, struct kvm_vcpu *vcpu)121121+static void test_hv_cpuid_e2big(struct kvm_vm *vm, struct kvm_vcpu *vcpu)128122{129123 static struct kvm_cpuid2 cpuid = {.nent = 0};130124 int ret;···149129int main(int argc, char *argv[])150130{151131 struct kvm_vm *vm;152152- const struct kvm_cpuid2 *hv_cpuid_entries;153132 struct kvm_vcpu *vcpu;154133155134 TEST_REQUIRE(kvm_has_cap(KVM_CAP_HYPERV_CPUID));156135157157- vm = vm_create_with_one_vcpu(&vcpu, guest_code);136136+ /* Test the vCPU ioctl without an in-kernel local APIC. */137137+ vm = vm_create_barebones();138138+ vcpu = __vm_vcpu_add(vm, 0);139139+ test_hv_cpuid(vcpu, false);140140+ kvm_vm_free(vm);158141159142 /* Test vCPU ioctl version */143143+ vm = vm_create_with_one_vcpu(&vcpu, guest_code);160144 test_hv_cpuid_e2big(vm, vcpu);161161-162162- hv_cpuid_entries = vcpu_get_supported_hv_cpuid(vcpu);163163- test_hv_cpuid(hv_cpuid_entries, false);164164- free((void *)hv_cpuid_entries);145145+ test_hv_cpuid(vcpu, false);165146166147 if (!kvm_cpu_has(X86_FEATURE_VMX) ||167148 !kvm_has_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) {···170149 goto do_sys;171150 }172151 vcpu_enable_evmcs(vcpu);173173- hv_cpuid_entries = vcpu_get_supported_hv_cpuid(vcpu);174174- test_hv_cpuid(hv_cpuid_entries, true);175175- free((void *)hv_cpuid_entries);152152+ test_hv_cpuid(vcpu, true);176153177154do_sys:178155 /* Test system ioctl version */···180161 }181162182163 test_hv_cpuid_e2big(vm, NULL);183183-184184- hv_cpuid_entries = kvm_get_supported_hv_cpuid();185185- test_hv_cpuid(hv_cpuid_entries, kvm_cpu_has(X86_FEATURE_VMX));164164+ test_hv_cpuid(NULL, kvm_cpu_has(X86_FEATURE_VMX));186165187166out:188167 kvm_vm_free(vm);
+1-1
tools/testing/selftests/mm/run_vmtests.sh
···220220 if test_selected ${CATEGORY}; then221221 # On memory constrainted systems some tests can fail to allocate hugepages.222222 # perform some cleanup before the test for a higher success rate.223223- if [ ${CATEGORY} == "thp" ] | [ ${CATEGORY} == "hugetlb" ]; then223223+ if [ ${CATEGORY} == "thp" -o ${CATEGORY} == "hugetlb" ]; then224224 echo 3 > /proc/sys/vm/drop_caches225225 sleep 2226226 echo 1 > /proc/sys/vm/compact_memory
···49495050 SCX_ASSERT(is_cpu_online());51515252- skel = hotplug__open_and_load();5353- SCX_ASSERT(skel);5252+ skel = hotplug__open();5353+ SCX_FAIL_IF(!skel, "Failed to open");5454+ SCX_ENUM_INIT(skel);5555+ SCX_FAIL_IF(hotplug__load(skel), "Failed to load skel");54565557 /* Testing the offline -> online path, so go offline before starting */5658 if (onlining)
···15151616#define SCHED_EXT 717171818-static struct init_enable_count *1919-open_load_prog(bool global)2020-{2121- struct init_enable_count *skel;2222-2323- skel = init_enable_count__open();2424- SCX_BUG_ON(!skel, "Failed to open skel");2525-2626- if (!global)2727- skel->struct_ops.init_enable_count_ops->flags |= SCX_OPS_SWITCH_PARTIAL;2828-2929- SCX_BUG_ON(init_enable_count__load(skel), "Failed to load skel");3030-3131- return skel;3232-}3333-3418static enum scx_test_status run_test(bool global)3519{3620 struct init_enable_count *skel;···2440 struct sched_param param = {};2541 pid_t pids[num_pre_forks];26422727- skel = open_load_prog(global);4343+ skel = init_enable_count__open();4444+ SCX_FAIL_IF(!skel, "Failed to open");4545+ SCX_ENUM_INIT(skel);4646+4747+ if (!global)4848+ skel->struct_ops.init_enable_count_ops->flags |= SCX_OPS_SWITCH_PARTIAL;4949+5050+ SCX_FAIL_IF(init_enable_count__load(skel), "Failed to load skel");28512952 /*3053 * Fork a bunch of children before we attach the scheduler so that we···150159151160struct scx_test init_enable_count = {152161 .name = "init_enable_count",153153- .description = "Verify we do the correct amount of counting of init, "162162+ .description = "Verify we correctly count the occurrences of init, "154163 "enable, etc callbacks.",155164 .run = run,156165};
+5-2
tools/testing/selftests/sched_ext/maximal.c
···1414{1515 struct maximal *skel;16161717- skel = maximal__open_and_load();1818- SCX_FAIL_IF(!skel, "Failed to open and load skel");1717+ skel = maximal__open();1818+ SCX_FAIL_IF(!skel, "Failed to open");1919+ SCX_ENUM_INIT(skel);2020+ SCX_FAIL_IF(maximal__load(skel), "Failed to load skel");2121+1922 *ctx = skel;20232124 return SCX_TEST_PASS;
+1-1
tools/testing/selftests/sched_ext/maybe_null.c
···43434444struct scx_test maybe_null = {4545 .name = "maybe_null",4646- .description = "Verify if PTR_MAYBE_NULL work for .dispatch",4646+ .description = "Verify if PTR_MAYBE_NULL works for .dispatch",4747 .run = run,4848};4949REGISTER_SCX_TEST(&maybe_null)
+5-5
tools/testing/selftests/sched_ext/minimal.c
···1515{1616 struct minimal *skel;17171818- skel = minimal__open_and_load();1919- if (!skel) {2020- SCX_ERR("Failed to open and load skel");2121- return SCX_TEST_FAIL;2222- }1818+ skel = minimal__open();1919+ SCX_FAIL_IF(!skel, "Failed to open");2020+ SCX_ENUM_INIT(skel);2121+ SCX_FAIL_IF(minimal__load(skel), "Failed to load skel");2222+2323 *ctx = skel;24242525 return SCX_TEST_PASS;
+5-5
tools/testing/selftests/sched_ext/prog_run.c
···1515{1616 struct prog_run *skel;17171818- skel = prog_run__open_and_load();1919- if (!skel) {2020- SCX_ERR("Failed to open and load skel");2121- return SCX_TEST_FAIL;2222- }1818+ skel = prog_run__open();1919+ SCX_FAIL_IF(!skel, "Failed to open");2020+ SCX_ENUM_INIT(skel);2121+ SCX_FAIL_IF(prog_run__load(skel), "Failed to load skel");2222+2323 *ctx = skel;24242525 return SCX_TEST_PASS;
+4-5
tools/testing/selftests/sched_ext/reload_loop.c
···18181919static enum scx_test_status setup(void **ctx)2020{2121- skel = maximal__open_and_load();2222- if (!skel) {2323- SCX_ERR("Failed to open and load skel");2424- return SCX_TEST_FAIL;2525- }2121+ skel = maximal__open();2222+ SCX_FAIL_IF(!skel, "Failed to open");2323+ SCX_ENUM_INIT(skel);2424+ SCX_FAIL_IF(maximal__load(skel), "Failed to load skel");26252726 return SCX_TEST_PASS;2827}