From cc111daef3f0ee9f7fdb4182752cb6c969b5b9b2 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Sun, 4 Apr 2021 15:35:39 +0200 Subject: [PATCH 01/18] Add vnstat network statistic measurement to the standard CLI image --- config/cli/bullseye/main/config_cli_standard/packages | 2 +- config/cli/buster/main/config_cli_standard/packages | 2 +- config/cli/focal/main/config_cli_standard/packages | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/cli/bullseye/main/config_cli_standard/packages b/config/cli/bullseye/main/config_cli_standard/packages index ce2bdb670..fff4b54d1 100644 --- a/config/cli/bullseye/main/config_cli_standard/packages +++ b/config/cli/bullseye/main/config_cli_standard/packages @@ -2,4 +2,4 @@ bridge-utils build-essential fbset iw wpasupplicant sudo linux-base crda wireles unattended-upgrades console-setup unicode-data initramfs-tools ca-certificates expect iptables automake html2text bison flex libwrap0-dev libssl-dev libnl-3-dev libnl-genl-3-dev keyboard-configuration gnupg2 networkd-dispatcher man-db hping3 command-not-found apt-file -dkms python3-distutils python3-lib2to3 +dkms python3-distutils python3-lib2to3 vnstat diff --git a/config/cli/buster/main/config_cli_standard/packages b/config/cli/buster/main/config_cli_standard/packages index 78a4ce807..e675e5d7c 100644 --- a/config/cli/buster/main/config_cli_standard/packages +++ b/config/cli/buster/main/config_cli_standard/packages @@ -2,4 +2,4 @@ bridge-utils build-essential fbset iw wpasupplicant sudo linux-base crda wireles unattended-upgrades console-setup unicode-data initramfs-tools ca-certificates expect iptables automake html2text bison flex libwrap0-dev libssl-dev libnl-3-dev libnl-genl-3-dev keyboard-configuration gnupg2 networkd-dispatcher man-db hping3 selinux-policy-default -rng-tools command-not-found apt-file dkms python3-distutils python3-lib2to3 +rng-tools command-not-found apt-file dkms python3-distutils python3-lib2to3 vnstat diff --git a/config/cli/focal/main/config_cli_standard/packages b/config/cli/focal/main/config_cli_standard/packages index fd59fbe64..be48fe468 100644 --- a/config/cli/focal/main/config_cli_standard/packages +++ b/config/cli/focal/main/config_cli_standard/packages @@ -2,4 +2,4 @@ bridge-utils build-essential fbset iw wpasupplicant sudo linux-base crda wireles unattended-upgrades console-setup unicode-data initramfs-tools ca-certificates expect iptables automake html2text bison flex libwrap0-dev libssl-dev libnl-3-dev libnl-genl-3-dev keyboard-configuration gnupg2 networkd-dispatcher man-db hping3 selinux-policy-default -dkms python3-distutils python3-lib2to3 +dkms python3-distutils python3-lib2to3 vnstat From 61b1c311dcb0b967245662bab3a5967bebea3b6f Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Wed, 14 Apr 2021 10:38:10 +0200 Subject: [PATCH 02/18] Add upstream patches --- .../odroidxu4-5.4/patch-5.4.111-112.patch | 4331 +++++++++ .../archive/sunxi-5.10/patch-5.10.29-30.patch | 7702 +++++++++++++++++ 2 files changed, 12033 insertions(+) create mode 100644 patch/kernel/archive/odroidxu4-5.4/patch-5.4.111-112.patch create mode 100644 patch/kernel/archive/sunxi-5.10/patch-5.10.29-30.patch diff --git a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.111-112.patch b/patch/kernel/archive/odroidxu4-5.4/patch-5.4.111-112.patch new file mode 100644 index 000000000..e4c282f3e --- /dev/null +++ b/patch/kernel/archive/odroidxu4-5.4/patch-5.4.111-112.patch @@ -0,0 +1,4331 @@ +diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml +index 4f78e9a6da609..fcafce635ff01 100644 +--- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml ++++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml +@@ -51,7 +51,7 @@ properties: + description: + Reference to an nvmem node for the MAC address + +- nvmem-cells-names: ++ nvmem-cell-names: + const: mac-address + + phy-connection-type: +diff --git a/Makefile b/Makefile +index 25680098f51b2..ba8ee5e806627 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 111 ++SUBLEVEL = 112 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts +index 768b6c5d2129a..fde4c302f08ec 100644 +--- a/arch/arm/boot/dts/armada-385-turris-omnia.dts ++++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts +@@ -236,6 +236,7 @@ + status = "okay"; + compatible = "ethernet-phy-id0141.0DD1", "ethernet-phy-ieee802.3-c22"; + reg = <1>; ++ marvell,reg-init = <3 18 0 0x4985>; + + /* irq is connected to &pcawan pin 7 */ + }; +diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi +index bc43c75f17450..6678b97b10076 100644 +--- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi ++++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi +@@ -432,6 +432,7 @@ + pinctrl-0 = <&pinctrl_usdhc2>; + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; ++ vmmc-supply = <&vdd_sd1_reg>; + status = "disabled"; + }; + +@@ -441,5 +442,6 @@ + &pinctrl_usdhc3_cdwp>; + cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>; ++ vmmc-supply = <&vdd_sd0_reg>; + status = "disabled"; + }; +diff --git a/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h b/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h +index cffa8991880d1..93b44efdbc527 100644 +--- a/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h ++++ b/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h +@@ -124,7 +124,7 @@ + #define MX8MM_IOMUXC_SD1_CMD_USDHC1_CMD 0x0A4 0x30C 0x000 0x0 0x0 + #define MX8MM_IOMUXC_SD1_CMD_GPIO2_IO1 0x0A4 0x30C 0x000 0x5 0x0 + #define MX8MM_IOMUXC_SD1_DATA0_USDHC1_DATA0 0x0A8 0x310 0x000 0x0 0x0 +-#define MX8MM_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x31 0x000 0x5 0x0 ++#define MX8MM_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x310 0x000 0x5 0x0 + #define MX8MM_IOMUXC_SD1_DATA1_USDHC1_DATA1 0x0AC 0x314 0x000 0x0 0x0 + #define MX8MM_IOMUXC_SD1_DATA1_GPIO2_IO3 0x0AC 0x314 0x000 0x5 0x0 + #define MX8MM_IOMUXC_SD1_DATA2_USDHC1_DATA2 0x0B0 0x318 0x000 0x0 0x0 +diff --git a/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h b/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h +index b94b02080a344..68e8fa1729741 100644 +--- a/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h ++++ b/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h +@@ -130,7 +130,7 @@ + #define MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0x0A4 0x30C 0x000 0x0 0x0 + #define MX8MQ_IOMUXC_SD1_CMD_GPIO2_IO1 0x0A4 0x30C 0x000 0x5 0x0 + #define MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0x0A8 0x310 0x000 0x0 0x0 +-#define MX8MQ_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x31 0x000 0x5 0x0 ++#define MX8MQ_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x310 0x000 0x5 0x0 + #define MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0x0AC 0x314 0x000 0x0 0x0 + #define MX8MQ_IOMUXC_SD1_DATA1_GPIO2_IO3 0x0AC 0x314 0x000 0x5 0x0 + #define MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0x0B0 0x318 0x000 0x0 0x0 +diff --git a/arch/ia64/include/asm/ptrace.h b/arch/ia64/include/asm/ptrace.h +index 7ff574d56429c..f31e07fc936d9 100644 +--- a/arch/ia64/include/asm/ptrace.h ++++ b/arch/ia64/include/asm/ptrace.h +@@ -54,8 +54,7 @@ + + static inline unsigned long user_stack_pointer(struct pt_regs *regs) + { +- /* FIXME: should this be bspstore + nr_dirty regs? */ +- return regs->ar_bspstore; ++ return regs->r12; + } + + static inline int is_syscall_success(struct pt_regs *regs) +@@ -79,11 +78,6 @@ static inline long regs_return_value(struct pt_regs *regs) + unsigned long __ip = instruction_pointer(regs); \ + (__ip & ~3UL) + ((__ip & 3UL) << 2); \ + }) +-/* +- * Why not default? Because user_stack_pointer() on ia64 gives register +- * stack backing store instead... +- */ +-#define current_user_stack_pointer() (current_pt_regs()->r12) + + /* given a pointer to a task_struct, return the user's pt_regs */ + # define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1) +diff --git a/arch/nds32/mm/cacheflush.c b/arch/nds32/mm/cacheflush.c +index 254703653b6f5..f34dc9bc6758e 100644 +--- a/arch/nds32/mm/cacheflush.c ++++ b/arch/nds32/mm/cacheflush.c +@@ -239,7 +239,7 @@ void flush_dcache_page(struct page *page) + { + struct address_space *mapping; + +- mapping = page_mapping(page); ++ mapping = page_mapping_file(page); + if (mapping && !mapping_mapped(mapping)) + set_bit(PG_dcache_dirty, &page->flags); + else { +diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h +index 0689585758717..a736dc59bbef8 100644 +--- a/arch/parisc/include/asm/cmpxchg.h ++++ b/arch/parisc/include/asm/cmpxchg.h +@@ -72,7 +72,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) + #endif + case 4: return __cmpxchg_u32((unsigned int *)ptr, + (unsigned int)old, (unsigned int)new_); +- case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_); ++ case 1: return __cmpxchg_u8((u8 *)ptr, old & 0xff, new_ & 0xff); + } + __cmpxchg_called_with_bad_pointer(); + return old; +diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c +index af013b4244d34..2da0273597989 100644 +--- a/arch/s390/kernel/cpcmd.c ++++ b/arch/s390/kernel/cpcmd.c +@@ -37,10 +37,12 @@ static int diag8_noresponse(int cmdlen) + + static int diag8_response(int cmdlen, char *response, int *rlen) + { ++ unsigned long _cmdlen = cmdlen | 0x40000000L; ++ unsigned long _rlen = *rlen; + register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf; + register unsigned long reg3 asm ("3") = (addr_t) response; +- register unsigned long reg4 asm ("4") = cmdlen | 0x40000000L; +- register unsigned long reg5 asm ("5") = *rlen; ++ register unsigned long reg4 asm ("4") = _cmdlen; ++ register unsigned long reg5 asm ("5") = _rlen; + + asm volatile( + " diag %2,%0,0x8\n" +diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig +index 812d6aa6e0136..f2d015a8ff57f 100644 +--- a/drivers/char/agp/Kconfig ++++ b/drivers/char/agp/Kconfig +@@ -125,7 +125,7 @@ config AGP_HP_ZX1 + + config AGP_PARISC + tristate "HP Quicksilver AGP support" +- depends on AGP && PARISC && 64BIT ++ depends on AGP && PARISC && 64BIT && IOMMU_SBA + help + This option gives you AGP GART support for the HP Quicksilver + AGP bus adapter on HP PA-RISC machines (Ok, just on the C8000 +diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c +index 36e9f38a38824..6ff87cd867121 100644 +--- a/drivers/clk/clk.c ++++ b/drivers/clk/clk.c +@@ -4151,20 +4151,19 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb) + /* search the list of notifiers for this clk */ + list_for_each_entry(cn, &clk_notifier_list, node) + if (cn->clk == clk) +- break; ++ goto found; + + /* if clk wasn't in the notifier list, allocate new clk_notifier */ +- if (cn->clk != clk) { +- cn = kzalloc(sizeof(*cn), GFP_KERNEL); +- if (!cn) +- goto out; ++ cn = kzalloc(sizeof(*cn), GFP_KERNEL); ++ if (!cn) ++ goto out; + +- cn->clk = clk; +- srcu_init_notifier_head(&cn->notifier_head); ++ cn->clk = clk; ++ srcu_init_notifier_head(&cn->notifier_head); + +- list_add(&cn->node, &clk_notifier_list); +- } ++ list_add(&cn->node, &clk_notifier_list); + ++found: + ret = srcu_notifier_chain_register(&cn->notifier_head, nb); + + clk->core->notifier_count++; +@@ -4189,32 +4188,28 @@ EXPORT_SYMBOL_GPL(clk_notifier_register); + */ + int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb) + { +- struct clk_notifier *cn = NULL; +- int ret = -EINVAL; ++ struct clk_notifier *cn; ++ int ret = -ENOENT; + + if (!clk || !nb) + return -EINVAL; + + clk_prepare_lock(); + +- list_for_each_entry(cn, &clk_notifier_list, node) +- if (cn->clk == clk) +- break; +- +- if (cn->clk == clk) { +- ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb); ++ list_for_each_entry(cn, &clk_notifier_list, node) { ++ if (cn->clk == clk) { ++ ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb); + +- clk->core->notifier_count--; ++ clk->core->notifier_count--; + +- /* XXX the notifier code should handle this better */ +- if (!cn->notifier_head.head) { +- srcu_cleanup_notifier_head(&cn->notifier_head); +- list_del(&cn->node); +- kfree(cn); ++ /* XXX the notifier code should handle this better */ ++ if (!cn->notifier_head.head) { ++ srcu_cleanup_notifier_head(&cn->notifier_head); ++ list_del(&cn->node); ++ kfree(cn); ++ } ++ break; + } +- +- } else { +- ret = -ENOENT; + } + + clk_prepare_unlock(); +diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c +index 43ecd507bf836..cf94a12459ea4 100644 +--- a/drivers/clk/socfpga/clk-gate.c ++++ b/drivers/clk/socfpga/clk-gate.c +@@ -99,7 +99,7 @@ static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk, + val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift; + val &= GENMASK(socfpgaclk->width - 1, 0); + /* Check for GPIO_DB_CLK by its offset */ +- if ((int) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET) ++ if ((uintptr_t) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET) + div = val + 1; + else + div = (1 << val); +diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c +index 75e08a98d09be..889ea7a6ed630 100644 +--- a/drivers/counter/stm32-timer-cnt.c ++++ b/drivers/counter/stm32-timer-cnt.c +@@ -24,7 +24,6 @@ struct stm32_timer_cnt { + struct counter_device counter; + struct regmap *regmap; + struct clk *clk; +- u32 ceiling; + u32 max_arr; + }; + +@@ -67,14 +66,15 @@ static int stm32_count_write(struct counter_device *counter, + struct counter_count_write_value *val) + { + struct stm32_timer_cnt *const priv = counter->priv; +- u32 cnt; ++ u32 cnt, ceiling; + int err; + + err = counter_count_write_value_get(&cnt, COUNTER_COUNT_POSITION, val); + if (err) + return err; + +- if (cnt > priv->ceiling) ++ regmap_read(priv->regmap, TIM_ARR, &ceiling); ++ if (cnt > ceiling) + return -EINVAL; + + return regmap_write(priv->regmap, TIM_CNT, cnt); +@@ -136,10 +136,6 @@ static int stm32_count_function_set(struct counter_device *counter, + + regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN, 0); + +- /* TIMx_ARR register shouldn't be buffered (ARPE=0) */ +- regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0); +- regmap_write(priv->regmap, TIM_ARR, priv->ceiling); +- + regmap_update_bits(priv->regmap, TIM_SMCR, TIM_SMCR_SMS, sms); + + /* Make sure that registers are updated */ +@@ -197,7 +193,6 @@ static ssize_t stm32_count_ceiling_write(struct counter_device *counter, + regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0); + regmap_write(priv->regmap, TIM_ARR, ceiling); + +- priv->ceiling = ceiling; + return len; + } + +@@ -369,7 +364,6 @@ static int stm32_timer_cnt_probe(struct platform_device *pdev) + + priv->regmap = ddata->regmap; + priv->clk = ddata->clk; +- priv->ceiling = ddata->max_arr; + priv->max_arr = ddata->max_arr; + + priv->counter.name = dev_name(dev); +diff --git a/drivers/gpu/drm/i915/display/intel_acpi.c b/drivers/gpu/drm/i915/display/intel_acpi.c +index 3456d33feb46a..ce8182bd0b558 100644 +--- a/drivers/gpu/drm/i915/display/intel_acpi.c ++++ b/drivers/gpu/drm/i915/display/intel_acpi.c +@@ -83,13 +83,31 @@ static void intel_dsm_platform_mux_info(acpi_handle dhandle) + return; + } + ++ if (!pkg->package.count) { ++ DRM_DEBUG_DRIVER("no connection in _DSM\n"); ++ return; ++ } ++ + connector_count = &pkg->package.elements[0]; + DRM_DEBUG_DRIVER("MUX info connectors: %lld\n", + (unsigned long long)connector_count->integer.value); + for (i = 1; i < pkg->package.count; i++) { + union acpi_object *obj = &pkg->package.elements[i]; +- union acpi_object *connector_id = &obj->package.elements[0]; +- union acpi_object *info = &obj->package.elements[1]; ++ union acpi_object *connector_id; ++ union acpi_object *info; ++ ++ if (obj->type != ACPI_TYPE_PACKAGE || obj->package.count < 2) { ++ DRM_DEBUG_DRIVER("Invalid object for MUX #%d\n", i); ++ continue; ++ } ++ ++ connector_id = &obj->package.elements[0]; ++ info = &obj->package.elements[1]; ++ if (info->type != ACPI_TYPE_BUFFER || info->buffer.length < 4) { ++ DRM_DEBUG_DRIVER("Invalid info for MUX obj #%d\n", i); ++ continue; ++ } ++ + DRM_DEBUG_DRIVER("Connector id: 0x%016llx\n", + (unsigned long long)connector_id->integer.value); + DRM_DEBUG_DRIVER(" port id: %s\n", +diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c +index 896d6f95a9604..7443df77cadb5 100644 +--- a/drivers/gpu/drm/msm/msm_drv.c ++++ b/drivers/gpu/drm/msm/msm_drv.c +@@ -567,6 +567,7 @@ err_free_priv: + kfree(priv); + err_put_drm_dev: + drm_dev_put(ddev); ++ platform_set_drvdata(pdev, NULL); + return ret; + } + +diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c +index 2dfe2ffcf8825..840f59650c7c4 100644 +--- a/drivers/i2c/i2c-core-base.c ++++ b/drivers/i2c/i2c-core-base.c +@@ -254,13 +254,14 @@ EXPORT_SYMBOL_GPL(i2c_recover_bus); + static void i2c_init_recovery(struct i2c_adapter *adap) + { + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; +- char *err_str; ++ char *err_str, *err_level = KERN_ERR; + + if (!bri) + return; + + if (!bri->recover_bus) { +- err_str = "no recover_bus() found"; ++ err_str = "no suitable method provided"; ++ err_level = KERN_DEBUG; + goto err; + } + +@@ -290,7 +291,7 @@ static void i2c_init_recovery(struct i2c_adapter *adap) + + return; + err: +- dev_err(&adap->dev, "Not using recovery: %s\n", err_str); ++ dev_printk(err_level, &adap->dev, "Not using recovery: %s\n", err_str); + adap->bus_recovery_info = NULL; + } + +diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c +index 8beed4197e73e..c9e63c692b6e8 100644 +--- a/drivers/infiniband/core/addr.c ++++ b/drivers/infiniband/core/addr.c +@@ -76,7 +76,9 @@ static struct workqueue_struct *addr_wq; + + static const struct nla_policy ib_nl_addr_policy[LS_NLA_TYPE_MAX] = { + [LS_NLA_TYPE_DGID] = {.type = NLA_BINARY, +- .len = sizeof(struct rdma_nla_ls_gid)}, ++ .len = sizeof(struct rdma_nla_ls_gid), ++ .validation_type = NLA_VALIDATE_MIN, ++ .min = sizeof(struct rdma_nla_ls_gid)}, + }; + + static inline bool ib_nl_is_good_ip_resp(const struct nlmsghdr *nlh) +diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c +index 3c78f8c32d12b..535ee41ee4214 100644 +--- a/drivers/infiniband/hw/cxgb4/cm.c ++++ b/drivers/infiniband/hw/cxgb4/cm.c +@@ -3616,7 +3616,8 @@ int c4iw_destroy_listen(struct iw_cm_id *cm_id) + c4iw_init_wr_wait(ep->com.wr_waitp); + err = cxgb4_remove_server( + ep->com.dev->rdev.lldi.ports[0], ep->stid, +- ep->com.dev->rdev.lldi.rxq_ids[0], true); ++ ep->com.dev->rdev.lldi.rxq_ids[0], ++ ep->com.local_addr.ss_family == AF_INET6); + if (err) + goto done; + err = c4iw_wait_for_reply(&ep->com.dev->rdev, ep->com.wr_waitp, +diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c +index f22089101cdda..4b18f37beb4c5 100644 +--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c ++++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c +@@ -856,7 +856,7 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, + if (dev->adapter->dev_set_bus) { + err = dev->adapter->dev_set_bus(dev, 0); + if (err) +- goto lbl_unregister_candev; ++ goto adap_dev_free; + } + + /* get device number early */ +@@ -868,6 +868,10 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, + + return 0; + ++adap_dev_free: ++ if (dev->adapter->dev_free) ++ dev->adapter->dev_free(dev); ++ + lbl_unregister_candev: + unregister_candev(netdev); + +diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c +index ee1e67df1e7b4..dc75e798dbff8 100644 +--- a/drivers/net/dsa/lantiq_gswip.c ++++ b/drivers/net/dsa/lantiq_gswip.c +@@ -93,8 +93,12 @@ + + /* GSWIP MII Registers */ + #define GSWIP_MII_CFGp(p) (0x2 * (p)) ++#define GSWIP_MII_CFG_RESET BIT(15) + #define GSWIP_MII_CFG_EN BIT(14) ++#define GSWIP_MII_CFG_ISOLATE BIT(13) + #define GSWIP_MII_CFG_LDCLKDIS BIT(12) ++#define GSWIP_MII_CFG_RGMII_IBS BIT(8) ++#define GSWIP_MII_CFG_RMII_CLK BIT(7) + #define GSWIP_MII_CFG_MODE_MIIP 0x0 + #define GSWIP_MII_CFG_MODE_MIIM 0x1 + #define GSWIP_MII_CFG_MODE_RMIIP 0x2 +@@ -190,6 +194,23 @@ + #define GSWIP_PCE_DEFPVID(p) (0x486 + ((p) * 0xA)) + + #define GSWIP_MAC_FLEN 0x8C5 ++#define GSWIP_MAC_CTRL_0p(p) (0x903 + ((p) * 0xC)) ++#define GSWIP_MAC_CTRL_0_PADEN BIT(8) ++#define GSWIP_MAC_CTRL_0_FCS_EN BIT(7) ++#define GSWIP_MAC_CTRL_0_FCON_MASK 0x0070 ++#define GSWIP_MAC_CTRL_0_FCON_AUTO 0x0000 ++#define GSWIP_MAC_CTRL_0_FCON_RX 0x0010 ++#define GSWIP_MAC_CTRL_0_FCON_TX 0x0020 ++#define GSWIP_MAC_CTRL_0_FCON_RXTX 0x0030 ++#define GSWIP_MAC_CTRL_0_FCON_NONE 0x0040 ++#define GSWIP_MAC_CTRL_0_FDUP_MASK 0x000C ++#define GSWIP_MAC_CTRL_0_FDUP_AUTO 0x0000 ++#define GSWIP_MAC_CTRL_0_FDUP_EN 0x0004 ++#define GSWIP_MAC_CTRL_0_FDUP_DIS 0x000C ++#define GSWIP_MAC_CTRL_0_GMII_MASK 0x0003 ++#define GSWIP_MAC_CTRL_0_GMII_AUTO 0x0000 ++#define GSWIP_MAC_CTRL_0_GMII_MII 0x0001 ++#define GSWIP_MAC_CTRL_0_GMII_RGMII 0x0002 + #define GSWIP_MAC_CTRL_2p(p) (0x905 + ((p) * 0xC)) + #define GSWIP_MAC_CTRL_2_MLEN BIT(3) /* Maximum Untagged Frame Lnegth */ + +@@ -653,16 +674,13 @@ static int gswip_port_enable(struct dsa_switch *ds, int port, + GSWIP_SDMA_PCTRLp(port)); + + if (!dsa_is_cpu_port(ds, port)) { +- u32 macconf = GSWIP_MDIO_PHY_LINK_AUTO | +- GSWIP_MDIO_PHY_SPEED_AUTO | +- GSWIP_MDIO_PHY_FDUP_AUTO | +- GSWIP_MDIO_PHY_FCONTX_AUTO | +- GSWIP_MDIO_PHY_FCONRX_AUTO | +- (phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK); +- +- gswip_mdio_w(priv, macconf, GSWIP_MDIO_PHYp(port)); +- /* Activate MDIO auto polling */ +- gswip_mdio_mask(priv, 0, BIT(port), GSWIP_MDIO_MDC_CFG0); ++ u32 mdio_phy = 0; ++ ++ if (phydev) ++ mdio_phy = phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK; ++ ++ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_ADDR_MASK, mdio_phy, ++ GSWIP_MDIO_PHYp(port)); + } + + return 0; +@@ -675,14 +693,6 @@ static void gswip_port_disable(struct dsa_switch *ds, int port) + if (!dsa_is_user_port(ds, port)) + return; + +- if (!dsa_is_cpu_port(ds, port)) { +- gswip_mdio_mask(priv, GSWIP_MDIO_PHY_LINK_DOWN, +- GSWIP_MDIO_PHY_LINK_MASK, +- GSWIP_MDIO_PHYp(port)); +- /* Deactivate MDIO auto polling */ +- gswip_mdio_mask(priv, BIT(port), 0, GSWIP_MDIO_MDC_CFG0); +- } +- + gswip_switch_mask(priv, GSWIP_FDMA_PCTRL_EN, 0, + GSWIP_FDMA_PCTRLp(port)); + gswip_switch_mask(priv, GSWIP_SDMA_PCTRL_EN, 0, +@@ -790,14 +800,32 @@ static int gswip_setup(struct dsa_switch *ds) + gswip_switch_w(priv, BIT(cpu_port), GSWIP_PCE_PMAP2); + gswip_switch_w(priv, BIT(cpu_port), GSWIP_PCE_PMAP3); + +- /* disable PHY auto polling */ ++ /* Deactivate MDIO PHY auto polling. Some PHYs as the AR8030 have an ++ * interoperability problem with this auto polling mechanism because ++ * their status registers think that the link is in a different state ++ * than it actually is. For the AR8030 it has the BMSR_ESTATEN bit set ++ * as well as ESTATUS_1000_TFULL and ESTATUS_1000_XFULL. This makes the ++ * auto polling state machine consider the link being negotiated with ++ * 1Gbit/s. Since the PHY itself is a Fast Ethernet RMII PHY this leads ++ * to the switch port being completely dead (RX and TX are both not ++ * working). ++ * Also with various other PHY / port combinations (PHY11G GPHY, PHY22F ++ * GPHY, external RGMII PEF7071/7072) any traffic would stop. Sometimes ++ * it would work fine for a few minutes to hours and then stop, on ++ * other device it would no traffic could be sent or received at all. ++ * Testing shows that when PHY auto polling is disabled these problems ++ * go away. ++ */ + gswip_mdio_w(priv, 0x0, GSWIP_MDIO_MDC_CFG0); ++ + /* Configure the MDIO Clock 2.5 MHz */ + gswip_mdio_mask(priv, 0xff, 0x09, GSWIP_MDIO_MDC_CFG1); + +- /* Disable the xMII link */ ++ /* Disable the xMII interface and clear it's isolation bit */ + for (i = 0; i < priv->hw_info->max_ports; i++) +- gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, i); ++ gswip_mii_mask_cfg(priv, ++ GSWIP_MII_CFG_EN | GSWIP_MII_CFG_ISOLATE, ++ 0, i); + + /* enable special tag insertion on cpu port */ + gswip_switch_mask(priv, 0, GSWIP_FDMA_PCTRL_STEN, +@@ -1447,6 +1475,112 @@ unsupported: + return; + } + ++static void gswip_port_set_link(struct gswip_priv *priv, int port, bool link) ++{ ++ u32 mdio_phy; ++ ++ if (link) ++ mdio_phy = GSWIP_MDIO_PHY_LINK_UP; ++ else ++ mdio_phy = GSWIP_MDIO_PHY_LINK_DOWN; ++ ++ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_LINK_MASK, mdio_phy, ++ GSWIP_MDIO_PHYp(port)); ++} ++ ++static void gswip_port_set_speed(struct gswip_priv *priv, int port, int speed, ++ phy_interface_t interface) ++{ ++ u32 mdio_phy = 0, mii_cfg = 0, mac_ctrl_0 = 0; ++ ++ switch (speed) { ++ case SPEED_10: ++ mdio_phy = GSWIP_MDIO_PHY_SPEED_M10; ++ ++ if (interface == PHY_INTERFACE_MODE_RMII) ++ mii_cfg = GSWIP_MII_CFG_RATE_M50; ++ else ++ mii_cfg = GSWIP_MII_CFG_RATE_M2P5; ++ ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_GMII_MII; ++ break; ++ ++ case SPEED_100: ++ mdio_phy = GSWIP_MDIO_PHY_SPEED_M100; ++ ++ if (interface == PHY_INTERFACE_MODE_RMII) ++ mii_cfg = GSWIP_MII_CFG_RATE_M50; ++ else ++ mii_cfg = GSWIP_MII_CFG_RATE_M25; ++ ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_GMII_MII; ++ break; ++ ++ case SPEED_1000: ++ mdio_phy = GSWIP_MDIO_PHY_SPEED_G1; ++ ++ mii_cfg = GSWIP_MII_CFG_RATE_M125; ++ ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_GMII_RGMII; ++ break; ++ } ++ ++ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_SPEED_MASK, mdio_phy, ++ GSWIP_MDIO_PHYp(port)); ++ gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_RATE_MASK, mii_cfg, port); ++ gswip_switch_mask(priv, GSWIP_MAC_CTRL_0_GMII_MASK, mac_ctrl_0, ++ GSWIP_MAC_CTRL_0p(port)); ++} ++ ++static void gswip_port_set_duplex(struct gswip_priv *priv, int port, int duplex) ++{ ++ u32 mac_ctrl_0, mdio_phy; ++ ++ if (duplex == DUPLEX_FULL) { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FDUP_EN; ++ mdio_phy = GSWIP_MDIO_PHY_FDUP_EN; ++ } else { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FDUP_DIS; ++ mdio_phy = GSWIP_MDIO_PHY_FDUP_DIS; ++ } ++ ++ gswip_switch_mask(priv, GSWIP_MAC_CTRL_0_FDUP_MASK, mac_ctrl_0, ++ GSWIP_MAC_CTRL_0p(port)); ++ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_FDUP_MASK, mdio_phy, ++ GSWIP_MDIO_PHYp(port)); ++} ++ ++static void gswip_port_set_pause(struct gswip_priv *priv, int port, ++ bool tx_pause, bool rx_pause) ++{ ++ u32 mac_ctrl_0, mdio_phy; ++ ++ if (tx_pause && rx_pause) { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_RXTX; ++ mdio_phy = GSWIP_MDIO_PHY_FCONTX_EN | ++ GSWIP_MDIO_PHY_FCONRX_EN; ++ } else if (tx_pause) { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_TX; ++ mdio_phy = GSWIP_MDIO_PHY_FCONTX_EN | ++ GSWIP_MDIO_PHY_FCONRX_DIS; ++ } else if (rx_pause) { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_RX; ++ mdio_phy = GSWIP_MDIO_PHY_FCONTX_DIS | ++ GSWIP_MDIO_PHY_FCONRX_EN; ++ } else { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_NONE; ++ mdio_phy = GSWIP_MDIO_PHY_FCONTX_DIS | ++ GSWIP_MDIO_PHY_FCONRX_DIS; ++ } ++ ++ gswip_switch_mask(priv, GSWIP_MAC_CTRL_0_FCON_MASK, ++ mac_ctrl_0, GSWIP_MAC_CTRL_0p(port)); ++ gswip_mdio_mask(priv, ++ GSWIP_MDIO_PHY_FCONTX_MASK | ++ GSWIP_MDIO_PHY_FCONRX_MASK, ++ mdio_phy, GSWIP_MDIO_PHYp(port)); ++} ++ + static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, + unsigned int mode, + const struct phylink_link_state *state) +@@ -1466,6 +1600,9 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, + break; + case PHY_INTERFACE_MODE_RMII: + miicfg |= GSWIP_MII_CFG_MODE_RMIIM; ++ ++ /* Configure the RMII clock as output: */ ++ miicfg |= GSWIP_MII_CFG_RMII_CLK; + break; + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: +@@ -1478,7 +1615,16 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, + "Unsupported interface: %d\n", state->interface); + return; + } +- gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_MODE_MASK, miicfg, port); ++ ++ gswip_mii_mask_cfg(priv, ++ GSWIP_MII_CFG_MODE_MASK | GSWIP_MII_CFG_RMII_CLK | ++ GSWIP_MII_CFG_RGMII_IBS | GSWIP_MII_CFG_LDCLKDIS, ++ miicfg, port); ++ ++ gswip_port_set_speed(priv, port, state->speed, state->interface); ++ gswip_port_set_duplex(priv, port, state->duplex); ++ gswip_port_set_pause(priv, port, !!(state->pause & MLO_PAUSE_TX), ++ !!(state->pause & MLO_PAUSE_RX)); + + switch (state->interface) { + case PHY_INTERFACE_MODE_RGMII_ID: +@@ -1503,6 +1649,9 @@ static void gswip_phylink_mac_link_down(struct dsa_switch *ds, int port, + struct gswip_priv *priv = ds->priv; + + gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, port); ++ ++ if (!dsa_is_cpu_port(ds, port)) ++ gswip_port_set_link(priv, port, false); + } + + static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port, +@@ -1512,6 +1661,9 @@ static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port, + { + struct gswip_priv *priv = ds->priv; + ++ if (!dsa_is_cpu_port(ds, port)) ++ gswip_port_set_link(priv, port, true); ++ + gswip_mii_mask_cfg(priv, 0, GSWIP_MII_CFG_EN, port); + } + +diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h +index 47bcbcf58048c..0c93a552b921d 100644 +--- a/drivers/net/ethernet/amd/xgbe/xgbe.h ++++ b/drivers/net/ethernet/amd/xgbe/xgbe.h +@@ -181,9 +181,9 @@ + #define XGBE_DMA_SYS_AWCR 0x30303030 + + /* DMA cache settings - PCI device */ +-#define XGBE_DMA_PCI_ARCR 0x00000003 +-#define XGBE_DMA_PCI_AWCR 0x13131313 +-#define XGBE_DMA_PCI_AWARCR 0x00000313 ++#define XGBE_DMA_PCI_ARCR 0x000f0f0f ++#define XGBE_DMA_PCI_AWCR 0x0f0f0f0f ++#define XGBE_DMA_PCI_AWARCR 0x00000f0f + + /* DMA channel interrupt modes */ + #define XGBE_IRQ_MODE_EDGE 0 +diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c +index 3f74416bb8744..bdef5b3dd848c 100644 +--- a/drivers/net/ethernet/cadence/macb_main.c ++++ b/drivers/net/ethernet/cadence/macb_main.c +@@ -2915,6 +2915,9 @@ static void gem_prog_cmp_regs(struct macb *bp, struct ethtool_rx_flow_spec *fs) + bool cmp_b = false; + bool cmp_c = false; + ++ if (!macb_is_gem(bp)) ++ return; ++ + tp4sp_v = &(fs->h_u.tcp_ip4_spec); + tp4sp_m = &(fs->m_u.tcp_ip4_spec); + +@@ -3286,6 +3289,7 @@ static void macb_restore_features(struct macb *bp) + { + struct net_device *netdev = bp->dev; + netdev_features_t features = netdev->features; ++ struct ethtool_rx_fs_item *item; + + /* TX checksum offload */ + macb_set_txcsum_feature(bp, features); +@@ -3294,6 +3298,9 @@ static void macb_restore_features(struct macb *bp) + macb_set_rxcsum_feature(bp, features); + + /* RX Flow Filters */ ++ list_for_each_entry(item, &bp->rx_fs_list.list, list) ++ gem_prog_cmp_regs(bp, &item->fs); ++ + macb_set_rxflow_feature(bp, features); + } + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +index e26ae298a080a..7801425e2726c 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +@@ -1393,11 +1393,25 @@ int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init, + struct cudbg_buffer temp_buff = { 0 }; + struct sge_qbase_reg_field *sge_qbase; + struct ireg_buf *ch_sge_dbg; ++ u8 padap_running = 0; + int i, rc; ++ u32 size; + +- rc = cudbg_get_buff(pdbg_init, dbg_buff, +- sizeof(*ch_sge_dbg) * 2 + sizeof(*sge_qbase), +- &temp_buff); ++ /* Accessing SGE_QBASE_MAP[0-3] and SGE_QBASE_INDEX regs can ++ * lead to SGE missing doorbells under heavy traffic. So, only ++ * collect them when adapter is idle. ++ */ ++ for_each_port(padap, i) { ++ padap_running = netif_running(padap->port[i]); ++ if (padap_running) ++ break; ++ } ++ ++ size = sizeof(*ch_sge_dbg) * 2; ++ if (!padap_running) ++ size += sizeof(*sge_qbase); ++ ++ rc = cudbg_get_buff(pdbg_init, dbg_buff, size, &temp_buff); + if (rc) + return rc; + +@@ -1419,7 +1433,8 @@ int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init, + ch_sge_dbg++; + } + +- if (CHELSIO_CHIP_VERSION(padap->params.chip) > CHELSIO_T5) { ++ if (CHELSIO_CHIP_VERSION(padap->params.chip) > CHELSIO_T5 && ++ !padap_running) { + sge_qbase = (struct sge_qbase_reg_field *)ch_sge_dbg; + /* 1 addr reg SGE_QBASE_INDEX and 4 data reg + * SGE_QBASE_MAP[0-3] +diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +index 588b63473c473..42374859b9d35 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +@@ -2093,7 +2093,8 @@ void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size) + 0x1190, 0x1194, + 0x11a0, 0x11a4, + 0x11b0, 0x11b4, +- 0x11fc, 0x1274, ++ 0x11fc, 0x123c, ++ 0x1254, 0x1274, + 0x1280, 0x133c, + 0x1800, 0x18fc, + 0x3000, 0x302c, +diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c +index a8959a092344f..382a45d84cc32 100644 +--- a/drivers/net/ethernet/freescale/gianfar.c ++++ b/drivers/net/ethernet/freescale/gianfar.c +@@ -366,7 +366,11 @@ static void gfar_set_mac_for_addr(struct net_device *dev, int num, + + static int gfar_set_mac_addr(struct net_device *dev, void *p) + { +- eth_mac_addr(dev, p); ++ int ret; ++ ++ ret = eth_mac_addr(dev, p); ++ if (ret) ++ return ret; + + gfar_set_mac_for_addr(dev, 0, dev->dev_addr); + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +index 9b09dd95e8781..fc275d4f484c5 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +@@ -2140,14 +2140,14 @@ static int hclgevf_ae_start(struct hnae3_handle *handle) + { + struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); + ++ clear_bit(HCLGEVF_STATE_DOWN, &hdev->state); ++ + hclgevf_reset_tqp_stats(handle); + + hclgevf_request_link_info(hdev); + + hclgevf_update_link_mode(hdev); + +- clear_bit(HCLGEVF_STATE_DOWN, &hdev->state); +- + return 0; + } + +diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h +index 678e4190b8a8c..e571c6116c4b7 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e.h ++++ b/drivers/net/ethernet/intel/i40e/i40e.h +@@ -152,6 +152,7 @@ enum i40e_state_t { + __I40E_VIRTCHNL_OP_PENDING, + __I40E_RECOVERY_MODE, + __I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */ ++ __I40E_VFS_RELEASING, + /* This must be last as it determines the size of the BITMAP */ + __I40E_STATE_SIZE__, + }; +diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +index 82c62e4678705..b519e5af5ed94 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +@@ -232,6 +232,8 @@ static void __i40e_add_stat_strings(u8 **p, const struct i40e_stats stats[], + I40E_STAT(struct i40e_vsi, _name, _stat) + #define I40E_VEB_STAT(_name, _stat) \ + I40E_STAT(struct i40e_veb, _name, _stat) ++#define I40E_VEB_TC_STAT(_name, _stat) \ ++ I40E_STAT(struct i40e_cp_veb_tc_stats, _name, _stat) + #define I40E_PFC_STAT(_name, _stat) \ + I40E_STAT(struct i40e_pfc_stats, _name, _stat) + #define I40E_QUEUE_STAT(_name, _stat) \ +@@ -266,11 +268,18 @@ static const struct i40e_stats i40e_gstrings_veb_stats[] = { + I40E_VEB_STAT("veb.rx_unknown_protocol", stats.rx_unknown_protocol), + }; + ++struct i40e_cp_veb_tc_stats { ++ u64 tc_rx_packets; ++ u64 tc_rx_bytes; ++ u64 tc_tx_packets; ++ u64 tc_tx_bytes; ++}; ++ + static const struct i40e_stats i40e_gstrings_veb_tc_stats[] = { +- I40E_VEB_STAT("veb.tc_%u_tx_packets", tc_stats.tc_tx_packets), +- I40E_VEB_STAT("veb.tc_%u_tx_bytes", tc_stats.tc_tx_bytes), +- I40E_VEB_STAT("veb.tc_%u_rx_packets", tc_stats.tc_rx_packets), +- I40E_VEB_STAT("veb.tc_%u_rx_bytes", tc_stats.tc_rx_bytes), ++ I40E_VEB_TC_STAT("veb.tc_%u_tx_packets", tc_tx_packets), ++ I40E_VEB_TC_STAT("veb.tc_%u_tx_bytes", tc_tx_bytes), ++ I40E_VEB_TC_STAT("veb.tc_%u_rx_packets", tc_rx_packets), ++ I40E_VEB_TC_STAT("veb.tc_%u_rx_bytes", tc_rx_bytes), + }; + + static const struct i40e_stats i40e_gstrings_misc_stats[] = { +@@ -1098,6 +1107,7 @@ static int i40e_get_link_ksettings(struct net_device *netdev, + + /* Set flow control settings */ + ethtool_link_ksettings_add_link_mode(ks, supported, Pause); ++ ethtool_link_ksettings_add_link_mode(ks, supported, Asym_Pause); + + switch (hw->fc.requested_mode) { + case I40E_FC_FULL: +@@ -2212,6 +2222,29 @@ static int i40e_get_sset_count(struct net_device *netdev, int sset) + } + } + ++/** ++ * i40e_get_veb_tc_stats - copy VEB TC statistics to formatted structure ++ * @tc: the TC statistics in VEB structure (veb->tc_stats) ++ * @i: the index of traffic class in (veb->tc_stats) structure to copy ++ * ++ * Copy VEB TC statistics from structure of arrays (veb->tc_stats) to ++ * one dimensional structure i40e_cp_veb_tc_stats. ++ * Produce formatted i40e_cp_veb_tc_stats structure of the VEB TC ++ * statistics for the given TC. ++ **/ ++static struct i40e_cp_veb_tc_stats ++i40e_get_veb_tc_stats(struct i40e_veb_tc_stats *tc, unsigned int i) ++{ ++ struct i40e_cp_veb_tc_stats veb_tc = { ++ .tc_rx_packets = tc->tc_rx_packets[i], ++ .tc_rx_bytes = tc->tc_rx_bytes[i], ++ .tc_tx_packets = tc->tc_tx_packets[i], ++ .tc_tx_bytes = tc->tc_tx_bytes[i], ++ }; ++ ++ return veb_tc; ++} ++ + /** + * i40e_get_pfc_stats - copy HW PFC statistics to formatted structure + * @pf: the PF device structure +@@ -2296,8 +2329,16 @@ static void i40e_get_ethtool_stats(struct net_device *netdev, + i40e_gstrings_veb_stats); + + for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) +- i40e_add_ethtool_stats(&data, veb_stats ? veb : NULL, +- i40e_gstrings_veb_tc_stats); ++ if (veb_stats) { ++ struct i40e_cp_veb_tc_stats veb_tc = ++ i40e_get_veb_tc_stats(&veb->tc_stats, i); ++ ++ i40e_add_ethtool_stats(&data, &veb_tc, ++ i40e_gstrings_veb_tc_stats); ++ } else { ++ i40e_add_ethtool_stats(&data, NULL, ++ i40e_gstrings_veb_tc_stats); ++ } + + i40e_add_ethtool_stats(&data, pf, i40e_gstrings_stats); + +diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c +index 58211590229b1..a69aace057925 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_main.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c +@@ -2547,8 +2547,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) + i40e_stat_str(hw, aq_ret), + i40e_aq_str(hw, hw->aq.asq_last_status)); + } else { +- dev_info(&pf->pdev->dev, "%s is %s allmulti mode.\n", +- vsi->netdev->name, ++ dev_info(&pf->pdev->dev, "%s allmulti mode.\n", + cur_multipromisc ? "entering" : "leaving"); + } + } +@@ -14701,12 +14700,16 @@ static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw) + * in order to register the netdev + */ + v_idx = i40e_vsi_mem_alloc(pf, I40E_VSI_MAIN); +- if (v_idx < 0) ++ if (v_idx < 0) { ++ err = v_idx; + goto err_switch_setup; ++ } + pf->lan_vsi = v_idx; + vsi = pf->vsi[v_idx]; +- if (!vsi) ++ if (!vsi) { ++ err = -EFAULT; + goto err_switch_setup; ++ } + vsi->alloc_queue_pairs = 1; + err = i40e_config_netdev(vsi); + if (err) +diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +index 5acd599d6b9af..e561073054865 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +@@ -137,6 +137,7 @@ void i40e_vc_notify_vf_reset(struct i40e_vf *vf) + **/ + static inline void i40e_vc_disable_vf(struct i40e_vf *vf) + { ++ struct i40e_pf *pf = vf->pf; + int i; + + i40e_vc_notify_vf_reset(vf); +@@ -147,6 +148,11 @@ static inline void i40e_vc_disable_vf(struct i40e_vf *vf) + * ensure a reset. + */ + for (i = 0; i < 20; i++) { ++ /* If PF is in VFs releasing state reset VF is impossible, ++ * so leave it. ++ */ ++ if (test_bit(__I40E_VFS_RELEASING, pf->state)) ++ return; + if (i40e_reset_vf(vf, false)) + return; + usleep_range(10000, 20000); +@@ -1506,6 +1512,8 @@ void i40e_free_vfs(struct i40e_pf *pf) + + if (!pf->vf) + return; ++ ++ set_bit(__I40E_VFS_RELEASING, pf->state); + while (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) + usleep_range(1000, 2000); + +@@ -1563,6 +1571,7 @@ void i40e_free_vfs(struct i40e_pf *pf) + } + } + clear_bit(__I40E_VF_DISABLE, pf->state); ++ clear_bit(__I40E_VFS_RELEASING, pf->state); + } + + #ifdef CONFIG_PCI_IOV +diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.h b/drivers/net/ethernet/intel/ice/ice_controlq.h +index 4df9da3591359..3b1d35365ef0f 100644 +--- a/drivers/net/ethernet/intel/ice/ice_controlq.h ++++ b/drivers/net/ethernet/intel/ice/ice_controlq.h +@@ -31,8 +31,8 @@ enum ice_ctl_q { + ICE_CTL_Q_MAILBOX, + }; + +-/* Control Queue timeout settings - max delay 250ms */ +-#define ICE_CTL_Q_SQ_CMD_TIMEOUT 2500 /* Count 2500 times */ ++/* Control Queue timeout settings - max delay 1s */ ++#define ICE_CTL_Q_SQ_CMD_TIMEOUT 10000 /* Count 10000 times */ + #define ICE_CTL_Q_SQ_CMD_USEC 100 /* Check every 100usec */ + + struct ice_ctl_q_ring { +diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c +index 1acdd43a2eddd..7ff2e07f6d38a 100644 +--- a/drivers/net/ethernet/intel/ice/ice_switch.c ++++ b/drivers/net/ethernet/intel/ice/ice_switch.c +@@ -1279,6 +1279,9 @@ ice_add_update_vsi_list(struct ice_hw *hw, + ice_create_vsi_list_map(hw, &vsi_handle_arr[0], 2, + vsi_list_id); + ++ if (!m_entry->vsi_list_info) ++ return ICE_ERR_NO_MEMORY; ++ + /* If this entry was large action then the large action needs + * to be updated to point to FWD to VSI list + */ +@@ -2266,6 +2269,7 @@ ice_vsi_uses_fltr(struct ice_fltr_mgmt_list_entry *fm_entry, u16 vsi_handle) + return ((fm_entry->fltr_info.fltr_act == ICE_FWD_TO_VSI && + fm_entry->fltr_info.vsi_handle == vsi_handle) || + (fm_entry->fltr_info.fltr_act == ICE_FWD_TO_VSI_LIST && ++ fm_entry->vsi_list_info && + (test_bit(vsi_handle, fm_entry->vsi_list_info->vsi_map)))); + } + +@@ -2338,14 +2342,12 @@ ice_add_to_vsi_fltr_list(struct ice_hw *hw, u16 vsi_handle, + return ICE_ERR_PARAM; + + list_for_each_entry(fm_entry, lkup_list_head, list_entry) { +- struct ice_fltr_info *fi; +- +- fi = &fm_entry->fltr_info; +- if (!fi || !ice_vsi_uses_fltr(fm_entry, vsi_handle)) ++ if (!ice_vsi_uses_fltr(fm_entry, vsi_handle)) + continue; + + status = ice_add_entry_to_vsi_fltr_list(hw, vsi_handle, +- vsi_list_head, fi); ++ vsi_list_head, ++ &fm_entry->fltr_info); + if (status) + return status; + } +@@ -2663,7 +2665,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle, + &remove_list_head); + mutex_unlock(rule_lock); + if (status) +- return; ++ goto free_fltr_list; + + switch (lkup) { + case ICE_SW_LKUP_MAC: +@@ -2686,6 +2688,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle, + break; + } + ++free_fltr_list: + list_for_each_entry_safe(fm_entry, tmp, &remove_list_head, list_entry) { + list_del(&fm_entry->list_entry); + devm_kfree(ice_hw_to_dev(hw), fm_entry); +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +index e09b4a96a1d5f..e3dc2cbdc9f6c 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +@@ -700,11 +700,11 @@ static int get_fec_supported_advertised(struct mlx5_core_dev *dev, + return 0; + } + +-static void ptys2ethtool_supported_advertised_port(struct ethtool_link_ksettings *link_ksettings, +- u32 eth_proto_cap, +- u8 connector_type, bool ext) ++static void ptys2ethtool_supported_advertised_port(struct mlx5_core_dev *mdev, ++ struct ethtool_link_ksettings *link_ksettings, ++ u32 eth_proto_cap, u8 connector_type) + { +- if ((!connector_type && !ext) || connector_type >= MLX5E_CONNECTOR_TYPE_NUMBER) { ++ if (!MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) { + if (eth_proto_cap & (MLX5E_PROT_MASK(MLX5E_10GBASE_CR) + | MLX5E_PROT_MASK(MLX5E_10GBASE_SR) + | MLX5E_PROT_MASK(MLX5E_40GBASE_CR4) +@@ -836,9 +836,9 @@ static int ptys2connector_type[MLX5E_CONNECTOR_TYPE_NUMBER] = { + [MLX5E_PORT_OTHER] = PORT_OTHER, + }; + +-static u8 get_connector_port(u32 eth_proto, u8 connector_type, bool ext) ++static u8 get_connector_port(struct mlx5_core_dev *mdev, u32 eth_proto, u8 connector_type) + { +- if ((connector_type || ext) && connector_type < MLX5E_CONNECTOR_TYPE_NUMBER) ++ if (MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) + return ptys2connector_type[connector_type]; + + if (eth_proto & +@@ -937,11 +937,11 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, + link_ksettings); + + eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; +- +- link_ksettings->base.port = get_connector_port(eth_proto_oper, +- connector_type, ext); +- ptys2ethtool_supported_advertised_port(link_ksettings, eth_proto_admin, +- connector_type, ext); ++ connector_type = connector_type < MLX5E_CONNECTOR_TYPE_NUMBER ? ++ connector_type : MLX5E_PORT_UNKNOWN; ++ link_ksettings->base.port = get_connector_port(mdev, eth_proto_oper, connector_type); ++ ptys2ethtool_supported_advertised_port(mdev, link_ksettings, eth_proto_admin, ++ connector_type); + get_lp_advertising(mdev, eth_proto_lp, link_ksettings); + + if (an_status == MLX5_AN_COMPLETE) +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c +index 0a20938b4aadb..30a2ee3c40a00 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c +@@ -926,13 +926,24 @@ void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev) + mutex_unlock(&table->lock); + } + ++#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING ++#define MLX5_MAX_ASYNC_EQS 4 ++#else ++#define MLX5_MAX_ASYNC_EQS 3 ++#endif ++ + int mlx5_eq_table_create(struct mlx5_core_dev *dev) + { + struct mlx5_eq_table *eq_table = dev->priv.eq_table; ++ int num_eqs = MLX5_CAP_GEN(dev, max_num_eqs) ? ++ MLX5_CAP_GEN(dev, max_num_eqs) : ++ 1 << MLX5_CAP_GEN(dev, log_max_eq); + int err; + + eq_table->num_comp_eqs = +- mlx5_irq_get_num_comp(eq_table->irq_table); ++ min_t(int, ++ mlx5_irq_get_num_comp(eq_table->irq_table), ++ num_eqs - MLX5_MAX_ASYNC_EQS); + + err = create_async_eqs(dev); + if (err) { +diff --git a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c +index 0e2db6ea79e96..2ec62c8d86e1c 100644 +--- a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c ++++ b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c +@@ -454,6 +454,7 @@ void nfp_bpf_ctrl_msg_rx(struct nfp_app *app, struct sk_buff *skb) + dev_consume_skb_any(skb); + else + dev_kfree_skb_any(skb); ++ return; + } + + nfp_ccm_rx(&bpf->ccm, skb); +diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h +index 31d94592a7c02..2d99533ad3e0d 100644 +--- a/drivers/net/ethernet/netronome/nfp/flower/main.h ++++ b/drivers/net/ethernet/netronome/nfp/flower/main.h +@@ -164,6 +164,7 @@ struct nfp_fl_internal_ports { + * @qos_rate_limiters: Current active qos rate limiters + * @qos_stats_lock: Lock on qos stats updates + * @pre_tun_rule_cnt: Number of pre-tunnel rules offloaded ++ * @merge_table: Hash table to store merged flows + */ + struct nfp_flower_priv { + struct nfp_app *app; +@@ -196,6 +197,7 @@ struct nfp_flower_priv { + unsigned int qos_rate_limiters; + spinlock_t qos_stats_lock; /* Protect the qos stats */ + int pre_tun_rule_cnt; ++ struct rhashtable merge_table; + }; + + /** +@@ -310,6 +312,12 @@ struct nfp_fl_payload_link { + }; + + extern const struct rhashtable_params nfp_flower_table_params; ++extern const struct rhashtable_params merge_table_params; ++ ++struct nfp_merge_info { ++ u64 parent_ctx; ++ struct rhash_head ht_node; ++}; + + struct nfp_fl_stats_frame { + __be32 stats_con_id; +diff --git a/drivers/net/ethernet/netronome/nfp/flower/metadata.c b/drivers/net/ethernet/netronome/nfp/flower/metadata.c +index aa06fcb38f8b9..327bb56b3ef56 100644 +--- a/drivers/net/ethernet/netronome/nfp/flower/metadata.c ++++ b/drivers/net/ethernet/netronome/nfp/flower/metadata.c +@@ -490,6 +490,12 @@ const struct rhashtable_params nfp_flower_table_params = { + .automatic_shrinking = true, + }; + ++const struct rhashtable_params merge_table_params = { ++ .key_offset = offsetof(struct nfp_merge_info, parent_ctx), ++ .head_offset = offsetof(struct nfp_merge_info, ht_node), ++ .key_len = sizeof(u64), ++}; ++ + int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, + unsigned int host_num_mems) + { +@@ -506,6 +512,10 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, + if (err) + goto err_free_flow_table; + ++ err = rhashtable_init(&priv->merge_table, &merge_table_params); ++ if (err) ++ goto err_free_stats_ctx_table; ++ + get_random_bytes(&priv->mask_id_seed, sizeof(priv->mask_id_seed)); + + /* Init ring buffer and unallocated mask_ids. */ +@@ -513,7 +523,7 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, + kmalloc_array(NFP_FLOWER_MASK_ENTRY_RS, + NFP_FLOWER_MASK_ELEMENT_RS, GFP_KERNEL); + if (!priv->mask_ids.mask_id_free_list.buf) +- goto err_free_stats_ctx_table; ++ goto err_free_merge_table; + + priv->mask_ids.init_unallocated = NFP_FLOWER_MASK_ENTRY_RS - 1; + +@@ -550,6 +560,8 @@ err_free_last_used: + kfree(priv->mask_ids.last_used); + err_free_mask_id: + kfree(priv->mask_ids.mask_id_free_list.buf); ++err_free_merge_table: ++ rhashtable_destroy(&priv->merge_table); + err_free_stats_ctx_table: + rhashtable_destroy(&priv->stats_ctx_table); + err_free_flow_table: +@@ -568,6 +580,8 @@ void nfp_flower_metadata_cleanup(struct nfp_app *app) + nfp_check_rhashtable_empty, NULL); + rhashtable_free_and_destroy(&priv->stats_ctx_table, + nfp_check_rhashtable_empty, NULL); ++ rhashtable_free_and_destroy(&priv->merge_table, ++ nfp_check_rhashtable_empty, NULL); + kvfree(priv->stats); + kfree(priv->mask_ids.mask_id_free_list.buf); + kfree(priv->mask_ids.last_used); +diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c +index 4dd3f8a5a9b88..f57e7f3370124 100644 +--- a/drivers/net/ethernet/netronome/nfp/flower/offload.c ++++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c +@@ -923,6 +923,8 @@ int nfp_flower_merge_offloaded_flows(struct nfp_app *app, + struct netlink_ext_ack *extack = NULL; + struct nfp_fl_payload *merge_flow; + struct nfp_fl_key_ls merge_key_ls; ++ struct nfp_merge_info *merge_info; ++ u64 parent_ctx = 0; + int err; + + ASSERT_RTNL(); +@@ -933,6 +935,15 @@ int nfp_flower_merge_offloaded_flows(struct nfp_app *app, + nfp_flower_is_merge_flow(sub_flow2)) + return -EINVAL; + ++ /* check if the two flows are already merged */ ++ parent_ctx = (u64)(be32_to_cpu(sub_flow1->meta.host_ctx_id)) << 32; ++ parent_ctx |= (u64)(be32_to_cpu(sub_flow2->meta.host_ctx_id)); ++ if (rhashtable_lookup_fast(&priv->merge_table, ++ &parent_ctx, merge_table_params)) { ++ nfp_flower_cmsg_warn(app, "The two flows are already merged.\n"); ++ return 0; ++ } ++ + err = nfp_flower_can_merge(sub_flow1, sub_flow2); + if (err) + return err; +@@ -974,16 +985,33 @@ int nfp_flower_merge_offloaded_flows(struct nfp_app *app, + if (err) + goto err_release_metadata; + ++ merge_info = kmalloc(sizeof(*merge_info), GFP_KERNEL); ++ if (!merge_info) { ++ err = -ENOMEM; ++ goto err_remove_rhash; ++ } ++ merge_info->parent_ctx = parent_ctx; ++ err = rhashtable_insert_fast(&priv->merge_table, &merge_info->ht_node, ++ merge_table_params); ++ if (err) ++ goto err_destroy_merge_info; ++ + err = nfp_flower_xmit_flow(app, merge_flow, + NFP_FLOWER_CMSG_TYPE_FLOW_MOD); + if (err) +- goto err_remove_rhash; ++ goto err_remove_merge_info; + + merge_flow->in_hw = true; + sub_flow1->in_hw = false; + + return 0; + ++err_remove_merge_info: ++ WARN_ON_ONCE(rhashtable_remove_fast(&priv->merge_table, ++ &merge_info->ht_node, ++ merge_table_params)); ++err_destroy_merge_info: ++ kfree(merge_info); + err_remove_rhash: + WARN_ON_ONCE(rhashtable_remove_fast(&priv->flow_table, + &merge_flow->fl_node, +@@ -1211,7 +1239,9 @@ nfp_flower_remove_merge_flow(struct nfp_app *app, + { + struct nfp_flower_priv *priv = app->priv; + struct nfp_fl_payload_link *link, *temp; ++ struct nfp_merge_info *merge_info; + struct nfp_fl_payload *origin; ++ u64 parent_ctx = 0; + bool mod = false; + int err; + +@@ -1248,8 +1278,22 @@ nfp_flower_remove_merge_flow(struct nfp_app *app, + err_free_links: + /* Clean any links connected with the merged flow. */ + list_for_each_entry_safe(link, temp, &merge_flow->linked_flows, +- merge_flow.list) ++ merge_flow.list) { ++ u32 ctx_id = be32_to_cpu(link->sub_flow.flow->meta.host_ctx_id); ++ ++ parent_ctx = (parent_ctx << 32) | (u64)(ctx_id); + nfp_flower_unlink_flow(link); ++ } ++ ++ merge_info = rhashtable_lookup_fast(&priv->merge_table, ++ &parent_ctx, ++ merge_table_params); ++ if (merge_info) { ++ WARN_ON_ONCE(rhashtable_remove_fast(&priv->merge_table, ++ &merge_info->ht_node, ++ merge_table_params)); ++ kfree(merge_info); ++ } + + kfree(merge_flow->action_data); + kfree(merge_flow->mask_data); +diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c +index 0dd0ba915ab97..23ee0b14cbfa1 100644 +--- a/drivers/net/ieee802154/atusb.c ++++ b/drivers/net/ieee802154/atusb.c +@@ -365,6 +365,7 @@ static int atusb_alloc_urbs(struct atusb *atusb, int n) + return -ENOMEM; + } + usb_anchor_urb(urb, &atusb->idle_urbs); ++ usb_free_urb(urb); + n--; + } + return 0; +diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c +index e0d3310957ffa..c99883120556c 100644 +--- a/drivers/net/phy/bcm-phy-lib.c ++++ b/drivers/net/phy/bcm-phy-lib.c +@@ -190,7 +190,7 @@ EXPORT_SYMBOL_GPL(bcm_phy_enable_apd); + + int bcm_phy_set_eee(struct phy_device *phydev, bool enable) + { +- int val; ++ int val, mask = 0; + + /* Enable EEE at PHY level */ + val = phy_read_mmd(phydev, MDIO_MMD_AN, BRCM_CL45VEN_EEE_CONTROL); +@@ -209,10 +209,17 @@ int bcm_phy_set_eee(struct phy_device *phydev, bool enable) + if (val < 0) + return val; + ++ if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, ++ phydev->supported)) ++ mask |= MDIO_EEE_1000T; ++ if (linkmode_test_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, ++ phydev->supported)) ++ mask |= MDIO_EEE_100TX; ++ + if (enable) +- val |= (MDIO_EEE_100TX | MDIO_EEE_1000T); ++ val |= mask; + else +- val &= ~(MDIO_EEE_100TX | MDIO_EEE_1000T); ++ val &= ~mask; + + phy_write_mmd(phydev, MDIO_MMD_AN, BCM_CL45VEN_EEE_ADV, (u32)val); + +diff --git a/drivers/net/tun.c b/drivers/net/tun.c +index fe6ec22bf3d51..7c40ae058e6d1 100644 +--- a/drivers/net/tun.c ++++ b/drivers/net/tun.c +@@ -68,6 +68,14 @@ + #include + #include + #include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include + + #include + #include +@@ -3043,6 +3051,45 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog **prog_p, + return __tun_set_ebpf(tun, prog_p, prog); + } + ++/* Return correct value for tun->dev->addr_len based on tun->dev->type. */ ++static unsigned char tun_get_addr_len(unsigned short type) ++{ ++ switch (type) { ++ case ARPHRD_IP6GRE: ++ case ARPHRD_TUNNEL6: ++ return sizeof(struct in6_addr); ++ case ARPHRD_IPGRE: ++ case ARPHRD_TUNNEL: ++ case ARPHRD_SIT: ++ return 4; ++ case ARPHRD_ETHER: ++ return ETH_ALEN; ++ case ARPHRD_IEEE802154: ++ case ARPHRD_IEEE802154_MONITOR: ++ return IEEE802154_EXTENDED_ADDR_LEN; ++ case ARPHRD_PHONET_PIPE: ++ case ARPHRD_PPP: ++ case ARPHRD_NONE: ++ return 0; ++ case ARPHRD_6LOWPAN: ++ return EUI64_ADDR_LEN; ++ case ARPHRD_FDDI: ++ return FDDI_K_ALEN; ++ case ARPHRD_HIPPI: ++ return HIPPI_ALEN; ++ case ARPHRD_IEEE802: ++ return FC_ALEN; ++ case ARPHRD_ROSE: ++ return ROSE_ADDR_LEN; ++ case ARPHRD_NETROM: ++ return AX25_ADDR_LEN; ++ case ARPHRD_LOCALTLK: ++ return LTALK_ALEN; ++ default: ++ return 0; ++ } ++} ++ + static long __tun_chr_ioctl(struct file *file, unsigned int cmd, + unsigned long arg, int ifreq_len) + { +@@ -3198,6 +3245,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, + ret = -EBUSY; + } else { + tun->dev->type = (int) arg; ++ tun->dev->addr_len = tun_get_addr_len(tun->dev->type); + tun_debug(KERN_INFO, tun, "linktype set to %d\n", + tun->dev->type); + ret = 0; +diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c +index 7449b97a3c89b..38f39154a6433 100644 +--- a/drivers/net/usb/hso.c ++++ b/drivers/net/usb/hso.c +@@ -611,7 +611,7 @@ static struct hso_serial *get_serial_by_index(unsigned index) + return serial; + } + +-static int get_free_serial_index(void) ++static int obtain_minor(struct hso_serial *serial) + { + int index; + unsigned long flags; +@@ -619,8 +619,10 @@ static int get_free_serial_index(void) + spin_lock_irqsave(&serial_table_lock, flags); + for (index = 0; index < HSO_SERIAL_TTY_MINORS; index++) { + if (serial_table[index] == NULL) { ++ serial_table[index] = serial->parent; ++ serial->minor = index; + spin_unlock_irqrestore(&serial_table_lock, flags); +- return index; ++ return 0; + } + } + spin_unlock_irqrestore(&serial_table_lock, flags); +@@ -629,15 +631,12 @@ static int get_free_serial_index(void) + return -1; + } + +-static void set_serial_by_index(unsigned index, struct hso_serial *serial) ++static void release_minor(struct hso_serial *serial) + { + unsigned long flags; + + spin_lock_irqsave(&serial_table_lock, flags); +- if (serial) +- serial_table[index] = serial->parent; +- else +- serial_table[index] = NULL; ++ serial_table[serial->minor] = NULL; + spin_unlock_irqrestore(&serial_table_lock, flags); + } + +@@ -2230,6 +2229,7 @@ static int hso_stop_serial_device(struct hso_device *hso_dev) + static void hso_serial_tty_unregister(struct hso_serial *serial) + { + tty_unregister_device(tty_drv, serial->minor); ++ release_minor(serial); + } + + static void hso_serial_common_free(struct hso_serial *serial) +@@ -2253,24 +2253,22 @@ static void hso_serial_common_free(struct hso_serial *serial) + static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, + int rx_size, int tx_size) + { +- int minor; + int i; + + tty_port_init(&serial->port); + +- minor = get_free_serial_index(); +- if (minor < 0) ++ if (obtain_minor(serial)) + goto exit2; + + /* register our minor number */ + serial->parent->dev = tty_port_register_device_attr(&serial->port, +- tty_drv, minor, &serial->parent->interface->dev, ++ tty_drv, serial->minor, &serial->parent->interface->dev, + serial->parent, hso_serial_dev_groups); +- if (IS_ERR(serial->parent->dev)) ++ if (IS_ERR(serial->parent->dev)) { ++ release_minor(serial); + goto exit2; ++ } + +- /* fill in specific data for later use */ +- serial->minor = minor; + serial->magic = HSO_SERIAL_MAGIC; + spin_lock_init(&serial->serial_lock); + serial->num_rx_urbs = num_urbs; +@@ -2668,9 +2666,6 @@ static struct hso_device *hso_create_bulk_serial_device( + + serial->write_data = hso_std_serial_write_data; + +- /* and record this serial */ +- set_serial_by_index(serial->minor, serial); +- + /* setup the proc dirs and files if needed */ + hso_log_port(hso_dev); + +@@ -2727,9 +2722,6 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, + serial->shared_int->ref_count++; + mutex_unlock(&serial->shared_int->shared_int_lock); + +- /* and record this serial */ +- set_serial_by_index(serial->minor, serial); +- + /* setup the proc dirs and files if needed */ + hso_log_port(hso_dev); + +@@ -3114,7 +3106,6 @@ static void hso_free_interface(struct usb_interface *interface) + cancel_work_sync(&serial_table[i]->async_get_intf); + hso_serial_tty_unregister(serial); + kref_put(&serial_table[i]->ref, hso_serial_ref_free); +- set_serial_by_index(i, NULL); + } + } + +diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c +index 0ef85819665c8..b67460864b3c2 100644 +--- a/drivers/net/virtio_net.c ++++ b/drivers/net/virtio_net.c +@@ -376,7 +376,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, + struct receive_queue *rq, + struct page *page, unsigned int offset, + unsigned int len, unsigned int truesize, +- bool hdr_valid) ++ bool hdr_valid, unsigned int metasize) + { + struct sk_buff *skb; + struct virtio_net_hdr_mrg_rxbuf *hdr; +@@ -398,6 +398,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, + else + hdr_padded_len = sizeof(struct padded_vnet_hdr); + ++ /* hdr_valid means no XDP, so we can copy the vnet header */ + if (hdr_valid) + memcpy(hdr, p, hdr_len); + +@@ -410,6 +411,11 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, + copy = skb_tailroom(skb); + skb_put_data(skb, p, copy); + ++ if (metasize) { ++ __skb_pull(skb, metasize); ++ skb_metadata_set(skb, metasize); ++ } ++ + len -= copy; + offset += copy; + +@@ -455,10 +461,6 @@ static int __virtnet_xdp_xmit_one(struct virtnet_info *vi, + struct virtio_net_hdr_mrg_rxbuf *hdr; + int err; + +- /* virtqueue want to use data area in-front of packet */ +- if (unlikely(xdpf->metasize > 0)) +- return -EOPNOTSUPP; +- + if (unlikely(xdpf->headroom < vi->hdr_len)) + return -EOVERFLOW; + +@@ -649,6 +651,7 @@ static struct sk_buff *receive_small(struct net_device *dev, + unsigned int delta = 0; + struct page *xdp_page; + int err; ++ unsigned int metasize = 0; + + len -= vi->hdr_len; + stats->bytes += len; +@@ -688,8 +691,8 @@ static struct sk_buff *receive_small(struct net_device *dev, + + xdp.data_hard_start = buf + VIRTNET_RX_PAD + vi->hdr_len; + xdp.data = xdp.data_hard_start + xdp_headroom; +- xdp_set_data_meta_invalid(&xdp); + xdp.data_end = xdp.data + len; ++ xdp.data_meta = xdp.data; + xdp.rxq = &rq->xdp_rxq; + orig_data = xdp.data; + act = bpf_prog_run_xdp(xdp_prog, &xdp); +@@ -700,6 +703,7 @@ static struct sk_buff *receive_small(struct net_device *dev, + /* Recalculate length in case bpf program changed it */ + delta = orig_data - xdp.data; + len = xdp.data_end - xdp.data; ++ metasize = xdp.data - xdp.data_meta; + break; + case XDP_TX: + stats->xdp_tx++; +@@ -745,6 +749,9 @@ static struct sk_buff *receive_small(struct net_device *dev, + memcpy(skb_vnet_hdr(skb), buf, vi->hdr_len); + } /* keep zeroed vnet hdr since packet was changed by bpf */ + ++ if (metasize) ++ skb_metadata_set(skb, metasize); ++ + err: + return skb; + +@@ -765,8 +772,8 @@ static struct sk_buff *receive_big(struct net_device *dev, + struct virtnet_rq_stats *stats) + { + struct page *page = buf; +- struct sk_buff *skb = page_to_skb(vi, rq, page, 0, len, +- PAGE_SIZE, true); ++ struct sk_buff *skb = ++ page_to_skb(vi, rq, page, 0, len, PAGE_SIZE, true, 0); + + stats->bytes += len - vi->hdr_len; + if (unlikely(!skb)) +@@ -798,6 +805,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, + unsigned int truesize; + unsigned int headroom = mergeable_ctx_to_headroom(ctx); + int err; ++ unsigned int metasize = 0; + + head_skb = NULL; + stats->bytes += len - vi->hdr_len; +@@ -844,8 +852,8 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, + data = page_address(xdp_page) + offset; + xdp.data_hard_start = data - VIRTIO_XDP_HEADROOM + vi->hdr_len; + xdp.data = data + vi->hdr_len; +- xdp_set_data_meta_invalid(&xdp); + xdp.data_end = xdp.data + (len - vi->hdr_len); ++ xdp.data_meta = xdp.data; + xdp.rxq = &rq->xdp_rxq; + + act = bpf_prog_run_xdp(xdp_prog, &xdp); +@@ -853,24 +861,27 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, + + switch (act) { + case XDP_PASS: ++ metasize = xdp.data - xdp.data_meta; ++ + /* recalculate offset to account for any header +- * adjustments. Note other cases do not build an +- * skb and avoid using offset ++ * adjustments and minus the metasize to copy the ++ * metadata in page_to_skb(). Note other cases do not ++ * build an skb and avoid using offset + */ +- offset = xdp.data - +- page_address(xdp_page) - vi->hdr_len; ++ offset = xdp.data - page_address(xdp_page) - ++ vi->hdr_len - metasize; + +- /* recalculate len if xdp.data or xdp.data_end were +- * adjusted ++ /* recalculate len if xdp.data, xdp.data_end or ++ * xdp.data_meta were adjusted + */ +- len = xdp.data_end - xdp.data + vi->hdr_len; ++ len = xdp.data_end - xdp.data + vi->hdr_len + metasize; + /* We can only create skb based on xdp_page. */ + if (unlikely(xdp_page != page)) { + rcu_read_unlock(); + put_page(page); +- head_skb = page_to_skb(vi, rq, xdp_page, +- offset, len, +- PAGE_SIZE, false); ++ head_skb = page_to_skb(vi, rq, xdp_page, offset, ++ len, PAGE_SIZE, false, ++ metasize); + return head_skb; + } + break; +@@ -926,7 +937,8 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, + goto err_skb; + } + +- head_skb = page_to_skb(vi, rq, page, offset, len, truesize, !xdp_prog); ++ head_skb = page_to_skb(vi, rq, page, offset, len, truesize, !xdp_prog, ++ metasize); + curr_skb = head_skb; + + if (unlikely(!curr_skb)) +diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c +index c09cf55e2d204..40334e55bbc74 100644 +--- a/drivers/ras/cec.c ++++ b/drivers/ras/cec.c +@@ -309,11 +309,20 @@ static bool sanity_check(struct ce_array *ca) + return ret; + } + ++/** ++ * cec_add_elem - Add an element to the CEC array. ++ * @pfn: page frame number to insert ++ * ++ * Return values: ++ * - <0: on error ++ * - 0: on success ++ * - >0: when the inserted pfn was offlined ++ */ + int cec_add_elem(u64 pfn) + { + struct ce_array *ca = &ce_arr; ++ int count, err, ret = 0; + unsigned int to = 0; +- int count, ret = 0; + + /* + * We can be called very early on the identify_cpu() path where we are +@@ -330,8 +339,8 @@ int cec_add_elem(u64 pfn) + if (ca->n == MAX_ELEMS) + WARN_ON(!del_lru_elem_unlocked(ca)); + +- ret = find_elem(ca, pfn, &to); +- if (ret < 0) { ++ err = find_elem(ca, pfn, &to); ++ if (err < 0) { + /* + * Shift range [to-end] to make room for one more element. + */ +diff --git a/drivers/regulator/bd9571mwv-regulator.c b/drivers/regulator/bd9571mwv-regulator.c +index e690c2ce5b3c5..25e33028871c0 100644 +--- a/drivers/regulator/bd9571mwv-regulator.c ++++ b/drivers/regulator/bd9571mwv-regulator.c +@@ -124,7 +124,7 @@ static const struct regulator_ops vid_ops = { + + static const struct regulator_desc regulators[] = { + BD9571MWV_REG("VD09", "vd09", VD09, avs_ops, 0, 0x7f, +- 0x80, 600000, 10000, 0x3c), ++ 0x6f, 600000, 10000, 0x3c), + BD9571MWV_REG("VD18", "vd18", VD18, vid_ops, BD9571MWV_VD18_VID, 0xf, + 16, 1625000, 25000, 0), + BD9571MWV_REG("VD25", "vd25", VD25, vid_ops, BD9571MWV_VD25_VID, 0xf, +@@ -133,7 +133,7 @@ static const struct regulator_desc regulators[] = { + 11, 2800000, 100000, 0), + BD9571MWV_REG("DVFS", "dvfs", DVFS, reg_ops, + BD9571MWV_DVFS_MONIVDAC, 0x7f, +- 0x80, 600000, 10000, 0x3c), ++ 0x6f, 600000, 10000, 0x3c), + }; + + #ifdef CONFIG_PM_SLEEP +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c +index 476ef8044ae59..b81eebc7e2df2 100644 +--- a/drivers/scsi/ufs/ufshcd.c ++++ b/drivers/scsi/ufs/ufshcd.c +@@ -239,7 +239,7 @@ static struct ufs_dev_fix ufs_fixups[] = { + END_FIX + }; + +-static void ufshcd_tmc_handler(struct ufs_hba *hba); ++static irqreturn_t ufshcd_tmc_handler(struct ufs_hba *hba); + static void ufshcd_async_scan(void *data, async_cookie_t cookie); + static int ufshcd_reset_and_restore(struct ufs_hba *hba); + static int ufshcd_eh_host_reset_handler(struct scsi_cmnd *cmd); +@@ -496,8 +496,8 @@ static void ufshcd_print_tmrs(struct ufs_hba *hba, unsigned long bitmap) + static void ufshcd_print_host_state(struct ufs_hba *hba) + { + dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state); +- dev_err(hba->dev, "lrb in use=0x%lx, outstanding reqs=0x%lx tasks=0x%lx\n", +- hba->lrb_in_use, hba->outstanding_reqs, hba->outstanding_tasks); ++ dev_err(hba->dev, "outstanding reqs=0x%lx tasks=0x%lx\n", ++ hba->outstanding_reqs, hba->outstanding_tasks); + dev_err(hba->dev, "saved_err=0x%x, saved_uic_err=0x%x\n", + hba->saved_err, hba->saved_uic_err); + dev_err(hba->dev, "Device power mode=%d, UIC link state=%d\n", +@@ -644,40 +644,6 @@ static inline int ufshcd_get_tr_ocs(struct ufshcd_lrb *lrbp) + return le32_to_cpu(lrbp->utr_descriptor_ptr->header.dword_2) & MASK_OCS; + } + +-/** +- * ufshcd_get_tm_free_slot - get a free slot for task management request +- * @hba: per adapter instance +- * @free_slot: pointer to variable with available slot value +- * +- * Get a free tag and lock it until ufshcd_put_tm_slot() is called. +- * Returns 0 if free slot is not available, else return 1 with tag value +- * in @free_slot. +- */ +-static bool ufshcd_get_tm_free_slot(struct ufs_hba *hba, int *free_slot) +-{ +- int tag; +- bool ret = false; +- +- if (!free_slot) +- goto out; +- +- do { +- tag = find_first_zero_bit(&hba->tm_slots_in_use, hba->nutmrs); +- if (tag >= hba->nutmrs) +- goto out; +- } while (test_and_set_bit_lock(tag, &hba->tm_slots_in_use)); +- +- *free_slot = tag; +- ret = true; +-out: +- return ret; +-} +- +-static inline void ufshcd_put_tm_slot(struct ufs_hba *hba, int slot) +-{ +- clear_bit_unlock(slot, &hba->tm_slots_in_use); +-} +- + /** + * ufshcd_utrl_clear - Clear a bit in UTRLCLR register + * @hba: per adapter instance +@@ -1279,6 +1245,24 @@ out: + return ret; + } + ++static bool ufshcd_is_busy(struct request *req, void *priv, bool reserved) ++{ ++ int *busy = priv; ++ ++ WARN_ON_ONCE(reserved); ++ (*busy)++; ++ return false; ++} ++ ++/* Whether or not any tag is in use by a request that is in progress. */ ++static bool ufshcd_any_tag_in_use(struct ufs_hba *hba) ++{ ++ struct request_queue *q = hba->cmd_queue; ++ int busy = 0; ++ ++ blk_mq_tagset_busy_iter(q->tag_set, ufshcd_is_busy, &busy); ++ return busy; ++} + + static int ufshcd_devfreq_get_dev_status(struct device *dev, + struct devfreq_dev_status *stat) +@@ -1633,7 +1617,7 @@ static void ufshcd_gate_work(struct work_struct *work) + + if (hba->clk_gating.active_reqs + || hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL +- || hba->lrb_in_use || hba->outstanding_tasks ++ || ufshcd_any_tag_in_use(hba) || hba->outstanding_tasks + || hba->active_uic_cmd || hba->uic_async_done) + goto rel_lock; + +@@ -1687,7 +1671,7 @@ static void __ufshcd_release(struct ufs_hba *hba) + + if (hba->clk_gating.active_reqs || hba->clk_gating.is_suspended + || hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL +- || hba->lrb_in_use || hba->outstanding_tasks ++ || ufshcd_any_tag_in_use(hba) || hba->outstanding_tasks + || hba->active_uic_cmd || hba->uic_async_done + || ufshcd_eh_in_progress(hba)) + return; +@@ -2457,22 +2441,9 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) + + hba->req_abort_count = 0; + +- /* acquire the tag to make sure device cmds don't use it */ +- if (test_and_set_bit_lock(tag, &hba->lrb_in_use)) { +- /* +- * Dev manage command in progress, requeue the command. +- * Requeuing the command helps in cases where the request *may* +- * find different tag instead of waiting for dev manage command +- * completion. +- */ +- err = SCSI_MLQUEUE_HOST_BUSY; +- goto out; +- } +- + err = ufshcd_hold(hba, true); + if (err) { + err = SCSI_MLQUEUE_HOST_BUSY; +- clear_bit_unlock(tag, &hba->lrb_in_use); + goto out; + } + WARN_ON(hba->clk_gating.state != CLKS_ON); +@@ -2494,7 +2465,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) + if (err) { + ufshcd_release(hba); + lrbp->cmd = NULL; +- clear_bit_unlock(tag, &hba->lrb_in_use); + goto out; + } + /* Make sure descriptors are ready before ringing the doorbell */ +@@ -2641,44 +2611,6 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba, + return err; + } + +-/** +- * ufshcd_get_dev_cmd_tag - Get device management command tag +- * @hba: per-adapter instance +- * @tag_out: pointer to variable with available slot value +- * +- * Get a free slot and lock it until device management command +- * completes. +- * +- * Returns false if free slot is unavailable for locking, else +- * return true with tag value in @tag. +- */ +-static bool ufshcd_get_dev_cmd_tag(struct ufs_hba *hba, int *tag_out) +-{ +- int tag; +- bool ret = false; +- unsigned long tmp; +- +- if (!tag_out) +- goto out; +- +- do { +- tmp = ~hba->lrb_in_use; +- tag = find_last_bit(&tmp, hba->nutrs); +- if (tag >= hba->nutrs) +- goto out; +- } while (test_and_set_bit_lock(tag, &hba->lrb_in_use)); +- +- *tag_out = tag; +- ret = true; +-out: +- return ret; +-} +- +-static inline void ufshcd_put_dev_cmd_tag(struct ufs_hba *hba, int tag) +-{ +- clear_bit_unlock(tag, &hba->lrb_in_use); +-} +- + /** + * ufshcd_exec_dev_cmd - API for sending device management requests + * @hba: UFS hba +@@ -2691,6 +2623,8 @@ static inline void ufshcd_put_dev_cmd_tag(struct ufs_hba *hba, int tag) + static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, + enum dev_cmd_type cmd_type, int timeout) + { ++ struct request_queue *q = hba->cmd_queue; ++ struct request *req; + struct ufshcd_lrb *lrbp; + int err; + int tag; +@@ -2704,7 +2638,11 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, + * Even though we use wait_event() which sleeps indefinitely, + * the maximum wait time is bounded by SCSI request timeout. + */ +- wait_event(hba->dev_cmd.tag_wq, ufshcd_get_dev_cmd_tag(hba, &tag)); ++ req = blk_get_request(q, REQ_OP_DRV_OUT, 0); ++ if (IS_ERR(req)) ++ return PTR_ERR(req); ++ tag = req->tag; ++ WARN_ON_ONCE(!ufshcd_valid_tag(hba, tag)); + + init_completion(&wait); + lrbp = &hba->lrb[tag]; +@@ -2729,8 +2667,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, + err ? "query_complete_err" : "query_complete"); + + out_put_tag: +- ufshcd_put_dev_cmd_tag(hba, tag); +- wake_up(&hba->dev_cmd.tag_wq); ++ blk_put_request(req); + up_read(&hba->clk_scaling_lock); + return err; + } +@@ -4815,19 +4752,29 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) + * ufshcd_uic_cmd_compl - handle completion of uic command + * @hba: per adapter instance + * @intr_status: interrupt status generated by the controller ++ * ++ * Returns ++ * IRQ_HANDLED - If interrupt is valid ++ * IRQ_NONE - If invalid interrupt + */ +-static void ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status) ++static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status) + { ++ irqreturn_t retval = IRQ_NONE; ++ + if ((intr_status & UIC_COMMAND_COMPL) && hba->active_uic_cmd) { + hba->active_uic_cmd->argument2 |= + ufshcd_get_uic_cmd_result(hba); + hba->active_uic_cmd->argument3 = + ufshcd_get_dme_attr_val(hba); + complete(&hba->active_uic_cmd->done); ++ retval = IRQ_HANDLED; + } + +- if ((intr_status & UFSHCD_UIC_PWR_MASK) && hba->uic_async_done) ++ if ((intr_status & UFSHCD_UIC_PWR_MASK) && hba->uic_async_done) { + complete(hba->uic_async_done); ++ retval = IRQ_HANDLED; ++ } ++ return retval; + } + + /** +@@ -4853,7 +4800,6 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, + cmd->result = result; + /* Mark completed command as NULL in LRB */ + lrbp->cmd = NULL; +- clear_bit_unlock(index, &hba->lrb_in_use); + /* Do not touch lrbp after scsi done */ + cmd->scsi_done(cmd); + __ufshcd_release(hba); +@@ -4875,16 +4821,17 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, + hba->outstanding_reqs ^= completed_reqs; + + ufshcd_clk_scaling_update_busy(hba); +- +- /* we might have free'd some tags above */ +- wake_up(&hba->dev_cmd.tag_wq); + } + + /** + * ufshcd_transfer_req_compl - handle SCSI and query command completion + * @hba: per adapter instance ++ * ++ * Returns ++ * IRQ_HANDLED - If interrupt is valid ++ * IRQ_NONE - If invalid interrupt + */ +-static void ufshcd_transfer_req_compl(struct ufs_hba *hba) ++static irqreturn_t ufshcd_transfer_req_compl(struct ufs_hba *hba) + { + unsigned long completed_reqs; + u32 tr_doorbell; +@@ -4903,7 +4850,12 @@ static void ufshcd_transfer_req_compl(struct ufs_hba *hba) + tr_doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL); + completed_reqs = tr_doorbell ^ hba->outstanding_reqs; + +- __ufshcd_transfer_req_compl(hba, completed_reqs); ++ if (completed_reqs) { ++ __ufshcd_transfer_req_compl(hba, completed_reqs); ++ return IRQ_HANDLED; ++ } else { ++ return IRQ_NONE; ++ } + } + + /** +@@ -5424,61 +5376,77 @@ out: + /** + * ufshcd_update_uic_error - check and set fatal UIC error flags. + * @hba: per-adapter instance ++ * ++ * Returns ++ * IRQ_HANDLED - If interrupt is valid ++ * IRQ_NONE - If invalid interrupt + */ +-static void ufshcd_update_uic_error(struct ufs_hba *hba) ++static irqreturn_t ufshcd_update_uic_error(struct ufs_hba *hba) + { + u32 reg; ++ irqreturn_t retval = IRQ_NONE; + + /* PHY layer lane error */ + reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_PHY_ADAPTER_LAYER); + /* Ignore LINERESET indication, as this is not an error */ + if ((reg & UIC_PHY_ADAPTER_LAYER_ERROR) && +- (reg & UIC_PHY_ADAPTER_LAYER_LANE_ERR_MASK)) { ++ (reg & UIC_PHY_ADAPTER_LAYER_LANE_ERR_MASK)) { + /* + * To know whether this error is fatal or not, DB timeout + * must be checked but this error is handled separately. + */ + dev_dbg(hba->dev, "%s: UIC Lane error reported\n", __func__); + ufshcd_update_reg_hist(&hba->ufs_stats.pa_err, reg); ++ retval |= IRQ_HANDLED; + } + + /* PA_INIT_ERROR is fatal and needs UIC reset */ + reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_DATA_LINK_LAYER); +- if (reg) ++ if ((reg & UIC_DATA_LINK_LAYER_ERROR) && ++ (reg & UIC_DATA_LINK_LAYER_ERROR_CODE_MASK)) { + ufshcd_update_reg_hist(&hba->ufs_stats.dl_err, reg); + +- if (reg & UIC_DATA_LINK_LAYER_ERROR_PA_INIT) +- hba->uic_error |= UFSHCD_UIC_DL_PA_INIT_ERROR; +- else if (hba->dev_quirks & +- UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS) { +- if (reg & UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED) +- hba->uic_error |= +- UFSHCD_UIC_DL_NAC_RECEIVED_ERROR; +- else if (reg & UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT) +- hba->uic_error |= UFSHCD_UIC_DL_TCx_REPLAY_ERROR; ++ if (reg & UIC_DATA_LINK_LAYER_ERROR_PA_INIT) ++ hba->uic_error |= UFSHCD_UIC_DL_PA_INIT_ERROR; ++ else if (hba->dev_quirks & ++ UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS) { ++ if (reg & UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED) ++ hba->uic_error |= ++ UFSHCD_UIC_DL_NAC_RECEIVED_ERROR; ++ else if (reg & UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT) ++ hba->uic_error |= UFSHCD_UIC_DL_TCx_REPLAY_ERROR; ++ } ++ retval |= IRQ_HANDLED; + } + + /* UIC NL/TL/DME errors needs software retry */ + reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_NETWORK_LAYER); +- if (reg) { ++ if ((reg & UIC_NETWORK_LAYER_ERROR) && ++ (reg & UIC_NETWORK_LAYER_ERROR_CODE_MASK)) { + ufshcd_update_reg_hist(&hba->ufs_stats.nl_err, reg); + hba->uic_error |= UFSHCD_UIC_NL_ERROR; ++ retval |= IRQ_HANDLED; + } + + reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_TRANSPORT_LAYER); +- if (reg) { ++ if ((reg & UIC_TRANSPORT_LAYER_ERROR) && ++ (reg & UIC_TRANSPORT_LAYER_ERROR_CODE_MASK)) { + ufshcd_update_reg_hist(&hba->ufs_stats.tl_err, reg); + hba->uic_error |= UFSHCD_UIC_TL_ERROR; ++ retval |= IRQ_HANDLED; + } + + reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_DME); +- if (reg) { ++ if ((reg & UIC_DME_ERROR) && ++ (reg & UIC_DME_ERROR_CODE_MASK)) { + ufshcd_update_reg_hist(&hba->ufs_stats.dme_err, reg); + hba->uic_error |= UFSHCD_UIC_DME_ERROR; ++ retval |= IRQ_HANDLED; + } + + dev_dbg(hba->dev, "%s: UIC error flags = 0x%08x\n", + __func__, hba->uic_error); ++ return retval; + } + + static bool ufshcd_is_auto_hibern8_error(struct ufs_hba *hba, +@@ -5502,10 +5470,15 @@ static bool ufshcd_is_auto_hibern8_error(struct ufs_hba *hba, + /** + * ufshcd_check_errors - Check for errors that need s/w attention + * @hba: per-adapter instance ++ * ++ * Returns ++ * IRQ_HANDLED - If interrupt is valid ++ * IRQ_NONE - If invalid interrupt + */ +-static void ufshcd_check_errors(struct ufs_hba *hba) ++static irqreturn_t ufshcd_check_errors(struct ufs_hba *hba) + { + bool queue_eh_work = false; ++ irqreturn_t retval = IRQ_NONE; + + if (hba->errors & INT_FATAL_ERRORS) { + ufshcd_update_reg_hist(&hba->ufs_stats.fatal_err, hba->errors); +@@ -5514,7 +5487,7 @@ static void ufshcd_check_errors(struct ufs_hba *hba) + + if (hba->errors & UIC_ERROR) { + hba->uic_error = 0; +- ufshcd_update_uic_error(hba); ++ retval = ufshcd_update_uic_error(hba); + if (hba->uic_error) + queue_eh_work = true; + } +@@ -5562,6 +5535,7 @@ static void ufshcd_check_errors(struct ufs_hba *hba) + } + schedule_work(&hba->eh_work); + } ++ retval |= IRQ_HANDLED; + } + /* + * if (!queue_eh_work) - +@@ -5569,44 +5543,81 @@ static void ufshcd_check_errors(struct ufs_hba *hba) + * itself without s/w intervention or errors that will be + * handled by the SCSI core layer. + */ ++ return retval; ++} ++ ++struct ctm_info { ++ struct ufs_hba *hba; ++ unsigned long pending; ++ unsigned int ncpl; ++}; ++ ++static bool ufshcd_compl_tm(struct request *req, void *priv, bool reserved) ++{ ++ struct ctm_info *const ci = priv; ++ struct completion *c; ++ ++ WARN_ON_ONCE(reserved); ++ if (test_bit(req->tag, &ci->pending)) ++ return true; ++ ci->ncpl++; ++ c = req->end_io_data; ++ if (c) ++ complete(c); ++ return true; + } + + /** + * ufshcd_tmc_handler - handle task management function completion + * @hba: per adapter instance ++ * ++ * Returns ++ * IRQ_HANDLED - If interrupt is valid ++ * IRQ_NONE - If invalid interrupt + */ +-static void ufshcd_tmc_handler(struct ufs_hba *hba) ++static irqreturn_t ufshcd_tmc_handler(struct ufs_hba *hba) + { +- u32 tm_doorbell; ++ struct request_queue *q = hba->tmf_queue; ++ struct ctm_info ci = { ++ .hba = hba, ++ .pending = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL), ++ }; + +- tm_doorbell = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL); +- hba->tm_condition = tm_doorbell ^ hba->outstanding_tasks; +- wake_up(&hba->tm_wq); ++ blk_mq_tagset_busy_iter(q->tag_set, ufshcd_compl_tm, &ci); ++ return ci.ncpl ? IRQ_HANDLED : IRQ_NONE; + } + + /** + * ufshcd_sl_intr - Interrupt service routine + * @hba: per adapter instance + * @intr_status: contains interrupts generated by the controller ++ * ++ * Returns ++ * IRQ_HANDLED - If interrupt is valid ++ * IRQ_NONE - If invalid interrupt + */ +-static void ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status) ++static irqreturn_t ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status) + { ++ irqreturn_t retval = IRQ_NONE; ++ + hba->errors = UFSHCD_ERROR_MASK & intr_status; + + if (ufshcd_is_auto_hibern8_error(hba, intr_status)) + hba->errors |= (UFSHCD_UIC_HIBERN8_MASK & intr_status); + + if (hba->errors) +- ufshcd_check_errors(hba); ++ retval |= ufshcd_check_errors(hba); + + if (intr_status & UFSHCD_UIC_MASK) +- ufshcd_uic_cmd_compl(hba, intr_status); ++ retval |= ufshcd_uic_cmd_compl(hba, intr_status); + + if (intr_status & UTP_TASK_REQ_COMPL) +- ufshcd_tmc_handler(hba); ++ retval |= ufshcd_tmc_handler(hba); + + if (intr_status & UTP_TRANSFER_REQ_COMPL) +- ufshcd_transfer_req_compl(hba); ++ retval |= ufshcd_transfer_req_compl(hba); ++ ++ return retval; + } + + /** +@@ -5614,8 +5625,9 @@ static void ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status) + * @irq: irq number + * @__hba: pointer to adapter instance + * +- * Returns IRQ_HANDLED - If interrupt is valid +- * IRQ_NONE - If invalid interrupt ++ * Returns ++ * IRQ_HANDLED - If interrupt is valid ++ * IRQ_NONE - If invalid interrupt + */ + static irqreturn_t ufshcd_intr(int irq, void *__hba) + { +@@ -5638,14 +5650,18 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba) + intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE); + if (intr_status) + ufshcd_writel(hba, intr_status, REG_INTERRUPT_STATUS); +- if (enabled_intr_status) { +- ufshcd_sl_intr(hba, enabled_intr_status); +- retval = IRQ_HANDLED; +- } ++ if (enabled_intr_status) ++ retval |= ufshcd_sl_intr(hba, enabled_intr_status); + + intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); + } + ++ if (retval == IRQ_NONE) { ++ dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n", ++ __func__, intr_status); ++ ufshcd_dump_regs(hba, 0, UFSHCI_REG_SPACE_SIZE, "host_regs: "); ++ } ++ + spin_unlock(hba->host->host_lock); + return retval; + } +@@ -5674,33 +5690,36 @@ out: + static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba, + struct utp_task_req_desc *treq, u8 tm_function) + { ++ struct request_queue *q = hba->tmf_queue; + struct Scsi_Host *host = hba->host; ++ DECLARE_COMPLETION_ONSTACK(wait); ++ struct request *req; + unsigned long flags; +- int free_slot, task_tag, err; ++ int task_tag, err; + + /* +- * Get free slot, sleep if slots are unavailable. +- * Even though we use wait_event() which sleeps indefinitely, +- * the maximum wait time is bounded by %TM_CMD_TIMEOUT. ++ * blk_get_request() is used here only to get a free tag. + */ +- wait_event(hba->tm_tag_wq, ufshcd_get_tm_free_slot(hba, &free_slot)); ++ req = blk_get_request(q, REQ_OP_DRV_OUT, BLK_MQ_REQ_RESERVED); ++ req->end_io_data = &wait; + ufshcd_hold(hba, false); + + spin_lock_irqsave(host->host_lock, flags); +- task_tag = hba->nutrs + free_slot; ++ blk_mq_start_request(req); + ++ task_tag = req->tag; + treq->req_header.dword_0 |= cpu_to_be32(task_tag); + +- memcpy(hba->utmrdl_base_addr + free_slot, treq, sizeof(*treq)); +- ufshcd_vops_setup_task_mgmt(hba, free_slot, tm_function); ++ memcpy(hba->utmrdl_base_addr + task_tag, treq, sizeof(*treq)); ++ ufshcd_vops_setup_task_mgmt(hba, task_tag, tm_function); + + /* send command to the controller */ +- __set_bit(free_slot, &hba->outstanding_tasks); ++ __set_bit(task_tag, &hba->outstanding_tasks); + + /* Make sure descriptors are ready before ringing the task doorbell */ + wmb(); + +- ufshcd_writel(hba, 1 << free_slot, REG_UTP_TASK_REQ_DOOR_BELL); ++ ufshcd_writel(hba, 1 << task_tag, REG_UTP_TASK_REQ_DOOR_BELL); + /* Make sure that doorbell is committed immediately */ + wmb(); + +@@ -5709,33 +5728,35 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba, + ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_send"); + + /* wait until the task management command is completed */ +- err = wait_event_timeout(hba->tm_wq, +- test_bit(free_slot, &hba->tm_condition), ++ err = wait_for_completion_io_timeout(&wait, + msecs_to_jiffies(TM_CMD_TIMEOUT)); + if (!err) { ++ /* ++ * Make sure that ufshcd_compl_tm() does not trigger a ++ * use-after-free. ++ */ ++ req->end_io_data = NULL; + ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_complete_err"); + dev_err(hba->dev, "%s: task management cmd 0x%.2x timed-out\n", + __func__, tm_function); +- if (ufshcd_clear_tm_cmd(hba, free_slot)) +- dev_WARN(hba->dev, "%s: unable clear tm cmd (slot %d) after timeout\n", +- __func__, free_slot); ++ if (ufshcd_clear_tm_cmd(hba, task_tag)) ++ dev_WARN(hba->dev, "%s: unable to clear tm cmd (slot %d) after timeout\n", ++ __func__, task_tag); + err = -ETIMEDOUT; + } else { + err = 0; +- memcpy(treq, hba->utmrdl_base_addr + free_slot, sizeof(*treq)); ++ memcpy(treq, hba->utmrdl_base_addr + task_tag, sizeof(*treq)); + + ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_complete"); + } + + spin_lock_irqsave(hba->host->host_lock, flags); +- __clear_bit(free_slot, &hba->outstanding_tasks); ++ __clear_bit(task_tag, &hba->outstanding_tasks); + spin_unlock_irqrestore(hba->host->host_lock, flags); + +- clear_bit(free_slot, &hba->tm_condition); +- ufshcd_put_tm_slot(hba, free_slot); +- wake_up(&hba->tm_tag_wq); +- + ufshcd_release(hba); ++ blk_put_request(req); ++ + return err; + } + +@@ -5809,6 +5830,8 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, + int cmd_type, + enum query_opcode desc_op) + { ++ struct request_queue *q = hba->cmd_queue; ++ struct request *req; + struct ufshcd_lrb *lrbp; + int err = 0; + int tag; +@@ -5818,7 +5841,11 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, + + down_read(&hba->clk_scaling_lock); + +- wait_event(hba->dev_cmd.tag_wq, ufshcd_get_dev_cmd_tag(hba, &tag)); ++ req = blk_get_request(q, REQ_OP_DRV_OUT, 0); ++ if (IS_ERR(req)) ++ return PTR_ERR(req); ++ tag = req->tag; ++ WARN_ON_ONCE(!ufshcd_valid_tag(hba, tag)); + + init_completion(&wait); + lrbp = &hba->lrb[tag]; +@@ -5892,8 +5919,7 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, + } + } + +- ufshcd_put_dev_cmd_tag(hba, tag); +- wake_up(&hba->dev_cmd.tag_wq); ++ blk_put_request(req); + up_read(&hba->clk_scaling_lock); + return err; + } +@@ -6186,9 +6212,6 @@ cleanup: + hba->lrb[tag].cmd = NULL; + spin_unlock_irqrestore(host->host_lock, flags); + +- clear_bit_unlock(tag, &hba->lrb_in_use); +- wake_up(&hba->dev_cmd.tag_wq); +- + out: + if (!err) { + err = SUCCESS; +@@ -8184,6 +8207,9 @@ void ufshcd_remove(struct ufs_hba *hba) + { + ufs_bsg_remove(hba); + ufs_sysfs_remove_nodes(hba->dev); ++ blk_cleanup_queue(hba->tmf_queue); ++ blk_mq_free_tag_set(&hba->tmf_tag_set); ++ blk_cleanup_queue(hba->cmd_queue); + scsi_remove_host(hba->host); + /* disable interrupts */ + ufshcd_disable_intr(hba, hba->intr_mask); +@@ -8262,6 +8288,18 @@ out_error: + } + EXPORT_SYMBOL(ufshcd_alloc_host); + ++/* This function exists because blk_mq_alloc_tag_set() requires this. */ ++static blk_status_t ufshcd_queue_tmf(struct blk_mq_hw_ctx *hctx, ++ const struct blk_mq_queue_data *qd) ++{ ++ WARN_ON_ONCE(true); ++ return BLK_STS_NOTSUPP; ++} ++ ++static const struct blk_mq_ops ufshcd_tmf_ops = { ++ .queue_rq = ufshcd_queue_tmf, ++}; ++ + /** + * ufshcd_init - Driver initialization routine + * @hba: per-adapter instance +@@ -8331,10 +8369,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) + + hba->max_pwr_info.is_valid = false; + +- /* Initailize wait queue for task management */ +- init_waitqueue_head(&hba->tm_wq); +- init_waitqueue_head(&hba->tm_tag_wq); +- + /* Initialize work queues */ + INIT_WORK(&hba->eh_work, ufshcd_err_handler); + INIT_WORK(&hba->eeh_work, ufshcd_exception_event_handler); +@@ -8347,9 +8381,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) + + init_rwsem(&hba->clk_scaling_lock); + +- /* Initialize device management tag acquire wait queue */ +- init_waitqueue_head(&hba->dev_cmd.tag_wq); +- + ufshcd_init_clk_gating(hba); + + ufshcd_init_clk_scaling(hba); +@@ -8383,6 +8414,27 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) + goto exit_gating; + } + ++ hba->cmd_queue = blk_mq_init_queue(&hba->host->tag_set); ++ if (IS_ERR(hba->cmd_queue)) { ++ err = PTR_ERR(hba->cmd_queue); ++ goto out_remove_scsi_host; ++ } ++ ++ hba->tmf_tag_set = (struct blk_mq_tag_set) { ++ .nr_hw_queues = 1, ++ .queue_depth = hba->nutmrs, ++ .ops = &ufshcd_tmf_ops, ++ .flags = BLK_MQ_F_NO_SCHED, ++ }; ++ err = blk_mq_alloc_tag_set(&hba->tmf_tag_set); ++ if (err < 0) ++ goto free_cmd_queue; ++ hba->tmf_queue = blk_mq_init_queue(&hba->tmf_tag_set); ++ if (IS_ERR(hba->tmf_queue)) { ++ err = PTR_ERR(hba->tmf_queue); ++ goto free_tmf_tag_set; ++ } ++ + /* Reset the attached device */ + ufshcd_vops_device_reset(hba); + +@@ -8392,7 +8444,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) + dev_err(hba->dev, "Host controller enable failed\n"); + ufshcd_print_host_regs(hba); + ufshcd_print_host_state(hba); +- goto out_remove_scsi_host; ++ goto free_tmf_queue; + } + + /* +@@ -8429,6 +8481,12 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) + + return 0; + ++free_tmf_queue: ++ blk_cleanup_queue(hba->tmf_queue); ++free_tmf_tag_set: ++ blk_mq_free_tag_set(&hba->tmf_tag_set); ++free_cmd_queue: ++ blk_cleanup_queue(hba->cmd_queue); + out_remove_scsi_host: + scsi_remove_host(hba->host); + exit_gating: +diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h +index 4f1dec68a853f..92ef6e6a3e511 100644 +--- a/drivers/scsi/ufs/ufshcd.h ++++ b/drivers/scsi/ufs/ufshcd.h +@@ -213,13 +213,11 @@ struct ufs_query { + * @type: device management command type - Query, NOP OUT + * @lock: lock to allow one command at a time + * @complete: internal commands completion +- * @tag_wq: wait queue until free command slot is available + */ + struct ufs_dev_cmd { + enum dev_cmd_type type; + struct mutex lock; + struct completion *complete; +- wait_queue_head_t tag_wq; + struct ufs_query query; + }; + +@@ -484,7 +482,7 @@ struct ufs_stats { + * @host: Scsi_Host instance of the driver + * @dev: device handle + * @lrb: local reference block +- * @lrb_in_use: lrb in use ++ * @cmd_queue: Used to allocate command tags from hba->host->tag_set. + * @outstanding_tasks: Bits representing outstanding task requests + * @outstanding_reqs: Bits representing outstanding transfer requests + * @capabilities: UFS Controller Capabilities +@@ -496,11 +494,9 @@ struct ufs_stats { + * @irq: Irq number of the controller + * @active_uic_cmd: handle of active UIC command + * @uic_cmd_mutex: mutex for uic command +- * @tm_wq: wait queue for task management +- * @tm_tag_wq: wait queue for free task management slots +- * @tm_slots_in_use: bit map of task management request slots in use ++ * @tmf_tag_set: TMF tag set. ++ * @tmf_queue: Used to allocate TMF tags. + * @pwr_done: completion for power mode change +- * @tm_condition: condition variable for task management + * @ufshcd_state: UFSHCD states + * @eh_flags: Error handling flags + * @intr_mask: Interrupt Mask Bits +@@ -543,6 +539,7 @@ struct ufs_hba { + + struct Scsi_Host *host; + struct device *dev; ++ struct request_queue *cmd_queue; + /* + * This field is to keep a reference to "scsi_device" corresponding to + * "UFS device" W-LU. +@@ -563,7 +560,6 @@ struct ufs_hba { + u32 ahit; + + struct ufshcd_lrb *lrb; +- unsigned long lrb_in_use; + + unsigned long outstanding_tasks; + unsigned long outstanding_reqs; +@@ -645,10 +641,8 @@ struct ufs_hba { + /* Device deviations from standard UFS device spec. */ + unsigned int dev_quirks; + +- wait_queue_head_t tm_wq; +- wait_queue_head_t tm_tag_wq; +- unsigned long tm_condition; +- unsigned long tm_slots_in_use; ++ struct blk_mq_tag_set tmf_tag_set; ++ struct request_queue *tmf_queue; + + struct uic_command *active_uic_cmd; + struct mutex uic_cmd_mutex; +diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h +index dbb75cd28dc8a..c2961d37cc1cf 100644 +--- a/drivers/scsi/ufs/ufshci.h ++++ b/drivers/scsi/ufs/ufshci.h +@@ -195,7 +195,7 @@ enum { + + /* UECDL - Host UIC Error Code Data Link Layer 3Ch */ + #define UIC_DATA_LINK_LAYER_ERROR 0x80000000 +-#define UIC_DATA_LINK_LAYER_ERROR_CODE_MASK 0x7FFF ++#define UIC_DATA_LINK_LAYER_ERROR_CODE_MASK 0xFFFF + #define UIC_DATA_LINK_LAYER_ERROR_TCX_REP_TIMER_EXP 0x2 + #define UIC_DATA_LINK_LAYER_ERROR_AFCX_REQ_TIMER_EXP 0x4 + #define UIC_DATA_LINK_LAYER_ERROR_FCX_PRO_TIMER_EXP 0x8 +diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c +index bf68d86d80ee5..95f9e48052452 100644 +--- a/drivers/soc/fsl/qbman/qman.c ++++ b/drivers/soc/fsl/qbman/qman.c +@@ -186,7 +186,7 @@ struct qm_eqcr_entry { + __be32 tag; + struct qm_fd fd; + u8 __reserved3[32]; +-} __packed; ++} __packed __aligned(8); + #define QM_EQCR_VERB_VBIT 0x80 + #define QM_EQCR_VERB_CMD_MASK 0x61 /* but only one value; */ + #define QM_EQCR_VERB_CMD_ENQUEUE 0x01 +diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c +index 8f1de1fbbeedf..d8d3892e5a69a 100644 +--- a/drivers/usb/usbip/stub_dev.c ++++ b/drivers/usb/usbip/stub_dev.c +@@ -63,6 +63,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a + + dev_info(dev, "stub up\n"); + ++ mutex_lock(&sdev->ud.sysfs_lock); + spin_lock_irq(&sdev->ud.lock); + + if (sdev->ud.status != SDEV_ST_AVAILABLE) { +@@ -87,13 +88,13 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a + tcp_rx = kthread_create(stub_rx_loop, &sdev->ud, "stub_rx"); + if (IS_ERR(tcp_rx)) { + sockfd_put(socket); +- return -EINVAL; ++ goto unlock_mutex; + } + tcp_tx = kthread_create(stub_tx_loop, &sdev->ud, "stub_tx"); + if (IS_ERR(tcp_tx)) { + kthread_stop(tcp_rx); + sockfd_put(socket); +- return -EINVAL; ++ goto unlock_mutex; + } + + /* get task structs now */ +@@ -112,6 +113,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a + wake_up_process(sdev->ud.tcp_rx); + wake_up_process(sdev->ud.tcp_tx); + ++ mutex_unlock(&sdev->ud.sysfs_lock); ++ + } else { + dev_info(dev, "stub down\n"); + +@@ -122,6 +125,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a + spin_unlock_irq(&sdev->ud.lock); + + usbip_event_add(&sdev->ud, SDEV_EVENT_DOWN); ++ mutex_unlock(&sdev->ud.sysfs_lock); + } + + return count; +@@ -130,6 +134,8 @@ sock_err: + sockfd_put(socket); + err: + spin_unlock_irq(&sdev->ud.lock); ++unlock_mutex: ++ mutex_unlock(&sdev->ud.sysfs_lock); + return -EINVAL; + } + static DEVICE_ATTR_WO(usbip_sockfd); +@@ -270,6 +276,7 @@ static struct stub_device *stub_device_alloc(struct usb_device *udev) + sdev->ud.side = USBIP_STUB; + sdev->ud.status = SDEV_ST_AVAILABLE; + spin_lock_init(&sdev->ud.lock); ++ mutex_init(&sdev->ud.sysfs_lock); + sdev->ud.tcp_socket = NULL; + sdev->ud.sockfd = -1; + +diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h +index 8be857a4fa132..a7e6ce96f62c7 100644 +--- a/drivers/usb/usbip/usbip_common.h ++++ b/drivers/usb/usbip/usbip_common.h +@@ -263,6 +263,9 @@ struct usbip_device { + /* lock for status */ + spinlock_t lock; + ++ /* mutex for synchronizing sysfs store paths */ ++ struct mutex sysfs_lock; ++ + int sockfd; + struct socket *tcp_socket; + +diff --git a/drivers/usb/usbip/usbip_event.c b/drivers/usb/usbip/usbip_event.c +index 5d88917c96314..086ca76dd0531 100644 +--- a/drivers/usb/usbip/usbip_event.c ++++ b/drivers/usb/usbip/usbip_event.c +@@ -70,6 +70,7 @@ static void event_handler(struct work_struct *work) + while ((ud = get_event()) != NULL) { + usbip_dbg_eh("pending event %lx\n", ud->event); + ++ mutex_lock(&ud->sysfs_lock); + /* + * NOTE: shutdown must come first. + * Shutdown the device. +@@ -90,6 +91,7 @@ static void event_handler(struct work_struct *work) + ud->eh_ops.unusable(ud); + unset_event(ud, USBIP_EH_UNUSABLE); + } ++ mutex_unlock(&ud->sysfs_lock); + + wake_up(&ud->eh_waitq); + } +diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c +index 1e0b618e2e6ec..98636fbf71882 100644 +--- a/drivers/usb/usbip/vhci_hcd.c ++++ b/drivers/usb/usbip/vhci_hcd.c +@@ -1096,6 +1096,7 @@ static void vhci_device_init(struct vhci_device *vdev) + vdev->ud.side = USBIP_VHCI; + vdev->ud.status = VDEV_ST_NULL; + spin_lock_init(&vdev->ud.lock); ++ mutex_init(&vdev->ud.sysfs_lock); + + INIT_LIST_HEAD(&vdev->priv_rx); + INIT_LIST_HEAD(&vdev->priv_tx); +diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c +index e64ea314930be..ebc7be1d98207 100644 +--- a/drivers/usb/usbip/vhci_sysfs.c ++++ b/drivers/usb/usbip/vhci_sysfs.c +@@ -185,6 +185,8 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport) + + usbip_dbg_vhci_sysfs("enter\n"); + ++ mutex_lock(&vdev->ud.sysfs_lock); ++ + /* lock */ + spin_lock_irqsave(&vhci->lock, flags); + spin_lock(&vdev->ud.lock); +@@ -195,6 +197,7 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport) + /* unlock */ + spin_unlock(&vdev->ud.lock); + spin_unlock_irqrestore(&vhci->lock, flags); ++ mutex_unlock(&vdev->ud.sysfs_lock); + + return -EINVAL; + } +@@ -205,6 +208,8 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport) + + usbip_event_add(&vdev->ud, VDEV_EVENT_DOWN); + ++ mutex_unlock(&vdev->ud.sysfs_lock); ++ + return 0; + } + +@@ -349,30 +354,36 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, + else + vdev = &vhci->vhci_hcd_hs->vdev[rhport]; + ++ mutex_lock(&vdev->ud.sysfs_lock); ++ + /* Extract socket from fd. */ + socket = sockfd_lookup(sockfd, &err); + if (!socket) { + dev_err(dev, "failed to lookup sock"); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + if (socket->type != SOCK_STREAM) { + dev_err(dev, "Expecting SOCK_STREAM - found %d", + socket->type); + sockfd_put(socket); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + + /* create threads before locking */ + tcp_rx = kthread_create(vhci_rx_loop, &vdev->ud, "vhci_rx"); + if (IS_ERR(tcp_rx)) { + sockfd_put(socket); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + tcp_tx = kthread_create(vhci_tx_loop, &vdev->ud, "vhci_tx"); + if (IS_ERR(tcp_tx)) { + kthread_stop(tcp_rx); + sockfd_put(socket); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + + /* get task structs now */ +@@ -397,7 +408,8 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, + * Will be retried from userspace + * if there's another free port. + */ +- return -EBUSY; ++ err = -EBUSY; ++ goto unlock_mutex; + } + + dev_info(dev, "pdev(%u) rhport(%u) sockfd(%d)\n", +@@ -422,7 +434,15 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, + + rh_port_connect(vdev, speed); + ++ dev_info(dev, "Device attached\n"); ++ ++ mutex_unlock(&vdev->ud.sysfs_lock); ++ + return count; ++ ++unlock_mutex: ++ mutex_unlock(&vdev->ud.sysfs_lock); ++ return err; + } + static DEVICE_ATTR_WO(attach); + +diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c +index c8eeabdd9b568..2bc428f2e2610 100644 +--- a/drivers/usb/usbip/vudc_dev.c ++++ b/drivers/usb/usbip/vudc_dev.c +@@ -572,6 +572,7 @@ static int init_vudc_hw(struct vudc *udc) + init_waitqueue_head(&udc->tx_waitq); + + spin_lock_init(&ud->lock); ++ mutex_init(&ud->sysfs_lock); + ud->status = SDEV_ST_AVAILABLE; + ud->side = USBIP_VUDC; + +diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c +index 7383a543c6d12..f7633ee655a17 100644 +--- a/drivers/usb/usbip/vudc_sysfs.c ++++ b/drivers/usb/usbip/vudc_sysfs.c +@@ -112,6 +112,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, + dev_err(dev, "no device"); + return -ENODEV; + } ++ mutex_lock(&udc->ud.sysfs_lock); + spin_lock_irqsave(&udc->lock, flags); + /* Don't export what we don't have */ + if (!udc->driver || !udc->pullup) { +@@ -187,6 +188,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, + + wake_up_process(udc->ud.tcp_rx); + wake_up_process(udc->ud.tcp_tx); ++ ++ mutex_unlock(&udc->ud.sysfs_lock); + return count; + + } else { +@@ -207,6 +210,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, + } + + spin_unlock_irqrestore(&udc->lock, flags); ++ mutex_unlock(&udc->ud.sysfs_lock); + + return count; + +@@ -216,6 +220,7 @@ unlock_ud: + spin_unlock_irq(&udc->ud.lock); + unlock: + spin_unlock_irqrestore(&udc->lock, flags); ++ mutex_unlock(&udc->ud.sysfs_lock); + + return ret; + } +diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c +index e492f5fe5be62..883abc46da6e2 100644 +--- a/drivers/xen/events/events_base.c ++++ b/drivers/xen/events/events_base.c +@@ -222,7 +222,7 @@ static int xen_irq_info_common_setup(struct irq_info *info, + info->evtchn = evtchn; + info->cpu = cpu; + info->mask_reason = EVT_MASK_REASON_EXPLICIT; +- spin_lock_init(&info->lock); ++ raw_spin_lock_init(&info->lock); + + ret = set_evtchn_to_irq(evtchn, irq); + if (ret < 0) +@@ -374,28 +374,28 @@ static void do_mask(struct irq_info *info, u8 reason) + { + unsigned long flags; + +- spin_lock_irqsave(&info->lock, flags); ++ raw_spin_lock_irqsave(&info->lock, flags); + + if (!info->mask_reason) + mask_evtchn(info->evtchn); + + info->mask_reason |= reason; + +- spin_unlock_irqrestore(&info->lock, flags); ++ raw_spin_unlock_irqrestore(&info->lock, flags); + } + + static void do_unmask(struct irq_info *info, u8 reason) + { + unsigned long flags; + +- spin_lock_irqsave(&info->lock, flags); ++ raw_spin_lock_irqsave(&info->lock, flags); + + info->mask_reason &= ~reason; + + if (!info->mask_reason) + unmask_evtchn(info->evtchn); + +- spin_unlock_irqrestore(&info->lock, flags); ++ raw_spin_unlock_irqrestore(&info->lock, flags); + } + + #ifdef CONFIG_X86 +diff --git a/drivers/xen/events/events_internal.h b/drivers/xen/events/events_internal.h +index d3a89b4646b8b..eb012fbb62e7b 100644 +--- a/drivers/xen/events/events_internal.h ++++ b/drivers/xen/events/events_internal.h +@@ -45,7 +45,7 @@ struct irq_info { + unsigned short eoi_cpu; /* EOI must happen on this cpu */ + unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */ + u64 eoi_time; /* Time in jiffies when to EOI. */ +- spinlock_t lock; ++ raw_spinlock_t lock; + + union { + unsigned short virq; +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c +index 67c2e6487479a..ab9eeb5ff8e57 100644 +--- a/fs/cifs/connect.c ++++ b/fs/cifs/connect.c +@@ -4198,7 +4198,6 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, + cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL); + if (cifs_sb->prepath == NULL) + return -ENOMEM; +- cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH; + } + + return 0; +diff --git a/fs/direct-io.c b/fs/direct-io.c +index 9329ced91f1d8..434cffcc0391f 100644 +--- a/fs/direct-io.c ++++ b/fs/direct-io.c +@@ -848,6 +848,7 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page, + struct buffer_head *map_bh) + { + int ret = 0; ++ int boundary = sdio->boundary; /* dio_send_cur_page may clear it */ + + if (dio->op == REQ_OP_WRITE) { + /* +@@ -886,10 +887,10 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page, + sdio->cur_page_fs_offset = sdio->block_in_file << sdio->blkbits; + out: + /* +- * If sdio->boundary then we want to schedule the IO now to ++ * If boundary then we want to schedule the IO now to + * avoid metadata seeks. + */ +- if (sdio->boundary) { ++ if (boundary) { + ret = dio_send_cur_page(dio, sdio, map_bh); + if (sdio->bio) + dio_bio_submit(dio, sdio); +diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c +index 5a7eb0c79839e..58a972667bf8e 100644 +--- a/fs/hostfs/hostfs_kern.c ++++ b/fs/hostfs/hostfs_kern.c +@@ -139,10 +139,10 @@ static char *inode_name(struct inode *ino) + + static char *follow_link(char *link) + { +- int len, n; + char *name, *resolved, *end; ++ int n; + +- name = __getname(); ++ name = kmalloc(PATH_MAX, GFP_KERNEL); + if (!name) { + n = -ENOMEM; + goto out_free; +@@ -164,21 +164,18 @@ static char *follow_link(char *link) + return name; + + *(end + 1) = '\0'; +- len = strlen(link) + strlen(name) + 1; + +- resolved = kmalloc(len, GFP_KERNEL); ++ resolved = kasprintf(GFP_KERNEL, "%s%s", link, name); + if (resolved == NULL) { + n = -ENOMEM; + goto out_free; + } + +- sprintf(resolved, "%s%s", link, name); +- __putname(name); +- kfree(link); ++ kfree(name); + return resolved; + + out_free: +- __putname(name); ++ kfree(name); + return ERR_PTR(n); + } + +@@ -918,18 +915,16 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) + sb->s_d_op = &simple_dentry_operations; + sb->s_maxbytes = MAX_LFS_FILESIZE; + +- /* NULL is printed as by sprintf: avoid that. */ ++ /* NULL is printed as '(null)' by printf(): avoid that. */ + if (req_root == NULL) + req_root = ""; + + err = -ENOMEM; + sb->s_fs_info = host_root_path = +- kmalloc(strlen(root_ino) + strlen(req_root) + 2, GFP_KERNEL); ++ kasprintf(GFP_KERNEL, "%s/%s", root_ino, req_root); + if (host_root_path == NULL) + goto out; + +- sprintf(host_root_path, "%s/%s", root_ino, req_root); +- + root_inode = new_inode(sb); + if (!root_inode) + goto out; +diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c +index 9cd0a68159337..7f66e33424750 100644 +--- a/fs/ocfs2/aops.c ++++ b/fs/ocfs2/aops.c +@@ -2304,7 +2304,7 @@ static int ocfs2_dio_end_io_write(struct inode *inode, + struct ocfs2_alloc_context *meta_ac = NULL; + handle_t *handle = NULL; + loff_t end = offset + bytes; +- int ret = 0, credits = 0, locked = 0; ++ int ret = 0, credits = 0; + + ocfs2_init_dealloc_ctxt(&dealloc); + +@@ -2315,13 +2315,6 @@ static int ocfs2_dio_end_io_write(struct inode *inode, + !dwc->dw_orphaned) + goto out; + +- /* ocfs2_file_write_iter will get i_mutex, so we need not lock if we +- * are in that context. */ +- if (dwc->dw_writer_pid != task_pid_nr(current)) { +- inode_lock(inode); +- locked = 1; +- } +- + ret = ocfs2_inode_lock(inode, &di_bh, 1); + if (ret < 0) { + mlog_errno(ret); +@@ -2402,8 +2395,6 @@ out: + if (meta_ac) + ocfs2_free_alloc_context(meta_ac); + ocfs2_run_deallocs(osb, &dealloc); +- if (locked) +- inode_unlock(inode); + ocfs2_dio_free_write_ctx(inode, dwc); + + return ret; +diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c +index 6cd5e4924e4d2..ab2b0d74ad03e 100644 +--- a/fs/ocfs2/file.c ++++ b/fs/ocfs2/file.c +@@ -1244,22 +1244,24 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) + goto bail_unlock; + } + } ++ down_write(&OCFS2_I(inode)->ip_alloc_sem); + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS + + 2 * ocfs2_quota_trans_credits(sb)); + if (IS_ERR(handle)) { + status = PTR_ERR(handle); + mlog_errno(status); +- goto bail_unlock; ++ goto bail_unlock_alloc; + } + status = __dquot_transfer(inode, transfer_to); + if (status < 0) + goto bail_commit; + } else { ++ down_write(&OCFS2_I(inode)->ip_alloc_sem); + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); + if (IS_ERR(handle)) { + status = PTR_ERR(handle); + mlog_errno(status); +- goto bail_unlock; ++ goto bail_unlock_alloc; + } + } + +@@ -1272,6 +1274,8 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) + + bail_commit: + ocfs2_commit_trans(osb, handle); ++bail_unlock_alloc: ++ up_write(&OCFS2_I(inode)->ip_alloc_sem); + bail_unlock: + if (status && inode_locked) { + ocfs2_inode_unlock_tracker(inode, 1, &oh, had_lock); +diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h +index 75e5a7fe341fd..36516fe86fe7c 100644 +--- a/include/linux/mlx5/mlx5_ifc.h ++++ b/include/linux/mlx5/mlx5_ifc.h +@@ -415,11 +415,11 @@ struct mlx5_ifc_flow_table_prop_layout_bits { + u8 reserved_at_60[0x18]; + u8 log_max_ft_num[0x8]; + +- u8 reserved_at_80[0x18]; ++ u8 reserved_at_80[0x10]; ++ u8 log_max_flow_counter[0x8]; + u8 log_max_destination[0x8]; + +- u8 log_max_flow_counter[0x8]; +- u8 reserved_at_a8[0x10]; ++ u8 reserved_at_a0[0x18]; + u8 log_max_flow[0x8]; + + u8 reserved_at_c0[0x40]; +@@ -9669,7 +9669,7 @@ struct mlx5_ifc_pbmc_reg_bits { + + struct mlx5_ifc_bufferx_reg_bits buffer[10]; + +- u8 reserved_at_2e0[0x40]; ++ u8 reserved_at_2e0[0x80]; + }; + + struct mlx5_ifc_qtct_reg_bits { +diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h +index 20f3550b0b11b..613d04526032b 100644 +--- a/include/linux/skmsg.h ++++ b/include/linux/skmsg.h +@@ -355,13 +355,17 @@ static inline void sk_psock_update_proto(struct sock *sk, + static inline void sk_psock_restore_proto(struct sock *sk, + struct sk_psock *psock) + { +- sk->sk_prot->unhash = psock->saved_unhash; +- + if (psock->sk_proto) { + struct inet_connection_sock *icsk = inet_csk(sk); + bool has_ulp = !!icsk->icsk_ulp_data; + + if (has_ulp) { ++ /* TLS does not have an unhash proto in SW cases, but we need ++ * to ensure we stop using the sock_map unhash routine because ++ * the associated psock is being removed. So use the original ++ * unhash handler. ++ */ ++ WRITE_ONCE(sk->sk_prot->unhash, psock->saved_unhash); + tcp_update_ulp(sk, psock->sk_proto, + psock->saved_write_space); + } else { +diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h +index 6b5fcfa1e5553..98775d7fa6963 100644 +--- a/include/linux/virtio_net.h ++++ b/include/linux/virtio_net.h +@@ -62,6 +62,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, + return -EINVAL; + } + ++ skb_reset_mac_header(skb); ++ + if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { + u16 start = __virtio16_to_cpu(little_endian, hdr->csum_start); + u16 off = __virtio16_to_cpu(little_endian, hdr->csum_offset); +diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h +index 59f45b1e9dac0..b59d73d529ba7 100644 +--- a/include/net/netns/xfrm.h ++++ b/include/net/netns/xfrm.h +@@ -72,7 +72,9 @@ struct netns_xfrm { + #if IS_ENABLED(CONFIG_IPV6) + struct dst_ops xfrm6_dst_ops; + #endif +- spinlock_t xfrm_state_lock; ++ spinlock_t xfrm_state_lock; ++ seqcount_t xfrm_state_hash_generation; ++ + spinlock_t xfrm_policy_lock; + struct mutex xfrm_cfg_mutex; + }; +diff --git a/include/net/red.h b/include/net/red.h +index 8fe55b8b2fb81..ff07a7cedf685 100644 +--- a/include/net/red.h ++++ b/include/net/red.h +@@ -171,9 +171,9 @@ static inline void red_set_vars(struct red_vars *v) + static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog, + u8 Scell_log, u8 *stab) + { +- if (fls(qth_min) + Wlog > 32) ++ if (fls(qth_min) + Wlog >= 32) + return false; +- if (fls(qth_max) + Wlog > 32) ++ if (fls(qth_max) + Wlog >= 32) + return false; + if (Scell_log >= 32) + return false; +diff --git a/include/net/sock.h b/include/net/sock.h +index e6a48ebb22aa4..4137fa1787903 100644 +--- a/include/net/sock.h ++++ b/include/net/sock.h +@@ -2150,6 +2150,15 @@ static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk) + sk_mem_charge(sk, skb->truesize); + } + ++static inline void skb_set_owner_sk_safe(struct sk_buff *skb, struct sock *sk) ++{ ++ if (sk && refcount_inc_not_zero(&sk->sk_refcnt)) { ++ skb_orphan(skb); ++ skb->destructor = sock_efree; ++ skb->sk = sk; ++ } ++} ++ + void sk_reset_timer(struct sock *sk, struct timer_list *timer, + unsigned long expires); + +diff --git a/include/net/xfrm.h b/include/net/xfrm.h +index c00b9ae71ae40..614f19bbad74f 100644 +--- a/include/net/xfrm.h ++++ b/include/net/xfrm.h +@@ -1098,7 +1098,7 @@ static inline int __xfrm_policy_check2(struct sock *sk, int dir, + return __xfrm_policy_check(sk, ndir, skb, family); + + return (!net->xfrm.policy_count[dir] && !secpath_exists(skb)) || +- (skb_dst(skb)->flags & DST_NOPOLICY) || ++ (skb_dst(skb) && (skb_dst(skb)->flags & DST_NOPOLICY)) || + __xfrm_policy_check(sk, ndir, skb, family); + } + +diff --git a/kernel/gcov/clang.c b/kernel/gcov/clang.c +index 8743150db2acc..c466c7fbdece5 100644 +--- a/kernel/gcov/clang.c ++++ b/kernel/gcov/clang.c +@@ -70,7 +70,9 @@ struct gcov_fn_info { + + u32 ident; + u32 checksum; ++#if CONFIG_CLANG_VERSION < 110000 + u8 use_extra_checksum; ++#endif + u32 cfg_checksum; + + u32 num_counters; +@@ -145,10 +147,8 @@ void llvm_gcda_emit_function(u32 ident, const char *function_name, + + list_add_tail(&info->head, ¤t_info->functions); + } +-EXPORT_SYMBOL(llvm_gcda_emit_function); + #else +-void llvm_gcda_emit_function(u32 ident, u32 func_checksum, +- u8 use_extra_checksum, u32 cfg_checksum) ++void llvm_gcda_emit_function(u32 ident, u32 func_checksum, u32 cfg_checksum) + { + struct gcov_fn_info *info = kzalloc(sizeof(*info), GFP_KERNEL); + +@@ -158,12 +158,11 @@ void llvm_gcda_emit_function(u32 ident, u32 func_checksum, + INIT_LIST_HEAD(&info->head); + info->ident = ident; + info->checksum = func_checksum; +- info->use_extra_checksum = use_extra_checksum; + info->cfg_checksum = cfg_checksum; + list_add_tail(&info->head, ¤t_info->functions); + } +-EXPORT_SYMBOL(llvm_gcda_emit_function); + #endif ++EXPORT_SYMBOL(llvm_gcda_emit_function); + + void llvm_gcda_emit_arcs(u32 num_counters, u64 *counters) + { +@@ -293,11 +292,16 @@ int gcov_info_is_compatible(struct gcov_info *info1, struct gcov_info *info2) + !list_is_last(&fn_ptr2->head, &info2->functions)) { + if (fn_ptr1->checksum != fn_ptr2->checksum) + return false; ++#if CONFIG_CLANG_VERSION < 110000 + if (fn_ptr1->use_extra_checksum != fn_ptr2->use_extra_checksum) + return false; + if (fn_ptr1->use_extra_checksum && + fn_ptr1->cfg_checksum != fn_ptr2->cfg_checksum) + return false; ++#else ++ if (fn_ptr1->cfg_checksum != fn_ptr2->cfg_checksum) ++ return false; ++#endif + fn_ptr1 = list_next_entry(fn_ptr1, head); + fn_ptr2 = list_next_entry(fn_ptr2, head); + } +@@ -529,17 +533,22 @@ static size_t convert_to_gcda(char *buffer, struct gcov_info *info) + + list_for_each_entry(fi_ptr, &info->functions, head) { + u32 i; +- u32 len = 2; +- +- if (fi_ptr->use_extra_checksum) +- len++; + + pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION); +- pos += store_gcov_u32(buffer, pos, len); ++#if CONFIG_CLANG_VERSION < 110000 ++ pos += store_gcov_u32(buffer, pos, ++ fi_ptr->use_extra_checksum ? 3 : 2); ++#else ++ pos += store_gcov_u32(buffer, pos, 3); ++#endif + pos += store_gcov_u32(buffer, pos, fi_ptr->ident); + pos += store_gcov_u32(buffer, pos, fi_ptr->checksum); ++#if CONFIG_CLANG_VERSION < 110000 + if (fi_ptr->use_extra_checksum) + pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); ++#else ++ pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); ++#endif + + pos += store_gcov_u32(buffer, pos, GCOV_TAG_COUNTER_BASE); + pos += store_gcov_u32(buffer, pos, fi_ptr->num_counters * 2); +diff --git a/kernel/workqueue.c b/kernel/workqueue.c +index 29c36c0290623..5d7092e32912e 100644 +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -1411,7 +1411,6 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, + */ + lockdep_assert_irqs_disabled(); + +- debug_work_activate(work); + + /* if draining, only works from the same workqueue are allowed */ + if (unlikely(wq->flags & __WQ_DRAINING) && +@@ -1493,6 +1492,7 @@ retry: + worklist = &pwq->delayed_works; + } + ++ debug_work_activate(work); + insert_work(pwq, work, worklist, work_flags); + + out: +diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c +index 8a482c5ec67bb..c5271ea4dc832 100644 +--- a/net/batman-adv/translation-table.c ++++ b/net/batman-adv/translation-table.c +@@ -891,6 +891,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node, + hlist_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) { + tt_vlan->vid = htons(vlan->vid); + tt_vlan->crc = htonl(vlan->tt.crc); ++ tt_vlan->reserved = 0; + + tt_vlan++; + } +@@ -974,6 +975,7 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, + + tt_vlan->vid = htons(vlan->vid); + tt_vlan->crc = htonl(vlan->tt.crc); ++ tt_vlan->reserved = 0; + + tt_vlan++; + } +diff --git a/net/can/bcm.c b/net/can/bcm.c +index c96fa0f33db39..d3aac6a2479b5 100644 +--- a/net/can/bcm.c ++++ b/net/can/bcm.c +@@ -88,6 +88,8 @@ MODULE_LICENSE("Dual BSD/GPL"); + MODULE_AUTHOR("Oliver Hartkopp "); + MODULE_ALIAS("can-proto-2"); + ++#define BCM_MIN_NAMELEN CAN_REQUIRED_SIZE(struct sockaddr_can, can_ifindex) ++ + /* + * easy access to the first 64 bit of can(fd)_frame payload. cp->data is + * 64 bit aligned so the offset has to be multiples of 8 which is ensured +@@ -1294,7 +1296,7 @@ static int bcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) + /* no bound device as default => check msg_name */ + DECLARE_SOCKADDR(struct sockaddr_can *, addr, msg->msg_name); + +- if (msg->msg_namelen < CAN_REQUIRED_SIZE(*addr, can_ifindex)) ++ if (msg->msg_namelen < BCM_MIN_NAMELEN) + return -EINVAL; + + if (addr->can_family != AF_CAN) +@@ -1536,7 +1538,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len, + struct net *net = sock_net(sk); + int ret = 0; + +- if (len < CAN_REQUIRED_SIZE(*addr, can_ifindex)) ++ if (len < BCM_MIN_NAMELEN) + return -EINVAL; + + lock_sock(sk); +@@ -1618,8 +1620,8 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, + sock_recv_ts_and_drops(msg, sk, skb); + + if (msg->msg_name) { +- __sockaddr_check_size(sizeof(struct sockaddr_can)); +- msg->msg_namelen = sizeof(struct sockaddr_can); ++ __sockaddr_check_size(BCM_MIN_NAMELEN); ++ msg->msg_namelen = BCM_MIN_NAMELEN; + memcpy(msg->msg_name, skb->cb, msg->msg_namelen); + } + +diff --git a/net/can/raw.c b/net/can/raw.c +index 59c039d73c6d5..af513d0957c74 100644 +--- a/net/can/raw.c ++++ b/net/can/raw.c +@@ -62,6 +62,8 @@ MODULE_LICENSE("Dual BSD/GPL"); + MODULE_AUTHOR("Urs Thuermann "); + MODULE_ALIAS("can-proto-1"); + ++#define RAW_MIN_NAMELEN CAN_REQUIRED_SIZE(struct sockaddr_can, can_ifindex) ++ + #define MASK_ALL 0 + + /* A raw socket has a list of can_filters attached to it, each receiving +@@ -396,7 +398,7 @@ static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len) + int err = 0; + int notify_enetdown = 0; + +- if (len < CAN_REQUIRED_SIZE(*addr, can_ifindex)) ++ if (len < RAW_MIN_NAMELEN) + return -EINVAL; + if (addr->can_family != AF_CAN) + return -EINVAL; +@@ -477,11 +479,11 @@ static int raw_getname(struct socket *sock, struct sockaddr *uaddr, + if (peer) + return -EOPNOTSUPP; + +- memset(addr, 0, sizeof(*addr)); ++ memset(addr, 0, RAW_MIN_NAMELEN); + addr->can_family = AF_CAN; + addr->can_ifindex = ro->ifindex; + +- return sizeof(*addr); ++ return RAW_MIN_NAMELEN; + } + + static int raw_setsockopt(struct socket *sock, int level, int optname, +@@ -733,7 +735,7 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) + if (msg->msg_name) { + DECLARE_SOCKADDR(struct sockaddr_can *, addr, msg->msg_name); + +- if (msg->msg_namelen < CAN_REQUIRED_SIZE(*addr, can_ifindex)) ++ if (msg->msg_namelen < RAW_MIN_NAMELEN) + return -EINVAL; + + if (addr->can_family != AF_CAN) +@@ -822,8 +824,8 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, + sock_recv_ts_and_drops(msg, sk, skb); + + if (msg->msg_name) { +- __sockaddr_check_size(sizeof(struct sockaddr_can)); +- msg->msg_namelen = sizeof(struct sockaddr_can); ++ __sockaddr_check_size(RAW_MIN_NAMELEN); ++ msg->msg_namelen = RAW_MIN_NAMELEN; + memcpy(msg->msg_name, skb->cb, msg->msg_namelen); + } + +diff --git a/net/core/sock.c b/net/core/sock.c +index 33543d59a10d6..19c178aac0ae8 100644 +--- a/net/core/sock.c ++++ b/net/core/sock.c +@@ -2026,16 +2026,10 @@ void skb_orphan_partial(struct sk_buff *skb) + if (skb_is_tcp_pure_ack(skb)) + return; + +- if (can_skb_orphan_partial(skb)) { +- struct sock *sk = skb->sk; +- +- if (refcount_inc_not_zero(&sk->sk_refcnt)) { +- WARN_ON(refcount_sub_and_test(skb->truesize, &sk->sk_wmem_alloc)); +- skb->destructor = sock_efree; +- } +- } else { ++ if (can_skb_orphan_partial(skb)) ++ skb_set_owner_sk_safe(skb, skb->sk); ++ else + skb_orphan(skb); +- } + } + EXPORT_SYMBOL(skb_orphan_partial); + +diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c +index c7bd6c49fadff..5dd463a18e4cf 100644 +--- a/net/hsr/hsr_device.c ++++ b/net/hsr/hsr_device.c +@@ -229,6 +229,7 @@ static int hsr_dev_xmit(struct sk_buff *skb, struct net_device *dev) + master = hsr_port_get_hsr(hsr, HSR_PT_MASTER); + if (master) { + skb->dev = master->dev; ++ skb_reset_mac_header(skb); + hsr_forward_skb(skb, master); + } else { + atomic_long_inc(&dev->tx_dropped); +diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c +index ddd9605bad04c..bf3ecf792688e 100644 +--- a/net/hsr/hsr_forward.c ++++ b/net/hsr/hsr_forward.c +@@ -349,12 +349,6 @@ void hsr_forward_skb(struct sk_buff *skb, struct hsr_port *port) + { + struct hsr_frame_info frame; + +- if (skb_mac_header(skb) != skb->data) { +- WARN_ONCE(1, "%s:%d: Malformed frame (port_src %s)\n", +- __FILE__, __LINE__, port->dev->name); +- goto out_drop; +- } +- + if (hsr_fill_frame_info(&frame, skb, port) < 0) + goto out_drop; + hsr_register_frame_in(frame.node_src, port, frame.sequence_nr); +diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c +index 6d091e419d3ee..d19c40c684e80 100644 +--- a/net/ieee802154/nl-mac.c ++++ b/net/ieee802154/nl-mac.c +@@ -551,9 +551,7 @@ ieee802154_llsec_parse_key_id(struct genl_info *info, + desc->mode = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE]); + + if (desc->mode == IEEE802154_SCF_KEY_IMPLICIT) { +- if (!info->attrs[IEEE802154_ATTR_PAN_ID] && +- !(info->attrs[IEEE802154_ATTR_SHORT_ADDR] || +- info->attrs[IEEE802154_ATTR_HW_ADDR])) ++ if (!info->attrs[IEEE802154_ATTR_PAN_ID]) + return -EINVAL; + + desc->device_addr.pan_id = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_PAN_ID]); +@@ -562,6 +560,9 @@ ieee802154_llsec_parse_key_id(struct genl_info *info, + desc->device_addr.mode = IEEE802154_ADDR_SHORT; + desc->device_addr.short_addr = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_SHORT_ADDR]); + } else { ++ if (!info->attrs[IEEE802154_ATTR_HW_ADDR]) ++ return -EINVAL; ++ + desc->device_addr.mode = IEEE802154_ADDR_LONG; + desc->device_addr.extended_addr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]); + } +diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c +index ffcfcef762912..f03958fcb5be1 100644 +--- a/net/ieee802154/nl802154.c ++++ b/net/ieee802154/nl802154.c +@@ -836,8 +836,13 @@ nl802154_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags, + goto nla_put_failure; + + #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) ++ goto out; ++ + if (nl802154_get_llsec_params(msg, rdev, wpan_dev) < 0) + goto nla_put_failure; ++ ++out: + #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */ + + genlmsg_end(msg, hdr); +@@ -1400,6 +1405,9 @@ static int nl802154_set_llsec_params(struct sk_buff *skb, + u32 changed = 0; + int ret; + ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) ++ return -EOPNOTSUPP; ++ + if (info->attrs[NL802154_ATTR_SEC_ENABLED]) { + u8 enabled; + +@@ -1560,7 +1568,8 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info) + struct ieee802154_llsec_key_id id = { }; + u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { }; + +- if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) ++ if (!info->attrs[NL802154_ATTR_SEC_KEY] || ++ nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) + return -EINVAL; + + if (!attrs[NL802154_KEY_ATTR_USAGE_FRAMES] || +@@ -1608,7 +1617,8 @@ static int nl802154_del_llsec_key(struct sk_buff *skb, struct genl_info *info) + struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1]; + struct ieee802154_llsec_key_id id; + +- if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) ++ if (!info->attrs[NL802154_ATTR_SEC_KEY] || ++ nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) + return -EINVAL; + + if (ieee802154_llsec_parse_key_id(attrs[NL802154_KEY_ATTR_ID], &id) < 0) +@@ -1773,7 +1783,8 @@ static int nl802154_del_llsec_dev(struct sk_buff *skb, struct genl_info *info) + struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1]; + __le64 extended_addr; + +- if (nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack)) ++ if (!info->attrs[NL802154_ATTR_SEC_DEVICE] || ++ nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack)) + return -EINVAL; + + if (!attrs[NL802154_DEV_ATTR_EXTENDED_ADDR]) +@@ -1929,7 +1940,8 @@ static int nl802154_del_llsec_devkey(struct sk_buff *skb, struct genl_info *info + struct ieee802154_llsec_device_key key; + __le64 extended_addr; + +- if (nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack)) ++ if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] || ++ nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack)) + return -EINVAL; + + if (!attrs[NL802154_DEVKEY_ATTR_EXTENDED_ADDR]) +@@ -2101,6 +2113,9 @@ static int nl802154_del_llsec_seclevel(struct sk_buff *skb, + struct wpan_dev *wpan_dev = dev->ieee802154_ptr; + struct ieee802154_llsec_seclevel sl; + ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) ++ return -EOPNOTSUPP; ++ + if (!info->attrs[NL802154_ATTR_SEC_LEVEL] || + llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL], + &sl) < 0) +diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c +index 25c8ba6732df0..8c0af30fb0679 100644 +--- a/net/ipv4/esp4_offload.c ++++ b/net/ipv4/esp4_offload.c +@@ -177,10 +177,12 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb, + + if ((!(skb->dev->gso_partial_features & NETIF_F_HW_ESP) && + !(features & NETIF_F_HW_ESP)) || x->xso.dev != skb->dev) +- esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK); ++ esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK | ++ NETIF_F_SCTP_CRC); + else if (!(features & NETIF_F_HW_ESP_TX_CSUM) && + !(skb->dev->gso_partial_features & NETIF_F_HW_ESP_TX_CSUM)) +- esp_features = features & ~NETIF_F_CSUM_MASK; ++ esp_features = features & ~(NETIF_F_CSUM_MASK | ++ NETIF_F_SCTP_CRC); + + xo->flags |= XFRM_GSO_SEGMENT; + +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c +index 994a150ae3e90..24841a9e99668 100644 +--- a/net/ipv4/udp.c ++++ b/net/ipv4/udp.c +@@ -2692,6 +2692,10 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, + val = up->gso_size; + break; + ++ case UDP_GRO: ++ val = up->gro_enabled; ++ break; ++ + /* The following two cannot be changed on UDP sockets, the return is + * always 0 (which corresponds to the full checksum coverage of UDP). */ + case UDPLITE_SEND_CSCOV: +diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c +index 93e086cf058a6..1c532638b2adf 100644 +--- a/net/ipv6/esp6_offload.c ++++ b/net/ipv6/esp6_offload.c +@@ -210,9 +210,11 @@ static struct sk_buff *esp6_gso_segment(struct sk_buff *skb, + skb->encap_hdr_csum = 1; + + if (!(features & NETIF_F_HW_ESP) || x->xso.dev != skb->dev) +- esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK); ++ esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK | ++ NETIF_F_SCTP_CRC); + else if (!(features & NETIF_F_HW_ESP_TX_CSUM)) +- esp_features = features & ~NETIF_F_CSUM_MASK; ++ esp_features = features & ~(NETIF_F_CSUM_MASK | ++ NETIF_F_SCTP_CRC); + + xo->flags |= XFRM_GSO_SEGMENT; + +diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c +index dfe5e603ffe16..828dd95840b47 100644 +--- a/net/ipv6/raw.c ++++ b/net/ipv6/raw.c +@@ -298,7 +298,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) + */ + v4addr = LOOPBACK4_IPV6; + if (!(addr_type & IPV6_ADDR_MULTICAST) && +- !sock_net(sk)->ipv6.sysctl.ip_nonlocal_bind) { ++ !ipv6_can_nonlocal_bind(sock_net(sk), inet)) { + err = -EADDRNOTAVAIL; + if (!ipv6_chk_addr(sock_net(sk), &addr->sin6_addr, + dev, 0)) { +diff --git a/net/ipv6/route.c b/net/ipv6/route.c +index 46df6345bb99c..3a9bd9687e7d1 100644 +--- a/net/ipv6/route.c ++++ b/net/ipv6/route.c +@@ -5183,9 +5183,11 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, + * nexthops have been replaced by first new, the rest should + * be added to it. + */ +- cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | +- NLM_F_REPLACE); +- cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE; ++ if (cfg->fc_nlinfo.nlh) { ++ cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | ++ NLM_F_REPLACE); ++ cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE; ++ } + nhn++; + } + +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index da0e285302f9d..538722522ffe9 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3582,7 +3582,7 @@ begin: + test_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags)) + goto out; + +- if (vif->txqs_stopped[ieee80211_ac_from_tid(txq->tid)]) { ++ if (vif->txqs_stopped[txq->ac]) { + set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags); + goto out; + } +diff --git a/net/mac802154/llsec.c b/net/mac802154/llsec.c +index c079ee69d3d03..346a9c86bcf88 100644 +--- a/net/mac802154/llsec.c ++++ b/net/mac802154/llsec.c +@@ -152,7 +152,7 @@ err_tfm0: + crypto_free_sync_skcipher(key->tfm0); + err_tfm: + for (i = 0; i < ARRAY_SIZE(key->tfm); i++) +- if (key->tfm[i]) ++ if (!IS_ERR_OR_NULL(key->tfm[i])) + crypto_free_aead(key->tfm[i]); + + kzfree(key); +diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c +index 4910e61622329..9bd12f7517ed5 100644 +--- a/net/ncsi/ncsi-manage.c ++++ b/net/ncsi/ncsi-manage.c +@@ -103,13 +103,20 @@ static void ncsi_channel_monitor(struct timer_list *t) + monitor_state = nc->monitor.state; + spin_unlock_irqrestore(&nc->lock, flags); + +- if (!enabled || chained) { +- ncsi_stop_channel_monitor(nc); +- return; +- } ++ if (!enabled) ++ return; /* expected race disabling timer */ ++ if (WARN_ON_ONCE(chained)) ++ goto bad_state; ++ + if (state != NCSI_CHANNEL_INACTIVE && + state != NCSI_CHANNEL_ACTIVE) { +- ncsi_stop_channel_monitor(nc); ++bad_state: ++ netdev_warn(ndp->ndev.dev, ++ "Bad NCSI monitor state channel %d 0x%x %s queue\n", ++ nc->id, state, chained ? "on" : "off"); ++ spin_lock_irqsave(&nc->lock, flags); ++ nc->monitor.enabled = false; ++ spin_unlock_irqrestore(&nc->lock, flags); + return; + } + +@@ -134,10 +141,9 @@ static void ncsi_channel_monitor(struct timer_list *t) + ncsi_report_link(ndp, true); + ndp->flags |= NCSI_DEV_RESHUFFLE; + +- ncsi_stop_channel_monitor(nc); +- + ncm = &nc->modes[NCSI_MODE_LINK]; + spin_lock_irqsave(&nc->lock, flags); ++ nc->monitor.enabled = false; + nc->state = NCSI_CHANNEL_INVISIBLE; + ncm->data[2] &= ~0x1; + spin_unlock_irqrestore(&nc->lock, flags); +diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c +index 28604414dec1b..170c342b11dae 100644 +--- a/net/nfc/llcp_sock.c ++++ b/net/nfc/llcp_sock.c +@@ -108,11 +108,13 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) + llcp_sock->service_name_len, + GFP_KERNEL); + if (!llcp_sock->service_name) { ++ nfc_llcp_local_put(llcp_sock->local); + ret = -ENOMEM; + goto put_dev; + } + llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock); + if (llcp_sock->ssap == LLCP_SAP_MAX) { ++ nfc_llcp_local_put(llcp_sock->local); + kfree(llcp_sock->service_name); + llcp_sock->service_name = NULL; + ret = -EADDRINUSE; +@@ -671,6 +673,10 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, + ret = -EISCONN; + goto error; + } ++ if (sk->sk_state == LLCP_CONNECTING) { ++ ret = -EINPROGRESS; ++ goto error; ++ } + + dev = nfc_get_device(addr->dev_idx); + if (dev == NULL) { +@@ -702,6 +708,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, + llcp_sock->local = nfc_llcp_local_get(local); + llcp_sock->ssap = nfc_llcp_get_local_ssap(local); + if (llcp_sock->ssap == LLCP_SAP_MAX) { ++ nfc_llcp_local_put(llcp_sock->local); + ret = -ENOMEM; + goto put_dev; + } +@@ -743,9 +750,12 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, + + sock_unlink: + nfc_llcp_sock_unlink(&local->connecting_sockets, sk); ++ kfree(llcp_sock->service_name); ++ llcp_sock->service_name = NULL; + + sock_llcp_release: + nfc_llcp_put_ssap(local, llcp_sock->ssap); ++ nfc_llcp_local_put(llcp_sock->local); + + put_dev: + nfc_put_device(dev); +diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c +index d06d7d58eaf27..b6f98eba71f1b 100644 +--- a/net/openvswitch/conntrack.c ++++ b/net/openvswitch/conntrack.c +@@ -2019,16 +2019,12 @@ static int ovs_ct_limit_del_zone_limit(struct nlattr *nla_zone_limit, + static int ovs_ct_limit_get_default_limit(struct ovs_ct_limit_info *info, + struct sk_buff *reply) + { +- struct ovs_zone_limit zone_limit; +- int err; ++ struct ovs_zone_limit zone_limit = { ++ .zone_id = OVS_ZONE_LIMIT_DEFAULT_ZONE, ++ .limit = info->default_limit, ++ }; + +- zone_limit.zone_id = OVS_ZONE_LIMIT_DEFAULT_ZONE; +- zone_limit.limit = info->default_limit; +- err = nla_put_nohdr(reply, sizeof(zone_limit), &zone_limit); +- if (err) +- return err; +- +- return 0; ++ return nla_put_nohdr(reply, sizeof(zone_limit), &zone_limit); + } + + static int __ovs_ct_limit_get_zone_limit(struct net *net, +diff --git a/net/rds/message.c b/net/rds/message.c +index 2d43e13d6dd59..92b6b22884d4c 100644 +--- a/net/rds/message.c ++++ b/net/rds/message.c +@@ -347,8 +347,9 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in + rm->data.op_nents = DIV_ROUND_UP(total_len, PAGE_SIZE); + rm->data.op_sg = rds_message_alloc_sgs(rm, num_sgs); + if (IS_ERR(rm->data.op_sg)) { ++ void *err = ERR_CAST(rm->data.op_sg); + rds_message_put(rm); +- return ERR_CAST(rm->data.op_sg); ++ return err; + } + + for (i = 0; i < rm->data.op_nents; ++i) { +diff --git a/net/sched/act_api.c b/net/sched/act_api.c +index 43c10a85e8813..716cad6773184 100644 +--- a/net/sched/act_api.c ++++ b/net/sched/act_api.c +@@ -935,6 +935,9 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, + if (err != ACT_P_CREATED) + module_put(a_o->owner); + ++ if (!bind && ovr && err == ACT_P_CREATED) ++ refcount_set(&a->tcfa_refcnt, 2); ++ + return a; + + err_mod: +diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c +index 2f1f0a3784083..6af6b95bdb672 100644 +--- a/net/sched/sch_teql.c ++++ b/net/sched/sch_teql.c +@@ -134,6 +134,9 @@ teql_destroy(struct Qdisc *sch) + struct teql_sched_data *dat = qdisc_priv(sch); + struct teql_master *master = dat->m; + ++ if (!master) ++ return; ++ + prev = master->slaves; + if (prev) { + do { +diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c +index c87af430107ae..52c92b8d827fd 100644 +--- a/net/sctp/ipv6.c ++++ b/net/sctp/ipv6.c +@@ -643,8 +643,8 @@ static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp) + if (!(type & IPV6_ADDR_UNICAST)) + return 0; + +- return sp->inet.freebind || net->ipv6.sysctl.ip_nonlocal_bind || +- ipv6_chk_addr(net, in6, NULL, 0); ++ return ipv6_can_nonlocal_bind(net, &sp->inet) || ++ ipv6_chk_addr(net, in6, NULL, 0); + } + + /* This function checks if the address is a valid address to be used for +@@ -933,8 +933,7 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr) + net = sock_net(&opt->inet.sk); + rcu_read_lock(); + dev = dev_get_by_index_rcu(net, addr->v6.sin6_scope_id); +- if (!dev || !(opt->inet.freebind || +- net->ipv6.sysctl.ip_nonlocal_bind || ++ if (!dev || !(ipv6_can_nonlocal_bind(net, &opt->inet) || + ipv6_chk_addr(net, &addr->v6.sin6_addr, + dev, 0))) { + rcu_read_unlock(); +diff --git a/net/tipc/socket.c b/net/tipc/socket.c +index 66e8f89bce534..b2c36dcfc8e2f 100644 +--- a/net/tipc/socket.c ++++ b/net/tipc/socket.c +@@ -1210,7 +1210,7 @@ void tipc_sk_mcast_rcv(struct net *net, struct sk_buff_head *arrvq, + spin_lock_bh(&inputq->lock); + if (skb_peek(arrvq) == skb) { + skb_queue_splice_tail_init(&tmpq, inputq); +- kfree_skb(__skb_dequeue(arrvq)); ++ __skb_dequeue(arrvq); + } + spin_unlock_bh(&inputq->lock); + __skb_queue_purge(&tmpq); +diff --git a/net/wireless/sme.c b/net/wireless/sme.c +index d32a2ec4d96ac..63f89687a018b 100644 +--- a/net/wireless/sme.c ++++ b/net/wireless/sme.c +@@ -530,7 +530,7 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev, + cfg80211_sme_free(wdev); + } + +- if (WARN_ON(wdev->conn)) ++ if (wdev->conn) + return -EINPROGRESS; + + wdev->conn = kzalloc(sizeof(*wdev->conn), GFP_KERNEL); +diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c +index 01c65f96d2832..74e90d78c3b46 100644 +--- a/net/xfrm/xfrm_interface.c ++++ b/net/xfrm/xfrm_interface.c +@@ -302,6 +302,8 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) + + icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); + } else { ++ if (!(ip_hdr(skb)->frag_off & htons(IP_DF))) ++ goto xmit; + icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, + htonl(mtu)); + } +@@ -310,6 +312,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) + return -EMSGSIZE; + } + ++xmit: + xfrmi_scrub_packet(skb, !net_eq(xi->net, dev_net(dev))); + skb_dst_set(skb, dst); + skb->dev = tdev; +diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c +index 61fd0569d3934..1423e2b7cb42a 100644 +--- a/net/xfrm/xfrm_state.c ++++ b/net/xfrm/xfrm_state.c +@@ -44,7 +44,6 @@ static void xfrm_state_gc_task(struct work_struct *work); + */ + + static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024; +-static __read_mostly seqcount_t xfrm_state_hash_generation = SEQCNT_ZERO(xfrm_state_hash_generation); + static struct kmem_cache *xfrm_state_cache __ro_after_init; + + static DECLARE_WORK(xfrm_state_gc_work, xfrm_state_gc_task); +@@ -140,7 +139,7 @@ static void xfrm_hash_resize(struct work_struct *work) + } + + spin_lock_bh(&net->xfrm.xfrm_state_lock); +- write_seqcount_begin(&xfrm_state_hash_generation); ++ write_seqcount_begin(&net->xfrm.xfrm_state_hash_generation); + + nhashmask = (nsize / sizeof(struct hlist_head)) - 1U; + odst = xfrm_state_deref_prot(net->xfrm.state_bydst, net); +@@ -156,7 +155,7 @@ static void xfrm_hash_resize(struct work_struct *work) + rcu_assign_pointer(net->xfrm.state_byspi, nspi); + net->xfrm.state_hmask = nhashmask; + +- write_seqcount_end(&xfrm_state_hash_generation); ++ write_seqcount_end(&net->xfrm.xfrm_state_hash_generation); + spin_unlock_bh(&net->xfrm.xfrm_state_lock); + + osize = (ohashmask + 1) * sizeof(struct hlist_head); +@@ -1058,7 +1057,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr, + + to_put = NULL; + +- sequence = read_seqcount_begin(&xfrm_state_hash_generation); ++ sequence = read_seqcount_begin(&net->xfrm.xfrm_state_hash_generation); + + rcu_read_lock(); + h = xfrm_dst_hash(net, daddr, saddr, tmpl->reqid, encap_family); +@@ -1171,7 +1170,7 @@ out: + if (to_put) + xfrm_state_put(to_put); + +- if (read_seqcount_retry(&xfrm_state_hash_generation, sequence)) { ++ if (read_seqcount_retry(&net->xfrm.xfrm_state_hash_generation, sequence)) { + *err = -EAGAIN; + if (x) { + xfrm_state_put(x); +@@ -2588,6 +2587,7 @@ int __net_init xfrm_state_init(struct net *net) + net->xfrm.state_num = 0; + INIT_WORK(&net->xfrm.state_hash_work, xfrm_hash_resize); + spin_lock_init(&net->xfrm.xfrm_state_lock); ++ seqcount_init(&net->xfrm.xfrm_state_hash_generation); + return 0; + + out_byspi: +diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c +index 9ccdad89c288d..452b9eaca815b 100644 +--- a/sound/drivers/aloop.c ++++ b/sound/drivers/aloop.c +@@ -1035,6 +1035,14 @@ static int loopback_mixer_new(struct loopback *loopback, int notify) + return -ENOMEM; + kctl->id.device = dev; + kctl->id.subdevice = substr; ++ ++ /* Add the control before copying the id so that ++ * the numid field of the id is set in the copy. ++ */ ++ err = snd_ctl_add(card, kctl); ++ if (err < 0) ++ return err; ++ + switch (idx) { + case ACTIVE_IDX: + setup->active_id = kctl->id; +@@ -1051,9 +1059,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify) + default: + break; + } +- err = snd_ctl_add(card, kctl); +- if (err < 0) +- return err; + } + } + } +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 3c9e072db3538..e3fab993b3395 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -3917,6 +3917,15 @@ static void alc271_fixup_dmic(struct hda_codec *codec, + snd_hda_sequence_write(codec, verbs); + } + ++/* Fix the speaker amp after resume, etc */ ++static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec, ++ const struct hda_fixup *fix, ++ int action) ++{ ++ if (action == HDA_FIXUP_ACT_INIT) ++ alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000); ++} ++ + static void alc269_fixup_pcm_44k(struct hda_codec *codec, + const struct hda_fixup *fix, int action) + { +@@ -6220,6 +6229,7 @@ enum { + ALC283_FIXUP_HEADSET_MIC, + ALC255_FIXUP_MIC_MUTE_LED, + ALC282_FIXUP_ASPIRE_V5_PINS, ++ ALC269VB_FIXUP_ASPIRE_E1_COEF, + ALC280_FIXUP_HP_GPIO4, + ALC286_FIXUP_HP_GPIO_LED, + ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, +@@ -6890,6 +6900,10 @@ static const struct hda_fixup alc269_fixups[] = { + { }, + }, + }, ++ [ALC269VB_FIXUP_ASPIRE_E1_COEF] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc269vb_fixup_aspire_e1_coef, ++ }, + [ALC280_FIXUP_HP_GPIO4] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc280_fixup_hp_gpio4, +@@ -7764,6 +7778,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), + SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), + SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), ++ SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF), + SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK), + SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC), +@@ -8240,6 +8255,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { + {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"}, + {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"}, + {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"}, ++ {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"}, + {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"}, + {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, + {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"}, +diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c +index 6cf0f6612bdaf..708fc4ed54eda 100644 +--- a/sound/soc/codecs/wm8960.c ++++ b/sound/soc/codecs/wm8960.c +@@ -707,7 +707,13 @@ int wm8960_configure_pll(struct snd_soc_component *component, int freq_in, + best_freq_out = -EINVAL; + *sysclk_idx = *dac_idx = *bclk_idx = -1; + +- for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) { ++ /* ++ * From Datasheet, the PLL performs best when f2 is between ++ * 90MHz and 100MHz, the desired sysclk output is 11.2896MHz ++ * or 12.288MHz, then sysclkdiv = 2 is the best choice. ++ * So search sysclk_divs from 2 to 1 other than from 1 to 2. ++ */ ++ for (i = ARRAY_SIZE(sysclk_divs) - 1; i >= 0; --i) { + if (sysclk_divs[i] == -1) + continue; + for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) { +diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c +index 31f1dd6541aa1..c3ff203c3f447 100644 +--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c ++++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c +@@ -500,14 +500,14 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { + .channels_min = SST_STEREO, + .channels_max = SST_STEREO, + .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, +- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + .capture = { + .stream_name = "Headset Capture", + .channels_min = 1, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, +- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + }, + { +@@ -518,7 +518,7 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { + .channels_min = SST_STEREO, + .channels_max = SST_STEREO, + .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, +- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + }, + { +diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c +index 94b093b370e2f..06715b3d8c319 100644 +--- a/sound/soc/sof/intel/hda-dsp.c ++++ b/sound/soc/sof/intel/hda-dsp.c +@@ -192,10 +192,17 @@ bool hda_dsp_core_is_enabled(struct snd_sof_dev *sdev, + + val = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPCS); + +- is_enable = ((val & HDA_DSP_ADSPCS_CPA_MASK(core_mask)) && +- (val & HDA_DSP_ADSPCS_SPA_MASK(core_mask)) && +- !(val & HDA_DSP_ADSPCS_CRST_MASK(core_mask)) && +- !(val & HDA_DSP_ADSPCS_CSTALL_MASK(core_mask))); ++#define MASK_IS_EQUAL(v, m, field) ({ \ ++ u32 _m = field(m); \ ++ ((v) & _m) == _m; \ ++}) ++ ++ is_enable = MASK_IS_EQUAL(val, core_mask, HDA_DSP_ADSPCS_CPA_MASK) && ++ MASK_IS_EQUAL(val, core_mask, HDA_DSP_ADSPCS_SPA_MASK) && ++ !(val & HDA_DSP_ADSPCS_CRST_MASK(core_mask)) && ++ !(val & HDA_DSP_ADSPCS_CSTALL_MASK(core_mask)); ++ ++#undef MASK_IS_EQUAL + + dev_dbg(sdev->dev, "DSP core(s) enabled? %d : core_mask %x\n", + is_enable, core_mask); +diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c +index ee448d5e07a6d..c4021d6ac9dfb 100644 +--- a/sound/soc/sunxi/sun4i-codec.c ++++ b/sound/soc/sunxi/sun4i-codec.c +@@ -1364,6 +1364,7 @@ static struct snd_soc_card *sun4i_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "sun4i-codec"; + card->dapm_widgets = sun4i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun4i_codec_card_dapm_widgets); +@@ -1396,6 +1397,7 @@ static struct snd_soc_card *sun6i_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "A31 Audio Codec"; + card->dapm_widgets = sun6i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); +@@ -1449,6 +1451,7 @@ static struct snd_soc_card *sun8i_a23_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "A23 Audio Codec"; + card->dapm_widgets = sun6i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); +@@ -1487,6 +1490,7 @@ static struct snd_soc_card *sun8i_h3_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "H3 Audio Codec"; + card->dapm_widgets = sun6i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); +@@ -1525,6 +1529,7 @@ static struct snd_soc_card *sun8i_v3s_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "V3s Audio Codec"; + card->dapm_widgets = sun6i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); +diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c +index 372ecb3e2c06f..0d524ef3606d7 100644 +--- a/tools/perf/builtin-inject.c ++++ b/tools/perf/builtin-inject.c +@@ -835,7 +835,7 @@ int cmd_inject(int argc, const char **argv) + inject.tool.ordered_events = inject.sched_stat; + + data.path = inject.input_name; +- inject.session = perf_session__new(&data, true, &inject.tool); ++ inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool); + if (IS_ERR(inject.session)) + return PTR_ERR(inject.session); + diff --git a/patch/kernel/archive/sunxi-5.10/patch-5.10.29-30.patch b/patch/kernel/archive/sunxi-5.10/patch-5.10.29-30.patch new file mode 100644 index 000000000..3789577d3 --- /dev/null +++ b/patch/kernel/archive/sunxi-5.10/patch-5.10.29-30.patch @@ -0,0 +1,7702 @@ +diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml +index 39147d33e8c7c..9e41dad9ef4da 100644 +--- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml ++++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml +@@ -49,7 +49,7 @@ properties: + description: + Reference to an nvmem node for the MAC address + +- nvmem-cells-names: ++ nvmem-cell-names: + const: mac-address + + phy-connection-type: +diff --git a/Makefile b/Makefile +index 1d4a50ebe3b77..872af26e085a1 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 10 +-SUBLEVEL = 29 ++SUBLEVEL = 30 + EXTRAVERSION = + NAME = Dare mighty things + +diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts +index 768b6c5d2129a..fde4c302f08ec 100644 +--- a/arch/arm/boot/dts/armada-385-turris-omnia.dts ++++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts +@@ -236,6 +236,7 @@ + status = "okay"; + compatible = "ethernet-phy-id0141.0DD1", "ethernet-phy-ieee802.3-c22"; + reg = <1>; ++ marvell,reg-init = <3 18 0 0x4985>; + + /* irq is connected to &pcawan pin 7 */ + }; +diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi +index e361df26a168d..5f84e9f2b5767 100644 +--- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi ++++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi +@@ -432,6 +432,7 @@ + pinctrl-0 = <&pinctrl_usdhc2>; + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; ++ vmmc-supply = <&vdd_sd1_reg>; + status = "disabled"; + }; + +@@ -441,5 +442,6 @@ + &pinctrl_usdhc3_cdwp>; + cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>; ++ vmmc-supply = <&vdd_sd0_reg>; + status = "disabled"; + }; +diff --git a/arch/arm/mach-omap2/omap-secure.c b/arch/arm/mach-omap2/omap-secure.c +index f70d561f37f71..0659ab4cb0af3 100644 +--- a/arch/arm/mach-omap2/omap-secure.c ++++ b/arch/arm/mach-omap2/omap-secure.c +@@ -9,6 +9,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -20,6 +21,7 @@ + + #include "common.h" + #include "omap-secure.h" ++#include "soc.h" + + static phys_addr_t omap_secure_memblock_base; + +@@ -213,3 +215,40 @@ void __init omap_secure_init(void) + { + omap_optee_init_check(); + } ++ ++/* ++ * Dummy dispatcher call after core OSWR and MPU off. Updates the ROM return ++ * address after MMU has been re-enabled after CPU1 has been woken up again. ++ * Otherwise the ROM code will attempt to use the earlier physical return ++ * address that got set with MMU off when waking up CPU1. Only used on secure ++ * devices. ++ */ ++static int cpu_notifier(struct notifier_block *nb, unsigned long cmd, void *v) ++{ ++ switch (cmd) { ++ case CPU_CLUSTER_PM_EXIT: ++ omap_secure_dispatcher(OMAP4_PPA_SERVICE_0, ++ FLAG_START_CRITICAL, ++ 0, 0, 0, 0, 0); ++ break; ++ default: ++ break; ++ } ++ ++ return NOTIFY_OK; ++} ++ ++static struct notifier_block secure_notifier_block = { ++ .notifier_call = cpu_notifier, ++}; ++ ++static int __init secure_pm_init(void) ++{ ++ if (omap_type() == OMAP2_DEVICE_TYPE_GP || !soc_is_omap44xx()) ++ return 0; ++ ++ cpu_pm_register_notifier(&secure_notifier_block); ++ ++ return 0; ++} ++omap_arch_initcall(secure_pm_init); +diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h +index 4aaa95706d39f..172069f316164 100644 +--- a/arch/arm/mach-omap2/omap-secure.h ++++ b/arch/arm/mach-omap2/omap-secure.h +@@ -50,6 +50,7 @@ + #define OMAP5_DRA7_MON_SET_ACR_INDEX 0x107 + + /* Secure PPA(Primary Protected Application) APIs */ ++#define OMAP4_PPA_SERVICE_0 0x21 + #define OMAP4_PPA_L2_POR_INDEX 0x23 + #define OMAP4_PPA_CPU_ACTRL_SMP_INDEX 0x25 + +diff --git a/arch/arm/mach-omap2/pmic-cpcap.c b/arch/arm/mach-omap2/pmic-cpcap.c +index 09076ad0576d9..668dc84fd31e0 100644 +--- a/arch/arm/mach-omap2/pmic-cpcap.c ++++ b/arch/arm/mach-omap2/pmic-cpcap.c +@@ -246,10 +246,10 @@ int __init omap4_cpcap_init(void) + omap_voltage_register_pmic(voltdm, &omap443x_max8952_mpu); + + if (of_machine_is_compatible("motorola,droid-bionic")) { +- voltdm = voltdm_lookup("mpu"); ++ voltdm = voltdm_lookup("core"); + omap_voltage_register_pmic(voltdm, &omap_cpcap_core); + +- voltdm = voltdm_lookup("mpu"); ++ voltdm = voltdm_lookup("iva"); + omap_voltage_register_pmic(voltdm, &omap_cpcap_iva); + } else { + voltdm = voltdm_lookup("core"); +diff --git a/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h b/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h +index 5ccc4cc91959d..a003e6af33533 100644 +--- a/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h ++++ b/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h +@@ -124,7 +124,7 @@ + #define MX8MM_IOMUXC_SD1_CMD_USDHC1_CMD 0x0A4 0x30C 0x000 0x0 0x0 + #define MX8MM_IOMUXC_SD1_CMD_GPIO2_IO1 0x0A4 0x30C 0x000 0x5 0x0 + #define MX8MM_IOMUXC_SD1_DATA0_USDHC1_DATA0 0x0A8 0x310 0x000 0x0 0x0 +-#define MX8MM_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x31 0x000 0x5 0x0 ++#define MX8MM_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x310 0x000 0x5 0x0 + #define MX8MM_IOMUXC_SD1_DATA1_USDHC1_DATA1 0x0AC 0x314 0x000 0x0 0x0 + #define MX8MM_IOMUXC_SD1_DATA1_GPIO2_IO3 0x0AC 0x314 0x000 0x5 0x0 + #define MX8MM_IOMUXC_SD1_DATA2_USDHC1_DATA2 0x0B0 0x318 0x000 0x0 0x0 +diff --git a/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h b/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h +index b94b02080a344..68e8fa1729741 100644 +--- a/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h ++++ b/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h +@@ -130,7 +130,7 @@ + #define MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0x0A4 0x30C 0x000 0x0 0x0 + #define MX8MQ_IOMUXC_SD1_CMD_GPIO2_IO1 0x0A4 0x30C 0x000 0x5 0x0 + #define MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0x0A8 0x310 0x000 0x0 0x0 +-#define MX8MQ_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x31 0x000 0x5 0x0 ++#define MX8MQ_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x310 0x000 0x5 0x0 + #define MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0x0AC 0x314 0x000 0x0 0x0 + #define MX8MQ_IOMUXC_SD1_DATA1_GPIO2_IO3 0x0AC 0x314 0x000 0x5 0x0 + #define MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0x0B0 0x318 0x000 0x0 0x0 +diff --git a/arch/ia64/include/asm/ptrace.h b/arch/ia64/include/asm/ptrace.h +index b3aa460901012..08179135905cd 100644 +--- a/arch/ia64/include/asm/ptrace.h ++++ b/arch/ia64/include/asm/ptrace.h +@@ -54,8 +54,7 @@ + + static inline unsigned long user_stack_pointer(struct pt_regs *regs) + { +- /* FIXME: should this be bspstore + nr_dirty regs? */ +- return regs->ar_bspstore; ++ return regs->r12; + } + + static inline int is_syscall_success(struct pt_regs *regs) +@@ -79,11 +78,6 @@ static inline long regs_return_value(struct pt_regs *regs) + unsigned long __ip = instruction_pointer(regs); \ + (__ip & ~3UL) + ((__ip & 3UL) << 2); \ + }) +-/* +- * Why not default? Because user_stack_pointer() on ia64 gives register +- * stack backing store instead... +- */ +-#define current_user_stack_pointer() (current_pt_regs()->r12) + + /* given a pointer to a task_struct, return the user's pt_regs */ + # define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1) +diff --git a/arch/nds32/mm/cacheflush.c b/arch/nds32/mm/cacheflush.c +index 6eb98a7ad27d2..ad5344ef5d334 100644 +--- a/arch/nds32/mm/cacheflush.c ++++ b/arch/nds32/mm/cacheflush.c +@@ -238,7 +238,7 @@ void flush_dcache_page(struct page *page) + { + struct address_space *mapping; + +- mapping = page_mapping(page); ++ mapping = page_mapping_file(page); + if (mapping && !mapping_mapped(mapping)) + set_bit(PG_dcache_dirty, &page->flags); + else { +diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h +index cf5ee9b0b393c..84ee232278a6a 100644 +--- a/arch/parisc/include/asm/cmpxchg.h ++++ b/arch/parisc/include/asm/cmpxchg.h +@@ -72,7 +72,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) + #endif + case 4: return __cmpxchg_u32((unsigned int *)ptr, + (unsigned int)old, (unsigned int)new_); +- case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_); ++ case 1: return __cmpxchg_u8((u8 *)ptr, old & 0xff, new_ & 0xff); + } + __cmpxchg_called_with_bad_pointer(); + return old; +diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c +index af013b4244d34..2da0273597989 100644 +--- a/arch/s390/kernel/cpcmd.c ++++ b/arch/s390/kernel/cpcmd.c +@@ -37,10 +37,12 @@ static int diag8_noresponse(int cmdlen) + + static int diag8_response(int cmdlen, char *response, int *rlen) + { ++ unsigned long _cmdlen = cmdlen | 0x40000000L; ++ unsigned long _rlen = *rlen; + register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf; + register unsigned long reg3 asm ("3") = (addr_t) response; +- register unsigned long reg4 asm ("4") = cmdlen | 0x40000000L; +- register unsigned long reg5 asm ("5") = *rlen; ++ register unsigned long reg4 asm ("4") = _cmdlen; ++ register unsigned long reg5 asm ("5") = _rlen; + + asm volatile( + " diag %2,%0,0x8\n" +diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h +index 57ef2094af93e..630ff08532be8 100644 +--- a/arch/x86/include/asm/smp.h ++++ b/arch/x86/include/asm/smp.h +@@ -132,7 +132,7 @@ void native_play_dead(void); + void play_dead_common(void); + void wbinvd_on_cpu(int cpu); + int wbinvd_on_all_cpus(void); +-bool wakeup_cpu0(void); ++void cond_wakeup_cpu0(void); + + void native_smp_send_reschedule(int cpu); + void native_send_call_func_ipi(const struct cpumask *mask); +diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c +index 5ea5f964f0a97..b95d1c533fef5 100644 +--- a/arch/x86/kernel/smpboot.c ++++ b/arch/x86/kernel/smpboot.c +@@ -1655,13 +1655,17 @@ void play_dead_common(void) + local_irq_disable(); + } + +-bool wakeup_cpu0(void) ++/** ++ * cond_wakeup_cpu0 - Wake up CPU0 if needed. ++ * ++ * If NMI wants to wake up CPU0, start CPU0. ++ */ ++void cond_wakeup_cpu0(void) + { + if (smp_processor_id() == 0 && enable_start_cpu0) +- return true; +- +- return false; ++ start_cpu0(); + } ++EXPORT_SYMBOL_GPL(cond_wakeup_cpu0); + + /* + * We need to flush the caches before going to sleep, lest we have +@@ -1730,11 +1734,8 @@ static inline void mwait_play_dead(void) + __monitor(mwait_ptr, 0, 0); + mb(); + __mwait(eax, 0); +- /* +- * If NMI wants to wake up CPU0, start CPU0. +- */ +- if (wakeup_cpu0()) +- start_cpu0(); ++ ++ cond_wakeup_cpu0(); + } + } + +@@ -1745,11 +1746,8 @@ void hlt_play_dead(void) + + while (1) { + native_halt(); +- /* +- * If NMI wants to wake up CPU0, start CPU0. +- */ +- if (wakeup_cpu0()) +- start_cpu0(); ++ ++ cond_wakeup_cpu0(); + } + } + +diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c +index dacbd13d32c69..15717a28b212e 100644 +--- a/arch/x86/kvm/mmu/mmu.c ++++ b/arch/x86/kvm/mmu/mmu.c +@@ -5972,6 +5972,7 @@ static void kvm_recover_nx_lpages(struct kvm *kvm) + struct kvm_mmu_page *sp; + unsigned int ratio; + LIST_HEAD(invalid_list); ++ bool flush = false; + ulong to_zap; + + rcu_idx = srcu_read_lock(&kvm->srcu); +@@ -5992,20 +5993,20 @@ static void kvm_recover_nx_lpages(struct kvm *kvm) + struct kvm_mmu_page, + lpage_disallowed_link); + WARN_ON_ONCE(!sp->lpage_disallowed); +- if (sp->tdp_mmu_page) +- kvm_tdp_mmu_zap_gfn_range(kvm, sp->gfn, +- sp->gfn + KVM_PAGES_PER_HPAGE(sp->role.level)); +- else { ++ if (sp->tdp_mmu_page) { ++ flush |= kvm_tdp_mmu_zap_sp(kvm, sp); ++ } else { + kvm_mmu_prepare_zap_page(kvm, sp, &invalid_list); + WARN_ON_ONCE(sp->lpage_disallowed); + } + + if (need_resched() || spin_needbreak(&kvm->mmu_lock)) { +- kvm_mmu_commit_zap_page(kvm, &invalid_list); ++ kvm_mmu_remote_flush_or_zap(kvm, &invalid_list, flush); + cond_resched_lock(&kvm->mmu_lock); ++ flush = false; + } + } +- kvm_mmu_commit_zap_page(kvm, &invalid_list); ++ kvm_mmu_remote_flush_or_zap(kvm, &invalid_list, flush); + + spin_unlock(&kvm->mmu_lock); + srcu_read_unlock(&kvm->srcu, rcu_idx); +diff --git a/arch/x86/kvm/mmu/tdp_iter.c b/arch/x86/kvm/mmu/tdp_iter.c +index 87b7e16911dbb..1a09d212186b3 100644 +--- a/arch/x86/kvm/mmu/tdp_iter.c ++++ b/arch/x86/kvm/mmu/tdp_iter.c +@@ -22,21 +22,22 @@ static gfn_t round_gfn_for_level(gfn_t gfn, int level) + + /* + * Sets a TDP iterator to walk a pre-order traversal of the paging structure +- * rooted at root_pt, starting with the walk to translate goal_gfn. ++ * rooted at root_pt, starting with the walk to translate next_last_level_gfn. + */ + void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level, +- int min_level, gfn_t goal_gfn) ++ int min_level, gfn_t next_last_level_gfn) + { + WARN_ON(root_level < 1); + WARN_ON(root_level > PT64_ROOT_MAX_LEVEL); + +- iter->goal_gfn = goal_gfn; ++ iter->next_last_level_gfn = next_last_level_gfn; ++ iter->yielded_gfn = iter->next_last_level_gfn; + iter->root_level = root_level; + iter->min_level = min_level; + iter->level = root_level; + iter->pt_path[iter->level - 1] = root_pt; + +- iter->gfn = round_gfn_for_level(iter->goal_gfn, iter->level); ++ iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level); + tdp_iter_refresh_sptep(iter); + + iter->valid = true; +@@ -82,7 +83,7 @@ static bool try_step_down(struct tdp_iter *iter) + + iter->level--; + iter->pt_path[iter->level - 1] = child_pt; +- iter->gfn = round_gfn_for_level(iter->goal_gfn, iter->level); ++ iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level); + tdp_iter_refresh_sptep(iter); + + return true; +@@ -106,7 +107,7 @@ static bool try_step_side(struct tdp_iter *iter) + return false; + + iter->gfn += KVM_PAGES_PER_HPAGE(iter->level); +- iter->goal_gfn = iter->gfn; ++ iter->next_last_level_gfn = iter->gfn; + iter->sptep++; + iter->old_spte = READ_ONCE(*iter->sptep); + +@@ -158,23 +159,6 @@ void tdp_iter_next(struct tdp_iter *iter) + iter->valid = false; + } + +-/* +- * Restart the walk over the paging structure from the root, starting from the +- * highest gfn the iterator had previously reached. Assumes that the entire +- * paging structure, except the root page, may have been completely torn down +- * and rebuilt. +- */ +-void tdp_iter_refresh_walk(struct tdp_iter *iter) +-{ +- gfn_t goal_gfn = iter->goal_gfn; +- +- if (iter->gfn > goal_gfn) +- goal_gfn = iter->gfn; +- +- tdp_iter_start(iter, iter->pt_path[iter->root_level - 1], +- iter->root_level, iter->min_level, goal_gfn); +-} +- + u64 *tdp_iter_root_pt(struct tdp_iter *iter) + { + return iter->pt_path[iter->root_level - 1]; +diff --git a/arch/x86/kvm/mmu/tdp_iter.h b/arch/x86/kvm/mmu/tdp_iter.h +index 47170d0dc98e5..d480c540ee27d 100644 +--- a/arch/x86/kvm/mmu/tdp_iter.h ++++ b/arch/x86/kvm/mmu/tdp_iter.h +@@ -15,7 +15,13 @@ struct tdp_iter { + * The iterator will traverse the paging structure towards the mapping + * for this GFN. + */ +- gfn_t goal_gfn; ++ gfn_t next_last_level_gfn; ++ /* ++ * The next_last_level_gfn at the time when the thread last ++ * yielded. Only yielding when the next_last_level_gfn != ++ * yielded_gfn helps ensure forward progress. ++ */ ++ gfn_t yielded_gfn; + /* Pointers to the page tables traversed to reach the current SPTE */ + u64 *pt_path[PT64_ROOT_MAX_LEVEL]; + /* A pointer to the current SPTE */ +@@ -52,9 +58,8 @@ struct tdp_iter { + u64 *spte_to_child_pt(u64 pte, int level); + + void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level, +- int min_level, gfn_t goal_gfn); ++ int min_level, gfn_t next_last_level_gfn); + void tdp_iter_next(struct tdp_iter *iter); +-void tdp_iter_refresh_walk(struct tdp_iter *iter); + u64 *tdp_iter_root_pt(struct tdp_iter *iter); + + #endif /* __KVM_X86_MMU_TDP_ITER_H */ +diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c +index ffa0bd0e033fb..61c00f8631f1a 100644 +--- a/arch/x86/kvm/mmu/tdp_mmu.c ++++ b/arch/x86/kvm/mmu/tdp_mmu.c +@@ -103,7 +103,7 @@ bool is_tdp_mmu_root(struct kvm *kvm, hpa_t hpa) + } + + static bool zap_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, +- gfn_t start, gfn_t end, bool can_yield); ++ gfn_t start, gfn_t end, bool can_yield, bool flush); + + void kvm_tdp_mmu_free_root(struct kvm *kvm, struct kvm_mmu_page *root) + { +@@ -116,7 +116,7 @@ void kvm_tdp_mmu_free_root(struct kvm *kvm, struct kvm_mmu_page *root) + + list_del(&root->link); + +- zap_gfn_range(kvm, root, 0, max_gfn, false); ++ zap_gfn_range(kvm, root, 0, max_gfn, false, false); + + free_page((unsigned long)root->spt); + kmem_cache_free(mmu_page_header_cache, root); +@@ -405,27 +405,43 @@ static inline void tdp_mmu_set_spte_no_dirty_log(struct kvm *kvm, + _mmu->shadow_root_level, _start, _end) + + /* +- * Flush the TLB if the process should drop kvm->mmu_lock. +- * Return whether the caller still needs to flush the tlb. ++ * Yield if the MMU lock is contended or this thread needs to return control ++ * to the scheduler. ++ * ++ * If this function should yield and flush is set, it will perform a remote ++ * TLB flush before yielding. ++ * ++ * If this function yields, it will also reset the tdp_iter's walk over the ++ * paging structure and the calling function should skip to the next ++ * iteration to allow the iterator to continue its traversal from the ++ * paging structure root. ++ * ++ * Return true if this function yielded and the iterator's traversal was reset. ++ * Return false if a yield was not needed. + */ +-static bool tdp_mmu_iter_flush_cond_resched(struct kvm *kvm, struct tdp_iter *iter) ++static inline bool tdp_mmu_iter_cond_resched(struct kvm *kvm, ++ struct tdp_iter *iter, bool flush) + { +- if (need_resched() || spin_needbreak(&kvm->mmu_lock)) { +- kvm_flush_remote_tlbs(kvm); +- cond_resched_lock(&kvm->mmu_lock); +- tdp_iter_refresh_walk(iter); ++ /* Ensure forward progress has been made before yielding. */ ++ if (iter->next_last_level_gfn == iter->yielded_gfn) + return false; +- } else { +- return true; +- } +-} + +-static void tdp_mmu_iter_cond_resched(struct kvm *kvm, struct tdp_iter *iter) +-{ + if (need_resched() || spin_needbreak(&kvm->mmu_lock)) { ++ if (flush) ++ kvm_flush_remote_tlbs(kvm); ++ + cond_resched_lock(&kvm->mmu_lock); +- tdp_iter_refresh_walk(iter); ++ ++ WARN_ON(iter->gfn > iter->next_last_level_gfn); ++ ++ tdp_iter_start(iter, iter->pt_path[iter->root_level - 1], ++ iter->root_level, iter->min_level, ++ iter->next_last_level_gfn); ++ ++ return true; + } ++ ++ return false; + } + + /* +@@ -437,15 +453,22 @@ static void tdp_mmu_iter_cond_resched(struct kvm *kvm, struct tdp_iter *iter) + * scheduler needs the CPU or there is contention on the MMU lock. If this + * function cannot yield, it will not release the MMU lock or reschedule and + * the caller must ensure it does not supply too large a GFN range, or the +- * operation can cause a soft lockup. ++ * operation can cause a soft lockup. Note, in some use cases a flush may be ++ * required by prior actions. Ensure the pending flush is performed prior to ++ * yielding. + */ + static bool zap_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, +- gfn_t start, gfn_t end, bool can_yield) ++ gfn_t start, gfn_t end, bool can_yield, bool flush) + { + struct tdp_iter iter; +- bool flush_needed = false; + + tdp_root_for_each_pte(iter, root, start, end) { ++ if (can_yield && ++ tdp_mmu_iter_cond_resched(kvm, &iter, flush)) { ++ flush = false; ++ continue; ++ } ++ + if (!is_shadow_present_pte(iter.old_spte)) + continue; + +@@ -460,13 +483,10 @@ static bool zap_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + continue; + + tdp_mmu_set_spte(kvm, &iter, 0); +- +- if (can_yield) +- flush_needed = tdp_mmu_iter_flush_cond_resched(kvm, &iter); +- else +- flush_needed = true; ++ flush = true; + } +- return flush_needed; ++ ++ return flush; + } + + /* +@@ -475,13 +495,14 @@ static bool zap_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + * SPTEs have been cleared and a TLB flush is needed before releasing the + * MMU lock. + */ +-bool kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, gfn_t end) ++bool __kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, gfn_t end, ++ bool can_yield) + { + struct kvm_mmu_page *root; + bool flush = false; + + for_each_tdp_mmu_root_yield_safe(kvm, root) +- flush |= zap_gfn_range(kvm, root, start, end, true); ++ flush = zap_gfn_range(kvm, root, start, end, can_yield, flush); + + return flush; + } +@@ -673,7 +694,7 @@ static int zap_gfn_range_hva_wrapper(struct kvm *kvm, + struct kvm_mmu_page *root, gfn_t start, + gfn_t end, unsigned long unused) + { +- return zap_gfn_range(kvm, root, start, end, false); ++ return zap_gfn_range(kvm, root, start, end, false, false); + } + + int kvm_tdp_mmu_zap_hva_range(struct kvm *kvm, unsigned long start, +@@ -824,6 +845,9 @@ static bool wrprot_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + + for_each_tdp_pte_min_level(iter, root->spt, root->role.level, + min_level, start, end) { ++ if (tdp_mmu_iter_cond_resched(kvm, &iter, false)) ++ continue; ++ + if (!is_shadow_present_pte(iter.old_spte) || + !is_last_spte(iter.old_spte, iter.level)) + continue; +@@ -832,8 +856,6 @@ static bool wrprot_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + + tdp_mmu_set_spte_no_dirty_log(kvm, &iter, new_spte); + spte_set = true; +- +- tdp_mmu_iter_cond_resched(kvm, &iter); + } + return spte_set; + } +@@ -877,6 +899,9 @@ static bool clear_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + bool spte_set = false; + + tdp_root_for_each_leaf_pte(iter, root, start, end) { ++ if (tdp_mmu_iter_cond_resched(kvm, &iter, false)) ++ continue; ++ + if (spte_ad_need_write_protect(iter.old_spte)) { + if (is_writable_pte(iter.old_spte)) + new_spte = iter.old_spte & ~PT_WRITABLE_MASK; +@@ -891,8 +916,6 @@ static bool clear_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + + tdp_mmu_set_spte_no_dirty_log(kvm, &iter, new_spte); + spte_set = true; +- +- tdp_mmu_iter_cond_resched(kvm, &iter); + } + return spte_set; + } +@@ -1000,6 +1023,9 @@ static bool set_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + bool spte_set = false; + + tdp_root_for_each_pte(iter, root, start, end) { ++ if (tdp_mmu_iter_cond_resched(kvm, &iter, false)) ++ continue; ++ + if (!is_shadow_present_pte(iter.old_spte)) + continue; + +@@ -1007,8 +1033,6 @@ static bool set_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + + tdp_mmu_set_spte(kvm, &iter, new_spte); + spte_set = true; +- +- tdp_mmu_iter_cond_resched(kvm, &iter); + } + + return spte_set; +@@ -1049,6 +1073,11 @@ static void zap_collapsible_spte_range(struct kvm *kvm, + bool spte_set = false; + + tdp_root_for_each_pte(iter, root, start, end) { ++ if (tdp_mmu_iter_cond_resched(kvm, &iter, spte_set)) { ++ spte_set = false; ++ continue; ++ } ++ + if (!is_shadow_present_pte(iter.old_spte) || + !is_last_spte(iter.old_spte, iter.level)) + continue; +@@ -1061,7 +1090,7 @@ static void zap_collapsible_spte_range(struct kvm *kvm, + + tdp_mmu_set_spte(kvm, &iter, 0); + +- spte_set = tdp_mmu_iter_flush_cond_resched(kvm, &iter); ++ spte_set = true; + } + + if (spte_set) +diff --git a/arch/x86/kvm/mmu/tdp_mmu.h b/arch/x86/kvm/mmu/tdp_mmu.h +index cbbdbadd1526f..a7a3f6db263d2 100644 +--- a/arch/x86/kvm/mmu/tdp_mmu.h ++++ b/arch/x86/kvm/mmu/tdp_mmu.h +@@ -12,7 +12,23 @@ bool is_tdp_mmu_root(struct kvm *kvm, hpa_t root); + hpa_t kvm_tdp_mmu_get_vcpu_root_hpa(struct kvm_vcpu *vcpu); + void kvm_tdp_mmu_free_root(struct kvm *kvm, struct kvm_mmu_page *root); + +-bool kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, gfn_t end); ++bool __kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, gfn_t end, ++ bool can_yield); ++static inline bool kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, ++ gfn_t end) ++{ ++ return __kvm_tdp_mmu_zap_gfn_range(kvm, start, end, true); ++} ++static inline bool kvm_tdp_mmu_zap_sp(struct kvm *kvm, struct kvm_mmu_page *sp) ++{ ++ gfn_t end = sp->gfn + KVM_PAGES_PER_HPAGE(sp->role.level); ++ ++ /* ++ * Don't allow yielding, as the caller may have pending pages to zap ++ * on the shadow MMU. ++ */ ++ return __kvm_tdp_mmu_zap_gfn_range(kvm, sp->gfn, end, false); ++} + void kvm_tdp_mmu_zap_all(struct kvm *kvm); + + int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, gpa_t gpa, u32 error_code, +diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c +index 4e303964f7e7f..fb161a21d0aec 100644 +--- a/drivers/acpi/processor_idle.c ++++ b/drivers/acpi/processor_idle.c +@@ -545,9 +545,7 @@ static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) + return -ENODEV; + + #if defined(CONFIG_X86) && defined(CONFIG_HOTPLUG_CPU) +- /* If NMI wants to wake up CPU0, start CPU0. */ +- if (wakeup_cpu0()) +- start_cpu0(); ++ cond_wakeup_cpu0(); + #endif + } + +diff --git a/drivers/base/dd.c b/drivers/base/dd.c +index 43130d64e213d..8d7f94ef0cfe0 100644 +--- a/drivers/base/dd.c ++++ b/drivers/base/dd.c +@@ -292,14 +292,16 @@ int driver_deferred_probe_check_state(struct device *dev) + + static void deferred_probe_timeout_work_func(struct work_struct *work) + { +- struct device_private *private, *p; ++ struct device_private *p; + + driver_deferred_probe_timeout = 0; + driver_deferred_probe_trigger(); + flush_work(&deferred_probe_work); + +- list_for_each_entry_safe(private, p, &deferred_probe_pending_list, deferred_probe) +- dev_info(private->device, "deferred probe pending\n"); ++ mutex_lock(&deferred_probe_mutex); ++ list_for_each_entry(p, &deferred_probe_pending_list, deferred_probe) ++ dev_info(p->device, "deferred probe pending\n"); ++ mutex_unlock(&deferred_probe_mutex); + wake_up_all(&probe_timeout_waitqueue); + } + static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func); +diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig +index a086dd34f932f..4f501e4842ab3 100644 +--- a/drivers/char/agp/Kconfig ++++ b/drivers/char/agp/Kconfig +@@ -125,7 +125,7 @@ config AGP_HP_ZX1 + + config AGP_PARISC + tristate "HP Quicksilver AGP support" +- depends on AGP && PARISC && 64BIT ++ depends on AGP && PARISC && 64BIT && IOMMU_SBA + help + This option gives you AGP GART support for the HP Quicksilver + AGP bus adapter on HP PA-RISC machines (Ok, just on the C8000 +diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c +index f83dac54ed853..61c78714c0957 100644 +--- a/drivers/clk/clk.c ++++ b/drivers/clk/clk.c +@@ -4262,20 +4262,19 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb) + /* search the list of notifiers for this clk */ + list_for_each_entry(cn, &clk_notifier_list, node) + if (cn->clk == clk) +- break; ++ goto found; + + /* if clk wasn't in the notifier list, allocate new clk_notifier */ +- if (cn->clk != clk) { +- cn = kzalloc(sizeof(*cn), GFP_KERNEL); +- if (!cn) +- goto out; ++ cn = kzalloc(sizeof(*cn), GFP_KERNEL); ++ if (!cn) ++ goto out; + +- cn->clk = clk; +- srcu_init_notifier_head(&cn->notifier_head); ++ cn->clk = clk; ++ srcu_init_notifier_head(&cn->notifier_head); + +- list_add(&cn->node, &clk_notifier_list); +- } ++ list_add(&cn->node, &clk_notifier_list); + ++found: + ret = srcu_notifier_chain_register(&cn->notifier_head, nb); + + clk->core->notifier_count++; +@@ -4300,32 +4299,28 @@ EXPORT_SYMBOL_GPL(clk_notifier_register); + */ + int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb) + { +- struct clk_notifier *cn = NULL; +- int ret = -EINVAL; ++ struct clk_notifier *cn; ++ int ret = -ENOENT; + + if (!clk || !nb) + return -EINVAL; + + clk_prepare_lock(); + +- list_for_each_entry(cn, &clk_notifier_list, node) +- if (cn->clk == clk) +- break; +- +- if (cn->clk == clk) { +- ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb); ++ list_for_each_entry(cn, &clk_notifier_list, node) { ++ if (cn->clk == clk) { ++ ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb); + +- clk->core->notifier_count--; ++ clk->core->notifier_count--; + +- /* XXX the notifier code should handle this better */ +- if (!cn->notifier_head.head) { +- srcu_cleanup_notifier_head(&cn->notifier_head); +- list_del(&cn->node); +- kfree(cn); ++ /* XXX the notifier code should handle this better */ ++ if (!cn->notifier_head.head) { ++ srcu_cleanup_notifier_head(&cn->notifier_head); ++ list_del(&cn->node); ++ kfree(cn); ++ } ++ break; + } +- +- } else { +- ret = -ENOENT; + } + + clk_prepare_unlock(); +diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c +index 43ecd507bf836..cf94a12459ea4 100644 +--- a/drivers/clk/socfpga/clk-gate.c ++++ b/drivers/clk/socfpga/clk-gate.c +@@ -99,7 +99,7 @@ static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk, + val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift; + val &= GENMASK(socfpgaclk->width - 1, 0); + /* Check for GPIO_DB_CLK by its offset */ +- if ((int) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET) ++ if ((uintptr_t) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET) + div = val + 1; + else + div = (1 << val); +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c +index 0a2c4adcd833c..af5bb8fedfea7 100644 +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -364,22 +364,18 @@ static int gpiochip_set_desc_names(struct gpio_chip *gc) + * + * Looks for device property "gpio-line-names" and if it exists assigns + * GPIO line names for the chip. The memory allocated for the assigned +- * names belong to the underlying software node and should not be released ++ * names belong to the underlying firmware node and should not be released + * by the caller. + */ + static int devprop_gpiochip_set_names(struct gpio_chip *chip) + { + struct gpio_device *gdev = chip->gpiodev; +- struct device *dev = chip->parent; ++ struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev); + const char **names; + int ret, i; + int count; + +- /* GPIO chip may not have a parent device whose properties we inspect. */ +- if (!dev) +- return 0; +- +- count = device_property_string_array_count(dev, "gpio-line-names"); ++ count = fwnode_property_string_array_count(fwnode, "gpio-line-names"); + if (count < 0) + return 0; + +@@ -393,7 +389,7 @@ static int devprop_gpiochip_set_names(struct gpio_chip *chip) + if (!names) + return -ENOMEM; + +- ret = device_property_read_string_array(dev, "gpio-line-names", ++ ret = fwnode_property_read_string_array(fwnode, "gpio-line-names", + names, count); + if (ret < 0) { + dev_warn(&gdev->dev, "failed to read GPIO line names\n"); +diff --git a/drivers/gpu/drm/i915/display/intel_acpi.c b/drivers/gpu/drm/i915/display/intel_acpi.c +index e21fb14d5e07b..833d0c1be4f1d 100644 +--- a/drivers/gpu/drm/i915/display/intel_acpi.c ++++ b/drivers/gpu/drm/i915/display/intel_acpi.c +@@ -84,13 +84,31 @@ static void intel_dsm_platform_mux_info(acpi_handle dhandle) + return; + } + ++ if (!pkg->package.count) { ++ DRM_DEBUG_DRIVER("no connection in _DSM\n"); ++ return; ++ } ++ + connector_count = &pkg->package.elements[0]; + DRM_DEBUG_DRIVER("MUX info connectors: %lld\n", + (unsigned long long)connector_count->integer.value); + for (i = 1; i < pkg->package.count; i++) { + union acpi_object *obj = &pkg->package.elements[i]; +- union acpi_object *connector_id = &obj->package.elements[0]; +- union acpi_object *info = &obj->package.elements[1]; ++ union acpi_object *connector_id; ++ union acpi_object *info; ++ ++ if (obj->type != ACPI_TYPE_PACKAGE || obj->package.count < 2) { ++ DRM_DEBUG_DRIVER("Invalid object for MUX #%d\n", i); ++ continue; ++ } ++ ++ connector_id = &obj->package.elements[0]; ++ info = &obj->package.elements[1]; ++ if (info->type != ACPI_TYPE_BUFFER || info->buffer.length < 4) { ++ DRM_DEBUG_DRIVER("Invalid info for MUX obj #%d\n", i); ++ continue; ++ } ++ + DRM_DEBUG_DRIVER("Connector id: 0x%016llx\n", + (unsigned long long)connector_id->integer.value); + DRM_DEBUG_DRIVER(" port id: %s\n", +diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c +index b38ebccad42ff..0aacc43faefa3 100644 +--- a/drivers/gpu/drm/msm/msm_drv.c ++++ b/drivers/gpu/drm/msm/msm_drv.c +@@ -557,6 +557,7 @@ err_free_priv: + kfree(priv); + err_put_drm_dev: + drm_dev_put(ddev); ++ platform_set_drvdata(pdev, NULL); + return ret; + } + +diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c +index 482219fb4db21..1d2416d466a36 100644 +--- a/drivers/gpu/drm/vc4/vc4_crtc.c ++++ b/drivers/gpu/drm/vc4/vc4_crtc.c +@@ -210,6 +210,7 @@ static u32 vc4_get_fifo_full_level(struct vc4_crtc *vc4_crtc, u32 format) + { + const struct vc4_crtc_data *crtc_data = vc4_crtc_to_vc4_crtc_data(vc4_crtc); + const struct vc4_pv_data *pv_data = vc4_crtc_to_vc4_pv_data(vc4_crtc); ++ struct vc4_dev *vc4 = to_vc4_dev(vc4_crtc->base.dev); + u32 fifo_len_bytes = pv_data->fifo_depth; + + /* +@@ -238,6 +239,22 @@ static u32 vc4_get_fifo_full_level(struct vc4_crtc *vc4_crtc, u32 format) + if (crtc_data->hvs_output == 5) + return 32; + ++ /* ++ * It looks like in some situations, we will overflow ++ * the PixelValve FIFO (with the bit 10 of PV stat being ++ * set) and stall the HVS / PV, eventually resulting in ++ * a page flip timeout. ++ * ++ * Displaying the video overlay during a playback with ++ * Kodi on an RPi3 seems to be a great solution with a ++ * failure rate around 50%. ++ * ++ * Removing 1 from the FIFO full level however ++ * seems to completely remove that issue. ++ */ ++ if (!vc4->hvs->hvs5) ++ return fifo_len_bytes - 3 * HVS_FIFO_LATENCY_PIX - 1; ++ + return fifo_len_bytes - 3 * HVS_FIFO_LATENCY_PIX; + } + } +diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c +index d6425ad6e6a38..2871cf2ee8b44 100644 +--- a/drivers/i2c/busses/i2c-designware-master.c ++++ b/drivers/i2c/busses/i2c-designware-master.c +@@ -129,6 +129,7 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) + if ((comp_param1 & DW_IC_COMP_PARAM_1_SPEED_MODE_MASK) + != DW_IC_COMP_PARAM_1_SPEED_MODE_HIGH) { + dev_err(dev->dev, "High Speed not supported!\n"); ++ t->bus_freq_hz = I2C_MAX_FAST_MODE_FREQ; + dev->master_cfg &= ~DW_IC_CON_SPEED_MASK; + dev->master_cfg |= DW_IC_CON_SPEED_FAST; + dev->hs_hcnt = 0; +diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c +index cb4a25ebb8900..2a946c2079284 100644 +--- a/drivers/i2c/busses/i2c-jz4780.c ++++ b/drivers/i2c/busses/i2c-jz4780.c +@@ -526,8 +526,8 @@ static irqreturn_t jz4780_i2c_irq(int irqno, void *dev_id) + i2c_sta = jz4780_i2c_readw(i2c, JZ4780_I2C_STA); + data = *i2c->wbuf; + data &= ~JZ4780_I2C_DC_READ; +- if ((!i2c->stop_hold) && (i2c->cdata->version >= +- ID_X1000)) ++ if ((i2c->wt_len == 1) && (!i2c->stop_hold) && ++ (i2c->cdata->version >= ID_X1000)) + data |= X1000_I2C_DC_STOP; + jz4780_i2c_writew(i2c, JZ4780_I2C_DC, data); + i2c->wbuf++; +diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c +index 573b5da145d1e..c13e7f107dd36 100644 +--- a/drivers/i2c/i2c-core-base.c ++++ b/drivers/i2c/i2c-core-base.c +@@ -378,7 +378,7 @@ static int i2c_gpio_init_recovery(struct i2c_adapter *adap) + static int i2c_init_recovery(struct i2c_adapter *adap) + { + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; +- char *err_str; ++ char *err_str, *err_level = KERN_ERR; + + if (!bri) + return 0; +@@ -387,7 +387,8 @@ static int i2c_init_recovery(struct i2c_adapter *adap) + return -EPROBE_DEFER; + + if (!bri->recover_bus) { +- err_str = "no recover_bus() found"; ++ err_str = "no suitable method provided"; ++ err_level = KERN_DEBUG; + goto err; + } + +@@ -414,7 +415,7 @@ static int i2c_init_recovery(struct i2c_adapter *adap) + + return 0; + err: +- dev_err(&adap->dev, "Not using recovery: %s\n", err_str); ++ dev_printk(err_level, &adap->dev, "Not using recovery: %s\n", err_str); + adap->bus_recovery_info = NULL; + + return -EINVAL; +diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c +index 0abce004a9591..65e3e7df8a4b0 100644 +--- a/drivers/infiniband/core/addr.c ++++ b/drivers/infiniband/core/addr.c +@@ -76,7 +76,9 @@ static struct workqueue_struct *addr_wq; + + static const struct nla_policy ib_nl_addr_policy[LS_NLA_TYPE_MAX] = { + [LS_NLA_TYPE_DGID] = {.type = NLA_BINARY, +- .len = sizeof(struct rdma_nla_ls_gid)}, ++ .len = sizeof(struct rdma_nla_ls_gid), ++ .validation_type = NLA_VALIDATE_MIN, ++ .min = sizeof(struct rdma_nla_ls_gid)}, + }; + + static inline bool ib_nl_is_good_ip_resp(const struct nlmsghdr *nlh) +diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c +index 81903749d2415..e42c812e74c3c 100644 +--- a/drivers/infiniband/hw/cxgb4/cm.c ++++ b/drivers/infiniband/hw/cxgb4/cm.c +@@ -3616,7 +3616,8 @@ int c4iw_destroy_listen(struct iw_cm_id *cm_id) + c4iw_init_wr_wait(ep->com.wr_waitp); + err = cxgb4_remove_server( + ep->com.dev->rdev.lldi.ports[0], ep->stid, +- ep->com.dev->rdev.lldi.rxq_ids[0], true); ++ ep->com.dev->rdev.lldi.rxq_ids[0], ++ ep->com.local_addr.ss_family == AF_INET6); + if (err) + goto done; + err = c4iw_wait_for_reply(&ep->com.dev->rdev, ep->com.wr_waitp, +diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c +index 2a91b8d95e12f..04b1e8f021f64 100644 +--- a/drivers/infiniband/hw/hfi1/affinity.c ++++ b/drivers/infiniband/hw/hfi1/affinity.c +@@ -632,22 +632,11 @@ static void _dev_comp_vect_cpu_mask_clean_up(struct hfi1_devdata *dd, + */ + int hfi1_dev_affinity_init(struct hfi1_devdata *dd) + { +- int node = pcibus_to_node(dd->pcidev->bus); + struct hfi1_affinity_node *entry; + const struct cpumask *local_mask; + int curr_cpu, possible, i, ret; + bool new_entry = false; + +- /* +- * If the BIOS does not have the NUMA node information set, select +- * NUMA 0 so we get consistent performance. +- */ +- if (node < 0) { +- dd_dev_err(dd, "Invalid PCI NUMA node. Performance may be affected\n"); +- node = 0; +- } +- dd->node = node; +- + local_mask = cpumask_of_node(dd->node); + if (cpumask_first(local_mask) >= nr_cpu_ids) + local_mask = topology_core_cpumask(0); +@@ -660,7 +649,7 @@ int hfi1_dev_affinity_init(struct hfi1_devdata *dd) + * create an entry in the global affinity structure and initialize it. + */ + if (!entry) { +- entry = node_affinity_allocate(node); ++ entry = node_affinity_allocate(dd->node); + if (!entry) { + dd_dev_err(dd, + "Unable to allocate global affinity node\n"); +@@ -751,6 +740,7 @@ int hfi1_dev_affinity_init(struct hfi1_devdata *dd) + if (new_entry) + node_affinity_add_tail(entry); + ++ dd->affinity_entry = entry; + mutex_unlock(&node_affinity.lock); + + return 0; +@@ -766,10 +756,9 @@ void hfi1_dev_affinity_clean_up(struct hfi1_devdata *dd) + { + struct hfi1_affinity_node *entry; + +- if (dd->node < 0) +- return; +- + mutex_lock(&node_affinity.lock); ++ if (!dd->affinity_entry) ++ goto unlock; + entry = node_affinity_lookup(dd->node); + if (!entry) + goto unlock; +@@ -780,8 +769,8 @@ void hfi1_dev_affinity_clean_up(struct hfi1_devdata *dd) + */ + _dev_comp_vect_cpu_mask_clean_up(dd, entry); + unlock: ++ dd->affinity_entry = NULL; + mutex_unlock(&node_affinity.lock); +- dd->node = NUMA_NO_NODE; + } + + /* +diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h +index e09e8244a94c4..2a9a040569ebb 100644 +--- a/drivers/infiniband/hw/hfi1/hfi.h ++++ b/drivers/infiniband/hw/hfi1/hfi.h +@@ -1409,6 +1409,7 @@ struct hfi1_devdata { + spinlock_t irq_src_lock; + int vnic_num_vports; + struct net_device *dummy_netdev; ++ struct hfi1_affinity_node *affinity_entry; + + /* Keeps track of IPoIB RSM rule users */ + atomic_t ipoib_rsm_usr_num; +diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c +index cb7ad12888219..786c6316273f7 100644 +--- a/drivers/infiniband/hw/hfi1/init.c ++++ b/drivers/infiniband/hw/hfi1/init.c +@@ -1277,7 +1277,6 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, + dd->pport = (struct hfi1_pportdata *)(dd + 1); + dd->pcidev = pdev; + pci_set_drvdata(pdev, dd); +- dd->node = NUMA_NO_NODE; + + ret = xa_alloc_irq(&hfi1_dev_table, &dd->unit, dd, xa_limit_32b, + GFP_KERNEL); +@@ -1287,6 +1286,15 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, + goto bail; + } + rvt_set_ibdev_name(&dd->verbs_dev.rdi, "%s_%d", class_name(), dd->unit); ++ /* ++ * If the BIOS does not have the NUMA node information set, select ++ * NUMA 0 so we get consistent performance. ++ */ ++ dd->node = pcibus_to_node(pdev->bus); ++ if (dd->node == NUMA_NO_NODE) { ++ dd_dev_err(dd, "Invalid PCI NUMA node. Performance may be affected\n"); ++ dd->node = 0; ++ } + + /* + * Initialize all locks for the device. This needs to be as early as +diff --git a/drivers/infiniband/hw/hfi1/netdev_rx.c b/drivers/infiniband/hw/hfi1/netdev_rx.c +index 6d263c9749b36..ea95baada2b6b 100644 +--- a/drivers/infiniband/hw/hfi1/netdev_rx.c ++++ b/drivers/infiniband/hw/hfi1/netdev_rx.c +@@ -173,8 +173,7 @@ u32 hfi1_num_netdev_contexts(struct hfi1_devdata *dd, u32 available_contexts, + return 0; + } + +- cpumask_and(node_cpu_mask, cpu_mask, +- cpumask_of_node(pcibus_to_node(dd->pcidev->bus))); ++ cpumask_and(node_cpu_mask, cpu_mask, cpumask_of_node(dd->node)); + + available_cpus = cpumask_weight(node_cpu_mask); + +diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c +index 511c95bb3d012..cdfb7732dff3e 100644 +--- a/drivers/infiniband/hw/qedr/verbs.c ++++ b/drivers/infiniband/hw/qedr/verbs.c +@@ -1241,7 +1241,8 @@ static int qedr_check_qp_attrs(struct ib_pd *ibpd, struct qedr_dev *dev, + * TGT QP isn't associated with RQ/SQ + */ + if ((attrs->qp_type != IB_QPT_GSI) && (dev->gsi_qp_created) && +- (attrs->qp_type != IB_QPT_XRC_TGT)) { ++ (attrs->qp_type != IB_QPT_XRC_TGT) && ++ (attrs->qp_type != IB_QPT_XRC_INI)) { + struct qedr_cq *send_cq = get_qedr_cq(attrs->send_cq); + struct qedr_cq *recv_cq = get_qedr_cq(attrs->recv_cq); + +diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c +index 6eb95e3c4c8a4..6ff97fbf87566 100644 +--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c +@@ -2739,8 +2739,8 @@ void rtrs_clt_close(struct rtrs_clt *clt) + + /* Now it is safe to iterate over all paths without locks */ + list_for_each_entry_safe(sess, tmp, &clt->paths_list, s.entry) { +- rtrs_clt_destroy_sess_files(sess, NULL); + rtrs_clt_close_conns(sess, true); ++ rtrs_clt_destroy_sess_files(sess, NULL); + kobject_put(&sess->kobj); + } + free_clt(clt); +diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c +index 22d814ae4edcd..42c3046fa3047 100644 +--- a/drivers/net/can/spi/mcp251x.c ++++ b/drivers/net/can/spi/mcp251x.c +@@ -314,6 +314,18 @@ static int mcp251x_spi_trans(struct spi_device *spi, int len) + return ret; + } + ++static int mcp251x_spi_write(struct spi_device *spi, int len) ++{ ++ struct mcp251x_priv *priv = spi_get_drvdata(spi); ++ int ret; ++ ++ ret = spi_write(spi, priv->spi_tx_buf, len); ++ if (ret) ++ dev_err(&spi->dev, "spi write failed: ret = %d\n", ret); ++ ++ return ret; ++} ++ + static u8 mcp251x_read_reg(struct spi_device *spi, u8 reg) + { + struct mcp251x_priv *priv = spi_get_drvdata(spi); +@@ -361,7 +373,7 @@ static void mcp251x_write_reg(struct spi_device *spi, u8 reg, u8 val) + priv->spi_tx_buf[1] = reg; + priv->spi_tx_buf[2] = val; + +- mcp251x_spi_trans(spi, 3); ++ mcp251x_spi_write(spi, 3); + } + + static void mcp251x_write_2regs(struct spi_device *spi, u8 reg, u8 v1, u8 v2) +@@ -373,7 +385,7 @@ static void mcp251x_write_2regs(struct spi_device *spi, u8 reg, u8 v1, u8 v2) + priv->spi_tx_buf[2] = v1; + priv->spi_tx_buf[3] = v2; + +- mcp251x_spi_trans(spi, 4); ++ mcp251x_spi_write(spi, 4); + } + + static void mcp251x_write_bits(struct spi_device *spi, u8 reg, +@@ -386,7 +398,7 @@ static void mcp251x_write_bits(struct spi_device *spi, u8 reg, + priv->spi_tx_buf[2] = mask; + priv->spi_tx_buf[3] = val; + +- mcp251x_spi_trans(spi, 4); ++ mcp251x_spi_write(spi, 4); + } + + static u8 mcp251x_read_stat(struct spi_device *spi) +@@ -618,7 +630,7 @@ static void mcp251x_hw_tx_frame(struct spi_device *spi, u8 *buf, + buf[i]); + } else { + memcpy(priv->spi_tx_buf, buf, TXBDAT_OFF + len); +- mcp251x_spi_trans(spi, TXBDAT_OFF + len); ++ mcp251x_spi_write(spi, TXBDAT_OFF + len); + } + } + +@@ -650,7 +662,7 @@ static void mcp251x_hw_tx(struct spi_device *spi, struct can_frame *frame, + + /* use INSTRUCTION_RTS, to avoid "repeated frame problem" */ + priv->spi_tx_buf[0] = INSTRUCTION_RTS(1 << tx_buf_idx); +- mcp251x_spi_trans(priv->spi, 1); ++ mcp251x_spi_write(priv->spi, 1); + } + + static void mcp251x_hw_rx_frame(struct spi_device *spi, u8 *buf, +@@ -888,7 +900,7 @@ static int mcp251x_hw_reset(struct spi_device *spi) + mdelay(MCP251X_OST_DELAY_MS); + + priv->spi_tx_buf[0] = INSTRUCTION_RESET; +- ret = mcp251x_spi_trans(spi, 1); ++ ret = mcp251x_spi_write(spi, 1); + if (ret) + return ret; + +diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c +index 204ccb27d6d9a..73c1bc3cb70d3 100644 +--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c ++++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c +@@ -856,7 +856,7 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, + if (dev->adapter->dev_set_bus) { + err = dev->adapter->dev_set_bus(dev, 0); + if (err) +- goto lbl_unregister_candev; ++ goto adap_dev_free; + } + + /* get device number early */ +@@ -868,6 +868,10 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, + + return 0; + ++adap_dev_free: ++ if (dev->adapter->dev_free) ++ dev->adapter->dev_free(dev); ++ + lbl_unregister_candev: + unregister_candev(netdev); + +diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c +index 662e68a0e7e61..93c7fa1fd4cb6 100644 +--- a/drivers/net/dsa/lantiq_gswip.c ++++ b/drivers/net/dsa/lantiq_gswip.c +@@ -93,8 +93,12 @@ + + /* GSWIP MII Registers */ + #define GSWIP_MII_CFGp(p) (0x2 * (p)) ++#define GSWIP_MII_CFG_RESET BIT(15) + #define GSWIP_MII_CFG_EN BIT(14) ++#define GSWIP_MII_CFG_ISOLATE BIT(13) + #define GSWIP_MII_CFG_LDCLKDIS BIT(12) ++#define GSWIP_MII_CFG_RGMII_IBS BIT(8) ++#define GSWIP_MII_CFG_RMII_CLK BIT(7) + #define GSWIP_MII_CFG_MODE_MIIP 0x0 + #define GSWIP_MII_CFG_MODE_MIIM 0x1 + #define GSWIP_MII_CFG_MODE_RMIIP 0x2 +@@ -190,6 +194,23 @@ + #define GSWIP_PCE_DEFPVID(p) (0x486 + ((p) * 0xA)) + + #define GSWIP_MAC_FLEN 0x8C5 ++#define GSWIP_MAC_CTRL_0p(p) (0x903 + ((p) * 0xC)) ++#define GSWIP_MAC_CTRL_0_PADEN BIT(8) ++#define GSWIP_MAC_CTRL_0_FCS_EN BIT(7) ++#define GSWIP_MAC_CTRL_0_FCON_MASK 0x0070 ++#define GSWIP_MAC_CTRL_0_FCON_AUTO 0x0000 ++#define GSWIP_MAC_CTRL_0_FCON_RX 0x0010 ++#define GSWIP_MAC_CTRL_0_FCON_TX 0x0020 ++#define GSWIP_MAC_CTRL_0_FCON_RXTX 0x0030 ++#define GSWIP_MAC_CTRL_0_FCON_NONE 0x0040 ++#define GSWIP_MAC_CTRL_0_FDUP_MASK 0x000C ++#define GSWIP_MAC_CTRL_0_FDUP_AUTO 0x0000 ++#define GSWIP_MAC_CTRL_0_FDUP_EN 0x0004 ++#define GSWIP_MAC_CTRL_0_FDUP_DIS 0x000C ++#define GSWIP_MAC_CTRL_0_GMII_MASK 0x0003 ++#define GSWIP_MAC_CTRL_0_GMII_AUTO 0x0000 ++#define GSWIP_MAC_CTRL_0_GMII_MII 0x0001 ++#define GSWIP_MAC_CTRL_0_GMII_RGMII 0x0002 + #define GSWIP_MAC_CTRL_2p(p) (0x905 + ((p) * 0xC)) + #define GSWIP_MAC_CTRL_2_MLEN BIT(3) /* Maximum Untagged Frame Lnegth */ + +@@ -653,16 +674,13 @@ static int gswip_port_enable(struct dsa_switch *ds, int port, + GSWIP_SDMA_PCTRLp(port)); + + if (!dsa_is_cpu_port(ds, port)) { +- u32 macconf = GSWIP_MDIO_PHY_LINK_AUTO | +- GSWIP_MDIO_PHY_SPEED_AUTO | +- GSWIP_MDIO_PHY_FDUP_AUTO | +- GSWIP_MDIO_PHY_FCONTX_AUTO | +- GSWIP_MDIO_PHY_FCONRX_AUTO | +- (phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK); +- +- gswip_mdio_w(priv, macconf, GSWIP_MDIO_PHYp(port)); +- /* Activate MDIO auto polling */ +- gswip_mdio_mask(priv, 0, BIT(port), GSWIP_MDIO_MDC_CFG0); ++ u32 mdio_phy = 0; ++ ++ if (phydev) ++ mdio_phy = phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK; ++ ++ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_ADDR_MASK, mdio_phy, ++ GSWIP_MDIO_PHYp(port)); + } + + return 0; +@@ -675,14 +693,6 @@ static void gswip_port_disable(struct dsa_switch *ds, int port) + if (!dsa_is_user_port(ds, port)) + return; + +- if (!dsa_is_cpu_port(ds, port)) { +- gswip_mdio_mask(priv, GSWIP_MDIO_PHY_LINK_DOWN, +- GSWIP_MDIO_PHY_LINK_MASK, +- GSWIP_MDIO_PHYp(port)); +- /* Deactivate MDIO auto polling */ +- gswip_mdio_mask(priv, BIT(port), 0, GSWIP_MDIO_MDC_CFG0); +- } +- + gswip_switch_mask(priv, GSWIP_FDMA_PCTRL_EN, 0, + GSWIP_FDMA_PCTRLp(port)); + gswip_switch_mask(priv, GSWIP_SDMA_PCTRL_EN, 0, +@@ -806,14 +816,32 @@ static int gswip_setup(struct dsa_switch *ds) + gswip_switch_w(priv, BIT(cpu_port), GSWIP_PCE_PMAP2); + gswip_switch_w(priv, BIT(cpu_port), GSWIP_PCE_PMAP3); + +- /* disable PHY auto polling */ ++ /* Deactivate MDIO PHY auto polling. Some PHYs as the AR8030 have an ++ * interoperability problem with this auto polling mechanism because ++ * their status registers think that the link is in a different state ++ * than it actually is. For the AR8030 it has the BMSR_ESTATEN bit set ++ * as well as ESTATUS_1000_TFULL and ESTATUS_1000_XFULL. This makes the ++ * auto polling state machine consider the link being negotiated with ++ * 1Gbit/s. Since the PHY itself is a Fast Ethernet RMII PHY this leads ++ * to the switch port being completely dead (RX and TX are both not ++ * working). ++ * Also with various other PHY / port combinations (PHY11G GPHY, PHY22F ++ * GPHY, external RGMII PEF7071/7072) any traffic would stop. Sometimes ++ * it would work fine for a few minutes to hours and then stop, on ++ * other device it would no traffic could be sent or received at all. ++ * Testing shows that when PHY auto polling is disabled these problems ++ * go away. ++ */ + gswip_mdio_w(priv, 0x0, GSWIP_MDIO_MDC_CFG0); ++ + /* Configure the MDIO Clock 2.5 MHz */ + gswip_mdio_mask(priv, 0xff, 0x09, GSWIP_MDIO_MDC_CFG1); + +- /* Disable the xMII link */ ++ /* Disable the xMII interface and clear it's isolation bit */ + for (i = 0; i < priv->hw_info->max_ports; i++) +- gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, i); ++ gswip_mii_mask_cfg(priv, ++ GSWIP_MII_CFG_EN | GSWIP_MII_CFG_ISOLATE, ++ 0, i); + + /* enable special tag insertion on cpu port */ + gswip_switch_mask(priv, 0, GSWIP_FDMA_PCTRL_STEN, +@@ -1464,6 +1492,112 @@ unsupported: + return; + } + ++static void gswip_port_set_link(struct gswip_priv *priv, int port, bool link) ++{ ++ u32 mdio_phy; ++ ++ if (link) ++ mdio_phy = GSWIP_MDIO_PHY_LINK_UP; ++ else ++ mdio_phy = GSWIP_MDIO_PHY_LINK_DOWN; ++ ++ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_LINK_MASK, mdio_phy, ++ GSWIP_MDIO_PHYp(port)); ++} ++ ++static void gswip_port_set_speed(struct gswip_priv *priv, int port, int speed, ++ phy_interface_t interface) ++{ ++ u32 mdio_phy = 0, mii_cfg = 0, mac_ctrl_0 = 0; ++ ++ switch (speed) { ++ case SPEED_10: ++ mdio_phy = GSWIP_MDIO_PHY_SPEED_M10; ++ ++ if (interface == PHY_INTERFACE_MODE_RMII) ++ mii_cfg = GSWIP_MII_CFG_RATE_M50; ++ else ++ mii_cfg = GSWIP_MII_CFG_RATE_M2P5; ++ ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_GMII_MII; ++ break; ++ ++ case SPEED_100: ++ mdio_phy = GSWIP_MDIO_PHY_SPEED_M100; ++ ++ if (interface == PHY_INTERFACE_MODE_RMII) ++ mii_cfg = GSWIP_MII_CFG_RATE_M50; ++ else ++ mii_cfg = GSWIP_MII_CFG_RATE_M25; ++ ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_GMII_MII; ++ break; ++ ++ case SPEED_1000: ++ mdio_phy = GSWIP_MDIO_PHY_SPEED_G1; ++ ++ mii_cfg = GSWIP_MII_CFG_RATE_M125; ++ ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_GMII_RGMII; ++ break; ++ } ++ ++ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_SPEED_MASK, mdio_phy, ++ GSWIP_MDIO_PHYp(port)); ++ gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_RATE_MASK, mii_cfg, port); ++ gswip_switch_mask(priv, GSWIP_MAC_CTRL_0_GMII_MASK, mac_ctrl_0, ++ GSWIP_MAC_CTRL_0p(port)); ++} ++ ++static void gswip_port_set_duplex(struct gswip_priv *priv, int port, int duplex) ++{ ++ u32 mac_ctrl_0, mdio_phy; ++ ++ if (duplex == DUPLEX_FULL) { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FDUP_EN; ++ mdio_phy = GSWIP_MDIO_PHY_FDUP_EN; ++ } else { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FDUP_DIS; ++ mdio_phy = GSWIP_MDIO_PHY_FDUP_DIS; ++ } ++ ++ gswip_switch_mask(priv, GSWIP_MAC_CTRL_0_FDUP_MASK, mac_ctrl_0, ++ GSWIP_MAC_CTRL_0p(port)); ++ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_FDUP_MASK, mdio_phy, ++ GSWIP_MDIO_PHYp(port)); ++} ++ ++static void gswip_port_set_pause(struct gswip_priv *priv, int port, ++ bool tx_pause, bool rx_pause) ++{ ++ u32 mac_ctrl_0, mdio_phy; ++ ++ if (tx_pause && rx_pause) { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_RXTX; ++ mdio_phy = GSWIP_MDIO_PHY_FCONTX_EN | ++ GSWIP_MDIO_PHY_FCONRX_EN; ++ } else if (tx_pause) { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_TX; ++ mdio_phy = GSWIP_MDIO_PHY_FCONTX_EN | ++ GSWIP_MDIO_PHY_FCONRX_DIS; ++ } else if (rx_pause) { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_RX; ++ mdio_phy = GSWIP_MDIO_PHY_FCONTX_DIS | ++ GSWIP_MDIO_PHY_FCONRX_EN; ++ } else { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_NONE; ++ mdio_phy = GSWIP_MDIO_PHY_FCONTX_DIS | ++ GSWIP_MDIO_PHY_FCONRX_DIS; ++ } ++ ++ gswip_switch_mask(priv, GSWIP_MAC_CTRL_0_FCON_MASK, ++ mac_ctrl_0, GSWIP_MAC_CTRL_0p(port)); ++ gswip_mdio_mask(priv, ++ GSWIP_MDIO_PHY_FCONTX_MASK | ++ GSWIP_MDIO_PHY_FCONRX_MASK, ++ mdio_phy, GSWIP_MDIO_PHYp(port)); ++} ++ + static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, + unsigned int mode, + const struct phylink_link_state *state) +@@ -1483,6 +1617,9 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, + break; + case PHY_INTERFACE_MODE_RMII: + miicfg |= GSWIP_MII_CFG_MODE_RMIIM; ++ ++ /* Configure the RMII clock as output: */ ++ miicfg |= GSWIP_MII_CFG_RMII_CLK; + break; + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: +@@ -1495,7 +1632,11 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, + "Unsupported interface: %d\n", state->interface); + return; + } +- gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_MODE_MASK, miicfg, port); ++ ++ gswip_mii_mask_cfg(priv, ++ GSWIP_MII_CFG_MODE_MASK | GSWIP_MII_CFG_RMII_CLK | ++ GSWIP_MII_CFG_RGMII_IBS | GSWIP_MII_CFG_LDCLKDIS, ++ miicfg, port); + + switch (state->interface) { + case PHY_INTERFACE_MODE_RGMII_ID: +@@ -1520,6 +1661,9 @@ static void gswip_phylink_mac_link_down(struct dsa_switch *ds, int port, + struct gswip_priv *priv = ds->priv; + + gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, port); ++ ++ if (!dsa_is_cpu_port(ds, port)) ++ gswip_port_set_link(priv, port, false); + } + + static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port, +@@ -1531,6 +1675,13 @@ static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port, + { + struct gswip_priv *priv = ds->priv; + ++ if (!dsa_is_cpu_port(ds, port)) { ++ gswip_port_set_link(priv, port, true); ++ gswip_port_set_speed(priv, port, speed, interface); ++ gswip_port_set_duplex(priv, port, duplex); ++ gswip_port_set_pause(priv, port, tx_pause, rx_pause); ++ } ++ + gswip_mii_mask_cfg(priv, 0, GSWIP_MII_CFG_EN, port); + } + +diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h +index ba8321ec1ee73..3305979a9f7c1 100644 +--- a/drivers/net/ethernet/amd/xgbe/xgbe.h ++++ b/drivers/net/ethernet/amd/xgbe/xgbe.h +@@ -180,9 +180,9 @@ + #define XGBE_DMA_SYS_AWCR 0x30303030 + + /* DMA cache settings - PCI device */ +-#define XGBE_DMA_PCI_ARCR 0x00000003 +-#define XGBE_DMA_PCI_AWCR 0x13131313 +-#define XGBE_DMA_PCI_AWARCR 0x00000313 ++#define XGBE_DMA_PCI_ARCR 0x000f0f0f ++#define XGBE_DMA_PCI_AWCR 0x0f0f0f0f ++#define XGBE_DMA_PCI_AWARCR 0x00000f0f + + /* DMA channel interrupt modes */ + #define XGBE_IRQ_MODE_EDGE 0 +diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c +index 286f0341bdf83..48a6bda2a8cc7 100644 +--- a/drivers/net/ethernet/cadence/macb_main.c ++++ b/drivers/net/ethernet/cadence/macb_main.c +@@ -3111,6 +3111,9 @@ static void gem_prog_cmp_regs(struct macb *bp, struct ethtool_rx_flow_spec *fs) + bool cmp_b = false; + bool cmp_c = false; + ++ if (!macb_is_gem(bp)) ++ return; ++ + tp4sp_v = &(fs->h_u.tcp_ip4_spec); + tp4sp_m = &(fs->m_u.tcp_ip4_spec); + +@@ -3479,6 +3482,7 @@ static void macb_restore_features(struct macb *bp) + { + struct net_device *netdev = bp->dev; + netdev_features_t features = netdev->features; ++ struct ethtool_rx_fs_item *item; + + /* TX checksum offload */ + macb_set_txcsum_feature(bp, features); +@@ -3487,6 +3491,9 @@ static void macb_restore_features(struct macb *bp) + macb_set_rxcsum_feature(bp, features); + + /* RX Flow Filters */ ++ list_for_each_entry(item, &bp->rx_fs_list.list, list) ++ gem_prog_cmp_regs(bp, &item->fs); ++ + macb_set_rxflow_feature(bp, features); + } + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +index 75474f8102490..c5b0e725b2382 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +@@ -1794,11 +1794,25 @@ int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init, + struct cudbg_buffer temp_buff = { 0 }; + struct sge_qbase_reg_field *sge_qbase; + struct ireg_buf *ch_sge_dbg; ++ u8 padap_running = 0; + int i, rc; ++ u32 size; + +- rc = cudbg_get_buff(pdbg_init, dbg_buff, +- sizeof(*ch_sge_dbg) * 2 + sizeof(*sge_qbase), +- &temp_buff); ++ /* Accessing SGE_QBASE_MAP[0-3] and SGE_QBASE_INDEX regs can ++ * lead to SGE missing doorbells under heavy traffic. So, only ++ * collect them when adapter is idle. ++ */ ++ for_each_port(padap, i) { ++ padap_running = netif_running(padap->port[i]); ++ if (padap_running) ++ break; ++ } ++ ++ size = sizeof(*ch_sge_dbg) * 2; ++ if (!padap_running) ++ size += sizeof(*sge_qbase); ++ ++ rc = cudbg_get_buff(pdbg_init, dbg_buff, size, &temp_buff); + if (rc) + return rc; + +@@ -1820,7 +1834,8 @@ int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init, + ch_sge_dbg++; + } + +- if (CHELSIO_CHIP_VERSION(padap->params.chip) > CHELSIO_T5) { ++ if (CHELSIO_CHIP_VERSION(padap->params.chip) > CHELSIO_T5 && ++ !padap_running) { + sge_qbase = (struct sge_qbase_reg_field *)ch_sge_dbg; + /* 1 addr reg SGE_QBASE_INDEX and 4 data reg + * SGE_QBASE_MAP[0-3] +diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +index 98d01a7497ecd..581670dced6ec 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +@@ -2090,7 +2090,8 @@ void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size) + 0x1190, 0x1194, + 0x11a0, 0x11a4, + 0x11b0, 0x11b4, +- 0x11fc, 0x1274, ++ 0x11fc, 0x123c, ++ 0x1254, 0x1274, + 0x1280, 0x133c, + 0x1800, 0x18fc, + 0x3000, 0x302c, +diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c +index 4fab2ee5bbf58..e4d9c4c640e55 100644 +--- a/drivers/net/ethernet/freescale/gianfar.c ++++ b/drivers/net/ethernet/freescale/gianfar.c +@@ -364,7 +364,11 @@ static void gfar_set_mac_for_addr(struct net_device *dev, int num, + + static int gfar_set_mac_addr(struct net_device *dev, void *p) + { +- eth_mac_addr(dev, p); ++ int ret; ++ ++ ret = eth_mac_addr(dev, p); ++ if (ret) ++ return ret; + + gfar_set_mac_for_addr(dev, 0, dev->dev_addr); + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +index dc5d150a9c546..ac6980acb6f02 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +@@ -2554,14 +2554,14 @@ static int hclgevf_ae_start(struct hnae3_handle *handle) + { + struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); + ++ clear_bit(HCLGEVF_STATE_DOWN, &hdev->state); ++ + hclgevf_reset_tqp_stats(handle); + + hclgevf_request_link_info(hdev); + + hclgevf_update_link_mode(hdev); + +- clear_bit(HCLGEVF_STATE_DOWN, &hdev->state); +- + return 0; + } + +diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h +index 118473dfdcbd2..fe1258778cbc4 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e.h ++++ b/drivers/net/ethernet/intel/i40e/i40e.h +@@ -142,6 +142,7 @@ enum i40e_state_t { + __I40E_VIRTCHNL_OP_PENDING, + __I40E_RECOVERY_MODE, + __I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */ ++ __I40E_VFS_RELEASING, + /* This must be last as it determines the size of the BITMAP */ + __I40E_STATE_SIZE__, + }; +diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c +index d7c13ca9be7dd..d627b59ad4465 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c +@@ -578,6 +578,9 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, + case RING_TYPE_XDP: + ring = kmemdup(vsi->xdp_rings[ring_id], sizeof(*ring), GFP_KERNEL); + break; ++ default: ++ ring = NULL; ++ break; + } + if (!ring) + return; +diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +index 9e81f85ee2d8d..31d48a85cfaf0 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +@@ -232,6 +232,8 @@ static void __i40e_add_stat_strings(u8 **p, const struct i40e_stats stats[], + I40E_STAT(struct i40e_vsi, _name, _stat) + #define I40E_VEB_STAT(_name, _stat) \ + I40E_STAT(struct i40e_veb, _name, _stat) ++#define I40E_VEB_TC_STAT(_name, _stat) \ ++ I40E_STAT(struct i40e_cp_veb_tc_stats, _name, _stat) + #define I40E_PFC_STAT(_name, _stat) \ + I40E_STAT(struct i40e_pfc_stats, _name, _stat) + #define I40E_QUEUE_STAT(_name, _stat) \ +@@ -266,11 +268,18 @@ static const struct i40e_stats i40e_gstrings_veb_stats[] = { + I40E_VEB_STAT("veb.rx_unknown_protocol", stats.rx_unknown_protocol), + }; + ++struct i40e_cp_veb_tc_stats { ++ u64 tc_rx_packets; ++ u64 tc_rx_bytes; ++ u64 tc_tx_packets; ++ u64 tc_tx_bytes; ++}; ++ + static const struct i40e_stats i40e_gstrings_veb_tc_stats[] = { +- I40E_VEB_STAT("veb.tc_%u_tx_packets", tc_stats.tc_tx_packets), +- I40E_VEB_STAT("veb.tc_%u_tx_bytes", tc_stats.tc_tx_bytes), +- I40E_VEB_STAT("veb.tc_%u_rx_packets", tc_stats.tc_rx_packets), +- I40E_VEB_STAT("veb.tc_%u_rx_bytes", tc_stats.tc_rx_bytes), ++ I40E_VEB_TC_STAT("veb.tc_%u_tx_packets", tc_tx_packets), ++ I40E_VEB_TC_STAT("veb.tc_%u_tx_bytes", tc_tx_bytes), ++ I40E_VEB_TC_STAT("veb.tc_%u_rx_packets", tc_rx_packets), ++ I40E_VEB_TC_STAT("veb.tc_%u_rx_bytes", tc_rx_bytes), + }; + + static const struct i40e_stats i40e_gstrings_misc_stats[] = { +@@ -1101,6 +1110,7 @@ static int i40e_get_link_ksettings(struct net_device *netdev, + + /* Set flow control settings */ + ethtool_link_ksettings_add_link_mode(ks, supported, Pause); ++ ethtool_link_ksettings_add_link_mode(ks, supported, Asym_Pause); + + switch (hw->fc.requested_mode) { + case I40E_FC_FULL: +@@ -2216,6 +2226,29 @@ static int i40e_get_sset_count(struct net_device *netdev, int sset) + } + } + ++/** ++ * i40e_get_veb_tc_stats - copy VEB TC statistics to formatted structure ++ * @tc: the TC statistics in VEB structure (veb->tc_stats) ++ * @i: the index of traffic class in (veb->tc_stats) structure to copy ++ * ++ * Copy VEB TC statistics from structure of arrays (veb->tc_stats) to ++ * one dimensional structure i40e_cp_veb_tc_stats. ++ * Produce formatted i40e_cp_veb_tc_stats structure of the VEB TC ++ * statistics for the given TC. ++ **/ ++static struct i40e_cp_veb_tc_stats ++i40e_get_veb_tc_stats(struct i40e_veb_tc_stats *tc, unsigned int i) ++{ ++ struct i40e_cp_veb_tc_stats veb_tc = { ++ .tc_rx_packets = tc->tc_rx_packets[i], ++ .tc_rx_bytes = tc->tc_rx_bytes[i], ++ .tc_tx_packets = tc->tc_tx_packets[i], ++ .tc_tx_bytes = tc->tc_tx_bytes[i], ++ }; ++ ++ return veb_tc; ++} ++ + /** + * i40e_get_pfc_stats - copy HW PFC statistics to formatted structure + * @pf: the PF device structure +@@ -2300,8 +2333,16 @@ static void i40e_get_ethtool_stats(struct net_device *netdev, + i40e_gstrings_veb_stats); + + for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) +- i40e_add_ethtool_stats(&data, veb_stats ? veb : NULL, +- i40e_gstrings_veb_tc_stats); ++ if (veb_stats) { ++ struct i40e_cp_veb_tc_stats veb_tc = ++ i40e_get_veb_tc_stats(&veb->tc_stats, i); ++ ++ i40e_add_ethtool_stats(&data, &veb_tc, ++ i40e_gstrings_veb_tc_stats); ++ } else { ++ i40e_add_ethtool_stats(&data, NULL, ++ i40e_gstrings_veb_tc_stats); ++ } + + i40e_add_ethtool_stats(&data, pf, i40e_gstrings_stats); + +@@ -5244,7 +5285,7 @@ static int i40e_get_module_eeprom(struct net_device *netdev, + + status = i40e_aq_get_phy_register(hw, + I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE, +- true, addr, offset, &value, NULL); ++ addr, true, offset, &value, NULL); + if (status) + return -EIO; + data[i] = value; +diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c +index 4a2d03cada01e..7fab60128c76d 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_main.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c +@@ -2560,8 +2560,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) + i40e_stat_str(hw, aq_ret), + i40e_aq_str(hw, hw->aq.asq_last_status)); + } else { +- dev_info(&pf->pdev->dev, "%s is %s allmulti mode.\n", +- vsi->netdev->name, ++ dev_info(&pf->pdev->dev, "%s allmulti mode.\n", + cur_multipromisc ? "entering" : "leaving"); + } + } +@@ -14647,12 +14646,16 @@ static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw) + * in order to register the netdev + */ + v_idx = i40e_vsi_mem_alloc(pf, I40E_VSI_MAIN); +- if (v_idx < 0) ++ if (v_idx < 0) { ++ err = v_idx; + goto err_switch_setup; ++ } + pf->lan_vsi = v_idx; + vsi = pf->vsi[v_idx]; +- if (!vsi) ++ if (!vsi) { ++ err = -EFAULT; + goto err_switch_setup; ++ } + vsi->alloc_queue_pairs = 1; + err = i40e_config_netdev(vsi); + if (err) +diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c +index 899714243af7a..62b439232fa50 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c +@@ -2187,8 +2187,7 @@ int i40e_xmit_xdp_tx_ring(struct xdp_buff *xdp, struct i40e_ring *xdp_ring) + * @rx_ring: Rx ring being processed + * @xdp: XDP buffer containing the frame + **/ +-static struct sk_buff *i40e_run_xdp(struct i40e_ring *rx_ring, +- struct xdp_buff *xdp) ++static int i40e_run_xdp(struct i40e_ring *rx_ring, struct xdp_buff *xdp) + { + int err, result = I40E_XDP_PASS; + struct i40e_ring *xdp_ring; +@@ -2227,7 +2226,7 @@ static struct sk_buff *i40e_run_xdp(struct i40e_ring *rx_ring, + } + xdp_out: + rcu_read_unlock(); +- return ERR_PTR(-result); ++ return result; + } + + /** +@@ -2339,6 +2338,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) + unsigned int xdp_xmit = 0; + bool failure = false; + struct xdp_buff xdp; ++ int xdp_res = 0; + + #if (PAGE_SIZE < 8192) + xdp.frame_sz = i40e_rx_frame_truesize(rx_ring, 0); +@@ -2405,12 +2405,10 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) + /* At larger PAGE_SIZE, frame_sz depend on len size */ + xdp.frame_sz = i40e_rx_frame_truesize(rx_ring, size); + #endif +- skb = i40e_run_xdp(rx_ring, &xdp); ++ xdp_res = i40e_run_xdp(rx_ring, &xdp); + } + +- if (IS_ERR(skb)) { +- unsigned int xdp_res = -PTR_ERR(skb); +- ++ if (xdp_res) { + if (xdp_res & (I40E_XDP_TX | I40E_XDP_REDIR)) { + xdp_xmit |= xdp_res; + i40e_rx_buffer_flip(rx_ring, rx_buffer, size); +diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +index 3b269c70dcfe1..e4f13a49c3df8 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +@@ -137,6 +137,7 @@ void i40e_vc_notify_vf_reset(struct i40e_vf *vf) + **/ + static inline void i40e_vc_disable_vf(struct i40e_vf *vf) + { ++ struct i40e_pf *pf = vf->pf; + int i; + + i40e_vc_notify_vf_reset(vf); +@@ -147,6 +148,11 @@ static inline void i40e_vc_disable_vf(struct i40e_vf *vf) + * ensure a reset. + */ + for (i = 0; i < 20; i++) { ++ /* If PF is in VFs releasing state reset VF is impossible, ++ * so leave it. ++ */ ++ if (test_bit(__I40E_VFS_RELEASING, pf->state)) ++ return; + if (i40e_reset_vf(vf, false)) + return; + usleep_range(10000, 20000); +@@ -1574,6 +1580,8 @@ void i40e_free_vfs(struct i40e_pf *pf) + + if (!pf->vf) + return; ++ ++ set_bit(__I40E_VFS_RELEASING, pf->state); + while (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) + usleep_range(1000, 2000); + +@@ -1631,6 +1639,7 @@ void i40e_free_vfs(struct i40e_pf *pf) + } + } + clear_bit(__I40E_VF_DISABLE, pf->state); ++ clear_bit(__I40E_VFS_RELEASING, pf->state); + } + + #ifdef CONFIG_PCI_IOV +diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h +index 5b3f2bb22eba7..6a57b41ddb545 100644 +--- a/drivers/net/ethernet/intel/ice/ice.h ++++ b/drivers/net/ethernet/intel/ice/ice.h +@@ -194,7 +194,6 @@ enum ice_state { + __ICE_NEEDS_RESTART, + __ICE_PREPARED_FOR_RESET, /* set by driver when prepared */ + __ICE_RESET_OICR_RECV, /* set by driver after rcv reset OICR */ +- __ICE_DCBNL_DEVRESET, /* set by dcbnl devreset */ + __ICE_PFR_REQ, /* set by driver and peers */ + __ICE_CORER_REQ, /* set by driver and peers */ + __ICE_GLOBR_REQ, /* set by driver and peers */ +@@ -587,7 +586,7 @@ int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset); + void ice_print_link_msg(struct ice_vsi *vsi, bool isup); + const char *ice_stat_str(enum ice_status stat_err); + const char *ice_aq_str(enum ice_aq_err aq_err); +-bool ice_is_wol_supported(struct ice_pf *pf); ++bool ice_is_wol_supported(struct ice_hw *hw); + int + ice_fdir_write_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input, bool add, + bool is_tun); +@@ -605,6 +604,7 @@ int ice_fdir_create_dflt_rules(struct ice_pf *pf); + int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout, + struct ice_rq_event_info *event); + int ice_open(struct net_device *netdev); ++int ice_open_internal(struct net_device *netdev); + int ice_stop(struct net_device *netdev); + void ice_service_task_schedule(struct ice_pf *pf); + +diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c +index 7db5fd9773672..2239a5f45e5a7 100644 +--- a/drivers/net/ethernet/intel/ice/ice_common.c ++++ b/drivers/net/ethernet/intel/ice/ice_common.c +@@ -717,8 +717,8 @@ static enum ice_status ice_cfg_fw_log(struct ice_hw *hw, bool enable) + + if (!data) { + data = devm_kcalloc(ice_hw_to_dev(hw), +- sizeof(*data), + ICE_AQC_FW_LOG_ID_MAX, ++ sizeof(*data), + GFP_KERNEL); + if (!data) + return ICE_ERR_NO_MEMORY; +diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.h b/drivers/net/ethernet/intel/ice/ice_controlq.h +index faaa08e8171b5..68866f4f0eb09 100644 +--- a/drivers/net/ethernet/intel/ice/ice_controlq.h ++++ b/drivers/net/ethernet/intel/ice/ice_controlq.h +@@ -31,8 +31,8 @@ enum ice_ctl_q { + ICE_CTL_Q_MAILBOX, + }; + +-/* Control Queue timeout settings - max delay 250ms */ +-#define ICE_CTL_Q_SQ_CMD_TIMEOUT 2500 /* Count 2500 times */ ++/* Control Queue timeout settings - max delay 1s */ ++#define ICE_CTL_Q_SQ_CMD_TIMEOUT 10000 /* Count 10000 times */ + #define ICE_CTL_Q_SQ_CMD_USEC 100 /* Check every 100usec */ + #define ICE_CTL_Q_ADMIN_INIT_TIMEOUT 10 /* Count 10 times */ + #define ICE_CTL_Q_ADMIN_INIT_MSEC 100 /* Check every 100msec */ +diff --git a/drivers/net/ethernet/intel/ice/ice_dcb.c b/drivers/net/ethernet/intel/ice/ice_dcb.c +index 2a3147ee0bbb1..211ac6f907adb 100644 +--- a/drivers/net/ethernet/intel/ice/ice_dcb.c ++++ b/drivers/net/ethernet/intel/ice/ice_dcb.c +@@ -738,22 +738,27 @@ ice_aq_get_cee_dcb_cfg(struct ice_hw *hw, + /** + * ice_cee_to_dcb_cfg + * @cee_cfg: pointer to CEE configuration struct +- * @dcbcfg: DCB configuration struct ++ * @pi: port information structure + * + * Convert CEE configuration from firmware to DCB configuration + */ + static void + ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, +- struct ice_dcbx_cfg *dcbcfg) ++ struct ice_port_info *pi) + { + u32 status, tlv_status = le32_to_cpu(cee_cfg->tlv_status); + u32 ice_aqc_cee_status_mask, ice_aqc_cee_status_shift; ++ u8 i, j, err, sync, oper, app_index, ice_app_sel_type; + u16 app_prio = le16_to_cpu(cee_cfg->oper_app_prio); +- u8 i, err, sync, oper, app_index, ice_app_sel_type; + u16 ice_aqc_cee_app_mask, ice_aqc_cee_app_shift; ++ struct ice_dcbx_cfg *cmp_dcbcfg, *dcbcfg; + u16 ice_app_prot_id_type; + +- /* CEE PG data to ETS config */ ++ dcbcfg = &pi->qos_cfg.local_dcbx_cfg; ++ dcbcfg->dcbx_mode = ICE_DCBX_MODE_CEE; ++ dcbcfg->tlv_status = tlv_status; ++ ++ /* CEE PG data */ + dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; + + /* Note that the FW creates the oper_prio_tc nibbles reversed +@@ -780,10 +785,16 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, + } + } + +- /* CEE PFC data to ETS config */ ++ /* CEE PFC data */ + dcbcfg->pfc.pfcena = cee_cfg->oper_pfc_en; + dcbcfg->pfc.pfccap = ICE_MAX_TRAFFIC_CLASS; + ++ /* CEE APP TLV data */ ++ if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING) ++ cmp_dcbcfg = &pi->qos_cfg.desired_dcbx_cfg; ++ else ++ cmp_dcbcfg = &pi->qos_cfg.remote_dcbx_cfg; ++ + app_index = 0; + for (i = 0; i < 3; i++) { + if (i == 0) { +@@ -802,6 +813,18 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, + ice_aqc_cee_app_shift = ICE_AQC_CEE_APP_ISCSI_S; + ice_app_sel_type = ICE_APP_SEL_TCPIP; + ice_app_prot_id_type = ICE_APP_PROT_ID_ISCSI; ++ ++ for (j = 0; j < cmp_dcbcfg->numapps; j++) { ++ u16 prot_id = cmp_dcbcfg->app[j].prot_id; ++ u8 sel = cmp_dcbcfg->app[j].selector; ++ ++ if (sel == ICE_APP_SEL_TCPIP && ++ (prot_id == ICE_APP_PROT_ID_ISCSI || ++ prot_id == ICE_APP_PROT_ID_ISCSI_860)) { ++ ice_app_prot_id_type = prot_id; ++ break; ++ } ++ } + } else { + /* FIP APP */ + ice_aqc_cee_status_mask = ICE_AQC_CEE_FIP_STATUS_M; +@@ -850,9 +873,9 @@ ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode) + return ICE_ERR_PARAM; + + if (dcbx_mode == ICE_DCBX_MODE_IEEE) +- dcbx_cfg = &pi->local_dcbx_cfg; ++ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; + else if (dcbx_mode == ICE_DCBX_MODE_CEE) +- dcbx_cfg = &pi->desired_dcbx_cfg; ++ dcbx_cfg = &pi->qos_cfg.desired_dcbx_cfg; + + /* Get Local DCB Config in case of ICE_DCBX_MODE_IEEE + * or get CEE DCB Desired Config in case of ICE_DCBX_MODE_CEE +@@ -863,7 +886,7 @@ ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode) + goto out; + + /* Get Remote DCB Config */ +- dcbx_cfg = &pi->remote_dcbx_cfg; ++ dcbx_cfg = &pi->qos_cfg.remote_dcbx_cfg; + ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_REMOTE, + ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID, dcbx_cfg); + /* Don't treat ENOENT as an error for Remote MIBs */ +@@ -892,14 +915,11 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi) + ret = ice_aq_get_cee_dcb_cfg(pi->hw, &cee_cfg, NULL); + if (!ret) { + /* CEE mode */ +- dcbx_cfg = &pi->local_dcbx_cfg; +- dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_CEE; +- dcbx_cfg->tlv_status = le32_to_cpu(cee_cfg.tlv_status); +- ice_cee_to_dcb_cfg(&cee_cfg, dcbx_cfg); + ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_CEE); ++ ice_cee_to_dcb_cfg(&cee_cfg, pi); + } else if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) { + /* CEE mode not enabled try querying IEEE data */ +- dcbx_cfg = &pi->local_dcbx_cfg; ++ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; + dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_IEEE; + ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_IEEE); + } +@@ -916,26 +936,26 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi) + */ + enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change) + { +- struct ice_port_info *pi = hw->port_info; ++ struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg; + enum ice_status ret = 0; + + if (!hw->func_caps.common_cap.dcb) + return ICE_ERR_NOT_SUPPORTED; + +- pi->is_sw_lldp = true; ++ qos_cfg->is_sw_lldp = true; + + /* Get DCBX status */ +- pi->dcbx_status = ice_get_dcbx_status(hw); ++ qos_cfg->dcbx_status = ice_get_dcbx_status(hw); + +- if (pi->dcbx_status == ICE_DCBX_STATUS_DONE || +- pi->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS || +- pi->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) { ++ if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DONE || ++ qos_cfg->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS || ++ qos_cfg->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) { + /* Get current DCBX configuration */ +- ret = ice_get_dcb_cfg(pi); ++ ret = ice_get_dcb_cfg(hw->port_info); + if (ret) + return ret; +- pi->is_sw_lldp = false; +- } else if (pi->dcbx_status == ICE_DCBX_STATUS_DIS) { ++ qos_cfg->is_sw_lldp = false; ++ } else if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS) { + return ICE_ERR_NOT_READY; + } + +@@ -943,7 +963,7 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change) + if (enable_mib_change) { + ret = ice_aq_cfg_lldp_mib_change(hw, true, NULL); + if (ret) +- pi->is_sw_lldp = true; ++ qos_cfg->is_sw_lldp = true; + } + + return ret; +@@ -958,21 +978,21 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change) + */ + enum ice_status ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib) + { +- struct ice_port_info *pi = hw->port_info; ++ struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg; + enum ice_status ret; + + if (!hw->func_caps.common_cap.dcb) + return ICE_ERR_NOT_SUPPORTED; + + /* Get DCBX status */ +- pi->dcbx_status = ice_get_dcbx_status(hw); ++ qos_cfg->dcbx_status = ice_get_dcbx_status(hw); + +- if (pi->dcbx_status == ICE_DCBX_STATUS_DIS) ++ if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS) + return ICE_ERR_NOT_READY; + + ret = ice_aq_cfg_lldp_mib_change(hw, ena_mib, NULL); + if (!ret) +- pi->is_sw_lldp = !ena_mib; ++ qos_cfg->is_sw_lldp = !ena_mib; + + return ret; + } +@@ -1270,7 +1290,7 @@ enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi) + hw = pi->hw; + + /* update the HW local config */ +- dcbcfg = &pi->local_dcbx_cfg; ++ dcbcfg = &pi->qos_cfg.local_dcbx_cfg; + /* Allocate the LLDPDU */ + lldpmib = devm_kzalloc(ice_hw_to_dev(hw), ICE_LLDPDU_SIZE, GFP_KERNEL); + if (!lldpmib) +diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c +index 36abd6b7280c8..1e8f71ffc8ce7 100644 +--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c ++++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c +@@ -28,7 +28,7 @@ void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc) + if (netdev_set_num_tc(netdev, vsi->tc_cfg.numtc)) + return; + +- dcbcfg = &pf->hw.port_info->local_dcbx_cfg; ++ dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + + ice_for_each_traffic_class(i) + if (vsi->tc_cfg.ena_tc & BIT(i)) +@@ -134,7 +134,7 @@ static u8 ice_dcb_get_mode(struct ice_port_info *port_info, bool host) + else + mode = DCB_CAP_DCBX_LLD_MANAGED; + +- if (port_info->local_dcbx_cfg.dcbx_mode & ICE_DCBX_MODE_CEE) ++ if (port_info->qos_cfg.local_dcbx_cfg.dcbx_mode & ICE_DCBX_MODE_CEE) + return mode | DCB_CAP_DCBX_VER_CEE; + else + return mode | DCB_CAP_DCBX_VER_IEEE; +@@ -277,10 +277,10 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked) + int ret = ICE_DCB_NO_HW_CHG; + struct ice_vsi *pf_vsi; + +- curr_cfg = &pf->hw.port_info->local_dcbx_cfg; ++ curr_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + + /* FW does not care if change happened */ +- if (!pf->hw.port_info->is_sw_lldp) ++ if (!pf->hw.port_info->qos_cfg.is_sw_lldp) + ret = ICE_DCB_HW_CHG_RST; + + /* Enable DCB tagging only when more than one TC */ +@@ -327,7 +327,7 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked) + /* Only send new config to HW if we are in SW LLDP mode. Otherwise, + * the new config came from the HW in the first place. + */ +- if (pf->hw.port_info->is_sw_lldp) { ++ if (pf->hw.port_info->qos_cfg.is_sw_lldp) { + ret = ice_set_dcb_cfg(pf->hw.port_info); + if (ret) { + dev_err(dev, "Set DCB Config failed\n"); +@@ -360,7 +360,7 @@ free_cfg: + */ + static void ice_cfg_etsrec_defaults(struct ice_port_info *pi) + { +- struct ice_dcbx_cfg *dcbcfg = &pi->local_dcbx_cfg; ++ struct ice_dcbx_cfg *dcbcfg = &pi->qos_cfg.local_dcbx_cfg; + u8 i; + + /* Ensure ETS recommended DCB configuration is not already set */ +@@ -446,7 +446,7 @@ void ice_dcb_rebuild(struct ice_pf *pf) + + mutex_lock(&pf->tc_mutex); + +- if (!pf->hw.port_info->is_sw_lldp) ++ if (!pf->hw.port_info->qos_cfg.is_sw_lldp) + ice_cfg_etsrec_defaults(pf->hw.port_info); + + ret = ice_set_dcb_cfg(pf->hw.port_info); +@@ -455,9 +455,9 @@ void ice_dcb_rebuild(struct ice_pf *pf) + goto dcb_error; + } + +- if (!pf->hw.port_info->is_sw_lldp) { ++ if (!pf->hw.port_info->qos_cfg.is_sw_lldp) { + ret = ice_cfg_lldp_mib_change(&pf->hw, true); +- if (ret && !pf->hw.port_info->is_sw_lldp) { ++ if (ret && !pf->hw.port_info->qos_cfg.is_sw_lldp) { + dev_err(dev, "Failed to register for MIB changes\n"); + goto dcb_error; + } +@@ -510,11 +510,12 @@ static int ice_dcb_init_cfg(struct ice_pf *pf, bool locked) + int ret = 0; + + pi = pf->hw.port_info; +- newcfg = kmemdup(&pi->local_dcbx_cfg, sizeof(*newcfg), GFP_KERNEL); ++ newcfg = kmemdup(&pi->qos_cfg.local_dcbx_cfg, sizeof(*newcfg), ++ GFP_KERNEL); + if (!newcfg) + return -ENOMEM; + +- memset(&pi->local_dcbx_cfg, 0, sizeof(*newcfg)); ++ memset(&pi->qos_cfg.local_dcbx_cfg, 0, sizeof(*newcfg)); + + dev_info(ice_pf_to_dev(pf), "Configuring initial DCB values\n"); + if (ice_pf_dcb_cfg(pf, newcfg, locked)) +@@ -545,7 +546,7 @@ static int ice_dcb_sw_dflt_cfg(struct ice_pf *pf, bool ets_willing, bool locked) + if (!dcbcfg) + return -ENOMEM; + +- memset(&pi->local_dcbx_cfg, 0, sizeof(*dcbcfg)); ++ memset(&pi->qos_cfg.local_dcbx_cfg, 0, sizeof(*dcbcfg)); + + dcbcfg->etscfg.willing = ets_willing ? 1 : 0; + dcbcfg->etscfg.maxtcs = hw->func_caps.common_cap.maxtc; +@@ -608,7 +609,7 @@ static bool ice_dcb_tc_contig(u8 *prio_table) + */ + static int ice_dcb_noncontig_cfg(struct ice_pf *pf) + { +- struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->local_dcbx_cfg; ++ struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + struct device *dev = ice_pf_to_dev(pf); + int ret; + +@@ -638,7 +639,7 @@ static int ice_dcb_noncontig_cfg(struct ice_pf *pf) + */ + void ice_pf_dcb_recfg(struct ice_pf *pf) + { +- struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->local_dcbx_cfg; ++ struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + u8 tc_map = 0; + int v, ret; + +@@ -691,7 +692,7 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked) + port_info = hw->port_info; + + err = ice_init_dcb(hw, false); +- if (err && !port_info->is_sw_lldp) { ++ if (err && !port_info->qos_cfg.is_sw_lldp) { + dev_err(dev, "Error initializing DCB %d\n", err); + goto dcb_init_err; + } +@@ -858,7 +859,7 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, + /* Update the remote cached instance and return */ + ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_REMOTE, + ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID, +- &pi->remote_dcbx_cfg); ++ &pi->qos_cfg.remote_dcbx_cfg); + if (ret) { + dev_err(dev, "Failed to get remote DCB config\n"); + return; +@@ -868,10 +869,11 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, + mutex_lock(&pf->tc_mutex); + + /* store the old configuration */ +- tmp_dcbx_cfg = pf->hw.port_info->local_dcbx_cfg; ++ tmp_dcbx_cfg = pf->hw.port_info->qos_cfg.local_dcbx_cfg; + + /* Reset the old DCBX configuration data */ +- memset(&pi->local_dcbx_cfg, 0, sizeof(pi->local_dcbx_cfg)); ++ memset(&pi->qos_cfg.local_dcbx_cfg, 0, ++ sizeof(pi->qos_cfg.local_dcbx_cfg)); + + /* Get updated DCBX data from firmware */ + ret = ice_get_dcb_cfg(pf->hw.port_info); +@@ -881,7 +883,8 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, + } + + /* No change detected in DCBX configs */ +- if (!memcmp(&tmp_dcbx_cfg, &pi->local_dcbx_cfg, sizeof(tmp_dcbx_cfg))) { ++ if (!memcmp(&tmp_dcbx_cfg, &pi->qos_cfg.local_dcbx_cfg, ++ sizeof(tmp_dcbx_cfg))) { + dev_dbg(dev, "No change detected in DCBX configuration.\n"); + goto out; + } +@@ -889,13 +892,13 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, + pf->dcbx_cap = ice_dcb_get_mode(pi, false); + + need_reconfig = ice_dcb_need_recfg(pf, &tmp_dcbx_cfg, +- &pi->local_dcbx_cfg); +- ice_dcbnl_flush_apps(pf, &tmp_dcbx_cfg, &pi->local_dcbx_cfg); ++ &pi->qos_cfg.local_dcbx_cfg); ++ ice_dcbnl_flush_apps(pf, &tmp_dcbx_cfg, &pi->qos_cfg.local_dcbx_cfg); + if (!need_reconfig) + goto out; + + /* Enable DCB tagging only when more than one TC */ +- if (ice_dcb_get_num_tc(&pi->local_dcbx_cfg) > 1) { ++ if (ice_dcb_get_num_tc(&pi->qos_cfg.local_dcbx_cfg) > 1) { + dev_dbg(dev, "DCB tagging enabled (num TC > 1)\n"); + set_bit(ICE_FLAG_DCB_ENA, pf->flags); + } else { +diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c +index 8c133a8be6add..4180f1f35fb89 100644 +--- a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c ++++ b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c +@@ -18,12 +18,10 @@ static void ice_dcbnl_devreset(struct net_device *netdev) + while (ice_is_reset_in_progress(pf->state)) + usleep_range(1000, 2000); + +- set_bit(__ICE_DCBNL_DEVRESET, pf->state); + dev_close(netdev); + netdev_state_change(netdev); + dev_open(netdev, NULL); + netdev_state_change(netdev); +- clear_bit(__ICE_DCBNL_DEVRESET, pf->state); + } + + /** +@@ -34,12 +32,10 @@ static void ice_dcbnl_devreset(struct net_device *netdev) + static int ice_dcbnl_getets(struct net_device *netdev, struct ieee_ets *ets) + { + struct ice_dcbx_cfg *dcbxcfg; +- struct ice_port_info *pi; + struct ice_pf *pf; + + pf = ice_netdev_to_pf(netdev); +- pi = pf->hw.port_info; +- dcbxcfg = &pi->local_dcbx_cfg; ++ dcbxcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + + ets->willing = dcbxcfg->etscfg.willing; + ets->ets_cap = dcbxcfg->etscfg.maxtcs; +@@ -74,7 +70,7 @@ static int ice_dcbnl_setets(struct net_device *netdev, struct ieee_ets *ets) + !(pf->dcbx_cap & DCB_CAP_DCBX_VER_IEEE)) + return -EINVAL; + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + mutex_lock(&pf->tc_mutex); + +@@ -159,6 +155,7 @@ static u8 ice_dcbnl_getdcbx(struct net_device *netdev) + static u8 ice_dcbnl_setdcbx(struct net_device *netdev, u8 mode) + { + struct ice_pf *pf = ice_netdev_to_pf(netdev); ++ struct ice_qos_cfg *qos_cfg; + + /* if FW LLDP agent is running, DCBNL not allowed to change mode */ + if (test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags)) +@@ -175,10 +172,11 @@ static u8 ice_dcbnl_setdcbx(struct net_device *netdev, u8 mode) + return ICE_DCB_NO_HW_CHG; + + pf->dcbx_cap = mode; ++ qos_cfg = &pf->hw.port_info->qos_cfg; + if (mode & DCB_CAP_DCBX_VER_CEE) +- pf->hw.port_info->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_CEE; ++ qos_cfg->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_CEE; + else +- pf->hw.port_info->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_IEEE; ++ qos_cfg->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_IEEE; + + dev_info(ice_pf_to_dev(pf), "DCBx mode = 0x%x\n", mode); + return ICE_DCB_HW_CHG_RST; +@@ -229,7 +227,7 @@ static int ice_dcbnl_getpfc(struct net_device *netdev, struct ieee_pfc *pfc) + struct ice_dcbx_cfg *dcbxcfg; + int i; + +- dcbxcfg = &pi->local_dcbx_cfg; ++ dcbxcfg = &pi->qos_cfg.local_dcbx_cfg; + pfc->pfc_cap = dcbxcfg->pfc.pfccap; + pfc->pfc_en = dcbxcfg->pfc.pfcena; + pfc->mbc = dcbxcfg->pfc.mbc; +@@ -260,7 +258,7 @@ static int ice_dcbnl_setpfc(struct net_device *netdev, struct ieee_pfc *pfc) + + mutex_lock(&pf->tc_mutex); + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + if (pfc->pfc_cap) + new_cfg->pfc.pfccap = pfc->pfc_cap; +@@ -297,9 +295,9 @@ ice_dcbnl_get_pfc_cfg(struct net_device *netdev, int prio, u8 *setting) + if (prio >= ICE_MAX_USER_PRIORITY) + return; + +- *setting = (pi->local_dcbx_cfg.pfc.pfcena >> prio) & 0x1; ++ *setting = (pi->qos_cfg.local_dcbx_cfg.pfc.pfcena >> prio) & 0x1; + dev_dbg(ice_pf_to_dev(pf), "Get PFC Config up=%d, setting=%d, pfcenable=0x%x\n", +- prio, *setting, pi->local_dcbx_cfg.pfc.pfcena); ++ prio, *setting, pi->qos_cfg.local_dcbx_cfg.pfc.pfcena); + } + + /** +@@ -320,7 +318,7 @@ static void ice_dcbnl_set_pfc_cfg(struct net_device *netdev, int prio, u8 set) + if (prio >= ICE_MAX_USER_PRIORITY) + return; + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + new_cfg->pfc.pfccap = pf->hw.func_caps.common_cap.maxtc; + if (set) +@@ -342,7 +340,7 @@ static u8 ice_dcbnl_getpfcstate(struct net_device *netdev) + struct ice_port_info *pi = pf->hw.port_info; + + /* Return enabled if any UP enabled for PFC */ +- if (pi->local_dcbx_cfg.pfc.pfcena) ++ if (pi->qos_cfg.local_dcbx_cfg.pfc.pfcena) + return 1; + + return 0; +@@ -382,8 +380,8 @@ static u8 ice_dcbnl_setstate(struct net_device *netdev, u8 state) + + if (state) { + set_bit(ICE_FLAG_DCB_ENA, pf->flags); +- memcpy(&pf->hw.port_info->desired_dcbx_cfg, +- &pf->hw.port_info->local_dcbx_cfg, ++ memcpy(&pf->hw.port_info->qos_cfg.desired_dcbx_cfg, ++ &pf->hw.port_info->qos_cfg.local_dcbx_cfg, + sizeof(struct ice_dcbx_cfg)); + } else { + clear_bit(ICE_FLAG_DCB_ENA, pf->flags); +@@ -417,7 +415,7 @@ ice_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int prio, + if (prio >= ICE_MAX_USER_PRIORITY) + return; + +- *pgid = pi->local_dcbx_cfg.etscfg.prio_table[prio]; ++ *pgid = pi->qos_cfg.local_dcbx_cfg.etscfg.prio_table[prio]; + dev_dbg(ice_pf_to_dev(pf), "Get PG config prio=%d tc=%d\n", prio, + *pgid); + } +@@ -448,7 +446,7 @@ ice_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc, + if (tc >= ICE_MAX_TRAFFIC_CLASS) + return; + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + /* prio_type, bwg_id and bw_pct per UP are not supported */ + +@@ -478,7 +476,7 @@ ice_dcbnl_get_pg_bwg_cfg_tx(struct net_device *netdev, int pgid, u8 *bw_pct) + if (pgid >= ICE_MAX_TRAFFIC_CLASS) + return; + +- *bw_pct = pi->local_dcbx_cfg.etscfg.tcbwtable[pgid]; ++ *bw_pct = pi->qos_cfg.local_dcbx_cfg.etscfg.tcbwtable[pgid]; + dev_dbg(ice_pf_to_dev(pf), "Get PG BW config tc=%d bw_pct=%d\n", + pgid, *bw_pct); + } +@@ -502,7 +500,7 @@ ice_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int pgid, u8 bw_pct) + if (pgid >= ICE_MAX_TRAFFIC_CLASS) + return; + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + new_cfg->etscfg.tcbwtable[pgid] = bw_pct; + } +@@ -532,7 +530,7 @@ ice_dcbnl_get_pg_tc_cfg_rx(struct net_device *netdev, int prio, + if (prio >= ICE_MAX_USER_PRIORITY) + return; + +- *pgid = pi->local_dcbx_cfg.etscfg.prio_table[prio]; ++ *pgid = pi->qos_cfg.local_dcbx_cfg.etscfg.prio_table[prio]; + } + + /** +@@ -703,9 +701,9 @@ static int ice_dcbnl_setapp(struct net_device *netdev, struct dcb_app *app) + + mutex_lock(&pf->tc_mutex); + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + +- old_cfg = &pf->hw.port_info->local_dcbx_cfg; ++ old_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + + if (old_cfg->numapps == ICE_DCBX_MAX_APPS) { + ret = -EINVAL; +@@ -755,7 +753,7 @@ static int ice_dcbnl_delapp(struct net_device *netdev, struct dcb_app *app) + return -EINVAL; + + mutex_lock(&pf->tc_mutex); +- old_cfg = &pf->hw.port_info->local_dcbx_cfg; ++ old_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + + if (old_cfg->numapps <= 1) + goto delapp_out; +@@ -764,7 +762,7 @@ static int ice_dcbnl_delapp(struct net_device *netdev, struct dcb_app *app) + if (ret) + goto delapp_out; + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + for (i = 1; i < new_cfg->numapps; i++) { + if (app->selector == new_cfg->app[i].selector && +@@ -817,7 +815,7 @@ static u8 ice_dcbnl_cee_set_all(struct net_device *netdev) + !(pf->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) + return ICE_DCB_NO_HW_CHG; + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + mutex_lock(&pf->tc_mutex); + +@@ -888,7 +886,7 @@ void ice_dcbnl_set_all(struct ice_vsi *vsi) + if (!test_bit(ICE_FLAG_DCB_ENA, pf->flags)) + return; + +- dcbxcfg = &pi->local_dcbx_cfg; ++ dcbxcfg = &pi->qos_cfg.local_dcbx_cfg; + + for (i = 0; i < dcbxcfg->numapps; i++) { + u8 prio, tc_map; +diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c +index aebebd2102da0..d70573f5072c6 100644 +--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c ++++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c +@@ -2986,7 +2986,7 @@ ice_get_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) + pause->rx_pause = 0; + pause->tx_pause = 0; + +- dcbx_cfg = &pi->local_dcbx_cfg; ++ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; + + pcaps = kzalloc(sizeof(*pcaps), GFP_KERNEL); + if (!pcaps) +@@ -3038,7 +3038,7 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) + + pi = vsi->port_info; + hw_link_info = &pi->phy.link_info; +- dcbx_cfg = &pi->local_dcbx_cfg; ++ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; + link_up = hw_link_info->link_info & ICE_AQ_LINK_UP; + + /* Changing the port's flow control is not supported if this isn't the +@@ -3472,7 +3472,7 @@ static void ice_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) + netdev_warn(netdev, "Wake on LAN is not supported on this interface!\n"); + + /* Get WoL settings based on the HW capability */ +- if (ice_is_wol_supported(pf)) { ++ if (ice_is_wol_supported(&pf->hw)) { + wol->supported = WAKE_MAGIC; + wol->wolopts = pf->wol_ena ? WAKE_MAGIC : 0; + } else { +@@ -3492,7 +3492,7 @@ static int ice_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) + struct ice_vsi *vsi = np->vsi; + struct ice_pf *pf = vsi->back; + +- if (vsi->type != ICE_VSI_PF || !ice_is_wol_supported(pf)) ++ if (vsi->type != ICE_VSI_PF || !ice_is_wol_supported(&pf->hw)) + return -EOPNOTSUPP; + + /* only magic packet is supported */ +diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c +index ad9c22a1b97a0..170367eaa95aa 100644 +--- a/drivers/net/ethernet/intel/ice/ice_lib.c ++++ b/drivers/net/ethernet/intel/ice/ice_lib.c +@@ -2078,7 +2078,7 @@ err_out: + + static void ice_vsi_set_tc_cfg(struct ice_vsi *vsi) + { +- struct ice_dcbx_cfg *cfg = &vsi->port_info->local_dcbx_cfg; ++ struct ice_dcbx_cfg *cfg = &vsi->port_info->qos_cfg.local_dcbx_cfg; + + vsi->tc_cfg.ena_tc = ice_dcb_get_ena_tc(cfg); + vsi->tc_cfg.numtc = ice_dcb_get_num_tc(cfg); +@@ -2489,7 +2489,7 @@ int ice_ena_vsi(struct ice_vsi *vsi, bool locked) + if (!locked) + rtnl_lock(); + +- err = ice_open(vsi->netdev); ++ err = ice_open_internal(vsi->netdev); + + if (!locked) + rtnl_unlock(); +@@ -2518,7 +2518,7 @@ void ice_dis_vsi(struct ice_vsi *vsi, bool locked) + if (!locked) + rtnl_lock(); + +- ice_stop(vsi->netdev); ++ ice_vsi_close(vsi); + + if (!locked) + rtnl_unlock(); +@@ -2944,7 +2944,6 @@ err_vsi: + bool ice_is_reset_in_progress(unsigned long *state) + { + return test_bit(__ICE_RESET_OICR_RECV, state) || +- test_bit(__ICE_DCBNL_DEVRESET, state) || + test_bit(__ICE_PFR_REQ, state) || + test_bit(__ICE_CORER_REQ, state) || + test_bit(__ICE_GLOBR_REQ, state); +diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c +index bacb368063e34..6f30aad7695fb 100644 +--- a/drivers/net/ethernet/intel/ice/ice_main.c ++++ b/drivers/net/ethernet/intel/ice/ice_main.c +@@ -3515,15 +3515,14 @@ static int ice_init_interrupt_scheme(struct ice_pf *pf) + } + + /** +- * ice_is_wol_supported - get NVM state of WoL +- * @pf: board private structure ++ * ice_is_wol_supported - check if WoL is supported ++ * @hw: pointer to hardware info + * + * Check if WoL is supported based on the HW configuration. + * Returns true if NVM supports and enables WoL for this port, false otherwise + */ +-bool ice_is_wol_supported(struct ice_pf *pf) ++bool ice_is_wol_supported(struct ice_hw *hw) + { +- struct ice_hw *hw = &pf->hw; + u16 wol_ctrl; + + /* A bit set to 1 in the NVM Software Reserved Word 2 (WoL control +@@ -3532,7 +3531,7 @@ bool ice_is_wol_supported(struct ice_pf *pf) + if (ice_read_sr_word(hw, ICE_SR_NVM_WOL_CFG, &wol_ctrl)) + return false; + +- return !(BIT(hw->pf_id) & wol_ctrl); ++ return !(BIT(hw->port_info->lport) & wol_ctrl); + } + + /** +@@ -4170,28 +4169,25 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) + goto err_send_version_unroll; + } + ++ /* not a fatal error if this fails */ + err = ice_init_nvm_phy_type(pf->hw.port_info); +- if (err) { ++ if (err) + dev_err(dev, "ice_init_nvm_phy_type failed: %d\n", err); +- goto err_send_version_unroll; +- } + ++ /* not a fatal error if this fails */ + err = ice_update_link_info(pf->hw.port_info); +- if (err) { ++ if (err) + dev_err(dev, "ice_update_link_info failed: %d\n", err); +- goto err_send_version_unroll; +- } + + ice_init_link_dflt_override(pf->hw.port_info); + + /* if media available, initialize PHY settings */ + if (pf->hw.port_info->phy.link_info.link_info & + ICE_AQ_MEDIA_AVAILABLE) { ++ /* not a fatal error if this fails */ + err = ice_init_phy_user_cfg(pf->hw.port_info); +- if (err) { ++ if (err) + dev_err(dev, "ice_init_phy_user_cfg failed: %d\n", err); +- goto err_send_version_unroll; +- } + + if (!test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags)) { + struct ice_vsi *vsi = ice_get_main_vsi(pf); +@@ -4542,6 +4538,7 @@ static int __maybe_unused ice_suspend(struct device *dev) + continue; + ice_vsi_free_q_vectors(pf->vsi[v]); + } ++ ice_free_cpu_rx_rmap(ice_get_main_vsi(pf)); + ice_clear_interrupt_scheme(pf); + + pci_save_state(pdev); +@@ -6616,6 +6613,28 @@ static void ice_tx_timeout(struct net_device *netdev, unsigned int txqueue) + * Returns 0 on success, negative value on failure + */ + int ice_open(struct net_device *netdev) ++{ ++ struct ice_netdev_priv *np = netdev_priv(netdev); ++ struct ice_pf *pf = np->vsi->back; ++ ++ if (ice_is_reset_in_progress(pf->state)) { ++ netdev_err(netdev, "can't open net device while reset is in progress"); ++ return -EBUSY; ++ } ++ ++ return ice_open_internal(netdev); ++} ++ ++/** ++ * ice_open_internal - Called when a network interface becomes active ++ * @netdev: network interface device structure ++ * ++ * Internal ice_open implementation. Should not be used directly except for ice_open and reset ++ * handling routine ++ * ++ * Returns 0 on success, negative value on failure ++ */ ++int ice_open_internal(struct net_device *netdev) + { + struct ice_netdev_priv *np = netdev_priv(netdev); + struct ice_vsi *vsi = np->vsi; +@@ -6696,6 +6715,12 @@ int ice_stop(struct net_device *netdev) + { + struct ice_netdev_priv *np = netdev_priv(netdev); + struct ice_vsi *vsi = np->vsi; ++ struct ice_pf *pf = vsi->back; ++ ++ if (ice_is_reset_in_progress(pf->state)) { ++ netdev_err(netdev, "can't stop net device while reset is in progress"); ++ return -EBUSY; ++ } + + ice_vsi_close(vsi); + +diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c +index c3a6c41385ee3..5ce8590cdb374 100644 +--- a/drivers/net/ethernet/intel/ice/ice_switch.c ++++ b/drivers/net/ethernet/intel/ice/ice_switch.c +@@ -1239,6 +1239,9 @@ ice_add_update_vsi_list(struct ice_hw *hw, + ice_create_vsi_list_map(hw, &vsi_handle_arr[0], 2, + vsi_list_id); + ++ if (!m_entry->vsi_list_info) ++ return ICE_ERR_NO_MEMORY; ++ + /* If this entry was large action then the large action needs + * to be updated to point to FWD to VSI list + */ +@@ -2224,6 +2227,7 @@ ice_vsi_uses_fltr(struct ice_fltr_mgmt_list_entry *fm_entry, u16 vsi_handle) + return ((fm_entry->fltr_info.fltr_act == ICE_FWD_TO_VSI && + fm_entry->fltr_info.vsi_handle == vsi_handle) || + (fm_entry->fltr_info.fltr_act == ICE_FWD_TO_VSI_LIST && ++ fm_entry->vsi_list_info && + (test_bit(vsi_handle, fm_entry->vsi_list_info->vsi_map)))); + } + +@@ -2296,14 +2300,12 @@ ice_add_to_vsi_fltr_list(struct ice_hw *hw, u16 vsi_handle, + return ICE_ERR_PARAM; + + list_for_each_entry(fm_entry, lkup_list_head, list_entry) { +- struct ice_fltr_info *fi; +- +- fi = &fm_entry->fltr_info; +- if (!fi || !ice_vsi_uses_fltr(fm_entry, vsi_handle)) ++ if (!ice_vsi_uses_fltr(fm_entry, vsi_handle)) + continue; + + status = ice_add_entry_to_vsi_fltr_list(hw, vsi_handle, +- vsi_list_head, fi); ++ vsi_list_head, ++ &fm_entry->fltr_info); + if (status) + return status; + } +@@ -2626,7 +2628,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle, + &remove_list_head); + mutex_unlock(rule_lock); + if (status) +- return; ++ goto free_fltr_list; + + switch (lkup) { + case ICE_SW_LKUP_MAC: +@@ -2649,6 +2651,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle, + break; + } + ++free_fltr_list: + list_for_each_entry_safe(fm_entry, tmp, &remove_list_head, list_entry) { + list_del(&fm_entry->list_entry); + devm_kfree(ice_hw_to_dev(hw), fm_entry); +diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c +index af5b7f33db9af..0f2544c420ac3 100644 +--- a/drivers/net/ethernet/intel/ice/ice_txrx.c ++++ b/drivers/net/ethernet/intel/ice/ice_txrx.c +@@ -2421,7 +2421,7 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring) + /* allow CONTROL frames egress from main VSI if FW LLDP disabled */ + if (unlikely(skb->priority == TC_PRIO_CONTROL && + vsi->type == ICE_VSI_PF && +- vsi->port_info->is_sw_lldp)) ++ vsi->port_info->qos_cfg.is_sw_lldp)) + offload.cd_qw1 |= (u64)(ICE_TX_DESC_DTYPE_CTX | + ICE_TX_CTX_DESC_SWTCH_UPLINK << + ICE_TXD_CTX_QW1_CMD_S); +diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h +index 2226a291a3943..1bed183d96a0d 100644 +--- a/drivers/net/ethernet/intel/ice/ice_type.h ++++ b/drivers/net/ethernet/intel/ice/ice_type.h +@@ -493,6 +493,7 @@ struct ice_dcb_app_priority_table { + #define ICE_TLV_STATUS_ERR 0x4 + #define ICE_APP_PROT_ID_FCOE 0x8906 + #define ICE_APP_PROT_ID_ISCSI 0x0cbc ++#define ICE_APP_PROT_ID_ISCSI_860 0x035c + #define ICE_APP_PROT_ID_FIP 0x8914 + #define ICE_APP_SEL_ETHTYPE 0x1 + #define ICE_APP_SEL_TCPIP 0x2 +@@ -514,6 +515,14 @@ struct ice_dcbx_cfg { + #define ICE_DCBX_APPS_NON_WILLING 0x1 + }; + ++struct ice_qos_cfg { ++ struct ice_dcbx_cfg local_dcbx_cfg; /* Oper/Local Cfg */ ++ struct ice_dcbx_cfg desired_dcbx_cfg; /* CEE Desired Cfg */ ++ struct ice_dcbx_cfg remote_dcbx_cfg; /* Peer Cfg */ ++ u8 dcbx_status : 3; /* see ICE_DCBX_STATUS_DIS */ ++ u8 is_sw_lldp : 1; ++}; ++ + struct ice_port_info { + struct ice_sched_node *root; /* Root Node per Port */ + struct ice_hw *hw; /* back pointer to HW instance */ +@@ -537,13 +546,7 @@ struct ice_port_info { + sib_head[ICE_MAX_TRAFFIC_CLASS][ICE_AQC_TOPO_MAX_LEVEL_NUM]; + /* List contain profile ID(s) and other params per layer */ + struct list_head rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM]; +- struct ice_dcbx_cfg local_dcbx_cfg; /* Oper/Local Cfg */ +- /* DCBX info */ +- struct ice_dcbx_cfg remote_dcbx_cfg; /* Peer Cfg */ +- struct ice_dcbx_cfg desired_dcbx_cfg; /* CEE Desired Cfg */ +- /* LLDP/DCBX Status */ +- u8 dcbx_status:3; /* see ICE_DCBX_STATUS_DIS */ +- u8 is_sw_lldp:1; ++ struct ice_qos_cfg qos_cfg; + u8 is_vf:1; + }; + +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +index b42396df3111d..0469f53dfb99e 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +@@ -184,6 +184,28 @@ mlx5_tc_ct_entry_has_nat(struct mlx5_ct_entry *entry) + return !!(entry->tuple_nat_node.next); + } + ++static int ++mlx5_get_label_mapping(struct mlx5_tc_ct_priv *ct_priv, ++ u32 *labels, u32 *id) ++{ ++ if (!memchr_inv(labels, 0, sizeof(u32) * 4)) { ++ *id = 0; ++ return 0; ++ } ++ ++ if (mapping_add(ct_priv->labels_mapping, labels, id)) ++ return -EOPNOTSUPP; ++ ++ return 0; ++} ++ ++static void ++mlx5_put_label_mapping(struct mlx5_tc_ct_priv *ct_priv, u32 id) ++{ ++ if (id) ++ mapping_remove(ct_priv->labels_mapping, id); ++} ++ + static int + mlx5_tc_ct_rule_to_tuple(struct mlx5_ct_tuple *tuple, struct flow_rule *rule) + { +@@ -435,7 +457,7 @@ mlx5_tc_ct_entry_del_rule(struct mlx5_tc_ct_priv *ct_priv, + mlx5_tc_rule_delete(netdev_priv(ct_priv->netdev), zone_rule->rule, attr); + mlx5e_mod_hdr_detach(ct_priv->dev, + ct_priv->mod_hdr_tbl, zone_rule->mh); +- mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id); ++ mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id); + kfree(attr); + } + +@@ -638,8 +660,8 @@ mlx5_tc_ct_entry_create_mod_hdr(struct mlx5_tc_ct_priv *ct_priv, + if (!meta) + return -EOPNOTSUPP; + +- err = mapping_add(ct_priv->labels_mapping, meta->ct_metadata.labels, +- &attr->ct_attr.ct_labels_id); ++ err = mlx5_get_label_mapping(ct_priv, meta->ct_metadata.labels, ++ &attr->ct_attr.ct_labels_id); + if (err) + return -EOPNOTSUPP; + if (nat) { +@@ -675,7 +697,7 @@ mlx5_tc_ct_entry_create_mod_hdr(struct mlx5_tc_ct_priv *ct_priv, + + err_mapping: + dealloc_mod_hdr_actions(&mod_acts); +- mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id); ++ mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id); + return err; + } + +@@ -743,7 +765,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv, + err_rule: + mlx5e_mod_hdr_detach(ct_priv->dev, + ct_priv->mod_hdr_tbl, zone_rule->mh); +- mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id); ++ mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id); + err_mod_hdr: + kfree(attr); + err_attr: +@@ -1198,7 +1220,7 @@ void mlx5_tc_ct_match_del(struct mlx5_tc_ct_priv *priv, struct mlx5_ct_attr *ct_ + if (!priv || !ct_attr->ct_labels_id) + return; + +- mapping_remove(priv->labels_mapping, ct_attr->ct_labels_id); ++ mlx5_put_label_mapping(priv, ct_attr->ct_labels_id); + } + + int +@@ -1276,7 +1298,7 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv, + ct_labels[1] = key->ct_labels[1] & mask->ct_labels[1]; + ct_labels[2] = key->ct_labels[2] & mask->ct_labels[2]; + ct_labels[3] = key->ct_labels[3] & mask->ct_labels[3]; +- if (mapping_add(priv->labels_mapping, ct_labels, &ct_attr->ct_labels_id)) ++ if (mlx5_get_label_mapping(priv, ct_labels, &ct_attr->ct_labels_id)) + return -EOPNOTSUPP; + mlx5e_tc_match_to_reg_match(spec, LABELS_TO_REG, ct_attr->ct_labels_id, + MLX5_CT_LABELS_MASK); +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +index bcd05457647e2..986f0d86e94dc 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +@@ -744,11 +744,11 @@ static int get_fec_supported_advertised(struct mlx5_core_dev *dev, + return 0; + } + +-static void ptys2ethtool_supported_advertised_port(struct ethtool_link_ksettings *link_ksettings, +- u32 eth_proto_cap, +- u8 connector_type, bool ext) ++static void ptys2ethtool_supported_advertised_port(struct mlx5_core_dev *mdev, ++ struct ethtool_link_ksettings *link_ksettings, ++ u32 eth_proto_cap, u8 connector_type) + { +- if ((!connector_type && !ext) || connector_type >= MLX5E_CONNECTOR_TYPE_NUMBER) { ++ if (!MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) { + if (eth_proto_cap & (MLX5E_PROT_MASK(MLX5E_10GBASE_CR) + | MLX5E_PROT_MASK(MLX5E_10GBASE_SR) + | MLX5E_PROT_MASK(MLX5E_40GBASE_CR4) +@@ -884,9 +884,9 @@ static int ptys2connector_type[MLX5E_CONNECTOR_TYPE_NUMBER] = { + [MLX5E_PORT_OTHER] = PORT_OTHER, + }; + +-static u8 get_connector_port(u32 eth_proto, u8 connector_type, bool ext) ++static u8 get_connector_port(struct mlx5_core_dev *mdev, u32 eth_proto, u8 connector_type) + { +- if ((connector_type || ext) && connector_type < MLX5E_CONNECTOR_TYPE_NUMBER) ++ if (MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) + return ptys2connector_type[connector_type]; + + if (eth_proto & +@@ -987,11 +987,11 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, + data_rate_oper, link_ksettings); + + eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; +- +- link_ksettings->base.port = get_connector_port(eth_proto_oper, +- connector_type, ext); +- ptys2ethtool_supported_advertised_port(link_ksettings, eth_proto_admin, +- connector_type, ext); ++ connector_type = connector_type < MLX5E_CONNECTOR_TYPE_NUMBER ? ++ connector_type : MLX5E_PORT_UNKNOWN; ++ link_ksettings->base.port = get_connector_port(mdev, eth_proto_oper, connector_type); ++ ptys2ethtool_supported_advertised_port(mdev, link_ksettings, eth_proto_admin, ++ connector_type); + get_lp_advertising(mdev, eth_proto_lp, link_ksettings); + + if (an_status == MLX5_AN_COMPLETE) +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c +index 8ebfe782f95e5..ccd53a7a2b801 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c +@@ -926,13 +926,24 @@ void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev) + mutex_unlock(&table->lock); + } + ++#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING ++#define MLX5_MAX_ASYNC_EQS 4 ++#else ++#define MLX5_MAX_ASYNC_EQS 3 ++#endif ++ + int mlx5_eq_table_create(struct mlx5_core_dev *dev) + { + struct mlx5_eq_table *eq_table = dev->priv.eq_table; ++ int num_eqs = MLX5_CAP_GEN(dev, max_num_eqs) ? ++ MLX5_CAP_GEN(dev, max_num_eqs) : ++ 1 << MLX5_CAP_GEN(dev, log_max_eq); + int err; + + eq_table->num_comp_eqs = +- mlx5_irq_get_num_comp(eq_table->irq_table); ++ min_t(int, ++ mlx5_irq_get_num_comp(eq_table->irq_table), ++ num_eqs - MLX5_MAX_ASYNC_EQS); + + err = create_async_eqs(dev); + if (err) { +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +index 74b3959b36d4d..3e7576e671df8 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #include "port.h" + #include "core.h" +@@ -345,6 +346,20 @@ struct mlxsw_sp_port_type_speed_ops { + u32 (*ptys_proto_cap_masked_get)(u32 eth_proto_cap); + }; + ++static inline u8 mlxsw_sp_tunnel_ecn_decap(u8 outer_ecn, u8 inner_ecn, ++ bool *trap_en) ++{ ++ bool set_ce = false; ++ ++ *trap_en = !!__INET_ECN_decapsulate(outer_ecn, inner_ecn, &set_ce); ++ if (set_ce) ++ return INET_ECN_CE; ++ else if (outer_ecn == INET_ECN_ECT_1 && inner_ecn == INET_ECN_ECT_0) ++ return INET_ECN_ECT_1; ++ else ++ return inner_ecn; ++} ++ + static inline struct net_device * + mlxsw_sp_bridge_vxlan_dev_find(struct net_device *br_dev) + { +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c +index a8525992528f5..3262a2c15ea75 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c +@@ -371,12 +371,11 @@ static int mlxsw_sp_ipip_ecn_decap_init_one(struct mlxsw_sp *mlxsw_sp, + u8 inner_ecn, u8 outer_ecn) + { + char tidem_pl[MLXSW_REG_TIDEM_LEN]; +- bool trap_en, set_ce = false; + u8 new_inner_ecn; ++ bool trap_en; + +- trap_en = __INET_ECN_decapsulate(outer_ecn, inner_ecn, &set_ce); +- new_inner_ecn = set_ce ? INET_ECN_CE : inner_ecn; +- ++ new_inner_ecn = mlxsw_sp_tunnel_ecn_decap(outer_ecn, inner_ecn, ++ &trap_en); + mlxsw_reg_tidem_pack(tidem_pl, outer_ecn, inner_ecn, new_inner_ecn, + trap_en, trap_en ? MLXSW_TRAP_ID_DECAP_ECN0 : 0); + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(tidem), tidem_pl); +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c +index 54d3e7dcd303b..a2d1b95d1f58b 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c +@@ -909,12 +909,11 @@ static int __mlxsw_sp_nve_ecn_decap_init(struct mlxsw_sp *mlxsw_sp, + u8 inner_ecn, u8 outer_ecn) + { + char tndem_pl[MLXSW_REG_TNDEM_LEN]; +- bool trap_en, set_ce = false; + u8 new_inner_ecn; ++ bool trap_en; + +- trap_en = !!__INET_ECN_decapsulate(outer_ecn, inner_ecn, &set_ce); +- new_inner_ecn = set_ce ? INET_ECN_CE : inner_ecn; +- ++ new_inner_ecn = mlxsw_sp_tunnel_ecn_decap(outer_ecn, inner_ecn, ++ &trap_en); + mlxsw_reg_tndem_pack(tndem_pl, outer_ecn, inner_ecn, new_inner_ecn, + trap_en, trap_en ? MLXSW_TRAP_ID_DECAP_ECN0 : 0); + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(tndem), tndem_pl); +diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +index 1634ca6d4a8f0..c84c8bf2bc20e 100644 +--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c ++++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +@@ -2897,7 +2897,7 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb, + dev_kfree_skb_any(curr); + if (segs != NULL) { + curr = segs; +- segs = segs->next; ++ segs = next; + curr->next = NULL; + dev_kfree_skb_any(segs); + } +diff --git a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c +index 0e2db6ea79e96..2ec62c8d86e1c 100644 +--- a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c ++++ b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c +@@ -454,6 +454,7 @@ void nfp_bpf_ctrl_msg_rx(struct nfp_app *app, struct sk_buff *skb) + dev_consume_skb_any(skb); + else + dev_kfree_skb_any(skb); ++ return; + } + + nfp_ccm_rx(&bpf->ccm, skb); +diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h +index caf12eec99459..56833a41f3d27 100644 +--- a/drivers/net/ethernet/netronome/nfp/flower/main.h ++++ b/drivers/net/ethernet/netronome/nfp/flower/main.h +@@ -190,6 +190,7 @@ struct nfp_fl_internal_ports { + * @qos_rate_limiters: Current active qos rate limiters + * @qos_stats_lock: Lock on qos stats updates + * @pre_tun_rule_cnt: Number of pre-tunnel rules offloaded ++ * @merge_table: Hash table to store merged flows + */ + struct nfp_flower_priv { + struct nfp_app *app; +@@ -223,6 +224,7 @@ struct nfp_flower_priv { + unsigned int qos_rate_limiters; + spinlock_t qos_stats_lock; /* Protect the qos stats */ + int pre_tun_rule_cnt; ++ struct rhashtable merge_table; + }; + + /** +@@ -350,6 +352,12 @@ struct nfp_fl_payload_link { + }; + + extern const struct rhashtable_params nfp_flower_table_params; ++extern const struct rhashtable_params merge_table_params; ++ ++struct nfp_merge_info { ++ u64 parent_ctx; ++ struct rhash_head ht_node; ++}; + + struct nfp_fl_stats_frame { + __be32 stats_con_id; +diff --git a/drivers/net/ethernet/netronome/nfp/flower/metadata.c b/drivers/net/ethernet/netronome/nfp/flower/metadata.c +index aa06fcb38f8b9..327bb56b3ef56 100644 +--- a/drivers/net/ethernet/netronome/nfp/flower/metadata.c ++++ b/drivers/net/ethernet/netronome/nfp/flower/metadata.c +@@ -490,6 +490,12 @@ const struct rhashtable_params nfp_flower_table_params = { + .automatic_shrinking = true, + }; + ++const struct rhashtable_params merge_table_params = { ++ .key_offset = offsetof(struct nfp_merge_info, parent_ctx), ++ .head_offset = offsetof(struct nfp_merge_info, ht_node), ++ .key_len = sizeof(u64), ++}; ++ + int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, + unsigned int host_num_mems) + { +@@ -506,6 +512,10 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, + if (err) + goto err_free_flow_table; + ++ err = rhashtable_init(&priv->merge_table, &merge_table_params); ++ if (err) ++ goto err_free_stats_ctx_table; ++ + get_random_bytes(&priv->mask_id_seed, sizeof(priv->mask_id_seed)); + + /* Init ring buffer and unallocated mask_ids. */ +@@ -513,7 +523,7 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, + kmalloc_array(NFP_FLOWER_MASK_ENTRY_RS, + NFP_FLOWER_MASK_ELEMENT_RS, GFP_KERNEL); + if (!priv->mask_ids.mask_id_free_list.buf) +- goto err_free_stats_ctx_table; ++ goto err_free_merge_table; + + priv->mask_ids.init_unallocated = NFP_FLOWER_MASK_ENTRY_RS - 1; + +@@ -550,6 +560,8 @@ err_free_last_used: + kfree(priv->mask_ids.last_used); + err_free_mask_id: + kfree(priv->mask_ids.mask_id_free_list.buf); ++err_free_merge_table: ++ rhashtable_destroy(&priv->merge_table); + err_free_stats_ctx_table: + rhashtable_destroy(&priv->stats_ctx_table); + err_free_flow_table: +@@ -568,6 +580,8 @@ void nfp_flower_metadata_cleanup(struct nfp_app *app) + nfp_check_rhashtable_empty, NULL); + rhashtable_free_and_destroy(&priv->stats_ctx_table, + nfp_check_rhashtable_empty, NULL); ++ rhashtable_free_and_destroy(&priv->merge_table, ++ nfp_check_rhashtable_empty, NULL); + kvfree(priv->stats); + kfree(priv->mask_ids.mask_id_free_list.buf); + kfree(priv->mask_ids.last_used); +diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c +index d72225d64a75d..e95969c462e46 100644 +--- a/drivers/net/ethernet/netronome/nfp/flower/offload.c ++++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c +@@ -1009,6 +1009,8 @@ int nfp_flower_merge_offloaded_flows(struct nfp_app *app, + struct netlink_ext_ack *extack = NULL; + struct nfp_fl_payload *merge_flow; + struct nfp_fl_key_ls merge_key_ls; ++ struct nfp_merge_info *merge_info; ++ u64 parent_ctx = 0; + int err; + + ASSERT_RTNL(); +@@ -1019,6 +1021,15 @@ int nfp_flower_merge_offloaded_flows(struct nfp_app *app, + nfp_flower_is_merge_flow(sub_flow2)) + return -EINVAL; + ++ /* check if the two flows are already merged */ ++ parent_ctx = (u64)(be32_to_cpu(sub_flow1->meta.host_ctx_id)) << 32; ++ parent_ctx |= (u64)(be32_to_cpu(sub_flow2->meta.host_ctx_id)); ++ if (rhashtable_lookup_fast(&priv->merge_table, ++ &parent_ctx, merge_table_params)) { ++ nfp_flower_cmsg_warn(app, "The two flows are already merged.\n"); ++ return 0; ++ } ++ + err = nfp_flower_can_merge(sub_flow1, sub_flow2); + if (err) + return err; +@@ -1060,16 +1071,33 @@ int nfp_flower_merge_offloaded_flows(struct nfp_app *app, + if (err) + goto err_release_metadata; + ++ merge_info = kmalloc(sizeof(*merge_info), GFP_KERNEL); ++ if (!merge_info) { ++ err = -ENOMEM; ++ goto err_remove_rhash; ++ } ++ merge_info->parent_ctx = parent_ctx; ++ err = rhashtable_insert_fast(&priv->merge_table, &merge_info->ht_node, ++ merge_table_params); ++ if (err) ++ goto err_destroy_merge_info; ++ + err = nfp_flower_xmit_flow(app, merge_flow, + NFP_FLOWER_CMSG_TYPE_FLOW_MOD); + if (err) +- goto err_remove_rhash; ++ goto err_remove_merge_info; + + merge_flow->in_hw = true; + sub_flow1->in_hw = false; + + return 0; + ++err_remove_merge_info: ++ WARN_ON_ONCE(rhashtable_remove_fast(&priv->merge_table, ++ &merge_info->ht_node, ++ merge_table_params)); ++err_destroy_merge_info: ++ kfree(merge_info); + err_remove_rhash: + WARN_ON_ONCE(rhashtable_remove_fast(&priv->flow_table, + &merge_flow->fl_node, +@@ -1359,7 +1387,9 @@ nfp_flower_remove_merge_flow(struct nfp_app *app, + { + struct nfp_flower_priv *priv = app->priv; + struct nfp_fl_payload_link *link, *temp; ++ struct nfp_merge_info *merge_info; + struct nfp_fl_payload *origin; ++ u64 parent_ctx = 0; + bool mod = false; + int err; + +@@ -1396,8 +1426,22 @@ nfp_flower_remove_merge_flow(struct nfp_app *app, + err_free_links: + /* Clean any links connected with the merged flow. */ + list_for_each_entry_safe(link, temp, &merge_flow->linked_flows, +- merge_flow.list) ++ merge_flow.list) { ++ u32 ctx_id = be32_to_cpu(link->sub_flow.flow->meta.host_ctx_id); ++ ++ parent_ctx = (parent_ctx << 32) | (u64)(ctx_id); + nfp_flower_unlink_flow(link); ++ } ++ ++ merge_info = rhashtable_lookup_fast(&priv->merge_table, ++ &parent_ctx, ++ merge_table_params); ++ if (merge_info) { ++ WARN_ON_ONCE(rhashtable_remove_fast(&priv->merge_table, ++ &merge_info->ht_node, ++ merge_table_params)); ++ kfree(merge_info); ++ } + + kfree(merge_flow->action_data); + kfree(merge_flow->mask_data); +diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c +index 1426bfc009bc3..abd37f26af682 100644 +--- a/drivers/net/geneve.c ++++ b/drivers/net/geneve.c +@@ -907,8 +907,16 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, + + info = skb_tunnel_info(skb); + if (info) { +- info->key.u.ipv4.dst = fl4.saddr; +- info->key.u.ipv4.src = fl4.daddr; ++ struct ip_tunnel_info *unclone; ++ ++ unclone = skb_tunnel_info_unclone(skb); ++ if (unlikely(!unclone)) { ++ dst_release(&rt->dst); ++ return -ENOMEM; ++ } ++ ++ unclone->key.u.ipv4.dst = fl4.saddr; ++ unclone->key.u.ipv4.src = fl4.daddr; + } + + if (!pskb_may_pull(skb, ETH_HLEN)) { +@@ -992,8 +1000,16 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, + struct ip_tunnel_info *info = skb_tunnel_info(skb); + + if (info) { +- info->key.u.ipv6.dst = fl6.saddr; +- info->key.u.ipv6.src = fl6.daddr; ++ struct ip_tunnel_info *unclone; ++ ++ unclone = skb_tunnel_info_unclone(skb); ++ if (unlikely(!unclone)) { ++ dst_release(dst); ++ return -ENOMEM; ++ } ++ ++ unclone->key.u.ipv6.dst = fl6.saddr; ++ unclone->key.u.ipv6.src = fl6.daddr; + } + + if (!pskb_may_pull(skb, ETH_HLEN)) { +diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c +index 0dd0ba915ab97..23ee0b14cbfa1 100644 +--- a/drivers/net/ieee802154/atusb.c ++++ b/drivers/net/ieee802154/atusb.c +@@ -365,6 +365,7 @@ static int atusb_alloc_urbs(struct atusb *atusb, int n) + return -ENOMEM; + } + usb_anchor_urb(urb, &atusb->idle_urbs); ++ usb_free_urb(urb); + n--; + } + return 0; +diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c +index ef6825b303233..b72e11ca974f7 100644 +--- a/drivers/net/phy/bcm-phy-lib.c ++++ b/drivers/net/phy/bcm-phy-lib.c +@@ -328,7 +328,7 @@ EXPORT_SYMBOL_GPL(bcm_phy_enable_apd); + + int bcm_phy_set_eee(struct phy_device *phydev, bool enable) + { +- int val; ++ int val, mask = 0; + + /* Enable EEE at PHY level */ + val = phy_read_mmd(phydev, MDIO_MMD_AN, BRCM_CL45VEN_EEE_CONTROL); +@@ -347,10 +347,17 @@ int bcm_phy_set_eee(struct phy_device *phydev, bool enable) + if (val < 0) + return val; + ++ if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, ++ phydev->supported)) ++ mask |= MDIO_EEE_1000T; ++ if (linkmode_test_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, ++ phydev->supported)) ++ mask |= MDIO_EEE_100TX; ++ + if (enable) +- val |= (MDIO_EEE_100TX | MDIO_EEE_1000T); ++ val |= mask; + else +- val &= ~(MDIO_EEE_100TX | MDIO_EEE_1000T); ++ val &= ~mask; + + phy_write_mmd(phydev, MDIO_MMD_AN, BCM_CL45VEN_EEE_ADV, (u32)val); + +diff --git a/drivers/net/tun.c b/drivers/net/tun.c +index accde25a66a01..c671d8e257741 100644 +--- a/drivers/net/tun.c ++++ b/drivers/net/tun.c +@@ -69,6 +69,14 @@ + #include + #include + #include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include + + #include + #include +@@ -2978,6 +2986,45 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p, + return __tun_set_ebpf(tun, prog_p, prog); + } + ++/* Return correct value for tun->dev->addr_len based on tun->dev->type. */ ++static unsigned char tun_get_addr_len(unsigned short type) ++{ ++ switch (type) { ++ case ARPHRD_IP6GRE: ++ case ARPHRD_TUNNEL6: ++ return sizeof(struct in6_addr); ++ case ARPHRD_IPGRE: ++ case ARPHRD_TUNNEL: ++ case ARPHRD_SIT: ++ return 4; ++ case ARPHRD_ETHER: ++ return ETH_ALEN; ++ case ARPHRD_IEEE802154: ++ case ARPHRD_IEEE802154_MONITOR: ++ return IEEE802154_EXTENDED_ADDR_LEN; ++ case ARPHRD_PHONET_PIPE: ++ case ARPHRD_PPP: ++ case ARPHRD_NONE: ++ return 0; ++ case ARPHRD_6LOWPAN: ++ return EUI64_ADDR_LEN; ++ case ARPHRD_FDDI: ++ return FDDI_K_ALEN; ++ case ARPHRD_HIPPI: ++ return HIPPI_ALEN; ++ case ARPHRD_IEEE802: ++ return FC_ALEN; ++ case ARPHRD_ROSE: ++ return ROSE_ADDR_LEN; ++ case ARPHRD_NETROM: ++ return AX25_ADDR_LEN; ++ case ARPHRD_LOCALTLK: ++ return LTALK_ALEN; ++ default: ++ return 0; ++ } ++} ++ + static long __tun_chr_ioctl(struct file *file, unsigned int cmd, + unsigned long arg, int ifreq_len) + { +@@ -3133,6 +3180,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, + ret = -EBUSY; + } else { + tun->dev->type = (int) arg; ++ tun->dev->addr_len = tun_get_addr_len(tun->dev->type); + netif_info(tun, drv, tun->dev, "linktype set to %d\n", + tun->dev->type); + ret = 0; +diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c +index 2bb28db894320..d18642a8144cf 100644 +--- a/drivers/net/usb/hso.c ++++ b/drivers/net/usb/hso.c +@@ -611,7 +611,7 @@ static struct hso_serial *get_serial_by_index(unsigned index) + return serial; + } + +-static int get_free_serial_index(void) ++static int obtain_minor(struct hso_serial *serial) + { + int index; + unsigned long flags; +@@ -619,8 +619,10 @@ static int get_free_serial_index(void) + spin_lock_irqsave(&serial_table_lock, flags); + for (index = 0; index < HSO_SERIAL_TTY_MINORS; index++) { + if (serial_table[index] == NULL) { ++ serial_table[index] = serial->parent; ++ serial->minor = index; + spin_unlock_irqrestore(&serial_table_lock, flags); +- return index; ++ return 0; + } + } + spin_unlock_irqrestore(&serial_table_lock, flags); +@@ -629,15 +631,12 @@ static int get_free_serial_index(void) + return -1; + } + +-static void set_serial_by_index(unsigned index, struct hso_serial *serial) ++static void release_minor(struct hso_serial *serial) + { + unsigned long flags; + + spin_lock_irqsave(&serial_table_lock, flags); +- if (serial) +- serial_table[index] = serial->parent; +- else +- serial_table[index] = NULL; ++ serial_table[serial->minor] = NULL; + spin_unlock_irqrestore(&serial_table_lock, flags); + } + +@@ -2230,6 +2229,7 @@ static int hso_stop_serial_device(struct hso_device *hso_dev) + static void hso_serial_tty_unregister(struct hso_serial *serial) + { + tty_unregister_device(tty_drv, serial->minor); ++ release_minor(serial); + } + + static void hso_serial_common_free(struct hso_serial *serial) +@@ -2253,24 +2253,22 @@ static void hso_serial_common_free(struct hso_serial *serial) + static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, + int rx_size, int tx_size) + { +- int minor; + int i; + + tty_port_init(&serial->port); + +- minor = get_free_serial_index(); +- if (minor < 0) ++ if (obtain_minor(serial)) + goto exit2; + + /* register our minor number */ + serial->parent->dev = tty_port_register_device_attr(&serial->port, +- tty_drv, minor, &serial->parent->interface->dev, ++ tty_drv, serial->minor, &serial->parent->interface->dev, + serial->parent, hso_serial_dev_groups); +- if (IS_ERR(serial->parent->dev)) ++ if (IS_ERR(serial->parent->dev)) { ++ release_minor(serial); + goto exit2; ++ } + +- /* fill in specific data for later use */ +- serial->minor = minor; + serial->magic = HSO_SERIAL_MAGIC; + spin_lock_init(&serial->serial_lock); + serial->num_rx_urbs = num_urbs; +@@ -2667,9 +2665,6 @@ static struct hso_device *hso_create_bulk_serial_device( + + serial->write_data = hso_std_serial_write_data; + +- /* and record this serial */ +- set_serial_by_index(serial->minor, serial); +- + /* setup the proc dirs and files if needed */ + hso_log_port(hso_dev); + +@@ -2726,9 +2721,6 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, + serial->shared_int->ref_count++; + mutex_unlock(&serial->shared_int->shared_int_lock); + +- /* and record this serial */ +- set_serial_by_index(serial->minor, serial); +- + /* setup the proc dirs and files if needed */ + hso_log_port(hso_dev); + +@@ -3113,7 +3105,6 @@ static void hso_free_interface(struct usb_interface *interface) + cancel_work_sync(&serial_table[i]->async_get_intf); + hso_serial_tty_unregister(serial); + kref_put(&serial_table[i]->ref, hso_serial_ref_free); +- set_serial_by_index(i, NULL); + } + } + +diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c +index 50cb8f045a1e5..d3b698d9e2e6a 100644 +--- a/drivers/net/vxlan.c ++++ b/drivers/net/vxlan.c +@@ -2724,12 +2724,17 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, + goto tx_error; + } else if (err) { + if (info) { ++ struct ip_tunnel_info *unclone; + struct in_addr src, dst; + ++ unclone = skb_tunnel_info_unclone(skb); ++ if (unlikely(!unclone)) ++ goto tx_error; ++ + src = remote_ip.sin.sin_addr; + dst = local_ip.sin.sin_addr; +- info->key.u.ipv4.src = src.s_addr; +- info->key.u.ipv4.dst = dst.s_addr; ++ unclone->key.u.ipv4.src = src.s_addr; ++ unclone->key.u.ipv4.dst = dst.s_addr; + } + vxlan_encap_bypass(skb, vxlan, vxlan, vni, false); + dst_release(ndst); +@@ -2780,12 +2785,17 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, + goto tx_error; + } else if (err) { + if (info) { ++ struct ip_tunnel_info *unclone; + struct in6_addr src, dst; + ++ unclone = skb_tunnel_info_unclone(skb); ++ if (unlikely(!unclone)) ++ goto tx_error; ++ + src = remote_ip.sin6.sin6_addr; + dst = local_ip.sin6.sin6_addr; +- info->key.u.ipv6.src = src; +- info->key.u.ipv6.dst = dst; ++ unclone->key.u.ipv6.src = src; ++ unclone->key.u.ipv6.dst = dst; + } + + vxlan_encap_bypass(skb, vxlan, vxlan, vni, false); +diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c +index 409e5a7ad8e26..857912ae84d71 100644 +--- a/drivers/net/wan/hdlc_fr.c ++++ b/drivers/net/wan/hdlc_fr.c +@@ -415,7 +415,7 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev) + + if (pad > 0) { /* Pad the frame with zeros */ + if (__skb_pad(skb, pad, false)) +- goto drop; ++ goto out; + skb_put(skb, pad); + } + } +@@ -448,8 +448,9 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev) + return NETDEV_TX_OK; + + drop: +- dev->stats.tx_dropped++; + kfree_skb(skb); ++out: ++ dev->stats.tx_dropped++; + return NETDEV_TX_OK; + } + +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +index 6d19de3058d21..cbde21e772b17 100644 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +@@ -285,7 +285,7 @@ enum iwl_reg_capa_flags_v2 { + REG_CAPA_V2_MCS_9_ALLOWED = BIT(6), + REG_CAPA_V2_WEATHER_DISABLED = BIT(7), + REG_CAPA_V2_40MHZ_ALLOWED = BIT(8), +- REG_CAPA_V2_11AX_DISABLED = BIT(13), ++ REG_CAPA_V2_11AX_DISABLED = BIT(10), + }; + + /* +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c +index 81ef4fc8d7831..ec1d6025081de 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c +@@ -5,7 +5,7 @@ + * + * GPL LICENSE SUMMARY + * +- * Copyright(c) 2018 - 2020 Intel Corporation ++ * Copyright(c) 2018 - 2021 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 +@@ -122,15 +122,6 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, + const struct fw_img *fw) + { + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); +- u32 ltr_val = CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ | +- u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, +- CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE) | +- u32_encode_bits(250, +- CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL) | +- CSR_LTR_LONG_VAL_AD_SNOOP_REQ | +- u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, +- CSR_LTR_LONG_VAL_AD_SNOOP_SCALE) | +- u32_encode_bits(250, CSR_LTR_LONG_VAL_AD_SNOOP_VAL); + struct iwl_context_info_gen3 *ctxt_info_gen3; + struct iwl_prph_scratch *prph_scratch; + struct iwl_prph_scratch_ctrl_cfg *prph_sc_ctrl; +@@ -264,26 +255,6 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, + iwl_set_bit(trans, CSR_CTXT_INFO_BOOT_CTRL, + CSR_AUTO_FUNC_BOOT_ENA); + +- /* +- * To workaround hardware latency issues during the boot process, +- * initialize the LTR to ~250 usec (see ltr_val above). +- * The firmware initializes this again later (to a smaller value). +- */ +- if ((trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210 || +- trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) && +- !trans->trans_cfg->integrated) { +- iwl_write32(trans, CSR_LTR_LONG_VAL_AD, ltr_val); +- } else if (trans->trans_cfg->integrated && +- trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) { +- iwl_write_prph(trans, HPM_MAC_LTR_CSR, HPM_MAC_LRT_ENABLE_ALL); +- iwl_write_prph(trans, HPM_UMAC_LTR, ltr_val); +- } +- +- if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) +- iwl_write_umac_prph(trans, UREG_CPU_INIT_RUN, 1); +- else +- iwl_set_bit(trans, CSR_GP_CNTRL, CSR_AUTO_FUNC_INIT); +- + return 0; + + err_free_ctxt_info: +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c +index 13fe9c00d7e8f..f65d363cc8922 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c +@@ -6,7 +6,7 @@ + * GPL LICENSE SUMMARY + * + * Copyright(c) 2017 Intel Deutschland GmbH +- * Copyright(c) 2018 - 2020 Intel Corporation ++ * Copyright(c) 2018 - 2021 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 +@@ -288,7 +288,6 @@ int iwl_pcie_ctxt_info_init(struct iwl_trans *trans, + + /* kick FW self load */ + iwl_write64(trans, CSR_CTXT_INFO_BA, trans_pcie->ctxt_info_dma_addr); +- iwl_write_prph(trans, UREG_CPU_INIT_RUN, 1); + + /* Context info will be released upon alive or failure to get one */ + +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +index 91ec9379c0611..4c3ca2a376964 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +@@ -281,6 +281,34 @@ void iwl_trans_pcie_gen2_fw_alive(struct iwl_trans *trans, u32 scd_addr) + mutex_unlock(&trans_pcie->mutex); + } + ++static void iwl_pcie_set_ltr(struct iwl_trans *trans) ++{ ++ u32 ltr_val = CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ | ++ u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, ++ CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE) | ++ u32_encode_bits(250, ++ CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL) | ++ CSR_LTR_LONG_VAL_AD_SNOOP_REQ | ++ u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, ++ CSR_LTR_LONG_VAL_AD_SNOOP_SCALE) | ++ u32_encode_bits(250, CSR_LTR_LONG_VAL_AD_SNOOP_VAL); ++ ++ /* ++ * To workaround hardware latency issues during the boot process, ++ * initialize the LTR to ~250 usec (see ltr_val above). ++ * The firmware initializes this again later (to a smaller value). ++ */ ++ if ((trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210 || ++ trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) && ++ !trans->trans_cfg->integrated) { ++ iwl_write32(trans, CSR_LTR_LONG_VAL_AD, ltr_val); ++ } else if (trans->trans_cfg->integrated && ++ trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) { ++ iwl_write_prph(trans, HPM_MAC_LTR_CSR, HPM_MAC_LRT_ENABLE_ALL); ++ iwl_write_prph(trans, HPM_UMAC_LTR, ltr_val); ++ } ++} ++ + int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans, + const struct fw_img *fw, bool run_in_rfkill) + { +@@ -347,6 +375,13 @@ int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans, + if (ret) + goto out; + ++ iwl_pcie_set_ltr(trans); ++ ++ if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) ++ iwl_write_umac_prph(trans, UREG_CPU_INIT_RUN, 1); ++ else ++ iwl_write_prph(trans, UREG_CPU_INIT_RUN, 1); ++ + /* re-check RF-Kill state since we may have missed the interrupt */ + hw_rfkill = iwl_pcie_check_hw_rf_kill(trans); + if (hw_rfkill && !run_in_rfkill) +diff --git a/drivers/of/property.c b/drivers/of/property.c +index 408a7b5f06a9e..1d7d24e7094b0 100644 +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -1308,7 +1308,16 @@ DEFINE_SIMPLE_PROP(pinctrl7, "pinctrl-7", NULL) + DEFINE_SIMPLE_PROP(pinctrl8, "pinctrl-8", NULL) + DEFINE_SUFFIX_PROP(regulators, "-supply", NULL) + DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells") +-DEFINE_SUFFIX_PROP(gpios, "-gpios", "#gpio-cells") ++ ++static struct device_node *parse_gpios(struct device_node *np, ++ const char *prop_name, int index) ++{ ++ if (!strcmp_suffix(prop_name, ",nr-gpios")) ++ return NULL; ++ ++ return parse_suffix_prop_cells(np, prop_name, index, "-gpios", ++ "#gpio-cells"); ++} + + static struct device_node *parse_iommu_maps(struct device_node *np, + const char *prop_name, int index) +diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c +index ddecf25b5dd40..d7894f178bd4f 100644 +--- a/drivers/ras/cec.c ++++ b/drivers/ras/cec.c +@@ -309,11 +309,20 @@ static bool sanity_check(struct ce_array *ca) + return ret; + } + ++/** ++ * cec_add_elem - Add an element to the CEC array. ++ * @pfn: page frame number to insert ++ * ++ * Return values: ++ * - <0: on error ++ * - 0: on success ++ * - >0: when the inserted pfn was offlined ++ */ + static int cec_add_elem(u64 pfn) + { + struct ce_array *ca = &ce_arr; ++ int count, err, ret = 0; + unsigned int to = 0; +- int count, ret = 0; + + /* + * We can be called very early on the identify_cpu() path where we are +@@ -330,8 +339,8 @@ static int cec_add_elem(u64 pfn) + if (ca->n == MAX_ELEMS) + WARN_ON(!del_lru_elem_unlocked(ca)); + +- ret = find_elem(ca, pfn, &to); +- if (ret < 0) { ++ err = find_elem(ca, pfn, &to); ++ if (err < 0) { + /* + * Shift range [to-end] to make room for one more element. + */ +diff --git a/drivers/regulator/bd9571mwv-regulator.c b/drivers/regulator/bd9571mwv-regulator.c +index e690c2ce5b3c5..25e33028871c0 100644 +--- a/drivers/regulator/bd9571mwv-regulator.c ++++ b/drivers/regulator/bd9571mwv-regulator.c +@@ -124,7 +124,7 @@ static const struct regulator_ops vid_ops = { + + static const struct regulator_desc regulators[] = { + BD9571MWV_REG("VD09", "vd09", VD09, avs_ops, 0, 0x7f, +- 0x80, 600000, 10000, 0x3c), ++ 0x6f, 600000, 10000, 0x3c), + BD9571MWV_REG("VD18", "vd18", VD18, vid_ops, BD9571MWV_VD18_VID, 0xf, + 16, 1625000, 25000, 0), + BD9571MWV_REG("VD25", "vd25", VD25, vid_ops, BD9571MWV_VD25_VID, 0xf, +@@ -133,7 +133,7 @@ static const struct regulator_desc regulators[] = { + 11, 2800000, 100000, 0), + BD9571MWV_REG("DVFS", "dvfs", DVFS, reg_ops, + BD9571MWV_DVFS_MONIVDAC, 0x7f, +- 0x80, 600000, 10000, 0x3c), ++ 0x6f, 600000, 10000, 0x3c), + }; + + #ifdef CONFIG_PM_SLEEP +diff --git a/drivers/remoteproc/qcom_pil_info.c b/drivers/remoteproc/qcom_pil_info.c +index 5521c4437ffab..7c007dd7b2000 100644 +--- a/drivers/remoteproc/qcom_pil_info.c ++++ b/drivers/remoteproc/qcom_pil_info.c +@@ -56,7 +56,7 @@ static int qcom_pil_info_init(void) + memset_io(base, 0, resource_size(&imem)); + + _reloc.base = base; +- _reloc.num_entries = resource_size(&imem) / PIL_RELOC_ENTRY_SIZE; ++ _reloc.num_entries = (u32)resource_size(&imem) / PIL_RELOC_ENTRY_SIZE; + + return 0; + } +diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c +index 95ba1bd16db93..c4705269e39fa 100644 +--- a/drivers/scsi/pm8001/pm8001_hwi.c ++++ b/drivers/scsi/pm8001/pm8001_hwi.c +@@ -223,7 +223,7 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha) + PM8001_EVENT_LOG_SIZE; + pm8001_ha->main_cfg_tbl.pm8001_tbl.iop_event_log_option = 0x01; + pm8001_ha->main_cfg_tbl.pm8001_tbl.fatal_err_interrupt = 0x01; +- for (i = 0; i < PM8001_MAX_INB_NUM; i++) { ++ for (i = 0; i < pm8001_ha->max_q_num; i++) { + pm8001_ha->inbnd_q_tbl[i].element_pri_size_cnt = + PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x00<<30); + pm8001_ha->inbnd_q_tbl[i].upper_base_addr = +@@ -249,7 +249,7 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha) + pm8001_ha->inbnd_q_tbl[i].producer_idx = 0; + pm8001_ha->inbnd_q_tbl[i].consumer_index = 0; + } +- for (i = 0; i < PM8001_MAX_OUTB_NUM; i++) { ++ for (i = 0; i < pm8001_ha->max_q_num; i++) { + pm8001_ha->outbnd_q_tbl[i].element_size_cnt = + PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x01<<30); + pm8001_ha->outbnd_q_tbl[i].upper_base_addr = +@@ -671,9 +671,9 @@ static int pm8001_chip_init(struct pm8001_hba_info *pm8001_ha) + read_outbnd_queue_table(pm8001_ha); + /* update main config table ,inbound table and outbound table */ + update_main_config_table(pm8001_ha); +- for (i = 0; i < PM8001_MAX_INB_NUM; i++) ++ for (i = 0; i < pm8001_ha->max_q_num; i++) + update_inbnd_queue_table(pm8001_ha, i); +- for (i = 0; i < PM8001_MAX_OUTB_NUM; i++) ++ for (i = 0; i < pm8001_ha->max_q_num; i++) + update_outbnd_queue_table(pm8001_ha, i); + /* 8081 controller donot require these operations */ + if (deviceid != 0x8081 && deviceid != 0x0042) { +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c +index 97d9d5d99adcc..4215d9a8e5de4 100644 +--- a/drivers/scsi/ufs/ufshcd.c ++++ b/drivers/scsi/ufs/ufshcd.c +@@ -6256,37 +6256,34 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba, + DECLARE_COMPLETION_ONSTACK(wait); + struct request *req; + unsigned long flags; +- int free_slot, task_tag, err; ++ int task_tag, err; + + /* +- * Get free slot, sleep if slots are unavailable. +- * Even though we use wait_event() which sleeps indefinitely, +- * the maximum wait time is bounded by %TM_CMD_TIMEOUT. ++ * blk_get_request() is used here only to get a free tag. + */ + req = blk_get_request(q, REQ_OP_DRV_OUT, 0); + if (IS_ERR(req)) + return PTR_ERR(req); + + req->end_io_data = &wait; +- free_slot = req->tag; +- WARN_ON_ONCE(free_slot < 0 || free_slot >= hba->nutmrs); + ufshcd_hold(hba, false); + + spin_lock_irqsave(host->host_lock, flags); +- task_tag = hba->nutrs + free_slot; ++ blk_mq_start_request(req); + ++ task_tag = req->tag; + treq->req_header.dword_0 |= cpu_to_be32(task_tag); + +- memcpy(hba->utmrdl_base_addr + free_slot, treq, sizeof(*treq)); +- ufshcd_vops_setup_task_mgmt(hba, free_slot, tm_function); ++ memcpy(hba->utmrdl_base_addr + task_tag, treq, sizeof(*treq)); ++ ufshcd_vops_setup_task_mgmt(hba, task_tag, tm_function); + + /* send command to the controller */ +- __set_bit(free_slot, &hba->outstanding_tasks); ++ __set_bit(task_tag, &hba->outstanding_tasks); + + /* Make sure descriptors are ready before ringing the task doorbell */ + wmb(); + +- ufshcd_writel(hba, 1 << free_slot, REG_UTP_TASK_REQ_DOOR_BELL); ++ ufshcd_writel(hba, 1 << task_tag, REG_UTP_TASK_REQ_DOOR_BELL); + /* Make sure that doorbell is committed immediately */ + wmb(); + +@@ -6306,24 +6303,24 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba, + ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_complete_err"); + dev_err(hba->dev, "%s: task management cmd 0x%.2x timed-out\n", + __func__, tm_function); +- if (ufshcd_clear_tm_cmd(hba, free_slot)) +- dev_WARN(hba->dev, "%s: unable clear tm cmd (slot %d) after timeout\n", +- __func__, free_slot); ++ if (ufshcd_clear_tm_cmd(hba, task_tag)) ++ dev_WARN(hba->dev, "%s: unable to clear tm cmd (slot %d) after timeout\n", ++ __func__, task_tag); + err = -ETIMEDOUT; + } else { + err = 0; +- memcpy(treq, hba->utmrdl_base_addr + free_slot, sizeof(*treq)); ++ memcpy(treq, hba->utmrdl_base_addr + task_tag, sizeof(*treq)); + + ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_complete"); + } + + spin_lock_irqsave(hba->host->host_lock, flags); +- __clear_bit(free_slot, &hba->outstanding_tasks); ++ __clear_bit(task_tag, &hba->outstanding_tasks); + spin_unlock_irqrestore(hba->host->host_lock, flags); + ++ ufshcd_release(hba); + blk_put_request(req); + +- ufshcd_release(hba); + return err; + } + +diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c +index 9888a70618730..feb97470699d9 100644 +--- a/drivers/soc/fsl/qbman/qman.c ++++ b/drivers/soc/fsl/qbman/qman.c +@@ -186,7 +186,7 @@ struct qm_eqcr_entry { + __be32 tag; + struct qm_fd fd; + u8 __reserved3[32]; +-} __packed; ++} __packed __aligned(8); + #define QM_EQCR_VERB_VBIT 0x80 + #define QM_EQCR_VERB_CMD_MASK 0x61 /* but only one value; */ + #define QM_EQCR_VERB_CMD_ENQUEUE 0x01 +diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c +index 518fac4864cfa..a237f1cf9bd60 100644 +--- a/drivers/target/iscsi/iscsi_target.c ++++ b/drivers/target/iscsi/iscsi_target.c +@@ -1166,6 +1166,7 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, + + target_get_sess_cmd(&cmd->se_cmd, true); + ++ cmd->se_cmd.tag = (__force u32)cmd->init_task_tag; + cmd->sense_reason = target_cmd_init_cdb(&cmd->se_cmd, hdr->cdb); + if (cmd->sense_reason) { + if (cmd->sense_reason == TCM_OUT_OF_RESOURCES) { +@@ -1180,8 +1181,6 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, + if (cmd->sense_reason) + goto attach_cmd; + +- /* only used for printks or comparing with ->ref_task_tag */ +- cmd->se_cmd.tag = (__force u32)cmd->init_task_tag; + cmd->sense_reason = target_cmd_parse_cdb(&cmd->se_cmd); + if (cmd->sense_reason) + goto attach_cmd; +diff --git a/drivers/thunderbolt/retimer.c b/drivers/thunderbolt/retimer.c +index 620bcf586ee24..c44fad2b9fbbf 100644 +--- a/drivers/thunderbolt/retimer.c ++++ b/drivers/thunderbolt/retimer.c +@@ -347,7 +347,7 @@ static int tb_retimer_add(struct tb_port *port, u8 index, u32 auth_status) + ret = tb_retimer_nvm_add(rt); + if (ret) { + dev_err(&rt->dev, "failed to add NVM devices: %d\n", ret); +- device_del(&rt->dev); ++ device_unregister(&rt->dev); + return ret; + } + +@@ -406,7 +406,7 @@ static struct tb_retimer *tb_port_find_retimer(struct tb_port *port, u8 index) + */ + int tb_retimer_scan(struct tb_port *port) + { +- u32 status[TB_MAX_RETIMER_INDEX] = {}; ++ u32 status[TB_MAX_RETIMER_INDEX + 1] = {}; + int ret, i, last_idx = 0; + + if (!port->cap_usb4) +diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c +index 8f1de1fbbeedf..d8d3892e5a69a 100644 +--- a/drivers/usb/usbip/stub_dev.c ++++ b/drivers/usb/usbip/stub_dev.c +@@ -63,6 +63,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a + + dev_info(dev, "stub up\n"); + ++ mutex_lock(&sdev->ud.sysfs_lock); + spin_lock_irq(&sdev->ud.lock); + + if (sdev->ud.status != SDEV_ST_AVAILABLE) { +@@ -87,13 +88,13 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a + tcp_rx = kthread_create(stub_rx_loop, &sdev->ud, "stub_rx"); + if (IS_ERR(tcp_rx)) { + sockfd_put(socket); +- return -EINVAL; ++ goto unlock_mutex; + } + tcp_tx = kthread_create(stub_tx_loop, &sdev->ud, "stub_tx"); + if (IS_ERR(tcp_tx)) { + kthread_stop(tcp_rx); + sockfd_put(socket); +- return -EINVAL; ++ goto unlock_mutex; + } + + /* get task structs now */ +@@ -112,6 +113,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a + wake_up_process(sdev->ud.tcp_rx); + wake_up_process(sdev->ud.tcp_tx); + ++ mutex_unlock(&sdev->ud.sysfs_lock); ++ + } else { + dev_info(dev, "stub down\n"); + +@@ -122,6 +125,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a + spin_unlock_irq(&sdev->ud.lock); + + usbip_event_add(&sdev->ud, SDEV_EVENT_DOWN); ++ mutex_unlock(&sdev->ud.sysfs_lock); + } + + return count; +@@ -130,6 +134,8 @@ sock_err: + sockfd_put(socket); + err: + spin_unlock_irq(&sdev->ud.lock); ++unlock_mutex: ++ mutex_unlock(&sdev->ud.sysfs_lock); + return -EINVAL; + } + static DEVICE_ATTR_WO(usbip_sockfd); +@@ -270,6 +276,7 @@ static struct stub_device *stub_device_alloc(struct usb_device *udev) + sdev->ud.side = USBIP_STUB; + sdev->ud.status = SDEV_ST_AVAILABLE; + spin_lock_init(&sdev->ud.lock); ++ mutex_init(&sdev->ud.sysfs_lock); + sdev->ud.tcp_socket = NULL; + sdev->ud.sockfd = -1; + +diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h +index 8be857a4fa132..a7e6ce96f62c7 100644 +--- a/drivers/usb/usbip/usbip_common.h ++++ b/drivers/usb/usbip/usbip_common.h +@@ -263,6 +263,9 @@ struct usbip_device { + /* lock for status */ + spinlock_t lock; + ++ /* mutex for synchronizing sysfs store paths */ ++ struct mutex sysfs_lock; ++ + int sockfd; + struct socket *tcp_socket; + +diff --git a/drivers/usb/usbip/usbip_event.c b/drivers/usb/usbip/usbip_event.c +index 5d88917c96314..086ca76dd0531 100644 +--- a/drivers/usb/usbip/usbip_event.c ++++ b/drivers/usb/usbip/usbip_event.c +@@ -70,6 +70,7 @@ static void event_handler(struct work_struct *work) + while ((ud = get_event()) != NULL) { + usbip_dbg_eh("pending event %lx\n", ud->event); + ++ mutex_lock(&ud->sysfs_lock); + /* + * NOTE: shutdown must come first. + * Shutdown the device. +@@ -90,6 +91,7 @@ static void event_handler(struct work_struct *work) + ud->eh_ops.unusable(ud); + unset_event(ud, USBIP_EH_UNUSABLE); + } ++ mutex_unlock(&ud->sysfs_lock); + + wake_up(&ud->eh_waitq); + } +diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c +index a20a8380ca0c9..4ba6bcdaa8e9d 100644 +--- a/drivers/usb/usbip/vhci_hcd.c ++++ b/drivers/usb/usbip/vhci_hcd.c +@@ -1101,6 +1101,7 @@ static void vhci_device_init(struct vhci_device *vdev) + vdev->ud.side = USBIP_VHCI; + vdev->ud.status = VDEV_ST_NULL; + spin_lock_init(&vdev->ud.lock); ++ mutex_init(&vdev->ud.sysfs_lock); + + INIT_LIST_HEAD(&vdev->priv_rx); + INIT_LIST_HEAD(&vdev->priv_tx); +diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c +index e64ea314930be..ebc7be1d98207 100644 +--- a/drivers/usb/usbip/vhci_sysfs.c ++++ b/drivers/usb/usbip/vhci_sysfs.c +@@ -185,6 +185,8 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport) + + usbip_dbg_vhci_sysfs("enter\n"); + ++ mutex_lock(&vdev->ud.sysfs_lock); ++ + /* lock */ + spin_lock_irqsave(&vhci->lock, flags); + spin_lock(&vdev->ud.lock); +@@ -195,6 +197,7 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport) + /* unlock */ + spin_unlock(&vdev->ud.lock); + spin_unlock_irqrestore(&vhci->lock, flags); ++ mutex_unlock(&vdev->ud.sysfs_lock); + + return -EINVAL; + } +@@ -205,6 +208,8 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport) + + usbip_event_add(&vdev->ud, VDEV_EVENT_DOWN); + ++ mutex_unlock(&vdev->ud.sysfs_lock); ++ + return 0; + } + +@@ -349,30 +354,36 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, + else + vdev = &vhci->vhci_hcd_hs->vdev[rhport]; + ++ mutex_lock(&vdev->ud.sysfs_lock); ++ + /* Extract socket from fd. */ + socket = sockfd_lookup(sockfd, &err); + if (!socket) { + dev_err(dev, "failed to lookup sock"); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + if (socket->type != SOCK_STREAM) { + dev_err(dev, "Expecting SOCK_STREAM - found %d", + socket->type); + sockfd_put(socket); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + + /* create threads before locking */ + tcp_rx = kthread_create(vhci_rx_loop, &vdev->ud, "vhci_rx"); + if (IS_ERR(tcp_rx)) { + sockfd_put(socket); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + tcp_tx = kthread_create(vhci_tx_loop, &vdev->ud, "vhci_tx"); + if (IS_ERR(tcp_tx)) { + kthread_stop(tcp_rx); + sockfd_put(socket); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + + /* get task structs now */ +@@ -397,7 +408,8 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, + * Will be retried from userspace + * if there's another free port. + */ +- return -EBUSY; ++ err = -EBUSY; ++ goto unlock_mutex; + } + + dev_info(dev, "pdev(%u) rhport(%u) sockfd(%d)\n", +@@ -422,7 +434,15 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, + + rh_port_connect(vdev, speed); + ++ dev_info(dev, "Device attached\n"); ++ ++ mutex_unlock(&vdev->ud.sysfs_lock); ++ + return count; ++ ++unlock_mutex: ++ mutex_unlock(&vdev->ud.sysfs_lock); ++ return err; + } + static DEVICE_ATTR_WO(attach); + +diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c +index c8eeabdd9b568..2bc428f2e2610 100644 +--- a/drivers/usb/usbip/vudc_dev.c ++++ b/drivers/usb/usbip/vudc_dev.c +@@ -572,6 +572,7 @@ static int init_vudc_hw(struct vudc *udc) + init_waitqueue_head(&udc->tx_waitq); + + spin_lock_init(&ud->lock); ++ mutex_init(&ud->sysfs_lock); + ud->status = SDEV_ST_AVAILABLE; + ud->side = USBIP_VUDC; + +diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c +index 7383a543c6d12..f7633ee655a17 100644 +--- a/drivers/usb/usbip/vudc_sysfs.c ++++ b/drivers/usb/usbip/vudc_sysfs.c +@@ -112,6 +112,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, + dev_err(dev, "no device"); + return -ENODEV; + } ++ mutex_lock(&udc->ud.sysfs_lock); + spin_lock_irqsave(&udc->lock, flags); + /* Don't export what we don't have */ + if (!udc->driver || !udc->pullup) { +@@ -187,6 +188,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, + + wake_up_process(udc->ud.tcp_rx); + wake_up_process(udc->ud.tcp_tx); ++ ++ mutex_unlock(&udc->ud.sysfs_lock); + return count; + + } else { +@@ -207,6 +210,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, + } + + spin_unlock_irqrestore(&udc->lock, flags); ++ mutex_unlock(&udc->ud.sysfs_lock); + + return count; + +@@ -216,6 +220,7 @@ unlock_ud: + spin_unlock_irq(&udc->ud.lock); + unlock: + spin_unlock_irqrestore(&udc->lock, flags); ++ mutex_unlock(&udc->ud.sysfs_lock); + + return ret; + } +diff --git a/drivers/vdpa/mlx5/core/mlx5_vdpa.h b/drivers/vdpa/mlx5/core/mlx5_vdpa.h +index 08f742fd24099..b6cc53ba980cc 100644 +--- a/drivers/vdpa/mlx5/core/mlx5_vdpa.h ++++ b/drivers/vdpa/mlx5/core/mlx5_vdpa.h +@@ -4,9 +4,13 @@ + #ifndef __MLX5_VDPA_H__ + #define __MLX5_VDPA_H__ + ++#include ++#include + #include + #include + ++#define MLX5V_ETH_HARD_MTU (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN) ++ + struct mlx5_vdpa_direct_mr { + u64 start; + u64 end; +diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c +index 5a86ede36c1ca..65cfbd3771301 100644 +--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c ++++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c +@@ -805,7 +805,7 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque + MLX5_SET(virtio_q, vq_ctx, event_qpn_or_msix, mvq->fwqp.mqp.qpn); + MLX5_SET(virtio_q, vq_ctx, queue_size, mvq->num_ent); + MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, +- !!(ndev->mvdev.actual_features & VIRTIO_F_VERSION_1)); ++ !!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_F_VERSION_1))); + MLX5_SET64(virtio_q, vq_ctx, desc_addr, mvq->desc_addr); + MLX5_SET64(virtio_q, vq_ctx, used_addr, mvq->device_addr); + MLX5_SET64(virtio_q, vq_ctx, available_addr, mvq->driver_addr); +@@ -1154,6 +1154,7 @@ static void suspend_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *m + return; + } + mvq->avail_idx = attr.available_index; ++ mvq->used_idx = attr.used_index; + } + + static void suspend_vqs(struct mlx5_vdpa_net *ndev) +@@ -1411,6 +1412,7 @@ static int mlx5_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx, + return -EINVAL; + } + ++ mvq->used_idx = state->avail_index; + mvq->avail_idx = state->avail_index; + return 0; + } +@@ -1428,7 +1430,11 @@ static int mlx5_vdpa_get_vq_state(struct vdpa_device *vdev, u16 idx, struct vdpa + * that cares about emulating the index after vq is stopped. + */ + if (!mvq->initialized) { +- state->avail_index = mvq->avail_idx; ++ /* Firmware returns a wrong value for the available index. ++ * Since both values should be identical, we take the value of ++ * used_idx which is reported correctly. ++ */ ++ state->avail_index = mvq->used_idx; + return 0; + } + +@@ -1437,7 +1443,7 @@ static int mlx5_vdpa_get_vq_state(struct vdpa_device *vdev, u16 idx, struct vdpa + mlx5_vdpa_warn(mvdev, "failed to query virtqueue\n"); + return err; + } +- state->avail_index = attr.available_index; ++ state->avail_index = attr.used_index; + return 0; + } + +@@ -1525,21 +1531,11 @@ static void teardown_virtqueues(struct mlx5_vdpa_net *ndev) + } + } + +-static void clear_virtqueues(struct mlx5_vdpa_net *ndev) +-{ +- int i; +- +- for (i = ndev->mvdev.max_vqs - 1; i >= 0; i--) { +- ndev->vqs[i].avail_idx = 0; +- ndev->vqs[i].used_idx = 0; +- } +-} +- + /* TODO: cross-endian support */ + static inline bool mlx5_vdpa_is_little_endian(struct mlx5_vdpa_dev *mvdev) + { + return virtio_legacy_is_little_endian() || +- (mvdev->actual_features & (1ULL << VIRTIO_F_VERSION_1)); ++ (mvdev->actual_features & BIT_ULL(VIRTIO_F_VERSION_1)); + } + + static __virtio16 cpu_to_mlx5vdpa16(struct mlx5_vdpa_dev *mvdev, u16 val) +@@ -1770,7 +1766,6 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) + if (!status) { + mlx5_vdpa_info(mvdev, "performing device reset\n"); + teardown_driver(ndev); +- clear_virtqueues(ndev); + mlx5_vdpa_destroy_mr(&ndev->mvdev); + ndev->mvdev.status = 0; + ndev->mvdev.mlx_features = 0; +@@ -1892,6 +1887,19 @@ static const struct vdpa_config_ops mlx5_vdpa_ops = { + .free = mlx5_vdpa_free, + }; + ++static int query_mtu(struct mlx5_core_dev *mdev, u16 *mtu) ++{ ++ u16 hw_mtu; ++ int err; ++ ++ err = mlx5_query_nic_vport_mtu(mdev, &hw_mtu); ++ if (err) ++ return err; ++ ++ *mtu = hw_mtu - MLX5V_ETH_HARD_MTU; ++ return 0; ++} ++ + static int alloc_resources(struct mlx5_vdpa_net *ndev) + { + struct mlx5_vdpa_net_resources *res = &ndev->res; +@@ -1974,7 +1982,7 @@ void *mlx5_vdpa_add_dev(struct mlx5_core_dev *mdev) + init_mvqs(ndev); + mutex_init(&ndev->reslock); + config = &ndev->config; +- err = mlx5_query_nic_vport_mtu(mdev, &ndev->mtu); ++ err = query_mtu(mdev, &ndev->mtu); + if (err) + goto err_mtu; + +diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c +index 7bd03f6e0422f..b91c19b90b8b4 100644 +--- a/drivers/xen/events/events_base.c ++++ b/drivers/xen/events/events_base.c +@@ -108,7 +108,7 @@ struct irq_info { + unsigned short eoi_cpu; /* EOI must happen on this cpu-1 */ + unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */ + u64 eoi_time; /* Time in jiffies when to EOI. */ +- spinlock_t lock; ++ raw_spinlock_t lock; + + union { + unsigned short virq; +@@ -280,7 +280,7 @@ static int xen_irq_info_common_setup(struct irq_info *info, + info->evtchn = evtchn; + info->cpu = cpu; + info->mask_reason = EVT_MASK_REASON_EXPLICIT; +- spin_lock_init(&info->lock); ++ raw_spin_lock_init(&info->lock); + + ret = set_evtchn_to_irq(evtchn, irq); + if (ret < 0) +@@ -432,28 +432,28 @@ static void do_mask(struct irq_info *info, u8 reason) + { + unsigned long flags; + +- spin_lock_irqsave(&info->lock, flags); ++ raw_spin_lock_irqsave(&info->lock, flags); + + if (!info->mask_reason) + mask_evtchn(info->evtchn); + + info->mask_reason |= reason; + +- spin_unlock_irqrestore(&info->lock, flags); ++ raw_spin_unlock_irqrestore(&info->lock, flags); + } + + static void do_unmask(struct irq_info *info, u8 reason) + { + unsigned long flags; + +- spin_lock_irqsave(&info->lock, flags); ++ raw_spin_lock_irqsave(&info->lock, flags); + + info->mask_reason &= ~reason; + + if (!info->mask_reason) + unmask_evtchn(info->evtchn); + +- spin_unlock_irqrestore(&info->lock, flags); ++ raw_spin_unlock_irqrestore(&info->lock, flags); + } + + #ifdef CONFIG_X86 +diff --git a/fs/direct-io.c b/fs/direct-io.c +index d53fa92a1ab65..c64d4eb38995a 100644 +--- a/fs/direct-io.c ++++ b/fs/direct-io.c +@@ -810,6 +810,7 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page, + struct buffer_head *map_bh) + { + int ret = 0; ++ int boundary = sdio->boundary; /* dio_send_cur_page may clear it */ + + if (dio->op == REQ_OP_WRITE) { + /* +@@ -848,10 +849,10 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page, + sdio->cur_page_fs_offset = sdio->block_in_file << sdio->blkbits; + out: + /* +- * If sdio->boundary then we want to schedule the IO now to ++ * If boundary then we want to schedule the IO now to + * avoid metadata seeks. + */ +- if (sdio->boundary) { ++ if (boundary) { + ret = dio_send_cur_page(dio, sdio, map_bh); + if (sdio->bio) + dio_bio_submit(dio, sdio); +diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c +index c070c0d8e3e97..d4e360234579b 100644 +--- a/fs/hostfs/hostfs_kern.c ++++ b/fs/hostfs/hostfs_kern.c +@@ -142,7 +142,7 @@ static char *follow_link(char *link) + char *name, *resolved, *end; + int n; + +- name = __getname(); ++ name = kmalloc(PATH_MAX, GFP_KERNEL); + if (!name) { + n = -ENOMEM; + goto out_free; +@@ -171,12 +171,11 @@ static char *follow_link(char *link) + goto out_free; + } + +- __putname(name); +- kfree(link); ++ kfree(name); + return resolved; + + out_free: +- __putname(name); ++ kfree(name); + return ERR_PTR(n); + } + +diff --git a/fs/namei.c b/fs/namei.c +index 7af66d5a0c1bf..4c9d0c36545d3 100644 +--- a/fs/namei.c ++++ b/fs/namei.c +@@ -2328,16 +2328,16 @@ static int path_lookupat(struct nameidata *nd, unsigned flags, struct path *path + while (!(err = link_path_walk(s, nd)) && + (s = lookup_last(nd)) != NULL) + ; ++ if (!err && unlikely(nd->flags & LOOKUP_MOUNTPOINT)) { ++ err = handle_lookup_down(nd); ++ nd->flags &= ~LOOKUP_JUMPED; // no d_weak_revalidate(), please... ++ } + if (!err) + err = complete_walk(nd); + + if (!err && nd->flags & LOOKUP_DIRECTORY) + if (!d_can_lookup(nd->path.dentry)) + err = -ENOTDIR; +- if (!err && unlikely(nd->flags & LOOKUP_MOUNTPOINT)) { +- err = handle_lookup_down(nd); +- nd->flags &= ~LOOKUP_JUMPED; // no d_weak_revalidate(), please... +- } + if (!err) { + *path = nd->path; + nd->path.mnt = NULL; +diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c +index 3bfb4147895a0..ad20403b383fa 100644 +--- a/fs/ocfs2/aops.c ++++ b/fs/ocfs2/aops.c +@@ -2295,7 +2295,7 @@ static int ocfs2_dio_end_io_write(struct inode *inode, + struct ocfs2_alloc_context *meta_ac = NULL; + handle_t *handle = NULL; + loff_t end = offset + bytes; +- int ret = 0, credits = 0, locked = 0; ++ int ret = 0, credits = 0; + + ocfs2_init_dealloc_ctxt(&dealloc); + +@@ -2306,13 +2306,6 @@ static int ocfs2_dio_end_io_write(struct inode *inode, + !dwc->dw_orphaned) + goto out; + +- /* ocfs2_file_write_iter will get i_mutex, so we need not lock if we +- * are in that context. */ +- if (dwc->dw_writer_pid != task_pid_nr(current)) { +- inode_lock(inode); +- locked = 1; +- } +- + ret = ocfs2_inode_lock(inode, &di_bh, 1); + if (ret < 0) { + mlog_errno(ret); +@@ -2393,8 +2386,6 @@ out: + if (meta_ac) + ocfs2_free_alloc_context(meta_ac); + ocfs2_run_deallocs(osb, &dealloc); +- if (locked) +- inode_unlock(inode); + ocfs2_dio_free_write_ctx(inode, dwc); + + return ret; +diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c +index 85979e2214b39..8880071ee4ee0 100644 +--- a/fs/ocfs2/file.c ++++ b/fs/ocfs2/file.c +@@ -1244,22 +1244,24 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) + goto bail_unlock; + } + } ++ down_write(&OCFS2_I(inode)->ip_alloc_sem); + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS + + 2 * ocfs2_quota_trans_credits(sb)); + if (IS_ERR(handle)) { + status = PTR_ERR(handle); + mlog_errno(status); +- goto bail_unlock; ++ goto bail_unlock_alloc; + } + status = __dquot_transfer(inode, transfer_to); + if (status < 0) + goto bail_commit; + } else { ++ down_write(&OCFS2_I(inode)->ip_alloc_sem); + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); + if (IS_ERR(handle)) { + status = PTR_ERR(handle); + mlog_errno(status); +- goto bail_unlock; ++ goto bail_unlock_alloc; + } + } + +@@ -1272,6 +1274,8 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) + + bail_commit: + ocfs2_commit_trans(osb, handle); ++bail_unlock_alloc: ++ up_write(&OCFS2_I(inode)->ip_alloc_sem); + bail_unlock: + if (status && inode_locked) { + ocfs2_inode_unlock_tracker(inode, 1, &oh, had_lock); +diff --git a/include/linux/avf/virtchnl.h b/include/linux/avf/virtchnl.h +index 40bad71865ea7..532bcbfc47161 100644 +--- a/include/linux/avf/virtchnl.h ++++ b/include/linux/avf/virtchnl.h +@@ -476,7 +476,6 @@ struct virtchnl_rss_key { + u16 vsi_id; + u16 key_len; + u8 key[1]; /* RSS hash key, packed bytes */ +- u8 pad[1]; + }; + + VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_key); +@@ -485,7 +484,6 @@ struct virtchnl_rss_lut { + u16 vsi_id; + u16 lut_entries; + u8 lut[1]; /* RSS lookup table */ +- u8 pad[1]; + }; + + VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_lut); +diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h +index 233352447b1a4..cc9ee07769745 100644 +--- a/include/linux/mlx5/mlx5_ifc.h ++++ b/include/linux/mlx5/mlx5_ifc.h +@@ -435,11 +435,11 @@ struct mlx5_ifc_flow_table_prop_layout_bits { + u8 reserved_at_60[0x18]; + u8 log_max_ft_num[0x8]; + +- u8 reserved_at_80[0x18]; ++ u8 reserved_at_80[0x10]; ++ u8 log_max_flow_counter[0x8]; + u8 log_max_destination[0x8]; + +- u8 log_max_flow_counter[0x8]; +- u8 reserved_at_a8[0x10]; ++ u8 reserved_at_a0[0x18]; + u8 log_max_flow[0x8]; + + u8 reserved_at_c0[0x40]; +@@ -8719,6 +8719,8 @@ struct mlx5_ifc_pplm_reg_bits { + + u8 fec_override_admin_100g_2x[0x10]; + u8 fec_override_admin_50g_1x[0x10]; ++ ++ u8 reserved_at_140[0x140]; + }; + + struct mlx5_ifc_ppcnt_reg_bits { +@@ -10056,7 +10058,7 @@ struct mlx5_ifc_pbmc_reg_bits { + + struct mlx5_ifc_bufferx_reg_bits buffer[10]; + +- u8 reserved_at_2e0[0x40]; ++ u8 reserved_at_2e0[0x80]; + }; + + struct mlx5_ifc_qtct_reg_bits { +diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h +index fec0c5ac1c4f9..82126d5297986 100644 +--- a/include/linux/skmsg.h ++++ b/include/linux/skmsg.h +@@ -349,8 +349,13 @@ static inline void sk_psock_update_proto(struct sock *sk, + static inline void sk_psock_restore_proto(struct sock *sk, + struct sk_psock *psock) + { +- sk->sk_prot->unhash = psock->saved_unhash; + if (inet_csk_has_ulp(sk)) { ++ /* TLS does not have an unhash proto in SW cases, but we need ++ * to ensure we stop using the sock_map unhash routine because ++ * the associated psock is being removed. So use the original ++ * unhash handler. ++ */ ++ WRITE_ONCE(sk->sk_prot->unhash, psock->saved_unhash); + tcp_update_ulp(sk, psock->sk_proto, psock->saved_write_space); + } else { + sk->sk_write_space = psock->saved_write_space; +diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h +index 6b5fcfa1e5553..98775d7fa6963 100644 +--- a/include/linux/virtio_net.h ++++ b/include/linux/virtio_net.h +@@ -62,6 +62,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, + return -EINVAL; + } + ++ skb_reset_mac_header(skb); ++ + if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { + u16 start = __virtio16_to_cpu(little_endian, hdr->csum_start); + u16 off = __virtio16_to_cpu(little_endian, hdr->csum_offset); +diff --git a/include/net/act_api.h b/include/net/act_api.h +index 89b42a1e4f88e..2c88b8af3cdbe 100644 +--- a/include/net/act_api.h ++++ b/include/net/act_api.h +@@ -170,12 +170,7 @@ void tcf_idr_insert_many(struct tc_action *actions[]); + void tcf_idr_cleanup(struct tc_action_net *tn, u32 index); + int tcf_idr_check_alloc(struct tc_action_net *tn, u32 *index, + struct tc_action **a, int bind); +-int __tcf_idr_release(struct tc_action *a, bool bind, bool strict); +- +-static inline int tcf_idr_release(struct tc_action *a, bool bind) +-{ +- return __tcf_idr_release(a, bind, false); +-} ++int tcf_idr_release(struct tc_action *a, bool bind); + + int tcf_register_action(struct tc_action_ops *a, struct pernet_operations *ops); + int tcf_unregister_action(struct tc_action_ops *a, +@@ -185,7 +180,7 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions, + int nr_actions, struct tcf_result *res); + int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, + struct nlattr *est, char *name, int ovr, int bind, +- struct tc_action *actions[], size_t *attr_size, ++ struct tc_action *actions[], int init_res[], size_t *attr_size, + bool rtnl_held, struct netlink_ext_ack *extack); + struct tc_action_ops *tc_action_load_ops(char *name, struct nlattr *nla, + bool rtnl_held, +@@ -193,7 +188,8 @@ struct tc_action_ops *tc_action_load_ops(char *name, struct nlattr *nla, + struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, + struct nlattr *nla, struct nlattr *est, + char *name, int ovr, int bind, +- struct tc_action_ops *ops, bool rtnl_held, ++ struct tc_action_ops *a_o, int *init_res, ++ bool rtnl_held, + struct netlink_ext_ack *extack); + int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[], int bind, + int ref, bool terse); +diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h +index 59f45b1e9dac0..b59d73d529ba7 100644 +--- a/include/net/netns/xfrm.h ++++ b/include/net/netns/xfrm.h +@@ -72,7 +72,9 @@ struct netns_xfrm { + #if IS_ENABLED(CONFIG_IPV6) + struct dst_ops xfrm6_dst_ops; + #endif +- spinlock_t xfrm_state_lock; ++ spinlock_t xfrm_state_lock; ++ seqcount_t xfrm_state_hash_generation; ++ + spinlock_t xfrm_policy_lock; + struct mutex xfrm_cfg_mutex; + }; +diff --git a/include/net/red.h b/include/net/red.h +index 9e6647c4ccd1f..cc9f6b0d7f1e9 100644 +--- a/include/net/red.h ++++ b/include/net/red.h +@@ -171,9 +171,9 @@ static inline void red_set_vars(struct red_vars *v) + static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog, + u8 Scell_log, u8 *stab) + { +- if (fls(qth_min) + Wlog > 32) ++ if (fls(qth_min) + Wlog >= 32) + return false; +- if (fls(qth_max) + Wlog > 32) ++ if (fls(qth_max) + Wlog >= 32) + return false; + if (Scell_log >= 32) + return false; +diff --git a/include/net/sock.h b/include/net/sock.h +index 253202dcc5e61..261195598df39 100644 +--- a/include/net/sock.h ++++ b/include/net/sock.h +@@ -2197,6 +2197,15 @@ static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk) + sk_mem_charge(sk, skb->truesize); + } + ++static inline void skb_set_owner_sk_safe(struct sk_buff *skb, struct sock *sk) ++{ ++ if (sk && refcount_inc_not_zero(&sk->sk_refcnt)) { ++ skb_orphan(skb); ++ skb->destructor = sock_efree; ++ skb->sk = sk; ++ } ++} ++ + void sk_reset_timer(struct sock *sk, struct timer_list *timer, + unsigned long expires); + +diff --git a/include/net/xfrm.h b/include/net/xfrm.h +index b2a06f10b62ce..c58a6d4eb6103 100644 +--- a/include/net/xfrm.h ++++ b/include/net/xfrm.h +@@ -1097,7 +1097,7 @@ static inline int __xfrm_policy_check2(struct sock *sk, int dir, + return __xfrm_policy_check(sk, ndir, skb, family); + + return (!net->xfrm.policy_count[dir] && !secpath_exists(skb)) || +- (skb_dst(skb)->flags & DST_NOPOLICY) || ++ (skb_dst(skb) && (skb_dst(skb)->flags & DST_NOPOLICY)) || + __xfrm_policy_check(sk, ndir, skb, family); + } + +@@ -1557,7 +1557,7 @@ int xfrm_trans_queue_net(struct net *net, struct sk_buff *skb, + int xfrm_trans_queue(struct sk_buff *skb, + int (*finish)(struct net *, struct sock *, + struct sk_buff *)); +-int xfrm_output_resume(struct sk_buff *skb, int err); ++int xfrm_output_resume(struct sock *sk, struct sk_buff *skb, int err); + int xfrm_output(struct sock *sk, struct sk_buff *skb); + + #if IS_ENABLED(CONFIG_NET_PKTGEN) +diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c +index dd4b7fd60ee7d..6b14b4c4068cc 100644 +--- a/kernel/bpf/inode.c ++++ b/kernel/bpf/inode.c +@@ -546,7 +546,7 @@ int bpf_obj_get_user(const char __user *pathname, int flags) + else if (type == BPF_TYPE_MAP) + ret = bpf_map_new_fd(raw, f_flags); + else if (type == BPF_TYPE_LINK) +- ret = bpf_link_new_fd(raw); ++ ret = (f_flags != O_RDWR) ? -EINVAL : bpf_link_new_fd(raw); + else + return -ENOENT; + +diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c +index 6e83bf8c080db..ebf60848d5eb7 100644 +--- a/kernel/bpf/stackmap.c ++++ b/kernel/bpf/stackmap.c +@@ -662,9 +662,17 @@ const struct bpf_func_proto bpf_get_stack_proto = { + BPF_CALL_4(bpf_get_task_stack, struct task_struct *, task, void *, buf, + u32, size, u64, flags) + { +- struct pt_regs *regs = task_pt_regs(task); ++ struct pt_regs *regs; ++ long res; + +- return __bpf_get_stack(regs, task, NULL, buf, size, flags); ++ if (!try_get_task_stack(task)) ++ return -EFAULT; ++ ++ regs = task_pt_regs(task); ++ res = __bpf_get_stack(regs, task, NULL, buf, size, flags); ++ put_task_stack(task); ++ ++ return res; + } + + BTF_ID_LIST_SINGLE(bpf_get_task_stack_btf_ids, struct, task_struct) +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c +index 9a1aba2d00733..12cd2997f982a 100644 +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -11429,6 +11429,11 @@ static int check_struct_ops_btf_id(struct bpf_verifier_env *env) + u32 btf_id, member_idx; + const char *mname; + ++ if (!prog->gpl_compatible) { ++ verbose(env, "struct ops programs must have a GPL compatible license\n"); ++ return -EINVAL; ++ } ++ + btf_id = prog->aux->attach_btf_id; + st_ops = bpf_struct_ops_find(btf_id); + if (!st_ops) { +diff --git a/kernel/gcov/clang.c b/kernel/gcov/clang.c +index 8743150db2acc..c466c7fbdece5 100644 +--- a/kernel/gcov/clang.c ++++ b/kernel/gcov/clang.c +@@ -70,7 +70,9 @@ struct gcov_fn_info { + + u32 ident; + u32 checksum; ++#if CONFIG_CLANG_VERSION < 110000 + u8 use_extra_checksum; ++#endif + u32 cfg_checksum; + + u32 num_counters; +@@ -145,10 +147,8 @@ void llvm_gcda_emit_function(u32 ident, const char *function_name, + + list_add_tail(&info->head, ¤t_info->functions); + } +-EXPORT_SYMBOL(llvm_gcda_emit_function); + #else +-void llvm_gcda_emit_function(u32 ident, u32 func_checksum, +- u8 use_extra_checksum, u32 cfg_checksum) ++void llvm_gcda_emit_function(u32 ident, u32 func_checksum, u32 cfg_checksum) + { + struct gcov_fn_info *info = kzalloc(sizeof(*info), GFP_KERNEL); + +@@ -158,12 +158,11 @@ void llvm_gcda_emit_function(u32 ident, u32 func_checksum, + INIT_LIST_HEAD(&info->head); + info->ident = ident; + info->checksum = func_checksum; +- info->use_extra_checksum = use_extra_checksum; + info->cfg_checksum = cfg_checksum; + list_add_tail(&info->head, ¤t_info->functions); + } +-EXPORT_SYMBOL(llvm_gcda_emit_function); + #endif ++EXPORT_SYMBOL(llvm_gcda_emit_function); + + void llvm_gcda_emit_arcs(u32 num_counters, u64 *counters) + { +@@ -293,11 +292,16 @@ int gcov_info_is_compatible(struct gcov_info *info1, struct gcov_info *info2) + !list_is_last(&fn_ptr2->head, &info2->functions)) { + if (fn_ptr1->checksum != fn_ptr2->checksum) + return false; ++#if CONFIG_CLANG_VERSION < 110000 + if (fn_ptr1->use_extra_checksum != fn_ptr2->use_extra_checksum) + return false; + if (fn_ptr1->use_extra_checksum && + fn_ptr1->cfg_checksum != fn_ptr2->cfg_checksum) + return false; ++#else ++ if (fn_ptr1->cfg_checksum != fn_ptr2->cfg_checksum) ++ return false; ++#endif + fn_ptr1 = list_next_entry(fn_ptr1, head); + fn_ptr2 = list_next_entry(fn_ptr2, head); + } +@@ -529,17 +533,22 @@ static size_t convert_to_gcda(char *buffer, struct gcov_info *info) + + list_for_each_entry(fi_ptr, &info->functions, head) { + u32 i; +- u32 len = 2; +- +- if (fi_ptr->use_extra_checksum) +- len++; + + pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION); +- pos += store_gcov_u32(buffer, pos, len); ++#if CONFIG_CLANG_VERSION < 110000 ++ pos += store_gcov_u32(buffer, pos, ++ fi_ptr->use_extra_checksum ? 3 : 2); ++#else ++ pos += store_gcov_u32(buffer, pos, 3); ++#endif + pos += store_gcov_u32(buffer, pos, fi_ptr->ident); + pos += store_gcov_u32(buffer, pos, fi_ptr->checksum); ++#if CONFIG_CLANG_VERSION < 110000 + if (fi_ptr->use_extra_checksum) + pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); ++#else ++ pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); ++#endif + + pos += store_gcov_u32(buffer, pos, GCOV_TAG_COUNTER_BASE); + pos += store_gcov_u32(buffer, pos, fi_ptr->num_counters * 2); +diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c +index 780012eb2f3fe..eead7efbe7e5d 100644 +--- a/kernel/locking/lockdep.c ++++ b/kernel/locking/lockdep.c +@@ -705,7 +705,7 @@ static void print_lock_name(struct lock_class *class) + + printk(KERN_CONT " ("); + __print_lock_name(class); +- printk(KERN_CONT "){%s}-{%hd:%hd}", usage, ++ printk(KERN_CONT "){%s}-{%d:%d}", usage, + class->wait_type_outer ?: class->wait_type_inner, + class->wait_type_inner); + } +diff --git a/kernel/workqueue.c b/kernel/workqueue.c +index 1d99c52cc99a6..1e2ca744dadbe 100644 +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -1409,7 +1409,6 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, + */ + lockdep_assert_irqs_disabled(); + +- debug_work_activate(work); + + /* if draining, only works from the same workqueue are allowed */ + if (unlikely(wq->flags & __WQ_DRAINING) && +@@ -1491,6 +1490,7 @@ retry: + worklist = &pwq->delayed_works; + } + ++ debug_work_activate(work); + insert_work(pwq, work, worklist, work_flags); + + out: +diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h +index 18b768ac7dcae..095d7eaa0db42 100644 +--- a/mm/percpu-internal.h ++++ b/mm/percpu-internal.h +@@ -87,7 +87,7 @@ extern spinlock_t pcpu_lock; + + extern struct list_head *pcpu_chunk_lists; + extern int pcpu_nr_slots; +-extern int pcpu_nr_empty_pop_pages; ++extern int pcpu_nr_empty_pop_pages[]; + + extern struct pcpu_chunk *pcpu_first_chunk; + extern struct pcpu_chunk *pcpu_reserved_chunk; +diff --git a/mm/percpu-stats.c b/mm/percpu-stats.c +index c8400a2adbc2b..f6026dbcdf6b3 100644 +--- a/mm/percpu-stats.c ++++ b/mm/percpu-stats.c +@@ -145,6 +145,7 @@ static int percpu_stats_show(struct seq_file *m, void *v) + int slot, max_nr_alloc; + int *buffer; + enum pcpu_chunk_type type; ++ int nr_empty_pop_pages; + + alloc_buffer: + spin_lock_irq(&pcpu_lock); +@@ -165,7 +166,11 @@ alloc_buffer: + goto alloc_buffer; + } + +-#define PL(X) \ ++ nr_empty_pop_pages = 0; ++ for (type = 0; type < PCPU_NR_CHUNK_TYPES; type++) ++ nr_empty_pop_pages += pcpu_nr_empty_pop_pages[type]; ++ ++#define PL(X) \ + seq_printf(m, " %-20s: %12lld\n", #X, (long long int)pcpu_stats_ai.X) + + seq_printf(m, +@@ -196,7 +201,7 @@ alloc_buffer: + PU(nr_max_chunks); + PU(min_alloc_size); + PU(max_alloc_size); +- P("empty_pop_pages", pcpu_nr_empty_pop_pages); ++ P("empty_pop_pages", nr_empty_pop_pages); + seq_putc(m, '\n'); + + #undef PU +diff --git a/mm/percpu.c b/mm/percpu.c +index ad7a37ee74ef5..e12ab708fe15b 100644 +--- a/mm/percpu.c ++++ b/mm/percpu.c +@@ -172,10 +172,10 @@ struct list_head *pcpu_chunk_lists __ro_after_init; /* chunk list slots */ + static LIST_HEAD(pcpu_map_extend_chunks); + + /* +- * The number of empty populated pages, protected by pcpu_lock. The +- * reserved chunk doesn't contribute to the count. ++ * The number of empty populated pages by chunk type, protected by pcpu_lock. ++ * The reserved chunk doesn't contribute to the count. + */ +-int pcpu_nr_empty_pop_pages; ++int pcpu_nr_empty_pop_pages[PCPU_NR_CHUNK_TYPES]; + + /* + * The number of populated pages in use by the allocator, protected by +@@ -555,7 +555,7 @@ static inline void pcpu_update_empty_pages(struct pcpu_chunk *chunk, int nr) + { + chunk->nr_empty_pop_pages += nr; + if (chunk != pcpu_reserved_chunk) +- pcpu_nr_empty_pop_pages += nr; ++ pcpu_nr_empty_pop_pages[pcpu_chunk_type(chunk)] += nr; + } + + /* +@@ -1831,7 +1831,7 @@ area_found: + mutex_unlock(&pcpu_alloc_mutex); + } + +- if (pcpu_nr_empty_pop_pages < PCPU_EMPTY_POP_PAGES_LOW) ++ if (pcpu_nr_empty_pop_pages[type] < PCPU_EMPTY_POP_PAGES_LOW) + pcpu_schedule_balance_work(); + + /* clear the areas and return address relative to base address */ +@@ -1999,7 +1999,7 @@ retry_pop: + pcpu_atomic_alloc_failed = false; + } else { + nr_to_pop = clamp(PCPU_EMPTY_POP_PAGES_HIGH - +- pcpu_nr_empty_pop_pages, ++ pcpu_nr_empty_pop_pages[type], + 0, PCPU_EMPTY_POP_PAGES_HIGH); + } + +@@ -2579,7 +2579,7 @@ void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, + + /* link the first chunk in */ + pcpu_first_chunk = chunk; +- pcpu_nr_empty_pop_pages = pcpu_first_chunk->nr_empty_pop_pages; ++ pcpu_nr_empty_pop_pages[PCPU_CHUNK_ROOT] = pcpu_first_chunk->nr_empty_pop_pages; + pcpu_chunk_relocate(pcpu_first_chunk, -1); + + /* include all regions of the first chunk */ +diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c +index 98a0aaaf0d502..a510f7f86a7dc 100644 +--- a/net/batman-adv/translation-table.c ++++ b/net/batman-adv/translation-table.c +@@ -891,6 +891,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node, + hlist_for_each_entry(vlan, &orig_node->vlan_list, list) { + tt_vlan->vid = htons(vlan->vid); + tt_vlan->crc = htonl(vlan->tt.crc); ++ tt_vlan->reserved = 0; + + tt_vlan++; + } +@@ -974,6 +975,7 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, + + tt_vlan->vid = htons(vlan->vid); + tt_vlan->crc = htonl(vlan->tt.crc); ++ tt_vlan->reserved = 0; + + tt_vlan++; + } +diff --git a/net/can/bcm.c b/net/can/bcm.c +index 0e5c37be4a2bd..909b9e684e043 100644 +--- a/net/can/bcm.c ++++ b/net/can/bcm.c +@@ -86,6 +86,8 @@ MODULE_LICENSE("Dual BSD/GPL"); + MODULE_AUTHOR("Oliver Hartkopp "); + MODULE_ALIAS("can-proto-2"); + ++#define BCM_MIN_NAMELEN CAN_REQUIRED_SIZE(struct sockaddr_can, can_ifindex) ++ + /* + * easy access to the first 64 bit of can(fd)_frame payload. cp->data is + * 64 bit aligned so the offset has to be multiples of 8 which is ensured +@@ -1292,7 +1294,7 @@ static int bcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) + /* no bound device as default => check msg_name */ + DECLARE_SOCKADDR(struct sockaddr_can *, addr, msg->msg_name); + +- if (msg->msg_namelen < CAN_REQUIRED_SIZE(*addr, can_ifindex)) ++ if (msg->msg_namelen < BCM_MIN_NAMELEN) + return -EINVAL; + + if (addr->can_family != AF_CAN) +@@ -1534,7 +1536,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len, + struct net *net = sock_net(sk); + int ret = 0; + +- if (len < CAN_REQUIRED_SIZE(*addr, can_ifindex)) ++ if (len < BCM_MIN_NAMELEN) + return -EINVAL; + + lock_sock(sk); +@@ -1616,8 +1618,8 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, + sock_recv_ts_and_drops(msg, sk, skb); + + if (msg->msg_name) { +- __sockaddr_check_size(sizeof(struct sockaddr_can)); +- msg->msg_namelen = sizeof(struct sockaddr_can); ++ __sockaddr_check_size(BCM_MIN_NAMELEN); ++ msg->msg_namelen = BCM_MIN_NAMELEN; + memcpy(msg->msg_name, skb->cb, msg->msg_namelen); + } + +diff --git a/net/can/isotp.c b/net/can/isotp.c +index ea1e227b8e544..d5780ab29e098 100644 +--- a/net/can/isotp.c ++++ b/net/can/isotp.c +@@ -77,6 +77,8 @@ MODULE_LICENSE("Dual BSD/GPL"); + MODULE_AUTHOR("Oliver Hartkopp "); + MODULE_ALIAS("can-proto-6"); + ++#define ISOTP_MIN_NAMELEN CAN_REQUIRED_SIZE(struct sockaddr_can, can_addr.tp) ++ + #define SINGLE_MASK(id) (((id) & CAN_EFF_FLAG) ? \ + (CAN_EFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG) : \ + (CAN_SFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG)) +@@ -981,7 +983,8 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, + sock_recv_timestamp(msg, sk, skb); + + if (msg->msg_name) { +- msg->msg_namelen = sizeof(struct sockaddr_can); ++ __sockaddr_check_size(ISOTP_MIN_NAMELEN); ++ msg->msg_namelen = ISOTP_MIN_NAMELEN; + memcpy(msg->msg_name, skb->cb, msg->msg_namelen); + } + +@@ -1050,7 +1053,7 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len) + int err = 0; + int notify_enetdown = 0; + +- if (len < CAN_REQUIRED_SIZE(struct sockaddr_can, can_addr.tp)) ++ if (len < ISOTP_MIN_NAMELEN) + return -EINVAL; + + if (addr->can_addr.tp.rx_id == addr->can_addr.tp.tx_id) +@@ -1136,13 +1139,13 @@ static int isotp_getname(struct socket *sock, struct sockaddr *uaddr, int peer) + if (peer) + return -EOPNOTSUPP; + +- memset(addr, 0, sizeof(*addr)); ++ memset(addr, 0, ISOTP_MIN_NAMELEN); + addr->can_family = AF_CAN; + addr->can_ifindex = so->ifindex; + addr->can_addr.tp.rx_id = so->rxid; + addr->can_addr.tp.tx_id = so->txid; + +- return sizeof(*addr); ++ return ISOTP_MIN_NAMELEN; + } + + static int isotp_setsockopt(struct socket *sock, int level, int optname, +diff --git a/net/can/raw.c b/net/can/raw.c +index 6ec8aa1d0da46..95113b0898b24 100644 +--- a/net/can/raw.c ++++ b/net/can/raw.c +@@ -60,6 +60,8 @@ MODULE_LICENSE("Dual BSD/GPL"); + MODULE_AUTHOR("Urs Thuermann "); + MODULE_ALIAS("can-proto-1"); + ++#define RAW_MIN_NAMELEN CAN_REQUIRED_SIZE(struct sockaddr_can, can_ifindex) ++ + #define MASK_ALL 0 + + /* A raw socket has a list of can_filters attached to it, each receiving +@@ -394,7 +396,7 @@ static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len) + int err = 0; + int notify_enetdown = 0; + +- if (len < CAN_REQUIRED_SIZE(*addr, can_ifindex)) ++ if (len < RAW_MIN_NAMELEN) + return -EINVAL; + if (addr->can_family != AF_CAN) + return -EINVAL; +@@ -475,11 +477,11 @@ static int raw_getname(struct socket *sock, struct sockaddr *uaddr, + if (peer) + return -EOPNOTSUPP; + +- memset(addr, 0, sizeof(*addr)); ++ memset(addr, 0, RAW_MIN_NAMELEN); + addr->can_family = AF_CAN; + addr->can_ifindex = ro->ifindex; + +- return sizeof(*addr); ++ return RAW_MIN_NAMELEN; + } + + static int raw_setsockopt(struct socket *sock, int level, int optname, +@@ -731,7 +733,7 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) + if (msg->msg_name) { + DECLARE_SOCKADDR(struct sockaddr_can *, addr, msg->msg_name); + +- if (msg->msg_namelen < CAN_REQUIRED_SIZE(*addr, can_ifindex)) ++ if (msg->msg_namelen < RAW_MIN_NAMELEN) + return -EINVAL; + + if (addr->can_family != AF_CAN) +@@ -824,8 +826,8 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, + sock_recv_ts_and_drops(msg, sk, skb); + + if (msg->msg_name) { +- __sockaddr_check_size(sizeof(struct sockaddr_can)); +- msg->msg_namelen = sizeof(struct sockaddr_can); ++ __sockaddr_check_size(RAW_MIN_NAMELEN); ++ msg->msg_namelen = RAW_MIN_NAMELEN; + memcpy(msg->msg_name, skb->cb, msg->msg_namelen); + } + +diff --git a/net/core/skmsg.c b/net/core/skmsg.c +index 25cdbb20f3a03..923a1d0f84ca3 100644 +--- a/net/core/skmsg.c ++++ b/net/core/skmsg.c +@@ -488,6 +488,7 @@ static int sk_psock_skb_ingress_self(struct sk_psock *psock, struct sk_buff *skb + if (unlikely(!msg)) + return -EAGAIN; + sk_msg_init(msg); ++ skb_set_owner_r(skb, sk); + return sk_psock_skb_ingress_enqueue(skb, psock, sk, msg); + } + +@@ -791,7 +792,6 @@ static void sk_psock_tls_verdict_apply(struct sk_buff *skb, struct sock *sk, int + { + switch (verdict) { + case __SK_REDIRECT: +- skb_set_owner_r(skb, sk); + sk_psock_skb_redirect(skb); + break; + case __SK_PASS: +@@ -809,10 +809,6 @@ int sk_psock_tls_strp_read(struct sk_psock *psock, struct sk_buff *skb) + rcu_read_lock(); + prog = READ_ONCE(psock->progs.skb_verdict); + if (likely(prog)) { +- /* We skip full set_owner_r here because if we do a SK_PASS +- * or SK_DROP we can skip skb memory accounting and use the +- * TLS context. +- */ + skb->sk = psock->sk; + tcp_skb_bpf_redirect_clear(skb); + ret = sk_psock_bpf_run(psock, prog, skb); +@@ -881,12 +877,13 @@ static void sk_psock_strp_read(struct strparser *strp, struct sk_buff *skb) + kfree_skb(skb); + goto out; + } +- skb_set_owner_r(skb, sk); + prog = READ_ONCE(psock->progs.skb_verdict); + if (likely(prog)) { ++ skb->sk = sk; + tcp_skb_bpf_redirect_clear(skb); + ret = sk_psock_bpf_run(psock, prog, skb); + ret = sk_psock_map_verd(ret, tcp_skb_bpf_redirect_fetch(skb)); ++ skb->sk = NULL; + } + sk_psock_verdict_apply(psock, skb, ret); + out: +@@ -957,12 +954,13 @@ static int sk_psock_verdict_recv(read_descriptor_t *desc, struct sk_buff *skb, + kfree_skb(skb); + goto out; + } +- skb_set_owner_r(skb, sk); + prog = READ_ONCE(psock->progs.skb_verdict); + if (likely(prog)) { ++ skb->sk = sk; + tcp_skb_bpf_redirect_clear(skb); + ret = sk_psock_bpf_run(psock, prog, skb); + ret = sk_psock_map_verd(ret, tcp_skb_bpf_redirect_fetch(skb)); ++ skb->sk = NULL; + } + sk_psock_verdict_apply(psock, skb, ret); + out: +diff --git a/net/core/sock.c b/net/core/sock.c +index 727ea1cc633ca..c75c1e723a840 100644 +--- a/net/core/sock.c ++++ b/net/core/sock.c +@@ -2099,16 +2099,10 @@ void skb_orphan_partial(struct sk_buff *skb) + if (skb_is_tcp_pure_ack(skb)) + return; + +- if (can_skb_orphan_partial(skb)) { +- struct sock *sk = skb->sk; +- +- if (refcount_inc_not_zero(&sk->sk_refcnt)) { +- WARN_ON(refcount_sub_and_test(skb->truesize, &sk->sk_wmem_alloc)); +- skb->destructor = sock_efree; +- } +- } else { ++ if (can_skb_orphan_partial(skb)) ++ skb_set_owner_sk_safe(skb, skb->sk); ++ else + skb_orphan(skb); +- } + } + EXPORT_SYMBOL(skb_orphan_partial); + +diff --git a/net/core/xdp.c b/net/core/xdp.c +index d900cebc0acd7..b8d7fa47d293c 100644 +--- a/net/core/xdp.c ++++ b/net/core/xdp.c +@@ -349,7 +349,8 @@ static void __xdp_return(void *data, struct xdp_mem_info *mem, bool napi_direct, + /* mem->id is valid, checked in xdp_rxq_info_reg_mem_model() */ + xa = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params); + page = virt_to_head_page(data); +- napi_direct &= !xdp_return_frame_no_direct(); ++ if (napi_direct && xdp_return_frame_no_direct()) ++ napi_direct = false; + page_pool_put_full_page(xa->page_pool, page, napi_direct); + rcu_read_unlock(); + break; +diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c +index a04fd637b4cdc..3ada338d7e08b 100644 +--- a/net/dsa/dsa2.c ++++ b/net/dsa/dsa2.c +@@ -533,8 +533,14 @@ static int dsa_tree_setup_switches(struct dsa_switch_tree *dst) + + list_for_each_entry(dp, &dst->ports, list) { + err = dsa_port_setup(dp); +- if (err) ++ if (err) { ++ dsa_port_devlink_teardown(dp); ++ dp->type = DSA_PORT_TYPE_UNUSED; ++ err = dsa_port_devlink_setup(dp); ++ if (err) ++ goto teardown; + continue; ++ } + } + + return 0; +diff --git a/net/ethtool/eee.c b/net/ethtool/eee.c +index 901b7de941abd..e10bfcc078531 100644 +--- a/net/ethtool/eee.c ++++ b/net/ethtool/eee.c +@@ -169,8 +169,8 @@ int ethnl_set_eee(struct sk_buff *skb, struct genl_info *info) + ethnl_update_bool32(&eee.eee_enabled, tb[ETHTOOL_A_EEE_ENABLED], &mod); + ethnl_update_bool32(&eee.tx_lpi_enabled, + tb[ETHTOOL_A_EEE_TX_LPI_ENABLED], &mod); +- ethnl_update_bool32(&eee.tx_lpi_timer, tb[ETHTOOL_A_EEE_TX_LPI_TIMER], +- &mod); ++ ethnl_update_u32(&eee.tx_lpi_timer, tb[ETHTOOL_A_EEE_TX_LPI_TIMER], ++ &mod); + ret = 0; + if (!mod) + goto out_ops; +diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c +index ab953a1a0d6cc..6f4c34b6a5d69 100644 +--- a/net/hsr/hsr_device.c ++++ b/net/hsr/hsr_device.c +@@ -217,6 +217,7 @@ static netdev_tx_t hsr_dev_xmit(struct sk_buff *skb, struct net_device *dev) + master = hsr_port_get_hsr(hsr, HSR_PT_MASTER); + if (master) { + skb->dev = master->dev; ++ skb_reset_mac_header(skb); + hsr_forward_skb(skb, master); + } else { + atomic_long_inc(&dev->tx_dropped); +diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c +index cadfccd7876e4..b4e06ae088348 100644 +--- a/net/hsr/hsr_forward.c ++++ b/net/hsr/hsr_forward.c +@@ -528,12 +528,6 @@ void hsr_forward_skb(struct sk_buff *skb, struct hsr_port *port) + { + struct hsr_frame_info frame; + +- if (skb_mac_header(skb) != skb->data) { +- WARN_ONCE(1, "%s:%d: Malformed frame (port_src %s)\n", +- __FILE__, __LINE__, port->dev->name); +- goto out_drop; +- } +- + if (fill_frame_info(&frame, skb, port) < 0) + goto out_drop; + +diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c +index 6d091e419d3ee..d19c40c684e80 100644 +--- a/net/ieee802154/nl-mac.c ++++ b/net/ieee802154/nl-mac.c +@@ -551,9 +551,7 @@ ieee802154_llsec_parse_key_id(struct genl_info *info, + desc->mode = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE]); + + if (desc->mode == IEEE802154_SCF_KEY_IMPLICIT) { +- if (!info->attrs[IEEE802154_ATTR_PAN_ID] && +- !(info->attrs[IEEE802154_ATTR_SHORT_ADDR] || +- info->attrs[IEEE802154_ATTR_HW_ADDR])) ++ if (!info->attrs[IEEE802154_ATTR_PAN_ID]) + return -EINVAL; + + desc->device_addr.pan_id = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_PAN_ID]); +@@ -562,6 +560,9 @@ ieee802154_llsec_parse_key_id(struct genl_info *info, + desc->device_addr.mode = IEEE802154_ADDR_SHORT; + desc->device_addr.short_addr = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_SHORT_ADDR]); + } else { ++ if (!info->attrs[IEEE802154_ATTR_HW_ADDR]) ++ return -EINVAL; ++ + desc->device_addr.mode = IEEE802154_ADDR_LONG; + desc->device_addr.extended_addr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]); + } +diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c +index 7c5a1aa5adb42..d1b6a9665b170 100644 +--- a/net/ieee802154/nl802154.c ++++ b/net/ieee802154/nl802154.c +@@ -820,8 +820,13 @@ nl802154_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags, + goto nla_put_failure; + + #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) ++ goto out; ++ + if (nl802154_get_llsec_params(msg, rdev, wpan_dev) < 0) + goto nla_put_failure; ++ ++out: + #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */ + + genlmsg_end(msg, hdr); +@@ -1384,6 +1389,9 @@ static int nl802154_set_llsec_params(struct sk_buff *skb, + u32 changed = 0; + int ret; + ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) ++ return -EOPNOTSUPP; ++ + if (info->attrs[NL802154_ATTR_SEC_ENABLED]) { + u8 enabled; + +@@ -1544,7 +1552,8 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info) + struct ieee802154_llsec_key_id id = { }; + u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { }; + +- if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) ++ if (!info->attrs[NL802154_ATTR_SEC_KEY] || ++ nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) + return -EINVAL; + + if (!attrs[NL802154_KEY_ATTR_USAGE_FRAMES] || +@@ -1592,7 +1601,8 @@ static int nl802154_del_llsec_key(struct sk_buff *skb, struct genl_info *info) + struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1]; + struct ieee802154_llsec_key_id id; + +- if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) ++ if (!info->attrs[NL802154_ATTR_SEC_KEY] || ++ nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) + return -EINVAL; + + if (ieee802154_llsec_parse_key_id(attrs[NL802154_KEY_ATTR_ID], &id) < 0) +@@ -1757,7 +1767,8 @@ static int nl802154_del_llsec_dev(struct sk_buff *skb, struct genl_info *info) + struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1]; + __le64 extended_addr; + +- if (nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack)) ++ if (!info->attrs[NL802154_ATTR_SEC_DEVICE] || ++ nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack)) + return -EINVAL; + + if (!attrs[NL802154_DEV_ATTR_EXTENDED_ADDR]) +@@ -1913,7 +1924,8 @@ static int nl802154_del_llsec_devkey(struct sk_buff *skb, struct genl_info *info + struct ieee802154_llsec_device_key key; + __le64 extended_addr; + +- if (nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack)) ++ if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] || ++ nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack)) + return -EINVAL; + + if (!attrs[NL802154_DEVKEY_ATTR_EXTENDED_ADDR]) +@@ -2085,6 +2097,9 @@ static int nl802154_del_llsec_seclevel(struct sk_buff *skb, + struct wpan_dev *wpan_dev = dev->ieee802154_ptr; + struct ieee802154_llsec_seclevel sl; + ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) ++ return -EOPNOTSUPP; ++ + if (!info->attrs[NL802154_ATTR_SEC_LEVEL] || + llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL], + &sl) < 0) +diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c +index d99e1be94019d..36ed85bf2ad51 100644 +--- a/net/ipv4/ah4.c ++++ b/net/ipv4/ah4.c +@@ -141,7 +141,7 @@ static void ah_output_done(struct crypto_async_request *base, int err) + } + + kfree(AH_SKB_CB(skb)->tmp); +- xfrm_output_resume(skb, err); ++ xfrm_output_resume(skb->sk, skb, err); + } + + static int ah_output(struct xfrm_state *x, struct sk_buff *skb) +diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c +index a3271ec3e1627..4b834bbf95e07 100644 +--- a/net/ipv4/esp4.c ++++ b/net/ipv4/esp4.c +@@ -279,7 +279,7 @@ static void esp_output_done(struct crypto_async_request *base, int err) + x->encap && x->encap->encap_type == TCP_ENCAP_ESPINTCP) + esp_output_tail_tcp(x, skb); + else +- xfrm_output_resume(skb, err); ++ xfrm_output_resume(skb->sk, skb, err); + } + } + +diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c +index 5bda5aeda5791..5aa7344dbec7f 100644 +--- a/net/ipv4/esp4_offload.c ++++ b/net/ipv4/esp4_offload.c +@@ -217,10 +217,12 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb, + + if ((!(skb->dev->gso_partial_features & NETIF_F_HW_ESP) && + !(features & NETIF_F_HW_ESP)) || x->xso.dev != skb->dev) +- esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK); ++ esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK | ++ NETIF_F_SCTP_CRC); + else if (!(features & NETIF_F_HW_ESP_TX_CSUM) && + !(skb->dev->gso_partial_features & NETIF_F_HW_ESP_TX_CSUM)) +- esp_features = features & ~NETIF_F_CSUM_MASK; ++ esp_features = features & ~(NETIF_F_CSUM_MASK | ++ NETIF_F_SCTP_CRC); + + xo->flags |= XFRM_GSO_SEGMENT; + +@@ -312,8 +314,17 @@ static int esp_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features_ + ip_hdr(skb)->tot_len = htons(skb->len); + ip_send_check(ip_hdr(skb)); + +- if (hw_offload) ++ if (hw_offload) { ++ if (!skb_ext_add(skb, SKB_EXT_SEC_PATH)) ++ return -ENOMEM; ++ ++ xo = xfrm_offload(skb); ++ if (!xo) ++ return -EINVAL; ++ ++ xo->flags |= XFRM_XMIT; + return 0; ++ } + + err = esp_output_tail(x, skb, &esp); + if (err) +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c +index e37a2fa65c294..4a2fd286787c0 100644 +--- a/net/ipv4/udp.c ++++ b/net/ipv4/udp.c +@@ -2747,6 +2747,10 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, + val = up->gso_size; + break; + ++ case UDP_GRO: ++ val = up->gro_enabled; ++ break; ++ + /* The following two cannot be changed on UDP sockets, the return is + * always 0 (which corresponds to the full checksum coverage of UDP). */ + case UDPLITE_SEND_CSCOV: +diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c +index 440080da805b5..080ee7f44c649 100644 +--- a/net/ipv6/ah6.c ++++ b/net/ipv6/ah6.c +@@ -316,7 +316,7 @@ static void ah6_output_done(struct crypto_async_request *base, int err) + } + + kfree(AH_SKB_CB(skb)->tmp); +- xfrm_output_resume(skb, err); ++ xfrm_output_resume(skb->sk, skb, err); + } + + static int ah6_output(struct xfrm_state *x, struct sk_buff *skb) +diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c +index 2b804fcebcc65..4071cb7c7a154 100644 +--- a/net/ipv6/esp6.c ++++ b/net/ipv6/esp6.c +@@ -314,7 +314,7 @@ static void esp_output_done(struct crypto_async_request *base, int err) + x->encap && x->encap->encap_type == TCP_ENCAP_ESPINTCP) + esp_output_tail_tcp(x, skb); + else +- xfrm_output_resume(skb, err); ++ xfrm_output_resume(skb->sk, skb, err); + } + } + +diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c +index 1ca516fb30e1c..4af56affaafd4 100644 +--- a/net/ipv6/esp6_offload.c ++++ b/net/ipv6/esp6_offload.c +@@ -254,9 +254,11 @@ static struct sk_buff *esp6_gso_segment(struct sk_buff *skb, + skb->encap_hdr_csum = 1; + + if (!(features & NETIF_F_HW_ESP) || x->xso.dev != skb->dev) +- esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK); ++ esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK | ++ NETIF_F_SCTP_CRC); + else if (!(features & NETIF_F_HW_ESP_TX_CSUM)) +- esp_features = features & ~NETIF_F_CSUM_MASK; ++ esp_features = features & ~(NETIF_F_CSUM_MASK | ++ NETIF_F_SCTP_CRC); + + xo->flags |= XFRM_GSO_SEGMENT; + +@@ -346,8 +348,17 @@ static int esp6_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features + + ipv6_hdr(skb)->payload_len = htons(len); + +- if (hw_offload) ++ if (hw_offload) { ++ if (!skb_ext_add(skb, SKB_EXT_SEC_PATH)) ++ return -ENOMEM; ++ ++ xo = xfrm_offload(skb); ++ if (!xo) ++ return -EINVAL; ++ ++ xo->flags |= XFRM_XMIT; + return 0; ++ } + + err = esp6_output_tail(x, skb, &esp); + if (err) +diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c +index 6e4ab80a3b944..00f133a55ef7c 100644 +--- a/net/ipv6/raw.c ++++ b/net/ipv6/raw.c +@@ -298,7 +298,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) + */ + v4addr = LOOPBACK4_IPV6; + if (!(addr_type & IPV6_ADDR_MULTICAST) && +- !sock_net(sk)->ipv6.sysctl.ip_nonlocal_bind) { ++ !ipv6_can_nonlocal_bind(sock_net(sk), inet)) { + err = -EADDRNOTAVAIL; + if (!ipv6_chk_addr(sock_net(sk), &addr->sin6_addr, + dev, 0)) { +diff --git a/net/ipv6/route.c b/net/ipv6/route.c +index fa276448d5a2a..71e578ed8699f 100644 +--- a/net/ipv6/route.c ++++ b/net/ipv6/route.c +@@ -5203,9 +5203,11 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, + * nexthops have been replaced by first new, the rest should + * be added to it. + */ +- cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | +- NLM_F_REPLACE); +- cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE; ++ if (cfg->fc_nlinfo.nlh) { ++ cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | ++ NLM_F_REPLACE); ++ cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE; ++ } + nhn++; + } + +diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c +index 3f483e84d5df3..ef19c3399b893 100644 +--- a/net/mac80211/mlme.c ++++ b/net/mac80211/mlme.c +@@ -4660,7 +4660,10 @@ static void ieee80211_sta_conn_mon_timer(struct timer_list *t) + timeout = sta->rx_stats.last_rx; + timeout += IEEE80211_CONNECTION_IDLE_TIME; + +- if (time_is_before_jiffies(timeout)) { ++ /* If timeout is after now, then update timer to fire at ++ * the later date, but do not actually probe at this time. ++ */ ++ if (time_is_after_jiffies(timeout)) { + mod_timer(&ifmgd->conn_mon_timer, round_jiffies_up(timeout)); + return; + } +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index 88868bf300513..1d8526d89505f 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3605,7 +3605,7 @@ begin: + test_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags)) + goto out; + +- if (vif->txqs_stopped[ieee80211_ac_from_tid(txq->tid)]) { ++ if (vif->txqs_stopped[txq->ac]) { + set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags); + goto out; + } +diff --git a/net/mac802154/llsec.c b/net/mac802154/llsec.c +index 585d33144c33f..55550ead2ced8 100644 +--- a/net/mac802154/llsec.c ++++ b/net/mac802154/llsec.c +@@ -152,7 +152,7 @@ err_tfm0: + crypto_free_sync_skcipher(key->tfm0); + err_tfm: + for (i = 0; i < ARRAY_SIZE(key->tfm); i++) +- if (key->tfm[i]) ++ if (!IS_ERR_OR_NULL(key->tfm[i])) + crypto_free_aead(key->tfm[i]); + + kfree_sensitive(key); +diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c +index f56b2e331bb6b..27f6672589ce2 100644 +--- a/net/mptcp/protocol.c ++++ b/net/mptcp/protocol.c +@@ -2245,6 +2245,48 @@ static int mptcp_setsockopt_v6(struct mptcp_sock *msk, int optname, + return ret; + } + ++static bool mptcp_unsupported(int level, int optname) ++{ ++ if (level == SOL_IP) { ++ switch (optname) { ++ case IP_ADD_MEMBERSHIP: ++ case IP_ADD_SOURCE_MEMBERSHIP: ++ case IP_DROP_MEMBERSHIP: ++ case IP_DROP_SOURCE_MEMBERSHIP: ++ case IP_BLOCK_SOURCE: ++ case IP_UNBLOCK_SOURCE: ++ case MCAST_JOIN_GROUP: ++ case MCAST_LEAVE_GROUP: ++ case MCAST_JOIN_SOURCE_GROUP: ++ case MCAST_LEAVE_SOURCE_GROUP: ++ case MCAST_BLOCK_SOURCE: ++ case MCAST_UNBLOCK_SOURCE: ++ case MCAST_MSFILTER: ++ return true; ++ } ++ return false; ++ } ++ if (level == SOL_IPV6) { ++ switch (optname) { ++ case IPV6_ADDRFORM: ++ case IPV6_ADD_MEMBERSHIP: ++ case IPV6_DROP_MEMBERSHIP: ++ case IPV6_JOIN_ANYCAST: ++ case IPV6_LEAVE_ANYCAST: ++ case MCAST_JOIN_GROUP: ++ case MCAST_LEAVE_GROUP: ++ case MCAST_JOIN_SOURCE_GROUP: ++ case MCAST_LEAVE_SOURCE_GROUP: ++ case MCAST_BLOCK_SOURCE: ++ case MCAST_UNBLOCK_SOURCE: ++ case MCAST_MSFILTER: ++ return true; ++ } ++ return false; ++ } ++ return false; ++} ++ + static int mptcp_setsockopt(struct sock *sk, int level, int optname, + sockptr_t optval, unsigned int optlen) + { +@@ -2253,6 +2295,9 @@ static int mptcp_setsockopt(struct sock *sk, int level, int optname, + + pr_debug("msk=%p", msk); + ++ if (mptcp_unsupported(level, optname)) ++ return -ENOPROTOOPT; ++ + if (level == SOL_SOCKET) + return mptcp_setsockopt_sol_socket(msk, optname, optval, optlen); + +diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c +index a9cb355324d1a..ffff8da707b8c 100644 +--- a/net/ncsi/ncsi-manage.c ++++ b/net/ncsi/ncsi-manage.c +@@ -105,13 +105,20 @@ static void ncsi_channel_monitor(struct timer_list *t) + monitor_state = nc->monitor.state; + spin_unlock_irqrestore(&nc->lock, flags); + +- if (!enabled || chained) { +- ncsi_stop_channel_monitor(nc); +- return; +- } ++ if (!enabled) ++ return; /* expected race disabling timer */ ++ if (WARN_ON_ONCE(chained)) ++ goto bad_state; ++ + if (state != NCSI_CHANNEL_INACTIVE && + state != NCSI_CHANNEL_ACTIVE) { +- ncsi_stop_channel_monitor(nc); ++bad_state: ++ netdev_warn(ndp->ndev.dev, ++ "Bad NCSI monitor state channel %d 0x%x %s queue\n", ++ nc->id, state, chained ? "on" : "off"); ++ spin_lock_irqsave(&nc->lock, flags); ++ nc->monitor.enabled = false; ++ spin_unlock_irqrestore(&nc->lock, flags); + return; + } + +@@ -136,10 +143,9 @@ static void ncsi_channel_monitor(struct timer_list *t) + ncsi_report_link(ndp, true); + ndp->flags |= NCSI_DEV_RESHUFFLE; + +- ncsi_stop_channel_monitor(nc); +- + ncm = &nc->modes[NCSI_MODE_LINK]; + spin_lock_irqsave(&nc->lock, flags); ++ nc->monitor.enabled = false; + nc->state = NCSI_CHANNEL_INVISIBLE; + ncm->data[2] &= ~0x1; + spin_unlock_irqrestore(&nc->lock, flags); +diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c +index d257ed3b732ae..a3b46f8888033 100644 +--- a/net/nfc/llcp_sock.c ++++ b/net/nfc/llcp_sock.c +@@ -108,11 +108,13 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) + llcp_sock->service_name_len, + GFP_KERNEL); + if (!llcp_sock->service_name) { ++ nfc_llcp_local_put(llcp_sock->local); + ret = -ENOMEM; + goto put_dev; + } + llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock); + if (llcp_sock->ssap == LLCP_SAP_MAX) { ++ nfc_llcp_local_put(llcp_sock->local); + kfree(llcp_sock->service_name); + llcp_sock->service_name = NULL; + ret = -EADDRINUSE; +@@ -671,6 +673,10 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, + ret = -EISCONN; + goto error; + } ++ if (sk->sk_state == LLCP_CONNECTING) { ++ ret = -EINPROGRESS; ++ goto error; ++ } + + dev = nfc_get_device(addr->dev_idx); + if (dev == NULL) { +@@ -702,6 +708,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, + llcp_sock->local = nfc_llcp_local_get(local); + llcp_sock->ssap = nfc_llcp_get_local_ssap(local); + if (llcp_sock->ssap == LLCP_SAP_MAX) { ++ nfc_llcp_local_put(llcp_sock->local); + ret = -ENOMEM; + goto put_dev; + } +@@ -743,9 +750,12 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, + + sock_unlink: + nfc_llcp_sock_unlink(&local->connecting_sockets, sk); ++ kfree(llcp_sock->service_name); ++ llcp_sock->service_name = NULL; + + sock_llcp_release: + nfc_llcp_put_ssap(local, llcp_sock->ssap); ++ nfc_llcp_local_put(llcp_sock->local); + + put_dev: + nfc_put_device(dev); +diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c +index 4beb96139d776..a11b558813c10 100644 +--- a/net/openvswitch/conntrack.c ++++ b/net/openvswitch/conntrack.c +@@ -2024,16 +2024,12 @@ static int ovs_ct_limit_del_zone_limit(struct nlattr *nla_zone_limit, + static int ovs_ct_limit_get_default_limit(struct ovs_ct_limit_info *info, + struct sk_buff *reply) + { +- struct ovs_zone_limit zone_limit; +- int err; ++ struct ovs_zone_limit zone_limit = { ++ .zone_id = OVS_ZONE_LIMIT_DEFAULT_ZONE, ++ .limit = info->default_limit, ++ }; + +- zone_limit.zone_id = OVS_ZONE_LIMIT_DEFAULT_ZONE; +- zone_limit.limit = info->default_limit; +- err = nla_put_nohdr(reply, sizeof(zone_limit), &zone_limit); +- if (err) +- return err; +- +- return 0; ++ return nla_put_nohdr(reply, sizeof(zone_limit), &zone_limit); + } + + static int __ovs_ct_limit_get_zone_limit(struct net *net, +diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c +index 45fbf5f4dcd25..93a7edcff11e7 100644 +--- a/net/qrtr/qrtr.c ++++ b/net/qrtr/qrtr.c +@@ -266,7 +266,10 @@ static int qrtr_tx_wait(struct qrtr_node *node, int dest_node, int dest_port, + flow = kzalloc(sizeof(*flow), GFP_KERNEL); + if (flow) { + init_waitqueue_head(&flow->resume_tx); +- radix_tree_insert(&node->qrtr_tx_flow, key, flow); ++ if (radix_tree_insert(&node->qrtr_tx_flow, key, flow)) { ++ kfree(flow); ++ flow = NULL; ++ } + } + } + mutex_unlock(&node->qrtr_tx_lock); +diff --git a/net/rds/message.c b/net/rds/message.c +index 071a261fdaabb..799034e0f513d 100644 +--- a/net/rds/message.c ++++ b/net/rds/message.c +@@ -347,8 +347,9 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in + rm->data.op_nents = DIV_ROUND_UP(total_len, PAGE_SIZE); + rm->data.op_sg = rds_message_alloc_sgs(rm, num_sgs); + if (IS_ERR(rm->data.op_sg)) { ++ void *err = ERR_CAST(rm->data.op_sg); + rds_message_put(rm); +- return ERR_CAST(rm->data.op_sg); ++ return err; + } + + for (i = 0; i < rm->data.op_nents; ++i) { +diff --git a/net/sched/act_api.c b/net/sched/act_api.c +index 181c4b501225f..88e14cfeb5d52 100644 +--- a/net/sched/act_api.c ++++ b/net/sched/act_api.c +@@ -142,7 +142,7 @@ static int __tcf_action_put(struct tc_action *p, bool bind) + return 0; + } + +-int __tcf_idr_release(struct tc_action *p, bool bind, bool strict) ++static int __tcf_idr_release(struct tc_action *p, bool bind, bool strict) + { + int ret = 0; + +@@ -168,7 +168,18 @@ int __tcf_idr_release(struct tc_action *p, bool bind, bool strict) + + return ret; + } +-EXPORT_SYMBOL(__tcf_idr_release); ++ ++int tcf_idr_release(struct tc_action *a, bool bind) ++{ ++ const struct tc_action_ops *ops = a->ops; ++ int ret; ++ ++ ret = __tcf_idr_release(a, bind, false); ++ if (ret == ACT_P_DELETED) ++ module_put(ops->owner); ++ return ret; ++} ++EXPORT_SYMBOL(tcf_idr_release); + + static size_t tcf_action_shared_attrs_size(const struct tc_action *act) + { +@@ -445,6 +456,7 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est, + } + + p->idrinfo = idrinfo; ++ __module_get(ops->owner); + p->ops = ops; + *a = p; + return 0; +@@ -972,7 +984,8 @@ struct tc_action_ops *tc_action_load_ops(char *name, struct nlattr *nla, + struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, + struct nlattr *nla, struct nlattr *est, + char *name, int ovr, int bind, +- struct tc_action_ops *a_o, bool rtnl_held, ++ struct tc_action_ops *a_o, int *init_res, ++ bool rtnl_held, + struct netlink_ext_ack *extack) + { + struct nla_bitfield32 flags = { 0, 0 }; +@@ -1008,6 +1021,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, + } + if (err < 0) + goto err_out; ++ *init_res = err; + + if (!name && tb[TCA_ACT_COOKIE]) + tcf_set_action_cookie(&a->act_cookie, cookie); +@@ -1015,13 +1029,6 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, + if (!name) + a->hw_stats = hw_stats; + +- /* module count goes up only when brand new policy is created +- * if it exists and is only bound to in a_o->init() then +- * ACT_P_CREATED is not returned (a zero is). +- */ +- if (err != ACT_P_CREATED) +- module_put(a_o->owner); +- + return a; + + err_out: +@@ -1036,7 +1043,7 @@ err_out: + + int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, + struct nlattr *est, char *name, int ovr, int bind, +- struct tc_action *actions[], size_t *attr_size, ++ struct tc_action *actions[], int init_res[], size_t *attr_size, + bool rtnl_held, struct netlink_ext_ack *extack) + { + struct tc_action_ops *ops[TCA_ACT_MAX_PRIO] = {}; +@@ -1064,7 +1071,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, + + for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) { + act = tcf_action_init_1(net, tp, tb[i], est, name, ovr, bind, +- ops[i - 1], rtnl_held, extack); ++ ops[i - 1], &init_res[i - 1], rtnl_held, ++ extack); + if (IS_ERR(act)) { + err = PTR_ERR(act); + goto err; +@@ -1080,7 +1088,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, + tcf_idr_insert_many(actions); + + *attr_size = tcf_action_full_attrs_size(sz); +- return i - 1; ++ err = i - 1; ++ goto err_mod; + + err: + tcf_action_destroy(actions, bind); +@@ -1477,12 +1486,13 @@ static int tcf_action_add(struct net *net, struct nlattr *nla, + struct netlink_ext_ack *extack) + { + size_t attr_size = 0; +- int loop, ret; ++ int loop, ret, i; + struct tc_action *actions[TCA_ACT_MAX_PRIO] = {}; ++ int init_res[TCA_ACT_MAX_PRIO] = {}; + + for (loop = 0; loop < 10; loop++) { + ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, +- actions, &attr_size, true, extack); ++ actions, init_res, &attr_size, true, extack); + if (ret != -EAGAIN) + break; + } +@@ -1490,8 +1500,12 @@ static int tcf_action_add(struct net *net, struct nlattr *nla, + if (ret < 0) + return ret; + ret = tcf_add_notify(net, n, actions, portid, attr_size, extack); +- if (ovr) +- tcf_action_put_many(actions); ++ ++ /* only put existing actions */ ++ for (i = 0; i < TCA_ACT_MAX_PRIO; i++) ++ if (init_res[i] == ACT_P_CREATED) ++ actions[i] = NULL; ++ tcf_action_put_many(actions); + + return ret; + } +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c +index b2b7834c6cf8a..9383dc29ead5d 100644 +--- a/net/sched/cls_api.c ++++ b/net/sched/cls_api.c +@@ -646,7 +646,7 @@ static void tc_block_indr_cleanup(struct flow_block_cb *block_cb) + struct net_device *dev = block_cb->indr.dev; + struct Qdisc *sch = block_cb->indr.sch; + struct netlink_ext_ack extack = {}; +- struct flow_block_offload bo; ++ struct flow_block_offload bo = {}; + + tcf_block_offload_init(&bo, dev, sch, FLOW_BLOCK_UNBIND, + block_cb->indr.binder_type, +@@ -3051,6 +3051,7 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, + { + #ifdef CONFIG_NET_CLS_ACT + { ++ int init_res[TCA_ACT_MAX_PRIO] = {}; + struct tc_action *act; + size_t attr_size = 0; + +@@ -3062,12 +3063,11 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, + return PTR_ERR(a_o); + act = tcf_action_init_1(net, tp, tb[exts->police], + rate_tlv, "police", ovr, +- TCA_ACT_BIND, a_o, rtnl_held, +- extack); +- if (IS_ERR(act)) { +- module_put(a_o->owner); ++ TCA_ACT_BIND, a_o, init_res, ++ rtnl_held, extack); ++ module_put(a_o->owner); ++ if (IS_ERR(act)) + return PTR_ERR(act); +- } + + act->type = exts->type = TCA_OLD_COMPAT; + exts->actions[0] = act; +@@ -3078,8 +3078,8 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, + + err = tcf_action_init(net, tp, tb[exts->action], + rate_tlv, NULL, ovr, TCA_ACT_BIND, +- exts->actions, &attr_size, +- rtnl_held, extack); ++ exts->actions, init_res, ++ &attr_size, rtnl_held, extack); + if (err < 0) + return err; + exts->nr_actions = err; +diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c +index 2f1f0a3784083..6af6b95bdb672 100644 +--- a/net/sched/sch_teql.c ++++ b/net/sched/sch_teql.c +@@ -134,6 +134,9 @@ teql_destroy(struct Qdisc *sch) + struct teql_sched_data *dat = qdisc_priv(sch); + struct teql_master *master = dat->m; + ++ if (!master) ++ return; ++ + prev = master->slaves; + if (prev) { + do { +diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c +index 8a58f42d6d195..c8074f435d3ef 100644 +--- a/net/sctp/ipv6.c ++++ b/net/sctp/ipv6.c +@@ -643,8 +643,8 @@ static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp) + if (!(type & IPV6_ADDR_UNICAST)) + return 0; + +- return sp->inet.freebind || net->ipv6.sysctl.ip_nonlocal_bind || +- ipv6_chk_addr(net, in6, NULL, 0); ++ return ipv6_can_nonlocal_bind(net, &sp->inet) || ++ ipv6_chk_addr(net, in6, NULL, 0); + } + + /* This function checks if the address is a valid address to be used for +@@ -933,8 +933,7 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr) + net = sock_net(&opt->inet.sk); + rcu_read_lock(); + dev = dev_get_by_index_rcu(net, addr->v6.sin6_scope_id); +- if (!dev || !(opt->inet.freebind || +- net->ipv6.sysctl.ip_nonlocal_bind || ++ if (!dev || !(ipv6_can_nonlocal_bind(net, &opt->inet) || + ipv6_chk_addr(net, &addr->v6.sin6_addr, + dev, 0))) { + rcu_read_unlock(); +diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c +index 740ab9ae41a66..86eb6d679225c 100644 +--- a/net/tipc/crypto.c ++++ b/net/tipc/crypto.c +@@ -1934,12 +1934,13 @@ static void tipc_crypto_rcv_complete(struct net *net, struct tipc_aead *aead, + goto rcv; + if (tipc_aead_clone(&tmp, aead) < 0) + goto rcv; ++ WARN_ON(!refcount_inc_not_zero(&tmp->refcnt)); + if (tipc_crypto_key_attach(rx, tmp, ehdr->tx_key, false) < 0) { + tipc_aead_free(&tmp->rcu); + goto rcv; + } + tipc_aead_put(aead); +- aead = tipc_aead_get(tmp); ++ aead = tmp; + } + + if (unlikely(err)) { +diff --git a/net/tipc/socket.c b/net/tipc/socket.c +index e795a8a2955b5..5b18c6a46cfb8 100644 +--- a/net/tipc/socket.c ++++ b/net/tipc/socket.c +@@ -1244,7 +1244,7 @@ void tipc_sk_mcast_rcv(struct net *net, struct sk_buff_head *arrvq, + spin_lock_bh(&inputq->lock); + if (skb_peek(arrvq) == skb) { + skb_queue_splice_tail_init(&tmpq, inputq); +- kfree_skb(__skb_dequeue(arrvq)); ++ __skb_dequeue(arrvq); + } + spin_unlock_bh(&inputq->lock); + __skb_queue_purge(&tmpq); +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c +index 535e34a84d651..daf3f29c7f0cc 100644 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -5,7 +5,7 @@ + * Copyright 2006-2010 Johannes Berg + * Copyright 2013-2014 Intel Mobile Communications GmbH + * Copyright 2015-2017 Intel Deutschland GmbH +- * Copyright (C) 2018-2020 Intel Corporation ++ * Copyright (C) 2018-2021 Intel Corporation + */ + + #include +@@ -209,9 +209,13 @@ static int validate_beacon_head(const struct nlattr *attr, + unsigned int len = nla_len(attr); + const struct element *elem; + const struct ieee80211_mgmt *mgmt = (void *)data; +- bool s1g_bcn = ieee80211_is_s1g_beacon(mgmt->frame_control); + unsigned int fixedlen, hdrlen; ++ bool s1g_bcn; + ++ if (len < offsetofend(typeof(*mgmt), frame_control)) ++ goto err; ++ ++ s1g_bcn = ieee80211_is_s1g_beacon(mgmt->frame_control); + if (s1g_bcn) { + fixedlen = offsetof(struct ieee80211_ext, + u.s1g_beacon.variable); +@@ -5320,7 +5324,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) + rdev, info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP], + ¶ms); + if (err) +- return err; ++ goto out; + } + + nl80211_calculate_ap_params(¶ms); +diff --git a/net/wireless/scan.c b/net/wireless/scan.c +index 3409f37d838b3..345ef1c967685 100644 +--- a/net/wireless/scan.c ++++ b/net/wireless/scan.c +@@ -2351,14 +2351,16 @@ cfg80211_inform_single_bss_frame_data(struct wiphy *wiphy, + return NULL; + + if (ext) { +- struct ieee80211_s1g_bcn_compat_ie *compat; +- u8 *ie; ++ const struct ieee80211_s1g_bcn_compat_ie *compat; ++ const struct element *elem; + +- ie = (void *)cfg80211_find_ie(WLAN_EID_S1G_BCN_COMPAT, +- variable, ielen); +- if (!ie) ++ elem = cfg80211_find_elem(WLAN_EID_S1G_BCN_COMPAT, ++ variable, ielen); ++ if (!elem) ++ return NULL; ++ if (elem->datalen < sizeof(*compat)) + return NULL; +- compat = (void *)(ie + 2); ++ compat = (void *)elem->data; + bssid = ext->u.s1g_beacon.sa; + capability = le16_to_cpu(compat->compat_info); + beacon_int = le16_to_cpu(compat->beacon_int); +diff --git a/net/wireless/sme.c b/net/wireless/sme.c +index 38df713f2e2ed..060e365c8259b 100644 +--- a/net/wireless/sme.c ++++ b/net/wireless/sme.c +@@ -530,7 +530,7 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev, + cfg80211_sme_free(wdev); + } + +- if (WARN_ON(wdev->conn)) ++ if (wdev->conn) + return -EINPROGRESS; + + wdev->conn = kzalloc(sizeof(*wdev->conn), GFP_KERNEL); +diff --git a/net/xfrm/xfrm_compat.c b/net/xfrm/xfrm_compat.c +index d8e8a11ca845e..a20aec9d73933 100644 +--- a/net/xfrm/xfrm_compat.c ++++ b/net/xfrm/xfrm_compat.c +@@ -216,7 +216,7 @@ static struct nlmsghdr *xfrm_nlmsg_put_compat(struct sk_buff *skb, + case XFRM_MSG_GETSADINFO: + case XFRM_MSG_GETSPDINFO: + default: +- WARN_ONCE(1, "unsupported nlmsg_type %d", nlh_src->nlmsg_type); ++ pr_warn_once("unsupported nlmsg_type %d\n", nlh_src->nlmsg_type); + return ERR_PTR(-EOPNOTSUPP); + } + +@@ -277,7 +277,7 @@ static int xfrm_xlate64_attr(struct sk_buff *dst, const struct nlattr *src) + return xfrm_nla_cpy(dst, src, nla_len(src)); + default: + BUILD_BUG_ON(XFRMA_MAX != XFRMA_IF_ID); +- WARN_ONCE(1, "unsupported nla_type %d", src->nla_type); ++ pr_warn_once("unsupported nla_type %d\n", src->nla_type); + return -EOPNOTSUPP; + } + } +@@ -315,8 +315,10 @@ static int xfrm_alloc_compat(struct sk_buff *skb, const struct nlmsghdr *nlh_src + struct sk_buff *new = NULL; + int err; + +- if (WARN_ON_ONCE(type >= ARRAY_SIZE(xfrm_msg_min))) ++ if (type >= ARRAY_SIZE(xfrm_msg_min)) { ++ pr_warn_once("unsupported nlmsg_type %d\n", nlh_src->nlmsg_type); + return -EOPNOTSUPP; ++ } + + if (skb_shinfo(skb)->frag_list == NULL) { + new = alloc_skb(skb->len + skb_tailroom(skb), GFP_ATOMIC); +@@ -378,6 +380,10 @@ static int xfrm_attr_cpy32(void *dst, size_t *pos, const struct nlattr *src, + struct nlmsghdr *nlmsg = dst; + struct nlattr *nla; + ++ /* xfrm_user_rcv_msg_compat() relies on fact that 32-bit messages ++ * have the same len or shorted than 64-bit ones. ++ * 32-bit translation that is bigger than 64-bit original is unexpected. ++ */ + if (WARN_ON_ONCE(copy_len > payload)) + copy_len = payload; + +diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c +index edf11893dbe81..6d6917b68856f 100644 +--- a/net/xfrm/xfrm_device.c ++++ b/net/xfrm/xfrm_device.c +@@ -134,8 +134,6 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur + return skb; + } + +- xo->flags |= XFRM_XMIT; +- + if (skb_is_gso(skb) && unlikely(x->xso.dev != dev)) { + struct sk_buff *segs; + +diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c +index 9b8e292a7c6a7..e9ce23343f5ca 100644 +--- a/net/xfrm/xfrm_interface.c ++++ b/net/xfrm/xfrm_interface.c +@@ -305,6 +305,8 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) + + icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); + } else { ++ if (!(ip_hdr(skb)->frag_off & htons(IP_DF))) ++ goto xmit; + icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, + htonl(mtu)); + } +@@ -313,6 +315,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) + return -EMSGSIZE; + } + ++xmit: + xfrmi_scrub_packet(skb, !net_eq(xi->net, dev_net(dev))); + skb_dst_set(skb, dst); + skb->dev = tdev; +diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c +index a7ab19353313c..b81ca117dac7a 100644 +--- a/net/xfrm/xfrm_output.c ++++ b/net/xfrm/xfrm_output.c +@@ -503,22 +503,22 @@ out: + return err; + } + +-int xfrm_output_resume(struct sk_buff *skb, int err) ++int xfrm_output_resume(struct sock *sk, struct sk_buff *skb, int err) + { + struct net *net = xs_net(skb_dst(skb)->xfrm); + + while (likely((err = xfrm_output_one(skb, err)) == 0)) { + nf_reset_ct(skb); + +- err = skb_dst(skb)->ops->local_out(net, skb->sk, skb); ++ err = skb_dst(skb)->ops->local_out(net, sk, skb); + if (unlikely(err != 1)) + goto out; + + if (!skb_dst(skb)->xfrm) +- return dst_output(net, skb->sk, skb); ++ return dst_output(net, sk, skb); + + err = nf_hook(skb_dst(skb)->ops->family, +- NF_INET_POST_ROUTING, net, skb->sk, skb, ++ NF_INET_POST_ROUTING, net, sk, skb, + NULL, skb_dst(skb)->dev, xfrm_output2); + if (unlikely(err != 1)) + goto out; +@@ -534,7 +534,7 @@ EXPORT_SYMBOL_GPL(xfrm_output_resume); + + static int xfrm_output2(struct net *net, struct sock *sk, struct sk_buff *skb) + { +- return xfrm_output_resume(skb, 1); ++ return xfrm_output_resume(sk, skb, 1); + } + + static int xfrm_output_gso(struct net *net, struct sock *sk, struct sk_buff *skb) +diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c +index 2f1517827995c..77499abd9f992 100644 +--- a/net/xfrm/xfrm_state.c ++++ b/net/xfrm/xfrm_state.c +@@ -44,7 +44,6 @@ static void xfrm_state_gc_task(struct work_struct *work); + */ + + static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024; +-static __read_mostly seqcount_t xfrm_state_hash_generation = SEQCNT_ZERO(xfrm_state_hash_generation); + static struct kmem_cache *xfrm_state_cache __ro_after_init; + + static DECLARE_WORK(xfrm_state_gc_work, xfrm_state_gc_task); +@@ -140,7 +139,7 @@ static void xfrm_hash_resize(struct work_struct *work) + } + + spin_lock_bh(&net->xfrm.xfrm_state_lock); +- write_seqcount_begin(&xfrm_state_hash_generation); ++ write_seqcount_begin(&net->xfrm.xfrm_state_hash_generation); + + nhashmask = (nsize / sizeof(struct hlist_head)) - 1U; + odst = xfrm_state_deref_prot(net->xfrm.state_bydst, net); +@@ -156,7 +155,7 @@ static void xfrm_hash_resize(struct work_struct *work) + rcu_assign_pointer(net->xfrm.state_byspi, nspi); + net->xfrm.state_hmask = nhashmask; + +- write_seqcount_end(&xfrm_state_hash_generation); ++ write_seqcount_end(&net->xfrm.xfrm_state_hash_generation); + spin_unlock_bh(&net->xfrm.xfrm_state_lock); + + osize = (ohashmask + 1) * sizeof(struct hlist_head); +@@ -1061,7 +1060,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr, + + to_put = NULL; + +- sequence = read_seqcount_begin(&xfrm_state_hash_generation); ++ sequence = read_seqcount_begin(&net->xfrm.xfrm_state_hash_generation); + + rcu_read_lock(); + h = xfrm_dst_hash(net, daddr, saddr, tmpl->reqid, encap_family); +@@ -1174,7 +1173,7 @@ out: + if (to_put) + xfrm_state_put(to_put); + +- if (read_seqcount_retry(&xfrm_state_hash_generation, sequence)) { ++ if (read_seqcount_retry(&net->xfrm.xfrm_state_hash_generation, sequence)) { + *err = -EAGAIN; + if (x) { + xfrm_state_put(x); +@@ -2664,6 +2663,7 @@ int __net_init xfrm_state_init(struct net *net) + net->xfrm.state_num = 0; + INIT_WORK(&net->xfrm.state_hash_work, xfrm_hash_resize); + spin_lock_init(&net->xfrm.xfrm_state_lock); ++ seqcount_init(&net->xfrm.xfrm_state_hash_generation); + return 0; + + out_byspi: +diff --git a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c +index 0172d87e2b9ae..364b2ef9b36f8 100644 +--- a/security/selinux/ss/avtab.c ++++ b/security/selinux/ss/avtab.c +@@ -109,7 +109,7 @@ static int avtab_insert(struct avtab *h, struct avtab_key *key, struct avtab_dat + struct avtab_node *prev, *cur, *newnode; + u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); + +- if (!h) ++ if (!h || !h->nslot) + return -EINVAL; + + hvalue = avtab_hash(key, h->mask); +@@ -154,7 +154,7 @@ avtab_insert_nonunique(struct avtab *h, struct avtab_key *key, struct avtab_datu + struct avtab_node *prev, *cur; + u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); + +- if (!h) ++ if (!h || !h->nslot) + return NULL; + hvalue = avtab_hash(key, h->mask); + for (prev = NULL, cur = h->htable[hvalue]; +@@ -184,7 +184,7 @@ struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *key) + struct avtab_node *cur; + u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); + +- if (!h) ++ if (!h || !h->nslot) + return NULL; + + hvalue = avtab_hash(key, h->mask); +@@ -220,7 +220,7 @@ avtab_search_node(struct avtab *h, struct avtab_key *key) + struct avtab_node *cur; + u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); + +- if (!h) ++ if (!h || !h->nslot) + return NULL; + + hvalue = avtab_hash(key, h->mask); +@@ -295,6 +295,7 @@ void avtab_destroy(struct avtab *h) + } + kvfree(h->htable); + h->htable = NULL; ++ h->nel = 0; + h->nslot = 0; + h->mask = 0; + } +@@ -303,88 +304,52 @@ void avtab_init(struct avtab *h) + { + h->htable = NULL; + h->nel = 0; ++ h->nslot = 0; ++ h->mask = 0; + } + +-int avtab_alloc(struct avtab *h, u32 nrules) ++static int avtab_alloc_common(struct avtab *h, u32 nslot) + { +- u32 mask = 0; +- u32 shift = 0; +- u32 work = nrules; +- u32 nslot = 0; +- +- if (nrules == 0) +- goto avtab_alloc_out; +- +- while (work) { +- work = work >> 1; +- shift++; +- } +- if (shift > 2) +- shift = shift - 2; +- nslot = 1 << shift; +- if (nslot > MAX_AVTAB_HASH_BUCKETS) +- nslot = MAX_AVTAB_HASH_BUCKETS; +- mask = nslot - 1; ++ if (!nslot) ++ return 0; + + h->htable = kvcalloc(nslot, sizeof(void *), GFP_KERNEL); + if (!h->htable) + return -ENOMEM; + +- avtab_alloc_out: +- h->nel = 0; + h->nslot = nslot; +- h->mask = mask; +- pr_debug("SELinux: %d avtab hash slots, %d rules.\n", +- h->nslot, nrules); ++ h->mask = nslot - 1; + return 0; + } + +-int avtab_duplicate(struct avtab *new, struct avtab *orig) ++int avtab_alloc(struct avtab *h, u32 nrules) + { +- int i; +- struct avtab_node *node, *tmp, *tail; +- +- memset(new, 0, sizeof(*new)); ++ int rc; ++ u32 nslot = 0; + +- new->htable = kvcalloc(orig->nslot, sizeof(void *), GFP_KERNEL); +- if (!new->htable) +- return -ENOMEM; +- new->nslot = orig->nslot; +- new->mask = orig->mask; +- +- for (i = 0; i < orig->nslot; i++) { +- tail = NULL; +- for (node = orig->htable[i]; node; node = node->next) { +- tmp = kmem_cache_zalloc(avtab_node_cachep, GFP_KERNEL); +- if (!tmp) +- goto error; +- tmp->key = node->key; +- if (tmp->key.specified & AVTAB_XPERMS) { +- tmp->datum.u.xperms = +- kmem_cache_zalloc(avtab_xperms_cachep, +- GFP_KERNEL); +- if (!tmp->datum.u.xperms) { +- kmem_cache_free(avtab_node_cachep, tmp); +- goto error; +- } +- tmp->datum.u.xperms = node->datum.u.xperms; +- } else +- tmp->datum.u.data = node->datum.u.data; +- +- if (tail) +- tail->next = tmp; +- else +- new->htable[i] = tmp; +- +- tail = tmp; +- new->nel++; ++ if (nrules != 0) { ++ u32 shift = 1; ++ u32 work = nrules >> 3; ++ while (work) { ++ work >>= 1; ++ shift++; + } ++ nslot = 1 << shift; ++ if (nslot > MAX_AVTAB_HASH_BUCKETS) ++ nslot = MAX_AVTAB_HASH_BUCKETS; ++ ++ rc = avtab_alloc_common(h, nslot); ++ if (rc) ++ return rc; + } + ++ pr_debug("SELinux: %d avtab hash slots, %d rules.\n", nslot, nrules); + return 0; +-error: +- avtab_destroy(new); +- return -ENOMEM; ++} ++ ++int avtab_alloc_dup(struct avtab *new, const struct avtab *orig) ++{ ++ return avtab_alloc_common(new, orig->nslot); + } + + void avtab_hash_eval(struct avtab *h, char *tag) +diff --git a/security/selinux/ss/avtab.h b/security/selinux/ss/avtab.h +index 4c4445ca9118e..f2eeb36265d15 100644 +--- a/security/selinux/ss/avtab.h ++++ b/security/selinux/ss/avtab.h +@@ -89,7 +89,7 @@ struct avtab { + + void avtab_init(struct avtab *h); + int avtab_alloc(struct avtab *, u32); +-int avtab_duplicate(struct avtab *new, struct avtab *orig); ++int avtab_alloc_dup(struct avtab *new, const struct avtab *orig); + struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *k); + void avtab_destroy(struct avtab *h); + void avtab_hash_eval(struct avtab *h, char *tag); +diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c +index 0b32f3ab025e5..1ef74c085f2b0 100644 +--- a/security/selinux/ss/conditional.c ++++ b/security/selinux/ss/conditional.c +@@ -605,7 +605,6 @@ static int cond_dup_av_list(struct cond_av_list *new, + struct cond_av_list *orig, + struct avtab *avtab) + { +- struct avtab_node *avnode; + u32 i; + + memset(new, 0, sizeof(*new)); +@@ -615,10 +614,11 @@ static int cond_dup_av_list(struct cond_av_list *new, + return -ENOMEM; + + for (i = 0; i < orig->len; i++) { +- avnode = avtab_search_node(avtab, &orig->nodes[i]->key); +- if (WARN_ON(!avnode)) +- return -EINVAL; +- new->nodes[i] = avnode; ++ new->nodes[i] = avtab_insert_nonunique(avtab, ++ &orig->nodes[i]->key, ++ &orig->nodes[i]->datum); ++ if (!new->nodes[i]) ++ return -ENOMEM; + new->len++; + } + +@@ -630,7 +630,7 @@ static int duplicate_policydb_cond_list(struct policydb *newp, + { + int rc, i, j; + +- rc = avtab_duplicate(&newp->te_cond_avtab, &origp->te_cond_avtab); ++ rc = avtab_alloc_dup(&newp->te_cond_avtab, &origp->te_cond_avtab); + if (rc) + return rc; + +diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c +index 495fc865faf55..fbdbfb5aa3707 100644 +--- a/security/selinux/ss/services.c ++++ b/security/selinux/ss/services.c +@@ -1553,6 +1553,7 @@ static int security_context_to_sid_core(struct selinux_state *state, + if (!str) + goto out; + } ++retry: + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -1566,6 +1567,15 @@ static int security_context_to_sid_core(struct selinux_state *state, + } else if (rc) + goto out_unlock; + rc = sidtab_context_to_sid(sidtab, &context, sid); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ if (context.str) { ++ str = context.str; ++ context.str = NULL; ++ } ++ context_destroy(&context); ++ goto retry; ++ } + context_destroy(&context); + out_unlock: + rcu_read_unlock(); +@@ -1715,7 +1725,7 @@ static int security_compute_sid(struct selinux_state *state, + struct selinux_policy *policy; + struct policydb *policydb; + struct sidtab *sidtab; +- struct class_datum *cladatum = NULL; ++ struct class_datum *cladatum; + struct context *scontext, *tcontext, newcontext; + struct sidtab_entry *sentry, *tentry; + struct avtab_key avkey; +@@ -1737,6 +1747,8 @@ static int security_compute_sid(struct selinux_state *state, + goto out; + } + ++retry: ++ cladatum = NULL; + context_init(&newcontext); + + rcu_read_lock(); +@@ -1881,6 +1893,11 @@ static int security_compute_sid(struct selinux_state *state, + } + /* Obtain the sid for the context. */ + rc = sidtab_context_to_sid(sidtab, &newcontext, out_sid); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ context_destroy(&newcontext); ++ goto retry; ++ } + out_unlock: + rcu_read_unlock(); + context_destroy(&newcontext); +@@ -2192,6 +2209,7 @@ void selinux_policy_commit(struct selinux_state *state, + struct selinux_load_state *load_state) + { + struct selinux_policy *oldpolicy, *newpolicy = load_state->policy; ++ unsigned long flags; + u32 seqno; + + oldpolicy = rcu_dereference_protected(state->policy, +@@ -2213,7 +2231,13 @@ void selinux_policy_commit(struct selinux_state *state, + seqno = newpolicy->latest_granting; + + /* Install the new policy. */ +- rcu_assign_pointer(state->policy, newpolicy); ++ if (oldpolicy) { ++ sidtab_freeze_begin(oldpolicy->sidtab, &flags); ++ rcu_assign_pointer(state->policy, newpolicy); ++ sidtab_freeze_end(oldpolicy->sidtab, &flags); ++ } else { ++ rcu_assign_pointer(state->policy, newpolicy); ++ } + + /* Load the policycaps from the new policy */ + security_load_policycaps(state, newpolicy); +@@ -2357,13 +2381,15 @@ int security_port_sid(struct selinux_state *state, + struct policydb *policydb; + struct sidtab *sidtab; + struct ocontext *c; +- int rc = 0; ++ int rc; + + if (!selinux_initialized(state)) { + *out_sid = SECINITSID_PORT; + return 0; + } + ++retry: ++ rc = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2382,6 +2408,10 @@ int security_port_sid(struct selinux_state *state, + if (!c->sid[0]) { + rc = sidtab_context_to_sid(sidtab, &c->context[0], + &c->sid[0]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + } +@@ -2408,13 +2438,15 @@ int security_ib_pkey_sid(struct selinux_state *state, + struct policydb *policydb; + struct sidtab *sidtab; + struct ocontext *c; +- int rc = 0; ++ int rc; + + if (!selinux_initialized(state)) { + *out_sid = SECINITSID_UNLABELED; + return 0; + } + ++retry: ++ rc = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2435,6 +2467,10 @@ int security_ib_pkey_sid(struct selinux_state *state, + rc = sidtab_context_to_sid(sidtab, + &c->context[0], + &c->sid[0]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + } +@@ -2460,13 +2496,15 @@ int security_ib_endport_sid(struct selinux_state *state, + struct policydb *policydb; + struct sidtab *sidtab; + struct ocontext *c; +- int rc = 0; ++ int rc; + + if (!selinux_initialized(state)) { + *out_sid = SECINITSID_UNLABELED; + return 0; + } + ++retry: ++ rc = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2487,6 +2525,10 @@ int security_ib_endport_sid(struct selinux_state *state, + if (!c->sid[0]) { + rc = sidtab_context_to_sid(sidtab, &c->context[0], + &c->sid[0]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + } +@@ -2510,7 +2552,7 @@ int security_netif_sid(struct selinux_state *state, + struct selinux_policy *policy; + struct policydb *policydb; + struct sidtab *sidtab; +- int rc = 0; ++ int rc; + struct ocontext *c; + + if (!selinux_initialized(state)) { +@@ -2518,6 +2560,8 @@ int security_netif_sid(struct selinux_state *state, + return 0; + } + ++retry: ++ rc = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2534,10 +2578,18 @@ int security_netif_sid(struct selinux_state *state, + if (!c->sid[0] || !c->sid[1]) { + rc = sidtab_context_to_sid(sidtab, &c->context[0], + &c->sid[0]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + rc = sidtab_context_to_sid(sidtab, &c->context[1], + &c->sid[1]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + } +@@ -2587,6 +2639,7 @@ int security_node_sid(struct selinux_state *state, + return 0; + } + ++retry: + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2635,6 +2688,10 @@ int security_node_sid(struct selinux_state *state, + rc = sidtab_context_to_sid(sidtab, + &c->context[0], + &c->sid[0]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + } +@@ -2676,18 +2733,24 @@ int security_get_user_sids(struct selinux_state *state, + struct sidtab *sidtab; + struct context *fromcon, usercon; + u32 *mysids = NULL, *mysids2, sid; +- u32 mynel = 0, maxnel = SIDS_NEL; ++ u32 i, j, mynel, maxnel = SIDS_NEL; + struct user_datum *user; + struct role_datum *role; + struct ebitmap_node *rnode, *tnode; +- int rc = 0, i, j; ++ int rc; + + *sids = NULL; + *nel = 0; + + if (!selinux_initialized(state)) +- goto out; ++ return 0; ++ ++ mysids = kcalloc(maxnel, sizeof(*mysids), GFP_KERNEL); ++ if (!mysids) ++ return -ENOMEM; + ++retry: ++ mynel = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2707,11 +2770,6 @@ int security_get_user_sids(struct selinux_state *state, + + usercon.user = user->value; + +- rc = -ENOMEM; +- mysids = kcalloc(maxnel, sizeof(*mysids), GFP_ATOMIC); +- if (!mysids) +- goto out_unlock; +- + ebitmap_for_each_positive_bit(&user->roles, rnode, i) { + role = policydb->role_val_to_struct[i]; + usercon.role = i + 1; +@@ -2723,6 +2781,10 @@ int security_get_user_sids(struct selinux_state *state, + continue; + + rc = sidtab_context_to_sid(sidtab, &usercon, &sid); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out_unlock; + if (mynel < maxnel) { +@@ -2745,14 +2807,14 @@ out_unlock: + rcu_read_unlock(); + if (rc || !mynel) { + kfree(mysids); +- goto out; ++ return rc; + } + + rc = -ENOMEM; + mysids2 = kcalloc(mynel, sizeof(*mysids2), GFP_KERNEL); + if (!mysids2) { + kfree(mysids); +- goto out; ++ return rc; + } + for (i = 0, j = 0; i < mynel; i++) { + struct av_decision dummy_avd; +@@ -2765,12 +2827,10 @@ out_unlock: + mysids2[j++] = mysids[i]; + cond_resched(); + } +- rc = 0; + kfree(mysids); + *sids = mysids2; + *nel = j; +-out: +- return rc; ++ return 0; + } + + /** +@@ -2783,6 +2843,9 @@ out: + * Obtain a SID to use for a file in a filesystem that + * cannot support xattr or use a fixed labeling behavior like + * transition SIDs or task SIDs. ++ * ++ * WARNING: This function may return -ESTALE, indicating that the caller ++ * must retry the operation after re-acquiring the policy pointer! + */ + static inline int __security_genfs_sid(struct selinux_policy *policy, + const char *fstype, +@@ -2861,11 +2924,13 @@ int security_genfs_sid(struct selinux_state *state, + return 0; + } + +- rcu_read_lock(); +- policy = rcu_dereference(state->policy); +- retval = __security_genfs_sid(policy, +- fstype, path, orig_sclass, sid); +- rcu_read_unlock(); ++ do { ++ rcu_read_lock(); ++ policy = rcu_dereference(state->policy); ++ retval = __security_genfs_sid(policy, fstype, path, ++ orig_sclass, sid); ++ rcu_read_unlock(); ++ } while (retval == -ESTALE); + return retval; + } + +@@ -2888,7 +2953,7 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb) + struct selinux_policy *policy; + struct policydb *policydb; + struct sidtab *sidtab; +- int rc = 0; ++ int rc; + struct ocontext *c; + struct superblock_security_struct *sbsec = sb->s_security; + const char *fstype = sb->s_type->name; +@@ -2899,6 +2964,8 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb) + return 0; + } + ++retry: ++ rc = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2916,6 +2983,10 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb) + if (!c->sid[0]) { + rc = sidtab_context_to_sid(sidtab, &c->context[0], + &c->sid[0]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + } +@@ -2923,6 +2994,10 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb) + } else { + rc = __security_genfs_sid(policy, fstype, "/", + SECCLASS_DIR, &sbsec->sid); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) { + sbsec->behavior = SECURITY_FS_USE_NONE; + rc = 0; +@@ -3132,12 +3207,13 @@ int security_sid_mls_copy(struct selinux_state *state, + u32 len; + int rc; + +- rc = 0; + if (!selinux_initialized(state)) { + *new_sid = sid; +- goto out; ++ return 0; + } + ++retry: ++ rc = 0; + context_init(&newcon); + + rcu_read_lock(); +@@ -3196,10 +3272,14 @@ int security_sid_mls_copy(struct selinux_state *state, + } + } + rc = sidtab_context_to_sid(sidtab, &newcon, new_sid); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ context_destroy(&newcon); ++ goto retry; ++ } + out_unlock: + rcu_read_unlock(); + context_destroy(&newcon); +-out: + return rc; + } + +@@ -3796,6 +3876,8 @@ int security_netlbl_secattr_to_sid(struct selinux_state *state, + return 0; + } + ++retry: ++ rc = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -3822,23 +3904,24 @@ int security_netlbl_secattr_to_sid(struct selinux_state *state, + goto out; + } + rc = -EIDRM; +- if (!mls_context_isvalid(policydb, &ctx_new)) +- goto out_free; ++ if (!mls_context_isvalid(policydb, &ctx_new)) { ++ ebitmap_destroy(&ctx_new.range.level[0].cat); ++ goto out; ++ } + + rc = sidtab_context_to_sid(sidtab, &ctx_new, sid); ++ ebitmap_destroy(&ctx_new.range.level[0].cat); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) +- goto out_free; ++ goto out; + + security_netlbl_cache_add(secattr, *sid); +- +- ebitmap_destroy(&ctx_new.range.level[0].cat); + } else + *sid = SECSID_NULL; + +- rcu_read_unlock(); +- return 0; +-out_free: +- ebitmap_destroy(&ctx_new.range.level[0].cat); + out: + rcu_read_unlock(); + return rc; +diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c +index 5ee190bd30f53..656d50b09f762 100644 +--- a/security/selinux/ss/sidtab.c ++++ b/security/selinux/ss/sidtab.c +@@ -39,6 +39,7 @@ int sidtab_init(struct sidtab *s) + for (i = 0; i < SECINITSID_NUM; i++) + s->isids[i].set = 0; + ++ s->frozen = false; + s->count = 0; + s->convert = NULL; + hash_init(s->context_to_sid); +@@ -281,6 +282,15 @@ int sidtab_context_to_sid(struct sidtab *s, struct context *context, + if (*sid) + goto out_unlock; + ++ if (unlikely(s->frozen)) { ++ /* ++ * This sidtab is now frozen - tell the caller to abort and ++ * get the new one. ++ */ ++ rc = -ESTALE; ++ goto out_unlock; ++ } ++ + count = s->count; + convert = s->convert; + +@@ -474,6 +484,17 @@ void sidtab_cancel_convert(struct sidtab *s) + spin_unlock_irqrestore(&s->lock, flags); + } + ++void sidtab_freeze_begin(struct sidtab *s, unsigned long *flags) __acquires(&s->lock) ++{ ++ spin_lock_irqsave(&s->lock, *flags); ++ s->frozen = true; ++ s->convert = NULL; ++} ++void sidtab_freeze_end(struct sidtab *s, unsigned long *flags) __releases(&s->lock) ++{ ++ spin_unlock_irqrestore(&s->lock, *flags); ++} ++ + static void sidtab_destroy_entry(struct sidtab_entry *entry) + { + context_destroy(&entry->context); +diff --git a/security/selinux/ss/sidtab.h b/security/selinux/ss/sidtab.h +index 80c744d07ad62..4eff0e49dcb22 100644 +--- a/security/selinux/ss/sidtab.h ++++ b/security/selinux/ss/sidtab.h +@@ -86,6 +86,7 @@ struct sidtab { + u32 count; + /* access only under spinlock */ + struct sidtab_convert_params *convert; ++ bool frozen; + spinlock_t lock; + + #if CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE > 0 +@@ -125,6 +126,9 @@ int sidtab_convert(struct sidtab *s, struct sidtab_convert_params *params); + + void sidtab_cancel_convert(struct sidtab *s); + ++void sidtab_freeze_begin(struct sidtab *s, unsigned long *flags) __acquires(&s->lock); ++void sidtab_freeze_end(struct sidtab *s, unsigned long *flags) __releases(&s->lock); ++ + int sidtab_context_to_sid(struct sidtab *s, struct context *context, u32 *sid); + + void sidtab_destroy(struct sidtab *s); +diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c +index c91356326699e..2c5f7e905ab8f 100644 +--- a/sound/drivers/aloop.c ++++ b/sound/drivers/aloop.c +@@ -1572,6 +1572,14 @@ static int loopback_mixer_new(struct loopback *loopback, int notify) + return -ENOMEM; + kctl->id.device = dev; + kctl->id.subdevice = substr; ++ ++ /* Add the control before copying the id so that ++ * the numid field of the id is set in the copy. ++ */ ++ err = snd_ctl_add(card, kctl); ++ if (err < 0) ++ return err; ++ + switch (idx) { + case ACTIVE_IDX: + setup->active_id = kctl->id; +@@ -1588,9 +1596,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify) + default: + break; + } +- err = snd_ctl_add(card, kctl); +- if (err < 0) +- return err; + } + } + } +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c +index a980a4eda51c9..7aa9062f4f838 100644 +--- a/sound/pci/hda/patch_conexant.c ++++ b/sound/pci/hda/patch_conexant.c +@@ -944,6 +944,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { + SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x8402, "HP ProBook 645 G4", CXT_FIXUP_MUTE_LED_GPIO), + SND_PCI_QUIRK(0x103c, 0x8427, "HP ZBook Studio G5", CXT_FIXUP_HP_ZBOOK_MUTE_LED), ++ SND_PCI_QUIRK(0x103c, 0x844f, "HP ZBook Studio G5", CXT_FIXUP_HP_ZBOOK_MUTE_LED), + SND_PCI_QUIRK(0x103c, 0x8455, "HP Z2 G4", CXT_FIXUP_HP_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x8456, "HP Z2 G4 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x8457, "HP Z2 G4 mini", CXT_FIXUP_HP_MIC_NO_PRESENCE), +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 58946d069ee59..a7544b77d3f7c 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -3927,6 +3927,15 @@ static void alc271_fixup_dmic(struct hda_codec *codec, + snd_hda_sequence_write(codec, verbs); + } + ++/* Fix the speaker amp after resume, etc */ ++static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec, ++ const struct hda_fixup *fix, ++ int action) ++{ ++ if (action == HDA_FIXUP_ACT_INIT) ++ alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000); ++} ++ + static void alc269_fixup_pcm_44k(struct hda_codec *codec, + const struct hda_fixup *fix, int action) + { +@@ -6301,6 +6310,7 @@ enum { + ALC283_FIXUP_HEADSET_MIC, + ALC255_FIXUP_MIC_MUTE_LED, + ALC282_FIXUP_ASPIRE_V5_PINS, ++ ALC269VB_FIXUP_ASPIRE_E1_COEF, + ALC280_FIXUP_HP_GPIO4, + ALC286_FIXUP_HP_GPIO_LED, + ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, +@@ -6979,6 +6989,10 @@ static const struct hda_fixup alc269_fixups[] = { + { }, + }, + }, ++ [ALC269VB_FIXUP_ASPIRE_E1_COEF] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc269vb_fixup_aspire_e1_coef, ++ }, + [ALC280_FIXUP_HP_GPIO4] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc280_fixup_hp_gpio4, +@@ -7901,6 +7915,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), + SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), + SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), ++ SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF), + SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK), + SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC), +@@ -8395,6 +8410,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { + {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"}, + {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"}, + {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"}, ++ {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"}, + {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"}, + {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, + {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"}, +diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c +index 660ec46eecf25..ceaf3bbb18e66 100644 +--- a/sound/soc/codecs/wm8960.c ++++ b/sound/soc/codecs/wm8960.c +@@ -707,7 +707,13 @@ int wm8960_configure_pll(struct snd_soc_component *component, int freq_in, + best_freq_out = -EINVAL; + *sysclk_idx = *dac_idx = *bclk_idx = -1; + +- for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) { ++ /* ++ * From Datasheet, the PLL performs best when f2 is between ++ * 90MHz and 100MHz, the desired sysclk output is 11.2896MHz ++ * or 12.288MHz, then sysclkdiv = 2 is the best choice. ++ * So search sysclk_divs from 2 to 1 other than from 1 to 2. ++ */ ++ for (i = ARRAY_SIZE(sysclk_divs) - 1; i >= 0; --i) { + if (sysclk_divs[i] == -1) + continue; + for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) { +diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c +index 9e9b05883557c..aa5dd590ddd52 100644 +--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c ++++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c +@@ -488,14 +488,14 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { + .channels_min = SST_STEREO, + .channels_max = SST_STEREO, + .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, +- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + .capture = { + .stream_name = "Headset Capture", + .channels_min = 1, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, +- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + }, + { +@@ -506,7 +506,7 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { + .channels_min = SST_STEREO, + .channels_max = SST_STEREO, + .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, +- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + }, + { +diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c +index c731b9bd60b4c..85ec4361c8c4e 100644 +--- a/sound/soc/sof/intel/hda-dsp.c ++++ b/sound/soc/sof/intel/hda-dsp.c +@@ -226,10 +226,17 @@ bool hda_dsp_core_is_enabled(struct snd_sof_dev *sdev, + + val = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPCS); + +- is_enable = (val & HDA_DSP_ADSPCS_CPA_MASK(core_mask)) && +- (val & HDA_DSP_ADSPCS_SPA_MASK(core_mask)) && +- !(val & HDA_DSP_ADSPCS_CRST_MASK(core_mask)) && +- !(val & HDA_DSP_ADSPCS_CSTALL_MASK(core_mask)); ++#define MASK_IS_EQUAL(v, m, field) ({ \ ++ u32 _m = field(m); \ ++ ((v) & _m) == _m; \ ++}) ++ ++ is_enable = MASK_IS_EQUAL(val, core_mask, HDA_DSP_ADSPCS_CPA_MASK) && ++ MASK_IS_EQUAL(val, core_mask, HDA_DSP_ADSPCS_SPA_MASK) && ++ !(val & HDA_DSP_ADSPCS_CRST_MASK(core_mask)) && ++ !(val & HDA_DSP_ADSPCS_CSTALL_MASK(core_mask)); ++ ++#undef MASK_IS_EQUAL + + dev_dbg(sdev->dev, "DSP core(s) enabled? %d : core_mask %x\n", + is_enable, core_mask); +diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c +index 6c13cc84b3fb5..2173991c13db1 100644 +--- a/sound/soc/sunxi/sun4i-codec.c ++++ b/sound/soc/sunxi/sun4i-codec.c +@@ -1364,6 +1364,7 @@ static struct snd_soc_card *sun4i_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "sun4i-codec"; + card->dapm_widgets = sun4i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun4i_codec_card_dapm_widgets); +@@ -1396,6 +1397,7 @@ static struct snd_soc_card *sun6i_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "A31 Audio Codec"; + card->dapm_widgets = sun6i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); +@@ -1449,6 +1451,7 @@ static struct snd_soc_card *sun8i_a23_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "A23 Audio Codec"; + card->dapm_widgets = sun6i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); +@@ -1487,6 +1490,7 @@ static struct snd_soc_card *sun8i_h3_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "H3 Audio Codec"; + card->dapm_widgets = sun6i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); +@@ -1525,6 +1529,7 @@ static struct snd_soc_card *sun8i_v3s_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "V3s Audio Codec"; + card->dapm_widgets = sun6i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); +diff --git a/tools/lib/bpf/ringbuf.c b/tools/lib/bpf/ringbuf.c +index 98537ff2679ef..06cd709a3453a 100644 +--- a/tools/lib/bpf/ringbuf.c ++++ b/tools/lib/bpf/ringbuf.c +@@ -227,7 +227,7 @@ static int ringbuf_process_ring(struct ring* r) + if ((len & BPF_RINGBUF_DISCARD_BIT) == 0) { + sample = (void *)len_ptr + BPF_RINGBUF_HDR_SZ; + err = r->sample_cb(r->ctx, sample, len); +- if (err) { ++ if (err < 0) { + /* update consumer pos and bail out */ + smp_store_release(r->consumer_pos, + cons_pos); +diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c +index f6e8831673f9b..5f7b85fba39d0 100644 +--- a/tools/lib/bpf/xsk.c ++++ b/tools/lib/bpf/xsk.c +@@ -54,6 +54,8 @@ struct xsk_umem { + int fd; + int refcount; + struct list_head ctx_list; ++ bool rx_ring_setup_done; ++ bool tx_ring_setup_done; + }; + + struct xsk_ctx { +@@ -628,26 +630,30 @@ static struct xsk_ctx *xsk_get_ctx(struct xsk_umem *umem, int ifindex, + return NULL; + } + +-static void xsk_put_ctx(struct xsk_ctx *ctx) ++static void xsk_put_ctx(struct xsk_ctx *ctx, bool unmap) + { + struct xsk_umem *umem = ctx->umem; + struct xdp_mmap_offsets off; + int err; + +- if (--ctx->refcount == 0) { +- err = xsk_get_mmap_offsets(umem->fd, &off); +- if (!err) { +- munmap(ctx->fill->ring - off.fr.desc, +- off.fr.desc + umem->config.fill_size * +- sizeof(__u64)); +- munmap(ctx->comp->ring - off.cr.desc, +- off.cr.desc + umem->config.comp_size * +- sizeof(__u64)); +- } ++ if (--ctx->refcount) ++ return; + +- list_del(&ctx->list); +- free(ctx); +- } ++ if (!unmap) ++ goto out_free; ++ ++ err = xsk_get_mmap_offsets(umem->fd, &off); ++ if (err) ++ goto out_free; ++ ++ munmap(ctx->fill->ring - off.fr.desc, off.fr.desc + umem->config.fill_size * ++ sizeof(__u64)); ++ munmap(ctx->comp->ring - off.cr.desc, off.cr.desc + umem->config.comp_size * ++ sizeof(__u64)); ++ ++out_free: ++ list_del(&ctx->list); ++ free(ctx); + } + + static struct xsk_ctx *xsk_create_ctx(struct xsk_socket *xsk, +@@ -682,8 +688,6 @@ static struct xsk_ctx *xsk_create_ctx(struct xsk_socket *xsk, + memcpy(ctx->ifname, ifname, IFNAMSIZ - 1); + ctx->ifname[IFNAMSIZ - 1] = '\0'; + +- umem->fill_save = NULL; +- umem->comp_save = NULL; + ctx->fill = fill; + ctx->comp = comp; + list_add(&ctx->list, &umem->ctx_list); +@@ -705,6 +709,8 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, + struct xsk_socket *xsk; + struct xsk_ctx *ctx; + int err, ifindex; ++ bool unmap = umem->fill_save != fill; ++ bool rx_setup_done = false, tx_setup_done = false; + + if (!umem || !xsk_ptr || !(rx || tx)) + return -EFAULT; +@@ -732,6 +738,8 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, + } + } else { + xsk->fd = umem->fd; ++ rx_setup_done = umem->rx_ring_setup_done; ++ tx_setup_done = umem->tx_ring_setup_done; + } + + ctx = xsk_get_ctx(umem, ifindex, queue_id); +@@ -750,7 +758,7 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, + } + xsk->ctx = ctx; + +- if (rx) { ++ if (rx && !rx_setup_done) { + err = setsockopt(xsk->fd, SOL_XDP, XDP_RX_RING, + &xsk->config.rx_size, + sizeof(xsk->config.rx_size)); +@@ -758,8 +766,10 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, + err = -errno; + goto out_put_ctx; + } ++ if (xsk->fd == umem->fd) ++ umem->rx_ring_setup_done = true; + } +- if (tx) { ++ if (tx && !tx_setup_done) { + err = setsockopt(xsk->fd, SOL_XDP, XDP_TX_RING, + &xsk->config.tx_size, + sizeof(xsk->config.tx_size)); +@@ -767,6 +777,8 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, + err = -errno; + goto out_put_ctx; + } ++ if (xsk->fd == umem->fd) ++ umem->rx_ring_setup_done = true; + } + + err = xsk_get_mmap_offsets(xsk->fd, &off); +@@ -845,6 +857,8 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, + } + + *xsk_ptr = xsk; ++ umem->fill_save = NULL; ++ umem->comp_save = NULL; + return 0; + + out_mmap_tx: +@@ -856,7 +870,7 @@ out_mmap_rx: + munmap(rx_map, off.rx.desc + + xsk->config.rx_size * sizeof(struct xdp_desc)); + out_put_ctx: +- xsk_put_ctx(ctx); ++ xsk_put_ctx(ctx, unmap); + out_socket: + if (--umem->refcount) + close(xsk->fd); +@@ -870,6 +884,9 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname, + struct xsk_ring_cons *rx, struct xsk_ring_prod *tx, + const struct xsk_socket_config *usr_config) + { ++ if (!umem) ++ return -EFAULT; ++ + return xsk_socket__create_shared(xsk_ptr, ifname, queue_id, umem, + rx, tx, umem->fill_save, + umem->comp_save, usr_config); +@@ -919,7 +936,7 @@ void xsk_socket__delete(struct xsk_socket *xsk) + } + } + +- xsk_put_ctx(ctx); ++ xsk_put_ctx(ctx, true); + + umem->refcount--; + /* Do not close an fd that also has an associated umem connected +diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c +index 0462dc8db2e38..5320ac1b1285c 100644 +--- a/tools/perf/builtin-inject.c ++++ b/tools/perf/builtin-inject.c +@@ -904,7 +904,7 @@ int cmd_inject(int argc, const char **argv) + } + + data.path = inject.input_name; +- inject.session = perf_session__new(&data, true, &inject.tool); ++ inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool); + if (IS_ERR(inject.session)) + return PTR_ERR(inject.session); + +diff --git a/tools/perf/util/block-info.c b/tools/perf/util/block-info.c +index 423ec69bda6ca..5ecd4f401f324 100644 +--- a/tools/perf/util/block-info.c ++++ b/tools/perf/util/block-info.c +@@ -201,7 +201,7 @@ static int block_total_cycles_pct_entry(struct perf_hpp_fmt *fmt, + double ratio = 0.0; + + if (block_fmt->total_cycles) +- ratio = (double)bi->cycles / (double)block_fmt->total_cycles; ++ ratio = (double)bi->cycles_aggr / (double)block_fmt->total_cycles; + + return color_pct(hpp, block_fmt->width, 100.0 * ratio); + } +@@ -216,9 +216,9 @@ static int64_t block_total_cycles_pct_sort(struct perf_hpp_fmt *fmt, + double l, r; + + if (block_fmt->total_cycles) { +- l = ((double)bi_l->cycles / ++ l = ((double)bi_l->cycles_aggr / + (double)block_fmt->total_cycles) * 100000.0; +- r = ((double)bi_r->cycles / ++ r = ((double)bi_r->cycles_aggr / + (double)block_fmt->total_cycles) * 100000.0; + return (int64_t)l - (int64_t)r; + } From 4a684bfb8459e8eb78a8c0c5994fc0a75697cf0f Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Wed, 14 Apr 2021 15:14:17 +0200 Subject: [PATCH 03/18] backend tweaks: we don't need to cycle all distributions when making u-boot package --- lib/build-all-ng.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/build-all-ng.sh b/lib/build-all-ng.sh index a911fb2a8..301c4a3c0 100644 --- a/lib/build-all-ng.sh +++ b/lib/build-all-ng.sh @@ -370,6 +370,8 @@ function build_all() for BRANCH in "${RELBRANCH[@]}" do RELTARGETS=(xenial stretch buster bullseye bionic focal hirsute sid) + # we don't need to cycle all distributions when making u-boot package + [[ $BOOTONLY == "yes" ]] && RELTARGETS=(focal) for RELEASE in "${RELTARGETS[@]}" do display_alert "BSP for ${BOARD} ${BRANCH} ${RELEASE}." From 57041c99a8fe74d618f47b7d40115bb33301ef98 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Wed, 14 Apr 2021 21:32:54 +0200 Subject: [PATCH 04/18] sunxi edge - add upstream patches --- config/kernel/linux-sunxi-edge.config | 2 +- config/kernel/linux-sunxi64-edge.config | 3 +- .../archive/sunxi-5.11/patch-5.11.11-12.patch | 8201 +++++++++++++++ .../archive/sunxi-5.11/patch-5.11.12-13.patch | 1345 +++ .../archive/sunxi-5.11/patch-5.11.13-14.patch | 8865 +++++++++++++++++ 5 files changed, 18414 insertions(+), 2 deletions(-) create mode 100644 patch/kernel/archive/sunxi-5.11/patch-5.11.11-12.patch create mode 100644 patch/kernel/archive/sunxi-5.11/patch-5.11.12-13.patch create mode 100644 patch/kernel/archive/sunxi-5.11/patch-5.11.13-14.patch diff --git a/config/kernel/linux-sunxi-edge.config b/config/kernel/linux-sunxi-edge.config index d5a0fddc0..bfb3fa543 100644 --- a/config/kernel/linux-sunxi-edge.config +++ b/config/kernel/linux-sunxi-edge.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.11.11 Kernel Configuration +# Linux/arm 5.11.14 Kernel Configuration # CONFIG_CC_VERSION_TEXT="arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0" CONFIG_CC_IS_GCC=y diff --git a/config/kernel/linux-sunxi64-edge.config b/config/kernel/linux-sunxi64-edge.config index 7c57d3636..73b4456b5 100644 --- a/config/kernel/linux-sunxi64-edge.config +++ b/config/kernel/linux-sunxi64-edge.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.11.11 Kernel Configuration +# Linux/arm64 5.11.14 Kernel Configuration # CONFIG_CC_VERSION_TEXT="aarch64-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0" CONFIG_CC_IS_GCC=y @@ -355,6 +355,7 @@ CONFIG_HISILICON_ERRATUM_161600802=y # CONFIG_QCOM_FALKOR_ERRATUM_1009 is not set # CONFIG_QCOM_QDF2400_ERRATUM_0065 is not set CONFIG_QCOM_FALKOR_ERRATUM_E1041=y +CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y CONFIG_SOCIONEXT_SYNQUACER_PREITS=y # end of ARM errata workarounds via the alternatives framework diff --git a/patch/kernel/archive/sunxi-5.11/patch-5.11.11-12.patch b/patch/kernel/archive/sunxi-5.11/patch-5.11.11-12.patch new file mode 100644 index 000000000..97b2867d4 --- /dev/null +++ b/patch/kernel/archive/sunxi-5.11/patch-5.11.11-12.patch @@ -0,0 +1,8201 @@ +diff --git a/Makefile b/Makefile +index 7578e0d9622fb..1e31504aab61b 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 11 +-SUBLEVEL = 11 ++SUBLEVEL = 12 + EXTRAVERSION = + NAME = 💕 Valentine's Day Edition 💕 + +diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c +index 6f0648777d347..ee01f421e1e4c 100644 +--- a/arch/arm64/mm/mmu.c ++++ b/arch/arm64/mm/mmu.c +@@ -1445,14 +1445,30 @@ static void __remove_pgd_mapping(pgd_t *pgdir, unsigned long start, u64 size) + + static bool inside_linear_region(u64 start, u64 size) + { ++ u64 start_linear_pa = __pa(_PAGE_OFFSET(vabits_actual)); ++ u64 end_linear_pa = __pa(PAGE_END - 1); ++ ++ if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) { ++ /* ++ * Check for a wrap, it is possible because of randomized linear ++ * mapping the start physical address is actually bigger than ++ * the end physical address. In this case set start to zero ++ * because [0, end_linear_pa] range must still be able to cover ++ * all addressable physical addresses. ++ */ ++ if (start_linear_pa > end_linear_pa) ++ start_linear_pa = 0; ++ } ++ ++ WARN_ON(start_linear_pa > end_linear_pa); ++ + /* + * Linear mapping region is the range [PAGE_OFFSET..(PAGE_END - 1)] + * accommodating both its ends but excluding PAGE_END. Max physical + * range which can be mapped inside this linear mapping range, must + * also be derived from its end points. + */ +- return start >= __pa(_PAGE_OFFSET(vabits_actual)) && +- (start + size - 1) <= __pa(PAGE_END - 1); ++ return start >= start_linear_pa && (start + size - 1) <= end_linear_pa; + } + + int arch_add_memory(int nid, u64 start, u64 size, +diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c +index 764170fdb0f74..3805519a64697 100644 +--- a/arch/powerpc/platforms/pseries/lpar.c ++++ b/arch/powerpc/platforms/pseries/lpar.c +@@ -887,7 +887,8 @@ static long pSeries_lpar_hpte_updatepp(unsigned long slot, + + want_v = hpte_encode_avpn(vpn, psize, ssize); + +- flags = (newpp & 7) | H_AVPN; ++ flags = (newpp & (HPTE_R_PP | HPTE_R_N | HPTE_R_KEY_LO)) | H_AVPN; ++ flags |= (newpp & HPTE_R_KEY_HI) >> 48; + if (mmu_has_feature(MMU_FTR_KERNEL_RO)) + /* Move pp0 into bit 8 (IBM 55) */ + flags |= (newpp & HPTE_R_PP0) >> 55; +diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c +index ea4d6a660e0dc..e83e0891272d3 100644 +--- a/arch/powerpc/platforms/pseries/mobility.c ++++ b/arch/powerpc/platforms/pseries/mobility.c +@@ -452,12 +452,28 @@ static int do_suspend(void) + return ret; + } + ++/** ++ * struct pseries_suspend_info - State shared between CPUs for join/suspend. ++ * @counter: Threads are to increment this upon resuming from suspend ++ * or if an error is received from H_JOIN. The thread which performs ++ * the first increment (i.e. sets it to 1) is responsible for ++ * waking the other threads. ++ * @done: False if join/suspend is in progress. True if the operation is ++ * complete (successful or not). ++ */ ++struct pseries_suspend_info { ++ atomic_t counter; ++ bool done; ++}; ++ + static int do_join(void *arg) + { +- atomic_t *counter = arg; ++ struct pseries_suspend_info *info = arg; ++ atomic_t *counter = &info->counter; + long hvrc; + int ret; + ++retry: + /* Must ensure MSR.EE off for H_JOIN. */ + hard_irq_disable(); + hvrc = plpar_hcall_norets(H_JOIN); +@@ -473,8 +489,20 @@ static int do_join(void *arg) + case H_SUCCESS: + /* + * The suspend is complete and this cpu has received a +- * prod. ++ * prod, or we've received a stray prod from unrelated ++ * code (e.g. paravirt spinlocks) and we need to join ++ * again. ++ * ++ * This barrier orders the return from H_JOIN above vs ++ * the load of info->done. It pairs with the barrier ++ * in the wakeup/prod path below. + */ ++ smp_mb(); ++ if (READ_ONCE(info->done) == false) { ++ pr_info_ratelimited("premature return from H_JOIN on CPU %i, retrying", ++ smp_processor_id()); ++ goto retry; ++ } + ret = 0; + break; + case H_BAD_MODE: +@@ -488,6 +516,13 @@ static int do_join(void *arg) + + if (atomic_inc_return(counter) == 1) { + pr_info("CPU %u waking all threads\n", smp_processor_id()); ++ WRITE_ONCE(info->done, true); ++ /* ++ * This barrier orders the store to info->done vs subsequent ++ * H_PRODs to wake the other CPUs. It pairs with the barrier ++ * in the H_SUCCESS case above. ++ */ ++ smp_mb(); + prod_others(); + } + /* +@@ -535,11 +570,16 @@ static int pseries_suspend(u64 handle) + int ret; + + while (true) { +- atomic_t counter = ATOMIC_INIT(0); ++ struct pseries_suspend_info info; + unsigned long vasi_state; + int vasi_err; + +- ret = stop_machine(do_join, &counter, cpu_online_mask); ++ info = (struct pseries_suspend_info) { ++ .counter = ATOMIC_INIT(0), ++ .done = false, ++ }; ++ ++ ret = stop_machine(do_join, &info, cpu_online_mask); + if (ret == 0) + break; + /* +diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h +index 824b2c9da75bd..f944062c9d990 100644 +--- a/arch/riscv/include/asm/uaccess.h ++++ b/arch/riscv/include/asm/uaccess.h +@@ -306,7 +306,9 @@ do { \ + * data types like structures or arrays. + * + * @ptr must have pointer-to-simple-variable type, and @x must be assignable +- * to the result of dereferencing @ptr. ++ * to the result of dereferencing @ptr. The value of @x is copied to avoid ++ * re-ordering where @x is evaluated inside the block that enables user-space ++ * access (thus bypassing user space protection if @x is a function). + * + * Caller must check the pointer with access_ok() before calling this + * function. +@@ -316,12 +318,13 @@ do { \ + #define __put_user(x, ptr) \ + ({ \ + __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ ++ __typeof__(*__gu_ptr) __val = (x); \ + long __pu_err = 0; \ + \ + __chk_user_ptr(__gu_ptr); \ + \ + __enable_user_access(); \ +- __put_user_nocheck(x, __gu_ptr, __pu_err); \ ++ __put_user_nocheck(__val, __gu_ptr, __pu_err); \ + __disable_user_access(); \ + \ + __pu_err; \ +diff --git a/arch/s390/include/asm/vdso/data.h b/arch/s390/include/asm/vdso/data.h +index 7b3cdb4a5f481..73ee891426662 100644 +--- a/arch/s390/include/asm/vdso/data.h ++++ b/arch/s390/include/asm/vdso/data.h +@@ -6,7 +6,7 @@ + #include + + struct arch_vdso_data { +- __u64 tod_steering_delta; ++ __s64 tod_steering_delta; + __u64 tod_steering_end; + }; + +diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c +index c59cb44fbb7d7..c71c4c12c9d30 100644 +--- a/arch/s390/kernel/time.c ++++ b/arch/s390/kernel/time.c +@@ -398,6 +398,7 @@ static void clock_sync_global(unsigned long long delta) + tod_steering_delta); + tod_steering_end = now + (abs(tod_steering_delta) << 15); + vdso_data->arch_data.tod_steering_end = tod_steering_end; ++ vdso_data->arch_data.tod_steering_delta = tod_steering_delta; + + /* Update LPAR offset. */ + if (ptff_query(PTFF_QTO) && ptff(&qto, sizeof(qto), PTFF_QTO) == 0) +diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h +index c0538f82c9a22..57ef2094af93e 100644 +--- a/arch/x86/include/asm/smp.h ++++ b/arch/x86/include/asm/smp.h +@@ -132,6 +132,7 @@ void native_play_dead(void); + void play_dead_common(void); + void wbinvd_on_cpu(int cpu); + int wbinvd_on_all_cpus(void); ++bool wakeup_cpu0(void); + + void native_smp_send_reschedule(int cpu); + void native_send_call_func_ipi(const struct cpumask *mask); +diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c +index 7bdc0239a9435..14cd3186dc77d 100644 +--- a/arch/x86/kernel/acpi/boot.c ++++ b/arch/x86/kernel/acpi/boot.c +@@ -1554,10 +1554,18 @@ void __init acpi_boot_table_init(void) + /* + * Initialize the ACPI boot-time table parser. + */ +- if (acpi_table_init()) { ++ if (acpi_locate_initial_tables()) + disable_acpi(); +- return; +- } ++ else ++ acpi_reserve_initial_tables(); ++} ++ ++int __init early_acpi_boot_init(void) ++{ ++ if (acpi_disabled) ++ return 1; ++ ++ acpi_table_init_complete(); + + acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf); + +@@ -1570,18 +1578,9 @@ void __init acpi_boot_table_init(void) + } else { + printk(KERN_WARNING PREFIX "Disabling ACPI support\n"); + disable_acpi(); +- return; ++ return 1; + } + } +-} +- +-int __init early_acpi_boot_init(void) +-{ +- /* +- * If acpi_disabled, bail out +- */ +- if (acpi_disabled) +- return 1; + + /* + * Process the Multiple APIC Description Table (MADT), if present +diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c +index 740f3bdb3f619..df964571a6b43 100644 +--- a/arch/x86/kernel/setup.c ++++ b/arch/x86/kernel/setup.c +@@ -1046,6 +1046,9 @@ void __init setup_arch(char **cmdline_p) + + cleanup_highmap(); + ++ /* Look for ACPI tables and reserve memory occupied by them. */ ++ acpi_boot_table_init(); ++ + memblock_set_current_limit(ISA_END_ADDRESS); + e820__memblock_setup(); + +@@ -1137,11 +1140,6 @@ void __init setup_arch(char **cmdline_p) + + early_platform_quirks(); + +- /* +- * Parse the ACPI tables for possible boot-time SMP configuration. +- */ +- acpi_boot_table_init(); +- + early_acpi_boot_init(); + + initmem_init(); +diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c +index 02813a7f3a7cf..f877150a91da1 100644 +--- a/arch/x86/kernel/smpboot.c ++++ b/arch/x86/kernel/smpboot.c +@@ -1659,7 +1659,7 @@ void play_dead_common(void) + local_irq_disable(); + } + +-static bool wakeup_cpu0(void) ++bool wakeup_cpu0(void) + { + if (smp_processor_id() == 0 && enable_start_cpu0) + return true; +diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c +index d36773c7b5359..0b3bf6e2aeb95 100644 +--- a/arch/x86/kvm/svm/nested.c ++++ b/arch/x86/kvm/svm/nested.c +@@ -246,11 +246,18 @@ static bool nested_vmcb_check_controls(struct vmcb_control_area *control) + return true; + } + +-static bool nested_vmcb_checks(struct vcpu_svm *svm, struct vmcb *vmcb12) ++static bool nested_vmcb_check_save(struct vcpu_svm *svm, struct vmcb *vmcb12) + { + struct kvm_vcpu *vcpu = &svm->vcpu; + bool vmcb12_lma; + ++ /* ++ * FIXME: these should be done after copying the fields, ++ * to avoid TOC/TOU races. For these save area checks ++ * the possible damage is limited since kvm_set_cr0 and ++ * kvm_set_cr4 handle failure; EFER_SVME is an exception ++ * so it is force-set later in nested_prepare_vmcb_save. ++ */ + if ((vmcb12->save.efer & EFER_SVME) == 0) + return false; + +@@ -271,7 +278,7 @@ static bool nested_vmcb_checks(struct vcpu_svm *svm, struct vmcb *vmcb12) + if (!kvm_is_valid_cr4(&svm->vcpu, vmcb12->save.cr4)) + return false; + +- return nested_vmcb_check_controls(&vmcb12->control); ++ return true; + } + + static void load_nested_vmcb_control(struct vcpu_svm *svm, +@@ -396,7 +403,14 @@ static void nested_prepare_vmcb_save(struct vcpu_svm *svm, struct vmcb *vmcb12) + svm->vmcb->save.gdtr = vmcb12->save.gdtr; + svm->vmcb->save.idtr = vmcb12->save.idtr; + kvm_set_rflags(&svm->vcpu, vmcb12->save.rflags | X86_EFLAGS_FIXED); +- svm_set_efer(&svm->vcpu, vmcb12->save.efer); ++ ++ /* ++ * Force-set EFER_SVME even though it is checked earlier on the ++ * VMCB12, because the guest can flip the bit between the check ++ * and now. Clearing EFER_SVME would call svm_free_nested. ++ */ ++ svm_set_efer(&svm->vcpu, vmcb12->save.efer | EFER_SVME); ++ + svm_set_cr0(&svm->vcpu, vmcb12->save.cr0); + svm_set_cr4(&svm->vcpu, vmcb12->save.cr4); + svm->vmcb->save.cr2 = svm->vcpu.arch.cr2 = vmcb12->save.cr2; +@@ -454,7 +468,6 @@ int enter_svm_guest_mode(struct vcpu_svm *svm, u64 vmcb12_gpa, + int ret; + + svm->nested.vmcb12_gpa = vmcb12_gpa; +- load_nested_vmcb_control(svm, &vmcb12->control); + nested_prepare_vmcb_save(svm, vmcb12); + nested_prepare_vmcb_control(svm); + +@@ -501,7 +514,10 @@ int nested_svm_vmrun(struct vcpu_svm *svm) + if (WARN_ON_ONCE(!svm->nested.initialized)) + return -EINVAL; + +- if (!nested_vmcb_checks(svm, vmcb12)) { ++ load_nested_vmcb_control(svm, &vmcb12->control); ++ ++ if (!nested_vmcb_check_save(svm, vmcb12) || ++ !nested_vmcb_check_controls(&svm->nested.ctl)) { + vmcb12->control.exit_code = SVM_EXIT_ERR; + vmcb12->control.exit_code_hi = 0; + vmcb12->control.exit_info_1 = 0; +@@ -1207,6 +1223,8 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, + */ + if (!(save->cr0 & X86_CR0_PG)) + goto out_free; ++ if (!(save->efer & EFER_SVME)) ++ goto out_free; + + /* + * All checks done, we can enter guest mode. L1 control fields +diff --git a/arch/xtensa/kernel/coprocessor.S b/arch/xtensa/kernel/coprocessor.S +index c426b846beefb..45cc0ae0af6f9 100644 +--- a/arch/xtensa/kernel/coprocessor.S ++++ b/arch/xtensa/kernel/coprocessor.S +@@ -99,37 +99,6 @@ + LOAD_CP_REGS_TAB(6) + LOAD_CP_REGS_TAB(7) + +-/* +- * coprocessor_flush(struct thread_info*, index) +- * a2 a3 +- * +- * Save coprocessor registers for coprocessor 'index'. +- * The register values are saved to or loaded from the coprocessor area +- * inside the task_info structure. +- * +- * Note that this function doesn't update the coprocessor_owner information! +- * +- */ +- +-ENTRY(coprocessor_flush) +- +- /* reserve 4 bytes on stack to save a0 */ +- abi_entry(4) +- +- s32i a0, a1, 0 +- movi a0, .Lsave_cp_regs_jump_table +- addx8 a3, a3, a0 +- l32i a4, a3, 4 +- l32i a3, a3, 0 +- add a2, a2, a4 +- beqz a3, 1f +- callx0 a3 +-1: l32i a0, a1, 0 +- +- abi_ret(4) +- +-ENDPROC(coprocessor_flush) +- + /* + * Entry condition: + * +@@ -245,6 +214,39 @@ ENTRY(fast_coprocessor) + + ENDPROC(fast_coprocessor) + ++ .text ++ ++/* ++ * coprocessor_flush(struct thread_info*, index) ++ * a2 a3 ++ * ++ * Save coprocessor registers for coprocessor 'index'. ++ * The register values are saved to or loaded from the coprocessor area ++ * inside the task_info structure. ++ * ++ * Note that this function doesn't update the coprocessor_owner information! ++ * ++ */ ++ ++ENTRY(coprocessor_flush) ++ ++ /* reserve 4 bytes on stack to save a0 */ ++ abi_entry(4) ++ ++ s32i a0, a1, 0 ++ movi a0, .Lsave_cp_regs_jump_table ++ addx8 a3, a3, a0 ++ l32i a4, a3, 4 ++ l32i a3, a3, 0 ++ add a2, a2, a4 ++ beqz a3, 1f ++ callx0 a3 ++1: l32i a0, a1, 0 ++ ++ abi_ret(4) ++ ++ENDPROC(coprocessor_flush) ++ + .data + + ENTRY(coprocessor_owner) +diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c +index 7666408ce12a4..95a74890c7e99 100644 +--- a/arch/xtensa/mm/fault.c ++++ b/arch/xtensa/mm/fault.c +@@ -112,8 +112,11 @@ good_area: + */ + fault = handle_mm_fault(vma, address, flags, regs); + +- if (fault_signal_pending(fault, regs)) ++ if (fault_signal_pending(fault, regs)) { ++ if (!user_mode(regs)) ++ goto bad_page_fault; + return; ++ } + + if (unlikely(fault & VM_FAULT_ERROR)) { + if (fault & VM_FAULT_OOM) +diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c +index d93e400940a31..768a6b4d23680 100644 +--- a/drivers/acpi/processor_idle.c ++++ b/drivers/acpi/processor_idle.c +@@ -29,6 +29,7 @@ + */ + #ifdef CONFIG_X86 + #include ++#include + #endif + + #define _COMPONENT ACPI_PROCESSOR_COMPONENT +@@ -541,6 +542,12 @@ static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) + wait_for_freeze(); + } else + return -ENODEV; ++ ++#if defined(CONFIG_X86) && defined(CONFIG_HOTPLUG_CPU) ++ /* If NMI wants to wake up CPU0, start CPU0. */ ++ if (wakeup_cpu0()) ++ start_cpu0(); ++#endif + } + + /* Never reached */ +diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c +index a4fdf61b06444..239eeeafc62f6 100644 +--- a/drivers/acpi/scan.c ++++ b/drivers/acpi/scan.c +@@ -1669,6 +1669,8 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, + device_initialize(&device->dev); + dev_set_uevent_suppress(&device->dev, true); + acpi_init_coherency(device); ++ /* Assume there are unmet deps to start with. */ ++ device->dep_unmet = 1; + } + + void acpi_device_add_finalize(struct acpi_device *device) +@@ -1934,6 +1936,8 @@ static void acpi_scan_dep_init(struct acpi_device *adev) + { + struct acpi_dep_data *dep; + ++ adev->dep_unmet = 0; ++ + mutex_lock(&acpi_dep_list_lock); + + list_for_each_entry(dep, &acpi_dep_list, node) { +@@ -1981,7 +1985,13 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, bool check_dep, + return AE_CTRL_DEPTH; + + acpi_scan_init_hotplug(device); +- if (!check_dep) ++ /* ++ * If check_dep is true at this point, the device has no dependencies, ++ * or the creation of the device object would have been postponed above. ++ */ ++ if (check_dep) ++ device->dep_unmet = 0; ++ else + acpi_scan_dep_init(device); + + out: +diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c +index e48690a006a4e..9d581045acff0 100644 +--- a/drivers/acpi/tables.c ++++ b/drivers/acpi/tables.c +@@ -780,7 +780,7 @@ acpi_status acpi_os_table_override(struct acpi_table_header *existing_table, + } + + /* +- * acpi_table_init() ++ * acpi_locate_initial_tables() + * + * find RSDP, find and checksum SDT/XSDT. + * checksum all tables, print SDT/XSDT +@@ -788,7 +788,7 @@ acpi_status acpi_os_table_override(struct acpi_table_header *existing_table, + * result: sdt_entry[] is initialized + */ + +-int __init acpi_table_init(void) ++int __init acpi_locate_initial_tables(void) + { + acpi_status status; + +@@ -803,9 +803,45 @@ int __init acpi_table_init(void) + status = acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); + if (ACPI_FAILURE(status)) + return -EINVAL; +- acpi_table_initrd_scan(); + ++ return 0; ++} ++ ++void __init acpi_reserve_initial_tables(void) ++{ ++ int i; ++ ++ for (i = 0; i < ACPI_MAX_TABLES; i++) { ++ struct acpi_table_desc *table_desc = &initial_tables[i]; ++ u64 start = table_desc->address; ++ u64 size = table_desc->length; ++ ++ if (!start || !size) ++ break; ++ ++ pr_info("Reserving %4s table memory at [mem 0x%llx-0x%llx]\n", ++ table_desc->signature.ascii, start, start + size - 1); ++ ++ memblock_reserve(start, size); ++ } ++} ++ ++void __init acpi_table_init_complete(void) ++{ ++ acpi_table_initrd_scan(); + check_multiple_madt(); ++} ++ ++int __init acpi_table_init(void) ++{ ++ int ret; ++ ++ ret = acpi_locate_initial_tables(); ++ if (ret) ++ return ret; ++ ++ acpi_table_init_complete(); ++ + return 0; + } + +diff --git a/drivers/base/dd.c b/drivers/base/dd.c +index 9179825ff646f..e2cf3b29123e8 100644 +--- a/drivers/base/dd.c ++++ b/drivers/base/dd.c +@@ -97,6 +97,9 @@ static void deferred_probe_work_func(struct work_struct *work) + + get_device(dev); + ++ kfree(dev->p->deferred_probe_reason); ++ dev->p->deferred_probe_reason = NULL; ++ + /* + * Drop the mutex while probing each device; the probe path may + * manipulate the deferred list +diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c +index 5ef67bacb585e..d6d73ff94e88f 100644 +--- a/drivers/base/power/runtime.c ++++ b/drivers/base/power/runtime.c +@@ -1690,8 +1690,8 @@ void pm_runtime_get_suppliers(struct device *dev) + device_links_read_lock_held()) + if (link->flags & DL_FLAG_PM_RUNTIME) { + link->supplier_preactivated = true; +- refcount_inc(&link->rpm_active); + pm_runtime_get_sync(link->supplier); ++ refcount_inc(&link->rpm_active); + } + + device_links_read_unlock(idx); +@@ -1704,6 +1704,8 @@ void pm_runtime_get_suppliers(struct device *dev) + void pm_runtime_put_suppliers(struct device *dev) + { + struct device_link *link; ++ unsigned long flags; ++ bool put; + int idx; + + idx = device_links_read_lock(); +@@ -1712,7 +1714,11 @@ void pm_runtime_put_suppliers(struct device *dev) + device_links_read_lock_held()) + if (link->supplier_preactivated) { + link->supplier_preactivated = false; +- if (refcount_dec_not_one(&link->rpm_active)) ++ spin_lock_irqsave(&dev->power.lock, flags); ++ put = pm_runtime_status_suspended(dev) && ++ refcount_dec_not_one(&link->rpm_active); ++ spin_unlock_irqrestore(&dev->power.lock, flags); ++ if (put) + pm_runtime_put(link->supplier); + } + +diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c +index 0a6438cbb3f30..e7a9561a826d3 100644 +--- a/drivers/extcon/extcon.c ++++ b/drivers/extcon/extcon.c +@@ -1241,6 +1241,7 @@ int extcon_dev_register(struct extcon_dev *edev) + sizeof(*edev->nh), GFP_KERNEL); + if (!edev->nh) { + ret = -ENOMEM; ++ device_unregister(&edev->dev); + goto err_dev; + } + +diff --git a/drivers/firewire/nosy.c b/drivers/firewire/nosy.c +index 5fd6a60b67410..88ed971e32c0d 100644 +--- a/drivers/firewire/nosy.c ++++ b/drivers/firewire/nosy.c +@@ -346,6 +346,7 @@ nosy_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + struct client *client = file->private_data; + spinlock_t *client_list_lock = &client->lynx->client_list_lock; + struct nosy_stats stats; ++ int ret; + + switch (cmd) { + case NOSY_IOC_GET_STATS: +@@ -360,11 +361,15 @@ nosy_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return 0; + + case NOSY_IOC_START: ++ ret = -EBUSY; + spin_lock_irq(client_list_lock); +- list_add_tail(&client->link, &client->lynx->client_list); ++ if (list_empty(&client->link)) { ++ list_add_tail(&client->link, &client->lynx->client_list); ++ ret = 0; ++ } + spin_unlock_irq(client_list_lock); + +- return 0; ++ return ret; + + case NOSY_IOC_STOP: + spin_lock_irq(client_list_lock); +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +index b16b32797624a..37010f290ba4e 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +@@ -780,9 +780,9 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) + dev_info->high_va_offset = AMDGPU_GMC_HOLE_END; + dev_info->high_va_max = AMDGPU_GMC_HOLE_END | vm_size; + } +- dev_info->virtual_address_alignment = max((int)PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE); ++ dev_info->virtual_address_alignment = max_t(u32, PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE); + dev_info->pte_fragment_size = (1 << adev->vm_manager.fragment_size) * AMDGPU_GPU_PAGE_SIZE; +- dev_info->gart_page_size = AMDGPU_GPU_PAGE_SIZE; ++ dev_info->gart_page_size = max_t(u32, PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE); + dev_info->cu_active_number = adev->gfx.cu_info.number; + dev_info->cu_ao_mask = adev->gfx.cu_info.ao_cu_mask; + dev_info->ce_ram_size = adev->gfx.ce_ram_size; +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +index 0768c86869836..b24cb44739132 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +@@ -2195,8 +2195,8 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, + uint64_t eaddr; + + /* validate the parameters */ +- if (saddr & AMDGPU_GPU_PAGE_MASK || offset & AMDGPU_GPU_PAGE_MASK || +- size == 0 || size & AMDGPU_GPU_PAGE_MASK) ++ if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK || ++ size == 0 || size & ~PAGE_MASK) + return -EINVAL; + + /* make sure object fit at this offset */ +@@ -2261,8 +2261,8 @@ int amdgpu_vm_bo_replace_map(struct amdgpu_device *adev, + int r; + + /* validate the parameters */ +- if (saddr & AMDGPU_GPU_PAGE_MASK || offset & AMDGPU_GPU_PAGE_MASK || +- size == 0 || size & AMDGPU_GPU_PAGE_MASK) ++ if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK || ++ size == 0 || size & ~PAGE_MASK) + return -EINVAL; + + /* make sure object fit at this offset */ +@@ -2407,7 +2407,7 @@ int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev, + after->start = eaddr + 1; + after->last = tmp->last; + after->offset = tmp->offset; +- after->offset += after->start - tmp->start; ++ after->offset += (after->start - tmp->start) << PAGE_SHIFT; + after->flags = tmp->flags; + after->bo_va = tmp->bo_va; + list_add(&after->list, &tmp->bo_va->invalids); +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c b/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c +index b258a3dae767f..159add0f5aaae 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c +@@ -155,7 +155,7 @@ static int dbgdev_diq_submit_ib(struct kfd_dbgdev *dbgdev, + + /* Wait till CP writes sync code: */ + status = amdkfd_fence_wait_timeout( +- (unsigned int *) rm_state, ++ rm_state, + QUEUESTATE__ACTIVE, 1500); + + kfd_gtt_sa_free(dbgdev->dev, mem_obj); +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +index e686ce2bf3b3c..4598a9a581251 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +@@ -1167,7 +1167,7 @@ static int start_cpsch(struct device_queue_manager *dqm) + if (retval) + goto fail_allocate_vidmem; + +- dqm->fence_addr = dqm->fence_mem->cpu_ptr; ++ dqm->fence_addr = (uint64_t *)dqm->fence_mem->cpu_ptr; + dqm->fence_gpu_addr = dqm->fence_mem->gpu_addr; + + init_interrupts(dqm); +@@ -1340,8 +1340,8 @@ out: + return retval; + } + +-int amdkfd_fence_wait_timeout(unsigned int *fence_addr, +- unsigned int fence_value, ++int amdkfd_fence_wait_timeout(uint64_t *fence_addr, ++ uint64_t fence_value, + unsigned int timeout_ms) + { + unsigned long end_jiffies = msecs_to_jiffies(timeout_ms) + jiffies; +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +index 7351dd195274e..45f8159465544 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +@@ -192,7 +192,7 @@ struct device_queue_manager { + uint16_t vmid_pasid[VMID_NUM]; + uint64_t pipelines_addr; + uint64_t fence_gpu_addr; +- unsigned int *fence_addr; ++ uint64_t *fence_addr; + struct kfd_mem_obj *fence_mem; + bool active_runlist; + int sched_policy; +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c +index 5d541e0cc8ca2..f71a7fa6680c8 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c +@@ -347,7 +347,7 @@ fail_create_runlist_ib: + } + + int pm_send_query_status(struct packet_manager *pm, uint64_t fence_address, +- uint32_t fence_value) ++ uint64_t fence_value) + { + uint32_t *buffer, size; + int retval = 0; +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c +index dfaf771a42e66..e3ba0cd3b6fa7 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c +@@ -283,7 +283,7 @@ static int pm_unmap_queues_v9(struct packet_manager *pm, uint32_t *buffer, + } + + static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer, +- uint64_t fence_address, uint32_t fence_value) ++ uint64_t fence_address, uint64_t fence_value) + { + struct pm4_mes_query_status *packet; + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c +index a852e0d7d804f..08442e7d99440 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c +@@ -263,7 +263,7 @@ static int pm_unmap_queues_vi(struct packet_manager *pm, uint32_t *buffer, + } + + static int pm_query_status_vi(struct packet_manager *pm, uint32_t *buffer, +- uint64_t fence_address, uint32_t fence_value) ++ uint64_t fence_address, uint64_t fence_value) + { + struct pm4_mes_query_status *packet; + +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +index 09599efa41fc9..f304d1f8df5f5 100644 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +@@ -1003,8 +1003,8 @@ int pqm_get_wave_state(struct process_queue_manager *pqm, + u32 *ctl_stack_used_size, + u32 *save_area_used_size); + +-int amdkfd_fence_wait_timeout(unsigned int *fence_addr, +- unsigned int fence_value, ++int amdkfd_fence_wait_timeout(uint64_t *fence_addr, ++ uint64_t fence_value, + unsigned int timeout_ms); + + /* Packet Manager */ +@@ -1040,7 +1040,7 @@ struct packet_manager_funcs { + uint32_t filter_param, bool reset, + unsigned int sdma_engine); + int (*query_status)(struct packet_manager *pm, uint32_t *buffer, +- uint64_t fence_address, uint32_t fence_value); ++ uint64_t fence_address, uint64_t fence_value); + int (*release_mem)(uint64_t gpu_addr, uint32_t *buffer); + + /* Packet sizes */ +@@ -1062,7 +1062,7 @@ int pm_send_set_resources(struct packet_manager *pm, + struct scheduling_resources *res); + int pm_send_runlist(struct packet_manager *pm, struct list_head *dqm_queues); + int pm_send_query_status(struct packet_manager *pm, uint64_t fence_address, +- uint32_t fence_value); ++ uint64_t fence_value); + + int pm_send_unmap_queue(struct packet_manager *pm, enum kfd_queue_type type, + enum kfd_unmap_queues_filter mode, +diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +index 72cb67d50e4ae..c9b1437811053 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +@@ -3330,7 +3330,8 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, + + disable_mclk_switching_for_display = ((1 < hwmgr->display_config->num_display) && + !hwmgr->display_config->multi_monitor_in_sync) || +- smu7_vblank_too_short(hwmgr, hwmgr->display_config->min_vblank_time); ++ (hwmgr->display_config->num_display && ++ smu7_vblank_too_short(hwmgr, hwmgr->display_config->min_vblank_time)); + + disable_mclk_switching = disable_mclk_switching_for_frame_lock || + disable_mclk_switching_for_display; +diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +index 92ad2cdbae107..bf6e364192539 100644 +--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +@@ -388,10 +388,15 @@ static int vangogh_get_allowed_feature_mask(struct smu_context *smu, + + static bool vangogh_is_dpm_running(struct smu_context *smu) + { ++ struct amdgpu_device *adev = smu->adev; + int ret = 0; + uint32_t feature_mask[2]; + uint64_t feature_enabled; + ++ /* we need to re-init after suspend so return false */ ++ if (adev->in_suspend) ++ return false; ++ + ret = smu_cmn_get_enabled_32_bits_mask(smu, feature_mask, 2); + + if (ret) +diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c +index d1a9841adeedf..e6a88c8cbd691 100644 +--- a/drivers/gpu/drm/imx/imx-drm-core.c ++++ b/drivers/gpu/drm/imx/imx-drm-core.c +@@ -215,7 +215,7 @@ static int imx_drm_bind(struct device *dev) + + ret = drmm_mode_config_init(drm); + if (ret) +- return ret; ++ goto err_kms; + + ret = drm_vblank_init(drm, MAX_CRTC); + if (ret) +diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c +index f1c9a22083beb..e05565f284dcc 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_bo.c ++++ b/drivers/gpu/drm/nouveau/nouveau_bo.c +@@ -551,6 +551,10 @@ nouveau_bo_sync_for_device(struct nouveau_bo *nvbo) + + if (!ttm_dma) + return; ++ if (!ttm_dma->pages) { ++ NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma); ++ return; ++ } + + /* Don't waste time looping if the object is coherent */ + if (nvbo->force_coherent) +@@ -583,6 +587,10 @@ nouveau_bo_sync_for_cpu(struct nouveau_bo *nvbo) + + if (!ttm_dma) + return; ++ if (!ttm_dma->pages) { ++ NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma); ++ return; ++ } + + /* Don't waste time looping if the object is coherent */ + if (nvbo->force_coherent) +diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c +index 0ae3a025efe9d..8eeef5017826e 100644 +--- a/drivers/gpu/drm/tegra/dc.c ++++ b/drivers/gpu/drm/tegra/dc.c +@@ -2501,22 +2501,18 @@ static int tegra_dc_couple(struct tegra_dc *dc) + * POWER_CONTROL registers during CRTC enabling. + */ + if (dc->soc->coupled_pm && dc->pipe == 1) { +- u32 flags = DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_CONSUMER; +- struct device_link *link; +- struct device *partner; ++ struct device *companion; ++ struct tegra_dc *parent; + +- partner = driver_find_device(dc->dev->driver, NULL, NULL, +- tegra_dc_match_by_pipe); +- if (!partner) ++ companion = driver_find_device(dc->dev->driver, NULL, (const void *)0, ++ tegra_dc_match_by_pipe); ++ if (!companion) + return -EPROBE_DEFER; + +- link = device_link_add(dc->dev, partner, flags); +- if (!link) { +- dev_err(dc->dev, "failed to link controllers\n"); +- return -EINVAL; +- } ++ parent = dev_get_drvdata(companion); ++ dc->client.parent = &parent->client; + +- dev_dbg(dc->dev, "coupled to %s\n", dev_name(partner)); ++ dev_dbg(dc->dev, "coupled to %s\n", dev_name(companion)); + } + + return 0; +diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c +index f02a035dda453..7b88261f57bb6 100644 +--- a/drivers/gpu/drm/tegra/sor.c ++++ b/drivers/gpu/drm/tegra/sor.c +@@ -3115,6 +3115,12 @@ static int tegra_sor_init(struct host1x_client *client) + * kernel is possible. + */ + if (sor->rst) { ++ err = pm_runtime_resume_and_get(sor->dev); ++ if (err < 0) { ++ dev_err(sor->dev, "failed to get runtime PM: %d\n", err); ++ return err; ++ } ++ + err = reset_control_acquire(sor->rst); + if (err < 0) { + dev_err(sor->dev, "failed to acquire SOR reset: %d\n", +@@ -3148,6 +3154,7 @@ static int tegra_sor_init(struct host1x_client *client) + } + + reset_control_release(sor->rst); ++ pm_runtime_put(sor->dev); + } + + err = clk_prepare_enable(sor->clk_safe); +diff --git a/drivers/net/can/Makefile b/drivers/net/can/Makefile +index 22164300122d5..a2b4463d84802 100644 +--- a/drivers/net/can/Makefile ++++ b/drivers/net/can/Makefile +@@ -7,12 +7,7 @@ obj-$(CONFIG_CAN_VCAN) += vcan.o + obj-$(CONFIG_CAN_VXCAN) += vxcan.o + obj-$(CONFIG_CAN_SLCAN) += slcan.o + +-obj-$(CONFIG_CAN_DEV) += can-dev.o +-can-dev-y += dev.o +-can-dev-y += rx-offload.o +- +-can-dev-$(CONFIG_CAN_LEDS) += led.o +- ++obj-y += dev/ + obj-y += rcar/ + obj-y += spi/ + obj-y += usb/ +diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c +deleted file mode 100644 +index 2a4f12c3c28b0..0000000000000 +--- a/drivers/net/can/dev.c ++++ /dev/null +@@ -1,1339 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0-only +-/* Copyright (C) 2005 Marc Kleine-Budde, Pengutronix +- * Copyright (C) 2006 Andrey Volkov, Varma Electronics +- * Copyright (C) 2008-2009 Wolfgang Grandegger +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define MOD_DESC "CAN device driver interface" +- +-MODULE_DESCRIPTION(MOD_DESC); +-MODULE_LICENSE("GPL v2"); +-MODULE_AUTHOR("Wolfgang Grandegger "); +- +-/* CAN DLC to real data length conversion helpers */ +- +-static const u8 dlc2len[] = {0, 1, 2, 3, 4, 5, 6, 7, +- 8, 12, 16, 20, 24, 32, 48, 64}; +- +-/* get data length from raw data length code (DLC) */ +-u8 can_fd_dlc2len(u8 dlc) +-{ +- return dlc2len[dlc & 0x0F]; +-} +-EXPORT_SYMBOL_GPL(can_fd_dlc2len); +- +-static const u8 len2dlc[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, /* 0 - 8 */ +- 9, 9, 9, 9, /* 9 - 12 */ +- 10, 10, 10, 10, /* 13 - 16 */ +- 11, 11, 11, 11, /* 17 - 20 */ +- 12, 12, 12, 12, /* 21 - 24 */ +- 13, 13, 13, 13, 13, 13, 13, 13, /* 25 - 32 */ +- 14, 14, 14, 14, 14, 14, 14, 14, /* 33 - 40 */ +- 14, 14, 14, 14, 14, 14, 14, 14, /* 41 - 48 */ +- 15, 15, 15, 15, 15, 15, 15, 15, /* 49 - 56 */ +- 15, 15, 15, 15, 15, 15, 15, 15}; /* 57 - 64 */ +- +-/* map the sanitized data length to an appropriate data length code */ +-u8 can_fd_len2dlc(u8 len) +-{ +- if (unlikely(len > 64)) +- return 0xF; +- +- return len2dlc[len]; +-} +-EXPORT_SYMBOL_GPL(can_fd_len2dlc); +- +-#ifdef CONFIG_CAN_CALC_BITTIMING +-#define CAN_CALC_MAX_ERROR 50 /* in one-tenth of a percent */ +- +-/* Bit-timing calculation derived from: +- * +- * Code based on LinCAN sources and H8S2638 project +- * Copyright 2004-2006 Pavel Pisa - DCE FELK CVUT cz +- * Copyright 2005 Stanislav Marek +- * email: pisa@cmp.felk.cvut.cz +- * +- * Calculates proper bit-timing parameters for a specified bit-rate +- * and sample-point, which can then be used to set the bit-timing +- * registers of the CAN controller. You can find more information +- * in the header file linux/can/netlink.h. +- */ +-static int +-can_update_sample_point(const struct can_bittiming_const *btc, +- unsigned int sample_point_nominal, unsigned int tseg, +- unsigned int *tseg1_ptr, unsigned int *tseg2_ptr, +- unsigned int *sample_point_error_ptr) +-{ +- unsigned int sample_point_error, best_sample_point_error = UINT_MAX; +- unsigned int sample_point, best_sample_point = 0; +- unsigned int tseg1, tseg2; +- int i; +- +- for (i = 0; i <= 1; i++) { +- tseg2 = tseg + CAN_SYNC_SEG - +- (sample_point_nominal * (tseg + CAN_SYNC_SEG)) / +- 1000 - i; +- tseg2 = clamp(tseg2, btc->tseg2_min, btc->tseg2_max); +- tseg1 = tseg - tseg2; +- if (tseg1 > btc->tseg1_max) { +- tseg1 = btc->tseg1_max; +- tseg2 = tseg - tseg1; +- } +- +- sample_point = 1000 * (tseg + CAN_SYNC_SEG - tseg2) / +- (tseg + CAN_SYNC_SEG); +- sample_point_error = abs(sample_point_nominal - sample_point); +- +- if (sample_point <= sample_point_nominal && +- sample_point_error < best_sample_point_error) { +- best_sample_point = sample_point; +- best_sample_point_error = sample_point_error; +- *tseg1_ptr = tseg1; +- *tseg2_ptr = tseg2; +- } +- } +- +- if (sample_point_error_ptr) +- *sample_point_error_ptr = best_sample_point_error; +- +- return best_sample_point; +-} +- +-static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, +- const struct can_bittiming_const *btc) +-{ +- struct can_priv *priv = netdev_priv(dev); +- unsigned int bitrate; /* current bitrate */ +- unsigned int bitrate_error; /* difference between current and nominal value */ +- unsigned int best_bitrate_error = UINT_MAX; +- unsigned int sample_point_error; /* difference between current and nominal value */ +- unsigned int best_sample_point_error = UINT_MAX; +- unsigned int sample_point_nominal; /* nominal sample point */ +- unsigned int best_tseg = 0; /* current best value for tseg */ +- unsigned int best_brp = 0; /* current best value for brp */ +- unsigned int brp, tsegall, tseg, tseg1 = 0, tseg2 = 0; +- u64 v64; +- +- /* Use CiA recommended sample points */ +- if (bt->sample_point) { +- sample_point_nominal = bt->sample_point; +- } else { +- if (bt->bitrate > 800000) +- sample_point_nominal = 750; +- else if (bt->bitrate > 500000) +- sample_point_nominal = 800; +- else +- sample_point_nominal = 875; +- } +- +- /* tseg even = round down, odd = round up */ +- for (tseg = (btc->tseg1_max + btc->tseg2_max) * 2 + 1; +- tseg >= (btc->tseg1_min + btc->tseg2_min) * 2; tseg--) { +- tsegall = CAN_SYNC_SEG + tseg / 2; +- +- /* Compute all possible tseg choices (tseg=tseg1+tseg2) */ +- brp = priv->clock.freq / (tsegall * bt->bitrate) + tseg % 2; +- +- /* choose brp step which is possible in system */ +- brp = (brp / btc->brp_inc) * btc->brp_inc; +- if (brp < btc->brp_min || brp > btc->brp_max) +- continue; +- +- bitrate = priv->clock.freq / (brp * tsegall); +- bitrate_error = abs(bt->bitrate - bitrate); +- +- /* tseg brp biterror */ +- if (bitrate_error > best_bitrate_error) +- continue; +- +- /* reset sample point error if we have a better bitrate */ +- if (bitrate_error < best_bitrate_error) +- best_sample_point_error = UINT_MAX; +- +- can_update_sample_point(btc, sample_point_nominal, tseg / 2, +- &tseg1, &tseg2, &sample_point_error); +- if (sample_point_error > best_sample_point_error) +- continue; +- +- best_sample_point_error = sample_point_error; +- best_bitrate_error = bitrate_error; +- best_tseg = tseg / 2; +- best_brp = brp; +- +- if (bitrate_error == 0 && sample_point_error == 0) +- break; +- } +- +- if (best_bitrate_error) { +- /* Error in one-tenth of a percent */ +- v64 = (u64)best_bitrate_error * 1000; +- do_div(v64, bt->bitrate); +- bitrate_error = (u32)v64; +- if (bitrate_error > CAN_CALC_MAX_ERROR) { +- netdev_err(dev, +- "bitrate error %d.%d%% too high\n", +- bitrate_error / 10, bitrate_error % 10); +- return -EDOM; +- } +- netdev_warn(dev, "bitrate error %d.%d%%\n", +- bitrate_error / 10, bitrate_error % 10); +- } +- +- /* real sample point */ +- bt->sample_point = can_update_sample_point(btc, sample_point_nominal, +- best_tseg, &tseg1, &tseg2, +- NULL); +- +- v64 = (u64)best_brp * 1000 * 1000 * 1000; +- do_div(v64, priv->clock.freq); +- bt->tq = (u32)v64; +- bt->prop_seg = tseg1 / 2; +- bt->phase_seg1 = tseg1 - bt->prop_seg; +- bt->phase_seg2 = tseg2; +- +- /* check for sjw user settings */ +- if (!bt->sjw || !btc->sjw_max) { +- bt->sjw = 1; +- } else { +- /* bt->sjw is at least 1 -> sanitize upper bound to sjw_max */ +- if (bt->sjw > btc->sjw_max) +- bt->sjw = btc->sjw_max; +- /* bt->sjw must not be higher than tseg2 */ +- if (tseg2 < bt->sjw) +- bt->sjw = tseg2; +- } +- +- bt->brp = best_brp; +- +- /* real bitrate */ +- bt->bitrate = priv->clock.freq / +- (bt->brp * (CAN_SYNC_SEG + tseg1 + tseg2)); +- +- return 0; +-} +-#else /* !CONFIG_CAN_CALC_BITTIMING */ +-static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, +- const struct can_bittiming_const *btc) +-{ +- netdev_err(dev, "bit-timing calculation not available\n"); +- return -EINVAL; +-} +-#endif /* CONFIG_CAN_CALC_BITTIMING */ +- +-/* Checks the validity of the specified bit-timing parameters prop_seg, +- * phase_seg1, phase_seg2 and sjw and tries to determine the bitrate +- * prescaler value brp. You can find more information in the header +- * file linux/can/netlink.h. +- */ +-static int can_fixup_bittiming(struct net_device *dev, struct can_bittiming *bt, +- const struct can_bittiming_const *btc) +-{ +- struct can_priv *priv = netdev_priv(dev); +- int tseg1, alltseg; +- u64 brp64; +- +- tseg1 = bt->prop_seg + bt->phase_seg1; +- if (!bt->sjw) +- bt->sjw = 1; +- if (bt->sjw > btc->sjw_max || +- tseg1 < btc->tseg1_min || tseg1 > btc->tseg1_max || +- bt->phase_seg2 < btc->tseg2_min || bt->phase_seg2 > btc->tseg2_max) +- return -ERANGE; +- +- brp64 = (u64)priv->clock.freq * (u64)bt->tq; +- if (btc->brp_inc > 1) +- do_div(brp64, btc->brp_inc); +- brp64 += 500000000UL - 1; +- do_div(brp64, 1000000000UL); /* the practicable BRP */ +- if (btc->brp_inc > 1) +- brp64 *= btc->brp_inc; +- bt->brp = (u32)brp64; +- +- if (bt->brp < btc->brp_min || bt->brp > btc->brp_max) +- return -EINVAL; +- +- alltseg = bt->prop_seg + bt->phase_seg1 + bt->phase_seg2 + 1; +- bt->bitrate = priv->clock.freq / (bt->brp * alltseg); +- bt->sample_point = ((tseg1 + 1) * 1000) / alltseg; +- +- return 0; +-} +- +-/* Checks the validity of predefined bitrate settings */ +-static int +-can_validate_bitrate(struct net_device *dev, struct can_bittiming *bt, +- const u32 *bitrate_const, +- const unsigned int bitrate_const_cnt) +-{ +- struct can_priv *priv = netdev_priv(dev); +- unsigned int i; +- +- for (i = 0; i < bitrate_const_cnt; i++) { +- if (bt->bitrate == bitrate_const[i]) +- break; +- } +- +- if (i >= priv->bitrate_const_cnt) +- return -EINVAL; +- +- return 0; +-} +- +-static int can_get_bittiming(struct net_device *dev, struct can_bittiming *bt, +- const struct can_bittiming_const *btc, +- const u32 *bitrate_const, +- const unsigned int bitrate_const_cnt) +-{ +- int err; +- +- /* Depending on the given can_bittiming parameter structure the CAN +- * timing parameters are calculated based on the provided bitrate OR +- * alternatively the CAN timing parameters (tq, prop_seg, etc.) are +- * provided directly which are then checked and fixed up. +- */ +- if (!bt->tq && bt->bitrate && btc) +- err = can_calc_bittiming(dev, bt, btc); +- else if (bt->tq && !bt->bitrate && btc) +- err = can_fixup_bittiming(dev, bt, btc); +- else if (!bt->tq && bt->bitrate && bitrate_const) +- err = can_validate_bitrate(dev, bt, bitrate_const, +- bitrate_const_cnt); +- else +- err = -EINVAL; +- +- return err; +-} +- +-static void can_update_state_error_stats(struct net_device *dev, +- enum can_state new_state) +-{ +- struct can_priv *priv = netdev_priv(dev); +- +- if (new_state <= priv->state) +- return; +- +- switch (new_state) { +- case CAN_STATE_ERROR_WARNING: +- priv->can_stats.error_warning++; +- break; +- case CAN_STATE_ERROR_PASSIVE: +- priv->can_stats.error_passive++; +- break; +- case CAN_STATE_BUS_OFF: +- priv->can_stats.bus_off++; +- break; +- default: +- break; +- } +-} +- +-static int can_tx_state_to_frame(struct net_device *dev, enum can_state state) +-{ +- switch (state) { +- case CAN_STATE_ERROR_ACTIVE: +- return CAN_ERR_CRTL_ACTIVE; +- case CAN_STATE_ERROR_WARNING: +- return CAN_ERR_CRTL_TX_WARNING; +- case CAN_STATE_ERROR_PASSIVE: +- return CAN_ERR_CRTL_TX_PASSIVE; +- default: +- return 0; +- } +-} +- +-static int can_rx_state_to_frame(struct net_device *dev, enum can_state state) +-{ +- switch (state) { +- case CAN_STATE_ERROR_ACTIVE: +- return CAN_ERR_CRTL_ACTIVE; +- case CAN_STATE_ERROR_WARNING: +- return CAN_ERR_CRTL_RX_WARNING; +- case CAN_STATE_ERROR_PASSIVE: +- return CAN_ERR_CRTL_RX_PASSIVE; +- default: +- return 0; +- } +-} +- +-static const char *can_get_state_str(const enum can_state state) +-{ +- switch (state) { +- case CAN_STATE_ERROR_ACTIVE: +- return "Error Active"; +- case CAN_STATE_ERROR_WARNING: +- return "Error Warning"; +- case CAN_STATE_ERROR_PASSIVE: +- return "Error Passive"; +- case CAN_STATE_BUS_OFF: +- return "Bus Off"; +- case CAN_STATE_STOPPED: +- return "Stopped"; +- case CAN_STATE_SLEEPING: +- return "Sleeping"; +- default: +- return ""; +- } +- +- return ""; +-} +- +-void can_change_state(struct net_device *dev, struct can_frame *cf, +- enum can_state tx_state, enum can_state rx_state) +-{ +- struct can_priv *priv = netdev_priv(dev); +- enum can_state new_state = max(tx_state, rx_state); +- +- if (unlikely(new_state == priv->state)) { +- netdev_warn(dev, "%s: oops, state did not change", __func__); +- return; +- } +- +- netdev_dbg(dev, "Controller changed from %s State (%d) into %s State (%d).\n", +- can_get_state_str(priv->state), priv->state, +- can_get_state_str(new_state), new_state); +- +- can_update_state_error_stats(dev, new_state); +- priv->state = new_state; +- +- if (!cf) +- return; +- +- if (unlikely(new_state == CAN_STATE_BUS_OFF)) { +- cf->can_id |= CAN_ERR_BUSOFF; +- return; +- } +- +- cf->can_id |= CAN_ERR_CRTL; +- cf->data[1] |= tx_state >= rx_state ? +- can_tx_state_to_frame(dev, tx_state) : 0; +- cf->data[1] |= tx_state <= rx_state ? +- can_rx_state_to_frame(dev, rx_state) : 0; +-} +-EXPORT_SYMBOL_GPL(can_change_state); +- +-/* Local echo of CAN messages +- * +- * CAN network devices *should* support a local echo functionality +- * (see Documentation/networking/can.rst). To test the handling of CAN +- * interfaces that do not support the local echo both driver types are +- * implemented. In the case that the driver does not support the echo +- * the IFF_ECHO remains clear in dev->flags. This causes the PF_CAN core +- * to perform the echo as a fallback solution. +- */ +-static void can_flush_echo_skb(struct net_device *dev) +-{ +- struct can_priv *priv = netdev_priv(dev); +- struct net_device_stats *stats = &dev->stats; +- int i; +- +- for (i = 0; i < priv->echo_skb_max; i++) { +- if (priv->echo_skb[i]) { +- kfree_skb(priv->echo_skb[i]); +- priv->echo_skb[i] = NULL; +- stats->tx_dropped++; +- stats->tx_aborted_errors++; +- } +- } +-} +- +-/* Put the skb on the stack to be looped backed locally lateron +- * +- * The function is typically called in the start_xmit function +- * of the device driver. The driver must protect access to +- * priv->echo_skb, if necessary. +- */ +-int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, +- unsigned int idx) +-{ +- struct can_priv *priv = netdev_priv(dev); +- +- BUG_ON(idx >= priv->echo_skb_max); +- +- /* check flag whether this packet has to be looped back */ +- if (!(dev->flags & IFF_ECHO) || skb->pkt_type != PACKET_LOOPBACK || +- (skb->protocol != htons(ETH_P_CAN) && +- skb->protocol != htons(ETH_P_CANFD))) { +- kfree_skb(skb); +- return 0; +- } +- +- if (!priv->echo_skb[idx]) { +- skb = can_create_echo_skb(skb); +- if (!skb) +- return -ENOMEM; +- +- /* make settings for echo to reduce code in irq context */ +- skb->pkt_type = PACKET_BROADCAST; +- skb->ip_summed = CHECKSUM_UNNECESSARY; +- skb->dev = dev; +- +- /* save this skb for tx interrupt echo handling */ +- priv->echo_skb[idx] = skb; +- } else { +- /* locking problem with netif_stop_queue() ?? */ +- netdev_err(dev, "%s: BUG! echo_skb %d is occupied!\n", __func__, idx); +- kfree_skb(skb); +- return -EBUSY; +- } +- +- return 0; +-} +-EXPORT_SYMBOL_GPL(can_put_echo_skb); +- +-struct sk_buff * +-__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) +-{ +- struct can_priv *priv = netdev_priv(dev); +- +- if (idx >= priv->echo_skb_max) { +- netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", +- __func__, idx, priv->echo_skb_max); +- return NULL; +- } +- +- if (priv->echo_skb[idx]) { +- /* Using "struct canfd_frame::len" for the frame +- * length is supported on both CAN and CANFD frames. +- */ +- struct sk_buff *skb = priv->echo_skb[idx]; +- struct canfd_frame *cf = (struct canfd_frame *)skb->data; +- +- /* get the real payload length for netdev statistics */ +- if (cf->can_id & CAN_RTR_FLAG) +- *len_ptr = 0; +- else +- *len_ptr = cf->len; +- +- priv->echo_skb[idx] = NULL; +- +- return skb; +- } +- +- return NULL; +-} +- +-/* Get the skb from the stack and loop it back locally +- * +- * The function is typically called when the TX done interrupt +- * is handled in the device driver. The driver must protect +- * access to priv->echo_skb, if necessary. +- */ +-unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx) +-{ +- struct sk_buff *skb; +- u8 len; +- +- skb = __can_get_echo_skb(dev, idx, &len); +- if (!skb) +- return 0; +- +- skb_get(skb); +- if (netif_rx(skb) == NET_RX_SUCCESS) +- dev_consume_skb_any(skb); +- else +- dev_kfree_skb_any(skb); +- +- return len; +-} +-EXPORT_SYMBOL_GPL(can_get_echo_skb); +- +-/* Remove the skb from the stack and free it. +- * +- * The function is typically called when TX failed. +- */ +-void can_free_echo_skb(struct net_device *dev, unsigned int idx) +-{ +- struct can_priv *priv = netdev_priv(dev); +- +- BUG_ON(idx >= priv->echo_skb_max); +- +- if (priv->echo_skb[idx]) { +- dev_kfree_skb_any(priv->echo_skb[idx]); +- priv->echo_skb[idx] = NULL; +- } +-} +-EXPORT_SYMBOL_GPL(can_free_echo_skb); +- +-/* CAN device restart for bus-off recovery */ +-static void can_restart(struct net_device *dev) +-{ +- struct can_priv *priv = netdev_priv(dev); +- struct net_device_stats *stats = &dev->stats; +- struct sk_buff *skb; +- struct can_frame *cf; +- int err; +- +- BUG_ON(netif_carrier_ok(dev)); +- +- /* No synchronization needed because the device is bus-off and +- * no messages can come in or go out. +- */ +- can_flush_echo_skb(dev); +- +- /* send restart message upstream */ +- skb = alloc_can_err_skb(dev, &cf); +- if (!skb) +- goto restart; +- +- cf->can_id |= CAN_ERR_RESTARTED; +- +- stats->rx_packets++; +- stats->rx_bytes += cf->len; +- +- netif_rx_ni(skb); +- +-restart: +- netdev_dbg(dev, "restarted\n"); +- priv->can_stats.restarts++; +- +- /* Now restart the device */ +- err = priv->do_set_mode(dev, CAN_MODE_START); +- +- netif_carrier_on(dev); +- if (err) +- netdev_err(dev, "Error %d during restart", err); +-} +- +-static void can_restart_work(struct work_struct *work) +-{ +- struct delayed_work *dwork = to_delayed_work(work); +- struct can_priv *priv = container_of(dwork, struct can_priv, +- restart_work); +- +- can_restart(priv->dev); +-} +- +-int can_restart_now(struct net_device *dev) +-{ +- struct can_priv *priv = netdev_priv(dev); +- +- /* A manual restart is only permitted if automatic restart is +- * disabled and the device is in the bus-off state +- */ +- if (priv->restart_ms) +- return -EINVAL; +- if (priv->state != CAN_STATE_BUS_OFF) +- return -EBUSY; +- +- cancel_delayed_work_sync(&priv->restart_work); +- can_restart(dev); +- +- return 0; +-} +- +-/* CAN bus-off +- * +- * This functions should be called when the device goes bus-off to +- * tell the netif layer that no more packets can be sent or received. +- * If enabled, a timer is started to trigger bus-off recovery. +- */ +-void can_bus_off(struct net_device *dev) +-{ +- struct can_priv *priv = netdev_priv(dev); +- +- if (priv->restart_ms) +- netdev_info(dev, "bus-off, scheduling restart in %d ms\n", +- priv->restart_ms); +- else +- netdev_info(dev, "bus-off\n"); +- +- netif_carrier_off(dev); +- +- if (priv->restart_ms) +- schedule_delayed_work(&priv->restart_work, +- msecs_to_jiffies(priv->restart_ms)); +-} +-EXPORT_SYMBOL_GPL(can_bus_off); +- +-static void can_setup(struct net_device *dev) +-{ +- dev->type = ARPHRD_CAN; +- dev->mtu = CAN_MTU; +- dev->hard_header_len = 0; +- dev->addr_len = 0; +- dev->tx_queue_len = 10; +- +- /* New-style flags. */ +- dev->flags = IFF_NOARP; +- dev->features = NETIF_F_HW_CSUM; +-} +- +-struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) +-{ +- struct sk_buff *skb; +- +- skb = netdev_alloc_skb(dev, sizeof(struct can_skb_priv) + +- sizeof(struct can_frame)); +- if (unlikely(!skb)) +- return NULL; +- +- skb->protocol = htons(ETH_P_CAN); +- skb->pkt_type = PACKET_BROADCAST; +- skb->ip_summed = CHECKSUM_UNNECESSARY; +- +- skb_reset_mac_header(skb); +- skb_reset_network_header(skb); +- skb_reset_transport_header(skb); +- +- can_skb_reserve(skb); +- can_skb_prv(skb)->ifindex = dev->ifindex; +- can_skb_prv(skb)->skbcnt = 0; +- +- *cf = skb_put_zero(skb, sizeof(struct can_frame)); +- +- return skb; +-} +-EXPORT_SYMBOL_GPL(alloc_can_skb); +- +-struct sk_buff *alloc_canfd_skb(struct net_device *dev, +- struct canfd_frame **cfd) +-{ +- struct sk_buff *skb; +- +- skb = netdev_alloc_skb(dev, sizeof(struct can_skb_priv) + +- sizeof(struct canfd_frame)); +- if (unlikely(!skb)) +- return NULL; +- +- skb->protocol = htons(ETH_P_CANFD); +- skb->pkt_type = PACKET_BROADCAST; +- skb->ip_summed = CHECKSUM_UNNECESSARY; +- +- skb_reset_mac_header(skb); +- skb_reset_network_header(skb); +- skb_reset_transport_header(skb); +- +- can_skb_reserve(skb); +- can_skb_prv(skb)->ifindex = dev->ifindex; +- can_skb_prv(skb)->skbcnt = 0; +- +- *cfd = skb_put_zero(skb, sizeof(struct canfd_frame)); +- +- return skb; +-} +-EXPORT_SYMBOL_GPL(alloc_canfd_skb); +- +-struct sk_buff *alloc_can_err_skb(struct net_device *dev, struct can_frame **cf) +-{ +- struct sk_buff *skb; +- +- skb = alloc_can_skb(dev, cf); +- if (unlikely(!skb)) +- return NULL; +- +- (*cf)->can_id = CAN_ERR_FLAG; +- (*cf)->len = CAN_ERR_DLC; +- +- return skb; +-} +-EXPORT_SYMBOL_GPL(alloc_can_err_skb); +- +-/* Allocate and setup space for the CAN network device */ +-struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max, +- unsigned int txqs, unsigned int rxqs) +-{ +- struct net_device *dev; +- struct can_priv *priv; +- int size; +- +- /* We put the driver's priv, the CAN mid layer priv and the +- * echo skb into the netdevice's priv. The memory layout for +- * the netdev_priv is like this: +- * +- * +-------------------------+ +- * | driver's priv | +- * +-------------------------+ +- * | struct can_ml_priv | +- * +-------------------------+ +- * | array of struct sk_buff | +- * +-------------------------+ +- */ +- +- size = ALIGN(sizeof_priv, NETDEV_ALIGN) + sizeof(struct can_ml_priv); +- +- if (echo_skb_max) +- size = ALIGN(size, sizeof(struct sk_buff *)) + +- echo_skb_max * sizeof(struct sk_buff *); +- +- dev = alloc_netdev_mqs(size, "can%d", NET_NAME_UNKNOWN, can_setup, +- txqs, rxqs); +- if (!dev) +- return NULL; +- +- priv = netdev_priv(dev); +- priv->dev = dev; +- +- dev->ml_priv = (void *)priv + ALIGN(sizeof_priv, NETDEV_ALIGN); +- +- if (echo_skb_max) { +- priv->echo_skb_max = echo_skb_max; +- priv->echo_skb = (void *)priv + +- (size - echo_skb_max * sizeof(struct sk_buff *)); +- } +- +- priv->state = CAN_STATE_STOPPED; +- +- INIT_DELAYED_WORK(&priv->restart_work, can_restart_work); +- +- return dev; +-} +-EXPORT_SYMBOL_GPL(alloc_candev_mqs); +- +-/* Free space of the CAN network device */ +-void free_candev(struct net_device *dev) +-{ +- free_netdev(dev); +-} +-EXPORT_SYMBOL_GPL(free_candev); +- +-/* changing MTU and control mode for CAN/CANFD devices */ +-int can_change_mtu(struct net_device *dev, int new_mtu) +-{ +- struct can_priv *priv = netdev_priv(dev); +- +- /* Do not allow changing the MTU while running */ +- if (dev->flags & IFF_UP) +- return -EBUSY; +- +- /* allow change of MTU according to the CANFD ability of the device */ +- switch (new_mtu) { +- case CAN_MTU: +- /* 'CANFD-only' controllers can not switch to CAN_MTU */ +- if (priv->ctrlmode_static & CAN_CTRLMODE_FD) +- return -EINVAL; +- +- priv->ctrlmode &= ~CAN_CTRLMODE_FD; +- break; +- +- case CANFD_MTU: +- /* check for potential CANFD ability */ +- if (!(priv->ctrlmode_supported & CAN_CTRLMODE_FD) && +- !(priv->ctrlmode_static & CAN_CTRLMODE_FD)) +- return -EINVAL; +- +- priv->ctrlmode |= CAN_CTRLMODE_FD; +- break; +- +- default: +- return -EINVAL; +- } +- +- dev->mtu = new_mtu; +- return 0; +-} +-EXPORT_SYMBOL_GPL(can_change_mtu); +- +-/* Common open function when the device gets opened. +- * +- * This function should be called in the open function of the device +- * driver. +- */ +-int open_candev(struct net_device *dev) +-{ +- struct can_priv *priv = netdev_priv(dev); +- +- if (!priv->bittiming.bitrate) { +- netdev_err(dev, "bit-timing not yet defined\n"); +- return -EINVAL; +- } +- +- /* For CAN FD the data bitrate has to be >= the arbitration bitrate */ +- if ((priv->ctrlmode & CAN_CTRLMODE_FD) && +- (!priv->data_bittiming.bitrate || +- priv->data_bittiming.bitrate < priv->bittiming.bitrate)) { +- netdev_err(dev, "incorrect/missing data bit-timing\n"); +- return -EINVAL; +- } +- +- /* Switch carrier on if device was stopped while in bus-off state */ +- if (!netif_carrier_ok(dev)) +- netif_carrier_on(dev); +- +- return 0; +-} +-EXPORT_SYMBOL_GPL(open_candev); +- +-#ifdef CONFIG_OF +-/* Common function that can be used to understand the limitation of +- * a transceiver when it provides no means to determine these limitations +- * at runtime. +- */ +-void of_can_transceiver(struct net_device *dev) +-{ +- struct device_node *dn; +- struct can_priv *priv = netdev_priv(dev); +- struct device_node *np = dev->dev.parent->of_node; +- int ret; +- +- dn = of_get_child_by_name(np, "can-transceiver"); +- if (!dn) +- return; +- +- ret = of_property_read_u32(dn, "max-bitrate", &priv->bitrate_max); +- of_node_put(dn); +- if ((ret && ret != -EINVAL) || (!ret && !priv->bitrate_max)) +- netdev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit.\n"); +-} +-EXPORT_SYMBOL_GPL(of_can_transceiver); +-#endif +- +-/* Common close function for cleanup before the device gets closed. +- * +- * This function should be called in the close function of the device +- * driver. +- */ +-void close_candev(struct net_device *dev) +-{ +- struct can_priv *priv = netdev_priv(dev); +- +- cancel_delayed_work_sync(&priv->restart_work); +- can_flush_echo_skb(dev); +-} +-EXPORT_SYMBOL_GPL(close_candev); +- +-/* CAN netlink interface */ +-static const struct nla_policy can_policy[IFLA_CAN_MAX + 1] = { +- [IFLA_CAN_STATE] = { .type = NLA_U32 }, +- [IFLA_CAN_CTRLMODE] = { .len = sizeof(struct can_ctrlmode) }, +- [IFLA_CAN_RESTART_MS] = { .type = NLA_U32 }, +- [IFLA_CAN_RESTART] = { .type = NLA_U32 }, +- [IFLA_CAN_BITTIMING] = { .len = sizeof(struct can_bittiming) }, +- [IFLA_CAN_BITTIMING_CONST] +- = { .len = sizeof(struct can_bittiming_const) }, +- [IFLA_CAN_CLOCK] = { .len = sizeof(struct can_clock) }, +- [IFLA_CAN_BERR_COUNTER] = { .len = sizeof(struct can_berr_counter) }, +- [IFLA_CAN_DATA_BITTIMING] +- = { .len = sizeof(struct can_bittiming) }, +- [IFLA_CAN_DATA_BITTIMING_CONST] +- = { .len = sizeof(struct can_bittiming_const) }, +- [IFLA_CAN_TERMINATION] = { .type = NLA_U16 }, +-}; +- +-static int can_validate(struct nlattr *tb[], struct nlattr *data[], +- struct netlink_ext_ack *extack) +-{ +- bool is_can_fd = false; +- +- /* Make sure that valid CAN FD configurations always consist of +- * - nominal/arbitration bittiming +- * - data bittiming +- * - control mode with CAN_CTRLMODE_FD set +- */ +- +- if (!data) +- return 0; +- +- if (data[IFLA_CAN_CTRLMODE]) { +- struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]); +- +- is_can_fd = cm->flags & cm->mask & CAN_CTRLMODE_FD; +- } +- +- if (is_can_fd) { +- if (!data[IFLA_CAN_BITTIMING] || !data[IFLA_CAN_DATA_BITTIMING]) +- return -EOPNOTSUPP; +- } +- +- if (data[IFLA_CAN_DATA_BITTIMING]) { +- if (!is_can_fd || !data[IFLA_CAN_BITTIMING]) +- return -EOPNOTSUPP; +- } +- +- return 0; +-} +- +-static int can_changelink(struct net_device *dev, struct nlattr *tb[], +- struct nlattr *data[], +- struct netlink_ext_ack *extack) +-{ +- struct can_priv *priv = netdev_priv(dev); +- int err; +- +- /* We need synchronization with dev->stop() */ +- ASSERT_RTNL(); +- +- if (data[IFLA_CAN_BITTIMING]) { +- struct can_bittiming bt; +- +- /* Do not allow changing bittiming while running */ +- if (dev->flags & IFF_UP) +- return -EBUSY; +- +- /* Calculate bittiming parameters based on +- * bittiming_const if set, otherwise pass bitrate +- * directly via do_set_bitrate(). Bail out if neither +- * is given. +- */ +- if (!priv->bittiming_const && !priv->do_set_bittiming) +- return -EOPNOTSUPP; +- +- memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); +- err = can_get_bittiming(dev, &bt, +- priv->bittiming_const, +- priv->bitrate_const, +- priv->bitrate_const_cnt); +- if (err) +- return err; +- +- if (priv->bitrate_max && bt.bitrate > priv->bitrate_max) { +- netdev_err(dev, "arbitration bitrate surpasses transceiver capabilities of %d bps\n", +- priv->bitrate_max); +- return -EINVAL; +- } +- +- memcpy(&priv->bittiming, &bt, sizeof(bt)); +- +- if (priv->do_set_bittiming) { +- /* Finally, set the bit-timing registers */ +- err = priv->do_set_bittiming(dev); +- if (err) +- return err; +- } +- } +- +- if (data[IFLA_CAN_CTRLMODE]) { +- struct can_ctrlmode *cm; +- u32 ctrlstatic; +- u32 maskedflags; +- +- /* Do not allow changing controller mode while running */ +- if (dev->flags & IFF_UP) +- return -EBUSY; +- cm = nla_data(data[IFLA_CAN_CTRLMODE]); +- ctrlstatic = priv->ctrlmode_static; +- maskedflags = cm->flags & cm->mask; +- +- /* check whether provided bits are allowed to be passed */ +- if (cm->mask & ~(priv->ctrlmode_supported | ctrlstatic)) +- return -EOPNOTSUPP; +- +- /* do not check for static fd-non-iso if 'fd' is disabled */ +- if (!(maskedflags & CAN_CTRLMODE_FD)) +- ctrlstatic &= ~CAN_CTRLMODE_FD_NON_ISO; +- +- /* make sure static options are provided by configuration */ +- if ((maskedflags & ctrlstatic) != ctrlstatic) +- return -EOPNOTSUPP; +- +- /* clear bits to be modified and copy the flag values */ +- priv->ctrlmode &= ~cm->mask; +- priv->ctrlmode |= maskedflags; +- +- /* CAN_CTRLMODE_FD can only be set when driver supports FD */ +- if (priv->ctrlmode & CAN_CTRLMODE_FD) +- dev->mtu = CANFD_MTU; +- else +- dev->mtu = CAN_MTU; +- } +- +- if (data[IFLA_CAN_RESTART_MS]) { +- /* Do not allow changing restart delay while running */ +- if (dev->flags & IFF_UP) +- return -EBUSY; +- priv->restart_ms = nla_get_u32(data[IFLA_CAN_RESTART_MS]); +- } +- +- if (data[IFLA_CAN_RESTART]) { +- /* Do not allow a restart while not running */ +- if (!(dev->flags & IFF_UP)) +- return -EINVAL; +- err = can_restart_now(dev); +- if (err) +- return err; +- } +- +- if (data[IFLA_CAN_DATA_BITTIMING]) { +- struct can_bittiming dbt; +- +- /* Do not allow changing bittiming while running */ +- if (dev->flags & IFF_UP) +- return -EBUSY; +- +- /* Calculate bittiming parameters based on +- * data_bittiming_const if set, otherwise pass bitrate +- * directly via do_set_bitrate(). Bail out if neither +- * is given. +- */ +- if (!priv->data_bittiming_const && !priv->do_set_data_bittiming) +- return -EOPNOTSUPP; +- +- memcpy(&dbt, nla_data(data[IFLA_CAN_DATA_BITTIMING]), +- sizeof(dbt)); +- err = can_get_bittiming(dev, &dbt, +- priv->data_bittiming_const, +- priv->data_bitrate_const, +- priv->data_bitrate_const_cnt); +- if (err) +- return err; +- +- if (priv->bitrate_max && dbt.bitrate > priv->bitrate_max) { +- netdev_err(dev, "canfd data bitrate surpasses transceiver capabilities of %d bps\n", +- priv->bitrate_max); +- return -EINVAL; +- } +- +- memcpy(&priv->data_bittiming, &dbt, sizeof(dbt)); +- +- if (priv->do_set_data_bittiming) { +- /* Finally, set the bit-timing registers */ +- err = priv->do_set_data_bittiming(dev); +- if (err) +- return err; +- } +- } +- +- if (data[IFLA_CAN_TERMINATION]) { +- const u16 termval = nla_get_u16(data[IFLA_CAN_TERMINATION]); +- const unsigned int num_term = priv->termination_const_cnt; +- unsigned int i; +- +- if (!priv->do_set_termination) +- return -EOPNOTSUPP; +- +- /* check whether given value is supported by the interface */ +- for (i = 0; i < num_term; i++) { +- if (termval == priv->termination_const[i]) +- break; +- } +- if (i >= num_term) +- return -EINVAL; +- +- /* Finally, set the termination value */ +- err = priv->do_set_termination(dev, termval); +- if (err) +- return err; +- +- priv->termination = termval; +- } +- +- return 0; +-} +- +-static size_t can_get_size(const struct net_device *dev) +-{ +- struct can_priv *priv = netdev_priv(dev); +- size_t size = 0; +- +- if (priv->bittiming.bitrate) /* IFLA_CAN_BITTIMING */ +- size += nla_total_size(sizeof(struct can_bittiming)); +- if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */ +- size += nla_total_size(sizeof(struct can_bittiming_const)); +- size += nla_total_size(sizeof(struct can_clock)); /* IFLA_CAN_CLOCK */ +- size += nla_total_size(sizeof(u32)); /* IFLA_CAN_STATE */ +- size += nla_total_size(sizeof(struct can_ctrlmode)); /* IFLA_CAN_CTRLMODE */ +- size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */ +- if (priv->do_get_berr_counter) /* IFLA_CAN_BERR_COUNTER */ +- size += nla_total_size(sizeof(struct can_berr_counter)); +- if (priv->data_bittiming.bitrate) /* IFLA_CAN_DATA_BITTIMING */ +- size += nla_total_size(sizeof(struct can_bittiming)); +- if (priv->data_bittiming_const) /* IFLA_CAN_DATA_BITTIMING_CONST */ +- size += nla_total_size(sizeof(struct can_bittiming_const)); +- if (priv->termination_const) { +- size += nla_total_size(sizeof(priv->termination)); /* IFLA_CAN_TERMINATION */ +- size += nla_total_size(sizeof(*priv->termination_const) * /* IFLA_CAN_TERMINATION_CONST */ +- priv->termination_const_cnt); +- } +- if (priv->bitrate_const) /* IFLA_CAN_BITRATE_CONST */ +- size += nla_total_size(sizeof(*priv->bitrate_const) * +- priv->bitrate_const_cnt); +- if (priv->data_bitrate_const) /* IFLA_CAN_DATA_BITRATE_CONST */ +- size += nla_total_size(sizeof(*priv->data_bitrate_const) * +- priv->data_bitrate_const_cnt); +- size += sizeof(priv->bitrate_max); /* IFLA_CAN_BITRATE_MAX */ +- +- return size; +-} +- +-static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) +-{ +- struct can_priv *priv = netdev_priv(dev); +- struct can_ctrlmode cm = {.flags = priv->ctrlmode}; +- struct can_berr_counter bec = { }; +- enum can_state state = priv->state; +- +- if (priv->do_get_state) +- priv->do_get_state(dev, &state); +- +- if ((priv->bittiming.bitrate && +- nla_put(skb, IFLA_CAN_BITTIMING, +- sizeof(priv->bittiming), &priv->bittiming)) || +- +- (priv->bittiming_const && +- nla_put(skb, IFLA_CAN_BITTIMING_CONST, +- sizeof(*priv->bittiming_const), priv->bittiming_const)) || +- +- nla_put(skb, IFLA_CAN_CLOCK, sizeof(priv->clock), &priv->clock) || +- nla_put_u32(skb, IFLA_CAN_STATE, state) || +- nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) || +- nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) || +- +- (priv->do_get_berr_counter && +- !priv->do_get_berr_counter(dev, &bec) && +- nla_put(skb, IFLA_CAN_BERR_COUNTER, sizeof(bec), &bec)) || +- +- (priv->data_bittiming.bitrate && +- nla_put(skb, IFLA_CAN_DATA_BITTIMING, +- sizeof(priv->data_bittiming), &priv->data_bittiming)) || +- +- (priv->data_bittiming_const && +- nla_put(skb, IFLA_CAN_DATA_BITTIMING_CONST, +- sizeof(*priv->data_bittiming_const), +- priv->data_bittiming_const)) || +- +- (priv->termination_const && +- (nla_put_u16(skb, IFLA_CAN_TERMINATION, priv->termination) || +- nla_put(skb, IFLA_CAN_TERMINATION_CONST, +- sizeof(*priv->termination_const) * +- priv->termination_const_cnt, +- priv->termination_const))) || +- +- (priv->bitrate_const && +- nla_put(skb, IFLA_CAN_BITRATE_CONST, +- sizeof(*priv->bitrate_const) * +- priv->bitrate_const_cnt, +- priv->bitrate_const)) || +- +- (priv->data_bitrate_const && +- nla_put(skb, IFLA_CAN_DATA_BITRATE_CONST, +- sizeof(*priv->data_bitrate_const) * +- priv->data_bitrate_const_cnt, +- priv->data_bitrate_const)) || +- +- (nla_put(skb, IFLA_CAN_BITRATE_MAX, +- sizeof(priv->bitrate_max), +- &priv->bitrate_max)) +- ) +- +- return -EMSGSIZE; +- +- return 0; +-} +- +-static size_t can_get_xstats_size(const struct net_device *dev) +-{ +- return sizeof(struct can_device_stats); +-} +- +-static int can_fill_xstats(struct sk_buff *skb, const struct net_device *dev) +-{ +- struct can_priv *priv = netdev_priv(dev); +- +- if (nla_put(skb, IFLA_INFO_XSTATS, +- sizeof(priv->can_stats), &priv->can_stats)) +- goto nla_put_failure; +- return 0; +- +-nla_put_failure: +- return -EMSGSIZE; +-} +- +-static int can_newlink(struct net *src_net, struct net_device *dev, +- struct nlattr *tb[], struct nlattr *data[], +- struct netlink_ext_ack *extack) +-{ +- return -EOPNOTSUPP; +-} +- +-static void can_dellink(struct net_device *dev, struct list_head *head) +-{ +-} +- +-static struct rtnl_link_ops can_link_ops __read_mostly = { +- .kind = "can", +- .netns_refund = true, +- .maxtype = IFLA_CAN_MAX, +- .policy = can_policy, +- .setup = can_setup, +- .validate = can_validate, +- .newlink = can_newlink, +- .changelink = can_changelink, +- .dellink = can_dellink, +- .get_size = can_get_size, +- .fill_info = can_fill_info, +- .get_xstats_size = can_get_xstats_size, +- .fill_xstats = can_fill_xstats, +-}; +- +-/* Register the CAN network device */ +-int register_candev(struct net_device *dev) +-{ +- struct can_priv *priv = netdev_priv(dev); +- +- /* Ensure termination_const, termination_const_cnt and +- * do_set_termination consistency. All must be either set or +- * unset. +- */ +- if ((!priv->termination_const != !priv->termination_const_cnt) || +- (!priv->termination_const != !priv->do_set_termination)) +- return -EINVAL; +- +- if (!priv->bitrate_const != !priv->bitrate_const_cnt) +- return -EINVAL; +- +- if (!priv->data_bitrate_const != !priv->data_bitrate_const_cnt) +- return -EINVAL; +- +- dev->rtnl_link_ops = &can_link_ops; +- netif_carrier_off(dev); +- +- return register_netdev(dev); +-} +-EXPORT_SYMBOL_GPL(register_candev); +- +-/* Unregister the CAN network device */ +-void unregister_candev(struct net_device *dev) +-{ +- unregister_netdev(dev); +-} +-EXPORT_SYMBOL_GPL(unregister_candev); +- +-/* Test if a network device is a candev based device +- * and return the can_priv* if so. +- */ +-struct can_priv *safe_candev_priv(struct net_device *dev) +-{ +- if (dev->type != ARPHRD_CAN || dev->rtnl_link_ops != &can_link_ops) +- return NULL; +- +- return netdev_priv(dev); +-} +-EXPORT_SYMBOL_GPL(safe_candev_priv); +- +-static __init int can_dev_init(void) +-{ +- int err; +- +- can_led_notifier_init(); +- +- err = rtnl_link_register(&can_link_ops); +- if (!err) +- pr_info(MOD_DESC "\n"); +- +- return err; +-} +-module_init(can_dev_init); +- +-static __exit void can_dev_exit(void) +-{ +- rtnl_link_unregister(&can_link_ops); +- +- can_led_notifier_exit(); +-} +-module_exit(can_dev_exit); +- +-MODULE_ALIAS_RTNL_LINK("can"); +diff --git a/drivers/net/can/dev/Makefile b/drivers/net/can/dev/Makefile +new file mode 100644 +index 0000000000000..cba92e6bcf6f5 +--- /dev/null ++++ b/drivers/net/can/dev/Makefile +@@ -0,0 +1,7 @@ ++# SPDX-License-Identifier: GPL-2.0 ++ ++obj-$(CONFIG_CAN_DEV) += can-dev.o ++can-dev-y += dev.o ++can-dev-y += rx-offload.o ++ ++can-dev-$(CONFIG_CAN_LEDS) += led.o +diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c +new file mode 100644 +index 0000000000000..a665afaeccd12 +--- /dev/null ++++ b/drivers/net/can/dev/dev.c +@@ -0,0 +1,1341 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* Copyright (C) 2005 Marc Kleine-Budde, Pengutronix ++ * Copyright (C) 2006 Andrey Volkov, Varma Electronics ++ * Copyright (C) 2008-2009 Wolfgang Grandegger ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MOD_DESC "CAN device driver interface" ++ ++MODULE_DESCRIPTION(MOD_DESC); ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Wolfgang Grandegger "); ++ ++/* CAN DLC to real data length conversion helpers */ ++ ++static const u8 dlc2len[] = {0, 1, 2, 3, 4, 5, 6, 7, ++ 8, 12, 16, 20, 24, 32, 48, 64}; ++ ++/* get data length from raw data length code (DLC) */ ++u8 can_fd_dlc2len(u8 dlc) ++{ ++ return dlc2len[dlc & 0x0F]; ++} ++EXPORT_SYMBOL_GPL(can_fd_dlc2len); ++ ++static const u8 len2dlc[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, /* 0 - 8 */ ++ 9, 9, 9, 9, /* 9 - 12 */ ++ 10, 10, 10, 10, /* 13 - 16 */ ++ 11, 11, 11, 11, /* 17 - 20 */ ++ 12, 12, 12, 12, /* 21 - 24 */ ++ 13, 13, 13, 13, 13, 13, 13, 13, /* 25 - 32 */ ++ 14, 14, 14, 14, 14, 14, 14, 14, /* 33 - 40 */ ++ 14, 14, 14, 14, 14, 14, 14, 14, /* 41 - 48 */ ++ 15, 15, 15, 15, 15, 15, 15, 15, /* 49 - 56 */ ++ 15, 15, 15, 15, 15, 15, 15, 15}; /* 57 - 64 */ ++ ++/* map the sanitized data length to an appropriate data length code */ ++u8 can_fd_len2dlc(u8 len) ++{ ++ if (unlikely(len > 64)) ++ return 0xF; ++ ++ return len2dlc[len]; ++} ++EXPORT_SYMBOL_GPL(can_fd_len2dlc); ++ ++#ifdef CONFIG_CAN_CALC_BITTIMING ++#define CAN_CALC_MAX_ERROR 50 /* in one-tenth of a percent */ ++ ++/* Bit-timing calculation derived from: ++ * ++ * Code based on LinCAN sources and H8S2638 project ++ * Copyright 2004-2006 Pavel Pisa - DCE FELK CVUT cz ++ * Copyright 2005 Stanislav Marek ++ * email: pisa@cmp.felk.cvut.cz ++ * ++ * Calculates proper bit-timing parameters for a specified bit-rate ++ * and sample-point, which can then be used to set the bit-timing ++ * registers of the CAN controller. You can find more information ++ * in the header file linux/can/netlink.h. ++ */ ++static int ++can_update_sample_point(const struct can_bittiming_const *btc, ++ unsigned int sample_point_nominal, unsigned int tseg, ++ unsigned int *tseg1_ptr, unsigned int *tseg2_ptr, ++ unsigned int *sample_point_error_ptr) ++{ ++ unsigned int sample_point_error, best_sample_point_error = UINT_MAX; ++ unsigned int sample_point, best_sample_point = 0; ++ unsigned int tseg1, tseg2; ++ int i; ++ ++ for (i = 0; i <= 1; i++) { ++ tseg2 = tseg + CAN_SYNC_SEG - ++ (sample_point_nominal * (tseg + CAN_SYNC_SEG)) / ++ 1000 - i; ++ tseg2 = clamp(tseg2, btc->tseg2_min, btc->tseg2_max); ++ tseg1 = tseg - tseg2; ++ if (tseg1 > btc->tseg1_max) { ++ tseg1 = btc->tseg1_max; ++ tseg2 = tseg - tseg1; ++ } ++ ++ sample_point = 1000 * (tseg + CAN_SYNC_SEG - tseg2) / ++ (tseg + CAN_SYNC_SEG); ++ sample_point_error = abs(sample_point_nominal - sample_point); ++ ++ if (sample_point <= sample_point_nominal && ++ sample_point_error < best_sample_point_error) { ++ best_sample_point = sample_point; ++ best_sample_point_error = sample_point_error; ++ *tseg1_ptr = tseg1; ++ *tseg2_ptr = tseg2; ++ } ++ } ++ ++ if (sample_point_error_ptr) ++ *sample_point_error_ptr = best_sample_point_error; ++ ++ return best_sample_point; ++} ++ ++static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, ++ const struct can_bittiming_const *btc) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ unsigned int bitrate; /* current bitrate */ ++ unsigned int bitrate_error; /* difference between current and nominal value */ ++ unsigned int best_bitrate_error = UINT_MAX; ++ unsigned int sample_point_error; /* difference between current and nominal value */ ++ unsigned int best_sample_point_error = UINT_MAX; ++ unsigned int sample_point_nominal; /* nominal sample point */ ++ unsigned int best_tseg = 0; /* current best value for tseg */ ++ unsigned int best_brp = 0; /* current best value for brp */ ++ unsigned int brp, tsegall, tseg, tseg1 = 0, tseg2 = 0; ++ u64 v64; ++ ++ /* Use CiA recommended sample points */ ++ if (bt->sample_point) { ++ sample_point_nominal = bt->sample_point; ++ } else { ++ if (bt->bitrate > 800000) ++ sample_point_nominal = 750; ++ else if (bt->bitrate > 500000) ++ sample_point_nominal = 800; ++ else ++ sample_point_nominal = 875; ++ } ++ ++ /* tseg even = round down, odd = round up */ ++ for (tseg = (btc->tseg1_max + btc->tseg2_max) * 2 + 1; ++ tseg >= (btc->tseg1_min + btc->tseg2_min) * 2; tseg--) { ++ tsegall = CAN_SYNC_SEG + tseg / 2; ++ ++ /* Compute all possible tseg choices (tseg=tseg1+tseg2) */ ++ brp = priv->clock.freq / (tsegall * bt->bitrate) + tseg % 2; ++ ++ /* choose brp step which is possible in system */ ++ brp = (brp / btc->brp_inc) * btc->brp_inc; ++ if (brp < btc->brp_min || brp > btc->brp_max) ++ continue; ++ ++ bitrate = priv->clock.freq / (brp * tsegall); ++ bitrate_error = abs(bt->bitrate - bitrate); ++ ++ /* tseg brp biterror */ ++ if (bitrate_error > best_bitrate_error) ++ continue; ++ ++ /* reset sample point error if we have a better bitrate */ ++ if (bitrate_error < best_bitrate_error) ++ best_sample_point_error = UINT_MAX; ++ ++ can_update_sample_point(btc, sample_point_nominal, tseg / 2, ++ &tseg1, &tseg2, &sample_point_error); ++ if (sample_point_error > best_sample_point_error) ++ continue; ++ ++ best_sample_point_error = sample_point_error; ++ best_bitrate_error = bitrate_error; ++ best_tseg = tseg / 2; ++ best_brp = brp; ++ ++ if (bitrate_error == 0 && sample_point_error == 0) ++ break; ++ } ++ ++ if (best_bitrate_error) { ++ /* Error in one-tenth of a percent */ ++ v64 = (u64)best_bitrate_error * 1000; ++ do_div(v64, bt->bitrate); ++ bitrate_error = (u32)v64; ++ if (bitrate_error > CAN_CALC_MAX_ERROR) { ++ netdev_err(dev, ++ "bitrate error %d.%d%% too high\n", ++ bitrate_error / 10, bitrate_error % 10); ++ return -EDOM; ++ } ++ netdev_warn(dev, "bitrate error %d.%d%%\n", ++ bitrate_error / 10, bitrate_error % 10); ++ } ++ ++ /* real sample point */ ++ bt->sample_point = can_update_sample_point(btc, sample_point_nominal, ++ best_tseg, &tseg1, &tseg2, ++ NULL); ++ ++ v64 = (u64)best_brp * 1000 * 1000 * 1000; ++ do_div(v64, priv->clock.freq); ++ bt->tq = (u32)v64; ++ bt->prop_seg = tseg1 / 2; ++ bt->phase_seg1 = tseg1 - bt->prop_seg; ++ bt->phase_seg2 = tseg2; ++ ++ /* check for sjw user settings */ ++ if (!bt->sjw || !btc->sjw_max) { ++ bt->sjw = 1; ++ } else { ++ /* bt->sjw is at least 1 -> sanitize upper bound to sjw_max */ ++ if (bt->sjw > btc->sjw_max) ++ bt->sjw = btc->sjw_max; ++ /* bt->sjw must not be higher than tseg2 */ ++ if (tseg2 < bt->sjw) ++ bt->sjw = tseg2; ++ } ++ ++ bt->brp = best_brp; ++ ++ /* real bitrate */ ++ bt->bitrate = priv->clock.freq / ++ (bt->brp * (CAN_SYNC_SEG + tseg1 + tseg2)); ++ ++ return 0; ++} ++#else /* !CONFIG_CAN_CALC_BITTIMING */ ++static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, ++ const struct can_bittiming_const *btc) ++{ ++ netdev_err(dev, "bit-timing calculation not available\n"); ++ return -EINVAL; ++} ++#endif /* CONFIG_CAN_CALC_BITTIMING */ ++ ++/* Checks the validity of the specified bit-timing parameters prop_seg, ++ * phase_seg1, phase_seg2 and sjw and tries to determine the bitrate ++ * prescaler value brp. You can find more information in the header ++ * file linux/can/netlink.h. ++ */ ++static int can_fixup_bittiming(struct net_device *dev, struct can_bittiming *bt, ++ const struct can_bittiming_const *btc) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ int tseg1, alltseg; ++ u64 brp64; ++ ++ tseg1 = bt->prop_seg + bt->phase_seg1; ++ if (!bt->sjw) ++ bt->sjw = 1; ++ if (bt->sjw > btc->sjw_max || ++ tseg1 < btc->tseg1_min || tseg1 > btc->tseg1_max || ++ bt->phase_seg2 < btc->tseg2_min || bt->phase_seg2 > btc->tseg2_max) ++ return -ERANGE; ++ ++ brp64 = (u64)priv->clock.freq * (u64)bt->tq; ++ if (btc->brp_inc > 1) ++ do_div(brp64, btc->brp_inc); ++ brp64 += 500000000UL - 1; ++ do_div(brp64, 1000000000UL); /* the practicable BRP */ ++ if (btc->brp_inc > 1) ++ brp64 *= btc->brp_inc; ++ bt->brp = (u32)brp64; ++ ++ if (bt->brp < btc->brp_min || bt->brp > btc->brp_max) ++ return -EINVAL; ++ ++ alltseg = bt->prop_seg + bt->phase_seg1 + bt->phase_seg2 + 1; ++ bt->bitrate = priv->clock.freq / (bt->brp * alltseg); ++ bt->sample_point = ((tseg1 + 1) * 1000) / alltseg; ++ ++ return 0; ++} ++ ++/* Checks the validity of predefined bitrate settings */ ++static int ++can_validate_bitrate(struct net_device *dev, struct can_bittiming *bt, ++ const u32 *bitrate_const, ++ const unsigned int bitrate_const_cnt) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ unsigned int i; ++ ++ for (i = 0; i < bitrate_const_cnt; i++) { ++ if (bt->bitrate == bitrate_const[i]) ++ break; ++ } ++ ++ if (i >= priv->bitrate_const_cnt) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static int can_get_bittiming(struct net_device *dev, struct can_bittiming *bt, ++ const struct can_bittiming_const *btc, ++ const u32 *bitrate_const, ++ const unsigned int bitrate_const_cnt) ++{ ++ int err; ++ ++ /* Depending on the given can_bittiming parameter structure the CAN ++ * timing parameters are calculated based on the provided bitrate OR ++ * alternatively the CAN timing parameters (tq, prop_seg, etc.) are ++ * provided directly which are then checked and fixed up. ++ */ ++ if (!bt->tq && bt->bitrate && btc) ++ err = can_calc_bittiming(dev, bt, btc); ++ else if (bt->tq && !bt->bitrate && btc) ++ err = can_fixup_bittiming(dev, bt, btc); ++ else if (!bt->tq && bt->bitrate && bitrate_const) ++ err = can_validate_bitrate(dev, bt, bitrate_const, ++ bitrate_const_cnt); ++ else ++ err = -EINVAL; ++ ++ return err; ++} ++ ++static void can_update_state_error_stats(struct net_device *dev, ++ enum can_state new_state) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ ++ if (new_state <= priv->state) ++ return; ++ ++ switch (new_state) { ++ case CAN_STATE_ERROR_WARNING: ++ priv->can_stats.error_warning++; ++ break; ++ case CAN_STATE_ERROR_PASSIVE: ++ priv->can_stats.error_passive++; ++ break; ++ case CAN_STATE_BUS_OFF: ++ priv->can_stats.bus_off++; ++ break; ++ default: ++ break; ++ } ++} ++ ++static int can_tx_state_to_frame(struct net_device *dev, enum can_state state) ++{ ++ switch (state) { ++ case CAN_STATE_ERROR_ACTIVE: ++ return CAN_ERR_CRTL_ACTIVE; ++ case CAN_STATE_ERROR_WARNING: ++ return CAN_ERR_CRTL_TX_WARNING; ++ case CAN_STATE_ERROR_PASSIVE: ++ return CAN_ERR_CRTL_TX_PASSIVE; ++ default: ++ return 0; ++ } ++} ++ ++static int can_rx_state_to_frame(struct net_device *dev, enum can_state state) ++{ ++ switch (state) { ++ case CAN_STATE_ERROR_ACTIVE: ++ return CAN_ERR_CRTL_ACTIVE; ++ case CAN_STATE_ERROR_WARNING: ++ return CAN_ERR_CRTL_RX_WARNING; ++ case CAN_STATE_ERROR_PASSIVE: ++ return CAN_ERR_CRTL_RX_PASSIVE; ++ default: ++ return 0; ++ } ++} ++ ++static const char *can_get_state_str(const enum can_state state) ++{ ++ switch (state) { ++ case CAN_STATE_ERROR_ACTIVE: ++ return "Error Active"; ++ case CAN_STATE_ERROR_WARNING: ++ return "Error Warning"; ++ case CAN_STATE_ERROR_PASSIVE: ++ return "Error Passive"; ++ case CAN_STATE_BUS_OFF: ++ return "Bus Off"; ++ case CAN_STATE_STOPPED: ++ return "Stopped"; ++ case CAN_STATE_SLEEPING: ++ return "Sleeping"; ++ default: ++ return ""; ++ } ++ ++ return ""; ++} ++ ++void can_change_state(struct net_device *dev, struct can_frame *cf, ++ enum can_state tx_state, enum can_state rx_state) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ enum can_state new_state = max(tx_state, rx_state); ++ ++ if (unlikely(new_state == priv->state)) { ++ netdev_warn(dev, "%s: oops, state did not change", __func__); ++ return; ++ } ++ ++ netdev_dbg(dev, "Controller changed from %s State (%d) into %s State (%d).\n", ++ can_get_state_str(priv->state), priv->state, ++ can_get_state_str(new_state), new_state); ++ ++ can_update_state_error_stats(dev, new_state); ++ priv->state = new_state; ++ ++ if (!cf) ++ return; ++ ++ if (unlikely(new_state == CAN_STATE_BUS_OFF)) { ++ cf->can_id |= CAN_ERR_BUSOFF; ++ return; ++ } ++ ++ cf->can_id |= CAN_ERR_CRTL; ++ cf->data[1] |= tx_state >= rx_state ? ++ can_tx_state_to_frame(dev, tx_state) : 0; ++ cf->data[1] |= tx_state <= rx_state ? ++ can_rx_state_to_frame(dev, rx_state) : 0; ++} ++EXPORT_SYMBOL_GPL(can_change_state); ++ ++/* Local echo of CAN messages ++ * ++ * CAN network devices *should* support a local echo functionality ++ * (see Documentation/networking/can.rst). To test the handling of CAN ++ * interfaces that do not support the local echo both driver types are ++ * implemented. In the case that the driver does not support the echo ++ * the IFF_ECHO remains clear in dev->flags. This causes the PF_CAN core ++ * to perform the echo as a fallback solution. ++ */ ++static void can_flush_echo_skb(struct net_device *dev) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ struct net_device_stats *stats = &dev->stats; ++ int i; ++ ++ for (i = 0; i < priv->echo_skb_max; i++) { ++ if (priv->echo_skb[i]) { ++ kfree_skb(priv->echo_skb[i]); ++ priv->echo_skb[i] = NULL; ++ stats->tx_dropped++; ++ stats->tx_aborted_errors++; ++ } ++ } ++} ++ ++/* Put the skb on the stack to be looped backed locally lateron ++ * ++ * The function is typically called in the start_xmit function ++ * of the device driver. The driver must protect access to ++ * priv->echo_skb, if necessary. ++ */ ++int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, ++ unsigned int idx) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ ++ BUG_ON(idx >= priv->echo_skb_max); ++ ++ /* check flag whether this packet has to be looped back */ ++ if (!(dev->flags & IFF_ECHO) || skb->pkt_type != PACKET_LOOPBACK || ++ (skb->protocol != htons(ETH_P_CAN) && ++ skb->protocol != htons(ETH_P_CANFD))) { ++ kfree_skb(skb); ++ return 0; ++ } ++ ++ if (!priv->echo_skb[idx]) { ++ skb = can_create_echo_skb(skb); ++ if (!skb) ++ return -ENOMEM; ++ ++ /* make settings for echo to reduce code in irq context */ ++ skb->pkt_type = PACKET_BROADCAST; ++ skb->ip_summed = CHECKSUM_UNNECESSARY; ++ skb->dev = dev; ++ ++ /* save this skb for tx interrupt echo handling */ ++ priv->echo_skb[idx] = skb; ++ } else { ++ /* locking problem with netif_stop_queue() ?? */ ++ netdev_err(dev, "%s: BUG! echo_skb %d is occupied!\n", __func__, idx); ++ kfree_skb(skb); ++ return -EBUSY; ++ } ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(can_put_echo_skb); ++ ++struct sk_buff * ++__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ ++ if (idx >= priv->echo_skb_max) { ++ netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", ++ __func__, idx, priv->echo_skb_max); ++ return NULL; ++ } ++ ++ if (priv->echo_skb[idx]) { ++ /* Using "struct canfd_frame::len" for the frame ++ * length is supported on both CAN and CANFD frames. ++ */ ++ struct sk_buff *skb = priv->echo_skb[idx]; ++ struct canfd_frame *cf = (struct canfd_frame *)skb->data; ++ ++ /* get the real payload length for netdev statistics */ ++ if (cf->can_id & CAN_RTR_FLAG) ++ *len_ptr = 0; ++ else ++ *len_ptr = cf->len; ++ ++ priv->echo_skb[idx] = NULL; ++ ++ return skb; ++ } ++ ++ return NULL; ++} ++ ++/* Get the skb from the stack and loop it back locally ++ * ++ * The function is typically called when the TX done interrupt ++ * is handled in the device driver. The driver must protect ++ * access to priv->echo_skb, if necessary. ++ */ ++unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx) ++{ ++ struct sk_buff *skb; ++ u8 len; ++ ++ skb = __can_get_echo_skb(dev, idx, &len); ++ if (!skb) ++ return 0; ++ ++ skb_get(skb); ++ if (netif_rx(skb) == NET_RX_SUCCESS) ++ dev_consume_skb_any(skb); ++ else ++ dev_kfree_skb_any(skb); ++ ++ return len; ++} ++EXPORT_SYMBOL_GPL(can_get_echo_skb); ++ ++/* Remove the skb from the stack and free it. ++ * ++ * The function is typically called when TX failed. ++ */ ++void can_free_echo_skb(struct net_device *dev, unsigned int idx) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ ++ BUG_ON(idx >= priv->echo_skb_max); ++ ++ if (priv->echo_skb[idx]) { ++ dev_kfree_skb_any(priv->echo_skb[idx]); ++ priv->echo_skb[idx] = NULL; ++ } ++} ++EXPORT_SYMBOL_GPL(can_free_echo_skb); ++ ++/* CAN device restart for bus-off recovery */ ++static void can_restart(struct net_device *dev) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ struct net_device_stats *stats = &dev->stats; ++ struct sk_buff *skb; ++ struct can_frame *cf; ++ int err; ++ ++ BUG_ON(netif_carrier_ok(dev)); ++ ++ /* No synchronization needed because the device is bus-off and ++ * no messages can come in or go out. ++ */ ++ can_flush_echo_skb(dev); ++ ++ /* send restart message upstream */ ++ skb = alloc_can_err_skb(dev, &cf); ++ if (!skb) ++ goto restart; ++ ++ cf->can_id |= CAN_ERR_RESTARTED; ++ ++ stats->rx_packets++; ++ stats->rx_bytes += cf->len; ++ ++ netif_rx_ni(skb); ++ ++restart: ++ netdev_dbg(dev, "restarted\n"); ++ priv->can_stats.restarts++; ++ ++ /* Now restart the device */ ++ err = priv->do_set_mode(dev, CAN_MODE_START); ++ ++ netif_carrier_on(dev); ++ if (err) ++ netdev_err(dev, "Error %d during restart", err); ++} ++ ++static void can_restart_work(struct work_struct *work) ++{ ++ struct delayed_work *dwork = to_delayed_work(work); ++ struct can_priv *priv = container_of(dwork, struct can_priv, ++ restart_work); ++ ++ can_restart(priv->dev); ++} ++ ++int can_restart_now(struct net_device *dev) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ ++ /* A manual restart is only permitted if automatic restart is ++ * disabled and the device is in the bus-off state ++ */ ++ if (priv->restart_ms) ++ return -EINVAL; ++ if (priv->state != CAN_STATE_BUS_OFF) ++ return -EBUSY; ++ ++ cancel_delayed_work_sync(&priv->restart_work); ++ can_restart(dev); ++ ++ return 0; ++} ++ ++/* CAN bus-off ++ * ++ * This functions should be called when the device goes bus-off to ++ * tell the netif layer that no more packets can be sent or received. ++ * If enabled, a timer is started to trigger bus-off recovery. ++ */ ++void can_bus_off(struct net_device *dev) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ ++ if (priv->restart_ms) ++ netdev_info(dev, "bus-off, scheduling restart in %d ms\n", ++ priv->restart_ms); ++ else ++ netdev_info(dev, "bus-off\n"); ++ ++ netif_carrier_off(dev); ++ ++ if (priv->restart_ms) ++ schedule_delayed_work(&priv->restart_work, ++ msecs_to_jiffies(priv->restart_ms)); ++} ++EXPORT_SYMBOL_GPL(can_bus_off); ++ ++static void can_setup(struct net_device *dev) ++{ ++ dev->type = ARPHRD_CAN; ++ dev->mtu = CAN_MTU; ++ dev->hard_header_len = 0; ++ dev->addr_len = 0; ++ dev->tx_queue_len = 10; ++ ++ /* New-style flags. */ ++ dev->flags = IFF_NOARP; ++ dev->features = NETIF_F_HW_CSUM; ++} ++ ++struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) ++{ ++ struct sk_buff *skb; ++ ++ skb = netdev_alloc_skb(dev, sizeof(struct can_skb_priv) + ++ sizeof(struct can_frame)); ++ if (unlikely(!skb)) ++ return NULL; ++ ++ skb->protocol = htons(ETH_P_CAN); ++ skb->pkt_type = PACKET_BROADCAST; ++ skb->ip_summed = CHECKSUM_UNNECESSARY; ++ ++ skb_reset_mac_header(skb); ++ skb_reset_network_header(skb); ++ skb_reset_transport_header(skb); ++ ++ can_skb_reserve(skb); ++ can_skb_prv(skb)->ifindex = dev->ifindex; ++ can_skb_prv(skb)->skbcnt = 0; ++ ++ *cf = skb_put_zero(skb, sizeof(struct can_frame)); ++ ++ return skb; ++} ++EXPORT_SYMBOL_GPL(alloc_can_skb); ++ ++struct sk_buff *alloc_canfd_skb(struct net_device *dev, ++ struct canfd_frame **cfd) ++{ ++ struct sk_buff *skb; ++ ++ skb = netdev_alloc_skb(dev, sizeof(struct can_skb_priv) + ++ sizeof(struct canfd_frame)); ++ if (unlikely(!skb)) ++ return NULL; ++ ++ skb->protocol = htons(ETH_P_CANFD); ++ skb->pkt_type = PACKET_BROADCAST; ++ skb->ip_summed = CHECKSUM_UNNECESSARY; ++ ++ skb_reset_mac_header(skb); ++ skb_reset_network_header(skb); ++ skb_reset_transport_header(skb); ++ ++ can_skb_reserve(skb); ++ can_skb_prv(skb)->ifindex = dev->ifindex; ++ can_skb_prv(skb)->skbcnt = 0; ++ ++ *cfd = skb_put_zero(skb, sizeof(struct canfd_frame)); ++ ++ return skb; ++} ++EXPORT_SYMBOL_GPL(alloc_canfd_skb); ++ ++struct sk_buff *alloc_can_err_skb(struct net_device *dev, struct can_frame **cf) ++{ ++ struct sk_buff *skb; ++ ++ skb = alloc_can_skb(dev, cf); ++ if (unlikely(!skb)) ++ return NULL; ++ ++ (*cf)->can_id = CAN_ERR_FLAG; ++ (*cf)->len = CAN_ERR_DLC; ++ ++ return skb; ++} ++EXPORT_SYMBOL_GPL(alloc_can_err_skb); ++ ++/* Allocate and setup space for the CAN network device */ ++struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max, ++ unsigned int txqs, unsigned int rxqs) ++{ ++ struct can_ml_priv *can_ml; ++ struct net_device *dev; ++ struct can_priv *priv; ++ int size; ++ ++ /* We put the driver's priv, the CAN mid layer priv and the ++ * echo skb into the netdevice's priv. The memory layout for ++ * the netdev_priv is like this: ++ * ++ * +-------------------------+ ++ * | driver's priv | ++ * +-------------------------+ ++ * | struct can_ml_priv | ++ * +-------------------------+ ++ * | array of struct sk_buff | ++ * +-------------------------+ ++ */ ++ ++ size = ALIGN(sizeof_priv, NETDEV_ALIGN) + sizeof(struct can_ml_priv); ++ ++ if (echo_skb_max) ++ size = ALIGN(size, sizeof(struct sk_buff *)) + ++ echo_skb_max * sizeof(struct sk_buff *); ++ ++ dev = alloc_netdev_mqs(size, "can%d", NET_NAME_UNKNOWN, can_setup, ++ txqs, rxqs); ++ if (!dev) ++ return NULL; ++ ++ priv = netdev_priv(dev); ++ priv->dev = dev; ++ ++ can_ml = (void *)priv + ALIGN(sizeof_priv, NETDEV_ALIGN); ++ can_set_ml_priv(dev, can_ml); ++ ++ if (echo_skb_max) { ++ priv->echo_skb_max = echo_skb_max; ++ priv->echo_skb = (void *)priv + ++ (size - echo_skb_max * sizeof(struct sk_buff *)); ++ } ++ ++ priv->state = CAN_STATE_STOPPED; ++ ++ INIT_DELAYED_WORK(&priv->restart_work, can_restart_work); ++ ++ return dev; ++} ++EXPORT_SYMBOL_GPL(alloc_candev_mqs); ++ ++/* Free space of the CAN network device */ ++void free_candev(struct net_device *dev) ++{ ++ free_netdev(dev); ++} ++EXPORT_SYMBOL_GPL(free_candev); ++ ++/* changing MTU and control mode for CAN/CANFD devices */ ++int can_change_mtu(struct net_device *dev, int new_mtu) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ ++ /* Do not allow changing the MTU while running */ ++ if (dev->flags & IFF_UP) ++ return -EBUSY; ++ ++ /* allow change of MTU according to the CANFD ability of the device */ ++ switch (new_mtu) { ++ case CAN_MTU: ++ /* 'CANFD-only' controllers can not switch to CAN_MTU */ ++ if (priv->ctrlmode_static & CAN_CTRLMODE_FD) ++ return -EINVAL; ++ ++ priv->ctrlmode &= ~CAN_CTRLMODE_FD; ++ break; ++ ++ case CANFD_MTU: ++ /* check for potential CANFD ability */ ++ if (!(priv->ctrlmode_supported & CAN_CTRLMODE_FD) && ++ !(priv->ctrlmode_static & CAN_CTRLMODE_FD)) ++ return -EINVAL; ++ ++ priv->ctrlmode |= CAN_CTRLMODE_FD; ++ break; ++ ++ default: ++ return -EINVAL; ++ } ++ ++ dev->mtu = new_mtu; ++ return 0; ++} ++EXPORT_SYMBOL_GPL(can_change_mtu); ++ ++/* Common open function when the device gets opened. ++ * ++ * This function should be called in the open function of the device ++ * driver. ++ */ ++int open_candev(struct net_device *dev) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ ++ if (!priv->bittiming.bitrate) { ++ netdev_err(dev, "bit-timing not yet defined\n"); ++ return -EINVAL; ++ } ++ ++ /* For CAN FD the data bitrate has to be >= the arbitration bitrate */ ++ if ((priv->ctrlmode & CAN_CTRLMODE_FD) && ++ (!priv->data_bittiming.bitrate || ++ priv->data_bittiming.bitrate < priv->bittiming.bitrate)) { ++ netdev_err(dev, "incorrect/missing data bit-timing\n"); ++ return -EINVAL; ++ } ++ ++ /* Switch carrier on if device was stopped while in bus-off state */ ++ if (!netif_carrier_ok(dev)) ++ netif_carrier_on(dev); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(open_candev); ++ ++#ifdef CONFIG_OF ++/* Common function that can be used to understand the limitation of ++ * a transceiver when it provides no means to determine these limitations ++ * at runtime. ++ */ ++void of_can_transceiver(struct net_device *dev) ++{ ++ struct device_node *dn; ++ struct can_priv *priv = netdev_priv(dev); ++ struct device_node *np = dev->dev.parent->of_node; ++ int ret; ++ ++ dn = of_get_child_by_name(np, "can-transceiver"); ++ if (!dn) ++ return; ++ ++ ret = of_property_read_u32(dn, "max-bitrate", &priv->bitrate_max); ++ of_node_put(dn); ++ if ((ret && ret != -EINVAL) || (!ret && !priv->bitrate_max)) ++ netdev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit.\n"); ++} ++EXPORT_SYMBOL_GPL(of_can_transceiver); ++#endif ++ ++/* Common close function for cleanup before the device gets closed. ++ * ++ * This function should be called in the close function of the device ++ * driver. ++ */ ++void close_candev(struct net_device *dev) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ ++ cancel_delayed_work_sync(&priv->restart_work); ++ can_flush_echo_skb(dev); ++} ++EXPORT_SYMBOL_GPL(close_candev); ++ ++/* CAN netlink interface */ ++static const struct nla_policy can_policy[IFLA_CAN_MAX + 1] = { ++ [IFLA_CAN_STATE] = { .type = NLA_U32 }, ++ [IFLA_CAN_CTRLMODE] = { .len = sizeof(struct can_ctrlmode) }, ++ [IFLA_CAN_RESTART_MS] = { .type = NLA_U32 }, ++ [IFLA_CAN_RESTART] = { .type = NLA_U32 }, ++ [IFLA_CAN_BITTIMING] = { .len = sizeof(struct can_bittiming) }, ++ [IFLA_CAN_BITTIMING_CONST] ++ = { .len = sizeof(struct can_bittiming_const) }, ++ [IFLA_CAN_CLOCK] = { .len = sizeof(struct can_clock) }, ++ [IFLA_CAN_BERR_COUNTER] = { .len = sizeof(struct can_berr_counter) }, ++ [IFLA_CAN_DATA_BITTIMING] ++ = { .len = sizeof(struct can_bittiming) }, ++ [IFLA_CAN_DATA_BITTIMING_CONST] ++ = { .len = sizeof(struct can_bittiming_const) }, ++ [IFLA_CAN_TERMINATION] = { .type = NLA_U16 }, ++}; ++ ++static int can_validate(struct nlattr *tb[], struct nlattr *data[], ++ struct netlink_ext_ack *extack) ++{ ++ bool is_can_fd = false; ++ ++ /* Make sure that valid CAN FD configurations always consist of ++ * - nominal/arbitration bittiming ++ * - data bittiming ++ * - control mode with CAN_CTRLMODE_FD set ++ */ ++ ++ if (!data) ++ return 0; ++ ++ if (data[IFLA_CAN_CTRLMODE]) { ++ struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]); ++ ++ is_can_fd = cm->flags & cm->mask & CAN_CTRLMODE_FD; ++ } ++ ++ if (is_can_fd) { ++ if (!data[IFLA_CAN_BITTIMING] || !data[IFLA_CAN_DATA_BITTIMING]) ++ return -EOPNOTSUPP; ++ } ++ ++ if (data[IFLA_CAN_DATA_BITTIMING]) { ++ if (!is_can_fd || !data[IFLA_CAN_BITTIMING]) ++ return -EOPNOTSUPP; ++ } ++ ++ return 0; ++} ++ ++static int can_changelink(struct net_device *dev, struct nlattr *tb[], ++ struct nlattr *data[], ++ struct netlink_ext_ack *extack) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ int err; ++ ++ /* We need synchronization with dev->stop() */ ++ ASSERT_RTNL(); ++ ++ if (data[IFLA_CAN_BITTIMING]) { ++ struct can_bittiming bt; ++ ++ /* Do not allow changing bittiming while running */ ++ if (dev->flags & IFF_UP) ++ return -EBUSY; ++ ++ /* Calculate bittiming parameters based on ++ * bittiming_const if set, otherwise pass bitrate ++ * directly via do_set_bitrate(). Bail out if neither ++ * is given. ++ */ ++ if (!priv->bittiming_const && !priv->do_set_bittiming) ++ return -EOPNOTSUPP; ++ ++ memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); ++ err = can_get_bittiming(dev, &bt, ++ priv->bittiming_const, ++ priv->bitrate_const, ++ priv->bitrate_const_cnt); ++ if (err) ++ return err; ++ ++ if (priv->bitrate_max && bt.bitrate > priv->bitrate_max) { ++ netdev_err(dev, "arbitration bitrate surpasses transceiver capabilities of %d bps\n", ++ priv->bitrate_max); ++ return -EINVAL; ++ } ++ ++ memcpy(&priv->bittiming, &bt, sizeof(bt)); ++ ++ if (priv->do_set_bittiming) { ++ /* Finally, set the bit-timing registers */ ++ err = priv->do_set_bittiming(dev); ++ if (err) ++ return err; ++ } ++ } ++ ++ if (data[IFLA_CAN_CTRLMODE]) { ++ struct can_ctrlmode *cm; ++ u32 ctrlstatic; ++ u32 maskedflags; ++ ++ /* Do not allow changing controller mode while running */ ++ if (dev->flags & IFF_UP) ++ return -EBUSY; ++ cm = nla_data(data[IFLA_CAN_CTRLMODE]); ++ ctrlstatic = priv->ctrlmode_static; ++ maskedflags = cm->flags & cm->mask; ++ ++ /* check whether provided bits are allowed to be passed */ ++ if (cm->mask & ~(priv->ctrlmode_supported | ctrlstatic)) ++ return -EOPNOTSUPP; ++ ++ /* do not check for static fd-non-iso if 'fd' is disabled */ ++ if (!(maskedflags & CAN_CTRLMODE_FD)) ++ ctrlstatic &= ~CAN_CTRLMODE_FD_NON_ISO; ++ ++ /* make sure static options are provided by configuration */ ++ if ((maskedflags & ctrlstatic) != ctrlstatic) ++ return -EOPNOTSUPP; ++ ++ /* clear bits to be modified and copy the flag values */ ++ priv->ctrlmode &= ~cm->mask; ++ priv->ctrlmode |= maskedflags; ++ ++ /* CAN_CTRLMODE_FD can only be set when driver supports FD */ ++ if (priv->ctrlmode & CAN_CTRLMODE_FD) ++ dev->mtu = CANFD_MTU; ++ else ++ dev->mtu = CAN_MTU; ++ } ++ ++ if (data[IFLA_CAN_RESTART_MS]) { ++ /* Do not allow changing restart delay while running */ ++ if (dev->flags & IFF_UP) ++ return -EBUSY; ++ priv->restart_ms = nla_get_u32(data[IFLA_CAN_RESTART_MS]); ++ } ++ ++ if (data[IFLA_CAN_RESTART]) { ++ /* Do not allow a restart while not running */ ++ if (!(dev->flags & IFF_UP)) ++ return -EINVAL; ++ err = can_restart_now(dev); ++ if (err) ++ return err; ++ } ++ ++ if (data[IFLA_CAN_DATA_BITTIMING]) { ++ struct can_bittiming dbt; ++ ++ /* Do not allow changing bittiming while running */ ++ if (dev->flags & IFF_UP) ++ return -EBUSY; ++ ++ /* Calculate bittiming parameters based on ++ * data_bittiming_const if set, otherwise pass bitrate ++ * directly via do_set_bitrate(). Bail out if neither ++ * is given. ++ */ ++ if (!priv->data_bittiming_const && !priv->do_set_data_bittiming) ++ return -EOPNOTSUPP; ++ ++ memcpy(&dbt, nla_data(data[IFLA_CAN_DATA_BITTIMING]), ++ sizeof(dbt)); ++ err = can_get_bittiming(dev, &dbt, ++ priv->data_bittiming_const, ++ priv->data_bitrate_const, ++ priv->data_bitrate_const_cnt); ++ if (err) ++ return err; ++ ++ if (priv->bitrate_max && dbt.bitrate > priv->bitrate_max) { ++ netdev_err(dev, "canfd data bitrate surpasses transceiver capabilities of %d bps\n", ++ priv->bitrate_max); ++ return -EINVAL; ++ } ++ ++ memcpy(&priv->data_bittiming, &dbt, sizeof(dbt)); ++ ++ if (priv->do_set_data_bittiming) { ++ /* Finally, set the bit-timing registers */ ++ err = priv->do_set_data_bittiming(dev); ++ if (err) ++ return err; ++ } ++ } ++ ++ if (data[IFLA_CAN_TERMINATION]) { ++ const u16 termval = nla_get_u16(data[IFLA_CAN_TERMINATION]); ++ const unsigned int num_term = priv->termination_const_cnt; ++ unsigned int i; ++ ++ if (!priv->do_set_termination) ++ return -EOPNOTSUPP; ++ ++ /* check whether given value is supported by the interface */ ++ for (i = 0; i < num_term; i++) { ++ if (termval == priv->termination_const[i]) ++ break; ++ } ++ if (i >= num_term) ++ return -EINVAL; ++ ++ /* Finally, set the termination value */ ++ err = priv->do_set_termination(dev, termval); ++ if (err) ++ return err; ++ ++ priv->termination = termval; ++ } ++ ++ return 0; ++} ++ ++static size_t can_get_size(const struct net_device *dev) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ size_t size = 0; ++ ++ if (priv->bittiming.bitrate) /* IFLA_CAN_BITTIMING */ ++ size += nla_total_size(sizeof(struct can_bittiming)); ++ if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */ ++ size += nla_total_size(sizeof(struct can_bittiming_const)); ++ size += nla_total_size(sizeof(struct can_clock)); /* IFLA_CAN_CLOCK */ ++ size += nla_total_size(sizeof(u32)); /* IFLA_CAN_STATE */ ++ size += nla_total_size(sizeof(struct can_ctrlmode)); /* IFLA_CAN_CTRLMODE */ ++ size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */ ++ if (priv->do_get_berr_counter) /* IFLA_CAN_BERR_COUNTER */ ++ size += nla_total_size(sizeof(struct can_berr_counter)); ++ if (priv->data_bittiming.bitrate) /* IFLA_CAN_DATA_BITTIMING */ ++ size += nla_total_size(sizeof(struct can_bittiming)); ++ if (priv->data_bittiming_const) /* IFLA_CAN_DATA_BITTIMING_CONST */ ++ size += nla_total_size(sizeof(struct can_bittiming_const)); ++ if (priv->termination_const) { ++ size += nla_total_size(sizeof(priv->termination)); /* IFLA_CAN_TERMINATION */ ++ size += nla_total_size(sizeof(*priv->termination_const) * /* IFLA_CAN_TERMINATION_CONST */ ++ priv->termination_const_cnt); ++ } ++ if (priv->bitrate_const) /* IFLA_CAN_BITRATE_CONST */ ++ size += nla_total_size(sizeof(*priv->bitrate_const) * ++ priv->bitrate_const_cnt); ++ if (priv->data_bitrate_const) /* IFLA_CAN_DATA_BITRATE_CONST */ ++ size += nla_total_size(sizeof(*priv->data_bitrate_const) * ++ priv->data_bitrate_const_cnt); ++ size += sizeof(priv->bitrate_max); /* IFLA_CAN_BITRATE_MAX */ ++ ++ return size; ++} ++ ++static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ struct can_ctrlmode cm = {.flags = priv->ctrlmode}; ++ struct can_berr_counter bec = { }; ++ enum can_state state = priv->state; ++ ++ if (priv->do_get_state) ++ priv->do_get_state(dev, &state); ++ ++ if ((priv->bittiming.bitrate && ++ nla_put(skb, IFLA_CAN_BITTIMING, ++ sizeof(priv->bittiming), &priv->bittiming)) || ++ ++ (priv->bittiming_const && ++ nla_put(skb, IFLA_CAN_BITTIMING_CONST, ++ sizeof(*priv->bittiming_const), priv->bittiming_const)) || ++ ++ nla_put(skb, IFLA_CAN_CLOCK, sizeof(priv->clock), &priv->clock) || ++ nla_put_u32(skb, IFLA_CAN_STATE, state) || ++ nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) || ++ nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) || ++ ++ (priv->do_get_berr_counter && ++ !priv->do_get_berr_counter(dev, &bec) && ++ nla_put(skb, IFLA_CAN_BERR_COUNTER, sizeof(bec), &bec)) || ++ ++ (priv->data_bittiming.bitrate && ++ nla_put(skb, IFLA_CAN_DATA_BITTIMING, ++ sizeof(priv->data_bittiming), &priv->data_bittiming)) || ++ ++ (priv->data_bittiming_const && ++ nla_put(skb, IFLA_CAN_DATA_BITTIMING_CONST, ++ sizeof(*priv->data_bittiming_const), ++ priv->data_bittiming_const)) || ++ ++ (priv->termination_const && ++ (nla_put_u16(skb, IFLA_CAN_TERMINATION, priv->termination) || ++ nla_put(skb, IFLA_CAN_TERMINATION_CONST, ++ sizeof(*priv->termination_const) * ++ priv->termination_const_cnt, ++ priv->termination_const))) || ++ ++ (priv->bitrate_const && ++ nla_put(skb, IFLA_CAN_BITRATE_CONST, ++ sizeof(*priv->bitrate_const) * ++ priv->bitrate_const_cnt, ++ priv->bitrate_const)) || ++ ++ (priv->data_bitrate_const && ++ nla_put(skb, IFLA_CAN_DATA_BITRATE_CONST, ++ sizeof(*priv->data_bitrate_const) * ++ priv->data_bitrate_const_cnt, ++ priv->data_bitrate_const)) || ++ ++ (nla_put(skb, IFLA_CAN_BITRATE_MAX, ++ sizeof(priv->bitrate_max), ++ &priv->bitrate_max)) ++ ) ++ ++ return -EMSGSIZE; ++ ++ return 0; ++} ++ ++static size_t can_get_xstats_size(const struct net_device *dev) ++{ ++ return sizeof(struct can_device_stats); ++} ++ ++static int can_fill_xstats(struct sk_buff *skb, const struct net_device *dev) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ ++ if (nla_put(skb, IFLA_INFO_XSTATS, ++ sizeof(priv->can_stats), &priv->can_stats)) ++ goto nla_put_failure; ++ return 0; ++ ++nla_put_failure: ++ return -EMSGSIZE; ++} ++ ++static int can_newlink(struct net *src_net, struct net_device *dev, ++ struct nlattr *tb[], struct nlattr *data[], ++ struct netlink_ext_ack *extack) ++{ ++ return -EOPNOTSUPP; ++} ++ ++static void can_dellink(struct net_device *dev, struct list_head *head) ++{ ++} ++ ++static struct rtnl_link_ops can_link_ops __read_mostly = { ++ .kind = "can", ++ .netns_refund = true, ++ .maxtype = IFLA_CAN_MAX, ++ .policy = can_policy, ++ .setup = can_setup, ++ .validate = can_validate, ++ .newlink = can_newlink, ++ .changelink = can_changelink, ++ .dellink = can_dellink, ++ .get_size = can_get_size, ++ .fill_info = can_fill_info, ++ .get_xstats_size = can_get_xstats_size, ++ .fill_xstats = can_fill_xstats, ++}; ++ ++/* Register the CAN network device */ ++int register_candev(struct net_device *dev) ++{ ++ struct can_priv *priv = netdev_priv(dev); ++ ++ /* Ensure termination_const, termination_const_cnt and ++ * do_set_termination consistency. All must be either set or ++ * unset. ++ */ ++ if ((!priv->termination_const != !priv->termination_const_cnt) || ++ (!priv->termination_const != !priv->do_set_termination)) ++ return -EINVAL; ++ ++ if (!priv->bitrate_const != !priv->bitrate_const_cnt) ++ return -EINVAL; ++ ++ if (!priv->data_bitrate_const != !priv->data_bitrate_const_cnt) ++ return -EINVAL; ++ ++ dev->rtnl_link_ops = &can_link_ops; ++ netif_carrier_off(dev); ++ ++ return register_netdev(dev); ++} ++EXPORT_SYMBOL_GPL(register_candev); ++ ++/* Unregister the CAN network device */ ++void unregister_candev(struct net_device *dev) ++{ ++ unregister_netdev(dev); ++} ++EXPORT_SYMBOL_GPL(unregister_candev); ++ ++/* Test if a network device is a candev based device ++ * and return the can_priv* if so. ++ */ ++struct can_priv *safe_candev_priv(struct net_device *dev) ++{ ++ if (dev->type != ARPHRD_CAN || dev->rtnl_link_ops != &can_link_ops) ++ return NULL; ++ ++ return netdev_priv(dev); ++} ++EXPORT_SYMBOL_GPL(safe_candev_priv); ++ ++static __init int can_dev_init(void) ++{ ++ int err; ++ ++ can_led_notifier_init(); ++ ++ err = rtnl_link_register(&can_link_ops); ++ if (!err) ++ pr_info(MOD_DESC "\n"); ++ ++ return err; ++} ++module_init(can_dev_init); ++ ++static __exit void can_dev_exit(void) ++{ ++ rtnl_link_unregister(&can_link_ops); ++ ++ can_led_notifier_exit(); ++} ++module_exit(can_dev_exit); ++ ++MODULE_ALIAS_RTNL_LINK("can"); +diff --git a/drivers/net/can/dev/rx-offload.c b/drivers/net/can/dev/rx-offload.c +new file mode 100644 +index 0000000000000..3c1912c0430b6 +--- /dev/null ++++ b/drivers/net/can/dev/rx-offload.c +@@ -0,0 +1,376 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* Copyright (c) 2014 Protonic Holland, ++ * David Jander ++ * Copyright (C) 2014-2017 Pengutronix, ++ * Marc Kleine-Budde ++ */ ++ ++#include ++#include ++ ++struct can_rx_offload_cb { ++ u32 timestamp; ++}; ++ ++static inline struct can_rx_offload_cb * ++can_rx_offload_get_cb(struct sk_buff *skb) ++{ ++ BUILD_BUG_ON(sizeof(struct can_rx_offload_cb) > sizeof(skb->cb)); ++ ++ return (struct can_rx_offload_cb *)skb->cb; ++} ++ ++static inline bool ++can_rx_offload_le(struct can_rx_offload *offload, ++ unsigned int a, unsigned int b) ++{ ++ if (offload->inc) ++ return a <= b; ++ else ++ return a >= b; ++} ++ ++static inline unsigned int ++can_rx_offload_inc(struct can_rx_offload *offload, unsigned int *val) ++{ ++ if (offload->inc) ++ return (*val)++; ++ else ++ return (*val)--; ++} ++ ++static int can_rx_offload_napi_poll(struct napi_struct *napi, int quota) ++{ ++ struct can_rx_offload *offload = container_of(napi, ++ struct can_rx_offload, ++ napi); ++ struct net_device *dev = offload->dev; ++ struct net_device_stats *stats = &dev->stats; ++ struct sk_buff *skb; ++ int work_done = 0; ++ ++ while ((work_done < quota) && ++ (skb = skb_dequeue(&offload->skb_queue))) { ++ struct can_frame *cf = (struct can_frame *)skb->data; ++ ++ work_done++; ++ stats->rx_packets++; ++ stats->rx_bytes += cf->len; ++ netif_receive_skb(skb); ++ } ++ ++ if (work_done < quota) { ++ napi_complete_done(napi, work_done); ++ ++ /* Check if there was another interrupt */ ++ if (!skb_queue_empty(&offload->skb_queue)) ++ napi_reschedule(&offload->napi); ++ } ++ ++ can_led_event(offload->dev, CAN_LED_EVENT_RX); ++ ++ return work_done; ++} ++ ++static inline void ++__skb_queue_add_sort(struct sk_buff_head *head, struct sk_buff *new, ++ int (*compare)(struct sk_buff *a, struct sk_buff *b)) ++{ ++ struct sk_buff *pos, *insert = NULL; ++ ++ skb_queue_reverse_walk(head, pos) { ++ const struct can_rx_offload_cb *cb_pos, *cb_new; ++ ++ cb_pos = can_rx_offload_get_cb(pos); ++ cb_new = can_rx_offload_get_cb(new); ++ ++ netdev_dbg(new->dev, ++ "%s: pos=0x%08x, new=0x%08x, diff=%10d, queue_len=%d\n", ++ __func__, ++ cb_pos->timestamp, cb_new->timestamp, ++ cb_new->timestamp - cb_pos->timestamp, ++ skb_queue_len(head)); ++ ++ if (compare(pos, new) < 0) ++ continue; ++ insert = pos; ++ break; ++ } ++ if (!insert) ++ __skb_queue_head(head, new); ++ else ++ __skb_queue_after(head, insert, new); ++} ++ ++static int can_rx_offload_compare(struct sk_buff *a, struct sk_buff *b) ++{ ++ const struct can_rx_offload_cb *cb_a, *cb_b; ++ ++ cb_a = can_rx_offload_get_cb(a); ++ cb_b = can_rx_offload_get_cb(b); ++ ++ /* Subtract two u32 and return result as int, to keep ++ * difference steady around the u32 overflow. ++ */ ++ return cb_b->timestamp - cb_a->timestamp; ++} ++ ++/** ++ * can_rx_offload_offload_one() - Read one CAN frame from HW ++ * @offload: pointer to rx_offload context ++ * @n: number of mailbox to read ++ * ++ * The task of this function is to read a CAN frame from mailbox @n ++ * from the device and return the mailbox's content as a struct ++ * sk_buff. ++ * ++ * If the struct can_rx_offload::skb_queue exceeds the maximal queue ++ * length (struct can_rx_offload::skb_queue_len_max) or no skb can be ++ * allocated, the mailbox contents is discarded by reading it into an ++ * overflow buffer. This way the mailbox is marked as free by the ++ * driver. ++ * ++ * Return: A pointer to skb containing the CAN frame on success. ++ * ++ * NULL if the mailbox @n is empty. ++ * ++ * ERR_PTR() in case of an error ++ */ ++static struct sk_buff * ++can_rx_offload_offload_one(struct can_rx_offload *offload, unsigned int n) ++{ ++ struct sk_buff *skb; ++ struct can_rx_offload_cb *cb; ++ bool drop = false; ++ u32 timestamp; ++ ++ /* If queue is full drop frame */ ++ if (unlikely(skb_queue_len(&offload->skb_queue) > ++ offload->skb_queue_len_max)) ++ drop = true; ++ ++ skb = offload->mailbox_read(offload, n, ×tamp, drop); ++ /* Mailbox was empty. */ ++ if (unlikely(!skb)) ++ return NULL; ++ ++ /* There was a problem reading the mailbox, propagate ++ * error value. ++ */ ++ if (IS_ERR(skb)) { ++ offload->dev->stats.rx_dropped++; ++ offload->dev->stats.rx_fifo_errors++; ++ ++ return skb; ++ } ++ ++ /* Mailbox was read. */ ++ cb = can_rx_offload_get_cb(skb); ++ cb->timestamp = timestamp; ++ ++ return skb; ++} ++ ++int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, ++ u64 pending) ++{ ++ struct sk_buff_head skb_queue; ++ unsigned int i; ++ ++ __skb_queue_head_init(&skb_queue); ++ ++ for (i = offload->mb_first; ++ can_rx_offload_le(offload, i, offload->mb_last); ++ can_rx_offload_inc(offload, &i)) { ++ struct sk_buff *skb; ++ ++ if (!(pending & BIT_ULL(i))) ++ continue; ++ ++ skb = can_rx_offload_offload_one(offload, i); ++ if (IS_ERR_OR_NULL(skb)) ++ continue; ++ ++ __skb_queue_add_sort(&skb_queue, skb, can_rx_offload_compare); ++ } ++ ++ if (!skb_queue_empty(&skb_queue)) { ++ unsigned long flags; ++ u32 queue_len; ++ ++ spin_lock_irqsave(&offload->skb_queue.lock, flags); ++ skb_queue_splice_tail(&skb_queue, &offload->skb_queue); ++ spin_unlock_irqrestore(&offload->skb_queue.lock, flags); ++ ++ queue_len = skb_queue_len(&offload->skb_queue); ++ if (queue_len > offload->skb_queue_len_max / 8) ++ netdev_dbg(offload->dev, "%s: queue_len=%d\n", ++ __func__, queue_len); ++ ++ can_rx_offload_schedule(offload); ++ } ++ ++ return skb_queue_len(&skb_queue); ++} ++EXPORT_SYMBOL_GPL(can_rx_offload_irq_offload_timestamp); ++ ++int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload) ++{ ++ struct sk_buff *skb; ++ int received = 0; ++ ++ while (1) { ++ skb = can_rx_offload_offload_one(offload, 0); ++ if (IS_ERR(skb)) ++ continue; ++ if (!skb) ++ break; ++ ++ skb_queue_tail(&offload->skb_queue, skb); ++ received++; ++ } ++ ++ if (received) ++ can_rx_offload_schedule(offload); ++ ++ return received; ++} ++EXPORT_SYMBOL_GPL(can_rx_offload_irq_offload_fifo); ++ ++int can_rx_offload_queue_sorted(struct can_rx_offload *offload, ++ struct sk_buff *skb, u32 timestamp) ++{ ++ struct can_rx_offload_cb *cb; ++ unsigned long flags; ++ ++ if (skb_queue_len(&offload->skb_queue) > ++ offload->skb_queue_len_max) { ++ dev_kfree_skb_any(skb); ++ return -ENOBUFS; ++ } ++ ++ cb = can_rx_offload_get_cb(skb); ++ cb->timestamp = timestamp; ++ ++ spin_lock_irqsave(&offload->skb_queue.lock, flags); ++ __skb_queue_add_sort(&offload->skb_queue, skb, can_rx_offload_compare); ++ spin_unlock_irqrestore(&offload->skb_queue.lock, flags); ++ ++ can_rx_offload_schedule(offload); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(can_rx_offload_queue_sorted); ++ ++unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload, ++ unsigned int idx, u32 timestamp) ++{ ++ struct net_device *dev = offload->dev; ++ struct net_device_stats *stats = &dev->stats; ++ struct sk_buff *skb; ++ u8 len; ++ int err; ++ ++ skb = __can_get_echo_skb(dev, idx, &len); ++ if (!skb) ++ return 0; ++ ++ err = can_rx_offload_queue_sorted(offload, skb, timestamp); ++ if (err) { ++ stats->rx_errors++; ++ stats->tx_fifo_errors++; ++ } ++ ++ return len; ++} ++EXPORT_SYMBOL_GPL(can_rx_offload_get_echo_skb); ++ ++int can_rx_offload_queue_tail(struct can_rx_offload *offload, ++ struct sk_buff *skb) ++{ ++ if (skb_queue_len(&offload->skb_queue) > ++ offload->skb_queue_len_max) { ++ dev_kfree_skb_any(skb); ++ return -ENOBUFS; ++ } ++ ++ skb_queue_tail(&offload->skb_queue, skb); ++ can_rx_offload_schedule(offload); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(can_rx_offload_queue_tail); ++ ++static int can_rx_offload_init_queue(struct net_device *dev, ++ struct can_rx_offload *offload, ++ unsigned int weight) ++{ ++ offload->dev = dev; ++ ++ /* Limit queue len to 4x the weight (rounted to next power of two) */ ++ offload->skb_queue_len_max = 2 << fls(weight); ++ offload->skb_queue_len_max *= 4; ++ skb_queue_head_init(&offload->skb_queue); ++ ++ netif_napi_add(dev, &offload->napi, can_rx_offload_napi_poll, weight); ++ ++ dev_dbg(dev->dev.parent, "%s: skb_queue_len_max=%d\n", ++ __func__, offload->skb_queue_len_max); ++ ++ return 0; ++} ++ ++int can_rx_offload_add_timestamp(struct net_device *dev, ++ struct can_rx_offload *offload) ++{ ++ unsigned int weight; ++ ++ if (offload->mb_first > BITS_PER_LONG_LONG || ++ offload->mb_last > BITS_PER_LONG_LONG || !offload->mailbox_read) ++ return -EINVAL; ++ ++ if (offload->mb_first < offload->mb_last) { ++ offload->inc = true; ++ weight = offload->mb_last - offload->mb_first; ++ } else { ++ offload->inc = false; ++ weight = offload->mb_first - offload->mb_last; ++ } ++ ++ return can_rx_offload_init_queue(dev, offload, weight); ++} ++EXPORT_SYMBOL_GPL(can_rx_offload_add_timestamp); ++ ++int can_rx_offload_add_fifo(struct net_device *dev, ++ struct can_rx_offload *offload, unsigned int weight) ++{ ++ if (!offload->mailbox_read) ++ return -EINVAL; ++ ++ return can_rx_offload_init_queue(dev, offload, weight); ++} ++EXPORT_SYMBOL_GPL(can_rx_offload_add_fifo); ++ ++int can_rx_offload_add_manual(struct net_device *dev, ++ struct can_rx_offload *offload, ++ unsigned int weight) ++{ ++ if (offload->mailbox_read) ++ return -EINVAL; ++ ++ return can_rx_offload_init_queue(dev, offload, weight); ++} ++EXPORT_SYMBOL_GPL(can_rx_offload_add_manual); ++ ++void can_rx_offload_enable(struct can_rx_offload *offload) ++{ ++ napi_enable(&offload->napi); ++} ++EXPORT_SYMBOL_GPL(can_rx_offload_enable); ++ ++void can_rx_offload_del(struct can_rx_offload *offload) ++{ ++ netif_napi_del(&offload->napi); ++ skb_queue_purge(&offload->skb_queue); ++} ++EXPORT_SYMBOL_GPL(can_rx_offload_del); +diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c +index 4920de09ffb79..aeac3ce7bfc8f 100644 +--- a/drivers/net/can/m_can/tcan4x5x.c ++++ b/drivers/net/can/m_can/tcan4x5x.c +@@ -88,7 +88,7 @@ + + #define TCAN4X5X_MRAM_START 0x8000 + #define TCAN4X5X_MCAN_OFFSET 0x1000 +-#define TCAN4X5X_MAX_REGISTER 0x8fff ++#define TCAN4X5X_MAX_REGISTER 0x8ffc + + #define TCAN4X5X_CLEAR_ALL_INT 0xffffffff + #define TCAN4X5X_SET_ALL_INT 0xffffffff +diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c +deleted file mode 100644 +index 3c1912c0430b6..0000000000000 +--- a/drivers/net/can/rx-offload.c ++++ /dev/null +@@ -1,376 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0-only +-/* Copyright (c) 2014 Protonic Holland, +- * David Jander +- * Copyright (C) 2014-2017 Pengutronix, +- * Marc Kleine-Budde +- */ +- +-#include +-#include +- +-struct can_rx_offload_cb { +- u32 timestamp; +-}; +- +-static inline struct can_rx_offload_cb * +-can_rx_offload_get_cb(struct sk_buff *skb) +-{ +- BUILD_BUG_ON(sizeof(struct can_rx_offload_cb) > sizeof(skb->cb)); +- +- return (struct can_rx_offload_cb *)skb->cb; +-} +- +-static inline bool +-can_rx_offload_le(struct can_rx_offload *offload, +- unsigned int a, unsigned int b) +-{ +- if (offload->inc) +- return a <= b; +- else +- return a >= b; +-} +- +-static inline unsigned int +-can_rx_offload_inc(struct can_rx_offload *offload, unsigned int *val) +-{ +- if (offload->inc) +- return (*val)++; +- else +- return (*val)--; +-} +- +-static int can_rx_offload_napi_poll(struct napi_struct *napi, int quota) +-{ +- struct can_rx_offload *offload = container_of(napi, +- struct can_rx_offload, +- napi); +- struct net_device *dev = offload->dev; +- struct net_device_stats *stats = &dev->stats; +- struct sk_buff *skb; +- int work_done = 0; +- +- while ((work_done < quota) && +- (skb = skb_dequeue(&offload->skb_queue))) { +- struct can_frame *cf = (struct can_frame *)skb->data; +- +- work_done++; +- stats->rx_packets++; +- stats->rx_bytes += cf->len; +- netif_receive_skb(skb); +- } +- +- if (work_done < quota) { +- napi_complete_done(napi, work_done); +- +- /* Check if there was another interrupt */ +- if (!skb_queue_empty(&offload->skb_queue)) +- napi_reschedule(&offload->napi); +- } +- +- can_led_event(offload->dev, CAN_LED_EVENT_RX); +- +- return work_done; +-} +- +-static inline void +-__skb_queue_add_sort(struct sk_buff_head *head, struct sk_buff *new, +- int (*compare)(struct sk_buff *a, struct sk_buff *b)) +-{ +- struct sk_buff *pos, *insert = NULL; +- +- skb_queue_reverse_walk(head, pos) { +- const struct can_rx_offload_cb *cb_pos, *cb_new; +- +- cb_pos = can_rx_offload_get_cb(pos); +- cb_new = can_rx_offload_get_cb(new); +- +- netdev_dbg(new->dev, +- "%s: pos=0x%08x, new=0x%08x, diff=%10d, queue_len=%d\n", +- __func__, +- cb_pos->timestamp, cb_new->timestamp, +- cb_new->timestamp - cb_pos->timestamp, +- skb_queue_len(head)); +- +- if (compare(pos, new) < 0) +- continue; +- insert = pos; +- break; +- } +- if (!insert) +- __skb_queue_head(head, new); +- else +- __skb_queue_after(head, insert, new); +-} +- +-static int can_rx_offload_compare(struct sk_buff *a, struct sk_buff *b) +-{ +- const struct can_rx_offload_cb *cb_a, *cb_b; +- +- cb_a = can_rx_offload_get_cb(a); +- cb_b = can_rx_offload_get_cb(b); +- +- /* Subtract two u32 and return result as int, to keep +- * difference steady around the u32 overflow. +- */ +- return cb_b->timestamp - cb_a->timestamp; +-} +- +-/** +- * can_rx_offload_offload_one() - Read one CAN frame from HW +- * @offload: pointer to rx_offload context +- * @n: number of mailbox to read +- * +- * The task of this function is to read a CAN frame from mailbox @n +- * from the device and return the mailbox's content as a struct +- * sk_buff. +- * +- * If the struct can_rx_offload::skb_queue exceeds the maximal queue +- * length (struct can_rx_offload::skb_queue_len_max) or no skb can be +- * allocated, the mailbox contents is discarded by reading it into an +- * overflow buffer. This way the mailbox is marked as free by the +- * driver. +- * +- * Return: A pointer to skb containing the CAN frame on success. +- * +- * NULL if the mailbox @n is empty. +- * +- * ERR_PTR() in case of an error +- */ +-static struct sk_buff * +-can_rx_offload_offload_one(struct can_rx_offload *offload, unsigned int n) +-{ +- struct sk_buff *skb; +- struct can_rx_offload_cb *cb; +- bool drop = false; +- u32 timestamp; +- +- /* If queue is full drop frame */ +- if (unlikely(skb_queue_len(&offload->skb_queue) > +- offload->skb_queue_len_max)) +- drop = true; +- +- skb = offload->mailbox_read(offload, n, ×tamp, drop); +- /* Mailbox was empty. */ +- if (unlikely(!skb)) +- return NULL; +- +- /* There was a problem reading the mailbox, propagate +- * error value. +- */ +- if (IS_ERR(skb)) { +- offload->dev->stats.rx_dropped++; +- offload->dev->stats.rx_fifo_errors++; +- +- return skb; +- } +- +- /* Mailbox was read. */ +- cb = can_rx_offload_get_cb(skb); +- cb->timestamp = timestamp; +- +- return skb; +-} +- +-int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, +- u64 pending) +-{ +- struct sk_buff_head skb_queue; +- unsigned int i; +- +- __skb_queue_head_init(&skb_queue); +- +- for (i = offload->mb_first; +- can_rx_offload_le(offload, i, offload->mb_last); +- can_rx_offload_inc(offload, &i)) { +- struct sk_buff *skb; +- +- if (!(pending & BIT_ULL(i))) +- continue; +- +- skb = can_rx_offload_offload_one(offload, i); +- if (IS_ERR_OR_NULL(skb)) +- continue; +- +- __skb_queue_add_sort(&skb_queue, skb, can_rx_offload_compare); +- } +- +- if (!skb_queue_empty(&skb_queue)) { +- unsigned long flags; +- u32 queue_len; +- +- spin_lock_irqsave(&offload->skb_queue.lock, flags); +- skb_queue_splice_tail(&skb_queue, &offload->skb_queue); +- spin_unlock_irqrestore(&offload->skb_queue.lock, flags); +- +- queue_len = skb_queue_len(&offload->skb_queue); +- if (queue_len > offload->skb_queue_len_max / 8) +- netdev_dbg(offload->dev, "%s: queue_len=%d\n", +- __func__, queue_len); +- +- can_rx_offload_schedule(offload); +- } +- +- return skb_queue_len(&skb_queue); +-} +-EXPORT_SYMBOL_GPL(can_rx_offload_irq_offload_timestamp); +- +-int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload) +-{ +- struct sk_buff *skb; +- int received = 0; +- +- while (1) { +- skb = can_rx_offload_offload_one(offload, 0); +- if (IS_ERR(skb)) +- continue; +- if (!skb) +- break; +- +- skb_queue_tail(&offload->skb_queue, skb); +- received++; +- } +- +- if (received) +- can_rx_offload_schedule(offload); +- +- return received; +-} +-EXPORT_SYMBOL_GPL(can_rx_offload_irq_offload_fifo); +- +-int can_rx_offload_queue_sorted(struct can_rx_offload *offload, +- struct sk_buff *skb, u32 timestamp) +-{ +- struct can_rx_offload_cb *cb; +- unsigned long flags; +- +- if (skb_queue_len(&offload->skb_queue) > +- offload->skb_queue_len_max) { +- dev_kfree_skb_any(skb); +- return -ENOBUFS; +- } +- +- cb = can_rx_offload_get_cb(skb); +- cb->timestamp = timestamp; +- +- spin_lock_irqsave(&offload->skb_queue.lock, flags); +- __skb_queue_add_sort(&offload->skb_queue, skb, can_rx_offload_compare); +- spin_unlock_irqrestore(&offload->skb_queue.lock, flags); +- +- can_rx_offload_schedule(offload); +- +- return 0; +-} +-EXPORT_SYMBOL_GPL(can_rx_offload_queue_sorted); +- +-unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload, +- unsigned int idx, u32 timestamp) +-{ +- struct net_device *dev = offload->dev; +- struct net_device_stats *stats = &dev->stats; +- struct sk_buff *skb; +- u8 len; +- int err; +- +- skb = __can_get_echo_skb(dev, idx, &len); +- if (!skb) +- return 0; +- +- err = can_rx_offload_queue_sorted(offload, skb, timestamp); +- if (err) { +- stats->rx_errors++; +- stats->tx_fifo_errors++; +- } +- +- return len; +-} +-EXPORT_SYMBOL_GPL(can_rx_offload_get_echo_skb); +- +-int can_rx_offload_queue_tail(struct can_rx_offload *offload, +- struct sk_buff *skb) +-{ +- if (skb_queue_len(&offload->skb_queue) > +- offload->skb_queue_len_max) { +- dev_kfree_skb_any(skb); +- return -ENOBUFS; +- } +- +- skb_queue_tail(&offload->skb_queue, skb); +- can_rx_offload_schedule(offload); +- +- return 0; +-} +-EXPORT_SYMBOL_GPL(can_rx_offload_queue_tail); +- +-static int can_rx_offload_init_queue(struct net_device *dev, +- struct can_rx_offload *offload, +- unsigned int weight) +-{ +- offload->dev = dev; +- +- /* Limit queue len to 4x the weight (rounted to next power of two) */ +- offload->skb_queue_len_max = 2 << fls(weight); +- offload->skb_queue_len_max *= 4; +- skb_queue_head_init(&offload->skb_queue); +- +- netif_napi_add(dev, &offload->napi, can_rx_offload_napi_poll, weight); +- +- dev_dbg(dev->dev.parent, "%s: skb_queue_len_max=%d\n", +- __func__, offload->skb_queue_len_max); +- +- return 0; +-} +- +-int can_rx_offload_add_timestamp(struct net_device *dev, +- struct can_rx_offload *offload) +-{ +- unsigned int weight; +- +- if (offload->mb_first > BITS_PER_LONG_LONG || +- offload->mb_last > BITS_PER_LONG_LONG || !offload->mailbox_read) +- return -EINVAL; +- +- if (offload->mb_first < offload->mb_last) { +- offload->inc = true; +- weight = offload->mb_last - offload->mb_first; +- } else { +- offload->inc = false; +- weight = offload->mb_first - offload->mb_last; +- } +- +- return can_rx_offload_init_queue(dev, offload, weight); +-} +-EXPORT_SYMBOL_GPL(can_rx_offload_add_timestamp); +- +-int can_rx_offload_add_fifo(struct net_device *dev, +- struct can_rx_offload *offload, unsigned int weight) +-{ +- if (!offload->mailbox_read) +- return -EINVAL; +- +- return can_rx_offload_init_queue(dev, offload, weight); +-} +-EXPORT_SYMBOL_GPL(can_rx_offload_add_fifo); +- +-int can_rx_offload_add_manual(struct net_device *dev, +- struct can_rx_offload *offload, +- unsigned int weight) +-{ +- if (offload->mailbox_read) +- return -EINVAL; +- +- return can_rx_offload_init_queue(dev, offload, weight); +-} +-EXPORT_SYMBOL_GPL(can_rx_offload_add_manual); +- +-void can_rx_offload_enable(struct can_rx_offload *offload) +-{ +- napi_enable(&offload->napi); +-} +-EXPORT_SYMBOL_GPL(can_rx_offload_enable); +- +-void can_rx_offload_del(struct can_rx_offload *offload) +-{ +- netif_napi_del(&offload->napi); +- skb_queue_purge(&offload->skb_queue); +-} +-EXPORT_SYMBOL_GPL(can_rx_offload_del); +diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c +index a1bd1be09548d..30c8d53c9745d 100644 +--- a/drivers/net/can/slcan.c ++++ b/drivers/net/can/slcan.c +@@ -516,6 +516,7 @@ static struct slcan *slc_alloc(void) + int i; + char name[IFNAMSIZ]; + struct net_device *dev = NULL; ++ struct can_ml_priv *can_ml; + struct slcan *sl; + int size; + +@@ -538,7 +539,8 @@ static struct slcan *slc_alloc(void) + + dev->base_addr = i; + sl = netdev_priv(dev); +- dev->ml_priv = (void *)sl + ALIGN(sizeof(*sl), NETDEV_ALIGN); ++ can_ml = (void *)sl + ALIGN(sizeof(*sl), NETDEV_ALIGN); ++ can_set_ml_priv(dev, can_ml); + + /* Initialize channel control data */ + sl->magic = SLCAN_MAGIC; +diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c +index 39ca14b0585dc..067705e2850b3 100644 +--- a/drivers/net/can/vcan.c ++++ b/drivers/net/can/vcan.c +@@ -153,7 +153,7 @@ static void vcan_setup(struct net_device *dev) + dev->addr_len = 0; + dev->tx_queue_len = 0; + dev->flags = IFF_NOARP; +- dev->ml_priv = netdev_priv(dev); ++ can_set_ml_priv(dev, netdev_priv(dev)); + + /* set flags according to driver capabilities */ + if (echo) +diff --git a/drivers/net/can/vxcan.c b/drivers/net/can/vxcan.c +index f9a524c5f6d62..8861a7d875e7e 100644 +--- a/drivers/net/can/vxcan.c ++++ b/drivers/net/can/vxcan.c +@@ -141,6 +141,8 @@ static const struct net_device_ops vxcan_netdev_ops = { + + static void vxcan_setup(struct net_device *dev) + { ++ struct can_ml_priv *can_ml; ++ + dev->type = ARPHRD_CAN; + dev->mtu = CANFD_MTU; + dev->hard_header_len = 0; +@@ -149,7 +151,9 @@ static void vxcan_setup(struct net_device *dev) + dev->flags = (IFF_NOARP|IFF_ECHO); + dev->netdev_ops = &vxcan_netdev_ops; + dev->needs_free_netdev = true; +- dev->ml_priv = netdev_priv(dev) + ALIGN(sizeof(struct vxcan_priv), NETDEV_ALIGN); ++ ++ can_ml = netdev_priv(dev) + ALIGN(sizeof(struct vxcan_priv), NETDEV_ALIGN); ++ can_set_ml_priv(dev, can_ml); + } + + /* forward declaration for rtnl_create_link() */ +diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c +index 8f70a3909929a..4af0cd9530de6 100644 +--- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c ++++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c +@@ -71,8 +71,10 @@ static int aq_ndev_open(struct net_device *ndev) + goto err_exit; + + err = aq_nic_start(aq_nic); +- if (err < 0) ++ if (err < 0) { ++ aq_nic_stop(aq_nic); + goto err_exit; ++ } + + err_exit: + if (err < 0) +diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +index 358119d983582..e6f9b5345b70b 100644 +--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c ++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +@@ -1153,7 +1153,7 @@ static void mvpp2_interrupts_unmask(void *arg) + u32 val; + + /* If the thread isn't used, don't do anything */ +- if (smp_processor_id() > port->priv->nthreads) ++ if (smp_processor_id() >= port->priv->nthreads) + return; + + val = MVPP2_CAUSE_MISC_SUM_MASK | +@@ -2287,7 +2287,7 @@ static void mvpp2_txq_sent_counter_clear(void *arg) + int queue; + + /* If the thread isn't used, don't do anything */ +- if (smp_processor_id() > port->priv->nthreads) ++ if (smp_processor_id() >= port->priv->nthreads) + return; + + for (queue = 0; queue < port->ntxqs; queue++) { +diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c +index b77f5fef7aeca..febfac75dd6a1 100644 +--- a/drivers/net/ipa/gsi.c ++++ b/drivers/net/ipa/gsi.c +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 + + /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +- * Copyright (C) 2018-2020 Linaro Ltd. ++ * Copyright (C) 2018-2021 Linaro Ltd. + */ + + #include +@@ -195,8 +195,6 @@ static void gsi_irq_type_disable(struct gsi *gsi, enum gsi_irq_type_id type_id) + /* Turn off all GSI interrupts initially */ + static void gsi_irq_setup(struct gsi *gsi) + { +- u32 adjust; +- + /* Disable all interrupt types */ + gsi_irq_type_update(gsi, 0); + +@@ -206,10 +204,9 @@ static void gsi_irq_setup(struct gsi *gsi) + iowrite32(0, gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET); + iowrite32(0, gsi->virt + GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET); + +- /* Reverse the offset adjustment for inter-EE register offsets */ +- adjust = gsi->version < IPA_VERSION_4_5 ? 0 : GSI_EE_REG_ADJUST; +- iowrite32(0, gsi->virt + adjust + GSI_INTER_EE_SRC_CH_IRQ_OFFSET); +- iowrite32(0, gsi->virt + adjust + GSI_INTER_EE_SRC_EV_CH_IRQ_OFFSET); ++ /* The inter-EE registers are in the non-adjusted address range */ ++ iowrite32(0, gsi->virt_raw + GSI_INTER_EE_SRC_CH_IRQ_OFFSET); ++ iowrite32(0, gsi->virt_raw + GSI_INTER_EE_SRC_EV_CH_IRQ_OFFSET); + + iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET); + } +@@ -2115,9 +2112,8 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, + gsi->dev = dev; + gsi->version = version; + +- /* The GSI layer performs NAPI on all endpoints. NAPI requires a +- * network device structure, but the GSI layer does not have one, +- * so we must create a dummy network device for this purpose. ++ /* GSI uses NAPI on all channels. Create a dummy network device ++ * for the channel NAPI contexts to be associated with. + */ + init_dummy_netdev(&gsi->dummy_dev); + +@@ -2142,13 +2138,13 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, + return -EINVAL; + } + +- gsi->virt = ioremap(res->start, size); +- if (!gsi->virt) { ++ gsi->virt_raw = ioremap(res->start, size); ++ if (!gsi->virt_raw) { + dev_err(dev, "unable to remap \"gsi\" memory\n"); + return -ENOMEM; + } +- /* Adjust register range pointer downward for newer IPA versions */ +- gsi->virt -= adjust; ++ /* Most registers are accessed using an adjusted register range */ ++ gsi->virt = gsi->virt_raw - adjust; + + init_completion(&gsi->completion); + +@@ -2167,7 +2163,7 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, + err_irq_exit: + gsi_irq_exit(gsi); + err_iounmap: +- iounmap(gsi->virt); ++ iounmap(gsi->virt_raw); + + return ret; + } +@@ -2178,7 +2174,7 @@ void gsi_exit(struct gsi *gsi) + mutex_destroy(&gsi->mutex); + gsi_channel_exit(gsi); + gsi_irq_exit(gsi); +- iounmap(gsi->virt); ++ iounmap(gsi->virt_raw); + } + + /* The maximum number of outstanding TREs on a channel. This limits +diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h +index 96c9aed397aad..696c9825834ab 100644 +--- a/drivers/net/ipa/gsi.h ++++ b/drivers/net/ipa/gsi.h +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: GPL-2.0 */ + + /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +- * Copyright (C) 2018-2020 Linaro Ltd. ++ * Copyright (C) 2018-2021 Linaro Ltd. + */ + #ifndef _GSI_H_ + #define _GSI_H_ +@@ -150,7 +150,8 @@ struct gsi { + struct device *dev; /* Same as IPA device */ + enum ipa_version version; + struct net_device dummy_dev; /* needed for NAPI */ +- void __iomem *virt; ++ void __iomem *virt_raw; /* I/O mapped address range */ ++ void __iomem *virt; /* Adjusted for most registers */ + u32 irq; + u32 channel_count; + u32 evt_ring_count; +diff --git a/drivers/net/ipa/gsi_reg.h b/drivers/net/ipa/gsi_reg.h +index 0e138bbd82053..1622d8cf8dea4 100644 +--- a/drivers/net/ipa/gsi_reg.h ++++ b/drivers/net/ipa/gsi_reg.h +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: GPL-2.0 */ + + /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +- * Copyright (C) 2018-2020 Linaro Ltd. ++ * Copyright (C) 2018-2021 Linaro Ltd. + */ + #ifndef _GSI_REG_H_ + #define _GSI_REG_H_ +@@ -38,17 +38,21 @@ + * (though the actual limit is hardware-dependent). + */ + +-/* GSI EE registers as a group are shifted downward by a fixed +- * constant amount for IPA versions 4.5 and beyond. This applies +- * to all GSI registers we use *except* the ones that disable +- * inter-EE interrupts for channels and event channels. ++/* GSI EE registers as a group are shifted downward by a fixed constant amount ++ * for IPA versions 4.5 and beyond. This applies to all GSI registers we use ++ * *except* the ones that disable inter-EE interrupts for channels and event ++ * channels. + * +- * We handle this by adjusting the pointer to the mapped GSI memory +- * region downward. Then in the one place we use them (gsi_irq_setup()) +- * we undo that adjustment for the inter-EE interrupt registers. ++ * The "raw" (not adjusted) GSI register range is mapped, and a pointer to ++ * the mapped range is held in gsi->virt_raw. The inter-EE interrupt ++ * registers are accessed using that pointer. ++ * ++ * Most registers are accessed using gsi->virt, which is a copy of the "raw" ++ * pointer, adjusted downward by the fixed amount. + */ + #define GSI_EE_REG_ADJUST 0x0000d000 /* IPA v4.5+ */ + ++/* The two inter-EE IRQ register offsets are relative to gsi->virt_raw */ + #define GSI_INTER_EE_SRC_CH_IRQ_OFFSET \ + GSI_INTER_EE_N_SRC_CH_IRQ_OFFSET(GSI_EE_AP) + #define GSI_INTER_EE_N_SRC_CH_IRQ_OFFSET(ee) \ +@@ -59,16 +63,7 @@ + #define GSI_INTER_EE_N_SRC_EV_CH_IRQ_OFFSET(ee) \ + (0x0000c01c + 0x1000 * (ee)) + +-#define GSI_INTER_EE_SRC_CH_IRQ_CLR_OFFSET \ +- GSI_INTER_EE_N_SRC_CH_IRQ_CLR_OFFSET(GSI_EE_AP) +-#define GSI_INTER_EE_N_SRC_CH_IRQ_CLR_OFFSET(ee) \ +- (0x0000c028 + 0x1000 * (ee)) +- +-#define GSI_INTER_EE_SRC_EV_CH_IRQ_CLR_OFFSET \ +- GSI_INTER_EE_N_SRC_EV_CH_IRQ_CLR_OFFSET(GSI_EE_AP) +-#define GSI_INTER_EE_N_SRC_EV_CH_IRQ_CLR_OFFSET(ee) \ +- (0x0000c02c + 0x1000 * (ee)) +- ++/* All other register offsets are relative to gsi->virt */ + #define GSI_CH_C_CNTXT_0_OFFSET(ch) \ + GSI_EE_N_CH_C_CNTXT_0_OFFSET((ch), GSI_EE_AP) + #define GSI_EE_N_CH_C_CNTXT_0_OFFSET(ch, ee) \ +diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c +index 002e514485100..eb65a11e33eaf 100644 +--- a/drivers/net/ipa/ipa_cmd.c ++++ b/drivers/net/ipa/ipa_cmd.c +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 + + /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. +- * Copyright (C) 2019-2020 Linaro Ltd. ++ * Copyright (C) 2019-2021 Linaro Ltd. + */ + + #include +@@ -244,11 +244,15 @@ static bool ipa_cmd_register_write_offset_valid(struct ipa *ipa, + if (ipa->version != IPA_VERSION_3_5_1) + bit_count += hweight32(REGISTER_WRITE_FLAGS_OFFSET_HIGH_FMASK); + BUILD_BUG_ON(bit_count > 32); +- offset_max = ~0 >> (32 - bit_count); ++ offset_max = ~0U >> (32 - bit_count); + ++ /* Make sure the offset can be represented by the field(s) ++ * that holds it. Also make sure the offset is not outside ++ * the overall IPA memory range. ++ */ + if (offset > offset_max || ipa->mem_offset > offset_max - offset) { + dev_err(dev, "%s offset too large 0x%04x + 0x%04x > 0x%04x)\n", +- ipa->mem_offset + offset, offset_max); ++ name, ipa->mem_offset, offset, offset_max); + return false; + } + +@@ -261,12 +265,24 @@ static bool ipa_cmd_register_write_valid(struct ipa *ipa) + const char *name; + u32 offset; + +- offset = ipa_reg_filt_rout_hash_flush_offset(ipa->version); +- name = "filter/route hash flush"; +- if (!ipa_cmd_register_write_offset_valid(ipa, name, offset)) +- return false; ++ /* If hashed tables are supported, ensure the hash flush register ++ * offset will fit in a register write IPA immediate command. ++ */ ++ if (ipa->version != IPA_VERSION_4_2) { ++ offset = ipa_reg_filt_rout_hash_flush_offset(ipa->version); ++ name = "filter/route hash flush"; ++ if (!ipa_cmd_register_write_offset_valid(ipa, name, offset)) ++ return false; ++ } + +- offset = IPA_REG_ENDP_STATUS_N_OFFSET(IPA_ENDPOINT_COUNT); ++ /* Each endpoint can have a status endpoint associated with it, ++ * and this is recorded in an endpoint register. If the modem ++ * crashes, we reset the status endpoint for all modem endpoints ++ * using a register write IPA immediate command. Make sure the ++ * worst case (highest endpoint number) offset of that endpoint ++ * fits in the register write command field(s) that must hold it. ++ */ ++ offset = IPA_REG_ENDP_STATUS_N_OFFSET(IPA_ENDPOINT_COUNT - 1); + name = "maximal endpoint status"; + if (!ipa_cmd_register_write_offset_valid(ipa, name, offset)) + return false; +diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c +index 816af1f55e2cd..dbeb29fa16e81 100644 +--- a/drivers/net/netdevsim/dev.c ++++ b/drivers/net/netdevsim/dev.c +@@ -1012,23 +1012,25 @@ static int nsim_dev_reload_create(struct nsim_dev *nsim_dev, + nsim_dev->fw_update_status = true; + nsim_dev->fw_update_overwrite_mask = 0; + +- nsim_dev->fib_data = nsim_fib_create(devlink, extack); +- if (IS_ERR(nsim_dev->fib_data)) +- return PTR_ERR(nsim_dev->fib_data); +- + nsim_devlink_param_load_driverinit_values(devlink); + + err = nsim_dev_dummy_region_init(nsim_dev, devlink); + if (err) +- goto err_fib_destroy; ++ return err; + + err = nsim_dev_traps_init(devlink); + if (err) + goto err_dummy_region_exit; + ++ nsim_dev->fib_data = nsim_fib_create(devlink, extack); ++ if (IS_ERR(nsim_dev->fib_data)) { ++ err = PTR_ERR(nsim_dev->fib_data); ++ goto err_traps_exit; ++ } ++ + err = nsim_dev_health_init(nsim_dev, devlink); + if (err) +- goto err_traps_exit; ++ goto err_fib_destroy; + + err = nsim_dev_port_add_all(nsim_dev, nsim_bus_dev->port_count); + if (err) +@@ -1043,12 +1045,12 @@ static int nsim_dev_reload_create(struct nsim_dev *nsim_dev, + + err_health_exit: + nsim_dev_health_exit(nsim_dev); ++err_fib_destroy: ++ nsim_fib_destroy(devlink, nsim_dev->fib_data); + err_traps_exit: + nsim_dev_traps_exit(devlink); + err_dummy_region_exit: + nsim_dev_dummy_region_exit(nsim_dev); +-err_fib_destroy: +- nsim_fib_destroy(devlink, nsim_dev->fib_data); + return err; + } + +@@ -1080,15 +1082,9 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev) + if (err) + goto err_devlink_free; + +- nsim_dev->fib_data = nsim_fib_create(devlink, NULL); +- if (IS_ERR(nsim_dev->fib_data)) { +- err = PTR_ERR(nsim_dev->fib_data); +- goto err_resources_unregister; +- } +- + err = devlink_register(devlink, &nsim_bus_dev->dev); + if (err) +- goto err_fib_destroy; ++ goto err_resources_unregister; + + err = devlink_params_register(devlink, nsim_devlink_params, + ARRAY_SIZE(nsim_devlink_params)); +@@ -1108,9 +1104,15 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev) + if (err) + goto err_traps_exit; + ++ nsim_dev->fib_data = nsim_fib_create(devlink, NULL); ++ if (IS_ERR(nsim_dev->fib_data)) { ++ err = PTR_ERR(nsim_dev->fib_data); ++ goto err_debugfs_exit; ++ } ++ + err = nsim_dev_health_init(nsim_dev, devlink); + if (err) +- goto err_debugfs_exit; ++ goto err_fib_destroy; + + err = nsim_bpf_dev_init(nsim_dev); + if (err) +@@ -1128,6 +1130,8 @@ err_bpf_dev_exit: + nsim_bpf_dev_exit(nsim_dev); + err_health_exit: + nsim_dev_health_exit(nsim_dev); ++err_fib_destroy: ++ nsim_fib_destroy(devlink, nsim_dev->fib_data); + err_debugfs_exit: + nsim_dev_debugfs_exit(nsim_dev); + err_traps_exit: +@@ -1139,8 +1143,6 @@ err_params_unregister: + ARRAY_SIZE(nsim_devlink_params)); + err_dl_unregister: + devlink_unregister(devlink); +-err_fib_destroy: +- nsim_fib_destroy(devlink, nsim_dev->fib_data); + err_resources_unregister: + devlink_resources_unregister(devlink, NULL); + err_devlink_free: +@@ -1157,10 +1159,10 @@ static void nsim_dev_reload_destroy(struct nsim_dev *nsim_dev) + debugfs_remove(nsim_dev->take_snapshot); + nsim_dev_port_del_all(nsim_dev); + nsim_dev_health_exit(nsim_dev); ++ nsim_fib_destroy(devlink, nsim_dev->fib_data); + nsim_dev_traps_exit(devlink); + nsim_dev_dummy_region_exit(nsim_dev); + mutex_destroy(&nsim_dev->port_list_lock); +- nsim_fib_destroy(devlink, nsim_dev->fib_data); + } + + void nsim_dev_remove(struct nsim_bus_dev *nsim_bus_dev) +diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c +index 93c7e8502845f..ebb568f9bc667 100644 +--- a/drivers/net/wan/lmc/lmc_main.c ++++ b/drivers/net/wan/lmc/lmc_main.c +@@ -899,6 +899,8 @@ static int lmc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + break; + default: + printk(KERN_WARNING "%s: LMC UNKNOWN CARD!\n", dev->name); ++ unregister_hdlc_device(dev); ++ return -EIO; + break; + } + +diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c +index e6135795719a1..e7072fc4f487a 100644 +--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c ++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c +@@ -576,13 +576,13 @@ static void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb) + case WMI_TDLS_TEARDOWN_REASON_TX: + case WMI_TDLS_TEARDOWN_REASON_RSSI: + case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT: ++ rcu_read_lock(); + station = ieee80211_find_sta_by_ifaddr(ar->hw, + ev->peer_macaddr.addr, + NULL); + if (!station) { + ath10k_warn(ar, "did not find station from tdls peer event"); +- kfree(tb); +- return; ++ goto exit; + } + arvif = ath10k_get_arvif(ar, __le32_to_cpu(ev->vdev_id)); + ieee80211_tdls_oper_request( +@@ -593,6 +593,9 @@ static void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb) + ); + break; + } ++ ++exit: ++ rcu_read_unlock(); + kfree(tb); + } + +diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c +index 54bdef33f3f85..55ecf7f437354 100644 +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -6361,17 +6361,20 @@ static int __ath11k_mac_register(struct ath11k *ar) + ret = ath11k_regd_update(ar, true); + if (ret) { + ath11k_err(ar->ab, "ath11k regd update failed: %d\n", ret); +- goto err_free_if_combs; ++ goto err_unregister_hw; + } + + ret = ath11k_debugfs_register(ar); + if (ret) { + ath11k_err(ar->ab, "debugfs registration failed: %d\n", ret); +- goto err_free_if_combs; ++ goto err_unregister_hw; + } + + return 0; + ++err_unregister_hw: ++ ieee80211_unregister_hw(ar->hw); ++ + err_free_if_combs: + kfree(ar->hw->wiphy->iface_combinations[0].limits); + kfree(ar->hw->wiphy->iface_combinations); +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index 0ee421f30aa24..23e6422c2251b 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -5611,7 +5611,8 @@ static bool brcmf_is_linkup(struct brcmf_cfg80211_vif *vif, + return false; + } + +-static bool brcmf_is_linkdown(const struct brcmf_event_msg *e) ++static bool brcmf_is_linkdown(struct brcmf_cfg80211_vif *vif, ++ const struct brcmf_event_msg *e) + { + u32 event = e->event_code; + u16 flags = e->flags; +@@ -5620,6 +5621,8 @@ static bool brcmf_is_linkdown(const struct brcmf_event_msg *e) + (event == BRCMF_E_DISASSOC_IND) || + ((event == BRCMF_E_LINK) && (!(flags & BRCMF_EVENT_MSG_LINK)))) { + brcmf_dbg(CONN, "Processing link down\n"); ++ clear_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &vif->sme_state); ++ clear_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &vif->sme_state); + return true; + } + return false; +@@ -6067,7 +6070,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, + } else + brcmf_bss_connect_done(cfg, ndev, e, true); + brcmf_net_setcarrier(ifp, true); +- } else if (brcmf_is_linkdown(e)) { ++ } else if (brcmf_is_linkdown(ifp->vif, e)) { + brcmf_dbg(CONN, "Linkdown\n"); + if (!brcmf_is_ibssmode(ifp->vif) && + test_bit(BRCMF_VIF_STATUS_CONNECTED, +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +index ab93a848a4667..e71bc97cb40e7 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +@@ -1972,7 +1972,7 @@ static bool iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans, + int ret; + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); + +- spin_lock_irqsave(&trans_pcie->reg_lock, *flags); ++ spin_lock_bh(&trans_pcie->reg_lock); + + if (trans_pcie->cmd_hold_nic_awake) + goto out; +@@ -2057,7 +2057,7 @@ static bool iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans, + } + + err: +- spin_unlock_irqrestore(&trans_pcie->reg_lock, *flags); ++ spin_unlock_bh(&trans_pcie->reg_lock); + return false; + } + +@@ -2095,7 +2095,7 @@ static void iwl_trans_pcie_release_nic_access(struct iwl_trans *trans, + * scheduled on different CPUs (after we drop reg_lock). + */ + out: +- spin_unlock_irqrestore(&trans_pcie->reg_lock, *flags); ++ spin_unlock_bh(&trans_pcie->reg_lock); + } + + static int iwl_trans_pcie_read_mem(struct iwl_trans *trans, u32 addr, +@@ -2296,11 +2296,10 @@ static void iwl_trans_pcie_set_bits_mask(struct iwl_trans *trans, u32 reg, + u32 mask, u32 value) + { + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); +- unsigned long flags; + +- spin_lock_irqsave(&trans_pcie->reg_lock, flags); ++ spin_lock_bh(&trans_pcie->reg_lock); + __iwl_trans_pcie_set_bits_mask(trans, reg, mask, value); +- spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); ++ spin_unlock_bh(&trans_pcie->reg_lock); + } + + static const char *get_csr_string(int cmd) +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c +index 8757246a90d53..b9afd9b04042a 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c +@@ -31,7 +31,6 @@ static int iwl_pcie_gen2_enqueue_hcmd(struct iwl_trans *trans, + struct iwl_txq *txq = trans->txqs.txq[trans->txqs.cmd.q_id]; + struct iwl_device_cmd *out_cmd; + struct iwl_cmd_meta *out_meta; +- unsigned long flags; + void *dup_buf = NULL; + dma_addr_t phys_addr; + int i, cmd_pos, idx; +@@ -244,11 +243,11 @@ static int iwl_pcie_gen2_enqueue_hcmd(struct iwl_trans *trans, + if (txq->read_ptr == txq->write_ptr && txq->wd_timeout) + mod_timer(&txq->stuck_timer, jiffies + txq->wd_timeout); + +- spin_lock_irqsave(&trans_pcie->reg_lock, flags); ++ spin_lock(&trans_pcie->reg_lock); + /* Increment and update queue's write index */ + txq->write_ptr = iwl_txq_inc_wrap(trans, txq->write_ptr); + iwl_txq_inc_wr_ptr(trans, txq); +- spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); ++ spin_unlock(&trans_pcie->reg_lock); + + out: + spin_unlock_bh(&txq->lock); +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c +index 83f4964f3cb29..689f51968049a 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c +@@ -223,12 +223,10 @@ static void iwl_pcie_txq_unmap(struct iwl_trans *trans, int txq_id) + txq->read_ptr = iwl_txq_inc_wrap(trans, txq->read_ptr); + + if (txq->read_ptr == txq->write_ptr) { +- unsigned long flags; +- +- spin_lock_irqsave(&trans_pcie->reg_lock, flags); ++ spin_lock(&trans_pcie->reg_lock); + if (txq_id == trans->txqs.cmd.q_id) + iwl_pcie_clear_cmd_in_flight(trans); +- spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); ++ spin_unlock(&trans_pcie->reg_lock); + } + } + +@@ -679,7 +677,6 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx) + { + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); + struct iwl_txq *txq = trans->txqs.txq[txq_id]; +- unsigned long flags; + int nfreed = 0; + u16 r; + +@@ -710,9 +707,10 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx) + } + + if (txq->read_ptr == txq->write_ptr) { +- spin_lock_irqsave(&trans_pcie->reg_lock, flags); ++ /* BHs are also disabled due to txq->lock */ ++ spin_lock(&trans_pcie->reg_lock); + iwl_pcie_clear_cmd_in_flight(trans); +- spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); ++ spin_unlock(&trans_pcie->reg_lock); + } + + iwl_txq_progress(txq); +@@ -921,7 +919,6 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, + struct iwl_txq *txq = trans->txqs.txq[trans->txqs.cmd.q_id]; + struct iwl_device_cmd *out_cmd; + struct iwl_cmd_meta *out_meta; +- unsigned long flags; + void *dup_buf = NULL; + dma_addr_t phys_addr; + int idx; +@@ -1164,20 +1161,19 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, + if (txq->read_ptr == txq->write_ptr && txq->wd_timeout) + mod_timer(&txq->stuck_timer, jiffies + txq->wd_timeout); + +- spin_lock_irqsave(&trans_pcie->reg_lock, flags); ++ spin_lock(&trans_pcie->reg_lock); + ret = iwl_pcie_set_cmd_in_flight(trans, cmd); + if (ret < 0) { + idx = ret; +- spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); +- goto out; ++ goto unlock_reg; + } + + /* Increment and update queue's write index */ + txq->write_ptr = iwl_txq_inc_wrap(trans, txq->write_ptr); + iwl_pcie_txq_inc_wr_ptr(trans, txq); + +- spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); +- ++ unlock_reg: ++ spin_unlock(&trans_pcie->reg_lock); + out: + spin_unlock_bh(&txq->lock); + free_dup_buf: +diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c +index fbfd85439d1ff..88fb49486ee09 100644 +--- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c +@@ -719,8 +719,8 @@ static void rtw8821c_coex_cfg_ant_switch(struct rtw_dev *rtwdev, u8 ctrl_type, + regval = (!polarity_inverse ? 0x1 : 0x2); + } + +- rtw_write8_mask(rtwdev, REG_RFE_CTRL8, BIT_MASK_R_RFE_SEL_15, +- regval); ++ rtw_write32_mask(rtwdev, REG_RFE_CTRL8, BIT_MASK_R_RFE_SEL_15, ++ regval); + break; + case COEX_SWITCH_CTRL_BY_PTA: + rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); +@@ -730,8 +730,8 @@ static void rtw8821c_coex_cfg_ant_switch(struct rtw_dev *rtwdev, u8 ctrl_type, + PTA_CTRL_PIN); + + regval = (!polarity_inverse ? 0x2 : 0x1); +- rtw_write8_mask(rtwdev, REG_RFE_CTRL8, BIT_MASK_R_RFE_SEL_15, +- regval); ++ rtw_write32_mask(rtwdev, REG_RFE_CTRL8, BIT_MASK_R_RFE_SEL_15, ++ regval); + break; + case COEX_SWITCH_CTRL_BY_ANTDIV: + rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); +@@ -757,11 +757,11 @@ static void rtw8821c_coex_cfg_ant_switch(struct rtw_dev *rtwdev, u8 ctrl_type, + } + + if (ctrl_type == COEX_SWITCH_CTRL_BY_BT) { +- rtw_write32_clr(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE1); +- rtw_write32_clr(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE2); ++ rtw_write8_clr(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE1); ++ rtw_write8_clr(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE2); + } else { +- rtw_write32_set(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE1); +- rtw_write32_set(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE2); ++ rtw_write8_set(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE1); ++ rtw_write8_set(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE2); + } + } + +diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c +index 8b0485ada315b..d658c6e8263af 100644 +--- a/drivers/nvme/target/tcp.c ++++ b/drivers/nvme/target/tcp.c +@@ -1098,11 +1098,11 @@ static int nvmet_tcp_try_recv_data(struct nvmet_tcp_queue *queue) + cmd->rbytes_done += ret; + } + ++ nvmet_tcp_unmap_pdu_iovec(cmd); + if (queue->data_digest) { + nvmet_tcp_prep_recv_ddgst(cmd); + return 0; + } +- nvmet_tcp_unmap_pdu_iovec(cmd); + + if (!(cmd->flags & NVMET_TCP_F_INIT_FAILED) && + cmd->rbytes_done == cmd->req.transfer_len) { +diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c +index f35edb0eac405..c12fa57ebd12c 100644 +--- a/drivers/pinctrl/pinctrl-microchip-sgpio.c ++++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c +@@ -572,7 +572,7 @@ static void microchip_sgpio_irq_settype(struct irq_data *data, + /* Type value spread over 2 registers sets: low, high bit */ + sgpio_clrsetbits(bank->priv, REG_INT_TRIGGER, addr.bit, + BIT(addr.port), (!!(type & 0x1)) << addr.port); +- sgpio_clrsetbits(bank->priv, REG_INT_TRIGGER + SGPIO_MAX_BITS, addr.bit, ++ sgpio_clrsetbits(bank->priv, REG_INT_TRIGGER, SGPIO_MAX_BITS + addr.bit, + BIT(addr.port), (!!(type & 0x2)) << addr.port); + + if (type == SGPIO_INT_TRG_LEVEL) +diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c +index aa1a1c850d057..53a0badc6b035 100644 +--- a/drivers/pinctrl/pinctrl-rockchip.c ++++ b/drivers/pinctrl/pinctrl-rockchip.c +@@ -3727,12 +3727,15 @@ static int __maybe_unused rockchip_pinctrl_suspend(struct device *dev) + static int __maybe_unused rockchip_pinctrl_resume(struct device *dev) + { + struct rockchip_pinctrl *info = dev_get_drvdata(dev); +- int ret = regmap_write(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX, +- rk3288_grf_gpio6c_iomux | +- GPIO6C6_SEL_WRITE_ENABLE); ++ int ret; + +- if (ret) +- return ret; ++ if (info->ctrl->type == RK3288) { ++ ret = regmap_write(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX, ++ rk3288_grf_gpio6c_iomux | ++ GPIO6C6_SEL_WRITE_ENABLE); ++ if (ret) ++ return ret; ++ } + + return pinctrl_force_default(info->pctl_dev); + } +diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +index 369ee20a7ea95..2f19ab4db7208 100644 +--- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c ++++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +@@ -392,7 +392,7 @@ static int lpi_config_set(struct pinctrl_dev *pctldev, unsigned int group, + unsigned long *configs, unsigned int nconfs) + { + struct lpi_pinctrl *pctrl = dev_get_drvdata(pctldev->dev); +- unsigned int param, arg, pullup, strength; ++ unsigned int param, arg, pullup = LPI_GPIO_BIAS_DISABLE, strength = 2; + bool value, output_enabled = false; + const struct lpi_pingroup *g; + unsigned long sval; +diff --git a/drivers/pinctrl/qcom/pinctrl-sc7280.c b/drivers/pinctrl/qcom/pinctrl-sc7280.c +index 8daccd5302854..9d41abfca37ea 100644 +--- a/drivers/pinctrl/qcom/pinctrl-sc7280.c ++++ b/drivers/pinctrl/qcom/pinctrl-sc7280.c +@@ -1439,14 +1439,14 @@ static const struct msm_pingroup sc7280_groups[] = { + [172] = PINGROUP(172, qdss, _, _, _, _, _, _, _, _), + [173] = PINGROUP(173, qdss, _, _, _, _, _, _, _, _), + [174] = PINGROUP(174, qdss, _, _, _, _, _, _, _, _), +- [175] = UFS_RESET(ufs_reset, 0x1be000), +- [176] = SDC_QDSD_PINGROUP(sdc1_rclk, 0x1b3000, 15, 0), +- [177] = SDC_QDSD_PINGROUP(sdc1_clk, 0x1b3000, 13, 6), +- [178] = SDC_QDSD_PINGROUP(sdc1_cmd, 0x1b3000, 11, 3), +- [179] = SDC_QDSD_PINGROUP(sdc1_data, 0x1b3000, 9, 0), +- [180] = SDC_QDSD_PINGROUP(sdc2_clk, 0x1b4000, 14, 6), +- [181] = SDC_QDSD_PINGROUP(sdc2_cmd, 0x1b4000, 11, 3), +- [182] = SDC_QDSD_PINGROUP(sdc2_data, 0x1b4000, 9, 0), ++ [175] = UFS_RESET(ufs_reset, 0xbe000), ++ [176] = SDC_QDSD_PINGROUP(sdc1_rclk, 0xb3004, 0, 6), ++ [177] = SDC_QDSD_PINGROUP(sdc1_clk, 0xb3000, 13, 6), ++ [178] = SDC_QDSD_PINGROUP(sdc1_cmd, 0xb3000, 11, 3), ++ [179] = SDC_QDSD_PINGROUP(sdc1_data, 0xb3000, 9, 0), ++ [180] = SDC_QDSD_PINGROUP(sdc2_clk, 0xb4000, 14, 6), ++ [181] = SDC_QDSD_PINGROUP(sdc2_cmd, 0xb4000, 11, 3), ++ [182] = SDC_QDSD_PINGROUP(sdc2_data, 0xb4000, 9, 0), + }; + + static const struct msm_pinctrl_soc_data sc7280_pinctrl = { +diff --git a/drivers/pinctrl/qcom/pinctrl-sdx55.c b/drivers/pinctrl/qcom/pinctrl-sdx55.c +index 2b5b0e2b03add..5aaf57b40407f 100644 +--- a/drivers/pinctrl/qcom/pinctrl-sdx55.c ++++ b/drivers/pinctrl/qcom/pinctrl-sdx55.c +@@ -423,7 +423,7 @@ static const char * const gpio_groups[] = { + + static const char * const qdss_stm_groups[] = { + "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7", "gpio12", "gpio13", +- "gpio14", "gpio15", "gpio16", "gpio17", "gpio18", "gpio19" "gpio20", "gpio21", "gpio22", ++ "gpio14", "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21", "gpio22", + "gpio23", "gpio44", "gpio45", "gpio52", "gpio53", "gpio56", "gpio57", "gpio61", "gpio62", + "gpio63", "gpio64", "gpio65", "gpio66", + }; +diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h +index 10e5e6c8087dc..01620f3eab39f 100644 +--- a/drivers/scsi/qla2xxx/qla_target.h ++++ b/drivers/scsi/qla2xxx/qla_target.h +@@ -116,7 +116,6 @@ + (min(1270, ((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD_24XX + \ + QLA_TGT_DATASEGS_PER_CONT_24XX*((ql) - 1)) : 0)) + #endif +-#endif + + #define GET_TARGET_ID(ha, iocb) ((HAS_EXTENDED_IDS(ha)) \ + ? le16_to_cpu((iocb)->u.isp2x.target.extended) \ +@@ -244,6 +243,7 @@ struct ctio_to_2xxx { + #ifndef CTIO_RET_TYPE + #define CTIO_RET_TYPE 0x17 /* CTIO return entry */ + #define ATIO_TYPE7 0x06 /* Accept target I/O entry for 24xx */ ++#endif + + struct fcp_hdr { + uint8_t r_ctl; +diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c +index 43f7624508a96..8b10fa4e381a4 100644 +--- a/drivers/scsi/st.c ++++ b/drivers/scsi/st.c +@@ -1269,8 +1269,8 @@ static int st_open(struct inode *inode, struct file *filp) + spin_lock(&st_use_lock); + if (STp->in_use) { + spin_unlock(&st_use_lock); +- scsi_tape_put(STp); + DEBC_printk(STp, "Device already in use.\n"); ++ scsi_tape_put(STp); + return (-EBUSY); + } + +diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c +index f42954e2c98e4..1fd29f93ff6d6 100644 +--- a/drivers/soc/qcom/qcom-geni-se.c ++++ b/drivers/soc/qcom/qcom-geni-se.c +@@ -3,7 +3,6 @@ + + #include + #include +-#include + #include + #include + #include +@@ -92,14 +91,11 @@ struct geni_wrapper { + struct device *dev; + void __iomem *base; + struct clk_bulk_data ahb_clks[NUM_AHB_CLKS]; +- struct geni_icc_path to_core; + }; + + static const char * const icc_path_names[] = {"qup-core", "qup-config", + "qup-memory"}; + +-static struct geni_wrapper *earlycon_wrapper; +- + #define QUP_HW_VER_REG 0x4 + + /* Common SE registers */ +@@ -843,44 +839,11 @@ int geni_icc_disable(struct geni_se *se) + } + EXPORT_SYMBOL(geni_icc_disable); + +-void geni_remove_earlycon_icc_vote(void) +-{ +- struct platform_device *pdev; +- struct geni_wrapper *wrapper; +- struct device_node *parent; +- struct device_node *child; +- +- if (!earlycon_wrapper) +- return; +- +- wrapper = earlycon_wrapper; +- parent = of_get_next_parent(wrapper->dev->of_node); +- for_each_child_of_node(parent, child) { +- if (!of_device_is_compatible(child, "qcom,geni-se-qup")) +- continue; +- +- pdev = of_find_device_by_node(child); +- if (!pdev) +- continue; +- +- wrapper = platform_get_drvdata(pdev); +- icc_put(wrapper->to_core.path); +- wrapper->to_core.path = NULL; +- +- } +- of_node_put(parent); +- +- earlycon_wrapper = NULL; +-} +-EXPORT_SYMBOL(geni_remove_earlycon_icc_vote); +- + static int geni_se_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; + struct resource *res; + struct geni_wrapper *wrapper; +- struct console __maybe_unused *bcon; +- bool __maybe_unused has_earlycon = false; + int ret; + + wrapper = devm_kzalloc(dev, sizeof(*wrapper), GFP_KERNEL); +@@ -903,43 +866,6 @@ static int geni_se_probe(struct platform_device *pdev) + } + } + +-#ifdef CONFIG_SERIAL_EARLYCON +- for_each_console(bcon) { +- if (!strcmp(bcon->name, "qcom_geni")) { +- has_earlycon = true; +- break; +- } +- } +- if (!has_earlycon) +- goto exit; +- +- wrapper->to_core.path = devm_of_icc_get(dev, "qup-core"); +- if (IS_ERR(wrapper->to_core.path)) +- return PTR_ERR(wrapper->to_core.path); +- /* +- * Put minmal BW request on core clocks on behalf of early console. +- * The vote will be removed earlycon exit function. +- * +- * Note: We are putting vote on each QUP wrapper instead only to which +- * earlycon is connected because QUP core clock of different wrapper +- * share same voltage domain. If core1 is put to 0, then core2 will +- * also run at 0, if not voted. Default ICC vote will be removed ASA +- * we touch any of the core clock. +- * core1 = core2 = max(core1, core2) +- */ +- ret = icc_set_bw(wrapper->to_core.path, GENI_DEFAULT_BW, +- GENI_DEFAULT_BW); +- if (ret) { +- dev_err(&pdev->dev, "%s: ICC BW voting failed for core: %d\n", +- __func__, ret); +- return ret; +- } +- +- if (of_get_compatible_child(pdev->dev.of_node, "qcom,geni-debug-uart")) +- earlycon_wrapper = wrapper; +- of_node_put(pdev->dev.of_node); +-exit: +-#endif + dev_set_drvdata(dev, wrapper); + dev_dbg(dev, "GENI SE Driver probed\n"); + return devm_of_platform_populate(dev); +diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c +index d740c47827751..2f20bd56ec6ca 100644 +--- a/drivers/staging/comedi/drivers/cb_pcidas.c ++++ b/drivers/staging/comedi/drivers/cb_pcidas.c +@@ -1281,7 +1281,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, + devpriv->amcc + AMCC_OP_REG_INTCSR); + + ret = request_irq(pcidev->irq, cb_pcidas_interrupt, IRQF_SHARED, +- dev->board_name, dev); ++ "cb_pcidas", dev); + if (ret) { + dev_dbg(dev->class_dev, "unable to allocate irq %d\n", + pcidev->irq); +diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c +index fa987bb0e7cd4..6d3ba399a7f0b 100644 +--- a/drivers/staging/comedi/drivers/cb_pcidas64.c ++++ b/drivers/staging/comedi/drivers/cb_pcidas64.c +@@ -4035,7 +4035,7 @@ static int auto_attach(struct comedi_device *dev, + init_stc_registers(dev); + + retval = request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED, +- dev->board_name, dev); ++ "cb_pcidas64", dev); + if (retval) { + dev_dbg(dev->class_dev, "unable to allocate irq %u\n", + pcidev->irq); +diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h +index b84f00b8d18bc..4cabaf21c1ca0 100644 +--- a/drivers/staging/rtl8192e/rtllib.h ++++ b/drivers/staging/rtl8192e/rtllib.h +@@ -1105,7 +1105,7 @@ struct rtllib_network { + bool bWithAironetIE; + bool bCkipSupported; + bool bCcxRmEnable; +- u16 CcxRmState[2]; ++ u8 CcxRmState[2]; + bool bMBssidValid; + u8 MBssidMask; + u8 MBssid[ETH_ALEN]; +diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c +index d31b5e1c8df47..63752233e551f 100644 +--- a/drivers/staging/rtl8192e/rtllib_rx.c ++++ b/drivers/staging/rtl8192e/rtllib_rx.c +@@ -1968,7 +1968,7 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee, + info_element->data[2] == 0x96 && + info_element->data[3] == 0x01) { + if (info_element->len == 6) { +- memcpy(network->CcxRmState, &info_element[4], 2); ++ memcpy(network->CcxRmState, &info_element->data[4], 2); + if (network->CcxRmState[0] != 0) + network->bCcxRmEnable = true; + else +diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c +index 0866e949339bd..9b73532464e55 100644 +--- a/drivers/thermal/thermal_sysfs.c ++++ b/drivers/thermal/thermal_sysfs.c +@@ -754,6 +754,9 @@ void thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev, + { + struct cooling_dev_stats *stats = cdev->stats; + ++ if (!stats) ++ return; ++ + spin_lock(&stats->lock); + + if (stats->state == new_state) +diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c +index 291649f028213..0d85b55ea8233 100644 +--- a/drivers/tty/serial/qcom_geni_serial.c ++++ b/drivers/tty/serial/qcom_geni_serial.c +@@ -1177,12 +1177,6 @@ static inline void qcom_geni_serial_enable_early_read(struct geni_se *se, + struct console *con) { } + #endif + +-static int qcom_geni_serial_earlycon_exit(struct console *con) +-{ +- geni_remove_earlycon_icc_vote(); +- return 0; +-} +- + static struct qcom_geni_private_data earlycon_private_data; + + static int __init qcom_geni_serial_earlycon_setup(struct earlycon_device *dev, +@@ -1233,7 +1227,6 @@ static int __init qcom_geni_serial_earlycon_setup(struct earlycon_device *dev, + writel(stop_bit_len, uport->membase + SE_UART_TX_STOP_BIT_LEN); + + dev->con->write = qcom_geni_serial_earlycon_write; +- dev->con->exit = qcom_geni_serial_earlycon_exit; + dev->con->setup = NULL; + qcom_geni_serial_enable_early_read(&se, dev->con); + +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c +index 2f4e5174e78c8..e79359326411a 100644 +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -147,17 +147,29 @@ static inline int acm_set_control(struct acm *acm, int control) + #define acm_send_break(acm, ms) \ + acm_ctrl_msg(acm, USB_CDC_REQ_SEND_BREAK, ms, NULL, 0) + +-static void acm_kill_urbs(struct acm *acm) ++static void acm_poison_urbs(struct acm *acm) + { + int i; + +- usb_kill_urb(acm->ctrlurb); ++ usb_poison_urb(acm->ctrlurb); + for (i = 0; i < ACM_NW; i++) +- usb_kill_urb(acm->wb[i].urb); ++ usb_poison_urb(acm->wb[i].urb); + for (i = 0; i < acm->rx_buflimit; i++) +- usb_kill_urb(acm->read_urbs[i]); ++ usb_poison_urb(acm->read_urbs[i]); + } + ++static void acm_unpoison_urbs(struct acm *acm) ++{ ++ int i; ++ ++ for (i = 0; i < acm->rx_buflimit; i++) ++ usb_unpoison_urb(acm->read_urbs[i]); ++ for (i = 0; i < ACM_NW; i++) ++ usb_unpoison_urb(acm->wb[i].urb); ++ usb_unpoison_urb(acm->ctrlurb); ++} ++ ++ + /* + * Write buffer management. + * All of these assume proper locks taken by the caller. +@@ -226,9 +238,10 @@ static int acm_start_wb(struct acm *acm, struct acm_wb *wb) + + rc = usb_submit_urb(wb->urb, GFP_ATOMIC); + if (rc < 0) { +- dev_err(&acm->data->dev, +- "%s - usb_submit_urb(write bulk) failed: %d\n", +- __func__, rc); ++ if (rc != -EPERM) ++ dev_err(&acm->data->dev, ++ "%s - usb_submit_urb(write bulk) failed: %d\n", ++ __func__, rc); + acm_write_done(acm, wb); + } + return rc; +@@ -313,8 +326,10 @@ static void acm_process_notification(struct acm *acm, unsigned char *buf) + acm->iocount.dsr++; + if (difference & ACM_CTRL_DCD) + acm->iocount.dcd++; +- if (newctrl & ACM_CTRL_BRK) ++ if (newctrl & ACM_CTRL_BRK) { + acm->iocount.brk++; ++ tty_insert_flip_char(&acm->port, 0, TTY_BREAK); ++ } + if (newctrl & ACM_CTRL_RI) + acm->iocount.rng++; + if (newctrl & ACM_CTRL_FRAMING) +@@ -480,11 +495,6 @@ static void acm_read_bulk_callback(struct urb *urb) + dev_vdbg(&acm->data->dev, "got urb %d, len %d, status %d\n", + rb->index, urb->actual_length, status); + +- if (!acm->dev) { +- dev_dbg(&acm->data->dev, "%s - disconnected\n", __func__); +- return; +- } +- + switch (status) { + case 0: + usb_mark_last_busy(acm->dev); +@@ -649,7 +659,8 @@ static void acm_port_dtr_rts(struct tty_port *port, int raise) + + res = acm_set_control(acm, val); + if (res && (acm->ctrl_caps & USB_CDC_CAP_LINE)) +- dev_err(&acm->control->dev, "failed to set dtr/rts\n"); ++ /* This is broken in too many devices to spam the logs */ ++ dev_dbg(&acm->control->dev, "failed to set dtr/rts\n"); + } + + static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) +@@ -731,6 +742,7 @@ static void acm_port_shutdown(struct tty_port *port) + * Need to grab write_lock to prevent race with resume, but no need to + * hold it due to the tty-port initialised flag. + */ ++ acm_poison_urbs(acm); + spin_lock_irq(&acm->write_lock); + spin_unlock_irq(&acm->write_lock); + +@@ -747,7 +759,8 @@ static void acm_port_shutdown(struct tty_port *port) + usb_autopm_put_interface_async(acm->control); + } + +- acm_kill_urbs(acm); ++ acm_unpoison_urbs(acm); ++ + } + + static void acm_tty_cleanup(struct tty_struct *tty) +@@ -1503,12 +1516,16 @@ skip_countries: + + return 0; + alloc_fail6: ++ if (!acm->combined_interfaces) { ++ /* Clear driver data so that disconnect() returns early. */ ++ usb_set_intfdata(data_interface, NULL); ++ usb_driver_release_interface(&acm_driver, data_interface); ++ } + if (acm->country_codes) { + device_remove_file(&acm->control->dev, + &dev_attr_wCountryCodes); + device_remove_file(&acm->control->dev, + &dev_attr_iCountryCodeRelDate); +- kfree(acm->country_codes); + } + device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); + alloc_fail5: +@@ -1540,8 +1557,14 @@ static void acm_disconnect(struct usb_interface *intf) + if (!acm) + return; + +- mutex_lock(&acm->mutex); + acm->disconnected = true; ++ /* ++ * there is a circular dependency. acm_softint() can resubmit ++ * the URBs in error handling so we need to block any ++ * submission right away ++ */ ++ acm_poison_urbs(acm); ++ mutex_lock(&acm->mutex); + if (acm->country_codes) { + device_remove_file(&acm->control->dev, + &dev_attr_wCountryCodes); +@@ -1560,7 +1583,6 @@ static void acm_disconnect(struct usb_interface *intf) + tty_kref_put(tty); + } + +- acm_kill_urbs(acm); + cancel_delayed_work_sync(&acm->dwork); + + tty_unregister_device(acm_tty_driver, acm->minor); +@@ -1602,7 +1624,7 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message) + if (cnt) + return 0; + +- acm_kill_urbs(acm); ++ acm_poison_urbs(acm); + cancel_delayed_work_sync(&acm->dwork); + acm->urbs_in_error_delay = 0; + +@@ -1615,6 +1637,7 @@ static int acm_resume(struct usb_interface *intf) + struct urb *urb; + int rv = 0; + ++ acm_unpoison_urbs(acm); + spin_lock_irq(&acm->write_lock); + + if (--acm->susp_count) +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c +index 6ade3daf78584..76ac5d6555ae4 100644 +--- a/drivers/usb/core/quirks.c ++++ b/drivers/usb/core/quirks.c +@@ -498,6 +498,10 @@ static const struct usb_device_id usb_quirk_list[] = { + /* DJI CineSSD */ + { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, + ++ /* Fibocom L850-GL LTE Modem */ ++ { USB_DEVICE(0x2cb7, 0x0007), .driver_info = ++ USB_QUIRK_IGNORE_REMOTE_WAKEUP }, ++ + /* INTEL VALUE SSD */ + { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, + +diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c +index fc3269f5faf19..1a9789ec5847f 100644 +--- a/drivers/usb/dwc2/hcd.c ++++ b/drivers/usb/dwc2/hcd.c +@@ -4322,7 +4322,8 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd) + if (hsotg->op_state == OTG_STATE_B_PERIPHERAL) + goto unlock; + +- if (hsotg->params.power_down > DWC2_POWER_DOWN_PARAM_PARTIAL) ++ if (hsotg->params.power_down != DWC2_POWER_DOWN_PARAM_PARTIAL || ++ hsotg->flags.b.port_connect_status == 0) + goto skip_power_saving; + + /* +@@ -5398,7 +5399,7 @@ int dwc2_host_enter_hibernation(struct dwc2_hsotg *hsotg) + dwc2_writel(hsotg, hprt0, HPRT0); + + /* Wait for the HPRT0.PrtSusp register field to be set */ +- if (dwc2_hsotg_wait_bit_set(hsotg, HPRT0, HPRT0_SUSP, 3000)) ++ if (dwc2_hsotg_wait_bit_set(hsotg, HPRT0, HPRT0_SUSP, 5000)) + dev_warn(hsotg->dev, "Suspend wasn't generated\n"); + + /* +diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c +index bae6a70664c80..598daed8086f6 100644 +--- a/drivers/usb/dwc3/dwc3-pci.c ++++ b/drivers/usb/dwc3/dwc3-pci.c +@@ -118,6 +118,8 @@ static const struct property_entry dwc3_pci_intel_properties[] = { + static const struct property_entry dwc3_pci_mrfld_properties[] = { + PROPERTY_ENTRY_STRING("dr_mode", "otg"), + PROPERTY_ENTRY_STRING("linux,extcon-name", "mrfld_bcove_pwrsrc"), ++ PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"), ++ PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"), + PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), + {} + }; +diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c +index c00c4fa139b88..8bd077fb1190f 100644 +--- a/drivers/usb/dwc3/dwc3-qcom.c ++++ b/drivers/usb/dwc3/dwc3-qcom.c +@@ -244,6 +244,9 @@ static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom) + struct device *dev = qcom->dev; + int ret; + ++ if (has_acpi_companion(dev)) ++ return 0; ++ + qcom->icc_path_ddr = of_icc_get(dev, "usb-ddr"); + if (IS_ERR(qcom->icc_path_ddr)) { + dev_err(dev, "failed to get usb-ddr path: %ld\n", +diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c +index 2a86ad4b12b34..65ff41e3a18eb 100644 +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -791,10 +791,6 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) + reg &= ~DWC3_DALEPENA_EP(dep->number); + dwc3_writel(dwc->regs, DWC3_DALEPENA, reg); + +- dep->stream_capable = false; +- dep->type = 0; +- dep->flags = 0; +- + /* Clear out the ep descriptors for non-ep0 */ + if (dep->number > 1) { + dep->endpoint.comp_desc = NULL; +@@ -803,6 +799,10 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) + + dwc3_remove_requests(dwc, dep); + ++ dep->stream_capable = false; ++ dep->type = 0; ++ dep->flags = 0; ++ + return 0; + } + +diff --git a/drivers/usb/gadget/udc/amd5536udc_pci.c b/drivers/usb/gadget/udc/amd5536udc_pci.c +index 8d387e0e4d91f..c80f9bd51b750 100644 +--- a/drivers/usb/gadget/udc/amd5536udc_pci.c ++++ b/drivers/usb/gadget/udc/amd5536udc_pci.c +@@ -153,6 +153,11 @@ static int udc_pci_probe( + pci_set_master(pdev); + pci_try_set_mwi(pdev); + ++ dev->phys_addr = resource; ++ dev->irq = pdev->irq; ++ dev->pdev = pdev; ++ dev->dev = &pdev->dev; ++ + /* init dma pools */ + if (use_dma) { + retval = init_dma_pools(dev); +@@ -160,11 +165,6 @@ static int udc_pci_probe( + goto err_dma; + } + +- dev->phys_addr = resource; +- dev->irq = pdev->irq; +- dev->pdev = pdev; +- dev->dev = &pdev->dev; +- + /* general probing */ + if (udc_probe(dev)) { + retval = -ENODEV; +diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c +index fe010cc61f19b..2f27dc0d9c6bd 100644 +--- a/drivers/usb/host/xhci-mtk.c ++++ b/drivers/usb/host/xhci-mtk.c +@@ -397,6 +397,13 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) + xhci->quirks |= XHCI_SPURIOUS_SUCCESS; + if (mtk->lpm_support) + xhci->quirks |= XHCI_LPM_SUPPORT; ++ ++ /* ++ * MTK xHCI 0.96: PSA is 1 by default even if doesn't support stream, ++ * and it's 3 when support it. ++ */ ++ if (xhci->hci_version < 0x100 && HCC_MAX_PSA(xhci->hcc_params) == 4) ++ xhci->quirks |= XHCI_BROKEN_STREAMS; + } + + /* called during probe() after chip reset completes */ +@@ -548,7 +555,8 @@ static int xhci_mtk_probe(struct platform_device *pdev) + if (ret) + goto put_usb3_hcd; + +- if (HCC_MAX_PSA(xhci->hcc_params) >= 4) ++ if (HCC_MAX_PSA(xhci->hcc_params) >= 4 && ++ !(xhci->quirks & XHCI_BROKEN_STREAMS)) + xhci->shared_hcd->can_do_streams = 1; + + ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); +diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c +index 3209b5ddd30c9..a20a8380ca0c9 100644 +--- a/drivers/usb/usbip/vhci_hcd.c ++++ b/drivers/usb/usbip/vhci_hcd.c +@@ -594,6 +594,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, + pr_err("invalid port number %d\n", wIndex); + goto error; + } ++ if (wValue >= 32) ++ goto error; + if (hcd->speed == HCD_USB3) { + if ((vhci_hcd->port_status[rhport] & + USB_SS_PORT_STAT_POWER) != 0) { +diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig +index 40a223381ab61..0f28bf99efebc 100644 +--- a/drivers/vfio/pci/Kconfig ++++ b/drivers/vfio/pci/Kconfig +@@ -42,7 +42,7 @@ config VFIO_PCI_IGD + + config VFIO_PCI_NVLINK2 + def_bool y +- depends on VFIO_PCI && PPC_POWERNV ++ depends on VFIO_PCI && PPC_POWERNV && SPAPR_TCE_IOMMU + help + VFIO PCI support for P9 Witherspoon machine with NVIDIA V100 GPUs + +diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c +index a262e12c6dc26..5ccb0705beae1 100644 +--- a/drivers/vhost/vhost.c ++++ b/drivers/vhost/vhost.c +@@ -332,8 +332,8 @@ static void vhost_vq_reset(struct vhost_dev *dev, + vq->error_ctx = NULL; + vq->kick = NULL; + vq->log_ctx = NULL; +- vhost_reset_is_le(vq); + vhost_disable_cross_endian(vq); ++ vhost_reset_is_le(vq); + vq->busyloop_timeout = 0; + vq->umem = NULL; + vq->iotlb = NULL; +diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c +index bf61598bf1c39..35fdec88d38d9 100644 +--- a/drivers/video/fbdev/core/fbcon.c ++++ b/drivers/video/fbdev/core/fbcon.c +@@ -1341,6 +1341,9 @@ static void fbcon_cursor(struct vc_data *vc, int mode) + + ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1; + ++ if (!ops->cursor) ++ return; ++ + if (mode & CM_SOFTBACK) { + mode &= ~CM_SOFTBACK; + y = softback_lines; +diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c +index c8b0ae676809b..4dc9077dd2ac0 100644 +--- a/drivers/video/fbdev/hyperv_fb.c ++++ b/drivers/video/fbdev/hyperv_fb.c +@@ -1031,7 +1031,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) + PCI_DEVICE_ID_HYPERV_VIDEO, NULL); + if (!pdev) { + pr_err("Unable to find PCI Hyper-V video\n"); +- kfree(info->apertures); + return -ENODEV; + } + +@@ -1129,7 +1128,6 @@ getmem_done: + } else { + pci_dev_put(pdev); + } +- kfree(info->apertures); + + return 0; + +@@ -1141,7 +1139,6 @@ err2: + err1: + if (!gen2vm) + pci_dev_put(pdev); +- kfree(info->apertures); + + return -ENOMEM; + } +diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c +index f45f9feebe593..74a5172c2d838 100644 +--- a/fs/ext4/balloc.c ++++ b/fs/ext4/balloc.c +@@ -626,27 +626,41 @@ int ext4_claim_free_clusters(struct ext4_sb_info *sbi, + + /** + * ext4_should_retry_alloc() - check if a block allocation should be retried +- * @sb: super block +- * @retries: number of attemps has been made ++ * @sb: superblock ++ * @retries: number of retry attempts made so far + * +- * ext4_should_retry_alloc() is called when ENOSPC is returned, and if +- * it is profitable to retry the operation, this function will wait +- * for the current or committing transaction to complete, and then +- * return TRUE. We will only retry once. ++ * ext4_should_retry_alloc() is called when ENOSPC is returned while ++ * attempting to allocate blocks. If there's an indication that a pending ++ * journal transaction might free some space and allow another attempt to ++ * succeed, this function will wait for the current or committing transaction ++ * to complete and then return TRUE. + */ + int ext4_should_retry_alloc(struct super_block *sb, int *retries) + { +- if (!ext4_has_free_clusters(EXT4_SB(sb), 1, 0) || +- (*retries)++ > 1 || +- !EXT4_SB(sb)->s_journal) ++ struct ext4_sb_info *sbi = EXT4_SB(sb); ++ ++ if (!sbi->s_journal) + return 0; + +- smp_mb(); +- if (EXT4_SB(sb)->s_mb_free_pending == 0) ++ if (++(*retries) > 3) { ++ percpu_counter_inc(&sbi->s_sra_exceeded_retry_limit); + return 0; ++ } + ++ /* ++ * if there's no indication that blocks are about to be freed it's ++ * possible we just missed a transaction commit that did so ++ */ ++ smp_mb(); ++ if (sbi->s_mb_free_pending == 0) ++ return ext4_has_free_clusters(sbi, 1, 0); ++ ++ /* ++ * it's possible we've just missed a transaction commit here, ++ * so ignore the returned status ++ */ + jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id); +- jbd2_journal_force_commit_nested(EXT4_SB(sb)->s_journal); ++ (void) jbd2_journal_force_commit_nested(sbi->s_journal); + return 1; + } + +diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h +index e5c81593d972c..9ad539ee41964 100644 +--- a/fs/ext4/ext4.h ++++ b/fs/ext4/ext4.h +@@ -1484,6 +1484,7 @@ struct ext4_sb_info { + struct percpu_counter s_freeinodes_counter; + struct percpu_counter s_dirs_counter; + struct percpu_counter s_dirtyclusters_counter; ++ struct percpu_counter s_sra_exceeded_retry_limit; + struct blockgroup_lock *s_blockgroup_lock; + struct proc_dir_entry *s_proc; + struct kobject s_kobj; +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index ed498538a7499..3b9f7bf4045b0 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -1937,13 +1937,13 @@ static int __ext4_journalled_writepage(struct page *page, + if (!ret) + ret = err; + +- if (!ext4_has_inline_data(inode)) +- ext4_walk_page_buffers(NULL, page_bufs, 0, len, +- NULL, bput_one); + ext4_set_inode_state(inode, EXT4_STATE_JDATA); + out: + unlock_page(page); + out_no_pagelock: ++ if (!inline_data && page_bufs) ++ ext4_walk_page_buffers(NULL, page_bufs, 0, len, ++ NULL, bput_one); + brelse(inode_bh); + return ret; + } +diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c +index 078f26f4b56e3..9cc9e6c1d582f 100644 +--- a/fs/ext4/namei.c ++++ b/fs/ext4/namei.c +@@ -3785,14 +3785,14 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, + */ + retval = -ENOENT; + if (!old.bh || le32_to_cpu(old.de->inode) != old.inode->i_ino) +- goto end_rename; ++ goto release_bh; + + new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, + &new.de, &new.inlined); + if (IS_ERR(new.bh)) { + retval = PTR_ERR(new.bh); + new.bh = NULL; +- goto end_rename; ++ goto release_bh; + } + if (new.bh) { + if (!new.inode) { +@@ -3809,15 +3809,13 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, + handle = ext4_journal_start(old.dir, EXT4_HT_DIR, credits); + if (IS_ERR(handle)) { + retval = PTR_ERR(handle); +- handle = NULL; +- goto end_rename; ++ goto release_bh; + } + } else { + whiteout = ext4_whiteout_for_rename(&old, credits, &handle); + if (IS_ERR(whiteout)) { + retval = PTR_ERR(whiteout); +- whiteout = NULL; +- goto end_rename; ++ goto release_bh; + } + } + +@@ -3954,16 +3952,18 @@ end_rename: + ext4_resetent(handle, &old, + old.inode->i_ino, old_file_type); + drop_nlink(whiteout); ++ ext4_orphan_add(handle, whiteout); + } + unlock_new_inode(whiteout); ++ ext4_journal_stop(handle); + iput(whiteout); +- ++ } else { ++ ext4_journal_stop(handle); + } ++release_bh: + brelse(old.dir_bh); + brelse(old.bh); + brelse(new.bh); +- if (handle) +- ext4_journal_stop(handle); + return retval; + } + +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index a1353b0825ea3..c8cc8175b376b 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -1210,6 +1210,7 @@ static void ext4_put_super(struct super_block *sb) + percpu_counter_destroy(&sbi->s_freeinodes_counter); + percpu_counter_destroy(&sbi->s_dirs_counter); + percpu_counter_destroy(&sbi->s_dirtyclusters_counter); ++ percpu_counter_destroy(&sbi->s_sra_exceeded_retry_limit); + percpu_free_rwsem(&sbi->s_writepages_rwsem); + #ifdef CONFIG_QUOTA + for (i = 0; i < EXT4_MAXQUOTAS; i++) +@@ -5011,6 +5012,9 @@ no_journal: + if (!err) + err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0, + GFP_KERNEL); ++ if (!err) ++ err = percpu_counter_init(&sbi->s_sra_exceeded_retry_limit, 0, ++ GFP_KERNEL); + if (!err) + err = percpu_init_rwsem(&sbi->s_writepages_rwsem); + +@@ -5124,6 +5128,7 @@ failed_mount6: + percpu_counter_destroy(&sbi->s_freeinodes_counter); + percpu_counter_destroy(&sbi->s_dirs_counter); + percpu_counter_destroy(&sbi->s_dirtyclusters_counter); ++ percpu_counter_destroy(&sbi->s_sra_exceeded_retry_limit); + percpu_free_rwsem(&sbi->s_writepages_rwsem); + failed_mount5: + ext4_ext_release(sb); +diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c +index 075aa3a19ff5f..a3d08276d441e 100644 +--- a/fs/ext4/sysfs.c ++++ b/fs/ext4/sysfs.c +@@ -24,6 +24,7 @@ typedef enum { + attr_session_write_kbytes, + attr_lifetime_write_kbytes, + attr_reserved_clusters, ++ attr_sra_exceeded_retry_limit, + attr_inode_readahead, + attr_trigger_test_error, + attr_first_error_time, +@@ -202,6 +203,7 @@ EXT4_ATTR_FUNC(delayed_allocation_blocks, 0444); + EXT4_ATTR_FUNC(session_write_kbytes, 0444); + EXT4_ATTR_FUNC(lifetime_write_kbytes, 0444); + EXT4_ATTR_FUNC(reserved_clusters, 0644); ++EXT4_ATTR_FUNC(sra_exceeded_retry_limit, 0444); + + EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, inode_readahead, + ext4_sb_info, s_inode_readahead_blks); +@@ -251,6 +253,7 @@ static struct attribute *ext4_attrs[] = { + ATTR_LIST(session_write_kbytes), + ATTR_LIST(lifetime_write_kbytes), + ATTR_LIST(reserved_clusters), ++ ATTR_LIST(sra_exceeded_retry_limit), + ATTR_LIST(inode_readahead_blks), + ATTR_LIST(inode_goal), + ATTR_LIST(mb_stats), +@@ -374,6 +377,10 @@ static ssize_t ext4_attr_show(struct kobject *kobj, + return snprintf(buf, PAGE_SIZE, "%llu\n", + (unsigned long long) + atomic64_read(&sbi->s_resv_clusters)); ++ case attr_sra_exceeded_retry_limit: ++ return snprintf(buf, PAGE_SIZE, "%llu\n", ++ (unsigned long long) ++ percpu_counter_sum(&sbi->s_sra_exceeded_retry_limit)); + case attr_inode_readahead: + case attr_pointer_ui: + if (!ptr) +diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c +index 8868ac31a3c0a..4ee6f734ba838 100644 +--- a/fs/fuse/virtio_fs.c ++++ b/fs/fuse/virtio_fs.c +@@ -1324,8 +1324,15 @@ static int virtio_fs_fill_super(struct super_block *sb, struct fs_context *fsc) + + /* virtiofs allocates and installs its own fuse devices */ + ctx->fudptr = NULL; +- if (ctx->dax) ++ if (ctx->dax) { ++ if (!fs->dax_dev) { ++ err = -EINVAL; ++ pr_err("virtio-fs: dax can't be enabled as filesystem" ++ " device does not support it.\n"); ++ goto err_free_fuse_devs; ++ } + ctx->dax_dev = fs->dax_dev; ++ } + err = fuse_fill_super_common(sb, ctx); + if (err < 0) + goto err_free_fuse_devs; +diff --git a/fs/io_uring.c b/fs/io_uring.c +index 5c4378694d541..8b4213de9e085 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -4628,6 +4628,7 @@ static int io_sendmsg(struct io_kiocb *req, bool force_nonblock, + struct io_async_msghdr iomsg, *kmsg; + struct socket *sock; + unsigned flags; ++ int min_ret = 0; + int ret; + + sock = sock_from_file(req->file); +@@ -4648,12 +4649,15 @@ static int io_sendmsg(struct io_kiocb *req, bool force_nonblock, + kmsg = &iomsg; + } + +- flags = req->sr_msg.msg_flags; ++ flags = req->sr_msg.msg_flags | MSG_NOSIGNAL; + if (flags & MSG_DONTWAIT) + req->flags |= REQ_F_NOWAIT; + else if (force_nonblock) + flags |= MSG_DONTWAIT; + ++ if (flags & MSG_WAITALL) ++ min_ret = iov_iter_count(&kmsg->msg.msg_iter); ++ + ret = __sys_sendmsg_sock(sock, &kmsg->msg, flags); + if (force_nonblock && ret == -EAGAIN) + return io_setup_async_msg(req, kmsg); +@@ -4663,7 +4667,7 @@ static int io_sendmsg(struct io_kiocb *req, bool force_nonblock, + if (kmsg->iov != kmsg->fast_iov) + kfree(kmsg->iov); + req->flags &= ~REQ_F_NEED_CLEANUP; +- if (ret < 0) ++ if (ret < min_ret) + req_set_fail_links(req); + __io_req_complete(req, ret, 0, cs); + return 0; +@@ -4677,6 +4681,7 @@ static int io_send(struct io_kiocb *req, bool force_nonblock, + struct iovec iov; + struct socket *sock; + unsigned flags; ++ int min_ret = 0; + int ret; + + sock = sock_from_file(req->file); +@@ -4692,12 +4697,15 @@ static int io_send(struct io_kiocb *req, bool force_nonblock, + msg.msg_controllen = 0; + msg.msg_namelen = 0; + +- flags = req->sr_msg.msg_flags; ++ flags = req->sr_msg.msg_flags | MSG_NOSIGNAL; + if (flags & MSG_DONTWAIT) + req->flags |= REQ_F_NOWAIT; + else if (force_nonblock) + flags |= MSG_DONTWAIT; + ++ if (flags & MSG_WAITALL) ++ min_ret = iov_iter_count(&msg.msg_iter); ++ + msg.msg_flags = flags; + ret = sock_sendmsg(sock, &msg); + if (force_nonblock && ret == -EAGAIN) +@@ -4705,7 +4713,7 @@ static int io_send(struct io_kiocb *req, bool force_nonblock, + if (ret == -ERESTARTSYS) + ret = -EINTR; + +- if (ret < 0) ++ if (ret < min_ret) + req_set_fail_links(req); + __io_req_complete(req, ret, 0, cs); + return 0; +@@ -4857,6 +4865,7 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock, + struct socket *sock; + struct io_buffer *kbuf; + unsigned flags; ++ int min_ret = 0; + int ret, cflags = 0; + + sock = sock_from_file(req->file); +@@ -4886,12 +4895,15 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock, + 1, req->sr_msg.len); + } + +- flags = req->sr_msg.msg_flags; ++ flags = req->sr_msg.msg_flags | MSG_NOSIGNAL; + if (flags & MSG_DONTWAIT) + req->flags |= REQ_F_NOWAIT; + else if (force_nonblock) + flags |= MSG_DONTWAIT; + ++ if (flags & MSG_WAITALL) ++ min_ret = iov_iter_count(&kmsg->msg.msg_iter); ++ + ret = __sys_recvmsg_sock(sock, &kmsg->msg, req->sr_msg.umsg, + kmsg->uaddr, flags); + if (force_nonblock && ret == -EAGAIN) +@@ -4904,7 +4916,7 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock, + if (kmsg->iov != kmsg->fast_iov) + kfree(kmsg->iov); + req->flags &= ~REQ_F_NEED_CLEANUP; +- if (ret < 0) ++ if (ret < min_ret || ((flags & MSG_WAITALL) && (kmsg->msg.msg_flags & (MSG_TRUNC | MSG_CTRUNC)))) + req_set_fail_links(req); + __io_req_complete(req, ret, cflags, cs); + return 0; +@@ -4920,6 +4932,7 @@ static int io_recv(struct io_kiocb *req, bool force_nonblock, + struct socket *sock; + struct iovec iov; + unsigned flags; ++ int min_ret = 0; + int ret, cflags = 0; + + sock = sock_from_file(req->file); +@@ -4944,12 +4957,15 @@ static int io_recv(struct io_kiocb *req, bool force_nonblock, + msg.msg_iocb = NULL; + msg.msg_flags = 0; + +- flags = req->sr_msg.msg_flags; ++ flags = req->sr_msg.msg_flags | MSG_NOSIGNAL; + if (flags & MSG_DONTWAIT) + req->flags |= REQ_F_NOWAIT; + else if (force_nonblock) + flags |= MSG_DONTWAIT; + ++ if (flags & MSG_WAITALL) ++ min_ret = iov_iter_count(&msg.msg_iter); ++ + ret = sock_recvmsg(sock, &msg, flags); + if (force_nonblock && ret == -EAGAIN) + return -EAGAIN; +@@ -4958,7 +4974,7 @@ static int io_recv(struct io_kiocb *req, bool force_nonblock, + out_free: + if (req->flags & REQ_F_BUFFER_SELECTED) + cflags = io_put_recv_kbuf(req); +- if (ret < 0) ++ if (ret < min_ret || ((flags & MSG_WAITALL) && (msg.msg_flags & (MSG_TRUNC | MSG_CTRUNC)))) + req_set_fail_links(req); + __io_req_complete(req, ret, cflags, cs); + return 0; +@@ -6496,7 +6512,6 @@ static enum hrtimer_restart io_link_timeout_fn(struct hrtimer *timer) + spin_unlock_irqrestore(&ctx->completion_lock, flags); + + if (prev) { +- req_set_fail_links(prev); + io_async_find_and_cancel(ctx, req, prev->user_data, -ETIME); + io_put_req_deferred(prev, 1); + } else { +@@ -8723,6 +8738,14 @@ static __poll_t io_uring_poll(struct file *file, poll_table *wait) + if (!io_sqring_full(ctx)) + mask |= EPOLLOUT | EPOLLWRNORM; + ++ /* prevent SQPOLL from submitting new requests */ ++ if (ctx->sq_data) { ++ io_sq_thread_park(ctx->sq_data); ++ list_del_init(&ctx->sqd_list); ++ io_sqd_update_thread_idle(ctx->sq_data); ++ io_sq_thread_unpark(ctx->sq_data); ++ } ++ + /* + * Don't flush cqring overflow list here, just do a simple check. + * Otherwise there could possible be ABBA deadlock: +diff --git a/fs/iomap/swapfile.c b/fs/iomap/swapfile.c +index a648dbf6991e4..a5e478de14174 100644 +--- a/fs/iomap/swapfile.c ++++ b/fs/iomap/swapfile.c +@@ -170,6 +170,16 @@ int iomap_swapfile_activate(struct swap_info_struct *sis, + return ret; + } + ++ /* ++ * If this swapfile doesn't contain even a single page-aligned ++ * contiguous range of blocks, reject this useless swapfile to ++ * prevent confusion later on. ++ */ ++ if (isi.nr_pages == 0) { ++ pr_warn("swapon: Cannot find a single usable page in file.\n"); ++ return -EINVAL; ++ } ++ + *pagespan = 1 + isi.highest_ppage - isi.lowest_ppage; + sis->max = isi.nr_pages; + sis->pages = isi.nr_pages - 1; +diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig +index dbbc583d62730..248f1459c0399 100644 +--- a/fs/nfsd/Kconfig ++++ b/fs/nfsd/Kconfig +@@ -73,6 +73,7 @@ config NFSD_V4 + select NFSD_V3 + select FS_POSIX_ACL + select SUNRPC_GSS ++ select CRYPTO + select CRYPTO_MD5 + select CRYPTO_SHA256 + select GRACE_PERIOD +diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c +index 052be5bf9ef50..7325592b456e5 100644 +--- a/fs/nfsd/nfs4callback.c ++++ b/fs/nfsd/nfs4callback.c +@@ -1189,6 +1189,7 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata) + switch (task->tk_status) { + case -EIO: + case -ETIMEDOUT: ++ case -EACCES: + nfsd4_mark_cb_down(clp, task->tk_status); + } + break; +diff --git a/fs/reiserfs/xattr.h b/fs/reiserfs/xattr.h +index c764352447ba1..81bec2c80b25c 100644 +--- a/fs/reiserfs/xattr.h ++++ b/fs/reiserfs/xattr.h +@@ -43,7 +43,7 @@ void reiserfs_security_free(struct reiserfs_security_handle *sec); + + static inline int reiserfs_xattrs_initialized(struct super_block *sb) + { +- return REISERFS_SB(sb)->priv_root != NULL; ++ return REISERFS_SB(sb)->priv_root && REISERFS_SB(sb)->xattr_root; + } + + #define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header)) +diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h +index 2564e66e67d74..562cb5e455240 100644 +--- a/include/drm/ttm/ttm_bo_api.h ++++ b/include/drm/ttm/ttm_bo_api.h +@@ -612,8 +612,10 @@ static inline void ttm_bo_pin(struct ttm_buffer_object *bo) + static inline void ttm_bo_unpin(struct ttm_buffer_object *bo) + { + dma_resv_assert_held(bo->base.resv); +- WARN_ON_ONCE(!bo->pin_count); +- --bo->pin_count; ++ if (bo->pin_count) ++ --bo->pin_count; ++ else ++ WARN_ON_ONCE(true); + } + + int ttm_mem_evict_first(struct ttm_bo_device *bdev, +diff --git a/include/linux/acpi.h b/include/linux/acpi.h +index b20568c440013..2f7508c3c2d6a 100644 +--- a/include/linux/acpi.h ++++ b/include/linux/acpi.h +@@ -222,10 +222,14 @@ void __iomem *__acpi_map_table(unsigned long phys, unsigned long size); + void __acpi_unmap_table(void __iomem *map, unsigned long size); + int early_acpi_boot_init(void); + int acpi_boot_init (void); ++void acpi_boot_table_prepare (void); + void acpi_boot_table_init (void); + int acpi_mps_check (void); + int acpi_numa_init (void); + ++int acpi_locate_initial_tables (void); ++void acpi_reserve_initial_tables (void); ++void acpi_table_init_complete (void); + int acpi_table_init (void); + int acpi_table_parse(char *id, acpi_tbl_table_handler handler); + int __init acpi_table_parse_entries(char *id, unsigned long table_size, +@@ -807,9 +811,12 @@ static inline int acpi_boot_init(void) + return 0; + } + ++static inline void acpi_boot_table_prepare(void) ++{ ++} ++ + static inline void acpi_boot_table_init(void) + { +- return; + } + + static inline int acpi_mps_check(void) +diff --git a/include/linux/can/can-ml.h b/include/linux/can/can-ml.h +index 2f5d731ae251d..8afa92d15a664 100644 +--- a/include/linux/can/can-ml.h ++++ b/include/linux/can/can-ml.h +@@ -44,6 +44,7 @@ + + #include + #include ++#include + + #define CAN_SFF_RCV_ARRAY_SZ (1 << CAN_SFF_ID_BITS) + #define CAN_EFF_RCV_HASH_BITS 10 +@@ -65,4 +66,15 @@ struct can_ml_priv { + #endif + }; + ++static inline struct can_ml_priv *can_get_ml_priv(struct net_device *dev) ++{ ++ return netdev_get_ml_priv(dev, ML_PRIV_CAN); ++} ++ ++static inline void can_set_ml_priv(struct net_device *dev, ++ struct can_ml_priv *ml_priv) ++{ ++ netdev_set_ml_priv(dev, ml_priv, ML_PRIV_CAN); ++} ++ + #endif /* CAN_ML_H */ +diff --git a/include/linux/extcon.h b/include/linux/extcon.h +index fd183fb9c20f7..0c19010da77fa 100644 +--- a/include/linux/extcon.h ++++ b/include/linux/extcon.h +@@ -271,6 +271,29 @@ static inline void devm_extcon_unregister_notifier(struct device *dev, + struct extcon_dev *edev, unsigned int id, + struct notifier_block *nb) { } + ++static inline int extcon_register_notifier_all(struct extcon_dev *edev, ++ struct notifier_block *nb) ++{ ++ return 0; ++} ++ ++static inline int extcon_unregister_notifier_all(struct extcon_dev *edev, ++ struct notifier_block *nb) ++{ ++ return 0; ++} ++ ++static inline int devm_extcon_register_notifier_all(struct device *dev, ++ struct extcon_dev *edev, ++ struct notifier_block *nb) ++{ ++ return 0; ++} ++ ++static inline void devm_extcon_unregister_notifier_all(struct device *dev, ++ struct extcon_dev *edev, ++ struct notifier_block *nb) { } ++ + static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name) + { + return ERR_PTR(-ENODEV); +diff --git a/include/linux/firmware/intel/stratix10-svc-client.h b/include/linux/firmware/intel/stratix10-svc-client.h +index a93d85932eb92..f843c6a10cf36 100644 +--- a/include/linux/firmware/intel/stratix10-svc-client.h ++++ b/include/linux/firmware/intel/stratix10-svc-client.h +@@ -56,7 +56,7 @@ + * COMMAND_RECONFIG_FLAG_PARTIAL: + * Set to FPGA configuration type (full or partial). + */ +-#define COMMAND_RECONFIG_FLAG_PARTIAL 1 ++#define COMMAND_RECONFIG_FLAG_PARTIAL 0 + + /** + * Timeout settings for service clients: +diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h +index fb79ac497794b..688c7477ec0ab 100644 +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -1607,6 +1607,12 @@ enum netdev_priv_flags { + #define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER + #define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK + ++/* Specifies the type of the struct net_device::ml_priv pointer */ ++enum netdev_ml_priv_type { ++ ML_PRIV_NONE, ++ ML_PRIV_CAN, ++}; ++ + /** + * struct net_device - The DEVICE structure. + * +@@ -1802,6 +1808,7 @@ enum netdev_priv_flags { + * @nd_net: Network namespace this network device is inside + * + * @ml_priv: Mid-layer private ++ * @ml_priv_type: Mid-layer private type + * @lstats: Loopback statistics + * @tstats: Tunnel statistics + * @dstats: Dummy statistics +@@ -2114,8 +2121,10 @@ struct net_device { + possible_net_t nd_net; + + /* mid-layer private */ ++ void *ml_priv; ++ enum netdev_ml_priv_type ml_priv_type; ++ + union { +- void *ml_priv; + struct pcpu_lstats __percpu *lstats; + struct pcpu_sw_netstats __percpu *tstats; + struct pcpu_dstats __percpu *dstats; +@@ -2305,6 +2314,29 @@ static inline void netdev_reset_rx_headroom(struct net_device *dev) + netdev_set_rx_headroom(dev, -1); + } + ++static inline void *netdev_get_ml_priv(struct net_device *dev, ++ enum netdev_ml_priv_type type) ++{ ++ if (dev->ml_priv_type != type) ++ return NULL; ++ ++ return dev->ml_priv; ++} ++ ++static inline void netdev_set_ml_priv(struct net_device *dev, ++ void *ml_priv, ++ enum netdev_ml_priv_type type) ++{ ++ WARN(dev->ml_priv_type && dev->ml_priv_type != type, ++ "Overwriting already set ml_priv_type (%u) with different ml_priv_type (%u)!\n", ++ dev->ml_priv_type, type); ++ WARN(!dev->ml_priv_type && dev->ml_priv, ++ "Overwriting already set ml_priv and ml_priv_type is ML_PRIV_NONE!\n"); ++ ++ dev->ml_priv = ml_priv; ++ dev->ml_priv_type = type; ++} ++ + /* + * Net namespace inlines + */ +diff --git a/include/linux/qcom-geni-se.h b/include/linux/qcom-geni-se.h +index ec2ad4b0fe14f..c4fdb4463f7d5 100644 +--- a/include/linux/qcom-geni-se.h ++++ b/include/linux/qcom-geni-se.h +@@ -460,7 +460,5 @@ void geni_icc_set_tag(struct geni_se *se, u32 tag); + int geni_icc_enable(struct geni_se *se); + + int geni_icc_disable(struct geni_se *se); +- +-void geni_remove_earlycon_icc_vote(void); + #endif + #endif +diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h +index 850424e5d0306..6ecf2a0220dbe 100644 +--- a/include/linux/ww_mutex.h ++++ b/include/linux/ww_mutex.h +@@ -173,9 +173,10 @@ static inline void ww_acquire_done(struct ww_acquire_ctx *ctx) + */ + static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx) + { +-#ifdef CONFIG_DEBUG_MUTEXES ++#ifdef CONFIG_DEBUG_LOCK_ALLOC + mutex_release(&ctx->dep_map, _THIS_IP_); +- ++#endif ++#ifdef CONFIG_DEBUG_MUTEXES + DEBUG_LOCKS_WARN_ON(ctx->acquired); + if (!IS_ENABLED(CONFIG_PROVE_LOCKING)) + /* +diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c +index 5352ce50a97e3..2c25b830203cd 100644 +--- a/kernel/locking/mutex.c ++++ b/kernel/locking/mutex.c +@@ -636,7 +636,7 @@ static inline int mutex_can_spin_on_owner(struct mutex *lock) + */ + static __always_inline bool + mutex_optimistic_spin(struct mutex *lock, struct ww_acquire_ctx *ww_ctx, +- const bool use_ww_ctx, struct mutex_waiter *waiter) ++ struct mutex_waiter *waiter) + { + if (!waiter) { + /* +@@ -712,7 +712,7 @@ fail: + #else + static __always_inline bool + mutex_optimistic_spin(struct mutex *lock, struct ww_acquire_ctx *ww_ctx, +- const bool use_ww_ctx, struct mutex_waiter *waiter) ++ struct mutex_waiter *waiter) + { + return false; + } +@@ -932,6 +932,9 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, + struct ww_mutex *ww; + int ret; + ++ if (!use_ww_ctx) ++ ww_ctx = NULL; ++ + might_sleep(); + + #ifdef CONFIG_DEBUG_MUTEXES +@@ -939,7 +942,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, + #endif + + ww = container_of(lock, struct ww_mutex, base); +- if (use_ww_ctx && ww_ctx) { ++ if (ww_ctx) { + if (unlikely(ww_ctx == READ_ONCE(ww->ctx))) + return -EALREADY; + +@@ -956,10 +959,10 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, + mutex_acquire_nest(&lock->dep_map, subclass, 0, nest_lock, ip); + + if (__mutex_trylock(lock) || +- mutex_optimistic_spin(lock, ww_ctx, use_ww_ctx, NULL)) { ++ mutex_optimistic_spin(lock, ww_ctx, NULL)) { + /* got the lock, yay! */ + lock_acquired(&lock->dep_map, ip); +- if (use_ww_ctx && ww_ctx) ++ if (ww_ctx) + ww_mutex_set_context_fastpath(ww, ww_ctx); + preempt_enable(); + return 0; +@@ -970,7 +973,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, + * After waiting to acquire the wait_lock, try again. + */ + if (__mutex_trylock(lock)) { +- if (use_ww_ctx && ww_ctx) ++ if (ww_ctx) + __ww_mutex_check_waiters(lock, ww_ctx); + + goto skip_wait; +@@ -1023,7 +1026,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, + goto err; + } + +- if (use_ww_ctx && ww_ctx) { ++ if (ww_ctx) { + ret = __ww_mutex_check_kill(lock, &waiter, ww_ctx); + if (ret) + goto err; +@@ -1036,7 +1039,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, + * ww_mutex needs to always recheck its position since its waiter + * list is not FIFO ordered. + */ +- if ((use_ww_ctx && ww_ctx) || !first) { ++ if (ww_ctx || !first) { + first = __mutex_waiter_is_first(lock, &waiter); + if (first) + __mutex_set_flag(lock, MUTEX_FLAG_HANDOFF); +@@ -1049,7 +1052,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, + * or we must see its unlock and acquire. + */ + if (__mutex_trylock(lock) || +- (first && mutex_optimistic_spin(lock, ww_ctx, use_ww_ctx, &waiter))) ++ (first && mutex_optimistic_spin(lock, ww_ctx, &waiter))) + break; + + spin_lock(&lock->wait_lock); +@@ -1058,7 +1061,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, + acquired: + __set_current_state(TASK_RUNNING); + +- if (use_ww_ctx && ww_ctx) { ++ if (ww_ctx) { + /* + * Wound-Wait; we stole the lock (!first_waiter), check the + * waiters as anyone might want to wound us. +@@ -1078,7 +1081,7 @@ skip_wait: + /* got the lock - cleanup and rejoice! */ + lock_acquired(&lock->dep_map, ip); + +- if (use_ww_ctx && ww_ctx) ++ if (ww_ctx) + ww_mutex_lock_acquired(ww, ww_ctx); + + spin_unlock(&lock->wait_lock); +diff --git a/kernel/reboot.c b/kernel/reboot.c +index eb1b158507616..a6ad5eb2fa733 100644 +--- a/kernel/reboot.c ++++ b/kernel/reboot.c +@@ -244,8 +244,6 @@ void migrate_to_reboot_cpu(void) + void kernel_restart(char *cmd) + { + kernel_restart_prepare(cmd); +- if (pm_power_off_prepare) +- pm_power_off_prepare(); + migrate_to_reboot_cpu(); + syscore_shutdown(); + if (!cmd) +diff --git a/kernel/static_call.c b/kernel/static_call.c +index 49efbdc5b4800..f59089a122319 100644 +--- a/kernel/static_call.c ++++ b/kernel/static_call.c +@@ -149,6 +149,7 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func) + }; + + for (site_mod = &first; site_mod; site_mod = site_mod->next) { ++ bool init = system_state < SYSTEM_RUNNING; + struct module *mod = site_mod->mod; + + if (!site_mod->sites) { +@@ -168,6 +169,7 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func) + if (mod) { + stop = mod->static_call_sites + + mod->num_static_call_sites; ++ init = mod->state == MODULE_STATE_COMING; + } + #endif + +@@ -175,16 +177,8 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func) + site < stop && static_call_key(site) == key; site++) { + void *site_addr = static_call_addr(site); + +- if (static_call_is_init(site)) { +- /* +- * Don't write to call sites which were in +- * initmem and have since been freed. +- */ +- if (!mod && system_state >= SYSTEM_RUNNING) +- continue; +- if (mod && !within_module_init((unsigned long)site_addr, mod)) +- continue; +- } ++ if (!init && static_call_is_init(site)) ++ continue; + + if (!kernel_text_address((unsigned long)site_addr)) { + /* +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c +index b5815a022ecc2..c27b05aeb7d2d 100644 +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -2984,7 +2984,8 @@ static void __ftrace_trace_stack(struct trace_buffer *buffer, + + size = nr_entries * sizeof(unsigned long); + event = __trace_buffer_lock_reserve(buffer, TRACE_STACK, +- sizeof(*entry) + size, flags, pc); ++ (sizeof(*entry) - sizeof(entry->caller)) + size, ++ flags, pc); + if (!event) + goto out; + entry = ring_buffer_event_data(event); +diff --git a/mm/memory.c b/mm/memory.c +index 97e1d045f236f..bf0cbc8d56176 100644 +--- a/mm/memory.c ++++ b/mm/memory.c +@@ -154,7 +154,7 @@ static int __init init_zero_pfn(void) + zero_pfn = page_to_pfn(ZERO_PAGE(0)); + return 0; + } +-core_initcall(init_zero_pfn); ++early_initcall(init_zero_pfn); + + void mm_trace_rss_stat(struct mm_struct *mm, int member, long count) + { +diff --git a/net/9p/client.c b/net/9p/client.c +index 4f62f299da0cf..0a9019da18f39 100644 +--- a/net/9p/client.c ++++ b/net/9p/client.c +@@ -1623,10 +1623,6 @@ p9_client_read_once(struct p9_fid *fid, u64 offset, struct iov_iter *to, + } + + p9_debug(P9_DEBUG_9P, "<<< RREAD count %d\n", count); +- if (!count) { +- p9_tag_remove(clnt, req); +- return 0; +- } + + if (non_zc) { + int n = copy_to_iter(dataptr, count, to); +diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c +index ca1a0d07a0878..ebda397fa95a7 100644 +--- a/net/appletalk/ddp.c ++++ b/net/appletalk/ddp.c +@@ -1577,8 +1577,8 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) + struct sk_buff *skb; + struct net_device *dev; + struct ddpehdr *ddp; +- int size; +- struct atalk_route *rt; ++ int size, hard_header_len; ++ struct atalk_route *rt, *rt_lo = NULL; + int err; + + if (flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) +@@ -1641,7 +1641,22 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) + SOCK_DEBUG(sk, "SK %p: Size needed %d, device %s\n", + sk, size, dev->name); + +- size += dev->hard_header_len; ++ hard_header_len = dev->hard_header_len; ++ /* Leave room for loopback hardware header if necessary */ ++ if (usat->sat_addr.s_node == ATADDR_BCAST && ++ (dev->flags & IFF_LOOPBACK || !(rt->flags & RTF_GATEWAY))) { ++ struct atalk_addr at_lo; ++ ++ at_lo.s_node = 0; ++ at_lo.s_net = 0; ++ ++ rt_lo = atrtr_find(&at_lo); ++ ++ if (rt_lo && rt_lo->dev->hard_header_len > hard_header_len) ++ hard_header_len = rt_lo->dev->hard_header_len; ++ } ++ ++ size += hard_header_len; + release_sock(sk); + skb = sock_alloc_send_skb(sk, size, (flags & MSG_DONTWAIT), &err); + lock_sock(sk); +@@ -1649,7 +1664,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) + goto out; + + skb_reserve(skb, ddp_dl->header_length); +- skb_reserve(skb, dev->hard_header_len); ++ skb_reserve(skb, hard_header_len); + skb->dev = dev; + + SOCK_DEBUG(sk, "SK %p: Begin build.\n", sk); +@@ -1700,18 +1715,12 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) + /* loop back */ + skb_orphan(skb); + if (ddp->deh_dnode == ATADDR_BCAST) { +- struct atalk_addr at_lo; +- +- at_lo.s_node = 0; +- at_lo.s_net = 0; +- +- rt = atrtr_find(&at_lo); +- if (!rt) { ++ if (!rt_lo) { + kfree_skb(skb); + err = -ENETUNREACH; + goto out; + } +- dev = rt->dev; ++ dev = rt_lo->dev; + skb->dev = dev; + } + ddp_dl->request(ddp_dl, skb, dev->dev_addr); +diff --git a/net/can/af_can.c b/net/can/af_can.c +index 837bb8af0ec30..cce2af10eb3ea 100644 +--- a/net/can/af_can.c ++++ b/net/can/af_can.c +@@ -304,8 +304,8 @@ static struct can_dev_rcv_lists *can_dev_rcv_lists_find(struct net *net, + struct net_device *dev) + { + if (dev) { +- struct can_ml_priv *ml_priv = dev->ml_priv; +- return &ml_priv->dev_rcv_lists; ++ struct can_ml_priv *can_ml = can_get_ml_priv(dev); ++ return &can_ml->dev_rcv_lists; + } else { + return net->can.rx_alldev_list; + } +@@ -790,25 +790,6 @@ void can_proto_unregister(const struct can_proto *cp) + } + EXPORT_SYMBOL(can_proto_unregister); + +-/* af_can notifier to create/remove CAN netdevice specific structs */ +-static int can_notifier(struct notifier_block *nb, unsigned long msg, +- void *ptr) +-{ +- struct net_device *dev = netdev_notifier_info_to_dev(ptr); +- +- if (dev->type != ARPHRD_CAN) +- return NOTIFY_DONE; +- +- switch (msg) { +- case NETDEV_REGISTER: +- WARN(!dev->ml_priv, +- "No CAN mid layer private allocated, please fix your driver and use alloc_candev()!\n"); +- break; +- } +- +- return NOTIFY_DONE; +-} +- + static int can_pernet_init(struct net *net) + { + spin_lock_init(&net->can.rcvlists_lock); +@@ -876,11 +857,6 @@ static const struct net_proto_family can_family_ops = { + .owner = THIS_MODULE, + }; + +-/* notifier block for netdevice event */ +-static struct notifier_block can_netdev_notifier __read_mostly = { +- .notifier_call = can_notifier, +-}; +- + static struct pernet_operations can_pernet_ops __read_mostly = { + .init = can_pernet_init, + .exit = can_pernet_exit, +@@ -911,17 +887,12 @@ static __init int can_init(void) + err = sock_register(&can_family_ops); + if (err) + goto out_sock; +- err = register_netdevice_notifier(&can_netdev_notifier); +- if (err) +- goto out_notifier; + + dev_add_pack(&can_packet); + dev_add_pack(&canfd_packet); + + return 0; + +-out_notifier: +- sock_unregister(PF_CAN); + out_sock: + unregister_pernet_subsys(&can_pernet_ops); + out_pernet: +@@ -935,7 +906,6 @@ static __exit void can_exit(void) + /* protocol unregister */ + dev_remove_pack(&canfd_packet); + dev_remove_pack(&can_packet); +- unregister_netdevice_notifier(&can_netdev_notifier); + sock_unregister(PF_CAN); + + unregister_pernet_subsys(&can_pernet_ops); +diff --git a/net/can/j1939/main.c b/net/can/j1939/main.c +index bb914d8b42168..da3a7a7bcff2b 100644 +--- a/net/can/j1939/main.c ++++ b/net/can/j1939/main.c +@@ -140,9 +140,9 @@ static struct j1939_priv *j1939_priv_create(struct net_device *ndev) + static inline void j1939_priv_set(struct net_device *ndev, + struct j1939_priv *priv) + { +- struct can_ml_priv *can_ml_priv = ndev->ml_priv; ++ struct can_ml_priv *can_ml = can_get_ml_priv(ndev); + +- can_ml_priv->j1939_priv = priv; ++ can_ml->j1939_priv = priv; + } + + static void __j1939_priv_release(struct kref *kref) +@@ -211,12 +211,9 @@ static void __j1939_rx_release(struct kref *kref) + /* get pointer to priv without increasing ref counter */ + static inline struct j1939_priv *j1939_ndev_to_priv(struct net_device *ndev) + { +- struct can_ml_priv *can_ml_priv = ndev->ml_priv; ++ struct can_ml_priv *can_ml = can_get_ml_priv(ndev); + +- if (!can_ml_priv) +- return NULL; +- +- return can_ml_priv->j1939_priv; ++ return can_ml->j1939_priv; + } + + static struct j1939_priv *j1939_priv_get_by_ndev_locked(struct net_device *ndev) +@@ -225,9 +222,6 @@ static struct j1939_priv *j1939_priv_get_by_ndev_locked(struct net_device *ndev) + + lockdep_assert_held(&j1939_netdev_lock); + +- if (ndev->type != ARPHRD_CAN) +- return NULL; +- + priv = j1939_ndev_to_priv(ndev); + if (priv) + j1939_priv_get(priv); +@@ -348,15 +342,16 @@ static int j1939_netdev_notify(struct notifier_block *nb, + unsigned long msg, void *data) + { + struct net_device *ndev = netdev_notifier_info_to_dev(data); ++ struct can_ml_priv *can_ml = can_get_ml_priv(ndev); + struct j1939_priv *priv; + ++ if (!can_ml) ++ goto notify_done; ++ + priv = j1939_priv_get_by_ndev(ndev); + if (!priv) + goto notify_done; + +- if (ndev->type != ARPHRD_CAN) +- goto notify_put; +- + switch (msg) { + case NETDEV_DOWN: + j1939_cancel_active_session(priv, NULL); +@@ -365,7 +360,6 @@ static int j1939_netdev_notify(struct notifier_block *nb, + break; + } + +-notify_put: + j1939_priv_put(priv); + + notify_done: +diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c +index f23966526a885..56aa66147d5ac 100644 +--- a/net/can/j1939/socket.c ++++ b/net/can/j1939/socket.c +@@ -12,6 +12,7 @@ + + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + ++#include + #include + #include + #include +@@ -453,6 +454,7 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) + j1939_jsk_del(priv, jsk); + j1939_local_ecu_put(priv, jsk->addr.src_name, jsk->addr.sa); + } else { ++ struct can_ml_priv *can_ml; + struct net_device *ndev; + + ndev = dev_get_by_index(net, addr->can_ifindex); +@@ -461,15 +463,8 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) + goto out_release_sock; + } + +- if (ndev->type != ARPHRD_CAN) { +- dev_put(ndev); +- ret = -ENODEV; +- goto out_release_sock; +- } +- +- if (!ndev->ml_priv) { +- netdev_warn_once(ndev, +- "No CAN mid layer private allocated, please fix your driver and use alloc_candev()!\n"); ++ can_ml = can_get_ml_priv(ndev); ++ if (!can_ml) { + dev_put(ndev); + ret = -ENODEV; + goto out_release_sock; +diff --git a/net/can/proc.c b/net/can/proc.c +index 5ea8695f507eb..b15760b5c1cce 100644 +--- a/net/can/proc.c ++++ b/net/can/proc.c +@@ -322,8 +322,11 @@ static int can_rcvlist_proc_show(struct seq_file *m, void *v) + + /* receive list for registered CAN devices */ + for_each_netdev_rcu(net, dev) { +- if (dev->type == ARPHRD_CAN && dev->ml_priv) +- can_rcvlist_proc_show_one(m, idx, dev, dev->ml_priv); ++ struct can_ml_priv *can_ml = can_get_ml_priv(dev); ++ ++ if (can_ml) ++ can_rcvlist_proc_show_one(m, idx, dev, ++ &can_ml->dev_rcv_lists); + } + + rcu_read_unlock(); +@@ -375,8 +378,10 @@ static int can_rcvlist_sff_proc_show(struct seq_file *m, void *v) + + /* sff receive list for registered CAN devices */ + for_each_netdev_rcu(net, dev) { +- if (dev->type == ARPHRD_CAN && dev->ml_priv) { +- dev_rcv_lists = dev->ml_priv; ++ struct can_ml_priv *can_ml = can_get_ml_priv(dev); ++ ++ if (can_ml) { ++ dev_rcv_lists = &can_ml->dev_rcv_lists; + can_rcvlist_proc_show_array(m, dev, dev_rcv_lists->rx_sff, + ARRAY_SIZE(dev_rcv_lists->rx_sff)); + } +@@ -406,8 +411,10 @@ static int can_rcvlist_eff_proc_show(struct seq_file *m, void *v) + + /* eff receive list for registered CAN devices */ + for_each_netdev_rcu(net, dev) { +- if (dev->type == ARPHRD_CAN && dev->ml_priv) { +- dev_rcv_lists = dev->ml_priv; ++ struct can_ml_priv *can_ml = can_get_ml_priv(dev); ++ ++ if (can_ml) { ++ dev_rcv_lists = &can_ml->dev_rcv_lists; + can_rcvlist_proc_show_array(m, dev, dev_rcv_lists->rx_eff, + ARRAY_SIZE(dev_rcv_lists->rx_eff)); + } +diff --git a/net/core/filter.c b/net/core/filter.c +index ee665720a41a0..8e4cc25cc98e1 100644 +--- a/net/core/filter.c ++++ b/net/core/filter.c +@@ -3552,11 +3552,7 @@ static int bpf_skb_net_shrink(struct sk_buff *skb, u32 off, u32 len_diff, + return 0; + } + +-static u32 __bpf_skb_max_len(const struct sk_buff *skb) +-{ +- return skb->dev ? skb->dev->mtu + skb->dev->hard_header_len : +- SKB_MAX_ALLOC; +-} ++#define BPF_SKB_MAX_LEN SKB_MAX_ALLOC + + BPF_CALL_4(sk_skb_adjust_room, struct sk_buff *, skb, s32, len_diff, + u32, mode, u64, flags) +@@ -3605,7 +3601,7 @@ BPF_CALL_4(bpf_skb_adjust_room, struct sk_buff *, skb, s32, len_diff, + { + u32 len_cur, len_diff_abs = abs(len_diff); + u32 len_min = bpf_skb_net_base_len(skb); +- u32 len_max = __bpf_skb_max_len(skb); ++ u32 len_max = BPF_SKB_MAX_LEN; + __be16 proto = skb->protocol; + bool shrink = len_diff < 0; + u32 off; +@@ -3688,7 +3684,7 @@ static int bpf_skb_trim_rcsum(struct sk_buff *skb, unsigned int new_len) + static inline int __bpf_skb_change_tail(struct sk_buff *skb, u32 new_len, + u64 flags) + { +- u32 max_len = __bpf_skb_max_len(skb); ++ u32 max_len = BPF_SKB_MAX_LEN; + u32 min_len = __bpf_skb_min_len(skb); + int ret; + +@@ -3764,7 +3760,7 @@ static const struct bpf_func_proto sk_skb_change_tail_proto = { + static inline int __bpf_skb_change_head(struct sk_buff *skb, u32 head_room, + u64 flags) + { +- u32 max_len = __bpf_skb_max_len(skb); ++ u32 max_len = BPF_SKB_MAX_LEN; + u32 new_len = skb->len + head_room; + int ret; + +diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c +index 7a06d43016175..180be5102efc5 100644 +--- a/net/core/flow_dissector.c ++++ b/net/core/flow_dissector.c +@@ -1050,6 +1050,9 @@ proto_again: + key_control->addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; + } + ++ __skb_flow_dissect_ipv4(skb, flow_dissector, ++ target_container, data, iph); ++ + if (ip_is_fragment(iph)) { + key_control->flags |= FLOW_DIS_IS_FRAGMENT; + +@@ -1066,9 +1069,6 @@ proto_again: + } + } + +- __skb_flow_dissect_ipv4(skb, flow_dissector, +- target_container, data, iph); +- + break; + } + case htons(ETH_P_IPV6): { +diff --git a/net/mptcp/options.c b/net/mptcp/options.c +index 37ef0bf098f6d..9e86c601093f4 100644 +--- a/net/mptcp/options.c ++++ b/net/mptcp/options.c +@@ -885,8 +885,7 @@ static void ack_update_msk(struct mptcp_sock *msk, + msk->wnd_end = new_wnd_end; + + /* this assumes mptcp_incoming_options() is invoked after tcp_ack() */ +- if (after64(msk->wnd_end, READ_ONCE(msk->snd_nxt)) && +- sk_stream_memory_free(ssk)) ++ if (after64(msk->wnd_end, READ_ONCE(msk->snd_nxt))) + __mptcp_check_push(sk, ssk); + + if (after64(new_snd_una, old_snd_una)) { +diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c +index 7345df40385ab..5932b0ebecc31 100644 +--- a/net/mptcp/protocol.c ++++ b/net/mptcp/protocol.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -19,6 +20,7 @@ + #include + #if IS_ENABLED(CONFIG_MPTCP_IPV6) + #include ++#include + #endif + #include + #include +@@ -1440,7 +1442,7 @@ static void mptcp_push_release(struct sock *sk, struct sock *ssk, + release_sock(ssk); + } + +-static void mptcp_push_pending(struct sock *sk, unsigned int flags) ++static void __mptcp_push_pending(struct sock *sk, unsigned int flags) + { + struct sock *prev_ssk = NULL, *ssk = NULL; + struct mptcp_sock *msk = mptcp_sk(sk); +@@ -1568,6 +1570,9 @@ out: + mptcp_set_timeout(sk, ssk); + tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, + info.size_goal); ++ if (!mptcp_timer_pending(sk)) ++ mptcp_reset_timer(sk); ++ + if (msk->snd_data_fin_enable && + msk->snd_nxt + 1 == msk->write_seq) + mptcp_schedule_work(sk); +@@ -1676,14 +1681,14 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) + + wait_for_memory: + set_bit(MPTCP_NOSPACE, &msk->flags); +- mptcp_push_pending(sk, msg->msg_flags); ++ __mptcp_push_pending(sk, msg->msg_flags); + ret = sk_stream_wait_memory(sk, &timeo); + if (ret) + goto out; + } + + if (copied) +- mptcp_push_pending(sk, msg->msg_flags); ++ __mptcp_push_pending(sk, msg->msg_flags); + + out: + release_sock(sk); +@@ -2289,13 +2294,12 @@ static void mptcp_worker(struct work_struct *work) + __mptcp_check_send_data_fin(sk); + mptcp_check_data_fin(sk); + +- /* if the msk data is completely acked, or the socket timedout, +- * there is no point in keeping around an orphaned sk ++ /* There is no point in keeping around an orphaned sk timedout or ++ * closed, but we need the msk around to reply to incoming DATA_FIN, ++ * even if it is orphaned and in FIN_WAIT2 state + */ + if (sock_flag(sk, SOCK_DEAD) && +- (mptcp_check_close_timeout(sk) || +- (state != sk->sk_state && +- ((1 << inet_sk_state_load(sk)) & (TCPF_CLOSE | TCPF_FIN_WAIT2))))) { ++ (mptcp_check_close_timeout(sk) || sk->sk_state == TCP_CLOSE)) { + inet_sk_state_store(sk, TCP_CLOSE); + __mptcp_destroy_sock(sk); + goto unlock; +@@ -2940,13 +2944,14 @@ static void mptcp_release_cb(struct sock *sk) + { + unsigned long flags, nflags; + +- /* push_pending may touch wmem_reserved, do it before the later +- * cleanup +- */ +- if (test_and_clear_bit(MPTCP_CLEAN_UNA, &mptcp_sk(sk)->flags)) +- __mptcp_clean_una(sk); +- if (test_and_clear_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags)) { +- /* mptcp_push_pending() acquires the subflow socket lock ++ for (;;) { ++ flags = 0; ++ if (test_and_clear_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags)) ++ flags |= BIT(MPTCP_PUSH_PENDING); ++ if (!flags) ++ break; ++ ++ /* the following actions acquire the subflow socket lock + * + * 1) can't be invoked in atomic scope + * 2) must avoid ABBA deadlock with msk socket spinlock: the RX +@@ -2955,11 +2960,21 @@ static void mptcp_release_cb(struct sock *sk) + */ + + spin_unlock_bh(&sk->sk_lock.slock); +- mptcp_push_pending(sk, 0); ++ if (flags & BIT(MPTCP_PUSH_PENDING)) ++ __mptcp_push_pending(sk, 0); ++ ++ cond_resched(); + spin_lock_bh(&sk->sk_lock.slock); + } + +- /* clear any wmem reservation and errors */ ++ if (test_and_clear_bit(MPTCP_CLEAN_UNA, &mptcp_sk(sk)->flags)) ++ __mptcp_clean_una(sk); ++ if (test_and_clear_bit(MPTCP_ERROR_REPORT, &mptcp_sk(sk)->flags)) ++ __mptcp_error_report(sk); ++ ++ /* push_pending may touch wmem_reserved, ensure we do the cleanup ++ * later ++ */ + __mptcp_update_wmem(sk); + __mptcp_update_rmem(sk); + +@@ -3318,7 +3333,7 @@ static __poll_t mptcp_check_writeable(struct mptcp_sock *msk) + struct sock *sk = (struct sock *)msk; + + if (unlikely(sk->sk_shutdown & SEND_SHUTDOWN)) +- return 0; ++ return EPOLLOUT | EPOLLWRNORM; + + if (sk_stream_is_writeable(sk)) + return EPOLLOUT | EPOLLWRNORM; +@@ -3351,16 +3366,47 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock, + mask |= mptcp_check_readable(msk); + mask |= mptcp_check_writeable(msk); + } ++ if (sk->sk_shutdown == SHUTDOWN_MASK || state == TCP_CLOSE) ++ mask |= EPOLLHUP; + if (sk->sk_shutdown & RCV_SHUTDOWN) + mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP; + ++ /* This barrier is coupled with smp_wmb() in tcp_reset() */ ++ smp_rmb(); ++ if (sk->sk_err) ++ mask |= EPOLLERR; ++ + return mask; + } + ++static int mptcp_release(struct socket *sock) ++{ ++ struct mptcp_subflow_context *subflow; ++ struct sock *sk = sock->sk; ++ struct mptcp_sock *msk; ++ ++ if (!sk) ++ return 0; ++ ++ lock_sock(sk); ++ ++ msk = mptcp_sk(sk); ++ ++ mptcp_for_each_subflow(msk, subflow) { ++ struct sock *ssk = mptcp_subflow_tcp_sock(subflow); ++ ++ ip_mc_drop_socket(ssk); ++ } ++ ++ release_sock(sk); ++ ++ return inet_release(sock); ++} ++ + static const struct proto_ops mptcp_stream_ops = { + .family = PF_INET, + .owner = THIS_MODULE, +- .release = inet_release, ++ .release = mptcp_release, + .bind = mptcp_bind, + .connect = mptcp_stream_connect, + .socketpair = sock_no_socketpair, +@@ -3407,10 +3453,35 @@ void __init mptcp_proto_init(void) + } + + #if IS_ENABLED(CONFIG_MPTCP_IPV6) ++static int mptcp6_release(struct socket *sock) ++{ ++ struct mptcp_subflow_context *subflow; ++ struct mptcp_sock *msk; ++ struct sock *sk = sock->sk; ++ ++ if (!sk) ++ return 0; ++ ++ lock_sock(sk); ++ ++ msk = mptcp_sk(sk); ++ ++ mptcp_for_each_subflow(msk, subflow) { ++ struct sock *ssk = mptcp_subflow_tcp_sock(subflow); ++ ++ ip_mc_drop_socket(ssk); ++ ipv6_sock_mc_close(ssk); ++ ipv6_sock_ac_close(ssk); ++ } ++ ++ release_sock(sk); ++ return inet6_release(sock); ++} ++ + static const struct proto_ops mptcp_v6_stream_ops = { + .family = PF_INET6, + .owner = THIS_MODULE, +- .release = inet6_release, ++ .release = mptcp6_release, + .bind = mptcp_bind, + .connect = mptcp_stream_connect, + .socketpair = sock_no_socketpair, +diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h +index c374345ad1349..62288836d0534 100644 +--- a/net/mptcp/protocol.h ++++ b/net/mptcp/protocol.h +@@ -96,6 +96,7 @@ + #define MPTCP_WORK_CLOSE_SUBFLOW 5 + #define MPTCP_PUSH_PENDING 6 + #define MPTCP_CLEAN_UNA 7 ++#define MPTCP_ERROR_REPORT 8 + + static inline bool before64(__u64 seq1, __u64 seq2) + { +@@ -413,6 +414,7 @@ struct mptcp_subflow_context { + void (*tcp_data_ready)(struct sock *sk); + void (*tcp_state_change)(struct sock *sk); + void (*tcp_write_space)(struct sock *sk); ++ void (*tcp_error_report)(struct sock *sk); + + struct rcu_head rcu; + }; +@@ -478,6 +480,7 @@ static inline void mptcp_subflow_tcp_fallback(struct sock *sk, + sk->sk_data_ready = ctx->tcp_data_ready; + sk->sk_state_change = ctx->tcp_state_change; + sk->sk_write_space = ctx->tcp_write_space; ++ sk->sk_error_report = ctx->tcp_error_report; + + inet_csk(sk)->icsk_af_ops = ctx->icsk_af_ops; + } +@@ -505,6 +508,7 @@ bool mptcp_finish_join(struct sock *sk); + bool mptcp_schedule_work(struct sock *sk); + void __mptcp_check_push(struct sock *sk, struct sock *ssk); + void __mptcp_data_acked(struct sock *sk); ++void __mptcp_error_report(struct sock *sk); + void mptcp_subflow_eof(struct sock *sk); + bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit); + void __mptcp_flush_join_list(struct mptcp_sock *msk); +diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c +index 96e040951cd40..f97f29df4505e 100644 +--- a/net/mptcp/subflow.c ++++ b/net/mptcp/subflow.c +@@ -92,7 +92,7 @@ static struct mptcp_sock *subflow_token_join_request(struct request_sock *req, + return msk; + } + +-static int __subflow_init_req(struct request_sock *req, const struct sock *sk_listener) ++static void subflow_init_req(struct request_sock *req, const struct sock *sk_listener) + { + struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + +@@ -100,16 +100,6 @@ static int __subflow_init_req(struct request_sock *req, const struct sock *sk_li + subflow_req->mp_join = 0; + subflow_req->msk = NULL; + mptcp_token_init_request(req); +- +-#ifdef CONFIG_TCP_MD5SIG +- /* no MPTCP if MD5SIG is enabled on this socket or we may run out of +- * TCP option space. +- */ +- if (rcu_access_pointer(tcp_sk(sk_listener)->md5sig_info)) +- return -EINVAL; +-#endif +- +- return 0; + } + + /* Init mptcp request socket. +@@ -117,20 +107,23 @@ static int __subflow_init_req(struct request_sock *req, const struct sock *sk_li + * Returns an error code if a JOIN has failed and a TCP reset + * should be sent. + */ +-static int subflow_init_req(struct request_sock *req, +- const struct sock *sk_listener, +- struct sk_buff *skb) ++static int subflow_check_req(struct request_sock *req, ++ const struct sock *sk_listener, ++ struct sk_buff *skb) + { + struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk_listener); + struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + struct mptcp_options_received mp_opt; +- int ret; + + pr_debug("subflow_req=%p, listener=%p", subflow_req, listener); + +- ret = __subflow_init_req(req, sk_listener); +- if (ret) +- return 0; ++#ifdef CONFIG_TCP_MD5SIG ++ /* no MPTCP if MD5SIG is enabled on this socket or we may run out of ++ * TCP option space. ++ */ ++ if (rcu_access_pointer(tcp_sk(sk_listener)->md5sig_info)) ++ return -EINVAL; ++#endif + + mptcp_get_options(skb, &mp_opt); + +@@ -205,10 +198,7 @@ int mptcp_subflow_init_cookie_req(struct request_sock *req, + struct mptcp_options_received mp_opt; + int err; + +- err = __subflow_init_req(req, sk_listener); +- if (err) +- return err; +- ++ subflow_init_req(req, sk_listener); + mptcp_get_options(skb, &mp_opt); + + if (mp_opt.mp_capable && mp_opt.mp_join) +@@ -248,12 +238,13 @@ static struct dst_entry *subflow_v4_route_req(const struct sock *sk, + int err; + + tcp_rsk(req)->is_mptcp = 1; ++ subflow_init_req(req, sk); + + dst = tcp_request_sock_ipv4_ops.route_req(sk, skb, fl, req); + if (!dst) + return NULL; + +- err = subflow_init_req(req, sk, skb); ++ err = subflow_check_req(req, sk, skb); + if (err == 0) + return dst; + +@@ -273,12 +264,13 @@ static struct dst_entry *subflow_v6_route_req(const struct sock *sk, + int err; + + tcp_rsk(req)->is_mptcp = 1; ++ subflow_init_req(req, sk); + + dst = tcp_request_sock_ipv6_ops.route_req(sk, skb, fl, req); + if (!dst) + return NULL; + +- err = subflow_init_req(req, sk, skb); ++ err = subflow_check_req(req, sk, skb); + if (err == 0) + return dst; + +@@ -1054,6 +1046,46 @@ static void subflow_write_space(struct sock *ssk) + /* we take action in __mptcp_clean_una() */ + } + ++void __mptcp_error_report(struct sock *sk) ++{ ++ struct mptcp_subflow_context *subflow; ++ struct mptcp_sock *msk = mptcp_sk(sk); ++ ++ mptcp_for_each_subflow(msk, subflow) { ++ struct sock *ssk = mptcp_subflow_tcp_sock(subflow); ++ int err = sock_error(ssk); ++ ++ if (!err) ++ continue; ++ ++ /* only propagate errors on fallen-back sockets or ++ * on MPC connect ++ */ ++ if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(msk)) ++ continue; ++ ++ inet_sk_state_store(sk, inet_sk_state_load(ssk)); ++ sk->sk_err = -err; ++ ++ /* This barrier is coupled with smp_rmb() in mptcp_poll() */ ++ smp_wmb(); ++ sk->sk_error_report(sk); ++ break; ++ } ++} ++ ++static void subflow_error_report(struct sock *ssk) ++{ ++ struct sock *sk = mptcp_subflow_ctx(ssk)->conn; ++ ++ mptcp_data_lock(sk); ++ if (!sock_owned_by_user(sk)) ++ __mptcp_error_report(sk); ++ else ++ set_bit(MPTCP_ERROR_REPORT, &mptcp_sk(sk)->flags); ++ mptcp_data_unlock(sk); ++} ++ + static struct inet_connection_sock_af_ops * + subflow_default_af_ops(struct sock *sk) + { +@@ -1367,9 +1399,11 @@ static int subflow_ulp_init(struct sock *sk) + ctx->tcp_data_ready = sk->sk_data_ready; + ctx->tcp_state_change = sk->sk_state_change; + ctx->tcp_write_space = sk->sk_write_space; ++ ctx->tcp_error_report = sk->sk_error_report; + sk->sk_data_ready = subflow_data_ready; + sk->sk_write_space = subflow_write_space; + sk->sk_state_change = subflow_state_change; ++ sk->sk_error_report = subflow_error_report; + out: + return err; + } +@@ -1422,6 +1456,7 @@ static void subflow_ulp_clone(const struct request_sock *req, + new_ctx->tcp_data_ready = old_ctx->tcp_data_ready; + new_ctx->tcp_state_change = old_ctx->tcp_state_change; + new_ctx->tcp_write_space = old_ctx->tcp_write_space; ++ new_ctx->tcp_error_report = old_ctx->tcp_error_report; + new_ctx->rel_write_seq = 1; + new_ctx->tcp_sock = newsk; + +diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c +index bd4678db9d76b..6dff64374bfe1 100644 +--- a/net/sunrpc/auth_gss/svcauth_gss.c ++++ b/net/sunrpc/auth_gss/svcauth_gss.c +@@ -1825,11 +1825,14 @@ static int + svcauth_gss_release(struct svc_rqst *rqstp) + { + struct gss_svc_data *gsd = (struct gss_svc_data *)rqstp->rq_auth_data; +- struct rpc_gss_wire_cred *gc = &gsd->clcred; ++ struct rpc_gss_wire_cred *gc; + struct xdr_buf *resbuf = &rqstp->rq_res; + int stat = -EINVAL; + struct sunrpc_net *sn = net_generic(SVC_NET(rqstp), sunrpc_net_id); + ++ if (!gsd) ++ goto out; ++ gc = &gsd->clcred; + if (gc->gc_proc != RPC_GSS_PROC_DATA) + goto out; + /* Release can be called twice, but we only wrap once. */ +@@ -1870,10 +1873,10 @@ out_err: + if (rqstp->rq_cred.cr_group_info) + put_group_info(rqstp->rq_cred.cr_group_info); + rqstp->rq_cred.cr_group_info = NULL; +- if (gsd->rsci) ++ if (gsd && gsd->rsci) { + cache_put(&gsd->rsci->h, sn->rsc_cache); +- gsd->rsci = NULL; +- ++ gsd->rsci = NULL; ++ } + return stat; + } + +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c +index 253d538251ae1..89a80beab5876 100644 +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -1023,8 +1023,12 @@ static int azx_prepare(struct device *dev) + struct snd_card *card = dev_get_drvdata(dev); + struct azx *chip; + ++ if (!azx_is_pm_ready(card)) ++ return 0; ++ + chip = card->private_data; + chip->pm_prepared = 1; ++ snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + + flush_work(&azx_bus(chip)->unsol_work); + +@@ -1039,7 +1043,11 @@ static void azx_complete(struct device *dev) + struct snd_card *card = dev_get_drvdata(dev); + struct azx *chip; + ++ if (!azx_is_pm_ready(card)) ++ return; ++ + chip = card->private_data; ++ snd_power_change_state(card, SNDRV_CTL_POWER_D0); + chip->pm_prepared = 0; + } + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 316b9b4ccb32d..58946d069ee59 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -5256,7 +5256,7 @@ static void alc_determine_headset_type(struct hda_codec *codec) + case 0x10ec0274: + case 0x10ec0294: + alc_process_coef_fw(codec, coef0274); +- msleep(80); ++ msleep(850); + val = alc_read_coef_idx(codec, 0x46); + is_ctia = (val & 0x00f0) == 0x00f0; + break; +@@ -5440,6 +5440,7 @@ static void alc_update_headset_jack_cb(struct hda_codec *codec, + struct hda_jack_callback *jack) + { + snd_hda_gen_hp_automute(codec, jack); ++ alc_update_headset_mode(codec); + } + + static void alc_probe_headset_mode(struct hda_codec *codec) +@@ -8057,6 +8058,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + ALC285_FIXUP_HP_GPIO_AMP_INIT), + SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), ++ SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP), +diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c +index 210fcbedf2413..4d82d24c7828d 100644 +--- a/sound/soc/codecs/cs42l42.c ++++ b/sound/soc/codecs/cs42l42.c +@@ -401,7 +401,7 @@ static const struct regmap_config cs42l42_regmap = { + }; + + static DECLARE_TLV_DB_SCALE(adc_tlv, -9600, 100, false); +-static DECLARE_TLV_DB_SCALE(mixer_tlv, -6200, 100, false); ++static DECLARE_TLV_DB_SCALE(mixer_tlv, -6300, 100, true); + + static const char * const cs42l42_hpf_freq_text[] = { + "1.86Hz", "120Hz", "235Hz", "466Hz" +@@ -458,7 +458,7 @@ static const struct snd_kcontrol_new cs42l42_snd_controls[] = { + CS42L42_DAC_HPF_EN_SHIFT, true, false), + SOC_DOUBLE_R_TLV("Mixer Volume", CS42L42_MIXER_CHA_VOL, + CS42L42_MIXER_CHB_VOL, CS42L42_MIXER_CH_VOL_SHIFT, +- 0x3e, 1, mixer_tlv) ++ 0x3f, 1, mixer_tlv) + }; + + static int cs42l42_hpdrv_evt(struct snd_soc_dapm_widget *w, +@@ -691,24 +691,6 @@ static int cs42l42_pll_config(struct snd_soc_component *component) + CS42L42_CLK_OASRC_SEL_MASK, + CS42L42_CLK_OASRC_SEL_12 << + CS42L42_CLK_OASRC_SEL_SHIFT); +- /* channel 1 on low LRCLK, 32 bit */ +- snd_soc_component_update_bits(component, +- CS42L42_ASP_RX_DAI0_CH1_AP_RES, +- CS42L42_ASP_RX_CH_AP_MASK | +- CS42L42_ASP_RX_CH_RES_MASK, +- (CS42L42_ASP_RX_CH_AP_LOW << +- CS42L42_ASP_RX_CH_AP_SHIFT) | +- (CS42L42_ASP_RX_CH_RES_32 << +- CS42L42_ASP_RX_CH_RES_SHIFT)); +- /* Channel 2 on high LRCLK, 32 bit */ +- snd_soc_component_update_bits(component, +- CS42L42_ASP_RX_DAI0_CH2_AP_RES, +- CS42L42_ASP_RX_CH_AP_MASK | +- CS42L42_ASP_RX_CH_RES_MASK, +- (CS42L42_ASP_RX_CH_AP_HI << +- CS42L42_ASP_RX_CH_AP_SHIFT) | +- (CS42L42_ASP_RX_CH_RES_32 << +- CS42L42_ASP_RX_CH_RES_SHIFT)); + if (pll_ratio_table[i].mclk_src_sel == 0) { + /* Pass the clock straight through */ + snd_soc_component_update_bits(component, +@@ -797,27 +779,23 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) + /* Bitclock/frame inversion */ + switch (fmt & SND_SOC_DAIFMT_INV_MASK) { + case SND_SOC_DAIFMT_NB_NF: ++ asp_cfg_val |= CS42L42_ASP_SCPOL_NOR << CS42L42_ASP_SCPOL_SHIFT; + break; + case SND_SOC_DAIFMT_NB_IF: +- asp_cfg_val |= CS42L42_ASP_POL_INV << +- CS42L42_ASP_LCPOL_IN_SHIFT; ++ asp_cfg_val |= CS42L42_ASP_SCPOL_NOR << CS42L42_ASP_SCPOL_SHIFT; ++ asp_cfg_val |= CS42L42_ASP_LCPOL_INV << CS42L42_ASP_LCPOL_SHIFT; + break; + case SND_SOC_DAIFMT_IB_NF: +- asp_cfg_val |= CS42L42_ASP_POL_INV << +- CS42L42_ASP_SCPOL_IN_DAC_SHIFT; + break; + case SND_SOC_DAIFMT_IB_IF: +- asp_cfg_val |= CS42L42_ASP_POL_INV << +- CS42L42_ASP_LCPOL_IN_SHIFT; +- asp_cfg_val |= CS42L42_ASP_POL_INV << +- CS42L42_ASP_SCPOL_IN_DAC_SHIFT; ++ asp_cfg_val |= CS42L42_ASP_LCPOL_INV << CS42L42_ASP_LCPOL_SHIFT; + break; + } + +- snd_soc_component_update_bits(component, CS42L42_ASP_CLK_CFG, +- CS42L42_ASP_MODE_MASK | +- CS42L42_ASP_SCPOL_IN_DAC_MASK | +- CS42L42_ASP_LCPOL_IN_MASK, asp_cfg_val); ++ snd_soc_component_update_bits(component, CS42L42_ASP_CLK_CFG, CS42L42_ASP_MODE_MASK | ++ CS42L42_ASP_SCPOL_MASK | ++ CS42L42_ASP_LCPOL_MASK, ++ asp_cfg_val); + + return 0; + } +@@ -828,14 +806,29 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream, + { + struct snd_soc_component *component = dai->component; + struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component); +- int retval; ++ unsigned int width = (params_width(params) / 8) - 1; ++ unsigned int val = 0; + + cs42l42->srate = params_rate(params); +- cs42l42->swidth = params_width(params); + +- retval = cs42l42_pll_config(component); ++ switch(substream->stream) { ++ case SNDRV_PCM_STREAM_PLAYBACK: ++ val |= width << CS42L42_ASP_RX_CH_RES_SHIFT; ++ /* channel 1 on low LRCLK */ ++ snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_CH1_AP_RES, ++ CS42L42_ASP_RX_CH_AP_MASK | ++ CS42L42_ASP_RX_CH_RES_MASK, val); ++ /* Channel 2 on high LRCLK */ ++ val |= CS42L42_ASP_RX_CH_AP_HI << CS42L42_ASP_RX_CH_AP_SHIFT; ++ snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_CH2_AP_RES, ++ CS42L42_ASP_RX_CH_AP_MASK | ++ CS42L42_ASP_RX_CH_RES_MASK, val); ++ break; ++ default: ++ break; ++ } + +- return retval; ++ return cs42l42_pll_config(component); + } + + static int cs42l42_set_sysclk(struct snd_soc_dai *dai, +@@ -900,9 +893,9 @@ static int cs42l42_mute(struct snd_soc_dai *dai, int mute, int direction) + return 0; + } + +-#define CS42L42_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S18_3LE | \ +- SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE | \ +- SNDRV_PCM_FMTBIT_S32_LE) ++#define CS42L42_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ ++ SNDRV_PCM_FMTBIT_S24_LE |\ ++ SNDRV_PCM_FMTBIT_S32_LE ) + + + static const struct snd_soc_dai_ops cs42l42_ops = { +@@ -1801,7 +1794,7 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client, + dev_dbg(&i2c_client->dev, "Found reset GPIO\n"); + gpiod_set_value_cansleep(cs42l42->reset_gpio, 1); + } +- mdelay(3); ++ usleep_range(CS42L42_BOOT_TIME_US, CS42L42_BOOT_TIME_US * 2); + + /* Request IRQ */ + ret = devm_request_threaded_irq(&i2c_client->dev, +@@ -1926,6 +1919,7 @@ static int cs42l42_runtime_resume(struct device *dev) + } + + gpiod_set_value_cansleep(cs42l42->reset_gpio, 1); ++ usleep_range(CS42L42_BOOT_TIME_US, CS42L42_BOOT_TIME_US * 2); + + regcache_cache_only(cs42l42->regmap, false); + regcache_sync(cs42l42->regmap); +diff --git a/sound/soc/codecs/cs42l42.h b/sound/soc/codecs/cs42l42.h +index 9e3cc528dcff0..866d7c873e3c9 100644 +--- a/sound/soc/codecs/cs42l42.h ++++ b/sound/soc/codecs/cs42l42.h +@@ -258,11 +258,12 @@ + #define CS42L42_ASP_SLAVE_MODE 0x00 + #define CS42L42_ASP_MODE_SHIFT 4 + #define CS42L42_ASP_MODE_MASK (1 << CS42L42_ASP_MODE_SHIFT) +-#define CS42L42_ASP_SCPOL_IN_DAC_SHIFT 2 +-#define CS42L42_ASP_SCPOL_IN_DAC_MASK (1 << CS42L42_ASP_SCPOL_IN_DAC_SHIFT) +-#define CS42L42_ASP_LCPOL_IN_SHIFT 0 +-#define CS42L42_ASP_LCPOL_IN_MASK (1 << CS42L42_ASP_LCPOL_IN_SHIFT) +-#define CS42L42_ASP_POL_INV 1 ++#define CS42L42_ASP_SCPOL_SHIFT 2 ++#define CS42L42_ASP_SCPOL_MASK (3 << CS42L42_ASP_SCPOL_SHIFT) ++#define CS42L42_ASP_SCPOL_NOR 3 ++#define CS42L42_ASP_LCPOL_SHIFT 0 ++#define CS42L42_ASP_LCPOL_MASK (3 << CS42L42_ASP_LCPOL_SHIFT) ++#define CS42L42_ASP_LCPOL_INV 3 + + #define CS42L42_ASP_FRM_CFG (CS42L42_PAGE_12 + 0x08) + #define CS42L42_ASP_STP_SHIFT 4 +@@ -739,6 +740,7 @@ + #define CS42L42_FRAC2_VAL(val) (((val) & 0xff0000) >> 16) + + #define CS42L42_NUM_SUPPLIES 5 ++#define CS42L42_BOOT_TIME_US 3000 + + static const char *const cs42l42_supply_names[CS42L42_NUM_SUPPLIES] = { + "VA", +@@ -756,7 +758,6 @@ struct cs42l42_private { + struct completion pdn_done; + u32 sclk; + u32 srate; +- u32 swidth; + u8 plug_state; + u8 hs_type; + u8 ts_inv; +diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c +index f9ec5cf825991..ec2f11ff8a84d 100644 +--- a/sound/soc/codecs/es8316.c ++++ b/sound/soc/codecs/es8316.c +@@ -63,13 +63,8 @@ static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(adc_pga_gain_tlv, + 1, 1, TLV_DB_SCALE_ITEM(0, 0, 0), + 2, 2, TLV_DB_SCALE_ITEM(250, 0, 0), + 3, 3, TLV_DB_SCALE_ITEM(450, 0, 0), +- 4, 4, TLV_DB_SCALE_ITEM(700, 0, 0), +- 5, 5, TLV_DB_SCALE_ITEM(1000, 0, 0), +- 6, 6, TLV_DB_SCALE_ITEM(1300, 0, 0), +- 7, 7, TLV_DB_SCALE_ITEM(1600, 0, 0), +- 8, 8, TLV_DB_SCALE_ITEM(1800, 0, 0), +- 9, 9, TLV_DB_SCALE_ITEM(2100, 0, 0), +- 10, 10, TLV_DB_SCALE_ITEM(2400, 0, 0), ++ 4, 7, TLV_DB_SCALE_ITEM(700, 300, 0), ++ 8, 10, TLV_DB_SCALE_ITEM(1800, 300, 0), + ); + + static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(hpout_vol_tlv, +diff --git a/sound/soc/codecs/rt1015.c b/sound/soc/codecs/rt1015.c +index 32e6bcf763d1d..4607039a16e7f 100644 +--- a/sound/soc/codecs/rt1015.c ++++ b/sound/soc/codecs/rt1015.c +@@ -209,6 +209,7 @@ static bool rt1015_volatile_register(struct device *dev, unsigned int reg) + case RT1015_VENDOR_ID: + case RT1015_DEVICE_ID: + case RT1015_PRO_ALT: ++ case RT1015_MAN_I2C: + case RT1015_DAC3: + case RT1015_VBAT_TEST_OUT1: + case RT1015_VBAT_TEST_OUT2: +diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c +index 1414ad15d01cf..a5674c227b3a6 100644 +--- a/sound/soc/codecs/rt5640.c ++++ b/sound/soc/codecs/rt5640.c +@@ -339,9 +339,9 @@ static bool rt5640_readable_register(struct device *dev, unsigned int reg) + } + + static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0); +-static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0); ++static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0); + static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); +-static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0); ++static const DECLARE_TLV_DB_MINMAX(adc_vol_tlv, -1762, 3000); + static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); + + /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ +diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c +index d198e191fb0c9..e59fdc81dbd45 100644 +--- a/sound/soc/codecs/rt5651.c ++++ b/sound/soc/codecs/rt5651.c +@@ -285,9 +285,9 @@ static bool rt5651_readable_register(struct device *dev, unsigned int reg) + } + + static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0); +-static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0); ++static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0); + static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); +-static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0); ++static const DECLARE_TLV_DB_MINMAX(adc_vol_tlv, -1762, 3000); + static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); + + /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ +diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c +index 41e5917b16a5e..91a4ef7f620ca 100644 +--- a/sound/soc/codecs/rt5659.c ++++ b/sound/soc/codecs/rt5659.c +@@ -3426,12 +3426,17 @@ static int rt5659_set_component_sysclk(struct snd_soc_component *component, int + { + struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); + unsigned int reg_val = 0; ++ int ret; + + if (freq == rt5659->sysclk && clk_id == rt5659->sysclk_src) + return 0; + + switch (clk_id) { + case RT5659_SCLK_S_MCLK: ++ ret = clk_set_rate(rt5659->mclk, freq); ++ if (ret) ++ return ret; ++ + reg_val |= RT5659_SCLK_SRC_MCLK; + break; + case RT5659_SCLK_S_PLL1: +diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c +index 85f744184a60f..047f4e677d78c 100644 +--- a/sound/soc/codecs/rt711.c ++++ b/sound/soc/codecs/rt711.c +@@ -895,6 +895,13 @@ static int rt711_probe(struct snd_soc_component *component) + return 0; + } + ++static void rt711_remove(struct snd_soc_component *component) ++{ ++ struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component); ++ ++ regcache_cache_only(rt711->regmap, true); ++} ++ + static const struct snd_soc_component_driver soc_codec_dev_rt711 = { + .probe = rt711_probe, + .set_bias_level = rt711_set_bias_level, +@@ -905,6 +912,7 @@ static const struct snd_soc_component_driver soc_codec_dev_rt711 = { + .dapm_routes = rt711_audio_map, + .num_dapm_routes = ARRAY_SIZE(rt711_audio_map), + .set_jack = rt711_set_jack_detect, ++ .remove = rt711_remove, + }; + + static int rt711_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, +diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c +index 4d6ff81146228..4c0e87e22b97b 100644 +--- a/sound/soc/codecs/sgtl5000.c ++++ b/sound/soc/codecs/sgtl5000.c +@@ -71,7 +71,7 @@ static const struct reg_default sgtl5000_reg_defaults[] = { + { SGTL5000_DAP_EQ_BASS_BAND4, 0x002f }, + { SGTL5000_DAP_MAIN_CHAN, 0x8000 }, + { SGTL5000_DAP_MIX_CHAN, 0x0000 }, +- { SGTL5000_DAP_AVC_CTRL, 0x0510 }, ++ { SGTL5000_DAP_AVC_CTRL, 0x5100 }, + { SGTL5000_DAP_AVC_THRESHOLD, 0x1473 }, + { SGTL5000_DAP_AVC_ATTACK, 0x0028 }, + { SGTL5000_DAP_AVC_DECAY, 0x0050 }, +diff --git a/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c b/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c +index 8383536b7ae00..504293de2c0d0 100644 +--- a/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c ++++ b/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c +@@ -555,7 +555,9 @@ static int mtk_dai_tdm_hw_params(struct snd_pcm_substream *substream, + + /* set tdm */ + if (tdm_priv->bck_invert) +- tdm_con |= 1 << BCK_INVERSE_SFT; ++ regmap_update_bits(afe->regmap, AUDIO_TOP_CON3, ++ BCK_INVERSE_MASK_SFT, ++ 0x1 << BCK_INVERSE_SFT); + + if (tdm_priv->lck_invert) + tdm_con |= 1 << LRCK_INVERSE_SFT; +diff --git a/sound/soc/mediatek/mt8192/mt8192-reg.h b/sound/soc/mediatek/mt8192/mt8192-reg.h +index 562f25c79c349..b9fb80d4afecd 100644 +--- a/sound/soc/mediatek/mt8192/mt8192-reg.h ++++ b/sound/soc/mediatek/mt8192/mt8192-reg.h +@@ -21,6 +21,11 @@ enum { + /***************************************************************************** + * R E G I S T E R D E F I N I T I O N + *****************************************************************************/ ++/* AUDIO_TOP_CON3 */ ++#define BCK_INVERSE_SFT 3 ++#define BCK_INVERSE_MASK 0x1 ++#define BCK_INVERSE_MASK_SFT (0x1 << 3) ++ + /* AFE_DAC_CON0 */ + #define VUL12_ON_SFT 31 + #define VUL12_ON_MASK 0x1 +@@ -2079,9 +2084,6 @@ enum { + #define TDM_EN_SFT 0 + #define TDM_EN_MASK 0x1 + #define TDM_EN_MASK_SFT (0x1 << 0) +-#define BCK_INVERSE_SFT 1 +-#define BCK_INVERSE_MASK 0x1 +-#define BCK_INVERSE_MASK_SFT (0x1 << 1) + #define LRCK_INVERSE_SFT 2 + #define LRCK_INVERSE_MASK 0x1 + #define LRCK_INVERSE_MASK_SFT (0x1 << 2) +diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c +index f6d4e99b590c7..0cffc9527e289 100644 +--- a/sound/soc/soc-core.c ++++ b/sound/soc/soc-core.c +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1573,6 +1574,9 @@ int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour) + if (card->long_name) + return 0; /* long name already set by driver or from DMI */ + ++ if (!is_acpi_device_node(card->dev->fwnode)) ++ return 0; ++ + /* make up dmi long name as: vendor-product-version-board */ + vendor = dmi_get_system_info(DMI_BOARD_VENDOR); + if (!vendor || !is_dmi_valid(vendor)) { +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index d3001fb18141f..176437a441e6c 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1521,6 +1521,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) + case USB_ID(0x21b4, 0x0081): /* AudioQuest DragonFly */ + case USB_ID(0x2912, 0x30c8): /* Audioengine D1 */ + case USB_ID(0x413c, 0xa506): /* Dell AE515 sound bar */ ++ case USB_ID(0x046d, 0x084c): /* Logitech ConferenceCam Connect */ + return true; + } + +diff --git a/tools/testing/selftests/net/forwarding/tc_flower.sh b/tools/testing/selftests/net/forwarding/tc_flower.sh +index 058c746ee3006..b11d8e6b5bc14 100755 +--- a/tools/testing/selftests/net/forwarding/tc_flower.sh ++++ b/tools/testing/selftests/net/forwarding/tc_flower.sh +@@ -3,7 +3,7 @@ + + ALL_TESTS="match_dst_mac_test match_src_mac_test match_dst_ip_test \ + match_src_ip_test match_ip_flags_test match_pcp_test match_vlan_test \ +- match_ip_tos_test match_indev_test" ++ match_ip_tos_test match_indev_test match_ip_ttl_test" + NUM_NETIFS=2 + source tc_common.sh + source lib.sh +@@ -310,6 +310,42 @@ match_ip_tos_test() + log_test "ip_tos match ($tcflags)" + } + ++match_ip_ttl_test() ++{ ++ RET=0 ++ ++ tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \ ++ $tcflags dst_ip 192.0.2.2 ip_ttl 63 action drop ++ tc filter add dev $h2 ingress protocol ip pref 2 handle 102 flower \ ++ $tcflags dst_ip 192.0.2.2 action drop ++ ++ $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \ ++ -t ip "ttl=63" -q ++ ++ $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \ ++ -t ip "ttl=63,mf,frag=256" -q ++ ++ tc_check_packets "dev $h2 ingress" 102 1 ++ check_fail $? "Matched on the wrong filter (no check on ttl)" ++ ++ tc_check_packets "dev $h2 ingress" 101 2 ++ check_err $? "Did not match on correct filter (ttl=63)" ++ ++ $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \ ++ -t ip "ttl=255" -q ++ ++ tc_check_packets "dev $h2 ingress" 101 3 ++ check_fail $? "Matched on a wrong filter (ttl=63)" ++ ++ tc_check_packets "dev $h2 ingress" 102 1 ++ check_err $? "Did not match on correct filter (no check on ttl)" ++ ++ tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower ++ tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower ++ ++ log_test "ip_ttl match ($tcflags)" ++} ++ + match_indev_test() + { + RET=0 diff --git a/patch/kernel/archive/sunxi-5.11/patch-5.11.12-13.patch b/patch/kernel/archive/sunxi-5.11/patch-5.11.12-13.patch new file mode 100644 index 000000000..860f1d761 --- /dev/null +++ b/patch/kernel/archive/sunxi-5.11/patch-5.11.12-13.patch @@ -0,0 +1,1345 @@ +diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/silicon-errata.rst +index 7195102472929..d410a47ffa57a 100644 +--- a/Documentation/arm64/silicon-errata.rst ++++ b/Documentation/arm64/silicon-errata.rst +@@ -130,6 +130,9 @@ stable kernels. + | Marvell | ARM-MMU-500 | #582743 | N/A | + +----------------+-----------------+-----------------+-----------------------------+ + +----------------+-----------------+-----------------+-----------------------------+ ++| NVIDIA | Carmel Core | N/A | NVIDIA_CARMEL_CNP_ERRATUM | +++----------------+-----------------+-----------------+-----------------------------+ +++----------------+-----------------+-----------------+-----------------------------+ + | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | + +----------------+-----------------+-----------------+-----------------------------+ + +----------------+-----------------+-----------------+-----------------------------+ +diff --git a/Makefile b/Makefile +index 1e31504aab61b..1be83283e0321 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 11 +-SUBLEVEL = 12 ++SUBLEVEL = 13 + EXTRAVERSION = + NAME = 💕 Valentine's Day Edition 💕 + +@@ -1082,6 +1082,17 @@ ifdef CONFIG_STACK_VALIDATION + endif + endif + ++PHONY += resolve_btfids_clean ++ ++resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids ++ ++# tools/bpf/resolve_btfids directory might not exist ++# in output directory, skip its clean in that case ++resolve_btfids_clean: ++ifneq ($(wildcard $(resolve_btfids_O)),) ++ $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean ++endif ++ + ifdef CONFIG_BPF + ifdef CONFIG_DEBUG_INFO_BTF + ifeq ($(has_libelf),1) +@@ -1499,7 +1510,7 @@ vmlinuxclean: + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean + $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) + +-clean: archclean vmlinuxclean ++clean: archclean vmlinuxclean resolve_btfids_clean + + # mrproper - Delete all generated files, including .config + # +diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi +index 5b213a1e68bb2..5e33d0e88f5b1 100644 +--- a/arch/arm/boot/dts/am33xx.dtsi ++++ b/arch/arm/boot/dts/am33xx.dtsi +@@ -40,6 +40,9 @@ + ethernet1 = &cpsw_emac1; + spi0 = &spi0; + spi1 = &spi1; ++ mmc0 = &mmc1; ++ mmc1 = &mmc2; ++ mmc2 = &mmc3; + }; + + cpus { +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig +index e42da99db91fc..2517dd8c5a4d1 100644 +--- a/arch/arm64/Kconfig ++++ b/arch/arm64/Kconfig +@@ -805,6 +805,16 @@ config QCOM_FALKOR_ERRATUM_E1041 + + If unsure, say Y. + ++config NVIDIA_CARMEL_CNP_ERRATUM ++ bool "NVIDIA Carmel CNP: CNP on Carmel semantically different than ARM cores" ++ default y ++ help ++ If CNP is enabled on Carmel cores, non-sharable TLBIs on a core will not ++ invalidate shared TLB entries installed by a different core, as it would ++ on standard ARM cores. ++ ++ If unsure, say Y. ++ + config SOCIONEXT_SYNQUACER_PREITS + bool "Socionext Synquacer: Workaround for GICv3 pre-ITS" + default y +diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h +index b77d997b173bc..c40f2490cd7b7 100644 +--- a/arch/arm64/include/asm/cpucaps.h ++++ b/arch/arm64/include/asm/cpucaps.h +@@ -66,7 +66,8 @@ + #define ARM64_WORKAROUND_1508412 58 + #define ARM64_HAS_LDAPR 59 + #define ARM64_KVM_PROTECTED_MODE 60 ++#define ARM64_WORKAROUND_NVIDIA_CARMEL_CNP 61 + +-#define ARM64_NCAPS 61 ++#define ARM64_NCAPS 62 + + #endif /* __ASM_CPUCAPS_H */ +diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c +index a63428301f423..3fc281e4e6550 100644 +--- a/arch/arm64/kernel/cpu_errata.c ++++ b/arch/arm64/kernel/cpu_errata.c +@@ -527,6 +527,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = { + 0, 0, + 1, 0), + }, ++#endif ++#ifdef CONFIG_NVIDIA_CARMEL_CNP_ERRATUM ++ { ++ /* NVIDIA Carmel */ ++ .desc = "NVIDIA Carmel CNP erratum", ++ .capability = ARM64_WORKAROUND_NVIDIA_CARMEL_CNP, ++ ERRATA_MIDR_ALL_VERSIONS(MIDR_NVIDIA_CARMEL), ++ }, + #endif + { + } +diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c +index 33b6f56dcb21b..b1f7bfadab9f7 100644 +--- a/arch/arm64/kernel/cpufeature.c ++++ b/arch/arm64/kernel/cpufeature.c +@@ -1270,7 +1270,10 @@ has_useable_cnp(const struct arm64_cpu_capabilities *entry, int scope) + * may share TLB entries with a CPU stuck in the crashed + * kernel. + */ +- if (is_kdump_kernel()) ++ if (is_kdump_kernel()) ++ return false; ++ ++ if (cpus_have_const_cap(ARM64_WORKAROUND_NVIDIA_CARMEL_CNP)) + return false; + + return has_cpuid_feature(entry, scope); +diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c +index 8b5b8e6bc9d9a..dd5bfed52031d 100644 +--- a/arch/ia64/kernel/err_inject.c ++++ b/arch/ia64/kernel/err_inject.c +@@ -59,7 +59,7 @@ show_##name(struct device *dev, struct device_attribute *attr, \ + char *buf) \ + { \ + u32 cpu=dev->id; \ +- return sprintf(buf, "%lx\n", name[cpu]); \ ++ return sprintf(buf, "%llx\n", name[cpu]); \ + } + + #define store(name) \ +@@ -86,9 +86,9 @@ store_call_start(struct device *dev, struct device_attribute *attr, + + #ifdef ERR_INJ_DEBUG + printk(KERN_DEBUG "pal_mc_err_inject for cpu%d:\n", cpu); +- printk(KERN_DEBUG "err_type_info=%lx,\n", err_type_info[cpu]); +- printk(KERN_DEBUG "err_struct_info=%lx,\n", err_struct_info[cpu]); +- printk(KERN_DEBUG "err_data_buffer=%lx, %lx, %lx.\n", ++ printk(KERN_DEBUG "err_type_info=%llx,\n", err_type_info[cpu]); ++ printk(KERN_DEBUG "err_struct_info=%llx,\n", err_struct_info[cpu]); ++ printk(KERN_DEBUG "err_data_buffer=%llx, %llx, %llx.\n", + err_data_buffer[cpu].data1, + err_data_buffer[cpu].data2, + err_data_buffer[cpu].data3); +@@ -117,8 +117,8 @@ store_call_start(struct device *dev, struct device_attribute *attr, + + #ifdef ERR_INJ_DEBUG + printk(KERN_DEBUG "Returns: status=%d,\n", (int)status[cpu]); +- printk(KERN_DEBUG "capabilities=%lx,\n", capabilities[cpu]); +- printk(KERN_DEBUG "resources=%lx\n", resources[cpu]); ++ printk(KERN_DEBUG "capabilities=%llx,\n", capabilities[cpu]); ++ printk(KERN_DEBUG "resources=%llx\n", resources[cpu]); + #endif + return size; + } +@@ -131,7 +131,7 @@ show_virtual_to_phys(struct device *dev, struct device_attribute *attr, + char *buf) + { + unsigned int cpu=dev->id; +- return sprintf(buf, "%lx\n", phys_addr[cpu]); ++ return sprintf(buf, "%llx\n", phys_addr[cpu]); + } + + static ssize_t +@@ -145,7 +145,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr, + ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL); + if (ret<=0) { + #ifdef ERR_INJ_DEBUG +- printk("Virtual address %lx is not existing.\n",virt_addr); ++ printk("Virtual address %llx is not existing.\n", virt_addr); + #endif + return -EINVAL; + } +@@ -163,7 +163,7 @@ show_err_data_buffer(struct device *dev, + { + unsigned int cpu=dev->id; + +- return sprintf(buf, "%lx, %lx, %lx\n", ++ return sprintf(buf, "%llx, %llx, %llx\n", + err_data_buffer[cpu].data1, + err_data_buffer[cpu].data2, + err_data_buffer[cpu].data3); +@@ -178,13 +178,13 @@ store_err_data_buffer(struct device *dev, + int ret; + + #ifdef ERR_INJ_DEBUG +- printk("write err_data_buffer=[%lx,%lx,%lx] on cpu%d\n", ++ printk("write err_data_buffer=[%llx,%llx,%llx] on cpu%d\n", + err_data_buffer[cpu].data1, + err_data_buffer[cpu].data2, + err_data_buffer[cpu].data3, + cpu); + #endif +- ret=sscanf(buf, "%lx, %lx, %lx", ++ ret = sscanf(buf, "%llx, %llx, %llx", + &err_data_buffer[cpu].data1, + &err_data_buffer[cpu].data2, + &err_data_buffer[cpu].data3); +diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c +index 2703f7795672d..bd0a51dc345af 100644 +--- a/arch/ia64/kernel/mca.c ++++ b/arch/ia64/kernel/mca.c +@@ -1822,7 +1822,7 @@ ia64_mca_cpu_init(void *cpu_data) + data = mca_bootmem(); + first_time = 0; + } else +- data = (void *)__get_free_pages(GFP_KERNEL, ++ data = (void *)__get_free_pages(GFP_ATOMIC, + get_order(sz)); + if (!data) + panic("Could not allocate MCA memory for cpu %d\n", +diff --git a/arch/x86/Makefile b/arch/x86/Makefile +index 30920d70b48b3..828f24d547b2f 100644 +--- a/arch/x86/Makefile ++++ b/arch/x86/Makefile +@@ -27,7 +27,7 @@ endif + REALMODE_CFLAGS := -m16 -g -Os -DDISABLE_BRANCH_PROFILING \ + -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \ + -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ +- -mno-mmx -mno-sse ++ -mno-mmx -mno-sse $(call cc-option,-fcf-protection=none) + + REALMODE_CFLAGS += -ffreestanding + REALMODE_CFLAGS += -fno-stack-protector +diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c +index 023ac12f54a29..a11796bbb9cee 100644 +--- a/arch/x86/net/bpf_jit_comp.c ++++ b/arch/x86/net/bpf_jit_comp.c +@@ -1476,7 +1476,16 @@ emit_jmp: + } + + if (image) { +- if (unlikely(proglen + ilen > oldproglen)) { ++ /* ++ * When populating the image, assert that: ++ * ++ * i) We do not write beyond the allocated space, and ++ * ii) addrs[i] did not change from the prior run, in order ++ * to validate assumptions made for computing branch ++ * displacements. ++ */ ++ if (unlikely(proglen + ilen > oldproglen || ++ proglen + ilen != addrs[i])) { + pr_err("bpf_jit: fatal error\n"); + return -EFAULT; + } +@@ -2038,7 +2047,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) + extra_pass = true; + goto skip_init_addrs; + } +- addrs = kmalloc_array(prog->len + 1, sizeof(*addrs), GFP_KERNEL); ++ addrs = kvmalloc_array(prog->len + 1, sizeof(*addrs), GFP_KERNEL); + if (!addrs) { + prog = orig_prog; + goto out_addrs; +@@ -2128,7 +2137,7 @@ out_image: + if (image) + bpf_prog_fill_jited_linfo(prog, addrs + 1); + out_addrs: +- kfree(addrs); ++ kvfree(addrs); + kfree(jit_data); + prog->aux->jit_data = NULL; + } +diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c +index 96fde03aa9877..2cf4d217840d8 100644 +--- a/arch/x86/net/bpf_jit_comp32.c ++++ b/arch/x86/net/bpf_jit_comp32.c +@@ -2278,7 +2278,16 @@ notyet: + } + + if (image) { +- if (unlikely(proglen + ilen > oldproglen)) { ++ /* ++ * When populating the image, assert that: ++ * ++ * i) We do not write beyond the allocated space, and ++ * ii) addrs[i] did not change from the prior run, in order ++ * to validate assumptions made for computing branch ++ * displacements. ++ */ ++ if (unlikely(proglen + ilen > oldproglen || ++ proglen + ilen != addrs[i])) { + pr_err("bpf_jit: fatal error\n"); + return -EFAULT; + } +diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c +index a27d751cf219d..3d74f237f005b 100644 +--- a/drivers/bus/ti-sysc.c ++++ b/drivers/bus/ti-sysc.c +@@ -3053,7 +3053,9 @@ static int sysc_remove(struct platform_device *pdev) + + pm_runtime_put_sync(&pdev->dev); + pm_runtime_disable(&pdev->dev); +- reset_control_assert(ddata->rsts); ++ ++ if (!reset_control_status(ddata->rsts)) ++ reset_control_assert(ddata->rsts); + + unprepare: + sysc_unprepare(ddata); +diff --git a/drivers/gpu/drm/msm/adreno/a5xx_power.c b/drivers/gpu/drm/msm/adreno/a5xx_power.c +index f176a6f3eff66..e58670a61df4b 100644 +--- a/drivers/gpu/drm/msm/adreno/a5xx_power.c ++++ b/drivers/gpu/drm/msm/adreno/a5xx_power.c +@@ -304,7 +304,7 @@ int a5xx_power_init(struct msm_gpu *gpu) + /* Set up the limits management */ + if (adreno_is_a530(adreno_gpu)) + a530_lm_setup(gpu); +- else ++ else if (adreno_is_a540(adreno_gpu)) + a540_lm_setup(gpu); + + /* Set up SP/TP power collpase */ +diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +index 0366419d8bfed..e7a8442b59afd 100644 +--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c ++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +@@ -521,28 +521,73 @@ static int a6xx_cp_init(struct msm_gpu *gpu) + return a6xx_idle(gpu, ring) ? 0 : -EINVAL; + } + +-static void a6xx_ucode_check_version(struct a6xx_gpu *a6xx_gpu, ++/* ++ * Check that the microcode version is new enough to include several key ++ * security fixes. Return true if the ucode is safe. ++ */ ++static bool a6xx_ucode_check_version(struct a6xx_gpu *a6xx_gpu, + struct drm_gem_object *obj) + { ++ struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; ++ struct msm_gpu *gpu = &adreno_gpu->base; + u32 *buf = msm_gem_get_vaddr(obj); ++ bool ret = false; + + if (IS_ERR(buf)) +- return; ++ return false; + + /* +- * If the lowest nibble is 0xa that is an indication that this microcode +- * has been patched. The actual version is in dword [3] but we only care +- * about the patchlevel which is the lowest nibble of dword [3] +- * +- * Otherwise check that the firmware is greater than or equal to 1.90 +- * which was the first version that had this fix built in ++ * Targets up to a640 (a618, a630 and a640) need to check for a ++ * microcode version that is patched to support the whereami opcode or ++ * one that is new enough to include it by default. + */ +- if (((buf[0] & 0xf) == 0xa) && (buf[2] & 0xf) >= 1) +- a6xx_gpu->has_whereami = true; +- else if ((buf[0] & 0xfff) > 0x190) +- a6xx_gpu->has_whereami = true; ++ if (adreno_is_a618(adreno_gpu) || adreno_is_a630(adreno_gpu) || ++ adreno_is_a640(adreno_gpu)) { ++ /* ++ * If the lowest nibble is 0xa that is an indication that this ++ * microcode has been patched. The actual version is in dword ++ * [3] but we only care about the patchlevel which is the lowest ++ * nibble of dword [3] ++ * ++ * Otherwise check that the firmware is greater than or equal ++ * to 1.90 which was the first version that had this fix built ++ * in ++ */ ++ if ((((buf[0] & 0xf) == 0xa) && (buf[2] & 0xf) >= 1) || ++ (buf[0] & 0xfff) >= 0x190) { ++ a6xx_gpu->has_whereami = true; ++ ret = true; ++ goto out; ++ } + ++ DRM_DEV_ERROR(&gpu->pdev->dev, ++ "a630 SQE ucode is too old. Have version %x need at least %x\n", ++ buf[0] & 0xfff, 0x190); ++ } else { ++ /* ++ * a650 tier targets don't need whereami but still need to be ++ * equal to or newer than 1.95 for other security fixes ++ */ ++ if (adreno_is_a650(adreno_gpu)) { ++ if ((buf[0] & 0xfff) >= 0x195) { ++ ret = true; ++ goto out; ++ } ++ ++ DRM_DEV_ERROR(&gpu->pdev->dev, ++ "a650 SQE ucode is too old. Have version %x need at least %x\n", ++ buf[0] & 0xfff, 0x195); ++ } ++ ++ /* ++ * When a660 is added those targets should return true here ++ * since those have all the critical security fixes built in ++ * from the start ++ */ ++ } ++out: + msm_gem_put_vaddr(obj); ++ return ret; + } + + static int a6xx_ucode_init(struct msm_gpu *gpu) +@@ -565,7 +610,13 @@ static int a6xx_ucode_init(struct msm_gpu *gpu) + } + + msm_gem_object_set_name(a6xx_gpu->sqe_bo, "sqefw"); +- a6xx_ucode_check_version(a6xx_gpu, a6xx_gpu->sqe_bo); ++ if (!a6xx_ucode_check_version(a6xx_gpu, a6xx_gpu->sqe_bo)) { ++ msm_gem_unpin_iova(a6xx_gpu->sqe_bo, gpu->aspace); ++ drm_gem_object_put(a6xx_gpu->sqe_bo); ++ ++ a6xx_gpu->sqe_bo = NULL; ++ return -EPERM; ++ } + } + + gpu_write64(gpu, REG_A6XX_CP_SQE_INSTR_BASE_LO, +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +index 374b0e8471e60..0f1b04ef61f2c 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +@@ -43,6 +43,8 @@ + #define DPU_DEBUGFS_DIR "msm_dpu" + #define DPU_DEBUGFS_HWMASKNAME "hw_log_mask" + ++#define MIN_IB_BW 400000000ULL /* Min ib vote 400MB */ ++ + static int dpu_kms_hw_init(struct msm_kms *kms); + static void _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms); + +@@ -931,6 +933,9 @@ static int dpu_kms_hw_init(struct msm_kms *kms) + DPU_DEBUG("REG_DMA is not defined"); + } + ++ if (of_device_is_compatible(dev->dev->of_node, "qcom,sc7180-mdss")) ++ dpu_kms_parse_data_bus_icc_path(dpu_kms); ++ + pm_runtime_get_sync(&dpu_kms->pdev->dev); + + dpu_kms->core_rev = readl_relaxed(dpu_kms->mmio + 0x0); +@@ -1032,9 +1037,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms) + + dpu_vbif_init_memtypes(dpu_kms); + +- if (of_device_is_compatible(dev->dev->of_node, "qcom,sc7180-mdss")) +- dpu_kms_parse_data_bus_icc_path(dpu_kms); +- + pm_runtime_put_sync(&dpu_kms->pdev->dev); + + return 0; +@@ -1191,10 +1193,10 @@ static int __maybe_unused dpu_runtime_resume(struct device *dev) + + ddev = dpu_kms->dev; + ++ WARN_ON(!(dpu_kms->num_paths)); + /* Min vote of BW is required before turning on AXI clk */ + for (i = 0; i < dpu_kms->num_paths; i++) +- icc_set_bw(dpu_kms->path[i], 0, +- dpu_kms->catalog->perf.min_dram_ib); ++ icc_set_bw(dpu_kms->path[i], 0, Bps_to_icc(MIN_IB_BW)); + + rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, true); + if (rc) { +diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c +index c1f6708367ae9..c1c41846b6b2b 100644 +--- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c ++++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c +@@ -325,7 +325,7 @@ static void dsi_pll_commit(struct dsi_pll_7nm *pll) + pll_write(base + REG_DSI_7nm_PHY_PLL_FRAC_DIV_START_LOW_1, reg->frac_div_start_low); + pll_write(base + REG_DSI_7nm_PHY_PLL_FRAC_DIV_START_MID_1, reg->frac_div_start_mid); + pll_write(base + REG_DSI_7nm_PHY_PLL_FRAC_DIV_START_HIGH_1, reg->frac_div_start_high); +- pll_write(base + REG_DSI_7nm_PHY_PLL_PLL_LOCKDET_RATE_1, 0x40); ++ pll_write(base + REG_DSI_7nm_PHY_PLL_PLL_LOCKDET_RATE_1, reg->pll_lockdet_rate); + pll_write(base + REG_DSI_7nm_PHY_PLL_PLL_LOCK_DELAY, 0x06); + pll_write(base + REG_DSI_7nm_PHY_PLL_CMODE_1, 0x10); /* TODO: 0x00 for CPHY */ + pll_write(base + REG_DSI_7nm_PHY_PLL_CLOCK_INVERTERS, reg->pll_clock_inverters); +diff --git a/drivers/gpu/drm/msm/msm_fence.c b/drivers/gpu/drm/msm/msm_fence.c +index ad2703698b052..cd59a59180385 100644 +--- a/drivers/gpu/drm/msm/msm_fence.c ++++ b/drivers/gpu/drm/msm/msm_fence.c +@@ -45,7 +45,7 @@ int msm_wait_fence(struct msm_fence_context *fctx, uint32_t fence, + int ret; + + if (fence > fctx->last_fence) { +- DRM_ERROR("%s: waiting on invalid fence: %u (of %u)\n", ++ DRM_ERROR_RATELIMITED("%s: waiting on invalid fence: %u (of %u)\n", + fctx->name, fence, fctx->last_fence); + return -EINVAL; + } +diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c +index ec475087fbf93..39f841b424883 100644 +--- a/drivers/isdn/hardware/mISDN/mISDNipac.c ++++ b/drivers/isdn/hardware/mISDN/mISDNipac.c +@@ -694,7 +694,7 @@ isac_release(struct isac_hw *isac) + { + if (isac->type & IPAC_TYPE_ISACX) + WriteISAC(isac, ISACX_MASK, 0xff); +- else ++ else if (isac->type != 0) + WriteISAC(isac, ISAC_MASK, 0xff); + if (isac->dch.timer.function != NULL) { + del_timer(&isac->dch.timer); +diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c +index 8bdc44b7e09a1..3c8f665c15580 100644 +--- a/drivers/net/arcnet/com20020-pci.c ++++ b/drivers/net/arcnet/com20020-pci.c +@@ -127,6 +127,8 @@ static int com20020pci_probe(struct pci_dev *pdev, + int i, ioaddr, ret; + struct resource *r; + ++ ret = 0; ++ + if (pci_enable_device(pdev)) + return -EIO; + +@@ -139,6 +141,8 @@ static int com20020pci_probe(struct pci_dev *pdev, + priv->ci = ci; + mm = &ci->misc_map; + ++ pci_set_drvdata(pdev, priv); ++ + INIT_LIST_HEAD(&priv->list_dev); + + if (mm->size) { +@@ -161,7 +165,7 @@ static int com20020pci_probe(struct pci_dev *pdev, + dev = alloc_arcdev(device); + if (!dev) { + ret = -ENOMEM; +- goto out_port; ++ break; + } + dev->dev_port = i; + +@@ -178,7 +182,7 @@ static int com20020pci_probe(struct pci_dev *pdev, + pr_err("IO region %xh-%xh already allocated\n", + ioaddr, ioaddr + cm->size - 1); + ret = -EBUSY; +- goto out_port; ++ goto err_free_arcdev; + } + + /* Dummy access after Reset +@@ -216,18 +220,18 @@ static int com20020pci_probe(struct pci_dev *pdev, + if (arcnet_inb(ioaddr, COM20020_REG_R_STATUS) == 0xFF) { + pr_err("IO address %Xh is empty!\n", ioaddr); + ret = -EIO; +- goto out_port; ++ goto err_free_arcdev; + } + if (com20020_check(dev)) { + ret = -EIO; +- goto out_port; ++ goto err_free_arcdev; + } + + card = devm_kzalloc(&pdev->dev, sizeof(struct com20020_dev), + GFP_KERNEL); + if (!card) { + ret = -ENOMEM; +- goto out_port; ++ goto err_free_arcdev; + } + + card->index = i; +@@ -253,29 +257,29 @@ static int com20020pci_probe(struct pci_dev *pdev, + + ret = devm_led_classdev_register(&pdev->dev, &card->tx_led); + if (ret) +- goto out_port; ++ goto err_free_arcdev; + + ret = devm_led_classdev_register(&pdev->dev, &card->recon_led); + if (ret) +- goto out_port; ++ goto err_free_arcdev; + + dev_set_drvdata(&dev->dev, card); + + ret = com20020_found(dev, IRQF_SHARED); + if (ret) +- goto out_port; ++ goto err_free_arcdev; + + devm_arcnet_led_init(dev, dev->dev_id, i); + + list_add(&card->list, &priv->list_dev); +- } ++ continue; + +- pci_set_drvdata(pdev, priv); +- +- return 0; +- +-out_port: +- com20020pci_remove(pdev); ++err_free_arcdev: ++ free_arcdev(dev); ++ break; ++ } ++ if (ret) ++ com20020pci_remove(pdev); + return ret; + } + +diff --git a/drivers/net/can/usb/Kconfig b/drivers/net/can/usb/Kconfig +index c1e5d5b570b65..538f4d9adb914 100644 +--- a/drivers/net/can/usb/Kconfig ++++ b/drivers/net/can/usb/Kconfig +@@ -73,6 +73,7 @@ config CAN_KVASER_USB + - Kvaser Memorator Pro 5xHS + - Kvaser USBcan Light 4xHS + - Kvaser USBcan Pro 2xHS v2 ++ - Kvaser USBcan Pro 4xHS + - Kvaser USBcan Pro 5xHS + - Kvaser U100 + - Kvaser U100P +diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +index e2d58846c40ca..073c4a39e7182 100644 +--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c ++++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +@@ -86,8 +86,9 @@ + #define USB_U100_PRODUCT_ID 273 + #define USB_U100P_PRODUCT_ID 274 + #define USB_U100S_PRODUCT_ID 275 ++#define USB_USBCAN_PRO_4HS_PRODUCT_ID 276 + #define USB_HYDRA_PRODUCT_ID_END \ +- USB_U100S_PRODUCT_ID ++ USB_USBCAN_PRO_4HS_PRODUCT_ID + + static inline bool kvaser_is_leaf(const struct usb_device_id *id) + { +@@ -193,6 +194,7 @@ static const struct usb_device_id kvaser_usb_table[] = { + { USB_DEVICE(KVASER_VENDOR_ID, USB_U100_PRODUCT_ID) }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_U100P_PRODUCT_ID) }, + { USB_DEVICE(KVASER_VENDOR_ID, USB_U100S_PRODUCT_ID) }, ++ { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_4HS_PRODUCT_ID) }, + { } + }; + MODULE_DEVICE_TABLE(usb, kvaser_usb_table); +diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c +index d1e4d42e497d8..3712e1786091f 100644 +--- a/drivers/net/ethernet/marvell/pxa168_eth.c ++++ b/drivers/net/ethernet/marvell/pxa168_eth.c +@@ -1544,8 +1544,8 @@ static int pxa168_eth_remove(struct platform_device *pdev) + clk_disable_unprepare(pep->clk); + mdiobus_unregister(pep->smi_bus); + mdiobus_free(pep->smi_bus); +- unregister_netdev(dev); + cancel_work_sync(&pep->tx_timeout_task); ++ unregister_netdev(dev); + free_netdev(dev); + return 0; + } +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +index aaa5a56b44c7c..b6324d11a0086 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +@@ -2317,8 +2317,9 @@ static u8 mlx5e_build_icosq_log_wq_sz(struct mlx5e_params *params, + { + switch (params->rq_wq_type) { + case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ: +- return order_base_2(MLX5E_UMR_WQEBBS) + +- mlx5e_get_rq_log_wq_sz(rqp->rqc); ++ return max_t(u8, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE, ++ order_base_2(MLX5E_UMR_WQEBBS) + ++ mlx5e_get_rq_log_wq_sz(rqp->rqc)); + default: /* MLX5_WQ_TYPE_CYCLIC */ + return MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE; + } +diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c +index eb65a11e33eaf..1ce013a2d6ed0 100644 +--- a/drivers/net/ipa/ipa_cmd.c ++++ b/drivers/net/ipa/ipa_cmd.c +@@ -175,21 +175,23 @@ bool ipa_cmd_table_valid(struct ipa *ipa, const struct ipa_mem *mem, + : field_max(IP_FLTRT_FLAGS_NHASH_ADDR_FMASK); + if (mem->offset > offset_max || + ipa->mem_offset > offset_max - mem->offset) { +- dev_err(dev, "IPv%c %s%s table region offset too large " +- "(0x%04x + 0x%04x > 0x%04x)\n", +- ipv6 ? '6' : '4', hashed ? "hashed " : "", +- route ? "route" : "filter", +- ipa->mem_offset, mem->offset, offset_max); ++ dev_err(dev, "IPv%c %s%s table region offset too large\n", ++ ipv6 ? '6' : '4', hashed ? "hashed " : "", ++ route ? "route" : "filter"); ++ dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n", ++ ipa->mem_offset, mem->offset, offset_max); ++ + return false; + } + + if (mem->offset > ipa->mem_size || + mem->size > ipa->mem_size - mem->offset) { +- dev_err(dev, "IPv%c %s%s table region out of range " +- "(0x%04x + 0x%04x > 0x%04x)\n", +- ipv6 ? '6' : '4', hashed ? "hashed " : "", +- route ? "route" : "filter", +- mem->offset, mem->size, ipa->mem_size); ++ dev_err(dev, "IPv%c %s%s table region out of range\n", ++ ipv6 ? '6' : '4', hashed ? "hashed " : "", ++ route ? "route" : "filter"); ++ dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n", ++ mem->offset, mem->size, ipa->mem_size); ++ + return false; + } + +@@ -205,22 +207,36 @@ static bool ipa_cmd_header_valid(struct ipa *ipa) + u32 size_max; + u32 size; + ++ /* In ipa_cmd_hdr_init_local_add() we record the offset and size ++ * of the header table memory area. Make sure the offset and size ++ * fit in the fields that need to hold them, and that the entire ++ * range is within the overall IPA memory range. ++ */ + offset_max = field_max(HDR_INIT_LOCAL_FLAGS_HDR_ADDR_FMASK); + if (mem->offset > offset_max || + ipa->mem_offset > offset_max - mem->offset) { +- dev_err(dev, "header table region offset too large " +- "(0x%04x + 0x%04x > 0x%04x)\n", +- ipa->mem_offset + mem->offset, offset_max); ++ dev_err(dev, "header table region offset too large\n"); ++ dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n", ++ ipa->mem_offset, mem->offset, offset_max); ++ + return false; + } + + size_max = field_max(HDR_INIT_LOCAL_FLAGS_TABLE_SIZE_FMASK); + size = ipa->mem[IPA_MEM_MODEM_HEADER].size; + size += ipa->mem[IPA_MEM_AP_HEADER].size; +- if (mem->offset > ipa->mem_size || size > ipa->mem_size - mem->offset) { +- dev_err(dev, "header table region out of range " +- "(0x%04x + 0x%04x > 0x%04x)\n", +- mem->offset, size, ipa->mem_size); ++ ++ if (size > size_max) { ++ dev_err(dev, "header table region size too large\n"); ++ dev_err(dev, " (0x%04x > 0x%08x)\n", size, size_max); ++ ++ return false; ++ } ++ if (size > ipa->mem_size || mem->offset > ipa->mem_size - size) { ++ dev_err(dev, "header table region out of range\n"); ++ dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n", ++ mem->offset, size, ipa->mem_size); ++ + return false; + } + +diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c +index 2f5b8d09143e3..57cc92891a570 100644 +--- a/drivers/platform/x86/intel-hid.c ++++ b/drivers/platform/x86/intel-hid.c +@@ -90,6 +90,13 @@ static const struct dmi_system_id button_array_table[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x2 Detachable"), + }, + }, ++ { ++ .ident = "Lenovo ThinkPad X1 Tablet Gen 2", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Tablet Gen 2"), ++ }, ++ }, + { } + }; + +diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c +index ee2f757515b0a..b5888aeb4bcff 100644 +--- a/drivers/platform/x86/intel_pmc_core.c ++++ b/drivers/platform/x86/intel_pmc_core.c +@@ -863,34 +863,45 @@ out_unlock: + } + DEFINE_SHOW_ATTRIBUTE(pmc_core_pll); + +-static ssize_t pmc_core_ltr_ignore_write(struct file *file, +- const char __user *userbuf, +- size_t count, loff_t *ppos) ++static int pmc_core_send_ltr_ignore(u32 value) + { + struct pmc_dev *pmcdev = &pmc; + const struct pmc_reg_map *map = pmcdev->map; +- u32 val, buf_size, fd; +- int err; +- +- buf_size = count < 64 ? count : 64; +- +- err = kstrtou32_from_user(userbuf, buf_size, 10, &val); +- if (err) +- return err; ++ u32 reg; ++ int err = 0; + + mutex_lock(&pmcdev->lock); + +- if (val > map->ltr_ignore_max) { ++ if (value > map->ltr_ignore_max) { + err = -EINVAL; + goto out_unlock; + } + +- fd = pmc_core_reg_read(pmcdev, map->ltr_ignore_offset); +- fd |= (1U << val); +- pmc_core_reg_write(pmcdev, map->ltr_ignore_offset, fd); ++ reg = pmc_core_reg_read(pmcdev, map->ltr_ignore_offset); ++ reg |= BIT(value); ++ pmc_core_reg_write(pmcdev, map->ltr_ignore_offset, reg); + + out_unlock: + mutex_unlock(&pmcdev->lock); ++ ++ return err; ++} ++ ++static ssize_t pmc_core_ltr_ignore_write(struct file *file, ++ const char __user *userbuf, ++ size_t count, loff_t *ppos) ++{ ++ u32 buf_size, value; ++ int err; ++ ++ buf_size = min_t(u32, count, 64); ++ ++ err = kstrtou32_from_user(userbuf, buf_size, 10, &value); ++ if (err) ++ return err; ++ ++ err = pmc_core_send_ltr_ignore(value); ++ + return err == 0 ? count : err; + } + +@@ -1244,6 +1255,15 @@ static int pmc_core_probe(struct platform_device *pdev) + pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(); + dmi_check_system(pmc_core_dmi_table); + ++ /* ++ * On TGL, due to a hardware limitation, the GBE LTR blocks PC10 when ++ * a cable is attached. Tell the PMC to ignore it. ++ */ ++ if (pmcdev->map == &tgl_reg_map) { ++ dev_dbg(&pdev->dev, "ignoring GBE LTR\n"); ++ pmc_core_send_ltr_ignore(3); ++ } ++ + pmc_core_dbgfs_register(pmcdev); + + device_initialized = true; +diff --git a/drivers/platform/x86/intel_pmt_class.c b/drivers/platform/x86/intel_pmt_class.c +index c8939fba45090..ee2b3bbeb83da 100644 +--- a/drivers/platform/x86/intel_pmt_class.c ++++ b/drivers/platform/x86/intel_pmt_class.c +@@ -173,7 +173,7 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry, + struct intel_pmt_namespace *ns, + struct device *parent) + { +- struct resource res; ++ struct resource res = {0}; + struct device *dev; + int ret; + +diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c +index f3e8eca8d86d6..9f8da7155a897 100644 +--- a/drivers/platform/x86/thinkpad_acpi.c ++++ b/drivers/platform/x86/thinkpad_acpi.c +@@ -4080,13 +4080,19 @@ static bool hotkey_notify_6xxx(const u32 hkey, + + case TP_HKEY_EV_KEY_NUMLOCK: + case TP_HKEY_EV_KEY_FN: +- case TP_HKEY_EV_KEY_FN_ESC: + /* key press events, we just ignore them as long as the EC + * is still reporting them in the normal keyboard stream */ + *send_acpi_ev = false; + *ignore_acpi_ev = true; + return true; + ++ case TP_HKEY_EV_KEY_FN_ESC: ++ /* Get the media key status to foce the status LED to update */ ++ acpi_evalf(hkey_handle, NULL, "GMKS", "v"); ++ *send_acpi_ev = false; ++ *ignore_acpi_ev = true; ++ return true; ++ + case TP_HKEY_EV_TABLET_CHANGED: + tpacpi_input_send_tabletsw(); + hotkey_tablet_mode_notify_change(); +diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c +index beb5f74944cdf..08f4cf0ad9e3c 100644 +--- a/drivers/ptp/ptp_qoriq.c ++++ b/drivers/ptp/ptp_qoriq.c +@@ -189,15 +189,16 @@ int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) + tmr_add = ptp_qoriq->tmr_add; + adj = tmr_add; + +- /* calculate diff as adj*(scaled_ppm/65536)/1000000 +- * and round() to the nearest integer ++ /* ++ * Calculate diff and round() to the nearest integer ++ * ++ * diff = adj * (ppb / 1000000000) ++ * = adj * scaled_ppm / 65536000000 + */ +- adj *= scaled_ppm; +- diff = div_u64(adj, 8000000); +- diff = (diff >> 13) + ((diff >> 12) & 1); ++ diff = mul_u64_u64_div_u64(adj, scaled_ppm, 32768000000); ++ diff = DIV64_U64_ROUND_UP(diff, 2); + + tmr_add = neg_adj ? tmr_add - diff : tmr_add + diff; +- + ptp_qoriq->write(®s->ctrl_regs->tmr_add, tmr_add); + + return 0; +diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c +index 7994f27e45271..0689d550c37ab 100644 +--- a/drivers/target/target_core_pscsi.c ++++ b/drivers/target/target_core_pscsi.c +@@ -939,6 +939,14 @@ new_bio: + + return 0; + fail: ++ if (bio) ++ bio_put(bio); ++ while (req->bio) { ++ bio = req->bio; ++ req->bio = bio->bi_next; ++ bio_put(bio); ++ } ++ req->biotail = NULL; + return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; + } + +diff --git a/fs/block_dev.c b/fs/block_dev.c +index c33151020bcd7..85500e2400cf6 100644 +--- a/fs/block_dev.c ++++ b/fs/block_dev.c +@@ -1240,13 +1240,13 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate) + + lockdep_assert_held(&bdev->bd_mutex); + +- clear_bit(GD_NEED_PART_SCAN, &bdev->bd_disk->state); +- + rescan: + ret = blk_drop_partitions(bdev); + if (ret) + return ret; + ++ clear_bit(GD_NEED_PART_SCAN, &disk->state); ++ + /* + * Historically we only set the capacity to zero for devices that + * support partitions (independ of actually having partitions created). +diff --git a/fs/cifs/file.c b/fs/cifs/file.c +index 6d001905c8e51..eef4f22b5e783 100644 +--- a/fs/cifs/file.c ++++ b/fs/cifs/file.c +@@ -165,6 +165,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode, + goto posix_open_ret; + } + } else { ++ cifs_revalidate_mapping(*pinode); + cifs_fattr_to_inode(*pinode, &fattr); + } + +diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c +index d9073b569e174..53fb751bf2108 100644 +--- a/fs/cifs/smb2misc.c ++++ b/fs/cifs/smb2misc.c +@@ -754,8 +754,8 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) + } + } + spin_unlock(&cifs_tcp_ses_lock); +- cifs_dbg(FYI, "Can not process oplock break for non-existent connection\n"); +- return false; ++ cifs_dbg(FYI, "No file id matched, oplock break ignored\n"); ++ return true; + } + + void +diff --git a/fs/io_uring.c b/fs/io_uring.c +index 8b4213de9e085..b1b3154c8d502 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -1594,7 +1594,7 @@ static void io_queue_async_work(struct io_kiocb *req) + io_queue_linked_timeout(link); + } + +-static void io_kill_timeout(struct io_kiocb *req) ++static void io_kill_timeout(struct io_kiocb *req, int status) + { + struct io_timeout_data *io = req->async_data; + int ret; +@@ -1604,7 +1604,7 @@ static void io_kill_timeout(struct io_kiocb *req) + atomic_set(&req->ctx->cq_timeouts, + atomic_read(&req->ctx->cq_timeouts) + 1); + list_del_init(&req->timeout.list); +- io_cqring_fill_event(req, 0); ++ io_cqring_fill_event(req, status); + io_put_req_deferred(req, 1); + } + } +@@ -1621,7 +1621,7 @@ static bool io_kill_timeouts(struct io_ring_ctx *ctx, struct task_struct *tsk, + spin_lock_irq(&ctx->completion_lock); + list_for_each_entry_safe(req, tmp, &ctx->timeout_list, timeout.list) { + if (io_match_task(req, tsk, files)) { +- io_kill_timeout(req); ++ io_kill_timeout(req, -ECANCELED); + canceled++; + } + } +@@ -1673,7 +1673,7 @@ static void io_flush_timeouts(struct io_ring_ctx *ctx) + break; + + list_del_init(&req->timeout.list); +- io_kill_timeout(req); ++ io_kill_timeout(req, 0); + } while (!list_empty(&ctx->timeout_list)); + + ctx->cq_last_tm_flush = seq; +diff --git a/init/Kconfig b/init/Kconfig +index b7d3c6a12196f..a3d27421de8f8 100644 +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -113,8 +113,7 @@ config INIT_ENV_ARG_LIMIT + + config COMPILE_TEST + bool "Compile also drivers which will not load" +- depends on !UML && !S390 +- default n ++ depends on HAS_IOMEM + help + Some drivers can be compiled on a different platform than they are + intended to be run on. Despite they cannot be loaded there (or even +diff --git a/lib/math/div64.c b/lib/math/div64.c +index 064d68a5391a0..46866394fc843 100644 +--- a/lib/math/div64.c ++++ b/lib/math/div64.c +@@ -232,4 +232,5 @@ u64 mul_u64_u64_div_u64(u64 a, u64 b, u64 c) + + return res + div64_u64(a * b, c); + } ++EXPORT_SYMBOL(mul_u64_u64_div_u64); + #endif +diff --git a/net/mac80211/aead_api.c b/net/mac80211/aead_api.c +index d7b3d905d5353..b00d6f5b33f40 100644 +--- a/net/mac80211/aead_api.c ++++ b/net/mac80211/aead_api.c +@@ -23,6 +23,7 @@ int aead_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len, + struct aead_request *aead_req; + int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm); + u8 *__aad; ++ int ret; + + aead_req = kzalloc(reqsize + aad_len, GFP_ATOMIC); + if (!aead_req) +@@ -40,10 +41,10 @@ int aead_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len, + aead_request_set_crypt(aead_req, sg, sg, data_len, b_0); + aead_request_set_ad(aead_req, sg[0].length); + +- crypto_aead_encrypt(aead_req); ++ ret = crypto_aead_encrypt(aead_req); + kfree_sensitive(aead_req); + +- return 0; ++ return ret; + } + + int aead_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len, +diff --git a/net/mac80211/aes_gmac.c b/net/mac80211/aes_gmac.c +index 6f3b3a0cc10a4..512cab073f2e8 100644 +--- a/net/mac80211/aes_gmac.c ++++ b/net/mac80211/aes_gmac.c +@@ -22,6 +22,7 @@ int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce, + struct aead_request *aead_req; + int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm); + const __le16 *fc; ++ int ret; + + if (data_len < GMAC_MIC_LEN) + return -EINVAL; +@@ -59,10 +60,10 @@ int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce, + aead_request_set_crypt(aead_req, sg, sg, 0, iv); + aead_request_set_ad(aead_req, GMAC_AAD_LEN + data_len); + +- crypto_aead_encrypt(aead_req); ++ ret = crypto_aead_encrypt(aead_req); + kfree_sensitive(aead_req); + +- return 0; ++ return ret; + } + + struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[], +diff --git a/net/mac80211/main.c b/net/mac80211/main.c +index dee88ec566ad1..d1023188ef373 100644 +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -970,8 +970,19 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) + continue; + + if (!dflt_chandef.chan) { ++ /* ++ * Assign the first enabled channel to dflt_chandef ++ * from the list of channels ++ */ ++ for (i = 0; i < sband->n_channels; i++) ++ if (!(sband->channels[i].flags & ++ IEEE80211_CHAN_DISABLED)) ++ break; ++ /* if none found then use the first anyway */ ++ if (i == sband->n_channels) ++ i = 0; + cfg80211_chandef_create(&dflt_chandef, +- &sband->channels[0], ++ &sband->channels[i], + NL80211_CHAN_NO_HT); + /* init channel we're on */ + if (!local->use_chanctx && !local->_oper_chandef.chan) { +diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c +index 5b05487a60d21..db11e403d8187 100644 +--- a/net/netfilter/nf_conntrack_proto_gre.c ++++ b/net/netfilter/nf_conntrack_proto_gre.c +@@ -218,9 +218,6 @@ int nf_conntrack_gre_packet(struct nf_conn *ct, + enum ip_conntrack_info ctinfo, + const struct nf_hook_state *state) + { +- if (state->pf != NFPROTO_IPV4) +- return -NF_ACCEPT; +- + if (!nf_ct_is_confirmed(ct)) { + unsigned int *timeouts = nf_ct_timeout_lookup(ct); + +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c +index 24a7a6b17268c..93d4bb39afb3c 100644 +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -6749,6 +6749,9 @@ static int nft_register_flowtable_net_hooks(struct net *net, + + list_for_each_entry(hook, hook_list, list) { + list_for_each_entry(ft, &table->flowtables, list) { ++ if (!nft_is_active_next(net, ft)) ++ continue; ++ + list_for_each_entry(hook2, &ft->hook_list, list) { + if (hook->ops.dev == hook2->ops.dev && + hook->ops.pf == hook2->ops.pf) { +diff --git a/tools/bpf/resolve_btfids/.gitignore b/tools/bpf/resolve_btfids/.gitignore +index a026df7dc2809..16913fffc9859 100644 +--- a/tools/bpf/resolve_btfids/.gitignore ++++ b/tools/bpf/resolve_btfids/.gitignore +@@ -1,4 +1,3 @@ +-/FEATURE-DUMP.libbpf +-/bpf_helper_defs.h + /fixdep + /resolve_btfids ++/libbpf/ +diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile +index bf656432ad736..bb9fa8de7e625 100644 +--- a/tools/bpf/resolve_btfids/Makefile ++++ b/tools/bpf/resolve_btfids/Makefile +@@ -2,11 +2,7 @@ + include ../../scripts/Makefile.include + include ../../scripts/Makefile.arch + +-ifeq ($(srctree),) +-srctree := $(patsubst %/,%,$(dir $(CURDIR))) +-srctree := $(patsubst %/,%,$(dir $(srctree))) +-srctree := $(patsubst %/,%,$(dir $(srctree))) +-endif ++srctree := $(abspath $(CURDIR)/../../../) + + ifeq ($(V),1) + Q = +@@ -22,28 +18,29 @@ AR = $(HOSTAR) + CC = $(HOSTCC) + LD = $(HOSTLD) + ARCH = $(HOSTARCH) ++RM ?= rm + + OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ + + LIBBPF_SRC := $(srctree)/tools/lib/bpf/ + SUBCMD_SRC := $(srctree)/tools/lib/subcmd/ + +-BPFOBJ := $(OUTPUT)/libbpf.a +-SUBCMDOBJ := $(OUTPUT)/libsubcmd.a ++BPFOBJ := $(OUTPUT)/libbpf/libbpf.a ++SUBCMDOBJ := $(OUTPUT)/libsubcmd/libsubcmd.a + + BINARY := $(OUTPUT)/resolve_btfids + BINARY_IN := $(BINARY)-in.o + + all: $(BINARY) + +-$(OUTPUT): ++$(OUTPUT) $(OUTPUT)/libbpf $(OUTPUT)/libsubcmd: + $(call msg,MKDIR,,$@) +- $(Q)mkdir -p $(OUTPUT) ++ $(Q)mkdir -p $(@) + +-$(SUBCMDOBJ): fixdep FORCE +- $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT) ++$(SUBCMDOBJ): fixdep FORCE | $(OUTPUT)/libsubcmd ++ $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@) + +-$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT) ++$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT)/libbpf + $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@) + + CFLAGS := -g \ +@@ -57,24 +54,27 @@ LIBS = -lelf -lz + export srctree OUTPUT CFLAGS Q + include $(srctree)/tools/build/Makefile.include + +-$(BINARY_IN): fixdep FORCE ++$(BINARY_IN): fixdep FORCE | $(OUTPUT) + $(Q)$(MAKE) $(build)=resolve_btfids + + $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) + $(call msg,LINK,$@) + $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS) + +-libsubcmd-clean: +- $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT) clean +- +-libbpf-clean: +- $(Q)$(MAKE) -C $(LIBBPF_SRC) OUTPUT=$(OUTPUT) clean ++clean_objects := $(wildcard $(OUTPUT)/*.o \ ++ $(OUTPUT)/.*.o.cmd \ ++ $(OUTPUT)/.*.o.d \ ++ $(OUTPUT)/libbpf \ ++ $(OUTPUT)/libsubcmd \ ++ $(OUTPUT)/resolve_btfids) + +-clean: libsubcmd-clean libbpf-clean fixdep-clean ++ifneq ($(clean_objects),) ++clean: fixdep-clean + $(call msg,CLEAN,$(BINARY)) +- $(Q)$(RM) -f $(BINARY); \ +- $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \ +- find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) ++ $(Q)$(RM) -rf $(clean_objects) ++else ++clean: ++endif + + tags: + $(call msg,GEN,,tags) +diff --git a/tools/testing/kunit/kunit_config.py b/tools/testing/kunit/kunit_config.py +index bdd60230764b0..27fe086d2d0d1 100644 +--- a/tools/testing/kunit/kunit_config.py ++++ b/tools/testing/kunit/kunit_config.py +@@ -13,7 +13,7 @@ from typing import List, Set + CONFIG_IS_NOT_SET_PATTERN = r'^# CONFIG_(\w+) is not set$' + CONFIG_PATTERN = r'^CONFIG_(\w+)=(\S+|".*")$' + +-KconfigEntryBase = collections.namedtuple('KconfigEntry', ['name', 'value']) ++KconfigEntryBase = collections.namedtuple('KconfigEntryBase', ['name', 'value']) + + class KconfigEntry(KconfigEntryBase): + +diff --git a/tools/testing/selftests/arm64/fp/sve-test.S b/tools/testing/selftests/arm64/fp/sve-test.S +index 9210691aa9985..e3e08d9c7020e 100644 +--- a/tools/testing/selftests/arm64/fp/sve-test.S ++++ b/tools/testing/selftests/arm64/fp/sve-test.S +@@ -284,16 +284,28 @@ endfunction + // Set up test pattern in the FFR + // x0: pid + // x2: generation ++// ++// We need to generate a canonical FFR value, which consists of a number of ++// low "1" bits, followed by a number of zeros. This gives us 17 unique values ++// per 16 bits of FFR, so we create a 4 bit signature out of the PID and ++// generation, and use that as the initial number of ones in the pattern. ++// We fill the upper lanes of FFR with zeros. + // Beware: corrupts P0. + function setup_ffr + mov x4, x30 + +- bl pattern ++ and w0, w0, #0x3 ++ bfi w0, w2, #2, #2 ++ mov w1, #1 ++ lsl w1, w1, w0 ++ sub w1, w1, #1 ++ + ldr x0, =ffrref +- ldr x1, =scratch +- rdvl x2, #1 +- lsr x2, x2, #3 +- bl memcpy ++ strh w1, [x0], 2 ++ rdvl x1, #1 ++ lsr x1, x1, #3 ++ sub x1, x1, #2 ++ bl memclr + + mov x0, #0 + ldr x1, =ffrref +diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile +index d42115e4284d7..8b0cd421ebd38 100644 +--- a/tools/testing/selftests/vm/Makefile ++++ b/tools/testing/selftests/vm/Makefile +@@ -101,7 +101,7 @@ endef + ifeq ($(CAN_BUILD_I386),1) + $(BINARIES_32): CFLAGS += -m32 + $(BINARIES_32): LDLIBS += -lrt -ldl -lm +-$(BINARIES_32): %_32: %.c ++$(BINARIES_32): $(OUTPUT)/%_32: %.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(notdir $^) $(LDLIBS) -o $@ + $(foreach t,$(TARGETS),$(eval $(call gen-target-rule-32,$(t)))) + endif +@@ -109,7 +109,7 @@ endif + ifeq ($(CAN_BUILD_X86_64),1) + $(BINARIES_64): CFLAGS += -m64 + $(BINARIES_64): LDLIBS += -lrt -ldl +-$(BINARIES_64): %_64: %.c ++$(BINARIES_64): $(OUTPUT)/%_64: %.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(notdir $^) $(LDLIBS) -o $@ + $(foreach t,$(TARGETS),$(eval $(call gen-target-rule-64,$(t)))) + endif diff --git a/patch/kernel/archive/sunxi-5.11/patch-5.11.13-14.patch b/patch/kernel/archive/sunxi-5.11/patch-5.11.13-14.patch new file mode 100644 index 000000000..1ca2de9cf --- /dev/null +++ b/patch/kernel/archive/sunxi-5.11/patch-5.11.13-14.patch @@ -0,0 +1,8865 @@ +diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml +index 880e55f7a4b13..a7ee05896564b 100644 +--- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml ++++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml +@@ -49,7 +49,7 @@ properties: + description: + Reference to an nvmem node for the MAC address + +- nvmem-cells-names: ++ nvmem-cell-names: + const: mac-address + + phy-connection-type: +diff --git a/Makefile b/Makefile +index 1be83283e0321..9116941553b86 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 11 +-SUBLEVEL = 13 ++SUBLEVEL = 14 + EXTRAVERSION = + NAME = 💕 Valentine's Day Edition 💕 + +diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts +index 646a06420c77e..5bd6a66d2c2b4 100644 +--- a/arch/arm/boot/dts/armada-385-turris-omnia.dts ++++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts +@@ -32,7 +32,8 @@ + ranges = ; ++ MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000 ++ MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>; + + internal-regs { + +@@ -389,6 +390,7 @@ + phy1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; ++ marvell,reg-init = <3 18 0 0x4985>; + + /* irq is connected to &pcawan pin 7 */ + }; +diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi +index 7a1e53195785b..f28a96fcf23e8 100644 +--- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi ++++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi +@@ -433,6 +433,7 @@ + pinctrl-0 = <&pinctrl_usdhc2>; + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; ++ vmmc-supply = <&vdd_sd1_reg>; + status = "disabled"; + }; + +@@ -442,5 +443,6 @@ + &pinctrl_usdhc3_cdwp>; + cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>; ++ vmmc-supply = <&vdd_sd0_reg>; + status = "disabled"; + }; +diff --git a/arch/arm/mach-omap2/omap-secure.c b/arch/arm/mach-omap2/omap-secure.c +index f70d561f37f71..0659ab4cb0af3 100644 +--- a/arch/arm/mach-omap2/omap-secure.c ++++ b/arch/arm/mach-omap2/omap-secure.c +@@ -9,6 +9,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -20,6 +21,7 @@ + + #include "common.h" + #include "omap-secure.h" ++#include "soc.h" + + static phys_addr_t omap_secure_memblock_base; + +@@ -213,3 +215,40 @@ void __init omap_secure_init(void) + { + omap_optee_init_check(); + } ++ ++/* ++ * Dummy dispatcher call after core OSWR and MPU off. Updates the ROM return ++ * address after MMU has been re-enabled after CPU1 has been woken up again. ++ * Otherwise the ROM code will attempt to use the earlier physical return ++ * address that got set with MMU off when waking up CPU1. Only used on secure ++ * devices. ++ */ ++static int cpu_notifier(struct notifier_block *nb, unsigned long cmd, void *v) ++{ ++ switch (cmd) { ++ case CPU_CLUSTER_PM_EXIT: ++ omap_secure_dispatcher(OMAP4_PPA_SERVICE_0, ++ FLAG_START_CRITICAL, ++ 0, 0, 0, 0, 0); ++ break; ++ default: ++ break; ++ } ++ ++ return NOTIFY_OK; ++} ++ ++static struct notifier_block secure_notifier_block = { ++ .notifier_call = cpu_notifier, ++}; ++ ++static int __init secure_pm_init(void) ++{ ++ if (omap_type() == OMAP2_DEVICE_TYPE_GP || !soc_is_omap44xx()) ++ return 0; ++ ++ cpu_pm_register_notifier(&secure_notifier_block); ++ ++ return 0; ++} ++omap_arch_initcall(secure_pm_init); +diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h +index 4aaa95706d39f..172069f316164 100644 +--- a/arch/arm/mach-omap2/omap-secure.h ++++ b/arch/arm/mach-omap2/omap-secure.h +@@ -50,6 +50,7 @@ + #define OMAP5_DRA7_MON_SET_ACR_INDEX 0x107 + + /* Secure PPA(Primary Protected Application) APIs */ ++#define OMAP4_PPA_SERVICE_0 0x21 + #define OMAP4_PPA_L2_POR_INDEX 0x23 + #define OMAP4_PPA_CPU_ACTRL_SMP_INDEX 0x25 + +diff --git a/arch/arm/mach-omap2/pmic-cpcap.c b/arch/arm/mach-omap2/pmic-cpcap.c +index 09076ad0576d9..668dc84fd31e0 100644 +--- a/arch/arm/mach-omap2/pmic-cpcap.c ++++ b/arch/arm/mach-omap2/pmic-cpcap.c +@@ -246,10 +246,10 @@ int __init omap4_cpcap_init(void) + omap_voltage_register_pmic(voltdm, &omap443x_max8952_mpu); + + if (of_machine_is_compatible("motorola,droid-bionic")) { +- voltdm = voltdm_lookup("mpu"); ++ voltdm = voltdm_lookup("core"); + omap_voltage_register_pmic(voltdm, &omap_cpcap_core); + +- voltdm = voltdm_lookup("mpu"); ++ voltdm = voltdm_lookup("iva"); + omap_voltage_register_pmic(voltdm, &omap_cpcap_iva); + } else { + voltdm = voltdm_lookup("core"); +diff --git a/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h b/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h +index 5ccc4cc91959d..a003e6af33533 100644 +--- a/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h ++++ b/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h +@@ -124,7 +124,7 @@ + #define MX8MM_IOMUXC_SD1_CMD_USDHC1_CMD 0x0A4 0x30C 0x000 0x0 0x0 + #define MX8MM_IOMUXC_SD1_CMD_GPIO2_IO1 0x0A4 0x30C 0x000 0x5 0x0 + #define MX8MM_IOMUXC_SD1_DATA0_USDHC1_DATA0 0x0A8 0x310 0x000 0x0 0x0 +-#define MX8MM_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x31 0x000 0x5 0x0 ++#define MX8MM_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x310 0x000 0x5 0x0 + #define MX8MM_IOMUXC_SD1_DATA1_USDHC1_DATA1 0x0AC 0x314 0x000 0x0 0x0 + #define MX8MM_IOMUXC_SD1_DATA1_GPIO2_IO3 0x0AC 0x314 0x000 0x5 0x0 + #define MX8MM_IOMUXC_SD1_DATA2_USDHC1_DATA2 0x0B0 0x318 0x000 0x0 0x0 +diff --git a/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h b/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h +index b94b02080a344..68e8fa1729741 100644 +--- a/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h ++++ b/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h +@@ -130,7 +130,7 @@ + #define MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0x0A4 0x30C 0x000 0x0 0x0 + #define MX8MQ_IOMUXC_SD1_CMD_GPIO2_IO1 0x0A4 0x30C 0x000 0x5 0x0 + #define MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0x0A8 0x310 0x000 0x0 0x0 +-#define MX8MQ_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x31 0x000 0x5 0x0 ++#define MX8MQ_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x310 0x000 0x5 0x0 + #define MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0x0AC 0x314 0x000 0x0 0x0 + #define MX8MQ_IOMUXC_SD1_DATA1_GPIO2_IO3 0x0AC 0x314 0x000 0x5 0x0 + #define MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0x0B0 0x318 0x000 0x0 0x0 +diff --git a/arch/arm64/boot/dts/marvell/armada-cp11x.dtsi b/arch/arm64/boot/dts/marvell/armada-cp11x.dtsi +index 994a2fce449a2..1e37ae181acf3 100644 +--- a/arch/arm64/boot/dts/marvell/armada-cp11x.dtsi ++++ b/arch/arm64/boot/dts/marvell/armada-cp11x.dtsi +@@ -300,9 +300,11 @@ + }; + + CP11X_LABEL(sata0): sata@540000 { +- compatible = "marvell,armada-8k-ahci"; ++ compatible = "marvell,armada-8k-ahci", ++ "generic-ahci"; + reg = <0x540000 0x30000>; + dma-coherent; ++ interrupts = <107 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&CP11X_LABEL(clk) 1 15>, + <&CP11X_LABEL(clk) 1 16>; + #address-cells = <1>; +@@ -310,12 +312,10 @@ + status = "disabled"; + + sata-port@0 { +- interrupts = <109 IRQ_TYPE_LEVEL_HIGH>; + reg = <0>; + }; + + sata-port@1 { +- interrupts = <107 IRQ_TYPE_LEVEL_HIGH>; + reg = <1>; + }; + }; +diff --git a/arch/ia64/include/asm/ptrace.h b/arch/ia64/include/asm/ptrace.h +index b3aa460901012..08179135905cd 100644 +--- a/arch/ia64/include/asm/ptrace.h ++++ b/arch/ia64/include/asm/ptrace.h +@@ -54,8 +54,7 @@ + + static inline unsigned long user_stack_pointer(struct pt_regs *regs) + { +- /* FIXME: should this be bspstore + nr_dirty regs? */ +- return regs->ar_bspstore; ++ return regs->r12; + } + + static inline int is_syscall_success(struct pt_regs *regs) +@@ -79,11 +78,6 @@ static inline long regs_return_value(struct pt_regs *regs) + unsigned long __ip = instruction_pointer(regs); \ + (__ip & ~3UL) + ((__ip & 3UL) << 2); \ + }) +-/* +- * Why not default? Because user_stack_pointer() on ia64 gives register +- * stack backing store instead... +- */ +-#define current_user_stack_pointer() (current_pt_regs()->r12) + + /* given a pointer to a task_struct, return the user's pt_regs */ + # define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1) +diff --git a/arch/nds32/mm/cacheflush.c b/arch/nds32/mm/cacheflush.c +index 6eb98a7ad27d2..ad5344ef5d334 100644 +--- a/arch/nds32/mm/cacheflush.c ++++ b/arch/nds32/mm/cacheflush.c +@@ -238,7 +238,7 @@ void flush_dcache_page(struct page *page) + { + struct address_space *mapping; + +- mapping = page_mapping(page); ++ mapping = page_mapping_file(page); + if (mapping && !mapping_mapped(mapping)) + set_bit(PG_dcache_dirty, &page->flags); + else { +diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h +index cf5ee9b0b393c..84ee232278a6a 100644 +--- a/arch/parisc/include/asm/cmpxchg.h ++++ b/arch/parisc/include/asm/cmpxchg.h +@@ -72,7 +72,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) + #endif + case 4: return __cmpxchg_u32((unsigned int *)ptr, + (unsigned int)old, (unsigned int)new_); +- case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_); ++ case 1: return __cmpxchg_u8((u8 *)ptr, old & 0xff, new_ & 0xff); + } + __cmpxchg_called_with_bad_pointer(); + return old; +diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile +index 79ee7750937db..b31e2160b233a 100644 +--- a/arch/powerpc/kernel/Makefile ++++ b/arch/powerpc/kernel/Makefile +@@ -191,3 +191,7 @@ $(obj)/prom_init_check: $(src)/prom_init_check.sh $(obj)/prom_init.o FORCE + targets += prom_init_check + + clean-files := vmlinux.lds ++ ++# Force dependency (incbin is bad) ++$(obj)/vdso32_wrapper.o : $(obj)/vdso32/vdso32.so.dbg ++$(obj)/vdso64_wrapper.o : $(obj)/vdso64/vdso64.so.dbg +diff --git a/arch/powerpc/kernel/ptrace/Makefile b/arch/powerpc/kernel/ptrace/Makefile +index 8ebc11d1168d8..77abd1a5a508d 100644 +--- a/arch/powerpc/kernel/ptrace/Makefile ++++ b/arch/powerpc/kernel/ptrace/Makefile +@@ -6,11 +6,11 @@ + CFLAGS_ptrace-view.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' + + obj-y += ptrace.o ptrace-view.o +-obj-$(CONFIG_PPC_FPU_REGS) += ptrace-fpu.o ++obj-y += ptrace-fpu.o + obj-$(CONFIG_COMPAT) += ptrace32.o + obj-$(CONFIG_VSX) += ptrace-vsx.o + ifneq ($(CONFIG_VSX),y) +-obj-$(CONFIG_PPC_FPU_REGS) += ptrace-novsx.o ++obj-y += ptrace-novsx.o + endif + obj-$(CONFIG_ALTIVEC) += ptrace-altivec.o + obj-$(CONFIG_SPE) += ptrace-spe.o +diff --git a/arch/powerpc/kernel/ptrace/ptrace-decl.h b/arch/powerpc/kernel/ptrace/ptrace-decl.h +index 3487f2c9735c6..eafe5f0f62898 100644 +--- a/arch/powerpc/kernel/ptrace/ptrace-decl.h ++++ b/arch/powerpc/kernel/ptrace/ptrace-decl.h +@@ -165,22 +165,8 @@ int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data); + extern const struct user_regset_view user_ppc_native_view; + + /* ptrace-fpu */ +-#ifdef CONFIG_PPC_FPU_REGS + int ptrace_get_fpr(struct task_struct *child, int index, unsigned long *data); + int ptrace_put_fpr(struct task_struct *child, int index, unsigned long data); +-#else +-static inline int +-ptrace_get_fpr(struct task_struct *child, int index, unsigned long *data) +-{ +- return -EIO; +-} +- +-static inline int +-ptrace_put_fpr(struct task_struct *child, int index, unsigned long data) +-{ +- return -EIO; +-} +-#endif + + /* ptrace-(no)adv */ + void ppc_gethwdinfo(struct ppc_debug_info *dbginfo); +diff --git a/arch/powerpc/kernel/ptrace/ptrace-fpu.c b/arch/powerpc/kernel/ptrace/ptrace-fpu.c +index 8301cb52dd992..5dca19361316e 100644 +--- a/arch/powerpc/kernel/ptrace/ptrace-fpu.c ++++ b/arch/powerpc/kernel/ptrace/ptrace-fpu.c +@@ -8,32 +8,42 @@ + + int ptrace_get_fpr(struct task_struct *child, int index, unsigned long *data) + { ++#ifdef CONFIG_PPC_FPU_REGS + unsigned int fpidx = index - PT_FPR0; ++#endif + + if (index > PT_FPSCR) + return -EIO; + ++#ifdef CONFIG_PPC_FPU_REGS + flush_fp_to_thread(child); + if (fpidx < (PT_FPSCR - PT_FPR0)) + memcpy(data, &child->thread.TS_FPR(fpidx), sizeof(long)); + else + *data = child->thread.fp_state.fpscr; ++#else ++ *data = 0; ++#endif + + return 0; + } + + int ptrace_put_fpr(struct task_struct *child, int index, unsigned long data) + { ++#ifdef CONFIG_PPC_FPU_REGS + unsigned int fpidx = index - PT_FPR0; ++#endif + + if (index > PT_FPSCR) + return -EIO; + ++#ifdef CONFIG_PPC_FPU_REGS + flush_fp_to_thread(child); + if (fpidx < (PT_FPSCR - PT_FPR0)) + memcpy(&child->thread.TS_FPR(fpidx), &data, sizeof(long)); + else + child->thread.fp_state.fpscr = data; ++#endif + + return 0; + } +diff --git a/arch/powerpc/kernel/ptrace/ptrace-novsx.c b/arch/powerpc/kernel/ptrace/ptrace-novsx.c +index b3b36835658af..7433f3db979ac 100644 +--- a/arch/powerpc/kernel/ptrace/ptrace-novsx.c ++++ b/arch/powerpc/kernel/ptrace/ptrace-novsx.c +@@ -21,12 +21,16 @@ + int fpr_get(struct task_struct *target, const struct user_regset *regset, + struct membuf to) + { ++#ifdef CONFIG_PPC_FPU_REGS + BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) != + offsetof(struct thread_fp_state, fpr[32])); + + flush_fp_to_thread(target); + + return membuf_write(&to, &target->thread.fp_state, 33 * sizeof(u64)); ++#else ++ return membuf_write(&to, &empty_zero_page, 33 * sizeof(u64)); ++#endif + } + + /* +@@ -46,6 +50,7 @@ int fpr_set(struct task_struct *target, const struct user_regset *regset, + unsigned int pos, unsigned int count, + const void *kbuf, const void __user *ubuf) + { ++#ifdef CONFIG_PPC_FPU_REGS + BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) != + offsetof(struct thread_fp_state, fpr[32])); + +@@ -53,4 +58,7 @@ int fpr_set(struct task_struct *target, const struct user_regset *regset, + + return user_regset_copyin(&pos, &count, &kbuf, &ubuf, + &target->thread.fp_state, 0, -1); ++#else ++ return 0; ++#endif + } +diff --git a/arch/powerpc/kernel/ptrace/ptrace-view.c b/arch/powerpc/kernel/ptrace/ptrace-view.c +index 2bad8068f598c..6ccffc65ac97e 100644 +--- a/arch/powerpc/kernel/ptrace/ptrace-view.c ++++ b/arch/powerpc/kernel/ptrace/ptrace-view.c +@@ -522,13 +522,11 @@ static const struct user_regset native_regsets[] = { + .size = sizeof(long), .align = sizeof(long), + .regset_get = gpr_get, .set = gpr_set + }, +-#ifdef CONFIG_PPC_FPU_REGS + [REGSET_FPR] = { + .core_note_type = NT_PRFPREG, .n = ELF_NFPREG, + .size = sizeof(double), .align = sizeof(double), + .regset_get = fpr_get, .set = fpr_set + }, +-#endif + #ifdef CONFIG_ALTIVEC + [REGSET_VMX] = { + .core_note_type = NT_PPC_VMX, .n = 34, +diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c +index af013b4244d34..2da0273597989 100644 +--- a/arch/s390/kernel/cpcmd.c ++++ b/arch/s390/kernel/cpcmd.c +@@ -37,10 +37,12 @@ static int diag8_noresponse(int cmdlen) + + static int diag8_response(int cmdlen, char *response, int *rlen) + { ++ unsigned long _cmdlen = cmdlen | 0x40000000L; ++ unsigned long _rlen = *rlen; + register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf; + register unsigned long reg3 asm ("3") = (addr_t) response; +- register unsigned long reg4 asm ("4") = cmdlen | 0x40000000L; +- register unsigned long reg5 asm ("5") = *rlen; ++ register unsigned long reg4 asm ("4") = _cmdlen; ++ register unsigned long reg5 asm ("5") = _rlen; + + asm volatile( + " diag %2,%0,0x8\n" +diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h +index 57ef2094af93e..630ff08532be8 100644 +--- a/arch/x86/include/asm/smp.h ++++ b/arch/x86/include/asm/smp.h +@@ -132,7 +132,7 @@ void native_play_dead(void); + void play_dead_common(void); + void wbinvd_on_cpu(int cpu); + int wbinvd_on_all_cpus(void); +-bool wakeup_cpu0(void); ++void cond_wakeup_cpu0(void); + + void native_smp_send_reschedule(int cpu); + void native_send_call_func_ipi(const struct cpumask *mask); +diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c +index f877150a91da1..16703c35a944f 100644 +--- a/arch/x86/kernel/smpboot.c ++++ b/arch/x86/kernel/smpboot.c +@@ -1659,13 +1659,17 @@ void play_dead_common(void) + local_irq_disable(); + } + +-bool wakeup_cpu0(void) ++/** ++ * cond_wakeup_cpu0 - Wake up CPU0 if needed. ++ * ++ * If NMI wants to wake up CPU0, start CPU0. ++ */ ++void cond_wakeup_cpu0(void) + { + if (smp_processor_id() == 0 && enable_start_cpu0) +- return true; +- +- return false; ++ start_cpu0(); + } ++EXPORT_SYMBOL_GPL(cond_wakeup_cpu0); + + /* + * We need to flush the caches before going to sleep, lest we have +@@ -1734,11 +1738,8 @@ static inline void mwait_play_dead(void) + __monitor(mwait_ptr, 0, 0); + mb(); + __mwait(eax, 0); +- /* +- * If NMI wants to wake up CPU0, start CPU0. +- */ +- if (wakeup_cpu0()) +- start_cpu0(); ++ ++ cond_wakeup_cpu0(); + } + } + +@@ -1749,11 +1750,8 @@ void hlt_play_dead(void) + + while (1) { + native_halt(); +- /* +- * If NMI wants to wake up CPU0, start CPU0. +- */ +- if (wakeup_cpu0()) +- start_cpu0(); ++ ++ cond_wakeup_cpu0(); + } + } + +diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c +index ac1874a2a70e8..651e3e5089593 100644 +--- a/arch/x86/kernel/traps.c ++++ b/arch/x86/kernel/traps.c +@@ -556,7 +556,7 @@ DEFINE_IDTENTRY_ERRORCODE(exc_general_protection) + tsk->thread.trap_nr = X86_TRAP_GP; + + if (fixup_vdso_exception(regs, X86_TRAP_GP, error_code, 0)) +- return; ++ goto exit; + + show_signal(tsk, SIGSEGV, "", desc, regs, error_code); + force_sig(SIGSEGV); +@@ -1057,7 +1057,7 @@ static void math_error(struct pt_regs *regs, int trapnr) + goto exit; + + if (fixup_vdso_exception(regs, trapnr, 0, 0)) +- return; ++ goto exit; + + force_sig_fault(SIGFPE, si_code, + (void __user *)uprobe_get_trap_addr(regs)); +diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c +index ed861245ecf04..86cedf32526a6 100644 +--- a/arch/x86/kvm/mmu/mmu.c ++++ b/arch/x86/kvm/mmu/mmu.c +@@ -5985,6 +5985,7 @@ static void kvm_recover_nx_lpages(struct kvm *kvm) + struct kvm_mmu_page *sp; + unsigned int ratio; + LIST_HEAD(invalid_list); ++ bool flush = false; + ulong to_zap; + + rcu_idx = srcu_read_lock(&kvm->srcu); +@@ -6005,20 +6006,20 @@ static void kvm_recover_nx_lpages(struct kvm *kvm) + struct kvm_mmu_page, + lpage_disallowed_link); + WARN_ON_ONCE(!sp->lpage_disallowed); +- if (sp->tdp_mmu_page) +- kvm_tdp_mmu_zap_gfn_range(kvm, sp->gfn, +- sp->gfn + KVM_PAGES_PER_HPAGE(sp->role.level)); +- else { ++ if (sp->tdp_mmu_page) { ++ flush |= kvm_tdp_mmu_zap_sp(kvm, sp); ++ } else { + kvm_mmu_prepare_zap_page(kvm, sp, &invalid_list); + WARN_ON_ONCE(sp->lpage_disallowed); + } + + if (need_resched() || spin_needbreak(&kvm->mmu_lock)) { +- kvm_mmu_commit_zap_page(kvm, &invalid_list); ++ kvm_mmu_remote_flush_or_zap(kvm, &invalid_list, flush); + cond_resched_lock(&kvm->mmu_lock); ++ flush = false; + } + } +- kvm_mmu_commit_zap_page(kvm, &invalid_list); ++ kvm_mmu_remote_flush_or_zap(kvm, &invalid_list, flush); + + spin_unlock(&kvm->mmu_lock); + srcu_read_unlock(&kvm->srcu, rcu_idx); +diff --git a/arch/x86/kvm/mmu/tdp_iter.c b/arch/x86/kvm/mmu/tdp_iter.c +index 87b7e16911dbb..1a09d212186b3 100644 +--- a/arch/x86/kvm/mmu/tdp_iter.c ++++ b/arch/x86/kvm/mmu/tdp_iter.c +@@ -22,21 +22,22 @@ static gfn_t round_gfn_for_level(gfn_t gfn, int level) + + /* + * Sets a TDP iterator to walk a pre-order traversal of the paging structure +- * rooted at root_pt, starting with the walk to translate goal_gfn. ++ * rooted at root_pt, starting with the walk to translate next_last_level_gfn. + */ + void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level, +- int min_level, gfn_t goal_gfn) ++ int min_level, gfn_t next_last_level_gfn) + { + WARN_ON(root_level < 1); + WARN_ON(root_level > PT64_ROOT_MAX_LEVEL); + +- iter->goal_gfn = goal_gfn; ++ iter->next_last_level_gfn = next_last_level_gfn; ++ iter->yielded_gfn = iter->next_last_level_gfn; + iter->root_level = root_level; + iter->min_level = min_level; + iter->level = root_level; + iter->pt_path[iter->level - 1] = root_pt; + +- iter->gfn = round_gfn_for_level(iter->goal_gfn, iter->level); ++ iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level); + tdp_iter_refresh_sptep(iter); + + iter->valid = true; +@@ -82,7 +83,7 @@ static bool try_step_down(struct tdp_iter *iter) + + iter->level--; + iter->pt_path[iter->level - 1] = child_pt; +- iter->gfn = round_gfn_for_level(iter->goal_gfn, iter->level); ++ iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level); + tdp_iter_refresh_sptep(iter); + + return true; +@@ -106,7 +107,7 @@ static bool try_step_side(struct tdp_iter *iter) + return false; + + iter->gfn += KVM_PAGES_PER_HPAGE(iter->level); +- iter->goal_gfn = iter->gfn; ++ iter->next_last_level_gfn = iter->gfn; + iter->sptep++; + iter->old_spte = READ_ONCE(*iter->sptep); + +@@ -158,23 +159,6 @@ void tdp_iter_next(struct tdp_iter *iter) + iter->valid = false; + } + +-/* +- * Restart the walk over the paging structure from the root, starting from the +- * highest gfn the iterator had previously reached. Assumes that the entire +- * paging structure, except the root page, may have been completely torn down +- * and rebuilt. +- */ +-void tdp_iter_refresh_walk(struct tdp_iter *iter) +-{ +- gfn_t goal_gfn = iter->goal_gfn; +- +- if (iter->gfn > goal_gfn) +- goal_gfn = iter->gfn; +- +- tdp_iter_start(iter, iter->pt_path[iter->root_level - 1], +- iter->root_level, iter->min_level, goal_gfn); +-} +- + u64 *tdp_iter_root_pt(struct tdp_iter *iter) + { + return iter->pt_path[iter->root_level - 1]; +diff --git a/arch/x86/kvm/mmu/tdp_iter.h b/arch/x86/kvm/mmu/tdp_iter.h +index 47170d0dc98e5..d480c540ee27d 100644 +--- a/arch/x86/kvm/mmu/tdp_iter.h ++++ b/arch/x86/kvm/mmu/tdp_iter.h +@@ -15,7 +15,13 @@ struct tdp_iter { + * The iterator will traverse the paging structure towards the mapping + * for this GFN. + */ +- gfn_t goal_gfn; ++ gfn_t next_last_level_gfn; ++ /* ++ * The next_last_level_gfn at the time when the thread last ++ * yielded. Only yielding when the next_last_level_gfn != ++ * yielded_gfn helps ensure forward progress. ++ */ ++ gfn_t yielded_gfn; + /* Pointers to the page tables traversed to reach the current SPTE */ + u64 *pt_path[PT64_ROOT_MAX_LEVEL]; + /* A pointer to the current SPTE */ +@@ -52,9 +58,8 @@ struct tdp_iter { + u64 *spte_to_child_pt(u64 pte, int level); + + void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level, +- int min_level, gfn_t goal_gfn); ++ int min_level, gfn_t next_last_level_gfn); + void tdp_iter_next(struct tdp_iter *iter); +-void tdp_iter_refresh_walk(struct tdp_iter *iter); + u64 *tdp_iter_root_pt(struct tdp_iter *iter); + + #endif /* __KVM_X86_MMU_TDP_ITER_H */ +diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c +index 17976998bffbc..a16559f31d946 100644 +--- a/arch/x86/kvm/mmu/tdp_mmu.c ++++ b/arch/x86/kvm/mmu/tdp_mmu.c +@@ -105,7 +105,7 @@ bool is_tdp_mmu_root(struct kvm *kvm, hpa_t hpa) + } + + static bool zap_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, +- gfn_t start, gfn_t end, bool can_yield); ++ gfn_t start, gfn_t end, bool can_yield, bool flush); + + void kvm_tdp_mmu_free_root(struct kvm *kvm, struct kvm_mmu_page *root) + { +@@ -118,7 +118,7 @@ void kvm_tdp_mmu_free_root(struct kvm *kvm, struct kvm_mmu_page *root) + + list_del(&root->link); + +- zap_gfn_range(kvm, root, 0, max_gfn, false); ++ zap_gfn_range(kvm, root, 0, max_gfn, false, false); + + free_page((unsigned long)root->spt); + kmem_cache_free(mmu_page_header_cache, root); +@@ -413,27 +413,43 @@ static inline void tdp_mmu_set_spte_no_dirty_log(struct kvm *kvm, + _mmu->shadow_root_level, _start, _end) + + /* +- * Flush the TLB if the process should drop kvm->mmu_lock. +- * Return whether the caller still needs to flush the tlb. ++ * Yield if the MMU lock is contended or this thread needs to return control ++ * to the scheduler. ++ * ++ * If this function should yield and flush is set, it will perform a remote ++ * TLB flush before yielding. ++ * ++ * If this function yields, it will also reset the tdp_iter's walk over the ++ * paging structure and the calling function should skip to the next ++ * iteration to allow the iterator to continue its traversal from the ++ * paging structure root. ++ * ++ * Return true if this function yielded and the iterator's traversal was reset. ++ * Return false if a yield was not needed. + */ +-static bool tdp_mmu_iter_flush_cond_resched(struct kvm *kvm, struct tdp_iter *iter) ++static inline bool tdp_mmu_iter_cond_resched(struct kvm *kvm, ++ struct tdp_iter *iter, bool flush) + { +- if (need_resched() || spin_needbreak(&kvm->mmu_lock)) { +- kvm_flush_remote_tlbs(kvm); +- cond_resched_lock(&kvm->mmu_lock); +- tdp_iter_refresh_walk(iter); ++ /* Ensure forward progress has been made before yielding. */ ++ if (iter->next_last_level_gfn == iter->yielded_gfn) + return false; +- } else { +- return true; +- } +-} + +-static void tdp_mmu_iter_cond_resched(struct kvm *kvm, struct tdp_iter *iter) +-{ + if (need_resched() || spin_needbreak(&kvm->mmu_lock)) { ++ if (flush) ++ kvm_flush_remote_tlbs(kvm); ++ + cond_resched_lock(&kvm->mmu_lock); +- tdp_iter_refresh_walk(iter); ++ ++ WARN_ON(iter->gfn > iter->next_last_level_gfn); ++ ++ tdp_iter_start(iter, iter->pt_path[iter->root_level - 1], ++ iter->root_level, iter->min_level, ++ iter->next_last_level_gfn); ++ ++ return true; + } ++ ++ return false; + } + + /* +@@ -445,15 +461,22 @@ static void tdp_mmu_iter_cond_resched(struct kvm *kvm, struct tdp_iter *iter) + * scheduler needs the CPU or there is contention on the MMU lock. If this + * function cannot yield, it will not release the MMU lock or reschedule and + * the caller must ensure it does not supply too large a GFN range, or the +- * operation can cause a soft lockup. ++ * operation can cause a soft lockup. Note, in some use cases a flush may be ++ * required by prior actions. Ensure the pending flush is performed prior to ++ * yielding. + */ + static bool zap_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, +- gfn_t start, gfn_t end, bool can_yield) ++ gfn_t start, gfn_t end, bool can_yield, bool flush) + { + struct tdp_iter iter; +- bool flush_needed = false; + + tdp_root_for_each_pte(iter, root, start, end) { ++ if (can_yield && ++ tdp_mmu_iter_cond_resched(kvm, &iter, flush)) { ++ flush = false; ++ continue; ++ } ++ + if (!is_shadow_present_pte(iter.old_spte)) + continue; + +@@ -468,13 +491,10 @@ static bool zap_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + continue; + + tdp_mmu_set_spte(kvm, &iter, 0); +- +- if (can_yield) +- flush_needed = tdp_mmu_iter_flush_cond_resched(kvm, &iter); +- else +- flush_needed = true; ++ flush = true; + } +- return flush_needed; ++ ++ return flush; + } + + /* +@@ -483,13 +503,14 @@ static bool zap_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + * SPTEs have been cleared and a TLB flush is needed before releasing the + * MMU lock. + */ +-bool kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, gfn_t end) ++bool __kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, gfn_t end, ++ bool can_yield) + { + struct kvm_mmu_page *root; + bool flush = false; + + for_each_tdp_mmu_root_yield_safe(kvm, root) +- flush |= zap_gfn_range(kvm, root, start, end, true); ++ flush = zap_gfn_range(kvm, root, start, end, can_yield, flush); + + return flush; + } +@@ -683,7 +704,7 @@ static int zap_gfn_range_hva_wrapper(struct kvm *kvm, + struct kvm_mmu_page *root, gfn_t start, + gfn_t end, unsigned long unused) + { +- return zap_gfn_range(kvm, root, start, end, false); ++ return zap_gfn_range(kvm, root, start, end, false, false); + } + + int kvm_tdp_mmu_zap_hva_range(struct kvm *kvm, unsigned long start, +@@ -836,6 +857,9 @@ static bool wrprot_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + + for_each_tdp_pte_min_level(iter, root->spt, root->role.level, + min_level, start, end) { ++ if (tdp_mmu_iter_cond_resched(kvm, &iter, false)) ++ continue; ++ + if (!is_shadow_present_pte(iter.old_spte) || + !is_last_spte(iter.old_spte, iter.level)) + continue; +@@ -844,8 +868,6 @@ static bool wrprot_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + + tdp_mmu_set_spte_no_dirty_log(kvm, &iter, new_spte); + spte_set = true; +- +- tdp_mmu_iter_cond_resched(kvm, &iter); + } + return spte_set; + } +@@ -889,6 +911,9 @@ static bool clear_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + bool spte_set = false; + + tdp_root_for_each_leaf_pte(iter, root, start, end) { ++ if (tdp_mmu_iter_cond_resched(kvm, &iter, false)) ++ continue; ++ + if (spte_ad_need_write_protect(iter.old_spte)) { + if (is_writable_pte(iter.old_spte)) + new_spte = iter.old_spte & ~PT_WRITABLE_MASK; +@@ -903,8 +928,6 @@ static bool clear_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + + tdp_mmu_set_spte_no_dirty_log(kvm, &iter, new_spte); + spte_set = true; +- +- tdp_mmu_iter_cond_resched(kvm, &iter); + } + return spte_set; + } +@@ -1012,6 +1035,9 @@ static bool set_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + bool spte_set = false; + + tdp_root_for_each_pte(iter, root, start, end) { ++ if (tdp_mmu_iter_cond_resched(kvm, &iter, false)) ++ continue; ++ + if (!is_shadow_present_pte(iter.old_spte)) + continue; + +@@ -1019,8 +1045,6 @@ static bool set_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, + + tdp_mmu_set_spte(kvm, &iter, new_spte); + spte_set = true; +- +- tdp_mmu_iter_cond_resched(kvm, &iter); + } + + return spte_set; +@@ -1061,6 +1085,11 @@ static void zap_collapsible_spte_range(struct kvm *kvm, + bool spte_set = false; + + tdp_root_for_each_pte(iter, root, start, end) { ++ if (tdp_mmu_iter_cond_resched(kvm, &iter, spte_set)) { ++ spte_set = false; ++ continue; ++ } ++ + if (!is_shadow_present_pte(iter.old_spte) || + !is_last_spte(iter.old_spte, iter.level)) + continue; +@@ -1073,7 +1102,7 @@ static void zap_collapsible_spte_range(struct kvm *kvm, + + tdp_mmu_set_spte(kvm, &iter, 0); + +- spte_set = tdp_mmu_iter_flush_cond_resched(kvm, &iter); ++ spte_set = true; + } + + if (spte_set) +diff --git a/arch/x86/kvm/mmu/tdp_mmu.h b/arch/x86/kvm/mmu/tdp_mmu.h +index cbbdbadd1526f..a7a3f6db263d2 100644 +--- a/arch/x86/kvm/mmu/tdp_mmu.h ++++ b/arch/x86/kvm/mmu/tdp_mmu.h +@@ -12,7 +12,23 @@ bool is_tdp_mmu_root(struct kvm *kvm, hpa_t root); + hpa_t kvm_tdp_mmu_get_vcpu_root_hpa(struct kvm_vcpu *vcpu); + void kvm_tdp_mmu_free_root(struct kvm *kvm, struct kvm_mmu_page *root); + +-bool kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, gfn_t end); ++bool __kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, gfn_t end, ++ bool can_yield); ++static inline bool kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, ++ gfn_t end) ++{ ++ return __kvm_tdp_mmu_zap_gfn_range(kvm, start, end, true); ++} ++static inline bool kvm_tdp_mmu_zap_sp(struct kvm *kvm, struct kvm_mmu_page *sp) ++{ ++ gfn_t end = sp->gfn + KVM_PAGES_PER_HPAGE(sp->role.level); ++ ++ /* ++ * Don't allow yielding, as the caller may have pending pages to zap ++ * on the shadow MMU. ++ */ ++ return __kvm_tdp_mmu_zap_gfn_range(kvm, sp->gfn, end, false); ++} + void kvm_tdp_mmu_zap_all(struct kvm *kvm); + + int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, gpa_t gpa, u32 error_code, +diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c +index 768a6b4d23680..4e2d76b8b697e 100644 +--- a/drivers/acpi/processor_idle.c ++++ b/drivers/acpi/processor_idle.c +@@ -544,9 +544,7 @@ static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) + return -ENODEV; + + #if defined(CONFIG_X86) && defined(CONFIG_HOTPLUG_CPU) +- /* If NMI wants to wake up CPU0, start CPU0. */ +- if (wakeup_cpu0()) +- start_cpu0(); ++ cond_wakeup_cpu0(); + #endif + } + +diff --git a/drivers/base/dd.c b/drivers/base/dd.c +index e2cf3b29123e8..37a5e5f8b2219 100644 +--- a/drivers/base/dd.c ++++ b/drivers/base/dd.c +@@ -292,14 +292,16 @@ int driver_deferred_probe_check_state(struct device *dev) + + static void deferred_probe_timeout_work_func(struct work_struct *work) + { +- struct device_private *private, *p; ++ struct device_private *p; + + driver_deferred_probe_timeout = 0; + driver_deferred_probe_trigger(); + flush_work(&deferred_probe_work); + +- list_for_each_entry_safe(private, p, &deferred_probe_pending_list, deferred_probe) +- dev_info(private->device, "deferred probe pending\n"); ++ mutex_lock(&deferred_probe_mutex); ++ list_for_each_entry(p, &deferred_probe_pending_list, deferred_probe) ++ dev_info(p->device, "deferred probe pending\n"); ++ mutex_unlock(&deferred_probe_mutex); + wake_up_all(&probe_timeout_waitqueue); + } + static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func); +diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig +index a086dd34f932f..4f501e4842ab3 100644 +--- a/drivers/char/agp/Kconfig ++++ b/drivers/char/agp/Kconfig +@@ -125,7 +125,7 @@ config AGP_HP_ZX1 + + config AGP_PARISC + tristate "HP Quicksilver AGP support" +- depends on AGP && PARISC && 64BIT ++ depends on AGP && PARISC && 64BIT && IOMMU_SBA + help + This option gives you AGP GART support for the HP Quicksilver + AGP bus adapter on HP PA-RISC machines (Ok, just on the C8000 +diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c +index 8c1d04db990d5..571ae066e548b 100644 +--- a/drivers/clk/clk.c ++++ b/drivers/clk/clk.c +@@ -4336,20 +4336,19 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb) + /* search the list of notifiers for this clk */ + list_for_each_entry(cn, &clk_notifier_list, node) + if (cn->clk == clk) +- break; ++ goto found; + + /* if clk wasn't in the notifier list, allocate new clk_notifier */ +- if (cn->clk != clk) { +- cn = kzalloc(sizeof(*cn), GFP_KERNEL); +- if (!cn) +- goto out; ++ cn = kzalloc(sizeof(*cn), GFP_KERNEL); ++ if (!cn) ++ goto out; + +- cn->clk = clk; +- srcu_init_notifier_head(&cn->notifier_head); ++ cn->clk = clk; ++ srcu_init_notifier_head(&cn->notifier_head); + +- list_add(&cn->node, &clk_notifier_list); +- } ++ list_add(&cn->node, &clk_notifier_list); + ++found: + ret = srcu_notifier_chain_register(&cn->notifier_head, nb); + + clk->core->notifier_count++; +@@ -4374,32 +4373,28 @@ EXPORT_SYMBOL_GPL(clk_notifier_register); + */ + int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb) + { +- struct clk_notifier *cn = NULL; +- int ret = -EINVAL; ++ struct clk_notifier *cn; ++ int ret = -ENOENT; + + if (!clk || !nb) + return -EINVAL; + + clk_prepare_lock(); + +- list_for_each_entry(cn, &clk_notifier_list, node) +- if (cn->clk == clk) +- break; +- +- if (cn->clk == clk) { +- ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb); ++ list_for_each_entry(cn, &clk_notifier_list, node) { ++ if (cn->clk == clk) { ++ ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb); + +- clk->core->notifier_count--; ++ clk->core->notifier_count--; + +- /* XXX the notifier code should handle this better */ +- if (!cn->notifier_head.head) { +- srcu_cleanup_notifier_head(&cn->notifier_head); +- list_del(&cn->node); +- kfree(cn); ++ /* XXX the notifier code should handle this better */ ++ if (!cn->notifier_head.head) { ++ srcu_cleanup_notifier_head(&cn->notifier_head); ++ list_del(&cn->node); ++ kfree(cn); ++ } ++ break; + } +- +- } else { +- ret = -ENOENT; + } + + clk_prepare_unlock(); +diff --git a/drivers/clk/qcom/camcc-sc7180.c b/drivers/clk/qcom/camcc-sc7180.c +index dbac5651ab855..9bcf2f8ed4de1 100644 +--- a/drivers/clk/qcom/camcc-sc7180.c ++++ b/drivers/clk/qcom/camcc-sc7180.c +@@ -304,7 +304,7 @@ static struct clk_rcg2 cam_cc_bps_clk_src = { + .name = "cam_cc_bps_clk_src", + .parent_data = cam_cc_parent_data_2, + .num_parents = 5, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -325,7 +325,7 @@ static struct clk_rcg2 cam_cc_cci_0_clk_src = { + .name = "cam_cc_cci_0_clk_src", + .parent_data = cam_cc_parent_data_5, + .num_parents = 3, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -339,7 +339,7 @@ static struct clk_rcg2 cam_cc_cci_1_clk_src = { + .name = "cam_cc_cci_1_clk_src", + .parent_data = cam_cc_parent_data_5, + .num_parents = 3, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -360,7 +360,7 @@ static struct clk_rcg2 cam_cc_cphy_rx_clk_src = { + .name = "cam_cc_cphy_rx_clk_src", + .parent_data = cam_cc_parent_data_3, + .num_parents = 6, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -379,7 +379,7 @@ static struct clk_rcg2 cam_cc_csi0phytimer_clk_src = { + .name = "cam_cc_csi0phytimer_clk_src", + .parent_data = cam_cc_parent_data_0, + .num_parents = 4, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -393,7 +393,7 @@ static struct clk_rcg2 cam_cc_csi1phytimer_clk_src = { + .name = "cam_cc_csi1phytimer_clk_src", + .parent_data = cam_cc_parent_data_0, + .num_parents = 4, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -407,7 +407,7 @@ static struct clk_rcg2 cam_cc_csi2phytimer_clk_src = { + .name = "cam_cc_csi2phytimer_clk_src", + .parent_data = cam_cc_parent_data_0, + .num_parents = 4, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -421,7 +421,7 @@ static struct clk_rcg2 cam_cc_csi3phytimer_clk_src = { + .name = "cam_cc_csi3phytimer_clk_src", + .parent_data = cam_cc_parent_data_0, + .num_parents = 4, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -443,7 +443,7 @@ static struct clk_rcg2 cam_cc_fast_ahb_clk_src = { + .name = "cam_cc_fast_ahb_clk_src", + .parent_data = cam_cc_parent_data_0, + .num_parents = 4, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -466,7 +466,7 @@ static struct clk_rcg2 cam_cc_icp_clk_src = { + .name = "cam_cc_icp_clk_src", + .parent_data = cam_cc_parent_data_2, + .num_parents = 5, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -488,7 +488,7 @@ static struct clk_rcg2 cam_cc_ife_0_clk_src = { + .name = "cam_cc_ife_0_clk_src", + .parent_data = cam_cc_parent_data_4, + .num_parents = 4, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -510,7 +510,7 @@ static struct clk_rcg2 cam_cc_ife_0_csid_clk_src = { + .name = "cam_cc_ife_0_csid_clk_src", + .parent_data = cam_cc_parent_data_3, + .num_parents = 6, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -524,7 +524,7 @@ static struct clk_rcg2 cam_cc_ife_1_clk_src = { + .name = "cam_cc_ife_1_clk_src", + .parent_data = cam_cc_parent_data_4, + .num_parents = 4, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -538,7 +538,7 @@ static struct clk_rcg2 cam_cc_ife_1_csid_clk_src = { + .name = "cam_cc_ife_1_csid_clk_src", + .parent_data = cam_cc_parent_data_3, + .num_parents = 6, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -553,7 +553,7 @@ static struct clk_rcg2 cam_cc_ife_lite_clk_src = { + .parent_data = cam_cc_parent_data_4, + .num_parents = 4, + .flags = CLK_SET_RATE_PARENT, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -567,7 +567,7 @@ static struct clk_rcg2 cam_cc_ife_lite_csid_clk_src = { + .name = "cam_cc_ife_lite_csid_clk_src", + .parent_data = cam_cc_parent_data_3, + .num_parents = 6, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -590,7 +590,7 @@ static struct clk_rcg2 cam_cc_ipe_0_clk_src = { + .name = "cam_cc_ipe_0_clk_src", + .parent_data = cam_cc_parent_data_2, + .num_parents = 5, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -613,7 +613,7 @@ static struct clk_rcg2 cam_cc_jpeg_clk_src = { + .name = "cam_cc_jpeg_clk_src", + .parent_data = cam_cc_parent_data_2, + .num_parents = 5, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -635,7 +635,7 @@ static struct clk_rcg2 cam_cc_lrme_clk_src = { + .name = "cam_cc_lrme_clk_src", + .parent_data = cam_cc_parent_data_6, + .num_parents = 5, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -656,7 +656,7 @@ static struct clk_rcg2 cam_cc_mclk0_clk_src = { + .name = "cam_cc_mclk0_clk_src", + .parent_data = cam_cc_parent_data_1, + .num_parents = 3, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -670,7 +670,7 @@ static struct clk_rcg2 cam_cc_mclk1_clk_src = { + .name = "cam_cc_mclk1_clk_src", + .parent_data = cam_cc_parent_data_1, + .num_parents = 3, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -684,7 +684,7 @@ static struct clk_rcg2 cam_cc_mclk2_clk_src = { + .name = "cam_cc_mclk2_clk_src", + .parent_data = cam_cc_parent_data_1, + .num_parents = 3, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -698,7 +698,7 @@ static struct clk_rcg2 cam_cc_mclk3_clk_src = { + .name = "cam_cc_mclk3_clk_src", + .parent_data = cam_cc_parent_data_1, + .num_parents = 3, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -712,7 +712,7 @@ static struct clk_rcg2 cam_cc_mclk4_clk_src = { + .name = "cam_cc_mclk4_clk_src", + .parent_data = cam_cc_parent_data_1, + .num_parents = 3, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +@@ -732,7 +732,7 @@ static struct clk_rcg2 cam_cc_slow_ahb_clk_src = { + .parent_data = cam_cc_parent_data_0, + .num_parents = 4, + .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_shared_ops, + }, + }; + +diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c +index 43ecd507bf836..cf94a12459ea4 100644 +--- a/drivers/clk/socfpga/clk-gate.c ++++ b/drivers/clk/socfpga/clk-gate.c +@@ -99,7 +99,7 @@ static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk, + val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift; + val &= GENMASK(socfpgaclk->width - 1, 0); + /* Check for GPIO_DB_CLK by its offset */ +- if ((int) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET) ++ if ((uintptr_t) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET) + div = val + 1; + else + div = (1 << val); +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c +index a4a47305574cb..c85fdc78fcc92 100644 +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -365,22 +365,18 @@ static int gpiochip_set_desc_names(struct gpio_chip *gc) + * + * Looks for device property "gpio-line-names" and if it exists assigns + * GPIO line names for the chip. The memory allocated for the assigned +- * names belong to the underlying software node and should not be released ++ * names belong to the underlying firmware node and should not be released + * by the caller. + */ + static int devprop_gpiochip_set_names(struct gpio_chip *chip) + { + struct gpio_device *gdev = chip->gpiodev; +- struct device *dev = chip->parent; ++ struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev); + const char **names; + int ret, i; + int count; + +- /* GPIO chip may not have a parent device whose properties we inspect. */ +- if (!dev) +- return 0; +- +- count = device_property_string_array_count(dev, "gpio-line-names"); ++ count = fwnode_property_string_array_count(fwnode, "gpio-line-names"); + if (count < 0) + return 0; + +@@ -394,7 +390,7 @@ static int devprop_gpiochip_set_names(struct gpio_chip *chip) + if (!names) + return -ENOMEM; + +- ret = device_property_read_string_array(dev, "gpio-line-names", ++ ret = fwnode_property_read_string_array(fwnode, "gpio-line-names", + names, count); + if (ret < 0) { + dev_warn(&gdev->dev, "failed to read GPIO line names\n"); +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +index 4d8f19ab10144..8b87991a0470a 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +@@ -907,7 +907,7 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_bo_device *bdev, + + /* Allocate an SG array and squash pages into it */ + r = sg_alloc_table_from_pages(ttm->sg, ttm->pages, ttm->num_pages, 0, +- ttm->num_pages << PAGE_SHIFT, ++ (u64)ttm->num_pages << PAGE_SHIFT, + GFP_KERNEL); + if (r) + goto release_sg; +diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +index c9b1437811053..c22956e8773d7 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +@@ -1224,7 +1224,8 @@ static int smu7_enable_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) + (hwmgr->chip_id == CHIP_POLARIS10) || + (hwmgr->chip_id == CHIP_POLARIS11) || + (hwmgr->chip_id == CHIP_POLARIS12) || +- (hwmgr->chip_id == CHIP_TONGA)) ++ (hwmgr->chip_id == CHIP_TONGA) || ++ (hwmgr->chip_id == CHIP_TOPAZ)) + PHM_WRITE_FIELD(hwmgr->device, MC_SEQ_CNTL_3, CAC_EN, 0x1); + + +diff --git a/drivers/gpu/drm/i915/display/intel_acpi.c b/drivers/gpu/drm/i915/display/intel_acpi.c +index e21fb14d5e07b..833d0c1be4f1d 100644 +--- a/drivers/gpu/drm/i915/display/intel_acpi.c ++++ b/drivers/gpu/drm/i915/display/intel_acpi.c +@@ -84,13 +84,31 @@ static void intel_dsm_platform_mux_info(acpi_handle dhandle) + return; + } + ++ if (!pkg->package.count) { ++ DRM_DEBUG_DRIVER("no connection in _DSM\n"); ++ return; ++ } ++ + connector_count = &pkg->package.elements[0]; + DRM_DEBUG_DRIVER("MUX info connectors: %lld\n", + (unsigned long long)connector_count->integer.value); + for (i = 1; i < pkg->package.count; i++) { + union acpi_object *obj = &pkg->package.elements[i]; +- union acpi_object *connector_id = &obj->package.elements[0]; +- union acpi_object *info = &obj->package.elements[1]; ++ union acpi_object *connector_id; ++ union acpi_object *info; ++ ++ if (obj->type != ACPI_TYPE_PACKAGE || obj->package.count < 2) { ++ DRM_DEBUG_DRIVER("Invalid object for MUX #%d\n", i); ++ continue; ++ } ++ ++ connector_id = &obj->package.elements[0]; ++ info = &obj->package.elements[1]; ++ if (info->type != ACPI_TYPE_BUFFER || info->buffer.length < 4) { ++ DRM_DEBUG_DRIVER("Invalid info for MUX obj #%d\n", i); ++ continue; ++ } ++ + DRM_DEBUG_DRIVER("Connector id: 0x%016llx\n", + (unsigned long long)connector_id->integer.value); + DRM_DEBUG_DRIVER(" port id: %s\n", +diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +index e7a8442b59afd..a676811ef69d2 100644 +--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c ++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +@@ -566,17 +566,17 @@ static bool a6xx_ucode_check_version(struct a6xx_gpu *a6xx_gpu, + } else { + /* + * a650 tier targets don't need whereami but still need to be +- * equal to or newer than 1.95 for other security fixes ++ * equal to or newer than 0.95 for other security fixes + */ + if (adreno_is_a650(adreno_gpu)) { +- if ((buf[0] & 0xfff) >= 0x195) { ++ if ((buf[0] & 0xfff) >= 0x095) { + ret = true; + goto out; + } + + DRM_DEV_ERROR(&gpu->pdev->dev, + "a650 SQE ucode is too old. Have version %x need at least %x\n", +- buf[0] & 0xfff, 0x195); ++ buf[0] & 0xfff, 0x095); + } + + /* +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +index 8981cfa9dbc37..92e6f1b947386 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +@@ -496,7 +496,9 @@ static void dpu_hw_ctl_intf_cfg_v1(struct dpu_hw_ctl *ctx, + + DPU_REG_WRITE(c, CTL_TOP, mode_sel); + DPU_REG_WRITE(c, CTL_INTF_ACTIVE, intf_active); +- DPU_REG_WRITE(c, CTL_MERGE_3D_ACTIVE, BIT(cfg->merge_3d - MERGE_3D_0)); ++ if (cfg->merge_3d) ++ DPU_REG_WRITE(c, CTL_MERGE_3D_ACTIVE, ++ BIT(cfg->merge_3d - MERGE_3D_0)); + } + + static void dpu_hw_ctl_intf_cfg(struct dpu_hw_ctl *ctx, +diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c +index a5c6b8c233366..196907689c82e 100644 +--- a/drivers/gpu/drm/msm/msm_drv.c ++++ b/drivers/gpu/drm/msm/msm_drv.c +@@ -570,6 +570,7 @@ err_free_priv: + kfree(priv); + err_put_drm_dev: + drm_dev_put(ddev); ++ platform_set_drvdata(pdev, NULL); + return ret; + } + +diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c +index 23195d5d4e919..176cb55062be6 100644 +--- a/drivers/gpu/drm/radeon/radeon_ttm.c ++++ b/drivers/gpu/drm/radeon/radeon_ttm.c +@@ -365,7 +365,7 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_bo_device *bdev, struct ttm_tt * + if (gtt->userflags & RADEON_GEM_USERPTR_ANONONLY) { + /* check that we only pin down anonymous memory + to prevent problems with writeback */ +- unsigned long end = gtt->userptr + ttm->num_pages * PAGE_SIZE; ++ unsigned long end = gtt->userptr + (u64)ttm->num_pages * PAGE_SIZE; + struct vm_area_struct *vma; + vma = find_vma(gtt->usermm, gtt->userptr); + if (!vma || vma->vm_file || vma->vm_end < end) +@@ -387,7 +387,7 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_bo_device *bdev, struct ttm_tt * + } while (pinned < ttm->num_pages); + + r = sg_alloc_table_from_pages(ttm->sg, ttm->pages, ttm->num_pages, 0, +- ttm->num_pages << PAGE_SHIFT, ++ (u64)ttm->num_pages << PAGE_SHIFT, + GFP_KERNEL); + if (r) + goto release_sg; +diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c +index ea710beb8e005..351c601f0ddbb 100644 +--- a/drivers/gpu/drm/vc4/vc4_crtc.c ++++ b/drivers/gpu/drm/vc4/vc4_crtc.c +@@ -210,6 +210,7 @@ static u32 vc4_get_fifo_full_level(struct vc4_crtc *vc4_crtc, u32 format) + { + const struct vc4_crtc_data *crtc_data = vc4_crtc_to_vc4_crtc_data(vc4_crtc); + const struct vc4_pv_data *pv_data = vc4_crtc_to_vc4_pv_data(vc4_crtc); ++ struct vc4_dev *vc4 = to_vc4_dev(vc4_crtc->base.dev); + u32 fifo_len_bytes = pv_data->fifo_depth; + + /* +@@ -238,6 +239,22 @@ static u32 vc4_get_fifo_full_level(struct vc4_crtc *vc4_crtc, u32 format) + if (crtc_data->hvs_output == 5) + return 32; + ++ /* ++ * It looks like in some situations, we will overflow ++ * the PixelValve FIFO (with the bit 10 of PV stat being ++ * set) and stall the HVS / PV, eventually resulting in ++ * a page flip timeout. ++ * ++ * Displaying the video overlay during a playback with ++ * Kodi on an RPi3 seems to be a great solution with a ++ * failure rate around 50%. ++ * ++ * Removing 1 from the FIFO full level however ++ * seems to completely remove that issue. ++ */ ++ if (!vc4->hvs->hvs5) ++ return fifo_len_bytes - 3 * HVS_FIFO_LATENCY_PIX - 1; ++ + return fifo_len_bytes - 3 * HVS_FIFO_LATENCY_PIX; + } + } +diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c +index d6425ad6e6a38..2871cf2ee8b44 100644 +--- a/drivers/i2c/busses/i2c-designware-master.c ++++ b/drivers/i2c/busses/i2c-designware-master.c +@@ -129,6 +129,7 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) + if ((comp_param1 & DW_IC_COMP_PARAM_1_SPEED_MODE_MASK) + != DW_IC_COMP_PARAM_1_SPEED_MODE_HIGH) { + dev_err(dev->dev, "High Speed not supported!\n"); ++ t->bus_freq_hz = I2C_MAX_FAST_MODE_FREQ; + dev->master_cfg &= ~DW_IC_CON_SPEED_MASK; + dev->master_cfg |= DW_IC_CON_SPEED_FAST; + dev->hs_hcnt = 0; +diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c +index cb4a25ebb8900..2a946c2079284 100644 +--- a/drivers/i2c/busses/i2c-jz4780.c ++++ b/drivers/i2c/busses/i2c-jz4780.c +@@ -526,8 +526,8 @@ static irqreturn_t jz4780_i2c_irq(int irqno, void *dev_id) + i2c_sta = jz4780_i2c_readw(i2c, JZ4780_I2C_STA); + data = *i2c->wbuf; + data &= ~JZ4780_I2C_DC_READ; +- if ((!i2c->stop_hold) && (i2c->cdata->version >= +- ID_X1000)) ++ if ((i2c->wt_len == 1) && (!i2c->stop_hold) && ++ (i2c->cdata->version >= ID_X1000)) + data |= X1000_I2C_DC_STOP; + jz4780_i2c_writew(i2c, JZ4780_I2C_DC, data); + i2c->wbuf++; +diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c +index 63ebf722a4248..f21362355973e 100644 +--- a/drivers/i2c/i2c-core-base.c ++++ b/drivers/i2c/i2c-core-base.c +@@ -378,7 +378,7 @@ static int i2c_gpio_init_recovery(struct i2c_adapter *adap) + static int i2c_init_recovery(struct i2c_adapter *adap) + { + struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; +- char *err_str; ++ char *err_str, *err_level = KERN_ERR; + + if (!bri) + return 0; +@@ -387,7 +387,8 @@ static int i2c_init_recovery(struct i2c_adapter *adap) + return -EPROBE_DEFER; + + if (!bri->recover_bus) { +- err_str = "no recover_bus() found"; ++ err_str = "no suitable method provided"; ++ err_level = KERN_DEBUG; + goto err; + } + +@@ -414,7 +415,7 @@ static int i2c_init_recovery(struct i2c_adapter *adap) + + return 0; + err: +- dev_err(&adap->dev, "Not using recovery: %s\n", err_str); ++ dev_printk(err_level, &adap->dev, "Not using recovery: %s\n", err_str); + adap->bus_recovery_info = NULL; + + return -EINVAL; +diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c +index 0abce004a9591..65e3e7df8a4b0 100644 +--- a/drivers/infiniband/core/addr.c ++++ b/drivers/infiniband/core/addr.c +@@ -76,7 +76,9 @@ static struct workqueue_struct *addr_wq; + + static const struct nla_policy ib_nl_addr_policy[LS_NLA_TYPE_MAX] = { + [LS_NLA_TYPE_DGID] = {.type = NLA_BINARY, +- .len = sizeof(struct rdma_nla_ls_gid)}, ++ .len = sizeof(struct rdma_nla_ls_gid), ++ .validation_type = NLA_VALIDATE_MIN, ++ .min = sizeof(struct rdma_nla_ls_gid)}, + }; + + static inline bool ib_nl_is_good_ip_resp(const struct nlmsghdr *nlh) +diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c +index 81903749d2415..e42c812e74c3c 100644 +--- a/drivers/infiniband/hw/cxgb4/cm.c ++++ b/drivers/infiniband/hw/cxgb4/cm.c +@@ -3616,7 +3616,8 @@ int c4iw_destroy_listen(struct iw_cm_id *cm_id) + c4iw_init_wr_wait(ep->com.wr_waitp); + err = cxgb4_remove_server( + ep->com.dev->rdev.lldi.ports[0], ep->stid, +- ep->com.dev->rdev.lldi.rxq_ids[0], true); ++ ep->com.dev->rdev.lldi.rxq_ids[0], ++ ep->com.local_addr.ss_family == AF_INET6); + if (err) + goto done; + err = c4iw_wait_for_reply(&ep->com.dev->rdev, ep->com.wr_waitp, +diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c +index 2a91b8d95e12f..04b1e8f021f64 100644 +--- a/drivers/infiniband/hw/hfi1/affinity.c ++++ b/drivers/infiniband/hw/hfi1/affinity.c +@@ -632,22 +632,11 @@ static void _dev_comp_vect_cpu_mask_clean_up(struct hfi1_devdata *dd, + */ + int hfi1_dev_affinity_init(struct hfi1_devdata *dd) + { +- int node = pcibus_to_node(dd->pcidev->bus); + struct hfi1_affinity_node *entry; + const struct cpumask *local_mask; + int curr_cpu, possible, i, ret; + bool new_entry = false; + +- /* +- * If the BIOS does not have the NUMA node information set, select +- * NUMA 0 so we get consistent performance. +- */ +- if (node < 0) { +- dd_dev_err(dd, "Invalid PCI NUMA node. Performance may be affected\n"); +- node = 0; +- } +- dd->node = node; +- + local_mask = cpumask_of_node(dd->node); + if (cpumask_first(local_mask) >= nr_cpu_ids) + local_mask = topology_core_cpumask(0); +@@ -660,7 +649,7 @@ int hfi1_dev_affinity_init(struct hfi1_devdata *dd) + * create an entry in the global affinity structure and initialize it. + */ + if (!entry) { +- entry = node_affinity_allocate(node); ++ entry = node_affinity_allocate(dd->node); + if (!entry) { + dd_dev_err(dd, + "Unable to allocate global affinity node\n"); +@@ -751,6 +740,7 @@ int hfi1_dev_affinity_init(struct hfi1_devdata *dd) + if (new_entry) + node_affinity_add_tail(entry); + ++ dd->affinity_entry = entry; + mutex_unlock(&node_affinity.lock); + + return 0; +@@ -766,10 +756,9 @@ void hfi1_dev_affinity_clean_up(struct hfi1_devdata *dd) + { + struct hfi1_affinity_node *entry; + +- if (dd->node < 0) +- return; +- + mutex_lock(&node_affinity.lock); ++ if (!dd->affinity_entry) ++ goto unlock; + entry = node_affinity_lookup(dd->node); + if (!entry) + goto unlock; +@@ -780,8 +769,8 @@ void hfi1_dev_affinity_clean_up(struct hfi1_devdata *dd) + */ + _dev_comp_vect_cpu_mask_clean_up(dd, entry); + unlock: ++ dd->affinity_entry = NULL; + mutex_unlock(&node_affinity.lock); +- dd->node = NUMA_NO_NODE; + } + + /* +diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h +index e09e8244a94c4..2a9a040569ebb 100644 +--- a/drivers/infiniband/hw/hfi1/hfi.h ++++ b/drivers/infiniband/hw/hfi1/hfi.h +@@ -1409,6 +1409,7 @@ struct hfi1_devdata { + spinlock_t irq_src_lock; + int vnic_num_vports; + struct net_device *dummy_netdev; ++ struct hfi1_affinity_node *affinity_entry; + + /* Keeps track of IPoIB RSM rule users */ + atomic_t ipoib_rsm_usr_num; +diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c +index cb7ad12888219..786c6316273f7 100644 +--- a/drivers/infiniband/hw/hfi1/init.c ++++ b/drivers/infiniband/hw/hfi1/init.c +@@ -1277,7 +1277,6 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, + dd->pport = (struct hfi1_pportdata *)(dd + 1); + dd->pcidev = pdev; + pci_set_drvdata(pdev, dd); +- dd->node = NUMA_NO_NODE; + + ret = xa_alloc_irq(&hfi1_dev_table, &dd->unit, dd, xa_limit_32b, + GFP_KERNEL); +@@ -1287,6 +1286,15 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, + goto bail; + } + rvt_set_ibdev_name(&dd->verbs_dev.rdi, "%s_%d", class_name(), dd->unit); ++ /* ++ * If the BIOS does not have the NUMA node information set, select ++ * NUMA 0 so we get consistent performance. ++ */ ++ dd->node = pcibus_to_node(pdev->bus); ++ if (dd->node == NUMA_NO_NODE) { ++ dd_dev_err(dd, "Invalid PCI NUMA node. Performance may be affected\n"); ++ dd->node = 0; ++ } + + /* + * Initialize all locks for the device. This needs to be as early as +diff --git a/drivers/infiniband/hw/hfi1/netdev_rx.c b/drivers/infiniband/hw/hfi1/netdev_rx.c +index 6d263c9749b36..ea95baada2b6b 100644 +--- a/drivers/infiniband/hw/hfi1/netdev_rx.c ++++ b/drivers/infiniband/hw/hfi1/netdev_rx.c +@@ -173,8 +173,7 @@ u32 hfi1_num_netdev_contexts(struct hfi1_devdata *dd, u32 available_contexts, + return 0; + } + +- cpumask_and(node_cpu_mask, cpu_mask, +- cpumask_of_node(pcibus_to_node(dd->pcidev->bus))); ++ cpumask_and(node_cpu_mask, cpu_mask, cpumask_of_node(dd->node)); + + available_cpus = cpumask_weight(node_cpu_mask); + +diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c +index 0eb6a7a618e07..9ea542270ed4a 100644 +--- a/drivers/infiniband/hw/qedr/verbs.c ++++ b/drivers/infiniband/hw/qedr/verbs.c +@@ -1244,7 +1244,8 @@ static int qedr_check_qp_attrs(struct ib_pd *ibpd, struct qedr_dev *dev, + * TGT QP isn't associated with RQ/SQ + */ + if ((attrs->qp_type != IB_QPT_GSI) && (dev->gsi_qp_created) && +- (attrs->qp_type != IB_QPT_XRC_TGT)) { ++ (attrs->qp_type != IB_QPT_XRC_TGT) && ++ (attrs->qp_type != IB_QPT_XRC_INI)) { + struct qedr_cq *send_cq = get_qedr_cq(attrs->send_cq); + struct qedr_cq *recv_cq = get_qedr_cq(attrs->recv_cq); + +diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c +index 394c1f6822b90..ee37c5af3a8c9 100644 +--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c +@@ -2735,8 +2735,8 @@ void rtrs_clt_close(struct rtrs_clt *clt) + + /* Now it is safe to iterate over all paths without locks */ + list_for_each_entry_safe(sess, tmp, &clt->paths_list, s.entry) { +- rtrs_clt_destroy_sess_files(sess, NULL); + rtrs_clt_close_conns(sess, true); ++ rtrs_clt_destroy_sess_files(sess, NULL); + kobject_put(&sess->kobj); + } + free_clt(clt); +diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c +index 25859d16d06f8..e7be36dc2159a 100644 +--- a/drivers/net/can/spi/mcp251x.c ++++ b/drivers/net/can/spi/mcp251x.c +@@ -314,6 +314,18 @@ static int mcp251x_spi_trans(struct spi_device *spi, int len) + return ret; + } + ++static int mcp251x_spi_write(struct spi_device *spi, int len) ++{ ++ struct mcp251x_priv *priv = spi_get_drvdata(spi); ++ int ret; ++ ++ ret = spi_write(spi, priv->spi_tx_buf, len); ++ if (ret) ++ dev_err(&spi->dev, "spi write failed: ret = %d\n", ret); ++ ++ return ret; ++} ++ + static u8 mcp251x_read_reg(struct spi_device *spi, u8 reg) + { + struct mcp251x_priv *priv = spi_get_drvdata(spi); +@@ -361,7 +373,7 @@ static void mcp251x_write_reg(struct spi_device *spi, u8 reg, u8 val) + priv->spi_tx_buf[1] = reg; + priv->spi_tx_buf[2] = val; + +- mcp251x_spi_trans(spi, 3); ++ mcp251x_spi_write(spi, 3); + } + + static void mcp251x_write_2regs(struct spi_device *spi, u8 reg, u8 v1, u8 v2) +@@ -373,7 +385,7 @@ static void mcp251x_write_2regs(struct spi_device *spi, u8 reg, u8 v1, u8 v2) + priv->spi_tx_buf[2] = v1; + priv->spi_tx_buf[3] = v2; + +- mcp251x_spi_trans(spi, 4); ++ mcp251x_spi_write(spi, 4); + } + + static void mcp251x_write_bits(struct spi_device *spi, u8 reg, +@@ -386,7 +398,7 @@ static void mcp251x_write_bits(struct spi_device *spi, u8 reg, + priv->spi_tx_buf[2] = mask; + priv->spi_tx_buf[3] = val; + +- mcp251x_spi_trans(spi, 4); ++ mcp251x_spi_write(spi, 4); + } + + static u8 mcp251x_read_stat(struct spi_device *spi) +@@ -618,7 +630,7 @@ static void mcp251x_hw_tx_frame(struct spi_device *spi, u8 *buf, + buf[i]); + } else { + memcpy(priv->spi_tx_buf, buf, TXBDAT_OFF + len); +- mcp251x_spi_trans(spi, TXBDAT_OFF + len); ++ mcp251x_spi_write(spi, TXBDAT_OFF + len); + } + } + +@@ -650,7 +662,7 @@ static void mcp251x_hw_tx(struct spi_device *spi, struct can_frame *frame, + + /* use INSTRUCTION_RTS, to avoid "repeated frame problem" */ + priv->spi_tx_buf[0] = INSTRUCTION_RTS(1 << tx_buf_idx); +- mcp251x_spi_trans(priv->spi, 1); ++ mcp251x_spi_write(priv->spi, 1); + } + + static void mcp251x_hw_rx_frame(struct spi_device *spi, u8 *buf, +@@ -888,7 +900,7 @@ static int mcp251x_hw_reset(struct spi_device *spi) + mdelay(MCP251X_OST_DELAY_MS); + + priv->spi_tx_buf[0] = INSTRUCTION_RESET; +- ret = mcp251x_spi_trans(spi, 1); ++ ret = mcp251x_spi_write(spi, 1); + if (ret) + return ret; + +diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c +index 251835ea15aa7..18c7d8c151a40 100644 +--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c ++++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c +@@ -857,7 +857,7 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, + if (dev->adapter->dev_set_bus) { + err = dev->adapter->dev_set_bus(dev, 0); + if (err) +- goto lbl_unregister_candev; ++ goto adap_dev_free; + } + + /* get device number early */ +@@ -869,6 +869,10 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, + + return 0; + ++adap_dev_free: ++ if (dev->adapter->dev_free) ++ dev->adapter->dev_free(dev); ++ + lbl_unregister_candev: + unregister_candev(netdev); + +diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c +index 662e68a0e7e61..93c7fa1fd4cb6 100644 +--- a/drivers/net/dsa/lantiq_gswip.c ++++ b/drivers/net/dsa/lantiq_gswip.c +@@ -93,8 +93,12 @@ + + /* GSWIP MII Registers */ + #define GSWIP_MII_CFGp(p) (0x2 * (p)) ++#define GSWIP_MII_CFG_RESET BIT(15) + #define GSWIP_MII_CFG_EN BIT(14) ++#define GSWIP_MII_CFG_ISOLATE BIT(13) + #define GSWIP_MII_CFG_LDCLKDIS BIT(12) ++#define GSWIP_MII_CFG_RGMII_IBS BIT(8) ++#define GSWIP_MII_CFG_RMII_CLK BIT(7) + #define GSWIP_MII_CFG_MODE_MIIP 0x0 + #define GSWIP_MII_CFG_MODE_MIIM 0x1 + #define GSWIP_MII_CFG_MODE_RMIIP 0x2 +@@ -190,6 +194,23 @@ + #define GSWIP_PCE_DEFPVID(p) (0x486 + ((p) * 0xA)) + + #define GSWIP_MAC_FLEN 0x8C5 ++#define GSWIP_MAC_CTRL_0p(p) (0x903 + ((p) * 0xC)) ++#define GSWIP_MAC_CTRL_0_PADEN BIT(8) ++#define GSWIP_MAC_CTRL_0_FCS_EN BIT(7) ++#define GSWIP_MAC_CTRL_0_FCON_MASK 0x0070 ++#define GSWIP_MAC_CTRL_0_FCON_AUTO 0x0000 ++#define GSWIP_MAC_CTRL_0_FCON_RX 0x0010 ++#define GSWIP_MAC_CTRL_0_FCON_TX 0x0020 ++#define GSWIP_MAC_CTRL_0_FCON_RXTX 0x0030 ++#define GSWIP_MAC_CTRL_0_FCON_NONE 0x0040 ++#define GSWIP_MAC_CTRL_0_FDUP_MASK 0x000C ++#define GSWIP_MAC_CTRL_0_FDUP_AUTO 0x0000 ++#define GSWIP_MAC_CTRL_0_FDUP_EN 0x0004 ++#define GSWIP_MAC_CTRL_0_FDUP_DIS 0x000C ++#define GSWIP_MAC_CTRL_0_GMII_MASK 0x0003 ++#define GSWIP_MAC_CTRL_0_GMII_AUTO 0x0000 ++#define GSWIP_MAC_CTRL_0_GMII_MII 0x0001 ++#define GSWIP_MAC_CTRL_0_GMII_RGMII 0x0002 + #define GSWIP_MAC_CTRL_2p(p) (0x905 + ((p) * 0xC)) + #define GSWIP_MAC_CTRL_2_MLEN BIT(3) /* Maximum Untagged Frame Lnegth */ + +@@ -653,16 +674,13 @@ static int gswip_port_enable(struct dsa_switch *ds, int port, + GSWIP_SDMA_PCTRLp(port)); + + if (!dsa_is_cpu_port(ds, port)) { +- u32 macconf = GSWIP_MDIO_PHY_LINK_AUTO | +- GSWIP_MDIO_PHY_SPEED_AUTO | +- GSWIP_MDIO_PHY_FDUP_AUTO | +- GSWIP_MDIO_PHY_FCONTX_AUTO | +- GSWIP_MDIO_PHY_FCONRX_AUTO | +- (phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK); +- +- gswip_mdio_w(priv, macconf, GSWIP_MDIO_PHYp(port)); +- /* Activate MDIO auto polling */ +- gswip_mdio_mask(priv, 0, BIT(port), GSWIP_MDIO_MDC_CFG0); ++ u32 mdio_phy = 0; ++ ++ if (phydev) ++ mdio_phy = phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK; ++ ++ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_ADDR_MASK, mdio_phy, ++ GSWIP_MDIO_PHYp(port)); + } + + return 0; +@@ -675,14 +693,6 @@ static void gswip_port_disable(struct dsa_switch *ds, int port) + if (!dsa_is_user_port(ds, port)) + return; + +- if (!dsa_is_cpu_port(ds, port)) { +- gswip_mdio_mask(priv, GSWIP_MDIO_PHY_LINK_DOWN, +- GSWIP_MDIO_PHY_LINK_MASK, +- GSWIP_MDIO_PHYp(port)); +- /* Deactivate MDIO auto polling */ +- gswip_mdio_mask(priv, BIT(port), 0, GSWIP_MDIO_MDC_CFG0); +- } +- + gswip_switch_mask(priv, GSWIP_FDMA_PCTRL_EN, 0, + GSWIP_FDMA_PCTRLp(port)); + gswip_switch_mask(priv, GSWIP_SDMA_PCTRL_EN, 0, +@@ -806,14 +816,32 @@ static int gswip_setup(struct dsa_switch *ds) + gswip_switch_w(priv, BIT(cpu_port), GSWIP_PCE_PMAP2); + gswip_switch_w(priv, BIT(cpu_port), GSWIP_PCE_PMAP3); + +- /* disable PHY auto polling */ ++ /* Deactivate MDIO PHY auto polling. Some PHYs as the AR8030 have an ++ * interoperability problem with this auto polling mechanism because ++ * their status registers think that the link is in a different state ++ * than it actually is. For the AR8030 it has the BMSR_ESTATEN bit set ++ * as well as ESTATUS_1000_TFULL and ESTATUS_1000_XFULL. This makes the ++ * auto polling state machine consider the link being negotiated with ++ * 1Gbit/s. Since the PHY itself is a Fast Ethernet RMII PHY this leads ++ * to the switch port being completely dead (RX and TX are both not ++ * working). ++ * Also with various other PHY / port combinations (PHY11G GPHY, PHY22F ++ * GPHY, external RGMII PEF7071/7072) any traffic would stop. Sometimes ++ * it would work fine for a few minutes to hours and then stop, on ++ * other device it would no traffic could be sent or received at all. ++ * Testing shows that when PHY auto polling is disabled these problems ++ * go away. ++ */ + gswip_mdio_w(priv, 0x0, GSWIP_MDIO_MDC_CFG0); ++ + /* Configure the MDIO Clock 2.5 MHz */ + gswip_mdio_mask(priv, 0xff, 0x09, GSWIP_MDIO_MDC_CFG1); + +- /* Disable the xMII link */ ++ /* Disable the xMII interface and clear it's isolation bit */ + for (i = 0; i < priv->hw_info->max_ports; i++) +- gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, i); ++ gswip_mii_mask_cfg(priv, ++ GSWIP_MII_CFG_EN | GSWIP_MII_CFG_ISOLATE, ++ 0, i); + + /* enable special tag insertion on cpu port */ + gswip_switch_mask(priv, 0, GSWIP_FDMA_PCTRL_STEN, +@@ -1464,6 +1492,112 @@ unsupported: + return; + } + ++static void gswip_port_set_link(struct gswip_priv *priv, int port, bool link) ++{ ++ u32 mdio_phy; ++ ++ if (link) ++ mdio_phy = GSWIP_MDIO_PHY_LINK_UP; ++ else ++ mdio_phy = GSWIP_MDIO_PHY_LINK_DOWN; ++ ++ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_LINK_MASK, mdio_phy, ++ GSWIP_MDIO_PHYp(port)); ++} ++ ++static void gswip_port_set_speed(struct gswip_priv *priv, int port, int speed, ++ phy_interface_t interface) ++{ ++ u32 mdio_phy = 0, mii_cfg = 0, mac_ctrl_0 = 0; ++ ++ switch (speed) { ++ case SPEED_10: ++ mdio_phy = GSWIP_MDIO_PHY_SPEED_M10; ++ ++ if (interface == PHY_INTERFACE_MODE_RMII) ++ mii_cfg = GSWIP_MII_CFG_RATE_M50; ++ else ++ mii_cfg = GSWIP_MII_CFG_RATE_M2P5; ++ ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_GMII_MII; ++ break; ++ ++ case SPEED_100: ++ mdio_phy = GSWIP_MDIO_PHY_SPEED_M100; ++ ++ if (interface == PHY_INTERFACE_MODE_RMII) ++ mii_cfg = GSWIP_MII_CFG_RATE_M50; ++ else ++ mii_cfg = GSWIP_MII_CFG_RATE_M25; ++ ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_GMII_MII; ++ break; ++ ++ case SPEED_1000: ++ mdio_phy = GSWIP_MDIO_PHY_SPEED_G1; ++ ++ mii_cfg = GSWIP_MII_CFG_RATE_M125; ++ ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_GMII_RGMII; ++ break; ++ } ++ ++ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_SPEED_MASK, mdio_phy, ++ GSWIP_MDIO_PHYp(port)); ++ gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_RATE_MASK, mii_cfg, port); ++ gswip_switch_mask(priv, GSWIP_MAC_CTRL_0_GMII_MASK, mac_ctrl_0, ++ GSWIP_MAC_CTRL_0p(port)); ++} ++ ++static void gswip_port_set_duplex(struct gswip_priv *priv, int port, int duplex) ++{ ++ u32 mac_ctrl_0, mdio_phy; ++ ++ if (duplex == DUPLEX_FULL) { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FDUP_EN; ++ mdio_phy = GSWIP_MDIO_PHY_FDUP_EN; ++ } else { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FDUP_DIS; ++ mdio_phy = GSWIP_MDIO_PHY_FDUP_DIS; ++ } ++ ++ gswip_switch_mask(priv, GSWIP_MAC_CTRL_0_FDUP_MASK, mac_ctrl_0, ++ GSWIP_MAC_CTRL_0p(port)); ++ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_FDUP_MASK, mdio_phy, ++ GSWIP_MDIO_PHYp(port)); ++} ++ ++static void gswip_port_set_pause(struct gswip_priv *priv, int port, ++ bool tx_pause, bool rx_pause) ++{ ++ u32 mac_ctrl_0, mdio_phy; ++ ++ if (tx_pause && rx_pause) { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_RXTX; ++ mdio_phy = GSWIP_MDIO_PHY_FCONTX_EN | ++ GSWIP_MDIO_PHY_FCONRX_EN; ++ } else if (tx_pause) { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_TX; ++ mdio_phy = GSWIP_MDIO_PHY_FCONTX_EN | ++ GSWIP_MDIO_PHY_FCONRX_DIS; ++ } else if (rx_pause) { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_RX; ++ mdio_phy = GSWIP_MDIO_PHY_FCONTX_DIS | ++ GSWIP_MDIO_PHY_FCONRX_EN; ++ } else { ++ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_NONE; ++ mdio_phy = GSWIP_MDIO_PHY_FCONTX_DIS | ++ GSWIP_MDIO_PHY_FCONRX_DIS; ++ } ++ ++ gswip_switch_mask(priv, GSWIP_MAC_CTRL_0_FCON_MASK, ++ mac_ctrl_0, GSWIP_MAC_CTRL_0p(port)); ++ gswip_mdio_mask(priv, ++ GSWIP_MDIO_PHY_FCONTX_MASK | ++ GSWIP_MDIO_PHY_FCONRX_MASK, ++ mdio_phy, GSWIP_MDIO_PHYp(port)); ++} ++ + static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, + unsigned int mode, + const struct phylink_link_state *state) +@@ -1483,6 +1617,9 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, + break; + case PHY_INTERFACE_MODE_RMII: + miicfg |= GSWIP_MII_CFG_MODE_RMIIM; ++ ++ /* Configure the RMII clock as output: */ ++ miicfg |= GSWIP_MII_CFG_RMII_CLK; + break; + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: +@@ -1495,7 +1632,11 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, + "Unsupported interface: %d\n", state->interface); + return; + } +- gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_MODE_MASK, miicfg, port); ++ ++ gswip_mii_mask_cfg(priv, ++ GSWIP_MII_CFG_MODE_MASK | GSWIP_MII_CFG_RMII_CLK | ++ GSWIP_MII_CFG_RGMII_IBS | GSWIP_MII_CFG_LDCLKDIS, ++ miicfg, port); + + switch (state->interface) { + case PHY_INTERFACE_MODE_RGMII_ID: +@@ -1520,6 +1661,9 @@ static void gswip_phylink_mac_link_down(struct dsa_switch *ds, int port, + struct gswip_priv *priv = ds->priv; + + gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, port); ++ ++ if (!dsa_is_cpu_port(ds, port)) ++ gswip_port_set_link(priv, port, false); + } + + static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port, +@@ -1531,6 +1675,13 @@ static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port, + { + struct gswip_priv *priv = ds->priv; + ++ if (!dsa_is_cpu_port(ds, port)) { ++ gswip_port_set_link(priv, port, true); ++ gswip_port_set_speed(priv, port, speed, interface); ++ gswip_port_set_duplex(priv, port, duplex); ++ gswip_port_set_pause(priv, port, tx_pause, rx_pause); ++ } ++ + gswip_mii_mask_cfg(priv, 0, GSWIP_MII_CFG_EN, port); + } + +diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h +index ba8321ec1ee73..3305979a9f7c1 100644 +--- a/drivers/net/ethernet/amd/xgbe/xgbe.h ++++ b/drivers/net/ethernet/amd/xgbe/xgbe.h +@@ -180,9 +180,9 @@ + #define XGBE_DMA_SYS_AWCR 0x30303030 + + /* DMA cache settings - PCI device */ +-#define XGBE_DMA_PCI_ARCR 0x00000003 +-#define XGBE_DMA_PCI_AWCR 0x13131313 +-#define XGBE_DMA_PCI_AWARCR 0x00000313 ++#define XGBE_DMA_PCI_ARCR 0x000f0f0f ++#define XGBE_DMA_PCI_AWCR 0x0f0f0f0f ++#define XGBE_DMA_PCI_AWARCR 0x00000f0f + + /* DMA channel interrupt modes */ + #define XGBE_IRQ_MODE_EDGE 0 +diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c +index 07cdb38e7d118..fbedbceef2d1b 100644 +--- a/drivers/net/ethernet/cadence/macb_main.c ++++ b/drivers/net/ethernet/cadence/macb_main.c +@@ -3235,6 +3235,9 @@ static void gem_prog_cmp_regs(struct macb *bp, struct ethtool_rx_flow_spec *fs) + bool cmp_b = false; + bool cmp_c = false; + ++ if (!macb_is_gem(bp)) ++ return; ++ + tp4sp_v = &(fs->h_u.tcp_ip4_spec); + tp4sp_m = &(fs->m_u.tcp_ip4_spec); + +@@ -3603,6 +3606,7 @@ static void macb_restore_features(struct macb *bp) + { + struct net_device *netdev = bp->dev; + netdev_features_t features = netdev->features; ++ struct ethtool_rx_fs_item *item; + + /* TX checksum offload */ + macb_set_txcsum_feature(bp, features); +@@ -3611,6 +3615,9 @@ static void macb_restore_features(struct macb *bp) + macb_set_rxcsum_feature(bp, features); + + /* RX Flow Filters */ ++ list_for_each_entry(item, &bp->rx_fs_list.list, list) ++ gem_prog_cmp_regs(bp, &item->fs); ++ + macb_set_rxflow_feature(bp, features); + } + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +index 75474f8102490..c5b0e725b2382 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +@@ -1794,11 +1794,25 @@ int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init, + struct cudbg_buffer temp_buff = { 0 }; + struct sge_qbase_reg_field *sge_qbase; + struct ireg_buf *ch_sge_dbg; ++ u8 padap_running = 0; + int i, rc; ++ u32 size; + +- rc = cudbg_get_buff(pdbg_init, dbg_buff, +- sizeof(*ch_sge_dbg) * 2 + sizeof(*sge_qbase), +- &temp_buff); ++ /* Accessing SGE_QBASE_MAP[0-3] and SGE_QBASE_INDEX regs can ++ * lead to SGE missing doorbells under heavy traffic. So, only ++ * collect them when adapter is idle. ++ */ ++ for_each_port(padap, i) { ++ padap_running = netif_running(padap->port[i]); ++ if (padap_running) ++ break; ++ } ++ ++ size = sizeof(*ch_sge_dbg) * 2; ++ if (!padap_running) ++ size += sizeof(*sge_qbase); ++ ++ rc = cudbg_get_buff(pdbg_init, dbg_buff, size, &temp_buff); + if (rc) + return rc; + +@@ -1820,7 +1834,8 @@ int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init, + ch_sge_dbg++; + } + +- if (CHELSIO_CHIP_VERSION(padap->params.chip) > CHELSIO_T5) { ++ if (CHELSIO_CHIP_VERSION(padap->params.chip) > CHELSIO_T5 && ++ !padap_running) { + sge_qbase = (struct sge_qbase_reg_field *)ch_sge_dbg; + /* 1 addr reg SGE_QBASE_INDEX and 4 data reg + * SGE_QBASE_MAP[0-3] +diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +index 98d01a7497ecd..581670dced6ec 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +@@ -2090,7 +2090,8 @@ void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size) + 0x1190, 0x1194, + 0x11a0, 0x11a4, + 0x11b0, 0x11b4, +- 0x11fc, 0x1274, ++ 0x11fc, 0x123c, ++ 0x1254, 0x1274, + 0x1280, 0x133c, + 0x1800, 0x18fc, + 0x3000, 0x302c, +diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c +index 4fab2ee5bbf58..e4d9c4c640e55 100644 +--- a/drivers/net/ethernet/freescale/gianfar.c ++++ b/drivers/net/ethernet/freescale/gianfar.c +@@ -364,7 +364,11 @@ static void gfar_set_mac_for_addr(struct net_device *dev, int num, + + static int gfar_set_mac_addr(struct net_device *dev, void *p) + { +- eth_mac_addr(dev, p); ++ int ret; ++ ++ ret = eth_mac_addr(dev, p); ++ if (ret) ++ return ret; + + gfar_set_mac_for_addr(dev, 0, dev->dev_addr); + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +index 674b3a22e91fe..3bd7bc7946771 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +@@ -2575,14 +2575,14 @@ static int hclgevf_ae_start(struct hnae3_handle *handle) + { + struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); + ++ clear_bit(HCLGEVF_STATE_DOWN, &hdev->state); ++ + hclgevf_reset_tqp_stats(handle); + + hclgevf_request_link_info(hdev); + + hclgevf_update_link_mode(hdev); + +- clear_bit(HCLGEVF_STATE_DOWN, &hdev->state); +- + return 0; + } + +diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h +index 118473dfdcbd2..fe1258778cbc4 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e.h ++++ b/drivers/net/ethernet/intel/i40e/i40e.h +@@ -142,6 +142,7 @@ enum i40e_state_t { + __I40E_VIRTCHNL_OP_PENDING, + __I40E_RECOVERY_MODE, + __I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */ ++ __I40E_VFS_RELEASING, + /* This must be last as it determines the size of the BITMAP */ + __I40E_STATE_SIZE__, + }; +diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c +index d7c13ca9be7dd..d627b59ad4465 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c +@@ -578,6 +578,9 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, + case RING_TYPE_XDP: + ring = kmemdup(vsi->xdp_rings[ring_id], sizeof(*ring), GFP_KERNEL); + break; ++ default: ++ ring = NULL; ++ break; + } + if (!ring) + return; +diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +index 9e81f85ee2d8d..31d48a85cfaf0 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +@@ -232,6 +232,8 @@ static void __i40e_add_stat_strings(u8 **p, const struct i40e_stats stats[], + I40E_STAT(struct i40e_vsi, _name, _stat) + #define I40E_VEB_STAT(_name, _stat) \ + I40E_STAT(struct i40e_veb, _name, _stat) ++#define I40E_VEB_TC_STAT(_name, _stat) \ ++ I40E_STAT(struct i40e_cp_veb_tc_stats, _name, _stat) + #define I40E_PFC_STAT(_name, _stat) \ + I40E_STAT(struct i40e_pfc_stats, _name, _stat) + #define I40E_QUEUE_STAT(_name, _stat) \ +@@ -266,11 +268,18 @@ static const struct i40e_stats i40e_gstrings_veb_stats[] = { + I40E_VEB_STAT("veb.rx_unknown_protocol", stats.rx_unknown_protocol), + }; + ++struct i40e_cp_veb_tc_stats { ++ u64 tc_rx_packets; ++ u64 tc_rx_bytes; ++ u64 tc_tx_packets; ++ u64 tc_tx_bytes; ++}; ++ + static const struct i40e_stats i40e_gstrings_veb_tc_stats[] = { +- I40E_VEB_STAT("veb.tc_%u_tx_packets", tc_stats.tc_tx_packets), +- I40E_VEB_STAT("veb.tc_%u_tx_bytes", tc_stats.tc_tx_bytes), +- I40E_VEB_STAT("veb.tc_%u_rx_packets", tc_stats.tc_rx_packets), +- I40E_VEB_STAT("veb.tc_%u_rx_bytes", tc_stats.tc_rx_bytes), ++ I40E_VEB_TC_STAT("veb.tc_%u_tx_packets", tc_tx_packets), ++ I40E_VEB_TC_STAT("veb.tc_%u_tx_bytes", tc_tx_bytes), ++ I40E_VEB_TC_STAT("veb.tc_%u_rx_packets", tc_rx_packets), ++ I40E_VEB_TC_STAT("veb.tc_%u_rx_bytes", tc_rx_bytes), + }; + + static const struct i40e_stats i40e_gstrings_misc_stats[] = { +@@ -1101,6 +1110,7 @@ static int i40e_get_link_ksettings(struct net_device *netdev, + + /* Set flow control settings */ + ethtool_link_ksettings_add_link_mode(ks, supported, Pause); ++ ethtool_link_ksettings_add_link_mode(ks, supported, Asym_Pause); + + switch (hw->fc.requested_mode) { + case I40E_FC_FULL: +@@ -2216,6 +2226,29 @@ static int i40e_get_sset_count(struct net_device *netdev, int sset) + } + } + ++/** ++ * i40e_get_veb_tc_stats - copy VEB TC statistics to formatted structure ++ * @tc: the TC statistics in VEB structure (veb->tc_stats) ++ * @i: the index of traffic class in (veb->tc_stats) structure to copy ++ * ++ * Copy VEB TC statistics from structure of arrays (veb->tc_stats) to ++ * one dimensional structure i40e_cp_veb_tc_stats. ++ * Produce formatted i40e_cp_veb_tc_stats structure of the VEB TC ++ * statistics for the given TC. ++ **/ ++static struct i40e_cp_veb_tc_stats ++i40e_get_veb_tc_stats(struct i40e_veb_tc_stats *tc, unsigned int i) ++{ ++ struct i40e_cp_veb_tc_stats veb_tc = { ++ .tc_rx_packets = tc->tc_rx_packets[i], ++ .tc_rx_bytes = tc->tc_rx_bytes[i], ++ .tc_tx_packets = tc->tc_tx_packets[i], ++ .tc_tx_bytes = tc->tc_tx_bytes[i], ++ }; ++ ++ return veb_tc; ++} ++ + /** + * i40e_get_pfc_stats - copy HW PFC statistics to formatted structure + * @pf: the PF device structure +@@ -2300,8 +2333,16 @@ static void i40e_get_ethtool_stats(struct net_device *netdev, + i40e_gstrings_veb_stats); + + for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) +- i40e_add_ethtool_stats(&data, veb_stats ? veb : NULL, +- i40e_gstrings_veb_tc_stats); ++ if (veb_stats) { ++ struct i40e_cp_veb_tc_stats veb_tc = ++ i40e_get_veb_tc_stats(&veb->tc_stats, i); ++ ++ i40e_add_ethtool_stats(&data, &veb_tc, ++ i40e_gstrings_veb_tc_stats); ++ } else { ++ i40e_add_ethtool_stats(&data, NULL, ++ i40e_gstrings_veb_tc_stats); ++ } + + i40e_add_ethtool_stats(&data, pf, i40e_gstrings_stats); + +@@ -5244,7 +5285,7 @@ static int i40e_get_module_eeprom(struct net_device *netdev, + + status = i40e_aq_get_phy_register(hw, + I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE, +- true, addr, offset, &value, NULL); ++ addr, true, offset, &value, NULL); + if (status) + return -EIO; + data[i] = value; +diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c +index 4a2d03cada01e..7fab60128c76d 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_main.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c +@@ -2560,8 +2560,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) + i40e_stat_str(hw, aq_ret), + i40e_aq_str(hw, hw->aq.asq_last_status)); + } else { +- dev_info(&pf->pdev->dev, "%s is %s allmulti mode.\n", +- vsi->netdev->name, ++ dev_info(&pf->pdev->dev, "%s allmulti mode.\n", + cur_multipromisc ? "entering" : "leaving"); + } + } +@@ -14647,12 +14646,16 @@ static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw) + * in order to register the netdev + */ + v_idx = i40e_vsi_mem_alloc(pf, I40E_VSI_MAIN); +- if (v_idx < 0) ++ if (v_idx < 0) { ++ err = v_idx; + goto err_switch_setup; ++ } + pf->lan_vsi = v_idx; + vsi = pf->vsi[v_idx]; +- if (!vsi) ++ if (!vsi) { ++ err = -EFAULT; + goto err_switch_setup; ++ } + vsi->alloc_queue_pairs = 1; + err = i40e_config_netdev(vsi); + if (err) +diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c +index 903d4e8cb0a11..92ce835bc79e3 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c +@@ -2198,8 +2198,7 @@ int i40e_xmit_xdp_tx_ring(struct xdp_buff *xdp, struct i40e_ring *xdp_ring) + * @rx_ring: Rx ring being processed + * @xdp: XDP buffer containing the frame + **/ +-static struct sk_buff *i40e_run_xdp(struct i40e_ring *rx_ring, +- struct xdp_buff *xdp) ++static int i40e_run_xdp(struct i40e_ring *rx_ring, struct xdp_buff *xdp) + { + int err, result = I40E_XDP_PASS; + struct i40e_ring *xdp_ring; +@@ -2238,7 +2237,7 @@ static struct sk_buff *i40e_run_xdp(struct i40e_ring *rx_ring, + } + xdp_out: + rcu_read_unlock(); +- return ERR_PTR(-result); ++ return result; + } + + /** +@@ -2350,6 +2349,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) + unsigned int xdp_xmit = 0; + bool failure = false; + struct xdp_buff xdp; ++ int xdp_res = 0; + + #if (PAGE_SIZE < 8192) + xdp.frame_sz = i40e_rx_frame_truesize(rx_ring, 0); +@@ -2416,12 +2416,10 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) + /* At larger PAGE_SIZE, frame_sz depend on len size */ + xdp.frame_sz = i40e_rx_frame_truesize(rx_ring, size); + #endif +- skb = i40e_run_xdp(rx_ring, &xdp); ++ xdp_res = i40e_run_xdp(rx_ring, &xdp); + } + +- if (IS_ERR(skb)) { +- unsigned int xdp_res = -PTR_ERR(skb); +- ++ if (xdp_res) { + if (xdp_res & (I40E_XDP_TX | I40E_XDP_REDIR)) { + xdp_xmit |= xdp_res; + i40e_rx_buffer_flip(rx_ring, rx_buffer, size); +diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +index 1b6ec9be155a6..5d301a466f5c5 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +@@ -137,6 +137,7 @@ void i40e_vc_notify_vf_reset(struct i40e_vf *vf) + **/ + static inline void i40e_vc_disable_vf(struct i40e_vf *vf) + { ++ struct i40e_pf *pf = vf->pf; + int i; + + i40e_vc_notify_vf_reset(vf); +@@ -147,6 +148,11 @@ static inline void i40e_vc_disable_vf(struct i40e_vf *vf) + * ensure a reset. + */ + for (i = 0; i < 20; i++) { ++ /* If PF is in VFs releasing state reset VF is impossible, ++ * so leave it. ++ */ ++ if (test_bit(__I40E_VFS_RELEASING, pf->state)) ++ return; + if (i40e_reset_vf(vf, false)) + return; + usleep_range(10000, 20000); +@@ -1574,6 +1580,8 @@ void i40e_free_vfs(struct i40e_pf *pf) + + if (!pf->vf) + return; ++ ++ set_bit(__I40E_VFS_RELEASING, pf->state); + while (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) + usleep_range(1000, 2000); + +@@ -1631,6 +1639,7 @@ void i40e_free_vfs(struct i40e_pf *pf) + } + } + clear_bit(__I40E_VF_DISABLE, pf->state); ++ clear_bit(__I40E_VFS_RELEASING, pf->state); + } + + #ifdef CONFIG_PCI_IOV +diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c +index 37a21fb999221..7949f6b79f92f 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c +@@ -462,7 +462,7 @@ static bool i40e_xmit_zc(struct i40e_ring *xdp_ring, unsigned int budget) + + nb_pkts = xsk_tx_peek_release_desc_batch(xdp_ring->xsk_pool, descs, budget); + if (!nb_pkts) +- return false; ++ return true; + + if (xdp_ring->next_to_use + nb_pkts >= xdp_ring->count) { + nb_processed = xdp_ring->count - xdp_ring->next_to_use; +@@ -479,7 +479,7 @@ static bool i40e_xmit_zc(struct i40e_ring *xdp_ring, unsigned int budget) + + i40e_update_tx_stats(xdp_ring, nb_pkts, total_bytes); + +- return true; ++ return nb_pkts < budget; + } + + /** +diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h +index 619d93f8b54c4..f3d927320a705 100644 +--- a/drivers/net/ethernet/intel/ice/ice.h ++++ b/drivers/net/ethernet/intel/ice/ice.h +@@ -194,7 +194,6 @@ enum ice_state { + __ICE_NEEDS_RESTART, + __ICE_PREPARED_FOR_RESET, /* set by driver when prepared */ + __ICE_RESET_OICR_RECV, /* set by driver after rcv reset OICR */ +- __ICE_DCBNL_DEVRESET, /* set by dcbnl devreset */ + __ICE_PFR_REQ, /* set by driver and peers */ + __ICE_CORER_REQ, /* set by driver and peers */ + __ICE_GLOBR_REQ, /* set by driver and peers */ +@@ -586,7 +585,7 @@ int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset); + void ice_print_link_msg(struct ice_vsi *vsi, bool isup); + const char *ice_stat_str(enum ice_status stat_err); + const char *ice_aq_str(enum ice_aq_err aq_err); +-bool ice_is_wol_supported(struct ice_pf *pf); ++bool ice_is_wol_supported(struct ice_hw *hw); + int + ice_fdir_write_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input, bool add, + bool is_tun); +@@ -604,6 +603,7 @@ int ice_fdir_create_dflt_rules(struct ice_pf *pf); + int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout, + struct ice_rq_event_info *event); + int ice_open(struct net_device *netdev); ++int ice_open_internal(struct net_device *netdev); + int ice_stop(struct net_device *netdev); + void ice_service_task_schedule(struct ice_pf *pf); + +diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c +index 6d7e7dd0ebe22..836e96159a09d 100644 +--- a/drivers/net/ethernet/intel/ice/ice_common.c ++++ b/drivers/net/ethernet/intel/ice/ice_common.c +@@ -717,8 +717,8 @@ static enum ice_status ice_cfg_fw_log(struct ice_hw *hw, bool enable) + + if (!data) { + data = devm_kcalloc(ice_hw_to_dev(hw), +- sizeof(*data), + ICE_AQC_FW_LOG_ID_MAX, ++ sizeof(*data), + GFP_KERNEL); + if (!data) + return ICE_ERR_NO_MEMORY; +diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.h b/drivers/net/ethernet/intel/ice/ice_controlq.h +index faaa08e8171b5..68866f4f0eb09 100644 +--- a/drivers/net/ethernet/intel/ice/ice_controlq.h ++++ b/drivers/net/ethernet/intel/ice/ice_controlq.h +@@ -31,8 +31,8 @@ enum ice_ctl_q { + ICE_CTL_Q_MAILBOX, + }; + +-/* Control Queue timeout settings - max delay 250ms */ +-#define ICE_CTL_Q_SQ_CMD_TIMEOUT 2500 /* Count 2500 times */ ++/* Control Queue timeout settings - max delay 1s */ ++#define ICE_CTL_Q_SQ_CMD_TIMEOUT 10000 /* Count 10000 times */ + #define ICE_CTL_Q_SQ_CMD_USEC 100 /* Check every 100usec */ + #define ICE_CTL_Q_ADMIN_INIT_TIMEOUT 10 /* Count 10 times */ + #define ICE_CTL_Q_ADMIN_INIT_MSEC 100 /* Check every 100msec */ +diff --git a/drivers/net/ethernet/intel/ice/ice_dcb.c b/drivers/net/ethernet/intel/ice/ice_dcb.c +index 2a3147ee0bbb1..211ac6f907adb 100644 +--- a/drivers/net/ethernet/intel/ice/ice_dcb.c ++++ b/drivers/net/ethernet/intel/ice/ice_dcb.c +@@ -738,22 +738,27 @@ ice_aq_get_cee_dcb_cfg(struct ice_hw *hw, + /** + * ice_cee_to_dcb_cfg + * @cee_cfg: pointer to CEE configuration struct +- * @dcbcfg: DCB configuration struct ++ * @pi: port information structure + * + * Convert CEE configuration from firmware to DCB configuration + */ + static void + ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, +- struct ice_dcbx_cfg *dcbcfg) ++ struct ice_port_info *pi) + { + u32 status, tlv_status = le32_to_cpu(cee_cfg->tlv_status); + u32 ice_aqc_cee_status_mask, ice_aqc_cee_status_shift; ++ u8 i, j, err, sync, oper, app_index, ice_app_sel_type; + u16 app_prio = le16_to_cpu(cee_cfg->oper_app_prio); +- u8 i, err, sync, oper, app_index, ice_app_sel_type; + u16 ice_aqc_cee_app_mask, ice_aqc_cee_app_shift; ++ struct ice_dcbx_cfg *cmp_dcbcfg, *dcbcfg; + u16 ice_app_prot_id_type; + +- /* CEE PG data to ETS config */ ++ dcbcfg = &pi->qos_cfg.local_dcbx_cfg; ++ dcbcfg->dcbx_mode = ICE_DCBX_MODE_CEE; ++ dcbcfg->tlv_status = tlv_status; ++ ++ /* CEE PG data */ + dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; + + /* Note that the FW creates the oper_prio_tc nibbles reversed +@@ -780,10 +785,16 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, + } + } + +- /* CEE PFC data to ETS config */ ++ /* CEE PFC data */ + dcbcfg->pfc.pfcena = cee_cfg->oper_pfc_en; + dcbcfg->pfc.pfccap = ICE_MAX_TRAFFIC_CLASS; + ++ /* CEE APP TLV data */ ++ if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING) ++ cmp_dcbcfg = &pi->qos_cfg.desired_dcbx_cfg; ++ else ++ cmp_dcbcfg = &pi->qos_cfg.remote_dcbx_cfg; ++ + app_index = 0; + for (i = 0; i < 3; i++) { + if (i == 0) { +@@ -802,6 +813,18 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, + ice_aqc_cee_app_shift = ICE_AQC_CEE_APP_ISCSI_S; + ice_app_sel_type = ICE_APP_SEL_TCPIP; + ice_app_prot_id_type = ICE_APP_PROT_ID_ISCSI; ++ ++ for (j = 0; j < cmp_dcbcfg->numapps; j++) { ++ u16 prot_id = cmp_dcbcfg->app[j].prot_id; ++ u8 sel = cmp_dcbcfg->app[j].selector; ++ ++ if (sel == ICE_APP_SEL_TCPIP && ++ (prot_id == ICE_APP_PROT_ID_ISCSI || ++ prot_id == ICE_APP_PROT_ID_ISCSI_860)) { ++ ice_app_prot_id_type = prot_id; ++ break; ++ } ++ } + } else { + /* FIP APP */ + ice_aqc_cee_status_mask = ICE_AQC_CEE_FIP_STATUS_M; +@@ -850,9 +873,9 @@ ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode) + return ICE_ERR_PARAM; + + if (dcbx_mode == ICE_DCBX_MODE_IEEE) +- dcbx_cfg = &pi->local_dcbx_cfg; ++ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; + else if (dcbx_mode == ICE_DCBX_MODE_CEE) +- dcbx_cfg = &pi->desired_dcbx_cfg; ++ dcbx_cfg = &pi->qos_cfg.desired_dcbx_cfg; + + /* Get Local DCB Config in case of ICE_DCBX_MODE_IEEE + * or get CEE DCB Desired Config in case of ICE_DCBX_MODE_CEE +@@ -863,7 +886,7 @@ ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode) + goto out; + + /* Get Remote DCB Config */ +- dcbx_cfg = &pi->remote_dcbx_cfg; ++ dcbx_cfg = &pi->qos_cfg.remote_dcbx_cfg; + ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_REMOTE, + ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID, dcbx_cfg); + /* Don't treat ENOENT as an error for Remote MIBs */ +@@ -892,14 +915,11 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi) + ret = ice_aq_get_cee_dcb_cfg(pi->hw, &cee_cfg, NULL); + if (!ret) { + /* CEE mode */ +- dcbx_cfg = &pi->local_dcbx_cfg; +- dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_CEE; +- dcbx_cfg->tlv_status = le32_to_cpu(cee_cfg.tlv_status); +- ice_cee_to_dcb_cfg(&cee_cfg, dcbx_cfg); + ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_CEE); ++ ice_cee_to_dcb_cfg(&cee_cfg, pi); + } else if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) { + /* CEE mode not enabled try querying IEEE data */ +- dcbx_cfg = &pi->local_dcbx_cfg; ++ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; + dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_IEEE; + ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_IEEE); + } +@@ -916,26 +936,26 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi) + */ + enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change) + { +- struct ice_port_info *pi = hw->port_info; ++ struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg; + enum ice_status ret = 0; + + if (!hw->func_caps.common_cap.dcb) + return ICE_ERR_NOT_SUPPORTED; + +- pi->is_sw_lldp = true; ++ qos_cfg->is_sw_lldp = true; + + /* Get DCBX status */ +- pi->dcbx_status = ice_get_dcbx_status(hw); ++ qos_cfg->dcbx_status = ice_get_dcbx_status(hw); + +- if (pi->dcbx_status == ICE_DCBX_STATUS_DONE || +- pi->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS || +- pi->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) { ++ if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DONE || ++ qos_cfg->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS || ++ qos_cfg->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) { + /* Get current DCBX configuration */ +- ret = ice_get_dcb_cfg(pi); ++ ret = ice_get_dcb_cfg(hw->port_info); + if (ret) + return ret; +- pi->is_sw_lldp = false; +- } else if (pi->dcbx_status == ICE_DCBX_STATUS_DIS) { ++ qos_cfg->is_sw_lldp = false; ++ } else if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS) { + return ICE_ERR_NOT_READY; + } + +@@ -943,7 +963,7 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change) + if (enable_mib_change) { + ret = ice_aq_cfg_lldp_mib_change(hw, true, NULL); + if (ret) +- pi->is_sw_lldp = true; ++ qos_cfg->is_sw_lldp = true; + } + + return ret; +@@ -958,21 +978,21 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change) + */ + enum ice_status ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib) + { +- struct ice_port_info *pi = hw->port_info; ++ struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg; + enum ice_status ret; + + if (!hw->func_caps.common_cap.dcb) + return ICE_ERR_NOT_SUPPORTED; + + /* Get DCBX status */ +- pi->dcbx_status = ice_get_dcbx_status(hw); ++ qos_cfg->dcbx_status = ice_get_dcbx_status(hw); + +- if (pi->dcbx_status == ICE_DCBX_STATUS_DIS) ++ if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS) + return ICE_ERR_NOT_READY; + + ret = ice_aq_cfg_lldp_mib_change(hw, ena_mib, NULL); + if (!ret) +- pi->is_sw_lldp = !ena_mib; ++ qos_cfg->is_sw_lldp = !ena_mib; + + return ret; + } +@@ -1270,7 +1290,7 @@ enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi) + hw = pi->hw; + + /* update the HW local config */ +- dcbcfg = &pi->local_dcbx_cfg; ++ dcbcfg = &pi->qos_cfg.local_dcbx_cfg; + /* Allocate the LLDPDU */ + lldpmib = devm_kzalloc(ice_hw_to_dev(hw), ICE_LLDPDU_SIZE, GFP_KERNEL); + if (!lldpmib) +diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c +index 36abd6b7280c8..1e8f71ffc8ce7 100644 +--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c ++++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c +@@ -28,7 +28,7 @@ void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc) + if (netdev_set_num_tc(netdev, vsi->tc_cfg.numtc)) + return; + +- dcbcfg = &pf->hw.port_info->local_dcbx_cfg; ++ dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + + ice_for_each_traffic_class(i) + if (vsi->tc_cfg.ena_tc & BIT(i)) +@@ -134,7 +134,7 @@ static u8 ice_dcb_get_mode(struct ice_port_info *port_info, bool host) + else + mode = DCB_CAP_DCBX_LLD_MANAGED; + +- if (port_info->local_dcbx_cfg.dcbx_mode & ICE_DCBX_MODE_CEE) ++ if (port_info->qos_cfg.local_dcbx_cfg.dcbx_mode & ICE_DCBX_MODE_CEE) + return mode | DCB_CAP_DCBX_VER_CEE; + else + return mode | DCB_CAP_DCBX_VER_IEEE; +@@ -277,10 +277,10 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked) + int ret = ICE_DCB_NO_HW_CHG; + struct ice_vsi *pf_vsi; + +- curr_cfg = &pf->hw.port_info->local_dcbx_cfg; ++ curr_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + + /* FW does not care if change happened */ +- if (!pf->hw.port_info->is_sw_lldp) ++ if (!pf->hw.port_info->qos_cfg.is_sw_lldp) + ret = ICE_DCB_HW_CHG_RST; + + /* Enable DCB tagging only when more than one TC */ +@@ -327,7 +327,7 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked) + /* Only send new config to HW if we are in SW LLDP mode. Otherwise, + * the new config came from the HW in the first place. + */ +- if (pf->hw.port_info->is_sw_lldp) { ++ if (pf->hw.port_info->qos_cfg.is_sw_lldp) { + ret = ice_set_dcb_cfg(pf->hw.port_info); + if (ret) { + dev_err(dev, "Set DCB Config failed\n"); +@@ -360,7 +360,7 @@ free_cfg: + */ + static void ice_cfg_etsrec_defaults(struct ice_port_info *pi) + { +- struct ice_dcbx_cfg *dcbcfg = &pi->local_dcbx_cfg; ++ struct ice_dcbx_cfg *dcbcfg = &pi->qos_cfg.local_dcbx_cfg; + u8 i; + + /* Ensure ETS recommended DCB configuration is not already set */ +@@ -446,7 +446,7 @@ void ice_dcb_rebuild(struct ice_pf *pf) + + mutex_lock(&pf->tc_mutex); + +- if (!pf->hw.port_info->is_sw_lldp) ++ if (!pf->hw.port_info->qos_cfg.is_sw_lldp) + ice_cfg_etsrec_defaults(pf->hw.port_info); + + ret = ice_set_dcb_cfg(pf->hw.port_info); +@@ -455,9 +455,9 @@ void ice_dcb_rebuild(struct ice_pf *pf) + goto dcb_error; + } + +- if (!pf->hw.port_info->is_sw_lldp) { ++ if (!pf->hw.port_info->qos_cfg.is_sw_lldp) { + ret = ice_cfg_lldp_mib_change(&pf->hw, true); +- if (ret && !pf->hw.port_info->is_sw_lldp) { ++ if (ret && !pf->hw.port_info->qos_cfg.is_sw_lldp) { + dev_err(dev, "Failed to register for MIB changes\n"); + goto dcb_error; + } +@@ -510,11 +510,12 @@ static int ice_dcb_init_cfg(struct ice_pf *pf, bool locked) + int ret = 0; + + pi = pf->hw.port_info; +- newcfg = kmemdup(&pi->local_dcbx_cfg, sizeof(*newcfg), GFP_KERNEL); ++ newcfg = kmemdup(&pi->qos_cfg.local_dcbx_cfg, sizeof(*newcfg), ++ GFP_KERNEL); + if (!newcfg) + return -ENOMEM; + +- memset(&pi->local_dcbx_cfg, 0, sizeof(*newcfg)); ++ memset(&pi->qos_cfg.local_dcbx_cfg, 0, sizeof(*newcfg)); + + dev_info(ice_pf_to_dev(pf), "Configuring initial DCB values\n"); + if (ice_pf_dcb_cfg(pf, newcfg, locked)) +@@ -545,7 +546,7 @@ static int ice_dcb_sw_dflt_cfg(struct ice_pf *pf, bool ets_willing, bool locked) + if (!dcbcfg) + return -ENOMEM; + +- memset(&pi->local_dcbx_cfg, 0, sizeof(*dcbcfg)); ++ memset(&pi->qos_cfg.local_dcbx_cfg, 0, sizeof(*dcbcfg)); + + dcbcfg->etscfg.willing = ets_willing ? 1 : 0; + dcbcfg->etscfg.maxtcs = hw->func_caps.common_cap.maxtc; +@@ -608,7 +609,7 @@ static bool ice_dcb_tc_contig(u8 *prio_table) + */ + static int ice_dcb_noncontig_cfg(struct ice_pf *pf) + { +- struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->local_dcbx_cfg; ++ struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + struct device *dev = ice_pf_to_dev(pf); + int ret; + +@@ -638,7 +639,7 @@ static int ice_dcb_noncontig_cfg(struct ice_pf *pf) + */ + void ice_pf_dcb_recfg(struct ice_pf *pf) + { +- struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->local_dcbx_cfg; ++ struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + u8 tc_map = 0; + int v, ret; + +@@ -691,7 +692,7 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked) + port_info = hw->port_info; + + err = ice_init_dcb(hw, false); +- if (err && !port_info->is_sw_lldp) { ++ if (err && !port_info->qos_cfg.is_sw_lldp) { + dev_err(dev, "Error initializing DCB %d\n", err); + goto dcb_init_err; + } +@@ -858,7 +859,7 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, + /* Update the remote cached instance and return */ + ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_REMOTE, + ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID, +- &pi->remote_dcbx_cfg); ++ &pi->qos_cfg.remote_dcbx_cfg); + if (ret) { + dev_err(dev, "Failed to get remote DCB config\n"); + return; +@@ -868,10 +869,11 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, + mutex_lock(&pf->tc_mutex); + + /* store the old configuration */ +- tmp_dcbx_cfg = pf->hw.port_info->local_dcbx_cfg; ++ tmp_dcbx_cfg = pf->hw.port_info->qos_cfg.local_dcbx_cfg; + + /* Reset the old DCBX configuration data */ +- memset(&pi->local_dcbx_cfg, 0, sizeof(pi->local_dcbx_cfg)); ++ memset(&pi->qos_cfg.local_dcbx_cfg, 0, ++ sizeof(pi->qos_cfg.local_dcbx_cfg)); + + /* Get updated DCBX data from firmware */ + ret = ice_get_dcb_cfg(pf->hw.port_info); +@@ -881,7 +883,8 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, + } + + /* No change detected in DCBX configs */ +- if (!memcmp(&tmp_dcbx_cfg, &pi->local_dcbx_cfg, sizeof(tmp_dcbx_cfg))) { ++ if (!memcmp(&tmp_dcbx_cfg, &pi->qos_cfg.local_dcbx_cfg, ++ sizeof(tmp_dcbx_cfg))) { + dev_dbg(dev, "No change detected in DCBX configuration.\n"); + goto out; + } +@@ -889,13 +892,13 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, + pf->dcbx_cap = ice_dcb_get_mode(pi, false); + + need_reconfig = ice_dcb_need_recfg(pf, &tmp_dcbx_cfg, +- &pi->local_dcbx_cfg); +- ice_dcbnl_flush_apps(pf, &tmp_dcbx_cfg, &pi->local_dcbx_cfg); ++ &pi->qos_cfg.local_dcbx_cfg); ++ ice_dcbnl_flush_apps(pf, &tmp_dcbx_cfg, &pi->qos_cfg.local_dcbx_cfg); + if (!need_reconfig) + goto out; + + /* Enable DCB tagging only when more than one TC */ +- if (ice_dcb_get_num_tc(&pi->local_dcbx_cfg) > 1) { ++ if (ice_dcb_get_num_tc(&pi->qos_cfg.local_dcbx_cfg) > 1) { + dev_dbg(dev, "DCB tagging enabled (num TC > 1)\n"); + set_bit(ICE_FLAG_DCB_ENA, pf->flags); + } else { +diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c +index 8c133a8be6add..4180f1f35fb89 100644 +--- a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c ++++ b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c +@@ -18,12 +18,10 @@ static void ice_dcbnl_devreset(struct net_device *netdev) + while (ice_is_reset_in_progress(pf->state)) + usleep_range(1000, 2000); + +- set_bit(__ICE_DCBNL_DEVRESET, pf->state); + dev_close(netdev); + netdev_state_change(netdev); + dev_open(netdev, NULL); + netdev_state_change(netdev); +- clear_bit(__ICE_DCBNL_DEVRESET, pf->state); + } + + /** +@@ -34,12 +32,10 @@ static void ice_dcbnl_devreset(struct net_device *netdev) + static int ice_dcbnl_getets(struct net_device *netdev, struct ieee_ets *ets) + { + struct ice_dcbx_cfg *dcbxcfg; +- struct ice_port_info *pi; + struct ice_pf *pf; + + pf = ice_netdev_to_pf(netdev); +- pi = pf->hw.port_info; +- dcbxcfg = &pi->local_dcbx_cfg; ++ dcbxcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + + ets->willing = dcbxcfg->etscfg.willing; + ets->ets_cap = dcbxcfg->etscfg.maxtcs; +@@ -74,7 +70,7 @@ static int ice_dcbnl_setets(struct net_device *netdev, struct ieee_ets *ets) + !(pf->dcbx_cap & DCB_CAP_DCBX_VER_IEEE)) + return -EINVAL; + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + mutex_lock(&pf->tc_mutex); + +@@ -159,6 +155,7 @@ static u8 ice_dcbnl_getdcbx(struct net_device *netdev) + static u8 ice_dcbnl_setdcbx(struct net_device *netdev, u8 mode) + { + struct ice_pf *pf = ice_netdev_to_pf(netdev); ++ struct ice_qos_cfg *qos_cfg; + + /* if FW LLDP agent is running, DCBNL not allowed to change mode */ + if (test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags)) +@@ -175,10 +172,11 @@ static u8 ice_dcbnl_setdcbx(struct net_device *netdev, u8 mode) + return ICE_DCB_NO_HW_CHG; + + pf->dcbx_cap = mode; ++ qos_cfg = &pf->hw.port_info->qos_cfg; + if (mode & DCB_CAP_DCBX_VER_CEE) +- pf->hw.port_info->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_CEE; ++ qos_cfg->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_CEE; + else +- pf->hw.port_info->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_IEEE; ++ qos_cfg->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_IEEE; + + dev_info(ice_pf_to_dev(pf), "DCBx mode = 0x%x\n", mode); + return ICE_DCB_HW_CHG_RST; +@@ -229,7 +227,7 @@ static int ice_dcbnl_getpfc(struct net_device *netdev, struct ieee_pfc *pfc) + struct ice_dcbx_cfg *dcbxcfg; + int i; + +- dcbxcfg = &pi->local_dcbx_cfg; ++ dcbxcfg = &pi->qos_cfg.local_dcbx_cfg; + pfc->pfc_cap = dcbxcfg->pfc.pfccap; + pfc->pfc_en = dcbxcfg->pfc.pfcena; + pfc->mbc = dcbxcfg->pfc.mbc; +@@ -260,7 +258,7 @@ static int ice_dcbnl_setpfc(struct net_device *netdev, struct ieee_pfc *pfc) + + mutex_lock(&pf->tc_mutex); + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + if (pfc->pfc_cap) + new_cfg->pfc.pfccap = pfc->pfc_cap; +@@ -297,9 +295,9 @@ ice_dcbnl_get_pfc_cfg(struct net_device *netdev, int prio, u8 *setting) + if (prio >= ICE_MAX_USER_PRIORITY) + return; + +- *setting = (pi->local_dcbx_cfg.pfc.pfcena >> prio) & 0x1; ++ *setting = (pi->qos_cfg.local_dcbx_cfg.pfc.pfcena >> prio) & 0x1; + dev_dbg(ice_pf_to_dev(pf), "Get PFC Config up=%d, setting=%d, pfcenable=0x%x\n", +- prio, *setting, pi->local_dcbx_cfg.pfc.pfcena); ++ prio, *setting, pi->qos_cfg.local_dcbx_cfg.pfc.pfcena); + } + + /** +@@ -320,7 +318,7 @@ static void ice_dcbnl_set_pfc_cfg(struct net_device *netdev, int prio, u8 set) + if (prio >= ICE_MAX_USER_PRIORITY) + return; + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + new_cfg->pfc.pfccap = pf->hw.func_caps.common_cap.maxtc; + if (set) +@@ -342,7 +340,7 @@ static u8 ice_dcbnl_getpfcstate(struct net_device *netdev) + struct ice_port_info *pi = pf->hw.port_info; + + /* Return enabled if any UP enabled for PFC */ +- if (pi->local_dcbx_cfg.pfc.pfcena) ++ if (pi->qos_cfg.local_dcbx_cfg.pfc.pfcena) + return 1; + + return 0; +@@ -382,8 +380,8 @@ static u8 ice_dcbnl_setstate(struct net_device *netdev, u8 state) + + if (state) { + set_bit(ICE_FLAG_DCB_ENA, pf->flags); +- memcpy(&pf->hw.port_info->desired_dcbx_cfg, +- &pf->hw.port_info->local_dcbx_cfg, ++ memcpy(&pf->hw.port_info->qos_cfg.desired_dcbx_cfg, ++ &pf->hw.port_info->qos_cfg.local_dcbx_cfg, + sizeof(struct ice_dcbx_cfg)); + } else { + clear_bit(ICE_FLAG_DCB_ENA, pf->flags); +@@ -417,7 +415,7 @@ ice_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int prio, + if (prio >= ICE_MAX_USER_PRIORITY) + return; + +- *pgid = pi->local_dcbx_cfg.etscfg.prio_table[prio]; ++ *pgid = pi->qos_cfg.local_dcbx_cfg.etscfg.prio_table[prio]; + dev_dbg(ice_pf_to_dev(pf), "Get PG config prio=%d tc=%d\n", prio, + *pgid); + } +@@ -448,7 +446,7 @@ ice_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc, + if (tc >= ICE_MAX_TRAFFIC_CLASS) + return; + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + /* prio_type, bwg_id and bw_pct per UP are not supported */ + +@@ -478,7 +476,7 @@ ice_dcbnl_get_pg_bwg_cfg_tx(struct net_device *netdev, int pgid, u8 *bw_pct) + if (pgid >= ICE_MAX_TRAFFIC_CLASS) + return; + +- *bw_pct = pi->local_dcbx_cfg.etscfg.tcbwtable[pgid]; ++ *bw_pct = pi->qos_cfg.local_dcbx_cfg.etscfg.tcbwtable[pgid]; + dev_dbg(ice_pf_to_dev(pf), "Get PG BW config tc=%d bw_pct=%d\n", + pgid, *bw_pct); + } +@@ -502,7 +500,7 @@ ice_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int pgid, u8 bw_pct) + if (pgid >= ICE_MAX_TRAFFIC_CLASS) + return; + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + new_cfg->etscfg.tcbwtable[pgid] = bw_pct; + } +@@ -532,7 +530,7 @@ ice_dcbnl_get_pg_tc_cfg_rx(struct net_device *netdev, int prio, + if (prio >= ICE_MAX_USER_PRIORITY) + return; + +- *pgid = pi->local_dcbx_cfg.etscfg.prio_table[prio]; ++ *pgid = pi->qos_cfg.local_dcbx_cfg.etscfg.prio_table[prio]; + } + + /** +@@ -703,9 +701,9 @@ static int ice_dcbnl_setapp(struct net_device *netdev, struct dcb_app *app) + + mutex_lock(&pf->tc_mutex); + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + +- old_cfg = &pf->hw.port_info->local_dcbx_cfg; ++ old_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + + if (old_cfg->numapps == ICE_DCBX_MAX_APPS) { + ret = -EINVAL; +@@ -755,7 +753,7 @@ static int ice_dcbnl_delapp(struct net_device *netdev, struct dcb_app *app) + return -EINVAL; + + mutex_lock(&pf->tc_mutex); +- old_cfg = &pf->hw.port_info->local_dcbx_cfg; ++ old_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; + + if (old_cfg->numapps <= 1) + goto delapp_out; +@@ -764,7 +762,7 @@ static int ice_dcbnl_delapp(struct net_device *netdev, struct dcb_app *app) + if (ret) + goto delapp_out; + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + for (i = 1; i < new_cfg->numapps; i++) { + if (app->selector == new_cfg->app[i].selector && +@@ -817,7 +815,7 @@ static u8 ice_dcbnl_cee_set_all(struct net_device *netdev) + !(pf->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) + return ICE_DCB_NO_HW_CHG; + +- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; ++ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; + + mutex_lock(&pf->tc_mutex); + +@@ -888,7 +886,7 @@ void ice_dcbnl_set_all(struct ice_vsi *vsi) + if (!test_bit(ICE_FLAG_DCB_ENA, pf->flags)) + return; + +- dcbxcfg = &pi->local_dcbx_cfg; ++ dcbxcfg = &pi->qos_cfg.local_dcbx_cfg; + + for (i = 0; i < dcbxcfg->numapps; i++) { + u8 prio, tc_map; +diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c +index aebebd2102da0..d70573f5072c6 100644 +--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c ++++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c +@@ -2986,7 +2986,7 @@ ice_get_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) + pause->rx_pause = 0; + pause->tx_pause = 0; + +- dcbx_cfg = &pi->local_dcbx_cfg; ++ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; + + pcaps = kzalloc(sizeof(*pcaps), GFP_KERNEL); + if (!pcaps) +@@ -3038,7 +3038,7 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) + + pi = vsi->port_info; + hw_link_info = &pi->phy.link_info; +- dcbx_cfg = &pi->local_dcbx_cfg; ++ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; + link_up = hw_link_info->link_info & ICE_AQ_LINK_UP; + + /* Changing the port's flow control is not supported if this isn't the +@@ -3472,7 +3472,7 @@ static void ice_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) + netdev_warn(netdev, "Wake on LAN is not supported on this interface!\n"); + + /* Get WoL settings based on the HW capability */ +- if (ice_is_wol_supported(pf)) { ++ if (ice_is_wol_supported(&pf->hw)) { + wol->supported = WAKE_MAGIC; + wol->wolopts = pf->wol_ena ? WAKE_MAGIC : 0; + } else { +@@ -3492,7 +3492,7 @@ static int ice_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) + struct ice_vsi *vsi = np->vsi; + struct ice_pf *pf = vsi->back; + +- if (vsi->type != ICE_VSI_PF || !ice_is_wol_supported(pf)) ++ if (vsi->type != ICE_VSI_PF || !ice_is_wol_supported(&pf->hw)) + return -EOPNOTSUPP; + + /* only magic packet is supported */ +diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c +index ad9c22a1b97a0..170367eaa95aa 100644 +--- a/drivers/net/ethernet/intel/ice/ice_lib.c ++++ b/drivers/net/ethernet/intel/ice/ice_lib.c +@@ -2078,7 +2078,7 @@ err_out: + + static void ice_vsi_set_tc_cfg(struct ice_vsi *vsi) + { +- struct ice_dcbx_cfg *cfg = &vsi->port_info->local_dcbx_cfg; ++ struct ice_dcbx_cfg *cfg = &vsi->port_info->qos_cfg.local_dcbx_cfg; + + vsi->tc_cfg.ena_tc = ice_dcb_get_ena_tc(cfg); + vsi->tc_cfg.numtc = ice_dcb_get_num_tc(cfg); +@@ -2489,7 +2489,7 @@ int ice_ena_vsi(struct ice_vsi *vsi, bool locked) + if (!locked) + rtnl_lock(); + +- err = ice_open(vsi->netdev); ++ err = ice_open_internal(vsi->netdev); + + if (!locked) + rtnl_unlock(); +@@ -2518,7 +2518,7 @@ void ice_dis_vsi(struct ice_vsi *vsi, bool locked) + if (!locked) + rtnl_lock(); + +- ice_stop(vsi->netdev); ++ ice_vsi_close(vsi); + + if (!locked) + rtnl_unlock(); +@@ -2944,7 +2944,6 @@ err_vsi: + bool ice_is_reset_in_progress(unsigned long *state) + { + return test_bit(__ICE_RESET_OICR_RECV, state) || +- test_bit(__ICE_DCBNL_DEVRESET, state) || + test_bit(__ICE_PFR_REQ, state) || + test_bit(__ICE_CORER_REQ, state) || + test_bit(__ICE_GLOBR_REQ, state); +diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c +index e10ca8929f85e..00a2520395c5e 100644 +--- a/drivers/net/ethernet/intel/ice/ice_main.c ++++ b/drivers/net/ethernet/intel/ice/ice_main.c +@@ -3512,15 +3512,14 @@ static int ice_init_interrupt_scheme(struct ice_pf *pf) + } + + /** +- * ice_is_wol_supported - get NVM state of WoL +- * @pf: board private structure ++ * ice_is_wol_supported - check if WoL is supported ++ * @hw: pointer to hardware info + * + * Check if WoL is supported based on the HW configuration. + * Returns true if NVM supports and enables WoL for this port, false otherwise + */ +-bool ice_is_wol_supported(struct ice_pf *pf) ++bool ice_is_wol_supported(struct ice_hw *hw) + { +- struct ice_hw *hw = &pf->hw; + u16 wol_ctrl; + + /* A bit set to 1 in the NVM Software Reserved Word 2 (WoL control +@@ -3529,7 +3528,7 @@ bool ice_is_wol_supported(struct ice_pf *pf) + if (ice_read_sr_word(hw, ICE_SR_NVM_WOL_CFG, &wol_ctrl)) + return false; + +- return !(BIT(hw->pf_id) & wol_ctrl); ++ return !(BIT(hw->port_info->lport) & wol_ctrl); + } + + /** +@@ -4167,28 +4166,25 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) + goto err_send_version_unroll; + } + ++ /* not a fatal error if this fails */ + err = ice_init_nvm_phy_type(pf->hw.port_info); +- if (err) { ++ if (err) + dev_err(dev, "ice_init_nvm_phy_type failed: %d\n", err); +- goto err_send_version_unroll; +- } + ++ /* not a fatal error if this fails */ + err = ice_update_link_info(pf->hw.port_info); +- if (err) { ++ if (err) + dev_err(dev, "ice_update_link_info failed: %d\n", err); +- goto err_send_version_unroll; +- } + + ice_init_link_dflt_override(pf->hw.port_info); + + /* if media available, initialize PHY settings */ + if (pf->hw.port_info->phy.link_info.link_info & + ICE_AQ_MEDIA_AVAILABLE) { ++ /* not a fatal error if this fails */ + err = ice_init_phy_user_cfg(pf->hw.port_info); +- if (err) { ++ if (err) + dev_err(dev, "ice_init_phy_user_cfg failed: %d\n", err); +- goto err_send_version_unroll; +- } + + if (!test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags)) { + struct ice_vsi *vsi = ice_get_main_vsi(pf); +@@ -4539,6 +4535,7 @@ static int __maybe_unused ice_suspend(struct device *dev) + continue; + ice_vsi_free_q_vectors(pf->vsi[v]); + } ++ ice_free_cpu_rx_rmap(ice_get_main_vsi(pf)); + ice_clear_interrupt_scheme(pf); + + pci_save_state(pdev); +@@ -6613,6 +6610,28 @@ static void ice_tx_timeout(struct net_device *netdev, unsigned int txqueue) + * Returns 0 on success, negative value on failure + */ + int ice_open(struct net_device *netdev) ++{ ++ struct ice_netdev_priv *np = netdev_priv(netdev); ++ struct ice_pf *pf = np->vsi->back; ++ ++ if (ice_is_reset_in_progress(pf->state)) { ++ netdev_err(netdev, "can't open net device while reset is in progress"); ++ return -EBUSY; ++ } ++ ++ return ice_open_internal(netdev); ++} ++ ++/** ++ * ice_open_internal - Called when a network interface becomes active ++ * @netdev: network interface device structure ++ * ++ * Internal ice_open implementation. Should not be used directly except for ice_open and reset ++ * handling routine ++ * ++ * Returns 0 on success, negative value on failure ++ */ ++int ice_open_internal(struct net_device *netdev) + { + struct ice_netdev_priv *np = netdev_priv(netdev); + struct ice_vsi *vsi = np->vsi; +@@ -6693,6 +6712,12 @@ int ice_stop(struct net_device *netdev) + { + struct ice_netdev_priv *np = netdev_priv(netdev); + struct ice_vsi *vsi = np->vsi; ++ struct ice_pf *pf = vsi->back; ++ ++ if (ice_is_reset_in_progress(pf->state)) { ++ netdev_err(netdev, "can't stop net device while reset is in progress"); ++ return -EBUSY; ++ } + + ice_vsi_close(vsi); + +diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c +index c33612132ddf0..0a8fcd4309ca9 100644 +--- a/drivers/net/ethernet/intel/ice/ice_switch.c ++++ b/drivers/net/ethernet/intel/ice/ice_switch.c +@@ -1238,6 +1238,9 @@ ice_add_update_vsi_list(struct ice_hw *hw, + ice_create_vsi_list_map(hw, &vsi_handle_arr[0], 2, + vsi_list_id); + ++ if (!m_entry->vsi_list_info) ++ return ICE_ERR_NO_MEMORY; ++ + /* If this entry was large action then the large action needs + * to be updated to point to FWD to VSI list + */ +@@ -2220,6 +2223,7 @@ ice_vsi_uses_fltr(struct ice_fltr_mgmt_list_entry *fm_entry, u16 vsi_handle) + return ((fm_entry->fltr_info.fltr_act == ICE_FWD_TO_VSI && + fm_entry->fltr_info.vsi_handle == vsi_handle) || + (fm_entry->fltr_info.fltr_act == ICE_FWD_TO_VSI_LIST && ++ fm_entry->vsi_list_info && + (test_bit(vsi_handle, fm_entry->vsi_list_info->vsi_map)))); + } + +@@ -2292,14 +2296,12 @@ ice_add_to_vsi_fltr_list(struct ice_hw *hw, u16 vsi_handle, + return ICE_ERR_PARAM; + + list_for_each_entry(fm_entry, lkup_list_head, list_entry) { +- struct ice_fltr_info *fi; +- +- fi = &fm_entry->fltr_info; +- if (!fi || !ice_vsi_uses_fltr(fm_entry, vsi_handle)) ++ if (!ice_vsi_uses_fltr(fm_entry, vsi_handle)) + continue; + + status = ice_add_entry_to_vsi_fltr_list(hw, vsi_handle, +- vsi_list_head, fi); ++ vsi_list_head, ++ &fm_entry->fltr_info); + if (status) + return status; + } +@@ -2622,7 +2624,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle, + &remove_list_head); + mutex_unlock(rule_lock); + if (status) +- return; ++ goto free_fltr_list; + + switch (lkup) { + case ICE_SW_LKUP_MAC: +@@ -2645,6 +2647,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle, + break; + } + ++free_fltr_list: + list_for_each_entry_safe(fm_entry, tmp, &remove_list_head, list_entry) { + list_del(&fm_entry->list_entry); + devm_kfree(ice_hw_to_dev(hw), fm_entry); +diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c +index b6fa83c619dd7..4cd3142ec20ab 100644 +--- a/drivers/net/ethernet/intel/ice/ice_txrx.c ++++ b/drivers/net/ethernet/intel/ice/ice_txrx.c +@@ -2421,7 +2421,7 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring) + /* allow CONTROL frames egress from main VSI if FW LLDP disabled */ + if (unlikely(skb->priority == TC_PRIO_CONTROL && + vsi->type == ICE_VSI_PF && +- vsi->port_info->is_sw_lldp)) ++ vsi->port_info->qos_cfg.is_sw_lldp)) + offload.cd_qw1 |= (u64)(ICE_TX_DESC_DTYPE_CTX | + ICE_TX_CTX_DESC_SWTCH_UPLINK << + ICE_TXD_CTX_QW1_CMD_S); +diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h +index 2226a291a3943..1bed183d96a0d 100644 +--- a/drivers/net/ethernet/intel/ice/ice_type.h ++++ b/drivers/net/ethernet/intel/ice/ice_type.h +@@ -493,6 +493,7 @@ struct ice_dcb_app_priority_table { + #define ICE_TLV_STATUS_ERR 0x4 + #define ICE_APP_PROT_ID_FCOE 0x8906 + #define ICE_APP_PROT_ID_ISCSI 0x0cbc ++#define ICE_APP_PROT_ID_ISCSI_860 0x035c + #define ICE_APP_PROT_ID_FIP 0x8914 + #define ICE_APP_SEL_ETHTYPE 0x1 + #define ICE_APP_SEL_TCPIP 0x2 +@@ -514,6 +515,14 @@ struct ice_dcbx_cfg { + #define ICE_DCBX_APPS_NON_WILLING 0x1 + }; + ++struct ice_qos_cfg { ++ struct ice_dcbx_cfg local_dcbx_cfg; /* Oper/Local Cfg */ ++ struct ice_dcbx_cfg desired_dcbx_cfg; /* CEE Desired Cfg */ ++ struct ice_dcbx_cfg remote_dcbx_cfg; /* Peer Cfg */ ++ u8 dcbx_status : 3; /* see ICE_DCBX_STATUS_DIS */ ++ u8 is_sw_lldp : 1; ++}; ++ + struct ice_port_info { + struct ice_sched_node *root; /* Root Node per Port */ + struct ice_hw *hw; /* back pointer to HW instance */ +@@ -537,13 +546,7 @@ struct ice_port_info { + sib_head[ICE_MAX_TRAFFIC_CLASS][ICE_AQC_TOPO_MAX_LEVEL_NUM]; + /* List contain profile ID(s) and other params per layer */ + struct list_head rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM]; +- struct ice_dcbx_cfg local_dcbx_cfg; /* Oper/Local Cfg */ +- /* DCBX info */ +- struct ice_dcbx_cfg remote_dcbx_cfg; /* Peer Cfg */ +- struct ice_dcbx_cfg desired_dcbx_cfg; /* CEE Desired Cfg */ +- /* LLDP/DCBX Status */ +- u8 dcbx_status:3; /* see ICE_DCBX_STATUS_DIS */ +- u8 is_sw_lldp:1; ++ struct ice_qos_cfg qos_cfg; + u8 is_vf:1; + }; + +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c +index b051417ede67b..9153c9bda96fa 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c +@@ -191,12 +191,12 @@ static bool is_ib_supported(struct mlx5_core_dev *dev) + } + + enum { +- MLX5_INTERFACE_PROTOCOL_ETH_REP, + MLX5_INTERFACE_PROTOCOL_ETH, ++ MLX5_INTERFACE_PROTOCOL_ETH_REP, + ++ MLX5_INTERFACE_PROTOCOL_IB, + MLX5_INTERFACE_PROTOCOL_IB_REP, + MLX5_INTERFACE_PROTOCOL_MPIB, +- MLX5_INTERFACE_PROTOCOL_IB, + + MLX5_INTERFACE_PROTOCOL_VNET, + }; +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h +index f258f2f9b8cff..9061a30a93bcf 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h +@@ -510,6 +510,7 @@ struct mlx5e_icosq { + struct mlx5_wq_cyc wq; + void __iomem *uar_map; + u32 sqn; ++ u16 reserved_room; + unsigned long state; + + /* control path */ +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +index b42396df3111d..0469f53dfb99e 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +@@ -184,6 +184,28 @@ mlx5_tc_ct_entry_has_nat(struct mlx5_ct_entry *entry) + return !!(entry->tuple_nat_node.next); + } + ++static int ++mlx5_get_label_mapping(struct mlx5_tc_ct_priv *ct_priv, ++ u32 *labels, u32 *id) ++{ ++ if (!memchr_inv(labels, 0, sizeof(u32) * 4)) { ++ *id = 0; ++ return 0; ++ } ++ ++ if (mapping_add(ct_priv->labels_mapping, labels, id)) ++ return -EOPNOTSUPP; ++ ++ return 0; ++} ++ ++static void ++mlx5_put_label_mapping(struct mlx5_tc_ct_priv *ct_priv, u32 id) ++{ ++ if (id) ++ mapping_remove(ct_priv->labels_mapping, id); ++} ++ + static int + mlx5_tc_ct_rule_to_tuple(struct mlx5_ct_tuple *tuple, struct flow_rule *rule) + { +@@ -435,7 +457,7 @@ mlx5_tc_ct_entry_del_rule(struct mlx5_tc_ct_priv *ct_priv, + mlx5_tc_rule_delete(netdev_priv(ct_priv->netdev), zone_rule->rule, attr); + mlx5e_mod_hdr_detach(ct_priv->dev, + ct_priv->mod_hdr_tbl, zone_rule->mh); +- mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id); ++ mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id); + kfree(attr); + } + +@@ -638,8 +660,8 @@ mlx5_tc_ct_entry_create_mod_hdr(struct mlx5_tc_ct_priv *ct_priv, + if (!meta) + return -EOPNOTSUPP; + +- err = mapping_add(ct_priv->labels_mapping, meta->ct_metadata.labels, +- &attr->ct_attr.ct_labels_id); ++ err = mlx5_get_label_mapping(ct_priv, meta->ct_metadata.labels, ++ &attr->ct_attr.ct_labels_id); + if (err) + return -EOPNOTSUPP; + if (nat) { +@@ -675,7 +697,7 @@ mlx5_tc_ct_entry_create_mod_hdr(struct mlx5_tc_ct_priv *ct_priv, + + err_mapping: + dealloc_mod_hdr_actions(&mod_acts); +- mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id); ++ mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id); + return err; + } + +@@ -743,7 +765,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv, + err_rule: + mlx5e_mod_hdr_detach(ct_priv->dev, + ct_priv->mod_hdr_tbl, zone_rule->mh); +- mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id); ++ mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id); + err_mod_hdr: + kfree(attr); + err_attr: +@@ -1198,7 +1220,7 @@ void mlx5_tc_ct_match_del(struct mlx5_tc_ct_priv *priv, struct mlx5_ct_attr *ct_ + if (!priv || !ct_attr->ct_labels_id) + return; + +- mapping_remove(priv->labels_mapping, ct_attr->ct_labels_id); ++ mlx5_put_label_mapping(priv, ct_attr->ct_labels_id); + } + + int +@@ -1276,7 +1298,7 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv, + ct_labels[1] = key->ct_labels[1] & mask->ct_labels[1]; + ct_labels[2] = key->ct_labels[2] & mask->ct_labels[2]; + ct_labels[3] = key->ct_labels[3] & mask->ct_labels[3]; +- if (mapping_add(priv->labels_mapping, ct_labels, &ct_attr->ct_labels_id)) ++ if (mlx5_get_label_mapping(priv, ct_labels, &ct_attr->ct_labels_id)) + return -EOPNOTSUPP; + mlx5e_tc_match_to_reg_match(spec, LABELS_TO_REG, ct_attr->ct_labels_id, + MLX5_CT_LABELS_MASK); +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +index 4880f21792730..05d673e5289df 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +@@ -434,4 +434,10 @@ static inline u16 mlx5e_stop_room_for_wqe(u16 wqe_size) + return wqe_size * 2 - 1; + } + ++static inline bool mlx5e_icosq_can_post_wqe(struct mlx5e_icosq *sq, u16 wqe_size) ++{ ++ u16 room = sq->reserved_room + mlx5e_stop_room_for_wqe(wqe_size); ++ ++ return mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, room); ++} + #endif +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c +index d06532d0baa43..c0bd4e55ed8cb 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c +@@ -137,11 +137,10 @@ post_static_params(struct mlx5e_icosq *sq, + { + struct mlx5e_set_tls_static_params_wqe *wqe; + struct mlx5e_icosq_wqe_info wi; +- u16 pi, num_wqebbs, room; ++ u16 pi, num_wqebbs; + + num_wqebbs = MLX5E_TLS_SET_STATIC_PARAMS_WQEBBS; +- room = mlx5e_stop_room_for_wqe(num_wqebbs); +- if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, room))) ++ if (unlikely(!mlx5e_icosq_can_post_wqe(sq, num_wqebbs))) + return ERR_PTR(-ENOSPC); + + pi = mlx5e_icosq_get_next_pi(sq, num_wqebbs); +@@ -168,11 +167,10 @@ post_progress_params(struct mlx5e_icosq *sq, + { + struct mlx5e_set_tls_progress_params_wqe *wqe; + struct mlx5e_icosq_wqe_info wi; +- u16 pi, num_wqebbs, room; ++ u16 pi, num_wqebbs; + + num_wqebbs = MLX5E_TLS_SET_PROGRESS_PARAMS_WQEBBS; +- room = mlx5e_stop_room_for_wqe(num_wqebbs); +- if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, room))) ++ if (unlikely(!mlx5e_icosq_can_post_wqe(sq, num_wqebbs))) + return ERR_PTR(-ENOSPC); + + pi = mlx5e_icosq_get_next_pi(sq, num_wqebbs); +@@ -277,17 +275,15 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq, + + buf->priv_rx = priv_rx; + +- BUILD_BUG_ON(MLX5E_KTLS_GET_PROGRESS_WQEBBS != 1); +- + spin_lock_bh(&sq->channel->async_icosq_lock); + +- if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, 1))) { ++ if (unlikely(!mlx5e_icosq_can_post_wqe(sq, MLX5E_KTLS_GET_PROGRESS_WQEBBS))) { + spin_unlock_bh(&sq->channel->async_icosq_lock); + err = -ENOSPC; + goto err_dma_unmap; + } + +- pi = mlx5e_icosq_get_next_pi(sq, 1); ++ pi = mlx5e_icosq_get_next_pi(sq, MLX5E_KTLS_GET_PROGRESS_WQEBBS); + wqe = MLX5E_TLS_FETCH_GET_PROGRESS_PARAMS_WQE(sq, pi); + + #define GET_PSV_DS_CNT (DIV_ROUND_UP(sizeof(*wqe), MLX5_SEND_WQE_DS)) +@@ -307,7 +303,7 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq, + + wi = (struct mlx5e_icosq_wqe_info) { + .wqe_type = MLX5E_ICOSQ_WQE_GET_PSV_TLS, +- .num_wqebbs = 1, ++ .num_wqebbs = MLX5E_KTLS_GET_PROGRESS_WQEBBS, + .tls_get_params.buf = buf, + }; + icosq_fill_wi(sq, pi, &wi); +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +index c9d01e705ab29..d3d532fdf04ee 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +@@ -747,11 +747,11 @@ static int get_fec_supported_advertised(struct mlx5_core_dev *dev, + return 0; + } + +-static void ptys2ethtool_supported_advertised_port(struct ethtool_link_ksettings *link_ksettings, +- u32 eth_proto_cap, +- u8 connector_type, bool ext) ++static void ptys2ethtool_supported_advertised_port(struct mlx5_core_dev *mdev, ++ struct ethtool_link_ksettings *link_ksettings, ++ u32 eth_proto_cap, u8 connector_type) + { +- if ((!connector_type && !ext) || connector_type >= MLX5E_CONNECTOR_TYPE_NUMBER) { ++ if (!MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) { + if (eth_proto_cap & (MLX5E_PROT_MASK(MLX5E_10GBASE_CR) + | MLX5E_PROT_MASK(MLX5E_10GBASE_SR) + | MLX5E_PROT_MASK(MLX5E_40GBASE_CR4) +@@ -887,9 +887,9 @@ static int ptys2connector_type[MLX5E_CONNECTOR_TYPE_NUMBER] = { + [MLX5E_PORT_OTHER] = PORT_OTHER, + }; + +-static u8 get_connector_port(u32 eth_proto, u8 connector_type, bool ext) ++static u8 get_connector_port(struct mlx5_core_dev *mdev, u32 eth_proto, u8 connector_type) + { +- if ((connector_type || ext) && connector_type < MLX5E_CONNECTOR_TYPE_NUMBER) ++ if (MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) + return ptys2connector_type[connector_type]; + + if (eth_proto & +@@ -990,11 +990,11 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, + data_rate_oper, link_ksettings); + + eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; +- +- link_ksettings->base.port = get_connector_port(eth_proto_oper, +- connector_type, ext); +- ptys2ethtool_supported_advertised_port(link_ksettings, eth_proto_admin, +- connector_type, ext); ++ connector_type = connector_type < MLX5E_CONNECTOR_TYPE_NUMBER ? ++ connector_type : MLX5E_PORT_UNKNOWN; ++ link_ksettings->base.port = get_connector_port(mdev, eth_proto_oper, connector_type); ++ ptys2ethtool_supported_advertised_port(mdev, link_ksettings, eth_proto_admin, ++ connector_type); + get_lp_advertising(mdev, eth_proto_lp, link_ksettings); + + if (an_status == MLX5_AN_COMPLETE) +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +index b6324d11a0086..7bb189e656283 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +@@ -1058,6 +1058,7 @@ static int mlx5e_alloc_icosq(struct mlx5e_channel *c, + + sq->channel = c; + sq->uar_map = mdev->mlx5e_res.bfreg.map; ++ sq->reserved_room = param->stop_room; + + param->wq.db_numa_node = cpu_to_node(c->cpu); + err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, wq, &sq->wq_ctrl); +@@ -2299,6 +2300,24 @@ void mlx5e_build_icosq_param(struct mlx5e_priv *priv, + mlx5e_build_ico_cq_param(priv, log_wq_size, ¶m->cqp); + } + ++static void mlx5e_build_async_icosq_param(struct mlx5e_priv *priv, ++ struct mlx5e_params *params, ++ u8 log_wq_size, ++ struct mlx5e_sq_param *param) ++{ ++ void *sqc = param->sqc; ++ void *wq = MLX5_ADDR_OF(sqc, sqc, wq); ++ ++ mlx5e_build_sq_param_common(priv, param); ++ ++ /* async_icosq is used by XSK only if xdp_prog is active */ ++ if (params->xdp_prog) ++ param->stop_room = mlx5e_stop_room_for_wqe(1); /* for XSK NOP */ ++ MLX5_SET(sqc, sqc, reg_umr, MLX5_CAP_ETH(priv->mdev, reg_umr_sq)); ++ MLX5_SET(wq, wq, log_wq_sz, log_wq_size); ++ mlx5e_build_ico_cq_param(priv, log_wq_size, ¶m->cqp); ++} ++ + void mlx5e_build_xdpsq_param(struct mlx5e_priv *priv, + struct mlx5e_params *params, + struct mlx5e_sq_param *param) +@@ -2347,7 +2366,7 @@ static void mlx5e_build_channel_param(struct mlx5e_priv *priv, + mlx5e_build_sq_param(priv, params, &cparam->txq_sq); + mlx5e_build_xdpsq_param(priv, params, &cparam->xdp_sq); + mlx5e_build_icosq_param(priv, icosq_log_wq_sz, &cparam->icosq); +- mlx5e_build_icosq_param(priv, async_icosq_log_wq_sz, &cparam->async_icosq); ++ mlx5e_build_async_icosq_param(priv, params, async_icosq_log_wq_sz, &cparam->async_icosq); + } + + int mlx5e_open_channels(struct mlx5e_priv *priv, +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +index f0ceae65f6cfa..8afbb485197e4 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +@@ -1103,8 +1103,9 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv) + + mlx5e_rep_tc_enable(priv); + +- mlx5_modify_vport_admin_state(mdev, MLX5_VPORT_STATE_OP_MOD_UPLINK, +- 0, 0, MLX5_VPORT_ADMIN_STATE_AUTO); ++ if (MLX5_CAP_GEN(mdev, uplink_follow)) ++ mlx5_modify_vport_admin_state(mdev, MLX5_VPORT_STATE_OP_MOD_UPLINK, ++ 0, 0, MLX5_VPORT_ADMIN_STATE_AUTO); + mlx5_lag_add(mdev, netdev); + priv->events_nb.notifier_call = uplink_rep_async_event; + mlx5_notifier_register(mdev, &priv->events_nb); +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c +index fc0afa03d407b..b5f48efebd714 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c +@@ -928,13 +928,24 @@ void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev) + mutex_unlock(&table->lock); + } + ++#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING ++#define MLX5_MAX_ASYNC_EQS 4 ++#else ++#define MLX5_MAX_ASYNC_EQS 3 ++#endif ++ + int mlx5_eq_table_create(struct mlx5_core_dev *dev) + { + struct mlx5_eq_table *eq_table = dev->priv.eq_table; ++ int num_eqs = MLX5_CAP_GEN(dev, max_num_eqs) ? ++ MLX5_CAP_GEN(dev, max_num_eqs) : ++ 1 << MLX5_CAP_GEN(dev, log_max_eq); + int err; + + eq_table->num_comp_eqs = +- mlx5_irq_get_num_comp(eq_table->irq_table); ++ min_t(int, ++ mlx5_irq_get_num_comp(eq_table->irq_table), ++ num_eqs - MLX5_MAX_ASYNC_EQS); + + err = create_async_eqs(dev); + if (err) { +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +index a6956cfc9cb12..4399c9a4999d5 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #include "port.h" + #include "core.h" +@@ -346,6 +347,20 @@ struct mlxsw_sp_port_type_speed_ops { + u32 (*ptys_proto_cap_masked_get)(u32 eth_proto_cap); + }; + ++static inline u8 mlxsw_sp_tunnel_ecn_decap(u8 outer_ecn, u8 inner_ecn, ++ bool *trap_en) ++{ ++ bool set_ce = false; ++ ++ *trap_en = !!__INET_ECN_decapsulate(outer_ecn, inner_ecn, &set_ce); ++ if (set_ce) ++ return INET_ECN_CE; ++ else if (outer_ecn == INET_ECN_ECT_1 && inner_ecn == INET_ECN_ECT_0) ++ return INET_ECN_ECT_1; ++ else ++ return inner_ecn; ++} ++ + static inline struct net_device * + mlxsw_sp_bridge_vxlan_dev_find(struct net_device *br_dev) + { +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c +index 6ccca39bae845..64a8f838eb532 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c +@@ -335,12 +335,11 @@ static int mlxsw_sp_ipip_ecn_decap_init_one(struct mlxsw_sp *mlxsw_sp, + u8 inner_ecn, u8 outer_ecn) + { + char tidem_pl[MLXSW_REG_TIDEM_LEN]; +- bool trap_en, set_ce = false; + u8 new_inner_ecn; ++ bool trap_en; + +- trap_en = __INET_ECN_decapsulate(outer_ecn, inner_ecn, &set_ce); +- new_inner_ecn = set_ce ? INET_ECN_CE : inner_ecn; +- ++ new_inner_ecn = mlxsw_sp_tunnel_ecn_decap(outer_ecn, inner_ecn, ++ &trap_en); + mlxsw_reg_tidem_pack(tidem_pl, outer_ecn, inner_ecn, new_inner_ecn, + trap_en, trap_en ? MLXSW_TRAP_ID_DECAP_ECN0 : 0); + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(tidem), tidem_pl); +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c +index e5ec595593f45..9eba8fa684aee 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c +@@ -909,12 +909,11 @@ static int __mlxsw_sp_nve_ecn_decap_init(struct mlxsw_sp *mlxsw_sp, + u8 inner_ecn, u8 outer_ecn) + { + char tndem_pl[MLXSW_REG_TNDEM_LEN]; +- bool trap_en, set_ce = false; + u8 new_inner_ecn; ++ bool trap_en; + +- trap_en = !!__INET_ECN_decapsulate(outer_ecn, inner_ecn, &set_ce); +- new_inner_ecn = set_ce ? INET_ECN_CE : inner_ecn; +- ++ new_inner_ecn = mlxsw_sp_tunnel_ecn_decap(outer_ecn, inner_ecn, ++ &trap_en); + mlxsw_reg_tndem_pack(tndem_pl, outer_ecn, inner_ecn, new_inner_ecn, + trap_en, trap_en ? MLXSW_TRAP_ID_DECAP_ECN0 : 0); + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(tndem), tndem_pl); +diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +index 1634ca6d4a8f0..c84c8bf2bc20e 100644 +--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c ++++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +@@ -2897,7 +2897,7 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb, + dev_kfree_skb_any(curr); + if (segs != NULL) { + curr = segs; +- segs = segs->next; ++ segs = next; + curr->next = NULL; + dev_kfree_skb_any(segs); + } +diff --git a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c +index 0e2db6ea79e96..2ec62c8d86e1c 100644 +--- a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c ++++ b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c +@@ -454,6 +454,7 @@ void nfp_bpf_ctrl_msg_rx(struct nfp_app *app, struct sk_buff *skb) + dev_consume_skb_any(skb); + else + dev_kfree_skb_any(skb); ++ return; + } + + nfp_ccm_rx(&bpf->ccm, skb); +diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h +index caf12eec99459..56833a41f3d27 100644 +--- a/drivers/net/ethernet/netronome/nfp/flower/main.h ++++ b/drivers/net/ethernet/netronome/nfp/flower/main.h +@@ -190,6 +190,7 @@ struct nfp_fl_internal_ports { + * @qos_rate_limiters: Current active qos rate limiters + * @qos_stats_lock: Lock on qos stats updates + * @pre_tun_rule_cnt: Number of pre-tunnel rules offloaded ++ * @merge_table: Hash table to store merged flows + */ + struct nfp_flower_priv { + struct nfp_app *app; +@@ -223,6 +224,7 @@ struct nfp_flower_priv { + unsigned int qos_rate_limiters; + spinlock_t qos_stats_lock; /* Protect the qos stats */ + int pre_tun_rule_cnt; ++ struct rhashtable merge_table; + }; + + /** +@@ -350,6 +352,12 @@ struct nfp_fl_payload_link { + }; + + extern const struct rhashtable_params nfp_flower_table_params; ++extern const struct rhashtable_params merge_table_params; ++ ++struct nfp_merge_info { ++ u64 parent_ctx; ++ struct rhash_head ht_node; ++}; + + struct nfp_fl_stats_frame { + __be32 stats_con_id; +diff --git a/drivers/net/ethernet/netronome/nfp/flower/metadata.c b/drivers/net/ethernet/netronome/nfp/flower/metadata.c +index aa06fcb38f8b9..327bb56b3ef56 100644 +--- a/drivers/net/ethernet/netronome/nfp/flower/metadata.c ++++ b/drivers/net/ethernet/netronome/nfp/flower/metadata.c +@@ -490,6 +490,12 @@ const struct rhashtable_params nfp_flower_table_params = { + .automatic_shrinking = true, + }; + ++const struct rhashtable_params merge_table_params = { ++ .key_offset = offsetof(struct nfp_merge_info, parent_ctx), ++ .head_offset = offsetof(struct nfp_merge_info, ht_node), ++ .key_len = sizeof(u64), ++}; ++ + int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, + unsigned int host_num_mems) + { +@@ -506,6 +512,10 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, + if (err) + goto err_free_flow_table; + ++ err = rhashtable_init(&priv->merge_table, &merge_table_params); ++ if (err) ++ goto err_free_stats_ctx_table; ++ + get_random_bytes(&priv->mask_id_seed, sizeof(priv->mask_id_seed)); + + /* Init ring buffer and unallocated mask_ids. */ +@@ -513,7 +523,7 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, + kmalloc_array(NFP_FLOWER_MASK_ENTRY_RS, + NFP_FLOWER_MASK_ELEMENT_RS, GFP_KERNEL); + if (!priv->mask_ids.mask_id_free_list.buf) +- goto err_free_stats_ctx_table; ++ goto err_free_merge_table; + + priv->mask_ids.init_unallocated = NFP_FLOWER_MASK_ENTRY_RS - 1; + +@@ -550,6 +560,8 @@ err_free_last_used: + kfree(priv->mask_ids.last_used); + err_free_mask_id: + kfree(priv->mask_ids.mask_id_free_list.buf); ++err_free_merge_table: ++ rhashtable_destroy(&priv->merge_table); + err_free_stats_ctx_table: + rhashtable_destroy(&priv->stats_ctx_table); + err_free_flow_table: +@@ -568,6 +580,8 @@ void nfp_flower_metadata_cleanup(struct nfp_app *app) + nfp_check_rhashtable_empty, NULL); + rhashtable_free_and_destroy(&priv->stats_ctx_table, + nfp_check_rhashtable_empty, NULL); ++ rhashtable_free_and_destroy(&priv->merge_table, ++ nfp_check_rhashtable_empty, NULL); + kvfree(priv->stats); + kfree(priv->mask_ids.mask_id_free_list.buf); + kfree(priv->mask_ids.last_used); +diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c +index d72225d64a75d..e95969c462e46 100644 +--- a/drivers/net/ethernet/netronome/nfp/flower/offload.c ++++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c +@@ -1009,6 +1009,8 @@ int nfp_flower_merge_offloaded_flows(struct nfp_app *app, + struct netlink_ext_ack *extack = NULL; + struct nfp_fl_payload *merge_flow; + struct nfp_fl_key_ls merge_key_ls; ++ struct nfp_merge_info *merge_info; ++ u64 parent_ctx = 0; + int err; + + ASSERT_RTNL(); +@@ -1019,6 +1021,15 @@ int nfp_flower_merge_offloaded_flows(struct nfp_app *app, + nfp_flower_is_merge_flow(sub_flow2)) + return -EINVAL; + ++ /* check if the two flows are already merged */ ++ parent_ctx = (u64)(be32_to_cpu(sub_flow1->meta.host_ctx_id)) << 32; ++ parent_ctx |= (u64)(be32_to_cpu(sub_flow2->meta.host_ctx_id)); ++ if (rhashtable_lookup_fast(&priv->merge_table, ++ &parent_ctx, merge_table_params)) { ++ nfp_flower_cmsg_warn(app, "The two flows are already merged.\n"); ++ return 0; ++ } ++ + err = nfp_flower_can_merge(sub_flow1, sub_flow2); + if (err) + return err; +@@ -1060,16 +1071,33 @@ int nfp_flower_merge_offloaded_flows(struct nfp_app *app, + if (err) + goto err_release_metadata; + ++ merge_info = kmalloc(sizeof(*merge_info), GFP_KERNEL); ++ if (!merge_info) { ++ err = -ENOMEM; ++ goto err_remove_rhash; ++ } ++ merge_info->parent_ctx = parent_ctx; ++ err = rhashtable_insert_fast(&priv->merge_table, &merge_info->ht_node, ++ merge_table_params); ++ if (err) ++ goto err_destroy_merge_info; ++ + err = nfp_flower_xmit_flow(app, merge_flow, + NFP_FLOWER_CMSG_TYPE_FLOW_MOD); + if (err) +- goto err_remove_rhash; ++ goto err_remove_merge_info; + + merge_flow->in_hw = true; + sub_flow1->in_hw = false; + + return 0; + ++err_remove_merge_info: ++ WARN_ON_ONCE(rhashtable_remove_fast(&priv->merge_table, ++ &merge_info->ht_node, ++ merge_table_params)); ++err_destroy_merge_info: ++ kfree(merge_info); + err_remove_rhash: + WARN_ON_ONCE(rhashtable_remove_fast(&priv->flow_table, + &merge_flow->fl_node, +@@ -1359,7 +1387,9 @@ nfp_flower_remove_merge_flow(struct nfp_app *app, + { + struct nfp_flower_priv *priv = app->priv; + struct nfp_fl_payload_link *link, *temp; ++ struct nfp_merge_info *merge_info; + struct nfp_fl_payload *origin; ++ u64 parent_ctx = 0; + bool mod = false; + int err; + +@@ -1396,8 +1426,22 @@ nfp_flower_remove_merge_flow(struct nfp_app *app, + err_free_links: + /* Clean any links connected with the merged flow. */ + list_for_each_entry_safe(link, temp, &merge_flow->linked_flows, +- merge_flow.list) ++ merge_flow.list) { ++ u32 ctx_id = be32_to_cpu(link->sub_flow.flow->meta.host_ctx_id); ++ ++ parent_ctx = (parent_ctx << 32) | (u64)(ctx_id); + nfp_flower_unlink_flow(link); ++ } ++ ++ merge_info = rhashtable_lookup_fast(&priv->merge_table, ++ &parent_ctx, ++ merge_table_params); ++ if (merge_info) { ++ WARN_ON_ONCE(rhashtable_remove_fast(&priv->merge_table, ++ &merge_info->ht_node, ++ merge_table_params)); ++ kfree(merge_info); ++ } + + kfree(merge_flow->action_data); + kfree(merge_flow->mask_data); +diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c +index 5523f069b9a5a..f35b0b83fe85a 100644 +--- a/drivers/net/geneve.c ++++ b/drivers/net/geneve.c +@@ -908,8 +908,16 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, + + info = skb_tunnel_info(skb); + if (info) { +- info->key.u.ipv4.dst = fl4.saddr; +- info->key.u.ipv4.src = fl4.daddr; ++ struct ip_tunnel_info *unclone; ++ ++ unclone = skb_tunnel_info_unclone(skb); ++ if (unlikely(!unclone)) { ++ dst_release(&rt->dst); ++ return -ENOMEM; ++ } ++ ++ unclone->key.u.ipv4.dst = fl4.saddr; ++ unclone->key.u.ipv4.src = fl4.daddr; + } + + if (!pskb_may_pull(skb, ETH_HLEN)) { +@@ -993,8 +1001,16 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, + struct ip_tunnel_info *info = skb_tunnel_info(skb); + + if (info) { +- info->key.u.ipv6.dst = fl6.saddr; +- info->key.u.ipv6.src = fl6.daddr; ++ struct ip_tunnel_info *unclone; ++ ++ unclone = skb_tunnel_info_unclone(skb); ++ if (unlikely(!unclone)) { ++ dst_release(dst); ++ return -ENOMEM; ++ } ++ ++ unclone->key.u.ipv6.dst = fl6.saddr; ++ unclone->key.u.ipv6.src = fl6.daddr; + } + + if (!pskb_may_pull(skb, ETH_HLEN)) { +diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c +index 0dd0ba915ab97..23ee0b14cbfa1 100644 +--- a/drivers/net/ieee802154/atusb.c ++++ b/drivers/net/ieee802154/atusb.c +@@ -365,6 +365,7 @@ static int atusb_alloc_urbs(struct atusb *atusb, int n) + return -ENOMEM; + } + usb_anchor_urb(urb, &atusb->idle_urbs); ++ usb_free_urb(urb); + n--; + } + return 0; +diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c +index 53282a6d5928f..287cccf8f7f4e 100644 +--- a/drivers/net/phy/bcm-phy-lib.c ++++ b/drivers/net/phy/bcm-phy-lib.c +@@ -369,7 +369,7 @@ EXPORT_SYMBOL_GPL(bcm_phy_enable_apd); + + int bcm_phy_set_eee(struct phy_device *phydev, bool enable) + { +- int val; ++ int val, mask = 0; + + /* Enable EEE at PHY level */ + val = phy_read_mmd(phydev, MDIO_MMD_AN, BRCM_CL45VEN_EEE_CONTROL); +@@ -388,10 +388,17 @@ int bcm_phy_set_eee(struct phy_device *phydev, bool enable) + if (val < 0) + return val; + ++ if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, ++ phydev->supported)) ++ mask |= MDIO_EEE_1000T; ++ if (linkmode_test_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, ++ phydev->supported)) ++ mask |= MDIO_EEE_100TX; ++ + if (enable) +- val |= (MDIO_EEE_100TX | MDIO_EEE_1000T); ++ val |= mask; + else +- val &= ~(MDIO_EEE_100TX | MDIO_EEE_1000T); ++ val &= ~mask; + + phy_write_mmd(phydev, MDIO_MMD_AN, BCM_CL45VEN_EEE_ADV, (u32)val); + +diff --git a/drivers/net/tun.c b/drivers/net/tun.c +index 5512418b7be0a..2ed54818dcbcf 100644 +--- a/drivers/net/tun.c ++++ b/drivers/net/tun.c +@@ -69,6 +69,14 @@ + #include + #include + #include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include + + #include + #include +@@ -2925,6 +2933,45 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p, + return __tun_set_ebpf(tun, prog_p, prog); + } + ++/* Return correct value for tun->dev->addr_len based on tun->dev->type. */ ++static unsigned char tun_get_addr_len(unsigned short type) ++{ ++ switch (type) { ++ case ARPHRD_IP6GRE: ++ case ARPHRD_TUNNEL6: ++ return sizeof(struct in6_addr); ++ case ARPHRD_IPGRE: ++ case ARPHRD_TUNNEL: ++ case ARPHRD_SIT: ++ return 4; ++ case ARPHRD_ETHER: ++ return ETH_ALEN; ++ case ARPHRD_IEEE802154: ++ case ARPHRD_IEEE802154_MONITOR: ++ return IEEE802154_EXTENDED_ADDR_LEN; ++ case ARPHRD_PHONET_PIPE: ++ case ARPHRD_PPP: ++ case ARPHRD_NONE: ++ return 0; ++ case ARPHRD_6LOWPAN: ++ return EUI64_ADDR_LEN; ++ case ARPHRD_FDDI: ++ return FDDI_K_ALEN; ++ case ARPHRD_HIPPI: ++ return HIPPI_ALEN; ++ case ARPHRD_IEEE802: ++ return FC_ALEN; ++ case ARPHRD_ROSE: ++ return ROSE_ADDR_LEN; ++ case ARPHRD_NETROM: ++ return AX25_ADDR_LEN; ++ case ARPHRD_LOCALTLK: ++ return LTALK_ALEN; ++ default: ++ return 0; ++ } ++} ++ + static long __tun_chr_ioctl(struct file *file, unsigned int cmd, + unsigned long arg, int ifreq_len) + { +@@ -3088,6 +3135,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, + break; + } + tun->dev->type = (int) arg; ++ tun->dev->addr_len = tun_get_addr_len(tun->dev->type); + netif_info(tun, drv, tun->dev, "linktype set to %d\n", + tun->dev->type); + call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, +diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c +index 2bb28db894320..d18642a8144cf 100644 +--- a/drivers/net/usb/hso.c ++++ b/drivers/net/usb/hso.c +@@ -611,7 +611,7 @@ static struct hso_serial *get_serial_by_index(unsigned index) + return serial; + } + +-static int get_free_serial_index(void) ++static int obtain_minor(struct hso_serial *serial) + { + int index; + unsigned long flags; +@@ -619,8 +619,10 @@ static int get_free_serial_index(void) + spin_lock_irqsave(&serial_table_lock, flags); + for (index = 0; index < HSO_SERIAL_TTY_MINORS; index++) { + if (serial_table[index] == NULL) { ++ serial_table[index] = serial->parent; ++ serial->minor = index; + spin_unlock_irqrestore(&serial_table_lock, flags); +- return index; ++ return 0; + } + } + spin_unlock_irqrestore(&serial_table_lock, flags); +@@ -629,15 +631,12 @@ static int get_free_serial_index(void) + return -1; + } + +-static void set_serial_by_index(unsigned index, struct hso_serial *serial) ++static void release_minor(struct hso_serial *serial) + { + unsigned long flags; + + spin_lock_irqsave(&serial_table_lock, flags); +- if (serial) +- serial_table[index] = serial->parent; +- else +- serial_table[index] = NULL; ++ serial_table[serial->minor] = NULL; + spin_unlock_irqrestore(&serial_table_lock, flags); + } + +@@ -2230,6 +2229,7 @@ static int hso_stop_serial_device(struct hso_device *hso_dev) + static void hso_serial_tty_unregister(struct hso_serial *serial) + { + tty_unregister_device(tty_drv, serial->minor); ++ release_minor(serial); + } + + static void hso_serial_common_free(struct hso_serial *serial) +@@ -2253,24 +2253,22 @@ static void hso_serial_common_free(struct hso_serial *serial) + static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, + int rx_size, int tx_size) + { +- int minor; + int i; + + tty_port_init(&serial->port); + +- minor = get_free_serial_index(); +- if (minor < 0) ++ if (obtain_minor(serial)) + goto exit2; + + /* register our minor number */ + serial->parent->dev = tty_port_register_device_attr(&serial->port, +- tty_drv, minor, &serial->parent->interface->dev, ++ tty_drv, serial->minor, &serial->parent->interface->dev, + serial->parent, hso_serial_dev_groups); +- if (IS_ERR(serial->parent->dev)) ++ if (IS_ERR(serial->parent->dev)) { ++ release_minor(serial); + goto exit2; ++ } + +- /* fill in specific data for later use */ +- serial->minor = minor; + serial->magic = HSO_SERIAL_MAGIC; + spin_lock_init(&serial->serial_lock); + serial->num_rx_urbs = num_urbs; +@@ -2667,9 +2665,6 @@ static struct hso_device *hso_create_bulk_serial_device( + + serial->write_data = hso_std_serial_write_data; + +- /* and record this serial */ +- set_serial_by_index(serial->minor, serial); +- + /* setup the proc dirs and files if needed */ + hso_log_port(hso_dev); + +@@ -2726,9 +2721,6 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, + serial->shared_int->ref_count++; + mutex_unlock(&serial->shared_int->shared_int_lock); + +- /* and record this serial */ +- set_serial_by_index(serial->minor, serial); +- + /* setup the proc dirs and files if needed */ + hso_log_port(hso_dev); + +@@ -3113,7 +3105,6 @@ static void hso_free_interface(struct usb_interface *interface) + cancel_work_sync(&serial_table[i]->async_get_intf); + hso_serial_tty_unregister(serial); + kref_put(&serial_table[i]->ref, hso_serial_ref_free); +- set_serial_by_index(i, NULL); + } + } + +diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c +index 0842371eca3d6..4adfa6a01198d 100644 +--- a/drivers/net/vxlan.c ++++ b/drivers/net/vxlan.c +@@ -2725,12 +2725,17 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, + goto tx_error; + } else if (err) { + if (info) { ++ struct ip_tunnel_info *unclone; + struct in_addr src, dst; + ++ unclone = skb_tunnel_info_unclone(skb); ++ if (unlikely(!unclone)) ++ goto tx_error; ++ + src = remote_ip.sin.sin_addr; + dst = local_ip.sin.sin_addr; +- info->key.u.ipv4.src = src.s_addr; +- info->key.u.ipv4.dst = dst.s_addr; ++ unclone->key.u.ipv4.src = src.s_addr; ++ unclone->key.u.ipv4.dst = dst.s_addr; + } + vxlan_encap_bypass(skb, vxlan, vxlan, vni, false); + dst_release(ndst); +@@ -2781,12 +2786,17 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, + goto tx_error; + } else if (err) { + if (info) { ++ struct ip_tunnel_info *unclone; + struct in6_addr src, dst; + ++ unclone = skb_tunnel_info_unclone(skb); ++ if (unlikely(!unclone)) ++ goto tx_error; ++ + src = remote_ip.sin6.sin6_addr; + dst = local_ip.sin6.sin6_addr; +- info->key.u.ipv6.src = src; +- info->key.u.ipv6.dst = dst; ++ unclone->key.u.ipv6.src = src; ++ unclone->key.u.ipv6.dst = dst; + } + + vxlan_encap_bypass(skb, vxlan, vxlan, vni, false); +diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c +index 0720f5f92caa7..4d9dc7d159089 100644 +--- a/drivers/net/wan/hdlc_fr.c ++++ b/drivers/net/wan/hdlc_fr.c +@@ -415,7 +415,7 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev) + + if (pad > 0) { /* Pad the frame with zeros */ + if (__skb_pad(skb, pad, false)) +- goto drop; ++ goto out; + skb_put(skb, pad); + } + } +@@ -448,8 +448,9 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev) + return NETDEV_TX_OK; + + drop: +- dev->stats.tx_dropped++; + kfree_skb(skb); ++out: ++ dev->stats.tx_dropped++; + return NETDEV_TX_OK; + } + +diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +index 720193d16539b..7da193a128710 100644 +--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +@@ -232,7 +232,7 @@ enum iwl_reg_capa_flags_v2 { + REG_CAPA_V2_MCS_9_ALLOWED = BIT(6), + REG_CAPA_V2_WEATHER_DISABLED = BIT(7), + REG_CAPA_V2_40MHZ_ALLOWED = BIT(8), +- REG_CAPA_V2_11AX_DISABLED = BIT(13), ++ REG_CAPA_V2_11AX_DISABLED = BIT(10), + }; + + /* +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c +index 8fba190e84cf3..cecc32e7dbe8a 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause + /* +- * Copyright (C) 2018-2020 Intel Corporation ++ * Copyright (C) 2018-2021 Intel Corporation + */ + #include "iwl-trans.h" + #include "iwl-fh.h" +@@ -75,15 +75,6 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, + const struct fw_img *fw) + { + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); +- u32 ltr_val = CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ | +- u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, +- CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE) | +- u32_encode_bits(250, +- CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL) | +- CSR_LTR_LONG_VAL_AD_SNOOP_REQ | +- u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, +- CSR_LTR_LONG_VAL_AD_SNOOP_SCALE) | +- u32_encode_bits(250, CSR_LTR_LONG_VAL_AD_SNOOP_VAL); + struct iwl_context_info_gen3 *ctxt_info_gen3; + struct iwl_prph_scratch *prph_scratch; + struct iwl_prph_scratch_ctrl_cfg *prph_sc_ctrl; +@@ -217,26 +208,6 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, + iwl_set_bit(trans, CSR_CTXT_INFO_BOOT_CTRL, + CSR_AUTO_FUNC_BOOT_ENA); + +- /* +- * To workaround hardware latency issues during the boot process, +- * initialize the LTR to ~250 usec (see ltr_val above). +- * The firmware initializes this again later (to a smaller value). +- */ +- if ((trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210 || +- trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) && +- !trans->trans_cfg->integrated) { +- iwl_write32(trans, CSR_LTR_LONG_VAL_AD, ltr_val); +- } else if (trans->trans_cfg->integrated && +- trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) { +- iwl_write_prph(trans, HPM_MAC_LTR_CSR, HPM_MAC_LRT_ENABLE_ALL); +- iwl_write_prph(trans, HPM_UMAC_LTR, ltr_val); +- } +- +- if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) +- iwl_write_umac_prph(trans, UREG_CPU_INIT_RUN, 1); +- else +- iwl_set_bit(trans, CSR_GP_CNTRL, CSR_AUTO_FUNC_INIT); +- + return 0; + + err_free_ctxt_info: +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c +index d1bb273d6b6d9..74ce31fdf45e9 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause + /* + * Copyright (C) 2017 Intel Deutschland GmbH +- * Copyright (C) 2018-2020 Intel Corporation ++ * Copyright (C) 2018-2021 Intel Corporation + */ + #include "iwl-trans.h" + #include "iwl-fh.h" +@@ -240,7 +240,6 @@ int iwl_pcie_ctxt_info_init(struct iwl_trans *trans, + + /* kick FW self load */ + iwl_write64(trans, CSR_CTXT_INFO_BA, trans_pcie->ctxt_info_dma_addr); +- iwl_write_prph(trans, UREG_CPU_INIT_RUN, 1); + + /* Context info will be released upon alive or failure to get one */ + +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +index c602b815dcc21..08788bc906830 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +@@ -260,6 +260,34 @@ void iwl_trans_pcie_gen2_fw_alive(struct iwl_trans *trans, u32 scd_addr) + mutex_unlock(&trans_pcie->mutex); + } + ++static void iwl_pcie_set_ltr(struct iwl_trans *trans) ++{ ++ u32 ltr_val = CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ | ++ u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, ++ CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE) | ++ u32_encode_bits(250, ++ CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL) | ++ CSR_LTR_LONG_VAL_AD_SNOOP_REQ | ++ u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, ++ CSR_LTR_LONG_VAL_AD_SNOOP_SCALE) | ++ u32_encode_bits(250, CSR_LTR_LONG_VAL_AD_SNOOP_VAL); ++ ++ /* ++ * To workaround hardware latency issues during the boot process, ++ * initialize the LTR to ~250 usec (see ltr_val above). ++ * The firmware initializes this again later (to a smaller value). ++ */ ++ if ((trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210 || ++ trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) && ++ !trans->trans_cfg->integrated) { ++ iwl_write32(trans, CSR_LTR_LONG_VAL_AD, ltr_val); ++ } else if (trans->trans_cfg->integrated && ++ trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) { ++ iwl_write_prph(trans, HPM_MAC_LTR_CSR, HPM_MAC_LRT_ENABLE_ALL); ++ iwl_write_prph(trans, HPM_UMAC_LTR, ltr_val); ++ } ++} ++ + int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans, + const struct fw_img *fw, bool run_in_rfkill) + { +@@ -326,6 +354,13 @@ int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans, + if (ret) + goto out; + ++ iwl_pcie_set_ltr(trans); ++ ++ if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) ++ iwl_write_umac_prph(trans, UREG_CPU_INIT_RUN, 1); ++ else ++ iwl_write_prph(trans, UREG_CPU_INIT_RUN, 1); ++ + /* re-check RF-Kill state since we may have missed the interrupt */ + hw_rfkill = iwl_pcie_check_hw_rf_kill(trans); + if (hw_rfkill && !run_in_rfkill) +diff --git a/drivers/of/property.c b/drivers/of/property.c +index 5f9eed79a8aaf..6d8368bf88cab 100644 +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -1260,7 +1260,16 @@ DEFINE_SIMPLE_PROP(pinctrl7, "pinctrl-7", NULL) + DEFINE_SIMPLE_PROP(pinctrl8, "pinctrl-8", NULL) + DEFINE_SUFFIX_PROP(regulators, "-supply", NULL) + DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells") +-DEFINE_SUFFIX_PROP(gpios, "-gpios", "#gpio-cells") ++ ++static struct device_node *parse_gpios(struct device_node *np, ++ const char *prop_name, int index) ++{ ++ if (!strcmp_suffix(prop_name, ",nr-gpios")) ++ return NULL; ++ ++ return parse_suffix_prop_cells(np, prop_name, index, "-gpios", ++ "#gpio-cells"); ++} + + static struct device_node *parse_iommu_maps(struct device_node *np, + const char *prop_name, int index) +diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c +index 57cc92891a570..078648a9201b3 100644 +--- a/drivers/platform/x86/intel-hid.c ++++ b/drivers/platform/x86/intel-hid.c +@@ -483,11 +483,16 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) + goto wakeup; + + /* +- * Switch events will wake the device and report the new switch +- * position to the input subsystem. ++ * Some devices send (duplicate) tablet-mode events when moved ++ * around even though the mode has not changed; and they do this ++ * even when suspended. ++ * Update the switch state in case it changed and then return ++ * without waking up to avoid spurious wakeups. + */ +- if (priv->switches && (event == 0xcc || event == 0xcd)) +- goto wakeup; ++ if (event == 0xcc || event == 0xcd) { ++ report_tablet_mode_event(priv->switches, event); ++ return; ++ } + + /* Wake up on 5-button array events only. */ + if (event == 0xc0 || !priv->array) +@@ -501,9 +506,6 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) + wakeup: + pm_wakeup_hard_event(&device->dev); + +- if (report_tablet_mode_event(priv->switches, event)) +- return; +- + return; + } + +diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c +index ddecf25b5dd40..d7894f178bd4f 100644 +--- a/drivers/ras/cec.c ++++ b/drivers/ras/cec.c +@@ -309,11 +309,20 @@ static bool sanity_check(struct ce_array *ca) + return ret; + } + ++/** ++ * cec_add_elem - Add an element to the CEC array. ++ * @pfn: page frame number to insert ++ * ++ * Return values: ++ * - <0: on error ++ * - 0: on success ++ * - >0: when the inserted pfn was offlined ++ */ + static int cec_add_elem(u64 pfn) + { + struct ce_array *ca = &ce_arr; ++ int count, err, ret = 0; + unsigned int to = 0; +- int count, ret = 0; + + /* + * We can be called very early on the identify_cpu() path where we are +@@ -330,8 +339,8 @@ static int cec_add_elem(u64 pfn) + if (ca->n == MAX_ELEMS) + WARN_ON(!del_lru_elem_unlocked(ca)); + +- ret = find_elem(ca, pfn, &to); +- if (ret < 0) { ++ err = find_elem(ca, pfn, &to); ++ if (err < 0) { + /* + * Shift range [to-end] to make room for one more element. + */ +diff --git a/drivers/regulator/bd9571mwv-regulator.c b/drivers/regulator/bd9571mwv-regulator.c +index e690c2ce5b3c5..25e33028871c0 100644 +--- a/drivers/regulator/bd9571mwv-regulator.c ++++ b/drivers/regulator/bd9571mwv-regulator.c +@@ -124,7 +124,7 @@ static const struct regulator_ops vid_ops = { + + static const struct regulator_desc regulators[] = { + BD9571MWV_REG("VD09", "vd09", VD09, avs_ops, 0, 0x7f, +- 0x80, 600000, 10000, 0x3c), ++ 0x6f, 600000, 10000, 0x3c), + BD9571MWV_REG("VD18", "vd18", VD18, vid_ops, BD9571MWV_VD18_VID, 0xf, + 16, 1625000, 25000, 0), + BD9571MWV_REG("VD25", "vd25", VD25, vid_ops, BD9571MWV_VD25_VID, 0xf, +@@ -133,7 +133,7 @@ static const struct regulator_desc regulators[] = { + 11, 2800000, 100000, 0), + BD9571MWV_REG("DVFS", "dvfs", DVFS, reg_ops, + BD9571MWV_DVFS_MONIVDAC, 0x7f, +- 0x80, 600000, 10000, 0x3c), ++ 0x6f, 600000, 10000, 0x3c), + }; + + #ifdef CONFIG_PM_SLEEP +diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c +index 2667919d76b34..16979c1cd2f4b 100644 +--- a/drivers/remoteproc/pru_rproc.c ++++ b/drivers/remoteproc/pru_rproc.c +@@ -585,7 +585,7 @@ pru_rproc_load_elf_segments(struct rproc *rproc, const struct firmware *fw) + break; + } + +- if (pru->data->is_k3 && is_iram) { ++ if (pru->data->is_k3) { + ret = pru_rproc_memcpy(ptr, elf_data + phdr->p_offset, + filesz); + if (ret) { +diff --git a/drivers/remoteproc/qcom_pil_info.c b/drivers/remoteproc/qcom_pil_info.c +index 5521c4437ffab..7c007dd7b2000 100644 +--- a/drivers/remoteproc/qcom_pil_info.c ++++ b/drivers/remoteproc/qcom_pil_info.c +@@ -56,7 +56,7 @@ static int qcom_pil_info_init(void) + memset_io(base, 0, resource_size(&imem)); + + _reloc.base = base; +- _reloc.num_entries = resource_size(&imem) / PIL_RELOC_ENTRY_SIZE; ++ _reloc.num_entries = (u32)resource_size(&imem) / PIL_RELOC_ENTRY_SIZE; + + return 0; + } +diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c +index ea43dff40a856..6fa739c92beb3 100644 +--- a/drivers/scsi/pm8001/pm8001_hwi.c ++++ b/drivers/scsi/pm8001/pm8001_hwi.c +@@ -223,7 +223,7 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha) + PM8001_EVENT_LOG_SIZE; + pm8001_ha->main_cfg_tbl.pm8001_tbl.iop_event_log_option = 0x01; + pm8001_ha->main_cfg_tbl.pm8001_tbl.fatal_err_interrupt = 0x01; +- for (i = 0; i < PM8001_MAX_INB_NUM; i++) { ++ for (i = 0; i < pm8001_ha->max_q_num; i++) { + pm8001_ha->inbnd_q_tbl[i].element_pri_size_cnt = + PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x00<<30); + pm8001_ha->inbnd_q_tbl[i].upper_base_addr = +@@ -249,7 +249,7 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha) + pm8001_ha->inbnd_q_tbl[i].producer_idx = 0; + pm8001_ha->inbnd_q_tbl[i].consumer_index = 0; + } +- for (i = 0; i < PM8001_MAX_OUTB_NUM; i++) { ++ for (i = 0; i < pm8001_ha->max_q_num; i++) { + pm8001_ha->outbnd_q_tbl[i].element_size_cnt = + PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x01<<30); + pm8001_ha->outbnd_q_tbl[i].upper_base_addr = +@@ -671,9 +671,9 @@ static int pm8001_chip_init(struct pm8001_hba_info *pm8001_ha) + read_outbnd_queue_table(pm8001_ha); + /* update main config table ,inbound table and outbound table */ + update_main_config_table(pm8001_ha); +- for (i = 0; i < PM8001_MAX_INB_NUM; i++) ++ for (i = 0; i < pm8001_ha->max_q_num; i++) + update_inbnd_queue_table(pm8001_ha, i); +- for (i = 0; i < PM8001_MAX_OUTB_NUM; i++) ++ for (i = 0; i < pm8001_ha->max_q_num; i++) + update_outbnd_queue_table(pm8001_ha, i); + /* 8081 controller donot require these operations */ + if (deviceid != 0x8081 && deviceid != 0x0042) { +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c +index 16e1bd1aa49d5..e53a3f89e8635 100644 +--- a/drivers/scsi/ufs/ufshcd.c ++++ b/drivers/scsi/ufs/ufshcd.c +@@ -6363,37 +6363,34 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba, + DECLARE_COMPLETION_ONSTACK(wait); + struct request *req; + unsigned long flags; +- int free_slot, task_tag, err; ++ int task_tag, err; + + /* +- * Get free slot, sleep if slots are unavailable. +- * Even though we use wait_event() which sleeps indefinitely, +- * the maximum wait time is bounded by %TM_CMD_TIMEOUT. ++ * blk_get_request() is used here only to get a free tag. + */ + req = blk_get_request(q, REQ_OP_DRV_OUT, 0); + if (IS_ERR(req)) + return PTR_ERR(req); + + req->end_io_data = &wait; +- free_slot = req->tag; +- WARN_ON_ONCE(free_slot < 0 || free_slot >= hba->nutmrs); + ufshcd_hold(hba, false); + + spin_lock_irqsave(host->host_lock, flags); +- task_tag = hba->nutrs + free_slot; ++ blk_mq_start_request(req); + ++ task_tag = req->tag; + treq->req_header.dword_0 |= cpu_to_be32(task_tag); + +- memcpy(hba->utmrdl_base_addr + free_slot, treq, sizeof(*treq)); +- ufshcd_vops_setup_task_mgmt(hba, free_slot, tm_function); ++ memcpy(hba->utmrdl_base_addr + task_tag, treq, sizeof(*treq)); ++ ufshcd_vops_setup_task_mgmt(hba, task_tag, tm_function); + + /* send command to the controller */ +- __set_bit(free_slot, &hba->outstanding_tasks); ++ __set_bit(task_tag, &hba->outstanding_tasks); + + /* Make sure descriptors are ready before ringing the task doorbell */ + wmb(); + +- ufshcd_writel(hba, 1 << free_slot, REG_UTP_TASK_REQ_DOOR_BELL); ++ ufshcd_writel(hba, 1 << task_tag, REG_UTP_TASK_REQ_DOOR_BELL); + /* Make sure that doorbell is committed immediately */ + wmb(); + +@@ -6413,24 +6410,24 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba, + ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_complete_err"); + dev_err(hba->dev, "%s: task management cmd 0x%.2x timed-out\n", + __func__, tm_function); +- if (ufshcd_clear_tm_cmd(hba, free_slot)) +- dev_WARN(hba->dev, "%s: unable clear tm cmd (slot %d) after timeout\n", +- __func__, free_slot); ++ if (ufshcd_clear_tm_cmd(hba, task_tag)) ++ dev_WARN(hba->dev, "%s: unable to clear tm cmd (slot %d) after timeout\n", ++ __func__, task_tag); + err = -ETIMEDOUT; + } else { + err = 0; +- memcpy(treq, hba->utmrdl_base_addr + free_slot, sizeof(*treq)); ++ memcpy(treq, hba->utmrdl_base_addr + task_tag, sizeof(*treq)); + + ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_complete"); + } + + spin_lock_irqsave(hba->host->host_lock, flags); +- __clear_bit(free_slot, &hba->outstanding_tasks); ++ __clear_bit(task_tag, &hba->outstanding_tasks); + spin_unlock_irqrestore(hba->host->host_lock, flags); + ++ ufshcd_release(hba); + blk_put_request(req); + +- ufshcd_release(hba); + return err; + } + +diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c +index a1b9be1d105a0..fde4edd83c14c 100644 +--- a/drivers/soc/fsl/qbman/qman.c ++++ b/drivers/soc/fsl/qbman/qman.c +@@ -186,7 +186,7 @@ struct qm_eqcr_entry { + __be32 tag; + struct qm_fd fd; + u8 __reserved3[32]; +-} __packed; ++} __packed __aligned(8); + #define QM_EQCR_VERB_VBIT 0x80 + #define QM_EQCR_VERB_CMD_MASK 0x61 /* but only one value; */ + #define QM_EQCR_VERB_CMD_ENQUEUE 0x01 +diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c +index 518fac4864cfa..a237f1cf9bd60 100644 +--- a/drivers/target/iscsi/iscsi_target.c ++++ b/drivers/target/iscsi/iscsi_target.c +@@ -1166,6 +1166,7 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, + + target_get_sess_cmd(&cmd->se_cmd, true); + ++ cmd->se_cmd.tag = (__force u32)cmd->init_task_tag; + cmd->sense_reason = target_cmd_init_cdb(&cmd->se_cmd, hdr->cdb); + if (cmd->sense_reason) { + if (cmd->sense_reason == TCM_OUT_OF_RESOURCES) { +@@ -1180,8 +1181,6 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, + if (cmd->sense_reason) + goto attach_cmd; + +- /* only used for printks or comparing with ->ref_task_tag */ +- cmd->se_cmd.tag = (__force u32)cmd->init_task_tag; + cmd->sense_reason = target_cmd_parse_cdb(&cmd->se_cmd); + if (cmd->sense_reason) + goto attach_cmd; +diff --git a/drivers/thunderbolt/retimer.c b/drivers/thunderbolt/retimer.c +index 620bcf586ee24..c44fad2b9fbbf 100644 +--- a/drivers/thunderbolt/retimer.c ++++ b/drivers/thunderbolt/retimer.c +@@ -347,7 +347,7 @@ static int tb_retimer_add(struct tb_port *port, u8 index, u32 auth_status) + ret = tb_retimer_nvm_add(rt); + if (ret) { + dev_err(&rt->dev, "failed to add NVM devices: %d\n", ret); +- device_del(&rt->dev); ++ device_unregister(&rt->dev); + return ret; + } + +@@ -406,7 +406,7 @@ static struct tb_retimer *tb_port_find_retimer(struct tb_port *port, u8 index) + */ + int tb_retimer_scan(struct tb_port *port) + { +- u32 status[TB_MAX_RETIMER_INDEX] = {}; ++ u32 status[TB_MAX_RETIMER_INDEX + 1] = {}; + int ret, i, last_idx = 0; + + if (!port->cap_usb4) +diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c +index 8f1de1fbbeedf..d8d3892e5a69a 100644 +--- a/drivers/usb/usbip/stub_dev.c ++++ b/drivers/usb/usbip/stub_dev.c +@@ -63,6 +63,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a + + dev_info(dev, "stub up\n"); + ++ mutex_lock(&sdev->ud.sysfs_lock); + spin_lock_irq(&sdev->ud.lock); + + if (sdev->ud.status != SDEV_ST_AVAILABLE) { +@@ -87,13 +88,13 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a + tcp_rx = kthread_create(stub_rx_loop, &sdev->ud, "stub_rx"); + if (IS_ERR(tcp_rx)) { + sockfd_put(socket); +- return -EINVAL; ++ goto unlock_mutex; + } + tcp_tx = kthread_create(stub_tx_loop, &sdev->ud, "stub_tx"); + if (IS_ERR(tcp_tx)) { + kthread_stop(tcp_rx); + sockfd_put(socket); +- return -EINVAL; ++ goto unlock_mutex; + } + + /* get task structs now */ +@@ -112,6 +113,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a + wake_up_process(sdev->ud.tcp_rx); + wake_up_process(sdev->ud.tcp_tx); + ++ mutex_unlock(&sdev->ud.sysfs_lock); ++ + } else { + dev_info(dev, "stub down\n"); + +@@ -122,6 +125,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a + spin_unlock_irq(&sdev->ud.lock); + + usbip_event_add(&sdev->ud, SDEV_EVENT_DOWN); ++ mutex_unlock(&sdev->ud.sysfs_lock); + } + + return count; +@@ -130,6 +134,8 @@ sock_err: + sockfd_put(socket); + err: + spin_unlock_irq(&sdev->ud.lock); ++unlock_mutex: ++ mutex_unlock(&sdev->ud.sysfs_lock); + return -EINVAL; + } + static DEVICE_ATTR_WO(usbip_sockfd); +@@ -270,6 +276,7 @@ static struct stub_device *stub_device_alloc(struct usb_device *udev) + sdev->ud.side = USBIP_STUB; + sdev->ud.status = SDEV_ST_AVAILABLE; + spin_lock_init(&sdev->ud.lock); ++ mutex_init(&sdev->ud.sysfs_lock); + sdev->ud.tcp_socket = NULL; + sdev->ud.sockfd = -1; + +diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h +index 8be857a4fa132..a7e6ce96f62c7 100644 +--- a/drivers/usb/usbip/usbip_common.h ++++ b/drivers/usb/usbip/usbip_common.h +@@ -263,6 +263,9 @@ struct usbip_device { + /* lock for status */ + spinlock_t lock; + ++ /* mutex for synchronizing sysfs store paths */ ++ struct mutex sysfs_lock; ++ + int sockfd; + struct socket *tcp_socket; + +diff --git a/drivers/usb/usbip/usbip_event.c b/drivers/usb/usbip/usbip_event.c +index 5d88917c96314..086ca76dd0531 100644 +--- a/drivers/usb/usbip/usbip_event.c ++++ b/drivers/usb/usbip/usbip_event.c +@@ -70,6 +70,7 @@ static void event_handler(struct work_struct *work) + while ((ud = get_event()) != NULL) { + usbip_dbg_eh("pending event %lx\n", ud->event); + ++ mutex_lock(&ud->sysfs_lock); + /* + * NOTE: shutdown must come first. + * Shutdown the device. +@@ -90,6 +91,7 @@ static void event_handler(struct work_struct *work) + ud->eh_ops.unusable(ud); + unset_event(ud, USBIP_EH_UNUSABLE); + } ++ mutex_unlock(&ud->sysfs_lock); + + wake_up(&ud->eh_waitq); + } +diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c +index a20a8380ca0c9..4ba6bcdaa8e9d 100644 +--- a/drivers/usb/usbip/vhci_hcd.c ++++ b/drivers/usb/usbip/vhci_hcd.c +@@ -1101,6 +1101,7 @@ static void vhci_device_init(struct vhci_device *vdev) + vdev->ud.side = USBIP_VHCI; + vdev->ud.status = VDEV_ST_NULL; + spin_lock_init(&vdev->ud.lock); ++ mutex_init(&vdev->ud.sysfs_lock); + + INIT_LIST_HEAD(&vdev->priv_rx); + INIT_LIST_HEAD(&vdev->priv_tx); +diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c +index e64ea314930be..ebc7be1d98207 100644 +--- a/drivers/usb/usbip/vhci_sysfs.c ++++ b/drivers/usb/usbip/vhci_sysfs.c +@@ -185,6 +185,8 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport) + + usbip_dbg_vhci_sysfs("enter\n"); + ++ mutex_lock(&vdev->ud.sysfs_lock); ++ + /* lock */ + spin_lock_irqsave(&vhci->lock, flags); + spin_lock(&vdev->ud.lock); +@@ -195,6 +197,7 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport) + /* unlock */ + spin_unlock(&vdev->ud.lock); + spin_unlock_irqrestore(&vhci->lock, flags); ++ mutex_unlock(&vdev->ud.sysfs_lock); + + return -EINVAL; + } +@@ -205,6 +208,8 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport) + + usbip_event_add(&vdev->ud, VDEV_EVENT_DOWN); + ++ mutex_unlock(&vdev->ud.sysfs_lock); ++ + return 0; + } + +@@ -349,30 +354,36 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, + else + vdev = &vhci->vhci_hcd_hs->vdev[rhport]; + ++ mutex_lock(&vdev->ud.sysfs_lock); ++ + /* Extract socket from fd. */ + socket = sockfd_lookup(sockfd, &err); + if (!socket) { + dev_err(dev, "failed to lookup sock"); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + if (socket->type != SOCK_STREAM) { + dev_err(dev, "Expecting SOCK_STREAM - found %d", + socket->type); + sockfd_put(socket); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + + /* create threads before locking */ + tcp_rx = kthread_create(vhci_rx_loop, &vdev->ud, "vhci_rx"); + if (IS_ERR(tcp_rx)) { + sockfd_put(socket); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + tcp_tx = kthread_create(vhci_tx_loop, &vdev->ud, "vhci_tx"); + if (IS_ERR(tcp_tx)) { + kthread_stop(tcp_rx); + sockfd_put(socket); +- return -EINVAL; ++ err = -EINVAL; ++ goto unlock_mutex; + } + + /* get task structs now */ +@@ -397,7 +408,8 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, + * Will be retried from userspace + * if there's another free port. + */ +- return -EBUSY; ++ err = -EBUSY; ++ goto unlock_mutex; + } + + dev_info(dev, "pdev(%u) rhport(%u) sockfd(%d)\n", +@@ -422,7 +434,15 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, + + rh_port_connect(vdev, speed); + ++ dev_info(dev, "Device attached\n"); ++ ++ mutex_unlock(&vdev->ud.sysfs_lock); ++ + return count; ++ ++unlock_mutex: ++ mutex_unlock(&vdev->ud.sysfs_lock); ++ return err; + } + static DEVICE_ATTR_WO(attach); + +diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c +index c8eeabdd9b568..2bc428f2e2610 100644 +--- a/drivers/usb/usbip/vudc_dev.c ++++ b/drivers/usb/usbip/vudc_dev.c +@@ -572,6 +572,7 @@ static int init_vudc_hw(struct vudc *udc) + init_waitqueue_head(&udc->tx_waitq); + + spin_lock_init(&ud->lock); ++ mutex_init(&ud->sysfs_lock); + ud->status = SDEV_ST_AVAILABLE; + ud->side = USBIP_VUDC; + +diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c +index 7383a543c6d12..f7633ee655a17 100644 +--- a/drivers/usb/usbip/vudc_sysfs.c ++++ b/drivers/usb/usbip/vudc_sysfs.c +@@ -112,6 +112,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, + dev_err(dev, "no device"); + return -ENODEV; + } ++ mutex_lock(&udc->ud.sysfs_lock); + spin_lock_irqsave(&udc->lock, flags); + /* Don't export what we don't have */ + if (!udc->driver || !udc->pullup) { +@@ -187,6 +188,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, + + wake_up_process(udc->ud.tcp_rx); + wake_up_process(udc->ud.tcp_tx); ++ ++ mutex_unlock(&udc->ud.sysfs_lock); + return count; + + } else { +@@ -207,6 +210,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, + } + + spin_unlock_irqrestore(&udc->lock, flags); ++ mutex_unlock(&udc->ud.sysfs_lock); + + return count; + +@@ -216,6 +220,7 @@ unlock_ud: + spin_unlock_irq(&udc->ud.lock); + unlock: + spin_unlock_irqrestore(&udc->lock, flags); ++ mutex_unlock(&udc->ud.sysfs_lock); + + return ret; + } +diff --git a/drivers/vdpa/mlx5/core/mlx5_vdpa.h b/drivers/vdpa/mlx5/core/mlx5_vdpa.h +index 08f742fd24099..b6cc53ba980cc 100644 +--- a/drivers/vdpa/mlx5/core/mlx5_vdpa.h ++++ b/drivers/vdpa/mlx5/core/mlx5_vdpa.h +@@ -4,9 +4,13 @@ + #ifndef __MLX5_VDPA_H__ + #define __MLX5_VDPA_H__ + ++#include ++#include + #include + #include + ++#define MLX5V_ETH_HARD_MTU (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN) ++ + struct mlx5_vdpa_direct_mr { + u64 start; + u64 end; +diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c +index 25fd971be63f7..ac6be2d722bb2 100644 +--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c ++++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c +@@ -820,7 +820,7 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque + MLX5_SET(virtio_q, vq_ctx, event_qpn_or_msix, mvq->fwqp.mqp.qpn); + MLX5_SET(virtio_q, vq_ctx, queue_size, mvq->num_ent); + MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, +- !!(ndev->mvdev.actual_features & VIRTIO_F_VERSION_1)); ++ !!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_F_VERSION_1))); + MLX5_SET64(virtio_q, vq_ctx, desc_addr, mvq->desc_addr); + MLX5_SET64(virtio_q, vq_ctx, used_addr, mvq->device_addr); + MLX5_SET64(virtio_q, vq_ctx, available_addr, mvq->driver_addr); +@@ -1169,6 +1169,7 @@ static void suspend_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *m + return; + } + mvq->avail_idx = attr.available_index; ++ mvq->used_idx = attr.used_index; + } + + static void suspend_vqs(struct mlx5_vdpa_net *ndev) +@@ -1426,6 +1427,7 @@ static int mlx5_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx, + return -EINVAL; + } + ++ mvq->used_idx = state->avail_index; + mvq->avail_idx = state->avail_index; + return 0; + } +@@ -1443,7 +1445,11 @@ static int mlx5_vdpa_get_vq_state(struct vdpa_device *vdev, u16 idx, struct vdpa + * that cares about emulating the index after vq is stopped. + */ + if (!mvq->initialized) { +- state->avail_index = mvq->avail_idx; ++ /* Firmware returns a wrong value for the available index. ++ * Since both values should be identical, we take the value of ++ * used_idx which is reported correctly. ++ */ ++ state->avail_index = mvq->used_idx; + return 0; + } + +@@ -1452,7 +1458,7 @@ static int mlx5_vdpa_get_vq_state(struct vdpa_device *vdev, u16 idx, struct vdpa + mlx5_vdpa_warn(mvdev, "failed to query virtqueue\n"); + return err; + } +- state->avail_index = attr.available_index; ++ state->avail_index = attr.used_index; + return 0; + } + +@@ -1540,21 +1546,11 @@ static void teardown_virtqueues(struct mlx5_vdpa_net *ndev) + } + } + +-static void clear_virtqueues(struct mlx5_vdpa_net *ndev) +-{ +- int i; +- +- for (i = ndev->mvdev.max_vqs - 1; i >= 0; i--) { +- ndev->vqs[i].avail_idx = 0; +- ndev->vqs[i].used_idx = 0; +- } +-} +- + /* TODO: cross-endian support */ + static inline bool mlx5_vdpa_is_little_endian(struct mlx5_vdpa_dev *mvdev) + { + return virtio_legacy_is_little_endian() || +- (mvdev->actual_features & (1ULL << VIRTIO_F_VERSION_1)); ++ (mvdev->actual_features & BIT_ULL(VIRTIO_F_VERSION_1)); + } + + static __virtio16 cpu_to_mlx5vdpa16(struct mlx5_vdpa_dev *mvdev, u16 val) +@@ -1785,7 +1781,6 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) + if (!status) { + mlx5_vdpa_info(mvdev, "performing device reset\n"); + teardown_driver(ndev); +- clear_virtqueues(ndev); + mlx5_vdpa_destroy_mr(&ndev->mvdev); + ndev->mvdev.status = 0; + ndev->mvdev.mlx_features = 0; +@@ -1907,6 +1902,19 @@ static const struct vdpa_config_ops mlx5_vdpa_ops = { + .free = mlx5_vdpa_free, + }; + ++static int query_mtu(struct mlx5_core_dev *mdev, u16 *mtu) ++{ ++ u16 hw_mtu; ++ int err; ++ ++ err = mlx5_query_nic_vport_mtu(mdev, &hw_mtu); ++ if (err) ++ return err; ++ ++ *mtu = hw_mtu - MLX5V_ETH_HARD_MTU; ++ return 0; ++} ++ + static int alloc_resources(struct mlx5_vdpa_net *ndev) + { + struct mlx5_vdpa_net_resources *res = &ndev->res; +@@ -1992,7 +2000,7 @@ static int mlx5v_probe(struct auxiliary_device *adev, + init_mvqs(ndev); + mutex_init(&ndev->reslock); + config = &ndev->config; +- err = mlx5_query_nic_vport_mtu(mdev, &ndev->mtu); ++ err = query_mtu(mdev, &ndev->mtu); + if (err) + goto err_mtu; + +diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c +index d9148609bd09a..1664edcdffd11 100644 +--- a/drivers/xen/events/events_base.c ++++ b/drivers/xen/events/events_base.c +@@ -109,7 +109,7 @@ struct irq_info { + unsigned short eoi_cpu; /* EOI must happen on this cpu-1 */ + unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */ + u64 eoi_time; /* Time in jiffies when to EOI. */ +- spinlock_t lock; ++ raw_spinlock_t lock; + + union { + unsigned short virq; +@@ -310,7 +310,7 @@ static int xen_irq_info_common_setup(struct irq_info *info, + info->evtchn = evtchn; + info->cpu = cpu; + info->mask_reason = EVT_MASK_REASON_EXPLICIT; +- spin_lock_init(&info->lock); ++ raw_spin_lock_init(&info->lock); + + ret = set_evtchn_to_irq(evtchn, irq); + if (ret < 0) +@@ -463,28 +463,28 @@ static void do_mask(struct irq_info *info, u8 reason) + { + unsigned long flags; + +- spin_lock_irqsave(&info->lock, flags); ++ raw_spin_lock_irqsave(&info->lock, flags); + + if (!info->mask_reason) + mask_evtchn(info->evtchn); + + info->mask_reason |= reason; + +- spin_unlock_irqrestore(&info->lock, flags); ++ raw_spin_unlock_irqrestore(&info->lock, flags); + } + + static void do_unmask(struct irq_info *info, u8 reason) + { + unsigned long flags; + +- spin_lock_irqsave(&info->lock, flags); ++ raw_spin_lock_irqsave(&info->lock, flags); + + info->mask_reason &= ~reason; + + if (!info->mask_reason) + unmask_evtchn(info->evtchn); + +- spin_unlock_irqrestore(&info->lock, flags); ++ raw_spin_unlock_irqrestore(&info->lock, flags); + } + + #ifdef CONFIG_X86 +diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig +index fe03cbdae9592..bf52e9326ebe8 100644 +--- a/fs/cifs/Kconfig ++++ b/fs/cifs/Kconfig +@@ -18,6 +18,7 @@ config CIFS + select CRYPTO_AES + select CRYPTO_LIB_DES + select KEYS ++ select DNS_RESOLVER + help + This is the client VFS module for the SMB3 family of NAS protocols, + (including support for the most recent, most secure dialect SMB3.1.1) +@@ -112,7 +113,6 @@ config CIFS_WEAK_PW_HASH + config CIFS_UPCALL + bool "Kerberos/SPNEGO advanced session setup" + depends on CIFS +- select DNS_RESOLVER + help + Enables an upcall mechanism for CIFS which accesses userspace helper + utilities to provide SPNEGO packaged (RFC 4178) Kerberos tickets +@@ -179,7 +179,6 @@ config CIFS_DEBUG_DUMP_KEYS + config CIFS_DFS_UPCALL + bool "DFS feature support" + depends on CIFS +- select DNS_RESOLVER + help + Distributed File System (DFS) support is used to access shares + transparently in an enterprise name space, even if the share +diff --git a/fs/cifs/Makefile b/fs/cifs/Makefile +index 5213b20843b50..3ee3b7de4dedf 100644 +--- a/fs/cifs/Makefile ++++ b/fs/cifs/Makefile +@@ -10,13 +10,14 @@ cifs-y := trace.o cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o \ + cifs_unicode.o nterr.o cifsencrypt.o \ + readdir.o ioctl.o sess.o export.o smb1ops.o unc.o winucase.o \ + smb2ops.o smb2maperror.o smb2transport.o \ +- smb2misc.o smb2pdu.o smb2inode.o smb2file.o cifsacl.o fs_context.o ++ smb2misc.o smb2pdu.o smb2inode.o smb2file.o cifsacl.o fs_context.o \ ++ dns_resolve.o + + cifs-$(CONFIG_CIFS_XATTR) += xattr.o + + cifs-$(CONFIG_CIFS_UPCALL) += cifs_spnego.o + +-cifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o cifs_dfs_ref.o dfs_cache.o ++cifs-$(CONFIG_CIFS_DFS_UPCALL) += cifs_dfs_ref.o dfs_cache.o + + cifs-$(CONFIG_CIFS_SWN_UPCALL) += netlink.o cifs_swn.o + +diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c +index 8a6a1772590bf..8fc877fb369e7 100644 +--- a/fs/cifs/cifsfs.c ++++ b/fs/cifs/cifsfs.c +@@ -475,7 +475,8 @@ static int cifs_show_devname(struct seq_file *m, struct dentry *root) + seq_puts(m, "none"); + else { + convert_delimiter(devname, '/'); +- seq_puts(m, devname); ++ /* escape all spaces in share names */ ++ seq_escape(m, devname, " \t"); + kfree(devname); + } + return 0; +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c +index 70d0f0388af47..2b72b8893affa 100644 +--- a/fs/cifs/connect.c ++++ b/fs/cifs/connect.c +@@ -87,7 +87,6 @@ static void cifs_prune_tlinks(struct work_struct *work); + * + * This should be called with server->srv_mutex held. + */ +-#ifdef CONFIG_CIFS_DFS_UPCALL + static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server) + { + int rc; +@@ -124,6 +123,7 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server) + return !rc ? -1 : 0; + } + ++#ifdef CONFIG_CIFS_DFS_UPCALL + /* These functions must be called with server->srv_mutex held */ + static void reconn_set_next_dfs_target(struct TCP_Server_Info *server, + struct cifs_sb_info *cifs_sb, +@@ -321,14 +321,29 @@ cifs_reconnect(struct TCP_Server_Info *server) + #endif + + #ifdef CONFIG_CIFS_DFS_UPCALL ++ if (cifs_sb && cifs_sb->origin_fullpath) + /* + * Set up next DFS target server (if any) for reconnect. If DFS + * feature is disabled, then we will retry last server we + * connected to before. + */ + reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it); ++ else { ++#endif ++ /* ++ * Resolve the hostname again to make sure that IP address is up-to-date. ++ */ ++ rc = reconn_set_ipaddr_from_hostname(server); ++ if (rc) { ++ cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n", ++ __func__, rc); ++ } ++ ++#ifdef CONFIG_CIFS_DFS_UPCALL ++ } + #endif + ++ + #ifdef CONFIG_CIFS_SWN_UPCALL + } + #endif +diff --git a/fs/direct-io.c b/fs/direct-io.c +index d53fa92a1ab65..c64d4eb38995a 100644 +--- a/fs/direct-io.c ++++ b/fs/direct-io.c +@@ -810,6 +810,7 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page, + struct buffer_head *map_bh) + { + int ret = 0; ++ int boundary = sdio->boundary; /* dio_send_cur_page may clear it */ + + if (dio->op == REQ_OP_WRITE) { + /* +@@ -848,10 +849,10 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page, + sdio->cur_page_fs_offset = sdio->block_in_file << sdio->blkbits; + out: + /* +- * If sdio->boundary then we want to schedule the IO now to ++ * If boundary then we want to schedule the IO now to + * avoid metadata seeks. + */ +- if (sdio->boundary) { ++ if (boundary) { + ret = dio_send_cur_page(dio, sdio, map_bh); + if (sdio->bio) + dio_bio_submit(dio, sdio); +diff --git a/fs/file.c b/fs/file.c +index f3a4bac2cbe91..f633348029a5a 100644 +--- a/fs/file.c ++++ b/fs/file.c +@@ -629,17 +629,30 @@ int close_fd(unsigned fd) + } + EXPORT_SYMBOL(close_fd); /* for ksys_close() */ + ++/** ++ * last_fd - return last valid index into fd table ++ * @cur_fds: files struct ++ * ++ * Context: Either rcu read lock or files_lock must be held. ++ * ++ * Returns: Last valid index into fdtable. ++ */ ++static inline unsigned last_fd(struct fdtable *fdt) ++{ ++ return fdt->max_fds - 1; ++} ++ + static inline void __range_cloexec(struct files_struct *cur_fds, + unsigned int fd, unsigned int max_fd) + { + struct fdtable *fdt; + +- if (fd > max_fd) +- return; +- ++ /* make sure we're using the correct maximum value */ + spin_lock(&cur_fds->file_lock); + fdt = files_fdtable(cur_fds); +- bitmap_set(fdt->close_on_exec, fd, max_fd - fd + 1); ++ max_fd = min(last_fd(fdt), max_fd); ++ if (fd <= max_fd) ++ bitmap_set(fdt->close_on_exec, fd, max_fd - fd + 1); + spin_unlock(&cur_fds->file_lock); + } + +diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c +index aea35459d3903..07467ca0f71d3 100644 +--- a/fs/hostfs/hostfs_kern.c ++++ b/fs/hostfs/hostfs_kern.c +@@ -142,7 +142,7 @@ static char *follow_link(char *link) + char *name, *resolved, *end; + int n; + +- name = __getname(); ++ name = kmalloc(PATH_MAX, GFP_KERNEL); + if (!name) { + n = -ENOMEM; + goto out_free; +@@ -171,12 +171,11 @@ static char *follow_link(char *link) + goto out_free; + } + +- __putname(name); +- kfree(link); ++ kfree(name); + return resolved; + + out_free: +- __putname(name); ++ kfree(name); + return ERR_PTR(n); + } + +diff --git a/fs/namei.c b/fs/namei.c +index dd85e12ac85a6..b7c0dcc25bd48 100644 +--- a/fs/namei.c ++++ b/fs/namei.c +@@ -2330,16 +2330,16 @@ static int path_lookupat(struct nameidata *nd, unsigned flags, struct path *path + while (!(err = link_path_walk(s, nd)) && + (s = lookup_last(nd)) != NULL) + ; ++ if (!err && unlikely(nd->flags & LOOKUP_MOUNTPOINT)) { ++ err = handle_lookup_down(nd); ++ nd->flags &= ~LOOKUP_JUMPED; // no d_weak_revalidate(), please... ++ } + if (!err) + err = complete_walk(nd); + + if (!err && nd->flags & LOOKUP_DIRECTORY) + if (!d_can_lookup(nd->path.dentry)) + err = -ENOTDIR; +- if (!err && unlikely(nd->flags & LOOKUP_MOUNTPOINT)) { +- err = handle_lookup_down(nd); +- nd->flags &= ~LOOKUP_JUMPED; // no d_weak_revalidate(), please... +- } + if (!err) { + *path = nd->path; + nd->path.mnt = NULL; +diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c +index 3bfb4147895a0..ad20403b383fa 100644 +--- a/fs/ocfs2/aops.c ++++ b/fs/ocfs2/aops.c +@@ -2295,7 +2295,7 @@ static int ocfs2_dio_end_io_write(struct inode *inode, + struct ocfs2_alloc_context *meta_ac = NULL; + handle_t *handle = NULL; + loff_t end = offset + bytes; +- int ret = 0, credits = 0, locked = 0; ++ int ret = 0, credits = 0; + + ocfs2_init_dealloc_ctxt(&dealloc); + +@@ -2306,13 +2306,6 @@ static int ocfs2_dio_end_io_write(struct inode *inode, + !dwc->dw_orphaned) + goto out; + +- /* ocfs2_file_write_iter will get i_mutex, so we need not lock if we +- * are in that context. */ +- if (dwc->dw_writer_pid != task_pid_nr(current)) { +- inode_lock(inode); +- locked = 1; +- } +- + ret = ocfs2_inode_lock(inode, &di_bh, 1); + if (ret < 0) { + mlog_errno(ret); +@@ -2393,8 +2386,6 @@ out: + if (meta_ac) + ocfs2_free_alloc_context(meta_ac); + ocfs2_run_deallocs(osb, &dealloc); +- if (locked) +- inode_unlock(inode); + ocfs2_dio_free_write_ctx(inode, dwc); + + return ret; +diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c +index 85979e2214b39..8880071ee4ee0 100644 +--- a/fs/ocfs2/file.c ++++ b/fs/ocfs2/file.c +@@ -1244,22 +1244,24 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) + goto bail_unlock; + } + } ++ down_write(&OCFS2_I(inode)->ip_alloc_sem); + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS + + 2 * ocfs2_quota_trans_credits(sb)); + if (IS_ERR(handle)) { + status = PTR_ERR(handle); + mlog_errno(status); +- goto bail_unlock; ++ goto bail_unlock_alloc; + } + status = __dquot_transfer(inode, transfer_to); + if (status < 0) + goto bail_commit; + } else { ++ down_write(&OCFS2_I(inode)->ip_alloc_sem); + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); + if (IS_ERR(handle)) { + status = PTR_ERR(handle); + mlog_errno(status); +- goto bail_unlock; ++ goto bail_unlock_alloc; + } + } + +@@ -1272,6 +1274,8 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) + + bail_commit: + ocfs2_commit_trans(osb, handle); ++bail_unlock_alloc: ++ up_write(&OCFS2_I(inode)->ip_alloc_sem); + bail_unlock: + if (status && inode_locked) { + ocfs2_inode_unlock_tracker(inode, 1, &oh, had_lock); +diff --git a/include/linux/avf/virtchnl.h b/include/linux/avf/virtchnl.h +index 40bad71865ea7..532bcbfc47161 100644 +--- a/include/linux/avf/virtchnl.h ++++ b/include/linux/avf/virtchnl.h +@@ -476,7 +476,6 @@ struct virtchnl_rss_key { + u16 vsi_id; + u16 key_len; + u8 key[1]; /* RSS hash key, packed bytes */ +- u8 pad[1]; + }; + + VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_key); +@@ -485,7 +484,6 @@ struct virtchnl_rss_lut { + u16 vsi_id; + u16 lut_entries; + u8 lut[1]; /* RSS lookup table */ +- u8 pad[1]; + }; + + VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_lut); +diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h +index 442c0160caab5..6370ba10f1fd2 100644 +--- a/include/linux/mlx5/mlx5_ifc.h ++++ b/include/linux/mlx5/mlx5_ifc.h +@@ -437,11 +437,11 @@ struct mlx5_ifc_flow_table_prop_layout_bits { + u8 reserved_at_60[0x18]; + u8 log_max_ft_num[0x8]; + +- u8 reserved_at_80[0x18]; ++ u8 reserved_at_80[0x10]; ++ u8 log_max_flow_counter[0x8]; + u8 log_max_destination[0x8]; + +- u8 log_max_flow_counter[0x8]; +- u8 reserved_at_a8[0x10]; ++ u8 reserved_at_a0[0x18]; + u8 log_max_flow[0x8]; + + u8 reserved_at_c0[0x40]; +@@ -8769,6 +8769,8 @@ struct mlx5_ifc_pplm_reg_bits { + + u8 fec_override_admin_100g_2x[0x10]; + u8 fec_override_admin_50g_1x[0x10]; ++ ++ u8 reserved_at_140[0x140]; + }; + + struct mlx5_ifc_ppcnt_reg_bits { +@@ -10106,7 +10108,7 @@ struct mlx5_ifc_pbmc_reg_bits { + + struct mlx5_ifc_bufferx_reg_bits buffer[10]; + +- u8 reserved_at_2e0[0x40]; ++ u8 reserved_at_2e0[0x80]; + }; + + struct mlx5_ifc_qtct_reg_bits { +diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h +index fec0c5ac1c4f9..82126d5297986 100644 +--- a/include/linux/skmsg.h ++++ b/include/linux/skmsg.h +@@ -349,8 +349,13 @@ static inline void sk_psock_update_proto(struct sock *sk, + static inline void sk_psock_restore_proto(struct sock *sk, + struct sk_psock *psock) + { +- sk->sk_prot->unhash = psock->saved_unhash; + if (inet_csk_has_ulp(sk)) { ++ /* TLS does not have an unhash proto in SW cases, but we need ++ * to ensure we stop using the sock_map unhash routine because ++ * the associated psock is being removed. So use the original ++ * unhash handler. ++ */ ++ WRITE_ONCE(sk->sk_prot->unhash, psock->saved_unhash); + tcp_update_ulp(sk, psock->sk_proto, psock->saved_write_space); + } else { + sk->sk_write_space = psock->saved_write_space; +diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h +index 6b5fcfa1e5553..98775d7fa6963 100644 +--- a/include/linux/virtio_net.h ++++ b/include/linux/virtio_net.h +@@ -62,6 +62,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, + return -EINVAL; + } + ++ skb_reset_mac_header(skb); ++ + if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { + u16 start = __virtio16_to_cpu(little_endian, hdr->csum_start); + u16 off = __virtio16_to_cpu(little_endian, hdr->csum_offset); +diff --git a/include/net/act_api.h b/include/net/act_api.h +index 2bf3092ae7ecc..086b291e9530b 100644 +--- a/include/net/act_api.h ++++ b/include/net/act_api.h +@@ -170,12 +170,7 @@ void tcf_idr_insert_many(struct tc_action *actions[]); + void tcf_idr_cleanup(struct tc_action_net *tn, u32 index); + int tcf_idr_check_alloc(struct tc_action_net *tn, u32 *index, + struct tc_action **a, int bind); +-int __tcf_idr_release(struct tc_action *a, bool bind, bool strict); +- +-static inline int tcf_idr_release(struct tc_action *a, bool bind) +-{ +- return __tcf_idr_release(a, bind, false); +-} ++int tcf_idr_release(struct tc_action *a, bool bind); + + int tcf_register_action(struct tc_action_ops *a, struct pernet_operations *ops); + int tcf_unregister_action(struct tc_action_ops *a, +@@ -185,7 +180,7 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions, + int nr_actions, struct tcf_result *res); + int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, + struct nlattr *est, char *name, int ovr, int bind, +- struct tc_action *actions[], size_t *attr_size, ++ struct tc_action *actions[], int init_res[], size_t *attr_size, + bool rtnl_held, struct netlink_ext_ack *extack); + struct tc_action_ops *tc_action_load_ops(char *name, struct nlattr *nla, + bool rtnl_held, +@@ -193,7 +188,8 @@ struct tc_action_ops *tc_action_load_ops(char *name, struct nlattr *nla, + struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, + struct nlattr *nla, struct nlattr *est, + char *name, int ovr, int bind, +- struct tc_action_ops *ops, bool rtnl_held, ++ struct tc_action_ops *a_o, int *init_res, ++ bool rtnl_held, + struct netlink_ext_ack *extack); + int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[], int bind, + int ref, bool terse); +diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h +index 59f45b1e9dac0..b59d73d529ba7 100644 +--- a/include/net/netns/xfrm.h ++++ b/include/net/netns/xfrm.h +@@ -72,7 +72,9 @@ struct netns_xfrm { + #if IS_ENABLED(CONFIG_IPV6) + struct dst_ops xfrm6_dst_ops; + #endif +- spinlock_t xfrm_state_lock; ++ spinlock_t xfrm_state_lock; ++ seqcount_t xfrm_state_hash_generation; ++ + spinlock_t xfrm_policy_lock; + struct mutex xfrm_cfg_mutex; + }; +diff --git a/include/net/red.h b/include/net/red.h +index 9e6647c4ccd1f..cc9f6b0d7f1e9 100644 +--- a/include/net/red.h ++++ b/include/net/red.h +@@ -171,9 +171,9 @@ static inline void red_set_vars(struct red_vars *v) + static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog, + u8 Scell_log, u8 *stab) + { +- if (fls(qth_min) + Wlog > 32) ++ if (fls(qth_min) + Wlog >= 32) + return false; +- if (fls(qth_max) + Wlog > 32) ++ if (fls(qth_max) + Wlog >= 32) + return false; + if (Scell_log >= 32) + return false; +diff --git a/include/net/sock.h b/include/net/sock.h +index 129d200bccb46..6f44084104626 100644 +--- a/include/net/sock.h ++++ b/include/net/sock.h +@@ -2215,6 +2215,15 @@ static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk) + sk_mem_charge(sk, skb->truesize); + } + ++static inline void skb_set_owner_sk_safe(struct sk_buff *skb, struct sock *sk) ++{ ++ if (sk && refcount_inc_not_zero(&sk->sk_refcnt)) { ++ skb_orphan(skb); ++ skb->destructor = sock_efree; ++ skb->sk = sk; ++ } ++} ++ + void sk_reset_timer(struct sock *sk, struct timer_list *timer, + unsigned long expires); + +diff --git a/include/net/xfrm.h b/include/net/xfrm.h +index b2a06f10b62ce..c58a6d4eb6103 100644 +--- a/include/net/xfrm.h ++++ b/include/net/xfrm.h +@@ -1097,7 +1097,7 @@ static inline int __xfrm_policy_check2(struct sock *sk, int dir, + return __xfrm_policy_check(sk, ndir, skb, family); + + return (!net->xfrm.policy_count[dir] && !secpath_exists(skb)) || +- (skb_dst(skb)->flags & DST_NOPOLICY) || ++ (skb_dst(skb) && (skb_dst(skb)->flags & DST_NOPOLICY)) || + __xfrm_policy_check(sk, ndir, skb, family); + } + +@@ -1557,7 +1557,7 @@ int xfrm_trans_queue_net(struct net *net, struct sk_buff *skb, + int xfrm_trans_queue(struct sk_buff *skb, + int (*finish)(struct net *, struct sock *, + struct sk_buff *)); +-int xfrm_output_resume(struct sk_buff *skb, int err); ++int xfrm_output_resume(struct sock *sk, struct sk_buff *skb, int err); + int xfrm_output(struct sock *sk, struct sk_buff *skb); + + #if IS_ENABLED(CONFIG_NET_PKTGEN) +diff --git a/include/uapi/linux/can.h b/include/uapi/linux/can.h +index f75238ac6dced..c7535352fef64 100644 +--- a/include/uapi/linux/can.h ++++ b/include/uapi/linux/can.h +@@ -113,7 +113,7 @@ struct can_frame { + */ + __u8 len; + __u8 can_dlc; /* deprecated */ +- }; ++ } __attribute__((packed)); /* disable padding added in some ABIs */ + __u8 __pad; /* padding */ + __u8 __res0; /* reserved / padding */ + __u8 len8_dlc; /* optional DLC for 8 byte payload length (9 .. 15) */ +diff --git a/include/uapi/linux/rfkill.h b/include/uapi/linux/rfkill.h +index 03e8af87b364c..9b77cfc42efa3 100644 +--- a/include/uapi/linux/rfkill.h ++++ b/include/uapi/linux/rfkill.h +@@ -86,34 +86,90 @@ enum rfkill_hard_block_reasons { + * @op: operation code + * @hard: hard state (0/1) + * @soft: soft state (0/1) ++ * ++ * Structure used for userspace communication on /dev/rfkill, ++ * used for events from the kernel and control to the kernel. ++ */ ++struct rfkill_event { ++ __u32 idx; ++ __u8 type; ++ __u8 op; ++ __u8 soft; ++ __u8 hard; ++} __attribute__((packed)); ++ ++/** ++ * struct rfkill_event_ext - events for userspace on /dev/rfkill ++ * @idx: index of dev rfkill ++ * @type: type of the rfkill struct ++ * @op: operation code ++ * @hard: hard state (0/1) ++ * @soft: soft state (0/1) + * @hard_block_reasons: valid if hard is set. One or several reasons from + * &enum rfkill_hard_block_reasons. + * + * Structure used for userspace communication on /dev/rfkill, + * used for events from the kernel and control to the kernel. ++ * ++ * See the extensibility docs below. + */ +-struct rfkill_event { ++struct rfkill_event_ext { + __u32 idx; + __u8 type; + __u8 op; + __u8 soft; + __u8 hard; ++ ++ /* ++ * older kernels will accept/send only up to this point, ++ * and if extended further up to any chunk marked below ++ */ ++ + __u8 hard_block_reasons; + } __attribute__((packed)); + +-/* +- * We are planning to be backward and forward compatible with changes +- * to the event struct, by adding new, optional, members at the end. +- * When reading an event (whether the kernel from userspace or vice +- * versa) we need to accept anything that's at least as large as the +- * version 1 event size, but might be able to accept other sizes in +- * the future. ++/** ++ * DOC: Extensibility ++ * ++ * Originally, we had planned to allow backward and forward compatible ++ * changes by just adding fields at the end of the structure that are ++ * then not reported on older kernels on read(), and not written to by ++ * older kernels on write(), with the kernel reporting the size it did ++ * accept as the result. ++ * ++ * This would have allowed userspace to detect on read() and write() ++ * which kernel structure version it was dealing with, and if was just ++ * recompiled it would have gotten the new fields, but obviously not ++ * accessed them, but things should've continued to work. ++ * ++ * Unfortunately, while actually exercising this mechanism to add the ++ * hard block reasons field, we found that userspace (notably systemd) ++ * did all kinds of fun things not in line with this scheme: ++ * ++ * 1. treat the (expected) short writes as an error; ++ * 2. ask to read sizeof(struct rfkill_event) but then compare the ++ * actual return value to RFKILL_EVENT_SIZE_V1 and treat any ++ * mismatch as an error. ++ * ++ * As a consequence, just recompiling with a new struct version caused ++ * things to no longer work correctly on old and new kernels. ++ * ++ * Hence, we've rolled back &struct rfkill_event to the original version ++ * and added &struct rfkill_event_ext. This effectively reverts to the ++ * old behaviour for all userspace, unless it explicitly opts in to the ++ * rules outlined here by using the new &struct rfkill_event_ext. ++ * ++ * Userspace using &struct rfkill_event_ext must adhere to the following ++ * rules + * +- * One exception is the kernel -- we already have two event sizes in +- * that we've made the 'hard' member optional since our only option +- * is to ignore it anyway. ++ * 1. accept short writes, optionally using them to detect that it's ++ * running on an older kernel; ++ * 2. accept short reads, knowing that this means it's running on an ++ * older kernel; ++ * 3. treat reads that are as long as requested as acceptable, not ++ * checking against RFKILL_EVENT_SIZE_V1 or such. + */ +-#define RFKILL_EVENT_SIZE_V1 8 ++#define RFKILL_EVENT_SIZE_V1 sizeof(struct rfkill_event) + + /* ioctl for turning off rfkill-input (if present) */ + #define RFKILL_IOC_MAGIC 'R' +diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c +index dd4b7fd60ee7d..6b14b4c4068cc 100644 +--- a/kernel/bpf/inode.c ++++ b/kernel/bpf/inode.c +@@ -546,7 +546,7 @@ int bpf_obj_get_user(const char __user *pathname, int flags) + else if (type == BPF_TYPE_MAP) + ret = bpf_map_new_fd(raw, f_flags); + else if (type == BPF_TYPE_LINK) +- ret = bpf_link_new_fd(raw); ++ ret = (f_flags != O_RDWR) ? -EINVAL : bpf_link_new_fd(raw); + else + return -ENOENT; + +diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c +index bfafbf115bf30..e274a33194319 100644 +--- a/kernel/bpf/stackmap.c ++++ b/kernel/bpf/stackmap.c +@@ -652,9 +652,17 @@ const struct bpf_func_proto bpf_get_stack_proto = { + BPF_CALL_4(bpf_get_task_stack, struct task_struct *, task, void *, buf, + u32, size, u64, flags) + { +- struct pt_regs *regs = task_pt_regs(task); ++ struct pt_regs *regs; ++ long res; + +- return __bpf_get_stack(regs, task, NULL, buf, size, flags); ++ if (!try_get_task_stack(task)) ++ return -EFAULT; ++ ++ regs = task_pt_regs(task); ++ res = __bpf_get_stack(regs, task, NULL, buf, size, flags); ++ put_task_stack(task); ++ ++ return res; + } + + BTF_ID_LIST_SINGLE(bpf_get_task_stack_btf_ids, struct, task_struct) +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c +index 5b233e911c2c2..36b81975d9cda 100644 +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -11570,6 +11570,11 @@ static int check_struct_ops_btf_id(struct bpf_verifier_env *env) + u32 btf_id, member_idx; + const char *mname; + ++ if (!prog->gpl_compatible) { ++ verbose(env, "struct ops programs must have a GPL compatible license\n"); ++ return -EINVAL; ++ } ++ + btf_id = prog->aux->attach_btf_id; + st_ops = bpf_struct_ops_find(btf_id); + if (!st_ops) { +diff --git a/kernel/gcov/clang.c b/kernel/gcov/clang.c +index 8743150db2acc..c466c7fbdece5 100644 +--- a/kernel/gcov/clang.c ++++ b/kernel/gcov/clang.c +@@ -70,7 +70,9 @@ struct gcov_fn_info { + + u32 ident; + u32 checksum; ++#if CONFIG_CLANG_VERSION < 110000 + u8 use_extra_checksum; ++#endif + u32 cfg_checksum; + + u32 num_counters; +@@ -145,10 +147,8 @@ void llvm_gcda_emit_function(u32 ident, const char *function_name, + + list_add_tail(&info->head, ¤t_info->functions); + } +-EXPORT_SYMBOL(llvm_gcda_emit_function); + #else +-void llvm_gcda_emit_function(u32 ident, u32 func_checksum, +- u8 use_extra_checksum, u32 cfg_checksum) ++void llvm_gcda_emit_function(u32 ident, u32 func_checksum, u32 cfg_checksum) + { + struct gcov_fn_info *info = kzalloc(sizeof(*info), GFP_KERNEL); + +@@ -158,12 +158,11 @@ void llvm_gcda_emit_function(u32 ident, u32 func_checksum, + INIT_LIST_HEAD(&info->head); + info->ident = ident; + info->checksum = func_checksum; +- info->use_extra_checksum = use_extra_checksum; + info->cfg_checksum = cfg_checksum; + list_add_tail(&info->head, ¤t_info->functions); + } +-EXPORT_SYMBOL(llvm_gcda_emit_function); + #endif ++EXPORT_SYMBOL(llvm_gcda_emit_function); + + void llvm_gcda_emit_arcs(u32 num_counters, u64 *counters) + { +@@ -293,11 +292,16 @@ int gcov_info_is_compatible(struct gcov_info *info1, struct gcov_info *info2) + !list_is_last(&fn_ptr2->head, &info2->functions)) { + if (fn_ptr1->checksum != fn_ptr2->checksum) + return false; ++#if CONFIG_CLANG_VERSION < 110000 + if (fn_ptr1->use_extra_checksum != fn_ptr2->use_extra_checksum) + return false; + if (fn_ptr1->use_extra_checksum && + fn_ptr1->cfg_checksum != fn_ptr2->cfg_checksum) + return false; ++#else ++ if (fn_ptr1->cfg_checksum != fn_ptr2->cfg_checksum) ++ return false; ++#endif + fn_ptr1 = list_next_entry(fn_ptr1, head); + fn_ptr2 = list_next_entry(fn_ptr2, head); + } +@@ -529,17 +533,22 @@ static size_t convert_to_gcda(char *buffer, struct gcov_info *info) + + list_for_each_entry(fi_ptr, &info->functions, head) { + u32 i; +- u32 len = 2; +- +- if (fi_ptr->use_extra_checksum) +- len++; + + pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION); +- pos += store_gcov_u32(buffer, pos, len); ++#if CONFIG_CLANG_VERSION < 110000 ++ pos += store_gcov_u32(buffer, pos, ++ fi_ptr->use_extra_checksum ? 3 : 2); ++#else ++ pos += store_gcov_u32(buffer, pos, 3); ++#endif + pos += store_gcov_u32(buffer, pos, fi_ptr->ident); + pos += store_gcov_u32(buffer, pos, fi_ptr->checksum); ++#if CONFIG_CLANG_VERSION < 110000 + if (fi_ptr->use_extra_checksum) + pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); ++#else ++ pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); ++#endif + + pos += store_gcov_u32(buffer, pos, GCOV_TAG_COUNTER_BASE); + pos += store_gcov_u32(buffer, pos, fi_ptr->num_counters * 2); +diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c +index 780012eb2f3fe..eead7efbe7e5d 100644 +--- a/kernel/locking/lockdep.c ++++ b/kernel/locking/lockdep.c +@@ -705,7 +705,7 @@ static void print_lock_name(struct lock_class *class) + + printk(KERN_CONT " ("); + __print_lock_name(class); +- printk(KERN_CONT "){%s}-{%hd:%hd}", usage, ++ printk(KERN_CONT "){%s}-{%d:%d}", usage, + class->wait_type_outer ?: class->wait_type_inner, + class->wait_type_inner); + } +diff --git a/kernel/workqueue.c b/kernel/workqueue.c +index 894bb885b40b1..6326a872510b3 100644 +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -1412,7 +1412,6 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, + */ + lockdep_assert_irqs_disabled(); + +- debug_work_activate(work); + + /* if draining, only works from the same workqueue are allowed */ + if (unlikely(wq->flags & __WQ_DRAINING) && +@@ -1494,6 +1493,7 @@ retry: + worklist = &pwq->delayed_works; + } + ++ debug_work_activate(work); + insert_work(pwq, work, worklist, work_flags); + + out: +diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h +index 18b768ac7dcae..095d7eaa0db42 100644 +--- a/mm/percpu-internal.h ++++ b/mm/percpu-internal.h +@@ -87,7 +87,7 @@ extern spinlock_t pcpu_lock; + + extern struct list_head *pcpu_chunk_lists; + extern int pcpu_nr_slots; +-extern int pcpu_nr_empty_pop_pages; ++extern int pcpu_nr_empty_pop_pages[]; + + extern struct pcpu_chunk *pcpu_first_chunk; + extern struct pcpu_chunk *pcpu_reserved_chunk; +diff --git a/mm/percpu-stats.c b/mm/percpu-stats.c +index c8400a2adbc2b..f6026dbcdf6b3 100644 +--- a/mm/percpu-stats.c ++++ b/mm/percpu-stats.c +@@ -145,6 +145,7 @@ static int percpu_stats_show(struct seq_file *m, void *v) + int slot, max_nr_alloc; + int *buffer; + enum pcpu_chunk_type type; ++ int nr_empty_pop_pages; + + alloc_buffer: + spin_lock_irq(&pcpu_lock); +@@ -165,7 +166,11 @@ alloc_buffer: + goto alloc_buffer; + } + +-#define PL(X) \ ++ nr_empty_pop_pages = 0; ++ for (type = 0; type < PCPU_NR_CHUNK_TYPES; type++) ++ nr_empty_pop_pages += pcpu_nr_empty_pop_pages[type]; ++ ++#define PL(X) \ + seq_printf(m, " %-20s: %12lld\n", #X, (long long int)pcpu_stats_ai.X) + + seq_printf(m, +@@ -196,7 +201,7 @@ alloc_buffer: + PU(nr_max_chunks); + PU(min_alloc_size); + PU(max_alloc_size); +- P("empty_pop_pages", pcpu_nr_empty_pop_pages); ++ P("empty_pop_pages", nr_empty_pop_pages); + seq_putc(m, '\n'); + + #undef PU +diff --git a/mm/percpu.c b/mm/percpu.c +index ad7a37ee74ef5..e12ab708fe15b 100644 +--- a/mm/percpu.c ++++ b/mm/percpu.c +@@ -172,10 +172,10 @@ struct list_head *pcpu_chunk_lists __ro_after_init; /* chunk list slots */ + static LIST_HEAD(pcpu_map_extend_chunks); + + /* +- * The number of empty populated pages, protected by pcpu_lock. The +- * reserved chunk doesn't contribute to the count. ++ * The number of empty populated pages by chunk type, protected by pcpu_lock. ++ * The reserved chunk doesn't contribute to the count. + */ +-int pcpu_nr_empty_pop_pages; ++int pcpu_nr_empty_pop_pages[PCPU_NR_CHUNK_TYPES]; + + /* + * The number of populated pages in use by the allocator, protected by +@@ -555,7 +555,7 @@ static inline void pcpu_update_empty_pages(struct pcpu_chunk *chunk, int nr) + { + chunk->nr_empty_pop_pages += nr; + if (chunk != pcpu_reserved_chunk) +- pcpu_nr_empty_pop_pages += nr; ++ pcpu_nr_empty_pop_pages[pcpu_chunk_type(chunk)] += nr; + } + + /* +@@ -1831,7 +1831,7 @@ area_found: + mutex_unlock(&pcpu_alloc_mutex); + } + +- if (pcpu_nr_empty_pop_pages < PCPU_EMPTY_POP_PAGES_LOW) ++ if (pcpu_nr_empty_pop_pages[type] < PCPU_EMPTY_POP_PAGES_LOW) + pcpu_schedule_balance_work(); + + /* clear the areas and return address relative to base address */ +@@ -1999,7 +1999,7 @@ retry_pop: + pcpu_atomic_alloc_failed = false; + } else { + nr_to_pop = clamp(PCPU_EMPTY_POP_PAGES_HIGH - +- pcpu_nr_empty_pop_pages, ++ pcpu_nr_empty_pop_pages[type], + 0, PCPU_EMPTY_POP_PAGES_HIGH); + } + +@@ -2579,7 +2579,7 @@ void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, + + /* link the first chunk in */ + pcpu_first_chunk = chunk; +- pcpu_nr_empty_pop_pages = pcpu_first_chunk->nr_empty_pop_pages; ++ pcpu_nr_empty_pop_pages[PCPU_CHUNK_ROOT] = pcpu_first_chunk->nr_empty_pop_pages; + pcpu_chunk_relocate(pcpu_first_chunk, -1); + + /* include all regions of the first chunk */ +diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c +index cd09916f97fe9..0e32e31872e29 100644 +--- a/net/batman-adv/translation-table.c ++++ b/net/batman-adv/translation-table.c +@@ -890,6 +890,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node, + hlist_for_each_entry(vlan, &orig_node->vlan_list, list) { + tt_vlan->vid = htons(vlan->vid); + tt_vlan->crc = htonl(vlan->tt.crc); ++ tt_vlan->reserved = 0; + + tt_vlan++; + } +@@ -973,6 +974,7 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, + + tt_vlan->vid = htons(vlan->vid); + tt_vlan->crc = htonl(vlan->tt.crc); ++ tt_vlan->reserved = 0; + + tt_vlan++; + } +diff --git a/net/can/bcm.c b/net/can/bcm.c +index 0e5c37be4a2bd..909b9e684e043 100644 +--- a/net/can/bcm.c ++++ b/net/can/bcm.c +@@ -86,6 +86,8 @@ MODULE_LICENSE("Dual BSD/GPL"); + MODULE_AUTHOR("Oliver Hartkopp "); + MODULE_ALIAS("can-proto-2"); + ++#define BCM_MIN_NAMELEN CAN_REQUIRED_SIZE(struct sockaddr_can, can_ifindex) ++ + /* + * easy access to the first 64 bit of can(fd)_frame payload. cp->data is + * 64 bit aligned so the offset has to be multiples of 8 which is ensured +@@ -1292,7 +1294,7 @@ static int bcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) + /* no bound device as default => check msg_name */ + DECLARE_SOCKADDR(struct sockaddr_can *, addr, msg->msg_name); + +- if (msg->msg_namelen < CAN_REQUIRED_SIZE(*addr, can_ifindex)) ++ if (msg->msg_namelen < BCM_MIN_NAMELEN) + return -EINVAL; + + if (addr->can_family != AF_CAN) +@@ -1534,7 +1536,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len, + struct net *net = sock_net(sk); + int ret = 0; + +- if (len < CAN_REQUIRED_SIZE(*addr, can_ifindex)) ++ if (len < BCM_MIN_NAMELEN) + return -EINVAL; + + lock_sock(sk); +@@ -1616,8 +1618,8 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, + sock_recv_ts_and_drops(msg, sk, skb); + + if (msg->msg_name) { +- __sockaddr_check_size(sizeof(struct sockaddr_can)); +- msg->msg_namelen = sizeof(struct sockaddr_can); ++ __sockaddr_check_size(BCM_MIN_NAMELEN); ++ msg->msg_namelen = BCM_MIN_NAMELEN; + memcpy(msg->msg_name, skb->cb, msg->msg_namelen); + } + +diff --git a/net/can/isotp.c b/net/can/isotp.c +index 15ea1234d4573..9f94ad3caee92 100644 +--- a/net/can/isotp.c ++++ b/net/can/isotp.c +@@ -77,6 +77,8 @@ MODULE_LICENSE("Dual BSD/GPL"); + MODULE_AUTHOR("Oliver Hartkopp "); + MODULE_ALIAS("can-proto-6"); + ++#define ISOTP_MIN_NAMELEN CAN_REQUIRED_SIZE(struct sockaddr_can, can_addr.tp) ++ + #define SINGLE_MASK(id) (((id) & CAN_EFF_FLAG) ? \ + (CAN_EFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG) : \ + (CAN_SFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG)) +@@ -986,7 +988,8 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, + sock_recv_timestamp(msg, sk, skb); + + if (msg->msg_name) { +- msg->msg_namelen = sizeof(struct sockaddr_can); ++ __sockaddr_check_size(ISOTP_MIN_NAMELEN); ++ msg->msg_namelen = ISOTP_MIN_NAMELEN; + memcpy(msg->msg_name, skb->cb, msg->msg_namelen); + } + +@@ -1056,7 +1059,7 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len) + int notify_enetdown = 0; + int do_rx_reg = 1; + +- if (len < CAN_REQUIRED_SIZE(struct sockaddr_can, can_addr.tp)) ++ if (len < ISOTP_MIN_NAMELEN) + return -EINVAL; + + /* do not register frame reception for functional addressing */ +@@ -1152,13 +1155,13 @@ static int isotp_getname(struct socket *sock, struct sockaddr *uaddr, int peer) + if (peer) + return -EOPNOTSUPP; + +- memset(addr, 0, sizeof(*addr)); ++ memset(addr, 0, ISOTP_MIN_NAMELEN); + addr->can_family = AF_CAN; + addr->can_ifindex = so->ifindex; + addr->can_addr.tp.rx_id = so->rxid; + addr->can_addr.tp.tx_id = so->txid; + +- return sizeof(*addr); ++ return ISOTP_MIN_NAMELEN; + } + + static int isotp_setsockopt(struct socket *sock, int level, int optname, +diff --git a/net/can/raw.c b/net/can/raw.c +index 6ec8aa1d0da46..95113b0898b24 100644 +--- a/net/can/raw.c ++++ b/net/can/raw.c +@@ -60,6 +60,8 @@ MODULE_LICENSE("Dual BSD/GPL"); + MODULE_AUTHOR("Urs Thuermann "); + MODULE_ALIAS("can-proto-1"); + ++#define RAW_MIN_NAMELEN CAN_REQUIRED_SIZE(struct sockaddr_can, can_ifindex) ++ + #define MASK_ALL 0 + + /* A raw socket has a list of can_filters attached to it, each receiving +@@ -394,7 +396,7 @@ static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len) + int err = 0; + int notify_enetdown = 0; + +- if (len < CAN_REQUIRED_SIZE(*addr, can_ifindex)) ++ if (len < RAW_MIN_NAMELEN) + return -EINVAL; + if (addr->can_family != AF_CAN) + return -EINVAL; +@@ -475,11 +477,11 @@ static int raw_getname(struct socket *sock, struct sockaddr *uaddr, + if (peer) + return -EOPNOTSUPP; + +- memset(addr, 0, sizeof(*addr)); ++ memset(addr, 0, RAW_MIN_NAMELEN); + addr->can_family = AF_CAN; + addr->can_ifindex = ro->ifindex; + +- return sizeof(*addr); ++ return RAW_MIN_NAMELEN; + } + + static int raw_setsockopt(struct socket *sock, int level, int optname, +@@ -731,7 +733,7 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) + if (msg->msg_name) { + DECLARE_SOCKADDR(struct sockaddr_can *, addr, msg->msg_name); + +- if (msg->msg_namelen < CAN_REQUIRED_SIZE(*addr, can_ifindex)) ++ if (msg->msg_namelen < RAW_MIN_NAMELEN) + return -EINVAL; + + if (addr->can_family != AF_CAN) +@@ -824,8 +826,8 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, + sock_recv_ts_and_drops(msg, sk, skb); + + if (msg->msg_name) { +- __sockaddr_check_size(sizeof(struct sockaddr_can)); +- msg->msg_namelen = sizeof(struct sockaddr_can); ++ __sockaddr_check_size(RAW_MIN_NAMELEN); ++ msg->msg_namelen = RAW_MIN_NAMELEN; + memcpy(msg->msg_name, skb->cb, msg->msg_namelen); + } + +diff --git a/net/core/skmsg.c b/net/core/skmsg.c +index 25cdbb20f3a03..923a1d0f84ca3 100644 +--- a/net/core/skmsg.c ++++ b/net/core/skmsg.c +@@ -488,6 +488,7 @@ static int sk_psock_skb_ingress_self(struct sk_psock *psock, struct sk_buff *skb + if (unlikely(!msg)) + return -EAGAIN; + sk_msg_init(msg); ++ skb_set_owner_r(skb, sk); + return sk_psock_skb_ingress_enqueue(skb, psock, sk, msg); + } + +@@ -791,7 +792,6 @@ static void sk_psock_tls_verdict_apply(struct sk_buff *skb, struct sock *sk, int + { + switch (verdict) { + case __SK_REDIRECT: +- skb_set_owner_r(skb, sk); + sk_psock_skb_redirect(skb); + break; + case __SK_PASS: +@@ -809,10 +809,6 @@ int sk_psock_tls_strp_read(struct sk_psock *psock, struct sk_buff *skb) + rcu_read_lock(); + prog = READ_ONCE(psock->progs.skb_verdict); + if (likely(prog)) { +- /* We skip full set_owner_r here because if we do a SK_PASS +- * or SK_DROP we can skip skb memory accounting and use the +- * TLS context. +- */ + skb->sk = psock->sk; + tcp_skb_bpf_redirect_clear(skb); + ret = sk_psock_bpf_run(psock, prog, skb); +@@ -881,12 +877,13 @@ static void sk_psock_strp_read(struct strparser *strp, struct sk_buff *skb) + kfree_skb(skb); + goto out; + } +- skb_set_owner_r(skb, sk); + prog = READ_ONCE(psock->progs.skb_verdict); + if (likely(prog)) { ++ skb->sk = sk; + tcp_skb_bpf_redirect_clear(skb); + ret = sk_psock_bpf_run(psock, prog, skb); + ret = sk_psock_map_verd(ret, tcp_skb_bpf_redirect_fetch(skb)); ++ skb->sk = NULL; + } + sk_psock_verdict_apply(psock, skb, ret); + out: +@@ -957,12 +954,13 @@ static int sk_psock_verdict_recv(read_descriptor_t *desc, struct sk_buff *skb, + kfree_skb(skb); + goto out; + } +- skb_set_owner_r(skb, sk); + prog = READ_ONCE(psock->progs.skb_verdict); + if (likely(prog)) { ++ skb->sk = sk; + tcp_skb_bpf_redirect_clear(skb); + ret = sk_psock_bpf_run(psock, prog, skb); + ret = sk_psock_map_verd(ret, tcp_skb_bpf_redirect_fetch(skb)); ++ skb->sk = NULL; + } + sk_psock_verdict_apply(psock, skb, ret); + out: +diff --git a/net/core/sock.c b/net/core/sock.c +index bbcd4b97eddd1..01a680c5c7aea 100644 +--- a/net/core/sock.c ++++ b/net/core/sock.c +@@ -2118,16 +2118,10 @@ void skb_orphan_partial(struct sk_buff *skb) + if (skb_is_tcp_pure_ack(skb)) + return; + +- if (can_skb_orphan_partial(skb)) { +- struct sock *sk = skb->sk; +- +- if (refcount_inc_not_zero(&sk->sk_refcnt)) { +- WARN_ON(refcount_sub_and_test(skb->truesize, &sk->sk_wmem_alloc)); +- skb->destructor = sock_efree; +- } +- } else { ++ if (can_skb_orphan_partial(skb)) ++ skb_set_owner_sk_safe(skb, skb->sk); ++ else + skb_orphan(skb); +- } + } + EXPORT_SYMBOL(skb_orphan_partial); + +diff --git a/net/core/xdp.c b/net/core/xdp.c +index 3a8c9ab4ecbe3..a86bc36607293 100644 +--- a/net/core/xdp.c ++++ b/net/core/xdp.c +@@ -350,7 +350,8 @@ static void __xdp_return(void *data, struct xdp_mem_info *mem, bool napi_direct, + /* mem->id is valid, checked in xdp_rxq_info_reg_mem_model() */ + xa = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params); + page = virt_to_head_page(data); +- napi_direct &= !xdp_return_frame_no_direct(); ++ if (napi_direct && xdp_return_frame_no_direct()) ++ napi_direct = false; + page_pool_put_full_page(xa->page_pool, page, napi_direct); + rcu_read_unlock(); + break; +diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c +index a04fd637b4cdc..3ada338d7e08b 100644 +--- a/net/dsa/dsa2.c ++++ b/net/dsa/dsa2.c +@@ -533,8 +533,14 @@ static int dsa_tree_setup_switches(struct dsa_switch_tree *dst) + + list_for_each_entry(dp, &dst->ports, list) { + err = dsa_port_setup(dp); +- if (err) ++ if (err) { ++ dsa_port_devlink_teardown(dp); ++ dp->type = DSA_PORT_TYPE_UNUSED; ++ err = dsa_port_devlink_setup(dp); ++ if (err) ++ goto teardown; + continue; ++ } + } + + return 0; +diff --git a/net/ethtool/eee.c b/net/ethtool/eee.c +index 901b7de941abd..e10bfcc078531 100644 +--- a/net/ethtool/eee.c ++++ b/net/ethtool/eee.c +@@ -169,8 +169,8 @@ int ethnl_set_eee(struct sk_buff *skb, struct genl_info *info) + ethnl_update_bool32(&eee.eee_enabled, tb[ETHTOOL_A_EEE_ENABLED], &mod); + ethnl_update_bool32(&eee.tx_lpi_enabled, + tb[ETHTOOL_A_EEE_TX_LPI_ENABLED], &mod); +- ethnl_update_bool32(&eee.tx_lpi_timer, tb[ETHTOOL_A_EEE_TX_LPI_TIMER], +- &mod); ++ ethnl_update_u32(&eee.tx_lpi_timer, tb[ETHTOOL_A_EEE_TX_LPI_TIMER], ++ &mod); + ret = 0; + if (!mod) + goto out_ops; +diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c +index ab953a1a0d6cc..6f4c34b6a5d69 100644 +--- a/net/hsr/hsr_device.c ++++ b/net/hsr/hsr_device.c +@@ -217,6 +217,7 @@ static netdev_tx_t hsr_dev_xmit(struct sk_buff *skb, struct net_device *dev) + master = hsr_port_get_hsr(hsr, HSR_PT_MASTER); + if (master) { + skb->dev = master->dev; ++ skb_reset_mac_header(skb); + hsr_forward_skb(skb, master); + } else { + atomic_long_inc(&dev->tx_dropped); +diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c +index cadfccd7876e4..b4e06ae088348 100644 +--- a/net/hsr/hsr_forward.c ++++ b/net/hsr/hsr_forward.c +@@ -528,12 +528,6 @@ void hsr_forward_skb(struct sk_buff *skb, struct hsr_port *port) + { + struct hsr_frame_info frame; + +- if (skb_mac_header(skb) != skb->data) { +- WARN_ONCE(1, "%s:%d: Malformed frame (port_src %s)\n", +- __FILE__, __LINE__, port->dev->name); +- goto out_drop; +- } +- + if (fill_frame_info(&frame, skb, port) < 0) + goto out_drop; + +diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c +index 9c640d670ffeb..0c1b0770c59ea 100644 +--- a/net/ieee802154/nl-mac.c ++++ b/net/ieee802154/nl-mac.c +@@ -551,9 +551,7 @@ ieee802154_llsec_parse_key_id(struct genl_info *info, + desc->mode = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE]); + + if (desc->mode == IEEE802154_SCF_KEY_IMPLICIT) { +- if (!info->attrs[IEEE802154_ATTR_PAN_ID] && +- !(info->attrs[IEEE802154_ATTR_SHORT_ADDR] || +- info->attrs[IEEE802154_ATTR_HW_ADDR])) ++ if (!info->attrs[IEEE802154_ATTR_PAN_ID]) + return -EINVAL; + + desc->device_addr.pan_id = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_PAN_ID]); +@@ -562,6 +560,9 @@ ieee802154_llsec_parse_key_id(struct genl_info *info, + desc->device_addr.mode = IEEE802154_ADDR_SHORT; + desc->device_addr.short_addr = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_SHORT_ADDR]); + } else { ++ if (!info->attrs[IEEE802154_ATTR_HW_ADDR]) ++ return -EINVAL; ++ + desc->device_addr.mode = IEEE802154_ADDR_LONG; + desc->device_addr.extended_addr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]); + } +diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c +index 7c5a1aa5adb42..d1b6a9665b170 100644 +--- a/net/ieee802154/nl802154.c ++++ b/net/ieee802154/nl802154.c +@@ -820,8 +820,13 @@ nl802154_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags, + goto nla_put_failure; + + #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) ++ goto out; ++ + if (nl802154_get_llsec_params(msg, rdev, wpan_dev) < 0) + goto nla_put_failure; ++ ++out: + #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */ + + genlmsg_end(msg, hdr); +@@ -1384,6 +1389,9 @@ static int nl802154_set_llsec_params(struct sk_buff *skb, + u32 changed = 0; + int ret; + ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) ++ return -EOPNOTSUPP; ++ + if (info->attrs[NL802154_ATTR_SEC_ENABLED]) { + u8 enabled; + +@@ -1544,7 +1552,8 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info) + struct ieee802154_llsec_key_id id = { }; + u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { }; + +- if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) ++ if (!info->attrs[NL802154_ATTR_SEC_KEY] || ++ nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) + return -EINVAL; + + if (!attrs[NL802154_KEY_ATTR_USAGE_FRAMES] || +@@ -1592,7 +1601,8 @@ static int nl802154_del_llsec_key(struct sk_buff *skb, struct genl_info *info) + struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1]; + struct ieee802154_llsec_key_id id; + +- if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) ++ if (!info->attrs[NL802154_ATTR_SEC_KEY] || ++ nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) + return -EINVAL; + + if (ieee802154_llsec_parse_key_id(attrs[NL802154_KEY_ATTR_ID], &id) < 0) +@@ -1757,7 +1767,8 @@ static int nl802154_del_llsec_dev(struct sk_buff *skb, struct genl_info *info) + struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1]; + __le64 extended_addr; + +- if (nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack)) ++ if (!info->attrs[NL802154_ATTR_SEC_DEVICE] || ++ nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack)) + return -EINVAL; + + if (!attrs[NL802154_DEV_ATTR_EXTENDED_ADDR]) +@@ -1913,7 +1924,8 @@ static int nl802154_del_llsec_devkey(struct sk_buff *skb, struct genl_info *info + struct ieee802154_llsec_device_key key; + __le64 extended_addr; + +- if (nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack)) ++ if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] || ++ nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack)) + return -EINVAL; + + if (!attrs[NL802154_DEVKEY_ATTR_EXTENDED_ADDR]) +@@ -2085,6 +2097,9 @@ static int nl802154_del_llsec_seclevel(struct sk_buff *skb, + struct wpan_dev *wpan_dev = dev->ieee802154_ptr; + struct ieee802154_llsec_seclevel sl; + ++ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) ++ return -EOPNOTSUPP; ++ + if (!info->attrs[NL802154_ATTR_SEC_LEVEL] || + llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL], + &sl) < 0) +diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c +index d99e1be94019d..36ed85bf2ad51 100644 +--- a/net/ipv4/ah4.c ++++ b/net/ipv4/ah4.c +@@ -141,7 +141,7 @@ static void ah_output_done(struct crypto_async_request *base, int err) + } + + kfree(AH_SKB_CB(skb)->tmp); +- xfrm_output_resume(skb, err); ++ xfrm_output_resume(skb->sk, skb, err); + } + + static int ah_output(struct xfrm_state *x, struct sk_buff *skb) +diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c +index a3271ec3e1627..4b834bbf95e07 100644 +--- a/net/ipv4/esp4.c ++++ b/net/ipv4/esp4.c +@@ -279,7 +279,7 @@ static void esp_output_done(struct crypto_async_request *base, int err) + x->encap && x->encap->encap_type == TCP_ENCAP_ESPINTCP) + esp_output_tail_tcp(x, skb); + else +- xfrm_output_resume(skb, err); ++ xfrm_output_resume(skb->sk, skb, err); + } + } + +diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c +index 5bda5aeda5791..5aa7344dbec7f 100644 +--- a/net/ipv4/esp4_offload.c ++++ b/net/ipv4/esp4_offload.c +@@ -217,10 +217,12 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb, + + if ((!(skb->dev->gso_partial_features & NETIF_F_HW_ESP) && + !(features & NETIF_F_HW_ESP)) || x->xso.dev != skb->dev) +- esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK); ++ esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK | ++ NETIF_F_SCTP_CRC); + else if (!(features & NETIF_F_HW_ESP_TX_CSUM) && + !(skb->dev->gso_partial_features & NETIF_F_HW_ESP_TX_CSUM)) +- esp_features = features & ~NETIF_F_CSUM_MASK; ++ esp_features = features & ~(NETIF_F_CSUM_MASK | ++ NETIF_F_SCTP_CRC); + + xo->flags |= XFRM_GSO_SEGMENT; + +@@ -312,8 +314,17 @@ static int esp_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features_ + ip_hdr(skb)->tot_len = htons(skb->len); + ip_send_check(ip_hdr(skb)); + +- if (hw_offload) ++ if (hw_offload) { ++ if (!skb_ext_add(skb, SKB_EXT_SEC_PATH)) ++ return -ENOMEM; ++ ++ xo = xfrm_offload(skb); ++ if (!xo) ++ return -EINVAL; ++ ++ xo->flags |= XFRM_XMIT; + return 0; ++ } + + err = esp_output_tail(x, skb, &esp); + if (err) +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c +index 69ea76578abb9..9d2a1a247cec6 100644 +--- a/net/ipv4/udp.c ++++ b/net/ipv4/udp.c +@@ -2749,6 +2749,10 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, + val = up->gso_size; + break; + ++ case UDP_GRO: ++ val = up->gro_enabled; ++ break; ++ + /* The following two cannot be changed on UDP sockets, the return is + * always 0 (which corresponds to the full checksum coverage of UDP). */ + case UDPLITE_SEND_CSCOV: +diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c +index 440080da805b5..080ee7f44c649 100644 +--- a/net/ipv6/ah6.c ++++ b/net/ipv6/ah6.c +@@ -316,7 +316,7 @@ static void ah6_output_done(struct crypto_async_request *base, int err) + } + + kfree(AH_SKB_CB(skb)->tmp); +- xfrm_output_resume(skb, err); ++ xfrm_output_resume(skb->sk, skb, err); + } + + static int ah6_output(struct xfrm_state *x, struct sk_buff *skb) +diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c +index 2b804fcebcc65..4071cb7c7a154 100644 +--- a/net/ipv6/esp6.c ++++ b/net/ipv6/esp6.c +@@ -314,7 +314,7 @@ static void esp_output_done(struct crypto_async_request *base, int err) + x->encap && x->encap->encap_type == TCP_ENCAP_ESPINTCP) + esp_output_tail_tcp(x, skb); + else +- xfrm_output_resume(skb, err); ++ xfrm_output_resume(skb->sk, skb, err); + } + } + +diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c +index 1ca516fb30e1c..4af56affaafd4 100644 +--- a/net/ipv6/esp6_offload.c ++++ b/net/ipv6/esp6_offload.c +@@ -254,9 +254,11 @@ static struct sk_buff *esp6_gso_segment(struct sk_buff *skb, + skb->encap_hdr_csum = 1; + + if (!(features & NETIF_F_HW_ESP) || x->xso.dev != skb->dev) +- esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK); ++ esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK | ++ NETIF_F_SCTP_CRC); + else if (!(features & NETIF_F_HW_ESP_TX_CSUM)) +- esp_features = features & ~NETIF_F_CSUM_MASK; ++ esp_features = features & ~(NETIF_F_CSUM_MASK | ++ NETIF_F_SCTP_CRC); + + xo->flags |= XFRM_GSO_SEGMENT; + +@@ -346,8 +348,17 @@ static int esp6_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features + + ipv6_hdr(skb)->payload_len = htons(len); + +- if (hw_offload) ++ if (hw_offload) { ++ if (!skb_ext_add(skb, SKB_EXT_SEC_PATH)) ++ return -ENOMEM; ++ ++ xo = xfrm_offload(skb); ++ if (!xo) ++ return -EINVAL; ++ ++ xo->flags |= XFRM_XMIT; + return 0; ++ } + + err = esp6_output_tail(x, skb, &esp); + if (err) +diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c +index 1f56d9aae5892..bf3646b57c686 100644 +--- a/net/ipv6/raw.c ++++ b/net/ipv6/raw.c +@@ -298,7 +298,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) + */ + v4addr = LOOPBACK4_IPV6; + if (!(addr_type & IPV6_ADDR_MULTICAST) && +- !sock_net(sk)->ipv6.sysctl.ip_nonlocal_bind) { ++ !ipv6_can_nonlocal_bind(sock_net(sk), inet)) { + err = -EADDRNOTAVAIL; + if (!ipv6_chk_addr(sock_net(sk), &addr->sin6_addr, + dev, 0)) { +diff --git a/net/ipv6/route.c b/net/ipv6/route.c +index 0bbfaa55e3c89..4bba6d21ffa0d 100644 +--- a/net/ipv6/route.c ++++ b/net/ipv6/route.c +@@ -5203,9 +5203,11 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, + * nexthops have been replaced by first new, the rest should + * be added to it. + */ +- cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | +- NLM_F_REPLACE); +- cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE; ++ if (cfg->fc_nlinfo.nlh) { ++ cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | ++ NLM_F_REPLACE); ++ cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE; ++ } + nhn++; + } + +diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c +index 9db648a91a4f6..b7155b078b198 100644 +--- a/net/mac80211/mlme.c ++++ b/net/mac80211/mlme.c +@@ -4707,7 +4707,10 @@ static void ieee80211_sta_conn_mon_timer(struct timer_list *t) + timeout = sta->rx_stats.last_rx; + timeout += IEEE80211_CONNECTION_IDLE_TIME; + +- if (time_is_before_jiffies(timeout)) { ++ /* If timeout is after now, then update timer to fire at ++ * the later date, but do not actually probe at this time. ++ */ ++ if (time_is_after_jiffies(timeout)) { + mod_timer(&ifmgd->conn_mon_timer, round_jiffies_up(timeout)); + return; + } +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index ebb3228ce9718..64fae4f645f52 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3578,7 +3578,7 @@ begin: + test_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags)) + goto out; + +- if (vif->txqs_stopped[ieee80211_ac_from_tid(txq->tid)]) { ++ if (vif->txqs_stopped[txq->ac]) { + set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags); + goto out; + } +diff --git a/net/mac802154/llsec.c b/net/mac802154/llsec.c +index 585d33144c33f..55550ead2ced8 100644 +--- a/net/mac802154/llsec.c ++++ b/net/mac802154/llsec.c +@@ -152,7 +152,7 @@ err_tfm0: + crypto_free_sync_skcipher(key->tfm0); + err_tfm: + for (i = 0; i < ARRAY_SIZE(key->tfm); i++) +- if (key->tfm[i]) ++ if (!IS_ERR_OR_NULL(key->tfm[i])) + crypto_free_aead(key->tfm[i]); + + kfree_sensitive(key); +diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c +index 5932b0ebecc31..e337b35a368f9 100644 +--- a/net/mptcp/protocol.c ++++ b/net/mptcp/protocol.c +@@ -11,7 +11,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -20,7 +19,6 @@ + #include + #if IS_ENABLED(CONFIG_MPTCP_IPV6) + #include +-#include + #endif + #include + #include +@@ -2863,6 +2861,48 @@ static int mptcp_setsockopt_v6(struct mptcp_sock *msk, int optname, + return ret; + } + ++static bool mptcp_unsupported(int level, int optname) ++{ ++ if (level == SOL_IP) { ++ switch (optname) { ++ case IP_ADD_MEMBERSHIP: ++ case IP_ADD_SOURCE_MEMBERSHIP: ++ case IP_DROP_MEMBERSHIP: ++ case IP_DROP_SOURCE_MEMBERSHIP: ++ case IP_BLOCK_SOURCE: ++ case IP_UNBLOCK_SOURCE: ++ case MCAST_JOIN_GROUP: ++ case MCAST_LEAVE_GROUP: ++ case MCAST_JOIN_SOURCE_GROUP: ++ case MCAST_LEAVE_SOURCE_GROUP: ++ case MCAST_BLOCK_SOURCE: ++ case MCAST_UNBLOCK_SOURCE: ++ case MCAST_MSFILTER: ++ return true; ++ } ++ return false; ++ } ++ if (level == SOL_IPV6) { ++ switch (optname) { ++ case IPV6_ADDRFORM: ++ case IPV6_ADD_MEMBERSHIP: ++ case IPV6_DROP_MEMBERSHIP: ++ case IPV6_JOIN_ANYCAST: ++ case IPV6_LEAVE_ANYCAST: ++ case MCAST_JOIN_GROUP: ++ case MCAST_LEAVE_GROUP: ++ case MCAST_JOIN_SOURCE_GROUP: ++ case MCAST_LEAVE_SOURCE_GROUP: ++ case MCAST_BLOCK_SOURCE: ++ case MCAST_UNBLOCK_SOURCE: ++ case MCAST_MSFILTER: ++ return true; ++ } ++ return false; ++ } ++ return false; ++} ++ + static int mptcp_setsockopt(struct sock *sk, int level, int optname, + sockptr_t optval, unsigned int optlen) + { +@@ -2871,6 +2911,9 @@ static int mptcp_setsockopt(struct sock *sk, int level, int optname, + + pr_debug("msk=%p", msk); + ++ if (mptcp_unsupported(level, optname)) ++ return -ENOPROTOOPT; ++ + if (level == SOL_SOCKET) + return mptcp_setsockopt_sol_socket(msk, optname, optval, optlen); + +@@ -3379,34 +3422,10 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock, + return mask; + } + +-static int mptcp_release(struct socket *sock) +-{ +- struct mptcp_subflow_context *subflow; +- struct sock *sk = sock->sk; +- struct mptcp_sock *msk; +- +- if (!sk) +- return 0; +- +- lock_sock(sk); +- +- msk = mptcp_sk(sk); +- +- mptcp_for_each_subflow(msk, subflow) { +- struct sock *ssk = mptcp_subflow_tcp_sock(subflow); +- +- ip_mc_drop_socket(ssk); +- } +- +- release_sock(sk); +- +- return inet_release(sock); +-} +- + static const struct proto_ops mptcp_stream_ops = { + .family = PF_INET, + .owner = THIS_MODULE, +- .release = mptcp_release, ++ .release = inet_release, + .bind = mptcp_bind, + .connect = mptcp_stream_connect, + .socketpair = sock_no_socketpair, +@@ -3453,35 +3472,10 @@ void __init mptcp_proto_init(void) + } + + #if IS_ENABLED(CONFIG_MPTCP_IPV6) +-static int mptcp6_release(struct socket *sock) +-{ +- struct mptcp_subflow_context *subflow; +- struct mptcp_sock *msk; +- struct sock *sk = sock->sk; +- +- if (!sk) +- return 0; +- +- lock_sock(sk); +- +- msk = mptcp_sk(sk); +- +- mptcp_for_each_subflow(msk, subflow) { +- struct sock *ssk = mptcp_subflow_tcp_sock(subflow); +- +- ip_mc_drop_socket(ssk); +- ipv6_sock_mc_close(ssk); +- ipv6_sock_ac_close(ssk); +- } +- +- release_sock(sk); +- return inet6_release(sock); +-} +- + static const struct proto_ops mptcp_v6_stream_ops = { + .family = PF_INET6, + .owner = THIS_MODULE, +- .release = mptcp6_release, ++ .release = inet6_release, + .bind = mptcp_bind, + .connect = mptcp_stream_connect, + .socketpair = sock_no_socketpair, +diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c +index a9cb355324d1a..ffff8da707b8c 100644 +--- a/net/ncsi/ncsi-manage.c ++++ b/net/ncsi/ncsi-manage.c +@@ -105,13 +105,20 @@ static void ncsi_channel_monitor(struct timer_list *t) + monitor_state = nc->monitor.state; + spin_unlock_irqrestore(&nc->lock, flags); + +- if (!enabled || chained) { +- ncsi_stop_channel_monitor(nc); +- return; +- } ++ if (!enabled) ++ return; /* expected race disabling timer */ ++ if (WARN_ON_ONCE(chained)) ++ goto bad_state; ++ + if (state != NCSI_CHANNEL_INACTIVE && + state != NCSI_CHANNEL_ACTIVE) { +- ncsi_stop_channel_monitor(nc); ++bad_state: ++ netdev_warn(ndp->ndev.dev, ++ "Bad NCSI monitor state channel %d 0x%x %s queue\n", ++ nc->id, state, chained ? "on" : "off"); ++ spin_lock_irqsave(&nc->lock, flags); ++ nc->monitor.enabled = false; ++ spin_unlock_irqrestore(&nc->lock, flags); + return; + } + +@@ -136,10 +143,9 @@ static void ncsi_channel_monitor(struct timer_list *t) + ncsi_report_link(ndp, true); + ndp->flags |= NCSI_DEV_RESHUFFLE; + +- ncsi_stop_channel_monitor(nc); +- + ncm = &nc->modes[NCSI_MODE_LINK]; + spin_lock_irqsave(&nc->lock, flags); ++ nc->monitor.enabled = false; + nc->state = NCSI_CHANNEL_INVISIBLE; + ncm->data[2] &= ~0x1; + spin_unlock_irqrestore(&nc->lock, flags); +diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c +index d257ed3b732ae..a3b46f8888033 100644 +--- a/net/nfc/llcp_sock.c ++++ b/net/nfc/llcp_sock.c +@@ -108,11 +108,13 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) + llcp_sock->service_name_len, + GFP_KERNEL); + if (!llcp_sock->service_name) { ++ nfc_llcp_local_put(llcp_sock->local); + ret = -ENOMEM; + goto put_dev; + } + llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock); + if (llcp_sock->ssap == LLCP_SAP_MAX) { ++ nfc_llcp_local_put(llcp_sock->local); + kfree(llcp_sock->service_name); + llcp_sock->service_name = NULL; + ret = -EADDRINUSE; +@@ -671,6 +673,10 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, + ret = -EISCONN; + goto error; + } ++ if (sk->sk_state == LLCP_CONNECTING) { ++ ret = -EINPROGRESS; ++ goto error; ++ } + + dev = nfc_get_device(addr->dev_idx); + if (dev == NULL) { +@@ -702,6 +708,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, + llcp_sock->local = nfc_llcp_local_get(local); + llcp_sock->ssap = nfc_llcp_get_local_ssap(local); + if (llcp_sock->ssap == LLCP_SAP_MAX) { ++ nfc_llcp_local_put(llcp_sock->local); + ret = -ENOMEM; + goto put_dev; + } +@@ -743,9 +750,12 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, + + sock_unlink: + nfc_llcp_sock_unlink(&local->connecting_sockets, sk); ++ kfree(llcp_sock->service_name); ++ llcp_sock->service_name = NULL; + + sock_llcp_release: + nfc_llcp_put_ssap(local, llcp_sock->ssap); ++ nfc_llcp_local_put(llcp_sock->local); + + put_dev: + nfc_put_device(dev); +diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c +index 5eddfe7bd3910..2316efd6ace8b 100644 +--- a/net/openvswitch/conntrack.c ++++ b/net/openvswitch/conntrack.c +@@ -2032,10 +2032,10 @@ static int ovs_ct_limit_del_zone_limit(struct nlattr *nla_zone_limit, + static int ovs_ct_limit_get_default_limit(struct ovs_ct_limit_info *info, + struct sk_buff *reply) + { +- struct ovs_zone_limit zone_limit; +- +- zone_limit.zone_id = OVS_ZONE_LIMIT_DEFAULT_ZONE; +- zone_limit.limit = info->default_limit; ++ struct ovs_zone_limit zone_limit = { ++ .zone_id = OVS_ZONE_LIMIT_DEFAULT_ZONE, ++ .limit = info->default_limit, ++ }; + + return nla_put_nohdr(reply, sizeof(zone_limit), &zone_limit); + } +diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c +index dfc820ee553a0..1e4fb568fa841 100644 +--- a/net/qrtr/qrtr.c ++++ b/net/qrtr/qrtr.c +@@ -271,7 +271,10 @@ static int qrtr_tx_wait(struct qrtr_node *node, int dest_node, int dest_port, + flow = kzalloc(sizeof(*flow), GFP_KERNEL); + if (flow) { + init_waitqueue_head(&flow->resume_tx); +- radix_tree_insert(&node->qrtr_tx_flow, key, flow); ++ if (radix_tree_insert(&node->qrtr_tx_flow, key, flow)) { ++ kfree(flow); ++ flow = NULL; ++ } + } + } + mutex_unlock(&node->qrtr_tx_lock); +diff --git a/net/rds/message.c b/net/rds/message.c +index 071a261fdaabb..799034e0f513d 100644 +--- a/net/rds/message.c ++++ b/net/rds/message.c +@@ -347,8 +347,9 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in + rm->data.op_nents = DIV_ROUND_UP(total_len, PAGE_SIZE); + rm->data.op_sg = rds_message_alloc_sgs(rm, num_sgs); + if (IS_ERR(rm->data.op_sg)) { ++ void *err = ERR_CAST(rm->data.op_sg); + rds_message_put(rm); +- return ERR_CAST(rm->data.op_sg); ++ return err; + } + + for (i = 0; i < rm->data.op_nents; ++i) { +diff --git a/net/rfkill/core.c b/net/rfkill/core.c +index 68d6ef9e59fc4..ac15a944573f7 100644 +--- a/net/rfkill/core.c ++++ b/net/rfkill/core.c +@@ -69,7 +69,7 @@ struct rfkill { + + struct rfkill_int_event { + struct list_head list; +- struct rfkill_event ev; ++ struct rfkill_event_ext ev; + }; + + struct rfkill_data { +@@ -253,7 +253,8 @@ static void rfkill_global_led_trigger_unregister(void) + } + #endif /* CONFIG_RFKILL_LEDS */ + +-static void rfkill_fill_event(struct rfkill_event *ev, struct rfkill *rfkill, ++static void rfkill_fill_event(struct rfkill_event_ext *ev, ++ struct rfkill *rfkill, + enum rfkill_operation op) + { + unsigned long flags; +@@ -1237,7 +1238,7 @@ static ssize_t rfkill_fop_write(struct file *file, const char __user *buf, + size_t count, loff_t *pos) + { + struct rfkill *rfkill; +- struct rfkill_event ev; ++ struct rfkill_event_ext ev; + int ret; + + /* we don't need the 'hard' variable but accept it */ +diff --git a/net/sched/act_api.c b/net/sched/act_api.c +index b919826939e0b..f6d5755d669eb 100644 +--- a/net/sched/act_api.c ++++ b/net/sched/act_api.c +@@ -158,7 +158,7 @@ static int __tcf_action_put(struct tc_action *p, bool bind) + return 0; + } + +-int __tcf_idr_release(struct tc_action *p, bool bind, bool strict) ++static int __tcf_idr_release(struct tc_action *p, bool bind, bool strict) + { + int ret = 0; + +@@ -184,7 +184,18 @@ int __tcf_idr_release(struct tc_action *p, bool bind, bool strict) + + return ret; + } +-EXPORT_SYMBOL(__tcf_idr_release); ++ ++int tcf_idr_release(struct tc_action *a, bool bind) ++{ ++ const struct tc_action_ops *ops = a->ops; ++ int ret; ++ ++ ret = __tcf_idr_release(a, bind, false); ++ if (ret == ACT_P_DELETED) ++ module_put(ops->owner); ++ return ret; ++} ++EXPORT_SYMBOL(tcf_idr_release); + + static size_t tcf_action_shared_attrs_size(const struct tc_action *act) + { +@@ -493,6 +504,7 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est, + } + + p->idrinfo = idrinfo; ++ __module_get(ops->owner); + p->ops = ops; + *a = p; + return 0; +@@ -992,7 +1004,8 @@ struct tc_action_ops *tc_action_load_ops(char *name, struct nlattr *nla, + struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, + struct nlattr *nla, struct nlattr *est, + char *name, int ovr, int bind, +- struct tc_action_ops *a_o, bool rtnl_held, ++ struct tc_action_ops *a_o, int *init_res, ++ bool rtnl_held, + struct netlink_ext_ack *extack) + { + struct nla_bitfield32 flags = { 0, 0 }; +@@ -1028,6 +1041,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, + } + if (err < 0) + goto err_out; ++ *init_res = err; + + if (!name && tb[TCA_ACT_COOKIE]) + tcf_set_action_cookie(&a->act_cookie, cookie); +@@ -1035,13 +1049,6 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, + if (!name) + a->hw_stats = hw_stats; + +- /* module count goes up only when brand new policy is created +- * if it exists and is only bound to in a_o->init() then +- * ACT_P_CREATED is not returned (a zero is). +- */ +- if (err != ACT_P_CREATED) +- module_put(a_o->owner); +- + return a; + + err_out: +@@ -1056,7 +1063,7 @@ err_out: + + int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, + struct nlattr *est, char *name, int ovr, int bind, +- struct tc_action *actions[], size_t *attr_size, ++ struct tc_action *actions[], int init_res[], size_t *attr_size, + bool rtnl_held, struct netlink_ext_ack *extack) + { + struct tc_action_ops *ops[TCA_ACT_MAX_PRIO] = {}; +@@ -1084,7 +1091,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, + + for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) { + act = tcf_action_init_1(net, tp, tb[i], est, name, ovr, bind, +- ops[i - 1], rtnl_held, extack); ++ ops[i - 1], &init_res[i - 1], rtnl_held, ++ extack); + if (IS_ERR(act)) { + err = PTR_ERR(act); + goto err; +@@ -1100,7 +1108,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, + tcf_idr_insert_many(actions); + + *attr_size = tcf_action_full_attrs_size(sz); +- return i - 1; ++ err = i - 1; ++ goto err_mod; + + err: + tcf_action_destroy(actions, bind); +@@ -1497,12 +1506,13 @@ static int tcf_action_add(struct net *net, struct nlattr *nla, + struct netlink_ext_ack *extack) + { + size_t attr_size = 0; +- int loop, ret; ++ int loop, ret, i; + struct tc_action *actions[TCA_ACT_MAX_PRIO] = {}; ++ int init_res[TCA_ACT_MAX_PRIO] = {}; + + for (loop = 0; loop < 10; loop++) { + ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, +- actions, &attr_size, true, extack); ++ actions, init_res, &attr_size, true, extack); + if (ret != -EAGAIN) + break; + } +@@ -1510,8 +1520,12 @@ static int tcf_action_add(struct net *net, struct nlattr *nla, + if (ret < 0) + return ret; + ret = tcf_add_notify(net, n, actions, portid, attr_size, extack); +- if (ovr) +- tcf_action_put_many(actions); ++ ++ /* only put existing actions */ ++ for (i = 0; i < TCA_ACT_MAX_PRIO; i++) ++ if (init_res[i] == ACT_P_CREATED) ++ actions[i] = NULL; ++ tcf_action_put_many(actions); + + return ret; + } +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c +index e37556cc37ab6..b3a2cba130a13 100644 +--- a/net/sched/cls_api.c ++++ b/net/sched/cls_api.c +@@ -646,7 +646,7 @@ static void tc_block_indr_cleanup(struct flow_block_cb *block_cb) + struct net_device *dev = block_cb->indr.dev; + struct Qdisc *sch = block_cb->indr.sch; + struct netlink_ext_ack extack = {}; +- struct flow_block_offload bo; ++ struct flow_block_offload bo = {}; + + tcf_block_offload_init(&bo, dev, sch, FLOW_BLOCK_UNBIND, + block_cb->indr.binder_type, +@@ -3039,6 +3039,7 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, + { + #ifdef CONFIG_NET_CLS_ACT + { ++ int init_res[TCA_ACT_MAX_PRIO] = {}; + struct tc_action *act; + size_t attr_size = 0; + +@@ -3050,12 +3051,11 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, + return PTR_ERR(a_o); + act = tcf_action_init_1(net, tp, tb[exts->police], + rate_tlv, "police", ovr, +- TCA_ACT_BIND, a_o, rtnl_held, +- extack); +- if (IS_ERR(act)) { +- module_put(a_o->owner); ++ TCA_ACT_BIND, a_o, init_res, ++ rtnl_held, extack); ++ module_put(a_o->owner); ++ if (IS_ERR(act)) + return PTR_ERR(act); +- } + + act->type = exts->type = TCA_OLD_COMPAT; + exts->actions[0] = act; +@@ -3066,8 +3066,8 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, + + err = tcf_action_init(net, tp, tb[exts->action], + rate_tlv, NULL, ovr, TCA_ACT_BIND, +- exts->actions, &attr_size, +- rtnl_held, extack); ++ exts->actions, init_res, ++ &attr_size, rtnl_held, extack); + if (err < 0) + return err; + exts->nr_actions = err; +diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c +index 2f1f0a3784083..6af6b95bdb672 100644 +--- a/net/sched/sch_teql.c ++++ b/net/sched/sch_teql.c +@@ -134,6 +134,9 @@ teql_destroy(struct Qdisc *sch) + struct teql_sched_data *dat = qdisc_priv(sch); + struct teql_master *master = dat->m; + ++ if (!master) ++ return; ++ + prev = master->slaves; + if (prev) { + do { +diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c +index c3e89c776e663..bd08807c9e447 100644 +--- a/net/sctp/ipv6.c ++++ b/net/sctp/ipv6.c +@@ -664,8 +664,8 @@ static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp) + if (!(type & IPV6_ADDR_UNICAST)) + return 0; + +- return sp->inet.freebind || net->ipv6.sysctl.ip_nonlocal_bind || +- ipv6_chk_addr(net, in6, NULL, 0); ++ return ipv6_can_nonlocal_bind(net, &sp->inet) || ++ ipv6_chk_addr(net, in6, NULL, 0); + } + + /* This function checks if the address is a valid address to be used for +@@ -954,8 +954,7 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr) + net = sock_net(&opt->inet.sk); + rcu_read_lock(); + dev = dev_get_by_index_rcu(net, addr->v6.sin6_scope_id); +- if (!dev || !(opt->inet.freebind || +- net->ipv6.sysctl.ip_nonlocal_bind || ++ if (!dev || !(ipv6_can_nonlocal_bind(net, &opt->inet) || + ipv6_chk_addr(net, &addr->v6.sin6_addr, + dev, 0))) { + rcu_read_unlock(); +diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c +index f4fca8f7f63fa..97710ce36047c 100644 +--- a/net/tipc/crypto.c ++++ b/net/tipc/crypto.c +@@ -1941,12 +1941,13 @@ static void tipc_crypto_rcv_complete(struct net *net, struct tipc_aead *aead, + goto rcv; + if (tipc_aead_clone(&tmp, aead) < 0) + goto rcv; ++ WARN_ON(!refcount_inc_not_zero(&tmp->refcnt)); + if (tipc_crypto_key_attach(rx, tmp, ehdr->tx_key, false) < 0) { + tipc_aead_free(&tmp->rcu); + goto rcv; + } + tipc_aead_put(aead); +- aead = tipc_aead_get(tmp); ++ aead = tmp; + } + + if (unlikely(err)) { +diff --git a/net/tipc/socket.c b/net/tipc/socket.c +index cebcc104dc70a..022999e0202d7 100644 +--- a/net/tipc/socket.c ++++ b/net/tipc/socket.c +@@ -1265,7 +1265,7 @@ void tipc_sk_mcast_rcv(struct net *net, struct sk_buff_head *arrvq, + spin_lock_bh(&inputq->lock); + if (skb_peek(arrvq) == skb) { + skb_queue_splice_tail_init(&tmpq, inputq); +- kfree_skb(__skb_dequeue(arrvq)); ++ __skb_dequeue(arrvq); + } + spin_unlock_bh(&inputq->lock); + __skb_queue_purge(&tmpq); +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c +index 775d0c4d86c36..1f2dff186cb60 100644 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -5,7 +5,7 @@ + * Copyright 2006-2010 Johannes Berg + * Copyright 2013-2014 Intel Mobile Communications GmbH + * Copyright 2015-2017 Intel Deutschland GmbH +- * Copyright (C) 2018-2020 Intel Corporation ++ * Copyright (C) 2018-2021 Intel Corporation + */ + + #include +@@ -209,9 +209,13 @@ static int validate_beacon_head(const struct nlattr *attr, + unsigned int len = nla_len(attr); + const struct element *elem; + const struct ieee80211_mgmt *mgmt = (void *)data; +- bool s1g_bcn = ieee80211_is_s1g_beacon(mgmt->frame_control); + unsigned int fixedlen, hdrlen; ++ bool s1g_bcn; + ++ if (len < offsetofend(typeof(*mgmt), frame_control)) ++ goto err; ++ ++ s1g_bcn = ieee80211_is_s1g_beacon(mgmt->frame_control); + if (s1g_bcn) { + fixedlen = offsetof(struct ieee80211_ext, + u.s1g_beacon.variable); +@@ -5397,7 +5401,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) + rdev, info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP], + ¶ms); + if (err) +- return err; ++ goto out; + } + + nl80211_calculate_ap_params(¶ms); +diff --git a/net/wireless/scan.c b/net/wireless/scan.c +index 1b7fec3b53cdd..1f1241443a1cc 100644 +--- a/net/wireless/scan.c ++++ b/net/wireless/scan.c +@@ -2352,14 +2352,16 @@ cfg80211_inform_single_bss_frame_data(struct wiphy *wiphy, + return NULL; + + if (ext) { +- struct ieee80211_s1g_bcn_compat_ie *compat; +- u8 *ie; ++ const struct ieee80211_s1g_bcn_compat_ie *compat; ++ const struct element *elem; + +- ie = (void *)cfg80211_find_ie(WLAN_EID_S1G_BCN_COMPAT, +- variable, ielen); +- if (!ie) ++ elem = cfg80211_find_elem(WLAN_EID_S1G_BCN_COMPAT, ++ variable, ielen); ++ if (!elem) ++ return NULL; ++ if (elem->datalen < sizeof(*compat)) + return NULL; +- compat = (void *)(ie + 2); ++ compat = (void *)elem->data; + bssid = ext->u.s1g_beacon.sa; + capability = le16_to_cpu(compat->compat_info); + beacon_int = le16_to_cpu(compat->beacon_int); +diff --git a/net/wireless/sme.c b/net/wireless/sme.c +index 38df713f2e2ed..060e365c8259b 100644 +--- a/net/wireless/sme.c ++++ b/net/wireless/sme.c +@@ -530,7 +530,7 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev, + cfg80211_sme_free(wdev); + } + +- if (WARN_ON(wdev->conn)) ++ if (wdev->conn) + return -EINPROGRESS; + + wdev->conn = kzalloc(sizeof(*wdev->conn), GFP_KERNEL); +diff --git a/net/xfrm/xfrm_compat.c b/net/xfrm/xfrm_compat.c +index d8e8a11ca845e..a20aec9d73933 100644 +--- a/net/xfrm/xfrm_compat.c ++++ b/net/xfrm/xfrm_compat.c +@@ -216,7 +216,7 @@ static struct nlmsghdr *xfrm_nlmsg_put_compat(struct sk_buff *skb, + case XFRM_MSG_GETSADINFO: + case XFRM_MSG_GETSPDINFO: + default: +- WARN_ONCE(1, "unsupported nlmsg_type %d", nlh_src->nlmsg_type); ++ pr_warn_once("unsupported nlmsg_type %d\n", nlh_src->nlmsg_type); + return ERR_PTR(-EOPNOTSUPP); + } + +@@ -277,7 +277,7 @@ static int xfrm_xlate64_attr(struct sk_buff *dst, const struct nlattr *src) + return xfrm_nla_cpy(dst, src, nla_len(src)); + default: + BUILD_BUG_ON(XFRMA_MAX != XFRMA_IF_ID); +- WARN_ONCE(1, "unsupported nla_type %d", src->nla_type); ++ pr_warn_once("unsupported nla_type %d\n", src->nla_type); + return -EOPNOTSUPP; + } + } +@@ -315,8 +315,10 @@ static int xfrm_alloc_compat(struct sk_buff *skb, const struct nlmsghdr *nlh_src + struct sk_buff *new = NULL; + int err; + +- if (WARN_ON_ONCE(type >= ARRAY_SIZE(xfrm_msg_min))) ++ if (type >= ARRAY_SIZE(xfrm_msg_min)) { ++ pr_warn_once("unsupported nlmsg_type %d\n", nlh_src->nlmsg_type); + return -EOPNOTSUPP; ++ } + + if (skb_shinfo(skb)->frag_list == NULL) { + new = alloc_skb(skb->len + skb_tailroom(skb), GFP_ATOMIC); +@@ -378,6 +380,10 @@ static int xfrm_attr_cpy32(void *dst, size_t *pos, const struct nlattr *src, + struct nlmsghdr *nlmsg = dst; + struct nlattr *nla; + ++ /* xfrm_user_rcv_msg_compat() relies on fact that 32-bit messages ++ * have the same len or shorted than 64-bit ones. ++ * 32-bit translation that is bigger than 64-bit original is unexpected. ++ */ + if (WARN_ON_ONCE(copy_len > payload)) + copy_len = payload; + +diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c +index edf11893dbe81..6d6917b68856f 100644 +--- a/net/xfrm/xfrm_device.c ++++ b/net/xfrm/xfrm_device.c +@@ -134,8 +134,6 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur + return skb; + } + +- xo->flags |= XFRM_XMIT; +- + if (skb_is_gso(skb) && unlikely(x->xso.dev != dev)) { + struct sk_buff *segs; + +diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c +index 697cdcfbb5e1a..3f42c2f15ba45 100644 +--- a/net/xfrm/xfrm_interface.c ++++ b/net/xfrm/xfrm_interface.c +@@ -305,6 +305,8 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) + + icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); + } else { ++ if (!(ip_hdr(skb)->frag_off & htons(IP_DF))) ++ goto xmit; + icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, + htonl(mtu)); + } +@@ -313,6 +315,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) + return -EMSGSIZE; + } + ++xmit: + xfrmi_scrub_packet(skb, !net_eq(xi->net, dev_net(dev))); + skb_dst_set(skb, dst); + skb->dev = tdev; +diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c +index a7ab19353313c..b81ca117dac7a 100644 +--- a/net/xfrm/xfrm_output.c ++++ b/net/xfrm/xfrm_output.c +@@ -503,22 +503,22 @@ out: + return err; + } + +-int xfrm_output_resume(struct sk_buff *skb, int err) ++int xfrm_output_resume(struct sock *sk, struct sk_buff *skb, int err) + { + struct net *net = xs_net(skb_dst(skb)->xfrm); + + while (likely((err = xfrm_output_one(skb, err)) == 0)) { + nf_reset_ct(skb); + +- err = skb_dst(skb)->ops->local_out(net, skb->sk, skb); ++ err = skb_dst(skb)->ops->local_out(net, sk, skb); + if (unlikely(err != 1)) + goto out; + + if (!skb_dst(skb)->xfrm) +- return dst_output(net, skb->sk, skb); ++ return dst_output(net, sk, skb); + + err = nf_hook(skb_dst(skb)->ops->family, +- NF_INET_POST_ROUTING, net, skb->sk, skb, ++ NF_INET_POST_ROUTING, net, sk, skb, + NULL, skb_dst(skb)->dev, xfrm_output2); + if (unlikely(err != 1)) + goto out; +@@ -534,7 +534,7 @@ EXPORT_SYMBOL_GPL(xfrm_output_resume); + + static int xfrm_output2(struct net *net, struct sock *sk, struct sk_buff *skb) + { +- return xfrm_output_resume(skb, 1); ++ return xfrm_output_resume(sk, skb, 1); + } + + static int xfrm_output_gso(struct net *net, struct sock *sk, struct sk_buff *skb) +diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c +index d01ca1a184189..ffd315cff9846 100644 +--- a/net/xfrm/xfrm_state.c ++++ b/net/xfrm/xfrm_state.c +@@ -44,7 +44,6 @@ static void xfrm_state_gc_task(struct work_struct *work); + */ + + static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024; +-static __read_mostly seqcount_t xfrm_state_hash_generation = SEQCNT_ZERO(xfrm_state_hash_generation); + static struct kmem_cache *xfrm_state_cache __ro_after_init; + + static DECLARE_WORK(xfrm_state_gc_work, xfrm_state_gc_task); +@@ -140,7 +139,7 @@ static void xfrm_hash_resize(struct work_struct *work) + } + + spin_lock_bh(&net->xfrm.xfrm_state_lock); +- write_seqcount_begin(&xfrm_state_hash_generation); ++ write_seqcount_begin(&net->xfrm.xfrm_state_hash_generation); + + nhashmask = (nsize / sizeof(struct hlist_head)) - 1U; + odst = xfrm_state_deref_prot(net->xfrm.state_bydst, net); +@@ -156,7 +155,7 @@ static void xfrm_hash_resize(struct work_struct *work) + rcu_assign_pointer(net->xfrm.state_byspi, nspi); + net->xfrm.state_hmask = nhashmask; + +- write_seqcount_end(&xfrm_state_hash_generation); ++ write_seqcount_end(&net->xfrm.xfrm_state_hash_generation); + spin_unlock_bh(&net->xfrm.xfrm_state_lock); + + osize = (ohashmask + 1) * sizeof(struct hlist_head); +@@ -1063,7 +1062,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr, + + to_put = NULL; + +- sequence = read_seqcount_begin(&xfrm_state_hash_generation); ++ sequence = read_seqcount_begin(&net->xfrm.xfrm_state_hash_generation); + + rcu_read_lock(); + h = xfrm_dst_hash(net, daddr, saddr, tmpl->reqid, encap_family); +@@ -1176,7 +1175,7 @@ out: + if (to_put) + xfrm_state_put(to_put); + +- if (read_seqcount_retry(&xfrm_state_hash_generation, sequence)) { ++ if (read_seqcount_retry(&net->xfrm.xfrm_state_hash_generation, sequence)) { + *err = -EAGAIN; + if (x) { + xfrm_state_put(x); +@@ -2666,6 +2665,7 @@ int __net_init xfrm_state_init(struct net *net) + net->xfrm.state_num = 0; + INIT_WORK(&net->xfrm.state_hash_work, xfrm_hash_resize); + spin_lock_init(&net->xfrm.xfrm_state_lock); ++ seqcount_init(&net->xfrm.xfrm_state_hash_generation); + return 0; + + out_byspi: +diff --git a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c +index 0172d87e2b9ae..364b2ef9b36f8 100644 +--- a/security/selinux/ss/avtab.c ++++ b/security/selinux/ss/avtab.c +@@ -109,7 +109,7 @@ static int avtab_insert(struct avtab *h, struct avtab_key *key, struct avtab_dat + struct avtab_node *prev, *cur, *newnode; + u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); + +- if (!h) ++ if (!h || !h->nslot) + return -EINVAL; + + hvalue = avtab_hash(key, h->mask); +@@ -154,7 +154,7 @@ avtab_insert_nonunique(struct avtab *h, struct avtab_key *key, struct avtab_datu + struct avtab_node *prev, *cur; + u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); + +- if (!h) ++ if (!h || !h->nslot) + return NULL; + hvalue = avtab_hash(key, h->mask); + for (prev = NULL, cur = h->htable[hvalue]; +@@ -184,7 +184,7 @@ struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *key) + struct avtab_node *cur; + u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); + +- if (!h) ++ if (!h || !h->nslot) + return NULL; + + hvalue = avtab_hash(key, h->mask); +@@ -220,7 +220,7 @@ avtab_search_node(struct avtab *h, struct avtab_key *key) + struct avtab_node *cur; + u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); + +- if (!h) ++ if (!h || !h->nslot) + return NULL; + + hvalue = avtab_hash(key, h->mask); +@@ -295,6 +295,7 @@ void avtab_destroy(struct avtab *h) + } + kvfree(h->htable); + h->htable = NULL; ++ h->nel = 0; + h->nslot = 0; + h->mask = 0; + } +@@ -303,88 +304,52 @@ void avtab_init(struct avtab *h) + { + h->htable = NULL; + h->nel = 0; ++ h->nslot = 0; ++ h->mask = 0; + } + +-int avtab_alloc(struct avtab *h, u32 nrules) ++static int avtab_alloc_common(struct avtab *h, u32 nslot) + { +- u32 mask = 0; +- u32 shift = 0; +- u32 work = nrules; +- u32 nslot = 0; +- +- if (nrules == 0) +- goto avtab_alloc_out; +- +- while (work) { +- work = work >> 1; +- shift++; +- } +- if (shift > 2) +- shift = shift - 2; +- nslot = 1 << shift; +- if (nslot > MAX_AVTAB_HASH_BUCKETS) +- nslot = MAX_AVTAB_HASH_BUCKETS; +- mask = nslot - 1; ++ if (!nslot) ++ return 0; + + h->htable = kvcalloc(nslot, sizeof(void *), GFP_KERNEL); + if (!h->htable) + return -ENOMEM; + +- avtab_alloc_out: +- h->nel = 0; + h->nslot = nslot; +- h->mask = mask; +- pr_debug("SELinux: %d avtab hash slots, %d rules.\n", +- h->nslot, nrules); ++ h->mask = nslot - 1; + return 0; + } + +-int avtab_duplicate(struct avtab *new, struct avtab *orig) ++int avtab_alloc(struct avtab *h, u32 nrules) + { +- int i; +- struct avtab_node *node, *tmp, *tail; +- +- memset(new, 0, sizeof(*new)); ++ int rc; ++ u32 nslot = 0; + +- new->htable = kvcalloc(orig->nslot, sizeof(void *), GFP_KERNEL); +- if (!new->htable) +- return -ENOMEM; +- new->nslot = orig->nslot; +- new->mask = orig->mask; +- +- for (i = 0; i < orig->nslot; i++) { +- tail = NULL; +- for (node = orig->htable[i]; node; node = node->next) { +- tmp = kmem_cache_zalloc(avtab_node_cachep, GFP_KERNEL); +- if (!tmp) +- goto error; +- tmp->key = node->key; +- if (tmp->key.specified & AVTAB_XPERMS) { +- tmp->datum.u.xperms = +- kmem_cache_zalloc(avtab_xperms_cachep, +- GFP_KERNEL); +- if (!tmp->datum.u.xperms) { +- kmem_cache_free(avtab_node_cachep, tmp); +- goto error; +- } +- tmp->datum.u.xperms = node->datum.u.xperms; +- } else +- tmp->datum.u.data = node->datum.u.data; +- +- if (tail) +- tail->next = tmp; +- else +- new->htable[i] = tmp; +- +- tail = tmp; +- new->nel++; ++ if (nrules != 0) { ++ u32 shift = 1; ++ u32 work = nrules >> 3; ++ while (work) { ++ work >>= 1; ++ shift++; + } ++ nslot = 1 << shift; ++ if (nslot > MAX_AVTAB_HASH_BUCKETS) ++ nslot = MAX_AVTAB_HASH_BUCKETS; ++ ++ rc = avtab_alloc_common(h, nslot); ++ if (rc) ++ return rc; + } + ++ pr_debug("SELinux: %d avtab hash slots, %d rules.\n", nslot, nrules); + return 0; +-error: +- avtab_destroy(new); +- return -ENOMEM; ++} ++ ++int avtab_alloc_dup(struct avtab *new, const struct avtab *orig) ++{ ++ return avtab_alloc_common(new, orig->nslot); + } + + void avtab_hash_eval(struct avtab *h, char *tag) +diff --git a/security/selinux/ss/avtab.h b/security/selinux/ss/avtab.h +index 4c4445ca9118e..f2eeb36265d15 100644 +--- a/security/selinux/ss/avtab.h ++++ b/security/selinux/ss/avtab.h +@@ -89,7 +89,7 @@ struct avtab { + + void avtab_init(struct avtab *h); + int avtab_alloc(struct avtab *, u32); +-int avtab_duplicate(struct avtab *new, struct avtab *orig); ++int avtab_alloc_dup(struct avtab *new, const struct avtab *orig); + struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *k); + void avtab_destroy(struct avtab *h); + void avtab_hash_eval(struct avtab *h, char *tag); +diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c +index 0b32f3ab025e5..1ef74c085f2b0 100644 +--- a/security/selinux/ss/conditional.c ++++ b/security/selinux/ss/conditional.c +@@ -605,7 +605,6 @@ static int cond_dup_av_list(struct cond_av_list *new, + struct cond_av_list *orig, + struct avtab *avtab) + { +- struct avtab_node *avnode; + u32 i; + + memset(new, 0, sizeof(*new)); +@@ -615,10 +614,11 @@ static int cond_dup_av_list(struct cond_av_list *new, + return -ENOMEM; + + for (i = 0; i < orig->len; i++) { +- avnode = avtab_search_node(avtab, &orig->nodes[i]->key); +- if (WARN_ON(!avnode)) +- return -EINVAL; +- new->nodes[i] = avnode; ++ new->nodes[i] = avtab_insert_nonunique(avtab, ++ &orig->nodes[i]->key, ++ &orig->nodes[i]->datum); ++ if (!new->nodes[i]) ++ return -ENOMEM; + new->len++; + } + +@@ -630,7 +630,7 @@ static int duplicate_policydb_cond_list(struct policydb *newp, + { + int rc, i, j; + +- rc = avtab_duplicate(&newp->te_cond_avtab, &origp->te_cond_avtab); ++ rc = avtab_alloc_dup(&newp->te_cond_avtab, &origp->te_cond_avtab); + if (rc) + return rc; + +diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c +index 8d9bbd39ab9a8..b09138000185c 100644 +--- a/security/selinux/ss/services.c ++++ b/security/selinux/ss/services.c +@@ -1551,6 +1551,7 @@ static int security_context_to_sid_core(struct selinux_state *state, + if (!str) + goto out; + } ++retry: + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -1564,6 +1565,15 @@ static int security_context_to_sid_core(struct selinux_state *state, + } else if (rc) + goto out_unlock; + rc = sidtab_context_to_sid(sidtab, &context, sid); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ if (context.str) { ++ str = context.str; ++ context.str = NULL; ++ } ++ context_destroy(&context); ++ goto retry; ++ } + context_destroy(&context); + out_unlock: + rcu_read_unlock(); +@@ -1713,7 +1723,7 @@ static int security_compute_sid(struct selinux_state *state, + struct selinux_policy *policy; + struct policydb *policydb; + struct sidtab *sidtab; +- struct class_datum *cladatum = NULL; ++ struct class_datum *cladatum; + struct context *scontext, *tcontext, newcontext; + struct sidtab_entry *sentry, *tentry; + struct avtab_key avkey; +@@ -1735,6 +1745,8 @@ static int security_compute_sid(struct selinux_state *state, + goto out; + } + ++retry: ++ cladatum = NULL; + context_init(&newcontext); + + rcu_read_lock(); +@@ -1879,6 +1891,11 @@ static int security_compute_sid(struct selinux_state *state, + } + /* Obtain the sid for the context. */ + rc = sidtab_context_to_sid(sidtab, &newcontext, out_sid); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ context_destroy(&newcontext); ++ goto retry; ++ } + out_unlock: + rcu_read_unlock(); + context_destroy(&newcontext); +@@ -2190,6 +2207,7 @@ void selinux_policy_commit(struct selinux_state *state, + struct selinux_load_state *load_state) + { + struct selinux_policy *oldpolicy, *newpolicy = load_state->policy; ++ unsigned long flags; + u32 seqno; + + oldpolicy = rcu_dereference_protected(state->policy, +@@ -2211,7 +2229,13 @@ void selinux_policy_commit(struct selinux_state *state, + seqno = newpolicy->latest_granting; + + /* Install the new policy. */ +- rcu_assign_pointer(state->policy, newpolicy); ++ if (oldpolicy) { ++ sidtab_freeze_begin(oldpolicy->sidtab, &flags); ++ rcu_assign_pointer(state->policy, newpolicy); ++ sidtab_freeze_end(oldpolicy->sidtab, &flags); ++ } else { ++ rcu_assign_pointer(state->policy, newpolicy); ++ } + + /* Load the policycaps from the new policy */ + security_load_policycaps(state, newpolicy); +@@ -2355,13 +2379,15 @@ int security_port_sid(struct selinux_state *state, + struct policydb *policydb; + struct sidtab *sidtab; + struct ocontext *c; +- int rc = 0; ++ int rc; + + if (!selinux_initialized(state)) { + *out_sid = SECINITSID_PORT; + return 0; + } + ++retry: ++ rc = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2380,6 +2406,10 @@ int security_port_sid(struct selinux_state *state, + if (!c->sid[0]) { + rc = sidtab_context_to_sid(sidtab, &c->context[0], + &c->sid[0]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + } +@@ -2406,13 +2436,15 @@ int security_ib_pkey_sid(struct selinux_state *state, + struct policydb *policydb; + struct sidtab *sidtab; + struct ocontext *c; +- int rc = 0; ++ int rc; + + if (!selinux_initialized(state)) { + *out_sid = SECINITSID_UNLABELED; + return 0; + } + ++retry: ++ rc = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2433,6 +2465,10 @@ int security_ib_pkey_sid(struct selinux_state *state, + rc = sidtab_context_to_sid(sidtab, + &c->context[0], + &c->sid[0]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + } +@@ -2458,13 +2494,15 @@ int security_ib_endport_sid(struct selinux_state *state, + struct policydb *policydb; + struct sidtab *sidtab; + struct ocontext *c; +- int rc = 0; ++ int rc; + + if (!selinux_initialized(state)) { + *out_sid = SECINITSID_UNLABELED; + return 0; + } + ++retry: ++ rc = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2485,6 +2523,10 @@ int security_ib_endport_sid(struct selinux_state *state, + if (!c->sid[0]) { + rc = sidtab_context_to_sid(sidtab, &c->context[0], + &c->sid[0]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + } +@@ -2508,7 +2550,7 @@ int security_netif_sid(struct selinux_state *state, + struct selinux_policy *policy; + struct policydb *policydb; + struct sidtab *sidtab; +- int rc = 0; ++ int rc; + struct ocontext *c; + + if (!selinux_initialized(state)) { +@@ -2516,6 +2558,8 @@ int security_netif_sid(struct selinux_state *state, + return 0; + } + ++retry: ++ rc = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2532,10 +2576,18 @@ int security_netif_sid(struct selinux_state *state, + if (!c->sid[0] || !c->sid[1]) { + rc = sidtab_context_to_sid(sidtab, &c->context[0], + &c->sid[0]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + rc = sidtab_context_to_sid(sidtab, &c->context[1], + &c->sid[1]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + } +@@ -2585,6 +2637,7 @@ int security_node_sid(struct selinux_state *state, + return 0; + } + ++retry: + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2633,6 +2686,10 @@ int security_node_sid(struct selinux_state *state, + rc = sidtab_context_to_sid(sidtab, + &c->context[0], + &c->sid[0]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + } +@@ -2674,18 +2731,24 @@ int security_get_user_sids(struct selinux_state *state, + struct sidtab *sidtab; + struct context *fromcon, usercon; + u32 *mysids = NULL, *mysids2, sid; +- u32 mynel = 0, maxnel = SIDS_NEL; ++ u32 i, j, mynel, maxnel = SIDS_NEL; + struct user_datum *user; + struct role_datum *role; + struct ebitmap_node *rnode, *tnode; +- int rc = 0, i, j; ++ int rc; + + *sids = NULL; + *nel = 0; + + if (!selinux_initialized(state)) +- goto out; ++ return 0; ++ ++ mysids = kcalloc(maxnel, sizeof(*mysids), GFP_KERNEL); ++ if (!mysids) ++ return -ENOMEM; + ++retry: ++ mynel = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2705,11 +2768,6 @@ int security_get_user_sids(struct selinux_state *state, + + usercon.user = user->value; + +- rc = -ENOMEM; +- mysids = kcalloc(maxnel, sizeof(*mysids), GFP_ATOMIC); +- if (!mysids) +- goto out_unlock; +- + ebitmap_for_each_positive_bit(&user->roles, rnode, i) { + role = policydb->role_val_to_struct[i]; + usercon.role = i + 1; +@@ -2721,6 +2779,10 @@ int security_get_user_sids(struct selinux_state *state, + continue; + + rc = sidtab_context_to_sid(sidtab, &usercon, &sid); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out_unlock; + if (mynel < maxnel) { +@@ -2743,14 +2805,14 @@ out_unlock: + rcu_read_unlock(); + if (rc || !mynel) { + kfree(mysids); +- goto out; ++ return rc; + } + + rc = -ENOMEM; + mysids2 = kcalloc(mynel, sizeof(*mysids2), GFP_KERNEL); + if (!mysids2) { + kfree(mysids); +- goto out; ++ return rc; + } + for (i = 0, j = 0; i < mynel; i++) { + struct av_decision dummy_avd; +@@ -2763,12 +2825,10 @@ out_unlock: + mysids2[j++] = mysids[i]; + cond_resched(); + } +- rc = 0; + kfree(mysids); + *sids = mysids2; + *nel = j; +-out: +- return rc; ++ return 0; + } + + /** +@@ -2781,6 +2841,9 @@ out: + * Obtain a SID to use for a file in a filesystem that + * cannot support xattr or use a fixed labeling behavior like + * transition SIDs or task SIDs. ++ * ++ * WARNING: This function may return -ESTALE, indicating that the caller ++ * must retry the operation after re-acquiring the policy pointer! + */ + static inline int __security_genfs_sid(struct selinux_policy *policy, + const char *fstype, +@@ -2859,11 +2922,13 @@ int security_genfs_sid(struct selinux_state *state, + return 0; + } + +- rcu_read_lock(); +- policy = rcu_dereference(state->policy); +- retval = __security_genfs_sid(policy, +- fstype, path, orig_sclass, sid); +- rcu_read_unlock(); ++ do { ++ rcu_read_lock(); ++ policy = rcu_dereference(state->policy); ++ retval = __security_genfs_sid(policy, fstype, path, ++ orig_sclass, sid); ++ rcu_read_unlock(); ++ } while (retval == -ESTALE); + return retval; + } + +@@ -2886,7 +2951,7 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb) + struct selinux_policy *policy; + struct policydb *policydb; + struct sidtab *sidtab; +- int rc = 0; ++ int rc; + struct ocontext *c; + struct superblock_security_struct *sbsec = sb->s_security; + const char *fstype = sb->s_type->name; +@@ -2897,6 +2962,8 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb) + return 0; + } + ++retry: ++ rc = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -2914,6 +2981,10 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb) + if (!c->sid[0]) { + rc = sidtab_context_to_sid(sidtab, &c->context[0], + &c->sid[0]); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) + goto out; + } +@@ -2921,6 +2992,10 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb) + } else { + rc = __security_genfs_sid(policy, fstype, "/", + SECCLASS_DIR, &sbsec->sid); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) { + sbsec->behavior = SECURITY_FS_USE_NONE; + rc = 0; +@@ -3130,12 +3205,13 @@ int security_sid_mls_copy(struct selinux_state *state, + u32 len; + int rc; + +- rc = 0; + if (!selinux_initialized(state)) { + *new_sid = sid; +- goto out; ++ return 0; + } + ++retry: ++ rc = 0; + context_init(&newcon); + + rcu_read_lock(); +@@ -3194,10 +3270,14 @@ int security_sid_mls_copy(struct selinux_state *state, + } + } + rc = sidtab_context_to_sid(sidtab, &newcon, new_sid); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ context_destroy(&newcon); ++ goto retry; ++ } + out_unlock: + rcu_read_unlock(); + context_destroy(&newcon); +-out: + return rc; + } + +@@ -3794,6 +3874,8 @@ int security_netlbl_secattr_to_sid(struct selinux_state *state, + return 0; + } + ++retry: ++ rc = 0; + rcu_read_lock(); + policy = rcu_dereference(state->policy); + policydb = &policy->policydb; +@@ -3820,23 +3902,24 @@ int security_netlbl_secattr_to_sid(struct selinux_state *state, + goto out; + } + rc = -EIDRM; +- if (!mls_context_isvalid(policydb, &ctx_new)) +- goto out_free; ++ if (!mls_context_isvalid(policydb, &ctx_new)) { ++ ebitmap_destroy(&ctx_new.range.level[0].cat); ++ goto out; ++ } + + rc = sidtab_context_to_sid(sidtab, &ctx_new, sid); ++ ebitmap_destroy(&ctx_new.range.level[0].cat); ++ if (rc == -ESTALE) { ++ rcu_read_unlock(); ++ goto retry; ++ } + if (rc) +- goto out_free; ++ goto out; + + security_netlbl_cache_add(secattr, *sid); +- +- ebitmap_destroy(&ctx_new.range.level[0].cat); + } else + *sid = SECSID_NULL; + +- rcu_read_unlock(); +- return 0; +-out_free: +- ebitmap_destroy(&ctx_new.range.level[0].cat); + out: + rcu_read_unlock(); + return rc; +diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c +index 5ee190bd30f53..656d50b09f762 100644 +--- a/security/selinux/ss/sidtab.c ++++ b/security/selinux/ss/sidtab.c +@@ -39,6 +39,7 @@ int sidtab_init(struct sidtab *s) + for (i = 0; i < SECINITSID_NUM; i++) + s->isids[i].set = 0; + ++ s->frozen = false; + s->count = 0; + s->convert = NULL; + hash_init(s->context_to_sid); +@@ -281,6 +282,15 @@ int sidtab_context_to_sid(struct sidtab *s, struct context *context, + if (*sid) + goto out_unlock; + ++ if (unlikely(s->frozen)) { ++ /* ++ * This sidtab is now frozen - tell the caller to abort and ++ * get the new one. ++ */ ++ rc = -ESTALE; ++ goto out_unlock; ++ } ++ + count = s->count; + convert = s->convert; + +@@ -474,6 +484,17 @@ void sidtab_cancel_convert(struct sidtab *s) + spin_unlock_irqrestore(&s->lock, flags); + } + ++void sidtab_freeze_begin(struct sidtab *s, unsigned long *flags) __acquires(&s->lock) ++{ ++ spin_lock_irqsave(&s->lock, *flags); ++ s->frozen = true; ++ s->convert = NULL; ++} ++void sidtab_freeze_end(struct sidtab *s, unsigned long *flags) __releases(&s->lock) ++{ ++ spin_unlock_irqrestore(&s->lock, *flags); ++} ++ + static void sidtab_destroy_entry(struct sidtab_entry *entry) + { + context_destroy(&entry->context); +diff --git a/security/selinux/ss/sidtab.h b/security/selinux/ss/sidtab.h +index 80c744d07ad62..4eff0e49dcb22 100644 +--- a/security/selinux/ss/sidtab.h ++++ b/security/selinux/ss/sidtab.h +@@ -86,6 +86,7 @@ struct sidtab { + u32 count; + /* access only under spinlock */ + struct sidtab_convert_params *convert; ++ bool frozen; + spinlock_t lock; + + #if CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE > 0 +@@ -125,6 +126,9 @@ int sidtab_convert(struct sidtab *s, struct sidtab_convert_params *params); + + void sidtab_cancel_convert(struct sidtab *s); + ++void sidtab_freeze_begin(struct sidtab *s, unsigned long *flags) __acquires(&s->lock); ++void sidtab_freeze_end(struct sidtab *s, unsigned long *flags) __releases(&s->lock); ++ + int sidtab_context_to_sid(struct sidtab *s, struct context *context, u32 *sid); + + void sidtab_destroy(struct sidtab *s); +diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c +index 702f91b9c60f7..12caa87fe74e8 100644 +--- a/sound/drivers/aloop.c ++++ b/sound/drivers/aloop.c +@@ -1572,6 +1572,14 @@ static int loopback_mixer_new(struct loopback *loopback, int notify) + return -ENOMEM; + kctl->id.device = dev; + kctl->id.subdevice = substr; ++ ++ /* Add the control before copying the id so that ++ * the numid field of the id is set in the copy. ++ */ ++ err = snd_ctl_add(card, kctl); ++ if (err < 0) ++ return err; ++ + switch (idx) { + case ACTIVE_IDX: + setup->active_id = kctl->id; +@@ -1588,9 +1596,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify) + default: + break; + } +- err = snd_ctl_add(card, kctl); +- if (err < 0) +- return err; + } + } + } +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c +index a980a4eda51c9..7aa9062f4f838 100644 +--- a/sound/pci/hda/patch_conexant.c ++++ b/sound/pci/hda/patch_conexant.c +@@ -944,6 +944,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { + SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x8402, "HP ProBook 645 G4", CXT_FIXUP_MUTE_LED_GPIO), + SND_PCI_QUIRK(0x103c, 0x8427, "HP ZBook Studio G5", CXT_FIXUP_HP_ZBOOK_MUTE_LED), ++ SND_PCI_QUIRK(0x103c, 0x844f, "HP ZBook Studio G5", CXT_FIXUP_HP_ZBOOK_MUTE_LED), + SND_PCI_QUIRK(0x103c, 0x8455, "HP Z2 G4", CXT_FIXUP_HP_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x8456, "HP Z2 G4 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x8457, "HP Z2 G4 mini", CXT_FIXUP_HP_MIC_NO_PRESENCE), +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 58946d069ee59..a7544b77d3f7c 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -3927,6 +3927,15 @@ static void alc271_fixup_dmic(struct hda_codec *codec, + snd_hda_sequence_write(codec, verbs); + } + ++/* Fix the speaker amp after resume, etc */ ++static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec, ++ const struct hda_fixup *fix, ++ int action) ++{ ++ if (action == HDA_FIXUP_ACT_INIT) ++ alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000); ++} ++ + static void alc269_fixup_pcm_44k(struct hda_codec *codec, + const struct hda_fixup *fix, int action) + { +@@ -6301,6 +6310,7 @@ enum { + ALC283_FIXUP_HEADSET_MIC, + ALC255_FIXUP_MIC_MUTE_LED, + ALC282_FIXUP_ASPIRE_V5_PINS, ++ ALC269VB_FIXUP_ASPIRE_E1_COEF, + ALC280_FIXUP_HP_GPIO4, + ALC286_FIXUP_HP_GPIO_LED, + ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, +@@ -6979,6 +6989,10 @@ static const struct hda_fixup alc269_fixups[] = { + { }, + }, + }, ++ [ALC269VB_FIXUP_ASPIRE_E1_COEF] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc269vb_fixup_aspire_e1_coef, ++ }, + [ALC280_FIXUP_HP_GPIO4] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc280_fixup_hp_gpio4, +@@ -7901,6 +7915,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), + SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), + SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), ++ SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF), + SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK), + SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC), +@@ -8395,6 +8410,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { + {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"}, + {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"}, + {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"}, ++ {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"}, + {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"}, + {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, + {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"}, +diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c +index 660ec46eecf25..ceaf3bbb18e66 100644 +--- a/sound/soc/codecs/wm8960.c ++++ b/sound/soc/codecs/wm8960.c +@@ -707,7 +707,13 @@ int wm8960_configure_pll(struct snd_soc_component *component, int freq_in, + best_freq_out = -EINVAL; + *sysclk_idx = *dac_idx = *bclk_idx = -1; + +- for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) { ++ /* ++ * From Datasheet, the PLL performs best when f2 is between ++ * 90MHz and 100MHz, the desired sysclk output is 11.2896MHz ++ * or 12.288MHz, then sysclkdiv = 2 is the best choice. ++ * So search sysclk_divs from 2 to 1 other than from 1 to 2. ++ */ ++ for (i = ARRAY_SIZE(sysclk_divs) - 1; i >= 0; --i) { + if (sysclk_divs[i] == -1) + continue; + for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) { +diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c +index 9e9b05883557c..aa5dd590ddd52 100644 +--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c ++++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c +@@ -488,14 +488,14 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { + .channels_min = SST_STEREO, + .channels_max = SST_STEREO, + .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, +- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + .capture = { + .stream_name = "Headset Capture", + .channels_min = 1, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, +- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + }, + { +@@ -506,7 +506,7 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { + .channels_min = SST_STEREO, + .channels_max = SST_STEREO, + .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, +- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + }, + { +diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c +index 012bac41fee0a..ea8e7ad8684d3 100644 +--- a/sound/soc/sof/intel/hda-dsp.c ++++ b/sound/soc/sof/intel/hda-dsp.c +@@ -226,10 +226,17 @@ bool hda_dsp_core_is_enabled(struct snd_sof_dev *sdev, + + val = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPCS); + +- is_enable = (val & HDA_DSP_ADSPCS_CPA_MASK(core_mask)) && +- (val & HDA_DSP_ADSPCS_SPA_MASK(core_mask)) && +- !(val & HDA_DSP_ADSPCS_CRST_MASK(core_mask)) && +- !(val & HDA_DSP_ADSPCS_CSTALL_MASK(core_mask)); ++#define MASK_IS_EQUAL(v, m, field) ({ \ ++ u32 _m = field(m); \ ++ ((v) & _m) == _m; \ ++}) ++ ++ is_enable = MASK_IS_EQUAL(val, core_mask, HDA_DSP_ADSPCS_CPA_MASK) && ++ MASK_IS_EQUAL(val, core_mask, HDA_DSP_ADSPCS_SPA_MASK) && ++ !(val & HDA_DSP_ADSPCS_CRST_MASK(core_mask)) && ++ !(val & HDA_DSP_ADSPCS_CSTALL_MASK(core_mask)); ++ ++#undef MASK_IS_EQUAL + + dev_dbg(sdev->dev, "DSP core(s) enabled? %d : core_mask %x\n", + is_enable, core_mask); +diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c +index 6c13cc84b3fb5..2173991c13db1 100644 +--- a/sound/soc/sunxi/sun4i-codec.c ++++ b/sound/soc/sunxi/sun4i-codec.c +@@ -1364,6 +1364,7 @@ static struct snd_soc_card *sun4i_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "sun4i-codec"; + card->dapm_widgets = sun4i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun4i_codec_card_dapm_widgets); +@@ -1396,6 +1397,7 @@ static struct snd_soc_card *sun6i_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "A31 Audio Codec"; + card->dapm_widgets = sun6i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); +@@ -1449,6 +1451,7 @@ static struct snd_soc_card *sun8i_a23_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "A23 Audio Codec"; + card->dapm_widgets = sun6i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); +@@ -1487,6 +1490,7 @@ static struct snd_soc_card *sun8i_h3_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "H3 Audio Codec"; + card->dapm_widgets = sun6i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); +@@ -1525,6 +1529,7 @@ static struct snd_soc_card *sun8i_v3s_codec_create_card(struct device *dev) + return ERR_PTR(-ENOMEM); + + card->dev = dev; ++ card->owner = THIS_MODULE; + card->name = "V3s Audio Codec"; + card->dapm_widgets = sun6i_codec_card_dapm_widgets; + card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); +diff --git a/tools/lib/bpf/ringbuf.c b/tools/lib/bpf/ringbuf.c +index 8caaafe7e312b..e7a8d847161f2 100644 +--- a/tools/lib/bpf/ringbuf.c ++++ b/tools/lib/bpf/ringbuf.c +@@ -227,7 +227,7 @@ static int ringbuf_process_ring(struct ring* r) + if ((len & BPF_RINGBUF_DISCARD_BIT) == 0) { + sample = (void *)len_ptr + BPF_RINGBUF_HDR_SZ; + err = r->sample_cb(r->ctx, sample, len); +- if (err) { ++ if (err < 0) { + /* update consumer pos and bail out */ + smp_store_release(r->consumer_pos, + cons_pos); +diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c +index 06746d96742f3..ba70937c5362a 100644 +--- a/tools/lib/bpf/xsk.c ++++ b/tools/lib/bpf/xsk.c +@@ -54,6 +54,8 @@ struct xsk_umem { + int fd; + int refcount; + struct list_head ctx_list; ++ bool rx_ring_setup_done; ++ bool tx_ring_setup_done; + }; + + struct xsk_ctx { +@@ -668,26 +670,30 @@ static struct xsk_ctx *xsk_get_ctx(struct xsk_umem *umem, int ifindex, + return NULL; + } + +-static void xsk_put_ctx(struct xsk_ctx *ctx) ++static void xsk_put_ctx(struct xsk_ctx *ctx, bool unmap) + { + struct xsk_umem *umem = ctx->umem; + struct xdp_mmap_offsets off; + int err; + +- if (--ctx->refcount == 0) { +- err = xsk_get_mmap_offsets(umem->fd, &off); +- if (!err) { +- munmap(ctx->fill->ring - off.fr.desc, +- off.fr.desc + umem->config.fill_size * +- sizeof(__u64)); +- munmap(ctx->comp->ring - off.cr.desc, +- off.cr.desc + umem->config.comp_size * +- sizeof(__u64)); +- } ++ if (--ctx->refcount) ++ return; + +- list_del(&ctx->list); +- free(ctx); +- } ++ if (!unmap) ++ goto out_free; ++ ++ err = xsk_get_mmap_offsets(umem->fd, &off); ++ if (err) ++ goto out_free; ++ ++ munmap(ctx->fill->ring - off.fr.desc, off.fr.desc + umem->config.fill_size * ++ sizeof(__u64)); ++ munmap(ctx->comp->ring - off.cr.desc, off.cr.desc + umem->config.comp_size * ++ sizeof(__u64)); ++ ++out_free: ++ list_del(&ctx->list); ++ free(ctx); + } + + static struct xsk_ctx *xsk_create_ctx(struct xsk_socket *xsk, +@@ -722,8 +728,6 @@ static struct xsk_ctx *xsk_create_ctx(struct xsk_socket *xsk, + memcpy(ctx->ifname, ifname, IFNAMSIZ - 1); + ctx->ifname[IFNAMSIZ - 1] = '\0'; + +- umem->fill_save = NULL; +- umem->comp_save = NULL; + ctx->fill = fill; + ctx->comp = comp; + list_add(&ctx->list, &umem->ctx_list); +@@ -779,6 +783,8 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, + struct xsk_socket *xsk; + struct xsk_ctx *ctx; + int err, ifindex; ++ bool unmap = umem->fill_save != fill; ++ bool rx_setup_done = false, tx_setup_done = false; + + if (!umem || !xsk_ptr || !(rx || tx)) + return -EFAULT; +@@ -806,6 +812,8 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, + } + } else { + xsk->fd = umem->fd; ++ rx_setup_done = umem->rx_ring_setup_done; ++ tx_setup_done = umem->tx_ring_setup_done; + } + + ctx = xsk_get_ctx(umem, ifindex, queue_id); +@@ -824,7 +832,7 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, + } + xsk->ctx = ctx; + +- if (rx) { ++ if (rx && !rx_setup_done) { + err = setsockopt(xsk->fd, SOL_XDP, XDP_RX_RING, + &xsk->config.rx_size, + sizeof(xsk->config.rx_size)); +@@ -832,8 +840,10 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, + err = -errno; + goto out_put_ctx; + } ++ if (xsk->fd == umem->fd) ++ umem->rx_ring_setup_done = true; + } +- if (tx) { ++ if (tx && !tx_setup_done) { + err = setsockopt(xsk->fd, SOL_XDP, XDP_TX_RING, + &xsk->config.tx_size, + sizeof(xsk->config.tx_size)); +@@ -841,6 +851,8 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, + err = -errno; + goto out_put_ctx; + } ++ if (xsk->fd == umem->fd) ++ umem->rx_ring_setup_done = true; + } + + err = xsk_get_mmap_offsets(xsk->fd, &off); +@@ -919,6 +931,8 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, + } + + *xsk_ptr = xsk; ++ umem->fill_save = NULL; ++ umem->comp_save = NULL; + return 0; + + out_mmap_tx: +@@ -930,7 +944,7 @@ out_mmap_rx: + munmap(rx_map, off.rx.desc + + xsk->config.rx_size * sizeof(struct xdp_desc)); + out_put_ctx: +- xsk_put_ctx(ctx); ++ xsk_put_ctx(ctx, unmap); + out_socket: + if (--umem->refcount) + close(xsk->fd); +@@ -944,6 +958,9 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname, + struct xsk_ring_cons *rx, struct xsk_ring_prod *tx, + const struct xsk_socket_config *usr_config) + { ++ if (!umem) ++ return -EFAULT; ++ + return xsk_socket__create_shared(xsk_ptr, ifname, queue_id, umem, + rx, tx, umem->fill_save, + umem->comp_save, usr_config); +@@ -993,7 +1010,7 @@ void xsk_socket__delete(struct xsk_socket *xsk) + } + } + +- xsk_put_ctx(ctx); ++ xsk_put_ctx(ctx, true); + + umem->refcount--; + /* Do not close an fd that also has an associated umem connected +diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c +index 43937f4b399ad..c0be51b957130 100644 +--- a/tools/perf/builtin-inject.c ++++ b/tools/perf/builtin-inject.c +@@ -906,7 +906,7 @@ int cmd_inject(int argc, const char **argv) + } + + data.path = inject.input_name; +- inject.session = perf_session__new(&data, true, &inject.tool); ++ inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool); + if (IS_ERR(inject.session)) + return PTR_ERR(inject.session); + +diff --git a/tools/perf/util/block-info.c b/tools/perf/util/block-info.c +index 423ec69bda6ca..5ecd4f401f324 100644 +--- a/tools/perf/util/block-info.c ++++ b/tools/perf/util/block-info.c +@@ -201,7 +201,7 @@ static int block_total_cycles_pct_entry(struct perf_hpp_fmt *fmt, + double ratio = 0.0; + + if (block_fmt->total_cycles) +- ratio = (double)bi->cycles / (double)block_fmt->total_cycles; ++ ratio = (double)bi->cycles_aggr / (double)block_fmt->total_cycles; + + return color_pct(hpp, block_fmt->width, 100.0 * ratio); + } +@@ -216,9 +216,9 @@ static int64_t block_total_cycles_pct_sort(struct perf_hpp_fmt *fmt, + double l, r; + + if (block_fmt->total_cycles) { +- l = ((double)bi_l->cycles / ++ l = ((double)bi_l->cycles_aggr / + (double)block_fmt->total_cycles) * 100000.0; +- r = ((double)bi_r->cycles / ++ r = ((double)bi_r->cycles_aggr / + (double)block_fmt->total_cycles) * 100000.0; + return (int64_t)l - (int64_t)r; + } From 20c06c0ba3b1fa2fb98b968df3b20a4d202e0f1e Mon Sep 17 00:00:00 2001 From: Oleg Date: Thu, 15 Apr 2021 02:16:13 +0300 Subject: [PATCH 05/18] fix install-nand for extlinux.conf (#2775) --- packages/bsp/common/usr/sbin/nand-sata-install | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/bsp/common/usr/sbin/nand-sata-install b/packages/bsp/common/usr/sbin/nand-sata-install index 0f42b5f5d..b8081f237 100755 --- a/packages/bsp/common/usr/sbin/nand-sata-install +++ b/packages/bsp/common/usr/sbin/nand-sata-install @@ -279,7 +279,13 @@ create_armbian() [[ -f "${TempDir}"/bootfs/boot/boot.ini ]] && sed -e 's,^setenv rootdev.*$,setenv rootdev "'"$targetuuid"'",' -i "${TempDir}"/bootfs/boot/boot.ini [[ -f "${TempDir}"/rootfs/boot/boot.ini ]] && sed -e 's,^setenv rootdev.*$,setenv rootdev "'"$targetuuid"'",' -i "${TempDir}"/rootfs/boot/boot.ini fi - mkimage -C none -A arm -T script -d "${TempDir}"/bootfs/boot/boot.cmd "${TempDir}"/bootfs/boot/boot.scr >/dev/null 2>&1 || (echo 'Error while creating U-Boot loader image with mkimage' >&2 ; exit 5) + + if [[ -f "${TempDir}"/bootfs/boot/extlinux/extlinux.conf ]]; then + sed -e 's,root='"$root_uuid"',root='"$targetuuid"',g' -i "${TempDir}"/bootfs/boot/extlinux/extlinux.conf + [[ -f "${TempDir}"/bootfs/boot/boot.cmd ]] && rm "${TempDir}"/bootfs/boot/boot.cmd + else + mkimage -C none -A arm -T script -d "${TempDir}"/bootfs/boot/boot.cmd "${TempDir}"/bootfs/boot/boot.scr >/dev/null 2>&1 || (echo 'Error while creating U-Boot loader image with mkimage' >&2 ; exit 5) + fi # fstab adj if [[ "$1" != "$2" ]]; then @@ -328,6 +334,10 @@ create_armbian() sed -e 's,setenv rootfstype.*,setenv rootfstype '"$FilesystemChoosen"',' -i /boot/boot.cmd sed -e 's,setenv rootfstype.*,setenv rootfstype '"$FilesystemChoosen"',' -i /boot/boot.ini fi + if [[ -f /bootfs/boot/extlinux/extlinux.conf ]]; then + sed -e 's,root='"$root_uuid"',root='"$satauuid"',g' -i /boot/extlinux/extlinux.conf + [[ -f /boot/boot.cmd ]] && rm /boot/boot.cmd + fi [[ -f /boot/boot.cmd ]] && mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr >/dev/null 2>&1 || (echo 'Error while creating U-Boot loader image with mkimage' >&2 ; exit 7) mkdir -p "${TempDir}"/rootfs/media/mmc/boot echo "${sduuid} /media/mmcboot ext4 ${mountopts[ext4]}" >> "${TempDir}"/rootfs/etc/fstab From dd12df4cacaf6783582c4f83114ea54c0976156e Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Thu, 15 Apr 2021 14:19:01 +0000 Subject: [PATCH 06/18] Add Orangepi R1+ to the build targets --- config/targets-cli-beta.conf | 6 +++++- config/targets.conf | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/config/targets-cli-beta.conf b/config/targets-cli-beta.conf index f16a8b0f0..39020c92a 100644 --- a/config/targets-cli-beta.conf +++ b/config/targets-cli-beta.conf @@ -204,10 +204,14 @@ orangepi3 edge hirsute cli beta orangepi4 edge hirsute cli beta yes -# orangepi-r1 +# Orangepi R1 orangepi-r1 edge hirsute cli beta yes +# Orangepi R1+ +orangepi-r1plus edge hirsute cli beta yes + + # orangepilite orangepilite edge hirsute cli beta yes diff --git a/config/targets.conf b/config/targets.conf index 24e48faa7..f341ab2f2 100644 --- a/config/targets.conf +++ b/config/targets.conf @@ -425,11 +425,16 @@ orangepi4 current focal desktop stable orangepi4 current focal desktop stable yes xfce config_base 3dsupport,browsers,chat,desktop_tools,editors,email,internet,multimedia,office,programming,remote_desktop -# orangepi-r1 +# Orangepi R1 orangepi-r1 current buster cli stable yes orangepi-r1 current focal cli stable yes +# orangepi R1+ +orangepi-r1plus current buster cli stable yes +orangepi-r1plus current focal cli stable yes + + # Orangepi rk3399 orangepi-rk3399 legacy buster desktop stable yes xfce config_base browsers orangepi-rk3399 current buster cli stable yes From d9613be7e67f216104398557e216e505ef1415a9 Mon Sep 17 00:00:00 2001 From: Paolo Sabatino Date: Tue, 13 Apr 2021 13:26:09 +0000 Subject: [PATCH 07/18] rk322x: use fdt_high and initrd_high to 0xffffffff to avoid dtb and initrd copy/expansion by u-boot --- .../rk322x-box-add-device-tree-makefile.patch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patch/u-boot/u-boot-rk322x/board_rk322x-box/rk322x-box-add-device-tree-makefile.patch b/patch/u-boot/u-boot-rk322x/board_rk322x-box/rk322x-box-add-device-tree-makefile.patch index 069c65238..c881ceab3 100644 --- a/patch/u-boot/u-boot-rk322x/board_rk322x-box/rk322x-box-add-device-tree-makefile.patch +++ b/patch/u-boot/u-boot-rk322x/board_rk322x-box/rk322x-box-add-device-tree-makefile.patch @@ -163,7 +163,7 @@ new file mode 100644 index 00000000..a909aa19 --- /dev/null +++ b/include/configs/rk322x-box.h -@@ -0,0 +1,27 @@ +@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * (C) Copyright 2017 Rockchip Electronics Co., Ltd @@ -175,7 +175,9 @@ index 00000000..a909aa19 +#define ROCKCHIP_DEVICE_SETTINGS \ + "stdin=serial,usbkbd\0" \ + "stdout=serial,vidconsole\0" \ -+ "stderr=serial,vidconsole\0" ++ "stderr=serial,vidconsole\0" \ ++ "fdt_high=0xffffffff\0" \ ++ "initrd_high=0xffffffff\0" + +#include + From adca07f5ab41631d930b76ecd24cd0e6d76697cb Mon Sep 17 00:00:00 2001 From: Paolo Sabatino Date: Tue, 13 Apr 2021 13:27:06 +0000 Subject: [PATCH 08/18] rk322x: put next entry point in r1 register to support rockchip proprietary op-tee blob --- ...oot-1005-support-rockchip-tee-binary.patch | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 patch/u-boot/u-boot-rk322x/u-boot-1005-support-rockchip-tee-binary.patch diff --git a/patch/u-boot/u-boot-rk322x/u-boot-1005-support-rockchip-tee-binary.patch b/patch/u-boot/u-boot-rk322x/u-boot-1005-support-rockchip-tee-binary.patch new file mode 100644 index 000000000..467faa299 --- /dev/null +++ b/patch/u-boot/u-boot-rk322x/u-boot-1005-support-rockchip-tee-binary.patch @@ -0,0 +1,24 @@ +From 52a917980ff9c621ff189c652df6f6c4afa7f44c Mon Sep 17 00:00:00 2001 +From: Paolo Sabatino +Date: Mon, 12 Apr 2021 13:42:48 +0000 +Subject: [PATCH] Set register r1 to CONFIG_SYS_TEXT_BASE to support rockchip + proprietary OP-TEE binaries + +--- + common/spl/spl_optee.S | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/common/spl/spl_optee.S b/common/spl/spl_optee.S +index 8bd1949d..6dde863f 100644 +--- a/common/spl/spl_optee.S ++++ b/common/spl/spl_optee.S +@@ -8,5 +8,6 @@ + + ENTRY(spl_optee_entry) + ldr lr, =CONFIG_SYS_TEXT_BASE ++ ldr r1, =CONFIG_SYS_TEXT_BASE + mov pc, r3 + ENDPROC(spl_optee_entry) +-- +2.25.1 + From 9a211110eaba6ae6a8af88599a626c143784258f Mon Sep 17 00:00:00 2001 From: Paolo Sabatino Date: Thu, 15 Apr 2021 19:50:06 +0000 Subject: [PATCH 09/18] rk322x: restored trust reserved memory in device tree --- .../archive/rk322x-4.4/01-linux-1002-rk322x-dts.patch | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/patch/kernel/archive/rk322x-4.4/01-linux-1002-rk322x-dts.patch b/patch/kernel/archive/rk322x-4.4/01-linux-1002-rk322x-dts.patch index 4e692993a..52c81af41 100644 --- a/patch/kernel/archive/rk322x-4.4/01-linux-1002-rk322x-dts.patch +++ b/patch/kernel/archive/rk322x-4.4/01-linux-1002-rk322x-dts.patch @@ -3,7 +3,7 @@ new file mode 100644 index 0000000..04330d3 --- /dev/null +++ b/arch/arm/boot/dts/rk322x-box.dtsi -@@ -0,0 +1,504 @@ +@@ -0,0 +1,503 @@ +/* + * Copyright (C) 2020 knaerzche + * @@ -40,11 +40,10 @@ index 0000000..04330d3 + reg = <0x62e00000 0xf0000>; + }; + -+ /* Not neeed for u-boot 2020.07 and up + trust_reserved: trust@68400000 { -+ reg = <0x68400000 0xe00000>; ++ reg = <0x68400000 0x2000000>; // OP-TEE uses 32mb + no-map; -+ };*/ ++ }; + }; + + ramoops { From ccb8a61c90d978106e5c9d4ad0239844c065b8c3 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sat, 17 Apr 2021 19:40:25 +0200 Subject: [PATCH 10/18] copy hostdev libfdt-dev compatibility patch, fixes odroidn2 (#2780) Signed-off-by: Ricardo Pardini --- ...ix_build_for_recent_host-side_libfdt.patch | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 patch/u-boot/u-boot-odroid/fix_build_for_recent_host-side_libfdt.patch diff --git a/patch/u-boot/u-boot-odroid/fix_build_for_recent_host-side_libfdt.patch b/patch/u-boot/u-boot-odroid/fix_build_for_recent_host-side_libfdt.patch new file mode 100644 index 000000000..b015611c3 --- /dev/null +++ b/patch/u-boot/u-boot-odroid/fix_build_for_recent_host-side_libfdt.patch @@ -0,0 +1,55 @@ +From 001bcba84e1f3ad0f605e5a9bb2fb5cb0e9c605d Mon Sep 17 00:00:00 2001 +From: Hugo Grostabussiat +Date: Fri, 11 Jan 2019 21:33:19 +0100 +Subject: [PATCH] tools: fix build for recent host-side libfdt + +Recent versions of libfdt removed the _ prefix in the header guards, +causing clashes with the libfdt version embedded in U-boot source tree. +--- + include/fdt.h | 3 ++- + include/libfdt.h | 3 ++- + include/libfdt_env.h | 3 ++- + 3 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/include/fdt.h b/include/fdt.h +index 526aedb515..3dd42971eb 100644 +--- a/include/fdt.h ++++ b/include/fdt.h +@@ -1,5 +1,6 @@ +-#ifndef _FDT_H ++#if !defined(_FDT_H) && !defined(FDT_H) + #define _FDT_H ++#define FDT_H + /* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. +diff --git a/include/libfdt.h b/include/libfdt.h +index e2bc2e00c1..9d0d4b98ea 100644 +--- a/include/libfdt.h ++++ b/include/libfdt.h +@@ -1,5 +1,6 @@ +-#ifndef _LIBFDT_H ++#if !defined(_LIBFDT_H) && !defined(LIBFDT_H) + #define _LIBFDT_H ++#define LIBFDT_H + /* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. +diff --git a/include/libfdt_env.h b/include/libfdt_env.h +index 6c6845f76c..216e5c6fa1 100644 +--- a/include/libfdt_env.h ++++ b/include/libfdt_env.h +@@ -6,8 +6,9 @@ + * SPDX-License-Identifier: LGPL-2.1+ + */ + +-#ifndef _LIBFDT_ENV_H ++#if !defined(_LIBFDT_ENV_H) && !defined(LIBFDT_ENV_H) + #define _LIBFDT_ENV_H ++#define LIBFDT_ENV_H + + #include "compiler.h" + #include "linux/types.h" +-- +GitLab + From 0c363a7ba8ad5cbfef1d57c49fe528976daf8145 Mon Sep 17 00:00:00 2001 From: lededev <30518126+lededev@users.noreply.github.com> Date: Mon, 19 Apr 2021 04:03:29 +0800 Subject: [PATCH 11/18] enable usbip and usbip vhci-hcd as module to all devices (#2781) * enable usbip and usbip vhci-hcd as module to all devices Add USBIP and it's module as a kernel module to all devices. It's pretty standard package available in all other distros, allow usage of USB over IP of devices. new file: config/kernel/linux-generic.config modified: config/kernel/linux-odroidxu4-legacy.config modified: lib/compilation.sh * enable usbip and usbip vhci-hcd as module to devices * rm unused config file Co-authored-by: lededev --- config/kernel/linux-imx7d-legacy.config | 8 +++++++- config/kernel/linux-meson64-legacy.config | 8 +++++++- config/kernel/linux-mt7623-edge.config | 8 +++++++- config/kernel/linux-mt7623-legacy.config | 8 +++++++- config/kernel/linux-mvebu64-current.config | 8 +++++++- config/kernel/linux-mvebu64-edge.config | 8 +++++++- config/kernel/linux-odroidxu4-current.config | 8 +++++++- config/kernel/linux-odroidxu4-edge.config | 8 +++++++- config/kernel/linux-rk322x-legacy.config | 8 +++++++- config/kernel/linux-rockchip-legacy.config | 8 +++++++- 10 files changed, 70 insertions(+), 10 deletions(-) diff --git a/config/kernel/linux-imx7d-legacy.config b/config/kernel/linux-imx7d-legacy.config index b977d292c..973830037 100644 --- a/config/kernel/linux-imx7d-legacy.config +++ b/config/kernel/linux-imx7d-legacy.config @@ -3742,7 +3742,13 @@ CONFIG_USB_STORAGE=y # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_VHCI_HC_PORTS=8 +CONFIG_USBIP_VHCI_NR_HCS=1 +CONFIG_USBIP_HOST=m +CONFIG_USBIP_VUDC=m +# CONFIG_USBIP_DEBUG is not set # CONFIG_USB_MUSB_HDRC is not set # CONFIG_USB_DWC3 is not set # CONFIG_USB_DWC2 is not set diff --git a/config/kernel/linux-meson64-legacy.config b/config/kernel/linux-meson64-legacy.config index f9ef773b1..0e94ef197 100644 --- a/config/kernel/linux-meson64-legacy.config +++ b/config/kernel/linux-meson64-legacy.config @@ -4933,7 +4933,13 @@ CONFIG_USB_STORAGE=y # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_VHCI_HC_PORTS=8 +CONFIG_USBIP_VHCI_NR_HCS=1 +CONFIG_USBIP_HOST=m +CONFIG_USBIP_VUDC=m +# CONFIG_USBIP_DEBUG is not set # CONFIG_USB_MUSB_HDRC is not set CONFIG_USB_DWC3=y CONFIG_USB_DWC3_HOST=y diff --git a/config/kernel/linux-mt7623-edge.config b/config/kernel/linux-mt7623-edge.config index 9078ec3f0..72ff8be91 100644 --- a/config/kernel/linux-mt7623-edge.config +++ b/config/kernel/linux-mt7623-edge.config @@ -5312,7 +5312,13 @@ CONFIG_USB_UAS=m # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_VHCI_HC_PORTS=8 +CONFIG_USBIP_VHCI_NR_HCS=1 +CONFIG_USBIP_HOST=m +CONFIG_USBIP_VUDC=m +# CONFIG_USBIP_DEBUG is not set CONFIG_USB_CDNS3=m # CONFIG_USB_CDNS3_GADGET is not set # CONFIG_USB_CDNS3_HOST is not set diff --git a/config/kernel/linux-mt7623-legacy.config b/config/kernel/linux-mt7623-legacy.config index d61881432..c6f1a4e49 100644 --- a/config/kernel/linux-mt7623-legacy.config +++ b/config/kernel/linux-mt7623-legacy.config @@ -4886,7 +4886,13 @@ CONFIG_USB_UAS=m # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_VHCI_HC_PORTS=8 +CONFIG_USBIP_VHCI_NR_HCS=1 +CONFIG_USBIP_HOST=m +CONFIG_USBIP_VUDC=m +# CONFIG_USBIP_DEBUG is not set CONFIG_USB_MTU3=m # CONFIG_USB_MTU3_HOST is not set # CONFIG_USB_MTU3_GADGET is not set diff --git a/config/kernel/linux-mvebu64-current.config b/config/kernel/linux-mvebu64-current.config index 33e0a6715..f6ce042ab 100644 --- a/config/kernel/linux-mvebu64-current.config +++ b/config/kernel/linux-mvebu64-current.config @@ -5288,7 +5288,13 @@ CONFIG_USB_UAS=m # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_VHCI_HC_PORTS=8 +CONFIG_USBIP_VHCI_NR_HCS=1 +CONFIG_USBIP_HOST=m +CONFIG_USBIP_VUDC=m +# CONFIG_USBIP_DEBUG is not set # CONFIG_USB_CDNS3 is not set # CONFIG_USB_MUSB_HDRC is not set # CONFIG_USB_DWC3 is not set diff --git a/config/kernel/linux-mvebu64-edge.config b/config/kernel/linux-mvebu64-edge.config index 666f48170..98ccde751 100644 --- a/config/kernel/linux-mvebu64-edge.config +++ b/config/kernel/linux-mvebu64-edge.config @@ -5324,7 +5324,13 @@ CONFIG_USB_UAS=m # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_VHCI_HC_PORTS=8 +CONFIG_USBIP_VHCI_NR_HCS=1 +CONFIG_USBIP_HOST=m +CONFIG_USBIP_VUDC=m +# CONFIG_USBIP_DEBUG is not set # CONFIG_USB_CDNS3 is not set # CONFIG_USB_MUSB_HDRC is not set # CONFIG_USB_DWC3 is not set diff --git a/config/kernel/linux-odroidxu4-current.config b/config/kernel/linux-odroidxu4-current.config index 2ca738b73..81fe788c4 100644 --- a/config/kernel/linux-odroidxu4-current.config +++ b/config/kernel/linux-odroidxu4-current.config @@ -4741,7 +4741,13 @@ CONFIG_USB_UAS=m # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_VHCI_HC_PORTS=8 +CONFIG_USBIP_VHCI_NR_HCS=1 +CONFIG_USBIP_HOST=m +CONFIG_USBIP_VUDC=m +# CONFIG_USBIP_DEBUG is not set # CONFIG_USB_CDNS3 is not set # CONFIG_USB_MUSB_HDRC is not set CONFIG_USB_DWC3=y diff --git a/config/kernel/linux-odroidxu4-edge.config b/config/kernel/linux-odroidxu4-edge.config index b741a80df..805bf11f8 100644 --- a/config/kernel/linux-odroidxu4-edge.config +++ b/config/kernel/linux-odroidxu4-edge.config @@ -4873,7 +4873,13 @@ CONFIG_USB_UAS=m # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_VHCI_HC_PORTS=8 +CONFIG_USBIP_VHCI_NR_HCS=1 +CONFIG_USBIP_HOST=m +CONFIG_USBIP_VUDC=m +# CONFIG_USBIP_DEBUG is not set # CONFIG_USB_CDNS3 is not set # CONFIG_USB_MUSB_HDRC is not set CONFIG_USB_DWC3=y diff --git a/config/kernel/linux-rk322x-legacy.config b/config/kernel/linux-rk322x-legacy.config index a1bfdd4d4..abc4ee3ad 100644 --- a/config/kernel/linux-rk322x-legacy.config +++ b/config/kernel/linux-rk322x-legacy.config @@ -3964,7 +3964,13 @@ CONFIG_USB_UAS=m # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_VHCI_HC_PORTS=8 +CONFIG_USBIP_VHCI_NR_HCS=1 +CONFIG_USBIP_HOST=m +CONFIG_USBIP_VUDC=m +# CONFIG_USBIP_DEBUG is not set # CONFIG_USB_MUSB_HDRC is not set # CONFIG_USB_DWC3 is not set CONFIG_USB_DWC2=y diff --git a/config/kernel/linux-rockchip-legacy.config b/config/kernel/linux-rockchip-legacy.config index 48b86d150..6e86f6f70 100644 --- a/config/kernel/linux-rockchip-legacy.config +++ b/config/kernel/linux-rockchip-legacy.config @@ -3876,7 +3876,13 @@ CONFIG_USB_UAS=m # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_VHCI_HC_PORTS=8 +CONFIG_USBIP_VHCI_NR_HCS=1 +CONFIG_USBIP_HOST=m +CONFIG_USBIP_VUDC=m +# CONFIG_USBIP_DEBUG is not set # CONFIG_USB_MUSB_HDRC is not set # CONFIG_USB_DWC3 is not set CONFIG_USB_DWC2=y From 780d07ea794548f8760eec6a7d2b21c863ee1e32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Sun, 18 Apr 2021 22:03:53 +0200 Subject: [PATCH 12/18] Renaming the BSP package to armbian-bsp (#2779) * Renaming the BSP package to armbian-bsp Extracted from https://github.com/armbian/build/pull/2776 * Update naming * Create meta package for upgrade and remove deprecated mpv related config management * Probably we want to keep our internal release version in filename --- lib/distributions.sh | 2 +- lib/main.sh | 6 ++++-- lib/makeboarddeb.sh | 29 ++++++++++++++++++++++------- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/lib/distributions.sh b/lib/distributions.sh index 43164ac23..8037e22fd 100644 --- a/lib/distributions.sh +++ b/lib/distributions.sh @@ -292,7 +292,7 @@ install_common() # install board support packages if [[ "${REPOSITORY_INSTALL}" != *bsp* ]]; then - install_deb_chroot "${DEB_STORAGE}/$RELEASE/${CHOSEN_ROOTFS}_${REVISION}_${ARCH}.deb" >> "${DEST}"/debug/install.log 2>&1 + install_deb_chroot "${DEB_STORAGE}/$RELEASE/${BSP_CLI_PACKAGE_FULLNAME}.deb" >> "${DEST}"/debug/install.log 2>&1 else install_deb_chroot "${CHOSEN_ROOTFS}" "remote" fi diff --git a/lib/main.sh b/lib/main.sh index c7fb48532..850dcbcf0 100644 --- a/lib/main.sh +++ b/lib/main.sh @@ -392,13 +392,15 @@ BOOTSOURCEDIR="${BOOTDIR}/$(branch2dir "${BOOTBRANCH}")" LINUXSOURCEDIR="${KERNELDIR}/$(branch2dir "${KERNELBRANCH}")" [[ -n $ATFSOURCE ]] && ATFSOURCEDIR="${ATFDIR}/$(branch2dir "${ATFBRANCH}")" +BSP_CLI_PACKAGE_NAME="armbian-bsp-cli-${BOARD}" +BSP_CLI_PACKAGE_FULLNAME="${BSP_CLI_PACKAGE_NAME}_${REVISION}_${ARCH}" # define package names DEB_BRANCH=${BRANCH//default} # if not empty, append hyphen DEB_BRANCH=${DEB_BRANCH:+${DEB_BRANCH}-} CHOSEN_UBOOT=linux-u-boot-${DEB_BRANCH}${BOARD} CHOSEN_KERNEL=linux-image-${DEB_BRANCH}${LINUXFAMILY} -CHOSEN_ROOTFS=linux-${RELEASE}-root-${DEB_BRANCH}${BOARD} +CHOSEN_ROOTFS=${BSP_CLI_PACKAGE_NAME} CHOSEN_DESKTOP=armbian-${RELEASE}-desktop-${DESKTOP_ENVIRONMENT} CHOSEN_KSRC=linux-source-${BRANCH}-${LINUXFAMILY} @@ -492,7 +494,7 @@ fi overlayfs_wrapper "cleanup" # create board support package -[[ -n $RELEASE && ! -f ${DEB_STORAGE}/$RELEASE/${CHOSEN_ROOTFS}_${REVISION}_${ARCH}.deb ]] && create_board_package +[[ -n $RELEASE && ! -f ${DEB_STORAGE}/$RELEASE/${BSP_CLI_PACKAGE_FULLNAME}.deb ]] && create_board_package # create desktop package [[ -n $RELEASE && $DESKTOP_ENVIRONMENT && ! -f ${DEB_STORAGE}/$RELEASE/${CHOSEN_DESKTOP}_${REVISION}_all.deb ]] && create_desktop_package diff --git a/lib/makeboarddeb.sh b/lib/makeboarddeb.sh index f18234f12..6e7db3736 100644 --- a/lib/makeboarddeb.sh +++ b/lib/makeboarddeb.sh @@ -20,7 +20,7 @@ create_board_package() bsptempdir=$(mktemp -d) chmod 700 ${bsptempdir} trap "rm -rf \"${bsptempdir}\" ; exit 0" 0 1 2 3 15 - local destination=${bsptempdir}/${RELEASE}/${CHOSEN_ROOTFS}_${REVISION}_${ARCH} + local destination=${bsptempdir}/${RELEASE}/${BSP_CLI_PACKAGE_FULLNAME} mkdir -p "${destination}"/DEBIAN cd $destination @@ -50,7 +50,7 @@ create_board_package() # Depends: linux-base is needed for "linux-version" command in initrd cleanup script # Depends: fping is needed for armbianmonitor to upload armbian-hardware-monitor.log cat <<-EOF > "${destination}"/DEBIAN/control - Package: linux-${RELEASE}-root-${DEB_BRANCH}${BOARD} + Package: ${BSP_CLI_PACKAGE_NAME} Version: $REVISION Architecture: $ARCH Maintainer: $MAINTAINER <$MAINTAINERMAIL> @@ -63,7 +63,7 @@ create_board_package() Suggests: armbian-config Replaces: zram-config, base-files, armbian-tools-$RELEASE Recommends: bsdutils, parted, util-linux, toilet - Description: Armbian tweaks for $RELEASE on $BOARD ($BRANCH branch) + Description: Tweaks for Armbian $RELEASE on $BOARD EOF # set up pre install script @@ -122,9 +122,6 @@ create_board_package() [ -f "/lib/systemd/system/resize2fs.service" ] && rm /lib/systemd/system/resize2fs.service [ -f "/usr/lib/armbian/apt-updates" ] && rm /usr/lib/armbian/apt-updates [ -f "/usr/lib/armbian/firstrun-config.sh" ] && rm /usr/lib/armbian/firstrun-config.sh - # fix for https://bugs.launchpad.net/ubuntu/+source/lightdm-gtk-greeter/+bug/1897491 - [ -d "/var/lib/lightdm" ] && (chown -R lightdm:lightdm /var/lib/lightdm ; chmod 0750 /var/lib/lightdm) - dpkg-divert --quiet --package linux-${RELEASE}-root-${DEB_BRANCH}${BOARD} --add --rename --divert /etc/mpv/mpv-dist.conf /etc/mpv/mpv.conf exit 0 EOF @@ -135,7 +132,6 @@ create_board_package() #!/bin/sh if [ remove = "\$1" ] || [ abort-install = "\$1" ]; then - dpkg-divert --quiet --package linux-${RELEASE}-root-${DEB_BRANCH}${BOARD} --remove --rename --divert /etc/mpv/mpv-dist.conf /etc/mpv/mpv.conf systemctl disable armbian-hardware-monitor.service armbian-hardware-optimize.service >/dev/null 2>&1 systemctl disable armbian-zram-config.service armbian-ramlog.service >/dev/null 2>&1 @@ -324,6 +320,25 @@ fi fakeroot dpkg-deb -b "${destination}" "${destination}.deb" >> "${DEST}"/debug/install.log 2>&1 mkdir -p "${DEB_STORAGE}/${RELEASE}/" rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/${RELEASE}/" + + # Can be removed after 21.05 + # create meta package for upgrade + local destination=${bsptempdir}/${RELEASE}/linux-${RELEASE}-root-${DEB_BRANCH}${BOARD}_${REVISION}_${ARCH} + mkdir -p "${destination}"/DEBIAN + cat <<-EOF > "${destination}"/DEBIAN/control + Package: linux-${RELEASE}-root-${DEB_BRANCH}${BOARD} + Version: $REVISION + Architecture: $ARCH + Maintainer: $MAINTAINER <$MAINTAINERMAIL> + Pre-Depends: ${BSP_CLI_PACKAGE_NAME} + Description: Meta package that upgrades to ${BSP_CLI_PACKAGE_NAME} + EOF + display_alert "Building meta package" "$CHOSEN_ROOTFS" "info" + fakeroot dpkg-deb -b "${destination}" "${destination}.deb" >> "${DEST}"/debug/install.log 2>&1 + mkdir -p "${DEB_STORAGE}/${RELEASE}/" + rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/${RELEASE}/" + # Can be removed after 21.05 + # cleanup rm -rf ${bsptempdir} } From 510e348202f8efb838a57a9eec6ccbc910d7e06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Sun, 18 Apr 2021 22:48:56 +0200 Subject: [PATCH 13/18] 150balbes fix station legacy (#2782) * Fix Legacy Stations Co-authored-by: balbes150 --- ...acy.config => linux-station-legacy.config} | 526 +- config/kernel/linux-station-p1-legacy.config | 6387 ----------------- config/sources/families/rockchip64.conf | 9 +- .../zz-add-rk3399-roc-pc-make.patch | 3 +- .../zz-add-rk3399-roc-pc-mezzanine-dts.patch | 1229 ++++ .../zz-add-rk3399-roc-pc-plus-dts.patch | 859 +-- .../rockchip64-4.4/zzz-add-rk3399-cru-h.patch | 11 + .../zzz-add-rk3399-es8323-c.patch | 354 + .../zzz-add-rk3399-roc-pc-dts.patch | 13 + .../zzz-add-rk3399-roc-pc-dtsi.patch | 1443 ++++ .../zzz-add-rk3399-roc-pc-plus-dts.patch | 167 + 11 files changed, 3879 insertions(+), 7122 deletions(-) rename config/kernel/{linux-station-m1-legacy.config => linux-station-legacy.config} (95%) delete mode 100644 config/kernel/linux-station-p1-legacy.config create mode 100644 patch/kernel/archive/rockchip64-4.4/zz-add-rk3399-roc-pc-mezzanine-dts.patch create mode 100644 patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-cru-h.patch create mode 100644 patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-es8323-c.patch create mode 100644 patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-roc-pc-dts.patch create mode 100644 patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-roc-pc-dtsi.patch create mode 100644 patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-roc-pc-plus-dts.patch diff --git a/config/kernel/linux-station-m1-legacy.config b/config/kernel/linux-station-legacy.config similarity index 95% rename from config/kernel/linux-station-m1-legacy.config rename to config/kernel/linux-station-legacy.config index 231a2b355..1514cbaaf 100644 --- a/config/kernel/linux-station-m1-legacy.config +++ b/config/kernel/linux-station-legacy.config @@ -1140,12 +1140,16 @@ CONFIG_NET_FLOW_LIMIT=y CONFIG_BT=y CONFIG_BT_BREDR=y CONFIG_BT_RFCOMM=y -# CONFIG_BT_RFCOMM_TTY is not set -# CONFIG_BT_BNEP is not set +CONFIG_BT_RFCOMM_TTY=y +CONFIG_BT_BNEP=m +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y CONFIG_BT_HIDP=y CONFIG_BT_HS=y CONFIG_BT_LE=y -# CONFIG_BT_SELFTEST is not set +CONFIG_BT_SELFTEST=y +CONFIG_BT_SELFTEST_ECDH=y +CONFIG_BT_SELFTEST_SMP=y CONFIG_BT_DEBUGFS=y # @@ -1154,27 +1158,28 @@ CONFIG_BT_DEBUGFS=y CONFIG_BT_INTEL=y CONFIG_BT_BCM=y CONFIG_BT_RTL=y +CONFIG_BT_QCA=y # CONFIG_BT_RTKBTUSB is not set CONFIG_BT_HCIBTUSB=y CONFIG_BT_HCIBTUSB_BCM=y CONFIG_BT_HCIBTUSB_RTL=y -# CONFIG_BT_HCIBTSDIO is not set +CONFIG_BT_HCIBTSDIO=m CONFIG_BT_HCIUART=y CONFIG_BT_HCIUART_H4=y -# CONFIG_BT_HCIUART_BCSP is not set +CONFIG_BT_HCIUART_BCSP=y CONFIG_BT_HCIUART_ATH3K=y CONFIG_BT_HCIUART_LL=y -# CONFIG_BT_HCIUART_3WIRE is not set -# CONFIG_BT_HCIUART_INTEL is not set -# CONFIG_BT_HCIUART_BCM is not set -# CONFIG_BT_HCIUART_QCA is not set -# CONFIG_BT_HCIBCM203X is not set -# CONFIG_BT_HCIBPA10X is not set +CONFIG_BT_HCIUART_3WIRE=y +CONFIG_BT_HCIUART_INTEL=y +CONFIG_BT_HCIUART_BCM=y +CONFIG_BT_HCIUART_QCA=y +CONFIG_BT_HCIBCM203X=m +CONFIG_BT_HCIBPA10X=m CONFIG_BT_HCIBFUSB=y CONFIG_BT_HCIVHCI=y CONFIG_BT_MRVL=y CONFIG_BT_MRVL_SDIO=y -# CONFIG_BT_ATH3K is not set +CONFIG_BT_ATH3K=m # CONFIG_AF_RXRPC is not set CONFIG_FIB_RULES=y CONFIG_WIRELESS=y @@ -1233,7 +1238,16 @@ CONFIG_RFKILL_INPUT=y CONFIG_CEPH_LIB=m # CONFIG_CEPH_LIB_PRETTYDEBUG is not set # CONFIG_CEPH_LIB_USE_DNS_RESOLVER is not set -# CONFIG_NFC is not set +CONFIG_NFC=m +# CONFIG_NFC_DIGITAL is not set +# CONFIG_NFC_NCI is not set +# CONFIG_NFC_HCI is not set + +# +# Near Field Communication (NFC) devices +# +# CONFIG_NFC_PN533 is not set +# CONFIG_NFC_SIM is not set CONFIG_LWTUNNEL=y CONFIG_DST_CACHE=y CONFIG_HAVE_BPF_JIT=y @@ -1425,7 +1439,7 @@ CONFIG_BLK_DEV_NVME=y # # Misc devices # -# CONFIG_ROCKCHIP_SCR is not set +CONFIG_ROCKCHIP_SCR=y # CONFIG_SENSORS_LIS3LV02D is not set # CONFIG_AD525X_DPOT is not set # CONFIG_DUMMY_IRQ is not set @@ -1528,7 +1542,7 @@ CONFIG_BLK_DEV_SD=y # CONFIG_CHR_DEV_OSST is not set CONFIG_BLK_DEV_SR=y # CONFIG_BLK_DEV_SR_VENDOR is not set -# CONFIG_CHR_DEV_SG is not set +CONFIG_CHR_DEV_SG=y # CONFIG_CHR_DEV_SCH is not set # CONFIG_SCSI_CONSTANTS is not set CONFIG_SCSI_LOGGING=y @@ -1604,7 +1618,7 @@ CONFIG_SATA_PMP=y # CONFIG_SATA_AHCI=y CONFIG_SATA_AHCI_PLATFORM=y -# CONFIG_AHCI_CEVA is not set +CONFIG_AHCI_CEVA=y # CONFIG_AHCI_QORIQ is not set # CONFIG_SATA_INIC162X is not set # CONFIG_SATA_ACARD_AHCI is not set @@ -1683,7 +1697,7 @@ CONFIG_ATA_BMDMA=y # # Generic fallback / legacy drivers # -# CONFIG_ATA_GENERIC is not set +CONFIG_ATA_GENERIC=y # CONFIG_PATA_LEGACY is not set CONFIG_MD=y CONFIG_BLK_DEV_MD=m @@ -2128,7 +2142,7 @@ CONFIG_B43_BUSES_BCMA_AND_SSB=y # CONFIG_B43_BUSES_SSB is not set CONFIG_B43_PCI_AUTOSELECT=y CONFIG_B43_PCICORE_AUTOSELECT=y -# CONFIG_B43_SDIO is not set +CONFIG_B43_SDIO=y CONFIG_B43_BCMA_PIO=y CONFIG_B43_PIO=y CONFIG_B43_PHY_G=y @@ -2223,11 +2237,11 @@ CONFIG_RTL8723DS=m # CONFIG_SSV6051 is not set # CONFIG_WL_TI is not set CONFIG_RTL8822BS=m -# CONFIG_RTL8723DU is not set +CONFIG_RTL8723DU=m CONFIG_RTL8822BU=m CONFIG_RTL8821CU=m CONFIG_88XXAU=m -# CONFIG_RTL8192EU is not set +CONFIG_RTL8192EU=m CONFIG_ZD1211RW=m # CONFIG_ZD1211RW_DEBUG is not set CONFIG_MWIFIEX=m @@ -2392,6 +2406,7 @@ CONFIG_TOUCHSCREEN_ELAN=y # CONFIG_TOUCHSCREEN_TOUCHWIN is not set # CONFIG_TOUCHSCREEN_PIXCIR is not set # CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set +# CONFIG_TOUCHSCREEN_WM97XX is not set CONFIG_TOUCHSCREEN_USB_COMPOSITE=y CONFIG_TOUCHSCREEN_USB_EGALAX=y CONFIG_TOUCHSCREEN_USB_PANJIT=y @@ -2421,7 +2436,6 @@ CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y # CONFIG_TOUCHSCREEN_SX8654 is not set # CONFIG_TOUCHSCREEN_TPS6507X is not set # CONFIG_TOUCHSCREEN_ZFORCE is not set -CONFIG_TOUCHSCREEN_COLIBRI_VF50=m # CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set # CONFIG_TOUCHSCREEN_VTL_CT36X is not set CONFIG_TOUCHSCREEN_GT1X=y @@ -3052,7 +3066,7 @@ CONFIG_SSB_PCIHOST_POSSIBLE=y CONFIG_SSB_PCIHOST=y CONFIG_SSB_B43_PCI_BRIDGE=y CONFIG_SSB_SDIOHOST_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set +CONFIG_SSB_SDIOHOST=y # CONFIG_SSB_HOST_SOC is not set # CONFIG_SSB_SILENT is not set # CONFIG_SSB_DEBUG is not set @@ -3124,6 +3138,7 @@ CONFIG_MFD_CROS_EC_SPI=y # CONFIG_MFD_VIPERBOARD is not set # CONFIG_MFD_RETU is not set # CONFIG_MFD_PCF50633 is not set +# CONFIG_UCB1400_CORE is not set # CONFIG_MFD_RDC321X is not set # CONFIG_MFD_RTSX_PCI is not set # CONFIG_MFD_RT5033 is not set @@ -3227,7 +3242,7 @@ CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y CONFIG_MEDIA_SDR_SUPPORT=y CONFIG_MEDIA_RC_SUPPORT=y CONFIG_MEDIA_CEC_SUPPORT=y -# CONFIG_MEDIA_CEC_RC is not set +CONFIG_MEDIA_CEC_RC=y CONFIG_MEDIA_CONTROLLER=y CONFIG_VIDEO_DEV=y CONFIG_VIDEO_V4L2_SUBDEV_API=y @@ -3434,8 +3449,8 @@ CONFIG_V4L_PLATFORM_DRIVERS=y CONFIG_SOC_CAMERA=y # CONFIG_SOC_CAMERA_PLATFORM is not set # CONFIG_VIDEO_XILINX is not set -# CONFIG_VIDEO_RK_CIF_ISP10 is not set -# CONFIG_VIDEO_ROCKCHIP_CIF is not set +CONFIG_VIDEO_RK_CIF_ISP10=y +CONFIG_VIDEO_ROCKCHIP_CIF=y CONFIG_VIDEO_ROCKCHIP_ISP1=y CONFIG_V4L_MEM2MEM_DRIVERS=y # CONFIG_VIDEO_MEM2MEM_DEINTERLACE is not set @@ -3545,7 +3560,7 @@ CONFIG_VIDEO_CX25840=m # # Camera sensor devices # -# CONFIG_VIDEO_IMX219 is not set +CONFIG_VIDEO_IMX219=y # CONFIG_VIDEO_IMX323 is not set # CONFIG_VIDEO_VIRT_CAMERA is not set # CONFIG_VIDEO_OV2659 is not set @@ -3553,7 +3568,7 @@ CONFIG_VIDEO_CX25840=m # CONFIG_VIDEO_OV2718 is not set # CONFIG_VIDEO_OV2735 is not set CONFIG_VIDEO_OV4689=y -# CONFIG_VIDEO_OV5647 is not set +CONFIG_VIDEO_OV5647=y # CONFIG_VIDEO_OV5695 is not set # CONFIG_VIDEO_OV7251 is not set # CONFIG_VIDEO_OV7640 is not set @@ -3636,6 +3651,16 @@ CONFIG_VIDEO_SC031GS=y # CONFIG_SOC_CAMERA_OV9740 is not set # CONFIG_SOC_CAMERA_RJ54N1 is not set # CONFIG_SOC_CAMERA_TW9910 is not set +# CONFIG_VIDEO_OV8858 is not set +# CONFIG_VIDEO_OV2710 is not set +# CONFIG_VIDEO_TC358749XBG is not set +# CONFIG_VIDEO_ADV7181 is not set +# CONFIG_VIDEO_OV7675 is not set +# CONFIG_VIDEO_NT99230 is not set +# CONFIG_VIDEO_OV9281 is not set +# CONFIG_VIDEO_OV9750 is not set +# CONFIG_VIDEO_ov5640 is not set +# CONFIG_VIDEO_SC2232 is not set # # SPI helper chips @@ -4120,11 +4145,13 @@ CONFIG_SND_PROC_FS=y CONFIG_SND_VERBOSE_PROCFS=y # CONFIG_SND_VERBOSE_PRINTK is not set # CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y CONFIG_SND_RAWMIDI_SEQ=y # CONFIG_SND_OPL3_LIB_SEQ is not set # CONFIG_SND_OPL4_LIB_SEQ is not set # CONFIG_SND_SBAWE_SEQ is not set # CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_AC97_CODEC=m CONFIG_SND_DRIVERS=y # CONFIG_SND_DUMMY is not set # CONFIG_SND_ALOOP is not set @@ -4132,6 +4159,7 @@ CONFIG_SND_DRIVERS=y # CONFIG_SND_MTPAV is not set # CONFIG_SND_SERIAL_U16550 is not set # CONFIG_SND_MPU401 is not set +# CONFIG_SND_AC97_POWER_SAVE is not set CONFIG_SND_PCI=y # CONFIG_SND_AD1889 is not set # CONFIG_SND_ALS300 is not set @@ -4215,6 +4243,7 @@ CONFIG_SND_USB_AUDIO=y # CONFIG_SND_USB_TONEPORT is not set # CONFIG_SND_USB_VARIAX is not set CONFIG_SND_SOC=y +CONFIG_SND_SOC_AC97_BUS=y CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y # CONFIG_SND_ATMEL_SOC is not set # CONFIG_SND_DESIGNWARE_I2S is not set @@ -4236,18 +4265,18 @@ CONFIG_SND_SOC_ROCKCHIP=y # CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM is not set CONFIG_SND_SOC_ROCKCHIP_I2S=y CONFIG_SND_SOC_ROCKCHIP_I2S_TDM=y -# CONFIG_SND_SOC_ROCKCHIP_MULTI_DAIS is not set +CONFIG_SND_SOC_ROCKCHIP_MULTI_DAIS=m CONFIG_SND_SOC_ROCKCHIP_PDM=y CONFIG_SND_SOC_ROCKCHIP_SPDIF=y -# CONFIG_SND_SOC_ROCKCHIP_SPDIFRX is not set +CONFIG_SND_SOC_ROCKCHIP_SPDIFRX=m # CONFIG_SND_SOC_ROCKCHIP_VAD is not set -# CONFIG_SND_SOC_ROCKCHIP_DA7219 is not set +CONFIG_SND_SOC_ROCKCHIP_DA7219=m CONFIG_SND_SOC_ROCKCHIP_HDMI_ANALOG=y CONFIG_SND_SOC_ROCKCHIP_HDMI_DP=y CONFIG_SND_SOC_ROCKCHIP_MAX98090=y CONFIG_SND_SOC_ROCKCHIP_MULTICODECS=y CONFIG_SND_SOC_ROCKCHIP_RT5645=y -# CONFIG_SND_SOC_ROCKCHIP_RT5651_TC358749 is not set +CONFIG_SND_SOC_ROCKCHIP_RT5651_TC358749=m CONFIG_SND_SOC_ROCKCHIP_CDNDP=y # @@ -4260,94 +4289,105 @@ CONFIG_SND_SOC_I2C_AND_SPI=y # # CODEC drivers # -# CONFIG_SND_SOC_AC97_CODEC is not set -# CONFIG_SND_SOC_ADAU1701 is not set -# CONFIG_SND_SOC_AK4104 is not set -# CONFIG_SND_SOC_AK4554 is not set -# CONFIG_SND_SOC_AK4613 is not set -# CONFIG_SND_SOC_AK4642 is not set -# CONFIG_SND_SOC_AK5386 is not set -# CONFIG_SND_SOC_ALC5623 is not set -# CONFIG_SND_SOC_CS35L32 is not set -# CONFIG_SND_SOC_CS42L51_I2C is not set -# CONFIG_SND_SOC_CS42L52 is not set -# CONFIG_SND_SOC_CS42L56 is not set -# CONFIG_SND_SOC_CS42L73 is not set -# CONFIG_SND_SOC_CS4265 is not set -# CONFIG_SND_SOC_CS4270 is not set -# CONFIG_SND_SOC_CS4271_I2C is not set -# CONFIG_SND_SOC_CS4271_SPI is not set -# CONFIG_SND_SOC_CS42XX8_I2C is not set -# CONFIG_SND_SOC_CS4349 is not set -# CONFIG_SND_SOC_CX2072X is not set +CONFIG_SND_SOC_AC97_CODEC=m +CONFIG_SND_SOC_ADAU1701=m +CONFIG_SND_SOC_AK4104=m +CONFIG_SND_SOC_AK4554=m +CONFIG_SND_SOC_AK4613=m +CONFIG_SND_SOC_AK4642=m +CONFIG_SND_SOC_AK5386=m +CONFIG_SND_SOC_ALC5623=m +CONFIG_SND_SOC_CS35L32=m +CONFIG_SND_SOC_CS42L51=m +CONFIG_SND_SOC_CS42L51_I2C=m +CONFIG_SND_SOC_CS42L52=m +CONFIG_SND_SOC_CS42L56=m +CONFIG_SND_SOC_CS42L73=m +CONFIG_SND_SOC_CS4265=m +CONFIG_SND_SOC_CS4270=m +CONFIG_SND_SOC_CS4271=m +CONFIG_SND_SOC_CS4271_I2C=m +CONFIG_SND_SOC_CS4271_SPI=m +CONFIG_SND_SOC_CS42XX8=m +CONFIG_SND_SOC_CS42XX8_I2C=m +CONFIG_SND_SOC_CS4349=m +CONFIG_SND_SOC_CX2072X=m # CONFIG_SND_SOC_CX20810 is not set -# CONFIG_SND_SOC_DUMMY_CODEC is not set -# CONFIG_SND_SOC_BT_SCO is not set +CONFIG_SND_SOC_DA7219=m +CONFIG_SND_SOC_DUMMY_CODEC=m +CONFIG_SND_SOC_BT_SCO=m CONFIG_SND_SOC_ES8316=y CONFIG_SND_SOC_ES8323=y CONFIG_SND_SOC_HDMI_CODEC=y CONFIG_SND_SOC_ES8328=y CONFIG_SND_SOC_ES8328_I2C=y -# CONFIG_SND_SOC_ES8396 is not set -# CONFIG_SND_SOC_GTM601 is not set -# CONFIG_SND_SOC_GVA_CODEC is not set -# CONFIG_SND_SOC_FM1288 is not set +CONFIG_SND_SOC_ES8396=m +CONFIG_SND_SOC_GTM601=m +CONFIG_SND_SOC_GVA_CODEC=m +CONFIG_SND_SOC_FM1288=m CONFIG_SND_SOC_MAX98090=y -# CONFIG_SND_SOC_PCM1681 is not set -# CONFIG_SND_SOC_PCM1792A is not set -# CONFIG_SND_SOC_PCM512x_I2C is not set -# CONFIG_SND_SOC_PCM512x_SPI is not set -# CONFIG_SND_SOC_RK312X is not set -# CONFIG_SND_SOC_RK3228 is not set +CONFIG_SND_SOC_PCM1681=m +CONFIG_SND_SOC_PCM1792A=m +CONFIG_SND_SOC_PCM512x=m +CONFIG_SND_SOC_PCM512x_I2C=m +CONFIG_SND_SOC_PCM512x_SPI=m +CONFIG_SND_SOC_RK312X=m +CONFIG_SND_SOC_RK3228=m CONFIG_SND_SOC_RK3308=y CONFIG_SND_SOC_RK3328=y CONFIG_SND_SOC_RK817=y CONFIG_SND_SOC_RL6231=y CONFIG_SND_SOC_RT5616=y -# CONFIG_SND_SOC_RT5631 is not set +CONFIG_SND_SOC_RT5631=m CONFIG_SND_SOC_RT5640=y CONFIG_SND_SOC_RT5645=y CONFIG_SND_SOC_RT5651=y # CONFIG_SND_SOC_RT5677_SPI is not set -# CONFIG_SND_SOC_SGTL5000 is not set -# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set +CONFIG_SND_SOC_SGTL5000=m +CONFIG_SND_SOC_SIGMADSP=m +CONFIG_SND_SOC_SIGMADSP_I2C=m +CONFIG_SND_SOC_SIRF_AUDIO_CODEC=m CONFIG_SND_SOC_SPDIF=y -# CONFIG_SND_SOC_SSM2602_SPI is not set -# CONFIG_SND_SOC_SSM2602_I2C is not set -# CONFIG_SND_SOC_SSM4567 is not set -# CONFIG_SND_SOC_STA32X is not set -# CONFIG_SND_SOC_STA350 is not set -# CONFIG_SND_SOC_STI_SAS is not set -# CONFIG_SND_SOC_TAS2552 is not set -# CONFIG_SND_SOC_TAS5086 is not set -# CONFIG_SND_SOC_TAS571X is not set -# CONFIG_SND_SOC_TC358749X is not set -# CONFIG_SND_SOC_TFA9879 is not set -# CONFIG_SND_SOC_TLV320AIC23_I2C is not set -# CONFIG_SND_SOC_TLV320AIC23_SPI is not set -# CONFIG_SND_SOC_TLV320AIC31XX is not set -# CONFIG_SND_SOC_TLV320AIC3X is not set +CONFIG_SND_SOC_SSM2602=m +CONFIG_SND_SOC_SSM2602_SPI=m +CONFIG_SND_SOC_SSM2602_I2C=m +CONFIG_SND_SOC_SSM4567=m +CONFIG_SND_SOC_STA32X=m +CONFIG_SND_SOC_STA350=m +CONFIG_SND_SOC_STI_SAS=m +CONFIG_SND_SOC_TAS2552=m +CONFIG_SND_SOC_TAS5086=m +CONFIG_SND_SOC_TAS571X=m +CONFIG_SND_SOC_TC358749X=m +CONFIG_SND_SOC_TFA9879=m +CONFIG_SND_SOC_TLV320AIC23=m +CONFIG_SND_SOC_TLV320AIC23_I2C=m +CONFIG_SND_SOC_TLV320AIC23_SPI=m +CONFIG_SND_SOC_TLV320AIC31XX=m +CONFIG_SND_SOC_TLV320AIC3X=m CONFIG_SND_SOC_TS3A227E=y -# CONFIG_SND_SOC_WM8510 is not set -# CONFIG_SND_SOC_WM8523 is not set -# CONFIG_SND_SOC_WM8580 is not set -# CONFIG_SND_SOC_WM8711 is not set -# CONFIG_SND_SOC_WM8728 is not set -# CONFIG_SND_SOC_WM8731 is not set -# CONFIG_SND_SOC_WM8737 is not set -# CONFIG_SND_SOC_WM8741 is not set -# CONFIG_SND_SOC_WM8750 is not set -# CONFIG_SND_SOC_WM8753 is not set -# CONFIG_SND_SOC_WM8770 is not set -# CONFIG_SND_SOC_WM8776 is not set -# CONFIG_SND_SOC_WM8804_I2C is not set -# CONFIG_SND_SOC_WM8804_SPI is not set -# CONFIG_SND_SOC_WM8903 is not set -# CONFIG_SND_SOC_WM8962 is not set -# CONFIG_SND_SOC_WM8978 is not set -# CONFIG_SND_SOC_TPA6130A2 is not set +CONFIG_SND_SOC_WM8510=m +CONFIG_SND_SOC_WM8523=m +CONFIG_SND_SOC_WM8580=m +CONFIG_SND_SOC_WM8711=m +CONFIG_SND_SOC_WM8728=m +CONFIG_SND_SOC_WM8731=m +CONFIG_SND_SOC_WM8737=m +CONFIG_SND_SOC_WM8741=m +CONFIG_SND_SOC_WM8750=m +CONFIG_SND_SOC_WM8753=m +CONFIG_SND_SOC_WM8770=m +CONFIG_SND_SOC_WM8776=m +CONFIG_SND_SOC_WM8804=m +CONFIG_SND_SOC_WM8804_I2C=m +CONFIG_SND_SOC_WM8804_SPI=m +CONFIG_SND_SOC_WM8903=m +CONFIG_SND_SOC_WM8962=m +CONFIG_SND_SOC_WM8978=m +CONFIG_SND_SOC_TPA6130A2=m CONFIG_SND_SIMPLE_CARD=y CONFIG_SOUND_PRIME=y +CONFIG_AC97_BUS=y # # HID support @@ -4518,7 +4558,7 @@ CONFIG_USB_WDM=m # # also be needed; see USB_STORAGE Help for more info # -CONFIG_USB_STORAGE=m +CONFIG_USB_STORAGE=y # CONFIG_USB_STORAGE_DEBUG is not set CONFIG_USB_STORAGE_REALTEK=m CONFIG_REALTEK_AUTOPM=y @@ -4683,7 +4723,7 @@ CONFIG_USB_PHY=y CONFIG_USB_GADGET=y # CONFIG_USB_GADGET_DEBUG is not set CONFIG_USB_GADGET_DEBUG_FILES=y -CONFIG_USB_GADGET_DEBUG_FS=y +# CONFIG_USB_GADGET_DEBUG_FS is not set CONFIG_USB_GADGET_VBUS_DRAW=500 CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 @@ -5201,11 +5241,12 @@ CONFIG_COMMON_CLK_XGENE=y # CONFIG_COMMON_CLK_PWM is not set # CONFIG_COMMON_CLK_PXA is not set # CONFIG_COMMON_CLK_CDCE706 is not set +CONFIG_HWSPINLOCK=m # # Hardware Spinlock drivers # -# CONFIG_HWSPINLOCK_ROCKCHIP is not set +CONFIG_HWSPINLOCK_ROCKCHIP=m # # Clock Source drivers @@ -5273,10 +5314,10 @@ CONFIG_ROCKCHIP_CPUINFO=y # CONFIG_ROCKCHIP_DEVICEINFO is not set CONFIG_ROCKCHIP_IPA=y CONFIG_ROCKCHIP_OPP=y -# CONFIG_ROCKCHIP_PM_TEST is not set +CONFIG_ROCKCHIP_PM_TEST=y CONFIG_ROCKCHIP_GRF=y CONFIG_ROCKCHIP_PM_DOMAINS=y -# CONFIG_ROCKCHIP_PVTM is not set +CONFIG_ROCKCHIP_PVTM=y CONFIG_ROCKCHIP_SUSPEND_MODE=y # CONFIG_ROCKCHIP_VENDOR_STORAGE is not set # CONFIG_SUNXI_SRAM is not set @@ -5315,57 +5356,49 @@ CONFIG_IIO=y CONFIG_IIO_BUFFER=y # CONFIG_IIO_BUFFER_CB is not set CONFIG_IIO_KFIFO_BUF=y -CONFIG_IIO_TRIGGERED_BUFFER=y CONFIG_IIO_TRIGGER=y CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 -CONFIG_IIO_TRIGGERED_EVENT=m # # Accelerometers # -CONFIG_BMA180=m -CONFIG_BMC150_ACCEL=m -CONFIG_BMC150_ACCEL_I2C=m -CONFIG_BMC150_ACCEL_SPI=m -CONFIG_HID_SENSOR_ACCEL_3D=m -CONFIG_IIO_ST_ACCEL_3AXIS=m -CONFIG_IIO_ST_ACCEL_I2C_3AXIS=m -CONFIG_IIO_ST_ACCEL_SPI_3AXIS=m -CONFIG_KXSD9=m -CONFIG_KXCJK1013=m -CONFIG_MMA8452=m -CONFIG_MMA9551_CORE=m -CONFIG_MMA9551=m -CONFIG_MMA9553=m -CONFIG_MXC4005=m -CONFIG_STK8312=m -CONFIG_STK8BA50=m +# CONFIG_BMA180 is not set +# CONFIG_BMC150_ACCEL is not set +# CONFIG_HID_SENSOR_ACCEL_3D is not set +# CONFIG_IIO_ST_ACCEL_3AXIS is not set +# CONFIG_KXSD9 is not set +# CONFIG_KXCJK1013 is not set +# CONFIG_MMA8452 is not set +# CONFIG_MMA9551 is not set +# CONFIG_MMA9553 is not set +# CONFIG_MXC4005 is not set +# CONFIG_STK8312 is not set +# CONFIG_STK8BA50 is not set # # Analog to digital converters # -CONFIG_AD_SIGMA_DELTA=m -CONFIG_AD7266=m -CONFIG_AD7291=m -CONFIG_AD7298=m -CONFIG_AD7476=m -CONFIG_AD7791=m -CONFIG_AD7793=m -CONFIG_AD7887=m -CONFIG_AD7923=m -CONFIG_AD799X=m -CONFIG_CC10001_ADC=m -CONFIG_GPIO_MUXADC=m -CONFIG_HI8435=m -CONFIG_MAX1027=m -CONFIG_MAX1363=m -CONFIG_MCP320X=m -CONFIG_MCP3422=m -CONFIG_NAU7802=m -CONFIG_ROCKCHIP_SARADC=m -CONFIG_TI_ADC081C=m -CONFIG_TI_ADC128S052=m -CONFIG_VF610_ADC=m +# CONFIG_AD7266 is not set +# CONFIG_AD7291 is not set +# CONFIG_AD7298 is not set +# CONFIG_AD7476 is not set +# CONFIG_AD7791 is not set +# CONFIG_AD7793 is not set +# CONFIG_AD7887 is not set +# CONFIG_AD7923 is not set +# CONFIG_AD799X is not set +# CONFIG_CC10001_ADC is not set +# CONFIG_GPIO_MUXADC is not set +# CONFIG_HI8435 is not set +# CONFIG_MAX1027 is not set +# CONFIG_MAX1363 is not set +# CONFIG_MCP320X is not set +# CONFIG_MCP3422 is not set +# CONFIG_NAU7802 is not set +CONFIG_ROCKCHIP_SARADC=y +# CONFIG_TI_ADC081C is not set +# CONFIG_TI_ADC128S052 is not set +# CONFIG_VF610_ADC is not set # # Amplifiers @@ -5375,44 +5408,39 @@ CONFIG_VF610_ADC=m # # Chemical Sensors # -CONFIG_VZ89X=m +# CONFIG_VZ89X is not set # # Hid Sensor IIO Common # -CONFIG_HID_SENSOR_IIO_COMMON=m -CONFIG_HID_SENSOR_IIO_TRIGGER=m -CONFIG_IIO_MS_SENSORS_I2C=m +# CONFIG_HID_SENSOR_IIO_COMMON is not set # # SSP Sensor Common # # CONFIG_IIO_SSP_SENSORHUB is not set -CONFIG_IIO_ST_SENSORS_I2C=m -CONFIG_IIO_ST_SENSORS_SPI=m -CONFIG_IIO_ST_SENSORS_CORE=m # # Digital to analog converters # -CONFIG_AD5064=m -CONFIG_AD5360=m -CONFIG_AD5380=m -CONFIG_AD5421=m -CONFIG_AD5446=m -CONFIG_AD5449=m -CONFIG_AD5504=m -CONFIG_AD5624R_SPI=m -CONFIG_AD5686=m -CONFIG_AD5755=m -CONFIG_AD5764=m -CONFIG_AD5791=m -CONFIG_AD7303=m -CONFIG_M62332=m -CONFIG_MAX517=m -CONFIG_MAX5821=m -CONFIG_MCP4725=m -CONFIG_MCP4922=m +# CONFIG_AD5064 is not set +# CONFIG_AD5360 is not set +# CONFIG_AD5380 is not set +# CONFIG_AD5421 is not set +# CONFIG_AD5446 is not set +# CONFIG_AD5449 is not set +# CONFIG_AD5504 is not set +# CONFIG_AD5624R_SPI is not set +# CONFIG_AD5686 is not set +# CONFIG_AD5755 is not set +# CONFIG_AD5764 is not set +# CONFIG_AD5791 is not set +# CONFIG_AD7303 is not set +# CONFIG_M62332 is not set +# CONFIG_MAX517 is not set +# CONFIG_MAX5821 is not set +# CONFIG_MCP4725 is not set +# CONFIG_MCP4922 is not set # # Frequency Synthesizers DDS/PLL @@ -5431,87 +5459,79 @@ CONFIG_MCP4922=m # # Digital gyroscope sensors # -CONFIG_ADIS16080=m -CONFIG_ADIS16130=m -CONFIG_ADIS16136=m -CONFIG_ADIS16260=m -CONFIG_ADXRS450=m -CONFIG_BMG160=m -CONFIG_BMG160_I2C=m -CONFIG_BMG160_SPI=m -CONFIG_HID_SENSOR_GYRO_3D=m -CONFIG_IIO_ST_GYRO_3AXIS=m -CONFIG_IIO_ST_GYRO_I2C_3AXIS=m -CONFIG_IIO_ST_GYRO_SPI_3AXIS=m -CONFIG_ITG3200=m +# CONFIG_ADIS16080 is not set +# CONFIG_ADIS16130 is not set +# CONFIG_ADIS16136 is not set +# CONFIG_ADIS16260 is not set +# CONFIG_ADXRS450 is not set +# CONFIG_BMG160 is not set +# CONFIG_HID_SENSOR_GYRO_3D is not set +# CONFIG_IIO_ST_GYRO_3AXIS is not set +# CONFIG_ITG3200 is not set # # Humidity sensors # -CONFIG_DHT11=m -CONFIG_HDC100X=m -CONFIG_HTU21=m -CONFIG_SI7005=m -CONFIG_SI7020=m +# CONFIG_DHT11 is not set +# CONFIG_HDC100X is not set +# CONFIG_HTU21 is not set +# CONFIG_SI7005 is not set +# CONFIG_SI7020 is not set # # Inertial measurement units # -CONFIG_ADIS16400=m -CONFIG_ADIS16480=m -CONFIG_KMX61=m -CONFIG_INV_MPU6050_IIO=m -CONFIG_IIO_ADIS_LIB=m -CONFIG_IIO_ADIS_LIB_BUFFER=y +# CONFIG_ADIS16400 is not set +# CONFIG_ADIS16480 is not set +# CONFIG_KMX61 is not set +# CONFIG_INV_MPU6050_IIO is not set # # Light sensors # -CONFIG_ADJD_S311=m -CONFIG_AL3320A=m -CONFIG_APDS9300=m -CONFIG_APDS9960=m -CONFIG_BH1750=m -CONFIG_CM32181=m -CONFIG_CM3232=m -CONFIG_CM3323=m -CONFIG_CM36651=m -CONFIG_GP2AP020A00F=m -CONFIG_ISL29125=m -CONFIG_HID_SENSOR_ALS=m -CONFIG_HID_SENSOR_PROX=m -CONFIG_JSA1212=m -CONFIG_RPR0521=m -CONFIG_LTR501=m -CONFIG_OPT3001=m -CONFIG_PA12203001=m -CONFIG_STK3310=m -CONFIG_TCS3414=m -CONFIG_TCS3472=m +# CONFIG_ADJD_S311 is not set +# CONFIG_AL3320A is not set +# CONFIG_APDS9300 is not set +# CONFIG_APDS9960 is not set +# CONFIG_BH1750 is not set +# CONFIG_CM32181 is not set +# CONFIG_CM3232 is not set +# CONFIG_CM3323 is not set +# CONFIG_CM36651 is not set +# CONFIG_GP2AP020A00F is not set +# CONFIG_ISL29125 is not set +# CONFIG_HID_SENSOR_ALS is not set +# CONFIG_HID_SENSOR_PROX is not set +# CONFIG_JSA1212 is not set +# CONFIG_RPR0521 is not set +# CONFIG_LTR501 is not set +# CONFIG_OPT3001 is not set +# CONFIG_PA12203001 is not set +# CONFIG_STK3310 is not set +# CONFIG_TCS3414 is not set +# CONFIG_TCS3472 is not set CONFIG_SENSORS_TSL2563=y -CONFIG_TSL4531=m -CONFIG_US5182D=m -CONFIG_VCNL4000=m -CONFIG_VL6180=m +# CONFIG_TSL4531 is not set +# CONFIG_US5182D is not set +# CONFIG_VCNL4000 is not set +# CONFIG_VL6180 is not set # # Magnetometer sensors # -CONFIG_AK8975=m -CONFIG_AK09911=m -CONFIG_BMC150_MAGN=m -CONFIG_MAG3110=m -CONFIG_HID_SENSOR_MAGNETOMETER_3D=m -CONFIG_MMC35240=m -CONFIG_IIO_ST_MAGN_3AXIS=m -CONFIG_IIO_ST_MAGN_I2C_3AXIS=m -CONFIG_IIO_ST_MAGN_SPI_3AXIS=m +# CONFIG_AK8975 is not set +# CONFIG_AK09911 is not set +# CONFIG_BMC150_MAGN is not set +# CONFIG_MAG3110 is not set +# CONFIG_HID_SENSOR_MAGNETOMETER_3D is not set +# CONFIG_MMC35240 is not set +# CONFIG_IIO_ST_MAGN_3AXIS is not set # # Inclinometer sensors # -CONFIG_HID_SENSOR_INCLINOMETER_3D=m -CONFIG_HID_SENSOR_DEVICE_ROTATION=m +# CONFIG_HID_SENSOR_INCLINOMETER_3D is not set +# CONFIG_HID_SENSOR_DEVICE_ROTATION is not set # # Triggers - standalone @@ -5522,43 +5542,39 @@ CONFIG_IIO_SYSFS_TRIGGER=y # # Digital potentiometers # -CONFIG_MCP4531=m +# CONFIG_MCP4531 is not set # # Pressure sensors # -CONFIG_BMP280=m -CONFIG_HID_SENSOR_PRESS=m -CONFIG_MPL115=m -CONFIG_MPL3115=m -CONFIG_MS5611=m -CONFIG_MS5611_I2C=m -CONFIG_MS5611_SPI=m -CONFIG_MS5637=m -CONFIG_IIO_ST_PRESS=m -CONFIG_IIO_ST_PRESS_I2C=m -CONFIG_IIO_ST_PRESS_SPI=m -CONFIG_T5403=m +# CONFIG_BMP280 is not set +# CONFIG_HID_SENSOR_PRESS is not set +# CONFIG_MPL115 is not set +# CONFIG_MPL3115 is not set +# CONFIG_MS5611 is not set +# CONFIG_MS5637 is not set +# CONFIG_IIO_ST_PRESS is not set +# CONFIG_T5403 is not set # # Lightning sensors # -CONFIG_AS3935=m +# CONFIG_AS3935 is not set # # Proximity sensors # -CONFIG_LIDAR_LITE_V2=m -CONFIG_SRF04=m -CONFIG_SX9500=m +# CONFIG_LIDAR_LITE_V2 is not set +# CONFIG_SRF04 is not set +# CONFIG_SX9500 is not set # # Temperature sensors # -CONFIG_MLX90614=m -CONFIG_TMP006=m -CONFIG_TSYS01=m -CONFIG_TSYS02D=m +# CONFIG_MLX90614 is not set +# CONFIG_TMP006 is not set +# CONFIG_TSYS01 is not set +# CONFIG_TSYS02D is not set # CONFIG_NTB is not set # CONFIG_VME_BUS is not set CONFIG_PWM=y @@ -5568,7 +5584,7 @@ CONFIG_PWM_SYSFS=y # CONFIG_PWM_GPIO is not set # CONFIG_PWM_PCA9685 is not set CONFIG_PWM_ROCKCHIP=y -# CONFIG_PWM_ROCKCHIP_I2S is not set +CONFIG_PWM_ROCKCHIP_I2S=m CONFIG_IRQCHIP=y CONFIG_ARM_GIC=y CONFIG_ARM_GIC_V2M=y @@ -5598,7 +5614,7 @@ CONFIG_PHY_ROCKCHIP_DP=y CONFIG_PHY_ROCKCHIP_MIPI_RX=y CONFIG_PHY_ROCKCHIP_INNO_MIPI_DPHY=y CONFIG_PHY_ROCKCHIP_INNO_HDMI_PHY=y -# CONFIG_PHY_ROCKCHIP_INNO_VIDEO_PHY is not set +CONFIG_PHY_ROCKCHIP_INNO_VIDEO_PHY=m CONFIG_PHY_ROCKCHIP_INNO_VIDEO_COMBO_PHY=y CONFIG_PHY_ROCKCHIP_TYPEC=y CONFIG_PHY_ROCKCHIP_PCIE=y @@ -5717,7 +5733,7 @@ CONFIG_QUOTACTL=y CONFIG_AUTOFS4_FS=m CONFIG_FUSE_FS=y # CONFIG_CUSE is not set -CONFIG_OVERLAY_FS=m +CONFIG_OVERLAY_FS=y # # Caches @@ -5789,7 +5805,7 @@ CONFIG_SQUASHFS_DECOMP_SINGLE=y # CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set # CONFIG_SQUASHFS_XATTR is not set CONFIG_SQUASHFS_ZLIB=y -# CONFIG_SQUASHFS_LZ4 is not set +CONFIG_SQUASHFS_LZ4=y CONFIG_SQUASHFS_LZO=y CONFIG_SQUASHFS_XZ=y # CONFIG_SQUASHFS_ZSTD is not set diff --git a/config/kernel/linux-station-p1-legacy.config b/config/kernel/linux-station-p1-legacy.config deleted file mode 100644 index 2e319879f..000000000 --- a/config/kernel/linux-station-p1-legacy.config +++ /dev/null @@ -1,6387 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# Linux/arm64 4.4.213 Kernel Configuration -# -CONFIG_ARM64=y -CONFIG_64BIT=y -CONFIG_ARCH_PHYS_ADDR_T_64BIT=y -CONFIG_MMU=y -CONFIG_ARCH_MMAP_RND_BITS_MIN=18 -CONFIG_ARCH_MMAP_RND_BITS_MAX=24 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 -CONFIG_ARM64_PAGE_SHIFT=12 -CONFIG_ARM64_CONT_SHIFT=4 -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_ZONE_DMA=y -CONFIG_HAVE_GENERIC_RCU_GUP=y -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_SMP=y -CONFIG_SWIOTLB=y -CONFIG_IOMMU_HELPER=y -CONFIG_KERNEL_MODE_NEON=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_PGTABLE_LEVELS=3 -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_EXTABLE_SORT=y -CONFIG_THREAD_INFO_IN_TASK=y - -# -# General setup -# -CONFIG_INIT_ENV_ARG_LIMIT=32 -CONFIG_CROSS_COMPILE="" -# CONFIG_COMPILE_TEST is not set -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -CONFIG_DEFAULT_HOSTNAME="(none)" -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_FHANDLE=y -CONFIG_USELIB=y -CONFIG_AUDIT=y -CONFIG_HAVE_ARCH_AUDITSYSCALL=y -CONFIG_AUDITSYSCALL=y -CONFIG_AUDIT_WATCH=y -CONFIG_AUDIT_TREE=y - -# -# IRQ subsystem -# -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_IRQ_MIGRATION=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_MSI_IRQ_DOMAIN=y -CONFIG_HANDLE_DOMAIN_IRQ=y -# CONFIG_IRQ_DOMAIN_DEBUG is not set -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_SPARSE_IRQ=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y - -# -# Timers subsystem -# -CONFIG_TICK_ONESHOT=y -CONFIG_NO_HZ_COMMON=y -# CONFIG_HZ_PERIODIC is not set -CONFIG_NO_HZ_IDLE=y -# CONFIG_NO_HZ_FULL is not set -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y - -# -# CPU/Task time and stats accounting -# -CONFIG_TICK_CPU_ACCOUNTING=y -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_IRQ_TIME_ACCOUNTING is not set -# CONFIG_SCHED_WALT is not set -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_BSD_PROCESS_ACCT_V3=y -CONFIG_TASKSTATS=y -CONFIG_TASK_DELAY_ACCT=y -CONFIG_TASK_XACCT=y -CONFIG_TASK_IO_ACCOUNTING=y - -# -# RCU Subsystem -# -CONFIG_TREE_RCU=y -# CONFIG_RCU_EXPERT is not set -CONFIG_SRCU=y -# CONFIG_TASKS_RCU is not set -CONFIG_RCU_STALL_COMMON=y -# CONFIG_TREE_RCU_TRACE is not set -# CONFIG_RCU_EXPEDITE_BOOT is not set -CONFIG_BUILD_BIN2C=y -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=18 -CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_CGROUPS=y -# CONFIG_CGROUP_DEBUG is not set -CONFIG_CGROUP_FREEZER=y -CONFIG_CGROUP_PIDS=y -CONFIG_CGROUP_DEVICE=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_CGROUP_CPUACCT=y -CONFIG_PAGE_COUNTER=y -CONFIG_MEMCG=y -CONFIG_MEMCG_SWAP=y -CONFIG_MEMCG_SWAP_ENABLED=y -CONFIG_MEMCG_KMEM=y -CONFIG_CGROUP_HUGETLB=y -CONFIG_CGROUP_PERF=y -CONFIG_CGROUP_SCHED=y -CONFIG_FAIR_GROUP_SCHED=y -CONFIG_CFS_BANDWIDTH=y -CONFIG_RT_GROUP_SCHED=y -CONFIG_BLK_CGROUP=y -# CONFIG_DEBUG_BLK_CGROUP is not set -CONFIG_CGROUP_WRITEBACK=y -CONFIG_CHECKPOINT_RESTORE=y -CONFIG_NAMESPACES=y -CONFIG_UTS_NS=y -CONFIG_IPC_NS=y -CONFIG_USER_NS=y -CONFIG_PID_NS=y -CONFIG_NET_NS=y -# CONFIG_SCHED_AUTOGROUP is not set -# CONFIG_SCHED_TUNE is not set -CONFIG_DEFAULT_USE_ENERGY_AWARE=y -# CONFIG_SYSFS_DEPRECATED is not set -CONFIG_RELAY=y -CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_RD_GZIP=y -CONFIG_RD_BZIP2=y -CONFIG_RD_LZMA=y -CONFIG_RD_XZ=y -CONFIG_RD_LZO=y -CONFIG_RD_LZ4=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_SYSCTL=y -CONFIG_ANON_INODES=y -CONFIG_HAVE_UID16=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_BPF=y -CONFIG_EXPERT=y -CONFIG_UID16=y -CONFIG_MULTIUSER=y -# CONFIG_SGETMASK_SYSCALL is not set -CONFIG_SYSFS_SYSCALL=y -# CONFIG_SYSCTL_SYSCALL is not set -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -CONFIG_PRINTK=y -CONFIG_BUG=y -CONFIG_ELF_CORE=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -CONFIG_SIGNALFD=y -CONFIG_TIMERFD=y -CONFIG_EVENTFD=y -# CONFIG_BPF_SYSCALL is not set -CONFIG_SHMEM=y -CONFIG_AIO=y -CONFIG_ADVISE_SYSCALLS=y -# CONFIG_USERFAULTFD is not set -CONFIG_PCI_QUIRKS=y -CONFIG_MEMBARRIER=y -CONFIG_EMBEDDED=y -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_PERF_USE_VMALLOC=y - -# -# Kernel Performance Events And Counters -# -CONFIG_PERF_EVENTS=y -# CONFIG_DEBUG_PERF_USE_VMALLOC is not set -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_SLUB_DEBUG=y -# CONFIG_COMPAT_BRK is not set -# CONFIG_SLAB is not set -CONFIG_SLUB=y -# CONFIG_SLOB is not set -CONFIG_SLUB_CPU_PARTIAL=y -# CONFIG_SYSTEM_DATA_VERIFICATION is not set -CONFIG_PROFILING=y -CONFIG_TRACEPOINTS=y -# CONFIG_KPROBES is not set -# CONFIG_JUMP_LABEL is not set -# CONFIG_UPROBES is not set -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_HW_BREAKPOINT=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_RCU_TABLE_FREE=y -CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y -CONFIG_HAVE_CMPXCHG_LOCAL=y -CONFIG_HAVE_CMPXCHG_DOUBLE=y -CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_SECCOMP_FILTER=y -CONFIG_HAVE_CC_STACKPROTECTOR=y -# CONFIG_CC_STACKPROTECTOR is not set -CONFIG_CC_STACKPROTECTOR_NONE=y -# CONFIG_CC_STACKPROTECTOR_REGULAR is not set -# CONFIG_CC_STACKPROTECTOR_STRONG is not set -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y -CONFIG_HAVE_ARCH_HUGE_VMAP=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_HAVE_ARCH_MMAP_RND_BITS=y -CONFIG_ARCH_MMAP_RND_BITS=18 -CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y -CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 -CONFIG_CLONE_BACKWARDS=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_COMPAT_OLD_SIGACTION=y - -# -# GCOV-based kernel profiling -# -# CONFIG_GCOV_KERNEL is not set -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_SLABINFO=y -CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 -CONFIG_MODULES=y -CONFIG_MODULE_FORCE_LOAD=y -CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -# CONFIG_MODULE_SIG is not set -# CONFIG_MODULE_COMPRESS is not set -CONFIG_MODULES_TREE_LOOKUP=y -CONFIG_BLOCK=y -CONFIG_BLK_DEV_BSG=y -CONFIG_BLK_DEV_BSGLIB=y -CONFIG_BLK_DEV_INTEGRITY=y -CONFIG_BLK_DEV_THROTTLING=y -# CONFIG_BLK_CMDLINE_PARSER is not set - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_AIX_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -CONFIG_MAC_PARTITION=y -CONFIG_MSDOS_PARTITION=y -# CONFIG_BSD_DISKLABEL is not set -# CONFIG_MINIX_SUBPARTITION is not set -# CONFIG_SOLARIS_X86_PARTITION is not set -# CONFIG_UNIXWARE_DISKLABEL is not set -# CONFIG_LDM_PARTITION is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_KARMA_PARTITION is not set -CONFIG_EFI_PARTITION=y -# CONFIG_SYSV68_PARTITION is not set -# CONFIG_RK_PARTITION is not set -# CONFIG_CMDLINE_PARTITION is not set -CONFIG_BLOCK_COMPAT=y - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -CONFIG_CFQ_GROUP_IOSCHED=y -CONFIG_DEFAULT_DEADLINE=y -# CONFIG_DEFAULT_CFQ is not set -# CONFIG_DEFAULT_NOOP is not set -CONFIG_DEFAULT_IOSCHED="deadline" -CONFIG_PREEMPT_NOTIFIERS=y -CONFIG_PADATA=y -CONFIG_ASN1=y -CONFIG_UNINLINE_SPIN_UNLOCK=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_FREEZER=y - -# -# Platform selection -# -# CONFIG_ARCH_BCM_IPROC is not set -# CONFIG_ARCH_BERLIN is not set -# CONFIG_ARCH_EXYNOS7 is not set -# CONFIG_ARCH_LAYERSCAPE is not set -# CONFIG_ARCH_HISI is not set -# CONFIG_ARCH_MEDIATEK is not set -# CONFIG_ARCH_QCOM is not set -CONFIG_ARCH_ROCKCHIP=y -# CONFIG_ARCH_SEATTLE is not set -# CONFIG_ARCH_STRATIX10 is not set -# CONFIG_ARCH_TEGRA is not set -# CONFIG_ARCH_SPRD is not set -# CONFIG_ARCH_THUNDER is not set -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_XGENE is not set -# CONFIG_ARCH_ZYNQMP is not set - -# -# Bus support -# -CONFIG_PCI=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DOMAINS_GENERIC=y -CONFIG_PCI_SYSCALL=y -CONFIG_PCI_BUS_ADDR_T_64BIT=y -CONFIG_PCI_MSI=y -CONFIG_PCI_MSI_IRQ_DOMAIN=y -# CONFIG_PCI_DEBUG is not set -# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set -# CONFIG_PCI_STUB is not set -# CONFIG_PCI_IOV is not set -# CONFIG_PCI_PRI is not set -# CONFIG_PCI_PASID is not set - -# -# PCI host controller drivers -# -# CONFIG_PCIE_DW_ROCKCHIP is not set -# CONFIG_ROCKCHIP_PCIE_DMA_OBJ is not set -# CONFIG_PCI_HOST_GENERIC is not set -# CONFIG_PCIE_IPROC is not set -# CONFIG_PCI_HISI is not set -CONFIG_PCIE_ROCKCHIP=y -CONFIG_PCIEPORTBUS=y -CONFIG_PCIEAER=y -# CONFIG_PCIE_ECRC is not set -# CONFIG_PCIEAER_INJECT is not set -CONFIG_PCIEASPM=y -# CONFIG_PCIEASPM_DEBUG is not set -# CONFIG_PCIEASPM_DEFAULT is not set -CONFIG_PCIEASPM_POWERSAVE=y -# CONFIG_PCIEASPM_PERFORMANCE is not set -CONFIG_PCIE_PME=y -# CONFIG_HOTPLUG_PCI is not set - -# -# Kernel Features -# - -# -# ARM errata workarounds via the alternatives framework -# -# CONFIG_ARM64_ERRATUM_826319 is not set -# CONFIG_ARM64_ERRATUM_827319 is not set -# CONFIG_ARM64_ERRATUM_824069 is not set -# CONFIG_ARM64_ERRATUM_819472 is not set -# CONFIG_ARM64_ERRATUM_832075 is not set -CONFIG_ARM64_ERRATUM_834220=y -CONFIG_ARM64_ERRATUM_845719=y -CONFIG_ARM64_ERRATUM_843419=y -# CONFIG_ARM64_ERRATUM_1024718 is not set -# CONFIG_CAVIUM_ERRATUM_22375 is not set -# CONFIG_CAVIUM_ERRATUM_23154 is not set -CONFIG_CAVIUM_ERRATUM_27456=y -CONFIG_ARM64_4K_PAGES=y -# CONFIG_ARM64_16K_PAGES is not set -# CONFIG_ARM64_64K_PAGES is not set -CONFIG_ARM64_VA_BITS_39=y -# CONFIG_ARM64_VA_BITS_48 is not set -CONFIG_ARM64_VA_BITS=39 -# CONFIG_CPU_BIG_ENDIAN is not set -CONFIG_SCHED_MC=y -# CONFIG_SCHED_SMT is not set -CONFIG_NR_CPUS=8 -CONFIG_HOTPLUG_CPU=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_VOLUNTARY=y -# CONFIG_PREEMPT is not set -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -# CONFIG_HZ_300 is not set -# CONFIG_HZ_1000 is not set -CONFIG_HZ=250 -CONFIG_SCHED_HRTICK=y -CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SPARSEMEM_DEFAULT=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HW_PERF_EVENTS=y -CONFIG_SYS_SUPPORTS_HUGETLBFS=y -CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_SELECT_MEMORY_MODEL=y -CONFIG_SPARSEMEM_MANUAL=y -CONFIG_SPARSEMEM=y -CONFIG_HAVE_MEMORY_PRESENT=y -CONFIG_SPARSEMEM_EXTREME=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_HAVE_MEMBLOCK=y -CONFIG_NO_BOOTMEM=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_SPLIT_PTLOCK_CPUS=4 -# CONFIG_COMPACTION is not set -CONFIG_PHYS_ADDR_T_64BIT=y -CONFIG_ZONE_DMA_FLAG=1 -CONFIG_BOUNCE=y -CONFIG_MMU_NOTIFIER=y -# CONFIG_KSM is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 -# CONFIG_TRANSPARENT_HUGEPAGE is not set -# CONFIG_CLEANCACHE is not set -# CONFIG_FRONTSWAP is not set -# CONFIG_CMA is not set -# CONFIG_ZPOOL is not set -# CONFIG_ZBUD is not set -CONFIG_ZSMALLOC=y -# CONFIG_PGTABLE_MAPPING is not set -# CONFIG_ZSMALLOC_STAT is not set -CONFIG_GENERIC_EARLY_IOREMAP=y -# CONFIG_IDLE_PAGE_TRACKING is not set -CONFIG_FRAME_VECTOR=y -CONFIG_SECCOMP=y -# CONFIG_KEXEC is not set -# CONFIG_CRASH_DUMP is not set -# CONFIG_XEN is not set -CONFIG_FORCE_MAX_ZONEORDER=11 -CONFIG_UNMAP_KERNEL_AT_EL0=y -CONFIG_ARMV8_DEPRECATED=y -CONFIG_SWP_EMULATION=y -CONFIG_CP15_BARRIER_EMULATION=y -CONFIG_SETEND_EMULATION=y -# CONFIG_ARM64_SW_TTBR0_PAN is not set - -# -# ARMv8.1 architectural features -# -CONFIG_ARM64_HW_AFDBM=y -CONFIG_ARM64_PAN=y -# CONFIG_ARM64_LSE_ATOMICS is not set -CONFIG_KEYS_COMPAT=y -CONFIG_ARM64_UAO=y -CONFIG_ARM64_MODULE_CMODEL_LARGE=y -# CONFIG_RANDOMIZE_BASE is not set - -# -# Boot options -# -CONFIG_CMDLINE="" -# CONFIG_EFI is not set -# CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE is not set - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_COMPAT_BINFMT_ELF=y -CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y -CONFIG_BINFMT_SCRIPT=y -# CONFIG_HAVE_AOUT is not set -CONFIG_BINFMT_MISC=m -CONFIG_COREDUMP=y -CONFIG_COMPAT=y -CONFIG_SYSVIPC_COMPAT=y - -# -# Power management options -# -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -# CONFIG_SUSPEND_SKIP_SYNC is not set -CONFIG_HAS_WAKELOCK=y -CONFIG_WAKELOCK=y -# CONFIG_HIBERNATION is not set -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -CONFIG_PM_AUTOSLEEP=y -CONFIG_PM_WAKELOCKS=y -CONFIG_PM_WAKELOCKS_LIMIT=100 -CONFIG_PM_WAKELOCKS_GC=y -CONFIG_PM=y -CONFIG_PM_DEBUG=y -CONFIG_PM_ADVANCED_DEBUG=y -# CONFIG_PM_TEST_SUSPEND is not set -CONFIG_PM_SLEEP_DEBUG=y -# CONFIG_DPM_WATCHDOG is not set -CONFIG_PM_OPP=y -CONFIG_PM_CLK=y -CONFIG_PM_GENERIC_DOMAINS=y -CONFIG_WQ_POWER_EFFICIENT_DEFAULT=y -CONFIG_PM_GENERIC_DOMAINS_SLEEP=y -CONFIG_PM_GENERIC_DOMAINS_OF=y -CONFIG_CPU_PM=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y - -# -# CPU Power Management -# - -# -# CPU Idle -# -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_IDLE_GOV_MENU=y -CONFIG_DT_IDLE_STATES=y - -# -# ARM CPU Idle Drivers -# -CONFIG_ARM_CPUIDLE=y -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_COMMON=y -CONFIG_CPU_FREQ_STAT=y -# CONFIG_CPU_FREQ_STAT_DETAILS is not set -CONFIG_CPU_FREQ_TIMES=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -CONFIG_CPU_FREQ_GOV_USERSPACE=y -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_INTERACTIVE=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -# CONFIG_CPU_FREQ_GOV_SCHEDUTIL is not set - -# -# CPU frequency scaling drivers -# -CONFIG_CPUFREQ_DT=y -# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set -# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set -CONFIG_ARM_ROCKCHIP_CPUFREQ=y -CONFIG_NET=y -CONFIG_COMPAT_NETLINK_MESSAGES=y -CONFIG_NET_INGRESS=y - -# -# Networking options -# -CONFIG_PACKET=m -CONFIG_PACKET_DIAG=m -CONFIG_UNIX=y -CONFIG_UNIX_DIAG=y -CONFIG_XFRM=y -CONFIG_XFRM_ALGO=y -CONFIG_XFRM_USER=y -CONFIG_XFRM_SUB_POLICY=y -CONFIG_XFRM_MIGRATE=y -CONFIG_XFRM_STATISTICS=y -CONFIG_XFRM_IPCOMP=m -CONFIG_NET_KEY=m -CONFIG_NET_KEY_MIGRATE=y -CONFIG_INET=y -CONFIG_WIREGUARD=m -# CONFIG_WIREGUARD_DEBUG is not set -CONFIG_IP_MULTICAST=y -CONFIG_IP_ADVANCED_ROUTER=y -CONFIG_IP_FIB_TRIE_STATS=y -CONFIG_IP_MULTIPLE_TABLES=y -CONFIG_IP_ROUTE_MULTIPATH=y -CONFIG_IP_ROUTE_VERBOSE=y -CONFIG_IP_ROUTE_CLASSID=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -CONFIG_IP_PNP_RARP=y -CONFIG_NET_IPIP=m -CONFIG_NET_IPGRE_DEMUX=m -CONFIG_NET_IP_TUNNEL=m -CONFIG_NET_IPGRE=m -CONFIG_NET_IPGRE_BROADCAST=y -CONFIG_IP_MROUTE=y -CONFIG_IP_MROUTE_MULTIPLE_TABLES=y -CONFIG_IP_PIMSM_V1=y -CONFIG_IP_PIMSM_V2=y -CONFIG_SYN_COOKIES=y -CONFIG_NET_IPVTI=m -CONFIG_NET_UDP_TUNNEL=m -CONFIG_NET_FOU=m -# CONFIG_NET_FOU_IP_TUNNELS is not set -CONFIG_INET_AH=m -CONFIG_INET_ESP=m -CONFIG_INET_IPCOMP=m -CONFIG_INET_XFRM_TUNNEL=m -CONFIG_INET_TUNNEL=m -CONFIG_INET_XFRM_MODE_TRANSPORT=m -CONFIG_INET_XFRM_MODE_TUNNEL=m -CONFIG_INET_XFRM_MODE_BEET=m -CONFIG_INET_LRO=m -CONFIG_INET_DIAG=m -CONFIG_INET_TCP_DIAG=m -CONFIG_INET_UDP_DIAG=m -# CONFIG_INET_DIAG_DESTROY is not set -CONFIG_TCP_CONG_ADVANCED=y -CONFIG_TCP_CONG_BIC=m -CONFIG_TCP_CONG_CUBIC=m -CONFIG_TCP_CONG_WESTWOOD=m -CONFIG_TCP_CONG_HTCP=m -CONFIG_TCP_CONG_HSTCP=m -CONFIG_TCP_CONG_HYBLA=m -CONFIG_TCP_CONG_VEGAS=m -CONFIG_TCP_CONG_SCALABLE=m -CONFIG_TCP_CONG_LP=m -CONFIG_TCP_CONG_VENO=m -CONFIG_TCP_CONG_YEAH=m -CONFIG_TCP_CONG_ILLINOIS=m -CONFIG_TCP_CONG_DCTCP=m -CONFIG_TCP_CONG_CDG=m -CONFIG_DEFAULT_RENO=y -CONFIG_DEFAULT_TCP_CONG="reno" -CONFIG_TCP_MD5SIG=y -CONFIG_IPV6=y -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -CONFIG_INET6_AH=y -CONFIG_INET6_ESP=y -CONFIG_INET6_IPCOMP=m -CONFIG_IPV6_MIP6=m -CONFIG_IPV6_ILA=m -CONFIG_INET6_XFRM_TUNNEL=m -CONFIG_INET6_TUNNEL=m -CONFIG_INET6_XFRM_MODE_TRANSPORT=m -CONFIG_INET6_XFRM_MODE_TUNNEL=m -CONFIG_INET6_XFRM_MODE_BEET=m -CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m -CONFIG_IPV6_VTI=m -CONFIG_IPV6_SIT=m -# CONFIG_IPV6_SIT_6RD is not set -CONFIG_IPV6_NDISC_NODETYPE=y -CONFIG_IPV6_TUNNEL=m -CONFIG_IPV6_GRE=m -CONFIG_IPV6_MULTIPLE_TABLES=y -CONFIG_IPV6_SUBTREES=y -# CONFIG_IPV6_MROUTE is not set -CONFIG_NETLABEL=y -# CONFIG_ANDROID_PARANOID_NETWORK is not set -CONFIG_NETWORK_SECMARK=y -CONFIG_NET_PTP_CLASSIFY=y -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_NETFILTER_ADVANCED=y -CONFIG_BRIDGE_NETFILTER=y - -# -# Core Netfilter Configuration -# -CONFIG_NETFILTER_INGRESS=y -CONFIG_NETFILTER_NETLINK=y -CONFIG_NETFILTER_NETLINK_ACCT=m -CONFIG_NETFILTER_NETLINK_QUEUE=y -CONFIG_NETFILTER_NETLINK_LOG=y -CONFIG_NF_CONNTRACK=m -CONFIG_NF_LOG_COMMON=m -CONFIG_NF_CONNTRACK_MARK=y -CONFIG_NF_CONNTRACK_SECMARK=y -# CONFIG_NF_CONNTRACK_ZONES is not set -CONFIG_NF_CONNTRACK_PROCFS=y -CONFIG_NF_CONNTRACK_EVENTS=y -CONFIG_NF_CONNTRACK_TIMEOUT=y -CONFIG_NF_CONNTRACK_TIMESTAMP=y -CONFIG_NF_CONNTRACK_LABELS=y -CONFIG_NF_CT_PROTO_DCCP=m -CONFIG_NF_CT_PROTO_GRE=m -CONFIG_NF_CT_PROTO_SCTP=m -CONFIG_NF_CT_PROTO_UDPLITE=m -CONFIG_NF_CONNTRACK_AMANDA=m -CONFIG_NF_CONNTRACK_FTP=m -CONFIG_NF_CONNTRACK_H323=m -CONFIG_NF_CONNTRACK_IRC=m -CONFIG_NF_CONNTRACK_BROADCAST=m -CONFIG_NF_CONNTRACK_NETBIOS_NS=m -CONFIG_NF_CONNTRACK_SNMP=m -CONFIG_NF_CONNTRACK_PPTP=m -CONFIG_NF_CONNTRACK_SANE=m -CONFIG_NF_CONNTRACK_SIP=m -CONFIG_NF_CONNTRACK_TFTP=m -CONFIG_NF_CT_NETLINK=m -CONFIG_NF_CT_NETLINK_TIMEOUT=m -# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set -CONFIG_NF_NAT=m -CONFIG_NF_NAT_NEEDED=y -CONFIG_NF_NAT_PROTO_DCCP=m -CONFIG_NF_NAT_PROTO_UDPLITE=m -CONFIG_NF_NAT_PROTO_SCTP=m -CONFIG_NF_NAT_AMANDA=m -CONFIG_NF_NAT_FTP=m -CONFIG_NF_NAT_IRC=m -CONFIG_NF_NAT_SIP=m -CONFIG_NF_NAT_TFTP=m -CONFIG_NF_NAT_REDIRECT=m -CONFIG_NETFILTER_SYNPROXY=m -CONFIG_NF_TABLES=m -CONFIG_NF_TABLES_INET=m -CONFIG_NF_TABLES_NETDEV=m -CONFIG_NFT_EXTHDR=m -CONFIG_NFT_META=m -CONFIG_NFT_CT=m -CONFIG_NFT_RBTREE=m -CONFIG_NFT_HASH=m -CONFIG_NFT_COUNTER=m -CONFIG_NFT_LOG=m -CONFIG_NFT_LIMIT=m -CONFIG_NFT_MASQ=m -CONFIG_NFT_REDIR=m -CONFIG_NFT_NAT=m -CONFIG_NFT_QUEUE=m -CONFIG_NFT_REJECT=m -CONFIG_NFT_REJECT_INET=m -CONFIG_NFT_COMPAT=m -CONFIG_NETFILTER_XTABLES=m - -# -# Xtables combined modules -# -CONFIG_NETFILTER_XT_MARK=m -CONFIG_NETFILTER_XT_CONNMARK=m -CONFIG_NETFILTER_XT_SET=m - -# -# Xtables targets -# -# CONFIG_NETFILTER_XT_TARGET_AUDIT is not set -CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m -CONFIG_NETFILTER_XT_TARGET_CT=m -CONFIG_NETFILTER_XT_TARGET_DSCP=m -CONFIG_NETFILTER_XT_TARGET_HL=m -CONFIG_NETFILTER_XT_TARGET_HMARK=m -CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -CONFIG_NETFILTER_XT_TARGET_LED=m -CONFIG_NETFILTER_XT_TARGET_LOG=m -CONFIG_NETFILTER_XT_TARGET_MARK=m -CONFIG_NETFILTER_XT_NAT=m -CONFIG_NETFILTER_XT_TARGET_NETMAP=m -CONFIG_NETFILTER_XT_TARGET_NFLOG=m -CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -CONFIG_NETFILTER_XT_TARGET_RATEEST=m -CONFIG_NETFILTER_XT_TARGET_REDIRECT=m -CONFIG_NETFILTER_XT_TARGET_TEE=m -CONFIG_NETFILTER_XT_TARGET_TPROXY=m -CONFIG_NETFILTER_XT_TARGET_TRACE=m -CONFIG_NETFILTER_XT_TARGET_SECMARK=m -CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m - -# -# Xtables matches -# -CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -CONFIG_NETFILTER_XT_MATCH_BPF=m -CONFIG_NETFILTER_XT_MATCH_CGROUP=m -CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -CONFIG_NETFILTER_XT_MATCH_COMMENT=m -CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -CONFIG_NETFILTER_XT_MATCH_CPU=m -CONFIG_NETFILTER_XT_MATCH_DCCP=m -CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -CONFIG_NETFILTER_XT_MATCH_DSCP=m -CONFIG_NETFILTER_XT_MATCH_ECN=m -CONFIG_NETFILTER_XT_MATCH_ESP=m -CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -CONFIG_NETFILTER_XT_MATCH_HELPER=m -CONFIG_NETFILTER_XT_MATCH_HL=m -CONFIG_NETFILTER_XT_MATCH_IPCOMP=m -CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -CONFIG_NETFILTER_XT_MATCH_IPVS=m -CONFIG_NETFILTER_XT_MATCH_L2TP=m -CONFIG_NETFILTER_XT_MATCH_LENGTH=m -CONFIG_NETFILTER_XT_MATCH_LIMIT=m -CONFIG_NETFILTER_XT_MATCH_MAC=m -CONFIG_NETFILTER_XT_MATCH_MARK=m -CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -CONFIG_NETFILTER_XT_MATCH_NFACCT=m -CONFIG_NETFILTER_XT_MATCH_OSF=m -CONFIG_NETFILTER_XT_MATCH_OWNER=m -CONFIG_NETFILTER_XT_MATCH_POLICY=m -CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -CONFIG_NETFILTER_XT_MATCH_QUOTA=m -CONFIG_NETFILTER_XT_MATCH_QUOTA2=m -CONFIG_NETFILTER_XT_MATCH_QUOTA2_LOG=y -CONFIG_NETFILTER_XT_MATCH_RATEEST=m -CONFIG_NETFILTER_XT_MATCH_REALM=m -CONFIG_NETFILTER_XT_MATCH_RECENT=m -CONFIG_NETFILTER_XT_MATCH_SCTP=m -CONFIG_NETFILTER_XT_MATCH_SOCKET=m -CONFIG_NETFILTER_XT_MATCH_STATE=m -CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -CONFIG_NETFILTER_XT_MATCH_STRING=m -CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -CONFIG_NETFILTER_XT_MATCH_TIME=m -CONFIG_NETFILTER_XT_MATCH_U32=m -CONFIG_IP_SET=y -CONFIG_IP_SET_MAX=256 -CONFIG_IP_SET_BITMAP_IP=m -CONFIG_IP_SET_BITMAP_IPMAC=m -CONFIG_IP_SET_BITMAP_PORT=m -CONFIG_IP_SET_HASH_IP=m -CONFIG_IP_SET_HASH_IPMARK=m -CONFIG_IP_SET_HASH_IPPORT=m -CONFIG_IP_SET_HASH_IPPORTIP=m -CONFIG_IP_SET_HASH_IPPORTNET=m -CONFIG_IP_SET_HASH_MAC=m -CONFIG_IP_SET_HASH_NETPORTNET=m -CONFIG_IP_SET_HASH_NET=m -CONFIG_IP_SET_HASH_NETNET=m -CONFIG_IP_SET_HASH_NETPORT=m -CONFIG_IP_SET_HASH_NETIFACE=m -CONFIG_IP_SET_LIST_SET=m -CONFIG_IP_VS=m -CONFIG_IP_VS_IPV6=y -# CONFIG_IP_VS_DEBUG is not set -CONFIG_IP_VS_TAB_BITS=12 - -# -# IPVS transport protocol load balancing support -# -CONFIG_IP_VS_PROTO_TCP=y -CONFIG_IP_VS_PROTO_UDP=y -CONFIG_IP_VS_PROTO_AH_ESP=y -CONFIG_IP_VS_PROTO_ESP=y -CONFIG_IP_VS_PROTO_AH=y -CONFIG_IP_VS_PROTO_SCTP=y - -# -# IPVS scheduler -# -CONFIG_IP_VS_RR=m -CONFIG_IP_VS_WRR=m -CONFIG_IP_VS_LC=m -CONFIG_IP_VS_WLC=m -CONFIG_IP_VS_FO=m -CONFIG_IP_VS_OVF=m -CONFIG_IP_VS_LBLC=m -CONFIG_IP_VS_LBLCR=m -CONFIG_IP_VS_DH=m -CONFIG_IP_VS_SH=m -CONFIG_IP_VS_SED=m -CONFIG_IP_VS_NQ=m - -# -# IPVS SH scheduler -# -CONFIG_IP_VS_SH_TAB_BITS=8 - -# -# IPVS application helper -# -# CONFIG_IP_VS_FTP is not set -CONFIG_IP_VS_NFCT=y -# CONFIG_IP_VS_PE_SIP is not set - -# -# IP: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV4=m -CONFIG_NF_CONNTRACK_IPV4=m -CONFIG_NF_CONNTRACK_PROC_COMPAT=y -CONFIG_NF_TABLES_IPV4=m -CONFIG_NFT_CHAIN_ROUTE_IPV4=m -CONFIG_NFT_REJECT_IPV4=m -CONFIG_NFT_DUP_IPV4=m -CONFIG_NF_TABLES_ARP=m -CONFIG_NF_DUP_IPV4=m -CONFIG_NF_LOG_ARP=m -CONFIG_NF_LOG_IPV4=m -CONFIG_NF_REJECT_IPV4=m -CONFIG_NF_NAT_IPV4=m -CONFIG_NFT_CHAIN_NAT_IPV4=m -CONFIG_NF_NAT_MASQUERADE_IPV4=m -CONFIG_NFT_MASQ_IPV4=m -CONFIG_NFT_REDIR_IPV4=m -CONFIG_NF_NAT_SNMP_BASIC=m -CONFIG_NF_NAT_PROTO_GRE=m -CONFIG_NF_NAT_PPTP=m -CONFIG_NF_NAT_H323=m -CONFIG_IP_NF_IPTABLES=m -CONFIG_IP_NF_MATCH_AH=m -CONFIG_IP_NF_MATCH_ECN=m -CONFIG_IP_NF_MATCH_RPFILTER=m -CONFIG_IP_NF_MATCH_TTL=m -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -CONFIG_IP_NF_TARGET_SYNPROXY=m -CONFIG_IP_NF_NAT=m -CONFIG_IP_NF_TARGET_MASQUERADE=m -CONFIG_IP_NF_TARGET_NETMAP=m -CONFIG_IP_NF_TARGET_REDIRECT=m -CONFIG_IP_NF_MANGLE=m -CONFIG_IP_NF_TARGET_CLUSTERIP=m -CONFIG_IP_NF_TARGET_ECN=m -CONFIG_IP_NF_TARGET_TTL=m -CONFIG_IP_NF_RAW=m -CONFIG_IP_NF_SECURITY=m -CONFIG_IP_NF_ARPTABLES=m -CONFIG_IP_NF_ARPFILTER=m -CONFIG_IP_NF_ARP_MANGLE=m - -# -# IPv6: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV6=m -CONFIG_NF_CONNTRACK_IPV6=m -CONFIG_NF_TABLES_IPV6=m -CONFIG_NFT_CHAIN_ROUTE_IPV6=m -CONFIG_NFT_REJECT_IPV6=m -CONFIG_NFT_DUP_IPV6=m -CONFIG_NF_DUP_IPV6=m -CONFIG_NF_REJECT_IPV6=m -CONFIG_NF_LOG_IPV6=m -CONFIG_NF_NAT_IPV6=m -CONFIG_NFT_CHAIN_NAT_IPV6=m -CONFIG_NF_NAT_MASQUERADE_IPV6=m -CONFIG_NFT_MASQ_IPV6=m -CONFIG_NFT_REDIR_IPV6=m -CONFIG_IP6_NF_IPTABLES=m -CONFIG_IP6_NF_MATCH_AH=m -CONFIG_IP6_NF_MATCH_EUI64=m -CONFIG_IP6_NF_MATCH_FRAG=m -CONFIG_IP6_NF_MATCH_OPTS=m -CONFIG_IP6_NF_MATCH_HL=m -CONFIG_IP6_NF_MATCH_IPV6HEADER=m -CONFIG_IP6_NF_MATCH_MH=m -CONFIG_IP6_NF_MATCH_RPFILTER=m -CONFIG_IP6_NF_MATCH_RT=m -CONFIG_IP6_NF_TARGET_HL=m -CONFIG_IP6_NF_FILTER=m -CONFIG_IP6_NF_TARGET_REJECT=m -CONFIG_IP6_NF_TARGET_SYNPROXY=m -CONFIG_IP6_NF_MANGLE=m -CONFIG_IP6_NF_RAW=m -CONFIG_IP6_NF_SECURITY=m -CONFIG_IP6_NF_NAT=m -CONFIG_IP6_NF_TARGET_MASQUERADE=m -CONFIG_IP6_NF_TARGET_NPT=m -CONFIG_NF_TABLES_BRIDGE=m -CONFIG_NFT_BRIDGE_META=m -CONFIG_NFT_BRIDGE_REJECT=m -CONFIG_NF_LOG_BRIDGE=m -CONFIG_BRIDGE_NF_EBTABLES=m -CONFIG_BRIDGE_EBT_BROUTE=m -CONFIG_BRIDGE_EBT_T_FILTER=m -CONFIG_BRIDGE_EBT_T_NAT=m -CONFIG_BRIDGE_EBT_802_3=m -CONFIG_BRIDGE_EBT_AMONG=m -CONFIG_BRIDGE_EBT_ARP=m -CONFIG_BRIDGE_EBT_IP=m -CONFIG_BRIDGE_EBT_IP6=m -CONFIG_BRIDGE_EBT_LIMIT=m -CONFIG_BRIDGE_EBT_MARK=m -CONFIG_BRIDGE_EBT_PKTTYPE=m -CONFIG_BRIDGE_EBT_STP=m -CONFIG_BRIDGE_EBT_VLAN=m -CONFIG_BRIDGE_EBT_ARPREPLY=m -CONFIG_BRIDGE_EBT_DNAT=m -CONFIG_BRIDGE_EBT_MARK_T=m -CONFIG_BRIDGE_EBT_REDIRECT=m -CONFIG_BRIDGE_EBT_SNAT=m -CONFIG_BRIDGE_EBT_LOG=m -CONFIG_BRIDGE_EBT_NFLOG=m -# CONFIG_IP_DCCP is not set -# CONFIG_IP_SCTP is not set -# CONFIG_RDS is not set -# CONFIG_TIPC is not set -# CONFIG_ATM is not set -# CONFIG_L2TP is not set -CONFIG_STP=y -CONFIG_BRIDGE=y -CONFIG_BRIDGE_IGMP_SNOOPING=y -# CONFIG_BRIDGE_VLAN_FILTERING is not set -CONFIG_HAVE_NET_DSA=y -# CONFIG_NET_DSA is not set -CONFIG_VLAN_8021Q=y -# CONFIG_VLAN_8021Q_GVRP is not set -# CONFIG_VLAN_8021Q_MVRP is not set -# CONFIG_DECNET is not set -CONFIG_LLC=y -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_PHONET is not set -# CONFIG_6LOWPAN is not set -# CONFIG_IEEE802154 is not set -CONFIG_NET_SCHED=y - -# -# Queueing/Scheduling -# -CONFIG_NET_SCH_CBQ=m -CONFIG_NET_SCH_HTB=y -CONFIG_NET_SCH_HFSC=m -CONFIG_NET_SCH_PRIO=m -CONFIG_NET_SCH_MULTIQ=m -CONFIG_NET_SCH_RED=m -CONFIG_NET_SCH_SFB=m -CONFIG_NET_SCH_SFQ=m -CONFIG_NET_SCH_TEQL=m -CONFIG_NET_SCH_TBF=m -CONFIG_NET_SCH_GRED=m -CONFIG_NET_SCH_DSMARK=m -CONFIG_NET_SCH_NETEM=m -CONFIG_NET_SCH_DRR=m -CONFIG_NET_SCH_MQPRIO=m -CONFIG_NET_SCH_CHOKE=m -CONFIG_NET_SCH_QFQ=m -CONFIG_NET_SCH_CODEL=y -CONFIG_NET_SCH_FQ_CODEL=y -CONFIG_NET_SCH_FQ=m -CONFIG_NET_SCH_HHF=m -CONFIG_NET_SCH_PIE=m -CONFIG_NET_SCH_PLUG=m - -# -# Classification -# -CONFIG_NET_CLS=y -# CONFIG_NET_CLS_BASIC is not set -# CONFIG_NET_CLS_TCINDEX is not set -# CONFIG_NET_CLS_ROUTE4 is not set -# CONFIG_NET_CLS_FW is not set -CONFIG_NET_CLS_U32=y -# CONFIG_CLS_U32_PERF is not set -CONFIG_CLS_U32_MARK=y -# CONFIG_NET_CLS_RSVP is not set -# CONFIG_NET_CLS_RSVP6 is not set -# CONFIG_NET_CLS_FLOW is not set -CONFIG_NET_CLS_CGROUP=y -# CONFIG_NET_CLS_BPF is not set -# CONFIG_NET_CLS_FLOWER is not set -# CONFIG_NET_EMATCH is not set -# CONFIG_NET_CLS_ACT is not set -# CONFIG_NET_CLS_IND is not set -CONFIG_NET_SCH_FIFO=y -# CONFIG_DCB is not set -CONFIG_DNS_RESOLVER=y -# CONFIG_BATMAN_ADV is not set -CONFIG_OPENVSWITCH=m -CONFIG_OPENVSWITCH_GRE=m -CONFIG_OPENVSWITCH_VXLAN=m -CONFIG_OPENVSWITCH_GENEVE=m -# CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_DIAG is not set -CONFIG_MPLS=y -CONFIG_NET_MPLS_GSO=m -# CONFIG_MPLS_ROUTING is not set -# CONFIG_HSR is not set -# CONFIG_NET_SWITCHDEV is not set -# CONFIG_NET_L3_MASTER_DEV is not set -CONFIG_RPS=y -CONFIG_RFS_ACCEL=y -CONFIG_XPS=y -CONFIG_CGROUP_NET_PRIO=y -CONFIG_CGROUP_NET_CLASSID=y -CONFIG_NET_RX_BUSY_POLL=y -CONFIG_BQL=y -# CONFIG_BPF_JIT is not set -CONFIG_NET_FLOW_LIMIT=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_NET_DROP_MONITOR is not set -# CONFIG_HAMRADIO is not set -# CONFIG_CAN is not set -# CONFIG_IRDA is not set -CONFIG_BT=y -CONFIG_BT_BREDR=y -CONFIG_BT_RFCOMM=y -# CONFIG_BT_RFCOMM_TTY is not set -# CONFIG_BT_BNEP is not set -CONFIG_BT_HIDP=y -CONFIG_BT_HS=y -CONFIG_BT_LE=y -# CONFIG_BT_SELFTEST is not set -CONFIG_BT_DEBUGFS=y - -# -# Bluetooth device drivers -# -CONFIG_BT_INTEL=y -CONFIG_BT_BCM=y -CONFIG_BT_RTL=y -# CONFIG_BT_RTKBTUSB is not set -CONFIG_BT_HCIBTUSB=y -CONFIG_BT_HCIBTUSB_BCM=y -CONFIG_BT_HCIBTUSB_RTL=y -# CONFIG_BT_HCIBTSDIO is not set -CONFIG_BT_HCIUART=y -CONFIG_BT_HCIUART_H4=y -# CONFIG_BT_HCIUART_BCSP is not set -CONFIG_BT_HCIUART_ATH3K=y -CONFIG_BT_HCIUART_LL=y -# CONFIG_BT_HCIUART_3WIRE is not set -# CONFIG_BT_HCIUART_INTEL is not set -# CONFIG_BT_HCIUART_BCM is not set -# CONFIG_BT_HCIUART_QCA is not set -# CONFIG_BT_HCIBCM203X is not set -# CONFIG_BT_HCIBPA10X is not set -CONFIG_BT_HCIBFUSB=y -CONFIG_BT_HCIVHCI=y -CONFIG_BT_MRVL=y -CONFIG_BT_MRVL_SDIO=y -# CONFIG_BT_ATH3K is not set -# CONFIG_AF_RXRPC is not set -CONFIG_FIB_RULES=y -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_SPY=y -CONFIG_WEXT_PRIV=y -CONFIG_CFG80211=y -CONFIG_NL80211_TESTMODE=y -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_REG_DEBUG is not set -# CONFIG_CFG80211_CERTIFICATION_ONUS is not set -CONFIG_CFG80211_DEFAULT_PS=y -CONFIG_CFG80211_DEBUGFS=y -# CONFIG_CFG80211_INTERNAL_REGDB is not set -CONFIG_CFG80211_CRDA_SUPPORT=y -CONFIG_CFG80211_WEXT=y -CONFIG_LIB80211=m -CONFIG_LIB80211_CRYPT_WEP=m -CONFIG_LIB80211_CRYPT_CCMP=m -CONFIG_LIB80211_CRYPT_TKIP=m -# CONFIG_LIB80211_DEBUG is not set -CONFIG_MAC80211=y -CONFIG_MAC80211_HAS_RC=y -CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_MINSTREL_HT=y -# CONFIG_MAC80211_RC_MINSTREL_VHT is not set -CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y -CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" -# CONFIG_MAC80211_MESH is not set -CONFIG_MAC80211_LEDS=y -CONFIG_MAC80211_DEBUGFS=y -# CONFIG_MAC80211_MESSAGE_TRACING is not set -CONFIG_MAC80211_DEBUG_MENU=y -# CONFIG_MAC80211_NOINLINE is not set -CONFIG_MAC80211_VERBOSE_DEBUG=y -# CONFIG_MAC80211_MLME_DEBUG is not set -# CONFIG_MAC80211_STA_DEBUG is not set -# CONFIG_MAC80211_HT_DEBUG is not set -# CONFIG_MAC80211_OCB_DEBUG is not set -# CONFIG_MAC80211_IBSS_DEBUG is not set -# CONFIG_MAC80211_PS_DEBUG is not set -# CONFIG_MAC80211_TDLS_DEBUG is not set -# CONFIG_MAC80211_DEBUG_COUNTERS is not set -CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 -# CONFIG_WIMAX is not set -CONFIG_RFKILL=y -CONFIG_RFKILL_PM=y -CONFIG_RFKILL_LEDS=y -CONFIG_RFKILL_INPUT=y -# CONFIG_RFKILL_REGULATOR is not set -# CONFIG_RFKILL_GPIO is not set -# CONFIG_NET_9P is not set -# CONFIG_CAIF is not set -CONFIG_CEPH_LIB=m -# CONFIG_CEPH_LIB_PRETTYDEBUG is not set -# CONFIG_CEPH_LIB_USE_DNS_RESOLVER is not set -# CONFIG_NFC is not set -CONFIG_LWTUNNEL=y -CONFIG_DST_CACHE=y -CONFIG_HAVE_BPF_JIT=y -CONFIG_HAVE_EBPF_JIT=y - -# -# Device Drivers -# -CONFIG_ARM_AMBA=y -# CONFIG_TEGRA_AHB is not set - -# -# Generic Driver Options -# -CONFIG_UEVENT_HELPER=y -CONFIG_UEVENT_HELPER_PATH="" -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y -CONFIG_FW_LOADER=y -CONFIG_FIRMWARE_IN_KERNEL=y -CONFIG_EXTRA_FIRMWARE="" -# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set -CONFIG_WANT_DEV_COREDUMP=y -CONFIG_ALLOW_DEV_COREDUMP=y -CONFIG_DEV_COREDUMP=y -# CONFIG_DEBUG_DRIVER is not set -CONFIG_DEBUG_DEVRES=y -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_SPI=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGMAP_IRQ=y -CONFIG_DMA_SHARED_BUFFER=y -# CONFIG_FENCE_TRACE is not set - -# -# Bus devices -# -# CONFIG_ARM_CCI400_PMU is not set -# CONFIG_ARM_CCI500_PMU is not set -# CONFIG_ARM_CCN is not set -# CONFIG_VEXPRESS_CONFIG is not set -CONFIG_CONNECTOR=y -CONFIG_PROC_EVENTS=y -CONFIG_MTD=y -# CONFIG_MTD_TESTS is not set -# CONFIG_MTD_REDBOOT_PARTS is not set -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_OF_PARTS=y -# CONFIG_MTD_AR7_PARTS is not set - -# -# User Modules And Translation Layers -# -CONFIG_MTD_BLKDEVS=y -CONFIG_MTD_BLOCK=y -# CONFIG_FTL is not set -# CONFIG_NFTL is not set -# CONFIG_INFTL is not set -# CONFIG_RFD_FTL is not set -# CONFIG_SSFDC is not set -# CONFIG_SM_FTL is not set -# CONFIG_MTD_OOPS is not set -# CONFIG_MTD_SWAP is not set -# CONFIG_MTD_PARTITIONED_MASTER is not set - -# -# RAM/ROM/Flash chip drivers -# -CONFIG_MTD_CFI=y -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_GEN_PROBE=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_NOSWAP=y -# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set -# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set -# CONFIG_MTD_CFI_GEOMETRY is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -# CONFIG_MTD_OTP is not set -CONFIG_MTD_CFI_INTELEXT=y -CONFIG_MTD_CFI_AMDSTD=y -CONFIG_MTD_CFI_STAA=y -CONFIG_MTD_CFI_UTIL=y -# CONFIG_MTD_RAM is not set -# CONFIG_MTD_ROM is not set -# CONFIG_MTD_ABSENT is not set - -# -# Mapping drivers for chip access -# -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_PHYSMAP is not set -# CONFIG_MTD_PHYSMAP_OF is not set -# CONFIG_MTD_INTEL_VR_NOR is not set -# CONFIG_MTD_PLATRAM is not set - -# -# Self-contained MTD device drivers -# -# CONFIG_MTD_PMC551 is not set -# CONFIG_MTD_DATAFLASH is not set -CONFIG_MTD_M25P80=y -# CONFIG_MTD_SST25L is not set -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLOCK2MTD is not set - -# -# Disk-On-Chip Device Drivers -# -# CONFIG_MTD_DOCG3 is not set -CONFIG_MTD_NAND_IDS=y -# CONFIG_MTD_NAND is not set -# CONFIG_MTD_ONENAND is not set - -# -# LPDDR & LPDDR2 PCM memory drivers -# -# CONFIG_MTD_LPDDR is not set -CONFIG_MTD_SPI_NOR=y -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y -CONFIG_MTD_UBI=m -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MTD_UBI_BEB_LIMIT=20 -# CONFIG_MTD_UBI_FASTMAP is not set -# CONFIG_MTD_UBI_GLUEBI is not set -# CONFIG_MTD_UBI_BLOCK is not set -CONFIG_DTC=y -CONFIG_OF=y -# CONFIG_OF_UNITTEST is not set -CONFIG_OF_FLATTREE=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_DYNAMIC=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_ADDRESS_PCI=y -CONFIG_OF_IRQ=y -CONFIG_OF_NET=y -CONFIG_OF_MDIO=y -CONFIG_OF_PCI=y -CONFIG_OF_PCI_IRQ=y -CONFIG_OF_MTD=y -CONFIG_OF_RESERVED_MEM=y -CONFIG_OF_RESOLVE=y -CONFIG_OF_OVERLAY=y -CONFIG_OF_CONFIGFS=y -# CONFIG_PARPORT is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set -CONFIG_ZRAM=m -# CONFIG_ZRAM_WRITEBACK is not set -# CONFIG_ZRAM_MEMORY_TRACKING is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 -CONFIG_BLK_DEV_CRYPTOLOOP=m -CONFIG_BLK_DEV_DRBD=m -CONFIG_DRBD_FAULT_INJECTION=y -CONFIG_BLK_DEV_NBD=m -# CONFIG_BLK_DEV_SKD is not set -# CONFIG_BLK_DEV_SX8 is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=1 -CONFIG_BLK_DEV_RAM_SIZE=4096 -# CONFIG_CDROM_PKTCDVD is not set -CONFIG_ATA_OVER_ETH=m -CONFIG_BLK_DEV_RBD=m -# CONFIG_BLK_DEV_RSXX is not set -CONFIG_BLK_DEV_NVME=y - -# -# Misc devices -# -# CONFIG_ROCKCHIP_SCR is not set -# CONFIG_SENSORS_LIS3LV02D is not set -# CONFIG_AD525X_DPOT is not set -# CONFIG_DUMMY_IRQ is not set -# CONFIG_PHANTOM is not set -# CONFIG_SGI_IOC4 is not set -# CONFIG_TIFM_CORE is not set -# CONFIG_ICS932S401 is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_HP_ILO is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_BH1780 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_HMC6352 is not set -# CONFIG_DS1682 is not set -# CONFIG_TI_DAC7512 is not set -CONFIG_BMP085=m -CONFIG_BMP085_I2C=m -CONFIG_BMP085_SPI=m -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -CONFIG_SRAM=y -# CONFIG_UID_SYS_STATS is not set -# CONFIG_MEMORY_STATE_TIME is not set -# CONFIG_USB_CAM_GPIO is not set -# CONFIG_GPIO_DET is not set -# CONFIG_C2PORT is not set - -# -# EEPROM support -# -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_AT25 is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -CONFIG_EEPROM_93CX6=m -# CONFIG_EEPROM_93XX46 is not set -# CONFIG_CB710_CORE is not set - -# -# Texas Instruments shared transport line discipline -# -# CONFIG_TI_ST is not set -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LIS3_I2C is not set - -# -# Altera FPGA firmware download module -# -# CONFIG_ALTERA_STAPL is not set - -# -# Intel MIC Bus Driver -# - -# -# SCIF Bus Driver -# - -# -# Intel MIC Host Driver -# - -# -# Intel MIC Card Driver -# - -# -# SCIF Driver -# - -# -# Intel MIC Coprocessor State Management (COSM) Drivers -# -# CONFIG_GENWQE is not set -# CONFIG_ECHO is not set -# CONFIG_CXL_BASE is not set -# CONFIG_CXL_KERNEL_API is not set -# CONFIG_CXL_EEH is not set - -# -# SCSI device support -# -CONFIG_SCSI_MOD=y -CONFIG_RAID_ATTRS=m -CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_NETLINK is not set -# CONFIG_SCSI_MQ_DEFAULT is not set -CONFIG_SCSI_PROC_FS=y - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=y -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CHR_DEV_OSST is not set -CONFIG_BLK_DEV_SR=y -# CONFIG_BLK_DEV_SR_VENDOR is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_SCH is not set -# CONFIG_SCSI_CONSTANTS is not set -CONFIG_SCSI_LOGGING=y -CONFIG_SCSI_SCAN_ASYNC=y - -# -# SCSI Transports -# -CONFIG_SCSI_SPI_ATTRS=y -# CONFIG_SCSI_FC_ATTRS is not set -CONFIG_SCSI_ISCSI_ATTRS=m -CONFIG_SCSI_SAS_ATTRS=m -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -CONFIG_SCSI_LOWLEVEL=y -CONFIG_ISCSI_TCP=m -CONFIG_ISCSI_BOOT_SYSFS=m -# CONFIG_SCSI_CXGB3_ISCSI is not set -# CONFIG_SCSI_CXGB4_ISCSI is not set -# CONFIG_SCSI_BNX2_ISCSI is not set -# CONFIG_BE2ISCSI is not set -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_SCSI_HPSA is not set -# CONFIG_SCSI_3W_9XXX is not set -# CONFIG_SCSI_3W_SAS is not set -# CONFIG_SCSI_ACARD is not set -# CONFIG_SCSI_AACRAID is not set -# CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_AIC94XX is not set -# CONFIG_SCSI_MVSAS is not set -# CONFIG_SCSI_MVUMI is not set -# CONFIG_SCSI_ADVANSYS is not set -# CONFIG_SCSI_ARCMSR is not set -# CONFIG_SCSI_ESAS2R is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_SAS is not set -CONFIG_SCSI_MPT3SAS=m -CONFIG_SCSI_MPT2SAS_MAX_SGE=128 -CONFIG_SCSI_MPT3SAS_MAX_SGE=128 -# CONFIG_SCSI_MPT2SAS is not set -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_SCSI_HPTIOP is not set -# CONFIG_SCSI_SNIC is not set -# CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_FUTURE_DOMAIN is not set -# CONFIG_SCSI_IPS is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_INIA100 is not set -# CONFIG_SCSI_STEX is not set -# CONFIG_SCSI_SYM53C8XX_2 is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_QLA_ISCSI is not set -# CONFIG_SCSI_DC395x is not set -# CONFIG_SCSI_AM53C974 is not set -# CONFIG_SCSI_WD719X is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_PMCRAID is not set -# CONFIG_SCSI_PM8001 is not set -# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set -# CONFIG_SCSI_DH is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -CONFIG_HAVE_PATA_PLATFORM=y -CONFIG_ATA=y -# CONFIG_ATA_NONSTANDARD is not set -CONFIG_ATA_VERBOSE_ERROR=y -CONFIG_SATA_PMP=y - -# -# Controllers with non-SFF native interface -# -CONFIG_SATA_AHCI=y -CONFIG_SATA_AHCI_PLATFORM=y -# CONFIG_AHCI_CEVA is not set -# CONFIG_AHCI_QORIQ is not set -# CONFIG_SATA_INIC162X is not set -# CONFIG_SATA_ACARD_AHCI is not set -# CONFIG_SATA_SIL24 is not set -CONFIG_ATA_SFF=y - -# -# SFF controllers with custom DMA interface -# -# CONFIG_PDC_ADMA is not set -# CONFIG_SATA_QSTOR is not set -# CONFIG_SATA_SX4 is not set -CONFIG_ATA_BMDMA=y - -# -# SATA SFF controllers with BMDMA -# -# CONFIG_ATA_PIIX is not set -# CONFIG_SATA_MV is not set -# CONFIG_SATA_NV is not set -# CONFIG_SATA_PROMISE is not set -# CONFIG_SATA_SIL is not set -# CONFIG_SATA_SIS is not set -# CONFIG_SATA_SVW is not set -# CONFIG_SATA_ULI is not set -# CONFIG_SATA_VIA is not set -# CONFIG_SATA_VITESSE is not set - -# -# PATA SFF controllers with BMDMA -# -# CONFIG_PATA_ALI is not set -# CONFIG_PATA_AMD is not set -# CONFIG_PATA_ARTOP is not set -# CONFIG_PATA_ATIIXP is not set -# CONFIG_PATA_ATP867X is not set -# CONFIG_PATA_CMD64X is not set -# CONFIG_PATA_CYPRESS is not set -# CONFIG_PATA_EFAR is not set -# CONFIG_PATA_HPT366 is not set -# CONFIG_PATA_HPT37X is not set -# CONFIG_PATA_HPT3X2N is not set -# CONFIG_PATA_HPT3X3 is not set -# CONFIG_PATA_IT8213 is not set -# CONFIG_PATA_IT821X is not set -# CONFIG_PATA_JMICRON is not set -# CONFIG_PATA_MARVELL is not set -# CONFIG_PATA_NETCELL is not set -# CONFIG_PATA_NINJA32 is not set -# CONFIG_PATA_NS87415 is not set -# CONFIG_PATA_OLDPIIX is not set -# CONFIG_PATA_OPTIDMA is not set -# CONFIG_PATA_PDC2027X is not set -# CONFIG_PATA_PDC_OLD is not set -# CONFIG_PATA_RADISYS is not set -# CONFIG_PATA_RDC is not set -# CONFIG_PATA_SCH is not set -# CONFIG_PATA_SERVERWORKS is not set -# CONFIG_PATA_SIL680 is not set -# CONFIG_PATA_SIS is not set -# CONFIG_PATA_TOSHIBA is not set -# CONFIG_PATA_TRIFLEX is not set -# CONFIG_PATA_VIA is not set -# CONFIG_PATA_WINBOND is not set - -# -# PIO-only SFF controllers -# -# CONFIG_PATA_CMD640_PCI is not set -# CONFIG_PATA_MPIIX is not set -# CONFIG_PATA_NS87410 is not set -# CONFIG_PATA_OPTI is not set -# CONFIG_PATA_PLATFORM is not set -# CONFIG_PATA_RZ1000 is not set - -# -# Generic fallback / legacy drivers -# -# CONFIG_ATA_GENERIC is not set -# CONFIG_PATA_LEGACY is not set -CONFIG_MD=y -CONFIG_BLK_DEV_MD=m -CONFIG_MD_LINEAR=m -CONFIG_MD_RAID0=m -CONFIG_MD_RAID1=m -CONFIG_MD_RAID10=m -CONFIG_MD_RAID456=m -CONFIG_MD_MULTIPATH=m -CONFIG_MD_FAULTY=m -CONFIG_BCACHE=m -# CONFIG_BCACHE_DEBUG is not set -# CONFIG_BCACHE_CLOSURES_DEBUG is not set -CONFIG_BLK_DEV_DM_BUILTIN=y -CONFIG_BLK_DEV_DM=y -# CONFIG_DM_MQ_DEFAULT is not set -# CONFIG_DM_DEBUG is not set -CONFIG_DM_BUFIO=m -CONFIG_DM_BIO_PRISON=m -CONFIG_DM_PERSISTENT_DATA=m -# CONFIG_DM_DEBUG_BLOCK_STACK_TRACING is not set -CONFIG_DM_CRYPT=m -CONFIG_DM_SNAPSHOT=m -CONFIG_DM_THIN_PROVISIONING=m -CONFIG_DM_CACHE=m -CONFIG_DM_CACHE_MQ=m -CONFIG_DM_CACHE_SMQ=m -CONFIG_DM_CACHE_CLEANER=m -CONFIG_DM_ERA=m -CONFIG_DM_MIRROR=m -CONFIG_DM_LOG_USERSPACE=m -CONFIG_DM_RAID=m -CONFIG_DM_ZERO=m -CONFIG_DM_MULTIPATH=m -CONFIG_DM_MULTIPATH_QL=m -CONFIG_DM_MULTIPATH_ST=m -CONFIG_DM_DELAY=m -# CONFIG_DM_UEVENT is not set -CONFIG_DM_FLAKEY=m -CONFIG_DM_VERITY=m -# CONFIG_DM_VERITY_HASH_PREFETCH_MIN_SIZE_128 is not set -CONFIG_DM_VERITY_HASH_PREFETCH_MIN_SIZE=1 -# CONFIG_DM_VERITY_FEC is not set -CONFIG_DM_SWITCH=m -CONFIG_DM_LOG_WRITES=m -# CONFIG_DM_VERITY_AVB is not set -# CONFIG_DM_ANDROID_VERITY_AT_MOST_ONCE_DEFAULT_ENABLED is not set -CONFIG_TARGET_CORE=m -CONFIG_TCM_IBLOCK=m -CONFIG_TCM_FILEIO=m -CONFIG_TCM_PSCSI=m -CONFIG_TCM_USER2=m -# CONFIG_LOOPBACK_TARGET is not set -CONFIG_ISCSI_TARGET=m -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# -# CONFIG_FIREWIRE is not set -# CONFIG_FIREWIRE_NOSY is not set -CONFIG_NETDEVICES=y -CONFIG_MII=y -CONFIG_NET_CORE=y -CONFIG_BONDING=m -CONFIG_DUMMY=m -CONFIG_EQUALIZER=m -# CONFIG_NET_FC is not set -CONFIG_NET_TEAM=m -# CONFIG_NET_TEAM_MODE_BROADCAST is not set -# CONFIG_NET_TEAM_MODE_ROUNDROBIN is not set -# CONFIG_NET_TEAM_MODE_RANDOM is not set -# CONFIG_NET_TEAM_MODE_ACTIVEBACKUP is not set -# CONFIG_NET_TEAM_MODE_LOADBALANCE is not set -CONFIG_MACVLAN=m -CONFIG_MACVTAP=m -CONFIG_IPVLAN=m -CONFIG_VXLAN=m -CONFIG_GENEVE=m -CONFIG_NETCONSOLE=m -# CONFIG_NETCONSOLE_DYNAMIC is not set -CONFIG_NETPOLL=y -CONFIG_NET_POLL_CONTROLLER=y -CONFIG_TUN=m -# CONFIG_TUN_VNET_CROSS_LE is not set -CONFIG_VETH=m -CONFIG_NLMON=m -CONFIG_ARCNET=m -# CONFIG_ARCNET_1201 is not set -# CONFIG_ARCNET_1051 is not set -# CONFIG_ARCNET_RAW is not set -# CONFIG_ARCNET_CAP is not set -# CONFIG_ARCNET_COM90xx is not set -# CONFIG_ARCNET_COM90xxIO is not set -# CONFIG_ARCNET_RIM_I is not set -# CONFIG_ARCNET_COM20020 is not set - -# -# CAIF transport drivers -# -CONFIG_VHOST_NET=m -# CONFIG_VHOST_SCSI is not set -CONFIG_VHOST_RING=m -CONFIG_VHOST=m -# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set - -# -# Distributed Switch Architecture drivers -# -# CONFIG_NET_DSA_MV88E6XXX is not set -# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set -CONFIG_ETHERNET=y -CONFIG_NET_VENDOR_3COM=y -# CONFIG_VORTEX is not set -# CONFIG_TYPHOON is not set -CONFIG_NET_VENDOR_ADAPTEC=y -# CONFIG_ADAPTEC_STARFIRE is not set -CONFIG_NET_VENDOR_AGERE=y -# CONFIG_ET131X is not set -CONFIG_NET_VENDOR_ALTEON=y -# CONFIG_ACENIC is not set -# CONFIG_ALTERA_TSE is not set -CONFIG_NET_VENDOR_AMD=y -# CONFIG_AMD8111_ETH is not set -# CONFIG_PCNET32 is not set -# CONFIG_AMD_XGBE is not set -CONFIG_NET_VENDOR_ARC=y -CONFIG_ARC_EMAC_CORE=y -# CONFIG_ARC_EMAC is not set -CONFIG_EMAC_ROCKCHIP=y -CONFIG_NET_VENDOR_ATHEROS=y -# CONFIG_ATL2 is not set -# CONFIG_ATL1 is not set -# CONFIG_ATL1E is not set -# CONFIG_ATL1C is not set -# CONFIG_ALX is not set -# CONFIG_NET_VENDOR_AURORA is not set -CONFIG_NET_CADENCE=y -# CONFIG_MACB is not set -CONFIG_NET_VENDOR_BROADCOM=y -# CONFIG_B44 is not set -# CONFIG_BCMGENET is not set -# CONFIG_BNX2 is not set -# CONFIG_CNIC is not set -# CONFIG_TIGON3 is not set -# CONFIG_BNX2X is not set -# CONFIG_SYSTEMPORT is not set -# CONFIG_BNXT is not set -CONFIG_NET_VENDOR_BROCADE=y -# CONFIG_BNA is not set -CONFIG_NET_VENDOR_CAVIUM=y -# CONFIG_THUNDER_NIC_PF is not set -# CONFIG_THUNDER_NIC_VF is not set -# CONFIG_THUNDER_NIC_BGX is not set -# CONFIG_LIQUIDIO is not set -CONFIG_NET_VENDOR_CHELSIO=y -# CONFIG_CHELSIO_T1 is not set -# CONFIG_CHELSIO_T3 is not set -# CONFIG_CHELSIO_T4 is not set -# CONFIG_CHELSIO_T4VF is not set -CONFIG_NET_VENDOR_CISCO=y -# CONFIG_ENIC is not set -# CONFIG_DNET is not set -CONFIG_NET_VENDOR_DEC=y -# CONFIG_NET_TULIP is not set -CONFIG_NET_VENDOR_DLINK=y -# CONFIG_DL2K is not set -# CONFIG_SUNDANCE is not set -CONFIG_NET_VENDOR_EMULEX=y -# CONFIG_BE2NET is not set -CONFIG_NET_VENDOR_EZCHIP=y -# CONFIG_EZCHIP_NPS_MANAGEMENT_ENET is not set -CONFIG_NET_VENDOR_EXAR=y -# CONFIG_S2IO is not set -# CONFIG_VXGE is not set -CONFIG_NET_VENDOR_HISILICON=y -# CONFIG_HIX5HD2_GMAC is not set -# CONFIG_HIP04_ETH is not set -# CONFIG_HNS is not set -# CONFIG_HNS_DSAF is not set -# CONFIG_HNS_ENET is not set -CONFIG_NET_VENDOR_HP=y -# CONFIG_HP100 is not set -CONFIG_NET_VENDOR_INTEL=y -# CONFIG_E100 is not set -# CONFIG_E1000 is not set -# CONFIG_E1000E is not set -# CONFIG_IGB is not set -# CONFIG_IGBVF is not set -# CONFIG_IXGB is not set -# CONFIG_IXGBE is not set -# CONFIG_IXGBEVF is not set -# CONFIG_I40E is not set -# CONFIG_I40EVF is not set -# CONFIG_FM10K is not set -CONFIG_NET_VENDOR_I825XX=y -# CONFIG_JME is not set -CONFIG_NET_VENDOR_MARVELL=y -# CONFIG_MVMDIO is not set -# CONFIG_SKGE is not set -# CONFIG_SKY2 is not set -CONFIG_NET_VENDOR_MELLANOX=y -# CONFIG_MLX4_EN is not set -# CONFIG_MLX4_CORE is not set -# CONFIG_MLX5_CORE is not set -# CONFIG_MLXSW_CORE is not set -CONFIG_NET_VENDOR_MICREL=y -# CONFIG_KS8842 is not set -# CONFIG_KS8851 is not set -# CONFIG_KS8851_MLL is not set -# CONFIG_KSZ884X_PCI is not set -CONFIG_NET_VENDOR_MICROCHIP=y -# CONFIG_ENC28J60 is not set -# CONFIG_ENCX24J600 is not set -CONFIG_NET_VENDOR_MYRI=y -# CONFIG_MYRI10GE is not set -# CONFIG_FEALNX is not set -CONFIG_NET_VENDOR_NATSEMI=y -# CONFIG_NATSEMI is not set -# CONFIG_NS83820 is not set -CONFIG_NET_VENDOR_8390=y -# CONFIG_NE2K_PCI is not set -CONFIG_NET_VENDOR_NVIDIA=y -# CONFIG_FORCEDETH is not set -CONFIG_NET_VENDOR_OKI=y -# CONFIG_ETHOC is not set -CONFIG_NET_PACKET_ENGINE=y -# CONFIG_HAMACHI is not set -# CONFIG_YELLOWFIN is not set -CONFIG_NET_VENDOR_QLOGIC=y -# CONFIG_QLA3XXX is not set -# CONFIG_QLCNIC is not set -# CONFIG_QLGE is not set -# CONFIG_NETXEN_NIC is not set -# CONFIG_QED is not set -CONFIG_NET_VENDOR_QUALCOMM=y -# CONFIG_QCA7000 is not set -CONFIG_NET_VENDOR_REALTEK=y -# CONFIG_8139CP is not set -# CONFIG_8139TOO is not set -# CONFIG_R8169 is not set -CONFIG_NET_VENDOR_RENESAS=y -CONFIG_NET_VENDOR_RDC=y -# CONFIG_R6040 is not set -CONFIG_NET_VENDOR_ROCKER=y -CONFIG_NET_VENDOR_SAMSUNG=y -# CONFIG_SXGBE_ETH is not set -CONFIG_NET_VENDOR_SEEQ=y -CONFIG_NET_VENDOR_SILAN=y -# CONFIG_SC92031 is not set -CONFIG_NET_VENDOR_SIS=y -# CONFIG_SIS900 is not set -# CONFIG_SIS190 is not set -# CONFIG_SFC is not set -CONFIG_NET_VENDOR_SMSC=y -# CONFIG_SMC91X is not set -# CONFIG_EPIC100 is not set -# CONFIG_SMSC911X is not set -# CONFIG_SMSC9420 is not set -CONFIG_NET_VENDOR_STMICRO=y -CONFIG_STMMAC_ETH=y -CONFIG_STMMAC_PLATFORM=y -CONFIG_DWMAC_GENERIC=y -# CONFIG_DWMAC_IPQ806X is not set -# CONFIG_DWMAC_LPC18XX is not set -# CONFIG_DWMAC_MESON is not set -CONFIG_DWMAC_ROCKCHIP=y -# CONFIG_DWMAC_SOCFPGA is not set -# CONFIG_DWMAC_STI is not set -# CONFIG_DWMAC_SUNXI is not set -# CONFIG_STMMAC_PCI is not set -CONFIG_NET_VENDOR_SUN=y -# CONFIG_HAPPYMEAL is not set -# CONFIG_SUNGEM is not set -# CONFIG_CASSINI is not set -# CONFIG_NIU is not set -CONFIG_NET_VENDOR_SYNOPSYS=y -# CONFIG_SYNOPSYS_DWC_ETH_QOS is not set -CONFIG_NET_VENDOR_TEHUTI=y -# CONFIG_TEHUTI is not set -CONFIG_NET_VENDOR_TI=y -# CONFIG_TI_CPSW_ALE is not set -# CONFIG_TLAN is not set -CONFIG_NET_VENDOR_VIA=y -# CONFIG_VIA_RHINE is not set -# CONFIG_VIA_VELOCITY is not set -CONFIG_NET_VENDOR_WIZNET=y -# CONFIG_WIZNET_W5100 is not set -# CONFIG_WIZNET_W5300 is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -CONFIG_PHYLIB=y - -# -# MII PHY device drivers -# -# CONFIG_AQUANTIA_PHY is not set -# CONFIG_AT803X_PHY is not set -# CONFIG_AMD_PHY is not set -# CONFIG_MARVELL_PHY is not set -# CONFIG_DAVICOM_PHY is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_LXT_PHY is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_VITESSE_PHY is not set -# CONFIG_TERANETICS_PHY is not set -CONFIG_ROCKCHIP_PHY=y -# CONFIG_SMSC_PHY is not set -# CONFIG_BROADCOM_PHY is not set -# CONFIG_BCM7XXX_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_ICPLUS_PHY is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_STE10XP is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_DP83848_PHY is not set -# CONFIG_DP83867_PHY is not set -CONFIG_MICROCHIP_PHY=m -# CONFIG_FIXED_PHY is not set -# CONFIG_MDIO_BITBANG is not set -# CONFIG_MDIO_OCTEON is not set -# CONFIG_MDIO_BUS_MUX_GPIO is not set -# CONFIG_MDIO_BUS_MUX_MMIOREG is not set -# CONFIG_MDIO_BCM_UNIMAC is not set -# CONFIG_MICREL_KS8995MA is not set -CONFIG_PPP=m -CONFIG_PPP_BSDCOMP=m -CONFIG_PPP_DEFLATE=m -# CONFIG_PPP_FILTER is not set -# CONFIG_PPP_MPPE is not set -# CONFIG_PPP_MULTILINK is not set -CONFIG_PPPOE=m -# CONFIG_PPTP is not set -CONFIG_PPPOLAC=m -CONFIG_PPPOPNS=m -CONFIG_PPP_ASYNC=m -CONFIG_PPP_SYNC_TTY=m -# CONFIG_SLIP is not set -CONFIG_SLHC=m -CONFIG_USB_NET_DRIVERS=y -CONFIG_USB_CATC=m -CONFIG_USB_KAWETH=m -CONFIG_USB_PEGASUS=m -CONFIG_USB_RTL8150=m -CONFIG_USB_RTL8152=m -CONFIG_USB_LAN78XX=m -CONFIG_USB_USBNET=y -CONFIG_USB_NET_AX8817X=m -CONFIG_USB_NET_AX88179_178A=m -CONFIG_USB_NET_CDCETHER=y -CONFIG_USB_NET_CDC_EEM=m -CONFIG_USB_NET_CDC_NCM=m -CONFIG_USB_NET_HUAWEI_CDC_NCM=m -CONFIG_USB_NET_CDC_MBIM=m -CONFIG_USB_NET_DM9601=m -CONFIG_USB_NET_SR9700=m -CONFIG_USB_NET_SR9800=m -CONFIG_USB_NET_SMSC75XX=m -CONFIG_USB_NET_SMSC95XX=m -CONFIG_USB_NET_GL620A=m -CONFIG_USB_NET_NET1080=m -CONFIG_USB_NET_PLUSB=m -CONFIG_USB_NET_MCS7830=m -CONFIG_USB_NET_RNDIS_HOST=y -CONFIG_USB_NET_CDC_SUBSET_ENABLE=m -CONFIG_USB_NET_CDC_SUBSET=m -CONFIG_USB_ALI_M5632=y -CONFIG_USB_AN2720=y -CONFIG_USB_BELKIN=y -# CONFIG_USB_ARMLINUX is not set -# CONFIG_USB_EPSON2888 is not set -CONFIG_USB_KC2190=y -CONFIG_USB_NET_ZAURUS=m -CONFIG_USB_NET_CX82310_ETH=m -CONFIG_USB_NET_KALMIA=m -CONFIG_USB_NET_QMI_WWAN=m -CONFIG_USB_HSO=m -CONFIG_USB_NET_INT51X1=m -CONFIG_USB_IPHETH=m -CONFIG_USB_SIERRA_NET=m -CONFIG_USB_VL600=m -CONFIG_USB_NET_CH9200=m -CONFIG_WLAN=y -CONFIG_LIBERTAS_THINFIRM=y -# CONFIG_LIBERTAS_THINFIRM_DEBUG is not set -# CONFIG_LIBERTAS_THINFIRM_USB is not set -# CONFIG_ATMEL is not set -CONFIG_AT76C50X_USB=m -# CONFIG_PRISM54 is not set -CONFIG_USB_ZD1201=m -CONFIG_USB_NET_RNDIS_WLAN=m -# CONFIG_ADM8211 is not set -# CONFIG_RTL8180 is not set -CONFIG_RTL8187=m -CONFIG_RTL8187_LEDS=y -# CONFIG_MAC80211_HWSIM is not set -# CONFIG_VIRT_WIFI is not set -# CONFIG_MWL8K is not set -CONFIG_ATH_COMMON=m -CONFIG_ATH_CARDS=m -# CONFIG_ATH_DEBUG is not set -CONFIG_ATH5K=m -# CONFIG_ATH5K_DEBUG is not set -# CONFIG_ATH5K_TRACER is not set -CONFIG_ATH5K_PCI=y -CONFIG_ATH9K_HW=m -CONFIG_ATH9K_COMMON=m -CONFIG_ATH9K_BTCOEX_SUPPORT=y -CONFIG_ATH9K=m -# CONFIG_ATH9K_PCI is not set -# CONFIG_ATH9K_AHB is not set -# CONFIG_ATH9K_DEBUGFS is not set -# CONFIG_ATH9K_DYNACK is not set -# CONFIG_ATH9K_WOW is not set -CONFIG_ATH9K_RFKILL=y -# CONFIG_ATH9K_CHANNEL_CONTEXT is not set -CONFIG_ATH9K_PCOEM=y -CONFIG_ATH9K_HTC=m -# CONFIG_ATH9K_HTC_DEBUGFS is not set -# CONFIG_CARL9170 is not set -CONFIG_ATH6KL=m -# CONFIG_ATH6KL_SDIO is not set -CONFIG_ATH6KL_USB=m -# CONFIG_ATH6KL_DEBUG is not set -# CONFIG_ATH6KL_TRACING is not set -CONFIG_AR5523=m -# CONFIG_WIL6210 is not set -CONFIG_ATH10K=m -# CONFIG_ATH10K_PCI is not set -# CONFIG_ATH10K_DEBUG is not set -# CONFIG_ATH10K_DEBUGFS is not set -# CONFIG_ATH10K_TRACING is not set -CONFIG_WCN36XX=m -# CONFIG_WCN36XX_DEBUGFS is not set -CONFIG_B43=m -CONFIG_B43_BCMA=y -CONFIG_B43_SSB=y -CONFIG_B43_BUSES_BCMA_AND_SSB=y -# CONFIG_B43_BUSES_BCMA is not set -# CONFIG_B43_BUSES_SSB is not set -CONFIG_B43_PCI_AUTOSELECT=y -CONFIG_B43_PCICORE_AUTOSELECT=y -# CONFIG_B43_SDIO is not set -CONFIG_B43_BCMA_PIO=y -CONFIG_B43_PIO=y -CONFIG_B43_PHY_G=y -CONFIG_B43_PHY_N=y -CONFIG_B43_PHY_LP=y -CONFIG_B43_PHY_HT=y -CONFIG_B43_LEDS=y -CONFIG_B43_HWRNG=y -# CONFIG_B43_DEBUG is not set -# CONFIG_B43LEGACY is not set -# CONFIG_BRCMSMAC is not set -# CONFIG_BRCMFMAC is not set -CONFIG_HOSTAP=m -CONFIG_HOSTAP_FIRMWARE=y -CONFIG_HOSTAP_FIRMWARE_NVRAM=y -# CONFIG_HOSTAP_PLX is not set -# CONFIG_HOSTAP_PCI is not set -# CONFIG_IPW2100 is not set -# CONFIG_IPW2200 is not set -# CONFIG_IWLWIFI is not set -# CONFIG_IWL4965 is not set -# CONFIG_IWL3945 is not set -CONFIG_LIBERTAS=m -CONFIG_LIBERTAS_USB=m -# CONFIG_LIBERTAS_SDIO is not set -# CONFIG_LIBERTAS_SPI is not set -# CONFIG_LIBERTAS_DEBUG is not set -# CONFIG_LIBERTAS_MESH is not set -# CONFIG_HERMES is not set -# CONFIG_P54_COMMON is not set -CONFIG_RT2X00=m -# CONFIG_RT2400PCI is not set -# CONFIG_RT2500PCI is not set -# CONFIG_RT61PCI is not set -# CONFIG_RT2800PCI is not set -CONFIG_RT2500USB=m -CONFIG_RT73USB=m -CONFIG_RT2800USB=m -CONFIG_RT2800USB_RT33XX=y -CONFIG_RT2800USB_RT35XX=y -CONFIG_RT2800USB_RT3573=y -CONFIG_RT2800USB_RT53XX=y -CONFIG_RT2800USB_RT55XX=y -CONFIG_RT2800USB_UNKNOWN=y -CONFIG_RT2800_LIB=m -CONFIG_RT2X00_LIB_USB=m -CONFIG_RT2X00_LIB=m -CONFIG_RT2X00_LIB_FIRMWARE=y -CONFIG_RT2X00_LIB_CRYPTO=y -CONFIG_RT2X00_LIB_LEDS=y -# CONFIG_RT2X00_LIB_DEBUGFS is not set -# CONFIG_RT2X00_DEBUG is not set -CONFIG_WL_MEDIATEK=y -CONFIG_MT7601U=m -# CONFIG_RTL_CARDS is not set -CONFIG_RTL8192CU=m -# CONFIG_RTL8XXXU is not set -# CONFIG_WL_ROCKCHIP is not set -CONFIG_RTL8188EU=m -CONFIG_RTL8189ES=m -CONFIG_RTL8189FS=m -CONFIG_RTL8723DS=m -# CONFIG_WL_TI is not set -CONFIG_RTL8822BS=m -CONFIG_RTL8723DU=m -CONFIG_RTL8822BU=m -CONFIG_RTL8821CU=m -CONFIG_88XXAU=m -CONFIG_RTL8192EU=m -CONFIG_ZD1211RW=m -# CONFIG_ZD1211RW_DEBUG is not set -CONFIG_MWIFIEX=m -# CONFIG_MWIFIEX_SDIO is not set -# CONFIG_MWIFIEX_PCIE is not set -CONFIG_MWIFIEX_USB=m -# CONFIG_CW1200 is not set -# CONFIG_RSI_91X is not set - -# -# Enable WiMAX (Networking options) to see the WiMAX drivers -# -# CONFIG_WAN is not set -# CONFIG_VMXNET3 is not set -# CONFIG_ISDN is not set -# CONFIG_NVM is not set - -# -# Input device support -# -CONFIG_INPUT=y -CONFIG_INPUT_LEDS=y -CONFIG_INPUT_FF_MEMLESS=y -CONFIG_INPUT_POLLDEV=y -# CONFIG_INPUT_SPARSEKMAP is not set -CONFIG_INPUT_MATRIXKMAP=y - -# -# Userland interfaces -# -# CONFIG_INPUT_MOUSEDEV is not set -CONFIG_INPUT_JOYDEV=y -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set -# CONFIG_INPUT_KEYRESET is not set -# CONFIG_INPUT_KEYCOMBO is not set - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -CONFIG_KEYBOARD_ADC=y -# CONFIG_KEYBOARD_ADP5588 is not set -# CONFIG_KEYBOARD_ADP5589 is not set -CONFIG_KEYBOARD_ATKBD=y -# CONFIG_KEYBOARD_QT1070 is not set -# CONFIG_KEYBOARD_QT2160 is not set -# CONFIG_KEYBOARD_LKKBD is not set -CONFIG_KEYBOARD_GPIO=y -CONFIG_KEYBOARD_GPIO_POLLED=y -# CONFIG_KEYBOARD_TCA6416 is not set -# CONFIG_KEYBOARD_TCA8418 is not set -# CONFIG_KEYBOARD_MATRIX is not set -# CONFIG_KEYBOARD_LM8323 is not set -# CONFIG_KEYBOARD_LM8333 is not set -# CONFIG_KEYBOARD_MAX7359 is not set -# CONFIG_KEYBOARD_MCS is not set -# CONFIG_KEYBOARD_MPR121 is not set -# CONFIG_KEYBOARD_NEWTON is not set -# CONFIG_KEYBOARD_OPENCORES is not set -# CONFIG_KEYBOARD_SAMSUNG is not set -# CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_OMAP4 is not set -CONFIG_KEYBOARD_ROCKCHIP=y -# CONFIG_KEYBOARD_XTKBD is not set -CONFIG_KEYBOARD_CROS_EC=y -# CONFIG_KEYBOARD_CAP11XX is not set -# CONFIG_KEYBOARD_BCM is not set -CONFIG_INPUT_MOUSE=y -# CONFIG_MOUSE_PS2 is not set -# CONFIG_MOUSE_SERIAL is not set -# CONFIG_MOUSE_APPLETOUCH is not set -# CONFIG_MOUSE_BCM5974 is not set -CONFIG_MOUSE_CYAPA=y -CONFIG_MOUSE_ELAN_I2C=y -CONFIG_MOUSE_ELAN_I2C_I2C=y -# CONFIG_MOUSE_ELAN_I2C_SMBUS is not set -# CONFIG_MOUSE_VSXXXAA is not set -# CONFIG_MOUSE_GPIO is not set -# CONFIG_MOUSE_SYNAPTICS_I2C is not set -# CONFIG_MOUSE_SYNAPTICS_USB is not set -CONFIG_INPUT_JOYSTICK=y -# CONFIG_JOYSTICK_ANALOG is not set -# CONFIG_JOYSTICK_A3D is not set -# CONFIG_JOYSTICK_ADI is not set -# CONFIG_JOYSTICK_COBRA is not set -# CONFIG_JOYSTICK_GF2K is not set -# CONFIG_JOYSTICK_GRIP is not set -# CONFIG_JOYSTICK_GRIP_MP is not set -# CONFIG_JOYSTICK_GUILLEMOT is not set -# CONFIG_JOYSTICK_INTERACT is not set -# CONFIG_JOYSTICK_SIDEWINDER is not set -# CONFIG_JOYSTICK_TMDC is not set -CONFIG_JOYSTICK_IFORCE=y -CONFIG_JOYSTICK_IFORCE_USB=y -# CONFIG_JOYSTICK_IFORCE_232 is not set -# CONFIG_JOYSTICK_WARRIOR is not set -# CONFIG_JOYSTICK_MAGELLAN is not set -# CONFIG_JOYSTICK_SPACEORB is not set -# CONFIG_JOYSTICK_SPACEBALL is not set -# CONFIG_JOYSTICK_STINGER is not set -# CONFIG_JOYSTICK_TWIDJOY is not set -# CONFIG_JOYSTICK_ZHENHUA is not set -# CONFIG_JOYSTICK_AS5011 is not set -# CONFIG_JOYSTICK_JOYDUMP is not set -CONFIG_JOYSTICK_XPAD=y -CONFIG_JOYSTICK_XPAD_FF=y -CONFIG_JOYSTICK_XPAD_LEDS=y -CONFIG_INPUT_TABLET=y -# CONFIG_TABLET_USB_ACECAD is not set -# CONFIG_TABLET_USB_AIPTEK is not set -# CONFIG_TABLET_USB_GTCO is not set -# CONFIG_TABLET_USB_HANWANG is not set -# CONFIG_TABLET_USB_KBTAB is not set -# CONFIG_TABLET_SERIAL_WACOM4 is not set -CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_PROPERTIES=y -# CONFIG_TOUCHSCREEN_ADS7846 is not set -# CONFIG_TOUCHSCREEN_AD7877 is not set -# CONFIG_TOUCHSCREEN_AD7879 is not set -# CONFIG_TOUCHSCREEN_AR1021_I2C is not set -CONFIG_TOUCHSCREEN_ATMEL_MXT=y -# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set -# CONFIG_TOUCHSCREEN_BU21013 is not set -# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set -# CONFIG_TOUCHSCREEN_CY8C40XX is not set -# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set -# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set -# CONFIG_TOUCHSCREEN_CYTTSP4_CORE is not set -# CONFIG_TOUCHSCREEN_DYNAPRO is not set -# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set -# CONFIG_TOUCHSCREEN_EETI is not set -# CONFIG_TOUCHSCREEN_EGALAX is not set -# CONFIG_TOUCHSCREEN_FT6236 is not set -# CONFIG_TOUCHSCREEN_FUJITSU is not set -# CONFIG_TOUCHSCREEN_GOODIX is not set -# CONFIG_TOUCHSCREEN_GSLX680A is not set -# CONFIG_TOUCHSCREEN_GSLX680_D708 is not set -# CONFIG_TOUCHSCREEN_GSLX680_PAD is not set -CONFIG_TOUCHSCREEN_GSLX680_VR=y -# CONFIG_TOUCHSCREEN_GSLX680_FIREFLY is not set -CONFIG_TOUCHSCREEN_GSL3673=y -# CONFIG_TOUCHSCREEN_GSL3673_800X1280 is not set -CONFIG_TOUCHSCREEN_GT9XX=y -# CONFIG_TOUCHSCREEN_ILI210X is not set -# CONFIG_TOUCHSCREEN_GUNZE is not set -CONFIG_TOUCHSCREEN_ELAN=y -# CONFIG_TOUCHSCREEN_ELO is not set -# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set -# CONFIG_TOUCHSCREEN_WACOM_I2C is not set -# CONFIG_TOUCHSCREEN_MAX11801 is not set -# CONFIG_TOUCHSCREEN_MCS5000 is not set -# CONFIG_TOUCHSCREEN_MMS114 is not set -# CONFIG_TOUCHSCREEN_MTOUCH is not set -# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set -# CONFIG_TOUCHSCREEN_INEXIO is not set -# CONFIG_TOUCHSCREEN_MK712 is not set -# CONFIG_TOUCHSCREEN_PENMOUNT is not set -# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set -# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set -# CONFIG_TOUCHSCREEN_TOUCHWIN is not set -# CONFIG_TOUCHSCREEN_PIXCIR is not set -# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set -CONFIG_TOUCHSCREEN_USB_COMPOSITE=y -CONFIG_TOUCHSCREEN_USB_EGALAX=y -CONFIG_TOUCHSCREEN_USB_PANJIT=y -CONFIG_TOUCHSCREEN_USB_3M=y -CONFIG_TOUCHSCREEN_USB_ITM=y -CONFIG_TOUCHSCREEN_USB_ETURBO=y -CONFIG_TOUCHSCREEN_USB_GUNZE=y -CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y -CONFIG_TOUCHSCREEN_USB_IRTOUCH=y -CONFIG_TOUCHSCREEN_USB_IDEALTEK=y -CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y -CONFIG_TOUCHSCREEN_USB_GOTOP=y -CONFIG_TOUCHSCREEN_USB_JASTEC=y -CONFIG_TOUCHSCREEN_USB_ELO=y -CONFIG_TOUCHSCREEN_USB_E2I=y -CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y -CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y -CONFIG_TOUCHSCREEN_USB_NEXIO=y -CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y -# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set -# CONFIG_TOUCHSCREEN_TSC_SERIO is not set -# CONFIG_TOUCHSCREEN_TSC2004 is not set -# CONFIG_TOUCHSCREEN_TSC2005 is not set -# CONFIG_TOUCHSCREEN_TSC2007 is not set -# CONFIG_TOUCHSCREEN_ST1232 is not set -# CONFIG_TOUCHSCREEN_SUR40 is not set -# CONFIG_TOUCHSCREEN_SX8654 is not set -# CONFIG_TOUCHSCREEN_TPS6507X is not set -# CONFIG_TOUCHSCREEN_ZFORCE is not set -CONFIG_TOUCHSCREEN_COLIBRI_VF50=m -# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set -# CONFIG_TOUCHSCREEN_VTL_CT36X is not set -CONFIG_TOUCHSCREEN_GT1X=y -CONFIG_ROCKCHIP_REMOTECTL=y -CONFIG_ROCKCHIP_REMOTECTL_PWM=y - -# -# handle all sensors -# -CONFIG_SENSOR_DEVICE=y -# CONFIG_ANGLE_DEVICE is not set -# CONFIG_GSENSOR_DEVICE is not set -# CONFIG_COMPASS_DEVICE is not set -# CONFIG_GYROSCOPE_DEVICE is not set -# CONFIG_LIGHT_DEVICE is not set -# CONFIG_PROXIMITY_DEVICE is not set -# CONFIG_TEMPERATURE_DEVICE is not set -# CONFIG_PRESSURE_DEVICE is not set -CONFIG_HALL_DEVICE=y -# CONFIG_HS_OCH165T is not set -CONFIG_HS_MH248=y -CONFIG_INPUT_MISC=y -# CONFIG_INPUT_AD714X is not set -# CONFIG_INPUT_BMA150 is not set -# CONFIG_INPUT_E3X0_BUTTON is not set -# CONFIG_INPUT_MMA8450 is not set -# CONFIG_INPUT_MPU3050 is not set -# CONFIG_INPUT_GP2A is not set -# CONFIG_INPUT_GPIO_BEEPER is not set -# CONFIG_INPUT_GPIO_TILT_POLLED is not set -# CONFIG_INPUT_ATI_REMOTE2 is not set -# CONFIG_INPUT_KEYCHORD is not set -# CONFIG_INPUT_KEYSPAN_REMOTE is not set -# CONFIG_INPUT_KXTJ9 is not set -# CONFIG_INPUT_POWERMATE is not set -# CONFIG_INPUT_YEALINK is not set -# CONFIG_INPUT_CM109 is not set -# CONFIG_INPUT_REGULATOR_HAPTIC is not set -CONFIG_INPUT_RK8XX_PWRKEY=y -CONFIG_INPUT_UINPUT=y -CONFIG_INPUT_GPIO=y -# CONFIG_INPUT_PCF8574 is not set -# CONFIG_INPUT_PWM_BEEPER is not set -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set -# CONFIG_INPUT_ADXL34X is not set -# CONFIG_INPUT_IMS_PCU is not set -# CONFIG_INPUT_CMA3000 is not set -# CONFIG_INPUT_SOC_BUTTON_ARRAY is not set -# CONFIG_INPUT_DRV260X_HAPTICS is not set -# CONFIG_INPUT_DRV2665_HAPTICS is not set -# CONFIG_INPUT_DRV2667_HAPTICS is not set - -# -# Hardware I/O ports -# -CONFIG_SERIO=y -CONFIG_SERIO_SERPORT=y -# CONFIG_SERIO_AMBAKMI is not set -# CONFIG_SERIO_PCIPS2 is not set -CONFIG_SERIO_LIBPS2=y -CONFIG_SERIO_RAW=y -# CONFIG_SERIO_ALTERA_PS2 is not set -# CONFIG_SERIO_PS2MULT is not set -# CONFIG_SERIO_ARC_PS2 is not set -# CONFIG_SERIO_APBPS2 is not set -# CONFIG_USERIO is not set -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_TTY=y -CONFIG_VT=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -CONFIG_HW_CONSOLE=y -CONFIG_VT_HW_CONSOLE_BINDING=y -CONFIG_UNIX98_PTYS=y -CONFIG_DEVPTS_MULTIPLE_INSTANCES=y -# CONFIG_LEGACY_PTYS is not set -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_NOZOMI is not set -# CONFIG_N_GSM is not set -# CONFIG_TRACE_SINK is not set -CONFIG_LDISC_AUTOLOAD=y -CONFIG_DEVMEM=y -# CONFIG_DEVKMEM is not set - -# -# Serial drivers -# -CONFIG_SERIAL_EARLYCON=y -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_DMA=y -# CONFIG_SERIAL_8250_PCI is not set -CONFIG_SERIAL_8250_NR_UARTS=5 -CONFIG_SERIAL_8250_RUNTIME_UARTS=5 -# CONFIG_SERIAL_8250_EXTENDED is not set -CONFIG_SERIAL_8250_FSL=y -CONFIG_SERIAL_8250_DW=y -# CONFIG_SERIAL_8250_RT288X is not set -# CONFIG_SERIAL_8250_INGENIC is not set -# CONFIG_SERIAL_8250_MID is not set - -# -# Non-8250 serial port support -# -# CONFIG_SERIAL_AMBA_PL010 is not set -# CONFIG_SERIAL_AMBA_PL011 is not set -# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX310X is not set -# CONFIG_SERIAL_UARTLITE is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_JSM is not set -CONFIG_SERIAL_OF_PLATFORM=y -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_SC16IS7XX is not set -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_RP2 is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set -# CONFIG_TTY_PRINTK is not set -# CONFIG_HVC_DCC is not set -# CONFIG_IPMI_HANDLER is not set -CONFIG_HW_RANDOM=y -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -CONFIG_HW_RANDOM_TPM=y -# CONFIG_HW_RANDOM_ROCKCHIP is not set -# CONFIG_APPLICOM is not set - -# -# PCMCIA character devices -# -# CONFIG_RAW_DRIVER is not set -CONFIG_TCG_TPM=y -# CONFIG_TCG_TIS_I2C_ATMEL is not set -CONFIG_TCG_TIS_I2C_INFINEON=y -# CONFIG_TCG_TIS_I2C_NUVOTON is not set -# CONFIG_TCG_ATMEL is not set -# CONFIG_TCG_TIS_ST33ZP24 is not set -CONFIG_DEVPORT=y -# CONFIG_XILLYBUS is not set - -# -# I2C support -# -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_COMPAT=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MUX=y - -# -# Multiplexer I2C Chip support -# -# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set -# CONFIG_I2C_MUX_GPIO is not set -# CONFIG_I2C_MUX_PCA9541 is not set -# CONFIG_I2C_MUX_PCA954x is not set -# CONFIG_I2C_MUX_PINCTRL is not set -# CONFIG_I2C_MUX_REG is not set -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_ALGOBIT=y - -# -# I2C Hardware Bus support -# - -# -# PC SMBus host controller drivers -# -# CONFIG_I2C_ALI1535 is not set -# CONFIG_I2C_ALI1563 is not set -# CONFIG_I2C_ALI15X3 is not set -# CONFIG_I2C_AMD756 is not set -# CONFIG_I2C_AMD8111 is not set -# CONFIG_I2C_I801 is not set -# CONFIG_I2C_ISCH is not set -# CONFIG_I2C_PIIX4 is not set -# CONFIG_I2C_NFORCE2 is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -# CONFIG_I2C_VIA is not set -# CONFIG_I2C_VIAPRO is not set - -# -# I2C system bus drivers (mostly embedded / system-on-chip) -# -# CONFIG_I2C_CADENCE is not set -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -# CONFIG_I2C_DESIGNWARE_PCI is not set -# CONFIG_I2C_EMEV2 is not set -# CONFIG_I2C_GPIO is not set -# CONFIG_I2C_NOMADIK is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PXA_PCI is not set -CONFIG_I2C_RK3X=y -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_XILINX is not set - -# -# External I2C/SMBus adapter drivers -# -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set - -# -# Other I2C/SMBus bus drivers -# -CONFIG_I2C_CROS_EC_TUNNEL=y -CONFIG_I2C_STUB=m -# CONFIG_I2C_SLAVE is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -CONFIG_SPI=y -# CONFIG_SPI_DEBUG is not set -CONFIG_SPI_MASTER=y - -# -# SPI Master Controller Drivers -# -# CONFIG_SPI_ALTERA is not set -CONFIG_SPI_BITBANG=y -# CONFIG_SPI_CADENCE is not set -# CONFIG_SPI_GPIO is not set -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_OC_TINY is not set -# CONFIG_SPI_PL022 is not set -# CONFIG_SPI_PXA2XX is not set -# CONFIG_SPI_PXA2XX_PCI is not set -CONFIG_SPI_ROCKCHIP=y -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_ZYNQMP_GQSPI is not set -# CONFIG_SPI_DESIGNWARE is not set - -# -# SPI Protocol Masters -# -CONFIG_SPI_SPIDEV=y -# CONFIG_SPI_TLE62X0 is not set -# CONFIG_SPMI is not set -# CONFIG_HSI is not set - -# -# PPS support -# -CONFIG_PPS=y -# CONFIG_PPS_DEBUG is not set - -# -# PPS clients support -# -CONFIG_PPS_CLIENT_KTIMER=m -# CONFIG_PPS_CLIENT_LDISC is not set -CONFIG_PPS_CLIENT_GPIO=m - -# -# PPS generators support -# - -# -# PTP clock support -# -CONFIG_PTP_1588_CLOCK=y - -# -# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. -# -CONFIG_PINCTRL=y - -# -# Pin controllers -# -CONFIG_PINMUX=y -CONFIG_PINCONF=y -CONFIG_GENERIC_PINCONF=y -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_PINCTRL_AMD is not set -CONFIG_PINCTRL_ROCKCHIP=y -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_PINCTRL_RK805=y -CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_OF_GPIO=y -CONFIG_DEBUG_GPIO=y -CONFIG_GPIO_SYSFS=y -CONFIG_GPIO_GENERIC=y - -# -# Memory mapped GPIO drivers -# -# CONFIG_GPIO_74XX_MMIO is not set -# CONFIG_GPIO_ALTERA is not set -# CONFIG_GPIO_DWAPB is not set -CONFIG_GPIO_GENERIC_PLATFORM=y -# CONFIG_GPIO_GRGPIO is not set -# CONFIG_GPIO_PL061 is not set -# CONFIG_GPIO_SYSCON is not set -# CONFIG_GPIO_VX855 is not set -# CONFIG_GPIO_XGENE is not set -# CONFIG_GPIO_XILINX is not set -# CONFIG_GPIO_ZX is not set - -# -# I2C GPIO expanders -# -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_ADNP is not set -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_PCA953X is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_SX150X is not set - -# -# MFD GPIO expanders -# -CONFIG_GPIO_RK8XX=y -# CONFIG_GPIO_TPS6586X is not set - -# -# PCI GPIO expanders -# -# CONFIG_GPIO_AMD8111 is not set -# CONFIG_GPIO_BT8XX is not set -# CONFIG_GPIO_ML_IOH is not set -# CONFIG_GPIO_RDC321X is not set - -# -# SPI GPIO expanders -# -# CONFIG_GPIO_74X164 is not set -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MC33880 is not set - -# -# SPI or I2C GPIO expanders -# -# CONFIG_GPIO_MCP23S08 is not set - -# -# USB GPIO expanders -# -CONFIG_W1=m -CONFIG_W1_CON=y - -# -# 1-wire Bus Masters -# -CONFIG_W1_MASTER_MATROX=m -CONFIG_W1_MASTER_DS2490=m -CONFIG_W1_MASTER_DS2482=m -CONFIG_W1_MASTER_DS1WM=m -CONFIG_W1_MASTER_GPIO=m - -# -# 1-wire Slaves -# -CONFIG_W1_SLAVE_THERM=m -CONFIG_W1_SLAVE_SMEM=m -CONFIG_W1_SLAVE_DS2408=m -CONFIG_W1_SLAVE_DS2408_READBACK=y -CONFIG_W1_SLAVE_DS2413=m -CONFIG_W1_SLAVE_DS2406=m -CONFIG_W1_SLAVE_DS2423=m -CONFIG_W1_SLAVE_DS2431=m -CONFIG_W1_SLAVE_DS2433=m -CONFIG_W1_SLAVE_DS2433_CRC=y -CONFIG_W1_SLAVE_DS2760=m -CONFIG_W1_SLAVE_DS2780=m -CONFIG_W1_SLAVE_DS2781=m -CONFIG_W1_SLAVE_DS28E04=m -CONFIG_W1_SLAVE_BQ27000=m -CONFIG_POWER_SUPPLY=y -# CONFIG_POWER_SUPPLY_DEBUG is not set -# CONFIG_PDA_POWER is not set -# CONFIG_GENERIC_ADC_BATTERY is not set -# CONFIG_TEST_POWER is not set -CONFIG_BATTERY_DS2760=m -# CONFIG_BATTERY_DS2780 is not set -# CONFIG_BATTERY_DS2781 is not set -# CONFIG_BATTERY_DS2782 is not set -CONFIG_BATTERY_SBS=y -# CONFIG_BATTERY_BQ27XXX is not set -# CONFIG_BATTERY_MAX17040 is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_CHARGER_ISP1704 is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_LP8727 is not set -CONFIG_CHARGER_GPIO=y -# CONFIG_CHARGER_MANAGER is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_CHARGER_BQ24190 is not set -# CONFIG_CHARGER_BQ24257 is not set -CONFIG_CHARGER_BQ24735=y -# CONFIG_CHARGER_BQ25700 is not set -# CONFIG_CHARGER_BQ25890 is not set -# CONFIG_CHARGER_SMB347 is not set -# CONFIG_CHARGER_SY6982C is not set -CONFIG_CHARGER_UNIVERSAL=y -# CONFIG_BATTERY_GAUGE_LTC2941 is not set -# CONFIG_BATTERY_EC is not set -CONFIG_BATTERY_CW2015=y -# CONFIG_BATTERY_RK816 is not set -CONFIG_BATTERY_RK817=y -CONFIG_CHARGER_RK817=y -# CONFIG_BATTERY_RK818 is not set -# CONFIG_CHARGER_RK818 is not set -# CONFIG_CHARGER_RT9455 is not set -CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_GPIO=y -CONFIG_POWER_RESET_GPIO_RESTART=y -# CONFIG_POWER_RESET_LTC2952 is not set -# CONFIG_POWER_RESET_RESTART is not set -# CONFIG_POWER_RESET_XGENE is not set -# CONFIG_POWER_RESET_SYSCON is not set -# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set -CONFIG_REBOOT_MODE=y -CONFIG_SYSCON_REBOOT_MODE=y -CONFIG_POWER_AVS=y -CONFIG_ROCKCHIP_IODOMAIN=y -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Native drivers -# -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADT7310 is not set -# CONFIG_SENSORS_ADT7410 is not set -# CONFIG_SENSORS_ADT7411 is not set -# CONFIG_SENSORS_ADT7462 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7475 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_I5K_AMB is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_G760A is not set -# CONFIG_SENSORS_G762 is not set -# CONFIG_SENSORS_GPIO_FAN is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_IIO_HWMON is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_POWR1220 is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LTC2945 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4222 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4260 is not set -# CONFIG_SENSORS_LTC4261 is not set -# CONFIG_SENSORS_MAX1111 is not set -# CONFIG_SENSORS_MAX16065 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX1668 is not set -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6642 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MAX31790 is not set -# CONFIG_SENSORS_HTU21 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_ADCXX is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM70 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_NTC_THERMISTOR is not set -# CONFIG_SENSORS_NCT6683 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NCT7802 is not set -# CONFIG_SENSORS_NCT7904 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set -CONFIG_SENSORS_PWM_FAN=y -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SHTC1 is not set -# CONFIG_SENSORS_SIS5595 is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_SCH5627 is not set -# CONFIG_SENSORS_SCH5636 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_ADC128D818 is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 is not set -# CONFIG_SENSORS_AMC6821 is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_TC74 is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP103 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_VT8231 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -CONFIG_THERMAL=y -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_OF=y -CONFIG_THERMAL_WRITABLE_TRIPS=y -# CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE is not set -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR=y -CONFIG_THERMAL_GOV_FAIR_SHARE=y -CONFIG_THERMAL_GOV_STEP_WISE=y -# CONFIG_THERMAL_GOV_BANG_BANG is not set -# CONFIG_THERMAL_GOV_USER_SPACE is not set -CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y -CONFIG_CPU_THERMAL=y -# CONFIG_CLOCK_THERMAL is not set -CONFIG_DEVFREQ_THERMAL=y -# CONFIG_THERMAL_EMULATION is not set -# CONFIG_IMX_THERMAL is not set -CONFIG_ROCKCHIP_THERMAL=y -# CONFIG_RK_VIRTUAL_THERMAL is not set -# CONFIG_RK3368_THERMAL is not set -CONFIG_WATCHDOG=y -CONFIG_WATCHDOG_CORE=y -# CONFIG_WATCHDOG_NOWAYOUT is not set - -# -# Watchdog Device Drivers -# -CONFIG_SOFT_WATCHDOG=m -# CONFIG_GPIO_WATCHDOG is not set -# CONFIG_XILINX_WATCHDOG is not set -# CONFIG_ARM_SP805_WATCHDOG is not set -# CONFIG_CADENCE_WATCHDOG is not set -CONFIG_DW_WATCHDOG=y -# CONFIG_MAX63XX_WATCHDOG is not set -# CONFIG_ALIM7101_WDT is not set -# CONFIG_I6300ESB_WDT is not set -# CONFIG_BCM7038_WDT is not set -# CONFIG_MEN_A21_WDT is not set - -# -# PCI-based Watchdog Cards -# -# CONFIG_PCIPCWATCHDOG is not set -# CONFIG_WDTPCI is not set - -# -# USB-based Watchdog Cards -# -# CONFIG_USBPCWATCHDOG is not set -CONFIG_SSB_POSSIBLE=y - -# -# Sonics Silicon Backplane -# -CONFIG_SSB=m -CONFIG_SSB_SPROM=y -CONFIG_SSB_BLOCKIO=y -CONFIG_SSB_PCIHOST_POSSIBLE=y -CONFIG_SSB_PCIHOST=y -CONFIG_SSB_B43_PCI_BRIDGE=y -CONFIG_SSB_SDIOHOST_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_HOST_SOC is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSB_DEBUG is not set -CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y -CONFIG_SSB_DRIVER_PCICORE=y -# CONFIG_SSB_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y - -# -# Broadcom specific AMBA -# -CONFIG_BCMA=m -CONFIG_BCMA_BLOCKIO=y -CONFIG_BCMA_HOST_PCI_POSSIBLE=y -CONFIG_BCMA_HOST_PCI=y -# CONFIG_BCMA_HOST_SOC is not set -CONFIG_BCMA_DRIVER_PCI=y -# CONFIG_BCMA_DRIVER_GMAC_CMN is not set -# CONFIG_BCMA_DRIVER_GPIO is not set -# CONFIG_BCMA_DEBUG is not set - -# -# Multifunction device drivers -# -CONFIG_MFD_CORE=y -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_AS3722 is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_ATMEL_FLEXCOM is not set -# CONFIG_MFD_ATMEL_HLCDC is not set -# CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_AXP20X is not set -CONFIG_MFD_CROS_EC=y -# CONFIG_MFD_CROS_EC_I2C is not set -CONFIG_MFD_CROS_EC_SPI=y -# CONFIG_PMIC_DA903X is not set -# CONFIG_MFD_DA9052_SPI is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9062 is not set -# CONFIG_MFD_DA9063 is not set -# CONFIG_MFD_DA9150 is not set -# CONFIG_MFD_DLN2 is not set -# CONFIG_MFD_MC13XXX_SPI is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_MFD_HI6421_PMIC is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_LPC_ICH is not set -# CONFIG_LPC_SCH is not set -# CONFIG_INTEL_SOC_PMIC is not set -# CONFIG_MFD_JANZ_CMODIO is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77686 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX77843 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_MFD_MT6397 is not set -# CONFIG_MFD_MENF21BMC is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_MFD_RDC321X is not set -# CONFIG_MFD_RTSX_PCI is not set -# CONFIG_MFD_RT5033 is not set -# CONFIG_MFD_RTSX_USB is not set -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_RK618 is not set -CONFIG_MFD_RK808=y -# CONFIG_MFD_RN5T618 is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_MFD_STMPE is not set -CONFIG_MFD_SYSCON=y -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set -# CONFIG_MFD_TPS65218 is not set -CONFIG_MFD_TPS6586X=y -# CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912 is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS65912_SPI is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_MFD_VX855 is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_ARIZONA_SPI is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM831X_SPI is not set -# CONFIG_MFD_RK1000 is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set -CONFIG_FUSB_30X=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_DEBUG=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y -# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set -# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set -CONFIG_REGULATOR_ACT8865=y -# CONFIG_REGULATOR_AD5398 is not set -# CONFIG_REGULATOR_ANATOP is not set -# CONFIG_REGULATOR_DA9210 is not set -# CONFIG_REGULATOR_DA9211 is not set -CONFIG_REGULATOR_FAN53555=y -CONFIG_REGULATOR_GPIO=y -# CONFIG_REGULATOR_ISL9305 is not set -# CONFIG_REGULATOR_ISL6271A is not set -# CONFIG_REGULATOR_LP3971 is not set -# CONFIG_REGULATOR_LP3972 is not set -# CONFIG_REGULATOR_LP872X is not set -CONFIG_REGULATOR_LP8752=y -# CONFIG_REGULATOR_LP8755 is not set -# CONFIG_REGULATOR_LTC3589 is not set -# CONFIG_REGULATOR_MAX1586 is not set -# CONFIG_REGULATOR_MAX8649 is not set -# CONFIG_REGULATOR_MAX8660 is not set -# CONFIG_REGULATOR_MAX8952 is not set -# CONFIG_REGULATOR_MAX8973 is not set -CONFIG_REGULATOR_MP8865=y -# CONFIG_REGULATOR_MT6311 is not set -# CONFIG_REGULATOR_PFUZE100 is not set -CONFIG_REGULATOR_PWM=y -CONFIG_REGULATOR_RK808=y -CONFIG_REGULATOR_RK818=y -# CONFIG_REGULATOR_SYR82X is not set -# CONFIG_REGULATOR_TPS51632 is not set -# CONFIG_REGULATOR_TPS549B22 is not set -# CONFIG_REGULATOR_TPS62360 is not set -# CONFIG_REGULATOR_TPS65023 is not set -# CONFIG_REGULATOR_TPS6507X is not set -# CONFIG_REGULATOR_TPS65132 is not set -# CONFIG_REGULATOR_TPS6524X is not set -CONFIG_REGULATOR_TPS6586X=y -CONFIG_REGULATOR_XZ3216=y -CONFIG_CEC_CORE=y -CONFIG_CEC_NOTIFIER=y -CONFIG_MEDIA_SUPPORT=y - -# -# Multimedia core support -# -CONFIG_MEDIA_CAMERA_SUPPORT=y -# CONFIG_MEDIA_ANALOG_TV_SUPPORT is not set -CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y -# CONFIG_MEDIA_RADIO_SUPPORT is not set -CONFIG_MEDIA_SDR_SUPPORT=y -CONFIG_MEDIA_RC_SUPPORT=y -CONFIG_MEDIA_CEC_SUPPORT=y -CONFIG_MEDIA_CEC_RC=y -CONFIG_MEDIA_CONTROLLER=y -CONFIG_VIDEO_DEV=y -CONFIG_VIDEO_V4L2_SUBDEV_API=y -CONFIG_VIDEO_V4L2=y -# CONFIG_VIDEO_ADV_DEBUG is not set -# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set -CONFIG_VIDEO_TUNER=m -CONFIG_V4L2_MEM2MEM_DEV=y -CONFIG_V4L2_FWNODE=y -CONFIG_VIDEOBUF_GEN=y -CONFIG_VIDEOBUF_VMALLOC=m -CONFIG_VIDEOBUF_DVB=m -CONFIG_VIDEOBUF2_CORE=y -CONFIG_VIDEOBUF2_MEMOPS=y -CONFIG_VIDEOBUF2_DMA_CONTIG=y -CONFIG_VIDEOBUF2_VMALLOC=y -CONFIG_VIDEOBUF2_DMA_SG=y -CONFIG_DVB_CORE=y -CONFIG_DVB_NET=y -CONFIG_TTPCI_EEPROM=m -CONFIG_DVB_MAX_ADAPTERS=8 -# CONFIG_DVB_DYNAMIC_MINORS is not set - -# -# Media drivers -# -CONFIG_RC_CORE=y -CONFIG_RC_MAP=y -CONFIG_LIRC=y -CONFIG_RC_DECODERS=y -CONFIG_IR_NEC_DECODER=y -CONFIG_IR_RC5_DECODER=y -CONFIG_IR_RC6_DECODER=y -CONFIG_IR_JVC_DECODER=y -CONFIG_IR_SONY_DECODER=y -CONFIG_IR_SANYO_DECODER=y -CONFIG_IR_SHARP_DECODER=y -CONFIG_IR_MCE_KBD_DECODER=y -CONFIG_IR_XMP_DECODER=y -# CONFIG_IR_IMON_DECODER is not set -CONFIG_RC_DEVICES=y -# CONFIG_RC_ATI_REMOTE is not set -# CONFIG_IR_HIX5HD2 is not set -# CONFIG_IR_IMON is not set -# CONFIG_IR_MCEUSB is not set -# CONFIG_IR_REDRAT3 is not set -# CONFIG_IR_STREAMZAP is not set -# CONFIG_IR_IGORPLUGUSB is not set -# CONFIG_IR_IGUANA is not set -# CONFIG_IR_TTUSBIR is not set -# CONFIG_RC_LOOPBACK is not set -CONFIG_IR_GPIO_CIR=m -# CONFIG_IR_GPIO_TX is not set -# CONFIG_IR_PWM_TX is not set -# CONFIG_IR_SERIAL is not set -CONFIG_MEDIA_USB_SUPPORT=y - -# -# Webcam devices -# -CONFIG_USB_VIDEO_CLASS=y -# CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV is not set -CONFIG_USB_GSPCA=m -CONFIG_USB_M5602=m -CONFIG_USB_STV06XX=m -CONFIG_USB_GL860=m -CONFIG_USB_GSPCA_BENQ=m -CONFIG_USB_GSPCA_CONEX=m -CONFIG_USB_GSPCA_CPIA1=m -CONFIG_USB_GSPCA_DTCS033=m -CONFIG_USB_GSPCA_ETOMS=m -CONFIG_USB_GSPCA_FINEPIX=m -CONFIG_USB_GSPCA_JEILINJ=m -CONFIG_USB_GSPCA_JL2005BCD=m -CONFIG_USB_GSPCA_KINECT=m -CONFIG_USB_GSPCA_KONICA=m -CONFIG_USB_GSPCA_MARS=m -CONFIG_USB_GSPCA_MR97310A=m -CONFIG_USB_GSPCA_NW80X=m -CONFIG_USB_GSPCA_OV519=m -CONFIG_USB_GSPCA_OV534=m -CONFIG_USB_GSPCA_OV534_9=m -CONFIG_USB_GSPCA_PAC207=m -CONFIG_USB_GSPCA_PAC7302=m -CONFIG_USB_GSPCA_PAC7311=m -CONFIG_USB_GSPCA_SE401=m -CONFIG_USB_GSPCA_SN9C2028=m -CONFIG_USB_GSPCA_SN9C20X=m -CONFIG_USB_GSPCA_SONIXB=m -CONFIG_USB_GSPCA_SONIXJ=m -CONFIG_USB_GSPCA_SPCA500=m -CONFIG_USB_GSPCA_SPCA501=m -CONFIG_USB_GSPCA_SPCA505=m -CONFIG_USB_GSPCA_SPCA506=m -CONFIG_USB_GSPCA_SPCA508=m -CONFIG_USB_GSPCA_SPCA561=m -CONFIG_USB_GSPCA_SPCA1528=m -CONFIG_USB_GSPCA_SQ905=m -CONFIG_USB_GSPCA_SQ905C=m -CONFIG_USB_GSPCA_SQ930X=m -CONFIG_USB_GSPCA_STK014=m -CONFIG_USB_GSPCA_STK1135=m -CONFIG_USB_GSPCA_STV0680=m -CONFIG_USB_GSPCA_SUNPLUS=m -CONFIG_USB_GSPCA_T613=m -CONFIG_USB_GSPCA_TOPRO=m -CONFIG_USB_GSPCA_TOUPTEK=m -CONFIG_USB_GSPCA_TV8532=m -CONFIG_USB_GSPCA_VC032X=m -CONFIG_USB_GSPCA_VICAM=m -CONFIG_USB_GSPCA_XIRLINK_CIT=m -CONFIG_USB_GSPCA_ZC3XX=m -CONFIG_USB_PWC=m -# CONFIG_USB_PWC_DEBUG is not set -CONFIG_USB_PWC_INPUT_EVDEV=y -CONFIG_VIDEO_CPIA2=m -CONFIG_USB_ZR364XX=m -CONFIG_USB_STKWEBCAM=m -CONFIG_USB_S2255=m -CONFIG_VIDEO_USBTV=m - -# -# Analog/digital TV USB devices -# -CONFIG_VIDEO_AU0828=m -CONFIG_VIDEO_AU0828_V4L2=y -# CONFIG_VIDEO_AU0828_RC is not set -CONFIG_VIDEO_CX231XX=m -CONFIG_VIDEO_CX231XX_RC=y -CONFIG_VIDEO_CX231XX_ALSA=m -CONFIG_VIDEO_CX231XX_DVB=m -# CONFIG_VIDEO_TM6000 is not set - -# -# Digital TV USB devices -# -CONFIG_DVB_USB=m -# CONFIG_DVB_USB_DEBUG is not set -CONFIG_DVB_USB_A800=m -CONFIG_DVB_USB_DIBUSB_MB=m -# CONFIG_DVB_USB_DIBUSB_MB_FAULTY is not set -CONFIG_DVB_USB_DIBUSB_MC=m -CONFIG_DVB_USB_DIB0700=m -CONFIG_DVB_USB_UMT_010=m -CONFIG_DVB_USB_CXUSB=m -CONFIG_DVB_USB_M920X=m -CONFIG_DVB_USB_DIGITV=m -CONFIG_DVB_USB_VP7045=m -CONFIG_DVB_USB_VP702X=m -CONFIG_DVB_USB_GP8PSK=m -CONFIG_DVB_USB_NOVA_T_USB2=m -CONFIG_DVB_USB_TTUSB2=m -CONFIG_DVB_USB_DTT200U=m -CONFIG_DVB_USB_OPERA1=m -CONFIG_DVB_USB_AF9005=m -CONFIG_DVB_USB_AF9005_REMOTE=m -CONFIG_DVB_USB_PCTV452E=m -CONFIG_DVB_USB_DW2102=m -CONFIG_DVB_USB_CINERGY_T2=m -CONFIG_DVB_USB_DTV5100=m -CONFIG_DVB_USB_FRIIO=m -CONFIG_DVB_USB_AZ6027=m -CONFIG_DVB_USB_TECHNISAT_USB2=m -CONFIG_DVB_USB_V2=m -CONFIG_DVB_USB_AF9015=m -CONFIG_DVB_USB_AF9035=m -CONFIG_DVB_USB_ANYSEE=m -CONFIG_DVB_USB_AU6610=m -CONFIG_DVB_USB_AZ6007=m -CONFIG_DVB_USB_CE6230=m -CONFIG_DVB_USB_EC168=m -CONFIG_DVB_USB_GL861=m -# CONFIG_DVB_USB_LME2510 is not set -CONFIG_DVB_USB_MXL111SF=m -CONFIG_DVB_USB_RTL28XXU=m -CONFIG_DVB_USB_DVBSKY=m -CONFIG_DVB_TTUSB_BUDGET=m -CONFIG_DVB_TTUSB_DEC=m -CONFIG_SMS_USB_DRV=m -CONFIG_DVB_B2C2_FLEXCOP_USB=m -# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set -CONFIG_DVB_AS102=m - -# -# Webcam, TV (analog/digital) USB devices -# -# CONFIG_VIDEO_EM28XX is not set - -# -# Software defined radio USB devices -# -CONFIG_USB_AIRSPY=m -CONFIG_USB_HACKRF=m -CONFIG_USB_MSI2500=m - -# -# USB HDMI CEC adapters -# -CONFIG_USB_PULSE8_CEC=m -CONFIG_USB_RAINSHADOW_CEC=m -# CONFIG_MEDIA_PCI_SUPPORT is not set -CONFIG_V4L_PLATFORM_DRIVERS=y -# CONFIG_VIDEO_CAFE_CCIC is not set -CONFIG_SOC_CAMERA=y -# CONFIG_SOC_CAMERA_PLATFORM is not set -# CONFIG_VIDEO_XILINX is not set -# CONFIG_VIDEO_RK_CIF_ISP10 is not set -# CONFIG_VIDEO_ROCKCHIP_CIF is not set -CONFIG_VIDEO_ROCKCHIP_ISP1=y -CONFIG_V4L_MEM2MEM_DRIVERS=y -# CONFIG_VIDEO_MEM2MEM_DEINTERLACE is not set -# CONFIG_VIDEO_SH_VEU is not set -CONFIG_VIDEO_ROCKCHIP_RGA=y -CONFIG_VIDEO_ROCKCHIP_VPU=y -CONFIG_V4L_TEST_DRIVERS=y -# CONFIG_VIDEO_VIVID is not set -# CONFIG_VIDEO_VIM2M is not set -CONFIG_DVB_PLATFORM_DRIVERS=y -# CONFIG_ROCKCHIP_TSP is not set - -# -# Supported MMC/SDIO adapters -# -# CONFIG_SMS_SDIO_DRV is not set -CONFIG_MEDIA_COMMON_OPTIONS=y - -# -# common driver options -# -CONFIG_VIDEO_CX2341X=m -CONFIG_VIDEO_TVEEPROM=m -CONFIG_CYPRESS_FIRMWARE=m -CONFIG_DVB_B2C2_FLEXCOP=m -CONFIG_SMS_SIANO_MDTV=m -CONFIG_SMS_SIANO_RC=y - -# -# Media ancillary drivers (tuners, sensors, i2c, spi, frontends) -# -# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set -CONFIG_MEDIA_ATTACH=y -# CONFIG_VIDEO_IR_I2C is not set - -# -# I2C Encoders, decoders, sensors and other helper chips -# - -# -# Audio decoders, processors and mixers -# -# CONFIG_VIDEO_TVAUDIO is not set -# CONFIG_VIDEO_TDA7432 is not set -# CONFIG_VIDEO_TDA9840 is not set -# CONFIG_VIDEO_TEA6415C is not set -# CONFIG_VIDEO_TEA6420 is not set -# CONFIG_VIDEO_MSP3400 is not set -# CONFIG_VIDEO_CS5345 is not set -# CONFIG_VIDEO_CS53L32A is not set -# CONFIG_VIDEO_TLV320AIC23B is not set -# CONFIG_VIDEO_UDA1342 is not set -# CONFIG_VIDEO_WM8775 is not set -# CONFIG_VIDEO_WM8739 is not set -# CONFIG_VIDEO_VP27SMPX is not set -# CONFIG_VIDEO_SONY_BTF_MPX is not set - -# -# RDS decoders -# -# CONFIG_VIDEO_SAA6588 is not set - -# -# Video decoders -# -# CONFIG_VIDEO_ADV7180 is not set -CONFIG_VIDEO_ADV7181D=m -# CONFIG_VIDEO_ADV7183 is not set -# CONFIG_VIDEO_ADV7604 is not set -# CONFIG_VIDEO_ADV7842 is not set -# CONFIG_VIDEO_BT819 is not set -# CONFIG_VIDEO_BT856 is not set -# CONFIG_VIDEO_BT866 is not set -# CONFIG_VIDEO_KS0127 is not set -# CONFIG_VIDEO_ML86V7667 is not set -# CONFIG_VIDEO_SAA7110 is not set -# CONFIG_VIDEO_SAA711X is not set -CONFIG_VIDEO_TC35874X=y -# CONFIG_VIDEO_TVP514X is not set -# CONFIG_VIDEO_TVP5150 is not set -# CONFIG_VIDEO_TVP7002 is not set -# CONFIG_VIDEO_TW2804 is not set -# CONFIG_VIDEO_TW9903 is not set -# CONFIG_VIDEO_TW9906 is not set -# CONFIG_VIDEO_VPX3220 is not set - -# -# Video and audio decoders -# -# CONFIG_VIDEO_SAA717X is not set -CONFIG_VIDEO_CX25840=m - -# -# Video encoders -# -# CONFIG_VIDEO_SAA7127 is not set -# CONFIG_VIDEO_SAA7185 is not set -# CONFIG_VIDEO_ADV7170 is not set -# CONFIG_VIDEO_ADV7175 is not set -# CONFIG_VIDEO_ADV7343 is not set -# CONFIG_VIDEO_ADV7393 is not set -# CONFIG_VIDEO_ADV7511 is not set -# CONFIG_VIDEO_AD9389B is not set -# CONFIG_VIDEO_AK881X is not set -# CONFIG_VIDEO_THS8200 is not set - -# -# Camera sensor devices -# -# CONFIG_VIDEO_IMX219 is not set -# CONFIG_VIDEO_IMX323 is not set -# CONFIG_VIDEO_VIRT_CAMERA is not set -# CONFIG_VIDEO_OV2659 is not set -# CONFIG_VIDEO_OV2685 is not set -# CONFIG_VIDEO_OV2718 is not set -# CONFIG_VIDEO_OV2735 is not set -CONFIG_VIDEO_OV4689=y -# CONFIG_VIDEO_OV5647 is not set -# CONFIG_VIDEO_OV5695 is not set -# CONFIG_VIDEO_OV7251 is not set -# CONFIG_VIDEO_OV7640 is not set -# CONFIG_VIDEO_OV7670 is not set -# CONFIG_VIDEO_OV7725 is not set -CONFIG_VIDEO_OV7750=y -# CONFIG_VIDEO_OV9650 is not set -CONFIG_VIDEO_OV13850=y -# CONFIG_VIDEO_VS6624 is not set -# CONFIG_VIDEO_MT9M032 is not set -# CONFIG_VIDEO_MT9P031 is not set -# CONFIG_VIDEO_MT9T001 is not set -# CONFIG_VIDEO_MT9V011 is not set -# CONFIG_VIDEO_MT9V032 is not set -# CONFIG_VIDEO_SR030PC30 is not set -# CONFIG_VIDEO_NOON010PC30 is not set -# CONFIG_VIDEO_M5MOLS is not set -# CONFIG_VIDEO_S5K6AA is not set -# CONFIG_VIDEO_S5K6A3 is not set -# CONFIG_VIDEO_S5K4ECGX is not set -# CONFIG_VIDEO_S5K5BAF is not set -# CONFIG_VIDEO_SMIAPP is not set -# CONFIG_VIDEO_S5C73M3 is not set -# CONFIG_VIDEO_GC2155 is not set -# CONFIG_VIDEO_GC0312 is not set -# CONFIG_VIDEO_GC2145 is not set -CONFIG_VIDEO_GC2355=y -CONFIG_VIDEO_SC031GS=y -# CONFIG_VIDEO_GC0329 is not set -# CONFIG_VIDEO_GC2035 is not set - -# -# Flash devices -# -# CONFIG_VIDEO_ADP1653 is not set -# CONFIG_VIDEO_AS3645A is not set -# CONFIG_VIDEO_LM3560 is not set -# CONFIG_VIDEO_LM3646 is not set - -# -# Video improvement chips -# -# CONFIG_VIDEO_UPD64031A is not set -# CONFIG_VIDEO_UPD64083 is not set - -# -# Camera lens devices -# -# CONFIG_VIDEO_VM149C is not set - -# -# Audio/Video compression chips -# -# CONFIG_VIDEO_SAA6752HS is not set - -# -# Miscellaneous helper chips -# -# CONFIG_VIDEO_THS7303 is not set -# CONFIG_VIDEO_M52790 is not set - -# -# Sensors used on soc_camera driver -# - -# -# soc_camera sensor drivers -# -# CONFIG_SOC_CAMERA_IMX074 is not set -# CONFIG_SOC_CAMERA_MT9M001 is not set -# CONFIG_SOC_CAMERA_MT9M111 is not set -# CONFIG_SOC_CAMERA_MT9T031 is not set -# CONFIG_SOC_CAMERA_MT9T112 is not set -# CONFIG_SOC_CAMERA_MT9V022 is not set -# CONFIG_SOC_CAMERA_OV2640 is not set -# CONFIG_SOC_CAMERA_OV5642 is not set -# CONFIG_SOC_CAMERA_OV6650 is not set -# CONFIG_SOC_CAMERA_OV772X is not set -# CONFIG_SOC_CAMERA_OV9640 is not set -# CONFIG_SOC_CAMERA_OV9740 is not set -# CONFIG_SOC_CAMERA_RJ54N1 is not set -# CONFIG_SOC_CAMERA_TW9910 is not set - -# -# SPI helper chips -# -# CONFIG_VIDEO_GS1662 is not set -# CONFIG_VIDEO_ROCKCHIP_PREISP is not set -CONFIG_MEDIA_TUNER=y - -# -# Customize TV tuners -# -CONFIG_MEDIA_TUNER_SIMPLE=m -CONFIG_MEDIA_TUNER_TDA8290=m -CONFIG_MEDIA_TUNER_TDA827X=m -CONFIG_MEDIA_TUNER_TDA18271=m -CONFIG_MEDIA_TUNER_TDA9887=m -CONFIG_MEDIA_TUNER_TEA5761=m -CONFIG_MEDIA_TUNER_TEA5767=m -CONFIG_MEDIA_TUNER_MSI001=m -CONFIG_MEDIA_TUNER_MT20XX=m -CONFIG_MEDIA_TUNER_MT2060=m -CONFIG_MEDIA_TUNER_MT2063=m -CONFIG_MEDIA_TUNER_MT2266=m -CONFIG_MEDIA_TUNER_MT2131=m -CONFIG_MEDIA_TUNER_QT1010=m -CONFIG_MEDIA_TUNER_XC2028=m -CONFIG_MEDIA_TUNER_XC5000=m -CONFIG_MEDIA_TUNER_XC4000=m -CONFIG_MEDIA_TUNER_MXL5005S=m -CONFIG_MEDIA_TUNER_MXL5007T=m -CONFIG_MEDIA_TUNER_MC44S803=m -CONFIG_MEDIA_TUNER_MAX2165=m -CONFIG_MEDIA_TUNER_TDA18218=m -CONFIG_MEDIA_TUNER_FC0011=m -CONFIG_MEDIA_TUNER_FC0012=m -CONFIG_MEDIA_TUNER_FC0013=m -CONFIG_MEDIA_TUNER_TDA18212=m -CONFIG_MEDIA_TUNER_E4000=m -CONFIG_MEDIA_TUNER_FC2580=m -CONFIG_MEDIA_TUNER_M88RS6000T=m -CONFIG_MEDIA_TUNER_TUA9001=m -CONFIG_MEDIA_TUNER_SI2157=m -CONFIG_MEDIA_TUNER_IT913X=m -CONFIG_MEDIA_TUNER_R820T=m -CONFIG_MEDIA_TUNER_MXL301RF=m -CONFIG_MEDIA_TUNER_QM1D1C0042=m - -# -# Customise DVB Frontends -# - -# -# Multistandard (satellite) frontends -# -CONFIG_DVB_STB0899=m -CONFIG_DVB_STB6100=m -CONFIG_DVB_STV090x=m -CONFIG_DVB_STV6110x=m -CONFIG_DVB_M88DS3103=m - -# -# Multistandard (cable + terrestrial) frontends -# -CONFIG_DVB_DRXK=m -CONFIG_DVB_TDA18271C2DD=m -CONFIG_DVB_SI2165=m - -# -# DVB-S (satellite) frontends -# -CONFIG_DVB_CX24110=m -CONFIG_DVB_CX24123=m -CONFIG_DVB_MT312=m -CONFIG_DVB_ZL10036=m -CONFIG_DVB_ZL10039=m -CONFIG_DVB_S5H1420=m -CONFIG_DVB_STV0288=m -CONFIG_DVB_STB6000=m -CONFIG_DVB_STV0299=m -CONFIG_DVB_STV6110=m -CONFIG_DVB_STV0900=m -CONFIG_DVB_TDA8083=m -CONFIG_DVB_TDA10086=m -CONFIG_DVB_TDA8261=m -CONFIG_DVB_VES1X93=m -CONFIG_DVB_TUNER_ITD1000=m -CONFIG_DVB_TUNER_CX24113=m -CONFIG_DVB_TDA826X=m -CONFIG_DVB_TUA6100=m -CONFIG_DVB_CX24116=m -CONFIG_DVB_CX24117=m -CONFIG_DVB_CX24120=m -CONFIG_DVB_SI21XX=m -CONFIG_DVB_TS2020=m -CONFIG_DVB_DS3000=m -CONFIG_DVB_MB86A16=m -CONFIG_DVB_TDA10071=m - -# -# DVB-T (terrestrial) frontends -# -CONFIG_DVB_SP8870=m -CONFIG_DVB_SP887X=m -CONFIG_DVB_CX22700=m -CONFIG_DVB_CX22702=m -CONFIG_DVB_S5H1432=m -CONFIG_DVB_DRXD=m -CONFIG_DVB_L64781=m -CONFIG_DVB_TDA1004X=m -CONFIG_DVB_NXT6000=m -CONFIG_DVB_MT352=m -CONFIG_DVB_ZL10353=m -CONFIG_DVB_DIB3000MB=m -CONFIG_DVB_DIB3000MC=m -CONFIG_DVB_DIB7000M=m -CONFIG_DVB_DIB7000P=m -CONFIG_DVB_DIB9000=m -CONFIG_DVB_TDA10048=m -CONFIG_DVB_AF9013=m -CONFIG_DVB_EC100=m -CONFIG_DVB_HD29L2=m -CONFIG_DVB_STV0367=m -CONFIG_DVB_CXD2820R=m -CONFIG_DVB_CXD2841ER=m -CONFIG_DVB_RTL2830=m -CONFIG_DVB_RTL2832=m -CONFIG_DVB_RTL2832_SDR=m -CONFIG_DVB_SI2168=m -CONFIG_DVB_AS102_FE=m - -# -# DVB-C (cable) frontends -# -CONFIG_DVB_VES1820=m -CONFIG_DVB_TDA10021=m -CONFIG_DVB_TDA10023=m -CONFIG_DVB_STV0297=m - -# -# ATSC (North American/Korean Terrestrial/Cable DTV) frontends -# -CONFIG_DVB_NXT200X=m -CONFIG_DVB_OR51211=m -CONFIG_DVB_OR51132=m -CONFIG_DVB_BCM3510=m -CONFIG_DVB_LGDT330X=m -CONFIG_DVB_LGDT3305=m -CONFIG_DVB_LGDT3306A=m -CONFIG_DVB_LG2160=m -CONFIG_DVB_S5H1409=m -CONFIG_DVB_AU8522=m -CONFIG_DVB_AU8522_DTV=m -# CONFIG_DVB_AU8522_V4L is not set -CONFIG_DVB_S5H1411=m - -# -# ISDB-T (terrestrial) frontends -# -CONFIG_DVB_S921=m -CONFIG_DVB_DIB8000=m -CONFIG_DVB_MB86A20S=m - -# -# ISDB-S (satellite) & ISDB-T (terrestrial) frontends -# -CONFIG_DVB_TC90522=m - -# -# Digital terrestrial only tuners/PLL -# -CONFIG_DVB_PLL=m -CONFIG_DVB_TUNER_DIB0070=m -CONFIG_DVB_TUNER_DIB0090=m - -# -# SEC control devices for DVB-S -# -CONFIG_DVB_DRX39XYJ=m -CONFIG_DVB_LNBH25=m -CONFIG_DVB_LNBP21=m -CONFIG_DVB_LNBP22=m -CONFIG_DVB_ISL6405=m -CONFIG_DVB_ISL6421=m -CONFIG_DVB_ISL6423=m -CONFIG_DVB_A8293=m -CONFIG_DVB_SP2=m -CONFIG_DVB_LGS8GL5=m -CONFIG_DVB_LGS8GXX=m -CONFIG_DVB_ATBM8830=m -CONFIG_DVB_TDA665x=m -CONFIG_DVB_IX2505V=m -CONFIG_DVB_M88RS2000=m -CONFIG_DVB_AF9033=m -CONFIG_DVB_HORUS3A=m -CONFIG_DVB_ASCOT2E=m - -# -# Tools to develop new frontends -# -# CONFIG_DVB_DUMMY_FE is not set -# CONFIG_CAMSYS_DRV is not set -# CONFIG_ROCK_CHIP_SOC_CAMERA is not set - -# -# Graphics support -# -# CONFIG_VGA_ARB is not set -CONFIG_DRM=y -CONFIG_DRM_IGNORE_IOTCL_PERMIT=y -CONFIG_DRM_MIPI_DSI=y -CONFIG_DRM_KMS_HELPER=y -CONFIG_DRM_KMS_FB_HELPER=y -CONFIG_DRM_FBDEV_EMULATION=y -CONFIG_DRM_LOAD_EDID_FIRMWARE=y -CONFIG_DRM_TTM=m -# CONFIG_DRM_SCDC_HELPER is not set -CONFIG_DRM_DMA_SYNC=y - -# -# I2C encoder or helper chips -# -# CONFIG_DRM_I2C_ADV7511 is not set -# CONFIG_DRM_I2C_CH7006 is not set -# CONFIG_DRM_I2C_SIL164 is not set -# CONFIG_DRM_I2C_NXP_TDA998X is not set -# CONFIG_DRM_TDFX is not set -# CONFIG_DRM_R128 is not set -# CONFIG_DRM_RADEON is not set -# CONFIG_DRM_AMDGPU is not set -# CONFIG_DRM_NOUVEAU is not set -# CONFIG_DRM_MGA is not set -# CONFIG_DRM_VIA is not set -# CONFIG_DRM_SAVAGE is not set -# CONFIG_DRM_VGEM is not set -CONFIG_DRM_ROCKCHIP=y -# CONFIG_ROCKCHIP_DRM_DEBUG is not set -CONFIG_ROCKCHIP_DRM_RGA=y -CONFIG_ROCKCHIP_CDN_DP=y -CONFIG_ROCKCHIP_DW_HDMI=y -CONFIG_ROCKCHIP_DW_MIPI_DSI=y -# CONFIG_ROCKCHIP_MIPI_CSI_TX is not set -CONFIG_ROCKCHIP_ANALOGIX_DP=y -CONFIG_ROCKCHIP_INNO_HDMI=y -CONFIG_ROCKCHIP_LVDS=y -CONFIG_ROCKCHIP_DRM_TVE=y -CONFIG_ROCKCHIP_RGB=y -CONFIG_ROCKCHIP_DRM_BACKLIGHT=y -# CONFIG_ROCKCHIP_RK3066_HDMI is not set -CONFIG_DRM_UDL=y -CONFIG_DRM_AST=m -# CONFIG_DRM_MGAG200 is not set -# CONFIG_DRM_CIRRUS_QEMU is not set -# CONFIG_DRM_QXL is not set -# CONFIG_DRM_BOCHS is not set -CONFIG_DRM_PANEL=y - -# -# Display Panels -# -CONFIG_DRM_PANEL_SIMPLE=y -# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set -# CONFIG_DRM_PANEL_LG_LG4573 is not set -# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set -# CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set -CONFIG_DRM_BRIDGE=y - -# -# Display Interface Bridges -# -# CONFIG_DRM_NXP_PTN3460 is not set -# CONFIG_DRM_PARADE_PS8622 is not set -# CONFIG_DRM_RK1000 is not set -# CONFIG_DRM_DUMB_VGA_DAC is not set -# CONFIG_DRM_LONTIUM_LT8912 is not set -# CONFIG_DRM_CHIPONE_ICN6211 is not set -CONFIG_DRM_ANALOGIX_DP=y -# CONFIG_DRM_ANALOGIX_ANX78XX is not set -# CONFIG_DRM_ANALOGIX_ANX6345 is not set -CONFIG_DRM_DW_HDMI=y -# CONFIG_DRM_DW_HDMI_AHB_AUDIO is not set -CONFIG_DRM_DW_HDMI_I2S_AUDIO=y -CONFIG_DRM_DW_HDMI_CEC=y -# CONFIG_POWERVR_ROGUE_M is not set -CONFIG_MALI400=m -CONFIG_MALI450=y -# CONFIG_MALI470 is not set -# CONFIG_MALI400_DEBUG is not set -# CONFIG_MALI400_PROFILING is not set -# CONFIG_MALI400_UMP is not set -CONFIG_MALI_DMA_BUF_MAP_ON_ATTACH=y -CONFIG_MALI_SHARED_INTERRUPTS=y -# CONFIG_MALI_PMU_PARALLEL_POWER_UP is not set -CONFIG_MALI_DT=y -CONFIG_MALI_DEVFREQ=y -# CONFIG_MALI_QUIET is not set -# CONFIG_MALI_MIDGARD_FOR_ANDROID is not set -CONFIG_MALI_MIDGARD_FOR_LINUX=y -CONFIG_MALI_MIDGARD=m -# CONFIG_MALI_GATOR_SUPPORT is not set -# CONFIG_MALI_MIDGARD_ENABLE_TRACE is not set -CONFIG_MALI_DMA_FENCE=y -CONFIG_MALI_EXPERT=y -# CONFIG_MALI_CORESTACK is not set -# CONFIG_MALI_PRFCNT_SET_SECONDARY is not set -# CONFIG_MALI_PLATFORM_FAKE is not set -# CONFIG_MALI_PLATFORM_DEVICETREE is not set -CONFIG_MALI_PLATFORM_THIRDPARTY=y -CONFIG_MALI_PLATFORM_THIRDPARTY_NAME="rk" -CONFIG_MALI_DEBUG=y -# CONFIG_MALI_NO_MALI is not set -# CONFIG_MALI_TRACE_TIMELINE is not set -# CONFIG_MALI_SYSTEM_TRACE is not set -# CONFIG_MALI_GPU_MMU_AARCH64 is not set -CONFIG_MALI_PWRSOFT_765=y -# CONFIG_MALI_KUTF is not set -# CONFIG_MALI_BIFROST_FOR_ANDROID is not set -CONFIG_MALI_BIFROST_FOR_LINUX=y -# CONFIG_MALI_BIFROST is not set - -# -# Frame buffer Devices -# -CONFIG_FB=y -# CONFIG_FIRMWARE_EDID is not set -CONFIG_FB_CMDLINE=y -# CONFIG_FB_DDC is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_IMAGEBLIT=y -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -CONFIG_FB_SYS_FILLRECT=y -CONFIG_FB_SYS_COPYAREA=y -CONFIG_FB_SYS_IMAGEBLIT=y -# CONFIG_FB_FOREIGN_ENDIAN is not set -CONFIG_FB_SYS_FOPS=y -CONFIG_FB_DEFERRED_IO=y -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_MACMODES is not set -# CONFIG_FB_BACKLIGHT is not set -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_TILEBLITTING is not set - -# -# Frame buffer hardware drivers -# -# CONFIG_FB_CIRRUS is not set -# CONFIG_FB_PM2 is not set -# CONFIG_FB_ARMCLCD is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_IMSTT is not set -# CONFIG_FB_UVESA is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_NVIDIA is not set -# CONFIG_FB_RIVA is not set -# CONFIG_FB_I740 is not set -# CONFIG_FB_MATROX is not set -# CONFIG_FB_RADEON is not set -# CONFIG_FB_ATY128 is not set -# CONFIG_FB_ATY is not set -# CONFIG_FB_S3 is not set -# CONFIG_FB_SAVAGE is not set -# CONFIG_FB_SIS is not set -# CONFIG_FB_NEOMAGIC is not set -# CONFIG_FB_KYRO is not set -# CONFIG_FB_3DFX is not set -# CONFIG_FB_VOODOO1 is not set -# CONFIG_FB_VT8623 is not set -# CONFIG_FB_TRIDENT is not set -# CONFIG_FB_ARK is not set -# CONFIG_FB_PM3 is not set -# CONFIG_FB_CARMINE is not set -# CONFIG_FB_SMSCUFX is not set -# CONFIG_FB_UDL is not set -# CONFIG_FB_IBM_GXT4500 is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_MB862XX is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_FB_SSD1307 is not set -# CONFIG_FB_SM712 is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -# CONFIG_LCD_CLASS_DEVICE is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -CONFIG_BACKLIGHT_GENERIC=y -CONFIG_BACKLIGHT_PWM=y -# CONFIG_BACKLIGHT_PM8941_WLED is not set -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_LM3630A is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_LP855X is not set -# CONFIG_BACKLIGHT_GPIO is not set -# CONFIG_BACKLIGHT_LV5207LP is not set -# CONFIG_BACKLIGHT_BD6107 is not set - -# -# Rockchip Misc Video driver -# -# CONFIG_FB_ROCKCHIP is not set -# CONFIG_LCDC_RK3368 is not set -CONFIG_LCD_GENERAL=y -# CONFIG_LCD_MIPI is not set -# CONFIG_RK_TRSM is not set -# CONFIG_RK_HDMI is not set - -# -# RGA -# -# CONFIG_ROCKCHIP_RGA is not set - -# -# RGA2 -# -CONFIG_ROCKCHIP_RGA2=y - -# -# VCODEC -# -CONFIG_RK_VCODEC=y - -# -# IEP -# -CONFIG_IEP=y -CONFIG_IEP_MMU=y - -# -# DP -# - -# -# ROCKCHIP_MPP -# -CONFIG_ROCKCHIP_MPP_SERVICE=y -CONFIG_ROCKCHIP_MPP_DEVICE=y -# CONFIG_VGASTATE is not set -CONFIG_VIDEOMODE_HELPERS=y -CONFIG_HDMI=y -CONFIG_HDMI_NOTIFIERS=y - -# -# Console display driver support -# -CONFIG_DUMMY_CONSOLE=y -CONFIG_DUMMY_CONSOLE_COLUMNS=80 -CONFIG_DUMMY_CONSOLE_ROWS=25 -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -# CONFIG_LOGO is not set -CONFIG_SOUND=y -CONFIG_SOUND_OSS_CORE=y -CONFIG_SOUND_OSS_CORE_PRECLAIM=y -CONFIG_SND=y -CONFIG_SND_TIMER=y -CONFIG_SND_PCM=y -CONFIG_SND_PCM_ELD=y -CONFIG_SND_PCM_IEC958=y -CONFIG_SND_DMAENGINE_PCM=y -CONFIG_SND_HWDEP=y -CONFIG_SND_RAWMIDI=y -CONFIG_SND_JACK=y -CONFIG_SND_SEQUENCER=y -CONFIG_SND_SEQ_DUMMY=y -CONFIG_SND_OSSEMUL=y -CONFIG_SND_MIXER_OSS=y -CONFIG_SND_PCM_OSS=y -CONFIG_SND_PCM_OSS_PLUGINS=y -CONFIG_SND_PCM_TIMER=y -CONFIG_SND_SEQUENCER_OSS=y -CONFIG_SND_HRTIMER=y -CONFIG_SND_SEQ_HRTIMER_DEFAULT=y -CONFIG_SND_DYNAMIC_MINORS=y -CONFIG_SND_MAX_CARDS=32 -# CONFIG_SND_SUPPORT_OLD_API is not set -CONFIG_SND_PROC_FS=y -CONFIG_SND_VERBOSE_PROCFS=y -# CONFIG_SND_VERBOSE_PRINTK is not set -# CONFIG_SND_DEBUG is not set -CONFIG_SND_RAWMIDI_SEQ=y -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_EMU10K1_SEQ is not set -CONFIG_SND_DRIVERS=y -# CONFIG_SND_DUMMY is not set -# CONFIG_SND_ALOOP is not set -# CONFIG_SND_VIRMIDI is not set -# CONFIG_SND_MTPAV is not set -# CONFIG_SND_SERIAL_U16550 is not set -# CONFIG_SND_MPU401 is not set -CONFIG_SND_PCI=y -# CONFIG_SND_AD1889 is not set -# CONFIG_SND_ALS300 is not set -# CONFIG_SND_ALI5451 is not set -# CONFIG_SND_ATIIXP is not set -# CONFIG_SND_ATIIXP_MODEM is not set -# CONFIG_SND_AU8810 is not set -# CONFIG_SND_AU8820 is not set -# CONFIG_SND_AU8830 is not set -# CONFIG_SND_AW2 is not set -# CONFIG_SND_AZT3328 is not set -# CONFIG_SND_BT87X is not set -# CONFIG_SND_CA0106 is not set -# CONFIG_SND_CMIPCI is not set -# CONFIG_SND_OXYGEN is not set -# CONFIG_SND_CS4281 is not set -# CONFIG_SND_CS46XX is not set -# CONFIG_SND_CTXFI is not set -# CONFIG_SND_DARLA20 is not set -# CONFIG_SND_GINA20 is not set -# CONFIG_SND_LAYLA20 is not set -# CONFIG_SND_DARLA24 is not set -# CONFIG_SND_GINA24 is not set -# CONFIG_SND_LAYLA24 is not set -# CONFIG_SND_MONA is not set -# CONFIG_SND_MIA is not set -# CONFIG_SND_ECHO3G is not set -# CONFIG_SND_INDIGO is not set -# CONFIG_SND_INDIGOIO is not set -# CONFIG_SND_INDIGODJ is not set -# CONFIG_SND_INDIGOIOX is not set -# CONFIG_SND_INDIGODJX is not set -# CONFIG_SND_EMU10K1 is not set -# CONFIG_SND_EMU10K1X is not set -# CONFIG_SND_ENS1370 is not set -# CONFIG_SND_ENS1371 is not set -# CONFIG_SND_ES1938 is not set -# CONFIG_SND_ES1968 is not set -# CONFIG_SND_FM801 is not set -# CONFIG_SND_HDSP is not set -# CONFIG_SND_HDSPM is not set -# CONFIG_SND_ICE1712 is not set -# CONFIG_SND_ICE1724 is not set -# CONFIG_SND_INTEL8X0 is not set -# CONFIG_SND_INTEL8X0M is not set -# CONFIG_SND_KORG1212 is not set -# CONFIG_SND_LOLA is not set -# CONFIG_SND_LX6464ES is not set -# CONFIG_SND_MAESTRO3 is not set -# CONFIG_SND_MIXART is not set -# CONFIG_SND_NM256 is not set -# CONFIG_SND_PCXHR is not set -# CONFIG_SND_RIPTIDE is not set -# CONFIG_SND_RME32 is not set -# CONFIG_SND_RME96 is not set -# CONFIG_SND_RME9652 is not set -# CONFIG_SND_SE6X is not set -# CONFIG_SND_SONICVIBES is not set -# CONFIG_SND_TRIDENT is not set -# CONFIG_SND_VIA82XX is not set -# CONFIG_SND_VIA82XX_MODEM is not set -# CONFIG_SND_VIRTUOSO is not set -# CONFIG_SND_VX222 is not set -# CONFIG_SND_YMFPCI is not set - -# -# HD-Audio -# -# CONFIG_SND_HDA_INTEL is not set -CONFIG_SND_HDA_PREALLOC_SIZE=64 -# CONFIG_SND_SPI is not set -CONFIG_SND_USB=y -CONFIG_SND_USB_AUDIO=y -# CONFIG_SND_USB_UA101 is not set -# CONFIG_SND_USB_CAIAQ is not set -# CONFIG_SND_USB_6FIRE is not set -# CONFIG_SND_USB_HIFACE is not set -# CONFIG_SND_BCD2000 is not set -# CONFIG_SND_USB_POD is not set -# CONFIG_SND_USB_PODHD is not set -# CONFIG_SND_USB_TONEPORT is not set -# CONFIG_SND_USB_VARIAX is not set -CONFIG_SND_SOC=y -CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y -# CONFIG_SND_ATMEL_SOC is not set -# CONFIG_SND_DESIGNWARE_I2S is not set - -# -# SoC Audio for Freescale CPUs -# - -# -# Common SoC Audio options for Freescale CPUs: -# -# CONFIG_SND_SOC_FSL_ASRC is not set -# CONFIG_SND_SOC_FSL_SAI is not set -# CONFIG_SND_SOC_FSL_SSI is not set -# CONFIG_SND_SOC_FSL_SPDIF is not set -# CONFIG_SND_SOC_FSL_ESAI is not set -# CONFIG_SND_SOC_IMX_AUDMUX is not set -CONFIG_SND_SOC_ROCKCHIP=y -# CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM is not set -CONFIG_SND_SOC_ROCKCHIP_I2S=y -CONFIG_SND_SOC_ROCKCHIP_I2S_TDM=y -# CONFIG_SND_SOC_ROCKCHIP_MULTI_DAIS is not set -CONFIG_SND_SOC_ROCKCHIP_PDM=y -CONFIG_SND_SOC_ROCKCHIP_SPDIF=y -# CONFIG_SND_SOC_ROCKCHIP_SPDIFRX is not set -# CONFIG_SND_SOC_ROCKCHIP_VAD is not set -# CONFIG_SND_SOC_ROCKCHIP_DA7219 is not set -CONFIG_SND_SOC_ROCKCHIP_HDMI_ANALOG=y -CONFIG_SND_SOC_ROCKCHIP_HDMI_DP=y -CONFIG_SND_SOC_ROCKCHIP_MAX98090=y -CONFIG_SND_SOC_ROCKCHIP_MULTICODECS=y -CONFIG_SND_SOC_ROCKCHIP_RT5645=y -# CONFIG_SND_SOC_ROCKCHIP_RT5651_TC358749 is not set -CONFIG_SND_SOC_ROCKCHIP_CDNDP=y - -# -# Allwinner SoC Audio support -# -# CONFIG_SND_SUN4I_CODEC is not set -# CONFIG_SND_SOC_XTFPGA_I2S is not set -CONFIG_SND_SOC_I2C_AND_SPI=y - -# -# CODEC drivers -# -# CONFIG_SND_SOC_AC97_CODEC is not set -# CONFIG_SND_SOC_ADAU1701 is not set -# CONFIG_SND_SOC_AK4104 is not set -# CONFIG_SND_SOC_AK4554 is not set -# CONFIG_SND_SOC_AK4613 is not set -# CONFIG_SND_SOC_AK4642 is not set -# CONFIG_SND_SOC_AK5386 is not set -# CONFIG_SND_SOC_ALC5623 is not set -# CONFIG_SND_SOC_CS35L32 is not set -# CONFIG_SND_SOC_CS42L51_I2C is not set -# CONFIG_SND_SOC_CS42L52 is not set -# CONFIG_SND_SOC_CS42L56 is not set -# CONFIG_SND_SOC_CS42L73 is not set -# CONFIG_SND_SOC_CS4265 is not set -# CONFIG_SND_SOC_CS4270 is not set -# CONFIG_SND_SOC_CS4271_I2C is not set -# CONFIG_SND_SOC_CS4271_SPI is not set -# CONFIG_SND_SOC_CS42XX8_I2C is not set -# CONFIG_SND_SOC_CS4349 is not set -# CONFIG_SND_SOC_CX2072X is not set -# CONFIG_SND_SOC_CX20810 is not set -# CONFIG_SND_SOC_DUMMY_CODEC is not set -# CONFIG_SND_SOC_BT_SCO is not set -CONFIG_SND_SOC_ES8316=y -CONFIG_SND_SOC_ES8323=y -CONFIG_SND_SOC_HDMI_CODEC=y -CONFIG_SND_SOC_ES8328=y -CONFIG_SND_SOC_ES8328_I2C=y -# CONFIG_SND_SOC_ES8396 is not set -# CONFIG_SND_SOC_GTM601 is not set -# CONFIG_SND_SOC_GVA_CODEC is not set -# CONFIG_SND_SOC_FM1288 is not set -CONFIG_SND_SOC_MAX98090=y -# CONFIG_SND_SOC_PCM1681 is not set -# CONFIG_SND_SOC_PCM1792A is not set -# CONFIG_SND_SOC_PCM512x_I2C is not set -# CONFIG_SND_SOC_PCM512x_SPI is not set -# CONFIG_SND_SOC_RK312X is not set -# CONFIG_SND_SOC_RK3228 is not set -CONFIG_SND_SOC_RK3308=y -CONFIG_SND_SOC_RK3328=y -CONFIG_SND_SOC_RK817=y -CONFIG_SND_SOC_RL6231=y -CONFIG_SND_SOC_RT5616=y -# CONFIG_SND_SOC_RT5631 is not set -CONFIG_SND_SOC_RT5640=y -CONFIG_SND_SOC_RT5645=y -CONFIG_SND_SOC_RT5651=y -# CONFIG_SND_SOC_RT5677_SPI is not set -# CONFIG_SND_SOC_SGTL5000 is not set -# CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set -CONFIG_SND_SOC_SPDIF=y -# CONFIG_SND_SOC_SSM2602_SPI is not set -# CONFIG_SND_SOC_SSM2602_I2C is not set -# CONFIG_SND_SOC_SSM4567 is not set -# CONFIG_SND_SOC_STA32X is not set -# CONFIG_SND_SOC_STA350 is not set -# CONFIG_SND_SOC_STI_SAS is not set -# CONFIG_SND_SOC_TAS2552 is not set -# CONFIG_SND_SOC_TAS5086 is not set -# CONFIG_SND_SOC_TAS571X is not set -# CONFIG_SND_SOC_TC358749X is not set -# CONFIG_SND_SOC_TFA9879 is not set -# CONFIG_SND_SOC_TLV320AIC23_I2C is not set -# CONFIG_SND_SOC_TLV320AIC23_SPI is not set -# CONFIG_SND_SOC_TLV320AIC31XX is not set -# CONFIG_SND_SOC_TLV320AIC3X is not set -CONFIG_SND_SOC_TS3A227E=y -# CONFIG_SND_SOC_WM8510 is not set -# CONFIG_SND_SOC_WM8523 is not set -# CONFIG_SND_SOC_WM8580 is not set -# CONFIG_SND_SOC_WM8711 is not set -# CONFIG_SND_SOC_WM8728 is not set -# CONFIG_SND_SOC_WM8731 is not set -# CONFIG_SND_SOC_WM8737 is not set -# CONFIG_SND_SOC_WM8741 is not set -# CONFIG_SND_SOC_WM8750 is not set -# CONFIG_SND_SOC_WM8753 is not set -# CONFIG_SND_SOC_WM8770 is not set -# CONFIG_SND_SOC_WM8776 is not set -# CONFIG_SND_SOC_WM8804_I2C is not set -# CONFIG_SND_SOC_WM8804_SPI is not set -# CONFIG_SND_SOC_WM8903 is not set -# CONFIG_SND_SOC_WM8962 is not set -# CONFIG_SND_SOC_WM8978 is not set -# CONFIG_SND_SOC_TPA6130A2 is not set -CONFIG_SND_SIMPLE_CARD=y -CONFIG_SOUND_PRIME=y - -# -# HID support -# -CONFIG_HID=y -CONFIG_HID_BATTERY_STRENGTH=y -CONFIG_HIDRAW=y -CONFIG_UHID=y -CONFIG_HID_GENERIC=y - -# -# Special HID drivers -# -CONFIG_HID_A4TECH=y -CONFIG_HID_ACRUX=y -# CONFIG_HID_ACRUX_FF is not set -CONFIG_HID_APPLE=y -CONFIG_HID_APPLEIR=y -CONFIG_HID_AUREAL=y -CONFIG_HID_BELKIN=y -CONFIG_HID_BETOP_FF=y -CONFIG_HID_CHERRY=y -CONFIG_HID_CHICONY=y -CONFIG_HID_CORSAIR=y -CONFIG_HID_PRODIKEYS=y -CONFIG_HID_CP2112=y -CONFIG_HID_CYPRESS=y -CONFIG_HID_DRAGONRISE=y -CONFIG_DRAGONRISE_FF=y -CONFIG_HID_EMS_FF=y -CONFIG_HID_ELECOM=y -CONFIG_HID_ELO=y -CONFIG_HID_EZKEY=y -CONFIG_HID_GEMBIRD=y -CONFIG_HID_GFRM=y -CONFIG_HID_HOLTEK=y -CONFIG_HOLTEK_FF=y -CONFIG_HID_GT683R=y -CONFIG_HID_KEYTOUCH=y -CONFIG_HID_KYE=y -CONFIG_HID_UCLOGIC=y -CONFIG_HID_WALTOP=y -CONFIG_HID_GYRATION=y -CONFIG_HID_ICADE=y -CONFIG_HID_TWINHAN=y -CONFIG_HID_KENSINGTON=y -CONFIG_HID_LCPOWER=y -CONFIG_HID_LENOVO=y -CONFIG_HID_LOGITECH=y -CONFIG_HID_LOGITECH_DJ=y -CONFIG_HID_LOGITECH_HIDPP=y -CONFIG_LOGITECH_FF=y -CONFIG_LOGIRUMBLEPAD2_FF=y -CONFIG_LOGIG940_FF=y -CONFIG_LOGIWHEELS_FF=y -CONFIG_HID_MAGICMOUSE=y -CONFIG_HID_MICROSOFT=y -CONFIG_HID_MONTEREY=y -CONFIG_HID_MULTITOUCH=y -CONFIG_HID_NTRIG=y -CONFIG_HID_ORTEK=y -CONFIG_HID_PANTHERLORD=y -CONFIG_PANTHERLORD_FF=y -CONFIG_HID_PENMOUNT=y -CONFIG_HID_PETALYNX=y -# CONFIG_HID_PICOLCD is not set -CONFIG_HID_PLANTRONICS=y -CONFIG_HID_PRIMAX=y -CONFIG_HID_ROCCAT=y -CONFIG_HID_SAITEK=y -CONFIG_HID_SAMSUNG=y -CONFIG_HID_SONY=y -# CONFIG_SONY_FF is not set -CONFIG_HID_SPEEDLINK=y -CONFIG_HID_STEELSERIES=y -CONFIG_HID_SUNPLUS=y -CONFIG_HID_RMI=y -CONFIG_HID_GREENASIA=y -CONFIG_GREENASIA_FF=y -CONFIG_HID_SMARTJOYPLUS=y -CONFIG_SMARTJOYPLUS_FF=y -CONFIG_HID_TIVO=y -CONFIG_HID_TOPSEED=y -CONFIG_HID_THINGM=y -CONFIG_HID_THRUSTMASTER=y -CONFIG_THRUSTMASTER_FF=y -CONFIG_HID_WACOM=y -CONFIG_HID_WIIMOTE=y -CONFIG_HID_XINMO=y -CONFIG_HID_ZEROPLUS=y -CONFIG_ZEROPLUS_FF=y -CONFIG_HID_ZYDACRON=y -CONFIG_HID_SENSOR_HUB=y -CONFIG_HID_SENSOR_CUSTOM_SENSOR=y -CONFIG_HID_RKVR=y -CONFIG_HID_ALPS=y - -# -# USB HID support -# -CONFIG_USB_HID=y -# CONFIG_HID_PID is not set -CONFIG_USB_HIDDEV=y - -# -# I2C HID support -# -CONFIG_I2C_HID=y -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_COMMON=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB=y -CONFIG_USB_ANNOUNCE_NEW_DEVICES=y - -# -# Miscellaneous USB options -# -# CONFIG_USB_DEFAULT_PERSIST is not set -# CONFIG_USB_DYNAMIC_MINORS is not set -CONFIG_USB_OTG=y -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_OTG_FSM is not set -# CONFIG_USB_ULPI_BUS is not set -CONFIG_USB_MON=y -# CONFIG_USB_WUSB_CBAF is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set -CONFIG_USB_XHCI_HCD=y -CONFIG_USB_XHCI_PCI=y -CONFIG_USB_XHCI_PLATFORM=y -CONFIG_USB_EHCI_HCD=y -CONFIG_USB_EHCI_ROOT_HUB_TT=y -CONFIG_USB_EHCI_TT_NEWSCHED=y -CONFIG_USB_EHCI_PCI=y -CONFIG_USB_EHCI_HCD_PLATFORM=y -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_FOTG210_HCD is not set -# CONFIG_USB_MAX3421_HCD is not set -CONFIG_USB_OHCI_HCD=y -# CONFIG_USB_OHCI_HCD_PCI is not set -CONFIG_USB_OHCI_HCD_PLATFORM=y -# CONFIG_USB_UHCI_HCD is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -CONFIG_USB_HCD_BCMA=m -CONFIG_USB_HCD_SSB=m -# CONFIG_USB_HCD_TEST_MODE is not set - -# -# USB Device Class drivers -# -CONFIG_USB_ACM=m -CONFIG_USB_PRINTER=m -CONFIG_USB_WDM=m -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# -CONFIG_USB_STORAGE=m -# CONFIG_USB_STORAGE_DEBUG is not set -CONFIG_USB_STORAGE_REALTEK=m -CONFIG_REALTEK_AUTOPM=y -CONFIG_USB_STORAGE_DATAFAB=m -CONFIG_USB_STORAGE_FREECOM=m -CONFIG_USB_STORAGE_ISD200=m -CONFIG_USB_STORAGE_USBAT=m -CONFIG_USB_STORAGE_SDDR09=m -CONFIG_USB_STORAGE_SDDR55=m -CONFIG_USB_STORAGE_JUMPSHOT=m -CONFIG_USB_STORAGE_ALAUDA=m -CONFIG_USB_STORAGE_ONETOUCH=m -CONFIG_USB_STORAGE_KARMA=m -CONFIG_USB_STORAGE_CYPRESS_ATACB=m -CONFIG_USB_STORAGE_ENE_UB6250=m -CONFIG_USB_UAS=m - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -CONFIG_USBIP_CORE=m -CONFIG_USBIP_VHCI_HCD=m -CONFIG_USBIP_HOST=m -# CONFIG_USBIP_DEBUG is not set -# CONFIG_USB_MUSB_HDRC is not set -CONFIG_USB_DWC3=y -# CONFIG_USB_DWC3_HOST is not set -# CONFIG_USB_DWC3_GADGET is not set -CONFIG_USB_DWC3_DUAL_ROLE=y - -# -# Platform Glue Driver Support -# -# CONFIG_USB_DWC3_PCI is not set -CONFIG_USB_DWC3_OF_SIMPLE=y -CONFIG_USB_DWC3_ROCKCHIP=y -CONFIG_USB_DWC3_ROCKCHIP_INNO=y -CONFIG_USB_DWC2=y -# CONFIG_USB_DWC2_HOST is not set - -# -# Gadget/Dual-role mode requires USB Gadget support to be enabled -# -# CONFIG_USB_DWC2_PERIPHERAL is not set -CONFIG_USB_DWC2_DUAL_ROLE=y -# CONFIG_USB_DWC2_PCI is not set -# CONFIG_USB_DWC2_DEBUG is not set -# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set -# CONFIG_USB_CHIPIDEA is not set -# CONFIG_USB_ISP1760 is not set - -# -# USB port drivers -# -CONFIG_USB_SERIAL=y -# CONFIG_USB_SERIAL_CONSOLE is not set -CONFIG_USB_SERIAL_GENERIC=y -CONFIG_USB_SERIAL_SIMPLE=m -CONFIG_USB_SERIAL_AIRCABLE=m -CONFIG_USB_SERIAL_ARK3116=m -CONFIG_USB_SERIAL_BELKIN=m -CONFIG_USB_SERIAL_CH341=m -CONFIG_USB_SERIAL_WHITEHEAT=m -CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m -CONFIG_USB_SERIAL_CP210X=m -CONFIG_USB_SERIAL_CYPRESS_M8=m -CONFIG_USB_SERIAL_EMPEG=m -CONFIG_USB_SERIAL_FTDI_SIO=m -CONFIG_USB_SERIAL_VISOR=m -CONFIG_USB_SERIAL_IPAQ=m -CONFIG_USB_SERIAL_IR=m -CONFIG_USB_SERIAL_EDGEPORT=m -CONFIG_USB_SERIAL_EDGEPORT_TI=m -CONFIG_USB_SERIAL_F81232=m -CONFIG_USB_SERIAL_GARMIN=m -CONFIG_USB_SERIAL_IPW=m -CONFIG_USB_SERIAL_IUU=m -CONFIG_USB_SERIAL_KEYSPAN_PDA=m -CONFIG_USB_SERIAL_KEYSPAN=m -# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA28X is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA19 is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA18X is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA19W is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA19QW is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA19QI is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA49W is not set -# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set -CONFIG_USB_SERIAL_KLSI=m -CONFIG_USB_SERIAL_KOBIL_SCT=m -CONFIG_USB_SERIAL_MCT_U232=m -CONFIG_USB_SERIAL_METRO=m -CONFIG_USB_SERIAL_MOS7720=m -CONFIG_USB_SERIAL_MOS7840=m -CONFIG_USB_SERIAL_MXUPORT=m -CONFIG_USB_SERIAL_NAVMAN=m -CONFIG_USB_SERIAL_PL2303=m -CONFIG_USB_SERIAL_OTI6858=m -CONFIG_USB_SERIAL_QCAUX=m -CONFIG_USB_SERIAL_QUALCOMM=m -CONFIG_USB_SERIAL_SPCP8X5=m -CONFIG_USB_SERIAL_SAFE=m -# CONFIG_USB_SERIAL_SAFE_PADDED is not set -CONFIG_USB_SERIAL_SIERRAWIRELESS=m -CONFIG_USB_SERIAL_SYMBOL=m -CONFIG_USB_SERIAL_TI=m -CONFIG_USB_SERIAL_CYBERJACK=m -CONFIG_USB_SERIAL_XIRCOM=m -CONFIG_USB_SERIAL_WWAN=m -CONFIG_USB_SERIAL_OPTION=m -CONFIG_USB_SERIAL_OMNINET=m -CONFIG_USB_SERIAL_OPTICON=m -CONFIG_USB_SERIAL_XSENS_MT=m -CONFIG_USB_SERIAL_WISHBONE=m -CONFIG_USB_SERIAL_SSU100=m -CONFIG_USB_SERIAL_QT2=m -CONFIG_USB_SERIAL_DEBUG=m - -# -# USB Miscellaneous drivers -# -CONFIG_USB_EMI62=m -CONFIG_USB_EMI26=m -CONFIG_USB_ADUTUX=m -CONFIG_USB_SEVSEG=m -# CONFIG_USB_LEGOTOWER is not set -CONFIG_USB_LCD=m -CONFIG_USB_LED=m -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_USB_SISUSBVGA is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_YUREX is not set -CONFIG_USB_EZUSB_FX2=y -# CONFIG_USB_HSIC_USB3503 is not set -# CONFIG_USB_LINK_LAYER_TEST is not set -# CONFIG_USB_CHAOSKEY is not set - -# -# USB Physical Layer drivers -# -CONFIG_USB_PHY=y -# CONFIG_USB_OTG_WAKELOCK is not set -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_ISP1301 is not set -# CONFIG_USB_ULPI is not set -# CONFIG_DUAL_ROLE_USB_INTF is not set -CONFIG_USB_GADGET=y -# CONFIG_USB_GADGET_DEBUG is not set -CONFIG_USB_GADGET_DEBUG_FILES=y -CONFIG_USB_GADGET_DEBUG_FS=y -CONFIG_USB_GADGET_VBUS_DRAW=500 -CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 - -# -# USB Peripheral Controller -# -CONFIG_USB_FOTG210_UDC=m -CONFIG_USB_GR_UDC=m -CONFIG_USB_R8A66597=m -CONFIG_USB_PXA27X=m -CONFIG_USB_MV_UDC=m -CONFIG_USB_MV_U3D=m -CONFIG_USB_M66592=m -CONFIG_USB_BDC_UDC=m - -# -# Platform Support -# -CONFIG_USB_BDC_PCI=m -CONFIG_USB_AMD5536UDC=m -CONFIG_USB_NET2272=m -# CONFIG_USB_NET2272_DMA is not set -CONFIG_USB_NET2280=m -CONFIG_USB_GOKU=m -CONFIG_USB_EG20T=m -CONFIG_USB_GADGET_XILINX=m -CONFIG_USB_DUMMY_HCD=m -CONFIG_USB_LIBCOMPOSITE=m -CONFIG_USB_F_ACM=m -CONFIG_USB_U_SERIAL=m -CONFIG_USB_U_ETHER=m -CONFIG_USB_F_SERIAL=m -CONFIG_USB_F_OBEX=m -CONFIG_USB_F_NCM=m -CONFIG_USB_F_ECM=m -CONFIG_USB_F_EEM=m -CONFIG_USB_F_SUBSET=m -CONFIG_USB_F_RNDIS=m -CONFIG_USB_F_MASS_STORAGE=m -CONFIG_USB_F_FS=m -CONFIG_USB_F_UAC1=m -CONFIG_USB_F_UAC2=m -CONFIG_USB_F_UVC=m -CONFIG_USB_F_MIDI=m -CONFIG_USB_F_HID=m -CONFIG_USB_F_PRINTER=m -CONFIG_USB_F_ACC=m -CONFIG_USB_CONFIGFS=m -CONFIG_USB_CONFIGFS_SERIAL=y -CONFIG_USB_CONFIGFS_ACM=y -CONFIG_USB_CONFIGFS_OBEX=y -CONFIG_USB_CONFIGFS_NCM=y -CONFIG_USB_CONFIGFS_ECM=y -CONFIG_USB_CONFIGFS_ECM_SUBSET=y -CONFIG_USB_CONFIGFS_RNDIS=y -CONFIG_USB_CONFIGFS_EEM=y -CONFIG_USB_CONFIGFS_MASS_STORAGE=y -# CONFIG_USB_CONFIGFS_F_LB_SS is not set -CONFIG_USB_CONFIGFS_F_FS=y -# CONFIG_USB_CONFIGFS_F_MTP is not set -CONFIG_USB_CONFIGFS_F_ACC=y -# CONFIG_USB_CONFIGFS_F_AUDIO_SRC is not set -# CONFIG_USB_CONFIGFS_UEVENT is not set -CONFIG_USB_CONFIGFS_F_UAC1=y -CONFIG_USB_CONFIGFS_F_UAC2=y -CONFIG_USB_CONFIGFS_F_MIDI=y -CONFIG_USB_CONFIGFS_F_HID=y -CONFIG_USB_CONFIGFS_F_UVC=y -# CONFIG_USB_CONFIGFS_F_UVC_ROCKCHIP is not set -CONFIG_USB_CONFIGFS_F_PRINTER=y -# CONFIG_USB_ZERO is not set -CONFIG_USB_AUDIO=m -# CONFIG_GADGET_UAC1 is not set -CONFIG_USB_ETH=m -# CONFIG_USB_ETH_RNDIS is not set -CONFIG_USB_ETH_EEM=y -CONFIG_USB_G_NCM=m -CONFIG_USB_GADGETFS=m -CONFIG_USB_FUNCTIONFS=m -CONFIG_USB_FUNCTIONFS_ETH=y -CONFIG_USB_FUNCTIONFS_RNDIS=y -CONFIG_USB_FUNCTIONFS_GENERIC=y -CONFIG_USB_MASS_STORAGE=m -# CONFIG_USB_GADGET_TARGET is not set -CONFIG_USB_G_SERIAL=m -CONFIG_USB_MIDI_GADGET=m -CONFIG_USB_G_PRINTER=m -CONFIG_USB_CDC_COMPOSITE=m -CONFIG_USB_G_ACM_MS=m -CONFIG_USB_G_MULTI=m -CONFIG_USB_G_MULTI_RNDIS=y -# CONFIG_USB_G_MULTI_CDC is not set -CONFIG_USB_G_HID=m -CONFIG_USB_G_DBGP=m -# CONFIG_USB_G_DBGP_PRINTK is not set -CONFIG_USB_G_DBGP_SERIAL=y -CONFIG_USB_G_WEBCAM=m - -# -# ROCKCHIP USB Support -# -# CONFIG_USB20_HOST is not set -# CONFIG_USB20_OTG is not set -# CONFIG_USB_LED_TRIG is not set -# CONFIG_UWB is not set -CONFIG_MMC=y -# CONFIG_MMC_DEBUG is not set -# CONFIG_MMC_EMBEDDED_SDIO is not set -# CONFIG_MMC_PARANOID_SD_INIT is not set - -# -# MMC/SD/SDIO Card Drivers -# -CONFIG_MMC_BLOCK=y -CONFIG_MMC_BLOCK_MINORS=32 -CONFIG_MMC_BLOCK_BOUNCE=y -# CONFIG_SDIO_UART is not set -CONFIG_MMC_TEST=y -# CONFIG_MMC_SIMULATE_MAX_SPEED is not set - -# -# MMC/SD/SDIO Host Controller Drivers -# -# CONFIG_MMC_ARMMMCI is not set -CONFIG_MMC_SDHCI=y -# CONFIG_MMC_SDHCI_PCI is not set -CONFIG_MMC_SDHCI_PLTFM=y -CONFIG_MMC_SDHCI_OF_ARASAN=y -# CONFIG_MMC_SDHCI_OF_AT91 is not set -# CONFIG_MMC_SDHCI_F_SDH30 is not set -# CONFIG_MMC_TIFM_SD is not set -# CONFIG_MMC_SPI is not set -# CONFIG_MMC_CB710 is not set -# CONFIG_MMC_VIA_SDMMC is not set -CONFIG_MMC_DW=y -CONFIG_MMC_DW_PLTFM=y -# CONFIG_MMC_DW_EXYNOS is not set -# CONFIG_MMC_DW_K3 is not set -# CONFIG_MMC_DW_PCI is not set -CONFIG_MMC_DW_ROCKCHIP=y -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MMC_USDHI6ROL0 is not set -# CONFIG_MMC_TOSHIBA_PCI is not set -# CONFIG_MMC_MTK is not set -# CONFIG_MEMSTICK is not set -CONFIG_NEW_LEDS=y -CONFIG_LEDS_CLASS=y -# CONFIG_LEDS_CLASS_FLASH is not set - -# -# LED drivers -# -# CONFIG_LEDS_BCM6328 is not set -# CONFIG_LEDS_BCM6358 is not set -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_PCA9532 is not set -CONFIG_LEDS_GPIO=y -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_LP8501 is not set -# CONFIG_LEDS_LP8860 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA963X is not set -# CONFIG_LEDS_DAC124S085 is not set -# CONFIG_LEDS_PWM is not set -# CONFIG_LEDS_REGULATOR is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_LT3593 is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_TLC591XX is not set -# CONFIG_LEDS_LM355x is not set -CONFIG_LEDS_IS31FL32XX=y - -# -# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) -# -# CONFIG_LEDS_BLINKM is not set -# CONFIG_LEDS_SYSCON is not set - -# -# LED Triggers -# -CONFIG_LEDS_TRIGGERS=y -CONFIG_LEDS_TRIGGER_TIMER=y -CONFIG_LEDS_TRIGGER_ONESHOT=y -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -# CONFIG_LEDS_TRIGGER_CPU is not set -# CONFIG_LEDS_TRIGGER_GPIO is not set -CONFIG_LEDS_TRIGGER_DEFAULT_ON=y - -# -# iptables trigger is under Netfilter config (LED target) -# -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set -# CONFIG_LEDS_TRIGGER_MULTI_CTRL is not set -CONFIG_SWITCH=m -CONFIG_SWITCH_GPIO=m -# CONFIG_ACCESSIBILITY is not set -# CONFIG_INFINIBAND is not set -CONFIG_EDAC_SUPPORT=y -# CONFIG_EDAC is not set -CONFIG_RTC_LIB=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -CONFIG_RTC_SYSTOHC=y -CONFIG_RTC_SYSTOHC_DEVICE="rtc0" -# CONFIG_RTC_DEBUG is not set - -# -# RTC interfaces -# -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -# CONFIG_RTC_DRV_TEST is not set - -# -# I2C RTC drivers -# -# CONFIG_RTC_DRV_ABB5ZES3 is not set -# CONFIG_RTC_DRV_ABX80X is not set -CONFIG_RTC_DRV_DS1307=y -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_DS3232 is not set -CONFIG_RTC_DRV_FAKE=y -CONFIG_RTC_DRV_HYM8563=y -# CONFIG_RTC_DRV_MAX6900 is not set -CONFIG_RTC_DRV_RK808=y -# CONFIG_RTC_DRV_RK_TIMER is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_ISL12057 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_PCF2127 is not set -# CONFIG_RTC_DRV_PCF8523 is not set -# CONFIG_RTC_DRV_PCF8563 is not set -# CONFIG_RTC_DRV_PCF85063 is not set -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_BQ32K is not set -# CONFIG_RTC_DRV_TPS6586X is not set -# CONFIG_RTC_DRV_S35390A is not set -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set -# CONFIG_RTC_DRV_RV8803 is not set - -# -# SPI RTC drivers -# -CONFIG_RTC_DRV_M41T93=m -CONFIG_RTC_DRV_M41T94=m -CONFIG_RTC_DRV_DS1305=m -CONFIG_RTC_DRV_DS1343=m -# CONFIG_RTC_DRV_DS1347 is not set -CONFIG_RTC_DRV_DS1390=m -# CONFIG_RTC_DRV_MAX6902 is not set -CONFIG_RTC_DRV_R9701=m -CONFIG_RTC_DRV_RS5C348=m -CONFIG_RTC_DRV_DS3234=m -CONFIG_RTC_DRV_PCF2123=m -# CONFIG_RTC_DRV_RX4581 is not set -# CONFIG_RTC_DRV_MCP795 is not set - -# -# Platform RTC drivers -# -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1685_FAMILY is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_DS2404 is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_BQ4802 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_ZYNQMP is not set - -# -# on-CPU RTC drivers -# -# CONFIG_RTC_DRV_PL030 is not set -# CONFIG_RTC_DRV_PL031 is not set -# CONFIG_RTC_DRV_SNVS is not set - -# -# HID Sensor RTC drivers -# -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -CONFIG_DMADEVICES=y -# CONFIG_DMADEVICES_DEBUG is not set - -# -# DMA Devices -# -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y -# CONFIG_AMBA_PL08X is not set -# CONFIG_FSL_EDMA is not set -# CONFIG_INTEL_IDMA64 is not set -CONFIG_PL330_DMA=y -# CONFIG_DW_DMAC is not set -# CONFIG_DW_DMAC_PCI is not set - -# -# DMA Clients -# -# CONFIG_ASYNC_TX_DMA is not set -# CONFIG_DMATEST is not set -# CONFIG_AUXDISPLAY is not set -CONFIG_UIO=m -# CONFIG_UIO_CIF is not set -CONFIG_UIO_PDRV_GENIRQ=m -# CONFIG_UIO_DMEM_GENIRQ is not set -# CONFIG_UIO_AEC is not set -# CONFIG_UIO_SERCOS3 is not set -# CONFIG_UIO_PCI_GENERIC is not set -# CONFIG_UIO_NETX is not set -# CONFIG_UIO_PRUSS is not set -# CONFIG_UIO_MF624 is not set -# CONFIG_VFIO is not set -CONFIG_VIRT_DRIVERS=y - -# -# Virtio drivers -# -# CONFIG_VIRTIO_PCI is not set -# CONFIG_VIRTIO_MMIO is not set - -# -# Microsoft Hyper-V guest support -# -CONFIG_STAGING=y -CONFIG_PRISM2_USB=m -# CONFIG_COMEDI is not set -# CONFIG_RTL8192U is not set -# CONFIG_RTLLIB is not set -# CONFIG_R8712U is not set -# CONFIG_R8188EU is not set -# CONFIG_R8723AU is not set -# CONFIG_RTS5208 is not set -# CONFIG_VT6655 is not set -CONFIG_VT6656=m - -# -# IIO staging drivers -# - -# -# Accelerometers -# -# CONFIG_ADIS16201 is not set -# CONFIG_ADIS16203 is not set -# CONFIG_ADIS16204 is not set -# CONFIG_ADIS16209 is not set -# CONFIG_ADIS16220 is not set -# CONFIG_ADIS16240 is not set -# CONFIG_LIS3L02DQ is not set -# CONFIG_SCA3000 is not set - -# -# Analog to digital converters -# -# CONFIG_AD7606 is not set -# CONFIG_AD7780 is not set -# CONFIG_AD7816 is not set -# CONFIG_AD7192 is not set -# CONFIG_AD7280 is not set - -# -# Analog digital bi-direction converters -# -# CONFIG_ADT7316 is not set - -# -# Capacitance to digital converters -# -# CONFIG_AD7150 is not set -# CONFIG_AD7152 is not set -# CONFIG_AD7746 is not set - -# -# Direct Digital Synthesis -# -# CONFIG_AD9832 is not set -# CONFIG_AD9834 is not set - -# -# Digital gyroscope sensors -# -# CONFIG_ADIS16060 is not set - -# -# Network Analyzer, Impedance Converters -# -# CONFIG_AD5933 is not set -# CONFIG_INV_MPU_IIO is not set - -# -# Light sensors -# -CONFIG_SENSORS_ISL29018=y -# CONFIG_SENSORS_ISL29028 is not set -CONFIG_TSL2583=y -# CONFIG_TSL2x7x is not set - -# -# Magnetometer sensors -# -# CONFIG_SENSORS_HMC5843_I2C is not set -# CONFIG_SENSORS_HMC5843_SPI is not set - -# -# Active energy metering IC -# -# CONFIG_ADE7753 is not set -# CONFIG_ADE7754 is not set -# CONFIG_ADE7758 is not set -# CONFIG_ADE7759 is not set -# CONFIG_ADE7854 is not set - -# -# Resolver to digital converters -# -# CONFIG_AD2S90 is not set -# CONFIG_AD2S1200 is not set -# CONFIG_AD2S1210 is not set - -# -# Triggers - standalone -# -# CONFIG_IIO_PERIODIC_RTC_TRIGGER is not set -# CONFIG_IIO_SIMPLE_DUMMY is not set -# CONFIG_FB_SM750 is not set -# CONFIG_FB_XGI is not set - -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set -# CONFIG_STAGING_MEDIA is not set - -# -# Android -# -# CONFIG_ASHMEM is not set -CONFIG_ANDROID_TIMED_OUTPUT=y -# CONFIG_ANDROID_TIMED_GPIO is not set -# CONFIG_ANDROID_LOW_MEMORY_KILLER is not set -# CONFIG_SYNC is not set -# CONFIG_ANDROID_VSOC is not set -CONFIG_ION=y -# CONFIG_ION_TEST is not set -# CONFIG_ION_DUMMY is not set -CONFIG_ION_ROCKCHIP=y -CONFIG_FIQ_DEBUGGER=y -CONFIG_FIQ_DEBUGGER_NO_SLEEP=y -# CONFIG_FIQ_DEBUGGER_WAKEUP_IRQ_ALWAYS_ON is not set -CONFIG_FIQ_DEBUGGER_CONSOLE=y -CONFIG_FIQ_DEBUGGER_CONSOLE_DEFAULT_ENABLE=y -# CONFIG_FIQ_DEBUGGER_TRUST_ZONE is not set -# CONFIG_FIQ_DEBUGGER_UART_OVERLAY is not set -# CONFIG_FIQ_WATCHDOG is not set -# CONFIG_RK_CONSOLE_THREAD is not set -# CONFIG_STAGING_BOARD is not set -# CONFIG_WIMAX_GDM72XX is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_LUSTRE_FS is not set -# CONFIG_DGNC is not set -# CONFIG_DGAP is not set -# CONFIG_GS_FPGABOOT is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set -# CONFIG_FB_TFT is not set -# CONFIG_FSL_MC_BUS is not set -# CONFIG_WILC1000_DRIVER is not set -# CONFIG_MOST is not set -# CONFIG_POWERVR_ROGUE_N is not set -# CONFIG_GOLDFISH is not set -CONFIG_CHROME_PLATFORMS=y -# CONFIG_CROS_EC_CHARDEV is not set -CONFIG_CROS_EC_PROTO=y -CONFIG_CLKDEV_LOOKUP=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_COMMON_CLK=y - -# -# Common Clock Framework -# -# CONFIG_COMMON_CLK_VERSATILE is not set -CONFIG_COMMON_CLK_RK808=y -# CONFIG_COMMON_CLK_SI5351 is not set -# CONFIG_COMMON_CLK_SI514 is not set -# CONFIG_COMMON_CLK_SI570 is not set -# CONFIG_COMMON_CLK_CDCE925 is not set -# CONFIG_CLK_QORIQ is not set -CONFIG_COMMON_CLK_XGENE=y -# CONFIG_COMMON_CLK_PWM is not set -# CONFIG_COMMON_CLK_PXA is not set -# CONFIG_COMMON_CLK_CDCE706 is not set - -# -# Hardware Spinlock drivers -# -# CONFIG_HWSPINLOCK_ROCKCHIP is not set - -# -# Clock Source drivers -# -CONFIG_CLKSRC_OF=y -CONFIG_CLKSRC_PROBE=y -CONFIG_ROCKCHIP_TIMER=y -CONFIG_ARM_ARCH_TIMER=y -CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -# CONFIG_ARM_ARCH_TIMER_VCT_ACCESS is not set -# CONFIG_ARM_TIMER_SP804 is not set -# CONFIG_ATMEL_PIT is not set -# CONFIG_SH_TIMER_CMT is not set -# CONFIG_SH_TIMER_MTU2 is not set -# CONFIG_SH_TIMER_TMU is not set -# CONFIG_EM_TIMER_STI is not set -CONFIG_MAILBOX=y -# CONFIG_ARM_MHU is not set -# CONFIG_PL320_MBOX is not set -# CONFIG_ALTERA_MBOX is not set -# CONFIG_MAILBOX_TEST is not set -# CONFIG_RK3368_MBOX is not set -CONFIG_IOMMU_API=y -CONFIG_IOMMU_SUPPORT=y - -# -# Generic IOMMU Pagetable Support -# -# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set -CONFIG_IOMMU_IOVA=y -CONFIG_OF_IOMMU=y -CONFIG_IOMMU_DMA=y -CONFIG_ROCKCHIP_IOMMU=y -CONFIG_RK_IOMMU=y -CONFIG_RK_IOVMM=y -# CONFIG_RK_IOMMU_DEBUG is not set -# CONFIG_ARM_SMMU is not set -# CONFIG_ARM_SMMU_V3 is not set - -# -# Remoteproc drivers -# -# CONFIG_STE_MODEM_RPROC is not set - -# -# Rpmsg drivers -# - -# -# SOC (System On Chip) specific Drivers -# - -# -# CPU selection -# -CONFIG_CPU_PX30=y -# CONFIG_CPU_RK1808 is not set -# CONFIG_CPU_RK3308 is not set -CONFIG_CPU_RK3328=y -# CONFIG_CPU_RK3366 is not set -CONFIG_CPU_RK3368=y -CONFIG_CPU_RK3399=y -CONFIG_ANDROID_VERSION=0x07010000 -CONFIG_ROCKCHIP_CPUINFO=y -# CONFIG_ROCKCHIP_DEVICEINFO is not set -CONFIG_ROCKCHIP_IPA=y -CONFIG_ROCKCHIP_OPP=y -# CONFIG_ROCKCHIP_PM_TEST is not set -CONFIG_ROCKCHIP_GRF=y -CONFIG_ROCKCHIP_PM_DOMAINS=y -# CONFIG_ROCKCHIP_PVTM is not set -CONFIG_ROCKCHIP_SUSPEND_MODE=y -# CONFIG_ROCKCHIP_VENDOR_STORAGE is not set -# CONFIG_SUNXI_SRAM is not set -# CONFIG_SOC_TI is not set -CONFIG_PM_DEVFREQ=y - -# -# DEVFREQ Governors -# -CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y -CONFIG_DEVFREQ_GOV_PERFORMANCE=y -CONFIG_DEVFREQ_GOV_POWERSAVE=y -CONFIG_DEVFREQ_GOV_USERSPACE=y - -# -# DEVFREQ Drivers -# -CONFIG_ARM_ROCKCHIP_BUS_DEVFREQ=y -CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ=y -CONFIG_PM_DEVFREQ_EVENT=y -CONFIG_DEVFREQ_EVENT_ROCKCHIP_DFI=y -CONFIG_DEVFREQ_EVENT_ROCKCHIP_NOCP=y -CONFIG_EXTCON=y - -# -# Extcon Device Drivers -# -# CONFIG_EXTCON_ADC_JACK is not set -# CONFIG_EXTCON_GPIO is not set -# CONFIG_EXTCON_RT8973A is not set -# CONFIG_EXTCON_SM5502 is not set -# CONFIG_EXTCON_USB_GPIO is not set -CONFIG_MEMORY=y -# CONFIG_ARM_PL172_MPMC is not set -CONFIG_IIO=y -CONFIG_IIO_BUFFER=y -# CONFIG_IIO_BUFFER_CB is not set -CONFIG_IIO_KFIFO_BUF=y -CONFIG_IIO_TRIGGERED_BUFFER=y -CONFIG_IIO_TRIGGER=y -CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 -CONFIG_IIO_TRIGGERED_EVENT=m - -# -# Accelerometers -# -CONFIG_BMA180=m -CONFIG_BMC150_ACCEL=m -CONFIG_BMC150_ACCEL_I2C=m -CONFIG_BMC150_ACCEL_SPI=m -CONFIG_HID_SENSOR_ACCEL_3D=m -CONFIG_IIO_ST_ACCEL_3AXIS=m -CONFIG_IIO_ST_ACCEL_I2C_3AXIS=m -CONFIG_IIO_ST_ACCEL_SPI_3AXIS=m -CONFIG_KXSD9=m -CONFIG_KXCJK1013=m -CONFIG_MMA8452=m -CONFIG_MMA9551_CORE=m -CONFIG_MMA9551=m -CONFIG_MMA9553=m -CONFIG_MXC4005=m -CONFIG_STK8312=m -CONFIG_STK8BA50=m - -# -# Analog to digital converters -# -CONFIG_AD_SIGMA_DELTA=m -CONFIG_AD7266=m -CONFIG_AD7291=m -CONFIG_AD7298=m -CONFIG_AD7476=m -CONFIG_AD7791=m -CONFIG_AD7793=m -CONFIG_AD7887=m -CONFIG_AD7923=m -CONFIG_AD799X=m -CONFIG_CC10001_ADC=m -CONFIG_GPIO_MUXADC=m -CONFIG_HI8435=m -CONFIG_MAX1027=m -CONFIG_MAX1363=m -CONFIG_MCP320X=m -CONFIG_MCP3422=m -CONFIG_NAU7802=m -CONFIG_ROCKCHIP_SARADC=m -CONFIG_TI_ADC081C=m -CONFIG_TI_ADC128S052=m -CONFIG_VF610_ADC=m - -# -# Amplifiers -# -# CONFIG_AD8366 is not set - -# -# Chemical Sensors -# -CONFIG_VZ89X=m - -# -# Hid Sensor IIO Common -# -CONFIG_HID_SENSOR_IIO_COMMON=m -CONFIG_HID_SENSOR_IIO_TRIGGER=m -CONFIG_IIO_MS_SENSORS_I2C=m - -# -# SSP Sensor Common -# -# CONFIG_IIO_SSP_SENSORHUB is not set -CONFIG_IIO_ST_SENSORS_I2C=m -CONFIG_IIO_ST_SENSORS_SPI=m -CONFIG_IIO_ST_SENSORS_CORE=m - -# -# Digital to analog converters -# -CONFIG_AD5064=m -CONFIG_AD5360=m -CONFIG_AD5380=m -CONFIG_AD5421=m -CONFIG_AD5446=m -CONFIG_AD5449=m -CONFIG_AD5504=m -CONFIG_AD5624R_SPI=m -CONFIG_AD5686=m -CONFIG_AD5755=m -CONFIG_AD5764=m -CONFIG_AD5791=m -CONFIG_AD7303=m -CONFIG_M62332=m -CONFIG_MAX517=m -CONFIG_MAX5821=m -CONFIG_MCP4725=m -CONFIG_MCP4922=m - -# -# Frequency Synthesizers DDS/PLL -# - -# -# Clock Generator/Distribution -# -# CONFIG_AD9523 is not set - -# -# Phase-Locked Loop (PLL) frequency synthesizers -# -# CONFIG_ADF4350 is not set - -# -# Digital gyroscope sensors -# -CONFIG_ADIS16080=m -CONFIG_ADIS16130=m -CONFIG_ADIS16136=m -CONFIG_ADIS16260=m -CONFIG_ADXRS450=m -CONFIG_BMG160=m -CONFIG_BMG160_I2C=m -CONFIG_BMG160_SPI=m -CONFIG_HID_SENSOR_GYRO_3D=m -CONFIG_IIO_ST_GYRO_3AXIS=m -CONFIG_IIO_ST_GYRO_I2C_3AXIS=m -CONFIG_IIO_ST_GYRO_SPI_3AXIS=m -CONFIG_ITG3200=m - -# -# Humidity sensors -# -CONFIG_DHT11=m -CONFIG_HDC100X=m -CONFIG_HTU21=m -CONFIG_SI7005=m -CONFIG_SI7020=m - -# -# Inertial measurement units -# -CONFIG_ADIS16400=m -CONFIG_ADIS16480=m -CONFIG_KMX61=m -CONFIG_INV_MPU6050_IIO=m -CONFIG_IIO_ADIS_LIB=m -CONFIG_IIO_ADIS_LIB_BUFFER=y - -# -# Light sensors -# -CONFIG_ADJD_S311=m -CONFIG_AL3320A=m -CONFIG_APDS9300=m -CONFIG_APDS9960=m -CONFIG_BH1750=m -CONFIG_CM32181=m -CONFIG_CM3232=m -CONFIG_CM3323=m -CONFIG_CM36651=m -CONFIG_GP2AP020A00F=m -CONFIG_ISL29125=m -CONFIG_HID_SENSOR_ALS=m -CONFIG_HID_SENSOR_PROX=m -CONFIG_JSA1212=m -CONFIG_RPR0521=m -CONFIG_LTR501=m -CONFIG_OPT3001=m -CONFIG_PA12203001=m -CONFIG_STK3310=m -CONFIG_TCS3414=m -CONFIG_TCS3472=m -CONFIG_SENSORS_TSL2563=y -CONFIG_TSL4531=m -CONFIG_US5182D=m -CONFIG_VCNL4000=m -CONFIG_VL6180=m - -# -# Magnetometer sensors -# -CONFIG_AK8975=m -CONFIG_AK09911=m -CONFIG_BMC150_MAGN=m -CONFIG_MAG3110=m -CONFIG_HID_SENSOR_MAGNETOMETER_3D=m -CONFIG_MMC35240=m -CONFIG_IIO_ST_MAGN_3AXIS=m -CONFIG_IIO_ST_MAGN_I2C_3AXIS=m -CONFIG_IIO_ST_MAGN_SPI_3AXIS=m - -# -# Inclinometer sensors -# -CONFIG_HID_SENSOR_INCLINOMETER_3D=m -CONFIG_HID_SENSOR_DEVICE_ROTATION=m - -# -# Triggers - standalone -# -# CONFIG_IIO_INTERRUPT_TRIGGER is not set -CONFIG_IIO_SYSFS_TRIGGER=y - -# -# Digital potentiometers -# -CONFIG_MCP4531=m - -# -# Pressure sensors -# -CONFIG_BMP280=m -CONFIG_HID_SENSOR_PRESS=m -CONFIG_MPL115=m -CONFIG_MPL3115=m -CONFIG_MS5611=m -CONFIG_MS5611_I2C=m -CONFIG_MS5611_SPI=m -CONFIG_MS5637=m -CONFIG_IIO_ST_PRESS=m -CONFIG_IIO_ST_PRESS_I2C=m -CONFIG_IIO_ST_PRESS_SPI=m -CONFIG_T5403=m - -# -# Lightning sensors -# -CONFIG_AS3935=m - -# -# Proximity sensors -# -CONFIG_LIDAR_LITE_V2=m -CONFIG_SRF04=m -CONFIG_SX9500=m - -# -# Temperature sensors -# -CONFIG_MLX90614=m -CONFIG_TMP006=m -CONFIG_TSYS01=m -CONFIG_TSYS02D=m -# CONFIG_NTB is not set -# CONFIG_VME_BUS is not set -CONFIG_PWM=y -CONFIG_PWM_SYSFS=y -# CONFIG_PWM_CROS_EC is not set -# CONFIG_PWM_FSL_FTM is not set -# CONFIG_PWM_GPIO is not set -# CONFIG_PWM_PCA9685 is not set -CONFIG_PWM_ROCKCHIP=y -# CONFIG_PWM_ROCKCHIP_I2S is not set -CONFIG_IRQCHIP=y -CONFIG_ARM_GIC=y -CONFIG_ARM_GIC_V2M=y -CONFIG_ARM_GIC_V3=y -CONFIG_ARM_GIC_V3_ITS=y -CONFIG_PARTITION_PERCPU=y -# CONFIG_IPACK_BUS is not set -CONFIG_ARCH_HAS_RESET_CONTROLLER=y -CONFIG_RESET_CONTROLLER=y -# CONFIG_FMC is not set - -# -# PHY Subsystem -# -CONFIG_GENERIC_PHY=y -# CONFIG_PHY_PXA_28NM_HSIC is not set -# CONFIG_PHY_PXA_28NM_USB2 is not set -# CONFIG_BCM_KONA_USB2_PHY is not set -# CONFIG_PHY_SAMSUNG_USB2 is not set -# CONFIG_PHY_XGENE is not set -CONFIG_PHY_ROCKCHIP_USB=y -# CONFIG_PHY_ROCKCHIP_INNO_COMBPHY is not set -CONFIG_PHY_ROCKCHIP_INNO_USB2=y -CONFIG_PHY_ROCKCHIP_INNO_USB3=y -CONFIG_PHY_ROCKCHIP_EMMC=y -CONFIG_PHY_ROCKCHIP_DP=y -CONFIG_PHY_ROCKCHIP_MIPI_RX=y -CONFIG_PHY_ROCKCHIP_INNO_MIPI_DPHY=y -CONFIG_PHY_ROCKCHIP_INNO_HDMI_PHY=y -# CONFIG_PHY_ROCKCHIP_INNO_VIDEO_PHY is not set -CONFIG_PHY_ROCKCHIP_INNO_VIDEO_COMBO_PHY=y -CONFIG_PHY_ROCKCHIP_TYPEC=y -CONFIG_PHY_ROCKCHIP_PCIE=y -# CONFIG_POWERCAP is not set -# CONFIG_MCB is not set - -# -# Performance monitor support -# -CONFIG_ARM_PMU=y -CONFIG_RAS=y -# CONFIG_THUNDERBOLT is not set - -# -# Android -# -CONFIG_ANDROID=y -# CONFIG_ANDROID_BINDER_IPC is not set -# CONFIG_LIBNVDIMM is not set -CONFIG_NVMEM=y -CONFIG_ROCKCHIP_EFUSE=y -CONFIG_ROCKCHIP_OTP=m -# CONFIG_STM is not set -# CONFIG_INTEL_TH is not set - -# -# FPGA Configuration Support -# -# CONFIG_FPGA is not set -# CONFIG_TEE is not set -# CONFIG_RK_FLASH is not set -# CONFIG_RK_NAND is not set - -# -# Headset device support -# -# CONFIG_RK_HEADSET is not set - -# -# Firmware Drivers -# -CONFIG_ARM_PSCI_FW=y -# CONFIG_FIRMWARE_MEMMAP is not set -CONFIG_HAVE_ARM_SMCCC=y -CONFIG_ROCKCHIP_SIP=y -# CONFIG_ACPI is not set - -# -# File systems -# -CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_EXT2_FS=y -CONFIG_EXT2_FS_XATTR=y -CONFIG_EXT2_FS_POSIX_ACL=y -CONFIG_EXT2_FS_SECURITY=y -CONFIG_EXT3_FS=y -CONFIG_EXT3_FS_POSIX_ACL=y -CONFIG_EXT3_FS_SECURITY=y -CONFIG_EXT4_FS=y -CONFIG_EXT4_FS_POSIX_ACL=y -CONFIG_EXT4_FS_SECURITY=y -CONFIG_EXT4_ENCRYPTION=y -CONFIG_EXT4_FS_ENCRYPTION=y -# CONFIG_EXT4_DEBUG is not set -CONFIG_JBD2=y -# CONFIG_JBD2_DEBUG is not set -CONFIG_FS_MBCACHE=y -# CONFIG_REISERFS_FS is not set -CONFIG_JFS_FS=y -CONFIG_JFS_POSIX_ACL=y -CONFIG_JFS_SECURITY=y -# CONFIG_JFS_DEBUG is not set -CONFIG_JFS_STATISTICS=y -CONFIG_XFS_FS=y -CONFIG_XFS_QUOTA=y -CONFIG_XFS_POSIX_ACL=y -CONFIG_XFS_RT=y -CONFIG_XFS_WARN=y -# CONFIG_XFS_DEBUG is not set -# CONFIG_GFS2_FS is not set -# CONFIG_OCFS2_FS is not set -CONFIG_BTRFS_FS=y -CONFIG_BTRFS_FS_POSIX_ACL=y -CONFIG_BTRFS_FS_CHECK_INTEGRITY=y -CONFIG_BTRFS_FS_RUN_SANITY_TESTS=y -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_BTRFS_ASSERT is not set -# CONFIG_NILFS2_FS is not set -CONFIG_F2FS_FS=y -CONFIG_F2FS_STAT_FS=y -CONFIG_F2FS_FS_XATTR=y -CONFIG_F2FS_FS_POSIX_ACL=y -CONFIG_F2FS_FS_SECURITY=y -# CONFIG_F2FS_CHECK_FS is not set -CONFIG_F2FS_FS_ENCRYPTION=y -# CONFIG_F2FS_IO_TRACE is not set -# CONFIG_F2FS_FAULT_INJECTION is not set -# CONFIG_FS_DAX is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_EXPORTFS=y -CONFIG_FILE_LOCKING=y -CONFIG_FS_ENCRYPTION=y -CONFIG_FSNOTIFY=y -CONFIG_DNOTIFY=y -CONFIG_INOTIFY_USER=y -CONFIG_FANOTIFY=y -CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y -CONFIG_QUOTA=y -CONFIG_QUOTA_NETLINK_INTERFACE=y -CONFIG_PRINT_QUOTA_WARNING=y -CONFIG_QUOTA_DEBUG=y -CONFIG_QUOTA_TREE=m -CONFIG_QFMT_V1=m -CONFIG_QFMT_V2=m -CONFIG_QUOTACTL=y -CONFIG_AUTOFS4_FS=m -CONFIG_FUSE_FS=y -# CONFIG_CUSE is not set -CONFIG_OVERLAY_FS=m - -# -# Caches -# -CONFIG_FSCACHE=m -# CONFIG_FSCACHE_STATS is not set -# CONFIG_FSCACHE_HISTOGRAM is not set -# CONFIG_FSCACHE_DEBUG is not set -# CONFIG_FSCACHE_OBJECT_LIST is not set -# CONFIG_CACHEFILES is not set - -# -# CD-ROM/DVD Filesystems -# -CONFIG_ISO9660_FS=y -CONFIG_JOLIET=y -CONFIG_ZISOFS=y -CONFIG_UDF_FS=y -CONFIG_UDF_NLS=y - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -# CONFIG_MSDOS_FS is not set -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=936 -CONFIG_FAT_DEFAULT_IOCHARSET="utf8" -CONFIG_NTFS_FS=m -# CONFIG_NTFS_DEBUG is not set -# CONFIG_NTFS_RW is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -# CONFIG_PROC_KCORE is not set -CONFIG_PROC_SYSCTL=y -CONFIG_PROC_PAGE_MONITOR=y -CONFIG_PROC_CHILDREN=y -CONFIG_PROC_UID=y -CONFIG_KERNFS=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_TMPFS_XATTR=y -CONFIG_HUGETLBFS=y -CONFIG_HUGETLB_PAGE=y -CONFIG_CONFIGFS_FS=y -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -CONFIG_ECRYPT_FS=m -# CONFIG_ECRYPT_FS_MESSAGING is not set -# CONFIG_SDCARD_FS is not set -# CONFIG_HFS_FS is not set -CONFIG_HFSPLUS_FS=y -# CONFIG_HFSPLUS_FS_POSIX_ACL is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_JFFS2_FS is not set -# CONFIG_UBIFS_FS is not set -# CONFIG_LOGFS is not set -# CONFIG_CRAMFS is not set -CONFIG_SQUASHFS=y -CONFIG_SQUASHFS_DECOMP_SINGLE=y -# CONFIG_SQUASHFS_DECOMP_MULTI is not set -# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set -# CONFIG_SQUASHFS_XATTR is not set -CONFIG_SQUASHFS_ZLIB=y -# CONFIG_SQUASHFS_LZ4 is not set -CONFIG_SQUASHFS_LZO=y -CONFIG_SQUASHFS_XZ=y -# CONFIG_SQUASHFS_ZSTD is not set -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_VXFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_ROMFS_FS is not set -CONFIG_PSTORE=y -CONFIG_PSTORE_CONSOLE=y -# CONFIG_PSTORE_PMSG is not set -# CONFIG_PSTORE_FTRACE is not set -CONFIG_PSTORE_RAM=y -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set -CONFIG_NETWORK_FILESYSTEMS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V2=y -CONFIG_NFS_V3=y -CONFIG_NFS_V3_ACL=y -CONFIG_NFS_V4=y -CONFIG_NFS_SWAP=y -# CONFIG_NFS_V4_1 is not set -# CONFIG_ROOT_NFS is not set -# CONFIG_NFS_USE_LEGACY_DNS is not set -CONFIG_NFS_USE_KERNEL_DNS=y -CONFIG_NFSD=y -CONFIG_NFSD_V2_ACL=y -CONFIG_NFSD_V3=y -CONFIG_NFSD_V3_ACL=y -CONFIG_NFSD_V4=y -# CONFIG_NFSD_PNFS is not set -# CONFIG_NFSD_V4_SECURITY_LABEL is not set -# CONFIG_NFSD_FAULT_INJECTION is not set -CONFIG_GRACE_PERIOD=y -CONFIG_LOCKD=y -CONFIG_LOCKD_V4=y -CONFIG_NFS_ACL_SUPPORT=y -CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=y -CONFIG_SUNRPC_SWAP=y -CONFIG_RPCSEC_GSS_KRB5=y -# CONFIG_SUNRPC_DEBUG is not set -CONFIG_CEPH_FS=m -CONFIG_CEPH_FSCACHE=y -CONFIG_CEPH_FS_POSIX_ACL=y -CONFIG_CIFS=m -CONFIG_CIFS_STATS=y -CONFIG_CIFS_STATS2=y -# CONFIG_CIFS_WEAK_PW_HASH is not set -# CONFIG_CIFS_UPCALL is not set -# CONFIG_CIFS_XATTR is not set -CONFIG_CIFS_DEBUG=y -# CONFIG_CIFS_DEBUG2 is not set -# CONFIG_CIFS_DFS_UPCALL is not set -CONFIG_CIFS_SMB2=y -CONFIG_CIFS_SMB311=y -CONFIG_CIFS_FSCACHE=y -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="utf8" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -CONFIG_NLS_CODEPAGE_936=y -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -CONFIG_NLS_ASCII=y -CONFIG_NLS_ISO8859_1=y -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -CONFIG_NLS_UTF8=y -# CONFIG_DLM is not set -CONFIG_HAVE_KVM_IRQFD=y -CONFIG_HAVE_KVM_EVENTFD=y -CONFIG_KVM_MMIO=y -CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y -CONFIG_KVM_VFIO=y -CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL=y -CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y -CONFIG_KVM_COMPAT=y -CONFIG_VIRTUALIZATION=y -CONFIG_KVM_ARM_VGIC_V3=y -CONFIG_KVM=y -CONFIG_KVM_ARM_HOST=y - -# -# Kernel hacking -# - -# -# printk and dmesg options -# -CONFIG_PRINTK_TIME=y -# CONFIG_PRINTK_PROCESS is not set -CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -# CONFIG_BOOT_PRINTK_DELAY is not set -# CONFIG_DYNAMIC_DEBUG is not set - -# -# Compile-time checks and compiler options -# -# CONFIG_DEBUG_INFO is not set -CONFIG_ENABLE_WARN_DEPRECATED=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_FRAME_WARN=2048 -# CONFIG_STRIP_ASM_SYMS is not set -# CONFIG_READABLE_ASM is not set -# CONFIG_UNUSED_SYMBOLS is not set -# CONFIG_PAGE_OWNER is not set -CONFIG_DEBUG_FS=y -# CONFIG_HEADERS_CHECK is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_SECTION_MISMATCH_WARN_ONLY=y -CONFIG_ARCH_WANT_FRAME_POINTERS=y -CONFIG_FRAME_POINTER=y -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -CONFIG_MAGIC_SYSRQ=y -CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0 -CONFIG_DEBUG_KERNEL=y - -# -# Memory Debugging -# -# CONFIG_PAGE_EXTENSION is not set -# CONFIG_DEBUG_PAGEALLOC is not set -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_SLUB_STATS is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -CONFIG_HAVE_ARCH_KASAN=y -# CONFIG_KASAN is not set -# CONFIG_DEBUG_SHIRQ is not set - -# -# Debug Lockups and Hangs -# -CONFIG_LOCKUP_DETECTOR=y -CONFIG_HARDLOCKUP_DETECTOR_OTHER_CPU=y -CONFIG_HARDLOCKUP_DETECTOR=y -# CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is not set -CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE=0 -CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y -CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=1 -CONFIG_DETECT_HUNG_TASK=y -CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 -CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y -CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=1 -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 -CONFIG_PANIC_TIMEOUT=0 -CONFIG_SCHED_DEBUG=y -CONFIG_SCHED_INFO=y -# CONFIG_PANIC_ON_RT_THROTTLING is not set -CONFIG_SCHEDSTATS=y -# CONFIG_SCHED_STACK_END_CHECK is not set -# CONFIG_DEBUG_TIMEKEEPING is not set -CONFIG_TIMER_STATS=y - -# -# Lock Debugging (spinlocks, mutexes, etc...) -# -# CONFIG_DEBUG_RT_MUTEXES is not set -CONFIG_DEBUG_SPINLOCK=y -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_LOCK_TORTURE_TEST is not set -CONFIG_STACKTRACE=y -# CONFIG_DEBUG_KOBJECT is not set -CONFIG_HAVE_DEBUG_BUGVERBOSE=y -CONFIG_DEBUG_BUGVERBOSE=y -# CONFIG_DEBUG_LIST is not set -# CONFIG_DEBUG_PI_LIST is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_NOTIFIERS is not set -CONFIG_DEBUG_CREDENTIALS=y - -# -# RCU Debugging -# -# CONFIG_PROVE_RCU is not set -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_TORTURE_TEST is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=60 -# CONFIG_RCU_TRACE is not set -# CONFIG_RCU_EQS_DEBUG is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set -CONFIG_NOP_TRACER=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_TRACE_CLOCK=y -CONFIG_RING_BUFFER=y -CONFIG_EVENT_TRACING=y -CONFIG_GPU_TRACEPOINTS=y -CONFIG_CONTEXT_SWITCH_TRACER=y -CONFIG_TRACING=y -CONFIG_GENERIC_TRACER=y -CONFIG_TRACING_SUPPORT=y -CONFIG_FTRACE=y -CONFIG_FUNCTION_TRACER=y -CONFIG_FUNCTION_GRAPH_TRACER=y -# CONFIG_PREEMPTIRQ_EVENTS is not set -# CONFIG_IRQSOFF_TRACER is not set -# CONFIG_SCHED_TRACER is not set -# CONFIG_FTRACE_SYSCALLS is not set -# CONFIG_TRACER_SNAPSHOT is not set -CONFIG_BRANCH_PROFILE_NONE=y -# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set -# CONFIG_PROFILE_ALL_BRANCHES is not set -# CONFIG_STACK_TRACER is not set -CONFIG_BLK_DEV_IO_TRACE=y -# CONFIG_PROBE_EVENTS is not set -CONFIG_DYNAMIC_FTRACE=y -# CONFIG_FUNCTION_PROFILER is not set -CONFIG_FTRACE_MCOUNT_RECORD=y -# CONFIG_FTRACE_STARTUP_TEST is not set -# CONFIG_TRACEPOINT_BENCHMARK is not set -# CONFIG_RING_BUFFER_BENCHMARK is not set -# CONFIG_RING_BUFFER_STARTUP_TEST is not set -# CONFIG_TRACE_ENUM_MAP_FILE is not set -CONFIG_TRACING_EVENTS_GPIO=y - -# -# Runtime Testing -# -CONFIG_LKDTM=y -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_PERCPU_TEST is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_ASYNC_RAID6_TEST is not set -# CONFIG_TEST_HEXDUMP is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_TEST_PRINTF is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_TEST_HASH is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_TEST_LKM is not set -# CONFIG_TEST_USER_COPY is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_FIRMWARE is not set -CONFIG_TEST_UDELAY=y -CONFIG_MEMTEST=y -# CONFIG_TEST_STATIC_KEYS is not set -# CONFIG_BUG_ON_DATA_CORRUPTION is not set -# CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set -# CONFIG_ARM64_PTDUMP is not set -CONFIG_STRICT_DEVMEM=y -# CONFIG_PID_IN_CONTEXTIDR is not set -# CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set -CONFIG_DEBUG_SET_MODULE_RONX=y -CONFIG_DEBUG_RODATA=y -# CONFIG_DEBUG_ALIGN_RODATA is not set -# CONFIG_CORESIGHT is not set - -# -# Security options -# -CONFIG_KEYS=y -CONFIG_PERSISTENT_KEYRINGS=y -CONFIG_BIG_KEYS=y -CONFIG_TRUSTED_KEYS=m -CONFIG_ENCRYPTED_KEYS=y -# CONFIG_SECURITY_DMESG_RESTRICT is not set -# CONFIG_SECURITY_PERF_EVENTS_RESTRICT is not set -CONFIG_SECURITY=y -CONFIG_SECURITYFS=y -CONFIG_SECURITY_NETWORK=y -# CONFIG_SECURITY_NETWORK_XFRM is not set -CONFIG_SECURITY_PATH=y -CONFIG_LSM_MMAP_MIN_ADDR=32768 -CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y -CONFIG_HAVE_ARCH_HARDENED_USERCOPY=y -# CONFIG_HARDENED_USERCOPY is not set -CONFIG_SECURITY_SELINUX=y -CONFIG_SECURITY_SELINUX_BOOTPARAM=y -CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0 -CONFIG_SECURITY_SELINUX_DISABLE=y -CONFIG_SECURITY_SELINUX_DEVELOP=y -CONFIG_SECURITY_SELINUX_AVC_STATS=y -CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=0 -# CONFIG_SECURITY_SELINUX_POLICYDB_VERSION_MAX is not set -CONFIG_SECURITY_SMACK=y -# CONFIG_SECURITY_SMACK_BRINGUP is not set -# CONFIG_SECURITY_SMACK_NETFILTER is not set -# CONFIG_SECURITY_TOMOYO is not set -CONFIG_SECURITY_APPARMOR=y -CONFIG_SECURITY_APPARMOR_BOOTPARAM_VALUE=0 -CONFIG_SECURITY_APPARMOR_HASH=y -CONFIG_SECURITY_YAMA=y -CONFIG_TEE_SUPPORT=y -CONFIG_INTEGRITY=y -# CONFIG_INTEGRITY_SIGNATURE is not set -CONFIG_INTEGRITY_AUDIT=y -# CONFIG_IMA is not set -# CONFIG_EVM is not set -# CONFIG_DEFAULT_SECURITY_SELINUX is not set -# CONFIG_DEFAULT_SECURITY_SMACK is not set -# CONFIG_DEFAULT_SECURITY_APPARMOR is not set -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_SECURITY="" -CONFIG_XOR_BLOCKS=y -CONFIG_ASYNC_CORE=m -CONFIG_ASYNC_MEMCPY=m -CONFIG_ASYNC_XOR=m -CONFIG_ASYNC_PQ=m -CONFIG_ASYNC_RAID6_RECOV=m -CONFIG_CRYPTO=y - -# -# Crypto core or helper -# -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_RNG_DEFAULT=y -CONFIG_CRYPTO_PCOMP=m -CONFIG_CRYPTO_PCOMP2=y -CONFIG_CRYPTO_AKCIPHER2=y -CONFIG_CRYPTO_AKCIPHER=y -CONFIG_CRYPTO_RSA=m -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -# CONFIG_CRYPTO_USER is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -CONFIG_CRYPTO_GF128MUL=y -CONFIG_CRYPTO_NULL=y -CONFIG_CRYPTO_NULL2=y -CONFIG_CRYPTO_PCRYPT=m -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_CRYPTO_CRYPTD=y -# CONFIG_CRYPTO_MCRYPTD is not set -CONFIG_CRYPTO_AUTHENC=y -# CONFIG_CRYPTO_TEST is not set -CONFIG_CRYPTO_ABLK_HELPER=y - -# -# Authenticated Encryption with Associated Data -# -CONFIG_CRYPTO_CCM=y -CONFIG_CRYPTO_GCM=y -CONFIG_CRYPTO_CHACHA20POLY1305=m -CONFIG_CRYPTO_SEQIV=y -CONFIG_CRYPTO_ECHAINIV=y - -# -# Block modes -# -CONFIG_CRYPTO_CBC=y -CONFIG_CRYPTO_HEH=y -CONFIG_CRYPTO_CTR=y -CONFIG_CRYPTO_CTS=y -CONFIG_CRYPTO_ECB=y -CONFIG_CRYPTO_LRW=m -CONFIG_CRYPTO_PCBC=m -CONFIG_CRYPTO_XTS=y -CONFIG_CRYPTO_KEYWRAP=m - -# -# Hash modes -# -CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_XCBC=m -CONFIG_CRYPTO_VMAC=m - -# -# Digest -# -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_CRC32=y -CONFIG_CRYPTO_CRCT10DIF=y -CONFIG_CRYPTO_GHASH=y -CONFIG_CRYPTO_POLY1305=m -CONFIG_CRYPTO_MD4=m -CONFIG_CRYPTO_MD5=y -CONFIG_CRYPTO_MICHAEL_MIC=y -CONFIG_CRYPTO_RMD128=m -CONFIG_CRYPTO_RMD160=m -CONFIG_CRYPTO_RMD256=m -CONFIG_CRYPTO_RMD320=m -CONFIG_CRYPTO_SHA1=y -CONFIG_CRYPTO_SHA256=y -CONFIG_CRYPTO_SHA512=y -CONFIG_CRYPTO_TGR192=m -CONFIG_CRYPTO_WP512=m - -# -# Ciphers -# -CONFIG_CRYPTO_AES=y -CONFIG_CRYPTO_ANUBIS=m -CONFIG_CRYPTO_ARC4=y -CONFIG_CRYPTO_BLOWFISH=m -CONFIG_CRYPTO_BLOWFISH_COMMON=m -CONFIG_CRYPTO_CAMELLIA=m -CONFIG_CRYPTO_CAST_COMMON=m -CONFIG_CRYPTO_CAST5=m -CONFIG_CRYPTO_CAST6=m -CONFIG_CRYPTO_DES=y -CONFIG_CRYPTO_FCRYPT=m -CONFIG_CRYPTO_KHAZAD=m -CONFIG_CRYPTO_SALSA20=m -CONFIG_CRYPTO_CHACHA20=m -CONFIG_CRYPTO_SEED=m -CONFIG_CRYPTO_SERPENT=m -CONFIG_CRYPTO_TEA=m -CONFIG_CRYPTO_TWOFISH=y -CONFIG_CRYPTO_TWOFISH_COMMON=y - -# -# Compression -# -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_ZLIB=m -CONFIG_CRYPTO_LZO=m -CONFIG_CRYPTO_842=m -CONFIG_CRYPTO_LZ4=m -CONFIG_CRYPTO_LZ4HC=m -# CONFIG_CRYPTO_ZSTD is not set - -# -# Random Number Generation -# -CONFIG_CRYPTO_ANSI_CPRNG=y -CONFIG_CRYPTO_DRBG_MENU=y -CONFIG_CRYPTO_DRBG_HMAC=y -# CONFIG_CRYPTO_DRBG_HASH is not set -# CONFIG_CRYPTO_DRBG_CTR is not set -CONFIG_CRYPTO_DRBG=y -CONFIG_CRYPTO_JITTERENTROPY=y -CONFIG_CRYPTO_USER_API=y -CONFIG_CRYPTO_USER_API_HASH=y -CONFIG_CRYPTO_USER_API_SKCIPHER=y -CONFIG_CRYPTO_USER_API_RNG=y -# CONFIG_CRYPTO_USER_API_AEAD is not set -CONFIG_CRYPTO_HASH_INFO=y -CONFIG_CRYPTO_HW=y -# CONFIG_CRYPTO_DEV_CCP is not set -CONFIG_CRYPTO_DEV_ROCKCHIP=m -CONFIG_ASYMMETRIC_KEY_TYPE=y -CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y -CONFIG_PUBLIC_KEY_ALGO_RSA=y -CONFIG_X509_CERTIFICATE_PARSER=y -CONFIG_PKCS7_MESSAGE_PARSER=y -# CONFIG_PKCS7_TEST_KEY is not set -# CONFIG_SIGNED_PE_FILE_VERIFICATION is not set - -# -# Certificates for signature checking -# -CONFIG_SYSTEM_TRUSTED_KEYRING=y -CONFIG_SYSTEM_TRUSTED_KEYS="" -CONFIG_ARM64_CRYPTO=y -CONFIG_CRYPTO_SHA1_ARM64_CE=y -CONFIG_CRYPTO_SHA2_ARM64_CE=y -CONFIG_CRYPTO_GHASH_ARM64_CE=y -CONFIG_CRYPTO_POLY_HASH_ARM64_CE=y -CONFIG_CRYPTO_AES_ARM64_CE=y -CONFIG_CRYPTO_AES_ARM64_CE_CCM=y -CONFIG_CRYPTO_AES_ARM64_CE_BLK=y -# CONFIG_CRYPTO_AES_ARM64_NEON_BLK is not set -CONFIG_CRYPTO_CRC32_ARM64=y -CONFIG_BINARY_PRINTF=y - -# -# Library routines -# -CONFIG_RAID6_PQ=y -CONFIG_BITREVERSE=y -CONFIG_HAVE_ARCH_BITREVERSE=y -CONFIG_RATIONAL=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_NET_UTILS=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_IO=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_CRC_CCITT=y -CONFIG_CRC16=y -CONFIG_CRC_T10DIF=y -CONFIG_CRC_ITU_T=y -CONFIG_CRC32=y -# CONFIG_CRC32_SELFTEST is not set -CONFIG_CRC32_SLICEBY8=y -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SARWATE is not set -# CONFIG_CRC32_BIT is not set -CONFIG_CRC7=y -CONFIG_LIBCRC32C=y -# CONFIG_CRC8 is not set -CONFIG_AUDIT_GENERIC=y -CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y -CONFIG_AUDIT_COMPAT_GENERIC=y -# CONFIG_RANDOM32_SELFTEST is not set -CONFIG_842_COMPRESS=m -CONFIG_842_DECOMPRESS=m -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_LZ4_COMPRESS=m -CONFIG_LZ4HC_COMPRESS=m -CONFIG_LZ4_DECOMPRESS=y -CONFIG_XZ_DEC=y -# CONFIG_XZ_DEC_X86 is not set -# CONFIG_XZ_DEC_POWERPC is not set -# CONFIG_XZ_DEC_IA64 is not set -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_ARMTHUMB=y -# CONFIG_XZ_DEC_SPARC is not set -CONFIG_XZ_DEC_BCJ=y -# CONFIG_XZ_DEC_TEST is not set -CONFIG_DECOMPRESS_GZIP=y -CONFIG_DECOMPRESS_BZIP2=y -CONFIG_DECOMPRESS_LZMA=y -CONFIG_DECOMPRESS_XZ=y -CONFIG_DECOMPRESS_LZO=y -CONFIG_DECOMPRESS_LZ4=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_REED_SOLOMON=y -CONFIG_REED_SOLOMON_ENC8=y -CONFIG_REED_SOLOMON_DEC8=y -CONFIG_TEXTSEARCH=y -CONFIG_TEXTSEARCH_KMP=m -CONFIG_TEXTSEARCH_BM=m -CONFIG_TEXTSEARCH_FSM=m -CONFIG_ASSOCIATIVE_ARRAY=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAS_DMA=y -CONFIG_CPU_RMAP=y -CONFIG_DQL=y -CONFIG_GLOB=y -# CONFIG_GLOB_SELFTEST is not set -CONFIG_NLATTR=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -CONFIG_LRU_CACHE=m -CONFIG_CLZ_TAB=y -# CONFIG_CORDIC is not set -# CONFIG_DDR is not set -CONFIG_MPILIB=y -CONFIG_LIBFDT=y -CONFIG_OID_REGISTRY=y -CONFIG_FONT_SUPPORT=y -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y -# CONFIG_SG_SPLIT is not set -CONFIG_ARCH_HAS_SG_CHAIN=y diff --git a/config/sources/families/rockchip64.conf b/config/sources/families/rockchip64.conf index 527a5db7e..cb6b6d2fe 100644 --- a/config/sources/families/rockchip64.conf +++ b/config/sources/families/rockchip64.conf @@ -10,12 +10,9 @@ case $BRANCH in KERNELDIR='linux-rockchip64' KERNELPATCHDIR='rockchip64-'$BRANCH - if [[ $BOARD == station-p1 ]]; then - LINUXCONFIG='linux-station-p1-'$BRANCH - LINUXFAMILY=station-p1 - elif [[ $BOARD == station-m1 ]]; then - LINUXCONFIG='linux-station-m1-'$BRANCH - LINUXFAMILY=station-m1 + if [[ $BOARD == station* ]]; then + LINUXCONFIG='linux-station-'$BRANCH + LINUXFAMILY=station fi ;; diff --git a/patch/kernel/archive/rockchip64-4.4/zz-add-rk3399-roc-pc-make.patch b/patch/kernel/archive/rockchip64-4.4/zz-add-rk3399-roc-pc-make.patch index f87c3afb8..52f0446e4 100644 --- a/patch/kernel/archive/rockchip64-4.4/zz-add-rk3399-roc-pc-make.patch +++ b/patch/kernel/archive/rockchip64-4.4/zz-add-rk3399-roc-pc-make.patch @@ -1,11 +1,12 @@ --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -86,6 +86,8 @@ +@@ -84,6 +84,9 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-evb-rev3-cros.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-firefly-android.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-firefly-linux.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-mezzanine.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc-plus.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-fpga.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-gru.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-kevin-r0.dtb diff --git a/patch/kernel/archive/rockchip64-4.4/zz-add-rk3399-roc-pc-mezzanine-dts.patch b/patch/kernel/archive/rockchip64-4.4/zz-add-rk3399-roc-pc-mezzanine-dts.patch new file mode 100644 index 000000000..713223658 --- /dev/null +++ b/patch/kernel/archive/rockchip64-4.4/zz-add-rk3399-roc-pc-mezzanine-dts.patch @@ -0,0 +1,1229 @@ +new file mode 100644 +index 0000000..7b82b78 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts +@@ -0,0 +1,1223 @@ ++/dts-v1/; ++ ++#include ++#include ++#include "rk3399.dtsi" ++#include "rk3399-opp.dtsi" ++#include "rk3399-vop-clk-set.dtsi" ++ ++/ { ++ model = "Firefly roc-rk3399-pc-mezzanine "; ++ compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399"; ++ ++ reserved-memory { ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ranges; ++ ++ drm_logo: drm-logo@00000000 { ++ compatible = "rockchip,drm-logo"; ++ reg = <0x0 0x0 0x0 0x0>; ++ }; ++ }; ++ ++ vcc1v8_s0: vcc1v8-s0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_s0"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ }; ++ ++ vcc_sys: vcc-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_sys"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-always-on; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vcc3v3_sys: vcc3v3-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ vcc3v3_pcie: vcc3v3-pcie-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio2 26 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_drv>; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-name = "vcc3v3_pcie"; ++ vin-supply = <&vcc3v3_sys>; ++ }; ++ ++ vcc5v0_host: vcc5v0-host-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 25 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&host_vbus_drv>; ++ regulator-name = "vcc5v0_host"; ++ regulator-always-on; ++ }; ++ ++ vcc5v0_otg: vcc5v0-otg-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 3 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&otg_vbus_drv>; ++ regulator-name = "vcc5v0_otg"; ++ regulator-always-on; ++ }; ++ ++ vdd_log: vdd-log { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm2 0 25000 1>; ++ regulator-name = "vdd_log"; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1400000>; ++ regulator-always-on; ++ regulator-boot-on; ++ ++ /* for rockchip boot on */ ++ rockchip,pwm_id= <2>; ++ rockchip,pwm_voltage = <900000>; ++ ++ vin-supply = <&vcc_sys>; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ es8328-sound { ++ status = "okay"; ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,name = "rockchip,es8328-codec"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s1>; ++ system-clock-frequency = <11289600>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&es8328>; ++ system-clock-frequency = <11289600>; ++ }; ++ }; ++ ++ hdmi_sound: hdmi-sound { ++ status = "disabled"; ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "rockchip,hdmi"; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&i2s2>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&dw_hdmi_audio>; ++ }; ++ }; ++ ++ dw_hdmi_audio: dw-hdmi-audio { ++ status = "disabled"; ++ compatible = "rockchip,dw-hdmi-audio"; ++ #sound-dai-cells = <0>; ++ }; ++ ++ hdmi_codec: hdmi-codec { ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "HDMI-CODEC"; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&i2s2>; ++ }; ++ ++ simple-audio-card,codec { ++ sound-dai = <&hdmi>; ++ }; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_enable_h>; ++ ++ /* ++ * On the module itself this is one of these (depending ++ * on the actual card populated): ++ * - SDIO_RESET_L_WL_REG_ON ++ * - PDN (power down when low) ++ */ ++ reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; /* GPIO0_B2 */ ++ }; ++ ++ wireless-wlan { ++ compatible = "wlan-platdata"; ++ rockchip,grf = <&grf>; ++ wifi_chip_type = "ap6354"; ++// wifi_chip_type = "ap6256"; ++// wifi_chip_type = "rtl8723du"; ++ sdio_vref = <1800>; ++ WIFI,host_wake_irq = <&gpio0 3 GPIO_ACTIVE_HIGH>; /* GPIO0_a3 */ ++ status = "disabled"; ++ }; ++ ++ wireless_bluetooth: wireless-bluetooth { ++ compatible = "bluetooth-platdata"; ++ //wifi-bt-power-toggle; ++ clocks = <&rk808 1>; ++ clock-name = "ext_clock"; ++ uart_rts_gpios = <&gpio2 19 GPIO_ACTIVE_LOW>; /* GPIO2_C3 */ ++ pinctrl-names = "default", "rts_gpio"; ++ pinctrl-0 = <&uart0_rts>; ++ pinctrl-1 = <&uart0_gpios>; ++ //BT,power_gpio = <&gpio3 19 GPIO_ACTIVE_HIGH>; /* GPIOx_xx */ ++ BT,reset_gpio = <&gpio0 9 GPIO_ACTIVE_HIGH>; /* GPIO0_B1 */ ++ BT,wake_gpio = <&gpio2 26 GPIO_ACTIVE_HIGH>; /* GPIO2_D2 */ ++ BT,wake_host_irq = <&gpio0 4 GPIO_ACTIVE_HIGH>; /* GPIO0_A4 */ ++ status = "disabled"; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ power { ++ label = "firefly:blue:power"; ++ linux,default-trigger = "ir-power-click"; ++ default-state = "on"; ++ gpios = <&gpio2 27 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default";pinctrl-0 = <&led_power>; ++ }; ++ user { ++ label = "firefly:yellow:user"; ++ linux,default-trigger = "ir-user-click"; ++ default-state = "off"; ++ gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&led_user>; ++ }; ++ }; ++ ++ adc-keys { ++ compatible = "adc-keys"; ++ io-channels = <&saradc 1>; ++ io-channel-names = "buttons"; ++ poll-interval = <300>; ++ keyup-threshold-microvolt = <1800000>; ++ ++ esc-key { ++ linux,code = ; ++ label = "esc"; ++ press-threshold-microvolt = <0>; ++ }; ++ }; ++ ++ test-power { ++ status = "okay"; ++ }; ++}; ++ ++&cpu_l0 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l1 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l2 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l3 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_b0 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cpu_b1 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&gmac { ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ clock_in_out = "input"; ++ snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ pinctrl-names = "default", "sleep"; ++ pinctrl-0 = <&rgmii_pins>; ++ pinctrl-1 = <&rgmii_sleep_pins>; ++ tx_delay = <0x28>; ++ rx_delay = <0x11>; ++ status = "okay"; ++}; ++ ++&gpu { ++ status = "okay"; ++ mali-supply = <&vdd_gpu>; ++}; ++ ++&hdmi { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ #sound-dai-cells = <0>; ++ status = "okay"; ++ rockchip,phy-table = ++ <74250000 0x8009 0x0004 0x0272>, ++ <165000000 0x802b 0x0004 0x0209>, ++ <297000000 0x8039 0x0005 0x028d>, ++ <594000000 0x8039 0x0000 0x019d>, ++ <000000000 0x0000 0x0000 0x0000>; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <168>; ++ i2c-scl-falling-time-ns = <4>; ++ clock-frequency = <400000>; ++ ++ vdd_cpu_b: syr827@40 { ++ compatible = "silergy,syr827"; ++ reg = <0x40>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-0 = <&vsel1_gpio>; ++ vsel-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_gpu: syr828@41 { ++ compatible = "silergy,syr828"; ++ reg = <0x41>; ++ regulator-compatible = "fan53555-reg"; ++ pinctrl-0 = <&vsel2_gpio>; ++ vsel-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_gpu"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ vin-supply = <&vcc_sys>; ++ regulator-initial-mode = <1>; /* 1:force PWM 2:auto */ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ rk808: pmic@1b { ++ compatible = "rockchip,rk808"; ++ reg = <0x1b>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <21 IRQ_TYPE_LEVEL_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk808-clkout2"; ++ ++ vcc1-supply = <&vcc_sys>; ++ vcc2-supply = <&vcc_sys>; ++ vcc3-supply = <&vcc_sys>; ++ vcc4-supply = <&vcc_sys>; ++ vcc6-supply = <&vcc_sys>; ++ vcc7-supply = <&vcc_sys>; ++ vcc8-supply = <&vcc3v3_sys>; ++ vcc9-supply = <&vcc_sys>; ++ vcc10-supply = <&vcc_sys>; ++ vcc11-supply = <&vcc_sys>; ++ vcc12-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc_1v8>; ++ ++ regulators { ++ vdd_center: DCDC_REG1 { ++ regulator-name = "vdd_center"; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_cpu_l: DCDC_REG2 { ++ regulator-name = "vdd_cpu_l"; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-name = "vcc_ddr"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_1v8: DCDC_REG4 { ++ regulator-name = "vcc_1v8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcca1v8_codec: LDO_REG1 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcca1v8_codec"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcca1v8_hdmi: LDO_REG2 { ++ regulator-name = "vcca1v8_hdmi"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcca_1v8: LDO_REG3 { ++ regulator-name = "vcca_1v8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc_sd: LDO_REG4 { ++ regulator-name = "vcc_sd"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v0_sd: LDO_REG5 { ++ regulator-name = "vcc3v0_sd"; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc_1v5: LDO_REG6 { ++ regulator-name = "vcc_1v5"; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1500000>; ++ }; ++ }; ++ ++ vcca0v9_hdmi: LDO_REG7 { ++ regulator-name = "vcca0v9_hdmi"; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <900000>; ++ }; ++ }; ++ ++ vcc_3v0: LDO_REG8 { ++ regulator-name = "vcc_3v0"; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v3_s3: SWITCH_REG1 { ++ regulator-name = "vcc3v3_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc3v3_s0: SWITCH_REG2 { ++ regulator-name = "vcc3v3_s0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <300>; ++ i2c-scl-falling-time-ns = <15>; ++ clock-frequency = <100000>; ++ ++ es8328: es8328@11 { ++ compatible = "everest,es8323"; ++ status = "okay"; ++ reg = <0x11>; ++ hp-det-gpio = <&gpio2 6 GPIO_ACTIVE_HIGH>; ++ hp-ctl-gpio = <&gpio0 2 GPIO_ACTIVE_HIGH>; ++ clock-names = "mclk"; ++ clocks = <&cru SCLK_I2S_8CH_OUT>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_8ch_mclk>; ++ pinctrl-1 = <&ear_ctl_h>; ++ #sound-dai-cells = <0>; ++ }; ++}; ++ ++&i2c2 { ++ status = "okay"; ++}; ++ ++&i2c4 { ++ status = "okay"; ++ ++ camera1: camera-module@10 { ++ status = "okay"; ++ compatible = "sony,imx219"; ++ reg = <0x10>; ++ ++ clocks = <&cru SCLK_CIF_OUT>; ++ clock-names = "clk_cif_out"; ++ pinctrl-names = "rockchip,camera_default"; ++ pwdn-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; ++ ++ port { ++ ucam_out0: endpoint { ++ remote-endpoint = <&mipi_in_ucam0>; ++ data-lanes = <1 2>; ++ }; ++ }; ++ }; ++}; ++ ++&i2c7 { ++ status = "okay"; ++}; ++ ++&i2s1 { ++ status = "okay"; ++ rockchip,i2s-broken-burst-len; ++ rockchip,playback-channels = <2>; ++ rockchip,capture-channels = <2>; ++ #sound-dai-cells = <0>; ++ assigned-clocks = <&cru SCLK_I2S1_DIV>, <&cru SCLK_I2S_8CH>; ++ assigned-clock-parents = <&cru PLL_GPLL>, <&cru SCLK_I2S1_8CH>; ++}; ++ ++&i2s2 { ++ #sound-dai-cells = <0>; ++ dmas = <&dmac_bus 4>; ++ dma-names = "tx"; ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ bt656-supply = <&vcc_3v0>; /* bt656_gpio2ab_ms */ ++ audio-supply = <&vcca1v8_codec>; /* audio_gpio3d4a_ms */ ++ sdmmc-supply = <&vcc_sd>; /* sdmmc_gpio4b_ms */ ++ gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */ ++}; ++ ++&pcie_phy { ++ status = "okay"; ++}; ++ ++&pcie0 { ++ ep-gpios = <&gpio4 27 GPIO_ACTIVE_HIGH>; ++ num-lanes = <4>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_clkreqnb_cpm>; ++ status = "okay"; ++}; ++ ++&pmu_io_domains { ++ status = "okay"; ++ pmu1830-supply = <&vcc_3v0>; ++}; ++ ++/* HACK: keep MALI version on linux */ ++&gpu_power_model { ++ // for DDK r14. ++ voltage = <900>; ++ frequency = <500>; ++ static-power = <300>; ++ dynamic-power = <396>; ++}; ++ ++&pinctrl { ++ ++ es8328-pins { ++ ear_ctl_h: ear-ctl-h { ++ rockchip,pins = <0 2 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ ++ sdio0 { ++ sdio0_bus1: sdio0-bus1 { ++ rockchip,pins = ++ <2 20 RK_FUNC_1 &pcfg_pull_up_20ma>; ++ }; ++ ++ sdio0_bus4: sdio0-bus4 { ++ rockchip,pins = ++ <2 20 RK_FUNC_1 &pcfg_pull_up_20ma>, ++ <2 21 RK_FUNC_1 &pcfg_pull_up_20ma>, ++ <2 22 RK_FUNC_1 &pcfg_pull_up_20ma>, ++ <2 23 RK_FUNC_1 &pcfg_pull_up_20ma>; ++ }; ++ ++ sdio0_cmd: sdio0-cmd { ++ rockchip,pins = ++ <2 24 RK_FUNC_1 &pcfg_pull_up_20ma>; ++ }; ++ ++ sdio0_clk: sdio0-clk { ++ rockchip,pins = ++ <2 25 RK_FUNC_1 &pcfg_pull_none_20ma>; ++ }; ++ }; ++ ++ sdmmc { ++ sdmmc_bus1: sdmmc-bus1 { ++ rockchip,pins = ++ <4 8 RK_FUNC_1 &pcfg_pull_up_8ma>; ++ }; ++ ++ sdmmc_bus4: sdmmc-bus4 { ++ rockchip,pins = ++ <4 8 RK_FUNC_1 &pcfg_pull_up_8ma>, ++ <4 9 RK_FUNC_1 &pcfg_pull_up_8ma>, ++ <4 10 RK_FUNC_1 &pcfg_pull_up_8ma>, ++ <4 11 RK_FUNC_1 &pcfg_pull_up_8ma>; ++ }; ++ ++ sdmmc_clk: sdmmc-clk { ++ rockchip,pins = ++ <4 12 RK_FUNC_1 &pcfg_pull_none_18ma>; ++ }; ++ ++ sdmmc_cmd: sdmmc-cmd { ++ rockchip,pins = ++ <4 13 RK_FUNC_1 &pcfg_pull_up_8ma>; ++ }; ++ }; ++ ++ leds { ++ led_power: led-power { ++ rockchip,pins = ++ <2 27 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ led_user: led-user { ++ rockchip,pins = ++ <0 13 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = ++ <1 21 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ pmic_dvs2: pmic-dvs2 { ++ rockchip,pins = ++ <1 18 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ vsel1_gpio: vsel1-gpio { ++ rockchip,pins = ++ <1 18 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ vsel2_gpio: vsel2-gpio { ++ rockchip,pins = ++ <1 14 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = ++ <0 10 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ wireless-bluetooth { ++ uart0_gpios: uart0-gpios { ++ rockchip,pins = ++ <2 19 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ usb2 { ++ host_vbus_drv: host-vbus-drv { ++ rockchip,pins = ++ <4 25 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ otg_vbus_drv: otg-vbus-drv { ++ rockchip,pins = ++ <1 3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pcie { ++ pcie_drv: pcie-drv { ++ rockchip,pins = ++ <2 26 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ wifi { ++ vcc_wifi_h: vcc-wifi-h { ++ rockchip,pins = <4 27 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ gmac { ++ rgmii_sleep_pins: rgmii-sleep-pins { ++ rockchip,pins = ++ <3 15 RK_FUNC_GPIO &pcfg_output_low>; ++ }; ++ }; ++ ++ i2c4 { ++ i2c4_xfer: i2c4-xfer { ++ rockchip,pins = ++ <1 12 RK_FUNC_1 &pcfg_pull_up>, ++ <1 11 RK_FUNC_1 &pcfg_pull_up>; ++ }; ++ }; ++}; ++ ++&pwm0 { ++ status = "okay"; ++}; ++ ++&pwm1 { ++ status = "okay"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++ pinctrl-names = "active"; ++ pinctrl-0 = <&pwm2_pin_pull_down>; ++}; ++ ++ ++&threshold { ++ temperature = <85000>; ++}; ++ ++&target { ++ temperature = <100000>; ++}; ++ ++&soc_crit { ++ temperature = <105000>; ++}; ++ ++&tcphy0 { ++ status = "okay"; ++}; ++ ++&tcphy1 { ++ status = "okay"; ++// /delete-property/ extcon; ++}; ++ ++&tsadc { ++ /* tshut mode 0:CRU 1:GPIO */ ++ rockchip,hw-tshut-mode = <1>; ++ /* tshut polarity 0:LOW 1:HIGH */ ++ rockchip,hw-tshut-polarity = <1>; ++ rockchip,hw-tshut-temp = <110000>; ++ status = "okay"; ++}; ++ ++&u2phy0 { ++ status = "okay"; ++ enable-active-high; ++ /* otg-vbus-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;*/ ++ gpio = <&gpio1 3 GPIO_ACTIVE_HIGH>; ++ ++ u2phy0_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy0_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy1_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&uart4 { ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usb_host1_ehci { ++ status = "okay"; ++}; ++ ++&usb_host1_ohci { ++ status = "okay"; ++}; ++ ++&usbdrd3_0 { ++ extcon = <&u2phy0>; ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_0 { ++ dr_mode = "otg"; ++ status = "okay"; ++}; ++ ++&usbdrd3_1 { ++ status = "okay"; ++ ++// /delete-property/ extcon; ++ ++}; ++ ++&usbdrd_dwc3_1 { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&pwm3 { ++ status = "okay"; ++ interrupts = ; ++ compatible = "rockchip,remotectl-pwm"; ++ pinctrl-names = "default"; ++ remote_pwm_id = <3>; ++ handle_cpu_id = <0>; ++ remote_support_psci = <1>; ++ ++ ir_key1 { ++ rockchip,usercode = <0x4040>; ++ rockchip,key_table = ++ <0xf2 KEY_REPLY>, ++ <0xba KEY_BACK>, ++ <0xf4 KEY_UP>, ++ <0xf1 KEY_DOWN>, ++ <0xef KEY_LEFT>, ++ <0xee KEY_RIGHT>, ++ <0xbd KEY_HOME>, ++ <0xea KEY_VOLUMEUP>, ++ <0xe3 KEY_VOLUMEDOWN>, ++ <0xe2 KEY_SEARCH>, ++ <0xb2 KEY_POWER>, ++ <0xbc KEY_MUTE>, ++ <0xec KEY_MENU>, ++ <0xbf 0x190>, ++ <0xe0 0x191>, ++ <0xe1 0x192>, ++ <0xe9 183>, ++ <0xe6 248>, ++ <0xe8 185>, ++ <0xe7 186>, ++ <0xf0 388>, ++ <0xbe 0x175>; ++ }; ++ ++ ir_key2 { ++ rockchip,usercode = <0xff00>; ++ rockchip,key_table = ++ <0xeb KEY_POWER>, ++ <0xec KEY_COMPOSE>, ++ <0xfe KEY_BACK>, ++ <0xb7 KEY_HOME>, ++ <0xa3 KEY_WWW>, ++ <0xf4 KEY_VOLUMEUP>, ++ <0xa7 KEY_VOLUMEDOWN>, ++ <0xf8 KEY_ENTER>, ++ <0xfc KEY_UP>, ++ <0xfd KEY_DOWN>, ++ <0xf1 KEY_LEFT>, ++ <0xe5 KEY_RIGHT>; ++ }; ++ ++ ir_key3 { ++ rockchip,usercode = <0x1dcc>; ++ rockchip,key_table = ++ <0xee KEY_REPLY>, ++ <0xf0 KEY_BACK>, ++ <0xf8 KEY_UP>, ++ <0xbb KEY_DOWN>, ++ <0xef KEY_LEFT>, ++ <0xed KEY_RIGHT>, ++ <0xfc KEY_HOME>, ++ <0xf1 KEY_VOLUMEUP>, ++ <0xfd KEY_VOLUMEDOWN>, ++ <0xb7 KEY_SEARCH>, ++ <0xff KEY_POWER>, ++ <0xf3 KEY_MUTE>, ++ <0xbf KEY_MENU>, ++ <0xf9 0x191>, ++ <0xf5 0x192>, ++ <0xb3 388>, ++ <0xbe KEY_1>, ++ <0xba KEY_2>, ++ <0xb2 KEY_3>, ++ <0xbd KEY_4>, ++ <0xf9 KEY_5>, ++ <0xb1 KEY_6>, ++ <0xfc KEY_7>, ++ <0xf8 KEY_8>, ++ <0xb0 KEY_9>, ++ <0xb6 KEY_0>, ++ <0xb5 KEY_BACKSPACE>; ++ }; ++}; ++ ++&dsi { ++ status = "disabled"; ++}; ++ ++&vopb_out_dsi { ++ status = "disabled"; ++}; ++ ++&vopl_out_dsi { ++ status = "disabled"; ++}; ++ ++&dsi1 { ++ rockchip,dual-channel = <&dsi>; ++ status = "disabled"; ++ ++ panel: panel@0 { ++ compatible ="rockpi,tc358762"; ++ reg = <0>; ++ status = "okay"; ++ }; ++}; ++ ++&saradc { ++ status = "okay"; ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ mmc-hs400-1_8v; ++ supports-emmc; ++ non-removable; ++ mmc-hs400-enhanced-strobe; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ clock-frequency = <100000000>; ++ clock-freq-min-max = <100000 100000000>; ++ supports-sd; ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ num-slots = <1>; ++ //sd-uhs-sdr104; ++ vqmmc-supply = <&vcc_sd>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; ++ card-detect-delay = <800>; ++ status = "okay"; ++}; ++ ++&sdio0 { ++ clock-frequency = <100000000>; ++ clock-freq-min-max = <200000 100000000>; ++ supports-sdio; ++ bus-width = <4>; ++ disable-wp; ++ cap-sd-highspeed; ++ cap-sdio-irq; ++ keep-power-in-suspend; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; ++ sd-uhs-sdr104; ++ status = "okay"; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++ ++&pvtm { ++ status = "okay"; ++}; ++ ++&pmu_pvtm { ++ status = "okay"; ++}; ++ ++&rockchip_suspend { ++ status = "okay"; ++ rockchip,sleep-debug-en = <0>; ++ rockchip,sleep-mode-config = < ++ (0 ++ | RKPM_SLP_ARMPD ++ | RKPM_SLP_PERILPPD ++ | RKPM_SLP_DDR_RET ++ | RKPM_SLP_PLLPD ++ | RKPM_SLP_CENTER_PD ++ | RKPM_SLP_AP_PWROFF ++ ) ++ >; ++ rockchip,wakeup-config = < ++ (0 ++ | RKPM_GPIO_WKUP_EN ++ | RKPM_PWM_WKUP_EN ++ ) ++ >; ++ rockchip,pwm-regulator-config = < ++ (0 ++ | PWM2_REGULATOR_EN ++ ) ++ >; ++ rockchip,power-ctrl = ++ <&gpio1 17 GPIO_ACTIVE_HIGH>, ++ <&gpio1 14 GPIO_ACTIVE_HIGH>; ++}; ++ ++&vopb { ++ status = "okay"; ++}; ++ ++&vopb_mmu { ++ status = "okay"; ++}; ++ ++&vopl { ++ status = "okay"; ++}; ++ ++&vopl_mmu { ++ status = "okay"; ++}; ++ ++&rkisp1_0 { ++ // TODO: this crashes kernel ++ status = "disabled"; ++ port { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ isp0_mipi_in: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&dphy_rx0_out>; ++ }; ++ }; ++}; ++ ++&mipi_dphy_rx0 { ++ // TODO: this crashes kernel ++ status = "disabled"; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mipi_in_ucam0: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&ucam_out0>; ++ data-lanes = <1 2>; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ dphy_rx0_out: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&isp0_mipi_in>; ++ }; ++ }; ++ }; ++}; ++ ++&isp0_mmu { ++ status = "okay"; ++}; ++ ++&isp1_mmu { ++ status = "disabled"; ++}; ++ ++&vpu { ++ status = "okay"; ++ /* 0 means ion, 1 means drm */ ++ //allocator = <0>; ++}; ++ ++&rkvdec { ++ status = "okay"; ++ /* 0 means ion, 1 means drm */ ++ //allocator = <0>; ++}; ++ ++&display_subsystem { ++ /delete-property/ devfreq; ++ status = "okay"; ++ ++ ports = <&vopb_out>, <&vopl_out>; ++ logo-memory-region = <&drm_logo>; ++ ++ route { ++ route_hdmi: route-hdmi { ++ logo,uboot = "logo.bmp"; ++ logo,kernel = "logo_kernel.bmp"; ++ logo,mode = "center"; ++ charge_logo,mode = "center"; ++ connect = <&vopb_out_hdmi>; ++ }; ++ ++ route_dp: route-dp { ++ logo,uboot = "logo.bmp"; ++ logo,kernel = "logo_kernel.bmp"; ++ logo,mode = "center"; ++ charge_logo,mode = "center"; ++ connect = <&vopl_out_dp>; ++ }; ++ }; ++}; ++ ++&dsi1_in_vopl { ++ status = "disabled"; ++}; ++ ++&dsi1_in_vopb { ++ status = "disabled"; ++}; + diff --git a/patch/kernel/archive/rockchip64-4.4/zz-add-rk3399-roc-pc-plus-dts.patch b/patch/kernel/archive/rockchip64-4.4/zz-add-rk3399-roc-pc-plus-dts.patch index fadb89d36..713223658 100644 --- a/patch/kernel/archive/rockchip64-4.4/zz-add-rk3399-roc-pc-plus-dts.patch +++ b/patch/kernel/archive/rockchip64-4.4/zz-add-rk3399-roc-pc-plus-dts.patch @@ -1,17 +1,8 @@ -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts -new file mode 120000 -index 00000000..5a62cd6b ---- /dev/null -+++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts -@@ -0,0 +1 @@ -+rk3399-roc-pc-plus.dts -\ No newline at end of file -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dts b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dts new file mode 100644 index 0000000..7b82b78 --- /dev/null -+++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dts -@@ -0,0 +1,1301 @@ ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts +@@ -0,0 +1,1223 @@ +/dts-v1/; + +#include @@ -21,14 +12,9 @@ index 0000000..7b82b78 +#include "rk3399-vop-clk-set.dtsi" + +/ { -+ model = "Firefly roc-rk3399-pc PLUS"; ++ model = "Firefly roc-rk3399-pc-mezzanine "; + compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399"; + -+ chosen { -+ bootargs = "earlycon=uart8250,mmio32,0xff1a0000 swiotlb=1"; -+ stdout-path = "serial2:1500000n8"; -+ }; -+ + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; @@ -127,42 +113,21 @@ index 0000000..7b82b78 + #clock-cells = <0>; + }; + -+// es8316-sound { -+// compatible = "simple-audio-card"; -+// simple-audio-card,format = "i2s"; -+// simple-audio-card,name = "rockchip,es8316-codec"; -+// simple-audio-card,mclk-fs = <256>; -+// simple-audio-card,widgets = -+// "Microphone", "Mic Jack", -+// "Headphone", "Headphone Jack"; -+// simple-audio-card,routing = -+// "Mic Jack", "MICBIAS1", -+// "IN1P", "Mic Jack", -+// "Headphone Jack", "HPOL", -+// "Headphone Jack", "HPOR"; -+// simple-audio-card,cpu { -+// sound-dai = <&i2s0>; -+// }; -+// simple-audio-card,codec { -+// sound-dai = <&es8316>; -+// }; -+// }; -+ -+// es8388-sound { -+// status = "okay"; -+// compatible = "simple-audio-card"; -+// simple-audio-card,format = "i2s"; -+// simple-audio-card,name = "rockchip,es8388-codec"; -+// simple-audio-card,mclk-fs = <256>; -+// simple-audio-card,cpu { -+// sound-dai = <&i2s1>; -+// system-clock-frequency = <11289600>; -+// }; -+// simple-audio-card,codec { -+// sound-dai = <&es8388>; -+// system-clock-frequency = <11289600>; -+// }; -+// }; ++ es8328-sound { ++ status = "okay"; ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,name = "rockchip,es8328-codec"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s1>; ++ system-clock-frequency = <11289600>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&es8328>; ++ system-clock-frequency = <11289600>; ++ }; ++ }; + + hdmi_sound: hdmi-sound { + status = "disabled"; @@ -200,24 +165,6 @@ index 0000000..7b82b78 + }; + }; + -+// spdif-sound { -+// status = "okay"; -+// compatible = "simple-audio-card"; -+// simple-audio-card,name = "ROCKCHIP,SPDIF"; -+// simple-audio-card,cpu { -+// sound-dai = <&spdif>; -+// }; -+// simple-audio-card,codec { -+// sound-dai = <&spdif_out>; -+// }; -+// }; -+ -+// spdif_out: spdif-out { -+// status = "okay"; -+// compatible = "linux,spdif-dit"; -+// #sound-dai-cells = <0>; -+// }; -+ + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk808 1>; @@ -231,72 +178,66 @@ index 0000000..7b82b78 + * - SDIO_RESET_L_WL_REG_ON + * - PDN (power down when low) + */ -+ reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; ++ reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; /* GPIO0_B2 */ + }; + + wireless-wlan { + compatible = "wlan-platdata"; + rockchip,grf = <&grf>; ++ wifi_chip_type = "ap6354"; +// wifi_chip_type = "ap6256"; -+ wifi_chip_type = "rtl8723ds"; ++// wifi_chip_type = "rtl8723du"; + sdio_vref = <1800>; -+ WIFI,host_wake_irq = <&gpio0 3 GPIO_ACTIVE_HIGH>; -+ status = "okay"; ++ WIFI,host_wake_irq = <&gpio0 3 GPIO_ACTIVE_HIGH>; /* GPIO0_a3 */ ++ status = "disabled"; + }; + -+ -+// wireless-wlan { -+// compatible = "wlan-platdata"; -+// clocks = <&cru SCLK_RTC32K>; -+// clock-names = "ext_clock"; -+// pinctrl-names = "default"; -+// pinctrl-0 = <&clock_wifi>; -+// rockchip,grf = <&grf>; -+// wifi_chip_type = "rtl8723ds"; -+// sdio_vref = <1800>; -+// WIFI,host_wake_irq = <&gpio3 1 GPIO_ACTIVE_HIGH>; -+// status = "okay"; -+// }; -+ -+ -+ wireless-bluetooth { ++ wireless_bluetooth: wireless-bluetooth { + compatible = "bluetooth-platdata"; ++ //wifi-bt-power-toggle; + clocks = <&rk808 1>; -+ clock-names = "ext_clock"; -+ /* wifi-bt-power-toggle; */ -+ uart_rts_gpios = <&gpio2 19 GPIO_ACTIVE_LOW>; ++ clock-name = "ext_clock"; ++ uart_rts_gpios = <&gpio2 19 GPIO_ACTIVE_LOW>; /* GPIO2_C3 */ + pinctrl-names = "default", "rts_gpio"; + pinctrl-0 = <&uart0_rts>; + pinctrl-1 = <&uart0_gpios>; -+ /* BT,power_gpio = <&gpio3 19 GPIO_ACTIVE_HIGH>; */ -+ BT,reset_gpio = <&gpio0 9 GPIO_ACTIVE_HIGH>; -+ BT,wake_gpio = <&gpio2 27 GPIO_ACTIVE_HIGH>; -+ BT,wake_host_irq = <&gpio0 4 GPIO_ACTIVE_HIGH>; -+ status = "okay"; ++ //BT,power_gpio = <&gpio3 19 GPIO_ACTIVE_HIGH>; /* GPIOx_xx */ ++ BT,reset_gpio = <&gpio0 9 GPIO_ACTIVE_HIGH>; /* GPIO0_B1 */ ++ BT,wake_gpio = <&gpio2 26 GPIO_ACTIVE_HIGH>; /* GPIO2_D2 */ ++ BT,wake_host_irq = <&gpio0 4 GPIO_ACTIVE_HIGH>; /* GPIO0_A4 */ ++ status = "disabled"; + }; + -+// wireless-bluetooth { -+// compatible = "bluetooth-platdata"; -+// clocks = <&cru SCLK_RTC32K>; -+// clock-names = "ext_clock"; -+// BT,power_gpio = <&gpio1 24 GPIO_ACTIVE_HIGH>; //GPIO1_D0 -+// BT,wake_host_irq = <&gpio1 26 GPIO_ACTIVE_HIGH>;//GPIO1_D2 -+// status = "okay"; -+// }; -+ -+ gpio-leds { ++ leds { + compatible = "gpio-leds"; -+ -+ user-led1 { -+ gpios=<&gpio3 28 GPIO_ACTIVE_HIGH>; -+ linux,default-trigger="heartbeat"; ++ power { ++ label = "firefly:blue:power"; ++ linux,default-trigger = "ir-power-click"; + default-state = "on"; ++ gpios = <&gpio2 27 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default";pinctrl-0 = <&led_power>; + }; ++ user { ++ label = "firefly:yellow:user"; ++ linux,default-trigger = "ir-user-click"; ++ default-state = "off"; ++ gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&led_user>; ++ }; ++ }; + -+ user-led2 { -+ gpios=<&gpio3 29 GPIO_ACTIVE_HIGH>; -+ linux,default-trigger="heartbeat"; -+ default-state = "on"; ++ adc-keys { ++ compatible = "adc-keys"; ++ io-channels = <&saradc 1>; ++ io-channel-names = "buttons"; ++ poll-interval = <300>; ++ keyup-threshold-microvolt = <1800000>; ++ ++ esc-key { ++ linux,code = ; ++ label = "esc"; ++ press-threshold-microvolt = <0>; + }; + }; + @@ -305,6 +246,52 @@ index 0000000..7b82b78 + }; +}; + ++&cpu_l0 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l1 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l2 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l3 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_b0 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cpu_b1 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&gmac { ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ clock_in_out = "input"; ++ snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ pinctrl-names = "default", "sleep"; ++ pinctrl-0 = <&rgmii_pins>; ++ pinctrl-1 = <&rgmii_sleep_pins>; ++ tx_delay = <0x28>; ++ rx_delay = <0x11>; ++ status = "okay"; ++}; ++ ++&gpu { ++ status = "okay"; ++ mali-supply = <&vdd_gpu>; ++}; ++ +&hdmi { + #address-cells = <1>; + #size-cells = <0>; @@ -318,67 +305,6 @@ index 0000000..7b82b78 + <000000000 0x0000 0x0000 0x0000>; +}; + -+&sdmmc { -+ clock-frequency = <100000000>; -+ clock-freq-min-max = <100000 100000000>; -+ supports-sd; -+ bus-width = <4>; -+ cap-mmc-highspeed; -+ cap-sd-highspeed; -+ disable-wp; -+ num-slots = <1>; -+ //sd-uhs-sdr104; -+ vqmmc-supply = <&vcc_sd>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; -+ card-detect-delay = <800>; -+ status = "okay"; -+}; -+ -+&sdio0 { -+ clock-frequency = <100000000>; -+ clock-freq-min-max = <200000 100000000>; -+ supports-sdio; -+ bus-width = <4>; -+ disable-wp; -+ cap-sd-highspeed; -+ cap-sdio-irq; -+ keep-power-in-suspend; -+ mmc-pwrseq = <&sdio_pwrseq>; -+ non-removable; -+ num-slots = <1>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; -+ sd-uhs-sdr104; -+ status = "okay"; -+}; -+ -+&emmc_phy { -+ status = "okay"; -+}; -+ -+&sdhci { -+ bus-width = <8>; -+ mmc-hs400-1_8v; -+ supports-emmc; -+ non-removable; -+ mmc-hs400-enhanced-strobe; -+ status = "okay"; -+}; -+ -+&i2s0 { -+ status = "okay"; -+ rockchip,i2s-broken-burst-len; -+ rockchip,playback-channels = <8>; -+ rockchip,capture-channels = <8>; -+ #sound-dai-cells = <0>; -+}; -+ -+&i2s2 { -+ status = "okay"; -+ #sound-dai-cells = <0>; -+}; -+ +&i2c0 { + status = "okay"; + i2c-scl-rising-time-ns = <168>; @@ -495,15 +421,14 @@ index 0000000..7b82b78 + }; + }; + -+ vcc1v8_dvp: LDO_REG1 { -+ regulator-name = "vcc1v8_codec"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; ++ vcca1v8_codec: LDO_REG1 { + regulator-always-on; + regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcca1v8_codec"; + regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1800000>; ++ regulator-off-in-suspend; + }; + }; + @@ -612,51 +537,28 @@ index 0000000..7b82b78 + }; +}; + -+//&i2c1 { -+// status = "okay"; -+// i2c-scl-rising-time-ns = <300>; -+// i2c-scl-falling-time-ns = <15>; ++&i2c1 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <300>; ++ i2c-scl-falling-time-ns = <15>; ++ clock-frequency = <100000>; + -+// es8316: es8316@11 { -+// #sound-dai-cells = <0>; -+// compatible = "everest,es8316"; -+// reg = <0x11>; -+// clocks = <&cru SCLK_I2S_8CH_OUT>; -+// clock-names = "mclk"; -+// pinctrl-names = "default"; -+// pinctrl-0 = <&i2s_8ch_mclk>; -+// }; ++ es8328: es8328@11 { ++ compatible = "everest,es8323"; ++ status = "okay"; ++ reg = <0x11>; ++ hp-det-gpio = <&gpio2 6 GPIO_ACTIVE_HIGH>; ++ hp-ctl-gpio = <&gpio0 2 GPIO_ACTIVE_HIGH>; ++ clock-names = "mclk"; ++ clocks = <&cru SCLK_I2S_8CH_OUT>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_8ch_mclk>; ++ pinctrl-1 = <&ear_ctl_h>; ++ #sound-dai-cells = <0>; ++ }; ++}; + -+// rockpi_mcu: rockpi_mcu@45 { -+// compatible = "rockpi_mcu"; -+// reg = <0x45>; -+// }; -+ -+// rockpi_ft5406: rockpi_ft5406@38 { -+// compatible = "rockpi_ft5406"; -+// reg = <0x38>; -+// }; -+ -+//}; -+ -+//&i2c1 { -+// status = "okay"; -+// es8388: es8388@11 { -+// compatible = "everest,es8323"; -+// status = "okay"; -+// reg = <0x11>; -+// hp-det-gpio = <&gpio2 6 GPIO_ACTIVE_HIGH>; -+// hp-ctl-gpio = <&gpio0 2 GPIO_ACTIVE_HIGH>; -+// clock-names = "mclk"; -+// clocks = <&cru SCLK_I2S_8CH_OUT>; -+// pinctrl-names = "default"; -+// pinctrl-0 = <&i2s_8ch_mclk>; -+// pinctrl-1 = <&ear_ctl_h>; -+// #sound-dai-cells = <0>; -+// }; -+//}; -+ -+&i2c7 { ++&i2c2 { + status = "okay"; +}; + @@ -682,41 +584,50 @@ index 0000000..7b82b78 + }; +}; + -+&i2c2 { -+ status = "okay"; -+}; -+ +&i2c7 { + status = "okay"; +}; + -+&cpu_l0 { -+ cpu-supply = <&vdd_cpu_l>; -+}; -+ -+&cpu_l1 { -+ cpu-supply = <&vdd_cpu_l>; -+}; -+ -+&cpu_l2 { -+ cpu-supply = <&vdd_cpu_l>; -+}; -+ -+&cpu_l3 { -+ cpu-supply = <&vdd_cpu_l>; -+}; -+ -+&cpu_b0 { -+ cpu-supply = <&vdd_cpu_b>; -+}; -+ -+&cpu_b1 { -+ cpu-supply = <&vdd_cpu_b>; -+}; -+ -+&gpu { ++&i2s1 { + status = "okay"; -+ mali-supply = <&vdd_gpu>; ++ rockchip,i2s-broken-burst-len; ++ rockchip,playback-channels = <2>; ++ rockchip,capture-channels = <2>; ++ #sound-dai-cells = <0>; ++ assigned-clocks = <&cru SCLK_I2S1_DIV>, <&cru SCLK_I2S_8CH>; ++ assigned-clock-parents = <&cru PLL_GPLL>, <&cru SCLK_I2S1_8CH>; ++}; ++ ++&i2s2 { ++ #sound-dai-cells = <0>; ++ dmas = <&dmac_bus 4>; ++ dma-names = "tx"; ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ bt656-supply = <&vcc_3v0>; /* bt656_gpio2ab_ms */ ++ audio-supply = <&vcca1v8_codec>; /* audio_gpio3d4a_ms */ ++ sdmmc-supply = <&vcc_sd>; /* sdmmc_gpio4b_ms */ ++ gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */ ++}; ++ ++&pcie_phy { ++ status = "okay"; ++}; ++ ++&pcie0 { ++ ep-gpios = <&gpio4 27 GPIO_ACTIVE_HIGH>; ++ num-lanes = <4>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_clkreqnb_cpm>; ++ status = "okay"; ++}; ++ ++&pmu_io_domains { ++ status = "okay"; ++ pmu1830-supply = <&vcc_3v0>; +}; + +/* HACK: keep MALI version on linux */ @@ -728,6 +639,167 @@ index 0000000..7b82b78 + dynamic-power = <396>; +}; + ++&pinctrl { ++ ++ es8328-pins { ++ ear_ctl_h: ear-ctl-h { ++ rockchip,pins = <0 2 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ ++ sdio0 { ++ sdio0_bus1: sdio0-bus1 { ++ rockchip,pins = ++ <2 20 RK_FUNC_1 &pcfg_pull_up_20ma>; ++ }; ++ ++ sdio0_bus4: sdio0-bus4 { ++ rockchip,pins = ++ <2 20 RK_FUNC_1 &pcfg_pull_up_20ma>, ++ <2 21 RK_FUNC_1 &pcfg_pull_up_20ma>, ++ <2 22 RK_FUNC_1 &pcfg_pull_up_20ma>, ++ <2 23 RK_FUNC_1 &pcfg_pull_up_20ma>; ++ }; ++ ++ sdio0_cmd: sdio0-cmd { ++ rockchip,pins = ++ <2 24 RK_FUNC_1 &pcfg_pull_up_20ma>; ++ }; ++ ++ sdio0_clk: sdio0-clk { ++ rockchip,pins = ++ <2 25 RK_FUNC_1 &pcfg_pull_none_20ma>; ++ }; ++ }; ++ ++ sdmmc { ++ sdmmc_bus1: sdmmc-bus1 { ++ rockchip,pins = ++ <4 8 RK_FUNC_1 &pcfg_pull_up_8ma>; ++ }; ++ ++ sdmmc_bus4: sdmmc-bus4 { ++ rockchip,pins = ++ <4 8 RK_FUNC_1 &pcfg_pull_up_8ma>, ++ <4 9 RK_FUNC_1 &pcfg_pull_up_8ma>, ++ <4 10 RK_FUNC_1 &pcfg_pull_up_8ma>, ++ <4 11 RK_FUNC_1 &pcfg_pull_up_8ma>; ++ }; ++ ++ sdmmc_clk: sdmmc-clk { ++ rockchip,pins = ++ <4 12 RK_FUNC_1 &pcfg_pull_none_18ma>; ++ }; ++ ++ sdmmc_cmd: sdmmc-cmd { ++ rockchip,pins = ++ <4 13 RK_FUNC_1 &pcfg_pull_up_8ma>; ++ }; ++ }; ++ ++ leds { ++ led_power: led-power { ++ rockchip,pins = ++ <2 27 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ led_user: led-user { ++ rockchip,pins = ++ <0 13 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = ++ <1 21 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ pmic_dvs2: pmic-dvs2 { ++ rockchip,pins = ++ <1 18 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ vsel1_gpio: vsel1-gpio { ++ rockchip,pins = ++ <1 18 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ vsel2_gpio: vsel2-gpio { ++ rockchip,pins = ++ <1 14 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = ++ <0 10 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ wireless-bluetooth { ++ uart0_gpios: uart0-gpios { ++ rockchip,pins = ++ <2 19 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ usb2 { ++ host_vbus_drv: host-vbus-drv { ++ rockchip,pins = ++ <4 25 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ otg_vbus_drv: otg-vbus-drv { ++ rockchip,pins = ++ <1 3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pcie { ++ pcie_drv: pcie-drv { ++ rockchip,pins = ++ <2 26 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ wifi { ++ vcc_wifi_h: vcc-wifi-h { ++ rockchip,pins = <4 27 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ gmac { ++ rgmii_sleep_pins: rgmii-sleep-pins { ++ rockchip,pins = ++ <3 15 RK_FUNC_GPIO &pcfg_output_low>; ++ }; ++ }; ++ ++ i2c4 { ++ i2c4_xfer: i2c4-xfer { ++ rockchip,pins = ++ <1 12 RK_FUNC_1 &pcfg_pull_up>, ++ <1 11 RK_FUNC_1 &pcfg_pull_up>; ++ }; ++ }; ++}; ++ ++&pwm0 { ++ status = "okay"; ++}; ++ ++&pwm1 { ++ status = "okay"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++ pinctrl-names = "active"; ++ pinctrl-0 = <&pwm2_pin_pull_down>; ++}; ++ ++ +&threshold { + temperature = <85000>; +}; @@ -785,9 +857,6 @@ index 0000000..7b82b78 + phy-supply = <&vcc5v0_host>; + status = "okay"; + }; -+ -+// /delete-property/ extcon; -+ +}; + +&uart0 { @@ -842,17 +911,13 @@ index 0000000..7b82b78 + status = "okay"; +}; + -+&pwm2 { -+ status = "okay"; -+}; -+ +&pwm3 { + status = "okay"; -+ + interrupts = ; + compatible = "rockchip,remotectl-pwm"; ++ pinctrl-names = "default"; + remote_pwm_id = <3>; -+ handle_cpu_id = <1>; ++ handle_cpu_id = <0>; + remote_support_psci = <1>; + + ir_key1 { @@ -883,39 +948,21 @@ index 0000000..7b82b78 + }; + + ir_key2 { -+ rockchip,usercode = <0xff00>; -+ rockchip,key_table = -+ <0xf9 KEY_HOME>, -+ <0xbf KEY_BACK>, -+ <0xfb KEY_MENU>, -+ <0xaa KEY_REPLY>, -+ <0xb9 KEY_UP>, -+ <0xe9 KEY_DOWN>, -+ <0xb8 KEY_LEFT>, -+ <0xea KEY_RIGHT>, -+ <0xeb KEY_VOLUMEDOWN>, -+ <0xef KEY_VOLUMEUP>, -+ <0xf7 KEY_MUTE>, -+ <0xe7 KEY_POWER>, -+ <0xfc KEY_POWER>, -+ <0xa9 KEY_VOLUMEDOWN>, -+ <0xa8 KEY_VOLUMEDOWN>, -+ <0xe0 KEY_VOLUMEDOWN>, -+ <0xa5 KEY_VOLUMEDOWN>, -+ <0xab 183>, -+ <0xb7 388>, -+ <0xe8 388>, -+ <0xf8 184>, -+ <0xaf 185>, -+ <0xed KEY_VOLUMEDOWN>, -+ <0xee 186>, -+ <0xb3 KEY_VOLUMEDOWN>, -+ <0xf1 KEY_VOLUMEDOWN>, -+ <0xf2 KEY_VOLUMEDOWN>, -+ <0xf3 KEY_SEARCH>, -+ <0xb4 KEY_VOLUMEDOWN>, -+ <0xbe KEY_SEARCH>; -+ }; ++ rockchip,usercode = <0xff00>; ++ rockchip,key_table = ++ <0xeb KEY_POWER>, ++ <0xec KEY_COMPOSE>, ++ <0xfe KEY_BACK>, ++ <0xb7 KEY_HOME>, ++ <0xa3 KEY_WWW>, ++ <0xf4 KEY_VOLUMEUP>, ++ <0xa7 KEY_VOLUMEDOWN>, ++ <0xf8 KEY_ENTER>, ++ <0xfc KEY_UP>, ++ <0xfd KEY_DOWN>, ++ <0xf1 KEY_LEFT>, ++ <0xe5 KEY_RIGHT>; ++ }; + + ir_key3 { + rockchip,usercode = <0x1dcc>; @@ -950,23 +997,6 @@ index 0000000..7b82b78 + }; +}; + -+&gmac { -+ phy-supply = <&vcc_phy>; -+ phy-mode = "rgmii"; -+ clock_in_out = "input"; -+ snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>; -+ snps,reset-active-low; -+ snps,reset-delays-us = <0 10000 50000>; -+ assigned-clocks = <&cru SCLK_RMII_SRC>; -+ assigned-clock-parents = <&clkin_gmac>; -+ pinctrl-names = "default", "sleep"; -+ pinctrl-0 = <&rgmii_pins>; -+ pinctrl-1 = <&rgmii_sleep_pins>; -+ tx_delay = <0x28>; -+ rx_delay = <0x11>; -+ status = "okay"; -+}; -+ +&dsi { + status = "disabled"; +}; @@ -994,167 +1024,55 @@ index 0000000..7b82b78 + status = "okay"; +}; + -+&io_domains { -+ status = "okay"; -+ -+ bt656-supply = <&vcc_3v0>; /* bt656_gpio2ab_ms */ -+ audio-supply = <&vcc_3v0>; /* audio_gpio3d4a_ms */ -+ sdmmc-supply = <&vcc_sd>; /* sdmmc_gpio4b_ms */ -+ gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */ -+}; -+ -+&pcie_phy { ++&sdhci { ++ bus-width = <8>; ++ mmc-hs400-1_8v; ++ supports-emmc; ++ non-removable; ++ mmc-hs400-enhanced-strobe; + status = "okay"; +}; + -+&pcie0 { -+ ep-gpios = <&gpio4 27 GPIO_ACTIVE_HIGH>; -+ num-lanes = <4>; ++&sdmmc { ++ clock-frequency = <100000000>; ++ clock-freq-min-max = <100000 100000000>; ++ supports-sd; ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ num-slots = <1>; ++ //sd-uhs-sdr104; ++ vqmmc-supply = <&vcc_sd>; + pinctrl-names = "default"; -+ pinctrl-0 = <&pcie_clkreqnb_cpm>; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; ++ card-detect-delay = <800>; + status = "okay"; +}; + -+&pinctrl { -+ -+// es8388-pins { -+// ear_ctl_h: ear-ctl-h { -+// rockchip,pins = <0 2 RK_FUNC_GPIO &pcfg_pull_down>; -+// }; -+// }; -+ -+ -+ sdio0 { -+ sdio0_bus1: sdio0-bus1 { -+ rockchip,pins = -+ <2 20 RK_FUNC_1 &pcfg_pull_up_20ma>; -+ }; -+ -+ sdio0_bus4: sdio0-bus4 { -+ rockchip,pins = -+ <2 20 RK_FUNC_1 &pcfg_pull_up_20ma>, -+ <2 21 RK_FUNC_1 &pcfg_pull_up_20ma>, -+ <2 22 RK_FUNC_1 &pcfg_pull_up_20ma>, -+ <2 23 RK_FUNC_1 &pcfg_pull_up_20ma>; -+ }; -+ -+ sdio0_cmd: sdio0-cmd { -+ rockchip,pins = -+ <2 24 RK_FUNC_1 &pcfg_pull_up_20ma>; -+ }; -+ -+ sdio0_clk: sdio0-clk { -+ rockchip,pins = -+ <2 25 RK_FUNC_1 &pcfg_pull_none_20ma>; -+ }; -+ }; -+ -+ sdmmc { -+ sdmmc_bus1: sdmmc-bus1 { -+ rockchip,pins = -+ <4 8 RK_FUNC_1 &pcfg_pull_up_8ma>; -+ }; -+ -+ sdmmc_bus4: sdmmc-bus4 { -+ rockchip,pins = -+ <4 8 RK_FUNC_1 &pcfg_pull_up_8ma>, -+ <4 9 RK_FUNC_1 &pcfg_pull_up_8ma>, -+ <4 10 RK_FUNC_1 &pcfg_pull_up_8ma>, -+ <4 11 RK_FUNC_1 &pcfg_pull_up_8ma>; -+ }; -+ -+ sdmmc_clk: sdmmc-clk { -+ rockchip,pins = -+ <4 12 RK_FUNC_1 &pcfg_pull_none_18ma>; -+ }; -+ -+ sdmmc_cmd: sdmmc-cmd { -+ rockchip,pins = -+ <4 13 RK_FUNC_1 &pcfg_pull_up_8ma>; -+ }; -+ }; -+ -+ sdio-pwrseq { -+ wifi_enable_h: wifi-enable-h { -+ rockchip,pins = -+ <0 10 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ wireless-bluetooth { -+ uart0_gpios: uart0-gpios { -+ rockchip,pins = -+ <2 19 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ usb2 { -+ host_vbus_drv: host-vbus-drv { -+ rockchip,pins = -+ <4 25 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ otg_vbus_drv: otg-vbus-drv { -+ rockchip,pins = -+ <1 3 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ pcie { -+ pcie_drv: pcie-drv { -+ rockchip,pins = -+ <2 26 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ pmic { -+ pmic_int_l: pmic-int-l { -+ rockchip,pins = -+ <1 21 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ -+ vsel1_gpio: vsel1-gpio { -+ rockchip,pins = -+ <1 17 RK_FUNC_GPIO &pcfg_pull_down>; -+ }; -+ -+ vsel2_gpio: vsel2-gpio { -+ rockchip,pins = -+ <1 14 RK_FUNC_GPIO &pcfg_pull_down>; -+ }; -+ }; -+ -+ gmac { -+ rgmii_sleep_pins: rgmii-sleep-pins { -+ rockchip,pins = -+ <3 15 RK_FUNC_GPIO &pcfg_output_low>; -+ }; -+ }; -+ -+ i2c4 { -+ i2c4_xfer: i2c4-xfer { -+ rockchip,pins = -+ <1 12 RK_FUNC_1 &pcfg_pull_up>, -+ <1 11 RK_FUNC_1 &pcfg_pull_up>; -+ }; -+ }; -+ i2s0 { -+ i2s0_8ch_bus: i2s0-8ch-bus { -+ rockchip,pins = -+ <3 24 RK_FUNC_1 &pcfg_pull_none>, -+ <3 25 RK_FUNC_1 &pcfg_pull_none>, -+ <3 26 RK_FUNC_1 &pcfg_pull_none>, -+ <3 27 RK_FUNC_1 &pcfg_pull_none>, -+ <3 30 RK_FUNC_1 &pcfg_pull_none>, -+ <3 31 RK_FUNC_1 &pcfg_pull_none>; -+ }; -+ -+ i2s_8ch_mclk: i2s-8ch-mclk { -+ rockchip,pins = <4 0 RK_FUNC_1 &pcfg_pull_none>; -+ }; -+ }; ++&sdio0 { ++ clock-frequency = <100000000>; ++ clock-freq-min-max = <200000 100000000>; ++ supports-sdio; ++ bus-width = <4>; ++ disable-wp; ++ cap-sd-highspeed; ++ cap-sdio-irq; ++ keep-power-in-suspend; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; ++ sd-uhs-sdr104; ++ status = "okay"; +}; + ++&emmc_phy { ++ status = "okay"; ++}; ++ ++ +&pvtm { + status = "okay"; +}; @@ -1163,11 +1081,6 @@ index 0000000..7b82b78 + status = "okay"; +}; + -+&pmu_io_domains { -+ status = "okay"; -+ pmu1830-supply = <&vcc_3v0>; -+}; -+ +&rockchip_suspend { + status = "okay"; + rockchip,sleep-debug-en = <0>; diff --git a/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-cru-h.patch b/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-cru-h.patch new file mode 100644 index 000000000..3a1c345c6 --- /dev/null +++ b/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-cru-h.patch @@ -0,0 +1,11 @@ +--- a/include/dt-bindings/clock/rk3399-cru.h ++++ b/include/dt-bindings/clock/rk3399-cru.h +@@ -31,6 +31,7 @@ + + /* sclk gates (special clocks) */ + #define SCLK_I2SOUT_SRC 64 ++#define SCLK_I2S_8CH SCLK_I2SOUT_SRC + #define SCLK_I2C1 65 + #define SCLK_I2C2 66 + #define SCLK_I2C3 67 + diff --git a/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-es8323-c.patch b/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-es8323-c.patch new file mode 100644 index 000000000..cb28b280d --- /dev/null +++ b/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-es8323-c.patch @@ -0,0 +1,354 @@ +--- a/sound/soc/codecs/es8323.c ++++ b/sound/soc/codecs/es8323.c +@@ -33,17 +33,19 @@ + #include + #include + #include ++#include + #include "es8323.h" + + #define INVALID_GPIO -1 + + #define ES8323_CODEC_SET_SPK 1 + #define ES8323_CODEC_SET_HP 2 +- +-#define es8323_DEF_VOL 0x1b +- +-static int es8323_set_bias_level(struct snd_soc_codec *codec, +- enum snd_soc_bias_level level); ++#define MUTED_TYPE_OFF 0 ++#define MUTED_TYPE_ON 1 ++ ++#define es8323_DEF_VOL 0x1e ++ ++#define DBG(fmt, ...) printk("%s-%d:" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__) + + /* + * es8323 register cache +@@ -72,21 +74,41 @@ + unsigned int sysclk; + struct clk *mclk; + struct snd_pcm_hw_constraint_list *sysclk_constraints; ++ struct snd_soc_jack hp_jack; + + int spk_ctl_gpio; ++ int hp_ctl_gpio; + int hp_det_gpio; ++ int aux_det_gpio; ++ int aux_det_irq; + + bool muted; + bool hp_inserted; + bool spk_gpio_level; ++ bool hp_gpio_level; + bool hp_det_level; ++ bool line_in_status; + }; + + static struct es8323_priv *es8323_private; +-static int es8323_set_gpio(struct es8323_priv *es8323, int gpio, bool level) +-{ ++static struct snd_soc_codec *es8323_codec; ++ ++static int es8323_set_bias_level(struct snd_soc_codec *codec, ++ enum snd_soc_bias_level level); ++static void aux_det_work_func(struct work_struct *work); ++static DECLARE_DELAYED_WORK(aux_det_work, aux_det_work_func); ++ ++static int es8323_set_gpio(int gpio, bool level) ++{ ++ struct es8323_priv *es8323 = es8323_private; ++ + if (!es8323) { + return 0; ++ } ++ ++ if ((gpio & ES8323_CODEC_SET_HP) && es8323 ++ && es8323->hp_ctl_gpio != INVALID_GPIO) { ++ gpio_set_value(es8323->hp_ctl_gpio, level); + } + + if ((gpio & ES8323_CODEC_SET_SPK) && es8323 +@@ -97,29 +119,91 @@ + return 0; + } + +-static void es8323_get_hp_det_gpio(struct es8323_priv *es8323) +-{ +- if (es8323->hp_det_gpio == INVALID_GPIO) ++static void spk_detect_do_switch(int flags) ++{ ++ struct es8323_priv *es8323 = es8323_private; ++ ++ switch (flags) { ++ case MUTED_TYPE_ON: ++ if (es8323->hp_det_level == es8323->hp_inserted) { ++ es8323_set_gpio(ES8323_CODEC_SET_HP, es8323->hp_gpio_level); ++ es8323_set_gpio(ES8323_CODEC_SET_SPK, !es8323->spk_gpio_level); ++ } else { ++ es8323_set_gpio(ES8323_CODEC_SET_HP, !es8323->hp_gpio_level); ++ es8323_set_gpio(ES8323_CODEC_SET_SPK, es8323->spk_gpio_level); ++ } ++ break; ++ case MUTED_TYPE_OFF: ++ es8323_set_gpio(ES8323_CODEC_SET_HP, !es8323->hp_gpio_level); ++ es8323_set_gpio(ES8323_CODEC_SET_SPK, !es8323->spk_gpio_level); ++ break; ++ default: ++ break; ++ } ++} ++ ++static irqreturn_t hp_det_irq_handler(int irq, void *dev_id) ++{ ++ struct es8323_priv *es8323 = es8323_private; ++ ++ if (!gpio_get_value(es8323->hp_det_gpio)) { + es8323->hp_inserted = 0; +- else if (gpio_get_value(es8323->hp_det_gpio) == es8323->hp_det_level) ++ snd_soc_jack_report(&es8323->hp_jack, 0, SND_JACK_HEADPHONE); ++ } else { + es8323->hp_inserted = 1; ++ snd_soc_jack_report(&es8323->hp_jack, SND_JACK_HEADPHONE, SND_JACK_HEADPHONE); ++ } ++ ++ if (!es8323->line_in_status) ++ spk_detect_do_switch(!es8323->muted); + else +- es8323->hp_inserted = 0; +-} +- +-static void es8323_set_spk_gpio(struct es8323_priv *es8323) +-{ +- if (es8323->muted || es8323->hp_inserted) +- es8323_set_gpio(es8323, ES8323_CODEC_SET_SPK, !es8323->spk_gpio_level); +- else +- es8323_set_gpio(es8323, ES8323_CODEC_SET_SPK, es8323->spk_gpio_level); +-} +- +-static irqreturn_t hp_det_irq_handler(int irq, void *dev_id) ++ spk_detect_do_switch(1); ++ ++ return IRQ_HANDLED; ++} ++ ++static void es8323_set_linein(unsigned int flags) + { + struct es8323_priv *es8323 = es8323_private; +- es8323_get_hp_det_gpio(es8323); +- es8323_set_spk_gpio(es8323); ++ ++ if (flags) { ++ printk("ES8323 enter line in mode\n"); ++ ++ snd_soc_write(es8323_codec, 0x26, 0x00); ++ snd_soc_write(es8323_codec, 0x27, 0x40); ++ snd_soc_write(es8323_codec, 0x2a, 0x40); ++ snd_soc_write(es8323_codec, 0x0b, 0x02); ++ snd_soc_write(es8323_codec, 0x04, 0x0c); ++ ++ spk_detect_do_switch(1); ++ } else { ++ printk("ES8323 exit line in mode\n"); ++ ++ snd_soc_write(es8323_codec, 0x26, 0x12); ++ snd_soc_write(es8323_codec, 0x27, 0xb8); ++ snd_soc_write(es8323_codec, 0x2a, 0xb8); ++ snd_soc_write(es8323_codec, 0x0b, 0x82); ++ snd_soc_write(es8323_codec, 0x04, 0x3c); ++ ++ spk_detect_do_switch(!es8323->muted); ++ } ++} ++ ++static void aux_det_work_func(struct work_struct *work) ++{ ++ struct es8323_priv *es8323 = es8323_private; ++ ++ es8323->line_in_status = !gpio_get_value(es8323->aux_det_gpio); ++ ++ es8323_set_linein(es8323->line_in_status); ++ enable_irq(es8323->aux_det_irq); ++} ++ ++static irqreturn_t aux_det_isr(int irq, void *data) ++{ ++ disable_irq_nosync(irq); ++ schedule_delayed_work(&aux_det_work, msecs_to_jiffies(250)); ++ + return IRQ_HANDLED; + } + +@@ -673,7 +757,7 @@ + + es8323->muted = mute; + if (mute) { +- es8323_set_spk_gpio(es8323); ++ es8323_set_gpio(ES8323_CODEC_SET_SPK, !es8323->spk_gpio_level); + usleep_range(18000, 20000); + snd_soc_write(codec, ES8323_DACCONTROL3, 0x06); + } else { +@@ -681,9 +765,16 @@ + snd_soc_write(codec, 0x30, es8323_DEF_VOL); + snd_soc_write(codec, 0x31, es8323_DEF_VOL); + msleep(50); +- es8323_set_spk_gpio(es8323); ++ if (!es8323->hp_inserted) ++ es8323_set_gpio(ES8323_CODEC_SET_SPK, es8323->spk_gpio_level); + usleep_range(18000, 20000); + } ++ ++ if (!es8323->line_in_status) ++ spk_detect_do_switch(!es8323->muted); ++ else ++ spk_detect_do_switch(1); ++ + return 0; + } + +@@ -798,7 +889,31 @@ + return 0; + } + +-static struct snd_soc_codec *es8323_codec; ++static int es8323_hp_jack_change(struct notifier_block *nb, ++ unsigned long flags, void *data) ++{ ++ if ( !(int)flags ) ++ snd_soc_write(es8323_codec, 0x0b, 0x82); ++ else ++ snd_soc_write(es8323_codec, 0x0b, 0x02); ++ ++ return NOTIFY_OK; ++} ++ ++static struct notifier_block es8323_hp_jack_nb = { ++ .notifier_call = es8323_hp_jack_change, ++}; ++ ++static void es8323_jack_init(struct snd_soc_codec *codec) ++{ ++ struct es8323_priv *es8323 = es8323_private; ++ ++ snd_soc_card_jack_new(codec->component.card, ++ "Headphone Jack", SND_JACK_HEADPHONE, ++ &es8323->hp_jack, NULL, 0); ++ snd_soc_jack_notifier_register(&es8323->hp_jack, &es8323_hp_jack_nb); ++} ++ + static int es8323_probe(struct snd_soc_codec *codec) + { + struct es8323_priv *es8323 = snd_soc_codec_get_drvdata(codec); +@@ -821,7 +936,17 @@ + codec->hw_write = (hw_write_t) i2c_master_send; + codec->control_data = container_of(codec->dev, struct i2c_client, dev); + ++ ++ if (es8323->hp_det_gpio != INVALID_GPIO) { ++ if (gpio_get_value(es8323->hp_det_gpio) == es8323->hp_det_level) ++ es8323->hp_inserted = 1; ++ } ++ ++ if (es8323->aux_det_gpio != INVALID_GPIO) ++ schedule_delayed_work(&aux_det_work, msecs_to_jiffies(500)); ++ + es8323_codec = codec; ++ es8323_jack_init(codec); + ret = es8323_reset(codec); + if (ret < 0) { + dev_err(codec->dev, "Failed to issue reset\n"); +@@ -840,6 +965,7 @@ + snd_soc_write(codec, 0x09, 0x88); /* ADC L/R PGA = +24dB */ + snd_soc_write(codec, 0x0a, 0xf0); /* ADC INPUT=LIN2/RIN2 */ + snd_soc_write(codec, 0x0b, 0x82); /* ADC INPUT=LIN2/RIN2 */ ++ snd_soc_write(codec, 0x0b, 0x02); + snd_soc_write(codec, 0x0C, 0x4c); /* I2S-24BIT */ + snd_soc_write(codec, 0x0d, 0x02); /* MCLK/LRCK=256 */ + snd_soc_write(codec, 0x10, 0x00); /* ADC Left Volume=0db */ +@@ -890,6 +1016,8 @@ + .remove = es8323_remove, + .suspend = es8323_suspend, + .resume = es8323_resume, ++ .controls = es8323_snd_controls, ++ .num_controls = ARRAY_SIZE(es8323_snd_controls), + .set_bias_level = es8323_set_bias_level, + .reg_cache_size = ARRAY_SIZE(es8323_reg), + .reg_word_size = sizeof(u16), +@@ -930,7 +1058,7 @@ + } + + es8323_private = es8323; +- es8323->spk_ctl_gpio = of_get_named_gpio_flags(i2c->dev.of_node, "spk-con-gpio", 0, &flags); ++ es8323->spk_ctl_gpio = of_get_named_gpio_flags(i2c->dev.of_node, "spk-ctl-gpio", 0, &flags); + if (es8323->spk_ctl_gpio < 0) { + dev_info(&i2c->dev, "Can not read property spk_ctl_gpio\n"); + es8323->spk_ctl_gpio = INVALID_GPIO; +@@ -941,6 +1069,21 @@ + dev_err(&i2c->dev, "Failed to request spk_ctl_gpio\n"); + return ret; + } ++ es8323_set_gpio(ES8323_CODEC_SET_SPK, !es8323->spk_gpio_level); ++ } ++ ++ es8323->hp_ctl_gpio = of_get_named_gpio_flags(i2c->dev.of_node, "hp-ctl-gpio", 0, &flags); ++ if (es8323->hp_ctl_gpio < 0) { ++ dev_info(&i2c->dev, "Can not read property hp_ctl_gpio\n"); ++ es8323->hp_ctl_gpio = INVALID_GPIO; ++ } else { ++ es8323->hp_gpio_level = (flags & OF_GPIO_ACTIVE_LOW) ? 0 : 1; ++ ret = devm_gpio_request_one(&i2c->dev, es8323->hp_ctl_gpio, GPIOF_DIR_OUT, "hp_ctl_gpio"); ++ if (ret != 0) { ++ dev_err(&i2c->dev, "Failed to request hp_ctl_gpio\n"); ++ return ret; ++ } ++ es8323_set_gpio(ES8323_CODEC_SET_HP, !es8323->hp_gpio_level); + } + + es8323->hp_det_gpio = of_get_named_gpio_flags(i2c->dev.of_node, "hp-det-gpio", 0, &flags); +@@ -964,11 +1107,30 @@ + return ret; + } + } +- +- es8323_get_hp_det_gpio(es8323); +- } +- +- es8323_set_spk_gpio(es8323); ++ } ++ ++ es8323->aux_det_gpio = of_get_named_gpio_flags(i2c->dev.of_node, "aux-det-gpio", 0, &flags); ++ if (es8323->aux_det_gpio < 0) { ++ dev_info(&i2c->dev, "Can not read property aux_det_gpio\n"); ++ es8323->aux_det_gpio = INVALID_GPIO; ++ } else { ++ ret = devm_gpio_request_one(&i2c->dev, es8323->aux_det_gpio, GPIOF_IN, NULL); ++ if (ret != 0) { ++ dev_err(&i2c->dev, "Failed to request aux_det_gpio\n"); ++ return ret; ++ } ++ es8323->aux_det_irq = gpio_to_irq(es8323->aux_det_gpio); ++ ++ if (es8323->aux_det_irq) { ++ ret = devm_request_threaded_irq(&i2c->dev, es8323->aux_det_irq, NULL, aux_det_isr, ++ IRQ_TYPE_EDGE_BOTH | IRQF_ONESHOT, "ES8323", NULL); ++ if (ret < 0) { ++ dev_err(&i2c->dev, "request_irq failed: %d\n", ret); ++ return ret; ++ } ++ disable_irq(es8323->aux_det_irq); ++ } ++ } + + ret = snd_soc_register_codec(&i2c->dev, + &soc_codec_dev_es8323, +@@ -993,7 +1155,8 @@ + { + struct es8323_priv *es8323 = es8323_private; + +- es8323_set_gpio(es8323, ES8323_CODEC_SET_SPK, !es8323->spk_gpio_level); ++ es8323_set_gpio(ES8323_CODEC_SET_SPK, !es8323->spk_gpio_level); ++ es8323_set_gpio(ES8323_CODEC_SET_HP, !es8323->hp_gpio_level); + mdelay(20); + snd_soc_write(es8323_codec, ES8323_CONTROL2, 0x58); + snd_soc_write(es8323_codec, ES8323_CONTROL1, 0x32); + diff --git a/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-roc-pc-dts.patch b/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-roc-pc-dts.patch new file mode 100644 index 000000000..4945d12fa --- /dev/null +++ b/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-roc-pc-dts.patch @@ -0,0 +1,13 @@ +new file mode 120000 +index 00000000..5a62cd6b +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dts +@@ -0,0 +1,7 @@ ++/dts-v1/; ++#include "rk3399-roc-pc.dtsi" ++ ++/ { ++ model = "Firefly roc-rk3399-pc"; ++ compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399"; ++}; + diff --git a/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-roc-pc-dtsi.patch b/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-roc-pc-dtsi.patch new file mode 100644 index 000000000..7c8e0d3ff --- /dev/null +++ b/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-roc-pc-dtsi.patch @@ -0,0 +1,1443 @@ +new file mode 120000 +index 00000000..5a62cd6b +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi +@@ -0,0 +1,1437 @@ ++/dts-v1/; ++ ++#include ++#include ++#include "rk3399.dtsi" ++#include "rk3399-opp.dtsi" ++#include "rk3399-vop-clk-set.dtsi" ++ ++/ { ++ compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399"; ++ ++ /* first 64k(0xff8c0000~0xff8d0000) for ddr and suspend */ ++ ++ iram: sram@ff8d0000 { ++ compatible = "mmio-sram"; ++ reg = <0x0 0xff8d0000 0x0 0x20000>; /* 128k */ ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ hdmi_sound: hdmi-sound { ++ status = "disabled"; ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,name = "rockchip,hdmi"; ++ ++ simple-audio-card,cpu { ++ sound-dai = <&i2s2>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&hdmi>; ++ }; ++ }; ++ ++ vccadc_ref: vccadc-ref { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc1v8_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ }; ++ ++ vcc3v3_sys: vcc3v3-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vcc5v0_host: vcc5v0-host-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 0 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&host_vbus_drv>; ++ regulator-name = "vcc5v0_host"; ++ regulator-always-on; ++ }; ++ ++ vcc_hub_en: vcc_hub_en-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio2 4 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hub_rst_en>; ++ regulator-name = "vcc_hub_en"; ++ regulator-always-on; ++ }; ++ ++ vcc_wifi: vcc-wifi { ++ status = "okay"; ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_wifi"; ++ enable-active-high; ++ gpio = <&gpio4 27 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_wifi_h>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vcc_pcie: vcc-pcie { ++ status = "okay"; ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_pcie"; ++ enable-active-high; ++ gpio = <&gpio1 17 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_pcie_h>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vcc_chargen: vcc-chargen { ++ status = "disabled"; ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_chargen"; ++ enable-active-high; ++ gpio = <&gpio2 28 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_chargen_h>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vcc_sd: vcc-sd { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 30 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_sd_h>; ++ regulator-name = "vcc_sd"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vcc5v0_sys: vcc5v0-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc5v0_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vdd_log: vdd-log { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm2 0 25000 1>; ++ regulator-name = "vdd_log"; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1100000>; ++ regulator-always-on; ++ regulator-boot-on; ++ ++ /* for rockchip boot on */ ++ rockchip,pwm_id= <2>; ++ rockchip,pwm_voltage = <1000000>; ++ }; ++ ++ vcc_lcd: vcc-lcd-regulator { ++ compatible = "regulator-fixed"; ++ regulator-always-on; ++ regulator-boot-on; ++ enable-active-high; ++ gpio = <&gpio1 24 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&lcd_en>; ++ regulator-name = "vcc_lcd"; ++ }; ++ ++ sdio_pwrseq: sdio-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&rk808 1>; ++ clock-names = "ext_clock"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_enable_h>; ++ ++ /* ++ * On the module itself this is one of these (depending ++ * on the actual card populated): ++ * - SDIO_RESET_L_WL_REG_ON ++ * - PDN (power down when low) ++ */ ++ reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; /* GPIO0_B2 */ ++ }; ++ ++ wireless_wlan: wireless-wlan { ++ compatible = "wlan-platdata"; ++ rockchip,grf = <&grf>; ++ wifi_chip_type = "ap6354"; ++ sdio_vref = <1800>; ++ WIFI,host_wake_irq = <&gpio0 3 GPIO_ACTIVE_HIGH>; /* GPIO0_a3 */ ++ status = "disabled"; ++ }; ++ ++ wireless_bluetooth: wireless-bluetooth { ++ compatible = "bluetooth-platdata"; ++ //wifi-bt-power-toggle; ++ clocks = <&rk808 1>; ++ clock-name = "ext_clock"; ++ uart_rts_gpios = <&gpio2 19 GPIO_ACTIVE_LOW>; /* GPIO2_C3 */ ++ pinctrl-names = "default", "rts_gpio"; ++ pinctrl-0 = <&uart0_rts>; ++ pinctrl-1 = <&uart0_gpios>; ++ //BT,power_gpio = <&gpio3 19 GPIO_ACTIVE_HIGH>; /* GPIOx_xx */ ++ BT,reset_gpio = <&gpio0 9 GPIO_ACTIVE_HIGH>; /* GPIO0_B1 */ ++ BT,wake_gpio = <&gpio2 26 GPIO_ACTIVE_HIGH>; /* GPIO2_D2 */ ++ BT,wake_host_irq = <&gpio0 4 GPIO_ACTIVE_HIGH>; /* GPIO0_A4 */ ++ status = "disabled"; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ power { ++ label = "firefly:blue:power"; ++ linux,default-trigger = "ir-power-click"; ++ default-state = "on"; ++ gpios = <&gpio2 27 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default";pinctrl-0 = <&led_power>; ++ }; ++ user { ++ label = "firefly:yellow:user"; ++ linux,default-trigger = "ir-user-click"; ++ default-state = "off"; ++ gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&led_user>; ++ }; ++ }; ++ ++ adc-keys { ++ compatible = "adc-keys"; ++ io-channels = <&saradc 1>; ++ io-channel-names = "buttons"; ++ poll-interval = <300>; ++ keyup-threshold-microvolt = <1800000>; ++ ++ esc-key { ++ linux,code = ; ++ label = "esc"; ++ press-threshold-microvolt = <0>; ++ }; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ autorepeat; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwrbtn>; ++ ++ button@0 { ++ gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ label = "GPIO Key Power"; ++ linux,input-type = <1>; ++ gpio-key,wakeup = <1>; ++ debounce-interval = <100>; ++ }; ++ }; ++ ++ usb_charge: usb-charge { ++ compatible = "usb-ext-charge"; ++ status = "disabled"; ++ io-channels = <&saradc 0>; ++ extcon = <&fusb0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_chargen_h &bat_int_h &cur_ctl_h &poe_det_h>; ++ bat-int = <&gpio2 28 IRQ_TYPE_EDGE_RISING>; ++ charge-en-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; ++ cur-ctl-gpios = <&gpio3 26 GPIO_ACTIVE_HIGH>; ++ poe-state-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; ++ //cap-led-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ dp_sound: dp-sound { ++ status = "disabled"; ++ compatible = "rockchip,cdndp-sound"; ++ rockchip,cpu = <&spdif>; ++ rockchip,codec = <&cdn_dp 1>; ++ }; ++ ++ vcc_mipi: vcc_mipi { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 22 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&dvp_pwr>; ++ regulator-name = "vcc_mipi"; ++ status = "disabled"; ++ }; ++ ++ dvdd_1v2: dvdd-1v2 { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&cif_pwr>; ++ regulator-name = "dvdd_1v2"; ++ status = "disabled"; ++ }; ++}; ++ ++&cpu_l0 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l1 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l2 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l3 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_b0 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cpu_b1 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&display_subsystem { ++ status = "okay"; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&gmac { ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ clock_in_out = "input"; ++ snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 10000 50000>; ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmii_pins>; ++ tx_delay = <0x2e>; ++ rx_delay = <0x13>; ++ status = "okay"; ++}; ++ ++&gpu { ++ status = "okay"; ++ mali-supply = <&vdd_gpu>; ++}; ++ ++&hdmi { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ #sound-dai-cells = <0>; ++ status = "okay"; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <168>; ++ i2c-scl-falling-time-ns = <4>; ++ clock-frequency = <400000>; ++ ++ vdd_cpu_b: syr827@40 { ++ compatible = "silergy,syr827"; ++ reg = <0x40>; ++ vin-supply = <&vcc5v0_sys>; ++ regulator-compatible = "fan53555-reg"; ++ regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ pinctrl-0 = <&vsel1_gpio>; ++ vsel-gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-initial-state = <3>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_gpu: syr828@41 { ++ compatible = "silergy,syr828"; ++ reg = <0x41>; ++ vin-supply = <&vcc5v0_sys>; ++ pinctrl-0 = <&vsel2_gpio>; ++ vsel-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; ++ regulator-compatible = "fan53555-reg"; ++ regulator-name = "vdd_gpu"; ++ regulator-min-microvolt = <712500>; ++ regulator-max-microvolt = <1500000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-initial-state = <3>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ rk808: pmic@1b { ++ compatible = "rockchip,rk808"; ++ reg = <0x1b>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <21 IRQ_TYPE_LEVEL_LOW>; ++ pinctrl-names = "default"; ++ //pinctrl-0 = <&pmic_int_l &pmic_dvs2>; ++ pinctrl-0 = <&pmic_int_l &pmic_dvs2 &vcc_5v0_h>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ #clock-cells = <1>; ++ clock-output-names = "xin32k", "rk808-clkout2"; ++ ++ pmic,hold-gpio = <&gpio2 6 GPIO_ACTIVE_HIGH>; ++ ++ //vin-supply = <&sys_12v>; ++ ++ vcc1-supply = <&vcc3v3_sys>; ++ vcc2-supply = <&vcc3v3_sys>; ++ vcc3-supply = <&vcc3v3_sys>; ++ vcc4-supply = <&vcc3v3_sys>; ++ vcc6-supply = <&vcc3v3_sys>; ++ vcc7-supply = <&vcc3v3_sys>; ++ vcc8-supply = <&vcc3v3_sys>; ++ vcc9-supply = <&vcc3v3_sys>; ++ vcc10-supply = <&vcc3v3_sys>; ++ vcc11-supply = <&vcc3v3_sys>; ++ vcc12-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc1v8_pmu>; ++ ++ regulators { ++ vdd_center: DCDC_REG1 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-name = "vdd_center"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_cpu_l: DCDC_REG2 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-name = "vdd_cpu_l"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc_ddr"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_1v8: DCDC_REG4 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc_1v8"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcca1v8_codec: LDO_REG1 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcca1v8_codec"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc1v8_hdmi: LDO_REG2 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc1v8_hdmi"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc1v8_pmu: LDO_REG3 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc1v8_pmu"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vccio_sd: LDO_REG4 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vccio_sd"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcca3v0_codec: LDO_REG5 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcca3v0_codec"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_1v5: LDO_REG6 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ regulator-name = "vcc_1v5"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1500000>; ++ }; ++ }; ++ ++ vcca0v9_hdmi: LDO_REG7 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; ++ regulator-name = "vcca0v9_hdmi"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_3v0: LDO_REG8 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcc_3v0"; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v3_s3: SWITCH_REG1 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc3v3_s3"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc3v3_s0: SWITCH_REG2 { ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vcc3v3_s0"; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <300>; ++ i2c-scl-falling-time-ns = <15>; ++ clock-frequency = <100000>; ++ ++ ov13850: ov13850@36 { ++ compatible = "ovti,ov13850"; ++ status = "disabled"; ++ reg = <0x36>; ++ clocks = <&cru SCLK_CIF_OUT>; ++ clock-names = "xvclk"; ++ ++ /* conflict with csi-ctl-gpios */ ++ reset-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; /*GPIO0_B0 MIP_RST*/ ++ pwdn-gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>; /*GPIO2_A2 DVP_PDN0*/ ++ pinctrl-names = "rockchip,camera_default", "rockchip,camera_sleep"; ++ //pinctrl-0 = <&cif_clkout>; ++ pinctrl-0 = <&pwdn_cam0 &mipi_rst>; ++ pinctrl-1 = <&cam0_default_pins>; ++ pinctrl-2 = <&cam0_sleep_pins>; ++ rockchip,camera-module-index = <0>; ++ rockchip,camera-module-facing = "back"; ++ rockchip,camera-module-name = "CMK-CT0116"; ++ rockchip,camera-module-lens-name = "Largan-50013A1"; ++ ++ avdd-supply = <&vcc_mipi>; /* GPIO1_C6 CIF_PWR AGND*/ ++ dovdd-supply = <&vcc_mipi>; /* GPIO1_C6 CIF_PWR AGND */ ++ dvdd-supply = <&dvdd_1v2>; /* GPIO1_C7 DVP_PWR DVDD_1V2 */ ++ ++ port { ++ ucam_out0: endpoint { ++ remote-endpoint = <&mipi_in_ucam0>; ++ data-lanes = <1 2>; ++ }; ++ }; ++ }; ++ ++ ov13850_1: ov13850@46 { ++ compatible = "ovti,ov13850"; ++ status = "disabled"; ++ reg = <0x46>; ++ clocks = <&cru SCLK_CIF_OUT>; ++ clock-names = "xvclk"; ++ ++ /* conflict with csi-ctl-gpios */ ++ reset-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>; /*GPIO0_B0 MIP_RST*/ ++ pwdn-gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>; /*GPIO2_A3 DVP_PDN0*/ ++ pinctrl-names = "rockchip,camera_default", "rockchip,camera_sleep"; ++ //pinctrl-0 = <&cif_clkout>; ++ pinctrl-0 = <&pwdn_cam1>; ++ pinctrl-1 = <&cam0_default_pins>; ++ pinctrl-2 = <&cam0_sleep_pins>; ++ rockchip,camera-module-index = <1>; ++ rockchip,camera-module-facing = "back"; ++ rockchip,camera-module-name = "CMK-CT0116"; ++ rockchip,camera-module-lens-name = "Largan-50013A1"; ++ ++ avdd-supply = <&vcc_mipi>; /* VCC28_MIPI */ ++ dovdd-supply = <&vcc_mipi>; /* VCC18_MIPI */ ++ dvdd-supply = <&dvdd_1v2>; /* DVDD_1V2 */ ++ ++ port { ++ ucam_out1: endpoint { ++ remote-endpoint = <&mipi_in_ucam1>; ++ data-lanes = <1 2>; ++ }; ++ }; ++ }; ++}; ++ ++&i2c2 { ++ status = "okay"; ++ cw2015@62 { ++ status = "okay"; ++ compatible = "cw201x"; ++ reg = <0x62>; ++ bat_config_info = <0x15 0x42 0x60 0x59 0x52 0x58 0x4D 0x48 ++ 0x48 0x44 0x44 0x46 0x49 0x48 0x32 0x24 ++ 0x20 0x17 0x13 0x0F 0x19 0x3E 0x51 0x45 ++ 0x08 0x76 0x0B 0x85 0x0E 0x1C 0x2E 0x3E ++ 0x4D 0x52 0x52 0x57 0x3D 0x1B 0x6A 0x2D ++ 0x25 0x43 0x52 0x87 0x8F 0x91 0x94 0x52 ++ 0x82 0x8C 0x92 0x96 0xFF 0x7B 0xBB 0xCB ++ 0x2F 0x7D 0x72 0xA5 0xB5 0xC1 0x46 0xAE>; ++ monitor_sec = <5>; ++ virtual_power = <0>; ++ }; ++}; ++ ++&i2c4 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <475>; ++ i2c-scl-falling-time-ns = <26>; ++ ++ gsl3680: gsl3680@40 { ++ status = "disabled"; ++ compatible = "gslX680"; ++ reg = <0x40>; ++ screen_max_x = <1536>; ++ screen_max_y = <2048>; ++ revert_xy = <0>; ++ revert_x = <0>; ++ revert_y = <0>; ++ touch-gpio = <&gpio4 28 IRQ_TYPE_LEVEL_LOW>; ++ reset-gpio = <&gpio4 21 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ fusb1: fusb30x@22 { ++ compatible = "fairchild,fusb302"; ++ reg = <0x22>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb1_int &typec1_vbus_drv>; ++ int-n-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; ++ vbus-5v-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++}; ++ ++&i2c7 { ++ status = "okay"; ++ i2c-scl-rising-time-ns = <345>; ++ i2c-scl-falling-time-ns = <11>; ++ clock-frequency = <400000>; ++ ++ fusb0: fusb30x@22 { ++ compatible = "fairchild,fusb302"; ++ reg = <0x22>; ++ //charge-dev = <&mp8859>; ++ power-dev = <&mp8859>; ++ pinctrl-names = "default"; ++ //pinctrl-0 = <&fusb0_int &vcc_chargen_h>; ++ pinctrl-0 = <&fusb0_int>; ++ int-n-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; ++ //charge-en-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++ mp8859: mp8859@66 { ++ compatible = "mps,mp8859"; ++ reg = <0x66>; ++ status = "okay"; ++ extcon = <&fusb0>; ++ max-input-voltage = <15000000>; ++ max-input-current = <3000000>; ++ //charge-en-gpios =<&gpio0 1 GPIO_ACTIVE_HIGH>; ++ //pinctrl-names = "default"; ++ //pinctrl-0 = <&vcc_chargen_h>; ++ //mp,register-power-supply; ++ ++ regulators { ++ sys_12v: mp8859_dcdc1 { ++ regulator-name = "sys_12v"; ++ regulator-min-microvolt = <12300000>; ++ regulator-max-microvolt = <12300000>; ++ regulator-ramp-delay = <8000>; ++ //regulator-always-on; ++ //regulator-boot-on; ++ }; ++ }; ++ }; ++}; ++ ++&i2s1 { ++ status = "okay"; ++ rockchip,i2s-broken-burst-len; ++ rockchip,playback-channels = <2>; ++ rockchip,capture-channels = <2>; ++ #sound-dai-cells = <0>; ++ assigned-clocks = <&cru SCLK_I2S1_DIV>, <&cru SCLK_I2S_8CH>; ++ assigned-clock-parents = <&cru PLL_GPLL>, <&cru SCLK_I2S1_8CH>; ++}; ++ ++&i2s2 { ++ #sound-dai-cells = <0>; ++ dmas = <&dmac_bus 4>; ++ dma-names = "tx"; ++ status = "okay"; ++}; ++ ++&io_domains { ++ status = "okay"; ++ bt656-supply = <&vcc_3v0>; /* bt656_gpio2ab_ms */ ++ audio-supply = <&vcca1v8_codec>; /* audio_gpio3d4a_ms */ ++ sdmmc-supply = <&vccio_sd>; /* sdmmc_gpio4b_ms */ ++ gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */ ++}; ++ ++&pcie_phy { ++ status = "okay"; ++}; ++ ++&pcie0 { ++ ep-gpios = <&gpio4 25 GPIO_ACTIVE_HIGH>; ++ num-lanes = <4>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_clkreqn_cpm>; ++ status = "okay"; ++}; ++ ++&pmu_io_domains { ++ status = "okay"; ++ pmu1830-supply = <&vcc_3v0>; ++}; ++ ++/* HACK: keep MALI version on linux */ ++&gpu_power_model { ++ // for DDK r14. ++ voltage = <900>; ++ frequency = <500>; ++ static-power = <300>; ++ dynamic-power = <396>; ++}; ++ ++&pinctrl { ++ cam0 { ++ cif_pwr: cif-pwr { ++ rockchip,pins = <1 23 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ dvp_pwr: dvp-pwr { ++ rockchip,pins = <1 22 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ lcd-panel { ++ lcd_panel_reset: lcd-panel-reset { ++ rockchip,pins = <4 29 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ lcd_en: lcd-en { ++ rockchip,pins = <1 24 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ pmic { ++ vsel1_gpio: vsel1-gpio { ++ rockchip,pins = ++ <1 18 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ vsel2_gpio: vsel2-gpio { ++ rockchip,pins = ++ <1 14 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ leds { ++ led_power: led-power { ++ rockchip,pins = ++ <2 27 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ led_user: led-user { ++ rockchip,pins = ++ <0 13 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = ++ <1 21 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ pmic_dvs2: pmic-dvs2 { ++ rockchip,pins = ++ <1 18 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ ++ }; ++ ++ sdio-pwrseq { ++ wifi_enable_h: wifi-enable-h { ++ rockchip,pins = ++ <0 10 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ wireless-bluetooth { ++ uart0_gpios: uart0-gpios { ++ rockchip,pins = ++ <2 19 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ usb2 { ++ host_vbus_drv: host-vbus-drv { ++ rockchip,pins = ++ <1 0 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ hub_rst_en: hub-rst-en { ++ rockchip,pins = ++ <2 4 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ fusb30x { ++ fusb1_int: fusb1-int { ++ rockchip,pins = <1 1 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ fusb0_int: fusb0-int { ++ rockchip,pins = <1 2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ ++ typec1_vbus_drv: typec1-vbus-drv { ++ rockchip,pins = <1 13 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ vcc5v0_sys { ++ vcc_5v0_h: vcc-5v0-h { ++ rockchip,pins = <2 6 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ vcc_sd { ++ vcc_sd_h: vcc-sd-h { ++ rockchip,pins = <4 30 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ wifi { ++ vcc_wifi_h: vcc-wifi-h { ++ rockchip,pins = <4 27 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ pcie { ++ vcc_pcie_h: vcc-pcie-h { ++ rockchip,pins = <1 17 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ buttons { ++ pwrbtn: pwrbtn { ++ rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ chargen { ++ vcc_chargen_h: vcc-chargen-h { ++ rockchip,pins = <0 1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ bat_int_h: bat-int-h { ++ rockchip,pins = <2 28 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ cur_ctl_h: cur-ctl-h { ++ rockchip,pins = <3 26 RK_FUNC_GPIO &pcfg_pull_none_20ma>; ++ }; ++ poe_det_h: poe-det-h { ++ rockchip,pins = <0 12 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ cam_pins { ++ cam0_default_pins: cam0-default-pins { ++ rockchip,pins = ++ // <4 27 RK_FUNC_GPIO &pcfg_pull_none>, ++ <2 11 RK_FUNC_3 &pcfg_pull_none>; ++ }; ++ ++ cam0_sleep_pins: cam0-sleep-pins { ++ rockchip,pins = ++ <4 27 RK_FUNC_3 &pcfg_pull_none>, ++ <2 11 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ pwdn_cam0: pwdn-cma0 { ++ rockchip,pins = ++ <2 2 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ pwdn_cam1: pwdn-cma1 { ++ rockchip,pins = ++ <2 3 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ ++ mipi_rst: mipi-rst { ++ rockchip,pins = ++ <0 8 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++}; ++ ++&pwm0 { ++ status = "okay"; ++}; ++ ++&pwm1 { ++ status = "okay"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++ pinctrl-names = "active"; ++ pinctrl-0 = <&pwm2_pin_pull_down>; ++}; ++ ++&rkvdec { ++ status = "okay"; ++}; ++ ++&rockchip_suspend { ++ rockchip,power-ctrl = ++ <&gpio1 18 GPIO_ACTIVE_LOW>, ++ <&gpio1 14 GPIO_ACTIVE_HIGH>; ++}; ++ ++&dp_sound { ++ status = "okay"; ++}; ++ ++&hdmi_sound { ++ status = "okay"; ++}; ++ ++&cdn_dp { ++ status = "okay"; ++ extcon = <&fusb0 &fusb1>; ++ phys = <&tcphy0_dp &tcphy1_dp>; ++}; ++ ++&hdmi_in_vopl { ++ status = "disabled"; ++}; ++ ++&dp_in_vopb { ++ status = "okay"; ++}; ++ ++&dp_in_vopl { ++ status = "disabled"; ++}; ++ ++&saradc { ++ status = "okay"; ++ vref-supply = <&vccadc_ref>; ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ mmc-hs400-1_8v; ++ supports-emmc; ++ non-removable; ++ mmc-hs400-enhanced-strobe; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ clock-frequency = <100000000>; ++ clock-freq-min-max = <100000 100000000>; ++ supports-sd; ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ num-slots = <1>; ++ //sd-uhs-sdr104; ++ vqmmc-supply = <&vcc_sd>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; ++ card-detect-delay = <800>; ++ status = "okay"; ++}; ++ ++&sdio0 { ++ max-frequency = <100000000>; ++ supports-sdio; ++ bus-width = <4>; ++ disable-wp; ++ cap-sd-highspeed; ++ keep-power-in-suspend; ++ mmc-pwrseq = <&sdio_pwrseq>; ++ non-removable; ++ num-slots = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; ++ sd-uhs-sdr104; ++ status = "okay"; ++}; ++ ++&tcphy0 { ++ extcon = <&fusb0>; ++ status = "okay"; ++}; ++ ++&tcphy1 { ++ extcon = <&fusb1>; ++ status = "okay"; ++}; ++ ++&tsadc { ++ /* tshut mode 0:CRU 1:GPIO */ ++ rockchip,hw-tshut-mode = <1>; ++ /* tshut polarity 0:LOW 1:HIGH */ ++ rockchip,hw-tshut-polarity = <1>; ++ status = "okay"; ++}; ++ ++&u2phy0 { ++ status = "okay"; ++ extcon = <&fusb0>; ++ ++ u2phy0_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy0_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++ extcon = <&fusb1>; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy1_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_xfer &uart0_cts>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&usbdrd3_0 { ++ status = "okay"; ++ extcon = <&fusb0>; ++}; ++ ++&usbdrd3_1 { ++ status = "okay"; ++ extcon = <&fusb1>; ++}; ++ ++&usbdrd_dwc3_0 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_1 { ++ status = "okay"; ++ dr_mode = "host"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usb_host1_ehci { ++ status = "okay"; ++}; ++ ++&usb_host1_ohci { ++ status = "okay"; ++ pinctrl-names = "default"; ++}; ++ ++&spi1 { ++ status = "okay"; ++ max-freq = <48000000>; ++ dev-port = <0>; ++ ++ spidev0: spidev@00 { ++ status = "okay"; ++ //compatible = "linux,spidev"; ++ compatible = "jedec,spi-nor"; ++ reg = <0x00>; ++ spi-max-frequency = <48000000>; ++ }; ++}; ++ ++&pwm3 { ++ status = "okay"; ++ interrupts = ; ++ compatible = "rockchip,remotectl-pwm"; ++ pinctrl-names = "default"; ++ remote_pwm_id = <3>; ++ handle_cpu_id = <0>; ++ remote_support_psci = <1>; ++ ++ ir_key1 { ++ rockchip,usercode = <0x4040>; ++ rockchip,key_table = ++ <0xf2 KEY_REPLY>, ++ <0xba KEY_BACK>, ++ <0xf4 KEY_UP>, ++ <0xf1 KEY_DOWN>, ++ <0xef KEY_LEFT>, ++ <0xee KEY_RIGHT>, ++ <0xbd KEY_HOME>, ++ <0xea KEY_VOLUMEUP>, ++ <0xe3 KEY_VOLUMEDOWN>, ++ <0xe2 KEY_SEARCH>, ++ <0xb2 KEY_POWER>, ++ <0xbc KEY_MUTE>, ++ <0xec KEY_MENU>, ++ <0xbf 0x190>, ++ <0xe0 0x191>, ++ <0xe1 0x192>, ++ <0xe9 183>, ++ <0xe6 248>, ++ <0xe8 185>, ++ <0xe7 186>, ++ <0xf0 388>, ++ <0xbe 0x175>; ++ }; ++ ++ ir_key2 { ++ rockchip,usercode = <0xff00>; ++ rockchip,key_table = ++ <0xeb KEY_POWER>, ++ <0xec KEY_COMPOSE>, ++ <0xfe KEY_BACK>, ++ <0xb7 KEY_HOME>, ++ <0xa3 KEY_WWW>, ++ <0xf4 KEY_VOLUMEUP>, ++ <0xa7 KEY_VOLUMEDOWN>, ++ <0xf8 KEY_ENTER>, ++ <0xfc KEY_UP>, ++ <0xfd KEY_DOWN>, ++ <0xf1 KEY_LEFT>, ++ <0xe5 KEY_RIGHT>; ++ }; ++ ++ ir_key3 { ++ rockchip,usercode = <0x1dcc>; ++ rockchip,key_table = ++ <0xee KEY_REPLY>, ++ <0xf0 KEY_BACK>, ++ <0xf8 KEY_UP>, ++ <0xbb KEY_DOWN>, ++ <0xef KEY_LEFT>, ++ <0xed KEY_RIGHT>, ++ <0xfc KEY_HOME>, ++ <0xf1 KEY_VOLUMEUP>, ++ <0xfd KEY_VOLUMEDOWN>, ++ <0xb7 KEY_SEARCH>, ++ <0xff KEY_POWER>, ++ <0xf3 KEY_MUTE>, ++ <0xbf KEY_MENU>, ++ <0xf9 0x191>, ++ <0xf5 0x192>, ++ <0xb3 388>, ++ <0xbe KEY_1>, ++ <0xba KEY_2>, ++ <0xb2 KEY_3>, ++ <0xbd KEY_4>, ++ <0xf9 KEY_5>, ++ <0xb1 KEY_6>, ++ <0xfc KEY_7>, ++ <0xf8 KEY_8>, ++ <0xb0 KEY_9>, ++ <0xb6 KEY_0>, ++ <0xb5 KEY_BACKSPACE>; ++ }; ++}; ++ ++&vopb { ++ status = "okay"; ++}; ++&vopb_mmu { ++ status = "okay"; ++}; ++&vopl { ++ status = "okay"; ++}; ++&vopl_mmu { ++ status = "okay"; ++}; ++&vpu { ++ status = "okay"; ++}; ++ ++&spdif { ++ status = "okay"; ++ pinctrl-0 = <&spdif_bus_1>; ++ i2c-scl-rising-time-ns = <450>; ++ i2c-scl-falling-time-ns = <15>; ++ #sound-dai-cells = <0>; ++}; ++ ++&mipi_dphy_rx0 { ++ status = "okay"; ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mipi_in_ucam0: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&ucam_out0>; ++ data-lanes = <1 2>; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ dphy_rx0_out: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&isp0_mipi_in>; ++ }; ++ }; ++ }; ++}; ++ ++&mipi_dphy_tx1rx1 { ++ status = "disabled"; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mipi_in_ucam1: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&ucam_out1>; ++ data-lanes = <1 2>; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ dphy_tx1rx1_out: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&isp1_mipi_in>; ++ }; ++ }; ++ }; ++}; ++ ++ ++&rkisp1_0 { ++ status = "disabled"; ++ ++ port { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ isp0_mipi_in: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&dphy_rx0_out>; ++ }; ++ }; ++}; ++ ++&rkisp1_1 { ++ status = "disabled"; ++ ++ port { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ isp1_mipi_in: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&dphy_tx1rx1_out>; ++ }; ++ }; ++}; ++ ++&cam0_default_pins { ++ rockchip,pins = ++ <2 11 RK_FUNC_3 &pcfg_pull_none>; ++}; ++ ++&vcc_mipi { ++ status = "okay"; ++}; ++ ++&dvdd_1v2 { ++ status = "okay"; ++}; ++ ++&ov13850 { ++ status = "okay"; ++}; ++ ++&ov13850_1 { ++ status = "okay"; ++}; ++ ++&rkisp1_0 { ++ status = "okay"; ++}; ++ ++&mipi_dphy_rx0 { ++ status = "okay"; ++}; ++ ++&isp0_mmu { ++ status = "okay"; ++}; ++ ++&rkisp1_1 { ++ status = "okay"; ++}; ++ ++&mipi_dphy_tx1rx1 { ++ status = "okay"; ++}; ++ ++&isp1_mmu { ++ status = "okay"; ++}; + diff --git a/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-roc-pc-plus-dts.patch b/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-roc-pc-plus-dts.patch new file mode 100644 index 000000000..bcd1705df --- /dev/null +++ b/patch/kernel/archive/rockchip64-4.4/zzz-add-rk3399-roc-pc-plus-dts.patch @@ -0,0 +1,167 @@ +new file mode 120000 +index 00000000..5a62cd6b +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc-plus.dts +@@ -0,0 +1,161 @@ ++/dts-v1/; ++#include "rk3399-roc-pc.dtsi" ++ ++/ { ++ model = "Firefly roc-rk3399-pc PLUS"; ++ compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399"; ++ ++ es8388-sound { ++ status = "okay"; ++ compatible = "simple-audio-card"; ++ simple-audio-card,format = "i2s"; ++ simple-audio-card,name = "rockchip,es8388-codec"; ++ simple-audio-card,mclk-fs = <256>; ++ simple-audio-card,cpu { ++ sound-dai = <&i2s1>; ++ system-clock-frequency = <11289600>; ++ }; ++ simple-audio-card,codec { ++ sound-dai = <&es8388>; ++ system-clock-frequency = <11289600>; ++ }; ++ }; ++ /delete-node/ vcc_hub_en-regulator; ++ ++ fan_enable: fan-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fan_pin>; ++ regulator-name = "fan_enable"; ++ regulator-always-on; ++ }; ++}; ++ ++/* RTC */ ++ ++&rk808{ ++ rtc { ++ status = "disabled"; ++ }; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ hym8563: hym8563@51 { ++ compatible = "haoyu,hym8563"; ++ reg = <0x51>; ++ interrupt-parent = <&gpio0>; ++ interrupts = <5 IRQ_TYPE_EDGE_FALLING>; ++ pinctrl-names = "default"; ++ #clock-cells = <0>; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ }; ++}; ++ ++ ++&i2c4 { ++ /delete-node/ fusb30x@22; ++}; ++ ++&fusb0 { ++ fusb302,role = "ROLE_MODE_DFP"; ++ vbus-5v-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; ++}; ++ ++&cdn_dp { ++ status = "disabled"; ++ extcon = <&fusb0>; ++ phys = <&tcphy0_dp>; ++}; ++ ++&tcphy1 { ++ /delete-property/ extcon; ++}; ++ ++&u2phy1 { ++ /delete-property/ extcon; ++}; ++ ++&usbdrd3_1 { ++ /delete-property/ extcon; ++}; ++ ++ ++ ++ ++ ++ ++ ++&i2s1 { ++ status = "okay"; ++}; ++ ++&vcc_wifi { ++ gpio = <&gpio2 4 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc_wifi_h>; ++}; ++ ++&vcc_wifi_h { ++ rockchip,pins = <2 4 RK_FUNC_GPIO &pcfg_pull_none>; ++}; ++ ++&dmc { ++ status = "disabled"; ++}; ++ ++&rk808 { ++ /delete-property/ pmic,hold-gpio; ++}; ++ ++&i2c1 { ++ status = "okay"; ++ es8388: es8388@11 { ++ compatible = "everest,es8323"; ++ status = "okay"; ++ reg = <0x11>; ++ hp-det-gpio = <&gpio2 6 GPIO_ACTIVE_HIGH>; ++ hp-ctl-gpio = <&gpio0 2 GPIO_ACTIVE_HIGH>; ++ clock-names = "mclk"; ++ clocks = <&cru SCLK_I2S_8CH_OUT>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_8ch_mclk>; ++ pinctrl-1 = <&ear_ctl_h>; ++ #sound-dai-cells = <0>; ++ }; ++}; ++ ++ ++ ++ ++ ++ ++ ++&pinctrl { ++ es8388-pins { ++ ear_ctl_h: ear-ctl-h { ++ rockchip,pins = <0 2 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ fan { ++ fan_pin: fan-pin { ++ rockchip,pins = ++ <1 1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++}; ++ ++/* ++&fusb0 { ++ status = "disabled"; ++}; ++ ++ ++&fusb1 { ++ status = "disabled"; ++}; ++*/ + From b164fcf54b1429eac013bf07a792e49884cfc14d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Sun, 18 Apr 2021 22:49:30 +0200 Subject: [PATCH 14/18] Merge neofetch to armbian-config (#2499) --- lib/compilation.sh | 11 +++++-- patch/misc/add-armbian-neofetch.patch | 44 +++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 patch/misc/add-armbian-neofetch.patch diff --git a/lib/compilation.sh b/lib/compilation.sh index ca0c94b40..3aacbad71 100644 --- a/lib/compilation.sh +++ b/lib/compilation.sh @@ -637,6 +637,8 @@ compile_armbian-config() display_alert "Building deb" "armbian-config" "info" fetch_from_repo "https://github.com/armbian/config" "armbian-config" "branch:master" + fetch_from_repo "https://github.com/dylanaraps/neofetch" "neofetch" "tag:7.1.0" + fetch_from_repo "https://github.com/complexorganizations/wireguard-manager" "wireguard-manager" "tag:1.0.11" mkdir -p "${tmp_dir}/${armbian_config_dir}"/{DEBIAN,usr/bin/,usr/sbin/,usr/lib/armbian-config/} @@ -646,8 +648,8 @@ compile_armbian-config() Version: $REVISION Architecture: all Maintainer: $MAINTAINER <$MAINTAINERMAIL> - Replaces: armbian-bsp - Depends: bash, iperf3, psmisc, curl, bc, expect, dialog, pv, \ + Replaces: armbian-bsp, neofetch + Depends: bash, iperf3, psmisc, curl, bc, expect, dialog, pv, zip, \ debconf-utils, unzip, build-essential, html2text, apt-transport-https, html2text, dirmngr, software-properties-common, debconf, jq Recommends: armbian-bsp Suggests: libpam-google-authenticator, qrencode, network-manager, sunxi-tools @@ -656,6 +658,11 @@ compile_armbian-config() Description: Armbian configuration utility END + install -m 755 "${SRC}"/cache/sources/neofetch/neofetch "${tmp_dir}/${armbian_config_dir}"/usr/bin/neofetch + cd "${tmp_dir}/${armbian_config_dir}"/usr/bin/ + process_patch_file "${SRC}/patch/misc/add-armbian-neofetch.patch" "applying" + + install -m 755 "${SRC}"/cache/sources/wireguard-manager/wireguard-manager.sh "${tmp_dir}/${armbian_config_dir}"/usr/bin/wireguard-manager install -m 755 "${SRC}"/cache/sources/armbian-config/scripts/tv_grab_file "${tmp_dir}/${armbian_config_dir}"/usr/bin/tv_grab_file install -m 755 "${SRC}"/cache/sources/armbian-config/debian-config "${tmp_dir}/${armbian_config_dir}"/usr/sbin/armbian-config install -m 644 "${SRC}"/cache/sources/armbian-config/debian-config-jobs "${tmp_dir}/${armbian_config_dir}"/usr/lib/armbian-config/jobs.sh diff --git a/patch/misc/add-armbian-neofetch.patch b/patch/misc/add-armbian-neofetch.patch new file mode 100644 index 000000000..4207bc151 --- /dev/null +++ b/patch/misc/add-armbian-neofetch.patch @@ -0,0 +1,44 @@ +diff --git a/neofetch b/neofetch +index 1e4b564..f59eca6 100755 +--- a/neofetch ++++ b/neofetch +@@ -967,6 +967,10 @@ get_distro() { + *) distro="Red Star OS $(awk -F'[^0-9*]' '$0=$2' /etc/redstar-release)" + esac + ++ elif [[ -f /etc/armbian-release ]]; then ++ . /etc/armbian-release ++ distro="Armbian $DISTRIBUTION_CODENAME ($VERSION)" ++ + elif [[ -f /etc/siduction-version ]]; then + case $distro_shorthand in + on|tiny) distro=Siduction ;; +@@ -5336,6 +5340,28 @@ ${c1} + EOF + ;; + ++ "Armbian"*) ++ set_colors 1 1 ++ read -rd '' ascii_data <<'EOF' ++ ${c1} ++ ++ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ ++ ███████████████████████ ++ ▄▄██ ██▄▄ ++ ▄▄██ ███████████ ██▄▄ ++ ▄▄██ ██ ██ ██▄▄ ++ ▄▄██ ██ ██ ██▄▄ ++ ▄▄██ ██ ██ ██▄▄ ++ ▄▄██ █████████████ ██▄▄ ++ ▄▄██ ██ ██ ██▄▄ ++ ▄▄██ ██ ██ ██▄▄ ++ ▄▄██ ██ ██ ██▄▄ ++ ▄▄██ ██▄▄ ++ ███████████████████████ ++ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ ++EOF ++ ;; ++ + "alpine_small") + set_colors 4 7 + read -rd '' ascii_data <<'EOF' From b6697fdfc946a98e8e7d6561dce8c43171395f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Mon, 19 Apr 2021 18:57:41 +0200 Subject: [PATCH 15/18] - move new bsp packages to $release-utils (#2783) - remove creating repository for xenial and stretch - creating meta upgrade packages which are gone with apt autoremove Tested on focal and stretch Note: we lost BRANCH information from /etc/armbian-release file https://armbian.atlassian.net/browse/AR-731 --- lib/general.sh | 21 +++++++++++++++------ lib/image-helpers.sh | 3 +-- lib/main.sh | 9 +++------ lib/makeboarddeb.sh | 23 ++++++++++++++--------- 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/lib/general.sh b/lib/general.sh index 2803e6f30..636521473 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -657,7 +657,7 @@ adding_packages() # add if not already there aptly repo search -architectures="${arch}" -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${1}" 'Name (% '${name}'), $Version (='${version}'), $Architecture (='${arch}')' &>/dev/null if [[ $? -ne 0 ]]; then - display_alert "Adding" "$name" "info" + display_alert "Adding ${1}" "$name" "info" aptly repo add -force-replace=true -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${1}" "${f}" &>/dev/null fi done @@ -674,7 +674,7 @@ addtorepo() # parameter "delete" remove incoming directory if publishing is succesful # function: cycle trough distributions - local distributions=("xenial" "stretch" "bionic" "buster" "bullseye" "groovy" "focal" "hirsute" "sid") + local distributions=("bionic" "buster" "bullseye" "focal" "hirsute" "sid") local errors=0 for release in "${distributions[@]}"; do @@ -688,10 +688,11 @@ addtorepo() # create local repository if not exist if [[ -z $(aptly repo list -config="${SCRIPTPATH}config/${REPO_CONFIG}" -raw | awk '{print $(NF)}' | grep "${release}") ]]; then - display_alert "Creating section" "$release" "info" + display_alert "Creating section" "main" "info" aptly repo create -config="${SCRIPTPATH}config/${REPO_CONFIG}" -distribution="${release}" -component="main" \ -comment="Armbian main repository" "${release}" >/dev/null fi + if [[ -z $(aptly repo list -config="${SCRIPTPATH}config/${REPO_CONFIG}" -raw | awk '{print $(NF)}' | grep "^utils") ]]; then aptly repo create -config="${SCRIPTPATH}config/${REPO_CONFIG}" -distribution="${release}" -component="utils" \ -comment="Armbian utilities (backwards compatibility)" utils >/dev/null @@ -717,7 +718,7 @@ addtorepo() # adding main distribution packages if find "${DEB_STORAGE}/${release}" -maxdepth 1 -type f -name "*.deb" 2>/dev/null | grep -q .; then - adding_packages "$release" "/${release}" "release" + adding_packages "${release}-utils" "/${release}" "release packages" else # workaround - add dummy package to not trigger error aptly repo add -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}" "${SCRIPTPATH}config/templates/example.deb" >/dev/null @@ -746,9 +747,17 @@ addtorepo() desknum=$(aptly repo show -with-packages -config="${SCRIPTPATH}config/${REPO_CONFIG}" "${release}-utils" | grep "Number of packages" | awk '{print $NF}') if [ $mainnum -gt 0 ] && [ $utilnum -gt 0 ] && [ $desknum -gt 0 ]; then + # publish - aptly publish -force-overwrite -passphrase="${GPG_PASS}" -origin=Armbian -label=Armbian -config="${SCRIPTPATH}config/${REPO_CONFIG}" -component="${COMPONENTS// /,}" \ - --distribution="${release}" repo "${release}" ${COMPONENTS//main/} >/dev/null + aptly publish \ + -acquire-by-hash \ + -passphrase="${GPG_PASS}" \ + -origin="Armbian" \ + -label="Armbian" \ + -config="${SCRIPTPATH}config/${REPO_CONFIG}" \ + -component="${COMPONENTS// /,}" \ + -distribution="${release}" repo "${release}" ${COMPONENTS//main/} >/dev/null + if [[ $? -ne 0 ]]; then display_alert "Publishing failed" "${release}" "err" errors=$((errors+1)) diff --git a/lib/image-helpers.sh b/lib/image-helpers.sh index c2b5d64aa..29abc810c 100644 --- a/lib/image-helpers.sh +++ b/lib/image-helpers.sh @@ -94,9 +94,8 @@ write_uboot() chmod 700 ${TEMP_DIR} revision=${REVISION} if [[ -n $UPSTREM_VER ]]; then - DEB_BRANCH=${DEB_BRANCH/-/} revision=${UPSTREM_VER} - dpkg -x "${DEB_STORAGE}/linux-u-boot-${BOARD}-${DEB_BRANCH/-/}_${revision}_${ARCH}.deb" ${TEMP_DIR}/ + dpkg -x "${DEB_STORAGE}/linux-u-boot-${BOARD}-${BRANCH}_${revision}_${ARCH}.deb" ${TEMP_DIR}/ else dpkg -x "${DEB_STORAGE}/${CHOSEN_UBOOT}_${revision}_${ARCH}.deb" ${TEMP_DIR}/ fi diff --git a/lib/main.sh b/lib/main.sh index 850dcbcf0..67d542737 100644 --- a/lib/main.sh +++ b/lib/main.sh @@ -394,12 +394,9 @@ LINUXSOURCEDIR="${KERNELDIR}/$(branch2dir "${KERNELBRANCH}")" BSP_CLI_PACKAGE_NAME="armbian-bsp-cli-${BOARD}" BSP_CLI_PACKAGE_FULLNAME="${BSP_CLI_PACKAGE_NAME}_${REVISION}_${ARCH}" -# define package names -DEB_BRANCH=${BRANCH//default} -# if not empty, append hyphen -DEB_BRANCH=${DEB_BRANCH:+${DEB_BRANCH}-} -CHOSEN_UBOOT=linux-u-boot-${DEB_BRANCH}${BOARD} -CHOSEN_KERNEL=linux-image-${DEB_BRANCH}${LINUXFAMILY} + +CHOSEN_UBOOT=linux-u-boot-${BRANCH}-${BOARD} +CHOSEN_KERNEL=linux-image-${BRANCH}-${LINUXFAMILY} CHOSEN_ROOTFS=${BSP_CLI_PACKAGE_NAME} CHOSEN_DESKTOP=armbian-${RELEASE}-desktop-${DESKTOP_ENVIRONMENT} CHOSEN_KSRC=linux-source-${BRANCH}-${LINUXFAMILY} diff --git a/lib/makeboarddeb.sh b/lib/makeboarddeb.sh index 6e7db3736..8092a7d38 100644 --- a/lib/makeboarddeb.sh +++ b/lib/makeboarddeb.sh @@ -58,10 +58,10 @@ create_board_package() Section: kernel Priority: optional Depends: bash, linux-base, u-boot-tools, initramfs-tools, lsb-release, fping - Provides: armbian-bsp - Conflicts: armbian-bsp + Provides: linux-${RELEASE}-root-legacy-$BOARD, linux-${RELEASE}-root-current-$BOARD, linux-${RELEASE}-root-edge-$BOARD Suggests: armbian-config - Replaces: zram-config, base-files, armbian-tools-$RELEASE + Replaces: zram-config, base-files, armbian-tools-$RELEASE, linux-${RELEASE}-root-legacy-$BOARD (<< $REVISION~), linux-${RELEASE}-root-current-$BOARD (<< $REVISION~), linux-${RELEASE}-root-edge-$BOARD (<< $REVISION~) + Breaks: linux-${RELEASE}-root-legacy-$BOARD (<< $REVISION~), linux-${RELEASE}-root-current-$BOARD (<< $REVISION~), linux-${RELEASE}-root-edge-$BOARD (<< $REVISION~) Recommends: bsdutils, parted, util-linux, toilet Description: Tweaks for Armbian $RELEASE on $BOARD EOF @@ -281,7 +281,6 @@ fi DISTRIBUTION_STATUS=${DISTRIBUTION_STATUS} VERSION=$REVISION LINUXFAMILY=$LINUXFAMILY - BRANCH=$BRANCH ARCH=$ARCHITECTURE IMAGE_TYPE=$IMAGE_TYPE BOARD_TYPE=$BOARD_TYPE @@ -323,20 +322,26 @@ fi # Can be removed after 21.05 # create meta package for upgrade - local destination=${bsptempdir}/${RELEASE}/linux-${RELEASE}-root-${DEB_BRANCH}${BOARD}_${REVISION}_${ARCH} + local DEB_BRANCH=("legacy" "current" "edge") + for deb_branch in "${DEB_BRANCH[@]}"; do + + local destination=${bsptempdir}/${RELEASE}/linux-${RELEASE}-root-${deb_branch}-${BOARD}_${REVISION}_${ARCH} mkdir -p "${destination}"/DEBIAN cat <<-EOF > "${destination}"/DEBIAN/control - Package: linux-${RELEASE}-root-${DEB_BRANCH}${BOARD} + Package: linux-${RELEASE}-root-${deb_branch}-${BOARD} Version: $REVISION - Architecture: $ARCH + Architecture: all + Priority: optional + Section: oldlibs Maintainer: $MAINTAINER <$MAINTAINERMAIL> - Pre-Depends: ${BSP_CLI_PACKAGE_NAME} - Description: Meta package that upgrades to ${BSP_CLI_PACKAGE_NAME} + Depends: ${BSP_CLI_PACKAGE_NAME} + Description: This is a transitional package. It can safely be removed. EOF display_alert "Building meta package" "$CHOSEN_ROOTFS" "info" fakeroot dpkg-deb -b "${destination}" "${destination}.deb" >> "${DEST}"/debug/install.log 2>&1 mkdir -p "${DEB_STORAGE}/${RELEASE}/" rsync --remove-source-files -rq "${destination}.deb" "${DEB_STORAGE}/${RELEASE}/" + done # Can be removed after 21.05 # cleanup From 570bf71c5cd474db782c7a49bd71c0f684d659b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Mon, 19 Apr 2021 19:23:23 +0200 Subject: [PATCH 16/18] Stop building C1 images U-boot doesn't build anymore ... --- config/targets.conf | 5 ----- 1 file changed, 5 deletions(-) diff --git a/config/targets.conf b/config/targets.conf index f341ab2f2..0cfbc7b08 100644 --- a/config/targets.conf +++ b/config/targets.conf @@ -346,11 +346,6 @@ nanopia64 current buster desktop stable nanopia64 current focal cli stable yes -# Odroid C1 -odroidc1 current focal cli stable yes -odroidc1 current buster cli stable yes - - # Odroid C2 odroidc2 current buster cli stable yes odroidc2 current buster desktop stable yes xfce config_base browsers From bad7362189497fe61e60eab8df9ec373523742b5 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Mon, 19 Apr 2021 19:30:13 +0200 Subject: [PATCH 17/18] Remove deprecated upstream patches --- .../archive/sunxi-5.11/patch-5.11.11-12.patch | 8201 --------------- .../archive/sunxi-5.11/patch-5.11.12-13.patch | 1345 --- .../archive/sunxi-5.11/patch-5.11.13-14.patch | 8865 ----------------- 3 files changed, 18411 deletions(-) delete mode 100644 patch/kernel/archive/sunxi-5.11/patch-5.11.11-12.patch delete mode 100644 patch/kernel/archive/sunxi-5.11/patch-5.11.12-13.patch delete mode 100644 patch/kernel/archive/sunxi-5.11/patch-5.11.13-14.patch diff --git a/patch/kernel/archive/sunxi-5.11/patch-5.11.11-12.patch b/patch/kernel/archive/sunxi-5.11/patch-5.11.11-12.patch deleted file mode 100644 index 97b2867d4..000000000 --- a/patch/kernel/archive/sunxi-5.11/patch-5.11.11-12.patch +++ /dev/null @@ -1,8201 +0,0 @@ -diff --git a/Makefile b/Makefile -index 7578e0d9622fb..1e31504aab61b 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 11 --SUBLEVEL = 11 -+SUBLEVEL = 12 - EXTRAVERSION = - NAME = 💕 Valentine's Day Edition 💕 - -diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c -index 6f0648777d347..ee01f421e1e4c 100644 ---- a/arch/arm64/mm/mmu.c -+++ b/arch/arm64/mm/mmu.c -@@ -1445,14 +1445,30 @@ static void __remove_pgd_mapping(pgd_t *pgdir, unsigned long start, u64 size) - - static bool inside_linear_region(u64 start, u64 size) - { -+ u64 start_linear_pa = __pa(_PAGE_OFFSET(vabits_actual)); -+ u64 end_linear_pa = __pa(PAGE_END - 1); -+ -+ if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) { -+ /* -+ * Check for a wrap, it is possible because of randomized linear -+ * mapping the start physical address is actually bigger than -+ * the end physical address. In this case set start to zero -+ * because [0, end_linear_pa] range must still be able to cover -+ * all addressable physical addresses. -+ */ -+ if (start_linear_pa > end_linear_pa) -+ start_linear_pa = 0; -+ } -+ -+ WARN_ON(start_linear_pa > end_linear_pa); -+ - /* - * Linear mapping region is the range [PAGE_OFFSET..(PAGE_END - 1)] - * accommodating both its ends but excluding PAGE_END. Max physical - * range which can be mapped inside this linear mapping range, must - * also be derived from its end points. - */ -- return start >= __pa(_PAGE_OFFSET(vabits_actual)) && -- (start + size - 1) <= __pa(PAGE_END - 1); -+ return start >= start_linear_pa && (start + size - 1) <= end_linear_pa; - } - - int arch_add_memory(int nid, u64 start, u64 size, -diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c -index 764170fdb0f74..3805519a64697 100644 ---- a/arch/powerpc/platforms/pseries/lpar.c -+++ b/arch/powerpc/platforms/pseries/lpar.c -@@ -887,7 +887,8 @@ static long pSeries_lpar_hpte_updatepp(unsigned long slot, - - want_v = hpte_encode_avpn(vpn, psize, ssize); - -- flags = (newpp & 7) | H_AVPN; -+ flags = (newpp & (HPTE_R_PP | HPTE_R_N | HPTE_R_KEY_LO)) | H_AVPN; -+ flags |= (newpp & HPTE_R_KEY_HI) >> 48; - if (mmu_has_feature(MMU_FTR_KERNEL_RO)) - /* Move pp0 into bit 8 (IBM 55) */ - flags |= (newpp & HPTE_R_PP0) >> 55; -diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c -index ea4d6a660e0dc..e83e0891272d3 100644 ---- a/arch/powerpc/platforms/pseries/mobility.c -+++ b/arch/powerpc/platforms/pseries/mobility.c -@@ -452,12 +452,28 @@ static int do_suspend(void) - return ret; - } - -+/** -+ * struct pseries_suspend_info - State shared between CPUs for join/suspend. -+ * @counter: Threads are to increment this upon resuming from suspend -+ * or if an error is received from H_JOIN. The thread which performs -+ * the first increment (i.e. sets it to 1) is responsible for -+ * waking the other threads. -+ * @done: False if join/suspend is in progress. True if the operation is -+ * complete (successful or not). -+ */ -+struct pseries_suspend_info { -+ atomic_t counter; -+ bool done; -+}; -+ - static int do_join(void *arg) - { -- atomic_t *counter = arg; -+ struct pseries_suspend_info *info = arg; -+ atomic_t *counter = &info->counter; - long hvrc; - int ret; - -+retry: - /* Must ensure MSR.EE off for H_JOIN. */ - hard_irq_disable(); - hvrc = plpar_hcall_norets(H_JOIN); -@@ -473,8 +489,20 @@ static int do_join(void *arg) - case H_SUCCESS: - /* - * The suspend is complete and this cpu has received a -- * prod. -+ * prod, or we've received a stray prod from unrelated -+ * code (e.g. paravirt spinlocks) and we need to join -+ * again. -+ * -+ * This barrier orders the return from H_JOIN above vs -+ * the load of info->done. It pairs with the barrier -+ * in the wakeup/prod path below. - */ -+ smp_mb(); -+ if (READ_ONCE(info->done) == false) { -+ pr_info_ratelimited("premature return from H_JOIN on CPU %i, retrying", -+ smp_processor_id()); -+ goto retry; -+ } - ret = 0; - break; - case H_BAD_MODE: -@@ -488,6 +516,13 @@ static int do_join(void *arg) - - if (atomic_inc_return(counter) == 1) { - pr_info("CPU %u waking all threads\n", smp_processor_id()); -+ WRITE_ONCE(info->done, true); -+ /* -+ * This barrier orders the store to info->done vs subsequent -+ * H_PRODs to wake the other CPUs. It pairs with the barrier -+ * in the H_SUCCESS case above. -+ */ -+ smp_mb(); - prod_others(); - } - /* -@@ -535,11 +570,16 @@ static int pseries_suspend(u64 handle) - int ret; - - while (true) { -- atomic_t counter = ATOMIC_INIT(0); -+ struct pseries_suspend_info info; - unsigned long vasi_state; - int vasi_err; - -- ret = stop_machine(do_join, &counter, cpu_online_mask); -+ info = (struct pseries_suspend_info) { -+ .counter = ATOMIC_INIT(0), -+ .done = false, -+ }; -+ -+ ret = stop_machine(do_join, &info, cpu_online_mask); - if (ret == 0) - break; - /* -diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h -index 824b2c9da75bd..f944062c9d990 100644 ---- a/arch/riscv/include/asm/uaccess.h -+++ b/arch/riscv/include/asm/uaccess.h -@@ -306,7 +306,9 @@ do { \ - * data types like structures or arrays. - * - * @ptr must have pointer-to-simple-variable type, and @x must be assignable -- * to the result of dereferencing @ptr. -+ * to the result of dereferencing @ptr. The value of @x is copied to avoid -+ * re-ordering where @x is evaluated inside the block that enables user-space -+ * access (thus bypassing user space protection if @x is a function). - * - * Caller must check the pointer with access_ok() before calling this - * function. -@@ -316,12 +318,13 @@ do { \ - #define __put_user(x, ptr) \ - ({ \ - __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ -+ __typeof__(*__gu_ptr) __val = (x); \ - long __pu_err = 0; \ - \ - __chk_user_ptr(__gu_ptr); \ - \ - __enable_user_access(); \ -- __put_user_nocheck(x, __gu_ptr, __pu_err); \ -+ __put_user_nocheck(__val, __gu_ptr, __pu_err); \ - __disable_user_access(); \ - \ - __pu_err; \ -diff --git a/arch/s390/include/asm/vdso/data.h b/arch/s390/include/asm/vdso/data.h -index 7b3cdb4a5f481..73ee891426662 100644 ---- a/arch/s390/include/asm/vdso/data.h -+++ b/arch/s390/include/asm/vdso/data.h -@@ -6,7 +6,7 @@ - #include - - struct arch_vdso_data { -- __u64 tod_steering_delta; -+ __s64 tod_steering_delta; - __u64 tod_steering_end; - }; - -diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c -index c59cb44fbb7d7..c71c4c12c9d30 100644 ---- a/arch/s390/kernel/time.c -+++ b/arch/s390/kernel/time.c -@@ -398,6 +398,7 @@ static void clock_sync_global(unsigned long long delta) - tod_steering_delta); - tod_steering_end = now + (abs(tod_steering_delta) << 15); - vdso_data->arch_data.tod_steering_end = tod_steering_end; -+ vdso_data->arch_data.tod_steering_delta = tod_steering_delta; - - /* Update LPAR offset. */ - if (ptff_query(PTFF_QTO) && ptff(&qto, sizeof(qto), PTFF_QTO) == 0) -diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h -index c0538f82c9a22..57ef2094af93e 100644 ---- a/arch/x86/include/asm/smp.h -+++ b/arch/x86/include/asm/smp.h -@@ -132,6 +132,7 @@ void native_play_dead(void); - void play_dead_common(void); - void wbinvd_on_cpu(int cpu); - int wbinvd_on_all_cpus(void); -+bool wakeup_cpu0(void); - - void native_smp_send_reschedule(int cpu); - void native_send_call_func_ipi(const struct cpumask *mask); -diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c -index 7bdc0239a9435..14cd3186dc77d 100644 ---- a/arch/x86/kernel/acpi/boot.c -+++ b/arch/x86/kernel/acpi/boot.c -@@ -1554,10 +1554,18 @@ void __init acpi_boot_table_init(void) - /* - * Initialize the ACPI boot-time table parser. - */ -- if (acpi_table_init()) { -+ if (acpi_locate_initial_tables()) - disable_acpi(); -- return; -- } -+ else -+ acpi_reserve_initial_tables(); -+} -+ -+int __init early_acpi_boot_init(void) -+{ -+ if (acpi_disabled) -+ return 1; -+ -+ acpi_table_init_complete(); - - acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf); - -@@ -1570,18 +1578,9 @@ void __init acpi_boot_table_init(void) - } else { - printk(KERN_WARNING PREFIX "Disabling ACPI support\n"); - disable_acpi(); -- return; -+ return 1; - } - } --} -- --int __init early_acpi_boot_init(void) --{ -- /* -- * If acpi_disabled, bail out -- */ -- if (acpi_disabled) -- return 1; - - /* - * Process the Multiple APIC Description Table (MADT), if present -diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c -index 740f3bdb3f619..df964571a6b43 100644 ---- a/arch/x86/kernel/setup.c -+++ b/arch/x86/kernel/setup.c -@@ -1046,6 +1046,9 @@ void __init setup_arch(char **cmdline_p) - - cleanup_highmap(); - -+ /* Look for ACPI tables and reserve memory occupied by them. */ -+ acpi_boot_table_init(); -+ - memblock_set_current_limit(ISA_END_ADDRESS); - e820__memblock_setup(); - -@@ -1137,11 +1140,6 @@ void __init setup_arch(char **cmdline_p) - - early_platform_quirks(); - -- /* -- * Parse the ACPI tables for possible boot-time SMP configuration. -- */ -- acpi_boot_table_init(); -- - early_acpi_boot_init(); - - initmem_init(); -diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c -index 02813a7f3a7cf..f877150a91da1 100644 ---- a/arch/x86/kernel/smpboot.c -+++ b/arch/x86/kernel/smpboot.c -@@ -1659,7 +1659,7 @@ void play_dead_common(void) - local_irq_disable(); - } - --static bool wakeup_cpu0(void) -+bool wakeup_cpu0(void) - { - if (smp_processor_id() == 0 && enable_start_cpu0) - return true; -diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c -index d36773c7b5359..0b3bf6e2aeb95 100644 ---- a/arch/x86/kvm/svm/nested.c -+++ b/arch/x86/kvm/svm/nested.c -@@ -246,11 +246,18 @@ static bool nested_vmcb_check_controls(struct vmcb_control_area *control) - return true; - } - --static bool nested_vmcb_checks(struct vcpu_svm *svm, struct vmcb *vmcb12) -+static bool nested_vmcb_check_save(struct vcpu_svm *svm, struct vmcb *vmcb12) - { - struct kvm_vcpu *vcpu = &svm->vcpu; - bool vmcb12_lma; - -+ /* -+ * FIXME: these should be done after copying the fields, -+ * to avoid TOC/TOU races. For these save area checks -+ * the possible damage is limited since kvm_set_cr0 and -+ * kvm_set_cr4 handle failure; EFER_SVME is an exception -+ * so it is force-set later in nested_prepare_vmcb_save. -+ */ - if ((vmcb12->save.efer & EFER_SVME) == 0) - return false; - -@@ -271,7 +278,7 @@ static bool nested_vmcb_checks(struct vcpu_svm *svm, struct vmcb *vmcb12) - if (!kvm_is_valid_cr4(&svm->vcpu, vmcb12->save.cr4)) - return false; - -- return nested_vmcb_check_controls(&vmcb12->control); -+ return true; - } - - static void load_nested_vmcb_control(struct vcpu_svm *svm, -@@ -396,7 +403,14 @@ static void nested_prepare_vmcb_save(struct vcpu_svm *svm, struct vmcb *vmcb12) - svm->vmcb->save.gdtr = vmcb12->save.gdtr; - svm->vmcb->save.idtr = vmcb12->save.idtr; - kvm_set_rflags(&svm->vcpu, vmcb12->save.rflags | X86_EFLAGS_FIXED); -- svm_set_efer(&svm->vcpu, vmcb12->save.efer); -+ -+ /* -+ * Force-set EFER_SVME even though it is checked earlier on the -+ * VMCB12, because the guest can flip the bit between the check -+ * and now. Clearing EFER_SVME would call svm_free_nested. -+ */ -+ svm_set_efer(&svm->vcpu, vmcb12->save.efer | EFER_SVME); -+ - svm_set_cr0(&svm->vcpu, vmcb12->save.cr0); - svm_set_cr4(&svm->vcpu, vmcb12->save.cr4); - svm->vmcb->save.cr2 = svm->vcpu.arch.cr2 = vmcb12->save.cr2; -@@ -454,7 +468,6 @@ int enter_svm_guest_mode(struct vcpu_svm *svm, u64 vmcb12_gpa, - int ret; - - svm->nested.vmcb12_gpa = vmcb12_gpa; -- load_nested_vmcb_control(svm, &vmcb12->control); - nested_prepare_vmcb_save(svm, vmcb12); - nested_prepare_vmcb_control(svm); - -@@ -501,7 +514,10 @@ int nested_svm_vmrun(struct vcpu_svm *svm) - if (WARN_ON_ONCE(!svm->nested.initialized)) - return -EINVAL; - -- if (!nested_vmcb_checks(svm, vmcb12)) { -+ load_nested_vmcb_control(svm, &vmcb12->control); -+ -+ if (!nested_vmcb_check_save(svm, vmcb12) || -+ !nested_vmcb_check_controls(&svm->nested.ctl)) { - vmcb12->control.exit_code = SVM_EXIT_ERR; - vmcb12->control.exit_code_hi = 0; - vmcb12->control.exit_info_1 = 0; -@@ -1207,6 +1223,8 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, - */ - if (!(save->cr0 & X86_CR0_PG)) - goto out_free; -+ if (!(save->efer & EFER_SVME)) -+ goto out_free; - - /* - * All checks done, we can enter guest mode. L1 control fields -diff --git a/arch/xtensa/kernel/coprocessor.S b/arch/xtensa/kernel/coprocessor.S -index c426b846beefb..45cc0ae0af6f9 100644 ---- a/arch/xtensa/kernel/coprocessor.S -+++ b/arch/xtensa/kernel/coprocessor.S -@@ -99,37 +99,6 @@ - LOAD_CP_REGS_TAB(6) - LOAD_CP_REGS_TAB(7) - --/* -- * coprocessor_flush(struct thread_info*, index) -- * a2 a3 -- * -- * Save coprocessor registers for coprocessor 'index'. -- * The register values are saved to or loaded from the coprocessor area -- * inside the task_info structure. -- * -- * Note that this function doesn't update the coprocessor_owner information! -- * -- */ -- --ENTRY(coprocessor_flush) -- -- /* reserve 4 bytes on stack to save a0 */ -- abi_entry(4) -- -- s32i a0, a1, 0 -- movi a0, .Lsave_cp_regs_jump_table -- addx8 a3, a3, a0 -- l32i a4, a3, 4 -- l32i a3, a3, 0 -- add a2, a2, a4 -- beqz a3, 1f -- callx0 a3 --1: l32i a0, a1, 0 -- -- abi_ret(4) -- --ENDPROC(coprocessor_flush) -- - /* - * Entry condition: - * -@@ -245,6 +214,39 @@ ENTRY(fast_coprocessor) - - ENDPROC(fast_coprocessor) - -+ .text -+ -+/* -+ * coprocessor_flush(struct thread_info*, index) -+ * a2 a3 -+ * -+ * Save coprocessor registers for coprocessor 'index'. -+ * The register values are saved to or loaded from the coprocessor area -+ * inside the task_info structure. -+ * -+ * Note that this function doesn't update the coprocessor_owner information! -+ * -+ */ -+ -+ENTRY(coprocessor_flush) -+ -+ /* reserve 4 bytes on stack to save a0 */ -+ abi_entry(4) -+ -+ s32i a0, a1, 0 -+ movi a0, .Lsave_cp_regs_jump_table -+ addx8 a3, a3, a0 -+ l32i a4, a3, 4 -+ l32i a3, a3, 0 -+ add a2, a2, a4 -+ beqz a3, 1f -+ callx0 a3 -+1: l32i a0, a1, 0 -+ -+ abi_ret(4) -+ -+ENDPROC(coprocessor_flush) -+ - .data - - ENTRY(coprocessor_owner) -diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c -index 7666408ce12a4..95a74890c7e99 100644 ---- a/arch/xtensa/mm/fault.c -+++ b/arch/xtensa/mm/fault.c -@@ -112,8 +112,11 @@ good_area: - */ - fault = handle_mm_fault(vma, address, flags, regs); - -- if (fault_signal_pending(fault, regs)) -+ if (fault_signal_pending(fault, regs)) { -+ if (!user_mode(regs)) -+ goto bad_page_fault; - return; -+ } - - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) -diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c -index d93e400940a31..768a6b4d23680 100644 ---- a/drivers/acpi/processor_idle.c -+++ b/drivers/acpi/processor_idle.c -@@ -29,6 +29,7 @@ - */ - #ifdef CONFIG_X86 - #include -+#include - #endif - - #define _COMPONENT ACPI_PROCESSOR_COMPONENT -@@ -541,6 +542,12 @@ static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) - wait_for_freeze(); - } else - return -ENODEV; -+ -+#if defined(CONFIG_X86) && defined(CONFIG_HOTPLUG_CPU) -+ /* If NMI wants to wake up CPU0, start CPU0. */ -+ if (wakeup_cpu0()) -+ start_cpu0(); -+#endif - } - - /* Never reached */ -diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c -index a4fdf61b06444..239eeeafc62f6 100644 ---- a/drivers/acpi/scan.c -+++ b/drivers/acpi/scan.c -@@ -1669,6 +1669,8 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, - device_initialize(&device->dev); - dev_set_uevent_suppress(&device->dev, true); - acpi_init_coherency(device); -+ /* Assume there are unmet deps to start with. */ -+ device->dep_unmet = 1; - } - - void acpi_device_add_finalize(struct acpi_device *device) -@@ -1934,6 +1936,8 @@ static void acpi_scan_dep_init(struct acpi_device *adev) - { - struct acpi_dep_data *dep; - -+ adev->dep_unmet = 0; -+ - mutex_lock(&acpi_dep_list_lock); - - list_for_each_entry(dep, &acpi_dep_list, node) { -@@ -1981,7 +1985,13 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, bool check_dep, - return AE_CTRL_DEPTH; - - acpi_scan_init_hotplug(device); -- if (!check_dep) -+ /* -+ * If check_dep is true at this point, the device has no dependencies, -+ * or the creation of the device object would have been postponed above. -+ */ -+ if (check_dep) -+ device->dep_unmet = 0; -+ else - acpi_scan_dep_init(device); - - out: -diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c -index e48690a006a4e..9d581045acff0 100644 ---- a/drivers/acpi/tables.c -+++ b/drivers/acpi/tables.c -@@ -780,7 +780,7 @@ acpi_status acpi_os_table_override(struct acpi_table_header *existing_table, - } - - /* -- * acpi_table_init() -+ * acpi_locate_initial_tables() - * - * find RSDP, find and checksum SDT/XSDT. - * checksum all tables, print SDT/XSDT -@@ -788,7 +788,7 @@ acpi_status acpi_os_table_override(struct acpi_table_header *existing_table, - * result: sdt_entry[] is initialized - */ - --int __init acpi_table_init(void) -+int __init acpi_locate_initial_tables(void) - { - acpi_status status; - -@@ -803,9 +803,45 @@ int __init acpi_table_init(void) - status = acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); - if (ACPI_FAILURE(status)) - return -EINVAL; -- acpi_table_initrd_scan(); - -+ return 0; -+} -+ -+void __init acpi_reserve_initial_tables(void) -+{ -+ int i; -+ -+ for (i = 0; i < ACPI_MAX_TABLES; i++) { -+ struct acpi_table_desc *table_desc = &initial_tables[i]; -+ u64 start = table_desc->address; -+ u64 size = table_desc->length; -+ -+ if (!start || !size) -+ break; -+ -+ pr_info("Reserving %4s table memory at [mem 0x%llx-0x%llx]\n", -+ table_desc->signature.ascii, start, start + size - 1); -+ -+ memblock_reserve(start, size); -+ } -+} -+ -+void __init acpi_table_init_complete(void) -+{ -+ acpi_table_initrd_scan(); - check_multiple_madt(); -+} -+ -+int __init acpi_table_init(void) -+{ -+ int ret; -+ -+ ret = acpi_locate_initial_tables(); -+ if (ret) -+ return ret; -+ -+ acpi_table_init_complete(); -+ - return 0; - } - -diff --git a/drivers/base/dd.c b/drivers/base/dd.c -index 9179825ff646f..e2cf3b29123e8 100644 ---- a/drivers/base/dd.c -+++ b/drivers/base/dd.c -@@ -97,6 +97,9 @@ static void deferred_probe_work_func(struct work_struct *work) - - get_device(dev); - -+ kfree(dev->p->deferred_probe_reason); -+ dev->p->deferred_probe_reason = NULL; -+ - /* - * Drop the mutex while probing each device; the probe path may - * manipulate the deferred list -diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c -index 5ef67bacb585e..d6d73ff94e88f 100644 ---- a/drivers/base/power/runtime.c -+++ b/drivers/base/power/runtime.c -@@ -1690,8 +1690,8 @@ void pm_runtime_get_suppliers(struct device *dev) - device_links_read_lock_held()) - if (link->flags & DL_FLAG_PM_RUNTIME) { - link->supplier_preactivated = true; -- refcount_inc(&link->rpm_active); - pm_runtime_get_sync(link->supplier); -+ refcount_inc(&link->rpm_active); - } - - device_links_read_unlock(idx); -@@ -1704,6 +1704,8 @@ void pm_runtime_get_suppliers(struct device *dev) - void pm_runtime_put_suppliers(struct device *dev) - { - struct device_link *link; -+ unsigned long flags; -+ bool put; - int idx; - - idx = device_links_read_lock(); -@@ -1712,7 +1714,11 @@ void pm_runtime_put_suppliers(struct device *dev) - device_links_read_lock_held()) - if (link->supplier_preactivated) { - link->supplier_preactivated = false; -- if (refcount_dec_not_one(&link->rpm_active)) -+ spin_lock_irqsave(&dev->power.lock, flags); -+ put = pm_runtime_status_suspended(dev) && -+ refcount_dec_not_one(&link->rpm_active); -+ spin_unlock_irqrestore(&dev->power.lock, flags); -+ if (put) - pm_runtime_put(link->supplier); - } - -diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c -index 0a6438cbb3f30..e7a9561a826d3 100644 ---- a/drivers/extcon/extcon.c -+++ b/drivers/extcon/extcon.c -@@ -1241,6 +1241,7 @@ int extcon_dev_register(struct extcon_dev *edev) - sizeof(*edev->nh), GFP_KERNEL); - if (!edev->nh) { - ret = -ENOMEM; -+ device_unregister(&edev->dev); - goto err_dev; - } - -diff --git a/drivers/firewire/nosy.c b/drivers/firewire/nosy.c -index 5fd6a60b67410..88ed971e32c0d 100644 ---- a/drivers/firewire/nosy.c -+++ b/drivers/firewire/nosy.c -@@ -346,6 +346,7 @@ nosy_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - struct client *client = file->private_data; - spinlock_t *client_list_lock = &client->lynx->client_list_lock; - struct nosy_stats stats; -+ int ret; - - switch (cmd) { - case NOSY_IOC_GET_STATS: -@@ -360,11 +361,15 @@ nosy_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - return 0; - - case NOSY_IOC_START: -+ ret = -EBUSY; - spin_lock_irq(client_list_lock); -- list_add_tail(&client->link, &client->lynx->client_list); -+ if (list_empty(&client->link)) { -+ list_add_tail(&client->link, &client->lynx->client_list); -+ ret = 0; -+ } - spin_unlock_irq(client_list_lock); - -- return 0; -+ return ret; - - case NOSY_IOC_STOP: - spin_lock_irq(client_list_lock); -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c -index b16b32797624a..37010f290ba4e 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c -@@ -780,9 +780,9 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) - dev_info->high_va_offset = AMDGPU_GMC_HOLE_END; - dev_info->high_va_max = AMDGPU_GMC_HOLE_END | vm_size; - } -- dev_info->virtual_address_alignment = max((int)PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE); -+ dev_info->virtual_address_alignment = max_t(u32, PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE); - dev_info->pte_fragment_size = (1 << adev->vm_manager.fragment_size) * AMDGPU_GPU_PAGE_SIZE; -- dev_info->gart_page_size = AMDGPU_GPU_PAGE_SIZE; -+ dev_info->gart_page_size = max_t(u32, PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE); - dev_info->cu_active_number = adev->gfx.cu_info.number; - dev_info->cu_ao_mask = adev->gfx.cu_info.ao_cu_mask; - dev_info->ce_ram_size = adev->gfx.ce_ram_size; -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c -index 0768c86869836..b24cb44739132 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c -@@ -2195,8 +2195,8 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev, - uint64_t eaddr; - - /* validate the parameters */ -- if (saddr & AMDGPU_GPU_PAGE_MASK || offset & AMDGPU_GPU_PAGE_MASK || -- size == 0 || size & AMDGPU_GPU_PAGE_MASK) -+ if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK || -+ size == 0 || size & ~PAGE_MASK) - return -EINVAL; - - /* make sure object fit at this offset */ -@@ -2261,8 +2261,8 @@ int amdgpu_vm_bo_replace_map(struct amdgpu_device *adev, - int r; - - /* validate the parameters */ -- if (saddr & AMDGPU_GPU_PAGE_MASK || offset & AMDGPU_GPU_PAGE_MASK || -- size == 0 || size & AMDGPU_GPU_PAGE_MASK) -+ if (saddr & ~PAGE_MASK || offset & ~PAGE_MASK || -+ size == 0 || size & ~PAGE_MASK) - return -EINVAL; - - /* make sure object fit at this offset */ -@@ -2407,7 +2407,7 @@ int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev, - after->start = eaddr + 1; - after->last = tmp->last; - after->offset = tmp->offset; -- after->offset += after->start - tmp->start; -+ after->offset += (after->start - tmp->start) << PAGE_SHIFT; - after->flags = tmp->flags; - after->bo_va = tmp->bo_va; - list_add(&after->list, &tmp->bo_va->invalids); -diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c b/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c -index b258a3dae767f..159add0f5aaae 100644 ---- a/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c -+++ b/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c -@@ -155,7 +155,7 @@ static int dbgdev_diq_submit_ib(struct kfd_dbgdev *dbgdev, - - /* Wait till CP writes sync code: */ - status = amdkfd_fence_wait_timeout( -- (unsigned int *) rm_state, -+ rm_state, - QUEUESTATE__ACTIVE, 1500); - - kfd_gtt_sa_free(dbgdev->dev, mem_obj); -diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c -index e686ce2bf3b3c..4598a9a581251 100644 ---- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c -+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c -@@ -1167,7 +1167,7 @@ static int start_cpsch(struct device_queue_manager *dqm) - if (retval) - goto fail_allocate_vidmem; - -- dqm->fence_addr = dqm->fence_mem->cpu_ptr; -+ dqm->fence_addr = (uint64_t *)dqm->fence_mem->cpu_ptr; - dqm->fence_gpu_addr = dqm->fence_mem->gpu_addr; - - init_interrupts(dqm); -@@ -1340,8 +1340,8 @@ out: - return retval; - } - --int amdkfd_fence_wait_timeout(unsigned int *fence_addr, -- unsigned int fence_value, -+int amdkfd_fence_wait_timeout(uint64_t *fence_addr, -+ uint64_t fence_value, - unsigned int timeout_ms) - { - unsigned long end_jiffies = msecs_to_jiffies(timeout_ms) + jiffies; -diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h -index 7351dd195274e..45f8159465544 100644 ---- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h -+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h -@@ -192,7 +192,7 @@ struct device_queue_manager { - uint16_t vmid_pasid[VMID_NUM]; - uint64_t pipelines_addr; - uint64_t fence_gpu_addr; -- unsigned int *fence_addr; -+ uint64_t *fence_addr; - struct kfd_mem_obj *fence_mem; - bool active_runlist; - int sched_policy; -diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c -index 5d541e0cc8ca2..f71a7fa6680c8 100644 ---- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c -+++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c -@@ -347,7 +347,7 @@ fail_create_runlist_ib: - } - - int pm_send_query_status(struct packet_manager *pm, uint64_t fence_address, -- uint32_t fence_value) -+ uint64_t fence_value) - { - uint32_t *buffer, size; - int retval = 0; -diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c -index dfaf771a42e66..e3ba0cd3b6fa7 100644 ---- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c -+++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c -@@ -283,7 +283,7 @@ static int pm_unmap_queues_v9(struct packet_manager *pm, uint32_t *buffer, - } - - static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer, -- uint64_t fence_address, uint32_t fence_value) -+ uint64_t fence_address, uint64_t fence_value) - { - struct pm4_mes_query_status *packet; - -diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c -index a852e0d7d804f..08442e7d99440 100644 ---- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c -+++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c -@@ -263,7 +263,7 @@ static int pm_unmap_queues_vi(struct packet_manager *pm, uint32_t *buffer, - } - - static int pm_query_status_vi(struct packet_manager *pm, uint32_t *buffer, -- uint64_t fence_address, uint32_t fence_value) -+ uint64_t fence_address, uint64_t fence_value) - { - struct pm4_mes_query_status *packet; - -diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h -index 09599efa41fc9..f304d1f8df5f5 100644 ---- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h -+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h -@@ -1003,8 +1003,8 @@ int pqm_get_wave_state(struct process_queue_manager *pqm, - u32 *ctl_stack_used_size, - u32 *save_area_used_size); - --int amdkfd_fence_wait_timeout(unsigned int *fence_addr, -- unsigned int fence_value, -+int amdkfd_fence_wait_timeout(uint64_t *fence_addr, -+ uint64_t fence_value, - unsigned int timeout_ms); - - /* Packet Manager */ -@@ -1040,7 +1040,7 @@ struct packet_manager_funcs { - uint32_t filter_param, bool reset, - unsigned int sdma_engine); - int (*query_status)(struct packet_manager *pm, uint32_t *buffer, -- uint64_t fence_address, uint32_t fence_value); -+ uint64_t fence_address, uint64_t fence_value); - int (*release_mem)(uint64_t gpu_addr, uint32_t *buffer); - - /* Packet sizes */ -@@ -1062,7 +1062,7 @@ int pm_send_set_resources(struct packet_manager *pm, - struct scheduling_resources *res); - int pm_send_runlist(struct packet_manager *pm, struct list_head *dqm_queues); - int pm_send_query_status(struct packet_manager *pm, uint64_t fence_address, -- uint32_t fence_value); -+ uint64_t fence_value); - - int pm_send_unmap_queue(struct packet_manager *pm, enum kfd_queue_type type, - enum kfd_unmap_queues_filter mode, -diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c -index 72cb67d50e4ae..c9b1437811053 100644 ---- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c -+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c -@@ -3330,7 +3330,8 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, - - disable_mclk_switching_for_display = ((1 < hwmgr->display_config->num_display) && - !hwmgr->display_config->multi_monitor_in_sync) || -- smu7_vblank_too_short(hwmgr, hwmgr->display_config->min_vblank_time); -+ (hwmgr->display_config->num_display && -+ smu7_vblank_too_short(hwmgr, hwmgr->display_config->min_vblank_time)); - - disable_mclk_switching = disable_mclk_switching_for_frame_lock || - disable_mclk_switching_for_display; -diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c -index 92ad2cdbae107..bf6e364192539 100644 ---- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c -+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c -@@ -388,10 +388,15 @@ static int vangogh_get_allowed_feature_mask(struct smu_context *smu, - - static bool vangogh_is_dpm_running(struct smu_context *smu) - { -+ struct amdgpu_device *adev = smu->adev; - int ret = 0; - uint32_t feature_mask[2]; - uint64_t feature_enabled; - -+ /* we need to re-init after suspend so return false */ -+ if (adev->in_suspend) -+ return false; -+ - ret = smu_cmn_get_enabled_32_bits_mask(smu, feature_mask, 2); - - if (ret) -diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c -index d1a9841adeedf..e6a88c8cbd691 100644 ---- a/drivers/gpu/drm/imx/imx-drm-core.c -+++ b/drivers/gpu/drm/imx/imx-drm-core.c -@@ -215,7 +215,7 @@ static int imx_drm_bind(struct device *dev) - - ret = drmm_mode_config_init(drm); - if (ret) -- return ret; -+ goto err_kms; - - ret = drm_vblank_init(drm, MAX_CRTC); - if (ret) -diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c -index f1c9a22083beb..e05565f284dcc 100644 ---- a/drivers/gpu/drm/nouveau/nouveau_bo.c -+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c -@@ -551,6 +551,10 @@ nouveau_bo_sync_for_device(struct nouveau_bo *nvbo) - - if (!ttm_dma) - return; -+ if (!ttm_dma->pages) { -+ NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma); -+ return; -+ } - - /* Don't waste time looping if the object is coherent */ - if (nvbo->force_coherent) -@@ -583,6 +587,10 @@ nouveau_bo_sync_for_cpu(struct nouveau_bo *nvbo) - - if (!ttm_dma) - return; -+ if (!ttm_dma->pages) { -+ NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma); -+ return; -+ } - - /* Don't waste time looping if the object is coherent */ - if (nvbo->force_coherent) -diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c -index 0ae3a025efe9d..8eeef5017826e 100644 ---- a/drivers/gpu/drm/tegra/dc.c -+++ b/drivers/gpu/drm/tegra/dc.c -@@ -2501,22 +2501,18 @@ static int tegra_dc_couple(struct tegra_dc *dc) - * POWER_CONTROL registers during CRTC enabling. - */ - if (dc->soc->coupled_pm && dc->pipe == 1) { -- u32 flags = DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_CONSUMER; -- struct device_link *link; -- struct device *partner; -+ struct device *companion; -+ struct tegra_dc *parent; - -- partner = driver_find_device(dc->dev->driver, NULL, NULL, -- tegra_dc_match_by_pipe); -- if (!partner) -+ companion = driver_find_device(dc->dev->driver, NULL, (const void *)0, -+ tegra_dc_match_by_pipe); -+ if (!companion) - return -EPROBE_DEFER; - -- link = device_link_add(dc->dev, partner, flags); -- if (!link) { -- dev_err(dc->dev, "failed to link controllers\n"); -- return -EINVAL; -- } -+ parent = dev_get_drvdata(companion); -+ dc->client.parent = &parent->client; - -- dev_dbg(dc->dev, "coupled to %s\n", dev_name(partner)); -+ dev_dbg(dc->dev, "coupled to %s\n", dev_name(companion)); - } - - return 0; -diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c -index f02a035dda453..7b88261f57bb6 100644 ---- a/drivers/gpu/drm/tegra/sor.c -+++ b/drivers/gpu/drm/tegra/sor.c -@@ -3115,6 +3115,12 @@ static int tegra_sor_init(struct host1x_client *client) - * kernel is possible. - */ - if (sor->rst) { -+ err = pm_runtime_resume_and_get(sor->dev); -+ if (err < 0) { -+ dev_err(sor->dev, "failed to get runtime PM: %d\n", err); -+ return err; -+ } -+ - err = reset_control_acquire(sor->rst); - if (err < 0) { - dev_err(sor->dev, "failed to acquire SOR reset: %d\n", -@@ -3148,6 +3154,7 @@ static int tegra_sor_init(struct host1x_client *client) - } - - reset_control_release(sor->rst); -+ pm_runtime_put(sor->dev); - } - - err = clk_prepare_enable(sor->clk_safe); -diff --git a/drivers/net/can/Makefile b/drivers/net/can/Makefile -index 22164300122d5..a2b4463d84802 100644 ---- a/drivers/net/can/Makefile -+++ b/drivers/net/can/Makefile -@@ -7,12 +7,7 @@ obj-$(CONFIG_CAN_VCAN) += vcan.o - obj-$(CONFIG_CAN_VXCAN) += vxcan.o - obj-$(CONFIG_CAN_SLCAN) += slcan.o - --obj-$(CONFIG_CAN_DEV) += can-dev.o --can-dev-y += dev.o --can-dev-y += rx-offload.o -- --can-dev-$(CONFIG_CAN_LEDS) += led.o -- -+obj-y += dev/ - obj-y += rcar/ - obj-y += spi/ - obj-y += usb/ -diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c -deleted file mode 100644 -index 2a4f12c3c28b0..0000000000000 ---- a/drivers/net/can/dev.c -+++ /dev/null -@@ -1,1339 +0,0 @@ --// SPDX-License-Identifier: GPL-2.0-only --/* Copyright (C) 2005 Marc Kleine-Budde, Pengutronix -- * Copyright (C) 2006 Andrey Volkov, Varma Electronics -- * Copyright (C) 2008-2009 Wolfgang Grandegger -- */ -- --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include -- --#define MOD_DESC "CAN device driver interface" -- --MODULE_DESCRIPTION(MOD_DESC); --MODULE_LICENSE("GPL v2"); --MODULE_AUTHOR("Wolfgang Grandegger "); -- --/* CAN DLC to real data length conversion helpers */ -- --static const u8 dlc2len[] = {0, 1, 2, 3, 4, 5, 6, 7, -- 8, 12, 16, 20, 24, 32, 48, 64}; -- --/* get data length from raw data length code (DLC) */ --u8 can_fd_dlc2len(u8 dlc) --{ -- return dlc2len[dlc & 0x0F]; --} --EXPORT_SYMBOL_GPL(can_fd_dlc2len); -- --static const u8 len2dlc[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, /* 0 - 8 */ -- 9, 9, 9, 9, /* 9 - 12 */ -- 10, 10, 10, 10, /* 13 - 16 */ -- 11, 11, 11, 11, /* 17 - 20 */ -- 12, 12, 12, 12, /* 21 - 24 */ -- 13, 13, 13, 13, 13, 13, 13, 13, /* 25 - 32 */ -- 14, 14, 14, 14, 14, 14, 14, 14, /* 33 - 40 */ -- 14, 14, 14, 14, 14, 14, 14, 14, /* 41 - 48 */ -- 15, 15, 15, 15, 15, 15, 15, 15, /* 49 - 56 */ -- 15, 15, 15, 15, 15, 15, 15, 15}; /* 57 - 64 */ -- --/* map the sanitized data length to an appropriate data length code */ --u8 can_fd_len2dlc(u8 len) --{ -- if (unlikely(len > 64)) -- return 0xF; -- -- return len2dlc[len]; --} --EXPORT_SYMBOL_GPL(can_fd_len2dlc); -- --#ifdef CONFIG_CAN_CALC_BITTIMING --#define CAN_CALC_MAX_ERROR 50 /* in one-tenth of a percent */ -- --/* Bit-timing calculation derived from: -- * -- * Code based on LinCAN sources and H8S2638 project -- * Copyright 2004-2006 Pavel Pisa - DCE FELK CVUT cz -- * Copyright 2005 Stanislav Marek -- * email: pisa@cmp.felk.cvut.cz -- * -- * Calculates proper bit-timing parameters for a specified bit-rate -- * and sample-point, which can then be used to set the bit-timing -- * registers of the CAN controller. You can find more information -- * in the header file linux/can/netlink.h. -- */ --static int --can_update_sample_point(const struct can_bittiming_const *btc, -- unsigned int sample_point_nominal, unsigned int tseg, -- unsigned int *tseg1_ptr, unsigned int *tseg2_ptr, -- unsigned int *sample_point_error_ptr) --{ -- unsigned int sample_point_error, best_sample_point_error = UINT_MAX; -- unsigned int sample_point, best_sample_point = 0; -- unsigned int tseg1, tseg2; -- int i; -- -- for (i = 0; i <= 1; i++) { -- tseg2 = tseg + CAN_SYNC_SEG - -- (sample_point_nominal * (tseg + CAN_SYNC_SEG)) / -- 1000 - i; -- tseg2 = clamp(tseg2, btc->tseg2_min, btc->tseg2_max); -- tseg1 = tseg - tseg2; -- if (tseg1 > btc->tseg1_max) { -- tseg1 = btc->tseg1_max; -- tseg2 = tseg - tseg1; -- } -- -- sample_point = 1000 * (tseg + CAN_SYNC_SEG - tseg2) / -- (tseg + CAN_SYNC_SEG); -- sample_point_error = abs(sample_point_nominal - sample_point); -- -- if (sample_point <= sample_point_nominal && -- sample_point_error < best_sample_point_error) { -- best_sample_point = sample_point; -- best_sample_point_error = sample_point_error; -- *tseg1_ptr = tseg1; -- *tseg2_ptr = tseg2; -- } -- } -- -- if (sample_point_error_ptr) -- *sample_point_error_ptr = best_sample_point_error; -- -- return best_sample_point; --} -- --static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, -- const struct can_bittiming_const *btc) --{ -- struct can_priv *priv = netdev_priv(dev); -- unsigned int bitrate; /* current bitrate */ -- unsigned int bitrate_error; /* difference between current and nominal value */ -- unsigned int best_bitrate_error = UINT_MAX; -- unsigned int sample_point_error; /* difference between current and nominal value */ -- unsigned int best_sample_point_error = UINT_MAX; -- unsigned int sample_point_nominal; /* nominal sample point */ -- unsigned int best_tseg = 0; /* current best value for tseg */ -- unsigned int best_brp = 0; /* current best value for brp */ -- unsigned int brp, tsegall, tseg, tseg1 = 0, tseg2 = 0; -- u64 v64; -- -- /* Use CiA recommended sample points */ -- if (bt->sample_point) { -- sample_point_nominal = bt->sample_point; -- } else { -- if (bt->bitrate > 800000) -- sample_point_nominal = 750; -- else if (bt->bitrate > 500000) -- sample_point_nominal = 800; -- else -- sample_point_nominal = 875; -- } -- -- /* tseg even = round down, odd = round up */ -- for (tseg = (btc->tseg1_max + btc->tseg2_max) * 2 + 1; -- tseg >= (btc->tseg1_min + btc->tseg2_min) * 2; tseg--) { -- tsegall = CAN_SYNC_SEG + tseg / 2; -- -- /* Compute all possible tseg choices (tseg=tseg1+tseg2) */ -- brp = priv->clock.freq / (tsegall * bt->bitrate) + tseg % 2; -- -- /* choose brp step which is possible in system */ -- brp = (brp / btc->brp_inc) * btc->brp_inc; -- if (brp < btc->brp_min || brp > btc->brp_max) -- continue; -- -- bitrate = priv->clock.freq / (brp * tsegall); -- bitrate_error = abs(bt->bitrate - bitrate); -- -- /* tseg brp biterror */ -- if (bitrate_error > best_bitrate_error) -- continue; -- -- /* reset sample point error if we have a better bitrate */ -- if (bitrate_error < best_bitrate_error) -- best_sample_point_error = UINT_MAX; -- -- can_update_sample_point(btc, sample_point_nominal, tseg / 2, -- &tseg1, &tseg2, &sample_point_error); -- if (sample_point_error > best_sample_point_error) -- continue; -- -- best_sample_point_error = sample_point_error; -- best_bitrate_error = bitrate_error; -- best_tseg = tseg / 2; -- best_brp = brp; -- -- if (bitrate_error == 0 && sample_point_error == 0) -- break; -- } -- -- if (best_bitrate_error) { -- /* Error in one-tenth of a percent */ -- v64 = (u64)best_bitrate_error * 1000; -- do_div(v64, bt->bitrate); -- bitrate_error = (u32)v64; -- if (bitrate_error > CAN_CALC_MAX_ERROR) { -- netdev_err(dev, -- "bitrate error %d.%d%% too high\n", -- bitrate_error / 10, bitrate_error % 10); -- return -EDOM; -- } -- netdev_warn(dev, "bitrate error %d.%d%%\n", -- bitrate_error / 10, bitrate_error % 10); -- } -- -- /* real sample point */ -- bt->sample_point = can_update_sample_point(btc, sample_point_nominal, -- best_tseg, &tseg1, &tseg2, -- NULL); -- -- v64 = (u64)best_brp * 1000 * 1000 * 1000; -- do_div(v64, priv->clock.freq); -- bt->tq = (u32)v64; -- bt->prop_seg = tseg1 / 2; -- bt->phase_seg1 = tseg1 - bt->prop_seg; -- bt->phase_seg2 = tseg2; -- -- /* check for sjw user settings */ -- if (!bt->sjw || !btc->sjw_max) { -- bt->sjw = 1; -- } else { -- /* bt->sjw is at least 1 -> sanitize upper bound to sjw_max */ -- if (bt->sjw > btc->sjw_max) -- bt->sjw = btc->sjw_max; -- /* bt->sjw must not be higher than tseg2 */ -- if (tseg2 < bt->sjw) -- bt->sjw = tseg2; -- } -- -- bt->brp = best_brp; -- -- /* real bitrate */ -- bt->bitrate = priv->clock.freq / -- (bt->brp * (CAN_SYNC_SEG + tseg1 + tseg2)); -- -- return 0; --} --#else /* !CONFIG_CAN_CALC_BITTIMING */ --static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, -- const struct can_bittiming_const *btc) --{ -- netdev_err(dev, "bit-timing calculation not available\n"); -- return -EINVAL; --} --#endif /* CONFIG_CAN_CALC_BITTIMING */ -- --/* Checks the validity of the specified bit-timing parameters prop_seg, -- * phase_seg1, phase_seg2 and sjw and tries to determine the bitrate -- * prescaler value brp. You can find more information in the header -- * file linux/can/netlink.h. -- */ --static int can_fixup_bittiming(struct net_device *dev, struct can_bittiming *bt, -- const struct can_bittiming_const *btc) --{ -- struct can_priv *priv = netdev_priv(dev); -- int tseg1, alltseg; -- u64 brp64; -- -- tseg1 = bt->prop_seg + bt->phase_seg1; -- if (!bt->sjw) -- bt->sjw = 1; -- if (bt->sjw > btc->sjw_max || -- tseg1 < btc->tseg1_min || tseg1 > btc->tseg1_max || -- bt->phase_seg2 < btc->tseg2_min || bt->phase_seg2 > btc->tseg2_max) -- return -ERANGE; -- -- brp64 = (u64)priv->clock.freq * (u64)bt->tq; -- if (btc->brp_inc > 1) -- do_div(brp64, btc->brp_inc); -- brp64 += 500000000UL - 1; -- do_div(brp64, 1000000000UL); /* the practicable BRP */ -- if (btc->brp_inc > 1) -- brp64 *= btc->brp_inc; -- bt->brp = (u32)brp64; -- -- if (bt->brp < btc->brp_min || bt->brp > btc->brp_max) -- return -EINVAL; -- -- alltseg = bt->prop_seg + bt->phase_seg1 + bt->phase_seg2 + 1; -- bt->bitrate = priv->clock.freq / (bt->brp * alltseg); -- bt->sample_point = ((tseg1 + 1) * 1000) / alltseg; -- -- return 0; --} -- --/* Checks the validity of predefined bitrate settings */ --static int --can_validate_bitrate(struct net_device *dev, struct can_bittiming *bt, -- const u32 *bitrate_const, -- const unsigned int bitrate_const_cnt) --{ -- struct can_priv *priv = netdev_priv(dev); -- unsigned int i; -- -- for (i = 0; i < bitrate_const_cnt; i++) { -- if (bt->bitrate == bitrate_const[i]) -- break; -- } -- -- if (i >= priv->bitrate_const_cnt) -- return -EINVAL; -- -- return 0; --} -- --static int can_get_bittiming(struct net_device *dev, struct can_bittiming *bt, -- const struct can_bittiming_const *btc, -- const u32 *bitrate_const, -- const unsigned int bitrate_const_cnt) --{ -- int err; -- -- /* Depending on the given can_bittiming parameter structure the CAN -- * timing parameters are calculated based on the provided bitrate OR -- * alternatively the CAN timing parameters (tq, prop_seg, etc.) are -- * provided directly which are then checked and fixed up. -- */ -- if (!bt->tq && bt->bitrate && btc) -- err = can_calc_bittiming(dev, bt, btc); -- else if (bt->tq && !bt->bitrate && btc) -- err = can_fixup_bittiming(dev, bt, btc); -- else if (!bt->tq && bt->bitrate && bitrate_const) -- err = can_validate_bitrate(dev, bt, bitrate_const, -- bitrate_const_cnt); -- else -- err = -EINVAL; -- -- return err; --} -- --static void can_update_state_error_stats(struct net_device *dev, -- enum can_state new_state) --{ -- struct can_priv *priv = netdev_priv(dev); -- -- if (new_state <= priv->state) -- return; -- -- switch (new_state) { -- case CAN_STATE_ERROR_WARNING: -- priv->can_stats.error_warning++; -- break; -- case CAN_STATE_ERROR_PASSIVE: -- priv->can_stats.error_passive++; -- break; -- case CAN_STATE_BUS_OFF: -- priv->can_stats.bus_off++; -- break; -- default: -- break; -- } --} -- --static int can_tx_state_to_frame(struct net_device *dev, enum can_state state) --{ -- switch (state) { -- case CAN_STATE_ERROR_ACTIVE: -- return CAN_ERR_CRTL_ACTIVE; -- case CAN_STATE_ERROR_WARNING: -- return CAN_ERR_CRTL_TX_WARNING; -- case CAN_STATE_ERROR_PASSIVE: -- return CAN_ERR_CRTL_TX_PASSIVE; -- default: -- return 0; -- } --} -- --static int can_rx_state_to_frame(struct net_device *dev, enum can_state state) --{ -- switch (state) { -- case CAN_STATE_ERROR_ACTIVE: -- return CAN_ERR_CRTL_ACTIVE; -- case CAN_STATE_ERROR_WARNING: -- return CAN_ERR_CRTL_RX_WARNING; -- case CAN_STATE_ERROR_PASSIVE: -- return CAN_ERR_CRTL_RX_PASSIVE; -- default: -- return 0; -- } --} -- --static const char *can_get_state_str(const enum can_state state) --{ -- switch (state) { -- case CAN_STATE_ERROR_ACTIVE: -- return "Error Active"; -- case CAN_STATE_ERROR_WARNING: -- return "Error Warning"; -- case CAN_STATE_ERROR_PASSIVE: -- return "Error Passive"; -- case CAN_STATE_BUS_OFF: -- return "Bus Off"; -- case CAN_STATE_STOPPED: -- return "Stopped"; -- case CAN_STATE_SLEEPING: -- return "Sleeping"; -- default: -- return ""; -- } -- -- return ""; --} -- --void can_change_state(struct net_device *dev, struct can_frame *cf, -- enum can_state tx_state, enum can_state rx_state) --{ -- struct can_priv *priv = netdev_priv(dev); -- enum can_state new_state = max(tx_state, rx_state); -- -- if (unlikely(new_state == priv->state)) { -- netdev_warn(dev, "%s: oops, state did not change", __func__); -- return; -- } -- -- netdev_dbg(dev, "Controller changed from %s State (%d) into %s State (%d).\n", -- can_get_state_str(priv->state), priv->state, -- can_get_state_str(new_state), new_state); -- -- can_update_state_error_stats(dev, new_state); -- priv->state = new_state; -- -- if (!cf) -- return; -- -- if (unlikely(new_state == CAN_STATE_BUS_OFF)) { -- cf->can_id |= CAN_ERR_BUSOFF; -- return; -- } -- -- cf->can_id |= CAN_ERR_CRTL; -- cf->data[1] |= tx_state >= rx_state ? -- can_tx_state_to_frame(dev, tx_state) : 0; -- cf->data[1] |= tx_state <= rx_state ? -- can_rx_state_to_frame(dev, rx_state) : 0; --} --EXPORT_SYMBOL_GPL(can_change_state); -- --/* Local echo of CAN messages -- * -- * CAN network devices *should* support a local echo functionality -- * (see Documentation/networking/can.rst). To test the handling of CAN -- * interfaces that do not support the local echo both driver types are -- * implemented. In the case that the driver does not support the echo -- * the IFF_ECHO remains clear in dev->flags. This causes the PF_CAN core -- * to perform the echo as a fallback solution. -- */ --static void can_flush_echo_skb(struct net_device *dev) --{ -- struct can_priv *priv = netdev_priv(dev); -- struct net_device_stats *stats = &dev->stats; -- int i; -- -- for (i = 0; i < priv->echo_skb_max; i++) { -- if (priv->echo_skb[i]) { -- kfree_skb(priv->echo_skb[i]); -- priv->echo_skb[i] = NULL; -- stats->tx_dropped++; -- stats->tx_aborted_errors++; -- } -- } --} -- --/* Put the skb on the stack to be looped backed locally lateron -- * -- * The function is typically called in the start_xmit function -- * of the device driver. The driver must protect access to -- * priv->echo_skb, if necessary. -- */ --int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, -- unsigned int idx) --{ -- struct can_priv *priv = netdev_priv(dev); -- -- BUG_ON(idx >= priv->echo_skb_max); -- -- /* check flag whether this packet has to be looped back */ -- if (!(dev->flags & IFF_ECHO) || skb->pkt_type != PACKET_LOOPBACK || -- (skb->protocol != htons(ETH_P_CAN) && -- skb->protocol != htons(ETH_P_CANFD))) { -- kfree_skb(skb); -- return 0; -- } -- -- if (!priv->echo_skb[idx]) { -- skb = can_create_echo_skb(skb); -- if (!skb) -- return -ENOMEM; -- -- /* make settings for echo to reduce code in irq context */ -- skb->pkt_type = PACKET_BROADCAST; -- skb->ip_summed = CHECKSUM_UNNECESSARY; -- skb->dev = dev; -- -- /* save this skb for tx interrupt echo handling */ -- priv->echo_skb[idx] = skb; -- } else { -- /* locking problem with netif_stop_queue() ?? */ -- netdev_err(dev, "%s: BUG! echo_skb %d is occupied!\n", __func__, idx); -- kfree_skb(skb); -- return -EBUSY; -- } -- -- return 0; --} --EXPORT_SYMBOL_GPL(can_put_echo_skb); -- --struct sk_buff * --__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) --{ -- struct can_priv *priv = netdev_priv(dev); -- -- if (idx >= priv->echo_skb_max) { -- netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", -- __func__, idx, priv->echo_skb_max); -- return NULL; -- } -- -- if (priv->echo_skb[idx]) { -- /* Using "struct canfd_frame::len" for the frame -- * length is supported on both CAN and CANFD frames. -- */ -- struct sk_buff *skb = priv->echo_skb[idx]; -- struct canfd_frame *cf = (struct canfd_frame *)skb->data; -- -- /* get the real payload length for netdev statistics */ -- if (cf->can_id & CAN_RTR_FLAG) -- *len_ptr = 0; -- else -- *len_ptr = cf->len; -- -- priv->echo_skb[idx] = NULL; -- -- return skb; -- } -- -- return NULL; --} -- --/* Get the skb from the stack and loop it back locally -- * -- * The function is typically called when the TX done interrupt -- * is handled in the device driver. The driver must protect -- * access to priv->echo_skb, if necessary. -- */ --unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx) --{ -- struct sk_buff *skb; -- u8 len; -- -- skb = __can_get_echo_skb(dev, idx, &len); -- if (!skb) -- return 0; -- -- skb_get(skb); -- if (netif_rx(skb) == NET_RX_SUCCESS) -- dev_consume_skb_any(skb); -- else -- dev_kfree_skb_any(skb); -- -- return len; --} --EXPORT_SYMBOL_GPL(can_get_echo_skb); -- --/* Remove the skb from the stack and free it. -- * -- * The function is typically called when TX failed. -- */ --void can_free_echo_skb(struct net_device *dev, unsigned int idx) --{ -- struct can_priv *priv = netdev_priv(dev); -- -- BUG_ON(idx >= priv->echo_skb_max); -- -- if (priv->echo_skb[idx]) { -- dev_kfree_skb_any(priv->echo_skb[idx]); -- priv->echo_skb[idx] = NULL; -- } --} --EXPORT_SYMBOL_GPL(can_free_echo_skb); -- --/* CAN device restart for bus-off recovery */ --static void can_restart(struct net_device *dev) --{ -- struct can_priv *priv = netdev_priv(dev); -- struct net_device_stats *stats = &dev->stats; -- struct sk_buff *skb; -- struct can_frame *cf; -- int err; -- -- BUG_ON(netif_carrier_ok(dev)); -- -- /* No synchronization needed because the device is bus-off and -- * no messages can come in or go out. -- */ -- can_flush_echo_skb(dev); -- -- /* send restart message upstream */ -- skb = alloc_can_err_skb(dev, &cf); -- if (!skb) -- goto restart; -- -- cf->can_id |= CAN_ERR_RESTARTED; -- -- stats->rx_packets++; -- stats->rx_bytes += cf->len; -- -- netif_rx_ni(skb); -- --restart: -- netdev_dbg(dev, "restarted\n"); -- priv->can_stats.restarts++; -- -- /* Now restart the device */ -- err = priv->do_set_mode(dev, CAN_MODE_START); -- -- netif_carrier_on(dev); -- if (err) -- netdev_err(dev, "Error %d during restart", err); --} -- --static void can_restart_work(struct work_struct *work) --{ -- struct delayed_work *dwork = to_delayed_work(work); -- struct can_priv *priv = container_of(dwork, struct can_priv, -- restart_work); -- -- can_restart(priv->dev); --} -- --int can_restart_now(struct net_device *dev) --{ -- struct can_priv *priv = netdev_priv(dev); -- -- /* A manual restart is only permitted if automatic restart is -- * disabled and the device is in the bus-off state -- */ -- if (priv->restart_ms) -- return -EINVAL; -- if (priv->state != CAN_STATE_BUS_OFF) -- return -EBUSY; -- -- cancel_delayed_work_sync(&priv->restart_work); -- can_restart(dev); -- -- return 0; --} -- --/* CAN bus-off -- * -- * This functions should be called when the device goes bus-off to -- * tell the netif layer that no more packets can be sent or received. -- * If enabled, a timer is started to trigger bus-off recovery. -- */ --void can_bus_off(struct net_device *dev) --{ -- struct can_priv *priv = netdev_priv(dev); -- -- if (priv->restart_ms) -- netdev_info(dev, "bus-off, scheduling restart in %d ms\n", -- priv->restart_ms); -- else -- netdev_info(dev, "bus-off\n"); -- -- netif_carrier_off(dev); -- -- if (priv->restart_ms) -- schedule_delayed_work(&priv->restart_work, -- msecs_to_jiffies(priv->restart_ms)); --} --EXPORT_SYMBOL_GPL(can_bus_off); -- --static void can_setup(struct net_device *dev) --{ -- dev->type = ARPHRD_CAN; -- dev->mtu = CAN_MTU; -- dev->hard_header_len = 0; -- dev->addr_len = 0; -- dev->tx_queue_len = 10; -- -- /* New-style flags. */ -- dev->flags = IFF_NOARP; -- dev->features = NETIF_F_HW_CSUM; --} -- --struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) --{ -- struct sk_buff *skb; -- -- skb = netdev_alloc_skb(dev, sizeof(struct can_skb_priv) + -- sizeof(struct can_frame)); -- if (unlikely(!skb)) -- return NULL; -- -- skb->protocol = htons(ETH_P_CAN); -- skb->pkt_type = PACKET_BROADCAST; -- skb->ip_summed = CHECKSUM_UNNECESSARY; -- -- skb_reset_mac_header(skb); -- skb_reset_network_header(skb); -- skb_reset_transport_header(skb); -- -- can_skb_reserve(skb); -- can_skb_prv(skb)->ifindex = dev->ifindex; -- can_skb_prv(skb)->skbcnt = 0; -- -- *cf = skb_put_zero(skb, sizeof(struct can_frame)); -- -- return skb; --} --EXPORT_SYMBOL_GPL(alloc_can_skb); -- --struct sk_buff *alloc_canfd_skb(struct net_device *dev, -- struct canfd_frame **cfd) --{ -- struct sk_buff *skb; -- -- skb = netdev_alloc_skb(dev, sizeof(struct can_skb_priv) + -- sizeof(struct canfd_frame)); -- if (unlikely(!skb)) -- return NULL; -- -- skb->protocol = htons(ETH_P_CANFD); -- skb->pkt_type = PACKET_BROADCAST; -- skb->ip_summed = CHECKSUM_UNNECESSARY; -- -- skb_reset_mac_header(skb); -- skb_reset_network_header(skb); -- skb_reset_transport_header(skb); -- -- can_skb_reserve(skb); -- can_skb_prv(skb)->ifindex = dev->ifindex; -- can_skb_prv(skb)->skbcnt = 0; -- -- *cfd = skb_put_zero(skb, sizeof(struct canfd_frame)); -- -- return skb; --} --EXPORT_SYMBOL_GPL(alloc_canfd_skb); -- --struct sk_buff *alloc_can_err_skb(struct net_device *dev, struct can_frame **cf) --{ -- struct sk_buff *skb; -- -- skb = alloc_can_skb(dev, cf); -- if (unlikely(!skb)) -- return NULL; -- -- (*cf)->can_id = CAN_ERR_FLAG; -- (*cf)->len = CAN_ERR_DLC; -- -- return skb; --} --EXPORT_SYMBOL_GPL(alloc_can_err_skb); -- --/* Allocate and setup space for the CAN network device */ --struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max, -- unsigned int txqs, unsigned int rxqs) --{ -- struct net_device *dev; -- struct can_priv *priv; -- int size; -- -- /* We put the driver's priv, the CAN mid layer priv and the -- * echo skb into the netdevice's priv. The memory layout for -- * the netdev_priv is like this: -- * -- * +-------------------------+ -- * | driver's priv | -- * +-------------------------+ -- * | struct can_ml_priv | -- * +-------------------------+ -- * | array of struct sk_buff | -- * +-------------------------+ -- */ -- -- size = ALIGN(sizeof_priv, NETDEV_ALIGN) + sizeof(struct can_ml_priv); -- -- if (echo_skb_max) -- size = ALIGN(size, sizeof(struct sk_buff *)) + -- echo_skb_max * sizeof(struct sk_buff *); -- -- dev = alloc_netdev_mqs(size, "can%d", NET_NAME_UNKNOWN, can_setup, -- txqs, rxqs); -- if (!dev) -- return NULL; -- -- priv = netdev_priv(dev); -- priv->dev = dev; -- -- dev->ml_priv = (void *)priv + ALIGN(sizeof_priv, NETDEV_ALIGN); -- -- if (echo_skb_max) { -- priv->echo_skb_max = echo_skb_max; -- priv->echo_skb = (void *)priv + -- (size - echo_skb_max * sizeof(struct sk_buff *)); -- } -- -- priv->state = CAN_STATE_STOPPED; -- -- INIT_DELAYED_WORK(&priv->restart_work, can_restart_work); -- -- return dev; --} --EXPORT_SYMBOL_GPL(alloc_candev_mqs); -- --/* Free space of the CAN network device */ --void free_candev(struct net_device *dev) --{ -- free_netdev(dev); --} --EXPORT_SYMBOL_GPL(free_candev); -- --/* changing MTU and control mode for CAN/CANFD devices */ --int can_change_mtu(struct net_device *dev, int new_mtu) --{ -- struct can_priv *priv = netdev_priv(dev); -- -- /* Do not allow changing the MTU while running */ -- if (dev->flags & IFF_UP) -- return -EBUSY; -- -- /* allow change of MTU according to the CANFD ability of the device */ -- switch (new_mtu) { -- case CAN_MTU: -- /* 'CANFD-only' controllers can not switch to CAN_MTU */ -- if (priv->ctrlmode_static & CAN_CTRLMODE_FD) -- return -EINVAL; -- -- priv->ctrlmode &= ~CAN_CTRLMODE_FD; -- break; -- -- case CANFD_MTU: -- /* check for potential CANFD ability */ -- if (!(priv->ctrlmode_supported & CAN_CTRLMODE_FD) && -- !(priv->ctrlmode_static & CAN_CTRLMODE_FD)) -- return -EINVAL; -- -- priv->ctrlmode |= CAN_CTRLMODE_FD; -- break; -- -- default: -- return -EINVAL; -- } -- -- dev->mtu = new_mtu; -- return 0; --} --EXPORT_SYMBOL_GPL(can_change_mtu); -- --/* Common open function when the device gets opened. -- * -- * This function should be called in the open function of the device -- * driver. -- */ --int open_candev(struct net_device *dev) --{ -- struct can_priv *priv = netdev_priv(dev); -- -- if (!priv->bittiming.bitrate) { -- netdev_err(dev, "bit-timing not yet defined\n"); -- return -EINVAL; -- } -- -- /* For CAN FD the data bitrate has to be >= the arbitration bitrate */ -- if ((priv->ctrlmode & CAN_CTRLMODE_FD) && -- (!priv->data_bittiming.bitrate || -- priv->data_bittiming.bitrate < priv->bittiming.bitrate)) { -- netdev_err(dev, "incorrect/missing data bit-timing\n"); -- return -EINVAL; -- } -- -- /* Switch carrier on if device was stopped while in bus-off state */ -- if (!netif_carrier_ok(dev)) -- netif_carrier_on(dev); -- -- return 0; --} --EXPORT_SYMBOL_GPL(open_candev); -- --#ifdef CONFIG_OF --/* Common function that can be used to understand the limitation of -- * a transceiver when it provides no means to determine these limitations -- * at runtime. -- */ --void of_can_transceiver(struct net_device *dev) --{ -- struct device_node *dn; -- struct can_priv *priv = netdev_priv(dev); -- struct device_node *np = dev->dev.parent->of_node; -- int ret; -- -- dn = of_get_child_by_name(np, "can-transceiver"); -- if (!dn) -- return; -- -- ret = of_property_read_u32(dn, "max-bitrate", &priv->bitrate_max); -- of_node_put(dn); -- if ((ret && ret != -EINVAL) || (!ret && !priv->bitrate_max)) -- netdev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit.\n"); --} --EXPORT_SYMBOL_GPL(of_can_transceiver); --#endif -- --/* Common close function for cleanup before the device gets closed. -- * -- * This function should be called in the close function of the device -- * driver. -- */ --void close_candev(struct net_device *dev) --{ -- struct can_priv *priv = netdev_priv(dev); -- -- cancel_delayed_work_sync(&priv->restart_work); -- can_flush_echo_skb(dev); --} --EXPORT_SYMBOL_GPL(close_candev); -- --/* CAN netlink interface */ --static const struct nla_policy can_policy[IFLA_CAN_MAX + 1] = { -- [IFLA_CAN_STATE] = { .type = NLA_U32 }, -- [IFLA_CAN_CTRLMODE] = { .len = sizeof(struct can_ctrlmode) }, -- [IFLA_CAN_RESTART_MS] = { .type = NLA_U32 }, -- [IFLA_CAN_RESTART] = { .type = NLA_U32 }, -- [IFLA_CAN_BITTIMING] = { .len = sizeof(struct can_bittiming) }, -- [IFLA_CAN_BITTIMING_CONST] -- = { .len = sizeof(struct can_bittiming_const) }, -- [IFLA_CAN_CLOCK] = { .len = sizeof(struct can_clock) }, -- [IFLA_CAN_BERR_COUNTER] = { .len = sizeof(struct can_berr_counter) }, -- [IFLA_CAN_DATA_BITTIMING] -- = { .len = sizeof(struct can_bittiming) }, -- [IFLA_CAN_DATA_BITTIMING_CONST] -- = { .len = sizeof(struct can_bittiming_const) }, -- [IFLA_CAN_TERMINATION] = { .type = NLA_U16 }, --}; -- --static int can_validate(struct nlattr *tb[], struct nlattr *data[], -- struct netlink_ext_ack *extack) --{ -- bool is_can_fd = false; -- -- /* Make sure that valid CAN FD configurations always consist of -- * - nominal/arbitration bittiming -- * - data bittiming -- * - control mode with CAN_CTRLMODE_FD set -- */ -- -- if (!data) -- return 0; -- -- if (data[IFLA_CAN_CTRLMODE]) { -- struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]); -- -- is_can_fd = cm->flags & cm->mask & CAN_CTRLMODE_FD; -- } -- -- if (is_can_fd) { -- if (!data[IFLA_CAN_BITTIMING] || !data[IFLA_CAN_DATA_BITTIMING]) -- return -EOPNOTSUPP; -- } -- -- if (data[IFLA_CAN_DATA_BITTIMING]) { -- if (!is_can_fd || !data[IFLA_CAN_BITTIMING]) -- return -EOPNOTSUPP; -- } -- -- return 0; --} -- --static int can_changelink(struct net_device *dev, struct nlattr *tb[], -- struct nlattr *data[], -- struct netlink_ext_ack *extack) --{ -- struct can_priv *priv = netdev_priv(dev); -- int err; -- -- /* We need synchronization with dev->stop() */ -- ASSERT_RTNL(); -- -- if (data[IFLA_CAN_BITTIMING]) { -- struct can_bittiming bt; -- -- /* Do not allow changing bittiming while running */ -- if (dev->flags & IFF_UP) -- return -EBUSY; -- -- /* Calculate bittiming parameters based on -- * bittiming_const if set, otherwise pass bitrate -- * directly via do_set_bitrate(). Bail out if neither -- * is given. -- */ -- if (!priv->bittiming_const && !priv->do_set_bittiming) -- return -EOPNOTSUPP; -- -- memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); -- err = can_get_bittiming(dev, &bt, -- priv->bittiming_const, -- priv->bitrate_const, -- priv->bitrate_const_cnt); -- if (err) -- return err; -- -- if (priv->bitrate_max && bt.bitrate > priv->bitrate_max) { -- netdev_err(dev, "arbitration bitrate surpasses transceiver capabilities of %d bps\n", -- priv->bitrate_max); -- return -EINVAL; -- } -- -- memcpy(&priv->bittiming, &bt, sizeof(bt)); -- -- if (priv->do_set_bittiming) { -- /* Finally, set the bit-timing registers */ -- err = priv->do_set_bittiming(dev); -- if (err) -- return err; -- } -- } -- -- if (data[IFLA_CAN_CTRLMODE]) { -- struct can_ctrlmode *cm; -- u32 ctrlstatic; -- u32 maskedflags; -- -- /* Do not allow changing controller mode while running */ -- if (dev->flags & IFF_UP) -- return -EBUSY; -- cm = nla_data(data[IFLA_CAN_CTRLMODE]); -- ctrlstatic = priv->ctrlmode_static; -- maskedflags = cm->flags & cm->mask; -- -- /* check whether provided bits are allowed to be passed */ -- if (cm->mask & ~(priv->ctrlmode_supported | ctrlstatic)) -- return -EOPNOTSUPP; -- -- /* do not check for static fd-non-iso if 'fd' is disabled */ -- if (!(maskedflags & CAN_CTRLMODE_FD)) -- ctrlstatic &= ~CAN_CTRLMODE_FD_NON_ISO; -- -- /* make sure static options are provided by configuration */ -- if ((maskedflags & ctrlstatic) != ctrlstatic) -- return -EOPNOTSUPP; -- -- /* clear bits to be modified and copy the flag values */ -- priv->ctrlmode &= ~cm->mask; -- priv->ctrlmode |= maskedflags; -- -- /* CAN_CTRLMODE_FD can only be set when driver supports FD */ -- if (priv->ctrlmode & CAN_CTRLMODE_FD) -- dev->mtu = CANFD_MTU; -- else -- dev->mtu = CAN_MTU; -- } -- -- if (data[IFLA_CAN_RESTART_MS]) { -- /* Do not allow changing restart delay while running */ -- if (dev->flags & IFF_UP) -- return -EBUSY; -- priv->restart_ms = nla_get_u32(data[IFLA_CAN_RESTART_MS]); -- } -- -- if (data[IFLA_CAN_RESTART]) { -- /* Do not allow a restart while not running */ -- if (!(dev->flags & IFF_UP)) -- return -EINVAL; -- err = can_restart_now(dev); -- if (err) -- return err; -- } -- -- if (data[IFLA_CAN_DATA_BITTIMING]) { -- struct can_bittiming dbt; -- -- /* Do not allow changing bittiming while running */ -- if (dev->flags & IFF_UP) -- return -EBUSY; -- -- /* Calculate bittiming parameters based on -- * data_bittiming_const if set, otherwise pass bitrate -- * directly via do_set_bitrate(). Bail out if neither -- * is given. -- */ -- if (!priv->data_bittiming_const && !priv->do_set_data_bittiming) -- return -EOPNOTSUPP; -- -- memcpy(&dbt, nla_data(data[IFLA_CAN_DATA_BITTIMING]), -- sizeof(dbt)); -- err = can_get_bittiming(dev, &dbt, -- priv->data_bittiming_const, -- priv->data_bitrate_const, -- priv->data_bitrate_const_cnt); -- if (err) -- return err; -- -- if (priv->bitrate_max && dbt.bitrate > priv->bitrate_max) { -- netdev_err(dev, "canfd data bitrate surpasses transceiver capabilities of %d bps\n", -- priv->bitrate_max); -- return -EINVAL; -- } -- -- memcpy(&priv->data_bittiming, &dbt, sizeof(dbt)); -- -- if (priv->do_set_data_bittiming) { -- /* Finally, set the bit-timing registers */ -- err = priv->do_set_data_bittiming(dev); -- if (err) -- return err; -- } -- } -- -- if (data[IFLA_CAN_TERMINATION]) { -- const u16 termval = nla_get_u16(data[IFLA_CAN_TERMINATION]); -- const unsigned int num_term = priv->termination_const_cnt; -- unsigned int i; -- -- if (!priv->do_set_termination) -- return -EOPNOTSUPP; -- -- /* check whether given value is supported by the interface */ -- for (i = 0; i < num_term; i++) { -- if (termval == priv->termination_const[i]) -- break; -- } -- if (i >= num_term) -- return -EINVAL; -- -- /* Finally, set the termination value */ -- err = priv->do_set_termination(dev, termval); -- if (err) -- return err; -- -- priv->termination = termval; -- } -- -- return 0; --} -- --static size_t can_get_size(const struct net_device *dev) --{ -- struct can_priv *priv = netdev_priv(dev); -- size_t size = 0; -- -- if (priv->bittiming.bitrate) /* IFLA_CAN_BITTIMING */ -- size += nla_total_size(sizeof(struct can_bittiming)); -- if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */ -- size += nla_total_size(sizeof(struct can_bittiming_const)); -- size += nla_total_size(sizeof(struct can_clock)); /* IFLA_CAN_CLOCK */ -- size += nla_total_size(sizeof(u32)); /* IFLA_CAN_STATE */ -- size += nla_total_size(sizeof(struct can_ctrlmode)); /* IFLA_CAN_CTRLMODE */ -- size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */ -- if (priv->do_get_berr_counter) /* IFLA_CAN_BERR_COUNTER */ -- size += nla_total_size(sizeof(struct can_berr_counter)); -- if (priv->data_bittiming.bitrate) /* IFLA_CAN_DATA_BITTIMING */ -- size += nla_total_size(sizeof(struct can_bittiming)); -- if (priv->data_bittiming_const) /* IFLA_CAN_DATA_BITTIMING_CONST */ -- size += nla_total_size(sizeof(struct can_bittiming_const)); -- if (priv->termination_const) { -- size += nla_total_size(sizeof(priv->termination)); /* IFLA_CAN_TERMINATION */ -- size += nla_total_size(sizeof(*priv->termination_const) * /* IFLA_CAN_TERMINATION_CONST */ -- priv->termination_const_cnt); -- } -- if (priv->bitrate_const) /* IFLA_CAN_BITRATE_CONST */ -- size += nla_total_size(sizeof(*priv->bitrate_const) * -- priv->bitrate_const_cnt); -- if (priv->data_bitrate_const) /* IFLA_CAN_DATA_BITRATE_CONST */ -- size += nla_total_size(sizeof(*priv->data_bitrate_const) * -- priv->data_bitrate_const_cnt); -- size += sizeof(priv->bitrate_max); /* IFLA_CAN_BITRATE_MAX */ -- -- return size; --} -- --static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) --{ -- struct can_priv *priv = netdev_priv(dev); -- struct can_ctrlmode cm = {.flags = priv->ctrlmode}; -- struct can_berr_counter bec = { }; -- enum can_state state = priv->state; -- -- if (priv->do_get_state) -- priv->do_get_state(dev, &state); -- -- if ((priv->bittiming.bitrate && -- nla_put(skb, IFLA_CAN_BITTIMING, -- sizeof(priv->bittiming), &priv->bittiming)) || -- -- (priv->bittiming_const && -- nla_put(skb, IFLA_CAN_BITTIMING_CONST, -- sizeof(*priv->bittiming_const), priv->bittiming_const)) || -- -- nla_put(skb, IFLA_CAN_CLOCK, sizeof(priv->clock), &priv->clock) || -- nla_put_u32(skb, IFLA_CAN_STATE, state) || -- nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) || -- nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) || -- -- (priv->do_get_berr_counter && -- !priv->do_get_berr_counter(dev, &bec) && -- nla_put(skb, IFLA_CAN_BERR_COUNTER, sizeof(bec), &bec)) || -- -- (priv->data_bittiming.bitrate && -- nla_put(skb, IFLA_CAN_DATA_BITTIMING, -- sizeof(priv->data_bittiming), &priv->data_bittiming)) || -- -- (priv->data_bittiming_const && -- nla_put(skb, IFLA_CAN_DATA_BITTIMING_CONST, -- sizeof(*priv->data_bittiming_const), -- priv->data_bittiming_const)) || -- -- (priv->termination_const && -- (nla_put_u16(skb, IFLA_CAN_TERMINATION, priv->termination) || -- nla_put(skb, IFLA_CAN_TERMINATION_CONST, -- sizeof(*priv->termination_const) * -- priv->termination_const_cnt, -- priv->termination_const))) || -- -- (priv->bitrate_const && -- nla_put(skb, IFLA_CAN_BITRATE_CONST, -- sizeof(*priv->bitrate_const) * -- priv->bitrate_const_cnt, -- priv->bitrate_const)) || -- -- (priv->data_bitrate_const && -- nla_put(skb, IFLA_CAN_DATA_BITRATE_CONST, -- sizeof(*priv->data_bitrate_const) * -- priv->data_bitrate_const_cnt, -- priv->data_bitrate_const)) || -- -- (nla_put(skb, IFLA_CAN_BITRATE_MAX, -- sizeof(priv->bitrate_max), -- &priv->bitrate_max)) -- ) -- -- return -EMSGSIZE; -- -- return 0; --} -- --static size_t can_get_xstats_size(const struct net_device *dev) --{ -- return sizeof(struct can_device_stats); --} -- --static int can_fill_xstats(struct sk_buff *skb, const struct net_device *dev) --{ -- struct can_priv *priv = netdev_priv(dev); -- -- if (nla_put(skb, IFLA_INFO_XSTATS, -- sizeof(priv->can_stats), &priv->can_stats)) -- goto nla_put_failure; -- return 0; -- --nla_put_failure: -- return -EMSGSIZE; --} -- --static int can_newlink(struct net *src_net, struct net_device *dev, -- struct nlattr *tb[], struct nlattr *data[], -- struct netlink_ext_ack *extack) --{ -- return -EOPNOTSUPP; --} -- --static void can_dellink(struct net_device *dev, struct list_head *head) --{ --} -- --static struct rtnl_link_ops can_link_ops __read_mostly = { -- .kind = "can", -- .netns_refund = true, -- .maxtype = IFLA_CAN_MAX, -- .policy = can_policy, -- .setup = can_setup, -- .validate = can_validate, -- .newlink = can_newlink, -- .changelink = can_changelink, -- .dellink = can_dellink, -- .get_size = can_get_size, -- .fill_info = can_fill_info, -- .get_xstats_size = can_get_xstats_size, -- .fill_xstats = can_fill_xstats, --}; -- --/* Register the CAN network device */ --int register_candev(struct net_device *dev) --{ -- struct can_priv *priv = netdev_priv(dev); -- -- /* Ensure termination_const, termination_const_cnt and -- * do_set_termination consistency. All must be either set or -- * unset. -- */ -- if ((!priv->termination_const != !priv->termination_const_cnt) || -- (!priv->termination_const != !priv->do_set_termination)) -- return -EINVAL; -- -- if (!priv->bitrate_const != !priv->bitrate_const_cnt) -- return -EINVAL; -- -- if (!priv->data_bitrate_const != !priv->data_bitrate_const_cnt) -- return -EINVAL; -- -- dev->rtnl_link_ops = &can_link_ops; -- netif_carrier_off(dev); -- -- return register_netdev(dev); --} --EXPORT_SYMBOL_GPL(register_candev); -- --/* Unregister the CAN network device */ --void unregister_candev(struct net_device *dev) --{ -- unregister_netdev(dev); --} --EXPORT_SYMBOL_GPL(unregister_candev); -- --/* Test if a network device is a candev based device -- * and return the can_priv* if so. -- */ --struct can_priv *safe_candev_priv(struct net_device *dev) --{ -- if (dev->type != ARPHRD_CAN || dev->rtnl_link_ops != &can_link_ops) -- return NULL; -- -- return netdev_priv(dev); --} --EXPORT_SYMBOL_GPL(safe_candev_priv); -- --static __init int can_dev_init(void) --{ -- int err; -- -- can_led_notifier_init(); -- -- err = rtnl_link_register(&can_link_ops); -- if (!err) -- pr_info(MOD_DESC "\n"); -- -- return err; --} --module_init(can_dev_init); -- --static __exit void can_dev_exit(void) --{ -- rtnl_link_unregister(&can_link_ops); -- -- can_led_notifier_exit(); --} --module_exit(can_dev_exit); -- --MODULE_ALIAS_RTNL_LINK("can"); -diff --git a/drivers/net/can/dev/Makefile b/drivers/net/can/dev/Makefile -new file mode 100644 -index 0000000000000..cba92e6bcf6f5 ---- /dev/null -+++ b/drivers/net/can/dev/Makefile -@@ -0,0 +1,7 @@ -+# SPDX-License-Identifier: GPL-2.0 -+ -+obj-$(CONFIG_CAN_DEV) += can-dev.o -+can-dev-y += dev.o -+can-dev-y += rx-offload.o -+ -+can-dev-$(CONFIG_CAN_LEDS) += led.o -diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c -new file mode 100644 -index 0000000000000..a665afaeccd12 ---- /dev/null -+++ b/drivers/net/can/dev/dev.c -@@ -0,0 +1,1341 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+/* Copyright (C) 2005 Marc Kleine-Budde, Pengutronix -+ * Copyright (C) 2006 Andrey Volkov, Varma Electronics -+ * Copyright (C) 2008-2009 Wolfgang Grandegger -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define MOD_DESC "CAN device driver interface" -+ -+MODULE_DESCRIPTION(MOD_DESC); -+MODULE_LICENSE("GPL v2"); -+MODULE_AUTHOR("Wolfgang Grandegger "); -+ -+/* CAN DLC to real data length conversion helpers */ -+ -+static const u8 dlc2len[] = {0, 1, 2, 3, 4, 5, 6, 7, -+ 8, 12, 16, 20, 24, 32, 48, 64}; -+ -+/* get data length from raw data length code (DLC) */ -+u8 can_fd_dlc2len(u8 dlc) -+{ -+ return dlc2len[dlc & 0x0F]; -+} -+EXPORT_SYMBOL_GPL(can_fd_dlc2len); -+ -+static const u8 len2dlc[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, /* 0 - 8 */ -+ 9, 9, 9, 9, /* 9 - 12 */ -+ 10, 10, 10, 10, /* 13 - 16 */ -+ 11, 11, 11, 11, /* 17 - 20 */ -+ 12, 12, 12, 12, /* 21 - 24 */ -+ 13, 13, 13, 13, 13, 13, 13, 13, /* 25 - 32 */ -+ 14, 14, 14, 14, 14, 14, 14, 14, /* 33 - 40 */ -+ 14, 14, 14, 14, 14, 14, 14, 14, /* 41 - 48 */ -+ 15, 15, 15, 15, 15, 15, 15, 15, /* 49 - 56 */ -+ 15, 15, 15, 15, 15, 15, 15, 15}; /* 57 - 64 */ -+ -+/* map the sanitized data length to an appropriate data length code */ -+u8 can_fd_len2dlc(u8 len) -+{ -+ if (unlikely(len > 64)) -+ return 0xF; -+ -+ return len2dlc[len]; -+} -+EXPORT_SYMBOL_GPL(can_fd_len2dlc); -+ -+#ifdef CONFIG_CAN_CALC_BITTIMING -+#define CAN_CALC_MAX_ERROR 50 /* in one-tenth of a percent */ -+ -+/* Bit-timing calculation derived from: -+ * -+ * Code based on LinCAN sources and H8S2638 project -+ * Copyright 2004-2006 Pavel Pisa - DCE FELK CVUT cz -+ * Copyright 2005 Stanislav Marek -+ * email: pisa@cmp.felk.cvut.cz -+ * -+ * Calculates proper bit-timing parameters for a specified bit-rate -+ * and sample-point, which can then be used to set the bit-timing -+ * registers of the CAN controller. You can find more information -+ * in the header file linux/can/netlink.h. -+ */ -+static int -+can_update_sample_point(const struct can_bittiming_const *btc, -+ unsigned int sample_point_nominal, unsigned int tseg, -+ unsigned int *tseg1_ptr, unsigned int *tseg2_ptr, -+ unsigned int *sample_point_error_ptr) -+{ -+ unsigned int sample_point_error, best_sample_point_error = UINT_MAX; -+ unsigned int sample_point, best_sample_point = 0; -+ unsigned int tseg1, tseg2; -+ int i; -+ -+ for (i = 0; i <= 1; i++) { -+ tseg2 = tseg + CAN_SYNC_SEG - -+ (sample_point_nominal * (tseg + CAN_SYNC_SEG)) / -+ 1000 - i; -+ tseg2 = clamp(tseg2, btc->tseg2_min, btc->tseg2_max); -+ tseg1 = tseg - tseg2; -+ if (tseg1 > btc->tseg1_max) { -+ tseg1 = btc->tseg1_max; -+ tseg2 = tseg - tseg1; -+ } -+ -+ sample_point = 1000 * (tseg + CAN_SYNC_SEG - tseg2) / -+ (tseg + CAN_SYNC_SEG); -+ sample_point_error = abs(sample_point_nominal - sample_point); -+ -+ if (sample_point <= sample_point_nominal && -+ sample_point_error < best_sample_point_error) { -+ best_sample_point = sample_point; -+ best_sample_point_error = sample_point_error; -+ *tseg1_ptr = tseg1; -+ *tseg2_ptr = tseg2; -+ } -+ } -+ -+ if (sample_point_error_ptr) -+ *sample_point_error_ptr = best_sample_point_error; -+ -+ return best_sample_point; -+} -+ -+static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, -+ const struct can_bittiming_const *btc) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ unsigned int bitrate; /* current bitrate */ -+ unsigned int bitrate_error; /* difference between current and nominal value */ -+ unsigned int best_bitrate_error = UINT_MAX; -+ unsigned int sample_point_error; /* difference between current and nominal value */ -+ unsigned int best_sample_point_error = UINT_MAX; -+ unsigned int sample_point_nominal; /* nominal sample point */ -+ unsigned int best_tseg = 0; /* current best value for tseg */ -+ unsigned int best_brp = 0; /* current best value for brp */ -+ unsigned int brp, tsegall, tseg, tseg1 = 0, tseg2 = 0; -+ u64 v64; -+ -+ /* Use CiA recommended sample points */ -+ if (bt->sample_point) { -+ sample_point_nominal = bt->sample_point; -+ } else { -+ if (bt->bitrate > 800000) -+ sample_point_nominal = 750; -+ else if (bt->bitrate > 500000) -+ sample_point_nominal = 800; -+ else -+ sample_point_nominal = 875; -+ } -+ -+ /* tseg even = round down, odd = round up */ -+ for (tseg = (btc->tseg1_max + btc->tseg2_max) * 2 + 1; -+ tseg >= (btc->tseg1_min + btc->tseg2_min) * 2; tseg--) { -+ tsegall = CAN_SYNC_SEG + tseg / 2; -+ -+ /* Compute all possible tseg choices (tseg=tseg1+tseg2) */ -+ brp = priv->clock.freq / (tsegall * bt->bitrate) + tseg % 2; -+ -+ /* choose brp step which is possible in system */ -+ brp = (brp / btc->brp_inc) * btc->brp_inc; -+ if (brp < btc->brp_min || brp > btc->brp_max) -+ continue; -+ -+ bitrate = priv->clock.freq / (brp * tsegall); -+ bitrate_error = abs(bt->bitrate - bitrate); -+ -+ /* tseg brp biterror */ -+ if (bitrate_error > best_bitrate_error) -+ continue; -+ -+ /* reset sample point error if we have a better bitrate */ -+ if (bitrate_error < best_bitrate_error) -+ best_sample_point_error = UINT_MAX; -+ -+ can_update_sample_point(btc, sample_point_nominal, tseg / 2, -+ &tseg1, &tseg2, &sample_point_error); -+ if (sample_point_error > best_sample_point_error) -+ continue; -+ -+ best_sample_point_error = sample_point_error; -+ best_bitrate_error = bitrate_error; -+ best_tseg = tseg / 2; -+ best_brp = brp; -+ -+ if (bitrate_error == 0 && sample_point_error == 0) -+ break; -+ } -+ -+ if (best_bitrate_error) { -+ /* Error in one-tenth of a percent */ -+ v64 = (u64)best_bitrate_error * 1000; -+ do_div(v64, bt->bitrate); -+ bitrate_error = (u32)v64; -+ if (bitrate_error > CAN_CALC_MAX_ERROR) { -+ netdev_err(dev, -+ "bitrate error %d.%d%% too high\n", -+ bitrate_error / 10, bitrate_error % 10); -+ return -EDOM; -+ } -+ netdev_warn(dev, "bitrate error %d.%d%%\n", -+ bitrate_error / 10, bitrate_error % 10); -+ } -+ -+ /* real sample point */ -+ bt->sample_point = can_update_sample_point(btc, sample_point_nominal, -+ best_tseg, &tseg1, &tseg2, -+ NULL); -+ -+ v64 = (u64)best_brp * 1000 * 1000 * 1000; -+ do_div(v64, priv->clock.freq); -+ bt->tq = (u32)v64; -+ bt->prop_seg = tseg1 / 2; -+ bt->phase_seg1 = tseg1 - bt->prop_seg; -+ bt->phase_seg2 = tseg2; -+ -+ /* check for sjw user settings */ -+ if (!bt->sjw || !btc->sjw_max) { -+ bt->sjw = 1; -+ } else { -+ /* bt->sjw is at least 1 -> sanitize upper bound to sjw_max */ -+ if (bt->sjw > btc->sjw_max) -+ bt->sjw = btc->sjw_max; -+ /* bt->sjw must not be higher than tseg2 */ -+ if (tseg2 < bt->sjw) -+ bt->sjw = tseg2; -+ } -+ -+ bt->brp = best_brp; -+ -+ /* real bitrate */ -+ bt->bitrate = priv->clock.freq / -+ (bt->brp * (CAN_SYNC_SEG + tseg1 + tseg2)); -+ -+ return 0; -+} -+#else /* !CONFIG_CAN_CALC_BITTIMING */ -+static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, -+ const struct can_bittiming_const *btc) -+{ -+ netdev_err(dev, "bit-timing calculation not available\n"); -+ return -EINVAL; -+} -+#endif /* CONFIG_CAN_CALC_BITTIMING */ -+ -+/* Checks the validity of the specified bit-timing parameters prop_seg, -+ * phase_seg1, phase_seg2 and sjw and tries to determine the bitrate -+ * prescaler value brp. You can find more information in the header -+ * file linux/can/netlink.h. -+ */ -+static int can_fixup_bittiming(struct net_device *dev, struct can_bittiming *bt, -+ const struct can_bittiming_const *btc) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ int tseg1, alltseg; -+ u64 brp64; -+ -+ tseg1 = bt->prop_seg + bt->phase_seg1; -+ if (!bt->sjw) -+ bt->sjw = 1; -+ if (bt->sjw > btc->sjw_max || -+ tseg1 < btc->tseg1_min || tseg1 > btc->tseg1_max || -+ bt->phase_seg2 < btc->tseg2_min || bt->phase_seg2 > btc->tseg2_max) -+ return -ERANGE; -+ -+ brp64 = (u64)priv->clock.freq * (u64)bt->tq; -+ if (btc->brp_inc > 1) -+ do_div(brp64, btc->brp_inc); -+ brp64 += 500000000UL - 1; -+ do_div(brp64, 1000000000UL); /* the practicable BRP */ -+ if (btc->brp_inc > 1) -+ brp64 *= btc->brp_inc; -+ bt->brp = (u32)brp64; -+ -+ if (bt->brp < btc->brp_min || bt->brp > btc->brp_max) -+ return -EINVAL; -+ -+ alltseg = bt->prop_seg + bt->phase_seg1 + bt->phase_seg2 + 1; -+ bt->bitrate = priv->clock.freq / (bt->brp * alltseg); -+ bt->sample_point = ((tseg1 + 1) * 1000) / alltseg; -+ -+ return 0; -+} -+ -+/* Checks the validity of predefined bitrate settings */ -+static int -+can_validate_bitrate(struct net_device *dev, struct can_bittiming *bt, -+ const u32 *bitrate_const, -+ const unsigned int bitrate_const_cnt) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ unsigned int i; -+ -+ for (i = 0; i < bitrate_const_cnt; i++) { -+ if (bt->bitrate == bitrate_const[i]) -+ break; -+ } -+ -+ if (i >= priv->bitrate_const_cnt) -+ return -EINVAL; -+ -+ return 0; -+} -+ -+static int can_get_bittiming(struct net_device *dev, struct can_bittiming *bt, -+ const struct can_bittiming_const *btc, -+ const u32 *bitrate_const, -+ const unsigned int bitrate_const_cnt) -+{ -+ int err; -+ -+ /* Depending on the given can_bittiming parameter structure the CAN -+ * timing parameters are calculated based on the provided bitrate OR -+ * alternatively the CAN timing parameters (tq, prop_seg, etc.) are -+ * provided directly which are then checked and fixed up. -+ */ -+ if (!bt->tq && bt->bitrate && btc) -+ err = can_calc_bittiming(dev, bt, btc); -+ else if (bt->tq && !bt->bitrate && btc) -+ err = can_fixup_bittiming(dev, bt, btc); -+ else if (!bt->tq && bt->bitrate && bitrate_const) -+ err = can_validate_bitrate(dev, bt, bitrate_const, -+ bitrate_const_cnt); -+ else -+ err = -EINVAL; -+ -+ return err; -+} -+ -+static void can_update_state_error_stats(struct net_device *dev, -+ enum can_state new_state) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ -+ if (new_state <= priv->state) -+ return; -+ -+ switch (new_state) { -+ case CAN_STATE_ERROR_WARNING: -+ priv->can_stats.error_warning++; -+ break; -+ case CAN_STATE_ERROR_PASSIVE: -+ priv->can_stats.error_passive++; -+ break; -+ case CAN_STATE_BUS_OFF: -+ priv->can_stats.bus_off++; -+ break; -+ default: -+ break; -+ } -+} -+ -+static int can_tx_state_to_frame(struct net_device *dev, enum can_state state) -+{ -+ switch (state) { -+ case CAN_STATE_ERROR_ACTIVE: -+ return CAN_ERR_CRTL_ACTIVE; -+ case CAN_STATE_ERROR_WARNING: -+ return CAN_ERR_CRTL_TX_WARNING; -+ case CAN_STATE_ERROR_PASSIVE: -+ return CAN_ERR_CRTL_TX_PASSIVE; -+ default: -+ return 0; -+ } -+} -+ -+static int can_rx_state_to_frame(struct net_device *dev, enum can_state state) -+{ -+ switch (state) { -+ case CAN_STATE_ERROR_ACTIVE: -+ return CAN_ERR_CRTL_ACTIVE; -+ case CAN_STATE_ERROR_WARNING: -+ return CAN_ERR_CRTL_RX_WARNING; -+ case CAN_STATE_ERROR_PASSIVE: -+ return CAN_ERR_CRTL_RX_PASSIVE; -+ default: -+ return 0; -+ } -+} -+ -+static const char *can_get_state_str(const enum can_state state) -+{ -+ switch (state) { -+ case CAN_STATE_ERROR_ACTIVE: -+ return "Error Active"; -+ case CAN_STATE_ERROR_WARNING: -+ return "Error Warning"; -+ case CAN_STATE_ERROR_PASSIVE: -+ return "Error Passive"; -+ case CAN_STATE_BUS_OFF: -+ return "Bus Off"; -+ case CAN_STATE_STOPPED: -+ return "Stopped"; -+ case CAN_STATE_SLEEPING: -+ return "Sleeping"; -+ default: -+ return ""; -+ } -+ -+ return ""; -+} -+ -+void can_change_state(struct net_device *dev, struct can_frame *cf, -+ enum can_state tx_state, enum can_state rx_state) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ enum can_state new_state = max(tx_state, rx_state); -+ -+ if (unlikely(new_state == priv->state)) { -+ netdev_warn(dev, "%s: oops, state did not change", __func__); -+ return; -+ } -+ -+ netdev_dbg(dev, "Controller changed from %s State (%d) into %s State (%d).\n", -+ can_get_state_str(priv->state), priv->state, -+ can_get_state_str(new_state), new_state); -+ -+ can_update_state_error_stats(dev, new_state); -+ priv->state = new_state; -+ -+ if (!cf) -+ return; -+ -+ if (unlikely(new_state == CAN_STATE_BUS_OFF)) { -+ cf->can_id |= CAN_ERR_BUSOFF; -+ return; -+ } -+ -+ cf->can_id |= CAN_ERR_CRTL; -+ cf->data[1] |= tx_state >= rx_state ? -+ can_tx_state_to_frame(dev, tx_state) : 0; -+ cf->data[1] |= tx_state <= rx_state ? -+ can_rx_state_to_frame(dev, rx_state) : 0; -+} -+EXPORT_SYMBOL_GPL(can_change_state); -+ -+/* Local echo of CAN messages -+ * -+ * CAN network devices *should* support a local echo functionality -+ * (see Documentation/networking/can.rst). To test the handling of CAN -+ * interfaces that do not support the local echo both driver types are -+ * implemented. In the case that the driver does not support the echo -+ * the IFF_ECHO remains clear in dev->flags. This causes the PF_CAN core -+ * to perform the echo as a fallback solution. -+ */ -+static void can_flush_echo_skb(struct net_device *dev) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ struct net_device_stats *stats = &dev->stats; -+ int i; -+ -+ for (i = 0; i < priv->echo_skb_max; i++) { -+ if (priv->echo_skb[i]) { -+ kfree_skb(priv->echo_skb[i]); -+ priv->echo_skb[i] = NULL; -+ stats->tx_dropped++; -+ stats->tx_aborted_errors++; -+ } -+ } -+} -+ -+/* Put the skb on the stack to be looped backed locally lateron -+ * -+ * The function is typically called in the start_xmit function -+ * of the device driver. The driver must protect access to -+ * priv->echo_skb, if necessary. -+ */ -+int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, -+ unsigned int idx) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ -+ BUG_ON(idx >= priv->echo_skb_max); -+ -+ /* check flag whether this packet has to be looped back */ -+ if (!(dev->flags & IFF_ECHO) || skb->pkt_type != PACKET_LOOPBACK || -+ (skb->protocol != htons(ETH_P_CAN) && -+ skb->protocol != htons(ETH_P_CANFD))) { -+ kfree_skb(skb); -+ return 0; -+ } -+ -+ if (!priv->echo_skb[idx]) { -+ skb = can_create_echo_skb(skb); -+ if (!skb) -+ return -ENOMEM; -+ -+ /* make settings for echo to reduce code in irq context */ -+ skb->pkt_type = PACKET_BROADCAST; -+ skb->ip_summed = CHECKSUM_UNNECESSARY; -+ skb->dev = dev; -+ -+ /* save this skb for tx interrupt echo handling */ -+ priv->echo_skb[idx] = skb; -+ } else { -+ /* locking problem with netif_stop_queue() ?? */ -+ netdev_err(dev, "%s: BUG! echo_skb %d is occupied!\n", __func__, idx); -+ kfree_skb(skb); -+ return -EBUSY; -+ } -+ -+ return 0; -+} -+EXPORT_SYMBOL_GPL(can_put_echo_skb); -+ -+struct sk_buff * -+__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ -+ if (idx >= priv->echo_skb_max) { -+ netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", -+ __func__, idx, priv->echo_skb_max); -+ return NULL; -+ } -+ -+ if (priv->echo_skb[idx]) { -+ /* Using "struct canfd_frame::len" for the frame -+ * length is supported on both CAN and CANFD frames. -+ */ -+ struct sk_buff *skb = priv->echo_skb[idx]; -+ struct canfd_frame *cf = (struct canfd_frame *)skb->data; -+ -+ /* get the real payload length for netdev statistics */ -+ if (cf->can_id & CAN_RTR_FLAG) -+ *len_ptr = 0; -+ else -+ *len_ptr = cf->len; -+ -+ priv->echo_skb[idx] = NULL; -+ -+ return skb; -+ } -+ -+ return NULL; -+} -+ -+/* Get the skb from the stack and loop it back locally -+ * -+ * The function is typically called when the TX done interrupt -+ * is handled in the device driver. The driver must protect -+ * access to priv->echo_skb, if necessary. -+ */ -+unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx) -+{ -+ struct sk_buff *skb; -+ u8 len; -+ -+ skb = __can_get_echo_skb(dev, idx, &len); -+ if (!skb) -+ return 0; -+ -+ skb_get(skb); -+ if (netif_rx(skb) == NET_RX_SUCCESS) -+ dev_consume_skb_any(skb); -+ else -+ dev_kfree_skb_any(skb); -+ -+ return len; -+} -+EXPORT_SYMBOL_GPL(can_get_echo_skb); -+ -+/* Remove the skb from the stack and free it. -+ * -+ * The function is typically called when TX failed. -+ */ -+void can_free_echo_skb(struct net_device *dev, unsigned int idx) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ -+ BUG_ON(idx >= priv->echo_skb_max); -+ -+ if (priv->echo_skb[idx]) { -+ dev_kfree_skb_any(priv->echo_skb[idx]); -+ priv->echo_skb[idx] = NULL; -+ } -+} -+EXPORT_SYMBOL_GPL(can_free_echo_skb); -+ -+/* CAN device restart for bus-off recovery */ -+static void can_restart(struct net_device *dev) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ struct net_device_stats *stats = &dev->stats; -+ struct sk_buff *skb; -+ struct can_frame *cf; -+ int err; -+ -+ BUG_ON(netif_carrier_ok(dev)); -+ -+ /* No synchronization needed because the device is bus-off and -+ * no messages can come in or go out. -+ */ -+ can_flush_echo_skb(dev); -+ -+ /* send restart message upstream */ -+ skb = alloc_can_err_skb(dev, &cf); -+ if (!skb) -+ goto restart; -+ -+ cf->can_id |= CAN_ERR_RESTARTED; -+ -+ stats->rx_packets++; -+ stats->rx_bytes += cf->len; -+ -+ netif_rx_ni(skb); -+ -+restart: -+ netdev_dbg(dev, "restarted\n"); -+ priv->can_stats.restarts++; -+ -+ /* Now restart the device */ -+ err = priv->do_set_mode(dev, CAN_MODE_START); -+ -+ netif_carrier_on(dev); -+ if (err) -+ netdev_err(dev, "Error %d during restart", err); -+} -+ -+static void can_restart_work(struct work_struct *work) -+{ -+ struct delayed_work *dwork = to_delayed_work(work); -+ struct can_priv *priv = container_of(dwork, struct can_priv, -+ restart_work); -+ -+ can_restart(priv->dev); -+} -+ -+int can_restart_now(struct net_device *dev) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ -+ /* A manual restart is only permitted if automatic restart is -+ * disabled and the device is in the bus-off state -+ */ -+ if (priv->restart_ms) -+ return -EINVAL; -+ if (priv->state != CAN_STATE_BUS_OFF) -+ return -EBUSY; -+ -+ cancel_delayed_work_sync(&priv->restart_work); -+ can_restart(dev); -+ -+ return 0; -+} -+ -+/* CAN bus-off -+ * -+ * This functions should be called when the device goes bus-off to -+ * tell the netif layer that no more packets can be sent or received. -+ * If enabled, a timer is started to trigger bus-off recovery. -+ */ -+void can_bus_off(struct net_device *dev) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ -+ if (priv->restart_ms) -+ netdev_info(dev, "bus-off, scheduling restart in %d ms\n", -+ priv->restart_ms); -+ else -+ netdev_info(dev, "bus-off\n"); -+ -+ netif_carrier_off(dev); -+ -+ if (priv->restart_ms) -+ schedule_delayed_work(&priv->restart_work, -+ msecs_to_jiffies(priv->restart_ms)); -+} -+EXPORT_SYMBOL_GPL(can_bus_off); -+ -+static void can_setup(struct net_device *dev) -+{ -+ dev->type = ARPHRD_CAN; -+ dev->mtu = CAN_MTU; -+ dev->hard_header_len = 0; -+ dev->addr_len = 0; -+ dev->tx_queue_len = 10; -+ -+ /* New-style flags. */ -+ dev->flags = IFF_NOARP; -+ dev->features = NETIF_F_HW_CSUM; -+} -+ -+struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) -+{ -+ struct sk_buff *skb; -+ -+ skb = netdev_alloc_skb(dev, sizeof(struct can_skb_priv) + -+ sizeof(struct can_frame)); -+ if (unlikely(!skb)) -+ return NULL; -+ -+ skb->protocol = htons(ETH_P_CAN); -+ skb->pkt_type = PACKET_BROADCAST; -+ skb->ip_summed = CHECKSUM_UNNECESSARY; -+ -+ skb_reset_mac_header(skb); -+ skb_reset_network_header(skb); -+ skb_reset_transport_header(skb); -+ -+ can_skb_reserve(skb); -+ can_skb_prv(skb)->ifindex = dev->ifindex; -+ can_skb_prv(skb)->skbcnt = 0; -+ -+ *cf = skb_put_zero(skb, sizeof(struct can_frame)); -+ -+ return skb; -+} -+EXPORT_SYMBOL_GPL(alloc_can_skb); -+ -+struct sk_buff *alloc_canfd_skb(struct net_device *dev, -+ struct canfd_frame **cfd) -+{ -+ struct sk_buff *skb; -+ -+ skb = netdev_alloc_skb(dev, sizeof(struct can_skb_priv) + -+ sizeof(struct canfd_frame)); -+ if (unlikely(!skb)) -+ return NULL; -+ -+ skb->protocol = htons(ETH_P_CANFD); -+ skb->pkt_type = PACKET_BROADCAST; -+ skb->ip_summed = CHECKSUM_UNNECESSARY; -+ -+ skb_reset_mac_header(skb); -+ skb_reset_network_header(skb); -+ skb_reset_transport_header(skb); -+ -+ can_skb_reserve(skb); -+ can_skb_prv(skb)->ifindex = dev->ifindex; -+ can_skb_prv(skb)->skbcnt = 0; -+ -+ *cfd = skb_put_zero(skb, sizeof(struct canfd_frame)); -+ -+ return skb; -+} -+EXPORT_SYMBOL_GPL(alloc_canfd_skb); -+ -+struct sk_buff *alloc_can_err_skb(struct net_device *dev, struct can_frame **cf) -+{ -+ struct sk_buff *skb; -+ -+ skb = alloc_can_skb(dev, cf); -+ if (unlikely(!skb)) -+ return NULL; -+ -+ (*cf)->can_id = CAN_ERR_FLAG; -+ (*cf)->len = CAN_ERR_DLC; -+ -+ return skb; -+} -+EXPORT_SYMBOL_GPL(alloc_can_err_skb); -+ -+/* Allocate and setup space for the CAN network device */ -+struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max, -+ unsigned int txqs, unsigned int rxqs) -+{ -+ struct can_ml_priv *can_ml; -+ struct net_device *dev; -+ struct can_priv *priv; -+ int size; -+ -+ /* We put the driver's priv, the CAN mid layer priv and the -+ * echo skb into the netdevice's priv. The memory layout for -+ * the netdev_priv is like this: -+ * -+ * +-------------------------+ -+ * | driver's priv | -+ * +-------------------------+ -+ * | struct can_ml_priv | -+ * +-------------------------+ -+ * | array of struct sk_buff | -+ * +-------------------------+ -+ */ -+ -+ size = ALIGN(sizeof_priv, NETDEV_ALIGN) + sizeof(struct can_ml_priv); -+ -+ if (echo_skb_max) -+ size = ALIGN(size, sizeof(struct sk_buff *)) + -+ echo_skb_max * sizeof(struct sk_buff *); -+ -+ dev = alloc_netdev_mqs(size, "can%d", NET_NAME_UNKNOWN, can_setup, -+ txqs, rxqs); -+ if (!dev) -+ return NULL; -+ -+ priv = netdev_priv(dev); -+ priv->dev = dev; -+ -+ can_ml = (void *)priv + ALIGN(sizeof_priv, NETDEV_ALIGN); -+ can_set_ml_priv(dev, can_ml); -+ -+ if (echo_skb_max) { -+ priv->echo_skb_max = echo_skb_max; -+ priv->echo_skb = (void *)priv + -+ (size - echo_skb_max * sizeof(struct sk_buff *)); -+ } -+ -+ priv->state = CAN_STATE_STOPPED; -+ -+ INIT_DELAYED_WORK(&priv->restart_work, can_restart_work); -+ -+ return dev; -+} -+EXPORT_SYMBOL_GPL(alloc_candev_mqs); -+ -+/* Free space of the CAN network device */ -+void free_candev(struct net_device *dev) -+{ -+ free_netdev(dev); -+} -+EXPORT_SYMBOL_GPL(free_candev); -+ -+/* changing MTU and control mode for CAN/CANFD devices */ -+int can_change_mtu(struct net_device *dev, int new_mtu) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ -+ /* Do not allow changing the MTU while running */ -+ if (dev->flags & IFF_UP) -+ return -EBUSY; -+ -+ /* allow change of MTU according to the CANFD ability of the device */ -+ switch (new_mtu) { -+ case CAN_MTU: -+ /* 'CANFD-only' controllers can not switch to CAN_MTU */ -+ if (priv->ctrlmode_static & CAN_CTRLMODE_FD) -+ return -EINVAL; -+ -+ priv->ctrlmode &= ~CAN_CTRLMODE_FD; -+ break; -+ -+ case CANFD_MTU: -+ /* check for potential CANFD ability */ -+ if (!(priv->ctrlmode_supported & CAN_CTRLMODE_FD) && -+ !(priv->ctrlmode_static & CAN_CTRLMODE_FD)) -+ return -EINVAL; -+ -+ priv->ctrlmode |= CAN_CTRLMODE_FD; -+ break; -+ -+ default: -+ return -EINVAL; -+ } -+ -+ dev->mtu = new_mtu; -+ return 0; -+} -+EXPORT_SYMBOL_GPL(can_change_mtu); -+ -+/* Common open function when the device gets opened. -+ * -+ * This function should be called in the open function of the device -+ * driver. -+ */ -+int open_candev(struct net_device *dev) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ -+ if (!priv->bittiming.bitrate) { -+ netdev_err(dev, "bit-timing not yet defined\n"); -+ return -EINVAL; -+ } -+ -+ /* For CAN FD the data bitrate has to be >= the arbitration bitrate */ -+ if ((priv->ctrlmode & CAN_CTRLMODE_FD) && -+ (!priv->data_bittiming.bitrate || -+ priv->data_bittiming.bitrate < priv->bittiming.bitrate)) { -+ netdev_err(dev, "incorrect/missing data bit-timing\n"); -+ return -EINVAL; -+ } -+ -+ /* Switch carrier on if device was stopped while in bus-off state */ -+ if (!netif_carrier_ok(dev)) -+ netif_carrier_on(dev); -+ -+ return 0; -+} -+EXPORT_SYMBOL_GPL(open_candev); -+ -+#ifdef CONFIG_OF -+/* Common function that can be used to understand the limitation of -+ * a transceiver when it provides no means to determine these limitations -+ * at runtime. -+ */ -+void of_can_transceiver(struct net_device *dev) -+{ -+ struct device_node *dn; -+ struct can_priv *priv = netdev_priv(dev); -+ struct device_node *np = dev->dev.parent->of_node; -+ int ret; -+ -+ dn = of_get_child_by_name(np, "can-transceiver"); -+ if (!dn) -+ return; -+ -+ ret = of_property_read_u32(dn, "max-bitrate", &priv->bitrate_max); -+ of_node_put(dn); -+ if ((ret && ret != -EINVAL) || (!ret && !priv->bitrate_max)) -+ netdev_warn(dev, "Invalid value for transceiver max bitrate. Ignoring bitrate limit.\n"); -+} -+EXPORT_SYMBOL_GPL(of_can_transceiver); -+#endif -+ -+/* Common close function for cleanup before the device gets closed. -+ * -+ * This function should be called in the close function of the device -+ * driver. -+ */ -+void close_candev(struct net_device *dev) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ -+ cancel_delayed_work_sync(&priv->restart_work); -+ can_flush_echo_skb(dev); -+} -+EXPORT_SYMBOL_GPL(close_candev); -+ -+/* CAN netlink interface */ -+static const struct nla_policy can_policy[IFLA_CAN_MAX + 1] = { -+ [IFLA_CAN_STATE] = { .type = NLA_U32 }, -+ [IFLA_CAN_CTRLMODE] = { .len = sizeof(struct can_ctrlmode) }, -+ [IFLA_CAN_RESTART_MS] = { .type = NLA_U32 }, -+ [IFLA_CAN_RESTART] = { .type = NLA_U32 }, -+ [IFLA_CAN_BITTIMING] = { .len = sizeof(struct can_bittiming) }, -+ [IFLA_CAN_BITTIMING_CONST] -+ = { .len = sizeof(struct can_bittiming_const) }, -+ [IFLA_CAN_CLOCK] = { .len = sizeof(struct can_clock) }, -+ [IFLA_CAN_BERR_COUNTER] = { .len = sizeof(struct can_berr_counter) }, -+ [IFLA_CAN_DATA_BITTIMING] -+ = { .len = sizeof(struct can_bittiming) }, -+ [IFLA_CAN_DATA_BITTIMING_CONST] -+ = { .len = sizeof(struct can_bittiming_const) }, -+ [IFLA_CAN_TERMINATION] = { .type = NLA_U16 }, -+}; -+ -+static int can_validate(struct nlattr *tb[], struct nlattr *data[], -+ struct netlink_ext_ack *extack) -+{ -+ bool is_can_fd = false; -+ -+ /* Make sure that valid CAN FD configurations always consist of -+ * - nominal/arbitration bittiming -+ * - data bittiming -+ * - control mode with CAN_CTRLMODE_FD set -+ */ -+ -+ if (!data) -+ return 0; -+ -+ if (data[IFLA_CAN_CTRLMODE]) { -+ struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]); -+ -+ is_can_fd = cm->flags & cm->mask & CAN_CTRLMODE_FD; -+ } -+ -+ if (is_can_fd) { -+ if (!data[IFLA_CAN_BITTIMING] || !data[IFLA_CAN_DATA_BITTIMING]) -+ return -EOPNOTSUPP; -+ } -+ -+ if (data[IFLA_CAN_DATA_BITTIMING]) { -+ if (!is_can_fd || !data[IFLA_CAN_BITTIMING]) -+ return -EOPNOTSUPP; -+ } -+ -+ return 0; -+} -+ -+static int can_changelink(struct net_device *dev, struct nlattr *tb[], -+ struct nlattr *data[], -+ struct netlink_ext_ack *extack) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ int err; -+ -+ /* We need synchronization with dev->stop() */ -+ ASSERT_RTNL(); -+ -+ if (data[IFLA_CAN_BITTIMING]) { -+ struct can_bittiming bt; -+ -+ /* Do not allow changing bittiming while running */ -+ if (dev->flags & IFF_UP) -+ return -EBUSY; -+ -+ /* Calculate bittiming parameters based on -+ * bittiming_const if set, otherwise pass bitrate -+ * directly via do_set_bitrate(). Bail out if neither -+ * is given. -+ */ -+ if (!priv->bittiming_const && !priv->do_set_bittiming) -+ return -EOPNOTSUPP; -+ -+ memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); -+ err = can_get_bittiming(dev, &bt, -+ priv->bittiming_const, -+ priv->bitrate_const, -+ priv->bitrate_const_cnt); -+ if (err) -+ return err; -+ -+ if (priv->bitrate_max && bt.bitrate > priv->bitrate_max) { -+ netdev_err(dev, "arbitration bitrate surpasses transceiver capabilities of %d bps\n", -+ priv->bitrate_max); -+ return -EINVAL; -+ } -+ -+ memcpy(&priv->bittiming, &bt, sizeof(bt)); -+ -+ if (priv->do_set_bittiming) { -+ /* Finally, set the bit-timing registers */ -+ err = priv->do_set_bittiming(dev); -+ if (err) -+ return err; -+ } -+ } -+ -+ if (data[IFLA_CAN_CTRLMODE]) { -+ struct can_ctrlmode *cm; -+ u32 ctrlstatic; -+ u32 maskedflags; -+ -+ /* Do not allow changing controller mode while running */ -+ if (dev->flags & IFF_UP) -+ return -EBUSY; -+ cm = nla_data(data[IFLA_CAN_CTRLMODE]); -+ ctrlstatic = priv->ctrlmode_static; -+ maskedflags = cm->flags & cm->mask; -+ -+ /* check whether provided bits are allowed to be passed */ -+ if (cm->mask & ~(priv->ctrlmode_supported | ctrlstatic)) -+ return -EOPNOTSUPP; -+ -+ /* do not check for static fd-non-iso if 'fd' is disabled */ -+ if (!(maskedflags & CAN_CTRLMODE_FD)) -+ ctrlstatic &= ~CAN_CTRLMODE_FD_NON_ISO; -+ -+ /* make sure static options are provided by configuration */ -+ if ((maskedflags & ctrlstatic) != ctrlstatic) -+ return -EOPNOTSUPP; -+ -+ /* clear bits to be modified and copy the flag values */ -+ priv->ctrlmode &= ~cm->mask; -+ priv->ctrlmode |= maskedflags; -+ -+ /* CAN_CTRLMODE_FD can only be set when driver supports FD */ -+ if (priv->ctrlmode & CAN_CTRLMODE_FD) -+ dev->mtu = CANFD_MTU; -+ else -+ dev->mtu = CAN_MTU; -+ } -+ -+ if (data[IFLA_CAN_RESTART_MS]) { -+ /* Do not allow changing restart delay while running */ -+ if (dev->flags & IFF_UP) -+ return -EBUSY; -+ priv->restart_ms = nla_get_u32(data[IFLA_CAN_RESTART_MS]); -+ } -+ -+ if (data[IFLA_CAN_RESTART]) { -+ /* Do not allow a restart while not running */ -+ if (!(dev->flags & IFF_UP)) -+ return -EINVAL; -+ err = can_restart_now(dev); -+ if (err) -+ return err; -+ } -+ -+ if (data[IFLA_CAN_DATA_BITTIMING]) { -+ struct can_bittiming dbt; -+ -+ /* Do not allow changing bittiming while running */ -+ if (dev->flags & IFF_UP) -+ return -EBUSY; -+ -+ /* Calculate bittiming parameters based on -+ * data_bittiming_const if set, otherwise pass bitrate -+ * directly via do_set_bitrate(). Bail out if neither -+ * is given. -+ */ -+ if (!priv->data_bittiming_const && !priv->do_set_data_bittiming) -+ return -EOPNOTSUPP; -+ -+ memcpy(&dbt, nla_data(data[IFLA_CAN_DATA_BITTIMING]), -+ sizeof(dbt)); -+ err = can_get_bittiming(dev, &dbt, -+ priv->data_bittiming_const, -+ priv->data_bitrate_const, -+ priv->data_bitrate_const_cnt); -+ if (err) -+ return err; -+ -+ if (priv->bitrate_max && dbt.bitrate > priv->bitrate_max) { -+ netdev_err(dev, "canfd data bitrate surpasses transceiver capabilities of %d bps\n", -+ priv->bitrate_max); -+ return -EINVAL; -+ } -+ -+ memcpy(&priv->data_bittiming, &dbt, sizeof(dbt)); -+ -+ if (priv->do_set_data_bittiming) { -+ /* Finally, set the bit-timing registers */ -+ err = priv->do_set_data_bittiming(dev); -+ if (err) -+ return err; -+ } -+ } -+ -+ if (data[IFLA_CAN_TERMINATION]) { -+ const u16 termval = nla_get_u16(data[IFLA_CAN_TERMINATION]); -+ const unsigned int num_term = priv->termination_const_cnt; -+ unsigned int i; -+ -+ if (!priv->do_set_termination) -+ return -EOPNOTSUPP; -+ -+ /* check whether given value is supported by the interface */ -+ for (i = 0; i < num_term; i++) { -+ if (termval == priv->termination_const[i]) -+ break; -+ } -+ if (i >= num_term) -+ return -EINVAL; -+ -+ /* Finally, set the termination value */ -+ err = priv->do_set_termination(dev, termval); -+ if (err) -+ return err; -+ -+ priv->termination = termval; -+ } -+ -+ return 0; -+} -+ -+static size_t can_get_size(const struct net_device *dev) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ size_t size = 0; -+ -+ if (priv->bittiming.bitrate) /* IFLA_CAN_BITTIMING */ -+ size += nla_total_size(sizeof(struct can_bittiming)); -+ if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */ -+ size += nla_total_size(sizeof(struct can_bittiming_const)); -+ size += nla_total_size(sizeof(struct can_clock)); /* IFLA_CAN_CLOCK */ -+ size += nla_total_size(sizeof(u32)); /* IFLA_CAN_STATE */ -+ size += nla_total_size(sizeof(struct can_ctrlmode)); /* IFLA_CAN_CTRLMODE */ -+ size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */ -+ if (priv->do_get_berr_counter) /* IFLA_CAN_BERR_COUNTER */ -+ size += nla_total_size(sizeof(struct can_berr_counter)); -+ if (priv->data_bittiming.bitrate) /* IFLA_CAN_DATA_BITTIMING */ -+ size += nla_total_size(sizeof(struct can_bittiming)); -+ if (priv->data_bittiming_const) /* IFLA_CAN_DATA_BITTIMING_CONST */ -+ size += nla_total_size(sizeof(struct can_bittiming_const)); -+ if (priv->termination_const) { -+ size += nla_total_size(sizeof(priv->termination)); /* IFLA_CAN_TERMINATION */ -+ size += nla_total_size(sizeof(*priv->termination_const) * /* IFLA_CAN_TERMINATION_CONST */ -+ priv->termination_const_cnt); -+ } -+ if (priv->bitrate_const) /* IFLA_CAN_BITRATE_CONST */ -+ size += nla_total_size(sizeof(*priv->bitrate_const) * -+ priv->bitrate_const_cnt); -+ if (priv->data_bitrate_const) /* IFLA_CAN_DATA_BITRATE_CONST */ -+ size += nla_total_size(sizeof(*priv->data_bitrate_const) * -+ priv->data_bitrate_const_cnt); -+ size += sizeof(priv->bitrate_max); /* IFLA_CAN_BITRATE_MAX */ -+ -+ return size; -+} -+ -+static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ struct can_ctrlmode cm = {.flags = priv->ctrlmode}; -+ struct can_berr_counter bec = { }; -+ enum can_state state = priv->state; -+ -+ if (priv->do_get_state) -+ priv->do_get_state(dev, &state); -+ -+ if ((priv->bittiming.bitrate && -+ nla_put(skb, IFLA_CAN_BITTIMING, -+ sizeof(priv->bittiming), &priv->bittiming)) || -+ -+ (priv->bittiming_const && -+ nla_put(skb, IFLA_CAN_BITTIMING_CONST, -+ sizeof(*priv->bittiming_const), priv->bittiming_const)) || -+ -+ nla_put(skb, IFLA_CAN_CLOCK, sizeof(priv->clock), &priv->clock) || -+ nla_put_u32(skb, IFLA_CAN_STATE, state) || -+ nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) || -+ nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) || -+ -+ (priv->do_get_berr_counter && -+ !priv->do_get_berr_counter(dev, &bec) && -+ nla_put(skb, IFLA_CAN_BERR_COUNTER, sizeof(bec), &bec)) || -+ -+ (priv->data_bittiming.bitrate && -+ nla_put(skb, IFLA_CAN_DATA_BITTIMING, -+ sizeof(priv->data_bittiming), &priv->data_bittiming)) || -+ -+ (priv->data_bittiming_const && -+ nla_put(skb, IFLA_CAN_DATA_BITTIMING_CONST, -+ sizeof(*priv->data_bittiming_const), -+ priv->data_bittiming_const)) || -+ -+ (priv->termination_const && -+ (nla_put_u16(skb, IFLA_CAN_TERMINATION, priv->termination) || -+ nla_put(skb, IFLA_CAN_TERMINATION_CONST, -+ sizeof(*priv->termination_const) * -+ priv->termination_const_cnt, -+ priv->termination_const))) || -+ -+ (priv->bitrate_const && -+ nla_put(skb, IFLA_CAN_BITRATE_CONST, -+ sizeof(*priv->bitrate_const) * -+ priv->bitrate_const_cnt, -+ priv->bitrate_const)) || -+ -+ (priv->data_bitrate_const && -+ nla_put(skb, IFLA_CAN_DATA_BITRATE_CONST, -+ sizeof(*priv->data_bitrate_const) * -+ priv->data_bitrate_const_cnt, -+ priv->data_bitrate_const)) || -+ -+ (nla_put(skb, IFLA_CAN_BITRATE_MAX, -+ sizeof(priv->bitrate_max), -+ &priv->bitrate_max)) -+ ) -+ -+ return -EMSGSIZE; -+ -+ return 0; -+} -+ -+static size_t can_get_xstats_size(const struct net_device *dev) -+{ -+ return sizeof(struct can_device_stats); -+} -+ -+static int can_fill_xstats(struct sk_buff *skb, const struct net_device *dev) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ -+ if (nla_put(skb, IFLA_INFO_XSTATS, -+ sizeof(priv->can_stats), &priv->can_stats)) -+ goto nla_put_failure; -+ return 0; -+ -+nla_put_failure: -+ return -EMSGSIZE; -+} -+ -+static int can_newlink(struct net *src_net, struct net_device *dev, -+ struct nlattr *tb[], struct nlattr *data[], -+ struct netlink_ext_ack *extack) -+{ -+ return -EOPNOTSUPP; -+} -+ -+static void can_dellink(struct net_device *dev, struct list_head *head) -+{ -+} -+ -+static struct rtnl_link_ops can_link_ops __read_mostly = { -+ .kind = "can", -+ .netns_refund = true, -+ .maxtype = IFLA_CAN_MAX, -+ .policy = can_policy, -+ .setup = can_setup, -+ .validate = can_validate, -+ .newlink = can_newlink, -+ .changelink = can_changelink, -+ .dellink = can_dellink, -+ .get_size = can_get_size, -+ .fill_info = can_fill_info, -+ .get_xstats_size = can_get_xstats_size, -+ .fill_xstats = can_fill_xstats, -+}; -+ -+/* Register the CAN network device */ -+int register_candev(struct net_device *dev) -+{ -+ struct can_priv *priv = netdev_priv(dev); -+ -+ /* Ensure termination_const, termination_const_cnt and -+ * do_set_termination consistency. All must be either set or -+ * unset. -+ */ -+ if ((!priv->termination_const != !priv->termination_const_cnt) || -+ (!priv->termination_const != !priv->do_set_termination)) -+ return -EINVAL; -+ -+ if (!priv->bitrate_const != !priv->bitrate_const_cnt) -+ return -EINVAL; -+ -+ if (!priv->data_bitrate_const != !priv->data_bitrate_const_cnt) -+ return -EINVAL; -+ -+ dev->rtnl_link_ops = &can_link_ops; -+ netif_carrier_off(dev); -+ -+ return register_netdev(dev); -+} -+EXPORT_SYMBOL_GPL(register_candev); -+ -+/* Unregister the CAN network device */ -+void unregister_candev(struct net_device *dev) -+{ -+ unregister_netdev(dev); -+} -+EXPORT_SYMBOL_GPL(unregister_candev); -+ -+/* Test if a network device is a candev based device -+ * and return the can_priv* if so. -+ */ -+struct can_priv *safe_candev_priv(struct net_device *dev) -+{ -+ if (dev->type != ARPHRD_CAN || dev->rtnl_link_ops != &can_link_ops) -+ return NULL; -+ -+ return netdev_priv(dev); -+} -+EXPORT_SYMBOL_GPL(safe_candev_priv); -+ -+static __init int can_dev_init(void) -+{ -+ int err; -+ -+ can_led_notifier_init(); -+ -+ err = rtnl_link_register(&can_link_ops); -+ if (!err) -+ pr_info(MOD_DESC "\n"); -+ -+ return err; -+} -+module_init(can_dev_init); -+ -+static __exit void can_dev_exit(void) -+{ -+ rtnl_link_unregister(&can_link_ops); -+ -+ can_led_notifier_exit(); -+} -+module_exit(can_dev_exit); -+ -+MODULE_ALIAS_RTNL_LINK("can"); -diff --git a/drivers/net/can/dev/rx-offload.c b/drivers/net/can/dev/rx-offload.c -new file mode 100644 -index 0000000000000..3c1912c0430b6 ---- /dev/null -+++ b/drivers/net/can/dev/rx-offload.c -@@ -0,0 +1,376 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+/* Copyright (c) 2014 Protonic Holland, -+ * David Jander -+ * Copyright (C) 2014-2017 Pengutronix, -+ * Marc Kleine-Budde -+ */ -+ -+#include -+#include -+ -+struct can_rx_offload_cb { -+ u32 timestamp; -+}; -+ -+static inline struct can_rx_offload_cb * -+can_rx_offload_get_cb(struct sk_buff *skb) -+{ -+ BUILD_BUG_ON(sizeof(struct can_rx_offload_cb) > sizeof(skb->cb)); -+ -+ return (struct can_rx_offload_cb *)skb->cb; -+} -+ -+static inline bool -+can_rx_offload_le(struct can_rx_offload *offload, -+ unsigned int a, unsigned int b) -+{ -+ if (offload->inc) -+ return a <= b; -+ else -+ return a >= b; -+} -+ -+static inline unsigned int -+can_rx_offload_inc(struct can_rx_offload *offload, unsigned int *val) -+{ -+ if (offload->inc) -+ return (*val)++; -+ else -+ return (*val)--; -+} -+ -+static int can_rx_offload_napi_poll(struct napi_struct *napi, int quota) -+{ -+ struct can_rx_offload *offload = container_of(napi, -+ struct can_rx_offload, -+ napi); -+ struct net_device *dev = offload->dev; -+ struct net_device_stats *stats = &dev->stats; -+ struct sk_buff *skb; -+ int work_done = 0; -+ -+ while ((work_done < quota) && -+ (skb = skb_dequeue(&offload->skb_queue))) { -+ struct can_frame *cf = (struct can_frame *)skb->data; -+ -+ work_done++; -+ stats->rx_packets++; -+ stats->rx_bytes += cf->len; -+ netif_receive_skb(skb); -+ } -+ -+ if (work_done < quota) { -+ napi_complete_done(napi, work_done); -+ -+ /* Check if there was another interrupt */ -+ if (!skb_queue_empty(&offload->skb_queue)) -+ napi_reschedule(&offload->napi); -+ } -+ -+ can_led_event(offload->dev, CAN_LED_EVENT_RX); -+ -+ return work_done; -+} -+ -+static inline void -+__skb_queue_add_sort(struct sk_buff_head *head, struct sk_buff *new, -+ int (*compare)(struct sk_buff *a, struct sk_buff *b)) -+{ -+ struct sk_buff *pos, *insert = NULL; -+ -+ skb_queue_reverse_walk(head, pos) { -+ const struct can_rx_offload_cb *cb_pos, *cb_new; -+ -+ cb_pos = can_rx_offload_get_cb(pos); -+ cb_new = can_rx_offload_get_cb(new); -+ -+ netdev_dbg(new->dev, -+ "%s: pos=0x%08x, new=0x%08x, diff=%10d, queue_len=%d\n", -+ __func__, -+ cb_pos->timestamp, cb_new->timestamp, -+ cb_new->timestamp - cb_pos->timestamp, -+ skb_queue_len(head)); -+ -+ if (compare(pos, new) < 0) -+ continue; -+ insert = pos; -+ break; -+ } -+ if (!insert) -+ __skb_queue_head(head, new); -+ else -+ __skb_queue_after(head, insert, new); -+} -+ -+static int can_rx_offload_compare(struct sk_buff *a, struct sk_buff *b) -+{ -+ const struct can_rx_offload_cb *cb_a, *cb_b; -+ -+ cb_a = can_rx_offload_get_cb(a); -+ cb_b = can_rx_offload_get_cb(b); -+ -+ /* Subtract two u32 and return result as int, to keep -+ * difference steady around the u32 overflow. -+ */ -+ return cb_b->timestamp - cb_a->timestamp; -+} -+ -+/** -+ * can_rx_offload_offload_one() - Read one CAN frame from HW -+ * @offload: pointer to rx_offload context -+ * @n: number of mailbox to read -+ * -+ * The task of this function is to read a CAN frame from mailbox @n -+ * from the device and return the mailbox's content as a struct -+ * sk_buff. -+ * -+ * If the struct can_rx_offload::skb_queue exceeds the maximal queue -+ * length (struct can_rx_offload::skb_queue_len_max) or no skb can be -+ * allocated, the mailbox contents is discarded by reading it into an -+ * overflow buffer. This way the mailbox is marked as free by the -+ * driver. -+ * -+ * Return: A pointer to skb containing the CAN frame on success. -+ * -+ * NULL if the mailbox @n is empty. -+ * -+ * ERR_PTR() in case of an error -+ */ -+static struct sk_buff * -+can_rx_offload_offload_one(struct can_rx_offload *offload, unsigned int n) -+{ -+ struct sk_buff *skb; -+ struct can_rx_offload_cb *cb; -+ bool drop = false; -+ u32 timestamp; -+ -+ /* If queue is full drop frame */ -+ if (unlikely(skb_queue_len(&offload->skb_queue) > -+ offload->skb_queue_len_max)) -+ drop = true; -+ -+ skb = offload->mailbox_read(offload, n, ×tamp, drop); -+ /* Mailbox was empty. */ -+ if (unlikely(!skb)) -+ return NULL; -+ -+ /* There was a problem reading the mailbox, propagate -+ * error value. -+ */ -+ if (IS_ERR(skb)) { -+ offload->dev->stats.rx_dropped++; -+ offload->dev->stats.rx_fifo_errors++; -+ -+ return skb; -+ } -+ -+ /* Mailbox was read. */ -+ cb = can_rx_offload_get_cb(skb); -+ cb->timestamp = timestamp; -+ -+ return skb; -+} -+ -+int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, -+ u64 pending) -+{ -+ struct sk_buff_head skb_queue; -+ unsigned int i; -+ -+ __skb_queue_head_init(&skb_queue); -+ -+ for (i = offload->mb_first; -+ can_rx_offload_le(offload, i, offload->mb_last); -+ can_rx_offload_inc(offload, &i)) { -+ struct sk_buff *skb; -+ -+ if (!(pending & BIT_ULL(i))) -+ continue; -+ -+ skb = can_rx_offload_offload_one(offload, i); -+ if (IS_ERR_OR_NULL(skb)) -+ continue; -+ -+ __skb_queue_add_sort(&skb_queue, skb, can_rx_offload_compare); -+ } -+ -+ if (!skb_queue_empty(&skb_queue)) { -+ unsigned long flags; -+ u32 queue_len; -+ -+ spin_lock_irqsave(&offload->skb_queue.lock, flags); -+ skb_queue_splice_tail(&skb_queue, &offload->skb_queue); -+ spin_unlock_irqrestore(&offload->skb_queue.lock, flags); -+ -+ queue_len = skb_queue_len(&offload->skb_queue); -+ if (queue_len > offload->skb_queue_len_max / 8) -+ netdev_dbg(offload->dev, "%s: queue_len=%d\n", -+ __func__, queue_len); -+ -+ can_rx_offload_schedule(offload); -+ } -+ -+ return skb_queue_len(&skb_queue); -+} -+EXPORT_SYMBOL_GPL(can_rx_offload_irq_offload_timestamp); -+ -+int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload) -+{ -+ struct sk_buff *skb; -+ int received = 0; -+ -+ while (1) { -+ skb = can_rx_offload_offload_one(offload, 0); -+ if (IS_ERR(skb)) -+ continue; -+ if (!skb) -+ break; -+ -+ skb_queue_tail(&offload->skb_queue, skb); -+ received++; -+ } -+ -+ if (received) -+ can_rx_offload_schedule(offload); -+ -+ return received; -+} -+EXPORT_SYMBOL_GPL(can_rx_offload_irq_offload_fifo); -+ -+int can_rx_offload_queue_sorted(struct can_rx_offload *offload, -+ struct sk_buff *skb, u32 timestamp) -+{ -+ struct can_rx_offload_cb *cb; -+ unsigned long flags; -+ -+ if (skb_queue_len(&offload->skb_queue) > -+ offload->skb_queue_len_max) { -+ dev_kfree_skb_any(skb); -+ return -ENOBUFS; -+ } -+ -+ cb = can_rx_offload_get_cb(skb); -+ cb->timestamp = timestamp; -+ -+ spin_lock_irqsave(&offload->skb_queue.lock, flags); -+ __skb_queue_add_sort(&offload->skb_queue, skb, can_rx_offload_compare); -+ spin_unlock_irqrestore(&offload->skb_queue.lock, flags); -+ -+ can_rx_offload_schedule(offload); -+ -+ return 0; -+} -+EXPORT_SYMBOL_GPL(can_rx_offload_queue_sorted); -+ -+unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload, -+ unsigned int idx, u32 timestamp) -+{ -+ struct net_device *dev = offload->dev; -+ struct net_device_stats *stats = &dev->stats; -+ struct sk_buff *skb; -+ u8 len; -+ int err; -+ -+ skb = __can_get_echo_skb(dev, idx, &len); -+ if (!skb) -+ return 0; -+ -+ err = can_rx_offload_queue_sorted(offload, skb, timestamp); -+ if (err) { -+ stats->rx_errors++; -+ stats->tx_fifo_errors++; -+ } -+ -+ return len; -+} -+EXPORT_SYMBOL_GPL(can_rx_offload_get_echo_skb); -+ -+int can_rx_offload_queue_tail(struct can_rx_offload *offload, -+ struct sk_buff *skb) -+{ -+ if (skb_queue_len(&offload->skb_queue) > -+ offload->skb_queue_len_max) { -+ dev_kfree_skb_any(skb); -+ return -ENOBUFS; -+ } -+ -+ skb_queue_tail(&offload->skb_queue, skb); -+ can_rx_offload_schedule(offload); -+ -+ return 0; -+} -+EXPORT_SYMBOL_GPL(can_rx_offload_queue_tail); -+ -+static int can_rx_offload_init_queue(struct net_device *dev, -+ struct can_rx_offload *offload, -+ unsigned int weight) -+{ -+ offload->dev = dev; -+ -+ /* Limit queue len to 4x the weight (rounted to next power of two) */ -+ offload->skb_queue_len_max = 2 << fls(weight); -+ offload->skb_queue_len_max *= 4; -+ skb_queue_head_init(&offload->skb_queue); -+ -+ netif_napi_add(dev, &offload->napi, can_rx_offload_napi_poll, weight); -+ -+ dev_dbg(dev->dev.parent, "%s: skb_queue_len_max=%d\n", -+ __func__, offload->skb_queue_len_max); -+ -+ return 0; -+} -+ -+int can_rx_offload_add_timestamp(struct net_device *dev, -+ struct can_rx_offload *offload) -+{ -+ unsigned int weight; -+ -+ if (offload->mb_first > BITS_PER_LONG_LONG || -+ offload->mb_last > BITS_PER_LONG_LONG || !offload->mailbox_read) -+ return -EINVAL; -+ -+ if (offload->mb_first < offload->mb_last) { -+ offload->inc = true; -+ weight = offload->mb_last - offload->mb_first; -+ } else { -+ offload->inc = false; -+ weight = offload->mb_first - offload->mb_last; -+ } -+ -+ return can_rx_offload_init_queue(dev, offload, weight); -+} -+EXPORT_SYMBOL_GPL(can_rx_offload_add_timestamp); -+ -+int can_rx_offload_add_fifo(struct net_device *dev, -+ struct can_rx_offload *offload, unsigned int weight) -+{ -+ if (!offload->mailbox_read) -+ return -EINVAL; -+ -+ return can_rx_offload_init_queue(dev, offload, weight); -+} -+EXPORT_SYMBOL_GPL(can_rx_offload_add_fifo); -+ -+int can_rx_offload_add_manual(struct net_device *dev, -+ struct can_rx_offload *offload, -+ unsigned int weight) -+{ -+ if (offload->mailbox_read) -+ return -EINVAL; -+ -+ return can_rx_offload_init_queue(dev, offload, weight); -+} -+EXPORT_SYMBOL_GPL(can_rx_offload_add_manual); -+ -+void can_rx_offload_enable(struct can_rx_offload *offload) -+{ -+ napi_enable(&offload->napi); -+} -+EXPORT_SYMBOL_GPL(can_rx_offload_enable); -+ -+void can_rx_offload_del(struct can_rx_offload *offload) -+{ -+ netif_napi_del(&offload->napi); -+ skb_queue_purge(&offload->skb_queue); -+} -+EXPORT_SYMBOL_GPL(can_rx_offload_del); -diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c -index 4920de09ffb79..aeac3ce7bfc8f 100644 ---- a/drivers/net/can/m_can/tcan4x5x.c -+++ b/drivers/net/can/m_can/tcan4x5x.c -@@ -88,7 +88,7 @@ - - #define TCAN4X5X_MRAM_START 0x8000 - #define TCAN4X5X_MCAN_OFFSET 0x1000 --#define TCAN4X5X_MAX_REGISTER 0x8fff -+#define TCAN4X5X_MAX_REGISTER 0x8ffc - - #define TCAN4X5X_CLEAR_ALL_INT 0xffffffff - #define TCAN4X5X_SET_ALL_INT 0xffffffff -diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c -deleted file mode 100644 -index 3c1912c0430b6..0000000000000 ---- a/drivers/net/can/rx-offload.c -+++ /dev/null -@@ -1,376 +0,0 @@ --// SPDX-License-Identifier: GPL-2.0-only --/* Copyright (c) 2014 Protonic Holland, -- * David Jander -- * Copyright (C) 2014-2017 Pengutronix, -- * Marc Kleine-Budde -- */ -- --#include --#include -- --struct can_rx_offload_cb { -- u32 timestamp; --}; -- --static inline struct can_rx_offload_cb * --can_rx_offload_get_cb(struct sk_buff *skb) --{ -- BUILD_BUG_ON(sizeof(struct can_rx_offload_cb) > sizeof(skb->cb)); -- -- return (struct can_rx_offload_cb *)skb->cb; --} -- --static inline bool --can_rx_offload_le(struct can_rx_offload *offload, -- unsigned int a, unsigned int b) --{ -- if (offload->inc) -- return a <= b; -- else -- return a >= b; --} -- --static inline unsigned int --can_rx_offload_inc(struct can_rx_offload *offload, unsigned int *val) --{ -- if (offload->inc) -- return (*val)++; -- else -- return (*val)--; --} -- --static int can_rx_offload_napi_poll(struct napi_struct *napi, int quota) --{ -- struct can_rx_offload *offload = container_of(napi, -- struct can_rx_offload, -- napi); -- struct net_device *dev = offload->dev; -- struct net_device_stats *stats = &dev->stats; -- struct sk_buff *skb; -- int work_done = 0; -- -- while ((work_done < quota) && -- (skb = skb_dequeue(&offload->skb_queue))) { -- struct can_frame *cf = (struct can_frame *)skb->data; -- -- work_done++; -- stats->rx_packets++; -- stats->rx_bytes += cf->len; -- netif_receive_skb(skb); -- } -- -- if (work_done < quota) { -- napi_complete_done(napi, work_done); -- -- /* Check if there was another interrupt */ -- if (!skb_queue_empty(&offload->skb_queue)) -- napi_reschedule(&offload->napi); -- } -- -- can_led_event(offload->dev, CAN_LED_EVENT_RX); -- -- return work_done; --} -- --static inline void --__skb_queue_add_sort(struct sk_buff_head *head, struct sk_buff *new, -- int (*compare)(struct sk_buff *a, struct sk_buff *b)) --{ -- struct sk_buff *pos, *insert = NULL; -- -- skb_queue_reverse_walk(head, pos) { -- const struct can_rx_offload_cb *cb_pos, *cb_new; -- -- cb_pos = can_rx_offload_get_cb(pos); -- cb_new = can_rx_offload_get_cb(new); -- -- netdev_dbg(new->dev, -- "%s: pos=0x%08x, new=0x%08x, diff=%10d, queue_len=%d\n", -- __func__, -- cb_pos->timestamp, cb_new->timestamp, -- cb_new->timestamp - cb_pos->timestamp, -- skb_queue_len(head)); -- -- if (compare(pos, new) < 0) -- continue; -- insert = pos; -- break; -- } -- if (!insert) -- __skb_queue_head(head, new); -- else -- __skb_queue_after(head, insert, new); --} -- --static int can_rx_offload_compare(struct sk_buff *a, struct sk_buff *b) --{ -- const struct can_rx_offload_cb *cb_a, *cb_b; -- -- cb_a = can_rx_offload_get_cb(a); -- cb_b = can_rx_offload_get_cb(b); -- -- /* Subtract two u32 and return result as int, to keep -- * difference steady around the u32 overflow. -- */ -- return cb_b->timestamp - cb_a->timestamp; --} -- --/** -- * can_rx_offload_offload_one() - Read one CAN frame from HW -- * @offload: pointer to rx_offload context -- * @n: number of mailbox to read -- * -- * The task of this function is to read a CAN frame from mailbox @n -- * from the device and return the mailbox's content as a struct -- * sk_buff. -- * -- * If the struct can_rx_offload::skb_queue exceeds the maximal queue -- * length (struct can_rx_offload::skb_queue_len_max) or no skb can be -- * allocated, the mailbox contents is discarded by reading it into an -- * overflow buffer. This way the mailbox is marked as free by the -- * driver. -- * -- * Return: A pointer to skb containing the CAN frame on success. -- * -- * NULL if the mailbox @n is empty. -- * -- * ERR_PTR() in case of an error -- */ --static struct sk_buff * --can_rx_offload_offload_one(struct can_rx_offload *offload, unsigned int n) --{ -- struct sk_buff *skb; -- struct can_rx_offload_cb *cb; -- bool drop = false; -- u32 timestamp; -- -- /* If queue is full drop frame */ -- if (unlikely(skb_queue_len(&offload->skb_queue) > -- offload->skb_queue_len_max)) -- drop = true; -- -- skb = offload->mailbox_read(offload, n, ×tamp, drop); -- /* Mailbox was empty. */ -- if (unlikely(!skb)) -- return NULL; -- -- /* There was a problem reading the mailbox, propagate -- * error value. -- */ -- if (IS_ERR(skb)) { -- offload->dev->stats.rx_dropped++; -- offload->dev->stats.rx_fifo_errors++; -- -- return skb; -- } -- -- /* Mailbox was read. */ -- cb = can_rx_offload_get_cb(skb); -- cb->timestamp = timestamp; -- -- return skb; --} -- --int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, -- u64 pending) --{ -- struct sk_buff_head skb_queue; -- unsigned int i; -- -- __skb_queue_head_init(&skb_queue); -- -- for (i = offload->mb_first; -- can_rx_offload_le(offload, i, offload->mb_last); -- can_rx_offload_inc(offload, &i)) { -- struct sk_buff *skb; -- -- if (!(pending & BIT_ULL(i))) -- continue; -- -- skb = can_rx_offload_offload_one(offload, i); -- if (IS_ERR_OR_NULL(skb)) -- continue; -- -- __skb_queue_add_sort(&skb_queue, skb, can_rx_offload_compare); -- } -- -- if (!skb_queue_empty(&skb_queue)) { -- unsigned long flags; -- u32 queue_len; -- -- spin_lock_irqsave(&offload->skb_queue.lock, flags); -- skb_queue_splice_tail(&skb_queue, &offload->skb_queue); -- spin_unlock_irqrestore(&offload->skb_queue.lock, flags); -- -- queue_len = skb_queue_len(&offload->skb_queue); -- if (queue_len > offload->skb_queue_len_max / 8) -- netdev_dbg(offload->dev, "%s: queue_len=%d\n", -- __func__, queue_len); -- -- can_rx_offload_schedule(offload); -- } -- -- return skb_queue_len(&skb_queue); --} --EXPORT_SYMBOL_GPL(can_rx_offload_irq_offload_timestamp); -- --int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload) --{ -- struct sk_buff *skb; -- int received = 0; -- -- while (1) { -- skb = can_rx_offload_offload_one(offload, 0); -- if (IS_ERR(skb)) -- continue; -- if (!skb) -- break; -- -- skb_queue_tail(&offload->skb_queue, skb); -- received++; -- } -- -- if (received) -- can_rx_offload_schedule(offload); -- -- return received; --} --EXPORT_SYMBOL_GPL(can_rx_offload_irq_offload_fifo); -- --int can_rx_offload_queue_sorted(struct can_rx_offload *offload, -- struct sk_buff *skb, u32 timestamp) --{ -- struct can_rx_offload_cb *cb; -- unsigned long flags; -- -- if (skb_queue_len(&offload->skb_queue) > -- offload->skb_queue_len_max) { -- dev_kfree_skb_any(skb); -- return -ENOBUFS; -- } -- -- cb = can_rx_offload_get_cb(skb); -- cb->timestamp = timestamp; -- -- spin_lock_irqsave(&offload->skb_queue.lock, flags); -- __skb_queue_add_sort(&offload->skb_queue, skb, can_rx_offload_compare); -- spin_unlock_irqrestore(&offload->skb_queue.lock, flags); -- -- can_rx_offload_schedule(offload); -- -- return 0; --} --EXPORT_SYMBOL_GPL(can_rx_offload_queue_sorted); -- --unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload, -- unsigned int idx, u32 timestamp) --{ -- struct net_device *dev = offload->dev; -- struct net_device_stats *stats = &dev->stats; -- struct sk_buff *skb; -- u8 len; -- int err; -- -- skb = __can_get_echo_skb(dev, idx, &len); -- if (!skb) -- return 0; -- -- err = can_rx_offload_queue_sorted(offload, skb, timestamp); -- if (err) { -- stats->rx_errors++; -- stats->tx_fifo_errors++; -- } -- -- return len; --} --EXPORT_SYMBOL_GPL(can_rx_offload_get_echo_skb); -- --int can_rx_offload_queue_tail(struct can_rx_offload *offload, -- struct sk_buff *skb) --{ -- if (skb_queue_len(&offload->skb_queue) > -- offload->skb_queue_len_max) { -- dev_kfree_skb_any(skb); -- return -ENOBUFS; -- } -- -- skb_queue_tail(&offload->skb_queue, skb); -- can_rx_offload_schedule(offload); -- -- return 0; --} --EXPORT_SYMBOL_GPL(can_rx_offload_queue_tail); -- --static int can_rx_offload_init_queue(struct net_device *dev, -- struct can_rx_offload *offload, -- unsigned int weight) --{ -- offload->dev = dev; -- -- /* Limit queue len to 4x the weight (rounted to next power of two) */ -- offload->skb_queue_len_max = 2 << fls(weight); -- offload->skb_queue_len_max *= 4; -- skb_queue_head_init(&offload->skb_queue); -- -- netif_napi_add(dev, &offload->napi, can_rx_offload_napi_poll, weight); -- -- dev_dbg(dev->dev.parent, "%s: skb_queue_len_max=%d\n", -- __func__, offload->skb_queue_len_max); -- -- return 0; --} -- --int can_rx_offload_add_timestamp(struct net_device *dev, -- struct can_rx_offload *offload) --{ -- unsigned int weight; -- -- if (offload->mb_first > BITS_PER_LONG_LONG || -- offload->mb_last > BITS_PER_LONG_LONG || !offload->mailbox_read) -- return -EINVAL; -- -- if (offload->mb_first < offload->mb_last) { -- offload->inc = true; -- weight = offload->mb_last - offload->mb_first; -- } else { -- offload->inc = false; -- weight = offload->mb_first - offload->mb_last; -- } -- -- return can_rx_offload_init_queue(dev, offload, weight); --} --EXPORT_SYMBOL_GPL(can_rx_offload_add_timestamp); -- --int can_rx_offload_add_fifo(struct net_device *dev, -- struct can_rx_offload *offload, unsigned int weight) --{ -- if (!offload->mailbox_read) -- return -EINVAL; -- -- return can_rx_offload_init_queue(dev, offload, weight); --} --EXPORT_SYMBOL_GPL(can_rx_offload_add_fifo); -- --int can_rx_offload_add_manual(struct net_device *dev, -- struct can_rx_offload *offload, -- unsigned int weight) --{ -- if (offload->mailbox_read) -- return -EINVAL; -- -- return can_rx_offload_init_queue(dev, offload, weight); --} --EXPORT_SYMBOL_GPL(can_rx_offload_add_manual); -- --void can_rx_offload_enable(struct can_rx_offload *offload) --{ -- napi_enable(&offload->napi); --} --EXPORT_SYMBOL_GPL(can_rx_offload_enable); -- --void can_rx_offload_del(struct can_rx_offload *offload) --{ -- netif_napi_del(&offload->napi); -- skb_queue_purge(&offload->skb_queue); --} --EXPORT_SYMBOL_GPL(can_rx_offload_del); -diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c -index a1bd1be09548d..30c8d53c9745d 100644 ---- a/drivers/net/can/slcan.c -+++ b/drivers/net/can/slcan.c -@@ -516,6 +516,7 @@ static struct slcan *slc_alloc(void) - int i; - char name[IFNAMSIZ]; - struct net_device *dev = NULL; -+ struct can_ml_priv *can_ml; - struct slcan *sl; - int size; - -@@ -538,7 +539,8 @@ static struct slcan *slc_alloc(void) - - dev->base_addr = i; - sl = netdev_priv(dev); -- dev->ml_priv = (void *)sl + ALIGN(sizeof(*sl), NETDEV_ALIGN); -+ can_ml = (void *)sl + ALIGN(sizeof(*sl), NETDEV_ALIGN); -+ can_set_ml_priv(dev, can_ml); - - /* Initialize channel control data */ - sl->magic = SLCAN_MAGIC; -diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c -index 39ca14b0585dc..067705e2850b3 100644 ---- a/drivers/net/can/vcan.c -+++ b/drivers/net/can/vcan.c -@@ -153,7 +153,7 @@ static void vcan_setup(struct net_device *dev) - dev->addr_len = 0; - dev->tx_queue_len = 0; - dev->flags = IFF_NOARP; -- dev->ml_priv = netdev_priv(dev); -+ can_set_ml_priv(dev, netdev_priv(dev)); - - /* set flags according to driver capabilities */ - if (echo) -diff --git a/drivers/net/can/vxcan.c b/drivers/net/can/vxcan.c -index f9a524c5f6d62..8861a7d875e7e 100644 ---- a/drivers/net/can/vxcan.c -+++ b/drivers/net/can/vxcan.c -@@ -141,6 +141,8 @@ static const struct net_device_ops vxcan_netdev_ops = { - - static void vxcan_setup(struct net_device *dev) - { -+ struct can_ml_priv *can_ml; -+ - dev->type = ARPHRD_CAN; - dev->mtu = CANFD_MTU; - dev->hard_header_len = 0; -@@ -149,7 +151,9 @@ static void vxcan_setup(struct net_device *dev) - dev->flags = (IFF_NOARP|IFF_ECHO); - dev->netdev_ops = &vxcan_netdev_ops; - dev->needs_free_netdev = true; -- dev->ml_priv = netdev_priv(dev) + ALIGN(sizeof(struct vxcan_priv), NETDEV_ALIGN); -+ -+ can_ml = netdev_priv(dev) + ALIGN(sizeof(struct vxcan_priv), NETDEV_ALIGN); -+ can_set_ml_priv(dev, can_ml); - } - - /* forward declaration for rtnl_create_link() */ -diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c -index 8f70a3909929a..4af0cd9530de6 100644 ---- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c -+++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c -@@ -71,8 +71,10 @@ static int aq_ndev_open(struct net_device *ndev) - goto err_exit; - - err = aq_nic_start(aq_nic); -- if (err < 0) -+ if (err < 0) { -+ aq_nic_stop(aq_nic); - goto err_exit; -+ } - - err_exit: - if (err < 0) -diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c -index 358119d983582..e6f9b5345b70b 100644 ---- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c -+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c -@@ -1153,7 +1153,7 @@ static void mvpp2_interrupts_unmask(void *arg) - u32 val; - - /* If the thread isn't used, don't do anything */ -- if (smp_processor_id() > port->priv->nthreads) -+ if (smp_processor_id() >= port->priv->nthreads) - return; - - val = MVPP2_CAUSE_MISC_SUM_MASK | -@@ -2287,7 +2287,7 @@ static void mvpp2_txq_sent_counter_clear(void *arg) - int queue; - - /* If the thread isn't used, don't do anything */ -- if (smp_processor_id() > port->priv->nthreads) -+ if (smp_processor_id() >= port->priv->nthreads) - return; - - for (queue = 0; queue < port->ntxqs; queue++) { -diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c -index b77f5fef7aeca..febfac75dd6a1 100644 ---- a/drivers/net/ipa/gsi.c -+++ b/drivers/net/ipa/gsi.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: GPL-2.0 - - /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. -- * Copyright (C) 2018-2020 Linaro Ltd. -+ * Copyright (C) 2018-2021 Linaro Ltd. - */ - - #include -@@ -195,8 +195,6 @@ static void gsi_irq_type_disable(struct gsi *gsi, enum gsi_irq_type_id type_id) - /* Turn off all GSI interrupts initially */ - static void gsi_irq_setup(struct gsi *gsi) - { -- u32 adjust; -- - /* Disable all interrupt types */ - gsi_irq_type_update(gsi, 0); - -@@ -206,10 +204,9 @@ static void gsi_irq_setup(struct gsi *gsi) - iowrite32(0, gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET); - iowrite32(0, gsi->virt + GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET); - -- /* Reverse the offset adjustment for inter-EE register offsets */ -- adjust = gsi->version < IPA_VERSION_4_5 ? 0 : GSI_EE_REG_ADJUST; -- iowrite32(0, gsi->virt + adjust + GSI_INTER_EE_SRC_CH_IRQ_OFFSET); -- iowrite32(0, gsi->virt + adjust + GSI_INTER_EE_SRC_EV_CH_IRQ_OFFSET); -+ /* The inter-EE registers are in the non-adjusted address range */ -+ iowrite32(0, gsi->virt_raw + GSI_INTER_EE_SRC_CH_IRQ_OFFSET); -+ iowrite32(0, gsi->virt_raw + GSI_INTER_EE_SRC_EV_CH_IRQ_OFFSET); - - iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET); - } -@@ -2115,9 +2112,8 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, - gsi->dev = dev; - gsi->version = version; - -- /* The GSI layer performs NAPI on all endpoints. NAPI requires a -- * network device structure, but the GSI layer does not have one, -- * so we must create a dummy network device for this purpose. -+ /* GSI uses NAPI on all channels. Create a dummy network device -+ * for the channel NAPI contexts to be associated with. - */ - init_dummy_netdev(&gsi->dummy_dev); - -@@ -2142,13 +2138,13 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, - return -EINVAL; - } - -- gsi->virt = ioremap(res->start, size); -- if (!gsi->virt) { -+ gsi->virt_raw = ioremap(res->start, size); -+ if (!gsi->virt_raw) { - dev_err(dev, "unable to remap \"gsi\" memory\n"); - return -ENOMEM; - } -- /* Adjust register range pointer downward for newer IPA versions */ -- gsi->virt -= adjust; -+ /* Most registers are accessed using an adjusted register range */ -+ gsi->virt = gsi->virt_raw - adjust; - - init_completion(&gsi->completion); - -@@ -2167,7 +2163,7 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, - err_irq_exit: - gsi_irq_exit(gsi); - err_iounmap: -- iounmap(gsi->virt); -+ iounmap(gsi->virt_raw); - - return ret; - } -@@ -2178,7 +2174,7 @@ void gsi_exit(struct gsi *gsi) - mutex_destroy(&gsi->mutex); - gsi_channel_exit(gsi); - gsi_irq_exit(gsi); -- iounmap(gsi->virt); -+ iounmap(gsi->virt_raw); - } - - /* The maximum number of outstanding TREs on a channel. This limits -diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h -index 96c9aed397aad..696c9825834ab 100644 ---- a/drivers/net/ipa/gsi.h -+++ b/drivers/net/ipa/gsi.h -@@ -1,7 +1,7 @@ - /* SPDX-License-Identifier: GPL-2.0 */ - - /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. -- * Copyright (C) 2018-2020 Linaro Ltd. -+ * Copyright (C) 2018-2021 Linaro Ltd. - */ - #ifndef _GSI_H_ - #define _GSI_H_ -@@ -150,7 +150,8 @@ struct gsi { - struct device *dev; /* Same as IPA device */ - enum ipa_version version; - struct net_device dummy_dev; /* needed for NAPI */ -- void __iomem *virt; -+ void __iomem *virt_raw; /* I/O mapped address range */ -+ void __iomem *virt; /* Adjusted for most registers */ - u32 irq; - u32 channel_count; - u32 evt_ring_count; -diff --git a/drivers/net/ipa/gsi_reg.h b/drivers/net/ipa/gsi_reg.h -index 0e138bbd82053..1622d8cf8dea4 100644 ---- a/drivers/net/ipa/gsi_reg.h -+++ b/drivers/net/ipa/gsi_reg.h -@@ -1,7 +1,7 @@ - /* SPDX-License-Identifier: GPL-2.0 */ - - /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. -- * Copyright (C) 2018-2020 Linaro Ltd. -+ * Copyright (C) 2018-2021 Linaro Ltd. - */ - #ifndef _GSI_REG_H_ - #define _GSI_REG_H_ -@@ -38,17 +38,21 @@ - * (though the actual limit is hardware-dependent). - */ - --/* GSI EE registers as a group are shifted downward by a fixed -- * constant amount for IPA versions 4.5 and beyond. This applies -- * to all GSI registers we use *except* the ones that disable -- * inter-EE interrupts for channels and event channels. -+/* GSI EE registers as a group are shifted downward by a fixed constant amount -+ * for IPA versions 4.5 and beyond. This applies to all GSI registers we use -+ * *except* the ones that disable inter-EE interrupts for channels and event -+ * channels. - * -- * We handle this by adjusting the pointer to the mapped GSI memory -- * region downward. Then in the one place we use them (gsi_irq_setup()) -- * we undo that adjustment for the inter-EE interrupt registers. -+ * The "raw" (not adjusted) GSI register range is mapped, and a pointer to -+ * the mapped range is held in gsi->virt_raw. The inter-EE interrupt -+ * registers are accessed using that pointer. -+ * -+ * Most registers are accessed using gsi->virt, which is a copy of the "raw" -+ * pointer, adjusted downward by the fixed amount. - */ - #define GSI_EE_REG_ADJUST 0x0000d000 /* IPA v4.5+ */ - -+/* The two inter-EE IRQ register offsets are relative to gsi->virt_raw */ - #define GSI_INTER_EE_SRC_CH_IRQ_OFFSET \ - GSI_INTER_EE_N_SRC_CH_IRQ_OFFSET(GSI_EE_AP) - #define GSI_INTER_EE_N_SRC_CH_IRQ_OFFSET(ee) \ -@@ -59,16 +63,7 @@ - #define GSI_INTER_EE_N_SRC_EV_CH_IRQ_OFFSET(ee) \ - (0x0000c01c + 0x1000 * (ee)) - --#define GSI_INTER_EE_SRC_CH_IRQ_CLR_OFFSET \ -- GSI_INTER_EE_N_SRC_CH_IRQ_CLR_OFFSET(GSI_EE_AP) --#define GSI_INTER_EE_N_SRC_CH_IRQ_CLR_OFFSET(ee) \ -- (0x0000c028 + 0x1000 * (ee)) -- --#define GSI_INTER_EE_SRC_EV_CH_IRQ_CLR_OFFSET \ -- GSI_INTER_EE_N_SRC_EV_CH_IRQ_CLR_OFFSET(GSI_EE_AP) --#define GSI_INTER_EE_N_SRC_EV_CH_IRQ_CLR_OFFSET(ee) \ -- (0x0000c02c + 0x1000 * (ee)) -- -+/* All other register offsets are relative to gsi->virt */ - #define GSI_CH_C_CNTXT_0_OFFSET(ch) \ - GSI_EE_N_CH_C_CNTXT_0_OFFSET((ch), GSI_EE_AP) - #define GSI_EE_N_CH_C_CNTXT_0_OFFSET(ch, ee) \ -diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c -index 002e514485100..eb65a11e33eaf 100644 ---- a/drivers/net/ipa/ipa_cmd.c -+++ b/drivers/net/ipa/ipa_cmd.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: GPL-2.0 - - /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. -- * Copyright (C) 2019-2020 Linaro Ltd. -+ * Copyright (C) 2019-2021 Linaro Ltd. - */ - - #include -@@ -244,11 +244,15 @@ static bool ipa_cmd_register_write_offset_valid(struct ipa *ipa, - if (ipa->version != IPA_VERSION_3_5_1) - bit_count += hweight32(REGISTER_WRITE_FLAGS_OFFSET_HIGH_FMASK); - BUILD_BUG_ON(bit_count > 32); -- offset_max = ~0 >> (32 - bit_count); -+ offset_max = ~0U >> (32 - bit_count); - -+ /* Make sure the offset can be represented by the field(s) -+ * that holds it. Also make sure the offset is not outside -+ * the overall IPA memory range. -+ */ - if (offset > offset_max || ipa->mem_offset > offset_max - offset) { - dev_err(dev, "%s offset too large 0x%04x + 0x%04x > 0x%04x)\n", -- ipa->mem_offset + offset, offset_max); -+ name, ipa->mem_offset, offset, offset_max); - return false; - } - -@@ -261,12 +265,24 @@ static bool ipa_cmd_register_write_valid(struct ipa *ipa) - const char *name; - u32 offset; - -- offset = ipa_reg_filt_rout_hash_flush_offset(ipa->version); -- name = "filter/route hash flush"; -- if (!ipa_cmd_register_write_offset_valid(ipa, name, offset)) -- return false; -+ /* If hashed tables are supported, ensure the hash flush register -+ * offset will fit in a register write IPA immediate command. -+ */ -+ if (ipa->version != IPA_VERSION_4_2) { -+ offset = ipa_reg_filt_rout_hash_flush_offset(ipa->version); -+ name = "filter/route hash flush"; -+ if (!ipa_cmd_register_write_offset_valid(ipa, name, offset)) -+ return false; -+ } - -- offset = IPA_REG_ENDP_STATUS_N_OFFSET(IPA_ENDPOINT_COUNT); -+ /* Each endpoint can have a status endpoint associated with it, -+ * and this is recorded in an endpoint register. If the modem -+ * crashes, we reset the status endpoint for all modem endpoints -+ * using a register write IPA immediate command. Make sure the -+ * worst case (highest endpoint number) offset of that endpoint -+ * fits in the register write command field(s) that must hold it. -+ */ -+ offset = IPA_REG_ENDP_STATUS_N_OFFSET(IPA_ENDPOINT_COUNT - 1); - name = "maximal endpoint status"; - if (!ipa_cmd_register_write_offset_valid(ipa, name, offset)) - return false; -diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c -index 816af1f55e2cd..dbeb29fa16e81 100644 ---- a/drivers/net/netdevsim/dev.c -+++ b/drivers/net/netdevsim/dev.c -@@ -1012,23 +1012,25 @@ static int nsim_dev_reload_create(struct nsim_dev *nsim_dev, - nsim_dev->fw_update_status = true; - nsim_dev->fw_update_overwrite_mask = 0; - -- nsim_dev->fib_data = nsim_fib_create(devlink, extack); -- if (IS_ERR(nsim_dev->fib_data)) -- return PTR_ERR(nsim_dev->fib_data); -- - nsim_devlink_param_load_driverinit_values(devlink); - - err = nsim_dev_dummy_region_init(nsim_dev, devlink); - if (err) -- goto err_fib_destroy; -+ return err; - - err = nsim_dev_traps_init(devlink); - if (err) - goto err_dummy_region_exit; - -+ nsim_dev->fib_data = nsim_fib_create(devlink, extack); -+ if (IS_ERR(nsim_dev->fib_data)) { -+ err = PTR_ERR(nsim_dev->fib_data); -+ goto err_traps_exit; -+ } -+ - err = nsim_dev_health_init(nsim_dev, devlink); - if (err) -- goto err_traps_exit; -+ goto err_fib_destroy; - - err = nsim_dev_port_add_all(nsim_dev, nsim_bus_dev->port_count); - if (err) -@@ -1043,12 +1045,12 @@ static int nsim_dev_reload_create(struct nsim_dev *nsim_dev, - - err_health_exit: - nsim_dev_health_exit(nsim_dev); -+err_fib_destroy: -+ nsim_fib_destroy(devlink, nsim_dev->fib_data); - err_traps_exit: - nsim_dev_traps_exit(devlink); - err_dummy_region_exit: - nsim_dev_dummy_region_exit(nsim_dev); --err_fib_destroy: -- nsim_fib_destroy(devlink, nsim_dev->fib_data); - return err; - } - -@@ -1080,15 +1082,9 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev) - if (err) - goto err_devlink_free; - -- nsim_dev->fib_data = nsim_fib_create(devlink, NULL); -- if (IS_ERR(nsim_dev->fib_data)) { -- err = PTR_ERR(nsim_dev->fib_data); -- goto err_resources_unregister; -- } -- - err = devlink_register(devlink, &nsim_bus_dev->dev); - if (err) -- goto err_fib_destroy; -+ goto err_resources_unregister; - - err = devlink_params_register(devlink, nsim_devlink_params, - ARRAY_SIZE(nsim_devlink_params)); -@@ -1108,9 +1104,15 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev) - if (err) - goto err_traps_exit; - -+ nsim_dev->fib_data = nsim_fib_create(devlink, NULL); -+ if (IS_ERR(nsim_dev->fib_data)) { -+ err = PTR_ERR(nsim_dev->fib_data); -+ goto err_debugfs_exit; -+ } -+ - err = nsim_dev_health_init(nsim_dev, devlink); - if (err) -- goto err_debugfs_exit; -+ goto err_fib_destroy; - - err = nsim_bpf_dev_init(nsim_dev); - if (err) -@@ -1128,6 +1130,8 @@ err_bpf_dev_exit: - nsim_bpf_dev_exit(nsim_dev); - err_health_exit: - nsim_dev_health_exit(nsim_dev); -+err_fib_destroy: -+ nsim_fib_destroy(devlink, nsim_dev->fib_data); - err_debugfs_exit: - nsim_dev_debugfs_exit(nsim_dev); - err_traps_exit: -@@ -1139,8 +1143,6 @@ err_params_unregister: - ARRAY_SIZE(nsim_devlink_params)); - err_dl_unregister: - devlink_unregister(devlink); --err_fib_destroy: -- nsim_fib_destroy(devlink, nsim_dev->fib_data); - err_resources_unregister: - devlink_resources_unregister(devlink, NULL); - err_devlink_free: -@@ -1157,10 +1159,10 @@ static void nsim_dev_reload_destroy(struct nsim_dev *nsim_dev) - debugfs_remove(nsim_dev->take_snapshot); - nsim_dev_port_del_all(nsim_dev); - nsim_dev_health_exit(nsim_dev); -+ nsim_fib_destroy(devlink, nsim_dev->fib_data); - nsim_dev_traps_exit(devlink); - nsim_dev_dummy_region_exit(nsim_dev); - mutex_destroy(&nsim_dev->port_list_lock); -- nsim_fib_destroy(devlink, nsim_dev->fib_data); - } - - void nsim_dev_remove(struct nsim_bus_dev *nsim_bus_dev) -diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c -index 93c7e8502845f..ebb568f9bc667 100644 ---- a/drivers/net/wan/lmc/lmc_main.c -+++ b/drivers/net/wan/lmc/lmc_main.c -@@ -899,6 +899,8 @@ static int lmc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) - break; - default: - printk(KERN_WARNING "%s: LMC UNKNOWN CARD!\n", dev->name); -+ unregister_hdlc_device(dev); -+ return -EIO; - break; - } - -diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c -index e6135795719a1..e7072fc4f487a 100644 ---- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c -+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c -@@ -576,13 +576,13 @@ static void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb) - case WMI_TDLS_TEARDOWN_REASON_TX: - case WMI_TDLS_TEARDOWN_REASON_RSSI: - case WMI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT: -+ rcu_read_lock(); - station = ieee80211_find_sta_by_ifaddr(ar->hw, - ev->peer_macaddr.addr, - NULL); - if (!station) { - ath10k_warn(ar, "did not find station from tdls peer event"); -- kfree(tb); -- return; -+ goto exit; - } - arvif = ath10k_get_arvif(ar, __le32_to_cpu(ev->vdev_id)); - ieee80211_tdls_oper_request( -@@ -593,6 +593,9 @@ static void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb) - ); - break; - } -+ -+exit: -+ rcu_read_unlock(); - kfree(tb); - } - -diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c -index 54bdef33f3f85..55ecf7f437354 100644 ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6361,17 +6361,20 @@ static int __ath11k_mac_register(struct ath11k *ar) - ret = ath11k_regd_update(ar, true); - if (ret) { - ath11k_err(ar->ab, "ath11k regd update failed: %d\n", ret); -- goto err_free_if_combs; -+ goto err_unregister_hw; - } - - ret = ath11k_debugfs_register(ar); - if (ret) { - ath11k_err(ar->ab, "debugfs registration failed: %d\n", ret); -- goto err_free_if_combs; -+ goto err_unregister_hw; - } - - return 0; - -+err_unregister_hw: -+ ieee80211_unregister_hw(ar->hw); -+ - err_free_if_combs: - kfree(ar->hw->wiphy->iface_combinations[0].limits); - kfree(ar->hw->wiphy->iface_combinations); -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -index 0ee421f30aa24..23e6422c2251b 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -5611,7 +5611,8 @@ static bool brcmf_is_linkup(struct brcmf_cfg80211_vif *vif, - return false; - } - --static bool brcmf_is_linkdown(const struct brcmf_event_msg *e) -+static bool brcmf_is_linkdown(struct brcmf_cfg80211_vif *vif, -+ const struct brcmf_event_msg *e) - { - u32 event = e->event_code; - u16 flags = e->flags; -@@ -5620,6 +5621,8 @@ static bool brcmf_is_linkdown(const struct brcmf_event_msg *e) - (event == BRCMF_E_DISASSOC_IND) || - ((event == BRCMF_E_LINK) && (!(flags & BRCMF_EVENT_MSG_LINK)))) { - brcmf_dbg(CONN, "Processing link down\n"); -+ clear_bit(BRCMF_VIF_STATUS_EAP_SUCCESS, &vif->sme_state); -+ clear_bit(BRCMF_VIF_STATUS_ASSOC_SUCCESS, &vif->sme_state); - return true; - } - return false; -@@ -6067,7 +6070,7 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, - } else - brcmf_bss_connect_done(cfg, ndev, e, true); - brcmf_net_setcarrier(ifp, true); -- } else if (brcmf_is_linkdown(e)) { -+ } else if (brcmf_is_linkdown(ifp->vif, e)) { - brcmf_dbg(CONN, "Linkdown\n"); - if (!brcmf_is_ibssmode(ifp->vif) && - test_bit(BRCMF_VIF_STATUS_CONNECTED, -diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c -index ab93a848a4667..e71bc97cb40e7 100644 ---- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c -+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c -@@ -1972,7 +1972,7 @@ static bool iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans, - int ret; - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - -- spin_lock_irqsave(&trans_pcie->reg_lock, *flags); -+ spin_lock_bh(&trans_pcie->reg_lock); - - if (trans_pcie->cmd_hold_nic_awake) - goto out; -@@ -2057,7 +2057,7 @@ static bool iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans, - } - - err: -- spin_unlock_irqrestore(&trans_pcie->reg_lock, *flags); -+ spin_unlock_bh(&trans_pcie->reg_lock); - return false; - } - -@@ -2095,7 +2095,7 @@ static void iwl_trans_pcie_release_nic_access(struct iwl_trans *trans, - * scheduled on different CPUs (after we drop reg_lock). - */ - out: -- spin_unlock_irqrestore(&trans_pcie->reg_lock, *flags); -+ spin_unlock_bh(&trans_pcie->reg_lock); - } - - static int iwl_trans_pcie_read_mem(struct iwl_trans *trans, u32 addr, -@@ -2296,11 +2296,10 @@ static void iwl_trans_pcie_set_bits_mask(struct iwl_trans *trans, u32 reg, - u32 mask, u32 value) - { - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); -- unsigned long flags; - -- spin_lock_irqsave(&trans_pcie->reg_lock, flags); -+ spin_lock_bh(&trans_pcie->reg_lock); - __iwl_trans_pcie_set_bits_mask(trans, reg, mask, value); -- spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); -+ spin_unlock_bh(&trans_pcie->reg_lock); - } - - static const char *get_csr_string(int cmd) -diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c -index 8757246a90d53..b9afd9b04042a 100644 ---- a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c -+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c -@@ -31,7 +31,6 @@ static int iwl_pcie_gen2_enqueue_hcmd(struct iwl_trans *trans, - struct iwl_txq *txq = trans->txqs.txq[trans->txqs.cmd.q_id]; - struct iwl_device_cmd *out_cmd; - struct iwl_cmd_meta *out_meta; -- unsigned long flags; - void *dup_buf = NULL; - dma_addr_t phys_addr; - int i, cmd_pos, idx; -@@ -244,11 +243,11 @@ static int iwl_pcie_gen2_enqueue_hcmd(struct iwl_trans *trans, - if (txq->read_ptr == txq->write_ptr && txq->wd_timeout) - mod_timer(&txq->stuck_timer, jiffies + txq->wd_timeout); - -- spin_lock_irqsave(&trans_pcie->reg_lock, flags); -+ spin_lock(&trans_pcie->reg_lock); - /* Increment and update queue's write index */ - txq->write_ptr = iwl_txq_inc_wrap(trans, txq->write_ptr); - iwl_txq_inc_wr_ptr(trans, txq); -- spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); -+ spin_unlock(&trans_pcie->reg_lock); - - out: - spin_unlock_bh(&txq->lock); -diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c -index 83f4964f3cb29..689f51968049a 100644 ---- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c -+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c -@@ -223,12 +223,10 @@ static void iwl_pcie_txq_unmap(struct iwl_trans *trans, int txq_id) - txq->read_ptr = iwl_txq_inc_wrap(trans, txq->read_ptr); - - if (txq->read_ptr == txq->write_ptr) { -- unsigned long flags; -- -- spin_lock_irqsave(&trans_pcie->reg_lock, flags); -+ spin_lock(&trans_pcie->reg_lock); - if (txq_id == trans->txqs.cmd.q_id) - iwl_pcie_clear_cmd_in_flight(trans); -- spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); -+ spin_unlock(&trans_pcie->reg_lock); - } - } - -@@ -679,7 +677,6 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx) - { - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_txq *txq = trans->txqs.txq[txq_id]; -- unsigned long flags; - int nfreed = 0; - u16 r; - -@@ -710,9 +707,10 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx) - } - - if (txq->read_ptr == txq->write_ptr) { -- spin_lock_irqsave(&trans_pcie->reg_lock, flags); -+ /* BHs are also disabled due to txq->lock */ -+ spin_lock(&trans_pcie->reg_lock); - iwl_pcie_clear_cmd_in_flight(trans); -- spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); -+ spin_unlock(&trans_pcie->reg_lock); - } - - iwl_txq_progress(txq); -@@ -921,7 +919,6 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, - struct iwl_txq *txq = trans->txqs.txq[trans->txqs.cmd.q_id]; - struct iwl_device_cmd *out_cmd; - struct iwl_cmd_meta *out_meta; -- unsigned long flags; - void *dup_buf = NULL; - dma_addr_t phys_addr; - int idx; -@@ -1164,20 +1161,19 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, - if (txq->read_ptr == txq->write_ptr && txq->wd_timeout) - mod_timer(&txq->stuck_timer, jiffies + txq->wd_timeout); - -- spin_lock_irqsave(&trans_pcie->reg_lock, flags); -+ spin_lock(&trans_pcie->reg_lock); - ret = iwl_pcie_set_cmd_in_flight(trans, cmd); - if (ret < 0) { - idx = ret; -- spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); -- goto out; -+ goto unlock_reg; - } - - /* Increment and update queue's write index */ - txq->write_ptr = iwl_txq_inc_wrap(trans, txq->write_ptr); - iwl_pcie_txq_inc_wr_ptr(trans, txq); - -- spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); -- -+ unlock_reg: -+ spin_unlock(&trans_pcie->reg_lock); - out: - spin_unlock_bh(&txq->lock); - free_dup_buf: -diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c -index fbfd85439d1ff..88fb49486ee09 100644 ---- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c -+++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c -@@ -719,8 +719,8 @@ static void rtw8821c_coex_cfg_ant_switch(struct rtw_dev *rtwdev, u8 ctrl_type, - regval = (!polarity_inverse ? 0x1 : 0x2); - } - -- rtw_write8_mask(rtwdev, REG_RFE_CTRL8, BIT_MASK_R_RFE_SEL_15, -- regval); -+ rtw_write32_mask(rtwdev, REG_RFE_CTRL8, BIT_MASK_R_RFE_SEL_15, -+ regval); - break; - case COEX_SWITCH_CTRL_BY_PTA: - rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); -@@ -730,8 +730,8 @@ static void rtw8821c_coex_cfg_ant_switch(struct rtw_dev *rtwdev, u8 ctrl_type, - PTA_CTRL_PIN); - - regval = (!polarity_inverse ? 0x2 : 0x1); -- rtw_write8_mask(rtwdev, REG_RFE_CTRL8, BIT_MASK_R_RFE_SEL_15, -- regval); -+ rtw_write32_mask(rtwdev, REG_RFE_CTRL8, BIT_MASK_R_RFE_SEL_15, -+ regval); - break; - case COEX_SWITCH_CTRL_BY_ANTDIV: - rtw_write32_clr(rtwdev, REG_LED_CFG, BIT_DPDT_SEL_EN); -@@ -757,11 +757,11 @@ static void rtw8821c_coex_cfg_ant_switch(struct rtw_dev *rtwdev, u8 ctrl_type, - } - - if (ctrl_type == COEX_SWITCH_CTRL_BY_BT) { -- rtw_write32_clr(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE1); -- rtw_write32_clr(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE2); -+ rtw_write8_clr(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE1); -+ rtw_write8_clr(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE2); - } else { -- rtw_write32_set(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE1); -- rtw_write32_set(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE2); -+ rtw_write8_set(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE1); -+ rtw_write8_set(rtwdev, REG_CTRL_TYPE, BIT_CTRL_TYPE2); - } - } - -diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c -index 8b0485ada315b..d658c6e8263af 100644 ---- a/drivers/nvme/target/tcp.c -+++ b/drivers/nvme/target/tcp.c -@@ -1098,11 +1098,11 @@ static int nvmet_tcp_try_recv_data(struct nvmet_tcp_queue *queue) - cmd->rbytes_done += ret; - } - -+ nvmet_tcp_unmap_pdu_iovec(cmd); - if (queue->data_digest) { - nvmet_tcp_prep_recv_ddgst(cmd); - return 0; - } -- nvmet_tcp_unmap_pdu_iovec(cmd); - - if (!(cmd->flags & NVMET_TCP_F_INIT_FAILED) && - cmd->rbytes_done == cmd->req.transfer_len) { -diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c -index f35edb0eac405..c12fa57ebd12c 100644 ---- a/drivers/pinctrl/pinctrl-microchip-sgpio.c -+++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c -@@ -572,7 +572,7 @@ static void microchip_sgpio_irq_settype(struct irq_data *data, - /* Type value spread over 2 registers sets: low, high bit */ - sgpio_clrsetbits(bank->priv, REG_INT_TRIGGER, addr.bit, - BIT(addr.port), (!!(type & 0x1)) << addr.port); -- sgpio_clrsetbits(bank->priv, REG_INT_TRIGGER + SGPIO_MAX_BITS, addr.bit, -+ sgpio_clrsetbits(bank->priv, REG_INT_TRIGGER, SGPIO_MAX_BITS + addr.bit, - BIT(addr.port), (!!(type & 0x2)) << addr.port); - - if (type == SGPIO_INT_TRG_LEVEL) -diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c -index aa1a1c850d057..53a0badc6b035 100644 ---- a/drivers/pinctrl/pinctrl-rockchip.c -+++ b/drivers/pinctrl/pinctrl-rockchip.c -@@ -3727,12 +3727,15 @@ static int __maybe_unused rockchip_pinctrl_suspend(struct device *dev) - static int __maybe_unused rockchip_pinctrl_resume(struct device *dev) - { - struct rockchip_pinctrl *info = dev_get_drvdata(dev); -- int ret = regmap_write(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX, -- rk3288_grf_gpio6c_iomux | -- GPIO6C6_SEL_WRITE_ENABLE); -+ int ret; - -- if (ret) -- return ret; -+ if (info->ctrl->type == RK3288) { -+ ret = regmap_write(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX, -+ rk3288_grf_gpio6c_iomux | -+ GPIO6C6_SEL_WRITE_ENABLE); -+ if (ret) -+ return ret; -+ } - - return pinctrl_force_default(info->pctl_dev); - } -diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c -index 369ee20a7ea95..2f19ab4db7208 100644 ---- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c -+++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c -@@ -392,7 +392,7 @@ static int lpi_config_set(struct pinctrl_dev *pctldev, unsigned int group, - unsigned long *configs, unsigned int nconfs) - { - struct lpi_pinctrl *pctrl = dev_get_drvdata(pctldev->dev); -- unsigned int param, arg, pullup, strength; -+ unsigned int param, arg, pullup = LPI_GPIO_BIAS_DISABLE, strength = 2; - bool value, output_enabled = false; - const struct lpi_pingroup *g; - unsigned long sval; -diff --git a/drivers/pinctrl/qcom/pinctrl-sc7280.c b/drivers/pinctrl/qcom/pinctrl-sc7280.c -index 8daccd5302854..9d41abfca37ea 100644 ---- a/drivers/pinctrl/qcom/pinctrl-sc7280.c -+++ b/drivers/pinctrl/qcom/pinctrl-sc7280.c -@@ -1439,14 +1439,14 @@ static const struct msm_pingroup sc7280_groups[] = { - [172] = PINGROUP(172, qdss, _, _, _, _, _, _, _, _), - [173] = PINGROUP(173, qdss, _, _, _, _, _, _, _, _), - [174] = PINGROUP(174, qdss, _, _, _, _, _, _, _, _), -- [175] = UFS_RESET(ufs_reset, 0x1be000), -- [176] = SDC_QDSD_PINGROUP(sdc1_rclk, 0x1b3000, 15, 0), -- [177] = SDC_QDSD_PINGROUP(sdc1_clk, 0x1b3000, 13, 6), -- [178] = SDC_QDSD_PINGROUP(sdc1_cmd, 0x1b3000, 11, 3), -- [179] = SDC_QDSD_PINGROUP(sdc1_data, 0x1b3000, 9, 0), -- [180] = SDC_QDSD_PINGROUP(sdc2_clk, 0x1b4000, 14, 6), -- [181] = SDC_QDSD_PINGROUP(sdc2_cmd, 0x1b4000, 11, 3), -- [182] = SDC_QDSD_PINGROUP(sdc2_data, 0x1b4000, 9, 0), -+ [175] = UFS_RESET(ufs_reset, 0xbe000), -+ [176] = SDC_QDSD_PINGROUP(sdc1_rclk, 0xb3004, 0, 6), -+ [177] = SDC_QDSD_PINGROUP(sdc1_clk, 0xb3000, 13, 6), -+ [178] = SDC_QDSD_PINGROUP(sdc1_cmd, 0xb3000, 11, 3), -+ [179] = SDC_QDSD_PINGROUP(sdc1_data, 0xb3000, 9, 0), -+ [180] = SDC_QDSD_PINGROUP(sdc2_clk, 0xb4000, 14, 6), -+ [181] = SDC_QDSD_PINGROUP(sdc2_cmd, 0xb4000, 11, 3), -+ [182] = SDC_QDSD_PINGROUP(sdc2_data, 0xb4000, 9, 0), - }; - - static const struct msm_pinctrl_soc_data sc7280_pinctrl = { -diff --git a/drivers/pinctrl/qcom/pinctrl-sdx55.c b/drivers/pinctrl/qcom/pinctrl-sdx55.c -index 2b5b0e2b03add..5aaf57b40407f 100644 ---- a/drivers/pinctrl/qcom/pinctrl-sdx55.c -+++ b/drivers/pinctrl/qcom/pinctrl-sdx55.c -@@ -423,7 +423,7 @@ static const char * const gpio_groups[] = { - - static const char * const qdss_stm_groups[] = { - "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7", "gpio12", "gpio13", -- "gpio14", "gpio15", "gpio16", "gpio17", "gpio18", "gpio19" "gpio20", "gpio21", "gpio22", -+ "gpio14", "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21", "gpio22", - "gpio23", "gpio44", "gpio45", "gpio52", "gpio53", "gpio56", "gpio57", "gpio61", "gpio62", - "gpio63", "gpio64", "gpio65", "gpio66", - }; -diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h -index 10e5e6c8087dc..01620f3eab39f 100644 ---- a/drivers/scsi/qla2xxx/qla_target.h -+++ b/drivers/scsi/qla2xxx/qla_target.h -@@ -116,7 +116,6 @@ - (min(1270, ((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD_24XX + \ - QLA_TGT_DATASEGS_PER_CONT_24XX*((ql) - 1)) : 0)) - #endif --#endif - - #define GET_TARGET_ID(ha, iocb) ((HAS_EXTENDED_IDS(ha)) \ - ? le16_to_cpu((iocb)->u.isp2x.target.extended) \ -@@ -244,6 +243,7 @@ struct ctio_to_2xxx { - #ifndef CTIO_RET_TYPE - #define CTIO_RET_TYPE 0x17 /* CTIO return entry */ - #define ATIO_TYPE7 0x06 /* Accept target I/O entry for 24xx */ -+#endif - - struct fcp_hdr { - uint8_t r_ctl; -diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c -index 43f7624508a96..8b10fa4e381a4 100644 ---- a/drivers/scsi/st.c -+++ b/drivers/scsi/st.c -@@ -1269,8 +1269,8 @@ static int st_open(struct inode *inode, struct file *filp) - spin_lock(&st_use_lock); - if (STp->in_use) { - spin_unlock(&st_use_lock); -- scsi_tape_put(STp); - DEBC_printk(STp, "Device already in use.\n"); -+ scsi_tape_put(STp); - return (-EBUSY); - } - -diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c -index f42954e2c98e4..1fd29f93ff6d6 100644 ---- a/drivers/soc/qcom/qcom-geni-se.c -+++ b/drivers/soc/qcom/qcom-geni-se.c -@@ -3,7 +3,6 @@ - - #include - #include --#include - #include - #include - #include -@@ -92,14 +91,11 @@ struct geni_wrapper { - struct device *dev; - void __iomem *base; - struct clk_bulk_data ahb_clks[NUM_AHB_CLKS]; -- struct geni_icc_path to_core; - }; - - static const char * const icc_path_names[] = {"qup-core", "qup-config", - "qup-memory"}; - --static struct geni_wrapper *earlycon_wrapper; -- - #define QUP_HW_VER_REG 0x4 - - /* Common SE registers */ -@@ -843,44 +839,11 @@ int geni_icc_disable(struct geni_se *se) - } - EXPORT_SYMBOL(geni_icc_disable); - --void geni_remove_earlycon_icc_vote(void) --{ -- struct platform_device *pdev; -- struct geni_wrapper *wrapper; -- struct device_node *parent; -- struct device_node *child; -- -- if (!earlycon_wrapper) -- return; -- -- wrapper = earlycon_wrapper; -- parent = of_get_next_parent(wrapper->dev->of_node); -- for_each_child_of_node(parent, child) { -- if (!of_device_is_compatible(child, "qcom,geni-se-qup")) -- continue; -- -- pdev = of_find_device_by_node(child); -- if (!pdev) -- continue; -- -- wrapper = platform_get_drvdata(pdev); -- icc_put(wrapper->to_core.path); -- wrapper->to_core.path = NULL; -- -- } -- of_node_put(parent); -- -- earlycon_wrapper = NULL; --} --EXPORT_SYMBOL(geni_remove_earlycon_icc_vote); -- - static int geni_se_probe(struct platform_device *pdev) - { - struct device *dev = &pdev->dev; - struct resource *res; - struct geni_wrapper *wrapper; -- struct console __maybe_unused *bcon; -- bool __maybe_unused has_earlycon = false; - int ret; - - wrapper = devm_kzalloc(dev, sizeof(*wrapper), GFP_KERNEL); -@@ -903,43 +866,6 @@ static int geni_se_probe(struct platform_device *pdev) - } - } - --#ifdef CONFIG_SERIAL_EARLYCON -- for_each_console(bcon) { -- if (!strcmp(bcon->name, "qcom_geni")) { -- has_earlycon = true; -- break; -- } -- } -- if (!has_earlycon) -- goto exit; -- -- wrapper->to_core.path = devm_of_icc_get(dev, "qup-core"); -- if (IS_ERR(wrapper->to_core.path)) -- return PTR_ERR(wrapper->to_core.path); -- /* -- * Put minmal BW request on core clocks on behalf of early console. -- * The vote will be removed earlycon exit function. -- * -- * Note: We are putting vote on each QUP wrapper instead only to which -- * earlycon is connected because QUP core clock of different wrapper -- * share same voltage domain. If core1 is put to 0, then core2 will -- * also run at 0, if not voted. Default ICC vote will be removed ASA -- * we touch any of the core clock. -- * core1 = core2 = max(core1, core2) -- */ -- ret = icc_set_bw(wrapper->to_core.path, GENI_DEFAULT_BW, -- GENI_DEFAULT_BW); -- if (ret) { -- dev_err(&pdev->dev, "%s: ICC BW voting failed for core: %d\n", -- __func__, ret); -- return ret; -- } -- -- if (of_get_compatible_child(pdev->dev.of_node, "qcom,geni-debug-uart")) -- earlycon_wrapper = wrapper; -- of_node_put(pdev->dev.of_node); --exit: --#endif - dev_set_drvdata(dev, wrapper); - dev_dbg(dev, "GENI SE Driver probed\n"); - return devm_of_platform_populate(dev); -diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c -index d740c47827751..2f20bd56ec6ca 100644 ---- a/drivers/staging/comedi/drivers/cb_pcidas.c -+++ b/drivers/staging/comedi/drivers/cb_pcidas.c -@@ -1281,7 +1281,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, - devpriv->amcc + AMCC_OP_REG_INTCSR); - - ret = request_irq(pcidev->irq, cb_pcidas_interrupt, IRQF_SHARED, -- dev->board_name, dev); -+ "cb_pcidas", dev); - if (ret) { - dev_dbg(dev->class_dev, "unable to allocate irq %d\n", - pcidev->irq); -diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c -index fa987bb0e7cd4..6d3ba399a7f0b 100644 ---- a/drivers/staging/comedi/drivers/cb_pcidas64.c -+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c -@@ -4035,7 +4035,7 @@ static int auto_attach(struct comedi_device *dev, - init_stc_registers(dev); - - retval = request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED, -- dev->board_name, dev); -+ "cb_pcidas64", dev); - if (retval) { - dev_dbg(dev->class_dev, "unable to allocate irq %u\n", - pcidev->irq); -diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h -index b84f00b8d18bc..4cabaf21c1ca0 100644 ---- a/drivers/staging/rtl8192e/rtllib.h -+++ b/drivers/staging/rtl8192e/rtllib.h -@@ -1105,7 +1105,7 @@ struct rtllib_network { - bool bWithAironetIE; - bool bCkipSupported; - bool bCcxRmEnable; -- u16 CcxRmState[2]; -+ u8 CcxRmState[2]; - bool bMBssidValid; - u8 MBssidMask; - u8 MBssid[ETH_ALEN]; -diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c -index d31b5e1c8df47..63752233e551f 100644 ---- a/drivers/staging/rtl8192e/rtllib_rx.c -+++ b/drivers/staging/rtl8192e/rtllib_rx.c -@@ -1968,7 +1968,7 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee, - info_element->data[2] == 0x96 && - info_element->data[3] == 0x01) { - if (info_element->len == 6) { -- memcpy(network->CcxRmState, &info_element[4], 2); -+ memcpy(network->CcxRmState, &info_element->data[4], 2); - if (network->CcxRmState[0] != 0) - network->bCcxRmEnable = true; - else -diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c -index 0866e949339bd..9b73532464e55 100644 ---- a/drivers/thermal/thermal_sysfs.c -+++ b/drivers/thermal/thermal_sysfs.c -@@ -754,6 +754,9 @@ void thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev, - { - struct cooling_dev_stats *stats = cdev->stats; - -+ if (!stats) -+ return; -+ - spin_lock(&stats->lock); - - if (stats->state == new_state) -diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c -index 291649f028213..0d85b55ea8233 100644 ---- a/drivers/tty/serial/qcom_geni_serial.c -+++ b/drivers/tty/serial/qcom_geni_serial.c -@@ -1177,12 +1177,6 @@ static inline void qcom_geni_serial_enable_early_read(struct geni_se *se, - struct console *con) { } - #endif - --static int qcom_geni_serial_earlycon_exit(struct console *con) --{ -- geni_remove_earlycon_icc_vote(); -- return 0; --} -- - static struct qcom_geni_private_data earlycon_private_data; - - static int __init qcom_geni_serial_earlycon_setup(struct earlycon_device *dev, -@@ -1233,7 +1227,6 @@ static int __init qcom_geni_serial_earlycon_setup(struct earlycon_device *dev, - writel(stop_bit_len, uport->membase + SE_UART_TX_STOP_BIT_LEN); - - dev->con->write = qcom_geni_serial_earlycon_write; -- dev->con->exit = qcom_geni_serial_earlycon_exit; - dev->con->setup = NULL; - qcom_geni_serial_enable_early_read(&se, dev->con); - -diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c -index 2f4e5174e78c8..e79359326411a 100644 ---- a/drivers/usb/class/cdc-acm.c -+++ b/drivers/usb/class/cdc-acm.c -@@ -147,17 +147,29 @@ static inline int acm_set_control(struct acm *acm, int control) - #define acm_send_break(acm, ms) \ - acm_ctrl_msg(acm, USB_CDC_REQ_SEND_BREAK, ms, NULL, 0) - --static void acm_kill_urbs(struct acm *acm) -+static void acm_poison_urbs(struct acm *acm) - { - int i; - -- usb_kill_urb(acm->ctrlurb); -+ usb_poison_urb(acm->ctrlurb); - for (i = 0; i < ACM_NW; i++) -- usb_kill_urb(acm->wb[i].urb); -+ usb_poison_urb(acm->wb[i].urb); - for (i = 0; i < acm->rx_buflimit; i++) -- usb_kill_urb(acm->read_urbs[i]); -+ usb_poison_urb(acm->read_urbs[i]); - } - -+static void acm_unpoison_urbs(struct acm *acm) -+{ -+ int i; -+ -+ for (i = 0; i < acm->rx_buflimit; i++) -+ usb_unpoison_urb(acm->read_urbs[i]); -+ for (i = 0; i < ACM_NW; i++) -+ usb_unpoison_urb(acm->wb[i].urb); -+ usb_unpoison_urb(acm->ctrlurb); -+} -+ -+ - /* - * Write buffer management. - * All of these assume proper locks taken by the caller. -@@ -226,9 +238,10 @@ static int acm_start_wb(struct acm *acm, struct acm_wb *wb) - - rc = usb_submit_urb(wb->urb, GFP_ATOMIC); - if (rc < 0) { -- dev_err(&acm->data->dev, -- "%s - usb_submit_urb(write bulk) failed: %d\n", -- __func__, rc); -+ if (rc != -EPERM) -+ dev_err(&acm->data->dev, -+ "%s - usb_submit_urb(write bulk) failed: %d\n", -+ __func__, rc); - acm_write_done(acm, wb); - } - return rc; -@@ -313,8 +326,10 @@ static void acm_process_notification(struct acm *acm, unsigned char *buf) - acm->iocount.dsr++; - if (difference & ACM_CTRL_DCD) - acm->iocount.dcd++; -- if (newctrl & ACM_CTRL_BRK) -+ if (newctrl & ACM_CTRL_BRK) { - acm->iocount.brk++; -+ tty_insert_flip_char(&acm->port, 0, TTY_BREAK); -+ } - if (newctrl & ACM_CTRL_RI) - acm->iocount.rng++; - if (newctrl & ACM_CTRL_FRAMING) -@@ -480,11 +495,6 @@ static void acm_read_bulk_callback(struct urb *urb) - dev_vdbg(&acm->data->dev, "got urb %d, len %d, status %d\n", - rb->index, urb->actual_length, status); - -- if (!acm->dev) { -- dev_dbg(&acm->data->dev, "%s - disconnected\n", __func__); -- return; -- } -- - switch (status) { - case 0: - usb_mark_last_busy(acm->dev); -@@ -649,7 +659,8 @@ static void acm_port_dtr_rts(struct tty_port *port, int raise) - - res = acm_set_control(acm, val); - if (res && (acm->ctrl_caps & USB_CDC_CAP_LINE)) -- dev_err(&acm->control->dev, "failed to set dtr/rts\n"); -+ /* This is broken in too many devices to spam the logs */ -+ dev_dbg(&acm->control->dev, "failed to set dtr/rts\n"); - } - - static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) -@@ -731,6 +742,7 @@ static void acm_port_shutdown(struct tty_port *port) - * Need to grab write_lock to prevent race with resume, but no need to - * hold it due to the tty-port initialised flag. - */ -+ acm_poison_urbs(acm); - spin_lock_irq(&acm->write_lock); - spin_unlock_irq(&acm->write_lock); - -@@ -747,7 +759,8 @@ static void acm_port_shutdown(struct tty_port *port) - usb_autopm_put_interface_async(acm->control); - } - -- acm_kill_urbs(acm); -+ acm_unpoison_urbs(acm); -+ - } - - static void acm_tty_cleanup(struct tty_struct *tty) -@@ -1503,12 +1516,16 @@ skip_countries: - - return 0; - alloc_fail6: -+ if (!acm->combined_interfaces) { -+ /* Clear driver data so that disconnect() returns early. */ -+ usb_set_intfdata(data_interface, NULL); -+ usb_driver_release_interface(&acm_driver, data_interface); -+ } - if (acm->country_codes) { - device_remove_file(&acm->control->dev, - &dev_attr_wCountryCodes); - device_remove_file(&acm->control->dev, - &dev_attr_iCountryCodeRelDate); -- kfree(acm->country_codes); - } - device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); - alloc_fail5: -@@ -1540,8 +1557,14 @@ static void acm_disconnect(struct usb_interface *intf) - if (!acm) - return; - -- mutex_lock(&acm->mutex); - acm->disconnected = true; -+ /* -+ * there is a circular dependency. acm_softint() can resubmit -+ * the URBs in error handling so we need to block any -+ * submission right away -+ */ -+ acm_poison_urbs(acm); -+ mutex_lock(&acm->mutex); - if (acm->country_codes) { - device_remove_file(&acm->control->dev, - &dev_attr_wCountryCodes); -@@ -1560,7 +1583,6 @@ static void acm_disconnect(struct usb_interface *intf) - tty_kref_put(tty); - } - -- acm_kill_urbs(acm); - cancel_delayed_work_sync(&acm->dwork); - - tty_unregister_device(acm_tty_driver, acm->minor); -@@ -1602,7 +1624,7 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message) - if (cnt) - return 0; - -- acm_kill_urbs(acm); -+ acm_poison_urbs(acm); - cancel_delayed_work_sync(&acm->dwork); - acm->urbs_in_error_delay = 0; - -@@ -1615,6 +1637,7 @@ static int acm_resume(struct usb_interface *intf) - struct urb *urb; - int rv = 0; - -+ acm_unpoison_urbs(acm); - spin_lock_irq(&acm->write_lock); - - if (--acm->susp_count) -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c -index 6ade3daf78584..76ac5d6555ae4 100644 ---- a/drivers/usb/core/quirks.c -+++ b/drivers/usb/core/quirks.c -@@ -498,6 +498,10 @@ static const struct usb_device_id usb_quirk_list[] = { - /* DJI CineSSD */ - { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, - -+ /* Fibocom L850-GL LTE Modem */ -+ { USB_DEVICE(0x2cb7, 0x0007), .driver_info = -+ USB_QUIRK_IGNORE_REMOTE_WAKEUP }, -+ - /* INTEL VALUE SSD */ - { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, - -diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c -index fc3269f5faf19..1a9789ec5847f 100644 ---- a/drivers/usb/dwc2/hcd.c -+++ b/drivers/usb/dwc2/hcd.c -@@ -4322,7 +4322,8 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd) - if (hsotg->op_state == OTG_STATE_B_PERIPHERAL) - goto unlock; - -- if (hsotg->params.power_down > DWC2_POWER_DOWN_PARAM_PARTIAL) -+ if (hsotg->params.power_down != DWC2_POWER_DOWN_PARAM_PARTIAL || -+ hsotg->flags.b.port_connect_status == 0) - goto skip_power_saving; - - /* -@@ -5398,7 +5399,7 @@ int dwc2_host_enter_hibernation(struct dwc2_hsotg *hsotg) - dwc2_writel(hsotg, hprt0, HPRT0); - - /* Wait for the HPRT0.PrtSusp register field to be set */ -- if (dwc2_hsotg_wait_bit_set(hsotg, HPRT0, HPRT0_SUSP, 3000)) -+ if (dwc2_hsotg_wait_bit_set(hsotg, HPRT0, HPRT0_SUSP, 5000)) - dev_warn(hsotg->dev, "Suspend wasn't generated\n"); - - /* -diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c -index bae6a70664c80..598daed8086f6 100644 ---- a/drivers/usb/dwc3/dwc3-pci.c -+++ b/drivers/usb/dwc3/dwc3-pci.c -@@ -118,6 +118,8 @@ static const struct property_entry dwc3_pci_intel_properties[] = { - static const struct property_entry dwc3_pci_mrfld_properties[] = { - PROPERTY_ENTRY_STRING("dr_mode", "otg"), - PROPERTY_ENTRY_STRING("linux,extcon-name", "mrfld_bcove_pwrsrc"), -+ PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"), -+ PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"), - PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), - {} - }; -diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c -index c00c4fa139b88..8bd077fb1190f 100644 ---- a/drivers/usb/dwc3/dwc3-qcom.c -+++ b/drivers/usb/dwc3/dwc3-qcom.c -@@ -244,6 +244,9 @@ static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom) - struct device *dev = qcom->dev; - int ret; - -+ if (has_acpi_companion(dev)) -+ return 0; -+ - qcom->icc_path_ddr = of_icc_get(dev, "usb-ddr"); - if (IS_ERR(qcom->icc_path_ddr)) { - dev_err(dev, "failed to get usb-ddr path: %ld\n", -diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c -index 2a86ad4b12b34..65ff41e3a18eb 100644 ---- a/drivers/usb/dwc3/gadget.c -+++ b/drivers/usb/dwc3/gadget.c -@@ -791,10 +791,6 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) - reg &= ~DWC3_DALEPENA_EP(dep->number); - dwc3_writel(dwc->regs, DWC3_DALEPENA, reg); - -- dep->stream_capable = false; -- dep->type = 0; -- dep->flags = 0; -- - /* Clear out the ep descriptors for non-ep0 */ - if (dep->number > 1) { - dep->endpoint.comp_desc = NULL; -@@ -803,6 +799,10 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) - - dwc3_remove_requests(dwc, dep); - -+ dep->stream_capable = false; -+ dep->type = 0; -+ dep->flags = 0; -+ - return 0; - } - -diff --git a/drivers/usb/gadget/udc/amd5536udc_pci.c b/drivers/usb/gadget/udc/amd5536udc_pci.c -index 8d387e0e4d91f..c80f9bd51b750 100644 ---- a/drivers/usb/gadget/udc/amd5536udc_pci.c -+++ b/drivers/usb/gadget/udc/amd5536udc_pci.c -@@ -153,6 +153,11 @@ static int udc_pci_probe( - pci_set_master(pdev); - pci_try_set_mwi(pdev); - -+ dev->phys_addr = resource; -+ dev->irq = pdev->irq; -+ dev->pdev = pdev; -+ dev->dev = &pdev->dev; -+ - /* init dma pools */ - if (use_dma) { - retval = init_dma_pools(dev); -@@ -160,11 +165,6 @@ static int udc_pci_probe( - goto err_dma; - } - -- dev->phys_addr = resource; -- dev->irq = pdev->irq; -- dev->pdev = pdev; -- dev->dev = &pdev->dev; -- - /* general probing */ - if (udc_probe(dev)) { - retval = -ENODEV; -diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c -index fe010cc61f19b..2f27dc0d9c6bd 100644 ---- a/drivers/usb/host/xhci-mtk.c -+++ b/drivers/usb/host/xhci-mtk.c -@@ -397,6 +397,13 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) - xhci->quirks |= XHCI_SPURIOUS_SUCCESS; - if (mtk->lpm_support) - xhci->quirks |= XHCI_LPM_SUPPORT; -+ -+ /* -+ * MTK xHCI 0.96: PSA is 1 by default even if doesn't support stream, -+ * and it's 3 when support it. -+ */ -+ if (xhci->hci_version < 0x100 && HCC_MAX_PSA(xhci->hcc_params) == 4) -+ xhci->quirks |= XHCI_BROKEN_STREAMS; - } - - /* called during probe() after chip reset completes */ -@@ -548,7 +555,8 @@ static int xhci_mtk_probe(struct platform_device *pdev) - if (ret) - goto put_usb3_hcd; - -- if (HCC_MAX_PSA(xhci->hcc_params) >= 4) -+ if (HCC_MAX_PSA(xhci->hcc_params) >= 4 && -+ !(xhci->quirks & XHCI_BROKEN_STREAMS)) - xhci->shared_hcd->can_do_streams = 1; - - ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); -diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c -index 3209b5ddd30c9..a20a8380ca0c9 100644 ---- a/drivers/usb/usbip/vhci_hcd.c -+++ b/drivers/usb/usbip/vhci_hcd.c -@@ -594,6 +594,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, - pr_err("invalid port number %d\n", wIndex); - goto error; - } -+ if (wValue >= 32) -+ goto error; - if (hcd->speed == HCD_USB3) { - if ((vhci_hcd->port_status[rhport] & - USB_SS_PORT_STAT_POWER) != 0) { -diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig -index 40a223381ab61..0f28bf99efebc 100644 ---- a/drivers/vfio/pci/Kconfig -+++ b/drivers/vfio/pci/Kconfig -@@ -42,7 +42,7 @@ config VFIO_PCI_IGD - - config VFIO_PCI_NVLINK2 - def_bool y -- depends on VFIO_PCI && PPC_POWERNV -+ depends on VFIO_PCI && PPC_POWERNV && SPAPR_TCE_IOMMU - help - VFIO PCI support for P9 Witherspoon machine with NVIDIA V100 GPUs - -diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c -index a262e12c6dc26..5ccb0705beae1 100644 ---- a/drivers/vhost/vhost.c -+++ b/drivers/vhost/vhost.c -@@ -332,8 +332,8 @@ static void vhost_vq_reset(struct vhost_dev *dev, - vq->error_ctx = NULL; - vq->kick = NULL; - vq->log_ctx = NULL; -- vhost_reset_is_le(vq); - vhost_disable_cross_endian(vq); -+ vhost_reset_is_le(vq); - vq->busyloop_timeout = 0; - vq->umem = NULL; - vq->iotlb = NULL; -diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c -index bf61598bf1c39..35fdec88d38d9 100644 ---- a/drivers/video/fbdev/core/fbcon.c -+++ b/drivers/video/fbdev/core/fbcon.c -@@ -1341,6 +1341,9 @@ static void fbcon_cursor(struct vc_data *vc, int mode) - - ops->cursor_flash = (mode == CM_ERASE) ? 0 : 1; - -+ if (!ops->cursor) -+ return; -+ - if (mode & CM_SOFTBACK) { - mode &= ~CM_SOFTBACK; - y = softback_lines; -diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c -index c8b0ae676809b..4dc9077dd2ac0 100644 ---- a/drivers/video/fbdev/hyperv_fb.c -+++ b/drivers/video/fbdev/hyperv_fb.c -@@ -1031,7 +1031,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) - PCI_DEVICE_ID_HYPERV_VIDEO, NULL); - if (!pdev) { - pr_err("Unable to find PCI Hyper-V video\n"); -- kfree(info->apertures); - return -ENODEV; - } - -@@ -1129,7 +1128,6 @@ getmem_done: - } else { - pci_dev_put(pdev); - } -- kfree(info->apertures); - - return 0; - -@@ -1141,7 +1139,6 @@ err2: - err1: - if (!gen2vm) - pci_dev_put(pdev); -- kfree(info->apertures); - - return -ENOMEM; - } -diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c -index f45f9feebe593..74a5172c2d838 100644 ---- a/fs/ext4/balloc.c -+++ b/fs/ext4/balloc.c -@@ -626,27 +626,41 @@ int ext4_claim_free_clusters(struct ext4_sb_info *sbi, - - /** - * ext4_should_retry_alloc() - check if a block allocation should be retried -- * @sb: super block -- * @retries: number of attemps has been made -+ * @sb: superblock -+ * @retries: number of retry attempts made so far - * -- * ext4_should_retry_alloc() is called when ENOSPC is returned, and if -- * it is profitable to retry the operation, this function will wait -- * for the current or committing transaction to complete, and then -- * return TRUE. We will only retry once. -+ * ext4_should_retry_alloc() is called when ENOSPC is returned while -+ * attempting to allocate blocks. If there's an indication that a pending -+ * journal transaction might free some space and allow another attempt to -+ * succeed, this function will wait for the current or committing transaction -+ * to complete and then return TRUE. - */ - int ext4_should_retry_alloc(struct super_block *sb, int *retries) - { -- if (!ext4_has_free_clusters(EXT4_SB(sb), 1, 0) || -- (*retries)++ > 1 || -- !EXT4_SB(sb)->s_journal) -+ struct ext4_sb_info *sbi = EXT4_SB(sb); -+ -+ if (!sbi->s_journal) - return 0; - -- smp_mb(); -- if (EXT4_SB(sb)->s_mb_free_pending == 0) -+ if (++(*retries) > 3) { -+ percpu_counter_inc(&sbi->s_sra_exceeded_retry_limit); - return 0; -+ } - -+ /* -+ * if there's no indication that blocks are about to be freed it's -+ * possible we just missed a transaction commit that did so -+ */ -+ smp_mb(); -+ if (sbi->s_mb_free_pending == 0) -+ return ext4_has_free_clusters(sbi, 1, 0); -+ -+ /* -+ * it's possible we've just missed a transaction commit here, -+ * so ignore the returned status -+ */ - jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id); -- jbd2_journal_force_commit_nested(EXT4_SB(sb)->s_journal); -+ (void) jbd2_journal_force_commit_nested(sbi->s_journal); - return 1; - } - -diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h -index e5c81593d972c..9ad539ee41964 100644 ---- a/fs/ext4/ext4.h -+++ b/fs/ext4/ext4.h -@@ -1484,6 +1484,7 @@ struct ext4_sb_info { - struct percpu_counter s_freeinodes_counter; - struct percpu_counter s_dirs_counter; - struct percpu_counter s_dirtyclusters_counter; -+ struct percpu_counter s_sra_exceeded_retry_limit; - struct blockgroup_lock *s_blockgroup_lock; - struct proc_dir_entry *s_proc; - struct kobject s_kobj; -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index ed498538a7499..3b9f7bf4045b0 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -1937,13 +1937,13 @@ static int __ext4_journalled_writepage(struct page *page, - if (!ret) - ret = err; - -- if (!ext4_has_inline_data(inode)) -- ext4_walk_page_buffers(NULL, page_bufs, 0, len, -- NULL, bput_one); - ext4_set_inode_state(inode, EXT4_STATE_JDATA); - out: - unlock_page(page); - out_no_pagelock: -+ if (!inline_data && page_bufs) -+ ext4_walk_page_buffers(NULL, page_bufs, 0, len, -+ NULL, bput_one); - brelse(inode_bh); - return ret; - } -diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c -index 078f26f4b56e3..9cc9e6c1d582f 100644 ---- a/fs/ext4/namei.c -+++ b/fs/ext4/namei.c -@@ -3785,14 +3785,14 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, - */ - retval = -ENOENT; - if (!old.bh || le32_to_cpu(old.de->inode) != old.inode->i_ino) -- goto end_rename; -+ goto release_bh; - - new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, - &new.de, &new.inlined); - if (IS_ERR(new.bh)) { - retval = PTR_ERR(new.bh); - new.bh = NULL; -- goto end_rename; -+ goto release_bh; - } - if (new.bh) { - if (!new.inode) { -@@ -3809,15 +3809,13 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, - handle = ext4_journal_start(old.dir, EXT4_HT_DIR, credits); - if (IS_ERR(handle)) { - retval = PTR_ERR(handle); -- handle = NULL; -- goto end_rename; -+ goto release_bh; - } - } else { - whiteout = ext4_whiteout_for_rename(&old, credits, &handle); - if (IS_ERR(whiteout)) { - retval = PTR_ERR(whiteout); -- whiteout = NULL; -- goto end_rename; -+ goto release_bh; - } - } - -@@ -3954,16 +3952,18 @@ end_rename: - ext4_resetent(handle, &old, - old.inode->i_ino, old_file_type); - drop_nlink(whiteout); -+ ext4_orphan_add(handle, whiteout); - } - unlock_new_inode(whiteout); -+ ext4_journal_stop(handle); - iput(whiteout); -- -+ } else { -+ ext4_journal_stop(handle); - } -+release_bh: - brelse(old.dir_bh); - brelse(old.bh); - brelse(new.bh); -- if (handle) -- ext4_journal_stop(handle); - return retval; - } - -diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index a1353b0825ea3..c8cc8175b376b 100644 ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -1210,6 +1210,7 @@ static void ext4_put_super(struct super_block *sb) - percpu_counter_destroy(&sbi->s_freeinodes_counter); - percpu_counter_destroy(&sbi->s_dirs_counter); - percpu_counter_destroy(&sbi->s_dirtyclusters_counter); -+ percpu_counter_destroy(&sbi->s_sra_exceeded_retry_limit); - percpu_free_rwsem(&sbi->s_writepages_rwsem); - #ifdef CONFIG_QUOTA - for (i = 0; i < EXT4_MAXQUOTAS; i++) -@@ -5011,6 +5012,9 @@ no_journal: - if (!err) - err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0, - GFP_KERNEL); -+ if (!err) -+ err = percpu_counter_init(&sbi->s_sra_exceeded_retry_limit, 0, -+ GFP_KERNEL); - if (!err) - err = percpu_init_rwsem(&sbi->s_writepages_rwsem); - -@@ -5124,6 +5128,7 @@ failed_mount6: - percpu_counter_destroy(&sbi->s_freeinodes_counter); - percpu_counter_destroy(&sbi->s_dirs_counter); - percpu_counter_destroy(&sbi->s_dirtyclusters_counter); -+ percpu_counter_destroy(&sbi->s_sra_exceeded_retry_limit); - percpu_free_rwsem(&sbi->s_writepages_rwsem); - failed_mount5: - ext4_ext_release(sb); -diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c -index 075aa3a19ff5f..a3d08276d441e 100644 ---- a/fs/ext4/sysfs.c -+++ b/fs/ext4/sysfs.c -@@ -24,6 +24,7 @@ typedef enum { - attr_session_write_kbytes, - attr_lifetime_write_kbytes, - attr_reserved_clusters, -+ attr_sra_exceeded_retry_limit, - attr_inode_readahead, - attr_trigger_test_error, - attr_first_error_time, -@@ -202,6 +203,7 @@ EXT4_ATTR_FUNC(delayed_allocation_blocks, 0444); - EXT4_ATTR_FUNC(session_write_kbytes, 0444); - EXT4_ATTR_FUNC(lifetime_write_kbytes, 0444); - EXT4_ATTR_FUNC(reserved_clusters, 0644); -+EXT4_ATTR_FUNC(sra_exceeded_retry_limit, 0444); - - EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, inode_readahead, - ext4_sb_info, s_inode_readahead_blks); -@@ -251,6 +253,7 @@ static struct attribute *ext4_attrs[] = { - ATTR_LIST(session_write_kbytes), - ATTR_LIST(lifetime_write_kbytes), - ATTR_LIST(reserved_clusters), -+ ATTR_LIST(sra_exceeded_retry_limit), - ATTR_LIST(inode_readahead_blks), - ATTR_LIST(inode_goal), - ATTR_LIST(mb_stats), -@@ -374,6 +377,10 @@ static ssize_t ext4_attr_show(struct kobject *kobj, - return snprintf(buf, PAGE_SIZE, "%llu\n", - (unsigned long long) - atomic64_read(&sbi->s_resv_clusters)); -+ case attr_sra_exceeded_retry_limit: -+ return snprintf(buf, PAGE_SIZE, "%llu\n", -+ (unsigned long long) -+ percpu_counter_sum(&sbi->s_sra_exceeded_retry_limit)); - case attr_inode_readahead: - case attr_pointer_ui: - if (!ptr) -diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c -index 8868ac31a3c0a..4ee6f734ba838 100644 ---- a/fs/fuse/virtio_fs.c -+++ b/fs/fuse/virtio_fs.c -@@ -1324,8 +1324,15 @@ static int virtio_fs_fill_super(struct super_block *sb, struct fs_context *fsc) - - /* virtiofs allocates and installs its own fuse devices */ - ctx->fudptr = NULL; -- if (ctx->dax) -+ if (ctx->dax) { -+ if (!fs->dax_dev) { -+ err = -EINVAL; -+ pr_err("virtio-fs: dax can't be enabled as filesystem" -+ " device does not support it.\n"); -+ goto err_free_fuse_devs; -+ } - ctx->dax_dev = fs->dax_dev; -+ } - err = fuse_fill_super_common(sb, ctx); - if (err < 0) - goto err_free_fuse_devs; -diff --git a/fs/io_uring.c b/fs/io_uring.c -index 5c4378694d541..8b4213de9e085 100644 ---- a/fs/io_uring.c -+++ b/fs/io_uring.c -@@ -4628,6 +4628,7 @@ static int io_sendmsg(struct io_kiocb *req, bool force_nonblock, - struct io_async_msghdr iomsg, *kmsg; - struct socket *sock; - unsigned flags; -+ int min_ret = 0; - int ret; - - sock = sock_from_file(req->file); -@@ -4648,12 +4649,15 @@ static int io_sendmsg(struct io_kiocb *req, bool force_nonblock, - kmsg = &iomsg; - } - -- flags = req->sr_msg.msg_flags; -+ flags = req->sr_msg.msg_flags | MSG_NOSIGNAL; - if (flags & MSG_DONTWAIT) - req->flags |= REQ_F_NOWAIT; - else if (force_nonblock) - flags |= MSG_DONTWAIT; - -+ if (flags & MSG_WAITALL) -+ min_ret = iov_iter_count(&kmsg->msg.msg_iter); -+ - ret = __sys_sendmsg_sock(sock, &kmsg->msg, flags); - if (force_nonblock && ret == -EAGAIN) - return io_setup_async_msg(req, kmsg); -@@ -4663,7 +4667,7 @@ static int io_sendmsg(struct io_kiocb *req, bool force_nonblock, - if (kmsg->iov != kmsg->fast_iov) - kfree(kmsg->iov); - req->flags &= ~REQ_F_NEED_CLEANUP; -- if (ret < 0) -+ if (ret < min_ret) - req_set_fail_links(req); - __io_req_complete(req, ret, 0, cs); - return 0; -@@ -4677,6 +4681,7 @@ static int io_send(struct io_kiocb *req, bool force_nonblock, - struct iovec iov; - struct socket *sock; - unsigned flags; -+ int min_ret = 0; - int ret; - - sock = sock_from_file(req->file); -@@ -4692,12 +4697,15 @@ static int io_send(struct io_kiocb *req, bool force_nonblock, - msg.msg_controllen = 0; - msg.msg_namelen = 0; - -- flags = req->sr_msg.msg_flags; -+ flags = req->sr_msg.msg_flags | MSG_NOSIGNAL; - if (flags & MSG_DONTWAIT) - req->flags |= REQ_F_NOWAIT; - else if (force_nonblock) - flags |= MSG_DONTWAIT; - -+ if (flags & MSG_WAITALL) -+ min_ret = iov_iter_count(&msg.msg_iter); -+ - msg.msg_flags = flags; - ret = sock_sendmsg(sock, &msg); - if (force_nonblock && ret == -EAGAIN) -@@ -4705,7 +4713,7 @@ static int io_send(struct io_kiocb *req, bool force_nonblock, - if (ret == -ERESTARTSYS) - ret = -EINTR; - -- if (ret < 0) -+ if (ret < min_ret) - req_set_fail_links(req); - __io_req_complete(req, ret, 0, cs); - return 0; -@@ -4857,6 +4865,7 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock, - struct socket *sock; - struct io_buffer *kbuf; - unsigned flags; -+ int min_ret = 0; - int ret, cflags = 0; - - sock = sock_from_file(req->file); -@@ -4886,12 +4895,15 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock, - 1, req->sr_msg.len); - } - -- flags = req->sr_msg.msg_flags; -+ flags = req->sr_msg.msg_flags | MSG_NOSIGNAL; - if (flags & MSG_DONTWAIT) - req->flags |= REQ_F_NOWAIT; - else if (force_nonblock) - flags |= MSG_DONTWAIT; - -+ if (flags & MSG_WAITALL) -+ min_ret = iov_iter_count(&kmsg->msg.msg_iter); -+ - ret = __sys_recvmsg_sock(sock, &kmsg->msg, req->sr_msg.umsg, - kmsg->uaddr, flags); - if (force_nonblock && ret == -EAGAIN) -@@ -4904,7 +4916,7 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock, - if (kmsg->iov != kmsg->fast_iov) - kfree(kmsg->iov); - req->flags &= ~REQ_F_NEED_CLEANUP; -- if (ret < 0) -+ if (ret < min_ret || ((flags & MSG_WAITALL) && (kmsg->msg.msg_flags & (MSG_TRUNC | MSG_CTRUNC)))) - req_set_fail_links(req); - __io_req_complete(req, ret, cflags, cs); - return 0; -@@ -4920,6 +4932,7 @@ static int io_recv(struct io_kiocb *req, bool force_nonblock, - struct socket *sock; - struct iovec iov; - unsigned flags; -+ int min_ret = 0; - int ret, cflags = 0; - - sock = sock_from_file(req->file); -@@ -4944,12 +4957,15 @@ static int io_recv(struct io_kiocb *req, bool force_nonblock, - msg.msg_iocb = NULL; - msg.msg_flags = 0; - -- flags = req->sr_msg.msg_flags; -+ flags = req->sr_msg.msg_flags | MSG_NOSIGNAL; - if (flags & MSG_DONTWAIT) - req->flags |= REQ_F_NOWAIT; - else if (force_nonblock) - flags |= MSG_DONTWAIT; - -+ if (flags & MSG_WAITALL) -+ min_ret = iov_iter_count(&msg.msg_iter); -+ - ret = sock_recvmsg(sock, &msg, flags); - if (force_nonblock && ret == -EAGAIN) - return -EAGAIN; -@@ -4958,7 +4974,7 @@ static int io_recv(struct io_kiocb *req, bool force_nonblock, - out_free: - if (req->flags & REQ_F_BUFFER_SELECTED) - cflags = io_put_recv_kbuf(req); -- if (ret < 0) -+ if (ret < min_ret || ((flags & MSG_WAITALL) && (msg.msg_flags & (MSG_TRUNC | MSG_CTRUNC)))) - req_set_fail_links(req); - __io_req_complete(req, ret, cflags, cs); - return 0; -@@ -6496,7 +6512,6 @@ static enum hrtimer_restart io_link_timeout_fn(struct hrtimer *timer) - spin_unlock_irqrestore(&ctx->completion_lock, flags); - - if (prev) { -- req_set_fail_links(prev); - io_async_find_and_cancel(ctx, req, prev->user_data, -ETIME); - io_put_req_deferred(prev, 1); - } else { -@@ -8723,6 +8738,14 @@ static __poll_t io_uring_poll(struct file *file, poll_table *wait) - if (!io_sqring_full(ctx)) - mask |= EPOLLOUT | EPOLLWRNORM; - -+ /* prevent SQPOLL from submitting new requests */ -+ if (ctx->sq_data) { -+ io_sq_thread_park(ctx->sq_data); -+ list_del_init(&ctx->sqd_list); -+ io_sqd_update_thread_idle(ctx->sq_data); -+ io_sq_thread_unpark(ctx->sq_data); -+ } -+ - /* - * Don't flush cqring overflow list here, just do a simple check. - * Otherwise there could possible be ABBA deadlock: -diff --git a/fs/iomap/swapfile.c b/fs/iomap/swapfile.c -index a648dbf6991e4..a5e478de14174 100644 ---- a/fs/iomap/swapfile.c -+++ b/fs/iomap/swapfile.c -@@ -170,6 +170,16 @@ int iomap_swapfile_activate(struct swap_info_struct *sis, - return ret; - } - -+ /* -+ * If this swapfile doesn't contain even a single page-aligned -+ * contiguous range of blocks, reject this useless swapfile to -+ * prevent confusion later on. -+ */ -+ if (isi.nr_pages == 0) { -+ pr_warn("swapon: Cannot find a single usable page in file.\n"); -+ return -EINVAL; -+ } -+ - *pagespan = 1 + isi.highest_ppage - isi.lowest_ppage; - sis->max = isi.nr_pages; - sis->pages = isi.nr_pages - 1; -diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig -index dbbc583d62730..248f1459c0399 100644 ---- a/fs/nfsd/Kconfig -+++ b/fs/nfsd/Kconfig -@@ -73,6 +73,7 @@ config NFSD_V4 - select NFSD_V3 - select FS_POSIX_ACL - select SUNRPC_GSS -+ select CRYPTO - select CRYPTO_MD5 - select CRYPTO_SHA256 - select GRACE_PERIOD -diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c -index 052be5bf9ef50..7325592b456e5 100644 ---- a/fs/nfsd/nfs4callback.c -+++ b/fs/nfsd/nfs4callback.c -@@ -1189,6 +1189,7 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata) - switch (task->tk_status) { - case -EIO: - case -ETIMEDOUT: -+ case -EACCES: - nfsd4_mark_cb_down(clp, task->tk_status); - } - break; -diff --git a/fs/reiserfs/xattr.h b/fs/reiserfs/xattr.h -index c764352447ba1..81bec2c80b25c 100644 ---- a/fs/reiserfs/xattr.h -+++ b/fs/reiserfs/xattr.h -@@ -43,7 +43,7 @@ void reiserfs_security_free(struct reiserfs_security_handle *sec); - - static inline int reiserfs_xattrs_initialized(struct super_block *sb) - { -- return REISERFS_SB(sb)->priv_root != NULL; -+ return REISERFS_SB(sb)->priv_root && REISERFS_SB(sb)->xattr_root; - } - - #define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header)) -diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h -index 2564e66e67d74..562cb5e455240 100644 ---- a/include/drm/ttm/ttm_bo_api.h -+++ b/include/drm/ttm/ttm_bo_api.h -@@ -612,8 +612,10 @@ static inline void ttm_bo_pin(struct ttm_buffer_object *bo) - static inline void ttm_bo_unpin(struct ttm_buffer_object *bo) - { - dma_resv_assert_held(bo->base.resv); -- WARN_ON_ONCE(!bo->pin_count); -- --bo->pin_count; -+ if (bo->pin_count) -+ --bo->pin_count; -+ else -+ WARN_ON_ONCE(true); - } - - int ttm_mem_evict_first(struct ttm_bo_device *bdev, -diff --git a/include/linux/acpi.h b/include/linux/acpi.h -index b20568c440013..2f7508c3c2d6a 100644 ---- a/include/linux/acpi.h -+++ b/include/linux/acpi.h -@@ -222,10 +222,14 @@ void __iomem *__acpi_map_table(unsigned long phys, unsigned long size); - void __acpi_unmap_table(void __iomem *map, unsigned long size); - int early_acpi_boot_init(void); - int acpi_boot_init (void); -+void acpi_boot_table_prepare (void); - void acpi_boot_table_init (void); - int acpi_mps_check (void); - int acpi_numa_init (void); - -+int acpi_locate_initial_tables (void); -+void acpi_reserve_initial_tables (void); -+void acpi_table_init_complete (void); - int acpi_table_init (void); - int acpi_table_parse(char *id, acpi_tbl_table_handler handler); - int __init acpi_table_parse_entries(char *id, unsigned long table_size, -@@ -807,9 +811,12 @@ static inline int acpi_boot_init(void) - return 0; - } - -+static inline void acpi_boot_table_prepare(void) -+{ -+} -+ - static inline void acpi_boot_table_init(void) - { -- return; - } - - static inline int acpi_mps_check(void) -diff --git a/include/linux/can/can-ml.h b/include/linux/can/can-ml.h -index 2f5d731ae251d..8afa92d15a664 100644 ---- a/include/linux/can/can-ml.h -+++ b/include/linux/can/can-ml.h -@@ -44,6 +44,7 @@ - - #include - #include -+#include - - #define CAN_SFF_RCV_ARRAY_SZ (1 << CAN_SFF_ID_BITS) - #define CAN_EFF_RCV_HASH_BITS 10 -@@ -65,4 +66,15 @@ struct can_ml_priv { - #endif - }; - -+static inline struct can_ml_priv *can_get_ml_priv(struct net_device *dev) -+{ -+ return netdev_get_ml_priv(dev, ML_PRIV_CAN); -+} -+ -+static inline void can_set_ml_priv(struct net_device *dev, -+ struct can_ml_priv *ml_priv) -+{ -+ netdev_set_ml_priv(dev, ml_priv, ML_PRIV_CAN); -+} -+ - #endif /* CAN_ML_H */ -diff --git a/include/linux/extcon.h b/include/linux/extcon.h -index fd183fb9c20f7..0c19010da77fa 100644 ---- a/include/linux/extcon.h -+++ b/include/linux/extcon.h -@@ -271,6 +271,29 @@ static inline void devm_extcon_unregister_notifier(struct device *dev, - struct extcon_dev *edev, unsigned int id, - struct notifier_block *nb) { } - -+static inline int extcon_register_notifier_all(struct extcon_dev *edev, -+ struct notifier_block *nb) -+{ -+ return 0; -+} -+ -+static inline int extcon_unregister_notifier_all(struct extcon_dev *edev, -+ struct notifier_block *nb) -+{ -+ return 0; -+} -+ -+static inline int devm_extcon_register_notifier_all(struct device *dev, -+ struct extcon_dev *edev, -+ struct notifier_block *nb) -+{ -+ return 0; -+} -+ -+static inline void devm_extcon_unregister_notifier_all(struct device *dev, -+ struct extcon_dev *edev, -+ struct notifier_block *nb) { } -+ - static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name) - { - return ERR_PTR(-ENODEV); -diff --git a/include/linux/firmware/intel/stratix10-svc-client.h b/include/linux/firmware/intel/stratix10-svc-client.h -index a93d85932eb92..f843c6a10cf36 100644 ---- a/include/linux/firmware/intel/stratix10-svc-client.h -+++ b/include/linux/firmware/intel/stratix10-svc-client.h -@@ -56,7 +56,7 @@ - * COMMAND_RECONFIG_FLAG_PARTIAL: - * Set to FPGA configuration type (full or partial). - */ --#define COMMAND_RECONFIG_FLAG_PARTIAL 1 -+#define COMMAND_RECONFIG_FLAG_PARTIAL 0 - - /** - * Timeout settings for service clients: -diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h -index fb79ac497794b..688c7477ec0ab 100644 ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -1607,6 +1607,12 @@ enum netdev_priv_flags { - #define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER - #define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK - -+/* Specifies the type of the struct net_device::ml_priv pointer */ -+enum netdev_ml_priv_type { -+ ML_PRIV_NONE, -+ ML_PRIV_CAN, -+}; -+ - /** - * struct net_device - The DEVICE structure. - * -@@ -1802,6 +1808,7 @@ enum netdev_priv_flags { - * @nd_net: Network namespace this network device is inside - * - * @ml_priv: Mid-layer private -+ * @ml_priv_type: Mid-layer private type - * @lstats: Loopback statistics - * @tstats: Tunnel statistics - * @dstats: Dummy statistics -@@ -2114,8 +2121,10 @@ struct net_device { - possible_net_t nd_net; - - /* mid-layer private */ -+ void *ml_priv; -+ enum netdev_ml_priv_type ml_priv_type; -+ - union { -- void *ml_priv; - struct pcpu_lstats __percpu *lstats; - struct pcpu_sw_netstats __percpu *tstats; - struct pcpu_dstats __percpu *dstats; -@@ -2305,6 +2314,29 @@ static inline void netdev_reset_rx_headroom(struct net_device *dev) - netdev_set_rx_headroom(dev, -1); - } - -+static inline void *netdev_get_ml_priv(struct net_device *dev, -+ enum netdev_ml_priv_type type) -+{ -+ if (dev->ml_priv_type != type) -+ return NULL; -+ -+ return dev->ml_priv; -+} -+ -+static inline void netdev_set_ml_priv(struct net_device *dev, -+ void *ml_priv, -+ enum netdev_ml_priv_type type) -+{ -+ WARN(dev->ml_priv_type && dev->ml_priv_type != type, -+ "Overwriting already set ml_priv_type (%u) with different ml_priv_type (%u)!\n", -+ dev->ml_priv_type, type); -+ WARN(!dev->ml_priv_type && dev->ml_priv, -+ "Overwriting already set ml_priv and ml_priv_type is ML_PRIV_NONE!\n"); -+ -+ dev->ml_priv = ml_priv; -+ dev->ml_priv_type = type; -+} -+ - /* - * Net namespace inlines - */ -diff --git a/include/linux/qcom-geni-se.h b/include/linux/qcom-geni-se.h -index ec2ad4b0fe14f..c4fdb4463f7d5 100644 ---- a/include/linux/qcom-geni-se.h -+++ b/include/linux/qcom-geni-se.h -@@ -460,7 +460,5 @@ void geni_icc_set_tag(struct geni_se *se, u32 tag); - int geni_icc_enable(struct geni_se *se); - - int geni_icc_disable(struct geni_se *se); -- --void geni_remove_earlycon_icc_vote(void); - #endif - #endif -diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h -index 850424e5d0306..6ecf2a0220dbe 100644 ---- a/include/linux/ww_mutex.h -+++ b/include/linux/ww_mutex.h -@@ -173,9 +173,10 @@ static inline void ww_acquire_done(struct ww_acquire_ctx *ctx) - */ - static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx) - { --#ifdef CONFIG_DEBUG_MUTEXES -+#ifdef CONFIG_DEBUG_LOCK_ALLOC - mutex_release(&ctx->dep_map, _THIS_IP_); -- -+#endif -+#ifdef CONFIG_DEBUG_MUTEXES - DEBUG_LOCKS_WARN_ON(ctx->acquired); - if (!IS_ENABLED(CONFIG_PROVE_LOCKING)) - /* -diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c -index 5352ce50a97e3..2c25b830203cd 100644 ---- a/kernel/locking/mutex.c -+++ b/kernel/locking/mutex.c -@@ -636,7 +636,7 @@ static inline int mutex_can_spin_on_owner(struct mutex *lock) - */ - static __always_inline bool - mutex_optimistic_spin(struct mutex *lock, struct ww_acquire_ctx *ww_ctx, -- const bool use_ww_ctx, struct mutex_waiter *waiter) -+ struct mutex_waiter *waiter) - { - if (!waiter) { - /* -@@ -712,7 +712,7 @@ fail: - #else - static __always_inline bool - mutex_optimistic_spin(struct mutex *lock, struct ww_acquire_ctx *ww_ctx, -- const bool use_ww_ctx, struct mutex_waiter *waiter) -+ struct mutex_waiter *waiter) - { - return false; - } -@@ -932,6 +932,9 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, - struct ww_mutex *ww; - int ret; - -+ if (!use_ww_ctx) -+ ww_ctx = NULL; -+ - might_sleep(); - - #ifdef CONFIG_DEBUG_MUTEXES -@@ -939,7 +942,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, - #endif - - ww = container_of(lock, struct ww_mutex, base); -- if (use_ww_ctx && ww_ctx) { -+ if (ww_ctx) { - if (unlikely(ww_ctx == READ_ONCE(ww->ctx))) - return -EALREADY; - -@@ -956,10 +959,10 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, - mutex_acquire_nest(&lock->dep_map, subclass, 0, nest_lock, ip); - - if (__mutex_trylock(lock) || -- mutex_optimistic_spin(lock, ww_ctx, use_ww_ctx, NULL)) { -+ mutex_optimistic_spin(lock, ww_ctx, NULL)) { - /* got the lock, yay! */ - lock_acquired(&lock->dep_map, ip); -- if (use_ww_ctx && ww_ctx) -+ if (ww_ctx) - ww_mutex_set_context_fastpath(ww, ww_ctx); - preempt_enable(); - return 0; -@@ -970,7 +973,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, - * After waiting to acquire the wait_lock, try again. - */ - if (__mutex_trylock(lock)) { -- if (use_ww_ctx && ww_ctx) -+ if (ww_ctx) - __ww_mutex_check_waiters(lock, ww_ctx); - - goto skip_wait; -@@ -1023,7 +1026,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, - goto err; - } - -- if (use_ww_ctx && ww_ctx) { -+ if (ww_ctx) { - ret = __ww_mutex_check_kill(lock, &waiter, ww_ctx); - if (ret) - goto err; -@@ -1036,7 +1039,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, - * ww_mutex needs to always recheck its position since its waiter - * list is not FIFO ordered. - */ -- if ((use_ww_ctx && ww_ctx) || !first) { -+ if (ww_ctx || !first) { - first = __mutex_waiter_is_first(lock, &waiter); - if (first) - __mutex_set_flag(lock, MUTEX_FLAG_HANDOFF); -@@ -1049,7 +1052,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, - * or we must see its unlock and acquire. - */ - if (__mutex_trylock(lock) || -- (first && mutex_optimistic_spin(lock, ww_ctx, use_ww_ctx, &waiter))) -+ (first && mutex_optimistic_spin(lock, ww_ctx, &waiter))) - break; - - spin_lock(&lock->wait_lock); -@@ -1058,7 +1061,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, - acquired: - __set_current_state(TASK_RUNNING); - -- if (use_ww_ctx && ww_ctx) { -+ if (ww_ctx) { - /* - * Wound-Wait; we stole the lock (!first_waiter), check the - * waiters as anyone might want to wound us. -@@ -1078,7 +1081,7 @@ skip_wait: - /* got the lock - cleanup and rejoice! */ - lock_acquired(&lock->dep_map, ip); - -- if (use_ww_ctx && ww_ctx) -+ if (ww_ctx) - ww_mutex_lock_acquired(ww, ww_ctx); - - spin_unlock(&lock->wait_lock); -diff --git a/kernel/reboot.c b/kernel/reboot.c -index eb1b158507616..a6ad5eb2fa733 100644 ---- a/kernel/reboot.c -+++ b/kernel/reboot.c -@@ -244,8 +244,6 @@ void migrate_to_reboot_cpu(void) - void kernel_restart(char *cmd) - { - kernel_restart_prepare(cmd); -- if (pm_power_off_prepare) -- pm_power_off_prepare(); - migrate_to_reboot_cpu(); - syscore_shutdown(); - if (!cmd) -diff --git a/kernel/static_call.c b/kernel/static_call.c -index 49efbdc5b4800..f59089a122319 100644 ---- a/kernel/static_call.c -+++ b/kernel/static_call.c -@@ -149,6 +149,7 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func) - }; - - for (site_mod = &first; site_mod; site_mod = site_mod->next) { -+ bool init = system_state < SYSTEM_RUNNING; - struct module *mod = site_mod->mod; - - if (!site_mod->sites) { -@@ -168,6 +169,7 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func) - if (mod) { - stop = mod->static_call_sites + - mod->num_static_call_sites; -+ init = mod->state == MODULE_STATE_COMING; - } - #endif - -@@ -175,16 +177,8 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func) - site < stop && static_call_key(site) == key; site++) { - void *site_addr = static_call_addr(site); - -- if (static_call_is_init(site)) { -- /* -- * Don't write to call sites which were in -- * initmem and have since been freed. -- */ -- if (!mod && system_state >= SYSTEM_RUNNING) -- continue; -- if (mod && !within_module_init((unsigned long)site_addr, mod)) -- continue; -- } -+ if (!init && static_call_is_init(site)) -+ continue; - - if (!kernel_text_address((unsigned long)site_addr)) { - /* -diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index b5815a022ecc2..c27b05aeb7d2d 100644 ---- a/kernel/trace/trace.c -+++ b/kernel/trace/trace.c -@@ -2984,7 +2984,8 @@ static void __ftrace_trace_stack(struct trace_buffer *buffer, - - size = nr_entries * sizeof(unsigned long); - event = __trace_buffer_lock_reserve(buffer, TRACE_STACK, -- sizeof(*entry) + size, flags, pc); -+ (sizeof(*entry) - sizeof(entry->caller)) + size, -+ flags, pc); - if (!event) - goto out; - entry = ring_buffer_event_data(event); -diff --git a/mm/memory.c b/mm/memory.c -index 97e1d045f236f..bf0cbc8d56176 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -154,7 +154,7 @@ static int __init init_zero_pfn(void) - zero_pfn = page_to_pfn(ZERO_PAGE(0)); - return 0; - } --core_initcall(init_zero_pfn); -+early_initcall(init_zero_pfn); - - void mm_trace_rss_stat(struct mm_struct *mm, int member, long count) - { -diff --git a/net/9p/client.c b/net/9p/client.c -index 4f62f299da0cf..0a9019da18f39 100644 ---- a/net/9p/client.c -+++ b/net/9p/client.c -@@ -1623,10 +1623,6 @@ p9_client_read_once(struct p9_fid *fid, u64 offset, struct iov_iter *to, - } - - p9_debug(P9_DEBUG_9P, "<<< RREAD count %d\n", count); -- if (!count) { -- p9_tag_remove(clnt, req); -- return 0; -- } - - if (non_zc) { - int n = copy_to_iter(dataptr, count, to); -diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c -index ca1a0d07a0878..ebda397fa95a7 100644 ---- a/net/appletalk/ddp.c -+++ b/net/appletalk/ddp.c -@@ -1577,8 +1577,8 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) - struct sk_buff *skb; - struct net_device *dev; - struct ddpehdr *ddp; -- int size; -- struct atalk_route *rt; -+ int size, hard_header_len; -+ struct atalk_route *rt, *rt_lo = NULL; - int err; - - if (flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) -@@ -1641,7 +1641,22 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) - SOCK_DEBUG(sk, "SK %p: Size needed %d, device %s\n", - sk, size, dev->name); - -- size += dev->hard_header_len; -+ hard_header_len = dev->hard_header_len; -+ /* Leave room for loopback hardware header if necessary */ -+ if (usat->sat_addr.s_node == ATADDR_BCAST && -+ (dev->flags & IFF_LOOPBACK || !(rt->flags & RTF_GATEWAY))) { -+ struct atalk_addr at_lo; -+ -+ at_lo.s_node = 0; -+ at_lo.s_net = 0; -+ -+ rt_lo = atrtr_find(&at_lo); -+ -+ if (rt_lo && rt_lo->dev->hard_header_len > hard_header_len) -+ hard_header_len = rt_lo->dev->hard_header_len; -+ } -+ -+ size += hard_header_len; - release_sock(sk); - skb = sock_alloc_send_skb(sk, size, (flags & MSG_DONTWAIT), &err); - lock_sock(sk); -@@ -1649,7 +1664,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) - goto out; - - skb_reserve(skb, ddp_dl->header_length); -- skb_reserve(skb, dev->hard_header_len); -+ skb_reserve(skb, hard_header_len); - skb->dev = dev; - - SOCK_DEBUG(sk, "SK %p: Begin build.\n", sk); -@@ -1700,18 +1715,12 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) - /* loop back */ - skb_orphan(skb); - if (ddp->deh_dnode == ATADDR_BCAST) { -- struct atalk_addr at_lo; -- -- at_lo.s_node = 0; -- at_lo.s_net = 0; -- -- rt = atrtr_find(&at_lo); -- if (!rt) { -+ if (!rt_lo) { - kfree_skb(skb); - err = -ENETUNREACH; - goto out; - } -- dev = rt->dev; -+ dev = rt_lo->dev; - skb->dev = dev; - } - ddp_dl->request(ddp_dl, skb, dev->dev_addr); -diff --git a/net/can/af_can.c b/net/can/af_can.c -index 837bb8af0ec30..cce2af10eb3ea 100644 ---- a/net/can/af_can.c -+++ b/net/can/af_can.c -@@ -304,8 +304,8 @@ static struct can_dev_rcv_lists *can_dev_rcv_lists_find(struct net *net, - struct net_device *dev) - { - if (dev) { -- struct can_ml_priv *ml_priv = dev->ml_priv; -- return &ml_priv->dev_rcv_lists; -+ struct can_ml_priv *can_ml = can_get_ml_priv(dev); -+ return &can_ml->dev_rcv_lists; - } else { - return net->can.rx_alldev_list; - } -@@ -790,25 +790,6 @@ void can_proto_unregister(const struct can_proto *cp) - } - EXPORT_SYMBOL(can_proto_unregister); - --/* af_can notifier to create/remove CAN netdevice specific structs */ --static int can_notifier(struct notifier_block *nb, unsigned long msg, -- void *ptr) --{ -- struct net_device *dev = netdev_notifier_info_to_dev(ptr); -- -- if (dev->type != ARPHRD_CAN) -- return NOTIFY_DONE; -- -- switch (msg) { -- case NETDEV_REGISTER: -- WARN(!dev->ml_priv, -- "No CAN mid layer private allocated, please fix your driver and use alloc_candev()!\n"); -- break; -- } -- -- return NOTIFY_DONE; --} -- - static int can_pernet_init(struct net *net) - { - spin_lock_init(&net->can.rcvlists_lock); -@@ -876,11 +857,6 @@ static const struct net_proto_family can_family_ops = { - .owner = THIS_MODULE, - }; - --/* notifier block for netdevice event */ --static struct notifier_block can_netdev_notifier __read_mostly = { -- .notifier_call = can_notifier, --}; -- - static struct pernet_operations can_pernet_ops __read_mostly = { - .init = can_pernet_init, - .exit = can_pernet_exit, -@@ -911,17 +887,12 @@ static __init int can_init(void) - err = sock_register(&can_family_ops); - if (err) - goto out_sock; -- err = register_netdevice_notifier(&can_netdev_notifier); -- if (err) -- goto out_notifier; - - dev_add_pack(&can_packet); - dev_add_pack(&canfd_packet); - - return 0; - --out_notifier: -- sock_unregister(PF_CAN); - out_sock: - unregister_pernet_subsys(&can_pernet_ops); - out_pernet: -@@ -935,7 +906,6 @@ static __exit void can_exit(void) - /* protocol unregister */ - dev_remove_pack(&canfd_packet); - dev_remove_pack(&can_packet); -- unregister_netdevice_notifier(&can_netdev_notifier); - sock_unregister(PF_CAN); - - unregister_pernet_subsys(&can_pernet_ops); -diff --git a/net/can/j1939/main.c b/net/can/j1939/main.c -index bb914d8b42168..da3a7a7bcff2b 100644 ---- a/net/can/j1939/main.c -+++ b/net/can/j1939/main.c -@@ -140,9 +140,9 @@ static struct j1939_priv *j1939_priv_create(struct net_device *ndev) - static inline void j1939_priv_set(struct net_device *ndev, - struct j1939_priv *priv) - { -- struct can_ml_priv *can_ml_priv = ndev->ml_priv; -+ struct can_ml_priv *can_ml = can_get_ml_priv(ndev); - -- can_ml_priv->j1939_priv = priv; -+ can_ml->j1939_priv = priv; - } - - static void __j1939_priv_release(struct kref *kref) -@@ -211,12 +211,9 @@ static void __j1939_rx_release(struct kref *kref) - /* get pointer to priv without increasing ref counter */ - static inline struct j1939_priv *j1939_ndev_to_priv(struct net_device *ndev) - { -- struct can_ml_priv *can_ml_priv = ndev->ml_priv; -+ struct can_ml_priv *can_ml = can_get_ml_priv(ndev); - -- if (!can_ml_priv) -- return NULL; -- -- return can_ml_priv->j1939_priv; -+ return can_ml->j1939_priv; - } - - static struct j1939_priv *j1939_priv_get_by_ndev_locked(struct net_device *ndev) -@@ -225,9 +222,6 @@ static struct j1939_priv *j1939_priv_get_by_ndev_locked(struct net_device *ndev) - - lockdep_assert_held(&j1939_netdev_lock); - -- if (ndev->type != ARPHRD_CAN) -- return NULL; -- - priv = j1939_ndev_to_priv(ndev); - if (priv) - j1939_priv_get(priv); -@@ -348,15 +342,16 @@ static int j1939_netdev_notify(struct notifier_block *nb, - unsigned long msg, void *data) - { - struct net_device *ndev = netdev_notifier_info_to_dev(data); -+ struct can_ml_priv *can_ml = can_get_ml_priv(ndev); - struct j1939_priv *priv; - -+ if (!can_ml) -+ goto notify_done; -+ - priv = j1939_priv_get_by_ndev(ndev); - if (!priv) - goto notify_done; - -- if (ndev->type != ARPHRD_CAN) -- goto notify_put; -- - switch (msg) { - case NETDEV_DOWN: - j1939_cancel_active_session(priv, NULL); -@@ -365,7 +360,6 @@ static int j1939_netdev_notify(struct notifier_block *nb, - break; - } - --notify_put: - j1939_priv_put(priv); - - notify_done: -diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c -index f23966526a885..56aa66147d5ac 100644 ---- a/net/can/j1939/socket.c -+++ b/net/can/j1939/socket.c -@@ -12,6 +12,7 @@ - - #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -+#include - #include - #include - #include -@@ -453,6 +454,7 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) - j1939_jsk_del(priv, jsk); - j1939_local_ecu_put(priv, jsk->addr.src_name, jsk->addr.sa); - } else { -+ struct can_ml_priv *can_ml; - struct net_device *ndev; - - ndev = dev_get_by_index(net, addr->can_ifindex); -@@ -461,15 +463,8 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) - goto out_release_sock; - } - -- if (ndev->type != ARPHRD_CAN) { -- dev_put(ndev); -- ret = -ENODEV; -- goto out_release_sock; -- } -- -- if (!ndev->ml_priv) { -- netdev_warn_once(ndev, -- "No CAN mid layer private allocated, please fix your driver and use alloc_candev()!\n"); -+ can_ml = can_get_ml_priv(ndev); -+ if (!can_ml) { - dev_put(ndev); - ret = -ENODEV; - goto out_release_sock; -diff --git a/net/can/proc.c b/net/can/proc.c -index 5ea8695f507eb..b15760b5c1cce 100644 ---- a/net/can/proc.c -+++ b/net/can/proc.c -@@ -322,8 +322,11 @@ static int can_rcvlist_proc_show(struct seq_file *m, void *v) - - /* receive list for registered CAN devices */ - for_each_netdev_rcu(net, dev) { -- if (dev->type == ARPHRD_CAN && dev->ml_priv) -- can_rcvlist_proc_show_one(m, idx, dev, dev->ml_priv); -+ struct can_ml_priv *can_ml = can_get_ml_priv(dev); -+ -+ if (can_ml) -+ can_rcvlist_proc_show_one(m, idx, dev, -+ &can_ml->dev_rcv_lists); - } - - rcu_read_unlock(); -@@ -375,8 +378,10 @@ static int can_rcvlist_sff_proc_show(struct seq_file *m, void *v) - - /* sff receive list for registered CAN devices */ - for_each_netdev_rcu(net, dev) { -- if (dev->type == ARPHRD_CAN && dev->ml_priv) { -- dev_rcv_lists = dev->ml_priv; -+ struct can_ml_priv *can_ml = can_get_ml_priv(dev); -+ -+ if (can_ml) { -+ dev_rcv_lists = &can_ml->dev_rcv_lists; - can_rcvlist_proc_show_array(m, dev, dev_rcv_lists->rx_sff, - ARRAY_SIZE(dev_rcv_lists->rx_sff)); - } -@@ -406,8 +411,10 @@ static int can_rcvlist_eff_proc_show(struct seq_file *m, void *v) - - /* eff receive list for registered CAN devices */ - for_each_netdev_rcu(net, dev) { -- if (dev->type == ARPHRD_CAN && dev->ml_priv) { -- dev_rcv_lists = dev->ml_priv; -+ struct can_ml_priv *can_ml = can_get_ml_priv(dev); -+ -+ if (can_ml) { -+ dev_rcv_lists = &can_ml->dev_rcv_lists; - can_rcvlist_proc_show_array(m, dev, dev_rcv_lists->rx_eff, - ARRAY_SIZE(dev_rcv_lists->rx_eff)); - } -diff --git a/net/core/filter.c b/net/core/filter.c -index ee665720a41a0..8e4cc25cc98e1 100644 ---- a/net/core/filter.c -+++ b/net/core/filter.c -@@ -3552,11 +3552,7 @@ static int bpf_skb_net_shrink(struct sk_buff *skb, u32 off, u32 len_diff, - return 0; - } - --static u32 __bpf_skb_max_len(const struct sk_buff *skb) --{ -- return skb->dev ? skb->dev->mtu + skb->dev->hard_header_len : -- SKB_MAX_ALLOC; --} -+#define BPF_SKB_MAX_LEN SKB_MAX_ALLOC - - BPF_CALL_4(sk_skb_adjust_room, struct sk_buff *, skb, s32, len_diff, - u32, mode, u64, flags) -@@ -3605,7 +3601,7 @@ BPF_CALL_4(bpf_skb_adjust_room, struct sk_buff *, skb, s32, len_diff, - { - u32 len_cur, len_diff_abs = abs(len_diff); - u32 len_min = bpf_skb_net_base_len(skb); -- u32 len_max = __bpf_skb_max_len(skb); -+ u32 len_max = BPF_SKB_MAX_LEN; - __be16 proto = skb->protocol; - bool shrink = len_diff < 0; - u32 off; -@@ -3688,7 +3684,7 @@ static int bpf_skb_trim_rcsum(struct sk_buff *skb, unsigned int new_len) - static inline int __bpf_skb_change_tail(struct sk_buff *skb, u32 new_len, - u64 flags) - { -- u32 max_len = __bpf_skb_max_len(skb); -+ u32 max_len = BPF_SKB_MAX_LEN; - u32 min_len = __bpf_skb_min_len(skb); - int ret; - -@@ -3764,7 +3760,7 @@ static const struct bpf_func_proto sk_skb_change_tail_proto = { - static inline int __bpf_skb_change_head(struct sk_buff *skb, u32 head_room, - u64 flags) - { -- u32 max_len = __bpf_skb_max_len(skb); -+ u32 max_len = BPF_SKB_MAX_LEN; - u32 new_len = skb->len + head_room; - int ret; - -diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c -index 7a06d43016175..180be5102efc5 100644 ---- a/net/core/flow_dissector.c -+++ b/net/core/flow_dissector.c -@@ -1050,6 +1050,9 @@ proto_again: - key_control->addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; - } - -+ __skb_flow_dissect_ipv4(skb, flow_dissector, -+ target_container, data, iph); -+ - if (ip_is_fragment(iph)) { - key_control->flags |= FLOW_DIS_IS_FRAGMENT; - -@@ -1066,9 +1069,6 @@ proto_again: - } - } - -- __skb_flow_dissect_ipv4(skb, flow_dissector, -- target_container, data, iph); -- - break; - } - case htons(ETH_P_IPV6): { -diff --git a/net/mptcp/options.c b/net/mptcp/options.c -index 37ef0bf098f6d..9e86c601093f4 100644 ---- a/net/mptcp/options.c -+++ b/net/mptcp/options.c -@@ -885,8 +885,7 @@ static void ack_update_msk(struct mptcp_sock *msk, - msk->wnd_end = new_wnd_end; - - /* this assumes mptcp_incoming_options() is invoked after tcp_ack() */ -- if (after64(msk->wnd_end, READ_ONCE(msk->snd_nxt)) && -- sk_stream_memory_free(ssk)) -+ if (after64(msk->wnd_end, READ_ONCE(msk->snd_nxt))) - __mptcp_check_push(sk, ssk); - - if (after64(new_snd_una, old_snd_una)) { -diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c -index 7345df40385ab..5932b0ebecc31 100644 ---- a/net/mptcp/protocol.c -+++ b/net/mptcp/protocol.c -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -19,6 +20,7 @@ - #include - #if IS_ENABLED(CONFIG_MPTCP_IPV6) - #include -+#include - #endif - #include - #include -@@ -1440,7 +1442,7 @@ static void mptcp_push_release(struct sock *sk, struct sock *ssk, - release_sock(ssk); - } - --static void mptcp_push_pending(struct sock *sk, unsigned int flags) -+static void __mptcp_push_pending(struct sock *sk, unsigned int flags) - { - struct sock *prev_ssk = NULL, *ssk = NULL; - struct mptcp_sock *msk = mptcp_sk(sk); -@@ -1568,6 +1570,9 @@ out: - mptcp_set_timeout(sk, ssk); - tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, - info.size_goal); -+ if (!mptcp_timer_pending(sk)) -+ mptcp_reset_timer(sk); -+ - if (msk->snd_data_fin_enable && - msk->snd_nxt + 1 == msk->write_seq) - mptcp_schedule_work(sk); -@@ -1676,14 +1681,14 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) - - wait_for_memory: - set_bit(MPTCP_NOSPACE, &msk->flags); -- mptcp_push_pending(sk, msg->msg_flags); -+ __mptcp_push_pending(sk, msg->msg_flags); - ret = sk_stream_wait_memory(sk, &timeo); - if (ret) - goto out; - } - - if (copied) -- mptcp_push_pending(sk, msg->msg_flags); -+ __mptcp_push_pending(sk, msg->msg_flags); - - out: - release_sock(sk); -@@ -2289,13 +2294,12 @@ static void mptcp_worker(struct work_struct *work) - __mptcp_check_send_data_fin(sk); - mptcp_check_data_fin(sk); - -- /* if the msk data is completely acked, or the socket timedout, -- * there is no point in keeping around an orphaned sk -+ /* There is no point in keeping around an orphaned sk timedout or -+ * closed, but we need the msk around to reply to incoming DATA_FIN, -+ * even if it is orphaned and in FIN_WAIT2 state - */ - if (sock_flag(sk, SOCK_DEAD) && -- (mptcp_check_close_timeout(sk) || -- (state != sk->sk_state && -- ((1 << inet_sk_state_load(sk)) & (TCPF_CLOSE | TCPF_FIN_WAIT2))))) { -+ (mptcp_check_close_timeout(sk) || sk->sk_state == TCP_CLOSE)) { - inet_sk_state_store(sk, TCP_CLOSE); - __mptcp_destroy_sock(sk); - goto unlock; -@@ -2940,13 +2944,14 @@ static void mptcp_release_cb(struct sock *sk) - { - unsigned long flags, nflags; - -- /* push_pending may touch wmem_reserved, do it before the later -- * cleanup -- */ -- if (test_and_clear_bit(MPTCP_CLEAN_UNA, &mptcp_sk(sk)->flags)) -- __mptcp_clean_una(sk); -- if (test_and_clear_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags)) { -- /* mptcp_push_pending() acquires the subflow socket lock -+ for (;;) { -+ flags = 0; -+ if (test_and_clear_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags)) -+ flags |= BIT(MPTCP_PUSH_PENDING); -+ if (!flags) -+ break; -+ -+ /* the following actions acquire the subflow socket lock - * - * 1) can't be invoked in atomic scope - * 2) must avoid ABBA deadlock with msk socket spinlock: the RX -@@ -2955,11 +2960,21 @@ static void mptcp_release_cb(struct sock *sk) - */ - - spin_unlock_bh(&sk->sk_lock.slock); -- mptcp_push_pending(sk, 0); -+ if (flags & BIT(MPTCP_PUSH_PENDING)) -+ __mptcp_push_pending(sk, 0); -+ -+ cond_resched(); - spin_lock_bh(&sk->sk_lock.slock); - } - -- /* clear any wmem reservation and errors */ -+ if (test_and_clear_bit(MPTCP_CLEAN_UNA, &mptcp_sk(sk)->flags)) -+ __mptcp_clean_una(sk); -+ if (test_and_clear_bit(MPTCP_ERROR_REPORT, &mptcp_sk(sk)->flags)) -+ __mptcp_error_report(sk); -+ -+ /* push_pending may touch wmem_reserved, ensure we do the cleanup -+ * later -+ */ - __mptcp_update_wmem(sk); - __mptcp_update_rmem(sk); - -@@ -3318,7 +3333,7 @@ static __poll_t mptcp_check_writeable(struct mptcp_sock *msk) - struct sock *sk = (struct sock *)msk; - - if (unlikely(sk->sk_shutdown & SEND_SHUTDOWN)) -- return 0; -+ return EPOLLOUT | EPOLLWRNORM; - - if (sk_stream_is_writeable(sk)) - return EPOLLOUT | EPOLLWRNORM; -@@ -3351,16 +3366,47 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock, - mask |= mptcp_check_readable(msk); - mask |= mptcp_check_writeable(msk); - } -+ if (sk->sk_shutdown == SHUTDOWN_MASK || state == TCP_CLOSE) -+ mask |= EPOLLHUP; - if (sk->sk_shutdown & RCV_SHUTDOWN) - mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP; - -+ /* This barrier is coupled with smp_wmb() in tcp_reset() */ -+ smp_rmb(); -+ if (sk->sk_err) -+ mask |= EPOLLERR; -+ - return mask; - } - -+static int mptcp_release(struct socket *sock) -+{ -+ struct mptcp_subflow_context *subflow; -+ struct sock *sk = sock->sk; -+ struct mptcp_sock *msk; -+ -+ if (!sk) -+ return 0; -+ -+ lock_sock(sk); -+ -+ msk = mptcp_sk(sk); -+ -+ mptcp_for_each_subflow(msk, subflow) { -+ struct sock *ssk = mptcp_subflow_tcp_sock(subflow); -+ -+ ip_mc_drop_socket(ssk); -+ } -+ -+ release_sock(sk); -+ -+ return inet_release(sock); -+} -+ - static const struct proto_ops mptcp_stream_ops = { - .family = PF_INET, - .owner = THIS_MODULE, -- .release = inet_release, -+ .release = mptcp_release, - .bind = mptcp_bind, - .connect = mptcp_stream_connect, - .socketpair = sock_no_socketpair, -@@ -3407,10 +3453,35 @@ void __init mptcp_proto_init(void) - } - - #if IS_ENABLED(CONFIG_MPTCP_IPV6) -+static int mptcp6_release(struct socket *sock) -+{ -+ struct mptcp_subflow_context *subflow; -+ struct mptcp_sock *msk; -+ struct sock *sk = sock->sk; -+ -+ if (!sk) -+ return 0; -+ -+ lock_sock(sk); -+ -+ msk = mptcp_sk(sk); -+ -+ mptcp_for_each_subflow(msk, subflow) { -+ struct sock *ssk = mptcp_subflow_tcp_sock(subflow); -+ -+ ip_mc_drop_socket(ssk); -+ ipv6_sock_mc_close(ssk); -+ ipv6_sock_ac_close(ssk); -+ } -+ -+ release_sock(sk); -+ return inet6_release(sock); -+} -+ - static const struct proto_ops mptcp_v6_stream_ops = { - .family = PF_INET6, - .owner = THIS_MODULE, -- .release = inet6_release, -+ .release = mptcp6_release, - .bind = mptcp_bind, - .connect = mptcp_stream_connect, - .socketpair = sock_no_socketpair, -diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h -index c374345ad1349..62288836d0534 100644 ---- a/net/mptcp/protocol.h -+++ b/net/mptcp/protocol.h -@@ -96,6 +96,7 @@ - #define MPTCP_WORK_CLOSE_SUBFLOW 5 - #define MPTCP_PUSH_PENDING 6 - #define MPTCP_CLEAN_UNA 7 -+#define MPTCP_ERROR_REPORT 8 - - static inline bool before64(__u64 seq1, __u64 seq2) - { -@@ -413,6 +414,7 @@ struct mptcp_subflow_context { - void (*tcp_data_ready)(struct sock *sk); - void (*tcp_state_change)(struct sock *sk); - void (*tcp_write_space)(struct sock *sk); -+ void (*tcp_error_report)(struct sock *sk); - - struct rcu_head rcu; - }; -@@ -478,6 +480,7 @@ static inline void mptcp_subflow_tcp_fallback(struct sock *sk, - sk->sk_data_ready = ctx->tcp_data_ready; - sk->sk_state_change = ctx->tcp_state_change; - sk->sk_write_space = ctx->tcp_write_space; -+ sk->sk_error_report = ctx->tcp_error_report; - - inet_csk(sk)->icsk_af_ops = ctx->icsk_af_ops; - } -@@ -505,6 +508,7 @@ bool mptcp_finish_join(struct sock *sk); - bool mptcp_schedule_work(struct sock *sk); - void __mptcp_check_push(struct sock *sk, struct sock *ssk); - void __mptcp_data_acked(struct sock *sk); -+void __mptcp_error_report(struct sock *sk); - void mptcp_subflow_eof(struct sock *sk); - bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit); - void __mptcp_flush_join_list(struct mptcp_sock *msk); -diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c -index 96e040951cd40..f97f29df4505e 100644 ---- a/net/mptcp/subflow.c -+++ b/net/mptcp/subflow.c -@@ -92,7 +92,7 @@ static struct mptcp_sock *subflow_token_join_request(struct request_sock *req, - return msk; - } - --static int __subflow_init_req(struct request_sock *req, const struct sock *sk_listener) -+static void subflow_init_req(struct request_sock *req, const struct sock *sk_listener) - { - struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); - -@@ -100,16 +100,6 @@ static int __subflow_init_req(struct request_sock *req, const struct sock *sk_li - subflow_req->mp_join = 0; - subflow_req->msk = NULL; - mptcp_token_init_request(req); -- --#ifdef CONFIG_TCP_MD5SIG -- /* no MPTCP if MD5SIG is enabled on this socket or we may run out of -- * TCP option space. -- */ -- if (rcu_access_pointer(tcp_sk(sk_listener)->md5sig_info)) -- return -EINVAL; --#endif -- -- return 0; - } - - /* Init mptcp request socket. -@@ -117,20 +107,23 @@ static int __subflow_init_req(struct request_sock *req, const struct sock *sk_li - * Returns an error code if a JOIN has failed and a TCP reset - * should be sent. - */ --static int subflow_init_req(struct request_sock *req, -- const struct sock *sk_listener, -- struct sk_buff *skb) -+static int subflow_check_req(struct request_sock *req, -+ const struct sock *sk_listener, -+ struct sk_buff *skb) - { - struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk_listener); - struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); - struct mptcp_options_received mp_opt; -- int ret; - - pr_debug("subflow_req=%p, listener=%p", subflow_req, listener); - -- ret = __subflow_init_req(req, sk_listener); -- if (ret) -- return 0; -+#ifdef CONFIG_TCP_MD5SIG -+ /* no MPTCP if MD5SIG is enabled on this socket or we may run out of -+ * TCP option space. -+ */ -+ if (rcu_access_pointer(tcp_sk(sk_listener)->md5sig_info)) -+ return -EINVAL; -+#endif - - mptcp_get_options(skb, &mp_opt); - -@@ -205,10 +198,7 @@ int mptcp_subflow_init_cookie_req(struct request_sock *req, - struct mptcp_options_received mp_opt; - int err; - -- err = __subflow_init_req(req, sk_listener); -- if (err) -- return err; -- -+ subflow_init_req(req, sk_listener); - mptcp_get_options(skb, &mp_opt); - - if (mp_opt.mp_capable && mp_opt.mp_join) -@@ -248,12 +238,13 @@ static struct dst_entry *subflow_v4_route_req(const struct sock *sk, - int err; - - tcp_rsk(req)->is_mptcp = 1; -+ subflow_init_req(req, sk); - - dst = tcp_request_sock_ipv4_ops.route_req(sk, skb, fl, req); - if (!dst) - return NULL; - -- err = subflow_init_req(req, sk, skb); -+ err = subflow_check_req(req, sk, skb); - if (err == 0) - return dst; - -@@ -273,12 +264,13 @@ static struct dst_entry *subflow_v6_route_req(const struct sock *sk, - int err; - - tcp_rsk(req)->is_mptcp = 1; -+ subflow_init_req(req, sk); - - dst = tcp_request_sock_ipv6_ops.route_req(sk, skb, fl, req); - if (!dst) - return NULL; - -- err = subflow_init_req(req, sk, skb); -+ err = subflow_check_req(req, sk, skb); - if (err == 0) - return dst; - -@@ -1054,6 +1046,46 @@ static void subflow_write_space(struct sock *ssk) - /* we take action in __mptcp_clean_una() */ - } - -+void __mptcp_error_report(struct sock *sk) -+{ -+ struct mptcp_subflow_context *subflow; -+ struct mptcp_sock *msk = mptcp_sk(sk); -+ -+ mptcp_for_each_subflow(msk, subflow) { -+ struct sock *ssk = mptcp_subflow_tcp_sock(subflow); -+ int err = sock_error(ssk); -+ -+ if (!err) -+ continue; -+ -+ /* only propagate errors on fallen-back sockets or -+ * on MPC connect -+ */ -+ if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(msk)) -+ continue; -+ -+ inet_sk_state_store(sk, inet_sk_state_load(ssk)); -+ sk->sk_err = -err; -+ -+ /* This barrier is coupled with smp_rmb() in mptcp_poll() */ -+ smp_wmb(); -+ sk->sk_error_report(sk); -+ break; -+ } -+} -+ -+static void subflow_error_report(struct sock *ssk) -+{ -+ struct sock *sk = mptcp_subflow_ctx(ssk)->conn; -+ -+ mptcp_data_lock(sk); -+ if (!sock_owned_by_user(sk)) -+ __mptcp_error_report(sk); -+ else -+ set_bit(MPTCP_ERROR_REPORT, &mptcp_sk(sk)->flags); -+ mptcp_data_unlock(sk); -+} -+ - static struct inet_connection_sock_af_ops * - subflow_default_af_ops(struct sock *sk) - { -@@ -1367,9 +1399,11 @@ static int subflow_ulp_init(struct sock *sk) - ctx->tcp_data_ready = sk->sk_data_ready; - ctx->tcp_state_change = sk->sk_state_change; - ctx->tcp_write_space = sk->sk_write_space; -+ ctx->tcp_error_report = sk->sk_error_report; - sk->sk_data_ready = subflow_data_ready; - sk->sk_write_space = subflow_write_space; - sk->sk_state_change = subflow_state_change; -+ sk->sk_error_report = subflow_error_report; - out: - return err; - } -@@ -1422,6 +1456,7 @@ static void subflow_ulp_clone(const struct request_sock *req, - new_ctx->tcp_data_ready = old_ctx->tcp_data_ready; - new_ctx->tcp_state_change = old_ctx->tcp_state_change; - new_ctx->tcp_write_space = old_ctx->tcp_write_space; -+ new_ctx->tcp_error_report = old_ctx->tcp_error_report; - new_ctx->rel_write_seq = 1; - new_ctx->tcp_sock = newsk; - -diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c -index bd4678db9d76b..6dff64374bfe1 100644 ---- a/net/sunrpc/auth_gss/svcauth_gss.c -+++ b/net/sunrpc/auth_gss/svcauth_gss.c -@@ -1825,11 +1825,14 @@ static int - svcauth_gss_release(struct svc_rqst *rqstp) - { - struct gss_svc_data *gsd = (struct gss_svc_data *)rqstp->rq_auth_data; -- struct rpc_gss_wire_cred *gc = &gsd->clcred; -+ struct rpc_gss_wire_cred *gc; - struct xdr_buf *resbuf = &rqstp->rq_res; - int stat = -EINVAL; - struct sunrpc_net *sn = net_generic(SVC_NET(rqstp), sunrpc_net_id); - -+ if (!gsd) -+ goto out; -+ gc = &gsd->clcred; - if (gc->gc_proc != RPC_GSS_PROC_DATA) - goto out; - /* Release can be called twice, but we only wrap once. */ -@@ -1870,10 +1873,10 @@ out_err: - if (rqstp->rq_cred.cr_group_info) - put_group_info(rqstp->rq_cred.cr_group_info); - rqstp->rq_cred.cr_group_info = NULL; -- if (gsd->rsci) -+ if (gsd && gsd->rsci) { - cache_put(&gsd->rsci->h, sn->rsc_cache); -- gsd->rsci = NULL; -- -+ gsd->rsci = NULL; -+ } - return stat; - } - -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c -index 253d538251ae1..89a80beab5876 100644 ---- a/sound/pci/hda/hda_intel.c -+++ b/sound/pci/hda/hda_intel.c -@@ -1023,8 +1023,12 @@ static int azx_prepare(struct device *dev) - struct snd_card *card = dev_get_drvdata(dev); - struct azx *chip; - -+ if (!azx_is_pm_ready(card)) -+ return 0; -+ - chip = card->private_data; - chip->pm_prepared = 1; -+ snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); - - flush_work(&azx_bus(chip)->unsol_work); - -@@ -1039,7 +1043,11 @@ static void azx_complete(struct device *dev) - struct snd_card *card = dev_get_drvdata(dev); - struct azx *chip; - -+ if (!azx_is_pm_ready(card)) -+ return; -+ - chip = card->private_data; -+ snd_power_change_state(card, SNDRV_CTL_POWER_D0); - chip->pm_prepared = 0; - } - -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 316b9b4ccb32d..58946d069ee59 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -5256,7 +5256,7 @@ static void alc_determine_headset_type(struct hda_codec *codec) - case 0x10ec0274: - case 0x10ec0294: - alc_process_coef_fw(codec, coef0274); -- msleep(80); -+ msleep(850); - val = alc_read_coef_idx(codec, 0x46); - is_ctia = (val & 0x00f0) == 0x00f0; - break; -@@ -5440,6 +5440,7 @@ static void alc_update_headset_jack_cb(struct hda_codec *codec, - struct hda_jack_callback *jack) - { - snd_hda_gen_hp_automute(codec, jack); -+ alc_update_headset_mode(codec); - } - - static void alc_probe_headset_mode(struct hda_codec *codec) -@@ -8057,6 +8058,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - ALC285_FIXUP_HP_GPIO_AMP_INIT), - SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED), - SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), -+ SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), - SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED), - SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED), - SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP), -diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c -index 210fcbedf2413..4d82d24c7828d 100644 ---- a/sound/soc/codecs/cs42l42.c -+++ b/sound/soc/codecs/cs42l42.c -@@ -401,7 +401,7 @@ static const struct regmap_config cs42l42_regmap = { - }; - - static DECLARE_TLV_DB_SCALE(adc_tlv, -9600, 100, false); --static DECLARE_TLV_DB_SCALE(mixer_tlv, -6200, 100, false); -+static DECLARE_TLV_DB_SCALE(mixer_tlv, -6300, 100, true); - - static const char * const cs42l42_hpf_freq_text[] = { - "1.86Hz", "120Hz", "235Hz", "466Hz" -@@ -458,7 +458,7 @@ static const struct snd_kcontrol_new cs42l42_snd_controls[] = { - CS42L42_DAC_HPF_EN_SHIFT, true, false), - SOC_DOUBLE_R_TLV("Mixer Volume", CS42L42_MIXER_CHA_VOL, - CS42L42_MIXER_CHB_VOL, CS42L42_MIXER_CH_VOL_SHIFT, -- 0x3e, 1, mixer_tlv) -+ 0x3f, 1, mixer_tlv) - }; - - static int cs42l42_hpdrv_evt(struct snd_soc_dapm_widget *w, -@@ -691,24 +691,6 @@ static int cs42l42_pll_config(struct snd_soc_component *component) - CS42L42_CLK_OASRC_SEL_MASK, - CS42L42_CLK_OASRC_SEL_12 << - CS42L42_CLK_OASRC_SEL_SHIFT); -- /* channel 1 on low LRCLK, 32 bit */ -- snd_soc_component_update_bits(component, -- CS42L42_ASP_RX_DAI0_CH1_AP_RES, -- CS42L42_ASP_RX_CH_AP_MASK | -- CS42L42_ASP_RX_CH_RES_MASK, -- (CS42L42_ASP_RX_CH_AP_LOW << -- CS42L42_ASP_RX_CH_AP_SHIFT) | -- (CS42L42_ASP_RX_CH_RES_32 << -- CS42L42_ASP_RX_CH_RES_SHIFT)); -- /* Channel 2 on high LRCLK, 32 bit */ -- snd_soc_component_update_bits(component, -- CS42L42_ASP_RX_DAI0_CH2_AP_RES, -- CS42L42_ASP_RX_CH_AP_MASK | -- CS42L42_ASP_RX_CH_RES_MASK, -- (CS42L42_ASP_RX_CH_AP_HI << -- CS42L42_ASP_RX_CH_AP_SHIFT) | -- (CS42L42_ASP_RX_CH_RES_32 << -- CS42L42_ASP_RX_CH_RES_SHIFT)); - if (pll_ratio_table[i].mclk_src_sel == 0) { - /* Pass the clock straight through */ - snd_soc_component_update_bits(component, -@@ -797,27 +779,23 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) - /* Bitclock/frame inversion */ - switch (fmt & SND_SOC_DAIFMT_INV_MASK) { - case SND_SOC_DAIFMT_NB_NF: -+ asp_cfg_val |= CS42L42_ASP_SCPOL_NOR << CS42L42_ASP_SCPOL_SHIFT; - break; - case SND_SOC_DAIFMT_NB_IF: -- asp_cfg_val |= CS42L42_ASP_POL_INV << -- CS42L42_ASP_LCPOL_IN_SHIFT; -+ asp_cfg_val |= CS42L42_ASP_SCPOL_NOR << CS42L42_ASP_SCPOL_SHIFT; -+ asp_cfg_val |= CS42L42_ASP_LCPOL_INV << CS42L42_ASP_LCPOL_SHIFT; - break; - case SND_SOC_DAIFMT_IB_NF: -- asp_cfg_val |= CS42L42_ASP_POL_INV << -- CS42L42_ASP_SCPOL_IN_DAC_SHIFT; - break; - case SND_SOC_DAIFMT_IB_IF: -- asp_cfg_val |= CS42L42_ASP_POL_INV << -- CS42L42_ASP_LCPOL_IN_SHIFT; -- asp_cfg_val |= CS42L42_ASP_POL_INV << -- CS42L42_ASP_SCPOL_IN_DAC_SHIFT; -+ asp_cfg_val |= CS42L42_ASP_LCPOL_INV << CS42L42_ASP_LCPOL_SHIFT; - break; - } - -- snd_soc_component_update_bits(component, CS42L42_ASP_CLK_CFG, -- CS42L42_ASP_MODE_MASK | -- CS42L42_ASP_SCPOL_IN_DAC_MASK | -- CS42L42_ASP_LCPOL_IN_MASK, asp_cfg_val); -+ snd_soc_component_update_bits(component, CS42L42_ASP_CLK_CFG, CS42L42_ASP_MODE_MASK | -+ CS42L42_ASP_SCPOL_MASK | -+ CS42L42_ASP_LCPOL_MASK, -+ asp_cfg_val); - - return 0; - } -@@ -828,14 +806,29 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream, - { - struct snd_soc_component *component = dai->component; - struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component); -- int retval; -+ unsigned int width = (params_width(params) / 8) - 1; -+ unsigned int val = 0; - - cs42l42->srate = params_rate(params); -- cs42l42->swidth = params_width(params); - -- retval = cs42l42_pll_config(component); -+ switch(substream->stream) { -+ case SNDRV_PCM_STREAM_PLAYBACK: -+ val |= width << CS42L42_ASP_RX_CH_RES_SHIFT; -+ /* channel 1 on low LRCLK */ -+ snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_CH1_AP_RES, -+ CS42L42_ASP_RX_CH_AP_MASK | -+ CS42L42_ASP_RX_CH_RES_MASK, val); -+ /* Channel 2 on high LRCLK */ -+ val |= CS42L42_ASP_RX_CH_AP_HI << CS42L42_ASP_RX_CH_AP_SHIFT; -+ snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_CH2_AP_RES, -+ CS42L42_ASP_RX_CH_AP_MASK | -+ CS42L42_ASP_RX_CH_RES_MASK, val); -+ break; -+ default: -+ break; -+ } - -- return retval; -+ return cs42l42_pll_config(component); - } - - static int cs42l42_set_sysclk(struct snd_soc_dai *dai, -@@ -900,9 +893,9 @@ static int cs42l42_mute(struct snd_soc_dai *dai, int mute, int direction) - return 0; - } - --#define CS42L42_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S18_3LE | \ -- SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE | \ -- SNDRV_PCM_FMTBIT_S32_LE) -+#define CS42L42_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ -+ SNDRV_PCM_FMTBIT_S24_LE |\ -+ SNDRV_PCM_FMTBIT_S32_LE ) - - - static const struct snd_soc_dai_ops cs42l42_ops = { -@@ -1801,7 +1794,7 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client, - dev_dbg(&i2c_client->dev, "Found reset GPIO\n"); - gpiod_set_value_cansleep(cs42l42->reset_gpio, 1); - } -- mdelay(3); -+ usleep_range(CS42L42_BOOT_TIME_US, CS42L42_BOOT_TIME_US * 2); - - /* Request IRQ */ - ret = devm_request_threaded_irq(&i2c_client->dev, -@@ -1926,6 +1919,7 @@ static int cs42l42_runtime_resume(struct device *dev) - } - - gpiod_set_value_cansleep(cs42l42->reset_gpio, 1); -+ usleep_range(CS42L42_BOOT_TIME_US, CS42L42_BOOT_TIME_US * 2); - - regcache_cache_only(cs42l42->regmap, false); - regcache_sync(cs42l42->regmap); -diff --git a/sound/soc/codecs/cs42l42.h b/sound/soc/codecs/cs42l42.h -index 9e3cc528dcff0..866d7c873e3c9 100644 ---- a/sound/soc/codecs/cs42l42.h -+++ b/sound/soc/codecs/cs42l42.h -@@ -258,11 +258,12 @@ - #define CS42L42_ASP_SLAVE_MODE 0x00 - #define CS42L42_ASP_MODE_SHIFT 4 - #define CS42L42_ASP_MODE_MASK (1 << CS42L42_ASP_MODE_SHIFT) --#define CS42L42_ASP_SCPOL_IN_DAC_SHIFT 2 --#define CS42L42_ASP_SCPOL_IN_DAC_MASK (1 << CS42L42_ASP_SCPOL_IN_DAC_SHIFT) --#define CS42L42_ASP_LCPOL_IN_SHIFT 0 --#define CS42L42_ASP_LCPOL_IN_MASK (1 << CS42L42_ASP_LCPOL_IN_SHIFT) --#define CS42L42_ASP_POL_INV 1 -+#define CS42L42_ASP_SCPOL_SHIFT 2 -+#define CS42L42_ASP_SCPOL_MASK (3 << CS42L42_ASP_SCPOL_SHIFT) -+#define CS42L42_ASP_SCPOL_NOR 3 -+#define CS42L42_ASP_LCPOL_SHIFT 0 -+#define CS42L42_ASP_LCPOL_MASK (3 << CS42L42_ASP_LCPOL_SHIFT) -+#define CS42L42_ASP_LCPOL_INV 3 - - #define CS42L42_ASP_FRM_CFG (CS42L42_PAGE_12 + 0x08) - #define CS42L42_ASP_STP_SHIFT 4 -@@ -739,6 +740,7 @@ - #define CS42L42_FRAC2_VAL(val) (((val) & 0xff0000) >> 16) - - #define CS42L42_NUM_SUPPLIES 5 -+#define CS42L42_BOOT_TIME_US 3000 - - static const char *const cs42l42_supply_names[CS42L42_NUM_SUPPLIES] = { - "VA", -@@ -756,7 +758,6 @@ struct cs42l42_private { - struct completion pdn_done; - u32 sclk; - u32 srate; -- u32 swidth; - u8 plug_state; - u8 hs_type; - u8 ts_inv; -diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c -index f9ec5cf825991..ec2f11ff8a84d 100644 ---- a/sound/soc/codecs/es8316.c -+++ b/sound/soc/codecs/es8316.c -@@ -63,13 +63,8 @@ static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(adc_pga_gain_tlv, - 1, 1, TLV_DB_SCALE_ITEM(0, 0, 0), - 2, 2, TLV_DB_SCALE_ITEM(250, 0, 0), - 3, 3, TLV_DB_SCALE_ITEM(450, 0, 0), -- 4, 4, TLV_DB_SCALE_ITEM(700, 0, 0), -- 5, 5, TLV_DB_SCALE_ITEM(1000, 0, 0), -- 6, 6, TLV_DB_SCALE_ITEM(1300, 0, 0), -- 7, 7, TLV_DB_SCALE_ITEM(1600, 0, 0), -- 8, 8, TLV_DB_SCALE_ITEM(1800, 0, 0), -- 9, 9, TLV_DB_SCALE_ITEM(2100, 0, 0), -- 10, 10, TLV_DB_SCALE_ITEM(2400, 0, 0), -+ 4, 7, TLV_DB_SCALE_ITEM(700, 300, 0), -+ 8, 10, TLV_DB_SCALE_ITEM(1800, 300, 0), - ); - - static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(hpout_vol_tlv, -diff --git a/sound/soc/codecs/rt1015.c b/sound/soc/codecs/rt1015.c -index 32e6bcf763d1d..4607039a16e7f 100644 ---- a/sound/soc/codecs/rt1015.c -+++ b/sound/soc/codecs/rt1015.c -@@ -209,6 +209,7 @@ static bool rt1015_volatile_register(struct device *dev, unsigned int reg) - case RT1015_VENDOR_ID: - case RT1015_DEVICE_ID: - case RT1015_PRO_ALT: -+ case RT1015_MAN_I2C: - case RT1015_DAC3: - case RT1015_VBAT_TEST_OUT1: - case RT1015_VBAT_TEST_OUT2: -diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c -index 1414ad15d01cf..a5674c227b3a6 100644 ---- a/sound/soc/codecs/rt5640.c -+++ b/sound/soc/codecs/rt5640.c -@@ -339,9 +339,9 @@ static bool rt5640_readable_register(struct device *dev, unsigned int reg) - } - - static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0); --static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0); -+static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0); - static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); --static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0); -+static const DECLARE_TLV_DB_MINMAX(adc_vol_tlv, -1762, 3000); - static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); - - /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ -diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c -index d198e191fb0c9..e59fdc81dbd45 100644 ---- a/sound/soc/codecs/rt5651.c -+++ b/sound/soc/codecs/rt5651.c -@@ -285,9 +285,9 @@ static bool rt5651_readable_register(struct device *dev, unsigned int reg) - } - - static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0); --static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0); -+static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0); - static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); --static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0); -+static const DECLARE_TLV_DB_MINMAX(adc_vol_tlv, -1762, 3000); - static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); - - /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ -diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c -index 41e5917b16a5e..91a4ef7f620ca 100644 ---- a/sound/soc/codecs/rt5659.c -+++ b/sound/soc/codecs/rt5659.c -@@ -3426,12 +3426,17 @@ static int rt5659_set_component_sysclk(struct snd_soc_component *component, int - { - struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); - unsigned int reg_val = 0; -+ int ret; - - if (freq == rt5659->sysclk && clk_id == rt5659->sysclk_src) - return 0; - - switch (clk_id) { - case RT5659_SCLK_S_MCLK: -+ ret = clk_set_rate(rt5659->mclk, freq); -+ if (ret) -+ return ret; -+ - reg_val |= RT5659_SCLK_SRC_MCLK; - break; - case RT5659_SCLK_S_PLL1: -diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c -index 85f744184a60f..047f4e677d78c 100644 ---- a/sound/soc/codecs/rt711.c -+++ b/sound/soc/codecs/rt711.c -@@ -895,6 +895,13 @@ static int rt711_probe(struct snd_soc_component *component) - return 0; - } - -+static void rt711_remove(struct snd_soc_component *component) -+{ -+ struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component); -+ -+ regcache_cache_only(rt711->regmap, true); -+} -+ - static const struct snd_soc_component_driver soc_codec_dev_rt711 = { - .probe = rt711_probe, - .set_bias_level = rt711_set_bias_level, -@@ -905,6 +912,7 @@ static const struct snd_soc_component_driver soc_codec_dev_rt711 = { - .dapm_routes = rt711_audio_map, - .num_dapm_routes = ARRAY_SIZE(rt711_audio_map), - .set_jack = rt711_set_jack_detect, -+ .remove = rt711_remove, - }; - - static int rt711_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream, -diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c -index 4d6ff81146228..4c0e87e22b97b 100644 ---- a/sound/soc/codecs/sgtl5000.c -+++ b/sound/soc/codecs/sgtl5000.c -@@ -71,7 +71,7 @@ static const struct reg_default sgtl5000_reg_defaults[] = { - { SGTL5000_DAP_EQ_BASS_BAND4, 0x002f }, - { SGTL5000_DAP_MAIN_CHAN, 0x8000 }, - { SGTL5000_DAP_MIX_CHAN, 0x0000 }, -- { SGTL5000_DAP_AVC_CTRL, 0x0510 }, -+ { SGTL5000_DAP_AVC_CTRL, 0x5100 }, - { SGTL5000_DAP_AVC_THRESHOLD, 0x1473 }, - { SGTL5000_DAP_AVC_ATTACK, 0x0028 }, - { SGTL5000_DAP_AVC_DECAY, 0x0050 }, -diff --git a/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c b/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c -index 8383536b7ae00..504293de2c0d0 100644 ---- a/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c -+++ b/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c -@@ -555,7 +555,9 @@ static int mtk_dai_tdm_hw_params(struct snd_pcm_substream *substream, - - /* set tdm */ - if (tdm_priv->bck_invert) -- tdm_con |= 1 << BCK_INVERSE_SFT; -+ regmap_update_bits(afe->regmap, AUDIO_TOP_CON3, -+ BCK_INVERSE_MASK_SFT, -+ 0x1 << BCK_INVERSE_SFT); - - if (tdm_priv->lck_invert) - tdm_con |= 1 << LRCK_INVERSE_SFT; -diff --git a/sound/soc/mediatek/mt8192/mt8192-reg.h b/sound/soc/mediatek/mt8192/mt8192-reg.h -index 562f25c79c349..b9fb80d4afecd 100644 ---- a/sound/soc/mediatek/mt8192/mt8192-reg.h -+++ b/sound/soc/mediatek/mt8192/mt8192-reg.h -@@ -21,6 +21,11 @@ enum { - /***************************************************************************** - * R E G I S T E R D E F I N I T I O N - *****************************************************************************/ -+/* AUDIO_TOP_CON3 */ -+#define BCK_INVERSE_SFT 3 -+#define BCK_INVERSE_MASK 0x1 -+#define BCK_INVERSE_MASK_SFT (0x1 << 3) -+ - /* AFE_DAC_CON0 */ - #define VUL12_ON_SFT 31 - #define VUL12_ON_MASK 0x1 -@@ -2079,9 +2084,6 @@ enum { - #define TDM_EN_SFT 0 - #define TDM_EN_MASK 0x1 - #define TDM_EN_MASK_SFT (0x1 << 0) --#define BCK_INVERSE_SFT 1 --#define BCK_INVERSE_MASK 0x1 --#define BCK_INVERSE_MASK_SFT (0x1 << 1) - #define LRCK_INVERSE_SFT 2 - #define LRCK_INVERSE_MASK 0x1 - #define LRCK_INVERSE_MASK_SFT (0x1 << 2) -diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c -index f6d4e99b590c7..0cffc9527e289 100644 ---- a/sound/soc/soc-core.c -+++ b/sound/soc/soc-core.c -@@ -31,6 +31,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1573,6 +1574,9 @@ int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour) - if (card->long_name) - return 0; /* long name already set by driver or from DMI */ - -+ if (!is_acpi_device_node(card->dev->fwnode)) -+ return 0; -+ - /* make up dmi long name as: vendor-product-version-board */ - vendor = dmi_get_system_info(DMI_BOARD_VENDOR); - if (!vendor || !is_dmi_valid(vendor)) { -diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c -index d3001fb18141f..176437a441e6c 100644 ---- a/sound/usb/quirks.c -+++ b/sound/usb/quirks.c -@@ -1521,6 +1521,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) - case USB_ID(0x21b4, 0x0081): /* AudioQuest DragonFly */ - case USB_ID(0x2912, 0x30c8): /* Audioengine D1 */ - case USB_ID(0x413c, 0xa506): /* Dell AE515 sound bar */ -+ case USB_ID(0x046d, 0x084c): /* Logitech ConferenceCam Connect */ - return true; - } - -diff --git a/tools/testing/selftests/net/forwarding/tc_flower.sh b/tools/testing/selftests/net/forwarding/tc_flower.sh -index 058c746ee3006..b11d8e6b5bc14 100755 ---- a/tools/testing/selftests/net/forwarding/tc_flower.sh -+++ b/tools/testing/selftests/net/forwarding/tc_flower.sh -@@ -3,7 +3,7 @@ - - ALL_TESTS="match_dst_mac_test match_src_mac_test match_dst_ip_test \ - match_src_ip_test match_ip_flags_test match_pcp_test match_vlan_test \ -- match_ip_tos_test match_indev_test" -+ match_ip_tos_test match_indev_test match_ip_ttl_test" - NUM_NETIFS=2 - source tc_common.sh - source lib.sh -@@ -310,6 +310,42 @@ match_ip_tos_test() - log_test "ip_tos match ($tcflags)" - } - -+match_ip_ttl_test() -+{ -+ RET=0 -+ -+ tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \ -+ $tcflags dst_ip 192.0.2.2 ip_ttl 63 action drop -+ tc filter add dev $h2 ingress protocol ip pref 2 handle 102 flower \ -+ $tcflags dst_ip 192.0.2.2 action drop -+ -+ $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \ -+ -t ip "ttl=63" -q -+ -+ $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \ -+ -t ip "ttl=63,mf,frag=256" -q -+ -+ tc_check_packets "dev $h2 ingress" 102 1 -+ check_fail $? "Matched on the wrong filter (no check on ttl)" -+ -+ tc_check_packets "dev $h2 ingress" 101 2 -+ check_err $? "Did not match on correct filter (ttl=63)" -+ -+ $MZ $h1 -c 1 -p 64 -a $h1mac -b $h2mac -A 192.0.2.1 -B 192.0.2.2 \ -+ -t ip "ttl=255" -q -+ -+ tc_check_packets "dev $h2 ingress" 101 3 -+ check_fail $? "Matched on a wrong filter (ttl=63)" -+ -+ tc_check_packets "dev $h2 ingress" 102 1 -+ check_err $? "Did not match on correct filter (no check on ttl)" -+ -+ tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower -+ tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower -+ -+ log_test "ip_ttl match ($tcflags)" -+} -+ - match_indev_test() - { - RET=0 diff --git a/patch/kernel/archive/sunxi-5.11/patch-5.11.12-13.patch b/patch/kernel/archive/sunxi-5.11/patch-5.11.12-13.patch deleted file mode 100644 index 860f1d761..000000000 --- a/patch/kernel/archive/sunxi-5.11/patch-5.11.12-13.patch +++ /dev/null @@ -1,1345 +0,0 @@ -diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/silicon-errata.rst -index 7195102472929..d410a47ffa57a 100644 ---- a/Documentation/arm64/silicon-errata.rst -+++ b/Documentation/arm64/silicon-errata.rst -@@ -130,6 +130,9 @@ stable kernels. - | Marvell | ARM-MMU-500 | #582743 | N/A | - +----------------+-----------------+-----------------+-----------------------------+ - +----------------+-----------------+-----------------+-----------------------------+ -+| NVIDIA | Carmel Core | N/A | NVIDIA_CARMEL_CNP_ERRATUM | -++----------------+-----------------+-----------------+-----------------------------+ -++----------------+-----------------+-----------------+-----------------------------+ - | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | - +----------------+-----------------+-----------------+-----------------------------+ - +----------------+-----------------+-----------------+-----------------------------+ -diff --git a/Makefile b/Makefile -index 1e31504aab61b..1be83283e0321 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 11 --SUBLEVEL = 12 -+SUBLEVEL = 13 - EXTRAVERSION = - NAME = 💕 Valentine's Day Edition 💕 - -@@ -1082,6 +1082,17 @@ ifdef CONFIG_STACK_VALIDATION - endif - endif - -+PHONY += resolve_btfids_clean -+ -+resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids -+ -+# tools/bpf/resolve_btfids directory might not exist -+# in output directory, skip its clean in that case -+resolve_btfids_clean: -+ifneq ($(wildcard $(resolve_btfids_O)),) -+ $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean -+endif -+ - ifdef CONFIG_BPF - ifdef CONFIG_DEBUG_INFO_BTF - ifeq ($(has_libelf),1) -@@ -1499,7 +1510,7 @@ vmlinuxclean: - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean - $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) - --clean: archclean vmlinuxclean -+clean: archclean vmlinuxclean resolve_btfids_clean - - # mrproper - Delete all generated files, including .config - # -diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi -index 5b213a1e68bb2..5e33d0e88f5b1 100644 ---- a/arch/arm/boot/dts/am33xx.dtsi -+++ b/arch/arm/boot/dts/am33xx.dtsi -@@ -40,6 +40,9 @@ - ethernet1 = &cpsw_emac1; - spi0 = &spi0; - spi1 = &spi1; -+ mmc0 = &mmc1; -+ mmc1 = &mmc2; -+ mmc2 = &mmc3; - }; - - cpus { -diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig -index e42da99db91fc..2517dd8c5a4d1 100644 ---- a/arch/arm64/Kconfig -+++ b/arch/arm64/Kconfig -@@ -805,6 +805,16 @@ config QCOM_FALKOR_ERRATUM_E1041 - - If unsure, say Y. - -+config NVIDIA_CARMEL_CNP_ERRATUM -+ bool "NVIDIA Carmel CNP: CNP on Carmel semantically different than ARM cores" -+ default y -+ help -+ If CNP is enabled on Carmel cores, non-sharable TLBIs on a core will not -+ invalidate shared TLB entries installed by a different core, as it would -+ on standard ARM cores. -+ -+ If unsure, say Y. -+ - config SOCIONEXT_SYNQUACER_PREITS - bool "Socionext Synquacer: Workaround for GICv3 pre-ITS" - default y -diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h -index b77d997b173bc..c40f2490cd7b7 100644 ---- a/arch/arm64/include/asm/cpucaps.h -+++ b/arch/arm64/include/asm/cpucaps.h -@@ -66,7 +66,8 @@ - #define ARM64_WORKAROUND_1508412 58 - #define ARM64_HAS_LDAPR 59 - #define ARM64_KVM_PROTECTED_MODE 60 -+#define ARM64_WORKAROUND_NVIDIA_CARMEL_CNP 61 - --#define ARM64_NCAPS 61 -+#define ARM64_NCAPS 62 - - #endif /* __ASM_CPUCAPS_H */ -diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c -index a63428301f423..3fc281e4e6550 100644 ---- a/arch/arm64/kernel/cpu_errata.c -+++ b/arch/arm64/kernel/cpu_errata.c -@@ -527,6 +527,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = { - 0, 0, - 1, 0), - }, -+#endif -+#ifdef CONFIG_NVIDIA_CARMEL_CNP_ERRATUM -+ { -+ /* NVIDIA Carmel */ -+ .desc = "NVIDIA Carmel CNP erratum", -+ .capability = ARM64_WORKAROUND_NVIDIA_CARMEL_CNP, -+ ERRATA_MIDR_ALL_VERSIONS(MIDR_NVIDIA_CARMEL), -+ }, - #endif - { - } -diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c -index 33b6f56dcb21b..b1f7bfadab9f7 100644 ---- a/arch/arm64/kernel/cpufeature.c -+++ b/arch/arm64/kernel/cpufeature.c -@@ -1270,7 +1270,10 @@ has_useable_cnp(const struct arm64_cpu_capabilities *entry, int scope) - * may share TLB entries with a CPU stuck in the crashed - * kernel. - */ -- if (is_kdump_kernel()) -+ if (is_kdump_kernel()) -+ return false; -+ -+ if (cpus_have_const_cap(ARM64_WORKAROUND_NVIDIA_CARMEL_CNP)) - return false; - - return has_cpuid_feature(entry, scope); -diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c -index 8b5b8e6bc9d9a..dd5bfed52031d 100644 ---- a/arch/ia64/kernel/err_inject.c -+++ b/arch/ia64/kernel/err_inject.c -@@ -59,7 +59,7 @@ show_##name(struct device *dev, struct device_attribute *attr, \ - char *buf) \ - { \ - u32 cpu=dev->id; \ -- return sprintf(buf, "%lx\n", name[cpu]); \ -+ return sprintf(buf, "%llx\n", name[cpu]); \ - } - - #define store(name) \ -@@ -86,9 +86,9 @@ store_call_start(struct device *dev, struct device_attribute *attr, - - #ifdef ERR_INJ_DEBUG - printk(KERN_DEBUG "pal_mc_err_inject for cpu%d:\n", cpu); -- printk(KERN_DEBUG "err_type_info=%lx,\n", err_type_info[cpu]); -- printk(KERN_DEBUG "err_struct_info=%lx,\n", err_struct_info[cpu]); -- printk(KERN_DEBUG "err_data_buffer=%lx, %lx, %lx.\n", -+ printk(KERN_DEBUG "err_type_info=%llx,\n", err_type_info[cpu]); -+ printk(KERN_DEBUG "err_struct_info=%llx,\n", err_struct_info[cpu]); -+ printk(KERN_DEBUG "err_data_buffer=%llx, %llx, %llx.\n", - err_data_buffer[cpu].data1, - err_data_buffer[cpu].data2, - err_data_buffer[cpu].data3); -@@ -117,8 +117,8 @@ store_call_start(struct device *dev, struct device_attribute *attr, - - #ifdef ERR_INJ_DEBUG - printk(KERN_DEBUG "Returns: status=%d,\n", (int)status[cpu]); -- printk(KERN_DEBUG "capabilities=%lx,\n", capabilities[cpu]); -- printk(KERN_DEBUG "resources=%lx\n", resources[cpu]); -+ printk(KERN_DEBUG "capabilities=%llx,\n", capabilities[cpu]); -+ printk(KERN_DEBUG "resources=%llx\n", resources[cpu]); - #endif - return size; - } -@@ -131,7 +131,7 @@ show_virtual_to_phys(struct device *dev, struct device_attribute *attr, - char *buf) - { - unsigned int cpu=dev->id; -- return sprintf(buf, "%lx\n", phys_addr[cpu]); -+ return sprintf(buf, "%llx\n", phys_addr[cpu]); - } - - static ssize_t -@@ -145,7 +145,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr, - ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL); - if (ret<=0) { - #ifdef ERR_INJ_DEBUG -- printk("Virtual address %lx is not existing.\n",virt_addr); -+ printk("Virtual address %llx is not existing.\n", virt_addr); - #endif - return -EINVAL; - } -@@ -163,7 +163,7 @@ show_err_data_buffer(struct device *dev, - { - unsigned int cpu=dev->id; - -- return sprintf(buf, "%lx, %lx, %lx\n", -+ return sprintf(buf, "%llx, %llx, %llx\n", - err_data_buffer[cpu].data1, - err_data_buffer[cpu].data2, - err_data_buffer[cpu].data3); -@@ -178,13 +178,13 @@ store_err_data_buffer(struct device *dev, - int ret; - - #ifdef ERR_INJ_DEBUG -- printk("write err_data_buffer=[%lx,%lx,%lx] on cpu%d\n", -+ printk("write err_data_buffer=[%llx,%llx,%llx] on cpu%d\n", - err_data_buffer[cpu].data1, - err_data_buffer[cpu].data2, - err_data_buffer[cpu].data3, - cpu); - #endif -- ret=sscanf(buf, "%lx, %lx, %lx", -+ ret = sscanf(buf, "%llx, %llx, %llx", - &err_data_buffer[cpu].data1, - &err_data_buffer[cpu].data2, - &err_data_buffer[cpu].data3); -diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c -index 2703f7795672d..bd0a51dc345af 100644 ---- a/arch/ia64/kernel/mca.c -+++ b/arch/ia64/kernel/mca.c -@@ -1822,7 +1822,7 @@ ia64_mca_cpu_init(void *cpu_data) - data = mca_bootmem(); - first_time = 0; - } else -- data = (void *)__get_free_pages(GFP_KERNEL, -+ data = (void *)__get_free_pages(GFP_ATOMIC, - get_order(sz)); - if (!data) - panic("Could not allocate MCA memory for cpu %d\n", -diff --git a/arch/x86/Makefile b/arch/x86/Makefile -index 30920d70b48b3..828f24d547b2f 100644 ---- a/arch/x86/Makefile -+++ b/arch/x86/Makefile -@@ -27,7 +27,7 @@ endif - REALMODE_CFLAGS := -m16 -g -Os -DDISABLE_BRANCH_PROFILING \ - -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \ - -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ -- -mno-mmx -mno-sse -+ -mno-mmx -mno-sse $(call cc-option,-fcf-protection=none) - - REALMODE_CFLAGS += -ffreestanding - REALMODE_CFLAGS += -fno-stack-protector -diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c -index 023ac12f54a29..a11796bbb9cee 100644 ---- a/arch/x86/net/bpf_jit_comp.c -+++ b/arch/x86/net/bpf_jit_comp.c -@@ -1476,7 +1476,16 @@ emit_jmp: - } - - if (image) { -- if (unlikely(proglen + ilen > oldproglen)) { -+ /* -+ * When populating the image, assert that: -+ * -+ * i) We do not write beyond the allocated space, and -+ * ii) addrs[i] did not change from the prior run, in order -+ * to validate assumptions made for computing branch -+ * displacements. -+ */ -+ if (unlikely(proglen + ilen > oldproglen || -+ proglen + ilen != addrs[i])) { - pr_err("bpf_jit: fatal error\n"); - return -EFAULT; - } -@@ -2038,7 +2047,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) - extra_pass = true; - goto skip_init_addrs; - } -- addrs = kmalloc_array(prog->len + 1, sizeof(*addrs), GFP_KERNEL); -+ addrs = kvmalloc_array(prog->len + 1, sizeof(*addrs), GFP_KERNEL); - if (!addrs) { - prog = orig_prog; - goto out_addrs; -@@ -2128,7 +2137,7 @@ out_image: - if (image) - bpf_prog_fill_jited_linfo(prog, addrs + 1); - out_addrs: -- kfree(addrs); -+ kvfree(addrs); - kfree(jit_data); - prog->aux->jit_data = NULL; - } -diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c -index 96fde03aa9877..2cf4d217840d8 100644 ---- a/arch/x86/net/bpf_jit_comp32.c -+++ b/arch/x86/net/bpf_jit_comp32.c -@@ -2278,7 +2278,16 @@ notyet: - } - - if (image) { -- if (unlikely(proglen + ilen > oldproglen)) { -+ /* -+ * When populating the image, assert that: -+ * -+ * i) We do not write beyond the allocated space, and -+ * ii) addrs[i] did not change from the prior run, in order -+ * to validate assumptions made for computing branch -+ * displacements. -+ */ -+ if (unlikely(proglen + ilen > oldproglen || -+ proglen + ilen != addrs[i])) { - pr_err("bpf_jit: fatal error\n"); - return -EFAULT; - } -diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c -index a27d751cf219d..3d74f237f005b 100644 ---- a/drivers/bus/ti-sysc.c -+++ b/drivers/bus/ti-sysc.c -@@ -3053,7 +3053,9 @@ static int sysc_remove(struct platform_device *pdev) - - pm_runtime_put_sync(&pdev->dev); - pm_runtime_disable(&pdev->dev); -- reset_control_assert(ddata->rsts); -+ -+ if (!reset_control_status(ddata->rsts)) -+ reset_control_assert(ddata->rsts); - - unprepare: - sysc_unprepare(ddata); -diff --git a/drivers/gpu/drm/msm/adreno/a5xx_power.c b/drivers/gpu/drm/msm/adreno/a5xx_power.c -index f176a6f3eff66..e58670a61df4b 100644 ---- a/drivers/gpu/drm/msm/adreno/a5xx_power.c -+++ b/drivers/gpu/drm/msm/adreno/a5xx_power.c -@@ -304,7 +304,7 @@ int a5xx_power_init(struct msm_gpu *gpu) - /* Set up the limits management */ - if (adreno_is_a530(adreno_gpu)) - a530_lm_setup(gpu); -- else -+ else if (adreno_is_a540(adreno_gpu)) - a540_lm_setup(gpu); - - /* Set up SP/TP power collpase */ -diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c -index 0366419d8bfed..e7a8442b59afd 100644 ---- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c -+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c -@@ -521,28 +521,73 @@ static int a6xx_cp_init(struct msm_gpu *gpu) - return a6xx_idle(gpu, ring) ? 0 : -EINVAL; - } - --static void a6xx_ucode_check_version(struct a6xx_gpu *a6xx_gpu, -+/* -+ * Check that the microcode version is new enough to include several key -+ * security fixes. Return true if the ucode is safe. -+ */ -+static bool a6xx_ucode_check_version(struct a6xx_gpu *a6xx_gpu, - struct drm_gem_object *obj) - { -+ struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; -+ struct msm_gpu *gpu = &adreno_gpu->base; - u32 *buf = msm_gem_get_vaddr(obj); -+ bool ret = false; - - if (IS_ERR(buf)) -- return; -+ return false; - - /* -- * If the lowest nibble is 0xa that is an indication that this microcode -- * has been patched. The actual version is in dword [3] but we only care -- * about the patchlevel which is the lowest nibble of dword [3] -- * -- * Otherwise check that the firmware is greater than or equal to 1.90 -- * which was the first version that had this fix built in -+ * Targets up to a640 (a618, a630 and a640) need to check for a -+ * microcode version that is patched to support the whereami opcode or -+ * one that is new enough to include it by default. - */ -- if (((buf[0] & 0xf) == 0xa) && (buf[2] & 0xf) >= 1) -- a6xx_gpu->has_whereami = true; -- else if ((buf[0] & 0xfff) > 0x190) -- a6xx_gpu->has_whereami = true; -+ if (adreno_is_a618(adreno_gpu) || adreno_is_a630(adreno_gpu) || -+ adreno_is_a640(adreno_gpu)) { -+ /* -+ * If the lowest nibble is 0xa that is an indication that this -+ * microcode has been patched. The actual version is in dword -+ * [3] but we only care about the patchlevel which is the lowest -+ * nibble of dword [3] -+ * -+ * Otherwise check that the firmware is greater than or equal -+ * to 1.90 which was the first version that had this fix built -+ * in -+ */ -+ if ((((buf[0] & 0xf) == 0xa) && (buf[2] & 0xf) >= 1) || -+ (buf[0] & 0xfff) >= 0x190) { -+ a6xx_gpu->has_whereami = true; -+ ret = true; -+ goto out; -+ } - -+ DRM_DEV_ERROR(&gpu->pdev->dev, -+ "a630 SQE ucode is too old. Have version %x need at least %x\n", -+ buf[0] & 0xfff, 0x190); -+ } else { -+ /* -+ * a650 tier targets don't need whereami but still need to be -+ * equal to or newer than 1.95 for other security fixes -+ */ -+ if (adreno_is_a650(adreno_gpu)) { -+ if ((buf[0] & 0xfff) >= 0x195) { -+ ret = true; -+ goto out; -+ } -+ -+ DRM_DEV_ERROR(&gpu->pdev->dev, -+ "a650 SQE ucode is too old. Have version %x need at least %x\n", -+ buf[0] & 0xfff, 0x195); -+ } -+ -+ /* -+ * When a660 is added those targets should return true here -+ * since those have all the critical security fixes built in -+ * from the start -+ */ -+ } -+out: - msm_gem_put_vaddr(obj); -+ return ret; - } - - static int a6xx_ucode_init(struct msm_gpu *gpu) -@@ -565,7 +610,13 @@ static int a6xx_ucode_init(struct msm_gpu *gpu) - } - - msm_gem_object_set_name(a6xx_gpu->sqe_bo, "sqefw"); -- a6xx_ucode_check_version(a6xx_gpu, a6xx_gpu->sqe_bo); -+ if (!a6xx_ucode_check_version(a6xx_gpu, a6xx_gpu->sqe_bo)) { -+ msm_gem_unpin_iova(a6xx_gpu->sqe_bo, gpu->aspace); -+ drm_gem_object_put(a6xx_gpu->sqe_bo); -+ -+ a6xx_gpu->sqe_bo = NULL; -+ return -EPERM; -+ } - } - - gpu_write64(gpu, REG_A6XX_CP_SQE_INSTR_BASE_LO, -diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c -index 374b0e8471e60..0f1b04ef61f2c 100644 ---- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c -+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c -@@ -43,6 +43,8 @@ - #define DPU_DEBUGFS_DIR "msm_dpu" - #define DPU_DEBUGFS_HWMASKNAME "hw_log_mask" - -+#define MIN_IB_BW 400000000ULL /* Min ib vote 400MB */ -+ - static int dpu_kms_hw_init(struct msm_kms *kms); - static void _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms); - -@@ -931,6 +933,9 @@ static int dpu_kms_hw_init(struct msm_kms *kms) - DPU_DEBUG("REG_DMA is not defined"); - } - -+ if (of_device_is_compatible(dev->dev->of_node, "qcom,sc7180-mdss")) -+ dpu_kms_parse_data_bus_icc_path(dpu_kms); -+ - pm_runtime_get_sync(&dpu_kms->pdev->dev); - - dpu_kms->core_rev = readl_relaxed(dpu_kms->mmio + 0x0); -@@ -1032,9 +1037,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms) - - dpu_vbif_init_memtypes(dpu_kms); - -- if (of_device_is_compatible(dev->dev->of_node, "qcom,sc7180-mdss")) -- dpu_kms_parse_data_bus_icc_path(dpu_kms); -- - pm_runtime_put_sync(&dpu_kms->pdev->dev); - - return 0; -@@ -1191,10 +1193,10 @@ static int __maybe_unused dpu_runtime_resume(struct device *dev) - - ddev = dpu_kms->dev; - -+ WARN_ON(!(dpu_kms->num_paths)); - /* Min vote of BW is required before turning on AXI clk */ - for (i = 0; i < dpu_kms->num_paths; i++) -- icc_set_bw(dpu_kms->path[i], 0, -- dpu_kms->catalog->perf.min_dram_ib); -+ icc_set_bw(dpu_kms->path[i], 0, Bps_to_icc(MIN_IB_BW)); - - rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, true); - if (rc) { -diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c -index c1f6708367ae9..c1c41846b6b2b 100644 ---- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c -+++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_7nm.c -@@ -325,7 +325,7 @@ static void dsi_pll_commit(struct dsi_pll_7nm *pll) - pll_write(base + REG_DSI_7nm_PHY_PLL_FRAC_DIV_START_LOW_1, reg->frac_div_start_low); - pll_write(base + REG_DSI_7nm_PHY_PLL_FRAC_DIV_START_MID_1, reg->frac_div_start_mid); - pll_write(base + REG_DSI_7nm_PHY_PLL_FRAC_DIV_START_HIGH_1, reg->frac_div_start_high); -- pll_write(base + REG_DSI_7nm_PHY_PLL_PLL_LOCKDET_RATE_1, 0x40); -+ pll_write(base + REG_DSI_7nm_PHY_PLL_PLL_LOCKDET_RATE_1, reg->pll_lockdet_rate); - pll_write(base + REG_DSI_7nm_PHY_PLL_PLL_LOCK_DELAY, 0x06); - pll_write(base + REG_DSI_7nm_PHY_PLL_CMODE_1, 0x10); /* TODO: 0x00 for CPHY */ - pll_write(base + REG_DSI_7nm_PHY_PLL_CLOCK_INVERTERS, reg->pll_clock_inverters); -diff --git a/drivers/gpu/drm/msm/msm_fence.c b/drivers/gpu/drm/msm/msm_fence.c -index ad2703698b052..cd59a59180385 100644 ---- a/drivers/gpu/drm/msm/msm_fence.c -+++ b/drivers/gpu/drm/msm/msm_fence.c -@@ -45,7 +45,7 @@ int msm_wait_fence(struct msm_fence_context *fctx, uint32_t fence, - int ret; - - if (fence > fctx->last_fence) { -- DRM_ERROR("%s: waiting on invalid fence: %u (of %u)\n", -+ DRM_ERROR_RATELIMITED("%s: waiting on invalid fence: %u (of %u)\n", - fctx->name, fence, fctx->last_fence); - return -EINVAL; - } -diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c -index ec475087fbf93..39f841b424883 100644 ---- a/drivers/isdn/hardware/mISDN/mISDNipac.c -+++ b/drivers/isdn/hardware/mISDN/mISDNipac.c -@@ -694,7 +694,7 @@ isac_release(struct isac_hw *isac) - { - if (isac->type & IPAC_TYPE_ISACX) - WriteISAC(isac, ISACX_MASK, 0xff); -- else -+ else if (isac->type != 0) - WriteISAC(isac, ISAC_MASK, 0xff); - if (isac->dch.timer.function != NULL) { - del_timer(&isac->dch.timer); -diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c -index 8bdc44b7e09a1..3c8f665c15580 100644 ---- a/drivers/net/arcnet/com20020-pci.c -+++ b/drivers/net/arcnet/com20020-pci.c -@@ -127,6 +127,8 @@ static int com20020pci_probe(struct pci_dev *pdev, - int i, ioaddr, ret; - struct resource *r; - -+ ret = 0; -+ - if (pci_enable_device(pdev)) - return -EIO; - -@@ -139,6 +141,8 @@ static int com20020pci_probe(struct pci_dev *pdev, - priv->ci = ci; - mm = &ci->misc_map; - -+ pci_set_drvdata(pdev, priv); -+ - INIT_LIST_HEAD(&priv->list_dev); - - if (mm->size) { -@@ -161,7 +165,7 @@ static int com20020pci_probe(struct pci_dev *pdev, - dev = alloc_arcdev(device); - if (!dev) { - ret = -ENOMEM; -- goto out_port; -+ break; - } - dev->dev_port = i; - -@@ -178,7 +182,7 @@ static int com20020pci_probe(struct pci_dev *pdev, - pr_err("IO region %xh-%xh already allocated\n", - ioaddr, ioaddr + cm->size - 1); - ret = -EBUSY; -- goto out_port; -+ goto err_free_arcdev; - } - - /* Dummy access after Reset -@@ -216,18 +220,18 @@ static int com20020pci_probe(struct pci_dev *pdev, - if (arcnet_inb(ioaddr, COM20020_REG_R_STATUS) == 0xFF) { - pr_err("IO address %Xh is empty!\n", ioaddr); - ret = -EIO; -- goto out_port; -+ goto err_free_arcdev; - } - if (com20020_check(dev)) { - ret = -EIO; -- goto out_port; -+ goto err_free_arcdev; - } - - card = devm_kzalloc(&pdev->dev, sizeof(struct com20020_dev), - GFP_KERNEL); - if (!card) { - ret = -ENOMEM; -- goto out_port; -+ goto err_free_arcdev; - } - - card->index = i; -@@ -253,29 +257,29 @@ static int com20020pci_probe(struct pci_dev *pdev, - - ret = devm_led_classdev_register(&pdev->dev, &card->tx_led); - if (ret) -- goto out_port; -+ goto err_free_arcdev; - - ret = devm_led_classdev_register(&pdev->dev, &card->recon_led); - if (ret) -- goto out_port; -+ goto err_free_arcdev; - - dev_set_drvdata(&dev->dev, card); - - ret = com20020_found(dev, IRQF_SHARED); - if (ret) -- goto out_port; -+ goto err_free_arcdev; - - devm_arcnet_led_init(dev, dev->dev_id, i); - - list_add(&card->list, &priv->list_dev); -- } -+ continue; - -- pci_set_drvdata(pdev, priv); -- -- return 0; -- --out_port: -- com20020pci_remove(pdev); -+err_free_arcdev: -+ free_arcdev(dev); -+ break; -+ } -+ if (ret) -+ com20020pci_remove(pdev); - return ret; - } - -diff --git a/drivers/net/can/usb/Kconfig b/drivers/net/can/usb/Kconfig -index c1e5d5b570b65..538f4d9adb914 100644 ---- a/drivers/net/can/usb/Kconfig -+++ b/drivers/net/can/usb/Kconfig -@@ -73,6 +73,7 @@ config CAN_KVASER_USB - - Kvaser Memorator Pro 5xHS - - Kvaser USBcan Light 4xHS - - Kvaser USBcan Pro 2xHS v2 -+ - Kvaser USBcan Pro 4xHS - - Kvaser USBcan Pro 5xHS - - Kvaser U100 - - Kvaser U100P -diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c -index e2d58846c40ca..073c4a39e7182 100644 ---- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c -+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c -@@ -86,8 +86,9 @@ - #define USB_U100_PRODUCT_ID 273 - #define USB_U100P_PRODUCT_ID 274 - #define USB_U100S_PRODUCT_ID 275 -+#define USB_USBCAN_PRO_4HS_PRODUCT_ID 276 - #define USB_HYDRA_PRODUCT_ID_END \ -- USB_U100S_PRODUCT_ID -+ USB_USBCAN_PRO_4HS_PRODUCT_ID - - static inline bool kvaser_is_leaf(const struct usb_device_id *id) - { -@@ -193,6 +194,7 @@ static const struct usb_device_id kvaser_usb_table[] = { - { USB_DEVICE(KVASER_VENDOR_ID, USB_U100_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_U100P_PRODUCT_ID) }, - { USB_DEVICE(KVASER_VENDOR_ID, USB_U100S_PRODUCT_ID) }, -+ { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_4HS_PRODUCT_ID) }, - { } - }; - MODULE_DEVICE_TABLE(usb, kvaser_usb_table); -diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c -index d1e4d42e497d8..3712e1786091f 100644 ---- a/drivers/net/ethernet/marvell/pxa168_eth.c -+++ b/drivers/net/ethernet/marvell/pxa168_eth.c -@@ -1544,8 +1544,8 @@ static int pxa168_eth_remove(struct platform_device *pdev) - clk_disable_unprepare(pep->clk); - mdiobus_unregister(pep->smi_bus); - mdiobus_free(pep->smi_bus); -- unregister_netdev(dev); - cancel_work_sync(&pep->tx_timeout_task); -+ unregister_netdev(dev); - free_netdev(dev); - return 0; - } -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c -index aaa5a56b44c7c..b6324d11a0086 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c -@@ -2317,8 +2317,9 @@ static u8 mlx5e_build_icosq_log_wq_sz(struct mlx5e_params *params, - { - switch (params->rq_wq_type) { - case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ: -- return order_base_2(MLX5E_UMR_WQEBBS) + -- mlx5e_get_rq_log_wq_sz(rqp->rqc); -+ return max_t(u8, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE, -+ order_base_2(MLX5E_UMR_WQEBBS) + -+ mlx5e_get_rq_log_wq_sz(rqp->rqc)); - default: /* MLX5_WQ_TYPE_CYCLIC */ - return MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE; - } -diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c -index eb65a11e33eaf..1ce013a2d6ed0 100644 ---- a/drivers/net/ipa/ipa_cmd.c -+++ b/drivers/net/ipa/ipa_cmd.c -@@ -175,21 +175,23 @@ bool ipa_cmd_table_valid(struct ipa *ipa, const struct ipa_mem *mem, - : field_max(IP_FLTRT_FLAGS_NHASH_ADDR_FMASK); - if (mem->offset > offset_max || - ipa->mem_offset > offset_max - mem->offset) { -- dev_err(dev, "IPv%c %s%s table region offset too large " -- "(0x%04x + 0x%04x > 0x%04x)\n", -- ipv6 ? '6' : '4', hashed ? "hashed " : "", -- route ? "route" : "filter", -- ipa->mem_offset, mem->offset, offset_max); -+ dev_err(dev, "IPv%c %s%s table region offset too large\n", -+ ipv6 ? '6' : '4', hashed ? "hashed " : "", -+ route ? "route" : "filter"); -+ dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n", -+ ipa->mem_offset, mem->offset, offset_max); -+ - return false; - } - - if (mem->offset > ipa->mem_size || - mem->size > ipa->mem_size - mem->offset) { -- dev_err(dev, "IPv%c %s%s table region out of range " -- "(0x%04x + 0x%04x > 0x%04x)\n", -- ipv6 ? '6' : '4', hashed ? "hashed " : "", -- route ? "route" : "filter", -- mem->offset, mem->size, ipa->mem_size); -+ dev_err(dev, "IPv%c %s%s table region out of range\n", -+ ipv6 ? '6' : '4', hashed ? "hashed " : "", -+ route ? "route" : "filter"); -+ dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n", -+ mem->offset, mem->size, ipa->mem_size); -+ - return false; - } - -@@ -205,22 +207,36 @@ static bool ipa_cmd_header_valid(struct ipa *ipa) - u32 size_max; - u32 size; - -+ /* In ipa_cmd_hdr_init_local_add() we record the offset and size -+ * of the header table memory area. Make sure the offset and size -+ * fit in the fields that need to hold them, and that the entire -+ * range is within the overall IPA memory range. -+ */ - offset_max = field_max(HDR_INIT_LOCAL_FLAGS_HDR_ADDR_FMASK); - if (mem->offset > offset_max || - ipa->mem_offset > offset_max - mem->offset) { -- dev_err(dev, "header table region offset too large " -- "(0x%04x + 0x%04x > 0x%04x)\n", -- ipa->mem_offset + mem->offset, offset_max); -+ dev_err(dev, "header table region offset too large\n"); -+ dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n", -+ ipa->mem_offset, mem->offset, offset_max); -+ - return false; - } - - size_max = field_max(HDR_INIT_LOCAL_FLAGS_TABLE_SIZE_FMASK); - size = ipa->mem[IPA_MEM_MODEM_HEADER].size; - size += ipa->mem[IPA_MEM_AP_HEADER].size; -- if (mem->offset > ipa->mem_size || size > ipa->mem_size - mem->offset) { -- dev_err(dev, "header table region out of range " -- "(0x%04x + 0x%04x > 0x%04x)\n", -- mem->offset, size, ipa->mem_size); -+ -+ if (size > size_max) { -+ dev_err(dev, "header table region size too large\n"); -+ dev_err(dev, " (0x%04x > 0x%08x)\n", size, size_max); -+ -+ return false; -+ } -+ if (size > ipa->mem_size || mem->offset > ipa->mem_size - size) { -+ dev_err(dev, "header table region out of range\n"); -+ dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n", -+ mem->offset, size, ipa->mem_size); -+ - return false; - } - -diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c -index 2f5b8d09143e3..57cc92891a570 100644 ---- a/drivers/platform/x86/intel-hid.c -+++ b/drivers/platform/x86/intel-hid.c -@@ -90,6 +90,13 @@ static const struct dmi_system_id button_array_table[] = { - DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x2 Detachable"), - }, - }, -+ { -+ .ident = "Lenovo ThinkPad X1 Tablet Gen 2", -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), -+ DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Tablet Gen 2"), -+ }, -+ }, - { } - }; - -diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c -index ee2f757515b0a..b5888aeb4bcff 100644 ---- a/drivers/platform/x86/intel_pmc_core.c -+++ b/drivers/platform/x86/intel_pmc_core.c -@@ -863,34 +863,45 @@ out_unlock: - } - DEFINE_SHOW_ATTRIBUTE(pmc_core_pll); - --static ssize_t pmc_core_ltr_ignore_write(struct file *file, -- const char __user *userbuf, -- size_t count, loff_t *ppos) -+static int pmc_core_send_ltr_ignore(u32 value) - { - struct pmc_dev *pmcdev = &pmc; - const struct pmc_reg_map *map = pmcdev->map; -- u32 val, buf_size, fd; -- int err; -- -- buf_size = count < 64 ? count : 64; -- -- err = kstrtou32_from_user(userbuf, buf_size, 10, &val); -- if (err) -- return err; -+ u32 reg; -+ int err = 0; - - mutex_lock(&pmcdev->lock); - -- if (val > map->ltr_ignore_max) { -+ if (value > map->ltr_ignore_max) { - err = -EINVAL; - goto out_unlock; - } - -- fd = pmc_core_reg_read(pmcdev, map->ltr_ignore_offset); -- fd |= (1U << val); -- pmc_core_reg_write(pmcdev, map->ltr_ignore_offset, fd); -+ reg = pmc_core_reg_read(pmcdev, map->ltr_ignore_offset); -+ reg |= BIT(value); -+ pmc_core_reg_write(pmcdev, map->ltr_ignore_offset, reg); - - out_unlock: - mutex_unlock(&pmcdev->lock); -+ -+ return err; -+} -+ -+static ssize_t pmc_core_ltr_ignore_write(struct file *file, -+ const char __user *userbuf, -+ size_t count, loff_t *ppos) -+{ -+ u32 buf_size, value; -+ int err; -+ -+ buf_size = min_t(u32, count, 64); -+ -+ err = kstrtou32_from_user(userbuf, buf_size, 10, &value); -+ if (err) -+ return err; -+ -+ err = pmc_core_send_ltr_ignore(value); -+ - return err == 0 ? count : err; - } - -@@ -1244,6 +1255,15 @@ static int pmc_core_probe(struct platform_device *pdev) - pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(); - dmi_check_system(pmc_core_dmi_table); - -+ /* -+ * On TGL, due to a hardware limitation, the GBE LTR blocks PC10 when -+ * a cable is attached. Tell the PMC to ignore it. -+ */ -+ if (pmcdev->map == &tgl_reg_map) { -+ dev_dbg(&pdev->dev, "ignoring GBE LTR\n"); -+ pmc_core_send_ltr_ignore(3); -+ } -+ - pmc_core_dbgfs_register(pmcdev); - - device_initialized = true; -diff --git a/drivers/platform/x86/intel_pmt_class.c b/drivers/platform/x86/intel_pmt_class.c -index c8939fba45090..ee2b3bbeb83da 100644 ---- a/drivers/platform/x86/intel_pmt_class.c -+++ b/drivers/platform/x86/intel_pmt_class.c -@@ -173,7 +173,7 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry, - struct intel_pmt_namespace *ns, - struct device *parent) - { -- struct resource res; -+ struct resource res = {0}; - struct device *dev; - int ret; - -diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c -index f3e8eca8d86d6..9f8da7155a897 100644 ---- a/drivers/platform/x86/thinkpad_acpi.c -+++ b/drivers/platform/x86/thinkpad_acpi.c -@@ -4080,13 +4080,19 @@ static bool hotkey_notify_6xxx(const u32 hkey, - - case TP_HKEY_EV_KEY_NUMLOCK: - case TP_HKEY_EV_KEY_FN: -- case TP_HKEY_EV_KEY_FN_ESC: - /* key press events, we just ignore them as long as the EC - * is still reporting them in the normal keyboard stream */ - *send_acpi_ev = false; - *ignore_acpi_ev = true; - return true; - -+ case TP_HKEY_EV_KEY_FN_ESC: -+ /* Get the media key status to foce the status LED to update */ -+ acpi_evalf(hkey_handle, NULL, "GMKS", "v"); -+ *send_acpi_ev = false; -+ *ignore_acpi_ev = true; -+ return true; -+ - case TP_HKEY_EV_TABLET_CHANGED: - tpacpi_input_send_tabletsw(); - hotkey_tablet_mode_notify_change(); -diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c -index beb5f74944cdf..08f4cf0ad9e3c 100644 ---- a/drivers/ptp/ptp_qoriq.c -+++ b/drivers/ptp/ptp_qoriq.c -@@ -189,15 +189,16 @@ int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) - tmr_add = ptp_qoriq->tmr_add; - adj = tmr_add; - -- /* calculate diff as adj*(scaled_ppm/65536)/1000000 -- * and round() to the nearest integer -+ /* -+ * Calculate diff and round() to the nearest integer -+ * -+ * diff = adj * (ppb / 1000000000) -+ * = adj * scaled_ppm / 65536000000 - */ -- adj *= scaled_ppm; -- diff = div_u64(adj, 8000000); -- diff = (diff >> 13) + ((diff >> 12) & 1); -+ diff = mul_u64_u64_div_u64(adj, scaled_ppm, 32768000000); -+ diff = DIV64_U64_ROUND_UP(diff, 2); - - tmr_add = neg_adj ? tmr_add - diff : tmr_add + diff; -- - ptp_qoriq->write(®s->ctrl_regs->tmr_add, tmr_add); - - return 0; -diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c -index 7994f27e45271..0689d550c37ab 100644 ---- a/drivers/target/target_core_pscsi.c -+++ b/drivers/target/target_core_pscsi.c -@@ -939,6 +939,14 @@ new_bio: - - return 0; - fail: -+ if (bio) -+ bio_put(bio); -+ while (req->bio) { -+ bio = req->bio; -+ req->bio = bio->bi_next; -+ bio_put(bio); -+ } -+ req->biotail = NULL; - return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; - } - -diff --git a/fs/block_dev.c b/fs/block_dev.c -index c33151020bcd7..85500e2400cf6 100644 ---- a/fs/block_dev.c -+++ b/fs/block_dev.c -@@ -1240,13 +1240,13 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate) - - lockdep_assert_held(&bdev->bd_mutex); - -- clear_bit(GD_NEED_PART_SCAN, &bdev->bd_disk->state); -- - rescan: - ret = blk_drop_partitions(bdev); - if (ret) - return ret; - -+ clear_bit(GD_NEED_PART_SCAN, &disk->state); -+ - /* - * Historically we only set the capacity to zero for devices that - * support partitions (independ of actually having partitions created). -diff --git a/fs/cifs/file.c b/fs/cifs/file.c -index 6d001905c8e51..eef4f22b5e783 100644 ---- a/fs/cifs/file.c -+++ b/fs/cifs/file.c -@@ -165,6 +165,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode, - goto posix_open_ret; - } - } else { -+ cifs_revalidate_mapping(*pinode); - cifs_fattr_to_inode(*pinode, &fattr); - } - -diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c -index d9073b569e174..53fb751bf2108 100644 ---- a/fs/cifs/smb2misc.c -+++ b/fs/cifs/smb2misc.c -@@ -754,8 +754,8 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) - } - } - spin_unlock(&cifs_tcp_ses_lock); -- cifs_dbg(FYI, "Can not process oplock break for non-existent connection\n"); -- return false; -+ cifs_dbg(FYI, "No file id matched, oplock break ignored\n"); -+ return true; - } - - void -diff --git a/fs/io_uring.c b/fs/io_uring.c -index 8b4213de9e085..b1b3154c8d502 100644 ---- a/fs/io_uring.c -+++ b/fs/io_uring.c -@@ -1594,7 +1594,7 @@ static void io_queue_async_work(struct io_kiocb *req) - io_queue_linked_timeout(link); - } - --static void io_kill_timeout(struct io_kiocb *req) -+static void io_kill_timeout(struct io_kiocb *req, int status) - { - struct io_timeout_data *io = req->async_data; - int ret; -@@ -1604,7 +1604,7 @@ static void io_kill_timeout(struct io_kiocb *req) - atomic_set(&req->ctx->cq_timeouts, - atomic_read(&req->ctx->cq_timeouts) + 1); - list_del_init(&req->timeout.list); -- io_cqring_fill_event(req, 0); -+ io_cqring_fill_event(req, status); - io_put_req_deferred(req, 1); - } - } -@@ -1621,7 +1621,7 @@ static bool io_kill_timeouts(struct io_ring_ctx *ctx, struct task_struct *tsk, - spin_lock_irq(&ctx->completion_lock); - list_for_each_entry_safe(req, tmp, &ctx->timeout_list, timeout.list) { - if (io_match_task(req, tsk, files)) { -- io_kill_timeout(req); -+ io_kill_timeout(req, -ECANCELED); - canceled++; - } - } -@@ -1673,7 +1673,7 @@ static void io_flush_timeouts(struct io_ring_ctx *ctx) - break; - - list_del_init(&req->timeout.list); -- io_kill_timeout(req); -+ io_kill_timeout(req, 0); - } while (!list_empty(&ctx->timeout_list)); - - ctx->cq_last_tm_flush = seq; -diff --git a/init/Kconfig b/init/Kconfig -index b7d3c6a12196f..a3d27421de8f8 100644 ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -113,8 +113,7 @@ config INIT_ENV_ARG_LIMIT - - config COMPILE_TEST - bool "Compile also drivers which will not load" -- depends on !UML && !S390 -- default n -+ depends on HAS_IOMEM - help - Some drivers can be compiled on a different platform than they are - intended to be run on. Despite they cannot be loaded there (or even -diff --git a/lib/math/div64.c b/lib/math/div64.c -index 064d68a5391a0..46866394fc843 100644 ---- a/lib/math/div64.c -+++ b/lib/math/div64.c -@@ -232,4 +232,5 @@ u64 mul_u64_u64_div_u64(u64 a, u64 b, u64 c) - - return res + div64_u64(a * b, c); - } -+EXPORT_SYMBOL(mul_u64_u64_div_u64); - #endif -diff --git a/net/mac80211/aead_api.c b/net/mac80211/aead_api.c -index d7b3d905d5353..b00d6f5b33f40 100644 ---- a/net/mac80211/aead_api.c -+++ b/net/mac80211/aead_api.c -@@ -23,6 +23,7 @@ int aead_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len, - struct aead_request *aead_req; - int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm); - u8 *__aad; -+ int ret; - - aead_req = kzalloc(reqsize + aad_len, GFP_ATOMIC); - if (!aead_req) -@@ -40,10 +41,10 @@ int aead_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len, - aead_request_set_crypt(aead_req, sg, sg, data_len, b_0); - aead_request_set_ad(aead_req, sg[0].length); - -- crypto_aead_encrypt(aead_req); -+ ret = crypto_aead_encrypt(aead_req); - kfree_sensitive(aead_req); - -- return 0; -+ return ret; - } - - int aead_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len, -diff --git a/net/mac80211/aes_gmac.c b/net/mac80211/aes_gmac.c -index 6f3b3a0cc10a4..512cab073f2e8 100644 ---- a/net/mac80211/aes_gmac.c -+++ b/net/mac80211/aes_gmac.c -@@ -22,6 +22,7 @@ int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce, - struct aead_request *aead_req; - int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm); - const __le16 *fc; -+ int ret; - - if (data_len < GMAC_MIC_LEN) - return -EINVAL; -@@ -59,10 +60,10 @@ int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce, - aead_request_set_crypt(aead_req, sg, sg, 0, iv); - aead_request_set_ad(aead_req, GMAC_AAD_LEN + data_len); - -- crypto_aead_encrypt(aead_req); -+ ret = crypto_aead_encrypt(aead_req); - kfree_sensitive(aead_req); - -- return 0; -+ return ret; - } - - struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[], -diff --git a/net/mac80211/main.c b/net/mac80211/main.c -index dee88ec566ad1..d1023188ef373 100644 ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -970,8 +970,19 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) - continue; - - if (!dflt_chandef.chan) { -+ /* -+ * Assign the first enabled channel to dflt_chandef -+ * from the list of channels -+ */ -+ for (i = 0; i < sband->n_channels; i++) -+ if (!(sband->channels[i].flags & -+ IEEE80211_CHAN_DISABLED)) -+ break; -+ /* if none found then use the first anyway */ -+ if (i == sband->n_channels) -+ i = 0; - cfg80211_chandef_create(&dflt_chandef, -- &sband->channels[0], -+ &sband->channels[i], - NL80211_CHAN_NO_HT); - /* init channel we're on */ - if (!local->use_chanctx && !local->_oper_chandef.chan) { -diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c -index 5b05487a60d21..db11e403d8187 100644 ---- a/net/netfilter/nf_conntrack_proto_gre.c -+++ b/net/netfilter/nf_conntrack_proto_gre.c -@@ -218,9 +218,6 @@ int nf_conntrack_gre_packet(struct nf_conn *ct, - enum ip_conntrack_info ctinfo, - const struct nf_hook_state *state) - { -- if (state->pf != NFPROTO_IPV4) -- return -NF_ACCEPT; -- - if (!nf_ct_is_confirmed(ct)) { - unsigned int *timeouts = nf_ct_timeout_lookup(ct); - -diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c -index 24a7a6b17268c..93d4bb39afb3c 100644 ---- a/net/netfilter/nf_tables_api.c -+++ b/net/netfilter/nf_tables_api.c -@@ -6749,6 +6749,9 @@ static int nft_register_flowtable_net_hooks(struct net *net, - - list_for_each_entry(hook, hook_list, list) { - list_for_each_entry(ft, &table->flowtables, list) { -+ if (!nft_is_active_next(net, ft)) -+ continue; -+ - list_for_each_entry(hook2, &ft->hook_list, list) { - if (hook->ops.dev == hook2->ops.dev && - hook->ops.pf == hook2->ops.pf) { -diff --git a/tools/bpf/resolve_btfids/.gitignore b/tools/bpf/resolve_btfids/.gitignore -index a026df7dc2809..16913fffc9859 100644 ---- a/tools/bpf/resolve_btfids/.gitignore -+++ b/tools/bpf/resolve_btfids/.gitignore -@@ -1,4 +1,3 @@ --/FEATURE-DUMP.libbpf --/bpf_helper_defs.h - /fixdep - /resolve_btfids -+/libbpf/ -diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile -index bf656432ad736..bb9fa8de7e625 100644 ---- a/tools/bpf/resolve_btfids/Makefile -+++ b/tools/bpf/resolve_btfids/Makefile -@@ -2,11 +2,7 @@ - include ../../scripts/Makefile.include - include ../../scripts/Makefile.arch - --ifeq ($(srctree),) --srctree := $(patsubst %/,%,$(dir $(CURDIR))) --srctree := $(patsubst %/,%,$(dir $(srctree))) --srctree := $(patsubst %/,%,$(dir $(srctree))) --endif -+srctree := $(abspath $(CURDIR)/../../../) - - ifeq ($(V),1) - Q = -@@ -22,28 +18,29 @@ AR = $(HOSTAR) - CC = $(HOSTCC) - LD = $(HOSTLD) - ARCH = $(HOSTARCH) -+RM ?= rm - - OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ - - LIBBPF_SRC := $(srctree)/tools/lib/bpf/ - SUBCMD_SRC := $(srctree)/tools/lib/subcmd/ - --BPFOBJ := $(OUTPUT)/libbpf.a --SUBCMDOBJ := $(OUTPUT)/libsubcmd.a -+BPFOBJ := $(OUTPUT)/libbpf/libbpf.a -+SUBCMDOBJ := $(OUTPUT)/libsubcmd/libsubcmd.a - - BINARY := $(OUTPUT)/resolve_btfids - BINARY_IN := $(BINARY)-in.o - - all: $(BINARY) - --$(OUTPUT): -+$(OUTPUT) $(OUTPUT)/libbpf $(OUTPUT)/libsubcmd: - $(call msg,MKDIR,,$@) -- $(Q)mkdir -p $(OUTPUT) -+ $(Q)mkdir -p $(@) - --$(SUBCMDOBJ): fixdep FORCE -- $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT) -+$(SUBCMDOBJ): fixdep FORCE | $(OUTPUT)/libsubcmd -+ $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@) - --$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT) -+$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT)/libbpf - $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@) - - CFLAGS := -g \ -@@ -57,24 +54,27 @@ LIBS = -lelf -lz - export srctree OUTPUT CFLAGS Q - include $(srctree)/tools/build/Makefile.include - --$(BINARY_IN): fixdep FORCE -+$(BINARY_IN): fixdep FORCE | $(OUTPUT) - $(Q)$(MAKE) $(build)=resolve_btfids - - $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) - $(call msg,LINK,$@) - $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS) - --libsubcmd-clean: -- $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT) clean -- --libbpf-clean: -- $(Q)$(MAKE) -C $(LIBBPF_SRC) OUTPUT=$(OUTPUT) clean -+clean_objects := $(wildcard $(OUTPUT)/*.o \ -+ $(OUTPUT)/.*.o.cmd \ -+ $(OUTPUT)/.*.o.d \ -+ $(OUTPUT)/libbpf \ -+ $(OUTPUT)/libsubcmd \ -+ $(OUTPUT)/resolve_btfids) - --clean: libsubcmd-clean libbpf-clean fixdep-clean -+ifneq ($(clean_objects),) -+clean: fixdep-clean - $(call msg,CLEAN,$(BINARY)) -- $(Q)$(RM) -f $(BINARY); \ -- $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \ -- find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) -+ $(Q)$(RM) -rf $(clean_objects) -+else -+clean: -+endif - - tags: - $(call msg,GEN,,tags) -diff --git a/tools/testing/kunit/kunit_config.py b/tools/testing/kunit/kunit_config.py -index bdd60230764b0..27fe086d2d0d1 100644 ---- a/tools/testing/kunit/kunit_config.py -+++ b/tools/testing/kunit/kunit_config.py -@@ -13,7 +13,7 @@ from typing import List, Set - CONFIG_IS_NOT_SET_PATTERN = r'^# CONFIG_(\w+) is not set$' - CONFIG_PATTERN = r'^CONFIG_(\w+)=(\S+|".*")$' - --KconfigEntryBase = collections.namedtuple('KconfigEntry', ['name', 'value']) -+KconfigEntryBase = collections.namedtuple('KconfigEntryBase', ['name', 'value']) - - class KconfigEntry(KconfigEntryBase): - -diff --git a/tools/testing/selftests/arm64/fp/sve-test.S b/tools/testing/selftests/arm64/fp/sve-test.S -index 9210691aa9985..e3e08d9c7020e 100644 ---- a/tools/testing/selftests/arm64/fp/sve-test.S -+++ b/tools/testing/selftests/arm64/fp/sve-test.S -@@ -284,16 +284,28 @@ endfunction - // Set up test pattern in the FFR - // x0: pid - // x2: generation -+// -+// We need to generate a canonical FFR value, which consists of a number of -+// low "1" bits, followed by a number of zeros. This gives us 17 unique values -+// per 16 bits of FFR, so we create a 4 bit signature out of the PID and -+// generation, and use that as the initial number of ones in the pattern. -+// We fill the upper lanes of FFR with zeros. - // Beware: corrupts P0. - function setup_ffr - mov x4, x30 - -- bl pattern -+ and w0, w0, #0x3 -+ bfi w0, w2, #2, #2 -+ mov w1, #1 -+ lsl w1, w1, w0 -+ sub w1, w1, #1 -+ - ldr x0, =ffrref -- ldr x1, =scratch -- rdvl x2, #1 -- lsr x2, x2, #3 -- bl memcpy -+ strh w1, [x0], 2 -+ rdvl x1, #1 -+ lsr x1, x1, #3 -+ sub x1, x1, #2 -+ bl memclr - - mov x0, #0 - ldr x1, =ffrref -diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile -index d42115e4284d7..8b0cd421ebd38 100644 ---- a/tools/testing/selftests/vm/Makefile -+++ b/tools/testing/selftests/vm/Makefile -@@ -101,7 +101,7 @@ endef - ifeq ($(CAN_BUILD_I386),1) - $(BINARIES_32): CFLAGS += -m32 - $(BINARIES_32): LDLIBS += -lrt -ldl -lm --$(BINARIES_32): %_32: %.c -+$(BINARIES_32): $(OUTPUT)/%_32: %.c - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(notdir $^) $(LDLIBS) -o $@ - $(foreach t,$(TARGETS),$(eval $(call gen-target-rule-32,$(t)))) - endif -@@ -109,7 +109,7 @@ endif - ifeq ($(CAN_BUILD_X86_64),1) - $(BINARIES_64): CFLAGS += -m64 - $(BINARIES_64): LDLIBS += -lrt -ldl --$(BINARIES_64): %_64: %.c -+$(BINARIES_64): $(OUTPUT)/%_64: %.c - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(notdir $^) $(LDLIBS) -o $@ - $(foreach t,$(TARGETS),$(eval $(call gen-target-rule-64,$(t)))) - endif diff --git a/patch/kernel/archive/sunxi-5.11/patch-5.11.13-14.patch b/patch/kernel/archive/sunxi-5.11/patch-5.11.13-14.patch deleted file mode 100644 index 1ca2de9cf..000000000 --- a/patch/kernel/archive/sunxi-5.11/patch-5.11.13-14.patch +++ /dev/null @@ -1,8865 +0,0 @@ -diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml -index 880e55f7a4b13..a7ee05896564b 100644 ---- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml -+++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml -@@ -49,7 +49,7 @@ properties: - description: - Reference to an nvmem node for the MAC address - -- nvmem-cells-names: -+ nvmem-cell-names: - const: mac-address - - phy-connection-type: -diff --git a/Makefile b/Makefile -index 1be83283e0321..9116941553b86 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - VERSION = 5 - PATCHLEVEL = 11 --SUBLEVEL = 13 -+SUBLEVEL = 14 - EXTRAVERSION = - NAME = 💕 Valentine's Day Edition 💕 - -diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts -index 646a06420c77e..5bd6a66d2c2b4 100644 ---- a/arch/arm/boot/dts/armada-385-turris-omnia.dts -+++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts -@@ -32,7 +32,8 @@ - ranges = ; -+ MBUS_ID(0x09, 0x15) 0 0xf1110000 0x10000 -+ MBUS_ID(0x0c, 0x04) 0 0xf1200000 0x100000>; - - internal-regs { - -@@ -389,6 +390,7 @@ - phy1: ethernet-phy@1 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <1>; -+ marvell,reg-init = <3 18 0 0x4985>; - - /* irq is connected to &pcawan pin 7 */ - }; -diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi -index 7a1e53195785b..f28a96fcf23e8 100644 ---- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi -+++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi -@@ -433,6 +433,7 @@ - pinctrl-0 = <&pinctrl_usdhc2>; - cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; - wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; -+ vmmc-supply = <&vdd_sd1_reg>; - status = "disabled"; - }; - -@@ -442,5 +443,6 @@ - &pinctrl_usdhc3_cdwp>; - cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; - wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>; -+ vmmc-supply = <&vdd_sd0_reg>; - status = "disabled"; - }; -diff --git a/arch/arm/mach-omap2/omap-secure.c b/arch/arm/mach-omap2/omap-secure.c -index f70d561f37f71..0659ab4cb0af3 100644 ---- a/arch/arm/mach-omap2/omap-secure.c -+++ b/arch/arm/mach-omap2/omap-secure.c -@@ -9,6 +9,7 @@ - */ - - #include -+#include - #include - #include - #include -@@ -20,6 +21,7 @@ - - #include "common.h" - #include "omap-secure.h" -+#include "soc.h" - - static phys_addr_t omap_secure_memblock_base; - -@@ -213,3 +215,40 @@ void __init omap_secure_init(void) - { - omap_optee_init_check(); - } -+ -+/* -+ * Dummy dispatcher call after core OSWR and MPU off. Updates the ROM return -+ * address after MMU has been re-enabled after CPU1 has been woken up again. -+ * Otherwise the ROM code will attempt to use the earlier physical return -+ * address that got set with MMU off when waking up CPU1. Only used on secure -+ * devices. -+ */ -+static int cpu_notifier(struct notifier_block *nb, unsigned long cmd, void *v) -+{ -+ switch (cmd) { -+ case CPU_CLUSTER_PM_EXIT: -+ omap_secure_dispatcher(OMAP4_PPA_SERVICE_0, -+ FLAG_START_CRITICAL, -+ 0, 0, 0, 0, 0); -+ break; -+ default: -+ break; -+ } -+ -+ return NOTIFY_OK; -+} -+ -+static struct notifier_block secure_notifier_block = { -+ .notifier_call = cpu_notifier, -+}; -+ -+static int __init secure_pm_init(void) -+{ -+ if (omap_type() == OMAP2_DEVICE_TYPE_GP || !soc_is_omap44xx()) -+ return 0; -+ -+ cpu_pm_register_notifier(&secure_notifier_block); -+ -+ return 0; -+} -+omap_arch_initcall(secure_pm_init); -diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h -index 4aaa95706d39f..172069f316164 100644 ---- a/arch/arm/mach-omap2/omap-secure.h -+++ b/arch/arm/mach-omap2/omap-secure.h -@@ -50,6 +50,7 @@ - #define OMAP5_DRA7_MON_SET_ACR_INDEX 0x107 - - /* Secure PPA(Primary Protected Application) APIs */ -+#define OMAP4_PPA_SERVICE_0 0x21 - #define OMAP4_PPA_L2_POR_INDEX 0x23 - #define OMAP4_PPA_CPU_ACTRL_SMP_INDEX 0x25 - -diff --git a/arch/arm/mach-omap2/pmic-cpcap.c b/arch/arm/mach-omap2/pmic-cpcap.c -index 09076ad0576d9..668dc84fd31e0 100644 ---- a/arch/arm/mach-omap2/pmic-cpcap.c -+++ b/arch/arm/mach-omap2/pmic-cpcap.c -@@ -246,10 +246,10 @@ int __init omap4_cpcap_init(void) - omap_voltage_register_pmic(voltdm, &omap443x_max8952_mpu); - - if (of_machine_is_compatible("motorola,droid-bionic")) { -- voltdm = voltdm_lookup("mpu"); -+ voltdm = voltdm_lookup("core"); - omap_voltage_register_pmic(voltdm, &omap_cpcap_core); - -- voltdm = voltdm_lookup("mpu"); -+ voltdm = voltdm_lookup("iva"); - omap_voltage_register_pmic(voltdm, &omap_cpcap_iva); - } else { - voltdm = voltdm_lookup("core"); -diff --git a/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h b/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h -index 5ccc4cc91959d..a003e6af33533 100644 ---- a/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h -+++ b/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h -@@ -124,7 +124,7 @@ - #define MX8MM_IOMUXC_SD1_CMD_USDHC1_CMD 0x0A4 0x30C 0x000 0x0 0x0 - #define MX8MM_IOMUXC_SD1_CMD_GPIO2_IO1 0x0A4 0x30C 0x000 0x5 0x0 - #define MX8MM_IOMUXC_SD1_DATA0_USDHC1_DATA0 0x0A8 0x310 0x000 0x0 0x0 --#define MX8MM_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x31 0x000 0x5 0x0 -+#define MX8MM_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x310 0x000 0x5 0x0 - #define MX8MM_IOMUXC_SD1_DATA1_USDHC1_DATA1 0x0AC 0x314 0x000 0x0 0x0 - #define MX8MM_IOMUXC_SD1_DATA1_GPIO2_IO3 0x0AC 0x314 0x000 0x5 0x0 - #define MX8MM_IOMUXC_SD1_DATA2_USDHC1_DATA2 0x0B0 0x318 0x000 0x0 0x0 -diff --git a/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h b/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h -index b94b02080a344..68e8fa1729741 100644 ---- a/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h -+++ b/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h -@@ -130,7 +130,7 @@ - #define MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0x0A4 0x30C 0x000 0x0 0x0 - #define MX8MQ_IOMUXC_SD1_CMD_GPIO2_IO1 0x0A4 0x30C 0x000 0x5 0x0 - #define MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0x0A8 0x310 0x000 0x0 0x0 --#define MX8MQ_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x31 0x000 0x5 0x0 -+#define MX8MQ_IOMUXC_SD1_DATA0_GPIO2_IO2 0x0A8 0x310 0x000 0x5 0x0 - #define MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0x0AC 0x314 0x000 0x0 0x0 - #define MX8MQ_IOMUXC_SD1_DATA1_GPIO2_IO3 0x0AC 0x314 0x000 0x5 0x0 - #define MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0x0B0 0x318 0x000 0x0 0x0 -diff --git a/arch/arm64/boot/dts/marvell/armada-cp11x.dtsi b/arch/arm64/boot/dts/marvell/armada-cp11x.dtsi -index 994a2fce449a2..1e37ae181acf3 100644 ---- a/arch/arm64/boot/dts/marvell/armada-cp11x.dtsi -+++ b/arch/arm64/boot/dts/marvell/armada-cp11x.dtsi -@@ -300,9 +300,11 @@ - }; - - CP11X_LABEL(sata0): sata@540000 { -- compatible = "marvell,armada-8k-ahci"; -+ compatible = "marvell,armada-8k-ahci", -+ "generic-ahci"; - reg = <0x540000 0x30000>; - dma-coherent; -+ interrupts = <107 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&CP11X_LABEL(clk) 1 15>, - <&CP11X_LABEL(clk) 1 16>; - #address-cells = <1>; -@@ -310,12 +312,10 @@ - status = "disabled"; - - sata-port@0 { -- interrupts = <109 IRQ_TYPE_LEVEL_HIGH>; - reg = <0>; - }; - - sata-port@1 { -- interrupts = <107 IRQ_TYPE_LEVEL_HIGH>; - reg = <1>; - }; - }; -diff --git a/arch/ia64/include/asm/ptrace.h b/arch/ia64/include/asm/ptrace.h -index b3aa460901012..08179135905cd 100644 ---- a/arch/ia64/include/asm/ptrace.h -+++ b/arch/ia64/include/asm/ptrace.h -@@ -54,8 +54,7 @@ - - static inline unsigned long user_stack_pointer(struct pt_regs *regs) - { -- /* FIXME: should this be bspstore + nr_dirty regs? */ -- return regs->ar_bspstore; -+ return regs->r12; - } - - static inline int is_syscall_success(struct pt_regs *regs) -@@ -79,11 +78,6 @@ static inline long regs_return_value(struct pt_regs *regs) - unsigned long __ip = instruction_pointer(regs); \ - (__ip & ~3UL) + ((__ip & 3UL) << 2); \ - }) --/* -- * Why not default? Because user_stack_pointer() on ia64 gives register -- * stack backing store instead... -- */ --#define current_user_stack_pointer() (current_pt_regs()->r12) - - /* given a pointer to a task_struct, return the user's pt_regs */ - # define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1) -diff --git a/arch/nds32/mm/cacheflush.c b/arch/nds32/mm/cacheflush.c -index 6eb98a7ad27d2..ad5344ef5d334 100644 ---- a/arch/nds32/mm/cacheflush.c -+++ b/arch/nds32/mm/cacheflush.c -@@ -238,7 +238,7 @@ void flush_dcache_page(struct page *page) - { - struct address_space *mapping; - -- mapping = page_mapping(page); -+ mapping = page_mapping_file(page); - if (mapping && !mapping_mapped(mapping)) - set_bit(PG_dcache_dirty, &page->flags); - else { -diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h -index cf5ee9b0b393c..84ee232278a6a 100644 ---- a/arch/parisc/include/asm/cmpxchg.h -+++ b/arch/parisc/include/asm/cmpxchg.h -@@ -72,7 +72,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) - #endif - case 4: return __cmpxchg_u32((unsigned int *)ptr, - (unsigned int)old, (unsigned int)new_); -- case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_); -+ case 1: return __cmpxchg_u8((u8 *)ptr, old & 0xff, new_ & 0xff); - } - __cmpxchg_called_with_bad_pointer(); - return old; -diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile -index 79ee7750937db..b31e2160b233a 100644 ---- a/arch/powerpc/kernel/Makefile -+++ b/arch/powerpc/kernel/Makefile -@@ -191,3 +191,7 @@ $(obj)/prom_init_check: $(src)/prom_init_check.sh $(obj)/prom_init.o FORCE - targets += prom_init_check - - clean-files := vmlinux.lds -+ -+# Force dependency (incbin is bad) -+$(obj)/vdso32_wrapper.o : $(obj)/vdso32/vdso32.so.dbg -+$(obj)/vdso64_wrapper.o : $(obj)/vdso64/vdso64.so.dbg -diff --git a/arch/powerpc/kernel/ptrace/Makefile b/arch/powerpc/kernel/ptrace/Makefile -index 8ebc11d1168d8..77abd1a5a508d 100644 ---- a/arch/powerpc/kernel/ptrace/Makefile -+++ b/arch/powerpc/kernel/ptrace/Makefile -@@ -6,11 +6,11 @@ - CFLAGS_ptrace-view.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' - - obj-y += ptrace.o ptrace-view.o --obj-$(CONFIG_PPC_FPU_REGS) += ptrace-fpu.o -+obj-y += ptrace-fpu.o - obj-$(CONFIG_COMPAT) += ptrace32.o - obj-$(CONFIG_VSX) += ptrace-vsx.o - ifneq ($(CONFIG_VSX),y) --obj-$(CONFIG_PPC_FPU_REGS) += ptrace-novsx.o -+obj-y += ptrace-novsx.o - endif - obj-$(CONFIG_ALTIVEC) += ptrace-altivec.o - obj-$(CONFIG_SPE) += ptrace-spe.o -diff --git a/arch/powerpc/kernel/ptrace/ptrace-decl.h b/arch/powerpc/kernel/ptrace/ptrace-decl.h -index 3487f2c9735c6..eafe5f0f62898 100644 ---- a/arch/powerpc/kernel/ptrace/ptrace-decl.h -+++ b/arch/powerpc/kernel/ptrace/ptrace-decl.h -@@ -165,22 +165,8 @@ int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data); - extern const struct user_regset_view user_ppc_native_view; - - /* ptrace-fpu */ --#ifdef CONFIG_PPC_FPU_REGS - int ptrace_get_fpr(struct task_struct *child, int index, unsigned long *data); - int ptrace_put_fpr(struct task_struct *child, int index, unsigned long data); --#else --static inline int --ptrace_get_fpr(struct task_struct *child, int index, unsigned long *data) --{ -- return -EIO; --} -- --static inline int --ptrace_put_fpr(struct task_struct *child, int index, unsigned long data) --{ -- return -EIO; --} --#endif - - /* ptrace-(no)adv */ - void ppc_gethwdinfo(struct ppc_debug_info *dbginfo); -diff --git a/arch/powerpc/kernel/ptrace/ptrace-fpu.c b/arch/powerpc/kernel/ptrace/ptrace-fpu.c -index 8301cb52dd992..5dca19361316e 100644 ---- a/arch/powerpc/kernel/ptrace/ptrace-fpu.c -+++ b/arch/powerpc/kernel/ptrace/ptrace-fpu.c -@@ -8,32 +8,42 @@ - - int ptrace_get_fpr(struct task_struct *child, int index, unsigned long *data) - { -+#ifdef CONFIG_PPC_FPU_REGS - unsigned int fpidx = index - PT_FPR0; -+#endif - - if (index > PT_FPSCR) - return -EIO; - -+#ifdef CONFIG_PPC_FPU_REGS - flush_fp_to_thread(child); - if (fpidx < (PT_FPSCR - PT_FPR0)) - memcpy(data, &child->thread.TS_FPR(fpidx), sizeof(long)); - else - *data = child->thread.fp_state.fpscr; -+#else -+ *data = 0; -+#endif - - return 0; - } - - int ptrace_put_fpr(struct task_struct *child, int index, unsigned long data) - { -+#ifdef CONFIG_PPC_FPU_REGS - unsigned int fpidx = index - PT_FPR0; -+#endif - - if (index > PT_FPSCR) - return -EIO; - -+#ifdef CONFIG_PPC_FPU_REGS - flush_fp_to_thread(child); - if (fpidx < (PT_FPSCR - PT_FPR0)) - memcpy(&child->thread.TS_FPR(fpidx), &data, sizeof(long)); - else - child->thread.fp_state.fpscr = data; -+#endif - - return 0; - } -diff --git a/arch/powerpc/kernel/ptrace/ptrace-novsx.c b/arch/powerpc/kernel/ptrace/ptrace-novsx.c -index b3b36835658af..7433f3db979ac 100644 ---- a/arch/powerpc/kernel/ptrace/ptrace-novsx.c -+++ b/arch/powerpc/kernel/ptrace/ptrace-novsx.c -@@ -21,12 +21,16 @@ - int fpr_get(struct task_struct *target, const struct user_regset *regset, - struct membuf to) - { -+#ifdef CONFIG_PPC_FPU_REGS - BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) != - offsetof(struct thread_fp_state, fpr[32])); - - flush_fp_to_thread(target); - - return membuf_write(&to, &target->thread.fp_state, 33 * sizeof(u64)); -+#else -+ return membuf_write(&to, &empty_zero_page, 33 * sizeof(u64)); -+#endif - } - - /* -@@ -46,6 +50,7 @@ int fpr_set(struct task_struct *target, const struct user_regset *regset, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf) - { -+#ifdef CONFIG_PPC_FPU_REGS - BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) != - offsetof(struct thread_fp_state, fpr[32])); - -@@ -53,4 +58,7 @@ int fpr_set(struct task_struct *target, const struct user_regset *regset, - - return user_regset_copyin(&pos, &count, &kbuf, &ubuf, - &target->thread.fp_state, 0, -1); -+#else -+ return 0; -+#endif - } -diff --git a/arch/powerpc/kernel/ptrace/ptrace-view.c b/arch/powerpc/kernel/ptrace/ptrace-view.c -index 2bad8068f598c..6ccffc65ac97e 100644 ---- a/arch/powerpc/kernel/ptrace/ptrace-view.c -+++ b/arch/powerpc/kernel/ptrace/ptrace-view.c -@@ -522,13 +522,11 @@ static const struct user_regset native_regsets[] = { - .size = sizeof(long), .align = sizeof(long), - .regset_get = gpr_get, .set = gpr_set - }, --#ifdef CONFIG_PPC_FPU_REGS - [REGSET_FPR] = { - .core_note_type = NT_PRFPREG, .n = ELF_NFPREG, - .size = sizeof(double), .align = sizeof(double), - .regset_get = fpr_get, .set = fpr_set - }, --#endif - #ifdef CONFIG_ALTIVEC - [REGSET_VMX] = { - .core_note_type = NT_PPC_VMX, .n = 34, -diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c -index af013b4244d34..2da0273597989 100644 ---- a/arch/s390/kernel/cpcmd.c -+++ b/arch/s390/kernel/cpcmd.c -@@ -37,10 +37,12 @@ static int diag8_noresponse(int cmdlen) - - static int diag8_response(int cmdlen, char *response, int *rlen) - { -+ unsigned long _cmdlen = cmdlen | 0x40000000L; -+ unsigned long _rlen = *rlen; - register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf; - register unsigned long reg3 asm ("3") = (addr_t) response; -- register unsigned long reg4 asm ("4") = cmdlen | 0x40000000L; -- register unsigned long reg5 asm ("5") = *rlen; -+ register unsigned long reg4 asm ("4") = _cmdlen; -+ register unsigned long reg5 asm ("5") = _rlen; - - asm volatile( - " diag %2,%0,0x8\n" -diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h -index 57ef2094af93e..630ff08532be8 100644 ---- a/arch/x86/include/asm/smp.h -+++ b/arch/x86/include/asm/smp.h -@@ -132,7 +132,7 @@ void native_play_dead(void); - void play_dead_common(void); - void wbinvd_on_cpu(int cpu); - int wbinvd_on_all_cpus(void); --bool wakeup_cpu0(void); -+void cond_wakeup_cpu0(void); - - void native_smp_send_reschedule(int cpu); - void native_send_call_func_ipi(const struct cpumask *mask); -diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c -index f877150a91da1..16703c35a944f 100644 ---- a/arch/x86/kernel/smpboot.c -+++ b/arch/x86/kernel/smpboot.c -@@ -1659,13 +1659,17 @@ void play_dead_common(void) - local_irq_disable(); - } - --bool wakeup_cpu0(void) -+/** -+ * cond_wakeup_cpu0 - Wake up CPU0 if needed. -+ * -+ * If NMI wants to wake up CPU0, start CPU0. -+ */ -+void cond_wakeup_cpu0(void) - { - if (smp_processor_id() == 0 && enable_start_cpu0) -- return true; -- -- return false; -+ start_cpu0(); - } -+EXPORT_SYMBOL_GPL(cond_wakeup_cpu0); - - /* - * We need to flush the caches before going to sleep, lest we have -@@ -1734,11 +1738,8 @@ static inline void mwait_play_dead(void) - __monitor(mwait_ptr, 0, 0); - mb(); - __mwait(eax, 0); -- /* -- * If NMI wants to wake up CPU0, start CPU0. -- */ -- if (wakeup_cpu0()) -- start_cpu0(); -+ -+ cond_wakeup_cpu0(); - } - } - -@@ -1749,11 +1750,8 @@ void hlt_play_dead(void) - - while (1) { - native_halt(); -- /* -- * If NMI wants to wake up CPU0, start CPU0. -- */ -- if (wakeup_cpu0()) -- start_cpu0(); -+ -+ cond_wakeup_cpu0(); - } - } - -diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c -index ac1874a2a70e8..651e3e5089593 100644 ---- a/arch/x86/kernel/traps.c -+++ b/arch/x86/kernel/traps.c -@@ -556,7 +556,7 @@ DEFINE_IDTENTRY_ERRORCODE(exc_general_protection) - tsk->thread.trap_nr = X86_TRAP_GP; - - if (fixup_vdso_exception(regs, X86_TRAP_GP, error_code, 0)) -- return; -+ goto exit; - - show_signal(tsk, SIGSEGV, "", desc, regs, error_code); - force_sig(SIGSEGV); -@@ -1057,7 +1057,7 @@ static void math_error(struct pt_regs *regs, int trapnr) - goto exit; - - if (fixup_vdso_exception(regs, trapnr, 0, 0)) -- return; -+ goto exit; - - force_sig_fault(SIGFPE, si_code, - (void __user *)uprobe_get_trap_addr(regs)); -diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c -index ed861245ecf04..86cedf32526a6 100644 ---- a/arch/x86/kvm/mmu/mmu.c -+++ b/arch/x86/kvm/mmu/mmu.c -@@ -5985,6 +5985,7 @@ static void kvm_recover_nx_lpages(struct kvm *kvm) - struct kvm_mmu_page *sp; - unsigned int ratio; - LIST_HEAD(invalid_list); -+ bool flush = false; - ulong to_zap; - - rcu_idx = srcu_read_lock(&kvm->srcu); -@@ -6005,20 +6006,20 @@ static void kvm_recover_nx_lpages(struct kvm *kvm) - struct kvm_mmu_page, - lpage_disallowed_link); - WARN_ON_ONCE(!sp->lpage_disallowed); -- if (sp->tdp_mmu_page) -- kvm_tdp_mmu_zap_gfn_range(kvm, sp->gfn, -- sp->gfn + KVM_PAGES_PER_HPAGE(sp->role.level)); -- else { -+ if (sp->tdp_mmu_page) { -+ flush |= kvm_tdp_mmu_zap_sp(kvm, sp); -+ } else { - kvm_mmu_prepare_zap_page(kvm, sp, &invalid_list); - WARN_ON_ONCE(sp->lpage_disallowed); - } - - if (need_resched() || spin_needbreak(&kvm->mmu_lock)) { -- kvm_mmu_commit_zap_page(kvm, &invalid_list); -+ kvm_mmu_remote_flush_or_zap(kvm, &invalid_list, flush); - cond_resched_lock(&kvm->mmu_lock); -+ flush = false; - } - } -- kvm_mmu_commit_zap_page(kvm, &invalid_list); -+ kvm_mmu_remote_flush_or_zap(kvm, &invalid_list, flush); - - spin_unlock(&kvm->mmu_lock); - srcu_read_unlock(&kvm->srcu, rcu_idx); -diff --git a/arch/x86/kvm/mmu/tdp_iter.c b/arch/x86/kvm/mmu/tdp_iter.c -index 87b7e16911dbb..1a09d212186b3 100644 ---- a/arch/x86/kvm/mmu/tdp_iter.c -+++ b/arch/x86/kvm/mmu/tdp_iter.c -@@ -22,21 +22,22 @@ static gfn_t round_gfn_for_level(gfn_t gfn, int level) - - /* - * Sets a TDP iterator to walk a pre-order traversal of the paging structure -- * rooted at root_pt, starting with the walk to translate goal_gfn. -+ * rooted at root_pt, starting with the walk to translate next_last_level_gfn. - */ - void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level, -- int min_level, gfn_t goal_gfn) -+ int min_level, gfn_t next_last_level_gfn) - { - WARN_ON(root_level < 1); - WARN_ON(root_level > PT64_ROOT_MAX_LEVEL); - -- iter->goal_gfn = goal_gfn; -+ iter->next_last_level_gfn = next_last_level_gfn; -+ iter->yielded_gfn = iter->next_last_level_gfn; - iter->root_level = root_level; - iter->min_level = min_level; - iter->level = root_level; - iter->pt_path[iter->level - 1] = root_pt; - -- iter->gfn = round_gfn_for_level(iter->goal_gfn, iter->level); -+ iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level); - tdp_iter_refresh_sptep(iter); - - iter->valid = true; -@@ -82,7 +83,7 @@ static bool try_step_down(struct tdp_iter *iter) - - iter->level--; - iter->pt_path[iter->level - 1] = child_pt; -- iter->gfn = round_gfn_for_level(iter->goal_gfn, iter->level); -+ iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level); - tdp_iter_refresh_sptep(iter); - - return true; -@@ -106,7 +107,7 @@ static bool try_step_side(struct tdp_iter *iter) - return false; - - iter->gfn += KVM_PAGES_PER_HPAGE(iter->level); -- iter->goal_gfn = iter->gfn; -+ iter->next_last_level_gfn = iter->gfn; - iter->sptep++; - iter->old_spte = READ_ONCE(*iter->sptep); - -@@ -158,23 +159,6 @@ void tdp_iter_next(struct tdp_iter *iter) - iter->valid = false; - } - --/* -- * Restart the walk over the paging structure from the root, starting from the -- * highest gfn the iterator had previously reached. Assumes that the entire -- * paging structure, except the root page, may have been completely torn down -- * and rebuilt. -- */ --void tdp_iter_refresh_walk(struct tdp_iter *iter) --{ -- gfn_t goal_gfn = iter->goal_gfn; -- -- if (iter->gfn > goal_gfn) -- goal_gfn = iter->gfn; -- -- tdp_iter_start(iter, iter->pt_path[iter->root_level - 1], -- iter->root_level, iter->min_level, goal_gfn); --} -- - u64 *tdp_iter_root_pt(struct tdp_iter *iter) - { - return iter->pt_path[iter->root_level - 1]; -diff --git a/arch/x86/kvm/mmu/tdp_iter.h b/arch/x86/kvm/mmu/tdp_iter.h -index 47170d0dc98e5..d480c540ee27d 100644 ---- a/arch/x86/kvm/mmu/tdp_iter.h -+++ b/arch/x86/kvm/mmu/tdp_iter.h -@@ -15,7 +15,13 @@ struct tdp_iter { - * The iterator will traverse the paging structure towards the mapping - * for this GFN. - */ -- gfn_t goal_gfn; -+ gfn_t next_last_level_gfn; -+ /* -+ * The next_last_level_gfn at the time when the thread last -+ * yielded. Only yielding when the next_last_level_gfn != -+ * yielded_gfn helps ensure forward progress. -+ */ -+ gfn_t yielded_gfn; - /* Pointers to the page tables traversed to reach the current SPTE */ - u64 *pt_path[PT64_ROOT_MAX_LEVEL]; - /* A pointer to the current SPTE */ -@@ -52,9 +58,8 @@ struct tdp_iter { - u64 *spte_to_child_pt(u64 pte, int level); - - void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level, -- int min_level, gfn_t goal_gfn); -+ int min_level, gfn_t next_last_level_gfn); - void tdp_iter_next(struct tdp_iter *iter); --void tdp_iter_refresh_walk(struct tdp_iter *iter); - u64 *tdp_iter_root_pt(struct tdp_iter *iter); - - #endif /* __KVM_X86_MMU_TDP_ITER_H */ -diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c -index 17976998bffbc..a16559f31d946 100644 ---- a/arch/x86/kvm/mmu/tdp_mmu.c -+++ b/arch/x86/kvm/mmu/tdp_mmu.c -@@ -105,7 +105,7 @@ bool is_tdp_mmu_root(struct kvm *kvm, hpa_t hpa) - } - - static bool zap_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, -- gfn_t start, gfn_t end, bool can_yield); -+ gfn_t start, gfn_t end, bool can_yield, bool flush); - - void kvm_tdp_mmu_free_root(struct kvm *kvm, struct kvm_mmu_page *root) - { -@@ -118,7 +118,7 @@ void kvm_tdp_mmu_free_root(struct kvm *kvm, struct kvm_mmu_page *root) - - list_del(&root->link); - -- zap_gfn_range(kvm, root, 0, max_gfn, false); -+ zap_gfn_range(kvm, root, 0, max_gfn, false, false); - - free_page((unsigned long)root->spt); - kmem_cache_free(mmu_page_header_cache, root); -@@ -413,27 +413,43 @@ static inline void tdp_mmu_set_spte_no_dirty_log(struct kvm *kvm, - _mmu->shadow_root_level, _start, _end) - - /* -- * Flush the TLB if the process should drop kvm->mmu_lock. -- * Return whether the caller still needs to flush the tlb. -+ * Yield if the MMU lock is contended or this thread needs to return control -+ * to the scheduler. -+ * -+ * If this function should yield and flush is set, it will perform a remote -+ * TLB flush before yielding. -+ * -+ * If this function yields, it will also reset the tdp_iter's walk over the -+ * paging structure and the calling function should skip to the next -+ * iteration to allow the iterator to continue its traversal from the -+ * paging structure root. -+ * -+ * Return true if this function yielded and the iterator's traversal was reset. -+ * Return false if a yield was not needed. - */ --static bool tdp_mmu_iter_flush_cond_resched(struct kvm *kvm, struct tdp_iter *iter) -+static inline bool tdp_mmu_iter_cond_resched(struct kvm *kvm, -+ struct tdp_iter *iter, bool flush) - { -- if (need_resched() || spin_needbreak(&kvm->mmu_lock)) { -- kvm_flush_remote_tlbs(kvm); -- cond_resched_lock(&kvm->mmu_lock); -- tdp_iter_refresh_walk(iter); -+ /* Ensure forward progress has been made before yielding. */ -+ if (iter->next_last_level_gfn == iter->yielded_gfn) - return false; -- } else { -- return true; -- } --} - --static void tdp_mmu_iter_cond_resched(struct kvm *kvm, struct tdp_iter *iter) --{ - if (need_resched() || spin_needbreak(&kvm->mmu_lock)) { -+ if (flush) -+ kvm_flush_remote_tlbs(kvm); -+ - cond_resched_lock(&kvm->mmu_lock); -- tdp_iter_refresh_walk(iter); -+ -+ WARN_ON(iter->gfn > iter->next_last_level_gfn); -+ -+ tdp_iter_start(iter, iter->pt_path[iter->root_level - 1], -+ iter->root_level, iter->min_level, -+ iter->next_last_level_gfn); -+ -+ return true; - } -+ -+ return false; - } - - /* -@@ -445,15 +461,22 @@ static void tdp_mmu_iter_cond_resched(struct kvm *kvm, struct tdp_iter *iter) - * scheduler needs the CPU or there is contention on the MMU lock. If this - * function cannot yield, it will not release the MMU lock or reschedule and - * the caller must ensure it does not supply too large a GFN range, or the -- * operation can cause a soft lockup. -+ * operation can cause a soft lockup. Note, in some use cases a flush may be -+ * required by prior actions. Ensure the pending flush is performed prior to -+ * yielding. - */ - static bool zap_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, -- gfn_t start, gfn_t end, bool can_yield) -+ gfn_t start, gfn_t end, bool can_yield, bool flush) - { - struct tdp_iter iter; -- bool flush_needed = false; - - tdp_root_for_each_pte(iter, root, start, end) { -+ if (can_yield && -+ tdp_mmu_iter_cond_resched(kvm, &iter, flush)) { -+ flush = false; -+ continue; -+ } -+ - if (!is_shadow_present_pte(iter.old_spte)) - continue; - -@@ -468,13 +491,10 @@ static bool zap_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, - continue; - - tdp_mmu_set_spte(kvm, &iter, 0); -- -- if (can_yield) -- flush_needed = tdp_mmu_iter_flush_cond_resched(kvm, &iter); -- else -- flush_needed = true; -+ flush = true; - } -- return flush_needed; -+ -+ return flush; - } - - /* -@@ -483,13 +503,14 @@ static bool zap_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, - * SPTEs have been cleared and a TLB flush is needed before releasing the - * MMU lock. - */ --bool kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, gfn_t end) -+bool __kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, gfn_t end, -+ bool can_yield) - { - struct kvm_mmu_page *root; - bool flush = false; - - for_each_tdp_mmu_root_yield_safe(kvm, root) -- flush |= zap_gfn_range(kvm, root, start, end, true); -+ flush = zap_gfn_range(kvm, root, start, end, can_yield, flush); - - return flush; - } -@@ -683,7 +704,7 @@ static int zap_gfn_range_hva_wrapper(struct kvm *kvm, - struct kvm_mmu_page *root, gfn_t start, - gfn_t end, unsigned long unused) - { -- return zap_gfn_range(kvm, root, start, end, false); -+ return zap_gfn_range(kvm, root, start, end, false, false); - } - - int kvm_tdp_mmu_zap_hva_range(struct kvm *kvm, unsigned long start, -@@ -836,6 +857,9 @@ static bool wrprot_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, - - for_each_tdp_pte_min_level(iter, root->spt, root->role.level, - min_level, start, end) { -+ if (tdp_mmu_iter_cond_resched(kvm, &iter, false)) -+ continue; -+ - if (!is_shadow_present_pte(iter.old_spte) || - !is_last_spte(iter.old_spte, iter.level)) - continue; -@@ -844,8 +868,6 @@ static bool wrprot_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, - - tdp_mmu_set_spte_no_dirty_log(kvm, &iter, new_spte); - spte_set = true; -- -- tdp_mmu_iter_cond_resched(kvm, &iter); - } - return spte_set; - } -@@ -889,6 +911,9 @@ static bool clear_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, - bool spte_set = false; - - tdp_root_for_each_leaf_pte(iter, root, start, end) { -+ if (tdp_mmu_iter_cond_resched(kvm, &iter, false)) -+ continue; -+ - if (spte_ad_need_write_protect(iter.old_spte)) { - if (is_writable_pte(iter.old_spte)) - new_spte = iter.old_spte & ~PT_WRITABLE_MASK; -@@ -903,8 +928,6 @@ static bool clear_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, - - tdp_mmu_set_spte_no_dirty_log(kvm, &iter, new_spte); - spte_set = true; -- -- tdp_mmu_iter_cond_resched(kvm, &iter); - } - return spte_set; - } -@@ -1012,6 +1035,9 @@ static bool set_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, - bool spte_set = false; - - tdp_root_for_each_pte(iter, root, start, end) { -+ if (tdp_mmu_iter_cond_resched(kvm, &iter, false)) -+ continue; -+ - if (!is_shadow_present_pte(iter.old_spte)) - continue; - -@@ -1019,8 +1045,6 @@ static bool set_dirty_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root, - - tdp_mmu_set_spte(kvm, &iter, new_spte); - spte_set = true; -- -- tdp_mmu_iter_cond_resched(kvm, &iter); - } - - return spte_set; -@@ -1061,6 +1085,11 @@ static void zap_collapsible_spte_range(struct kvm *kvm, - bool spte_set = false; - - tdp_root_for_each_pte(iter, root, start, end) { -+ if (tdp_mmu_iter_cond_resched(kvm, &iter, spte_set)) { -+ spte_set = false; -+ continue; -+ } -+ - if (!is_shadow_present_pte(iter.old_spte) || - !is_last_spte(iter.old_spte, iter.level)) - continue; -@@ -1073,7 +1102,7 @@ static void zap_collapsible_spte_range(struct kvm *kvm, - - tdp_mmu_set_spte(kvm, &iter, 0); - -- spte_set = tdp_mmu_iter_flush_cond_resched(kvm, &iter); -+ spte_set = true; - } - - if (spte_set) -diff --git a/arch/x86/kvm/mmu/tdp_mmu.h b/arch/x86/kvm/mmu/tdp_mmu.h -index cbbdbadd1526f..a7a3f6db263d2 100644 ---- a/arch/x86/kvm/mmu/tdp_mmu.h -+++ b/arch/x86/kvm/mmu/tdp_mmu.h -@@ -12,7 +12,23 @@ bool is_tdp_mmu_root(struct kvm *kvm, hpa_t root); - hpa_t kvm_tdp_mmu_get_vcpu_root_hpa(struct kvm_vcpu *vcpu); - void kvm_tdp_mmu_free_root(struct kvm *kvm, struct kvm_mmu_page *root); - --bool kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, gfn_t end); -+bool __kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, gfn_t end, -+ bool can_yield); -+static inline bool kvm_tdp_mmu_zap_gfn_range(struct kvm *kvm, gfn_t start, -+ gfn_t end) -+{ -+ return __kvm_tdp_mmu_zap_gfn_range(kvm, start, end, true); -+} -+static inline bool kvm_tdp_mmu_zap_sp(struct kvm *kvm, struct kvm_mmu_page *sp) -+{ -+ gfn_t end = sp->gfn + KVM_PAGES_PER_HPAGE(sp->role.level); -+ -+ /* -+ * Don't allow yielding, as the caller may have pending pages to zap -+ * on the shadow MMU. -+ */ -+ return __kvm_tdp_mmu_zap_gfn_range(kvm, sp->gfn, end, false); -+} - void kvm_tdp_mmu_zap_all(struct kvm *kvm); - - int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, gpa_t gpa, u32 error_code, -diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c -index 768a6b4d23680..4e2d76b8b697e 100644 ---- a/drivers/acpi/processor_idle.c -+++ b/drivers/acpi/processor_idle.c -@@ -544,9 +544,7 @@ static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) - return -ENODEV; - - #if defined(CONFIG_X86) && defined(CONFIG_HOTPLUG_CPU) -- /* If NMI wants to wake up CPU0, start CPU0. */ -- if (wakeup_cpu0()) -- start_cpu0(); -+ cond_wakeup_cpu0(); - #endif - } - -diff --git a/drivers/base/dd.c b/drivers/base/dd.c -index e2cf3b29123e8..37a5e5f8b2219 100644 ---- a/drivers/base/dd.c -+++ b/drivers/base/dd.c -@@ -292,14 +292,16 @@ int driver_deferred_probe_check_state(struct device *dev) - - static void deferred_probe_timeout_work_func(struct work_struct *work) - { -- struct device_private *private, *p; -+ struct device_private *p; - - driver_deferred_probe_timeout = 0; - driver_deferred_probe_trigger(); - flush_work(&deferred_probe_work); - -- list_for_each_entry_safe(private, p, &deferred_probe_pending_list, deferred_probe) -- dev_info(private->device, "deferred probe pending\n"); -+ mutex_lock(&deferred_probe_mutex); -+ list_for_each_entry(p, &deferred_probe_pending_list, deferred_probe) -+ dev_info(p->device, "deferred probe pending\n"); -+ mutex_unlock(&deferred_probe_mutex); - wake_up_all(&probe_timeout_waitqueue); - } - static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func); -diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig -index a086dd34f932f..4f501e4842ab3 100644 ---- a/drivers/char/agp/Kconfig -+++ b/drivers/char/agp/Kconfig -@@ -125,7 +125,7 @@ config AGP_HP_ZX1 - - config AGP_PARISC - tristate "HP Quicksilver AGP support" -- depends on AGP && PARISC && 64BIT -+ depends on AGP && PARISC && 64BIT && IOMMU_SBA - help - This option gives you AGP GART support for the HP Quicksilver - AGP bus adapter on HP PA-RISC machines (Ok, just on the C8000 -diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c -index 8c1d04db990d5..571ae066e548b 100644 ---- a/drivers/clk/clk.c -+++ b/drivers/clk/clk.c -@@ -4336,20 +4336,19 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb) - /* search the list of notifiers for this clk */ - list_for_each_entry(cn, &clk_notifier_list, node) - if (cn->clk == clk) -- break; -+ goto found; - - /* if clk wasn't in the notifier list, allocate new clk_notifier */ -- if (cn->clk != clk) { -- cn = kzalloc(sizeof(*cn), GFP_KERNEL); -- if (!cn) -- goto out; -+ cn = kzalloc(sizeof(*cn), GFP_KERNEL); -+ if (!cn) -+ goto out; - -- cn->clk = clk; -- srcu_init_notifier_head(&cn->notifier_head); -+ cn->clk = clk; -+ srcu_init_notifier_head(&cn->notifier_head); - -- list_add(&cn->node, &clk_notifier_list); -- } -+ list_add(&cn->node, &clk_notifier_list); - -+found: - ret = srcu_notifier_chain_register(&cn->notifier_head, nb); - - clk->core->notifier_count++; -@@ -4374,32 +4373,28 @@ EXPORT_SYMBOL_GPL(clk_notifier_register); - */ - int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb) - { -- struct clk_notifier *cn = NULL; -- int ret = -EINVAL; -+ struct clk_notifier *cn; -+ int ret = -ENOENT; - - if (!clk || !nb) - return -EINVAL; - - clk_prepare_lock(); - -- list_for_each_entry(cn, &clk_notifier_list, node) -- if (cn->clk == clk) -- break; -- -- if (cn->clk == clk) { -- ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb); -+ list_for_each_entry(cn, &clk_notifier_list, node) { -+ if (cn->clk == clk) { -+ ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb); - -- clk->core->notifier_count--; -+ clk->core->notifier_count--; - -- /* XXX the notifier code should handle this better */ -- if (!cn->notifier_head.head) { -- srcu_cleanup_notifier_head(&cn->notifier_head); -- list_del(&cn->node); -- kfree(cn); -+ /* XXX the notifier code should handle this better */ -+ if (!cn->notifier_head.head) { -+ srcu_cleanup_notifier_head(&cn->notifier_head); -+ list_del(&cn->node); -+ kfree(cn); -+ } -+ break; - } -- -- } else { -- ret = -ENOENT; - } - - clk_prepare_unlock(); -diff --git a/drivers/clk/qcom/camcc-sc7180.c b/drivers/clk/qcom/camcc-sc7180.c -index dbac5651ab855..9bcf2f8ed4de1 100644 ---- a/drivers/clk/qcom/camcc-sc7180.c -+++ b/drivers/clk/qcom/camcc-sc7180.c -@@ -304,7 +304,7 @@ static struct clk_rcg2 cam_cc_bps_clk_src = { - .name = "cam_cc_bps_clk_src", - .parent_data = cam_cc_parent_data_2, - .num_parents = 5, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -325,7 +325,7 @@ static struct clk_rcg2 cam_cc_cci_0_clk_src = { - .name = "cam_cc_cci_0_clk_src", - .parent_data = cam_cc_parent_data_5, - .num_parents = 3, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -339,7 +339,7 @@ static struct clk_rcg2 cam_cc_cci_1_clk_src = { - .name = "cam_cc_cci_1_clk_src", - .parent_data = cam_cc_parent_data_5, - .num_parents = 3, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -360,7 +360,7 @@ static struct clk_rcg2 cam_cc_cphy_rx_clk_src = { - .name = "cam_cc_cphy_rx_clk_src", - .parent_data = cam_cc_parent_data_3, - .num_parents = 6, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -379,7 +379,7 @@ static struct clk_rcg2 cam_cc_csi0phytimer_clk_src = { - .name = "cam_cc_csi0phytimer_clk_src", - .parent_data = cam_cc_parent_data_0, - .num_parents = 4, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -393,7 +393,7 @@ static struct clk_rcg2 cam_cc_csi1phytimer_clk_src = { - .name = "cam_cc_csi1phytimer_clk_src", - .parent_data = cam_cc_parent_data_0, - .num_parents = 4, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -407,7 +407,7 @@ static struct clk_rcg2 cam_cc_csi2phytimer_clk_src = { - .name = "cam_cc_csi2phytimer_clk_src", - .parent_data = cam_cc_parent_data_0, - .num_parents = 4, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -421,7 +421,7 @@ static struct clk_rcg2 cam_cc_csi3phytimer_clk_src = { - .name = "cam_cc_csi3phytimer_clk_src", - .parent_data = cam_cc_parent_data_0, - .num_parents = 4, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -443,7 +443,7 @@ static struct clk_rcg2 cam_cc_fast_ahb_clk_src = { - .name = "cam_cc_fast_ahb_clk_src", - .parent_data = cam_cc_parent_data_0, - .num_parents = 4, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -466,7 +466,7 @@ static struct clk_rcg2 cam_cc_icp_clk_src = { - .name = "cam_cc_icp_clk_src", - .parent_data = cam_cc_parent_data_2, - .num_parents = 5, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -488,7 +488,7 @@ static struct clk_rcg2 cam_cc_ife_0_clk_src = { - .name = "cam_cc_ife_0_clk_src", - .parent_data = cam_cc_parent_data_4, - .num_parents = 4, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -510,7 +510,7 @@ static struct clk_rcg2 cam_cc_ife_0_csid_clk_src = { - .name = "cam_cc_ife_0_csid_clk_src", - .parent_data = cam_cc_parent_data_3, - .num_parents = 6, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -524,7 +524,7 @@ static struct clk_rcg2 cam_cc_ife_1_clk_src = { - .name = "cam_cc_ife_1_clk_src", - .parent_data = cam_cc_parent_data_4, - .num_parents = 4, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -538,7 +538,7 @@ static struct clk_rcg2 cam_cc_ife_1_csid_clk_src = { - .name = "cam_cc_ife_1_csid_clk_src", - .parent_data = cam_cc_parent_data_3, - .num_parents = 6, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -553,7 +553,7 @@ static struct clk_rcg2 cam_cc_ife_lite_clk_src = { - .parent_data = cam_cc_parent_data_4, - .num_parents = 4, - .flags = CLK_SET_RATE_PARENT, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -567,7 +567,7 @@ static struct clk_rcg2 cam_cc_ife_lite_csid_clk_src = { - .name = "cam_cc_ife_lite_csid_clk_src", - .parent_data = cam_cc_parent_data_3, - .num_parents = 6, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -590,7 +590,7 @@ static struct clk_rcg2 cam_cc_ipe_0_clk_src = { - .name = "cam_cc_ipe_0_clk_src", - .parent_data = cam_cc_parent_data_2, - .num_parents = 5, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -613,7 +613,7 @@ static struct clk_rcg2 cam_cc_jpeg_clk_src = { - .name = "cam_cc_jpeg_clk_src", - .parent_data = cam_cc_parent_data_2, - .num_parents = 5, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -635,7 +635,7 @@ static struct clk_rcg2 cam_cc_lrme_clk_src = { - .name = "cam_cc_lrme_clk_src", - .parent_data = cam_cc_parent_data_6, - .num_parents = 5, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -656,7 +656,7 @@ static struct clk_rcg2 cam_cc_mclk0_clk_src = { - .name = "cam_cc_mclk0_clk_src", - .parent_data = cam_cc_parent_data_1, - .num_parents = 3, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -670,7 +670,7 @@ static struct clk_rcg2 cam_cc_mclk1_clk_src = { - .name = "cam_cc_mclk1_clk_src", - .parent_data = cam_cc_parent_data_1, - .num_parents = 3, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -684,7 +684,7 @@ static struct clk_rcg2 cam_cc_mclk2_clk_src = { - .name = "cam_cc_mclk2_clk_src", - .parent_data = cam_cc_parent_data_1, - .num_parents = 3, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -698,7 +698,7 @@ static struct clk_rcg2 cam_cc_mclk3_clk_src = { - .name = "cam_cc_mclk3_clk_src", - .parent_data = cam_cc_parent_data_1, - .num_parents = 3, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -712,7 +712,7 @@ static struct clk_rcg2 cam_cc_mclk4_clk_src = { - .name = "cam_cc_mclk4_clk_src", - .parent_data = cam_cc_parent_data_1, - .num_parents = 3, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -@@ -732,7 +732,7 @@ static struct clk_rcg2 cam_cc_slow_ahb_clk_src = { - .parent_data = cam_cc_parent_data_0, - .num_parents = 4, - .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, -- .ops = &clk_rcg2_ops, -+ .ops = &clk_rcg2_shared_ops, - }, - }; - -diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c -index 43ecd507bf836..cf94a12459ea4 100644 ---- a/drivers/clk/socfpga/clk-gate.c -+++ b/drivers/clk/socfpga/clk-gate.c -@@ -99,7 +99,7 @@ static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk, - val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift; - val &= GENMASK(socfpgaclk->width - 1, 0); - /* Check for GPIO_DB_CLK by its offset */ -- if ((int) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET) -+ if ((uintptr_t) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET) - div = val + 1; - else - div = (1 << val); -diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c -index a4a47305574cb..c85fdc78fcc92 100644 ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -365,22 +365,18 @@ static int gpiochip_set_desc_names(struct gpio_chip *gc) - * - * Looks for device property "gpio-line-names" and if it exists assigns - * GPIO line names for the chip. The memory allocated for the assigned -- * names belong to the underlying software node and should not be released -+ * names belong to the underlying firmware node and should not be released - * by the caller. - */ - static int devprop_gpiochip_set_names(struct gpio_chip *chip) - { - struct gpio_device *gdev = chip->gpiodev; -- struct device *dev = chip->parent; -+ struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev); - const char **names; - int ret, i; - int count; - -- /* GPIO chip may not have a parent device whose properties we inspect. */ -- if (!dev) -- return 0; -- -- count = device_property_string_array_count(dev, "gpio-line-names"); -+ count = fwnode_property_string_array_count(fwnode, "gpio-line-names"); - if (count < 0) - return 0; - -@@ -394,7 +390,7 @@ static int devprop_gpiochip_set_names(struct gpio_chip *chip) - if (!names) - return -ENOMEM; - -- ret = device_property_read_string_array(dev, "gpio-line-names", -+ ret = fwnode_property_read_string_array(fwnode, "gpio-line-names", - names, count); - if (ret < 0) { - dev_warn(&gdev->dev, "failed to read GPIO line names\n"); -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c -index 4d8f19ab10144..8b87991a0470a 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c -@@ -907,7 +907,7 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_bo_device *bdev, - - /* Allocate an SG array and squash pages into it */ - r = sg_alloc_table_from_pages(ttm->sg, ttm->pages, ttm->num_pages, 0, -- ttm->num_pages << PAGE_SHIFT, -+ (u64)ttm->num_pages << PAGE_SHIFT, - GFP_KERNEL); - if (r) - goto release_sg; -diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c -index c9b1437811053..c22956e8773d7 100644 ---- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c -+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c -@@ -1224,7 +1224,8 @@ static int smu7_enable_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) - (hwmgr->chip_id == CHIP_POLARIS10) || - (hwmgr->chip_id == CHIP_POLARIS11) || - (hwmgr->chip_id == CHIP_POLARIS12) || -- (hwmgr->chip_id == CHIP_TONGA)) -+ (hwmgr->chip_id == CHIP_TONGA) || -+ (hwmgr->chip_id == CHIP_TOPAZ)) - PHM_WRITE_FIELD(hwmgr->device, MC_SEQ_CNTL_3, CAC_EN, 0x1); - - -diff --git a/drivers/gpu/drm/i915/display/intel_acpi.c b/drivers/gpu/drm/i915/display/intel_acpi.c -index e21fb14d5e07b..833d0c1be4f1d 100644 ---- a/drivers/gpu/drm/i915/display/intel_acpi.c -+++ b/drivers/gpu/drm/i915/display/intel_acpi.c -@@ -84,13 +84,31 @@ static void intel_dsm_platform_mux_info(acpi_handle dhandle) - return; - } - -+ if (!pkg->package.count) { -+ DRM_DEBUG_DRIVER("no connection in _DSM\n"); -+ return; -+ } -+ - connector_count = &pkg->package.elements[0]; - DRM_DEBUG_DRIVER("MUX info connectors: %lld\n", - (unsigned long long)connector_count->integer.value); - for (i = 1; i < pkg->package.count; i++) { - union acpi_object *obj = &pkg->package.elements[i]; -- union acpi_object *connector_id = &obj->package.elements[0]; -- union acpi_object *info = &obj->package.elements[1]; -+ union acpi_object *connector_id; -+ union acpi_object *info; -+ -+ if (obj->type != ACPI_TYPE_PACKAGE || obj->package.count < 2) { -+ DRM_DEBUG_DRIVER("Invalid object for MUX #%d\n", i); -+ continue; -+ } -+ -+ connector_id = &obj->package.elements[0]; -+ info = &obj->package.elements[1]; -+ if (info->type != ACPI_TYPE_BUFFER || info->buffer.length < 4) { -+ DRM_DEBUG_DRIVER("Invalid info for MUX obj #%d\n", i); -+ continue; -+ } -+ - DRM_DEBUG_DRIVER("Connector id: 0x%016llx\n", - (unsigned long long)connector_id->integer.value); - DRM_DEBUG_DRIVER(" port id: %s\n", -diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c -index e7a8442b59afd..a676811ef69d2 100644 ---- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c -+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c -@@ -566,17 +566,17 @@ static bool a6xx_ucode_check_version(struct a6xx_gpu *a6xx_gpu, - } else { - /* - * a650 tier targets don't need whereami but still need to be -- * equal to or newer than 1.95 for other security fixes -+ * equal to or newer than 0.95 for other security fixes - */ - if (adreno_is_a650(adreno_gpu)) { -- if ((buf[0] & 0xfff) >= 0x195) { -+ if ((buf[0] & 0xfff) >= 0x095) { - ret = true; - goto out; - } - - DRM_DEV_ERROR(&gpu->pdev->dev, - "a650 SQE ucode is too old. Have version %x need at least %x\n", -- buf[0] & 0xfff, 0x195); -+ buf[0] & 0xfff, 0x095); - } - - /* -diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c -index 8981cfa9dbc37..92e6f1b947386 100644 ---- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c -+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c -@@ -496,7 +496,9 @@ static void dpu_hw_ctl_intf_cfg_v1(struct dpu_hw_ctl *ctx, - - DPU_REG_WRITE(c, CTL_TOP, mode_sel); - DPU_REG_WRITE(c, CTL_INTF_ACTIVE, intf_active); -- DPU_REG_WRITE(c, CTL_MERGE_3D_ACTIVE, BIT(cfg->merge_3d - MERGE_3D_0)); -+ if (cfg->merge_3d) -+ DPU_REG_WRITE(c, CTL_MERGE_3D_ACTIVE, -+ BIT(cfg->merge_3d - MERGE_3D_0)); - } - - static void dpu_hw_ctl_intf_cfg(struct dpu_hw_ctl *ctx, -diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c -index a5c6b8c233366..196907689c82e 100644 ---- a/drivers/gpu/drm/msm/msm_drv.c -+++ b/drivers/gpu/drm/msm/msm_drv.c -@@ -570,6 +570,7 @@ err_free_priv: - kfree(priv); - err_put_drm_dev: - drm_dev_put(ddev); -+ platform_set_drvdata(pdev, NULL); - return ret; - } - -diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c -index 23195d5d4e919..176cb55062be6 100644 ---- a/drivers/gpu/drm/radeon/radeon_ttm.c -+++ b/drivers/gpu/drm/radeon/radeon_ttm.c -@@ -365,7 +365,7 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_bo_device *bdev, struct ttm_tt * - if (gtt->userflags & RADEON_GEM_USERPTR_ANONONLY) { - /* check that we only pin down anonymous memory - to prevent problems with writeback */ -- unsigned long end = gtt->userptr + ttm->num_pages * PAGE_SIZE; -+ unsigned long end = gtt->userptr + (u64)ttm->num_pages * PAGE_SIZE; - struct vm_area_struct *vma; - vma = find_vma(gtt->usermm, gtt->userptr); - if (!vma || vma->vm_file || vma->vm_end < end) -@@ -387,7 +387,7 @@ static int radeon_ttm_tt_pin_userptr(struct ttm_bo_device *bdev, struct ttm_tt * - } while (pinned < ttm->num_pages); - - r = sg_alloc_table_from_pages(ttm->sg, ttm->pages, ttm->num_pages, 0, -- ttm->num_pages << PAGE_SHIFT, -+ (u64)ttm->num_pages << PAGE_SHIFT, - GFP_KERNEL); - if (r) - goto release_sg; -diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c -index ea710beb8e005..351c601f0ddbb 100644 ---- a/drivers/gpu/drm/vc4/vc4_crtc.c -+++ b/drivers/gpu/drm/vc4/vc4_crtc.c -@@ -210,6 +210,7 @@ static u32 vc4_get_fifo_full_level(struct vc4_crtc *vc4_crtc, u32 format) - { - const struct vc4_crtc_data *crtc_data = vc4_crtc_to_vc4_crtc_data(vc4_crtc); - const struct vc4_pv_data *pv_data = vc4_crtc_to_vc4_pv_data(vc4_crtc); -+ struct vc4_dev *vc4 = to_vc4_dev(vc4_crtc->base.dev); - u32 fifo_len_bytes = pv_data->fifo_depth; - - /* -@@ -238,6 +239,22 @@ static u32 vc4_get_fifo_full_level(struct vc4_crtc *vc4_crtc, u32 format) - if (crtc_data->hvs_output == 5) - return 32; - -+ /* -+ * It looks like in some situations, we will overflow -+ * the PixelValve FIFO (with the bit 10 of PV stat being -+ * set) and stall the HVS / PV, eventually resulting in -+ * a page flip timeout. -+ * -+ * Displaying the video overlay during a playback with -+ * Kodi on an RPi3 seems to be a great solution with a -+ * failure rate around 50%. -+ * -+ * Removing 1 from the FIFO full level however -+ * seems to completely remove that issue. -+ */ -+ if (!vc4->hvs->hvs5) -+ return fifo_len_bytes - 3 * HVS_FIFO_LATENCY_PIX - 1; -+ - return fifo_len_bytes - 3 * HVS_FIFO_LATENCY_PIX; - } - } -diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c -index d6425ad6e6a38..2871cf2ee8b44 100644 ---- a/drivers/i2c/busses/i2c-designware-master.c -+++ b/drivers/i2c/busses/i2c-designware-master.c -@@ -129,6 +129,7 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) - if ((comp_param1 & DW_IC_COMP_PARAM_1_SPEED_MODE_MASK) - != DW_IC_COMP_PARAM_1_SPEED_MODE_HIGH) { - dev_err(dev->dev, "High Speed not supported!\n"); -+ t->bus_freq_hz = I2C_MAX_FAST_MODE_FREQ; - dev->master_cfg &= ~DW_IC_CON_SPEED_MASK; - dev->master_cfg |= DW_IC_CON_SPEED_FAST; - dev->hs_hcnt = 0; -diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c -index cb4a25ebb8900..2a946c2079284 100644 ---- a/drivers/i2c/busses/i2c-jz4780.c -+++ b/drivers/i2c/busses/i2c-jz4780.c -@@ -526,8 +526,8 @@ static irqreturn_t jz4780_i2c_irq(int irqno, void *dev_id) - i2c_sta = jz4780_i2c_readw(i2c, JZ4780_I2C_STA); - data = *i2c->wbuf; - data &= ~JZ4780_I2C_DC_READ; -- if ((!i2c->stop_hold) && (i2c->cdata->version >= -- ID_X1000)) -+ if ((i2c->wt_len == 1) && (!i2c->stop_hold) && -+ (i2c->cdata->version >= ID_X1000)) - data |= X1000_I2C_DC_STOP; - jz4780_i2c_writew(i2c, JZ4780_I2C_DC, data); - i2c->wbuf++; -diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c -index 63ebf722a4248..f21362355973e 100644 ---- a/drivers/i2c/i2c-core-base.c -+++ b/drivers/i2c/i2c-core-base.c -@@ -378,7 +378,7 @@ static int i2c_gpio_init_recovery(struct i2c_adapter *adap) - static int i2c_init_recovery(struct i2c_adapter *adap) - { - struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; -- char *err_str; -+ char *err_str, *err_level = KERN_ERR; - - if (!bri) - return 0; -@@ -387,7 +387,8 @@ static int i2c_init_recovery(struct i2c_adapter *adap) - return -EPROBE_DEFER; - - if (!bri->recover_bus) { -- err_str = "no recover_bus() found"; -+ err_str = "no suitable method provided"; -+ err_level = KERN_DEBUG; - goto err; - } - -@@ -414,7 +415,7 @@ static int i2c_init_recovery(struct i2c_adapter *adap) - - return 0; - err: -- dev_err(&adap->dev, "Not using recovery: %s\n", err_str); -+ dev_printk(err_level, &adap->dev, "Not using recovery: %s\n", err_str); - adap->bus_recovery_info = NULL; - - return -EINVAL; -diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c -index 0abce004a9591..65e3e7df8a4b0 100644 ---- a/drivers/infiniband/core/addr.c -+++ b/drivers/infiniband/core/addr.c -@@ -76,7 +76,9 @@ static struct workqueue_struct *addr_wq; - - static const struct nla_policy ib_nl_addr_policy[LS_NLA_TYPE_MAX] = { - [LS_NLA_TYPE_DGID] = {.type = NLA_BINARY, -- .len = sizeof(struct rdma_nla_ls_gid)}, -+ .len = sizeof(struct rdma_nla_ls_gid), -+ .validation_type = NLA_VALIDATE_MIN, -+ .min = sizeof(struct rdma_nla_ls_gid)}, - }; - - static inline bool ib_nl_is_good_ip_resp(const struct nlmsghdr *nlh) -diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c -index 81903749d2415..e42c812e74c3c 100644 ---- a/drivers/infiniband/hw/cxgb4/cm.c -+++ b/drivers/infiniband/hw/cxgb4/cm.c -@@ -3616,7 +3616,8 @@ int c4iw_destroy_listen(struct iw_cm_id *cm_id) - c4iw_init_wr_wait(ep->com.wr_waitp); - err = cxgb4_remove_server( - ep->com.dev->rdev.lldi.ports[0], ep->stid, -- ep->com.dev->rdev.lldi.rxq_ids[0], true); -+ ep->com.dev->rdev.lldi.rxq_ids[0], -+ ep->com.local_addr.ss_family == AF_INET6); - if (err) - goto done; - err = c4iw_wait_for_reply(&ep->com.dev->rdev, ep->com.wr_waitp, -diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c -index 2a91b8d95e12f..04b1e8f021f64 100644 ---- a/drivers/infiniband/hw/hfi1/affinity.c -+++ b/drivers/infiniband/hw/hfi1/affinity.c -@@ -632,22 +632,11 @@ static void _dev_comp_vect_cpu_mask_clean_up(struct hfi1_devdata *dd, - */ - int hfi1_dev_affinity_init(struct hfi1_devdata *dd) - { -- int node = pcibus_to_node(dd->pcidev->bus); - struct hfi1_affinity_node *entry; - const struct cpumask *local_mask; - int curr_cpu, possible, i, ret; - bool new_entry = false; - -- /* -- * If the BIOS does not have the NUMA node information set, select -- * NUMA 0 so we get consistent performance. -- */ -- if (node < 0) { -- dd_dev_err(dd, "Invalid PCI NUMA node. Performance may be affected\n"); -- node = 0; -- } -- dd->node = node; -- - local_mask = cpumask_of_node(dd->node); - if (cpumask_first(local_mask) >= nr_cpu_ids) - local_mask = topology_core_cpumask(0); -@@ -660,7 +649,7 @@ int hfi1_dev_affinity_init(struct hfi1_devdata *dd) - * create an entry in the global affinity structure and initialize it. - */ - if (!entry) { -- entry = node_affinity_allocate(node); -+ entry = node_affinity_allocate(dd->node); - if (!entry) { - dd_dev_err(dd, - "Unable to allocate global affinity node\n"); -@@ -751,6 +740,7 @@ int hfi1_dev_affinity_init(struct hfi1_devdata *dd) - if (new_entry) - node_affinity_add_tail(entry); - -+ dd->affinity_entry = entry; - mutex_unlock(&node_affinity.lock); - - return 0; -@@ -766,10 +756,9 @@ void hfi1_dev_affinity_clean_up(struct hfi1_devdata *dd) - { - struct hfi1_affinity_node *entry; - -- if (dd->node < 0) -- return; -- - mutex_lock(&node_affinity.lock); -+ if (!dd->affinity_entry) -+ goto unlock; - entry = node_affinity_lookup(dd->node); - if (!entry) - goto unlock; -@@ -780,8 +769,8 @@ void hfi1_dev_affinity_clean_up(struct hfi1_devdata *dd) - */ - _dev_comp_vect_cpu_mask_clean_up(dd, entry); - unlock: -+ dd->affinity_entry = NULL; - mutex_unlock(&node_affinity.lock); -- dd->node = NUMA_NO_NODE; - } - - /* -diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h -index e09e8244a94c4..2a9a040569ebb 100644 ---- a/drivers/infiniband/hw/hfi1/hfi.h -+++ b/drivers/infiniband/hw/hfi1/hfi.h -@@ -1409,6 +1409,7 @@ struct hfi1_devdata { - spinlock_t irq_src_lock; - int vnic_num_vports; - struct net_device *dummy_netdev; -+ struct hfi1_affinity_node *affinity_entry; - - /* Keeps track of IPoIB RSM rule users */ - atomic_t ipoib_rsm_usr_num; -diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c -index cb7ad12888219..786c6316273f7 100644 ---- a/drivers/infiniband/hw/hfi1/init.c -+++ b/drivers/infiniband/hw/hfi1/init.c -@@ -1277,7 +1277,6 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, - dd->pport = (struct hfi1_pportdata *)(dd + 1); - dd->pcidev = pdev; - pci_set_drvdata(pdev, dd); -- dd->node = NUMA_NO_NODE; - - ret = xa_alloc_irq(&hfi1_dev_table, &dd->unit, dd, xa_limit_32b, - GFP_KERNEL); -@@ -1287,6 +1286,15 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, - goto bail; - } - rvt_set_ibdev_name(&dd->verbs_dev.rdi, "%s_%d", class_name(), dd->unit); -+ /* -+ * If the BIOS does not have the NUMA node information set, select -+ * NUMA 0 so we get consistent performance. -+ */ -+ dd->node = pcibus_to_node(pdev->bus); -+ if (dd->node == NUMA_NO_NODE) { -+ dd_dev_err(dd, "Invalid PCI NUMA node. Performance may be affected\n"); -+ dd->node = 0; -+ } - - /* - * Initialize all locks for the device. This needs to be as early as -diff --git a/drivers/infiniband/hw/hfi1/netdev_rx.c b/drivers/infiniband/hw/hfi1/netdev_rx.c -index 6d263c9749b36..ea95baada2b6b 100644 ---- a/drivers/infiniband/hw/hfi1/netdev_rx.c -+++ b/drivers/infiniband/hw/hfi1/netdev_rx.c -@@ -173,8 +173,7 @@ u32 hfi1_num_netdev_contexts(struct hfi1_devdata *dd, u32 available_contexts, - return 0; - } - -- cpumask_and(node_cpu_mask, cpu_mask, -- cpumask_of_node(pcibus_to_node(dd->pcidev->bus))); -+ cpumask_and(node_cpu_mask, cpu_mask, cpumask_of_node(dd->node)); - - available_cpus = cpumask_weight(node_cpu_mask); - -diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c -index 0eb6a7a618e07..9ea542270ed4a 100644 ---- a/drivers/infiniband/hw/qedr/verbs.c -+++ b/drivers/infiniband/hw/qedr/verbs.c -@@ -1244,7 +1244,8 @@ static int qedr_check_qp_attrs(struct ib_pd *ibpd, struct qedr_dev *dev, - * TGT QP isn't associated with RQ/SQ - */ - if ((attrs->qp_type != IB_QPT_GSI) && (dev->gsi_qp_created) && -- (attrs->qp_type != IB_QPT_XRC_TGT)) { -+ (attrs->qp_type != IB_QPT_XRC_TGT) && -+ (attrs->qp_type != IB_QPT_XRC_INI)) { - struct qedr_cq *send_cq = get_qedr_cq(attrs->send_cq); - struct qedr_cq *recv_cq = get_qedr_cq(attrs->recv_cq); - -diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c -index 394c1f6822b90..ee37c5af3a8c9 100644 ---- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c -+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c -@@ -2735,8 +2735,8 @@ void rtrs_clt_close(struct rtrs_clt *clt) - - /* Now it is safe to iterate over all paths without locks */ - list_for_each_entry_safe(sess, tmp, &clt->paths_list, s.entry) { -- rtrs_clt_destroy_sess_files(sess, NULL); - rtrs_clt_close_conns(sess, true); -+ rtrs_clt_destroy_sess_files(sess, NULL); - kobject_put(&sess->kobj); - } - free_clt(clt); -diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c -index 25859d16d06f8..e7be36dc2159a 100644 ---- a/drivers/net/can/spi/mcp251x.c -+++ b/drivers/net/can/spi/mcp251x.c -@@ -314,6 +314,18 @@ static int mcp251x_spi_trans(struct spi_device *spi, int len) - return ret; - } - -+static int mcp251x_spi_write(struct spi_device *spi, int len) -+{ -+ struct mcp251x_priv *priv = spi_get_drvdata(spi); -+ int ret; -+ -+ ret = spi_write(spi, priv->spi_tx_buf, len); -+ if (ret) -+ dev_err(&spi->dev, "spi write failed: ret = %d\n", ret); -+ -+ return ret; -+} -+ - static u8 mcp251x_read_reg(struct spi_device *spi, u8 reg) - { - struct mcp251x_priv *priv = spi_get_drvdata(spi); -@@ -361,7 +373,7 @@ static void mcp251x_write_reg(struct spi_device *spi, u8 reg, u8 val) - priv->spi_tx_buf[1] = reg; - priv->spi_tx_buf[2] = val; - -- mcp251x_spi_trans(spi, 3); -+ mcp251x_spi_write(spi, 3); - } - - static void mcp251x_write_2regs(struct spi_device *spi, u8 reg, u8 v1, u8 v2) -@@ -373,7 +385,7 @@ static void mcp251x_write_2regs(struct spi_device *spi, u8 reg, u8 v1, u8 v2) - priv->spi_tx_buf[2] = v1; - priv->spi_tx_buf[3] = v2; - -- mcp251x_spi_trans(spi, 4); -+ mcp251x_spi_write(spi, 4); - } - - static void mcp251x_write_bits(struct spi_device *spi, u8 reg, -@@ -386,7 +398,7 @@ static void mcp251x_write_bits(struct spi_device *spi, u8 reg, - priv->spi_tx_buf[2] = mask; - priv->spi_tx_buf[3] = val; - -- mcp251x_spi_trans(spi, 4); -+ mcp251x_spi_write(spi, 4); - } - - static u8 mcp251x_read_stat(struct spi_device *spi) -@@ -618,7 +630,7 @@ static void mcp251x_hw_tx_frame(struct spi_device *spi, u8 *buf, - buf[i]); - } else { - memcpy(priv->spi_tx_buf, buf, TXBDAT_OFF + len); -- mcp251x_spi_trans(spi, TXBDAT_OFF + len); -+ mcp251x_spi_write(spi, TXBDAT_OFF + len); - } - } - -@@ -650,7 +662,7 @@ static void mcp251x_hw_tx(struct spi_device *spi, struct can_frame *frame, - - /* use INSTRUCTION_RTS, to avoid "repeated frame problem" */ - priv->spi_tx_buf[0] = INSTRUCTION_RTS(1 << tx_buf_idx); -- mcp251x_spi_trans(priv->spi, 1); -+ mcp251x_spi_write(priv->spi, 1); - } - - static void mcp251x_hw_rx_frame(struct spi_device *spi, u8 *buf, -@@ -888,7 +900,7 @@ static int mcp251x_hw_reset(struct spi_device *spi) - mdelay(MCP251X_OST_DELAY_MS); - - priv->spi_tx_buf[0] = INSTRUCTION_RESET; -- ret = mcp251x_spi_trans(spi, 1); -+ ret = mcp251x_spi_write(spi, 1); - if (ret) - return ret; - -diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c -index 251835ea15aa7..18c7d8c151a40 100644 ---- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c -+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c -@@ -857,7 +857,7 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, - if (dev->adapter->dev_set_bus) { - err = dev->adapter->dev_set_bus(dev, 0); - if (err) -- goto lbl_unregister_candev; -+ goto adap_dev_free; - } - - /* get device number early */ -@@ -869,6 +869,10 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, - - return 0; - -+adap_dev_free: -+ if (dev->adapter->dev_free) -+ dev->adapter->dev_free(dev); -+ - lbl_unregister_candev: - unregister_candev(netdev); - -diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c -index 662e68a0e7e61..93c7fa1fd4cb6 100644 ---- a/drivers/net/dsa/lantiq_gswip.c -+++ b/drivers/net/dsa/lantiq_gswip.c -@@ -93,8 +93,12 @@ - - /* GSWIP MII Registers */ - #define GSWIP_MII_CFGp(p) (0x2 * (p)) -+#define GSWIP_MII_CFG_RESET BIT(15) - #define GSWIP_MII_CFG_EN BIT(14) -+#define GSWIP_MII_CFG_ISOLATE BIT(13) - #define GSWIP_MII_CFG_LDCLKDIS BIT(12) -+#define GSWIP_MII_CFG_RGMII_IBS BIT(8) -+#define GSWIP_MII_CFG_RMII_CLK BIT(7) - #define GSWIP_MII_CFG_MODE_MIIP 0x0 - #define GSWIP_MII_CFG_MODE_MIIM 0x1 - #define GSWIP_MII_CFG_MODE_RMIIP 0x2 -@@ -190,6 +194,23 @@ - #define GSWIP_PCE_DEFPVID(p) (0x486 + ((p) * 0xA)) - - #define GSWIP_MAC_FLEN 0x8C5 -+#define GSWIP_MAC_CTRL_0p(p) (0x903 + ((p) * 0xC)) -+#define GSWIP_MAC_CTRL_0_PADEN BIT(8) -+#define GSWIP_MAC_CTRL_0_FCS_EN BIT(7) -+#define GSWIP_MAC_CTRL_0_FCON_MASK 0x0070 -+#define GSWIP_MAC_CTRL_0_FCON_AUTO 0x0000 -+#define GSWIP_MAC_CTRL_0_FCON_RX 0x0010 -+#define GSWIP_MAC_CTRL_0_FCON_TX 0x0020 -+#define GSWIP_MAC_CTRL_0_FCON_RXTX 0x0030 -+#define GSWIP_MAC_CTRL_0_FCON_NONE 0x0040 -+#define GSWIP_MAC_CTRL_0_FDUP_MASK 0x000C -+#define GSWIP_MAC_CTRL_0_FDUP_AUTO 0x0000 -+#define GSWIP_MAC_CTRL_0_FDUP_EN 0x0004 -+#define GSWIP_MAC_CTRL_0_FDUP_DIS 0x000C -+#define GSWIP_MAC_CTRL_0_GMII_MASK 0x0003 -+#define GSWIP_MAC_CTRL_0_GMII_AUTO 0x0000 -+#define GSWIP_MAC_CTRL_0_GMII_MII 0x0001 -+#define GSWIP_MAC_CTRL_0_GMII_RGMII 0x0002 - #define GSWIP_MAC_CTRL_2p(p) (0x905 + ((p) * 0xC)) - #define GSWIP_MAC_CTRL_2_MLEN BIT(3) /* Maximum Untagged Frame Lnegth */ - -@@ -653,16 +674,13 @@ static int gswip_port_enable(struct dsa_switch *ds, int port, - GSWIP_SDMA_PCTRLp(port)); - - if (!dsa_is_cpu_port(ds, port)) { -- u32 macconf = GSWIP_MDIO_PHY_LINK_AUTO | -- GSWIP_MDIO_PHY_SPEED_AUTO | -- GSWIP_MDIO_PHY_FDUP_AUTO | -- GSWIP_MDIO_PHY_FCONTX_AUTO | -- GSWIP_MDIO_PHY_FCONRX_AUTO | -- (phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK); -- -- gswip_mdio_w(priv, macconf, GSWIP_MDIO_PHYp(port)); -- /* Activate MDIO auto polling */ -- gswip_mdio_mask(priv, 0, BIT(port), GSWIP_MDIO_MDC_CFG0); -+ u32 mdio_phy = 0; -+ -+ if (phydev) -+ mdio_phy = phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK; -+ -+ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_ADDR_MASK, mdio_phy, -+ GSWIP_MDIO_PHYp(port)); - } - - return 0; -@@ -675,14 +693,6 @@ static void gswip_port_disable(struct dsa_switch *ds, int port) - if (!dsa_is_user_port(ds, port)) - return; - -- if (!dsa_is_cpu_port(ds, port)) { -- gswip_mdio_mask(priv, GSWIP_MDIO_PHY_LINK_DOWN, -- GSWIP_MDIO_PHY_LINK_MASK, -- GSWIP_MDIO_PHYp(port)); -- /* Deactivate MDIO auto polling */ -- gswip_mdio_mask(priv, BIT(port), 0, GSWIP_MDIO_MDC_CFG0); -- } -- - gswip_switch_mask(priv, GSWIP_FDMA_PCTRL_EN, 0, - GSWIP_FDMA_PCTRLp(port)); - gswip_switch_mask(priv, GSWIP_SDMA_PCTRL_EN, 0, -@@ -806,14 +816,32 @@ static int gswip_setup(struct dsa_switch *ds) - gswip_switch_w(priv, BIT(cpu_port), GSWIP_PCE_PMAP2); - gswip_switch_w(priv, BIT(cpu_port), GSWIP_PCE_PMAP3); - -- /* disable PHY auto polling */ -+ /* Deactivate MDIO PHY auto polling. Some PHYs as the AR8030 have an -+ * interoperability problem with this auto polling mechanism because -+ * their status registers think that the link is in a different state -+ * than it actually is. For the AR8030 it has the BMSR_ESTATEN bit set -+ * as well as ESTATUS_1000_TFULL and ESTATUS_1000_XFULL. This makes the -+ * auto polling state machine consider the link being negotiated with -+ * 1Gbit/s. Since the PHY itself is a Fast Ethernet RMII PHY this leads -+ * to the switch port being completely dead (RX and TX are both not -+ * working). -+ * Also with various other PHY / port combinations (PHY11G GPHY, PHY22F -+ * GPHY, external RGMII PEF7071/7072) any traffic would stop. Sometimes -+ * it would work fine for a few minutes to hours and then stop, on -+ * other device it would no traffic could be sent or received at all. -+ * Testing shows that when PHY auto polling is disabled these problems -+ * go away. -+ */ - gswip_mdio_w(priv, 0x0, GSWIP_MDIO_MDC_CFG0); -+ - /* Configure the MDIO Clock 2.5 MHz */ - gswip_mdio_mask(priv, 0xff, 0x09, GSWIP_MDIO_MDC_CFG1); - -- /* Disable the xMII link */ -+ /* Disable the xMII interface and clear it's isolation bit */ - for (i = 0; i < priv->hw_info->max_ports; i++) -- gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, i); -+ gswip_mii_mask_cfg(priv, -+ GSWIP_MII_CFG_EN | GSWIP_MII_CFG_ISOLATE, -+ 0, i); - - /* enable special tag insertion on cpu port */ - gswip_switch_mask(priv, 0, GSWIP_FDMA_PCTRL_STEN, -@@ -1464,6 +1492,112 @@ unsupported: - return; - } - -+static void gswip_port_set_link(struct gswip_priv *priv, int port, bool link) -+{ -+ u32 mdio_phy; -+ -+ if (link) -+ mdio_phy = GSWIP_MDIO_PHY_LINK_UP; -+ else -+ mdio_phy = GSWIP_MDIO_PHY_LINK_DOWN; -+ -+ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_LINK_MASK, mdio_phy, -+ GSWIP_MDIO_PHYp(port)); -+} -+ -+static void gswip_port_set_speed(struct gswip_priv *priv, int port, int speed, -+ phy_interface_t interface) -+{ -+ u32 mdio_phy = 0, mii_cfg = 0, mac_ctrl_0 = 0; -+ -+ switch (speed) { -+ case SPEED_10: -+ mdio_phy = GSWIP_MDIO_PHY_SPEED_M10; -+ -+ if (interface == PHY_INTERFACE_MODE_RMII) -+ mii_cfg = GSWIP_MII_CFG_RATE_M50; -+ else -+ mii_cfg = GSWIP_MII_CFG_RATE_M2P5; -+ -+ mac_ctrl_0 = GSWIP_MAC_CTRL_0_GMII_MII; -+ break; -+ -+ case SPEED_100: -+ mdio_phy = GSWIP_MDIO_PHY_SPEED_M100; -+ -+ if (interface == PHY_INTERFACE_MODE_RMII) -+ mii_cfg = GSWIP_MII_CFG_RATE_M50; -+ else -+ mii_cfg = GSWIP_MII_CFG_RATE_M25; -+ -+ mac_ctrl_0 = GSWIP_MAC_CTRL_0_GMII_MII; -+ break; -+ -+ case SPEED_1000: -+ mdio_phy = GSWIP_MDIO_PHY_SPEED_G1; -+ -+ mii_cfg = GSWIP_MII_CFG_RATE_M125; -+ -+ mac_ctrl_0 = GSWIP_MAC_CTRL_0_GMII_RGMII; -+ break; -+ } -+ -+ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_SPEED_MASK, mdio_phy, -+ GSWIP_MDIO_PHYp(port)); -+ gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_RATE_MASK, mii_cfg, port); -+ gswip_switch_mask(priv, GSWIP_MAC_CTRL_0_GMII_MASK, mac_ctrl_0, -+ GSWIP_MAC_CTRL_0p(port)); -+} -+ -+static void gswip_port_set_duplex(struct gswip_priv *priv, int port, int duplex) -+{ -+ u32 mac_ctrl_0, mdio_phy; -+ -+ if (duplex == DUPLEX_FULL) { -+ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FDUP_EN; -+ mdio_phy = GSWIP_MDIO_PHY_FDUP_EN; -+ } else { -+ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FDUP_DIS; -+ mdio_phy = GSWIP_MDIO_PHY_FDUP_DIS; -+ } -+ -+ gswip_switch_mask(priv, GSWIP_MAC_CTRL_0_FDUP_MASK, mac_ctrl_0, -+ GSWIP_MAC_CTRL_0p(port)); -+ gswip_mdio_mask(priv, GSWIP_MDIO_PHY_FDUP_MASK, mdio_phy, -+ GSWIP_MDIO_PHYp(port)); -+} -+ -+static void gswip_port_set_pause(struct gswip_priv *priv, int port, -+ bool tx_pause, bool rx_pause) -+{ -+ u32 mac_ctrl_0, mdio_phy; -+ -+ if (tx_pause && rx_pause) { -+ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_RXTX; -+ mdio_phy = GSWIP_MDIO_PHY_FCONTX_EN | -+ GSWIP_MDIO_PHY_FCONRX_EN; -+ } else if (tx_pause) { -+ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_TX; -+ mdio_phy = GSWIP_MDIO_PHY_FCONTX_EN | -+ GSWIP_MDIO_PHY_FCONRX_DIS; -+ } else if (rx_pause) { -+ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_RX; -+ mdio_phy = GSWIP_MDIO_PHY_FCONTX_DIS | -+ GSWIP_MDIO_PHY_FCONRX_EN; -+ } else { -+ mac_ctrl_0 = GSWIP_MAC_CTRL_0_FCON_NONE; -+ mdio_phy = GSWIP_MDIO_PHY_FCONTX_DIS | -+ GSWIP_MDIO_PHY_FCONRX_DIS; -+ } -+ -+ gswip_switch_mask(priv, GSWIP_MAC_CTRL_0_FCON_MASK, -+ mac_ctrl_0, GSWIP_MAC_CTRL_0p(port)); -+ gswip_mdio_mask(priv, -+ GSWIP_MDIO_PHY_FCONTX_MASK | -+ GSWIP_MDIO_PHY_FCONRX_MASK, -+ mdio_phy, GSWIP_MDIO_PHYp(port)); -+} -+ - static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, - unsigned int mode, - const struct phylink_link_state *state) -@@ -1483,6 +1617,9 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, - break; - case PHY_INTERFACE_MODE_RMII: - miicfg |= GSWIP_MII_CFG_MODE_RMIIM; -+ -+ /* Configure the RMII clock as output: */ -+ miicfg |= GSWIP_MII_CFG_RMII_CLK; - break; - case PHY_INTERFACE_MODE_RGMII: - case PHY_INTERFACE_MODE_RGMII_ID: -@@ -1495,7 +1632,11 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, - "Unsupported interface: %d\n", state->interface); - return; - } -- gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_MODE_MASK, miicfg, port); -+ -+ gswip_mii_mask_cfg(priv, -+ GSWIP_MII_CFG_MODE_MASK | GSWIP_MII_CFG_RMII_CLK | -+ GSWIP_MII_CFG_RGMII_IBS | GSWIP_MII_CFG_LDCLKDIS, -+ miicfg, port); - - switch (state->interface) { - case PHY_INTERFACE_MODE_RGMII_ID: -@@ -1520,6 +1661,9 @@ static void gswip_phylink_mac_link_down(struct dsa_switch *ds, int port, - struct gswip_priv *priv = ds->priv; - - gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, port); -+ -+ if (!dsa_is_cpu_port(ds, port)) -+ gswip_port_set_link(priv, port, false); - } - - static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port, -@@ -1531,6 +1675,13 @@ static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port, - { - struct gswip_priv *priv = ds->priv; - -+ if (!dsa_is_cpu_port(ds, port)) { -+ gswip_port_set_link(priv, port, true); -+ gswip_port_set_speed(priv, port, speed, interface); -+ gswip_port_set_duplex(priv, port, duplex); -+ gswip_port_set_pause(priv, port, tx_pause, rx_pause); -+ } -+ - gswip_mii_mask_cfg(priv, 0, GSWIP_MII_CFG_EN, port); - } - -diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h -index ba8321ec1ee73..3305979a9f7c1 100644 ---- a/drivers/net/ethernet/amd/xgbe/xgbe.h -+++ b/drivers/net/ethernet/amd/xgbe/xgbe.h -@@ -180,9 +180,9 @@ - #define XGBE_DMA_SYS_AWCR 0x30303030 - - /* DMA cache settings - PCI device */ --#define XGBE_DMA_PCI_ARCR 0x00000003 --#define XGBE_DMA_PCI_AWCR 0x13131313 --#define XGBE_DMA_PCI_AWARCR 0x00000313 -+#define XGBE_DMA_PCI_ARCR 0x000f0f0f -+#define XGBE_DMA_PCI_AWCR 0x0f0f0f0f -+#define XGBE_DMA_PCI_AWARCR 0x00000f0f - - /* DMA channel interrupt modes */ - #define XGBE_IRQ_MODE_EDGE 0 -diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c -index 07cdb38e7d118..fbedbceef2d1b 100644 ---- a/drivers/net/ethernet/cadence/macb_main.c -+++ b/drivers/net/ethernet/cadence/macb_main.c -@@ -3235,6 +3235,9 @@ static void gem_prog_cmp_regs(struct macb *bp, struct ethtool_rx_flow_spec *fs) - bool cmp_b = false; - bool cmp_c = false; - -+ if (!macb_is_gem(bp)) -+ return; -+ - tp4sp_v = &(fs->h_u.tcp_ip4_spec); - tp4sp_m = &(fs->m_u.tcp_ip4_spec); - -@@ -3603,6 +3606,7 @@ static void macb_restore_features(struct macb *bp) - { - struct net_device *netdev = bp->dev; - netdev_features_t features = netdev->features; -+ struct ethtool_rx_fs_item *item; - - /* TX checksum offload */ - macb_set_txcsum_feature(bp, features); -@@ -3611,6 +3615,9 @@ static void macb_restore_features(struct macb *bp) - macb_set_rxcsum_feature(bp, features); - - /* RX Flow Filters */ -+ list_for_each_entry(item, &bp->rx_fs_list.list, list) -+ gem_prog_cmp_regs(bp, &item->fs); -+ - macb_set_rxflow_feature(bp, features); - } - -diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c -index 75474f8102490..c5b0e725b2382 100644 ---- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c -+++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c -@@ -1794,11 +1794,25 @@ int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init, - struct cudbg_buffer temp_buff = { 0 }; - struct sge_qbase_reg_field *sge_qbase; - struct ireg_buf *ch_sge_dbg; -+ u8 padap_running = 0; - int i, rc; -+ u32 size; - -- rc = cudbg_get_buff(pdbg_init, dbg_buff, -- sizeof(*ch_sge_dbg) * 2 + sizeof(*sge_qbase), -- &temp_buff); -+ /* Accessing SGE_QBASE_MAP[0-3] and SGE_QBASE_INDEX regs can -+ * lead to SGE missing doorbells under heavy traffic. So, only -+ * collect them when adapter is idle. -+ */ -+ for_each_port(padap, i) { -+ padap_running = netif_running(padap->port[i]); -+ if (padap_running) -+ break; -+ } -+ -+ size = sizeof(*ch_sge_dbg) * 2; -+ if (!padap_running) -+ size += sizeof(*sge_qbase); -+ -+ rc = cudbg_get_buff(pdbg_init, dbg_buff, size, &temp_buff); - if (rc) - return rc; - -@@ -1820,7 +1834,8 @@ int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init, - ch_sge_dbg++; - } - -- if (CHELSIO_CHIP_VERSION(padap->params.chip) > CHELSIO_T5) { -+ if (CHELSIO_CHIP_VERSION(padap->params.chip) > CHELSIO_T5 && -+ !padap_running) { - sge_qbase = (struct sge_qbase_reg_field *)ch_sge_dbg; - /* 1 addr reg SGE_QBASE_INDEX and 4 data reg - * SGE_QBASE_MAP[0-3] -diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c -index 98d01a7497ecd..581670dced6ec 100644 ---- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c -+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c -@@ -2090,7 +2090,8 @@ void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size) - 0x1190, 0x1194, - 0x11a0, 0x11a4, - 0x11b0, 0x11b4, -- 0x11fc, 0x1274, -+ 0x11fc, 0x123c, -+ 0x1254, 0x1274, - 0x1280, 0x133c, - 0x1800, 0x18fc, - 0x3000, 0x302c, -diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c -index 4fab2ee5bbf58..e4d9c4c640e55 100644 ---- a/drivers/net/ethernet/freescale/gianfar.c -+++ b/drivers/net/ethernet/freescale/gianfar.c -@@ -364,7 +364,11 @@ static void gfar_set_mac_for_addr(struct net_device *dev, int num, - - static int gfar_set_mac_addr(struct net_device *dev, void *p) - { -- eth_mac_addr(dev, p); -+ int ret; -+ -+ ret = eth_mac_addr(dev, p); -+ if (ret) -+ return ret; - - gfar_set_mac_for_addr(dev, 0, dev->dev_addr); - -diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -index 674b3a22e91fe..3bd7bc7946771 100644 ---- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c -@@ -2575,14 +2575,14 @@ static int hclgevf_ae_start(struct hnae3_handle *handle) - { - struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); - -+ clear_bit(HCLGEVF_STATE_DOWN, &hdev->state); -+ - hclgevf_reset_tqp_stats(handle); - - hclgevf_request_link_info(hdev); - - hclgevf_update_link_mode(hdev); - -- clear_bit(HCLGEVF_STATE_DOWN, &hdev->state); -- - return 0; - } - -diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h -index 118473dfdcbd2..fe1258778cbc4 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e.h -+++ b/drivers/net/ethernet/intel/i40e/i40e.h -@@ -142,6 +142,7 @@ enum i40e_state_t { - __I40E_VIRTCHNL_OP_PENDING, - __I40E_RECOVERY_MODE, - __I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */ -+ __I40E_VFS_RELEASING, - /* This must be last as it determines the size of the BITMAP */ - __I40E_STATE_SIZE__, - }; -diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c -index d7c13ca9be7dd..d627b59ad4465 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c -@@ -578,6 +578,9 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, - case RING_TYPE_XDP: - ring = kmemdup(vsi->xdp_rings[ring_id], sizeof(*ring), GFP_KERNEL); - break; -+ default: -+ ring = NULL; -+ break; - } - if (!ring) - return; -diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c -index 9e81f85ee2d8d..31d48a85cfaf0 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c -@@ -232,6 +232,8 @@ static void __i40e_add_stat_strings(u8 **p, const struct i40e_stats stats[], - I40E_STAT(struct i40e_vsi, _name, _stat) - #define I40E_VEB_STAT(_name, _stat) \ - I40E_STAT(struct i40e_veb, _name, _stat) -+#define I40E_VEB_TC_STAT(_name, _stat) \ -+ I40E_STAT(struct i40e_cp_veb_tc_stats, _name, _stat) - #define I40E_PFC_STAT(_name, _stat) \ - I40E_STAT(struct i40e_pfc_stats, _name, _stat) - #define I40E_QUEUE_STAT(_name, _stat) \ -@@ -266,11 +268,18 @@ static const struct i40e_stats i40e_gstrings_veb_stats[] = { - I40E_VEB_STAT("veb.rx_unknown_protocol", stats.rx_unknown_protocol), - }; - -+struct i40e_cp_veb_tc_stats { -+ u64 tc_rx_packets; -+ u64 tc_rx_bytes; -+ u64 tc_tx_packets; -+ u64 tc_tx_bytes; -+}; -+ - static const struct i40e_stats i40e_gstrings_veb_tc_stats[] = { -- I40E_VEB_STAT("veb.tc_%u_tx_packets", tc_stats.tc_tx_packets), -- I40E_VEB_STAT("veb.tc_%u_tx_bytes", tc_stats.tc_tx_bytes), -- I40E_VEB_STAT("veb.tc_%u_rx_packets", tc_stats.tc_rx_packets), -- I40E_VEB_STAT("veb.tc_%u_rx_bytes", tc_stats.tc_rx_bytes), -+ I40E_VEB_TC_STAT("veb.tc_%u_tx_packets", tc_tx_packets), -+ I40E_VEB_TC_STAT("veb.tc_%u_tx_bytes", tc_tx_bytes), -+ I40E_VEB_TC_STAT("veb.tc_%u_rx_packets", tc_rx_packets), -+ I40E_VEB_TC_STAT("veb.tc_%u_rx_bytes", tc_rx_bytes), - }; - - static const struct i40e_stats i40e_gstrings_misc_stats[] = { -@@ -1101,6 +1110,7 @@ static int i40e_get_link_ksettings(struct net_device *netdev, - - /* Set flow control settings */ - ethtool_link_ksettings_add_link_mode(ks, supported, Pause); -+ ethtool_link_ksettings_add_link_mode(ks, supported, Asym_Pause); - - switch (hw->fc.requested_mode) { - case I40E_FC_FULL: -@@ -2216,6 +2226,29 @@ static int i40e_get_sset_count(struct net_device *netdev, int sset) - } - } - -+/** -+ * i40e_get_veb_tc_stats - copy VEB TC statistics to formatted structure -+ * @tc: the TC statistics in VEB structure (veb->tc_stats) -+ * @i: the index of traffic class in (veb->tc_stats) structure to copy -+ * -+ * Copy VEB TC statistics from structure of arrays (veb->tc_stats) to -+ * one dimensional structure i40e_cp_veb_tc_stats. -+ * Produce formatted i40e_cp_veb_tc_stats structure of the VEB TC -+ * statistics for the given TC. -+ **/ -+static struct i40e_cp_veb_tc_stats -+i40e_get_veb_tc_stats(struct i40e_veb_tc_stats *tc, unsigned int i) -+{ -+ struct i40e_cp_veb_tc_stats veb_tc = { -+ .tc_rx_packets = tc->tc_rx_packets[i], -+ .tc_rx_bytes = tc->tc_rx_bytes[i], -+ .tc_tx_packets = tc->tc_tx_packets[i], -+ .tc_tx_bytes = tc->tc_tx_bytes[i], -+ }; -+ -+ return veb_tc; -+} -+ - /** - * i40e_get_pfc_stats - copy HW PFC statistics to formatted structure - * @pf: the PF device structure -@@ -2300,8 +2333,16 @@ static void i40e_get_ethtool_stats(struct net_device *netdev, - i40e_gstrings_veb_stats); - - for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) -- i40e_add_ethtool_stats(&data, veb_stats ? veb : NULL, -- i40e_gstrings_veb_tc_stats); -+ if (veb_stats) { -+ struct i40e_cp_veb_tc_stats veb_tc = -+ i40e_get_veb_tc_stats(&veb->tc_stats, i); -+ -+ i40e_add_ethtool_stats(&data, &veb_tc, -+ i40e_gstrings_veb_tc_stats); -+ } else { -+ i40e_add_ethtool_stats(&data, NULL, -+ i40e_gstrings_veb_tc_stats); -+ } - - i40e_add_ethtool_stats(&data, pf, i40e_gstrings_stats); - -@@ -5244,7 +5285,7 @@ static int i40e_get_module_eeprom(struct net_device *netdev, - - status = i40e_aq_get_phy_register(hw, - I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE, -- true, addr, offset, &value, NULL); -+ addr, true, offset, &value, NULL); - if (status) - return -EIO; - data[i] = value; -diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c -index 4a2d03cada01e..7fab60128c76d 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_main.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c -@@ -2560,8 +2560,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) - i40e_stat_str(hw, aq_ret), - i40e_aq_str(hw, hw->aq.asq_last_status)); - } else { -- dev_info(&pf->pdev->dev, "%s is %s allmulti mode.\n", -- vsi->netdev->name, -+ dev_info(&pf->pdev->dev, "%s allmulti mode.\n", - cur_multipromisc ? "entering" : "leaving"); - } - } -@@ -14647,12 +14646,16 @@ static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw) - * in order to register the netdev - */ - v_idx = i40e_vsi_mem_alloc(pf, I40E_VSI_MAIN); -- if (v_idx < 0) -+ if (v_idx < 0) { -+ err = v_idx; - goto err_switch_setup; -+ } - pf->lan_vsi = v_idx; - vsi = pf->vsi[v_idx]; -- if (!vsi) -+ if (!vsi) { -+ err = -EFAULT; - goto err_switch_setup; -+ } - vsi->alloc_queue_pairs = 1; - err = i40e_config_netdev(vsi); - if (err) -diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c -index 903d4e8cb0a11..92ce835bc79e3 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c -@@ -2198,8 +2198,7 @@ int i40e_xmit_xdp_tx_ring(struct xdp_buff *xdp, struct i40e_ring *xdp_ring) - * @rx_ring: Rx ring being processed - * @xdp: XDP buffer containing the frame - **/ --static struct sk_buff *i40e_run_xdp(struct i40e_ring *rx_ring, -- struct xdp_buff *xdp) -+static int i40e_run_xdp(struct i40e_ring *rx_ring, struct xdp_buff *xdp) - { - int err, result = I40E_XDP_PASS; - struct i40e_ring *xdp_ring; -@@ -2238,7 +2237,7 @@ static struct sk_buff *i40e_run_xdp(struct i40e_ring *rx_ring, - } - xdp_out: - rcu_read_unlock(); -- return ERR_PTR(-result); -+ return result; - } - - /** -@@ -2350,6 +2349,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) - unsigned int xdp_xmit = 0; - bool failure = false; - struct xdp_buff xdp; -+ int xdp_res = 0; - - #if (PAGE_SIZE < 8192) - xdp.frame_sz = i40e_rx_frame_truesize(rx_ring, 0); -@@ -2416,12 +2416,10 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) - /* At larger PAGE_SIZE, frame_sz depend on len size */ - xdp.frame_sz = i40e_rx_frame_truesize(rx_ring, size); - #endif -- skb = i40e_run_xdp(rx_ring, &xdp); -+ xdp_res = i40e_run_xdp(rx_ring, &xdp); - } - -- if (IS_ERR(skb)) { -- unsigned int xdp_res = -PTR_ERR(skb); -- -+ if (xdp_res) { - if (xdp_res & (I40E_XDP_TX | I40E_XDP_REDIR)) { - xdp_xmit |= xdp_res; - i40e_rx_buffer_flip(rx_ring, rx_buffer, size); -diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c -index 1b6ec9be155a6..5d301a466f5c5 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c -@@ -137,6 +137,7 @@ void i40e_vc_notify_vf_reset(struct i40e_vf *vf) - **/ - static inline void i40e_vc_disable_vf(struct i40e_vf *vf) - { -+ struct i40e_pf *pf = vf->pf; - int i; - - i40e_vc_notify_vf_reset(vf); -@@ -147,6 +148,11 @@ static inline void i40e_vc_disable_vf(struct i40e_vf *vf) - * ensure a reset. - */ - for (i = 0; i < 20; i++) { -+ /* If PF is in VFs releasing state reset VF is impossible, -+ * so leave it. -+ */ -+ if (test_bit(__I40E_VFS_RELEASING, pf->state)) -+ return; - if (i40e_reset_vf(vf, false)) - return; - usleep_range(10000, 20000); -@@ -1574,6 +1580,8 @@ void i40e_free_vfs(struct i40e_pf *pf) - - if (!pf->vf) - return; -+ -+ set_bit(__I40E_VFS_RELEASING, pf->state); - while (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) - usleep_range(1000, 2000); - -@@ -1631,6 +1639,7 @@ void i40e_free_vfs(struct i40e_pf *pf) - } - } - clear_bit(__I40E_VF_DISABLE, pf->state); -+ clear_bit(__I40E_VFS_RELEASING, pf->state); - } - - #ifdef CONFIG_PCI_IOV -diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c -index 37a21fb999221..7949f6b79f92f 100644 ---- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c -+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c -@@ -462,7 +462,7 @@ static bool i40e_xmit_zc(struct i40e_ring *xdp_ring, unsigned int budget) - - nb_pkts = xsk_tx_peek_release_desc_batch(xdp_ring->xsk_pool, descs, budget); - if (!nb_pkts) -- return false; -+ return true; - - if (xdp_ring->next_to_use + nb_pkts >= xdp_ring->count) { - nb_processed = xdp_ring->count - xdp_ring->next_to_use; -@@ -479,7 +479,7 @@ static bool i40e_xmit_zc(struct i40e_ring *xdp_ring, unsigned int budget) - - i40e_update_tx_stats(xdp_ring, nb_pkts, total_bytes); - -- return true; -+ return nb_pkts < budget; - } - - /** -diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h -index 619d93f8b54c4..f3d927320a705 100644 ---- a/drivers/net/ethernet/intel/ice/ice.h -+++ b/drivers/net/ethernet/intel/ice/ice.h -@@ -194,7 +194,6 @@ enum ice_state { - __ICE_NEEDS_RESTART, - __ICE_PREPARED_FOR_RESET, /* set by driver when prepared */ - __ICE_RESET_OICR_RECV, /* set by driver after rcv reset OICR */ -- __ICE_DCBNL_DEVRESET, /* set by dcbnl devreset */ - __ICE_PFR_REQ, /* set by driver and peers */ - __ICE_CORER_REQ, /* set by driver and peers */ - __ICE_GLOBR_REQ, /* set by driver and peers */ -@@ -586,7 +585,7 @@ int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset); - void ice_print_link_msg(struct ice_vsi *vsi, bool isup); - const char *ice_stat_str(enum ice_status stat_err); - const char *ice_aq_str(enum ice_aq_err aq_err); --bool ice_is_wol_supported(struct ice_pf *pf); -+bool ice_is_wol_supported(struct ice_hw *hw); - int - ice_fdir_write_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input, bool add, - bool is_tun); -@@ -604,6 +603,7 @@ int ice_fdir_create_dflt_rules(struct ice_pf *pf); - int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout, - struct ice_rq_event_info *event); - int ice_open(struct net_device *netdev); -+int ice_open_internal(struct net_device *netdev); - int ice_stop(struct net_device *netdev); - void ice_service_task_schedule(struct ice_pf *pf); - -diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c -index 6d7e7dd0ebe22..836e96159a09d 100644 ---- a/drivers/net/ethernet/intel/ice/ice_common.c -+++ b/drivers/net/ethernet/intel/ice/ice_common.c -@@ -717,8 +717,8 @@ static enum ice_status ice_cfg_fw_log(struct ice_hw *hw, bool enable) - - if (!data) { - data = devm_kcalloc(ice_hw_to_dev(hw), -- sizeof(*data), - ICE_AQC_FW_LOG_ID_MAX, -+ sizeof(*data), - GFP_KERNEL); - if (!data) - return ICE_ERR_NO_MEMORY; -diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.h b/drivers/net/ethernet/intel/ice/ice_controlq.h -index faaa08e8171b5..68866f4f0eb09 100644 ---- a/drivers/net/ethernet/intel/ice/ice_controlq.h -+++ b/drivers/net/ethernet/intel/ice/ice_controlq.h -@@ -31,8 +31,8 @@ enum ice_ctl_q { - ICE_CTL_Q_MAILBOX, - }; - --/* Control Queue timeout settings - max delay 250ms */ --#define ICE_CTL_Q_SQ_CMD_TIMEOUT 2500 /* Count 2500 times */ -+/* Control Queue timeout settings - max delay 1s */ -+#define ICE_CTL_Q_SQ_CMD_TIMEOUT 10000 /* Count 10000 times */ - #define ICE_CTL_Q_SQ_CMD_USEC 100 /* Check every 100usec */ - #define ICE_CTL_Q_ADMIN_INIT_TIMEOUT 10 /* Count 10 times */ - #define ICE_CTL_Q_ADMIN_INIT_MSEC 100 /* Check every 100msec */ -diff --git a/drivers/net/ethernet/intel/ice/ice_dcb.c b/drivers/net/ethernet/intel/ice/ice_dcb.c -index 2a3147ee0bbb1..211ac6f907adb 100644 ---- a/drivers/net/ethernet/intel/ice/ice_dcb.c -+++ b/drivers/net/ethernet/intel/ice/ice_dcb.c -@@ -738,22 +738,27 @@ ice_aq_get_cee_dcb_cfg(struct ice_hw *hw, - /** - * ice_cee_to_dcb_cfg - * @cee_cfg: pointer to CEE configuration struct -- * @dcbcfg: DCB configuration struct -+ * @pi: port information structure - * - * Convert CEE configuration from firmware to DCB configuration - */ - static void - ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, -- struct ice_dcbx_cfg *dcbcfg) -+ struct ice_port_info *pi) - { - u32 status, tlv_status = le32_to_cpu(cee_cfg->tlv_status); - u32 ice_aqc_cee_status_mask, ice_aqc_cee_status_shift; -+ u8 i, j, err, sync, oper, app_index, ice_app_sel_type; - u16 app_prio = le16_to_cpu(cee_cfg->oper_app_prio); -- u8 i, err, sync, oper, app_index, ice_app_sel_type; - u16 ice_aqc_cee_app_mask, ice_aqc_cee_app_shift; -+ struct ice_dcbx_cfg *cmp_dcbcfg, *dcbcfg; - u16 ice_app_prot_id_type; - -- /* CEE PG data to ETS config */ -+ dcbcfg = &pi->qos_cfg.local_dcbx_cfg; -+ dcbcfg->dcbx_mode = ICE_DCBX_MODE_CEE; -+ dcbcfg->tlv_status = tlv_status; -+ -+ /* CEE PG data */ - dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; - - /* Note that the FW creates the oper_prio_tc nibbles reversed -@@ -780,10 +785,16 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, - } - } - -- /* CEE PFC data to ETS config */ -+ /* CEE PFC data */ - dcbcfg->pfc.pfcena = cee_cfg->oper_pfc_en; - dcbcfg->pfc.pfccap = ICE_MAX_TRAFFIC_CLASS; - -+ /* CEE APP TLV data */ -+ if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING) -+ cmp_dcbcfg = &pi->qos_cfg.desired_dcbx_cfg; -+ else -+ cmp_dcbcfg = &pi->qos_cfg.remote_dcbx_cfg; -+ - app_index = 0; - for (i = 0; i < 3; i++) { - if (i == 0) { -@@ -802,6 +813,18 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, - ice_aqc_cee_app_shift = ICE_AQC_CEE_APP_ISCSI_S; - ice_app_sel_type = ICE_APP_SEL_TCPIP; - ice_app_prot_id_type = ICE_APP_PROT_ID_ISCSI; -+ -+ for (j = 0; j < cmp_dcbcfg->numapps; j++) { -+ u16 prot_id = cmp_dcbcfg->app[j].prot_id; -+ u8 sel = cmp_dcbcfg->app[j].selector; -+ -+ if (sel == ICE_APP_SEL_TCPIP && -+ (prot_id == ICE_APP_PROT_ID_ISCSI || -+ prot_id == ICE_APP_PROT_ID_ISCSI_860)) { -+ ice_app_prot_id_type = prot_id; -+ break; -+ } -+ } - } else { - /* FIP APP */ - ice_aqc_cee_status_mask = ICE_AQC_CEE_FIP_STATUS_M; -@@ -850,9 +873,9 @@ ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode) - return ICE_ERR_PARAM; - - if (dcbx_mode == ICE_DCBX_MODE_IEEE) -- dcbx_cfg = &pi->local_dcbx_cfg; -+ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; - else if (dcbx_mode == ICE_DCBX_MODE_CEE) -- dcbx_cfg = &pi->desired_dcbx_cfg; -+ dcbx_cfg = &pi->qos_cfg.desired_dcbx_cfg; - - /* Get Local DCB Config in case of ICE_DCBX_MODE_IEEE - * or get CEE DCB Desired Config in case of ICE_DCBX_MODE_CEE -@@ -863,7 +886,7 @@ ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode) - goto out; - - /* Get Remote DCB Config */ -- dcbx_cfg = &pi->remote_dcbx_cfg; -+ dcbx_cfg = &pi->qos_cfg.remote_dcbx_cfg; - ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_REMOTE, - ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID, dcbx_cfg); - /* Don't treat ENOENT as an error for Remote MIBs */ -@@ -892,14 +915,11 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi) - ret = ice_aq_get_cee_dcb_cfg(pi->hw, &cee_cfg, NULL); - if (!ret) { - /* CEE mode */ -- dcbx_cfg = &pi->local_dcbx_cfg; -- dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_CEE; -- dcbx_cfg->tlv_status = le32_to_cpu(cee_cfg.tlv_status); -- ice_cee_to_dcb_cfg(&cee_cfg, dcbx_cfg); - ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_CEE); -+ ice_cee_to_dcb_cfg(&cee_cfg, pi); - } else if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) { - /* CEE mode not enabled try querying IEEE data */ -- dcbx_cfg = &pi->local_dcbx_cfg; -+ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; - dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_IEEE; - ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_IEEE); - } -@@ -916,26 +936,26 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi) - */ - enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change) - { -- struct ice_port_info *pi = hw->port_info; -+ struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg; - enum ice_status ret = 0; - - if (!hw->func_caps.common_cap.dcb) - return ICE_ERR_NOT_SUPPORTED; - -- pi->is_sw_lldp = true; -+ qos_cfg->is_sw_lldp = true; - - /* Get DCBX status */ -- pi->dcbx_status = ice_get_dcbx_status(hw); -+ qos_cfg->dcbx_status = ice_get_dcbx_status(hw); - -- if (pi->dcbx_status == ICE_DCBX_STATUS_DONE || -- pi->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS || -- pi->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) { -+ if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DONE || -+ qos_cfg->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS || -+ qos_cfg->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) { - /* Get current DCBX configuration */ -- ret = ice_get_dcb_cfg(pi); -+ ret = ice_get_dcb_cfg(hw->port_info); - if (ret) - return ret; -- pi->is_sw_lldp = false; -- } else if (pi->dcbx_status == ICE_DCBX_STATUS_DIS) { -+ qos_cfg->is_sw_lldp = false; -+ } else if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS) { - return ICE_ERR_NOT_READY; - } - -@@ -943,7 +963,7 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change) - if (enable_mib_change) { - ret = ice_aq_cfg_lldp_mib_change(hw, true, NULL); - if (ret) -- pi->is_sw_lldp = true; -+ qos_cfg->is_sw_lldp = true; - } - - return ret; -@@ -958,21 +978,21 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change) - */ - enum ice_status ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib) - { -- struct ice_port_info *pi = hw->port_info; -+ struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg; - enum ice_status ret; - - if (!hw->func_caps.common_cap.dcb) - return ICE_ERR_NOT_SUPPORTED; - - /* Get DCBX status */ -- pi->dcbx_status = ice_get_dcbx_status(hw); -+ qos_cfg->dcbx_status = ice_get_dcbx_status(hw); - -- if (pi->dcbx_status == ICE_DCBX_STATUS_DIS) -+ if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS) - return ICE_ERR_NOT_READY; - - ret = ice_aq_cfg_lldp_mib_change(hw, ena_mib, NULL); - if (!ret) -- pi->is_sw_lldp = !ena_mib; -+ qos_cfg->is_sw_lldp = !ena_mib; - - return ret; - } -@@ -1270,7 +1290,7 @@ enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi) - hw = pi->hw; - - /* update the HW local config */ -- dcbcfg = &pi->local_dcbx_cfg; -+ dcbcfg = &pi->qos_cfg.local_dcbx_cfg; - /* Allocate the LLDPDU */ - lldpmib = devm_kzalloc(ice_hw_to_dev(hw), ICE_LLDPDU_SIZE, GFP_KERNEL); - if (!lldpmib) -diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c -index 36abd6b7280c8..1e8f71ffc8ce7 100644 ---- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c -+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c -@@ -28,7 +28,7 @@ void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc) - if (netdev_set_num_tc(netdev, vsi->tc_cfg.numtc)) - return; - -- dcbcfg = &pf->hw.port_info->local_dcbx_cfg; -+ dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; - - ice_for_each_traffic_class(i) - if (vsi->tc_cfg.ena_tc & BIT(i)) -@@ -134,7 +134,7 @@ static u8 ice_dcb_get_mode(struct ice_port_info *port_info, bool host) - else - mode = DCB_CAP_DCBX_LLD_MANAGED; - -- if (port_info->local_dcbx_cfg.dcbx_mode & ICE_DCBX_MODE_CEE) -+ if (port_info->qos_cfg.local_dcbx_cfg.dcbx_mode & ICE_DCBX_MODE_CEE) - return mode | DCB_CAP_DCBX_VER_CEE; - else - return mode | DCB_CAP_DCBX_VER_IEEE; -@@ -277,10 +277,10 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked) - int ret = ICE_DCB_NO_HW_CHG; - struct ice_vsi *pf_vsi; - -- curr_cfg = &pf->hw.port_info->local_dcbx_cfg; -+ curr_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; - - /* FW does not care if change happened */ -- if (!pf->hw.port_info->is_sw_lldp) -+ if (!pf->hw.port_info->qos_cfg.is_sw_lldp) - ret = ICE_DCB_HW_CHG_RST; - - /* Enable DCB tagging only when more than one TC */ -@@ -327,7 +327,7 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked) - /* Only send new config to HW if we are in SW LLDP mode. Otherwise, - * the new config came from the HW in the first place. - */ -- if (pf->hw.port_info->is_sw_lldp) { -+ if (pf->hw.port_info->qos_cfg.is_sw_lldp) { - ret = ice_set_dcb_cfg(pf->hw.port_info); - if (ret) { - dev_err(dev, "Set DCB Config failed\n"); -@@ -360,7 +360,7 @@ free_cfg: - */ - static void ice_cfg_etsrec_defaults(struct ice_port_info *pi) - { -- struct ice_dcbx_cfg *dcbcfg = &pi->local_dcbx_cfg; -+ struct ice_dcbx_cfg *dcbcfg = &pi->qos_cfg.local_dcbx_cfg; - u8 i; - - /* Ensure ETS recommended DCB configuration is not already set */ -@@ -446,7 +446,7 @@ void ice_dcb_rebuild(struct ice_pf *pf) - - mutex_lock(&pf->tc_mutex); - -- if (!pf->hw.port_info->is_sw_lldp) -+ if (!pf->hw.port_info->qos_cfg.is_sw_lldp) - ice_cfg_etsrec_defaults(pf->hw.port_info); - - ret = ice_set_dcb_cfg(pf->hw.port_info); -@@ -455,9 +455,9 @@ void ice_dcb_rebuild(struct ice_pf *pf) - goto dcb_error; - } - -- if (!pf->hw.port_info->is_sw_lldp) { -+ if (!pf->hw.port_info->qos_cfg.is_sw_lldp) { - ret = ice_cfg_lldp_mib_change(&pf->hw, true); -- if (ret && !pf->hw.port_info->is_sw_lldp) { -+ if (ret && !pf->hw.port_info->qos_cfg.is_sw_lldp) { - dev_err(dev, "Failed to register for MIB changes\n"); - goto dcb_error; - } -@@ -510,11 +510,12 @@ static int ice_dcb_init_cfg(struct ice_pf *pf, bool locked) - int ret = 0; - - pi = pf->hw.port_info; -- newcfg = kmemdup(&pi->local_dcbx_cfg, sizeof(*newcfg), GFP_KERNEL); -+ newcfg = kmemdup(&pi->qos_cfg.local_dcbx_cfg, sizeof(*newcfg), -+ GFP_KERNEL); - if (!newcfg) - return -ENOMEM; - -- memset(&pi->local_dcbx_cfg, 0, sizeof(*newcfg)); -+ memset(&pi->qos_cfg.local_dcbx_cfg, 0, sizeof(*newcfg)); - - dev_info(ice_pf_to_dev(pf), "Configuring initial DCB values\n"); - if (ice_pf_dcb_cfg(pf, newcfg, locked)) -@@ -545,7 +546,7 @@ static int ice_dcb_sw_dflt_cfg(struct ice_pf *pf, bool ets_willing, bool locked) - if (!dcbcfg) - return -ENOMEM; - -- memset(&pi->local_dcbx_cfg, 0, sizeof(*dcbcfg)); -+ memset(&pi->qos_cfg.local_dcbx_cfg, 0, sizeof(*dcbcfg)); - - dcbcfg->etscfg.willing = ets_willing ? 1 : 0; - dcbcfg->etscfg.maxtcs = hw->func_caps.common_cap.maxtc; -@@ -608,7 +609,7 @@ static bool ice_dcb_tc_contig(u8 *prio_table) - */ - static int ice_dcb_noncontig_cfg(struct ice_pf *pf) - { -- struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->local_dcbx_cfg; -+ struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; - struct device *dev = ice_pf_to_dev(pf); - int ret; - -@@ -638,7 +639,7 @@ static int ice_dcb_noncontig_cfg(struct ice_pf *pf) - */ - void ice_pf_dcb_recfg(struct ice_pf *pf) - { -- struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->local_dcbx_cfg; -+ struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; - u8 tc_map = 0; - int v, ret; - -@@ -691,7 +692,7 @@ int ice_init_pf_dcb(struct ice_pf *pf, bool locked) - port_info = hw->port_info; - - err = ice_init_dcb(hw, false); -- if (err && !port_info->is_sw_lldp) { -+ if (err && !port_info->qos_cfg.is_sw_lldp) { - dev_err(dev, "Error initializing DCB %d\n", err); - goto dcb_init_err; - } -@@ -858,7 +859,7 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, - /* Update the remote cached instance and return */ - ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_REMOTE, - ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID, -- &pi->remote_dcbx_cfg); -+ &pi->qos_cfg.remote_dcbx_cfg); - if (ret) { - dev_err(dev, "Failed to get remote DCB config\n"); - return; -@@ -868,10 +869,11 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, - mutex_lock(&pf->tc_mutex); - - /* store the old configuration */ -- tmp_dcbx_cfg = pf->hw.port_info->local_dcbx_cfg; -+ tmp_dcbx_cfg = pf->hw.port_info->qos_cfg.local_dcbx_cfg; - - /* Reset the old DCBX configuration data */ -- memset(&pi->local_dcbx_cfg, 0, sizeof(pi->local_dcbx_cfg)); -+ memset(&pi->qos_cfg.local_dcbx_cfg, 0, -+ sizeof(pi->qos_cfg.local_dcbx_cfg)); - - /* Get updated DCBX data from firmware */ - ret = ice_get_dcb_cfg(pf->hw.port_info); -@@ -881,7 +883,8 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, - } - - /* No change detected in DCBX configs */ -- if (!memcmp(&tmp_dcbx_cfg, &pi->local_dcbx_cfg, sizeof(tmp_dcbx_cfg))) { -+ if (!memcmp(&tmp_dcbx_cfg, &pi->qos_cfg.local_dcbx_cfg, -+ sizeof(tmp_dcbx_cfg))) { - dev_dbg(dev, "No change detected in DCBX configuration.\n"); - goto out; - } -@@ -889,13 +892,13 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, - pf->dcbx_cap = ice_dcb_get_mode(pi, false); - - need_reconfig = ice_dcb_need_recfg(pf, &tmp_dcbx_cfg, -- &pi->local_dcbx_cfg); -- ice_dcbnl_flush_apps(pf, &tmp_dcbx_cfg, &pi->local_dcbx_cfg); -+ &pi->qos_cfg.local_dcbx_cfg); -+ ice_dcbnl_flush_apps(pf, &tmp_dcbx_cfg, &pi->qos_cfg.local_dcbx_cfg); - if (!need_reconfig) - goto out; - - /* Enable DCB tagging only when more than one TC */ -- if (ice_dcb_get_num_tc(&pi->local_dcbx_cfg) > 1) { -+ if (ice_dcb_get_num_tc(&pi->qos_cfg.local_dcbx_cfg) > 1) { - dev_dbg(dev, "DCB tagging enabled (num TC > 1)\n"); - set_bit(ICE_FLAG_DCB_ENA, pf->flags); - } else { -diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c -index 8c133a8be6add..4180f1f35fb89 100644 ---- a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c -+++ b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c -@@ -18,12 +18,10 @@ static void ice_dcbnl_devreset(struct net_device *netdev) - while (ice_is_reset_in_progress(pf->state)) - usleep_range(1000, 2000); - -- set_bit(__ICE_DCBNL_DEVRESET, pf->state); - dev_close(netdev); - netdev_state_change(netdev); - dev_open(netdev, NULL); - netdev_state_change(netdev); -- clear_bit(__ICE_DCBNL_DEVRESET, pf->state); - } - - /** -@@ -34,12 +32,10 @@ static void ice_dcbnl_devreset(struct net_device *netdev) - static int ice_dcbnl_getets(struct net_device *netdev, struct ieee_ets *ets) - { - struct ice_dcbx_cfg *dcbxcfg; -- struct ice_port_info *pi; - struct ice_pf *pf; - - pf = ice_netdev_to_pf(netdev); -- pi = pf->hw.port_info; -- dcbxcfg = &pi->local_dcbx_cfg; -+ dcbxcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; - - ets->willing = dcbxcfg->etscfg.willing; - ets->ets_cap = dcbxcfg->etscfg.maxtcs; -@@ -74,7 +70,7 @@ static int ice_dcbnl_setets(struct net_device *netdev, struct ieee_ets *ets) - !(pf->dcbx_cap & DCB_CAP_DCBX_VER_IEEE)) - return -EINVAL; - -- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; -+ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; - - mutex_lock(&pf->tc_mutex); - -@@ -159,6 +155,7 @@ static u8 ice_dcbnl_getdcbx(struct net_device *netdev) - static u8 ice_dcbnl_setdcbx(struct net_device *netdev, u8 mode) - { - struct ice_pf *pf = ice_netdev_to_pf(netdev); -+ struct ice_qos_cfg *qos_cfg; - - /* if FW LLDP agent is running, DCBNL not allowed to change mode */ - if (test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags)) -@@ -175,10 +172,11 @@ static u8 ice_dcbnl_setdcbx(struct net_device *netdev, u8 mode) - return ICE_DCB_NO_HW_CHG; - - pf->dcbx_cap = mode; -+ qos_cfg = &pf->hw.port_info->qos_cfg; - if (mode & DCB_CAP_DCBX_VER_CEE) -- pf->hw.port_info->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_CEE; -+ qos_cfg->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_CEE; - else -- pf->hw.port_info->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_IEEE; -+ qos_cfg->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_IEEE; - - dev_info(ice_pf_to_dev(pf), "DCBx mode = 0x%x\n", mode); - return ICE_DCB_HW_CHG_RST; -@@ -229,7 +227,7 @@ static int ice_dcbnl_getpfc(struct net_device *netdev, struct ieee_pfc *pfc) - struct ice_dcbx_cfg *dcbxcfg; - int i; - -- dcbxcfg = &pi->local_dcbx_cfg; -+ dcbxcfg = &pi->qos_cfg.local_dcbx_cfg; - pfc->pfc_cap = dcbxcfg->pfc.pfccap; - pfc->pfc_en = dcbxcfg->pfc.pfcena; - pfc->mbc = dcbxcfg->pfc.mbc; -@@ -260,7 +258,7 @@ static int ice_dcbnl_setpfc(struct net_device *netdev, struct ieee_pfc *pfc) - - mutex_lock(&pf->tc_mutex); - -- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; -+ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; - - if (pfc->pfc_cap) - new_cfg->pfc.pfccap = pfc->pfc_cap; -@@ -297,9 +295,9 @@ ice_dcbnl_get_pfc_cfg(struct net_device *netdev, int prio, u8 *setting) - if (prio >= ICE_MAX_USER_PRIORITY) - return; - -- *setting = (pi->local_dcbx_cfg.pfc.pfcena >> prio) & 0x1; -+ *setting = (pi->qos_cfg.local_dcbx_cfg.pfc.pfcena >> prio) & 0x1; - dev_dbg(ice_pf_to_dev(pf), "Get PFC Config up=%d, setting=%d, pfcenable=0x%x\n", -- prio, *setting, pi->local_dcbx_cfg.pfc.pfcena); -+ prio, *setting, pi->qos_cfg.local_dcbx_cfg.pfc.pfcena); - } - - /** -@@ -320,7 +318,7 @@ static void ice_dcbnl_set_pfc_cfg(struct net_device *netdev, int prio, u8 set) - if (prio >= ICE_MAX_USER_PRIORITY) - return; - -- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; -+ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; - - new_cfg->pfc.pfccap = pf->hw.func_caps.common_cap.maxtc; - if (set) -@@ -342,7 +340,7 @@ static u8 ice_dcbnl_getpfcstate(struct net_device *netdev) - struct ice_port_info *pi = pf->hw.port_info; - - /* Return enabled if any UP enabled for PFC */ -- if (pi->local_dcbx_cfg.pfc.pfcena) -+ if (pi->qos_cfg.local_dcbx_cfg.pfc.pfcena) - return 1; - - return 0; -@@ -382,8 +380,8 @@ static u8 ice_dcbnl_setstate(struct net_device *netdev, u8 state) - - if (state) { - set_bit(ICE_FLAG_DCB_ENA, pf->flags); -- memcpy(&pf->hw.port_info->desired_dcbx_cfg, -- &pf->hw.port_info->local_dcbx_cfg, -+ memcpy(&pf->hw.port_info->qos_cfg.desired_dcbx_cfg, -+ &pf->hw.port_info->qos_cfg.local_dcbx_cfg, - sizeof(struct ice_dcbx_cfg)); - } else { - clear_bit(ICE_FLAG_DCB_ENA, pf->flags); -@@ -417,7 +415,7 @@ ice_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int prio, - if (prio >= ICE_MAX_USER_PRIORITY) - return; - -- *pgid = pi->local_dcbx_cfg.etscfg.prio_table[prio]; -+ *pgid = pi->qos_cfg.local_dcbx_cfg.etscfg.prio_table[prio]; - dev_dbg(ice_pf_to_dev(pf), "Get PG config prio=%d tc=%d\n", prio, - *pgid); - } -@@ -448,7 +446,7 @@ ice_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc, - if (tc >= ICE_MAX_TRAFFIC_CLASS) - return; - -- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; -+ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; - - /* prio_type, bwg_id and bw_pct per UP are not supported */ - -@@ -478,7 +476,7 @@ ice_dcbnl_get_pg_bwg_cfg_tx(struct net_device *netdev, int pgid, u8 *bw_pct) - if (pgid >= ICE_MAX_TRAFFIC_CLASS) - return; - -- *bw_pct = pi->local_dcbx_cfg.etscfg.tcbwtable[pgid]; -+ *bw_pct = pi->qos_cfg.local_dcbx_cfg.etscfg.tcbwtable[pgid]; - dev_dbg(ice_pf_to_dev(pf), "Get PG BW config tc=%d bw_pct=%d\n", - pgid, *bw_pct); - } -@@ -502,7 +500,7 @@ ice_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int pgid, u8 bw_pct) - if (pgid >= ICE_MAX_TRAFFIC_CLASS) - return; - -- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; -+ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; - - new_cfg->etscfg.tcbwtable[pgid] = bw_pct; - } -@@ -532,7 +530,7 @@ ice_dcbnl_get_pg_tc_cfg_rx(struct net_device *netdev, int prio, - if (prio >= ICE_MAX_USER_PRIORITY) - return; - -- *pgid = pi->local_dcbx_cfg.etscfg.prio_table[prio]; -+ *pgid = pi->qos_cfg.local_dcbx_cfg.etscfg.prio_table[prio]; - } - - /** -@@ -703,9 +701,9 @@ static int ice_dcbnl_setapp(struct net_device *netdev, struct dcb_app *app) - - mutex_lock(&pf->tc_mutex); - -- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; -+ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; - -- old_cfg = &pf->hw.port_info->local_dcbx_cfg; -+ old_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; - - if (old_cfg->numapps == ICE_DCBX_MAX_APPS) { - ret = -EINVAL; -@@ -755,7 +753,7 @@ static int ice_dcbnl_delapp(struct net_device *netdev, struct dcb_app *app) - return -EINVAL; - - mutex_lock(&pf->tc_mutex); -- old_cfg = &pf->hw.port_info->local_dcbx_cfg; -+ old_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg; - - if (old_cfg->numapps <= 1) - goto delapp_out; -@@ -764,7 +762,7 @@ static int ice_dcbnl_delapp(struct net_device *netdev, struct dcb_app *app) - if (ret) - goto delapp_out; - -- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; -+ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; - - for (i = 1; i < new_cfg->numapps; i++) { - if (app->selector == new_cfg->app[i].selector && -@@ -817,7 +815,7 @@ static u8 ice_dcbnl_cee_set_all(struct net_device *netdev) - !(pf->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) - return ICE_DCB_NO_HW_CHG; - -- new_cfg = &pf->hw.port_info->desired_dcbx_cfg; -+ new_cfg = &pf->hw.port_info->qos_cfg.desired_dcbx_cfg; - - mutex_lock(&pf->tc_mutex); - -@@ -888,7 +886,7 @@ void ice_dcbnl_set_all(struct ice_vsi *vsi) - if (!test_bit(ICE_FLAG_DCB_ENA, pf->flags)) - return; - -- dcbxcfg = &pi->local_dcbx_cfg; -+ dcbxcfg = &pi->qos_cfg.local_dcbx_cfg; - - for (i = 0; i < dcbxcfg->numapps; i++) { - u8 prio, tc_map; -diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c -index aebebd2102da0..d70573f5072c6 100644 ---- a/drivers/net/ethernet/intel/ice/ice_ethtool.c -+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c -@@ -2986,7 +2986,7 @@ ice_get_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) - pause->rx_pause = 0; - pause->tx_pause = 0; - -- dcbx_cfg = &pi->local_dcbx_cfg; -+ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; - - pcaps = kzalloc(sizeof(*pcaps), GFP_KERNEL); - if (!pcaps) -@@ -3038,7 +3038,7 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) - - pi = vsi->port_info; - hw_link_info = &pi->phy.link_info; -- dcbx_cfg = &pi->local_dcbx_cfg; -+ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; - link_up = hw_link_info->link_info & ICE_AQ_LINK_UP; - - /* Changing the port's flow control is not supported if this isn't the -@@ -3472,7 +3472,7 @@ static void ice_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) - netdev_warn(netdev, "Wake on LAN is not supported on this interface!\n"); - - /* Get WoL settings based on the HW capability */ -- if (ice_is_wol_supported(pf)) { -+ if (ice_is_wol_supported(&pf->hw)) { - wol->supported = WAKE_MAGIC; - wol->wolopts = pf->wol_ena ? WAKE_MAGIC : 0; - } else { -@@ -3492,7 +3492,7 @@ static int ice_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) - struct ice_vsi *vsi = np->vsi; - struct ice_pf *pf = vsi->back; - -- if (vsi->type != ICE_VSI_PF || !ice_is_wol_supported(pf)) -+ if (vsi->type != ICE_VSI_PF || !ice_is_wol_supported(&pf->hw)) - return -EOPNOTSUPP; - - /* only magic packet is supported */ -diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c -index ad9c22a1b97a0..170367eaa95aa 100644 ---- a/drivers/net/ethernet/intel/ice/ice_lib.c -+++ b/drivers/net/ethernet/intel/ice/ice_lib.c -@@ -2078,7 +2078,7 @@ err_out: - - static void ice_vsi_set_tc_cfg(struct ice_vsi *vsi) - { -- struct ice_dcbx_cfg *cfg = &vsi->port_info->local_dcbx_cfg; -+ struct ice_dcbx_cfg *cfg = &vsi->port_info->qos_cfg.local_dcbx_cfg; - - vsi->tc_cfg.ena_tc = ice_dcb_get_ena_tc(cfg); - vsi->tc_cfg.numtc = ice_dcb_get_num_tc(cfg); -@@ -2489,7 +2489,7 @@ int ice_ena_vsi(struct ice_vsi *vsi, bool locked) - if (!locked) - rtnl_lock(); - -- err = ice_open(vsi->netdev); -+ err = ice_open_internal(vsi->netdev); - - if (!locked) - rtnl_unlock(); -@@ -2518,7 +2518,7 @@ void ice_dis_vsi(struct ice_vsi *vsi, bool locked) - if (!locked) - rtnl_lock(); - -- ice_stop(vsi->netdev); -+ ice_vsi_close(vsi); - - if (!locked) - rtnl_unlock(); -@@ -2944,7 +2944,6 @@ err_vsi: - bool ice_is_reset_in_progress(unsigned long *state) - { - return test_bit(__ICE_RESET_OICR_RECV, state) || -- test_bit(__ICE_DCBNL_DEVRESET, state) || - test_bit(__ICE_PFR_REQ, state) || - test_bit(__ICE_CORER_REQ, state) || - test_bit(__ICE_GLOBR_REQ, state); -diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c -index e10ca8929f85e..00a2520395c5e 100644 ---- a/drivers/net/ethernet/intel/ice/ice_main.c -+++ b/drivers/net/ethernet/intel/ice/ice_main.c -@@ -3512,15 +3512,14 @@ static int ice_init_interrupt_scheme(struct ice_pf *pf) - } - - /** -- * ice_is_wol_supported - get NVM state of WoL -- * @pf: board private structure -+ * ice_is_wol_supported - check if WoL is supported -+ * @hw: pointer to hardware info - * - * Check if WoL is supported based on the HW configuration. - * Returns true if NVM supports and enables WoL for this port, false otherwise - */ --bool ice_is_wol_supported(struct ice_pf *pf) -+bool ice_is_wol_supported(struct ice_hw *hw) - { -- struct ice_hw *hw = &pf->hw; - u16 wol_ctrl; - - /* A bit set to 1 in the NVM Software Reserved Word 2 (WoL control -@@ -3529,7 +3528,7 @@ bool ice_is_wol_supported(struct ice_pf *pf) - if (ice_read_sr_word(hw, ICE_SR_NVM_WOL_CFG, &wol_ctrl)) - return false; - -- return !(BIT(hw->pf_id) & wol_ctrl); -+ return !(BIT(hw->port_info->lport) & wol_ctrl); - } - - /** -@@ -4167,28 +4166,25 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) - goto err_send_version_unroll; - } - -+ /* not a fatal error if this fails */ - err = ice_init_nvm_phy_type(pf->hw.port_info); -- if (err) { -+ if (err) - dev_err(dev, "ice_init_nvm_phy_type failed: %d\n", err); -- goto err_send_version_unroll; -- } - -+ /* not a fatal error if this fails */ - err = ice_update_link_info(pf->hw.port_info); -- if (err) { -+ if (err) - dev_err(dev, "ice_update_link_info failed: %d\n", err); -- goto err_send_version_unroll; -- } - - ice_init_link_dflt_override(pf->hw.port_info); - - /* if media available, initialize PHY settings */ - if (pf->hw.port_info->phy.link_info.link_info & - ICE_AQ_MEDIA_AVAILABLE) { -+ /* not a fatal error if this fails */ - err = ice_init_phy_user_cfg(pf->hw.port_info); -- if (err) { -+ if (err) - dev_err(dev, "ice_init_phy_user_cfg failed: %d\n", err); -- goto err_send_version_unroll; -- } - - if (!test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags)) { - struct ice_vsi *vsi = ice_get_main_vsi(pf); -@@ -4539,6 +4535,7 @@ static int __maybe_unused ice_suspend(struct device *dev) - continue; - ice_vsi_free_q_vectors(pf->vsi[v]); - } -+ ice_free_cpu_rx_rmap(ice_get_main_vsi(pf)); - ice_clear_interrupt_scheme(pf); - - pci_save_state(pdev); -@@ -6613,6 +6610,28 @@ static void ice_tx_timeout(struct net_device *netdev, unsigned int txqueue) - * Returns 0 on success, negative value on failure - */ - int ice_open(struct net_device *netdev) -+{ -+ struct ice_netdev_priv *np = netdev_priv(netdev); -+ struct ice_pf *pf = np->vsi->back; -+ -+ if (ice_is_reset_in_progress(pf->state)) { -+ netdev_err(netdev, "can't open net device while reset is in progress"); -+ return -EBUSY; -+ } -+ -+ return ice_open_internal(netdev); -+} -+ -+/** -+ * ice_open_internal - Called when a network interface becomes active -+ * @netdev: network interface device structure -+ * -+ * Internal ice_open implementation. Should not be used directly except for ice_open and reset -+ * handling routine -+ * -+ * Returns 0 on success, negative value on failure -+ */ -+int ice_open_internal(struct net_device *netdev) - { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_vsi *vsi = np->vsi; -@@ -6693,6 +6712,12 @@ int ice_stop(struct net_device *netdev) - { - struct ice_netdev_priv *np = netdev_priv(netdev); - struct ice_vsi *vsi = np->vsi; -+ struct ice_pf *pf = vsi->back; -+ -+ if (ice_is_reset_in_progress(pf->state)) { -+ netdev_err(netdev, "can't stop net device while reset is in progress"); -+ return -EBUSY; -+ } - - ice_vsi_close(vsi); - -diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c -index c33612132ddf0..0a8fcd4309ca9 100644 ---- a/drivers/net/ethernet/intel/ice/ice_switch.c -+++ b/drivers/net/ethernet/intel/ice/ice_switch.c -@@ -1238,6 +1238,9 @@ ice_add_update_vsi_list(struct ice_hw *hw, - ice_create_vsi_list_map(hw, &vsi_handle_arr[0], 2, - vsi_list_id); - -+ if (!m_entry->vsi_list_info) -+ return ICE_ERR_NO_MEMORY; -+ - /* If this entry was large action then the large action needs - * to be updated to point to FWD to VSI list - */ -@@ -2220,6 +2223,7 @@ ice_vsi_uses_fltr(struct ice_fltr_mgmt_list_entry *fm_entry, u16 vsi_handle) - return ((fm_entry->fltr_info.fltr_act == ICE_FWD_TO_VSI && - fm_entry->fltr_info.vsi_handle == vsi_handle) || - (fm_entry->fltr_info.fltr_act == ICE_FWD_TO_VSI_LIST && -+ fm_entry->vsi_list_info && - (test_bit(vsi_handle, fm_entry->vsi_list_info->vsi_map)))); - } - -@@ -2292,14 +2296,12 @@ ice_add_to_vsi_fltr_list(struct ice_hw *hw, u16 vsi_handle, - return ICE_ERR_PARAM; - - list_for_each_entry(fm_entry, lkup_list_head, list_entry) { -- struct ice_fltr_info *fi; -- -- fi = &fm_entry->fltr_info; -- if (!fi || !ice_vsi_uses_fltr(fm_entry, vsi_handle)) -+ if (!ice_vsi_uses_fltr(fm_entry, vsi_handle)) - continue; - - status = ice_add_entry_to_vsi_fltr_list(hw, vsi_handle, -- vsi_list_head, fi); -+ vsi_list_head, -+ &fm_entry->fltr_info); - if (status) - return status; - } -@@ -2622,7 +2624,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle, - &remove_list_head); - mutex_unlock(rule_lock); - if (status) -- return; -+ goto free_fltr_list; - - switch (lkup) { - case ICE_SW_LKUP_MAC: -@@ -2645,6 +2647,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle, - break; - } - -+free_fltr_list: - list_for_each_entry_safe(fm_entry, tmp, &remove_list_head, list_entry) { - list_del(&fm_entry->list_entry); - devm_kfree(ice_hw_to_dev(hw), fm_entry); -diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c -index b6fa83c619dd7..4cd3142ec20ab 100644 ---- a/drivers/net/ethernet/intel/ice/ice_txrx.c -+++ b/drivers/net/ethernet/intel/ice/ice_txrx.c -@@ -2421,7 +2421,7 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring) - /* allow CONTROL frames egress from main VSI if FW LLDP disabled */ - if (unlikely(skb->priority == TC_PRIO_CONTROL && - vsi->type == ICE_VSI_PF && -- vsi->port_info->is_sw_lldp)) -+ vsi->port_info->qos_cfg.is_sw_lldp)) - offload.cd_qw1 |= (u64)(ICE_TX_DESC_DTYPE_CTX | - ICE_TX_CTX_DESC_SWTCH_UPLINK << - ICE_TXD_CTX_QW1_CMD_S); -diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h -index 2226a291a3943..1bed183d96a0d 100644 ---- a/drivers/net/ethernet/intel/ice/ice_type.h -+++ b/drivers/net/ethernet/intel/ice/ice_type.h -@@ -493,6 +493,7 @@ struct ice_dcb_app_priority_table { - #define ICE_TLV_STATUS_ERR 0x4 - #define ICE_APP_PROT_ID_FCOE 0x8906 - #define ICE_APP_PROT_ID_ISCSI 0x0cbc -+#define ICE_APP_PROT_ID_ISCSI_860 0x035c - #define ICE_APP_PROT_ID_FIP 0x8914 - #define ICE_APP_SEL_ETHTYPE 0x1 - #define ICE_APP_SEL_TCPIP 0x2 -@@ -514,6 +515,14 @@ struct ice_dcbx_cfg { - #define ICE_DCBX_APPS_NON_WILLING 0x1 - }; - -+struct ice_qos_cfg { -+ struct ice_dcbx_cfg local_dcbx_cfg; /* Oper/Local Cfg */ -+ struct ice_dcbx_cfg desired_dcbx_cfg; /* CEE Desired Cfg */ -+ struct ice_dcbx_cfg remote_dcbx_cfg; /* Peer Cfg */ -+ u8 dcbx_status : 3; /* see ICE_DCBX_STATUS_DIS */ -+ u8 is_sw_lldp : 1; -+}; -+ - struct ice_port_info { - struct ice_sched_node *root; /* Root Node per Port */ - struct ice_hw *hw; /* back pointer to HW instance */ -@@ -537,13 +546,7 @@ struct ice_port_info { - sib_head[ICE_MAX_TRAFFIC_CLASS][ICE_AQC_TOPO_MAX_LEVEL_NUM]; - /* List contain profile ID(s) and other params per layer */ - struct list_head rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM]; -- struct ice_dcbx_cfg local_dcbx_cfg; /* Oper/Local Cfg */ -- /* DCBX info */ -- struct ice_dcbx_cfg remote_dcbx_cfg; /* Peer Cfg */ -- struct ice_dcbx_cfg desired_dcbx_cfg; /* CEE Desired Cfg */ -- /* LLDP/DCBX Status */ -- u8 dcbx_status:3; /* see ICE_DCBX_STATUS_DIS */ -- u8 is_sw_lldp:1; -+ struct ice_qos_cfg qos_cfg; - u8 is_vf:1; - }; - -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c -index b051417ede67b..9153c9bda96fa 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c -@@ -191,12 +191,12 @@ static bool is_ib_supported(struct mlx5_core_dev *dev) - } - - enum { -- MLX5_INTERFACE_PROTOCOL_ETH_REP, - MLX5_INTERFACE_PROTOCOL_ETH, -+ MLX5_INTERFACE_PROTOCOL_ETH_REP, - -+ MLX5_INTERFACE_PROTOCOL_IB, - MLX5_INTERFACE_PROTOCOL_IB_REP, - MLX5_INTERFACE_PROTOCOL_MPIB, -- MLX5_INTERFACE_PROTOCOL_IB, - - MLX5_INTERFACE_PROTOCOL_VNET, - }; -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h -index f258f2f9b8cff..9061a30a93bcf 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en.h -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h -@@ -510,6 +510,7 @@ struct mlx5e_icosq { - struct mlx5_wq_cyc wq; - void __iomem *uar_map; - u32 sqn; -+ u16 reserved_room; - unsigned long state; - - /* control path */ -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c -index b42396df3111d..0469f53dfb99e 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c -@@ -184,6 +184,28 @@ mlx5_tc_ct_entry_has_nat(struct mlx5_ct_entry *entry) - return !!(entry->tuple_nat_node.next); - } - -+static int -+mlx5_get_label_mapping(struct mlx5_tc_ct_priv *ct_priv, -+ u32 *labels, u32 *id) -+{ -+ if (!memchr_inv(labels, 0, sizeof(u32) * 4)) { -+ *id = 0; -+ return 0; -+ } -+ -+ if (mapping_add(ct_priv->labels_mapping, labels, id)) -+ return -EOPNOTSUPP; -+ -+ return 0; -+} -+ -+static void -+mlx5_put_label_mapping(struct mlx5_tc_ct_priv *ct_priv, u32 id) -+{ -+ if (id) -+ mapping_remove(ct_priv->labels_mapping, id); -+} -+ - static int - mlx5_tc_ct_rule_to_tuple(struct mlx5_ct_tuple *tuple, struct flow_rule *rule) - { -@@ -435,7 +457,7 @@ mlx5_tc_ct_entry_del_rule(struct mlx5_tc_ct_priv *ct_priv, - mlx5_tc_rule_delete(netdev_priv(ct_priv->netdev), zone_rule->rule, attr); - mlx5e_mod_hdr_detach(ct_priv->dev, - ct_priv->mod_hdr_tbl, zone_rule->mh); -- mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id); -+ mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id); - kfree(attr); - } - -@@ -638,8 +660,8 @@ mlx5_tc_ct_entry_create_mod_hdr(struct mlx5_tc_ct_priv *ct_priv, - if (!meta) - return -EOPNOTSUPP; - -- err = mapping_add(ct_priv->labels_mapping, meta->ct_metadata.labels, -- &attr->ct_attr.ct_labels_id); -+ err = mlx5_get_label_mapping(ct_priv, meta->ct_metadata.labels, -+ &attr->ct_attr.ct_labels_id); - if (err) - return -EOPNOTSUPP; - if (nat) { -@@ -675,7 +697,7 @@ mlx5_tc_ct_entry_create_mod_hdr(struct mlx5_tc_ct_priv *ct_priv, - - err_mapping: - dealloc_mod_hdr_actions(&mod_acts); -- mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id); -+ mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id); - return err; - } - -@@ -743,7 +765,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv, - err_rule: - mlx5e_mod_hdr_detach(ct_priv->dev, - ct_priv->mod_hdr_tbl, zone_rule->mh); -- mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id); -+ mlx5_put_label_mapping(ct_priv, attr->ct_attr.ct_labels_id); - err_mod_hdr: - kfree(attr); - err_attr: -@@ -1198,7 +1220,7 @@ void mlx5_tc_ct_match_del(struct mlx5_tc_ct_priv *priv, struct mlx5_ct_attr *ct_ - if (!priv || !ct_attr->ct_labels_id) - return; - -- mapping_remove(priv->labels_mapping, ct_attr->ct_labels_id); -+ mlx5_put_label_mapping(priv, ct_attr->ct_labels_id); - } - - int -@@ -1276,7 +1298,7 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv, - ct_labels[1] = key->ct_labels[1] & mask->ct_labels[1]; - ct_labels[2] = key->ct_labels[2] & mask->ct_labels[2]; - ct_labels[3] = key->ct_labels[3] & mask->ct_labels[3]; -- if (mapping_add(priv->labels_mapping, ct_labels, &ct_attr->ct_labels_id)) -+ if (mlx5_get_label_mapping(priv, ct_labels, &ct_attr->ct_labels_id)) - return -EOPNOTSUPP; - mlx5e_tc_match_to_reg_match(spec, LABELS_TO_REG, ct_attr->ct_labels_id, - MLX5_CT_LABELS_MASK); -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h -index 4880f21792730..05d673e5289df 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h -@@ -434,4 +434,10 @@ static inline u16 mlx5e_stop_room_for_wqe(u16 wqe_size) - return wqe_size * 2 - 1; - } - -+static inline bool mlx5e_icosq_can_post_wqe(struct mlx5e_icosq *sq, u16 wqe_size) -+{ -+ u16 room = sq->reserved_room + mlx5e_stop_room_for_wqe(wqe_size); -+ -+ return mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, room); -+} - #endif -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c -index d06532d0baa43..c0bd4e55ed8cb 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c -@@ -137,11 +137,10 @@ post_static_params(struct mlx5e_icosq *sq, - { - struct mlx5e_set_tls_static_params_wqe *wqe; - struct mlx5e_icosq_wqe_info wi; -- u16 pi, num_wqebbs, room; -+ u16 pi, num_wqebbs; - - num_wqebbs = MLX5E_TLS_SET_STATIC_PARAMS_WQEBBS; -- room = mlx5e_stop_room_for_wqe(num_wqebbs); -- if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, room))) -+ if (unlikely(!mlx5e_icosq_can_post_wqe(sq, num_wqebbs))) - return ERR_PTR(-ENOSPC); - - pi = mlx5e_icosq_get_next_pi(sq, num_wqebbs); -@@ -168,11 +167,10 @@ post_progress_params(struct mlx5e_icosq *sq, - { - struct mlx5e_set_tls_progress_params_wqe *wqe; - struct mlx5e_icosq_wqe_info wi; -- u16 pi, num_wqebbs, room; -+ u16 pi, num_wqebbs; - - num_wqebbs = MLX5E_TLS_SET_PROGRESS_PARAMS_WQEBBS; -- room = mlx5e_stop_room_for_wqe(num_wqebbs); -- if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, room))) -+ if (unlikely(!mlx5e_icosq_can_post_wqe(sq, num_wqebbs))) - return ERR_PTR(-ENOSPC); - - pi = mlx5e_icosq_get_next_pi(sq, num_wqebbs); -@@ -277,17 +275,15 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq, - - buf->priv_rx = priv_rx; - -- BUILD_BUG_ON(MLX5E_KTLS_GET_PROGRESS_WQEBBS != 1); -- - spin_lock_bh(&sq->channel->async_icosq_lock); - -- if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, 1))) { -+ if (unlikely(!mlx5e_icosq_can_post_wqe(sq, MLX5E_KTLS_GET_PROGRESS_WQEBBS))) { - spin_unlock_bh(&sq->channel->async_icosq_lock); - err = -ENOSPC; - goto err_dma_unmap; - } - -- pi = mlx5e_icosq_get_next_pi(sq, 1); -+ pi = mlx5e_icosq_get_next_pi(sq, MLX5E_KTLS_GET_PROGRESS_WQEBBS); - wqe = MLX5E_TLS_FETCH_GET_PROGRESS_PARAMS_WQE(sq, pi); - - #define GET_PSV_DS_CNT (DIV_ROUND_UP(sizeof(*wqe), MLX5_SEND_WQE_DS)) -@@ -307,7 +303,7 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq, - - wi = (struct mlx5e_icosq_wqe_info) { - .wqe_type = MLX5E_ICOSQ_WQE_GET_PSV_TLS, -- .num_wqebbs = 1, -+ .num_wqebbs = MLX5E_KTLS_GET_PROGRESS_WQEBBS, - .tls_get_params.buf = buf, - }; - icosq_fill_wi(sq, pi, &wi); -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c -index c9d01e705ab29..d3d532fdf04ee 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c -@@ -747,11 +747,11 @@ static int get_fec_supported_advertised(struct mlx5_core_dev *dev, - return 0; - } - --static void ptys2ethtool_supported_advertised_port(struct ethtool_link_ksettings *link_ksettings, -- u32 eth_proto_cap, -- u8 connector_type, bool ext) -+static void ptys2ethtool_supported_advertised_port(struct mlx5_core_dev *mdev, -+ struct ethtool_link_ksettings *link_ksettings, -+ u32 eth_proto_cap, u8 connector_type) - { -- if ((!connector_type && !ext) || connector_type >= MLX5E_CONNECTOR_TYPE_NUMBER) { -+ if (!MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) { - if (eth_proto_cap & (MLX5E_PROT_MASK(MLX5E_10GBASE_CR) - | MLX5E_PROT_MASK(MLX5E_10GBASE_SR) - | MLX5E_PROT_MASK(MLX5E_40GBASE_CR4) -@@ -887,9 +887,9 @@ static int ptys2connector_type[MLX5E_CONNECTOR_TYPE_NUMBER] = { - [MLX5E_PORT_OTHER] = PORT_OTHER, - }; - --static u8 get_connector_port(u32 eth_proto, u8 connector_type, bool ext) -+static u8 get_connector_port(struct mlx5_core_dev *mdev, u32 eth_proto, u8 connector_type) - { -- if ((connector_type || ext) && connector_type < MLX5E_CONNECTOR_TYPE_NUMBER) -+ if (MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) - return ptys2connector_type[connector_type]; - - if (eth_proto & -@@ -990,11 +990,11 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, - data_rate_oper, link_ksettings); - - eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; -- -- link_ksettings->base.port = get_connector_port(eth_proto_oper, -- connector_type, ext); -- ptys2ethtool_supported_advertised_port(link_ksettings, eth_proto_admin, -- connector_type, ext); -+ connector_type = connector_type < MLX5E_CONNECTOR_TYPE_NUMBER ? -+ connector_type : MLX5E_PORT_UNKNOWN; -+ link_ksettings->base.port = get_connector_port(mdev, eth_proto_oper, connector_type); -+ ptys2ethtool_supported_advertised_port(mdev, link_ksettings, eth_proto_admin, -+ connector_type); - get_lp_advertising(mdev, eth_proto_lp, link_ksettings); - - if (an_status == MLX5_AN_COMPLETE) -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c -index b6324d11a0086..7bb189e656283 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c -@@ -1058,6 +1058,7 @@ static int mlx5e_alloc_icosq(struct mlx5e_channel *c, - - sq->channel = c; - sq->uar_map = mdev->mlx5e_res.bfreg.map; -+ sq->reserved_room = param->stop_room; - - param->wq.db_numa_node = cpu_to_node(c->cpu); - err = mlx5_wq_cyc_create(mdev, ¶m->wq, sqc_wq, wq, &sq->wq_ctrl); -@@ -2299,6 +2300,24 @@ void mlx5e_build_icosq_param(struct mlx5e_priv *priv, - mlx5e_build_ico_cq_param(priv, log_wq_size, ¶m->cqp); - } - -+static void mlx5e_build_async_icosq_param(struct mlx5e_priv *priv, -+ struct mlx5e_params *params, -+ u8 log_wq_size, -+ struct mlx5e_sq_param *param) -+{ -+ void *sqc = param->sqc; -+ void *wq = MLX5_ADDR_OF(sqc, sqc, wq); -+ -+ mlx5e_build_sq_param_common(priv, param); -+ -+ /* async_icosq is used by XSK only if xdp_prog is active */ -+ if (params->xdp_prog) -+ param->stop_room = mlx5e_stop_room_for_wqe(1); /* for XSK NOP */ -+ MLX5_SET(sqc, sqc, reg_umr, MLX5_CAP_ETH(priv->mdev, reg_umr_sq)); -+ MLX5_SET(wq, wq, log_wq_sz, log_wq_size); -+ mlx5e_build_ico_cq_param(priv, log_wq_size, ¶m->cqp); -+} -+ - void mlx5e_build_xdpsq_param(struct mlx5e_priv *priv, - struct mlx5e_params *params, - struct mlx5e_sq_param *param) -@@ -2347,7 +2366,7 @@ static void mlx5e_build_channel_param(struct mlx5e_priv *priv, - mlx5e_build_sq_param(priv, params, &cparam->txq_sq); - mlx5e_build_xdpsq_param(priv, params, &cparam->xdp_sq); - mlx5e_build_icosq_param(priv, icosq_log_wq_sz, &cparam->icosq); -- mlx5e_build_icosq_param(priv, async_icosq_log_wq_sz, &cparam->async_icosq); -+ mlx5e_build_async_icosq_param(priv, params, async_icosq_log_wq_sz, &cparam->async_icosq); - } - - int mlx5e_open_channels(struct mlx5e_priv *priv, -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c -index f0ceae65f6cfa..8afbb485197e4 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c -@@ -1103,8 +1103,9 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv) - - mlx5e_rep_tc_enable(priv); - -- mlx5_modify_vport_admin_state(mdev, MLX5_VPORT_STATE_OP_MOD_UPLINK, -- 0, 0, MLX5_VPORT_ADMIN_STATE_AUTO); -+ if (MLX5_CAP_GEN(mdev, uplink_follow)) -+ mlx5_modify_vport_admin_state(mdev, MLX5_VPORT_STATE_OP_MOD_UPLINK, -+ 0, 0, MLX5_VPORT_ADMIN_STATE_AUTO); - mlx5_lag_add(mdev, netdev); - priv->events_nb.notifier_call = uplink_rep_async_event; - mlx5_notifier_register(mdev, &priv->events_nb); -diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c -index fc0afa03d407b..b5f48efebd714 100644 ---- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c -+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c -@@ -928,13 +928,24 @@ void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev) - mutex_unlock(&table->lock); - } - -+#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING -+#define MLX5_MAX_ASYNC_EQS 4 -+#else -+#define MLX5_MAX_ASYNC_EQS 3 -+#endif -+ - int mlx5_eq_table_create(struct mlx5_core_dev *dev) - { - struct mlx5_eq_table *eq_table = dev->priv.eq_table; -+ int num_eqs = MLX5_CAP_GEN(dev, max_num_eqs) ? -+ MLX5_CAP_GEN(dev, max_num_eqs) : -+ 1 << MLX5_CAP_GEN(dev, log_max_eq); - int err; - - eq_table->num_comp_eqs = -- mlx5_irq_get_num_comp(eq_table->irq_table); -+ min_t(int, -+ mlx5_irq_get_num_comp(eq_table->irq_table), -+ num_eqs - MLX5_MAX_ASYNC_EQS); - - err = create_async_eqs(dev); - if (err) { -diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h -index a6956cfc9cb12..4399c9a4999d5 100644 ---- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h -+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - - #include "port.h" - #include "core.h" -@@ -346,6 +347,20 @@ struct mlxsw_sp_port_type_speed_ops { - u32 (*ptys_proto_cap_masked_get)(u32 eth_proto_cap); - }; - -+static inline u8 mlxsw_sp_tunnel_ecn_decap(u8 outer_ecn, u8 inner_ecn, -+ bool *trap_en) -+{ -+ bool set_ce = false; -+ -+ *trap_en = !!__INET_ECN_decapsulate(outer_ecn, inner_ecn, &set_ce); -+ if (set_ce) -+ return INET_ECN_CE; -+ else if (outer_ecn == INET_ECN_ECT_1 && inner_ecn == INET_ECN_ECT_0) -+ return INET_ECN_ECT_1; -+ else -+ return inner_ecn; -+} -+ - static inline struct net_device * - mlxsw_sp_bridge_vxlan_dev_find(struct net_device *br_dev) - { -diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c -index 6ccca39bae845..64a8f838eb532 100644 ---- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c -+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.c -@@ -335,12 +335,11 @@ static int mlxsw_sp_ipip_ecn_decap_init_one(struct mlxsw_sp *mlxsw_sp, - u8 inner_ecn, u8 outer_ecn) - { - char tidem_pl[MLXSW_REG_TIDEM_LEN]; -- bool trap_en, set_ce = false; - u8 new_inner_ecn; -+ bool trap_en; - -- trap_en = __INET_ECN_decapsulate(outer_ecn, inner_ecn, &set_ce); -- new_inner_ecn = set_ce ? INET_ECN_CE : inner_ecn; -- -+ new_inner_ecn = mlxsw_sp_tunnel_ecn_decap(outer_ecn, inner_ecn, -+ &trap_en); - mlxsw_reg_tidem_pack(tidem_pl, outer_ecn, inner_ecn, new_inner_ecn, - trap_en, trap_en ? MLXSW_TRAP_ID_DECAP_ECN0 : 0); - return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(tidem), tidem_pl); -diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c -index e5ec595593f45..9eba8fa684aee 100644 ---- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c -+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c -@@ -909,12 +909,11 @@ static int __mlxsw_sp_nve_ecn_decap_init(struct mlxsw_sp *mlxsw_sp, - u8 inner_ecn, u8 outer_ecn) - { - char tndem_pl[MLXSW_REG_TNDEM_LEN]; -- bool trap_en, set_ce = false; - u8 new_inner_ecn; -+ bool trap_en; - -- trap_en = !!__INET_ECN_decapsulate(outer_ecn, inner_ecn, &set_ce); -- new_inner_ecn = set_ce ? INET_ECN_CE : inner_ecn; -- -+ new_inner_ecn = mlxsw_sp_tunnel_ecn_decap(outer_ecn, inner_ecn, -+ &trap_en); - mlxsw_reg_tndem_pack(tndem_pl, outer_ecn, inner_ecn, new_inner_ecn, - trap_en, trap_en ? MLXSW_TRAP_ID_DECAP_ECN0 : 0); - return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(tndem), tndem_pl); -diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c -index 1634ca6d4a8f0..c84c8bf2bc20e 100644 ---- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c -+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c -@@ -2897,7 +2897,7 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb, - dev_kfree_skb_any(curr); - if (segs != NULL) { - curr = segs; -- segs = segs->next; -+ segs = next; - curr->next = NULL; - dev_kfree_skb_any(segs); - } -diff --git a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c -index 0e2db6ea79e96..2ec62c8d86e1c 100644 ---- a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c -+++ b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c -@@ -454,6 +454,7 @@ void nfp_bpf_ctrl_msg_rx(struct nfp_app *app, struct sk_buff *skb) - dev_consume_skb_any(skb); - else - dev_kfree_skb_any(skb); -+ return; - } - - nfp_ccm_rx(&bpf->ccm, skb); -diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h -index caf12eec99459..56833a41f3d27 100644 ---- a/drivers/net/ethernet/netronome/nfp/flower/main.h -+++ b/drivers/net/ethernet/netronome/nfp/flower/main.h -@@ -190,6 +190,7 @@ struct nfp_fl_internal_ports { - * @qos_rate_limiters: Current active qos rate limiters - * @qos_stats_lock: Lock on qos stats updates - * @pre_tun_rule_cnt: Number of pre-tunnel rules offloaded -+ * @merge_table: Hash table to store merged flows - */ - struct nfp_flower_priv { - struct nfp_app *app; -@@ -223,6 +224,7 @@ struct nfp_flower_priv { - unsigned int qos_rate_limiters; - spinlock_t qos_stats_lock; /* Protect the qos stats */ - int pre_tun_rule_cnt; -+ struct rhashtable merge_table; - }; - - /** -@@ -350,6 +352,12 @@ struct nfp_fl_payload_link { - }; - - extern const struct rhashtable_params nfp_flower_table_params; -+extern const struct rhashtable_params merge_table_params; -+ -+struct nfp_merge_info { -+ u64 parent_ctx; -+ struct rhash_head ht_node; -+}; - - struct nfp_fl_stats_frame { - __be32 stats_con_id; -diff --git a/drivers/net/ethernet/netronome/nfp/flower/metadata.c b/drivers/net/ethernet/netronome/nfp/flower/metadata.c -index aa06fcb38f8b9..327bb56b3ef56 100644 ---- a/drivers/net/ethernet/netronome/nfp/flower/metadata.c -+++ b/drivers/net/ethernet/netronome/nfp/flower/metadata.c -@@ -490,6 +490,12 @@ const struct rhashtable_params nfp_flower_table_params = { - .automatic_shrinking = true, - }; - -+const struct rhashtable_params merge_table_params = { -+ .key_offset = offsetof(struct nfp_merge_info, parent_ctx), -+ .head_offset = offsetof(struct nfp_merge_info, ht_node), -+ .key_len = sizeof(u64), -+}; -+ - int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, - unsigned int host_num_mems) - { -@@ -506,6 +512,10 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, - if (err) - goto err_free_flow_table; - -+ err = rhashtable_init(&priv->merge_table, &merge_table_params); -+ if (err) -+ goto err_free_stats_ctx_table; -+ - get_random_bytes(&priv->mask_id_seed, sizeof(priv->mask_id_seed)); - - /* Init ring buffer and unallocated mask_ids. */ -@@ -513,7 +523,7 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, - kmalloc_array(NFP_FLOWER_MASK_ENTRY_RS, - NFP_FLOWER_MASK_ELEMENT_RS, GFP_KERNEL); - if (!priv->mask_ids.mask_id_free_list.buf) -- goto err_free_stats_ctx_table; -+ goto err_free_merge_table; - - priv->mask_ids.init_unallocated = NFP_FLOWER_MASK_ENTRY_RS - 1; - -@@ -550,6 +560,8 @@ err_free_last_used: - kfree(priv->mask_ids.last_used); - err_free_mask_id: - kfree(priv->mask_ids.mask_id_free_list.buf); -+err_free_merge_table: -+ rhashtable_destroy(&priv->merge_table); - err_free_stats_ctx_table: - rhashtable_destroy(&priv->stats_ctx_table); - err_free_flow_table: -@@ -568,6 +580,8 @@ void nfp_flower_metadata_cleanup(struct nfp_app *app) - nfp_check_rhashtable_empty, NULL); - rhashtable_free_and_destroy(&priv->stats_ctx_table, - nfp_check_rhashtable_empty, NULL); -+ rhashtable_free_and_destroy(&priv->merge_table, -+ nfp_check_rhashtable_empty, NULL); - kvfree(priv->stats); - kfree(priv->mask_ids.mask_id_free_list.buf); - kfree(priv->mask_ids.last_used); -diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c -index d72225d64a75d..e95969c462e46 100644 ---- a/drivers/net/ethernet/netronome/nfp/flower/offload.c -+++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c -@@ -1009,6 +1009,8 @@ int nfp_flower_merge_offloaded_flows(struct nfp_app *app, - struct netlink_ext_ack *extack = NULL; - struct nfp_fl_payload *merge_flow; - struct nfp_fl_key_ls merge_key_ls; -+ struct nfp_merge_info *merge_info; -+ u64 parent_ctx = 0; - int err; - - ASSERT_RTNL(); -@@ -1019,6 +1021,15 @@ int nfp_flower_merge_offloaded_flows(struct nfp_app *app, - nfp_flower_is_merge_flow(sub_flow2)) - return -EINVAL; - -+ /* check if the two flows are already merged */ -+ parent_ctx = (u64)(be32_to_cpu(sub_flow1->meta.host_ctx_id)) << 32; -+ parent_ctx |= (u64)(be32_to_cpu(sub_flow2->meta.host_ctx_id)); -+ if (rhashtable_lookup_fast(&priv->merge_table, -+ &parent_ctx, merge_table_params)) { -+ nfp_flower_cmsg_warn(app, "The two flows are already merged.\n"); -+ return 0; -+ } -+ - err = nfp_flower_can_merge(sub_flow1, sub_flow2); - if (err) - return err; -@@ -1060,16 +1071,33 @@ int nfp_flower_merge_offloaded_flows(struct nfp_app *app, - if (err) - goto err_release_metadata; - -+ merge_info = kmalloc(sizeof(*merge_info), GFP_KERNEL); -+ if (!merge_info) { -+ err = -ENOMEM; -+ goto err_remove_rhash; -+ } -+ merge_info->parent_ctx = parent_ctx; -+ err = rhashtable_insert_fast(&priv->merge_table, &merge_info->ht_node, -+ merge_table_params); -+ if (err) -+ goto err_destroy_merge_info; -+ - err = nfp_flower_xmit_flow(app, merge_flow, - NFP_FLOWER_CMSG_TYPE_FLOW_MOD); - if (err) -- goto err_remove_rhash; -+ goto err_remove_merge_info; - - merge_flow->in_hw = true; - sub_flow1->in_hw = false; - - return 0; - -+err_remove_merge_info: -+ WARN_ON_ONCE(rhashtable_remove_fast(&priv->merge_table, -+ &merge_info->ht_node, -+ merge_table_params)); -+err_destroy_merge_info: -+ kfree(merge_info); - err_remove_rhash: - WARN_ON_ONCE(rhashtable_remove_fast(&priv->flow_table, - &merge_flow->fl_node, -@@ -1359,7 +1387,9 @@ nfp_flower_remove_merge_flow(struct nfp_app *app, - { - struct nfp_flower_priv *priv = app->priv; - struct nfp_fl_payload_link *link, *temp; -+ struct nfp_merge_info *merge_info; - struct nfp_fl_payload *origin; -+ u64 parent_ctx = 0; - bool mod = false; - int err; - -@@ -1396,8 +1426,22 @@ nfp_flower_remove_merge_flow(struct nfp_app *app, - err_free_links: - /* Clean any links connected with the merged flow. */ - list_for_each_entry_safe(link, temp, &merge_flow->linked_flows, -- merge_flow.list) -+ merge_flow.list) { -+ u32 ctx_id = be32_to_cpu(link->sub_flow.flow->meta.host_ctx_id); -+ -+ parent_ctx = (parent_ctx << 32) | (u64)(ctx_id); - nfp_flower_unlink_flow(link); -+ } -+ -+ merge_info = rhashtable_lookup_fast(&priv->merge_table, -+ &parent_ctx, -+ merge_table_params); -+ if (merge_info) { -+ WARN_ON_ONCE(rhashtable_remove_fast(&priv->merge_table, -+ &merge_info->ht_node, -+ merge_table_params)); -+ kfree(merge_info); -+ } - - kfree(merge_flow->action_data); - kfree(merge_flow->mask_data); -diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c -index 5523f069b9a5a..f35b0b83fe85a 100644 ---- a/drivers/net/geneve.c -+++ b/drivers/net/geneve.c -@@ -908,8 +908,16 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, - - info = skb_tunnel_info(skb); - if (info) { -- info->key.u.ipv4.dst = fl4.saddr; -- info->key.u.ipv4.src = fl4.daddr; -+ struct ip_tunnel_info *unclone; -+ -+ unclone = skb_tunnel_info_unclone(skb); -+ if (unlikely(!unclone)) { -+ dst_release(&rt->dst); -+ return -ENOMEM; -+ } -+ -+ unclone->key.u.ipv4.dst = fl4.saddr; -+ unclone->key.u.ipv4.src = fl4.daddr; - } - - if (!pskb_may_pull(skb, ETH_HLEN)) { -@@ -993,8 +1001,16 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, - struct ip_tunnel_info *info = skb_tunnel_info(skb); - - if (info) { -- info->key.u.ipv6.dst = fl6.saddr; -- info->key.u.ipv6.src = fl6.daddr; -+ struct ip_tunnel_info *unclone; -+ -+ unclone = skb_tunnel_info_unclone(skb); -+ if (unlikely(!unclone)) { -+ dst_release(dst); -+ return -ENOMEM; -+ } -+ -+ unclone->key.u.ipv6.dst = fl6.saddr; -+ unclone->key.u.ipv6.src = fl6.daddr; - } - - if (!pskb_may_pull(skb, ETH_HLEN)) { -diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c -index 0dd0ba915ab97..23ee0b14cbfa1 100644 ---- a/drivers/net/ieee802154/atusb.c -+++ b/drivers/net/ieee802154/atusb.c -@@ -365,6 +365,7 @@ static int atusb_alloc_urbs(struct atusb *atusb, int n) - return -ENOMEM; - } - usb_anchor_urb(urb, &atusb->idle_urbs); -+ usb_free_urb(urb); - n--; - } - return 0; -diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c -index 53282a6d5928f..287cccf8f7f4e 100644 ---- a/drivers/net/phy/bcm-phy-lib.c -+++ b/drivers/net/phy/bcm-phy-lib.c -@@ -369,7 +369,7 @@ EXPORT_SYMBOL_GPL(bcm_phy_enable_apd); - - int bcm_phy_set_eee(struct phy_device *phydev, bool enable) - { -- int val; -+ int val, mask = 0; - - /* Enable EEE at PHY level */ - val = phy_read_mmd(phydev, MDIO_MMD_AN, BRCM_CL45VEN_EEE_CONTROL); -@@ -388,10 +388,17 @@ int bcm_phy_set_eee(struct phy_device *phydev, bool enable) - if (val < 0) - return val; - -+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, -+ phydev->supported)) -+ mask |= MDIO_EEE_1000T; -+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, -+ phydev->supported)) -+ mask |= MDIO_EEE_100TX; -+ - if (enable) -- val |= (MDIO_EEE_100TX | MDIO_EEE_1000T); -+ val |= mask; - else -- val &= ~(MDIO_EEE_100TX | MDIO_EEE_1000T); -+ val &= ~mask; - - phy_write_mmd(phydev, MDIO_MMD_AN, BCM_CL45VEN_EEE_ADV, (u32)val); - -diff --git a/drivers/net/tun.c b/drivers/net/tun.c -index 5512418b7be0a..2ed54818dcbcf 100644 ---- a/drivers/net/tun.c -+++ b/drivers/net/tun.c -@@ -69,6 +69,14 @@ - #include - #include - #include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include - - #include - #include -@@ -2925,6 +2933,45 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p, - return __tun_set_ebpf(tun, prog_p, prog); - } - -+/* Return correct value for tun->dev->addr_len based on tun->dev->type. */ -+static unsigned char tun_get_addr_len(unsigned short type) -+{ -+ switch (type) { -+ case ARPHRD_IP6GRE: -+ case ARPHRD_TUNNEL6: -+ return sizeof(struct in6_addr); -+ case ARPHRD_IPGRE: -+ case ARPHRD_TUNNEL: -+ case ARPHRD_SIT: -+ return 4; -+ case ARPHRD_ETHER: -+ return ETH_ALEN; -+ case ARPHRD_IEEE802154: -+ case ARPHRD_IEEE802154_MONITOR: -+ return IEEE802154_EXTENDED_ADDR_LEN; -+ case ARPHRD_PHONET_PIPE: -+ case ARPHRD_PPP: -+ case ARPHRD_NONE: -+ return 0; -+ case ARPHRD_6LOWPAN: -+ return EUI64_ADDR_LEN; -+ case ARPHRD_FDDI: -+ return FDDI_K_ALEN; -+ case ARPHRD_HIPPI: -+ return HIPPI_ALEN; -+ case ARPHRD_IEEE802: -+ return FC_ALEN; -+ case ARPHRD_ROSE: -+ return ROSE_ADDR_LEN; -+ case ARPHRD_NETROM: -+ return AX25_ADDR_LEN; -+ case ARPHRD_LOCALTLK: -+ return LTALK_ALEN; -+ default: -+ return 0; -+ } -+} -+ - static long __tun_chr_ioctl(struct file *file, unsigned int cmd, - unsigned long arg, int ifreq_len) - { -@@ -3088,6 +3135,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, - break; - } - tun->dev->type = (int) arg; -+ tun->dev->addr_len = tun_get_addr_len(tun->dev->type); - netif_info(tun, drv, tun->dev, "linktype set to %d\n", - tun->dev->type); - call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, -diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c -index 2bb28db894320..d18642a8144cf 100644 ---- a/drivers/net/usb/hso.c -+++ b/drivers/net/usb/hso.c -@@ -611,7 +611,7 @@ static struct hso_serial *get_serial_by_index(unsigned index) - return serial; - } - --static int get_free_serial_index(void) -+static int obtain_minor(struct hso_serial *serial) - { - int index; - unsigned long flags; -@@ -619,8 +619,10 @@ static int get_free_serial_index(void) - spin_lock_irqsave(&serial_table_lock, flags); - for (index = 0; index < HSO_SERIAL_TTY_MINORS; index++) { - if (serial_table[index] == NULL) { -+ serial_table[index] = serial->parent; -+ serial->minor = index; - spin_unlock_irqrestore(&serial_table_lock, flags); -- return index; -+ return 0; - } - } - spin_unlock_irqrestore(&serial_table_lock, flags); -@@ -629,15 +631,12 @@ static int get_free_serial_index(void) - return -1; - } - --static void set_serial_by_index(unsigned index, struct hso_serial *serial) -+static void release_minor(struct hso_serial *serial) - { - unsigned long flags; - - spin_lock_irqsave(&serial_table_lock, flags); -- if (serial) -- serial_table[index] = serial->parent; -- else -- serial_table[index] = NULL; -+ serial_table[serial->minor] = NULL; - spin_unlock_irqrestore(&serial_table_lock, flags); - } - -@@ -2230,6 +2229,7 @@ static int hso_stop_serial_device(struct hso_device *hso_dev) - static void hso_serial_tty_unregister(struct hso_serial *serial) - { - tty_unregister_device(tty_drv, serial->minor); -+ release_minor(serial); - } - - static void hso_serial_common_free(struct hso_serial *serial) -@@ -2253,24 +2253,22 @@ static void hso_serial_common_free(struct hso_serial *serial) - static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, - int rx_size, int tx_size) - { -- int minor; - int i; - - tty_port_init(&serial->port); - -- minor = get_free_serial_index(); -- if (minor < 0) -+ if (obtain_minor(serial)) - goto exit2; - - /* register our minor number */ - serial->parent->dev = tty_port_register_device_attr(&serial->port, -- tty_drv, minor, &serial->parent->interface->dev, -+ tty_drv, serial->minor, &serial->parent->interface->dev, - serial->parent, hso_serial_dev_groups); -- if (IS_ERR(serial->parent->dev)) -+ if (IS_ERR(serial->parent->dev)) { -+ release_minor(serial); - goto exit2; -+ } - -- /* fill in specific data for later use */ -- serial->minor = minor; - serial->magic = HSO_SERIAL_MAGIC; - spin_lock_init(&serial->serial_lock); - serial->num_rx_urbs = num_urbs; -@@ -2667,9 +2665,6 @@ static struct hso_device *hso_create_bulk_serial_device( - - serial->write_data = hso_std_serial_write_data; - -- /* and record this serial */ -- set_serial_by_index(serial->minor, serial); -- - /* setup the proc dirs and files if needed */ - hso_log_port(hso_dev); - -@@ -2726,9 +2721,6 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, - serial->shared_int->ref_count++; - mutex_unlock(&serial->shared_int->shared_int_lock); - -- /* and record this serial */ -- set_serial_by_index(serial->minor, serial); -- - /* setup the proc dirs and files if needed */ - hso_log_port(hso_dev); - -@@ -3113,7 +3105,6 @@ static void hso_free_interface(struct usb_interface *interface) - cancel_work_sync(&serial_table[i]->async_get_intf); - hso_serial_tty_unregister(serial); - kref_put(&serial_table[i]->ref, hso_serial_ref_free); -- set_serial_by_index(i, NULL); - } - } - -diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c -index 0842371eca3d6..4adfa6a01198d 100644 ---- a/drivers/net/vxlan.c -+++ b/drivers/net/vxlan.c -@@ -2725,12 +2725,17 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, - goto tx_error; - } else if (err) { - if (info) { -+ struct ip_tunnel_info *unclone; - struct in_addr src, dst; - -+ unclone = skb_tunnel_info_unclone(skb); -+ if (unlikely(!unclone)) -+ goto tx_error; -+ - src = remote_ip.sin.sin_addr; - dst = local_ip.sin.sin_addr; -- info->key.u.ipv4.src = src.s_addr; -- info->key.u.ipv4.dst = dst.s_addr; -+ unclone->key.u.ipv4.src = src.s_addr; -+ unclone->key.u.ipv4.dst = dst.s_addr; - } - vxlan_encap_bypass(skb, vxlan, vxlan, vni, false); - dst_release(ndst); -@@ -2781,12 +2786,17 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, - goto tx_error; - } else if (err) { - if (info) { -+ struct ip_tunnel_info *unclone; - struct in6_addr src, dst; - -+ unclone = skb_tunnel_info_unclone(skb); -+ if (unlikely(!unclone)) -+ goto tx_error; -+ - src = remote_ip.sin6.sin6_addr; - dst = local_ip.sin6.sin6_addr; -- info->key.u.ipv6.src = src; -- info->key.u.ipv6.dst = dst; -+ unclone->key.u.ipv6.src = src; -+ unclone->key.u.ipv6.dst = dst; - } - - vxlan_encap_bypass(skb, vxlan, vxlan, vni, false); -diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c -index 0720f5f92caa7..4d9dc7d159089 100644 ---- a/drivers/net/wan/hdlc_fr.c -+++ b/drivers/net/wan/hdlc_fr.c -@@ -415,7 +415,7 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev) - - if (pad > 0) { /* Pad the frame with zeros */ - if (__skb_pad(skb, pad, false)) -- goto drop; -+ goto out; - skb_put(skb, pad); - } - } -@@ -448,8 +448,9 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev) - return NETDEV_TX_OK; - - drop: -- dev->stats.tx_dropped++; - kfree_skb(skb); -+out: -+ dev->stats.tx_dropped++; - return NETDEV_TX_OK; - } - -diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -index 720193d16539b..7da193a128710 100644 ---- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -@@ -232,7 +232,7 @@ enum iwl_reg_capa_flags_v2 { - REG_CAPA_V2_MCS_9_ALLOWED = BIT(6), - REG_CAPA_V2_WEATHER_DISABLED = BIT(7), - REG_CAPA_V2_40MHZ_ALLOWED = BIT(8), -- REG_CAPA_V2_11AX_DISABLED = BIT(13), -+ REG_CAPA_V2_11AX_DISABLED = BIT(10), - }; - - /* -diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c -index 8fba190e84cf3..cecc32e7dbe8a 100644 ---- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c -+++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c -@@ -1,6 +1,6 @@ - // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause - /* -- * Copyright (C) 2018-2020 Intel Corporation -+ * Copyright (C) 2018-2021 Intel Corporation - */ - #include "iwl-trans.h" - #include "iwl-fh.h" -@@ -75,15 +75,6 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, - const struct fw_img *fw) - { - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); -- u32 ltr_val = CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ | -- u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, -- CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE) | -- u32_encode_bits(250, -- CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL) | -- CSR_LTR_LONG_VAL_AD_SNOOP_REQ | -- u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, -- CSR_LTR_LONG_VAL_AD_SNOOP_SCALE) | -- u32_encode_bits(250, CSR_LTR_LONG_VAL_AD_SNOOP_VAL); - struct iwl_context_info_gen3 *ctxt_info_gen3; - struct iwl_prph_scratch *prph_scratch; - struct iwl_prph_scratch_ctrl_cfg *prph_sc_ctrl; -@@ -217,26 +208,6 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, - iwl_set_bit(trans, CSR_CTXT_INFO_BOOT_CTRL, - CSR_AUTO_FUNC_BOOT_ENA); - -- /* -- * To workaround hardware latency issues during the boot process, -- * initialize the LTR to ~250 usec (see ltr_val above). -- * The firmware initializes this again later (to a smaller value). -- */ -- if ((trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210 || -- trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) && -- !trans->trans_cfg->integrated) { -- iwl_write32(trans, CSR_LTR_LONG_VAL_AD, ltr_val); -- } else if (trans->trans_cfg->integrated && -- trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) { -- iwl_write_prph(trans, HPM_MAC_LTR_CSR, HPM_MAC_LRT_ENABLE_ALL); -- iwl_write_prph(trans, HPM_UMAC_LTR, ltr_val); -- } -- -- if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) -- iwl_write_umac_prph(trans, UREG_CPU_INIT_RUN, 1); -- else -- iwl_set_bit(trans, CSR_GP_CNTRL, CSR_AUTO_FUNC_INIT); -- - return 0; - - err_free_ctxt_info: -diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c -index d1bb273d6b6d9..74ce31fdf45e9 100644 ---- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c -+++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause - /* - * Copyright (C) 2017 Intel Deutschland GmbH -- * Copyright (C) 2018-2020 Intel Corporation -+ * Copyright (C) 2018-2021 Intel Corporation - */ - #include "iwl-trans.h" - #include "iwl-fh.h" -@@ -240,7 +240,6 @@ int iwl_pcie_ctxt_info_init(struct iwl_trans *trans, - - /* kick FW self load */ - iwl_write64(trans, CSR_CTXT_INFO_BA, trans_pcie->ctxt_info_dma_addr); -- iwl_write_prph(trans, UREG_CPU_INIT_RUN, 1); - - /* Context info will be released upon alive or failure to get one */ - -diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c -index c602b815dcc21..08788bc906830 100644 ---- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c -+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c -@@ -260,6 +260,34 @@ void iwl_trans_pcie_gen2_fw_alive(struct iwl_trans *trans, u32 scd_addr) - mutex_unlock(&trans_pcie->mutex); - } - -+static void iwl_pcie_set_ltr(struct iwl_trans *trans) -+{ -+ u32 ltr_val = CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ | -+ u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, -+ CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE) | -+ u32_encode_bits(250, -+ CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL) | -+ CSR_LTR_LONG_VAL_AD_SNOOP_REQ | -+ u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, -+ CSR_LTR_LONG_VAL_AD_SNOOP_SCALE) | -+ u32_encode_bits(250, CSR_LTR_LONG_VAL_AD_SNOOP_VAL); -+ -+ /* -+ * To workaround hardware latency issues during the boot process, -+ * initialize the LTR to ~250 usec (see ltr_val above). -+ * The firmware initializes this again later (to a smaller value). -+ */ -+ if ((trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210 || -+ trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) && -+ !trans->trans_cfg->integrated) { -+ iwl_write32(trans, CSR_LTR_LONG_VAL_AD, ltr_val); -+ } else if (trans->trans_cfg->integrated && -+ trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) { -+ iwl_write_prph(trans, HPM_MAC_LTR_CSR, HPM_MAC_LRT_ENABLE_ALL); -+ iwl_write_prph(trans, HPM_UMAC_LTR, ltr_val); -+ } -+} -+ - int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans, - const struct fw_img *fw, bool run_in_rfkill) - { -@@ -326,6 +354,13 @@ int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans, - if (ret) - goto out; - -+ iwl_pcie_set_ltr(trans); -+ -+ if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) -+ iwl_write_umac_prph(trans, UREG_CPU_INIT_RUN, 1); -+ else -+ iwl_write_prph(trans, UREG_CPU_INIT_RUN, 1); -+ - /* re-check RF-Kill state since we may have missed the interrupt */ - hw_rfkill = iwl_pcie_check_hw_rf_kill(trans); - if (hw_rfkill && !run_in_rfkill) -diff --git a/drivers/of/property.c b/drivers/of/property.c -index 5f9eed79a8aaf..6d8368bf88cab 100644 ---- a/drivers/of/property.c -+++ b/drivers/of/property.c -@@ -1260,7 +1260,16 @@ DEFINE_SIMPLE_PROP(pinctrl7, "pinctrl-7", NULL) - DEFINE_SIMPLE_PROP(pinctrl8, "pinctrl-8", NULL) - DEFINE_SUFFIX_PROP(regulators, "-supply", NULL) - DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells") --DEFINE_SUFFIX_PROP(gpios, "-gpios", "#gpio-cells") -+ -+static struct device_node *parse_gpios(struct device_node *np, -+ const char *prop_name, int index) -+{ -+ if (!strcmp_suffix(prop_name, ",nr-gpios")) -+ return NULL; -+ -+ return parse_suffix_prop_cells(np, prop_name, index, "-gpios", -+ "#gpio-cells"); -+} - - static struct device_node *parse_iommu_maps(struct device_node *np, - const char *prop_name, int index) -diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c -index 57cc92891a570..078648a9201b3 100644 ---- a/drivers/platform/x86/intel-hid.c -+++ b/drivers/platform/x86/intel-hid.c -@@ -483,11 +483,16 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) - goto wakeup; - - /* -- * Switch events will wake the device and report the new switch -- * position to the input subsystem. -+ * Some devices send (duplicate) tablet-mode events when moved -+ * around even though the mode has not changed; and they do this -+ * even when suspended. -+ * Update the switch state in case it changed and then return -+ * without waking up to avoid spurious wakeups. - */ -- if (priv->switches && (event == 0xcc || event == 0xcd)) -- goto wakeup; -+ if (event == 0xcc || event == 0xcd) { -+ report_tablet_mode_event(priv->switches, event); -+ return; -+ } - - /* Wake up on 5-button array events only. */ - if (event == 0xc0 || !priv->array) -@@ -501,9 +506,6 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) - wakeup: - pm_wakeup_hard_event(&device->dev); - -- if (report_tablet_mode_event(priv->switches, event)) -- return; -- - return; - } - -diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c -index ddecf25b5dd40..d7894f178bd4f 100644 ---- a/drivers/ras/cec.c -+++ b/drivers/ras/cec.c -@@ -309,11 +309,20 @@ static bool sanity_check(struct ce_array *ca) - return ret; - } - -+/** -+ * cec_add_elem - Add an element to the CEC array. -+ * @pfn: page frame number to insert -+ * -+ * Return values: -+ * - <0: on error -+ * - 0: on success -+ * - >0: when the inserted pfn was offlined -+ */ - static int cec_add_elem(u64 pfn) - { - struct ce_array *ca = &ce_arr; -+ int count, err, ret = 0; - unsigned int to = 0; -- int count, ret = 0; - - /* - * We can be called very early on the identify_cpu() path where we are -@@ -330,8 +339,8 @@ static int cec_add_elem(u64 pfn) - if (ca->n == MAX_ELEMS) - WARN_ON(!del_lru_elem_unlocked(ca)); - -- ret = find_elem(ca, pfn, &to); -- if (ret < 0) { -+ err = find_elem(ca, pfn, &to); -+ if (err < 0) { - /* - * Shift range [to-end] to make room for one more element. - */ -diff --git a/drivers/regulator/bd9571mwv-regulator.c b/drivers/regulator/bd9571mwv-regulator.c -index e690c2ce5b3c5..25e33028871c0 100644 ---- a/drivers/regulator/bd9571mwv-regulator.c -+++ b/drivers/regulator/bd9571mwv-regulator.c -@@ -124,7 +124,7 @@ static const struct regulator_ops vid_ops = { - - static const struct regulator_desc regulators[] = { - BD9571MWV_REG("VD09", "vd09", VD09, avs_ops, 0, 0x7f, -- 0x80, 600000, 10000, 0x3c), -+ 0x6f, 600000, 10000, 0x3c), - BD9571MWV_REG("VD18", "vd18", VD18, vid_ops, BD9571MWV_VD18_VID, 0xf, - 16, 1625000, 25000, 0), - BD9571MWV_REG("VD25", "vd25", VD25, vid_ops, BD9571MWV_VD25_VID, 0xf, -@@ -133,7 +133,7 @@ static const struct regulator_desc regulators[] = { - 11, 2800000, 100000, 0), - BD9571MWV_REG("DVFS", "dvfs", DVFS, reg_ops, - BD9571MWV_DVFS_MONIVDAC, 0x7f, -- 0x80, 600000, 10000, 0x3c), -+ 0x6f, 600000, 10000, 0x3c), - }; - - #ifdef CONFIG_PM_SLEEP -diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c -index 2667919d76b34..16979c1cd2f4b 100644 ---- a/drivers/remoteproc/pru_rproc.c -+++ b/drivers/remoteproc/pru_rproc.c -@@ -585,7 +585,7 @@ pru_rproc_load_elf_segments(struct rproc *rproc, const struct firmware *fw) - break; - } - -- if (pru->data->is_k3 && is_iram) { -+ if (pru->data->is_k3) { - ret = pru_rproc_memcpy(ptr, elf_data + phdr->p_offset, - filesz); - if (ret) { -diff --git a/drivers/remoteproc/qcom_pil_info.c b/drivers/remoteproc/qcom_pil_info.c -index 5521c4437ffab..7c007dd7b2000 100644 ---- a/drivers/remoteproc/qcom_pil_info.c -+++ b/drivers/remoteproc/qcom_pil_info.c -@@ -56,7 +56,7 @@ static int qcom_pil_info_init(void) - memset_io(base, 0, resource_size(&imem)); - - _reloc.base = base; -- _reloc.num_entries = resource_size(&imem) / PIL_RELOC_ENTRY_SIZE; -+ _reloc.num_entries = (u32)resource_size(&imem) / PIL_RELOC_ENTRY_SIZE; - - return 0; - } -diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c -index ea43dff40a856..6fa739c92beb3 100644 ---- a/drivers/scsi/pm8001/pm8001_hwi.c -+++ b/drivers/scsi/pm8001/pm8001_hwi.c -@@ -223,7 +223,7 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha) - PM8001_EVENT_LOG_SIZE; - pm8001_ha->main_cfg_tbl.pm8001_tbl.iop_event_log_option = 0x01; - pm8001_ha->main_cfg_tbl.pm8001_tbl.fatal_err_interrupt = 0x01; -- for (i = 0; i < PM8001_MAX_INB_NUM; i++) { -+ for (i = 0; i < pm8001_ha->max_q_num; i++) { - pm8001_ha->inbnd_q_tbl[i].element_pri_size_cnt = - PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x00<<30); - pm8001_ha->inbnd_q_tbl[i].upper_base_addr = -@@ -249,7 +249,7 @@ static void init_default_table_values(struct pm8001_hba_info *pm8001_ha) - pm8001_ha->inbnd_q_tbl[i].producer_idx = 0; - pm8001_ha->inbnd_q_tbl[i].consumer_index = 0; - } -- for (i = 0; i < PM8001_MAX_OUTB_NUM; i++) { -+ for (i = 0; i < pm8001_ha->max_q_num; i++) { - pm8001_ha->outbnd_q_tbl[i].element_size_cnt = - PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x01<<30); - pm8001_ha->outbnd_q_tbl[i].upper_base_addr = -@@ -671,9 +671,9 @@ static int pm8001_chip_init(struct pm8001_hba_info *pm8001_ha) - read_outbnd_queue_table(pm8001_ha); - /* update main config table ,inbound table and outbound table */ - update_main_config_table(pm8001_ha); -- for (i = 0; i < PM8001_MAX_INB_NUM; i++) -+ for (i = 0; i < pm8001_ha->max_q_num; i++) - update_inbnd_queue_table(pm8001_ha, i); -- for (i = 0; i < PM8001_MAX_OUTB_NUM; i++) -+ for (i = 0; i < pm8001_ha->max_q_num; i++) - update_outbnd_queue_table(pm8001_ha, i); - /* 8081 controller donot require these operations */ - if (deviceid != 0x8081 && deviceid != 0x0042) { -diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c -index 16e1bd1aa49d5..e53a3f89e8635 100644 ---- a/drivers/scsi/ufs/ufshcd.c -+++ b/drivers/scsi/ufs/ufshcd.c -@@ -6363,37 +6363,34 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba, - DECLARE_COMPLETION_ONSTACK(wait); - struct request *req; - unsigned long flags; -- int free_slot, task_tag, err; -+ int task_tag, err; - - /* -- * Get free slot, sleep if slots are unavailable. -- * Even though we use wait_event() which sleeps indefinitely, -- * the maximum wait time is bounded by %TM_CMD_TIMEOUT. -+ * blk_get_request() is used here only to get a free tag. - */ - req = blk_get_request(q, REQ_OP_DRV_OUT, 0); - if (IS_ERR(req)) - return PTR_ERR(req); - - req->end_io_data = &wait; -- free_slot = req->tag; -- WARN_ON_ONCE(free_slot < 0 || free_slot >= hba->nutmrs); - ufshcd_hold(hba, false); - - spin_lock_irqsave(host->host_lock, flags); -- task_tag = hba->nutrs + free_slot; -+ blk_mq_start_request(req); - -+ task_tag = req->tag; - treq->req_header.dword_0 |= cpu_to_be32(task_tag); - -- memcpy(hba->utmrdl_base_addr + free_slot, treq, sizeof(*treq)); -- ufshcd_vops_setup_task_mgmt(hba, free_slot, tm_function); -+ memcpy(hba->utmrdl_base_addr + task_tag, treq, sizeof(*treq)); -+ ufshcd_vops_setup_task_mgmt(hba, task_tag, tm_function); - - /* send command to the controller */ -- __set_bit(free_slot, &hba->outstanding_tasks); -+ __set_bit(task_tag, &hba->outstanding_tasks); - - /* Make sure descriptors are ready before ringing the task doorbell */ - wmb(); - -- ufshcd_writel(hba, 1 << free_slot, REG_UTP_TASK_REQ_DOOR_BELL); -+ ufshcd_writel(hba, 1 << task_tag, REG_UTP_TASK_REQ_DOOR_BELL); - /* Make sure that doorbell is committed immediately */ - wmb(); - -@@ -6413,24 +6410,24 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba, - ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_complete_err"); - dev_err(hba->dev, "%s: task management cmd 0x%.2x timed-out\n", - __func__, tm_function); -- if (ufshcd_clear_tm_cmd(hba, free_slot)) -- dev_WARN(hba->dev, "%s: unable clear tm cmd (slot %d) after timeout\n", -- __func__, free_slot); -+ if (ufshcd_clear_tm_cmd(hba, task_tag)) -+ dev_WARN(hba->dev, "%s: unable to clear tm cmd (slot %d) after timeout\n", -+ __func__, task_tag); - err = -ETIMEDOUT; - } else { - err = 0; -- memcpy(treq, hba->utmrdl_base_addr + free_slot, sizeof(*treq)); -+ memcpy(treq, hba->utmrdl_base_addr + task_tag, sizeof(*treq)); - - ufshcd_add_tm_upiu_trace(hba, task_tag, "tm_complete"); - } - - spin_lock_irqsave(hba->host->host_lock, flags); -- __clear_bit(free_slot, &hba->outstanding_tasks); -+ __clear_bit(task_tag, &hba->outstanding_tasks); - spin_unlock_irqrestore(hba->host->host_lock, flags); - -+ ufshcd_release(hba); - blk_put_request(req); - -- ufshcd_release(hba); - return err; - } - -diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c -index a1b9be1d105a0..fde4edd83c14c 100644 ---- a/drivers/soc/fsl/qbman/qman.c -+++ b/drivers/soc/fsl/qbman/qman.c -@@ -186,7 +186,7 @@ struct qm_eqcr_entry { - __be32 tag; - struct qm_fd fd; - u8 __reserved3[32]; --} __packed; -+} __packed __aligned(8); - #define QM_EQCR_VERB_VBIT 0x80 - #define QM_EQCR_VERB_CMD_MASK 0x61 /* but only one value; */ - #define QM_EQCR_VERB_CMD_ENQUEUE 0x01 -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index 518fac4864cfa..a237f1cf9bd60 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -1166,6 +1166,7 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, - - target_get_sess_cmd(&cmd->se_cmd, true); - -+ cmd->se_cmd.tag = (__force u32)cmd->init_task_tag; - cmd->sense_reason = target_cmd_init_cdb(&cmd->se_cmd, hdr->cdb); - if (cmd->sense_reason) { - if (cmd->sense_reason == TCM_OUT_OF_RESOURCES) { -@@ -1180,8 +1181,6 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, - if (cmd->sense_reason) - goto attach_cmd; - -- /* only used for printks or comparing with ->ref_task_tag */ -- cmd->se_cmd.tag = (__force u32)cmd->init_task_tag; - cmd->sense_reason = target_cmd_parse_cdb(&cmd->se_cmd); - if (cmd->sense_reason) - goto attach_cmd; -diff --git a/drivers/thunderbolt/retimer.c b/drivers/thunderbolt/retimer.c -index 620bcf586ee24..c44fad2b9fbbf 100644 ---- a/drivers/thunderbolt/retimer.c -+++ b/drivers/thunderbolt/retimer.c -@@ -347,7 +347,7 @@ static int tb_retimer_add(struct tb_port *port, u8 index, u32 auth_status) - ret = tb_retimer_nvm_add(rt); - if (ret) { - dev_err(&rt->dev, "failed to add NVM devices: %d\n", ret); -- device_del(&rt->dev); -+ device_unregister(&rt->dev); - return ret; - } - -@@ -406,7 +406,7 @@ static struct tb_retimer *tb_port_find_retimer(struct tb_port *port, u8 index) - */ - int tb_retimer_scan(struct tb_port *port) - { -- u32 status[TB_MAX_RETIMER_INDEX] = {}; -+ u32 status[TB_MAX_RETIMER_INDEX + 1] = {}; - int ret, i, last_idx = 0; - - if (!port->cap_usb4) -diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c -index 8f1de1fbbeedf..d8d3892e5a69a 100644 ---- a/drivers/usb/usbip/stub_dev.c -+++ b/drivers/usb/usbip/stub_dev.c -@@ -63,6 +63,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a - - dev_info(dev, "stub up\n"); - -+ mutex_lock(&sdev->ud.sysfs_lock); - spin_lock_irq(&sdev->ud.lock); - - if (sdev->ud.status != SDEV_ST_AVAILABLE) { -@@ -87,13 +88,13 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a - tcp_rx = kthread_create(stub_rx_loop, &sdev->ud, "stub_rx"); - if (IS_ERR(tcp_rx)) { - sockfd_put(socket); -- return -EINVAL; -+ goto unlock_mutex; - } - tcp_tx = kthread_create(stub_tx_loop, &sdev->ud, "stub_tx"); - if (IS_ERR(tcp_tx)) { - kthread_stop(tcp_rx); - sockfd_put(socket); -- return -EINVAL; -+ goto unlock_mutex; - } - - /* get task structs now */ -@@ -112,6 +113,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a - wake_up_process(sdev->ud.tcp_rx); - wake_up_process(sdev->ud.tcp_tx); - -+ mutex_unlock(&sdev->ud.sysfs_lock); -+ - } else { - dev_info(dev, "stub down\n"); - -@@ -122,6 +125,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a - spin_unlock_irq(&sdev->ud.lock); - - usbip_event_add(&sdev->ud, SDEV_EVENT_DOWN); -+ mutex_unlock(&sdev->ud.sysfs_lock); - } - - return count; -@@ -130,6 +134,8 @@ sock_err: - sockfd_put(socket); - err: - spin_unlock_irq(&sdev->ud.lock); -+unlock_mutex: -+ mutex_unlock(&sdev->ud.sysfs_lock); - return -EINVAL; - } - static DEVICE_ATTR_WO(usbip_sockfd); -@@ -270,6 +276,7 @@ static struct stub_device *stub_device_alloc(struct usb_device *udev) - sdev->ud.side = USBIP_STUB; - sdev->ud.status = SDEV_ST_AVAILABLE; - spin_lock_init(&sdev->ud.lock); -+ mutex_init(&sdev->ud.sysfs_lock); - sdev->ud.tcp_socket = NULL; - sdev->ud.sockfd = -1; - -diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h -index 8be857a4fa132..a7e6ce96f62c7 100644 ---- a/drivers/usb/usbip/usbip_common.h -+++ b/drivers/usb/usbip/usbip_common.h -@@ -263,6 +263,9 @@ struct usbip_device { - /* lock for status */ - spinlock_t lock; - -+ /* mutex for synchronizing sysfs store paths */ -+ struct mutex sysfs_lock; -+ - int sockfd; - struct socket *tcp_socket; - -diff --git a/drivers/usb/usbip/usbip_event.c b/drivers/usb/usbip/usbip_event.c -index 5d88917c96314..086ca76dd0531 100644 ---- a/drivers/usb/usbip/usbip_event.c -+++ b/drivers/usb/usbip/usbip_event.c -@@ -70,6 +70,7 @@ static void event_handler(struct work_struct *work) - while ((ud = get_event()) != NULL) { - usbip_dbg_eh("pending event %lx\n", ud->event); - -+ mutex_lock(&ud->sysfs_lock); - /* - * NOTE: shutdown must come first. - * Shutdown the device. -@@ -90,6 +91,7 @@ static void event_handler(struct work_struct *work) - ud->eh_ops.unusable(ud); - unset_event(ud, USBIP_EH_UNUSABLE); - } -+ mutex_unlock(&ud->sysfs_lock); - - wake_up(&ud->eh_waitq); - } -diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c -index a20a8380ca0c9..4ba6bcdaa8e9d 100644 ---- a/drivers/usb/usbip/vhci_hcd.c -+++ b/drivers/usb/usbip/vhci_hcd.c -@@ -1101,6 +1101,7 @@ static void vhci_device_init(struct vhci_device *vdev) - vdev->ud.side = USBIP_VHCI; - vdev->ud.status = VDEV_ST_NULL; - spin_lock_init(&vdev->ud.lock); -+ mutex_init(&vdev->ud.sysfs_lock); - - INIT_LIST_HEAD(&vdev->priv_rx); - INIT_LIST_HEAD(&vdev->priv_tx); -diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c -index e64ea314930be..ebc7be1d98207 100644 ---- a/drivers/usb/usbip/vhci_sysfs.c -+++ b/drivers/usb/usbip/vhci_sysfs.c -@@ -185,6 +185,8 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport) - - usbip_dbg_vhci_sysfs("enter\n"); - -+ mutex_lock(&vdev->ud.sysfs_lock); -+ - /* lock */ - spin_lock_irqsave(&vhci->lock, flags); - spin_lock(&vdev->ud.lock); -@@ -195,6 +197,7 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport) - /* unlock */ - spin_unlock(&vdev->ud.lock); - spin_unlock_irqrestore(&vhci->lock, flags); -+ mutex_unlock(&vdev->ud.sysfs_lock); - - return -EINVAL; - } -@@ -205,6 +208,8 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport) - - usbip_event_add(&vdev->ud, VDEV_EVENT_DOWN); - -+ mutex_unlock(&vdev->ud.sysfs_lock); -+ - return 0; - } - -@@ -349,30 +354,36 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, - else - vdev = &vhci->vhci_hcd_hs->vdev[rhport]; - -+ mutex_lock(&vdev->ud.sysfs_lock); -+ - /* Extract socket from fd. */ - socket = sockfd_lookup(sockfd, &err); - if (!socket) { - dev_err(dev, "failed to lookup sock"); -- return -EINVAL; -+ err = -EINVAL; -+ goto unlock_mutex; - } - if (socket->type != SOCK_STREAM) { - dev_err(dev, "Expecting SOCK_STREAM - found %d", - socket->type); - sockfd_put(socket); -- return -EINVAL; -+ err = -EINVAL; -+ goto unlock_mutex; - } - - /* create threads before locking */ - tcp_rx = kthread_create(vhci_rx_loop, &vdev->ud, "vhci_rx"); - if (IS_ERR(tcp_rx)) { - sockfd_put(socket); -- return -EINVAL; -+ err = -EINVAL; -+ goto unlock_mutex; - } - tcp_tx = kthread_create(vhci_tx_loop, &vdev->ud, "vhci_tx"); - if (IS_ERR(tcp_tx)) { - kthread_stop(tcp_rx); - sockfd_put(socket); -- return -EINVAL; -+ err = -EINVAL; -+ goto unlock_mutex; - } - - /* get task structs now */ -@@ -397,7 +408,8 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, - * Will be retried from userspace - * if there's another free port. - */ -- return -EBUSY; -+ err = -EBUSY; -+ goto unlock_mutex; - } - - dev_info(dev, "pdev(%u) rhport(%u) sockfd(%d)\n", -@@ -422,7 +434,15 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, - - rh_port_connect(vdev, speed); - -+ dev_info(dev, "Device attached\n"); -+ -+ mutex_unlock(&vdev->ud.sysfs_lock); -+ - return count; -+ -+unlock_mutex: -+ mutex_unlock(&vdev->ud.sysfs_lock); -+ return err; - } - static DEVICE_ATTR_WO(attach); - -diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c -index c8eeabdd9b568..2bc428f2e2610 100644 ---- a/drivers/usb/usbip/vudc_dev.c -+++ b/drivers/usb/usbip/vudc_dev.c -@@ -572,6 +572,7 @@ static int init_vudc_hw(struct vudc *udc) - init_waitqueue_head(&udc->tx_waitq); - - spin_lock_init(&ud->lock); -+ mutex_init(&ud->sysfs_lock); - ud->status = SDEV_ST_AVAILABLE; - ud->side = USBIP_VUDC; - -diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c -index 7383a543c6d12..f7633ee655a17 100644 ---- a/drivers/usb/usbip/vudc_sysfs.c -+++ b/drivers/usb/usbip/vudc_sysfs.c -@@ -112,6 +112,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, - dev_err(dev, "no device"); - return -ENODEV; - } -+ mutex_lock(&udc->ud.sysfs_lock); - spin_lock_irqsave(&udc->lock, flags); - /* Don't export what we don't have */ - if (!udc->driver || !udc->pullup) { -@@ -187,6 +188,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, - - wake_up_process(udc->ud.tcp_rx); - wake_up_process(udc->ud.tcp_tx); -+ -+ mutex_unlock(&udc->ud.sysfs_lock); - return count; - - } else { -@@ -207,6 +210,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, - } - - spin_unlock_irqrestore(&udc->lock, flags); -+ mutex_unlock(&udc->ud.sysfs_lock); - - return count; - -@@ -216,6 +220,7 @@ unlock_ud: - spin_unlock_irq(&udc->ud.lock); - unlock: - spin_unlock_irqrestore(&udc->lock, flags); -+ mutex_unlock(&udc->ud.sysfs_lock); - - return ret; - } -diff --git a/drivers/vdpa/mlx5/core/mlx5_vdpa.h b/drivers/vdpa/mlx5/core/mlx5_vdpa.h -index 08f742fd24099..b6cc53ba980cc 100644 ---- a/drivers/vdpa/mlx5/core/mlx5_vdpa.h -+++ b/drivers/vdpa/mlx5/core/mlx5_vdpa.h -@@ -4,9 +4,13 @@ - #ifndef __MLX5_VDPA_H__ - #define __MLX5_VDPA_H__ - -+#include -+#include - #include - #include - -+#define MLX5V_ETH_HARD_MTU (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN) -+ - struct mlx5_vdpa_direct_mr { - u64 start; - u64 end; -diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c -index 25fd971be63f7..ac6be2d722bb2 100644 ---- a/drivers/vdpa/mlx5/net/mlx5_vnet.c -+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c -@@ -820,7 +820,7 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque - MLX5_SET(virtio_q, vq_ctx, event_qpn_or_msix, mvq->fwqp.mqp.qpn); - MLX5_SET(virtio_q, vq_ctx, queue_size, mvq->num_ent); - MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, -- !!(ndev->mvdev.actual_features & VIRTIO_F_VERSION_1)); -+ !!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_F_VERSION_1))); - MLX5_SET64(virtio_q, vq_ctx, desc_addr, mvq->desc_addr); - MLX5_SET64(virtio_q, vq_ctx, used_addr, mvq->device_addr); - MLX5_SET64(virtio_q, vq_ctx, available_addr, mvq->driver_addr); -@@ -1169,6 +1169,7 @@ static void suspend_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *m - return; - } - mvq->avail_idx = attr.available_index; -+ mvq->used_idx = attr.used_index; - } - - static void suspend_vqs(struct mlx5_vdpa_net *ndev) -@@ -1426,6 +1427,7 @@ static int mlx5_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx, - return -EINVAL; - } - -+ mvq->used_idx = state->avail_index; - mvq->avail_idx = state->avail_index; - return 0; - } -@@ -1443,7 +1445,11 @@ static int mlx5_vdpa_get_vq_state(struct vdpa_device *vdev, u16 idx, struct vdpa - * that cares about emulating the index after vq is stopped. - */ - if (!mvq->initialized) { -- state->avail_index = mvq->avail_idx; -+ /* Firmware returns a wrong value for the available index. -+ * Since both values should be identical, we take the value of -+ * used_idx which is reported correctly. -+ */ -+ state->avail_index = mvq->used_idx; - return 0; - } - -@@ -1452,7 +1458,7 @@ static int mlx5_vdpa_get_vq_state(struct vdpa_device *vdev, u16 idx, struct vdpa - mlx5_vdpa_warn(mvdev, "failed to query virtqueue\n"); - return err; - } -- state->avail_index = attr.available_index; -+ state->avail_index = attr.used_index; - return 0; - } - -@@ -1540,21 +1546,11 @@ static void teardown_virtqueues(struct mlx5_vdpa_net *ndev) - } - } - --static void clear_virtqueues(struct mlx5_vdpa_net *ndev) --{ -- int i; -- -- for (i = ndev->mvdev.max_vqs - 1; i >= 0; i--) { -- ndev->vqs[i].avail_idx = 0; -- ndev->vqs[i].used_idx = 0; -- } --} -- - /* TODO: cross-endian support */ - static inline bool mlx5_vdpa_is_little_endian(struct mlx5_vdpa_dev *mvdev) - { - return virtio_legacy_is_little_endian() || -- (mvdev->actual_features & (1ULL << VIRTIO_F_VERSION_1)); -+ (mvdev->actual_features & BIT_ULL(VIRTIO_F_VERSION_1)); - } - - static __virtio16 cpu_to_mlx5vdpa16(struct mlx5_vdpa_dev *mvdev, u16 val) -@@ -1785,7 +1781,6 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) - if (!status) { - mlx5_vdpa_info(mvdev, "performing device reset\n"); - teardown_driver(ndev); -- clear_virtqueues(ndev); - mlx5_vdpa_destroy_mr(&ndev->mvdev); - ndev->mvdev.status = 0; - ndev->mvdev.mlx_features = 0; -@@ -1907,6 +1902,19 @@ static const struct vdpa_config_ops mlx5_vdpa_ops = { - .free = mlx5_vdpa_free, - }; - -+static int query_mtu(struct mlx5_core_dev *mdev, u16 *mtu) -+{ -+ u16 hw_mtu; -+ int err; -+ -+ err = mlx5_query_nic_vport_mtu(mdev, &hw_mtu); -+ if (err) -+ return err; -+ -+ *mtu = hw_mtu - MLX5V_ETH_HARD_MTU; -+ return 0; -+} -+ - static int alloc_resources(struct mlx5_vdpa_net *ndev) - { - struct mlx5_vdpa_net_resources *res = &ndev->res; -@@ -1992,7 +2000,7 @@ static int mlx5v_probe(struct auxiliary_device *adev, - init_mvqs(ndev); - mutex_init(&ndev->reslock); - config = &ndev->config; -- err = mlx5_query_nic_vport_mtu(mdev, &ndev->mtu); -+ err = query_mtu(mdev, &ndev->mtu); - if (err) - goto err_mtu; - -diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c -index d9148609bd09a..1664edcdffd11 100644 ---- a/drivers/xen/events/events_base.c -+++ b/drivers/xen/events/events_base.c -@@ -109,7 +109,7 @@ struct irq_info { - unsigned short eoi_cpu; /* EOI must happen on this cpu-1 */ - unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */ - u64 eoi_time; /* Time in jiffies when to EOI. */ -- spinlock_t lock; -+ raw_spinlock_t lock; - - union { - unsigned short virq; -@@ -310,7 +310,7 @@ static int xen_irq_info_common_setup(struct irq_info *info, - info->evtchn = evtchn; - info->cpu = cpu; - info->mask_reason = EVT_MASK_REASON_EXPLICIT; -- spin_lock_init(&info->lock); -+ raw_spin_lock_init(&info->lock); - - ret = set_evtchn_to_irq(evtchn, irq); - if (ret < 0) -@@ -463,28 +463,28 @@ static void do_mask(struct irq_info *info, u8 reason) - { - unsigned long flags; - -- spin_lock_irqsave(&info->lock, flags); -+ raw_spin_lock_irqsave(&info->lock, flags); - - if (!info->mask_reason) - mask_evtchn(info->evtchn); - - info->mask_reason |= reason; - -- spin_unlock_irqrestore(&info->lock, flags); -+ raw_spin_unlock_irqrestore(&info->lock, flags); - } - - static void do_unmask(struct irq_info *info, u8 reason) - { - unsigned long flags; - -- spin_lock_irqsave(&info->lock, flags); -+ raw_spin_lock_irqsave(&info->lock, flags); - - info->mask_reason &= ~reason; - - if (!info->mask_reason) - unmask_evtchn(info->evtchn); - -- spin_unlock_irqrestore(&info->lock, flags); -+ raw_spin_unlock_irqrestore(&info->lock, flags); - } - - #ifdef CONFIG_X86 -diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig -index fe03cbdae9592..bf52e9326ebe8 100644 ---- a/fs/cifs/Kconfig -+++ b/fs/cifs/Kconfig -@@ -18,6 +18,7 @@ config CIFS - select CRYPTO_AES - select CRYPTO_LIB_DES - select KEYS -+ select DNS_RESOLVER - help - This is the client VFS module for the SMB3 family of NAS protocols, - (including support for the most recent, most secure dialect SMB3.1.1) -@@ -112,7 +113,6 @@ config CIFS_WEAK_PW_HASH - config CIFS_UPCALL - bool "Kerberos/SPNEGO advanced session setup" - depends on CIFS -- select DNS_RESOLVER - help - Enables an upcall mechanism for CIFS which accesses userspace helper - utilities to provide SPNEGO packaged (RFC 4178) Kerberos tickets -@@ -179,7 +179,6 @@ config CIFS_DEBUG_DUMP_KEYS - config CIFS_DFS_UPCALL - bool "DFS feature support" - depends on CIFS -- select DNS_RESOLVER - help - Distributed File System (DFS) support is used to access shares - transparently in an enterprise name space, even if the share -diff --git a/fs/cifs/Makefile b/fs/cifs/Makefile -index 5213b20843b50..3ee3b7de4dedf 100644 ---- a/fs/cifs/Makefile -+++ b/fs/cifs/Makefile -@@ -10,13 +10,14 @@ cifs-y := trace.o cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o \ - cifs_unicode.o nterr.o cifsencrypt.o \ - readdir.o ioctl.o sess.o export.o smb1ops.o unc.o winucase.o \ - smb2ops.o smb2maperror.o smb2transport.o \ -- smb2misc.o smb2pdu.o smb2inode.o smb2file.o cifsacl.o fs_context.o -+ smb2misc.o smb2pdu.o smb2inode.o smb2file.o cifsacl.o fs_context.o \ -+ dns_resolve.o - - cifs-$(CONFIG_CIFS_XATTR) += xattr.o - - cifs-$(CONFIG_CIFS_UPCALL) += cifs_spnego.o - --cifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o cifs_dfs_ref.o dfs_cache.o -+cifs-$(CONFIG_CIFS_DFS_UPCALL) += cifs_dfs_ref.o dfs_cache.o - - cifs-$(CONFIG_CIFS_SWN_UPCALL) += netlink.o cifs_swn.o - -diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c -index 8a6a1772590bf..8fc877fb369e7 100644 ---- a/fs/cifs/cifsfs.c -+++ b/fs/cifs/cifsfs.c -@@ -475,7 +475,8 @@ static int cifs_show_devname(struct seq_file *m, struct dentry *root) - seq_puts(m, "none"); - else { - convert_delimiter(devname, '/'); -- seq_puts(m, devname); -+ /* escape all spaces in share names */ -+ seq_escape(m, devname, " \t"); - kfree(devname); - } - return 0; -diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c -index 70d0f0388af47..2b72b8893affa 100644 ---- a/fs/cifs/connect.c -+++ b/fs/cifs/connect.c -@@ -87,7 +87,6 @@ static void cifs_prune_tlinks(struct work_struct *work); - * - * This should be called with server->srv_mutex held. - */ --#ifdef CONFIG_CIFS_DFS_UPCALL - static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server) - { - int rc; -@@ -124,6 +123,7 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server) - return !rc ? -1 : 0; - } - -+#ifdef CONFIG_CIFS_DFS_UPCALL - /* These functions must be called with server->srv_mutex held */ - static void reconn_set_next_dfs_target(struct TCP_Server_Info *server, - struct cifs_sb_info *cifs_sb, -@@ -321,14 +321,29 @@ cifs_reconnect(struct TCP_Server_Info *server) - #endif - - #ifdef CONFIG_CIFS_DFS_UPCALL -+ if (cifs_sb && cifs_sb->origin_fullpath) - /* - * Set up next DFS target server (if any) for reconnect. If DFS - * feature is disabled, then we will retry last server we - * connected to before. - */ - reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it); -+ else { -+#endif -+ /* -+ * Resolve the hostname again to make sure that IP address is up-to-date. -+ */ -+ rc = reconn_set_ipaddr_from_hostname(server); -+ if (rc) { -+ cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n", -+ __func__, rc); -+ } -+ -+#ifdef CONFIG_CIFS_DFS_UPCALL -+ } - #endif - -+ - #ifdef CONFIG_CIFS_SWN_UPCALL - } - #endif -diff --git a/fs/direct-io.c b/fs/direct-io.c -index d53fa92a1ab65..c64d4eb38995a 100644 ---- a/fs/direct-io.c -+++ b/fs/direct-io.c -@@ -810,6 +810,7 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page, - struct buffer_head *map_bh) - { - int ret = 0; -+ int boundary = sdio->boundary; /* dio_send_cur_page may clear it */ - - if (dio->op == REQ_OP_WRITE) { - /* -@@ -848,10 +849,10 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page, - sdio->cur_page_fs_offset = sdio->block_in_file << sdio->blkbits; - out: - /* -- * If sdio->boundary then we want to schedule the IO now to -+ * If boundary then we want to schedule the IO now to - * avoid metadata seeks. - */ -- if (sdio->boundary) { -+ if (boundary) { - ret = dio_send_cur_page(dio, sdio, map_bh); - if (sdio->bio) - dio_bio_submit(dio, sdio); -diff --git a/fs/file.c b/fs/file.c -index f3a4bac2cbe91..f633348029a5a 100644 ---- a/fs/file.c -+++ b/fs/file.c -@@ -629,17 +629,30 @@ int close_fd(unsigned fd) - } - EXPORT_SYMBOL(close_fd); /* for ksys_close() */ - -+/** -+ * last_fd - return last valid index into fd table -+ * @cur_fds: files struct -+ * -+ * Context: Either rcu read lock or files_lock must be held. -+ * -+ * Returns: Last valid index into fdtable. -+ */ -+static inline unsigned last_fd(struct fdtable *fdt) -+{ -+ return fdt->max_fds - 1; -+} -+ - static inline void __range_cloexec(struct files_struct *cur_fds, - unsigned int fd, unsigned int max_fd) - { - struct fdtable *fdt; - -- if (fd > max_fd) -- return; -- -+ /* make sure we're using the correct maximum value */ - spin_lock(&cur_fds->file_lock); - fdt = files_fdtable(cur_fds); -- bitmap_set(fdt->close_on_exec, fd, max_fd - fd + 1); -+ max_fd = min(last_fd(fdt), max_fd); -+ if (fd <= max_fd) -+ bitmap_set(fdt->close_on_exec, fd, max_fd - fd + 1); - spin_unlock(&cur_fds->file_lock); - } - -diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c -index aea35459d3903..07467ca0f71d3 100644 ---- a/fs/hostfs/hostfs_kern.c -+++ b/fs/hostfs/hostfs_kern.c -@@ -142,7 +142,7 @@ static char *follow_link(char *link) - char *name, *resolved, *end; - int n; - -- name = __getname(); -+ name = kmalloc(PATH_MAX, GFP_KERNEL); - if (!name) { - n = -ENOMEM; - goto out_free; -@@ -171,12 +171,11 @@ static char *follow_link(char *link) - goto out_free; - } - -- __putname(name); -- kfree(link); -+ kfree(name); - return resolved; - - out_free: -- __putname(name); -+ kfree(name); - return ERR_PTR(n); - } - -diff --git a/fs/namei.c b/fs/namei.c -index dd85e12ac85a6..b7c0dcc25bd48 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -2330,16 +2330,16 @@ static int path_lookupat(struct nameidata *nd, unsigned flags, struct path *path - while (!(err = link_path_walk(s, nd)) && - (s = lookup_last(nd)) != NULL) - ; -+ if (!err && unlikely(nd->flags & LOOKUP_MOUNTPOINT)) { -+ err = handle_lookup_down(nd); -+ nd->flags &= ~LOOKUP_JUMPED; // no d_weak_revalidate(), please... -+ } - if (!err) - err = complete_walk(nd); - - if (!err && nd->flags & LOOKUP_DIRECTORY) - if (!d_can_lookup(nd->path.dentry)) - err = -ENOTDIR; -- if (!err && unlikely(nd->flags & LOOKUP_MOUNTPOINT)) { -- err = handle_lookup_down(nd); -- nd->flags &= ~LOOKUP_JUMPED; // no d_weak_revalidate(), please... -- } - if (!err) { - *path = nd->path; - nd->path.mnt = NULL; -diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c -index 3bfb4147895a0..ad20403b383fa 100644 ---- a/fs/ocfs2/aops.c -+++ b/fs/ocfs2/aops.c -@@ -2295,7 +2295,7 @@ static int ocfs2_dio_end_io_write(struct inode *inode, - struct ocfs2_alloc_context *meta_ac = NULL; - handle_t *handle = NULL; - loff_t end = offset + bytes; -- int ret = 0, credits = 0, locked = 0; -+ int ret = 0, credits = 0; - - ocfs2_init_dealloc_ctxt(&dealloc); - -@@ -2306,13 +2306,6 @@ static int ocfs2_dio_end_io_write(struct inode *inode, - !dwc->dw_orphaned) - goto out; - -- /* ocfs2_file_write_iter will get i_mutex, so we need not lock if we -- * are in that context. */ -- if (dwc->dw_writer_pid != task_pid_nr(current)) { -- inode_lock(inode); -- locked = 1; -- } -- - ret = ocfs2_inode_lock(inode, &di_bh, 1); - if (ret < 0) { - mlog_errno(ret); -@@ -2393,8 +2386,6 @@ out: - if (meta_ac) - ocfs2_free_alloc_context(meta_ac); - ocfs2_run_deallocs(osb, &dealloc); -- if (locked) -- inode_unlock(inode); - ocfs2_dio_free_write_ctx(inode, dwc); - - return ret; -diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c -index 85979e2214b39..8880071ee4ee0 100644 ---- a/fs/ocfs2/file.c -+++ b/fs/ocfs2/file.c -@@ -1244,22 +1244,24 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) - goto bail_unlock; - } - } -+ down_write(&OCFS2_I(inode)->ip_alloc_sem); - handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS + - 2 * ocfs2_quota_trans_credits(sb)); - if (IS_ERR(handle)) { - status = PTR_ERR(handle); - mlog_errno(status); -- goto bail_unlock; -+ goto bail_unlock_alloc; - } - status = __dquot_transfer(inode, transfer_to); - if (status < 0) - goto bail_commit; - } else { -+ down_write(&OCFS2_I(inode)->ip_alloc_sem); - handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); - if (IS_ERR(handle)) { - status = PTR_ERR(handle); - mlog_errno(status); -- goto bail_unlock; -+ goto bail_unlock_alloc; - } - } - -@@ -1272,6 +1274,8 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) - - bail_commit: - ocfs2_commit_trans(osb, handle); -+bail_unlock_alloc: -+ up_write(&OCFS2_I(inode)->ip_alloc_sem); - bail_unlock: - if (status && inode_locked) { - ocfs2_inode_unlock_tracker(inode, 1, &oh, had_lock); -diff --git a/include/linux/avf/virtchnl.h b/include/linux/avf/virtchnl.h -index 40bad71865ea7..532bcbfc47161 100644 ---- a/include/linux/avf/virtchnl.h -+++ b/include/linux/avf/virtchnl.h -@@ -476,7 +476,6 @@ struct virtchnl_rss_key { - u16 vsi_id; - u16 key_len; - u8 key[1]; /* RSS hash key, packed bytes */ -- u8 pad[1]; - }; - - VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_key); -@@ -485,7 +484,6 @@ struct virtchnl_rss_lut { - u16 vsi_id; - u16 lut_entries; - u8 lut[1]; /* RSS lookup table */ -- u8 pad[1]; - }; - - VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_lut); -diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h -index 442c0160caab5..6370ba10f1fd2 100644 ---- a/include/linux/mlx5/mlx5_ifc.h -+++ b/include/linux/mlx5/mlx5_ifc.h -@@ -437,11 +437,11 @@ struct mlx5_ifc_flow_table_prop_layout_bits { - u8 reserved_at_60[0x18]; - u8 log_max_ft_num[0x8]; - -- u8 reserved_at_80[0x18]; -+ u8 reserved_at_80[0x10]; -+ u8 log_max_flow_counter[0x8]; - u8 log_max_destination[0x8]; - -- u8 log_max_flow_counter[0x8]; -- u8 reserved_at_a8[0x10]; -+ u8 reserved_at_a0[0x18]; - u8 log_max_flow[0x8]; - - u8 reserved_at_c0[0x40]; -@@ -8769,6 +8769,8 @@ struct mlx5_ifc_pplm_reg_bits { - - u8 fec_override_admin_100g_2x[0x10]; - u8 fec_override_admin_50g_1x[0x10]; -+ -+ u8 reserved_at_140[0x140]; - }; - - struct mlx5_ifc_ppcnt_reg_bits { -@@ -10106,7 +10108,7 @@ struct mlx5_ifc_pbmc_reg_bits { - - struct mlx5_ifc_bufferx_reg_bits buffer[10]; - -- u8 reserved_at_2e0[0x40]; -+ u8 reserved_at_2e0[0x80]; - }; - - struct mlx5_ifc_qtct_reg_bits { -diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h -index fec0c5ac1c4f9..82126d5297986 100644 ---- a/include/linux/skmsg.h -+++ b/include/linux/skmsg.h -@@ -349,8 +349,13 @@ static inline void sk_psock_update_proto(struct sock *sk, - static inline void sk_psock_restore_proto(struct sock *sk, - struct sk_psock *psock) - { -- sk->sk_prot->unhash = psock->saved_unhash; - if (inet_csk_has_ulp(sk)) { -+ /* TLS does not have an unhash proto in SW cases, but we need -+ * to ensure we stop using the sock_map unhash routine because -+ * the associated psock is being removed. So use the original -+ * unhash handler. -+ */ -+ WRITE_ONCE(sk->sk_prot->unhash, psock->saved_unhash); - tcp_update_ulp(sk, psock->sk_proto, psock->saved_write_space); - } else { - sk->sk_write_space = psock->saved_write_space; -diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h -index 6b5fcfa1e5553..98775d7fa6963 100644 ---- a/include/linux/virtio_net.h -+++ b/include/linux/virtio_net.h -@@ -62,6 +62,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, - return -EINVAL; - } - -+ skb_reset_mac_header(skb); -+ - if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { - u16 start = __virtio16_to_cpu(little_endian, hdr->csum_start); - u16 off = __virtio16_to_cpu(little_endian, hdr->csum_offset); -diff --git a/include/net/act_api.h b/include/net/act_api.h -index 2bf3092ae7ecc..086b291e9530b 100644 ---- a/include/net/act_api.h -+++ b/include/net/act_api.h -@@ -170,12 +170,7 @@ void tcf_idr_insert_many(struct tc_action *actions[]); - void tcf_idr_cleanup(struct tc_action_net *tn, u32 index); - int tcf_idr_check_alloc(struct tc_action_net *tn, u32 *index, - struct tc_action **a, int bind); --int __tcf_idr_release(struct tc_action *a, bool bind, bool strict); -- --static inline int tcf_idr_release(struct tc_action *a, bool bind) --{ -- return __tcf_idr_release(a, bind, false); --} -+int tcf_idr_release(struct tc_action *a, bool bind); - - int tcf_register_action(struct tc_action_ops *a, struct pernet_operations *ops); - int tcf_unregister_action(struct tc_action_ops *a, -@@ -185,7 +180,7 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions, - int nr_actions, struct tcf_result *res); - int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, - struct nlattr *est, char *name, int ovr, int bind, -- struct tc_action *actions[], size_t *attr_size, -+ struct tc_action *actions[], int init_res[], size_t *attr_size, - bool rtnl_held, struct netlink_ext_ack *extack); - struct tc_action_ops *tc_action_load_ops(char *name, struct nlattr *nla, - bool rtnl_held, -@@ -193,7 +188,8 @@ struct tc_action_ops *tc_action_load_ops(char *name, struct nlattr *nla, - struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, - struct nlattr *nla, struct nlattr *est, - char *name, int ovr, int bind, -- struct tc_action_ops *ops, bool rtnl_held, -+ struct tc_action_ops *a_o, int *init_res, -+ bool rtnl_held, - struct netlink_ext_ack *extack); - int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[], int bind, - int ref, bool terse); -diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h -index 59f45b1e9dac0..b59d73d529ba7 100644 ---- a/include/net/netns/xfrm.h -+++ b/include/net/netns/xfrm.h -@@ -72,7 +72,9 @@ struct netns_xfrm { - #if IS_ENABLED(CONFIG_IPV6) - struct dst_ops xfrm6_dst_ops; - #endif -- spinlock_t xfrm_state_lock; -+ spinlock_t xfrm_state_lock; -+ seqcount_t xfrm_state_hash_generation; -+ - spinlock_t xfrm_policy_lock; - struct mutex xfrm_cfg_mutex; - }; -diff --git a/include/net/red.h b/include/net/red.h -index 9e6647c4ccd1f..cc9f6b0d7f1e9 100644 ---- a/include/net/red.h -+++ b/include/net/red.h -@@ -171,9 +171,9 @@ static inline void red_set_vars(struct red_vars *v) - static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog, - u8 Scell_log, u8 *stab) - { -- if (fls(qth_min) + Wlog > 32) -+ if (fls(qth_min) + Wlog >= 32) - return false; -- if (fls(qth_max) + Wlog > 32) -+ if (fls(qth_max) + Wlog >= 32) - return false; - if (Scell_log >= 32) - return false; -diff --git a/include/net/sock.h b/include/net/sock.h -index 129d200bccb46..6f44084104626 100644 ---- a/include/net/sock.h -+++ b/include/net/sock.h -@@ -2215,6 +2215,15 @@ static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk) - sk_mem_charge(sk, skb->truesize); - } - -+static inline void skb_set_owner_sk_safe(struct sk_buff *skb, struct sock *sk) -+{ -+ if (sk && refcount_inc_not_zero(&sk->sk_refcnt)) { -+ skb_orphan(skb); -+ skb->destructor = sock_efree; -+ skb->sk = sk; -+ } -+} -+ - void sk_reset_timer(struct sock *sk, struct timer_list *timer, - unsigned long expires); - -diff --git a/include/net/xfrm.h b/include/net/xfrm.h -index b2a06f10b62ce..c58a6d4eb6103 100644 ---- a/include/net/xfrm.h -+++ b/include/net/xfrm.h -@@ -1097,7 +1097,7 @@ static inline int __xfrm_policy_check2(struct sock *sk, int dir, - return __xfrm_policy_check(sk, ndir, skb, family); - - return (!net->xfrm.policy_count[dir] && !secpath_exists(skb)) || -- (skb_dst(skb)->flags & DST_NOPOLICY) || -+ (skb_dst(skb) && (skb_dst(skb)->flags & DST_NOPOLICY)) || - __xfrm_policy_check(sk, ndir, skb, family); - } - -@@ -1557,7 +1557,7 @@ int xfrm_trans_queue_net(struct net *net, struct sk_buff *skb, - int xfrm_trans_queue(struct sk_buff *skb, - int (*finish)(struct net *, struct sock *, - struct sk_buff *)); --int xfrm_output_resume(struct sk_buff *skb, int err); -+int xfrm_output_resume(struct sock *sk, struct sk_buff *skb, int err); - int xfrm_output(struct sock *sk, struct sk_buff *skb); - - #if IS_ENABLED(CONFIG_NET_PKTGEN) -diff --git a/include/uapi/linux/can.h b/include/uapi/linux/can.h -index f75238ac6dced..c7535352fef64 100644 ---- a/include/uapi/linux/can.h -+++ b/include/uapi/linux/can.h -@@ -113,7 +113,7 @@ struct can_frame { - */ - __u8 len; - __u8 can_dlc; /* deprecated */ -- }; -+ } __attribute__((packed)); /* disable padding added in some ABIs */ - __u8 __pad; /* padding */ - __u8 __res0; /* reserved / padding */ - __u8 len8_dlc; /* optional DLC for 8 byte payload length (9 .. 15) */ -diff --git a/include/uapi/linux/rfkill.h b/include/uapi/linux/rfkill.h -index 03e8af87b364c..9b77cfc42efa3 100644 ---- a/include/uapi/linux/rfkill.h -+++ b/include/uapi/linux/rfkill.h -@@ -86,34 +86,90 @@ enum rfkill_hard_block_reasons { - * @op: operation code - * @hard: hard state (0/1) - * @soft: soft state (0/1) -+ * -+ * Structure used for userspace communication on /dev/rfkill, -+ * used for events from the kernel and control to the kernel. -+ */ -+struct rfkill_event { -+ __u32 idx; -+ __u8 type; -+ __u8 op; -+ __u8 soft; -+ __u8 hard; -+} __attribute__((packed)); -+ -+/** -+ * struct rfkill_event_ext - events for userspace on /dev/rfkill -+ * @idx: index of dev rfkill -+ * @type: type of the rfkill struct -+ * @op: operation code -+ * @hard: hard state (0/1) -+ * @soft: soft state (0/1) - * @hard_block_reasons: valid if hard is set. One or several reasons from - * &enum rfkill_hard_block_reasons. - * - * Structure used for userspace communication on /dev/rfkill, - * used for events from the kernel and control to the kernel. -+ * -+ * See the extensibility docs below. - */ --struct rfkill_event { -+struct rfkill_event_ext { - __u32 idx; - __u8 type; - __u8 op; - __u8 soft; - __u8 hard; -+ -+ /* -+ * older kernels will accept/send only up to this point, -+ * and if extended further up to any chunk marked below -+ */ -+ - __u8 hard_block_reasons; - } __attribute__((packed)); - --/* -- * We are planning to be backward and forward compatible with changes -- * to the event struct, by adding new, optional, members at the end. -- * When reading an event (whether the kernel from userspace or vice -- * versa) we need to accept anything that's at least as large as the -- * version 1 event size, but might be able to accept other sizes in -- * the future. -+/** -+ * DOC: Extensibility -+ * -+ * Originally, we had planned to allow backward and forward compatible -+ * changes by just adding fields at the end of the structure that are -+ * then not reported on older kernels on read(), and not written to by -+ * older kernels on write(), with the kernel reporting the size it did -+ * accept as the result. -+ * -+ * This would have allowed userspace to detect on read() and write() -+ * which kernel structure version it was dealing with, and if was just -+ * recompiled it would have gotten the new fields, but obviously not -+ * accessed them, but things should've continued to work. -+ * -+ * Unfortunately, while actually exercising this mechanism to add the -+ * hard block reasons field, we found that userspace (notably systemd) -+ * did all kinds of fun things not in line with this scheme: -+ * -+ * 1. treat the (expected) short writes as an error; -+ * 2. ask to read sizeof(struct rfkill_event) but then compare the -+ * actual return value to RFKILL_EVENT_SIZE_V1 and treat any -+ * mismatch as an error. -+ * -+ * As a consequence, just recompiling with a new struct version caused -+ * things to no longer work correctly on old and new kernels. -+ * -+ * Hence, we've rolled back &struct rfkill_event to the original version -+ * and added &struct rfkill_event_ext. This effectively reverts to the -+ * old behaviour for all userspace, unless it explicitly opts in to the -+ * rules outlined here by using the new &struct rfkill_event_ext. -+ * -+ * Userspace using &struct rfkill_event_ext must adhere to the following -+ * rules - * -- * One exception is the kernel -- we already have two event sizes in -- * that we've made the 'hard' member optional since our only option -- * is to ignore it anyway. -+ * 1. accept short writes, optionally using them to detect that it's -+ * running on an older kernel; -+ * 2. accept short reads, knowing that this means it's running on an -+ * older kernel; -+ * 3. treat reads that are as long as requested as acceptable, not -+ * checking against RFKILL_EVENT_SIZE_V1 or such. - */ --#define RFKILL_EVENT_SIZE_V1 8 -+#define RFKILL_EVENT_SIZE_V1 sizeof(struct rfkill_event) - - /* ioctl for turning off rfkill-input (if present) */ - #define RFKILL_IOC_MAGIC 'R' -diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c -index dd4b7fd60ee7d..6b14b4c4068cc 100644 ---- a/kernel/bpf/inode.c -+++ b/kernel/bpf/inode.c -@@ -546,7 +546,7 @@ int bpf_obj_get_user(const char __user *pathname, int flags) - else if (type == BPF_TYPE_MAP) - ret = bpf_map_new_fd(raw, f_flags); - else if (type == BPF_TYPE_LINK) -- ret = bpf_link_new_fd(raw); -+ ret = (f_flags != O_RDWR) ? -EINVAL : bpf_link_new_fd(raw); - else - return -ENOENT; - -diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c -index bfafbf115bf30..e274a33194319 100644 ---- a/kernel/bpf/stackmap.c -+++ b/kernel/bpf/stackmap.c -@@ -652,9 +652,17 @@ const struct bpf_func_proto bpf_get_stack_proto = { - BPF_CALL_4(bpf_get_task_stack, struct task_struct *, task, void *, buf, - u32, size, u64, flags) - { -- struct pt_regs *regs = task_pt_regs(task); -+ struct pt_regs *regs; -+ long res; - -- return __bpf_get_stack(regs, task, NULL, buf, size, flags); -+ if (!try_get_task_stack(task)) -+ return -EFAULT; -+ -+ regs = task_pt_regs(task); -+ res = __bpf_get_stack(regs, task, NULL, buf, size, flags); -+ put_task_stack(task); -+ -+ return res; - } - - BTF_ID_LIST_SINGLE(bpf_get_task_stack_btf_ids, struct, task_struct) -diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c -index 5b233e911c2c2..36b81975d9cda 100644 ---- a/kernel/bpf/verifier.c -+++ b/kernel/bpf/verifier.c -@@ -11570,6 +11570,11 @@ static int check_struct_ops_btf_id(struct bpf_verifier_env *env) - u32 btf_id, member_idx; - const char *mname; - -+ if (!prog->gpl_compatible) { -+ verbose(env, "struct ops programs must have a GPL compatible license\n"); -+ return -EINVAL; -+ } -+ - btf_id = prog->aux->attach_btf_id; - st_ops = bpf_struct_ops_find(btf_id); - if (!st_ops) { -diff --git a/kernel/gcov/clang.c b/kernel/gcov/clang.c -index 8743150db2acc..c466c7fbdece5 100644 ---- a/kernel/gcov/clang.c -+++ b/kernel/gcov/clang.c -@@ -70,7 +70,9 @@ struct gcov_fn_info { - - u32 ident; - u32 checksum; -+#if CONFIG_CLANG_VERSION < 110000 - u8 use_extra_checksum; -+#endif - u32 cfg_checksum; - - u32 num_counters; -@@ -145,10 +147,8 @@ void llvm_gcda_emit_function(u32 ident, const char *function_name, - - list_add_tail(&info->head, ¤t_info->functions); - } --EXPORT_SYMBOL(llvm_gcda_emit_function); - #else --void llvm_gcda_emit_function(u32 ident, u32 func_checksum, -- u8 use_extra_checksum, u32 cfg_checksum) -+void llvm_gcda_emit_function(u32 ident, u32 func_checksum, u32 cfg_checksum) - { - struct gcov_fn_info *info = kzalloc(sizeof(*info), GFP_KERNEL); - -@@ -158,12 +158,11 @@ void llvm_gcda_emit_function(u32 ident, u32 func_checksum, - INIT_LIST_HEAD(&info->head); - info->ident = ident; - info->checksum = func_checksum; -- info->use_extra_checksum = use_extra_checksum; - info->cfg_checksum = cfg_checksum; - list_add_tail(&info->head, ¤t_info->functions); - } --EXPORT_SYMBOL(llvm_gcda_emit_function); - #endif -+EXPORT_SYMBOL(llvm_gcda_emit_function); - - void llvm_gcda_emit_arcs(u32 num_counters, u64 *counters) - { -@@ -293,11 +292,16 @@ int gcov_info_is_compatible(struct gcov_info *info1, struct gcov_info *info2) - !list_is_last(&fn_ptr2->head, &info2->functions)) { - if (fn_ptr1->checksum != fn_ptr2->checksum) - return false; -+#if CONFIG_CLANG_VERSION < 110000 - if (fn_ptr1->use_extra_checksum != fn_ptr2->use_extra_checksum) - return false; - if (fn_ptr1->use_extra_checksum && - fn_ptr1->cfg_checksum != fn_ptr2->cfg_checksum) - return false; -+#else -+ if (fn_ptr1->cfg_checksum != fn_ptr2->cfg_checksum) -+ return false; -+#endif - fn_ptr1 = list_next_entry(fn_ptr1, head); - fn_ptr2 = list_next_entry(fn_ptr2, head); - } -@@ -529,17 +533,22 @@ static size_t convert_to_gcda(char *buffer, struct gcov_info *info) - - list_for_each_entry(fi_ptr, &info->functions, head) { - u32 i; -- u32 len = 2; -- -- if (fi_ptr->use_extra_checksum) -- len++; - - pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION); -- pos += store_gcov_u32(buffer, pos, len); -+#if CONFIG_CLANG_VERSION < 110000 -+ pos += store_gcov_u32(buffer, pos, -+ fi_ptr->use_extra_checksum ? 3 : 2); -+#else -+ pos += store_gcov_u32(buffer, pos, 3); -+#endif - pos += store_gcov_u32(buffer, pos, fi_ptr->ident); - pos += store_gcov_u32(buffer, pos, fi_ptr->checksum); -+#if CONFIG_CLANG_VERSION < 110000 - if (fi_ptr->use_extra_checksum) - pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); -+#else -+ pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); -+#endif - - pos += store_gcov_u32(buffer, pos, GCOV_TAG_COUNTER_BASE); - pos += store_gcov_u32(buffer, pos, fi_ptr->num_counters * 2); -diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c -index 780012eb2f3fe..eead7efbe7e5d 100644 ---- a/kernel/locking/lockdep.c -+++ b/kernel/locking/lockdep.c -@@ -705,7 +705,7 @@ static void print_lock_name(struct lock_class *class) - - printk(KERN_CONT " ("); - __print_lock_name(class); -- printk(KERN_CONT "){%s}-{%hd:%hd}", usage, -+ printk(KERN_CONT "){%s}-{%d:%d}", usage, - class->wait_type_outer ?: class->wait_type_inner, - class->wait_type_inner); - } -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index 894bb885b40b1..6326a872510b3 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -1412,7 +1412,6 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, - */ - lockdep_assert_irqs_disabled(); - -- debug_work_activate(work); - - /* if draining, only works from the same workqueue are allowed */ - if (unlikely(wq->flags & __WQ_DRAINING) && -@@ -1494,6 +1493,7 @@ retry: - worklist = &pwq->delayed_works; - } - -+ debug_work_activate(work); - insert_work(pwq, work, worklist, work_flags); - - out: -diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h -index 18b768ac7dcae..095d7eaa0db42 100644 ---- a/mm/percpu-internal.h -+++ b/mm/percpu-internal.h -@@ -87,7 +87,7 @@ extern spinlock_t pcpu_lock; - - extern struct list_head *pcpu_chunk_lists; - extern int pcpu_nr_slots; --extern int pcpu_nr_empty_pop_pages; -+extern int pcpu_nr_empty_pop_pages[]; - - extern struct pcpu_chunk *pcpu_first_chunk; - extern struct pcpu_chunk *pcpu_reserved_chunk; -diff --git a/mm/percpu-stats.c b/mm/percpu-stats.c -index c8400a2adbc2b..f6026dbcdf6b3 100644 ---- a/mm/percpu-stats.c -+++ b/mm/percpu-stats.c -@@ -145,6 +145,7 @@ static int percpu_stats_show(struct seq_file *m, void *v) - int slot, max_nr_alloc; - int *buffer; - enum pcpu_chunk_type type; -+ int nr_empty_pop_pages; - - alloc_buffer: - spin_lock_irq(&pcpu_lock); -@@ -165,7 +166,11 @@ alloc_buffer: - goto alloc_buffer; - } - --#define PL(X) \ -+ nr_empty_pop_pages = 0; -+ for (type = 0; type < PCPU_NR_CHUNK_TYPES; type++) -+ nr_empty_pop_pages += pcpu_nr_empty_pop_pages[type]; -+ -+#define PL(X) \ - seq_printf(m, " %-20s: %12lld\n", #X, (long long int)pcpu_stats_ai.X) - - seq_printf(m, -@@ -196,7 +201,7 @@ alloc_buffer: - PU(nr_max_chunks); - PU(min_alloc_size); - PU(max_alloc_size); -- P("empty_pop_pages", pcpu_nr_empty_pop_pages); -+ P("empty_pop_pages", nr_empty_pop_pages); - seq_putc(m, '\n'); - - #undef PU -diff --git a/mm/percpu.c b/mm/percpu.c -index ad7a37ee74ef5..e12ab708fe15b 100644 ---- a/mm/percpu.c -+++ b/mm/percpu.c -@@ -172,10 +172,10 @@ struct list_head *pcpu_chunk_lists __ro_after_init; /* chunk list slots */ - static LIST_HEAD(pcpu_map_extend_chunks); - - /* -- * The number of empty populated pages, protected by pcpu_lock. The -- * reserved chunk doesn't contribute to the count. -+ * The number of empty populated pages by chunk type, protected by pcpu_lock. -+ * The reserved chunk doesn't contribute to the count. - */ --int pcpu_nr_empty_pop_pages; -+int pcpu_nr_empty_pop_pages[PCPU_NR_CHUNK_TYPES]; - - /* - * The number of populated pages in use by the allocator, protected by -@@ -555,7 +555,7 @@ static inline void pcpu_update_empty_pages(struct pcpu_chunk *chunk, int nr) - { - chunk->nr_empty_pop_pages += nr; - if (chunk != pcpu_reserved_chunk) -- pcpu_nr_empty_pop_pages += nr; -+ pcpu_nr_empty_pop_pages[pcpu_chunk_type(chunk)] += nr; - } - - /* -@@ -1831,7 +1831,7 @@ area_found: - mutex_unlock(&pcpu_alloc_mutex); - } - -- if (pcpu_nr_empty_pop_pages < PCPU_EMPTY_POP_PAGES_LOW) -+ if (pcpu_nr_empty_pop_pages[type] < PCPU_EMPTY_POP_PAGES_LOW) - pcpu_schedule_balance_work(); - - /* clear the areas and return address relative to base address */ -@@ -1999,7 +1999,7 @@ retry_pop: - pcpu_atomic_alloc_failed = false; - } else { - nr_to_pop = clamp(PCPU_EMPTY_POP_PAGES_HIGH - -- pcpu_nr_empty_pop_pages, -+ pcpu_nr_empty_pop_pages[type], - 0, PCPU_EMPTY_POP_PAGES_HIGH); - } - -@@ -2579,7 +2579,7 @@ void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, - - /* link the first chunk in */ - pcpu_first_chunk = chunk; -- pcpu_nr_empty_pop_pages = pcpu_first_chunk->nr_empty_pop_pages; -+ pcpu_nr_empty_pop_pages[PCPU_CHUNK_ROOT] = pcpu_first_chunk->nr_empty_pop_pages; - pcpu_chunk_relocate(pcpu_first_chunk, -1); - - /* include all regions of the first chunk */ -diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c -index cd09916f97fe9..0e32e31872e29 100644 ---- a/net/batman-adv/translation-table.c -+++ b/net/batman-adv/translation-table.c -@@ -890,6 +890,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node, - hlist_for_each_entry(vlan, &orig_node->vlan_list, list) { - tt_vlan->vid = htons(vlan->vid); - tt_vlan->crc = htonl(vlan->tt.crc); -+ tt_vlan->reserved = 0; - - tt_vlan++; - } -@@ -973,6 +974,7 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, - - tt_vlan->vid = htons(vlan->vid); - tt_vlan->crc = htonl(vlan->tt.crc); -+ tt_vlan->reserved = 0; - - tt_vlan++; - } -diff --git a/net/can/bcm.c b/net/can/bcm.c -index 0e5c37be4a2bd..909b9e684e043 100644 ---- a/net/can/bcm.c -+++ b/net/can/bcm.c -@@ -86,6 +86,8 @@ MODULE_LICENSE("Dual BSD/GPL"); - MODULE_AUTHOR("Oliver Hartkopp "); - MODULE_ALIAS("can-proto-2"); - -+#define BCM_MIN_NAMELEN CAN_REQUIRED_SIZE(struct sockaddr_can, can_ifindex) -+ - /* - * easy access to the first 64 bit of can(fd)_frame payload. cp->data is - * 64 bit aligned so the offset has to be multiples of 8 which is ensured -@@ -1292,7 +1294,7 @@ static int bcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) - /* no bound device as default => check msg_name */ - DECLARE_SOCKADDR(struct sockaddr_can *, addr, msg->msg_name); - -- if (msg->msg_namelen < CAN_REQUIRED_SIZE(*addr, can_ifindex)) -+ if (msg->msg_namelen < BCM_MIN_NAMELEN) - return -EINVAL; - - if (addr->can_family != AF_CAN) -@@ -1534,7 +1536,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len, - struct net *net = sock_net(sk); - int ret = 0; - -- if (len < CAN_REQUIRED_SIZE(*addr, can_ifindex)) -+ if (len < BCM_MIN_NAMELEN) - return -EINVAL; - - lock_sock(sk); -@@ -1616,8 +1618,8 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, - sock_recv_ts_and_drops(msg, sk, skb); - - if (msg->msg_name) { -- __sockaddr_check_size(sizeof(struct sockaddr_can)); -- msg->msg_namelen = sizeof(struct sockaddr_can); -+ __sockaddr_check_size(BCM_MIN_NAMELEN); -+ msg->msg_namelen = BCM_MIN_NAMELEN; - memcpy(msg->msg_name, skb->cb, msg->msg_namelen); - } - -diff --git a/net/can/isotp.c b/net/can/isotp.c -index 15ea1234d4573..9f94ad3caee92 100644 ---- a/net/can/isotp.c -+++ b/net/can/isotp.c -@@ -77,6 +77,8 @@ MODULE_LICENSE("Dual BSD/GPL"); - MODULE_AUTHOR("Oliver Hartkopp "); - MODULE_ALIAS("can-proto-6"); - -+#define ISOTP_MIN_NAMELEN CAN_REQUIRED_SIZE(struct sockaddr_can, can_addr.tp) -+ - #define SINGLE_MASK(id) (((id) & CAN_EFF_FLAG) ? \ - (CAN_EFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG) : \ - (CAN_SFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG)) -@@ -986,7 +988,8 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, - sock_recv_timestamp(msg, sk, skb); - - if (msg->msg_name) { -- msg->msg_namelen = sizeof(struct sockaddr_can); -+ __sockaddr_check_size(ISOTP_MIN_NAMELEN); -+ msg->msg_namelen = ISOTP_MIN_NAMELEN; - memcpy(msg->msg_name, skb->cb, msg->msg_namelen); - } - -@@ -1056,7 +1059,7 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len) - int notify_enetdown = 0; - int do_rx_reg = 1; - -- if (len < CAN_REQUIRED_SIZE(struct sockaddr_can, can_addr.tp)) -+ if (len < ISOTP_MIN_NAMELEN) - return -EINVAL; - - /* do not register frame reception for functional addressing */ -@@ -1152,13 +1155,13 @@ static int isotp_getname(struct socket *sock, struct sockaddr *uaddr, int peer) - if (peer) - return -EOPNOTSUPP; - -- memset(addr, 0, sizeof(*addr)); -+ memset(addr, 0, ISOTP_MIN_NAMELEN); - addr->can_family = AF_CAN; - addr->can_ifindex = so->ifindex; - addr->can_addr.tp.rx_id = so->rxid; - addr->can_addr.tp.tx_id = so->txid; - -- return sizeof(*addr); -+ return ISOTP_MIN_NAMELEN; - } - - static int isotp_setsockopt(struct socket *sock, int level, int optname, -diff --git a/net/can/raw.c b/net/can/raw.c -index 6ec8aa1d0da46..95113b0898b24 100644 ---- a/net/can/raw.c -+++ b/net/can/raw.c -@@ -60,6 +60,8 @@ MODULE_LICENSE("Dual BSD/GPL"); - MODULE_AUTHOR("Urs Thuermann "); - MODULE_ALIAS("can-proto-1"); - -+#define RAW_MIN_NAMELEN CAN_REQUIRED_SIZE(struct sockaddr_can, can_ifindex) -+ - #define MASK_ALL 0 - - /* A raw socket has a list of can_filters attached to it, each receiving -@@ -394,7 +396,7 @@ static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len) - int err = 0; - int notify_enetdown = 0; - -- if (len < CAN_REQUIRED_SIZE(*addr, can_ifindex)) -+ if (len < RAW_MIN_NAMELEN) - return -EINVAL; - if (addr->can_family != AF_CAN) - return -EINVAL; -@@ -475,11 +477,11 @@ static int raw_getname(struct socket *sock, struct sockaddr *uaddr, - if (peer) - return -EOPNOTSUPP; - -- memset(addr, 0, sizeof(*addr)); -+ memset(addr, 0, RAW_MIN_NAMELEN); - addr->can_family = AF_CAN; - addr->can_ifindex = ro->ifindex; - -- return sizeof(*addr); -+ return RAW_MIN_NAMELEN; - } - - static int raw_setsockopt(struct socket *sock, int level, int optname, -@@ -731,7 +733,7 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) - if (msg->msg_name) { - DECLARE_SOCKADDR(struct sockaddr_can *, addr, msg->msg_name); - -- if (msg->msg_namelen < CAN_REQUIRED_SIZE(*addr, can_ifindex)) -+ if (msg->msg_namelen < RAW_MIN_NAMELEN) - return -EINVAL; - - if (addr->can_family != AF_CAN) -@@ -824,8 +826,8 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, - sock_recv_ts_and_drops(msg, sk, skb); - - if (msg->msg_name) { -- __sockaddr_check_size(sizeof(struct sockaddr_can)); -- msg->msg_namelen = sizeof(struct sockaddr_can); -+ __sockaddr_check_size(RAW_MIN_NAMELEN); -+ msg->msg_namelen = RAW_MIN_NAMELEN; - memcpy(msg->msg_name, skb->cb, msg->msg_namelen); - } - -diff --git a/net/core/skmsg.c b/net/core/skmsg.c -index 25cdbb20f3a03..923a1d0f84ca3 100644 ---- a/net/core/skmsg.c -+++ b/net/core/skmsg.c -@@ -488,6 +488,7 @@ static int sk_psock_skb_ingress_self(struct sk_psock *psock, struct sk_buff *skb - if (unlikely(!msg)) - return -EAGAIN; - sk_msg_init(msg); -+ skb_set_owner_r(skb, sk); - return sk_psock_skb_ingress_enqueue(skb, psock, sk, msg); - } - -@@ -791,7 +792,6 @@ static void sk_psock_tls_verdict_apply(struct sk_buff *skb, struct sock *sk, int - { - switch (verdict) { - case __SK_REDIRECT: -- skb_set_owner_r(skb, sk); - sk_psock_skb_redirect(skb); - break; - case __SK_PASS: -@@ -809,10 +809,6 @@ int sk_psock_tls_strp_read(struct sk_psock *psock, struct sk_buff *skb) - rcu_read_lock(); - prog = READ_ONCE(psock->progs.skb_verdict); - if (likely(prog)) { -- /* We skip full set_owner_r here because if we do a SK_PASS -- * or SK_DROP we can skip skb memory accounting and use the -- * TLS context. -- */ - skb->sk = psock->sk; - tcp_skb_bpf_redirect_clear(skb); - ret = sk_psock_bpf_run(psock, prog, skb); -@@ -881,12 +877,13 @@ static void sk_psock_strp_read(struct strparser *strp, struct sk_buff *skb) - kfree_skb(skb); - goto out; - } -- skb_set_owner_r(skb, sk); - prog = READ_ONCE(psock->progs.skb_verdict); - if (likely(prog)) { -+ skb->sk = sk; - tcp_skb_bpf_redirect_clear(skb); - ret = sk_psock_bpf_run(psock, prog, skb); - ret = sk_psock_map_verd(ret, tcp_skb_bpf_redirect_fetch(skb)); -+ skb->sk = NULL; - } - sk_psock_verdict_apply(psock, skb, ret); - out: -@@ -957,12 +954,13 @@ static int sk_psock_verdict_recv(read_descriptor_t *desc, struct sk_buff *skb, - kfree_skb(skb); - goto out; - } -- skb_set_owner_r(skb, sk); - prog = READ_ONCE(psock->progs.skb_verdict); - if (likely(prog)) { -+ skb->sk = sk; - tcp_skb_bpf_redirect_clear(skb); - ret = sk_psock_bpf_run(psock, prog, skb); - ret = sk_psock_map_verd(ret, tcp_skb_bpf_redirect_fetch(skb)); -+ skb->sk = NULL; - } - sk_psock_verdict_apply(psock, skb, ret); - out: -diff --git a/net/core/sock.c b/net/core/sock.c -index bbcd4b97eddd1..01a680c5c7aea 100644 ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -2118,16 +2118,10 @@ void skb_orphan_partial(struct sk_buff *skb) - if (skb_is_tcp_pure_ack(skb)) - return; - -- if (can_skb_orphan_partial(skb)) { -- struct sock *sk = skb->sk; -- -- if (refcount_inc_not_zero(&sk->sk_refcnt)) { -- WARN_ON(refcount_sub_and_test(skb->truesize, &sk->sk_wmem_alloc)); -- skb->destructor = sock_efree; -- } -- } else { -+ if (can_skb_orphan_partial(skb)) -+ skb_set_owner_sk_safe(skb, skb->sk); -+ else - skb_orphan(skb); -- } - } - EXPORT_SYMBOL(skb_orphan_partial); - -diff --git a/net/core/xdp.c b/net/core/xdp.c -index 3a8c9ab4ecbe3..a86bc36607293 100644 ---- a/net/core/xdp.c -+++ b/net/core/xdp.c -@@ -350,7 +350,8 @@ static void __xdp_return(void *data, struct xdp_mem_info *mem, bool napi_direct, - /* mem->id is valid, checked in xdp_rxq_info_reg_mem_model() */ - xa = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params); - page = virt_to_head_page(data); -- napi_direct &= !xdp_return_frame_no_direct(); -+ if (napi_direct && xdp_return_frame_no_direct()) -+ napi_direct = false; - page_pool_put_full_page(xa->page_pool, page, napi_direct); - rcu_read_unlock(); - break; -diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c -index a04fd637b4cdc..3ada338d7e08b 100644 ---- a/net/dsa/dsa2.c -+++ b/net/dsa/dsa2.c -@@ -533,8 +533,14 @@ static int dsa_tree_setup_switches(struct dsa_switch_tree *dst) - - list_for_each_entry(dp, &dst->ports, list) { - err = dsa_port_setup(dp); -- if (err) -+ if (err) { -+ dsa_port_devlink_teardown(dp); -+ dp->type = DSA_PORT_TYPE_UNUSED; -+ err = dsa_port_devlink_setup(dp); -+ if (err) -+ goto teardown; - continue; -+ } - } - - return 0; -diff --git a/net/ethtool/eee.c b/net/ethtool/eee.c -index 901b7de941abd..e10bfcc078531 100644 ---- a/net/ethtool/eee.c -+++ b/net/ethtool/eee.c -@@ -169,8 +169,8 @@ int ethnl_set_eee(struct sk_buff *skb, struct genl_info *info) - ethnl_update_bool32(&eee.eee_enabled, tb[ETHTOOL_A_EEE_ENABLED], &mod); - ethnl_update_bool32(&eee.tx_lpi_enabled, - tb[ETHTOOL_A_EEE_TX_LPI_ENABLED], &mod); -- ethnl_update_bool32(&eee.tx_lpi_timer, tb[ETHTOOL_A_EEE_TX_LPI_TIMER], -- &mod); -+ ethnl_update_u32(&eee.tx_lpi_timer, tb[ETHTOOL_A_EEE_TX_LPI_TIMER], -+ &mod); - ret = 0; - if (!mod) - goto out_ops; -diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c -index ab953a1a0d6cc..6f4c34b6a5d69 100644 ---- a/net/hsr/hsr_device.c -+++ b/net/hsr/hsr_device.c -@@ -217,6 +217,7 @@ static netdev_tx_t hsr_dev_xmit(struct sk_buff *skb, struct net_device *dev) - master = hsr_port_get_hsr(hsr, HSR_PT_MASTER); - if (master) { - skb->dev = master->dev; -+ skb_reset_mac_header(skb); - hsr_forward_skb(skb, master); - } else { - atomic_long_inc(&dev->tx_dropped); -diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c -index cadfccd7876e4..b4e06ae088348 100644 ---- a/net/hsr/hsr_forward.c -+++ b/net/hsr/hsr_forward.c -@@ -528,12 +528,6 @@ void hsr_forward_skb(struct sk_buff *skb, struct hsr_port *port) - { - struct hsr_frame_info frame; - -- if (skb_mac_header(skb) != skb->data) { -- WARN_ONCE(1, "%s:%d: Malformed frame (port_src %s)\n", -- __FILE__, __LINE__, port->dev->name); -- goto out_drop; -- } -- - if (fill_frame_info(&frame, skb, port) < 0) - goto out_drop; - -diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c -index 9c640d670ffeb..0c1b0770c59ea 100644 ---- a/net/ieee802154/nl-mac.c -+++ b/net/ieee802154/nl-mac.c -@@ -551,9 +551,7 @@ ieee802154_llsec_parse_key_id(struct genl_info *info, - desc->mode = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE]); - - if (desc->mode == IEEE802154_SCF_KEY_IMPLICIT) { -- if (!info->attrs[IEEE802154_ATTR_PAN_ID] && -- !(info->attrs[IEEE802154_ATTR_SHORT_ADDR] || -- info->attrs[IEEE802154_ATTR_HW_ADDR])) -+ if (!info->attrs[IEEE802154_ATTR_PAN_ID]) - return -EINVAL; - - desc->device_addr.pan_id = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_PAN_ID]); -@@ -562,6 +560,9 @@ ieee802154_llsec_parse_key_id(struct genl_info *info, - desc->device_addr.mode = IEEE802154_ADDR_SHORT; - desc->device_addr.short_addr = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_SHORT_ADDR]); - } else { -+ if (!info->attrs[IEEE802154_ATTR_HW_ADDR]) -+ return -EINVAL; -+ - desc->device_addr.mode = IEEE802154_ADDR_LONG; - desc->device_addr.extended_addr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]); - } -diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c -index 7c5a1aa5adb42..d1b6a9665b170 100644 ---- a/net/ieee802154/nl802154.c -+++ b/net/ieee802154/nl802154.c -@@ -820,8 +820,13 @@ nl802154_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags, - goto nla_put_failure; - - #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL -+ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) -+ goto out; -+ - if (nl802154_get_llsec_params(msg, rdev, wpan_dev) < 0) - goto nla_put_failure; -+ -+out: - #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */ - - genlmsg_end(msg, hdr); -@@ -1384,6 +1389,9 @@ static int nl802154_set_llsec_params(struct sk_buff *skb, - u32 changed = 0; - int ret; - -+ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) -+ return -EOPNOTSUPP; -+ - if (info->attrs[NL802154_ATTR_SEC_ENABLED]) { - u8 enabled; - -@@ -1544,7 +1552,8 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info) - struct ieee802154_llsec_key_id id = { }; - u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { }; - -- if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) -+ if (!info->attrs[NL802154_ATTR_SEC_KEY] || -+ nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) - return -EINVAL; - - if (!attrs[NL802154_KEY_ATTR_USAGE_FRAMES] || -@@ -1592,7 +1601,8 @@ static int nl802154_del_llsec_key(struct sk_buff *skb, struct genl_info *info) - struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1]; - struct ieee802154_llsec_key_id id; - -- if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) -+ if (!info->attrs[NL802154_ATTR_SEC_KEY] || -+ nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) - return -EINVAL; - - if (ieee802154_llsec_parse_key_id(attrs[NL802154_KEY_ATTR_ID], &id) < 0) -@@ -1757,7 +1767,8 @@ static int nl802154_del_llsec_dev(struct sk_buff *skb, struct genl_info *info) - struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1]; - __le64 extended_addr; - -- if (nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack)) -+ if (!info->attrs[NL802154_ATTR_SEC_DEVICE] || -+ nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack)) - return -EINVAL; - - if (!attrs[NL802154_DEV_ATTR_EXTENDED_ADDR]) -@@ -1913,7 +1924,8 @@ static int nl802154_del_llsec_devkey(struct sk_buff *skb, struct genl_info *info - struct ieee802154_llsec_device_key key; - __le64 extended_addr; - -- if (nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack)) -+ if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] || -+ nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack)) - return -EINVAL; - - if (!attrs[NL802154_DEVKEY_ATTR_EXTENDED_ADDR]) -@@ -2085,6 +2097,9 @@ static int nl802154_del_llsec_seclevel(struct sk_buff *skb, - struct wpan_dev *wpan_dev = dev->ieee802154_ptr; - struct ieee802154_llsec_seclevel sl; - -+ if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) -+ return -EOPNOTSUPP; -+ - if (!info->attrs[NL802154_ATTR_SEC_LEVEL] || - llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL], - &sl) < 0) -diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c -index d99e1be94019d..36ed85bf2ad51 100644 ---- a/net/ipv4/ah4.c -+++ b/net/ipv4/ah4.c -@@ -141,7 +141,7 @@ static void ah_output_done(struct crypto_async_request *base, int err) - } - - kfree(AH_SKB_CB(skb)->tmp); -- xfrm_output_resume(skb, err); -+ xfrm_output_resume(skb->sk, skb, err); - } - - static int ah_output(struct xfrm_state *x, struct sk_buff *skb) -diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c -index a3271ec3e1627..4b834bbf95e07 100644 ---- a/net/ipv4/esp4.c -+++ b/net/ipv4/esp4.c -@@ -279,7 +279,7 @@ static void esp_output_done(struct crypto_async_request *base, int err) - x->encap && x->encap->encap_type == TCP_ENCAP_ESPINTCP) - esp_output_tail_tcp(x, skb); - else -- xfrm_output_resume(skb, err); -+ xfrm_output_resume(skb->sk, skb, err); - } - } - -diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c -index 5bda5aeda5791..5aa7344dbec7f 100644 ---- a/net/ipv4/esp4_offload.c -+++ b/net/ipv4/esp4_offload.c -@@ -217,10 +217,12 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb, - - if ((!(skb->dev->gso_partial_features & NETIF_F_HW_ESP) && - !(features & NETIF_F_HW_ESP)) || x->xso.dev != skb->dev) -- esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK); -+ esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK | -+ NETIF_F_SCTP_CRC); - else if (!(features & NETIF_F_HW_ESP_TX_CSUM) && - !(skb->dev->gso_partial_features & NETIF_F_HW_ESP_TX_CSUM)) -- esp_features = features & ~NETIF_F_CSUM_MASK; -+ esp_features = features & ~(NETIF_F_CSUM_MASK | -+ NETIF_F_SCTP_CRC); - - xo->flags |= XFRM_GSO_SEGMENT; - -@@ -312,8 +314,17 @@ static int esp_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features_ - ip_hdr(skb)->tot_len = htons(skb->len); - ip_send_check(ip_hdr(skb)); - -- if (hw_offload) -+ if (hw_offload) { -+ if (!skb_ext_add(skb, SKB_EXT_SEC_PATH)) -+ return -ENOMEM; -+ -+ xo = xfrm_offload(skb); -+ if (!xo) -+ return -EINVAL; -+ -+ xo->flags |= XFRM_XMIT; - return 0; -+ } - - err = esp_output_tail(x, skb, &esp); - if (err) -diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c -index 69ea76578abb9..9d2a1a247cec6 100644 ---- a/net/ipv4/udp.c -+++ b/net/ipv4/udp.c -@@ -2749,6 +2749,10 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, - val = up->gso_size; - break; - -+ case UDP_GRO: -+ val = up->gro_enabled; -+ break; -+ - /* The following two cannot be changed on UDP sockets, the return is - * always 0 (which corresponds to the full checksum coverage of UDP). */ - case UDPLITE_SEND_CSCOV: -diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c -index 440080da805b5..080ee7f44c649 100644 ---- a/net/ipv6/ah6.c -+++ b/net/ipv6/ah6.c -@@ -316,7 +316,7 @@ static void ah6_output_done(struct crypto_async_request *base, int err) - } - - kfree(AH_SKB_CB(skb)->tmp); -- xfrm_output_resume(skb, err); -+ xfrm_output_resume(skb->sk, skb, err); - } - - static int ah6_output(struct xfrm_state *x, struct sk_buff *skb) -diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c -index 2b804fcebcc65..4071cb7c7a154 100644 ---- a/net/ipv6/esp6.c -+++ b/net/ipv6/esp6.c -@@ -314,7 +314,7 @@ static void esp_output_done(struct crypto_async_request *base, int err) - x->encap && x->encap->encap_type == TCP_ENCAP_ESPINTCP) - esp_output_tail_tcp(x, skb); - else -- xfrm_output_resume(skb, err); -+ xfrm_output_resume(skb->sk, skb, err); - } - } - -diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c -index 1ca516fb30e1c..4af56affaafd4 100644 ---- a/net/ipv6/esp6_offload.c -+++ b/net/ipv6/esp6_offload.c -@@ -254,9 +254,11 @@ static struct sk_buff *esp6_gso_segment(struct sk_buff *skb, - skb->encap_hdr_csum = 1; - - if (!(features & NETIF_F_HW_ESP) || x->xso.dev != skb->dev) -- esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK); -+ esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK | -+ NETIF_F_SCTP_CRC); - else if (!(features & NETIF_F_HW_ESP_TX_CSUM)) -- esp_features = features & ~NETIF_F_CSUM_MASK; -+ esp_features = features & ~(NETIF_F_CSUM_MASK | -+ NETIF_F_SCTP_CRC); - - xo->flags |= XFRM_GSO_SEGMENT; - -@@ -346,8 +348,17 @@ static int esp6_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features - - ipv6_hdr(skb)->payload_len = htons(len); - -- if (hw_offload) -+ if (hw_offload) { -+ if (!skb_ext_add(skb, SKB_EXT_SEC_PATH)) -+ return -ENOMEM; -+ -+ xo = xfrm_offload(skb); -+ if (!xo) -+ return -EINVAL; -+ -+ xo->flags |= XFRM_XMIT; - return 0; -+ } - - err = esp6_output_tail(x, skb, &esp); - if (err) -diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c -index 1f56d9aae5892..bf3646b57c686 100644 ---- a/net/ipv6/raw.c -+++ b/net/ipv6/raw.c -@@ -298,7 +298,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) - */ - v4addr = LOOPBACK4_IPV6; - if (!(addr_type & IPV6_ADDR_MULTICAST) && -- !sock_net(sk)->ipv6.sysctl.ip_nonlocal_bind) { -+ !ipv6_can_nonlocal_bind(sock_net(sk), inet)) { - err = -EADDRNOTAVAIL; - if (!ipv6_chk_addr(sock_net(sk), &addr->sin6_addr, - dev, 0)) { -diff --git a/net/ipv6/route.c b/net/ipv6/route.c -index 0bbfaa55e3c89..4bba6d21ffa0d 100644 ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -5203,9 +5203,11 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, - * nexthops have been replaced by first new, the rest should - * be added to it. - */ -- cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | -- NLM_F_REPLACE); -- cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE; -+ if (cfg->fc_nlinfo.nlh) { -+ cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | -+ NLM_F_REPLACE); -+ cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE; -+ } - nhn++; - } - -diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c -index 9db648a91a4f6..b7155b078b198 100644 ---- a/net/mac80211/mlme.c -+++ b/net/mac80211/mlme.c -@@ -4707,7 +4707,10 @@ static void ieee80211_sta_conn_mon_timer(struct timer_list *t) - timeout = sta->rx_stats.last_rx; - timeout += IEEE80211_CONNECTION_IDLE_TIME; - -- if (time_is_before_jiffies(timeout)) { -+ /* If timeout is after now, then update timer to fire at -+ * the later date, but do not actually probe at this time. -+ */ -+ if (time_is_after_jiffies(timeout)) { - mod_timer(&ifmgd->conn_mon_timer, round_jiffies_up(timeout)); - return; - } -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c -index ebb3228ce9718..64fae4f645f52 100644 ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3578,7 +3578,7 @@ begin: - test_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags)) - goto out; - -- if (vif->txqs_stopped[ieee80211_ac_from_tid(txq->tid)]) { -+ if (vif->txqs_stopped[txq->ac]) { - set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags); - goto out; - } -diff --git a/net/mac802154/llsec.c b/net/mac802154/llsec.c -index 585d33144c33f..55550ead2ced8 100644 ---- a/net/mac802154/llsec.c -+++ b/net/mac802154/llsec.c -@@ -152,7 +152,7 @@ err_tfm0: - crypto_free_sync_skcipher(key->tfm0); - err_tfm: - for (i = 0; i < ARRAY_SIZE(key->tfm); i++) -- if (key->tfm[i]) -+ if (!IS_ERR_OR_NULL(key->tfm[i])) - crypto_free_aead(key->tfm[i]); - - kfree_sensitive(key); -diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c -index 5932b0ebecc31..e337b35a368f9 100644 ---- a/net/mptcp/protocol.c -+++ b/net/mptcp/protocol.c -@@ -11,7 +11,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -20,7 +19,6 @@ - #include - #if IS_ENABLED(CONFIG_MPTCP_IPV6) - #include --#include - #endif - #include - #include -@@ -2863,6 +2861,48 @@ static int mptcp_setsockopt_v6(struct mptcp_sock *msk, int optname, - return ret; - } - -+static bool mptcp_unsupported(int level, int optname) -+{ -+ if (level == SOL_IP) { -+ switch (optname) { -+ case IP_ADD_MEMBERSHIP: -+ case IP_ADD_SOURCE_MEMBERSHIP: -+ case IP_DROP_MEMBERSHIP: -+ case IP_DROP_SOURCE_MEMBERSHIP: -+ case IP_BLOCK_SOURCE: -+ case IP_UNBLOCK_SOURCE: -+ case MCAST_JOIN_GROUP: -+ case MCAST_LEAVE_GROUP: -+ case MCAST_JOIN_SOURCE_GROUP: -+ case MCAST_LEAVE_SOURCE_GROUP: -+ case MCAST_BLOCK_SOURCE: -+ case MCAST_UNBLOCK_SOURCE: -+ case MCAST_MSFILTER: -+ return true; -+ } -+ return false; -+ } -+ if (level == SOL_IPV6) { -+ switch (optname) { -+ case IPV6_ADDRFORM: -+ case IPV6_ADD_MEMBERSHIP: -+ case IPV6_DROP_MEMBERSHIP: -+ case IPV6_JOIN_ANYCAST: -+ case IPV6_LEAVE_ANYCAST: -+ case MCAST_JOIN_GROUP: -+ case MCAST_LEAVE_GROUP: -+ case MCAST_JOIN_SOURCE_GROUP: -+ case MCAST_LEAVE_SOURCE_GROUP: -+ case MCAST_BLOCK_SOURCE: -+ case MCAST_UNBLOCK_SOURCE: -+ case MCAST_MSFILTER: -+ return true; -+ } -+ return false; -+ } -+ return false; -+} -+ - static int mptcp_setsockopt(struct sock *sk, int level, int optname, - sockptr_t optval, unsigned int optlen) - { -@@ -2871,6 +2911,9 @@ static int mptcp_setsockopt(struct sock *sk, int level, int optname, - - pr_debug("msk=%p", msk); - -+ if (mptcp_unsupported(level, optname)) -+ return -ENOPROTOOPT; -+ - if (level == SOL_SOCKET) - return mptcp_setsockopt_sol_socket(msk, optname, optval, optlen); - -@@ -3379,34 +3422,10 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock, - return mask; - } - --static int mptcp_release(struct socket *sock) --{ -- struct mptcp_subflow_context *subflow; -- struct sock *sk = sock->sk; -- struct mptcp_sock *msk; -- -- if (!sk) -- return 0; -- -- lock_sock(sk); -- -- msk = mptcp_sk(sk); -- -- mptcp_for_each_subflow(msk, subflow) { -- struct sock *ssk = mptcp_subflow_tcp_sock(subflow); -- -- ip_mc_drop_socket(ssk); -- } -- -- release_sock(sk); -- -- return inet_release(sock); --} -- - static const struct proto_ops mptcp_stream_ops = { - .family = PF_INET, - .owner = THIS_MODULE, -- .release = mptcp_release, -+ .release = inet_release, - .bind = mptcp_bind, - .connect = mptcp_stream_connect, - .socketpair = sock_no_socketpair, -@@ -3453,35 +3472,10 @@ void __init mptcp_proto_init(void) - } - - #if IS_ENABLED(CONFIG_MPTCP_IPV6) --static int mptcp6_release(struct socket *sock) --{ -- struct mptcp_subflow_context *subflow; -- struct mptcp_sock *msk; -- struct sock *sk = sock->sk; -- -- if (!sk) -- return 0; -- -- lock_sock(sk); -- -- msk = mptcp_sk(sk); -- -- mptcp_for_each_subflow(msk, subflow) { -- struct sock *ssk = mptcp_subflow_tcp_sock(subflow); -- -- ip_mc_drop_socket(ssk); -- ipv6_sock_mc_close(ssk); -- ipv6_sock_ac_close(ssk); -- } -- -- release_sock(sk); -- return inet6_release(sock); --} -- - static const struct proto_ops mptcp_v6_stream_ops = { - .family = PF_INET6, - .owner = THIS_MODULE, -- .release = mptcp6_release, -+ .release = inet6_release, - .bind = mptcp_bind, - .connect = mptcp_stream_connect, - .socketpair = sock_no_socketpair, -diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c -index a9cb355324d1a..ffff8da707b8c 100644 ---- a/net/ncsi/ncsi-manage.c -+++ b/net/ncsi/ncsi-manage.c -@@ -105,13 +105,20 @@ static void ncsi_channel_monitor(struct timer_list *t) - monitor_state = nc->monitor.state; - spin_unlock_irqrestore(&nc->lock, flags); - -- if (!enabled || chained) { -- ncsi_stop_channel_monitor(nc); -- return; -- } -+ if (!enabled) -+ return; /* expected race disabling timer */ -+ if (WARN_ON_ONCE(chained)) -+ goto bad_state; -+ - if (state != NCSI_CHANNEL_INACTIVE && - state != NCSI_CHANNEL_ACTIVE) { -- ncsi_stop_channel_monitor(nc); -+bad_state: -+ netdev_warn(ndp->ndev.dev, -+ "Bad NCSI monitor state channel %d 0x%x %s queue\n", -+ nc->id, state, chained ? "on" : "off"); -+ spin_lock_irqsave(&nc->lock, flags); -+ nc->monitor.enabled = false; -+ spin_unlock_irqrestore(&nc->lock, flags); - return; - } - -@@ -136,10 +143,9 @@ static void ncsi_channel_monitor(struct timer_list *t) - ncsi_report_link(ndp, true); - ndp->flags |= NCSI_DEV_RESHUFFLE; - -- ncsi_stop_channel_monitor(nc); -- - ncm = &nc->modes[NCSI_MODE_LINK]; - spin_lock_irqsave(&nc->lock, flags); -+ nc->monitor.enabled = false; - nc->state = NCSI_CHANNEL_INVISIBLE; - ncm->data[2] &= ~0x1; - spin_unlock_irqrestore(&nc->lock, flags); -diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c -index d257ed3b732ae..a3b46f8888033 100644 ---- a/net/nfc/llcp_sock.c -+++ b/net/nfc/llcp_sock.c -@@ -108,11 +108,13 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) - llcp_sock->service_name_len, - GFP_KERNEL); - if (!llcp_sock->service_name) { -+ nfc_llcp_local_put(llcp_sock->local); - ret = -ENOMEM; - goto put_dev; - } - llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock); - if (llcp_sock->ssap == LLCP_SAP_MAX) { -+ nfc_llcp_local_put(llcp_sock->local); - kfree(llcp_sock->service_name); - llcp_sock->service_name = NULL; - ret = -EADDRINUSE; -@@ -671,6 +673,10 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, - ret = -EISCONN; - goto error; - } -+ if (sk->sk_state == LLCP_CONNECTING) { -+ ret = -EINPROGRESS; -+ goto error; -+ } - - dev = nfc_get_device(addr->dev_idx); - if (dev == NULL) { -@@ -702,6 +708,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, - llcp_sock->local = nfc_llcp_local_get(local); - llcp_sock->ssap = nfc_llcp_get_local_ssap(local); - if (llcp_sock->ssap == LLCP_SAP_MAX) { -+ nfc_llcp_local_put(llcp_sock->local); - ret = -ENOMEM; - goto put_dev; - } -@@ -743,9 +750,12 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, - - sock_unlink: - nfc_llcp_sock_unlink(&local->connecting_sockets, sk); -+ kfree(llcp_sock->service_name); -+ llcp_sock->service_name = NULL; - - sock_llcp_release: - nfc_llcp_put_ssap(local, llcp_sock->ssap); -+ nfc_llcp_local_put(llcp_sock->local); - - put_dev: - nfc_put_device(dev); -diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c -index 5eddfe7bd3910..2316efd6ace8b 100644 ---- a/net/openvswitch/conntrack.c -+++ b/net/openvswitch/conntrack.c -@@ -2032,10 +2032,10 @@ static int ovs_ct_limit_del_zone_limit(struct nlattr *nla_zone_limit, - static int ovs_ct_limit_get_default_limit(struct ovs_ct_limit_info *info, - struct sk_buff *reply) - { -- struct ovs_zone_limit zone_limit; -- -- zone_limit.zone_id = OVS_ZONE_LIMIT_DEFAULT_ZONE; -- zone_limit.limit = info->default_limit; -+ struct ovs_zone_limit zone_limit = { -+ .zone_id = OVS_ZONE_LIMIT_DEFAULT_ZONE, -+ .limit = info->default_limit, -+ }; - - return nla_put_nohdr(reply, sizeof(zone_limit), &zone_limit); - } -diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c -index dfc820ee553a0..1e4fb568fa841 100644 ---- a/net/qrtr/qrtr.c -+++ b/net/qrtr/qrtr.c -@@ -271,7 +271,10 @@ static int qrtr_tx_wait(struct qrtr_node *node, int dest_node, int dest_port, - flow = kzalloc(sizeof(*flow), GFP_KERNEL); - if (flow) { - init_waitqueue_head(&flow->resume_tx); -- radix_tree_insert(&node->qrtr_tx_flow, key, flow); -+ if (radix_tree_insert(&node->qrtr_tx_flow, key, flow)) { -+ kfree(flow); -+ flow = NULL; -+ } - } - } - mutex_unlock(&node->qrtr_tx_lock); -diff --git a/net/rds/message.c b/net/rds/message.c -index 071a261fdaabb..799034e0f513d 100644 ---- a/net/rds/message.c -+++ b/net/rds/message.c -@@ -347,8 +347,9 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in - rm->data.op_nents = DIV_ROUND_UP(total_len, PAGE_SIZE); - rm->data.op_sg = rds_message_alloc_sgs(rm, num_sgs); - if (IS_ERR(rm->data.op_sg)) { -+ void *err = ERR_CAST(rm->data.op_sg); - rds_message_put(rm); -- return ERR_CAST(rm->data.op_sg); -+ return err; - } - - for (i = 0; i < rm->data.op_nents; ++i) { -diff --git a/net/rfkill/core.c b/net/rfkill/core.c -index 68d6ef9e59fc4..ac15a944573f7 100644 ---- a/net/rfkill/core.c -+++ b/net/rfkill/core.c -@@ -69,7 +69,7 @@ struct rfkill { - - struct rfkill_int_event { - struct list_head list; -- struct rfkill_event ev; -+ struct rfkill_event_ext ev; - }; - - struct rfkill_data { -@@ -253,7 +253,8 @@ static void rfkill_global_led_trigger_unregister(void) - } - #endif /* CONFIG_RFKILL_LEDS */ - --static void rfkill_fill_event(struct rfkill_event *ev, struct rfkill *rfkill, -+static void rfkill_fill_event(struct rfkill_event_ext *ev, -+ struct rfkill *rfkill, - enum rfkill_operation op) - { - unsigned long flags; -@@ -1237,7 +1238,7 @@ static ssize_t rfkill_fop_write(struct file *file, const char __user *buf, - size_t count, loff_t *pos) - { - struct rfkill *rfkill; -- struct rfkill_event ev; -+ struct rfkill_event_ext ev; - int ret; - - /* we don't need the 'hard' variable but accept it */ -diff --git a/net/sched/act_api.c b/net/sched/act_api.c -index b919826939e0b..f6d5755d669eb 100644 ---- a/net/sched/act_api.c -+++ b/net/sched/act_api.c -@@ -158,7 +158,7 @@ static int __tcf_action_put(struct tc_action *p, bool bind) - return 0; - } - --int __tcf_idr_release(struct tc_action *p, bool bind, bool strict) -+static int __tcf_idr_release(struct tc_action *p, bool bind, bool strict) - { - int ret = 0; - -@@ -184,7 +184,18 @@ int __tcf_idr_release(struct tc_action *p, bool bind, bool strict) - - return ret; - } --EXPORT_SYMBOL(__tcf_idr_release); -+ -+int tcf_idr_release(struct tc_action *a, bool bind) -+{ -+ const struct tc_action_ops *ops = a->ops; -+ int ret; -+ -+ ret = __tcf_idr_release(a, bind, false); -+ if (ret == ACT_P_DELETED) -+ module_put(ops->owner); -+ return ret; -+} -+EXPORT_SYMBOL(tcf_idr_release); - - static size_t tcf_action_shared_attrs_size(const struct tc_action *act) - { -@@ -493,6 +504,7 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est, - } - - p->idrinfo = idrinfo; -+ __module_get(ops->owner); - p->ops = ops; - *a = p; - return 0; -@@ -992,7 +1004,8 @@ struct tc_action_ops *tc_action_load_ops(char *name, struct nlattr *nla, - struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, - struct nlattr *nla, struct nlattr *est, - char *name, int ovr, int bind, -- struct tc_action_ops *a_o, bool rtnl_held, -+ struct tc_action_ops *a_o, int *init_res, -+ bool rtnl_held, - struct netlink_ext_ack *extack) - { - struct nla_bitfield32 flags = { 0, 0 }; -@@ -1028,6 +1041,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, - } - if (err < 0) - goto err_out; -+ *init_res = err; - - if (!name && tb[TCA_ACT_COOKIE]) - tcf_set_action_cookie(&a->act_cookie, cookie); -@@ -1035,13 +1049,6 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, - if (!name) - a->hw_stats = hw_stats; - -- /* module count goes up only when brand new policy is created -- * if it exists and is only bound to in a_o->init() then -- * ACT_P_CREATED is not returned (a zero is). -- */ -- if (err != ACT_P_CREATED) -- module_put(a_o->owner); -- - return a; - - err_out: -@@ -1056,7 +1063,7 @@ err_out: - - int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, - struct nlattr *est, char *name, int ovr, int bind, -- struct tc_action *actions[], size_t *attr_size, -+ struct tc_action *actions[], int init_res[], size_t *attr_size, - bool rtnl_held, struct netlink_ext_ack *extack) - { - struct tc_action_ops *ops[TCA_ACT_MAX_PRIO] = {}; -@@ -1084,7 +1091,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, - - for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) { - act = tcf_action_init_1(net, tp, tb[i], est, name, ovr, bind, -- ops[i - 1], rtnl_held, extack); -+ ops[i - 1], &init_res[i - 1], rtnl_held, -+ extack); - if (IS_ERR(act)) { - err = PTR_ERR(act); - goto err; -@@ -1100,7 +1108,8 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla, - tcf_idr_insert_many(actions); - - *attr_size = tcf_action_full_attrs_size(sz); -- return i - 1; -+ err = i - 1; -+ goto err_mod; - - err: - tcf_action_destroy(actions, bind); -@@ -1497,12 +1506,13 @@ static int tcf_action_add(struct net *net, struct nlattr *nla, - struct netlink_ext_ack *extack) - { - size_t attr_size = 0; -- int loop, ret; -+ int loop, ret, i; - struct tc_action *actions[TCA_ACT_MAX_PRIO] = {}; -+ int init_res[TCA_ACT_MAX_PRIO] = {}; - - for (loop = 0; loop < 10; loop++) { - ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, -- actions, &attr_size, true, extack); -+ actions, init_res, &attr_size, true, extack); - if (ret != -EAGAIN) - break; - } -@@ -1510,8 +1520,12 @@ static int tcf_action_add(struct net *net, struct nlattr *nla, - if (ret < 0) - return ret; - ret = tcf_add_notify(net, n, actions, portid, attr_size, extack); -- if (ovr) -- tcf_action_put_many(actions); -+ -+ /* only put existing actions */ -+ for (i = 0; i < TCA_ACT_MAX_PRIO; i++) -+ if (init_res[i] == ACT_P_CREATED) -+ actions[i] = NULL; -+ tcf_action_put_many(actions); - - return ret; - } -diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c -index e37556cc37ab6..b3a2cba130a13 100644 ---- a/net/sched/cls_api.c -+++ b/net/sched/cls_api.c -@@ -646,7 +646,7 @@ static void tc_block_indr_cleanup(struct flow_block_cb *block_cb) - struct net_device *dev = block_cb->indr.dev; - struct Qdisc *sch = block_cb->indr.sch; - struct netlink_ext_ack extack = {}; -- struct flow_block_offload bo; -+ struct flow_block_offload bo = {}; - - tcf_block_offload_init(&bo, dev, sch, FLOW_BLOCK_UNBIND, - block_cb->indr.binder_type, -@@ -3039,6 +3039,7 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, - { - #ifdef CONFIG_NET_CLS_ACT - { -+ int init_res[TCA_ACT_MAX_PRIO] = {}; - struct tc_action *act; - size_t attr_size = 0; - -@@ -3050,12 +3051,11 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, - return PTR_ERR(a_o); - act = tcf_action_init_1(net, tp, tb[exts->police], - rate_tlv, "police", ovr, -- TCA_ACT_BIND, a_o, rtnl_held, -- extack); -- if (IS_ERR(act)) { -- module_put(a_o->owner); -+ TCA_ACT_BIND, a_o, init_res, -+ rtnl_held, extack); -+ module_put(a_o->owner); -+ if (IS_ERR(act)) - return PTR_ERR(act); -- } - - act->type = exts->type = TCA_OLD_COMPAT; - exts->actions[0] = act; -@@ -3066,8 +3066,8 @@ int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, - - err = tcf_action_init(net, tp, tb[exts->action], - rate_tlv, NULL, ovr, TCA_ACT_BIND, -- exts->actions, &attr_size, -- rtnl_held, extack); -+ exts->actions, init_res, -+ &attr_size, rtnl_held, extack); - if (err < 0) - return err; - exts->nr_actions = err; -diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c -index 2f1f0a3784083..6af6b95bdb672 100644 ---- a/net/sched/sch_teql.c -+++ b/net/sched/sch_teql.c -@@ -134,6 +134,9 @@ teql_destroy(struct Qdisc *sch) - struct teql_sched_data *dat = qdisc_priv(sch); - struct teql_master *master = dat->m; - -+ if (!master) -+ return; -+ - prev = master->slaves; - if (prev) { - do { -diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c -index c3e89c776e663..bd08807c9e447 100644 ---- a/net/sctp/ipv6.c -+++ b/net/sctp/ipv6.c -@@ -664,8 +664,8 @@ static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp) - if (!(type & IPV6_ADDR_UNICAST)) - return 0; - -- return sp->inet.freebind || net->ipv6.sysctl.ip_nonlocal_bind || -- ipv6_chk_addr(net, in6, NULL, 0); -+ return ipv6_can_nonlocal_bind(net, &sp->inet) || -+ ipv6_chk_addr(net, in6, NULL, 0); - } - - /* This function checks if the address is a valid address to be used for -@@ -954,8 +954,7 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr) - net = sock_net(&opt->inet.sk); - rcu_read_lock(); - dev = dev_get_by_index_rcu(net, addr->v6.sin6_scope_id); -- if (!dev || !(opt->inet.freebind || -- net->ipv6.sysctl.ip_nonlocal_bind || -+ if (!dev || !(ipv6_can_nonlocal_bind(net, &opt->inet) || - ipv6_chk_addr(net, &addr->v6.sin6_addr, - dev, 0))) { - rcu_read_unlock(); -diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c -index f4fca8f7f63fa..97710ce36047c 100644 ---- a/net/tipc/crypto.c -+++ b/net/tipc/crypto.c -@@ -1941,12 +1941,13 @@ static void tipc_crypto_rcv_complete(struct net *net, struct tipc_aead *aead, - goto rcv; - if (tipc_aead_clone(&tmp, aead) < 0) - goto rcv; -+ WARN_ON(!refcount_inc_not_zero(&tmp->refcnt)); - if (tipc_crypto_key_attach(rx, tmp, ehdr->tx_key, false) < 0) { - tipc_aead_free(&tmp->rcu); - goto rcv; - } - tipc_aead_put(aead); -- aead = tipc_aead_get(tmp); -+ aead = tmp; - } - - if (unlikely(err)) { -diff --git a/net/tipc/socket.c b/net/tipc/socket.c -index cebcc104dc70a..022999e0202d7 100644 ---- a/net/tipc/socket.c -+++ b/net/tipc/socket.c -@@ -1265,7 +1265,7 @@ void tipc_sk_mcast_rcv(struct net *net, struct sk_buff_head *arrvq, - spin_lock_bh(&inputq->lock); - if (skb_peek(arrvq) == skb) { - skb_queue_splice_tail_init(&tmpq, inputq); -- kfree_skb(__skb_dequeue(arrvq)); -+ __skb_dequeue(arrvq); - } - spin_unlock_bh(&inputq->lock); - __skb_queue_purge(&tmpq); -diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c -index 775d0c4d86c36..1f2dff186cb60 100644 ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -5,7 +5,7 @@ - * Copyright 2006-2010 Johannes Berg - * Copyright 2013-2014 Intel Mobile Communications GmbH - * Copyright 2015-2017 Intel Deutschland GmbH -- * Copyright (C) 2018-2020 Intel Corporation -+ * Copyright (C) 2018-2021 Intel Corporation - */ - - #include -@@ -209,9 +209,13 @@ static int validate_beacon_head(const struct nlattr *attr, - unsigned int len = nla_len(attr); - const struct element *elem; - const struct ieee80211_mgmt *mgmt = (void *)data; -- bool s1g_bcn = ieee80211_is_s1g_beacon(mgmt->frame_control); - unsigned int fixedlen, hdrlen; -+ bool s1g_bcn; - -+ if (len < offsetofend(typeof(*mgmt), frame_control)) -+ goto err; -+ -+ s1g_bcn = ieee80211_is_s1g_beacon(mgmt->frame_control); - if (s1g_bcn) { - fixedlen = offsetof(struct ieee80211_ext, - u.s1g_beacon.variable); -@@ -5397,7 +5401,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) - rdev, info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP], - ¶ms); - if (err) -- return err; -+ goto out; - } - - nl80211_calculate_ap_params(¶ms); -diff --git a/net/wireless/scan.c b/net/wireless/scan.c -index 1b7fec3b53cdd..1f1241443a1cc 100644 ---- a/net/wireless/scan.c -+++ b/net/wireless/scan.c -@@ -2352,14 +2352,16 @@ cfg80211_inform_single_bss_frame_data(struct wiphy *wiphy, - return NULL; - - if (ext) { -- struct ieee80211_s1g_bcn_compat_ie *compat; -- u8 *ie; -+ const struct ieee80211_s1g_bcn_compat_ie *compat; -+ const struct element *elem; - -- ie = (void *)cfg80211_find_ie(WLAN_EID_S1G_BCN_COMPAT, -- variable, ielen); -- if (!ie) -+ elem = cfg80211_find_elem(WLAN_EID_S1G_BCN_COMPAT, -+ variable, ielen); -+ if (!elem) -+ return NULL; -+ if (elem->datalen < sizeof(*compat)) - return NULL; -- compat = (void *)(ie + 2); -+ compat = (void *)elem->data; - bssid = ext->u.s1g_beacon.sa; - capability = le16_to_cpu(compat->compat_info); - beacon_int = le16_to_cpu(compat->beacon_int); -diff --git a/net/wireless/sme.c b/net/wireless/sme.c -index 38df713f2e2ed..060e365c8259b 100644 ---- a/net/wireless/sme.c -+++ b/net/wireless/sme.c -@@ -530,7 +530,7 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev, - cfg80211_sme_free(wdev); - } - -- if (WARN_ON(wdev->conn)) -+ if (wdev->conn) - return -EINPROGRESS; - - wdev->conn = kzalloc(sizeof(*wdev->conn), GFP_KERNEL); -diff --git a/net/xfrm/xfrm_compat.c b/net/xfrm/xfrm_compat.c -index d8e8a11ca845e..a20aec9d73933 100644 ---- a/net/xfrm/xfrm_compat.c -+++ b/net/xfrm/xfrm_compat.c -@@ -216,7 +216,7 @@ static struct nlmsghdr *xfrm_nlmsg_put_compat(struct sk_buff *skb, - case XFRM_MSG_GETSADINFO: - case XFRM_MSG_GETSPDINFO: - default: -- WARN_ONCE(1, "unsupported nlmsg_type %d", nlh_src->nlmsg_type); -+ pr_warn_once("unsupported nlmsg_type %d\n", nlh_src->nlmsg_type); - return ERR_PTR(-EOPNOTSUPP); - } - -@@ -277,7 +277,7 @@ static int xfrm_xlate64_attr(struct sk_buff *dst, const struct nlattr *src) - return xfrm_nla_cpy(dst, src, nla_len(src)); - default: - BUILD_BUG_ON(XFRMA_MAX != XFRMA_IF_ID); -- WARN_ONCE(1, "unsupported nla_type %d", src->nla_type); -+ pr_warn_once("unsupported nla_type %d\n", src->nla_type); - return -EOPNOTSUPP; - } - } -@@ -315,8 +315,10 @@ static int xfrm_alloc_compat(struct sk_buff *skb, const struct nlmsghdr *nlh_src - struct sk_buff *new = NULL; - int err; - -- if (WARN_ON_ONCE(type >= ARRAY_SIZE(xfrm_msg_min))) -+ if (type >= ARRAY_SIZE(xfrm_msg_min)) { -+ pr_warn_once("unsupported nlmsg_type %d\n", nlh_src->nlmsg_type); - return -EOPNOTSUPP; -+ } - - if (skb_shinfo(skb)->frag_list == NULL) { - new = alloc_skb(skb->len + skb_tailroom(skb), GFP_ATOMIC); -@@ -378,6 +380,10 @@ static int xfrm_attr_cpy32(void *dst, size_t *pos, const struct nlattr *src, - struct nlmsghdr *nlmsg = dst; - struct nlattr *nla; - -+ /* xfrm_user_rcv_msg_compat() relies on fact that 32-bit messages -+ * have the same len or shorted than 64-bit ones. -+ * 32-bit translation that is bigger than 64-bit original is unexpected. -+ */ - if (WARN_ON_ONCE(copy_len > payload)) - copy_len = payload; - -diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c -index edf11893dbe81..6d6917b68856f 100644 ---- a/net/xfrm/xfrm_device.c -+++ b/net/xfrm/xfrm_device.c -@@ -134,8 +134,6 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur - return skb; - } - -- xo->flags |= XFRM_XMIT; -- - if (skb_is_gso(skb) && unlikely(x->xso.dev != dev)) { - struct sk_buff *segs; - -diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c -index 697cdcfbb5e1a..3f42c2f15ba45 100644 ---- a/net/xfrm/xfrm_interface.c -+++ b/net/xfrm/xfrm_interface.c -@@ -305,6 +305,8 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) - - icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); - } else { -+ if (!(ip_hdr(skb)->frag_off & htons(IP_DF))) -+ goto xmit; - icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, - htonl(mtu)); - } -@@ -313,6 +315,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) - return -EMSGSIZE; - } - -+xmit: - xfrmi_scrub_packet(skb, !net_eq(xi->net, dev_net(dev))); - skb_dst_set(skb, dst); - skb->dev = tdev; -diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c -index a7ab19353313c..b81ca117dac7a 100644 ---- a/net/xfrm/xfrm_output.c -+++ b/net/xfrm/xfrm_output.c -@@ -503,22 +503,22 @@ out: - return err; - } - --int xfrm_output_resume(struct sk_buff *skb, int err) -+int xfrm_output_resume(struct sock *sk, struct sk_buff *skb, int err) - { - struct net *net = xs_net(skb_dst(skb)->xfrm); - - while (likely((err = xfrm_output_one(skb, err)) == 0)) { - nf_reset_ct(skb); - -- err = skb_dst(skb)->ops->local_out(net, skb->sk, skb); -+ err = skb_dst(skb)->ops->local_out(net, sk, skb); - if (unlikely(err != 1)) - goto out; - - if (!skb_dst(skb)->xfrm) -- return dst_output(net, skb->sk, skb); -+ return dst_output(net, sk, skb); - - err = nf_hook(skb_dst(skb)->ops->family, -- NF_INET_POST_ROUTING, net, skb->sk, skb, -+ NF_INET_POST_ROUTING, net, sk, skb, - NULL, skb_dst(skb)->dev, xfrm_output2); - if (unlikely(err != 1)) - goto out; -@@ -534,7 +534,7 @@ EXPORT_SYMBOL_GPL(xfrm_output_resume); - - static int xfrm_output2(struct net *net, struct sock *sk, struct sk_buff *skb) - { -- return xfrm_output_resume(skb, 1); -+ return xfrm_output_resume(sk, skb, 1); - } - - static int xfrm_output_gso(struct net *net, struct sock *sk, struct sk_buff *skb) -diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c -index d01ca1a184189..ffd315cff9846 100644 ---- a/net/xfrm/xfrm_state.c -+++ b/net/xfrm/xfrm_state.c -@@ -44,7 +44,6 @@ static void xfrm_state_gc_task(struct work_struct *work); - */ - - static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024; --static __read_mostly seqcount_t xfrm_state_hash_generation = SEQCNT_ZERO(xfrm_state_hash_generation); - static struct kmem_cache *xfrm_state_cache __ro_after_init; - - static DECLARE_WORK(xfrm_state_gc_work, xfrm_state_gc_task); -@@ -140,7 +139,7 @@ static void xfrm_hash_resize(struct work_struct *work) - } - - spin_lock_bh(&net->xfrm.xfrm_state_lock); -- write_seqcount_begin(&xfrm_state_hash_generation); -+ write_seqcount_begin(&net->xfrm.xfrm_state_hash_generation); - - nhashmask = (nsize / sizeof(struct hlist_head)) - 1U; - odst = xfrm_state_deref_prot(net->xfrm.state_bydst, net); -@@ -156,7 +155,7 @@ static void xfrm_hash_resize(struct work_struct *work) - rcu_assign_pointer(net->xfrm.state_byspi, nspi); - net->xfrm.state_hmask = nhashmask; - -- write_seqcount_end(&xfrm_state_hash_generation); -+ write_seqcount_end(&net->xfrm.xfrm_state_hash_generation); - spin_unlock_bh(&net->xfrm.xfrm_state_lock); - - osize = (ohashmask + 1) * sizeof(struct hlist_head); -@@ -1063,7 +1062,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr, - - to_put = NULL; - -- sequence = read_seqcount_begin(&xfrm_state_hash_generation); -+ sequence = read_seqcount_begin(&net->xfrm.xfrm_state_hash_generation); - - rcu_read_lock(); - h = xfrm_dst_hash(net, daddr, saddr, tmpl->reqid, encap_family); -@@ -1176,7 +1175,7 @@ out: - if (to_put) - xfrm_state_put(to_put); - -- if (read_seqcount_retry(&xfrm_state_hash_generation, sequence)) { -+ if (read_seqcount_retry(&net->xfrm.xfrm_state_hash_generation, sequence)) { - *err = -EAGAIN; - if (x) { - xfrm_state_put(x); -@@ -2666,6 +2665,7 @@ int __net_init xfrm_state_init(struct net *net) - net->xfrm.state_num = 0; - INIT_WORK(&net->xfrm.state_hash_work, xfrm_hash_resize); - spin_lock_init(&net->xfrm.xfrm_state_lock); -+ seqcount_init(&net->xfrm.xfrm_state_hash_generation); - return 0; - - out_byspi: -diff --git a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c -index 0172d87e2b9ae..364b2ef9b36f8 100644 ---- a/security/selinux/ss/avtab.c -+++ b/security/selinux/ss/avtab.c -@@ -109,7 +109,7 @@ static int avtab_insert(struct avtab *h, struct avtab_key *key, struct avtab_dat - struct avtab_node *prev, *cur, *newnode; - u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); - -- if (!h) -+ if (!h || !h->nslot) - return -EINVAL; - - hvalue = avtab_hash(key, h->mask); -@@ -154,7 +154,7 @@ avtab_insert_nonunique(struct avtab *h, struct avtab_key *key, struct avtab_datu - struct avtab_node *prev, *cur; - u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); - -- if (!h) -+ if (!h || !h->nslot) - return NULL; - hvalue = avtab_hash(key, h->mask); - for (prev = NULL, cur = h->htable[hvalue]; -@@ -184,7 +184,7 @@ struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *key) - struct avtab_node *cur; - u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); - -- if (!h) -+ if (!h || !h->nslot) - return NULL; - - hvalue = avtab_hash(key, h->mask); -@@ -220,7 +220,7 @@ avtab_search_node(struct avtab *h, struct avtab_key *key) - struct avtab_node *cur; - u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); - -- if (!h) -+ if (!h || !h->nslot) - return NULL; - - hvalue = avtab_hash(key, h->mask); -@@ -295,6 +295,7 @@ void avtab_destroy(struct avtab *h) - } - kvfree(h->htable); - h->htable = NULL; -+ h->nel = 0; - h->nslot = 0; - h->mask = 0; - } -@@ -303,88 +304,52 @@ void avtab_init(struct avtab *h) - { - h->htable = NULL; - h->nel = 0; -+ h->nslot = 0; -+ h->mask = 0; - } - --int avtab_alloc(struct avtab *h, u32 nrules) -+static int avtab_alloc_common(struct avtab *h, u32 nslot) - { -- u32 mask = 0; -- u32 shift = 0; -- u32 work = nrules; -- u32 nslot = 0; -- -- if (nrules == 0) -- goto avtab_alloc_out; -- -- while (work) { -- work = work >> 1; -- shift++; -- } -- if (shift > 2) -- shift = shift - 2; -- nslot = 1 << shift; -- if (nslot > MAX_AVTAB_HASH_BUCKETS) -- nslot = MAX_AVTAB_HASH_BUCKETS; -- mask = nslot - 1; -+ if (!nslot) -+ return 0; - - h->htable = kvcalloc(nslot, sizeof(void *), GFP_KERNEL); - if (!h->htable) - return -ENOMEM; - -- avtab_alloc_out: -- h->nel = 0; - h->nslot = nslot; -- h->mask = mask; -- pr_debug("SELinux: %d avtab hash slots, %d rules.\n", -- h->nslot, nrules); -+ h->mask = nslot - 1; - return 0; - } - --int avtab_duplicate(struct avtab *new, struct avtab *orig) -+int avtab_alloc(struct avtab *h, u32 nrules) - { -- int i; -- struct avtab_node *node, *tmp, *tail; -- -- memset(new, 0, sizeof(*new)); -+ int rc; -+ u32 nslot = 0; - -- new->htable = kvcalloc(orig->nslot, sizeof(void *), GFP_KERNEL); -- if (!new->htable) -- return -ENOMEM; -- new->nslot = orig->nslot; -- new->mask = orig->mask; -- -- for (i = 0; i < orig->nslot; i++) { -- tail = NULL; -- for (node = orig->htable[i]; node; node = node->next) { -- tmp = kmem_cache_zalloc(avtab_node_cachep, GFP_KERNEL); -- if (!tmp) -- goto error; -- tmp->key = node->key; -- if (tmp->key.specified & AVTAB_XPERMS) { -- tmp->datum.u.xperms = -- kmem_cache_zalloc(avtab_xperms_cachep, -- GFP_KERNEL); -- if (!tmp->datum.u.xperms) { -- kmem_cache_free(avtab_node_cachep, tmp); -- goto error; -- } -- tmp->datum.u.xperms = node->datum.u.xperms; -- } else -- tmp->datum.u.data = node->datum.u.data; -- -- if (tail) -- tail->next = tmp; -- else -- new->htable[i] = tmp; -- -- tail = tmp; -- new->nel++; -+ if (nrules != 0) { -+ u32 shift = 1; -+ u32 work = nrules >> 3; -+ while (work) { -+ work >>= 1; -+ shift++; - } -+ nslot = 1 << shift; -+ if (nslot > MAX_AVTAB_HASH_BUCKETS) -+ nslot = MAX_AVTAB_HASH_BUCKETS; -+ -+ rc = avtab_alloc_common(h, nslot); -+ if (rc) -+ return rc; - } - -+ pr_debug("SELinux: %d avtab hash slots, %d rules.\n", nslot, nrules); - return 0; --error: -- avtab_destroy(new); -- return -ENOMEM; -+} -+ -+int avtab_alloc_dup(struct avtab *new, const struct avtab *orig) -+{ -+ return avtab_alloc_common(new, orig->nslot); - } - - void avtab_hash_eval(struct avtab *h, char *tag) -diff --git a/security/selinux/ss/avtab.h b/security/selinux/ss/avtab.h -index 4c4445ca9118e..f2eeb36265d15 100644 ---- a/security/selinux/ss/avtab.h -+++ b/security/selinux/ss/avtab.h -@@ -89,7 +89,7 @@ struct avtab { - - void avtab_init(struct avtab *h); - int avtab_alloc(struct avtab *, u32); --int avtab_duplicate(struct avtab *new, struct avtab *orig); -+int avtab_alloc_dup(struct avtab *new, const struct avtab *orig); - struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *k); - void avtab_destroy(struct avtab *h); - void avtab_hash_eval(struct avtab *h, char *tag); -diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c -index 0b32f3ab025e5..1ef74c085f2b0 100644 ---- a/security/selinux/ss/conditional.c -+++ b/security/selinux/ss/conditional.c -@@ -605,7 +605,6 @@ static int cond_dup_av_list(struct cond_av_list *new, - struct cond_av_list *orig, - struct avtab *avtab) - { -- struct avtab_node *avnode; - u32 i; - - memset(new, 0, sizeof(*new)); -@@ -615,10 +614,11 @@ static int cond_dup_av_list(struct cond_av_list *new, - return -ENOMEM; - - for (i = 0; i < orig->len; i++) { -- avnode = avtab_search_node(avtab, &orig->nodes[i]->key); -- if (WARN_ON(!avnode)) -- return -EINVAL; -- new->nodes[i] = avnode; -+ new->nodes[i] = avtab_insert_nonunique(avtab, -+ &orig->nodes[i]->key, -+ &orig->nodes[i]->datum); -+ if (!new->nodes[i]) -+ return -ENOMEM; - new->len++; - } - -@@ -630,7 +630,7 @@ static int duplicate_policydb_cond_list(struct policydb *newp, - { - int rc, i, j; - -- rc = avtab_duplicate(&newp->te_cond_avtab, &origp->te_cond_avtab); -+ rc = avtab_alloc_dup(&newp->te_cond_avtab, &origp->te_cond_avtab); - if (rc) - return rc; - -diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c -index 8d9bbd39ab9a8..b09138000185c 100644 ---- a/security/selinux/ss/services.c -+++ b/security/selinux/ss/services.c -@@ -1551,6 +1551,7 @@ static int security_context_to_sid_core(struct selinux_state *state, - if (!str) - goto out; - } -+retry: - rcu_read_lock(); - policy = rcu_dereference(state->policy); - policydb = &policy->policydb; -@@ -1564,6 +1565,15 @@ static int security_context_to_sid_core(struct selinux_state *state, - } else if (rc) - goto out_unlock; - rc = sidtab_context_to_sid(sidtab, &context, sid); -+ if (rc == -ESTALE) { -+ rcu_read_unlock(); -+ if (context.str) { -+ str = context.str; -+ context.str = NULL; -+ } -+ context_destroy(&context); -+ goto retry; -+ } - context_destroy(&context); - out_unlock: - rcu_read_unlock(); -@@ -1713,7 +1723,7 @@ static int security_compute_sid(struct selinux_state *state, - struct selinux_policy *policy; - struct policydb *policydb; - struct sidtab *sidtab; -- struct class_datum *cladatum = NULL; -+ struct class_datum *cladatum; - struct context *scontext, *tcontext, newcontext; - struct sidtab_entry *sentry, *tentry; - struct avtab_key avkey; -@@ -1735,6 +1745,8 @@ static int security_compute_sid(struct selinux_state *state, - goto out; - } - -+retry: -+ cladatum = NULL; - context_init(&newcontext); - - rcu_read_lock(); -@@ -1879,6 +1891,11 @@ static int security_compute_sid(struct selinux_state *state, - } - /* Obtain the sid for the context. */ - rc = sidtab_context_to_sid(sidtab, &newcontext, out_sid); -+ if (rc == -ESTALE) { -+ rcu_read_unlock(); -+ context_destroy(&newcontext); -+ goto retry; -+ } - out_unlock: - rcu_read_unlock(); - context_destroy(&newcontext); -@@ -2190,6 +2207,7 @@ void selinux_policy_commit(struct selinux_state *state, - struct selinux_load_state *load_state) - { - struct selinux_policy *oldpolicy, *newpolicy = load_state->policy; -+ unsigned long flags; - u32 seqno; - - oldpolicy = rcu_dereference_protected(state->policy, -@@ -2211,7 +2229,13 @@ void selinux_policy_commit(struct selinux_state *state, - seqno = newpolicy->latest_granting; - - /* Install the new policy. */ -- rcu_assign_pointer(state->policy, newpolicy); -+ if (oldpolicy) { -+ sidtab_freeze_begin(oldpolicy->sidtab, &flags); -+ rcu_assign_pointer(state->policy, newpolicy); -+ sidtab_freeze_end(oldpolicy->sidtab, &flags); -+ } else { -+ rcu_assign_pointer(state->policy, newpolicy); -+ } - - /* Load the policycaps from the new policy */ - security_load_policycaps(state, newpolicy); -@@ -2355,13 +2379,15 @@ int security_port_sid(struct selinux_state *state, - struct policydb *policydb; - struct sidtab *sidtab; - struct ocontext *c; -- int rc = 0; -+ int rc; - - if (!selinux_initialized(state)) { - *out_sid = SECINITSID_PORT; - return 0; - } - -+retry: -+ rc = 0; - rcu_read_lock(); - policy = rcu_dereference(state->policy); - policydb = &policy->policydb; -@@ -2380,6 +2406,10 @@ int security_port_sid(struct selinux_state *state, - if (!c->sid[0]) { - rc = sidtab_context_to_sid(sidtab, &c->context[0], - &c->sid[0]); -+ if (rc == -ESTALE) { -+ rcu_read_unlock(); -+ goto retry; -+ } - if (rc) - goto out; - } -@@ -2406,13 +2436,15 @@ int security_ib_pkey_sid(struct selinux_state *state, - struct policydb *policydb; - struct sidtab *sidtab; - struct ocontext *c; -- int rc = 0; -+ int rc; - - if (!selinux_initialized(state)) { - *out_sid = SECINITSID_UNLABELED; - return 0; - } - -+retry: -+ rc = 0; - rcu_read_lock(); - policy = rcu_dereference(state->policy); - policydb = &policy->policydb; -@@ -2433,6 +2465,10 @@ int security_ib_pkey_sid(struct selinux_state *state, - rc = sidtab_context_to_sid(sidtab, - &c->context[0], - &c->sid[0]); -+ if (rc == -ESTALE) { -+ rcu_read_unlock(); -+ goto retry; -+ } - if (rc) - goto out; - } -@@ -2458,13 +2494,15 @@ int security_ib_endport_sid(struct selinux_state *state, - struct policydb *policydb; - struct sidtab *sidtab; - struct ocontext *c; -- int rc = 0; -+ int rc; - - if (!selinux_initialized(state)) { - *out_sid = SECINITSID_UNLABELED; - return 0; - } - -+retry: -+ rc = 0; - rcu_read_lock(); - policy = rcu_dereference(state->policy); - policydb = &policy->policydb; -@@ -2485,6 +2523,10 @@ int security_ib_endport_sid(struct selinux_state *state, - if (!c->sid[0]) { - rc = sidtab_context_to_sid(sidtab, &c->context[0], - &c->sid[0]); -+ if (rc == -ESTALE) { -+ rcu_read_unlock(); -+ goto retry; -+ } - if (rc) - goto out; - } -@@ -2508,7 +2550,7 @@ int security_netif_sid(struct selinux_state *state, - struct selinux_policy *policy; - struct policydb *policydb; - struct sidtab *sidtab; -- int rc = 0; -+ int rc; - struct ocontext *c; - - if (!selinux_initialized(state)) { -@@ -2516,6 +2558,8 @@ int security_netif_sid(struct selinux_state *state, - return 0; - } - -+retry: -+ rc = 0; - rcu_read_lock(); - policy = rcu_dereference(state->policy); - policydb = &policy->policydb; -@@ -2532,10 +2576,18 @@ int security_netif_sid(struct selinux_state *state, - if (!c->sid[0] || !c->sid[1]) { - rc = sidtab_context_to_sid(sidtab, &c->context[0], - &c->sid[0]); -+ if (rc == -ESTALE) { -+ rcu_read_unlock(); -+ goto retry; -+ } - if (rc) - goto out; - rc = sidtab_context_to_sid(sidtab, &c->context[1], - &c->sid[1]); -+ if (rc == -ESTALE) { -+ rcu_read_unlock(); -+ goto retry; -+ } - if (rc) - goto out; - } -@@ -2585,6 +2637,7 @@ int security_node_sid(struct selinux_state *state, - return 0; - } - -+retry: - rcu_read_lock(); - policy = rcu_dereference(state->policy); - policydb = &policy->policydb; -@@ -2633,6 +2686,10 @@ int security_node_sid(struct selinux_state *state, - rc = sidtab_context_to_sid(sidtab, - &c->context[0], - &c->sid[0]); -+ if (rc == -ESTALE) { -+ rcu_read_unlock(); -+ goto retry; -+ } - if (rc) - goto out; - } -@@ -2674,18 +2731,24 @@ int security_get_user_sids(struct selinux_state *state, - struct sidtab *sidtab; - struct context *fromcon, usercon; - u32 *mysids = NULL, *mysids2, sid; -- u32 mynel = 0, maxnel = SIDS_NEL; -+ u32 i, j, mynel, maxnel = SIDS_NEL; - struct user_datum *user; - struct role_datum *role; - struct ebitmap_node *rnode, *tnode; -- int rc = 0, i, j; -+ int rc; - - *sids = NULL; - *nel = 0; - - if (!selinux_initialized(state)) -- goto out; -+ return 0; -+ -+ mysids = kcalloc(maxnel, sizeof(*mysids), GFP_KERNEL); -+ if (!mysids) -+ return -ENOMEM; - -+retry: -+ mynel = 0; - rcu_read_lock(); - policy = rcu_dereference(state->policy); - policydb = &policy->policydb; -@@ -2705,11 +2768,6 @@ int security_get_user_sids(struct selinux_state *state, - - usercon.user = user->value; - -- rc = -ENOMEM; -- mysids = kcalloc(maxnel, sizeof(*mysids), GFP_ATOMIC); -- if (!mysids) -- goto out_unlock; -- - ebitmap_for_each_positive_bit(&user->roles, rnode, i) { - role = policydb->role_val_to_struct[i]; - usercon.role = i + 1; -@@ -2721,6 +2779,10 @@ int security_get_user_sids(struct selinux_state *state, - continue; - - rc = sidtab_context_to_sid(sidtab, &usercon, &sid); -+ if (rc == -ESTALE) { -+ rcu_read_unlock(); -+ goto retry; -+ } - if (rc) - goto out_unlock; - if (mynel < maxnel) { -@@ -2743,14 +2805,14 @@ out_unlock: - rcu_read_unlock(); - if (rc || !mynel) { - kfree(mysids); -- goto out; -+ return rc; - } - - rc = -ENOMEM; - mysids2 = kcalloc(mynel, sizeof(*mysids2), GFP_KERNEL); - if (!mysids2) { - kfree(mysids); -- goto out; -+ return rc; - } - for (i = 0, j = 0; i < mynel; i++) { - struct av_decision dummy_avd; -@@ -2763,12 +2825,10 @@ out_unlock: - mysids2[j++] = mysids[i]; - cond_resched(); - } -- rc = 0; - kfree(mysids); - *sids = mysids2; - *nel = j; --out: -- return rc; -+ return 0; - } - - /** -@@ -2781,6 +2841,9 @@ out: - * Obtain a SID to use for a file in a filesystem that - * cannot support xattr or use a fixed labeling behavior like - * transition SIDs or task SIDs. -+ * -+ * WARNING: This function may return -ESTALE, indicating that the caller -+ * must retry the operation after re-acquiring the policy pointer! - */ - static inline int __security_genfs_sid(struct selinux_policy *policy, - const char *fstype, -@@ -2859,11 +2922,13 @@ int security_genfs_sid(struct selinux_state *state, - return 0; - } - -- rcu_read_lock(); -- policy = rcu_dereference(state->policy); -- retval = __security_genfs_sid(policy, -- fstype, path, orig_sclass, sid); -- rcu_read_unlock(); -+ do { -+ rcu_read_lock(); -+ policy = rcu_dereference(state->policy); -+ retval = __security_genfs_sid(policy, fstype, path, -+ orig_sclass, sid); -+ rcu_read_unlock(); -+ } while (retval == -ESTALE); - return retval; - } - -@@ -2886,7 +2951,7 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb) - struct selinux_policy *policy; - struct policydb *policydb; - struct sidtab *sidtab; -- int rc = 0; -+ int rc; - struct ocontext *c; - struct superblock_security_struct *sbsec = sb->s_security; - const char *fstype = sb->s_type->name; -@@ -2897,6 +2962,8 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb) - return 0; - } - -+retry: -+ rc = 0; - rcu_read_lock(); - policy = rcu_dereference(state->policy); - policydb = &policy->policydb; -@@ -2914,6 +2981,10 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb) - if (!c->sid[0]) { - rc = sidtab_context_to_sid(sidtab, &c->context[0], - &c->sid[0]); -+ if (rc == -ESTALE) { -+ rcu_read_unlock(); -+ goto retry; -+ } - if (rc) - goto out; - } -@@ -2921,6 +2992,10 @@ int security_fs_use(struct selinux_state *state, struct super_block *sb) - } else { - rc = __security_genfs_sid(policy, fstype, "/", - SECCLASS_DIR, &sbsec->sid); -+ if (rc == -ESTALE) { -+ rcu_read_unlock(); -+ goto retry; -+ } - if (rc) { - sbsec->behavior = SECURITY_FS_USE_NONE; - rc = 0; -@@ -3130,12 +3205,13 @@ int security_sid_mls_copy(struct selinux_state *state, - u32 len; - int rc; - -- rc = 0; - if (!selinux_initialized(state)) { - *new_sid = sid; -- goto out; -+ return 0; - } - -+retry: -+ rc = 0; - context_init(&newcon); - - rcu_read_lock(); -@@ -3194,10 +3270,14 @@ int security_sid_mls_copy(struct selinux_state *state, - } - } - rc = sidtab_context_to_sid(sidtab, &newcon, new_sid); -+ if (rc == -ESTALE) { -+ rcu_read_unlock(); -+ context_destroy(&newcon); -+ goto retry; -+ } - out_unlock: - rcu_read_unlock(); - context_destroy(&newcon); --out: - return rc; - } - -@@ -3794,6 +3874,8 @@ int security_netlbl_secattr_to_sid(struct selinux_state *state, - return 0; - } - -+retry: -+ rc = 0; - rcu_read_lock(); - policy = rcu_dereference(state->policy); - policydb = &policy->policydb; -@@ -3820,23 +3902,24 @@ int security_netlbl_secattr_to_sid(struct selinux_state *state, - goto out; - } - rc = -EIDRM; -- if (!mls_context_isvalid(policydb, &ctx_new)) -- goto out_free; -+ if (!mls_context_isvalid(policydb, &ctx_new)) { -+ ebitmap_destroy(&ctx_new.range.level[0].cat); -+ goto out; -+ } - - rc = sidtab_context_to_sid(sidtab, &ctx_new, sid); -+ ebitmap_destroy(&ctx_new.range.level[0].cat); -+ if (rc == -ESTALE) { -+ rcu_read_unlock(); -+ goto retry; -+ } - if (rc) -- goto out_free; -+ goto out; - - security_netlbl_cache_add(secattr, *sid); -- -- ebitmap_destroy(&ctx_new.range.level[0].cat); - } else - *sid = SECSID_NULL; - -- rcu_read_unlock(); -- return 0; --out_free: -- ebitmap_destroy(&ctx_new.range.level[0].cat); - out: - rcu_read_unlock(); - return rc; -diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c -index 5ee190bd30f53..656d50b09f762 100644 ---- a/security/selinux/ss/sidtab.c -+++ b/security/selinux/ss/sidtab.c -@@ -39,6 +39,7 @@ int sidtab_init(struct sidtab *s) - for (i = 0; i < SECINITSID_NUM; i++) - s->isids[i].set = 0; - -+ s->frozen = false; - s->count = 0; - s->convert = NULL; - hash_init(s->context_to_sid); -@@ -281,6 +282,15 @@ int sidtab_context_to_sid(struct sidtab *s, struct context *context, - if (*sid) - goto out_unlock; - -+ if (unlikely(s->frozen)) { -+ /* -+ * This sidtab is now frozen - tell the caller to abort and -+ * get the new one. -+ */ -+ rc = -ESTALE; -+ goto out_unlock; -+ } -+ - count = s->count; - convert = s->convert; - -@@ -474,6 +484,17 @@ void sidtab_cancel_convert(struct sidtab *s) - spin_unlock_irqrestore(&s->lock, flags); - } - -+void sidtab_freeze_begin(struct sidtab *s, unsigned long *flags) __acquires(&s->lock) -+{ -+ spin_lock_irqsave(&s->lock, *flags); -+ s->frozen = true; -+ s->convert = NULL; -+} -+void sidtab_freeze_end(struct sidtab *s, unsigned long *flags) __releases(&s->lock) -+{ -+ spin_unlock_irqrestore(&s->lock, *flags); -+} -+ - static void sidtab_destroy_entry(struct sidtab_entry *entry) - { - context_destroy(&entry->context); -diff --git a/security/selinux/ss/sidtab.h b/security/selinux/ss/sidtab.h -index 80c744d07ad62..4eff0e49dcb22 100644 ---- a/security/selinux/ss/sidtab.h -+++ b/security/selinux/ss/sidtab.h -@@ -86,6 +86,7 @@ struct sidtab { - u32 count; - /* access only under spinlock */ - struct sidtab_convert_params *convert; -+ bool frozen; - spinlock_t lock; - - #if CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE > 0 -@@ -125,6 +126,9 @@ int sidtab_convert(struct sidtab *s, struct sidtab_convert_params *params); - - void sidtab_cancel_convert(struct sidtab *s); - -+void sidtab_freeze_begin(struct sidtab *s, unsigned long *flags) __acquires(&s->lock); -+void sidtab_freeze_end(struct sidtab *s, unsigned long *flags) __releases(&s->lock); -+ - int sidtab_context_to_sid(struct sidtab *s, struct context *context, u32 *sid); - - void sidtab_destroy(struct sidtab *s); -diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c -index 702f91b9c60f7..12caa87fe74e8 100644 ---- a/sound/drivers/aloop.c -+++ b/sound/drivers/aloop.c -@@ -1572,6 +1572,14 @@ static int loopback_mixer_new(struct loopback *loopback, int notify) - return -ENOMEM; - kctl->id.device = dev; - kctl->id.subdevice = substr; -+ -+ /* Add the control before copying the id so that -+ * the numid field of the id is set in the copy. -+ */ -+ err = snd_ctl_add(card, kctl); -+ if (err < 0) -+ return err; -+ - switch (idx) { - case ACTIVE_IDX: - setup->active_id = kctl->id; -@@ -1588,9 +1596,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify) - default: - break; - } -- err = snd_ctl_add(card, kctl); -- if (err < 0) -- return err; - } - } - } -diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c -index a980a4eda51c9..7aa9062f4f838 100644 ---- a/sound/pci/hda/patch_conexant.c -+++ b/sound/pci/hda/patch_conexant.c -@@ -944,6 +944,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { - SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x103c, 0x8402, "HP ProBook 645 G4", CXT_FIXUP_MUTE_LED_GPIO), - SND_PCI_QUIRK(0x103c, 0x8427, "HP ZBook Studio G5", CXT_FIXUP_HP_ZBOOK_MUTE_LED), -+ SND_PCI_QUIRK(0x103c, 0x844f, "HP ZBook Studio G5", CXT_FIXUP_HP_ZBOOK_MUTE_LED), - SND_PCI_QUIRK(0x103c, 0x8455, "HP Z2 G4", CXT_FIXUP_HP_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x103c, 0x8456, "HP Z2 G4 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x103c, 0x8457, "HP Z2 G4 mini", CXT_FIXUP_HP_MIC_NO_PRESENCE), -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 58946d069ee59..a7544b77d3f7c 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -3927,6 +3927,15 @@ static void alc271_fixup_dmic(struct hda_codec *codec, - snd_hda_sequence_write(codec, verbs); - } - -+/* Fix the speaker amp after resume, etc */ -+static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec, -+ const struct hda_fixup *fix, -+ int action) -+{ -+ if (action == HDA_FIXUP_ACT_INIT) -+ alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000); -+} -+ - static void alc269_fixup_pcm_44k(struct hda_codec *codec, - const struct hda_fixup *fix, int action) - { -@@ -6301,6 +6310,7 @@ enum { - ALC283_FIXUP_HEADSET_MIC, - ALC255_FIXUP_MIC_MUTE_LED, - ALC282_FIXUP_ASPIRE_V5_PINS, -+ ALC269VB_FIXUP_ASPIRE_E1_COEF, - ALC280_FIXUP_HP_GPIO4, - ALC286_FIXUP_HP_GPIO_LED, - ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, -@@ -6979,6 +6989,10 @@ static const struct hda_fixup alc269_fixups[] = { - { }, - }, - }, -+ [ALC269VB_FIXUP_ASPIRE_E1_COEF] = { -+ .type = HDA_FIXUP_FUNC, -+ .v.func = alc269vb_fixup_aspire_e1_coef, -+ }, - [ALC280_FIXUP_HP_GPIO4] = { - .type = HDA_FIXUP_FUNC, - .v.func = alc280_fixup_hp_gpio4, -@@ -7901,6 +7915,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), - SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), - SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), -+ SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF), - SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK), - SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC), -@@ -8395,6 +8410,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { - {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"}, - {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"}, - {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"}, -+ {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"}, - {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"}, - {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, - {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"}, -diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c -index 660ec46eecf25..ceaf3bbb18e66 100644 ---- a/sound/soc/codecs/wm8960.c -+++ b/sound/soc/codecs/wm8960.c -@@ -707,7 +707,13 @@ int wm8960_configure_pll(struct snd_soc_component *component, int freq_in, - best_freq_out = -EINVAL; - *sysclk_idx = *dac_idx = *bclk_idx = -1; - -- for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) { -+ /* -+ * From Datasheet, the PLL performs best when f2 is between -+ * 90MHz and 100MHz, the desired sysclk output is 11.2896MHz -+ * or 12.288MHz, then sysclkdiv = 2 is the best choice. -+ * So search sysclk_divs from 2 to 1 other than from 1 to 2. -+ */ -+ for (i = ARRAY_SIZE(sysclk_divs) - 1; i >= 0; --i) { - if (sysclk_divs[i] == -1) - continue; - for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) { -diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c -index 9e9b05883557c..aa5dd590ddd52 100644 ---- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c -+++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c -@@ -488,14 +488,14 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { - .channels_min = SST_STEREO, - .channels_max = SST_STEREO, - .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, -- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, -+ .formats = SNDRV_PCM_FMTBIT_S16_LE, - }, - .capture = { - .stream_name = "Headset Capture", - .channels_min = 1, - .channels_max = 2, - .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, -- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, -+ .formats = SNDRV_PCM_FMTBIT_S16_LE, - }, - }, - { -@@ -506,7 +506,7 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { - .channels_min = SST_STEREO, - .channels_max = SST_STEREO, - .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, -- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, -+ .formats = SNDRV_PCM_FMTBIT_S16_LE, - }, - }, - { -diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c -index 012bac41fee0a..ea8e7ad8684d3 100644 ---- a/sound/soc/sof/intel/hda-dsp.c -+++ b/sound/soc/sof/intel/hda-dsp.c -@@ -226,10 +226,17 @@ bool hda_dsp_core_is_enabled(struct snd_sof_dev *sdev, - - val = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPCS); - -- is_enable = (val & HDA_DSP_ADSPCS_CPA_MASK(core_mask)) && -- (val & HDA_DSP_ADSPCS_SPA_MASK(core_mask)) && -- !(val & HDA_DSP_ADSPCS_CRST_MASK(core_mask)) && -- !(val & HDA_DSP_ADSPCS_CSTALL_MASK(core_mask)); -+#define MASK_IS_EQUAL(v, m, field) ({ \ -+ u32 _m = field(m); \ -+ ((v) & _m) == _m; \ -+}) -+ -+ is_enable = MASK_IS_EQUAL(val, core_mask, HDA_DSP_ADSPCS_CPA_MASK) && -+ MASK_IS_EQUAL(val, core_mask, HDA_DSP_ADSPCS_SPA_MASK) && -+ !(val & HDA_DSP_ADSPCS_CRST_MASK(core_mask)) && -+ !(val & HDA_DSP_ADSPCS_CSTALL_MASK(core_mask)); -+ -+#undef MASK_IS_EQUAL - - dev_dbg(sdev->dev, "DSP core(s) enabled? %d : core_mask %x\n", - is_enable, core_mask); -diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c -index 6c13cc84b3fb5..2173991c13db1 100644 ---- a/sound/soc/sunxi/sun4i-codec.c -+++ b/sound/soc/sunxi/sun4i-codec.c -@@ -1364,6 +1364,7 @@ static struct snd_soc_card *sun4i_codec_create_card(struct device *dev) - return ERR_PTR(-ENOMEM); - - card->dev = dev; -+ card->owner = THIS_MODULE; - card->name = "sun4i-codec"; - card->dapm_widgets = sun4i_codec_card_dapm_widgets; - card->num_dapm_widgets = ARRAY_SIZE(sun4i_codec_card_dapm_widgets); -@@ -1396,6 +1397,7 @@ static struct snd_soc_card *sun6i_codec_create_card(struct device *dev) - return ERR_PTR(-ENOMEM); - - card->dev = dev; -+ card->owner = THIS_MODULE; - card->name = "A31 Audio Codec"; - card->dapm_widgets = sun6i_codec_card_dapm_widgets; - card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); -@@ -1449,6 +1451,7 @@ static struct snd_soc_card *sun8i_a23_codec_create_card(struct device *dev) - return ERR_PTR(-ENOMEM); - - card->dev = dev; -+ card->owner = THIS_MODULE; - card->name = "A23 Audio Codec"; - card->dapm_widgets = sun6i_codec_card_dapm_widgets; - card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); -@@ -1487,6 +1490,7 @@ static struct snd_soc_card *sun8i_h3_codec_create_card(struct device *dev) - return ERR_PTR(-ENOMEM); - - card->dev = dev; -+ card->owner = THIS_MODULE; - card->name = "H3 Audio Codec"; - card->dapm_widgets = sun6i_codec_card_dapm_widgets; - card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); -@@ -1525,6 +1529,7 @@ static struct snd_soc_card *sun8i_v3s_codec_create_card(struct device *dev) - return ERR_PTR(-ENOMEM); - - card->dev = dev; -+ card->owner = THIS_MODULE; - card->name = "V3s Audio Codec"; - card->dapm_widgets = sun6i_codec_card_dapm_widgets; - card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); -diff --git a/tools/lib/bpf/ringbuf.c b/tools/lib/bpf/ringbuf.c -index 8caaafe7e312b..e7a8d847161f2 100644 ---- a/tools/lib/bpf/ringbuf.c -+++ b/tools/lib/bpf/ringbuf.c -@@ -227,7 +227,7 @@ static int ringbuf_process_ring(struct ring* r) - if ((len & BPF_RINGBUF_DISCARD_BIT) == 0) { - sample = (void *)len_ptr + BPF_RINGBUF_HDR_SZ; - err = r->sample_cb(r->ctx, sample, len); -- if (err) { -+ if (err < 0) { - /* update consumer pos and bail out */ - smp_store_release(r->consumer_pos, - cons_pos); -diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c -index 06746d96742f3..ba70937c5362a 100644 ---- a/tools/lib/bpf/xsk.c -+++ b/tools/lib/bpf/xsk.c -@@ -54,6 +54,8 @@ struct xsk_umem { - int fd; - int refcount; - struct list_head ctx_list; -+ bool rx_ring_setup_done; -+ bool tx_ring_setup_done; - }; - - struct xsk_ctx { -@@ -668,26 +670,30 @@ static struct xsk_ctx *xsk_get_ctx(struct xsk_umem *umem, int ifindex, - return NULL; - } - --static void xsk_put_ctx(struct xsk_ctx *ctx) -+static void xsk_put_ctx(struct xsk_ctx *ctx, bool unmap) - { - struct xsk_umem *umem = ctx->umem; - struct xdp_mmap_offsets off; - int err; - -- if (--ctx->refcount == 0) { -- err = xsk_get_mmap_offsets(umem->fd, &off); -- if (!err) { -- munmap(ctx->fill->ring - off.fr.desc, -- off.fr.desc + umem->config.fill_size * -- sizeof(__u64)); -- munmap(ctx->comp->ring - off.cr.desc, -- off.cr.desc + umem->config.comp_size * -- sizeof(__u64)); -- } -+ if (--ctx->refcount) -+ return; - -- list_del(&ctx->list); -- free(ctx); -- } -+ if (!unmap) -+ goto out_free; -+ -+ err = xsk_get_mmap_offsets(umem->fd, &off); -+ if (err) -+ goto out_free; -+ -+ munmap(ctx->fill->ring - off.fr.desc, off.fr.desc + umem->config.fill_size * -+ sizeof(__u64)); -+ munmap(ctx->comp->ring - off.cr.desc, off.cr.desc + umem->config.comp_size * -+ sizeof(__u64)); -+ -+out_free: -+ list_del(&ctx->list); -+ free(ctx); - } - - static struct xsk_ctx *xsk_create_ctx(struct xsk_socket *xsk, -@@ -722,8 +728,6 @@ static struct xsk_ctx *xsk_create_ctx(struct xsk_socket *xsk, - memcpy(ctx->ifname, ifname, IFNAMSIZ - 1); - ctx->ifname[IFNAMSIZ - 1] = '\0'; - -- umem->fill_save = NULL; -- umem->comp_save = NULL; - ctx->fill = fill; - ctx->comp = comp; - list_add(&ctx->list, &umem->ctx_list); -@@ -779,6 +783,8 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, - struct xsk_socket *xsk; - struct xsk_ctx *ctx; - int err, ifindex; -+ bool unmap = umem->fill_save != fill; -+ bool rx_setup_done = false, tx_setup_done = false; - - if (!umem || !xsk_ptr || !(rx || tx)) - return -EFAULT; -@@ -806,6 +812,8 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, - } - } else { - xsk->fd = umem->fd; -+ rx_setup_done = umem->rx_ring_setup_done; -+ tx_setup_done = umem->tx_ring_setup_done; - } - - ctx = xsk_get_ctx(umem, ifindex, queue_id); -@@ -824,7 +832,7 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, - } - xsk->ctx = ctx; - -- if (rx) { -+ if (rx && !rx_setup_done) { - err = setsockopt(xsk->fd, SOL_XDP, XDP_RX_RING, - &xsk->config.rx_size, - sizeof(xsk->config.rx_size)); -@@ -832,8 +840,10 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, - err = -errno; - goto out_put_ctx; - } -+ if (xsk->fd == umem->fd) -+ umem->rx_ring_setup_done = true; - } -- if (tx) { -+ if (tx && !tx_setup_done) { - err = setsockopt(xsk->fd, SOL_XDP, XDP_TX_RING, - &xsk->config.tx_size, - sizeof(xsk->config.tx_size)); -@@ -841,6 +851,8 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, - err = -errno; - goto out_put_ctx; - } -+ if (xsk->fd == umem->fd) -+ umem->rx_ring_setup_done = true; - } - - err = xsk_get_mmap_offsets(xsk->fd, &off); -@@ -919,6 +931,8 @@ int xsk_socket__create_shared(struct xsk_socket **xsk_ptr, - } - - *xsk_ptr = xsk; -+ umem->fill_save = NULL; -+ umem->comp_save = NULL; - return 0; - - out_mmap_tx: -@@ -930,7 +944,7 @@ out_mmap_rx: - munmap(rx_map, off.rx.desc + - xsk->config.rx_size * sizeof(struct xdp_desc)); - out_put_ctx: -- xsk_put_ctx(ctx); -+ xsk_put_ctx(ctx, unmap); - out_socket: - if (--umem->refcount) - close(xsk->fd); -@@ -944,6 +958,9 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname, - struct xsk_ring_cons *rx, struct xsk_ring_prod *tx, - const struct xsk_socket_config *usr_config) - { -+ if (!umem) -+ return -EFAULT; -+ - return xsk_socket__create_shared(xsk_ptr, ifname, queue_id, umem, - rx, tx, umem->fill_save, - umem->comp_save, usr_config); -@@ -993,7 +1010,7 @@ void xsk_socket__delete(struct xsk_socket *xsk) - } - } - -- xsk_put_ctx(ctx); -+ xsk_put_ctx(ctx, true); - - umem->refcount--; - /* Do not close an fd that also has an associated umem connected -diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c -index 43937f4b399ad..c0be51b957130 100644 ---- a/tools/perf/builtin-inject.c -+++ b/tools/perf/builtin-inject.c -@@ -906,7 +906,7 @@ int cmd_inject(int argc, const char **argv) - } - - data.path = inject.input_name; -- inject.session = perf_session__new(&data, true, &inject.tool); -+ inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool); - if (IS_ERR(inject.session)) - return PTR_ERR(inject.session); - -diff --git a/tools/perf/util/block-info.c b/tools/perf/util/block-info.c -index 423ec69bda6ca..5ecd4f401f324 100644 ---- a/tools/perf/util/block-info.c -+++ b/tools/perf/util/block-info.c -@@ -201,7 +201,7 @@ static int block_total_cycles_pct_entry(struct perf_hpp_fmt *fmt, - double ratio = 0.0; - - if (block_fmt->total_cycles) -- ratio = (double)bi->cycles / (double)block_fmt->total_cycles; -+ ratio = (double)bi->cycles_aggr / (double)block_fmt->total_cycles; - - return color_pct(hpp, block_fmt->width, 100.0 * ratio); - } -@@ -216,9 +216,9 @@ static int64_t block_total_cycles_pct_sort(struct perf_hpp_fmt *fmt, - double l, r; - - if (block_fmt->total_cycles) { -- l = ((double)bi_l->cycles / -+ l = ((double)bi_l->cycles_aggr / - (double)block_fmt->total_cycles) * 100000.0; -- r = ((double)bi_r->cycles / -+ r = ((double)bi_r->cycles_aggr / - (double)block_fmt->total_cycles) * 100000.0; - return (int64_t)l - (int64_t)r; - } From 895e5c95d5d04785f8a3f337329f5e8a64755826 Mon Sep 17 00:00:00 2001 From: Jannis <52237708+heisath@users.noreply.github.com> Date: Tue, 20 Apr 2021 19:59:57 +0200 Subject: [PATCH 18/18] Update VERSION Set master to v21.08-trunk as the 21.05-rc has been branched off. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index c499058d2..fc46ac9c6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -21.05.0-trunk +21.08.0-trunk