diff --git a/config/kernel/linux-sunxi-current.config b/config/kernel/linux-sunxi-current.config index ff43f8dd37..027c349fda 100644 --- a/config/kernel/linux-sunxi-current.config +++ b/config/kernel/linux-sunxi-current.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.4.16 Kernel Configuration +# Linux/arm 5.4.18 Kernel Configuration # # diff --git a/config/kernel/linux-sunxi64-current.config b/config/kernel/linux-sunxi64-current.config index 485d1d1eae..032427b257 100644 --- a/config/kernel/linux-sunxi64-current.config +++ b/config/kernel/linux-sunxi64-current.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.4.16 Kernel Configuration +# Linux/arm64 5.4.18 Kernel Configuration # # diff --git a/patch/kernel/sunxi-current/patch-5.4.16-17-modified.patch b/patch/kernel/sunxi-current/patch-5.4.16-17-modified.patch new file mode 100644 index 0000000000..b35a9137b6 --- /dev/null +++ b/patch/kernel/sunxi-current/patch-5.4.16-17-modified.patch @@ -0,0 +1,4040 @@ +diff --git a/Makefile b/Makefile +index e16d2e58ed4b..a363a539a092 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 16 ++SUBLEVEL = 17 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/arc/plat-eznps/Kconfig b/arch/arc/plat-eznps/Kconfig +index a376a50d3fea..a931d0a256d0 100644 +--- a/arch/arc/plat-eznps/Kconfig ++++ b/arch/arc/plat-eznps/Kconfig +@@ -7,7 +7,7 @@ + menuconfig ARC_PLAT_EZNPS + bool "\"EZchip\" ARC dev platform" + select CPU_BIG_ENDIAN +- select CLKSRC_NPS ++ select CLKSRC_NPS if !PHYS_ADDR_T_64BIT + select EZNPS_GIC + select EZCHIP_NPS_MANAGEMENT_ENET if ETHERNET + help +diff --git a/arch/arm/configs/aspeed_g5_defconfig b/arch/arm/configs/aspeed_g5_defconfig +index 597536cc9573..b87508c7056c 100644 +--- a/arch/arm/configs/aspeed_g5_defconfig ++++ b/arch/arm/configs/aspeed_g5_defconfig +@@ -139,6 +139,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=6 + CONFIG_SERIAL_8250_EXTENDED=y + CONFIG_SERIAL_8250_ASPEED_VUART=y + CONFIG_SERIAL_8250_SHARE_IRQ=y ++CONFIG_SERIAL_8250_DW=y + CONFIG_SERIAL_OF_PLATFORM=y + CONFIG_ASPEED_KCS_IPMI_BMC=y + CONFIG_ASPEED_BT_IPMI_BMC=y +diff --git a/arch/arm64/kvm/debug.c b/arch/arm64/kvm/debug.c +index 43487f035385..7a7e425616b5 100644 +--- a/arch/arm64/kvm/debug.c ++++ b/arch/arm64/kvm/debug.c +@@ -101,7 +101,7 @@ void kvm_arm_reset_debug_ptr(struct kvm_vcpu *vcpu) + void kvm_arm_setup_debug(struct kvm_vcpu *vcpu) + { + bool trap_debug = !(vcpu->arch.flags & KVM_ARM64_DEBUG_DIRTY); +- unsigned long mdscr; ++ unsigned long mdscr, orig_mdcr_el2 = vcpu->arch.mdcr_el2; + + trace_kvm_arm_setup_debug(vcpu, vcpu->guest_debug); + +@@ -197,6 +197,10 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu) + if (vcpu_read_sys_reg(vcpu, MDSCR_EL1) & (DBG_MDSCR_KDE | DBG_MDSCR_MDE)) + vcpu->arch.flags |= KVM_ARM64_DEBUG_DIRTY; + ++ /* Write mdcr_el2 changes since vcpu_load on VHE systems */ ++ if (has_vhe() && orig_mdcr_el2 != vcpu->arch.mdcr_el2) ++ write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2); ++ + trace_kvm_arm_set_dreg32("MDCR_EL2", vcpu->arch.mdcr_el2); + trace_kvm_arm_set_dreg32("MDSCR_EL1", vcpu_read_sys_reg(vcpu, MDSCR_EL1)); + } +diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S +index d7086b985f27..4049f2c46387 100644 +--- a/arch/um/include/asm/common.lds.S ++++ b/arch/um/include/asm/common.lds.S +@@ -83,8 +83,8 @@ + __preinit_array_end = .; + } + .init_array : { +- /* dummy - we call this ourselves */ + __init_array_start = .; ++ *(.init_array) + __init_array_end = .; + } + .fini_array : { +diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S +index c69d69ee96be..f5001481010c 100644 +--- a/arch/um/kernel/dyn.lds.S ++++ b/arch/um/kernel/dyn.lds.S +@@ -103,6 +103,7 @@ SECTIONS + be empty, which isn't pretty. */ + . = ALIGN(32 / 8); + .preinit_array : { *(.preinit_array) } ++ .init_array : { *(.init_array) } + .fini_array : { *(.fini_array) } + .data : { + INIT_TASK_DATA(KERNEL_STACK_SIZE) +diff --git a/crypto/af_alg.c b/crypto/af_alg.c +index 0dceaabc6321..3d8e53010cda 100644 +--- a/crypto/af_alg.c ++++ b/crypto/af_alg.c +@@ -134,11 +134,13 @@ void af_alg_release_parent(struct sock *sk) + sk = ask->parent; + ask = alg_sk(sk); + +- lock_sock(sk); ++ local_bh_disable(); ++ bh_lock_sock(sk); + ask->nokey_refcnt -= nokey; + if (!last) + last = !--ask->refcnt; +- release_sock(sk); ++ bh_unlock_sock(sk); ++ local_bh_enable(); + + if (last) + sock_put(sk); +diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c +index 543792e0ebf0..81bbea7f2ba6 100644 +--- a/crypto/pcrypt.c ++++ b/crypto/pcrypt.c +@@ -362,11 +362,12 @@ err: + + static void __exit pcrypt_exit(void) + { ++ crypto_unregister_template(&pcrypt_tmpl); ++ + pcrypt_fini_padata(pencrypt); + pcrypt_fini_padata(pdecrypt); + + kset_unregister(pcrypt_kset); +- crypto_unregister_template(&pcrypt_tmpl); + } + + subsys_initcall(pcrypt_init); +diff --git a/drivers/android/binder.c b/drivers/android/binder.c +index 976a69420c16..254f87b627fe 100644 +--- a/drivers/android/binder.c ++++ b/drivers/android/binder.c +@@ -5203,10 +5203,11 @@ err_bad_arg: + + static int binder_open(struct inode *nodp, struct file *filp) + { +- struct binder_proc *proc; ++ struct binder_proc *proc, *itr; + struct binder_device *binder_dev; + struct binderfs_info *info; + struct dentry *binder_binderfs_dir_entry_proc = NULL; ++ bool existing_pid = false; + + binder_debug(BINDER_DEBUG_OPEN_CLOSE, "%s: %d:%d\n", __func__, + current->group_leader->pid, current->pid); +@@ -5239,19 +5240,24 @@ static int binder_open(struct inode *nodp, struct file *filp) + filp->private_data = proc; + + mutex_lock(&binder_procs_lock); ++ hlist_for_each_entry(itr, &binder_procs, proc_node) { ++ if (itr->pid == proc->pid) { ++ existing_pid = true; ++ break; ++ } ++ } + hlist_add_head(&proc->proc_node, &binder_procs); + mutex_unlock(&binder_procs_lock); + +- if (binder_debugfs_dir_entry_proc) { ++ if (binder_debugfs_dir_entry_proc && !existing_pid) { + char strbuf[11]; + + snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); + /* +- * proc debug entries are shared between contexts, so +- * this will fail if the process tries to open the driver +- * again with a different context. The priting code will +- * anyway print all contexts that a given PID has, so this +- * is not a problem. ++ * proc debug entries are shared between contexts. ++ * Only create for the first PID to avoid debugfs log spamming ++ * The printing code will anyway print all contexts for a given ++ * PID so this is not a problem. + */ + proc->debugfs_entry = debugfs_create_file(strbuf, 0444, + binder_debugfs_dir_entry_proc, +@@ -5259,19 +5265,16 @@ static int binder_open(struct inode *nodp, struct file *filp) + &proc_fops); + } + +- if (binder_binderfs_dir_entry_proc) { ++ if (binder_binderfs_dir_entry_proc && !existing_pid) { + char strbuf[11]; + struct dentry *binderfs_entry; + + snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); + /* + * Similar to debugfs, the process specific log file is shared +- * between contexts. If the file has already been created for a +- * process, the following binderfs_create_file() call will +- * fail with error code EEXIST if another context of the same +- * process invoked binder_open(). This is ok since same as +- * debugfs, the log file will contain information on all +- * contexts of a given PID. ++ * between contexts. Only create for the first PID. ++ * This is ok since same as debugfs, the log file will contain ++ * information on all contexts of a given PID. + */ + binderfs_entry = binderfs_create_file(binder_binderfs_dir_entry_proc, + strbuf, &proc_fops, (void *)(unsigned long)proc->pid); +@@ -5281,10 +5284,8 @@ static int binder_open(struct inode *nodp, struct file *filp) + int error; + + error = PTR_ERR(binderfs_entry); +- if (error != -EEXIST) { +- pr_warn("Unable to create file %s in binderfs (error %d)\n", +- strbuf, error); +- } ++ pr_warn("Unable to create file %s in binderfs (error %d)\n", ++ strbuf, error); + } + } + +diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c +index b23d1e4bad33..9d0d65efcd94 100644 +--- a/drivers/atm/eni.c ++++ b/drivers/atm/eni.c +@@ -374,7 +374,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb, + here = (eni_vcc->descr+skip) & (eni_vcc->words-1); + dma[j++] = (here << MID_DMA_COUNT_SHIFT) | (vcc->vci + << MID_DMA_VCI_SHIFT) | MID_DT_JK; +- j++; ++ dma[j++] = 0; + } + here = (eni_vcc->descr+size+skip) & (eni_vcc->words-1); + if (!eff) size += skip; +@@ -447,7 +447,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb, + if (size != eff) { + dma[j++] = (here << MID_DMA_COUNT_SHIFT) | + (vcc->vci << MID_DMA_VCI_SHIFT) | MID_DT_JK; +- j++; ++ dma[j++] = 0; + } + if (!j || j > 2*RX_DMA_BUF) { + printk(KERN_CRIT DEV_LABEL "!j or j too big!!!\n"); +diff --git a/drivers/base/component.c b/drivers/base/component.c +index 532a3a5d8f63..1fdbd6ff2058 100644 +--- a/drivers/base/component.c ++++ b/drivers/base/component.c +@@ -102,11 +102,11 @@ static int component_devices_show(struct seq_file *s, void *data) + seq_printf(s, "%-40s %20s\n", "device name", "status"); + seq_puts(s, "-------------------------------------------------------------\n"); + for (i = 0; i < match->num; i++) { +- struct device *d = (struct device *)match->compare[i].data; ++ struct component *component = match->compare[i].component; + +- seq_printf(s, "%-40s %20s\n", dev_name(d), +- match->compare[i].component ? +- "registered" : "not registered"); ++ seq_printf(s, "%-40s %20s\n", ++ component ? dev_name(component->dev) : "(unknown)", ++ component ? (component->bound ? "bound" : "not bound") : "not registered"); + } + mutex_unlock(&component_mutex); + +diff --git a/drivers/base/test/test_async_driver_probe.c b/drivers/base/test/test_async_driver_probe.c +index f4b1d8e54daf..3bb7beb127a9 100644 +--- a/drivers/base/test/test_async_driver_probe.c ++++ b/drivers/base/test/test_async_driver_probe.c +@@ -44,7 +44,8 @@ static int test_probe(struct platform_device *pdev) + * performing an async init on that node. + */ + if (dev->driver->probe_type == PROBE_PREFER_ASYNCHRONOUS) { +- if (dev_to_node(dev) != numa_node_id()) { ++ if (IS_ENABLED(CONFIG_NUMA) && ++ dev_to_node(dev) != numa_node_id()) { + dev_warn(dev, "NUMA node mismatch %d != %d\n", + dev_to_node(dev), numa_node_id()); + atomic_inc(&warnings); +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c +index 04cf767d0708..4e7ef35f1c8f 100644 +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -2585,7 +2585,7 @@ static void btusb_mtk_wmt_recv(struct urb *urb) + * and being processed the events from there then. + */ + if (test_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags)) { +- data->evt_skb = skb_clone(skb, GFP_KERNEL); ++ data->evt_skb = skb_clone(skb, GFP_ATOMIC); + if (!data->evt_skb) + goto err_out; + } +diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c +index abbf281ee337..d9846265a5cd 100644 +--- a/drivers/bus/ti-sysc.c ++++ b/drivers/bus/ti-sysc.c +@@ -923,6 +923,9 @@ set_midle: + return -EINVAL; + } + ++ if (ddata->cfg.quirks & SYSC_QUIRK_SWSUP_MSTANDBY) ++ best_mode = SYSC_IDLE_NO; ++ + reg &= ~(SYSC_IDLE_MASK << regbits->midle_shift); + reg |= best_mode << regbits->midle_shift; + sysc_write(ddata, ddata->offsets[SYSC_SYSCONFIG], reg); +@@ -984,6 +987,10 @@ static int sysc_disable_module(struct device *dev) + return ret; + } + ++ if (ddata->cfg.quirks & (SYSC_QUIRK_SWSUP_MSTANDBY) || ++ ddata->cfg.quirks & (SYSC_QUIRK_FORCE_MSTANDBY)) ++ best_mode = SYSC_IDLE_FORCE; ++ + reg &= ~(SYSC_IDLE_MASK << regbits->midle_shift); + reg |= best_mode << regbits->midle_shift; + sysc_write(ddata, ddata->offsets[SYSC_SYSCONFIG], reg); +@@ -1242,6 +1249,8 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { + SYSC_QUIRK_SWSUP_SIDLE), + + /* Quirks that need to be set based on detected module */ ++ SYSC_QUIRK("aess", 0, 0, 0x10, -1, 0x40000000, 0xffffffff, ++ SYSC_MODULE_QUIRK_AESS), + SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x00000006, 0xffffffff, + SYSC_MODULE_QUIRK_HDQ1W), + SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x0000000a, 0xffffffff, +@@ -1257,6 +1266,10 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { + SYSC_QUIRK("gpu", 0x50000000, 0x14, -1, -1, 0x00010201, 0xffffffff, 0), + SYSC_QUIRK("gpu", 0x50000000, 0xfe00, 0xfe10, -1, 0x40000000 , 0xffffffff, + SYSC_MODULE_QUIRK_SGX), ++ SYSC_QUIRK("usb_otg_hs", 0, 0x400, 0x404, 0x408, 0x00000050, ++ 0xffffffff, SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), ++ SYSC_QUIRK("usb_otg_hs", 0, 0, 0x10, -1, 0x4ea2080d, 0xffffffff, ++ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), + SYSC_QUIRK("wdt", 0, 0, 0x10, 0x14, 0x502a0500, 0xfffff0f0, + SYSC_MODULE_QUIRK_WDT), + /* Watchdog on am3 and am4 */ +@@ -1266,7 +1279,6 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { + #ifdef DEBUG + SYSC_QUIRK("adc", 0, 0, 0x10, -1, 0x47300001, 0xffffffff, 0), + SYSC_QUIRK("atl", 0, 0, -1, -1, 0x0a070100, 0xffffffff, 0), +- SYSC_QUIRK("aess", 0, 0, 0x10, -1, 0x40000000, 0xffffffff, 0), + SYSC_QUIRK("cm", 0, 0, -1, -1, 0x40000301, 0xffffffff, 0), + SYSC_QUIRK("control", 0, 0, 0x10, -1, 0x40000900, 0xffffffff, 0), + SYSC_QUIRK("cpgmac", 0, 0x1200, 0x1208, 0x1204, 0x4edb1902, +@@ -1315,8 +1327,6 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { + SYSC_QUIRK("usbhstll", 0, 0, 0x10, 0x14, 0x00000008, 0xffffffff, 0), + SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, 0x14, 0x50700100, 0xffffffff, 0), + SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, -1, 0x50700101, 0xffffffff, 0), +- SYSC_QUIRK("usb_otg_hs", 0, 0x400, 0x404, 0x408, 0x00000050, +- 0xffffffff, 0), + SYSC_QUIRK("vfpe", 0, 0, 0x104, -1, 0x4d001200, 0xffffffff, 0), + #endif + }; +@@ -1400,6 +1410,14 @@ static void sysc_clk_enable_quirk_hdq1w(struct sysc *ddata) + sysc_write(ddata, offset, val); + } + ++/* AESS (Audio Engine SubSystem) needs autogating set after enable */ ++static void sysc_module_enable_quirk_aess(struct sysc *ddata) ++{ ++ int offset = 0x7c; /* AESS_AUTO_GATING_ENABLE */ ++ ++ sysc_write(ddata, offset, 1); ++} ++ + /* I2C needs extra enable bit toggling for reset */ + static void sysc_clk_quirk_i2c(struct sysc *ddata, bool enable) + { +@@ -1482,6 +1500,9 @@ static void sysc_init_module_quirks(struct sysc *ddata) + return; + } + ++ if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_AESS) ++ ddata->module_enable_quirk = sysc_module_enable_quirk_aess; ++ + if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_SGX) + ddata->module_enable_quirk = sysc_module_enable_quirk_sgx; + +diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c +index db22777d59b4..62930351ccd9 100644 +--- a/drivers/crypto/caam/ctrl.c ++++ b/drivers/crypto/caam/ctrl.c +@@ -685,11 +685,9 @@ static int caam_probe(struct platform_device *pdev) + of_node_put(np); + + if (!ctrlpriv->mc_en) +- clrsetbits_32(&ctrl->mcr, MCFGR_AWCACHE_MASK | MCFGR_LONG_PTR, ++ clrsetbits_32(&ctrl->mcr, MCFGR_AWCACHE_MASK, + MCFGR_AWCACHE_CACH | MCFGR_AWCACHE_BUFF | +- MCFGR_WDENABLE | MCFGR_LARGE_BURST | +- (sizeof(dma_addr_t) == sizeof(u64) ? +- MCFGR_LONG_PTR : 0)); ++ MCFGR_WDENABLE | MCFGR_LARGE_BURST); + + handle_imx6_err005766(&ctrl->mcr); + +diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c +index 38ee38b37ae6..01dd418bdadc 100644 +--- a/drivers/crypto/chelsio/chcr_algo.c ++++ b/drivers/crypto/chelsio/chcr_algo.c +@@ -3194,9 +3194,6 @@ static int chcr_gcm_setauthsize(struct crypto_aead *tfm, unsigned int authsize) + aeadctx->mayverify = VERIFY_SW; + break; + default: +- +- crypto_tfm_set_flags((struct crypto_tfm *) tfm, +- CRYPTO_TFM_RES_BAD_KEY_LEN); + return -EINVAL; + } + return crypto_aead_setauthsize(aeadctx->sw_cipher, authsize); +@@ -3221,8 +3218,6 @@ static int chcr_4106_4309_setauthsize(struct crypto_aead *tfm, + aeadctx->mayverify = VERIFY_HW; + break; + default: +- crypto_tfm_set_flags((struct crypto_tfm *)tfm, +- CRYPTO_TFM_RES_BAD_KEY_LEN); + return -EINVAL; + } + return crypto_aead_setauthsize(aeadctx->sw_cipher, authsize); +@@ -3263,8 +3258,6 @@ static int chcr_ccm_setauthsize(struct crypto_aead *tfm, + aeadctx->mayverify = VERIFY_HW; + break; + default: +- crypto_tfm_set_flags((struct crypto_tfm *)tfm, +- CRYPTO_TFM_RES_BAD_KEY_LEN); + return -EINVAL; + } + return crypto_aead_setauthsize(aeadctx->sw_cipher, authsize); +@@ -3289,8 +3282,7 @@ static int chcr_ccm_common_setkey(struct crypto_aead *aead, + ck_size = CHCR_KEYCTX_CIPHER_KEY_SIZE_256; + mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_256; + } else { +- crypto_tfm_set_flags((struct crypto_tfm *)aead, +- CRYPTO_TFM_RES_BAD_KEY_LEN); ++ crypto_aead_set_flags(aead, CRYPTO_TFM_RES_BAD_KEY_LEN); + aeadctx->enckey_len = 0; + return -EINVAL; + } +@@ -3328,8 +3320,7 @@ static int chcr_aead_rfc4309_setkey(struct crypto_aead *aead, const u8 *key, + int error; + + if (keylen < 3) { +- crypto_tfm_set_flags((struct crypto_tfm *)aead, +- CRYPTO_TFM_RES_BAD_KEY_LEN); ++ crypto_aead_set_flags(aead, CRYPTO_TFM_RES_BAD_KEY_LEN); + aeadctx->enckey_len = 0; + return -EINVAL; + } +@@ -3379,8 +3370,7 @@ static int chcr_gcm_setkey(struct crypto_aead *aead, const u8 *key, + } else if (keylen == AES_KEYSIZE_256) { + ck_size = CHCR_KEYCTX_CIPHER_KEY_SIZE_256; + } else { +- crypto_tfm_set_flags((struct crypto_tfm *)aead, +- CRYPTO_TFM_RES_BAD_KEY_LEN); ++ crypto_aead_set_flags(aead, CRYPTO_TFM_RES_BAD_KEY_LEN); + pr_err("GCM: Invalid key length %d\n", keylen); + ret = -EINVAL; + goto out; +diff --git a/drivers/crypto/vmx/aes_xts.c b/drivers/crypto/vmx/aes_xts.c +index d59e736882f6..9fee1b1532a4 100644 +--- a/drivers/crypto/vmx/aes_xts.c ++++ b/drivers/crypto/vmx/aes_xts.c +@@ -84,6 +84,9 @@ static int p8_aes_xts_crypt(struct skcipher_request *req, int enc) + u8 tweak[AES_BLOCK_SIZE]; + int ret; + ++ if (req->cryptlen < AES_BLOCK_SIZE) ++ return -EINVAL; ++ + if (!crypto_simd_usable() || (req->cryptlen % XTS_BLOCK_SIZE) != 0) { + struct skcipher_request *subreq = skcipher_request_ctx(req); + +diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c +index 9d32150e68db..771f6f4cf92e 100644 +--- a/drivers/extcon/extcon-intel-cht-wc.c ++++ b/drivers/extcon/extcon-intel-cht-wc.c +@@ -338,6 +338,7 @@ static int cht_wc_extcon_probe(struct platform_device *pdev) + struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent); + struct cht_wc_extcon_data *ext; + unsigned long mask = ~(CHT_WC_PWRSRC_VBUS | CHT_WC_PWRSRC_USBID_MASK); ++ int pwrsrc_sts, id; + int irq, ret; + + irq = platform_get_irq(pdev, 0); +@@ -387,8 +388,19 @@ static int cht_wc_extcon_probe(struct platform_device *pdev) + goto disable_sw_control; + } + +- /* Route D+ and D- to PMIC for initial charger detection */ +- cht_wc_extcon_set_phymux(ext, MUX_SEL_PMIC); ++ ret = regmap_read(ext->regmap, CHT_WC_PWRSRC_STS, &pwrsrc_sts); ++ if (ret) { ++ dev_err(ext->dev, "Error reading pwrsrc status: %d\n", ret); ++ goto disable_sw_control; ++ } ++ ++ /* ++ * If no USB host or device connected, route D+ and D- to PMIC for ++ * initial charger detection ++ */ ++ id = cht_wc_extcon_get_id(ext, pwrsrc_sts); ++ if (id != INTEL_USB_ID_GND) ++ cht_wc_extcon_set_phymux(ext, MUX_SEL_PMIC); + + /* Get initial state */ + cht_wc_extcon_pwrsrc_event(ext); +diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig +index ceb908f7dbe5..f9263426af03 100644 +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -1120,6 +1120,7 @@ config GPIO_MADERA + config GPIO_MAX77620 + tristate "GPIO support for PMIC MAX77620 and MAX20024" + depends on MFD_MAX77620 ++ select GPIOLIB_IRQCHIP + help + GPIO driver for MAX77620 and MAX20024 PMIC from Maxim Semiconductor. + MAX77620 PMIC has 8 pins that can be configured as GPIOs. The +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +index 33a1099e2f33..bb9a2771a0f9 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +@@ -1023,6 +1023,7 @@ static const struct pci_device_id pciidlist[] = { + + /* Navi12 */ + {0x1002, 0x7360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12|AMD_EXP_HW_SUPPORT}, ++ {0x1002, 0x7362, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12|AMD_EXP_HW_SUPPORT}, + + {0, 0, 0} + }; +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 4e9c15c409ba..360c87ba4595 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -3266,27 +3266,21 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing) + return color_space; + } + +-static void reduce_mode_colour_depth(struct dc_crtc_timing *timing_out) +-{ +- if (timing_out->display_color_depth <= COLOR_DEPTH_888) +- return; +- +- timing_out->display_color_depth--; +-} +- +-static void adjust_colour_depth_from_display_info(struct dc_crtc_timing *timing_out, +- const struct drm_display_info *info) ++static bool adjust_colour_depth_from_display_info( ++ struct dc_crtc_timing *timing_out, ++ const struct drm_display_info *info) + { ++ enum dc_color_depth depth = timing_out->display_color_depth; + int normalized_clk; +- if (timing_out->display_color_depth <= COLOR_DEPTH_888) +- return; + do { + normalized_clk = timing_out->pix_clk_100hz / 10; + /* YCbCr 4:2:0 requires additional adjustment of 1/2 */ + if (timing_out->pixel_encoding == PIXEL_ENCODING_YCBCR420) + normalized_clk /= 2; + /* Adjusting pix clock following on HDMI spec based on colour depth */ +- switch (timing_out->display_color_depth) { ++ switch (depth) { ++ case COLOR_DEPTH_888: ++ break; + case COLOR_DEPTH_101010: + normalized_clk = (normalized_clk * 30) / 24; + break; +@@ -3297,14 +3291,15 @@ static void adjust_colour_depth_from_display_info(struct dc_crtc_timing *timing_ + normalized_clk = (normalized_clk * 48) / 24; + break; + default: +- return; ++ /* The above depths are the only ones valid for HDMI. */ ++ return false; + } +- if (normalized_clk <= info->max_tmds_clock) +- return; +- reduce_mode_colour_depth(timing_out); +- +- } while (timing_out->display_color_depth > COLOR_DEPTH_888); +- ++ if (normalized_clk <= info->max_tmds_clock) { ++ timing_out->display_color_depth = depth; ++ return true; ++ } ++ } while (--depth > COLOR_DEPTH_666); ++ return false; + } + + static void fill_stream_properties_from_drm_display_mode( +@@ -3370,8 +3365,14 @@ static void fill_stream_properties_from_drm_display_mode( + + stream->out_transfer_func->type = TF_TYPE_PREDEFINED; + stream->out_transfer_func->tf = TRANSFER_FUNCTION_SRGB; +- if (stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) +- adjust_colour_depth_from_display_info(timing_out, info); ++ if (stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) { ++ if (!adjust_colour_depth_from_display_info(timing_out, info) && ++ drm_mode_is_420_also(info, mode_in) && ++ timing_out->pixel_encoding != PIXEL_ENCODING_YCBCR420) { ++ timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR420; ++ adjust_colour_depth_from_display_info(timing_out, info); ++ } ++ } + } + + static void fill_audio_info(struct audio_info *audio_info, +diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c +index 8063b1d567b1..e6e4c841fb06 100644 +--- a/drivers/hid/hid-asus.c ++++ b/drivers/hid/hid-asus.c +@@ -261,7 +261,8 @@ static int asus_event(struct hid_device *hdev, struct hid_field *field, + struct hid_usage *usage, __s32 value) + { + if ((usage->hid & HID_USAGE_PAGE) == 0xff310000 && +- (usage->hid & HID_USAGE) != 0x00 && !usage->type) { ++ (usage->hid & HID_USAGE) != 0x00 && ++ (usage->hid & HID_USAGE) != 0xff && !usage->type) { + hid_warn(hdev, "Unmapped Asus vendor usagepage code 0x%02x\n", + usage->hid & HID_USAGE); + } +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h +index 6273e7178e78..5fc82029a03b 100644 +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -631,6 +631,7 @@ + #define USB_VENDOR_ID_ITE 0x048d + #define USB_DEVICE_ID_ITE_LENOVO_YOGA 0x8386 + #define USB_DEVICE_ID_ITE_LENOVO_YOGA2 0x8350 ++#define I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720 0x837a + #define USB_DEVICE_ID_ITE_LENOVO_YOGA900 0x8396 + #define USB_DEVICE_ID_ITE8595 0x8595 + +@@ -730,6 +731,7 @@ + #define USB_DEVICE_ID_LG_MULTITOUCH 0x0064 + #define USB_DEVICE_ID_LG_MELFAS_MT 0x6007 + #define I2C_DEVICE_ID_LG_8001 0x8001 ++#define I2C_DEVICE_ID_LG_7010 0x7010 + + #define USB_VENDOR_ID_LOGITECH 0x046d + #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e +@@ -1098,6 +1100,7 @@ + #define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10 + #define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3 + #define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3 ++#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968 + #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710 + #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7 + +diff --git a/drivers/hid/hid-ite.c b/drivers/hid/hid-ite.c +index a45f2352618d..c436e12feb23 100644 +--- a/drivers/hid/hid-ite.c ++++ b/drivers/hid/hid-ite.c +@@ -40,6 +40,9 @@ static int ite_event(struct hid_device *hdev, struct hid_field *field, + static const struct hid_device_id ite_devices[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE8595) }, + { HID_USB_DEVICE(USB_VENDOR_ID_258A, USB_DEVICE_ID_258A_6A88) }, ++ /* ITE8595 USB kbd ctlr, with Synaptics touchpad connected to it. */ ++ { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, ++ USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012) }, + { } + }; + MODULE_DEVICE_TABLE(hid, ite_devices); +diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c +index 3cfeb1629f79..362805ddf377 100644 +--- a/drivers/hid/hid-multitouch.c ++++ b/drivers/hid/hid-multitouch.c +@@ -1019,7 +1019,7 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input, + tool = MT_TOOL_DIAL; + else if (unlikely(!confidence_state)) { + tool = MT_TOOL_PALM; +- if (!active && ++ if (!active && mt && + input_mt_is_active(&mt->slots[slotnum])) { + /* + * The non-confidence was reported for +@@ -1985,6 +1985,9 @@ static const struct hid_device_id mt_devices[] = { + { .driver_data = MT_CLS_LG, + HID_USB_DEVICE(USB_VENDOR_ID_LG, + USB_DEVICE_ID_LG_MELFAS_MT) }, ++ { .driver_data = MT_CLS_LG, ++ HID_DEVICE(BUS_I2C, HID_GROUP_GENERIC, ++ USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_7010) }, + + /* MosArt panels */ + { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c +index 9a35af1e2662..fa58a7cbb3ff 100644 +--- a/drivers/hid/hid-quirks.c ++++ b/drivers/hid/hid-quirks.c +@@ -174,6 +174,7 @@ static const struct hid_device_id hid_quirks[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET), HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, ++ { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE), HID_QUIRK_MULTI_INPUT }, + + { 0 } + }; +diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c +index 8dae0f9b819e..6286204d4c56 100644 +--- a/drivers/hid/hid-steam.c ++++ b/drivers/hid/hid-steam.c +@@ -768,8 +768,12 @@ static int steam_probe(struct hid_device *hdev, + + if (steam->quirks & STEAM_QUIRK_WIRELESS) { + hid_info(hdev, "Steam wireless receiver connected"); ++ /* If using a wireless adaptor ask for connection status */ ++ steam->connected = false; + steam_request_conn_status(steam); + } else { ++ /* A wired connection is always present */ ++ steam->connected = true; + ret = steam_register(steam); + if (ret) { + hid_err(hdev, +diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c +index ac44bf752ff1..479934f7d241 100644 +--- a/drivers/hid/i2c-hid/i2c-hid-core.c ++++ b/drivers/hid/i2c-hid/i2c-hid-core.c +@@ -49,6 +49,8 @@ + #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1) + #define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) + #define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5) ++#define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(6) ++ + + /* flags */ + #define I2C_HID_STARTED 0 +@@ -177,6 +179,8 @@ static const struct i2c_hid_quirks { + I2C_HID_QUIRK_BOGUS_IRQ }, + { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID, + I2C_HID_QUIRK_RESET_ON_RESUME }, ++ { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720, ++ I2C_HID_QUIRK_BAD_INPUT_SIZE }, + { 0, 0 } + }; + +@@ -498,9 +502,15 @@ static void i2c_hid_get_input(struct i2c_hid *ihid) + } + + if ((ret_size > size) || (ret_size < 2)) { +- dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n", +- __func__, size, ret_size); +- return; ++ if (ihid->quirks & I2C_HID_QUIRK_BAD_INPUT_SIZE) { ++ ihid->inbuf[0] = size & 0xff; ++ ihid->inbuf[1] = size >> 8; ++ ret_size = size; ++ } else { ++ dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n", ++ __func__, size, ret_size); ++ return; ++ } + } + + i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf); +diff --git a/drivers/hid/intel-ish-hid/ipc/hw-ish.h b/drivers/hid/intel-ish-hid/ipc/hw-ish.h +index 6c1e6110867f..1fb294ca463e 100644 +--- a/drivers/hid/intel-ish-hid/ipc/hw-ish.h ++++ b/drivers/hid/intel-ish-hid/ipc/hw-ish.h +@@ -24,7 +24,9 @@ + #define ICL_MOBILE_DEVICE_ID 0x34FC + #define SPT_H_DEVICE_ID 0xA135 + #define CML_LP_DEVICE_ID 0x02FC ++#define CMP_H_DEVICE_ID 0x06FC + #define EHL_Ax_DEVICE_ID 0x4BB3 ++#define TGL_LP_DEVICE_ID 0xA0FC + + #define REVISION_ID_CHT_A0 0x6 + #define REVISION_ID_CHT_Ax_SI 0x0 +diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c +index 784dcc8c7022..f491d8b4e24c 100644 +--- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c ++++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c +@@ -34,7 +34,9 @@ static const struct pci_device_id ish_pci_tbl[] = { + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, ICL_MOBILE_DEVICE_ID)}, + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, SPT_H_DEVICE_ID)}, + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CML_LP_DEVICE_ID)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CMP_H_DEVICE_ID)}, + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, EHL_Ax_DEVICE_ID)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, TGL_LP_DEVICE_ID)}, + {0, } + }; + MODULE_DEVICE_TABLE(pci, ish_pci_tbl); +diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c +index ccb74529bc78..d99a9d407671 100644 +--- a/drivers/hid/wacom_wac.c ++++ b/drivers/hid/wacom_wac.c +@@ -2096,14 +2096,16 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field + (hdev->product == 0x34d || hdev->product == 0x34e || /* MobileStudio Pro */ + hdev->product == 0x357 || hdev->product == 0x358 || /* Intuos Pro 2 */ + hdev->product == 0x392 || /* Intuos Pro 2 */ +- hdev->product == 0x398 || hdev->product == 0x399)) { /* MobileStudio Pro */ ++ hdev->product == 0x398 || hdev->product == 0x399 || /* MobileStudio Pro */ ++ hdev->product == 0x3AA)) { /* MobileStudio Pro */ + value = (field->logical_maximum - value); + + if (hdev->product == 0x357 || hdev->product == 0x358 || + hdev->product == 0x392) + value = wacom_offset_rotation(input, usage, value, 3, 16); + else if (hdev->product == 0x34d || hdev->product == 0x34e || +- hdev->product == 0x398 || hdev->product == 0x399) ++ hdev->product == 0x398 || hdev->product == 0x399 || ++ hdev->product == 0x3AA) + value = wacom_offset_rotation(input, usage, value, 1, 2); + } + else { +diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c +index e493242c266e..0339ecdd06bd 100644 +--- a/drivers/iio/adc/stm32-dfsdm-adc.c ++++ b/drivers/iio/adc/stm32-dfsdm-adc.c +@@ -1204,6 +1204,8 @@ static int stm32_dfsdm_single_conv(struct iio_dev *indio_dev, + + stm32_dfsdm_stop_conv(adc); + ++ stm32_dfsdm_process_data(adc, res); ++ + stop_dfsdm: + stm32_dfsdm_stop_dfsdm(adc->dfsdm); + +diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c +index c0acbb5d2ffb..b21f72dd473c 100644 +--- a/drivers/iio/gyro/st_gyro_core.c ++++ b/drivers/iio/gyro/st_gyro_core.c +@@ -139,7 +139,6 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = { + [2] = LSM330DLC_GYRO_DEV_NAME, + [3] = L3G4IS_GYRO_DEV_NAME, + [4] = LSM330_GYRO_DEV_NAME, +- [5] = LSM9DS0_GYRO_DEV_NAME, + }, + .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, + .odr = { +@@ -209,6 +208,80 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = { + .multi_read_bit = true, + .bootime = 2, + }, ++ { ++ .wai = 0xd4, ++ .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, ++ .sensors_supported = { ++ [0] = LSM9DS0_GYRO_DEV_NAME, ++ }, ++ .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, ++ .odr = { ++ .addr = 0x20, ++ .mask = GENMASK(7, 6), ++ .odr_avl = { ++ { .hz = 95, .value = 0x00, }, ++ { .hz = 190, .value = 0x01, }, ++ { .hz = 380, .value = 0x02, }, ++ { .hz = 760, .value = 0x03, }, ++ }, ++ }, ++ .pw = { ++ .addr = 0x20, ++ .mask = BIT(3), ++ .value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE, ++ .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, ++ }, ++ .enable_axis = { ++ .addr = ST_SENSORS_DEFAULT_AXIS_ADDR, ++ .mask = ST_SENSORS_DEFAULT_AXIS_MASK, ++ }, ++ .fs = { ++ .addr = 0x23, ++ .mask = GENMASK(5, 4), ++ .fs_avl = { ++ [0] = { ++ .num = ST_GYRO_FS_AVL_245DPS, ++ .value = 0x00, ++ .gain = IIO_DEGREE_TO_RAD(8750), ++ }, ++ [1] = { ++ .num = ST_GYRO_FS_AVL_500DPS, ++ .value = 0x01, ++ .gain = IIO_DEGREE_TO_RAD(17500), ++ }, ++ [2] = { ++ .num = ST_GYRO_FS_AVL_2000DPS, ++ .value = 0x02, ++ .gain = IIO_DEGREE_TO_RAD(70000), ++ }, ++ }, ++ }, ++ .bdu = { ++ .addr = 0x23, ++ .mask = BIT(7), ++ }, ++ .drdy_irq = { ++ .int2 = { ++ .addr = 0x22, ++ .mask = BIT(3), ++ }, ++ /* ++ * The sensor has IHL (active low) and open ++ * drain settings, but only for INT1 and not ++ * for the DRDY line on INT2. ++ */ ++ .stat_drdy = { ++ .addr = ST_SENSORS_DEFAULT_STAT_ADDR, ++ .mask = GENMASK(2, 0), ++ }, ++ }, ++ .sim = { ++ .addr = 0x23, ++ .value = BIT(0), ++ }, ++ .multi_read_bit = true, ++ .bootime = 2, ++ }, + { + .wai = 0xd7, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, +diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c +index dd555078258c..454695b372c8 100644 +--- a/drivers/iommu/amd_iommu.c ++++ b/drivers/iommu/amd_iommu.c +@@ -226,71 +226,61 @@ static struct iommu_dev_data *search_dev_data(u16 devid) + return NULL; + } + +-static int __last_alias(struct pci_dev *pdev, u16 alias, void *data) ++static int clone_alias(struct pci_dev *pdev, u16 alias, void *data) + { +- *(u16 *)data = alias; +- return 0; +-} +- +-static u16 get_alias(struct device *dev) +-{ +- struct pci_dev *pdev = to_pci_dev(dev); +- u16 devid, ivrs_alias, pci_alias; +- +- /* The callers make sure that get_device_id() does not fail here */ +- devid = get_device_id(dev); ++ u16 devid = pci_dev_id(pdev); + +- /* For ACPI HID devices, we simply return the devid as such */ +- if (!dev_is_pci(dev)) +- return devid; ++ if (devid == alias) ++ return 0; + +- ivrs_alias = amd_iommu_alias_table[devid]; ++ amd_iommu_rlookup_table[alias] = ++ amd_iommu_rlookup_table[devid]; ++ memcpy(amd_iommu_dev_table[alias].data, ++ amd_iommu_dev_table[devid].data, ++ sizeof(amd_iommu_dev_table[alias].data)); + +- pci_for_each_dma_alias(pdev, __last_alias, &pci_alias); ++ return 0; ++} + +- if (ivrs_alias == pci_alias) +- return ivrs_alias; ++static void clone_aliases(struct pci_dev *pdev) ++{ ++ if (!pdev) ++ return; + + /* +- * DMA alias showdown +- * +- * The IVRS is fairly reliable in telling us about aliases, but it +- * can't know about every screwy device. If we don't have an IVRS +- * reported alias, use the PCI reported alias. In that case we may +- * still need to initialize the rlookup and dev_table entries if the +- * alias is to a non-existent device. ++ * The IVRS alias stored in the alias table may not be ++ * part of the PCI DMA aliases if it's bus differs ++ * from the original device. + */ +- if (ivrs_alias == devid) { +- if (!amd_iommu_rlookup_table[pci_alias]) { +- amd_iommu_rlookup_table[pci_alias] = +- amd_iommu_rlookup_table[devid]; +- memcpy(amd_iommu_dev_table[pci_alias].data, +- amd_iommu_dev_table[devid].data, +- sizeof(amd_iommu_dev_table[pci_alias].data)); +- } ++ clone_alias(pdev, amd_iommu_alias_table[pci_dev_id(pdev)], NULL); + +- return pci_alias; +- } ++ pci_for_each_dma_alias(pdev, clone_alias, NULL); ++} + +- pci_info(pdev, "Using IVRS reported alias %02x:%02x.%d " +- "for device [%04x:%04x], kernel reported alias " +- "%02x:%02x.%d\n", PCI_BUS_NUM(ivrs_alias), PCI_SLOT(ivrs_alias), +- PCI_FUNC(ivrs_alias), pdev->vendor, pdev->device, +- PCI_BUS_NUM(pci_alias), PCI_SLOT(pci_alias), +- PCI_FUNC(pci_alias)); ++static struct pci_dev *setup_aliases(struct device *dev) ++{ ++ struct pci_dev *pdev = to_pci_dev(dev); ++ u16 ivrs_alias; ++ ++ /* For ACPI HID devices, there are no aliases */ ++ if (!dev_is_pci(dev)) ++ return NULL; + + /* +- * If we don't have a PCI DMA alias and the IVRS alias is on the same +- * bus, then the IVRS table may know about a quirk that we don't. ++ * Add the IVRS alias to the pci aliases if it is on the same ++ * bus. The IVRS table may know about a quirk that we don't. + */ +- if (pci_alias == devid && ++ ivrs_alias = amd_iommu_alias_table[pci_dev_id(pdev)]; ++ if (ivrs_alias != pci_dev_id(pdev) && + PCI_BUS_NUM(ivrs_alias) == pdev->bus->number) { + pci_add_dma_alias(pdev, ivrs_alias & 0xff); + pci_info(pdev, "Added PCI DMA alias %02x.%d\n", + PCI_SLOT(ivrs_alias), PCI_FUNC(ivrs_alias)); + } + +- return ivrs_alias; ++ clone_aliases(pdev); ++ ++ return pdev; + } + + static struct iommu_dev_data *find_dev_data(u16 devid) +@@ -428,7 +418,7 @@ static int iommu_init_device(struct device *dev) + if (!dev_data) + return -ENOMEM; + +- dev_data->alias = get_alias(dev); ++ dev_data->pdev = setup_aliases(dev); + + /* + * By default we use passthrough mode for IOMMUv2 capable device. +@@ -453,20 +443,16 @@ static int iommu_init_device(struct device *dev) + + static void iommu_ignore_device(struct device *dev) + { +- u16 alias; + int devid; + + devid = get_device_id(dev); + if (devid < 0) + return; + +- alias = get_alias(dev); +- ++ amd_iommu_rlookup_table[devid] = NULL; + memset(&amd_iommu_dev_table[devid], 0, sizeof(struct dev_table_entry)); +- memset(&amd_iommu_dev_table[alias], 0, sizeof(struct dev_table_entry)); + +- amd_iommu_rlookup_table[devid] = NULL; +- amd_iommu_rlookup_table[alias] = NULL; ++ setup_aliases(dev); + } + + static void iommu_uninit_device(struct device *dev) +@@ -1236,6 +1222,13 @@ static int device_flush_iotlb(struct iommu_dev_data *dev_data, + return iommu_queue_command(iommu, &cmd); + } + ++static int device_flush_dte_alias(struct pci_dev *pdev, u16 alias, void *data) ++{ ++ struct amd_iommu *iommu = data; ++ ++ return iommu_flush_dte(iommu, alias); ++} ++ + /* + * Command send function for invalidating a device table entry + */ +@@ -1246,14 +1239,22 @@ static int device_flush_dte(struct iommu_dev_data *dev_data) + int ret; + + iommu = amd_iommu_rlookup_table[dev_data->devid]; +- alias = dev_data->alias; + +- ret = iommu_flush_dte(iommu, dev_data->devid); +- if (!ret && alias != dev_data->devid) +- ret = iommu_flush_dte(iommu, alias); ++ if (dev_data->pdev) ++ ret = pci_for_each_dma_alias(dev_data->pdev, ++ device_flush_dte_alias, iommu); ++ else ++ ret = iommu_flush_dte(iommu, dev_data->devid); + if (ret) + return ret; + ++ alias = amd_iommu_alias_table[dev_data->devid]; ++ if (alias != dev_data->devid) { ++ ret = iommu_flush_dte(iommu, alias); ++ if (ret) ++ return ret; ++ } ++ + if (dev_data->ats.enabled) + ret = device_flush_iotlb(dev_data, 0, ~0UL); + +@@ -2035,11 +2036,9 @@ static void do_attach(struct iommu_dev_data *dev_data, + struct protection_domain *domain) + { + struct amd_iommu *iommu; +- u16 alias; + bool ats; + + iommu = amd_iommu_rlookup_table[dev_data->devid]; +- alias = dev_data->alias; + ats = dev_data->ats.enabled; + + /* Update data structures */ +@@ -2052,8 +2051,7 @@ static void do_attach(struct iommu_dev_data *dev_data, + + /* Update device table */ + set_dte_entry(dev_data->devid, domain, ats, dev_data->iommu_v2); +- if (alias != dev_data->devid) +- set_dte_entry(alias, domain, ats, dev_data->iommu_v2); ++ clone_aliases(dev_data->pdev); + + device_flush_dte(dev_data); + } +@@ -2062,17 +2060,14 @@ static void do_detach(struct iommu_dev_data *dev_data) + { + struct protection_domain *domain = dev_data->domain; + struct amd_iommu *iommu; +- u16 alias; + + iommu = amd_iommu_rlookup_table[dev_data->devid]; +- alias = dev_data->alias; + + /* Update data structures */ + dev_data->domain = NULL; + list_del(&dev_data->list); + clear_dte_entry(dev_data->devid); +- if (alias != dev_data->devid) +- clear_dte_entry(alias); ++ clone_aliases(dev_data->pdev); + + /* Flush the DTE entry */ + device_flush_dte(dev_data); +@@ -2384,13 +2379,7 @@ static void update_device_table(struct protection_domain *domain) + list_for_each_entry(dev_data, &domain->dev_list, list) { + set_dte_entry(dev_data->devid, domain, dev_data->ats.enabled, + dev_data->iommu_v2); +- +- if (dev_data->devid == dev_data->alias) +- continue; +- +- /* There is an alias, update device table entry for it */ +- set_dte_entry(dev_data->alias, domain, dev_data->ats.enabled, +- dev_data->iommu_v2); ++ clone_aliases(dev_data->pdev); + } + } + +@@ -3752,7 +3741,20 @@ static void set_remap_table_entry(struct amd_iommu *iommu, u16 devid, + iommu_flush_dte(iommu, devid); + } + +-static struct irq_remap_table *alloc_irq_table(u16 devid) ++static int set_remap_table_entry_alias(struct pci_dev *pdev, u16 alias, ++ void *data) ++{ ++ struct irq_remap_table *table = data; ++ ++ irq_lookup_table[alias] = table; ++ set_dte_irq_entry(alias, table); ++ ++ iommu_flush_dte(amd_iommu_rlookup_table[alias], alias); ++ ++ return 0; ++} ++ ++static struct irq_remap_table *alloc_irq_table(u16 devid, struct pci_dev *pdev) + { + struct irq_remap_table *table = NULL; + struct irq_remap_table *new_table = NULL; +@@ -3798,7 +3800,12 @@ static struct irq_remap_table *alloc_irq_table(u16 devid) + table = new_table; + new_table = NULL; + +- set_remap_table_entry(iommu, devid, table); ++ if (pdev) ++ pci_for_each_dma_alias(pdev, set_remap_table_entry_alias, ++ table); ++ else ++ set_remap_table_entry(iommu, devid, table); ++ + if (devid != alias) + set_remap_table_entry(iommu, alias, table); + +@@ -3815,7 +3822,8 @@ out_unlock: + return table; + } + +-static int alloc_irq_index(u16 devid, int count, bool align) ++static int alloc_irq_index(u16 devid, int count, bool align, ++ struct pci_dev *pdev) + { + struct irq_remap_table *table; + int index, c, alignment = 1; +@@ -3825,7 +3833,7 @@ static int alloc_irq_index(u16 devid, int count, bool align) + if (!iommu) + return -ENODEV; + +- table = alloc_irq_table(devid); ++ table = alloc_irq_table(devid, pdev); + if (!table) + return -ENODEV; + +@@ -4258,7 +4266,7 @@ static int irq_remapping_alloc(struct irq_domain *domain, unsigned int virq, + struct irq_remap_table *table; + struct amd_iommu *iommu; + +- table = alloc_irq_table(devid); ++ table = alloc_irq_table(devid, NULL); + if (table) { + if (!table->min_index) { + /* +@@ -4275,11 +4283,15 @@ static int irq_remapping_alloc(struct irq_domain *domain, unsigned int virq, + } else { + index = -ENOMEM; + } +- } else { ++ } else if (info->type == X86_IRQ_ALLOC_TYPE_MSI || ++ info->type == X86_IRQ_ALLOC_TYPE_MSIX) { + bool align = (info->type == X86_IRQ_ALLOC_TYPE_MSI); + +- index = alloc_irq_index(devid, nr_irqs, align); ++ index = alloc_irq_index(devid, nr_irqs, align, info->msi_dev); ++ } else { ++ index = alloc_irq_index(devid, nr_irqs, false, NULL); + } ++ + if (index < 0) { + pr_warn("Failed to allocate IRTE\n"); + ret = index; +diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h +index 17bd5a349119..fc956479b94e 100644 +--- a/drivers/iommu/amd_iommu_types.h ++++ b/drivers/iommu/amd_iommu_types.h +@@ -639,8 +639,8 @@ struct iommu_dev_data { + struct list_head list; /* For domain->dev_list */ + struct llist_node dev_data_list; /* For global dev_data_list */ + struct protection_domain *domain; /* Domain the device is bound to */ ++ struct pci_dev *pdev; + u16 devid; /* PCI Device ID */ +- u16 alias; /* Alias Device ID */ + bool iommu_v2; /* Device can make use of IOMMUv2 */ + bool passthrough; /* Device is identity mapped */ + struct { +diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c +index 51456e7f264f..c68a1f072c31 100644 +--- a/drivers/iommu/dma-iommu.c ++++ b/drivers/iommu/dma-iommu.c +@@ -1177,7 +1177,6 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr) + { + struct device *dev = msi_desc_to_dev(desc); + struct iommu_domain *domain = iommu_get_domain_for_dev(dev); +- struct iommu_dma_cookie *cookie; + struct iommu_dma_msi_page *msi_page; + static DEFINE_MUTEX(msi_prepare_lock); /* see below */ + +@@ -1186,8 +1185,6 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr) + return 0; + } + +- cookie = domain->iova_cookie; +- + /* + * In fact the whole prepare operation should already be serialised by + * irq_domain_mutex further up the callchain, but that's pretty subtle +diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c +index 617a306f6815..dc380c0c9536 100644 +--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c ++++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c +@@ -792,6 +792,9 @@ static const struct usb_device_id dvbsky_id_table[] = { + { DVB_USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230C, + &mygica_t230c_props, "MyGica Mini DVB-T2 USB Stick T230C", + RC_MAP_TOTAL_MEDIA_IN_HAND_02) }, ++ { DVB_USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230C_LITE, ++ &mygica_t230c_props, "MyGica Mini DVB-T2 USB Stick T230C Lite", ++ NULL) }, + { DVB_USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230C2, + &mygica_t230c_props, "MyGica Mini DVB-T2 USB Stick T230C v2", + RC_MAP_TOTAL_MEDIA_IN_HAND_02) }, +diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c +index 1767f30a1676..b33030e3385c 100644 +--- a/drivers/mfd/intel-lpss-pci.c ++++ b/drivers/mfd/intel-lpss-pci.c +@@ -140,7 +140,7 @@ static const struct intel_lpss_platform_info cnl_i2c_info = { + }; + + static const struct pci_device_id intel_lpss_pci_ids[] = { +- /* CML */ ++ /* CML-LP */ + { PCI_VDEVICE(INTEL, 0x02a8), (kernel_ulong_t)&spt_uart_info }, + { PCI_VDEVICE(INTEL, 0x02a9), (kernel_ulong_t)&spt_uart_info }, + { PCI_VDEVICE(INTEL, 0x02aa), (kernel_ulong_t)&spt_info }, +@@ -153,6 +153,17 @@ static const struct pci_device_id intel_lpss_pci_ids[] = { + { PCI_VDEVICE(INTEL, 0x02ea), (kernel_ulong_t)&cnl_i2c_info }, + { PCI_VDEVICE(INTEL, 0x02eb), (kernel_ulong_t)&cnl_i2c_info }, + { PCI_VDEVICE(INTEL, 0x02fb), (kernel_ulong_t)&spt_info }, ++ /* CML-H */ ++ { PCI_VDEVICE(INTEL, 0x06a8), (kernel_ulong_t)&spt_uart_info }, ++ { PCI_VDEVICE(INTEL, 0x06a9), (kernel_ulong_t)&spt_uart_info }, ++ { PCI_VDEVICE(INTEL, 0x06aa), (kernel_ulong_t)&spt_info }, ++ { PCI_VDEVICE(INTEL, 0x06ab), (kernel_ulong_t)&spt_info }, ++ { PCI_VDEVICE(INTEL, 0x06c7), (kernel_ulong_t)&spt_uart_info }, ++ { PCI_VDEVICE(INTEL, 0x06e8), (kernel_ulong_t)&cnl_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x06e9), (kernel_ulong_t)&cnl_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x06ea), (kernel_ulong_t)&cnl_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x06eb), (kernel_ulong_t)&cnl_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x06fb), (kernel_ulong_t)&spt_info }, + /* BXT A-Step */ + { PCI_VDEVICE(INTEL, 0x0aac), (kernel_ulong_t)&bxt_i2c_info }, + { PCI_VDEVICE(INTEL, 0x0aae), (kernel_ulong_t)&bxt_i2c_info }, +diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c +index c681f6fab342..a9793ea6933b 100644 +--- a/drivers/misc/mei/hdcp/mei_hdcp.c ++++ b/drivers/misc/mei/hdcp/mei_hdcp.c +@@ -758,11 +758,38 @@ static const struct component_master_ops mei_component_master_ops = { + .unbind = mei_component_master_unbind, + }; + ++/** ++ * mei_hdcp_component_match - compare function for matching mei hdcp. ++ * ++ * The function checks if the driver is i915, the subcomponent is HDCP ++ * and the grand parent of hdcp and the parent of i915 are the same ++ * PCH device. ++ * ++ * @dev: master device ++ * @subcomponent: subcomponent to match (I915_COMPONENT_HDCP) ++ * @data: compare data (mei hdcp device) ++ * ++ * Return: ++ * * 1 - if components match ++ * * 0 - otherwise ++ */ + static int mei_hdcp_component_match(struct device *dev, int subcomponent, + void *data) + { +- return !strcmp(dev->driver->name, "i915") && +- subcomponent == I915_COMPONENT_HDCP; ++ struct device *base = data; ++ ++ if (strcmp(dev->driver->name, "i915") || ++ subcomponent != I915_COMPONENT_HDCP) ++ return 0; ++ ++ base = base->parent; ++ if (!base) ++ return 0; ++ ++ base = base->parent; ++ dev = dev->parent; ++ ++ return (base && dev && dev == base); + } + + static int mei_hdcp_probe(struct mei_cl_device *cldev, +@@ -786,7 +813,7 @@ static int mei_hdcp_probe(struct mei_cl_device *cldev, + + master_match = NULL; + component_match_add_typed(&cldev->dev, &master_match, +- mei_hdcp_component_match, comp_master); ++ mei_hdcp_component_match, &cldev->dev); + if (IS_ERR_OR_NULL(master_match)) { + ret = -ENOMEM; + goto err_exit; +diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h +index b359f06f05e7..69d9b1736bf9 100644 +--- a/drivers/misc/mei/hw-me-regs.h ++++ b/drivers/misc/mei/hw-me-regs.h +@@ -81,8 +81,12 @@ + + #define MEI_DEV_ID_CMP_LP 0x02e0 /* Comet Point LP */ + #define MEI_DEV_ID_CMP_LP_3 0x02e4 /* Comet Point LP 3 (iTouch) */ ++ + #define MEI_DEV_ID_CMP_V 0xA3BA /* Comet Point Lake V */ + ++#define MEI_DEV_ID_CMP_H 0x06e0 /* Comet Lake H */ ++#define MEI_DEV_ID_CMP_H_3 0x06e4 /* Comet Lake H 3 (iTouch) */ ++ + #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */ + + #define MEI_DEV_ID_TGP_LP 0xA0E0 /* Tiger Lake Point LP */ +diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c +index ce43415a536c..309cb8a23381 100644 +--- a/drivers/misc/mei/pci-me.c ++++ b/drivers/misc/mei/pci-me.c +@@ -99,6 +99,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = { + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP, MEI_ME_PCH12_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP_3, MEI_ME_PCH8_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_V, MEI_ME_PCH12_CFG)}, ++ {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_H, MEI_ME_PCH12_CFG)}, ++ {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_H_3, MEI_ME_PCH8_CFG)}, + + {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)}, + +diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c +index 642a9667db4d..c9ea365c248c 100644 +--- a/drivers/mmc/host/sdhci-pci-core.c ++++ b/drivers/mmc/host/sdhci-pci-core.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1598,11 +1599,59 @@ static int amd_probe(struct sdhci_pci_chip *chip) + return 0; + } + ++static u32 sdhci_read_present_state(struct sdhci_host *host) ++{ ++ return sdhci_readl(host, SDHCI_PRESENT_STATE); ++} ++ ++void amd_sdhci_reset(struct sdhci_host *host, u8 mask) ++{ ++ struct sdhci_pci_slot *slot = sdhci_priv(host); ++ struct pci_dev *pdev = slot->chip->pdev; ++ u32 present_state; ++ ++ /* ++ * SDHC 0x7906 requires a hard reset to clear all internal state. ++ * Otherwise it can get into a bad state where the DATA lines are always ++ * read as zeros. ++ */ ++ if (pdev->device == 0x7906 && (mask & SDHCI_RESET_ALL)) { ++ pci_clear_master(pdev); ++ ++ pci_save_state(pdev); ++ ++ pci_set_power_state(pdev, PCI_D3cold); ++ pr_debug("%s: power_state=%u\n", mmc_hostname(host->mmc), ++ pdev->current_state); ++ pci_set_power_state(pdev, PCI_D0); ++ ++ pci_restore_state(pdev); ++ ++ /* ++ * SDHCI_RESET_ALL says the card detect logic should not be ++ * reset, but since we need to reset the entire controller ++ * we should wait until the card detect logic has stabilized. ++ * ++ * This normally takes about 40ms. ++ */ ++ readx_poll_timeout( ++ sdhci_read_present_state, ++ host, ++ present_state, ++ present_state & SDHCI_CD_STABLE, ++ 10000, ++ 100000 ++ ); ++ } ++ ++ return sdhci_reset(host, mask); ++} ++ + static const struct sdhci_ops amd_sdhci_pci_ops = { + .set_clock = sdhci_set_clock, + .enable_dma = sdhci_pci_enable_dma, + .set_bus_width = sdhci_set_bus_width, +- .reset = sdhci_reset, ++ .reset = amd_sdhci_reset, + .set_uhs_signaling = sdhci_set_uhs_signaling, + }; + +@@ -1681,6 +1730,8 @@ static const struct pci_device_id pci_ids[] = { + SDHCI_PCI_DEVICE(INTEL, CML_EMMC, intel_glk_emmc), + SDHCI_PCI_DEVICE(INTEL, CML_SD, intel_byt_sd), + SDHCI_PCI_DEVICE(INTEL, CMLH_SD, intel_byt_sd), ++ SDHCI_PCI_DEVICE(INTEL, JSL_EMMC, intel_glk_emmc), ++ SDHCI_PCI_DEVICE(INTEL, JSL_SD, intel_byt_sd), + SDHCI_PCI_DEVICE(O2, 8120, o2), + SDHCI_PCI_DEVICE(O2, 8220, o2), + SDHCI_PCI_DEVICE(O2, 8221, o2), +diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h +index 558202fe64c6..981bbbe63aff 100644 +--- a/drivers/mmc/host/sdhci-pci.h ++++ b/drivers/mmc/host/sdhci-pci.h +@@ -55,6 +55,8 @@ + #define PCI_DEVICE_ID_INTEL_CML_EMMC 0x02c4 + #define PCI_DEVICE_ID_INTEL_CML_SD 0x02f5 + #define PCI_DEVICE_ID_INTEL_CMLH_SD 0x06f5 ++#define PCI_DEVICE_ID_INTEL_JSL_EMMC 0x4dc4 ++#define PCI_DEVICE_ID_INTEL_JSL_SD 0x4df8 + + #define PCI_DEVICE_ID_SYSKONNECT_8000 0x8000 + #define PCI_DEVICE_ID_VIA_95D0 0x95d0 +diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c +index d797912e665a..b233756345f8 100644 +--- a/drivers/net/can/m_can/tcan4x5x.c ++++ b/drivers/net/can/m_can/tcan4x5x.c +@@ -164,6 +164,28 @@ static void tcan4x5x_check_wake(struct tcan4x5x_priv *priv) + } + } + ++static int tcan4x5x_reset(struct tcan4x5x_priv *priv) ++{ ++ int ret = 0; ++ ++ if (priv->reset_gpio) { ++ gpiod_set_value(priv->reset_gpio, 1); ++ ++ /* tpulse_width minimum 30us */ ++ usleep_range(30, 100); ++ gpiod_set_value(priv->reset_gpio, 0); ++ } else { ++ ret = regmap_write(priv->regmap, TCAN4X5X_CONFIG, ++ TCAN4X5X_SW_RESET); ++ if (ret) ++ return ret; ++ } ++ ++ usleep_range(700, 1000); ++ ++ return ret; ++} ++ + static int regmap_spi_gather_write(void *context, const void *reg, + size_t reg_len, const void *val, + size_t val_len) +@@ -341,6 +363,7 @@ static int tcan4x5x_init(struct m_can_classdev *cdev) + static int tcan4x5x_parse_config(struct m_can_classdev *cdev) + { + struct tcan4x5x_priv *tcan4x5x = cdev->device_data; ++ int ret; + + tcan4x5x->device_wake_gpio = devm_gpiod_get(cdev->dev, "device-wake", + GPIOD_OUT_HIGH); +@@ -354,7 +377,9 @@ static int tcan4x5x_parse_config(struct m_can_classdev *cdev) + if (IS_ERR(tcan4x5x->reset_gpio)) + tcan4x5x->reset_gpio = NULL; + +- usleep_range(700, 1000); ++ ret = tcan4x5x_reset(tcan4x5x); ++ if (ret) ++ return ret; + + tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev, + "device-state", +diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c +index 97ab0dd25552..1a7710c399d7 100644 +--- a/drivers/net/ethernet/broadcom/b44.c ++++ b/drivers/net/ethernet/broadcom/b44.c +@@ -1519,8 +1519,10 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset) + int ethaddr_bytes = ETH_ALEN; + + memset(ppattern + offset, 0xff, magicsync); +- for (j = 0; j < magicsync; j++) +- set_bit(len++, (unsigned long *) pmask); ++ for (j = 0; j < magicsync; j++) { ++ pmask[len >> 3] |= BIT(len & 7); ++ len++; ++ } + + for (j = 0; j < B44_MAX_PATTERNS; j++) { + if ((B44_PATTERN_SIZE - len) >= ETH_ALEN) +@@ -1532,7 +1534,8 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset) + for (k = 0; k< ethaddr_bytes; k++) { + ppattern[offset + magicsync + + (j * ETH_ALEN) + k] = macaddr[k]; +- set_bit(len++, (unsigned long *) pmask); ++ pmask[len >> 3] |= BIT(len & 7); ++ len++; + } + } + return len - 1; +diff --git a/drivers/net/ethernet/google/gve/gve_rx.c b/drivers/net/ethernet/google/gve/gve_rx.c +index edec61dfc868..9f52e72ff641 100644 +--- a/drivers/net/ethernet/google/gve/gve_rx.c ++++ b/drivers/net/ethernet/google/gve/gve_rx.c +@@ -418,8 +418,6 @@ bool gve_clean_rx_done(struct gve_rx_ring *rx, int budget, + rx->cnt = cnt; + rx->fill_cnt += work_done; + +- /* restock desc ring slots */ +- dma_wmb(); /* Ensure descs are visible before ringing doorbell */ + gve_rx_write_doorbell(priv, rx); + return gve_rx_work_pending(rx); + } +diff --git a/drivers/net/ethernet/google/gve/gve_tx.c b/drivers/net/ethernet/google/gve/gve_tx.c +index f4889431f9b7..d0244feb0301 100644 +--- a/drivers/net/ethernet/google/gve/gve_tx.c ++++ b/drivers/net/ethernet/google/gve/gve_tx.c +@@ -487,10 +487,6 @@ netdev_tx_t gve_tx(struct sk_buff *skb, struct net_device *dev) + * may have added descriptors without ringing the doorbell. + */ + +- /* Ensure tx descs from a prior gve_tx are visible before +- * ringing doorbell. +- */ +- dma_wmb(); + gve_tx_put_doorbell(priv, tx->q_resources, tx->req); + return NETDEV_TX_BUSY; + } +@@ -505,8 +501,6 @@ netdev_tx_t gve_tx(struct sk_buff *skb, struct net_device *dev) + if (!netif_xmit_stopped(tx->netdev_txq) && netdev_xmit_more()) + return NETDEV_TX_OK; + +- /* Ensure tx descs are visible before ringing doorbell */ +- dma_wmb(); + gve_tx_put_doorbell(priv, tx->q_resources, tx->req); + return NETDEV_TX_OK; + } +diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c +index 471b0ca6d69a..55dfba990e6e 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c +@@ -204,8 +204,8 @@ mlxsw_m_port_create(struct mlxsw_m *mlxsw_m, u8 local_port, u8 module) + + err_register_netdev: + mlxsw_m->ports[local_port] = NULL; +- free_netdev(dev); + err_dev_addr_get: ++ free_netdev(dev); + err_alloc_etherdev: + mlxsw_core_port_fini(mlxsw_m->core, local_port); + return err; +diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c +index 41ddd8fff2a7..8bd2912bf713 100644 +--- a/drivers/net/ethernet/socionext/netsec.c ++++ b/drivers/net/ethernet/socionext/netsec.c +@@ -928,7 +928,6 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget) + struct netsec_rx_pkt_info rx_info; + enum dma_data_direction dma_dir; + struct bpf_prog *xdp_prog; +- struct sk_buff *skb = NULL; + u16 xdp_xmit = 0; + u32 xdp_act = 0; + int done = 0; +@@ -942,7 +941,8 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget) + struct netsec_de *de = dring->vaddr + (DESC_SZ * idx); + struct netsec_desc *desc = &dring->desc[idx]; + struct page *page = virt_to_page(desc->addr); +- u32 xdp_result = XDP_PASS; ++ u32 xdp_result = NETSEC_XDP_PASS; ++ struct sk_buff *skb = NULL; + u16 pkt_len, desc_len; + dma_addr_t dma_handle; + struct xdp_buff xdp; +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +index 1b3520d0e59e..06dd65c419c4 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -105,6 +105,7 @@ MODULE_PARM_DESC(chain_mode, "To use chain instead of ring mode"); + static irqreturn_t stmmac_interrupt(int irq, void *dev_id); + + #ifdef CONFIG_DEBUG_FS ++static const struct net_device_ops stmmac_netdev_ops; + static void stmmac_init_fs(struct net_device *dev); + static void stmmac_exit_fs(struct net_device *dev); + #endif +@@ -4175,6 +4176,34 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v) + } + DEFINE_SHOW_ATTRIBUTE(stmmac_dma_cap); + ++/* Use network device events to rename debugfs file entries. ++ */ ++static int stmmac_device_event(struct notifier_block *unused, ++ unsigned long event, void *ptr) ++{ ++ struct net_device *dev = netdev_notifier_info_to_dev(ptr); ++ struct stmmac_priv *priv = netdev_priv(dev); ++ ++ if (dev->netdev_ops != &stmmac_netdev_ops) ++ goto done; ++ ++ switch (event) { ++ case NETDEV_CHANGENAME: ++ if (priv->dbgfs_dir) ++ priv->dbgfs_dir = debugfs_rename(stmmac_fs_dir, ++ priv->dbgfs_dir, ++ stmmac_fs_dir, ++ dev->name); ++ break; ++ } ++done: ++ return NOTIFY_DONE; ++} ++ ++static struct notifier_block stmmac_notifier = { ++ .notifier_call = stmmac_device_event, ++}; ++ + static void stmmac_init_fs(struct net_device *dev) + { + struct stmmac_priv *priv = netdev_priv(dev); +@@ -4189,12 +4218,15 @@ static void stmmac_init_fs(struct net_device *dev) + /* Entry to report the DMA HW features */ + debugfs_create_file("dma_cap", 0444, priv->dbgfs_dir, dev, + &stmmac_dma_cap_fops); ++ ++ register_netdevice_notifier(&stmmac_notifier); + } + + static void stmmac_exit_fs(struct net_device *dev) + { + struct stmmac_priv *priv = netdev_priv(dev); + ++ unregister_netdevice_notifier(&stmmac_notifier); + debugfs_remove_recursive(priv->dbgfs_dir); + } + #endif /* CONFIG_DEBUG_FS */ +diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c +index e2e679a01b65..77ccf3672ede 100644 +--- a/drivers/net/wan/sdla.c ++++ b/drivers/net/wan/sdla.c +@@ -708,7 +708,7 @@ static netdev_tx_t sdla_transmit(struct sk_buff *skb, + + spin_lock_irqsave(&sdla_lock, flags); + SDLA_WINDOW(dev, addr); +- pbuf = (void *)(((int) dev->mem_start) + (addr & SDLA_ADDR_MASK)); ++ pbuf = (void *)(dev->mem_start + (addr & SDLA_ADDR_MASK)); + __sdla_write(dev, pbuf->buf_addr, skb->data, skb->len); + SDLA_WINDOW(dev, addr); + pbuf->opp_flag = 1; +diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c +index fb649d85b8fc..dd0c32379375 100644 +--- a/drivers/net/wireless/ath/ath9k/hif_usb.c ++++ b/drivers/net/wireless/ath/ath9k/hif_usb.c +@@ -1216,7 +1216,7 @@ err_fw: + static int send_eject_command(struct usb_interface *interface) + { + struct usb_device *udev = interface_to_usbdev(interface); +- struct usb_host_interface *iface_desc = &interface->altsetting[0]; ++ struct usb_host_interface *iface_desc = interface->cur_altsetting; + struct usb_endpoint_descriptor *endpoint; + unsigned char *cmd; + u8 bulk_out_ep; +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +index 06f3c01f10b3..7cdfde9b3dea 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1348,7 +1348,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) + goto fail; + } + +- desc = &intf->altsetting[0].desc; ++ desc = &intf->cur_altsetting->desc; + if ((desc->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || + (desc->bInterfaceSubClass != 2) || + (desc->bInterfaceProtocol != 0xff)) { +@@ -1361,7 +1361,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) + + num_of_eps = desc->bNumEndpoints; + for (ep = 0; ep < num_of_eps; ep++) { +- endpoint = &intf->altsetting[0].endpoint[ep].desc; ++ endpoint = &intf->cur_altsetting->endpoint[ep].desc; + endpoint_num = usb_endpoint_num(endpoint); + if (!usb_endpoint_xfer_bulk(endpoint)) + continue; +diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c +index 40a8b941ad5c..8c79b963bcff 100644 +--- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c ++++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c +@@ -1608,9 +1608,9 @@ static int ezusb_probe(struct usb_interface *interface, + /* set up the endpoint information */ + /* check out the endpoints */ + +- iface_desc = &interface->altsetting[0].desc; ++ iface_desc = &interface->cur_altsetting->desc; + for (i = 0; i < iface_desc->bNumEndpoints; ++i) { +- ep = &interface->altsetting[0].endpoint[i].desc; ++ ep = &interface->cur_altsetting->endpoint[i].desc; + + if (usb_endpoint_is_bulk_in(ep)) { + /* we found a bulk in endpoint */ +diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +index e7d96ac673b7..3499b211dad5 100644 +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -5915,7 +5915,7 @@ static int rtl8xxxu_parse_usb(struct rtl8xxxu_priv *priv, + u8 dir, xtype, num; + int ret = 0; + +- host_interface = &interface->altsetting[0]; ++ host_interface = interface->cur_altsetting; + interface_desc = &host_interface->desc; + endpoints = interface_desc->bNumEndpoints; + +diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c +index f84250bdb8cf..6f8d5f9a9f7e 100644 +--- a/drivers/net/wireless/rsi/rsi_91x_hal.c ++++ b/drivers/net/wireless/rsi/rsi_91x_hal.c +@@ -622,6 +622,7 @@ static int bl_cmd(struct rsi_hw *adapter, u8 cmd, u8 exp_resp, char *str) + bl_start_cmd_timer(adapter, timeout); + status = bl_write_cmd(adapter, cmd, exp_resp, ®out_val); + if (status < 0) { ++ bl_stop_cmd_timer(adapter); + rsi_dbg(ERR_ZONE, + "%s: Command %s (%0x) writing failed..\n", + __func__, str, cmd); +@@ -737,10 +738,9 @@ static int ping_pong_write(struct rsi_hw *adapter, u8 cmd, u8 *addr, u32 size) + } + + status = bl_cmd(adapter, cmd_req, cmd_resp, str); +- if (status) { +- bl_stop_cmd_timer(adapter); ++ if (status) + return status; +- } ++ + return 0; + } + +@@ -828,10 +828,9 @@ static int auto_fw_upgrade(struct rsi_hw *adapter, u8 *flash_content, + + status = bl_cmd(adapter, EOF_REACHED, FW_LOADING_SUCCESSFUL, + "EOF_REACHED"); +- if (status) { +- bl_stop_cmd_timer(adapter); ++ if (status) + return status; +- } ++ + rsi_dbg(INFO_ZONE, "FW loading is done and FW is running..\n"); + return 0; + } +@@ -849,6 +848,7 @@ static int rsi_hal_prepare_fwload(struct rsi_hw *adapter) + ®out_val, + RSI_COMMON_REG_SIZE); + if (status < 0) { ++ bl_stop_cmd_timer(adapter); + rsi_dbg(ERR_ZONE, + "%s: REGOUT read failed\n", __func__); + return status; +diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c +index 23a1d00b5f38..d6cdabef264d 100644 +--- a/drivers/net/wireless/rsi/rsi_91x_usb.c ++++ b/drivers/net/wireless/rsi/rsi_91x_usb.c +@@ -16,6 +16,7 @@ + */ + + #include ++#include + #include + #include "rsi_usb.h" + #include "rsi_hal.h" +@@ -29,7 +30,7 @@ MODULE_PARM_DESC(dev_oper_mode, + "9[Wi-Fi STA + BT LE], 13[Wi-Fi STA + BT classic + BT LE]\n" + "6[AP + BT classic], 14[AP + BT classic + BT LE]"); + +-static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num); ++static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t flags); + + /** + * rsi_usb_card_write() - This function writes to the USB Card. +@@ -117,7 +118,7 @@ static int rsi_find_bulk_in_and_out_endpoints(struct usb_interface *interface, + __le16 buffer_size; + int ii, bin_found = 0, bout_found = 0; + +- iface_desc = &(interface->altsetting[0]); ++ iface_desc = interface->cur_altsetting; + + for (ii = 0; ii < iface_desc->desc.bNumEndpoints; ++ii) { + endpoint = &(iface_desc->endpoint[ii].desc); +@@ -285,20 +286,29 @@ static void rsi_rx_done_handler(struct urb *urb) + status = 0; + + out: +- if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num)) ++ if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num, GFP_ATOMIC)) + rsi_dbg(ERR_ZONE, "%s: Failed in urb submission", __func__); + + if (status) + dev_kfree_skb(rx_cb->rx_skb); + } + ++static void rsi_rx_urb_kill(struct rsi_hw *adapter, u8 ep_num) ++{ ++ struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev; ++ struct rx_usb_ctrl_block *rx_cb = &dev->rx_cb[ep_num - 1]; ++ struct urb *urb = rx_cb->rx_urb; ++ ++ usb_kill_urb(urb); ++} ++ + /** + * rsi_rx_urb_submit() - This function submits the given URB to the USB stack. + * @adapter: Pointer to the adapter structure. + * + * Return: 0 on success, a negative error code on failure. + */ +-static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num) ++static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t mem_flags) + { + struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev; + struct rx_usb_ctrl_block *rx_cb = &dev->rx_cb[ep_num - 1]; +@@ -328,9 +338,11 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num) + rsi_rx_done_handler, + rx_cb); + +- status = usb_submit_urb(urb, GFP_KERNEL); +- if (status) ++ status = usb_submit_urb(urb, mem_flags); ++ if (status) { + rsi_dbg(ERR_ZONE, "%s: Failed in urb submission\n", __func__); ++ dev_kfree_skb(skb); ++ } + + return status; + } +@@ -816,17 +828,20 @@ static int rsi_probe(struct usb_interface *pfunction, + rsi_dbg(INIT_ZONE, "%s: Device Init Done\n", __func__); + } + +- status = rsi_rx_urb_submit(adapter, WLAN_EP); ++ status = rsi_rx_urb_submit(adapter, WLAN_EP, GFP_KERNEL); + if (status) + goto err1; + + if (adapter->priv->coex_mode > 1) { +- status = rsi_rx_urb_submit(adapter, BT_EP); ++ status = rsi_rx_urb_submit(adapter, BT_EP, GFP_KERNEL); + if (status) +- goto err1; ++ goto err_kill_wlan_urb; + } + + return 0; ++ ++err_kill_wlan_urb: ++ rsi_rx_urb_kill(adapter, WLAN_EP); + err1: + rsi_deinit_usb_interface(adapter); + err: +@@ -857,6 +872,10 @@ static void rsi_disconnect(struct usb_interface *pfunction) + adapter->priv->bt_adapter = NULL; + } + ++ if (adapter->priv->coex_mode > 1) ++ rsi_rx_urb_kill(adapter, BT_EP); ++ rsi_rx_urb_kill(adapter, WLAN_EP); ++ + rsi_reset_card(adapter); + rsi_deinit_usb_interface(adapter); + rsi_91x_deinit(adapter); +diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c +index 7b5c2fe5bd4d..8ff0374126e4 100644 +--- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c ++++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c +@@ -1263,7 +1263,7 @@ static void print_id(struct usb_device *udev) + static int eject_installer(struct usb_interface *intf) + { + struct usb_device *udev = interface_to_usbdev(intf); +- struct usb_host_interface *iface_desc = &intf->altsetting[0]; ++ struct usb_host_interface *iface_desc = intf->cur_altsetting; + struct usb_endpoint_descriptor *endpoint; + unsigned char *cmd; + u8 bulk_out_ep; +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index 1593b8494ebb..2f88b1ff7ada 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -4080,6 +4080,40 @@ static void quirk_mic_x200_dma_alias(struct pci_dev *pdev) + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2260, quirk_mic_x200_dma_alias); + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2264, quirk_mic_x200_dma_alias); + ++/* ++ * Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices ++ * exposing computational units via Non Transparent Bridges (NTB, PEX 87xx). ++ * ++ * Similarly to MIC x200, we need to add DMA aliases to allow buffer access ++ * when IOMMU is enabled. These aliases allow computational unit access to ++ * host memory. These aliases mark the whole VCA device as one IOMMU ++ * group. ++ * ++ * All possible slot numbers (0x20) are used, since we are unable to tell ++ * what slot is used on other side. This quirk is intended for both host ++ * and computational unit sides. The VCA devices have up to five functions ++ * (four for DMA channels and one additional). ++ */ ++static void quirk_pex_vca_alias(struct pci_dev *pdev) ++{ ++ const unsigned int num_pci_slots = 0x20; ++ unsigned int slot; ++ ++ for (slot = 0; slot < num_pci_slots; slot++) { ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x0)); ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x1)); ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x2)); ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x3)); ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x4)); ++ } ++} ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2954, quirk_pex_vca_alias); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2955, quirk_pex_vca_alias); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2956, quirk_pex_vca_alias); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2958, quirk_pex_vca_alias); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2959, quirk_pex_vca_alias); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x295A, quirk_pex_vca_alias); ++ + /* + * The IOMMU and interrupt controller on Broadcom Vulcan/Cavium ThunderX2 are + * associated not at the root bus, but at a bridge below. This quirk avoids +diff --git a/drivers/perf/fsl_imx8_ddr_perf.c b/drivers/perf/fsl_imx8_ddr_perf.c +index ce7345745b42..2a3966d059e7 100644 +--- a/drivers/perf/fsl_imx8_ddr_perf.c ++++ b/drivers/perf/fsl_imx8_ddr_perf.c +@@ -45,7 +45,8 @@ + static DEFINE_IDA(ddr_ida); + + /* DDR Perf hardware feature */ +-#define DDR_CAP_AXI_ID_FILTER 0x1 /* support AXI ID filter */ ++#define DDR_CAP_AXI_ID_FILTER 0x1 /* support AXI ID filter */ ++#define DDR_CAP_AXI_ID_FILTER_ENHANCED 0x3 /* support enhanced AXI ID filter */ + + struct fsl_ddr_devtype_data { + unsigned int quirks; /* quirks needed for different DDR Perf core */ +@@ -178,6 +179,36 @@ static const struct attribute_group *attr_groups[] = { + NULL, + }; + ++static bool ddr_perf_is_filtered(struct perf_event *event) ++{ ++ return event->attr.config == 0x41 || event->attr.config == 0x42; ++} ++ ++static u32 ddr_perf_filter_val(struct perf_event *event) ++{ ++ return event->attr.config1; ++} ++ ++static bool ddr_perf_filters_compatible(struct perf_event *a, ++ struct perf_event *b) ++{ ++ if (!ddr_perf_is_filtered(a)) ++ return true; ++ if (!ddr_perf_is_filtered(b)) ++ return true; ++ return ddr_perf_filter_val(a) == ddr_perf_filter_val(b); ++} ++ ++static bool ddr_perf_is_enhanced_filtered(struct perf_event *event) ++{ ++ unsigned int filt; ++ struct ddr_pmu *pmu = to_ddr_pmu(event->pmu); ++ ++ filt = pmu->devtype_data->quirks & DDR_CAP_AXI_ID_FILTER_ENHANCED; ++ return (filt == DDR_CAP_AXI_ID_FILTER_ENHANCED) && ++ ddr_perf_is_filtered(event); ++} ++ + static u32 ddr_perf_alloc_counter(struct ddr_pmu *pmu, int event) + { + int i; +@@ -209,27 +240,17 @@ static void ddr_perf_free_counter(struct ddr_pmu *pmu, int counter) + + static u32 ddr_perf_read_counter(struct ddr_pmu *pmu, int counter) + { +- return readl_relaxed(pmu->base + COUNTER_READ + counter * 4); +-} +- +-static bool ddr_perf_is_filtered(struct perf_event *event) +-{ +- return event->attr.config == 0x41 || event->attr.config == 0x42; +-} ++ struct perf_event *event = pmu->events[counter]; ++ void __iomem *base = pmu->base; + +-static u32 ddr_perf_filter_val(struct perf_event *event) +-{ +- return event->attr.config1; +-} +- +-static bool ddr_perf_filters_compatible(struct perf_event *a, +- struct perf_event *b) +-{ +- if (!ddr_perf_is_filtered(a)) +- return true; +- if (!ddr_perf_is_filtered(b)) +- return true; +- return ddr_perf_filter_val(a) == ddr_perf_filter_val(b); ++ /* ++ * return bytes instead of bursts from ddr transaction for ++ * axid-read and axid-write event if PMU core supports enhanced ++ * filter. ++ */ ++ base += ddr_perf_is_enhanced_filtered(event) ? COUNTER_DPCR1 : ++ COUNTER_READ; ++ return readl_relaxed(base + counter * 4); + } + + static int ddr_perf_event_init(struct perf_event *event) +diff --git a/drivers/phy/motorola/phy-cpcap-usb.c b/drivers/phy/motorola/phy-cpcap-usb.c +index 9a38741d3546..5baf64dfb24d 100644 +--- a/drivers/phy/motorola/phy-cpcap-usb.c ++++ b/drivers/phy/motorola/phy-cpcap-usb.c +@@ -115,7 +115,7 @@ struct cpcap_usb_ints_state { + enum cpcap_gpio_mode { + CPCAP_DM_DP, + CPCAP_MDM_RX_TX, +- CPCAP_UNKNOWN, ++ CPCAP_UNKNOWN_DISABLED, /* Seems to disable USB lines */ + CPCAP_OTG_DM_DP, + }; + +@@ -381,7 +381,8 @@ static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata) + { + int error; + +- error = cpcap_usb_gpio_set_mode(ddata, CPCAP_DM_DP); ++ /* Disable lines to prevent glitches from waking up mdm6600 */ ++ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_UNKNOWN_DISABLED); + if (error) + goto out_err; + +@@ -408,6 +409,11 @@ static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata) + if (error) + goto out_err; + ++ /* Enable UART mode */ ++ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_DM_DP); ++ if (error) ++ goto out_err; ++ + return 0; + + out_err: +@@ -420,7 +426,8 @@ static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata) + { + int error; + +- error = cpcap_usb_gpio_set_mode(ddata, CPCAP_OTG_DM_DP); ++ /* Disable lines to prevent glitches from waking up mdm6600 */ ++ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_UNKNOWN_DISABLED); + if (error) + return error; + +@@ -460,6 +467,11 @@ static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata) + if (error) + goto out_err; + ++ /* Enable USB mode */ ++ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_OTG_DM_DP); ++ if (error) ++ goto out_err; ++ + return 0; + + out_err: +diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c +index 39e8deb8001e..27dd20a7fe13 100644 +--- a/drivers/phy/qualcomm/phy-qcom-qmp.c ++++ b/drivers/phy/qualcomm/phy-qcom-qmp.c +@@ -66,7 +66,7 @@ + /* QPHY_V3_PCS_MISC_CLAMP_ENABLE register bits */ + #define CLAMP_EN BIT(0) /* enables i/o clamp_n */ + +-#define PHY_INIT_COMPLETE_TIMEOUT 1000 ++#define PHY_INIT_COMPLETE_TIMEOUT 10000 + #define POWER_DOWN_DELAY_US_MIN 10 + #define POWER_DOWN_DELAY_US_MAX 11 + +diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c +index d27be2836bc2..74e988f839e8 100644 +--- a/drivers/platform/x86/dell-laptop.c ++++ b/drivers/platform/x86/dell-laptop.c +@@ -33,6 +33,7 @@ + + struct quirk_entry { + bool touchpad_led; ++ bool kbd_led_not_present; + bool kbd_led_levels_off_1; + bool kbd_missing_ac_tag; + +@@ -73,6 +74,10 @@ static struct quirk_entry quirk_dell_latitude_e6410 = { + .kbd_led_levels_off_1 = true, + }; + ++static struct quirk_entry quirk_dell_inspiron_1012 = { ++ .kbd_led_not_present = true, ++}; ++ + static struct platform_driver platform_driver = { + .driver = { + .name = "dell-laptop", +@@ -310,6 +315,24 @@ static const struct dmi_system_id dell_quirks[] __initconst = { + }, + .driver_data = &quirk_dell_latitude_e6410, + }, ++ { ++ .callback = dmi_matched, ++ .ident = "Dell Inspiron 1012", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1012"), ++ }, ++ .driver_data = &quirk_dell_inspiron_1012, ++ }, ++ { ++ .callback = dmi_matched, ++ .ident = "Dell Inspiron 1018", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1018"), ++ }, ++ .driver_data = &quirk_dell_inspiron_1012, ++ }, + { } + }; + +@@ -1493,6 +1516,9 @@ static void kbd_init(void) + { + int ret; + ++ if (quirks && quirks->kbd_led_not_present) ++ return; ++ + ret = kbd_init_info(); + kbd_init_tokens(); + +diff --git a/drivers/power/supply/ingenic-battery.c b/drivers/power/supply/ingenic-battery.c +index 35816d4b3012..2748715c4c75 100644 +--- a/drivers/power/supply/ingenic-battery.c ++++ b/drivers/power/supply/ingenic-battery.c +@@ -100,10 +100,17 @@ static int ingenic_battery_set_scale(struct ingenic_battery *bat) + return -EINVAL; + } + +- return iio_write_channel_attribute(bat->channel, +- scale_raw[best_idx], +- scale_raw[best_idx + 1], +- IIO_CHAN_INFO_SCALE); ++ /* Only set scale if there is more than one (fractional) entry */ ++ if (scale_len > 2) { ++ ret = iio_write_channel_attribute(bat->channel, ++ scale_raw[best_idx], ++ scale_raw[best_idx + 1], ++ IIO_CHAN_INFO_SCALE); ++ if (ret) ++ return ret; ++ } ++ ++ return 0; + } + + static enum power_supply_property ingenic_battery_properties[] = { +diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c +index 45972056ed8c..11cac7e10663 100644 +--- a/drivers/spi/spi-dw.c ++++ b/drivers/spi/spi-dw.c +@@ -172,9 +172,11 @@ static inline u32 rx_max(struct dw_spi *dws) + + static void dw_writer(struct dw_spi *dws) + { +- u32 max = tx_max(dws); ++ u32 max; + u16 txw = 0; + ++ spin_lock(&dws->buf_lock); ++ max = tx_max(dws); + while (max--) { + /* Set the tx word if the transfer's original "tx" is not null */ + if (dws->tx_end - dws->len) { +@@ -186,13 +188,16 @@ static void dw_writer(struct dw_spi *dws) + dw_write_io_reg(dws, DW_SPI_DR, txw); + dws->tx += dws->n_bytes; + } ++ spin_unlock(&dws->buf_lock); + } + + static void dw_reader(struct dw_spi *dws) + { +- u32 max = rx_max(dws); ++ u32 max; + u16 rxw; + ++ spin_lock(&dws->buf_lock); ++ max = rx_max(dws); + while (max--) { + rxw = dw_read_io_reg(dws, DW_SPI_DR); + /* Care rx only if the transfer's original "rx" is not null */ +@@ -204,6 +209,7 @@ static void dw_reader(struct dw_spi *dws) + } + dws->rx += dws->n_bytes; + } ++ spin_unlock(&dws->buf_lock); + } + + static void int_error_stop(struct dw_spi *dws, const char *msg) +@@ -276,18 +282,20 @@ static int dw_spi_transfer_one(struct spi_controller *master, + { + struct dw_spi *dws = spi_controller_get_devdata(master); + struct chip_data *chip = spi_get_ctldata(spi); ++ unsigned long flags; + u8 imask = 0; + u16 txlevel = 0; + u32 cr0; + int ret; + + dws->dma_mapped = 0; +- ++ spin_lock_irqsave(&dws->buf_lock, flags); + dws->tx = (void *)transfer->tx_buf; + dws->tx_end = dws->tx + transfer->len; + dws->rx = transfer->rx_buf; + dws->rx_end = dws->rx + transfer->len; + dws->len = transfer->len; ++ spin_unlock_irqrestore(&dws->buf_lock, flags); + + spi_enable_chip(dws, 0); + +@@ -471,6 +479,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) + dws->type = SSI_MOTO_SPI; + dws->dma_inited = 0; + dws->dma_addr = (dma_addr_t)(dws->paddr + DW_SPI_DR); ++ spin_lock_init(&dws->buf_lock); + + spi_controller_set_devdata(master, dws); + +diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h +index c9c15881e982..f3a2f157a2b1 100644 +--- a/drivers/spi/spi-dw.h ++++ b/drivers/spi/spi-dw.h +@@ -120,6 +120,7 @@ struct dw_spi { + size_t len; + void *tx; + void *tx_end; ++ spinlock_t buf_lock; + void *rx; + void *rx_end; + int dma_mapped; +diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c +index 9f92165fe09f..2fd843b18297 100644 +--- a/drivers/spi/spi-pxa2xx.c ++++ b/drivers/spi/spi-pxa2xx.c +@@ -1461,6 +1461,10 @@ static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = { + { PCI_VDEVICE(INTEL, 0x02aa), LPSS_CNL_SSP }, + { PCI_VDEVICE(INTEL, 0x02ab), LPSS_CNL_SSP }, + { PCI_VDEVICE(INTEL, 0x02fb), LPSS_CNL_SSP }, ++ /* CML-H */ ++ { PCI_VDEVICE(INTEL, 0x06aa), LPSS_CNL_SSP }, ++ { PCI_VDEVICE(INTEL, 0x06ab), LPSS_CNL_SSP }, ++ { PCI_VDEVICE(INTEL, 0x06fb), LPSS_CNL_SSP }, + /* TGL-LP */ + { PCI_VDEVICE(INTEL, 0xa0aa), LPSS_CNL_SSP }, + { PCI_VDEVICE(INTEL, 0xa0ab), LPSS_CNL_SSP }, +diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c +index 26a31854c636..c48956f0ef29 100644 +--- a/drivers/staging/most/net/net.c ++++ b/drivers/staging/most/net/net.c +@@ -81,6 +81,11 @@ static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo) + unsigned int payload_len = skb->len - ETH_HLEN; + unsigned int mdp_len = payload_len + MDP_HDR_LEN; + ++ if (mdp_len < skb->len) { ++ pr_err("drop: too large packet! (%u)\n", skb->len); ++ return -EINVAL; ++ } ++ + if (mbo->buffer_length < mdp_len) { + pr_err("drop: too small buffer! (%d for %d)\n", + mbo->buffer_length, mdp_len); +@@ -128,6 +133,11 @@ static int skb_to_mep(const struct sk_buff *skb, struct mbo *mbo) + u8 *buff = mbo->virt_address; + unsigned int mep_len = skb->len + MEP_HDR_LEN; + ++ if (mep_len < skb->len) { ++ pr_err("drop: too large packet! (%u)\n", skb->len); ++ return -EINVAL; ++ } ++ + if (mbo->buffer_length < mep_len) { + pr_err("drop: too small buffer! (%d for %d)\n", + mbo->buffer_length, mep_len); +diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c +index 6b98827da57f..3633c924848e 100644 +--- a/drivers/staging/mt7621-pci/pci-mt7621.c ++++ b/drivers/staging/mt7621-pci/pci-mt7621.c +@@ -29,15 +29,14 @@ + #include + #include + #include ++#include + #include + #include + + #include "../../pci/pci.h" + + /* sysctl */ +-#define MT7621_CHIP_REV_ID 0x0c + #define MT7621_GPIO_MODE 0x60 +-#define CHIP_REV_MT7621_E2 0x0101 + + /* MediaTek specific configuration registers */ + #define PCIE_FTS_NUM 0x70c +@@ -126,6 +125,8 @@ struct mt7621_pcie_port { + * @ports: pointer to PCIe port information + * @perst: gpio reset + * @rst: pointer to pcie reset ++ * @resets_inverted: depends on chip revision ++ * reset lines are inverted. + */ + struct mt7621_pcie { + void __iomem *base; +@@ -140,6 +141,7 @@ struct mt7621_pcie { + struct list_head ports; + struct gpio_desc *perst; + struct reset_control *rst; ++ bool resets_inverted; + }; + + static inline u32 pcie_read(struct mt7621_pcie *pcie, u32 reg) +@@ -229,9 +231,9 @@ static inline void mt7621_pcie_port_clk_disable(struct mt7621_pcie_port *port) + + static inline void mt7621_control_assert(struct mt7621_pcie_port *port) + { +- u32 chip_rev_id = rt_sysc_r32(MT7621_CHIP_REV_ID); ++ struct mt7621_pcie *pcie = port->pcie; + +- if ((chip_rev_id & 0xFFFF) == CHIP_REV_MT7621_E2) ++ if (pcie->resets_inverted) + reset_control_assert(port->pcie_rst); + else + reset_control_deassert(port->pcie_rst); +@@ -239,9 +241,9 @@ static inline void mt7621_control_assert(struct mt7621_pcie_port *port) + + static inline void mt7621_control_deassert(struct mt7621_pcie_port *port) + { +- u32 chip_rev_id = rt_sysc_r32(MT7621_CHIP_REV_ID); ++ struct mt7621_pcie *pcie = port->pcie; + +- if ((chip_rev_id & 0xFFFF) == CHIP_REV_MT7621_E2) ++ if (pcie->resets_inverted) + reset_control_deassert(port->pcie_rst); + else + reset_control_assert(port->pcie_rst); +@@ -641,9 +643,14 @@ static int mt7621_pcie_register_host(struct pci_host_bridge *host, + return pci_host_probe(host); + } + ++static const struct soc_device_attribute mt7621_pci_quirks_match[] = { ++ { .soc_id = "mt7621", .revision = "E2" } ++}; ++ + static int mt7621_pci_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; ++ const struct soc_device_attribute *attr; + struct mt7621_pcie *pcie; + struct pci_host_bridge *bridge; + int err; +@@ -661,6 +668,10 @@ static int mt7621_pci_probe(struct platform_device *pdev) + platform_set_drvdata(pdev, pcie); + INIT_LIST_HEAD(&pcie->ports); + ++ attr = soc_device_match(mt7621_pci_quirks_match); ++ if (attr) ++ pcie->resets_inverted = true; ++ + err = mt7621_pcie_parse_dt(pcie); + if (err) { + dev_err(dev, "Parsing DT failed\n"); +diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h +index 50e1c8918040..e2fabe818b19 100644 +--- a/drivers/staging/vt6656/device.h ++++ b/drivers/staging/vt6656/device.h +@@ -52,6 +52,8 @@ + #define RATE_AUTO 12 + + #define MAX_RATE 12 ++#define VNT_B_RATES (BIT(RATE_1M) | BIT(RATE_2M) |\ ++ BIT(RATE_5M) | BIT(RATE_11M)) + + /* + * device specific +diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c +index f40947955675..af215860be4c 100644 +--- a/drivers/staging/vt6656/int.c ++++ b/drivers/staging/vt6656/int.c +@@ -99,9 +99,11 @@ static int vnt_int_report_rate(struct vnt_private *priv, u8 pkt_no, u8 tsr) + + info->status.rates[0].count = tx_retry; + +- if (!(tsr & (TSR_TMO | TSR_RETRYTMO))) { ++ if (!(tsr & TSR_TMO)) { + info->status.rates[0].idx = idx; +- info->flags |= IEEE80211_TX_STAT_ACK; ++ ++ if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) ++ info->flags |= IEEE80211_TX_STAT_ACK; + } + + ieee80211_tx_status_irqsafe(priv->hw, context->skb); +diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c +index c26882e2bb80..69a48383611f 100644 +--- a/drivers/staging/vt6656/main_usb.c ++++ b/drivers/staging/vt6656/main_usb.c +@@ -1016,6 +1016,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) + ieee80211_hw_set(priv->hw, RX_INCLUDES_FCS); + ieee80211_hw_set(priv->hw, REPORTS_TX_ACK_STATUS); + ieee80211_hw_set(priv->hw, SUPPORTS_PS); ++ ieee80211_hw_set(priv->hw, PS_NULLFUNC_STACK); + + priv->hw->max_signal = 100; + +diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c +index 4e9cfacf75f2..ab6141f361af 100644 +--- a/drivers/staging/vt6656/rxtx.c ++++ b/drivers/staging/vt6656/rxtx.c +@@ -278,11 +278,9 @@ static u16 vnt_rxtx_datahead_g(struct vnt_usb_send_context *tx_context, + PK_TYPE_11B, &buf->b); + + /* Get Duration and TimeStamp */ +- if (ieee80211_is_pspoll(hdr->frame_control)) { +- __le16 dur = cpu_to_le16(priv->current_aid | BIT(14) | BIT(15)); +- +- buf->duration_a = dur; +- buf->duration_b = dur; ++ if (ieee80211_is_nullfunc(hdr->frame_control)) { ++ buf->duration_a = hdr->duration_id; ++ buf->duration_b = hdr->duration_id; + } else { + buf->duration_a = vnt_get_duration_le(priv, + tx_context->pkt_type, need_ack); +@@ -371,10 +369,8 @@ static u16 vnt_rxtx_datahead_ab(struct vnt_usb_send_context *tx_context, + tx_context->pkt_type, &buf->ab); + + /* Get Duration and TimeStampOff */ +- if (ieee80211_is_pspoll(hdr->frame_control)) { +- __le16 dur = cpu_to_le16(priv->current_aid | BIT(14) | BIT(15)); +- +- buf->duration = dur; ++ if (ieee80211_is_nullfunc(hdr->frame_control)) { ++ buf->duration = hdr->duration_id; + } else { + buf->duration = vnt_get_duration_le(priv, tx_context->pkt_type, + need_ack); +@@ -815,10 +811,14 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) + if (info->band == NL80211_BAND_5GHZ) { + pkt_type = PK_TYPE_11A; + } else { +- if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT) +- pkt_type = PK_TYPE_11GB; +- else +- pkt_type = PK_TYPE_11GA; ++ if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { ++ if (priv->basic_rates & VNT_B_RATES) ++ pkt_type = PK_TYPE_11GB; ++ else ++ pkt_type = PK_TYPE_11GA; ++ } else { ++ pkt_type = PK_TYPE_11A; ++ } + } + } else { + pkt_type = PK_TYPE_11B; +diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c +index 7350fe5d96a3..a8860d2aee68 100644 +--- a/drivers/staging/wlan-ng/prism2mgmt.c ++++ b/drivers/staging/wlan-ng/prism2mgmt.c +@@ -959,7 +959,7 @@ int prism2mgmt_flashdl_state(struct wlandevice *wlandev, void *msgp) + } + } + +- return 0; ++ return result; + } + + /*---------------------------------------------------------------- +diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial/8250/8250_bcm2835aux.c +index 8ce700c1a7fc..4997c519ebb3 100644 +--- a/drivers/tty/serial/8250/8250_bcm2835aux.c ++++ b/drivers/tty/serial/8250/8250_bcm2835aux.c +@@ -113,7 +113,7 @@ static int bcm2835aux_serial_remove(struct platform_device *pdev) + { + struct bcm2835aux_data *data = platform_get_drvdata(pdev); + +- serial8250_unregister_port(data->uart.port.line); ++ serial8250_unregister_port(data->line); + clk_disable_unprepare(data->clk); + + return 0; +diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c +index 34f602c3a882..9d8c660dc289 100644 +--- a/drivers/tty/serial/imx.c ++++ b/drivers/tty/serial/imx.c +@@ -700,22 +700,33 @@ static void imx_uart_start_tx(struct uart_port *port) + } + } + +-static irqreturn_t imx_uart_rtsint(int irq, void *dev_id) ++static irqreturn_t __imx_uart_rtsint(int irq, void *dev_id) + { + struct imx_port *sport = dev_id; + u32 usr1; + +- spin_lock(&sport->port.lock); +- + imx_uart_writel(sport, USR1_RTSD, USR1); + usr1 = imx_uart_readl(sport, USR1) & USR1_RTSS; + uart_handle_cts_change(&sport->port, !!usr1); + wake_up_interruptible(&sport->port.state->port.delta_msr_wait); + +- spin_unlock(&sport->port.lock); + return IRQ_HANDLED; + } + ++static irqreturn_t imx_uart_rtsint(int irq, void *dev_id) ++{ ++ struct imx_port *sport = dev_id; ++ irqreturn_t ret; ++ ++ spin_lock(&sport->port.lock); ++ ++ ret = __imx_uart_rtsint(irq, dev_id); ++ ++ spin_unlock(&sport->port.lock); ++ ++ return ret; ++} ++ + static irqreturn_t imx_uart_txint(int irq, void *dev_id) + { + struct imx_port *sport = dev_id; +@@ -726,14 +737,12 @@ static irqreturn_t imx_uart_txint(int irq, void *dev_id) + return IRQ_HANDLED; + } + +-static irqreturn_t imx_uart_rxint(int irq, void *dev_id) ++static irqreturn_t __imx_uart_rxint(int irq, void *dev_id) + { + struct imx_port *sport = dev_id; + unsigned int rx, flg, ignored = 0; + struct tty_port *port = &sport->port.state->port; + +- spin_lock(&sport->port.lock); +- + while (imx_uart_readl(sport, USR2) & USR2_RDR) { + u32 usr2; + +@@ -792,11 +801,25 @@ static irqreturn_t imx_uart_rxint(int irq, void *dev_id) + } + + out: +- spin_unlock(&sport->port.lock); + tty_flip_buffer_push(port); ++ + return IRQ_HANDLED; + } + ++static irqreturn_t imx_uart_rxint(int irq, void *dev_id) ++{ ++ struct imx_port *sport = dev_id; ++ irqreturn_t ret; ++ ++ spin_lock(&sport->port.lock); ++ ++ ret = __imx_uart_rxint(irq, dev_id); ++ ++ spin_unlock(&sport->port.lock); ++ ++ return ret; ++} ++ + static void imx_uart_clear_rx_errors(struct imx_port *sport); + + /* +@@ -855,6 +878,8 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id) + unsigned int usr1, usr2, ucr1, ucr2, ucr3, ucr4; + irqreturn_t ret = IRQ_NONE; + ++ spin_lock(&sport->port.lock); ++ + usr1 = imx_uart_readl(sport, USR1); + usr2 = imx_uart_readl(sport, USR2); + ucr1 = imx_uart_readl(sport, UCR1); +@@ -888,27 +913,25 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id) + usr2 &= ~USR2_ORE; + + if (usr1 & (USR1_RRDY | USR1_AGTIM)) { +- imx_uart_rxint(irq, dev_id); ++ __imx_uart_rxint(irq, dev_id); + ret = IRQ_HANDLED; + } + + if ((usr1 & USR1_TRDY) || (usr2 & USR2_TXDC)) { +- imx_uart_txint(irq, dev_id); ++ imx_uart_transmit_buffer(sport); + ret = IRQ_HANDLED; + } + + if (usr1 & USR1_DTRD) { + imx_uart_writel(sport, USR1_DTRD, USR1); + +- spin_lock(&sport->port.lock); + imx_uart_mctrl_check(sport); +- spin_unlock(&sport->port.lock); + + ret = IRQ_HANDLED; + } + + if (usr1 & USR1_RTSD) { +- imx_uart_rtsint(irq, dev_id); ++ __imx_uart_rtsint(irq, dev_id); + ret = IRQ_HANDLED; + } + +@@ -923,6 +946,8 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id) + ret = IRQ_HANDLED; + } + ++ spin_unlock(&sport->port.lock); ++ + return ret; + } + +diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c +index 97d6ae3c4df2..cede7a8e3605 100644 +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -1209,6 +1209,9 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc) + /* do nothing */ + break; + } ++ ++ /* de-assert DRVVBUS for HOST and OTG mode */ ++ dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); + } + + static void dwc3_get_properties(struct dwc3 *dwc) +diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c +index 294276f7deb9..7051611229c9 100644 +--- a/drivers/usb/dwc3/dwc3-pci.c ++++ b/drivers/usb/dwc3/dwc3-pci.c +@@ -34,6 +34,7 @@ + #define PCI_DEVICE_ID_INTEL_GLK 0x31aa + #define PCI_DEVICE_ID_INTEL_CNPLP 0x9dee + #define PCI_DEVICE_ID_INTEL_CNPH 0xa36e ++#define PCI_DEVICE_ID_INTEL_CNPV 0xa3b0 + #define PCI_DEVICE_ID_INTEL_ICLLP 0x34ee + #define PCI_DEVICE_ID_INTEL_EHLLP 0x4b7e + #define PCI_DEVICE_ID_INTEL_TGPLP 0xa0ee +@@ -342,6 +343,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = { + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPH), + (kernel_ulong_t) &dwc3_pci_intel_properties, }, + ++ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPV), ++ (kernel_ulong_t) &dwc3_pci_intel_properties, }, ++ + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICLLP), + (kernel_ulong_t) &dwc3_pci_intel_properties, }, + +diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c +index dc172513a4aa..b8e24ccba9f3 100644 +--- a/drivers/usb/host/xhci-tegra.c ++++ b/drivers/usb/host/xhci-tegra.c +@@ -1413,6 +1413,7 @@ MODULE_FIRMWARE("nvidia/tegra210/xusb.bin"); + + static const char * const tegra186_supply_names[] = { + }; ++MODULE_FIRMWARE("nvidia/tegra186/xusb.bin"); + + static const struct tegra_xusb_phy_type tegra186_phy_types[] = { + { .name = "usb3", .num = 3, }, +diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c +index 5261f8dfedec..e3b8c84ccdb8 100644 +--- a/drivers/usb/musb/jz4740.c ++++ b/drivers/usb/musb/jz4740.c +@@ -75,14 +75,17 @@ static struct musb_hdrc_platform_data jz4740_musb_platform_data = { + static int jz4740_musb_init(struct musb *musb) + { + struct device *dev = musb->controller->parent; ++ int err; + + if (dev->of_node) + musb->xceiv = devm_usb_get_phy_by_phandle(dev, "phys", 0); + else + musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + if (IS_ERR(musb->xceiv)) { +- dev_err(dev, "No transceiver configured\n"); +- return PTR_ERR(musb->xceiv); ++ err = PTR_ERR(musb->xceiv); ++ if (err != -EPROBE_DEFER) ++ dev_err(dev, "No transceiver configured: %d", err); ++ return err; + } + + /* Silicon does not implement ConfigData register. +diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c +index 302eb9530859..627bea7e6cfb 100644 +--- a/drivers/usb/serial/ir-usb.c ++++ b/drivers/usb/serial/ir-usb.c +@@ -45,9 +45,10 @@ static int buffer_size; + static int xbof = -1; + + static int ir_startup (struct usb_serial *serial); +-static int ir_open(struct tty_struct *tty, struct usb_serial_port *port); +-static int ir_prepare_write_buffer(struct usb_serial_port *port, +- void *dest, size_t size); ++static int ir_write(struct tty_struct *tty, struct usb_serial_port *port, ++ const unsigned char *buf, int count); ++static int ir_write_room(struct tty_struct *tty); ++static void ir_write_bulk_callback(struct urb *urb); + static void ir_process_read_urb(struct urb *urb); + static void ir_set_termios(struct tty_struct *tty, + struct usb_serial_port *port, struct ktermios *old_termios); +@@ -77,8 +78,9 @@ static struct usb_serial_driver ir_device = { + .num_ports = 1, + .set_termios = ir_set_termios, + .attach = ir_startup, +- .open = ir_open, +- .prepare_write_buffer = ir_prepare_write_buffer, ++ .write = ir_write, ++ .write_room = ir_write_room, ++ .write_bulk_callback = ir_write_bulk_callback, + .process_read_urb = ir_process_read_urb, + }; + +@@ -195,6 +197,9 @@ static int ir_startup(struct usb_serial *serial) + struct usb_irda_cs_descriptor *irda_desc; + int rates; + ++ if (serial->num_bulk_in < 1 || serial->num_bulk_out < 1) ++ return -ENODEV; ++ + irda_desc = irda_usb_find_class_desc(serial, 0); + if (!irda_desc) { + dev_err(&serial->dev->dev, +@@ -251,35 +256,102 @@ static int ir_startup(struct usb_serial *serial) + return 0; + } + +-static int ir_open(struct tty_struct *tty, struct usb_serial_port *port) ++static int ir_write(struct tty_struct *tty, struct usb_serial_port *port, ++ const unsigned char *buf, int count) + { +- int i; ++ struct urb *urb = NULL; ++ unsigned long flags; ++ int ret; + +- for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) +- port->write_urbs[i]->transfer_flags = URB_ZERO_PACKET; ++ if (port->bulk_out_size == 0) ++ return -EINVAL; + +- /* Start reading from the device */ +- return usb_serial_generic_open(tty, port); +-} ++ if (count == 0) ++ return 0; + +-static int ir_prepare_write_buffer(struct usb_serial_port *port, +- void *dest, size_t size) +-{ +- unsigned char *buf = dest; +- int count; ++ count = min(count, port->bulk_out_size - 1); ++ ++ spin_lock_irqsave(&port->lock, flags); ++ if (__test_and_clear_bit(0, &port->write_urbs_free)) { ++ urb = port->write_urbs[0]; ++ port->tx_bytes += count; ++ } ++ spin_unlock_irqrestore(&port->lock, flags); ++ ++ if (!urb) ++ return 0; + + /* + * The first byte of the packet we send to the device contains an +- * inbound header which indicates an additional number of BOFs and ++ * outbound header which indicates an additional number of BOFs and + * a baud rate change. + * + * See section 5.4.2.2 of the USB IrDA spec. + */ +- *buf = ir_xbof | ir_baud; ++ *(u8 *)urb->transfer_buffer = ir_xbof | ir_baud; ++ ++ memcpy(urb->transfer_buffer + 1, buf, count); ++ ++ urb->transfer_buffer_length = count + 1; ++ urb->transfer_flags = URB_ZERO_PACKET; ++ ++ ret = usb_submit_urb(urb, GFP_ATOMIC); ++ if (ret) { ++ dev_err(&port->dev, "failed to submit write urb: %d\n", ret); ++ ++ spin_lock_irqsave(&port->lock, flags); ++ __set_bit(0, &port->write_urbs_free); ++ port->tx_bytes -= count; ++ spin_unlock_irqrestore(&port->lock, flags); ++ ++ return ret; ++ } ++ ++ return count; ++} ++ ++static void ir_write_bulk_callback(struct urb *urb) ++{ ++ struct usb_serial_port *port = urb->context; ++ int status = urb->status; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&port->lock, flags); ++ __set_bit(0, &port->write_urbs_free); ++ port->tx_bytes -= urb->transfer_buffer_length - 1; ++ spin_unlock_irqrestore(&port->lock, flags); ++ ++ switch (status) { ++ case 0: ++ break; ++ case -ENOENT: ++ case -ECONNRESET: ++ case -ESHUTDOWN: ++ dev_dbg(&port->dev, "write urb stopped: %d\n", status); ++ return; ++ case -EPIPE: ++ dev_err(&port->dev, "write urb stopped: %d\n", status); ++ return; ++ default: ++ dev_err(&port->dev, "nonzero write-urb status: %d\n", status); ++ break; ++ } ++ ++ usb_serial_port_softint(port); ++} ++ ++static int ir_write_room(struct tty_struct *tty) ++{ ++ struct usb_serial_port *port = tty->driver_data; ++ int count = 0; ++ ++ if (port->bulk_out_size == 0) ++ return 0; ++ ++ if (test_bit(0, &port->write_urbs_free)) ++ count = port->bulk_out_size - 1; + +- count = kfifo_out_locked(&port->write_fifo, buf + 1, size - 1, +- &port->lock); +- return count + 1; ++ return count; + } + + static void ir_process_read_urb(struct urb *urb) +@@ -332,34 +404,34 @@ static void ir_set_termios(struct tty_struct *tty, + + switch (baud) { + case 2400: +- ir_baud = USB_IRDA_BR_2400; ++ ir_baud = USB_IRDA_LS_2400; + break; + case 9600: +- ir_baud = USB_IRDA_BR_9600; ++ ir_baud = USB_IRDA_LS_9600; + break; + case 19200: +- ir_baud = USB_IRDA_BR_19200; ++ ir_baud = USB_IRDA_LS_19200; + break; + case 38400: +- ir_baud = USB_IRDA_BR_38400; ++ ir_baud = USB_IRDA_LS_38400; + break; + case 57600: +- ir_baud = USB_IRDA_BR_57600; ++ ir_baud = USB_IRDA_LS_57600; + break; + case 115200: +- ir_baud = USB_IRDA_BR_115200; ++ ir_baud = USB_IRDA_LS_115200; + break; + case 576000: +- ir_baud = USB_IRDA_BR_576000; ++ ir_baud = USB_IRDA_LS_576000; + break; + case 1152000: +- ir_baud = USB_IRDA_BR_1152000; ++ ir_baud = USB_IRDA_LS_1152000; + break; + case 4000000: +- ir_baud = USB_IRDA_BR_4000000; ++ ir_baud = USB_IRDA_LS_4000000; + break; + default: +- ir_baud = USB_IRDA_BR_9600; ++ ir_baud = USB_IRDA_LS_9600; + baud = 9600; + } + +diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h +index d0bdebd87ce3..1b23741036ee 100644 +--- a/drivers/usb/storage/unusual_uas.h ++++ b/drivers/usb/storage/unusual_uas.h +@@ -87,12 +87,15 @@ UNUSUAL_DEV(0x2537, 0x1068, 0x0000, 0x9999, + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + +-/* Reported-by: Takeo Nakayama */ ++/* ++ * Initially Reported-by: Takeo Nakayama ++ * UAS Ignore Reported by Steven Ellis ++ */ + UNUSUAL_DEV(0x357d, 0x7788, 0x0000, 0x9999, + "JMicron", + "JMS566", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, +- US_FL_NO_REPORT_OPCODES), ++ US_FL_NO_REPORT_OPCODES | US_FL_IGNORE_UAS), + + /* Reported-by: Hans de Goede */ + UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999, +diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c +index ed8655c6af8c..b498960ff72b 100644 +--- a/drivers/usb/typec/tcpm/fusb302.c ++++ b/drivers/usb/typec/tcpm/fusb302.c +@@ -1666,7 +1666,7 @@ static const struct property_entry port_props[] = { + PROPERTY_ENTRY_STRING("try-power-role", "sink"), + PROPERTY_ENTRY_U32_ARRAY("source-pdos", src_pdo), + PROPERTY_ENTRY_U32_ARRAY("sink-pdos", snk_pdo), +- PROPERTY_ENTRY_U32("op-sink-microwatt", 2500), ++ PROPERTY_ENTRY_U32("op-sink-microwatt", 2500000), + { } + }; + +diff --git a/drivers/usb/typec/tcpm/wcove.c b/drivers/usb/typec/tcpm/wcove.c +index edc271da14f4..9b745f432c91 100644 +--- a/drivers/usb/typec/tcpm/wcove.c ++++ b/drivers/usb/typec/tcpm/wcove.c +@@ -597,7 +597,7 @@ static const struct property_entry wcove_props[] = { + PROPERTY_ENTRY_STRING("try-power-role", "sink"), + PROPERTY_ENTRY_U32_ARRAY("source-pdos", src_pdo), + PROPERTY_ENTRY_U32_ARRAY("sink-pdos", snk_pdo), +- PROPERTY_ENTRY_U32("op-sink-microwatt", 15000), ++ PROPERTY_ENTRY_U32("op-sink-microwatt", 15000000), + { } + }; + +diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig +index 4c761abc5688..e2745f686196 100644 +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -687,6 +687,7 @@ config MAX63XX_WATCHDOG + config MAX77620_WATCHDOG + tristate "Maxim Max77620 Watchdog Timer" + depends on MFD_MAX77620 || COMPILE_TEST ++ select WATCHDOG_CORE + help + This is the driver for the Max77620 watchdog timer. + Say 'Y' here to enable the watchdog timer support for +diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c +index 1cccf8eb1c5d..8e6dfe76f9c9 100644 +--- a/drivers/watchdog/orion_wdt.c ++++ b/drivers/watchdog/orion_wdt.c +@@ -602,7 +602,7 @@ static int orion_wdt_probe(struct platform_device *pdev) + set_bit(WDOG_HW_RUNNING, &dev->wdt.status); + + /* Request the IRQ only after the watchdog is disabled */ +- irq = platform_get_irq(pdev, 0); ++ irq = platform_get_irq_optional(pdev, 0); + if (irq > 0) { + /* + * Not all supported platforms specify an interrupt for the +@@ -617,7 +617,7 @@ static int orion_wdt_probe(struct platform_device *pdev) + } + + /* Optional 2nd interrupt for pretimeout */ +- irq = platform_get_irq(pdev, 1); ++ irq = platform_get_irq_optional(pdev, 1); + if (irq > 0) { + orion_wdt_info.options |= WDIOF_PRETIMEOUT; + ret = devm_request_irq(&pdev->dev, irq, orion_wdt_pre_irq, +diff --git a/drivers/watchdog/rn5t618_wdt.c b/drivers/watchdog/rn5t618_wdt.c +index 234876047431..6e524c8e26a8 100644 +--- a/drivers/watchdog/rn5t618_wdt.c ++++ b/drivers/watchdog/rn5t618_wdt.c +@@ -188,6 +188,7 @@ static struct platform_driver rn5t618_wdt_driver = { + + module_platform_driver(rn5t618_wdt_driver); + ++MODULE_ALIAS("platform:rn5t618-wdt"); + MODULE_AUTHOR("Beniamino Galvani "); + MODULE_DESCRIPTION("RN5T618 watchdog driver"); + MODULE_LICENSE("GPL v2"); +diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h +index f55e53486e74..53611d7e9d28 100644 +--- a/fs/cifs/cifsglob.h ++++ b/fs/cifs/cifsglob.h +@@ -1538,6 +1538,7 @@ struct mid_q_entry { + mid_callback_t *callback; /* call completion callback */ + mid_handle_t *handle; /* call handle mid callback */ + void *callback_data; /* general purpose pointer for callback */ ++ struct task_struct *creator; + void *resp_buf; /* pointer to received SMB header */ + unsigned int resp_buf_size; + int mid_state; /* wish this were enum but can not pass to wait_event */ +diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c +index 766974fe637a..14265b4bbcc0 100644 +--- a/fs/cifs/smb2misc.c ++++ b/fs/cifs/smb2misc.c +@@ -750,7 +750,7 @@ __smb2_handle_cancelled_close(struct cifs_tcon *tcon, __u64 persistent_fid, + { + struct close_cancelled_open *cancelled; + +- cancelled = kzalloc(sizeof(*cancelled), GFP_KERNEL); ++ cancelled = kzalloc(sizeof(*cancelled), GFP_ATOMIC); + if (!cancelled) + return -ENOMEM; + +diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c +index b5c1cba3e6a1..662256fa2a18 100644 +--- a/fs/cifs/smb2ops.c ++++ b/fs/cifs/smb2ops.c +@@ -1461,7 +1461,9 @@ smb2_ioctl_query_info(const unsigned int xid, + COMPOUND_FID, COMPOUND_FID, + qi.info_type, true, buffer, + qi.output_buffer_length, +- CIFSMaxBufSize); ++ CIFSMaxBufSize - ++ MAX_SMB2_CREATE_RESPONSE_SIZE - ++ MAX_SMB2_CLOSE_RESPONSE_SIZE); + } + } else if (qi.flags == PASSTHRU_SET_INFO) { + /* Can eventually relax perm check since server enforces too */ +@@ -2634,7 +2636,10 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, + + rc = SMB2_ioctl_init(tcon, &rqst[1], fid.persistent_fid, + fid.volatile_fid, FSCTL_GET_REPARSE_POINT, +- true /* is_fctl */, NULL, 0, CIFSMaxBufSize); ++ true /* is_fctl */, NULL, 0, ++ CIFSMaxBufSize - ++ MAX_SMB2_CREATE_RESPONSE_SIZE - ++ MAX_SMB2_CLOSE_RESPONSE_SIZE); + if (rc) + goto querty_exit; + +diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c +index 148d7942c796..805652969065 100644 +--- a/fs/cifs/smb2transport.c ++++ b/fs/cifs/smb2transport.c +@@ -599,6 +599,8 @@ smb2_mid_entry_alloc(const struct smb2_sync_hdr *shdr, + * The default is for the mid to be synchronous, so the + * default callback just wakes up the current task. + */ ++ get_task_struct(current); ++ temp->creator = current; + temp->callback = cifs_wake_up_task; + temp->callback_data = current; + +diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c +index 755434d5e4e7..e67a43fd037c 100644 +--- a/fs/cifs/transport.c ++++ b/fs/cifs/transport.c +@@ -76,6 +76,8 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server) + * The default is for the mid to be synchronous, so the + * default callback just wakes up the current task. + */ ++ get_task_struct(current); ++ temp->creator = current; + temp->callback = cifs_wake_up_task; + temp->callback_data = current; + +@@ -158,6 +160,7 @@ static void _cifs_mid_q_entry_release(struct kref *refcount) + } + } + #endif ++ put_task_struct(midEntry->creator); + + mempool_free(midEntry, cifs_mid_poolp); + } +diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c +index 87846aad594b..8fd45eb89424 100644 +--- a/fs/debugfs/file.c ++++ b/fs/debugfs/file.c +@@ -142,18 +142,21 @@ EXPORT_SYMBOL_GPL(debugfs_file_put); + * We also need to exclude any file that has ways to write or alter it as root + * can bypass the permissions check. + */ +-static bool debugfs_is_locked_down(struct inode *inode, +- struct file *filp, +- const struct file_operations *real_fops) ++static int debugfs_locked_down(struct inode *inode, ++ struct file *filp, ++ const struct file_operations *real_fops) + { + if ((inode->i_mode & 07777) == 0444 && + !(filp->f_mode & FMODE_WRITE) && + !real_fops->unlocked_ioctl && + !real_fops->compat_ioctl && + !real_fops->mmap) +- return false; ++ return 0; + +- return security_locked_down(LOCKDOWN_DEBUGFS); ++ if (security_locked_down(LOCKDOWN_DEBUGFS)) ++ return -EPERM; ++ ++ return 0; + } + + static int open_proxy_open(struct inode *inode, struct file *filp) +@@ -168,7 +171,7 @@ static int open_proxy_open(struct inode *inode, struct file *filp) + + real_fops = debugfs_real_fops(filp); + +- r = debugfs_is_locked_down(inode, filp, real_fops); ++ r = debugfs_locked_down(inode, filp, real_fops); + if (r) + goto out; + +@@ -298,7 +301,7 @@ static int full_proxy_open(struct inode *inode, struct file *filp) + + real_fops = debugfs_real_fops(filp); + +- r = debugfs_is_locked_down(inode, filp, real_fops); ++ r = debugfs_locked_down(inode, filp, real_fops); + if (r) + goto out; + +diff --git a/include/linux/platform_data/ti-sysc.h b/include/linux/platform_data/ti-sysc.h +index b5b7a3423ca8..8cfe570fdece 100644 +--- a/include/linux/platform_data/ti-sysc.h ++++ b/include/linux/platform_data/ti-sysc.h +@@ -49,6 +49,8 @@ struct sysc_regbits { + s8 emufree_shift; + }; + ++#define SYSC_QUIRK_FORCE_MSTANDBY BIT(20) ++#define SYSC_MODULE_QUIRK_AESS BIT(19) + #define SYSC_MODULE_QUIRK_SGX BIT(18) + #define SYSC_MODULE_QUIRK_HDQ1W BIT(17) + #define SYSC_MODULE_QUIRK_I2C BIT(16) +diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h +index d0b37e937037..971c9264179e 100644 +--- a/include/linux/power/smartreflex.h ++++ b/include/linux/power/smartreflex.h +@@ -293,6 +293,9 @@ struct omap_sr_data { + struct voltagedomain *voltdm; + }; + ++ ++extern struct omap_sr_data omap_sr_pdata[OMAP_SR_NR]; ++ + #ifdef CONFIG_POWER_AVS_OMAP + + /* Smartreflex module enable/disable interface */ +diff --git a/include/linux/usb/irda.h b/include/linux/usb/irda.h +index 396d2b043e64..556a801efce3 100644 +--- a/include/linux/usb/irda.h ++++ b/include/linux/usb/irda.h +@@ -119,11 +119,22 @@ struct usb_irda_cs_descriptor { + * 6 - 115200 bps + * 7 - 576000 bps + * 8 - 1.152 Mbps +- * 9 - 5 mbps ++ * 9 - 4 Mbps + * 10..15 - Reserved + */ + #define USB_IRDA_STATUS_LINK_SPEED 0x0f + ++#define USB_IRDA_LS_NO_CHANGE 0 ++#define USB_IRDA_LS_2400 1 ++#define USB_IRDA_LS_9600 2 ++#define USB_IRDA_LS_19200 3 ++#define USB_IRDA_LS_38400 4 ++#define USB_IRDA_LS_57600 5 ++#define USB_IRDA_LS_115200 6 ++#define USB_IRDA_LS_576000 7 ++#define USB_IRDA_LS_1152000 8 ++#define USB_IRDA_LS_4000000 9 ++ + /* The following is a 4-bit value used only for + * outbound header: + * +diff --git a/include/media/dvb-usb-ids.h b/include/media/dvb-usb-ids.h +index 7ce4e8332421..1409230ad3a4 100644 +--- a/include/media/dvb-usb-ids.h ++++ b/include/media/dvb-usb-ids.h +@@ -389,6 +389,7 @@ + #define USB_PID_MYGICA_T230 0xc688 + #define USB_PID_MYGICA_T230C 0xc689 + #define USB_PID_MYGICA_T230C2 0xc68a ++#define USB_PID_MYGICA_T230C_LITE 0xc699 + #define USB_PID_ELGATO_EYETV_DIVERSITY 0x0011 + #define USB_PID_ELGATO_EYETV_DTT 0x0021 + #define USB_PID_ELGATO_EYETV_DTT_2 0x003f +diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h +index e553fc80eb23..9976ad2f54fd 100644 +--- a/include/net/pkt_cls.h ++++ b/include/net/pkt_cls.h +@@ -141,31 +141,38 @@ __cls_set_class(unsigned long *clp, unsigned long cl) + return xchg(clp, cl); + } + +-static inline unsigned long +-cls_set_class(struct Qdisc *q, unsigned long *clp, unsigned long cl) ++static inline void ++__tcf_bind_filter(struct Qdisc *q, struct tcf_result *r, unsigned long base) + { +- unsigned long old_cl; ++ unsigned long cl; + +- sch_tree_lock(q); +- old_cl = __cls_set_class(clp, cl); +- sch_tree_unlock(q); +- return old_cl; ++ cl = q->ops->cl_ops->bind_tcf(q, base, r->classid); ++ cl = __cls_set_class(&r->class, cl); ++ if (cl) ++ q->ops->cl_ops->unbind_tcf(q, cl); + } + + static inline void + tcf_bind_filter(struct tcf_proto *tp, struct tcf_result *r, unsigned long base) + { + struct Qdisc *q = tp->chain->block->q; +- unsigned long cl; + + /* Check q as it is not set for shared blocks. In that case, + * setting class is not supported. + */ + if (!q) + return; +- cl = q->ops->cl_ops->bind_tcf(q, base, r->classid); +- cl = cls_set_class(q, &r->class, cl); +- if (cl) ++ sch_tree_lock(q); ++ __tcf_bind_filter(q, r, base); ++ sch_tree_unlock(q); ++} ++ ++static inline void ++__tcf_unbind_filter(struct Qdisc *q, struct tcf_result *r) ++{ ++ unsigned long cl; ++ ++ if ((cl = __cls_set_class(&r->class, 0)) != 0) + q->ops->cl_ops->unbind_tcf(q, cl); + } + +@@ -173,12 +180,10 @@ static inline void + tcf_unbind_filter(struct tcf_proto *tp, struct tcf_result *r) + { + struct Qdisc *q = tp->chain->block->q; +- unsigned long cl; + + if (!q) + return; +- if ((cl = __cls_set_class(&r->class, 0)) != 0) +- q->ops->cl_ops->unbind_tcf(q, cl); ++ __tcf_unbind_filter(q, r); + } + + struct tcf_exts { +diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h +index 32e418dba133..d334e4609dd4 100644 +--- a/include/net/sch_generic.h ++++ b/include/net/sch_generic.h +@@ -318,7 +318,8 @@ struct tcf_proto_ops { + void *type_data); + void (*hw_del)(struct tcf_proto *tp, + void *type_data); +- void (*bind_class)(void *, u32, unsigned long); ++ void (*bind_class)(void *, u32, unsigned long, ++ void *, unsigned long); + void * (*tmplt_create)(struct net *net, + struct tcf_chain *chain, + struct nlattr **tca, +diff --git a/include/net/udp.h b/include/net/udp.h +index bad74f780831..8f163d674f07 100644 +--- a/include/net/udp.h ++++ b/include/net/udp.h +@@ -476,6 +476,9 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk, + if (!inet_get_convert_csum(sk)) + features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + ++ if (skb->pkt_type == PACKET_LOOPBACK) ++ skb->ip_summed = CHECKSUM_PARTIAL; ++ + /* the GSO CB lays after the UDP one, no need to save and restore any + * CB fragment + */ +diff --git a/init/Kconfig b/init/Kconfig +index b4daad2bac23..0328b53d09ad 100644 +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -54,6 +54,7 @@ config CC_DISABLE_WARN_MAYBE_UNINITIALIZED + + config CONSTRUCTORS + bool ++ depends on !UML + + config IRQ_WORK + bool +diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig +index 060e8e726755..3941a9c48f83 100644 +--- a/kernel/gcov/Kconfig ++++ b/kernel/gcov/Kconfig +@@ -4,7 +4,7 @@ menu "GCOV-based kernel profiling" + config GCOV_KERNEL + bool "Enable gcov-based kernel profiling" + depends on DEBUG_FS +- select CONSTRUCTORS ++ select CONSTRUCTORS if !UML + default n + ---help--- + This option enables gcov-based code profiling (e.g. for code coverage +diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c +index fc34fd1668d6..3737d32ad11a 100644 +--- a/net/ipv4/nexthop.c ++++ b/net/ipv4/nexthop.c +@@ -322,7 +322,9 @@ static size_t nh_nlmsg_size_single(struct nexthop *nh) + + static size_t nh_nlmsg_size(struct nexthop *nh) + { +- size_t sz = nla_total_size(4); /* NHA_ID */ ++ size_t sz = NLMSG_ALIGN(sizeof(struct nhmsg)); ++ ++ sz += nla_total_size(4); /* NHA_ID */ + + if (nh->is_group) + sz += nh_nlmsg_size_grp(nh); +diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c +index 86bd133b4fa0..96d54e5bf7bc 100644 +--- a/net/rxrpc/input.c ++++ b/net/rxrpc/input.c +@@ -413,7 +413,7 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) + { + struct rxrpc_skb_priv *sp = rxrpc_skb(skb); + enum rxrpc_call_state state; +- unsigned int j; ++ unsigned int j, nr_subpackets; + rxrpc_serial_t serial = sp->hdr.serial, ack_serial = 0; + rxrpc_seq_t seq0 = sp->hdr.seq, hard_ack; + bool immediate_ack = false, jumbo_bad = false; +@@ -457,7 +457,8 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) + call->ackr_prev_seq = seq0; + hard_ack = READ_ONCE(call->rx_hard_ack); + +- if (sp->nr_subpackets > 1) { ++ nr_subpackets = sp->nr_subpackets; ++ if (nr_subpackets > 1) { + if (call->nr_jumbo_bad > 3) { + ack = RXRPC_ACK_NOSPACE; + ack_serial = serial; +@@ -465,11 +466,11 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) + } + } + +- for (j = 0; j < sp->nr_subpackets; j++) { ++ for (j = 0; j < nr_subpackets; j++) { + rxrpc_serial_t serial = sp->hdr.serial + j; + rxrpc_seq_t seq = seq0 + j; + unsigned int ix = seq & RXRPC_RXTX_BUFF_MASK; +- bool terminal = (j == sp->nr_subpackets - 1); ++ bool terminal = (j == nr_subpackets - 1); + bool last = terminal && (sp->rx_flags & RXRPC_SKB_INCL_LAST); + u8 flags, annotation = j; + +@@ -506,7 +507,7 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) + } + + if (call->rxtx_buffer[ix]) { +- rxrpc_input_dup_data(call, seq, sp->nr_subpackets > 1, ++ rxrpc_input_dup_data(call, seq, nr_subpackets > 1, + &jumbo_bad); + if (ack != RXRPC_ACK_DUPLICATE) { + ack = RXRPC_ACK_DUPLICATE; +@@ -564,6 +565,7 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) + * ring. + */ + skb = NULL; ++ sp = NULL; + } + + if (last) { +diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c +index 4aafbe3d435c..f256a7c69093 100644 +--- a/net/sched/cls_basic.c ++++ b/net/sched/cls_basic.c +@@ -263,12 +263,17 @@ skip: + } + } + +-static void basic_bind_class(void *fh, u32 classid, unsigned long cl) ++static void basic_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct basic_filter *f = fh; + +- if (f && f->res.classid == classid) +- f->res.class = cl; ++ if (f && f->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &f->res, base); ++ else ++ __tcf_unbind_filter(q, &f->res); ++ } + } + + static int basic_dump(struct net *net, struct tcf_proto *tp, void *fh, +diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c +index 8229ed4a67be..6e3e63db0e01 100644 +--- a/net/sched/cls_bpf.c ++++ b/net/sched/cls_bpf.c +@@ -631,12 +631,17 @@ nla_put_failure: + return -1; + } + +-static void cls_bpf_bind_class(void *fh, u32 classid, unsigned long cl) ++static void cls_bpf_bind_class(void *fh, u32 classid, unsigned long cl, ++ void *q, unsigned long base) + { + struct cls_bpf_prog *prog = fh; + +- if (prog && prog->res.classid == classid) +- prog->res.class = cl; ++ if (prog && prog->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &prog->res, base); ++ else ++ __tcf_unbind_filter(q, &prog->res); ++ } + } + + static void cls_bpf_walk(struct tcf_proto *tp, struct tcf_walker *arg, +diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c +index 5cf8163710c8..7394e01c0c9c 100644 +--- a/net/sched/cls_flower.c ++++ b/net/sched/cls_flower.c +@@ -2511,12 +2511,17 @@ nla_put_failure: + return -EMSGSIZE; + } + +-static void fl_bind_class(void *fh, u32 classid, unsigned long cl) ++static void fl_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct cls_fl_filter *f = fh; + +- if (f && f->res.classid == classid) +- f->res.class = cl; ++ if (f && f->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &f->res, base); ++ else ++ __tcf_unbind_filter(q, &f->res); ++ } + } + + static bool fl_delete_empty(struct tcf_proto *tp) +diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c +index c9496c920d6f..ec945294626a 100644 +--- a/net/sched/cls_fw.c ++++ b/net/sched/cls_fw.c +@@ -419,12 +419,17 @@ nla_put_failure: + return -1; + } + +-static void fw_bind_class(void *fh, u32 classid, unsigned long cl) ++static void fw_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct fw_filter *f = fh; + +- if (f && f->res.classid == classid) +- f->res.class = cl; ++ if (f && f->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &f->res, base); ++ else ++ __tcf_unbind_filter(q, &f->res); ++ } + } + + static struct tcf_proto_ops cls_fw_ops __read_mostly = { +diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c +index 7fc2eb62aa98..039cc86974f4 100644 +--- a/net/sched/cls_matchall.c ++++ b/net/sched/cls_matchall.c +@@ -393,12 +393,17 @@ nla_put_failure: + return -1; + } + +-static void mall_bind_class(void *fh, u32 classid, unsigned long cl) ++static void mall_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct cls_mall_head *head = fh; + +- if (head && head->res.classid == classid) +- head->res.class = cl; ++ if (head && head->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &head->res, base); ++ else ++ __tcf_unbind_filter(q, &head->res); ++ } + } + + static struct tcf_proto_ops cls_mall_ops __read_mostly = { +diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c +index 2d9e0b4484ea..6f8786b06bde 100644 +--- a/net/sched/cls_route.c ++++ b/net/sched/cls_route.c +@@ -641,12 +641,17 @@ nla_put_failure: + return -1; + } + +-static void route4_bind_class(void *fh, u32 classid, unsigned long cl) ++static void route4_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct route4_filter *f = fh; + +- if (f && f->res.classid == classid) +- f->res.class = cl; ++ if (f && f->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &f->res, base); ++ else ++ __tcf_unbind_filter(q, &f->res); ++ } + } + + static struct tcf_proto_ops cls_route4_ops __read_mostly = { +diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h +index 2f3c03b25d5d..c22624131949 100644 +--- a/net/sched/cls_rsvp.h ++++ b/net/sched/cls_rsvp.h +@@ -738,12 +738,17 @@ nla_put_failure: + return -1; + } + +-static void rsvp_bind_class(void *fh, u32 classid, unsigned long cl) ++static void rsvp_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct rsvp_filter *f = fh; + +- if (f && f->res.classid == classid) +- f->res.class = cl; ++ if (f && f->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &f->res, base); ++ else ++ __tcf_unbind_filter(q, &f->res); ++ } + } + + static struct tcf_proto_ops RSVP_OPS __read_mostly = { +diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c +index e573e5a5c794..3d4a1280352f 100644 +--- a/net/sched/cls_tcindex.c ++++ b/net/sched/cls_tcindex.c +@@ -654,12 +654,17 @@ nla_put_failure: + return -1; + } + +-static void tcindex_bind_class(void *fh, u32 classid, unsigned long cl) ++static void tcindex_bind_class(void *fh, u32 classid, unsigned long cl, ++ void *q, unsigned long base) + { + struct tcindex_filter_result *r = fh; + +- if (r && r->res.classid == classid) +- r->res.class = cl; ++ if (r && r->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &r->res, base); ++ else ++ __tcf_unbind_filter(q, &r->res); ++ } + } + + static struct tcf_proto_ops cls_tcindex_ops __read_mostly = { +diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c +index a0e6fac613de..e15ff335953d 100644 +--- a/net/sched/cls_u32.c ++++ b/net/sched/cls_u32.c +@@ -1255,12 +1255,17 @@ static int u32_reoffload(struct tcf_proto *tp, bool add, flow_setup_cb_t *cb, + return 0; + } + +-static void u32_bind_class(void *fh, u32 classid, unsigned long cl) ++static void u32_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct tc_u_knode *n = fh; + +- if (n && n->res.classid == classid) +- n->res.class = cl; ++ if (n && n->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &n->res, base); ++ else ++ __tcf_unbind_filter(q, &n->res); ++ } + } + + static int u32_dump(struct net *net, struct tcf_proto *tp, void *fh, +diff --git a/net/sched/ematch.c b/net/sched/ematch.c +index d0140a92694a..dd3b8c11a2e0 100644 +--- a/net/sched/ematch.c ++++ b/net/sched/ematch.c +@@ -238,6 +238,9 @@ static int tcf_em_validate(struct tcf_proto *tp, + goto errout; + + if (em->ops->change) { ++ err = -EINVAL; ++ if (em_hdr->flags & TCF_EM_SIMPLE) ++ goto errout; + err = em->ops->change(net, data, data_len, em); + if (err < 0) + goto errout; +diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c +index 1047825d9f48..50794125bf02 100644 +--- a/net/sched/sch_api.c ++++ b/net/sched/sch_api.c +@@ -1891,8 +1891,9 @@ static int tclass_del_notify(struct net *net, + + struct tcf_bind_args { + struct tcf_walker w; +- u32 classid; ++ unsigned long base; + unsigned long cl; ++ u32 classid; + }; + + static int tcf_node_bind(struct tcf_proto *tp, void *n, struct tcf_walker *arg) +@@ -1903,28 +1904,30 @@ static int tcf_node_bind(struct tcf_proto *tp, void *n, struct tcf_walker *arg) + struct Qdisc *q = tcf_block_q(tp->chain->block); + + sch_tree_lock(q); +- tp->ops->bind_class(n, a->classid, a->cl); ++ tp->ops->bind_class(n, a->classid, a->cl, q, a->base); + sch_tree_unlock(q); + } + return 0; + } + +-static void tc_bind_tclass(struct Qdisc *q, u32 portid, u32 clid, +- unsigned long new_cl) ++struct tc_bind_class_args { ++ struct qdisc_walker w; ++ unsigned long new_cl; ++ u32 portid; ++ u32 clid; ++}; ++ ++static int tc_bind_class_walker(struct Qdisc *q, unsigned long cl, ++ struct qdisc_walker *w) + { ++ struct tc_bind_class_args *a = (struct tc_bind_class_args *)w; + const struct Qdisc_class_ops *cops = q->ops->cl_ops; + struct tcf_block *block; + struct tcf_chain *chain; +- unsigned long cl; + +- cl = cops->find(q, portid); +- if (!cl) +- return; +- if (!cops->tcf_block) +- return; + block = cops->tcf_block(q, cl, NULL); + if (!block) +- return; ++ return 0; + for (chain = tcf_get_next_chain(block, NULL); + chain; + chain = tcf_get_next_chain(block, chain)) { +@@ -1935,11 +1938,29 @@ static void tc_bind_tclass(struct Qdisc *q, u32 portid, u32 clid, + struct tcf_bind_args arg = {}; + + arg.w.fn = tcf_node_bind; +- arg.classid = clid; +- arg.cl = new_cl; ++ arg.classid = a->clid; ++ arg.base = cl; ++ arg.cl = a->new_cl; + tp->ops->walk(tp, &arg.w, true); + } + } ++ ++ return 0; ++} ++ ++static void tc_bind_tclass(struct Qdisc *q, u32 portid, u32 clid, ++ unsigned long new_cl) ++{ ++ const struct Qdisc_class_ops *cops = q->ops->cl_ops; ++ struct tc_bind_class_args args = {}; ++ ++ if (!cops->tcf_block) ++ return; ++ args.portid = portid; ++ args.clid = clid; ++ args.new_cl = new_cl; ++ args.w.fn = tc_bind_class_walker; ++ q->ops->cl_ops->walk(q, &args.w); + } + + #else +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index d293488dc3dd..68832f52c1ad 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -7563,20 +7563,6 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { + {0x19, 0x02a11020}, + {0x1a, 0x02a11030}, + {0x21, 0x0221101f}), +- SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, +- {0x12, 0x90a60140}, +- {0x14, 0x90170110}, +- {0x21, 0x02211020}), +- SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, +- {0x12, 0x90a60140}, +- {0x14, 0x90170150}, +- {0x21, 0x02211020}), +- SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, +- {0x21, 0x02211020}), +- SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, +- {0x12, 0x40000000}, +- {0x14, 0x90170110}, +- {0x21, 0x02211020}), + SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, + {0x14, 0x90170110}, + {0x21, 0x02211020}), +@@ -7901,6 +7887,9 @@ static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = { + SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, + {0x19, 0x40000000}, + {0x1a, 0x40000000}), ++ SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, ++ {0x19, 0x40000000}, ++ {0x1a, 0x40000000}), + {} + }; + +diff --git a/sound/soc/fsl/fsl_audmix.c b/sound/soc/fsl/fsl_audmix.c +index a1db1bce330f..5faecbeb5497 100644 +--- a/sound/soc/fsl/fsl_audmix.c ++++ b/sound/soc/fsl/fsl_audmix.c +@@ -505,15 +505,20 @@ static int fsl_audmix_probe(struct platform_device *pdev) + ARRAY_SIZE(fsl_audmix_dai)); + if (ret) { + dev_err(dev, "failed to register ASoC DAI\n"); +- return ret; ++ goto err_disable_pm; + } + + priv->pdev = platform_device_register_data(dev, mdrv, 0, NULL, 0); + if (IS_ERR(priv->pdev)) { + ret = PTR_ERR(priv->pdev); + dev_err(dev, "failed to register platform %s: %d\n", mdrv, ret); ++ goto err_disable_pm; + } + ++ return 0; ++ ++err_disable_pm: ++ pm_runtime_disable(dev); + return ret; + } + +@@ -521,6 +526,8 @@ static int fsl_audmix_remove(struct platform_device *pdev) + { + struct fsl_audmix *priv = dev_get_drvdata(&pdev->dev); + ++ pm_runtime_disable(&pdev->dev); ++ + if (priv->pdev) + platform_device_unregister(priv->pdev); + +diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c +index 8879c3be29d5..c68a5b85a4a0 100644 +--- a/sound/soc/intel/boards/cht_bsw_rt5645.c ++++ b/sound/soc/intel/boards/cht_bsw_rt5645.c +@@ -48,6 +48,7 @@ struct cht_mc_private { + #define CHT_RT5645_SSP2_AIF2 BIT(16) /* default is using AIF1 */ + #define CHT_RT5645_SSP0_AIF1 BIT(17) + #define CHT_RT5645_SSP0_AIF2 BIT(18) ++#define CHT_RT5645_PMC_PLT_CLK_0 BIT(19) + + static unsigned long cht_rt5645_quirk = 0; + +@@ -59,6 +60,8 @@ static void log_quirks(struct device *dev) + dev_info(dev, "quirk SSP0_AIF1 enabled"); + if (cht_rt5645_quirk & CHT_RT5645_SSP0_AIF2) + dev_info(dev, "quirk SSP0_AIF2 enabled"); ++ if (cht_rt5645_quirk & CHT_RT5645_PMC_PLT_CLK_0) ++ dev_info(dev, "quirk PMC_PLT_CLK_0 enabled"); + } + + static int platform_clock_control(struct snd_soc_dapm_widget *w, +@@ -226,15 +229,21 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream, + return 0; + } + +-/* uncomment when we have a real quirk + static int cht_rt5645_quirk_cb(const struct dmi_system_id *id) + { + cht_rt5645_quirk = (unsigned long)id->driver_data; + return 1; + } +-*/ + + static const struct dmi_system_id cht_rt5645_quirk_table[] = { ++ { ++ /* Strago family Chromebooks */ ++ .callback = cht_rt5645_quirk_cb, ++ .matches = { ++ DMI_MATCH(DMI_PRODUCT_FAMILY, "Intel_Strago"), ++ }, ++ .driver_data = (void *)CHT_RT5645_PMC_PLT_CLK_0, ++ }, + { + }, + }; +@@ -526,6 +535,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) + int dai_index = 0; + int ret_val = 0; + int i; ++ const char *mclk_name; + + drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); + if (!drv) +@@ -662,11 +672,15 @@ static int snd_cht_mc_probe(struct platform_device *pdev) + if (ret_val) + return ret_val; + +- drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); ++ if (cht_rt5645_quirk & CHT_RT5645_PMC_PLT_CLK_0) ++ mclk_name = "pmc_plt_clk_0"; ++ else ++ mclk_name = "pmc_plt_clk_3"; ++ ++ drv->mclk = devm_clk_get(&pdev->dev, mclk_name); + if (IS_ERR(drv->mclk)) { +- dev_err(&pdev->dev, +- "Failed to get MCLK from pmc_plt_clk_3: %ld\n", +- PTR_ERR(drv->mclk)); ++ dev_err(&pdev->dev, "Failed to get MCLK from %s: %ld\n", ++ mclk_name, PTR_ERR(drv->mclk)); + return PTR_ERR(drv->mclk); + } + +diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c +index fd2d22ddc81b..7ccbca47240d 100644 +--- a/sound/soc/soc-topology.c ++++ b/sound/soc/soc-topology.c +@@ -548,12 +548,12 @@ static void remove_link(struct snd_soc_component *comp, + if (dobj->ops && dobj->ops->link_unload) + dobj->ops->link_unload(comp, dobj); + ++ list_del(&dobj->list); ++ snd_soc_remove_dai_link(comp->card, link); ++ + kfree(link->name); + kfree(link->stream_name); + kfree(link->cpus->dai_name); +- +- list_del(&dobj->list); +- snd_soc_remove_dai_link(comp->card, link); + kfree(link); + } + +diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c +index 8796f385be76..896d21984b73 100644 +--- a/sound/soc/sof/intel/hda-dai.c ++++ b/sound/soc/sof/intel/hda-dai.c +@@ -216,6 +216,8 @@ static int hda_link_hw_params(struct snd_pcm_substream *substream, + link_dev = hda_link_stream_assign(bus, substream); + if (!link_dev) + return -EBUSY; ++ ++ snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev); + } + + stream_tag = hdac_stream(link_dev)->stream_tag; +@@ -228,8 +230,6 @@ static int hda_link_hw_params(struct snd_pcm_substream *substream, + if (ret < 0) + return ret; + +- snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev); +- + link = snd_hdac_ext_bus_get_link(bus, codec_dai->component->name); + if (!link) + return -EINVAL; +@@ -361,6 +361,13 @@ static int hda_link_hw_free(struct snd_pcm_substream *substream, + bus = hstream->bus; + rtd = snd_pcm_substream_chip(substream); + link_dev = snd_soc_dai_get_dma_data(dai, substream); ++ ++ if (!link_dev) { ++ dev_dbg(dai->dev, ++ "%s: link_dev is not assigned\n", __func__); ++ return -EINVAL; ++ } ++ + hda_stream = hstream_to_sof_hda_stream(link_dev); + + /* free the link DMA channel in the FW */ +diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c +index 086eeeab8679..7b6d69783e16 100644 +--- a/sound/soc/sof/ipc.c ++++ b/sound/soc/sof/ipc.c +@@ -834,6 +834,9 @@ void snd_sof_ipc_free(struct snd_sof_dev *sdev) + { + struct snd_sof_ipc *ipc = sdev->ipc; + ++ if (!ipc) ++ return; ++ + /* disable sending of ipc's */ + mutex_lock(&ipc->tx_mutex); + ipc->disable_ipc_tx = true; +diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h +index 54a50699bbfd..9f77cbaac01c 100644 +--- a/tools/testing/selftests/bpf/bpf_helpers.h ++++ b/tools/testing/selftests/bpf/bpf_helpers.h +@@ -3,7 +3,7 @@ + #define __BPF_HELPERS__ + + #define __uint(name, val) int (*name)[val] +-#define __type(name, val) val *name ++#define __type(name, val) typeof(val) *name + + /* helper macro to print out debug messages */ + #define bpf_printk(fmt, ...) \ +diff --git a/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c b/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c +index f8ffa3f3d44b..6cc4479ac9df 100644 +--- a/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c ++++ b/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c +@@ -47,12 +47,11 @@ struct { + * issue and avoid complicated C programming massaging. + * This is an acceptable workaround since there is one entry here. + */ +-typedef __u64 raw_stack_trace_t[2 * MAX_STACK_RAWTP]; + struct { + __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); + __uint(max_entries, 1); + __type(key, __u32); +- __type(value, raw_stack_trace_t); ++ __type(value, __u64[2 * MAX_STACK_RAWTP]); + } rawdata_map SEC(".maps"); + + SEC("raw_tracepoint/sys_enter") diff --git a/patch/kernel/sunxi-current/patch-5.4.17-18.patch b/patch/kernel/sunxi-current/patch-5.4.17-18.patch new file mode 100644 index 0000000000..aa79549ab6 --- /dev/null +++ b/patch/kernel/sunxi-current/patch-5.4.17-18.patch @@ -0,0 +1,3992 @@ +diff --git a/Documentation/ABI/testing/sysfs-class-devfreq b/Documentation/ABI/testing/sysfs-class-devfreq +index 01196e19afca..75897e2fde43 100644 +--- a/Documentation/ABI/testing/sysfs-class-devfreq ++++ b/Documentation/ABI/testing/sysfs-class-devfreq +@@ -7,6 +7,13 @@ Description: + The name of devfreq object denoted as ... is same as the + name of device using devfreq. + ++What: /sys/class/devfreq/.../name ++Date: November 2019 ++Contact: Chanwoo Choi ++Description: ++ The /sys/class/devfreq/.../name shows the name of device ++ of the corresponding devfreq object. ++ + What: /sys/class/devfreq/.../governor + Date: September 2011 + Contact: MyungJoo Ham +diff --git a/Makefile b/Makefile +index a363a539a092..b6c151fd5227 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 17 ++SUBLEVEL = 18 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/arm/boot/dts/am335x-boneblack-common.dtsi b/arch/arm/boot/dts/am335x-boneblack-common.dtsi +index 7ad079861efd..91f93bc89716 100644 +--- a/arch/arm/boot/dts/am335x-boneblack-common.dtsi ++++ b/arch/arm/boot/dts/am335x-boneblack-common.dtsi +@@ -131,6 +131,11 @@ + }; + + / { ++ memory@80000000 { ++ device_type = "memory"; ++ reg = <0x80000000 0x20000000>; /* 512 MB */ ++ }; ++ + clk_mcasp0_fixed: clk_mcasp0_fixed { + #clock-cells = <0>; + compatible = "fixed-clock"; +diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts +index 078cb473fa7d..a6fbc088daa8 100644 +--- a/arch/arm/boot/dts/am43x-epos-evm.dts ++++ b/arch/arm/boot/dts/am43x-epos-evm.dts +@@ -848,6 +848,7 @@ + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&spi0_pins_default>; + pinctrl-1 = <&spi0_pins_sleep>; ++ ti,pindir-d0-out-d1-in = <1>; + }; + + &spi1 { +@@ -855,6 +856,7 @@ + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&spi1_pins_default>; + pinctrl-1 = <&spi1_pins_sleep>; ++ ti,pindir-d0-out-d1-in = <1>; + }; + + &usb2_phy1 { +diff --git a/arch/arm/boot/dts/am571x-idk.dts b/arch/arm/boot/dts/am571x-idk.dts +index 9d6a872c2b23..10105a497c1a 100644 +--- a/arch/arm/boot/dts/am571x-idk.dts ++++ b/arch/arm/boot/dts/am571x-idk.dts +@@ -170,10 +170,6 @@ + gpios = <&gpio5 18 GPIO_ACTIVE_HIGH>; + }; + +-&pcie1_ep { +- gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; +-}; +- + &mmc1 { + pinctrl-names = "default", "hs"; + pinctrl-0 = <&mmc1_pins_default_no_clk_pu>; +diff --git a/arch/arm/boot/dts/am572x-idk-common.dtsi b/arch/arm/boot/dts/am572x-idk-common.dtsi +index a064f13b3880..ddf123620e96 100644 +--- a/arch/arm/boot/dts/am572x-idk-common.dtsi ++++ b/arch/arm/boot/dts/am572x-idk-common.dtsi +@@ -147,10 +147,6 @@ + gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; + }; + +-&pcie1_ep { +- gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; +-}; +- + &mailbox5 { + status = "okay"; + mbox_ipu1_ipc3x: mbox_ipu1_ipc3x { +diff --git a/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi b/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi +index bc76f1705c0f..a813a0cf3ff3 100644 +--- a/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi ++++ b/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi +@@ -29,6 +29,27 @@ + reg = <0x0 0x80000000 0x0 0x80000000>; + }; + ++ main_12v0: fixedregulator-main_12v0 { ++ /* main supply */ ++ compatible = "regulator-fixed"; ++ regulator-name = "main_12v0"; ++ regulator-min-microvolt = <12000000>; ++ regulator-max-microvolt = <12000000>; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ evm_5v0: fixedregulator-evm_5v0 { ++ /* Output of TPS54531D */ ++ compatible = "regulator-fixed"; ++ regulator-name = "evm_5v0"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&main_12v0>; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ + vdd_3v3: fixedregulator-vdd_3v3 { + compatible = "regulator-fixed"; + regulator-name = "vdd_3v3"; +@@ -547,10 +568,6 @@ + gpios = <&gpio2 8 GPIO_ACTIVE_LOW>; + }; + +-&pcie1_ep { +- gpios = <&gpio2 8 GPIO_ACTIVE_LOW>; +-}; +- + &mcasp3 { + #sound-dai-cells = <0>; + assigned-clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 24>; +diff --git a/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts b/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts +index fb928503ad45..d9be511f054f 100644 +--- a/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts ++++ b/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts +@@ -101,7 +101,7 @@ + initial-mode = <1>; /* initialize in HUB mode */ + disabled-ports = <1>; + intn-gpios = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */ +- reset-gpios = <&pio 4 16 GPIO_ACTIVE_HIGH>; /* PE16 */ ++ reset-gpios = <&pio 4 16 GPIO_ACTIVE_LOW>; /* PE16 */ + connect-gpios = <&pio 4 17 GPIO_ACTIVE_HIGH>; /* PE17 */ + refclk-frequency = <19200000>; + }; +diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S +index ae5020302de4..6607fa817bba 100644 +--- a/arch/arm/kernel/hyp-stub.S ++++ b/arch/arm/kernel/hyp-stub.S +@@ -146,10 +146,9 @@ ARM_BE8(orr r7, r7, #(1 << 25)) @ HSCTLR.EE + #if !defined(ZIMAGE) && defined(CONFIG_ARM_ARCH_TIMER) + @ make CNTP_* and CNTPCT accessible from PL1 + mrc p15, 0, r7, c0, c1, 1 @ ID_PFR1 +- lsr r7, #16 +- and r7, #0xf +- cmp r7, #1 +- bne 1f ++ ubfx r7, r7, #16, #4 ++ teq r7, #0 ++ beq 1f + mrc p15, 4, r7, c14, c1, 0 @ CNTHCTL + orr r7, r7, #3 @ PL1PCEN | PL1PCTEN + mcr p15, 4, r7, c14, c1, 0 @ CNTHCTL +diff --git a/arch/arm64/boot/Makefile b/arch/arm64/boot/Makefile +index 1f012c506434..cd3414898d10 100644 +--- a/arch/arm64/boot/Makefile ++++ b/arch/arm64/boot/Makefile +@@ -16,7 +16,7 @@ + + OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S + +-targets := Image Image.gz ++targets := Image Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo + + $(obj)/Image: vmlinux FORCE + $(call if_changed,objcopy) +diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts +index 3435aaa4e8db..5d6a8dafe8dc 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts +@@ -361,6 +361,8 @@ + + bluetooth { + compatible = "brcm,bcm43438-bt"; ++ interrupt-parent = <&gpio_intc>; ++ interrupts = <95 IRQ_TYPE_LEVEL_HIGH>; + shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; + max-speed = <2000000>; + clocks = <&wifi32k>; +diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c +index a6c9f49c6612..a5f3e50fe976 100644 +--- a/arch/parisc/kernel/drivers.c ++++ b/arch/parisc/kernel/drivers.c +@@ -889,8 +889,8 @@ static void print_parisc_device(struct parisc_device *dev) + static int count; + + print_pa_hwpath(dev, hw_path); +- pr_info("%d. %s at 0x%px [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }", +- ++count, dev->name, (void*) dev->hpa.start, hw_path, dev->id.hw_type, ++ pr_info("%d. %s at %pap [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }", ++ ++count, dev->name, &(dev->hpa.start), hw_path, dev->id.hw_type, + dev->id.hversion_rev, dev->id.hversion, dev->id.sversion); + + if (dev->num_addrs) { +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi +index e1a961f05dcd..baa0c503e741 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi +@@ -63,6 +63,7 @@ fman@400000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe1000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy0: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi +index c288f3c6c637..93095600e808 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi +@@ -60,6 +60,7 @@ fman@400000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xf1000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy6: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi +index 94f3e7175012..ff4bd38f0645 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi +@@ -63,6 +63,7 @@ fman@400000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe3000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy1: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi +index 94a76982d214..1fa38ed6f59e 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi +@@ -60,6 +60,7 @@ fman@400000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xf3000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy7: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi +index b5ff5f71c6b8..a8cc9780c0c4 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi +@@ -59,6 +59,7 @@ fman@400000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe1000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy0: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi +index ee44182c6348..8b8bd70c9382 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi +@@ -59,6 +59,7 @@ fman@400000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe3000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy1: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi +index f05f0d775039..619c880b54d8 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi +@@ -59,6 +59,7 @@ fman@400000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe5000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy2: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi +index a9114ec51075..d7ebb73a400d 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi +@@ -59,6 +59,7 @@ fman@400000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe7000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy3: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi +index 44dd00ac7367..b151d696a069 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi +@@ -59,6 +59,7 @@ fman@400000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe9000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy4: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi +index 5b1b84b58602..adc0ae0013a3 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi +@@ -59,6 +59,7 @@ fman@400000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xeb000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy5: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi +index 0e1daaef9e74..435047e0e250 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi +@@ -60,6 +60,7 @@ fman@500000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xf1000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy14: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi +index 68c5ef779266..c098657cca0a 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi +@@ -60,6 +60,7 @@ fman@500000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xf3000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy15: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi +index 605363cc1117..9d06824815f3 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi +@@ -59,6 +59,7 @@ fman@500000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe1000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy8: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi +index 1955dfa13634..70e947730c4b 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi +@@ -59,6 +59,7 @@ fman@500000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe3000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy9: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi +index 2c1476454ee0..ad96e6529595 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi +@@ -59,6 +59,7 @@ fman@500000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe5000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy10: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi +index b8b541ff5fb0..034bc4b71f7a 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi +@@ -59,6 +59,7 @@ fman@500000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe7000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy11: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi +index 4b2cfddd1b15..93ca23d82b39 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi +@@ -59,6 +59,7 @@ fman@500000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe9000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy12: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi +index 0a52ddf7cc17..23b3117a2fd2 100644 +--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi +@@ -59,6 +59,7 @@ fman@500000 { + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xeb000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy13: ethernet-phy@0 { + reg = <0x0>; +diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile +index 49a5852fd07d..33b16f4212f7 100644 +--- a/arch/riscv/kernel/vdso/Makefile ++++ b/arch/riscv/kernel/vdso/Makefile +@@ -58,7 +58,8 @@ quiet_cmd_vdsold = VDSOLD $@ + cmd_vdsold = $(CC) $(KBUILD_CFLAGS) $(call cc-option, -no-pie) -nostdlib -nostartfiles $(SYSCFLAGS_$(@F)) \ + -Wl,-T,$(filter-out FORCE,$^) -o $@.tmp && \ + $(CROSS_COMPILE)objcopy \ +- $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ ++ $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \ ++ rm $@.tmp + + # install commands for the unstripped file + quiet_cmd_vdso_install = INSTALL $@ +diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c +index dbaa1b088a30..c37cb12d0ef6 100644 +--- a/arch/x86/events/intel/uncore_snb.c ++++ b/arch/x86/events/intel/uncore_snb.c +@@ -15,6 +15,7 @@ + #define PCI_DEVICE_ID_INTEL_SKL_HQ_IMC 0x1910 + #define PCI_DEVICE_ID_INTEL_SKL_SD_IMC 0x190f + #define PCI_DEVICE_ID_INTEL_SKL_SQ_IMC 0x191f ++#define PCI_DEVICE_ID_INTEL_SKL_E3_IMC 0x1918 + #define PCI_DEVICE_ID_INTEL_KBL_Y_IMC 0x590c + #define PCI_DEVICE_ID_INTEL_KBL_U_IMC 0x5904 + #define PCI_DEVICE_ID_INTEL_KBL_UQ_IMC 0x5914 +@@ -657,6 +658,10 @@ static const struct pci_device_id skl_uncore_pci_ids[] = { + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_SQ_IMC), + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), + }, ++ { /* IMC */ ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_E3_IMC), ++ .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), ++ }, + { /* IMC */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_Y_IMC), + .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), +@@ -826,6 +831,7 @@ static const struct imc_uncore_pci_dev desktop_imc_pci_ids[] = { + IMC_DEV(SKL_HQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core H Quad Core */ + IMC_DEV(SKL_SD_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Dual Core */ + IMC_DEV(SKL_SQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Quad Core */ ++ IMC_DEV(SKL_E3_IMC, &skl_uncore_pci_driver), /* Xeon E3 V5 Gen Core processor */ + IMC_DEV(KBL_Y_IMC, &skl_uncore_pci_driver), /* 7th Gen Core Y */ + IMC_DEV(KBL_U_IMC, &skl_uncore_pci_driver), /* 7th Gen Core U */ + IMC_DEV(KBL_UQ_IMC, &skl_uncore_pci_driver), /* 7th Gen Core U Quad Core */ +diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c +index 011644802ce7..ad20220af303 100644 +--- a/arch/x86/events/intel/uncore_snbep.c ++++ b/arch/x86/events/intel/uncore_snbep.c +@@ -369,11 +369,6 @@ + #define SNR_M2M_PCI_PMON_BOX_CTL 0x438 + #define SNR_M2M_PCI_PMON_UMASK_EXT 0xff + +-/* SNR PCIE3 */ +-#define SNR_PCIE3_PCI_PMON_CTL0 0x508 +-#define SNR_PCIE3_PCI_PMON_CTR0 0x4e8 +-#define SNR_PCIE3_PCI_PMON_BOX_CTL 0x4e4 +- + /* SNR IMC */ + #define SNR_IMC_MMIO_PMON_FIXED_CTL 0x54 + #define SNR_IMC_MMIO_PMON_FIXED_CTR 0x38 +@@ -4328,27 +4323,12 @@ static struct intel_uncore_type snr_uncore_m2m = { + .format_group = &snr_m2m_uncore_format_group, + }; + +-static struct intel_uncore_type snr_uncore_pcie3 = { +- .name = "pcie3", +- .num_counters = 4, +- .num_boxes = 1, +- .perf_ctr_bits = 48, +- .perf_ctr = SNR_PCIE3_PCI_PMON_CTR0, +- .event_ctl = SNR_PCIE3_PCI_PMON_CTL0, +- .event_mask = SNBEP_PMON_RAW_EVENT_MASK, +- .box_ctl = SNR_PCIE3_PCI_PMON_BOX_CTL, +- .ops = &ivbep_uncore_pci_ops, +- .format_group = &ivbep_uncore_format_group, +-}; +- + enum { + SNR_PCI_UNCORE_M2M, +- SNR_PCI_UNCORE_PCIE3, + }; + + static struct intel_uncore_type *snr_pci_uncores[] = { + [SNR_PCI_UNCORE_M2M] = &snr_uncore_m2m, +- [SNR_PCI_UNCORE_PCIE3] = &snr_uncore_pcie3, + NULL, + }; + +@@ -4357,10 +4337,6 @@ static const struct pci_device_id snr_uncore_pci_ids[] = { + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x344a), + .driver_data = UNCORE_PCI_DEV_FULL_DATA(12, 0, SNR_PCI_UNCORE_M2M, 0), + }, +- { /* PCIe3 */ +- PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x334a), +- .driver_data = UNCORE_PCI_DEV_FULL_DATA(4, 0, SNR_PCI_UNCORE_PCIE3, 0), +- }, + { /* end: all zeroes */ } + }; + +diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c +index dac7209a0708..954fd048ad9b 100644 +--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c ++++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c +@@ -1970,7 +1970,7 @@ static int rdt_get_tree(struct fs_context *fc) + + if (rdt_mon_capable) { + ret = mongroup_create_dir(rdtgroup_default.kn, +- NULL, "mon_groups", ++ &rdtgroup_default, "mon_groups", + &kn_mongrp); + if (ret < 0) + goto out_info; +@@ -2205,7 +2205,11 @@ static void free_all_child_rdtgrp(struct rdtgroup *rdtgrp) + list_for_each_entry_safe(sentry, stmp, head, mon.crdtgrp_list) { + free_rmid(sentry->mon.rmid); + list_del(&sentry->mon.crdtgrp_list); +- kfree(sentry); ++ ++ if (atomic_read(&sentry->waitcount) != 0) ++ sentry->flags = RDT_DELETED; ++ else ++ kfree(sentry); + } + } + +@@ -2243,7 +2247,11 @@ static void rmdir_all_sub(void) + + kernfs_remove(rdtgrp->kn); + list_del(&rdtgrp->rdtgroup_list); +- kfree(rdtgrp); ++ ++ if (atomic_read(&rdtgrp->waitcount) != 0) ++ rdtgrp->flags = RDT_DELETED; ++ else ++ kfree(rdtgrp); + } + /* Notify online CPUs to update per cpu storage and PQR_ASSOC MSR */ + update_closid_rmid(cpu_online_mask, &rdtgroup_default); +@@ -2446,7 +2454,7 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn, + /* + * Create the mon_data directory first. + */ +- ret = mongroup_create_dir(parent_kn, NULL, "mon_data", &kn); ++ ret = mongroup_create_dir(parent_kn, prgrp, "mon_data", &kn); + if (ret) + return ret; + +@@ -2645,7 +2653,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, + uint files = 0; + int ret; + +- prdtgrp = rdtgroup_kn_lock_live(prgrp_kn); ++ prdtgrp = rdtgroup_kn_lock_live(parent_kn); + if (!prdtgrp) { + ret = -ENODEV; + goto out_unlock; +@@ -2718,7 +2726,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, + kernfs_activate(kn); + + /* +- * The caller unlocks the prgrp_kn upon success. ++ * The caller unlocks the parent_kn upon success. + */ + return 0; + +@@ -2729,7 +2737,7 @@ out_destroy: + out_free_rgrp: + kfree(rdtgrp); + out_unlock: +- rdtgroup_kn_unlock(prgrp_kn); ++ rdtgroup_kn_unlock(parent_kn); + return ret; + } + +@@ -2767,7 +2775,7 @@ static int rdtgroup_mkdir_mon(struct kernfs_node *parent_kn, + */ + list_add_tail(&rdtgrp->mon.crdtgrp_list, &prgrp->mon.crdtgrp_list); + +- rdtgroup_kn_unlock(prgrp_kn); ++ rdtgroup_kn_unlock(parent_kn); + return ret; + } + +@@ -2810,7 +2818,7 @@ static int rdtgroup_mkdir_ctrl_mon(struct kernfs_node *parent_kn, + * Create an empty mon_groups directory to hold the subset + * of tasks and cpus to monitor. + */ +- ret = mongroup_create_dir(kn, NULL, "mon_groups", NULL); ++ ret = mongroup_create_dir(kn, rdtgrp, "mon_groups", NULL); + if (ret) { + rdt_last_cmd_puts("kernfs subdir error\n"); + goto out_del_list; +@@ -2826,7 +2834,7 @@ out_id_free: + out_common_fail: + mkdir_rdt_prepare_clean(rdtgrp); + out_unlock: +- rdtgroup_kn_unlock(prgrp_kn); ++ rdtgroup_kn_unlock(parent_kn); + return ret; + } + +@@ -2952,13 +2960,13 @@ static int rdtgroup_rmdir_ctrl(struct kernfs_node *kn, struct rdtgroup *rdtgrp, + closid_free(rdtgrp->closid); + free_rmid(rdtgrp->mon.rmid); + ++ rdtgroup_ctrl_remove(kn, rdtgrp); ++ + /* + * Free all the child monitor group rmids. + */ + free_all_child_rdtgrp(rdtgrp); + +- rdtgroup_ctrl_remove(kn, rdtgrp); +- + return 0; + } + +diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c +index 4f24e46ebe7c..56db949a7b70 100644 +--- a/drivers/char/ttyprintk.c ++++ b/drivers/char/ttyprintk.c +@@ -15,10 +15,11 @@ + #include + #include + #include ++#include + + struct ttyprintk_port { + struct tty_port port; +- struct mutex port_write_mutex; ++ spinlock_t spinlock; + }; + + static struct ttyprintk_port tpk_port; +@@ -99,11 +100,12 @@ static int tpk_open(struct tty_struct *tty, struct file *filp) + static void tpk_close(struct tty_struct *tty, struct file *filp) + { + struct ttyprintk_port *tpkp = tty->driver_data; ++ unsigned long flags; + +- mutex_lock(&tpkp->port_write_mutex); ++ spin_lock_irqsave(&tpkp->spinlock, flags); + /* flush tpk_printk buffer */ + tpk_printk(NULL, 0); +- mutex_unlock(&tpkp->port_write_mutex); ++ spin_unlock_irqrestore(&tpkp->spinlock, flags); + + tty_port_close(&tpkp->port, tty, filp); + } +@@ -115,13 +117,14 @@ static int tpk_write(struct tty_struct *tty, + const unsigned char *buf, int count) + { + struct ttyprintk_port *tpkp = tty->driver_data; ++ unsigned long flags; + int ret; + + + /* exclusive use of tpk_printk within this tty */ +- mutex_lock(&tpkp->port_write_mutex); ++ spin_lock_irqsave(&tpkp->spinlock, flags); + ret = tpk_printk(buf, count); +- mutex_unlock(&tpkp->port_write_mutex); ++ spin_unlock_irqrestore(&tpkp->spinlock, flags); + + return ret; + } +@@ -171,7 +174,7 @@ static int __init ttyprintk_init(void) + { + int ret = -ENOMEM; + +- mutex_init(&tpk_port.port_write_mutex); ++ spin_lock_init(&tpk_port.spinlock); + + ttyprintk_driver = tty_alloc_driver(1, + TTY_DRIVER_RESET_TERMIOS | +diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c +index a60a1be937ad..b4a95cbbda98 100644 +--- a/drivers/clk/mmp/clk-of-mmp2.c ++++ b/drivers/clk/mmp/clk-of-mmp2.c +@@ -134,7 +134,7 @@ static DEFINE_SPINLOCK(ssp3_lock); + static const char *ssp_parent_names[] = {"vctcxo_4", "vctcxo_2", "vctcxo", "pll1_16"}; + + static DEFINE_SPINLOCK(timer_lock); +-static const char *timer_parent_names[] = {"clk32", "vctcxo_2", "vctcxo_4", "vctcxo"}; ++static const char *timer_parent_names[] = {"clk32", "vctcxo_4", "vctcxo_2", "vctcxo"}; + + static DEFINE_SPINLOCK(reset_lock); + +diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c +index 45a1ed3fe674..ab194143e06c 100644 +--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c ++++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c +@@ -23,9 +23,9 @@ + */ + + static const char * const ar100_r_apb2_parents[] = { "osc24M", "osc32k", +- "pll-periph0", "iosc" }; ++ "iosc", "pll-periph0" }; + static const struct ccu_mux_var_prediv ar100_r_apb2_predivs[] = { +- { .index = 2, .shift = 0, .width = 5 }, ++ { .index = 3, .shift = 0, .width = 5 }, + }; + + static struct ccu_div ar100_clk = { +diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-r.c b/drivers/clk/sunxi-ng/ccu-sun8i-r.c +index 4646fdc61053..4c8c491b87c2 100644 +--- a/drivers/clk/sunxi-ng/ccu-sun8i-r.c ++++ b/drivers/clk/sunxi-ng/ccu-sun8i-r.c +@@ -51,19 +51,7 @@ static struct ccu_div ar100_clk = { + + static CLK_FIXED_FACTOR_HW(ahb0_clk, "ahb0", &ar100_clk.common.hw, 1, 1, 0); + +-static struct ccu_div apb0_clk = { +- .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), +- +- .common = { +- .reg = 0x0c, +- .hw.init = CLK_HW_INIT_HW("apb0", +- &ahb0_clk.hw, +- &ccu_div_ops, +- 0), +- }, +-}; +- +-static SUNXI_CCU_M(a83t_apb0_clk, "apb0", "ahb0", 0x0c, 0, 2, 0); ++static SUNXI_CCU_M(apb0_clk, "apb0", "ahb0", 0x0c, 0, 2, 0); + + /* + * Define the parent as an array that can be reused to save space +@@ -127,7 +115,7 @@ static struct ccu_mp a83t_ir_clk = { + + static struct ccu_common *sun8i_a83t_r_ccu_clks[] = { + &ar100_clk.common, +- &a83t_apb0_clk.common, ++ &apb0_clk.common, + &apb0_pio_clk.common, + &apb0_ir_clk.common, + &apb0_timer_clk.common, +@@ -167,7 +155,7 @@ static struct clk_hw_onecell_data sun8i_a83t_r_hw_clks = { + .hws = { + [CLK_AR100] = &ar100_clk.common.hw, + [CLK_AHB0] = &ahb0_clk.hw, +- [CLK_APB0] = &a83t_apb0_clk.common.hw, ++ [CLK_APB0] = &apb0_clk.common.hw, + [CLK_APB0_PIO] = &apb0_pio_clk.common.hw, + [CLK_APB0_IR] = &apb0_ir_clk.common.hw, + [CLK_APB0_TIMER] = &apb0_timer_clk.common.hw, +@@ -282,9 +270,6 @@ static void __init sunxi_r_ccu_init(struct device_node *node, + + static void __init sun8i_a83t_r_ccu_setup(struct device_node *node) + { +- /* Fix apb0 bus gate parents here */ +- apb0_gate_parent[0] = &a83t_apb0_clk.common.hw; +- + sunxi_r_ccu_init(node, &sun8i_a83t_r_ccu_desc); + } + CLK_OF_DECLARE(sun8i_a83t_r_ccu, "allwinner,sun8i-a83t-r-ccu", +diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c +index 5c779eec454b..0e36ca3bf3d5 100644 +--- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c ++++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c +@@ -618,7 +618,7 @@ static struct clk_hw_onecell_data sun8i_v3s_hw_clks = { + [CLK_MBUS] = &mbus_clk.common.hw, + [CLK_MIPI_CSI] = &mipi_csi_clk.common.hw, + }, +- .num = CLK_NUMBER, ++ .num = CLK_PLL_DDR1 + 1, + }; + + static struct clk_hw_onecell_data sun8i_v3_hw_clks = { +@@ -700,7 +700,7 @@ static struct clk_hw_onecell_data sun8i_v3_hw_clks = { + [CLK_MBUS] = &mbus_clk.common.hw, + [CLK_MIPI_CSI] = &mipi_csi_clk.common.hw, + }, +- .num = CLK_NUMBER, ++ .num = CLK_I2S0 + 1, + }; + + static struct ccu_reset_map sun8i_v3s_ccu_resets[] = { +diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.h b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.h +index b0160d305a67..108eeeedcbf7 100644 +--- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.h ++++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.h +@@ -51,6 +51,4 @@ + + #define CLK_PLL_DDR1 74 + +-#define CLK_NUMBER (CLK_I2S0 + 1) +- + #endif /* _CCU_SUN8I_H3_H_ */ +diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c +index 703047434ee1..c71773c88890 100644 +--- a/drivers/cpuidle/governors/teo.c ++++ b/drivers/cpuidle/governors/teo.c +@@ -234,7 +234,7 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, + struct teo_cpu *cpu_data = per_cpu_ptr(&teo_cpus, dev->cpu); + int latency_req = cpuidle_governor_latency_req(dev->cpu); + unsigned int duration_us, hits, misses, early_hits; +- int max_early_idx, constraint_idx, idx, i; ++ int max_early_idx, prev_max_early_idx, constraint_idx, idx, i; + ktime_t delta_tick; + + if (dev->last_state_idx >= 0) { +@@ -251,6 +251,7 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, + misses = 0; + early_hits = 0; + max_early_idx = -1; ++ prev_max_early_idx = -1; + constraint_idx = drv->state_count; + idx = -1; + +@@ -303,6 +304,7 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, + */ + if (!(tick_nohz_tick_stopped() && + drv->states[idx].target_residency < TICK_USEC)) { ++ prev_max_early_idx = max_early_idx; + early_hits = cpu_data->states[i].early_hits; + max_early_idx = idx; + } +@@ -329,6 +331,7 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, + if (early_hits < cpu_data->states[i].early_hits && + !(tick_nohz_tick_stopped() && + drv->states[i].target_residency < TICK_USEC)) { ++ prev_max_early_idx = max_early_idx; + early_hits = cpu_data->states[i].early_hits; + max_early_idx = i; + } +@@ -342,9 +345,19 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, + * "early hits" metric, but if that cannot be determined, just use the + * state selected so far. + */ +- if (hits <= misses && max_early_idx >= 0) { +- idx = max_early_idx; +- duration_us = drv->states[idx].target_residency; ++ if (hits <= misses) { ++ /* ++ * The current candidate state is not suitable, so take the one ++ * whose "early hits" metric is the maximum for the range of ++ * shallower states. ++ */ ++ if (idx == max_early_idx) ++ max_early_idx = prev_max_early_idx; ++ ++ if (max_early_idx >= 0) { ++ idx = max_early_idx; ++ duration_us = drv->states[idx].target_residency; ++ } + } + + /* +diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c +index c64d20fdc187..174795ecbd3b 100644 +--- a/drivers/devfreq/devfreq.c ++++ b/drivers/devfreq/devfreq.c +@@ -1112,6 +1112,14 @@ err_out: + } + EXPORT_SYMBOL(devfreq_remove_governor); + ++static ssize_t name_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ struct devfreq *devfreq = to_devfreq(dev); ++ return sprintf(buf, "%s\n", dev_name(devfreq->dev.parent)); ++} ++static DEVICE_ATTR_RO(name); ++ + static ssize_t governor_show(struct device *dev, + struct device_attribute *attr, char *buf) + { +@@ -1440,6 +1448,7 @@ static ssize_t trans_stat_show(struct device *dev, + static DEVICE_ATTR_RO(trans_stat); + + static struct attribute *devfreq_attrs[] = { ++ &dev_attr_name.attr, + &dev_attr_governor.attr, + &dev_attr_available_governors.attr, + &dev_attr_cur_freq.attr, +diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c +index f918fca9ada3..cb6e3a5f509c 100644 +--- a/drivers/input/evdev.c ++++ b/drivers/input/evdev.c +@@ -484,10 +484,7 @@ static int evdev_open(struct inode *inode, struct file *file) + struct evdev_client *client; + int error; + +- client = kzalloc(struct_size(client, buffer, bufsize), +- GFP_KERNEL | __GFP_NOWARN); +- if (!client) +- client = vzalloc(struct_size(client, buffer, bufsize)); ++ client = kvzalloc(struct_size(client, buffer, bufsize), GFP_KERNEL); + if (!client) + return -ENOMEM; + +diff --git a/drivers/input/misc/max77650-onkey.c b/drivers/input/misc/max77650-onkey.c +index 4d875f2ac13d..ee55f22dbca5 100644 +--- a/drivers/input/misc/max77650-onkey.c ++++ b/drivers/input/misc/max77650-onkey.c +@@ -108,9 +108,16 @@ static int max77650_onkey_probe(struct platform_device *pdev) + return input_register_device(onkey->input); + } + ++static const struct of_device_id max77650_onkey_of_match[] = { ++ { .compatible = "maxim,max77650-onkey" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, max77650_onkey_of_match); ++ + static struct platform_driver max77650_onkey_driver = { + .driver = { + .name = "max77650-onkey", ++ .of_match_table = max77650_onkey_of_match, + }, + .probe = max77650_onkey_probe, + }; +diff --git a/drivers/leds/leds-max77650.c b/drivers/leds/leds-max77650.c +index 4c2d0b3c6dad..a0d4b725c917 100644 +--- a/drivers/leds/leds-max77650.c ++++ b/drivers/leds/leds-max77650.c +@@ -135,9 +135,16 @@ err_node_put: + return rv; + } + ++static const struct of_device_id max77650_led_of_match[] = { ++ { .compatible = "maxim,max77650-led" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, max77650_led_of_match); ++ + static struct platform_driver max77650_led_driver = { + .driver = { + .name = "max77650-led", ++ .of_match_table = max77650_led_of_match, + }, + .probe = max77650_led_probe, + }; +diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c +index 1696bfd23ad1..69201bdf7f4c 100644 +--- a/drivers/md/dm-thin.c ++++ b/drivers/md/dm-thin.c +@@ -3420,10 +3420,6 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) + if (r) + goto out_flags_changed; + +- dm_pool_register_pre_commit_callback(pt->pool->pmd, +- metadata_pre_commit_callback, +- pt); +- + pt->callbacks.congested_fn = pool_is_congested; + dm_table_add_target_callbacks(ti->table, &pt->callbacks); + +@@ -3587,6 +3583,9 @@ static int pool_preresume(struct dm_target *ti) + if (r) + return r; + ++ dm_pool_register_pre_commit_callback(pool->pmd, ++ metadata_pre_commit_callback, pt); ++ + r = maybe_resize_data_dev(ti, &need_commit1); + if (r) + return r; +diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c +index ac93e88d7038..89b4b5d84cdf 100644 +--- a/drivers/media/usb/dvb-usb/af9005.c ++++ b/drivers/media/usb/dvb-usb/af9005.c +@@ -554,7 +554,7 @@ static int af9005_boot_packet(struct usb_device *udev, int type, u8 *reply, + u8 *buf, int size) + { + u16 checksum; +- int act_len, i, ret; ++ int act_len = 0, i, ret; + + memset(buf, 0, size); + buf[0] = (u8) (FW_BULKOUT_SIZE & 0xff); +diff --git a/drivers/media/usb/dvb-usb/digitv.c b/drivers/media/usb/dvb-usb/digitv.c +index dd5bb230cec1..99a39339d45d 100644 +--- a/drivers/media/usb/dvb-usb/digitv.c ++++ b/drivers/media/usb/dvb-usb/digitv.c +@@ -230,18 +230,22 @@ static struct rc_map_table rc_map_digitv_table[] = { + + static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) + { +- int i; ++ int ret, i; + u8 key[5]; + u8 b[4] = { 0 }; + + *event = 0; + *state = REMOTE_NO_KEY_PRESSED; + +- digitv_ctrl_msg(d,USB_READ_REMOTE,0,NULL,0,&key[1],4); ++ ret = digitv_ctrl_msg(d, USB_READ_REMOTE, 0, NULL, 0, &key[1], 4); ++ if (ret) ++ return ret; + + /* Tell the device we've read the remote. Not sure how necessary + this is, but the Nebula SDK does it. */ +- digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0); ++ ret = digitv_ctrl_msg(d, USB_WRITE_REMOTE, 0, b, 4, NULL, 0); ++ if (ret) ++ return ret; + + /* if something is inside the buffer, simulate key press */ + if (key[1] != 0) +diff --git a/drivers/media/usb/dvb-usb/dvb-usb-urb.c b/drivers/media/usb/dvb-usb/dvb-usb-urb.c +index c1b4e94a37f8..2aabf90d8697 100644 +--- a/drivers/media/usb/dvb-usb/dvb-usb-urb.c ++++ b/drivers/media/usb/dvb-usb/dvb-usb-urb.c +@@ -12,7 +12,7 @@ + int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf, + u16 rlen, int delay_ms) + { +- int actlen,ret = -ENOMEM; ++ int actlen = 0, ret = -ENOMEM; + + if (!d || wbuf == NULL || wlen == 0) + return -EINVAL; +diff --git a/drivers/media/usb/dvb-usb/vp7045.c b/drivers/media/usb/dvb-usb/vp7045.c +index 80c1cf05384b..2baf57216d19 100644 +--- a/drivers/media/usb/dvb-usb/vp7045.c ++++ b/drivers/media/usb/dvb-usb/vp7045.c +@@ -96,10 +96,14 @@ static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff) + + static int vp7045_rc_query(struct dvb_usb_device *d) + { ++ int ret; + u8 key; +- vp7045_usb_op(d,RC_VAL_READ,NULL,0,&key,1,20); + +- deb_rc("remote query key: %x %d\n",key,key); ++ ret = vp7045_usb_op(d, RC_VAL_READ, NULL, 0, &key, 1, 20); ++ if (ret) ++ return ret; ++ ++ deb_rc("remote query key: %x\n", key); + + if (key != 0x44) { + /* +@@ -115,15 +119,18 @@ static int vp7045_rc_query(struct dvb_usb_device *d) + + static int vp7045_read_eeprom(struct dvb_usb_device *d,u8 *buf, int len, int offset) + { +- int i = 0; +- u8 v,br[2]; ++ int i, ret; ++ u8 v, br[2]; + for (i=0; i < len; i++) { + v = offset + i; +- vp7045_usb_op(d,GET_EE_VALUE,&v,1,br,2,5); ++ ret = vp7045_usb_op(d, GET_EE_VALUE, &v, 1, br, 2, 5); ++ if (ret) ++ return ret; ++ + buf[i] = br[1]; + } +- deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ",offset, i); +- debug_dump(buf,i,deb_info); ++ deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ", offset, i); ++ debug_dump(buf, i, deb_info); + return 0; + } + +diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c +index 4add2b12d330..c1b307bbe540 100644 +--- a/drivers/media/usb/gspca/gspca.c ++++ b/drivers/media/usb/gspca/gspca.c +@@ -1461,7 +1461,7 @@ int gspca_dev_probe2(struct usb_interface *intf, + pr_err("couldn't kzalloc gspca struct\n"); + return -ENOMEM; + } +- gspca_dev->usb_buf = kmalloc(USB_BUF_SZ, GFP_KERNEL); ++ gspca_dev->usb_buf = kzalloc(USB_BUF_SZ, GFP_KERNEL); + if (!gspca_dev->usb_buf) { + pr_err("out of memory\n"); + ret = -ENOMEM; +diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c +index 7284a22b1a09..4d5a512769e9 100644 +--- a/drivers/misc/lkdtm/bugs.c ++++ b/drivers/misc/lkdtm/bugs.c +@@ -274,7 +274,7 @@ void lkdtm_STACK_GUARD_PAGE_TRAILING(void) + + void lkdtm_UNSET_SMEP(void) + { +-#ifdef CONFIG_X86_64 ++#if IS_ENABLED(CONFIG_X86_64) && !IS_ENABLED(CONFIG_UML) + #define MOV_CR4_DEPTH 64 + void (*direct_write_cr4)(unsigned long val); + unsigned char *insn; +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +index fb8ade9a05a9..2ce96cc1bad4 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +@@ -70,8 +70,7 @@ static void *seq_tab_start(struct seq_file *seq, loff_t *pos) + static void *seq_tab_next(struct seq_file *seq, void *v, loff_t *pos) + { + v = seq_tab_get_idx(seq->private, *pos + 1); +- if (v) +- ++*pos; ++ ++(*pos); + return v; + } + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/l2t.c b/drivers/net/ethernet/chelsio/cxgb4/l2t.c +index 1a407d3c1d67..e6fe2870137b 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/l2t.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/l2t.c +@@ -682,8 +682,7 @@ static void *l2t_seq_start(struct seq_file *seq, loff_t *pos) + static void *l2t_seq_next(struct seq_file *seq, void *v, loff_t *pos) + { + v = l2t_get_idx(seq, *pos); +- if (v) +- ++*pos; ++ ++(*pos); + return v; + } + +diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c +index 41c6fa200e74..e1901874c19f 100644 +--- a/drivers/net/ethernet/freescale/fman/fman_memac.c ++++ b/drivers/net/ethernet/freescale/fman/fman_memac.c +@@ -110,7 +110,7 @@ do { \ + /* Interface Mode Register (IF_MODE) */ + + #define IF_MODE_MASK 0x00000003 /* 30-31 Mask on i/f mode bits */ +-#define IF_MODE_XGMII 0x00000000 /* 30-31 XGMII (10G) interface */ ++#define IF_MODE_10G 0x00000000 /* 30-31 10G interface */ + #define IF_MODE_GMII 0x00000002 /* 30-31 GMII (1G) interface */ + #define IF_MODE_RGMII 0x00000004 + #define IF_MODE_RGMII_AUTO 0x00008000 +@@ -440,7 +440,7 @@ static int init(struct memac_regs __iomem *regs, struct memac_cfg *cfg, + tmp = 0; + switch (phy_if) { + case PHY_INTERFACE_MODE_XGMII: +- tmp |= IF_MODE_XGMII; ++ tmp |= IF_MODE_10G; + break; + default: + tmp |= IF_MODE_GMII; +diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c +index e03b30c60dcf..c82c85ef5fb3 100644 +--- a/drivers/net/ethernet/freescale/xgmac_mdio.c ++++ b/drivers/net/ethernet/freescale/xgmac_mdio.c +@@ -49,6 +49,7 @@ struct tgec_mdio_controller { + struct mdio_fsl_priv { + struct tgec_mdio_controller __iomem *mdio_base; + bool is_little_endian; ++ bool has_a011043; + }; + + static u32 xgmac_read32(void __iomem *regs, +@@ -226,7 +227,8 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) + return ret; + + /* Return all Fs if nothing was there */ +- if (xgmac_read32(®s->mdio_stat, endian) & MDIO_STAT_RD_ER) { ++ if ((xgmac_read32(®s->mdio_stat, endian) & MDIO_STAT_RD_ER) && ++ !priv->has_a011043) { + dev_err(&bus->dev, + "Error while reading PHY%d reg at %d.%hhu\n", + phy_id, dev_addr, regnum); +@@ -274,6 +276,9 @@ static int xgmac_mdio_probe(struct platform_device *pdev) + priv->is_little_endian = of_property_read_bool(pdev->dev.of_node, + "little-endian"); + ++ priv->has_a011043 = of_property_read_bool(pdev->dev.of_node, ++ "fsl,erratum-a011043"); ++ + ret = of_mdiobus_register(bus, np); + if (ret) { + dev_err(&pdev->dev, "cannot register MDIO bus\n"); +diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h +index 6c51b1bad8c4..37a2314d3e6b 100644 +--- a/drivers/net/ethernet/intel/e1000e/e1000.h ++++ b/drivers/net/ethernet/intel/e1000e/e1000.h +@@ -185,13 +185,12 @@ struct e1000_phy_regs { + + /* board specific private data structure */ + struct e1000_adapter { ++ struct timer_list watchdog_timer; + struct timer_list phy_info_timer; + struct timer_list blink_timer; + + struct work_struct reset_task; +- struct delayed_work watchdog_task; +- +- struct workqueue_struct *e1000_workqueue; ++ struct work_struct watchdog_task; + + const struct e1000_info *ei; + +diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c +index d7d56e42a6aa..c27ed7363768 100644 +--- a/drivers/net/ethernet/intel/e1000e/netdev.c ++++ b/drivers/net/ethernet/intel/e1000e/netdev.c +@@ -1780,8 +1780,7 @@ static irqreturn_t e1000_intr_msi(int __always_unused irq, void *data) + } + /* guard against interrupt when we're going down */ + if (!test_bit(__E1000_DOWN, &adapter->state)) +- mod_delayed_work(adapter->e1000_workqueue, +- &adapter->watchdog_task, HZ); ++ mod_timer(&adapter->watchdog_timer, jiffies + 1); + } + + /* Reset on uncorrectable ECC error */ +@@ -1861,8 +1860,7 @@ static irqreturn_t e1000_intr(int __always_unused irq, void *data) + } + /* guard against interrupt when we're going down */ + if (!test_bit(__E1000_DOWN, &adapter->state)) +- mod_delayed_work(adapter->e1000_workqueue, +- &adapter->watchdog_task, HZ); ++ mod_timer(&adapter->watchdog_timer, jiffies + 1); + } + + /* Reset on uncorrectable ECC error */ +@@ -1907,8 +1905,7 @@ static irqreturn_t e1000_msix_other(int __always_unused irq, void *data) + hw->mac.get_link_status = true; + /* guard against interrupt when we're going down */ + if (!test_bit(__E1000_DOWN, &adapter->state)) +- mod_delayed_work(adapter->e1000_workqueue, +- &adapter->watchdog_task, HZ); ++ mod_timer(&adapter->watchdog_timer, jiffies + 1); + } + + if (!test_bit(__E1000_DOWN, &adapter->state)) +@@ -4281,6 +4278,7 @@ void e1000e_down(struct e1000_adapter *adapter, bool reset) + + napi_synchronize(&adapter->napi); + ++ del_timer_sync(&adapter->watchdog_timer); + del_timer_sync(&adapter->phy_info_timer); + + spin_lock(&adapter->stats64_lock); +@@ -5152,11 +5150,25 @@ static void e1000e_check_82574_phy_workaround(struct e1000_adapter *adapter) + } + } + ++/** ++ * e1000_watchdog - Timer Call-back ++ * @data: pointer to adapter cast into an unsigned long ++ **/ ++static void e1000_watchdog(struct timer_list *t) ++{ ++ struct e1000_adapter *adapter = from_timer(adapter, t, watchdog_timer); ++ ++ /* Do the rest outside of interrupt context */ ++ schedule_work(&adapter->watchdog_task); ++ ++ /* TODO: make this use queue_delayed_work() */ ++} ++ + static void e1000_watchdog_task(struct work_struct *work) + { + struct e1000_adapter *adapter = container_of(work, + struct e1000_adapter, +- watchdog_task.work); ++ watchdog_task); + struct net_device *netdev = adapter->netdev; + struct e1000_mac_info *mac = &adapter->hw.mac; + struct e1000_phy_info *phy = &adapter->hw.phy; +@@ -5404,9 +5416,8 @@ link_up: + + /* Reset the timer */ + if (!test_bit(__E1000_DOWN, &adapter->state)) +- queue_delayed_work(adapter->e1000_workqueue, +- &adapter->watchdog_task, +- round_jiffies(2 * HZ)); ++ mod_timer(&adapter->watchdog_timer, ++ round_jiffies(jiffies + 2 * HZ)); + } + + #define E1000_TX_FLAGS_CSUM 0x00000001 +@@ -7259,21 +7270,11 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) + goto err_eeprom; + } + +- adapter->e1000_workqueue = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0, +- e1000e_driver_name); +- +- if (!adapter->e1000_workqueue) { +- err = -ENOMEM; +- goto err_workqueue; +- } +- +- INIT_DELAYED_WORK(&adapter->watchdog_task, e1000_watchdog_task); +- queue_delayed_work(adapter->e1000_workqueue, &adapter->watchdog_task, +- 0); +- ++ timer_setup(&adapter->watchdog_timer, e1000_watchdog, 0); + timer_setup(&adapter->phy_info_timer, e1000_update_phy_info, 0); + + INIT_WORK(&adapter->reset_task, e1000_reset_task); ++ INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task); + INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround); + INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task); + INIT_WORK(&adapter->print_hang_task, e1000_print_hw_hang); +@@ -7367,9 +7368,6 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) + return 0; + + err_register: +- flush_workqueue(adapter->e1000_workqueue); +- destroy_workqueue(adapter->e1000_workqueue); +-err_workqueue: + if (!(adapter->flags & FLAG_HAS_AMT)) + e1000e_release_hw_control(adapter); + err_eeprom: +@@ -7407,26 +7405,22 @@ static void e1000_remove(struct pci_dev *pdev) + { + struct net_device *netdev = pci_get_drvdata(pdev); + struct e1000_adapter *adapter = netdev_priv(netdev); +- bool down = test_bit(__E1000_DOWN, &adapter->state); + + e1000e_ptp_remove(adapter); + + /* The timers may be rescheduled, so explicitly disable them + * from being rescheduled. + */ +- if (!down) +- set_bit(__E1000_DOWN, &adapter->state); ++ set_bit(__E1000_DOWN, &adapter->state); ++ del_timer_sync(&adapter->watchdog_timer); + del_timer_sync(&adapter->phy_info_timer); + + cancel_work_sync(&adapter->reset_task); ++ cancel_work_sync(&adapter->watchdog_task); + cancel_work_sync(&adapter->downshift_task); + cancel_work_sync(&adapter->update_phy_task); + cancel_work_sync(&adapter->print_hang_task); + +- cancel_delayed_work(&adapter->watchdog_task); +- flush_workqueue(adapter->e1000_workqueue); +- destroy_workqueue(adapter->e1000_workqueue); +- + if (adapter->flags & FLAG_HAS_HW_TIMESTAMP) { + cancel_work_sync(&adapter->tx_hwtstamp_work); + if (adapter->tx_hwtstamp_skb) { +@@ -7435,9 +7429,6 @@ static void e1000_remove(struct pci_dev *pdev) + } + } + +- /* Don't lie to e1000_close() down the road. */ +- if (!down) +- clear_bit(__E1000_DOWN, &adapter->state); + unregister_netdev(netdev); + + if (pci_dev_run_wake(pdev)) +diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +index 3d2440838822..3515ace0f020 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +@@ -2322,6 +2322,22 @@ static int i40e_ctrl_vf_rx_rings(struct i40e_vsi *vsi, unsigned long q_map, + return ret; + } + ++/** ++ * i40e_vc_validate_vqs_bitmaps - validate Rx/Tx queue bitmaps from VIRTHCHNL ++ * @vqs: virtchnl_queue_select structure containing bitmaps to validate ++ * ++ * Returns true if validation was successful, else false. ++ */ ++static bool i40e_vc_validate_vqs_bitmaps(struct virtchnl_queue_select *vqs) ++{ ++ if ((!vqs->rx_queues && !vqs->tx_queues) || ++ vqs->rx_queues >= BIT(I40E_MAX_VF_QUEUES) || ++ vqs->tx_queues >= BIT(I40E_MAX_VF_QUEUES)) ++ return false; ++ ++ return true; ++} ++ + /** + * i40e_vc_enable_queues_msg + * @vf: pointer to the VF info +@@ -2347,7 +2363,7 @@ static int i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg) + goto error_param; + } + +- if ((0 == vqs->rx_queues) && (0 == vqs->tx_queues)) { ++ if (i40e_vc_validate_vqs_bitmaps(vqs)) { + aq_ret = I40E_ERR_PARAM; + goto error_param; + } +@@ -2409,9 +2425,7 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg) + goto error_param; + } + +- if ((vqs->rx_queues == 0 && vqs->tx_queues == 0) || +- vqs->rx_queues > I40E_MAX_VF_QUEUES || +- vqs->tx_queues > I40E_MAX_VF_QUEUES) { ++ if (i40e_vc_validate_vqs_bitmaps(vqs)) { + aq_ret = I40E_ERR_PARAM; + goto error_param; + } +diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/intel/iavf/iavf.h +index 29de3ae96ef2..bd1b1ed323f4 100644 +--- a/drivers/net/ethernet/intel/iavf/iavf.h ++++ b/drivers/net/ethernet/intel/iavf/iavf.h +@@ -415,4 +415,6 @@ void iavf_enable_channels(struct iavf_adapter *adapter); + void iavf_disable_channels(struct iavf_adapter *adapter); + void iavf_add_cloud_filter(struct iavf_adapter *adapter); + void iavf_del_cloud_filter(struct iavf_adapter *adapter); ++struct iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter, ++ const u8 *macaddr); + #endif /* _IAVF_H_ */ +diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c +index 821987da5698..8e16be960e96 100644 +--- a/drivers/net/ethernet/intel/iavf/iavf_main.c ++++ b/drivers/net/ethernet/intel/iavf/iavf_main.c +@@ -743,9 +743,8 @@ iavf_mac_filter *iavf_find_filter(struct iavf_adapter *adapter, + * + * Returns ptr to the filter object or NULL when no memory available. + **/ +-static struct +-iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter, +- const u8 *macaddr) ++struct iavf_mac_filter *iavf_add_filter(struct iavf_adapter *adapter, ++ const u8 *macaddr) + { + struct iavf_mac_filter *f; + +@@ -2065,9 +2064,9 @@ static void iavf_reset_task(struct work_struct *work) + struct virtchnl_vf_resource *vfres = adapter->vf_res; + struct net_device *netdev = adapter->netdev; + struct iavf_hw *hw = &adapter->hw; ++ struct iavf_mac_filter *f, *ftmp; + struct iavf_vlan_filter *vlf; + struct iavf_cloud_filter *cf; +- struct iavf_mac_filter *f; + u32 reg_val; + int i = 0, err; + bool running; +@@ -2181,6 +2180,16 @@ continue_reset: + + spin_lock_bh(&adapter->mac_vlan_list_lock); + ++ /* Delete filter for the current MAC address, it could have ++ * been changed by the PF via administratively set MAC. ++ * Will be re-added via VIRTCHNL_OP_GET_VF_RESOURCES. ++ */ ++ list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { ++ if (ether_addr_equal(f->macaddr, adapter->hw.mac.addr)) { ++ list_del(&f->list); ++ kfree(f); ++ } ++ } + /* re-add all MAC filters */ + list_for_each_entry(f, &adapter->mac_filter_list, list) { + f->add = true; +diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +index c46770eba320..1ab9cb339acb 100644 +--- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c ++++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +@@ -1359,6 +1359,9 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, + ether_addr_copy(netdev->perm_addr, + adapter->hw.mac.addr); + } ++ spin_lock_bh(&adapter->mac_vlan_list_lock); ++ iavf_add_filter(adapter, adapter->hw.mac.addr); ++ spin_unlock_bh(&adapter->mac_vlan_list_lock); + iavf_process_config(adapter); + } + break; +diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c +index 8a6ef3514129..438b42ce2cd9 100644 +--- a/drivers/net/ethernet/intel/igb/e1000_82575.c ++++ b/drivers/net/ethernet/intel/igb/e1000_82575.c +@@ -530,7 +530,7 @@ static s32 igb_set_sfp_media_type_82575(struct e1000_hw *hw) + dev_spec->module_plugged = true; + if (eth_flags->e1000_base_lx || eth_flags->e1000_base_sx) { + hw->phy.media_type = e1000_media_type_internal_serdes; +- } else if (eth_flags->e100_base_fx) { ++ } else if (eth_flags->e100_base_fx || eth_flags->e100_base_lx) { + dev_spec->sgmii_active = true; + hw->phy.media_type = e1000_media_type_internal_serdes; + } else if (eth_flags->e1000_base_t) { +@@ -657,14 +657,10 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) + break; + } + +- /* do not change link mode for 100BaseFX */ +- if (dev_spec->eth_flags.e100_base_fx) +- break; +- + /* change current link mode setting */ + ctrl_ext &= ~E1000_CTRL_EXT_LINK_MODE_MASK; + +- if (hw->phy.media_type == e1000_media_type_copper) ++ if (dev_spec->sgmii_active) + ctrl_ext |= E1000_CTRL_EXT_LINK_MODE_SGMII; + else + ctrl_ext |= E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES; +diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c +index 3182b059bf55..8959418776f6 100644 +--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c ++++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c +@@ -181,7 +181,7 @@ static int igb_get_link_ksettings(struct net_device *netdev, + advertising &= ~ADVERTISED_1000baseKX_Full; + } + } +- if (eth_flags->e100_base_fx) { ++ if (eth_flags->e100_base_fx || eth_flags->e100_base_lx) { + supported |= SUPPORTED_100baseT_Full; + advertising |= ADVERTISED_100baseT_Full; + } +diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +index c6404abf2dd1..a26f9fb95ac0 100644 +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +@@ -5239,7 +5239,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) + struct ixgbe_hw *hw = &adapter->hw; + struct hlist_node *node2; + struct ixgbe_fdir_filter *filter; +- u64 action; ++ u8 queue; + + spin_lock(&adapter->fdir_perfect_lock); + +@@ -5248,17 +5248,34 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) + + hlist_for_each_entry_safe(filter, node2, + &adapter->fdir_filter_list, fdir_node) { +- action = filter->action; +- if (action != IXGBE_FDIR_DROP_QUEUE && action != 0) +- action = +- (action >> ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF) - 1; ++ if (filter->action == IXGBE_FDIR_DROP_QUEUE) { ++ queue = IXGBE_FDIR_DROP_QUEUE; ++ } else { ++ u32 ring = ethtool_get_flow_spec_ring(filter->action); ++ u8 vf = ethtool_get_flow_spec_ring_vf(filter->action); ++ ++ if (!vf && (ring >= adapter->num_rx_queues)) { ++ e_err(drv, "FDIR restore failed without VF, ring: %u\n", ++ ring); ++ continue; ++ } else if (vf && ++ ((vf > adapter->num_vfs) || ++ ring >= adapter->num_rx_queues_per_pool)) { ++ e_err(drv, "FDIR restore failed with VF, vf: %hhu, ring: %u\n", ++ vf, ring); ++ continue; ++ } ++ ++ /* Map the ring onto the absolute queue index */ ++ if (!vf) ++ queue = adapter->rx_ring[ring]->reg_idx; ++ else ++ queue = ((vf - 1) * ++ adapter->num_rx_queues_per_pool) + ring; ++ } + + ixgbe_fdir_write_perfect_filter_82599(hw, +- &filter->filter, +- filter->sw_idx, +- (action == IXGBE_FDIR_DROP_QUEUE) ? +- IXGBE_FDIR_DROP_QUEUE : +- adapter->rx_ring[action]->reg_idx); ++ &filter->filter, filter->sw_idx, queue); + } + + spin_unlock(&adapter->fdir_perfect_lock); +diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +index 076f2da36f27..64ec0e7c64b4 100644 +--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c ++++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +@@ -2081,11 +2081,6 @@ static int ixgbevf_write_uc_addr_list(struct net_device *netdev) + struct ixgbe_hw *hw = &adapter->hw; + int count = 0; + +- if ((netdev_uc_count(netdev)) > 10) { +- pr_err("Too many unicast filters - No Space\n"); +- return -ENOSPC; +- } +- + if (!netdev_uc_empty(netdev)) { + struct netdev_hw_addr *ha; + +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +index a496390b8632..07f9067affc6 100644 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +@@ -2043,6 +2043,7 @@ static void qlcnic_83xx_exec_template_cmd(struct qlcnic_adapter *p_dev, + break; + } + entry += p_hdr->size; ++ cond_resched(); + } + p_dev->ahw->reset.seq_index = index; + } +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c +index afa10a163da1..f34ae8c75bc5 100644 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c +@@ -703,6 +703,7 @@ static u32 qlcnic_read_memory_test_agent(struct qlcnic_adapter *adapter, + addr += 16; + reg_read -= 16; + ret += 16; ++ cond_resched(); + } + out: + mutex_unlock(&adapter->ahw->mem_lock); +@@ -1383,6 +1384,7 @@ int qlcnic_dump_fw(struct qlcnic_adapter *adapter) + buf_offset += entry->hdr.cap_size; + entry_offset += entry->hdr.offset; + buffer = fw_dump->data + buf_offset; ++ cond_resched(); + } + + fw_dump->clr = 1; +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index 4196c0e32740..9485c8d1de8a 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -1062,6 +1062,7 @@ static const struct usb_device_id products[] = { + {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ + {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */ + {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */ ++ {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */ + + /* 3. Combined interface devices matching on interface number */ + {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c +index 9e4b7a400284..6912624eed4a 100644 +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -29,7 +29,7 @@ + #define NETNEXT_VERSION "10" + + /* Information for net */ +-#define NET_VERSION "10" ++#define NET_VERSION "11" + + #define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION + #define DRIVER_AUTHOR "Realtek linux nic maintainers " +@@ -63,6 +63,7 @@ + #define PLA_LED_FEATURE 0xdd92 + #define PLA_PHYAR 0xde00 + #define PLA_BOOT_CTRL 0xe004 ++#define PLA_LWAKE_CTRL_REG 0xe007 + #define PLA_GPHY_INTR_IMR 0xe022 + #define PLA_EEE_CR 0xe040 + #define PLA_EEEP_CR 0xe080 +@@ -90,6 +91,7 @@ + #define PLA_TALLYCNT 0xe890 + #define PLA_SFF_STS_7 0xe8de + #define PLA_PHYSTATUS 0xe908 ++#define PLA_CONFIG6 0xe90a /* CONFIG6 */ + #define PLA_BP_BA 0xfc26 + #define PLA_BP_0 0xfc28 + #define PLA_BP_1 0xfc2a +@@ -102,6 +104,7 @@ + #define PLA_BP_EN 0xfc38 + + #define USB_USB2PHY 0xb41e ++#define USB_SSPHYLINK1 0xb426 + #define USB_SSPHYLINK2 0xb428 + #define USB_U2P3_CTRL 0xb460 + #define USB_CSR_DUMMY1 0xb464 +@@ -286,6 +289,9 @@ + #define LINK_ON_WAKE_EN 0x0010 + #define LINK_OFF_WAKE_EN 0x0008 + ++/* PLA_CONFIG6 */ ++#define LANWAKE_CLR_EN BIT(0) ++ + /* PLA_CONFIG5 */ + #define BWF_EN 0x0040 + #define MWF_EN 0x0020 +@@ -298,6 +304,7 @@ + /* PLA_PHY_PWR */ + #define TX_10M_IDLE_EN 0x0080 + #define PFM_PWM_SWITCH 0x0040 ++#define TEST_IO_OFF BIT(4) + + /* PLA_MAC_PWR_CTRL */ + #define D3_CLK_GATED_EN 0x00004000 +@@ -310,6 +317,7 @@ + #define MAC_CLK_SPDWN_EN BIT(15) + + /* PLA_MAC_PWR_CTRL3 */ ++#define PLA_MCU_SPDWN_EN BIT(14) + #define PKT_AVAIL_SPDWN_EN 0x0100 + #define SUSPEND_SPDWN_EN 0x0004 + #define U1U2_SPDWN_EN 0x0002 +@@ -340,6 +348,9 @@ + /* PLA_BOOT_CTRL */ + #define AUTOLOAD_DONE 0x0002 + ++/* PLA_LWAKE_CTRL_REG */ ++#define LANWAKE_PIN BIT(7) ++ + /* PLA_SUSPEND_FLAG */ + #define LINK_CHG_EVENT BIT(0) + +@@ -353,6 +364,9 @@ + #define USB2PHY_SUSPEND 0x0001 + #define USB2PHY_L1 0x0002 + ++/* USB_SSPHYLINK1 */ ++#define DELAY_PHY_PWR_CHG BIT(1) ++ + /* USB_SSPHYLINK2 */ + #define pwd_dn_scale_mask 0x3ffe + #define pwd_dn_scale(x) ((x) << 1) +@@ -3175,7 +3189,6 @@ static void rtl8153b_runtime_enable(struct r8152 *tp, bool enable) + r8153b_ups_en(tp, false); + r8153_queue_wake(tp, false); + rtl_runtime_suspend_enable(tp, false); +- r8153_u2p3en(tp, true); + r8153b_u1u2en(tp, true); + } + } +@@ -3703,7 +3716,6 @@ static void r8153b_hw_phy_cfg(struct r8152 *tp) + + r8153_aldps_en(tp, true); + r8152b_enable_fc(tp); +- r8153_u2p3en(tp, true); + + set_bit(PHY_RESET, &tp->flags); + } +@@ -4004,6 +4016,8 @@ static void rtl8152_down(struct r8152 *tp) + + static void rtl8153_up(struct r8152 *tp) + { ++ u32 ocp_data; ++ + if (test_bit(RTL8152_UNPLUG, &tp->flags)) + return; + +@@ -4011,6 +4025,19 @@ static void rtl8153_up(struct r8152 *tp) + r8153_u2p3en(tp, false); + r8153_aldps_en(tp, false); + r8153_first_init(tp); ++ ++ ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6); ++ ocp_data |= LANWAKE_CLR_EN; ++ ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6, ocp_data); ++ ++ ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_LWAKE_CTRL_REG); ++ ocp_data &= ~LANWAKE_PIN; ++ ocp_write_byte(tp, MCU_TYPE_PLA, PLA_LWAKE_CTRL_REG, ocp_data); ++ ++ ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_SSPHYLINK1); ++ ocp_data &= ~DELAY_PHY_PWR_CHG; ++ ocp_write_word(tp, MCU_TYPE_USB, USB_SSPHYLINK1, ocp_data); ++ + r8153_aldps_en(tp, true); + + switch (tp->version) { +@@ -4029,11 +4056,17 @@ static void rtl8153_up(struct r8152 *tp) + + static void rtl8153_down(struct r8152 *tp) + { ++ u32 ocp_data; ++ + if (test_bit(RTL8152_UNPLUG, &tp->flags)) { + rtl_drop_queued_tx(tp); + return; + } + ++ ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6); ++ ocp_data &= ~LANWAKE_CLR_EN; ++ ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6, ocp_data); ++ + r8153_u1u2en(tp, false); + r8153_u2p3en(tp, false); + r8153_power_cut_en(tp, false); +@@ -4044,6 +4077,8 @@ static void rtl8153_down(struct r8152 *tp) + + static void rtl8153b_up(struct r8152 *tp) + { ++ u32 ocp_data; ++ + if (test_bit(RTL8152_UNPLUG, &tp->flags)) + return; + +@@ -4054,18 +4089,27 @@ static void rtl8153b_up(struct r8152 *tp) + r8153_first_init(tp); + ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_THR_B); + ++ ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3); ++ ocp_data &= ~PLA_MCU_SPDWN_EN; ++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, ocp_data); ++ + r8153_aldps_en(tp, true); +- r8153_u2p3en(tp, true); + r8153b_u1u2en(tp, true); + } + + static void rtl8153b_down(struct r8152 *tp) + { ++ u32 ocp_data; ++ + if (test_bit(RTL8152_UNPLUG, &tp->flags)) { + rtl_drop_queued_tx(tp); + return; + } + ++ ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3); ++ ocp_data |= PLA_MCU_SPDWN_EN; ++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, ocp_data); ++ + r8153b_u1u2en(tp, false); + r8153_u2p3en(tp, false); + r8153b_power_cut_en(tp, false); +@@ -4454,6 +4498,14 @@ static void r8153_init(struct r8152 *tp) + r8153_mac_clk_spd(tp, false); + usb_enable_lpm(tp->udev); + ++ ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6); ++ ocp_data |= LANWAKE_CLR_EN; ++ ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6, ocp_data); ++ ++ ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_LWAKE_CTRL_REG); ++ ocp_data &= ~LANWAKE_PIN; ++ ocp_write_byte(tp, MCU_TYPE_PLA, PLA_LWAKE_CTRL_REG, ocp_data); ++ + /* rx aggregation */ + ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL); + ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN); +@@ -4526,6 +4578,19 @@ static void r8153b_init(struct r8152 *tp) + ocp_data |= MAC_CLK_SPDWN_EN; + ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2, ocp_data); + ++ ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3); ++ ocp_data &= ~PLA_MCU_SPDWN_EN; ++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, ocp_data); ++ ++ if (tp->version == RTL_VER_09) { ++ /* Disable Test IO for 32QFN */ ++ if (ocp_read_byte(tp, MCU_TYPE_PLA, 0xdc00) & BIT(5)) { ++ ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR); ++ ocp_data |= TEST_IO_OFF; ++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR, ocp_data); ++ } ++ } ++ + set_bit(GREEN_ETHERNET, &tp->flags); + + /* rx aggregation */ +@@ -5690,6 +5755,11 @@ static int rtl8152_probe(struct usb_interface *intf, + + intf->needs_remote_wakeup = 1; + ++ if (!rtl_can_wakeup(tp)) ++ __rtl_set_wol(tp, 0); ++ else ++ tp->saved_wolopts = __rtl_get_wol(tp); ++ + tp->rtl_ops.init(tp); + queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0); + set_ethernet_addr(tp); +@@ -5703,10 +5773,6 @@ static int rtl8152_probe(struct usb_interface *intf, + goto out1; + } + +- if (!rtl_can_wakeup(tp)) +- __rtl_set_wol(tp, 0); +- +- tp->saved_wolopts = __rtl_get_wol(tp); + if (tp->saved_wolopts) + device_set_wakeup_enable(&udev->dev, true); + else +diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/tx.c b/drivers/net/wireless/intel/iwlwifi/dvm/tx.c +index 3029e3f6de63..621cd7206b7c 100644 +--- a/drivers/net/wireless/intel/iwlwifi/dvm/tx.c ++++ b/drivers/net/wireless/intel/iwlwifi/dvm/tx.c +@@ -267,7 +267,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct iwl_station_priv *sta_priv = NULL; + struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; +- struct iwl_device_cmd *dev_cmd; ++ struct iwl_device_tx_cmd *dev_cmd; + struct iwl_tx_cmd *tx_cmd; + __le16 fc; + u8 hdr_len; +@@ -348,7 +348,6 @@ int iwlagn_tx_skb(struct iwl_priv *priv, + if (unlikely(!dev_cmd)) + goto drop_unlock_priv; + +- memset(dev_cmd, 0, sizeof(*dev_cmd)); + dev_cmd->hdr.cmd = REPLY_TX; + tx_cmd = (struct iwl_tx_cmd *) dev_cmd->payload; + +diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c +index 87421807e040..386ca67ec7b4 100644 +--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c ++++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c +@@ -2490,12 +2490,7 @@ int iwl_fw_dbg_stop_restart_recording(struct iwl_fw_runtime *fwrt, + { + int ret = 0; + +- /* if the FW crashed or not debug monitor cfg was given, there is +- * no point in changing the recording state +- */ +- if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status) || +- (!fwrt->trans->dbg.dest_tlv && +- fwrt->trans->dbg.ini_dest == IWL_FW_INI_LOCATION_INVALID)) ++ if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status)) + return 0; + + if (fw_has_capa(&fwrt->fw->ucode_capa, +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +index c8972f6e38ba..5d546dac7814 100644 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +@@ -225,6 +225,34 @@ enum iwl_nvm_channel_flags { + NVM_CHANNEL_DC_HIGH = BIT(12), + }; + ++/** ++ * enum iwl_reg_capa_flags - global flags applied for the whole regulatory ++ * domain. ++ * @REG_CAPA_BF_CCD_LOW_BAND: Beam-forming or Cyclic Delay Diversity in the ++ * 2.4Ghz band is allowed. ++ * @REG_CAPA_BF_CCD_HIGH_BAND: Beam-forming or Cyclic Delay Diversity in the ++ * 5Ghz band is allowed. ++ * @REG_CAPA_160MHZ_ALLOWED: 11ac channel with a width of 160Mhz is allowed ++ * for this regulatory domain (valid only in 5Ghz). ++ * @REG_CAPA_80MHZ_ALLOWED: 11ac channel with a width of 80Mhz is allowed ++ * for this regulatory domain (valid only in 5Ghz). ++ * @REG_CAPA_MCS_8_ALLOWED: 11ac with MCS 8 is allowed. ++ * @REG_CAPA_MCS_9_ALLOWED: 11ac with MCS 9 is allowed. ++ * @REG_CAPA_40MHZ_FORBIDDEN: 11n channel with a width of 40Mhz is forbidden ++ * for this regulatory domain (valid only in 5Ghz). ++ * @REG_CAPA_DC_HIGH_ENABLED: DC HIGH allowed. ++ */ ++enum iwl_reg_capa_flags { ++ REG_CAPA_BF_CCD_LOW_BAND = BIT(0), ++ REG_CAPA_BF_CCD_HIGH_BAND = BIT(1), ++ REG_CAPA_160MHZ_ALLOWED = BIT(2), ++ REG_CAPA_80MHZ_ALLOWED = BIT(3), ++ REG_CAPA_MCS_8_ALLOWED = BIT(4), ++ REG_CAPA_MCS_9_ALLOWED = BIT(5), ++ REG_CAPA_40MHZ_FORBIDDEN = BIT(7), ++ REG_CAPA_DC_HIGH_ENABLED = BIT(9), ++}; ++ + static inline void iwl_nvm_print_channel_flags(struct device *dev, u32 level, + int chan, u32 flags) + { +@@ -1031,6 +1059,7 @@ IWL_EXPORT_SYMBOL(iwl_parse_nvm_data); + + static u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan, + int ch_idx, u16 nvm_flags, ++ u16 cap_flags, + const struct iwl_cfg *cfg) + { + u32 flags = NL80211_RRF_NO_HT40; +@@ -1069,13 +1098,27 @@ static u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan, + (flags & NL80211_RRF_NO_IR)) + flags |= NL80211_RRF_GO_CONCURRENT; + ++ /* ++ * cap_flags is per regulatory domain so apply it for every channel ++ */ ++ if (ch_idx >= NUM_2GHZ_CHANNELS) { ++ if (cap_flags & REG_CAPA_40MHZ_FORBIDDEN) ++ flags |= NL80211_RRF_NO_HT40; ++ ++ if (!(cap_flags & REG_CAPA_80MHZ_ALLOWED)) ++ flags |= NL80211_RRF_NO_80MHZ; ++ ++ if (!(cap_flags & REG_CAPA_160MHZ_ALLOWED)) ++ flags |= NL80211_RRF_NO_160MHZ; ++ } ++ + return flags; + } + + struct ieee80211_regdomain * + iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg, + int num_of_ch, __le32 *channels, u16 fw_mcc, +- u16 geo_info) ++ u16 geo_info, u16 cap) + { + int ch_idx; + u16 ch_flags; +@@ -1133,7 +1176,8 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg, + } + + reg_rule_flags = iwl_nvm_get_regdom_bw_flags(nvm_chan, ch_idx, +- ch_flags, cfg); ++ ch_flags, cap, ++ cfg); + + /* we can't continue the same rule */ + if (ch_idx == 0 || prev_reg_rule_flags != reg_rule_flags || +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h +index b7e1ddf8f177..4eeedb41e9ac 100644 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h +@@ -7,7 +7,7 @@ + * + * Copyright(c) 2008 - 2015 Intel Corporation. All rights reserved. + * Copyright(c) 2016 - 2017 Intel Deutschland GmbH +- * Copyright(c) 2018 Intel Corporation ++ * Copyright(c) 2018 - 2019 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as +@@ -29,7 +29,7 @@ + * + * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. + * Copyright(c) 2016 - 2017 Intel Deutschland GmbH +- * Copyright(c) 2018 Intel Corporation ++ * Copyright(c) 2018 - 2019 Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without +@@ -103,7 +103,7 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg, + struct ieee80211_regdomain * + iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg, + int num_of_ch, __le32 *channels, u16 fw_mcc, +- u16 geo_info); ++ u16 geo_info, u16 cap); + + /** + * struct iwl_nvm_section - describes an NVM section in memory. +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.c b/drivers/net/wireless/intel/iwlwifi/iwl-trans.c +index 28bdc9a9617e..f91197e4ae40 100644 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.c ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.c +@@ -66,7 +66,9 @@ + + struct iwl_trans *iwl_trans_alloc(unsigned int priv_size, + struct device *dev, +- const struct iwl_trans_ops *ops) ++ const struct iwl_trans_ops *ops, ++ unsigned int cmd_pool_size, ++ unsigned int cmd_pool_align) + { + struct iwl_trans *trans; + #ifdef CONFIG_LOCKDEP +@@ -90,10 +92,8 @@ struct iwl_trans *iwl_trans_alloc(unsigned int priv_size, + "iwl_cmd_pool:%s", dev_name(trans->dev)); + trans->dev_cmd_pool = + kmem_cache_create(trans->dev_cmd_pool_name, +- sizeof(struct iwl_device_cmd), +- sizeof(void *), +- SLAB_HWCACHE_ALIGN, +- NULL); ++ cmd_pool_size, cmd_pool_align, ++ SLAB_HWCACHE_ALIGN, NULL); + if (!trans->dev_cmd_pool) + return NULL; + +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h +index a31408188ed0..1e85d59b9161 100644 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h +@@ -193,6 +193,18 @@ struct iwl_device_cmd { + }; + } __packed; + ++/** ++ * struct iwl_device_tx_cmd - buffer for TX command ++ * @hdr: the header ++ * @payload: the payload placeholder ++ * ++ * The actual structure is sized dynamically according to need. ++ */ ++struct iwl_device_tx_cmd { ++ struct iwl_cmd_header hdr; ++ u8 payload[]; ++} __packed; ++ + #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd)) + + /* +@@ -544,7 +556,7 @@ struct iwl_trans_ops { + int (*send_cmd)(struct iwl_trans *trans, struct iwl_host_cmd *cmd); + + int (*tx)(struct iwl_trans *trans, struct sk_buff *skb, +- struct iwl_device_cmd *dev_cmd, int queue); ++ struct iwl_device_tx_cmd *dev_cmd, int queue); + void (*reclaim)(struct iwl_trans *trans, int queue, int ssn, + struct sk_buff_head *skbs); + +@@ -921,22 +933,22 @@ iwl_trans_dump_data(struct iwl_trans *trans, u32 dump_mask) + return trans->ops->dump_data(trans, dump_mask); + } + +-static inline struct iwl_device_cmd * ++static inline struct iwl_device_tx_cmd * + iwl_trans_alloc_tx_cmd(struct iwl_trans *trans) + { +- return kmem_cache_alloc(trans->dev_cmd_pool, GFP_ATOMIC); ++ return kmem_cache_zalloc(trans->dev_cmd_pool, GFP_ATOMIC); + } + + int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd); + + static inline void iwl_trans_free_tx_cmd(struct iwl_trans *trans, +- struct iwl_device_cmd *dev_cmd) ++ struct iwl_device_tx_cmd *dev_cmd) + { + kmem_cache_free(trans->dev_cmd_pool, dev_cmd); + } + + static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb, +- struct iwl_device_cmd *dev_cmd, int queue) ++ struct iwl_device_tx_cmd *dev_cmd, int queue) + { + if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status))) + return -EIO; +@@ -1239,7 +1251,9 @@ static inline bool iwl_trans_dbg_ini_valid(struct iwl_trans *trans) + *****************************************************/ + struct iwl_trans *iwl_trans_alloc(unsigned int priv_size, + struct device *dev, +- const struct iwl_trans_ops *ops); ++ const struct iwl_trans_ops *ops, ++ unsigned int cmd_pool_size, ++ unsigned int cmd_pool_align); + void iwl_trans_free(struct iwl_trans *trans); + + /***************************************************** +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +index 49aeab7c27a2..18ccc2692437 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +@@ -256,7 +256,8 @@ struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy, + __le32_to_cpu(resp->n_channels), + resp->channels, + __le16_to_cpu(resp->mcc), +- __le16_to_cpu(resp->geo_info)); ++ __le16_to_cpu(resp->geo_info), ++ __le16_to_cpu(resp->cap)); + /* Store the return source id */ + src_id = resp->source_id; + kfree(resp); +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +index d9d82f6b5e87..2b92980a49e6 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +@@ -487,13 +487,13 @@ static void iwl_mvm_set_tx_cmd_crypto(struct iwl_mvm *mvm, + /* + * Allocates and sets the Tx cmd the driver data pointers in the skb + */ +-static struct iwl_device_cmd * ++static struct iwl_device_tx_cmd * + iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb, + struct ieee80211_tx_info *info, int hdrlen, + struct ieee80211_sta *sta, u8 sta_id) + { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; +- struct iwl_device_cmd *dev_cmd; ++ struct iwl_device_tx_cmd *dev_cmd; + struct iwl_tx_cmd *tx_cmd; + + dev_cmd = iwl_trans_alloc_tx_cmd(mvm->trans); +@@ -501,11 +501,6 @@ iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb, + if (unlikely(!dev_cmd)) + return NULL; + +- /* Make sure we zero enough of dev_cmd */ +- BUILD_BUG_ON(sizeof(struct iwl_tx_cmd_gen2) > sizeof(*tx_cmd)); +- BUILD_BUG_ON(sizeof(struct iwl_tx_cmd_gen3) > sizeof(*tx_cmd)); +- +- memset(dev_cmd, 0, sizeof(dev_cmd->hdr) + sizeof(*tx_cmd)); + dev_cmd->hdr.cmd = TX_CMD; + + if (iwl_mvm_has_new_tx_api(mvm)) { +@@ -594,7 +589,7 @@ out: + } + + static void iwl_mvm_skb_prepare_status(struct sk_buff *skb, +- struct iwl_device_cmd *cmd) ++ struct iwl_device_tx_cmd *cmd) + { + struct ieee80211_tx_info *skb_info = IEEE80211_SKB_CB(skb); + +@@ -713,7 +708,7 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb) + { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_tx_info info; +- struct iwl_device_cmd *dev_cmd; ++ struct iwl_device_tx_cmd *dev_cmd; + u8 sta_id; + int hdrlen = ieee80211_hdrlen(hdr->frame_control); + __le16 fc = hdr->frame_control; +@@ -1075,7 +1070,7 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb, + { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct iwl_mvm_sta *mvmsta; +- struct iwl_device_cmd *dev_cmd; ++ struct iwl_device_tx_cmd *dev_cmd; + __le16 fc; + u16 seq_number = 0; + u8 tid = IWL_MAX_TID_COUNT; +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h +index 1047d48beaa5..9b5b96e34456 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h +@@ -305,7 +305,7 @@ struct iwl_cmd_meta { + #define IWL_FIRST_TB_SIZE_ALIGN ALIGN(IWL_FIRST_TB_SIZE, 64) + + struct iwl_pcie_txq_entry { +- struct iwl_device_cmd *cmd; ++ void *cmd; + struct sk_buff *skb; + /* buffer to free after command completes */ + const void *free_buf; +@@ -690,7 +690,7 @@ void iwl_trans_pcie_txq_set_shared_mode(struct iwl_trans *trans, u32 txq_id, + void iwl_trans_pcie_log_scd_error(struct iwl_trans *trans, + struct iwl_txq *txq); + int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, +- struct iwl_device_cmd *dev_cmd, int txq_id); ++ struct iwl_device_tx_cmd *dev_cmd, int txq_id); + void iwl_pcie_txq_check_wrptrs(struct iwl_trans *trans); + int iwl_trans_pcie_send_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd); + void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx); +@@ -1111,7 +1111,7 @@ int iwl_trans_pcie_dyn_txq_alloc(struct iwl_trans *trans, + unsigned int timeout); + void iwl_trans_pcie_dyn_txq_free(struct iwl_trans *trans, int queue); + int iwl_trans_pcie_gen2_tx(struct iwl_trans *trans, struct sk_buff *skb, +- struct iwl_device_cmd *dev_cmd, int txq_id); ++ struct iwl_device_tx_cmd *dev_cmd, int txq_id); + int iwl_trans_pcie_gen2_send_hcmd(struct iwl_trans *trans, + struct iwl_host_cmd *cmd); + void iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans); +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +index d3db38c3095b..c76d26708e65 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +@@ -79,6 +79,7 @@ + #include "iwl-agn-hw.h" + #include "fw/error-dump.h" + #include "fw/dbg.h" ++#include "fw/api/tx.h" + #include "internal.h" + #include "iwl-fh.h" + +@@ -3462,19 +3463,34 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, + { + struct iwl_trans_pcie *trans_pcie; + struct iwl_trans *trans; +- int ret, addr_size; ++ int ret, addr_size, txcmd_size, txcmd_align; ++ const struct iwl_trans_ops *ops = &trans_ops_pcie_gen2; ++ ++ if (!cfg_trans->gen2) { ++ ops = &trans_ops_pcie; ++ txcmd_size = sizeof(struct iwl_tx_cmd); ++ txcmd_align = sizeof(void *); ++ } else if (cfg_trans->device_family < IWL_DEVICE_FAMILY_AX210) { ++ txcmd_size = sizeof(struct iwl_tx_cmd_gen2); ++ txcmd_align = 64; ++ } else { ++ txcmd_size = sizeof(struct iwl_tx_cmd_gen3); ++ txcmd_align = 128; ++ } ++ ++ txcmd_size += sizeof(struct iwl_cmd_header); ++ txcmd_size += 36; /* biggest possible 802.11 header */ ++ ++ /* Ensure device TX cmd cannot reach/cross a page boundary in gen2 */ ++ if (WARN_ON(cfg_trans->gen2 && txcmd_size >= txcmd_align)) ++ return ERR_PTR(-EINVAL); + + ret = pcim_enable_device(pdev); + if (ret) + return ERR_PTR(ret); + +- if (cfg_trans->gen2) +- trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie), +- &pdev->dev, &trans_ops_pcie_gen2); +- else +- trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie), +- &pdev->dev, &trans_ops_pcie); +- ++ trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie), &pdev->dev, ops, ++ txcmd_size, txcmd_align); + if (!trans) + return ERR_PTR(-ENOMEM); + +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c +index 97cb3a8d505c..ff4c34d7b74f 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c +@@ -243,7 +243,8 @@ static int iwl_pcie_gen2_set_tb(struct iwl_trans *trans, + static int iwl_pcie_gen2_build_amsdu(struct iwl_trans *trans, + struct sk_buff *skb, + struct iwl_tfh_tfd *tfd, int start_len, +- u8 hdr_len, struct iwl_device_cmd *dev_cmd) ++ u8 hdr_len, ++ struct iwl_device_tx_cmd *dev_cmd) + { + #ifdef CONFIG_INET + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); +@@ -371,7 +372,7 @@ out_err: + static struct + iwl_tfh_tfd *iwl_pcie_gen2_build_tx_amsdu(struct iwl_trans *trans, + struct iwl_txq *txq, +- struct iwl_device_cmd *dev_cmd, ++ struct iwl_device_tx_cmd *dev_cmd, + struct sk_buff *skb, + struct iwl_cmd_meta *out_meta, + int hdr_len, +@@ -403,6 +404,10 @@ iwl_tfh_tfd *iwl_pcie_gen2_build_tx_amsdu(struct iwl_trans *trans, + tb_phys = dma_map_single(trans->dev, tb1_addr, len, DMA_TO_DEVICE); + if (unlikely(dma_mapping_error(trans->dev, tb_phys))) + goto out_err; ++ /* ++ * No need for _with_wa(), we ensure (via alignment) that the data ++ * here can never cross or end at a page boundary. ++ */ + iwl_pcie_gen2_set_tb(trans, tfd, tb_phys, len); + + if (iwl_pcie_gen2_build_amsdu(trans, skb, tfd, +@@ -456,7 +461,7 @@ static int iwl_pcie_gen2_tx_add_frags(struct iwl_trans *trans, + static struct + iwl_tfh_tfd *iwl_pcie_gen2_build_tx(struct iwl_trans *trans, + struct iwl_txq *txq, +- struct iwl_device_cmd *dev_cmd, ++ struct iwl_device_tx_cmd *dev_cmd, + struct sk_buff *skb, + struct iwl_cmd_meta *out_meta, + int hdr_len, +@@ -496,6 +501,10 @@ iwl_tfh_tfd *iwl_pcie_gen2_build_tx(struct iwl_trans *trans, + tb_phys = dma_map_single(trans->dev, tb1_addr, tb1_len, DMA_TO_DEVICE); + if (unlikely(dma_mapping_error(trans->dev, tb_phys))) + goto out_err; ++ /* ++ * No need for _with_wa(), we ensure (via alignment) that the data ++ * here can never cross or end at a page boundary. ++ */ + iwl_pcie_gen2_set_tb(trans, tfd, tb_phys, tb1_len); + trace_iwlwifi_dev_tx(trans->dev, skb, tfd, sizeof(*tfd), &dev_cmd->hdr, + IWL_FIRST_TB_SIZE + tb1_len, hdr_len); +@@ -540,7 +549,7 @@ out_err: + static + struct iwl_tfh_tfd *iwl_pcie_gen2_build_tfd(struct iwl_trans *trans, + struct iwl_txq *txq, +- struct iwl_device_cmd *dev_cmd, ++ struct iwl_device_tx_cmd *dev_cmd, + struct sk_buff *skb, + struct iwl_cmd_meta *out_meta) + { +@@ -580,7 +589,7 @@ struct iwl_tfh_tfd *iwl_pcie_gen2_build_tfd(struct iwl_trans *trans, + } + + int iwl_trans_pcie_gen2_tx(struct iwl_trans *trans, struct sk_buff *skb, +- struct iwl_device_cmd *dev_cmd, int txq_id) ++ struct iwl_device_tx_cmd *dev_cmd, int txq_id) + { + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); + struct iwl_cmd_meta *out_meta; +@@ -605,7 +614,7 @@ int iwl_trans_pcie_gen2_tx(struct iwl_trans *trans, struct sk_buff *skb, + + /* don't put the packet on the ring, if there is no room */ + if (unlikely(iwl_queue_space(trans, txq) < 3)) { +- struct iwl_device_cmd **dev_cmd_ptr; ++ struct iwl_device_tx_cmd **dev_cmd_ptr; + + dev_cmd_ptr = (void *)((u8 *)skb->cb + + trans_pcie->dev_cmd_offs); +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c +index 4806a04cec8c..d3b58334e13e 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c +@@ -213,8 +213,8 @@ static void iwl_pcie_txq_update_byte_cnt_tbl(struct iwl_trans *trans, + u8 sec_ctl = 0; + u16 len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; + __le16 bc_ent; +- struct iwl_tx_cmd *tx_cmd = +- (void *)txq->entries[txq->write_ptr].cmd->payload; ++ struct iwl_device_tx_cmd *dev_cmd = txq->entries[txq->write_ptr].cmd; ++ struct iwl_tx_cmd *tx_cmd = (void *)dev_cmd->payload; + u8 sta_id = tx_cmd->sta_id; + + scd_bc_tbl = trans_pcie->scd_bc_tbls.addr; +@@ -257,8 +257,8 @@ static void iwl_pcie_txq_inval_byte_cnt_tbl(struct iwl_trans *trans, + int read_ptr = txq->read_ptr; + u8 sta_id = 0; + __le16 bc_ent; +- struct iwl_tx_cmd *tx_cmd = +- (void *)txq->entries[read_ptr].cmd->payload; ++ struct iwl_device_tx_cmd *dev_cmd = txq->entries[read_ptr].cmd; ++ struct iwl_tx_cmd *tx_cmd = (void *)dev_cmd->payload; + + WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX); + +@@ -1196,7 +1196,7 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, + + while (!skb_queue_empty(&overflow_skbs)) { + struct sk_buff *skb = __skb_dequeue(&overflow_skbs); +- struct iwl_device_cmd *dev_cmd_ptr; ++ struct iwl_device_tx_cmd *dev_cmd_ptr; + + dev_cmd_ptr = *(void **)((u8 *)skb->cb + + trans_pcie->dev_cmd_offs); +@@ -2099,7 +2099,8 @@ static void iwl_compute_pseudo_hdr_csum(void *iph, struct tcphdr *tcph, + static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb, + struct iwl_txq *txq, u8 hdr_len, + struct iwl_cmd_meta *out_meta, +- struct iwl_device_cmd *dev_cmd, u16 tb1_len) ++ struct iwl_device_tx_cmd *dev_cmd, ++ u16 tb1_len) + { + struct iwl_tx_cmd *tx_cmd = (void *)dev_cmd->payload; + struct iwl_trans_pcie *trans_pcie = txq->trans_pcie; +@@ -2281,7 +2282,8 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb, + static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb, + struct iwl_txq *txq, u8 hdr_len, + struct iwl_cmd_meta *out_meta, +- struct iwl_device_cmd *dev_cmd, u16 tb1_len) ++ struct iwl_device_tx_cmd *dev_cmd, ++ u16 tb1_len) + { + /* No A-MSDU without CONFIG_INET */ + WARN_ON(1); +@@ -2291,7 +2293,7 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb, + #endif /* CONFIG_INET */ + + int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, +- struct iwl_device_cmd *dev_cmd, int txq_id) ++ struct iwl_device_tx_cmd *dev_cmd, int txq_id) + { + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); + struct ieee80211_hdr *hdr; +@@ -2348,7 +2350,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, + + /* don't put the packet on the ring, if there is no room */ + if (unlikely(iwl_queue_space(trans, txq) < 3)) { +- struct iwl_device_cmd **dev_cmd_ptr; ++ struct iwl_device_tx_cmd **dev_cmd_ptr; + + dev_cmd_ptr = (void *)((u8 *)skb->cb + + trans_pcie->dev_cmd_offs); +diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c +index d6cdabef264d..4b9e406b8461 100644 +--- a/drivers/net/wireless/rsi/rsi_91x_usb.c ++++ b/drivers/net/wireless/rsi/rsi_91x_usb.c +@@ -805,7 +805,7 @@ static int rsi_probe(struct usb_interface *pfunction, + adapter->device_model = RSI_DEV_9116; + } else { + rsi_dbg(ERR_ZONE, "%s: Unsupported RSI device id 0x%x\n", +- __func__, id ? id->idProduct : 0x0); ++ __func__, id->idProduct); + goto err1; + } + +diff --git a/drivers/platform/x86/gpd-pocket-fan.c b/drivers/platform/x86/gpd-pocket-fan.c +index 73eb1572b966..b471b86c28fe 100644 +--- a/drivers/platform/x86/gpd-pocket-fan.c ++++ b/drivers/platform/x86/gpd-pocket-fan.c +@@ -127,7 +127,7 @@ static int gpd_pocket_fan_probe(struct platform_device *pdev) + int i; + + for (i = 0; i < ARRAY_SIZE(temp_limits); i++) { +- if (temp_limits[i] < 40000 || temp_limits[i] > 70000) { ++ if (temp_limits[i] < 20000 || temp_limits[i] > 90000) { + dev_err(&pdev->dev, "Invalid temp-limit %d (must be between 40000 and 70000)\n", + temp_limits[i]); + temp_limits[0] = TEMP_LIMIT0_DEFAULT; +diff --git a/drivers/platform/x86/intel_pmc_core_pltdrv.c b/drivers/platform/x86/intel_pmc_core_pltdrv.c +index 6fe829f30997..e1266f5c6359 100644 +--- a/drivers/platform/x86/intel_pmc_core_pltdrv.c ++++ b/drivers/platform/x86/intel_pmc_core_pltdrv.c +@@ -44,6 +44,8 @@ static const struct x86_cpu_id intel_pmc_core_platform_ids[] = { + INTEL_CPU_FAM6(KABYLAKE, pmc_core_device), + INTEL_CPU_FAM6(CANNONLAKE_L, pmc_core_device), + INTEL_CPU_FAM6(ICELAKE_L, pmc_core_device), ++ INTEL_CPU_FAM6(COMETLAKE, pmc_core_device), ++ INTEL_CPU_FAM6(COMETLAKE_L, pmc_core_device), + {} + }; + MODULE_DEVICE_TABLE(x86cpu, intel_pmc_core_platform_ids); +diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c +index a1915061932e..5256e3ce84e5 100644 +--- a/drivers/s390/crypto/ap_bus.c ++++ b/drivers/s390/crypto/ap_bus.c +@@ -793,8 +793,6 @@ static int ap_device_probe(struct device *dev) + drvres = ap_drv->flags & AP_DRIVER_FLAG_DEFAULT; + if (!!devres != !!drvres) + return -ENODEV; +- /* (re-)init queue's state machine */ +- ap_queue_reinit_state(to_ap_queue(dev)); + } + + /* Add queue/card to list of active queues/cards */ +diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h +index 433b7b64368d..bb35ba4a8d24 100644 +--- a/drivers/s390/crypto/ap_bus.h ++++ b/drivers/s390/crypto/ap_bus.h +@@ -261,7 +261,7 @@ void ap_queue_prepare_remove(struct ap_queue *aq); + void ap_queue_remove(struct ap_queue *aq); + void ap_queue_suspend(struct ap_device *ap_dev); + void ap_queue_resume(struct ap_device *ap_dev); +-void ap_queue_reinit_state(struct ap_queue *aq); ++void ap_queue_init_state(struct ap_queue *aq); + + struct ap_card *ap_card_create(int id, int queue_depth, int raw_device_type, + int comp_device_type, unsigned int functions); +diff --git a/drivers/s390/crypto/ap_queue.c b/drivers/s390/crypto/ap_queue.c +index dad2be333d82..37c3bdc3642d 100644 +--- a/drivers/s390/crypto/ap_queue.c ++++ b/drivers/s390/crypto/ap_queue.c +@@ -638,7 +638,7 @@ struct ap_queue *ap_queue_create(ap_qid_t qid, int device_type) + aq->ap_dev.device.type = &ap_queue_type; + aq->ap_dev.device_type = device_type; + aq->qid = qid; +- aq->state = AP_STATE_RESET_START; ++ aq->state = AP_STATE_UNBOUND; + aq->interrupt = AP_INTR_DISABLED; + spin_lock_init(&aq->lock); + INIT_LIST_HEAD(&aq->list); +@@ -771,10 +771,11 @@ void ap_queue_remove(struct ap_queue *aq) + spin_unlock_bh(&aq->lock); + } + +-void ap_queue_reinit_state(struct ap_queue *aq) ++void ap_queue_init_state(struct ap_queue *aq) + { + spin_lock_bh(&aq->lock); + aq->state = AP_STATE_RESET_START; + ap_wait(ap_sm_event(aq, AP_EVENT_POLL)); + spin_unlock_bh(&aq->lock); + } ++EXPORT_SYMBOL(ap_queue_init_state); +diff --git a/drivers/s390/crypto/zcrypt_cex2a.c b/drivers/s390/crypto/zcrypt_cex2a.c +index c50f3e86cc74..7cbb384ec535 100644 +--- a/drivers/s390/crypto/zcrypt_cex2a.c ++++ b/drivers/s390/crypto/zcrypt_cex2a.c +@@ -175,6 +175,7 @@ static int zcrypt_cex2a_queue_probe(struct ap_device *ap_dev) + zq->queue = aq; + zq->online = 1; + atomic_set(&zq->load, 0); ++ ap_queue_init_state(aq); + ap_queue_init_reply(aq, &zq->reply); + aq->request_timeout = CEX2A_CLEANUP_TIME, + aq->private = zq; +diff --git a/drivers/s390/crypto/zcrypt_cex2c.c b/drivers/s390/crypto/zcrypt_cex2c.c +index 35c7c6672713..c78c0d119806 100644 +--- a/drivers/s390/crypto/zcrypt_cex2c.c ++++ b/drivers/s390/crypto/zcrypt_cex2c.c +@@ -220,6 +220,7 @@ static int zcrypt_cex2c_queue_probe(struct ap_device *ap_dev) + zq->queue = aq; + zq->online = 1; + atomic_set(&zq->load, 0); ++ ap_rapq(aq->qid); + rc = zcrypt_cex2c_rng_supported(aq); + if (rc < 0) { + zcrypt_queue_free(zq); +@@ -231,6 +232,7 @@ static int zcrypt_cex2c_queue_probe(struct ap_device *ap_dev) + else + zq->ops = zcrypt_msgtype(MSGTYPE06_NAME, + MSGTYPE06_VARIANT_NORNG); ++ ap_queue_init_state(aq); + ap_queue_init_reply(aq, &zq->reply); + aq->request_timeout = CEX2C_CLEANUP_TIME; + aq->private = zq; +diff --git a/drivers/s390/crypto/zcrypt_cex4.c b/drivers/s390/crypto/zcrypt_cex4.c +index 442e3d6162f7..6fabc906114c 100644 +--- a/drivers/s390/crypto/zcrypt_cex4.c ++++ b/drivers/s390/crypto/zcrypt_cex4.c +@@ -381,6 +381,7 @@ static int zcrypt_cex4_queue_probe(struct ap_device *ap_dev) + zq->queue = aq; + zq->online = 1; + atomic_set(&zq->load, 0); ++ ap_queue_init_state(aq); + ap_queue_init_reply(aq, &zq->reply); + aq->request_timeout = CEX4_CLEANUP_TIME, + aq->private = zq; +diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c +index 80608b53897b..e3f5c91d5e4f 100644 +--- a/drivers/scsi/fnic/fnic_scsi.c ++++ b/drivers/scsi/fnic/fnic_scsi.c +@@ -439,6 +439,9 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_ + if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED))) + return SCSI_MLQUEUE_HOST_BUSY; + ++ if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_FWRESET))) ++ return SCSI_MLQUEUE_HOST_BUSY; ++ + rport = starget_to_rport(scsi_target(sc->device)); + if (!rport) { + FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, +diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c +index 378369d9364a..e9ece45d7a33 100644 +--- a/drivers/soc/ti/wkup_m3_ipc.c ++++ b/drivers/soc/ti/wkup_m3_ipc.c +@@ -419,6 +419,8 @@ static void wkup_m3_rproc_boot_thread(struct wkup_m3_ipc *m3_ipc) + ret = rproc_boot(m3_ipc->rproc); + if (ret) + dev_err(dev, "rproc_boot failed\n"); ++ else ++ m3_ipc_state = m3_ipc; + + do_exit(0); + } +@@ -505,8 +507,6 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) + goto err_put_rproc; + } + +- m3_ipc_state = m3_ipc; +- + return 0; + + err_put_rproc: +diff --git a/drivers/tee/optee/Kconfig b/drivers/tee/optee/Kconfig +index d1ad512e1708..3ca71e3812ed 100644 +--- a/drivers/tee/optee/Kconfig ++++ b/drivers/tee/optee/Kconfig +@@ -3,6 +3,7 @@ + config OPTEE + tristate "OP-TEE" + depends on HAVE_ARM_SMCCC ++ depends on MMU + help + This implements the OP-TEE Trusted Execution Environment (TEE) + driver. +diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c +index 1b151af25772..abcd93a3ca1d 100644 +--- a/fs/btrfs/super.c ++++ b/fs/btrfs/super.c +@@ -2102,7 +2102,15 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf) + */ + thresh = SZ_4M; + +- if (!mixed && total_free_meta - thresh < block_rsv->size) ++ /* ++ * We only want to claim there's no available space if we can no longer ++ * allocate chunks for our metadata profile and our global reserve will ++ * not fit in the free metadata space. If we aren't ->full then we ++ * still can allocate chunks and thus are fine using the currently ++ * calculated f_bavail. ++ */ ++ if (!mixed && block_rsv->space_info->full && ++ total_free_meta - thresh < block_rsv->size) + buf->f_bavail = 0; + + buf->f_type = BTRFS_SUPER_MAGIC; +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c +index e1d8cec6ba2e..e1cac715d19e 100644 +--- a/fs/cifs/smb2pdu.c ++++ b/fs/cifs/smb2pdu.c +@@ -312,7 +312,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon) + if (server->tcpStatus != CifsNeedReconnect) + break; + +- if (--retries) ++ if (retries && --retries) + continue; + + /* +diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c +index e2437b775456..e7b9d39955d4 100644 +--- a/fs/gfs2/lops.c ++++ b/fs/gfs2/lops.c +@@ -264,7 +264,7 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno, + struct super_block *sb = sdp->sd_vfs; + struct bio *bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES); + +- bio->bi_iter.bi_sector = blkno * (sb->s_blocksize >> 9); ++ bio->bi_iter.bi_sector = blkno << (sb->s_blocksize_bits - 9); + bio_set_dev(bio, sb->s_bdev); + bio->bi_end_io = end_io; + bio->bi_private = sdp; +@@ -471,6 +471,20 @@ static void gfs2_jhead_process_page(struct gfs2_jdesc *jd, unsigned long index, + put_page(page); /* Once more for find_or_create_page */ + } + ++static struct bio *gfs2_chain_bio(struct bio *prev, unsigned int nr_iovecs) ++{ ++ struct bio *new; ++ ++ new = bio_alloc(GFP_NOIO, nr_iovecs); ++ bio_copy_dev(new, prev); ++ new->bi_iter.bi_sector = bio_end_sector(prev); ++ new->bi_opf = prev->bi_opf; ++ new->bi_write_hint = prev->bi_write_hint; ++ bio_chain(new, prev); ++ submit_bio(prev); ++ return new; ++} ++ + /** + * gfs2_find_jhead - find the head of a log + * @jd: The journal descriptor +@@ -487,15 +501,15 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, + struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); + struct address_space *mapping = jd->jd_inode->i_mapping; + unsigned int block = 0, blocks_submitted = 0, blocks_read = 0; +- unsigned int bsize = sdp->sd_sb.sb_bsize; ++ unsigned int bsize = sdp->sd_sb.sb_bsize, off; + unsigned int bsize_shift = sdp->sd_sb.sb_bsize_shift; + unsigned int shift = PAGE_SHIFT - bsize_shift; +- unsigned int readhead_blocks = BIO_MAX_PAGES << shift; ++ unsigned int readahead_blocks = BIO_MAX_PAGES << shift; + struct gfs2_journal_extent *je; + int sz, ret = 0; + struct bio *bio = NULL; + struct page *page = NULL; +- bool done = false; ++ bool bio_chained = false, done = false; + errseq_t since; + + memset(head, 0, sizeof(*head)); +@@ -504,9 +518,9 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, + + since = filemap_sample_wb_err(mapping); + list_for_each_entry(je, &jd->extent_list, list) { +- for (; block < je->lblock + je->blocks; block++) { +- u64 dblock; ++ u64 dblock = je->dblock; + ++ for (; block < je->lblock + je->blocks; block++, dblock++) { + if (!page) { + page = find_or_create_page(mapping, + block >> shift, GFP_NOFS); +@@ -515,35 +529,41 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, + done = true; + goto out; + } ++ off = 0; + } + +- if (bio) { +- unsigned int off; +- +- off = (block << bsize_shift) & ~PAGE_MASK; ++ if (!bio || (bio_chained && !off)) { ++ /* start new bio */ ++ } else { + sz = bio_add_page(bio, page, bsize, off); +- if (sz == bsize) { /* block added */ +- if (off + bsize == PAGE_SIZE) { +- page = NULL; +- goto page_added; +- } +- continue; ++ if (sz == bsize) ++ goto block_added; ++ if (off) { ++ unsigned int blocks = ++ (PAGE_SIZE - off) >> bsize_shift; ++ ++ bio = gfs2_chain_bio(bio, blocks); ++ bio_chained = true; ++ goto add_block_to_new_bio; + } ++ } ++ ++ if (bio) { + blocks_submitted = block + 1; + submit_bio(bio); +- bio = NULL; + } + +- dblock = je->dblock + (block - je->lblock); + bio = gfs2_log_alloc_bio(sdp, dblock, gfs2_end_log_read); + bio->bi_opf = REQ_OP_READ; +- sz = bio_add_page(bio, page, bsize, 0); +- gfs2_assert_warn(sdp, sz == bsize); +- if (bsize == PAGE_SIZE) ++ bio_chained = false; ++add_block_to_new_bio: ++ sz = bio_add_page(bio, page, bsize, off); ++ BUG_ON(sz != bsize); ++block_added: ++ off += bsize; ++ if (off == PAGE_SIZE) + page = NULL; +- +-page_added: +- if (blocks_submitted < blocks_read + readhead_blocks) { ++ if (blocks_submitted < blocks_read + readahead_blocks) { + /* Keep at least one bio in flight */ + continue; + } +diff --git a/fs/namei.c b/fs/namei.c +index e81521c87f98..bd1c0ca4151c 100644 +--- a/fs/namei.c ++++ b/fs/namei.c +@@ -3249,8 +3249,8 @@ static int do_last(struct nameidata *nd, + struct file *file, const struct open_flags *op) + { + struct dentry *dir = nd->path.dentry; +- kuid_t dir_uid = dir->d_inode->i_uid; +- umode_t dir_mode = dir->d_inode->i_mode; ++ kuid_t dir_uid = nd->inode->i_uid; ++ umode_t dir_mode = nd->inode->i_mode; + int open_flag = op->open_flag; + bool will_truncate = (open_flag & O_TRUNC) != 0; + bool got_write = false; +diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c +index 3244037b1286..d127af64283e 100644 +--- a/fs/reiserfs/super.c ++++ b/fs/reiserfs/super.c +@@ -629,6 +629,7 @@ static void reiserfs_put_super(struct super_block *s) + reiserfs_write_unlock(s); + mutex_destroy(&REISERFS_SB(s)->lock); + destroy_workqueue(REISERFS_SB(s)->commit_wq); ++ kfree(REISERFS_SB(s)->s_jdev); + kfree(s->s_fs_info); + s->s_fs_info = NULL; + } +@@ -2240,6 +2241,7 @@ error_unlocked: + kfree(qf_names[j]); + } + #endif ++ kfree(sbi->s_jdev); + kfree(sbi); + + s->s_fs_info = NULL; +diff --git a/include/linux/sched.h b/include/linux/sched.h +index 775503573ed7..b968d736833b 100644 +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -1915,11 +1915,11 @@ static inline void rseq_migrate(struct task_struct *t) + + /* + * If parent process has a registered restartable sequences area, the +- * child inherits. Only applies when forking a process, not a thread. ++ * child inherits. Unregister rseq for a clone with CLONE_VM set. + */ + static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags) + { +- if (clone_flags & CLONE_THREAD) { ++ if (clone_flags & CLONE_VM) { + t->rseq = NULL; + t->rseq_sig = 0; + t->rseq_event_mask = 0; +diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h +index 4ab2c49423dc..68782ba8b6e8 100644 +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -3537,6 +3537,9 @@ struct cfg80211_update_owe_info { + * + * @start_radar_detection: Start radar detection in the driver. + * ++ * @end_cac: End running CAC, probably because a related CAC ++ * was finished on another phy. ++ * + * @update_ft_ies: Provide updated Fast BSS Transition information to the + * driver. If the SME is in the driver/firmware, this information can be + * used in building Authentication and Reassociation Request frames. +@@ -3863,6 +3866,8 @@ struct cfg80211_ops { + struct net_device *dev, + struct cfg80211_chan_def *chandef, + u32 cac_time_ms); ++ void (*end_cac)(struct wiphy *wiphy, ++ struct net_device *dev); + int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_update_ft_ies_params *ftie); + int (*crit_proto_start)(struct wiphy *wiphy, +diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c +index ef4242e5d4bc..595c52d59f31 100644 +--- a/kernel/cgroup/cgroup.c ++++ b/kernel/cgroup/cgroup.c +@@ -3111,8 +3111,6 @@ static int cgroup_apply_control_enable(struct cgroup *cgrp) + for_each_subsys(ss, ssid) { + struct cgroup_subsys_state *css = cgroup_css(dsct, ss); + +- WARN_ON_ONCE(css && percpu_ref_is_dying(&css->refcnt)); +- + if (!(cgroup_ss_mask(dsct) & (1 << ss->id))) + continue; + +@@ -3122,6 +3120,8 @@ static int cgroup_apply_control_enable(struct cgroup *cgrp) + return PTR_ERR(css); + } + ++ WARN_ON_ONCE(percpu_ref_is_dying(&css->refcnt)); ++ + if (css_visible(css)) { + ret = css_populate_dir(css); + if (ret) +@@ -3157,11 +3157,11 @@ static void cgroup_apply_control_disable(struct cgroup *cgrp) + for_each_subsys(ss, ssid) { + struct cgroup_subsys_state *css = cgroup_css(dsct, ss); + +- WARN_ON_ONCE(css && percpu_ref_is_dying(&css->refcnt)); +- + if (!css) + continue; + ++ WARN_ON_ONCE(percpu_ref_is_dying(&css->refcnt)); ++ + if (css->parent && + !(cgroup_ss_mask(dsct) & (1 << ss->id))) { + kill_css(css); +@@ -3448,7 +3448,8 @@ static ssize_t cgroup_type_write(struct kernfs_open_file *of, char *buf, + if (strcmp(strstrip(buf), "threaded")) + return -EINVAL; + +- cgrp = cgroup_kn_lock_live(of->kn, false); ++ /* drain dying csses before we re-apply (threaded) subtree control */ ++ cgrp = cgroup_kn_lock_live(of->kn, true); + if (!cgrp) + return -ENOENT; + +diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c +index 3e5f9c7d939c..3f54dc2f6e1c 100644 +--- a/kernel/trace/trace_kprobe.c ++++ b/kernel/trace/trace_kprobe.c +@@ -290,7 +290,7 @@ static struct trace_kprobe *alloc_trace_kprobe(const char *group, + INIT_HLIST_NODE(&tk->rp.kp.hlist); + INIT_LIST_HEAD(&tk->rp.kp.list); + +- ret = trace_probe_init(&tk->tp, event, group, 0); ++ ret = trace_probe_init(&tk->tp, event, group, false); + if (ret < 0) + goto error; + +diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c +index bba18cf44a30..9ae87be422f2 100644 +--- a/kernel/trace/trace_probe.c ++++ b/kernel/trace/trace_probe.c +@@ -984,16 +984,19 @@ void trace_probe_cleanup(struct trace_probe *tp) + } + + int trace_probe_init(struct trace_probe *tp, const char *event, +- const char *group, size_t event_data_size) ++ const char *group, bool alloc_filter) + { + struct trace_event_call *call; ++ size_t size = sizeof(struct trace_probe_event); + int ret = 0; + + if (!event || !group) + return -EINVAL; + +- tp->event = kzalloc(sizeof(struct trace_probe_event) + event_data_size, +- GFP_KERNEL); ++ if (alloc_filter) ++ size += sizeof(struct trace_uprobe_filter); ++ ++ tp->event = kzalloc(size, GFP_KERNEL); + if (!tp->event) + return -ENOMEM; + +diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h +index 03e4e180058d..a0ff9e200ef6 100644 +--- a/kernel/trace/trace_probe.h ++++ b/kernel/trace/trace_probe.h +@@ -223,6 +223,12 @@ struct probe_arg { + const struct fetch_type *type; /* Type of this argument */ + }; + ++struct trace_uprobe_filter { ++ rwlock_t rwlock; ++ int nr_systemwide; ++ struct list_head perf_events; ++}; ++ + /* Event call and class holder */ + struct trace_probe_event { + unsigned int flags; /* For TP_FLAG_* */ +@@ -230,7 +236,7 @@ struct trace_probe_event { + struct trace_event_call call; + struct list_head files; + struct list_head probes; +- char data[0]; ++ struct trace_uprobe_filter filter[0]; + }; + + struct trace_probe { +@@ -323,7 +329,7 @@ static inline bool trace_probe_has_single_file(struct trace_probe *tp) + } + + int trace_probe_init(struct trace_probe *tp, const char *event, +- const char *group, size_t event_data_size); ++ const char *group, bool alloc_filter); + void trace_probe_cleanup(struct trace_probe *tp); + int trace_probe_append(struct trace_probe *tp, struct trace_probe *to); + void trace_probe_unlink(struct trace_probe *tp); +diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c +index f66e202fec13..2619bc5ed520 100644 +--- a/kernel/trace/trace_uprobe.c ++++ b/kernel/trace/trace_uprobe.c +@@ -34,12 +34,6 @@ struct uprobe_trace_entry_head { + #define DATAOF_TRACE_ENTRY(entry, is_return) \ + ((void*)(entry) + SIZEOF_TRACE_ENTRY(is_return)) + +-struct trace_uprobe_filter { +- rwlock_t rwlock; +- int nr_systemwide; +- struct list_head perf_events; +-}; +- + static int trace_uprobe_create(int argc, const char **argv); + static int trace_uprobe_show(struct seq_file *m, struct dyn_event *ev); + static int trace_uprobe_release(struct dyn_event *ev); +@@ -263,14 +257,6 @@ process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs, void *dest, + } + NOKPROBE_SYMBOL(process_fetch_insn) + +-static struct trace_uprobe_filter * +-trace_uprobe_get_filter(struct trace_uprobe *tu) +-{ +- struct trace_probe_event *event = tu->tp.event; +- +- return (struct trace_uprobe_filter *)&event->data[0]; +-} +- + static inline void init_trace_uprobe_filter(struct trace_uprobe_filter *filter) + { + rwlock_init(&filter->rwlock); +@@ -358,8 +344,7 @@ alloc_trace_uprobe(const char *group, const char *event, int nargs, bool is_ret) + if (!tu) + return ERR_PTR(-ENOMEM); + +- ret = trace_probe_init(&tu->tp, event, group, +- sizeof(struct trace_uprobe_filter)); ++ ret = trace_probe_init(&tu->tp, event, group, true); + if (ret < 0) + goto error; + +@@ -367,7 +352,7 @@ alloc_trace_uprobe(const char *group, const char *event, int nargs, bool is_ret) + tu->consumer.handler = uprobe_dispatcher; + if (is_ret) + tu->consumer.ret_handler = uretprobe_dispatcher; +- init_trace_uprobe_filter(trace_uprobe_get_filter(tu)); ++ init_trace_uprobe_filter(tu->tp.event->filter); + return tu; + + error: +@@ -1076,7 +1061,7 @@ static void __probe_event_disable(struct trace_probe *tp) + struct trace_uprobe *tu; + + tu = container_of(tp, struct trace_uprobe, tp); +- WARN_ON(!uprobe_filter_is_empty(trace_uprobe_get_filter(tu))); ++ WARN_ON(!uprobe_filter_is_empty(tu->tp.event->filter)); + + list_for_each_entry(pos, trace_probe_probe_list(tp), list) { + tu = container_of(pos, struct trace_uprobe, tp); +@@ -1117,7 +1102,7 @@ static int probe_event_enable(struct trace_event_call *call, + } + + tu = container_of(tp, struct trace_uprobe, tp); +- WARN_ON(!uprobe_filter_is_empty(trace_uprobe_get_filter(tu))); ++ WARN_ON(!uprobe_filter_is_empty(tu->tp.event->filter)); + + if (enabled) + return 0; +@@ -1281,7 +1266,7 @@ static int uprobe_perf_close(struct trace_event_call *call, + return -ENODEV; + + tu = container_of(tp, struct trace_uprobe, tp); +- if (trace_uprobe_filter_remove(trace_uprobe_get_filter(tu), event)) ++ if (trace_uprobe_filter_remove(tu->tp.event->filter, event)) + return 0; + + list_for_each_entry(pos, trace_probe_probe_list(tp), list) { +@@ -1306,7 +1291,7 @@ static int uprobe_perf_open(struct trace_event_call *call, + return -ENODEV; + + tu = container_of(tp, struct trace_uprobe, tp); +- if (trace_uprobe_filter_add(trace_uprobe_get_filter(tu), event)) ++ if (trace_uprobe_filter_add(tu->tp.event->filter, event)) + return 0; + + list_for_each_entry(pos, trace_probe_probe_list(tp), list) { +@@ -1328,7 +1313,7 @@ static bool uprobe_perf_filter(struct uprobe_consumer *uc, + int ret; + + tu = container_of(uc, struct trace_uprobe, consumer); +- filter = trace_uprobe_get_filter(tu); ++ filter = tu->tp.event->filter; + + read_lock(&filter->rwlock); + ret = __uprobe_perf_filter(filter, mm); +diff --git a/lib/test_xarray.c b/lib/test_xarray.c +index 03c3f42966ce..55c14e8c8859 100644 +--- a/lib/test_xarray.c ++++ b/lib/test_xarray.c +@@ -1160,6 +1160,27 @@ static noinline void check_move_tiny(struct xarray *xa) + XA_BUG_ON(xa, !xa_empty(xa)); + } + ++static noinline void check_move_max(struct xarray *xa) ++{ ++ XA_STATE(xas, xa, 0); ++ ++ xa_store_index(xa, ULONG_MAX, GFP_KERNEL); ++ rcu_read_lock(); ++ XA_BUG_ON(xa, xas_find(&xas, ULONG_MAX) != xa_mk_index(ULONG_MAX)); ++ XA_BUG_ON(xa, xas_find(&xas, ULONG_MAX) != NULL); ++ rcu_read_unlock(); ++ ++ xas_set(&xas, 0); ++ rcu_read_lock(); ++ XA_BUG_ON(xa, xas_find(&xas, ULONG_MAX) != xa_mk_index(ULONG_MAX)); ++ xas_pause(&xas); ++ XA_BUG_ON(xa, xas_find(&xas, ULONG_MAX) != NULL); ++ rcu_read_unlock(); ++ ++ xa_erase_index(xa, ULONG_MAX); ++ XA_BUG_ON(xa, !xa_empty(xa)); ++} ++ + static noinline void check_move_small(struct xarray *xa, unsigned long idx) + { + XA_STATE(xas, xa, 0); +@@ -1268,6 +1289,7 @@ static noinline void check_move(struct xarray *xa) + xa_destroy(xa); + + check_move_tiny(xa); ++ check_move_max(xa); + + for (i = 0; i < 16; i++) + check_move_small(xa, 1UL << i); +diff --git a/lib/xarray.c b/lib/xarray.c +index 47e17d46e5f8..1d9fab7db8da 100644 +--- a/lib/xarray.c ++++ b/lib/xarray.c +@@ -968,6 +968,7 @@ void xas_pause(struct xa_state *xas) + if (xas_invalid(xas)) + return; + ++ xas->xa_node = XAS_RESTART; + if (node) { + unsigned int offset = xas->xa_offset; + while (++offset < XA_CHUNK_SIZE) { +@@ -975,10 +976,11 @@ void xas_pause(struct xa_state *xas) + break; + } + xas->xa_index += (offset - xas->xa_offset) << node->shift; ++ if (xas->xa_index == 0) ++ xas->xa_node = XAS_BOUNDS; + } else { + xas->xa_index++; + } +- xas->xa_node = XAS_RESTART; + } + EXPORT_SYMBOL_GPL(xas_pause); + +@@ -1080,7 +1082,7 @@ void *xas_find(struct xa_state *xas, unsigned long max) + { + void *entry; + +- if (xas_error(xas)) ++ if (xas_error(xas) || xas->xa_node == XAS_BOUNDS) + return NULL; + if (xas->xa_index > max) + return set_bounds(xas); +@@ -1088,7 +1090,7 @@ void *xas_find(struct xa_state *xas, unsigned long max) + if (!xas->xa_node) { + xas->xa_index = 1; + return set_bounds(xas); +- } else if (xas_top(xas->xa_node)) { ++ } else if (xas->xa_node == XAS_RESTART) { + entry = xas_load(xas); + if (entry || xas_not_node(xas->xa_node)) + return entry; +diff --git a/mm/mempolicy.c b/mm/mempolicy.c +index e08c94170ae4..fbb3258af275 100644 +--- a/mm/mempolicy.c ++++ b/mm/mempolicy.c +@@ -2802,6 +2802,9 @@ int mpol_parse_str(char *str, struct mempolicy **mpol) + char *flags = strchr(str, '='); + int err = 1, mode; + ++ if (flags) ++ *flags++ = '\0'; /* terminate mode string */ ++ + if (nodelist) { + /* NUL-terminate mode or flags string */ + *nodelist++ = '\0'; +@@ -2812,9 +2815,6 @@ int mpol_parse_str(char *str, struct mempolicy **mpol) + } else + nodes_clear(nodes); + +- if (flags) +- *flags++ = '\0'; /* terminate mode string */ +- + mode = match_string(policy_modes, MPOL_MAX, str); + if (mode < 0) + goto out; +diff --git a/mm/migrate.c b/mm/migrate.c +index 45d3303e0022..6956627ebf8b 100644 +--- a/mm/migrate.c ++++ b/mm/migrate.c +@@ -1680,7 +1680,7 @@ out_flush: + err1 = do_move_pages_to_node(mm, &pagelist, current_node); + if (!err1) + err1 = store_status(status, start, current_node, i - start); +- if (!err) ++ if (err >= 0) + err = err1; + out: + return err; +diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c +index d32077b28433..8159b344deef 100644 +--- a/net/bluetooth/hci_sock.c ++++ b/net/bluetooth/hci_sock.c +@@ -831,6 +831,8 @@ static int hci_sock_release(struct socket *sock) + if (!sk) + return 0; + ++ lock_sock(sk); ++ + switch (hci_pi(sk)->channel) { + case HCI_CHANNEL_MONITOR: + atomic_dec(&monitor_promisc); +@@ -878,6 +880,7 @@ static int hci_sock_release(struct socket *sock) + skb_queue_purge(&sk->sk_receive_queue); + skb_queue_purge(&sk->sk_write_queue); + ++ release_sock(sk); + sock_put(sk); + return 0; + } +diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c +index 1292f3f0f93f..96b2566c298d 100644 +--- a/net/core/flow_dissector.c ++++ b/net/core/flow_dissector.c +@@ -758,10 +758,10 @@ static void __skb_flow_bpf_to_target(const struct bpf_flow_keys *flow_keys, + struct flow_dissector *flow_dissector, + void *target_container) + { ++ struct flow_dissector_key_ports *key_ports = NULL; + struct flow_dissector_key_control *key_control; + struct flow_dissector_key_basic *key_basic; + struct flow_dissector_key_addrs *key_addrs; +- struct flow_dissector_key_ports *key_ports; + struct flow_dissector_key_tags *key_tags; + + key_control = skb_flow_dissector_target(flow_dissector, +@@ -800,10 +800,17 @@ static void __skb_flow_bpf_to_target(const struct bpf_flow_keys *flow_keys, + key_control->addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; + } + +- if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS)) { ++ if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS)) + key_ports = skb_flow_dissector_target(flow_dissector, + FLOW_DISSECTOR_KEY_PORTS, + target_container); ++ else if (dissector_uses_key(flow_dissector, ++ FLOW_DISSECTOR_KEY_PORTS_RANGE)) ++ key_ports = skb_flow_dissector_target(flow_dissector, ++ FLOW_DISSECTOR_KEY_PORTS_RANGE, ++ target_container); ++ ++ if (key_ports) { + key_ports->src = flow_keys->sport; + key_ports->dst = flow_keys->dport; + } +diff --git a/net/core/utils.c b/net/core/utils.c +index 6b6e51db9f3b..1f31a39236d5 100644 +--- a/net/core/utils.c ++++ b/net/core/utils.c +@@ -438,6 +438,23 @@ void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, + } + EXPORT_SYMBOL(inet_proto_csum_replace4); + ++/** ++ * inet_proto_csum_replace16 - update layer 4 header checksum field ++ * @sum: Layer 4 header checksum field ++ * @skb: sk_buff for the packet ++ * @from: old IPv6 address ++ * @to: new IPv6 address ++ * @pseudohdr: True if layer 4 header checksum includes pseudoheader ++ * ++ * Update layer 4 header as per the update in IPv6 src/dst address. ++ * ++ * There is no need to update skb->csum in this function, because update in two ++ * fields a.) IPv6 src/dst address and b.) L4 header checksum cancels each other ++ * for skb->csum calculation. Whereas inet_proto_csum_replace4 function needs to ++ * update skb->csum, because update in 3 fields a.) IPv4 src/dst address, ++ * b.) IPv4 Header checksum and c.) L4 header checksum results in same diff as ++ * L4 Header checksum for skb->csum calculation. ++ */ + void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, + const __be32 *from, const __be32 *to, + bool pseudohdr) +@@ -449,9 +466,6 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, + if (skb->ip_summed != CHECKSUM_PARTIAL) { + *sum = csum_fold(csum_partial(diff, sizeof(diff), + ~csum_unfold(*sum))); +- if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr) +- skb->csum = ~csum_partial(diff, sizeof(diff), +- ~skb->csum); + } else if (pseudohdr) + *sum = ~csum_fold(csum_partial(diff, sizeof(diff), + csum_unfold(*sum))); +diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c +index fb9f6d60c27c..79eef5db336a 100644 +--- a/net/ipv4/ip_vti.c ++++ b/net/ipv4/ip_vti.c +@@ -187,8 +187,17 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev, + int mtu; + + if (!dst) { +- dev->stats.tx_carrier_errors++; +- goto tx_error_icmp; ++ struct rtable *rt; ++ ++ fl->u.ip4.flowi4_oif = dev->ifindex; ++ fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC; ++ rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4); ++ if (IS_ERR(rt)) { ++ dev->stats.tx_carrier_errors++; ++ goto tx_error_icmp; ++ } ++ dst = &rt->dst; ++ skb_dst_set(skb, dst); + } + + dst_hold(dst); +diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c +index 6f08b760c2a7..524006aa0d78 100644 +--- a/net/ipv6/ip6_vti.c ++++ b/net/ipv6/ip6_vti.c +@@ -449,8 +449,17 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) + int err = -1; + int mtu; + +- if (!dst) +- goto tx_err_link_failure; ++ if (!dst) { ++ fl->u.ip6.flowi6_oif = dev->ifindex; ++ fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC; ++ dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6); ++ if (dst->error) { ++ dst_release(dst); ++ dst = NULL; ++ goto tx_err_link_failure; ++ } ++ skb_dst_set(skb, dst); ++ } + + dst_hold(dst); + dst = xfrm_lookup(t->net, dst, fl, NULL, 0); +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c +index 70739e746c13..0daaf7e37a21 100644 +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -2954,6 +2954,28 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy, + return err; + } + ++static void ieee80211_end_cac(struct wiphy *wiphy, ++ struct net_device *dev) ++{ ++ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); ++ struct ieee80211_local *local = sdata->local; ++ ++ mutex_lock(&local->mtx); ++ list_for_each_entry(sdata, &local->interfaces, list) { ++ /* it might be waiting for the local->mtx, but then ++ * by the time it gets it, sdata->wdev.cac_started ++ * will no longer be true ++ */ ++ cancel_delayed_work(&sdata->dfs_cac_timer_work); ++ ++ if (sdata->wdev.cac_started) { ++ ieee80211_vif_release_channel(sdata); ++ sdata->wdev.cac_started = false; ++ } ++ } ++ mutex_unlock(&local->mtx); ++} ++ + static struct cfg80211_beacon_data * + cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon) + { +@@ -4023,6 +4045,7 @@ const struct cfg80211_ops mac80211_config_ops = { + #endif + .get_channel = ieee80211_cfg_get_channel, + .start_radar_detection = ieee80211_start_radar_detection, ++ .end_cac = ieee80211_end_cac, + .channel_switch = ieee80211_channel_switch, + .set_qos_map = ieee80211_set_qos_map, + .set_ap_chanwidth = ieee80211_set_ap_chanwidth, +diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c +index 68af62306385..d69983370381 100644 +--- a/net/mac80211/mesh_hwmp.c ++++ b/net/mac80211/mesh_hwmp.c +@@ -328,6 +328,9 @@ u32 airtime_link_metric_get(struct ieee80211_local *local, + unsigned long fail_avg = + ewma_mesh_fail_avg_read(&sta->mesh->fail_avg); + ++ if (sta->mesh->plink_state != NL80211_PLINK_ESTAB) ++ return MAX_METRIC; ++ + /* Try to get rate based on HW/SW RC algorithm. + * Rate is returned in units of Kbps, correct this + * to comply with airtime calculation units +diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c +index 727dc9f3f3b3..e7f57bb18f6e 100644 +--- a/net/mac80211/tkip.c ++++ b/net/mac80211/tkip.c +@@ -263,9 +263,21 @@ int ieee80211_tkip_decrypt_data(struct arc4_ctx *ctx, + if ((keyid >> 6) != key->conf.keyidx) + return TKIP_DECRYPT_INVALID_KEYIDX; + +- if (rx_ctx->ctx.state != TKIP_STATE_NOT_INIT && +- (iv32 < rx_ctx->iv32 || +- (iv32 == rx_ctx->iv32 && iv16 <= rx_ctx->iv16))) ++ /* Reject replays if the received TSC is smaller than or equal to the ++ * last received value in a valid message, but with an exception for ++ * the case where a new key has been set and no valid frame using that ++ * key has yet received and the local RSC was initialized to 0. This ++ * exception allows the very first frame sent by the transmitter to be ++ * accepted even if that transmitter were to use TSC 0 (IEEE 802.11 ++ * described TSC to be initialized to 1 whenever a new key is taken into ++ * use). ++ */ ++ if (iv32 < rx_ctx->iv32 || ++ (iv32 == rx_ctx->iv32 && ++ (iv16 < rx_ctx->iv16 || ++ (iv16 == rx_ctx->iv16 && ++ (rx_ctx->iv32 || rx_ctx->iv16 || ++ rx_ctx->ctx.state != TKIP_STATE_NOT_INIT))))) + return TKIP_DECRYPT_REPLAY; + + if (only_iv) { +diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c +index 0399ae8f1188..4f897b14b606 100644 +--- a/net/netfilter/nf_conntrack_proto_sctp.c ++++ b/net/netfilter/nf_conntrack_proto_sctp.c +@@ -114,7 +114,7 @@ static const u8 sctp_conntracks[2][11][SCTP_CONNTRACK_MAX] = { + { + /* ORIGINAL */ + /* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS, sHA */ +-/* init */ {sCW, sCW, sCW, sCE, sES, sSS, sSR, sSA, sCW, sHA}, ++/* init */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCW, sHA}, + /* init_ack */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCL, sHA}, + /* abort */ {sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sCL}, + /* shutdown */ {sCL, sCL, sCW, sCE, sSS, sSS, sSR, sSA, sCL, sSS}, +@@ -130,7 +130,7 @@ static const u8 sctp_conntracks[2][11][SCTP_CONNTRACK_MAX] = { + /* REPLY */ + /* sNO, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS, sHA */ + /* init */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sIV, sHA},/* INIT in sCL Big TODO */ +-/* init_ack */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sIV, sHA}, ++/* init_ack */ {sIV, sCW, sCW, sCE, sES, sSS, sSR, sSA, sIV, sHA}, + /* abort */ {sIV, sCL, sCL, sCL, sCL, sCL, sCL, sCL, sIV, sCL}, + /* shutdown */ {sIV, sCL, sCW, sCE, sSR, sSS, sSR, sSA, sIV, sSR}, + /* shutdown_ack */ {sIV, sCL, sCW, sCE, sES, sSA, sSA, sSA, sIV, sHA}, +@@ -316,7 +316,7 @@ sctp_new(struct nf_conn *ct, const struct sk_buff *skb, + ct->proto.sctp.vtag[IP_CT_DIR_REPLY] = sh->vtag; + } + +- ct->proto.sctp.state = new_state; ++ ct->proto.sctp.state = SCTP_CONNTRACK_NONE; + } + + return true; +diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c +index 96a64e7594a5..914cd0618d5a 100644 +--- a/net/netfilter/nf_tables_offload.c ++++ b/net/netfilter/nf_tables_offload.c +@@ -437,7 +437,7 @@ static void nft_indr_block_cb(struct net_device *dev, + + mutex_lock(&net->nft.commit_mutex); + chain = __nft_offload_get_chain(dev); +- if (chain) { ++ if (chain && chain->flags & NFT_CHAIN_HW_OFFLOAD) { + struct nft_base_chain *basechain; + + basechain = nft_base_chain(chain); +diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h +index 3dd9515c836b..e0d34f796d0b 100644 +--- a/net/wireless/rdev-ops.h ++++ b/net/wireless/rdev-ops.h +@@ -1171,6 +1171,16 @@ rdev_start_radar_detection(struct cfg80211_registered_device *rdev, + return ret; + } + ++static inline void ++rdev_end_cac(struct cfg80211_registered_device *rdev, ++ struct net_device *dev) ++{ ++ trace_rdev_end_cac(&rdev->wiphy, dev); ++ if (rdev->ops->end_cac) ++ rdev->ops->end_cac(&rdev->wiphy, dev); ++ trace_rdev_return_void(&rdev->wiphy); ++} ++ + static inline int + rdev_set_mcast_rate(struct cfg80211_registered_device *rdev, + struct net_device *dev, +diff --git a/net/wireless/reg.c b/net/wireless/reg.c +index 446c76d44e65..fff9a74891fc 100644 +--- a/net/wireless/reg.c ++++ b/net/wireless/reg.c +@@ -2261,14 +2261,15 @@ static void update_all_wiphy_regulatory(enum nl80211_reg_initiator initiator) + + static void handle_channel_custom(struct wiphy *wiphy, + struct ieee80211_channel *chan, +- const struct ieee80211_regdomain *regd) ++ const struct ieee80211_regdomain *regd, ++ u32 min_bw) + { + u32 bw_flags = 0; + const struct ieee80211_reg_rule *reg_rule = NULL; + const struct ieee80211_power_rule *power_rule = NULL; + u32 bw; + +- for (bw = MHZ_TO_KHZ(20); bw >= MHZ_TO_KHZ(5); bw = bw / 2) { ++ for (bw = MHZ_TO_KHZ(20); bw >= min_bw; bw = bw / 2) { + reg_rule = freq_reg_info_regd(MHZ_TO_KHZ(chan->center_freq), + regd, bw); + if (!IS_ERR(reg_rule)) +@@ -2324,8 +2325,14 @@ static void handle_band_custom(struct wiphy *wiphy, + if (!sband) + return; + ++ /* ++ * We currently assume that you always want at least 20 MHz, ++ * otherwise channel 12 might get enabled if this rule is ++ * compatible to US, which permits 2402 - 2472 MHz. ++ */ + for (i = 0; i < sband->n_channels; i++) +- handle_channel_custom(wiphy, &sband->channels[i], regd); ++ handle_channel_custom(wiphy, &sband->channels[i], regd, ++ MHZ_TO_KHZ(20)); + } + + /* Used by drivers prior to wiphy registration */ +@@ -3885,6 +3892,25 @@ bool regulatory_pre_cac_allowed(struct wiphy *wiphy) + } + EXPORT_SYMBOL(regulatory_pre_cac_allowed); + ++static void cfg80211_check_and_end_cac(struct cfg80211_registered_device *rdev) ++{ ++ struct wireless_dev *wdev; ++ /* If we finished CAC or received radar, we should end any ++ * CAC running on the same channels. ++ * the check !cfg80211_chandef_dfs_usable contain 2 options: ++ * either all channels are available - those the CAC_FINISHED ++ * event has effected another wdev state, or there is a channel ++ * in unavailable state in wdev chandef - those the RADAR_DETECTED ++ * event has effected another wdev state. ++ * In both cases we should end the CAC on the wdev. ++ */ ++ list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { ++ if (wdev->cac_started && ++ !cfg80211_chandef_dfs_usable(&rdev->wiphy, &wdev->chandef)) ++ rdev_end_cac(rdev, wdev->netdev); ++ } ++} ++ + void regulatory_propagate_dfs_state(struct wiphy *wiphy, + struct cfg80211_chan_def *chandef, + enum nl80211_dfs_state dfs_state, +@@ -3911,8 +3937,10 @@ void regulatory_propagate_dfs_state(struct wiphy *wiphy, + cfg80211_set_dfs_state(&rdev->wiphy, chandef, dfs_state); + + if (event == NL80211_RADAR_DETECTED || +- event == NL80211_RADAR_CAC_FINISHED) ++ event == NL80211_RADAR_CAC_FINISHED) { + cfg80211_sched_dfs_chan_update(rdev); ++ cfg80211_check_and_end_cac(rdev); ++ } + + nl80211_radar_notify(rdev, chandef, event, NULL, GFP_KERNEL); + } +diff --git a/net/wireless/trace.h b/net/wireless/trace.h +index d98ad2b3143b..8677d7ab7d69 100644 +--- a/net/wireless/trace.h ++++ b/net/wireless/trace.h +@@ -646,6 +646,11 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_flush_pmksa, + TP_ARGS(wiphy, netdev) + ); + ++DEFINE_EVENT(wiphy_netdev_evt, rdev_end_cac, ++ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev), ++ TP_ARGS(wiphy, netdev) ++); ++ + DECLARE_EVENT_CLASS(station_add_change, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 *mac, + struct station_parameters *params), +diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c +index 5e677dac2a0c..69102fda9ebd 100644 +--- a/net/wireless/wext-core.c ++++ b/net/wireless/wext-core.c +@@ -657,7 +657,8 @@ struct iw_statistics *get_wireless_stats(struct net_device *dev) + return NULL; + } + +-static int iw_handler_get_iwstats(struct net_device * dev, ++/* noinline to avoid a bogus warning with -O3 */ ++static noinline int iw_handler_get_iwstats(struct net_device * dev, + struct iw_request_info * info, + union iwreq_data * wrqu, + char * extra) +diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c +index 0f5131bc3342..4d5627e274fe 100644 +--- a/net/xfrm/xfrm_interface.c ++++ b/net/xfrm/xfrm_interface.c +@@ -268,9 +268,6 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) + int err = -1; + int mtu; + +- if (!dst) +- goto tx_err_link_failure; +- + dst_hold(dst); + dst = xfrm_lookup_with_ifid(xi->net, dst, fl, NULL, 0, xi->p.if_id); + if (IS_ERR(dst)) { +@@ -297,7 +294,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) + + mtu = dst_mtu(dst); + if (!skb->ignore_df && skb->len > mtu) { +- skb_dst_update_pmtu(skb, mtu); ++ skb_dst_update_pmtu_no_confirm(skb, mtu); + + if (skb->protocol == htons(ETH_P_IPV6)) { + if (mtu < IPV6_MIN_MTU) +@@ -343,6 +340,7 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct xfrm_if *xi = netdev_priv(dev); + struct net_device_stats *stats = &xi->dev->stats; ++ struct dst_entry *dst = skb_dst(skb); + struct flowi fl; + int ret; + +@@ -352,10 +350,33 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev) + case htons(ETH_P_IPV6): + xfrm_decode_session(skb, &fl, AF_INET6); + memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); ++ if (!dst) { ++ fl.u.ip6.flowi6_oif = dev->ifindex; ++ fl.u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC; ++ dst = ip6_route_output(dev_net(dev), NULL, &fl.u.ip6); ++ if (dst->error) { ++ dst_release(dst); ++ stats->tx_carrier_errors++; ++ goto tx_err; ++ } ++ skb_dst_set(skb, dst); ++ } + break; + case htons(ETH_P_IP): + xfrm_decode_session(skb, &fl, AF_INET); + memset(IPCB(skb), 0, sizeof(*IPCB(skb))); ++ if (!dst) { ++ struct rtable *rt; ++ ++ fl.u.ip4.flowi4_oif = dev->ifindex; ++ fl.u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC; ++ rt = __ip_route_output_key(dev_net(dev), &fl.u.ip4); ++ if (IS_ERR(rt)) { ++ stats->tx_carrier_errors++; ++ goto tx_err; ++ } ++ skb_dst_set(skb, &rt->dst); ++ } + break; + default: + goto tx_err; +@@ -563,12 +584,9 @@ static void xfrmi_dev_setup(struct net_device *dev) + { + dev->netdev_ops = &xfrmi_netdev_ops; + dev->type = ARPHRD_NONE; +- dev->hard_header_len = ETH_HLEN; +- dev->min_header_len = ETH_HLEN; + dev->mtu = ETH_DATA_LEN; + dev->min_mtu = ETH_MIN_MTU; +- dev->max_mtu = ETH_DATA_LEN; +- dev->addr_len = ETH_ALEN; ++ dev->max_mtu = IP_MAX_MTU; + dev->flags = IFF_NOARP; + dev->needs_free_netdev = true; + dev->priv_destructor = xfrmi_dev_free; +diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c +index c36bafbcd77e..1b467381986f 100644 +--- a/security/tomoyo/common.c ++++ b/security/tomoyo/common.c +@@ -2322,9 +2322,9 @@ static const char * const tomoyo_memory_headers[TOMOYO_MAX_MEMORY_STAT] = { + [TOMOYO_MEMORY_QUERY] = "query message:", + }; + +-/* Timestamp counter for last updated. */ +-static unsigned int tomoyo_stat_updated[TOMOYO_MAX_POLICY_STAT]; + /* Counter for number of updates. */ ++static atomic_t tomoyo_stat_updated[TOMOYO_MAX_POLICY_STAT]; ++/* Timestamp counter for last updated. */ + static time64_t tomoyo_stat_modified[TOMOYO_MAX_POLICY_STAT]; + + /** +@@ -2336,10 +2336,7 @@ static time64_t tomoyo_stat_modified[TOMOYO_MAX_POLICY_STAT]; + */ + void tomoyo_update_stat(const u8 index) + { +- /* +- * I don't use atomic operations because race condition is not fatal. +- */ +- tomoyo_stat_updated[index]++; ++ atomic_inc(&tomoyo_stat_updated[index]); + tomoyo_stat_modified[index] = ktime_get_real_seconds(); + } + +@@ -2360,7 +2357,7 @@ static void tomoyo_read_stat(struct tomoyo_io_buffer *head) + for (i = 0; i < TOMOYO_MAX_POLICY_STAT; i++) { + tomoyo_io_printf(head, "Policy %-30s %10u", + tomoyo_policy_headers[i], +- tomoyo_stat_updated[i]); ++ atomic_read(&tomoyo_stat_updated[i])); + if (tomoyo_stat_modified[i]) { + struct tomoyo_time stamp; + +diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c +index 4570f662fb48..d78f4d856aaf 100644 +--- a/sound/soc/codecs/hdac_hda.c ++++ b/sound/soc/codecs/hdac_hda.c +@@ -498,7 +498,9 @@ static int hdac_hda_dev_remove(struct hdac_device *hdev) + struct hdac_hda_priv *hda_pvt; + + hda_pvt = dev_get_drvdata(&hdev->dev); +- cancel_delayed_work_sync(&hda_pvt->codec.jackpoll_work); ++ if (hda_pvt && hda_pvt->codec.registered) ++ cancel_delayed_work_sync(&hda_pvt->codec.jackpoll_work); ++ + return 0; + } + +diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c +index adbae1f36a8a..747ca248bf10 100644 +--- a/sound/soc/codecs/rt5640.c ++++ b/sound/soc/codecs/rt5640.c +@@ -2432,6 +2432,13 @@ static void rt5640_disable_jack_detect(struct snd_soc_component *component) + { + struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); + ++ /* ++ * soc_remove_component() force-disables jack and thus rt5640->jack ++ * could be NULL at the time of driver's module unloading. ++ */ ++ if (!rt5640->jack) ++ return; ++ + disable_irq(rt5640->irq); + rt5640_cancel_work(rt5640); + +diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c +index 7ccbca47240d..fef01e1dd15c 100644 +--- a/sound/soc/soc-topology.c ++++ b/sound/soc/soc-topology.c +@@ -1891,6 +1891,10 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg, + link->num_codecs = 1; + link->num_platforms = 1; + ++ link->dobj.index = tplg->index; ++ link->dobj.ops = tplg->ops; ++ link->dobj.type = SND_SOC_DOBJ_DAI_LINK; ++ + if (strlen(pcm->pcm_name)) { + link->name = kstrdup(pcm->pcm_name, GFP_KERNEL); + link->stream_name = kstrdup(pcm->pcm_name, GFP_KERNEL); +@@ -1927,9 +1931,6 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg, + goto err; + } + +- link->dobj.index = tplg->index; +- link->dobj.ops = tplg->ops; +- link->dobj.type = SND_SOC_DOBJ_DAI_LINK; + list_add(&link->dobj.list, &tplg->comp->dobj_list); + + return 0; +diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c +index 3ca6795a89ba..9e8233c10d86 100644 +--- a/sound/soc/sof/intel/hda-codec.c ++++ b/sound/soc/sof/intel/hda-codec.c +@@ -24,19 +24,18 @@ + #define IDISP_VID_INTEL 0x80860000 + + /* load the legacy HDA codec driver */ +-#ifdef MODULE +-static void hda_codec_load_module(struct hda_codec *codec) ++static int hda_codec_load_module(struct hda_codec *codec) + { ++#ifdef MODULE + char alias[MODULE_NAME_LEN]; + const char *module = alias; + + snd_hdac_codec_modalias(&codec->core, alias, sizeof(alias)); + dev_dbg(&codec->core.dev, "loading codec module: %s\n", module); + request_module(module); +-} +-#else +-static void hda_codec_load_module(struct hda_codec *codec) {} + #endif ++ return device_attach(hda_codec_dev(codec)); ++} + + /* enable controller wake up event for all codecs with jack connectors */ + void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev) +@@ -116,10 +115,16 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address) + /* use legacy bus only for HDA codecs, idisp uses ext bus */ + if ((resp & 0xFFFF0000) != IDISP_VID_INTEL) { + hdev->type = HDA_DEV_LEGACY; +- hda_codec_load_module(&hda_priv->codec); ++ ret = hda_codec_load_module(&hda_priv->codec); ++ /* ++ * handle ret==0 (no driver bound) as an error, but pass ++ * other return codes without modification ++ */ ++ if (ret == 0) ++ ret = -ENOENT; + } + +- return 0; ++ return ret; + #else + hdev = devm_kzalloc(sdev->dev, sizeof(*hdev), GFP_KERNEL); + if (!hdev) +diff --git a/sound/soc/sti/uniperif_player.c b/sound/soc/sti/uniperif_player.c +index 48ea915b24ba..2ed92c990b97 100644 +--- a/sound/soc/sti/uniperif_player.c ++++ b/sound/soc/sti/uniperif_player.c +@@ -226,7 +226,6 @@ static void uni_player_set_channel_status(struct uniperif *player, + * sampling frequency. If no sample rate is already specified, then + * set one. + */ +- mutex_lock(&player->ctrl_lock); + if (runtime) { + switch (runtime->rate) { + case 22050: +@@ -303,7 +302,6 @@ static void uni_player_set_channel_status(struct uniperif *player, + player->stream_settings.iec958.status[3 + (n * 4)] << 24; + SET_UNIPERIF_CHANNEL_STA_REGN(player, n, status); + } +- mutex_unlock(&player->ctrl_lock); + + /* Update the channel status */ + if (player->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0) +@@ -365,8 +363,10 @@ static int uni_player_prepare_iec958(struct uniperif *player, + + SET_UNIPERIF_CTRL_ZERO_STUFF_HW(player); + ++ mutex_lock(&player->ctrl_lock); + /* Update the channel status */ + uni_player_set_channel_status(player, runtime); ++ mutex_unlock(&player->ctrl_lock); + + /* Clear the user validity user bits */ + SET_UNIPERIF_USER_VALIDITY_VALIDITY_LR(player, 0); +@@ -598,7 +598,6 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol, + iec958->status[1] = ucontrol->value.iec958.status[1]; + iec958->status[2] = ucontrol->value.iec958.status[2]; + iec958->status[3] = ucontrol->value.iec958.status[3]; +- mutex_unlock(&player->ctrl_lock); + + spin_lock_irqsave(&player->irq_lock, flags); + if (player->substream && player->substream->runtime) +@@ -608,6 +607,8 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol, + uni_player_set_channel_status(player, NULL); + + spin_unlock_irqrestore(&player->irq_lock, flags); ++ mutex_unlock(&player->ctrl_lock); ++ + return 0; + } + +diff --git a/tools/include/linux/string.h b/tools/include/linux/string.h +index 980cb9266718..5e9e781905ed 100644 +--- a/tools/include/linux/string.h ++++ b/tools/include/linux/string.h +@@ -17,7 +17,15 @@ int strtobool(const char *s, bool *res); + * However uClibc headers also define __GLIBC__ hence the hack below + */ + #if defined(__GLIBC__) && !defined(__UCLIBC__) ++// pragma diagnostic was introduced in gcc 4.6 ++#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wredundant-decls" ++#endif + extern size_t strlcpy(char *dest, const char *src, size_t size); ++#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) ++#pragma GCC diagnostic pop ++#endif + #endif + + char *str_error_r(int errnum, char *buf, size_t buflen); +diff --git a/tools/lib/string.c b/tools/lib/string.c +index f2ae1b87c719..f645343815de 100644 +--- a/tools/lib/string.c ++++ b/tools/lib/string.c +@@ -96,6 +96,10 @@ int strtobool(const char *s, bool *res) + * If libc has strlcpy() then that version will override this + * implementation: + */ ++#ifdef __clang__ ++#pragma clang diagnostic push ++#pragma clang diagnostic ignored "-Wignored-attributes" ++#endif + size_t __weak strlcpy(char *dest, const char *src, size_t size) + { + size_t ret = strlen(src); +@@ -107,6 +111,9 @@ size_t __weak strlcpy(char *dest, const char *src, size_t size) + } + return ret; + } ++#ifdef __clang__ ++#pragma clang diagnostic pop ++#endif + + /** + * skip_spaces - Removes leading whitespace from @str. +diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c +index f3cbf86e51ac..20eed719542e 100644 +--- a/tools/lib/traceevent/parse-filter.c ++++ b/tools/lib/traceevent/parse-filter.c +@@ -1228,8 +1228,10 @@ filter_event(struct tep_event_filter *filter, struct tep_event *event, + } + + filter_type = add_filter_type(filter, event->id); +- if (filter_type == NULL) ++ if (filter_type == NULL) { ++ free_arg(arg); + return TEP_ERRNO__MEM_ALLOC_FAILED; ++ } + + if (filter_type->filter) + free_arg(filter_type->filter); +diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c +index e69f44941aad..f2e9d2b1b913 100644 +--- a/tools/perf/builtin-c2c.c ++++ b/tools/perf/builtin-c2c.c +@@ -595,8 +595,8 @@ tot_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_unused, + { + struct c2c_hist_entry *c2c_left; + struct c2c_hist_entry *c2c_right; +- unsigned int tot_hitm_left; +- unsigned int tot_hitm_right; ++ uint64_t tot_hitm_left; ++ uint64_t tot_hitm_right; + + c2c_left = container_of(left, struct c2c_hist_entry, he); + c2c_right = container_of(right, struct c2c_hist_entry, he); +@@ -629,7 +629,8 @@ __f ## _cmp(struct perf_hpp_fmt *fmt __maybe_unused, \ + \ + c2c_left = container_of(left, struct c2c_hist_entry, he); \ + c2c_right = container_of(right, struct c2c_hist_entry, he); \ +- return c2c_left->stats.__f - c2c_right->stats.__f; \ ++ return (uint64_t) c2c_left->stats.__f - \ ++ (uint64_t) c2c_right->stats.__f; \ + } + + #define STAT_FN(__f) \ +@@ -682,7 +683,8 @@ ld_llcmiss_cmp(struct perf_hpp_fmt *fmt __maybe_unused, + c2c_left = container_of(left, struct c2c_hist_entry, he); + c2c_right = container_of(right, struct c2c_hist_entry, he); + +- return llc_miss(&c2c_left->stats) - llc_miss(&c2c_right->stats); ++ return (uint64_t) llc_miss(&c2c_left->stats) - ++ (uint64_t) llc_miss(&c2c_right->stats); + } + + static uint64_t total_records(struct c2c_stats *stats) +diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c +index ea3f0745d7ad..6407dff405d9 100644 +--- a/tools/perf/builtin-report.c ++++ b/tools/perf/builtin-report.c +@@ -399,10 +399,10 @@ static int report__setup_sample_type(struct report *rep) + PERF_SAMPLE_BRANCH_ANY)) + rep->nonany_branch_mode = true; + +-#ifndef HAVE_LIBUNWIND_SUPPORT ++#if !defined(HAVE_LIBUNWIND_SUPPORT) && !defined(HAVE_DWARF_SUPPORT) + if (dwarf_callchain_users) { +- ui__warning("Please install libunwind development packages " +- "during the perf build.\n"); ++ ui__warning("Please install libunwind or libdw " ++ "development packages during the perf build.\n"); + } + #endif +