diff --git a/patch/kernel/sunxi-current/patch1-5.7.8-9.patch b/patch/kernel/sunxi-current/patch1-5.7.8-9.patch deleted file mode 100644 index ff65b1b028..0000000000 --- a/patch/kernel/sunxi-current/patch1-5.7.8-9.patch +++ /dev/null @@ -1,7856 +0,0 @@ -diff --git a/Makefile b/Makefile -index 6163d607ca72..fb3a747575b5 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 7 --SUBLEVEL = 8 -+SUBLEVEL = 9 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/arc/include/asm/elf.h b/arch/arc/include/asm/elf.h -index c77a0e3671ac..0284ace0e1ab 100644 ---- a/arch/arc/include/asm/elf.h -+++ b/arch/arc/include/asm/elf.h -@@ -19,7 +19,7 @@ - #define R_ARC_32_PCREL 0x31 - - /*to set parameters in the core dumps */ --#define ELF_ARCH EM_ARCOMPACT -+#define ELF_ARCH EM_ARC_INUSE - #define ELF_CLASS ELFCLASS32 - - #ifdef CONFIG_CPU_BIG_ENDIAN -diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S -index 60406ec62eb8..ea00c8a17f07 100644 ---- a/arch/arc/kernel/entry.S -+++ b/arch/arc/kernel/entry.S -@@ -165,7 +165,6 @@ END(EV_Extension) - tracesys: - ; save EFA in case tracer wants the PC of traced task - ; using ERET won't work since next-PC has already committed -- lr r12, [efa] - GET_CURR_TASK_FIELD_PTR TASK_THREAD, r11 - st r12, [r11, THREAD_FAULT_ADDR] ; thread.fault_address - -@@ -208,15 +207,9 @@ tracesys_exit: - ; Breakpoint TRAP - ; --------------------------------------------- - trap_with_param: -- -- ; stop_pc info by gdb needs this info -- lr r0, [efa] -+ mov r0, r12 ; EFA in case ptracer/gdb wants stop_pc - mov r1, sp - -- ; Now that we have read EFA, it is safe to do "fake" rtie -- ; and get out of CPU exception mode -- FAKE_RET_FROM_EXCPN -- - ; Save callee regs in case gdb wants to have a look - ; SP will grow up by size of CALLEE Reg-File - ; NOTE: clobbers r12 -@@ -243,6 +236,10 @@ ENTRY(EV_Trap) - - EXCEPTION_PROLOGUE - -+ lr r12, [efa] -+ -+ FAKE_RET_FROM_EXCPN -+ - ;============ TRAP 1 :breakpoints - ; Check ECR for trap with arg (PROLOGUE ensures r10 has ECR) - bmsk.f 0, r10, 7 -@@ -250,9 +247,6 @@ ENTRY(EV_Trap) - - ;============ TRAP (no param): syscall top level - -- ; First return from Exception to pure K mode (Exception/IRQs renabled) -- FAKE_RET_FROM_EXCPN -- - ; If syscall tracing ongoing, invoke pre-post-hooks - GET_CURR_THR_INFO_FLAGS r10 - btst r10, TIF_SYSCALL_TRACE -diff --git a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi -index e39eee628afd..08a7d3ce383f 100644 ---- a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi -+++ b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi -@@ -13,8 +13,10 @@ - #interrupt-cells = <2>; - #address-cells = <1>; - #size-cells = <0>; -- spi-max-frequency = <3000000>; -+ spi-max-frequency = <9600000>; - spi-cs-high; -+ spi-cpol; -+ spi-cpha; - - cpcap_adc: adc { - compatible = "motorola,mapphone-cpcap-adc"; -diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c -index dd34dff13762..40c74b4c4d73 100644 ---- a/arch/arm/mach-imx/pm-imx6.c -+++ b/arch/arm/mach-imx/pm-imx6.c -@@ -493,14 +493,14 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata) - if (!ocram_pool) { - pr_warn("%s: ocram pool unavailable!\n", __func__); - ret = -ENODEV; -- goto put_node; -+ goto put_device; - } - - ocram_base = gen_pool_alloc(ocram_pool, MX6Q_SUSPEND_OCRAM_SIZE); - if (!ocram_base) { - pr_warn("%s: unable to alloc ocram!\n", __func__); - ret = -ENOMEM; -- goto put_node; -+ goto put_device; - } - - ocram_pbase = gen_pool_virt_to_phys(ocram_pool, ocram_base); -@@ -523,7 +523,7 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata) - ret = imx6_pm_get_base(&pm_info->mmdc_base, socdata->mmdc_compat); - if (ret) { - pr_warn("%s: failed to get mmdc base %d!\n", __func__, ret); -- goto put_node; -+ goto put_device; - } - - ret = imx6_pm_get_base(&pm_info->src_base, socdata->src_compat); -@@ -570,7 +570,7 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata) - &imx6_suspend, - MX6Q_SUSPEND_OCRAM_SIZE - sizeof(*pm_info)); - -- goto put_node; -+ goto put_device; - - pl310_cache_map_failed: - iounmap(pm_info->gpc_base.vbase); -@@ -580,6 +580,8 @@ iomuxc_map_failed: - iounmap(pm_info->src_base.vbase); - src_map_failed: - iounmap(pm_info->mmdc_base.vbase); -+put_device: -+ put_device(&pdev->dev); - put_node: - of_node_put(node); - -diff --git a/arch/arm64/include/asm/arch_gicv3.h b/arch/arm64/include/asm/arch_gicv3.h -index a358e97572c1..6647ae4f0231 100644 ---- a/arch/arm64/include/asm/arch_gicv3.h -+++ b/arch/arm64/include/asm/arch_gicv3.h -@@ -109,7 +109,7 @@ static inline u32 gic_read_pmr(void) - return read_sysreg_s(SYS_ICC_PMR_EL1); - } - --static inline void gic_write_pmr(u32 val) -+static __always_inline void gic_write_pmr(u32 val) - { - write_sysreg_s(val, SYS_ICC_PMR_EL1); - } -diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h -index 7ae54d7d333a..9f0ec21d6327 100644 ---- a/arch/arm64/include/asm/arch_timer.h -+++ b/arch/arm64/include/asm/arch_timer.h -@@ -58,6 +58,7 @@ struct arch_timer_erratum_workaround { - u64 (*read_cntvct_el0)(void); - int (*set_next_event_phys)(unsigned long, struct clock_event_device *); - int (*set_next_event_virt)(unsigned long, struct clock_event_device *); -+ bool disable_compat_vdso; - }; - - DECLARE_PER_CPU(const struct arch_timer_erratum_workaround *, -diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h -index afe08251ff95..9e2d2f04d93b 100644 ---- a/arch/arm64/include/asm/cpufeature.h -+++ b/arch/arm64/include/asm/cpufeature.h -@@ -668,7 +668,7 @@ static inline bool system_supports_generic_auth(void) - cpus_have_const_cap(ARM64_HAS_GENERIC_AUTH); - } - --static inline bool system_uses_irq_prio_masking(void) -+static __always_inline bool system_uses_irq_prio_masking(void) - { - return IS_ENABLED(CONFIG_ARM64_PSEUDO_NMI) && - cpus_have_const_cap(ARM64_HAS_IRQ_PRIO_MASKING); -diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h -index 1305e28225fc..6ffcb290b8aa 100644 ---- a/arch/arm64/include/asm/pgtable-prot.h -+++ b/arch/arm64/include/asm/pgtable-prot.h -@@ -56,7 +56,7 @@ extern bool arm64_use_ng_mappings; - #define PAGE_HYP __pgprot(_HYP_PAGE_DEFAULT | PTE_HYP | PTE_HYP_XN) - #define PAGE_HYP_EXEC __pgprot(_HYP_PAGE_DEFAULT | PTE_HYP | PTE_RDONLY) - #define PAGE_HYP_RO __pgprot(_HYP_PAGE_DEFAULT | PTE_HYP | PTE_RDONLY | PTE_HYP_XN) --#define PAGE_HYP_DEVICE __pgprot(PROT_DEVICE_nGnRE | PTE_HYP) -+#define PAGE_HYP_DEVICE __pgprot(_PROT_DEFAULT | PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_HYP | PTE_HYP_XN) - - #define PAGE_S2_MEMATTR(attr) \ - ({ \ -diff --git a/arch/arm64/include/asm/vdso/clocksource.h b/arch/arm64/include/asm/vdso/clocksource.h -index df6ea65c1dec..b054d9febfb5 100644 ---- a/arch/arm64/include/asm/vdso/clocksource.h -+++ b/arch/arm64/include/asm/vdso/clocksource.h -@@ -2,7 +2,10 @@ - #ifndef __ASM_VDSOCLOCKSOURCE_H - #define __ASM_VDSOCLOCKSOURCE_H - --#define VDSO_ARCH_CLOCKMODES \ -- VDSO_CLOCKMODE_ARCHTIMER -+#define VDSO_ARCH_CLOCKMODES \ -+ /* vdso clocksource for both 32 and 64bit tasks */ \ -+ VDSO_CLOCKMODE_ARCHTIMER, \ -+ /* vdso clocksource for 64bit tasks only */ \ -+ VDSO_CLOCKMODE_ARCHTIMER_NOCOMPAT - - #endif -diff --git a/arch/arm64/include/asm/vdso/compat_gettimeofday.h b/arch/arm64/include/asm/vdso/compat_gettimeofday.h -index b6907ae78e53..9a625e8947ff 100644 ---- a/arch/arm64/include/asm/vdso/compat_gettimeofday.h -+++ b/arch/arm64/include/asm/vdso/compat_gettimeofday.h -@@ -111,7 +111,7 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode) - * update. Return something. Core will do another round and then - * see the mode change and fallback to the syscall. - */ -- if (clock_mode == VDSO_CLOCKMODE_NONE) -+ if (clock_mode != VDSO_CLOCKMODE_ARCHTIMER) - return 0; - - /* -@@ -152,6 +152,12 @@ static __always_inline const struct vdso_data *__arch_get_vdso_data(void) - return ret; - } - -+static inline bool vdso_clocksource_ok(const struct vdso_data *vd) -+{ -+ return vd->clock_mode == VDSO_CLOCKMODE_ARCHTIMER; -+} -+#define vdso_clocksource_ok vdso_clocksource_ok -+ - #endif /* !__ASSEMBLY__ */ - - #endif /* __ASM_VDSO_GETTIMEOFDAY_H */ -diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c -index df56d2295d16..0f37045fafab 100644 ---- a/arch/arm64/kernel/cpu_errata.c -+++ b/arch/arm64/kernel/cpu_errata.c -@@ -460,6 +460,8 @@ static const struct midr_range arm64_ssb_cpus[] = { - MIDR_ALL_VERSIONS(MIDR_CORTEX_A53), - MIDR_ALL_VERSIONS(MIDR_CORTEX_A55), - MIDR_ALL_VERSIONS(MIDR_BRAHMA_B53), -+ MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_3XX_SILVER), -+ MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_SILVER), - {}, - }; - -diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c -index 9fac745aa7bb..b0fb1d5bf223 100644 ---- a/arch/arm64/kernel/cpufeature.c -+++ b/arch/arm64/kernel/cpufeature.c -@@ -1059,6 +1059,8 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry, - MIDR_ALL_VERSIONS(MIDR_CORTEX_A73), - MIDR_ALL_VERSIONS(MIDR_HISI_TSV110), - MIDR_ALL_VERSIONS(MIDR_NVIDIA_CARMEL), -+ MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_3XX_SILVER), -+ MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_SILVER), - { /* sentinel */ } - }; - char const *str = "kpti command line option"; -diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c -index 43119922341f..1a157ca33262 100644 ---- a/arch/arm64/kernel/kgdb.c -+++ b/arch/arm64/kernel/kgdb.c -@@ -252,7 +252,7 @@ static int kgdb_step_brk_fn(struct pt_regs *regs, unsigned int esr) - if (!kgdb_single_step) - return DBG_HOOK_ERROR; - -- kgdb_handle_exception(1, SIGTRAP, 0, regs); -+ kgdb_handle_exception(0, SIGTRAP, 0, regs); - return DBG_HOOK_HANDLED; - } - NOKPROBE_SYMBOL(kgdb_step_brk_fn); -diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S -index 6e6ed5581eed..e76c0e89d48e 100644 ---- a/arch/arm64/kvm/hyp-init.S -+++ b/arch/arm64/kvm/hyp-init.S -@@ -136,11 +136,15 @@ SYM_CODE_START(__kvm_handle_stub_hvc) - - 1: cmp x0, #HVC_RESET_VECTORS - b.ne 1f --reset: -+ - /* -- * Reset kvm back to the hyp stub. Do not clobber x0-x4 in -- * case we coming via HVC_SOFT_RESTART. -+ * Set the HVC_RESET_VECTORS return code before entering the common -+ * path so that we do not clobber x0-x2 in case we are coming via -+ * HVC_SOFT_RESTART. - */ -+ mov x0, xzr -+reset: -+ /* Reset kvm back to the hyp stub. */ - mrs x5, sctlr_el2 - mov_q x6, SCTLR_ELx_FLAGS - bic x5, x5, x6 // Clear SCTL_M and etc -@@ -151,7 +155,6 @@ reset: - /* Install stub vectors */ - adr_l x5, __hyp_stub_vectors - msr vbar_el2, x5 -- mov x0, xzr - eret - - 1: /* Bad stub call */ -diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c -index 30b7ea680f66..ab76728e2742 100644 ---- a/arch/arm64/kvm/reset.c -+++ b/arch/arm64/kvm/reset.c -@@ -258,7 +258,7 @@ static int kvm_vcpu_enable_ptrauth(struct kvm_vcpu *vcpu) - int kvm_reset_vcpu(struct kvm_vcpu *vcpu) - { - const struct kvm_regs *cpu_reset; -- int ret = -EINVAL; -+ int ret; - bool loaded; - - /* Reset PMU outside of the non-preemptible section */ -@@ -281,15 +281,19 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) - - if (test_bit(KVM_ARM_VCPU_PTRAUTH_ADDRESS, vcpu->arch.features) || - test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, vcpu->arch.features)) { -- if (kvm_vcpu_enable_ptrauth(vcpu)) -+ if (kvm_vcpu_enable_ptrauth(vcpu)) { -+ ret = -EINVAL; - goto out; -+ } - } - - switch (vcpu->arch.target) { - default: - if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features)) { -- if (!cpu_has_32bit_el1()) -+ if (!cpu_has_32bit_el1()) { -+ ret = -EINVAL; - goto out; -+ } - cpu_reset = &default_regs_reset32; - } else { - cpu_reset = &default_regs_reset; -diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S -index d9ddce40bed8..fd99d4feec7a 100644 ---- a/arch/powerpc/kernel/exceptions-64s.S -+++ b/arch/powerpc/kernel/exceptions-64s.S -@@ -2547,7 +2547,7 @@ EXC_VIRT_NONE(0x5400, 0x100) - INT_DEFINE_BEGIN(denorm_exception) - IVEC=0x1500 - IHSRR=1 -- IBRANCH_COMMON=0 -+ IBRANCH_TO_COMMON=0 - IKVM_REAL=1 - INT_DEFINE_END(denorm_exception) - -diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c -index d4e532a63f08..2f27faf24b2c 100644 ---- a/arch/powerpc/kvm/book3s_64_mmu_radix.c -+++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c -@@ -40,7 +40,8 @@ unsigned long __kvmhv_copy_tofrom_guest_radix(int lpid, int pid, - /* Can't access quadrants 1 or 2 in non-HV mode, call the HV to do it */ - if (kvmhv_on_pseries()) - return plpar_hcall_norets(H_COPY_TOFROM_GUEST, lpid, pid, eaddr, -- __pa(to), __pa(from), n); -+ (to != NULL) ? __pa(to): 0, -+ (from != NULL) ? __pa(from): 0, n); - - quadrant = 1; - if (!pid) -diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h -index d6bcd34f3ec3..ec65bc2bd084 100644 ---- a/arch/s390/include/asm/kvm_host.h -+++ b/arch/s390/include/asm/kvm_host.h -@@ -31,12 +31,12 @@ - #define KVM_USER_MEM_SLOTS 32 - - /* -- * These seem to be used for allocating ->chip in the routing table, -- * which we don't use. 4096 is an out-of-thin-air value. If we need -- * to look at ->chip later on, we'll need to revisit this. -+ * These seem to be used for allocating ->chip in the routing table, which we -+ * don't use. 1 is as small as we can get to reduce the needed memory. If we -+ * need to look at ->chip later on, we'll need to revisit this. - */ - #define KVM_NR_IRQCHIPS 1 --#define KVM_IRQCHIP_NUM_PINS 4096 -+#define KVM_IRQCHIP_NUM_PINS 1 - #define KVM_HALT_POLL_NS_DEFAULT 50000 - - /* s390-specific vcpu->requests bit members */ -diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h -index a470f1fa9f2a..324438889fe1 100644 ---- a/arch/s390/include/asm/uaccess.h -+++ b/arch/s390/include/asm/uaccess.h -@@ -276,6 +276,6 @@ static inline unsigned long __must_check clear_user(void __user *to, unsigned lo - } - - int copy_to_user_real(void __user *dest, void *src, unsigned long count); --void s390_kernel_write(void *dst, const void *src, size_t size); -+void *s390_kernel_write(void *dst, const void *src, size_t size); - - #endif /* __S390_UACCESS_H */ -diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c -index cd241ee66eff..078277231858 100644 ---- a/arch/s390/kernel/early.c -+++ b/arch/s390/kernel/early.c -@@ -170,6 +170,8 @@ static noinline __init void setup_lowcore_early(void) - psw_t psw; - - psw.mask = PSW_MASK_BASE | PSW_DEFAULT_KEY | PSW_MASK_EA | PSW_MASK_BA; -+ if (IS_ENABLED(CONFIG_KASAN)) -+ psw.mask |= PSW_MASK_DAT; - psw.addr = (unsigned long) s390_base_ext_handler; - S390_lowcore.external_new_psw = psw; - psw.addr = (unsigned long) s390_base_pgm_handler; -diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c -index 36445dd40fdb..cb10885f3d27 100644 ---- a/arch/s390/kernel/setup.c -+++ b/arch/s390/kernel/setup.c -@@ -1107,6 +1107,7 @@ void __init setup_arch(char **cmdline_p) - if (IS_ENABLED(CONFIG_EXPOLINE_AUTO)) - nospec_auto_detect(); - -+ jump_label_init(); - parse_early_param(); - #ifdef CONFIG_CRASH_DUMP - /* Deactivate elfcorehdr= kernel parameter */ -diff --git a/arch/s390/mm/hugetlbpage.c b/arch/s390/mm/hugetlbpage.c -index 4632d4e26b66..720d4405160b 100644 ---- a/arch/s390/mm/hugetlbpage.c -+++ b/arch/s390/mm/hugetlbpage.c -@@ -117,7 +117,7 @@ static inline pte_t __rste_to_pte(unsigned long rste) - _PAGE_YOUNG); - #ifdef CONFIG_MEM_SOFT_DIRTY - pte_val(pte) |= move_set_bit(rste, _SEGMENT_ENTRY_SOFT_DIRTY, -- _PAGE_DIRTY); -+ _PAGE_SOFT_DIRTY); - #endif - pte_val(pte) |= move_set_bit(rste, _SEGMENT_ENTRY_NOEXEC, - _PAGE_NOEXEC); -diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c -index de7ca4b6718f..1d17413b319a 100644 ---- a/arch/s390/mm/maccess.c -+++ b/arch/s390/mm/maccess.c -@@ -55,19 +55,26 @@ static notrace long s390_kernel_write_odd(void *dst, const void *src, size_t siz - */ - static DEFINE_SPINLOCK(s390_kernel_write_lock); - --void notrace s390_kernel_write(void *dst, const void *src, size_t size) -+notrace void *s390_kernel_write(void *dst, const void *src, size_t size) - { -+ void *tmp = dst; - unsigned long flags; - long copied; - - spin_lock_irqsave(&s390_kernel_write_lock, flags); -- while (size) { -- copied = s390_kernel_write_odd(dst, src, size); -- dst += copied; -- src += copied; -- size -= copied; -+ if (!(flags & PSW_MASK_DAT)) { -+ memcpy(dst, src, size); -+ } else { -+ while (size) { -+ copied = s390_kernel_write_odd(tmp, src, size); -+ tmp += copied; -+ src += copied; -+ size -= copied; -+ } - } - spin_unlock_irqrestore(&s390_kernel_write_lock, flags); -+ -+ return dst; - } - - static int __no_sanitize_address __memcpy_real(void *dest, void *src, size_t count) -diff --git a/arch/x86/events/Kconfig b/arch/x86/events/Kconfig -index 9a7a1446cb3a..4a809c6cbd2f 100644 ---- a/arch/x86/events/Kconfig -+++ b/arch/x86/events/Kconfig -@@ -10,11 +10,11 @@ config PERF_EVENTS_INTEL_UNCORE - available on NehalemEX and more modern processors. - - config PERF_EVENTS_INTEL_RAPL -- tristate "Intel rapl performance events" -- depends on PERF_EVENTS && CPU_SUP_INTEL && PCI -+ tristate "Intel/AMD rapl performance events" -+ depends on PERF_EVENTS && (CPU_SUP_INTEL || CPU_SUP_AMD) && PCI - default y - ---help--- -- Include support for Intel rapl performance events for power -+ Include support for Intel and AMD rapl performance events for power - monitoring on modern processors. - - config PERF_EVENTS_INTEL_CSTATE -diff --git a/arch/x86/events/Makefile b/arch/x86/events/Makefile -index 9e07f554333f..726e83c0a31a 100644 ---- a/arch/x86/events/Makefile -+++ b/arch/x86/events/Makefile -@@ -1,5 +1,6 @@ - # SPDX-License-Identifier: GPL-2.0-only - obj-y += core.o probe.o -+obj-$(CONFIG_PERF_EVENTS_INTEL_RAPL) += rapl.o - obj-y += amd/ - obj-$(CONFIG_X86_LOCAL_APIC) += msr.o - obj-$(CONFIG_CPU_SUP_INTEL) += intel/ -diff --git a/arch/x86/events/intel/Makefile b/arch/x86/events/intel/Makefile -index 3468b0c1dc7c..e67a5886336c 100644 ---- a/arch/x86/events/intel/Makefile -+++ b/arch/x86/events/intel/Makefile -@@ -2,8 +2,6 @@ - obj-$(CONFIG_CPU_SUP_INTEL) += core.o bts.o - obj-$(CONFIG_CPU_SUP_INTEL) += ds.o knc.o - obj-$(CONFIG_CPU_SUP_INTEL) += lbr.o p4.o p6.o pt.o --obj-$(CONFIG_PERF_EVENTS_INTEL_RAPL) += intel-rapl-perf.o --intel-rapl-perf-objs := rapl.o - obj-$(CONFIG_PERF_EVENTS_INTEL_UNCORE) += intel-uncore.o - intel-uncore-objs := uncore.o uncore_nhmex.o uncore_snb.o uncore_snbep.o - obj-$(CONFIG_PERF_EVENTS_INTEL_CSTATE) += intel-cstate.o -diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c -deleted file mode 100644 -index a5dbd25852cb..000000000000 ---- a/arch/x86/events/intel/rapl.c -+++ /dev/null -@@ -1,800 +0,0 @@ --// SPDX-License-Identifier: GPL-2.0-only --/* -- * Support Intel RAPL energy consumption counters -- * Copyright (C) 2013 Google, Inc., Stephane Eranian -- * -- * Intel RAPL interface is specified in the IA-32 Manual Vol3b -- * section 14.7.1 (September 2013) -- * -- * RAPL provides more controls than just reporting energy consumption -- * however here we only expose the 3 energy consumption free running -- * counters (pp0, pkg, dram). -- * -- * Each of those counters increments in a power unit defined by the -- * RAPL_POWER_UNIT MSR. On SandyBridge, this unit is 1/(2^16) Joules -- * but it can vary. -- * -- * Counter to rapl events mappings: -- * -- * pp0 counter: consumption of all physical cores (power plane 0) -- * event: rapl_energy_cores -- * perf code: 0x1 -- * -- * pkg counter: consumption of the whole processor package -- * event: rapl_energy_pkg -- * perf code: 0x2 -- * -- * dram counter: consumption of the dram domain (servers only) -- * event: rapl_energy_dram -- * perf code: 0x3 -- * -- * gpu counter: consumption of the builtin-gpu domain (client only) -- * event: rapl_energy_gpu -- * perf code: 0x4 -- * -- * psys counter: consumption of the builtin-psys domain (client only) -- * event: rapl_energy_psys -- * perf code: 0x5 -- * -- * We manage those counters as free running (read-only). They may be -- * use simultaneously by other tools, such as turbostat. -- * -- * The events only support system-wide mode counting. There is no -- * sampling support because it does not make sense and is not -- * supported by the RAPL hardware. -- * -- * Because we want to avoid floating-point operations in the kernel, -- * the events are all reported in fixed point arithmetic (32.32). -- * Tools must adjust the counts to convert them to Watts using -- * the duration of the measurement. Tools may use a function such as -- * ldexp(raw_count, -32); -- */ -- --#define pr_fmt(fmt) "RAPL PMU: " fmt -- --#include --#include --#include --#include --#include --#include --#include "../perf_event.h" --#include "../probe.h" -- --MODULE_LICENSE("GPL"); -- --/* -- * RAPL energy status counters -- */ --enum perf_rapl_events { -- PERF_RAPL_PP0 = 0, /* all cores */ -- PERF_RAPL_PKG, /* entire package */ -- PERF_RAPL_RAM, /* DRAM */ -- PERF_RAPL_PP1, /* gpu */ -- PERF_RAPL_PSYS, /* psys */ -- -- PERF_RAPL_MAX, -- NR_RAPL_DOMAINS = PERF_RAPL_MAX, --}; -- --static const char *const rapl_domain_names[NR_RAPL_DOMAINS] __initconst = { -- "pp0-core", -- "package", -- "dram", -- "pp1-gpu", -- "psys", --}; -- --/* -- * event code: LSB 8 bits, passed in attr->config -- * any other bit is reserved -- */ --#define RAPL_EVENT_MASK 0xFFULL -- --#define DEFINE_RAPL_FORMAT_ATTR(_var, _name, _format) \ --static ssize_t __rapl_##_var##_show(struct kobject *kobj, \ -- struct kobj_attribute *attr, \ -- char *page) \ --{ \ -- BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ -- return sprintf(page, _format "\n"); \ --} \ --static struct kobj_attribute format_attr_##_var = \ -- __ATTR(_name, 0444, __rapl_##_var##_show, NULL) -- --#define RAPL_CNTR_WIDTH 32 -- --#define RAPL_EVENT_ATTR_STR(_name, v, str) \ --static struct perf_pmu_events_attr event_attr_##v = { \ -- .attr = __ATTR(_name, 0444, perf_event_sysfs_show, NULL), \ -- .id = 0, \ -- .event_str = str, \ --}; -- --struct rapl_pmu { -- raw_spinlock_t lock; -- int n_active; -- int cpu; -- struct list_head active_list; -- struct pmu *pmu; -- ktime_t timer_interval; -- struct hrtimer hrtimer; --}; -- --struct rapl_pmus { -- struct pmu pmu; -- unsigned int maxdie; -- struct rapl_pmu *pmus[]; --}; -- --struct rapl_model { -- unsigned long events; -- bool apply_quirk; --}; -- -- /* 1/2^hw_unit Joule */ --static int rapl_hw_unit[NR_RAPL_DOMAINS] __read_mostly; --static struct rapl_pmus *rapl_pmus; --static cpumask_t rapl_cpu_mask; --static unsigned int rapl_cntr_mask; --static u64 rapl_timer_ms; --static struct perf_msr rapl_msrs[]; -- --static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu) --{ -- unsigned int dieid = topology_logical_die_id(cpu); -- -- /* -- * The unsigned check also catches the '-1' return value for non -- * existent mappings in the topology map. -- */ -- return dieid < rapl_pmus->maxdie ? rapl_pmus->pmus[dieid] : NULL; --} -- --static inline u64 rapl_read_counter(struct perf_event *event) --{ -- u64 raw; -- rdmsrl(event->hw.event_base, raw); -- return raw; --} -- --static inline u64 rapl_scale(u64 v, int cfg) --{ -- if (cfg > NR_RAPL_DOMAINS) { -- pr_warn("Invalid domain %d, failed to scale data\n", cfg); -- return v; -- } -- /* -- * scale delta to smallest unit (1/2^32) -- * users must then scale back: count * 1/(1e9*2^32) to get Joules -- * or use ldexp(count, -32). -- * Watts = Joules/Time delta -- */ -- return v << (32 - rapl_hw_unit[cfg - 1]); --} -- --static u64 rapl_event_update(struct perf_event *event) --{ -- struct hw_perf_event *hwc = &event->hw; -- u64 prev_raw_count, new_raw_count; -- s64 delta, sdelta; -- int shift = RAPL_CNTR_WIDTH; -- --again: -- prev_raw_count = local64_read(&hwc->prev_count); -- rdmsrl(event->hw.event_base, new_raw_count); -- -- if (local64_cmpxchg(&hwc->prev_count, prev_raw_count, -- new_raw_count) != prev_raw_count) { -- cpu_relax(); -- goto again; -- } -- -- /* -- * Now we have the new raw value and have updated the prev -- * timestamp already. We can now calculate the elapsed delta -- * (event-)time and add that to the generic event. -- * -- * Careful, not all hw sign-extends above the physical width -- * of the count. -- */ -- delta = (new_raw_count << shift) - (prev_raw_count << shift); -- delta >>= shift; -- -- sdelta = rapl_scale(delta, event->hw.config); -- -- local64_add(sdelta, &event->count); -- -- return new_raw_count; --} -- --static void rapl_start_hrtimer(struct rapl_pmu *pmu) --{ -- hrtimer_start(&pmu->hrtimer, pmu->timer_interval, -- HRTIMER_MODE_REL_PINNED); --} -- --static enum hrtimer_restart rapl_hrtimer_handle(struct hrtimer *hrtimer) --{ -- struct rapl_pmu *pmu = container_of(hrtimer, struct rapl_pmu, hrtimer); -- struct perf_event *event; -- unsigned long flags; -- -- if (!pmu->n_active) -- return HRTIMER_NORESTART; -- -- raw_spin_lock_irqsave(&pmu->lock, flags); -- -- list_for_each_entry(event, &pmu->active_list, active_entry) -- rapl_event_update(event); -- -- raw_spin_unlock_irqrestore(&pmu->lock, flags); -- -- hrtimer_forward_now(hrtimer, pmu->timer_interval); -- -- return HRTIMER_RESTART; --} -- --static void rapl_hrtimer_init(struct rapl_pmu *pmu) --{ -- struct hrtimer *hr = &pmu->hrtimer; -- -- hrtimer_init(hr, CLOCK_MONOTONIC, HRTIMER_MODE_REL); -- hr->function = rapl_hrtimer_handle; --} -- --static void __rapl_pmu_event_start(struct rapl_pmu *pmu, -- struct perf_event *event) --{ -- if (WARN_ON_ONCE(!(event->hw.state & PERF_HES_STOPPED))) -- return; -- -- event->hw.state = 0; -- -- list_add_tail(&event->active_entry, &pmu->active_list); -- -- local64_set(&event->hw.prev_count, rapl_read_counter(event)); -- -- pmu->n_active++; -- if (pmu->n_active == 1) -- rapl_start_hrtimer(pmu); --} -- --static void rapl_pmu_event_start(struct perf_event *event, int mode) --{ -- struct rapl_pmu *pmu = event->pmu_private; -- unsigned long flags; -- -- raw_spin_lock_irqsave(&pmu->lock, flags); -- __rapl_pmu_event_start(pmu, event); -- raw_spin_unlock_irqrestore(&pmu->lock, flags); --} -- --static void rapl_pmu_event_stop(struct perf_event *event, int mode) --{ -- struct rapl_pmu *pmu = event->pmu_private; -- struct hw_perf_event *hwc = &event->hw; -- unsigned long flags; -- -- raw_spin_lock_irqsave(&pmu->lock, flags); -- -- /* mark event as deactivated and stopped */ -- if (!(hwc->state & PERF_HES_STOPPED)) { -- WARN_ON_ONCE(pmu->n_active <= 0); -- pmu->n_active--; -- if (pmu->n_active == 0) -- hrtimer_cancel(&pmu->hrtimer); -- -- list_del(&event->active_entry); -- -- WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED); -- hwc->state |= PERF_HES_STOPPED; -- } -- -- /* check if update of sw counter is necessary */ -- if ((mode & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) { -- /* -- * Drain the remaining delta count out of a event -- * that we are disabling: -- */ -- rapl_event_update(event); -- hwc->state |= PERF_HES_UPTODATE; -- } -- -- raw_spin_unlock_irqrestore(&pmu->lock, flags); --} -- --static int rapl_pmu_event_add(struct perf_event *event, int mode) --{ -- struct rapl_pmu *pmu = event->pmu_private; -- struct hw_perf_event *hwc = &event->hw; -- unsigned long flags; -- -- raw_spin_lock_irqsave(&pmu->lock, flags); -- -- hwc->state = PERF_HES_UPTODATE | PERF_HES_STOPPED; -- -- if (mode & PERF_EF_START) -- __rapl_pmu_event_start(pmu, event); -- -- raw_spin_unlock_irqrestore(&pmu->lock, flags); -- -- return 0; --} -- --static void rapl_pmu_event_del(struct perf_event *event, int flags) --{ -- rapl_pmu_event_stop(event, PERF_EF_UPDATE); --} -- --static int rapl_pmu_event_init(struct perf_event *event) --{ -- u64 cfg = event->attr.config & RAPL_EVENT_MASK; -- int bit, ret = 0; -- struct rapl_pmu *pmu; -- -- /* only look at RAPL events */ -- if (event->attr.type != rapl_pmus->pmu.type) -- return -ENOENT; -- -- /* check only supported bits are set */ -- if (event->attr.config & ~RAPL_EVENT_MASK) -- return -EINVAL; -- -- if (event->cpu < 0) -- return -EINVAL; -- -- event->event_caps |= PERF_EV_CAP_READ_ACTIVE_PKG; -- -- if (!cfg || cfg >= NR_RAPL_DOMAINS + 1) -- return -EINVAL; -- -- cfg = array_index_nospec((long)cfg, NR_RAPL_DOMAINS + 1); -- bit = cfg - 1; -- -- /* check event supported */ -- if (!(rapl_cntr_mask & (1 << bit))) -- return -EINVAL; -- -- /* unsupported modes and filters */ -- if (event->attr.sample_period) /* no sampling */ -- return -EINVAL; -- -- /* must be done before validate_group */ -- pmu = cpu_to_rapl_pmu(event->cpu); -- if (!pmu) -- return -EINVAL; -- event->cpu = pmu->cpu; -- event->pmu_private = pmu; -- event->hw.event_base = rapl_msrs[bit].msr; -- event->hw.config = cfg; -- event->hw.idx = bit; -- -- return ret; --} -- --static void rapl_pmu_event_read(struct perf_event *event) --{ -- rapl_event_update(event); --} -- --static ssize_t rapl_get_attr_cpumask(struct device *dev, -- struct device_attribute *attr, char *buf) --{ -- return cpumap_print_to_pagebuf(true, buf, &rapl_cpu_mask); --} -- --static DEVICE_ATTR(cpumask, S_IRUGO, rapl_get_attr_cpumask, NULL); -- --static struct attribute *rapl_pmu_attrs[] = { -- &dev_attr_cpumask.attr, -- NULL, --}; -- --static struct attribute_group rapl_pmu_attr_group = { -- .attrs = rapl_pmu_attrs, --}; -- --RAPL_EVENT_ATTR_STR(energy-cores, rapl_cores, "event=0x01"); --RAPL_EVENT_ATTR_STR(energy-pkg , rapl_pkg, "event=0x02"); --RAPL_EVENT_ATTR_STR(energy-ram , rapl_ram, "event=0x03"); --RAPL_EVENT_ATTR_STR(energy-gpu , rapl_gpu, "event=0x04"); --RAPL_EVENT_ATTR_STR(energy-psys, rapl_psys, "event=0x05"); -- --RAPL_EVENT_ATTR_STR(energy-cores.unit, rapl_cores_unit, "Joules"); --RAPL_EVENT_ATTR_STR(energy-pkg.unit , rapl_pkg_unit, "Joules"); --RAPL_EVENT_ATTR_STR(energy-ram.unit , rapl_ram_unit, "Joules"); --RAPL_EVENT_ATTR_STR(energy-gpu.unit , rapl_gpu_unit, "Joules"); --RAPL_EVENT_ATTR_STR(energy-psys.unit, rapl_psys_unit, "Joules"); -- --/* -- * we compute in 0.23 nJ increments regardless of MSR -- */ --RAPL_EVENT_ATTR_STR(energy-cores.scale, rapl_cores_scale, "2.3283064365386962890625e-10"); --RAPL_EVENT_ATTR_STR(energy-pkg.scale, rapl_pkg_scale, "2.3283064365386962890625e-10"); --RAPL_EVENT_ATTR_STR(energy-ram.scale, rapl_ram_scale, "2.3283064365386962890625e-10"); --RAPL_EVENT_ATTR_STR(energy-gpu.scale, rapl_gpu_scale, "2.3283064365386962890625e-10"); --RAPL_EVENT_ATTR_STR(energy-psys.scale, rapl_psys_scale, "2.3283064365386962890625e-10"); -- --/* -- * There are no default events, but we need to create -- * "events" group (with empty attrs) before updating -- * it with detected events. -- */ --static struct attribute *attrs_empty[] = { -- NULL, --}; -- --static struct attribute_group rapl_pmu_events_group = { -- .name = "events", -- .attrs = attrs_empty, --}; -- --DEFINE_RAPL_FORMAT_ATTR(event, event, "config:0-7"); --static struct attribute *rapl_formats_attr[] = { -- &format_attr_event.attr, -- NULL, --}; -- --static struct attribute_group rapl_pmu_format_group = { -- .name = "format", -- .attrs = rapl_formats_attr, --}; -- --static const struct attribute_group *rapl_attr_groups[] = { -- &rapl_pmu_attr_group, -- &rapl_pmu_format_group, -- &rapl_pmu_events_group, -- NULL, --}; -- --static struct attribute *rapl_events_cores[] = { -- EVENT_PTR(rapl_cores), -- EVENT_PTR(rapl_cores_unit), -- EVENT_PTR(rapl_cores_scale), -- NULL, --}; -- --static struct attribute_group rapl_events_cores_group = { -- .name = "events", -- .attrs = rapl_events_cores, --}; -- --static struct attribute *rapl_events_pkg[] = { -- EVENT_PTR(rapl_pkg), -- EVENT_PTR(rapl_pkg_unit), -- EVENT_PTR(rapl_pkg_scale), -- NULL, --}; -- --static struct attribute_group rapl_events_pkg_group = { -- .name = "events", -- .attrs = rapl_events_pkg, --}; -- --static struct attribute *rapl_events_ram[] = { -- EVENT_PTR(rapl_ram), -- EVENT_PTR(rapl_ram_unit), -- EVENT_PTR(rapl_ram_scale), -- NULL, --}; -- --static struct attribute_group rapl_events_ram_group = { -- .name = "events", -- .attrs = rapl_events_ram, --}; -- --static struct attribute *rapl_events_gpu[] = { -- EVENT_PTR(rapl_gpu), -- EVENT_PTR(rapl_gpu_unit), -- EVENT_PTR(rapl_gpu_scale), -- NULL, --}; -- --static struct attribute_group rapl_events_gpu_group = { -- .name = "events", -- .attrs = rapl_events_gpu, --}; -- --static struct attribute *rapl_events_psys[] = { -- EVENT_PTR(rapl_psys), -- EVENT_PTR(rapl_psys_unit), -- EVENT_PTR(rapl_psys_scale), -- NULL, --}; -- --static struct attribute_group rapl_events_psys_group = { -- .name = "events", -- .attrs = rapl_events_psys, --}; -- --static bool test_msr(int idx, void *data) --{ -- return test_bit(idx, (unsigned long *) data); --} -- --static struct perf_msr rapl_msrs[] = { -- [PERF_RAPL_PP0] = { MSR_PP0_ENERGY_STATUS, &rapl_events_cores_group, test_msr }, -- [PERF_RAPL_PKG] = { MSR_PKG_ENERGY_STATUS, &rapl_events_pkg_group, test_msr }, -- [PERF_RAPL_RAM] = { MSR_DRAM_ENERGY_STATUS, &rapl_events_ram_group, test_msr }, -- [PERF_RAPL_PP1] = { MSR_PP1_ENERGY_STATUS, &rapl_events_gpu_group, test_msr }, -- [PERF_RAPL_PSYS] = { MSR_PLATFORM_ENERGY_STATUS, &rapl_events_psys_group, test_msr }, --}; -- --static int rapl_cpu_offline(unsigned int cpu) --{ -- struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); -- int target; -- -- /* Check if exiting cpu is used for collecting rapl events */ -- if (!cpumask_test_and_clear_cpu(cpu, &rapl_cpu_mask)) -- return 0; -- -- pmu->cpu = -1; -- /* Find a new cpu to collect rapl events */ -- target = cpumask_any_but(topology_die_cpumask(cpu), cpu); -- -- /* Migrate rapl events to the new target */ -- if (target < nr_cpu_ids) { -- cpumask_set_cpu(target, &rapl_cpu_mask); -- pmu->cpu = target; -- perf_pmu_migrate_context(pmu->pmu, cpu, target); -- } -- return 0; --} -- --static int rapl_cpu_online(unsigned int cpu) --{ -- struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); -- int target; -- -- if (!pmu) { -- pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); -- if (!pmu) -- return -ENOMEM; -- -- raw_spin_lock_init(&pmu->lock); -- INIT_LIST_HEAD(&pmu->active_list); -- pmu->pmu = &rapl_pmus->pmu; -- pmu->timer_interval = ms_to_ktime(rapl_timer_ms); -- rapl_hrtimer_init(pmu); -- -- rapl_pmus->pmus[topology_logical_die_id(cpu)] = pmu; -- } -- -- /* -- * Check if there is an online cpu in the package which collects rapl -- * events already. -- */ -- target = cpumask_any_and(&rapl_cpu_mask, topology_die_cpumask(cpu)); -- if (target < nr_cpu_ids) -- return 0; -- -- cpumask_set_cpu(cpu, &rapl_cpu_mask); -- pmu->cpu = cpu; -- return 0; --} -- --static int rapl_check_hw_unit(bool apply_quirk) --{ -- u64 msr_rapl_power_unit_bits; -- int i; -- -- /* protect rdmsrl() to handle virtualization */ -- if (rdmsrl_safe(MSR_RAPL_POWER_UNIT, &msr_rapl_power_unit_bits)) -- return -1; -- for (i = 0; i < NR_RAPL_DOMAINS; i++) -- rapl_hw_unit[i] = (msr_rapl_power_unit_bits >> 8) & 0x1FULL; -- -- /* -- * DRAM domain on HSW server and KNL has fixed energy unit which can be -- * different than the unit from power unit MSR. See -- * "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2 -- * of 2. Datasheet, September 2014, Reference Number: 330784-001 " -- */ -- if (apply_quirk) -- rapl_hw_unit[PERF_RAPL_RAM] = 16; -- -- /* -- * Calculate the timer rate: -- * Use reference of 200W for scaling the timeout to avoid counter -- * overflows. 200W = 200 Joules/sec -- * Divide interval by 2 to avoid lockstep (2 * 100) -- * if hw unit is 32, then we use 2 ms 1/200/2 -- */ -- rapl_timer_ms = 2; -- if (rapl_hw_unit[0] < 32) { -- rapl_timer_ms = (1000 / (2 * 100)); -- rapl_timer_ms *= (1ULL << (32 - rapl_hw_unit[0] - 1)); -- } -- return 0; --} -- --static void __init rapl_advertise(void) --{ -- int i; -- -- pr_info("API unit is 2^-32 Joules, %d fixed counters, %llu ms ovfl timer\n", -- hweight32(rapl_cntr_mask), rapl_timer_ms); -- -- for (i = 0; i < NR_RAPL_DOMAINS; i++) { -- if (rapl_cntr_mask & (1 << i)) { -- pr_info("hw unit of domain %s 2^-%d Joules\n", -- rapl_domain_names[i], rapl_hw_unit[i]); -- } -- } --} -- --static void cleanup_rapl_pmus(void) --{ -- int i; -- -- for (i = 0; i < rapl_pmus->maxdie; i++) -- kfree(rapl_pmus->pmus[i]); -- kfree(rapl_pmus); --} -- --static const struct attribute_group *rapl_attr_update[] = { -- &rapl_events_cores_group, -- &rapl_events_pkg_group, -- &rapl_events_ram_group, -- &rapl_events_gpu_group, -- &rapl_events_gpu_group, -- NULL, --}; -- --static int __init init_rapl_pmus(void) --{ -- int maxdie = topology_max_packages() * topology_max_die_per_package(); -- size_t size; -- -- size = sizeof(*rapl_pmus) + maxdie * sizeof(struct rapl_pmu *); -- rapl_pmus = kzalloc(size, GFP_KERNEL); -- if (!rapl_pmus) -- return -ENOMEM; -- -- rapl_pmus->maxdie = maxdie; -- rapl_pmus->pmu.attr_groups = rapl_attr_groups; -- rapl_pmus->pmu.attr_update = rapl_attr_update; -- rapl_pmus->pmu.task_ctx_nr = perf_invalid_context; -- rapl_pmus->pmu.event_init = rapl_pmu_event_init; -- rapl_pmus->pmu.add = rapl_pmu_event_add; -- rapl_pmus->pmu.del = rapl_pmu_event_del; -- rapl_pmus->pmu.start = rapl_pmu_event_start; -- rapl_pmus->pmu.stop = rapl_pmu_event_stop; -- rapl_pmus->pmu.read = rapl_pmu_event_read; -- rapl_pmus->pmu.module = THIS_MODULE; -- rapl_pmus->pmu.capabilities = PERF_PMU_CAP_NO_EXCLUDE; -- return 0; --} -- --static struct rapl_model model_snb = { -- .events = BIT(PERF_RAPL_PP0) | -- BIT(PERF_RAPL_PKG) | -- BIT(PERF_RAPL_PP1), -- .apply_quirk = false, --}; -- --static struct rapl_model model_snbep = { -- .events = BIT(PERF_RAPL_PP0) | -- BIT(PERF_RAPL_PKG) | -- BIT(PERF_RAPL_RAM), -- .apply_quirk = false, --}; -- --static struct rapl_model model_hsw = { -- .events = BIT(PERF_RAPL_PP0) | -- BIT(PERF_RAPL_PKG) | -- BIT(PERF_RAPL_RAM) | -- BIT(PERF_RAPL_PP1), -- .apply_quirk = false, --}; -- --static struct rapl_model model_hsx = { -- .events = BIT(PERF_RAPL_PP0) | -- BIT(PERF_RAPL_PKG) | -- BIT(PERF_RAPL_RAM), -- .apply_quirk = true, --}; -- --static struct rapl_model model_knl = { -- .events = BIT(PERF_RAPL_PKG) | -- BIT(PERF_RAPL_RAM), -- .apply_quirk = true, --}; -- --static struct rapl_model model_skl = { -- .events = BIT(PERF_RAPL_PP0) | -- BIT(PERF_RAPL_PKG) | -- BIT(PERF_RAPL_RAM) | -- BIT(PERF_RAPL_PP1) | -- BIT(PERF_RAPL_PSYS), -- .apply_quirk = false, --}; -- --static const struct x86_cpu_id rapl_model_match[] __initconst = { -- X86_MATCH_INTEL_FAM6_MODEL(SANDYBRIDGE, &model_snb), -- X86_MATCH_INTEL_FAM6_MODEL(SANDYBRIDGE_X, &model_snbep), -- X86_MATCH_INTEL_FAM6_MODEL(IVYBRIDGE, &model_snb), -- X86_MATCH_INTEL_FAM6_MODEL(IVYBRIDGE_X, &model_snbep), -- X86_MATCH_INTEL_FAM6_MODEL(HASWELL, &model_hsw), -- X86_MATCH_INTEL_FAM6_MODEL(HASWELL_X, &model_hsx), -- X86_MATCH_INTEL_FAM6_MODEL(HASWELL_L, &model_hsw), -- X86_MATCH_INTEL_FAM6_MODEL(HASWELL_G, &model_hsw), -- X86_MATCH_INTEL_FAM6_MODEL(BROADWELL, &model_hsw), -- X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_G, &model_hsw), -- X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_X, &model_hsx), -- X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_D, &model_hsx), -- X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNL, &model_knl), -- X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNM, &model_knl), -- X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_L, &model_skl), -- X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE, &model_skl), -- X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_X, &model_hsx), -- X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE_L, &model_skl), -- X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE, &model_skl), -- X86_MATCH_INTEL_FAM6_MODEL(CANNONLAKE_L, &model_skl), -- X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT, &model_hsw), -- X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_D, &model_hsw), -- X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_PLUS, &model_hsw), -- X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_L, &model_skl), -- X86_MATCH_INTEL_FAM6_MODEL(ICELAKE, &model_skl), -- X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE_L, &model_skl), -- X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE, &model_skl), -- {}, --}; --MODULE_DEVICE_TABLE(x86cpu, rapl_model_match); -- --static int __init rapl_pmu_init(void) --{ -- const struct x86_cpu_id *id; -- struct rapl_model *rm; -- int ret; -- -- id = x86_match_cpu(rapl_model_match); -- if (!id) -- return -ENODEV; -- -- rm = (struct rapl_model *) id->driver_data; -- rapl_cntr_mask = perf_msr_probe(rapl_msrs, PERF_RAPL_MAX, -- false, (void *) &rm->events); -- -- ret = rapl_check_hw_unit(rm->apply_quirk); -- if (ret) -- return ret; -- -- ret = init_rapl_pmus(); -- if (ret) -- return ret; -- -- /* -- * Install callbacks. Core will call them for each online cpu. -- */ -- ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_RAPL_ONLINE, -- "perf/x86/rapl:online", -- rapl_cpu_online, rapl_cpu_offline); -- if (ret) -- goto out; -- -- ret = perf_pmu_register(&rapl_pmus->pmu, "power", -1); -- if (ret) -- goto out1; -- -- rapl_advertise(); -- return 0; -- --out1: -- cpuhp_remove_state(CPUHP_AP_PERF_X86_RAPL_ONLINE); --out: -- pr_warn("Initialization failed (%d), disabled\n", ret); -- cleanup_rapl_pmus(); -- return ret; --} --module_init(rapl_pmu_init); -- --static void __exit intel_rapl_exit(void) --{ -- cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_RAPL_ONLINE); -- perf_pmu_unregister(&rapl_pmus->pmu); -- cleanup_rapl_pmus(); --} --module_exit(intel_rapl_exit); -diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c -new file mode 100644 -index 000000000000..ece043fb7b49 ---- /dev/null -+++ b/arch/x86/events/rapl.c -@@ -0,0 +1,803 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+/* -+ * Support Intel/AMD RAPL energy consumption counters -+ * Copyright (C) 2013 Google, Inc., Stephane Eranian -+ * -+ * Intel RAPL interface is specified in the IA-32 Manual Vol3b -+ * section 14.7.1 (September 2013) -+ * -+ * AMD RAPL interface for Fam17h is described in the public PPR: -+ * https://bugzilla.kernel.org/show_bug.cgi?id=206537 -+ * -+ * RAPL provides more controls than just reporting energy consumption -+ * however here we only expose the 3 energy consumption free running -+ * counters (pp0, pkg, dram). -+ * -+ * Each of those counters increments in a power unit defined by the -+ * RAPL_POWER_UNIT MSR. On SandyBridge, this unit is 1/(2^16) Joules -+ * but it can vary. -+ * -+ * Counter to rapl events mappings: -+ * -+ * pp0 counter: consumption of all physical cores (power plane 0) -+ * event: rapl_energy_cores -+ * perf code: 0x1 -+ * -+ * pkg counter: consumption of the whole processor package -+ * event: rapl_energy_pkg -+ * perf code: 0x2 -+ * -+ * dram counter: consumption of the dram domain (servers only) -+ * event: rapl_energy_dram -+ * perf code: 0x3 -+ * -+ * gpu counter: consumption of the builtin-gpu domain (client only) -+ * event: rapl_energy_gpu -+ * perf code: 0x4 -+ * -+ * psys counter: consumption of the builtin-psys domain (client only) -+ * event: rapl_energy_psys -+ * perf code: 0x5 -+ * -+ * We manage those counters as free running (read-only). They may be -+ * use simultaneously by other tools, such as turbostat. -+ * -+ * The events only support system-wide mode counting. There is no -+ * sampling support because it does not make sense and is not -+ * supported by the RAPL hardware. -+ * -+ * Because we want to avoid floating-point operations in the kernel, -+ * the events are all reported in fixed point arithmetic (32.32). -+ * Tools must adjust the counts to convert them to Watts using -+ * the duration of the measurement. Tools may use a function such as -+ * ldexp(raw_count, -32); -+ */ -+ -+#define pr_fmt(fmt) "RAPL PMU: " fmt -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include "perf_event.h" -+#include "probe.h" -+ -+MODULE_LICENSE("GPL"); -+ -+/* -+ * RAPL energy status counters -+ */ -+enum perf_rapl_events { -+ PERF_RAPL_PP0 = 0, /* all cores */ -+ PERF_RAPL_PKG, /* entire package */ -+ PERF_RAPL_RAM, /* DRAM */ -+ PERF_RAPL_PP1, /* gpu */ -+ PERF_RAPL_PSYS, /* psys */ -+ -+ PERF_RAPL_MAX, -+ NR_RAPL_DOMAINS = PERF_RAPL_MAX, -+}; -+ -+static const char *const rapl_domain_names[NR_RAPL_DOMAINS] __initconst = { -+ "pp0-core", -+ "package", -+ "dram", -+ "pp1-gpu", -+ "psys", -+}; -+ -+/* -+ * event code: LSB 8 bits, passed in attr->config -+ * any other bit is reserved -+ */ -+#define RAPL_EVENT_MASK 0xFFULL -+ -+#define DEFINE_RAPL_FORMAT_ATTR(_var, _name, _format) \ -+static ssize_t __rapl_##_var##_show(struct kobject *kobj, \ -+ struct kobj_attribute *attr, \ -+ char *page) \ -+{ \ -+ BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ -+ return sprintf(page, _format "\n"); \ -+} \ -+static struct kobj_attribute format_attr_##_var = \ -+ __ATTR(_name, 0444, __rapl_##_var##_show, NULL) -+ -+#define RAPL_CNTR_WIDTH 32 -+ -+#define RAPL_EVENT_ATTR_STR(_name, v, str) \ -+static struct perf_pmu_events_attr event_attr_##v = { \ -+ .attr = __ATTR(_name, 0444, perf_event_sysfs_show, NULL), \ -+ .id = 0, \ -+ .event_str = str, \ -+}; -+ -+struct rapl_pmu { -+ raw_spinlock_t lock; -+ int n_active; -+ int cpu; -+ struct list_head active_list; -+ struct pmu *pmu; -+ ktime_t timer_interval; -+ struct hrtimer hrtimer; -+}; -+ -+struct rapl_pmus { -+ struct pmu pmu; -+ unsigned int maxdie; -+ struct rapl_pmu *pmus[]; -+}; -+ -+struct rapl_model { -+ unsigned long events; -+ bool apply_quirk; -+}; -+ -+ /* 1/2^hw_unit Joule */ -+static int rapl_hw_unit[NR_RAPL_DOMAINS] __read_mostly; -+static struct rapl_pmus *rapl_pmus; -+static cpumask_t rapl_cpu_mask; -+static unsigned int rapl_cntr_mask; -+static u64 rapl_timer_ms; -+static struct perf_msr rapl_msrs[]; -+ -+static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu) -+{ -+ unsigned int dieid = topology_logical_die_id(cpu); -+ -+ /* -+ * The unsigned check also catches the '-1' return value for non -+ * existent mappings in the topology map. -+ */ -+ return dieid < rapl_pmus->maxdie ? rapl_pmus->pmus[dieid] : NULL; -+} -+ -+static inline u64 rapl_read_counter(struct perf_event *event) -+{ -+ u64 raw; -+ rdmsrl(event->hw.event_base, raw); -+ return raw; -+} -+ -+static inline u64 rapl_scale(u64 v, int cfg) -+{ -+ if (cfg > NR_RAPL_DOMAINS) { -+ pr_warn("Invalid domain %d, failed to scale data\n", cfg); -+ return v; -+ } -+ /* -+ * scale delta to smallest unit (1/2^32) -+ * users must then scale back: count * 1/(1e9*2^32) to get Joules -+ * or use ldexp(count, -32). -+ * Watts = Joules/Time delta -+ */ -+ return v << (32 - rapl_hw_unit[cfg - 1]); -+} -+ -+static u64 rapl_event_update(struct perf_event *event) -+{ -+ struct hw_perf_event *hwc = &event->hw; -+ u64 prev_raw_count, new_raw_count; -+ s64 delta, sdelta; -+ int shift = RAPL_CNTR_WIDTH; -+ -+again: -+ prev_raw_count = local64_read(&hwc->prev_count); -+ rdmsrl(event->hw.event_base, new_raw_count); -+ -+ if (local64_cmpxchg(&hwc->prev_count, prev_raw_count, -+ new_raw_count) != prev_raw_count) { -+ cpu_relax(); -+ goto again; -+ } -+ -+ /* -+ * Now we have the new raw value and have updated the prev -+ * timestamp already. We can now calculate the elapsed delta -+ * (event-)time and add that to the generic event. -+ * -+ * Careful, not all hw sign-extends above the physical width -+ * of the count. -+ */ -+ delta = (new_raw_count << shift) - (prev_raw_count << shift); -+ delta >>= shift; -+ -+ sdelta = rapl_scale(delta, event->hw.config); -+ -+ local64_add(sdelta, &event->count); -+ -+ return new_raw_count; -+} -+ -+static void rapl_start_hrtimer(struct rapl_pmu *pmu) -+{ -+ hrtimer_start(&pmu->hrtimer, pmu->timer_interval, -+ HRTIMER_MODE_REL_PINNED); -+} -+ -+static enum hrtimer_restart rapl_hrtimer_handle(struct hrtimer *hrtimer) -+{ -+ struct rapl_pmu *pmu = container_of(hrtimer, struct rapl_pmu, hrtimer); -+ struct perf_event *event; -+ unsigned long flags; -+ -+ if (!pmu->n_active) -+ return HRTIMER_NORESTART; -+ -+ raw_spin_lock_irqsave(&pmu->lock, flags); -+ -+ list_for_each_entry(event, &pmu->active_list, active_entry) -+ rapl_event_update(event); -+ -+ raw_spin_unlock_irqrestore(&pmu->lock, flags); -+ -+ hrtimer_forward_now(hrtimer, pmu->timer_interval); -+ -+ return HRTIMER_RESTART; -+} -+ -+static void rapl_hrtimer_init(struct rapl_pmu *pmu) -+{ -+ struct hrtimer *hr = &pmu->hrtimer; -+ -+ hrtimer_init(hr, CLOCK_MONOTONIC, HRTIMER_MODE_REL); -+ hr->function = rapl_hrtimer_handle; -+} -+ -+static void __rapl_pmu_event_start(struct rapl_pmu *pmu, -+ struct perf_event *event) -+{ -+ if (WARN_ON_ONCE(!(event->hw.state & PERF_HES_STOPPED))) -+ return; -+ -+ event->hw.state = 0; -+ -+ list_add_tail(&event->active_entry, &pmu->active_list); -+ -+ local64_set(&event->hw.prev_count, rapl_read_counter(event)); -+ -+ pmu->n_active++; -+ if (pmu->n_active == 1) -+ rapl_start_hrtimer(pmu); -+} -+ -+static void rapl_pmu_event_start(struct perf_event *event, int mode) -+{ -+ struct rapl_pmu *pmu = event->pmu_private; -+ unsigned long flags; -+ -+ raw_spin_lock_irqsave(&pmu->lock, flags); -+ __rapl_pmu_event_start(pmu, event); -+ raw_spin_unlock_irqrestore(&pmu->lock, flags); -+} -+ -+static void rapl_pmu_event_stop(struct perf_event *event, int mode) -+{ -+ struct rapl_pmu *pmu = event->pmu_private; -+ struct hw_perf_event *hwc = &event->hw; -+ unsigned long flags; -+ -+ raw_spin_lock_irqsave(&pmu->lock, flags); -+ -+ /* mark event as deactivated and stopped */ -+ if (!(hwc->state & PERF_HES_STOPPED)) { -+ WARN_ON_ONCE(pmu->n_active <= 0); -+ pmu->n_active--; -+ if (pmu->n_active == 0) -+ hrtimer_cancel(&pmu->hrtimer); -+ -+ list_del(&event->active_entry); -+ -+ WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED); -+ hwc->state |= PERF_HES_STOPPED; -+ } -+ -+ /* check if update of sw counter is necessary */ -+ if ((mode & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) { -+ /* -+ * Drain the remaining delta count out of a event -+ * that we are disabling: -+ */ -+ rapl_event_update(event); -+ hwc->state |= PERF_HES_UPTODATE; -+ } -+ -+ raw_spin_unlock_irqrestore(&pmu->lock, flags); -+} -+ -+static int rapl_pmu_event_add(struct perf_event *event, int mode) -+{ -+ struct rapl_pmu *pmu = event->pmu_private; -+ struct hw_perf_event *hwc = &event->hw; -+ unsigned long flags; -+ -+ raw_spin_lock_irqsave(&pmu->lock, flags); -+ -+ hwc->state = PERF_HES_UPTODATE | PERF_HES_STOPPED; -+ -+ if (mode & PERF_EF_START) -+ __rapl_pmu_event_start(pmu, event); -+ -+ raw_spin_unlock_irqrestore(&pmu->lock, flags); -+ -+ return 0; -+} -+ -+static void rapl_pmu_event_del(struct perf_event *event, int flags) -+{ -+ rapl_pmu_event_stop(event, PERF_EF_UPDATE); -+} -+ -+static int rapl_pmu_event_init(struct perf_event *event) -+{ -+ u64 cfg = event->attr.config & RAPL_EVENT_MASK; -+ int bit, ret = 0; -+ struct rapl_pmu *pmu; -+ -+ /* only look at RAPL events */ -+ if (event->attr.type != rapl_pmus->pmu.type) -+ return -ENOENT; -+ -+ /* check only supported bits are set */ -+ if (event->attr.config & ~RAPL_EVENT_MASK) -+ return -EINVAL; -+ -+ if (event->cpu < 0) -+ return -EINVAL; -+ -+ event->event_caps |= PERF_EV_CAP_READ_ACTIVE_PKG; -+ -+ if (!cfg || cfg >= NR_RAPL_DOMAINS + 1) -+ return -EINVAL; -+ -+ cfg = array_index_nospec((long)cfg, NR_RAPL_DOMAINS + 1); -+ bit = cfg - 1; -+ -+ /* check event supported */ -+ if (!(rapl_cntr_mask & (1 << bit))) -+ return -EINVAL; -+ -+ /* unsupported modes and filters */ -+ if (event->attr.sample_period) /* no sampling */ -+ return -EINVAL; -+ -+ /* must be done before validate_group */ -+ pmu = cpu_to_rapl_pmu(event->cpu); -+ if (!pmu) -+ return -EINVAL; -+ event->cpu = pmu->cpu; -+ event->pmu_private = pmu; -+ event->hw.event_base = rapl_msrs[bit].msr; -+ event->hw.config = cfg; -+ event->hw.idx = bit; -+ -+ return ret; -+} -+ -+static void rapl_pmu_event_read(struct perf_event *event) -+{ -+ rapl_event_update(event); -+} -+ -+static ssize_t rapl_get_attr_cpumask(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ return cpumap_print_to_pagebuf(true, buf, &rapl_cpu_mask); -+} -+ -+static DEVICE_ATTR(cpumask, S_IRUGO, rapl_get_attr_cpumask, NULL); -+ -+static struct attribute *rapl_pmu_attrs[] = { -+ &dev_attr_cpumask.attr, -+ NULL, -+}; -+ -+static struct attribute_group rapl_pmu_attr_group = { -+ .attrs = rapl_pmu_attrs, -+}; -+ -+RAPL_EVENT_ATTR_STR(energy-cores, rapl_cores, "event=0x01"); -+RAPL_EVENT_ATTR_STR(energy-pkg , rapl_pkg, "event=0x02"); -+RAPL_EVENT_ATTR_STR(energy-ram , rapl_ram, "event=0x03"); -+RAPL_EVENT_ATTR_STR(energy-gpu , rapl_gpu, "event=0x04"); -+RAPL_EVENT_ATTR_STR(energy-psys, rapl_psys, "event=0x05"); -+ -+RAPL_EVENT_ATTR_STR(energy-cores.unit, rapl_cores_unit, "Joules"); -+RAPL_EVENT_ATTR_STR(energy-pkg.unit , rapl_pkg_unit, "Joules"); -+RAPL_EVENT_ATTR_STR(energy-ram.unit , rapl_ram_unit, "Joules"); -+RAPL_EVENT_ATTR_STR(energy-gpu.unit , rapl_gpu_unit, "Joules"); -+RAPL_EVENT_ATTR_STR(energy-psys.unit, rapl_psys_unit, "Joules"); -+ -+/* -+ * we compute in 0.23 nJ increments regardless of MSR -+ */ -+RAPL_EVENT_ATTR_STR(energy-cores.scale, rapl_cores_scale, "2.3283064365386962890625e-10"); -+RAPL_EVENT_ATTR_STR(energy-pkg.scale, rapl_pkg_scale, "2.3283064365386962890625e-10"); -+RAPL_EVENT_ATTR_STR(energy-ram.scale, rapl_ram_scale, "2.3283064365386962890625e-10"); -+RAPL_EVENT_ATTR_STR(energy-gpu.scale, rapl_gpu_scale, "2.3283064365386962890625e-10"); -+RAPL_EVENT_ATTR_STR(energy-psys.scale, rapl_psys_scale, "2.3283064365386962890625e-10"); -+ -+/* -+ * There are no default events, but we need to create -+ * "events" group (with empty attrs) before updating -+ * it with detected events. -+ */ -+static struct attribute *attrs_empty[] = { -+ NULL, -+}; -+ -+static struct attribute_group rapl_pmu_events_group = { -+ .name = "events", -+ .attrs = attrs_empty, -+}; -+ -+DEFINE_RAPL_FORMAT_ATTR(event, event, "config:0-7"); -+static struct attribute *rapl_formats_attr[] = { -+ &format_attr_event.attr, -+ NULL, -+}; -+ -+static struct attribute_group rapl_pmu_format_group = { -+ .name = "format", -+ .attrs = rapl_formats_attr, -+}; -+ -+static const struct attribute_group *rapl_attr_groups[] = { -+ &rapl_pmu_attr_group, -+ &rapl_pmu_format_group, -+ &rapl_pmu_events_group, -+ NULL, -+}; -+ -+static struct attribute *rapl_events_cores[] = { -+ EVENT_PTR(rapl_cores), -+ EVENT_PTR(rapl_cores_unit), -+ EVENT_PTR(rapl_cores_scale), -+ NULL, -+}; -+ -+static struct attribute_group rapl_events_cores_group = { -+ .name = "events", -+ .attrs = rapl_events_cores, -+}; -+ -+static struct attribute *rapl_events_pkg[] = { -+ EVENT_PTR(rapl_pkg), -+ EVENT_PTR(rapl_pkg_unit), -+ EVENT_PTR(rapl_pkg_scale), -+ NULL, -+}; -+ -+static struct attribute_group rapl_events_pkg_group = { -+ .name = "events", -+ .attrs = rapl_events_pkg, -+}; -+ -+static struct attribute *rapl_events_ram[] = { -+ EVENT_PTR(rapl_ram), -+ EVENT_PTR(rapl_ram_unit), -+ EVENT_PTR(rapl_ram_scale), -+ NULL, -+}; -+ -+static struct attribute_group rapl_events_ram_group = { -+ .name = "events", -+ .attrs = rapl_events_ram, -+}; -+ -+static struct attribute *rapl_events_gpu[] = { -+ EVENT_PTR(rapl_gpu), -+ EVENT_PTR(rapl_gpu_unit), -+ EVENT_PTR(rapl_gpu_scale), -+ NULL, -+}; -+ -+static struct attribute_group rapl_events_gpu_group = { -+ .name = "events", -+ .attrs = rapl_events_gpu, -+}; -+ -+static struct attribute *rapl_events_psys[] = { -+ EVENT_PTR(rapl_psys), -+ EVENT_PTR(rapl_psys_unit), -+ EVENT_PTR(rapl_psys_scale), -+ NULL, -+}; -+ -+static struct attribute_group rapl_events_psys_group = { -+ .name = "events", -+ .attrs = rapl_events_psys, -+}; -+ -+static bool test_msr(int idx, void *data) -+{ -+ return test_bit(idx, (unsigned long *) data); -+} -+ -+static struct perf_msr rapl_msrs[] = { -+ [PERF_RAPL_PP0] = { MSR_PP0_ENERGY_STATUS, &rapl_events_cores_group, test_msr }, -+ [PERF_RAPL_PKG] = { MSR_PKG_ENERGY_STATUS, &rapl_events_pkg_group, test_msr }, -+ [PERF_RAPL_RAM] = { MSR_DRAM_ENERGY_STATUS, &rapl_events_ram_group, test_msr }, -+ [PERF_RAPL_PP1] = { MSR_PP1_ENERGY_STATUS, &rapl_events_gpu_group, test_msr }, -+ [PERF_RAPL_PSYS] = { MSR_PLATFORM_ENERGY_STATUS, &rapl_events_psys_group, test_msr }, -+}; -+ -+static int rapl_cpu_offline(unsigned int cpu) -+{ -+ struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); -+ int target; -+ -+ /* Check if exiting cpu is used for collecting rapl events */ -+ if (!cpumask_test_and_clear_cpu(cpu, &rapl_cpu_mask)) -+ return 0; -+ -+ pmu->cpu = -1; -+ /* Find a new cpu to collect rapl events */ -+ target = cpumask_any_but(topology_die_cpumask(cpu), cpu); -+ -+ /* Migrate rapl events to the new target */ -+ if (target < nr_cpu_ids) { -+ cpumask_set_cpu(target, &rapl_cpu_mask); -+ pmu->cpu = target; -+ perf_pmu_migrate_context(pmu->pmu, cpu, target); -+ } -+ return 0; -+} -+ -+static int rapl_cpu_online(unsigned int cpu) -+{ -+ struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); -+ int target; -+ -+ if (!pmu) { -+ pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); -+ if (!pmu) -+ return -ENOMEM; -+ -+ raw_spin_lock_init(&pmu->lock); -+ INIT_LIST_HEAD(&pmu->active_list); -+ pmu->pmu = &rapl_pmus->pmu; -+ pmu->timer_interval = ms_to_ktime(rapl_timer_ms); -+ rapl_hrtimer_init(pmu); -+ -+ rapl_pmus->pmus[topology_logical_die_id(cpu)] = pmu; -+ } -+ -+ /* -+ * Check if there is an online cpu in the package which collects rapl -+ * events already. -+ */ -+ target = cpumask_any_and(&rapl_cpu_mask, topology_die_cpumask(cpu)); -+ if (target < nr_cpu_ids) -+ return 0; -+ -+ cpumask_set_cpu(cpu, &rapl_cpu_mask); -+ pmu->cpu = cpu; -+ return 0; -+} -+ -+static int rapl_check_hw_unit(bool apply_quirk) -+{ -+ u64 msr_rapl_power_unit_bits; -+ int i; -+ -+ /* protect rdmsrl() to handle virtualization */ -+ if (rdmsrl_safe(MSR_RAPL_POWER_UNIT, &msr_rapl_power_unit_bits)) -+ return -1; -+ for (i = 0; i < NR_RAPL_DOMAINS; i++) -+ rapl_hw_unit[i] = (msr_rapl_power_unit_bits >> 8) & 0x1FULL; -+ -+ /* -+ * DRAM domain on HSW server and KNL has fixed energy unit which can be -+ * different than the unit from power unit MSR. See -+ * "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2 -+ * of 2. Datasheet, September 2014, Reference Number: 330784-001 " -+ */ -+ if (apply_quirk) -+ rapl_hw_unit[PERF_RAPL_RAM] = 16; -+ -+ /* -+ * Calculate the timer rate: -+ * Use reference of 200W for scaling the timeout to avoid counter -+ * overflows. 200W = 200 Joules/sec -+ * Divide interval by 2 to avoid lockstep (2 * 100) -+ * if hw unit is 32, then we use 2 ms 1/200/2 -+ */ -+ rapl_timer_ms = 2; -+ if (rapl_hw_unit[0] < 32) { -+ rapl_timer_ms = (1000 / (2 * 100)); -+ rapl_timer_ms *= (1ULL << (32 - rapl_hw_unit[0] - 1)); -+ } -+ return 0; -+} -+ -+static void __init rapl_advertise(void) -+{ -+ int i; -+ -+ pr_info("API unit is 2^-32 Joules, %d fixed counters, %llu ms ovfl timer\n", -+ hweight32(rapl_cntr_mask), rapl_timer_ms); -+ -+ for (i = 0; i < NR_RAPL_DOMAINS; i++) { -+ if (rapl_cntr_mask & (1 << i)) { -+ pr_info("hw unit of domain %s 2^-%d Joules\n", -+ rapl_domain_names[i], rapl_hw_unit[i]); -+ } -+ } -+} -+ -+static void cleanup_rapl_pmus(void) -+{ -+ int i; -+ -+ for (i = 0; i < rapl_pmus->maxdie; i++) -+ kfree(rapl_pmus->pmus[i]); -+ kfree(rapl_pmus); -+} -+ -+static const struct attribute_group *rapl_attr_update[] = { -+ &rapl_events_cores_group, -+ &rapl_events_pkg_group, -+ &rapl_events_ram_group, -+ &rapl_events_gpu_group, -+ &rapl_events_gpu_group, -+ NULL, -+}; -+ -+static int __init init_rapl_pmus(void) -+{ -+ int maxdie = topology_max_packages() * topology_max_die_per_package(); -+ size_t size; -+ -+ size = sizeof(*rapl_pmus) + maxdie * sizeof(struct rapl_pmu *); -+ rapl_pmus = kzalloc(size, GFP_KERNEL); -+ if (!rapl_pmus) -+ return -ENOMEM; -+ -+ rapl_pmus->maxdie = maxdie; -+ rapl_pmus->pmu.attr_groups = rapl_attr_groups; -+ rapl_pmus->pmu.attr_update = rapl_attr_update; -+ rapl_pmus->pmu.task_ctx_nr = perf_invalid_context; -+ rapl_pmus->pmu.event_init = rapl_pmu_event_init; -+ rapl_pmus->pmu.add = rapl_pmu_event_add; -+ rapl_pmus->pmu.del = rapl_pmu_event_del; -+ rapl_pmus->pmu.start = rapl_pmu_event_start; -+ rapl_pmus->pmu.stop = rapl_pmu_event_stop; -+ rapl_pmus->pmu.read = rapl_pmu_event_read; -+ rapl_pmus->pmu.module = THIS_MODULE; -+ rapl_pmus->pmu.capabilities = PERF_PMU_CAP_NO_EXCLUDE; -+ return 0; -+} -+ -+static struct rapl_model model_snb = { -+ .events = BIT(PERF_RAPL_PP0) | -+ BIT(PERF_RAPL_PKG) | -+ BIT(PERF_RAPL_PP1), -+ .apply_quirk = false, -+}; -+ -+static struct rapl_model model_snbep = { -+ .events = BIT(PERF_RAPL_PP0) | -+ BIT(PERF_RAPL_PKG) | -+ BIT(PERF_RAPL_RAM), -+ .apply_quirk = false, -+}; -+ -+static struct rapl_model model_hsw = { -+ .events = BIT(PERF_RAPL_PP0) | -+ BIT(PERF_RAPL_PKG) | -+ BIT(PERF_RAPL_RAM) | -+ BIT(PERF_RAPL_PP1), -+ .apply_quirk = false, -+}; -+ -+static struct rapl_model model_hsx = { -+ .events = BIT(PERF_RAPL_PP0) | -+ BIT(PERF_RAPL_PKG) | -+ BIT(PERF_RAPL_RAM), -+ .apply_quirk = true, -+}; -+ -+static struct rapl_model model_knl = { -+ .events = BIT(PERF_RAPL_PKG) | -+ BIT(PERF_RAPL_RAM), -+ .apply_quirk = true, -+}; -+ -+static struct rapl_model model_skl = { -+ .events = BIT(PERF_RAPL_PP0) | -+ BIT(PERF_RAPL_PKG) | -+ BIT(PERF_RAPL_RAM) | -+ BIT(PERF_RAPL_PP1) | -+ BIT(PERF_RAPL_PSYS), -+ .apply_quirk = false, -+}; -+ -+static const struct x86_cpu_id rapl_model_match[] __initconst = { -+ X86_MATCH_INTEL_FAM6_MODEL(SANDYBRIDGE, &model_snb), -+ X86_MATCH_INTEL_FAM6_MODEL(SANDYBRIDGE_X, &model_snbep), -+ X86_MATCH_INTEL_FAM6_MODEL(IVYBRIDGE, &model_snb), -+ X86_MATCH_INTEL_FAM6_MODEL(IVYBRIDGE_X, &model_snbep), -+ X86_MATCH_INTEL_FAM6_MODEL(HASWELL, &model_hsw), -+ X86_MATCH_INTEL_FAM6_MODEL(HASWELL_X, &model_hsx), -+ X86_MATCH_INTEL_FAM6_MODEL(HASWELL_L, &model_hsw), -+ X86_MATCH_INTEL_FAM6_MODEL(HASWELL_G, &model_hsw), -+ X86_MATCH_INTEL_FAM6_MODEL(BROADWELL, &model_hsw), -+ X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_G, &model_hsw), -+ X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_X, &model_hsx), -+ X86_MATCH_INTEL_FAM6_MODEL(BROADWELL_D, &model_hsx), -+ X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNL, &model_knl), -+ X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNM, &model_knl), -+ X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_L, &model_skl), -+ X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE, &model_skl), -+ X86_MATCH_INTEL_FAM6_MODEL(SKYLAKE_X, &model_hsx), -+ X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE_L, &model_skl), -+ X86_MATCH_INTEL_FAM6_MODEL(KABYLAKE, &model_skl), -+ X86_MATCH_INTEL_FAM6_MODEL(CANNONLAKE_L, &model_skl), -+ X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT, &model_hsw), -+ X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_D, &model_hsw), -+ X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_PLUS, &model_hsw), -+ X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_L, &model_skl), -+ X86_MATCH_INTEL_FAM6_MODEL(ICELAKE, &model_skl), -+ X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE_L, &model_skl), -+ X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE, &model_skl), -+ {}, -+}; -+MODULE_DEVICE_TABLE(x86cpu, rapl_model_match); -+ -+static int __init rapl_pmu_init(void) -+{ -+ const struct x86_cpu_id *id; -+ struct rapl_model *rm; -+ int ret; -+ -+ id = x86_match_cpu(rapl_model_match); -+ if (!id) -+ return -ENODEV; -+ -+ rm = (struct rapl_model *) id->driver_data; -+ rapl_cntr_mask = perf_msr_probe(rapl_msrs, PERF_RAPL_MAX, -+ false, (void *) &rm->events); -+ -+ ret = rapl_check_hw_unit(rm->apply_quirk); -+ if (ret) -+ return ret; -+ -+ ret = init_rapl_pmus(); -+ if (ret) -+ return ret; -+ -+ /* -+ * Install callbacks. Core will call them for each online cpu. -+ */ -+ ret = cpuhp_setup_state(CPUHP_AP_PERF_X86_RAPL_ONLINE, -+ "perf/x86/rapl:online", -+ rapl_cpu_online, rapl_cpu_offline); -+ if (ret) -+ goto out; -+ -+ ret = perf_pmu_register(&rapl_pmus->pmu, "power", -1); -+ if (ret) -+ goto out1; -+ -+ rapl_advertise(); -+ return 0; -+ -+out1: -+ cpuhp_remove_state(CPUHP_AP_PERF_X86_RAPL_ONLINE); -+out: -+ pr_warn("Initialization failed (%d), disabled\n", ret); -+ cleanup_rapl_pmus(); -+ return ret; -+} -+module_init(rapl_pmu_init); -+ -+static void __exit intel_rapl_exit(void) -+{ -+ cpuhp_remove_state_nocalls(CPUHP_AP_PERF_X86_RAPL_ONLINE); -+ perf_pmu_unregister(&rapl_pmus->pmu); -+ cleanup_rapl_pmus(); -+} -+module_exit(intel_rapl_exit); -diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h -index c4e8fd709cf6..e38befea287f 100644 ---- a/arch/x86/include/asm/processor.h -+++ b/arch/x86/include/asm/processor.h -@@ -370,7 +370,7 @@ struct x86_hw_tss { - #define IO_BITMAP_OFFSET_INVALID (__KERNEL_TSS_LIMIT + 1) - - struct entry_stack { -- unsigned long words[64]; -+ char stack[PAGE_SIZE]; - }; - - struct entry_stack_page { -diff --git a/arch/x86/kvm/kvm_cache_regs.h b/arch/x86/kvm/kvm_cache_regs.h -index 62558b9bdda7..a4b8277ae88e 100644 ---- a/arch/x86/kvm/kvm_cache_regs.h -+++ b/arch/x86/kvm/kvm_cache_regs.h -@@ -7,7 +7,7 @@ - #define KVM_POSSIBLE_CR0_GUEST_BITS X86_CR0_TS - #define KVM_POSSIBLE_CR4_GUEST_BITS \ - (X86_CR4_PVI | X86_CR4_DE | X86_CR4_PCE | X86_CR4_OSFXSR \ -- | X86_CR4_OSXMMEXCPT | X86_CR4_LA57 | X86_CR4_PGE) -+ | X86_CR4_OSXMMEXCPT | X86_CR4_LA57 | X86_CR4_PGE | X86_CR4_TSD) - - #define BUILD_KVM_GPR_ACCESSORS(lname, uname) \ - static __always_inline unsigned long kvm_##lname##_read(struct kvm_vcpu *vcpu)\ -diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c -index eb27ab47d607..70cf2c1a1423 100644 ---- a/arch/x86/kvm/mmu/mmu.c -+++ b/arch/x86/kvm/mmu/mmu.c -@@ -4484,7 +4484,7 @@ __reset_rsvds_bits_mask(struct kvm_vcpu *vcpu, - nonleaf_bit8_rsvd | rsvd_bits(7, 7) | - rsvd_bits(maxphyaddr, 51); - rsvd_check->rsvd_bits_mask[0][2] = exb_bit_rsvd | -- nonleaf_bit8_rsvd | gbpages_bit_rsvd | -+ gbpages_bit_rsvd | - rsvd_bits(maxphyaddr, 51); - rsvd_check->rsvd_bits_mask[0][1] = exb_bit_rsvd | - rsvd_bits(maxphyaddr, 51); -diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c -index 390ec34e4b4f..8fafcb2cd103 100644 ---- a/arch/x86/kvm/vmx/vmx.c -+++ b/arch/x86/kvm/vmx/vmx.c -@@ -3932,6 +3932,8 @@ void vmx_set_constant_host_state(struct vcpu_vmx *vmx) - - void set_cr4_guest_host_mask(struct vcpu_vmx *vmx) - { -+ BUILD_BUG_ON(KVM_CR4_GUEST_OWNED_BITS & ~KVM_POSSIBLE_CR4_GUEST_BITS); -+ - vmx->vcpu.arch.cr4_guest_owned_bits = KVM_CR4_GUEST_OWNED_BITS; - if (enable_ept) - vmx->vcpu.arch.cr4_guest_owned_bits |= X86_CR4_PGE; -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 5f08eeac16c8..738a558c915c 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -964,6 +964,8 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) - if (is_long_mode(vcpu)) { - if (!(cr4 & X86_CR4_PAE)) - return 1; -+ if ((cr4 ^ old_cr4) & X86_CR4_LA57) -+ return 1; - } else if (is_paging(vcpu) && (cr4 & X86_CR4_PAE) - && ((cr4 ^ old_cr4) & pdptr_bits) - && !load_pdptrs(vcpu, vcpu->arch.walk_mmu, -diff --git a/block/bio-integrity.c b/block/bio-integrity.c -index ae07dd78e951..c9dc2b17ce25 100644 ---- a/block/bio-integrity.c -+++ b/block/bio-integrity.c -@@ -24,6 +24,18 @@ void blk_flush_integrity(void) - flush_workqueue(kintegrityd_wq); - } - -+void __bio_integrity_free(struct bio_set *bs, struct bio_integrity_payload *bip) -+{ -+ if (bs && mempool_initialized(&bs->bio_integrity_pool)) { -+ if (bip->bip_vec) -+ bvec_free(&bs->bvec_integrity_pool, bip->bip_vec, -+ bip->bip_slab); -+ mempool_free(bip, &bs->bio_integrity_pool); -+ } else { -+ kfree(bip); -+ } -+} -+ - /** - * bio_integrity_alloc - Allocate integrity payload and attach it to bio - * @bio: bio to attach integrity metadata to -@@ -75,7 +87,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, - - return bip; - err: -- mempool_free(bip, &bs->bio_integrity_pool); -+ __bio_integrity_free(bs, bip); - return ERR_PTR(-ENOMEM); - } - EXPORT_SYMBOL(bio_integrity_alloc); -@@ -96,14 +108,7 @@ void bio_integrity_free(struct bio *bio) - kfree(page_address(bip->bip_vec->bv_page) + - bip->bip_vec->bv_offset); - -- if (bs && mempool_initialized(&bs->bio_integrity_pool)) { -- bvec_free(&bs->bvec_integrity_pool, bip->bip_vec, bip->bip_slab); -- -- mempool_free(bip, &bs->bio_integrity_pool); -- } else { -- kfree(bip); -- } -- -+ __bio_integrity_free(bs, bip); - bio->bi_integrity = NULL; - bio->bi_opf &= ~REQ_INTEGRITY; - } -diff --git a/block/blk-mq.c b/block/blk-mq.c -index 8f580e66691b..0d533d084a5f 100644 ---- a/block/blk-mq.c -+++ b/block/blk-mq.c -@@ -803,10 +803,10 @@ static bool blk_mq_rq_inflight(struct blk_mq_hw_ctx *hctx, struct request *rq, - void *priv, bool reserved) - { - /* -- * If we find a request that is inflight and the queue matches, -+ * If we find a request that isn't idle and the queue matches, - * we know the queue is busy. Return false to stop the iteration. - */ -- if (rq->state == MQ_RQ_IN_FLIGHT && rq->q == hctx->queue) { -+ if (blk_mq_request_started(rq) && rq->q == hctx->queue) { - bool *busy = priv; - - *busy = true; -diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c -index 508bbd6ea439..320d23de02c2 100644 ---- a/drivers/base/regmap/regmap.c -+++ b/drivers/base/regmap/regmap.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - - #define CREATE_TRACE_POINTS - #include "trace.h" -@@ -249,22 +250,20 @@ static void regmap_format_8(void *buf, unsigned int val, unsigned int shift) - - static void regmap_format_16_be(void *buf, unsigned int val, unsigned int shift) - { -- __be16 *b = buf; -- -- b[0] = cpu_to_be16(val << shift); -+ put_unaligned_be16(val << shift, buf); - } - - static void regmap_format_16_le(void *buf, unsigned int val, unsigned int shift) - { -- __le16 *b = buf; -- -- b[0] = cpu_to_le16(val << shift); -+ put_unaligned_le16(val << shift, buf); - } - - static void regmap_format_16_native(void *buf, unsigned int val, - unsigned int shift) - { -- *(u16 *)buf = val << shift; -+ u16 v = val << shift; -+ -+ memcpy(buf, &v, sizeof(v)); - } - - static void regmap_format_24(void *buf, unsigned int val, unsigned int shift) -@@ -280,43 +279,39 @@ static void regmap_format_24(void *buf, unsigned int val, unsigned int shift) - - static void regmap_format_32_be(void *buf, unsigned int val, unsigned int shift) - { -- __be32 *b = buf; -- -- b[0] = cpu_to_be32(val << shift); -+ put_unaligned_be32(val << shift, buf); - } - - static void regmap_format_32_le(void *buf, unsigned int val, unsigned int shift) - { -- __le32 *b = buf; -- -- b[0] = cpu_to_le32(val << shift); -+ put_unaligned_le32(val << shift, buf); - } - - static void regmap_format_32_native(void *buf, unsigned int val, - unsigned int shift) - { -- *(u32 *)buf = val << shift; -+ u32 v = val << shift; -+ -+ memcpy(buf, &v, sizeof(v)); - } - - #ifdef CONFIG_64BIT - static void regmap_format_64_be(void *buf, unsigned int val, unsigned int shift) - { -- __be64 *b = buf; -- -- b[0] = cpu_to_be64((u64)val << shift); -+ put_unaligned_be64((u64) val << shift, buf); - } - - static void regmap_format_64_le(void *buf, unsigned int val, unsigned int shift) - { -- __le64 *b = buf; -- -- b[0] = cpu_to_le64((u64)val << shift); -+ put_unaligned_le64((u64) val << shift, buf); - } - - static void regmap_format_64_native(void *buf, unsigned int val, - unsigned int shift) - { -- *(u64 *)buf = (u64)val << shift; -+ u64 v = (u64) val << shift; -+ -+ memcpy(buf, &v, sizeof(v)); - } - #endif - -@@ -333,35 +328,34 @@ static unsigned int regmap_parse_8(const void *buf) - - static unsigned int regmap_parse_16_be(const void *buf) - { -- const __be16 *b = buf; -- -- return be16_to_cpu(b[0]); -+ return get_unaligned_be16(buf); - } - - static unsigned int regmap_parse_16_le(const void *buf) - { -- const __le16 *b = buf; -- -- return le16_to_cpu(b[0]); -+ return get_unaligned_le16(buf); - } - - static void regmap_parse_16_be_inplace(void *buf) - { -- __be16 *b = buf; -+ u16 v = get_unaligned_be16(buf); - -- b[0] = be16_to_cpu(b[0]); -+ memcpy(buf, &v, sizeof(v)); - } - - static void regmap_parse_16_le_inplace(void *buf) - { -- __le16 *b = buf; -+ u16 v = get_unaligned_le16(buf); - -- b[0] = le16_to_cpu(b[0]); -+ memcpy(buf, &v, sizeof(v)); - } - - static unsigned int regmap_parse_16_native(const void *buf) - { -- return *(u16 *)buf; -+ u16 v; -+ -+ memcpy(&v, buf, sizeof(v)); -+ return v; - } - - static unsigned int regmap_parse_24(const void *buf) -@@ -376,69 +370,67 @@ static unsigned int regmap_parse_24(const void *buf) - - static unsigned int regmap_parse_32_be(const void *buf) - { -- const __be32 *b = buf; -- -- return be32_to_cpu(b[0]); -+ return get_unaligned_be32(buf); - } - - static unsigned int regmap_parse_32_le(const void *buf) - { -- const __le32 *b = buf; -- -- return le32_to_cpu(b[0]); -+ return get_unaligned_le32(buf); - } - - static void regmap_parse_32_be_inplace(void *buf) - { -- __be32 *b = buf; -+ u32 v = get_unaligned_be32(buf); - -- b[0] = be32_to_cpu(b[0]); -+ memcpy(buf, &v, sizeof(v)); - } - - static void regmap_parse_32_le_inplace(void *buf) - { -- __le32 *b = buf; -+ u32 v = get_unaligned_le32(buf); - -- b[0] = le32_to_cpu(b[0]); -+ memcpy(buf, &v, sizeof(v)); - } - - static unsigned int regmap_parse_32_native(const void *buf) - { -- return *(u32 *)buf; -+ u32 v; -+ -+ memcpy(&v, buf, sizeof(v)); -+ return v; - } - - #ifdef CONFIG_64BIT - static unsigned int regmap_parse_64_be(const void *buf) - { -- const __be64 *b = buf; -- -- return be64_to_cpu(b[0]); -+ return get_unaligned_be64(buf); - } - - static unsigned int regmap_parse_64_le(const void *buf) - { -- const __le64 *b = buf; -- -- return le64_to_cpu(b[0]); -+ return get_unaligned_le64(buf); - } - - static void regmap_parse_64_be_inplace(void *buf) - { -- __be64 *b = buf; -+ u64 v = get_unaligned_be64(buf); - -- b[0] = be64_to_cpu(b[0]); -+ memcpy(buf, &v, sizeof(v)); - } - - static void regmap_parse_64_le_inplace(void *buf) - { -- __le64 *b = buf; -+ u64 v = get_unaligned_le64(buf); - -- b[0] = le64_to_cpu(b[0]); -+ memcpy(buf, &v, sizeof(v)); - } - - static unsigned int regmap_parse_64_native(const void *buf) - { -- return *(u64 *)buf; -+ u64 v; -+ -+ memcpy(&v, buf, sizeof(v)); -+ return v; - } - #endif - -diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c -index 43cff01a5a67..ce7e9f223b20 100644 ---- a/drivers/block/nbd.c -+++ b/drivers/block/nbd.c -@@ -1033,25 +1033,26 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, - test_bit(NBD_RT_BOUND, &config->runtime_flags))) { - dev_err(disk_to_dev(nbd->disk), - "Device being setup by another task"); -- sockfd_put(sock); -- return -EBUSY; -+ err = -EBUSY; -+ goto put_socket; -+ } -+ -+ nsock = kzalloc(sizeof(*nsock), GFP_KERNEL); -+ if (!nsock) { -+ err = -ENOMEM; -+ goto put_socket; - } - - socks = krealloc(config->socks, (config->num_connections + 1) * - sizeof(struct nbd_sock *), GFP_KERNEL); - if (!socks) { -- sockfd_put(sock); -- return -ENOMEM; -+ kfree(nsock); -+ err = -ENOMEM; -+ goto put_socket; - } - - config->socks = socks; - -- nsock = kzalloc(sizeof(struct nbd_sock), GFP_KERNEL); -- if (!nsock) { -- sockfd_put(sock); -- return -ENOMEM; -- } -- - nsock->fallback_index = -1; - nsock->dead = false; - mutex_init(&nsock->tx_lock); -@@ -1063,6 +1064,10 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, - atomic_inc(&config->live_connections); - - return 0; -+ -+put_socket: -+ sockfd_put(sock); -+ return err; - } - - static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg) -diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c -index 2204a444e801..3cf4b402cdac 100644 ---- a/drivers/clocksource/arm_arch_timer.c -+++ b/drivers/clocksource/arm_arch_timer.c -@@ -480,6 +480,14 @@ static const struct arch_timer_erratum_workaround ool_workarounds[] = { - .set_next_event_virt = erratum_set_next_event_tval_virt, - }, - #endif -+#ifdef CONFIG_ARM64_ERRATUM_1418040 -+ { -+ .match_type = ate_match_local_cap_id, -+ .id = (void *)ARM64_WORKAROUND_1418040, -+ .desc = "ARM erratum 1418040", -+ .disable_compat_vdso = true, -+ }, -+#endif - }; - - typedef bool (*ate_match_fn_t)(const struct arch_timer_erratum_workaround *, -@@ -566,6 +574,9 @@ void arch_timer_enable_workaround(const struct arch_timer_erratum_workaround *wa - if (wa->read_cntvct_el0) { - clocksource_counter.vdso_clock_mode = VDSO_CLOCKMODE_NONE; - vdso_default = VDSO_CLOCKMODE_NONE; -+ } else if (wa->disable_compat_vdso && vdso_default != VDSO_CLOCKMODE_NONE) { -+ vdso_default = VDSO_CLOCKMODE_ARCHTIMER_NOCOMPAT; -+ clocksource_counter.vdso_clock_mode = vdso_default; - } - } - -diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c -index 01011a780688..48bea0997e70 100644 ---- a/drivers/gpio/gpio-pca953x.c -+++ b/drivers/gpio/gpio-pca953x.c -@@ -107,6 +107,84 @@ static const struct i2c_device_id pca953x_id[] = { - }; - MODULE_DEVICE_TABLE(i2c, pca953x_id); - -+#ifdef CONFIG_GPIO_PCA953X_IRQ -+ -+#include -+#include -+#include -+ -+static const struct dmi_system_id pca953x_dmi_acpi_irq_info[] = { -+ { -+ /* -+ * On Intel Galileo Gen 2 board the IRQ pin of one of -+ * the I²C GPIO expanders, which has GpioInt() resource, -+ * is provided as an absolute number instead of being -+ * relative. Since first controller (gpio-sch.c) and -+ * second (gpio-dwapb.c) are at the fixed bases, we may -+ * safely refer to the number in the global space to get -+ * an IRQ out of it. -+ */ -+ .matches = { -+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "GalileoGen2"), -+ }, -+ }, -+ {} -+}; -+ -+#ifdef CONFIG_ACPI -+static int pca953x_acpi_get_pin(struct acpi_resource *ares, void *data) -+{ -+ struct acpi_resource_gpio *agpio; -+ int *pin = data; -+ -+ if (acpi_gpio_get_irq_resource(ares, &agpio)) -+ *pin = agpio->pin_table[0]; -+ return 1; -+} -+ -+static int pca953x_acpi_find_pin(struct device *dev) -+{ -+ struct acpi_device *adev = ACPI_COMPANION(dev); -+ int pin = -ENOENT, ret; -+ LIST_HEAD(r); -+ -+ ret = acpi_dev_get_resources(adev, &r, pca953x_acpi_get_pin, &pin); -+ acpi_dev_free_resource_list(&r); -+ if (ret < 0) -+ return ret; -+ -+ return pin; -+} -+#else -+static inline int pca953x_acpi_find_pin(struct device *dev) { return -ENXIO; } -+#endif -+ -+static int pca953x_acpi_get_irq(struct device *dev) -+{ -+ int pin, ret; -+ -+ pin = pca953x_acpi_find_pin(dev); -+ if (pin < 0) -+ return pin; -+ -+ dev_info(dev, "Applying ACPI interrupt quirk (GPIO %d)\n", pin); -+ -+ if (!gpio_is_valid(pin)) -+ return -EINVAL; -+ -+ ret = gpio_request(pin, "pca953x interrupt"); -+ if (ret) -+ return ret; -+ -+ ret = gpio_to_irq(pin); -+ -+ /* When pin is used as an IRQ, no need to keep it requested */ -+ gpio_free(pin); -+ -+ return ret; -+} -+#endif -+ - static const struct acpi_device_id pca953x_acpi_ids[] = { - { "INT3491", 16 | PCA953X_TYPE | PCA_LATCH_INT, }, - { } -@@ -613,8 +691,6 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d) - DECLARE_BITMAP(reg_direction, MAX_LINE); - int level; - -- pca953x_read_regs(chip, chip->regs->direction, reg_direction); -- - if (chip->driver_data & PCA_PCAL) { - /* Enable latch on interrupt-enabled inputs */ - pca953x_write_regs(chip, PCAL953X_IN_LATCH, chip->irq_mask); -@@ -625,7 +701,11 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d) - pca953x_write_regs(chip, PCAL953X_INT_MASK, irq_mask); - } - -+ /* Switch direction to input if needed */ -+ pca953x_read_regs(chip, chip->regs->direction, reg_direction); -+ - bitmap_or(irq_mask, chip->irq_trig_fall, chip->irq_trig_raise, gc->ngpio); -+ bitmap_complement(reg_direction, reg_direction, gc->ngpio); - bitmap_and(irq_mask, irq_mask, reg_direction, gc->ngpio); - - /* Look for any newly setup interrupt */ -@@ -724,14 +804,16 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid) - struct gpio_chip *gc = &chip->gpio_chip; - DECLARE_BITMAP(pending, MAX_LINE); - int level; -+ bool ret; - -- if (!pca953x_irq_pending(chip, pending)) -- return IRQ_NONE; -+ mutex_lock(&chip->i2c_lock); -+ ret = pca953x_irq_pending(chip, pending); -+ mutex_unlock(&chip->i2c_lock); - - for_each_set_bit(level, pending, gc->ngpio) - handle_nested_irq(irq_find_mapping(gc->irq.domain, level)); - -- return IRQ_HANDLED; -+ return IRQ_RETVAL(ret); - } - - static int pca953x_irq_setup(struct pca953x_chip *chip, int irq_base) -@@ -742,6 +824,12 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, int irq_base) - DECLARE_BITMAP(irq_stat, MAX_LINE); - int ret; - -+ if (dmi_first_match(pca953x_dmi_acpi_irq_info)) { -+ ret = pca953x_acpi_get_irq(&client->dev); -+ if (ret > 0) -+ client->irq = ret; -+ } -+ - if (!client->irq) - return 0; - -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c -index 4981e443a884..2f0eff2c23c7 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c -@@ -36,7 +36,8 @@ static void amdgpu_job_timedout(struct drm_sched_job *s_job) - - memset(&ti, 0, sizeof(struct amdgpu_task_info)); - -- if (amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) { -+ if (amdgpu_gpu_recovery && -+ amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) { - DRM_ERROR("ring %s timeout, but soft recovered\n", - s_job->sched->name); - return; -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c -index deaa26808841..3c6f60c5b1a5 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c -@@ -370,6 +370,52 @@ static int psp_tmr_load(struct psp_context *psp) - return ret; - } - -+static void psp_prep_tmr_unload_cmd_buf(struct psp_context *psp, -+ struct psp_gfx_cmd_resp *cmd) -+{ -+ if (amdgpu_sriov_vf(psp->adev)) -+ cmd->cmd_id = GFX_CMD_ID_DESTROY_VMR; -+ else -+ cmd->cmd_id = GFX_CMD_ID_DESTROY_TMR; -+} -+ -+static int psp_tmr_unload(struct psp_context *psp) -+{ -+ int ret; -+ struct psp_gfx_cmd_resp *cmd; -+ -+ cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL); -+ if (!cmd) -+ return -ENOMEM; -+ -+ psp_prep_tmr_unload_cmd_buf(psp, cmd); -+ DRM_INFO("free PSP TMR buffer\n"); -+ -+ ret = psp_cmd_submit_buf(psp, NULL, cmd, -+ psp->fence_buf_mc_addr); -+ -+ kfree(cmd); -+ -+ return ret; -+} -+ -+static int psp_tmr_terminate(struct psp_context *psp) -+{ -+ int ret; -+ void *tmr_buf; -+ void **pptr; -+ -+ ret = psp_tmr_unload(psp); -+ if (ret) -+ return ret; -+ -+ /* free TMR memory buffer */ -+ pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL; -+ amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, pptr); -+ -+ return 0; -+} -+ - static void psp_prep_asd_load_cmd_buf(struct psp_gfx_cmd_resp *cmd, - uint64_t asd_mc, uint32_t size) - { -@@ -1575,8 +1621,6 @@ static int psp_hw_fini(void *handle) - { - struct amdgpu_device *adev = (struct amdgpu_device *)handle; - struct psp_context *psp = &adev->psp; -- void *tmr_buf; -- void **pptr; - - if (psp->adev->psp.ta_fw) { - psp_ras_terminate(psp); -@@ -1586,10 +1630,9 @@ static int psp_hw_fini(void *handle) - - psp_asd_unload(psp); - -+ psp_tmr_terminate(psp); - psp_ring_destroy(psp, PSP_RING_TYPE__KM); - -- pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL; -- amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, pptr); - amdgpu_bo_free_kernel(&psp->fw_pri_bo, - &psp->fw_pri_mc_addr, &psp->fw_pri_buf); - amdgpu_bo_free_kernel(&psp->fence_buf_bo, -@@ -1636,6 +1679,18 @@ static int psp_suspend(void *handle) - } - } - -+ ret = psp_tmr_terminate(psp); -+ if (ret) { -+ DRM_ERROR("Falied to terminate tmr\n"); -+ return ret; -+ } -+ -+ ret = psp_asd_unload(psp); -+ if (ret) { -+ DRM_ERROR("Failed to unload asd\n"); -+ return ret; -+ } -+ - ret = psp_ring_stop(psp, PSP_RING_TYPE__KM); - if (ret) { - DRM_ERROR("PSP ring stop failed\n"); -diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c -index ffd95bfeaa94..d00ea384dcbf 100644 ---- a/drivers/gpu/drm/drm_panel_orientation_quirks.c -+++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c -@@ -30,12 +30,6 @@ struct drm_dmi_panel_orientation_data { - int orientation; - }; - --static const struct drm_dmi_panel_orientation_data acer_s1003 = { -- .width = 800, -- .height = 1280, -- .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, --}; -- - static const struct drm_dmi_panel_orientation_data asus_t100ha = { - .width = 800, - .height = 1280, -@@ -114,13 +108,19 @@ static const struct dmi_system_id orientation_data[] = { - DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"), - DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), - }, -- .driver_data = (void *)&acer_s1003, -+ .driver_data = (void *)&lcd800x1280_rightside_up, - }, { /* Asus T100HA */ - .matches = { - DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100HAN"), - }, - .driver_data = (void *)&asus_t100ha, -+ }, { /* Asus T101HA */ -+ .matches = { -+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), -+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T101HA"), -+ }, -+ .driver_data = (void *)&lcd800x1280_rightside_up, - }, { /* GPD MicroPC (generic strings, also match on bios date) */ - .matches = { - DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"), -diff --git a/drivers/gpu/drm/i915/gt/intel_context.c b/drivers/gpu/drm/i915/gt/intel_context.c -index aea992e46c42..711380375fa1 100644 ---- a/drivers/gpu/drm/i915/gt/intel_context.c -+++ b/drivers/gpu/drm/i915/gt/intel_context.c -@@ -201,25 +201,25 @@ static int __ring_active(struct intel_ring *ring) - { - int err; - -- err = i915_active_acquire(&ring->vma->active); -+ err = intel_ring_pin(ring); - if (err) - return err; - -- err = intel_ring_pin(ring); -+ err = i915_active_acquire(&ring->vma->active); - if (err) -- goto err_active; -+ goto err_pin; - - return 0; - --err_active: -- i915_active_release(&ring->vma->active); -+err_pin: -+ intel_ring_unpin(ring); - return err; - } - - static void __ring_retire(struct intel_ring *ring) - { -- intel_ring_unpin(ring); - i915_active_release(&ring->vma->active); -+ intel_ring_unpin(ring); - } - - __i915_active_call -diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c -index 6ca797128aa1..4472b6eb3085 100644 ---- a/drivers/gpu/drm/i915/i915_debugfs.c -+++ b/drivers/gpu/drm/i915/i915_debugfs.c -@@ -229,7 +229,7 @@ static int per_file_stats(int id, void *ptr, void *data) - struct file_stats *stats = data; - struct i915_vma *vma; - -- if (!kref_get_unless_zero(&obj->base.refcount)) -+ if (IS_ERR_OR_NULL(obj) || !kref_get_unless_zero(&obj->base.refcount)) - return 0; - - stats->count++; -diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c -index 2cd7a7e87c0a..1e4bd2d4f019 100644 ---- a/drivers/gpu/drm/i915/i915_vma.c -+++ b/drivers/gpu/drm/i915/i915_vma.c -@@ -104,6 +104,7 @@ vma_create(struct drm_i915_gem_object *obj, - struct i915_address_space *vm, - const struct i915_ggtt_view *view) - { -+ struct i915_vma *pos = ERR_PTR(-E2BIG); - struct i915_vma *vma; - struct rb_node *rb, **p; - -@@ -184,7 +185,6 @@ vma_create(struct drm_i915_gem_object *obj, - rb = NULL; - p = &obj->vma.tree.rb_node; - while (*p) { -- struct i915_vma *pos; - long cmp; - - rb = *p; -@@ -196,16 +196,12 @@ vma_create(struct drm_i915_gem_object *obj, - * and dispose of ours. - */ - cmp = i915_vma_compare(pos, vm, view); -- if (cmp == 0) { -- spin_unlock(&obj->vma.lock); -- i915_vma_free(vma); -- return pos; -- } -- - if (cmp < 0) - p = &rb->rb_right; -- else -+ else if (cmp > 0) - p = &rb->rb_left; -+ else -+ goto err_unlock; - } - rb_link_node(&vma->obj_node, rb, p); - rb_insert_color(&vma->obj_node, &obj->vma.tree); -@@ -228,8 +224,9 @@ vma_create(struct drm_i915_gem_object *obj, - err_unlock: - spin_unlock(&obj->vma.lock); - err_vma: -+ i915_vm_put(vm); - i915_vma_free(vma); -- return ERR_PTR(-E2BIG); -+ return pos; - } - - static struct i915_vma * -diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c -index f28cb7a576ba..1e7c5aa4d5e6 100644 ---- a/drivers/gpu/drm/mcde/mcde_drv.c -+++ b/drivers/gpu/drm/mcde/mcde_drv.c -@@ -208,7 +208,6 @@ static int mcde_modeset_init(struct drm_device *drm) - - drm_mode_config_reset(drm); - drm_kms_helper_poll_init(drm); -- drm_fbdev_generic_setup(drm, 32); - - return 0; - -@@ -275,6 +274,8 @@ static int mcde_drm_bind(struct device *dev) - if (ret < 0) - goto unbind; - -+ drm_fbdev_generic_setup(drm, 32); -+ - return 0; - - unbind: -diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c -index c2bd683a87c8..92141a19681b 100644 ---- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c -+++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c -@@ -164,6 +164,16 @@ static int mtk_plane_atomic_check(struct drm_plane *plane, - true, true); - } - -+static void mtk_plane_atomic_disable(struct drm_plane *plane, -+ struct drm_plane_state *old_state) -+{ -+ struct mtk_plane_state *state = to_mtk_plane_state(plane->state); -+ -+ state->pending.enable = false; -+ wmb(); /* Make sure the above parameter is set before update */ -+ state->pending.dirty = true; -+} -+ - static void mtk_plane_atomic_update(struct drm_plane *plane, - struct drm_plane_state *old_state) - { -@@ -178,6 +188,11 @@ static void mtk_plane_atomic_update(struct drm_plane *plane, - if (!crtc || WARN_ON(!fb)) - return; - -+ if (!plane->state->visible) { -+ mtk_plane_atomic_disable(plane, old_state); -+ return; -+ } -+ - gem = fb->obj[0]; - mtk_gem = to_mtk_gem_obj(gem); - addr = mtk_gem->dma_addr; -@@ -200,16 +215,6 @@ static void mtk_plane_atomic_update(struct drm_plane *plane, - state->pending.dirty = true; - } - --static void mtk_plane_atomic_disable(struct drm_plane *plane, -- struct drm_plane_state *old_state) --{ -- struct mtk_plane_state *state = to_mtk_plane_state(plane->state); -- -- state->pending.enable = false; -- wmb(); /* Make sure the above parameter is set before update */ -- state->pending.dirty = true; --} -- - static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = { - .prepare_fb = drm_gem_fb_prepare_fb, - .atomic_check = mtk_plane_atomic_check, -diff --git a/drivers/gpu/drm/meson/meson_registers.h b/drivers/gpu/drm/meson/meson_registers.h -index 8ea00546cd4e..049c4bfe2a3a 100644 ---- a/drivers/gpu/drm/meson/meson_registers.h -+++ b/drivers/gpu/drm/meson/meson_registers.h -@@ -261,6 +261,12 @@ - #define VIU_OSD_FIFO_DEPTH_VAL(val) ((val & 0x7f) << 12) - #define VIU_OSD_WORDS_PER_BURST(words) (((words & 0x4) >> 1) << 22) - #define VIU_OSD_FIFO_LIMITS(size) ((size & 0xf) << 24) -+#define VIU_OSD_BURST_LENGTH_24 (0x0 << 31 | 0x0 << 10) -+#define VIU_OSD_BURST_LENGTH_32 (0x0 << 31 | 0x1 << 10) -+#define VIU_OSD_BURST_LENGTH_48 (0x0 << 31 | 0x2 << 10) -+#define VIU_OSD_BURST_LENGTH_64 (0x0 << 31 | 0x3 << 10) -+#define VIU_OSD_BURST_LENGTH_96 (0x1 << 31 | 0x0 << 10) -+#define VIU_OSD_BURST_LENGTH_128 (0x1 << 31 | 0x1 << 10) - - #define VD1_IF0_GEN_REG 0x1a50 - #define VD1_IF0_CANVAS0 0x1a51 -diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meson_viu.c -index 304f8ff1339c..aede0c67a57f 100644 ---- a/drivers/gpu/drm/meson/meson_viu.c -+++ b/drivers/gpu/drm/meson/meson_viu.c -@@ -411,13 +411,6 @@ void meson_viu_gxm_disable_osd1_afbc(struct meson_drm *priv) - priv->io_base + _REG(VIU_MISC_CTRL1)); - } - --static inline uint32_t meson_viu_osd_burst_length_reg(uint32_t length) --{ -- uint32_t val = (((length & 0x80) % 24) / 12); -- -- return (((val & 0x3) << 10) | (((val & 0x4) >> 2) << 31)); --} -- - void meson_viu_init(struct meson_drm *priv) - { - uint32_t reg; -@@ -444,9 +437,9 @@ void meson_viu_init(struct meson_drm *priv) - VIU_OSD_FIFO_LIMITS(2); /* fifo_lim: 2*16=32 */ - - if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) -- reg |= meson_viu_osd_burst_length_reg(32); -+ reg |= VIU_OSD_BURST_LENGTH_32; - else -- reg |= meson_viu_osd_burst_length_reg(64); -+ reg |= VIU_OSD_BURST_LENGTH_64; - - writel_relaxed(reg, priv->io_base + _REG(VIU_OSD1_FIFO_CTRL_STAT)); - writel_relaxed(reg, priv->io_base + _REG(VIU_OSD2_FIFO_CTRL_STAT)); -diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c -index a9257bed3484..30b5a59353c5 100644 ---- a/drivers/gpu/drm/radeon/ci_dpm.c -+++ b/drivers/gpu/drm/radeon/ci_dpm.c -@@ -5577,6 +5577,7 @@ static int ci_parse_power_table(struct radeon_device *rdev) - if (!rdev->pm.dpm.ps) - return -ENOMEM; - power_state_offset = (u8 *)state_array->states; -+ rdev->pm.dpm.num_ps = 0; - for (i = 0; i < state_array->ucNumEntries; i++) { - u8 *idx; - power_state = (union pplib_power_state *)power_state_offset; -@@ -5586,10 +5587,8 @@ static int ci_parse_power_table(struct radeon_device *rdev) - if (!rdev->pm.power_state[i].clock_info) - return -EINVAL; - ps = kzalloc(sizeof(struct ci_ps), GFP_KERNEL); -- if (ps == NULL) { -- kfree(rdev->pm.dpm.ps); -+ if (ps == NULL) - return -ENOMEM; -- } - rdev->pm.dpm.ps[i].ps_priv = ps; - ci_parse_pplib_non_clock_info(rdev, &rdev->pm.dpm.ps[i], - non_clock_info, -@@ -5611,8 +5610,8 @@ static int ci_parse_power_table(struct radeon_device *rdev) - k++; - } - power_state_offset += 2 + power_state->v2.ucNumDPMLevels; -+ rdev->pm.dpm.num_ps = i + 1; - } -- rdev->pm.dpm.num_ps = state_array->ucNumEntries; - - /* fill in the vce power states */ - for (i = 0; i < RADEON_MAX_VCE_LEVELS; i++) { -diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c -index 8183e617bf6b..a2ef8f218d4e 100644 ---- a/drivers/gpu/drm/tegra/hub.c -+++ b/drivers/gpu/drm/tegra/hub.c -@@ -149,7 +149,9 @@ int tegra_display_hub_prepare(struct tegra_display_hub *hub) - for (i = 0; i < hub->soc->num_wgrps; i++) { - struct tegra_windowgroup *wgrp = &hub->wgrps[i]; - -- tegra_windowgroup_enable(wgrp); -+ /* Skip orphaned window group whose parent DC is disabled */ -+ if (wgrp->parent) -+ tegra_windowgroup_enable(wgrp); - } - - return 0; -@@ -166,7 +168,9 @@ void tegra_display_hub_cleanup(struct tegra_display_hub *hub) - for (i = 0; i < hub->soc->num_wgrps; i++) { - struct tegra_windowgroup *wgrp = &hub->wgrps[i]; - -- tegra_windowgroup_disable(wgrp); -+ /* Skip orphaned window group whose parent DC is disabled */ -+ if (wgrp->parent) -+ tegra_windowgroup_disable(wgrp); - } - } - -diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c -index 9e07c3f75156..ef5bc00c73e2 100644 ---- a/drivers/gpu/drm/ttm/ttm_bo.c -+++ b/drivers/gpu/drm/ttm/ttm_bo.c -@@ -881,8 +881,10 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo, - if (!fence) - return 0; - -- if (no_wait_gpu) -+ if (no_wait_gpu) { -+ dma_fence_put(fence); - return -EBUSY; -+ } - - dma_resv_add_shared_fence(bo->base.resv, fence); - -diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c -index 0ad30b112982..72100b84c7a9 100644 ---- a/drivers/gpu/drm/ttm/ttm_bo_vm.c -+++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c -@@ -300,8 +300,10 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf, - break; - case -EBUSY: - case -ERESTARTSYS: -+ dma_fence_put(moving); - return VM_FAULT_NOPAGE; - default: -+ dma_fence_put(moving); - return VM_FAULT_SIGBUS; - } - -diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c -index 6a995db51d6d..e201f62d62c0 100644 ---- a/drivers/gpu/host1x/bus.c -+++ b/drivers/gpu/host1x/bus.c -@@ -686,8 +686,17 @@ EXPORT_SYMBOL(host1x_driver_register_full); - */ - void host1x_driver_unregister(struct host1x_driver *driver) - { -+ struct host1x *host1x; -+ - driver_unregister(&driver->driver); - -+ mutex_lock(&devices_lock); -+ -+ list_for_each_entry(host1x, &devices, list) -+ host1x_detach_driver(host1x, driver); -+ -+ mutex_unlock(&devices_lock); -+ - mutex_lock(&drivers_lock); - list_del_init(&driver->list); - mutex_unlock(&drivers_lock); -diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c -index d24344e91922..3c0f151847ba 100644 ---- a/drivers/gpu/host1x/dev.c -+++ b/drivers/gpu/host1x/dev.c -@@ -468,11 +468,12 @@ static int host1x_probe(struct platform_device *pdev) - - err = host1x_register(host); - if (err < 0) -- goto deinit_intr; -+ goto deinit_debugfs; - - return 0; - --deinit_intr: -+deinit_debugfs: -+ host1x_debug_deinit(host); - host1x_intr_deinit(host); - deinit_syncpt: - host1x_syncpt_deinit(host); -diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c -index 74e0058fcf9e..0c14ab2244d4 100644 ---- a/drivers/infiniband/core/sa_query.c -+++ b/drivers/infiniband/core/sa_query.c -@@ -829,13 +829,20 @@ static int ib_nl_get_path_rec_attrs_len(ib_sa_comp_mask comp_mask) - return len; - } - --static int ib_nl_send_msg(struct ib_sa_query *query, gfp_t gfp_mask) -+static int ib_nl_make_request(struct ib_sa_query *query, gfp_t gfp_mask) - { - struct sk_buff *skb = NULL; - struct nlmsghdr *nlh; - void *data; - struct ib_sa_mad *mad; - int len; -+ unsigned long flags; -+ unsigned long delay; -+ gfp_t gfp_flag; -+ int ret; -+ -+ INIT_LIST_HEAD(&query->list); -+ query->seq = (u32)atomic_inc_return(&ib_nl_sa_request_seq); - - mad = query->mad_buf->mad; - len = ib_nl_get_path_rec_attrs_len(mad->sa_hdr.comp_mask); -@@ -860,36 +867,25 @@ static int ib_nl_send_msg(struct ib_sa_query *query, gfp_t gfp_mask) - /* Repair the nlmsg header length */ - nlmsg_end(skb, nlh); - -- return rdma_nl_multicast(&init_net, skb, RDMA_NL_GROUP_LS, gfp_mask); --} -+ gfp_flag = ((gfp_mask & GFP_ATOMIC) == GFP_ATOMIC) ? GFP_ATOMIC : -+ GFP_NOWAIT; - --static int ib_nl_make_request(struct ib_sa_query *query, gfp_t gfp_mask) --{ -- unsigned long flags; -- unsigned long delay; -- int ret; -+ spin_lock_irqsave(&ib_nl_request_lock, flags); -+ ret = rdma_nl_multicast(&init_net, skb, RDMA_NL_GROUP_LS, gfp_flag); - -- INIT_LIST_HEAD(&query->list); -- query->seq = (u32)atomic_inc_return(&ib_nl_sa_request_seq); -+ if (ret) -+ goto out; - -- /* Put the request on the list first.*/ -- spin_lock_irqsave(&ib_nl_request_lock, flags); -+ /* Put the request on the list.*/ - delay = msecs_to_jiffies(sa_local_svc_timeout_ms); - query->timeout = delay + jiffies; - list_add_tail(&query->list, &ib_nl_request_list); - /* Start the timeout if this is the only request */ - if (ib_nl_request_list.next == &query->list) - queue_delayed_work(ib_nl_wq, &ib_nl_timed_work, delay); -- spin_unlock_irqrestore(&ib_nl_request_lock, flags); - -- ret = ib_nl_send_msg(query, gfp_mask); -- if (ret) { -- ret = -EIO; -- /* Remove the request */ -- spin_lock_irqsave(&ib_nl_request_lock, flags); -- list_del(&query->list); -- spin_unlock_irqrestore(&ib_nl_request_lock, flags); -- } -+out: -+ spin_unlock_irqrestore(&ib_nl_request_lock, flags); - - return ret; - } -diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c -index 3759d9233a1c..498684551427 100644 ---- a/drivers/infiniband/hw/hfi1/init.c -+++ b/drivers/infiniband/hw/hfi1/init.c -@@ -828,6 +828,29 @@ wq_error: - return -ENOMEM; - } - -+/** -+ * destroy_workqueues - destroy per port workqueues -+ * @dd: the hfi1_ib device -+ */ -+static void destroy_workqueues(struct hfi1_devdata *dd) -+{ -+ int pidx; -+ struct hfi1_pportdata *ppd; -+ -+ for (pidx = 0; pidx < dd->num_pports; ++pidx) { -+ ppd = dd->pport + pidx; -+ -+ if (ppd->hfi1_wq) { -+ destroy_workqueue(ppd->hfi1_wq); -+ ppd->hfi1_wq = NULL; -+ } -+ if (ppd->link_wq) { -+ destroy_workqueue(ppd->link_wq); -+ ppd->link_wq = NULL; -+ } -+ } -+} -+ - /** - * enable_general_intr() - Enable the IRQs that will be handled by the - * general interrupt handler. -@@ -1101,15 +1124,10 @@ static void shutdown_device(struct hfi1_devdata *dd) - * We can't count on interrupts since we are stopping. - */ - hfi1_quiet_serdes(ppd); -- -- if (ppd->hfi1_wq) { -- destroy_workqueue(ppd->hfi1_wq); -- ppd->hfi1_wq = NULL; -- } -- if (ppd->link_wq) { -- destroy_workqueue(ppd->link_wq); -- ppd->link_wq = NULL; -- } -+ if (ppd->hfi1_wq) -+ flush_workqueue(ppd->hfi1_wq); -+ if (ppd->link_wq) -+ flush_workqueue(ppd->link_wq); - } - sdma_exit(dd); - } -@@ -1757,6 +1775,7 @@ static void remove_one(struct pci_dev *pdev) - * clear dma engines, etc. - */ - shutdown_device(dd); -+ destroy_workqueues(dd); - - stop_timers(dd); - -diff --git a/drivers/infiniband/hw/hfi1/qp.c b/drivers/infiniband/hw/hfi1/qp.c -index f8e733aa3bb8..acd4400b0092 100644 ---- a/drivers/infiniband/hw/hfi1/qp.c -+++ b/drivers/infiniband/hw/hfi1/qp.c -@@ -381,7 +381,10 @@ bool _hfi1_schedule_send(struct rvt_qp *qp) - struct hfi1_ibport *ibp = - to_iport(qp->ibqp.device, qp->port_num); - struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); -- struct hfi1_devdata *dd = dd_from_ibdev(qp->ibqp.device); -+ struct hfi1_devdata *dd = ppd->dd; -+ -+ if (dd->flags & HFI1_SHUTDOWN) -+ return true; - - return iowait_schedule(&priv->s_iowait, ppd->hfi1_wq, - priv->s_sde ? -diff --git a/drivers/infiniband/hw/hfi1/tid_rdma.c b/drivers/infiniband/hw/hfi1/tid_rdma.c -index 8a2e0d9351e9..7c6fd720fb2e 100644 ---- a/drivers/infiniband/hw/hfi1/tid_rdma.c -+++ b/drivers/infiniband/hw/hfi1/tid_rdma.c -@@ -5406,7 +5406,10 @@ static bool _hfi1_schedule_tid_send(struct rvt_qp *qp) - struct hfi1_ibport *ibp = - to_iport(qp->ibqp.device, qp->port_num); - struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); -- struct hfi1_devdata *dd = dd_from_ibdev(qp->ibqp.device); -+ struct hfi1_devdata *dd = ppd->dd; -+ -+ if ((dd->flags & HFI1_SHUTDOWN)) -+ return true; - - return iowait_tid_schedule(&priv->s_iowait, ppd->hfi1_wq, - priv->s_sde ? -diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c -index 6679756506e6..820e407b3e26 100644 ---- a/drivers/infiniband/hw/mlx5/main.c -+++ b/drivers/infiniband/hw/mlx5/main.c -@@ -515,7 +515,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, - mdev_port_num); - if (err) - goto out; -- ext = MLX5_CAP_PCAM_FEATURE(dev->mdev, ptys_extended_ethernet); -+ ext = !!MLX5_GET_ETH_PROTO(ptys_reg, out, true, eth_proto_capability); - eth_prot_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, eth_proto_oper); - - props->active_width = IB_WIDTH_4X; -diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c -index 5cd40fb9e20c..634c4b371623 100644 ---- a/drivers/infiniband/sw/siw/siw_main.c -+++ b/drivers/infiniband/sw/siw/siw_main.c -@@ -67,12 +67,13 @@ static int siw_device_register(struct siw_device *sdev, const char *name) - static int dev_id = 1; - int rv; - -+ sdev->vendor_part_id = dev_id++; -+ - rv = ib_register_device(base_dev, name); - if (rv) { - pr_warn("siw: device registration error %d\n", rv); - return rv; - } -- sdev->vendor_part_id = dev_id++; - - siw_dbg(base_dev, "HWaddr=%pM\n", sdev->netdev->dev_addr); - -diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c -index 34b2ed91cf4d..2acf2842c3bd 100644 ---- a/drivers/iommu/intel-iommu.c -+++ b/drivers/iommu/intel-iommu.c -@@ -6206,6 +6206,23 @@ intel_iommu_domain_set_attr(struct iommu_domain *domain, - return ret; - } - -+/* -+ * Check that the device does not live on an external facing PCI port that is -+ * marked as untrusted. Such devices should not be able to apply quirks and -+ * thus not be able to bypass the IOMMU restrictions. -+ */ -+static bool risky_device(struct pci_dev *pdev) -+{ -+ if (pdev->untrusted) { -+ pci_info(pdev, -+ "Skipping IOMMU quirk for dev [%04X:%04X] on untrusted PCI link\n", -+ pdev->vendor, pdev->device); -+ pci_info(pdev, "Please check with your BIOS/Platform vendor about this\n"); -+ return true; -+ } -+ return false; -+} -+ - const struct iommu_ops intel_iommu_ops = { - .capable = intel_iommu_capable, - .domain_alloc = intel_iommu_domain_alloc, -@@ -6235,6 +6252,9 @@ const struct iommu_ops intel_iommu_ops = { - - static void quirk_iommu_igfx(struct pci_dev *dev) - { -+ if (risky_device(dev)) -+ return; -+ - pci_info(dev, "Disabling IOMMU for graphics on this chipset\n"); - dmar_map_gfx = 0; - } -@@ -6276,6 +6296,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x163D, quirk_iommu_igfx); - - static void quirk_iommu_rwbf(struct pci_dev *dev) - { -+ if (risky_device(dev)) -+ return; -+ - /* - * Mobile 4 Series Chipset neglects to set RWBF capability, - * but needs it. Same seems to hold for the desktop versions. -@@ -6306,6 +6329,9 @@ static void quirk_calpella_no_shadow_gtt(struct pci_dev *dev) - { - unsigned short ggc; - -+ if (risky_device(dev)) -+ return; -+ - if (pci_read_config_word(dev, GGC, &ggc)) - return; - -@@ -6339,6 +6365,12 @@ static void __init check_tylersburg_isoch(void) - pdev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x3a3e, NULL); - if (!pdev) - return; -+ -+ if (risky_device(pdev)) { -+ pci_dev_put(pdev); -+ return; -+ } -+ - pci_dev_put(pdev); - - /* System Management Registers. Might be hidden, in which case -@@ -6348,6 +6380,11 @@ static void __init check_tylersburg_isoch(void) - if (!pdev) - return; - -+ if (risky_device(pdev)) { -+ pci_dev_put(pdev); -+ return; -+ } -+ - if (pci_read_config_dword(pdev, 0x188, &vtisochctrl)) { - pci_dev_put(pdev); - return; -diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c -index b3e16a06c13b..b99e3105bf9f 100644 ---- a/drivers/irqchip/irq-gic-v3-its.c -+++ b/drivers/irqchip/irq-gic-v3-its.c -@@ -3938,16 +3938,24 @@ static void its_vpe_4_1_deschedule(struct its_vpe *vpe, - u64 val; - - if (info->req_db) { -+ unsigned long flags; -+ - /* - * vPE is going to block: make the vPE non-resident with - * PendingLast clear and DB set. The GIC guarantees that if - * we read-back PendingLast clear, then a doorbell will be - * delivered when an interrupt comes. -+ * -+ * Note the locking to deal with the concurrent update of -+ * pending_last from the doorbell interrupt handler that can -+ * run concurrently. - */ -+ raw_spin_lock_irqsave(&vpe->vpe_lock, flags); - val = its_clear_vpend_valid(vlpi_base, - GICR_VPENDBASER_PendingLast, - GICR_VPENDBASER_4_1_DB); - vpe->pending_last = !!(val & GICR_VPENDBASER_PendingLast); -+ raw_spin_unlock_irqrestore(&vpe->vpe_lock, flags); - } else { - /* - * We're not blocking, so just make the vPE non-resident -diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c -index 5cc94f57421c..00d774bdd2b1 100644 ---- a/drivers/md/dm-writecache.c -+++ b/drivers/md/dm-writecache.c -@@ -2232,6 +2232,12 @@ invalid_optional: - } - - if (WC_MODE_PMEM(wc)) { -+ if (!dax_synchronous(wc->ssd_dev->dax_dev)) { -+ r = -EOPNOTSUPP; -+ ti->error = "Asynchronous persistent memory not supported as pmem cache"; -+ goto bad; -+ } -+ - r = persistent_memory_claim(wc); - if (r) { - ti->error = "Unable to map persistent memory for cache"; -diff --git a/drivers/md/dm.c b/drivers/md/dm.c -index db9e46114653..05333fc2f8d2 100644 ---- a/drivers/md/dm.c -+++ b/drivers/md/dm.c -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -2894,17 +2895,25 @@ EXPORT_SYMBOL_GPL(dm_internal_resume_fast); - int dm_kobject_uevent(struct mapped_device *md, enum kobject_action action, - unsigned cookie) - { -+ int r; -+ unsigned noio_flag; - char udev_cookie[DM_COOKIE_LENGTH]; - char *envp[] = { udev_cookie, NULL }; - -+ noio_flag = memalloc_noio_save(); -+ - if (!cookie) -- return kobject_uevent(&disk_to_dev(md->disk)->kobj, action); -+ r = kobject_uevent(&disk_to_dev(md->disk)->kobj, action); - else { - snprintf(udev_cookie, DM_COOKIE_LENGTH, "%s=%u", - DM_COOKIE_ENV_VAR_NAME, cookie); -- return kobject_uevent_env(&disk_to_dev(md->disk)->kobj, -- action, envp); -+ r = kobject_uevent_env(&disk_to_dev(md->disk)->kobj, -+ action, envp); - } -+ -+ memalloc_noio_restore(noio_flag); -+ -+ return r; - } - - uint32_t dm_next_uevent_seq(struct mapped_device *md) -diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c -index f0737c57ed5f..1491561d2e5c 100644 ---- a/drivers/message/fusion/mptscsih.c -+++ b/drivers/message/fusion/mptscsih.c -@@ -118,8 +118,6 @@ int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state); - int mptscsih_resume(struct pci_dev *pdev); - #endif - --#define SNS_LEN(scp) SCSI_SENSE_BUFFERSIZE -- - - /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ - /* -@@ -2422,7 +2420,7 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR - /* Copy the sense received into the scsi command block. */ - req_index = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); - sense_data = ((u8 *)ioc->sense_buf_pool + (req_index * MPT_SENSE_BUFFER_ALLOC)); -- memcpy(sc->sense_buffer, sense_data, SNS_LEN(sc)); -+ memcpy(sc->sense_buffer, sense_data, MPT_SENSE_BUFFER_ALLOC); - - /* Log SMART data (asc = 0x5D, non-IM case only) if required. - */ -diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c -index 35400cf2a2e4..cfaf8e7e22ec 100644 ---- a/drivers/mmc/host/meson-gx-mmc.c -+++ b/drivers/mmc/host/meson-gx-mmc.c -@@ -1143,9 +1143,11 @@ static int meson_mmc_probe(struct platform_device *pdev) - - mmc->caps |= MMC_CAP_CMD23; - if (host->dram_access_quirk) { -+ /* Limit segments to 1 due to low available sram memory */ -+ mmc->max_segs = 1; - /* Limit to the available sram memory */ -- mmc->max_segs = SD_EMMC_SRAM_DATA_BUF_LEN / mmc->max_blk_size; -- mmc->max_blk_count = mmc->max_segs; -+ mmc->max_blk_count = SD_EMMC_SRAM_DATA_BUF_LEN / -+ mmc->max_blk_size; - } else { - mmc->max_blk_count = CMD_CFG_LENGTH_MASK; - mmc->max_segs = SD_EMMC_DESC_BUF_LEN / -diff --git a/drivers/mmc/host/owl-mmc.c b/drivers/mmc/host/owl-mmc.c -index 5e20c099fe03..df43f42855e2 100644 ---- a/drivers/mmc/host/owl-mmc.c -+++ b/drivers/mmc/host/owl-mmc.c -@@ -689,7 +689,7 @@ MODULE_DEVICE_TABLE(of, owl_mmc_of_match); - static struct platform_driver owl_mmc_driver = { - .driver = { - .name = "owl_mmc", -- .of_match_table = of_match_ptr(owl_mmc_of_match), -+ .of_match_table = owl_mmc_of_match, - }, - .probe = owl_mmc_probe, - .remove = owl_mmc_remove, -diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c -index 29d41003d6e0..f8317ccd8f2a 100644 ---- a/drivers/mtd/mtdcore.c -+++ b/drivers/mtd/mtdcore.c -@@ -1235,8 +1235,8 @@ int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, - return -EROFS; - if (!len) - return 0; -- if (!mtd->oops_panic_write) -- mtd->oops_panic_write = true; -+ if (!master->oops_panic_write) -+ master->oops_panic_write = true; - - return master->_panic_write(master, mtd_get_master_ofs(mtd, to), len, - retlen, buf); -diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c -index 47d65b77caf7..7c17b0f705ec 100644 ---- a/drivers/net/dsa/microchip/ksz8795.c -+++ b/drivers/net/dsa/microchip/ksz8795.c -@@ -1268,6 +1268,9 @@ static int ksz8795_switch_init(struct ksz_device *dev) - return -ENOMEM; - } - -+ /* set the real number of ports */ -+ dev->ds->num_ports = dev->port_cnt; -+ - return 0; - } - -diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c -index 9a51b8a4de5d..8d15c3016024 100644 ---- a/drivers/net/dsa/microchip/ksz9477.c -+++ b/drivers/net/dsa/microchip/ksz9477.c -@@ -1588,6 +1588,9 @@ static int ksz9477_switch_init(struct ksz_device *dev) - return -ENOMEM; - } - -+ /* set the real number of ports */ -+ dev->ds->num_ports = dev->port_cnt; -+ - return 0; - } - -diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c -index d1f68fc16291..e6b1fb10ad91 100644 ---- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c -+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c -@@ -1651,7 +1651,7 @@ void hw_atl_rpfl3l4_ipv6_src_addr_set(struct aq_hw_s *aq_hw, u8 location, - for (i = 0; i < 4; ++i) - aq_hw_write_reg(aq_hw, - HW_ATL_RPF_L3_SRCA_ADR(location + i), -- ipv6_src[i]); -+ ipv6_src[3 - i]); - } - - void hw_atl_rpfl3l4_ipv6_dest_addr_set(struct aq_hw_s *aq_hw, u8 location, -@@ -1662,7 +1662,7 @@ void hw_atl_rpfl3l4_ipv6_dest_addr_set(struct aq_hw_s *aq_hw, u8 location, - for (i = 0; i < 4; ++i) - aq_hw_write_reg(aq_hw, - HW_ATL_RPF_L3_DSTA_ADR(location + i), -- ipv6_dest[i]); -+ ipv6_dest[3 - i]); - } - - u32 hw_atl_sem_ram_get(struct aq_hw_s *self) -diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h -index 18de2f7b8959..a7590b9ea2df 100644 ---- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h -+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h -@@ -1360,7 +1360,7 @@ - */ - - /* Register address for bitfield pif_rpf_l3_da0_i[31:0] */ --#define HW_ATL_RPF_L3_DSTA_ADR(filter) (0x000053B0 + (filter) * 0x4) -+#define HW_ATL_RPF_L3_DSTA_ADR(filter) (0x000053D0 + (filter) * 0x4) - /* Bitmask for bitfield l3_da0[1F:0] */ - #define HW_ATL_RPF_L3_DSTA_MSK 0xFFFFFFFFu - /* Inverted bitmask for bitfield l3_da0[1F:0] */ -diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c -index cea2f9958a1d..2295f539a641 100644 ---- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c -+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c -@@ -396,6 +396,7 @@ static void bnxt_free_vf_resources(struct bnxt *bp) - } - } - -+ bp->pf.active_vfs = 0; - kfree(bp->pf.vf); - bp->pf.vf = NULL; - } -@@ -835,7 +836,6 @@ void bnxt_sriov_disable(struct bnxt *bp) - - bnxt_free_vf_resources(bp); - -- bp->pf.active_vfs = 0; - /* Reclaim all resources for the PF. */ - rtnl_lock(); - bnxt_restore_pf_fw_resources(bp); -diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c -index 52582e8ed90e..f1f0976e7669 100644 ---- a/drivers/net/ethernet/cadence/macb_main.c -+++ b/drivers/net/ethernet/cadence/macb_main.c -@@ -2821,11 +2821,13 @@ static void macb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) - { - struct macb *bp = netdev_priv(netdev); - -- wol->supported = 0; -- wol->wolopts = 0; -- -- if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) -+ if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) { - phylink_ethtool_get_wol(bp->phylink, wol); -+ wol->supported |= WAKE_MAGIC; -+ -+ if (bp->wol & MACB_WOL_ENABLED) -+ wol->wolopts |= WAKE_MAGIC; -+ } - } - - static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) -@@ -2833,9 +2835,13 @@ static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) - struct macb *bp = netdev_priv(netdev); - int ret; - -+ /* Pass the order to phylink layer */ - ret = phylink_ethtool_set_wol(bp->phylink, wol); -- if (!ret) -- return 0; -+ /* Don't manage WoL on MAC if handled by the PHY -+ * or if there's a failure in talking to the PHY -+ */ -+ if (!ret || ret != -EOPNOTSUPP) -+ return ret; - - if (!(bp->wol & MACB_WOL_HAS_MAGIC_PACKET) || - (wol->wolopts & ~WAKE_MAGIC)) -@@ -4422,7 +4428,7 @@ static int macb_probe(struct platform_device *pdev) - bp->wol = 0; - if (of_get_property(np, "magic-packet", NULL)) - bp->wol |= MACB_WOL_HAS_MAGIC_PACKET; -- device_init_wakeup(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET); -+ device_set_wakeup_capable(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET); - - spin_lock_init(&bp->lock); - -@@ -4598,10 +4604,10 @@ static int __maybe_unused macb_suspend(struct device *dev) - bp->pm_data.scrt2 = gem_readl_n(bp, ETHT, SCRT2_ETHT); - } - -- netif_carrier_off(netdev); - if (bp->ptp_info) - bp->ptp_info->ptp_remove(netdev); -- pm_runtime_force_suspend(dev); -+ if (!device_may_wakeup(dev)) -+ pm_runtime_force_suspend(dev); - - return 0; - } -@@ -4616,7 +4622,8 @@ static int __maybe_unused macb_resume(struct device *dev) - if (!netif_running(netdev)) - return 0; - -- pm_runtime_force_resume(dev); -+ if (!device_may_wakeup(dev)) -+ pm_runtime_force_resume(dev); - - if (bp->wol & MACB_WOL_ENABLED) { - macb_writel(bp, IDR, MACB_BIT(WOL)); -@@ -4654,7 +4661,7 @@ static int __maybe_unused macb_runtime_suspend(struct device *dev) - struct net_device *netdev = dev_get_drvdata(dev); - struct macb *bp = netdev_priv(netdev); - -- if (!(device_may_wakeup(&bp->dev->dev))) { -+ if (!(device_may_wakeup(dev))) { - clk_disable_unprepare(bp->tx_clk); - clk_disable_unprepare(bp->hclk); - clk_disable_unprepare(bp->pclk); -@@ -4670,7 +4677,7 @@ static int __maybe_unused macb_runtime_resume(struct device *dev) - struct net_device *netdev = dev_get_drvdata(dev); - struct macb *bp = netdev_priv(netdev); - -- if (!(device_may_wakeup(&bp->dev->dev))) { -+ if (!(device_may_wakeup(dev))) { - clk_prepare_enable(bp->pclk); - clk_prepare_enable(bp->hclk); - clk_prepare_enable(bp->tx_clk); -diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c -index 7a7f61a8cdf4..d02d346629b3 100644 ---- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c -+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c -@@ -1112,16 +1112,16 @@ static bool is_addr_all_mask(u8 *ipmask, int family) - struct in_addr *addr; - - addr = (struct in_addr *)ipmask; -- if (ntohl(addr->s_addr) == 0xffffffff) -+ if (addr->s_addr == htonl(0xffffffff)) - return true; - } else if (family == AF_INET6) { - struct in6_addr *addr6; - - addr6 = (struct in6_addr *)ipmask; -- if (ntohl(addr6->s6_addr32[0]) == 0xffffffff && -- ntohl(addr6->s6_addr32[1]) == 0xffffffff && -- ntohl(addr6->s6_addr32[2]) == 0xffffffff && -- ntohl(addr6->s6_addr32[3]) == 0xffffffff) -+ if (addr6->s6_addr32[0] == htonl(0xffffffff) && -+ addr6->s6_addr32[1] == htonl(0xffffffff) && -+ addr6->s6_addr32[2] == htonl(0xffffffff) && -+ addr6->s6_addr32[3] == htonl(0xffffffff)) - return true; - } - return false; -diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c -index 2a3480fc1d91..9121cef2be2d 100644 ---- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c -+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c -@@ -3493,7 +3493,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, - drv_fw = &fw_info->fw_hdr; - - /* Read the header of the firmware on the card */ -- ret = -t4_read_flash(adap, FLASH_FW_START, -+ ret = t4_read_flash(adap, FLASH_FW_START, - sizeof(*card_fw) / sizeof(uint32_t), - (uint32_t *)card_fw, 1); - if (ret == 0) { -@@ -3522,8 +3522,8 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, - should_install_fs_fw(adap, card_fw_usable, - be32_to_cpu(fs_fw->fw_ver), - be32_to_cpu(card_fw->fw_ver))) { -- ret = -t4_fw_upgrade(adap, adap->mbox, fw_data, -- fw_size, 0); -+ ret = t4_fw_upgrade(adap, adap->mbox, fw_data, -+ fw_size, 0); - if (ret != 0) { - dev_err(adap->pdev_dev, - "failed to install firmware: %d\n", ret); -@@ -3554,7 +3554,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, - FW_HDR_FW_VER_MICRO_G(c), FW_HDR_FW_VER_BUILD_G(c), - FW_HDR_FW_VER_MAJOR_G(k), FW_HDR_FW_VER_MINOR_G(k), - FW_HDR_FW_VER_MICRO_G(k), FW_HDR_FW_VER_BUILD_G(k)); -- ret = EINVAL; -+ ret = -EINVAL; - goto bye; - } - -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -index da98fd7c8eca..3003eecd5263 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c -@@ -4153,9 +4153,8 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset) - - hns3_put_ring_config(priv); - -- hns3_dbg_uninit(handle); -- - out_netdev_free: -+ hns3_dbg_uninit(handle); - free_netdev(netdev); - } - -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c -index 28b81f24afa1..2a78805d531a 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c -@@ -174,18 +174,21 @@ static void hns3_lb_check_skb_data(struct hns3_enet_ring *ring, - { - struct hns3_enet_tqp_vector *tqp_vector = ring->tqp_vector; - unsigned char *packet = skb->data; -+ u32 len = skb_headlen(skb); - u32 i; - -- for (i = 0; i < skb->len; i++) -+ len = min_t(u32, len, HNS3_NIC_LB_TEST_PACKET_SIZE); -+ -+ for (i = 0; i < len; i++) - if (packet[i] != (unsigned char)(i & 0xff)) - break; - - /* The packet is correctly received */ -- if (i == skb->len) -+ if (i == HNS3_NIC_LB_TEST_PACKET_SIZE) - tqp_vector->rx_group.total_packets++; - else - print_hex_dump(KERN_ERR, "selftest:", DUMP_PREFIX_OFFSET, 16, 1, -- skb->data, skb->len, true); -+ skb->data, len, true); - - dev_kfree_skb_any(skb); - } -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -index a758f9ae32be..4de268a87958 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c -@@ -9351,7 +9351,7 @@ retry: - set_bit(HCLGE_STATE_RST_HANDLING, &hdev->state); - hdev->reset_type = HNAE3_FLR_RESET; - ret = hclge_reset_prepare(hdev); -- if (ret) { -+ if (ret || hdev->reset_pending) { - dev_err(&hdev->pdev->dev, "fail to prepare FLR, ret=%d\n", - ret); - if (hdev->reset_pending || -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -index e02d427131ee..e6cdd06925e6 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -@@ -1527,6 +1527,11 @@ static int hclgevf_reset_prepare_wait(struct hclgevf_dev *hdev) - if (hdev->reset_type == HNAE3_VF_FUNC_RESET) { - hclgevf_build_send_msg(&send_msg, HCLGE_MBX_RESET, 0); - ret = hclgevf_send_mbx_msg(hdev, &send_msg, true, NULL, 0); -+ if (ret) { -+ dev_err(&hdev->pdev->dev, -+ "failed to assert VF reset, ret = %d\n", ret); -+ return ret; -+ } - hdev->rst_stats.vf_func_rst_cnt++; - } - -diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c -index 2baf7b3ff4cb..0fd7eae25fe9 100644 ---- a/drivers/net/ethernet/ibm/ibmvnic.c -+++ b/drivers/net/ethernet/ibm/ibmvnic.c -@@ -1971,13 +1971,18 @@ static int do_reset(struct ibmvnic_adapter *adapter, - release_sub_crqs(adapter, 1); - } else { - rc = ibmvnic_reset_crq(adapter); -- if (!rc) -+ if (rc == H_CLOSED || rc == H_SUCCESS) { - rc = vio_enable_interrupts(adapter->vdev); -+ if (rc) -+ netdev_err(adapter->netdev, -+ "Reset failed to enable interrupts. rc=%d\n", -+ rc); -+ } - } - - if (rc) { - netdev_err(adapter->netdev, -- "Couldn't initialize crq. rc=%d\n", rc); -+ "Reset couldn't initialize crq. rc=%d\n", rc); - goto out; - } - -diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c -index 2a037ec244b9..80dc5fcb82db 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_main.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c -@@ -439,11 +439,15 @@ static void i40e_get_netdev_stats_struct(struct net_device *netdev, - i40e_get_netdev_stats_struct_tx(ring, stats); - - if (i40e_enabled_xdp_vsi(vsi)) { -- ring++; -+ ring = READ_ONCE(vsi->xdp_rings[i]); -+ if (!ring) -+ continue; - i40e_get_netdev_stats_struct_tx(ring, stats); - } - -- ring++; -+ ring = READ_ONCE(vsi->rx_rings[i]); -+ if (!ring) -+ continue; - do { - start = u64_stats_fetch_begin_irq(&ring->syncp); - packets = ring->stats.packets; -@@ -787,6 +791,8 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) - for (q = 0; q < vsi->num_queue_pairs; q++) { - /* locate Tx ring */ - p = READ_ONCE(vsi->tx_rings[q]); -+ if (!p) -+ continue; - - do { - start = u64_stats_fetch_begin_irq(&p->syncp); -@@ -800,8 +806,11 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi) - tx_linearize += p->tx_stats.tx_linearize; - tx_force_wb += p->tx_stats.tx_force_wb; - -- /* Rx queue is part of the same block as Tx queue */ -- p = &p[1]; -+ /* locate Rx ring */ -+ p = READ_ONCE(vsi->rx_rings[q]); -+ if (!p) -+ continue; -+ - do { - start = u64_stats_fetch_begin_irq(&p->syncp); - packets = p->stats.packets; -@@ -10816,10 +10825,10 @@ static void i40e_vsi_clear_rings(struct i40e_vsi *vsi) - if (vsi->tx_rings && vsi->tx_rings[0]) { - for (i = 0; i < vsi->alloc_queue_pairs; i++) { - kfree_rcu(vsi->tx_rings[i], rcu); -- vsi->tx_rings[i] = NULL; -- vsi->rx_rings[i] = NULL; -+ WRITE_ONCE(vsi->tx_rings[i], NULL); -+ WRITE_ONCE(vsi->rx_rings[i], NULL); - if (vsi->xdp_rings) -- vsi->xdp_rings[i] = NULL; -+ WRITE_ONCE(vsi->xdp_rings[i], NULL); - } - } - } -@@ -10853,7 +10862,7 @@ static int i40e_alloc_rings(struct i40e_vsi *vsi) - if (vsi->back->hw_features & I40E_HW_WB_ON_ITR_CAPABLE) - ring->flags = I40E_TXR_FLAGS_WB_ON_ITR; - ring->itr_setting = pf->tx_itr_default; -- vsi->tx_rings[i] = ring++; -+ WRITE_ONCE(vsi->tx_rings[i], ring++); - - if (!i40e_enabled_xdp_vsi(vsi)) - goto setup_rx; -@@ -10871,7 +10880,7 @@ static int i40e_alloc_rings(struct i40e_vsi *vsi) - ring->flags = I40E_TXR_FLAGS_WB_ON_ITR; - set_ring_xdp(ring); - ring->itr_setting = pf->tx_itr_default; -- vsi->xdp_rings[i] = ring++; -+ WRITE_ONCE(vsi->xdp_rings[i], ring++); - - setup_rx: - ring->queue_index = i; -@@ -10884,7 +10893,7 @@ setup_rx: - ring->size = 0; - ring->dcb_tc = 0; - ring->itr_setting = pf->rx_itr_default; -- vsi->rx_rings[i] = ring; -+ WRITE_ONCE(vsi->rx_rings[i], ring); - } - - return 0; -diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c -index 2f256bf45efc..6dd839b32525 100644 ---- a/drivers/net/ethernet/intel/ice/ice_lib.c -+++ b/drivers/net/ethernet/intel/ice/ice_lib.c -@@ -1063,7 +1063,7 @@ static void ice_vsi_clear_rings(struct ice_vsi *vsi) - for (i = 0; i < vsi->alloc_txq; i++) { - if (vsi->tx_rings[i]) { - kfree_rcu(vsi->tx_rings[i], rcu); -- vsi->tx_rings[i] = NULL; -+ WRITE_ONCE(vsi->tx_rings[i], NULL); - } - } - } -@@ -1071,7 +1071,7 @@ static void ice_vsi_clear_rings(struct ice_vsi *vsi) - for (i = 0; i < vsi->alloc_rxq; i++) { - if (vsi->rx_rings[i]) { - kfree_rcu(vsi->rx_rings[i], rcu); -- vsi->rx_rings[i] = NULL; -+ WRITE_ONCE(vsi->rx_rings[i], NULL); - } - } - } -@@ -1104,7 +1104,7 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi) - ring->vsi = vsi; - ring->dev = dev; - ring->count = vsi->num_tx_desc; -- vsi->tx_rings[i] = ring; -+ WRITE_ONCE(vsi->tx_rings[i], ring); - } - - /* Allocate Rx rings */ -@@ -1123,7 +1123,7 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi) - ring->netdev = vsi->netdev; - ring->dev = dev; - ring->count = vsi->num_rx_desc; -- vsi->rx_rings[i] = ring; -+ WRITE_ONCE(vsi->rx_rings[i], ring); - } - - return 0; -diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c -index 69e50331e08e..7fd2ec63f128 100644 ---- a/drivers/net/ethernet/intel/ice/ice_main.c -+++ b/drivers/net/ethernet/intel/ice/ice_main.c -@@ -1701,7 +1701,7 @@ static int ice_xdp_alloc_setup_rings(struct ice_vsi *vsi) - xdp_ring->netdev = NULL; - xdp_ring->dev = dev; - xdp_ring->count = vsi->num_tx_desc; -- vsi->xdp_rings[i] = xdp_ring; -+ WRITE_ONCE(vsi->xdp_rings[i], xdp_ring); - if (ice_setup_tx_ring(xdp_ring)) - goto free_xdp_rings; - ice_set_ring_xdp(xdp_ring); -diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c -index fd9f5d41b594..2e35c5706cf1 100644 ---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c -+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c -@@ -921,7 +921,7 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, - ring->queue_index = txr_idx; - - /* assign ring to adapter */ -- adapter->tx_ring[txr_idx] = ring; -+ WRITE_ONCE(adapter->tx_ring[txr_idx], ring); - - /* update count and index */ - txr_count--; -@@ -948,7 +948,7 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, - set_ring_xdp(ring); - - /* assign ring to adapter */ -- adapter->xdp_ring[xdp_idx] = ring; -+ WRITE_ONCE(adapter->xdp_ring[xdp_idx], ring); - - /* update count and index */ - xdp_count--; -@@ -991,7 +991,7 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, - ring->queue_index = rxr_idx; - - /* assign ring to adapter */ -- adapter->rx_ring[rxr_idx] = ring; -+ WRITE_ONCE(adapter->rx_ring[rxr_idx], ring); - - /* update count and index */ - rxr_count--; -@@ -1020,13 +1020,13 @@ static void ixgbe_free_q_vector(struct ixgbe_adapter *adapter, int v_idx) - - ixgbe_for_each_ring(ring, q_vector->tx) { - if (ring_is_xdp(ring)) -- adapter->xdp_ring[ring->queue_index] = NULL; -+ WRITE_ONCE(adapter->xdp_ring[ring->queue_index], NULL); - else -- adapter->tx_ring[ring->queue_index] = NULL; -+ WRITE_ONCE(adapter->tx_ring[ring->queue_index], NULL); - } - - ixgbe_for_each_ring(ring, q_vector->rx) -- adapter->rx_ring[ring->queue_index] = NULL; -+ WRITE_ONCE(adapter->rx_ring[ring->queue_index], NULL); - - adapter->q_vector[v_idx] = NULL; - napi_hash_del(&q_vector->napi); -diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -index ea6834bae04c..a32a072761aa 100644 ---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c -@@ -7065,7 +7065,10 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) - } - - for (i = 0; i < adapter->num_rx_queues; i++) { -- struct ixgbe_ring *rx_ring = adapter->rx_ring[i]; -+ struct ixgbe_ring *rx_ring = READ_ONCE(adapter->rx_ring[i]); -+ -+ if (!rx_ring) -+ continue; - non_eop_descs += rx_ring->rx_stats.non_eop_descs; - alloc_rx_page += rx_ring->rx_stats.alloc_rx_page; - alloc_rx_page_failed += rx_ring->rx_stats.alloc_rx_page_failed; -@@ -7086,15 +7089,20 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) - packets = 0; - /* gather some stats to the adapter struct that are per queue */ - for (i = 0; i < adapter->num_tx_queues; i++) { -- struct ixgbe_ring *tx_ring = adapter->tx_ring[i]; -+ struct ixgbe_ring *tx_ring = READ_ONCE(adapter->tx_ring[i]); -+ -+ if (!tx_ring) -+ continue; - restart_queue += tx_ring->tx_stats.restart_queue; - tx_busy += tx_ring->tx_stats.tx_busy; - bytes += tx_ring->stats.bytes; - packets += tx_ring->stats.packets; - } - for (i = 0; i < adapter->num_xdp_queues; i++) { -- struct ixgbe_ring *xdp_ring = adapter->xdp_ring[i]; -+ struct ixgbe_ring *xdp_ring = READ_ONCE(adapter->xdp_ring[i]); - -+ if (!xdp_ring) -+ continue; - restart_queue += xdp_ring->tx_stats.restart_queue; - tx_busy += xdp_ring->tx_stats.tx_busy; - bytes += xdp_ring->stats.bytes; -diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c -index 43b44a1e8f69..cf26cf4e47aa 100644 ---- a/drivers/net/ethernet/marvell/mvneta.c -+++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -106,9 +106,11 @@ - #define MVNETA_TX_IN_PRGRS BIT(1) - #define MVNETA_TX_FIFO_EMPTY BIT(8) - #define MVNETA_RX_MIN_FRAME_SIZE 0x247c -+/* Only exists on Armada XP and Armada 370 */ - #define MVNETA_SERDES_CFG 0x24A0 - #define MVNETA_SGMII_SERDES_PROTO 0x0cc7 - #define MVNETA_QSGMII_SERDES_PROTO 0x0667 -+#define MVNETA_HSGMII_SERDES_PROTO 0x1107 - #define MVNETA_TYPE_PRIO 0x24bc - #define MVNETA_FORCE_UNI BIT(21) - #define MVNETA_TXQ_CMD_1 0x24e4 -@@ -3523,26 +3525,60 @@ static int mvneta_setup_txqs(struct mvneta_port *pp) - return 0; - } - --static int mvneta_comphy_init(struct mvneta_port *pp) -+static int mvneta_comphy_init(struct mvneta_port *pp, phy_interface_t interface) - { - int ret; - -- if (!pp->comphy) -- return 0; -- -- ret = phy_set_mode_ext(pp->comphy, PHY_MODE_ETHERNET, -- pp->phy_interface); -+ ret = phy_set_mode_ext(pp->comphy, PHY_MODE_ETHERNET, interface); - if (ret) - return ret; - - return phy_power_on(pp->comphy); - } - -+static int mvneta_config_interface(struct mvneta_port *pp, -+ phy_interface_t interface) -+{ -+ int ret = 0; -+ -+ if (pp->comphy) { -+ if (interface == PHY_INTERFACE_MODE_SGMII || -+ interface == PHY_INTERFACE_MODE_1000BASEX || -+ interface == PHY_INTERFACE_MODE_2500BASEX) { -+ ret = mvneta_comphy_init(pp, interface); -+ } -+ } else { -+ switch (interface) { -+ case PHY_INTERFACE_MODE_QSGMII: -+ mvreg_write(pp, MVNETA_SERDES_CFG, -+ MVNETA_QSGMII_SERDES_PROTO); -+ break; -+ -+ case PHY_INTERFACE_MODE_SGMII: -+ case PHY_INTERFACE_MODE_1000BASEX: -+ mvreg_write(pp, MVNETA_SERDES_CFG, -+ MVNETA_SGMII_SERDES_PROTO); -+ break; -+ -+ case PHY_INTERFACE_MODE_2500BASEX: -+ mvreg_write(pp, MVNETA_SERDES_CFG, -+ MVNETA_HSGMII_SERDES_PROTO); -+ break; -+ default: -+ return -EINVAL; -+ } -+ } -+ -+ pp->phy_interface = interface; -+ -+ return ret; -+} -+ - static void mvneta_start_dev(struct mvneta_port *pp) - { - int cpu; - -- WARN_ON(mvneta_comphy_init(pp)); -+ WARN_ON(mvneta_config_interface(pp, pp->phy_interface)); - - mvneta_max_rx_size_set(pp, pp->pkt_size); - mvneta_txq_max_tx_size_set(pp, pp->pkt_size); -@@ -3917,17 +3953,13 @@ static void mvneta_mac_config(struct phylink_config *config, unsigned int mode, - /* When at 2.5G, the link partner can send frames with shortened - * preambles. - */ -- if (state->speed == SPEED_2500) -+ if (state->interface == PHY_INTERFACE_MODE_2500BASEX) - new_ctrl4 |= MVNETA_GMAC4_SHORT_PREAMBLE_ENABLE; - -- if (pp->comphy && pp->phy_interface != state->interface && -- (state->interface == PHY_INTERFACE_MODE_SGMII || -- state->interface == PHY_INTERFACE_MODE_1000BASEX || -- state->interface == PHY_INTERFACE_MODE_2500BASEX)) { -- pp->phy_interface = state->interface; -- -- WARN_ON(phy_power_off(pp->comphy)); -- WARN_ON(mvneta_comphy_init(pp)); -+ if (pp->phy_interface != state->interface) { -+ if (pp->comphy) -+ WARN_ON(phy_power_off(pp->comphy)); -+ WARN_ON(mvneta_config_interface(pp, state->interface)); - } - - if (new_ctrl0 != gmac_ctrl0) -@@ -4971,20 +5003,10 @@ static void mvneta_conf_mbus_windows(struct mvneta_port *pp, - } - - /* Power up the port */ --static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) -+static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) - { - /* MAC Cause register should be cleared */ - mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0); -- -- if (phy_mode == PHY_INTERFACE_MODE_QSGMII) -- mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_QSGMII_SERDES_PROTO); -- else if (phy_mode == PHY_INTERFACE_MODE_SGMII || -- phy_interface_mode_is_8023z(phy_mode)) -- mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO); -- else if (!phy_interface_mode_is_rgmii(phy_mode)) -- return -EINVAL; -- -- return 0; - } - - /* Device initialization routine */ -@@ -5170,11 +5192,7 @@ static int mvneta_probe(struct platform_device *pdev) - if (err < 0) - goto err_netdev; - -- err = mvneta_port_power_up(pp, phy_mode); -- if (err < 0) { -- dev_err(&pdev->dev, "can't power up port\n"); -- goto err_netdev; -- } -+ mvneta_port_power_up(pp, phy_mode); - - /* Armada3700 network controller does not support per-cpu - * operation, so only single NAPI should be initialized. -@@ -5328,11 +5346,7 @@ static int mvneta_resume(struct device *device) - } - } - mvneta_defaults_set(pp); -- err = mvneta_port_power_up(pp, pp->phy_interface); -- if (err < 0) { -- dev_err(device, "can't power up port\n"); -- return err; -- } -+ mvneta_port_power_up(pp, pp->phy_interface); - - netif_device_attach(dev); - -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/port.c b/drivers/net/ethernet/mellanox/mlx5/core/en/port.c -index 2a8950b3056f..3cf3e35053f7 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en/port.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port.c -@@ -78,11 +78,26 @@ static const u32 mlx5e_ext_link_speed[MLX5E_EXT_LINK_MODES_NUMBER] = { - [MLX5E_400GAUI_8] = 400000, - }; - -+bool mlx5e_ptys_ext_supported(struct mlx5_core_dev *mdev) -+{ -+ struct mlx5e_port_eth_proto eproto; -+ int err; -+ -+ if (MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet)) -+ return true; -+ -+ err = mlx5_port_query_eth_proto(mdev, 1, true, &eproto); -+ if (err) -+ return false; -+ -+ return !!eproto.cap; -+} -+ - static void mlx5e_port_get_speed_arr(struct mlx5_core_dev *mdev, - const u32 **arr, u32 *size, - bool force_legacy) - { -- bool ext = force_legacy ? false : MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); -+ bool ext = force_legacy ? false : mlx5e_ptys_ext_supported(mdev); - - *size = ext ? ARRAY_SIZE(mlx5e_ext_link_speed) : - ARRAY_SIZE(mlx5e_link_speed); -@@ -177,7 +192,7 @@ int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed) - bool ext; - int err; - -- ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); -+ ext = mlx5e_ptys_ext_supported(mdev); - err = mlx5_port_query_eth_proto(mdev, 1, ext, &eproto); - if (err) - goto out; -@@ -205,7 +220,7 @@ int mlx5e_port_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed) - int err; - int i; - -- ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); -+ ext = mlx5e_ptys_ext_supported(mdev); - err = mlx5_port_query_eth_proto(mdev, 1, ext, &eproto); - if (err) - return err; -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/port.h b/drivers/net/ethernet/mellanox/mlx5/core/en/port.h -index a2ddd446dd59..7a7defe60792 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en/port.h -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port.h -@@ -54,7 +54,7 @@ int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed); - int mlx5e_port_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed); - u32 mlx5e_port_speed2linkmodes(struct mlx5_core_dev *mdev, u32 speed, - bool force_legacy); -- -+bool mlx5e_ptys_ext_supported(struct mlx5_core_dev *mdev); - int mlx5e_port_query_pbmc(struct mlx5_core_dev *mdev, void *out); - int mlx5e_port_set_pbmc(struct mlx5_core_dev *mdev, void *in); - int mlx5e_port_query_priority2buffer(struct mlx5_core_dev *mdev, u8 *buffer); -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c -index 470282daed19..369a03771435 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c -@@ -849,6 +849,7 @@ mlx5_tc_ct_flush_ft_entry(void *ptr, void *arg) - struct mlx5_ct_entry *entry = ptr; - - mlx5_tc_ct_entry_del_rules(ct_priv, entry); -+ kfree(entry); - } - - static void -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c -index bc290ae80a53..1c491acd48f3 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c -@@ -200,7 +200,7 @@ static void mlx5e_ethtool_get_speed_arr(struct mlx5_core_dev *mdev, - struct ptys2ethtool_config **arr, - u32 *size) - { -- bool ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); -+ bool ext = mlx5e_ptys_ext_supported(mdev); - - *arr = ext ? ptys2ext_ethtool_table : ptys2legacy_ethtool_table; - *size = ext ? ARRAY_SIZE(ptys2ext_ethtool_table) : -@@ -883,7 +883,7 @@ static void get_lp_advertising(struct mlx5_core_dev *mdev, u32 eth_proto_lp, - struct ethtool_link_ksettings *link_ksettings) - { - unsigned long *lp_advertising = link_ksettings->link_modes.lp_advertising; -- bool ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); -+ bool ext = mlx5e_ptys_ext_supported(mdev); - - ptys2ethtool_adver_link(lp_advertising, eth_proto_lp, ext); - } -@@ -913,7 +913,7 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, - __func__, err); - goto err_query_regs; - } -- ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); -+ ext = !!MLX5_GET_ETH_PROTO(ptys_reg, out, true, eth_proto_capability); - eth_proto_cap = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, - eth_proto_capability); - eth_proto_admin = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, -@@ -1066,7 +1066,7 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, - autoneg = link_ksettings->base.autoneg; - speed = link_ksettings->base.speed; - -- ext_supported = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); -+ ext_supported = mlx5e_ptys_ext_supported(mdev); - ext = ext_requested(autoneg, adver, ext_supported); - if (!ext_supported && ext) - return -EOPNOTSUPP; -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c -index bd8d0e096085..bc54913c5861 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c -@@ -3076,9 +3076,6 @@ int mlx5e_open(struct net_device *netdev) - mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP); - mutex_unlock(&priv->state_lock); - -- if (mlx5_vxlan_allowed(priv->mdev->vxlan)) -- udp_tunnel_get_rx_info(netdev); -- - return err; - } - -@@ -5122,6 +5119,10 @@ static int mlx5e_init_nic_rx(struct mlx5e_priv *priv) - if (err) - goto err_destroy_flow_steering; - -+#ifdef CONFIG_MLX5_EN_ARFS -+ priv->netdev->rx_cpu_rmap = mlx5_eq_table_get_rmap(priv->mdev); -+#endif -+ - return 0; - - err_destroy_flow_steering: -@@ -5207,6 +5208,8 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv) - rtnl_lock(); - if (netif_running(netdev)) - mlx5e_open(netdev); -+ if (mlx5_vxlan_allowed(priv->mdev->vxlan)) -+ udp_tunnel_get_rx_info(netdev); - netif_device_attach(netdev); - rtnl_unlock(); - } -@@ -5223,6 +5226,8 @@ static void mlx5e_nic_disable(struct mlx5e_priv *priv) - rtnl_lock(); - if (netif_running(priv->netdev)) - mlx5e_close(priv->netdev); -+ if (mlx5_vxlan_allowed(priv->mdev->vxlan)) -+ udp_tunnel_drop_rx_info(priv->netdev); - netif_device_detach(priv->netdev); - rtnl_unlock(); - -@@ -5295,10 +5300,6 @@ int mlx5e_netdev_init(struct net_device *netdev, - /* netdev init */ - netif_carrier_off(netdev); - --#ifdef CONFIG_MLX5_EN_ARFS -- netdev->rx_cpu_rmap = mlx5_eq_table_get_rmap(mdev); --#endif -- - return 0; - - err_free_cpumask: -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c -index cc262b30aed5..dc589322940c 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/port.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c -@@ -293,7 +293,40 @@ static int mlx5_query_module_num(struct mlx5_core_dev *dev, int *module_num) - return 0; - } - --static int mlx5_eeprom_page(int offset) -+static int mlx5_query_module_id(struct mlx5_core_dev *dev, int module_num, -+ u8 *module_id) -+{ -+ u32 in[MLX5_ST_SZ_DW(mcia_reg)] = {}; -+ u32 out[MLX5_ST_SZ_DW(mcia_reg)]; -+ int err, status; -+ u8 *ptr; -+ -+ MLX5_SET(mcia_reg, in, i2c_device_address, MLX5_I2C_ADDR_LOW); -+ MLX5_SET(mcia_reg, in, module, module_num); -+ MLX5_SET(mcia_reg, in, device_address, 0); -+ MLX5_SET(mcia_reg, in, page_number, 0); -+ MLX5_SET(mcia_reg, in, size, 1); -+ MLX5_SET(mcia_reg, in, l, 0); -+ -+ err = mlx5_core_access_reg(dev, in, sizeof(in), out, -+ sizeof(out), MLX5_REG_MCIA, 0, 0); -+ if (err) -+ return err; -+ -+ status = MLX5_GET(mcia_reg, out, status); -+ if (status) { -+ mlx5_core_err(dev, "query_mcia_reg failed: status: 0x%x\n", -+ status); -+ return -EIO; -+ } -+ ptr = MLX5_ADDR_OF(mcia_reg, out, dword_0); -+ -+ *module_id = ptr[0]; -+ -+ return 0; -+} -+ -+static int mlx5_qsfp_eeprom_page(u16 offset) - { - if (offset < MLX5_EEPROM_PAGE_LENGTH) - /* Addresses between 0-255 - page 00 */ -@@ -307,7 +340,7 @@ static int mlx5_eeprom_page(int offset) - MLX5_EEPROM_HIGH_PAGE_LENGTH); - } - --static int mlx5_eeprom_high_page_offset(int page_num) -+static int mlx5_qsfp_eeprom_high_page_offset(int page_num) - { - if (!page_num) /* Page 0 always start from low page */ - return 0; -@@ -316,35 +349,62 @@ static int mlx5_eeprom_high_page_offset(int page_num) - return page_num * MLX5_EEPROM_HIGH_PAGE_LENGTH; - } - -+static void mlx5_qsfp_eeprom_params_set(u16 *i2c_addr, int *page_num, u16 *offset) -+{ -+ *i2c_addr = MLX5_I2C_ADDR_LOW; -+ *page_num = mlx5_qsfp_eeprom_page(*offset); -+ *offset -= mlx5_qsfp_eeprom_high_page_offset(*page_num); -+} -+ -+static void mlx5_sfp_eeprom_params_set(u16 *i2c_addr, int *page_num, u16 *offset) -+{ -+ *i2c_addr = MLX5_I2C_ADDR_LOW; -+ *page_num = 0; -+ -+ if (*offset < MLX5_EEPROM_PAGE_LENGTH) -+ return; -+ -+ *i2c_addr = MLX5_I2C_ADDR_HIGH; -+ *offset -= MLX5_EEPROM_PAGE_LENGTH; -+} -+ - int mlx5_query_module_eeprom(struct mlx5_core_dev *dev, - u16 offset, u16 size, u8 *data) - { -- int module_num, page_num, status, err; -+ int module_num, status, err, page_num = 0; -+ u32 in[MLX5_ST_SZ_DW(mcia_reg)] = {}; - u32 out[MLX5_ST_SZ_DW(mcia_reg)]; -- u32 in[MLX5_ST_SZ_DW(mcia_reg)]; -- u16 i2c_addr; -- void *ptr = MLX5_ADDR_OF(mcia_reg, out, dword_0); -+ u16 i2c_addr = 0; -+ u8 module_id; -+ void *ptr; - - err = mlx5_query_module_num(dev, &module_num); - if (err) - return err; - -- memset(in, 0, sizeof(in)); -- size = min_t(int, size, MLX5_EEPROM_MAX_BYTES); -- -- /* Get the page number related to the given offset */ -- page_num = mlx5_eeprom_page(offset); -+ err = mlx5_query_module_id(dev, module_num, &module_id); -+ if (err) -+ return err; - -- /* Set the right offset according to the page number, -- * For page_num > 0, relative offset is always >= 128 (high page). -- */ -- offset -= mlx5_eeprom_high_page_offset(page_num); -+ switch (module_id) { -+ case MLX5_MODULE_ID_SFP: -+ mlx5_sfp_eeprom_params_set(&i2c_addr, &page_num, &offset); -+ break; -+ case MLX5_MODULE_ID_QSFP: -+ case MLX5_MODULE_ID_QSFP_PLUS: -+ case MLX5_MODULE_ID_QSFP28: -+ mlx5_qsfp_eeprom_params_set(&i2c_addr, &page_num, &offset); -+ break; -+ default: -+ mlx5_core_err(dev, "Module ID not recognized: 0x%x\n", module_id); -+ return -EINVAL; -+ } - - if (offset + size > MLX5_EEPROM_PAGE_LENGTH) - /* Cross pages read, read until offset 256 in low page */ - size -= offset + size - MLX5_EEPROM_PAGE_LENGTH; - -- i2c_addr = MLX5_I2C_ADDR_LOW; -+ size = min_t(int, size, MLX5_EEPROM_MAX_BYTES); - - MLX5_SET(mcia_reg, in, l, 0); - MLX5_SET(mcia_reg, in, module, module_num); -@@ -365,6 +425,7 @@ int mlx5_query_module_eeprom(struct mlx5_core_dev *dev, - return -EIO; - } - -+ ptr = MLX5_ADDR_OF(mcia_reg, out, dword_0); - memcpy(data, ptr, size); - - return size; -diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c -index fd0e97de44e7..c04ec1a92826 100644 ---- a/drivers/net/ethernet/mellanox/mlxsw/pci.c -+++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c -@@ -1414,23 +1414,12 @@ static int mlxsw_pci_init(void *bus_priv, struct mlxsw_core *mlxsw_core, - u16 num_pages; - int err; - -- mutex_init(&mlxsw_pci->cmd.lock); -- init_waitqueue_head(&mlxsw_pci->cmd.wait); -- - mlxsw_pci->core = mlxsw_core; - - mbox = mlxsw_cmd_mbox_alloc(); - if (!mbox) - return -ENOMEM; - -- err = mlxsw_pci_mbox_alloc(mlxsw_pci, &mlxsw_pci->cmd.in_mbox); -- if (err) -- goto mbox_put; -- -- err = mlxsw_pci_mbox_alloc(mlxsw_pci, &mlxsw_pci->cmd.out_mbox); -- if (err) -- goto err_out_mbox_alloc; -- - err = mlxsw_pci_sw_reset(mlxsw_pci, mlxsw_pci->id); - if (err) - goto err_sw_reset; -@@ -1537,9 +1526,6 @@ err_query_fw: - mlxsw_pci_free_irq_vectors(mlxsw_pci); - err_alloc_irq: - err_sw_reset: -- mlxsw_pci_mbox_free(mlxsw_pci, &mlxsw_pci->cmd.out_mbox); --err_out_mbox_alloc: -- mlxsw_pci_mbox_free(mlxsw_pci, &mlxsw_pci->cmd.in_mbox); - mbox_put: - mlxsw_cmd_mbox_free(mbox); - return err; -@@ -1553,8 +1539,6 @@ static void mlxsw_pci_fini(void *bus_priv) - mlxsw_pci_aqs_fini(mlxsw_pci); - mlxsw_pci_fw_area_fini(mlxsw_pci); - mlxsw_pci_free_irq_vectors(mlxsw_pci); -- mlxsw_pci_mbox_free(mlxsw_pci, &mlxsw_pci->cmd.out_mbox); -- mlxsw_pci_mbox_free(mlxsw_pci, &mlxsw_pci->cmd.in_mbox); - } - - static struct mlxsw_pci_queue * -@@ -1776,6 +1760,37 @@ static const struct mlxsw_bus mlxsw_pci_bus = { - .features = MLXSW_BUS_F_TXRX | MLXSW_BUS_F_RESET, - }; - -+static int mlxsw_pci_cmd_init(struct mlxsw_pci *mlxsw_pci) -+{ -+ int err; -+ -+ mutex_init(&mlxsw_pci->cmd.lock); -+ init_waitqueue_head(&mlxsw_pci->cmd.wait); -+ -+ err = mlxsw_pci_mbox_alloc(mlxsw_pci, &mlxsw_pci->cmd.in_mbox); -+ if (err) -+ goto err_in_mbox_alloc; -+ -+ err = mlxsw_pci_mbox_alloc(mlxsw_pci, &mlxsw_pci->cmd.out_mbox); -+ if (err) -+ goto err_out_mbox_alloc; -+ -+ return 0; -+ -+err_out_mbox_alloc: -+ mlxsw_pci_mbox_free(mlxsw_pci, &mlxsw_pci->cmd.in_mbox); -+err_in_mbox_alloc: -+ mutex_destroy(&mlxsw_pci->cmd.lock); -+ return err; -+} -+ -+static void mlxsw_pci_cmd_fini(struct mlxsw_pci *mlxsw_pci) -+{ -+ mlxsw_pci_mbox_free(mlxsw_pci, &mlxsw_pci->cmd.out_mbox); -+ mlxsw_pci_mbox_free(mlxsw_pci, &mlxsw_pci->cmd.in_mbox); -+ mutex_destroy(&mlxsw_pci->cmd.lock); -+} -+ - static int mlxsw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) - { - const char *driver_name = pdev->driver->name; -@@ -1831,6 +1846,10 @@ static int mlxsw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) - mlxsw_pci->pdev = pdev; - pci_set_drvdata(pdev, mlxsw_pci); - -+ err = mlxsw_pci_cmd_init(mlxsw_pci); -+ if (err) -+ goto err_pci_cmd_init; -+ - mlxsw_pci->bus_info.device_kind = driver_name; - mlxsw_pci->bus_info.device_name = pci_name(mlxsw_pci->pdev); - mlxsw_pci->bus_info.dev = &pdev->dev; -@@ -1848,6 +1867,8 @@ static int mlxsw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) - return 0; - - err_bus_device_register: -+ mlxsw_pci_cmd_fini(mlxsw_pci); -+err_pci_cmd_init: - iounmap(mlxsw_pci->hw_addr); - err_ioremap: - err_pci_resource_len_check: -@@ -1865,6 +1886,7 @@ static void mlxsw_pci_remove(struct pci_dev *pdev) - struct mlxsw_pci *mlxsw_pci = pci_get_drvdata(pdev); - - mlxsw_core_bus_device_unregister(mlxsw_pci->core, false); -+ mlxsw_pci_cmd_fini(mlxsw_pci); - iounmap(mlxsw_pci->hw_addr); - pci_release_regions(mlxsw_pci->pdev); - pci_disable_device(mlxsw_pci->pdev); -diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c -index d5bca1be3ef5..84b3d78a9dd8 100644 ---- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c -+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c -@@ -6256,7 +6256,7 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb, - } - - fib_work = kzalloc(sizeof(*fib_work), GFP_ATOMIC); -- if (WARN_ON(!fib_work)) -+ if (!fib_work) - return NOTIFY_BAD; - - fib_work->mlxsw_sp = router->mlxsw_sp; -diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c -index 6996229facfd..22430fa911e2 100644 ---- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c -+++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c -@@ -464,12 +464,18 @@ static void ionic_get_ringparam(struct net_device *netdev, - ring->rx_pending = lif->nrxq_descs; - } - -+static void ionic_set_ringsize(struct ionic_lif *lif, void *arg) -+{ -+ struct ethtool_ringparam *ring = arg; -+ -+ lif->ntxq_descs = ring->tx_pending; -+ lif->nrxq_descs = ring->rx_pending; -+} -+ - static int ionic_set_ringparam(struct net_device *netdev, - struct ethtool_ringparam *ring) - { - struct ionic_lif *lif = netdev_priv(netdev); -- bool running; -- int err; - - if (ring->rx_mini_pending || ring->rx_jumbo_pending) { - netdev_info(netdev, "Changing jumbo or mini descriptors not supported\n"); -@@ -487,22 +493,7 @@ static int ionic_set_ringparam(struct net_device *netdev, - ring->rx_pending == lif->nrxq_descs) - return 0; - -- err = ionic_wait_for_bit(lif, IONIC_LIF_F_QUEUE_RESET); -- if (err) -- return err; -- -- running = test_bit(IONIC_LIF_F_UP, lif->state); -- if (running) -- ionic_stop(netdev); -- -- lif->ntxq_descs = ring->tx_pending; -- lif->nrxq_descs = ring->rx_pending; -- -- if (running) -- ionic_open(netdev); -- clear_bit(IONIC_LIF_F_QUEUE_RESET, lif->state); -- -- return 0; -+ return ionic_reset_queues(lif, ionic_set_ringsize, ring); - } - - static void ionic_get_channels(struct net_device *netdev, -@@ -517,12 +508,17 @@ static void ionic_get_channels(struct net_device *netdev, - ch->combined_count = lif->nxqs; - } - -+static void ionic_set_queuecount(struct ionic_lif *lif, void *arg) -+{ -+ struct ethtool_channels *ch = arg; -+ -+ lif->nxqs = ch->combined_count; -+} -+ - static int ionic_set_channels(struct net_device *netdev, - struct ethtool_channels *ch) - { - struct ionic_lif *lif = netdev_priv(netdev); -- bool running; -- int err; - - if (!ch->combined_count || ch->other_count || - ch->rx_count || ch->tx_count) -@@ -531,21 +527,7 @@ static int ionic_set_channels(struct net_device *netdev, - if (ch->combined_count == lif->nxqs) - return 0; - -- err = ionic_wait_for_bit(lif, IONIC_LIF_F_QUEUE_RESET); -- if (err) -- return err; -- -- running = test_bit(IONIC_LIF_F_UP, lif->state); -- if (running) -- ionic_stop(netdev); -- -- lif->nxqs = ch->combined_count; -- -- if (running) -- ionic_open(netdev); -- clear_bit(IONIC_LIF_F_QUEUE_RESET, lif->state); -- -- return 0; -+ return ionic_reset_queues(lif, ionic_set_queuecount, ch); - } - - static u32 ionic_get_priv_flags(struct net_device *netdev) -diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c -index 790d4854b8ef..b591bec0301c 100644 ---- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c -+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c -@@ -1301,7 +1301,7 @@ static int ionic_change_mtu(struct net_device *netdev, int new_mtu) - return err; - - netdev->mtu = new_mtu; -- err = ionic_reset_queues(lif); -+ err = ionic_reset_queues(lif, NULL, NULL); - - return err; - } -@@ -1313,7 +1313,7 @@ static void ionic_tx_timeout_work(struct work_struct *ws) - netdev_info(lif->netdev, "Tx Timeout recovery\n"); - - rtnl_lock(); -- ionic_reset_queues(lif); -+ ionic_reset_queues(lif, NULL, NULL); - rtnl_unlock(); - } - -@@ -1944,7 +1944,7 @@ static const struct net_device_ops ionic_netdev_ops = { - .ndo_get_vf_stats = ionic_get_vf_stats, - }; - --int ionic_reset_queues(struct ionic_lif *lif) -+int ionic_reset_queues(struct ionic_lif *lif, ionic_reset_cb cb, void *arg) - { - bool running; - int err = 0; -@@ -1957,12 +1957,19 @@ int ionic_reset_queues(struct ionic_lif *lif) - if (running) { - netif_device_detach(lif->netdev); - err = ionic_stop(lif->netdev); -+ if (err) -+ goto reset_out; - } -- if (!err && running) { -- ionic_open(lif->netdev); -+ -+ if (cb) -+ cb(lif, arg); -+ -+ if (running) { -+ err = ionic_open(lif->netdev); - netif_device_attach(lif->netdev); - } - -+reset_out: - clear_bit(IONIC_LIF_F_QUEUE_RESET, lif->state); - - return err; -diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h -index 5d4ffda5c05f..2c65cf6300db 100644 ---- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h -+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h -@@ -226,6 +226,8 @@ static inline u32 ionic_coal_hw_to_usec(struct ionic *ionic, u32 units) - return (units * div) / mult; - } - -+typedef void (*ionic_reset_cb)(struct ionic_lif *lif, void *arg); -+ - void ionic_link_status_check_request(struct ionic_lif *lif); - void ionic_lif_deferred_enqueue(struct ionic_deferred *def, - struct ionic_deferred_work *work); -@@ -243,7 +245,7 @@ int ionic_lif_rss_config(struct ionic_lif *lif, u16 types, - - int ionic_open(struct net_device *netdev); - int ionic_stop(struct net_device *netdev); --int ionic_reset_queues(struct ionic_lif *lif); -+int ionic_reset_queues(struct ionic_lif *lif, ionic_reset_cb cb, void *arg); - - static inline void debug_stats_txq_post(struct ionic_qcq *qcq, - struct ionic_txq_desc *desc, bool dbell) -diff --git a/drivers/net/ethernet/qlogic/qed/qed.h b/drivers/net/ethernet/qlogic/qed/qed.h -index fa41bf08a589..58d6ef489d5b 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed.h -+++ b/drivers/net/ethernet/qlogic/qed/qed.h -@@ -880,6 +880,8 @@ struct qed_dev { - #endif - struct qed_dbg_feature dbg_features[DBG_FEATURE_NUM]; - bool disable_ilt_dump; -+ bool dbg_bin_dump; -+ - DECLARE_HASHTABLE(connections, 10); - const struct firmware *firmware; - -diff --git a/drivers/net/ethernet/qlogic/qed/qed_debug.c b/drivers/net/ethernet/qlogic/qed/qed_debug.c -index 3e56b6056b47..25745b75daf3 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_debug.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_debug.c -@@ -7506,6 +7506,12 @@ static enum dbg_status format_feature(struct qed_hwfn *p_hwfn, - if (p_hwfn->cdev->dbg_params.print_data) - qed_dbg_print_feature(text_buf, text_size_bytes); - -+ /* Just return the original binary buffer if requested */ -+ if (p_hwfn->cdev->dbg_bin_dump) { -+ vfree(text_buf); -+ return DBG_STATUS_OK; -+ } -+ - /* Free the old dump_buf and point the dump_buf to the newly allocagted - * and formatted text buffer. - */ -@@ -7733,7 +7739,9 @@ int qed_dbg_mcp_trace_size(struct qed_dev *cdev) - #define REGDUMP_HEADER_SIZE_SHIFT 0 - #define REGDUMP_HEADER_SIZE_MASK 0xffffff - #define REGDUMP_HEADER_FEATURE_SHIFT 24 --#define REGDUMP_HEADER_FEATURE_MASK 0x3f -+#define REGDUMP_HEADER_FEATURE_MASK 0x1f -+#define REGDUMP_HEADER_BIN_DUMP_SHIFT 29 -+#define REGDUMP_HEADER_BIN_DUMP_MASK 0x1 - #define REGDUMP_HEADER_OMIT_ENGINE_SHIFT 30 - #define REGDUMP_HEADER_OMIT_ENGINE_MASK 0x1 - #define REGDUMP_HEADER_ENGINE_SHIFT 31 -@@ -7771,6 +7779,7 @@ static u32 qed_calc_regdump_header(struct qed_dev *cdev, - feature, feature_size); - - SET_FIELD(res, REGDUMP_HEADER_FEATURE, feature); -+ SET_FIELD(res, REGDUMP_HEADER_BIN_DUMP, 1); - SET_FIELD(res, REGDUMP_HEADER_OMIT_ENGINE, omit_engine); - SET_FIELD(res, REGDUMP_HEADER_ENGINE, engine); - -@@ -7794,6 +7803,7 @@ int qed_dbg_all_data(struct qed_dev *cdev, void *buffer) - omit_engine = 1; - - mutex_lock(&qed_dbg_lock); -+ cdev->dbg_bin_dump = true; - - org_engine = qed_get_debug_engine(cdev); - for (cur_engine = 0; cur_engine < cdev->num_hwfns; cur_engine++) { -@@ -7931,6 +7941,10 @@ int qed_dbg_all_data(struct qed_dev *cdev, void *buffer) - DP_ERR(cdev, "qed_dbg_mcp_trace failed. rc = %d\n", rc); - } - -+ /* Re-populate nvm attribute info */ -+ qed_mcp_nvm_info_free(p_hwfn); -+ qed_mcp_nvm_info_populate(p_hwfn); -+ - /* nvm cfg1 */ - rc = qed_dbg_nvm_image(cdev, - (u8 *)buffer + offset + -@@ -7993,6 +8007,7 @@ int qed_dbg_all_data(struct qed_dev *cdev, void *buffer) - QED_NVM_IMAGE_MDUMP, "QED_NVM_IMAGE_MDUMP", rc); - } - -+ cdev->dbg_bin_dump = false; - mutex_unlock(&qed_dbg_lock); - - return 0; -diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c -index 9b00988fb77e..58913fe4f345 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_dev.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c -@@ -4466,12 +4466,6 @@ static int qed_get_dev_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) - return 0; - } - --static void qed_nvm_info_free(struct qed_hwfn *p_hwfn) --{ -- kfree(p_hwfn->nvm_info.image_att); -- p_hwfn->nvm_info.image_att = NULL; --} -- - static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn, - void __iomem *p_regview, - void __iomem *p_doorbells, -@@ -4556,7 +4550,7 @@ static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn, - return rc; - err3: - if (IS_LEAD_HWFN(p_hwfn)) -- qed_nvm_info_free(p_hwfn); -+ qed_mcp_nvm_info_free(p_hwfn); - err2: - if (IS_LEAD_HWFN(p_hwfn)) - qed_iov_free_hw_info(p_hwfn->cdev); -@@ -4617,7 +4611,7 @@ int qed_hw_prepare(struct qed_dev *cdev, - if (rc) { - if (IS_PF(cdev)) { - qed_init_free(p_hwfn); -- qed_nvm_info_free(p_hwfn); -+ qed_mcp_nvm_info_free(p_hwfn); - qed_mcp_free(p_hwfn); - qed_hw_hwfn_free(p_hwfn); - } -@@ -4651,7 +4645,7 @@ void qed_hw_remove(struct qed_dev *cdev) - - qed_iov_free_hw_info(cdev); - -- qed_nvm_info_free(p_hwfn); -+ qed_mcp_nvm_info_free(p_hwfn); - } - - static void qed_chain_free_next_ptr(struct qed_dev *cdev, -diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c -index 280527cc0578..99548d5b44ea 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c -+++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c -@@ -3151,6 +3151,13 @@ err0: - return rc; - } - -+void qed_mcp_nvm_info_free(struct qed_hwfn *p_hwfn) -+{ -+ kfree(p_hwfn->nvm_info.image_att); -+ p_hwfn->nvm_info.image_att = NULL; -+ p_hwfn->nvm_info.valid = false; -+} -+ - int - qed_mcp_get_nvm_image_att(struct qed_hwfn *p_hwfn, - enum qed_nvm_images image_id, -diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.h b/drivers/net/ethernet/qlogic/qed/qed_mcp.h -index 9c4c2763de8d..e38297383b00 100644 ---- a/drivers/net/ethernet/qlogic/qed/qed_mcp.h -+++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.h -@@ -1192,6 +1192,13 @@ void qed_mcp_read_ufp_config(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); - */ - int qed_mcp_nvm_info_populate(struct qed_hwfn *p_hwfn); - -+/** -+ * @brief Delete nvm info shadow in the given hardware function -+ * -+ * @param p_hwfn -+ */ -+void qed_mcp_nvm_info_free(struct qed_hwfn *p_hwfn); -+ - /** - * @brief Get the engine affinity configuration. - * -diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c -index 40efe60eff8d..fcdecddb2812 100644 ---- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c -+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c -@@ -47,15 +47,23 @@ static int rmnet_unregister_real_device(struct net_device *real_dev) - return 0; - } - --static int rmnet_register_real_device(struct net_device *real_dev) -+static int rmnet_register_real_device(struct net_device *real_dev, -+ struct netlink_ext_ack *extack) - { - struct rmnet_port *port; - int rc, entry; - - ASSERT_RTNL(); - -- if (rmnet_is_real_dev_registered(real_dev)) -+ if (rmnet_is_real_dev_registered(real_dev)) { -+ port = rmnet_get_port_rtnl(real_dev); -+ if (port->rmnet_mode != RMNET_EPMODE_VND) { -+ NL_SET_ERR_MSG_MOD(extack, "bridge device already exists"); -+ return -EINVAL; -+ } -+ - return 0; -+ } - - port = kzalloc(sizeof(*port), GFP_KERNEL); - if (!port) -@@ -133,7 +141,7 @@ static int rmnet_newlink(struct net *src_net, struct net_device *dev, - - mux_id = nla_get_u16(data[IFLA_RMNET_MUX_ID]); - -- err = rmnet_register_real_device(real_dev); -+ err = rmnet_register_real_device(real_dev, extack); - if (err) - goto err0; - -@@ -422,7 +430,7 @@ int rmnet_add_bridge(struct net_device *rmnet_dev, - } - - if (port->rmnet_mode != RMNET_EPMODE_VND) { -- NL_SET_ERR_MSG_MOD(extack, "bridge device already exists"); -+ NL_SET_ERR_MSG_MOD(extack, "more than one bridge dev attached"); - return -EINVAL; - } - -@@ -433,7 +441,7 @@ int rmnet_add_bridge(struct net_device *rmnet_dev, - return -EBUSY; - } - -- err = rmnet_register_real_device(slave_dev); -+ err = rmnet_register_real_device(slave_dev, extack); - if (err) - return -EBUSY; - -diff --git a/drivers/net/ipa/ipa_data-sdm845.c b/drivers/net/ipa/ipa_data-sdm845.c -index 0d9c36e1e806..0917c5b028f6 100644 ---- a/drivers/net/ipa/ipa_data-sdm845.c -+++ b/drivers/net/ipa/ipa_data-sdm845.c -@@ -44,7 +44,6 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { - .endpoint = { - .seq_type = IPA_SEQ_INVALID, - .config = { -- .checksum = true, - .aggregation = true, - .status_enable = true, - .rx = { -diff --git a/drivers/net/ipa/ipa_qmi_msg.c b/drivers/net/ipa/ipa_qmi_msg.c -index 03a1d0e55964..73413371e3d3 100644 ---- a/drivers/net/ipa/ipa_qmi_msg.c -+++ b/drivers/net/ipa/ipa_qmi_msg.c -@@ -119,7 +119,7 @@ struct qmi_elem_info ipa_driver_init_complete_rsp_ei[] = { - sizeof_field(struct ipa_driver_init_complete_rsp, - rsp), - .tlv_type = 0x02, -- .elem_size = offsetof(struct ipa_driver_init_complete_rsp, -+ .offset = offsetof(struct ipa_driver_init_complete_rsp, - rsp), - .ei_array = qmi_response_type_v01_ei, - }, -@@ -137,7 +137,7 @@ struct qmi_elem_info ipa_init_complete_ind_ei[] = { - sizeof_field(struct ipa_init_complete_ind, - status), - .tlv_type = 0x02, -- .elem_size = offsetof(struct ipa_init_complete_ind, -+ .offset = offsetof(struct ipa_init_complete_ind, - status), - .ei_array = qmi_response_type_v01_ei, - }, -@@ -218,7 +218,7 @@ struct qmi_elem_info ipa_init_modem_driver_req_ei[] = { - sizeof_field(struct ipa_init_modem_driver_req, - platform_type_valid), - .tlv_type = 0x10, -- .elem_size = offsetof(struct ipa_init_modem_driver_req, -+ .offset = offsetof(struct ipa_init_modem_driver_req, - platform_type_valid), - }, - { -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c -index 3cf4dc3433f9..bb4ccbda031a 100644 ---- a/drivers/net/usb/smsc95xx.c -+++ b/drivers/net/usb/smsc95xx.c -@@ -1287,11 +1287,14 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) - - /* Init all registers */ - ret = smsc95xx_reset(dev); -+ if (ret) -+ goto free_pdata; - - /* detect device revision as different features may be available */ - ret = smsc95xx_read_reg(dev, ID_REV, &val); - if (ret < 0) -- return ret; -+ goto free_pdata; -+ - val >>= 16; - pdata->chip_id = val; - pdata->mdix_ctrl = get_mdix_status(dev->net); -@@ -1317,6 +1320,10 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) - schedule_delayed_work(&pdata->carrier_check, CARRIER_CHECK_DELAY); - - return 0; -+ -+free_pdata: -+ kfree(pdata); -+ return ret; - } - - static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf) -diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c -index 4ed21dad6a8e..6049d3766c64 100644 ---- a/drivers/net/wireless/ath/ath9k/hif_usb.c -+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c -@@ -643,9 +643,9 @@ err: - - static void ath9k_hif_usb_rx_cb(struct urb *urb) - { -- struct rx_buf *rx_buf = (struct rx_buf *)urb->context; -- struct hif_device_usb *hif_dev = rx_buf->hif_dev; -- struct sk_buff *skb = rx_buf->skb; -+ struct sk_buff *skb = (struct sk_buff *) urb->context; -+ struct hif_device_usb *hif_dev = -+ usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); - int ret; - - if (!skb) -@@ -685,15 +685,14 @@ resubmit: - return; - free: - kfree_skb(skb); -- kfree(rx_buf); - } - - static void ath9k_hif_usb_reg_in_cb(struct urb *urb) - { -- struct rx_buf *rx_buf = (struct rx_buf *)urb->context; -- struct hif_device_usb *hif_dev = rx_buf->hif_dev; -- struct sk_buff *skb = rx_buf->skb; -+ struct sk_buff *skb = (struct sk_buff *) urb->context; - struct sk_buff *nskb; -+ struct hif_device_usb *hif_dev = -+ usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); - int ret; - - if (!skb) -@@ -751,7 +750,6 @@ resubmit: - return; - free: - kfree_skb(skb); -- kfree(rx_buf); - urb->context = NULL; - } - -@@ -797,7 +795,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev) - init_usb_anchor(&hif_dev->mgmt_submitted); - - for (i = 0; i < MAX_TX_URB_NUM; i++) { -- tx_buf = kzalloc(sizeof(*tx_buf), GFP_KERNEL); -+ tx_buf = kzalloc(sizeof(struct tx_buf), GFP_KERNEL); - if (!tx_buf) - goto err; - -@@ -834,9 +832,8 @@ static void ath9k_hif_usb_dealloc_rx_urbs(struct hif_device_usb *hif_dev) - - static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) - { -- struct rx_buf *rx_buf = NULL; -- struct sk_buff *skb = NULL; - struct urb *urb = NULL; -+ struct sk_buff *skb = NULL; - int i, ret; - - init_usb_anchor(&hif_dev->rx_submitted); -@@ -844,12 +841,6 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) - - for (i = 0; i < MAX_RX_URB_NUM; i++) { - -- rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL); -- if (!rx_buf) { -- ret = -ENOMEM; -- goto err_rxb; -- } -- - /* Allocate URB */ - urb = usb_alloc_urb(0, GFP_KERNEL); - if (urb == NULL) { -@@ -864,14 +855,11 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) - goto err_skb; - } - -- rx_buf->hif_dev = hif_dev; -- rx_buf->skb = skb; -- - usb_fill_bulk_urb(urb, hif_dev->udev, - usb_rcvbulkpipe(hif_dev->udev, - USB_WLAN_RX_PIPE), - skb->data, MAX_RX_BUF_SIZE, -- ath9k_hif_usb_rx_cb, rx_buf); -+ ath9k_hif_usb_rx_cb, skb); - - /* Anchor URB */ - usb_anchor_urb(urb, &hif_dev->rx_submitted); -@@ -897,8 +885,6 @@ err_submit: - err_skb: - usb_free_urb(urb); - err_urb: -- kfree(rx_buf); --err_rxb: - ath9k_hif_usb_dealloc_rx_urbs(hif_dev); - return ret; - } -@@ -910,21 +896,14 @@ static void ath9k_hif_usb_dealloc_reg_in_urbs(struct hif_device_usb *hif_dev) - - static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) - { -- struct rx_buf *rx_buf = NULL; -- struct sk_buff *skb = NULL; - struct urb *urb = NULL; -+ struct sk_buff *skb = NULL; - int i, ret; - - init_usb_anchor(&hif_dev->reg_in_submitted); - - for (i = 0; i < MAX_REG_IN_URB_NUM; i++) { - -- rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL); -- if (!rx_buf) { -- ret = -ENOMEM; -- goto err_rxb; -- } -- - /* Allocate URB */ - urb = usb_alloc_urb(0, GFP_KERNEL); - if (urb == NULL) { -@@ -939,14 +918,11 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) - goto err_skb; - } - -- rx_buf->hif_dev = hif_dev; -- rx_buf->skb = skb; -- - usb_fill_int_urb(urb, hif_dev->udev, - usb_rcvintpipe(hif_dev->udev, - USB_REG_IN_PIPE), - skb->data, MAX_REG_IN_BUF_SIZE, -- ath9k_hif_usb_reg_in_cb, rx_buf, 1); -+ ath9k_hif_usb_reg_in_cb, skb, 1); - - /* Anchor URB */ - usb_anchor_urb(urb, &hif_dev->reg_in_submitted); -@@ -972,8 +948,6 @@ err_submit: - err_skb: - usb_free_urb(urb); - err_urb: -- kfree(rx_buf); --err_rxb: - ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev); - return ret; - } -diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h -index 5985aa15ca93..a94e7e1c86e9 100644 ---- a/drivers/net/wireless/ath/ath9k/hif_usb.h -+++ b/drivers/net/wireless/ath/ath9k/hif_usb.h -@@ -86,11 +86,6 @@ struct tx_buf { - struct list_head list; - }; - --struct rx_buf { -- struct sk_buff *skb; -- struct hif_device_usb *hif_dev; --}; -- - #define HIF_USB_TX_STOP BIT(0) - #define HIF_USB_TX_FLUSH BIT(1) - -diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c -index cac8a930396a..1f9a45145d0d 100644 ---- a/drivers/nvme/host/rdma.c -+++ b/drivers/nvme/host/rdma.c -@@ -443,7 +443,7 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue) - * Spread I/O queues completion vectors according their queue index. - * Admin queues can always go on completion vector 0. - */ -- comp_vector = idx == 0 ? idx : idx - 1; -+ comp_vector = (idx == 0 ? idx : idx - 1) % ibdev->num_comp_vectors; - - /* Polling queues need direct cq polling context */ - if (nvme_rdma_poll_queue(queue)) -diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c -index 9b821c9cbd16..b033f9d13fb4 100644 ---- a/drivers/pinctrl/intel/pinctrl-baytrail.c -+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c -@@ -800,6 +800,21 @@ static void byt_gpio_disable_free(struct pinctrl_dev *pctl_dev, - pm_runtime_put(vg->dev); - } - -+static void byt_gpio_direct_irq_check(struct intel_pinctrl *vg, -+ unsigned int offset) -+{ -+ void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG); -+ -+ /* -+ * Before making any direction modifications, do a check if gpio is set -+ * for direct IRQ. On Bay Trail, setting GPIO to output does not make -+ * sense, so let's at least inform the caller before they shoot -+ * themselves in the foot. -+ */ -+ if (readl(conf_reg) & BYT_DIRECT_IRQ_EN) -+ dev_info_once(vg->dev, "Potential Error: Setting GPIO with direct_irq_en to output"); -+} -+ - static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, - struct pinctrl_gpio_range *range, - unsigned int offset, -@@ -807,7 +822,6 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, - { - struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctl_dev); - void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); -- void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG); - unsigned long flags; - u32 value; - -@@ -817,14 +831,8 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, - value &= ~BYT_DIR_MASK; - if (input) - value |= BYT_OUTPUT_EN; -- else if (readl(conf_reg) & BYT_DIRECT_IRQ_EN) -- /* -- * Before making any direction modifications, do a check if gpio -- * is set for direct IRQ. On baytrail, setting GPIO to output -- * does not make sense, so let's at least inform the caller before -- * they shoot themselves in the foot. -- */ -- dev_info_once(vg->dev, "Potential Error: Setting GPIO with direct_irq_en to output"); -+ else -+ byt_gpio_direct_irq_check(vg, offset); - - writel(value, val_reg); - -@@ -1165,19 +1173,50 @@ static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) - - static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) - { -- return pinctrl_gpio_direction_input(chip->base + offset); -+ struct intel_pinctrl *vg = gpiochip_get_data(chip); -+ void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); -+ unsigned long flags; -+ u32 reg; -+ -+ raw_spin_lock_irqsave(&byt_lock, flags); -+ -+ reg = readl(val_reg); -+ reg &= ~BYT_DIR_MASK; -+ reg |= BYT_OUTPUT_EN; -+ writel(reg, val_reg); -+ -+ raw_spin_unlock_irqrestore(&byt_lock, flags); -+ return 0; - } - -+/* -+ * Note despite the temptation this MUST NOT be converted into a call to -+ * pinctrl_gpio_direction_output() + byt_gpio_set() that does not work this -+ * MUST be done as a single BYT_VAL_REG register write. -+ * See the commit message of the commit adding this comment for details. -+ */ - static int byt_gpio_direction_output(struct gpio_chip *chip, - unsigned int offset, int value) - { -- int ret = pinctrl_gpio_direction_output(chip->base + offset); -+ struct intel_pinctrl *vg = gpiochip_get_data(chip); -+ void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); -+ unsigned long flags; -+ u32 reg; - -- if (ret) -- return ret; -+ raw_spin_lock_irqsave(&byt_lock, flags); -+ -+ byt_gpio_direct_irq_check(vg, offset); - -- byt_gpio_set(chip, offset, value); -+ reg = readl(val_reg); -+ reg &= ~BYT_DIR_MASK; -+ if (value) -+ reg |= BYT_LEVEL; -+ else -+ reg &= ~BYT_LEVEL; - -+ writel(reg, val_reg); -+ -+ raw_spin_unlock_irqrestore(&byt_lock, flags); - return 0; - } - -diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c -index 2c9e5ac24692..c4917f441b10 100644 ---- a/drivers/scsi/qla2xxx/qla_attr.c -+++ b/drivers/scsi/qla2xxx/qla_attr.c -@@ -26,7 +26,8 @@ qla2x00_sysfs_read_fw_dump(struct file *filp, struct kobject *kobj, - struct qla_hw_data *ha = vha->hw; - int rval = 0; - -- if (!(ha->fw_dump_reading || ha->mctp_dump_reading)) -+ if (!(ha->fw_dump_reading || ha->mctp_dump_reading || -+ ha->mpi_fw_dump_reading)) - return 0; - - mutex_lock(&ha->optrom_mutex); -@@ -42,6 +43,10 @@ qla2x00_sysfs_read_fw_dump(struct file *filp, struct kobject *kobj, - } else if (ha->mctp_dumped && ha->mctp_dump_reading) { - rval = memory_read_from_buffer(buf, count, &off, ha->mctp_dump, - MCTP_DUMP_SIZE); -+ } else if (ha->mpi_fw_dumped && ha->mpi_fw_dump_reading) { -+ rval = memory_read_from_buffer(buf, count, &off, -+ ha->mpi_fw_dump, -+ ha->mpi_fw_dump_len); - } else if (ha->fw_dump_reading) { - rval = memory_read_from_buffer(buf, count, &off, ha->fw_dump, - ha->fw_dump_len); -@@ -103,7 +108,6 @@ qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject *kobj, - qla82xx_set_reset_owner(vha); - qla8044_idc_unlock(ha); - } else { -- ha->fw_dump_mpi = 1; - qla2x00_system_error(vha); - } - break; -@@ -137,6 +141,22 @@ qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject *kobj, - vha->host_no); - } - break; -+ case 8: -+ if (!ha->mpi_fw_dump_reading) -+ break; -+ ql_log(ql_log_info, vha, 0x70e7, -+ "MPI firmware dump cleared on (%ld).\n", vha->host_no); -+ ha->mpi_fw_dump_reading = 0; -+ ha->mpi_fw_dumped = 0; -+ break; -+ case 9: -+ if (ha->mpi_fw_dumped && !ha->mpi_fw_dump_reading) { -+ ha->mpi_fw_dump_reading = 1; -+ ql_log(ql_log_info, vha, 0x70e8, -+ "Raw MPI firmware dump ready for read on (%ld).\n", -+ vha->host_no); -+ } -+ break; - } - return count; - } -@@ -706,7 +726,8 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj, - scsi_unblock_requests(vha->host); - break; - case 0x2025d: -- if (!IS_QLA81XX(ha) && !IS_QLA83XX(ha)) -+ if (!IS_QLA81XX(ha) && !IS_QLA83XX(ha) && -+ !IS_QLA27XX(ha) && !IS_QLA28XX(ha)) - return -EPERM; - - ql_log(ql_log_info, vha, 0x706f, -@@ -724,6 +745,8 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj, - qla83xx_idc_audit(vha, IDC_AUDIT_TIMESTAMP); - qla83xx_idc_unlock(vha, 0); - break; -+ } else if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) { -+ qla27xx_reset_mpi(vha); - } else { - /* Make sure FC side is not in reset */ - WARN_ON_ONCE(qla2x00_wait_for_hba_online(vha) != -@@ -737,6 +760,7 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj, - scsi_unblock_requests(vha->host); - break; - } -+ break; - case 0x2025e: - if (!IS_P3P_TYPE(ha) || vha != base_vha) { - ql_log(ql_log_info, vha, 0x7071, -diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h -index 47c7a56438b5..daa9e936887b 100644 ---- a/drivers/scsi/qla2xxx/qla_def.h -+++ b/drivers/scsi/qla2xxx/qla_def.h -@@ -3223,6 +3223,7 @@ struct isp_operations { - uint32_t); - - void (*fw_dump) (struct scsi_qla_host *, int); -+ void (*mpi_fw_dump)(struct scsi_qla_host *, int); - - int (*beacon_on) (struct scsi_qla_host *); - int (*beacon_off) (struct scsi_qla_host *); -@@ -3748,6 +3749,11 @@ struct qlt_hw_data { - - #define LEAK_EXCHG_THRESH_HOLD_PERCENT 75 /* 75 percent */ - -+struct qla_hw_data_stat { -+ u32 num_fw_dump; -+ u32 num_mpi_reset; -+}; -+ - /* - * Qlogic host adapter specific data structure. - */ -@@ -4230,7 +4236,6 @@ struct qla_hw_data { - uint32_t fw_dump_len; - u32 fw_dump_alloc_len; - bool fw_dumped; -- bool fw_dump_mpi; - unsigned long fw_dump_cap_flags; - #define RISC_PAUSE_CMPL 0 - #define DMA_SHUTDOWN_CMPL 1 -@@ -4241,6 +4246,10 @@ struct qla_hw_data { - #define ISP_MBX_RDY 6 - #define ISP_SOFT_RESET_CMPL 7 - int fw_dump_reading; -+ void *mpi_fw_dump; -+ u32 mpi_fw_dump_len; -+ int mpi_fw_dump_reading:1; -+ int mpi_fw_dumped:1; - int prev_minidump_failed; - dma_addr_t eft_dma; - void *eft; -@@ -4454,6 +4463,8 @@ struct qla_hw_data { - uint16_t last_zio_threshold; - - #define DEFAULT_ZIO_THRESHOLD 5 -+ -+ struct qla_hw_data_stat stat; - }; - - struct active_regions { -diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h -index 1b93f5b4d77d..b20c5fa122fb 100644 ---- a/drivers/scsi/qla2xxx/qla_gbl.h -+++ b/drivers/scsi/qla2xxx/qla_gbl.h -@@ -173,6 +173,7 @@ extern int ql2xenablemsix; - extern int qla2xuseresexchforels; - extern int ql2xexlogins; - extern int ql2xdifbundlinginternalbuffers; -+extern int ql2xfulldump_on_mpifail; - - extern int qla2x00_loop_reset(scsi_qla_host_t *); - extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); -@@ -645,6 +646,7 @@ extern void qla82xx_fw_dump(scsi_qla_host_t *, int); - extern void qla8044_fw_dump(scsi_qla_host_t *, int); - - extern void qla27xx_fwdump(scsi_qla_host_t *, int); -+extern void qla27xx_mpi_fwdump(scsi_qla_host_t *, int); - extern ulong qla27xx_fwdt_calculate_dump_size(struct scsi_qla_host *, void *); - extern int qla27xx_fwdt_template_valid(void *); - extern ulong qla27xx_fwdt_template_size(void *); -@@ -933,5 +935,6 @@ extern void qla24xx_process_purex_list(struct purex_list *); - - /* nvme.c */ - void qla_nvme_unregister_remote_port(struct fc_port *fcport); -+void qla27xx_reset_mpi(scsi_qla_host_t *vha); - void qla_handle_els_plogi_done(scsi_qla_host_t *vha, struct event_arg *ea); - #endif /* _QLA_GBL_H */ -diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c -index cfbb4294fb8b..53686246f566 100644 ---- a/drivers/scsi/qla2xxx/qla_init.c -+++ b/drivers/scsi/qla2xxx/qla_init.c -@@ -3339,6 +3339,8 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha) - dump_size / 1024); - - if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) { -+ ha->mpi_fw_dump = (char *)fw_dump + -+ ha->fwdt[1].dump_size; - mutex_unlock(&ha->optrom_mutex); - return; - } -diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c -index 8a78d395bbc8..4d9ec7ee59cc 100644 ---- a/drivers/scsi/qla2xxx/qla_isr.c -+++ b/drivers/scsi/qla2xxx/qla_isr.c -@@ -756,6 +756,39 @@ qla2x00_find_fcport_by_nportid(scsi_qla_host_t *vha, port_id_t *id, - return NULL; - } - -+/* Shall be called only on supported adapters. */ -+static void -+qla27xx_handle_8200_aen(scsi_qla_host_t *vha, uint16_t *mb) -+{ -+ struct qla_hw_data *ha = vha->hw; -+ bool reset_isp_needed = 0; -+ -+ ql_log(ql_log_warn, vha, 0x02f0, -+ "MPI Heartbeat stop. MPI reset is%s needed. " -+ "MB0[%xh] MB1[%xh] MB2[%xh] MB3[%xh]\n", -+ mb[0] & BIT_8 ? "" : " not", -+ mb[0], mb[1], mb[2], mb[3]); -+ -+ if ((mb[1] & BIT_8) == 0) -+ return; -+ -+ ql_log(ql_log_warn, vha, 0x02f1, -+ "MPI Heartbeat stop. FW dump needed\n"); -+ -+ if (ql2xfulldump_on_mpifail) { -+ ha->isp_ops->fw_dump(vha, 1); -+ reset_isp_needed = 1; -+ } -+ -+ ha->isp_ops->mpi_fw_dump(vha, 1); -+ -+ if (reset_isp_needed) { -+ vha->hw->flags.fw_init_done = 0; -+ set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); -+ qla2xxx_wake_dpc(vha); -+ } -+} -+ - /** - * qla2x00_async_event() - Process aynchronous events. - * @vha: SCSI driver HA context -@@ -871,9 +904,9 @@ skip_rio: - "ISP System Error - mbx1=%xh mbx2=%xh mbx3=%xh.\n ", - mb[1], mb[2], mb[3]); - -- ha->fw_dump_mpi = -- (IS_QLA27XX(ha) || IS_QLA28XX(ha)) && -- RD_REG_WORD(®24->mailbox7) & BIT_8; -+ if ((IS_QLA27XX(ha) || IS_QLA28XX(ha)) && -+ RD_REG_WORD(®24->mailbox7) & BIT_8) -+ ha->isp_ops->mpi_fw_dump(vha, 1); - ha->isp_ops->fw_dump(vha, 1); - ha->flags.fw_init_done = 0; - QLA_FW_STOPPED(ha); -@@ -1374,20 +1407,7 @@ global_port_update: - - case MBA_IDC_AEN: - if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) { -- ha->flags.fw_init_done = 0; -- ql_log(ql_log_warn, vha, 0xffff, -- "MPI Heartbeat stop. Chip reset needed. MB0[%xh] MB1[%xh] MB2[%xh] MB3[%xh]\n", -- mb[0], mb[1], mb[2], mb[3]); -- -- if ((mb[1] & BIT_8) || -- (mb[2] & BIT_8)) { -- ql_log(ql_log_warn, vha, 0xd013, -- "MPI Heartbeat stop. FW dump needed\n"); -- ha->fw_dump_mpi = 1; -- ha->isp_ops->fw_dump(vha, 1); -- } -- set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); -- qla2xxx_wake_dpc(vha); -+ qla27xx_handle_8200_aen(vha, mb); - } else if (IS_QLA83XX(ha)) { - mb[4] = RD_REG_WORD(®24->mailbox4); - mb[5] = RD_REG_WORD(®24->mailbox5); -diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c -index 9179bb4caed8..1120d133204c 100644 ---- a/drivers/scsi/qla2xxx/qla_os.c -+++ b/drivers/scsi/qla2xxx/qla_os.c -@@ -35,6 +35,11 @@ static int apidev_major; - */ - struct kmem_cache *srb_cachep; - -+int ql2xfulldump_on_mpifail; -+module_param(ql2xfulldump_on_mpifail, int, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(ql2xfulldump_on_mpifail, -+ "Set this to take full dump on MPI hang."); -+ - /* - * CT6 CTX allocation cache - */ -@@ -2518,6 +2523,7 @@ static struct isp_operations qla27xx_isp_ops = { - .read_nvram = NULL, - .write_nvram = NULL, - .fw_dump = qla27xx_fwdump, -+ .mpi_fw_dump = qla27xx_mpi_fwdump, - .beacon_on = qla24xx_beacon_on, - .beacon_off = qla24xx_beacon_off, - .beacon_blink = qla83xx_beacon_blink, -diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c -index 6aeb1c3fb7a8..342363862434 100644 ---- a/drivers/scsi/qla2xxx/qla_tmpl.c -+++ b/drivers/scsi/qla2xxx/qla_tmpl.c -@@ -12,6 +12,33 @@ - #define IOBASE(vha) IOBAR(ISPREG(vha)) - #define INVALID_ENTRY ((struct qla27xx_fwdt_entry *)0xffffffffffffffffUL) - -+/* hardware_lock assumed held. */ -+static void -+qla27xx_write_remote_reg(struct scsi_qla_host *vha, -+ u32 addr, u32 data) -+{ -+ char *reg = (char *)ISPREG(vha); -+ -+ ql_dbg(ql_dbg_misc, vha, 0xd300, -+ "%s: addr/data = %xh/%xh\n", __func__, addr, data); -+ -+ WRT_REG_DWORD(reg + IOBASE(vha), 0x40); -+ WRT_REG_DWORD(reg + 0xc4, data); -+ WRT_REG_DWORD(reg + 0xc0, addr); -+} -+ -+void -+qla27xx_reset_mpi(scsi_qla_host_t *vha) -+{ -+ ql_dbg(ql_dbg_misc + ql_dbg_verbose, vha, 0xd301, -+ "Entered %s.\n", __func__); -+ -+ qla27xx_write_remote_reg(vha, 0x104050, 0x40004); -+ qla27xx_write_remote_reg(vha, 0x10405c, 0x4); -+ -+ vha->hw->stat.num_mpi_reset++; -+} -+ - static inline void - qla27xx_insert16(uint16_t value, void *buf, ulong *len) - { -@@ -997,6 +1024,62 @@ qla27xx_fwdt_template_valid(void *p) - return true; - } - -+void -+qla27xx_mpi_fwdump(scsi_qla_host_t *vha, int hardware_locked) -+{ -+ ulong flags = 0; -+ bool need_mpi_reset = 1; -+ -+#ifndef __CHECKER__ -+ if (!hardware_locked) -+ spin_lock_irqsave(&vha->hw->hardware_lock, flags); -+#endif -+ if (!vha->hw->mpi_fw_dump) { -+ ql_log(ql_log_warn, vha, 0x02f3, "-> mpi_fwdump no buffer\n"); -+ } else if (vha->hw->mpi_fw_dumped) { -+ ql_log(ql_log_warn, vha, 0x02f4, -+ "-> MPI firmware already dumped (%p) -- ignoring request\n", -+ vha->hw->mpi_fw_dump); -+ } else { -+ struct fwdt *fwdt = &vha->hw->fwdt[1]; -+ ulong len; -+ void *buf = vha->hw->mpi_fw_dump; -+ -+ ql_log(ql_log_warn, vha, 0x02f5, "-> fwdt1 running...\n"); -+ if (!fwdt->template) { -+ ql_log(ql_log_warn, vha, 0x02f6, -+ "-> fwdt1 no template\n"); -+ goto bailout; -+ } -+ len = qla27xx_execute_fwdt_template(vha, fwdt->template, buf); -+ if (len == 0) { -+ goto bailout; -+ } else if (len != fwdt->dump_size) { -+ ql_log(ql_log_warn, vha, 0x02f7, -+ "-> fwdt1 fwdump residual=%+ld\n", -+ fwdt->dump_size - len); -+ } else { -+ need_mpi_reset = 0; -+ } -+ -+ vha->hw->mpi_fw_dump_len = len; -+ vha->hw->mpi_fw_dumped = 1; -+ -+ ql_log(ql_log_warn, vha, 0x02f8, -+ "-> MPI firmware dump saved to buffer (%lu/%p)\n", -+ vha->host_no, vha->hw->mpi_fw_dump); -+ qla2x00_post_uevent_work(vha, QLA_UEVENT_CODE_FW_DUMP); -+ } -+ -+bailout: -+ if (need_mpi_reset) -+ qla27xx_reset_mpi(vha); -+#ifndef __CHECKER__ -+ if (!hardware_locked) -+ spin_unlock_irqrestore(&vha->hw->hardware_lock, flags); -+#endif -+} -+ - void - qla27xx_fwdump(scsi_qla_host_t *vha, int hardware_locked) - { -@@ -1015,30 +1098,25 @@ qla27xx_fwdump(scsi_qla_host_t *vha, int hardware_locked) - vha->hw->fw_dump); - } else { - struct fwdt *fwdt = vha->hw->fwdt; -- uint j; - ulong len; - void *buf = vha->hw->fw_dump; -- uint count = vha->hw->fw_dump_mpi ? 2 : 1; -- -- for (j = 0; j < count; j++, fwdt++, buf += len) { -- ql_log(ql_log_warn, vha, 0xd011, -- "-> fwdt%u running...\n", j); -- if (!fwdt->template) { -- ql_log(ql_log_warn, vha, 0xd012, -- "-> fwdt%u no template\n", j); -- break; -- } -- len = qla27xx_execute_fwdt_template(vha, -- fwdt->template, buf); -- if (len == 0) { -- goto bailout; -- } else if (len != fwdt->dump_size) { -- ql_log(ql_log_warn, vha, 0xd013, -- "-> fwdt%u fwdump residual=%+ld\n", -- j, fwdt->dump_size - len); -- } -+ -+ ql_log(ql_log_warn, vha, 0xd011, "-> fwdt0 running...\n"); -+ if (!fwdt->template) { -+ ql_log(ql_log_warn, vha, 0xd012, -+ "-> fwdt0 no template\n"); -+ goto bailout; - } -- vha->hw->fw_dump_len = buf - (void *)vha->hw->fw_dump; -+ len = qla27xx_execute_fwdt_template(vha, fwdt->template, buf); -+ if (len == 0) { -+ goto bailout; -+ } else if (len != fwdt->dump_size) { -+ ql_log(ql_log_warn, vha, 0xd013, -+ "-> fwdt0 fwdump residual=%+ld\n", -+ fwdt->dump_size - len); -+ } -+ -+ vha->hw->fw_dump_len = len; - vha->hw->fw_dumped = 1; - - ql_log(ql_log_warn, vha, 0xd015, -@@ -1048,7 +1126,6 @@ qla27xx_fwdump(scsi_qla_host_t *vha, int hardware_locked) - } - - bailout: -- vha->hw->fw_dump_mpi = 0; - #ifndef __CHECKER__ - if (!hardware_locked) - spin_unlock_irqrestore(&vha->hw->hardware_lock, flags); -diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c -index 856a4a0edcc7..38d337f0967d 100644 ---- a/drivers/spi/spi-fsl-dspi.c -+++ b/drivers/spi/spi-fsl-dspi.c -@@ -1,6 +1,7 @@ - // SPDX-License-Identifier: GPL-2.0+ - // - // Copyright 2013 Freescale Semiconductor, Inc. -+// Copyright 2020 NXP - // - // Freescale DSPI driver - // This file contains a driver for the Freescale DSPI -@@ -26,6 +27,9 @@ - #define SPI_MCR_CLR_TXF BIT(11) - #define SPI_MCR_CLR_RXF BIT(10) - #define SPI_MCR_XSPI BIT(3) -+#define SPI_MCR_DIS_TXF BIT(13) -+#define SPI_MCR_DIS_RXF BIT(12) -+#define SPI_MCR_HALT BIT(0) - - #define SPI_TCR 0x08 - #define SPI_TCR_GET_TCNT(x) (((x) & GENMASK(31, 16)) >> 16) -@@ -1437,15 +1441,42 @@ static int dspi_remove(struct platform_device *pdev) - struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); - - /* Disconnect from the SPI framework */ -+ spi_unregister_controller(dspi->ctlr); -+ -+ /* Disable RX and TX */ -+ regmap_update_bits(dspi->regmap, SPI_MCR, -+ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF, -+ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF); -+ -+ /* Stop Running */ -+ regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT); -+ - dspi_release_dma(dspi); - if (dspi->irq) - free_irq(dspi->irq, dspi); - clk_disable_unprepare(dspi->clk); -- spi_unregister_controller(dspi->ctlr); - - return 0; - } - -+static void dspi_shutdown(struct platform_device *pdev) -+{ -+ struct spi_controller *ctlr = platform_get_drvdata(pdev); -+ struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); -+ -+ /* Disable RX and TX */ -+ regmap_update_bits(dspi->regmap, SPI_MCR, -+ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF, -+ SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF); -+ -+ /* Stop Running */ -+ regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT); -+ -+ dspi_release_dma(dspi); -+ clk_disable_unprepare(dspi->clk); -+ spi_unregister_controller(dspi->ctlr); -+} -+ - static struct platform_driver fsl_dspi_driver = { - .driver.name = DRIVER_NAME, - .driver.of_match_table = fsl_dspi_dt_ids, -@@ -1453,6 +1484,7 @@ static struct platform_driver fsl_dspi_driver = { - .driver.pm = &dspi_pm, - .probe = dspi_probe, - .remove = dspi_remove, -+ .shutdown = dspi_shutdown, - }; - module_platform_driver(fsl_dspi_driver); - -diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c -index 80dd1025b953..012a89123067 100644 ---- a/drivers/spi/spidev.c -+++ b/drivers/spi/spidev.c -@@ -608,15 +608,20 @@ err_find_dev: - static int spidev_release(struct inode *inode, struct file *filp) - { - struct spidev_data *spidev; -+ int dofree; - - mutex_lock(&device_list_lock); - spidev = filp->private_data; - filp->private_data = NULL; - -+ spin_lock_irq(&spidev->spi_lock); -+ /* ... after we unbound from the underlying device? */ -+ dofree = (spidev->spi == NULL); -+ spin_unlock_irq(&spidev->spi_lock); -+ - /* last close? */ - spidev->users--; - if (!spidev->users) { -- int dofree; - - kfree(spidev->tx_buffer); - spidev->tx_buffer = NULL; -@@ -624,19 +629,14 @@ static int spidev_release(struct inode *inode, struct file *filp) - kfree(spidev->rx_buffer); - spidev->rx_buffer = NULL; - -- spin_lock_irq(&spidev->spi_lock); -- if (spidev->spi) -- spidev->speed_hz = spidev->spi->max_speed_hz; -- -- /* ... after we unbound from the underlying device? */ -- dofree = (spidev->spi == NULL); -- spin_unlock_irq(&spidev->spi_lock); -- - if (dofree) - kfree(spidev); -+ else -+ spidev->speed_hz = spidev->spi->max_speed_hz; - } - #ifdef CONFIG_SPI_SLAVE -- spi_slave_abort(spidev->spi); -+ if (!dofree) -+ spi_slave_abort(spidev->spi); - #endif - mutex_unlock(&device_list_lock); - -@@ -786,13 +786,13 @@ static int spidev_remove(struct spi_device *spi) - { - struct spidev_data *spidev = spi_get_drvdata(spi); - -+ /* prevent new opens */ -+ mutex_lock(&device_list_lock); - /* make sure ops on existing fds can abort cleanly */ - spin_lock_irq(&spidev->spi_lock); - spidev->spi = NULL; - spin_unlock_irq(&spidev->spi_lock); - -- /* prevent new opens */ -- mutex_lock(&device_list_lock); - list_del(&spidev->device_entry); - device_destroy(spidev_class, spidev->devt); - clear_bit(MINOR(spidev->devt), minors); -diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c -index 20b3045d7667..15ff60a58466 100644 ---- a/drivers/staging/wfx/hif_tx.c -+++ b/drivers/staging/wfx/hif_tx.c -@@ -222,7 +222,7 @@ int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, - } - - int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, -- int chan_start_idx, int chan_num) -+ int chan_start_idx, int chan_num, int *timeout) - { - int ret, i; - struct hif_msg *hif; -@@ -269,11 +269,13 @@ int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, - tmo_chan_fg = 512 * USEC_PER_TU + body->probe_delay; - tmo_chan_fg *= body->num_of_probe_requests; - tmo = chan_num * max(tmo_chan_bg, tmo_chan_fg) + 512 * USEC_PER_TU; -+ if (timeout) -+ *timeout = usecs_to_jiffies(tmo); - - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START_SCAN, buf_len); - ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); - kfree(hif); -- return ret ? ret : usecs_to_jiffies(tmo); -+ return ret; - } - - int hif_stop_scan(struct wfx_vif *wvif) -diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h -index f8520a14c14c..7a21338470ee 100644 ---- a/drivers/staging/wfx/hif_tx.h -+++ b/drivers/staging/wfx/hif_tx.h -@@ -43,7 +43,7 @@ int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, - void *buf, size_t buf_size); - int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req80211, -- int chan_start, int chan_num); -+ int chan_start, int chan_num, int *timeout); - int hif_stop_scan(struct wfx_vif *wvif); - int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, - struct ieee80211_channel *channel, const u8 *ssid, int ssidlen); -diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c -index 9aa14331affd..d47b8a3ba403 100644 ---- a/drivers/staging/wfx/scan.c -+++ b/drivers/staging/wfx/scan.c -@@ -56,10 +56,10 @@ static int send_scan_req(struct wfx_vif *wvif, - wfx_tx_lock_flush(wvif->wdev); - wvif->scan_abort = false; - reinit_completion(&wvif->scan_complete); -- timeout = hif_scan(wvif, req, start_idx, i - start_idx); -- if (timeout < 0) { -+ ret = hif_scan(wvif, req, start_idx, i - start_idx, &timeout); -+ if (ret) { - wfx_tx_unlock(wvif->wdev); -- return timeout; -+ return -EIO; - } - ret = wait_for_completion_timeout(&wvif->scan_complete, timeout); - if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower) -diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c -index b67372737dc9..96c05b121fac 100644 ---- a/drivers/usb/dwc3/dwc3-pci.c -+++ b/drivers/usb/dwc3/dwc3-pci.c -@@ -206,8 +206,10 @@ static void dwc3_pci_resume_work(struct work_struct *work) - int ret; - - ret = pm_runtime_get_sync(&dwc3->dev); -- if (ret) -+ if (ret) { -+ pm_runtime_put_sync_autosuspend(&dwc3->dev); - return; -+ } - - pm_runtime_mark_last_busy(&dwc3->dev); - pm_runtime_put_sync_autosuspend(&dwc3->dev); -diff --git a/fs/btrfs/discard.c b/fs/btrfs/discard.c -index 5615320fa659..741c7e19c32f 100644 ---- a/fs/btrfs/discard.c -+++ b/fs/btrfs/discard.c -@@ -619,6 +619,7 @@ void btrfs_discard_punt_unused_bgs_list(struct btrfs_fs_info *fs_info) - list_for_each_entry_safe(block_group, next, &fs_info->unused_bgs, - bg_list) { - list_del_init(&block_group->bg_list); -+ btrfs_put_block_group(block_group); - btrfs_discard_queue_work(&fs_info->discard_ctl, block_group); - } - spin_unlock(&fs_info->unused_bgs_lock); -diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c -index 91def9fd9456..f71e4dbe1d8a 100644 ---- a/fs/btrfs/disk-io.c -+++ b/fs/btrfs/disk-io.c -@@ -2583,10 +2583,12 @@ static int __cold init_tree_roots(struct btrfs_fs_info *fs_info) - !extent_buffer_uptodate(tree_root->node)) { - handle_error = true; - -- if (IS_ERR(tree_root->node)) -+ if (IS_ERR(tree_root->node)) { - ret = PTR_ERR(tree_root->node); -- else if (!extent_buffer_uptodate(tree_root->node)) -+ tree_root->node = NULL; -+ } else if (!extent_buffer_uptodate(tree_root->node)) { - ret = -EUCLEAN; -+ } - - btrfs_warn(fs_info, "failed to read tree root"); - continue; -diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c -index 39e45b8a5031..6e17a92869ad 100644 ---- a/fs/btrfs/extent_io.c -+++ b/fs/btrfs/extent_io.c -@@ -5063,25 +5063,28 @@ struct extent_buffer *alloc_dummy_extent_buffer(struct btrfs_fs_info *fs_info, - static void check_buffer_tree_ref(struct extent_buffer *eb) - { - int refs; -- /* the ref bit is tricky. We have to make sure it is set -- * if we have the buffer dirty. Otherwise the -- * code to free a buffer can end up dropping a dirty -- * page -+ /* -+ * The TREE_REF bit is first set when the extent_buffer is added -+ * to the radix tree. It is also reset, if unset, when a new reference -+ * is created by find_extent_buffer. - * -- * Once the ref bit is set, it won't go away while the -- * buffer is dirty or in writeback, and it also won't -- * go away while we have the reference count on the -- * eb bumped. -+ * It is only cleared in two cases: freeing the last non-tree -+ * reference to the extent_buffer when its STALE bit is set or -+ * calling releasepage when the tree reference is the only reference. - * -- * We can't just set the ref bit without bumping the -- * ref on the eb because free_extent_buffer might -- * see the ref bit and try to clear it. If this happens -- * free_extent_buffer might end up dropping our original -- * ref by mistake and freeing the page before we are able -- * to add one more ref. -+ * In both cases, care is taken to ensure that the extent_buffer's -+ * pages are not under io. However, releasepage can be concurrently -+ * called with creating new references, which is prone to race -+ * conditions between the calls to check_buffer_tree_ref in those -+ * codepaths and clearing TREE_REF in try_release_extent_buffer. - * -- * So bump the ref count first, then set the bit. If someone -- * beat us to it, drop the ref we added. -+ * The actual lifetime of the extent_buffer in the radix tree is -+ * adequately protected by the refcount, but the TREE_REF bit and -+ * its corresponding reference are not. To protect against this -+ * class of races, we call check_buffer_tree_ref from the codepaths -+ * which trigger io after they set eb->io_pages. Note that once io is -+ * initiated, TREE_REF can no longer be cleared, so that is the -+ * moment at which any such race is best fixed. - */ - refs = atomic_read(&eb->refs); - if (refs >= 2 && test_bit(EXTENT_BUFFER_TREE_REF, &eb->bflags)) -@@ -5532,6 +5535,11 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int wait, int mirror_num) - clear_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags); - eb->read_mirror = 0; - atomic_set(&eb->io_pages, num_reads); -+ /* -+ * It is possible for releasepage to clear the TREE_REF bit before we -+ * set io_pages. See check_buffer_tree_ref for a more detailed comment. -+ */ -+ check_buffer_tree_ref(eb); - for (i = 0; i < num_pages; i++) { - page = eb->pages[i]; - -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index 6aa200e373c8..e7bdda3ed069 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -1690,12 +1690,8 @@ out_check: - ret = fallback_to_cow(inode, locked_page, cow_start, - found_key.offset - 1, - page_started, nr_written); -- if (ret) { -- if (nocow) -- btrfs_dec_nocow_writers(fs_info, -- disk_bytenr); -+ if (ret) - goto error; -- } - cow_start = (u64)-1; - } - -@@ -1711,9 +1707,6 @@ out_check: - ram_bytes, BTRFS_COMPRESS_NONE, - BTRFS_ORDERED_PREALLOC); - if (IS_ERR(em)) { -- if (nocow) -- btrfs_dec_nocow_writers(fs_info, -- disk_bytenr); - ret = PTR_ERR(em); - goto error; - } -diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c -index eee6748c49e4..756950aba1a6 100644 ---- a/fs/btrfs/space-info.c -+++ b/fs/btrfs/space-info.c -@@ -879,8 +879,8 @@ static bool steal_from_global_rsv(struct btrfs_fs_info *fs_info, - return false; - } - global_rsv->reserved -= ticket->bytes; -+ remove_ticket(space_info, ticket); - ticket->bytes = 0; -- list_del_init(&ticket->list); - wake_up(&ticket->wait); - space_info->tickets_id++; - if (global_rsv->reserved < global_rsv->size) -diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c -index 430b0b125654..44a57b65915b 100644 ---- a/fs/cifs/inode.c -+++ b/fs/cifs/inode.c -@@ -2350,6 +2350,15 @@ set_size_out: - if (rc == 0) { - cifsInode->server_eof = attrs->ia_size; - cifs_setsize(inode, attrs->ia_size); -+ -+ /* -+ * The man page of truncate says if the size changed, -+ * then the st_ctime and st_mtime fields for the file -+ * are updated. -+ */ -+ attrs->ia_ctime = attrs->ia_mtime = current_time(inode); -+ attrs->ia_valid |= ATTR_CTIME | ATTR_MTIME; -+ - cifs_truncate_page(inode->i_mapping, inode->i_size); - } - -diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c -index 4a73e63c4d43..dcde44ff6cf9 100644 ---- a/fs/cifs/ioctl.c -+++ b/fs/cifs/ioctl.c -@@ -169,6 +169,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) - unsigned int xid; - struct cifsFileInfo *pSMBFile = filep->private_data; - struct cifs_tcon *tcon; -+ struct tcon_link *tlink; - struct cifs_sb_info *cifs_sb; - __u64 ExtAttrBits = 0; - __u64 caps; -@@ -307,13 +308,19 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) - break; - } - cifs_sb = CIFS_SB(inode->i_sb); -- tcon = tlink_tcon(cifs_sb_tlink(cifs_sb)); -+ tlink = cifs_sb_tlink(cifs_sb); -+ if (IS_ERR(tlink)) { -+ rc = PTR_ERR(tlink); -+ break; -+ } -+ tcon = tlink_tcon(tlink); - if (tcon && tcon->ses->server->ops->notify) { - rc = tcon->ses->server->ops->notify(xid, - filep, (void __user *)arg); - cifs_dbg(FYI, "ioctl notify rc %d\n", rc); - } else - rc = -EOPNOTSUPP; -+ cifs_put_tlink(tlink); - break; - default: - cifs_dbg(FYI, "unsupported ioctl\n"); -diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c -index 497afb0b9960..44fca24d993e 100644 ---- a/fs/cifs/smb2misc.c -+++ b/fs/cifs/smb2misc.c -@@ -354,9 +354,13 @@ smb2_get_data_area_len(int *off, int *len, struct smb2_sync_hdr *shdr) - ((struct smb2_ioctl_rsp *)shdr)->OutputCount); - break; - case SMB2_CHANGE_NOTIFY: -+ *off = le16_to_cpu( -+ ((struct smb2_change_notify_rsp *)shdr)->OutputBufferOffset); -+ *len = le32_to_cpu( -+ ((struct smb2_change_notify_rsp *)shdr)->OutputBufferLength); -+ break; - default: -- /* BB FIXME for unimplemented cases above */ -- cifs_dbg(VFS, "no length check for command\n"); -+ cifs_dbg(VFS, "no length check for command %d\n", le16_to_cpu(shdr->Command)); - break; - } - -diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c -index 6fc69c3b2749..bf13917ec1a4 100644 ---- a/fs/cifs/smb2ops.c -+++ b/fs/cifs/smb2ops.c -@@ -2119,7 +2119,7 @@ smb3_notify(const unsigned int xid, struct file *pfile, - - tcon = cifs_sb_master_tcon(cifs_sb); - oparms.tcon = tcon; -- oparms.desired_access = FILE_READ_ATTRIBUTES; -+ oparms.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA; - oparms.disposition = FILE_OPEN; - oparms.create_options = cifs_create_options(cifs_sb, 0); - oparms.fid = &fid; -diff --git a/fs/io_uring.c b/fs/io_uring.c -index 2be6ea010340..ba2184841cb5 100644 ---- a/fs/io_uring.c -+++ b/fs/io_uring.c -@@ -3587,6 +3587,7 @@ static int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) - if (req->flags & REQ_F_NEED_CLEANUP) - return 0; - -+ io->msg.msg.msg_name = &io->msg.addr; - io->msg.iov = io->msg.fast_iov; - ret = sendmsg_copy_msghdr(&io->msg.msg, sr->msg, sr->msg_flags, - &io->msg.iov); -@@ -3774,6 +3775,7 @@ static int __io_compat_recvmsg_copy_hdr(struct io_kiocb *req, - - static int io_recvmsg_copy_hdr(struct io_kiocb *req, struct io_async_ctx *io) - { -+ io->msg.msg.msg_name = &io->msg.addr; - io->msg.iov = io->msg.fast_iov; - - #ifdef CONFIG_COMPAT -@@ -6751,6 +6753,7 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg, - for (i = 0; i < nr_tables; i++) - kfree(ctx->file_data->table[i].files); - -+ percpu_ref_exit(&ctx->file_data->refs); - kfree(ctx->file_data->table); - kfree(ctx->file_data); - ctx->file_data = NULL; -@@ -6904,8 +6907,10 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx, - } - table->files[index] = file; - err = io_sqe_file_register(ctx, file, i); -- if (err) -+ if (err) { -+ fput(file); - break; -+ } - } - nr_args--; - done++; -@@ -7400,9 +7405,6 @@ static void io_ring_ctx_free(struct io_ring_ctx *ctx) - io_mem_free(ctx->sq_sqes); - - percpu_ref_exit(&ctx->refs); -- if (ctx->account_mem) -- io_unaccount_mem(ctx->user, -- ring_pages(ctx->sq_entries, ctx->cq_entries)); - free_uid(ctx->user); - put_cred(ctx->creds); - kfree(ctx->completions); -@@ -7498,6 +7500,16 @@ static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx) - if (ctx->rings) - io_cqring_overflow_flush(ctx, true); - idr_for_each(&ctx->personality_idr, io_remove_personalities, ctx); -+ -+ /* -+ * Do this upfront, so we won't have a grace period where the ring -+ * is closed but resources aren't reaped yet. This can cause -+ * spurious failure in setting up a new ring. -+ */ -+ if (ctx->account_mem) -+ io_unaccount_mem(ctx->user, -+ ring_pages(ctx->sq_entries, ctx->cq_entries)); -+ - INIT_WORK(&ctx->exit_work, io_ring_exit_work); - queue_work(system_wq, &ctx->exit_work); - } -diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c -index a3ab6e219061..873342308dc0 100644 ---- a/fs/nfs/nfs4namespace.c -+++ b/fs/nfs/nfs4namespace.c -@@ -308,6 +308,7 @@ static int try_location(struct fs_context *fc, - if (IS_ERR(export_path)) - return PTR_ERR(export_path); - -+ kfree(ctx->nfs_server.export_path); - ctx->nfs_server.export_path = export_path; - - source = kmalloc(len + 1 + ctx->nfs_server.export_path_len + 1, -diff --git a/include/linux/btf.h b/include/linux/btf.h -index 5c1ea99b480f..8b81fbb4497c 100644 ---- a/include/linux/btf.h -+++ b/include/linux/btf.h -@@ -82,6 +82,11 @@ static inline bool btf_type_is_int(const struct btf_type *t) - return BTF_INFO_KIND(t->info) == BTF_KIND_INT; - } - -+static inline bool btf_type_is_small_int(const struct btf_type *t) -+{ -+ return btf_type_is_int(t) && t->size <= sizeof(u64); -+} -+ - static inline bool btf_type_is_enum(const struct btf_type *t) - { - return BTF_INFO_KIND(t->info) == BTF_KIND_ENUM; -diff --git a/include/linux/filter.h b/include/linux/filter.h -index 9b5aa5c483cc..ccbba0adc0da 100644 ---- a/include/linux/filter.h -+++ b/include/linux/filter.h -@@ -888,12 +888,12 @@ void bpf_jit_compile(struct bpf_prog *prog); - bool bpf_jit_needs_zext(void); - bool bpf_helper_changes_pkt_data(void *func); - --static inline bool bpf_dump_raw_ok(void) -+static inline bool bpf_dump_raw_ok(const struct cred *cred) - { - /* Reconstruction of call-sites is dependent on kallsyms, - * thus make dump the same restriction. - */ -- return kallsyms_show_value() == 1; -+ return kallsyms_show_value(cred); - } - - struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, -diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h -index 657a83b943f0..1f96ce2b47df 100644 ---- a/include/linux/kallsyms.h -+++ b/include/linux/kallsyms.h -@@ -18,6 +18,7 @@ - #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \ - 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1) - -+struct cred; - struct module; - - static inline int is_kernel_inittext(unsigned long addr) -@@ -98,7 +99,7 @@ int lookup_symbol_name(unsigned long addr, char *symname); - int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name); - - /* How and when do we show kallsyms values? */ --extern int kallsyms_show_value(void); -+extern bool kallsyms_show_value(const struct cred *cred); - - #else /* !CONFIG_KALLSYMS */ - -@@ -158,7 +159,7 @@ static inline int lookup_symbol_attrs(unsigned long addr, unsigned long *size, u - return -ERANGE; - } - --static inline int kallsyms_show_value(void) -+static inline bool kallsyms_show_value(const struct cred *cred) - { - return false; - } -diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h -index 6ce8effa0b12..70cbc5095e72 100644 ---- a/include/sound/compress_driver.h -+++ b/include/sound/compress_driver.h -@@ -66,6 +66,7 @@ struct snd_compr_runtime { - * @direction: stream direction, playback/recording - * @metadata_set: metadata set flag, true when set - * @next_track: has userspace signal next track transition, true when set -+ * @partial_drain: undergoing partial_drain for stream, true when set - * @private_data: pointer to DSP private data - * @dma_buffer: allocated buffer if any - */ -@@ -78,6 +79,7 @@ struct snd_compr_stream { - enum snd_compr_direction direction; - bool metadata_set; - bool next_track; -+ bool partial_drain; - void *private_data; - struct snd_dma_buffer dma_buffer; - }; -@@ -182,7 +184,13 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream) - if (snd_BUG_ON(!stream)) - return; - -- stream->runtime->state = SNDRV_PCM_STATE_SETUP; -+ /* for partial_drain case we are back to running state on success */ -+ if (stream->partial_drain) { -+ stream->runtime->state = SNDRV_PCM_STATE_RUNNING; -+ stream->partial_drain = false; /* clear this flag as well */ -+ } else { -+ stream->runtime->state = SNDRV_PCM_STATE_SETUP; -+ } - - wake_up(&stream->runtime->sleep); - } -diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c -index d65c6912bdaf..d1f5d428c9fe 100644 ---- a/kernel/bpf/btf.c -+++ b/kernel/bpf/btf.c -@@ -3744,7 +3744,7 @@ bool btf_ctx_access(int off, int size, enum bpf_access_type type, - return false; - - t = btf_type_skip_modifiers(btf, t->type, NULL); -- if (!btf_type_is_int(t)) { -+ if (!btf_type_is_small_int(t)) { - bpf_log(log, - "ret type %s not allowed for fmod_ret\n", - btf_kind_str[BTF_INFO_KIND(t->info)]); -@@ -3766,7 +3766,7 @@ bool btf_ctx_access(int off, int size, enum bpf_access_type type, - /* skip modifiers */ - while (btf_type_is_modifier(t)) - t = btf_type_by_id(btf, t->type); -- if (btf_type_is_int(t) || btf_type_is_enum(t)) -+ if (btf_type_is_small_int(t) || btf_type_is_enum(t)) - /* accessing a scalar */ - return true; - if (!btf_type_is_ptr(t)) { -diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c -index c8acc8f37583..0e4d99cfac93 100644 ---- a/kernel/bpf/syscall.c -+++ b/kernel/bpf/syscall.c -@@ -2918,7 +2918,8 @@ static const struct bpf_map *bpf_map_from_imm(const struct bpf_prog *prog, - return NULL; - } - --static struct bpf_insn *bpf_insn_prepare_dump(const struct bpf_prog *prog) -+static struct bpf_insn *bpf_insn_prepare_dump(const struct bpf_prog *prog, -+ const struct cred *f_cred) - { - const struct bpf_map *map; - struct bpf_insn *insns; -@@ -2944,7 +2945,7 @@ static struct bpf_insn *bpf_insn_prepare_dump(const struct bpf_prog *prog) - code == (BPF_JMP | BPF_CALL_ARGS)) { - if (code == (BPF_JMP | BPF_CALL_ARGS)) - insns[i].code = BPF_JMP | BPF_CALL; -- if (!bpf_dump_raw_ok()) -+ if (!bpf_dump_raw_ok(f_cred)) - insns[i].imm = 0; - continue; - } -@@ -3000,7 +3001,8 @@ static int set_info_rec_size(struct bpf_prog_info *info) - return 0; - } - --static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, -+static int bpf_prog_get_info_by_fd(struct file *file, -+ struct bpf_prog *prog, - const union bpf_attr *attr, - union bpf_attr __user *uattr) - { -@@ -3069,11 +3071,11 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, - struct bpf_insn *insns_sanitized; - bool fault; - -- if (prog->blinded && !bpf_dump_raw_ok()) { -+ if (prog->blinded && !bpf_dump_raw_ok(file->f_cred)) { - info.xlated_prog_insns = 0; - goto done; - } -- insns_sanitized = bpf_insn_prepare_dump(prog); -+ insns_sanitized = bpf_insn_prepare_dump(prog, file->f_cred); - if (!insns_sanitized) - return -ENOMEM; - uinsns = u64_to_user_ptr(info.xlated_prog_insns); -@@ -3107,7 +3109,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, - } - - if (info.jited_prog_len && ulen) { -- if (bpf_dump_raw_ok()) { -+ if (bpf_dump_raw_ok(file->f_cred)) { - uinsns = u64_to_user_ptr(info.jited_prog_insns); - ulen = min_t(u32, info.jited_prog_len, ulen); - -@@ -3142,7 +3144,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, - ulen = info.nr_jited_ksyms; - info.nr_jited_ksyms = prog->aux->func_cnt ? : 1; - if (ulen) { -- if (bpf_dump_raw_ok()) { -+ if (bpf_dump_raw_ok(file->f_cred)) { - unsigned long ksym_addr; - u64 __user *user_ksyms; - u32 i; -@@ -3173,7 +3175,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, - ulen = info.nr_jited_func_lens; - info.nr_jited_func_lens = prog->aux->func_cnt ? : 1; - if (ulen) { -- if (bpf_dump_raw_ok()) { -+ if (bpf_dump_raw_ok(file->f_cred)) { - u32 __user *user_lens; - u32 func_len, i; - -@@ -3230,7 +3232,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, - else - info.nr_jited_line_info = 0; - if (info.nr_jited_line_info && ulen) { -- if (bpf_dump_raw_ok()) { -+ if (bpf_dump_raw_ok(file->f_cred)) { - __u64 __user *user_linfo; - u32 i; - -@@ -3276,7 +3278,8 @@ done: - return 0; - } - --static int bpf_map_get_info_by_fd(struct bpf_map *map, -+static int bpf_map_get_info_by_fd(struct file *file, -+ struct bpf_map *map, - const union bpf_attr *attr, - union bpf_attr __user *uattr) - { -@@ -3319,7 +3322,8 @@ static int bpf_map_get_info_by_fd(struct bpf_map *map, - return 0; - } - --static int bpf_btf_get_info_by_fd(struct btf *btf, -+static int bpf_btf_get_info_by_fd(struct file *file, -+ struct btf *btf, - const union bpf_attr *attr, - union bpf_attr __user *uattr) - { -@@ -3351,13 +3355,13 @@ static int bpf_obj_get_info_by_fd(const union bpf_attr *attr, - return -EBADFD; - - if (f.file->f_op == &bpf_prog_fops) -- err = bpf_prog_get_info_by_fd(f.file->private_data, attr, -+ err = bpf_prog_get_info_by_fd(f.file, f.file->private_data, attr, - uattr); - else if (f.file->f_op == &bpf_map_fops) -- err = bpf_map_get_info_by_fd(f.file->private_data, attr, -+ err = bpf_map_get_info_by_fd(f.file, f.file->private_data, attr, - uattr); - else if (f.file->f_op == &btf_fops) -- err = bpf_btf_get_info_by_fd(f.file->private_data, attr, uattr); -+ err = bpf_btf_get_info_by_fd(f.file, f.file->private_data, attr, uattr); - else - err = -EINVAL; - -diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c -index 16c8c605f4b0..bb14e64f62a4 100644 ---- a/kernel/kallsyms.c -+++ b/kernel/kallsyms.c -@@ -644,19 +644,20 @@ static inline int kallsyms_for_perf(void) - * Otherwise, require CAP_SYSLOG (assuming kptr_restrict isn't set to - * block even that). - */ --int kallsyms_show_value(void) -+bool kallsyms_show_value(const struct cred *cred) - { - switch (kptr_restrict) { - case 0: - if (kallsyms_for_perf()) -- return 1; -+ return true; - /* fallthrough */ - case 1: -- if (has_capability_noaudit(current, CAP_SYSLOG)) -- return 1; -+ if (security_capable(cred, &init_user_ns, CAP_SYSLOG, -+ CAP_OPT_NOAUDIT) == 0) -+ return true; - /* fallthrough */ - default: -- return 0; -+ return false; - } - } - -@@ -673,7 +674,11 @@ static int kallsyms_open(struct inode *inode, struct file *file) - return -ENOMEM; - reset_iter(iter, 0); - -- iter->show_value = kallsyms_show_value(); -+ /* -+ * Instead of checking this on every s_show() call, cache -+ * the result here at open time. -+ */ -+ iter->show_value = kallsyms_show_value(file->f_cred); - return 0; - } - -diff --git a/kernel/kprobes.c b/kernel/kprobes.c -index 950a5cfd262c..0a967db226d8 100644 ---- a/kernel/kprobes.c -+++ b/kernel/kprobes.c -@@ -2362,7 +2362,7 @@ static void report_probe(struct seq_file *pi, struct kprobe *p, - else - kprobe_type = "k"; - -- if (!kallsyms_show_value()) -+ if (!kallsyms_show_value(pi->file->f_cred)) - addr = NULL; - - if (sym) -@@ -2463,7 +2463,7 @@ static int kprobe_blacklist_seq_show(struct seq_file *m, void *v) - * If /proc/kallsyms is not showing kernel address, we won't - * show them here either. - */ -- if (!kallsyms_show_value()) -+ if (!kallsyms_show_value(m->file->f_cred)) - seq_printf(m, "0x%px-0x%px\t%ps\n", NULL, NULL, - (void *)ent->start_addr); - else -diff --git a/kernel/module.c b/kernel/module.c -index 646f1e2330d2..af59c86f1547 100644 ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -1507,8 +1507,7 @@ static inline bool sect_empty(const Elf_Shdr *sect) - } - - struct module_sect_attr { -- struct module_attribute mattr; -- char *name; -+ struct bin_attribute battr; - unsigned long address; - }; - -@@ -1518,13 +1517,18 @@ struct module_sect_attrs { - struct module_sect_attr attrs[]; - }; - --static ssize_t module_sect_show(struct module_attribute *mattr, -- struct module_kobject *mk, char *buf) -+static ssize_t module_sect_read(struct file *file, struct kobject *kobj, -+ struct bin_attribute *battr, -+ char *buf, loff_t pos, size_t count) - { - struct module_sect_attr *sattr = -- container_of(mattr, struct module_sect_attr, mattr); -- return sprintf(buf, "0x%px\n", kptr_restrict < 2 ? -- (void *)sattr->address : NULL); -+ container_of(battr, struct module_sect_attr, battr); -+ -+ if (pos != 0) -+ return -EINVAL; -+ -+ return sprintf(buf, "0x%px\n", -+ kallsyms_show_value(file->f_cred) ? (void *)sattr->address : NULL); - } - - static void free_sect_attrs(struct module_sect_attrs *sect_attrs) -@@ -1532,7 +1536,7 @@ static void free_sect_attrs(struct module_sect_attrs *sect_attrs) - unsigned int section; - - for (section = 0; section < sect_attrs->nsections; section++) -- kfree(sect_attrs->attrs[section].name); -+ kfree(sect_attrs->attrs[section].battr.attr.name); - kfree(sect_attrs); - } - -@@ -1541,42 +1545,41 @@ static void add_sect_attrs(struct module *mod, const struct load_info *info) - unsigned int nloaded = 0, i, size[2]; - struct module_sect_attrs *sect_attrs; - struct module_sect_attr *sattr; -- struct attribute **gattr; -+ struct bin_attribute **gattr; - - /* Count loaded sections and allocate structures */ - for (i = 0; i < info->hdr->e_shnum; i++) - if (!sect_empty(&info->sechdrs[i])) - nloaded++; - size[0] = ALIGN(struct_size(sect_attrs, attrs, nloaded), -- sizeof(sect_attrs->grp.attrs[0])); -- size[1] = (nloaded + 1) * sizeof(sect_attrs->grp.attrs[0]); -+ sizeof(sect_attrs->grp.bin_attrs[0])); -+ size[1] = (nloaded + 1) * sizeof(sect_attrs->grp.bin_attrs[0]); - sect_attrs = kzalloc(size[0] + size[1], GFP_KERNEL); - if (sect_attrs == NULL) - return; - - /* Setup section attributes. */ - sect_attrs->grp.name = "sections"; -- sect_attrs->grp.attrs = (void *)sect_attrs + size[0]; -+ sect_attrs->grp.bin_attrs = (void *)sect_attrs + size[0]; - - sect_attrs->nsections = 0; - sattr = §_attrs->attrs[0]; -- gattr = §_attrs->grp.attrs[0]; -+ gattr = §_attrs->grp.bin_attrs[0]; - for (i = 0; i < info->hdr->e_shnum; i++) { - Elf_Shdr *sec = &info->sechdrs[i]; - if (sect_empty(sec)) - continue; -+ sysfs_bin_attr_init(&sattr->battr); - sattr->address = sec->sh_addr; -- sattr->name = kstrdup(info->secstrings + sec->sh_name, -- GFP_KERNEL); -- if (sattr->name == NULL) -+ sattr->battr.attr.name = -+ kstrdup(info->secstrings + sec->sh_name, GFP_KERNEL); -+ if (sattr->battr.attr.name == NULL) - goto out; - sect_attrs->nsections++; -- sysfs_attr_init(&sattr->mattr.attr); -- sattr->mattr.show = module_sect_show; -- sattr->mattr.store = NULL; -- sattr->mattr.attr.name = sattr->name; -- sattr->mattr.attr.mode = S_IRUSR; -- *(gattr++) = &(sattr++)->mattr.attr; -+ sattr->battr.read = module_sect_read; -+ sattr->battr.size = 3 /* "0x", "\n" */ + (BITS_PER_LONG / 4); -+ sattr->battr.attr.mode = 0400; -+ *(gattr++) = &(sattr++)->battr; - } - *gattr = NULL; - -@@ -1666,7 +1669,7 @@ static void add_notes_attrs(struct module *mod, const struct load_info *info) - continue; - if (info->sechdrs[i].sh_type == SHT_NOTE) { - sysfs_bin_attr_init(nattr); -- nattr->attr.name = mod->sect_attrs->attrs[loaded].name; -+ nattr->attr.name = mod->sect_attrs->attrs[loaded].battr.attr.name; - nattr->attr.mode = S_IRUGO; - nattr->size = info->sechdrs[i].sh_size; - nattr->private = (void *) info->sechdrs[i].sh_addr; -@@ -4348,7 +4351,7 @@ static int modules_open(struct inode *inode, struct file *file) - - if (!err) { - struct seq_file *m = file->private_data; -- m->private = kallsyms_show_value() ? NULL : (void *)8ul; -+ m->private = kallsyms_show_value(file->f_cred) ? NULL : (void *)8ul; - } - - return err; -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index f2618ade8047..8034434b1040 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -1637,7 +1637,7 @@ static int __set_cpus_allowed_ptr(struct task_struct *p, - goto out; - } - -- if (cpumask_equal(p->cpus_ptr, new_mask)) -+ if (cpumask_equal(&p->cpus_mask, new_mask)) - goto out; - - /* -diff --git a/net/core/skmsg.c b/net/core/skmsg.c -index 351afbf6bfba..6a32a1fd34f8 100644 ---- a/net/core/skmsg.c -+++ b/net/core/skmsg.c -@@ -683,7 +683,7 @@ static struct sk_psock *sk_psock_from_strp(struct strparser *strp) - return container_of(parser, struct sk_psock, parser); - } - --static void sk_psock_skb_redirect(struct sk_psock *psock, struct sk_buff *skb) -+static void sk_psock_skb_redirect(struct sk_buff *skb) - { - struct sk_psock *psock_other; - struct sock *sk_other; -@@ -715,12 +715,11 @@ static void sk_psock_skb_redirect(struct sk_psock *psock, struct sk_buff *skb) - } - } - --static void sk_psock_tls_verdict_apply(struct sk_psock *psock, -- struct sk_buff *skb, int verdict) -+static void sk_psock_tls_verdict_apply(struct sk_buff *skb, int verdict) - { - switch (verdict) { - case __SK_REDIRECT: -- sk_psock_skb_redirect(psock, skb); -+ sk_psock_skb_redirect(skb); - break; - case __SK_PASS: - case __SK_DROP: -@@ -741,8 +740,8 @@ int sk_psock_tls_strp_read(struct sk_psock *psock, struct sk_buff *skb) - ret = sk_psock_bpf_run(psock, prog, skb); - ret = sk_psock_map_verd(ret, tcp_skb_bpf_redirect_fetch(skb)); - } -+ sk_psock_tls_verdict_apply(skb, ret); - rcu_read_unlock(); -- sk_psock_tls_verdict_apply(psock, skb, ret); - return ret; - } - EXPORT_SYMBOL_GPL(sk_psock_tls_strp_read); -@@ -770,7 +769,7 @@ static void sk_psock_verdict_apply(struct sk_psock *psock, - } - goto out_free; - case __SK_REDIRECT: -- sk_psock_skb_redirect(psock, skb); -+ sk_psock_skb_redirect(skb); - break; - case __SK_DROP: - /* fall-through */ -@@ -782,11 +781,18 @@ out_free: - - static void sk_psock_strp_read(struct strparser *strp, struct sk_buff *skb) - { -- struct sk_psock *psock = sk_psock_from_strp(strp); -+ struct sk_psock *psock; - struct bpf_prog *prog; - int ret = __SK_DROP; -+ struct sock *sk; - - rcu_read_lock(); -+ sk = strp->sk; -+ psock = sk_psock(sk); -+ if (unlikely(!psock)) { -+ kfree_skb(skb); -+ goto out; -+ } - prog = READ_ONCE(psock->progs.skb_verdict); - if (likely(prog)) { - skb_orphan(skb); -@@ -794,8 +800,9 @@ static void sk_psock_strp_read(struct strparser *strp, struct sk_buff *skb) - ret = sk_psock_bpf_run(psock, prog, skb); - ret = sk_psock_map_verd(ret, tcp_skb_bpf_redirect_fetch(skb)); - } -- rcu_read_unlock(); - sk_psock_verdict_apply(psock, skb, ret); -+out: -+ rcu_read_unlock(); - } - - static int sk_psock_strp_read_done(struct strparser *strp, int err) -diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c -index 9f9e00ba3ad7..669cbe1609d9 100644 ---- a/net/core/sysctl_net_core.c -+++ b/net/core/sysctl_net_core.c -@@ -277,7 +277,7 @@ static int proc_dointvec_minmax_bpf_enable(struct ctl_table *table, int write, - ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); - if (write && !ret) { - if (jit_enable < 2 || -- (jit_enable == 2 && bpf_dump_raw_ok())) { -+ (jit_enable == 2 && bpf_dump_raw_ok(current_cred()))) { - *(int *)table->data = jit_enable; - if (jit_enable == 2) - pr_warn("bpf_jit_enable = 2 was set! NEVER use this in production, only for JIT debugging!\n"); -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c -index 82846aca86d9..6ab33d9904ee 100644 ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -4192,7 +4192,7 @@ static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata, - (!sta || !test_sta_flag(sta, WLAN_STA_TDLS_PEER))) - ra = sdata->u.mgd.bssid; - -- if (!is_valid_ether_addr(ra)) -+ if (is_zero_ether_addr(ra)) - goto out_free; - - multicast = is_multicast_ether_addr(ra); -diff --git a/net/netfilter/ipset/ip_set_bitmap_ip.c b/net/netfilter/ipset/ip_set_bitmap_ip.c -index 486959f70cf3..a8ce04a4bb72 100644 ---- a/net/netfilter/ipset/ip_set_bitmap_ip.c -+++ b/net/netfilter/ipset/ip_set_bitmap_ip.c -@@ -326,7 +326,7 @@ bitmap_ip_create(struct net *net, struct ip_set *set, struct nlattr *tb[], - set->variant = &bitmap_ip; - if (!init_map_ip(set, map, first_ip, last_ip, - elements, hosts, netmask)) { -- kfree(map); -+ ip_set_free(map); - return -ENOMEM; - } - if (tb[IPSET_ATTR_TIMEOUT]) { -diff --git a/net/netfilter/ipset/ip_set_bitmap_ipmac.c b/net/netfilter/ipset/ip_set_bitmap_ipmac.c -index 2310a316e0af..2c625e0f49ec 100644 ---- a/net/netfilter/ipset/ip_set_bitmap_ipmac.c -+++ b/net/netfilter/ipset/ip_set_bitmap_ipmac.c -@@ -363,7 +363,7 @@ bitmap_ipmac_create(struct net *net, struct ip_set *set, struct nlattr *tb[], - map->memsize = BITS_TO_LONGS(elements) * sizeof(unsigned long); - set->variant = &bitmap_ipmac; - if (!init_map_ipmac(set, map, first_ip, last_ip, elements)) { -- kfree(map); -+ ip_set_free(map); - return -ENOMEM; - } - if (tb[IPSET_ATTR_TIMEOUT]) { -diff --git a/net/netfilter/ipset/ip_set_bitmap_port.c b/net/netfilter/ipset/ip_set_bitmap_port.c -index e56ced66f202..7138e080def4 100644 ---- a/net/netfilter/ipset/ip_set_bitmap_port.c -+++ b/net/netfilter/ipset/ip_set_bitmap_port.c -@@ -274,7 +274,7 @@ bitmap_port_create(struct net *net, struct ip_set *set, struct nlattr *tb[], - map->memsize = BITS_TO_LONGS(elements) * sizeof(unsigned long); - set->variant = &bitmap_port; - if (!init_map_port(set, map, first_port, last_port)) { -- kfree(map); -+ ip_set_free(map); - return -ENOMEM; - } - if (tb[IPSET_ATTR_TIMEOUT]) { -diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h -index 1ee43752d6d3..521e970be402 100644 ---- a/net/netfilter/ipset/ip_set_hash_gen.h -+++ b/net/netfilter/ipset/ip_set_hash_gen.h -@@ -682,7 +682,7 @@ retry: - } - t->hregion = ip_set_alloc(ahash_sizeof_regions(htable_bits)); - if (!t->hregion) { -- kfree(t); -+ ip_set_free(t); - ret = -ENOMEM; - goto out; - } -@@ -1533,7 +1533,7 @@ IPSET_TOKEN(HTYPE, _create)(struct net *net, struct ip_set *set, - } - t->hregion = ip_set_alloc(ahash_sizeof_regions(hbits)); - if (!t->hregion) { -- kfree(t); -+ ip_set_free(t); - kfree(h); - return -ENOMEM; - } -diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c -index bb72ca5f3999..3ab6dbb6588e 100644 ---- a/net/netfilter/nf_conntrack_core.c -+++ b/net/netfilter/nf_conntrack_core.c -@@ -2149,6 +2149,8 @@ static int nf_conntrack_update(struct net *net, struct sk_buff *skb) - err = __nf_conntrack_update(net, skb, ct, ctinfo); - if (err < 0) - return err; -+ -+ ct = nf_ct_get(skb, &ctinfo); - } - - return nf_confirm_cthelper(skb, ct, ctinfo); -diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c -index 2d8d6131bc5f..7eccbbf6f8ad 100644 ---- a/net/qrtr/qrtr.c -+++ b/net/qrtr/qrtr.c -@@ -427,7 +427,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len) - unsigned int ver; - size_t hdrlen; - -- if (len & 3) -+ if (len == 0 || len & 3) - return -EINVAL; - - skb = netdev_alloc_skb(NULL, len); -@@ -441,6 +441,8 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len) - - switch (ver) { - case QRTR_PROTO_VER_1: -+ if (len < sizeof(*v1)) -+ goto err; - v1 = data; - hdrlen = sizeof(*v1); - -@@ -454,6 +456,8 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len) - size = le32_to_cpu(v1->size); - break; - case QRTR_PROTO_VER_2: -+ if (len < sizeof(*v2)) -+ goto err; - v2 = data; - hdrlen = sizeof(*v2) + v2->optlen; - -diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c -index 05c4d3a9cda2..db0259c6467e 100644 ---- a/net/sunrpc/xprtrdma/verbs.c -+++ b/net/sunrpc/xprtrdma/verbs.c -@@ -84,7 +84,8 @@ static void rpcrdma_rep_destroy(struct rpcrdma_rep *rep); - static void rpcrdma_reps_unmap(struct rpcrdma_xprt *r_xprt); - static void rpcrdma_mrs_create(struct rpcrdma_xprt *r_xprt); - static void rpcrdma_mrs_destroy(struct rpcrdma_xprt *r_xprt); --static int rpcrdma_ep_destroy(struct rpcrdma_ep *ep); -+static void rpcrdma_ep_get(struct rpcrdma_ep *ep); -+static int rpcrdma_ep_put(struct rpcrdma_ep *ep); - static struct rpcrdma_regbuf * - rpcrdma_regbuf_alloc(size_t size, enum dma_data_direction direction, - gfp_t flags); -@@ -97,7 +98,8 @@ static void rpcrdma_regbuf_free(struct rpcrdma_regbuf *rb); - */ - static void rpcrdma_xprt_drain(struct rpcrdma_xprt *r_xprt) - { -- struct rdma_cm_id *id = r_xprt->rx_ep->re_id; -+ struct rpcrdma_ep *ep = r_xprt->rx_ep; -+ struct rdma_cm_id *id = ep->re_id; - - /* Flush Receives, then wait for deferred Reply work - * to complete. -@@ -108,6 +110,8 @@ static void rpcrdma_xprt_drain(struct rpcrdma_xprt *r_xprt) - * local invalidations. - */ - ib_drain_sq(id->qp); -+ -+ rpcrdma_ep_put(ep); - } - - /** -@@ -267,7 +271,7 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) - xprt_force_disconnect(xprt); - goto disconnected; - case RDMA_CM_EVENT_ESTABLISHED: -- kref_get(&ep->re_kref); -+ rpcrdma_ep_get(ep); - ep->re_connect_status = 1; - rpcrdma_update_cm_private(ep, &event->param.conn); - trace_xprtrdma_inline_thresh(ep); -@@ -290,7 +294,7 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) - ep->re_connect_status = -ECONNABORTED; - disconnected: - xprt_force_disconnect(xprt); -- return rpcrdma_ep_destroy(ep); -+ return rpcrdma_ep_put(ep); - default: - break; - } -@@ -346,7 +350,7 @@ out: - return ERR_PTR(rc); - } - --static void rpcrdma_ep_put(struct kref *kref) -+static void rpcrdma_ep_destroy(struct kref *kref) - { - struct rpcrdma_ep *ep = container_of(kref, struct rpcrdma_ep, re_kref); - -@@ -370,13 +374,18 @@ static void rpcrdma_ep_put(struct kref *kref) - module_put(THIS_MODULE); - } - -+static noinline void rpcrdma_ep_get(struct rpcrdma_ep *ep) -+{ -+ kref_get(&ep->re_kref); -+} -+ - /* Returns: - * %0 if @ep still has a positive kref count, or - * %1 if @ep was destroyed successfully. - */ --static int rpcrdma_ep_destroy(struct rpcrdma_ep *ep) -+static noinline int rpcrdma_ep_put(struct rpcrdma_ep *ep) - { -- return kref_put(&ep->re_kref, rpcrdma_ep_put); -+ return kref_put(&ep->re_kref, rpcrdma_ep_destroy); - } - - static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt) -@@ -493,7 +502,7 @@ static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt) - return 0; - - out_destroy: -- rpcrdma_ep_destroy(ep); -+ rpcrdma_ep_put(ep); - rdma_destroy_id(id); - out_free: - kfree(ep); -@@ -522,8 +531,12 @@ retry: - - ep->re_connect_status = 0; - xprt_clear_connected(xprt); -- - rpcrdma_reset_cwnd(r_xprt); -+ -+ /* Bump the ep's reference count while there are -+ * outstanding Receives. -+ */ -+ rpcrdma_ep_get(ep); - rpcrdma_post_recvs(r_xprt, true); - - rc = rpcrdma_sendctxs_create(r_xprt); -@@ -588,7 +601,7 @@ void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt) - rpcrdma_mrs_destroy(r_xprt); - rpcrdma_sendctxs_destroy(r_xprt); - -- if (rpcrdma_ep_destroy(ep)) -+ if (rpcrdma_ep_put(ep)) - rdma_destroy_id(id); - - r_xprt->rx_ep = NULL; -diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c -index 692bcd35f809..7ae6b90e0d26 100644 ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -5004,7 +5004,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) - err = nl80211_parse_he_obss_pd( - info->attrs[NL80211_ATTR_HE_OBSS_PD], - ¶ms.he_obss_pd); -- goto out; -+ if (err) -+ goto out; - } - - if (info->attrs[NL80211_ATTR_HE_BSS_COLOR]) { -@@ -5012,7 +5013,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) - info->attrs[NL80211_ATTR_HE_BSS_COLOR], - ¶ms.he_bss_color); - if (err) -- return err; -+ goto out; - } - - nl80211_calculate_ap_params(¶ms); -diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c -index 509290f2efa8..0e53f6f31916 100644 ---- a/sound/core/compress_offload.c -+++ b/sound/core/compress_offload.c -@@ -764,6 +764,9 @@ static int snd_compr_stop(struct snd_compr_stream *stream) - - retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP); - if (!retval) { -+ /* clear flags and stop any drain wait */ -+ stream->partial_drain = false; -+ stream->metadata_set = false; - snd_compr_drain_notify(stream); - stream->runtime->total_bytes_available = 0; - stream->runtime->total_bytes_transferred = 0; -@@ -921,6 +924,7 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream) - if (stream->next_track == false) - return -EPERM; - -+ stream->partial_drain = true; - retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_PARTIAL_DRAIN); - if (retval) { - pr_debug("Partial drain returned failure\n"); -diff --git a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c -index e69a4ef0d6bd..08c10ac9d6c8 100644 ---- a/sound/drivers/opl3/opl3_synth.c -+++ b/sound/drivers/opl3/opl3_synth.c -@@ -91,6 +91,8 @@ int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file, - { - struct snd_dm_fm_info info; - -+ memset(&info, 0, sizeof(info)); -+ - info.fm_mode = opl3->fm_mode; - info.rhythm = opl3->rhythm; - if (copy_to_user(argp, &info, sizeof(struct snd_dm_fm_info))) -diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c -index 2c6d2becfe1a..824f4ac1a8ce 100644 ---- a/sound/pci/hda/hda_auto_parser.c -+++ b/sound/pci/hda/hda_auto_parser.c -@@ -72,6 +72,12 @@ static int compare_input_type(const void *ap, const void *bp) - if (a->type != b->type) - return (int)(a->type - b->type); - -+ /* If has both hs_mic and hp_mic, pick the hs_mic ahead of hp_mic. */ -+ if (a->is_headset_mic && b->is_headphone_mic) -+ return -1; /* don't swap */ -+ else if (a->is_headphone_mic && b->is_headset_mic) -+ return 1; /* swap */ -+ - /* In case one has boost and the other one has not, - pick the one with boost first. */ - return (int)(b->has_boost_on_pin - a->has_boost_on_pin); -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c -index 41a03c61a74b..11ec5c56c80e 100644 ---- a/sound/pci/hda/hda_intel.c -+++ b/sound/pci/hda/hda_intel.c -@@ -2470,6 +2470,9 @@ static const struct pci_device_id azx_ids[] = { - /* Icelake */ - { PCI_DEVICE(0x8086, 0x34c8), - .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, -+ /* Icelake-H */ -+ { PCI_DEVICE(0x8086, 0x3dc8), -+ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, - /* Jasperlake */ - { PCI_DEVICE(0x8086, 0x38c8), - .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, -@@ -2478,9 +2481,14 @@ static const struct pci_device_id azx_ids[] = { - /* Tigerlake */ - { PCI_DEVICE(0x8086, 0xa0c8), - .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, -+ /* Tigerlake-H */ -+ { PCI_DEVICE(0x8086, 0x43c8), -+ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, - /* Elkhart Lake */ - { PCI_DEVICE(0x8086, 0x4b55), - .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, -+ { PCI_DEVICE(0x8086, 0x4b58), -+ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, - /* Broxton-P(Apollolake) */ - { PCI_DEVICE(0x8086, 0x5a98), - .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON }, -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index cb689878ba20..16ecc8515db8 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -6114,6 +6114,9 @@ enum { - ALC236_FIXUP_HP_MUTE_LED, - ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, - ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, -+ ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS, -+ ALC269VC_FIXUP_ACER_HEADSET_MIC, -+ ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE, - }; - - static const struct hda_fixup alc269_fixups[] = { -@@ -7292,6 +7295,35 @@ static const struct hda_fixup alc269_fixups[] = { - .chained = true, - .chain_id = ALC269_FIXUP_HEADSET_MODE - }, -+ [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ { 0x14, 0x90100120 }, /* use as internal speaker */ -+ { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */ -+ { 0x1a, 0x01011020 }, /* use as line out */ -+ { }, -+ }, -+ .chained = true, -+ .chain_id = ALC269_FIXUP_HEADSET_MIC -+ }, -+ [ALC269VC_FIXUP_ACER_HEADSET_MIC] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ { 0x18, 0x02a11030 }, /* use as headset mic */ -+ { } -+ }, -+ .chained = true, -+ .chain_id = ALC269_FIXUP_HEADSET_MIC -+ }, -+ [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */ -+ { } -+ }, -+ .chained = true, -+ .chain_id = ALC269_FIXUP_HEADSET_MIC -+ }, - }; - - static const struct snd_pci_quirk alc269_fixup_tbl[] = { -@@ -7307,10 +7339,13 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), - SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), - SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), -+ SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC), - SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK), - SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK), -+ SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS), -+ SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), - SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), - SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), -@@ -7536,8 +7571,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), - SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), - SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), -- SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK), -- SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK), -+ SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK), - SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK), - SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), - SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), -diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c -index de003acb1951..473efe9ef998 100644 ---- a/sound/soc/codecs/hdac_hda.c -+++ b/sound/soc/codecs/hdac_hda.c -@@ -441,13 +441,13 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) - ret = snd_hda_codec_set_name(hcodec, hcodec->preset->name); - if (ret < 0) { - dev_err(&hdev->dev, "name failed %s\n", hcodec->preset->name); -- goto error; -+ goto error_pm; - } - - ret = snd_hdac_regmap_init(&hcodec->core); - if (ret < 0) { - dev_err(&hdev->dev, "regmap init failed\n"); -- goto error; -+ goto error_pm; - } - - patch = (hda_codec_patch_t)hcodec->preset->driver_data; -@@ -455,7 +455,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) - ret = patch(hcodec); - if (ret < 0) { - dev_err(&hdev->dev, "patch failed %d\n", ret); -- goto error; -+ goto error_regmap; - } - } else { - dev_dbg(&hdev->dev, "no patch file found\n"); -@@ -467,7 +467,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) - ret = snd_hda_codec_parse_pcms(hcodec); - if (ret < 0) { - dev_err(&hdev->dev, "unable to map pcms to dai %d\n", ret); -- goto error; -+ goto error_regmap; - } - - /* HDMI controls need to be created in machine drivers */ -@@ -476,7 +476,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) - if (ret < 0) { - dev_err(&hdev->dev, "unable to create controls %d\n", - ret); -- goto error; -+ goto error_regmap; - } - } - -@@ -496,7 +496,9 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) - - return 0; - --error: -+error_regmap: -+ snd_hdac_regmap_exit(hdev); -+error_pm: - pm_runtime_put(&hdev->dev); - error_no_pm: - snd_hdac_ext_bus_link_put(hdev->bus, hlink); -@@ -518,6 +520,8 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component) - - pm_runtime_disable(&hdev->dev); - snd_hdac_ext_bus_link_put(hdev->bus, hlink); -+ -+ snd_hdac_regmap_exit(hdev); - } - - static const struct snd_soc_dapm_route hdac_hda_dapm_routes[] = { -diff --git a/sound/soc/fsl/fsl_mqs.c b/sound/soc/fsl/fsl_mqs.c -index 0c813a45bba7..69aeb0e71844 100644 ---- a/sound/soc/fsl/fsl_mqs.c -+++ b/sound/soc/fsl/fsl_mqs.c -@@ -265,12 +265,20 @@ static int fsl_mqs_remove(struct platform_device *pdev) - static int fsl_mqs_runtime_resume(struct device *dev) - { - struct fsl_mqs *mqs_priv = dev_get_drvdata(dev); -+ int ret; - -- if (mqs_priv->ipg) -- clk_prepare_enable(mqs_priv->ipg); -+ ret = clk_prepare_enable(mqs_priv->ipg); -+ if (ret) { -+ dev_err(dev, "failed to enable ipg clock\n"); -+ return ret; -+ } - -- if (mqs_priv->mclk) -- clk_prepare_enable(mqs_priv->mclk); -+ ret = clk_prepare_enable(mqs_priv->mclk); -+ if (ret) { -+ dev_err(dev, "failed to enable mclk clock\n"); -+ clk_disable_unprepare(mqs_priv->ipg); -+ return ret; -+ } - - if (mqs_priv->use_gpr) - regmap_write(mqs_priv->regmap, IOMUXC_GPR2, -@@ -292,11 +300,8 @@ static int fsl_mqs_runtime_suspend(struct device *dev) - regmap_read(mqs_priv->regmap, REG_MQS_CTRL, - &mqs_priv->reg_mqs_ctrl); - -- if (mqs_priv->mclk) -- clk_disable_unprepare(mqs_priv->mclk); -- -- if (mqs_priv->ipg) -- clk_disable_unprepare(mqs_priv->ipg); -+ clk_disable_unprepare(mqs_priv->mclk); -+ clk_disable_unprepare(mqs_priv->ipg); - - return 0; - } -diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c -index cec631a1389b..7b1846aeadd5 100644 ---- a/sound/soc/sof/sof-pci-dev.c -+++ b/sound/soc/sof/sof-pci-dev.c -@@ -427,6 +427,8 @@ static const struct pci_device_id sof_pci_ids[] = { - #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_H) - { PCI_DEVICE(0x8086, 0x06c8), - .driver_data = (unsigned long)&cml_desc}, -+ { PCI_DEVICE(0x8086, 0xa3f0), /* CML-S */ -+ .driver_data = (unsigned long)&cml_desc}, - #endif - #if IS_ENABLED(CONFIG_SND_SOC_SOF_TIGERLAKE) - { PCI_DEVICE(0x8086, 0xa0c8), -diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c -index c73efdf7545e..9702c4311b91 100644 ---- a/sound/usb/pcm.c -+++ b/sound/usb/pcm.c -@@ -368,6 +368,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, - goto add_sync_ep_from_ifnum; - case USB_ID(0x07fd, 0x0008): /* MOTU M Series */ - case USB_ID(0x31e9, 0x0002): /* Solid State Logic SSL2+ */ -+ case USB_ID(0x0d9a, 0x00df): /* RTX6001 */ - ep = 0x81; - ifnum = 2; - goto add_sync_ep_from_ifnum; -diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h -index 0bf370d89556..562179492a33 100644 ---- a/sound/usb/quirks-table.h -+++ b/sound/usb/quirks-table.h -@@ -3611,4 +3611,56 @@ ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* Asrock TRX40 Creator */ - } - }, - -+/* -+ * MacroSilicon MS2109 based HDMI capture cards -+ * -+ * These claim 96kHz 1ch in the descriptors, but are actually 48kHz 2ch. -+ * They also need QUIRK_AUDIO_ALIGN_TRANSFER, which makes one wonder if -+ * they pretend to be 96kHz mono as a workaround for stereo being broken -+ * by that... -+ * -+ * They also have swapped L-R channels, but that's for userspace to deal -+ * with. -+ */ -+{ -+ USB_DEVICE(0x534d, 0x2109), -+ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { -+ .vendor_name = "MacroSilicon", -+ .product_name = "MS2109", -+ .ifnum = QUIRK_ANY_INTERFACE, -+ .type = QUIRK_COMPOSITE, -+ .data = &(const struct snd_usb_audio_quirk[]) { -+ { -+ .ifnum = 2, -+ .type = QUIRK_AUDIO_ALIGN_TRANSFER, -+ }, -+ { -+ .ifnum = 2, -+ .type = QUIRK_AUDIO_STANDARD_MIXER, -+ }, -+ { -+ .ifnum = 3, -+ .type = QUIRK_AUDIO_FIXED_ENDPOINT, -+ .data = &(const struct audioformat) { -+ .formats = SNDRV_PCM_FMTBIT_S16_LE, -+ .channels = 2, -+ .iface = 3, -+ .altsetting = 1, -+ .altset_idx = 1, -+ .attributes = 0, -+ .endpoint = 0x82, -+ .ep_attr = USB_ENDPOINT_XFER_ISOC | -+ USB_ENDPOINT_SYNC_ASYNC, -+ .rates = SNDRV_PCM_RATE_CONTINUOUS, -+ .rate_min = 48000, -+ .rate_max = 48000, -+ } -+ }, -+ { -+ .ifnum = -1 -+ } -+ } -+ } -+}, -+ - #undef USB_DEVICE_VENDOR_SPEC -diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c -index 1643aed8c4c8..2a548fbdf2a2 100644 ---- a/tools/perf/arch/x86/util/intel-pt.c -+++ b/tools/perf/arch/x86/util/intel-pt.c -@@ -634,6 +634,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, - } - evsel->core.attr.freq = 0; - evsel->core.attr.sample_period = 1; -+ evsel->no_aux_samples = true; - intel_pt_evsel = evsel; - opts->full_auxtrace = true; - } -diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py -index 7bd73a904b4e..d187e46c2683 100644 ---- a/tools/perf/scripts/python/export-to-postgresql.py -+++ b/tools/perf/scripts/python/export-to-postgresql.py -@@ -1055,7 +1055,7 @@ def cbr(id, raw_buf): - cbr = data[0] - MHz = (data[4] + 500) / 1000 - percent = ((cbr * 1000 / data[2]) + 5) / 10 -- value = struct.pack("!hiqiiiiii", 4, 8, id, 4, cbr, 4, MHz, 4, percent) -+ value = struct.pack("!hiqiiiiii", 4, 8, id, 4, cbr, 4, int(MHz), 4, int(percent)) - cbr_file.write(value) - - def mwait(id, raw_buf): -diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py -index 26d7be785288..7daa8bb70a5a 100755 ---- a/tools/perf/scripts/python/exported-sql-viewer.py -+++ b/tools/perf/scripts/python/exported-sql-viewer.py -@@ -768,7 +768,8 @@ class CallGraphModel(CallGraphModelBase): - " FROM calls" - " INNER JOIN call_paths ON calls.call_path_id = call_paths.id" - " INNER JOIN symbols ON call_paths.symbol_id = symbols.id" -- " WHERE symbols.name" + match + -+ " WHERE calls.id <> 0" -+ " AND symbols.name" + match + - " GROUP BY comm_id, thread_id, call_path_id" - " ORDER BY comm_id, thread_id, call_path_id") - -@@ -963,7 +964,8 @@ class CallTreeModel(CallGraphModelBase): - " FROM calls" - " INNER JOIN call_paths ON calls.call_path_id = call_paths.id" - " INNER JOIN symbols ON call_paths.symbol_id = symbols.id" -- " WHERE symbols.name" + match + -+ " WHERE calls.id <> 0" -+ " AND symbols.name" + match + - " ORDER BY comm_id, thread_id, call_time, calls.id") - - def FindPath(self, query): -@@ -1050,6 +1052,7 @@ class TreeWindowBase(QMdiSubWindow): - child = self.model.index(row, 0, parent) - if child.internalPointer().dbid == dbid: - found = True -+ self.view.setExpanded(parent, True) - self.view.setCurrentIndex(child) - parent = child - break -@@ -1127,6 +1130,7 @@ class CallTreeWindow(TreeWindowBase): - child = self.model.index(row, 0, parent) - if child.internalPointer().dbid == dbid: - found = True -+ self.view.setExpanded(parent, True) - self.view.setCurrentIndex(child) - parent = child - break -@@ -1139,6 +1143,7 @@ class CallTreeWindow(TreeWindowBase): - return - last_child = None - for row in xrange(n): -+ self.view.setExpanded(parent, True) - child = self.model.index(row, 0, parent) - child_call_time = child.internalPointer().call_time - if child_call_time < time: -@@ -1151,9 +1156,11 @@ class CallTreeWindow(TreeWindowBase): - if not last_child: - if not found: - child = self.model.index(0, 0, parent) -+ self.view.setExpanded(parent, True) - self.view.setCurrentIndex(child) - return - found = True -+ self.view.setExpanded(parent, True) - self.view.setCurrentIndex(last_child) - parent = last_child - -diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c -index 487e54ef56a9..2101b6b770d8 100644 ---- a/tools/perf/ui/browsers/hists.c -+++ b/tools/perf/ui/browsers/hists.c -@@ -2288,6 +2288,11 @@ static struct thread *hist_browser__selected_thread(struct hist_browser *browser - return browser->he_selection->thread; - } - -+static struct res_sample *hist_browser__selected_res_sample(struct hist_browser *browser) -+{ -+ return browser->he_selection ? browser->he_selection->res_samples : NULL; -+} -+ - /* Check whether the browser is for 'top' or 'report' */ - static inline bool is_report_browser(void *timer) - { -@@ -3357,16 +3362,16 @@ skip_annotation: - &options[nr_options], NULL, NULL, evsel); - nr_options += add_res_sample_opt(browser, &actions[nr_options], - &options[nr_options], -- hist_browser__selected_entry(browser)->res_samples, -- evsel, A_NORMAL); -+ hist_browser__selected_res_sample(browser), -+ evsel, A_NORMAL); - nr_options += add_res_sample_opt(browser, &actions[nr_options], - &options[nr_options], -- hist_browser__selected_entry(browser)->res_samples, -- evsel, A_ASM); -+ hist_browser__selected_res_sample(browser), -+ evsel, A_ASM); - nr_options += add_res_sample_opt(browser, &actions[nr_options], - &options[nr_options], -- hist_browser__selected_entry(browser)->res_samples, -- evsel, A_SOURCE); -+ hist_browser__selected_res_sample(browser), -+ evsel, A_SOURCE); - nr_options += add_switch_opt(browser, &actions[nr_options], - &options[nr_options]); - skip_scripting: -diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c -index eb880efbce16..386950f29792 100644 ---- a/tools/perf/util/evsel.c -+++ b/tools/perf/util/evsel.c -@@ -1048,12 +1048,12 @@ void perf_evsel__config(struct evsel *evsel, struct record_opts *opts, - if (callchain && callchain->enabled && !evsel->no_aux_samples) - perf_evsel__config_callchain(evsel, opts, callchain); - -- if (opts->sample_intr_regs) { -+ if (opts->sample_intr_regs && !evsel->no_aux_samples) { - attr->sample_regs_intr = opts->sample_intr_regs; - perf_evsel__set_sample_bit(evsel, REGS_INTR); - } - -- if (opts->sample_user_regs) { -+ if (opts->sample_user_regs && !evsel->no_aux_samples) { - attr->sample_regs_user |= opts->sample_user_regs; - perf_evsel__set_sample_bit(evsel, REGS_USER); - } -diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c -index 23c8289c2472..545d1cdc0ec8 100644 ---- a/tools/perf/util/intel-pt.c -+++ b/tools/perf/util/intel-pt.c -@@ -1731,6 +1731,7 @@ static int intel_pt_synth_pebs_sample(struct intel_pt_queue *ptq) - u64 sample_type = evsel->core.attr.sample_type; - u64 id = evsel->core.id[0]; - u8 cpumode; -+ u64 regs[8 * sizeof(sample.intr_regs.mask)]; - - if (intel_pt_skip_event(pt)) - return 0; -@@ -1780,8 +1781,8 @@ static int intel_pt_synth_pebs_sample(struct intel_pt_queue *ptq) - } - - if (sample_type & PERF_SAMPLE_REGS_INTR && -- items->mask[INTEL_PT_GP_REGS_POS]) { -- u64 regs[sizeof(sample.intr_regs.mask)]; -+ (items->mask[INTEL_PT_GP_REGS_POS] || -+ items->mask[INTEL_PT_XMM_POS])) { - u64 regs_mask = evsel->core.attr.sample_regs_intr; - u64 *pos; - -diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c -index c6766b2cff85..9990e91c18df 100644 ---- a/tools/testing/selftests/bpf/test_maps.c -+++ b/tools/testing/selftests/bpf/test_maps.c -@@ -789,19 +789,19 @@ static void test_sockmap(unsigned int tasks, void *data) - } - - err = bpf_prog_detach(fd, BPF_SK_SKB_STREAM_PARSER); -- if (err) { -+ if (!err) { - printf("Failed empty parser prog detach\n"); - goto out_sockmap; - } - - err = bpf_prog_detach(fd, BPF_SK_SKB_STREAM_VERDICT); -- if (err) { -+ if (!err) { - printf("Failed empty verdict prog detach\n"); - goto out_sockmap; - } - - err = bpf_prog_detach(fd, BPF_SK_MSG_VERDICT); -- if (err) { -+ if (!err) { - printf("Failed empty msg verdict prog detach\n"); - goto out_sockmap; - } -@@ -1090,19 +1090,19 @@ static void test_sockmap(unsigned int tasks, void *data) - assert(status == 0); - } - -- err = bpf_prog_detach(map_fd_rx, __MAX_BPF_ATTACH_TYPE); -+ err = bpf_prog_detach2(parse_prog, map_fd_rx, __MAX_BPF_ATTACH_TYPE); - if (!err) { - printf("Detached an invalid prog type.\n"); - goto out_sockmap; - } - -- err = bpf_prog_detach(map_fd_rx, BPF_SK_SKB_STREAM_PARSER); -+ err = bpf_prog_detach2(parse_prog, map_fd_rx, BPF_SK_SKB_STREAM_PARSER); - if (err) { - printf("Failed parser prog detach\n"); - goto out_sockmap; - } - -- err = bpf_prog_detach(map_fd_rx, BPF_SK_SKB_STREAM_VERDICT); -+ err = bpf_prog_detach2(verdict_prog, map_fd_rx, BPF_SK_SKB_STREAM_VERDICT); - if (err) { - printf("Failed parser prog detach\n"); - goto out_sockmap; -diff --git a/virt/kvm/arm/vgic/vgic-v4.c b/virt/kvm/arm/vgic/vgic-v4.c -index 27ac833e5ec7..b5fa73c9fd35 100644 ---- a/virt/kvm/arm/vgic/vgic-v4.c -+++ b/virt/kvm/arm/vgic/vgic-v4.c -@@ -90,7 +90,15 @@ static irqreturn_t vgic_v4_doorbell_handler(int irq, void *info) - !irqd_irq_disabled(&irq_to_desc(irq)->irq_data)) - disable_irq_nosync(irq); - -+ /* -+ * The v4.1 doorbell can fire concurrently with the vPE being -+ * made non-resident. Ensure we only update pending_last -+ * *after* the non-residency sequence has completed. -+ */ -+ raw_spin_lock(&vcpu->arch.vgic_cpu.vgic_v3.its_vpe.vpe_lock); - vcpu->arch.vgic_cpu.vgic_v3.its_vpe.pending_last = true; -+ raw_spin_unlock(&vcpu->arch.vgic_cpu.vgic_v3.its_vpe.vpe_lock); -+ - kvm_make_request(KVM_REQ_IRQ_PENDING, vcpu); - kvm_vcpu_kick(vcpu); - diff --git a/patch/kernel/sunxi-current/patch2-5.7.9-10.modified.patch b/patch/kernel/sunxi-current/patch2-5.7.9-10.modified.patch deleted file mode 100644 index be2bc535d1..0000000000 --- a/patch/kernel/sunxi-current/patch2-5.7.9-10.modified.patch +++ /dev/null @@ -1,9109 +0,0 @@ -diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/silicon-errata.rst -index 2c08c628febd..7dc8f8ac69ee 100644 ---- a/Documentation/arm64/silicon-errata.rst -+++ b/Documentation/arm64/silicon-errata.rst -@@ -147,6 +147,14 @@ stable kernels. - +----------------+-----------------+-----------------+-----------------------------+ - | Qualcomm Tech. | Falkor v{1,2} | E1041 | QCOM_FALKOR_ERRATUM_1041 | - +----------------+-----------------+-----------------+-----------------------------+ -+| Qualcomm Tech. | Kryo4xx Gold | N/A | ARM64_ERRATUM_1463225 | -++----------------+-----------------+-----------------+-----------------------------+ -+| Qualcomm Tech. | Kryo4xx Gold | N/A | ARM64_ERRATUM_1418040 | -++----------------+-----------------+-----------------+-----------------------------+ -+| Qualcomm Tech. | Kryo4xx Silver | N/A | ARM64_ERRATUM_1530923 | -++----------------+-----------------+-----------------+-----------------------------+ -+| Qualcomm Tech. | Kryo4xx Silver | N/A | ARM64_ERRATUM_1024718 | -++----------------+-----------------+-----------------+-----------------------------+ - +----------------+-----------------+-----------------+-----------------------------+ - | Fujitsu | A64FX | E#010001 | FUJITSU_ERRATUM_010001 | - +----------------+-----------------+-----------------+-----------------------------+ -diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile -index 7782d9985082..b03d58c6b072 100644 ---- a/Documentation/devicetree/bindings/Makefile -+++ b/Documentation/devicetree/bindings/Makefile -@@ -45,3 +45,8 @@ $(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE - $(call if_changed,mk_schema) - - extra-y += processed-schema.yaml -+ -+# Hack: avoid 'Argument list too long' error for 'make clean'. Remove most of -+# build artifacts here before they are processed by scripts/Makefile.clean -+clean-files = $(shell find $(obj) \( -name '*.example.dts' -o \ -+ -name '*.example.dt.yaml' \) -delete 2>/dev/null) -diff --git a/Documentation/devicetree/bindings/bus/socionext,uniphier-system-bus.yaml b/Documentation/devicetree/bindings/bus/socionext,uniphier-system-bus.yaml -index c4c9119e4a20..a0c6c5d2b70f 100644 ---- a/Documentation/devicetree/bindings/bus/socionext,uniphier-system-bus.yaml -+++ b/Documentation/devicetree/bindings/bus/socionext,uniphier-system-bus.yaml -@@ -80,14 +80,14 @@ examples: - ranges = <1 0x00000000 0x42000000 0x02000000>, - <5 0x00000000 0x46000000 0x01000000>; - -- ethernet@1,01f00000 { -+ ethernet@1,1f00000 { - compatible = "smsc,lan9115"; - reg = <1 0x01f00000 0x1000>; - interrupts = <0 48 4>; - phy-mode = "mii"; - }; - -- uart@5,00200000 { -+ serial@5,200000 { - compatible = "ns16550a"; - reg = <5 0x00200000 0x20>; - interrupts = <0 49 4>; -diff --git a/Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt b/Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt -index 4438432bfe9b..ad76edccf881 100644 ---- a/Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt -+++ b/Documentation/devicetree/bindings/mailbox/xlnx,zynqmp-ipi-mailbox.txt -@@ -87,7 +87,7 @@ Example: - ranges; - - /* APU<->RPU0 IPI mailbox controller */ -- ipi_mailbox_rpu0: mailbox@ff90400 { -+ ipi_mailbox_rpu0: mailbox@ff990400 { - reg = <0xff990400 0x20>, - <0xff990420 0x20>, - <0xff990080 0x20>, -diff --git a/Makefile b/Makefile -index fb3a747575b5..e622e084e7e2 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 7 --SUBLEVEL = 9 -+SUBLEVEL = 10 - EXTRAVERSION = - NAME = Kleptomaniac Octopus - -diff --git a/arch/arm/boot/dts/am437x-l4.dtsi b/arch/arm/boot/dts/am437x-l4.dtsi -index 49c6a872052e..e30089e96263 100644 ---- a/arch/arm/boot/dts/am437x-l4.dtsi -+++ b/arch/arm/boot/dts/am437x-l4.dtsi -@@ -1544,8 +1544,9 @@ - reg = <0xcc020 0x4>; - reg-names = "rev"; - /* Domains (P, C): per_pwrdm, l4ls_clkdm */ -- clocks = <&l4ls_clkctrl AM4_L4LS_D_CAN0_CLKCTRL 0>; -- clock-names = "fck"; -+ clocks = <&l4ls_clkctrl AM4_L4LS_D_CAN0_CLKCTRL 0>, -+ <&dcan0_fck>; -+ clock-names = "fck", "osc"; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0xcc000 0x2000>; -@@ -1553,6 +1554,8 @@ - dcan0: can@0 { - compatible = "ti,am4372-d_can", "ti,am3352-d_can"; - reg = <0x0 0x2000>; -+ clocks = <&dcan0_fck>; -+ clock-names = "fck"; - syscon-raminit = <&scm_conf 0x644 0>; - interrupts = ; - status = "disabled"; -@@ -1564,8 +1567,9 @@ - reg = <0xd0020 0x4>; - reg-names = "rev"; - /* Domains (P, C): per_pwrdm, l4ls_clkdm */ -- clocks = <&l4ls_clkctrl AM4_L4LS_D_CAN1_CLKCTRL 0>; -- clock-names = "fck"; -+ clocks = <&l4ls_clkctrl AM4_L4LS_D_CAN1_CLKCTRL 0>, -+ <&dcan1_fck>; -+ clock-names = "fck", "osc"; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0xd0000 0x2000>; -@@ -1573,6 +1577,8 @@ - dcan1: can@0 { - compatible = "ti,am4372-d_can", "ti,am3352-d_can"; - reg = <0x0 0x2000>; -+ clocks = <&dcan1_fck>; -+ clock-name = "fck"; - syscon-raminit = <&scm_conf 0x644 1>; - interrupts = ; - status = "disabled"; -diff --git a/arch/arm/boot/dts/imx6qdl-gw551x.dtsi b/arch/arm/boot/dts/imx6qdl-gw551x.dtsi -index c38e86eedcc0..8c33510c9519 100644 ---- a/arch/arm/boot/dts/imx6qdl-gw551x.dtsi -+++ b/arch/arm/boot/dts/imx6qdl-gw551x.dtsi -@@ -110,7 +110,7 @@ - simple-audio-card,frame-master = <&sound_codec>; - - sound_cpu: simple-audio-card,cpu { -- sound-dai = <&ssi2>; -+ sound-dai = <&ssi1>; - }; - - sound_codec: simple-audio-card,codec { -diff --git a/arch/arm/boot/dts/mt7623n-rfb-emmc.dts b/arch/arm/boot/dts/mt7623n-rfb-emmc.dts -index b7606130ade9..0447748f9fa0 100644 ---- a/arch/arm/boot/dts/mt7623n-rfb-emmc.dts -+++ b/arch/arm/boot/dts/mt7623n-rfb-emmc.dts -@@ -138,6 +138,7 @@ - mac@1 { - compatible = "mediatek,eth-mac"; - reg = <1>; -+ phy-mode = "rgmii"; - phy-handle = <&phy5>; - }; - -diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi -index 4f3993cc0227..451030897220 100644 ---- a/arch/arm/boot/dts/socfpga.dtsi -+++ b/arch/arm/boot/dts/socfpga.dtsi -@@ -710,7 +710,7 @@ - }; - }; - -- L2: l2-cache@fffef000 { -+ L2: cache-controller@fffef000 { - compatible = "arm,pl310-cache"; - reg = <0xfffef000 0x1000>; - interrupts = <0 38 0x04>; -diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi -index 3b8571b8b412..8f614c4b0e3e 100644 ---- a/arch/arm/boot/dts/socfpga_arria10.dtsi -+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi -@@ -636,7 +636,7 @@ - reg = <0xffcfb100 0x80>; - }; - -- L2: l2-cache@fffff000 { -+ L2: cache-controller@fffff000 { - compatible = "arm,pl310-cache"; - reg = <0xfffff000 0x1000>; - interrupts = <0 18 IRQ_TYPE_LEVEL_HIGH>; -diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi -index d1fc9c2055f4..9498d1de730c 100644 ---- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi -+++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi -@@ -77,7 +77,7 @@ - method = "smc"; - }; - -- intc: intc@fffc1000 { -+ intc: interrupt-controller@fffc1000 { - compatible = "arm,gic-400", "arm,cortex-a15-gic"; - #interrupt-cells = <3>; - interrupt-controller; -@@ -302,7 +302,7 @@ - status = "disabled"; - }; - -- nand: nand@ffb90000 { -+ nand: nand-controller@ffb90000 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "altr,socfpga-denali-nand"; -@@ -445,7 +445,7 @@ - clock-names = "timer"; - }; - -- uart0: serial0@ffc02000 { -+ uart0: serial@ffc02000 { - compatible = "snps,dw-apb-uart"; - reg = <0xffc02000 0x100>; - interrupts = <0 108 4>; -@@ -456,7 +456,7 @@ - status = "disabled"; - }; - -- uart1: serial1@ffc02100 { -+ uart1: serial@ffc02100 { - compatible = "snps,dw-apb-uart"; - reg = <0xffc02100 0x100>; - interrupts = <0 109 4>; -diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts b/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts -index f6c4a15079d3..feadd21bc0dc 100644 ---- a/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts -+++ b/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts -@@ -155,6 +155,7 @@ - }; - - &qspi { -+ status = "okay"; - flash@0 { - #address-cells = <1>; - #size-cells = <1>; -diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk_nand.dts b/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk_nand.dts -index 9946515b8afd..c07966740e14 100644 ---- a/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk_nand.dts -+++ b/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk_nand.dts -@@ -188,6 +188,7 @@ - }; - - &qspi { -+ status = "okay"; - flash@0 { - #address-cells = <1>; - #size-cells = <1>; -@@ -211,12 +212,12 @@ - - qspi_boot: partition@0 { - label = "Boot and fpga data"; -- reg = <0x0 0x034B0000>; -+ reg = <0x0 0x03FE0000>; - }; - -- qspi_rootfs: partition@4000000 { -+ qspi_rootfs: partition@3FE0000 { - label = "Root Filesystem - JFFS2"; -- reg = <0x034B0000 0x0EB50000>; -+ reg = <0x03FE0000 0x0C020000>; - }; - }; - }; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts -index 4d5949496596..c6ae5622a532 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dts -@@ -9,7 +9,7 @@ - - #include - --#include "meson-gxl-s905x.dtsi" -+#include "meson-gxl-s805x.dtsi" - - / { - compatible = "libretech,aml-s805x-ac", "amlogic,s805x", -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-p241.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-p241.dts -index a1119cfb0280..85f78a945407 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-p241.dts -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x-p241.dts -@@ -9,7 +9,7 @@ - - #include - --#include "meson-gxl-s905x.dtsi" -+#include "meson-gxl-s805x.dtsi" - - / { - compatible = "amlogic,p241", "amlogic,s805x", "amlogic,meson-gxl"; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s805x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x.dtsi -new file mode 100644 -index 000000000000..f9d705648426 ---- /dev/null -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s805x.dtsi -@@ -0,0 +1,24 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2020 BayLibre SAS -+ * Author: Neil Armstrong -+ */ -+ -+#include "meson-gxl-s905x.dtsi" -+ -+/ { -+ compatible = "amlogic,s805x", "amlogic,meson-gxl"; -+}; -+ -+/* The S805X Package doesn't seem to handle the 744MHz OPP correctly */ -+&mali { -+ assigned-clocks = <&clkc CLKID_MALI_0_SEL>, -+ <&clkc CLKID_MALI_0>, -+ <&clkc CLKID_MALI>; /* Glitch free mux */ -+ assigned-clock-parents = <&clkc CLKID_FCLK_DIV3>, -+ <0>, /* Do Nothing */ -+ <&clkc CLKID_MALI_0>; -+ assigned-clock-rates = <0>, /* Do Nothing */ -+ <666666666>, -+ <0>; /* Do Nothing */ -+}; -diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi -index 259d86399390..887c43119e63 100644 ---- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi -+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi -@@ -298,6 +298,11 @@ - }; - }; - -+&hwrng { -+ clocks = <&clkc CLKID_RNG0>; -+ clock-names = "core"; -+}; -+ - &i2c_A { - clocks = <&clkc CLKID_I2C>; - }; -diff --git a/arch/arm64/boot/dts/intel/socfpga_agilex_socdk.dts b/arch/arm64/boot/dts/intel/socfpga_agilex_socdk.dts -index 51d948323bfd..92f478def723 100644 ---- a/arch/arm64/boot/dts/intel/socfpga_agilex_socdk.dts -+++ b/arch/arm64/boot/dts/intel/socfpga_agilex_socdk.dts -@@ -98,6 +98,7 @@ - }; - - &qspi { -+ status = "okay"; - flash@0 { - #address-cells = <1>; - #size-cells = <1>; -diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h -index 5e5dc05d63a0..12f0eb56a1cc 100644 ---- a/arch/arm64/include/asm/alternative.h -+++ b/arch/arm64/include/asm/alternative.h -@@ -73,11 +73,11 @@ static inline void apply_alternatives_module(void *start, size_t length) { } - ".pushsection .altinstructions,\"a\"\n" \ - ALTINSTR_ENTRY(feature) \ - ".popsection\n" \ -- ".pushsection .altinstr_replacement, \"a\"\n" \ -+ ".subsection 1\n" \ - "663:\n\t" \ - newinstr "\n" \ - "664:\n\t" \ -- ".popsection\n\t" \ -+ ".previous\n\t" \ - ".org . - (664b-663b) + (662b-661b)\n\t" \ - ".org . - (662b-661b) + (664b-663b)\n" \ - ".endif\n" -@@ -117,9 +117,9 @@ static inline void apply_alternatives_module(void *start, size_t length) { } - 662: .pushsection .altinstructions, "a" - altinstruction_entry 661b, 663f, \cap, 662b-661b, 664f-663f - .popsection -- .pushsection .altinstr_replacement, "ax" -+ .subsection 1 - 663: \insn2 --664: .popsection -+664: .previous - .org . - (664b-663b) + (662b-661b) - .org . - (662b-661b) + (664b-663b) - .endif -@@ -160,7 +160,7 @@ static inline void apply_alternatives_module(void *start, size_t length) { } - .pushsection .altinstructions, "a" - altinstruction_entry 663f, 661f, \cap, 664f-663f, 662f-661f - .popsection -- .pushsection .altinstr_replacement, "ax" -+ .subsection 1 - .align 2 /* So GAS knows label 661 is suitably aligned */ - 661: - .endm -@@ -179,9 +179,9 @@ static inline void apply_alternatives_module(void *start, size_t length) { } - .macro alternative_else - 662: - .if .Lasm_alt_mode==0 -- .pushsection .altinstr_replacement, "ax" -+ .subsection 1 - .else -- .popsection -+ .previous - .endif - 663: - .endm -@@ -192,7 +192,7 @@ static inline void apply_alternatives_module(void *start, size_t length) { } - .macro alternative_endif - 664: - .if .Lasm_alt_mode==0 -- .popsection -+ .previous - .endif - .org . - (664b-663b) + (662b-661b) - .org . - (662b-661b) + (664b-663b) -diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h -index a87a93f67671..7219cddeba66 100644 ---- a/arch/arm64/include/asm/cputype.h -+++ b/arch/arm64/include/asm/cputype.h -@@ -86,6 +86,7 @@ - #define QCOM_CPU_PART_FALKOR 0xC00 - #define QCOM_CPU_PART_KRYO 0x200 - #define QCOM_CPU_PART_KRYO_3XX_SILVER 0x803 -+#define QCOM_CPU_PART_KRYO_4XX_GOLD 0x804 - #define QCOM_CPU_PART_KRYO_4XX_SILVER 0x805 - - #define NVIDIA_CPU_PART_DENVER 0x003 -@@ -114,6 +115,7 @@ - #define MIDR_QCOM_FALKOR MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR) - #define MIDR_QCOM_KRYO MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO) - #define MIDR_QCOM_KRYO_3XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_SILVER) -+#define MIDR_QCOM_KRYO_4XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_GOLD) - #define MIDR_QCOM_KRYO_4XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_SILVER) - #define MIDR_NVIDIA_DENVER MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_DENVER) - #define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL) -diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h -index 7619f473155f..d825e3585e28 100644 ---- a/arch/arm64/include/asm/debug-monitors.h -+++ b/arch/arm64/include/asm/debug-monitors.h -@@ -109,6 +109,8 @@ void disable_debug_monitors(enum dbg_active_el el); - - void user_rewind_single_step(struct task_struct *task); - void user_fastforward_single_step(struct task_struct *task); -+void user_regs_reset_single_step(struct user_pt_regs *regs, -+ struct task_struct *task); - - void kernel_enable_single_step(struct pt_regs *regs); - void kernel_disable_single_step(void); -diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h -index 65299a2dcf9c..cfc0672013f6 100644 ---- a/arch/arm64/include/asm/syscall.h -+++ b/arch/arm64/include/asm/syscall.h -@@ -34,6 +34,10 @@ static inline long syscall_get_error(struct task_struct *task, - struct pt_regs *regs) - { - unsigned long error = regs->regs[0]; -+ -+ if (is_compat_thread(task_thread_info(task))) -+ error = sign_extend64(error, 31); -+ - return IS_ERR_VALUE(error) ? error : 0; - } - -@@ -47,7 +51,13 @@ static inline void syscall_set_return_value(struct task_struct *task, - struct pt_regs *regs, - int error, long val) - { -- regs->regs[0] = (long) error ? error : val; -+ if (error) -+ val = error; -+ -+ if (is_compat_thread(task_thread_info(task))) -+ val = lower_32_bits(val); -+ -+ regs->regs[0] = val; - } - - #define SYSCALL_MAX_ARGS 6 -diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h -index 512174a8e789..62aca2a50ad7 100644 ---- a/arch/arm64/include/asm/thread_info.h -+++ b/arch/arm64/include/asm/thread_info.h -@@ -89,6 +89,7 @@ void arch_release_task_struct(struct task_struct *tsk); - #define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU) - #define _TIF_UPROBE (1 << TIF_UPROBE) - #define _TIF_FSCHECK (1 << TIF_FSCHECK) -+#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) - #define _TIF_32BIT (1 << TIF_32BIT) - #define _TIF_SVE (1 << TIF_SVE) - -diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c -index d1757ef1b1e7..73039949b5ce 100644 ---- a/arch/arm64/kernel/alternative.c -+++ b/arch/arm64/kernel/alternative.c -@@ -43,20 +43,8 @@ bool alternative_is_applied(u16 cpufeature) - */ - static bool branch_insn_requires_update(struct alt_instr *alt, unsigned long pc) - { -- unsigned long replptr; -- -- if (kernel_text_address(pc)) -- return true; -- -- replptr = (unsigned long)ALT_REPL_PTR(alt); -- if (pc >= replptr && pc <= (replptr + alt->alt_len)) -- return false; -- -- /* -- * Branching into *another* alternate sequence is doomed, and -- * we're not even trying to fix it up. -- */ -- BUG(); -+ unsigned long replptr = (unsigned long)ALT_REPL_PTR(alt); -+ return !(pc >= replptr && pc <= (replptr + alt->alt_len)); - } - - #define align_down(x, a) ((unsigned long)(x) & ~(((unsigned long)(a)) - 1)) -diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c -index 0f37045fafab..f9387c125232 100644 ---- a/arch/arm64/kernel/cpu_errata.c -+++ b/arch/arm64/kernel/cpu_errata.c -@@ -472,12 +472,7 @@ static bool - has_cortex_a76_erratum_1463225(const struct arm64_cpu_capabilities *entry, - int scope) - { -- u32 midr = read_cpuid_id(); -- /* Cortex-A76 r0p0 - r3p1 */ -- struct midr_range range = MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 1); -- -- WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible()); -- return is_midr_in_range(midr, &range) && is_kernel_in_hyp_mode(); -+ return is_affected_midr_range_list(entry, scope) && is_kernel_in_hyp_mode(); - } - #endif - -@@ -728,6 +723,8 @@ static const struct midr_range erratum_1418040_list[] = { - MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 1), - /* Neoverse-N1 r0p0 to r3p1 */ - MIDR_RANGE(MIDR_NEOVERSE_N1, 0, 0, 3, 1), -+ /* Kryo4xx Gold (rcpe to rfpf) => (r0p0 to r3p1) */ -+ MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xf), - {}, - }; - #endif -@@ -768,11 +765,23 @@ static const struct midr_range erratum_speculative_at_vhe_list[] = { - #ifdef CONFIG_ARM64_ERRATUM_1530923 - /* Cortex A55 r0p0 to r2p0 */ - MIDR_RANGE(MIDR_CORTEX_A55, 0, 0, 2, 0), -+ /* Kryo4xx Silver (rdpe => r1p0) */ -+ MIDR_REV(MIDR_QCOM_KRYO_4XX_SILVER, 0xd, 0xe), - #endif - {}, - }; - #endif - -+#ifdef CONFIG_ARM64_ERRATUM_1463225 -+static const struct midr_range erratum_1463225[] = { -+ /* Cortex-A76 r0p0 - r3p1 */ -+ MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 1), -+ /* Kryo4xx Gold (rcpe to rfpf) => (r0p0 to r3p1) */ -+ MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xf), -+ {}, -+}; -+#endif -+ - const struct arm64_cpu_capabilities arm64_errata[] = { - #ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE - { -@@ -912,6 +921,7 @@ const struct arm64_cpu_capabilities arm64_errata[] = { - .capability = ARM64_WORKAROUND_1463225, - .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, - .matches = has_cortex_a76_erratum_1463225, -+ .midr_range_list = erratum_1463225, - }, - #endif - #ifdef CONFIG_CAVIUM_TX2_ERRATUM_219 -diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c -index b0fb1d5bf223..cadc9d9a7477 100644 ---- a/arch/arm64/kernel/cpufeature.c -+++ b/arch/arm64/kernel/cpufeature.c -@@ -1177,6 +1177,8 @@ static bool cpu_has_broken_dbm(void) - static const struct midr_range cpus[] = { - #ifdef CONFIG_ARM64_ERRATUM_1024718 - MIDR_RANGE(MIDR_CORTEX_A55, 0, 0, 1, 0), // A55 r0p0 -r1p0 -+ /* Kryo4xx Silver (rdpe => r1p0) */ -+ MIDR_REV(MIDR_QCOM_KRYO_4XX_SILVER, 0xd, 0xe), - #endif - {}, - }; -diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c -index 48222a4760c2..7569deb1eac1 100644 ---- a/arch/arm64/kernel/debug-monitors.c -+++ b/arch/arm64/kernel/debug-monitors.c -@@ -141,17 +141,20 @@ postcore_initcall(debug_monitors_init); - /* - * Single step API and exception handling. - */ --static void set_regs_spsr_ss(struct pt_regs *regs) -+static void set_user_regs_spsr_ss(struct user_pt_regs *regs) - { - regs->pstate |= DBG_SPSR_SS; - } --NOKPROBE_SYMBOL(set_regs_spsr_ss); -+NOKPROBE_SYMBOL(set_user_regs_spsr_ss); - --static void clear_regs_spsr_ss(struct pt_regs *regs) -+static void clear_user_regs_spsr_ss(struct user_pt_regs *regs) - { - regs->pstate &= ~DBG_SPSR_SS; - } --NOKPROBE_SYMBOL(clear_regs_spsr_ss); -+NOKPROBE_SYMBOL(clear_user_regs_spsr_ss); -+ -+#define set_regs_spsr_ss(r) set_user_regs_spsr_ss(&(r)->user_regs) -+#define clear_regs_spsr_ss(r) clear_user_regs_spsr_ss(&(r)->user_regs) - - static DEFINE_SPINLOCK(debug_hook_lock); - static LIST_HEAD(user_step_hook); -@@ -404,6 +407,15 @@ void user_fastforward_single_step(struct task_struct *task) - clear_regs_spsr_ss(task_pt_regs(task)); - } - -+void user_regs_reset_single_step(struct user_pt_regs *regs, -+ struct task_struct *task) -+{ -+ if (test_tsk_thread_flag(task, TIF_SINGLESTEP)) -+ set_user_regs_spsr_ss(regs); -+ else -+ clear_user_regs_spsr_ss(regs); -+} -+ - /* Kernel API */ - void kernel_enable_single_step(struct pt_regs *regs) - { -diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c -index e7b01904f180..cd1b47d5198a 100644 ---- a/arch/arm64/kernel/ptrace.c -+++ b/arch/arm64/kernel/ptrace.c -@@ -1819,12 +1819,23 @@ static void tracehook_report_syscall(struct pt_regs *regs, - saved_reg = regs->regs[regno]; - regs->regs[regno] = dir; - -- if (dir == PTRACE_SYSCALL_EXIT) -+ if (dir == PTRACE_SYSCALL_ENTER) { -+ if (tracehook_report_syscall_entry(regs)) -+ forget_syscall(regs); -+ regs->regs[regno] = saved_reg; -+ } else if (!test_thread_flag(TIF_SINGLESTEP)) { - tracehook_report_syscall_exit(regs, 0); -- else if (tracehook_report_syscall_entry(regs)) -- forget_syscall(regs); -+ regs->regs[regno] = saved_reg; -+ } else { -+ regs->regs[regno] = saved_reg; - -- regs->regs[regno] = saved_reg; -+ /* -+ * Signal a pseudo-step exception since we are stepping but -+ * tracer modifications to the registers may have rewound the -+ * state machine. -+ */ -+ tracehook_report_syscall_exit(regs, 1); -+ } - } - - int syscall_trace_enter(struct pt_regs *regs) -@@ -1852,12 +1863,14 @@ int syscall_trace_enter(struct pt_regs *regs) - - void syscall_trace_exit(struct pt_regs *regs) - { -+ unsigned long flags = READ_ONCE(current_thread_info()->flags); -+ - audit_syscall_exit(regs); - -- if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) -+ if (flags & _TIF_SYSCALL_TRACEPOINT) - trace_sys_exit(regs, regs_return_value(regs)); - -- if (test_thread_flag(TIF_SYSCALL_TRACE)) -+ if (flags & (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP)) - tracehook_report_syscall(regs, PTRACE_SYSCALL_EXIT); - - rseq_syscall(regs); -@@ -1935,8 +1948,8 @@ static int valid_native_regs(struct user_pt_regs *regs) - */ - int valid_user_regs(struct user_pt_regs *regs, struct task_struct *task) - { -- if (!test_tsk_thread_flag(task, TIF_SINGLESTEP)) -- regs->pstate &= ~DBG_SPSR_SS; -+ /* https://lore.kernel.org/lkml/20191118131525.GA4180@willie-the-truck */ -+ user_regs_reset_single_step(regs, task); - - if (is_compat_thread(task_thread_info(task))) - return valid_compat_regs(regs); -diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c -index 339882db5a91..de205ca806c1 100644 ---- a/arch/arm64/kernel/signal.c -+++ b/arch/arm64/kernel/signal.c -@@ -784,7 +784,6 @@ static void setup_restart_syscall(struct pt_regs *regs) - */ - static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) - { -- struct task_struct *tsk = current; - sigset_t *oldset = sigmask_to_save(); - int usig = ksig->sig; - int ret; -@@ -808,14 +807,8 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) - */ - ret |= !valid_user_regs(®s->user_regs, current); - -- /* -- * Fast forward the stepping logic so we step into the signal -- * handler. -- */ -- if (!ret) -- user_fastforward_single_step(tsk); -- -- signal_setup_done(ret, ksig, 0); -+ /* Step into the signal handler if we are stepping */ -+ signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP)); - } - - /* -diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c -index a12c0c88d345..7aa7cf76367e 100644 ---- a/arch/arm64/kernel/syscall.c -+++ b/arch/arm64/kernel/syscall.c -@@ -50,6 +50,9 @@ static void invoke_syscall(struct pt_regs *regs, unsigned int scno, - ret = do_ni_syscall(regs, scno); - } - -+ if (is_compat_task()) -+ ret = lower_32_bits(ret); -+ - regs->regs[0] = ret; - } - -@@ -121,7 +124,7 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, - if (!has_syscall_work(flags) && !IS_ENABLED(CONFIG_DEBUG_RSEQ)) { - local_daif_mask(); - flags = current_thread_info()->flags; -- if (!has_syscall_work(flags)) { -+ if (!has_syscall_work(flags) && !(flags & _TIF_SINGLESTEP)) { - /* - * We're off to userspace, where interrupts are - * always enabled after we restore the flags from -diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S -index 94402aaf5f5c..9869412ac156 100644 ---- a/arch/arm64/kernel/vmlinux.lds.S -+++ b/arch/arm64/kernel/vmlinux.lds.S -@@ -172,9 +172,6 @@ SECTIONS - *(.altinstructions) - __alt_instructions_end = .; - } -- .altinstr_replacement : { -- *(.altinstr_replacement) -- } - - . = ALIGN(PAGE_SIZE); - __inittext_end = .; -diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c -index a63483de7a42..5dacba392c74 100644 ---- a/arch/m68k/kernel/setup_no.c -+++ b/arch/m68k/kernel/setup_no.c -@@ -139,7 +139,8 @@ void __init setup_arch(char **cmdline_p) - pr_debug("MEMORY -> ROMFS=0x%p-0x%06lx MEM=0x%06lx-0x%06lx\n ", - __bss_stop, memory_start, memory_start, memory_end); - -- memblock_add(memory_start, memory_end - memory_start); -+ memblock_add(_rambase, memory_end - _rambase); -+ memblock_reserve(_rambase, memory_start - _rambase); - - /* Keep a copy of command line */ - *cmdline_p = &command_line[0]; -diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c -index 0ea375607767..2c57f46facc0 100644 ---- a/arch/m68k/mm/mcfmmu.c -+++ b/arch/m68k/mm/mcfmmu.c -@@ -178,7 +178,7 @@ void __init cf_bootmem_alloc(void) - m68k_memory[0].addr = _rambase; - m68k_memory[0].size = _ramend - _rambase; - -- memblock_add(m68k_memory[0].addr, m68k_memory[0].size); -+ memblock_add_node(m68k_memory[0].addr, m68k_memory[0].size, 0); - - /* compute total pages in system */ - num_pages = PFN_DOWN(_ramend - _rambase); -diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c -index 3f91ccaa9c74..4ea0cca52e16 100644 ---- a/arch/powerpc/kernel/paca.c -+++ b/arch/powerpc/kernel/paca.c -@@ -86,7 +86,7 @@ static void *__init alloc_shared_lppaca(unsigned long size, unsigned long align, - * This is very early in boot, so no harm done if the kernel crashes at - * this point. - */ -- BUG_ON(shared_lppaca_size >= shared_lppaca_total_size); -+ BUG_ON(shared_lppaca_size > shared_lppaca_total_size); - - return ptr; - } -diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c -index 1199fc2bfaec..268ce9581676 100644 ---- a/arch/powerpc/mm/book3s64/pkeys.c -+++ b/arch/powerpc/mm/book3s64/pkeys.c -@@ -357,12 +357,14 @@ static bool pkey_access_permitted(int pkey, bool write, bool execute) - return true; - - pkey_shift = pkeyshift(pkey); -- if (execute && !(read_iamr() & (IAMR_EX_BIT << pkey_shift))) -- return true; -+ if (execute) -+ return !(read_iamr() & (IAMR_EX_BIT << pkey_shift)); -+ -+ amr = read_amr(); -+ if (write) -+ return !(amr & (AMR_WR_BIT << pkey_shift)); - -- amr = read_amr(); /* Delay reading amr until absolutely needed */ -- return ((!write && !(amr & (AMR_RD_BIT << pkey_shift))) || -- (write && !(amr & (AMR_WR_BIT << pkey_shift)))); -+ return !(amr & (AMR_RD_BIT << pkey_shift)); - } - - bool arch_pte_access_permitted(u64 pte, bool write, bool execute) -diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h -index 1dd12a0cbb2b..464a2bbc97ea 100644 ---- a/arch/riscv/include/asm/thread_info.h -+++ b/arch/riscv/include/asm/thread_info.h -@@ -12,7 +12,11 @@ - #include - - /* thread information allocation */ -+#ifdef CONFIG_64BIT -+#define THREAD_SIZE_ORDER (2) -+#else - #define THREAD_SIZE_ORDER (1) -+#endif - #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) - - #ifndef __ASSEMBLY__ -diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h -index 44c48e34d799..00eac7f1529b 100644 ---- a/arch/x86/include/asm/fpu/internal.h -+++ b/arch/x86/include/asm/fpu/internal.h -@@ -619,6 +619,11 @@ static inline void switch_fpu_finish(struct fpu *new_fpu) - * MXCSR and XCR definitions: - */ - -+static inline void ldmxcsr(u32 mxcsr) -+{ -+ asm volatile("ldmxcsr %0" :: "m" (mxcsr)); -+} -+ - extern unsigned int mxcsr_feature_mask; - - #define XCR_XFEATURE_ENABLED_MASK 0x00000000 -diff --git a/arch/x86/include/asm/io_bitmap.h b/arch/x86/include/asm/io_bitmap.h -index ac1a99ffbd8d..7f080f5c7def 100644 ---- a/arch/x86/include/asm/io_bitmap.h -+++ b/arch/x86/include/asm/io_bitmap.h -@@ -19,12 +19,28 @@ struct task_struct; - void io_bitmap_share(struct task_struct *tsk); - void io_bitmap_exit(struct task_struct *tsk); - -+static inline void native_tss_invalidate_io_bitmap(void) -+{ -+ /* -+ * Invalidate the I/O bitmap by moving io_bitmap_base outside the -+ * TSS limit so any subsequent I/O access from user space will -+ * trigger a #GP. -+ * -+ * This is correct even when VMEXIT rewrites the TSS limit -+ * to 0x67 as the only requirement is that the base points -+ * outside the limit. -+ */ -+ this_cpu_write(cpu_tss_rw.x86_tss.io_bitmap_base, -+ IO_BITMAP_OFFSET_INVALID); -+} -+ - void native_tss_update_io_bitmap(void); - - #ifdef CONFIG_PARAVIRT_XXL - #include - #else - #define tss_update_io_bitmap native_tss_update_io_bitmap -+#define tss_invalidate_io_bitmap native_tss_invalidate_io_bitmap - #endif - - #else -diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h -index 694d8daf4983..0296dd66c167 100644 ---- a/arch/x86/include/asm/paravirt.h -+++ b/arch/x86/include/asm/paravirt.h -@@ -296,6 +296,11 @@ static inline void write_idt_entry(gate_desc *dt, int entry, const gate_desc *g) - } - - #ifdef CONFIG_X86_IOPL_IOPERM -+static inline void tss_invalidate_io_bitmap(void) -+{ -+ PVOP_VCALL0(cpu.invalidate_io_bitmap); -+} -+ - static inline void tss_update_io_bitmap(void) - { - PVOP_VCALL0(cpu.update_io_bitmap); -diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h -index 732f62e04ddb..8dfcb2508e6d 100644 ---- a/arch/x86/include/asm/paravirt_types.h -+++ b/arch/x86/include/asm/paravirt_types.h -@@ -141,6 +141,7 @@ struct pv_cpu_ops { - void (*load_sp0)(unsigned long sp0); - - #ifdef CONFIG_X86_IOPL_IOPERM -+ void (*invalidate_io_bitmap)(void); - void (*update_io_bitmap)(void); - #endif - -diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c -index 67768e54438b..cf8b6ebc6031 100644 ---- a/arch/x86/kernel/apic/vector.c -+++ b/arch/x86/kernel/apic/vector.c -@@ -446,12 +446,10 @@ static int x86_vector_activate(struct irq_domain *dom, struct irq_data *irqd, - trace_vector_activate(irqd->irq, apicd->is_managed, - apicd->can_reserve, reserve); - -- /* Nothing to do for fixed assigned vectors */ -- if (!apicd->can_reserve && !apicd->is_managed) -- return 0; -- - raw_spin_lock_irqsave(&vector_lock, flags); -- if (reserve || irqd_is_managed_and_shutdown(irqd)) -+ if (!apicd->can_reserve && !apicd->is_managed) -+ assign_irq_vector_any_locked(irqd); -+ else if (reserve || irqd_is_managed_and_shutdown(irqd)) - vector_assign_managed_shutdown(irqd); - else if (apicd->is_managed) - ret = activate_managed(irqd); -@@ -775,20 +773,10 @@ void lapic_offline(void) - static int apic_set_affinity(struct irq_data *irqd, - const struct cpumask *dest, bool force) - { -- struct apic_chip_data *apicd = apic_chip_data(irqd); - int err; - -- /* -- * Core code can call here for inactive interrupts. For inactive -- * interrupts which use managed or reservation mode there is no -- * point in going through the vector assignment right now as the -- * activation will assign a vector which fits the destination -- * cpumask. Let the core code store the destination mask and be -- * done with it. -- */ -- if (!irqd_is_activated(irqd) && -- (apicd->is_managed || apicd->can_reserve)) -- return IRQ_SET_MASK_OK; -+ if (WARN_ON_ONCE(!irqd_is_activated(irqd))) -+ return -EIO; - - raw_spin_lock(&vector_lock); - cpumask_and(vector_searchmask, dest, cpu_online_mask); -diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c -index 12c70840980e..cd8839027f66 100644 ---- a/arch/x86/kernel/fpu/core.c -+++ b/arch/x86/kernel/fpu/core.c -@@ -101,6 +101,12 @@ void kernel_fpu_begin(void) - copy_fpregs_to_fpstate(¤t->thread.fpu); - } - __cpu_invalidate_fpregs_state(); -+ -+ if (boot_cpu_has(X86_FEATURE_XMM)) -+ ldmxcsr(MXCSR_DEFAULT); -+ -+ if (boot_cpu_has(X86_FEATURE_FPU)) -+ asm volatile ("fninit"); - } - EXPORT_SYMBOL_GPL(kernel_fpu_begin); - -diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c -index 6a54e83d5589..9cf40a7ff7ae 100644 ---- a/arch/x86/kernel/fpu/xstate.c -+++ b/arch/x86/kernel/fpu/xstate.c -@@ -1022,7 +1022,7 @@ int copy_xstate_to_kernel(void *kbuf, struct xregs_state *xsave, unsigned int of - copy_part(offsetof(struct fxregs_state, st_space), 128, - &xsave->i387.st_space, &kbuf, &offset_start, &count); - if (header.xfeatures & XFEATURE_MASK_SSE) -- copy_part(xstate_offsets[XFEATURE_MASK_SSE], 256, -+ copy_part(xstate_offsets[XFEATURE_SSE], 256, - &xsave->i387.xmm_space, &kbuf, &offset_start, &count); - /* - * Fill xsave->i387.sw_reserved value for ptrace frame: -diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c -index c131ba4e70ef..97b4ce839b4c 100644 ---- a/arch/x86/kernel/paravirt.c -+++ b/arch/x86/kernel/paravirt.c -@@ -343,7 +343,8 @@ struct paravirt_patch_template pv_ops = { - .cpu.swapgs = native_swapgs, - - #ifdef CONFIG_X86_IOPL_IOPERM -- .cpu.update_io_bitmap = native_tss_update_io_bitmap, -+ .cpu.invalidate_io_bitmap = native_tss_invalidate_io_bitmap, -+ .cpu.update_io_bitmap = native_tss_update_io_bitmap, - #endif - - .cpu.start_context_switch = paravirt_nop, -diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c -index 8f4533c1a4ec..19a94a0be3bd 100644 ---- a/arch/x86/kernel/process.c -+++ b/arch/x86/kernel/process.c -@@ -322,20 +322,6 @@ void arch_setup_new_exec(void) - } - - #ifdef CONFIG_X86_IOPL_IOPERM --static inline void tss_invalidate_io_bitmap(struct tss_struct *tss) --{ -- /* -- * Invalidate the I/O bitmap by moving io_bitmap_base outside the -- * TSS limit so any subsequent I/O access from user space will -- * trigger a #GP. -- * -- * This is correct even when VMEXIT rewrites the TSS limit -- * to 0x67 as the only requirement is that the base points -- * outside the limit. -- */ -- tss->x86_tss.io_bitmap_base = IO_BITMAP_OFFSET_INVALID; --} -- - static inline void switch_to_bitmap(unsigned long tifp) - { - /* -@@ -346,7 +332,7 @@ static inline void switch_to_bitmap(unsigned long tifp) - * user mode. - */ - if (tifp & _TIF_IO_BITMAP) -- tss_invalidate_io_bitmap(this_cpu_ptr(&cpu_tss_rw)); -+ tss_invalidate_io_bitmap(); - } - - static void tss_copy_io_bitmap(struct tss_struct *tss, struct io_bitmap *iobm) -@@ -380,7 +366,7 @@ void native_tss_update_io_bitmap(void) - u16 *base = &tss->x86_tss.io_bitmap_base; - - if (!test_thread_flag(TIF_IO_BITMAP)) { -- tss_invalidate_io_bitmap(tss); -+ native_tss_invalidate_io_bitmap(); - return; - } - -diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c -index 507f4fb88fa7..9621d31104b6 100644 ---- a/arch/x86/xen/enlighten_pv.c -+++ b/arch/x86/xen/enlighten_pv.c -@@ -841,6 +841,17 @@ static void xen_load_sp0(unsigned long sp0) - } - - #ifdef CONFIG_X86_IOPL_IOPERM -+static void xen_invalidate_io_bitmap(void) -+{ -+ struct physdev_set_iobitmap iobitmap = { -+ .bitmap = 0, -+ .nr_ports = 0, -+ }; -+ -+ native_tss_invalidate_io_bitmap(); -+ HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap, &iobitmap); -+} -+ - static void xen_update_io_bitmap(void) - { - struct physdev_set_iobitmap iobitmap; -@@ -1070,6 +1081,7 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = { - .load_sp0 = xen_load_sp0, - - #ifdef CONFIG_X86_IOPL_IOPERM -+ .invalidate_io_bitmap = xen_invalidate_io_bitmap, - .update_io_bitmap = xen_update_io_bitmap, - #endif - .io_delay = xen_io_delay, -diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c -index b3f2ba483992..121f4c1e0697 100644 ---- a/block/blk-mq-debugfs.c -+++ b/block/blk-mq-debugfs.c -@@ -125,6 +125,9 @@ static const char *const blk_queue_flag_name[] = { - QUEUE_FLAG_NAME(REGISTERED), - QUEUE_FLAG_NAME(SCSI_PASSTHROUGH), - QUEUE_FLAG_NAME(QUIESCED), -+ QUEUE_FLAG_NAME(PCI_P2PDMA), -+ QUEUE_FLAG_NAME(ZONE_RESETALL), -+ QUEUE_FLAG_NAME(RQ_ALLOC_TIME), - }; - #undef QUEUE_FLAG_NAME - -diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c -index d7f43d4ea925..e5fae4e838c0 100644 ---- a/crypto/asymmetric_keys/public_key.c -+++ b/crypto/asymmetric_keys/public_key.c -@@ -119,6 +119,7 @@ static int software_key_query(const struct kernel_pkey_params *params, - if (IS_ERR(tfm)) - return PTR_ERR(tfm); - -+ ret = -ENOMEM; - key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen, - GFP_KERNEL); - if (!key) -diff --git a/drivers/acpi/dptf/dptf_power.c b/drivers/acpi/dptf/dptf_power.c -index e4e8b75d39f0..8b42f529047e 100644 ---- a/drivers/acpi/dptf/dptf_power.c -+++ b/drivers/acpi/dptf/dptf_power.c -@@ -99,6 +99,7 @@ static int dptf_power_remove(struct platform_device *pdev) - static const struct acpi_device_id int3407_device_ids[] = { - {"INT3407", 0}, - {"INTC1047", 0}, -+ {"INTC1050", 0}, - {"", 0}, - }; - MODULE_DEVICE_TABLE(acpi, int3407_device_ids); -diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c -index e72843fe41df..e16afa27700d 100644 ---- a/drivers/base/regmap/regmap-debugfs.c -+++ b/drivers/base/regmap/regmap-debugfs.c -@@ -457,29 +457,31 @@ static ssize_t regmap_cache_only_write_file(struct file *file, - { - struct regmap *map = container_of(file->private_data, - struct regmap, cache_only); -- ssize_t result; -- bool was_enabled, require_sync = false; -+ bool new_val, require_sync = false; - int err; - -- map->lock(map->lock_arg); -+ err = kstrtobool_from_user(user_buf, count, &new_val); -+ /* Ignore malforned data like debugfs_write_file_bool() */ -+ if (err) -+ return count; - -- was_enabled = map->cache_only; -+ err = debugfs_file_get(file->f_path.dentry); -+ if (err) -+ return err; - -- result = debugfs_write_file_bool(file, user_buf, count, ppos); -- if (result < 0) { -- map->unlock(map->lock_arg); -- return result; -- } -+ map->lock(map->lock_arg); - -- if (map->cache_only && !was_enabled) { -+ if (new_val && !map->cache_only) { - dev_warn(map->dev, "debugfs cache_only=Y forced\n"); - add_taint(TAINT_USER, LOCKDEP_STILL_OK); -- } else if (!map->cache_only && was_enabled) { -+ } else if (!new_val && map->cache_only) { - dev_warn(map->dev, "debugfs cache_only=N forced: syncing cache\n"); - require_sync = true; - } -+ map->cache_only = new_val; - - map->unlock(map->lock_arg); -+ debugfs_file_put(file->f_path.dentry); - - if (require_sync) { - err = regcache_sync(map); -@@ -487,7 +489,7 @@ static ssize_t regmap_cache_only_write_file(struct file *file, - dev_err(map->dev, "Failed to sync cache %d\n", err); - } - -- return result; -+ return count; - } - - static const struct file_operations regmap_cache_only_fops = { -@@ -502,28 +504,32 @@ static ssize_t regmap_cache_bypass_write_file(struct file *file, - { - struct regmap *map = container_of(file->private_data, - struct regmap, cache_bypass); -- ssize_t result; -- bool was_enabled; -+ bool new_val; -+ int err; - -- map->lock(map->lock_arg); -+ err = kstrtobool_from_user(user_buf, count, &new_val); -+ /* Ignore malforned data like debugfs_write_file_bool() */ -+ if (err) -+ return count; - -- was_enabled = map->cache_bypass; -+ err = debugfs_file_get(file->f_path.dentry); -+ if (err) -+ return err; - -- result = debugfs_write_file_bool(file, user_buf, count, ppos); -- if (result < 0) -- goto out; -+ map->lock(map->lock_arg); - -- if (map->cache_bypass && !was_enabled) { -+ if (new_val && !map->cache_bypass) { - dev_warn(map->dev, "debugfs cache_bypass=Y forced\n"); - add_taint(TAINT_USER, LOCKDEP_STILL_OK); -- } else if (!map->cache_bypass && was_enabled) { -+ } else if (!new_val && map->cache_bypass) { - dev_warn(map->dev, "debugfs cache_bypass=N forced\n"); - } -+ map->cache_bypass = new_val; - --out: - map->unlock(map->lock_arg); -+ debugfs_file_put(file->f_path.dentry); - -- return result; -+ return count; - } - - static const struct file_operations regmap_cache_bypass_fops = { -diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c -index ebb234f36909..73a5cecfa9bb 100644 ---- a/drivers/block/zram/zram_drv.c -+++ b/drivers/block/zram/zram_drv.c -@@ -2025,7 +2025,8 @@ static ssize_t hot_add_show(struct class *class, - return ret; - return scnprintf(buf, PAGE_SIZE, "%d\n", ret); - } --static CLASS_ATTR_RO(hot_add); -+static struct class_attribute class_attr_hot_add = -+ __ATTR(hot_add, 0400, hot_add_show, NULL); - - static ssize_t hot_remove_store(struct class *class, - struct class_attribute *attr, -diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c -index db9541f38505..3b0417a01494 100644 ---- a/drivers/bus/ti-sysc.c -+++ b/drivers/bus/ti-sysc.c -@@ -236,15 +236,14 @@ static int sysc_wait_softreset(struct sysc *ddata) - syss_done = ddata->cfg.syss_mask; - - if (syss_offset >= 0) { -- error = readx_poll_timeout(sysc_read_sysstatus, ddata, rstval, -- (rstval & ddata->cfg.syss_mask) == -- syss_done, -- 100, MAX_MODULE_SOFTRESET_WAIT); -+ error = readx_poll_timeout_atomic(sysc_read_sysstatus, ddata, -+ rstval, (rstval & ddata->cfg.syss_mask) == -+ syss_done, 100, MAX_MODULE_SOFTRESET_WAIT); - - } else if (ddata->cfg.quirks & SYSC_QUIRK_RESET_STATUS) { -- error = readx_poll_timeout(sysc_read_sysconfig, ddata, rstval, -- !(rstval & sysc_mask), -- 100, MAX_MODULE_SOFTRESET_WAIT); -+ error = readx_poll_timeout_atomic(sysc_read_sysconfig, ddata, -+ rstval, !(rstval & sysc_mask), -+ 100, MAX_MODULE_SOFTRESET_WAIT); - } - - return error; -@@ -1279,7 +1278,8 @@ static int __maybe_unused sysc_noirq_suspend(struct device *dev) - - ddata = dev_get_drvdata(dev); - -- if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE) -+ if (ddata->cfg.quirks & -+ (SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_NO_IDLE)) - return 0; - - return pm_runtime_force_suspend(dev); -@@ -1291,7 +1291,8 @@ static int __maybe_unused sysc_noirq_resume(struct device *dev) - - ddata = dev_get_drvdata(dev); - -- if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE) -+ if (ddata->cfg.quirks & -+ (SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_NO_IDLE)) - return 0; - - return pm_runtime_force_resume(dev); -@@ -1728,8 +1729,8 @@ static void sysc_quirk_rtc(struct sysc *ddata, bool lock) - - local_irq_save(flags); - /* RTC_STATUS BUSY bit may stay active for 1/32768 seconds (~30 usec) */ -- error = readl_poll_timeout(ddata->module_va + 0x44, val, -- !(val & BIT(0)), 100, 50); -+ error = readl_poll_timeout_atomic(ddata->module_va + 0x44, val, -+ !(val & BIT(0)), 100, 50); - if (error) - dev_warn(ddata->dev, "rtc busy timeout\n"); - /* Now we have ~15 microseconds to read/write various registers */ -diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c -index 2435216bd10a..65ab1b027949 100644 ---- a/drivers/char/tpm/tpm_tis_core.c -+++ b/drivers/char/tpm/tpm_tis_core.c -@@ -1085,7 +1085,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, - - return 0; - out_err: -- if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL)) -+ if (chip->ops->clk_enable != NULL) - chip->ops->clk_enable(chip, false); - - tpm_tis_remove(chip); -diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c -index 3cbaec925606..5adad9fa3036 100644 ---- a/drivers/char/virtio_console.c -+++ b/drivers/char/virtio_console.c -@@ -2116,6 +2116,7 @@ static struct virtio_device_id id_table[] = { - { VIRTIO_ID_CONSOLE, VIRTIO_DEV_ANY_ID }, - { 0 }, - }; -+MODULE_DEVICE_TABLE(virtio, id_table); - - static unsigned int features[] = { - VIRTIO_CONSOLE_F_SIZE, -@@ -2128,6 +2129,7 @@ static struct virtio_device_id rproc_serial_id_table[] = { - #endif - { 0 }, - }; -+MODULE_DEVICE_TABLE(virtio, rproc_serial_id_table); - - static unsigned int rproc_serial_features[] = { - }; -@@ -2280,6 +2282,5 @@ static void __exit fini(void) - module_init(init); - module_exit(fini); - --MODULE_DEVICE_TABLE(virtio, id_table); - MODULE_DESCRIPTION("Virtio console driver"); - MODULE_LICENSE("GPL"); -diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c -index 99afc949925f..177368cac6dd 100644 ---- a/drivers/clk/clk-ast2600.c -+++ b/drivers/clk/clk-ast2600.c -@@ -131,6 +131,18 @@ static const struct clk_div_table ast2600_eclk_div_table[] = { - { 0 } - }; - -+static const struct clk_div_table ast2600_emmc_extclk_div_table[] = { -+ { 0x0, 2 }, -+ { 0x1, 4 }, -+ { 0x2, 6 }, -+ { 0x3, 8 }, -+ { 0x4, 10 }, -+ { 0x5, 12 }, -+ { 0x6, 14 }, -+ { 0x7, 16 }, -+ { 0 } -+}; -+ - static const struct clk_div_table ast2600_mac_div_table[] = { - { 0x0, 4 }, - { 0x1, 4 }, -@@ -390,6 +402,11 @@ static struct clk_hw *aspeed_g6_clk_hw_register_gate(struct device *dev, - return hw; - } - -+static const char *const emmc_extclk_parent_names[] = { -+ "emmc_extclk_hpll_in", -+ "mpll", -+}; -+ - static const char * const vclk_parent_names[] = { - "dpll", - "d1pll", -@@ -459,16 +476,32 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev) - return PTR_ERR(hw); - aspeed_g6_clk_data->hws[ASPEED_CLK_UARTX] = hw; - -- /* EMMC ext clock divider */ -- hw = clk_hw_register_gate(dev, "emmc_extclk_gate", "hpll", 0, -- scu_g6_base + ASPEED_G6_CLK_SELECTION1, 15, 0, -- &aspeed_g6_clk_lock); -+ /* EMMC ext clock */ -+ hw = clk_hw_register_fixed_factor(dev, "emmc_extclk_hpll_in", "hpll", -+ 0, 1, 2); - if (IS_ERR(hw)) - return PTR_ERR(hw); -- hw = clk_hw_register_divider_table(dev, "emmc_extclk", "emmc_extclk_gate", 0, -- scu_g6_base + ASPEED_G6_CLK_SELECTION1, 12, 3, 0, -- ast2600_div_table, -- &aspeed_g6_clk_lock); -+ -+ hw = clk_hw_register_mux(dev, "emmc_extclk_mux", -+ emmc_extclk_parent_names, -+ ARRAY_SIZE(emmc_extclk_parent_names), 0, -+ scu_g6_base + ASPEED_G6_CLK_SELECTION1, 11, 1, -+ 0, &aspeed_g6_clk_lock); -+ if (IS_ERR(hw)) -+ return PTR_ERR(hw); -+ -+ hw = clk_hw_register_gate(dev, "emmc_extclk_gate", "emmc_extclk_mux", -+ 0, scu_g6_base + ASPEED_G6_CLK_SELECTION1, -+ 15, 0, &aspeed_g6_clk_lock); -+ if (IS_ERR(hw)) -+ return PTR_ERR(hw); -+ -+ hw = clk_hw_register_divider_table(dev, "emmc_extclk", -+ "emmc_extclk_gate", 0, -+ scu_g6_base + -+ ASPEED_G6_CLK_SELECTION1, 12, -+ 3, 0, ast2600_emmc_extclk_div_table, -+ &aspeed_g6_clk_lock); - if (IS_ERR(hw)) - return PTR_ERR(hw); - aspeed_g6_clk_data->hws[ASPEED_CLK_EMMC] = hw; -diff --git a/drivers/clk/mvebu/Kconfig b/drivers/clk/mvebu/Kconfig -index ded07b0bd0d5..557d6213783c 100644 ---- a/drivers/clk/mvebu/Kconfig -+++ b/drivers/clk/mvebu/Kconfig -@@ -42,6 +42,7 @@ config ARMADA_AP806_SYSCON - - config ARMADA_AP_CPU_CLK - bool -+ select ARMADA_AP_CP_HELPER - - config ARMADA_CP110_SYSCON - bool -diff --git a/drivers/clk/qcom/gcc-msm8998.c b/drivers/clk/qcom/gcc-msm8998.c -index df1d7056436c..9d7016bcd680 100644 ---- a/drivers/clk/qcom/gcc-msm8998.c -+++ b/drivers/clk/qcom/gcc-msm8998.c -@@ -1110,6 +1110,27 @@ static struct clk_rcg2 ufs_axi_clk_src = { - }, - }; - -+static const struct freq_tbl ftbl_ufs_unipro_core_clk_src[] = { -+ F(37500000, P_GPLL0_OUT_MAIN, 16, 0, 0), -+ F(75000000, P_GPLL0_OUT_MAIN, 8, 0, 0), -+ F(150000000, P_GPLL0_OUT_MAIN, 4, 0, 0), -+ { } -+}; -+ -+static struct clk_rcg2 ufs_unipro_core_clk_src = { -+ .cmd_rcgr = 0x76028, -+ .mnd_width = 8, -+ .hid_width = 5, -+ .parent_map = gcc_parent_map_0, -+ .freq_tbl = ftbl_ufs_unipro_core_clk_src, -+ .clkr.hw.init = &(struct clk_init_data){ -+ .name = "ufs_unipro_core_clk_src", -+ .parent_names = gcc_parent_names_0, -+ .num_parents = 4, -+ .ops = &clk_rcg2_ops, -+ }, -+}; -+ - static const struct freq_tbl ftbl_usb30_master_clk_src[] = { - F(19200000, P_XO, 1, 0, 0), - F(60000000, P_GPLL0_OUT_MAIN, 10, 0, 0), -@@ -2549,6 +2570,11 @@ static struct clk_branch gcc_ufs_unipro_core_clk = { - .enable_mask = BIT(0), - .hw.init = &(struct clk_init_data){ - .name = "gcc_ufs_unipro_core_clk", -+ .parent_names = (const char *[]){ -+ "ufs_unipro_core_clk_src", -+ }, -+ .num_parents = 1, -+ .flags = CLK_SET_RATE_PARENT, - .ops = &clk_branch2_ops, - }, - }, -@@ -2904,6 +2930,7 @@ static struct clk_regmap *gcc_msm8998_clocks[] = { - [SDCC4_APPS_CLK_SRC] = &sdcc4_apps_clk_src.clkr, - [TSIF_REF_CLK_SRC] = &tsif_ref_clk_src.clkr, - [UFS_AXI_CLK_SRC] = &ufs_axi_clk_src.clkr, -+ [UFS_UNIPRO_CORE_CLK_SRC] = &ufs_unipro_core_clk_src.clkr, - [USB30_MASTER_CLK_SRC] = &usb30_master_clk_src.clkr, - [USB30_MOCK_UTMI_CLK_SRC] = &usb30_mock_utmi_clk_src.clkr, - [USB3_PHY_AUX_CLK_SRC] = &usb3_phy_aux_clk_src.clkr, -diff --git a/drivers/clk/qcom/gcc-sc7180.c b/drivers/clk/qcom/gcc-sc7180.c -index 6a51b5b5fc19..73380525cb09 100644 ---- a/drivers/clk/qcom/gcc-sc7180.c -+++ b/drivers/clk/qcom/gcc-sc7180.c -@@ -390,6 +390,7 @@ static const struct freq_tbl ftbl_gcc_qupv3_wrap0_s0_clk_src[] = { - F(29491200, P_GPLL0_OUT_EVEN, 1, 1536, 15625), - F(32000000, P_GPLL0_OUT_EVEN, 1, 8, 75), - F(48000000, P_GPLL0_OUT_EVEN, 1, 4, 25), -+ F(51200000, P_GPLL6_OUT_MAIN, 7.5, 0, 0), - F(64000000, P_GPLL0_OUT_EVEN, 1, 16, 75), - F(75000000, P_GPLL0_OUT_EVEN, 4, 0, 0), - F(80000000, P_GPLL0_OUT_EVEN, 1, 4, 15), -@@ -405,8 +406,8 @@ static const struct freq_tbl ftbl_gcc_qupv3_wrap0_s0_clk_src[] = { - - static struct clk_init_data gcc_qupv3_wrap0_s0_clk_src_init = { - .name = "gcc_qupv3_wrap0_s0_clk_src", -- .parent_data = gcc_parent_data_0, -- .num_parents = 4, -+ .parent_data = gcc_parent_data_1, -+ .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, - }; - -@@ -414,15 +415,15 @@ static struct clk_rcg2 gcc_qupv3_wrap0_s0_clk_src = { - .cmd_rcgr = 0x17034, - .mnd_width = 16, - .hid_width = 5, -- .parent_map = gcc_parent_map_0, -+ .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_qupv3_wrap0_s0_clk_src, - .clkr.hw.init = &gcc_qupv3_wrap0_s0_clk_src_init, - }; - - static struct clk_init_data gcc_qupv3_wrap0_s1_clk_src_init = { - .name = "gcc_qupv3_wrap0_s1_clk_src", -- .parent_data = gcc_parent_data_0, -- .num_parents = 4, -+ .parent_data = gcc_parent_data_1, -+ .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, - }; - -@@ -430,15 +431,15 @@ static struct clk_rcg2 gcc_qupv3_wrap0_s1_clk_src = { - .cmd_rcgr = 0x17164, - .mnd_width = 16, - .hid_width = 5, -- .parent_map = gcc_parent_map_0, -+ .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_qupv3_wrap0_s0_clk_src, - .clkr.hw.init = &gcc_qupv3_wrap0_s1_clk_src_init, - }; - - static struct clk_init_data gcc_qupv3_wrap0_s2_clk_src_init = { - .name = "gcc_qupv3_wrap0_s2_clk_src", -- .parent_data = gcc_parent_data_0, -- .num_parents = 4, -+ .parent_data = gcc_parent_data_1, -+ .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, - }; - -@@ -446,15 +447,15 @@ static struct clk_rcg2 gcc_qupv3_wrap0_s2_clk_src = { - .cmd_rcgr = 0x17294, - .mnd_width = 16, - .hid_width = 5, -- .parent_map = gcc_parent_map_0, -+ .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_qupv3_wrap0_s0_clk_src, - .clkr.hw.init = &gcc_qupv3_wrap0_s2_clk_src_init, - }; - - static struct clk_init_data gcc_qupv3_wrap0_s3_clk_src_init = { - .name = "gcc_qupv3_wrap0_s3_clk_src", -- .parent_data = gcc_parent_data_0, -- .num_parents = 4, -+ .parent_data = gcc_parent_data_1, -+ .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, - }; - -@@ -462,15 +463,15 @@ static struct clk_rcg2 gcc_qupv3_wrap0_s3_clk_src = { - .cmd_rcgr = 0x173c4, - .mnd_width = 16, - .hid_width = 5, -- .parent_map = gcc_parent_map_0, -+ .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_qupv3_wrap0_s0_clk_src, - .clkr.hw.init = &gcc_qupv3_wrap0_s3_clk_src_init, - }; - - static struct clk_init_data gcc_qupv3_wrap0_s4_clk_src_init = { - .name = "gcc_qupv3_wrap0_s4_clk_src", -- .parent_data = gcc_parent_data_0, -- .num_parents = 4, -+ .parent_data = gcc_parent_data_1, -+ .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, - }; - -@@ -478,15 +479,15 @@ static struct clk_rcg2 gcc_qupv3_wrap0_s4_clk_src = { - .cmd_rcgr = 0x174f4, - .mnd_width = 16, - .hid_width = 5, -- .parent_map = gcc_parent_map_0, -+ .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_qupv3_wrap0_s0_clk_src, - .clkr.hw.init = &gcc_qupv3_wrap0_s4_clk_src_init, - }; - - static struct clk_init_data gcc_qupv3_wrap0_s5_clk_src_init = { - .name = "gcc_qupv3_wrap0_s5_clk_src", -- .parent_data = gcc_parent_data_0, -- .num_parents = 4, -+ .parent_data = gcc_parent_data_1, -+ .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, - }; - -@@ -494,15 +495,15 @@ static struct clk_rcg2 gcc_qupv3_wrap0_s5_clk_src = { - .cmd_rcgr = 0x17624, - .mnd_width = 16, - .hid_width = 5, -- .parent_map = gcc_parent_map_0, -+ .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_qupv3_wrap0_s0_clk_src, - .clkr.hw.init = &gcc_qupv3_wrap0_s5_clk_src_init, - }; - - static struct clk_init_data gcc_qupv3_wrap1_s0_clk_src_init = { - .name = "gcc_qupv3_wrap1_s0_clk_src", -- .parent_data = gcc_parent_data_0, -- .num_parents = 4, -+ .parent_data = gcc_parent_data_1, -+ .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, - }; - -@@ -510,15 +511,15 @@ static struct clk_rcg2 gcc_qupv3_wrap1_s0_clk_src = { - .cmd_rcgr = 0x18018, - .mnd_width = 16, - .hid_width = 5, -- .parent_map = gcc_parent_map_0, -+ .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_qupv3_wrap0_s0_clk_src, - .clkr.hw.init = &gcc_qupv3_wrap1_s0_clk_src_init, - }; - - static struct clk_init_data gcc_qupv3_wrap1_s1_clk_src_init = { - .name = "gcc_qupv3_wrap1_s1_clk_src", -- .parent_data = gcc_parent_data_0, -- .num_parents = 4, -+ .parent_data = gcc_parent_data_1, -+ .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, - }; - -@@ -526,15 +527,15 @@ static struct clk_rcg2 gcc_qupv3_wrap1_s1_clk_src = { - .cmd_rcgr = 0x18148, - .mnd_width = 16, - .hid_width = 5, -- .parent_map = gcc_parent_map_0, -+ .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_qupv3_wrap0_s0_clk_src, - .clkr.hw.init = &gcc_qupv3_wrap1_s1_clk_src_init, - }; - - static struct clk_init_data gcc_qupv3_wrap1_s2_clk_src_init = { - .name = "gcc_qupv3_wrap1_s2_clk_src", -- .parent_data = gcc_parent_data_0, -- .num_parents = 4, -+ .parent_data = gcc_parent_data_1, -+ .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, - }; - -@@ -542,15 +543,15 @@ static struct clk_rcg2 gcc_qupv3_wrap1_s2_clk_src = { - .cmd_rcgr = 0x18278, - .mnd_width = 16, - .hid_width = 5, -- .parent_map = gcc_parent_map_0, -+ .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_qupv3_wrap0_s0_clk_src, - .clkr.hw.init = &gcc_qupv3_wrap1_s2_clk_src_init, - }; - - static struct clk_init_data gcc_qupv3_wrap1_s3_clk_src_init = { - .name = "gcc_qupv3_wrap1_s3_clk_src", -- .parent_data = gcc_parent_data_0, -- .num_parents = 4, -+ .parent_data = gcc_parent_data_1, -+ .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, - }; - -@@ -558,15 +559,15 @@ static struct clk_rcg2 gcc_qupv3_wrap1_s3_clk_src = { - .cmd_rcgr = 0x183a8, - .mnd_width = 16, - .hid_width = 5, -- .parent_map = gcc_parent_map_0, -+ .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_qupv3_wrap0_s0_clk_src, - .clkr.hw.init = &gcc_qupv3_wrap1_s3_clk_src_init, - }; - - static struct clk_init_data gcc_qupv3_wrap1_s4_clk_src_init = { - .name = "gcc_qupv3_wrap1_s4_clk_src", -- .parent_data = gcc_parent_data_0, -- .num_parents = 4, -+ .parent_data = gcc_parent_data_1, -+ .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, - }; - -@@ -574,15 +575,15 @@ static struct clk_rcg2 gcc_qupv3_wrap1_s4_clk_src = { - .cmd_rcgr = 0x184d8, - .mnd_width = 16, - .hid_width = 5, -- .parent_map = gcc_parent_map_0, -+ .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_qupv3_wrap0_s0_clk_src, - .clkr.hw.init = &gcc_qupv3_wrap1_s4_clk_src_init, - }; - - static struct clk_init_data gcc_qupv3_wrap1_s5_clk_src_init = { - .name = "gcc_qupv3_wrap1_s5_clk_src", -- .parent_data = gcc_parent_data_0, -- .num_parents = 4, -+ .parent_data = gcc_parent_data_1, -+ .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, - }; - -@@ -590,7 +591,7 @@ static struct clk_rcg2 gcc_qupv3_wrap1_s5_clk_src = { - .cmd_rcgr = 0x18608, - .mnd_width = 16, - .hid_width = 5, -- .parent_map = gcc_parent_map_0, -+ .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_qupv3_wrap0_s0_clk_src, - .clkr.hw.init = &gcc_qupv3_wrap1_s5_clk_src_init, - }; -diff --git a/drivers/clk/qcom/gcc-sm8150.c b/drivers/clk/qcom/gcc-sm8150.c -index 732bc7c937e6..72524cf11048 100644 ---- a/drivers/clk/qcom/gcc-sm8150.c -+++ b/drivers/clk/qcom/gcc-sm8150.c -@@ -1616,6 +1616,36 @@ static struct clk_branch gcc_gpu_cfg_ahb_clk = { - }, - }; - -+static struct clk_branch gcc_gpu_gpll0_clk_src = { -+ .clkr = { -+ .enable_reg = 0x52004, -+ .enable_mask = BIT(15), -+ .hw.init = &(struct clk_init_data){ -+ .name = "gcc_gpu_gpll0_clk_src", -+ .parent_hws = (const struct clk_hw *[]){ -+ &gpll0.clkr.hw }, -+ .num_parents = 1, -+ .flags = CLK_SET_RATE_PARENT, -+ .ops = &clk_branch2_ops, -+ }, -+ }, -+}; -+ -+static struct clk_branch gcc_gpu_gpll0_div_clk_src = { -+ .clkr = { -+ .enable_reg = 0x52004, -+ .enable_mask = BIT(16), -+ .hw.init = &(struct clk_init_data){ -+ .name = "gcc_gpu_gpll0_div_clk_src", -+ .parent_hws = (const struct clk_hw *[]){ -+ &gcc_gpu_gpll0_clk_src.clkr.hw }, -+ .num_parents = 1, -+ .flags = CLK_SET_RATE_PARENT, -+ .ops = &clk_branch2_ops, -+ }, -+ }, -+}; -+ - static struct clk_branch gcc_gpu_iref_clk = { - .halt_reg = 0x8c010, - .halt_check = BRANCH_HALT, -@@ -1698,6 +1728,36 @@ static struct clk_branch gcc_npu_cfg_ahb_clk = { - }, - }; - -+static struct clk_branch gcc_npu_gpll0_clk_src = { -+ .clkr = { -+ .enable_reg = 0x52004, -+ .enable_mask = BIT(18), -+ .hw.init = &(struct clk_init_data){ -+ .name = "gcc_npu_gpll0_clk_src", -+ .parent_hws = (const struct clk_hw *[]){ -+ &gpll0.clkr.hw }, -+ .num_parents = 1, -+ .flags = CLK_SET_RATE_PARENT, -+ .ops = &clk_branch2_ops, -+ }, -+ }, -+}; -+ -+static struct clk_branch gcc_npu_gpll0_div_clk_src = { -+ .clkr = { -+ .enable_reg = 0x52004, -+ .enable_mask = BIT(19), -+ .hw.init = &(struct clk_init_data){ -+ .name = "gcc_npu_gpll0_div_clk_src", -+ .parent_hws = (const struct clk_hw *[]){ -+ &gcc_npu_gpll0_clk_src.clkr.hw }, -+ .num_parents = 1, -+ .flags = CLK_SET_RATE_PARENT, -+ .ops = &clk_branch2_ops, -+ }, -+ }, -+}; -+ - static struct clk_branch gcc_npu_trig_clk = { - .halt_reg = 0x4d00c, - .halt_check = BRANCH_VOTED, -@@ -2812,6 +2872,45 @@ static struct clk_branch gcc_ufs_card_phy_aux_hw_ctl_clk = { - }, - }; - -+/* external clocks so add BRANCH_HALT_SKIP */ -+static struct clk_branch gcc_ufs_card_rx_symbol_0_clk = { -+ .halt_check = BRANCH_HALT_SKIP, -+ .clkr = { -+ .enable_reg = 0x7501c, -+ .enable_mask = BIT(0), -+ .hw.init = &(struct clk_init_data){ -+ .name = "gcc_ufs_card_rx_symbol_0_clk", -+ .ops = &clk_branch2_ops, -+ }, -+ }, -+}; -+ -+/* external clocks so add BRANCH_HALT_SKIP */ -+static struct clk_branch gcc_ufs_card_rx_symbol_1_clk = { -+ .halt_check = BRANCH_HALT_SKIP, -+ .clkr = { -+ .enable_reg = 0x750ac, -+ .enable_mask = BIT(0), -+ .hw.init = &(struct clk_init_data){ -+ .name = "gcc_ufs_card_rx_symbol_1_clk", -+ .ops = &clk_branch2_ops, -+ }, -+ }, -+}; -+ -+/* external clocks so add BRANCH_HALT_SKIP */ -+static struct clk_branch gcc_ufs_card_tx_symbol_0_clk = { -+ .halt_check = BRANCH_HALT_SKIP, -+ .clkr = { -+ .enable_reg = 0x75018, -+ .enable_mask = BIT(0), -+ .hw.init = &(struct clk_init_data){ -+ .name = "gcc_ufs_card_tx_symbol_0_clk", -+ .ops = &clk_branch2_ops, -+ }, -+ }, -+}; -+ - static struct clk_branch gcc_ufs_card_unipro_core_clk = { - .halt_reg = 0x75058, - .halt_check = BRANCH_HALT, -@@ -2992,6 +3091,45 @@ static struct clk_branch gcc_ufs_phy_phy_aux_hw_ctl_clk = { - }, - }; - -+/* external clocks so add BRANCH_HALT_SKIP */ -+static struct clk_branch gcc_ufs_phy_rx_symbol_0_clk = { -+ .halt_check = BRANCH_HALT_SKIP, -+ .clkr = { -+ .enable_reg = 0x7701c, -+ .enable_mask = BIT(0), -+ .hw.init = &(struct clk_init_data){ -+ .name = "gcc_ufs_phy_rx_symbol_0_clk", -+ .ops = &clk_branch2_ops, -+ }, -+ }, -+}; -+ -+/* external clocks so add BRANCH_HALT_SKIP */ -+static struct clk_branch gcc_ufs_phy_rx_symbol_1_clk = { -+ .halt_check = BRANCH_HALT_SKIP, -+ .clkr = { -+ .enable_reg = 0x770ac, -+ .enable_mask = BIT(0), -+ .hw.init = &(struct clk_init_data){ -+ .name = "gcc_ufs_phy_rx_symbol_1_clk", -+ .ops = &clk_branch2_ops, -+ }, -+ }, -+}; -+ -+/* external clocks so add BRANCH_HALT_SKIP */ -+static struct clk_branch gcc_ufs_phy_tx_symbol_0_clk = { -+ .halt_check = BRANCH_HALT_SKIP, -+ .clkr = { -+ .enable_reg = 0x77018, -+ .enable_mask = BIT(0), -+ .hw.init = &(struct clk_init_data){ -+ .name = "gcc_ufs_phy_tx_symbol_0_clk", -+ .ops = &clk_branch2_ops, -+ }, -+ }, -+}; -+ - static struct clk_branch gcc_ufs_phy_unipro_core_clk = { - .halt_reg = 0x77058, - .halt_check = BRANCH_HALT, -@@ -3374,12 +3512,16 @@ static struct clk_regmap *gcc_sm8150_clocks[] = { - [GCC_GP3_CLK] = &gcc_gp3_clk.clkr, - [GCC_GP3_CLK_SRC] = &gcc_gp3_clk_src.clkr, - [GCC_GPU_CFG_AHB_CLK] = &gcc_gpu_cfg_ahb_clk.clkr, -+ [GCC_GPU_GPLL0_CLK_SRC] = &gcc_gpu_gpll0_clk_src.clkr, -+ [GCC_GPU_GPLL0_DIV_CLK_SRC] = &gcc_gpu_gpll0_div_clk_src.clkr, - [GCC_GPU_IREF_CLK] = &gcc_gpu_iref_clk.clkr, - [GCC_GPU_MEMNOC_GFX_CLK] = &gcc_gpu_memnoc_gfx_clk.clkr, - [GCC_GPU_SNOC_DVM_GFX_CLK] = &gcc_gpu_snoc_dvm_gfx_clk.clkr, - [GCC_NPU_AT_CLK] = &gcc_npu_at_clk.clkr, - [GCC_NPU_AXI_CLK] = &gcc_npu_axi_clk.clkr, - [GCC_NPU_CFG_AHB_CLK] = &gcc_npu_cfg_ahb_clk.clkr, -+ [GCC_NPU_GPLL0_CLK_SRC] = &gcc_npu_gpll0_clk_src.clkr, -+ [GCC_NPU_GPLL0_DIV_CLK_SRC] = &gcc_npu_gpll0_div_clk_src.clkr, - [GCC_NPU_TRIG_CLK] = &gcc_npu_trig_clk.clkr, - [GCC_PCIE0_PHY_REFGEN_CLK] = &gcc_pcie0_phy_refgen_clk.clkr, - [GCC_PCIE1_PHY_REFGEN_CLK] = &gcc_pcie1_phy_refgen_clk.clkr, -@@ -3484,6 +3626,9 @@ static struct clk_regmap *gcc_sm8150_clocks[] = { - [GCC_UFS_CARD_PHY_AUX_CLK_SRC] = &gcc_ufs_card_phy_aux_clk_src.clkr, - [GCC_UFS_CARD_PHY_AUX_HW_CTL_CLK] = - &gcc_ufs_card_phy_aux_hw_ctl_clk.clkr, -+ [GCC_UFS_CARD_RX_SYMBOL_0_CLK] = &gcc_ufs_card_rx_symbol_0_clk.clkr, -+ [GCC_UFS_CARD_RX_SYMBOL_1_CLK] = &gcc_ufs_card_rx_symbol_1_clk.clkr, -+ [GCC_UFS_CARD_TX_SYMBOL_0_CLK] = &gcc_ufs_card_tx_symbol_0_clk.clkr, - [GCC_UFS_CARD_UNIPRO_CORE_CLK] = &gcc_ufs_card_unipro_core_clk.clkr, - [GCC_UFS_CARD_UNIPRO_CORE_CLK_SRC] = - &gcc_ufs_card_unipro_core_clk_src.clkr, -@@ -3501,6 +3646,9 @@ static struct clk_regmap *gcc_sm8150_clocks[] = { - [GCC_UFS_PHY_PHY_AUX_CLK] = &gcc_ufs_phy_phy_aux_clk.clkr, - [GCC_UFS_PHY_PHY_AUX_CLK_SRC] = &gcc_ufs_phy_phy_aux_clk_src.clkr, - [GCC_UFS_PHY_PHY_AUX_HW_CTL_CLK] = &gcc_ufs_phy_phy_aux_hw_ctl_clk.clkr, -+ [GCC_UFS_PHY_RX_SYMBOL_0_CLK] = &gcc_ufs_phy_rx_symbol_0_clk.clkr, -+ [GCC_UFS_PHY_RX_SYMBOL_1_CLK] = &gcc_ufs_phy_rx_symbol_1_clk.clkr, -+ [GCC_UFS_PHY_TX_SYMBOL_0_CLK] = &gcc_ufs_phy_tx_symbol_0_clk.clkr, - [GCC_UFS_PHY_UNIPRO_CORE_CLK] = &gcc_ufs_phy_unipro_core_clk.clkr, - [GCC_UFS_PHY_UNIPRO_CORE_CLK_SRC] = - &gcc_ufs_phy_unipro_core_clk_src.clkr, -diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c -index aa13708c2bc3..d22cfae1b019 100644 ---- a/drivers/counter/104-quad-8.c -+++ b/drivers/counter/104-quad-8.c -@@ -1274,18 +1274,26 @@ static ssize_t quad8_signal_cable_fault_read(struct counter_device *counter, - struct counter_signal *signal, - void *private, char *buf) - { -- const struct quad8_iio *const priv = counter->priv; -+ struct quad8_iio *const priv = counter->priv; - const size_t channel_id = signal->id / 2; -- const bool disabled = !(priv->cable_fault_enable & BIT(channel_id)); -+ bool disabled; - unsigned int status; - unsigned int fault; - -- if (disabled) -+ mutex_lock(&priv->lock); -+ -+ disabled = !(priv->cable_fault_enable & BIT(channel_id)); -+ -+ if (disabled) { -+ mutex_unlock(&priv->lock); - return -EINVAL; -+ } - - /* Logic 0 = cable fault */ - status = inb(priv->base + QUAD8_DIFF_ENCODER_CABLE_STATUS); - -+ mutex_unlock(&priv->lock); -+ - /* Mask respective channel and invert logic */ - fault = !(status & BIT(channel_id)); - -@@ -1317,6 +1325,8 @@ static ssize_t quad8_signal_cable_fault_enable_write( - if (ret) - return ret; - -+ mutex_lock(&priv->lock); -+ - if (enable) - priv->cable_fault_enable |= BIT(channel_id); - else -@@ -1327,6 +1337,8 @@ static ssize_t quad8_signal_cable_fault_enable_write( - - outb(cable_fault_enable, priv->base + QUAD8_DIFF_ENCODER_CABLE_STATUS); - -+ mutex_unlock(&priv->lock); -+ - return len; - } - -@@ -1353,6 +1365,8 @@ static ssize_t quad8_signal_fck_prescaler_write(struct counter_device *counter, - if (ret) - return ret; - -+ mutex_lock(&priv->lock); -+ - priv->fck_prescaler[channel_id] = prescaler; - - /* Reset Byte Pointer */ -@@ -1363,6 +1377,8 @@ static ssize_t quad8_signal_fck_prescaler_write(struct counter_device *counter, - outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_PRESET_PSC, - base_offset + 1); - -+ mutex_unlock(&priv->lock); -+ - return len; - } - -diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c -index e782aaaf3e1f..c26937143c35 100644 ---- a/drivers/dma-buf/dma-buf.c -+++ b/drivers/dma-buf/dma-buf.c -@@ -45,10 +45,10 @@ static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen) - size_t ret = 0; - - dmabuf = dentry->d_fsdata; -- dma_resv_lock(dmabuf->resv, NULL); -+ spin_lock(&dmabuf->name_lock); - if (dmabuf->name) - ret = strlcpy(name, dmabuf->name, DMA_BUF_NAME_LEN); -- dma_resv_unlock(dmabuf->resv); -+ spin_unlock(&dmabuf->name_lock); - - return dynamic_dname(dentry, buffer, buflen, "/%s:%s", - dentry->d_name.name, ret > 0 ? name : ""); -@@ -338,8 +338,10 @@ static long dma_buf_set_name(struct dma_buf *dmabuf, const char __user *buf) - kfree(name); - goto out_unlock; - } -+ spin_lock(&dmabuf->name_lock); - kfree(dmabuf->name); - dmabuf->name = name; -+ spin_unlock(&dmabuf->name_lock); - - out_unlock: - dma_resv_unlock(dmabuf->resv); -@@ -402,10 +404,10 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file) - /* Don't count the temporary reference taken inside procfs seq_show */ - seq_printf(m, "count:\t%ld\n", file_count(dmabuf->file) - 1); - seq_printf(m, "exp_name:\t%s\n", dmabuf->exp_name); -- dma_resv_lock(dmabuf->resv, NULL); -+ spin_lock(&dmabuf->name_lock); - if (dmabuf->name) - seq_printf(m, "name:\t%s\n", dmabuf->name); -- dma_resv_unlock(dmabuf->resv); -+ spin_unlock(&dmabuf->name_lock); - } - - static const struct file_operations dma_buf_fops = { -@@ -542,6 +544,7 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) - dmabuf->size = exp_info->size; - dmabuf->exp_name = exp_info->exp_name; - dmabuf->owner = exp_info->owner; -+ spin_lock_init(&dmabuf->name_lock); - init_waitqueue_head(&dmabuf->poll); - dmabuf->cb_excl.poll = dmabuf->cb_shared.poll = &dmabuf->poll; - dmabuf->cb_excl.active = dmabuf->cb_shared.active = 0; -diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c -index 0425984db118..62d9825a49e9 100644 ---- a/drivers/dma/dmatest.c -+++ b/drivers/dma/dmatest.c -@@ -1168,6 +1168,8 @@ static int dmatest_run_set(const char *val, const struct kernel_param *kp) - } else if (dmatest_run) { - if (!is_threaded_test_pending(info)) { - pr_info("No channels configured, continue with any\n"); -+ if (!is_threaded_test_run(info)) -+ stop_threaded_test(info); - add_threaded_test(info); - } - start_threaded_tests(info); -diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c -index 21cb2a58dbd2..a1b56f52db2f 100644 ---- a/drivers/dma/dw/core.c -+++ b/drivers/dma/dw/core.c -@@ -118,16 +118,11 @@ static void dwc_initialize(struct dw_dma_chan *dwc) - { - struct dw_dma *dw = to_dw_dma(dwc->chan.device); - -- if (test_bit(DW_DMA_IS_INITIALIZED, &dwc->flags)) -- return; -- - dw->initialize_chan(dwc); - - /* Enable interrupts */ - channel_set_bit(dw, MASK.XFER, dwc->mask); - channel_set_bit(dw, MASK.ERROR, dwc->mask); -- -- set_bit(DW_DMA_IS_INITIALIZED, &dwc->flags); - } - - /*----------------------------------------------------------------------*/ -@@ -954,8 +949,6 @@ static void dwc_issue_pending(struct dma_chan *chan) - - void do_dw_dma_off(struct dw_dma *dw) - { -- unsigned int i; -- - dma_writel(dw, CFG, 0); - - channel_clear_bit(dw, MASK.XFER, dw->all_chan_mask); -@@ -966,9 +959,6 @@ void do_dw_dma_off(struct dw_dma *dw) - - while (dma_readl(dw, CFG) & DW_CFG_DMA_EN) - cpu_relax(); -- -- for (i = 0; i < dw->dma.chancnt; i++) -- clear_bit(DW_DMA_IS_INITIALIZED, &dw->chan[i].flags); - } - - void do_dw_dma_on(struct dw_dma *dw) -@@ -1032,8 +1022,6 @@ static void dwc_free_chan_resources(struct dma_chan *chan) - /* Clear custom channel configuration */ - memset(&dwc->dws, 0, sizeof(struct dw_dma_slave)); - -- clear_bit(DW_DMA_IS_INITIALIZED, &dwc->flags); -- - /* Disable interrupts */ - channel_clear_bit(dw, MASK.XFER, dwc->mask); - channel_clear_bit(dw, MASK.BLOCK, dwc->mask); -diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h -index 67e422590c9a..ec1169741de1 100644 ---- a/drivers/dma/fsl-edma-common.h -+++ b/drivers/dma/fsl-edma-common.h -@@ -33,7 +33,7 @@ - #define EDMA_TCD_ATTR_DSIZE_16BIT BIT(0) - #define EDMA_TCD_ATTR_DSIZE_32BIT BIT(1) - #define EDMA_TCD_ATTR_DSIZE_64BIT (BIT(0) | BIT(1)) --#define EDMA_TCD_ATTR_DSIZE_32BYTE (BIT(3) | BIT(0)) -+#define EDMA_TCD_ATTR_DSIZE_32BYTE (BIT(2) | BIT(0)) - #define EDMA_TCD_ATTR_SSIZE_8BIT 0 - #define EDMA_TCD_ATTR_SSIZE_16BIT (EDMA_TCD_ATTR_DSIZE_16BIT << 8) - #define EDMA_TCD_ATTR_SSIZE_32BIT (EDMA_TCD_ATTR_DSIZE_32BIT << 8) -diff --git a/drivers/dma/fsl-edma.c b/drivers/dma/fsl-edma.c -index eff7ebd8cf35..90bb72af306c 100644 ---- a/drivers/dma/fsl-edma.c -+++ b/drivers/dma/fsl-edma.c -@@ -45,6 +45,13 @@ static irqreturn_t fsl_edma_tx_handler(int irq, void *dev_id) - fsl_chan = &fsl_edma->chans[ch]; - - spin_lock(&fsl_chan->vchan.lock); -+ -+ if (!fsl_chan->edesc) { -+ /* terminate_all called before */ -+ spin_unlock(&fsl_chan->vchan.lock); -+ continue; -+ } -+ - if (!fsl_chan->edesc->iscyclic) { - list_del(&fsl_chan->edesc->vdesc.node); - vchan_cookie_complete(&fsl_chan->edesc->vdesc); -diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c -index ff49847e37a8..cb376cf6a2d2 100644 ---- a/drivers/dma/idxd/cdev.c -+++ b/drivers/dma/idxd/cdev.c -@@ -74,6 +74,7 @@ static int idxd_cdev_open(struct inode *inode, struct file *filp) - struct idxd_device *idxd; - struct idxd_wq *wq; - struct device *dev; -+ int rc = 0; - - wq = inode_wq(inode); - idxd = wq->idxd; -@@ -81,17 +82,27 @@ static int idxd_cdev_open(struct inode *inode, struct file *filp) - - dev_dbg(dev, "%s called: %d\n", __func__, idxd_wq_refcount(wq)); - -- if (idxd_wq_refcount(wq) > 0 && wq_dedicated(wq)) -- return -EBUSY; -- - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); - if (!ctx) - return -ENOMEM; - -+ mutex_lock(&wq->wq_lock); -+ -+ if (idxd_wq_refcount(wq) > 0 && wq_dedicated(wq)) { -+ rc = -EBUSY; -+ goto failed; -+ } -+ - ctx->wq = wq; - filp->private_data = ctx; - idxd_wq_get(wq); -+ mutex_unlock(&wq->wq_lock); - return 0; -+ -+ failed: -+ mutex_unlock(&wq->wq_lock); -+ kfree(ctx); -+ return rc; - } - - static int idxd_cdev_release(struct inode *node, struct file *filep) -@@ -105,7 +116,9 @@ static int idxd_cdev_release(struct inode *node, struct file *filep) - filep->private_data = NULL; - - kfree(ctx); -+ mutex_lock(&wq->wq_lock); - idxd_wq_put(wq); -+ mutex_unlock(&wq->wq_lock); - return 0; - } - -diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c -index 8d79a8787104..8d2718c585dc 100644 ---- a/drivers/dma/idxd/device.c -+++ b/drivers/dma/idxd/device.c -@@ -320,6 +320,31 @@ void idxd_wq_unmap_portal(struct idxd_wq *wq) - devm_iounmap(dev, wq->dportal); - } - -+void idxd_wq_disable_cleanup(struct idxd_wq *wq) -+{ -+ struct idxd_device *idxd = wq->idxd; -+ struct device *dev = &idxd->pdev->dev; -+ int i, wq_offset; -+ -+ lockdep_assert_held(&idxd->dev_lock); -+ memset(&wq->wqcfg, 0, sizeof(wq->wqcfg)); -+ wq->type = IDXD_WQT_NONE; -+ wq->size = 0; -+ wq->group = NULL; -+ wq->threshold = 0; -+ wq->priority = 0; -+ clear_bit(WQ_FLAG_DEDICATED, &wq->flags); -+ memset(wq->name, 0, WQ_NAME_SIZE); -+ -+ for (i = 0; i < 8; i++) { -+ wq_offset = idxd->wqcfg_offset + wq->id * 32 + i * sizeof(u32); -+ iowrite32(0, idxd->reg_base + wq_offset); -+ dev_dbg(dev, "WQ[%d][%d][%#x]: %#x\n", -+ wq->id, i, wq_offset, -+ ioread32(idxd->reg_base + wq_offset)); -+ } -+} -+ - /* Device control bits */ - static inline bool idxd_is_enabled(struct idxd_device *idxd) - { -diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h -index b8f8a363b4a7..908c8d0ef3ab 100644 ---- a/drivers/dma/idxd/idxd.h -+++ b/drivers/dma/idxd/idxd.h -@@ -290,6 +290,7 @@ int idxd_wq_enable(struct idxd_wq *wq); - int idxd_wq_disable(struct idxd_wq *wq); - int idxd_wq_map_portal(struct idxd_wq *wq); - void idxd_wq_unmap_portal(struct idxd_wq *wq); -+void idxd_wq_disable_cleanup(struct idxd_wq *wq); - - /* submission */ - int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc); -diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c -index 6510791b9921..8a35f58da689 100644 ---- a/drivers/dma/idxd/irq.c -+++ b/drivers/dma/idxd/irq.c -@@ -141,7 +141,7 @@ irqreturn_t idxd_misc_thread(int vec, void *data) - - iowrite32(cause, idxd->reg_base + IDXD_INTCAUSE_OFFSET); - if (!err) -- return IRQ_HANDLED; -+ goto out; - - gensts.bits = ioread32(idxd->reg_base + IDXD_GENSTATS_OFFSET); - if (gensts.state == IDXD_DEVICE_STATE_HALT) { -@@ -162,6 +162,7 @@ irqreturn_t idxd_misc_thread(int vec, void *data) - spin_unlock_bh(&idxd->dev_lock); - } - -+ out: - idxd_unmask_msix_vector(idxd, irq_entry->id); - return IRQ_HANDLED; - } -diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c -index 3999827970ab..fbb455ece81e 100644 ---- a/drivers/dma/idxd/sysfs.c -+++ b/drivers/dma/idxd/sysfs.c -@@ -315,6 +315,11 @@ static int idxd_config_bus_remove(struct device *dev) - idxd_unregister_dma_device(idxd); - spin_lock_irqsave(&idxd->dev_lock, flags); - rc = idxd_device_disable(idxd); -+ for (i = 0; i < idxd->max_wqs; i++) { -+ struct idxd_wq *wq = &idxd->wqs[i]; -+ -+ idxd_wq_disable_cleanup(wq); -+ } - spin_unlock_irqrestore(&idxd->dev_lock, flags); - module_put(THIS_MODULE); - if (rc < 0) -diff --git a/drivers/dma/mcf-edma.c b/drivers/dma/mcf-edma.c -index e15bd15a9ef6..e12b754e6398 100644 ---- a/drivers/dma/mcf-edma.c -+++ b/drivers/dma/mcf-edma.c -@@ -35,6 +35,13 @@ static irqreturn_t mcf_edma_tx_handler(int irq, void *dev_id) - mcf_chan = &mcf_edma->chans[ch]; - - spin_lock(&mcf_chan->vchan.lock); -+ -+ if (!mcf_chan->edesc) { -+ /* terminate_all called before */ -+ spin_unlock(&mcf_chan->vchan.lock); -+ continue; -+ } -+ - if (!mcf_chan->edesc->iscyclic) { - list_del(&mcf_chan->edesc->vdesc.node); - vchan_cookie_complete(&mcf_chan->edesc->vdesc); -diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c -index b218a013c260..8f7ceb698226 100644 ---- a/drivers/dma/sh/usb-dmac.c -+++ b/drivers/dma/sh/usb-dmac.c -@@ -586,6 +586,8 @@ static void usb_dmac_isr_transfer_end(struct usb_dmac_chan *chan) - desc->residue = usb_dmac_get_current_residue(chan, desc, - desc->sg_index - 1); - desc->done_cookie = desc->vd.tx.cookie; -+ desc->vd.tx_result.result = DMA_TRANS_NOERROR; -+ desc->vd.tx_result.residue = desc->residue; - vchan_cookie_complete(&desc->vd); - - /* Restart the next transfer if this driver has a next desc */ -diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c -index a90e154b0ae0..7cab23fe5c73 100644 ---- a/drivers/dma/ti/k3-udma.c -+++ b/drivers/dma/ti/k3-udma.c -@@ -1925,8 +1925,6 @@ static int udma_alloc_chan_resources(struct dma_chan *chan) - - udma_reset_rings(uc); - -- INIT_DELAYED_WORK_ONSTACK(&uc->tx_drain.work, -- udma_check_tx_completion); - return 0; - - err_irq_free: -@@ -3038,7 +3036,6 @@ static void udma_free_chan_resources(struct dma_chan *chan) - } - - cancel_delayed_work_sync(&uc->tx_drain.work); -- destroy_delayed_work_on_stack(&uc->tx_drain.work); - - if (uc->irq_num_ring > 0) { - free_irq(uc->irq_num_ring, uc); -@@ -3189,7 +3186,7 @@ static struct udma_match_data am654_main_data = { - - static struct udma_match_data am654_mcu_data = { - .psil_base = 0x6000, -- .enable_memcpy_support = true, /* TEST: DMA domains */ -+ .enable_memcpy_support = false, - .statictr_z_mask = GENMASK(11, 0), - .rchan_oes_offset = 0x2000, - .tpl_levels = 2, -@@ -3609,7 +3606,7 @@ static int udma_probe(struct platform_device *pdev) - return ret; - } - -- ret = of_property_read_u32(navss_node, "ti,udma-atype", &ud->atype); -+ ret = of_property_read_u32(dev->of_node, "ti,udma-atype", &ud->atype); - if (!ret && ud->atype > 2) { - dev_err(dev, "Invalid atype: %u\n", ud->atype); - return -EINVAL; -@@ -3727,6 +3724,7 @@ static int udma_probe(struct platform_device *pdev) - tasklet_init(&uc->vc.task, udma_vchan_complete, - (unsigned long)&uc->vc); - init_completion(&uc->teardown_completed); -+ INIT_DELAYED_WORK(&uc->tx_drain.work, udma_check_tx_completion); - } - - ret = dma_async_device_register(&ud->ddev); -diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c -index 48bea0997e70..374b772150a6 100644 ---- a/drivers/gpio/gpio-pca953x.c -+++ b/drivers/gpio/gpio-pca953x.c -@@ -399,6 +399,7 @@ static const struct regmap_config pca953x_ai_i2c_regmap = { - .writeable_reg = pca953x_writeable_register, - .volatile_reg = pca953x_volatile_register, - -+ .disable_locking = true, - .cache_type = REGCACHE_RBTREE, - .max_register = 0x7f, - }; -diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c -index 1dc57079933c..ee96f12c4aef 100644 ---- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c -+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c -@@ -286,30 +286,20 @@ static uint64_t sdma_v5_0_ring_get_rptr(struct amdgpu_ring *ring) - static uint64_t sdma_v5_0_ring_get_wptr(struct amdgpu_ring *ring) - { - struct amdgpu_device *adev = ring->adev; -- u64 *wptr = NULL; -- uint64_t local_wptr = 0; -+ u64 wptr; - - if (ring->use_doorbell) { - /* XXX check if swapping is necessary on BE */ -- wptr = ((u64 *)&adev->wb.wb[ring->wptr_offs]); -- DRM_DEBUG("wptr/doorbell before shift == 0x%016llx\n", *wptr); -- *wptr = (*wptr) >> 2; -- DRM_DEBUG("wptr/doorbell after shift == 0x%016llx\n", *wptr); -+ wptr = READ_ONCE(*((u64 *)&adev->wb.wb[ring->wptr_offs])); -+ DRM_DEBUG("wptr/doorbell before shift == 0x%016llx\n", wptr); - } else { -- u32 lowbit, highbit; -- -- wptr = &local_wptr; -- lowbit = RREG32(sdma_v5_0_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR)) >> 2; -- highbit = RREG32(sdma_v5_0_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI)) >> 2; -- -- DRM_DEBUG("wptr [%i]high== 0x%08x low==0x%08x\n", -- ring->me, highbit, lowbit); -- *wptr = highbit; -- *wptr = (*wptr) << 32; -- *wptr |= lowbit; -+ wptr = RREG32(sdma_v5_0_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI)); -+ wptr = wptr << 32; -+ wptr |= RREG32(sdma_v5_0_get_reg_offset(adev, ring->me, mmSDMA0_GFX_RB_WPTR)); -+ DRM_DEBUG("wptr before shift [%i] wptr == 0x%016llx\n", ring->me, wptr); - } - -- return *wptr; -+ return wptr >> 2; - } - - /** -diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -index 69b1f61928ef..d06fa6380179 100644 ---- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c -@@ -956,6 +956,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) - /* Update the actual used number of crtc */ - adev->mode_info.num_crtc = adev->dm.display_indexes_num; - -+ /* create fake encoders for MST */ -+ dm_dp_create_fake_mst_encoders(adev); -+ - /* TODO: Add_display_info? */ - - /* TODO use dynamic cursor width */ -@@ -979,6 +982,12 @@ error: - - static void amdgpu_dm_fini(struct amdgpu_device *adev) - { -+ int i; -+ -+ for (i = 0; i < adev->dm.display_indexes_num; i++) { -+ drm_encoder_cleanup(&adev->dm.mst_encoders[i].base); -+ } -+ - amdgpu_dm_audio_fini(adev); - - amdgpu_dm_destroy_drm_device(&adev->dm); -@@ -1804,6 +1813,7 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) - struct amdgpu_display_manager *dm; - struct drm_connector *conn_base; - struct amdgpu_device *adev; -+ struct dc_link *link = NULL; - static const u8 pre_computed_values[] = { - 50, 51, 52, 53, 55, 56, 57, 58, 59, 61, 62, 63, 65, 66, 68, 69, - 71, 72, 74, 75, 77, 79, 81, 82, 84, 86, 88, 90, 92, 94, 96, 98}; -@@ -1811,6 +1821,10 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) - if (!aconnector || !aconnector->dc_link) - return; - -+ link = aconnector->dc_link; -+ if (link->connector_signal != SIGNAL_TYPE_EDP) -+ return; -+ - conn_base = &aconnector->base; - adev = conn_base->dev->dev_private; - dm = &adev->dm; -diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h -index 5cab3e65d992..76f7c5275239 100644 ---- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h -+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h -@@ -43,6 +43,9 @@ - */ - - #define AMDGPU_DM_MAX_DISPLAY_INDEX 31 -+ -+#define AMDGPU_DM_MAX_CRTC 6 -+ - /* - #include "include/amdgpu_dal_power_if.h" - #include "amdgpu_dm_irq.h" -@@ -327,6 +330,13 @@ struct amdgpu_display_manager { - * available in FW - */ - const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box; -+ -+ /** -+ * @mst_encoders: -+ * -+ * fake encoders used for DP MST. -+ */ -+ struct amdgpu_encoder mst_encoders[AMDGPU_DM_MAX_CRTC]; - }; - - struct amdgpu_dm_connector { -@@ -355,7 +365,6 @@ struct amdgpu_dm_connector { - struct amdgpu_dm_dp_aux dm_dp_aux; - struct drm_dp_mst_port *port; - struct amdgpu_dm_connector *mst_port; -- struct amdgpu_encoder *mst_encoder; - struct drm_dp_aux *dsc_aux; - - /* TODO see if we can merge with ddc_bus or make a dm_connector */ -diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c -index d2917759b7ab..6c8e87baedd9 100644 ---- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c -+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c -@@ -137,13 +137,10 @@ static void - dm_dp_mst_connector_destroy(struct drm_connector *connector) - { - struct amdgpu_dm_connector *amdgpu_dm_connector = to_amdgpu_dm_connector(connector); -- struct amdgpu_encoder *amdgpu_encoder = amdgpu_dm_connector->mst_encoder; - - kfree(amdgpu_dm_connector->edid); - amdgpu_dm_connector->edid = NULL; - -- drm_encoder_cleanup(&amdgpu_encoder->base); -- kfree(amdgpu_encoder); - drm_connector_cleanup(connector); - drm_dp_mst_put_port_malloc(amdgpu_dm_connector->port); - kfree(amdgpu_dm_connector); -@@ -280,7 +277,11 @@ static struct drm_encoder * - dm_mst_atomic_best_encoder(struct drm_connector *connector, - struct drm_connector_state *connector_state) - { -- return &to_amdgpu_dm_connector(connector)->mst_encoder->base; -+ struct drm_device *dev = connector->dev; -+ struct amdgpu_device *adev = dev->dev_private; -+ struct amdgpu_crtc *acrtc = to_amdgpu_crtc(connector_state->crtc); -+ -+ return &adev->dm.mst_encoders[acrtc->crtc_id].base; - } - - static int -@@ -343,31 +344,27 @@ static const struct drm_encoder_funcs amdgpu_dm_encoder_funcs = { - .destroy = amdgpu_dm_encoder_destroy, - }; - --static struct amdgpu_encoder * --dm_dp_create_fake_mst_encoder(struct amdgpu_dm_connector *connector) -+void -+dm_dp_create_fake_mst_encoders(struct amdgpu_device *adev) - { -- struct drm_device *dev = connector->base.dev; -- struct amdgpu_device *adev = dev->dev_private; -- struct amdgpu_encoder *amdgpu_encoder; -- struct drm_encoder *encoder; -- -- amdgpu_encoder = kzalloc(sizeof(*amdgpu_encoder), GFP_KERNEL); -- if (!amdgpu_encoder) -- return NULL; -+ struct drm_device *dev = adev->ddev; -+ int i; - -- encoder = &amdgpu_encoder->base; -- encoder->possible_crtcs = amdgpu_dm_get_encoder_crtc_mask(adev); -+ for (i = 0; i < adev->dm.display_indexes_num; i++) { -+ struct amdgpu_encoder *amdgpu_encoder = &adev->dm.mst_encoders[i]; -+ struct drm_encoder *encoder = &amdgpu_encoder->base; - -- drm_encoder_init( -- dev, -- &amdgpu_encoder->base, -- &amdgpu_dm_encoder_funcs, -- DRM_MODE_ENCODER_DPMST, -- NULL); -+ encoder->possible_crtcs = amdgpu_dm_get_encoder_crtc_mask(adev); - -- drm_encoder_helper_add(encoder, &amdgpu_dm_encoder_helper_funcs); -+ drm_encoder_init( -+ dev, -+ &amdgpu_encoder->base, -+ &amdgpu_dm_encoder_funcs, -+ DRM_MODE_ENCODER_DPMST, -+ NULL); - -- return amdgpu_encoder; -+ drm_encoder_helper_add(encoder, &amdgpu_dm_encoder_helper_funcs); -+ } - } - - static struct drm_connector * -@@ -380,6 +377,7 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr, - struct amdgpu_device *adev = dev->dev_private; - struct amdgpu_dm_connector *aconnector; - struct drm_connector *connector; -+ int i; - - aconnector = kzalloc(sizeof(*aconnector), GFP_KERNEL); - if (!aconnector) -@@ -406,9 +404,10 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr, - master->dc_link, - master->connector_id); - -- aconnector->mst_encoder = dm_dp_create_fake_mst_encoder(master); -- drm_connector_attach_encoder(&aconnector->base, -- &aconnector->mst_encoder->base); -+ for (i = 0; i < adev->dm.display_indexes_num; i++) { -+ drm_connector_attach_encoder(&aconnector->base, -+ &adev->dm.mst_encoders[i].base); -+ } - - connector->max_bpc_property = master->base.max_bpc_property; - if (connector->max_bpc_property) -diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h -index d2c56579a2cc..b38bd68121ce 100644 ---- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h -+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h -@@ -35,6 +35,9 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, - struct amdgpu_dm_connector *aconnector, - int link_index); - -+void -+dm_dp_create_fake_mst_encoders(struct amdgpu_device *adev); -+ - #if defined(CONFIG_DRM_AMD_DC_DCN) - bool compute_mst_dsc_configs_for_state(struct drm_atomic_state *state, - struct dc_state *dc_state); -diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c -index 4f0e7203dba4..470c82794f6f 100644 ---- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c -+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c -@@ -56,7 +56,7 @@ void update_stream_signal(struct dc_stream_state *stream, struct dc_sink *sink) - } - } - --static void dc_stream_construct(struct dc_stream_state *stream, -+static bool dc_stream_construct(struct dc_stream_state *stream, - struct dc_sink *dc_sink_data) - { - uint32_t i = 0; -@@ -118,11 +118,17 @@ static void dc_stream_construct(struct dc_stream_state *stream, - update_stream_signal(stream, dc_sink_data); - - stream->out_transfer_func = dc_create_transfer_func(); -+ if (stream->out_transfer_func == NULL) { -+ dc_sink_release(dc_sink_data); -+ return false; -+ } - stream->out_transfer_func->type = TF_TYPE_BYPASS; - stream->out_transfer_func->ctx = stream->ctx; - - stream->stream_id = stream->ctx->dc_stream_id_count; - stream->ctx->dc_stream_id_count++; -+ -+ return true; - } - - static void dc_stream_destruct(struct dc_stream_state *stream) -@@ -164,13 +170,20 @@ struct dc_stream_state *dc_create_stream_for_sink( - - stream = kzalloc(sizeof(struct dc_stream_state), GFP_KERNEL); - if (stream == NULL) -- return NULL; -+ goto alloc_fail; - -- dc_stream_construct(stream, sink); -+ if (dc_stream_construct(stream, sink) == false) -+ goto construct_fail; - - kref_init(&stream->refcount); - - return stream; -+ -+construct_fail: -+ kfree(stream); -+ -+alloc_fail: -+ return NULL; - } - - struct dc_stream_state *dc_copy_stream(const struct dc_stream_state *stream) -diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c -index b0ed1b3fe79a..72e4d7611323 100644 ---- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c -+++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c -@@ -687,7 +687,7 @@ static int renoir_set_power_profile_mode(struct smu_context *smu, long *input, u - return -EINVAL; - } - -- ret = smu_send_smc_msg_with_param(smu, SMU_MSG_SetWorkloadMask, -+ ret = smu_send_smc_msg_with_param(smu, SMU_MSG_ActiveProcessNotify, - 1 << workload_type, - NULL); - if (ret) { -diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c -index 619f81435c1b..58b89ec11b0e 100644 ---- a/drivers/gpu/drm/exynos/exynos_drm_dma.c -+++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c -@@ -61,7 +61,7 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev, - struct device *subdrv_dev, void **dma_priv) - { - struct exynos_drm_private *priv = drm_dev->dev_private; -- int ret; -+ int ret = 0; - - if (get_dma_ops(priv->dma_dev) != get_dma_ops(subdrv_dev)) { - DRM_DEV_ERROR(subdrv_dev, "Device %s lacks support for IOMMU\n", -@@ -92,7 +92,7 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev, - if (ret) - clear_dma_max_seg_size(subdrv_dev); - -- return 0; -+ return ret; - } - - /* -diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c -index f41d75923557..004110c5ded4 100644 ---- a/drivers/gpu/drm/exynos/exynos_drm_mic.c -+++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c -@@ -269,8 +269,10 @@ static void mic_pre_enable(struct drm_bridge *bridge) - goto unlock; - - ret = pm_runtime_get_sync(mic->dev); -- if (ret < 0) -+ if (ret < 0) { -+ pm_runtime_put_noidle(mic->dev); - goto unlock; -+ } - - mic_set_path(mic, 1); - -diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c -index 821411b93dac..0718ffc7829f 100644 ---- a/drivers/gpu/drm/i915/display/intel_hdmi.c -+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c -@@ -2821,19 +2821,13 @@ intel_hdmi_connector_register(struct drm_connector *connector) - return ret; - } - --static void intel_hdmi_destroy(struct drm_connector *connector) -+static void intel_hdmi_connector_unregister(struct drm_connector *connector) - { - struct cec_notifier *n = intel_attached_hdmi(to_intel_connector(connector))->cec_notifier; - - cec_notifier_conn_unregister(n); - -- intel_connector_destroy(connector); --} -- --static void intel_hdmi_connector_unregister(struct drm_connector *connector) --{ - intel_hdmi_remove_i2c_symlink(connector); -- - intel_connector_unregister(connector); - } - -@@ -2845,7 +2839,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = { - .atomic_set_property = intel_digital_connector_atomic_set_property, - .late_register = intel_hdmi_connector_register, - .early_unregister = intel_hdmi_connector_unregister, -- .destroy = intel_hdmi_destroy, -+ .destroy = intel_connector_destroy, - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, - .atomic_duplicate_state = intel_digital_connector_duplicate_state, - }; -diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c -index ba82193b4e31..06922e8aae99 100644 ---- a/drivers/gpu/drm/i915/gt/intel_lrc.c -+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c -@@ -4897,13 +4897,8 @@ static void virtual_engine_initial_hint(struct virtual_engine *ve) - * typically be the first we inspect for submission. - */ - swp = prandom_u32_max(ve->num_siblings); -- if (!swp) -- return; -- -- swap(ve->siblings[swp], ve->siblings[0]); -- if (!intel_engine_has_relative_mmio(ve->siblings[0])) -- virtual_update_register_offsets(ve->context.lrc_reg_state, -- ve->siblings[0]); -+ if (swp) -+ swap(ve->siblings[swp], ve->siblings[0]); - } - - static int virtual_context_alloc(struct intel_context *ce) -@@ -4916,15 +4911,9 @@ static int virtual_context_alloc(struct intel_context *ce) - static int virtual_context_pin(struct intel_context *ce) - { - struct virtual_engine *ve = container_of(ce, typeof(*ve), context); -- int err; - - /* Note: we must use a real engine class for setting up reg state */ -- err = __execlists_context_pin(ce, ve->siblings[0]); -- if (err) -- return err; -- -- virtual_engine_initial_hint(ve); -- return 0; -+ return __execlists_context_pin(ce, ve->siblings[0]); - } - - static void virtual_context_enter(struct intel_context *ce) -@@ -5188,6 +5177,7 @@ intel_execlists_create_virtual(struct intel_engine_cs **siblings, - intel_engine_init_active(&ve->base, ENGINE_VIRTUAL); - intel_engine_init_breadcrumbs(&ve->base); - intel_engine_init_execlists(&ve->base); -+ ve->base.breadcrumbs.irq_armed = true; /* fake HW, used for irq_work */ - - ve->base.cops = &virtual_context_ops; - ve->base.request_alloc = execlists_request_alloc; -@@ -5269,6 +5259,7 @@ intel_execlists_create_virtual(struct intel_engine_cs **siblings, - - ve->base.flags |= I915_ENGINE_IS_VIRTUAL; - -+ virtual_engine_initial_hint(ve); - return &ve->context; - - err_put: -diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c -index 2faf50e1b051..6e7dc28455c4 100644 ---- a/drivers/gpu/drm/i915/gvt/handlers.c -+++ b/drivers/gpu/drm/i915/gvt/handlers.c -@@ -3131,8 +3131,8 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) - MMIO_DFH(GEN9_WM_CHICKEN3, D_SKL_PLUS, F_MODE_MASK | F_CMD_ACCESS, - NULL, NULL); - -- MMIO_D(GAMT_CHKN_BIT_REG, D_KBL); -- MMIO_D(GEN9_CTX_PREEMPT_REG, D_KBL | D_SKL); -+ MMIO_D(GAMT_CHKN_BIT_REG, D_KBL | D_CFL); -+ MMIO_D(GEN9_CTX_PREEMPT_REG, D_SKL_PLUS); - - return 0; - } -diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c -index cf2c01f17da8..803983d9a05d 100644 ---- a/drivers/gpu/drm/i915/i915_perf.c -+++ b/drivers/gpu/drm/i915/i915_perf.c -@@ -1645,6 +1645,7 @@ static u32 *save_restore_register(struct i915_perf_stream *stream, u32 *cs, - u32 d; - - cmd = save ? MI_STORE_REGISTER_MEM : MI_LOAD_REGISTER_MEM; -+ cmd |= MI_SRM_LRM_GLOBAL_GTT; - if (INTEL_GEN(stream->perf->i915) >= 8) - cmd++; - -diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c -index a2f6b688a976..932dd8c3c411 100644 ---- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c -+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c -@@ -2126,7 +2126,6 @@ int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc, - - dpu_enc = to_dpu_encoder_virt(enc); - -- mutex_init(&dpu_enc->enc_lock); - ret = dpu_encoder_setup_display(dpu_enc, dpu_kms, disp_info); - if (ret) - goto fail; -@@ -2141,7 +2140,6 @@ int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc, - 0); - - -- mutex_init(&dpu_enc->rc_lock); - INIT_DELAYED_WORK(&dpu_enc->delayed_off_work, - dpu_encoder_off_work); - dpu_enc->idle_timeout = IDLE_TIMEOUT; -@@ -2186,6 +2184,8 @@ struct drm_encoder *dpu_encoder_init(struct drm_device *dev, - - spin_lock_init(&dpu_enc->enc_spinlock); - dpu_enc->enabled = false; -+ mutex_init(&dpu_enc->enc_lock); -+ mutex_init(&dpu_enc->rc_lock); - - return &dpu_enc->base; - } -diff --git a/drivers/gpu/drm/msm/msm_submitqueue.c b/drivers/gpu/drm/msm/msm_submitqueue.c -index 001fbf537440..a1d94be7883a 100644 ---- a/drivers/gpu/drm/msm/msm_submitqueue.c -+++ b/drivers/gpu/drm/msm/msm_submitqueue.c -@@ -71,8 +71,10 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private *ctx, - queue->flags = flags; - - if (priv->gpu) { -- if (prio >= priv->gpu->nr_rings) -+ if (prio >= priv->gpu->nr_rings) { -+ kfree(queue); - return -EINVAL; -+ } - - queue->prio = prio; - } -diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c -index 9ffa9c75a5da..16b385629688 100644 ---- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c -+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c -@@ -1069,10 +1069,6 @@ vmw_stdu_primary_plane_prepare_fb(struct drm_plane *plane, - if (new_content_type != SAME_AS_DISPLAY) { - struct vmw_surface_metadata metadata = {0}; - -- metadata.base_size.width = hdisplay; -- metadata.base_size.height = vdisplay; -- metadata.base_size.depth = 1; -- - /* - * If content buffer is a buffer object, then we have to - * construct surface info -@@ -1104,6 +1100,10 @@ vmw_stdu_primary_plane_prepare_fb(struct drm_plane *plane, - metadata = new_vfbs->surface->metadata; - } - -+ metadata.base_size.width = hdisplay; -+ metadata.base_size.height = vdisplay; -+ metadata.base_size.depth = 1; -+ - if (vps->surf) { - struct drm_vmw_size cur_base_size = - vps->surf->metadata.base_size; -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h -index f03f1cc913ce..047abf731cf0 100644 ---- a/drivers/hid/hid-ids.h -+++ b/drivers/hid/hid-ids.h -@@ -624,6 +624,7 @@ - #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081 0xa081 - #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2 0xa0c2 - #define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A096 0xa096 -+#define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A293 0xa293 - - #define USB_VENDOR_ID_IMATION 0x0718 - #define USB_DEVICE_ID_DISC_STAKKA 0xd000 -@@ -1005,6 +1006,8 @@ - #define USB_DEVICE_ID_ROCCAT_RYOS_MK_PRO 0x3232 - #define USB_DEVICE_ID_ROCCAT_SAVU 0x2d5a - -+#define USB_VENDOR_ID_SAI 0x17dd -+ - #define USB_VENDOR_ID_SAITEK 0x06a3 - #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 - #define USB_DEVICE_ID_SAITEK_PS1000 0x0621 -diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c -index 094f4f1b6555..89d74cc264f9 100644 ---- a/drivers/hid/hid-logitech-hidpp.c -+++ b/drivers/hid/hid-logitech-hidpp.c -@@ -3146,7 +3146,7 @@ static int hi_res_scroll_enable(struct hidpp_device *hidpp) - multiplier = 1; - - hidpp->vertical_wheel_counter.wheel_multiplier = multiplier; -- hid_info(hidpp->hid_dev, "multiplier = %d\n", multiplier); -+ hid_dbg(hidpp->hid_dev, "wheel multiplier = %d\n", multiplier); - return 0; - } - -diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c -index 34138667f8af..abd86903875f 100644 ---- a/drivers/hid/hid-magicmouse.c -+++ b/drivers/hid/hid-magicmouse.c -@@ -535,6 +535,12 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd - __set_bit(MSC_RAW, input->mscbit); - } - -+ /* -+ * hid-input may mark device as using autorepeat, but neither -+ * the trackpad, nor the mouse actually want it. -+ */ -+ __clear_bit(EV_REP, input->evbit); -+ - return 0; - } - -diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c -index ca8b5c261c7c..934fc0a798d4 100644 ---- a/drivers/hid/hid-quirks.c -+++ b/drivers/hid/hid-quirks.c -@@ -88,6 +88,7 @@ static const struct hid_device_id hid_quirks[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING), HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, - { HID_USB_DEVICE(USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING), HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, - { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A096), HID_QUIRK_NO_INIT_REPORTS }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A293), HID_QUIRK_ALWAYS_POLL }, - { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A), HID_QUIRK_ALWAYS_POLL }, - { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A), HID_QUIRK_ALWAYS_POLL }, - { HID_USB_DEVICE(USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL }, -@@ -832,6 +833,7 @@ static const struct hid_device_id hid_ignore_list[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_PETZL, USB_DEVICE_ID_PETZL_HEADLAMP) }, - { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE) }, - { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) }, -+ { HID_USB_DEVICE(USB_VENDOR_ID_SAI, USB_DEVICE_ID_CYPRESS_HIDCOM) }, - #if IS_ENABLED(CONFIG_MOUSE_SYNAPTICS_USB) - { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP) }, - { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_INT_TP) }, -diff --git a/drivers/hwmon/drivetemp.c b/drivers/hwmon/drivetemp.c -index 0d4f3d97ffc6..72c760373957 100644 ---- a/drivers/hwmon/drivetemp.c -+++ b/drivers/hwmon/drivetemp.c -@@ -285,6 +285,42 @@ static int drivetemp_get_scttemp(struct drivetemp_data *st, u32 attr, long *val) - return err; - } - -+static const char * const sct_avoid_models[] = { -+/* -+ * These drives will have WRITE FPDMA QUEUED command timeouts and sometimes just -+ * freeze until power-cycled under heavy write loads when their temperature is -+ * getting polled in SCT mode. The SMART mode seems to be fine, though. -+ * -+ * While only the 3 TB model (DT01ACA3) was actually caught exhibiting the -+ * problem let's play safe here to avoid data corruption and ban the whole -+ * DT01ACAx family. -+ -+ * The models from this array are prefix-matched. -+ */ -+ "TOSHIBA DT01ACA", -+}; -+ -+static bool drivetemp_sct_avoid(struct drivetemp_data *st) -+{ -+ struct scsi_device *sdev = st->sdev; -+ unsigned int ctr; -+ -+ if (!sdev->model) -+ return false; -+ -+ /* -+ * The "model" field contains just the raw SCSI INQUIRY response -+ * "product identification" field, which has a width of 16 bytes. -+ * This field is space-filled, but is NOT NULL-terminated. -+ */ -+ for (ctr = 0; ctr < ARRAY_SIZE(sct_avoid_models); ctr++) -+ if (!strncmp(sdev->model, sct_avoid_models[ctr], -+ strlen(sct_avoid_models[ctr]))) -+ return true; -+ -+ return false; -+} -+ - static int drivetemp_identify_sata(struct drivetemp_data *st) - { - struct scsi_device *sdev = st->sdev; -@@ -326,6 +362,13 @@ static int drivetemp_identify_sata(struct drivetemp_data *st) - /* bail out if this is not a SATA device */ - if (!is_ata || !is_sata) - return -ENODEV; -+ -+ if (have_sct && drivetemp_sct_avoid(st)) { -+ dev_notice(&sdev->sdev_gendev, -+ "will avoid using SCT for temperature monitoring\n"); -+ have_sct = false; -+ } -+ - if (!have_sct) - goto skip_sct; - -diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c -index 491a570e8e50..924c02c1631d 100644 ---- a/drivers/hwmon/emc2103.c -+++ b/drivers/hwmon/emc2103.c -@@ -443,7 +443,7 @@ static ssize_t pwm1_enable_store(struct device *dev, - } - - result = read_u8_from_i2c(client, REG_FAN_CONF1, &conf_reg); -- if (result) { -+ if (result < 0) { - count = result; - goto err; - } -diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c -index a6d6c7a3abcb..d59e4b1e5ce5 100644 ---- a/drivers/hwtracing/coresight/coresight-etm4x.c -+++ b/drivers/hwtracing/coresight/coresight-etm4x.c -@@ -1399,18 +1399,57 @@ static struct notifier_block etm4_cpu_pm_nb = { - .notifier_call = etm4_cpu_pm_notify, - }; - --static int etm4_cpu_pm_register(void) -+/* Setup PM. Called with cpus locked. Deals with error conditions and counts */ -+static int etm4_pm_setup_cpuslocked(void) - { -- if (IS_ENABLED(CONFIG_CPU_PM)) -- return cpu_pm_register_notifier(&etm4_cpu_pm_nb); -+ int ret; - -- return 0; -+ if (etm4_count++) -+ return 0; -+ -+ ret = cpu_pm_register_notifier(&etm4_cpu_pm_nb); -+ if (ret) -+ goto reduce_count; -+ -+ ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ARM_CORESIGHT_STARTING, -+ "arm/coresight4:starting", -+ etm4_starting_cpu, etm4_dying_cpu); -+ -+ if (ret) -+ goto unregister_notifier; -+ -+ ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ONLINE_DYN, -+ "arm/coresight4:online", -+ etm4_online_cpu, NULL); -+ -+ /* HP dyn state ID returned in ret on success */ -+ if (ret > 0) { -+ hp_online = ret; -+ return 0; -+ } -+ -+ /* failed dyn state - remove others */ -+ cpuhp_remove_state_nocalls_cpuslocked(CPUHP_AP_ARM_CORESIGHT_STARTING); -+ -+unregister_notifier: -+ cpu_pm_unregister_notifier(&etm4_cpu_pm_nb); -+ -+reduce_count: -+ --etm4_count; -+ return ret; - } - --static void etm4_cpu_pm_unregister(void) -+static void etm4_pm_clear(void) - { -- if (IS_ENABLED(CONFIG_CPU_PM)) -- cpu_pm_unregister_notifier(&etm4_cpu_pm_nb); -+ if (--etm4_count != 0) -+ return; -+ -+ cpu_pm_unregister_notifier(&etm4_cpu_pm_nb); -+ cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING); -+ if (hp_online) { -+ cpuhp_remove_state_nocalls(hp_online); -+ hp_online = 0; -+ } - } - - static int etm4_probe(struct amba_device *adev, const struct amba_id *id) -@@ -1464,24 +1503,15 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) - etm4_init_arch_data, drvdata, 1)) - dev_err(dev, "ETM arch init failed\n"); - -- if (!etm4_count++) { -- cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ARM_CORESIGHT_STARTING, -- "arm/coresight4:starting", -- etm4_starting_cpu, etm4_dying_cpu); -- ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ONLINE_DYN, -- "arm/coresight4:online", -- etm4_online_cpu, NULL); -- if (ret < 0) -- goto err_arch_supported; -- hp_online = ret; -+ ret = etm4_pm_setup_cpuslocked(); -+ cpus_read_unlock(); - -- ret = etm4_cpu_pm_register(); -- if (ret) -- goto err_arch_supported; -+ /* etm4_pm_setup_cpuslocked() does its own cleanup - exit on error */ -+ if (ret) { -+ etmdrvdata[drvdata->cpu] = NULL; -+ return ret; - } - -- cpus_read_unlock(); -- - if (etm4_arch_supported(drvdata->arch) == false) { - ret = -EINVAL; - goto err_arch_supported; -@@ -1528,13 +1558,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) - - err_arch_supported: - etmdrvdata[drvdata->cpu] = NULL; -- if (--etm4_count == 0) { -- etm4_cpu_pm_unregister(); -- -- cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING); -- if (hp_online) -- cpuhp_remove_state_nocalls(hp_online); -- } -+ etm4_pm_clear(); - return ret; - } - -diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c -index ca232ec565e8..c9ac3dc65113 100644 ---- a/drivers/hwtracing/intel_th/core.c -+++ b/drivers/hwtracing/intel_th/core.c -@@ -1021,15 +1021,30 @@ int intel_th_set_output(struct intel_th_device *thdev, - { - struct intel_th_device *hub = to_intel_th_hub(thdev); - struct intel_th_driver *hubdrv = to_intel_th_driver(hub->dev.driver); -+ int ret; - - /* In host mode, this is up to the external debugger, do nothing. */ - if (hub->host_mode) - return 0; - -- if (!hubdrv->set_output) -- return -ENOTSUPP; -+ /* -+ * hub is instantiated together with the source device that -+ * calls here, so guaranteed to be present. -+ */ -+ hubdrv = to_intel_th_driver(hub->dev.driver); -+ if (!hubdrv || !try_module_get(hubdrv->driver.owner)) -+ return -EINVAL; -+ -+ if (!hubdrv->set_output) { -+ ret = -ENOTSUPP; -+ goto out; -+ } -+ -+ ret = hubdrv->set_output(hub, master); - -- return hubdrv->set_output(hub, master); -+out: -+ module_put(hubdrv->driver.owner); -+ return ret; - } - EXPORT_SYMBOL_GPL(intel_th_set_output); - -diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c -index 7ccac74553a6..21fdf0b93516 100644 ---- a/drivers/hwtracing/intel_th/pci.c -+++ b/drivers/hwtracing/intel_th/pci.c -@@ -233,11 +233,21 @@ static const struct pci_device_id intel_th_pci_id_table[] = { - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa0a6), - .driver_data = (kernel_ulong_t)&intel_th_2x, - }, -+ { -+ /* Tiger Lake PCH-H */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x43a6), -+ .driver_data = (kernel_ulong_t)&intel_th_2x, -+ }, - { - /* Jasper Lake PCH */ - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4da6), - .driver_data = (kernel_ulong_t)&intel_th_2x, - }, -+ { -+ /* Jasper Lake CPU */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4e29), -+ .driver_data = (kernel_ulong_t)&intel_th_2x, -+ }, - { - /* Elkhart Lake CPU */ - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4529), -@@ -248,6 +258,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4b26), - .driver_data = (kernel_ulong_t)&intel_th_2x, - }, -+ { -+ /* Emmitsburg PCH */ -+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x1bcc), -+ .driver_data = (kernel_ulong_t)&intel_th_2x, -+ }, - { 0 }, - }; - -diff --git a/drivers/hwtracing/intel_th/sth.c b/drivers/hwtracing/intel_th/sth.c -index 3a1f4e650378..a1529f571491 100644 ---- a/drivers/hwtracing/intel_th/sth.c -+++ b/drivers/hwtracing/intel_th/sth.c -@@ -161,9 +161,7 @@ static int sth_stm_link(struct stm_data *stm_data, unsigned int master, - { - struct sth_device *sth = container_of(stm_data, struct sth_device, stm); - -- intel_th_set_output(to_intel_th_device(sth->dev), master); -- -- return 0; -+ return intel_th_set_output(to_intel_th_device(sth->dev), master); - } - - static int intel_th_sw_init(struct sth_device *sth) -diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c -index bb810dee8fb5..73f139690e4e 100644 ---- a/drivers/i2c/busses/i2c-eg20t.c -+++ b/drivers/i2c/busses/i2c-eg20t.c -@@ -180,6 +180,7 @@ static const struct pci_device_id pch_pcidev_id[] = { - { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7831_I2C), 1, }, - {0,} - }; -+MODULE_DEVICE_TABLE(pci, pch_pcidev_id); - - static irqreturn_t pch_i2c_handler(int irq, void *pData); - -diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c -index 00e100fc845a..813bca7cfc3e 100644 ---- a/drivers/iio/accel/mma8452.c -+++ b/drivers/iio/accel/mma8452.c -@@ -1685,10 +1685,13 @@ static int mma8452_probe(struct i2c_client *client, - - ret = mma8452_set_freefall_mode(data, false); - if (ret < 0) -- goto buffer_cleanup; -+ goto unregister_device; - - return 0; - -+unregister_device: -+ iio_device_unregister(indio_dev); -+ - buffer_cleanup: - iio_triggered_buffer_cleanup(indio_dev); - -diff --git a/drivers/iio/adc/ad7780.c b/drivers/iio/adc/ad7780.c -index 291c1a898129..643771ed3f83 100644 ---- a/drivers/iio/adc/ad7780.c -+++ b/drivers/iio/adc/ad7780.c -@@ -310,7 +310,7 @@ static int ad7780_probe(struct spi_device *spi) - - ret = ad7780_init_gpios(&spi->dev, st); - if (ret) -- goto error_cleanup_buffer_and_trigger; -+ return ret; - - st->reg = devm_regulator_get(&spi->dev, "avdd"); - if (IS_ERR(st->reg)) -diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c -index dc22dc363a99..29104656a537 100644 ---- a/drivers/iio/health/afe4403.c -+++ b/drivers/iio/health/afe4403.c -@@ -63,6 +63,7 @@ static const struct reg_field afe4403_reg_fields[] = { - * @regulator: Pointer to the regulator for the IC - * @trig: IIO trigger for this device - * @irq: ADC_RDY line interrupt number -+ * @buffer: Used to construct data layout to push into IIO buffer. - */ - struct afe4403_data { - struct device *dev; -@@ -72,6 +73,8 @@ struct afe4403_data { - struct regulator *regulator; - struct iio_trigger *trig; - int irq; -+ /* Ensure suitable alignment for timestamp */ -+ s32 buffer[8] __aligned(8); - }; - - enum afe4403_chan_id { -@@ -309,7 +312,6 @@ static irqreturn_t afe4403_trigger_handler(int irq, void *private) - struct iio_dev *indio_dev = pf->indio_dev; - struct afe4403_data *afe = iio_priv(indio_dev); - int ret, bit, i = 0; -- s32 buffer[8]; - u8 tx[4] = {AFE440X_CONTROL0, 0x0, 0x0, AFE440X_CONTROL0_READ}; - u8 rx[3]; - -@@ -326,9 +328,9 @@ static irqreturn_t afe4403_trigger_handler(int irq, void *private) - if (ret) - goto err; - -- buffer[i++] = (rx[0] << 16) | -- (rx[1] << 8) | -- (rx[2]); -+ afe->buffer[i++] = (rx[0] << 16) | -+ (rx[1] << 8) | -+ (rx[2]); - } - - /* Disable reading from the device */ -@@ -337,7 +339,8 @@ static irqreturn_t afe4403_trigger_handler(int irq, void *private) - if (ret) - goto err; - -- iio_push_to_buffers_with_timestamp(indio_dev, buffer, pf->timestamp); -+ iio_push_to_buffers_with_timestamp(indio_dev, afe->buffer, -+ pf->timestamp); - err: - iio_trigger_notify_done(indio_dev->trig); - -diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c -index e728bbb21ca8..cebb1fd4d0b1 100644 ---- a/drivers/iio/health/afe4404.c -+++ b/drivers/iio/health/afe4404.c -@@ -83,6 +83,7 @@ static const struct reg_field afe4404_reg_fields[] = { - * @regulator: Pointer to the regulator for the IC - * @trig: IIO trigger for this device - * @irq: ADC_RDY line interrupt number -+ * @buffer: Used to construct a scan to push to the iio buffer. - */ - struct afe4404_data { - struct device *dev; -@@ -91,6 +92,7 @@ struct afe4404_data { - struct regulator *regulator; - struct iio_trigger *trig; - int irq; -+ s32 buffer[10] __aligned(8); - }; - - enum afe4404_chan_id { -@@ -328,17 +330,17 @@ static irqreturn_t afe4404_trigger_handler(int irq, void *private) - struct iio_dev *indio_dev = pf->indio_dev; - struct afe4404_data *afe = iio_priv(indio_dev); - int ret, bit, i = 0; -- s32 buffer[10]; - - for_each_set_bit(bit, indio_dev->active_scan_mask, - indio_dev->masklength) { - ret = regmap_read(afe->regmap, afe4404_channel_values[bit], -- &buffer[i++]); -+ &afe->buffer[i++]); - if (ret) - goto err; - } - -- iio_push_to_buffers_with_timestamp(indio_dev, buffer, pf->timestamp); -+ iio_push_to_buffers_with_timestamp(indio_dev, afe->buffer, -+ pf->timestamp); - err: - iio_trigger_notify_done(indio_dev->trig); - -diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c -index 7ecd2ffa3132..665eb7e38293 100644 ---- a/drivers/iio/humidity/hdc100x.c -+++ b/drivers/iio/humidity/hdc100x.c -@@ -38,6 +38,11 @@ struct hdc100x_data { - - /* integration time of the sensor */ - int adc_int_us[2]; -+ /* Ensure natural alignment of timestamp */ -+ struct { -+ __be16 channels[2]; -+ s64 ts __aligned(8); -+ } scan; - }; - - /* integration time in us */ -@@ -322,7 +327,6 @@ static irqreturn_t hdc100x_trigger_handler(int irq, void *p) - struct i2c_client *client = data->client; - int delay = data->adc_int_us[0] + data->adc_int_us[1]; - int ret; -- s16 buf[8]; /* 2x s16 + padding + 8 byte timestamp */ - - /* dual read starts at temp register */ - mutex_lock(&data->lock); -@@ -333,13 +337,13 @@ static irqreturn_t hdc100x_trigger_handler(int irq, void *p) - } - usleep_range(delay, delay + 1000); - -- ret = i2c_master_recv(client, (u8 *)buf, 4); -+ ret = i2c_master_recv(client, (u8 *)data->scan.channels, 4); - if (ret < 0) { - dev_err(&client->dev, "cannot read sensor data\n"); - goto err; - } - -- iio_push_to_buffers_with_timestamp(indio_dev, buf, -+ iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, - iio_get_time_ns(indio_dev)); - err: - mutex_unlock(&data->lock); -diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h -index 7d6771f7cf47..b2eb5abeaccd 100644 ---- a/drivers/iio/humidity/hts221.h -+++ b/drivers/iio/humidity/hts221.h -@@ -14,8 +14,6 @@ - - #include - --#define HTS221_DATA_SIZE 2 -- - enum hts221_sensor_type { - HTS221_SENSOR_H, - HTS221_SENSOR_T, -@@ -39,6 +37,11 @@ struct hts221_hw { - - bool enabled; - u8 odr; -+ /* Ensure natural alignment of timestamp */ -+ struct { -+ __le16 channels[2]; -+ s64 ts __aligned(8); -+ } scan; - }; - - extern const struct dev_pm_ops hts221_pm_ops; -diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c -index 81d50a861c22..49dcd36d8838 100644 ---- a/drivers/iio/humidity/hts221_buffer.c -+++ b/drivers/iio/humidity/hts221_buffer.c -@@ -162,7 +162,6 @@ static const struct iio_buffer_setup_ops hts221_buffer_ops = { - - static irqreturn_t hts221_buffer_handler_thread(int irq, void *p) - { -- u8 buffer[ALIGN(2 * HTS221_DATA_SIZE, sizeof(s64)) + sizeof(s64)]; - struct iio_poll_func *pf = p; - struct iio_dev *iio_dev = pf->indio_dev; - struct hts221_hw *hw = iio_priv(iio_dev); -@@ -172,18 +171,20 @@ static irqreturn_t hts221_buffer_handler_thread(int irq, void *p) - /* humidity data */ - ch = &iio_dev->channels[HTS221_SENSOR_H]; - err = regmap_bulk_read(hw->regmap, ch->address, -- buffer, HTS221_DATA_SIZE); -+ &hw->scan.channels[0], -+ sizeof(hw->scan.channels[0])); - if (err < 0) - goto out; - - /* temperature data */ - ch = &iio_dev->channels[HTS221_SENSOR_T]; - err = regmap_bulk_read(hw->regmap, ch->address, -- buffer + HTS221_DATA_SIZE, HTS221_DATA_SIZE); -+ &hw->scan.channels[1], -+ sizeof(hw->scan.channels[1])); - if (err < 0) - goto out; - -- iio_push_to_buffers_with_timestamp(iio_dev, buffer, -+ iio_push_to_buffers_with_timestamp(iio_dev, &hw->scan, - iio_get_time_ns(iio_dev)); - - out: -diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c -index 24f7bbff4938..c6e36411053b 100644 ---- a/drivers/iio/industrialio-core.c -+++ b/drivers/iio/industrialio-core.c -@@ -130,6 +130,8 @@ static const char * const iio_modifier_names[] = { - [IIO_MOD_PM2P5] = "pm2p5", - [IIO_MOD_PM4] = "pm4", - [IIO_MOD_PM10] = "pm10", -+ [IIO_MOD_ETHANOL] = "ethanol", -+ [IIO_MOD_H2] = "h2", - }; - - /* relies on pairs of these shared then separate */ -diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c -index d32996702110..87c15a63c1a4 100644 ---- a/drivers/iio/magnetometer/ak8974.c -+++ b/drivers/iio/magnetometer/ak8974.c -@@ -185,6 +185,11 @@ struct ak8974 { - bool drdy_irq; - struct completion drdy_complete; - bool drdy_active_low; -+ /* Ensure timestamp is naturally aligned */ -+ struct { -+ __le16 channels[3]; -+ s64 ts __aligned(8); -+ } scan; - }; - - static const char ak8974_reg_avdd[] = "avdd"; -@@ -581,7 +586,6 @@ static void ak8974_fill_buffer(struct iio_dev *indio_dev) - { - struct ak8974 *ak8974 = iio_priv(indio_dev); - int ret; -- __le16 hw_values[8]; /* Three axes + 64bit padding */ - - pm_runtime_get_sync(&ak8974->i2c->dev); - mutex_lock(&ak8974->lock); -@@ -591,13 +595,13 @@ static void ak8974_fill_buffer(struct iio_dev *indio_dev) - dev_err(&ak8974->i2c->dev, "error triggering measure\n"); - goto out_unlock; - } -- ret = ak8974_getresult(ak8974, hw_values); -+ ret = ak8974_getresult(ak8974, ak8974->scan.channels); - if (ret) { - dev_err(&ak8974->i2c->dev, "error getting measures\n"); - goto out_unlock; - } - -- iio_push_to_buffers_with_timestamp(indio_dev, hw_values, -+ iio_push_to_buffers_with_timestamp(indio_dev, &ak8974->scan, - iio_get_time_ns(indio_dev)); - - out_unlock: -@@ -764,19 +768,21 @@ static int ak8974_probe(struct i2c_client *i2c, - ak8974->map = devm_regmap_init_i2c(i2c, &ak8974_regmap_config); - if (IS_ERR(ak8974->map)) { - dev_err(&i2c->dev, "failed to allocate register map\n"); -+ pm_runtime_put_noidle(&i2c->dev); -+ pm_runtime_disable(&i2c->dev); - return PTR_ERR(ak8974->map); - } - - ret = ak8974_set_power(ak8974, AK8974_PWR_ON); - if (ret) { - dev_err(&i2c->dev, "could not power on\n"); -- goto power_off; -+ goto disable_pm; - } - - ret = ak8974_detect(ak8974); - if (ret) { - dev_err(&i2c->dev, "neither AK8974 nor AMI30x found\n"); -- goto power_off; -+ goto disable_pm; - } - - ret = ak8974_selftest(ak8974); -@@ -786,14 +792,9 @@ static int ak8974_probe(struct i2c_client *i2c, - ret = ak8974_reset(ak8974); - if (ret) { - dev_err(&i2c->dev, "AK8974 reset failed\n"); -- goto power_off; -+ goto disable_pm; - } - -- pm_runtime_set_autosuspend_delay(&i2c->dev, -- AK8974_AUTOSUSPEND_DELAY); -- pm_runtime_use_autosuspend(&i2c->dev); -- pm_runtime_put(&i2c->dev); -- - indio_dev->dev.parent = &i2c->dev; - indio_dev->channels = ak8974_channels; - indio_dev->num_channels = ARRAY_SIZE(ak8974_channels); -@@ -846,6 +847,11 @@ no_irq: - goto cleanup_buffer; - } - -+ pm_runtime_set_autosuspend_delay(&i2c->dev, -+ AK8974_AUTOSUSPEND_DELAY); -+ pm_runtime_use_autosuspend(&i2c->dev); -+ pm_runtime_put(&i2c->dev); -+ - return 0; - - cleanup_buffer: -@@ -854,7 +860,6 @@ disable_pm: - pm_runtime_put_noidle(&i2c->dev); - pm_runtime_disable(&i2c->dev); - ak8974_set_power(ak8974, AK8974_PWR_OFF); --power_off: - regulator_bulk_disable(ARRAY_SIZE(ak8974->regs), ak8974->regs); - - return ret; -diff --git a/drivers/iio/pressure/ms5611_core.c b/drivers/iio/pressure/ms5611_core.c -index 2f598ad91621..f5db9fa086f3 100644 ---- a/drivers/iio/pressure/ms5611_core.c -+++ b/drivers/iio/pressure/ms5611_core.c -@@ -212,16 +212,21 @@ static irqreturn_t ms5611_trigger_handler(int irq, void *p) - struct iio_poll_func *pf = p; - struct iio_dev *indio_dev = pf->indio_dev; - struct ms5611_state *st = iio_priv(indio_dev); -- s32 buf[4]; /* s32 (pressure) + s32 (temp) + 2 * s32 (timestamp) */ -+ /* Ensure buffer elements are naturally aligned */ -+ struct { -+ s32 channels[2]; -+ s64 ts __aligned(8); -+ } scan; - int ret; - - mutex_lock(&st->lock); -- ret = ms5611_read_temp_and_pressure(indio_dev, &buf[1], &buf[0]); -+ ret = ms5611_read_temp_and_pressure(indio_dev, &scan.channels[1], -+ &scan.channels[0]); - mutex_unlock(&st->lock); - if (ret < 0) - goto err; - -- iio_push_to_buffers_with_timestamp(indio_dev, buf, -+ iio_push_to_buffers_with_timestamp(indio_dev, &scan, - iio_get_time_ns(indio_dev)); - - err: -diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c -index 99dfe33ee402..245f2e2d412b 100644 ---- a/drivers/iio/pressure/zpa2326.c -+++ b/drivers/iio/pressure/zpa2326.c -@@ -664,8 +664,10 @@ static int zpa2326_resume(const struct iio_dev *indio_dev) - int err; - - err = pm_runtime_get_sync(indio_dev->dev.parent); -- if (err < 0) -+ if (err < 0) { -+ pm_runtime_put(indio_dev->dev.parent); - return err; -+ } - - if (err > 0) { - /* -diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c -index 2210759843ba..c3521ace4d25 100644 ---- a/drivers/infiniband/hw/mlx5/qp.c -+++ b/drivers/infiniband/hw/mlx5/qp.c -@@ -1525,6 +1525,8 @@ static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, - u16 uid = to_mpd(pd)->uid; - u32 out[MLX5_ST_SZ_DW(create_tir_out)] = {}; - -+ if (!qp->sq.wqe_cnt && !qp->rq.wqe_cnt) -+ return -EINVAL; - if (qp->sq.wqe_cnt) { - err = create_raw_packet_qp_tis(dev, qp, sq, tdn, pd); - if (err) -diff --git a/drivers/infiniband/sw/rxe/rxe.c b/drivers/infiniband/sw/rxe/rxe.c -index 4afdd2e20883..5642eefb4ba1 100644 ---- a/drivers/infiniband/sw/rxe/rxe.c -+++ b/drivers/infiniband/sw/rxe/rxe.c -@@ -77,6 +77,7 @@ static void rxe_init_device_param(struct rxe_dev *rxe) - { - rxe->max_inline_data = RXE_MAX_INLINE_DATA; - -+ rxe->attr.vendor_id = RXE_VENDOR_ID; - rxe->attr.max_mr_size = RXE_MAX_MR_SIZE; - rxe->attr.page_size_cap = RXE_PAGE_SIZE_CAP; - rxe->attr.max_qp = RXE_MAX_QP; -diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h -index f59616b02477..99e9d8ba9767 100644 ---- a/drivers/infiniband/sw/rxe/rxe_param.h -+++ b/drivers/infiniband/sw/rxe/rxe_param.h -@@ -127,6 +127,9 @@ enum rxe_device_param { - - /* Delay before calling arbiter timer */ - RXE_NSEC_ARB_TIMER_DELAY = 200, -+ -+ /* IBTA v1.4 A3.3.1 VENDOR INFORMATION section */ -+ RXE_VENDOR_ID = 0XFFFFFF, - }; - - /* default/initial rxe port parameters */ -diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h -index 7e048b557462..858a26302198 100644 ---- a/drivers/input/serio/i8042-x86ia64io.h -+++ b/drivers/input/serio/i8042-x86ia64io.h -@@ -425,6 +425,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { - DMI_MATCH(DMI_PRODUCT_NAME, "076804U"), - }, - }, -+ { -+ /* Lenovo XiaoXin Air 12 */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "80UN"), -+ }, -+ }, - { - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Acer"), -diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c -index 2289f9638116..5b14a4a87c40 100644 ---- a/drivers/input/touchscreen/elants_i2c.c -+++ b/drivers/input/touchscreen/elants_i2c.c -@@ -1318,7 +1318,6 @@ static int elants_i2c_probe(struct i2c_client *client, - 0, MT_TOOL_PALM, 0, 0); - input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res); - input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res); -- input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, 1); - - error = input_register_device(ts->input); - if (error) { -diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c -index 2ef1adaed9af..5bdf4ac1a303 100644 ---- a/drivers/input/touchscreen/mms114.c -+++ b/drivers/input/touchscreen/mms114.c -@@ -54,6 +54,7 @@ - enum mms_type { - TYPE_MMS114 = 114, - TYPE_MMS152 = 152, -+ TYPE_MMS345L = 345, - }; - - struct mms114_data { -@@ -250,6 +251,15 @@ static int mms114_get_version(struct mms114_data *data) - int error; - - switch (data->type) { -+ case TYPE_MMS345L: -+ error = __mms114_read_reg(data, MMS152_FW_REV, 3, buf); -+ if (error) -+ return error; -+ -+ dev_info(dev, "TSP FW Rev: bootloader 0x%x / core 0x%x / config 0x%x\n", -+ buf[0], buf[1], buf[2]); -+ break; -+ - case TYPE_MMS152: - error = __mms114_read_reg(data, MMS152_FW_REV, 3, buf); - if (error) -@@ -287,8 +297,8 @@ static int mms114_setup_regs(struct mms114_data *data) - if (error < 0) - return error; - -- /* MMS152 has no configuration or power on registers */ -- if (data->type == TYPE_MMS152) -+ /* Only MMS114 has configuration and power on registers */ -+ if (data->type != TYPE_MMS114) - return 0; - - error = mms114_set_active(data, true); -@@ -597,6 +607,9 @@ static const struct of_device_id mms114_dt_match[] = { - }, { - .compatible = "melfas,mms152", - .data = (void *)TYPE_MMS152, -+ }, { -+ .compatible = "melfas,mms345l", -+ .data = (void *)TYPE_MMS345L, - }, - { } - }; -diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig -index 2ab07ce17abb..432f3ff080c9 100644 ---- a/drivers/iommu/Kconfig -+++ b/drivers/iommu/Kconfig -@@ -211,7 +211,7 @@ config INTEL_IOMMU_DEBUGFS - - config INTEL_IOMMU_SVM - bool "Support for Shared Virtual Memory with Intel IOMMU" -- depends on INTEL_IOMMU && X86 -+ depends on INTEL_IOMMU && X86_64 - select PCI_PASID - select PCI_PRI - select MMU_NOTIFIER -diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c -index ab4144ea1f11..d6cd5537126c 100644 ---- a/drivers/misc/atmel-ssc.c -+++ b/drivers/misc/atmel-ssc.c -@@ -10,7 +10,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -@@ -20,7 +20,7 @@ - #include "../../sound/soc/atmel/atmel_ssc_dai.h" - - /* Serialize access to ssc_list and user count */ --static DEFINE_SPINLOCK(user_lock); -+static DEFINE_MUTEX(user_lock); - static LIST_HEAD(ssc_list); - - struct ssc_device *ssc_request(unsigned int ssc_num) -@@ -28,7 +28,7 @@ struct ssc_device *ssc_request(unsigned int ssc_num) - int ssc_valid = 0; - struct ssc_device *ssc; - -- spin_lock(&user_lock); -+ mutex_lock(&user_lock); - list_for_each_entry(ssc, &ssc_list, list) { - if (ssc->pdev->dev.of_node) { - if (of_alias_get_id(ssc->pdev->dev.of_node, "ssc") -@@ -44,18 +44,18 @@ struct ssc_device *ssc_request(unsigned int ssc_num) - } - - if (!ssc_valid) { -- spin_unlock(&user_lock); -+ mutex_unlock(&user_lock); - pr_err("ssc: ssc%d platform device is missing\n", ssc_num); - return ERR_PTR(-ENODEV); - } - - if (ssc->user) { -- spin_unlock(&user_lock); -+ mutex_unlock(&user_lock); - dev_dbg(&ssc->pdev->dev, "module busy\n"); - return ERR_PTR(-EBUSY); - } - ssc->user++; -- spin_unlock(&user_lock); -+ mutex_unlock(&user_lock); - - clk_prepare(ssc->clk); - -@@ -67,14 +67,14 @@ void ssc_free(struct ssc_device *ssc) - { - bool disable_clk = true; - -- spin_lock(&user_lock); -+ mutex_lock(&user_lock); - if (ssc->user) - ssc->user--; - else { - disable_clk = false; - dev_dbg(&ssc->pdev->dev, "device already free\n"); - } -- spin_unlock(&user_lock); -+ mutex_unlock(&user_lock); - - if (disable_clk) - clk_unprepare(ssc->clk); -@@ -237,9 +237,9 @@ static int ssc_probe(struct platform_device *pdev) - return -ENXIO; - } - -- spin_lock(&user_lock); -+ mutex_lock(&user_lock); - list_add_tail(&ssc->list, &ssc_list); -- spin_unlock(&user_lock); -+ mutex_unlock(&user_lock); - - platform_set_drvdata(pdev, ssc); - -@@ -258,9 +258,9 @@ static int ssc_remove(struct platform_device *pdev) - - ssc_sound_dai_remove(ssc); - -- spin_lock(&user_lock); -+ mutex_lock(&user_lock); - list_del(&ssc->list); -- spin_unlock(&user_lock); -+ mutex_unlock(&user_lock); - - return 0; - } -diff --git a/drivers/misc/habanalabs/goya/goya_security.c b/drivers/misc/habanalabs/goya/goya_security.c -index d6ec12b3e692..08fc89ea0a0c 100644 ---- a/drivers/misc/habanalabs/goya/goya_security.c -+++ b/drivers/misc/habanalabs/goya/goya_security.c -@@ -695,7 +695,6 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - mask |= 1 << ((mmTPC0_CFG_CFG_SUBTRACT_VALUE & 0x7F) >> 2); - mask |= 1 << ((mmTPC0_CFG_SM_BASE_ADDRESS_LOW & 0x7F) >> 2); - mask |= 1 << ((mmTPC0_CFG_SM_BASE_ADDRESS_HIGH & 0x7F) >> 2); -- mask |= 1 << ((mmTPC0_CFG_CFG_SUBTRACT_VALUE & 0x7F) >> 2); - mask |= 1 << ((mmTPC0_CFG_TPC_STALL & 0x7F) >> 2); - mask |= 1 << ((mmTPC0_CFG_MSS_CONFIG & 0x7F) >> 2); - mask |= 1 << ((mmTPC0_CFG_TPC_INTR_CAUSE & 0x7F) >> 2); -@@ -875,6 +874,16 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - goya_pb_set_block(hdev, mmTPC1_RD_REGULATOR_BASE); - goya_pb_set_block(hdev, mmTPC1_WR_REGULATOR_BASE); - -+ pb_addr = (mmTPC1_CFG_SEMAPHORE & ~0xFFF) + PROT_BITS_OFFS; -+ word_offset = ((mmTPC1_CFG_SEMAPHORE & PROT_BITS_OFFS) >> 7) << 2; -+ -+ mask = 1 << ((mmTPC1_CFG_SEMAPHORE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC1_CFG_VFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC1_CFG_SFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC1_CFG_STATUS & 0x7F) >> 2); -+ -+ WREG32(pb_addr + word_offset, ~mask); -+ - pb_addr = (mmTPC1_CFG_CFG_BASE_ADDRESS_HIGH & ~0xFFF) + PROT_BITS_OFFS; - word_offset = ((mmTPC1_CFG_CFG_BASE_ADDRESS_HIGH & - PROT_BITS_OFFS) >> 7) << 2; -@@ -882,6 +891,10 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - mask |= 1 << ((mmTPC1_CFG_CFG_SUBTRACT_VALUE & 0x7F) >> 2); - mask |= 1 << ((mmTPC1_CFG_SM_BASE_ADDRESS_LOW & 0x7F) >> 2); - mask |= 1 << ((mmTPC1_CFG_SM_BASE_ADDRESS_HIGH & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC1_CFG_TPC_STALL & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC1_CFG_MSS_CONFIG & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC1_CFG_TPC_INTR_CAUSE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC1_CFG_TPC_INTR_MASK & 0x7F) >> 2); - - WREG32(pb_addr + word_offset, ~mask); - -@@ -1057,6 +1070,16 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - goya_pb_set_block(hdev, mmTPC2_RD_REGULATOR_BASE); - goya_pb_set_block(hdev, mmTPC2_WR_REGULATOR_BASE); - -+ pb_addr = (mmTPC2_CFG_SEMAPHORE & ~0xFFF) + PROT_BITS_OFFS; -+ word_offset = ((mmTPC2_CFG_SEMAPHORE & PROT_BITS_OFFS) >> 7) << 2; -+ -+ mask = 1 << ((mmTPC2_CFG_SEMAPHORE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC2_CFG_VFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC2_CFG_SFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC2_CFG_STATUS & 0x7F) >> 2); -+ -+ WREG32(pb_addr + word_offset, ~mask); -+ - pb_addr = (mmTPC2_CFG_CFG_BASE_ADDRESS_HIGH & ~0xFFF) + PROT_BITS_OFFS; - word_offset = ((mmTPC2_CFG_CFG_BASE_ADDRESS_HIGH & - PROT_BITS_OFFS) >> 7) << 2; -@@ -1064,6 +1087,10 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - mask |= 1 << ((mmTPC2_CFG_CFG_SUBTRACT_VALUE & 0x7F) >> 2); - mask |= 1 << ((mmTPC2_CFG_SM_BASE_ADDRESS_LOW & 0x7F) >> 2); - mask |= 1 << ((mmTPC2_CFG_SM_BASE_ADDRESS_HIGH & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC2_CFG_TPC_STALL & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC2_CFG_MSS_CONFIG & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC2_CFG_TPC_INTR_CAUSE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC2_CFG_TPC_INTR_MASK & 0x7F) >> 2); - - WREG32(pb_addr + word_offset, ~mask); - -@@ -1239,6 +1266,16 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - goya_pb_set_block(hdev, mmTPC3_RD_REGULATOR_BASE); - goya_pb_set_block(hdev, mmTPC3_WR_REGULATOR_BASE); - -+ pb_addr = (mmTPC3_CFG_SEMAPHORE & ~0xFFF) + PROT_BITS_OFFS; -+ word_offset = ((mmTPC3_CFG_SEMAPHORE & PROT_BITS_OFFS) >> 7) << 2; -+ -+ mask = 1 << ((mmTPC3_CFG_SEMAPHORE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC3_CFG_VFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC3_CFG_SFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC3_CFG_STATUS & 0x7F) >> 2); -+ -+ WREG32(pb_addr + word_offset, ~mask); -+ - pb_addr = (mmTPC3_CFG_CFG_BASE_ADDRESS_HIGH & ~0xFFF) + PROT_BITS_OFFS; - word_offset = ((mmTPC3_CFG_CFG_BASE_ADDRESS_HIGH - & PROT_BITS_OFFS) >> 7) << 2; -@@ -1246,6 +1283,10 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - mask |= 1 << ((mmTPC3_CFG_CFG_SUBTRACT_VALUE & 0x7F) >> 2); - mask |= 1 << ((mmTPC3_CFG_SM_BASE_ADDRESS_LOW & 0x7F) >> 2); - mask |= 1 << ((mmTPC3_CFG_SM_BASE_ADDRESS_HIGH & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC3_CFG_TPC_STALL & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC3_CFG_MSS_CONFIG & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC3_CFG_TPC_INTR_CAUSE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC3_CFG_TPC_INTR_MASK & 0x7F) >> 2); - - WREG32(pb_addr + word_offset, ~mask); - -@@ -1421,6 +1462,16 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - goya_pb_set_block(hdev, mmTPC4_RD_REGULATOR_BASE); - goya_pb_set_block(hdev, mmTPC4_WR_REGULATOR_BASE); - -+ pb_addr = (mmTPC4_CFG_SEMAPHORE & ~0xFFF) + PROT_BITS_OFFS; -+ word_offset = ((mmTPC4_CFG_SEMAPHORE & PROT_BITS_OFFS) >> 7) << 2; -+ -+ mask = 1 << ((mmTPC4_CFG_SEMAPHORE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC4_CFG_VFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC4_CFG_SFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC4_CFG_STATUS & 0x7F) >> 2); -+ -+ WREG32(pb_addr + word_offset, ~mask); -+ - pb_addr = (mmTPC4_CFG_CFG_BASE_ADDRESS_HIGH & ~0xFFF) + PROT_BITS_OFFS; - word_offset = ((mmTPC4_CFG_CFG_BASE_ADDRESS_HIGH & - PROT_BITS_OFFS) >> 7) << 2; -@@ -1428,6 +1479,10 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - mask |= 1 << ((mmTPC4_CFG_CFG_SUBTRACT_VALUE & 0x7F) >> 2); - mask |= 1 << ((mmTPC4_CFG_SM_BASE_ADDRESS_LOW & 0x7F) >> 2); - mask |= 1 << ((mmTPC4_CFG_SM_BASE_ADDRESS_HIGH & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC4_CFG_TPC_STALL & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC4_CFG_MSS_CONFIG & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC4_CFG_TPC_INTR_CAUSE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC4_CFG_TPC_INTR_MASK & 0x7F) >> 2); - - WREG32(pb_addr + word_offset, ~mask); - -@@ -1603,6 +1658,16 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - goya_pb_set_block(hdev, mmTPC5_RD_REGULATOR_BASE); - goya_pb_set_block(hdev, mmTPC5_WR_REGULATOR_BASE); - -+ pb_addr = (mmTPC5_CFG_SEMAPHORE & ~0xFFF) + PROT_BITS_OFFS; -+ word_offset = ((mmTPC5_CFG_SEMAPHORE & PROT_BITS_OFFS) >> 7) << 2; -+ -+ mask = 1 << ((mmTPC5_CFG_SEMAPHORE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC5_CFG_VFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC5_CFG_SFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC5_CFG_STATUS & 0x7F) >> 2); -+ -+ WREG32(pb_addr + word_offset, ~mask); -+ - pb_addr = (mmTPC5_CFG_CFG_BASE_ADDRESS_HIGH & ~0xFFF) + PROT_BITS_OFFS; - word_offset = ((mmTPC5_CFG_CFG_BASE_ADDRESS_HIGH & - PROT_BITS_OFFS) >> 7) << 2; -@@ -1610,6 +1675,10 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - mask |= 1 << ((mmTPC5_CFG_CFG_SUBTRACT_VALUE & 0x7F) >> 2); - mask |= 1 << ((mmTPC5_CFG_SM_BASE_ADDRESS_LOW & 0x7F) >> 2); - mask |= 1 << ((mmTPC5_CFG_SM_BASE_ADDRESS_HIGH & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC5_CFG_TPC_STALL & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC5_CFG_MSS_CONFIG & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC5_CFG_TPC_INTR_CAUSE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC5_CFG_TPC_INTR_MASK & 0x7F) >> 2); - - WREG32(pb_addr + word_offset, ~mask); - -@@ -1785,6 +1854,16 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - goya_pb_set_block(hdev, mmTPC6_RD_REGULATOR_BASE); - goya_pb_set_block(hdev, mmTPC6_WR_REGULATOR_BASE); - -+ pb_addr = (mmTPC6_CFG_SEMAPHORE & ~0xFFF) + PROT_BITS_OFFS; -+ word_offset = ((mmTPC6_CFG_SEMAPHORE & PROT_BITS_OFFS) >> 7) << 2; -+ -+ mask = 1 << ((mmTPC6_CFG_SEMAPHORE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC6_CFG_VFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC6_CFG_SFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC6_CFG_STATUS & 0x7F) >> 2); -+ -+ WREG32(pb_addr + word_offset, ~mask); -+ - pb_addr = (mmTPC6_CFG_CFG_BASE_ADDRESS_HIGH & ~0xFFF) + PROT_BITS_OFFS; - word_offset = ((mmTPC6_CFG_CFG_BASE_ADDRESS_HIGH & - PROT_BITS_OFFS) >> 7) << 2; -@@ -1792,6 +1871,10 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - mask |= 1 << ((mmTPC6_CFG_CFG_SUBTRACT_VALUE & 0x7F) >> 2); - mask |= 1 << ((mmTPC6_CFG_SM_BASE_ADDRESS_LOW & 0x7F) >> 2); - mask |= 1 << ((mmTPC6_CFG_SM_BASE_ADDRESS_HIGH & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC6_CFG_TPC_STALL & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC6_CFG_MSS_CONFIG & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC6_CFG_TPC_INTR_CAUSE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC6_CFG_TPC_INTR_MASK & 0x7F) >> 2); - - WREG32(pb_addr + word_offset, ~mask); - -@@ -1967,6 +2050,16 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - goya_pb_set_block(hdev, mmTPC7_RD_REGULATOR_BASE); - goya_pb_set_block(hdev, mmTPC7_WR_REGULATOR_BASE); - -+ pb_addr = (mmTPC7_CFG_SEMAPHORE & ~0xFFF) + PROT_BITS_OFFS; -+ word_offset = ((mmTPC7_CFG_SEMAPHORE & PROT_BITS_OFFS) >> 7) << 2; -+ -+ mask = 1 << ((mmTPC7_CFG_SEMAPHORE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC7_CFG_VFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC7_CFG_SFLAGS & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC7_CFG_STATUS & 0x7F) >> 2); -+ -+ WREG32(pb_addr + word_offset, ~mask); -+ - pb_addr = (mmTPC7_CFG_CFG_BASE_ADDRESS_HIGH & ~0xFFF) + PROT_BITS_OFFS; - word_offset = ((mmTPC7_CFG_CFG_BASE_ADDRESS_HIGH & - PROT_BITS_OFFS) >> 7) << 2; -@@ -1974,6 +2067,10 @@ static void goya_init_tpc_protection_bits(struct hl_device *hdev) - mask |= 1 << ((mmTPC7_CFG_CFG_SUBTRACT_VALUE & 0x7F) >> 2); - mask |= 1 << ((mmTPC7_CFG_SM_BASE_ADDRESS_LOW & 0x7F) >> 2); - mask |= 1 << ((mmTPC7_CFG_SM_BASE_ADDRESS_HIGH & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC7_CFG_TPC_STALL & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC7_CFG_MSS_CONFIG & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC7_CFG_TPC_INTR_CAUSE & 0x7F) >> 2); -+ mask |= 1 << ((mmTPC7_CFG_TPC_INTR_MASK & 0x7F) >> 2); - - WREG32(pb_addr + word_offset, ~mask); - -diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c -index 8d468e0a950a..f476dbc7252b 100644 ---- a/drivers/misc/mei/bus.c -+++ b/drivers/misc/mei/bus.c -@@ -745,9 +745,8 @@ static int mei_cl_device_remove(struct device *dev) - - mei_cl_bus_module_put(cldev); - module_put(THIS_MODULE); -- dev->driver = NULL; -- return ret; - -+ return ret; - } - - static ssize_t name_show(struct device *dev, struct device_attribute *a, -diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -index 52402aa7b4d3..968ff7703925 100644 ---- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c -+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c -@@ -606,8 +606,9 @@ static int brcmnand_revision_init(struct brcmnand_controller *ctrl) - } else { - ctrl->cs_offsets = brcmnand_cs_offsets; - -- /* v5.0 and earlier has a different CS0 offset layout */ -- if (ctrl->nand_version <= 0x0500) -+ /* v3.3-5.0 have a different CS0 offset layout */ -+ if (ctrl->nand_version >= 0x0303 && -+ ctrl->nand_version <= 0x0500) - ctrl->cs0_offsets = brcmnand_cs_offsets_cs0; - } - -@@ -2021,28 +2022,31 @@ static int brcmnand_read_by_pio(struct mtd_info *mtd, struct nand_chip *chip, - static int brcmstb_nand_verify_erased_page(struct mtd_info *mtd, - struct nand_chip *chip, void *buf, u64 addr) - { -- int i, sas; -- void *oob = chip->oob_poi; -+ struct mtd_oob_region ecc; -+ int i; - int bitflips = 0; - int page = addr >> chip->page_shift; - int ret; -+ void *ecc_bytes; - void *ecc_chunk; - - if (!buf) - buf = nand_get_data_buf(chip); - -- sas = mtd->oobsize / chip->ecc.steps; -- - /* read without ecc for verification */ - ret = chip->ecc.read_page_raw(chip, buf, true, page); - if (ret) - return ret; - -- for (i = 0; i < chip->ecc.steps; i++, oob += sas) { -+ for (i = 0; i < chip->ecc.steps; i++) { - ecc_chunk = buf + chip->ecc.size * i; -- ret = nand_check_erased_ecc_chunk(ecc_chunk, -- chip->ecc.size, -- oob, sas, NULL, 0, -+ -+ mtd_ooblayout_ecc(mtd, i, &ecc); -+ ecc_bytes = chip->oob_poi + ecc.offset; -+ -+ ret = nand_check_erased_ecc_chunk(ecc_chunk, chip->ecc.size, -+ ecc_bytes, ecc.length, -+ NULL, 0, - chip->ecc.strength); - if (ret < 0) - return ret; -diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c -index 179f0ca585f8..2211a23e4d50 100644 ---- a/drivers/mtd/nand/raw/marvell_nand.c -+++ b/drivers/mtd/nand/raw/marvell_nand.c -@@ -707,7 +707,7 @@ static int marvell_nfc_wait_op(struct nand_chip *chip, unsigned int timeout_ms) - * In case the interrupt was not served in the required time frame, - * check if the ISR was not served or if something went actually wrong. - */ -- if (ret && !pending) { -+ if (!ret && !pending) { - dev_err(nfc->dev, "Timeout waiting for RB signal\n"); - return -ETIMEDOUT; - } -@@ -2664,7 +2664,7 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc, - ret = mtd_device_register(mtd, NULL, 0); - if (ret) { - dev_err(dev, "failed to register mtd device: %d\n", ret); -- nand_release(chip); -+ nand_cleanup(chip); - return ret; - } - -@@ -2673,6 +2673,16 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc, - return 0; - } - -+static void marvell_nand_chips_cleanup(struct marvell_nfc *nfc) -+{ -+ struct marvell_nand_chip *entry, *temp; -+ -+ list_for_each_entry_safe(entry, temp, &nfc->chips, node) { -+ nand_release(&entry->chip); -+ list_del(&entry->node); -+ } -+} -+ - static int marvell_nand_chips_init(struct device *dev, struct marvell_nfc *nfc) - { - struct device_node *np = dev->of_node; -@@ -2707,21 +2717,16 @@ static int marvell_nand_chips_init(struct device *dev, struct marvell_nfc *nfc) - ret = marvell_nand_chip_init(dev, nfc, nand_np); - if (ret) { - of_node_put(nand_np); -- return ret; -+ goto cleanup_chips; - } - } - - return 0; --} - --static void marvell_nand_chips_cleanup(struct marvell_nfc *nfc) --{ -- struct marvell_nand_chip *entry, *temp; -+cleanup_chips: -+ marvell_nand_chips_cleanup(nfc); - -- list_for_each_entry_safe(entry, temp, &nfc->chips, node) { -- nand_release(&entry->chip); -- list_del(&entry->node); -- } -+ return ret; - } - - static int marvell_nfc_init_dma(struct marvell_nfc *nfc) -diff --git a/drivers/mtd/nand/raw/nand_timings.c b/drivers/mtd/nand/raw/nand_timings.c -index f64b06a71dfa..f12b7a7844c9 100644 ---- a/drivers/mtd/nand/raw/nand_timings.c -+++ b/drivers/mtd/nand/raw/nand_timings.c -@@ -314,10 +314,9 @@ int onfi_fill_data_interface(struct nand_chip *chip, - /* microseconds -> picoseconds */ - timings->tPROG_max = 1000000ULL * ONFI_DYN_TIMING_MAX; - timings->tBERS_max = 1000000ULL * ONFI_DYN_TIMING_MAX; -- timings->tR_max = 1000000ULL * 200000000ULL; - -- /* nanoseconds -> picoseconds */ -- timings->tCCS_min = 1000UL * 500000; -+ timings->tR_max = 200000000; -+ timings->tCCS_min = 500000; - } - - return 0; -diff --git a/drivers/mtd/nand/raw/oxnas_nand.c b/drivers/mtd/nand/raw/oxnas_nand.c -index 0429d218fd9f..23c222b6c40e 100644 ---- a/drivers/mtd/nand/raw/oxnas_nand.c -+++ b/drivers/mtd/nand/raw/oxnas_nand.c -@@ -32,6 +32,7 @@ struct oxnas_nand_ctrl { - void __iomem *io_base; - struct clk *clk; - struct nand_chip *chips[OXNAS_NAND_MAX_CHIPS]; -+ unsigned int nchips; - }; - - static uint8_t oxnas_nand_read_byte(struct nand_chip *chip) -@@ -79,9 +80,9 @@ static int oxnas_nand_probe(struct platform_device *pdev) - struct nand_chip *chip; - struct mtd_info *mtd; - struct resource *res; -- int nchips = 0; - int count = 0; - int err = 0; -+ int i; - - /* Allocate memory for the device structure (and zero it) */ - oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas), -@@ -143,12 +144,12 @@ static int oxnas_nand_probe(struct platform_device *pdev) - if (err) - goto err_cleanup_nand; - -- oxnas->chips[nchips] = chip; -- ++nchips; -+ oxnas->chips[oxnas->nchips] = chip; -+ ++oxnas->nchips; - } - - /* Exit if no chips found */ -- if (!nchips) { -+ if (!oxnas->nchips) { - err = -ENODEV; - goto err_clk_unprepare; - } -@@ -161,6 +162,13 @@ err_cleanup_nand: - nand_cleanup(chip); - err_release_child: - of_node_put(nand_np); -+ -+ for (i = 0; i < oxnas->nchips; i++) { -+ chip = oxnas->chips[i]; -+ WARN_ON(mtd_device_unregister(nand_to_mtd(chip))); -+ nand_cleanup(chip); -+ } -+ - err_clk_unprepare: - clk_disable_unprepare(oxnas->clk); - return err; -@@ -169,9 +177,13 @@ err_clk_unprepare: - static int oxnas_nand_remove(struct platform_device *pdev) - { - struct oxnas_nand_ctrl *oxnas = platform_get_drvdata(pdev); -+ struct nand_chip *chip; -+ int i; - -- if (oxnas->chips[0]) -- nand_release(oxnas->chips[0]); -+ for (i = 0; i < oxnas->nchips; i++) { -+ chip = oxnas->chips[i]; -+ nand_release(chip); -+ } - - clk_disable_unprepare(oxnas->clk); - -diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c -index f6038d3a3684..27838f6166bb 100644 ---- a/drivers/mtd/spi-nor/sfdp.c -+++ b/drivers/mtd/spi-nor/sfdp.c -@@ -21,10 +21,6 @@ - #define SFDP_4BAIT_ID 0xff84 /* 4-byte Address Instruction Table */ - - #define SFDP_SIGNATURE 0x50444653U --#define SFDP_JESD216_MAJOR 1 --#define SFDP_JESD216_MINOR 0 --#define SFDP_JESD216A_MINOR 5 --#define SFDP_JESD216B_MINOR 6 - - struct sfdp_header { - u32 signature; /* Ox50444653U <=> "SFDP" */ -diff --git a/drivers/mtd/spi-nor/sfdp.h b/drivers/mtd/spi-nor/sfdp.h -index e0a8ded04890..b84abd0b6434 100644 ---- a/drivers/mtd/spi-nor/sfdp.h -+++ b/drivers/mtd/spi-nor/sfdp.h -@@ -7,6 +7,12 @@ - #ifndef __LINUX_MTD_SFDP_H - #define __LINUX_MTD_SFDP_H - -+/* SFDP revisions */ -+#define SFDP_JESD216_MAJOR 1 -+#define SFDP_JESD216_MINOR 0 -+#define SFDP_JESD216A_MINOR 5 -+#define SFDP_JESD216B_MINOR 6 -+ - /* Basic Flash Parameter Table */ - - /* -diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c -index 6756202ace4b..eac1c22b730f 100644 ---- a/drivers/mtd/spi-nor/spansion.c -+++ b/drivers/mtd/spi-nor/spansion.c -@@ -8,6 +8,27 @@ - - #include "core.h" - -+static int -+s25fs_s_post_bfpt_fixups(struct spi_nor *nor, -+ const struct sfdp_parameter_header *bfpt_header, -+ const struct sfdp_bfpt *bfpt, -+ struct spi_nor_flash_parameter *params) -+{ -+ /* -+ * The S25FS-S chip family reports 512-byte pages in BFPT but -+ * in reality the write buffer still wraps at the safe default -+ * of 256 bytes. Overwrite the page size advertised by BFPT -+ * to get the writes working. -+ */ -+ params->page_size = 256; -+ -+ return 0; -+} -+ -+static struct spi_nor_fixups s25fs_s_fixups = { -+ .post_bfpt = s25fs_s_post_bfpt_fixups, -+}; -+ - static const struct flash_info spansion_parts[] = { - /* Spansion/Cypress -- single (large) sector size only, at least - * for the chips listed here (without boot sectors). -@@ -30,8 +51,8 @@ static const struct flash_info spansion_parts[] = { - SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_HAS_LOCK | USE_CLSR) }, - { "s25fs512s", INFO6(0x010220, 0x4d0081, 256 * 1024, 256, -- SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | -- USE_CLSR) }, -+ SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) -+ .fixups = &s25fs_s_fixups, }, - { "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) }, - { "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) }, - { "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) }, -diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c -index 17deabad57e1..5062af10f138 100644 ---- a/drivers/mtd/spi-nor/winbond.c -+++ b/drivers/mtd/spi-nor/winbond.c -@@ -8,6 +8,31 @@ - - #include "core.h" - -+static int -+w25q256_post_bfpt_fixups(struct spi_nor *nor, -+ const struct sfdp_parameter_header *bfpt_header, -+ const struct sfdp_bfpt *bfpt, -+ struct spi_nor_flash_parameter *params) -+{ -+ /* -+ * W25Q256JV supports 4B opcodes but W25Q256FV does not. -+ * Unfortunately, Winbond has re-used the same JEDEC ID for both -+ * variants which prevents us from defining a new entry in the parts -+ * table. -+ * To differentiate between W25Q256JV and W25Q256FV check SFDP header -+ * version: only JV has JESD216A compliant structure (version 5). -+ */ -+ if (bfpt_header->major == SFDP_JESD216_MAJOR && -+ bfpt_header->minor == SFDP_JESD216A_MINOR) -+ nor->flags |= SNOR_F_4B_OPCODES; -+ -+ return 0; -+} -+ -+static struct spi_nor_fixups w25q256_fixups = { -+ .post_bfpt = w25q256_post_bfpt_fixups, -+}; -+ - static const struct flash_info winbond_parts[] = { - /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ - { "w25x05", INFO(0xef3010, 0, 64 * 1024, 1, SECT_4K) }, -@@ -53,8 +78,8 @@ static const struct flash_info winbond_parts[] = { - { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) }, - { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) }, - { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512, -- SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | -- SPI_NOR_4B_OPCODES) }, -+ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) -+ .fixups = &w25q256_fixups }, - { "w25q256jvm", INFO(0xef7019, 0, 64 * 1024, 512, - SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "w25q256jw", INFO(0xef6019, 0, 64 * 1024, 512, -diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c -index 7c17b0f705ec..6aadab277abc 100644 ---- a/drivers/net/dsa/microchip/ksz8795.c -+++ b/drivers/net/dsa/microchip/ksz8795.c -@@ -1271,6 +1271,9 @@ static int ksz8795_switch_init(struct ksz_device *dev) - /* set the real number of ports */ - dev->ds->num_ports = dev->port_cnt; - -+ /* set the real number of ports */ -+ dev->ds->num_ports = dev->port_cnt; -+ - return 0; - } - -diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c -index 8d15c3016024..65701e65b6c2 100644 ---- a/drivers/net/dsa/microchip/ksz9477.c -+++ b/drivers/net/dsa/microchip/ksz9477.c -@@ -516,6 +516,9 @@ static int ksz9477_port_vlan_filtering(struct dsa_switch *ds, int port, - PORT_VLAN_LOOKUP_VID_0, false); - } - -+ /* set the real number of ports */ -+ dev->ds->num_ports = dev->port_cnt; -+ - return 0; - } - -diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c -index cf26cf4e47aa..b2da295e2fc0 100644 ---- a/drivers/net/ethernet/marvell/mvneta.c -+++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -3565,7 +3565,7 @@ static int mvneta_config_interface(struct mvneta_port *pp, - MVNETA_HSGMII_SERDES_PROTO); - break; - default: -- return -EINVAL; -+ break; - } - } - -@@ -5003,10 +5003,18 @@ static void mvneta_conf_mbus_windows(struct mvneta_port *pp, - } - - /* Power up the port */ --static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) -+static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) - { - /* MAC Cause register should be cleared */ - mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0); -+ -+ if (phy_mode != PHY_INTERFACE_MODE_QSGMII && -+ phy_mode != PHY_INTERFACE_MODE_SGMII && -+ !phy_interface_mode_is_8023z(phy_mode) && -+ !phy_interface_mode_is_rgmii(phy_mode)) -+ return -EINVAL; -+ -+ return 0; - } - - /* Device initialization routine */ -@@ -5192,7 +5200,11 @@ static int mvneta_probe(struct platform_device *pdev) - if (err < 0) - goto err_netdev; - -- mvneta_port_power_up(pp, phy_mode); -+ err = mvneta_port_power_up(pp, pp->phy_interface); -+ if (err < 0) { -+ dev_err(&pdev->dev, "can't power up port\n"); -+ return err; -+ } - - /* Armada3700 network controller does not support per-cpu - * operation, so only single NAPI should be initialized. -@@ -5346,7 +5358,11 @@ static int mvneta_resume(struct device *device) - } - } - mvneta_defaults_set(pp); -- mvneta_port_power_up(pp, pp->phy_interface); -+ err = mvneta_port_power_up(pp, pp->phy_interface); -+ if (err < 0) { -+ dev_err(device, "can't power up port\n"); -+ return err; -+ } - - netif_device_attach(dev); - -diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c -index b591bec0301c..7fea60fc3e08 100644 ---- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c -+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c -@@ -85,7 +85,8 @@ static void ionic_link_status_check(struct ionic_lif *lif) - u16 link_status; - bool link_up; - -- if (!test_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state)) -+ if (!test_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state) || -+ test_bit(IONIC_LIF_F_QUEUE_RESET, lif->state)) - return; - - if (lif->ionic->is_mgmt_nic) -@@ -1235,6 +1236,7 @@ static int ionic_init_nic_features(struct ionic_lif *lif) - - netdev->hw_features |= netdev->hw_enc_features; - netdev->features |= netdev->hw_features; -+ netdev->vlan_features |= netdev->features & ~NETIF_F_VLAN_FEATURES; - - netdev->priv_flags |= IFF_UNICAST_FLT | - IFF_LIVE_ADDR_CHANGE; -diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c -index fcdecddb2812..32106f4b3370 100644 ---- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c -+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c -@@ -434,6 +434,11 @@ int rmnet_add_bridge(struct net_device *rmnet_dev, - return -EINVAL; - } - -+ if (port->rmnet_mode != RMNET_EPMODE_VND) { -+ NL_SET_ERR_MSG_MOD(extack, "more than one bridge dev attached"); -+ return -EINVAL; -+ } -+ - if (rmnet_is_real_dev_registered(slave_dev)) { - NL_SET_ERR_MSG_MOD(extack, - "slave cannot be another rmnet dev"); -diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c -index 043a675e1be1..6144a1ccc0f3 100644 ---- a/drivers/net/ipa/gsi.c -+++ b/drivers/net/ipa/gsi.c -@@ -490,6 +490,12 @@ static int gsi_channel_stop_command(struct gsi_channel *channel) - enum gsi_channel_state state = channel->state; - int ret; - -+ /* Channel could have entered STOPPED state since last call -+ * if it timed out. If so, we're done. -+ */ -+ if (state == GSI_CHANNEL_STATE_STOPPED) -+ return 0; -+ - if (state != GSI_CHANNEL_STATE_STARTED && - state != GSI_CHANNEL_STATE_STOP_IN_PROC) - return -EINVAL; -@@ -773,13 +779,6 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id) - - gsi_channel_freeze(channel); - -- /* Channel could have entered STOPPED state since last call if the -- * STOP command timed out. We won't stop a channel if stopping it -- * was successful previously (so we still want the freeze above). -- */ -- if (channel->state == GSI_CHANNEL_STATE_STOPPED) -- return 0; -- - /* RX channels might require a little time to enter STOPPED state */ - retries = channel->toward_ipa ? 0 : GSI_CHANNEL_STOP_RX_RETRIES; - -diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c -index cee417181f98..e4febda2d6b4 100644 ---- a/drivers/net/ipa/ipa_cmd.c -+++ b/drivers/net/ipa/ipa_cmd.c -@@ -645,6 +645,21 @@ u32 ipa_cmd_tag_process_count(void) - return 4; - } - -+void ipa_cmd_tag_process(struct ipa *ipa) -+{ -+ u32 count = ipa_cmd_tag_process_count(); -+ struct gsi_trans *trans; -+ -+ trans = ipa_cmd_trans_alloc(ipa, count); -+ if (trans) { -+ ipa_cmd_tag_process_add(trans); -+ gsi_trans_commit_wait(trans); -+ } else { -+ dev_err(&ipa->pdev->dev, -+ "error allocating %u entry tag transaction\n", count); -+ } -+} -+ - static struct ipa_cmd_info * - ipa_cmd_info_alloc(struct ipa_endpoint *endpoint, u32 tre_count) - { -diff --git a/drivers/net/ipa/ipa_cmd.h b/drivers/net/ipa/ipa_cmd.h -index 4917525b3a47..1ee9265651a1 100644 ---- a/drivers/net/ipa/ipa_cmd.h -+++ b/drivers/net/ipa/ipa_cmd.h -@@ -182,6 +182,14 @@ void ipa_cmd_tag_process_add(struct gsi_trans *trans); - */ - u32 ipa_cmd_tag_process_count(void); - -+/** -+ * ipa_cmd_tag_process() - Perform a tag process -+ * -+ * @Return: The number of elements to allocate in a transaction -+ * to hold tag process commands -+ */ -+void ipa_cmd_tag_process(struct ipa *ipa); -+ - /** - * ipa_cmd_trans_alloc() - Allocate a transaction for the command TX endpoint - * @ipa: IPA pointer -diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c -index 1d823ac0f6d6..371c93953aea 100644 ---- a/drivers/net/ipa/ipa_endpoint.c -+++ b/drivers/net/ipa/ipa_endpoint.c -@@ -1485,6 +1485,8 @@ void ipa_endpoint_suspend(struct ipa *ipa) - if (ipa->modem_netdev) - ipa_modem_suspend(ipa->modem_netdev); - -+ ipa_cmd_tag_process(ipa); -+ - ipa_endpoint_suspend_one(ipa->name_map[IPA_ENDPOINT_AP_LAN_RX]); - ipa_endpoint_suspend_one(ipa->name_map[IPA_ENDPOINT_AP_COMMAND_TX]); - } -diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c -index 4a2c7355be63..e57d59b0a7ae 100644 ---- a/drivers/net/usb/qmi_wwan.c -+++ b/drivers/net/usb/qmi_wwan.c -@@ -1370,6 +1370,7 @@ static const struct usb_device_id products[] = { - {QMI_QUIRK_SET_DTR(0x1e0e, 0x9001, 5)}, /* SIMCom 7100E, 7230E, 7600E ++ */ - {QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */ - {QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */ -+ {QMI_QUIRK_SET_DTR(0x2c7c, 0x0195, 4)}, /* Quectel EG95 */ - {QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */ - {QMI_QUIRK_SET_DTR(0x2cb7, 0x0104, 4)}, /* Fibocom NL678 series */ - {QMI_FIXED_INTF(0x0489, 0xe0b4, 0)}, /* Foxconn T77W968 LTE */ -diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c -index 71d63ed62071..137d7bcc1358 100644 ---- a/drivers/nvme/host/core.c -+++ b/drivers/nvme/host/core.c -@@ -1916,6 +1916,7 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) - if (ns->head->disk) { - nvme_update_disk_info(ns->head->disk, ns, id); - blk_queue_stack_limits(ns->head->disk->queue, ns->queue); -+ nvme_mpath_update_disk_size(ns->head->disk); - } - #endif - } -diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h -index 719342600be6..46f965f8c9bc 100644 ---- a/drivers/nvme/host/nvme.h -+++ b/drivers/nvme/host/nvme.h -@@ -583,6 +583,16 @@ static inline void nvme_trace_bio_complete(struct request *req, - req->bio, status); - } - -+static inline void nvme_mpath_update_disk_size(struct gendisk *disk) -+{ -+ struct block_device *bdev = bdget_disk(disk, 0); -+ -+ if (bdev) { -+ bd_set_size(bdev, get_capacity(disk) << SECTOR_SHIFT); -+ bdput(bdev); -+ } -+} -+ - extern struct device_attribute dev_attr_ana_grpid; - extern struct device_attribute dev_attr_ana_state; - extern struct device_attribute subsys_attr_iopolicy; -@@ -658,6 +668,9 @@ static inline void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys) - static inline void nvme_mpath_start_freeze(struct nvme_subsystem *subsys) - { - } -+static inline void nvme_mpath_update_disk_size(struct gendisk *disk) -+{ -+} - #endif /* CONFIG_NVME_MULTIPATH */ - - #ifdef CONFIG_NVM -diff --git a/drivers/opp/of.c b/drivers/opp/of.c -index 9cd8f0adacae..249738e1e0b7 100644 ---- a/drivers/opp/of.c -+++ b/drivers/opp/of.c -@@ -733,6 +733,10 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table) - return -EINVAL; - } - -+ mutex_lock(&opp_table->lock); -+ opp_table->parsed_static_opps = 1; -+ mutex_unlock(&opp_table->lock); -+ - val = prop->value; - while (nr) { - unsigned long freq = be32_to_cpup(val++) * 1000; -diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c -index 809f2584e338..d4758518a97b 100644 ---- a/drivers/pci/pci.c -+++ b/drivers/pci/pci.c -@@ -868,7 +868,9 @@ static inline bool platform_pci_need_resume(struct pci_dev *dev) - - static inline bool platform_pci_bridge_d3(struct pci_dev *dev) - { -- return pci_platform_pm ? pci_platform_pm->bridge_d3(dev) : false; -+ if (pci_platform_pm && pci_platform_pm->bridge_d3) -+ return pci_platform_pm->bridge_d3(dev); -+ return false; - } - - /** -diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c -index 856927382248..e5842e48a5e0 100644 ---- a/drivers/phy/allwinner/phy-sun4i-usb.c -+++ b/drivers/phy/allwinner/phy-sun4i-usb.c -@@ -545,13 +545,14 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work) - struct sun4i_usb_phy_data *data = - container_of(work, struct sun4i_usb_phy_data, detect.work); - struct phy *phy0 = data->phys[0].phy; -- struct sun4i_usb_phy *phy = phy_get_drvdata(phy0); -+ struct sun4i_usb_phy *phy; - bool force_session_end, id_notify = false, vbus_notify = false; - int id_det, vbus_det; - -- if (phy0 == NULL) -+ if (!phy0) - return; - -+ phy = phy_get_drvdata(phy0); - id_det = sun4i_usb_phy0_get_id_det(data); - vbus_det = sun4i_usb_phy0_get_vbus_det(data); - -diff --git a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c -index a7c6c940a3a8..8af8c6c5cc02 100644 ---- a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c -+++ b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c -@@ -607,8 +607,8 @@ static int inno_dsidphy_probe(struct platform_device *pdev) - platform_set_drvdata(pdev, inno); - - inno->phy_base = devm_platform_ioremap_resource(pdev, 0); -- if (!inno->phy_base) -- return -ENOMEM; -+ if (IS_ERR(inno->phy_base)) -+ return PTR_ERR(inno->phy_base); - - inno->ref_clk = devm_clk_get(dev, "ref"); - if (IS_ERR(inno->ref_clk)) { -diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c -index 03a6c86475c8..9a9d742779f6 100644 ---- a/drivers/scsi/megaraid/megaraid_sas_fusion.c -+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c -@@ -3797,10 +3797,8 @@ static irqreturn_t megasas_isr_fusion(int irq, void *devp) - if (instance->mask_interrupts) - return IRQ_NONE; - --#if defined(ENABLE_IRQ_POLL) - if (irq_context->irq_poll_scheduled) - return IRQ_HANDLED; --#endif - - if (!instance->msix_vectors) { - mfiStatus = instance->instancet->clear_intr(instance); -diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h -index daa9e936887b..172ea4e5887d 100644 ---- a/drivers/scsi/qla2xxx/qla_def.h -+++ b/drivers/scsi/qla2xxx/qla_def.h -@@ -4248,8 +4248,8 @@ struct qla_hw_data { - int fw_dump_reading; - void *mpi_fw_dump; - u32 mpi_fw_dump_len; -- int mpi_fw_dump_reading:1; -- int mpi_fw_dumped:1; -+ unsigned int mpi_fw_dump_reading:1; -+ unsigned int mpi_fw_dumped:1; - int prev_minidump_failed; - dma_addr_t eft_dma; - void *eft; -diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c -index 526e3215d8fe..63ee96eb58c6 100644 ---- a/drivers/slimbus/core.c -+++ b/drivers/slimbus/core.c -@@ -283,6 +283,7 @@ EXPORT_SYMBOL_GPL(slim_register_controller); - /* slim_remove_device: Remove the effect of slim_add_device() */ - static void slim_remove_device(struct slim_device *sbdev) - { -+ of_node_put(sbdev->dev.of_node); - device_unregister(&sbdev->dev); - } - -diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c -index b71822131f59..3d2104286ee9 100644 ---- a/drivers/soc/qcom/rpmh-rsc.c -+++ b/drivers/soc/qcom/rpmh-rsc.c -@@ -148,7 +148,7 @@ int rpmh_rsc_invalidate(struct rsc_drv *drv) - static struct tcs_group *get_tcs_for_msg(struct rsc_drv *drv, - const struct tcs_request *msg) - { -- int type, ret; -+ int type; - struct tcs_group *tcs; - - switch (msg->state) { -@@ -169,19 +169,10 @@ static struct tcs_group *get_tcs_for_msg(struct rsc_drv *drv, - * If we are making an active request on a RSC that does not have a - * dedicated TCS for active state use, then re-purpose a wake TCS to - * send active votes. -- * NOTE: The driver must be aware that this RSC does not have a -- * dedicated AMC, and therefore would invalidate the sleep and wake -- * TCSes before making an active state request. - */ - tcs = get_tcs_of_type(drv, type); -- if (msg->state == RPMH_ACTIVE_ONLY_STATE && !tcs->num_tcs) { -+ if (msg->state == RPMH_ACTIVE_ONLY_STATE && !tcs->num_tcs) - tcs = get_tcs_of_type(drv, WAKE_TCS); -- if (tcs->num_tcs) { -- ret = rpmh_rsc_invalidate(drv); -- if (ret) -- return ERR_PTR(ret); -- } -- } - - return tcs; - } -@@ -201,6 +192,42 @@ static const struct tcs_request *get_req_from_tcs(struct rsc_drv *drv, - return NULL; - } - -+static void __tcs_set_trigger(struct rsc_drv *drv, int tcs_id, bool trigger) -+{ -+ u32 enable; -+ -+ /* -+ * HW req: Clear the DRV_CONTROL and enable TCS again -+ * While clearing ensure that the AMC mode trigger is cleared -+ * and then the mode enable is cleared. -+ */ -+ enable = read_tcs_reg(drv, RSC_DRV_CONTROL, tcs_id, 0); -+ enable &= ~TCS_AMC_MODE_TRIGGER; -+ write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); -+ enable &= ~TCS_AMC_MODE_ENABLE; -+ write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); -+ -+ if (trigger) { -+ /* Enable the AMC mode on the TCS and then trigger the TCS */ -+ enable = TCS_AMC_MODE_ENABLE; -+ write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); -+ enable |= TCS_AMC_MODE_TRIGGER; -+ write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); -+ } -+} -+ -+static void enable_tcs_irq(struct rsc_drv *drv, int tcs_id, bool enable) -+{ -+ u32 data; -+ -+ data = read_tcs_reg(drv, RSC_DRV_IRQ_ENABLE, 0, 0); -+ if (enable) -+ data |= BIT(tcs_id); -+ else -+ data &= ~BIT(tcs_id); -+ write_tcs_reg(drv, RSC_DRV_IRQ_ENABLE, 0, data); -+} -+ - /** - * tcs_tx_done: TX Done interrupt handler - */ -@@ -237,6 +264,14 @@ static irqreturn_t tcs_tx_done(int irq, void *p) - } - - trace_rpmh_tx_done(drv, i, req, err); -+ -+ /* -+ * If wake tcs was re-purposed for sending active -+ * votes, clear AMC trigger & enable modes and -+ * disable interrupt for this TCS -+ */ -+ if (!drv->tcs[ACTIVE_TCS].num_tcs) -+ __tcs_set_trigger(drv, i, false); - skip: - /* Reclaim the TCS */ - write_tcs_reg(drv, RSC_DRV_CMD_ENABLE, i, 0); -@@ -244,6 +279,13 @@ skip: - write_tcs_reg(drv, RSC_DRV_IRQ_CLEAR, 0, BIT(i)); - spin_lock(&drv->lock); - clear_bit(i, drv->tcs_in_use); -+ /* -+ * Disable interrupt for WAKE TCS to avoid being -+ * spammed with interrupts coming when the solver -+ * sends its wake votes. -+ */ -+ if (!drv->tcs[ACTIVE_TCS].num_tcs) -+ enable_tcs_irq(drv, i, false); - spin_unlock(&drv->lock); - if (req) - rpmh_tx_done(req, err); -@@ -285,28 +327,6 @@ static void __tcs_buffer_write(struct rsc_drv *drv, int tcs_id, int cmd_id, - write_tcs_reg(drv, RSC_DRV_CMD_ENABLE, tcs_id, cmd_enable); - } - --static void __tcs_trigger(struct rsc_drv *drv, int tcs_id) --{ -- u32 enable; -- -- /* -- * HW req: Clear the DRV_CONTROL and enable TCS again -- * While clearing ensure that the AMC mode trigger is cleared -- * and then the mode enable is cleared. -- */ -- enable = read_tcs_reg(drv, RSC_DRV_CONTROL, tcs_id, 0); -- enable &= ~TCS_AMC_MODE_TRIGGER; -- write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); -- enable &= ~TCS_AMC_MODE_ENABLE; -- write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); -- -- /* Enable the AMC mode on the TCS and then trigger the TCS */ -- enable = TCS_AMC_MODE_ENABLE; -- write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); -- enable |= TCS_AMC_MODE_TRIGGER; -- write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); --} -- - static int check_for_req_inflight(struct rsc_drv *drv, struct tcs_group *tcs, - const struct tcs_request *msg) - { -@@ -377,10 +397,20 @@ static int tcs_write(struct rsc_drv *drv, const struct tcs_request *msg) - - tcs->req[tcs_id - tcs->offset] = msg; - set_bit(tcs_id, drv->tcs_in_use); -+ if (msg->state == RPMH_ACTIVE_ONLY_STATE && tcs->type != ACTIVE_TCS) { -+ /* -+ * Clear previously programmed WAKE commands in selected -+ * repurposed TCS to avoid triggering them. tcs->slots will be -+ * cleaned from rpmh_flush() by invoking rpmh_rsc_invalidate() -+ */ -+ write_tcs_reg_sync(drv, RSC_DRV_CMD_ENABLE, tcs_id, 0); -+ write_tcs_reg_sync(drv, RSC_DRV_CMD_WAIT_FOR_CMPL, tcs_id, 0); -+ enable_tcs_irq(drv, tcs_id, true); -+ } - spin_unlock(&drv->lock); - - __tcs_buffer_write(drv, tcs_id, 0, msg); -- __tcs_trigger(drv, tcs_id); -+ __tcs_set_trigger(drv, tcs_id, true); - - done_write: - spin_unlock_irqrestore(&tcs->lock, flags); -diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c -index eb0ded059d2e..a75f3df97742 100644 ---- a/drivers/soc/qcom/rpmh.c -+++ b/drivers/soc/qcom/rpmh.c -@@ -119,6 +119,7 @@ static struct cache_req *cache_rpm_request(struct rpmh_ctrlr *ctrlr, - { - struct cache_req *req; - unsigned long flags; -+ u32 old_sleep_val, old_wake_val; - - spin_lock_irqsave(&ctrlr->cache_lock, flags); - req = __find_req(ctrlr, cmd->addr); -@@ -133,26 +134,27 @@ static struct cache_req *cache_rpm_request(struct rpmh_ctrlr *ctrlr, - - req->addr = cmd->addr; - req->sleep_val = req->wake_val = UINT_MAX; -- INIT_LIST_HEAD(&req->list); - list_add_tail(&req->list, &ctrlr->cache); - - existing: -+ old_sleep_val = req->sleep_val; -+ old_wake_val = req->wake_val; -+ - switch (state) { - case RPMH_ACTIVE_ONLY_STATE: -- if (req->sleep_val != UINT_MAX) -- req->wake_val = cmd->data; -- break; - case RPMH_WAKE_ONLY_STATE: - req->wake_val = cmd->data; - break; - case RPMH_SLEEP_STATE: - req->sleep_val = cmd->data; - break; -- default: -- break; - } - -- ctrlr->dirty = true; -+ ctrlr->dirty = (req->sleep_val != old_sleep_val || -+ req->wake_val != old_wake_val) && -+ req->sleep_val != UINT_MAX && -+ req->wake_val != UINT_MAX; -+ - unlock: - spin_unlock_irqrestore(&ctrlr->cache_lock, flags); - -@@ -287,6 +289,7 @@ static void cache_batch(struct rpmh_ctrlr *ctrlr, struct batch_cache_req *req) - - spin_lock_irqsave(&ctrlr->cache_lock, flags); - list_add_tail(&req->list, &ctrlr->batch_cache); -+ ctrlr->dirty = true; - spin_unlock_irqrestore(&ctrlr->cache_lock, flags); - } - -@@ -314,18 +317,6 @@ static int flush_batch(struct rpmh_ctrlr *ctrlr) - return ret; - } - --static void invalidate_batch(struct rpmh_ctrlr *ctrlr) --{ -- struct batch_cache_req *req, *tmp; -- unsigned long flags; -- -- spin_lock_irqsave(&ctrlr->cache_lock, flags); -- list_for_each_entry_safe(req, tmp, &ctrlr->batch_cache, list) -- kfree(req); -- INIT_LIST_HEAD(&ctrlr->batch_cache); -- spin_unlock_irqrestore(&ctrlr->cache_lock, flags); --} -- - /** - * rpmh_write_batch: Write multiple sets of RPMH commands and wait for the - * batch to finish. -@@ -463,6 +454,13 @@ int rpmh_flush(struct rpmh_ctrlr *ctrlr) - return 0; - } - -+ /* Invalidate the TCSes first to avoid stale data */ -+ do { -+ ret = rpmh_rsc_invalidate(ctrlr_to_drv(ctrlr)); -+ } while (ret == -EAGAIN); -+ if (ret) -+ return ret; -+ - /* First flush the cached batch requests */ - ret = flush_batch(ctrlr); - if (ret) -@@ -494,25 +492,25 @@ int rpmh_flush(struct rpmh_ctrlr *ctrlr) - } - - /** -- * rpmh_invalidate: Invalidate all sleep and active sets -- * sets. -+ * rpmh_invalidate: Invalidate sleep and wake sets in batch_cache - * - * @dev: The device making the request - * -- * Invalidate the sleep and active values in the TCS blocks. -+ * Invalidate the sleep and wake values in batch_cache. - */ - int rpmh_invalidate(const struct device *dev) - { - struct rpmh_ctrlr *ctrlr = get_rpmh_ctrlr(dev); -- int ret; -+ struct batch_cache_req *req, *tmp; -+ unsigned long flags; - -- invalidate_batch(ctrlr); -+ spin_lock_irqsave(&ctrlr->cache_lock, flags); -+ list_for_each_entry_safe(req, tmp, &ctrlr->batch_cache, list) -+ kfree(req); -+ INIT_LIST_HEAD(&ctrlr->batch_cache); - ctrlr->dirty = true; -+ spin_unlock_irqrestore(&ctrlr->cache_lock, flags); - -- do { -- ret = rpmh_rsc_invalidate(ctrlr_to_drv(ctrlr)); -- } while (ret == -EAGAIN); -- -- return ret; -+ return 0; - } - EXPORT_SYMBOL(rpmh_invalidate); -diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c -index ebb49aee179b..08a4b8ae1764 100644 ---- a/drivers/soc/qcom/socinfo.c -+++ b/drivers/soc/qcom/socinfo.c -@@ -430,6 +430,8 @@ static int qcom_socinfo_probe(struct platform_device *pdev) - qs->attr.family = "Snapdragon"; - qs->attr.machine = socinfo_machine(&pdev->dev, - le32_to_cpu(info->id)); -+ qs->attr.soc_id = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%u", -+ le32_to_cpu(info->id)); - qs->attr.revision = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%u.%u", - SOCINFO_MAJOR(le32_to_cpu(info->ver)), - SOCINFO_MINOR(le32_to_cpu(info->ver))); -diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c -index 3c83e76c6bf9..cab425070e64 100644 ---- a/drivers/soundwire/intel.c -+++ b/drivers/soundwire/intel.c -@@ -930,8 +930,9 @@ static int intel_create_dai(struct sdw_cdns *cdns, - - /* TODO: Read supported rates/formats from hardware */ - for (i = off; i < (off + num); i++) { -- dais[i].name = kasprintf(GFP_KERNEL, "SDW%d Pin%d", -- cdns->instance, i); -+ dais[i].name = devm_kasprintf(cdns->dev, GFP_KERNEL, -+ "SDW%d Pin%d", -+ cdns->instance, i); - if (!dais[i].name) - return -ENOMEM; - -diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c -index 38d337f0967d..e0b30e4b1b69 100644 ---- a/drivers/spi/spi-fsl-dspi.c -+++ b/drivers/spi/spi-fsl-dspi.c -@@ -1461,20 +1461,7 @@ static int dspi_remove(struct platform_device *pdev) - - static void dspi_shutdown(struct platform_device *pdev) - { -- struct spi_controller *ctlr = platform_get_drvdata(pdev); -- struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); -- -- /* Disable RX and TX */ -- regmap_update_bits(dspi->regmap, SPI_MCR, -- SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF, -- SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF); -- -- /* Stop Running */ -- regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT); -- -- dspi_release_dma(dspi); -- clk_disable_unprepare(dspi->clk); -- spi_unregister_controller(dspi->ctlr); -+ dspi_remove(pdev); - } - - static struct platform_driver fsl_dspi_driver = { -diff --git a/drivers/spi/spi-sprd-adi.c b/drivers/spi/spi-sprd-adi.c -index 87dadb6b8ebf..8e84e25a8f7a 100644 ---- a/drivers/spi/spi-sprd-adi.c -+++ b/drivers/spi/spi-sprd-adi.c -@@ -389,9 +389,9 @@ static int sprd_adi_restart_handler(struct notifier_block *this, - sprd_adi_write(sadi, sadi->slave_pbase + REG_WDG_CTRL, val); - - /* Load the watchdog timeout value, 50ms is always enough. */ -+ sprd_adi_write(sadi, sadi->slave_pbase + REG_WDG_LOAD_HIGH, 0); - sprd_adi_write(sadi, sadi->slave_pbase + REG_WDG_LOAD_LOW, - WDG_LOAD_VAL & WDG_LOAD_MASK); -- sprd_adi_write(sadi, sadi->slave_pbase + REG_WDG_LOAD_HIGH, 0); - - /* Start the watchdog to reset system */ - sprd_adi_read(sadi, sadi->slave_pbase + REG_WDG_CTRL, &val); -diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c -index ec7967be9e2f..956df79035d5 100644 ---- a/drivers/spi/spi-sun6i.c -+++ b/drivers/spi/spi-sun6i.c -@@ -198,7 +198,7 @@ static int sun6i_spi_transfer_one(struct spi_master *master, - struct spi_transfer *tfr) - { - struct sun6i_spi *sspi = spi_master_get_devdata(master); -- unsigned int mclk_rate, div, timeout; -+ unsigned int mclk_rate, div, div_cdr1, div_cdr2, timeout; - unsigned int start, end, tx_time; - unsigned int trig_level; - unsigned int tx_len = 0; -@@ -287,14 +287,12 @@ static int sun6i_spi_transfer_one(struct spi_master *master, - * First try CDR2, and if we can't reach the expected - * frequency, fall back to CDR1. - */ -- div = mclk_rate / (2 * tfr->speed_hz); -- if (div <= (SUN6I_CLK_CTL_CDR2_MASK + 1)) { -- if (div > 0) -- div--; -- -- reg = SUN6I_CLK_CTL_CDR2(div) | SUN6I_CLK_CTL_DRS; -+ div_cdr1 = DIV_ROUND_UP(mclk_rate, tfr->speed_hz); -+ div_cdr2 = DIV_ROUND_UP(div_cdr1, 2); -+ if (div_cdr2 <= (SUN6I_CLK_CTL_CDR2_MASK + 1)) { -+ reg = SUN6I_CLK_CTL_CDR2(div_cdr2 - 1) | SUN6I_CLK_CTL_DRS; - } else { -- div = ilog2(mclk_rate) - ilog2(tfr->speed_hz); -+ div = min(SUN6I_CLK_CTL_CDR1_MASK, order_base_2(div_cdr1)); - reg = SUN6I_CLK_CTL_CDR1(div); - } - -diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c -index 45ad4ba92f94..689acd69a1b9 100644 ---- a/drivers/staging/comedi/drivers/addi_apci_1500.c -+++ b/drivers/staging/comedi/drivers/addi_apci_1500.c -@@ -456,9 +456,9 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev, - unsigned int lo_mask = data[5] << shift; - unsigned int chan_mask = hi_mask | lo_mask; - unsigned int old_mask = (1 << shift) - 1; -- unsigned int pm = devpriv->pm[trig] & old_mask; -- unsigned int pt = devpriv->pt[trig] & old_mask; -- unsigned int pp = devpriv->pp[trig] & old_mask; -+ unsigned int pm; -+ unsigned int pt; -+ unsigned int pp; - - if (trig > 1) { - dev_dbg(dev->class_dev, -@@ -471,6 +471,10 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev, - return -EINVAL; - } - -+ pm = devpriv->pm[trig] & old_mask; -+ pt = devpriv->pt[trig] & old_mask; -+ pp = devpriv->pp[trig] & old_mask; -+ - switch (data[2]) { - case COMEDI_DIGITAL_TRIG_DISABLE: - /* clear trigger configuration */ -diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c -index e761c9b42217..1b84ea674edb 100644 ---- a/drivers/thermal/imx_thermal.c -+++ b/drivers/thermal/imx_thermal.c -@@ -649,7 +649,7 @@ MODULE_DEVICE_TABLE(of, of_imx_thermal_match); - static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data) - { - struct device_node *np; -- int ret; -+ int ret = 0; - - data->policy = cpufreq_cpu_get(0); - if (!data->policy) { -@@ -664,11 +664,12 @@ static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data) - if (IS_ERR(data->cdev)) { - ret = PTR_ERR(data->cdev); - cpufreq_cpu_put(data->policy); -- return ret; - } - } - -- return 0; -+ of_node_put(np); -+ -+ return ret; - } - - static void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data *data) -diff --git a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c -index f86cbb125e2f..ec1d58c4ceaa 100644 ---- a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c -+++ b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c -@@ -74,7 +74,7 @@ static void int3403_notify(acpi_handle handle, - THERMAL_TRIP_CHANGED); - break; - default: -- dev_err(&priv->pdev->dev, "Unsupported event [0x%x]\n", event); -+ dev_dbg(&priv->pdev->dev, "Unsupported event [0x%x]\n", event); - break; - } - } -diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c -index 6b7ef1993d7e..42c9cd0e5f77 100644 ---- a/drivers/thermal/mtk_thermal.c -+++ b/drivers/thermal/mtk_thermal.c -@@ -594,8 +594,7 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank) - u32 raw; - - for (i = 0; i < conf->bank_data[bank->id].num_sensors; i++) { -- raw = readl(mt->thermal_base + -- conf->msr[conf->bank_data[bank->id].sensors[i]]); -+ raw = readl(mt->thermal_base + conf->msr[i]); - - temp = raw_to_mcelsius(mt, - conf->bank_data[bank->id].sensors[i], -@@ -736,8 +735,7 @@ static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num, - - for (i = 0; i < conf->bank_data[num].num_sensors; i++) - writel(conf->sensor_mux_values[conf->bank_data[num].sensors[i]], -- mt->thermal_base + -- conf->adcpnp[conf->bank_data[num].sensors[i]]); -+ mt->thermal_base + conf->adcpnp[i]); - - writel((1 << conf->bank_data[num].num_sensors) - 1, - controller_base + TEMP_MONCTL0); -diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c -index dbe90bcf4ad4..c144ca9b032c 100644 ---- a/drivers/thunderbolt/tunnel.c -+++ b/drivers/thunderbolt/tunnel.c -@@ -913,21 +913,21 @@ struct tb_tunnel *tb_tunnel_discover_usb3(struct tb *tb, struct tb_port *down) - * case. - */ - path = tb_path_discover(down, TB_USB3_HOPID, NULL, -1, -- &tunnel->dst_port, "USB3 Up"); -+ &tunnel->dst_port, "USB3 Down"); - if (!path) { - /* Just disable the downstream port */ - tb_usb3_port_enable(down, false); - goto err_free; - } -- tunnel->paths[TB_USB3_PATH_UP] = path; -- tb_usb3_init_path(tunnel->paths[TB_USB3_PATH_UP]); -+ tunnel->paths[TB_USB3_PATH_DOWN] = path; -+ tb_usb3_init_path(tunnel->paths[TB_USB3_PATH_DOWN]); - - path = tb_path_discover(tunnel->dst_port, -1, down, TB_USB3_HOPID, NULL, -- "USB3 Down"); -+ "USB3 Up"); - if (!path) - goto err_deactivate; -- tunnel->paths[TB_USB3_PATH_DOWN] = path; -- tb_usb3_init_path(tunnel->paths[TB_USB3_PATH_DOWN]); -+ tunnel->paths[TB_USB3_PATH_UP] = path; -+ tb_usb3_init_path(tunnel->paths[TB_USB3_PATH_UP]); - - /* Validate that the tunnel is complete */ - if (!tb_port_is_usb3_up(tunnel->dst_port)) { -diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c -index a04f74d2e854..4df47d02b34b 100644 ---- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c -+++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c -@@ -1215,7 +1215,12 @@ static int cpm_uart_init_port(struct device_node *np, - - pinfo->gpios[i] = NULL; - -- gpiod = devm_gpiod_get_index(dev, NULL, i, GPIOD_ASIS); -+ gpiod = devm_gpiod_get_index_optional(dev, NULL, i, GPIOD_ASIS); -+ -+ if (IS_ERR(gpiod)) { -+ ret = PTR_ERR(gpiod); -+ goto out_irq; -+ } - - if (gpiod) { - if (i == GPIO_RTS || i == GPIO_DTR) -@@ -1237,6 +1242,8 @@ static int cpm_uart_init_port(struct device_node *np, - - return cpm_uart_request_port(&pinfo->port); - -+out_irq: -+ irq_dispose_mapping(pinfo->port.irq); - out_pram: - cpm_uart_unmap_pram(pinfo, pram); - out_mem: -diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c -index b4f835e7de23..b784323a6a7b 100644 ---- a/drivers/tty/serial/mxs-auart.c -+++ b/drivers/tty/serial/mxs-auart.c -@@ -1698,21 +1698,21 @@ static int mxs_auart_probe(struct platform_device *pdev) - irq = platform_get_irq(pdev, 0); - if (irq < 0) { - ret = irq; -- goto out_disable_clks; -+ goto out_iounmap; - } - - s->port.irq = irq; - ret = devm_request_irq(&pdev->dev, irq, mxs_auart_irq_handle, 0, - dev_name(&pdev->dev), s); - if (ret) -- goto out_disable_clks; -+ goto out_iounmap; - - platform_set_drvdata(pdev, s); - - ret = mxs_auart_init_gpios(s, &pdev->dev); - if (ret) { - dev_err(&pdev->dev, "Failed to initialize GPIOs.\n"); -- goto out_disable_clks; -+ goto out_iounmap; - } - - /* -@@ -1720,7 +1720,7 @@ static int mxs_auart_probe(struct platform_device *pdev) - */ - ret = mxs_auart_request_gpio_irq(s); - if (ret) -- goto out_disable_clks; -+ goto out_iounmap; - - auart_port[s->port.line] = s; - -@@ -1746,6 +1746,9 @@ out_free_qpio_irq: - mxs_auart_free_gpio_irq(s); - auart_port[pdev->id] = NULL; - -+out_iounmap: -+ iounmap(s->port.membase); -+ - out_disable_clks: - if (is_asm9260_auart(s)) { - clk_disable_unprepare(s->clk); -@@ -1761,6 +1764,7 @@ static int mxs_auart_remove(struct platform_device *pdev) - uart_remove_one_port(&auart_driver, &s->port); - auart_port[pdev->id] = NULL; - mxs_auart_free_gpio_irq(s); -+ iounmap(s->port.membase); - if (is_asm9260_auart(s)) { - clk_disable_unprepare(s->clk); - clk_disable_unprepare(s->clk_ahb); -diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c -index 66a5e2faf57e..01cfeece0f16 100644 ---- a/drivers/tty/serial/serial_core.c -+++ b/drivers/tty/serial/serial_core.c -@@ -41,8 +41,6 @@ static struct lock_class_key port_lock_key; - - #define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) - --#define SYSRQ_TIMEOUT (HZ * 5) -- - static void uart_change_speed(struct tty_struct *tty, struct uart_state *state, - struct ktermios *old_termios); - static void uart_wait_until_sent(struct tty_struct *tty, int timeout); -@@ -1916,6 +1914,12 @@ static inline bool uart_console_enabled(struct uart_port *port) - return uart_console(port) && (port->cons->flags & CON_ENABLED); - } - -+static void __uart_port_spin_lock_init(struct uart_port *port) -+{ -+ spin_lock_init(&port->lock); -+ lockdep_set_class(&port->lock, &port_lock_key); -+} -+ - /* - * Ensure that the serial console lock is initialised early. - * If this port is a console, then the spinlock is already initialised. -@@ -1925,8 +1929,7 @@ static inline void uart_port_spin_lock_init(struct uart_port *port) - if (uart_console(port)) - return; - -- spin_lock_init(&port->lock); -- lockdep_set_class(&port->lock, &port_lock_key); -+ __uart_port_spin_lock_init(port); - } - - #if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL) -@@ -2372,6 +2375,13 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, - /* Power up port for set_mctrl() */ - uart_change_pm(state, UART_PM_STATE_ON); - -+ /* -+ * If this driver supports console, and it hasn't been -+ * successfully registered yet, initialise spin lock for it. -+ */ -+ if (port->cons && !(port->cons->flags & CON_ENABLED)) -+ __uart_port_spin_lock_init(port); -+ - /* - * Ensure that the modem control lines are de-activated. - * keep the DTR setting that is set in uart_set_options() -@@ -3163,7 +3173,7 @@ static DECLARE_WORK(sysrq_enable_work, uart_sysrq_on); - * Returns false if @ch is out of enabling sequence and should be - * handled some other way, true if @ch was consumed. - */ --static bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch) -+bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch) - { - int sysrq_toggle_seq_len = strlen(sysrq_toggle_seq); - -@@ -3186,99 +3196,9 @@ static bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch) - port->sysrq = 0; - return true; - } --#else --static inline bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch) --{ -- return false; --} -+EXPORT_SYMBOL_GPL(uart_try_toggle_sysrq); - #endif - --int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) --{ -- if (!IS_ENABLED(CONFIG_MAGIC_SYSRQ_SERIAL)) -- return 0; -- -- if (!port->has_sysrq || !port->sysrq) -- return 0; -- -- if (ch && time_before(jiffies, port->sysrq)) { -- if (sysrq_mask()) { -- handle_sysrq(ch); -- port->sysrq = 0; -- return 1; -- } -- if (uart_try_toggle_sysrq(port, ch)) -- return 1; -- } -- port->sysrq = 0; -- -- return 0; --} --EXPORT_SYMBOL_GPL(uart_handle_sysrq_char); -- --int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) --{ -- if (!IS_ENABLED(CONFIG_MAGIC_SYSRQ_SERIAL)) -- return 0; -- -- if (!port->has_sysrq || !port->sysrq) -- return 0; -- -- if (ch && time_before(jiffies, port->sysrq)) { -- if (sysrq_mask()) { -- port->sysrq_ch = ch; -- port->sysrq = 0; -- return 1; -- } -- if (uart_try_toggle_sysrq(port, ch)) -- return 1; -- } -- port->sysrq = 0; -- -- return 0; --} --EXPORT_SYMBOL_GPL(uart_prepare_sysrq_char); -- --void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long flags) --__releases(&port->lock) --{ -- if (port->has_sysrq) { -- int sysrq_ch = port->sysrq_ch; -- -- port->sysrq_ch = 0; -- spin_unlock_irqrestore(&port->lock, flags); -- if (sysrq_ch) -- handle_sysrq(sysrq_ch); -- } else { -- spin_unlock_irqrestore(&port->lock, flags); -- } --} --EXPORT_SYMBOL_GPL(uart_unlock_and_check_sysrq); -- --/* -- * We do the SysRQ and SAK checking like this... -- */ --int uart_handle_break(struct uart_port *port) --{ -- struct uart_state *state = port->state; -- -- if (port->handle_break) -- port->handle_break(port); -- -- if (port->has_sysrq && uart_console(port)) { -- if (!port->sysrq) { -- port->sysrq = jiffies + SYSRQ_TIMEOUT; -- return 1; -- } -- port->sysrq = 0; -- } -- -- if (port->flags & UPF_SAK) -- do_SAK(state->port.tty); -- return 0; --} --EXPORT_SYMBOL_GPL(uart_handle_break); -- - EXPORT_SYMBOL(uart_write_wakeup); - EXPORT_SYMBOL(uart_register_driver); - EXPORT_SYMBOL(uart_unregister_driver); -diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c -index e1179e74a2b8..204bb68ce3ca 100644 ---- a/drivers/tty/serial/sh-sci.c -+++ b/drivers/tty/serial/sh-sci.c -@@ -3301,6 +3301,9 @@ static int sci_probe_single(struct platform_device *dev, - sciport->port.flags |= UPF_HARD_FLOW; - } - -+ if (sci_uart_driver.cons->index == sciport->port.line) -+ spin_lock_init(&sciport->port.lock); -+ - ret = uart_add_one_port(&sci_uart_driver, &sciport->port); - if (ret) { - sci_cleanup_single(sciport); -diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c -index 35e9e8faf8de..ac137b6a1dc1 100644 ---- a/drivers/tty/serial/xilinx_uartps.c -+++ b/drivers/tty/serial/xilinx_uartps.c -@@ -1459,7 +1459,6 @@ static int cdns_uart_probe(struct platform_device *pdev) - cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS; - #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE - cdns_uart_uart_driver.cons = &cdns_uart_console; -- cdns_uart_console.index = id; - #endif - - rc = uart_register_driver(&cdns_uart_uart_driver); -diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c -index ae319ef3a832..b60173bc93ce 100644 ---- a/drivers/uio/uio_pdrv_genirq.c -+++ b/drivers/uio/uio_pdrv_genirq.c -@@ -159,9 +159,9 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) - priv->pdev = pdev; - - if (!uioinfo->irq) { -- ret = platform_get_irq(pdev, 0); -+ ret = platform_get_irq_optional(pdev, 0); - uioinfo->irq = ret; -- if (ret == -ENXIO && pdev->dev.of_node) -+ if (ret == -ENXIO) - uioinfo->irq = UIO_IRQ_NONE; - else if (ret == -EPROBE_DEFER) - return ret; -diff --git a/drivers/usb/c67x00/c67x00-sched.c b/drivers/usb/c67x00/c67x00-sched.c -index 633c52de3bb3..9865750bc31e 100644 ---- a/drivers/usb/c67x00/c67x00-sched.c -+++ b/drivers/usb/c67x00/c67x00-sched.c -@@ -486,7 +486,7 @@ c67x00_giveback_urb(struct c67x00_hcd *c67x00, struct urb *urb, int status) - c67x00_release_urb(c67x00, urb); - usb_hcd_unlink_urb_from_ep(c67x00_hcd_to_hcd(c67x00), urb); - spin_unlock(&c67x00->lock); -- usb_hcd_giveback_urb(c67x00_hcd_to_hcd(c67x00), urb, urbp->status); -+ usb_hcd_giveback_urb(c67x00_hcd_to_hcd(c67x00), urb, status); - spin_lock(&c67x00->lock); - } - -diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c -index ae0bdc036464..2a93127187ea 100644 ---- a/drivers/usb/chipidea/core.c -+++ b/drivers/usb/chipidea/core.c -@@ -1265,6 +1265,29 @@ static void ci_controller_suspend(struct ci_hdrc *ci) - enable_irq(ci->irq); - } - -+/* -+ * Handle the wakeup interrupt triggered by extcon connector -+ * We need to call ci_irq again for extcon since the first -+ * interrupt (wakeup int) only let the controller be out of -+ * low power mode, but not handle any interrupts. -+ */ -+static void ci_extcon_wakeup_int(struct ci_hdrc *ci) -+{ -+ struct ci_hdrc_cable *cable_id, *cable_vbus; -+ u32 otgsc = hw_read_otgsc(ci, ~0); -+ -+ cable_id = &ci->platdata->id_extcon; -+ cable_vbus = &ci->platdata->vbus_extcon; -+ -+ if (!IS_ERR(cable_id->edev) && ci->is_otg && -+ (otgsc & OTGSC_IDIE) && (otgsc & OTGSC_IDIS)) -+ ci_irq(ci->irq, ci); -+ -+ if (!IS_ERR(cable_vbus->edev) && ci->is_otg && -+ (otgsc & OTGSC_BSVIE) && (otgsc & OTGSC_BSVIS)) -+ ci_irq(ci->irq, ci); -+} -+ - static int ci_controller_resume(struct device *dev) - { - struct ci_hdrc *ci = dev_get_drvdata(dev); -@@ -1297,6 +1320,7 @@ static int ci_controller_resume(struct device *dev) - enable_irq(ci->irq); - if (ci_otg_is_fsm_mode(ci)) - ci_otg_fsm_wakeup_by_srp(ci); -+ ci_extcon_wakeup_int(ci); - } - - return 0; -diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c -index 5684c4781af9..797afa99ef3b 100644 ---- a/drivers/usb/dwc2/platform.c -+++ b/drivers/usb/dwc2/platform.c -@@ -342,7 +342,8 @@ static void dwc2_driver_shutdown(struct platform_device *dev) - { - struct dwc2_hsotg *hsotg = platform_get_drvdata(dev); - -- disable_irq(hsotg->irq); -+ dwc2_disable_global_interrupts(hsotg); -+ synchronize_irq(hsotg->irq); - } - - /** -diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c -index 349deae7cabd..e2d7f69128a0 100644 ---- a/drivers/usb/gadget/function/f_uac1_legacy.c -+++ b/drivers/usb/gadget/function/f_uac1_legacy.c -@@ -336,7 +336,9 @@ static int f_audio_out_ep_complete(struct usb_ep *ep, struct usb_request *req) - - /* Copy buffer is full, add it to the play_queue */ - if (audio_buf_size - copy_buf->actual < req->actual) { -+ spin_lock_irq(&audio->lock); - list_add_tail(©_buf->list, &audio->play_queue); -+ spin_unlock_irq(&audio->lock); - schedule_work(&audio->playback_work); - copy_buf = f_audio_buffer_alloc(audio_buf_size); - if (IS_ERR(copy_buf)) -diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c -index b771a854e29c..cfdc66e11871 100644 ---- a/drivers/usb/gadget/udc/atmel_usba_udc.c -+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c -@@ -871,7 +871,7 @@ static int usba_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) - u32 status; - - DBG(DBG_GADGET | DBG_QUEUE, "ep_dequeue: %s, req %p\n", -- ep->ep.name, req); -+ ep->ep.name, _req); - - spin_lock_irqsave(&udc->lock, flags); - -diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c -index 89675ee29645..8fbaef5c9d69 100644 ---- a/drivers/usb/serial/ch341.c -+++ b/drivers/usb/serial/ch341.c -@@ -77,6 +77,7 @@ - - static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x4348, 0x5523) }, -+ { USB_DEVICE(0x1a86, 0x7522) }, - { USB_DEVICE(0x1a86, 0x7523) }, - { USB_DEVICE(0x1a86, 0x5523) }, - { }, -diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c -index 216edd5826ca..ecda82198798 100644 ---- a/drivers/usb/serial/cypress_m8.c -+++ b/drivers/usb/serial/cypress_m8.c -@@ -59,6 +59,7 @@ static const struct usb_device_id id_table_earthmate[] = { - - static const struct usb_device_id id_table_cyphidcomrs232[] = { - { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, -+ { USB_DEVICE(VENDOR_ID_SAI, PRODUCT_ID_CYPHIDCOM) }, - { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, - { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) }, - { } /* Terminating entry */ -@@ -73,6 +74,7 @@ static const struct usb_device_id id_table_combined[] = { - { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB) }, - { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, - { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, -+ { USB_DEVICE(VENDOR_ID_SAI, PRODUCT_ID_CYPHIDCOM) }, - { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, - { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) }, - { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) }, -diff --git a/drivers/usb/serial/cypress_m8.h b/drivers/usb/serial/cypress_m8.h -index 35e223751c0e..16b7410ad057 100644 ---- a/drivers/usb/serial/cypress_m8.h -+++ b/drivers/usb/serial/cypress_m8.h -@@ -25,6 +25,9 @@ - #define VENDOR_ID_CYPRESS 0x04b4 - #define PRODUCT_ID_CYPHIDCOM 0x5500 - -+/* Simply Automated HID->COM UPB PIM (using Cypress PID 0x5500) */ -+#define VENDOR_ID_SAI 0x17dd -+ - /* FRWD Dongle - a GPS sports watch */ - #define VENDOR_ID_FRWD 0x6737 - #define PRODUCT_ID_CYPHIDCOM_FRWD 0x0001 -diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c -index d5bff69b1769..b8dfeb4fb2ed 100644 ---- a/drivers/usb/serial/iuu_phoenix.c -+++ b/drivers/usb/serial/iuu_phoenix.c -@@ -697,14 +697,16 @@ static int iuu_uart_write(struct tty_struct *tty, struct usb_serial_port *port, - struct iuu_private *priv = usb_get_serial_port_data(port); - unsigned long flags; - -- if (count > 256) -- return -ENOMEM; -- - spin_lock_irqsave(&priv->lock, flags); - -+ count = min(count, 256 - priv->writelen); -+ if (count == 0) -+ goto out; -+ - /* fill the buffer */ - memcpy(priv->writebuf + priv->writelen, buf, count); - priv->writelen += count; -+out: - spin_unlock_irqrestore(&priv->lock, flags); - - return count; -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index 254a8bbeea67..9b7cee98ea60 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -245,6 +245,7 @@ static void option_instat_callback(struct urb *urb); - /* These Quectel products use Quectel's vendor ID */ - #define QUECTEL_PRODUCT_EC21 0x0121 - #define QUECTEL_PRODUCT_EC25 0x0125 -+#define QUECTEL_PRODUCT_EG95 0x0195 - #define QUECTEL_PRODUCT_BG96 0x0296 - #define QUECTEL_PRODUCT_EP06 0x0306 - #define QUECTEL_PRODUCT_EM12 0x0512 -@@ -1097,6 +1098,8 @@ static const struct usb_device_id option_ids[] = { - .driver_info = RSVD(4) }, - { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25), - .driver_info = RSVD(4) | RSVD(5) | RSVD(6) | RSVD(7) }, -+ { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95), -+ .driver_info = RSVD(4) }, - { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), - .driver_info = RSVD(4) }, - { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), -@@ -2028,6 +2031,9 @@ static const struct usb_device_id option_ids[] = { - .driver_info = RSVD(4) | RSVD(5) }, - { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0105, 0xff), /* Fibocom NL678 series */ - .driver_info = RSVD(6) }, -+ { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */ -+ { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */ -+ { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) }, /* GosunCn GM500 ECM/NCM */ - { } /* Terminating entry */ - }; - MODULE_DEVICE_TABLE(usb, option_ids); -diff --git a/drivers/virt/vboxguest/vboxguest_core.c b/drivers/virt/vboxguest/vboxguest_core.c -index b690a8a4bf9e..18ebd7a6af98 100644 ---- a/drivers/virt/vboxguest/vboxguest_core.c -+++ b/drivers/virt/vboxguest/vboxguest_core.c -@@ -1444,7 +1444,7 @@ static int vbg_ioctl_change_guest_capabilities(struct vbg_dev *gdev, - or_mask = caps->u.in.or_mask; - not_mask = caps->u.in.not_mask; - -- if ((or_mask | not_mask) & ~VMMDEV_EVENT_VALID_EVENT_MASK) -+ if ((or_mask | not_mask) & ~VMMDEV_GUEST_CAPABILITIES_MASK) - return -EINVAL; - - ret = vbg_set_session_capabilities(gdev, session, or_mask, not_mask, -@@ -1520,7 +1520,8 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data) - - /* For VMMDEV_REQUEST hdr->type != VBG_IOCTL_HDR_TYPE_DEFAULT */ - if (req_no_size == VBG_IOCTL_VMMDEV_REQUEST(0) || -- req == VBG_IOCTL_VMMDEV_REQUEST_BIG) -+ req == VBG_IOCTL_VMMDEV_REQUEST_BIG || -+ req == VBG_IOCTL_VMMDEV_REQUEST_BIG_ALT) - return vbg_ioctl_vmmrequest(gdev, session, data); - - if (hdr->type != VBG_IOCTL_HDR_TYPE_DEFAULT) -@@ -1558,6 +1559,7 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data) - case VBG_IOCTL_HGCM_CALL(0): - return vbg_ioctl_hgcm_call(gdev, session, f32bit, data); - case VBG_IOCTL_LOG(0): -+ case VBG_IOCTL_LOG_ALT(0): - return vbg_ioctl_log(data); - } - -diff --git a/drivers/virt/vboxguest/vboxguest_core.h b/drivers/virt/vboxguest/vboxguest_core.h -index 4188c12b839f..77c3a9c8255d 100644 ---- a/drivers/virt/vboxguest/vboxguest_core.h -+++ b/drivers/virt/vboxguest/vboxguest_core.h -@@ -15,6 +15,21 @@ - #include - #include "vmmdev.h" - -+/* -+ * The mainline kernel version (this version) of the vboxguest module -+ * contained a bug where it defined VBGL_IOCTL_VMMDEV_REQUEST_BIG and -+ * VBGL_IOCTL_LOG using _IOC(_IOC_READ | _IOC_WRITE, 'V', ...) instead -+ * of _IO(V, ...) as the out of tree VirtualBox upstream version does. -+ * -+ * These _ALT definitions keep compatibility with the wrong defines the -+ * mainline kernel version used for a while. -+ * Note the VirtualBox userspace bits have always been built against -+ * VirtualBox upstream's headers, so this is likely not necessary. But -+ * we must never break our ABI so we keep these around to be 100% sure. -+ */ -+#define VBG_IOCTL_VMMDEV_REQUEST_BIG_ALT _IOC(_IOC_READ | _IOC_WRITE, 'V', 3, 0) -+#define VBG_IOCTL_LOG_ALT(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 9, s) -+ - struct vbg_session; - - /** VBox guest memory balloon. */ -diff --git a/drivers/virt/vboxguest/vboxguest_linux.c b/drivers/virt/vboxguest/vboxguest_linux.c -index 6e8c0f1c1056..32c2c52f7e84 100644 ---- a/drivers/virt/vboxguest/vboxguest_linux.c -+++ b/drivers/virt/vboxguest/vboxguest_linux.c -@@ -131,7 +131,8 @@ static long vbg_misc_device_ioctl(struct file *filp, unsigned int req, - * the need for a bounce-buffer and another copy later on. - */ - is_vmmdev_req = (req & ~IOCSIZE_MASK) == VBG_IOCTL_VMMDEV_REQUEST(0) || -- req == VBG_IOCTL_VMMDEV_REQUEST_BIG; -+ req == VBG_IOCTL_VMMDEV_REQUEST_BIG || -+ req == VBG_IOCTL_VMMDEV_REQUEST_BIG_ALT; - - if (is_vmmdev_req) - buf = vbg_req_alloc(size, VBG_IOCTL_HDR_TYPE_DEFAULT, -diff --git a/drivers/virt/vboxguest/vmmdev.h b/drivers/virt/vboxguest/vmmdev.h -index 6337b8d75d96..21f408120e3f 100644 ---- a/drivers/virt/vboxguest/vmmdev.h -+++ b/drivers/virt/vboxguest/vmmdev.h -@@ -206,6 +206,8 @@ VMMDEV_ASSERT_SIZE(vmmdev_mask, 24 + 8); - * not. - */ - #define VMMDEV_GUEST_SUPPORTS_GRAPHICS BIT(2) -+/* The mask of valid capabilities, for sanity checking. */ -+#define VMMDEV_GUEST_CAPABILITIES_MASK 0x00000007U - - /** struct vmmdev_hypervisorinfo - Hypervisor info structure. */ - struct vmmdev_hypervisorinfo { -diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c -index 040d2a43e8e3..786fbb7d8be0 100644 ---- a/drivers/xen/xenbus/xenbus_client.c -+++ b/drivers/xen/xenbus/xenbus_client.c -@@ -69,11 +69,27 @@ struct xenbus_map_node { - unsigned int nr_handles; - }; - -+struct map_ring_valloc { -+ struct xenbus_map_node *node; -+ -+ /* Why do we need two arrays? See comment of __xenbus_map_ring */ -+ union { -+ unsigned long addrs[XENBUS_MAX_RING_GRANTS]; -+ pte_t *ptes[XENBUS_MAX_RING_GRANTS]; -+ }; -+ phys_addr_t phys_addrs[XENBUS_MAX_RING_GRANTS]; -+ -+ struct gnttab_map_grant_ref map[XENBUS_MAX_RING_GRANTS]; -+ struct gnttab_unmap_grant_ref unmap[XENBUS_MAX_RING_GRANTS]; -+ -+ unsigned int idx; /* HVM only. */ -+}; -+ - static DEFINE_SPINLOCK(xenbus_valloc_lock); - static LIST_HEAD(xenbus_valloc_pages); - - struct xenbus_ring_ops { -- int (*map)(struct xenbus_device *dev, -+ int (*map)(struct xenbus_device *dev, struct map_ring_valloc *info, - grant_ref_t *gnt_refs, unsigned int nr_grefs, - void **vaddr); - int (*unmap)(struct xenbus_device *dev, void *vaddr); -@@ -440,8 +456,7 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn); - * Map @nr_grefs pages of memory into this domain from another - * domain's grant table. xenbus_map_ring_valloc allocates @nr_grefs - * pages of virtual address space, maps the pages to that address, and -- * sets *vaddr to that address. Returns 0 on success, and GNTST_* -- * (see xen/include/interface/grant_table.h) or -ENOMEM / -EINVAL on -+ * sets *vaddr to that address. Returns 0 on success, and -errno on - * error. If an error is returned, device will switch to - * XenbusStateClosing and the error message will be saved in XenStore. - */ -@@ -449,12 +464,25 @@ int xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t *gnt_refs, - unsigned int nr_grefs, void **vaddr) - { - int err; -+ struct map_ring_valloc *info; -+ -+ *vaddr = NULL; -+ -+ if (nr_grefs > XENBUS_MAX_RING_GRANTS) -+ return -EINVAL; -+ -+ info = kzalloc(sizeof(*info), GFP_KERNEL); -+ if (!info) -+ return -ENOMEM; - -- err = ring_ops->map(dev, gnt_refs, nr_grefs, vaddr); -- /* Some hypervisors are buggy and can return 1. */ -- if (err > 0) -- err = GNTST_general_error; -+ info->node = kzalloc(sizeof(*info->node), GFP_KERNEL); -+ if (!info->node) -+ err = -ENOMEM; -+ else -+ err = ring_ops->map(dev, info, gnt_refs, nr_grefs, vaddr); - -+ kfree(info->node); -+ kfree(info); - return err; - } - EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc); -@@ -466,62 +494,57 @@ static int __xenbus_map_ring(struct xenbus_device *dev, - grant_ref_t *gnt_refs, - unsigned int nr_grefs, - grant_handle_t *handles, -- phys_addr_t *addrs, -+ struct map_ring_valloc *info, - unsigned int flags, - bool *leaked) - { -- struct gnttab_map_grant_ref map[XENBUS_MAX_RING_GRANTS]; -- struct gnttab_unmap_grant_ref unmap[XENBUS_MAX_RING_GRANTS]; - int i, j; -- int err = GNTST_okay; - - if (nr_grefs > XENBUS_MAX_RING_GRANTS) - return -EINVAL; - - for (i = 0; i < nr_grefs; i++) { -- memset(&map[i], 0, sizeof(map[i])); -- gnttab_set_map_op(&map[i], addrs[i], flags, gnt_refs[i], -- dev->otherend_id); -+ gnttab_set_map_op(&info->map[i], info->phys_addrs[i], flags, -+ gnt_refs[i], dev->otherend_id); - handles[i] = INVALID_GRANT_HANDLE; - } - -- gnttab_batch_map(map, i); -+ gnttab_batch_map(info->map, i); - - for (i = 0; i < nr_grefs; i++) { -- if (map[i].status != GNTST_okay) { -- err = map[i].status; -- xenbus_dev_fatal(dev, map[i].status, -+ if (info->map[i].status != GNTST_okay) { -+ xenbus_dev_fatal(dev, info->map[i].status, - "mapping in shared page %d from domain %d", - gnt_refs[i], dev->otherend_id); - goto fail; - } else -- handles[i] = map[i].handle; -+ handles[i] = info->map[i].handle; - } - -- return GNTST_okay; -+ return 0; - - fail: - for (i = j = 0; i < nr_grefs; i++) { - if (handles[i] != INVALID_GRANT_HANDLE) { -- memset(&unmap[j], 0, sizeof(unmap[j])); -- gnttab_set_unmap_op(&unmap[j], (phys_addr_t)addrs[i], -+ gnttab_set_unmap_op(&info->unmap[j], -+ info->phys_addrs[i], - GNTMAP_host_map, handles[i]); - j++; - } - } - -- if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, unmap, j)) -+ if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, info->unmap, j)) - BUG(); - - *leaked = false; - for (i = 0; i < j; i++) { -- if (unmap[i].status != GNTST_okay) { -+ if (info->unmap[i].status != GNTST_okay) { - *leaked = true; - break; - } - } - -- return err; -+ return -ENOENT; - } - - /** -@@ -566,21 +589,12 @@ static int xenbus_unmap_ring(struct xenbus_device *dev, grant_handle_t *handles, - return err; - } - --struct map_ring_valloc_hvm --{ -- unsigned int idx; -- -- /* Why do we need two arrays? See comment of __xenbus_map_ring */ -- phys_addr_t phys_addrs[XENBUS_MAX_RING_GRANTS]; -- unsigned long addrs[XENBUS_MAX_RING_GRANTS]; --}; -- - static void xenbus_map_ring_setup_grant_hvm(unsigned long gfn, - unsigned int goffset, - unsigned int len, - void *data) - { -- struct map_ring_valloc_hvm *info = data; -+ struct map_ring_valloc *info = data; - unsigned long vaddr = (unsigned long)gfn_to_virt(gfn); - - info->phys_addrs[info->idx] = vaddr; -@@ -589,39 +603,28 @@ static void xenbus_map_ring_setup_grant_hvm(unsigned long gfn, - info->idx++; - } - --static int xenbus_map_ring_valloc_hvm(struct xenbus_device *dev, -- grant_ref_t *gnt_ref, -- unsigned int nr_grefs, -- void **vaddr) -+static int xenbus_map_ring_hvm(struct xenbus_device *dev, -+ struct map_ring_valloc *info, -+ grant_ref_t *gnt_ref, -+ unsigned int nr_grefs, -+ void **vaddr) - { -- struct xenbus_map_node *node; -+ struct xenbus_map_node *node = info->node; - int err; - void *addr; - bool leaked = false; -- struct map_ring_valloc_hvm info = { -- .idx = 0, -- }; - unsigned int nr_pages = XENBUS_PAGES(nr_grefs); - -- if (nr_grefs > XENBUS_MAX_RING_GRANTS) -- return -EINVAL; -- -- *vaddr = NULL; -- -- node = kzalloc(sizeof(*node), GFP_KERNEL); -- if (!node) -- return -ENOMEM; -- - err = alloc_xenballooned_pages(nr_pages, node->hvm.pages); - if (err) - goto out_err; - - gnttab_foreach_grant(node->hvm.pages, nr_grefs, - xenbus_map_ring_setup_grant_hvm, -- &info); -+ info); - - err = __xenbus_map_ring(dev, gnt_ref, nr_grefs, node->handles, -- info.phys_addrs, GNTMAP_host_map, &leaked); -+ info, GNTMAP_host_map, &leaked); - node->nr_handles = nr_grefs; - - if (err) -@@ -641,11 +644,13 @@ static int xenbus_map_ring_valloc_hvm(struct xenbus_device *dev, - spin_unlock(&xenbus_valloc_lock); - - *vaddr = addr; -+ info->node = NULL; -+ - return 0; - - out_xenbus_unmap_ring: - if (!leaked) -- xenbus_unmap_ring(dev, node->handles, nr_grefs, info.addrs); -+ xenbus_unmap_ring(dev, node->handles, nr_grefs, info->addrs); - else - pr_alert("leaking %p size %u page(s)", - addr, nr_pages); -@@ -653,7 +658,6 @@ static int xenbus_map_ring_valloc_hvm(struct xenbus_device *dev, - if (!leaked) - free_xenballooned_pages(nr_pages, node->hvm.pages); - out_err: -- kfree(node); - return err; - } - -@@ -676,40 +680,28 @@ int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr) - EXPORT_SYMBOL_GPL(xenbus_unmap_ring_vfree); - - #ifdef CONFIG_XEN_PV --static int xenbus_map_ring_valloc_pv(struct xenbus_device *dev, -- grant_ref_t *gnt_refs, -- unsigned int nr_grefs, -- void **vaddr) -+static int xenbus_map_ring_pv(struct xenbus_device *dev, -+ struct map_ring_valloc *info, -+ grant_ref_t *gnt_refs, -+ unsigned int nr_grefs, -+ void **vaddr) - { -- struct xenbus_map_node *node; -+ struct xenbus_map_node *node = info->node; - struct vm_struct *area; -- pte_t *ptes[XENBUS_MAX_RING_GRANTS]; -- phys_addr_t phys_addrs[XENBUS_MAX_RING_GRANTS]; - int err = GNTST_okay; - int i; - bool leaked; - -- *vaddr = NULL; -- -- if (nr_grefs > XENBUS_MAX_RING_GRANTS) -- return -EINVAL; -- -- node = kzalloc(sizeof(*node), GFP_KERNEL); -- if (!node) -+ area = alloc_vm_area(XEN_PAGE_SIZE * nr_grefs, info->ptes); -+ if (!area) - return -ENOMEM; - -- area = alloc_vm_area(XEN_PAGE_SIZE * nr_grefs, ptes); -- if (!area) { -- kfree(node); -- return -ENOMEM; -- } -- - for (i = 0; i < nr_grefs; i++) -- phys_addrs[i] = arbitrary_virt_to_machine(ptes[i]).maddr; -+ info->phys_addrs[i] = -+ arbitrary_virt_to_machine(info->ptes[i]).maddr; - - err = __xenbus_map_ring(dev, gnt_refs, nr_grefs, node->handles, -- phys_addrs, -- GNTMAP_host_map | GNTMAP_contains_pte, -+ info, GNTMAP_host_map | GNTMAP_contains_pte, - &leaked); - if (err) - goto failed; -@@ -722,6 +714,8 @@ static int xenbus_map_ring_valloc_pv(struct xenbus_device *dev, - spin_unlock(&xenbus_valloc_lock); - - *vaddr = area->addr; -+ info->node = NULL; -+ - return 0; - - failed: -@@ -730,11 +724,10 @@ failed: - else - pr_alert("leaking VM area %p size %u page(s)", area, nr_grefs); - -- kfree(node); - return err; - } - --static int xenbus_unmap_ring_vfree_pv(struct xenbus_device *dev, void *vaddr) -+static int xenbus_unmap_ring_pv(struct xenbus_device *dev, void *vaddr) - { - struct xenbus_map_node *node; - struct gnttab_unmap_grant_ref unmap[XENBUS_MAX_RING_GRANTS]; -@@ -798,12 +791,12 @@ static int xenbus_unmap_ring_vfree_pv(struct xenbus_device *dev, void *vaddr) - } - - static const struct xenbus_ring_ops ring_ops_pv = { -- .map = xenbus_map_ring_valloc_pv, -- .unmap = xenbus_unmap_ring_vfree_pv, -+ .map = xenbus_map_ring_pv, -+ .unmap = xenbus_unmap_ring_pv, - }; - #endif - --struct unmap_ring_vfree_hvm -+struct unmap_ring_hvm - { - unsigned int idx; - unsigned long addrs[XENBUS_MAX_RING_GRANTS]; -@@ -814,19 +807,19 @@ static void xenbus_unmap_ring_setup_grant_hvm(unsigned long gfn, - unsigned int len, - void *data) - { -- struct unmap_ring_vfree_hvm *info = data; -+ struct unmap_ring_hvm *info = data; - - info->addrs[info->idx] = (unsigned long)gfn_to_virt(gfn); - - info->idx++; - } - --static int xenbus_unmap_ring_vfree_hvm(struct xenbus_device *dev, void *vaddr) -+static int xenbus_unmap_ring_hvm(struct xenbus_device *dev, void *vaddr) - { - int rv; - struct xenbus_map_node *node; - void *addr; -- struct unmap_ring_vfree_hvm info = { -+ struct unmap_ring_hvm info = { - .idx = 0, - }; - unsigned int nr_pages; -@@ -887,8 +880,8 @@ enum xenbus_state xenbus_read_driver_state(const char *path) - EXPORT_SYMBOL_GPL(xenbus_read_driver_state); - - static const struct xenbus_ring_ops ring_ops_hvm = { -- .map = xenbus_map_ring_valloc_hvm, -- .unmap = xenbus_unmap_ring_vfree_hvm, -+ .map = xenbus_map_ring_hvm, -+ .unmap = xenbus_unmap_ring_hvm, - }; - - void __init xenbus_ring_ops_init(void) -diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c -index c97570eb2c18..7fefd2bd111c 100644 ---- a/fs/cifs/transport.c -+++ b/fs/cifs/transport.c -@@ -528,7 +528,7 @@ wait_for_free_credits(struct TCP_Server_Info *server, const int num_credits, - const int timeout, const int flags, - unsigned int *instance) - { -- int rc; -+ long rc; - int *credits; - int optype; - long int t; -diff --git a/fs/fuse/file.c b/fs/fuse/file.c -index e3afceecaa6b..0df03bc520a9 100644 ---- a/fs/fuse/file.c -+++ b/fs/fuse/file.c -@@ -18,6 +18,7 @@ - #include - #include - #include -+#include - - static struct page **fuse_pages_alloc(unsigned int npages, gfp_t flags, - struct fuse_page_desc **desc) -@@ -2148,10 +2149,8 @@ static int fuse_writepages(struct address_space *mapping, - - err = write_cache_pages(mapping, wbc, fuse_writepages_fill, &data); - if (data.wpa) { -- /* Ignore errors if we can write at least one page */ - WARN_ON(!data.wpa->ia.ap.num_pages); - fuse_writepages_send(&data); -- err = 0; - } - if (data.ff) - fuse_file_put(data.ff, false, false); -@@ -2760,7 +2759,16 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, - struct iovec *iov = iov_page; - - iov->iov_base = (void __user *)arg; -- iov->iov_len = _IOC_SIZE(cmd); -+ -+ switch (cmd) { -+ case FS_IOC_GETFLAGS: -+ case FS_IOC_SETFLAGS: -+ iov->iov_len = sizeof(int); -+ break; -+ default: -+ iov->iov_len = _IOC_SIZE(cmd); -+ break; -+ } - - if (_IOC_DIR(cmd) & _IOC_WRITE) { - in_iov = iov; -diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c -index 95d712d44ca1..46dde0b659ec 100644 ---- a/fs/fuse/inode.c -+++ b/fs/fuse/inode.c -@@ -121,10 +121,12 @@ static void fuse_evict_inode(struct inode *inode) - } - } - --static int fuse_remount_fs(struct super_block *sb, int *flags, char *data) -+static int fuse_reconfigure(struct fs_context *fc) - { -+ struct super_block *sb = fc->root->d_sb; -+ - sync_filesystem(sb); -- if (*flags & SB_MANDLOCK) -+ if (fc->sb_flags & SB_MANDLOCK) - return -EINVAL; - - return 0; -@@ -468,6 +470,13 @@ static int fuse_parse_param(struct fs_context *fc, struct fs_parameter *param) - struct fuse_fs_context *ctx = fc->fs_private; - int opt; - -+ /* -+ * Ignore options coming from mount(MS_REMOUNT) for backward -+ * compatibility. -+ */ -+ if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) -+ return 0; -+ - opt = fs_parse(fc, fuse_fs_parameters, param, &result); - if (opt < 0) - return opt; -@@ -810,7 +819,6 @@ static const struct super_operations fuse_super_operations = { - .evict_inode = fuse_evict_inode, - .write_inode = fuse_write_inode, - .drop_inode = generic_delete_inode, -- .remount_fs = fuse_remount_fs, - .put_super = fuse_put_super, - .umount_begin = fuse_umount_begin, - .statfs = fuse_statfs, -@@ -1284,6 +1292,7 @@ static int fuse_get_tree(struct fs_context *fc) - static const struct fs_context_operations fuse_context_ops = { - .free = fuse_free_fc, - .parse_param = fuse_parse_param, -+ .reconfigure = fuse_reconfigure, - .get_tree = fuse_get_tree, - }; - -diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c -index 9e9c7a4b8c66..fc97c4d24dc5 100644 ---- a/fs/gfs2/glops.c -+++ b/fs/gfs2/glops.c -@@ -527,8 +527,7 @@ static int freeze_go_sync(struct gfs2_glock *gl) - int error = 0; - struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; - -- if (gl->gl_state == LM_ST_SHARED && !gfs2_withdrawn(sdp) && -- test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) { -+ if (gl->gl_req == LM_ST_EXCLUSIVE && !gfs2_withdrawn(sdp)) { - atomic_set(&sdp->sd_freeze_state, SFS_STARTING_FREEZE); - error = freeze_super(sdp->sd_vfs); - if (error) { -@@ -541,8 +540,11 @@ static int freeze_go_sync(struct gfs2_glock *gl) - gfs2_assert_withdraw(sdp, 0); - } - queue_work(gfs2_freeze_wq, &sdp->sd_freeze_work); -- gfs2_log_flush(sdp, NULL, GFS2_LOG_HEAD_FLUSH_FREEZE | -- GFS2_LFC_FREEZE_GO_SYNC); -+ if (test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) -+ gfs2_log_flush(sdp, NULL, GFS2_LOG_HEAD_FLUSH_FREEZE | -+ GFS2_LFC_FREEZE_GO_SYNC); -+ else /* read-only mounts */ -+ atomic_set(&sdp->sd_freeze_state, SFS_FROZEN); - } - return 0; - } -diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h -index 84a824293a78..013c029dd16b 100644 ---- a/fs/gfs2/incore.h -+++ b/fs/gfs2/incore.h -@@ -395,7 +395,6 @@ enum { - GIF_QD_LOCKED = 1, - GIF_ALLOC_FAILED = 2, - GIF_SW_PAGED = 3, -- GIF_ORDERED = 4, - GIF_FREE_VFS_INODE = 5, - GIF_GLOP_PENDING = 6, - }; -diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c -index 04882712cd66..62a73bd6575c 100644 ---- a/fs/gfs2/log.c -+++ b/fs/gfs2/log.c -@@ -613,6 +613,12 @@ static int ip_cmp(void *priv, struct list_head *a, struct list_head *b) - return 0; - } - -+static void __ordered_del_inode(struct gfs2_inode *ip) -+{ -+ if (!list_empty(&ip->i_ordered)) -+ list_del_init(&ip->i_ordered); -+} -+ - static void gfs2_ordered_write(struct gfs2_sbd *sdp) - { - struct gfs2_inode *ip; -@@ -623,8 +629,7 @@ static void gfs2_ordered_write(struct gfs2_sbd *sdp) - while (!list_empty(&sdp->sd_log_ordered)) { - ip = list_first_entry(&sdp->sd_log_ordered, struct gfs2_inode, i_ordered); - if (ip->i_inode.i_mapping->nrpages == 0) { -- test_and_clear_bit(GIF_ORDERED, &ip->i_flags); -- list_del(&ip->i_ordered); -+ __ordered_del_inode(ip); - continue; - } - list_move(&ip->i_ordered, &written); -@@ -643,8 +648,7 @@ static void gfs2_ordered_wait(struct gfs2_sbd *sdp) - spin_lock(&sdp->sd_ordered_lock); - while (!list_empty(&sdp->sd_log_ordered)) { - ip = list_first_entry(&sdp->sd_log_ordered, struct gfs2_inode, i_ordered); -- list_del(&ip->i_ordered); -- WARN_ON(!test_and_clear_bit(GIF_ORDERED, &ip->i_flags)); -+ __ordered_del_inode(ip); - if (ip->i_inode.i_mapping->nrpages == 0) - continue; - spin_unlock(&sdp->sd_ordered_lock); -@@ -659,8 +663,7 @@ void gfs2_ordered_del_inode(struct gfs2_inode *ip) - struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); - - spin_lock(&sdp->sd_ordered_lock); -- if (test_and_clear_bit(GIF_ORDERED, &ip->i_flags)) -- list_del(&ip->i_ordered); -+ __ordered_del_inode(ip); - spin_unlock(&sdp->sd_ordered_lock); - } - -diff --git a/fs/gfs2/log.h b/fs/gfs2/log.h -index c1cd6ae17659..8965c751a303 100644 ---- a/fs/gfs2/log.h -+++ b/fs/gfs2/log.h -@@ -53,9 +53,9 @@ static inline void gfs2_ordered_add_inode(struct gfs2_inode *ip) - if (gfs2_is_jdata(ip) || !gfs2_is_ordered(sdp)) - return; - -- if (!test_bit(GIF_ORDERED, &ip->i_flags)) { -+ if (list_empty(&ip->i_ordered)) { - spin_lock(&sdp->sd_ordered_lock); -- if (!test_and_set_bit(GIF_ORDERED, &ip->i_flags)) -+ if (list_empty(&ip->i_ordered)) - list_add(&ip->i_ordered, &sdp->sd_log_ordered); - spin_unlock(&sdp->sd_ordered_lock); - } -diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c -index a1a295b739fb..4f2edb777a72 100644 ---- a/fs/gfs2/main.c -+++ b/fs/gfs2/main.c -@@ -39,6 +39,7 @@ static void gfs2_init_inode_once(void *foo) - atomic_set(&ip->i_sizehint, 0); - init_rwsem(&ip->i_rw_mutex); - INIT_LIST_HEAD(&ip->i_trunc_list); -+ INIT_LIST_HEAD(&ip->i_ordered); - ip->i_qadata = NULL; - gfs2_holder_mark_uninitialized(&ip->i_rgd_gh); - memset(&ip->i_res, 0, sizeof(ip->i_res)); -diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c -index 094f5fe7c009..6d18d2c91add 100644 ---- a/fs/gfs2/ops_fstype.c -+++ b/fs/gfs2/ops_fstype.c -@@ -1136,7 +1136,18 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc) - goto fail_per_node; - } - -- if (!sb_rdonly(sb)) { -+ if (sb_rdonly(sb)) { -+ struct gfs2_holder freeze_gh; -+ -+ error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, -+ LM_FLAG_NOEXP | GL_EXACT, -+ &freeze_gh); -+ if (error) { -+ fs_err(sdp, "can't make FS RO: %d\n", error); -+ goto fail_per_node; -+ } -+ gfs2_glock_dq_uninit(&freeze_gh); -+ } else { - error = gfs2_make_fs_rw(sdp); - if (error) { - fs_err(sdp, "can't make FS RW: %d\n", error); -diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c -index 96c345f49273..390ea79d682c 100644 ---- a/fs/gfs2/recovery.c -+++ b/fs/gfs2/recovery.c -@@ -364,8 +364,8 @@ void gfs2_recover_func(struct work_struct *work) - /* Acquire a shared hold on the freeze lock */ - - error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, -- LM_FLAG_NOEXP | LM_FLAG_PRIORITY, -- &thaw_gh); -+ LM_FLAG_NOEXP | LM_FLAG_PRIORITY | -+ GL_EXACT, &thaw_gh); - if (error) - goto fail_gunlock_ji; - -diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c -index 956fced0a8ec..160bb4598b48 100644 ---- a/fs/gfs2/super.c -+++ b/fs/gfs2/super.c -@@ -167,7 +167,8 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp) - if (error) - return error; - -- error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, 0, -+ error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, -+ LM_FLAG_NOEXP | GL_EXACT, - &freeze_gh); - if (error) - goto fail_threads; -@@ -203,7 +204,6 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp) - return 0; - - fail: -- freeze_gh.gh_flags |= GL_NOCACHE; - gfs2_glock_dq_uninit(&freeze_gh); - fail_threads: - if (sdp->sd_quotad_process) -@@ -430,7 +430,7 @@ static int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp) - } - - error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_EXCLUSIVE, -- GL_NOCACHE, &sdp->sd_freeze_gh); -+ LM_FLAG_NOEXP, &sdp->sd_freeze_gh); - if (error) - goto out; - -@@ -613,13 +613,15 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp) - !gfs2_glock_is_locked_by_me(sdp->sd_freeze_gl)) { - if (!log_write_allowed) { - error = gfs2_glock_nq_init(sdp->sd_freeze_gl, -- LM_ST_SHARED, GL_NOCACHE | -- LM_FLAG_TRY, &freeze_gh); -+ LM_ST_SHARED, LM_FLAG_TRY | -+ LM_FLAG_NOEXP | GL_EXACT, -+ &freeze_gh); - if (error == GLR_TRYFAILED) - error = 0; - } else { - error = gfs2_glock_nq_init(sdp->sd_freeze_gl, -- LM_ST_SHARED, GL_NOCACHE, -+ LM_ST_SHARED, -+ LM_FLAG_NOEXP | GL_EXACT, - &freeze_gh); - if (error && !gfs2_withdrawn(sdp)) - return error; -@@ -761,8 +763,8 @@ void gfs2_freeze_func(struct work_struct *work) - struct super_block *sb = sdp->sd_vfs; - - atomic_inc(&sb->s_active); -- error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, 0, -- &freeze_gh); -+ error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, -+ LM_FLAG_NOEXP | GL_EXACT, &freeze_gh); - if (error) { - fs_info(sdp, "GFS2: couldn't get freeze lock : %d\n", error); - gfs2_assert_withdraw(sdp, 0); -@@ -774,8 +776,6 @@ void gfs2_freeze_func(struct work_struct *work) - error); - gfs2_assert_withdraw(sdp, 0); - } -- if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) -- freeze_gh.gh_flags |= GL_NOCACHE; - gfs2_glock_dq_uninit(&freeze_gh); - } - deactivate_super(sb); -diff --git a/fs/io_uring.c b/fs/io_uring.c -index ba2184841cb5..51be3a20ade1 100644 ---- a/fs/io_uring.c -+++ b/fs/io_uring.c -@@ -3884,10 +3884,16 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock) - - ret = __sys_recvmsg_sock(sock, &kmsg->msg, req->sr_msg.msg, - kmsg->uaddr, flags); -- if (force_nonblock && ret == -EAGAIN) -- return io_setup_async_msg(req, kmsg); -+ if (force_nonblock && ret == -EAGAIN) { -+ ret = io_setup_async_msg(req, kmsg); -+ if (ret != -EAGAIN) -+ kfree(kbuf); -+ return ret; -+ } - if (ret == -ERESTARTSYS) - ret = -EINTR; -+ if (kbuf) -+ kfree(kbuf); - } - - if (kmsg && kmsg->iov != kmsg->fast_iov) -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c -index e32717fd1169..2e2dac29a9e9 100644 ---- a/fs/nfs/nfs4proc.c -+++ b/fs/nfs/nfs4proc.c -@@ -774,6 +774,14 @@ static void nfs4_slot_sequence_acked(struct nfs4_slot *slot, - slot->seq_nr_last_acked = seqnr; - } - -+static void nfs4_probe_sequence(struct nfs_client *client, const struct cred *cred, -+ struct nfs4_slot *slot) -+{ -+ struct rpc_task *task = _nfs41_proc_sequence(client, cred, slot, true); -+ if (!IS_ERR(task)) -+ rpc_put_task_async(task); -+} -+ - static int nfs41_sequence_process(struct rpc_task *task, - struct nfs4_sequence_res *res) - { -@@ -790,6 +798,7 @@ static int nfs41_sequence_process(struct rpc_task *task, - goto out; - - session = slot->table->session; -+ clp = session->clp; - - trace_nfs4_sequence_done(session, res); - -@@ -804,7 +813,6 @@ static int nfs41_sequence_process(struct rpc_task *task, - nfs4_slot_sequence_acked(slot, slot->seq_nr); - /* Update the slot's sequence and clientid lease timer */ - slot->seq_done = 1; -- clp = session->clp; - do_renew_lease(clp, res->sr_timestamp); - /* Check sequence flags */ - nfs41_handle_sequence_flag_errors(clp, res->sr_status_flags, -@@ -852,10 +860,18 @@ static int nfs41_sequence_process(struct rpc_task *task, - /* - * Were one or more calls using this slot interrupted? - * If the server never received the request, then our -- * transmitted slot sequence number may be too high. -+ * transmitted slot sequence number may be too high. However, -+ * if the server did receive the request then it might -+ * accidentally give us a reply with a mismatched operation. -+ * We can sort this out by sending a lone sequence operation -+ * to the server on the same slot. - */ - if ((s32)(slot->seq_nr - slot->seq_nr_last_acked) > 1) { - slot->seq_nr--; -+ if (task->tk_msg.rpc_proc != &nfs4_procedures[NFSPROC4_CLNT_SEQUENCE]) { -+ nfs4_probe_sequence(clp, task->tk_msg.rpc_cred, slot); -+ res->sr_slot = NULL; -+ } - goto retry_nowait; - } - /* -diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c -index ed5c1078919c..c19531dc62ef 100644 ---- a/fs/overlayfs/export.c -+++ b/fs/overlayfs/export.c -@@ -478,7 +478,7 @@ static struct dentry *ovl_lookup_real_inode(struct super_block *sb, - if (IS_ERR_OR_NULL(this)) - return this; - -- if (WARN_ON(ovl_dentry_real_at(this, layer->idx) != real)) { -+ if (ovl_dentry_real_at(this, layer->idx) != real) { - dput(this); - this = ERR_PTR(-EIO); - } -diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c -index 87c362f65448..6804e55db217 100644 ---- a/fs/overlayfs/file.c -+++ b/fs/overlayfs/file.c -@@ -32,13 +32,16 @@ static char ovl_whatisit(struct inode *inode, struct inode *realinode) - return 'm'; - } - -+/* No atime modificaton nor notify on underlying */ -+#define OVL_OPEN_FLAGS (O_NOATIME | FMODE_NONOTIFY) -+ - static struct file *ovl_open_realfile(const struct file *file, - struct inode *realinode) - { - struct inode *inode = file_inode(file); - struct file *realfile; - const struct cred *old_cred; -- int flags = file->f_flags | O_NOATIME | FMODE_NONOTIFY; -+ int flags = file->f_flags | OVL_OPEN_FLAGS; - - old_cred = ovl_override_creds(inode->i_sb); - realfile = open_with_fake_path(&file->f_path, flags, realinode, -@@ -59,8 +62,7 @@ static int ovl_change_flags(struct file *file, unsigned int flags) - struct inode *inode = file_inode(file); - int err; - -- /* No atime modificaton on underlying */ -- flags |= O_NOATIME | FMODE_NONOTIFY; -+ flags |= OVL_OPEN_FLAGS; - - /* If some flag changed that cannot be changed then something's amiss */ - if (WARN_ON((file->f_flags ^ flags) & ~OVL_SETFL_MASK)) -@@ -113,7 +115,7 @@ static int ovl_real_fdget_meta(const struct file *file, struct fd *real, - } - - /* Did the flags change since open? */ -- if (unlikely((file->f_flags ^ real->file->f_flags) & ~O_NOATIME)) -+ if (unlikely((file->f_flags ^ real->file->f_flags) & ~OVL_OPEN_FLAGS)) - return ovl_change_flags(real->file, file->f_flags); - - return 0; -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -index 732ad5495c92..72395e42e897 100644 ---- a/fs/overlayfs/super.c -+++ b/fs/overlayfs/super.c -@@ -1331,6 +1331,18 @@ static bool ovl_lower_uuid_ok(struct ovl_fs *ofs, const uuid_t *uuid) - if (!ofs->config.nfs_export && !ofs->upper_mnt) - return true; - -+ /* -+ * We allow using single lower with null uuid for index and nfs_export -+ * for example to support those features with single lower squashfs. -+ * To avoid regressions in setups of overlay with re-formatted lower -+ * squashfs, do not allow decoding origin with lower null uuid unless -+ * user opted-in to one of the new features that require following the -+ * lower inode of non-dir upper. -+ */ -+ if (!ofs->config.index && !ofs->config.metacopy && !ofs->config.xino && -+ uuid_is_null(uuid)) -+ return false; -+ - for (i = 0; i < ofs->numfs; i++) { - /* - * We use uuid to associate an overlay lower file handle with a -@@ -1438,14 +1450,23 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs, - if (err < 0) - goto out; - -+ /* -+ * Check if lower root conflicts with this overlay layers before -+ * checking if it is in-use as upperdir/workdir of "another" -+ * mount, because we do not bother to check in ovl_is_inuse() if -+ * the upperdir/workdir is in fact in-use by our -+ * upperdir/workdir. -+ */ - err = ovl_setup_trap(sb, stack[i].dentry, &trap, "lowerdir"); - if (err) - goto out; - - if (ovl_is_inuse(stack[i].dentry)) { - err = ovl_report_in_use(ofs, "lowerdir"); -- if (err) -+ if (err) { -+ iput(trap); - goto out; -+ } - } - - mnt = clone_private_mount(&stack[i]); -diff --git a/include/dt-bindings/clock/qcom,gcc-msm8998.h b/include/dt-bindings/clock/qcom,gcc-msm8998.h -index 63e02dc32a0b..6a73a174f049 100644 ---- a/include/dt-bindings/clock/qcom,gcc-msm8998.h -+++ b/include/dt-bindings/clock/qcom,gcc-msm8998.h -@@ -183,6 +183,7 @@ - #define GCC_MSS_SNOC_AXI_CLK 174 - #define GCC_MSS_MNOC_BIMC_AXI_CLK 175 - #define GCC_BIMC_GFX_CLK 176 -+#define UFS_UNIPRO_CORE_CLK_SRC 177 - - #define PCIE_0_GDSC 0 - #define UFS_GDSC 1 -diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h -index 32868fbedc9e..02809e4dd661 100644 ---- a/include/linux/blkdev.h -+++ b/include/linux/blkdev.h -@@ -585,6 +585,7 @@ struct request_queue { - u64 write_hints[BLK_MAX_WRITE_HINTS]; - }; - -+/* Keep blk_queue_flag_name[] in sync with the definitions below */ - #define QUEUE_FLAG_STOPPED 0 /* queue is stopped */ - #define QUEUE_FLAG_DYING 1 /* queue being torn down */ - #define QUEUE_FLAG_NOMERGES 3 /* disable merge attempts */ -diff --git a/include/linux/bpf.h b/include/linux/bpf.h -index fd2b2322412d..746bae8624a8 100644 ---- a/include/linux/bpf.h -+++ b/include/linux/bpf.h -@@ -1444,13 +1444,16 @@ static inline void bpf_map_offload_map_free(struct bpf_map *map) - #endif /* CONFIG_NET && CONFIG_BPF_SYSCALL */ - - #if defined(CONFIG_BPF_STREAM_PARSER) --int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog, u32 which); -+int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog, -+ struct bpf_prog *old, u32 which); - int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog); -+int sock_map_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype); - void sock_map_unhash(struct sock *sk); - void sock_map_close(struct sock *sk, long timeout); - #else - static inline int sock_map_prog_update(struct bpf_map *map, -- struct bpf_prog *prog, u32 which) -+ struct bpf_prog *prog, -+ struct bpf_prog *old, u32 which) - { - return -EOPNOTSUPP; - } -@@ -1460,6 +1463,12 @@ static inline int sock_map_get_from_fd(const union bpf_attr *attr, - { - return -EINVAL; - } -+ -+static inline int sock_map_prog_detach(const union bpf_attr *attr, -+ enum bpf_prog_type ptype) -+{ -+ return -EOPNOTSUPP; -+} - #endif /* CONFIG_BPF_STREAM_PARSER */ - - #if defined(CONFIG_INET) && defined(CONFIG_BPF_SYSCALL) -diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h -index 52661155f85f..fee0b5547cd0 100644 ---- a/include/linux/cgroup-defs.h -+++ b/include/linux/cgroup-defs.h -@@ -790,7 +790,9 @@ struct sock_cgroup_data { - union { - #ifdef __LITTLE_ENDIAN - struct { -- u8 is_data; -+ u8 is_data : 1; -+ u8 no_refcnt : 1; -+ u8 unused : 6; - u8 padding; - u16 prioidx; - u32 classid; -@@ -800,7 +802,9 @@ struct sock_cgroup_data { - u32 classid; - u16 prioidx; - u8 padding; -- u8 is_data; -+ u8 unused : 6; -+ u8 no_refcnt : 1; -+ u8 is_data : 1; - } __packed; - #endif - u64 val; -diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h -index 4598e4da6b1b..618838c48313 100644 ---- a/include/linux/cgroup.h -+++ b/include/linux/cgroup.h -@@ -822,6 +822,7 @@ extern spinlock_t cgroup_sk_update_lock; - - void cgroup_sk_alloc_disable(void); - void cgroup_sk_alloc(struct sock_cgroup_data *skcd); -+void cgroup_sk_clone(struct sock_cgroup_data *skcd); - void cgroup_sk_free(struct sock_cgroup_data *skcd); - - static inline struct cgroup *sock_cgroup_ptr(struct sock_cgroup_data *skcd) -@@ -835,7 +836,7 @@ static inline struct cgroup *sock_cgroup_ptr(struct sock_cgroup_data *skcd) - */ - v = READ_ONCE(skcd->val); - -- if (v & 1) -+ if (v & 3) - return &cgrp_dfl_root.cgrp; - - return (struct cgroup *)(unsigned long)v ?: &cgrp_dfl_root.cgrp; -@@ -847,6 +848,7 @@ static inline struct cgroup *sock_cgroup_ptr(struct sock_cgroup_data *skcd) - #else /* CONFIG_CGROUP_DATA */ - - static inline void cgroup_sk_alloc(struct sock_cgroup_data *skcd) {} -+static inline void cgroup_sk_clone(struct sock_cgroup_data *skcd) {} - static inline void cgroup_sk_free(struct sock_cgroup_data *skcd) {} - - #endif /* CONFIG_CGROUP_DATA */ -diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h -index 57bcef6f988a..589c4cb03372 100644 ---- a/include/linux/dma-buf.h -+++ b/include/linux/dma-buf.h -@@ -311,6 +311,7 @@ struct dma_buf { - void *vmap_ptr; - const char *exp_name; - const char *name; -+ spinlock_t name_lock; /* spinlock to protect name access */ - struct module *owner; - struct list_head list_node; - void *priv; -diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h -index b05e855f1ddd..41a518336673 100644 ---- a/include/linux/if_vlan.h -+++ b/include/linux/if_vlan.h -@@ -25,6 +25,8 @@ - #define VLAN_ETH_DATA_LEN 1500 /* Max. octets in payload */ - #define VLAN_ETH_FRAME_LEN 1518 /* Max. octets in frame sans FCS */ - -+#define VLAN_MAX_DEPTH 8 /* Max. number of nested VLAN tags parsed */ -+ - /* - * struct vlan_hdr - vlan header - * @h_vlan_TCI: priority and VLAN ID -@@ -577,10 +579,10 @@ static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) - * Returns the EtherType of the packet, regardless of whether it is - * vlan encapsulated (normal or hardware accelerated) or not. - */ --static inline __be16 __vlan_get_protocol(struct sk_buff *skb, __be16 type, -+static inline __be16 __vlan_get_protocol(const struct sk_buff *skb, __be16 type, - int *depth) - { -- unsigned int vlan_depth = skb->mac_len; -+ unsigned int vlan_depth = skb->mac_len, parse_depth = VLAN_MAX_DEPTH; - - /* if type is 802.1Q/AD then the header should already be - * present at mac_len - VLAN_HLEN (if mac_len > 0), or at -@@ -595,13 +597,12 @@ static inline __be16 __vlan_get_protocol(struct sk_buff *skb, __be16 type, - vlan_depth = ETH_HLEN; - } - do { -- struct vlan_hdr *vh; -+ struct vlan_hdr vhdr, *vh; - -- if (unlikely(!pskb_may_pull(skb, -- vlan_depth + VLAN_HLEN))) -+ vh = skb_header_pointer(skb, vlan_depth, sizeof(vhdr), &vhdr); -+ if (unlikely(!vh || !--parse_depth)) - return 0; - -- vh = (struct vlan_hdr *)(skb->data + vlan_depth); - type = vh->h_vlan_encapsulated_proto; - vlan_depth += VLAN_HLEN; - } while (eth_type_vlan(type)); -@@ -620,11 +621,25 @@ static inline __be16 __vlan_get_protocol(struct sk_buff *skb, __be16 type, - * Returns the EtherType of the packet, regardless of whether it is - * vlan encapsulated (normal or hardware accelerated) or not. - */ --static inline __be16 vlan_get_protocol(struct sk_buff *skb) -+static inline __be16 vlan_get_protocol(const struct sk_buff *skb) - { - return __vlan_get_protocol(skb, skb->protocol, NULL); - } - -+/* A getter for the SKB protocol field which will handle VLAN tags consistently -+ * whether VLAN acceleration is enabled or not. -+ */ -+static inline __be16 skb_protocol(const struct sk_buff *skb, bool skip_vlan) -+{ -+ if (!skip_vlan) -+ /* VLAN acceleration strips the VLAN header from the skb and -+ * moves it to skb->vlan_proto -+ */ -+ return skb_vlan_tag_present(skb) ? skb->vlan_proto : skb->protocol; -+ -+ return vlan_get_protocol(skb); -+} -+ - static inline void vlan_set_encap_proto(struct sk_buff *skb, - struct vlan_hdr *vhdr) - { -diff --git a/include/linux/input/elan-i2c-ids.h b/include/linux/input/elan-i2c-ids.h -index 1ecb6b45812c..520858d12680 100644 ---- a/include/linux/input/elan-i2c-ids.h -+++ b/include/linux/input/elan-i2c-ids.h -@@ -67,8 +67,15 @@ static const struct acpi_device_id elan_acpi_id[] = { - { "ELAN062B", 0 }, - { "ELAN062C", 0 }, - { "ELAN062D", 0 }, -+ { "ELAN062E", 0 }, /* Lenovo V340 Whiskey Lake U */ -+ { "ELAN062F", 0 }, /* Lenovo V340 Comet Lake U */ - { "ELAN0631", 0 }, - { "ELAN0632", 0 }, -+ { "ELAN0633", 0 }, /* Lenovo S145 */ -+ { "ELAN0634", 0 }, /* Lenovo V340 Ice lake */ -+ { "ELAN0635", 0 }, /* Lenovo V1415-IIL */ -+ { "ELAN0636", 0 }, /* Lenovo V1415-Dali */ -+ { "ELAN0637", 0 }, /* Lenovo V1415-IGLR */ - { "ELAN1000", 0 }, - { } - }; -diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h -index 92f5eba86052..60b1160b6d06 100644 ---- a/include/linux/serial_core.h -+++ b/include/linux/serial_core.h -@@ -460,10 +460,104 @@ extern void uart_handle_cts_change(struct uart_port *uport, - extern void uart_insert_char(struct uart_port *port, unsigned int status, - unsigned int overrun, unsigned int ch, unsigned int flag); - --extern int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch); --extern int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch); --extern void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long flags); --extern int uart_handle_break(struct uart_port *port); -+#ifdef CONFIG_MAGIC_SYSRQ_SERIAL -+#define SYSRQ_TIMEOUT (HZ * 5) -+ -+bool uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch); -+ -+static inline int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) -+{ -+ if (!port->has_sysrq || !port->sysrq) -+ return 0; -+ -+ if (ch && time_before(jiffies, port->sysrq)) { -+ if (sysrq_mask()) { -+ handle_sysrq(ch); -+ port->sysrq = 0; -+ return 1; -+ } -+ if (uart_try_toggle_sysrq(port, ch)) -+ return 1; -+ } -+ port->sysrq = 0; -+ -+ return 0; -+} -+ -+static inline int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) -+{ -+ if (!port->has_sysrq || !port->sysrq) -+ return 0; -+ -+ if (ch && time_before(jiffies, port->sysrq)) { -+ if (sysrq_mask()) { -+ port->sysrq_ch = ch; -+ port->sysrq = 0; -+ return 1; -+ } -+ if (uart_try_toggle_sysrq(port, ch)) -+ return 1; -+ } -+ port->sysrq = 0; -+ -+ return 0; -+} -+ -+static inline void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) -+{ -+ int sysrq_ch; -+ -+ if (!port->has_sysrq) { -+ spin_unlock_irqrestore(&port->lock, irqflags); -+ return; -+ } -+ -+ sysrq_ch = port->sysrq_ch; -+ port->sysrq_ch = 0; -+ -+ spin_unlock_irqrestore(&port->lock, irqflags); -+ -+ if (sysrq_ch) -+ handle_sysrq(sysrq_ch); -+} -+#else /* CONFIG_MAGIC_SYSRQ_SERIAL */ -+static inline int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) -+{ -+ return 0; -+} -+static inline int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) -+{ -+ return 0; -+} -+static inline void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) -+{ -+ spin_unlock_irqrestore(&port->lock, irqflags); -+} -+#endif /* CONFIG_MAGIC_SYSRQ_SERIAL */ -+ -+/* -+ * We do the SysRQ and SAK checking like this... -+ */ -+static inline int uart_handle_break(struct uart_port *port) -+{ -+ struct uart_state *state = port->state; -+ -+ if (port->handle_break) -+ port->handle_break(port); -+ -+#ifdef CONFIG_MAGIC_SYSRQ_SERIAL -+ if (port->has_sysrq && uart_console(port)) { -+ if (!port->sysrq) { -+ port->sysrq = jiffies + SYSRQ_TIMEOUT; -+ return 1; -+ } -+ port->sysrq = 0; -+ } -+#endif -+ if (port->flags & UPF_SAK) -+ do_SAK(state->port.tty); -+ return 0; -+} - - /* - * UART_ENABLE_MS - determine if port should enable modem status irqs -diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h -index 08674cd14d5a..1e9ed840b9fc 100644 ---- a/include/linux/skmsg.h -+++ b/include/linux/skmsg.h -@@ -430,6 +430,19 @@ static inline void psock_set_prog(struct bpf_prog **pprog, - bpf_prog_put(prog); - } - -+static inline int psock_replace_prog(struct bpf_prog **pprog, -+ struct bpf_prog *prog, -+ struct bpf_prog *old) -+{ -+ if (cmpxchg(pprog, old, prog) != old) -+ return -ENOENT; -+ -+ if (old) -+ bpf_prog_put(old); -+ -+ return 0; -+} -+ - static inline void psock_progs_drop(struct sk_psock_progs *progs) - { - psock_set_prog(&progs->msg_parser, NULL); -diff --git a/include/net/dst.h b/include/net/dst.h -index 07adfacd8088..852d8fb36ab7 100644 ---- a/include/net/dst.h -+++ b/include/net/dst.h -@@ -400,7 +400,15 @@ static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, co - static inline struct neighbour *dst_neigh_lookup_skb(const struct dst_entry *dst, - struct sk_buff *skb) - { -- struct neighbour *n = dst->ops->neigh_lookup(dst, skb, NULL); -+ struct neighbour *n = NULL; -+ -+ /* The packets from tunnel devices (eg bareudp) may have only -+ * metadata in the dst pointer of skb. Hence a pointer check of -+ * neigh_lookup is needed. -+ */ -+ if (dst->ops->neigh_lookup) -+ n = dst->ops->neigh_lookup(dst, skb, NULL); -+ - return IS_ERR(n) ? NULL : n; - } - -diff --git a/include/net/genetlink.h b/include/net/genetlink.h -index 74950663bb00..6e5f1e1aa822 100644 ---- a/include/net/genetlink.h -+++ b/include/net/genetlink.h -@@ -35,13 +35,6 @@ struct genl_info; - * do additional, common, filtering and return an error - * @post_doit: called after an operation's doit callback, it may - * undo operations done by pre_doit, for example release locks -- * @mcast_bind: a socket bound to the given multicast group (which -- * is given as the offset into the groups array) -- * @mcast_unbind: a socket was unbound from the given multicast group. -- * Note that unbind() will not be called symmetrically if the -- * generic netlink family is removed while there are still open -- * sockets. -- * @attrbuf: buffer to store parsed attributes (private) - * @mcgrps: multicast groups used by this family - * @n_mcgrps: number of multicast groups - * @mcgrp_offset: starting number of multicast group IDs in this family -@@ -64,9 +57,6 @@ struct genl_family { - void (*post_doit)(const struct genl_ops *ops, - struct sk_buff *skb, - struct genl_info *info); -- int (*mcast_bind)(struct net *net, int group); -- void (*mcast_unbind)(struct net *net, int group); -- struct nlattr ** attrbuf; /* private */ - const struct genl_ops * ops; - const struct genl_multicast_group *mcgrps; - unsigned int n_ops; -diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h -index 0f0d1efe06dd..e1eaf1780288 100644 ---- a/include/net/inet_ecn.h -+++ b/include/net/inet_ecn.h -@@ -4,6 +4,7 @@ - - #include - #include -+#include - - #include - #include -@@ -172,7 +173,7 @@ static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner) - - static inline int INET_ECN_set_ce(struct sk_buff *skb) - { -- switch (skb->protocol) { -+ switch (skb_protocol(skb, true)) { - case cpu_to_be16(ETH_P_IP): - if (skb_network_header(skb) + sizeof(struct iphdr) <= - skb_tail_pointer(skb)) -@@ -191,7 +192,7 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb) - - static inline int INET_ECN_set_ect1(struct sk_buff *skb) - { -- switch (skb->protocol) { -+ switch (skb_protocol(skb, true)) { - case cpu_to_be16(ETH_P_IP): - if (skb_network_header(skb) + sizeof(struct iphdr) <= - skb_tail_pointer(skb)) -@@ -272,12 +273,16 @@ static inline int IP_ECN_decapsulate(const struct iphdr *oiph, - { - __u8 inner; - -- if (skb->protocol == htons(ETH_P_IP)) -+ switch (skb_protocol(skb, true)) { -+ case htons(ETH_P_IP): - inner = ip_hdr(skb)->tos; -- else if (skb->protocol == htons(ETH_P_IPV6)) -+ break; -+ case htons(ETH_P_IPV6): - inner = ipv6_get_dsfield(ipv6_hdr(skb)); -- else -+ break; -+ default: - return 0; -+ } - - return INET_ECN_decapsulate(skb, oiph->tos, inner); - } -@@ -287,12 +292,16 @@ static inline int IP6_ECN_decapsulate(const struct ipv6hdr *oipv6h, - { - __u8 inner; - -- if (skb->protocol == htons(ETH_P_IP)) -+ switch (skb_protocol(skb, true)) { -+ case htons(ETH_P_IP): - inner = ip_hdr(skb)->tos; -- else if (skb->protocol == htons(ETH_P_IPV6)) -+ break; -+ case htons(ETH_P_IPV6): - inner = ipv6_get_dsfield(ipv6_hdr(skb)); -- else -+ break; -+ default: - return 0; -+ } - - return INET_ECN_decapsulate(skb, ipv6_get_dsfield(oipv6h), inner); - } -diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h -index 9092e697059e..ac8c890a2657 100644 ---- a/include/net/pkt_sched.h -+++ b/include/net/pkt_sched.h -@@ -136,17 +136,6 @@ static inline void qdisc_run(struct Qdisc *q) - } - } - --static inline __be16 tc_skb_protocol(const struct sk_buff *skb) --{ -- /* We need to take extra care in case the skb came via -- * vlan accelerated path. In that case, use skb->vlan_proto -- * as the original vlan header was already stripped. -- */ -- if (skb_vlan_tag_present(skb)) -- return skb->vlan_proto; -- return skb->protocol; --} -- - /* Calculate maximal size of packet seen by hard_start_xmit - routine of this device. - */ -diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h -index ba9efdc848f9..059b6e45a028 100644 ---- a/include/trace/events/rxrpc.h -+++ b/include/trace/events/rxrpc.h -@@ -400,7 +400,7 @@ enum rxrpc_tx_point { - EM(rxrpc_cong_begin_retransmission, " Retrans") \ - EM(rxrpc_cong_cleared_nacks, " Cleared") \ - EM(rxrpc_cong_new_low_nack, " NewLowN") \ -- EM(rxrpc_cong_no_change, "") \ -+ EM(rxrpc_cong_no_change, " -") \ - EM(rxrpc_cong_progress, " Progres") \ - EM(rxrpc_cong_retransmit_again, " ReTxAgn") \ - EM(rxrpc_cong_rtt_window_end, " RttWinE") \ -diff --git a/include/uapi/linux/vboxguest.h b/include/uapi/linux/vboxguest.h -index 9cec58a6a5ea..f79d7abe27db 100644 ---- a/include/uapi/linux/vboxguest.h -+++ b/include/uapi/linux/vboxguest.h -@@ -103,7 +103,7 @@ VMMDEV_ASSERT_SIZE(vbg_ioctl_driver_version_info, 24 + 20); - - - /* IOCTL to perform a VMM Device request larger then 1KB. */ --#define VBG_IOCTL_VMMDEV_REQUEST_BIG _IOC(_IOC_READ | _IOC_WRITE, 'V', 3, 0) -+#define VBG_IOCTL_VMMDEV_REQUEST_BIG _IO('V', 3) - - - /** VBG_IOCTL_HGCM_CONNECT data structure. */ -@@ -198,7 +198,7 @@ struct vbg_ioctl_log { - } u; - }; - --#define VBG_IOCTL_LOG(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 9, s) -+#define VBG_IOCTL_LOG(s) _IO('V', 9) - - - /** VBG_IOCTL_WAIT_FOR_EVENTS data structure. */ -diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c -index 0e4d99cfac93..f9e95ea2883b 100644 ---- a/kernel/bpf/syscall.c -+++ b/kernel/bpf/syscall.c -@@ -2695,7 +2695,7 @@ static int bpf_prog_detach(const union bpf_attr *attr) - switch (ptype) { - case BPF_PROG_TYPE_SK_MSG: - case BPF_PROG_TYPE_SK_SKB: -- return sock_map_get_from_fd(attr, NULL); -+ return sock_map_prog_detach(attr, ptype); - case BPF_PROG_TYPE_LIRC_MODE2: - return lirc_prog_detach(attr); - case BPF_PROG_TYPE_FLOW_DISSECTOR: -diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c -index 06b5ea9d899d..9b46a7604e7b 100644 ---- a/kernel/cgroup/cgroup.c -+++ b/kernel/cgroup/cgroup.c -@@ -6447,18 +6447,8 @@ void cgroup_sk_alloc_disable(void) - - void cgroup_sk_alloc(struct sock_cgroup_data *skcd) - { -- if (cgroup_sk_alloc_disabled) -- return; -- -- /* Socket clone path */ -- if (skcd->val) { -- /* -- * We might be cloning a socket which is left in an empty -- * cgroup and the cgroup might have already been rmdir'd. -- * Don't use cgroup_get_live(). -- */ -- cgroup_get(sock_cgroup_ptr(skcd)); -- cgroup_bpf_get(sock_cgroup_ptr(skcd)); -+ if (cgroup_sk_alloc_disabled) { -+ skcd->no_refcnt = 1; - return; - } - -@@ -6483,10 +6473,27 @@ void cgroup_sk_alloc(struct sock_cgroup_data *skcd) - rcu_read_unlock(); - } - -+void cgroup_sk_clone(struct sock_cgroup_data *skcd) -+{ -+ if (skcd->val) { -+ if (skcd->no_refcnt) -+ return; -+ /* -+ * We might be cloning a socket which is left in an empty -+ * cgroup and the cgroup might have already been rmdir'd. -+ * Don't use cgroup_get_live(). -+ */ -+ cgroup_get(sock_cgroup_ptr(skcd)); -+ cgroup_bpf_get(sock_cgroup_ptr(skcd)); -+ } -+} -+ - void cgroup_sk_free(struct sock_cgroup_data *skcd) - { - struct cgroup *cgrp = sock_cgroup_ptr(skcd); - -+ if (skcd->no_refcnt) -+ return; - cgroup_bpf_put(cgrp); - cgroup_put(cgrp); - } -diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c -index 453a8a0f4804..dc58fd245e79 100644 ---- a/kernel/irq/manage.c -+++ b/kernel/irq/manage.c -@@ -195,9 +195,9 @@ void irq_set_thread_affinity(struct irq_desc *desc) - set_bit(IRQTF_AFFINITY, &action->thread_flags); - } - -+#ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK - static void irq_validate_effective_affinity(struct irq_data *data) - { --#ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK - const struct cpumask *m = irq_data_get_effective_affinity_mask(data); - struct irq_chip *chip = irq_data_get_irq_chip(data); - -@@ -205,9 +205,19 @@ static void irq_validate_effective_affinity(struct irq_data *data) - return; - pr_warn_once("irq_chip %s did not update eff. affinity mask of irq %u\n", - chip->name, data->irq); --#endif - } - -+static inline void irq_init_effective_affinity(struct irq_data *data, -+ const struct cpumask *mask) -+{ -+ cpumask_copy(irq_data_get_effective_affinity_mask(data), mask); -+} -+#else -+static inline void irq_validate_effective_affinity(struct irq_data *data) { } -+static inline void irq_init_effective_affinity(struct irq_data *data, -+ const struct cpumask *mask) { } -+#endif -+ - int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, - bool force) - { -@@ -304,6 +314,26 @@ static int irq_try_set_affinity(struct irq_data *data, - return ret; - } - -+static bool irq_set_affinity_deactivated(struct irq_data *data, -+ const struct cpumask *mask, bool force) -+{ -+ struct irq_desc *desc = irq_data_to_desc(data); -+ -+ /* -+ * If the interrupt is not yet activated, just store the affinity -+ * mask and do not call the chip driver at all. On activation the -+ * driver has to make sure anyway that the interrupt is in a -+ * useable state so startup works. -+ */ -+ if (!IS_ENABLED(CONFIG_IRQ_DOMAIN_HIERARCHY) || irqd_is_activated(data)) -+ return false; -+ -+ cpumask_copy(desc->irq_common_data.affinity, mask); -+ irq_init_effective_affinity(data, mask); -+ irqd_set(data, IRQD_AFFINITY_SET); -+ return true; -+} -+ - int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask, - bool force) - { -@@ -314,6 +344,9 @@ int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask, - if (!chip || !chip->irq_set_affinity) - return -EINVAL; - -+ if (irq_set_affinity_deactivated(data, mask, force)) -+ return 0; -+ - if (irq_can_move_pcntxt(data) && !irqd_is_setaffinity_pending(data)) { - ret = irq_try_set_affinity(data, mask, force); - } else { -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 8034434b1040..a7ef76a62699 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -2876,6 +2876,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) - * Silence PROVE_RCU. - */ - raw_spin_lock_irqsave(&p->pi_lock, flags); -+ rseq_migrate(p); - /* - * We're setting the CPU for the first time, we don't migrate, - * so use __set_task_cpu(). -@@ -2940,6 +2941,7 @@ void wake_up_new_task(struct task_struct *p) - * as we're not fully set-up yet. - */ - p->recent_used_cpu = task_cpu(p); -+ rseq_migrate(p); - __set_task_cpu(p, select_task_rq(p, task_cpu(p), SD_BALANCE_FORK, 0)); - #endif - rq = __task_rq_lock(p, &rf); -diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index 5725199b32dc..5c31875a7d9d 100644 ---- a/kernel/sched/fair.c -+++ b/kernel/sched/fair.c -@@ -4033,7 +4033,11 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq) - return; - } - -- rq->misfit_task_load = task_h_load(p); -+ /* -+ * Make sure that misfit_task_load will not be null even if -+ * task_h_load() returns 0. -+ */ -+ rq->misfit_task_load = max_t(unsigned long, task_h_load(p), 1); - } - - #else /* CONFIG_SMP */ -@@ -7633,7 +7637,14 @@ static int detach_tasks(struct lb_env *env) - - switch (env->migration_type) { - case migrate_load: -- load = task_h_load(p); -+ /* -+ * Depending of the number of CPUs and tasks and the -+ * cgroup hierarchy, task_h_load() can return a null -+ * value. Make sure that env->imbalance decreases -+ * otherwise detach_tasks() will stop only after -+ * detaching up to loop_max tasks. -+ */ -+ load = max_t(unsigned long, task_h_load(p), 1); - - if (sched_feat(LB_MIN) && - load < 16 && !env->sd->nr_balance_failed) -diff --git a/kernel/time/timer.c b/kernel/time/timer.c -index a5221abb4594..03c9fc395ab1 100644 ---- a/kernel/time/timer.c -+++ b/kernel/time/timer.c -@@ -522,8 +522,8 @@ static int calc_wheel_index(unsigned long expires, unsigned long clk) - * Force expire obscene large timeouts to expire at the - * capacity limit of the wheel. - */ -- if (expires >= WHEEL_TIMEOUT_CUTOFF) -- expires = WHEEL_TIMEOUT_MAX; -+ if (delta >= WHEEL_TIMEOUT_CUTOFF) -+ expires = clk + WHEEL_TIMEOUT_MAX; - - idx = calc_index(expires, LVL_DEPTH - 1); - } -@@ -585,7 +585,15 @@ trigger_dyntick_cpu(struct timer_base *base, struct timer_list *timer) - * Set the next expiry time and kick the CPU so it can reevaluate the - * wheel: - */ -- base->next_expiry = timer->expires; -+ if (time_before(timer->expires, base->clk)) { -+ /* -+ * Prevent from forward_timer_base() moving the base->clk -+ * backward -+ */ -+ base->next_expiry = base->clk; -+ } else { -+ base->next_expiry = timer->expires; -+ } - wake_up_nohz_cpu(base->cpu); - } - -@@ -897,10 +905,13 @@ static inline void forward_timer_base(struct timer_base *base) - * If the next expiry value is > jiffies, then we fast forward to - * jiffies otherwise we forward to the next expiry value. - */ -- if (time_after(base->next_expiry, jnow)) -+ if (time_after(base->next_expiry, jnow)) { - base->clk = jnow; -- else -+ } else { -+ if (WARN_ON_ONCE(time_before(base->next_expiry, base->clk))) -+ return; - base->clk = base->next_expiry; -+ } - #endif - } - -diff --git a/mm/memory.c b/mm/memory.c -index f703fe8c8346..22d218bc56c8 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -1501,7 +1501,7 @@ out: - } - - #ifdef pte_index --static int insert_page_in_batch_locked(struct mm_struct *mm, pmd_t *pmd, -+static int insert_page_in_batch_locked(struct mm_struct *mm, pte_t *pte, - unsigned long addr, struct page *page, pgprot_t prot) - { - int err; -@@ -1509,8 +1509,9 @@ static int insert_page_in_batch_locked(struct mm_struct *mm, pmd_t *pmd, - if (!page_count(page)) - return -EINVAL; - err = validate_page_before_insert(page); -- return err ? err : insert_page_into_pte_locked( -- mm, pte_offset_map(pmd, addr), addr, page, prot); -+ if (err) -+ return err; -+ return insert_page_into_pte_locked(mm, pte, addr, page, prot); - } - - /* insert_pages() amortizes the cost of spinlock operations -@@ -1520,7 +1521,8 @@ static int insert_pages(struct vm_area_struct *vma, unsigned long addr, - struct page **pages, unsigned long *num, pgprot_t prot) - { - pmd_t *pmd = NULL; -- spinlock_t *pte_lock = NULL; -+ pte_t *start_pte, *pte; -+ spinlock_t *pte_lock; - struct mm_struct *const mm = vma->vm_mm; - unsigned long curr_page_idx = 0; - unsigned long remaining_pages_total = *num; -@@ -1539,18 +1541,17 @@ more: - ret = -ENOMEM; - if (pte_alloc(mm, pmd)) - goto out; -- pte_lock = pte_lockptr(mm, pmd); - - while (pages_to_write_in_pmd) { - int pte_idx = 0; - const int batch_size = min_t(int, pages_to_write_in_pmd, 8); - -- spin_lock(pte_lock); -- for (; pte_idx < batch_size; ++pte_idx) { -- int err = insert_page_in_batch_locked(mm, pmd, -+ start_pte = pte_offset_map_lock(mm, pmd, addr, &pte_lock); -+ for (pte = start_pte; pte_idx < batch_size; ++pte, ++pte_idx) { -+ int err = insert_page_in_batch_locked(mm, pte, - addr, pages[curr_page_idx], prot); - if (unlikely(err)) { -- spin_unlock(pte_lock); -+ pte_unmap_unlock(start_pte, pte_lock); - ret = err; - remaining_pages_total -= pte_idx; - goto out; -@@ -1558,7 +1559,7 @@ more: - addr += PAGE_SIZE; - ++curr_page_idx; - } -- spin_unlock(pte_lock); -+ pte_unmap_unlock(start_pte, pte_lock); - pages_to_write_in_pmd -= batch_size; - remaining_pages_total -= batch_size; - } -diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c -index 83490bf73a13..4c4a93abde68 100644 ---- a/net/bridge/br_multicast.c -+++ b/net/bridge/br_multicast.c -@@ -1007,7 +1007,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, - nsrcs_offset = len + offsetof(struct mld2_grec, grec_nsrcs); - - if (skb_transport_offset(skb) + ipv6_transport_len(skb) < -- nsrcs_offset + sizeof(_nsrcs)) -+ nsrcs_offset + sizeof(__nsrcs)) - return -EINVAL; - - _nsrcs = skb_header_pointer(skb, nsrcs_offset, -diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c -index 1d4973f8cd7a..99f35b7f765d 100644 ---- a/net/ceph/osd_client.c -+++ b/net/ceph/osd_client.c -@@ -445,6 +445,7 @@ static void target_copy(struct ceph_osd_request_target *dest, - dest->size = src->size; - dest->min_size = src->min_size; - dest->sort_bitwise = src->sort_bitwise; -+ dest->recovery_deletes = src->recovery_deletes; - - dest->flags = src->flags; - dest->paused = src->paused; -diff --git a/net/core/filter.c b/net/core/filter.c -index 45fa65a28983..cebbb6ba9ed9 100644 ---- a/net/core/filter.c -+++ b/net/core/filter.c -@@ -5724,12 +5724,16 @@ BPF_CALL_1(bpf_skb_ecn_set_ce, struct sk_buff *, skb) - { - unsigned int iphdr_len; - -- if (skb->protocol == cpu_to_be16(ETH_P_IP)) -+ switch (skb_protocol(skb, true)) { -+ case cpu_to_be16(ETH_P_IP): - iphdr_len = sizeof(struct iphdr); -- else if (skb->protocol == cpu_to_be16(ETH_P_IPV6)) -+ break; -+ case cpu_to_be16(ETH_P_IPV6): - iphdr_len = sizeof(struct ipv6hdr); -- else -+ break; -+ default: - return 0; -+ } - - if (skb_headlen(skb) < iphdr_len) - return 0; -diff --git a/net/core/sock.c b/net/core/sock.c -index afe4a62adf8f..bc6fe4114374 100644 ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -1837,7 +1837,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) - /* sk->sk_memcg will be populated at accept() time */ - newsk->sk_memcg = NULL; - -- cgroup_sk_alloc(&newsk->sk_cgrp_data); -+ cgroup_sk_clone(&newsk->sk_cgrp_data); - - rcu_read_lock(); - filter = rcu_dereference(sk->sk_filter); -diff --git a/net/core/sock_map.c b/net/core/sock_map.c -index 591457fcbd02..4d0aba233bb4 100644 ---- a/net/core/sock_map.c -+++ b/net/core/sock_map.c -@@ -70,11 +70,49 @@ int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog) - struct fd f; - int ret; - -+ if (attr->attach_flags || attr->replace_bpf_fd) -+ return -EINVAL; -+ - f = fdget(ufd); - map = __bpf_map_get(f); - if (IS_ERR(map)) - return PTR_ERR(map); -- ret = sock_map_prog_update(map, prog, attr->attach_type); -+ ret = sock_map_prog_update(map, prog, NULL, attr->attach_type); -+ fdput(f); -+ return ret; -+} -+ -+int sock_map_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype) -+{ -+ u32 ufd = attr->target_fd; -+ struct bpf_prog *prog; -+ struct bpf_map *map; -+ struct fd f; -+ int ret; -+ -+ if (attr->attach_flags || attr->replace_bpf_fd) -+ return -EINVAL; -+ -+ f = fdget(ufd); -+ map = __bpf_map_get(f); -+ if (IS_ERR(map)) -+ return PTR_ERR(map); -+ -+ prog = bpf_prog_get(attr->attach_bpf_fd); -+ if (IS_ERR(prog)) { -+ ret = PTR_ERR(prog); -+ goto put_map; -+ } -+ -+ if (prog->type != ptype) { -+ ret = -EINVAL; -+ goto put_prog; -+ } -+ -+ ret = sock_map_prog_update(map, NULL, prog, attr->attach_type); -+put_prog: -+ bpf_prog_put(prog); -+put_map: - fdput(f); - return ret; - } -@@ -1189,27 +1227,32 @@ static struct sk_psock_progs *sock_map_progs(struct bpf_map *map) - } - - int sock_map_prog_update(struct bpf_map *map, struct bpf_prog *prog, -- u32 which) -+ struct bpf_prog *old, u32 which) - { - struct sk_psock_progs *progs = sock_map_progs(map); -+ struct bpf_prog **pprog; - - if (!progs) - return -EOPNOTSUPP; - - switch (which) { - case BPF_SK_MSG_VERDICT: -- psock_set_prog(&progs->msg_parser, prog); -+ pprog = &progs->msg_parser; - break; - case BPF_SK_SKB_STREAM_PARSER: -- psock_set_prog(&progs->skb_parser, prog); -+ pprog = &progs->skb_parser; - break; - case BPF_SK_SKB_STREAM_VERDICT: -- psock_set_prog(&progs->skb_verdict, prog); -+ pprog = &progs->skb_verdict; - break; - default: - return -EOPNOTSUPP; - } - -+ if (old) -+ return psock_replace_prog(pprog, prog, old); -+ -+ psock_set_prog(pprog, prog); - return 0; - } - -diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c -index ed5357210193..0f4e2e106799 100644 ---- a/net/ethtool/netlink.c -+++ b/net/ethtool/netlink.c -@@ -376,10 +376,17 @@ err_dev: - } - - static int ethnl_default_dump_one(struct sk_buff *skb, struct net_device *dev, -- const struct ethnl_dump_ctx *ctx) -+ const struct ethnl_dump_ctx *ctx, -+ struct netlink_callback *cb) - { -+ void *ehdr; - int ret; - -+ ehdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, -+ ðtool_genl_family, 0, ctx->ops->reply_cmd); -+ if (!ehdr) -+ return -EMSGSIZE; -+ - ethnl_init_reply_data(ctx->reply_data, ctx->ops, dev); - rtnl_lock(); - ret = ctx->ops->prepare_data(ctx->req_info, ctx->reply_data, NULL); -@@ -395,6 +402,10 @@ out: - if (ctx->ops->cleanup_data) - ctx->ops->cleanup_data(ctx->reply_data); - ctx->reply_data->dev = NULL; -+ if (ret < 0) -+ genlmsg_cancel(skb, ehdr); -+ else -+ genlmsg_end(skb, ehdr); - return ret; - } - -@@ -411,7 +422,6 @@ static int ethnl_default_dumpit(struct sk_buff *skb, - int s_idx = ctx->pos_idx; - int h, idx = 0; - int ret = 0; -- void *ehdr; - - rtnl_lock(); - for (h = ctx->pos_hash; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { -@@ -431,26 +441,15 @@ restart_chain: - dev_hold(dev); - rtnl_unlock(); - -- ehdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, -- cb->nlh->nlmsg_seq, -- ðtool_genl_family, 0, -- ctx->ops->reply_cmd); -- if (!ehdr) { -- dev_put(dev); -- ret = -EMSGSIZE; -- goto out; -- } -- ret = ethnl_default_dump_one(skb, dev, ctx); -+ ret = ethnl_default_dump_one(skb, dev, ctx, cb); - dev_put(dev); - if (ret < 0) { -- genlmsg_cancel(skb, ehdr); - if (ret == -EOPNOTSUPP) - goto lock_and_cont; - if (likely(skb->len)) - ret = skb->len; - goto out; - } -- genlmsg_end(skb, ehdr); - lock_and_cont: - rtnl_lock(); - if (net->dev_base_seq != seq) { -diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c -index ef100cfd2ac1..56a11341f99c 100644 ---- a/net/hsr/hsr_device.c -+++ b/net/hsr/hsr_device.c -@@ -417,6 +417,7 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2], - unsigned char multicast_spec, u8 protocol_version, - struct netlink_ext_ack *extack) - { -+ bool unregister = false; - struct hsr_priv *hsr; - int res; - -@@ -468,25 +469,27 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2], - if (res) - goto err_unregister; - -+ unregister = true; -+ - res = hsr_add_port(hsr, slave[0], HSR_PT_SLAVE_A, extack); - if (res) -- goto err_add_slaves; -+ goto err_unregister; - - res = hsr_add_port(hsr, slave[1], HSR_PT_SLAVE_B, extack); - if (res) -- goto err_add_slaves; -+ goto err_unregister; - - hsr_debugfs_init(hsr, hsr_dev); - mod_timer(&hsr->prune_timer, jiffies + msecs_to_jiffies(PRUNE_PERIOD)); - - return 0; - --err_add_slaves: -- unregister_netdevice(hsr_dev); - err_unregister: - hsr_del_ports(hsr); - err_add_master: - hsr_del_self_node(hsr); - -+ if (unregister) -+ unregister_netdevice(hsr_dev); - return res; - } -diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c -index fc61f51d87a3..ca591051c656 100644 ---- a/net/ipv4/icmp.c -+++ b/net/ipv4/icmp.c -@@ -427,7 +427,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) - - ipcm_init(&ipc); - inet->tos = ip_hdr(skb)->tos; -- sk->sk_mark = mark; -+ ipc.sockc.mark = mark; - daddr = ipc.addr = ip_hdr(skb)->saddr; - saddr = fib_compute_spec_dst(skb); - -@@ -710,10 +710,10 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info, - icmp_param.skb = skb_in; - icmp_param.offset = skb_network_offset(skb_in); - inet_sk(sk)->tos = tos; -- sk->sk_mark = mark; - ipcm_init(&ipc); - ipc.addr = iph->saddr; - ipc.opt = &icmp_param.replyopts.opt; -+ ipc.sockc.mark = mark; - - rt = icmp_route_lookup(net, &fl4, skb_in, iph, saddr, tos, mark, - type, code, &icmp_param); -diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c -index 090d3097ee15..17206677d503 100644 ---- a/net/ipv4/ip_output.c -+++ b/net/ipv4/ip_output.c -@@ -1702,7 +1702,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, - sk->sk_protocol = ip_hdr(skb)->protocol; - sk->sk_bound_dev_if = arg->bound_dev_if; - sk->sk_sndbuf = sysctl_wmem_default; -- sk->sk_mark = fl4.flowi4_mark; -+ ipc.sockc.mark = fl4.flowi4_mark; - err = ip_append_data(sk, &fl4, ip_reply_glue_bits, arg->iov->iov_base, - len, 0, &ipc, &rt, MSG_DONTWAIT); - if (unlikely(err)) { -diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c -index 535427292194..df6fbefe44d4 100644 ---- a/net/ipv4/ping.c -+++ b/net/ipv4/ping.c -@@ -786,6 +786,9 @@ static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) - inet_sk_flowi_flags(sk), faddr, saddr, 0, 0, - sk->sk_uid); - -+ fl4.fl4_icmp_type = user_icmph.type; -+ fl4.fl4_icmp_code = user_icmph.code; -+ - security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); - rt = ip_route_output_flow(net, &fl4, sk); - if (IS_ERR(rt)) { -diff --git a/net/ipv4/route.c b/net/ipv4/route.c -index b73f540fa19b..abe12caf2451 100644 ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -2027,7 +2027,7 @@ int ip_route_use_hint(struct sk_buff *skb, __be32 daddr, __be32 saddr, - const struct sk_buff *hint) - { - struct in_device *in_dev = __in_dev_get_rcu(dev); -- struct rtable *rt = (struct rtable *)hint; -+ struct rtable *rt = skb_rtable(hint); - struct net *net = dev_net(dev); - int err = -EINVAL; - u32 tag = 0; -diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c -index dd401757eea1..eee18259a24e 100644 ---- a/net/ipv4/tcp.c -+++ b/net/ipv4/tcp.c -@@ -2635,6 +2635,9 @@ int tcp_disconnect(struct sock *sk, int flags) - tp->window_clamp = 0; - tp->delivered = 0; - tp->delivered_ce = 0; -+ if (icsk->icsk_ca_ops->release) -+ icsk->icsk_ca_ops->release(sk); -+ memset(icsk->icsk_ca_priv, 0, sizeof(icsk->icsk_ca_priv)); - tcp_set_ca_state(sk, TCP_CA_Open); - tp->is_sack_reneg = 0; - tcp_clear_retrans(tp); -@@ -3090,10 +3093,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level, - #ifdef CONFIG_TCP_MD5SIG - case TCP_MD5SIG: - case TCP_MD5SIG_EXT: -- if ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)) -- err = tp->af_specific->md5_parse(sk, optname, optval, optlen); -- else -- err = -EINVAL; -+ err = tp->af_specific->md5_parse(sk, optname, optval, optlen); - break; - #endif - case TCP_USER_TIMEOUT: -@@ -3877,10 +3877,13 @@ EXPORT_SYMBOL(tcp_md5_hash_skb_data); - - int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, const struct tcp_md5sig_key *key) - { -+ u8 keylen = READ_ONCE(key->keylen); /* paired with WRITE_ONCE() in tcp_md5_do_add */ - struct scatterlist sg; - -- sg_init_one(&sg, key->key, key->keylen); -- ahash_request_set_crypt(hp->md5_req, &sg, NULL, key->keylen); -+ sg_init_one(&sg, key->key, keylen); -+ ahash_request_set_crypt(hp->md5_req, &sg, NULL, keylen); -+ -+ /* tcp_md5_do_add() might change key->key under us */ - return crypto_ahash_update(hp->md5_req); - } - EXPORT_SYMBOL(tcp_md5_hash_key); -diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c -index 3172e31987be..62878cf26d9c 100644 ---- a/net/ipv4/tcp_cong.c -+++ b/net/ipv4/tcp_cong.c -@@ -197,7 +197,7 @@ static void tcp_reinit_congestion_control(struct sock *sk, - icsk->icsk_ca_setsockopt = 1; - memset(icsk->icsk_ca_priv, 0, sizeof(icsk->icsk_ca_priv)); - -- if (sk->sk_state != TCP_CLOSE) -+ if (!((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) - tcp_init_congestion_control(sk); - } - -diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c -index 1fa009999f57..31c58e00d25b 100644 ---- a/net/ipv4/tcp_input.c -+++ b/net/ipv4/tcp_input.c -@@ -4570,6 +4570,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb) - - if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) { - NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP); -+ sk->sk_data_ready(sk); - tcp_drop(sk, skb); - return; - } -@@ -4816,6 +4817,7 @@ queue_and_out: - sk_forced_mem_schedule(sk, skb->truesize); - else if (tcp_try_rmem_schedule(sk, skb, skb->truesize)) { - NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRCVQDROP); -+ sk->sk_data_ready(sk); - goto drop; - } - -diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c -index 83a5d24e13b8..4c2f2f2107a9 100644 ---- a/net/ipv4/tcp_ipv4.c -+++ b/net/ipv4/tcp_ipv4.c -@@ -1103,9 +1103,18 @@ int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, - - key = tcp_md5_do_lookup_exact(sk, addr, family, prefixlen, l3index); - if (key) { -- /* Pre-existing entry - just update that one. */ -+ /* Pre-existing entry - just update that one. -+ * Note that the key might be used concurrently. -+ */ - memcpy(key->key, newkey, newkeylen); -- key->keylen = newkeylen; -+ -+ /* Pairs with READ_ONCE() in tcp_md5_hash_key(). -+ * Also note that a reader could catch new key->keylen value -+ * but old key->key[], this is the reason we use __GFP_ZERO -+ * at sock_kmalloc() time below these lines. -+ */ -+ WRITE_ONCE(key->keylen, newkeylen); -+ - return 0; - } - -@@ -1121,7 +1130,7 @@ int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, - rcu_assign_pointer(tp->md5sig_info, md5sig); - } - -- key = sock_kmalloc(sk, sizeof(*key), gfp); -+ key = sock_kmalloc(sk, sizeof(*key), gfp | __GFP_ZERO); - if (!key) - return -ENOMEM; - if (!tcp_alloc_md5sig_pool()) { -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c -index 2f45cde168c4..bee2f9b8b8a1 100644 ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -700,7 +700,8 @@ static unsigned int tcp_synack_options(const struct sock *sk, - unsigned int mss, struct sk_buff *skb, - struct tcp_out_options *opts, - const struct tcp_md5sig_key *md5, -- struct tcp_fastopen_cookie *foc) -+ struct tcp_fastopen_cookie *foc, -+ enum tcp_synack_type synack_type) - { - struct inet_request_sock *ireq = inet_rsk(req); - unsigned int remaining = MAX_TCP_OPTION_SPACE; -@@ -715,7 +716,8 @@ static unsigned int tcp_synack_options(const struct sock *sk, - * rather than TS in order to fit in better with old, - * buggy kernels, but that was deemed to be unnecessary. - */ -- ireq->tstamp_ok &= !ireq->sack_ok; -+ if (synack_type != TCP_SYNACK_COOKIE) -+ ireq->tstamp_ok &= !ireq->sack_ok; - } - #endif - -@@ -3388,7 +3390,7 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst, - #endif - skb_set_hash(skb, tcp_rsk(req)->txhash, PKT_HASH_TYPE_L4); - tcp_header_size = tcp_synack_options(sk, req, mss, skb, &opts, md5, -- foc) + sizeof(*th); -+ foc, synack_type) + sizeof(*th); - - skb_push(skb, tcp_header_size); - skb_reset_transport_header(skb); -diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c -index fc5000370030..9df8737ae0d3 100644 ---- a/net/ipv6/icmp.c -+++ b/net/ipv6/icmp.c -@@ -566,7 +566,6 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, - fl6.mp_hash = rt6_multipath_hash(net, &fl6, skb, NULL); - security_skb_classify_flow(skb, flowi6_to_flowi(&fl6)); - -- sk->sk_mark = mark; - np = inet6_sk(sk); - - if (!icmpv6_xrlim_allow(sk, type, &fl6)) -@@ -583,6 +582,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, - fl6.flowi6_oif = np->ucast_oif; - - ipcm6_init_sk(&ipc6, np); -+ ipc6.sockc.mark = mark; - fl6.flowlabel = ip6_make_flowinfo(ipc6.tclass, fl6.flowlabel); - - dst = icmpv6_route_lookup(net, skb, sk, &fl6); -@@ -751,7 +751,6 @@ static void icmpv6_echo_reply(struct sk_buff *skb) - sk = icmpv6_xmit_lock(net); - if (!sk) - goto out_bh_enable; -- sk->sk_mark = mark; - np = inet6_sk(sk); - - if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) -@@ -779,6 +778,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb) - ipcm6_init_sk(&ipc6, np); - ipc6.hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst); - ipc6.tclass = ipv6_get_dsfield(ipv6_hdr(skb)); -+ ipc6.sockc.mark = mark; - - if (ip6_append_data(sk, icmpv6_getfrag, &msg, - skb->len + sizeof(struct icmp6hdr), -diff --git a/net/ipv6/route.c b/net/ipv6/route.c -index ff847a324220..e8a184acf668 100644 ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -431,9 +431,12 @@ void fib6_select_path(const struct net *net, struct fib6_result *res, - struct fib6_info *sibling, *next_sibling; - struct fib6_info *match = res->f6i; - -- if ((!match->fib6_nsiblings && !match->nh) || have_oif_match) -+ if (!match->nh && (!match->fib6_nsiblings || have_oif_match)) - goto out; - -+ if (match->nh && have_oif_match && res->nh) -+ return; -+ - /* We might have already computed the hash for ICMPv6 errors. In such - * case it will always be non-zero. Otherwise now is the time to do it. - */ -@@ -3399,7 +3402,7 @@ static bool fib6_is_reject(u32 flags, struct net_device *dev, int addr_type) - if ((flags & RTF_REJECT) || - (dev && (dev->flags & IFF_LOOPBACK) && - !(addr_type & IPV6_ADDR_LOOPBACK) && -- !(flags & RTF_LOCAL))) -+ !(flags & (RTF_ANYCAST | RTF_LOCAL)))) - return true; - - return false; -diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c -index 6d7ef78c88af..6434d17e6e8e 100644 ---- a/net/l2tp/l2tp_core.c -+++ b/net/l2tp/l2tp_core.c -@@ -1028,6 +1028,7 @@ static void l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, - - /* Queue the packet to IP for output */ - skb->ignore_df = 1; -+ skb_dst_drop(skb); - #if IS_ENABLED(CONFIG_IPV6) - if (l2tp_sk_is_v6(tunnel->sock)) - error = inet6_csk_xmit(tunnel->sock, skb, NULL); -@@ -1099,10 +1100,6 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len - goto out_unlock; - } - -- /* Get routing info from the tunnel socket */ -- skb_dst_drop(skb); -- skb_dst_set(skb, sk_dst_check(sk, 0)); -- - inet = inet_sk(sk); - fl = &inet->cork.fl; - switch (tunnel->encap) { -diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c -index 54fb8d452a7b..6e53e43c1907 100644 ---- a/net/llc/af_llc.c -+++ b/net/llc/af_llc.c -@@ -273,6 +273,10 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr) - - if (!sock_flag(sk, SOCK_ZAPPED)) - goto out; -+ if (!addr->sllc_arphrd) -+ addr->sllc_arphrd = ARPHRD_ETHER; -+ if (addr->sllc_arphrd != ARPHRD_ETHER) -+ goto out; - rc = -ENODEV; - if (sk->sk_bound_dev_if) { - llc->dev = dev_get_by_index(&init_net, sk->sk_bound_dev_if); -@@ -328,7 +332,9 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) - if (unlikely(!sock_flag(sk, SOCK_ZAPPED) || addrlen != sizeof(*addr))) - goto out; - rc = -EAFNOSUPPORT; -- if (unlikely(addr->sllc_family != AF_LLC)) -+ if (!addr->sllc_arphrd) -+ addr->sllc_arphrd = ARPHRD_ETHER; -+ if (unlikely(addr->sllc_family != AF_LLC || addr->sllc_arphrd != ARPHRD_ETHER)) - goto out; - dprintk("%s: binding %02X\n", __func__, addr->sllc_sap); - rc = -ENODEV; -@@ -336,8 +342,6 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) - if (sk->sk_bound_dev_if) { - llc->dev = dev_get_by_index_rcu(&init_net, sk->sk_bound_dev_if); - if (llc->dev) { -- if (!addr->sllc_arphrd) -- addr->sllc_arphrd = llc->dev->type; - if (is_zero_ether_addr(addr->sllc_mac)) - memcpy(addr->sllc_mac, llc->dev->dev_addr, - IFHWADDRLEN); -diff --git a/net/mptcp/options.c b/net/mptcp/options.c -index 2430bbfa3405..2b3ed0c5199d 100644 ---- a/net/mptcp/options.c -+++ b/net/mptcp/options.c -@@ -449,9 +449,9 @@ static bool mptcp_established_options_mp(struct sock *sk, struct sk_buff *skb, - } - - static void mptcp_write_data_fin(struct mptcp_subflow_context *subflow, -- struct mptcp_ext *ext) -+ struct sk_buff *skb, struct mptcp_ext *ext) - { -- if (!ext->use_map) { -+ if (!ext->use_map || !skb->len) { - /* RFC6824 requires a DSS mapping with specific values - * if DATA_FIN is set but no data payload is mapped - */ -@@ -503,7 +503,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, - opts->ext_copy = *mpext; - - if (skb && tcp_fin && subflow->data_fin_tx_enable) -- mptcp_write_data_fin(subflow, &opts->ext_copy); -+ mptcp_write_data_fin(subflow, skb, &opts->ext_copy); - ret = true; - } - -diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c -index 9c1c27f3a089..cfcc518d77c0 100644 ---- a/net/netlink/genetlink.c -+++ b/net/netlink/genetlink.c -@@ -351,22 +351,11 @@ int genl_register_family(struct genl_family *family) - start = end = GENL_ID_VFS_DQUOT; - } - -- if (family->maxattr && !family->parallel_ops) { -- family->attrbuf = kmalloc_array(family->maxattr + 1, -- sizeof(struct nlattr *), -- GFP_KERNEL); -- if (family->attrbuf == NULL) { -- err = -ENOMEM; -- goto errout_locked; -- } -- } else -- family->attrbuf = NULL; -- - family->id = idr_alloc_cyclic(&genl_fam_idr, family, - start, end + 1, GFP_KERNEL); - if (family->id < 0) { - err = family->id; -- goto errout_free; -+ goto errout_locked; - } - - err = genl_validate_assign_mc_groups(family); -@@ -385,8 +374,6 @@ int genl_register_family(struct genl_family *family) - - errout_remove: - idr_remove(&genl_fam_idr, family->id); --errout_free: -- kfree(family->attrbuf); - errout_locked: - genl_unlock_all(); - return err; -@@ -419,8 +406,6 @@ int genl_unregister_family(const struct genl_family *family) - atomic_read(&genl_sk_destructing_cnt) == 0); - genl_unlock(); - -- kfree(family->attrbuf); -- - genl_ctrl_event(CTRL_CMD_DELFAMILY, family, NULL, 0); - - return 0; -@@ -485,30 +470,23 @@ genl_family_rcv_msg_attrs_parse(const struct genl_family *family, - if (!family->maxattr) - return NULL; - -- if (family->parallel_ops) { -- attrbuf = kmalloc_array(family->maxattr + 1, -- sizeof(struct nlattr *), GFP_KERNEL); -- if (!attrbuf) -- return ERR_PTR(-ENOMEM); -- } else { -- attrbuf = family->attrbuf; -- } -+ attrbuf = kmalloc_array(family->maxattr + 1, -+ sizeof(struct nlattr *), GFP_KERNEL); -+ if (!attrbuf) -+ return ERR_PTR(-ENOMEM); - - err = __nlmsg_parse(nlh, hdrlen, attrbuf, family->maxattr, - family->policy, validate, extack); - if (err) { -- if (family->parallel_ops) -- kfree(attrbuf); -+ kfree(attrbuf); - return ERR_PTR(err); - } - return attrbuf; - } - --static void genl_family_rcv_msg_attrs_free(const struct genl_family *family, -- struct nlattr **attrbuf) -+static void genl_family_rcv_msg_attrs_free(struct nlattr **attrbuf) - { -- if (family->parallel_ops) -- kfree(attrbuf); -+ kfree(attrbuf); - } - - struct genl_start_context { -@@ -542,7 +520,7 @@ static int genl_start(struct netlink_callback *cb) - no_attrs: - info = genl_dumpit_info_alloc(); - if (!info) { -- genl_family_rcv_msg_attrs_free(ctx->family, attrs); -+ genl_family_rcv_msg_attrs_free(attrs); - return -ENOMEM; - } - info->family = ctx->family; -@@ -559,7 +537,7 @@ no_attrs: - } - - if (rc) { -- genl_family_rcv_msg_attrs_free(info->family, info->attrs); -+ genl_family_rcv_msg_attrs_free(info->attrs); - genl_dumpit_info_free(info); - cb->data = NULL; - } -@@ -588,7 +566,7 @@ static int genl_lock_done(struct netlink_callback *cb) - rc = ops->done(cb); - genl_unlock(); - } -- genl_family_rcv_msg_attrs_free(info->family, info->attrs); -+ genl_family_rcv_msg_attrs_free(info->attrs); - genl_dumpit_info_free(info); - return rc; - } -@@ -601,7 +579,7 @@ static int genl_parallel_done(struct netlink_callback *cb) - - if (ops->done) - rc = ops->done(cb); -- genl_family_rcv_msg_attrs_free(info->family, info->attrs); -+ genl_family_rcv_msg_attrs_free(info->attrs); - genl_dumpit_info_free(info); - return rc; - } -@@ -694,7 +672,7 @@ static int genl_family_rcv_msg_doit(const struct genl_family *family, - family->post_doit(ops, skb, &info); - - out: -- genl_family_rcv_msg_attrs_free(family, attrbuf); -+ genl_family_rcv_msg_attrs_free(attrbuf); - - return err; - } -@@ -1088,60 +1066,11 @@ static struct genl_family genl_ctrl __ro_after_init = { - .netnsok = true, - }; - --static int genl_bind(struct net *net, int group) --{ -- struct genl_family *f; -- int err = -ENOENT; -- unsigned int id; -- -- down_read(&cb_lock); -- -- idr_for_each_entry(&genl_fam_idr, f, id) { -- if (group >= f->mcgrp_offset && -- group < f->mcgrp_offset + f->n_mcgrps) { -- int fam_grp = group - f->mcgrp_offset; -- -- if (!f->netnsok && net != &init_net) -- err = -ENOENT; -- else if (f->mcast_bind) -- err = f->mcast_bind(net, fam_grp); -- else -- err = 0; -- break; -- } -- } -- up_read(&cb_lock); -- -- return err; --} -- --static void genl_unbind(struct net *net, int group) --{ -- struct genl_family *f; -- unsigned int id; -- -- down_read(&cb_lock); -- -- idr_for_each_entry(&genl_fam_idr, f, id) { -- if (group >= f->mcgrp_offset && -- group < f->mcgrp_offset + f->n_mcgrps) { -- int fam_grp = group - f->mcgrp_offset; -- -- if (f->mcast_unbind) -- f->mcast_unbind(net, fam_grp); -- break; -- } -- } -- up_read(&cb_lock); --} -- - static int __net_init genl_pernet_init(struct net *net) - { - struct netlink_kernel_cfg cfg = { - .input = genl_rcv, - .flags = NL_CFG_F_NONROOT_RECV, -- .bind = genl_bind, -- .unbind = genl_unbind, - }; - - /* we'll bump the group number right afterwards */ -diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c -index 7eccbbf6f8ad..24a8c3c6da0d 100644 ---- a/net/qrtr/qrtr.c -+++ b/net/qrtr/qrtr.c -@@ -166,6 +166,7 @@ static void __qrtr_node_release(struct kref *kref) - { - struct qrtr_node *node = container_of(kref, struct qrtr_node, ref); - struct radix_tree_iter iter; -+ struct qrtr_tx_flow *flow; - unsigned long flags; - void __rcu **slot; - -@@ -181,8 +182,9 @@ static void __qrtr_node_release(struct kref *kref) - - /* Free tx flow counters */ - radix_tree_for_each_slot(slot, &node->qrtr_tx_flow, &iter, 0) { -+ flow = *slot; - radix_tree_iter_delete(&node->qrtr_tx_flow, &iter, slot); -- kfree(*slot); -+ kfree(flow); - } - kfree(node); - } -diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c -index 43a243081e7d..f901421b0634 100644 ---- a/net/sched/act_connmark.c -+++ b/net/sched/act_connmark.c -@@ -43,17 +43,20 @@ static int tcf_connmark_act(struct sk_buff *skb, const struct tc_action *a, - tcf_lastuse_update(&ca->tcf_tm); - bstats_update(&ca->tcf_bstats, skb); - -- if (skb->protocol == htons(ETH_P_IP)) { -+ switch (skb_protocol(skb, true)) { -+ case htons(ETH_P_IP): - if (skb->len < sizeof(struct iphdr)) - goto out; - - proto = NFPROTO_IPV4; -- } else if (skb->protocol == htons(ETH_P_IPV6)) { -+ break; -+ case htons(ETH_P_IPV6): - if (skb->len < sizeof(struct ipv6hdr)) - goto out; - - proto = NFPROTO_IPV6; -- } else { -+ break; -+ default: - goto out; - } - -diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c -index cb8608f0a77a..c60674cf25c4 100644 ---- a/net/sched/act_csum.c -+++ b/net/sched/act_csum.c -@@ -587,7 +587,7 @@ static int tcf_csum_act(struct sk_buff *skb, const struct tc_action *a, - goto drop; - - update_flags = params->update_flags; -- protocol = tc_skb_protocol(skb); -+ protocol = skb_protocol(skb, false); - again: - switch (protocol) { - case cpu_to_be16(ETH_P_IP): -diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c -index 20577355235a..6a114f80e54b 100644 ---- a/net/sched/act_ct.c -+++ b/net/sched/act_ct.c -@@ -622,7 +622,7 @@ static u8 tcf_ct_skb_nf_family(struct sk_buff *skb) - { - u8 family = NFPROTO_UNSPEC; - -- switch (skb->protocol) { -+ switch (skb_protocol(skb, true)) { - case htons(ETH_P_IP): - family = NFPROTO_IPV4; - break; -@@ -746,6 +746,7 @@ static int ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct, - const struct nf_nat_range2 *range, - enum nf_nat_manip_type maniptype) - { -+ __be16 proto = skb_protocol(skb, true); - int hooknum, err = NF_ACCEPT; - - /* See HOOK2MANIP(). */ -@@ -757,14 +758,13 @@ static int ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct, - switch (ctinfo) { - case IP_CT_RELATED: - case IP_CT_RELATED_REPLY: -- if (skb->protocol == htons(ETH_P_IP) && -+ if (proto == htons(ETH_P_IP) && - ip_hdr(skb)->protocol == IPPROTO_ICMP) { - if (!nf_nat_icmp_reply_translation(skb, ct, ctinfo, - hooknum)) - err = NF_DROP; - goto out; -- } else if (IS_ENABLED(CONFIG_IPV6) && -- skb->protocol == htons(ETH_P_IPV6)) { -+ } else if (IS_ENABLED(CONFIG_IPV6) && proto == htons(ETH_P_IPV6)) { - __be16 frag_off; - u8 nexthdr = ipv6_hdr(skb)->nexthdr; - int hdrlen = ipv6_skip_exthdr(skb, -@@ -1559,4 +1559,3 @@ MODULE_AUTHOR("Yossi Kuperman "); - MODULE_AUTHOR("Marcelo Ricardo Leitner "); - MODULE_DESCRIPTION("Connection tracking action"); - MODULE_LICENSE("GPL v2"); -- -diff --git a/net/sched/act_ctinfo.c b/net/sched/act_ctinfo.c -index 19649623493b..b5042f3ea079 100644 ---- a/net/sched/act_ctinfo.c -+++ b/net/sched/act_ctinfo.c -@@ -96,19 +96,22 @@ static int tcf_ctinfo_act(struct sk_buff *skb, const struct tc_action *a, - action = READ_ONCE(ca->tcf_action); - - wlen = skb_network_offset(skb); -- if (tc_skb_protocol(skb) == htons(ETH_P_IP)) { -+ switch (skb_protocol(skb, true)) { -+ case htons(ETH_P_IP): - wlen += sizeof(struct iphdr); - if (!pskb_may_pull(skb, wlen)) - goto out; - - proto = NFPROTO_IPV4; -- } else if (tc_skb_protocol(skb) == htons(ETH_P_IPV6)) { -+ break; -+ case htons(ETH_P_IPV6): - wlen += sizeof(struct ipv6hdr); - if (!pskb_may_pull(skb, wlen)) - goto out; - - proto = NFPROTO_IPV6; -- } else { -+ break; -+ default: - goto out; - } - -diff --git a/net/sched/act_mpls.c b/net/sched/act_mpls.c -index be3f215cd027..8118e2640979 100644 ---- a/net/sched/act_mpls.c -+++ b/net/sched/act_mpls.c -@@ -82,7 +82,7 @@ static int tcf_mpls_act(struct sk_buff *skb, const struct tc_action *a, - goto drop; - break; - case TCA_MPLS_ACT_PUSH: -- new_lse = tcf_mpls_get_lse(NULL, p, !eth_p_mpls(skb->protocol)); -+ new_lse = tcf_mpls_get_lse(NULL, p, !eth_p_mpls(skb_protocol(skb, true))); - if (skb_mpls_push(skb, new_lse, p->tcfm_proto, mac_len, - skb->dev && skb->dev->type == ARPHRD_ETHER)) - goto drop; -diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c -index b125b2be4467..b2b3faa57294 100644 ---- a/net/sched/act_skbedit.c -+++ b/net/sched/act_skbedit.c -@@ -41,7 +41,7 @@ static int tcf_skbedit_act(struct sk_buff *skb, const struct tc_action *a, - if (params->flags & SKBEDIT_F_INHERITDSFIELD) { - int wlen = skb_network_offset(skb); - -- switch (tc_skb_protocol(skb)) { -+ switch (skb_protocol(skb, true)) { - case htons(ETH_P_IP): - wlen += sizeof(struct iphdr); - if (!pskb_may_pull(skb, wlen)) -diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c -index 0a7ecc292bd3..58d469a66896 100644 ---- a/net/sched/cls_api.c -+++ b/net/sched/cls_api.c -@@ -1589,7 +1589,7 @@ static inline int __tcf_classify(struct sk_buff *skb, - reclassify: - #endif - for (; tp; tp = rcu_dereference_bh(tp->next)) { -- __be16 protocol = tc_skb_protocol(skb); -+ __be16 protocol = skb_protocol(skb, false); - int err; - - if (tp->protocol != protocol && -diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c -index 80ae7b9fa90a..ab53a93b2f2b 100644 ---- a/net/sched/cls_flow.c -+++ b/net/sched/cls_flow.c -@@ -80,7 +80,7 @@ static u32 flow_get_dst(const struct sk_buff *skb, const struct flow_keys *flow) - if (dst) - return ntohl(dst); - -- return addr_fold(skb_dst(skb)) ^ (__force u16) tc_skb_protocol(skb); -+ return addr_fold(skb_dst(skb)) ^ (__force u16)skb_protocol(skb, true); - } - - static u32 flow_get_proto(const struct sk_buff *skb, -@@ -104,7 +104,7 @@ static u32 flow_get_proto_dst(const struct sk_buff *skb, - if (flow->ports.ports) - return ntohs(flow->ports.dst); - -- return addr_fold(skb_dst(skb)) ^ (__force u16) tc_skb_protocol(skb); -+ return addr_fold(skb_dst(skb)) ^ (__force u16)skb_protocol(skb, true); - } - - static u32 flow_get_iif(const struct sk_buff *skb) -@@ -151,7 +151,7 @@ static u32 flow_get_nfct(const struct sk_buff *skb) - static u32 flow_get_nfct_src(const struct sk_buff *skb, - const struct flow_keys *flow) - { -- switch (tc_skb_protocol(skb)) { -+ switch (skb_protocol(skb, true)) { - case htons(ETH_P_IP): - return ntohl(CTTUPLE(skb, src.u3.ip)); - case htons(ETH_P_IPV6): -@@ -164,7 +164,7 @@ fallback: - static u32 flow_get_nfct_dst(const struct sk_buff *skb, - const struct flow_keys *flow) - { -- switch (tc_skb_protocol(skb)) { -+ switch (skb_protocol(skb, true)) { - case htons(ETH_P_IP): - return ntohl(CTTUPLE(skb, dst.u3.ip)); - case htons(ETH_P_IPV6): -diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c -index 74a0febcafb8..3b93d95d2a56 100644 ---- a/net/sched/cls_flower.c -+++ b/net/sched/cls_flower.c -@@ -312,7 +312,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, - /* skb_flow_dissect() does not set n_proto in case an unknown - * protocol, so do it rather here. - */ -- skb_key.basic.n_proto = skb->protocol; -+ skb_key.basic.n_proto = skb_protocol(skb, false); - skb_flow_dissect_tunnel_info(skb, &mask->dissector, &skb_key); - skb_flow_dissect_ct(skb, &mask->dissector, &skb_key, - fl_ct_info_to_flower_map, -diff --git a/net/sched/em_ipset.c b/net/sched/em_ipset.c -index df00566d327d..c95cf86fb431 100644 ---- a/net/sched/em_ipset.c -+++ b/net/sched/em_ipset.c -@@ -59,7 +59,7 @@ static int em_ipset_match(struct sk_buff *skb, struct tcf_ematch *em, - }; - int ret, network_offset; - -- switch (tc_skb_protocol(skb)) { -+ switch (skb_protocol(skb, true)) { - case htons(ETH_P_IP): - state.pf = NFPROTO_IPV4; - if (!pskb_network_may_pull(skb, sizeof(struct iphdr))) -diff --git a/net/sched/em_ipt.c b/net/sched/em_ipt.c -index eecfe072c508..9405b4d88002 100644 ---- a/net/sched/em_ipt.c -+++ b/net/sched/em_ipt.c -@@ -212,7 +212,7 @@ static int em_ipt_match(struct sk_buff *skb, struct tcf_ematch *em, - struct nf_hook_state state; - int ret; - -- switch (tc_skb_protocol(skb)) { -+ switch (skb_protocol(skb, true)) { - case htons(ETH_P_IP): - if (!pskb_network_may_pull(skb, sizeof(struct iphdr))) - return 0; -diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c -index d99966a55c84..46254968d390 100644 ---- a/net/sched/em_meta.c -+++ b/net/sched/em_meta.c -@@ -195,7 +195,7 @@ META_COLLECTOR(int_priority) - META_COLLECTOR(int_protocol) - { - /* Let userspace take care of the byte ordering */ -- dst->value = tc_skb_protocol(skb); -+ dst->value = skb_protocol(skb, false); - } - - META_COLLECTOR(int_pkttype) -diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c -index ee12ca9f55b4..1c281cc81f57 100644 ---- a/net/sched/sch_atm.c -+++ b/net/sched/sch_atm.c -@@ -553,16 +553,16 @@ static int atm_tc_init(struct Qdisc *sch, struct nlattr *opt, - if (!p->link.q) - p->link.q = &noop_qdisc; - pr_debug("atm_tc_init: link (%p) qdisc %p\n", &p->link, p->link.q); -+ p->link.vcc = NULL; -+ p->link.sock = NULL; -+ p->link.common.classid = sch->handle; -+ p->link.ref = 1; - - err = tcf_block_get(&p->link.block, &p->link.filter_list, sch, - extack); - if (err) - return err; - -- p->link.vcc = NULL; -- p->link.sock = NULL; -- p->link.common.classid = sch->handle; -- p->link.ref = 1; - tasklet_init(&p->task, sch_atm_dequeue, (unsigned long)sch); - return 0; - } -diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c -index 9475fa81ea7f..9bb2b8f73692 100644 ---- a/net/sched/sch_cake.c -+++ b/net/sched/sch_cake.c -@@ -591,7 +591,7 @@ static void cake_update_flowkeys(struct flow_keys *keys, - struct nf_conntrack_tuple tuple = {}; - bool rev = !skb->_nfct; - -- if (tc_skb_protocol(skb) != htons(ETH_P_IP)) -+ if (skb_protocol(skb, true) != htons(ETH_P_IP)) - return; - - if (!nf_ct_get_tuple_skb(&tuple, skb)) -@@ -1520,7 +1520,7 @@ static u8 cake_handle_diffserv(struct sk_buff *skb, bool wash) - u16 *buf, buf_; - u8 dscp; - -- switch (tc_skb_protocol(skb)) { -+ switch (skb_protocol(skb, true)) { - case htons(ETH_P_IP): - buf = skb_header_pointer(skb, offset, sizeof(buf_), &buf_); - if (unlikely(!buf)) -diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c -index 05605b30bef3..2b88710994d7 100644 ---- a/net/sched/sch_dsmark.c -+++ b/net/sched/sch_dsmark.c -@@ -210,7 +210,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch, - if (p->set_tc_index) { - int wlen = skb_network_offset(skb); - -- switch (tc_skb_protocol(skb)) { -+ switch (skb_protocol(skb, true)) { - case htons(ETH_P_IP): - wlen += sizeof(struct iphdr); - if (!pskb_may_pull(skb, wlen) || -@@ -303,7 +303,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch) - index = skb->tc_index & (p->indices - 1); - pr_debug("index %d->%d\n", skb->tc_index, index); - -- switch (tc_skb_protocol(skb)) { -+ switch (skb_protocol(skb, true)) { - case htons(ETH_P_IP): - ipv4_change_dsfield(ip_hdr(skb), p->mv[index].mask, - p->mv[index].value); -@@ -320,7 +320,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch) - */ - if (p->mv[index].mask != 0xff || p->mv[index].value) - pr_warn("%s: unsupported protocol %d\n", -- __func__, ntohs(tc_skb_protocol(skb))); -+ __func__, ntohs(skb_protocol(skb, true))); - break; - } - -diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c -index 689ef6f3ded8..2f1f0a378408 100644 ---- a/net/sched/sch_teql.c -+++ b/net/sched/sch_teql.c -@@ -239,7 +239,7 @@ __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, - char haddr[MAX_ADDR_LEN]; - - neigh_ha_snapshot(haddr, n, dev); -- err = dev_hard_header(skb, dev, ntohs(tc_skb_protocol(skb)), -+ err = dev_hard_header(skb, dev, ntohs(skb_protocol(skb, false)), - haddr, NULL, skb->len); - - if (err < 0) -diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c -index 57118e342c8e..06a8268edf3b 100644 ---- a/net/sunrpc/xprtrdma/rpc_rdma.c -+++ b/net/sunrpc/xprtrdma/rpc_rdma.c -@@ -71,7 +71,7 @@ static unsigned int rpcrdma_max_call_header_size(unsigned int maxsegs) - size = RPCRDMA_HDRLEN_MIN; - - /* Maximum Read list size */ -- size = maxsegs * rpcrdma_readchunk_maxsz * sizeof(__be32); -+ size += maxsegs * rpcrdma_readchunk_maxsz * sizeof(__be32); - - /* Minimal Read chunk size */ - size += sizeof(__be32); /* segment count */ -@@ -94,7 +94,7 @@ static unsigned int rpcrdma_max_reply_header_size(unsigned int maxsegs) - size = RPCRDMA_HDRLEN_MIN; - - /* Maximum Write list size */ -- size = sizeof(__be32); /* segment count */ -+ size += sizeof(__be32); /* segment count */ - size += maxsegs * rpcrdma_segment_maxsz * sizeof(__be32); - size += sizeof(__be32); /* list discriminator */ - -diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c -index 659da37020a4..3b5fb1f57aeb 100644 ---- a/net/sunrpc/xprtrdma/transport.c -+++ b/net/sunrpc/xprtrdma/transport.c -@@ -249,6 +249,11 @@ xprt_rdma_connect_worker(struct work_struct *work) - xprt->stat.connect_start; - xprt_set_connected(xprt); - rc = -EAGAIN; -+ } else { -+ /* Force a call to xprt_rdma_close to clean up */ -+ spin_lock(&xprt->transport_lock); -+ set_bit(XPRT_CLOSE_WAIT, &xprt->state); -+ spin_unlock(&xprt->transport_lock); - } - xprt_wake_pending_tasks(xprt, rc); - } -diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c -index db0259c6467e..26e89c65ba56 100644 ---- a/net/sunrpc/xprtrdma/verbs.c -+++ b/net/sunrpc/xprtrdma/verbs.c -@@ -279,17 +279,19 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) - break; - case RDMA_CM_EVENT_CONNECT_ERROR: - ep->re_connect_status = -ENOTCONN; -- goto disconnected; -+ goto wake_connect_worker; - case RDMA_CM_EVENT_UNREACHABLE: - ep->re_connect_status = -ENETUNREACH; -- goto disconnected; -+ goto wake_connect_worker; - case RDMA_CM_EVENT_REJECTED: - dprintk("rpcrdma: connection to %pISpc rejected: %s\n", - sap, rdma_reject_msg(id, event->status)); - ep->re_connect_status = -ECONNREFUSED; - if (event->status == IB_CM_REJ_STALE_CONN) -- ep->re_connect_status = -EAGAIN; -- goto disconnected; -+ ep->re_connect_status = -ENOTCONN; -+wake_connect_worker: -+ wake_up_all(&ep->re_connect_wait); -+ return 0; - case RDMA_CM_EVENT_DISCONNECTED: - ep->re_connect_status = -ECONNABORTED; - disconnected: -@@ -398,14 +400,14 @@ static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt) - - ep = kzalloc(sizeof(*ep), GFP_NOFS); - if (!ep) -- return -EAGAIN; -+ return -ENOTCONN; - ep->re_xprt = &r_xprt->rx_xprt; - kref_init(&ep->re_kref); - - id = rpcrdma_create_id(r_xprt, ep); - if (IS_ERR(id)) { -- rc = PTR_ERR(id); -- goto out_free; -+ kfree(ep); -+ return PTR_ERR(id); - } - __module_get(THIS_MODULE); - device = id->device; -@@ -504,9 +506,6 @@ static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt) - out_destroy: - rpcrdma_ep_put(ep); - rdma_destroy_id(id); --out_free: -- kfree(ep); -- r_xprt->rx_ep = NULL; - return rc; - } - -@@ -522,8 +521,6 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt) - struct rpcrdma_ep *ep; - int rc; - --retry: -- rpcrdma_xprt_disconnect(r_xprt); - rc = rpcrdma_ep_create(r_xprt); - if (rc) - return rc; -@@ -539,10 +536,6 @@ retry: - rpcrdma_ep_get(ep); - rpcrdma_post_recvs(r_xprt, true); - -- rc = rpcrdma_sendctxs_create(r_xprt); -- if (rc) -- goto out; -- - rc = rdma_connect(ep->re_id, &ep->re_remote_cma); - if (rc) - goto out; -@@ -552,15 +545,19 @@ retry: - wait_event_interruptible(ep->re_connect_wait, - ep->re_connect_status != 0); - if (ep->re_connect_status <= 0) { -- if (ep->re_connect_status == -EAGAIN) -- goto retry; - rc = ep->re_connect_status; - goto out; - } - -+ rc = rpcrdma_sendctxs_create(r_xprt); -+ if (rc) { -+ rc = -ENOTCONN; -+ goto out; -+ } -+ - rc = rpcrdma_reqs_setup(r_xprt); - if (rc) { -- rpcrdma_xprt_disconnect(r_xprt); -+ rc = -ENOTCONN; - goto out; - } - rpcrdma_mrs_create(r_xprt); -diff --git a/security/apparmor/match.c b/security/apparmor/match.c -index 525ce22dc0e9..5947b0a763c2 100644 ---- a/security/apparmor/match.c -+++ b/security/apparmor/match.c -@@ -97,6 +97,9 @@ static struct table_header *unpack_table(char *blob, size_t bsize) - th.td_flags == YYTD_DATA8)) - goto out; - -+ /* if we have a table it must have some entries */ -+ if (th.td_lolen == 0) -+ goto out; - tsize = table_size(th.td_lolen, th.td_flags); - if (bsize < tsize) - goto out; -@@ -198,6 +201,8 @@ static int verify_dfa(struct aa_dfa *dfa) - - state_count = dfa->tables[YYTD_ID_BASE]->td_lolen; - trans_count = dfa->tables[YYTD_ID_NXT]->td_lolen; -+ if (state_count == 0) -+ goto out; - for (i = 0; i < state_count; i++) { - if (!(BASE_TABLE(dfa)[i] & MATCH_FLAG_DIFF_ENCODE) && - (DEFAULT_TABLE(dfa)[i] >= state_count)) -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 16ecc8515db8..d80eed2a48a1 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -6117,6 +6117,8 @@ enum { - ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS, - ALC269VC_FIXUP_ACER_HEADSET_MIC, - ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE, -+ ALC289_FIXUP_ASUS_G401, -+ ALC256_FIXUP_ACER_MIC_NO_PRESENCE, - }; - - static const struct hda_fixup alc269_fixups[] = { -@@ -7082,7 +7084,7 @@ static const struct hda_fixup alc269_fixups[] = { - { } - }, - .chained = true, -- .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC -+ .chain_id = ALC269_FIXUP_HEADSET_MIC - }, - [ALC294_FIXUP_ASUS_HEADSET_MIC] = { - .type = HDA_FIXUP_PINS, -@@ -7091,7 +7093,7 @@ static const struct hda_fixup alc269_fixups[] = { - { } - }, - .chained = true, -- .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC -+ .chain_id = ALC269_FIXUP_HEADSET_MIC - }, - [ALC294_FIXUP_ASUS_SPK] = { - .type = HDA_FIXUP_VERBS, -@@ -7099,6 +7101,8 @@ static const struct hda_fixup alc269_fixups[] = { - /* Set EAPD high */ - { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 }, - { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 }, -+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f }, -+ { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 }, - { } - }, - .chained = true, -@@ -7324,6 +7328,22 @@ static const struct hda_fixup alc269_fixups[] = { - .chained = true, - .chain_id = ALC269_FIXUP_HEADSET_MIC - }, -+ [ALC289_FIXUP_ASUS_G401] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ { 0x19, 0x03a11020 }, /* headset mic with jack detect */ -+ { } -+ }, -+ }, -+ [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */ -+ { } -+ }, -+ .chained = true, -+ .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE -+ }, - }; - - static const struct snd_pci_quirk alc269_fixup_tbl[] = { -@@ -7352,6 +7372,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), - SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC), - SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC), -+ SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), - SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), - SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X), -@@ -7495,6 +7516,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), - SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), - SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC), -+ SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE), - SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE), - SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), -@@ -7504,6 +7526,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), - SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), -+ SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_G401), - SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), - SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), - SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), -diff --git a/sound/usb/line6/capture.c b/sound/usb/line6/capture.c -index 663d608c4287..970c9bdce0b2 100644 ---- a/sound/usb/line6/capture.c -+++ b/sound/usb/line6/capture.c -@@ -286,6 +286,8 @@ int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm) - urb->interval = LINE6_ISO_INTERVAL; - urb->error_count = 0; - urb->complete = audio_in_callback; -+ if (usb_urb_ep_type_check(urb)) -+ return -EINVAL; - } - - return 0; -diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c -index 4f096685ed65..0caf53f5764c 100644 ---- a/sound/usb/line6/driver.c -+++ b/sound/usb/line6/driver.c -@@ -820,7 +820,7 @@ void line6_disconnect(struct usb_interface *interface) - if (WARN_ON(usbdev != line6->usbdev)) - return; - -- cancel_delayed_work(&line6->startup_work); -+ cancel_delayed_work_sync(&line6->startup_work); - - if (line6->urb_listen != NULL) - line6_stop_listen(line6); -diff --git a/sound/usb/line6/playback.c b/sound/usb/line6/playback.c -index 01930ce7bd75..8233c61e23f1 100644 ---- a/sound/usb/line6/playback.c -+++ b/sound/usb/line6/playback.c -@@ -431,6 +431,8 @@ int line6_create_audio_out_urbs(struct snd_line6_pcm *line6pcm) - urb->interval = LINE6_ISO_INTERVAL; - urb->error_count = 0; - urb->complete = audio_out_callback; -+ if (usb_urb_ep_type_check(urb)) -+ return -EINVAL; - } - - return 0; -diff --git a/sound/usb/midi.c b/sound/usb/midi.c -index 047b90595d65..354f57692938 100644 ---- a/sound/usb/midi.c -+++ b/sound/usb/midi.c -@@ -1499,6 +1499,8 @@ void snd_usbmidi_disconnect(struct list_head *p) - spin_unlock_irq(&umidi->disc_lock); - up_write(&umidi->disc_rwsem); - -+ del_timer_sync(&umidi->error_timer); -+ - for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { - struct snd_usb_midi_endpoint *ep = &umidi->endpoints[i]; - if (ep->out) -@@ -1525,7 +1527,6 @@ void snd_usbmidi_disconnect(struct list_head *p) - ep->in = NULL; - } - } -- del_timer_sync(&umidi->error_timer); - } - EXPORT_SYMBOL(snd_usbmidi_disconnect); - -@@ -2301,16 +2302,22 @@ void snd_usbmidi_input_stop(struct list_head *p) - } - EXPORT_SYMBOL(snd_usbmidi_input_stop); - --static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint *ep) -+static void snd_usbmidi_input_start_ep(struct snd_usb_midi *umidi, -+ struct snd_usb_midi_in_endpoint *ep) - { - unsigned int i; -+ unsigned long flags; - - if (!ep) - return; - for (i = 0; i < INPUT_URBS; ++i) { - struct urb *urb = ep->urbs[i]; -- urb->dev = ep->umidi->dev; -- snd_usbmidi_submit_urb(urb, GFP_KERNEL); -+ spin_lock_irqsave(&umidi->disc_lock, flags); -+ if (!atomic_read(&urb->use_count)) { -+ urb->dev = ep->umidi->dev; -+ snd_usbmidi_submit_urb(urb, GFP_ATOMIC); -+ } -+ spin_unlock_irqrestore(&umidi->disc_lock, flags); - } - } - -@@ -2326,7 +2333,7 @@ void snd_usbmidi_input_start(struct list_head *p) - if (umidi->input_running || !umidi->opened[1]) - return; - for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) -- snd_usbmidi_input_start_ep(umidi->endpoints[i].in); -+ snd_usbmidi_input_start_ep(umidi, umidi->endpoints[i].in); - umidi->input_running = 1; - } - EXPORT_SYMBOL(snd_usbmidi_input_start); -diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c -index 5f26137b8d60..242476eb808c 100644 ---- a/tools/perf/util/stat.c -+++ b/tools/perf/util/stat.c -@@ -368,8 +368,10 @@ int perf_stat_process_counter(struct perf_stat_config *config, - * interval mode, otherwise overall avg running - * averages will be shown for each interval. - */ -- if (config->interval) -- init_stats(ps->res_stats); -+ if (config->interval) { -+ for (i = 0; i < 3; i++) -+ init_stats(&ps->res_stats[i]); -+ } - - if (counter->per_pkg) - zero_per_pkg(counter); -diff --git a/tools/testing/selftests/net/fib_nexthops.sh b/tools/testing/selftests/net/fib_nexthops.sh -index 6560ed796ac4..09830b88ec8c 100755 ---- a/tools/testing/selftests/net/fib_nexthops.sh -+++ b/tools/testing/selftests/net/fib_nexthops.sh -@@ -512,6 +512,19 @@ ipv6_fcnal_runtime() - run_cmd "$IP nexthop add id 86 via 2001:db8:91::2 dev veth1" - run_cmd "$IP ro add 2001:db8:101::1/128 nhid 81" - -+ # rpfilter and default route -+ $IP nexthop flush >/dev/null 2>&1 -+ run_cmd "ip netns exec me ip6tables -t mangle -I PREROUTING 1 -m rpfilter --invert -j DROP" -+ run_cmd "$IP nexthop add id 91 via 2001:db8:91::2 dev veth1" -+ run_cmd "$IP nexthop add id 92 via 2001:db8:92::2 dev veth3" -+ run_cmd "$IP nexthop add id 93 group 91/92" -+ run_cmd "$IP -6 ro add default nhid 91" -+ run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1" -+ log_test $? 0 "Nexthop with default route and rpfilter" -+ run_cmd "$IP -6 ro replace default nhid 93" -+ run_cmd "ip netns exec me ping -c1 -w1 2001:db8:101::1" -+ log_test $? 0 "Nexthop with multipath default route and rpfilter" -+ - # TO-DO: - # existing route with old nexthop; append route with new nexthop - # existing route with old nexthop; replace route with new