diff --git a/config/kernel/linux-rockchip-rk3588-legacy.config b/config/kernel/linux-rockchip-rk3588-legacy.config index 9704853c54..c571fefd71 100644 --- a/config/kernel/linux-rockchip-rk3588-legacy.config +++ b/config/kernel/linux-rockchip-rk3588-legacy.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.10.66 Kernel Configuration +# Linux/arm64 5.10.72 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 @@ -1536,7 +1536,9 @@ CONFIG_NET_NSH=m # CONFIG_HSR is not set # CONFIG_NET_SWITCHDEV is not set CONFIG_NET_L3_MASTER_DEV=y -# CONFIG_QRTR is not set +CONFIG_QRTR=m +CONFIG_QRTR_TUN=m +CONFIG_QRTR_MHI=m # CONFIG_NET_NCSI is not set CONFIG_RPS=y CONFIG_RFS_ACCEL=y @@ -1878,7 +1880,8 @@ CONFIG_GENERIC_ARCH_TOPOLOGY=y # CONFIG_MOXTET is not set # CONFIG_SIMPLE_PM_BUS is not set # CONFIG_VEXPRESS_CONFIG is not set -# CONFIG_MHI_BUS is not set +CONFIG_MHI_BUS=m +# CONFIG_MHI_BUS_DEBUG is not set # end of Bus devices CONFIG_CONNECTOR=y @@ -2564,6 +2567,7 @@ CONFIG_WLAN=y # CONFIG_WIRELESS_WDS is not set CONFIG_WLAN_VENDOR_ADMTEK=y # CONFIG_ADM8211 is not set +CONFIG_ATH_COMMON=m CONFIG_WLAN_VENDOR_ATH=y # CONFIG_ATH_DEBUG is not set # CONFIG_ATH5K is not set @@ -2578,6 +2582,9 @@ CONFIG_WLAN_VENDOR_ATH=y # CONFIG_WCN36XX is not set CONFIG_ATH11K=m CONFIG_ATH11K_PCI=m +# CONFIG_ATH11K_DEBUG is not set +# CONFIG_ATH11K_DEBUGFS is not set +# CONFIG_ATH11K_TRACING is not set CONFIG_WLAN_VENDOR_ATMEL=y # CONFIG_ATMEL is not set CONFIG_AT76C50X_USB=m @@ -6213,6 +6220,7 @@ CONFIG_ARM_SMMU_V3=y # # Qualcomm SoC drivers # +CONFIG_QCOM_QMI_HELPERS=m # end of Qualcomm SoC drivers # diff --git a/patch/kernel/rockchip-rk3588-legacy/001-scripts-fix-modpost.patch b/patch/kernel/rockchip-rk3588-legacy/001-scripts-fix-modpost.patch new file mode 100644 index 0000000000..562ceb870e --- /dev/null +++ b/patch/kernel/rockchip-rk3588-legacy/001-scripts-fix-modpost.patch @@ -0,0 +1,418 @@ +diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c +index 9c8c7511d..79aef50ed 100644 +--- a/scripts/mod/modpost.c ++++ b/scripts/mod/modpost.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + #include + #include "modpost.h" + #include "../../include/linux/license.h" +@@ -29,20 +30,16 @@ static int have_vmlinux = 0; + static int all_versions = 0; + /* If we are modposting external module set to 1 */ + static int external_module = 0; +-#define MODULE_SCMVERSION_SIZE 64 +-static char module_scmversion[MODULE_SCMVERSION_SIZE]; + /* Only warn about unresolved symbols */ + static int warn_unresolved = 0; + /* How a symbol is exported */ + static int sec_mismatch_count = 0; +-static int sec_mismatch_warn_only = true; ++static int sec_mismatch_fatal = 0; + /* ignore missing files */ + static int ignore_missing_files; + /* If set to 1, only warn (instead of error) about missing ns imports */ + static int allow_missing_ns_imports; + +-static bool error_occurred; +- + enum export { + export_plain, export_unused, export_gpl, + export_unused_gpl, export_gpl_future, export_unknown +@@ -81,8 +78,14 @@ modpost_log(enum loglevel loglevel, const char *fmt, ...) + + if (loglevel == LOG_FATAL) + exit(1); +- if (loglevel == LOG_ERROR) +- error_occurred = true; ++} ++ ++static inline bool strends(const char *str, const char *postfix) ++{ ++ if (strlen(str) < strlen(postfix)) ++ return false; ++ ++ return strcmp(str + strlen(str) - strlen(postfix), postfix) == 0; + } + + void *do_nofail(void *ptr, const char *expr) +@@ -400,8 +403,8 @@ static void sym_update_namespace(const char *symname, const char *namespace) + * actually an assertion. + */ + if (!s) { +- error("Could not update namespace(%s) for symbol %s\n", +- namespace, symname); ++ merror("Could not update namespace(%s) for symbol %s\n", ++ namespace, symname); + return; + } + +@@ -423,9 +426,10 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod, + s = new_symbol(name, mod, export); + } else if (!external_module || s->module->is_vmlinux || + s->module == mod) { +- fatal("%s: '%s' exported twice. Previous export was in %s%s\n", +- mod->name, name, s->module->name, +- s->module->is_vmlinux ? "" : ".ko"); ++ warn("%s: '%s' exported twice. Previous export was in %s%s\n", ++ mod->name, name, s->module->name, ++ s->module->is_vmlinux ? "" : ".ko"); ++ return s; + } + + s->module = mod; +@@ -1267,7 +1271,8 @@ static int secref_whitelist(const struct sectioncheck *mismatch, + + static inline int is_arm_mapping_symbol(const char *str) + { +- return str[0] == '$' && strchr("axtd", str[1]) ++ return str[0] == '$' && ++ (str[1] == 'a' || str[1] == 'd' || str[1] == 't' || str[1] == 'x') + && (str[2] == '\0' || str[2] == '.'); + } + +@@ -1978,12 +1983,8 @@ static char *remove_dot(char *s) + + if (n && s[n]) { + size_t m = strspn(s + n + 1, "0123456789"); +- if (m && (s[n + m] == '.' || s[n + m] == 0)) ++ if (m && (s[n + m + 1] == '.' || s[n + m + 1] == 0)) + s[n] = 0; +- +- /* strip trailing .lto */ +- if (strends(s, ".lto")) +- s[strlen(s) - 4] = '\0'; + } + return s; + } +@@ -2007,9 +2008,6 @@ static void read_symbols(const char *modname) + /* strip trailing .o */ + tmp = NOFAIL(strdup(modname)); + tmp[strlen(tmp) - 2] = '\0'; +- /* strip trailing .lto */ +- if (strends(tmp, ".lto")) +- tmp[strlen(tmp) - 4] = '\0'; + mod = new_module(tmp); + free(tmp); + } +@@ -2017,7 +2015,7 @@ static void read_symbols(const char *modname) + if (!mod->is_vmlinux) { + license = get_modinfo(&info, "license"); + if (!license) +- error("missing MODULE_LICENSE() in %s\n", modname); ++ warn("missing MODULE_LICENSE() in %s\n", modname); + while (license) { + if (license_is_gpl_compatible(license)) + mod->gpl_compatible = 1; +@@ -2144,11 +2142,11 @@ static void check_for_gpl_usage(enum export exp, const char *m, const char *s) + { + switch (exp) { + case export_gpl: +- error("GPL-incompatible module %s.ko uses GPL-only symbol '%s'\n", ++ fatal("GPL-incompatible module %s.ko uses GPL-only symbol '%s'\n", + m, s); + break; + case export_unused_gpl: +- error("GPL-incompatible module %s.ko uses GPL-only symbol marked UNUSED '%s'\n", ++ fatal("GPL-incompatible module %s.ko uses GPL-only symbol marked UNUSED '%s'\n", + m, s); + break; + case export_gpl_future: +@@ -2177,18 +2175,22 @@ static void check_for_unused(enum export exp, const char *m, const char *s) + } + } + +-static void check_exports(struct module *mod) ++static int check_exports(struct module *mod) + { + struct symbol *s, *exp; ++ int err = 0; + + for (s = mod->unres; s; s = s->next) { + const char *basename; + exp = find_symbol(s->name); + if (!exp || exp->module == mod) { +- if (have_vmlinux && !s->weak) ++ if (have_vmlinux && !s->weak) { + modpost_log(warn_unresolved ? LOG_WARN : LOG_ERROR, + "\"%s\" [%s.ko] undefined!\n", + s->name, mod->name); ++ if (!warn_unresolved) ++ err = 1; ++ } + continue; + } + basename = strrchr(mod->name, '/'); +@@ -2202,6 +2204,8 @@ static void check_exports(struct module *mod) + modpost_log(allow_missing_ns_imports ? LOG_WARN : LOG_ERROR, + "module %s uses symbol %s from namespace %s, but does not import it.\n", + basename, exp->name, exp->namespace); ++ if (!allow_missing_ns_imports) ++ err = 1; + add_namespace(&mod->missing_namespaces, exp->namespace); + } + +@@ -2209,9 +2213,11 @@ static void check_exports(struct module *mod) + check_for_gpl_usage(exp->export, basename, exp->name); + check_for_unused(exp->export, basename, exp->name); + } ++ ++ return err; + } + +-static void check_modname_len(struct module *mod) ++static int check_modname_len(struct module *mod) + { + const char *mod_name; + +@@ -2220,8 +2226,12 @@ static void check_modname_len(struct module *mod) + mod_name = mod->name; + else + mod_name++; +- if (strlen(mod_name) >= MODULE_NAME_LEN) +- error("module name is too long [%s.ko]\n", mod->name); ++ if (strlen(mod_name) >= MODULE_NAME_LEN) { ++ merror("module name is too long [%s.ko]\n", mod->name); ++ return 1; ++ } ++ ++ return 0; + } + + /** +@@ -2263,20 +2273,6 @@ static void add_intree_flag(struct buffer *b, int is_intree) + buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n"); + } + +-/** +- * add_scmversion() - Adds the MODULE_INFO macro for the scmversion. +- * @b: Buffer to append to. +- * +- * This function fills in the module attribute `scmversion` for the kernel +- * module. This is useful for determining a given module's SCM version on +- * device via /sys/modules//scmversion and/or using the modinfo tool. +- */ +-static void add_scmversion(struct buffer *b) +-{ +- if (module_scmversion[0] != '\0') +- buf_printf(b, "\nMODULE_INFO(scmversion, \"%s\");\n", module_scmversion); +-} +- + /* Cannot check for assembler */ + static void add_retpoline(struct buffer *b) + { +@@ -2294,9 +2290,10 @@ static void add_staging_flag(struct buffer *b, const char *name) + /** + * Record CRCs for unresolved symbols + **/ +-static void add_versions(struct buffer *b, struct module *mod) ++static int add_versions(struct buffer *b, struct module *mod) + { + struct symbol *s, *exp; ++ int err = 0; + + for (s = mod->unres; s; s = s->next) { + exp = find_symbol(s->name); +@@ -2308,7 +2305,7 @@ static void add_versions(struct buffer *b, struct module *mod) + } + + if (!modversions) +- return; ++ return err; + + buf_printf(b, "\n"); + buf_printf(b, "static const struct modversion_info ____versions[]\n"); +@@ -2323,8 +2320,9 @@ static void add_versions(struct buffer *b, struct module *mod) + continue; + } + if (strlen(s->name) >= MODULE_NAME_LEN) { +- error("too long symbol \"%s\" [%s.ko]\n", +- s->name, mod->name); ++ merror("too long symbol \"%s\" [%s.ko]\n", ++ s->name, mod->name); ++ err = 1; + break; + } + buf_printf(b, "\t{ %#8x, \"%s\" },\n", +@@ -2332,6 +2330,8 @@ static void add_versions(struct buffer *b, struct module *mod) + } + + buf_printf(b, "};\n"); ++ ++ return err; + } + + static void add_depends(struct buffer *b, struct module *mod) +@@ -2542,11 +2542,12 @@ int main(int argc, char **argv) + char *missing_namespace_deps = NULL; + char *dump_write = NULL, *files_source = NULL; + int opt; ++ int err; + int n; + struct dump_list *dump_read_start = NULL; + struct dump_list **dump_read_iter = &dump_read_start; + +- while ((opt = getopt(argc, argv, "ei:mnT:o:awENd:v:")) != -1) { ++ while ((opt = getopt(argc, argv, "ei:mnT:o:awENd:")) != -1) { + switch (opt) { + case 'e': + external_module = 1; +@@ -2576,7 +2577,7 @@ int main(int argc, char **argv) + warn_unresolved = 1; + break; + case 'E': +- sec_mismatch_warn_only = false; ++ sec_mismatch_fatal = 1; + break; + case 'N': + allow_missing_ns_imports = 1; +@@ -2584,9 +2585,6 @@ int main(int argc, char **argv) + case 'd': + missing_namespace_deps = optarg; + break; +- case 'v': +- strncpy(module_scmversion, optarg, sizeof(module_scmversion) - 1); +- break; + default: + exit(1); + } +@@ -2614,6 +2612,8 @@ int main(int argc, char **argv) + if (!have_vmlinux) + warn("Symbol info of vmlinux is missing. Unresolved symbol check will be entirely skipped.\n"); + ++ err = 0; ++ + for (mod = modules; mod; mod = mod->next) { + char fname[PATH_MAX]; + +@@ -2622,18 +2622,17 @@ int main(int argc, char **argv) + + buf.pos = 0; + +- check_modname_len(mod); +- check_exports(mod); ++ err |= check_modname_len(mod); ++ err |= check_exports(mod); + + add_header(&buf, mod); + add_intree_flag(&buf, !external_module); + add_retpoline(&buf); + add_staging_flag(&buf, mod->name); +- add_versions(&buf, mod); ++ err |= add_versions(&buf, mod); + add_depends(&buf, mod); + add_moddevtable(&buf, mod); + add_srcversion(&buf, mod); +- add_scmversion(&buf); + + sprintf(fname, "%s.mod.c", mod->name); + write_if_changed(&buf, fname); +@@ -2644,21 +2643,21 @@ int main(int argc, char **argv) + + if (dump_write) + write_dump(dump_write); +- if (sec_mismatch_count && !sec_mismatch_warn_only) +- error("Section mismatches detected.\n" ++ if (sec_mismatch_count && sec_mismatch_fatal) ++ fatal("Section mismatches detected.\n" + "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n"); + for (n = 0; n < SYMBOL_HASH_SIZE; n++) { + struct symbol *s; + + for (s = symbolhash[n]; s; s = s->next) { + if (s->is_static) +- error("\"%s\" [%s] is a static %s\n", +- s->name, s->module->name, +- export_str(s->export)); ++ warn("\"%s\" [%s] is a static %s\n", ++ s->name, s->module->name, ++ export_str(s->export)); + } + } + + free(buf.p); + +- return error_occurred ? 1 : 0; ++ return err; + } +diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h +index 1f76eea7c..3aa052722 100644 +--- a/scripts/mod/modpost.h ++++ b/scripts/mod/modpost.h +@@ -2,7 +2,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -181,14 +180,6 @@ static inline unsigned int get_secindex(const struct elf_info *info, + return info->symtab_shndx_start[sym - info->symtab_start]; + } + +-static inline bool strends(const char *str, const char *postfix) +-{ +- if (strlen(str) < strlen(postfix)) +- return false; +- +- return strcmp(str + strlen(str) - strlen(postfix), postfix) == 0; +-} +- + /* file2alias.c */ + extern unsigned int cross_build; + void handle_moddevtable(struct module *mod, struct elf_info *info, +@@ -210,19 +201,6 @@ enum loglevel { + + void modpost_log(enum loglevel loglevel, const char *fmt, ...); + +-/* +- * warn - show the given message, then let modpost continue running, still +- * allowing modpost to exit successfully. This should be used when +- * we still allow to generate vmlinux and modules. +- * +- * error - show the given message, then let modpost continue running, but fail +- * in the end. This should be used when we should stop building vmlinux +- * or modules, but we can continue running modpost to catch as many +- * issues as possible. +- * +- * fatal - show the given message, and bail out immediately. This should be +- * used when there is no point to continue running modpost. +- */ + #define warn(fmt, args...) modpost_log(LOG_WARN, fmt, ##args) +-#define error(fmt, args...) modpost_log(LOG_ERROR, fmt, ##args) ++#define merror(fmt, args...) modpost_log(LOG_ERROR, fmt, ##args) + #define fatal(fmt, args...) modpost_log(LOG_FATAL, fmt, ##args) +diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c +index 760e6baa7..d587f40f1 100644 +--- a/scripts/mod/sumversion.c ++++ b/scripts/mod/sumversion.c +@@ -391,14 +391,10 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) + struct md4_ctx md; + char *fname; + char filelist[PATH_MAX + 1]; +- int postfix_len = 1; +- +- if (strends(modname, ".lto.o")) +- postfix_len = 5; + + /* objects for a module are listed in the first line of *.mod file. */ + snprintf(filelist, sizeof(filelist), "%.*smod", +- (int)strlen(modname) - postfix_len, modname); ++ (int)strlen(modname) - 1, modname); + + buf = read_text_file(filelist); + diff --git a/patch/kernel/rockchip-rk3588-legacy/002-scripts-fix-lld-version.patch b/patch/kernel/rockchip-rk3588-legacy/002-scripts-fix-lld-version.patch new file mode 100644 index 0000000000..2e44dcd881 --- /dev/null +++ b/patch/kernel/rockchip-rk3588-legacy/002-scripts-fix-lld-version.patch @@ -0,0 +1,46 @@ +diff --git a/scripts/lld-version.sh b/scripts/lld-version.sh +index d70edb4d8..f1eeee450 100755 +--- a/scripts/lld-version.sh ++++ b/scripts/lld-version.sh +@@ -6,15 +6,32 @@ + # Print the linker version of `ld.lld' in a 5 or 6-digit form + # such as `100001' for ld.lld 10.0.1 etc. + +-linker_string="$($* --version)" ++set -e + +-if ! ( echo $linker_string | grep -q LLD ); then ++# Convert the version string x.y.z to a canonical 5 or 6-digit form. ++get_canonical_version() ++{ ++ IFS=. ++ set -- $1 ++ ++ # If the 2nd or 3rd field is missing, fill it with a zero. ++ echo $((10000 * $1 + 100 * ${2:-0} + ${3:-0})) ++} ++ ++# Get the first line of the --version output. ++IFS=' ++' ++set -- $(LC_ALL=C "$@" --version) ++ ++# Split the line on spaces. ++IFS=' ' ++set -- $1 ++ ++while [ $# -gt 1 -a "$1" != "LLD" ]; do ++ shift ++done ++if [ "$1" = LLD ]; then ++ echo $(get_canonical_version ${2%-*}) ++else + echo 0 +- exit 1 + fi +- +-VERSION=$(echo $linker_string | cut -d ' ' -f 2) +-MAJOR=$(echo $VERSION | cut -d . -f 1) +-MINOR=$(echo $VERSION | cut -d . -f 2) +-PATCHLEVEL=$(echo $VERSION | cut -d . -f 3) +-printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL diff --git a/patch/kernel/rockchip-rk3588-legacy/003-fix-compile-error-for-usb-gadget-legacy-webcam.patch b/patch/kernel/rockchip-rk3588-legacy/003-fix-compile-error-for-usb-gadget-legacy-webcam.patch new file mode 100644 index 0000000000..495b97ef48 --- /dev/null +++ b/patch/kernel/rockchip-rk3588-legacy/003-fix-compile-error-for-usb-gadget-legacy-webcam.patch @@ -0,0 +1,12 @@ +diff --git a/drivers/usb/gadget/legacy/webcam.c b/drivers/usb/gadget/legacy/webcam.c +index b18e011b5..87ca1f031 100644 +--- a/drivers/usb/gadget/legacy/webcam.c ++++ b/drivers/usb/gadget/legacy/webcam.c +@@ -12,6 +12,7 @@ + #include + + #include "u_uvc.h" ++#include "../function/uvc.h" + + USB_GADGET_COMPOSITE_OPTIONS(); + diff --git a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.69-70.patch b/patch/kernel/rockchip-rk3588-legacy/patch-5.10.69-70.patch new file mode 100644 index 0000000000..6489abd021 --- /dev/null +++ b/patch/kernel/rockchip-rk3588-legacy/patch-5.10.69-70.patch @@ -0,0 +1,4153 @@ +diff --git a/Makefile b/Makefile +index 683820ad2..ea7037dac 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 10 +-SUBLEVEL = 69 ++SUBLEVEL = 70 + EXTRAVERSION = + NAME = Dare mighty things + +diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h +index 1f6a909d1..7bc2f444a 100644 +--- a/arch/alpha/include/asm/io.h ++++ b/arch/alpha/include/asm/io.h +@@ -60,7 +60,7 @@ extern inline void set_hae(unsigned long new_hae) + * Change virtual addresses to physical addresses and vv. + */ + #ifdef USE_48_BIT_KSEG +-static inline unsigned long virt_to_phys(void *address) ++static inline unsigned long virt_to_phys(volatile void *address) + { + return (unsigned long)address - IDENT_ADDR; + } +@@ -70,7 +70,7 @@ static inline void * phys_to_virt(unsigned long address) + return (void *) (address + IDENT_ADDR); + } + #else +-static inline unsigned long virt_to_phys(void *address) ++static inline unsigned long virt_to_phys(volatile void *address) + { + unsigned long phys = (unsigned long)address; + +@@ -106,7 +106,7 @@ static inline void * phys_to_virt(unsigned long address) + extern unsigned long __direct_map_base; + extern unsigned long __direct_map_size; + +-static inline unsigned long __deprecated virt_to_bus(void *address) ++static inline unsigned long __deprecated virt_to_bus(volatile void *address) + { + unsigned long phys = virt_to_phys(address); + unsigned long bus = phys + __direct_map_base; +diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c +index 641d0ae6d..380098ad8 100644 +--- a/arch/arm64/kernel/process.c ++++ b/arch/arm64/kernel/process.c +@@ -61,7 +61,7 @@ + + #if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK) + #include +-unsigned long __stack_chk_guard __read_mostly; ++unsigned long __stack_chk_guard __ro_after_init; + EXPORT_SYMBOL(__stack_chk_guard); + #endif + +diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c +index 40cbaca81..b9518f94b 100644 +--- a/arch/arm64/kvm/vgic/vgic-its.c ++++ b/arch/arm64/kvm/vgic/vgic-its.c +@@ -2190,8 +2190,8 @@ static int vgic_its_restore_ite(struct vgic_its *its, u32 event_id, + return offset; + } + +-static int vgic_its_ite_cmp(void *priv, struct list_head *a, +- struct list_head *b) ++static int vgic_its_ite_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct its_ite *itea = container_of(a, struct its_ite, ite_list); + struct its_ite *iteb = container_of(b, struct its_ite, ite_list); +@@ -2329,8 +2329,8 @@ static int vgic_its_restore_dte(struct vgic_its *its, u32 id, + return offset; + } + +-static int vgic_its_device_cmp(void *priv, struct list_head *a, +- struct list_head *b) ++static int vgic_its_device_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct its_device *deva = container_of(a, struct its_device, dev_list); + struct its_device *devb = container_of(b, struct its_device, dev_list); +diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c +index 1c597c988..15b666200 100644 +--- a/arch/arm64/kvm/vgic/vgic.c ++++ b/arch/arm64/kvm/vgic/vgic.c +@@ -255,7 +255,8 @@ static struct kvm_vcpu *vgic_target_oracle(struct vgic_irq *irq) + * Return negative if "a" sorts before "b", 0 to preserve order, and positive + * to sort "b" before "a". + */ +-static int vgic_irq_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int vgic_irq_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct vgic_irq *irqa = container_of(a, struct vgic_irq, ap_list); + struct vgic_irq *irqb = container_of(b, struct vgic_irq, ap_list); +diff --git a/arch/m68k/include/asm/raw_io.h b/arch/m68k/include/asm/raw_io.h +index 911826ea8..80eb2396d 100644 +--- a/arch/m68k/include/asm/raw_io.h ++++ b/arch/m68k/include/asm/raw_io.h +@@ -17,21 +17,21 @@ + * two accesses to memory, which may be undesirable for some devices. + */ + #define in_8(addr) \ +- ({ u8 __v = (*(__force volatile u8 *) (addr)); __v; }) ++ ({ u8 __v = (*(__force volatile u8 *) (unsigned long)(addr)); __v; }) + #define in_be16(addr) \ +- ({ u16 __v = (*(__force volatile u16 *) (addr)); __v; }) ++ ({ u16 __v = (*(__force volatile u16 *) (unsigned long)(addr)); __v; }) + #define in_be32(addr) \ +- ({ u32 __v = (*(__force volatile u32 *) (addr)); __v; }) ++ ({ u32 __v = (*(__force volatile u32 *) (unsigned long)(addr)); __v; }) + #define in_le16(addr) \ +- ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (addr)); __v; }) ++ ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (unsigned long)(addr)); __v; }) + #define in_le32(addr) \ +- ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (addr)); __v; }) ++ ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (unsigned long)(addr)); __v; }) + +-#define out_8(addr,b) (void)((*(__force volatile u8 *) (addr)) = (b)) +-#define out_be16(addr,w) (void)((*(__force volatile u16 *) (addr)) = (w)) +-#define out_be32(addr,l) (void)((*(__force volatile u32 *) (addr)) = (l)) +-#define out_le16(addr,w) (void)((*(__force volatile __le16 *) (addr)) = cpu_to_le16(w)) +-#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l)) ++#define out_8(addr,b) (void)((*(__force volatile u8 *) (unsigned long)(addr)) = (b)) ++#define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w)) ++#define out_be32(addr,l) (void)((*(__force volatile u32 *) (unsigned long)(addr)) = (l)) ++#define out_le16(addr,w) (void)((*(__force volatile __le16 *) (unsigned long)(addr)) = cpu_to_le16(w)) ++#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (unsigned long)(addr)) = cpu_to_le32(l)) + + #define raw_inb in_8 + #define raw_inw in_be16 +diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h +index 6b3f6740a..8802ce651 100644 +--- a/arch/parisc/include/asm/page.h ++++ b/arch/parisc/include/asm/page.h +@@ -184,7 +184,7 @@ extern int npmem_ranges; + #include + #include + +-#define PAGE0 ((struct zeropage *)__PAGE_OFFSET) ++#define PAGE0 ((struct zeropage *)absolute_pointer(__PAGE_OFFSET)) + + /* DEFINITION OF THE ZERO-PAGE (PAG0) */ + /* based on work by Jason Eckhardt (jason@equator.com) */ +diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c +index 8e1d72a16..7ceae24b0 100644 +--- a/arch/sparc/kernel/ioport.c ++++ b/arch/sparc/kernel/ioport.c +@@ -356,7 +356,9 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, + void arch_dma_free(struct device *dev, size_t size, void *cpu_addr, + dma_addr_t dma_addr, unsigned long attrs) + { +- if (!sparc_dma_free_resource(cpu_addr, PAGE_ALIGN(size))) ++ size = PAGE_ALIGN(size); ++ ++ if (!sparc_dma_free_resource(cpu_addr, size)) + return; + + dma_make_coherent(dma_addr, size); +diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c +index 8e645ddac..30f171b7b 100644 +--- a/arch/sparc/kernel/mdesc.c ++++ b/arch/sparc/kernel/mdesc.c +@@ -39,6 +39,7 @@ struct mdesc_hdr { + u32 node_sz; /* node block size */ + u32 name_sz; /* name block size */ + u32 data_sz; /* data block size */ ++ char data[]; + } __attribute__((aligned(16))); + + struct mdesc_elem { +@@ -612,7 +613,7 @@ EXPORT_SYMBOL(mdesc_get_node_info); + + static struct mdesc_elem *node_block(struct mdesc_hdr *mdesc) + { +- return (struct mdesc_elem *) (mdesc + 1); ++ return (struct mdesc_elem *) mdesc->data; + } + + static void *name_block(struct mdesc_hdr *mdesc) +diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h +index cc177b443..415693f5d 100644 +--- a/arch/x86/include/asm/special_insns.h ++++ b/arch/x86/include/asm/special_insns.h +@@ -286,8 +286,8 @@ static inline void movdir64b(void *dst, const void *src) + static inline int enqcmds(void __iomem *dst, const void *src) + { + const struct { char _[64]; } *__src = src; +- struct { char _[64]; } *__dst = dst; +- int zf; ++ struct { char _[64]; } __iomem *__dst = dst; ++ bool zf; + + /* + * ENQCMDS %(rdx), rax +diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c +index c758fd913..5af0421ef 100644 +--- a/arch/x86/xen/enlighten_pv.c ++++ b/arch/x86/xen/enlighten_pv.c +@@ -736,8 +736,8 @@ static void xen_write_idt_entry(gate_desc *dt, int entrynum, const gate_desc *g) + preempt_enable(); + } + +-static void xen_convert_trap_info(const struct desc_ptr *desc, +- struct trap_info *traps) ++static unsigned xen_convert_trap_info(const struct desc_ptr *desc, ++ struct trap_info *traps, bool full) + { + unsigned in, out, count; + +@@ -747,17 +747,18 @@ static void xen_convert_trap_info(const struct desc_ptr *desc, + for (in = out = 0; in < count; in++) { + gate_desc *entry = (gate_desc *)(desc->address) + in; + +- if (cvt_gate_to_trap(in, entry, &traps[out])) ++ if (cvt_gate_to_trap(in, entry, &traps[out]) || full) + out++; + } +- traps[out].address = 0; ++ ++ return out; + } + + void xen_copy_trap_info(struct trap_info *traps) + { + const struct desc_ptr *desc = this_cpu_ptr(&idt_desc); + +- xen_convert_trap_info(desc, traps); ++ xen_convert_trap_info(desc, traps, true); + } + + /* Load a new IDT into Xen. In principle this can be per-CPU, so we +@@ -767,6 +768,7 @@ static void xen_load_idt(const struct desc_ptr *desc) + { + static DEFINE_SPINLOCK(lock); + static struct trap_info traps[257]; ++ unsigned out; + + trace_xen_cpu_load_idt(desc); + +@@ -774,7 +776,8 @@ static void xen_load_idt(const struct desc_ptr *desc) + + memcpy(this_cpu_ptr(&idt_desc), desc, sizeof(idt_desc)); + +- xen_convert_trap_info(desc, traps); ++ out = xen_convert_trap_info(desc, traps, false); ++ memset(&traps[out], 0, sizeof(traps[0])); + + xen_mc_flush(); + if (HYPERVISOR_set_trap_table(traps)) +diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c +index e798d196a..cca79c06d 100644 +--- a/block/blk-cgroup.c ++++ b/block/blk-cgroup.c +@@ -1391,10 +1391,14 @@ int blkcg_activate_policy(struct request_queue *q, + /* alloc failed, nothing's initialized yet, free everything */ + spin_lock_irq(&q->queue_lock); + list_for_each_entry(blkg, &q->blkg_list, q_node) { ++ struct blkcg *blkcg = blkg->blkcg; ++ ++ spin_lock(&blkcg->lock); + if (blkg->pd[pol->plid]) { + pol->pd_free_fn(blkg->pd[pol->plid]); + blkg->pd[pol->plid] = NULL; + } ++ spin_unlock(&blkcg->lock); + } + spin_unlock_irq(&q->queue_lock); + ret = -ENOMEM; +@@ -1426,12 +1430,16 @@ void blkcg_deactivate_policy(struct request_queue *q, + __clear_bit(pol->plid, q->blkcg_pols); + + list_for_each_entry(blkg, &q->blkg_list, q_node) { ++ struct blkcg *blkcg = blkg->blkcg; ++ ++ spin_lock(&blkcg->lock); + if (blkg->pd[pol->plid]) { + if (pol->pd_offline_fn) + pol->pd_offline_fn(blkg->pd[pol->plid]); + pol->pd_free_fn(blkg->pd[pol->plid]); + blkg->pd[pol->plid] = NULL; + } ++ spin_unlock(&blkcg->lock); + } + + spin_unlock_irq(&q->queue_lock); +diff --git a/block/blk-integrity.c b/block/blk-integrity.c +index 410da060d..9e83159f5 100644 +--- a/block/blk-integrity.c ++++ b/block/blk-integrity.c +@@ -426,8 +426,15 @@ EXPORT_SYMBOL(blk_integrity_register); + */ + void blk_integrity_unregister(struct gendisk *disk) + { ++ struct blk_integrity *bi = &disk->queue->integrity; ++ ++ if (!bi->profile) ++ return; ++ ++ /* ensure all bios are off the integrity workqueue */ ++ blk_flush_integrity(); + blk_queue_flag_clear(QUEUE_FLAG_STABLE_WRITES, disk->queue); +- memset(&disk->queue->integrity, 0, sizeof(struct blk_integrity)); ++ memset(bi, 0, sizeof(*bi)); + } + EXPORT_SYMBOL(blk_integrity_unregister); + +diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c +index 581be65a5..24c089638 100644 +--- a/block/blk-mq-sched.c ++++ b/block/blk-mq-sched.c +@@ -75,7 +75,8 @@ void blk_mq_sched_restart(struct blk_mq_hw_ctx *hctx) + blk_mq_run_hw_queue(hctx, true); + } + +-static int sched_rq_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int sched_rq_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct request *rqa = container_of(a, struct request, queuelist); + struct request *rqb = container_of(b, struct request, queuelist); +diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c +index c4f2f6c12..16ad9e656 100644 +--- a/block/blk-mq-tag.c ++++ b/block/blk-mq-tag.c +@@ -207,7 +207,7 @@ static struct request *blk_mq_find_and_get_req(struct blk_mq_tags *tags, + + spin_lock_irqsave(&tags->lock, flags); + rq = tags->rqs[bitnr]; +- if (!rq || !refcount_inc_not_zero(&rq->ref)) ++ if (!rq || rq->tag != bitnr || !refcount_inc_not_zero(&rq->ref)) + rq = NULL; + spin_unlock_irqrestore(&tags->lock, flags); + return rq; +diff --git a/block/blk-mq.c b/block/blk-mq.c +index 61091c0be..fe59a6c75 100644 +--- a/block/blk-mq.c ++++ b/block/blk-mq.c +@@ -1924,7 +1924,8 @@ void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx, + spin_unlock(&ctx->lock); + } + +-static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int plug_rq_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct request *rqa = container_of(a, struct request, queuelist); + struct request *rqb = container_of(b, struct request, queuelist); +diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c +index cb18cb5c5..d061bff5c 100644 +--- a/drivers/acpi/nfit/core.c ++++ b/drivers/acpi/nfit/core.c +@@ -1194,7 +1194,8 @@ static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc, + return 0; + } + +-static int nfit_mem_cmp(void *priv, struct list_head *_a, struct list_head *_b) ++static int nfit_mem_cmp(void *priv, const struct list_head *_a, ++ const struct list_head *_b) + { + struct nfit_mem *a = container_of(_a, typeof(*a), list); + struct nfit_mem *b = container_of(_b, typeof(*b), list); +diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c +index cb73a5d6e..137a5dd88 100644 +--- a/drivers/acpi/numa/hmat.c ++++ b/drivers/acpi/numa/hmat.c +@@ -558,7 +558,8 @@ static bool hmat_update_best(u8 type, u32 value, u32 *best) + return updated; + } + +-static int initiator_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int initiator_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct memory_initiator *ia; + struct memory_initiator *ib; +diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c +index aaf31abe1..7e1b136e7 100644 +--- a/drivers/clk/keystone/sci-clk.c ++++ b/drivers/clk/keystone/sci-clk.c +@@ -503,8 +503,8 @@ static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider) + + #else + +-static int _cmp_sci_clk_list(void *priv, struct list_head *a, +- struct list_head *b) ++static int _cmp_sci_clk_list(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct sci_clk *ca = container_of(a, struct sci_clk, node); + struct sci_clk *cb = container_of(b, struct sci_clk, node); +diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c +index 44a5d15a7..1686705be 100644 +--- a/drivers/cpufreq/intel_pstate.c ++++ b/drivers/cpufreq/intel_pstate.c +@@ -3035,11 +3035,15 @@ static int __init intel_pstate_init(void) + if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) + return -ENODEV; + +- if (no_load) +- return -ENODEV; +- + id = x86_match_cpu(hwp_support_ids); + if (id) { ++ bool hwp_forced = intel_pstate_hwp_is_enabled(); ++ ++ if (hwp_forced) ++ pr_info("HWP enabled by BIOS\n"); ++ else if (no_load) ++ return -ENODEV; ++ + copy_cpu_funcs(&core_funcs); + /* + * Avoid enabling HWP for processors without EPP support, +@@ -3049,8 +3053,7 @@ static int __init intel_pstate_init(void) + * If HWP is enabled already, though, there is no choice but to + * deal with it. + */ +- if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) || +- intel_pstate_hwp_is_enabled()) { ++ if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) || hwp_forced) { + hwp_active++; + hwp_mode_bdw = id->driver_data; + intel_pstate.attr = hwp_cpufreq_attrs; +@@ -3061,7 +3064,11 @@ static int __init intel_pstate_init(void) + + goto hwp_cpu_matched; + } ++ pr_info("HWP not enabled\n"); + } else { ++ if (no_load) ++ return -ENODEV; ++ + id = x86_match_cpu(intel_pstate_cpu_ids); + if (!id) { + pr_info("CPU model not supported\n"); +@@ -3138,10 +3145,9 @@ static int __init intel_pstate_setup(char *str) + else if (!strcmp(str, "passive")) + default_driver = &intel_cpufreq; + +- if (!strcmp(str, "no_hwp")) { +- pr_info("HWP disabled\n"); ++ if (!strcmp(str, "no_hwp")) + no_hwp = 1; +- } ++ + if (!strcmp(str, "force")) + force_load = 1; + if (!strcmp(str, "hwp_only")) +diff --git a/drivers/edac/dmc520_edac.c b/drivers/edac/dmc520_edac.c +index fc1153ab1..b8a7d9594 100644 +--- a/drivers/edac/dmc520_edac.c ++++ b/drivers/edac/dmc520_edac.c +@@ -464,7 +464,7 @@ static void dmc520_init_csrow(struct mem_ctl_info *mci) + dimm->grain = pvt->mem_width_in_bytes; + dimm->dtype = dt; + dimm->mtype = mt; +- dimm->edac_mode = EDAC_FLAG_SECDED; ++ dimm->edac_mode = EDAC_SECDED; + dimm->nr_pages = pages_per_rank / csi->nr_channels; + } + } +diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c +index 12211dc04..1a801a5d3 100644 +--- a/drivers/edac/synopsys_edac.c ++++ b/drivers/edac/synopsys_edac.c +@@ -782,7 +782,7 @@ static void init_csrows(struct mem_ctl_info *mci) + + for (j = 0; j < csi->nr_channels; j++) { + dimm = csi->channels[j]->dimm; +- dimm->edac_mode = EDAC_FLAG_SECDED; ++ dimm->edac_mode = EDAC_SECDED; + dimm->mtype = p_data->get_mtype(priv->baseaddr); + dimm->nr_pages = (size >> PAGE_SHIFT) / csi->nr_channels; + dimm->grain = SYNPS_EDAC_ERR_GRAIN; +diff --git a/drivers/fpga/machxo2-spi.c b/drivers/fpga/machxo2-spi.c +index b31636915..9eef18349 100644 +--- a/drivers/fpga/machxo2-spi.c ++++ b/drivers/fpga/machxo2-spi.c +@@ -225,8 +225,10 @@ static int machxo2_write_init(struct fpga_manager *mgr, + goto fail; + + get_status(spi, &status); +- if (test_bit(FAIL, &status)) ++ if (test_bit(FAIL, &status)) { ++ ret = -EINVAL; + goto fail; ++ } + dump_status_reg(&status); + + spi_message_init(&msg); +@@ -313,6 +315,7 @@ static int machxo2_write_complete(struct fpga_manager *mgr, + dump_status_reg(&status); + if (!test_bit(DONE, &status)) { + machxo2_cleanup(mgr); ++ ret = -EINVAL; + goto fail; + } + +@@ -335,6 +338,7 @@ static int machxo2_write_complete(struct fpga_manager *mgr, + break; + if (++refreshloop == MACHXO2_MAX_REFRESH_LOOP) { + machxo2_cleanup(mgr); ++ ret = -EINVAL; + goto fail; + } + } while (1); +diff --git a/drivers/gpio/gpio-uniphier.c b/drivers/gpio/gpio-uniphier.c +index f99f3c10b..39dca147d 100644 +--- a/drivers/gpio/gpio-uniphier.c ++++ b/drivers/gpio/gpio-uniphier.c +@@ -184,7 +184,7 @@ static void uniphier_gpio_irq_mask(struct irq_data *data) + + uniphier_gpio_reg_update(priv, UNIPHIER_GPIO_IRQ_EN, mask, 0); + +- return irq_chip_mask_parent(data); ++ irq_chip_mask_parent(data); + } + + static void uniphier_gpio_irq_unmask(struct irq_data *data) +@@ -194,7 +194,7 @@ static void uniphier_gpio_irq_unmask(struct irq_data *data) + + uniphier_gpio_reg_update(priv, UNIPHIER_GPIO_IRQ_EN, mask, mask); + +- return irq_chip_unmask_parent(data); ++ irq_chip_unmask_parent(data); + } + + static int uniphier_gpio_irq_set_type(struct irq_data *data, unsigned int type) +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index bc9df3f21..ce21a21dd 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -8962,7 +8962,8 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, + goto fail; + status = dc_validate_global_state(dc, dm_state->context, false); + if (status != DC_OK) { +- DC_LOG_WARNING("DC global validation failure: %s (%d)", ++ drm_dbg_atomic(dev, ++ "DC global validation failure: %s (%d)", + dc_status_to_str(status), status); + ret = -EINVAL; + goto fail; +diff --git a/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c b/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c +index b5986d19d..a1e7ba599 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c +@@ -6870,6 +6870,8 @@ static int si_dpm_enable(struct amdgpu_device *adev) + si_enable_auto_throttle_source(adev, AMDGPU_DPM_AUTO_THROTTLE_SRC_THERMAL, true); + si_thermal_start_thermal_controller(adev); + ++ ni_update_current_ps(adev, boot_ps); ++ + return 0; + } + +diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c +index 39b092e33..d42c7310b 100644 +--- a/drivers/gpu/drm/drm_modes.c ++++ b/drivers/gpu/drm/drm_modes.c +@@ -1290,7 +1290,8 @@ EXPORT_SYMBOL(drm_mode_prune_invalid); + * Negative if @lh_a is better than @lh_b, zero if they're equivalent, or + * positive if @lh_b is better than @lh_a. + */ +-static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head *lh_b) ++static int drm_mode_compare(void *priv, const struct list_head *lh_a, ++ const struct list_head *lh_b) + { + struct drm_display_mode *a = list_entry(lh_a, struct drm_display_mode, head); + struct drm_display_mode *b = list_entry(lh_b, struct drm_display_mode, head); +diff --git a/drivers/gpu/drm/i915/gt/intel_engine_user.c b/drivers/gpu/drm/i915/gt/intel_engine_user.c +index 34e6096f1..da21d2a10 100644 +--- a/drivers/gpu/drm/i915/gt/intel_engine_user.c ++++ b/drivers/gpu/drm/i915/gt/intel_engine_user.c +@@ -49,7 +49,8 @@ static const u8 uabi_classes[] = { + [VIDEO_ENHANCEMENT_CLASS] = I915_ENGINE_CLASS_VIDEO_ENHANCE, + }; + +-static int engine_cmp(void *priv, struct list_head *A, struct list_head *B) ++static int engine_cmp(void *priv, const struct list_head *A, ++ const struct list_head *B) + { + const struct intel_engine_cs *a = + container_of((struct rb_node *)A, typeof(*a), uabi_node); +diff --git a/drivers/gpu/drm/i915/gvt/debugfs.c b/drivers/gpu/drm/i915/gvt/debugfs.c +index 62e6a14ad..9f1c209d9 100644 +--- a/drivers/gpu/drm/i915/gvt/debugfs.c ++++ b/drivers/gpu/drm/i915/gvt/debugfs.c +@@ -41,7 +41,7 @@ struct diff_mmio { + + /* Compare two diff_mmio items. */ + static int mmio_offset_compare(void *priv, +- struct list_head *a, struct list_head *b) ++ const struct list_head *a, const struct list_head *b) + { + struct diff_mmio *ma; + struct diff_mmio *mb; +diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +index 713770fb2..65e28c4cd 100644 +--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c ++++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +@@ -1075,7 +1075,8 @@ static int igt_ppgtt_shrink_boom(void *arg) + return exercise_ppgtt(arg, shrink_boom); + } + +-static int sort_holes(void *priv, struct list_head *A, struct list_head *B) ++static int sort_holes(void *priv, const struct list_head *A, ++ const struct list_head *B) + { + struct drm_mm_node *a = list_entry(A, typeof(*a), hole_stack); + struct drm_mm_node *b = list_entry(B, typeof(*b), hole_stack); +diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c +index 21ce2f950..a78b60b62 100644 +--- a/drivers/gpu/drm/radeon/radeon_cs.c ++++ b/drivers/gpu/drm/radeon/radeon_cs.c +@@ -394,8 +394,8 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) + return 0; + } + +-static int cmp_size_smaller_first(void *priv, struct list_head *a, +- struct list_head *b) ++static int cmp_size_smaller_first(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct radeon_bo_list *la = list_entry(a, struct radeon_bo_list, tv.head); + struct radeon_bo_list *lb = list_entry(b, struct radeon_bo_list, tv.head); +diff --git a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c +index d39952320..29d71267a 100644 +--- a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c ++++ b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c +@@ -83,7 +83,8 @@ usnic_uiom_interval_node_alloc(long int start, long int last, int ref_cnt, + return interval; + } + +-static int interval_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int interval_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct usnic_uiom_interval_node *node_a, *node_b; + +diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c +index dd0e3bd50..3c0809095 100644 +--- a/drivers/interconnect/qcom/bcm-voter.c ++++ b/drivers/interconnect/qcom/bcm-voter.c +@@ -39,7 +39,7 @@ struct bcm_voter { + u32 tcs_wait; + }; + +-static int cmp_vcd(void *priv, struct list_head *a, struct list_head *b) ++static int cmp_vcd(void *priv, const struct list_head *a, const struct list_head *b) + { + const struct qcom_icc_bcm *bcm_a = + list_entry(a, struct qcom_icc_bcm, list); +diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig +index b7f826be8..c44e1f31a 100644 +--- a/drivers/irqchip/Kconfig ++++ b/drivers/irqchip/Kconfig +@@ -426,6 +426,7 @@ config MESON_IRQ_GPIO + config GOLDFISH_PIC + bool "Goldfish programmable interrupt controller" + depends on MIPS && (GOLDFISH || COMPILE_TEST) ++ select GENERIC_IRQ_CHIP + select IRQ_DOMAIN + help + Say yes here to enable Goldfish interrupt controller driver used +diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c +index 53cf1e3dd..77472255e 100644 +--- a/drivers/irqchip/irq-gic-v3-its.c ++++ b/drivers/irqchip/irq-gic-v3-its.c +@@ -4531,7 +4531,7 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq + + if (err) { + if (i > 0) +- its_vpe_irq_domain_free(domain, virq, i - 1); ++ its_vpe_irq_domain_free(domain, virq, i); + + its_lpi_free(bitmap, base, nr_ids); + its_free_prop_table(vprop_page); +diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c +index 38fbb3b59..38cc8340e 100644 +--- a/drivers/mcb/mcb-core.c ++++ b/drivers/mcb/mcb-core.c +@@ -277,8 +277,8 @@ struct mcb_bus *mcb_alloc_bus(struct device *carrier) + + bus_nr = ida_simple_get(&mcb_ida, 0, 0, GFP_KERNEL); + if (bus_nr < 0) { +- rc = bus_nr; +- goto err_free; ++ kfree(bus); ++ return ERR_PTR(bus_nr); + } + + bus->bus_nr = bus_nr; +@@ -293,12 +293,12 @@ struct mcb_bus *mcb_alloc_bus(struct device *carrier) + dev_set_name(&bus->dev, "mcb:%d", bus_nr); + rc = device_add(&bus->dev); + if (rc) +- goto err_free; ++ goto err_put; + + return bus; +-err_free: +- put_device(carrier); +- kfree(bus); ++ ++err_put: ++ put_device(&bus->dev); + return ERR_PTR(rc); + } + EXPORT_SYMBOL_NS_GPL(mcb_alloc_bus, MCB); +diff --git a/drivers/md/md.c b/drivers/md/md.c +index 288d26013..f16f19054 100644 +--- a/drivers/md/md.c ++++ b/drivers/md/md.c +@@ -5759,10 +5759,6 @@ static int md_alloc(dev_t dev, char *name) + disk->flags |= GENHD_FL_EXT_DEVT; + disk->events |= DISK_EVENT_MEDIA_CHANGE; + mddev->gendisk = disk; +- /* As soon as we call add_disk(), another thread could get +- * through to md_open, so make sure it doesn't get too far +- */ +- mutex_lock(&mddev->open_mutex); + add_disk(disk); + + error = kobject_add(&mddev->kobj, &disk_to_dev(disk)->kobj, "%s", "md"); +@@ -5777,7 +5773,6 @@ static int md_alloc(dev_t dev, char *name) + if (mddev->kobj.sd && + sysfs_create_group(&mddev->kobj, &md_bitmap_group)) + pr_debug("pointless warning\n"); +- mutex_unlock(&mddev->open_mutex); + abort: + mutex_unlock(&disks_mutex); + if (!error && mddev->kobj.sd) { +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c +index 39343479a..c82953a32 100644 +--- a/drivers/md/raid5.c ++++ b/drivers/md/raid5.c +@@ -953,7 +953,8 @@ static void dispatch_bio_list(struct bio_list *tmp) + submit_bio_noacct(bio); + } + +-static int cmp_stripe(void *priv, struct list_head *a, struct list_head *b) ++static int cmp_stripe(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + const struct r5pending_data *da = list_entry(a, + struct r5pending_data, sibling); +diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c +index 6c1a23cb3..202bf951e 100644 +--- a/drivers/misc/sram.c ++++ b/drivers/misc/sram.c +@@ -144,8 +144,8 @@ static void sram_free_partitions(struct sram_dev *sram) + } + } + +-static int sram_reserve_cmp(void *priv, struct list_head *a, +- struct list_head *b) ++static int sram_reserve_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct sram_reserve *ra = list_entry(a, struct sram_reserve, list); + struct sram_reserve *rb = list_entry(b, struct sram_reserve, list); +diff --git a/drivers/net/dsa/realtek-smi-core.c b/drivers/net/dsa/realtek-smi-core.c +index 8e49d4f85..6bf46d76c 100644 +--- a/drivers/net/dsa/realtek-smi-core.c ++++ b/drivers/net/dsa/realtek-smi-core.c +@@ -368,7 +368,7 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) + smi->slave_mii_bus->parent = smi->dev; + smi->ds->slave_mii_bus = smi->slave_mii_bus; + +- ret = of_mdiobus_register(smi->slave_mii_bus, mdio_np); ++ ret = devm_of_mdiobus_register(smi->dev, smi->slave_mii_bus, mdio_np); + if (ret) { + dev_err(smi->dev, "unable to register MDIO bus %s\n", + smi->slave_mii_bus->id); +diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +index f26d03735..5b996330f 100644 +--- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c ++++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +@@ -419,13 +419,13 @@ static int atl_resume_common(struct device *dev, bool deep) + if (deep) { + /* Reinitialize Nic/Vecs objects */ + aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); ++ } + ++ if (netif_running(nic->ndev)) { + ret = aq_nic_init(nic); + if (ret) + goto err_exit; +- } + +- if (netif_running(nic->ndev)) { + ret = aq_nic_start(nic); + if (ret) + goto err_exit; +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c +index 26179e437..cb0c27041 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c +@@ -381,7 +381,7 @@ static bool bnxt_txr_netif_try_stop_queue(struct bnxt *bp, + * netif_tx_queue_stopped(). + */ + smp_mb(); +- if (bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh) { ++ if (bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh) { + netif_tx_wake_queue(txq); + return false; + } +@@ -717,7 +717,7 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts) + smp_mb(); + + if (unlikely(netif_tx_queue_stopped(txq)) && +- bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh && ++ bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh && + READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING) + netif_tx_wake_queue(txq); + } +@@ -2300,7 +2300,7 @@ static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, + if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) { + tx_pkts++; + /* return full budget so NAPI will complete. */ +- if (unlikely(tx_pkts > bp->tx_wake_thresh)) { ++ if (unlikely(tx_pkts >= bp->tx_wake_thresh)) { + rx_pkts = budget; + raw_cons = NEXT_RAW_CMP(raw_cons); + if (budget) +@@ -3431,7 +3431,7 @@ static int bnxt_init_tx_rings(struct bnxt *bp) + u16 i; + + bp->tx_wake_thresh = max_t(int, bp->tx_ring_size / 2, +- MAX_SKB_FRAGS + 1); ++ BNXT_MIN_TX_DESC_CNT); + + for (i = 0; i < bp->tx_nr_rings; i++) { + struct bnxt_tx_ring_info *txr = &bp->tx_ring[i]; +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h +index 95d10e7bb..92f9f7f52 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h +@@ -611,6 +611,11 @@ struct nqe_cn { + #define BNXT_MAX_RX_JUM_DESC_CNT (RX_DESC_CNT * MAX_RX_AGG_PAGES - 1) + #define BNXT_MAX_TX_DESC_CNT (TX_DESC_CNT * MAX_TX_PAGES - 1) + ++/* Minimum TX BDs for a TX packet with MAX_SKB_FRAGS + 1. We need one extra ++ * BD because the first TX BD is always a long BD. ++ */ ++#define BNXT_MIN_TX_DESC_CNT (MAX_SKB_FRAGS + 2) ++ + #define RX_RING(x) (((x) & ~(RX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4)) + #define RX_IDX(x) ((x) & (RX_DESC_CNT - 1)) + +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +index 1471c9a36..6f9196ff2 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +@@ -780,7 +780,7 @@ static int bnxt_set_ringparam(struct net_device *dev, + + if ((ering->rx_pending > BNXT_MAX_RX_DESC_CNT) || + (ering->tx_pending > BNXT_MAX_TX_DESC_CNT) || +- (ering->tx_pending <= MAX_SKB_FRAGS)) ++ (ering->tx_pending < BNXT_MIN_TX_DESC_CNT)) + return -EINVAL; + + if (netif_running(dev)) +diff --git a/drivers/net/ethernet/cadence/macb_pci.c b/drivers/net/ethernet/cadence/macb_pci.c +index 353393dea..3593b310c 100644 +--- a/drivers/net/ethernet/cadence/macb_pci.c ++++ b/drivers/net/ethernet/cadence/macb_pci.c +@@ -111,9 +111,9 @@ static void macb_remove(struct pci_dev *pdev) + struct platform_device *plat_dev = pci_get_drvdata(pdev); + struct macb_platform_data *plat_data = dev_get_platdata(&plat_dev->dev); + +- platform_device_unregister(plat_dev); + clk_unregister(plat_data->pclk); + clk_unregister(plat_data->hclk); ++ platform_device_unregister(plat_dev); + } + + static const struct pci_device_id dev_id_table[] = { +diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c +index df4a858c8..15aa3b3c0 100644 +--- a/drivers/net/ethernet/freescale/enetc/enetc.c ++++ b/drivers/net/ethernet/freescale/enetc/enetc.c +@@ -299,7 +299,7 @@ static void enetc_rx_dim_work(struct work_struct *w) + + static void enetc_rx_net_dim(struct enetc_int_vector *v) + { +- struct dim_sample dim_sample; ++ struct dim_sample dim_sample = {}; + + v->comp_cnt++; + +@@ -1320,7 +1320,6 @@ static void enetc_clear_bdrs(struct enetc_ndev_priv *priv) + static int enetc_setup_irqs(struct enetc_ndev_priv *priv) + { + struct pci_dev *pdev = priv->si->pdev; +- cpumask_t cpu_mask; + int i, j, err; + + for (i = 0; i < priv->bdr_int_num; i++) { +@@ -1349,9 +1348,7 @@ static int enetc_setup_irqs(struct enetc_ndev_priv *priv) + + enetc_wr(hw, ENETC_SIMSITRV(idx), entry); + } +- cpumask_clear(&cpu_mask); +- cpumask_set_cpu(i % num_online_cpus(), &cpu_mask); +- irq_set_affinity_hint(irq, &cpu_mask); ++ irq_set_affinity_hint(irq, get_cpu_mask(i % num_online_cpus())); + } + + return 0; +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +index 59ec538eb..24357e907 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +@@ -4377,6 +4377,24 @@ static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir, + return 0; + } + ++static int hclge_parse_rss_hfunc(struct hclge_vport *vport, const u8 hfunc, ++ u8 *hash_algo) ++{ ++ switch (hfunc) { ++ case ETH_RSS_HASH_TOP: ++ *hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ; ++ return 0; ++ case ETH_RSS_HASH_XOR: ++ *hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE; ++ return 0; ++ case ETH_RSS_HASH_NO_CHANGE: ++ *hash_algo = vport->rss_algo; ++ return 0; ++ default: ++ return -EINVAL; ++ } ++} ++ + static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, + const u8 *key, const u8 hfunc) + { +@@ -4385,30 +4403,27 @@ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, + u8 hash_algo; + int ret, i; + ++ ret = hclge_parse_rss_hfunc(vport, hfunc, &hash_algo); ++ if (ret) { ++ dev_err(&hdev->pdev->dev, "invalid hfunc type %u\n", hfunc); ++ return ret; ++ } ++ + /* Set the RSS Hash Key if specififed by the user */ + if (key) { +- switch (hfunc) { +- case ETH_RSS_HASH_TOP: +- hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ; +- break; +- case ETH_RSS_HASH_XOR: +- hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE; +- break; +- case ETH_RSS_HASH_NO_CHANGE: +- hash_algo = vport->rss_algo; +- break; +- default: +- return -EINVAL; +- } +- + ret = hclge_set_rss_algo_key(hdev, hash_algo, key); + if (ret) + return ret; + + /* Update the shadow RSS key with user specified qids */ + memcpy(vport->rss_hash_key, key, HCLGE_RSS_KEY_SIZE); +- vport->rss_algo = hash_algo; ++ } else { ++ ret = hclge_set_rss_algo_key(hdev, hash_algo, ++ vport->rss_hash_key); ++ if (ret) ++ return ret; + } ++ vport->rss_algo = hash_algo; + + /* Update the shadow RSS table with user specified qids */ + for (i = 0; i < HCLGE_RSS_IND_TBL_SIZE; i++) +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +index ff9d84a71..5d3996767 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +@@ -581,9 +581,17 @@ static void hclge_get_queue_id_in_pf(struct hclge_vport *vport, + struct hclge_mbx_vf_to_pf_cmd *mbx_req, + struct hclge_respond_to_vf_msg *resp_msg) + { ++ struct hnae3_handle *handle = &vport->nic; ++ struct hclge_dev *hdev = vport->back; + u16 queue_id, qid_in_pf; + + memcpy(&queue_id, mbx_req->msg.data, sizeof(queue_id)); ++ if (queue_id >= handle->kinfo.num_tqps) { ++ dev_err(&hdev->pdev->dev, "Invalid queue id(%u) from VF %u\n", ++ queue_id, mbx_req->mbx_src_vfid); ++ return; ++ } ++ + qid_in_pf = hclge_covert_handle_qid_global(&vport->nic, queue_id); + memcpy(resp_msg->data, &qid_in_pf, sizeof(qid_in_pf)); + resp_msg->len = sizeof(qid_in_pf); +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +index 447457cac..3641d7c31 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +@@ -785,40 +785,56 @@ static int hclgevf_get_rss(struct hnae3_handle *handle, u32 *indir, u8 *key, + return 0; + } + ++static int hclgevf_parse_rss_hfunc(struct hclgevf_dev *hdev, const u8 hfunc, ++ u8 *hash_algo) ++{ ++ switch (hfunc) { ++ case ETH_RSS_HASH_TOP: ++ *hash_algo = HCLGEVF_RSS_HASH_ALGO_TOEPLITZ; ++ return 0; ++ case ETH_RSS_HASH_XOR: ++ *hash_algo = HCLGEVF_RSS_HASH_ALGO_SIMPLE; ++ return 0; ++ case ETH_RSS_HASH_NO_CHANGE: ++ *hash_algo = hdev->rss_cfg.hash_algo; ++ return 0; ++ default: ++ return -EINVAL; ++ } ++} ++ + static int hclgevf_set_rss(struct hnae3_handle *handle, const u32 *indir, + const u8 *key, const u8 hfunc) + { + struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); + struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg; ++ u8 hash_algo; + int ret, i; + + if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) { ++ ret = hclgevf_parse_rss_hfunc(hdev, hfunc, &hash_algo); ++ if (ret) ++ return ret; ++ + /* Set the RSS Hash Key if specififed by the user */ + if (key) { +- switch (hfunc) { +- case ETH_RSS_HASH_TOP: +- rss_cfg->hash_algo = +- HCLGEVF_RSS_HASH_ALGO_TOEPLITZ; +- break; +- case ETH_RSS_HASH_XOR: +- rss_cfg->hash_algo = +- HCLGEVF_RSS_HASH_ALGO_SIMPLE; +- break; +- case ETH_RSS_HASH_NO_CHANGE: +- break; +- default: +- return -EINVAL; +- } +- +- ret = hclgevf_set_rss_algo_key(hdev, rss_cfg->hash_algo, +- key); +- if (ret) ++ ret = hclgevf_set_rss_algo_key(hdev, hash_algo, key); ++ if (ret) { ++ dev_err(&hdev->pdev->dev, ++ "invalid hfunc type %u\n", hfunc); + return ret; ++ } + + /* Update the shadow RSS key with user specified qids */ + memcpy(rss_cfg->rss_hash_key, key, + HCLGEVF_RSS_KEY_SIZE); ++ } else { ++ ret = hclgevf_set_rss_algo_key(hdev, hash_algo, ++ rss_cfg->rss_hash_key); ++ if (ret) ++ return ret; + } ++ rss_cfg->hash_algo = hash_algo; + } + + /* update the shadow RSS table with user specified qids */ +diff --git a/drivers/net/ethernet/i825xx/82596.c b/drivers/net/ethernet/i825xx/82596.c +index fc8c7cd67..8b12a5ab3 100644 +--- a/drivers/net/ethernet/i825xx/82596.c ++++ b/drivers/net/ethernet/i825xx/82596.c +@@ -1155,7 +1155,7 @@ struct net_device * __init i82596_probe(int unit) + err = -ENODEV; + goto out; + } +- memcpy(eth_addr, (void *) 0xfffc1f2c, ETH_ALEN); /* YUCK! Get addr from NOVRAM */ ++ memcpy(eth_addr, absolute_pointer(0xfffc1f2c), ETH_ALEN); /* YUCK! Get addr from NOVRAM */ + dev->base_addr = MVME_I596_BASE; + dev->irq = (unsigned) MVME16x_IRQ_I596; + goto found; +diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +index d8a20e83d..8999e9ce4 100644 +--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c ++++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +@@ -372,6 +372,9 @@ mlx4_en_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, + int nhoff = skb_network_offset(skb); + int ret = 0; + ++ if (skb->encapsulation) ++ return -EPROTONOSUPPORT; ++ + if (skb->protocol != htons(ETH_P_IP)) + return -EPROTONOSUPPORT; + +diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c +index a99861124..68fbe536a 100644 +--- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c +@@ -1297,6 +1297,14 @@ qed_iwarp_wait_cid_map_cleared(struct qed_hwfn *p_hwfn, struct qed_bmap *bmap) + prev_weight = weight; + + while (weight) { ++ /* If the HW device is during recovery, all resources are ++ * immediately reset without receiving a per-cid indication ++ * from HW. In this case we don't expect the cid_map to be ++ * cleared. ++ */ ++ if (p_hwfn->cdev->recov_in_prog) ++ return 0; ++ + msleep(QED_IWARP_MAX_CID_CLEAN_TIME); + + weight = bitmap_weight(bmap->bitmap, bmap->max_count); +diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c +index f16a157bb..cf5baa5e5 100644 +--- a/drivers/net/ethernet/qlogic/qed/qed_roce.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c +@@ -77,6 +77,14 @@ void qed_roce_stop(struct qed_hwfn *p_hwfn) + * Beyond the added delay we clear the bitmap anyway. + */ + while (bitmap_weight(rcid_map->bitmap, rcid_map->max_count)) { ++ /* If the HW device is during recovery, all resources are ++ * immediately reset without receiving a per-cid indication ++ * from HW. In this case we don't expect the cid bitmap to be ++ * cleared. ++ */ ++ if (p_hwfn->cdev->recov_in_prog) ++ return; ++ + msleep(100); + if (wait_count++ > 20) { + DP_NOTICE(p_hwfn, "cid bitmap wait timed out\n"); +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +index 3b5023240..93e3596f1 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -226,7 +226,7 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv) + priv->clk_csr = STMMAC_CSR_100_150M; + else if ((clk_rate >= CSR_F_150M) && (clk_rate < CSR_F_250M)) + priv->clk_csr = STMMAC_CSR_150_250M; +- else if ((clk_rate >= CSR_F_250M) && (clk_rate < CSR_F_300M)) ++ else if ((clk_rate >= CSR_F_250M) && (clk_rate <= CSR_F_300M)) + priv->clk_csr = STMMAC_CSR_250_300M; + } + +diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c +index da13683d5..bd0beb16d 100644 +--- a/drivers/net/hamradio/6pack.c ++++ b/drivers/net/hamradio/6pack.c +@@ -68,9 +68,9 @@ + #define SIXP_DAMA_OFF 0 + + /* default level 2 parameters */ +-#define SIXP_TXDELAY (HZ/4) /* in 1 s */ ++#define SIXP_TXDELAY 25 /* 250 ms */ + #define SIXP_PERSIST 50 /* in 256ths */ +-#define SIXP_SLOTTIME (HZ/10) /* in 1 s */ ++#define SIXP_SLOTTIME 10 /* 100 ms */ + #define SIXP_INIT_RESYNC_TIMEOUT (3*HZ/2) /* in 1 s */ + #define SIXP_RESYNC_TIMEOUT 5*HZ /* in 1 s */ + +diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c +index 6072e87ed..025c3246f 100644 +--- a/drivers/net/phy/phylink.c ++++ b/drivers/net/phy/phylink.c +@@ -1493,6 +1493,32 @@ int phylink_ethtool_ksettings_set(struct phylink *pl, + if (config.an_enabled && phylink_is_empty_linkmode(config.advertising)) + return -EINVAL; + ++ /* If this link is with an SFP, ensure that changes to advertised modes ++ * also cause the associated interface to be selected such that the ++ * link can be configured correctly. ++ */ ++ if (pl->sfp_port && pl->sfp_bus) { ++ config.interface = sfp_select_interface(pl->sfp_bus, ++ config.advertising); ++ if (config.interface == PHY_INTERFACE_MODE_NA) { ++ phylink_err(pl, ++ "selection of interface failed, advertisement %*pb\n", ++ __ETHTOOL_LINK_MODE_MASK_NBITS, ++ config.advertising); ++ return -EINVAL; ++ } ++ ++ /* Revalidate with the selected interface */ ++ linkmode_copy(support, pl->supported); ++ if (phylink_validate(pl, support, &config)) { ++ phylink_err(pl, "validation of %s/%s with support %*pb failed\n", ++ phylink_an_mode_str(pl->cur_link_an_mode), ++ phy_modes(config.interface), ++ __ETHTOOL_LINK_MODE_MASK_NBITS, support); ++ return -EINVAL; ++ } ++ } ++ + mutex_lock(&pl->state_mutex); + pl->link_config.speed = config.speed; + pl->link_config.duplex = config.duplex; +@@ -2072,7 +2098,9 @@ static int phylink_sfp_config(struct phylink *pl, u8 mode, + if (phy_interface_mode_is_8023z(iface) && pl->phydev) + return -EINVAL; + +- changed = !linkmode_equal(pl->supported, support); ++ changed = !linkmode_equal(pl->supported, support) || ++ !linkmode_equal(pl->link_config.advertising, ++ config.advertising); + if (changed) { + linkmode_copy(pl->supported, support); + linkmode_copy(pl->link_config.advertising, config.advertising); +diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c +index f269337c8..df8d4c1e5 100644 +--- a/drivers/net/usb/hso.c ++++ b/drivers/net/usb/hso.c +@@ -2721,14 +2721,14 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, + + serial = kzalloc(sizeof(*serial), GFP_KERNEL); + if (!serial) +- goto exit; ++ goto err_free_dev; + + hso_dev->port_data.dev_serial = serial; + serial->parent = hso_dev; + + if (hso_serial_common_create + (serial, 1, CTRL_URB_RX_SIZE, CTRL_URB_TX_SIZE)) +- goto exit; ++ goto err_free_serial; + + serial->tx_data_length--; + serial->write_data = hso_mux_serial_write_data; +@@ -2744,11 +2744,9 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, + /* done, return it */ + return hso_dev; + +-exit: +- if (serial) { +- tty_unregister_device(tty_drv, serial->minor); +- kfree(serial); +- } ++err_free_serial: ++ kfree(serial); ++err_free_dev: + kfree(hso_dev); + return NULL; + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 5a9b2f1b1..bbc3efef5 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -13,7 +13,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -3801,14 +3800,6 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid, + return ret; + } + +-static int ns_cmp(void *priv, struct list_head *a, struct list_head *b) +-{ +- struct nvme_ns *nsa = container_of(a, struct nvme_ns, list); +- struct nvme_ns *nsb = container_of(b, struct nvme_ns, list); +- +- return nsa->head->ns_id - nsb->head->ns_id; +-} +- + struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) + { + struct nvme_ns *ns, *ret = NULL; +@@ -3829,6 +3820,22 @@ struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) + } + EXPORT_SYMBOL_NS_GPL(nvme_find_get_ns, NVME_TARGET_PASSTHRU); + ++/* ++ * Add the namespace to the controller list while keeping the list ordered. ++ */ ++static void nvme_ns_add_to_ctrl_list(struct nvme_ns *ns) ++{ ++ struct nvme_ns *tmp; ++ ++ list_for_each_entry_reverse(tmp, &ns->ctrl->namespaces, list) { ++ if (tmp->head->ns_id < ns->head->ns_id) { ++ list_add(&ns->list, &tmp->list); ++ return; ++ } ++ } ++ list_add(&ns->list, &ns->ctrl->namespaces); ++} ++ + static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, + struct nvme_ns_ids *ids) + { +@@ -3888,9 +3895,8 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, + } + + down_write(&ctrl->namespaces_rwsem); +- list_add_tail(&ns->list, &ctrl->namespaces); ++ nvme_ns_add_to_ctrl_list(ns); + up_write(&ctrl->namespaces_rwsem); +- + nvme_get_ctrl(ctrl); + + device_add_disk(ctrl->device, ns->disk, nvme_ns_id_attr_groups); +@@ -4159,10 +4165,6 @@ static void nvme_scan_work(struct work_struct *work) + if (nvme_scan_ns_list(ctrl) != 0) + nvme_scan_ns_sequential(ctrl); + mutex_unlock(&ctrl->scan_lock); +- +- down_write(&ctrl->namespaces_rwsem); +- list_sort(NULL, &ctrl->namespaces, ns_cmp); +- up_write(&ctrl->namespaces_rwsem); + } + + /* +diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c +index 2747efc03..46a1e24ba 100644 +--- a/drivers/nvme/host/multipath.c ++++ b/drivers/nvme/host/multipath.c +@@ -509,14 +509,17 @@ static int nvme_update_ana_state(struct nvme_ctrl *ctrl, + + down_read(&ctrl->namespaces_rwsem); + list_for_each_entry(ns, &ctrl->namespaces, list) { +- unsigned nsid = le32_to_cpu(desc->nsids[n]); +- ++ unsigned nsid; ++again: ++ nsid = le32_to_cpu(desc->nsids[n]); + if (ns->head->ns_id < nsid) + continue; + if (ns->head->ns_id == nsid) + nvme_update_ns_ana_state(desc, ns); + if (++n == nr_nsids) + break; ++ if (ns->head->ns_id > nsid) ++ goto again; + } + up_read(&ctrl->namespaces_rwsem); + return 0; +diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c +index 9c356be7f..51f4647ea 100644 +--- a/drivers/nvme/host/rdma.c ++++ b/drivers/nvme/host/rdma.c +@@ -655,8 +655,8 @@ static void nvme_rdma_free_queue(struct nvme_rdma_queue *queue) + if (!test_and_clear_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags)) + return; + +- nvme_rdma_destroy_queue_ib(queue); + rdma_destroy_id(queue->cm_id); ++ nvme_rdma_destroy_queue_ib(queue); + mutex_destroy(&queue->queue_lock); + } + +@@ -1823,14 +1823,10 @@ static int nvme_rdma_conn_established(struct nvme_rdma_queue *queue) + for (i = 0; i < queue->queue_size; i++) { + ret = nvme_rdma_post_recv(queue, &queue->rsp_ring[i]); + if (ret) +- goto out_destroy_queue_ib; ++ return ret; + } + + return 0; +- +-out_destroy_queue_ib: +- nvme_rdma_destroy_queue_ib(queue); +- return ret; + } + + static int nvme_rdma_conn_rejected(struct nvme_rdma_queue *queue, +@@ -1924,14 +1920,10 @@ static int nvme_rdma_route_resolved(struct nvme_rdma_queue *queue) + if (ret) { + dev_err(ctrl->ctrl.device, + "rdma_connect_locked failed (%d).\n", ret); +- goto out_destroy_queue_ib; ++ return ret; + } + + return 0; +- +-out_destroy_queue_ib: +- nvme_rdma_destroy_queue_ib(queue); +- return ret; + } + + static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, +@@ -1962,8 +1954,6 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, + case RDMA_CM_EVENT_ROUTE_ERROR: + case RDMA_CM_EVENT_CONNECT_ERROR: + case RDMA_CM_EVENT_UNREACHABLE: +- nvme_rdma_destroy_queue_ib(queue); +- fallthrough; + case RDMA_CM_EVENT_ADDR_ERROR: + dev_dbg(queue->ctrl->ctrl.device, + "CM error event %d\n", ev->event); +diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c +index a6b3b0762..05ad6bee0 100644 +--- a/drivers/nvme/host/tcp.c ++++ b/drivers/nvme/host/tcp.c +@@ -611,7 +611,7 @@ static int nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req, + cpu_to_le32(data->hdr.hlen + hdgst + req->pdu_len + ddgst); + data->ttag = pdu->ttag; + data->command_id = nvme_cid(rq); +- data->data_offset = cpu_to_le32(req->data_sent); ++ data->data_offset = pdu->r2t_offset; + data->data_length = cpu_to_le32(req->pdu_len); + return 0; + } +@@ -937,7 +937,15 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) + nvme_tcp_ddgst_update(queue->snd_hash, page, + offset, ret); + +- /* fully successful last write*/ ++ /* ++ * update the request iterator except for the last payload send ++ * in the request where we don't want to modify it as we may ++ * compete with the RX path completing the request. ++ */ ++ if (req->data_sent + ret < req->data_len) ++ nvme_tcp_advance_req(req, ret); ++ ++ /* fully successful last send in current PDU */ + if (last && ret == len) { + if (queue->data_digest) { + nvme_tcp_ddgst_final(queue->snd_hash, +@@ -949,7 +957,6 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) + } + return 1; + } +- nvme_tcp_advance_req(req, ret); + } + return -EAGAIN; + } +diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c +index a40ed9e12..fb96d37a1 100644 +--- a/drivers/pci/controller/cadence/pcie-cadence-host.c ++++ b/drivers/pci/controller/cadence/pcie-cadence-host.c +@@ -345,7 +345,8 @@ static int cdns_pcie_host_bar_config(struct cdns_pcie_rc *rc, + return 0; + } + +-static int cdns_pcie_host_dma_ranges_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int cdns_pcie_host_dma_ranges_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct resource_entry *entry1, *entry2; + +diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c +index f175cff39..4f1a29ede 100644 +--- a/drivers/pci/controller/pci-aardvark.c ++++ b/drivers/pci/controller/pci-aardvark.c +@@ -214,7 +214,7 @@ + (PCIE_CONF_BUS(bus) | PCIE_CONF_DEV(PCI_SLOT(devfn)) | \ + PCIE_CONF_FUNC(PCI_FUNC(devfn)) | PCIE_CONF_REG(where)) + +-#define PIO_RETRY_CNT 500 ++#define PIO_RETRY_CNT 750000 /* 1.5 s */ + #define PIO_RETRY_DELAY 2 /* 2 us*/ + + #define LINK_WAIT_MAX_RETRIES 10 +diff --git a/drivers/platform/x86/intel_punit_ipc.c b/drivers/platform/x86/intel_punit_ipc.c +index f58b8543f..66bb39fd0 100644 +--- a/drivers/platform/x86/intel_punit_ipc.c ++++ b/drivers/platform/x86/intel_punit_ipc.c +@@ -8,7 +8,6 @@ + * which provide mailbox interface for power management usage. + */ + +-#include + #include + #include + #include +@@ -319,7 +318,7 @@ static struct platform_driver intel_punit_ipc_driver = { + .remove = intel_punit_ipc_remove, + .driver = { + .name = "intel_punit_ipc", +- .acpi_match_table = ACPI_PTR(punit_ipc_acpi_ids), ++ .acpi_match_table = punit_ipc_acpi_ids, + }, + }; + +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c +index 4d51c4ace..7b0155b0e 100644 +--- a/drivers/s390/net/qeth_core_main.c ++++ b/drivers/s390/net/qeth_core_main.c +@@ -210,6 +210,9 @@ static void qeth_clear_working_pool_list(struct qeth_card *card) + &card->qdio.in_buf_pool.entry_list, list) + list_del(&pool_entry->list); + ++ if (!queue) ++ return; ++ + for (i = 0; i < ARRAY_SIZE(queue->bufs); i++) + queue->bufs[i].pool_entry = NULL; + } +diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c +index bdea28675..2c59a5bf3 100644 +--- a/drivers/scsi/lpfc/lpfc_attr.c ++++ b/drivers/scsi/lpfc/lpfc_attr.c +@@ -6005,7 +6005,8 @@ lpfc_sg_seg_cnt_show(struct device *dev, struct device_attribute *attr, + len = scnprintf(buf, PAGE_SIZE, "SGL sz: %d total SGEs: %d\n", + phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt); + +- len += scnprintf(buf + len, PAGE_SIZE, "Cfg: %d SCSI: %d NVME: %d\n", ++ len += scnprintf(buf + len, PAGE_SIZE - len, ++ "Cfg: %d SCSI: %d NVME: %d\n", + phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt, + phba->cfg_nvme_seg_cnt); + return len; +diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c +index 6faf34fa6..b7aac3116 100644 +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -6934,7 +6934,8 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) + return 0; + break; + case QLA2XXX_INI_MODE_DUAL: +- if (!qla_dual_mode_enabled(vha)) ++ if (!qla_dual_mode_enabled(vha) && ++ !qla_ini_mode_enabled(vha)) + return 0; + break; + case QLA2XXX_INI_MODE_ENABLED: +diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c +index ac07a9ef3..41772b886 100644 +--- a/drivers/scsi/scsi_transport_iscsi.c ++++ b/drivers/scsi/scsi_transport_iscsi.c +@@ -442,9 +442,7 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, + struct iscsi_transport *t = iface->transport; + int param = -1; + +- if (attr == &dev_attr_iface_enabled.attr) +- param = ISCSI_NET_PARAM_IFACE_ENABLE; +- else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr) ++ if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr) + param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO; + else if (attr == &dev_attr_iface_header_digest.attr) + param = ISCSI_IFACE_PARAM_HDRDGST_EN; +@@ -484,7 +482,9 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, + if (param != -1) + return t->attr_is_visible(ISCSI_IFACE_PARAM, param); + +- if (attr == &dev_attr_iface_vlan_id.attr) ++ if (attr == &dev_attr_iface_enabled.attr) ++ param = ISCSI_NET_PARAM_IFACE_ENABLE; ++ else if (attr == &dev_attr_iface_vlan_id.attr) + param = ISCSI_NET_PARAM_VLAN_ID; + else if (attr == &dev_attr_iface_vlan_priority.attr) + param = ISCSI_NET_PARAM_VLAN_PRIORITY; +diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c +index 87a7274e4..01088f333 100644 +--- a/drivers/scsi/sd_zbc.c ++++ b/drivers/scsi/sd_zbc.c +@@ -155,8 +155,8 @@ static void *sd_zbc_alloc_report_buffer(struct scsi_disk *sdkp, + + /* + * Report zone buffer size should be at most 64B times the number of +- * zones requested plus the 64B reply header, but should be at least +- * SECTOR_SIZE for ATA devices. ++ * zones requested plus the 64B reply header, but should be aligned ++ * to SECTOR_SIZE for ATA devices. + * Make sure that this size does not exceed the hardware capabilities. + * Furthermore, since the report zone command cannot be split, make + * sure that the allocated buffer can always be mapped by limiting the +@@ -175,7 +175,7 @@ static void *sd_zbc_alloc_report_buffer(struct scsi_disk *sdkp, + *buflen = bufsize; + return buf; + } +- bufsize >>= 1; ++ bufsize = rounddown(bufsize >> 1, SECTOR_SIZE); + } + + return NULL; +diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c +index 89b91cdfb..4d4f77a18 100644 +--- a/drivers/spi/spi-loopback-test.c ++++ b/drivers/spi/spi-loopback-test.c +@@ -454,7 +454,8 @@ struct rx_ranges { + u8 *end; + }; + +-static int rx_ranges_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int rx_ranges_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct rx_ranges *rx_a = list_entry(a, struct rx_ranges, list); + struct rx_ranges *rx_b = list_entry(b, struct rx_ranges, list); +diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c +index f7c832fd4..669fc4286 100644 +--- a/drivers/spi/spi-tegra20-slink.c ++++ b/drivers/spi/spi-tegra20-slink.c +@@ -1201,7 +1201,7 @@ static int tegra_slink_resume(struct device *dev) + } + #endif + +-static int tegra_slink_runtime_suspend(struct device *dev) ++static int __maybe_unused tegra_slink_runtime_suspend(struct device *dev) + { + struct spi_master *master = dev_get_drvdata(dev); + struct tegra_slink_data *tspi = spi_master_get_devdata(master); +@@ -1213,7 +1213,7 @@ static int tegra_slink_runtime_suspend(struct device *dev) + return 0; + } + +-static int tegra_slink_runtime_resume(struct device *dev) ++static int __maybe_unused tegra_slink_runtime_resume(struct device *dev) + { + struct spi_master *master = dev_get_drvdata(dev); + struct tegra_slink_data *tspi = spi_master_get_devdata(master); +diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c +index 80d74cce2..9858fae81 100644 +--- a/drivers/staging/comedi/comedi_fops.c ++++ b/drivers/staging/comedi/comedi_fops.c +@@ -3090,6 +3090,7 @@ static int compat_insnlist(struct file *file, unsigned long arg) + mutex_lock(&dev->mutex); + rc = do_insnlist_ioctl(dev, insns, insnlist32.n_insns, file); + mutex_unlock(&dev->mutex); ++ kfree(insns); + return rc; + } + +diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c +index a520f7f21..edaa83a69 100644 +--- a/drivers/staging/greybus/uart.c ++++ b/drivers/staging/greybus/uart.c +@@ -778,6 +778,17 @@ static void gb_tty_port_shutdown(struct tty_port *port) + gbphy_runtime_put_autosuspend(gb_tty->gbphy_dev); + } + ++static void gb_tty_port_destruct(struct tty_port *port) ++{ ++ struct gb_tty *gb_tty = container_of(port, struct gb_tty, port); ++ ++ if (gb_tty->minor != GB_NUM_MINORS) ++ release_minor(gb_tty); ++ kfifo_free(&gb_tty->write_fifo); ++ kfree(gb_tty->buffer); ++ kfree(gb_tty); ++} ++ + static const struct tty_operations gb_ops = { + .install = gb_tty_install, + .open = gb_tty_open, +@@ -803,6 +814,7 @@ static const struct tty_port_operations gb_port_ops = { + .dtr_rts = gb_tty_dtr_rts, + .activate = gb_tty_port_activate, + .shutdown = gb_tty_port_shutdown, ++ .destruct = gb_tty_port_destruct, + }; + + static int gb_uart_probe(struct gbphy_device *gbphy_dev, +@@ -815,17 +827,11 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, + int retval; + int minor; + +- gb_tty = kzalloc(sizeof(*gb_tty), GFP_KERNEL); +- if (!gb_tty) +- return -ENOMEM; +- + connection = gb_connection_create(gbphy_dev->bundle, + le16_to_cpu(gbphy_dev->cport_desc->id), + gb_uart_request_handler); +- if (IS_ERR(connection)) { +- retval = PTR_ERR(connection); +- goto exit_tty_free; +- } ++ if (IS_ERR(connection)) ++ return PTR_ERR(connection); + + max_payload = gb_operation_get_payload_size_max(connection); + if (max_payload < sizeof(struct gb_uart_send_data_request)) { +@@ -833,13 +839,23 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, + goto exit_connection_destroy; + } + ++ gb_tty = kzalloc(sizeof(*gb_tty), GFP_KERNEL); ++ if (!gb_tty) { ++ retval = -ENOMEM; ++ goto exit_connection_destroy; ++ } ++ ++ tty_port_init(&gb_tty->port); ++ gb_tty->port.ops = &gb_port_ops; ++ gb_tty->minor = GB_NUM_MINORS; ++ + gb_tty->buffer_payload_max = max_payload - + sizeof(struct gb_uart_send_data_request); + + gb_tty->buffer = kzalloc(gb_tty->buffer_payload_max, GFP_KERNEL); + if (!gb_tty->buffer) { + retval = -ENOMEM; +- goto exit_connection_destroy; ++ goto exit_put_port; + } + + INIT_WORK(&gb_tty->tx_work, gb_uart_tx_write_work); +@@ -847,7 +863,7 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, + retval = kfifo_alloc(&gb_tty->write_fifo, GB_UART_WRITE_FIFO_SIZE, + GFP_KERNEL); + if (retval) +- goto exit_buf_free; ++ goto exit_put_port; + + gb_tty->credits = GB_UART_FIRMWARE_CREDITS; + init_completion(&gb_tty->credits_complete); +@@ -861,7 +877,7 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, + } else { + retval = minor; + } +- goto exit_kfifo_free; ++ goto exit_put_port; + } + + gb_tty->minor = minor; +@@ -870,9 +886,6 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, + init_waitqueue_head(&gb_tty->wioctl); + mutex_init(&gb_tty->mutex); + +- tty_port_init(&gb_tty->port); +- gb_tty->port.ops = &gb_port_ops; +- + gb_tty->connection = connection; + gb_tty->gbphy_dev = gbphy_dev; + gb_connection_set_data(connection, gb_tty); +@@ -880,7 +893,7 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, + + retval = gb_connection_enable_tx(connection); + if (retval) +- goto exit_release_minor; ++ goto exit_put_port; + + send_control(gb_tty, gb_tty->ctrlout); + +@@ -907,16 +920,10 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, + + exit_connection_disable: + gb_connection_disable(connection); +-exit_release_minor: +- release_minor(gb_tty); +-exit_kfifo_free: +- kfifo_free(&gb_tty->write_fifo); +-exit_buf_free: +- kfree(gb_tty->buffer); ++exit_put_port: ++ tty_port_put(&gb_tty->port); + exit_connection_destroy: + gb_connection_destroy(connection); +-exit_tty_free: +- kfree(gb_tty); + + return retval; + } +@@ -947,15 +954,10 @@ static void gb_uart_remove(struct gbphy_device *gbphy_dev) + gb_connection_disable_rx(connection); + tty_unregister_device(gb_tty_driver, gb_tty->minor); + +- /* FIXME - free transmit / receive buffers */ +- + gb_connection_disable(connection); +- tty_port_destroy(&gb_tty->port); + gb_connection_destroy(connection); +- release_minor(gb_tty); +- kfifo_free(&gb_tty->write_fifo); +- kfree(gb_tty->buffer); +- kfree(gb_tty); ++ ++ tty_port_put(&gb_tty->port); + } + + static int gb_tty_init(void) +diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c +index f04352285..56ae882fb 100644 +--- a/drivers/target/target_core_configfs.c ++++ b/drivers/target/target_core_configfs.c +@@ -1110,20 +1110,24 @@ static ssize_t alua_support_store(struct config_item *item, + { + struct se_dev_attrib *da = to_attrib(item); + struct se_device *dev = da->da_dev; +- bool flag; ++ bool flag, oldflag; + int ret; + ++ ret = strtobool(page, &flag); ++ if (ret < 0) ++ return ret; ++ ++ oldflag = !(dev->transport_flags & TRANSPORT_FLAG_PASSTHROUGH_ALUA); ++ if (flag == oldflag) ++ return count; ++ + if (!(dev->transport->transport_flags_changeable & + TRANSPORT_FLAG_PASSTHROUGH_ALUA)) { + pr_err("dev[%p]: Unable to change SE Device alua_support:" + " alua_support has fixed value\n", dev); +- return -EINVAL; ++ return -ENOSYS; + } + +- ret = strtobool(page, &flag); +- if (ret < 0) +- return ret; +- + if (flag) + dev->transport_flags &= ~TRANSPORT_FLAG_PASSTHROUGH_ALUA; + else +@@ -1145,20 +1149,24 @@ static ssize_t pgr_support_store(struct config_item *item, + { + struct se_dev_attrib *da = to_attrib(item); + struct se_device *dev = da->da_dev; +- bool flag; ++ bool flag, oldflag; + int ret; + ++ ret = strtobool(page, &flag); ++ if (ret < 0) ++ return ret; ++ ++ oldflag = !(dev->transport_flags & TRANSPORT_FLAG_PASSTHROUGH_PGR); ++ if (flag == oldflag) ++ return count; ++ + if (!(dev->transport->transport_flags_changeable & + TRANSPORT_FLAG_PASSTHROUGH_PGR)) { + pr_err("dev[%p]: Unable to change SE Device pgr_support:" + " pgr_support has fixed value\n", dev); +- return -EINVAL; ++ return -ENOSYS; + } + +- ret = strtobool(page, &flag); +- if (ret < 0) +- return ret; +- + if (flag) + dev->transport_flags &= ~TRANSPORT_FLAG_PASSTHROUGH_PGR; + else +diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c +index 74158fa66..f5204f96f 100644 +--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c ++++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c +@@ -185,7 +185,7 @@ static int tcc_offset_update(unsigned int tcc) + return 0; + } + +-static unsigned int tcc_offset_save; ++static int tcc_offset_save = -1; + + static ssize_t tcc_offset_degree_celsius_store(struct device *dev, + struct device_attribute *attr, const char *buf, +@@ -709,7 +709,8 @@ static int proc_thermal_resume(struct device *dev) + proc_dev = dev_get_drvdata(dev); + proc_thermal_read_ppcc(proc_dev); + +- tcc_offset_update(tcc_offset_save); ++ if (tcc_offset_save >= 0) ++ tcc_offset_update(tcc_offset_save); + + return 0; + } +diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c +index 17e94f3aa..48a993d22 100644 +--- a/drivers/thermal/thermal_core.c ++++ b/drivers/thermal/thermal_core.c +@@ -226,15 +226,14 @@ int thermal_build_list_of_policies(char *buf) + { + struct thermal_governor *pos; + ssize_t count = 0; +- ssize_t size = PAGE_SIZE; + + mutex_lock(&thermal_governor_lock); + + list_for_each_entry(pos, &thermal_governor_list, governor_list) { +- size = PAGE_SIZE - count; +- count += scnprintf(buf + count, size, "%s ", pos->name); ++ count += scnprintf(buf + count, PAGE_SIZE - count, "%s ", ++ pos->name); + } +- count += scnprintf(buf + count, size, "\n"); ++ count += scnprintf(buf + count, PAGE_SIZE - count, "\n"); + + mutex_unlock(&thermal_governor_lock); + +diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c +index efe4cf32a..537bee8d2 100644 +--- a/drivers/tty/serial/8250/8250_omap.c ++++ b/drivers/tty/serial/8250/8250_omap.c +@@ -106,7 +106,7 @@ + #define UART_OMAP_EFR2_TIMEOUT_BEHAVE BIT(6) + + /* RX FIFO occupancy indicator */ +-#define UART_OMAP_RX_LVL 0x64 ++#define UART_OMAP_RX_LVL 0x19 + + struct omap8250_priv { + int line; +diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c +index 1e26220c7..34ff2181a 100644 +--- a/drivers/tty/serial/mvebu-uart.c ++++ b/drivers/tty/serial/mvebu-uart.c +@@ -164,7 +164,7 @@ static unsigned int mvebu_uart_tx_empty(struct uart_port *port) + st = readl(port->membase + UART_STAT); + spin_unlock_irqrestore(&port->lock, flags); + +- return (st & STAT_TX_FIFO_EMP) ? TIOCSER_TEMT : 0; ++ return (st & STAT_TX_EMP) ? TIOCSER_TEMT : 0; + } + + static unsigned int mvebu_uart_get_mctrl(struct uart_port *port) +diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c +index afa4cc52e..1a0c7beec 100644 +--- a/drivers/tty/synclink_gt.c ++++ b/drivers/tty/synclink_gt.c +@@ -137,37 +137,14 @@ MODULE_PARM_DESC(maxframe, "Maximum frame size used by device (4096 to 65535)"); + */ + static struct tty_driver *serial_driver; + +-static int open(struct tty_struct *tty, struct file * filp); +-static void close(struct tty_struct *tty, struct file * filp); +-static void hangup(struct tty_struct *tty); +-static void set_termios(struct tty_struct *tty, struct ktermios *old_termios); +- +-static int write(struct tty_struct *tty, const unsigned char *buf, int count); +-static int put_char(struct tty_struct *tty, unsigned char ch); +-static void send_xchar(struct tty_struct *tty, char ch); + static void wait_until_sent(struct tty_struct *tty, int timeout); +-static int write_room(struct tty_struct *tty); +-static void flush_chars(struct tty_struct *tty); + static void flush_buffer(struct tty_struct *tty); +-static void tx_hold(struct tty_struct *tty); + static void tx_release(struct tty_struct *tty); + +-static int ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); +-static int chars_in_buffer(struct tty_struct *tty); +-static void throttle(struct tty_struct * tty); +-static void unthrottle(struct tty_struct * tty); +-static int set_break(struct tty_struct *tty, int break_state); +- + /* +- * generic HDLC support and callbacks ++ * generic HDLC support + */ +-#if SYNCLINK_GENERIC_HDLC + #define dev_to_port(D) (dev_to_hdlc(D)->priv) +-static void hdlcdev_tx_done(struct slgt_info *info); +-static void hdlcdev_rx(struct slgt_info *info, char *buf, int size); +-static int hdlcdev_init(struct slgt_info *info); +-static void hdlcdev_exit(struct slgt_info *info); +-#endif + + + /* +@@ -186,9 +163,6 @@ struct cond_wait { + wait_queue_entry_t wait; + unsigned int data; + }; +-static void init_cond_wait(struct cond_wait *w, unsigned int data); +-static void add_cond_wait(struct cond_wait **head, struct cond_wait *w); +-static void remove_cond_wait(struct cond_wait **head, struct cond_wait *w); + static void flush_cond_wait(struct cond_wait **head); + + /* +@@ -443,12 +417,8 @@ static void shutdown(struct slgt_info *info); + static void program_hw(struct slgt_info *info); + static void change_params(struct slgt_info *info); + +-static int register_test(struct slgt_info *info); +-static int irq_test(struct slgt_info *info); +-static int loopback_test(struct slgt_info *info); + static int adapter_test(struct slgt_info *info); + +-static void reset_adapter(struct slgt_info *info); + static void reset_port(struct slgt_info *info); + static void async_mode(struct slgt_info *info); + static void sync_mode(struct slgt_info *info); +@@ -457,41 +427,23 @@ static void rx_stop(struct slgt_info *info); + static void rx_start(struct slgt_info *info); + static void reset_rbufs(struct slgt_info *info); + static void free_rbufs(struct slgt_info *info, unsigned int first, unsigned int last); +-static void rdma_reset(struct slgt_info *info); + static bool rx_get_frame(struct slgt_info *info); + static bool rx_get_buf(struct slgt_info *info); + + static void tx_start(struct slgt_info *info); + static void tx_stop(struct slgt_info *info); + static void tx_set_idle(struct slgt_info *info); +-static unsigned int free_tbuf_count(struct slgt_info *info); + static unsigned int tbuf_bytes(struct slgt_info *info); + static void reset_tbufs(struct slgt_info *info); + static void tdma_reset(struct slgt_info *info); + static bool tx_load(struct slgt_info *info, const char *buf, unsigned int count); + +-static void get_signals(struct slgt_info *info); +-static void set_signals(struct slgt_info *info); +-static void enable_loopback(struct slgt_info *info); ++static void get_gtsignals(struct slgt_info *info); ++static void set_gtsignals(struct slgt_info *info); + static void set_rate(struct slgt_info *info, u32 data_rate); + +-static int bh_action(struct slgt_info *info); +-static void bh_handler(struct work_struct *work); + static void bh_transmit(struct slgt_info *info); +-static void isr_serial(struct slgt_info *info); +-static void isr_rdma(struct slgt_info *info); + static void isr_txeom(struct slgt_info *info, unsigned short status); +-static void isr_tdma(struct slgt_info *info); +- +-static int alloc_dma_bufs(struct slgt_info *info); +-static void free_dma_bufs(struct slgt_info *info); +-static int alloc_desc(struct slgt_info *info); +-static void free_desc(struct slgt_info *info); +-static int alloc_bufs(struct slgt_info *info, struct slgt_desc *bufs, int count); +-static void free_bufs(struct slgt_info *info, struct slgt_desc *bufs, int count); +- +-static int alloc_tmp_rbuf(struct slgt_info *info); +-static void free_tmp_rbuf(struct slgt_info *info); + + static void tx_timeout(struct timer_list *t); + static void rx_timeout(struct timer_list *t); +@@ -509,10 +461,6 @@ static int tx_abort(struct slgt_info *info); + static int rx_enable(struct slgt_info *info, int enable); + static int modem_input_wait(struct slgt_info *info,int arg); + static int wait_mgsl_event(struct slgt_info *info, int __user *mask_ptr); +-static int tiocmget(struct tty_struct *tty); +-static int tiocmset(struct tty_struct *tty, +- unsigned int set, unsigned int clear); +-static int set_break(struct tty_struct *tty, int break_state); + static int get_interface(struct slgt_info *info, int __user *if_mode); + static int set_interface(struct slgt_info *info, int if_mode); + static int set_gpio(struct slgt_info *info, struct gpio_desc __user *gpio); +@@ -526,9 +474,6 @@ static int set_xctrl(struct slgt_info *info, int if_mode); + /* + * driver functions + */ +-static void add_device(struct slgt_info *info); +-static void device_init(int adapter_num, struct pci_dev *pdev); +-static int claim_resources(struct slgt_info *info); + static void release_resources(struct slgt_info *info); + + /* +@@ -776,7 +721,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) + if ((old_termios->c_cflag & CBAUD) && !C_BAUD(tty)) { + info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); + spin_lock_irqsave(&info->lock,flags); +- set_signals(info); ++ set_gtsignals(info); + spin_unlock_irqrestore(&info->lock,flags); + } + +@@ -786,7 +731,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) + if (!C_CRTSCTS(tty) || !tty_throttled(tty)) + info->signals |= SerialSignal_RTS; + spin_lock_irqsave(&info->lock,flags); +- set_signals(info); ++ set_gtsignals(info); + spin_unlock_irqrestore(&info->lock,flags); + } + +@@ -1237,7 +1182,7 @@ static inline void line_info(struct seq_file *m, struct slgt_info *info) + + /* output current serial signal states */ + spin_lock_irqsave(&info->lock,flags); +- get_signals(info); ++ get_gtsignals(info); + spin_unlock_irqrestore(&info->lock,flags); + + stat_buf[0] = 0; +@@ -1337,7 +1282,7 @@ static void throttle(struct tty_struct * tty) + if (C_CRTSCTS(tty)) { + spin_lock_irqsave(&info->lock,flags); + info->signals &= ~SerialSignal_RTS; +- set_signals(info); ++ set_gtsignals(info); + spin_unlock_irqrestore(&info->lock,flags); + } + } +@@ -1362,7 +1307,7 @@ static void unthrottle(struct tty_struct * tty) + if (C_CRTSCTS(tty)) { + spin_lock_irqsave(&info->lock,flags); + info->signals |= SerialSignal_RTS; +- set_signals(info); ++ set_gtsignals(info); + spin_unlock_irqrestore(&info->lock,flags); + } + } +@@ -1533,7 +1478,7 @@ static int hdlcdev_open(struct net_device *dev) + + /* inform generic HDLC layer of current DCD status */ + spin_lock_irqsave(&info->lock, flags); +- get_signals(info); ++ get_gtsignals(info); + spin_unlock_irqrestore(&info->lock, flags); + if (info->signals & SerialSignal_DCD) + netif_carrier_on(dev); +@@ -2287,7 +2232,7 @@ static void isr_txeom(struct slgt_info *info, unsigned short status) + if (info->params.mode != MGSL_MODE_ASYNC && info->drop_rts_on_tx_done) { + info->signals &= ~SerialSignal_RTS; + info->drop_rts_on_tx_done = false; +- set_signals(info); ++ set_gtsignals(info); + } + + #if SYNCLINK_GENERIC_HDLC +@@ -2452,7 +2397,7 @@ static void shutdown(struct slgt_info *info) + + if (!info->port.tty || info->port.tty->termios.c_cflag & HUPCL) { + info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); +- set_signals(info); ++ set_gtsignals(info); + } + + flush_cond_wait(&info->gpio_wait_q); +@@ -2480,7 +2425,7 @@ static void program_hw(struct slgt_info *info) + else + async_mode(info); + +- set_signals(info); ++ set_gtsignals(info); + + info->dcd_chkcount = 0; + info->cts_chkcount = 0; +@@ -2488,7 +2433,7 @@ static void program_hw(struct slgt_info *info) + info->dsr_chkcount = 0; + + slgt_irq_on(info, IRQ_DCD | IRQ_CTS | IRQ_DSR | IRQ_RI); +- get_signals(info); ++ get_gtsignals(info); + + if (info->netcount || + (info->port.tty && info->port.tty->termios.c_cflag & CREAD)) +@@ -2732,7 +2677,7 @@ static int wait_mgsl_event(struct slgt_info *info, int __user *mask_ptr) + spin_lock_irqsave(&info->lock,flags); + + /* return immediately if state matches requested events */ +- get_signals(info); ++ get_gtsignals(info); + s = info->signals; + + events = mask & +@@ -3150,7 +3095,7 @@ static int tiocmget(struct tty_struct *tty) + unsigned long flags; + + spin_lock_irqsave(&info->lock,flags); +- get_signals(info); ++ get_gtsignals(info); + spin_unlock_irqrestore(&info->lock,flags); + + result = ((info->signals & SerialSignal_RTS) ? TIOCM_RTS:0) + +@@ -3189,7 +3134,7 @@ static int tiocmset(struct tty_struct *tty, + info->signals &= ~SerialSignal_DTR; + + spin_lock_irqsave(&info->lock,flags); +- set_signals(info); ++ set_gtsignals(info); + spin_unlock_irqrestore(&info->lock,flags); + return 0; + } +@@ -3200,7 +3145,7 @@ static int carrier_raised(struct tty_port *port) + struct slgt_info *info = container_of(port, struct slgt_info, port); + + spin_lock_irqsave(&info->lock,flags); +- get_signals(info); ++ get_gtsignals(info); + spin_unlock_irqrestore(&info->lock,flags); + return (info->signals & SerialSignal_DCD) ? 1 : 0; + } +@@ -3215,7 +3160,7 @@ static void dtr_rts(struct tty_port *port, int on) + info->signals |= SerialSignal_RTS | SerialSignal_DTR; + else + info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); +- set_signals(info); ++ set_gtsignals(info); + spin_unlock_irqrestore(&info->lock,flags); + } + +@@ -4018,10 +3963,10 @@ static void tx_start(struct slgt_info *info) + + if (info->params.mode != MGSL_MODE_ASYNC) { + if (info->params.flags & HDLC_FLAG_AUTO_RTS) { +- get_signals(info); ++ get_gtsignals(info); + if (!(info->signals & SerialSignal_RTS)) { + info->signals |= SerialSignal_RTS; +- set_signals(info); ++ set_gtsignals(info); + info->drop_rts_on_tx_done = true; + } + } +@@ -4075,7 +4020,7 @@ static void reset_port(struct slgt_info *info) + rx_stop(info); + + info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); +- set_signals(info); ++ set_gtsignals(info); + + slgt_irq_off(info, IRQ_ALL | IRQ_MASTER); + } +@@ -4497,7 +4442,7 @@ static void tx_set_idle(struct slgt_info *info) + /* + * get state of V24 status (input) signals + */ +-static void get_signals(struct slgt_info *info) ++static void get_gtsignals(struct slgt_info *info) + { + unsigned short status = rd_reg16(info, SSR); + +@@ -4559,7 +4504,7 @@ static void msc_set_vcr(struct slgt_info *info) + /* + * set state of V24 control (output) signals + */ +-static void set_signals(struct slgt_info *info) ++static void set_gtsignals(struct slgt_info *info) + { + unsigned char val = rd_reg8(info, VCR); + if (info->signals & SerialSignal_DTR) +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c +index df5b2d1e2..7748b1335 100644 +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -726,7 +726,8 @@ static void acm_port_destruct(struct tty_port *port) + { + struct acm *acm = container_of(port, struct acm, port); + +- acm_release_minor(acm); ++ if (acm->minor != ACM_MINOR_INVALID) ++ acm_release_minor(acm); + usb_put_intf(acm->control); + kfree(acm->country_codes); + kfree(acm); +@@ -1343,8 +1344,10 @@ static int acm_probe(struct usb_interface *intf, + usb_get_intf(acm->control); /* undone in destruct() */ + + minor = acm_alloc_minor(acm); +- if (minor < 0) ++ if (minor < 0) { ++ acm->minor = ACM_MINOR_INVALID; + goto alloc_fail1; ++ } + + acm->minor = minor; + acm->dev = usb_dev; +diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h +index 8aef5eb76..3aa7f0a3a 100644 +--- a/drivers/usb/class/cdc-acm.h ++++ b/drivers/usb/class/cdc-acm.h +@@ -22,6 +22,8 @@ + #define ACM_TTY_MAJOR 166 + #define ACM_TTY_MINORS 256 + ++#define ACM_MINOR_INVALID ACM_TTY_MINORS ++ + /* + * Requests. + */ +diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c +index 99908d8d2..4bbf3316a 100644 +--- a/drivers/usb/core/hcd.c ++++ b/drivers/usb/core/hcd.c +@@ -2640,6 +2640,7 @@ int usb_add_hcd(struct usb_hcd *hcd, + { + int retval; + struct usb_device *rhdev; ++ struct usb_hcd *shared_hcd; + + if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) { + hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev); +@@ -2796,13 +2797,26 @@ int usb_add_hcd(struct usb_hcd *hcd, + goto err_hcd_driver_start; + } + ++ /* starting here, usbcore will pay attention to the shared HCD roothub */ ++ shared_hcd = hcd->shared_hcd; ++ if (!usb_hcd_is_primary_hcd(hcd) && shared_hcd && HCD_DEFER_RH_REGISTER(shared_hcd)) { ++ retval = register_root_hub(shared_hcd); ++ if (retval != 0) ++ goto err_register_root_hub; ++ ++ if (shared_hcd->uses_new_polling && HCD_POLL_RH(shared_hcd)) ++ usb_hcd_poll_rh_status(shared_hcd); ++ } ++ + /* starting here, usbcore will pay attention to this root hub */ +- retval = register_root_hub(hcd); +- if (retval != 0) +- goto err_register_root_hub; ++ if (!HCD_DEFER_RH_REGISTER(hcd)) { ++ retval = register_root_hub(hcd); ++ if (retval != 0) ++ goto err_register_root_hub; + +- if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) +- usb_hcd_poll_rh_status(hcd); ++ if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) ++ usb_hcd_poll_rh_status(hcd); ++ } + + return retval; + +@@ -2845,6 +2859,7 @@ EXPORT_SYMBOL_GPL(usb_add_hcd); + void usb_remove_hcd(struct usb_hcd *hcd) + { + struct usb_device *rhdev = hcd->self.root_hub; ++ bool rh_registered; + + dev_info(hcd->self.controller, "remove, state %x\n", hcd->state); + +@@ -2855,6 +2870,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) + + dev_dbg(hcd->self.controller, "roothub graceful disconnect\n"); + spin_lock_irq (&hcd_root_hub_lock); ++ rh_registered = hcd->rh_registered; + hcd->rh_registered = 0; + spin_unlock_irq (&hcd_root_hub_lock); + +@@ -2864,7 +2880,8 @@ void usb_remove_hcd(struct usb_hcd *hcd) + cancel_work_sync(&hcd->died_work); + + mutex_lock(&usb_bus_idr_lock); +- usb_disconnect(&rhdev); /* Sets rhdev to NULL */ ++ if (rh_registered) ++ usb_disconnect(&rhdev); /* Sets rhdev to NULL */ + mutex_unlock(&usb_bus_idr_lock); + + /* +diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c +index 593a0027c..831538541 100644 +--- a/drivers/usb/dwc2/gadget.c ++++ b/drivers/usb/dwc2/gadget.c +@@ -134,12 +134,16 @@ static u32 dwc2_hsotg_read_frameno(struct dwc2_hsotg *hsotg) + static inline void dwc2_gadget_incr_frame_num(struct dwc2_hsotg_ep *hs_ep) + { + struct dwc2_hsotg *hsotg = hs_ep->parent; ++ u16 limit = DSTS_SOFFN_LIMIT; + u32 current_frame = dwc2_hsotg_read_frameno(hsotg); + ++ if (hsotg->gadget.speed != USB_SPEED_HIGH) ++ limit >>= 3; ++ + hs_ep->target_frame += hs_ep->interval; +- if (hs_ep->target_frame > DSTS_SOFFN_LIMIT) { ++ if (hs_ep->target_frame > limit) { + hs_ep->frame_overrun = true; +- hs_ep->target_frame &= DSTS_SOFFN_LIMIT; ++ hs_ep->target_frame &= limit; + } else if (current_frame <= hs_ep->target_frame) { + hs_ep->frame_overrun = false; + } +@@ -157,10 +161,16 @@ static inline void dwc2_gadget_incr_frame_num(struct dwc2_hsotg_ep *hs_ep) + */ + static inline void dwc2_gadget_dec_frame_num_by_one(struct dwc2_hsotg_ep *hs_ep) + { ++ struct dwc2_hsotg *hsotg = hs_ep->parent; ++ u16 limit = DSTS_SOFFN_LIMIT; ++ ++ if (hsotg->gadget.speed != USB_SPEED_HIGH) ++ limit >>= 3; ++ + if (hs_ep->target_frame) + hs_ep->target_frame -= 1; + else +- hs_ep->target_frame = DSTS_SOFFN_LIMIT; ++ hs_ep->target_frame = limit; + } + + /** +@@ -1022,6 +1032,12 @@ static void dwc2_gadget_start_isoc_ddma(struct dwc2_hsotg_ep *hs_ep) + dwc2_writel(hsotg, ctrl, depctl); + } + ++static bool dwc2_gadget_target_frame_elapsed(struct dwc2_hsotg_ep *hs_ep); ++static void dwc2_hsotg_complete_request(struct dwc2_hsotg *hsotg, ++ struct dwc2_hsotg_ep *hs_ep, ++ struct dwc2_hsotg_req *hs_req, ++ int result); ++ + /** + * dwc2_hsotg_start_req - start a USB request from an endpoint's queue + * @hsotg: The controller state. +@@ -1174,14 +1190,19 @@ static void dwc2_hsotg_start_req(struct dwc2_hsotg *hsotg, + } + } + +- if (hs_ep->isochronous && hs_ep->interval == 1) { +- hs_ep->target_frame = dwc2_hsotg_read_frameno(hsotg); +- dwc2_gadget_incr_frame_num(hs_ep); +- +- if (hs_ep->target_frame & 0x1) +- ctrl |= DXEPCTL_SETODDFR; +- else +- ctrl |= DXEPCTL_SETEVENFR; ++ if (hs_ep->isochronous) { ++ if (!dwc2_gadget_target_frame_elapsed(hs_ep)) { ++ if (hs_ep->interval == 1) { ++ if (hs_ep->target_frame & 0x1) ++ ctrl |= DXEPCTL_SETODDFR; ++ else ++ ctrl |= DXEPCTL_SETEVENFR; ++ } ++ ctrl |= DXEPCTL_CNAK; ++ } else { ++ dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, -ENODATA); ++ return; ++ } + } + + ctrl |= DXEPCTL_EPENA; /* ensure ep enabled */ +@@ -1329,12 +1350,16 @@ static bool dwc2_gadget_target_frame_elapsed(struct dwc2_hsotg_ep *hs_ep) + u32 target_frame = hs_ep->target_frame; + u32 current_frame = hsotg->frame_number; + bool frame_overrun = hs_ep->frame_overrun; ++ u16 limit = DSTS_SOFFN_LIMIT; ++ ++ if (hsotg->gadget.speed != USB_SPEED_HIGH) ++ limit >>= 3; + + if (!frame_overrun && current_frame >= target_frame) + return true; + + if (frame_overrun && current_frame >= target_frame && +- ((current_frame - target_frame) < DSTS_SOFFN_LIMIT / 2)) ++ ((current_frame - target_frame) < limit / 2)) + return true; + + return false; +@@ -1717,11 +1742,9 @@ static struct dwc2_hsotg_req *get_ep_head(struct dwc2_hsotg_ep *hs_ep) + */ + static void dwc2_gadget_start_next_request(struct dwc2_hsotg_ep *hs_ep) + { +- u32 mask; + struct dwc2_hsotg *hsotg = hs_ep->parent; + int dir_in = hs_ep->dir_in; + struct dwc2_hsotg_req *hs_req; +- u32 epmsk_reg = dir_in ? DIEPMSK : DOEPMSK; + + if (!list_empty(&hs_ep->queue)) { + hs_req = get_ep_head(hs_ep); +@@ -1737,9 +1760,6 @@ static void dwc2_gadget_start_next_request(struct dwc2_hsotg_ep *hs_ep) + } else { + dev_dbg(hsotg->dev, "%s: No more ISOC-OUT requests\n", + __func__); +- mask = dwc2_readl(hsotg, epmsk_reg); +- mask |= DOEPMSK_OUTTKNEPDISMSK; +- dwc2_writel(hsotg, mask, epmsk_reg); + } + } + +@@ -2309,19 +2329,6 @@ static void dwc2_hsotg_ep0_zlp(struct dwc2_hsotg *hsotg, bool dir_in) + dwc2_hsotg_program_zlp(hsotg, hsotg->eps_out[0]); + } + +-static void dwc2_hsotg_change_ep_iso_parity(struct dwc2_hsotg *hsotg, +- u32 epctl_reg) +-{ +- u32 ctrl; +- +- ctrl = dwc2_readl(hsotg, epctl_reg); +- if (ctrl & DXEPCTL_EOFRNUM) +- ctrl |= DXEPCTL_SETEVENFR; +- else +- ctrl |= DXEPCTL_SETODDFR; +- dwc2_writel(hsotg, ctrl, epctl_reg); +-} +- + /* + * dwc2_gadget_get_xfersize_ddma - get transferred bytes amount from desc + * @hs_ep - The endpoint on which transfer went +@@ -2442,20 +2449,11 @@ static void dwc2_hsotg_handle_outdone(struct dwc2_hsotg *hsotg, int epnum) + dwc2_hsotg_ep0_zlp(hsotg, true); + } + +- /* +- * Slave mode OUT transfers do not go through XferComplete so +- * adjust the ISOC parity here. +- */ +- if (!using_dma(hsotg)) { +- if (hs_ep->isochronous && hs_ep->interval == 1) +- dwc2_hsotg_change_ep_iso_parity(hsotg, DOEPCTL(epnum)); +- else if (hs_ep->isochronous && hs_ep->interval > 1) +- dwc2_gadget_incr_frame_num(hs_ep); +- } +- + /* Set actual frame number for completed transfers */ +- if (!using_desc_dma(hsotg) && hs_ep->isochronous) +- req->frame_number = hsotg->frame_number; ++ if (!using_desc_dma(hsotg) && hs_ep->isochronous) { ++ req->frame_number = hs_ep->target_frame; ++ dwc2_gadget_incr_frame_num(hs_ep); ++ } + + dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, result); + } +@@ -2769,6 +2767,12 @@ static void dwc2_hsotg_complete_in(struct dwc2_hsotg *hsotg, + return; + } + ++ /* Set actual frame number for completed transfers */ ++ if (!using_desc_dma(hsotg) && hs_ep->isochronous) { ++ hs_req->req.frame_number = hs_ep->target_frame; ++ dwc2_gadget_incr_frame_num(hs_ep); ++ } ++ + dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, 0); + } + +@@ -2829,23 +2833,18 @@ static void dwc2_gadget_handle_ep_disabled(struct dwc2_hsotg_ep *hs_ep) + + dwc2_hsotg_txfifo_flush(hsotg, hs_ep->fifo_index); + +- if (hs_ep->isochronous) { +- dwc2_hsotg_complete_in(hsotg, hs_ep); +- return; +- } +- + if ((epctl & DXEPCTL_STALL) && (epctl & DXEPCTL_EPTYPE_BULK)) { + int dctl = dwc2_readl(hsotg, DCTL); + + dctl |= DCTL_CGNPINNAK; + dwc2_writel(hsotg, dctl, DCTL); + } +- return; +- } ++ } else { + +- if (dctl & DCTL_GOUTNAKSTS) { +- dctl |= DCTL_CGOUTNAK; +- dwc2_writel(hsotg, dctl, DCTL); ++ if (dctl & DCTL_GOUTNAKSTS) { ++ dctl |= DCTL_CGOUTNAK; ++ dwc2_writel(hsotg, dctl, DCTL); ++ } + } + + if (!hs_ep->isochronous) +@@ -2866,8 +2865,6 @@ static void dwc2_gadget_handle_ep_disabled(struct dwc2_hsotg_ep *hs_ep) + /* Update current frame number value. */ + hsotg->frame_number = dwc2_hsotg_read_frameno(hsotg); + } while (dwc2_gadget_target_frame_elapsed(hs_ep)); +- +- dwc2_gadget_start_next_request(hs_ep); + } + + /** +@@ -2884,8 +2881,8 @@ static void dwc2_gadget_handle_ep_disabled(struct dwc2_hsotg_ep *hs_ep) + static void dwc2_gadget_handle_out_token_ep_disabled(struct dwc2_hsotg_ep *ep) + { + struct dwc2_hsotg *hsotg = ep->parent; ++ struct dwc2_hsotg_req *hs_req; + int dir_in = ep->dir_in; +- u32 doepmsk; + + if (dir_in || !ep->isochronous) + return; +@@ -2899,28 +2896,39 @@ static void dwc2_gadget_handle_out_token_ep_disabled(struct dwc2_hsotg_ep *ep) + return; + } + +- if (ep->interval > 1 && +- ep->target_frame == TARGET_FRAME_INITIAL) { ++ if (ep->target_frame == TARGET_FRAME_INITIAL) { + u32 ctrl; + + ep->target_frame = hsotg->frame_number; +- dwc2_gadget_incr_frame_num(ep); ++ if (ep->interval > 1) { ++ ctrl = dwc2_readl(hsotg, DOEPCTL(ep->index)); ++ if (ep->target_frame & 0x1) ++ ctrl |= DXEPCTL_SETODDFR; ++ else ++ ctrl |= DXEPCTL_SETEVENFR; + +- ctrl = dwc2_readl(hsotg, DOEPCTL(ep->index)); +- if (ep->target_frame & 0x1) +- ctrl |= DXEPCTL_SETODDFR; +- else +- ctrl |= DXEPCTL_SETEVENFR; ++ dwc2_writel(hsotg, ctrl, DOEPCTL(ep->index)); ++ } ++ } + +- dwc2_writel(hsotg, ctrl, DOEPCTL(ep->index)); ++ while (dwc2_gadget_target_frame_elapsed(ep)) { ++ hs_req = get_ep_head(ep); ++ if (hs_req) ++ dwc2_hsotg_complete_request(hsotg, ep, hs_req, -ENODATA); ++ ++ dwc2_gadget_incr_frame_num(ep); ++ /* Update current frame number value. */ ++ hsotg->frame_number = dwc2_hsotg_read_frameno(hsotg); + } + +- dwc2_gadget_start_next_request(ep); +- doepmsk = dwc2_readl(hsotg, DOEPMSK); +- doepmsk &= ~DOEPMSK_OUTTKNEPDISMSK; +- dwc2_writel(hsotg, doepmsk, DOEPMSK); ++ if (!ep->req) ++ dwc2_gadget_start_next_request(ep); ++ + } + ++static void dwc2_hsotg_ep_stop_xfr(struct dwc2_hsotg *hsotg, ++ struct dwc2_hsotg_ep *hs_ep); ++ + /** + * dwc2_gadget_handle_nak - handle NAK interrupt + * @hs_ep: The endpoint on which interrupt is asserted. +@@ -2938,7 +2946,9 @@ static void dwc2_gadget_handle_out_token_ep_disabled(struct dwc2_hsotg_ep *ep) + static void dwc2_gadget_handle_nak(struct dwc2_hsotg_ep *hs_ep) + { + struct dwc2_hsotg *hsotg = hs_ep->parent; ++ struct dwc2_hsotg_req *hs_req; + int dir_in = hs_ep->dir_in; ++ u32 ctrl; + + if (!dir_in || !hs_ep->isochronous) + return; +@@ -2980,13 +2990,29 @@ static void dwc2_gadget_handle_nak(struct dwc2_hsotg_ep *hs_ep) + + dwc2_writel(hsotg, ctrl, DIEPCTL(hs_ep->index)); + } +- +- dwc2_hsotg_complete_request(hsotg, hs_ep, +- get_ep_head(hs_ep), 0); + } + +- if (!using_desc_dma(hsotg)) ++ if (using_desc_dma(hsotg)) ++ return; ++ ++ ctrl = dwc2_readl(hsotg, DIEPCTL(hs_ep->index)); ++ if (ctrl & DXEPCTL_EPENA) ++ dwc2_hsotg_ep_stop_xfr(hsotg, hs_ep); ++ else ++ dwc2_hsotg_txfifo_flush(hsotg, hs_ep->fifo_index); ++ ++ while (dwc2_gadget_target_frame_elapsed(hs_ep)) { ++ hs_req = get_ep_head(hs_ep); ++ if (hs_req) ++ dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, -ENODATA); ++ + dwc2_gadget_incr_frame_num(hs_ep); ++ /* Update current frame number value. */ ++ hsotg->frame_number = dwc2_hsotg_read_frameno(hsotg); ++ } ++ ++ if (!hs_ep->req) ++ dwc2_gadget_start_next_request(hs_ep); + } + + /** +@@ -3042,21 +3068,15 @@ static void dwc2_hsotg_epint(struct dwc2_hsotg *hsotg, unsigned int idx, + + /* In DDMA handle isochronous requests separately */ + if (using_desc_dma(hsotg) && hs_ep->isochronous) { +- /* XferCompl set along with BNA */ +- if (!(ints & DXEPINT_BNAINTR)) +- dwc2_gadget_complete_isoc_request_ddma(hs_ep); ++ dwc2_gadget_complete_isoc_request_ddma(hs_ep); + } else if (dir_in) { + /* + * We get OutDone from the FIFO, so we only + * need to look at completing IN requests here + * if operating slave mode + */ +- if (hs_ep->isochronous && hs_ep->interval > 1) +- dwc2_gadget_incr_frame_num(hs_ep); +- +- dwc2_hsotg_complete_in(hsotg, hs_ep); +- if (ints & DXEPINT_NAKINTRPT) +- ints &= ~DXEPINT_NAKINTRPT; ++ if (!hs_ep->isochronous || !(ints & DXEPINT_NAKINTRPT)) ++ dwc2_hsotg_complete_in(hsotg, hs_ep); + + if (idx == 0 && !hs_ep->req) + dwc2_hsotg_enqueue_setup(hsotg); +@@ -3065,10 +3085,8 @@ static void dwc2_hsotg_epint(struct dwc2_hsotg *hsotg, unsigned int idx, + * We're using DMA, we need to fire an OutDone here + * as we ignore the RXFIFO. + */ +- if (hs_ep->isochronous && hs_ep->interval > 1) +- dwc2_gadget_incr_frame_num(hs_ep); +- +- dwc2_hsotg_handle_outdone(hsotg, idx); ++ if (!hs_ep->isochronous || !(ints & DXEPINT_OUTTKNEPDIS)) ++ dwc2_hsotg_handle_outdone(hsotg, idx); + } + } + +@@ -4087,6 +4105,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, + mask |= DIEPMSK_NAKMSK; + dwc2_writel(hsotg, mask, DIEPMSK); + } else { ++ epctrl |= DXEPCTL_SNAK; + mask = dwc2_readl(hsotg, DOEPMSK); + mask |= DOEPMSK_OUTTKNEPDISMSK; + dwc2_writel(hsotg, mask, DOEPMSK); +diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c +index 9a00a2c7b..27d7bd1c9 100644 +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -294,19 +294,6 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc) + { + u32 reg; + int retries = 1000; +- int ret; +- +- usb_phy_init(dwc->usb2_phy); +- usb_phy_init(dwc->usb3_phy); +- ret = phy_init(dwc->usb2_generic_phy); +- if (ret < 0) +- return ret; +- +- ret = phy_init(dwc->usb3_generic_phy); +- if (ret < 0) { +- phy_exit(dwc->usb2_generic_phy); +- return ret; +- } + + /* + * We're resetting only the device side because, if we're in host mode, +@@ -340,9 +327,6 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc) + udelay(1); + } while (--retries); + +- phy_exit(dwc->usb3_generic_phy); +- phy_exit(dwc->usb2_generic_phy); +- + return -ETIMEDOUT; + + done: +@@ -1012,9 +996,21 @@ static int dwc3_core_init(struct dwc3 *dwc) + dwc->phys_ready = true; + } + ++ usb_phy_init(dwc->usb2_phy); ++ usb_phy_init(dwc->usb3_phy); ++ ret = phy_init(dwc->usb2_generic_phy); ++ if (ret < 0) ++ goto err0a; ++ ++ ret = phy_init(dwc->usb3_generic_phy); ++ if (ret < 0) { ++ phy_exit(dwc->usb2_generic_phy); ++ goto err0a; ++ } ++ + ret = dwc3_core_soft_reset(dwc); + if (ret) +- goto err0a; ++ goto err1; + + if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD && + !DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) { +diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c +index 65cae4883..38e4d6b50 100644 +--- a/drivers/usb/gadget/udc/r8a66597-udc.c ++++ b/drivers/usb/gadget/udc/r8a66597-udc.c +@@ -1250,7 +1250,7 @@ static void set_feature(struct r8a66597 *r8a66597, struct usb_ctrlrequest *ctrl) + do { + tmp = r8a66597_read(r8a66597, INTSTS0) & CTSQ; + udelay(1); +- } while (tmp != CS_IDST || timeout-- > 0); ++ } while (tmp != CS_IDST && timeout-- > 0); + + if (tmp == CS_IDST) + r8a66597_bset(r8a66597, +diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c +index 337b425dd..2df52f75f 100644 +--- a/drivers/usb/host/bcma-hcd.c ++++ b/drivers/usb/host/bcma-hcd.c +@@ -406,12 +406,9 @@ static int bcma_hcd_probe(struct bcma_device *core) + return -ENOMEM; + usb_dev->core = core; + +- if (core->dev.of_node) { ++ if (core->dev.of_node) + usb_dev->gpio_desc = devm_gpiod_get(&core->dev, "vcc", + GPIOD_OUT_HIGH); +- if (IS_ERR(usb_dev->gpio_desc)) +- return PTR_ERR(usb_dev->gpio_desc); +- } + + switch (core->id.id) { + case BCMA_CORE_USB20_HOST: +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c +index 2b844d186..853238190 100644 +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -692,6 +692,7 @@ int xhci_run(struct usb_hcd *hcd) + if (ret) + xhci_free_command(xhci, command); + } ++ set_bit(HCD_FLAG_DEFER_RH_REGISTER, &hcd->flags); + xhci_dbg_trace(xhci, trace_xhci_dbg_init, + "Finished xhci_run for USB2 roothub"); + +diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c +index c26683a27..0c2afed41 100644 +--- a/drivers/usb/musb/tusb6010.c ++++ b/drivers/usb/musb/tusb6010.c +@@ -190,6 +190,7 @@ tusb_fifo_write_unaligned(void __iomem *fifo, const u8 *buf, u16 len) + } + if (len > 0) { + /* Write the rest 1 - 3 bytes to FIFO */ ++ val = 0; + memcpy(&val, buf, len); + musb_writel(fifo, 0, val); + } +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c +index 329fc25f7..6d858bdaf 100644 +--- a/drivers/usb/serial/cp210x.c ++++ b/drivers/usb/serial/cp210x.c +@@ -237,6 +237,7 @@ static const struct usb_device_id id_table[] = { + { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ + { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ + { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ ++ { USB_DEVICE(0x2184, 0x0030) }, /* GW Instek GDM-834x Digital Multimeter */ + { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */ + { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ + { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ +@@ -260,6 +261,7 @@ struct cp210x_serial_private { + speed_t min_speed; + speed_t max_speed; + bool use_actual_rate; ++ bool no_event_mode; + }; + + enum cp210x_event_state { +@@ -1331,12 +1333,16 @@ static void cp210x_change_speed(struct tty_struct *tty, + + static void cp210x_enable_event_mode(struct usb_serial_port *port) + { ++ struct cp210x_serial_private *priv = usb_get_serial_data(port->serial); + struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); + int ret; + + if (port_priv->event_mode) + return; + ++ if (priv->no_event_mode) ++ return; ++ + port_priv->event_state = ES_DATA; + port_priv->event_mode = true; + +@@ -2086,6 +2092,46 @@ static void cp210x_init_max_speed(struct usb_serial *serial) + priv->use_actual_rate = use_actual_rate; + } + ++static void cp2102_determine_quirks(struct usb_serial *serial) ++{ ++ struct cp210x_serial_private *priv = usb_get_serial_data(serial); ++ u8 *buf; ++ int ret; ++ ++ buf = kmalloc(2, GFP_KERNEL); ++ if (!buf) ++ return; ++ /* ++ * Some (possibly counterfeit) CP2102 do not support event-insertion ++ * mode and respond differently to malformed vendor requests. ++ * Specifically, they return one instead of two bytes when sent a ++ * two-byte part-number request. ++ */ ++ ret = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), ++ CP210X_VENDOR_SPECIFIC, REQTYPE_DEVICE_TO_HOST, ++ CP210X_GET_PARTNUM, 0, buf, 2, USB_CTRL_GET_TIMEOUT); ++ if (ret == 1) { ++ dev_dbg(&serial->interface->dev, ++ "device does not support event-insertion mode\n"); ++ priv->no_event_mode = true; ++ } ++ ++ kfree(buf); ++} ++ ++static void cp210x_determine_quirks(struct usb_serial *serial) ++{ ++ struct cp210x_serial_private *priv = usb_get_serial_data(serial); ++ ++ switch (priv->partnum) { ++ case CP210X_PARTNUM_CP2102: ++ cp2102_determine_quirks(serial); ++ break; ++ default: ++ break; ++ } ++} ++ + static int cp210x_attach(struct usb_serial *serial) + { + int result; +@@ -2106,6 +2152,7 @@ static int cp210x_attach(struct usb_serial *serial) + + usb_set_serial_data(serial, priv); + ++ cp210x_determine_quirks(serial); + cp210x_init_max_speed(serial); + + result = cp210x_gpio_init(serial); +diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c +index 30c25ef0d..48a9a0476 100644 +--- a/drivers/usb/serial/mos7840.c ++++ b/drivers/usb/serial/mos7840.c +@@ -107,7 +107,6 @@ + #define BANDB_DEVICE_ID_USOPTL4_2P 0xBC02 + #define BANDB_DEVICE_ID_USOPTL4_4 0xAC44 + #define BANDB_DEVICE_ID_USOPTL4_4P 0xBC03 +-#define BANDB_DEVICE_ID_USOPTL2_4 0xAC24 + + /* Interrupt Routine Defines */ + +@@ -186,7 +185,6 @@ static const struct usb_device_id id_table[] = { + { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2P) }, + { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4) }, + { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4P) }, +- { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4) }, + {} /* terminating entry */ + }; + MODULE_DEVICE_TABLE(usb, id_table); +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c +index acb8eec14..1e990a826 100644 +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -1205,6 +1205,14 @@ static const struct usb_device_id option_ids[] = { + .driver_info = NCTRL(0) | RSVD(1) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1056, 0xff), /* Telit FD980 */ + .driver_info = NCTRL(2) | RSVD(3) }, ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1060, 0xff), /* Telit LN920 (rmnet) */ ++ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1061, 0xff), /* Telit LN920 (MBIM) */ ++ .driver_info = NCTRL(0) | RSVD(1) }, ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1062, 0xff), /* Telit LN920 (RNDIS) */ ++ .driver_info = NCTRL(2) | RSVD(3) }, ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1063, 0xff), /* Telit LN920 (ECM) */ ++ .driver_info = NCTRL(0) | RSVD(1) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), + .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), +@@ -1650,7 +1658,6 @@ static const struct usb_device_id option_ids[] = { + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0060, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff), + .driver_info = RSVD(1) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0133, 0xff, 0xff, 0xff), +@@ -2068,6 +2075,8 @@ static const struct usb_device_id option_ids[] = { + .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, + { USB_DEVICE(0x0489, 0xe0b5), /* Foxconn T77W968 ESIM */ + .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, ++ { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe0db, 0xff), /* Foxconn T99W265 MBIM */ ++ .driver_info = RSVD(3) }, + { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */ + .driver_info = RSVD(4) | RSVD(5) | RSVD(6) }, + { USB_DEVICE(0x2cb7, 0x0104), /* Fibocom NL678 series */ +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h +index b0d7c77e4..5b2373962 100644 +--- a/drivers/usb/storage/unusual_devs.h ++++ b/drivers/usb/storage/unusual_devs.h +@@ -416,9 +416,16 @@ UNUSUAL_DEV( 0x04cb, 0x0100, 0x0000, 0x2210, + USB_SC_UFI, USB_PR_DEVICE, NULL, US_FL_FIX_INQUIRY | US_FL_SINGLE_LUN), + + /* +- * Reported by Ondrej Zary ++ * Reported by Ondrej Zary + * The device reports one sector more and breaks when that sector is accessed ++ * Firmwares older than 2.6c (the latest one and the only that claims Linux ++ * support) have also broken tag handling + */ ++UNUSUAL_DEV( 0x04ce, 0x0002, 0x0000, 0x026b, ++ "ScanLogic", ++ "SL11R-IDE", ++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, ++ US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG), + UNUSUAL_DEV( 0x04ce, 0x0002, 0x026c, 0x026c, + "ScanLogic", + "SL11R-IDE", +diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h +index 2227a8241..1fcb871c6 100644 +--- a/drivers/usb/storage/unusual_uas.h ++++ b/drivers/usb/storage/unusual_uas.h +@@ -50,7 +50,7 @@ UNUSUAL_DEV(0x059f, 0x1061, 0x0000, 0x9999, + "LaCie", + "Rugged USB3-FW", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, +- US_FL_IGNORE_UAS), ++ US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME), + + /* + * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI +diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c +index b57b2067e..15d4b1ef1 100644 +--- a/drivers/xen/balloon.c ++++ b/drivers/xen/balloon.c +@@ -43,6 +43,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -115,7 +117,7 @@ static struct ctl_table xen_root[] = { + #define EXTENT_ORDER (fls(XEN_PFN_PER_PAGE) - 1) + + /* +- * balloon_process() state: ++ * balloon_thread() state: + * + * BP_DONE: done or nothing to do, + * BP_WAIT: wait to be rescheduled, +@@ -130,6 +132,8 @@ enum bp_state { + BP_ECANCELED + }; + ++/* Main waiting point for xen-balloon thread. */ ++static DECLARE_WAIT_QUEUE_HEAD(balloon_thread_wq); + + static DEFINE_MUTEX(balloon_mutex); + +@@ -144,10 +148,6 @@ static xen_pfn_t frame_list[PAGE_SIZE / sizeof(xen_pfn_t)]; + static LIST_HEAD(ballooned_pages); + static DECLARE_WAIT_QUEUE_HEAD(balloon_wq); + +-/* Main work function, always executed in process context. */ +-static void balloon_process(struct work_struct *work); +-static DECLARE_DELAYED_WORK(balloon_worker, balloon_process); +- + /* When ballooning out (allocating memory to return to Xen) we don't really + want the kernel to try too hard since that can trigger the oom killer. */ + #define GFP_BALLOON \ +@@ -366,7 +366,7 @@ static void xen_online_page(struct page *page, unsigned int order) + static int xen_memory_notifier(struct notifier_block *nb, unsigned long val, void *v) + { + if (val == MEM_ONLINE) +- schedule_delayed_work(&balloon_worker, 0); ++ wake_up(&balloon_thread_wq); + + return NOTIFY_OK; + } +@@ -491,18 +491,43 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) + } + + /* +- * As this is a work item it is guaranteed to run as a single instance only. ++ * Stop waiting if either state is not BP_EAGAIN and ballooning action is ++ * needed, or if the credit has changed while state is BP_EAGAIN. ++ */ ++static bool balloon_thread_cond(enum bp_state state, long credit) ++{ ++ if (state != BP_EAGAIN) ++ credit = 0; ++ ++ return current_credit() != credit || kthread_should_stop(); ++} ++ ++/* ++ * As this is a kthread it is guaranteed to run as a single instance only. + * We may of course race updates of the target counts (which are protected + * by the balloon lock), or with changes to the Xen hard limit, but we will + * recover from these in time. + */ +-static void balloon_process(struct work_struct *work) ++static int balloon_thread(void *unused) + { + enum bp_state state = BP_DONE; + long credit; ++ unsigned long timeout; ++ ++ set_freezable(); ++ for (;;) { ++ if (state == BP_EAGAIN) ++ timeout = balloon_stats.schedule_delay * HZ; ++ else ++ timeout = 3600 * HZ; ++ credit = current_credit(); + ++ wait_event_freezable_timeout(balloon_thread_wq, ++ balloon_thread_cond(state, credit), timeout); ++ ++ if (kthread_should_stop()) ++ return 0; + +- do { + mutex_lock(&balloon_mutex); + + credit = current_credit(); +@@ -529,12 +554,7 @@ static void balloon_process(struct work_struct *work) + mutex_unlock(&balloon_mutex); + + cond_resched(); +- +- } while (credit && state == BP_DONE); +- +- /* Schedule more work if there is some still to be done. */ +- if (state == BP_EAGAIN) +- schedule_delayed_work(&balloon_worker, balloon_stats.schedule_delay * HZ); ++ } + } + + /* Resets the Xen limit, sets new target, and kicks off processing. */ +@@ -542,7 +562,7 @@ void balloon_set_new_target(unsigned long target) + { + /* No need for lock. Not read-modify-write updates. */ + balloon_stats.target_pages = target; +- schedule_delayed_work(&balloon_worker, 0); ++ wake_up(&balloon_thread_wq); + } + EXPORT_SYMBOL_GPL(balloon_set_new_target); + +@@ -647,7 +667,7 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) + + /* The balloon may be too large now. Shrink it if needed. */ + if (current_credit()) +- schedule_delayed_work(&balloon_worker, 0); ++ wake_up(&balloon_thread_wq); + + mutex_unlock(&balloon_mutex); + } +@@ -679,6 +699,8 @@ static void __init balloon_add_region(unsigned long start_pfn, + + static int __init balloon_init(void) + { ++ struct task_struct *task; ++ + if (!xen_domain()) + return -ENODEV; + +@@ -722,6 +744,12 @@ static int __init balloon_init(void) + } + #endif + ++ task = kthread_run(balloon_thread, NULL, "xen-balloon"); ++ if (IS_ERR(task)) { ++ pr_err("xen-balloon thread could not be started, ballooning will not work!\n"); ++ return PTR_ERR(task); ++ } ++ + /* Init the xen-balloon driver. */ + xen_balloon_init(); + +diff --git a/fs/afs/dir.c b/fs/afs/dir.c +index 92d7fd743..262c0ae50 100644 +--- a/fs/afs/dir.c ++++ b/fs/afs/dir.c +@@ -997,9 +997,9 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, + */ + static int afs_d_revalidate_rcu(struct dentry *dentry) + { +- struct afs_vnode *dvnode, *vnode; ++ struct afs_vnode *dvnode; + struct dentry *parent; +- struct inode *dir, *inode; ++ struct inode *dir; + long dir_version, de_version; + + _enter("%p", dentry); +@@ -1029,18 +1029,6 @@ static int afs_d_revalidate_rcu(struct dentry *dentry) + return -ECHILD; + } + +- /* Check to see if the vnode referred to by the dentry still +- * has a callback. +- */ +- if (d_really_is_positive(dentry)) { +- inode = d_inode_rcu(dentry); +- if (inode) { +- vnode = AFS_FS_I(inode); +- if (!afs_check_validity(vnode)) +- return -ECHILD; +- } +- } +- + return 1; /* Still valid */ + } + +@@ -1076,17 +1064,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) + if (IS_ERR(key)) + key = NULL; + +- if (d_really_is_positive(dentry)) { +- inode = d_inode(dentry); +- if (inode) { +- vnode = AFS_FS_I(inode); +- afs_validate(vnode, key); +- if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) +- goto out_bad; +- } +- } +- +- /* lock down the parent dentry so we can peer at it */ ++ /* Hold the parent dentry so we can peer at it */ + parent = dget_parent(dentry); + dir = AFS_FS_I(d_inode(parent)); + +@@ -1095,7 +1073,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) + + if (test_bit(AFS_VNODE_DELETED, &dir->flags)) { + _debug("%pd: parent dir deleted", dentry); +- goto out_bad_parent; ++ goto not_found; + } + + /* We only need to invalidate a dentry if the server's copy changed +@@ -1121,12 +1099,12 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) + case 0: + /* the filename maps to something */ + if (d_really_is_negative(dentry)) +- goto out_bad_parent; ++ goto not_found; + inode = d_inode(dentry); + if (is_bad_inode(inode)) { + printk("kAFS: afs_d_revalidate: %pd2 has bad inode\n", + dentry); +- goto out_bad_parent; ++ goto not_found; + } + + vnode = AFS_FS_I(inode); +@@ -1148,9 +1126,6 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) + dentry, fid.unique, + vnode->fid.unique, + vnode->vfs_inode.i_generation); +- write_seqlock(&vnode->cb_lock); +- set_bit(AFS_VNODE_DELETED, &vnode->flags); +- write_sequnlock(&vnode->cb_lock); + goto not_found; + } + goto out_valid; +@@ -1165,7 +1140,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) + default: + _debug("failed to iterate dir %pd: %d", + parent, ret); +- goto out_bad_parent; ++ goto not_found; + } + + out_valid: +@@ -1176,16 +1151,9 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) + _leave(" = 1 [valid]"); + return 1; + +- /* the dirent, if it exists, now points to a different vnode */ + not_found: +- spin_lock(&dentry->d_lock); +- dentry->d_flags |= DCACHE_NFSFS_RENAMED; +- spin_unlock(&dentry->d_lock); +- +-out_bad_parent: + _debug("dropping dentry %pd2", dentry); + dput(parent); +-out_bad: + key_put(key); + + _leave(" = 0 [bad]"); +diff --git a/fs/afs/dir_edit.c b/fs/afs/dir_edit.c +index 2ffe09aba..3a9cffc08 100644 +--- a/fs/afs/dir_edit.c ++++ b/fs/afs/dir_edit.c +@@ -264,7 +264,7 @@ void afs_edit_dir_add(struct afs_vnode *vnode, + if (b == nr_blocks) { + _debug("init %u", b); + afs_edit_init_block(meta, block, b); +- i_size_write(&vnode->vfs_inode, (b + 1) * AFS_DIR_BLOCK_SIZE); ++ afs_set_i_size(vnode, (b + 1) * AFS_DIR_BLOCK_SIZE); + } + + /* Only lower dir pages have a counter in the header. */ +@@ -297,7 +297,7 @@ void afs_edit_dir_add(struct afs_vnode *vnode, + new_directory: + afs_edit_init_block(meta, meta, 0); + i_size = AFS_DIR_BLOCK_SIZE; +- i_size_write(&vnode->vfs_inode, i_size); ++ afs_set_i_size(vnode, i_size); + slot = AFS_DIR_RESV_BLOCKS0; + page = page0; + block = meta; +diff --git a/fs/afs/inode.c b/fs/afs/inode.c +index ae3016a9f..f81a972bd 100644 +--- a/fs/afs/inode.c ++++ b/fs/afs/inode.c +@@ -53,16 +53,6 @@ static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *paren + dump_stack(); + } + +-/* +- * Set the file size and block count. Estimate the number of 512 bytes blocks +- * used, rounded up to nearest 1K for consistency with other AFS clients. +- */ +-static void afs_set_i_size(struct afs_vnode *vnode, u64 size) +-{ +- i_size_write(&vnode->vfs_inode, size); +- vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1; +-} +- + /* + * Initialise an inode from the vnode status. + */ +diff --git a/fs/afs/internal.h b/fs/afs/internal.h +index ffe318ad2..dc08a3d9b 100644 +--- a/fs/afs/internal.h ++++ b/fs/afs/internal.h +@@ -1573,6 +1573,16 @@ static inline void afs_update_dentry_version(struct afs_operation *op, + (void *)(unsigned long)dir_vp->scb.status.data_version; + } + ++/* ++ * Set the file size and block count. Estimate the number of 512 bytes blocks ++ * used, rounded up to nearest 1K for consistency with other AFS clients. ++ */ ++static inline void afs_set_i_size(struct afs_vnode *vnode, u64 size) ++{ ++ i_size_write(&vnode->vfs_inode, size); ++ vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1; ++} ++ + /* + * Check for a conflicting operation on a directory that we just unlinked from. + * If someone managed to sneak a link or an unlink in on the file we just +diff --git a/fs/afs/write.c b/fs/afs/write.c +index d37b5cfcf..be60cf110 100644 +--- a/fs/afs/write.c ++++ b/fs/afs/write.c +@@ -184,7 +184,7 @@ int afs_write_end(struct file *file, struct address_space *mapping, + write_seqlock(&vnode->cb_lock); + i_size = i_size_read(&vnode->vfs_inode); + if (maybe_i_size > i_size) +- i_size_write(&vnode->vfs_inode, maybe_i_size); ++ afs_set_i_size(vnode, maybe_i_size); + write_sequnlock(&vnode->cb_lock); + } + +diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c +index 9d33bf015..e65d0fabb 100644 +--- a/fs/btrfs/raid56.c ++++ b/fs/btrfs/raid56.c +@@ -1646,7 +1646,8 @@ struct btrfs_plug_cb { + /* + * rbios on the plug list are sorted for easier merging. + */ +-static int plug_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int plug_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct btrfs_raid_bio *ra = container_of(a, struct btrfs_raid_bio, + plug_list); +diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c +index e8347461c..69ab10c92 100644 +--- a/fs/btrfs/space-info.c ++++ b/fs/btrfs/space-info.c +@@ -417,9 +417,10 @@ static void __btrfs_dump_space_info(struct btrfs_fs_info *fs_info, + { + lockdep_assert_held(&info->lock); + +- btrfs_info(fs_info, "space_info %llu has %llu free, is %sfull", ++ /* The free space could be negative in case of overcommit */ ++ btrfs_info(fs_info, "space_info %llu has %lld free, is %sfull", + info->flags, +- info->total_bytes - btrfs_space_info_used(info, true), ++ (s64)(info->total_bytes - btrfs_space_info_used(info, true)), + info->full ? "" : "not "); + btrfs_info(fs_info, + "space_info total=%llu, used=%llu, pinned=%llu, reserved=%llu, may_use=%llu, readonly=%llu", +diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c +index ec25e5eab..7bf3936ac 100644 +--- a/fs/btrfs/tree-log.c ++++ b/fs/btrfs/tree-log.c +@@ -4070,7 +4070,8 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, + return ret; + } + +-static int extent_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int extent_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct extent_map *em1, *em2; + +diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c +index 509811aab..d8b8764f5 100644 +--- a/fs/btrfs/volumes.c ++++ b/fs/btrfs/volumes.c +@@ -1226,7 +1226,8 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices, + return 0; + } + +-static int devid_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int devid_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct btrfs_device *dev1, *dev2; + +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c +index 8ffe8063e..7f5d17376 100644 +--- a/fs/cifs/connect.c ++++ b/fs/cifs/connect.c +@@ -3504,9 +3504,10 @@ cifs_match_super(struct super_block *sb, void *data) + spin_lock(&cifs_tcp_ses_lock); + cifs_sb = CIFS_SB(sb); + tlink = cifs_get_tlink(cifs_sb_master_tlink(cifs_sb)); +- if (IS_ERR(tlink)) { ++ if (tlink == NULL) { ++ /* can not match superblock if tlink were ever null */ + spin_unlock(&cifs_tcp_ses_lock); +- return rc; ++ return 0; + } + tcon = tlink_tcon(tlink); + ses = tcon->ses; +diff --git a/fs/cifs/file.c b/fs/cifs/file.c +index f46904a4e..67139f9d5 100644 +--- a/fs/cifs/file.c ++++ b/fs/cifs/file.c +@@ -3039,7 +3039,7 @@ static void collect_uncached_write_data(struct cifs_aio_ctx *ctx) + struct cifs_tcon *tcon; + struct cifs_sb_info *cifs_sb; + struct dentry *dentry = ctx->cfile->dentry; +- int rc; ++ ssize_t rc; + + tcon = tlink_tcon(ctx->cfile->tlink); + cifs_sb = CIFS_SB(dentry->d_sb); +diff --git a/fs/ext4/fsmap.c b/fs/ext4/fsmap.c +index 4c2a9fe30..4493ef0c7 100644 +--- a/fs/ext4/fsmap.c ++++ b/fs/ext4/fsmap.c +@@ -354,8 +354,8 @@ static unsigned int ext4_getfsmap_find_sb(struct super_block *sb, + + /* Compare two fsmap items. */ + static int ext4_getfsmap_compare(void *priv, +- struct list_head *a, +- struct list_head *b) ++ const struct list_head *a, ++ const struct list_head *b) + { + struct ext4_fsmap *fa; + struct ext4_fsmap *fb; +diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c +index cd43c481d..03c3407c8 100644 +--- a/fs/gfs2/glock.c ++++ b/fs/gfs2/glock.c +@@ -1744,7 +1744,8 @@ void gfs2_glock_complete(struct gfs2_glock *gl, int ret) + spin_unlock(&gl->gl_lockref.lock); + } + +-static int glock_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int glock_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct gfs2_glock *gla, *glb; + +diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c +index 1955dea99..7473b894e 100644 +--- a/fs/gfs2/log.c ++++ b/fs/gfs2/log.c +@@ -605,7 +605,7 @@ void log_flush_wait(struct gfs2_sbd *sdp) + } + } + +-static int ip_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int ip_cmp(void *priv, const struct list_head *a, const struct list_head *b) + { + struct gfs2_inode *ipa, *ipb; + +diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c +index 3922b2626..383ac2190 100644 +--- a/fs/gfs2/lops.c ++++ b/fs/gfs2/lops.c +@@ -627,7 +627,8 @@ static void gfs2_check_magic(struct buffer_head *bh) + kunmap_atomic(kaddr); + } + +-static int blocknr_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int blocknr_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct gfs2_bufdata *bda, *bdb; + +diff --git a/fs/io_uring.c b/fs/io_uring.c +index a8d07273d..26753d0cb 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -4041,7 +4041,7 @@ static int io_add_buffers(struct io_provide_buf *pbuf, struct io_buffer **head) + int i, bid = pbuf->bid; + + for (i = 0; i < pbuf->nbufs; i++) { +- buf = kmalloc(sizeof(*buf), GFP_KERNEL); ++ buf = kmalloc(sizeof(*buf), GFP_KERNEL_ACCOUNT); + if (!buf) + break; + +diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c +index caed9d98c..cd9f7baa5 100644 +--- a/fs/iomap/buffered-io.c ++++ b/fs/iomap/buffered-io.c +@@ -1155,7 +1155,8 @@ iomap_ioend_try_merge(struct iomap_ioend *ioend, struct list_head *more_ioends, + EXPORT_SYMBOL_GPL(iomap_ioend_try_merge); + + static int +-iomap_ioend_compare(void *priv, struct list_head *a, struct list_head *b) ++iomap_ioend_compare(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct iomap_ioend *ia = container_of(a, struct iomap_ioend, io_list); + struct iomap_ioend *ib = container_of(b, struct iomap_ioend, io_list); +diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c +index 8e3a36908..3e06e9a8c 100644 +--- a/fs/ocfs2/dlmglue.c ++++ b/fs/ocfs2/dlmglue.c +@@ -3933,7 +3933,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, + oi = OCFS2_I(inode); + oi->ip_dir_lock_gen++; + mlog(0, "generation: %u\n", oi->ip_dir_lock_gen); +- goto out; ++ goto out_forget; + } + + if (!S_ISREG(inode->i_mode)) +@@ -3964,6 +3964,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, + filemap_fdatawait(mapping); + } + ++out_forget: + forget_all_cached_acls(inode); + + out: +diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c +index a6ee23aad..66645a5a3 100644 +--- a/fs/qnx4/dir.c ++++ b/fs/qnx4/dir.c +@@ -15,13 +15,48 @@ + #include + #include "qnx4.h" + ++/* ++ * A qnx4 directory entry is an inode entry or link info ++ * depending on the status field in the last byte. The ++ * first byte is where the name start either way, and a ++ * zero means it's empty. ++ * ++ * Also, due to a bug in gcc, we don't want to use the ++ * real (differently sized) name arrays in the inode and ++ * link entries, but always the 'de_name[]' one in the ++ * fake struct entry. ++ * ++ * See ++ * ++ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c6 ++ * ++ * for details, but basically gcc will take the size of the ++ * 'name' array from one of the used union entries randomly. ++ * ++ * This use of 'de_name[]' (48 bytes) avoids the false positive ++ * warnings that would happen if gcc decides to use 'inode.di_name' ++ * (16 bytes) even when the pointer and size were to come from ++ * 'link.dl_name' (48 bytes). ++ * ++ * In all cases the actual name pointer itself is the same, it's ++ * only the gcc internal 'what is the size of this field' logic ++ * that can get confused. ++ */ ++union qnx4_directory_entry { ++ struct { ++ const char de_name[48]; ++ u8 de_pad[15]; ++ u8 de_status; ++ }; ++ struct qnx4_inode_entry inode; ++ struct qnx4_link_info link; ++}; ++ + static int qnx4_readdir(struct file *file, struct dir_context *ctx) + { + struct inode *inode = file_inode(file); + unsigned int offset; + struct buffer_head *bh; +- struct qnx4_inode_entry *de; +- struct qnx4_link_info *le; + unsigned long blknum; + int ix, ino; + int size; +@@ -38,27 +73,27 @@ static int qnx4_readdir(struct file *file, struct dir_context *ctx) + } + ix = (ctx->pos >> QNX4_DIR_ENTRY_SIZE_BITS) % QNX4_INODES_PER_BLOCK; + for (; ix < QNX4_INODES_PER_BLOCK; ix++, ctx->pos += QNX4_DIR_ENTRY_SIZE) { ++ union qnx4_directory_entry *de; ++ + offset = ix * QNX4_DIR_ENTRY_SIZE; +- de = (struct qnx4_inode_entry *) (bh->b_data + offset); +- if (!de->di_fname[0]) ++ de = (union qnx4_directory_entry *) (bh->b_data + offset); ++ ++ if (!de->de_name[0]) + continue; +- if (!(de->di_status & (QNX4_FILE_USED|QNX4_FILE_LINK))) ++ if (!(de->de_status & (QNX4_FILE_USED|QNX4_FILE_LINK))) + continue; +- if (!(de->di_status & QNX4_FILE_LINK)) +- size = QNX4_SHORT_NAME_MAX; +- else +- size = QNX4_NAME_MAX; +- size = strnlen(de->di_fname, size); +- QNX4DEBUG((KERN_INFO "qnx4_readdir:%.*s\n", size, de->di_fname)); +- if (!(de->di_status & QNX4_FILE_LINK)) ++ if (!(de->de_status & QNX4_FILE_LINK)) { ++ size = sizeof(de->inode.di_fname); + ino = blknum * QNX4_INODES_PER_BLOCK + ix - 1; +- else { +- le = (struct qnx4_link_info*)de; +- ino = ( le32_to_cpu(le->dl_inode_blk) - 1 ) * ++ } else { ++ size = sizeof(de->link.dl_fname); ++ ino = ( le32_to_cpu(de->link.dl_inode_blk) - 1 ) * + QNX4_INODES_PER_BLOCK + +- le->dl_inode_ndx; ++ de->link.dl_inode_ndx; + } +- if (!dir_emit(ctx, de->di_fname, size, ino, DT_UNKNOWN)) { ++ size = strnlen(de->de_name, size); ++ QNX4DEBUG((KERN_INFO "qnx4_readdir:%.*s\n", size, name)); ++ if (!dir_emit(ctx, de->de_name, size, ino, DT_UNKNOWN)) { + brelse(bh); + return 0; + } +diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c +index a4aaeea63..dc3e26e9e 100644 +--- a/fs/ubifs/gc.c ++++ b/fs/ubifs/gc.c +@@ -102,7 +102,8 @@ static int switch_gc_head(struct ubifs_info *c) + * This function compares data nodes @a and @b. Returns %1 if @a has greater + * inode or block number, and %-1 otherwise. + */ +-static int data_nodes_cmp(void *priv, struct list_head *a, struct list_head *b) ++static int data_nodes_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + ino_t inuma, inumb; + struct ubifs_info *c = priv; +@@ -145,8 +146,8 @@ static int data_nodes_cmp(void *priv, struct list_head *a, struct list_head *b) + * first and sorted by length in descending order. Directory entry nodes go + * after inode nodes and are sorted in ascending hash valuer order. + */ +-static int nondata_nodes_cmp(void *priv, struct list_head *a, +- struct list_head *b) ++static int nondata_nodes_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + ino_t inuma, inumb; + struct ubifs_info *c = priv; +diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c +index 1c6fc99fc..b2f5563d1 100644 +--- a/fs/ubifs/replay.c ++++ b/fs/ubifs/replay.c +@@ -299,8 +299,8 @@ static int apply_replay_entry(struct ubifs_info *c, struct replay_entry *r) + * entries @a and @b by comparing their sequence numer. Returns %1 if @a has + * greater sequence number and %-1 otherwise. + */ +-static int replay_entries_cmp(void *priv, struct list_head *a, +- struct list_head *b) ++static int replay_entries_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct ubifs_info *c = priv; + struct replay_entry *ra, *rb; +diff --git a/fs/xfs/scrub/bitmap.c b/fs/xfs/scrub/bitmap.c +index f88694f22..813b5f219 100644 +--- a/fs/xfs/scrub/bitmap.c ++++ b/fs/xfs/scrub/bitmap.c +@@ -63,8 +63,8 @@ xbitmap_init( + static int + xbitmap_range_cmp( + void *priv, +- struct list_head *a, +- struct list_head *b) ++ const struct list_head *a, ++ const struct list_head *b) + { + struct xbitmap_range *ap; + struct xbitmap_range *bp; +diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c +index 9e16a4d0f..984bb480f 100644 +--- a/fs/xfs/xfs_bmap_item.c ++++ b/fs/xfs/xfs_bmap_item.c +@@ -265,8 +265,8 @@ xfs_trans_log_finish_bmap_update( + static int + xfs_bmap_update_diff_items( + void *priv, +- struct list_head *a, +- struct list_head *b) ++ const struct list_head *a, ++ const struct list_head *b) + { + struct xfs_bmap_intent *ba; + struct xfs_bmap_intent *bb; +diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c +index 4e4cf91f4..118819030 100644 +--- a/fs/xfs/xfs_buf.c ++++ b/fs/xfs/xfs_buf.c +@@ -2114,9 +2114,9 @@ xfs_buf_delwri_queue( + */ + static int + xfs_buf_cmp( +- void *priv, +- struct list_head *a, +- struct list_head *b) ++ void *priv, ++ const struct list_head *a, ++ const struct list_head *b) + { + struct xfs_buf *ap = container_of(a, struct xfs_buf, b_list); + struct xfs_buf *bp = container_of(b, struct xfs_buf, b_list); +diff --git a/fs/xfs/xfs_extent_busy.c b/fs/xfs/xfs_extent_busy.c +index 3991e59cf..5c2695a42 100644 +--- a/fs/xfs/xfs_extent_busy.c ++++ b/fs/xfs/xfs_extent_busy.c +@@ -643,8 +643,8 @@ xfs_extent_busy_wait_all( + int + xfs_extent_busy_ag_cmp( + void *priv, +- struct list_head *l1, +- struct list_head *l2) ++ const struct list_head *l1, ++ const struct list_head *l2) + { + struct xfs_extent_busy *b1 = + container_of(l1, struct xfs_extent_busy, list); +diff --git a/fs/xfs/xfs_extent_busy.h b/fs/xfs/xfs_extent_busy.h +index 990ab3891..8aea07100 100644 +--- a/fs/xfs/xfs_extent_busy.h ++++ b/fs/xfs/xfs_extent_busy.h +@@ -58,7 +58,8 @@ void + xfs_extent_busy_wait_all(struct xfs_mount *mp); + + int +-xfs_extent_busy_ag_cmp(void *priv, struct list_head *a, struct list_head *b); ++xfs_extent_busy_ag_cmp(void *priv, const struct list_head *a, ++ const struct list_head *b); + + static inline void xfs_extent_busy_sort(struct list_head *list) + { +diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c +index 6c11bfc3d..5c0395256 100644 +--- a/fs/xfs/xfs_extfree_item.c ++++ b/fs/xfs/xfs_extfree_item.c +@@ -397,8 +397,8 @@ xfs_trans_free_extent( + static int + xfs_extent_free_diff_items( + void *priv, +- struct list_head *a, +- struct list_head *b) ++ const struct list_head *a, ++ const struct list_head *b) + { + struct xfs_mount *mp = priv; + struct xfs_extent_free_item *ra; +diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c +index 7529eb63c..0dee31628 100644 +--- a/fs/xfs/xfs_refcount_item.c ++++ b/fs/xfs/xfs_refcount_item.c +@@ -269,8 +269,8 @@ xfs_trans_log_finish_refcount_update( + static int + xfs_refcount_update_diff_items( + void *priv, +- struct list_head *a, +- struct list_head *b) ++ const struct list_head *a, ++ const struct list_head *b) + { + struct xfs_mount *mp = priv; + struct xfs_refcount_intent *ra; +diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c +index 7adc996ca..20905953f 100644 +--- a/fs/xfs/xfs_rmap_item.c ++++ b/fs/xfs/xfs_rmap_item.c +@@ -337,8 +337,8 @@ xfs_trans_log_finish_rmap_update( + static int + xfs_rmap_update_diff_items( + void *priv, +- struct list_head *a, +- struct list_head *b) ++ const struct list_head *a, ++ const struct list_head *b) + { + struct xfs_mount *mp = priv; + struct xfs_rmap_intent *ra; +diff --git a/include/linux/compiler.h b/include/linux/compiler.h +index b8fe0c23c..475d0a3ce 100644 +--- a/include/linux/compiler.h ++++ b/include/linux/compiler.h +@@ -180,6 +180,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, + (typeof(ptr)) (__ptr + (off)); }) + #endif + ++#define absolute_pointer(val) RELOC_HIDE((void *)(val), 0) ++ + #ifndef OPTIMIZER_HIDE_VAR + /* Make the optimizer believe the variable can be manipulated arbitrarily. */ + #define OPTIMIZER_HIDE_VAR(var) \ +diff --git a/include/linux/list_sort.h b/include/linux/list_sort.h +index 20f178c24..453105f74 100644 +--- a/include/linux/list_sort.h ++++ b/include/linux/list_sort.h +@@ -6,8 +6,9 @@ + + struct list_head; + ++typedef int __attribute__((nonnull(2,3))) (*list_cmp_func_t)(void *, ++ const struct list_head *, const struct list_head *); ++ + __attribute__((nonnull(2,3))) +-void list_sort(void *priv, struct list_head *head, +- int (*cmp)(void *priv, struct list_head *a, +- struct list_head *b)); ++void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp); + #endif +diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h +index 2ffafbdcd..d14b39d14 100644 +--- a/include/linux/usb/hcd.h ++++ b/include/linux/usb/hcd.h +@@ -125,6 +125,7 @@ struct usb_hcd { + #define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */ + #define HCD_FLAG_DEAD 6 /* controller has died? */ + #define HCD_FLAG_INTF_AUTHORIZED 7 /* authorize interfaces? */ ++#define HCD_FLAG_DEFER_RH_REGISTER 8 /* Defer roothub registration */ + + /* The flags can be tested using these macros; they are likely to + * be slightly faster than test_bit(). +@@ -135,6 +136,7 @@ struct usb_hcd { + #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) + #define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING)) + #define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD)) ++#define HCD_DEFER_RH_REGISTER(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEFER_RH_REGISTER)) + + /* + * Specifies if interfaces are authorized by default +diff --git a/include/trace/events/erofs.h b/include/trace/events/erofs.h +index bf9806fd1..db4f2cec8 100644 +--- a/include/trace/events/erofs.h ++++ b/include/trace/events/erofs.h +@@ -35,20 +35,20 @@ TRACE_EVENT(erofs_lookup, + TP_STRUCT__entry( + __field(dev_t, dev ) + __field(erofs_nid_t, nid ) +- __field(const char *, name ) ++ __string(name, dentry->d_name.name ) + __field(unsigned int, flags ) + ), + + TP_fast_assign( + __entry->dev = dir->i_sb->s_dev; + __entry->nid = EROFS_I(dir)->nid; +- __entry->name = dentry->d_name.name; ++ __assign_str(name, dentry->d_name.name); + __entry->flags = flags; + ), + + TP_printk("dev = (%d,%d), pnid = %llu, name:%s, flags:%x", + show_dev_nid(__entry), +- __entry->name, ++ __get_str(name), + __entry->flags) + ); + +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c +index 8247f056e..8edcb1db7 100644 +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -8822,6 +8822,8 @@ static int check_btf_line(struct bpf_verifier_env *env, + nr_linfo = attr->line_info_cnt; + if (!nr_linfo) + return 0; ++ if (nr_linfo > INT_MAX / sizeof(struct bpf_line_info)) ++ return -EINVAL; + + rec_size = attr->line_info_rec_size; + if (rec_size < MIN_BPF_LINEINFO_SIZE || +diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c +index f1022945e..b89ff188a 100644 +--- a/kernel/trace/blktrace.c ++++ b/kernel/trace/blktrace.c +@@ -1670,6 +1670,14 @@ static int blk_trace_remove_queue(struct request_queue *q) + if (bt == NULL) + return -EINVAL; + ++ if (bt->trace_state == Blktrace_running) { ++ bt->trace_state = Blktrace_stopped; ++ spin_lock_irq(&running_trace_lock); ++ list_del_init(&bt->running_list); ++ spin_unlock_irq(&running_trace_lock); ++ relay_flush(bt->rchan); ++ } ++ + put_probe_ref(); + synchronize_rcu(); + blk_trace_free(bt); +diff --git a/lib/list_sort.c b/lib/list_sort.c +index b14accf4e..a926d96ff 100644 +--- a/lib/list_sort.c ++++ b/lib/list_sort.c +@@ -7,16 +7,13 @@ + #include + #include + +-typedef int __attribute__((nonnull(2,3))) (*cmp_func)(void *, +- struct list_head *, struct list_head *); +- + /* + * Returns a list organized in an intermediate format suited + * to chaining of merge() calls: null-terminated, no reserved or + * sentinel head node, "prev" links not maintained. + */ + __attribute__((nonnull(2,3,4))) +-static struct list_head *merge(void *priv, cmp_func cmp, ++static struct list_head *merge(void *priv, list_cmp_func_t cmp, + struct list_head *a, struct list_head *b) + { + struct list_head *head, **tail = &head; +@@ -52,7 +49,7 @@ static struct list_head *merge(void *priv, cmp_func cmp, + * throughout. + */ + __attribute__((nonnull(2,3,4,5))) +-static void merge_final(void *priv, cmp_func cmp, struct list_head *head, ++static void merge_final(void *priv, list_cmp_func_t cmp, struct list_head *head, + struct list_head *a, struct list_head *b) + { + struct list_head *tail = head; +@@ -185,9 +182,7 @@ static void merge_final(void *priv, cmp_func cmp, struct list_head *head, + * 2^(k+1) - 1 (second merge of case 5 when x == 2^(k-1) - 1). + */ + __attribute__((nonnull(2,3))) +-void list_sort(void *priv, struct list_head *head, +- int (*cmp)(void *priv, struct list_head *a, +- struct list_head *b)) ++void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp) + { + struct list_head *list = head->next, *pending = NULL; + size_t count = 0; /* Count of pending */ +diff --git a/lib/test_list_sort.c b/lib/test_list_sort.c +index 1f017d3b6..00daaf233 100644 +--- a/lib/test_list_sort.c ++++ b/lib/test_list_sort.c +@@ -56,7 +56,8 @@ static int __init check(struct debug_el *ela, struct debug_el *elb) + return 0; + } + +-static int __init cmp(void *priv, struct list_head *a, struct list_head *b) ++static int __init cmp(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct debug_el *ela, *elb; + +diff --git a/mm/util.c b/mm/util.c +index f8fc6a1ee..3d05a88e0 100644 +--- a/mm/util.c ++++ b/mm/util.c +@@ -761,7 +761,7 @@ int overcommit_policy_handler(struct ctl_table *table, int write, void *buffer, + size_t *lenp, loff_t *ppos) + { + struct ctl_table t; +- int new_policy; ++ int new_policy = -1; + int ret; + + /* +@@ -779,7 +779,7 @@ int overcommit_policy_handler(struct ctl_table *table, int write, void *buffer, + t = *table; + t.data = &new_policy; + ret = proc_dointvec_minmax(&t, write, buffer, lenp, ppos); +- if (ret) ++ if (ret || new_policy == -1) + return ret; + + mm_compute_batch(new_policy); +diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c +index 3ada338d7..71c8ef7d4 100644 +--- a/net/dsa/dsa2.c ++++ b/net/dsa/dsa2.c +@@ -459,7 +459,7 @@ static int dsa_switch_setup(struct dsa_switch *ds) + devlink_params_publish(ds->devlink); + + if (!ds->slave_mii_bus && ds->ops->phy_read) { +- ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev); ++ ds->slave_mii_bus = mdiobus_alloc(); + if (!ds->slave_mii_bus) { + err = -ENOMEM; + goto teardown; +@@ -469,13 +469,16 @@ static int dsa_switch_setup(struct dsa_switch *ds) + + err = mdiobus_register(ds->slave_mii_bus); + if (err < 0) +- goto teardown; ++ goto free_slave_mii_bus; + } + + ds->setup = true; + + return 0; + ++free_slave_mii_bus: ++ if (ds->slave_mii_bus && ds->ops->phy_read) ++ mdiobus_free(ds->slave_mii_bus); + teardown: + if (ds->ops->teardown) + ds->ops->teardown(ds); +@@ -500,8 +503,11 @@ static void dsa_switch_teardown(struct dsa_switch *ds) + if (!ds->setup) + return; + +- if (ds->slave_mii_bus && ds->ops->phy_read) ++ if (ds->slave_mii_bus && ds->ops->phy_read) { + mdiobus_unregister(ds->slave_mii_bus); ++ mdiobus_free(ds->slave_mii_bus); ++ ds->slave_mii_bus = NULL; ++ } + + dsa_switch_unregister_notifier(ds); + +diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c +index 1fb79dbde..e43f1fbac 100644 +--- a/net/ipv6/ip6_fib.c ++++ b/net/ipv6/ip6_fib.c +@@ -1376,7 +1376,6 @@ int fib6_add(struct fib6_node *root, struct fib6_info *rt, + int err = -ENOMEM; + int allow_create = 1; + int replace_required = 0; +- int sernum = fib6_new_sernum(info->nl_net); + + if (info->nlh) { + if (!(info->nlh->nlmsg_flags & NLM_F_CREATE)) +@@ -1476,7 +1475,7 @@ int fib6_add(struct fib6_node *root, struct fib6_info *rt, + if (!err) { + if (rt->nh) + list_add(&rt->nh_list, &rt->nh->f6i_list); +- __fib6_update_sernum_upto_root(rt, sernum); ++ __fib6_update_sernum_upto_root(rt, fib6_new_sernum(info->nl_net)); + fib6_start_gc(info->nl_net, rt); + } + +diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c +index 696d89c2d..5ee5b2ce2 100644 +--- a/net/smc/smc_clc.c ++++ b/net/smc/smc_clc.c +@@ -230,7 +230,8 @@ static int smc_clc_prfx_set(struct socket *clcsock, + goto out_rel; + } + /* get address to which the internal TCP socket is bound */ +- kernel_getsockname(clcsock, (struct sockaddr *)&addrs); ++ if (kernel_getsockname(clcsock, (struct sockaddr *)&addrs) < 0) ++ goto out_rel; + /* analyze IP specific data of net_device belonging to TCP socket */ + addr6 = (struct sockaddr_in6 *)&addrs; + rcu_read_lock(); +diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c +index af96f813c..c491dd8e6 100644 +--- a/net/smc/smc_core.c ++++ b/net/smc/smc_core.c +@@ -1089,7 +1089,9 @@ static void smc_conn_abort_work(struct work_struct *work) + abort_work); + struct smc_sock *smc = container_of(conn, struct smc_sock, conn); + ++ lock_sock(&smc->sk); + smc_conn_kill(conn, true); ++ release_sock(&smc->sk); + sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */ + } + +diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c +index 2ac33d32e..f6a6acef4 100644 +--- a/net/tipc/name_table.c ++++ b/net/tipc/name_table.c +@@ -381,8 +381,8 @@ static struct publication *tipc_service_remove_publ(struct service_range *sr, + * Code reused: time_after32() for the same purpose + */ + #define publication_after(pa, pb) time_after32((pa)->id, (pb)->id) +-static int tipc_publ_sort(void *priv, struct list_head *a, +- struct list_head *b) ++static int tipc_publ_sort(void *priv, const struct list_head *a, ++ const struct list_head *b) + { + struct publication *pa, *pb; + +diff --git a/tools/testing/selftests/arm64/signal/test_signals.h b/tools/testing/selftests/arm64/signal/test_signals.h +index f96baf1ce..ebe8694db 100644 +--- a/tools/testing/selftests/arm64/signal/test_signals.h ++++ b/tools/testing/selftests/arm64/signal/test_signals.h +@@ -33,10 +33,12 @@ + */ + enum { + FSSBS_BIT, ++ FSVE_BIT, + FMAX_END + }; + + #define FEAT_SSBS (1UL << FSSBS_BIT) ++#define FEAT_SVE (1UL << FSVE_BIT) + + /* + * A descriptor used to describe and configure a test case. +diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.c b/tools/testing/selftests/arm64/signal/test_signals_utils.c +index 2de6e5ed5..22722abc9 100644 +--- a/tools/testing/selftests/arm64/signal/test_signals_utils.c ++++ b/tools/testing/selftests/arm64/signal/test_signals_utils.c +@@ -26,6 +26,7 @@ static int sig_copyctx = SIGTRAP; + + static char const *const feats_names[FMAX_END] = { + " SSBS ", ++ " SVE ", + }; + + #define MAX_FEATS_SZ 128 +@@ -263,16 +264,21 @@ int test_init(struct tdescr *td) + */ + if (getauxval(AT_HWCAP) & HWCAP_SSBS) + td->feats_supported |= FEAT_SSBS; +- if (feats_ok(td)) ++ if (getauxval(AT_HWCAP) & HWCAP_SVE) ++ td->feats_supported |= FEAT_SVE; ++ if (feats_ok(td)) { + fprintf(stderr, + "Required Features: [%s] supported\n", + feats_to_string(td->feats_required & + td->feats_supported)); +- else ++ } else { + fprintf(stderr, + "Required Features: [%s] NOT supported\n", + feats_to_string(td->feats_required & + ~td->feats_supported)); ++ td->result = KSFT_SKIP; ++ return 0; ++ } + } + + /* Perform test specific additional initialization */ diff --git a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.70-71.patch b/patch/kernel/rockchip-rk3588-legacy/patch-5.10.70-71.patch new file mode 100644 index 0000000000..829673a270 --- /dev/null +++ b/patch/kernel/rockchip-rk3588-legacy/patch-5.10.70-71.patch @@ -0,0 +1,4574 @@ +diff --git a/Makefile b/Makefile +index ea7037dac..00935cfee 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 10 +-SUBLEVEL = 70 ++SUBLEVEL = 71 + EXTRAVERSION = + NAME = Dare mighty things + +diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c +index 0af88622c..cb6d22439 100644 +--- a/arch/mips/net/bpf_jit.c ++++ b/arch/mips/net/bpf_jit.c +@@ -662,6 +662,11 @@ static void build_epilogue(struct jit_ctx *ctx) + ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative : func) : \ + func##_positive) + ++static bool is_bad_offset(int b_off) ++{ ++ return b_off > 0x1ffff || b_off < -0x20000; ++} ++ + static int build_body(struct jit_ctx *ctx) + { + const struct bpf_prog *prog = ctx->skf; +@@ -728,7 +733,10 @@ static int build_body(struct jit_ctx *ctx) + /* Load return register on DS for failures */ + emit_reg_move(r_ret, r_zero, ctx); + /* Return with error */ +- emit_b(b_imm(prog->len, ctx), ctx); ++ b_off = b_imm(prog->len, ctx); ++ if (is_bad_offset(b_off)) ++ return -E2BIG; ++ emit_b(b_off, ctx); + emit_nop(ctx); + break; + case BPF_LD | BPF_W | BPF_IND: +@@ -775,8 +783,10 @@ static int build_body(struct jit_ctx *ctx) + emit_jalr(MIPS_R_RA, r_s0, ctx); + emit_reg_move(MIPS_R_A0, r_skb, ctx); /* delay slot */ + /* Check the error value */ +- emit_bcond(MIPS_COND_NE, r_ret, 0, +- b_imm(prog->len, ctx), ctx); ++ b_off = b_imm(prog->len, ctx); ++ if (is_bad_offset(b_off)) ++ return -E2BIG; ++ emit_bcond(MIPS_COND_NE, r_ret, 0, b_off, ctx); + emit_reg_move(r_ret, r_zero, ctx); + /* We are good */ + /* X <- P[1:K] & 0xf */ +@@ -855,8 +865,10 @@ static int build_body(struct jit_ctx *ctx) + /* A /= X */ + ctx->flags |= SEEN_X | SEEN_A; + /* Check if r_X is zero */ +- emit_bcond(MIPS_COND_EQ, r_X, r_zero, +- b_imm(prog->len, ctx), ctx); ++ b_off = b_imm(prog->len, ctx); ++ if (is_bad_offset(b_off)) ++ return -E2BIG; ++ emit_bcond(MIPS_COND_EQ, r_X, r_zero, b_off, ctx); + emit_load_imm(r_ret, 0, ctx); /* delay slot */ + emit_div(r_A, r_X, ctx); + break; +@@ -864,8 +876,10 @@ static int build_body(struct jit_ctx *ctx) + /* A %= X */ + ctx->flags |= SEEN_X | SEEN_A; + /* Check if r_X is zero */ +- emit_bcond(MIPS_COND_EQ, r_X, r_zero, +- b_imm(prog->len, ctx), ctx); ++ b_off = b_imm(prog->len, ctx); ++ if (is_bad_offset(b_off)) ++ return -E2BIG; ++ emit_bcond(MIPS_COND_EQ, r_X, r_zero, b_off, ctx); + emit_load_imm(r_ret, 0, ctx); /* delay slot */ + emit_mod(r_A, r_X, ctx); + break; +@@ -926,7 +940,10 @@ static int build_body(struct jit_ctx *ctx) + break; + case BPF_JMP | BPF_JA: + /* pc += K */ +- emit_b(b_imm(i + k + 1, ctx), ctx); ++ b_off = b_imm(i + k + 1, ctx); ++ if (is_bad_offset(b_off)) ++ return -E2BIG; ++ emit_b(b_off, ctx); + emit_nop(ctx); + break; + case BPF_JMP | BPF_JEQ | BPF_K: +@@ -1056,12 +1073,16 @@ static int build_body(struct jit_ctx *ctx) + break; + case BPF_RET | BPF_A: + ctx->flags |= SEEN_A; +- if (i != prog->len - 1) ++ if (i != prog->len - 1) { + /* + * If this is not the last instruction + * then jump to the epilogue + */ +- emit_b(b_imm(prog->len, ctx), ctx); ++ b_off = b_imm(prog->len, ctx); ++ if (is_bad_offset(b_off)) ++ return -E2BIG; ++ emit_b(b_off, ctx); ++ } + emit_reg_move(r_ret, r_A, ctx); /* delay slot */ + break; + case BPF_RET | BPF_K: +@@ -1075,7 +1096,10 @@ static int build_body(struct jit_ctx *ctx) + * If this is not the last instruction + * then jump to the epilogue + */ +- emit_b(b_imm(prog->len, ctx), ctx); ++ b_off = b_imm(prog->len, ctx); ++ if (is_bad_offset(b_off)) ++ return -E2BIG; ++ emit_b(b_off, ctx); + emit_nop(ctx); + } + break; +@@ -1133,8 +1157,10 @@ static int build_body(struct jit_ctx *ctx) + /* Load *dev pointer */ + emit_load_ptr(r_s0, r_skb, off, ctx); + /* error (0) in the delay slot */ +- emit_bcond(MIPS_COND_EQ, r_s0, r_zero, +- b_imm(prog->len, ctx), ctx); ++ b_off = b_imm(prog->len, ctx); ++ if (is_bad_offset(b_off)) ++ return -E2BIG; ++ emit_bcond(MIPS_COND_EQ, r_s0, r_zero, b_off, ctx); + emit_reg_move(r_ret, r_zero, ctx); + if (code == (BPF_ANC | SKF_AD_IFINDEX)) { + BUILD_BUG_ON(sizeof_field(struct net_device, ifindex) != 4); +@@ -1244,7 +1270,10 @@ void bpf_jit_compile(struct bpf_prog *fp) + + /* Generate the actual JIT code */ + build_prologue(&ctx); +- build_body(&ctx); ++ if (build_body(&ctx)) { ++ module_memfree(ctx.target); ++ goto out; ++ } + build_epilogue(&ctx); + + /* Update the icache */ +diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c +index 3b8b8eede..4684bf9fc 100644 +--- a/arch/x86/events/intel/core.c ++++ b/arch/x86/events/intel/core.c +@@ -263,6 +263,7 @@ static struct event_constraint intel_icl_event_constraints[] = { + INTEL_EVENT_CONSTRAINT_RANGE(0xa8, 0xb0, 0xf), + INTEL_EVENT_CONSTRAINT_RANGE(0xb7, 0xbd, 0xf), + INTEL_EVENT_CONSTRAINT_RANGE(0xd0, 0xe6, 0xf), ++ INTEL_EVENT_CONSTRAINT(0xef, 0xf), + INTEL_EVENT_CONSTRAINT_RANGE(0xf0, 0xf4, 0xf), + EVENT_CONSTRAINT_END + }; +diff --git a/arch/x86/include/asm/kvm_page_track.h b/arch/x86/include/asm/kvm_page_track.h +index 87bd6025d..6a5f3acf2 100644 +--- a/arch/x86/include/asm/kvm_page_track.h ++++ b/arch/x86/include/asm/kvm_page_track.h +@@ -46,7 +46,7 @@ struct kvm_page_track_notifier_node { + struct kvm_page_track_notifier_node *node); + }; + +-void kvm_page_track_init(struct kvm *kvm); ++int kvm_page_track_init(struct kvm *kvm); + void kvm_page_track_cleanup(struct kvm *kvm); + + void kvm_page_track_free_memslot(struct kvm_memory_slot *slot); +diff --git a/arch/x86/include/asm/kvmclock.h b/arch/x86/include/asm/kvmclock.h +index eceea9299..6c5765192 100644 +--- a/arch/x86/include/asm/kvmclock.h ++++ b/arch/x86/include/asm/kvmclock.h +@@ -2,6 +2,20 @@ + #ifndef _ASM_X86_KVM_CLOCK_H + #define _ASM_X86_KVM_CLOCK_H + ++#include ++ + extern struct clocksource kvm_clock; + ++DECLARE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); ++ ++static inline struct pvclock_vcpu_time_info *this_cpu_pvti(void) ++{ ++ return &this_cpu_read(hv_clock_per_cpu)->pvti; ++} ++ ++static inline struct pvclock_vsyscall_time_info *this_cpu_hvclock(void) ++{ ++ return this_cpu_read(hv_clock_per_cpu); ++} ++ + #endif /* _ASM_X86_KVM_CLOCK_H */ +diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c +index c4ac26333..bb657e2e6 100644 +--- a/arch/x86/kernel/kvmclock.c ++++ b/arch/x86/kernel/kvmclock.c +@@ -50,18 +50,9 @@ early_param("no-kvmclock-vsyscall", parse_no_kvmclock_vsyscall); + static struct pvclock_vsyscall_time_info + hv_clock_boot[HVC_BOOT_ARRAY_SIZE] __bss_decrypted __aligned(PAGE_SIZE); + static struct pvclock_wall_clock wall_clock __bss_decrypted; +-static DEFINE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); + static struct pvclock_vsyscall_time_info *hvclock_mem; +- +-static inline struct pvclock_vcpu_time_info *this_cpu_pvti(void) +-{ +- return &this_cpu_read(hv_clock_per_cpu)->pvti; +-} +- +-static inline struct pvclock_vsyscall_time_info *this_cpu_hvclock(void) +-{ +- return this_cpu_read(hv_clock_per_cpu); +-} ++DEFINE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu); ++EXPORT_PER_CPU_SYMBOL_GPL(hv_clock_per_cpu); + + /* + * The wallclock is the time of day when we booted. Since then, some time may +diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c +index ff005fe73..8c065da73 100644 +--- a/arch/x86/kvm/ioapic.c ++++ b/arch/x86/kvm/ioapic.c +@@ -319,8 +319,8 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) + unsigned index; + bool mask_before, mask_after; + union kvm_ioapic_redirect_entry *e; +- unsigned long vcpu_bitmap; + int old_remote_irr, old_delivery_status, old_dest_id, old_dest_mode; ++ DECLARE_BITMAP(vcpu_bitmap, KVM_MAX_VCPUS); + + switch (ioapic->ioregsel) { + case IOAPIC_REG_VERSION: +@@ -384,9 +384,9 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) + irq.shorthand = APIC_DEST_NOSHORT; + irq.dest_id = e->fields.dest_id; + irq.msi_redir_hint = false; +- bitmap_zero(&vcpu_bitmap, 16); ++ bitmap_zero(vcpu_bitmap, KVM_MAX_VCPUS); + kvm_bitmap_or_dest_vcpus(ioapic->kvm, &irq, +- &vcpu_bitmap); ++ vcpu_bitmap); + if (old_dest_mode != e->fields.dest_mode || + old_dest_id != e->fields.dest_id) { + /* +@@ -399,10 +399,10 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) + kvm_lapic_irq_dest_mode( + !!e->fields.dest_mode); + kvm_bitmap_or_dest_vcpus(ioapic->kvm, &irq, +- &vcpu_bitmap); ++ vcpu_bitmap); + } + kvm_make_scan_ioapic_request_mask(ioapic->kvm, +- &vcpu_bitmap); ++ vcpu_bitmap); + } else { + kvm_make_scan_ioapic_request(ioapic->kvm); + } +diff --git a/arch/x86/kvm/mmu/page_track.c b/arch/x86/kvm/mmu/page_track.c +index 8443a6757..81cf4babb 100644 +--- a/arch/x86/kvm/mmu/page_track.c ++++ b/arch/x86/kvm/mmu/page_track.c +@@ -163,13 +163,13 @@ void kvm_page_track_cleanup(struct kvm *kvm) + cleanup_srcu_struct(&head->track_srcu); + } + +-void kvm_page_track_init(struct kvm *kvm) ++int kvm_page_track_init(struct kvm *kvm) + { + struct kvm_page_track_notifier_head *head; + + head = &kvm->arch.track_notifier_head; +- init_srcu_struct(&head->track_srcu); + INIT_HLIST_HEAD(&head->track_notifier_list); ++ return init_srcu_struct(&head->track_srcu); + } + + /* +diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c +index df17146e8..f0946872f 100644 +--- a/arch/x86/kvm/svm/nested.c ++++ b/arch/x86/kvm/svm/nested.c +@@ -447,7 +447,6 @@ static void nested_prepare_vmcb_control(struct vcpu_svm *svm) + (svm->nested.ctl.int_ctl & int_ctl_vmcb12_bits) | + (svm->nested.hsave->control.int_ctl & int_ctl_vmcb01_bits); + +- svm->vmcb->control.virt_ext = svm->nested.ctl.virt_ext; + svm->vmcb->control.int_vector = svm->nested.ctl.int_vector; + svm->vmcb->control.int_state = svm->nested.ctl.int_state; + svm->vmcb->control.event_inj = svm->nested.ctl.event_inj; +diff --git a/arch/x86/kvm/vmx/evmcs.c b/arch/x86/kvm/vmx/evmcs.c +index f3199bb02..c0d6fee92 100644 +--- a/arch/x86/kvm/vmx/evmcs.c ++++ b/arch/x86/kvm/vmx/evmcs.c +@@ -352,14 +352,20 @@ void nested_evmcs_filter_control_msr(u32 msr_index, u64 *pdata) + switch (msr_index) { + case MSR_IA32_VMX_EXIT_CTLS: + case MSR_IA32_VMX_TRUE_EXIT_CTLS: +- ctl_high &= ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL; ++ ctl_high &= ~EVMCS1_UNSUPPORTED_VMEXIT_CTRL; + break; + case MSR_IA32_VMX_ENTRY_CTLS: + case MSR_IA32_VMX_TRUE_ENTRY_CTLS: +- ctl_high &= ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; ++ ctl_high &= ~EVMCS1_UNSUPPORTED_VMENTRY_CTRL; + break; + case MSR_IA32_VMX_PROCBASED_CTLS2: +- ctl_high &= ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; ++ ctl_high &= ~EVMCS1_UNSUPPORTED_2NDEXEC; ++ break; ++ case MSR_IA32_VMX_PINBASED_CTLS: ++ ctl_high &= ~EVMCS1_UNSUPPORTED_PINCTRL; ++ break; ++ case MSR_IA32_VMX_VMFUNC: ++ ctl_low &= ~EVMCS1_UNSUPPORTED_VMFUNC; + break; + } + +diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c +index fcd8bcb7e..e0dba0037 100644 +--- a/arch/x86/kvm/vmx/vmx.c ++++ b/arch/x86/kvm/vmx/vmx.c +@@ -1867,10 +1867,11 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) + &msr_info->data)) + return 1; + /* +- * Enlightened VMCS v1 doesn't have certain fields, but buggy +- * Hyper-V versions are still trying to use corresponding +- * features when they are exposed. Filter out the essential +- * minimum. ++ * Enlightened VMCS v1 doesn't have certain VMCS fields but ++ * instead of just ignoring the features, different Hyper-V ++ * versions are either trying to use them and fail or do some ++ * sanity checking and refuse to boot. Filter all unsupported ++ * features out. + */ + if (!msr_info->host_initiated && + vmx->nested.enlightened_vmcs_enabled) +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c +index 75c59ad27..d65da3b58 100644 +--- a/arch/x86/kvm/x86.c ++++ b/arch/x86/kvm/x86.c +@@ -10392,9 +10392,15 @@ void kvm_arch_free_vm(struct kvm *kvm) + + int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) + { ++ int ret; ++ + if (type) + return -EINVAL; + ++ ret = kvm_page_track_init(kvm); ++ if (ret) ++ return ret; ++ + INIT_HLIST_HEAD(&kvm->arch.mask_notifier_list); + INIT_LIST_HEAD(&kvm->arch.active_mmu_pages); + INIT_LIST_HEAD(&kvm->arch.zapped_obsolete_pages); +@@ -10421,7 +10427,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) + INIT_DELAYED_WORK(&kvm->arch.kvmclock_sync_work, kvmclock_sync_fn); + + kvm_hv_init_vm(kvm); +- kvm_page_track_init(kvm); + kvm_mmu_init_vm(kvm); + + return kvm_x86_ops.vm_init(kvm); +diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c +index 40b47f98c..610b43529 100644 +--- a/arch/x86/net/bpf_jit_comp.c ++++ b/arch/x86/net/bpf_jit_comp.c +@@ -1544,7 +1544,7 @@ static void restore_regs(const struct btf_func_model *m, u8 **prog, int nr_args, + } + + static int invoke_bpf_prog(const struct btf_func_model *m, u8 **pprog, +- struct bpf_prog *p, int stack_size, bool mod_ret) ++ struct bpf_prog *p, int stack_size, bool save_ret) + { + u8 *prog = *pprog; + int cnt = 0; +@@ -1570,11 +1570,15 @@ static int invoke_bpf_prog(const struct btf_func_model *m, u8 **pprog, + if (emit_call(&prog, p->bpf_func, prog)) + return -EINVAL; + +- /* BPF_TRAMP_MODIFY_RETURN trampolines can modify the return ++ /* ++ * BPF_TRAMP_MODIFY_RETURN trampolines can modify the return + * of the previous call which is then passed on the stack to + * the next BPF program. ++ * ++ * BPF_TRAMP_FENTRY trampoline may need to return the return ++ * value of BPF_PROG_TYPE_STRUCT_OPS prog. + */ +- if (mod_ret) ++ if (save_ret) + emit_stx(&prog, BPF_DW, BPF_REG_FP, BPF_REG_0, -8); + + if (p->aux->sleepable) { +@@ -1642,13 +1646,15 @@ static int emit_cond_near_jump(u8 **pprog, void *func, void *ip, u8 jmp_cond) + } + + static int invoke_bpf(const struct btf_func_model *m, u8 **pprog, +- struct bpf_tramp_progs *tp, int stack_size) ++ struct bpf_tramp_progs *tp, int stack_size, ++ bool save_ret) + { + int i; + u8 *prog = *pprog; + + for (i = 0; i < tp->nr_progs; i++) { +- if (invoke_bpf_prog(m, &prog, tp->progs[i], stack_size, false)) ++ if (invoke_bpf_prog(m, &prog, tp->progs[i], stack_size, ++ save_ret)) + return -EINVAL; + } + *pprog = prog; +@@ -1691,6 +1697,23 @@ static int invoke_bpf_mod_ret(const struct btf_func_model *m, u8 **pprog, + return 0; + } + ++static bool is_valid_bpf_tramp_flags(unsigned int flags) ++{ ++ if ((flags & BPF_TRAMP_F_RESTORE_REGS) && ++ (flags & BPF_TRAMP_F_SKIP_FRAME)) ++ return false; ++ ++ /* ++ * BPF_TRAMP_F_RET_FENTRY_RET is only used by bpf_struct_ops, ++ * and it must be used alone. ++ */ ++ if ((flags & BPF_TRAMP_F_RET_FENTRY_RET) && ++ (flags & ~BPF_TRAMP_F_RET_FENTRY_RET)) ++ return false; ++ ++ return true; ++} ++ + /* Example: + * __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); + * its 'struct btf_func_model' will be nr_args=2 +@@ -1763,17 +1786,19 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *i + struct bpf_tramp_progs *fmod_ret = &tprogs[BPF_TRAMP_MODIFY_RETURN]; + u8 **branches = NULL; + u8 *prog; ++ bool save_ret; + + /* x86-64 supports up to 6 arguments. 7+ can be added in the future */ + if (nr_args > 6) + return -ENOTSUPP; + +- if ((flags & BPF_TRAMP_F_RESTORE_REGS) && +- (flags & BPF_TRAMP_F_SKIP_FRAME)) ++ if (!is_valid_bpf_tramp_flags(flags)) + return -EINVAL; + +- if (flags & BPF_TRAMP_F_CALL_ORIG) +- stack_size += 8; /* room for return value of orig_call */ ++ /* room for return value of orig_call or fentry prog */ ++ save_ret = flags & (BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_RET_FENTRY_RET); ++ if (save_ret) ++ stack_size += 8; + + if (flags & BPF_TRAMP_F_SKIP_FRAME) + /* skip patched call instruction and point orig_call to actual +@@ -1800,7 +1825,8 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *i + } + + if (fentry->nr_progs) +- if (invoke_bpf(m, &prog, fentry, stack_size)) ++ if (invoke_bpf(m, &prog, fentry, stack_size, ++ flags & BPF_TRAMP_F_RET_FENTRY_RET)) + return -EINVAL; + + if (fmod_ret->nr_progs) { +@@ -1847,7 +1873,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *i + } + + if (fexit->nr_progs) +- if (invoke_bpf(m, &prog, fexit, stack_size)) { ++ if (invoke_bpf(m, &prog, fexit, stack_size, false)) { + ret = -EINVAL; + goto cleanup; + } +@@ -1867,9 +1893,10 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *i + ret = -EINVAL; + goto cleanup; + } +- /* restore original return value back into RAX */ +- emit_ldx(&prog, BPF_DW, BPF_REG_0, BPF_REG_FP, -8); + } ++ /* restore return value of orig_call or fentry prog back into RAX */ ++ if (save_ret) ++ emit_ldx(&prog, BPF_DW, BPF_REG_0, BPF_REG_FP, -8); + + EMIT1(0x5B); /* pop rbx */ + EMIT1(0xC9); /* leave */ +diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c +index e9167904f..81e0959a1 100644 +--- a/block/bfq-iosched.c ++++ b/block/bfq-iosched.c +@@ -2526,15 +2526,6 @@ bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq) + * are likely to increase the throughput. + */ + bfqq->new_bfqq = new_bfqq; +- /* +- * The above assignment schedules the following redirections: +- * each time some I/O for bfqq arrives, the process that +- * generated that I/O is disassociated from bfqq and +- * associated with new_bfqq. Here we increases new_bfqq->ref +- * in advance, adding the number of processes that are +- * expected to be associated with new_bfqq as they happen to +- * issue I/O. +- */ + new_bfqq->ref += process_refs; + return new_bfqq; + } +@@ -2594,10 +2585,6 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, + { + struct bfq_queue *in_service_bfqq, *new_bfqq; + +- /* if a merge has already been setup, then proceed with that first */ +- if (bfqq->new_bfqq) +- return bfqq->new_bfqq; +- + /* + * Do not perform queue merging if the device is non + * rotational and performs internal queueing. In fact, such a +@@ -2652,6 +2639,9 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, + if (bfq_too_late_for_merging(bfqq)) + return NULL; + ++ if (bfqq->new_bfqq) ++ return bfqq->new_bfqq; ++ + if (!io_struct || unlikely(bfqq == &bfqd->oom_bfqq)) + return NULL; + +diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c +index d061bff5c..99e23a5df 100644 +--- a/drivers/acpi/nfit/core.c ++++ b/drivers/acpi/nfit/core.c +@@ -3018,6 +3018,18 @@ static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc, + ndr_desc->target_node = NUMA_NO_NODE; + } + ++ /* Fallback to address based numa information if node lookup failed */ ++ if (ndr_desc->numa_node == NUMA_NO_NODE) { ++ ndr_desc->numa_node = memory_add_physaddr_to_nid(spa->address); ++ dev_info(acpi_desc->dev, "changing numa node from %d to %d for nfit region [%pa-%pa]", ++ NUMA_NO_NODE, ndr_desc->numa_node, &res.start, &res.end); ++ } ++ if (ndr_desc->target_node == NUMA_NO_NODE) { ++ ndr_desc->target_node = phys_to_target_node(spa->address); ++ dev_info(acpi_desc->dev, "changing target node from %d to %d for nfit region [%pa-%pa]", ++ NUMA_NO_NODE, ndr_desc->numa_node, &res.start, &res.end); ++ } ++ + /* + * Persistence domain bits are hierarchical, if + * ACPI_NFIT_CAPABILITY_CACHE_FLUSH is set then +diff --git a/drivers/cpufreq/cpufreq_governor_attr_set.c b/drivers/cpufreq/cpufreq_governor_attr_set.c +index 66b05a326..a6f365b9c 100644 +--- a/drivers/cpufreq/cpufreq_governor_attr_set.c ++++ b/drivers/cpufreq/cpufreq_governor_attr_set.c +@@ -74,8 +74,8 @@ unsigned int gov_attr_set_put(struct gov_attr_set *attr_set, struct list_head *l + if (count) + return count; + +- kobject_put(&attr_set->kobj); + mutex_destroy(&attr_set->update_lock); ++ kobject_put(&attr_set->kobj); + return 0; + } + EXPORT_SYMBOL_GPL(gov_attr_set_put); +diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c +index d6a8f4e4b..c15625e8f 100644 +--- a/drivers/crypto/ccp/ccp-ops.c ++++ b/drivers/crypto/ccp/ccp-ops.c +@@ -778,7 +778,7 @@ ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) + in_place ? DMA_BIDIRECTIONAL + : DMA_TO_DEVICE); + if (ret) +- goto e_ctx; ++ goto e_aad; + + if (in_place) { + dst = src; +@@ -863,7 +863,7 @@ ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) + op.u.aes.size = 0; + ret = cmd_q->ccp->vdata->perform->aes(&op); + if (ret) +- goto e_dst; ++ goto e_final_wa; + + if (aes->action == CCP_AES_ACTION_ENCRYPT) { + /* Put the ciphered tag after the ciphertext. */ +@@ -873,17 +873,19 @@ ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) + ret = ccp_init_dm_workarea(&tag, cmd_q, authsize, + DMA_BIDIRECTIONAL); + if (ret) +- goto e_tag; ++ goto e_final_wa; + ret = ccp_set_dm_area(&tag, 0, p_tag, 0, authsize); +- if (ret) +- goto e_tag; ++ if (ret) { ++ ccp_dm_free(&tag); ++ goto e_final_wa; ++ } + + ret = crypto_memneq(tag.address, final_wa.address, + authsize) ? -EBADMSG : 0; + ccp_dm_free(&tag); + } + +-e_tag: ++e_final_wa: + ccp_dm_free(&final_wa); + + e_dst: +diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c +index 7cc7d1371..3a3aeef10 100644 +--- a/drivers/gpio/gpio-pca953x.c ++++ b/drivers/gpio/gpio-pca953x.c +@@ -467,15 +467,8 @@ static int pca953x_gpio_get_value(struct gpio_chip *gc, unsigned off) + mutex_lock(&chip->i2c_lock); + ret = regmap_read(chip->regmap, inreg, ®_val); + mutex_unlock(&chip->i2c_lock); +- if (ret < 0) { +- /* +- * NOTE: +- * diagnostic already emitted; that's all we should +- * do unless gpio_*_value_cansleep() calls become different +- * from their nonsleeping siblings (and report faults). +- */ +- return 0; +- } ++ if (ret < 0) ++ return ret; + + return !!(reg_val & bit); + } +diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +index ac3a88197..c7d6a677d 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +@@ -3542,7 +3542,7 @@ static int gfx_v9_0_mqd_init(struct amdgpu_ring *ring) + + /* set static priority for a queue/ring */ + gfx_v9_0_mqd_set_priority(ring, mqd); +- mqd->cp_hqd_quantum = RREG32(mmCP_HQD_QUANTUM); ++ mqd->cp_hqd_quantum = RREG32_SOC15(GC, 0, mmCP_HQD_QUANTUM); + + /* map_queues packet doesn't need activate the queue, + * so only kiq need set this field. +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index ce21a21dd..d9525fbed 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -951,6 +951,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) + + init_data.asic_id.pci_revision_id = adev->pdev->revision; + init_data.asic_id.hw_internal_rev = adev->external_rev_id; ++ init_data.asic_id.chip_id = adev->pdev->device; + + init_data.asic_id.vram_width = adev->gmc.vram_width; + /* TODO: initialize init_data.asic_id.vram_type here!!!! */ +diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c +index d8fef42ca..896389f93 100644 +--- a/drivers/gpu/drm/i915/i915_request.c ++++ b/drivers/gpu/drm/i915/i915_request.c +@@ -776,8 +776,6 @@ static void __i915_request_ctor(void *arg) + i915_sw_fence_init(&rq->submit, submit_notify); + i915_sw_fence_init(&rq->semaphore, semaphore_notify); + +- dma_fence_init(&rq->fence, &i915_fence_ops, &rq->lock, 0, 0); +- + rq->capture_list = NULL; + + init_llist_head(&rq->execute_cb); +@@ -840,17 +838,12 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp) + rq->ring = ce->ring; + rq->execution_mask = ce->engine->mask; + +- kref_init(&rq->fence.refcount); +- rq->fence.flags = 0; +- rq->fence.error = 0; +- INIT_LIST_HEAD(&rq->fence.cb_list); +- + ret = intel_timeline_get_seqno(tl, rq, &seqno); + if (ret) + goto err_free; + +- rq->fence.context = tl->fence_context; +- rq->fence.seqno = seqno; ++ dma_fence_init(&rq->fence, &i915_fence_ops, &rq->lock, ++ tl->fence_context, seqno); + + RCU_INIT_POINTER(rq->timeline, tl); + RCU_INIT_POINTER(rq->hwsp_cacheline, tl->hwsp_cacheline); +diff --git a/drivers/hid/hid-betopff.c b/drivers/hid/hid-betopff.c +index 0790fbd3f..467d789f9 100644 +--- a/drivers/hid/hid-betopff.c ++++ b/drivers/hid/hid-betopff.c +@@ -56,15 +56,22 @@ static int betopff_init(struct hid_device *hid) + { + struct betopff_device *betopff; + struct hid_report *report; +- struct hid_input *hidinput = +- list_first_entry(&hid->inputs, struct hid_input, list); ++ struct hid_input *hidinput; + struct list_head *report_list = + &hid->report_enum[HID_OUTPUT_REPORT].report_list; +- struct input_dev *dev = hidinput->input; ++ struct input_dev *dev; + int field_count = 0; + int error; + int i, j; + ++ if (list_empty(&hid->inputs)) { ++ hid_err(hid, "no inputs found\n"); ++ return -ENODEV; ++ } ++ ++ hidinput = list_first_entry(&hid->inputs, struct hid_input, list); ++ dev = hidinput->input; ++ + if (list_empty(report_list)) { + hid_err(hid, "no output reports found\n"); + return -ENODEV; +diff --git a/drivers/hid/hid-u2fzero.c b/drivers/hid/hid-u2fzero.c +index 95e080787..d70cd3d7f 100644 +--- a/drivers/hid/hid-u2fzero.c ++++ b/drivers/hid/hid-u2fzero.c +@@ -198,7 +198,9 @@ static int u2fzero_rng_read(struct hwrng *rng, void *data, + } + + ret = u2fzero_recv(dev, &req, &resp); +- if (ret < 0) ++ ++ /* ignore errors or packets without data */ ++ if (ret < offsetof(struct u2f_hid_msg, init.data)) + return 0; + + /* only take the minimum amount of data it is safe to take */ +diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c +index c28d81a95..4bf61fb13 100644 +--- a/drivers/hid/usbhid/hid-core.c ++++ b/drivers/hid/usbhid/hid-core.c +@@ -503,7 +503,7 @@ static void hid_ctrl(struct urb *urb) + + if (unplug) { + usbhid->ctrltail = usbhid->ctrlhead; +- } else { ++ } else if (usbhid->ctrlhead != usbhid->ctrltail) { + usbhid->ctrltail = (usbhid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1); + + if (usbhid->ctrlhead != usbhid->ctrltail && +@@ -1224,9 +1224,20 @@ static void usbhid_stop(struct hid_device *hid) + mutex_lock(&usbhid->mutex); + + clear_bit(HID_STARTED, &usbhid->iofl); ++ + spin_lock_irq(&usbhid->lock); /* Sync with error and led handlers */ + set_bit(HID_DISCONNECTED, &usbhid->iofl); ++ while (usbhid->ctrltail != usbhid->ctrlhead) { ++ if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_OUT) { ++ kfree(usbhid->ctrl[usbhid->ctrltail].raw_report); ++ usbhid->ctrl[usbhid->ctrltail].raw_report = NULL; ++ } ++ ++ usbhid->ctrltail = (usbhid->ctrltail + 1) & ++ (HID_CONTROL_FIFO_SIZE - 1); ++ } + spin_unlock_irq(&usbhid->lock); ++ + usb_kill_urb(usbhid->urbin); + usb_kill_urb(usbhid->urbout); + usb_kill_urb(usbhid->urbctrl); +diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c +index ed8d59d4e..bd8f5a3aa 100644 +--- a/drivers/hwmon/mlxreg-fan.c ++++ b/drivers/hwmon/mlxreg-fan.c +@@ -291,8 +291,8 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev, + { + struct mlxreg_fan *fan = cdev->devdata; + unsigned long cur_state; ++ int i, config = 0; + u32 regval; +- int i; + int err; + + /* +@@ -305,6 +305,12 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev, + * overwritten. + */ + if (state >= MLXREG_FAN_SPEED_MIN && state <= MLXREG_FAN_SPEED_MAX) { ++ /* ++ * This is configuration change, which is only supported through sysfs. ++ * For configuration non-zero value is to be returned to avoid thermal ++ * statistics update. ++ */ ++ config = 1; + state -= MLXREG_FAN_MAX_STATE; + for (i = 0; i < state; i++) + fan->cooling_levels[i] = state; +@@ -319,7 +325,7 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev, + + cur_state = MLXREG_FAN_PWM_DUTY2STATE(regval); + if (state < cur_state) +- return 0; ++ return config; + + state = cur_state; + } +@@ -335,7 +341,7 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev, + dev_err(fan->dev, "Failed to write PWM duty\n"); + return err; + } +- return 0; ++ return config; + } + + static const struct thermal_cooling_device_ops mlxreg_fan_cooling_ops = { +diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c +index 1c3e2a945..a41fe06e0 100644 +--- a/drivers/hwmon/pmbus/mp2975.c ++++ b/drivers/hwmon/pmbus/mp2975.c +@@ -54,7 +54,7 @@ + + #define MP2975_RAIL2_FUNC (PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | \ + PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | \ +- PMBUS_PHASE_VIRTUAL) ++ PMBUS_HAVE_POUT | PMBUS_PHASE_VIRTUAL) + + struct mp2975_data { + struct pmbus_driver_info info; +diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c +index ede66ea6a..b963a369c 100644 +--- a/drivers/hwmon/tmp421.c ++++ b/drivers/hwmon/tmp421.c +@@ -100,71 +100,81 @@ struct tmp421_data { + s16 temp[4]; + }; + +-static int temp_from_s16(s16 reg) ++static int temp_from_raw(u16 reg, bool extended) + { + /* Mask out status bits */ + int temp = reg & ~0xf; + +- return (temp * 1000 + 128) / 256; +-} +- +-static int temp_from_u16(u16 reg) +-{ +- /* Mask out status bits */ +- int temp = reg & ~0xf; +- +- /* Add offset for extended temperature range. */ +- temp -= 64 * 256; ++ if (extended) ++ temp = temp - 64 * 256; ++ else ++ temp = (s16)temp; + +- return (temp * 1000 + 128) / 256; ++ return DIV_ROUND_CLOSEST(temp * 1000, 256); + } + +-static struct tmp421_data *tmp421_update_device(struct device *dev) ++static int tmp421_update_device(struct tmp421_data *data) + { +- struct tmp421_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; ++ int ret = 0; + int i; + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + (HZ / 2)) || + !data->valid) { +- data->config = i2c_smbus_read_byte_data(client, +- TMP421_CONFIG_REG_1); ++ ret = i2c_smbus_read_byte_data(client, TMP421_CONFIG_REG_1); ++ if (ret < 0) ++ goto exit; ++ data->config = ret; + + for (i = 0; i < data->channels; i++) { +- data->temp[i] = i2c_smbus_read_byte_data(client, +- TMP421_TEMP_MSB[i]) << 8; +- data->temp[i] |= i2c_smbus_read_byte_data(client, +- TMP421_TEMP_LSB[i]); ++ ret = i2c_smbus_read_byte_data(client, TMP421_TEMP_MSB[i]); ++ if (ret < 0) ++ goto exit; ++ data->temp[i] = ret << 8; ++ ++ ret = i2c_smbus_read_byte_data(client, TMP421_TEMP_LSB[i]); ++ if (ret < 0) ++ goto exit; ++ data->temp[i] |= ret; + } + data->last_updated = jiffies; + data->valid = 1; + } + ++exit: + mutex_unlock(&data->update_lock); + +- return data; ++ if (ret < 0) { ++ data->valid = 0; ++ return ret; ++ } ++ ++ return 0; + } + + static int tmp421_read(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, long *val) + { +- struct tmp421_data *tmp421 = tmp421_update_device(dev); ++ struct tmp421_data *tmp421 = dev_get_drvdata(dev); ++ int ret = 0; ++ ++ ret = tmp421_update_device(tmp421); ++ if (ret) ++ return ret; + + switch (attr) { + case hwmon_temp_input: +- if (tmp421->config & TMP421_CONFIG_RANGE) +- *val = temp_from_u16(tmp421->temp[channel]); +- else +- *val = temp_from_s16(tmp421->temp[channel]); ++ *val = temp_from_raw(tmp421->temp[channel], ++ tmp421->config & TMP421_CONFIG_RANGE); + return 0; + case hwmon_temp_fault: + /* +- * The OPEN bit signals a fault. This is bit 0 of the temperature +- * register (low byte). ++ * Any of OPEN or /PVLD bits indicate a hardware mulfunction ++ * and the conversion result may be incorrect + */ +- *val = tmp421->temp[channel] & 0x01; ++ *val = !!(tmp421->temp[channel] & 0x03); + return 0; + default: + return -EOPNOTSUPP; +@@ -177,9 +187,6 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type, + { + switch (attr) { + case hwmon_temp_fault: +- if (channel == 0) +- return 0; +- return 0444; + case hwmon_temp_input: + return 0444; + default: +diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c +index 37b25a147..3c1be2c11 100644 +--- a/drivers/hwmon/w83791d.c ++++ b/drivers/hwmon/w83791d.c +@@ -273,9 +273,6 @@ struct w83791d_data { + char valid; /* !=0 if following fields are valid */ + unsigned long last_updated; /* In jiffies */ + +- /* array of 2 pointers to subclients */ +- struct i2c_client *lm75[2]; +- + /* volts */ + u8 in[NUMBER_OF_VIN]; /* Register value */ + u8 in_max[NUMBER_OF_VIN]; /* Register value */ +@@ -1257,7 +1254,6 @@ static const struct attribute_group w83791d_group_fanpwm45 = { + static int w83791d_detect_subclients(struct i2c_client *client) + { + struct i2c_adapter *adapter = client->adapter; +- struct w83791d_data *data = i2c_get_clientdata(client); + int address = client->addr; + int i, id; + u8 val; +@@ -1280,22 +1276,19 @@ static int w83791d_detect_subclients(struct i2c_client *client) + } + + val = w83791d_read(client, W83791D_REG_I2C_SUBADDR); +- if (!(val & 0x08)) +- data->lm75[0] = devm_i2c_new_dummy_device(&client->dev, adapter, +- 0x48 + (val & 0x7)); +- if (!(val & 0x80)) { +- if (!IS_ERR(data->lm75[0]) && +- ((val & 0x7) == ((val >> 4) & 0x7))) { +- dev_err(&client->dev, +- "duplicate addresses 0x%x, " +- "use force_subclient\n", +- data->lm75[0]->addr); +- return -ENODEV; +- } +- data->lm75[1] = devm_i2c_new_dummy_device(&client->dev, adapter, +- 0x48 + ((val >> 4) & 0x7)); ++ ++ if (!(val & 0x88) && (val & 0x7) == ((val >> 4) & 0x7)) { ++ dev_err(&client->dev, ++ "duplicate addresses 0x%x, use force_subclient\n", 0x48 + (val & 0x7)); ++ return -ENODEV; + } + ++ if (!(val & 0x08)) ++ devm_i2c_new_dummy_device(&client->dev, adapter, 0x48 + (val & 0x7)); ++ ++ if (!(val & 0x80)) ++ devm_i2c_new_dummy_device(&client->dev, adapter, 0x48 + ((val >> 4) & 0x7)); ++ + return 0; + } + +diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c +index abd5c3a72..1f175f381 100644 +--- a/drivers/hwmon/w83792d.c ++++ b/drivers/hwmon/w83792d.c +@@ -264,9 +264,6 @@ struct w83792d_data { + char valid; /* !=0 if following fields are valid */ + unsigned long last_updated; /* In jiffies */ + +- /* array of 2 pointers to subclients */ +- struct i2c_client *lm75[2]; +- + u8 in[9]; /* Register value */ + u8 in_max[9]; /* Register value */ + u8 in_min[9]; /* Register value */ +@@ -927,7 +924,6 @@ w83792d_detect_subclients(struct i2c_client *new_client) + int address = new_client->addr; + u8 val; + struct i2c_adapter *adapter = new_client->adapter; +- struct w83792d_data *data = i2c_get_clientdata(new_client); + + id = i2c_adapter_id(adapter); + if (force_subclients[0] == id && force_subclients[1] == address) { +@@ -946,21 +942,19 @@ w83792d_detect_subclients(struct i2c_client *new_client) + } + + val = w83792d_read_value(new_client, W83792D_REG_I2C_SUBADDR); +- if (!(val & 0x08)) +- data->lm75[0] = devm_i2c_new_dummy_device(&new_client->dev, adapter, +- 0x48 + (val & 0x7)); +- if (!(val & 0x80)) { +- if (!IS_ERR(data->lm75[0]) && +- ((val & 0x7) == ((val >> 4) & 0x7))) { +- dev_err(&new_client->dev, +- "duplicate addresses 0x%x, use force_subclient\n", +- data->lm75[0]->addr); +- return -ENODEV; +- } +- data->lm75[1] = devm_i2c_new_dummy_device(&new_client->dev, adapter, +- 0x48 + ((val >> 4) & 0x7)); ++ ++ if (!(val & 0x88) && (val & 0x7) == ((val >> 4) & 0x7)) { ++ dev_err(&new_client->dev, ++ "duplicate addresses 0x%x, use force_subclient\n", 0x48 + (val & 0x7)); ++ return -ENODEV; + } + ++ if (!(val & 0x08)) ++ devm_i2c_new_dummy_device(&new_client->dev, adapter, 0x48 + (val & 0x7)); ++ ++ if (!(val & 0x80)) ++ devm_i2c_new_dummy_device(&new_client->dev, adapter, 0x48 + ((val >> 4) & 0x7)); ++ + return 0; + } + +diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c +index e7d0484ea..1d2854de1 100644 +--- a/drivers/hwmon/w83793.c ++++ b/drivers/hwmon/w83793.c +@@ -202,7 +202,6 @@ static inline s8 TEMP_TO_REG(long val, s8 min, s8 max) + } + + struct w83793_data { +- struct i2c_client *lm75[2]; + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if following fields are valid */ +@@ -1566,7 +1565,6 @@ w83793_detect_subclients(struct i2c_client *client) + int address = client->addr; + u8 tmp; + struct i2c_adapter *adapter = client->adapter; +- struct w83793_data *data = i2c_get_clientdata(client); + + id = i2c_adapter_id(adapter); + if (force_subclients[0] == id && force_subclients[1] == address) { +@@ -1586,21 +1584,19 @@ w83793_detect_subclients(struct i2c_client *client) + } + + tmp = w83793_read_value(client, W83793_REG_I2C_SUBADDR); +- if (!(tmp & 0x08)) +- data->lm75[0] = devm_i2c_new_dummy_device(&client->dev, adapter, +- 0x48 + (tmp & 0x7)); +- if (!(tmp & 0x80)) { +- if (!IS_ERR(data->lm75[0]) +- && ((tmp & 0x7) == ((tmp >> 4) & 0x7))) { +- dev_err(&client->dev, +- "duplicate addresses 0x%x, " +- "use force_subclients\n", data->lm75[0]->addr); +- return -ENODEV; +- } +- data->lm75[1] = devm_i2c_new_dummy_device(&client->dev, adapter, +- 0x48 + ((tmp >> 4) & 0x7)); ++ ++ if (!(tmp & 0x88) && (tmp & 0x7) == ((tmp >> 4) & 0x7)) { ++ dev_err(&client->dev, ++ "duplicate addresses 0x%x, use force_subclient\n", 0x48 + (tmp & 0x7)); ++ return -ENODEV; + } + ++ if (!(tmp & 0x08)) ++ devm_i2c_new_dummy_device(&client->dev, adapter, 0x48 + (tmp & 0x7)); ++ ++ if (!(tmp & 0x80)) ++ devm_i2c_new_dummy_device(&client->dev, adapter, 0x48 + ((tmp >> 4) & 0x7)); ++ + return 0; + } + +diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c +index 34b94e525..8e5418456 100644 +--- a/drivers/infiniband/core/cma.c ++++ b/drivers/infiniband/core/cma.c +@@ -1750,15 +1750,16 @@ static void cma_cancel_route(struct rdma_id_private *id_priv) + } + } + +-static void cma_cancel_listens(struct rdma_id_private *id_priv) ++static void _cma_cancel_listens(struct rdma_id_private *id_priv) + { + struct rdma_id_private *dev_id_priv; + ++ lockdep_assert_held(&lock); ++ + /* + * Remove from listen_any_list to prevent added devices from spawning + * additional listen requests. + */ +- mutex_lock(&lock); + list_del(&id_priv->list); + + while (!list_empty(&id_priv->listen_list)) { +@@ -1772,6 +1773,12 @@ static void cma_cancel_listens(struct rdma_id_private *id_priv) + rdma_destroy_id(&dev_id_priv->id); + mutex_lock(&lock); + } ++} ++ ++static void cma_cancel_listens(struct rdma_id_private *id_priv) ++{ ++ mutex_lock(&lock); ++ _cma_cancel_listens(id_priv); + mutex_unlock(&lock); + } + +@@ -1814,6 +1821,8 @@ static void cma_release_port(struct rdma_id_private *id_priv) + static void destroy_mc(struct rdma_id_private *id_priv, + struct cma_multicast *mc) + { ++ bool send_only = mc->join_state == BIT(SENDONLY_FULLMEMBER_JOIN); ++ + if (rdma_cap_ib_mcast(id_priv->id.device, id_priv->id.port_num)) + ib_sa_free_multicast(mc->sa_mc); + +@@ -1830,7 +1839,10 @@ static void destroy_mc(struct rdma_id_private *id_priv, + + cma_set_mgid(id_priv, (struct sockaddr *)&mc->addr, + &mgid); +- cma_igmp_send(ndev, &mgid, false); ++ ++ if (!send_only) ++ cma_igmp_send(ndev, &mgid, false); ++ + dev_put(ndev); + } + +@@ -2577,7 +2589,7 @@ static int cma_listen_on_all(struct rdma_id_private *id_priv) + return 0; + + err_listen: +- list_del(&id_priv->list); ++ _cma_cancel_listens(id_priv); + mutex_unlock(&lock); + if (to_destroy) + rdma_destroy_id(&to_destroy->id); +@@ -3732,9 +3744,13 @@ int rdma_listen(struct rdma_cm_id *id, int backlog) + int ret; + + if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_LISTEN)) { ++ struct sockaddr_in any_in = { ++ .sin_family = AF_INET, ++ .sin_addr.s_addr = htonl(INADDR_ANY), ++ }; ++ + /* For a well behaved ULP state will be RDMA_CM_IDLE */ +- id->route.addr.src_addr.ss_family = AF_INET; +- ret = rdma_bind_addr(id, cma_src_addr(id_priv)); ++ ret = rdma_bind_addr(id, (struct sockaddr *)&any_in); + if (ret) + return ret; + if (WARN_ON(!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, +diff --git a/drivers/infiniband/hw/hns/hns_roce_alloc.c b/drivers/infiniband/hw/hns/hns_roce_alloc.c +index a6b23dec1..5b2baf89d 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_alloc.c ++++ b/drivers/infiniband/hw/hns/hns_roce_alloc.c +@@ -240,7 +240,7 @@ int hns_roce_get_kmem_bufs(struct hns_roce_dev *hr_dev, dma_addr_t *bufs, + end = start + buf_cnt; + if (end > buf->npages) { + dev_err(hr_dev->dev, +- "Failed to check kmem bufs, end %d + %d total %d!\n", ++ "failed to check kmem bufs, end %d + %d total %u!\n", + start, buf_cnt, buf->npages); + return -EINVAL; + } +@@ -262,7 +262,7 @@ int hns_roce_get_umem_bufs(struct hns_roce_dev *hr_dev, dma_addr_t *bufs, + u64 addr; + + if (page_shift < HNS_HW_PAGE_SHIFT) { +- dev_err(hr_dev->dev, "Failed to check umem page shift %d!\n", ++ dev_err(hr_dev->dev, "failed to check umem page shift %u!\n", + page_shift); + return -EINVAL; + } +diff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c +index da346129f..8a6bded9c 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_cq.c ++++ b/drivers/infiniband/hw/hns/hns_roce_cq.c +@@ -50,29 +50,29 @@ static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq) + + ret = hns_roce_mtr_find(hr_dev, &hr_cq->mtr, 0, mtts, ARRAY_SIZE(mtts), + &dma_handle); +- if (ret < 1) { +- ibdev_err(ibdev, "Failed to find CQ mtr\n"); ++ if (!ret) { ++ ibdev_err(ibdev, "failed to find CQ mtr, ret = %d.\n", ret); + return -EINVAL; + } + + cq_table = &hr_dev->cq_table; + ret = hns_roce_bitmap_alloc(&cq_table->bitmap, &hr_cq->cqn); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc CQ bitmap, err %d\n", ret); ++ ibdev_err(ibdev, "failed to alloc CQ bitmap, ret = %d.\n", ret); + return ret; + } + + /* Get CQC memory HEM(Hardware Entry Memory) table */ + ret = hns_roce_table_get(hr_dev, &cq_table->table, hr_cq->cqn); + if (ret) { +- ibdev_err(ibdev, "Failed to get CQ(0x%lx) context, err %d\n", ++ ibdev_err(ibdev, "failed to get CQ(0x%lx) context, ret = %d.\n", + hr_cq->cqn, ret); + goto err_out; + } + + ret = xa_err(xa_store(&cq_table->array, hr_cq->cqn, hr_cq, GFP_KERNEL)); + if (ret) { +- ibdev_err(ibdev, "Failed to xa_store CQ\n"); ++ ibdev_err(ibdev, "failed to xa_store CQ, ret = %d.\n", ret); + goto err_put; + } + +@@ -91,7 +91,7 @@ static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq) + hns_roce_free_cmd_mailbox(hr_dev, mailbox); + if (ret) { + ibdev_err(ibdev, +- "Failed to send create cmd for CQ(0x%lx), err %d\n", ++ "failed to send create cmd for CQ(0x%lx), ret = %d.\n", + hr_cq->cqn, ret); + goto err_xa; + } +@@ -147,7 +147,7 @@ static int alloc_cq_buf(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq, + { + struct ib_device *ibdev = &hr_dev->ib_dev; + struct hns_roce_buf_attr buf_attr = {}; +- int err; ++ int ret; + + buf_attr.page_shift = hr_dev->caps.cqe_buf_pg_sz + HNS_HW_PAGE_SHIFT; + buf_attr.region[0].size = hr_cq->cq_depth * hr_cq->cqe_size; +@@ -155,13 +155,13 @@ static int alloc_cq_buf(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq, + buf_attr.region_count = 1; + buf_attr.fixed_page = true; + +- err = hns_roce_mtr_create(hr_dev, &hr_cq->mtr, &buf_attr, ++ ret = hns_roce_mtr_create(hr_dev, &hr_cq->mtr, &buf_attr, + hr_dev->caps.cqe_ba_pg_sz + HNS_HW_PAGE_SHIFT, + udata, addr); +- if (err) +- ibdev_err(ibdev, "Failed to alloc CQ mtr, err %d\n", err); ++ if (ret) ++ ibdev_err(ibdev, "failed to alloc CQ mtr, ret = %d.\n", ret); + +- return err; ++ return ret; + } + + static void free_cq_buf(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq) +@@ -252,13 +252,13 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr, + int ret; + + if (cq_entries < 1 || cq_entries > hr_dev->caps.max_cqes) { +- ibdev_err(ibdev, "Failed to check CQ count %d max=%d\n", ++ ibdev_err(ibdev, "failed to check CQ count %u, max = %u.\n", + cq_entries, hr_dev->caps.max_cqes); + return -EINVAL; + } + + if (vector >= hr_dev->caps.num_comp_vectors) { +- ibdev_err(ibdev, "Failed to check CQ vector=%d max=%d\n", ++ ibdev_err(ibdev, "failed to check CQ vector = %d, max = %d.\n", + vector, hr_dev->caps.num_comp_vectors); + return -EINVAL; + } +@@ -276,7 +276,7 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr, + ret = ib_copy_from_udata(&ucmd, udata, + min(udata->inlen, sizeof(ucmd))); + if (ret) { +- ibdev_err(ibdev, "Failed to copy CQ udata, err %d\n", ++ ibdev_err(ibdev, "failed to copy CQ udata, ret = %d.\n", + ret); + return ret; + } +@@ -286,19 +286,20 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr, + + ret = alloc_cq_buf(hr_dev, hr_cq, udata, ucmd.buf_addr); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc CQ buf, err %d\n", ret); ++ ibdev_err(ibdev, "failed to alloc CQ buf, ret = %d.\n", ret); + return ret; + } + + ret = alloc_cq_db(hr_dev, hr_cq, udata, ucmd.db_addr, &resp); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc CQ db, err %d\n", ret); ++ ibdev_err(ibdev, "failed to alloc CQ db, ret = %d.\n", ret); + goto err_cq_buf; + } + + ret = alloc_cqc(hr_dev, hr_cq); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc CQ context, err %d\n", ret); ++ ibdev_err(ibdev, ++ "failed to alloc CQ context, ret = %d.\n", ret); + goto err_cq_db; + } + +diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.c b/drivers/infiniband/hw/hns/hns_roce_hem.c +index 66f9f036e..c880a8be7 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_hem.c ++++ b/drivers/infiniband/hw/hns/hns_roce_hem.c +@@ -184,7 +184,7 @@ static int get_hem_table_config(struct hns_roce_dev *hr_dev, + mhop->hop_num = hr_dev->caps.srqc_hop_num; + break; + default: +- dev_err(dev, "Table %d not support multi-hop addressing!\n", ++ dev_err(dev, "table %u not support multi-hop addressing!\n", + type); + return -EINVAL; + } +@@ -232,8 +232,8 @@ int hns_roce_calc_hem_mhop(struct hns_roce_dev *hr_dev, + mhop->l0_idx = table_idx; + break; + default: +- dev_err(dev, "Table %d not support hop_num = %d!\n", +- table->type, mhop->hop_num); ++ dev_err(dev, "table %u not support hop_num = %u!\n", ++ table->type, mhop->hop_num); + return -EINVAL; + } + if (mhop->l0_idx >= mhop->ba_l0_num) +@@ -438,13 +438,13 @@ static int calc_hem_config(struct hns_roce_dev *hr_dev, + index->buf = l0_idx; + break; + default: +- ibdev_err(ibdev, "Table %d not support mhop.hop_num = %d!\n", ++ ibdev_err(ibdev, "table %u not support mhop.hop_num = %u!\n", + table->type, mhop->hop_num); + return -EINVAL; + } + + if (unlikely(index->buf >= table->num_hem)) { +- ibdev_err(ibdev, "Table %d exceed hem limt idx %llu,max %lu!\n", ++ ibdev_err(ibdev, "table %u exceed hem limt idx %llu, max %lu!\n", + table->type, index->buf, table->num_hem); + return -EINVAL; + } +@@ -714,15 +714,15 @@ static void clear_mhop_hem(struct hns_roce_dev *hr_dev, + step_idx = hop_num; + + if (hr_dev->hw->clear_hem(hr_dev, table, obj, step_idx)) +- ibdev_warn(ibdev, "Clear hop%d HEM failed.\n", hop_num); ++ ibdev_warn(ibdev, "failed to clear hop%u HEM.\n", hop_num); + + if (index->inited & HEM_INDEX_L1) + if (hr_dev->hw->clear_hem(hr_dev, table, obj, 1)) +- ibdev_warn(ibdev, "Clear HEM step 1 failed.\n"); ++ ibdev_warn(ibdev, "failed to clear HEM step 1.\n"); + + if (index->inited & HEM_INDEX_L0) + if (hr_dev->hw->clear_hem(hr_dev, table, obj, 0)) +- ibdev_warn(ibdev, "Clear HEM step 0 failed.\n"); ++ ibdev_warn(ibdev, "failed to clear HEM step 0.\n"); + } + } + +@@ -1234,7 +1234,7 @@ static int hem_list_alloc_mid_bt(struct hns_roce_dev *hr_dev, + } + + if (offset < r->offset) { +- dev_err(hr_dev->dev, "invalid offset %d,min %d!\n", ++ dev_err(hr_dev->dev, "invalid offset %d, min %u!\n", + offset, r->offset); + return -EINVAL; + } +diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +index ebcf26dec..c29ba8ee5 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c ++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +@@ -361,7 +361,7 @@ static int check_send_valid(struct hns_roce_dev *hr_dev, + } else if (unlikely(hr_qp->state == IB_QPS_RESET || + hr_qp->state == IB_QPS_INIT || + hr_qp->state == IB_QPS_RTR)) { +- ibdev_err(ibdev, "failed to post WQE, QP state %d!\n", ++ ibdev_err(ibdev, "failed to post WQE, QP state %hhu!\n", + hr_qp->state); + return -EINVAL; + } else if (unlikely(hr_dev->state >= HNS_ROCE_DEVICE_STATE_RST_DOWN)) { +@@ -665,7 +665,7 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, + wqe_idx = (qp->sq.head + nreq) & (qp->sq.wqe_cnt - 1); + + if (unlikely(wr->num_sge > qp->sq.max_gs)) { +- ibdev_err(ibdev, "num_sge=%d > qp->sq.max_gs=%d\n", ++ ibdev_err(ibdev, "num_sge = %d > qp->sq.max_gs = %u.\n", + wr->num_sge, qp->sq.max_gs); + ret = -EINVAL; + *bad_wr = wr; +@@ -750,7 +750,7 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp, + wqe_idx = (hr_qp->rq.head + nreq) & (hr_qp->rq.wqe_cnt - 1); + + if (unlikely(wr->num_sge > hr_qp->rq.max_gs)) { +- ibdev_err(ibdev, "rq:num_sge=%d >= qp->sq.max_gs=%d\n", ++ ibdev_err(ibdev, "num_sge = %d >= max_sge = %u.\n", + wr->num_sge, hr_qp->rq.max_gs); + ret = -EINVAL; + *bad_wr = wr; +@@ -1920,8 +1920,8 @@ static void calc_pg_sz(int obj_num, int obj_size, int hop_num, int ctx_bt_num, + obj_per_chunk = ctx_bt_num * obj_per_chunk_default; + break; + default: +- pr_err("Table %d not support hop_num = %d!\n", hem_type, +- hop_num); ++ pr_err("table %u not support hop_num = %u!\n", hem_type, ++ hop_num); + return; + } + +@@ -3562,7 +3562,7 @@ static int get_op_for_set_hem(struct hns_roce_dev *hr_dev, u32 type, + break; + default: + dev_warn(hr_dev->dev, +- "Table %d not to be written by mailbox!\n", type); ++ "table %u not to be written by mailbox!\n", type); + return -EINVAL; + } + +@@ -3681,7 +3681,7 @@ static int hns_roce_v2_clear_hem(struct hns_roce_dev *hr_dev, + op = HNS_ROCE_CMD_DESTROY_SRQC_BT0; + break; + default: +- dev_warn(dev, "Table %d not to be destroyed by mailbox!\n", ++ dev_warn(dev, "table %u not to be destroyed by mailbox!\n", + table->type); + return 0; + } +@@ -4318,7 +4318,7 @@ static int modify_qp_rtr_to_rts(struct ib_qp *ibqp, + + ret = config_qp_sq_buf(hr_dev, hr_qp, context, qpc_mask); + if (ret) { +- ibdev_err(ibdev, "failed to config sq buf, ret %d\n", ret); ++ ibdev_err(ibdev, "failed to config sq buf, ret = %d.\n", ret); + return ret; + } + +@@ -4804,7 +4804,7 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp, + /* SW pass context to HW */ + ret = hns_roce_v2_qp_modify(hr_dev, context, qpc_mask, hr_qp); + if (ret) { +- ibdev_err(ibdev, "failed to modify QP, ret = %d\n", ret); ++ ibdev_err(ibdev, "failed to modify QP, ret = %d.\n", ret); + goto out; + } + +@@ -4897,7 +4897,7 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, + + ret = hns_roce_v2_query_qpc(hr_dev, hr_qp, &context); + if (ret) { +- ibdev_err(ibdev, "failed to query QPC, ret = %d\n", ret); ++ ibdev_err(ibdev, "failed to query QPC, ret = %d.\n", ret); + ret = -EINVAL; + goto out; + } +@@ -5018,7 +5018,7 @@ static int hns_roce_v2_destroy_qp_common(struct hns_roce_dev *hr_dev, + hr_qp->state, IB_QPS_RESET); + if (ret) + ibdev_err(ibdev, +- "failed to modify QP to RST, ret = %d\n", ++ "failed to modify QP to RST, ret = %d.\n", + ret); + } + +@@ -5057,7 +5057,7 @@ static int hns_roce_v2_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata) + ret = hns_roce_v2_destroy_qp_common(hr_dev, hr_qp, udata); + if (ret) + ibdev_err(&hr_dev->ib_dev, +- "failed to destroy QP 0x%06lx, ret = %d\n", ++ "failed to destroy QP, QPN = 0x%06lx, ret = %d.\n", + hr_qp->qpn, ret); + + hns_roce_qp_destroy(hr_dev, hr_qp, udata); +@@ -5080,7 +5080,7 @@ static int hns_roce_v2_qp_flow_control_init(struct hns_roce_dev *hr_dev, + hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_RESET_SCCC, false); + ret = hns_roce_cmq_send(hr_dev, &desc, 1); + if (ret) { +- ibdev_err(ibdev, "failed to reset SCC ctx, ret = %d\n", ret); ++ ibdev_err(ibdev, "failed to reset SCC ctx, ret = %d.\n", ret); + goto out; + } + +@@ -5090,7 +5090,7 @@ static int hns_roce_v2_qp_flow_control_init(struct hns_roce_dev *hr_dev, + clr->qpn = cpu_to_le32(hr_qp->qpn); + ret = hns_roce_cmq_send(hr_dev, &desc, 1); + if (ret) { +- ibdev_err(ibdev, "failed to clear SCC ctx, ret = %d\n", ret); ++ ibdev_err(ibdev, "failed to clear SCC ctx, ret = %d.\n", ret); + goto out; + } + +@@ -5339,7 +5339,7 @@ static int hns_roce_v2_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period) + hns_roce_free_cmd_mailbox(hr_dev, mailbox); + if (ret) + ibdev_err(&hr_dev->ib_dev, +- "failed to process cmd when modifying CQ, ret = %d\n", ++ "failed to process cmd when modifying CQ, ret = %d.\n", + ret); + + return ret; +diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c +index 7f81a695e..027ec8413 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_mr.c ++++ b/drivers/infiniband/hw/hns/hns_roce_mr.c +@@ -185,14 +185,14 @@ static int hns_roce_mr_enable(struct hns_roce_dev *hr_dev, + else + ret = hr_dev->hw->frmr_write_mtpt(hr_dev, mailbox->buf, mr); + if (ret) { +- dev_err(dev, "Write mtpt fail!\n"); ++ dev_err(dev, "failed to write mtpt, ret = %d.\n", ret); + goto err_page; + } + + ret = hns_roce_hw_create_mpt(hr_dev, mailbox, + mtpt_idx & (hr_dev->caps.num_mtpts - 1)); + if (ret) { +- dev_err(dev, "CREATE_MPT failed (%d)\n", ret); ++ dev_err(dev, "failed to create mpt, ret = %d.\n", ret); + goto err_page; + } + +@@ -495,7 +495,7 @@ int hns_roce_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, + + ret = ib_sg_to_pages(ibmr, sg, sg_nents, sg_offset, hns_roce_set_page); + if (ret < 1) { +- ibdev_err(ibdev, "failed to store sg pages %d %d, cnt = %d.\n", ++ ibdev_err(ibdev, "failed to store sg pages %u %u, cnt = %d.\n", + mr->npages, mr->pbl_mtr.hem_cfg.buf_pg_count, ret); + goto err_page_list; + } +@@ -862,7 +862,7 @@ int hns_roce_mtr_map(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr, + if (r->offset + r->count > page_cnt) { + err = -EINVAL; + ibdev_err(ibdev, +- "Failed to check mtr%d end %d + %d, max %d\n", ++ "failed to check mtr%u end %u + %u, max %u.\n", + i, r->offset, r->count, page_cnt); + return err; + } +@@ -870,7 +870,7 @@ int hns_roce_mtr_map(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr, + err = mtr_map_region(hr_dev, mtr, &pages[r->offset], r); + if (err) { + ibdev_err(ibdev, +- "Failed to map mtr%d offset %d, err %d\n", ++ "failed to map mtr%u offset %u, ret = %d.\n", + i, r->offset, err); + return err; + } +diff --git a/drivers/infiniband/hw/hns/hns_roce_pd.c b/drivers/infiniband/hw/hns/hns_roce_pd.c +index f78fa1d3d..012a769d6 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_pd.c ++++ b/drivers/infiniband/hw/hns/hns_roce_pd.c +@@ -65,7 +65,7 @@ int hns_roce_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) + + ret = hns_roce_pd_alloc(to_hr_dev(ib_dev), &pd->pdn); + if (ret) { +- ibdev_err(ib_dev, "failed to alloc pd, ret = %d\n", ret); ++ ibdev_err(ib_dev, "failed to alloc pd, ret = %d.\n", ret); + return ret; + } + +diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c +index 7ce9ad8ae..291e06d63 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_qp.c ++++ b/drivers/infiniband/hw/hns/hns_roce_qp.c +@@ -452,12 +452,12 @@ static int check_sq_size_with_integrity(struct hns_roce_dev *hr_dev, + /* Sanity check SQ size before proceeding */ + if (ucmd->log_sq_stride > max_sq_stride || + ucmd->log_sq_stride < HNS_ROCE_IB_MIN_SQ_STRIDE) { +- ibdev_err(&hr_dev->ib_dev, "Failed to check SQ stride size\n"); ++ ibdev_err(&hr_dev->ib_dev, "failed to check SQ stride size.\n"); + return -EINVAL; + } + + if (cap->max_send_sge > hr_dev->caps.max_sq_sg) { +- ibdev_err(&hr_dev->ib_dev, "Failed to check SQ SGE size %d\n", ++ ibdev_err(&hr_dev->ib_dev, "failed to check SQ SGE size %u.\n", + cap->max_send_sge); + return -EINVAL; + } +@@ -563,7 +563,7 @@ static int set_kernel_sq_size(struct hns_roce_dev *hr_dev, + + cnt = roundup_pow_of_two(max(cap->max_send_wr, hr_dev->caps.min_wqes)); + if (cnt > hr_dev->caps.max_wqes) { +- ibdev_err(ibdev, "failed to check WQE num, WQE num = %d.\n", ++ ibdev_err(ibdev, "failed to check WQE num, WQE num = %u.\n", + cnt); + return -EINVAL; + } +@@ -736,7 +736,8 @@ static int alloc_qp_db(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, + &hr_qp->sdb); + if (ret) { + ibdev_err(ibdev, +- "Failed to map user SQ doorbell\n"); ++ "failed to map user SQ doorbell, ret = %d.\n", ++ ret); + goto err_out; + } + hr_qp->en_flags |= HNS_ROCE_QP_CAP_SQ_RECORD_DB; +@@ -747,7 +748,8 @@ static int alloc_qp_db(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, + &hr_qp->rdb); + if (ret) { + ibdev_err(ibdev, +- "Failed to map user RQ doorbell\n"); ++ "failed to map user RQ doorbell, ret = %d.\n", ++ ret); + goto err_sdb; + } + hr_qp->en_flags |= HNS_ROCE_QP_CAP_RQ_RECORD_DB; +@@ -763,7 +765,8 @@ static int alloc_qp_db(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, + ret = hns_roce_alloc_db(hr_dev, &hr_qp->rdb, 0); + if (ret) { + ibdev_err(ibdev, +- "Failed to alloc kernel RQ doorbell\n"); ++ "failed to alloc kernel RQ doorbell, ret = %d.\n", ++ ret); + goto err_out; + } + *hr_qp->rdb.db_record = 0; +@@ -806,14 +809,14 @@ static int alloc_kernel_wrid(struct hns_roce_dev *hr_dev, + + sq_wrid = kcalloc(hr_qp->sq.wqe_cnt, sizeof(u64), GFP_KERNEL); + if (ZERO_OR_NULL_PTR(sq_wrid)) { +- ibdev_err(ibdev, "Failed to alloc SQ wrid\n"); ++ ibdev_err(ibdev, "failed to alloc SQ wrid.\n"); + return -ENOMEM; + } + + if (hr_qp->rq.wqe_cnt) { + rq_wrid = kcalloc(hr_qp->rq.wqe_cnt, sizeof(u64), GFP_KERNEL); + if (ZERO_OR_NULL_PTR(rq_wrid)) { +- ibdev_err(ibdev, "Failed to alloc RQ wrid\n"); ++ ibdev_err(ibdev, "failed to alloc RQ wrid.\n"); + ret = -ENOMEM; + goto err_sq; + } +@@ -873,7 +876,9 @@ static int set_qp_param(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, + + ret = set_user_sq_size(hr_dev, &init_attr->cap, hr_qp, ucmd); + if (ret) +- ibdev_err(ibdev, "Failed to set user SQ size\n"); ++ ibdev_err(ibdev, ++ "failed to set user SQ size, ret = %d.\n", ++ ret); + } else { + if (init_attr->create_flags & + IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK) { +@@ -888,7 +893,9 @@ static int set_qp_param(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp, + + ret = set_kernel_sq_size(hr_dev, &init_attr->cap, hr_qp); + if (ret) +- ibdev_err(ibdev, "Failed to set kernel SQ size\n"); ++ ibdev_err(ibdev, ++ "failed to set kernel SQ size, ret = %d.\n", ++ ret); + } + + return ret; +@@ -914,45 +921,48 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev, + + ret = set_qp_param(hr_dev, hr_qp, init_attr, udata, &ucmd); + if (ret) { +- ibdev_err(ibdev, "Failed to set QP param\n"); ++ ibdev_err(ibdev, "failed to set QP param, ret = %d.\n", ret); + return ret; + } + + if (!udata) { + ret = alloc_kernel_wrid(hr_dev, hr_qp); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc wrid\n"); ++ ibdev_err(ibdev, "failed to alloc wrid, ret = %d.\n", ++ ret); + return ret; + } + } + + ret = alloc_qp_db(hr_dev, hr_qp, init_attr, udata, &ucmd, &resp); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc QP doorbell\n"); ++ ibdev_err(ibdev, "failed to alloc QP doorbell, ret = %d.\n", ++ ret); + goto err_wrid; + } + + ret = alloc_qp_buf(hr_dev, hr_qp, init_attr, udata, ucmd.buf_addr); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc QP buffer\n"); ++ ibdev_err(ibdev, "failed to alloc QP buffer, ret = %d.\n", ret); + goto err_db; + } + + ret = alloc_qpn(hr_dev, hr_qp); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc QPN\n"); ++ ibdev_err(ibdev, "failed to alloc QPN, ret = %d.\n", ret); + goto err_buf; + } + + ret = alloc_qpc(hr_dev, hr_qp); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc QP context\n"); ++ ibdev_err(ibdev, "failed to alloc QP context, ret = %d.\n", ++ ret); + goto err_qpn; + } + + ret = hns_roce_qp_store(hr_dev, hr_qp, init_attr); + if (ret) { +- ibdev_err(ibdev, "Failed to store QP\n"); ++ ibdev_err(ibdev, "failed to store QP, ret = %d.\n", ret); + goto err_qpc; + } + +@@ -1098,9 +1108,8 @@ static int hns_roce_check_qp_attr(struct ib_qp *ibqp, struct ib_qp_attr *attr, + + if ((attr_mask & IB_QP_PORT) && + (attr->port_num == 0 || attr->port_num > hr_dev->caps.num_ports)) { +- ibdev_err(&hr_dev->ib_dev, +- "attr port_num invalid.attr->port_num=%d\n", +- attr->port_num); ++ ibdev_err(&hr_dev->ib_dev, "invalid attr, port_num = %u.\n", ++ attr->port_num); + return -EINVAL; + } + +@@ -1108,8 +1117,8 @@ static int hns_roce_check_qp_attr(struct ib_qp *ibqp, struct ib_qp_attr *attr, + p = attr_mask & IB_QP_PORT ? (attr->port_num - 1) : hr_qp->port; + if (attr->pkey_index >= hr_dev->caps.pkey_table_len[p]) { + ibdev_err(&hr_dev->ib_dev, +- "attr pkey_index invalid.attr->pkey_index=%d\n", +- attr->pkey_index); ++ "invalid attr, pkey_index = %u.\n", ++ attr->pkey_index); + return -EINVAL; + } + } +@@ -1117,16 +1126,16 @@ static int hns_roce_check_qp_attr(struct ib_qp *ibqp, struct ib_qp_attr *attr, + if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && + attr->max_rd_atomic > hr_dev->caps.max_qp_init_rdma) { + ibdev_err(&hr_dev->ib_dev, +- "attr max_rd_atomic invalid.attr->max_rd_atomic=%d\n", +- attr->max_rd_atomic); ++ "invalid attr, max_rd_atomic = %u.\n", ++ attr->max_rd_atomic); + return -EINVAL; + } + + if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC && + attr->max_dest_rd_atomic > hr_dev->caps.max_qp_dest_rdma) { + ibdev_err(&hr_dev->ib_dev, +- "attr max_dest_rd_atomic invalid.attr->max_dest_rd_atomic=%d\n", +- attr->max_dest_rd_atomic); ++ "invalid attr, max_dest_rd_atomic = %u.\n", ++ attr->max_dest_rd_atomic); + return -EINVAL; + } + +diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c +index 75d74f4bb..f27523e1a 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_srq.c ++++ b/drivers/infiniband/hw/hns/hns_roce_srq.c +@@ -93,7 +93,8 @@ static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq, + ret = hns_roce_mtr_find(hr_dev, &srq->buf_mtr, 0, mtts_wqe, + ARRAY_SIZE(mtts_wqe), &dma_handle_wqe); + if (ret < 1) { +- ibdev_err(ibdev, "Failed to find mtr for SRQ WQE\n"); ++ ibdev_err(ibdev, "failed to find mtr for SRQ WQE, ret = %d.\n", ++ ret); + return -ENOBUFS; + } + +@@ -101,32 +102,34 @@ static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq, + ret = hns_roce_mtr_find(hr_dev, &srq->idx_que.mtr, 0, mtts_idx, + ARRAY_SIZE(mtts_idx), &dma_handle_idx); + if (ret < 1) { +- ibdev_err(ibdev, "Failed to find mtr for SRQ idx\n"); ++ ibdev_err(ibdev, "failed to find mtr for SRQ idx, ret = %d.\n", ++ ret); + return -ENOBUFS; + } + + ret = hns_roce_bitmap_alloc(&srq_table->bitmap, &srq->srqn); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc SRQ number, err %d\n", ret); ++ ibdev_err(ibdev, ++ "failed to alloc SRQ number, ret = %d.\n", ret); + return -ENOMEM; + } + + ret = hns_roce_table_get(hr_dev, &srq_table->table, srq->srqn); + if (ret) { +- ibdev_err(ibdev, "Failed to get SRQC table, err %d\n", ret); ++ ibdev_err(ibdev, "failed to get SRQC table, ret = %d.\n", ret); + goto err_out; + } + + ret = xa_err(xa_store(&srq_table->xa, srq->srqn, srq, GFP_KERNEL)); + if (ret) { +- ibdev_err(ibdev, "Failed to store SRQC, err %d\n", ret); ++ ibdev_err(ibdev, "failed to store SRQC, ret = %d.\n", ret); + goto err_put; + } + + mailbox = hns_roce_alloc_cmd_mailbox(hr_dev); + if (IS_ERR_OR_NULL(mailbox)) { + ret = -ENOMEM; +- ibdev_err(ibdev, "Failed to alloc mailbox for SRQC\n"); ++ ibdev_err(ibdev, "failed to alloc mailbox for SRQC.\n"); + goto err_xa; + } + +@@ -137,7 +140,7 @@ static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq, + ret = hns_roce_hw_create_srq(hr_dev, mailbox, srq->srqn); + hns_roce_free_cmd_mailbox(hr_dev, mailbox); + if (ret) { +- ibdev_err(ibdev, "Failed to config SRQC, err %d\n", ret); ++ ibdev_err(ibdev, "failed to config SRQC, ret = %d.\n", ret); + goto err_xa; + } + +@@ -198,7 +201,8 @@ static int alloc_srq_buf(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq, + hr_dev->caps.srqwqe_ba_pg_sz + + HNS_HW_PAGE_SHIFT, udata, addr); + if (err) +- ibdev_err(ibdev, "Failed to alloc SRQ buf mtr, err %d\n", err); ++ ibdev_err(ibdev, ++ "failed to alloc SRQ buf mtr, ret = %d.\n", err); + + return err; + } +@@ -229,14 +233,15 @@ static int alloc_srq_idx(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq, + hr_dev->caps.idx_ba_pg_sz + HNS_HW_PAGE_SHIFT, + udata, addr); + if (err) { +- ibdev_err(ibdev, "Failed to alloc SRQ idx mtr, err %d\n", err); ++ ibdev_err(ibdev, ++ "failed to alloc SRQ idx mtr, ret = %d.\n", err); + return err; + } + + if (!udata) { + idx_que->bitmap = bitmap_zalloc(srq->wqe_cnt, GFP_KERNEL); + if (!idx_que->bitmap) { +- ibdev_err(ibdev, "Failed to alloc SRQ idx bitmap\n"); ++ ibdev_err(ibdev, "failed to alloc SRQ idx bitmap.\n"); + err = -ENOMEM; + goto err_idx_mtr; + } +@@ -303,7 +308,7 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, + ret = ib_copy_from_udata(&ucmd, udata, + min(udata->inlen, sizeof(ucmd))); + if (ret) { +- ibdev_err(ibdev, "Failed to copy SRQ udata, err %d\n", ++ ibdev_err(ibdev, "failed to copy SRQ udata, ret = %d.\n", + ret); + return ret; + } +@@ -311,20 +316,21 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, + + ret = alloc_srq_buf(hr_dev, srq, udata, ucmd.buf_addr); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc SRQ buffer, err %d\n", ret); ++ ibdev_err(ibdev, ++ "failed to alloc SRQ buffer, ret = %d.\n", ret); + return ret; + } + + ret = alloc_srq_idx(hr_dev, srq, udata, ucmd.que_addr); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc SRQ idx, err %d\n", ret); ++ ibdev_err(ibdev, "failed to alloc SRQ idx, ret = %d.\n", ret); + goto err_buf_alloc; + } + + if (!udata) { + ret = alloc_srq_wrid(hr_dev, srq); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc SRQ wrid, err %d\n", ++ ibdev_err(ibdev, "failed to alloc SRQ wrid, ret = %d.\n", + ret); + goto err_idx_alloc; + } +@@ -336,7 +342,8 @@ int hns_roce_create_srq(struct ib_srq *ib_srq, + + ret = alloc_srqc(hr_dev, srq, to_hr_pd(ib_srq->pd)->pdn, cqn, 0, 0); + if (ret) { +- ibdev_err(ibdev, "Failed to alloc SRQ context, err %d\n", ret); ++ ibdev_err(ibdev, ++ "failed to alloc SRQ context, ret = %d.\n", ret); + goto err_wrid_alloc; + } + +diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c +index d480a514c..1f7512c99 100644 +--- a/drivers/ipack/devices/ipoctal.c ++++ b/drivers/ipack/devices/ipoctal.c +@@ -35,6 +35,7 @@ struct ipoctal_channel { + unsigned int pointer_read; + unsigned int pointer_write; + struct tty_port tty_port; ++ bool tty_registered; + union scc2698_channel __iomem *regs; + union scc2698_block __iomem *block_regs; + unsigned int board_id; +@@ -83,22 +84,34 @@ static int ipoctal_port_activate(struct tty_port *port, struct tty_struct *tty) + return 0; + } + +-static int ipoctal_open(struct tty_struct *tty, struct file *file) ++static int ipoctal_install(struct tty_driver *driver, struct tty_struct *tty) + { + struct ipoctal_channel *channel = dev_get_drvdata(tty->dev); + struct ipoctal *ipoctal = chan_to_ipoctal(channel, tty->index); +- int err; +- +- tty->driver_data = channel; ++ int res; + + if (!ipack_get_carrier(ipoctal->dev)) + return -EBUSY; + +- err = tty_port_open(&channel->tty_port, tty, file); +- if (err) +- ipack_put_carrier(ipoctal->dev); ++ res = tty_standard_install(driver, tty); ++ if (res) ++ goto err_put_carrier; ++ ++ tty->driver_data = channel; ++ ++ return 0; ++ ++err_put_carrier: ++ ipack_put_carrier(ipoctal->dev); ++ ++ return res; ++} ++ ++static int ipoctal_open(struct tty_struct *tty, struct file *file) ++{ ++ struct ipoctal_channel *channel = tty->driver_data; + +- return err; ++ return tty_port_open(&channel->tty_port, tty, file); + } + + static void ipoctal_reset_stats(struct ipoctal_stats *stats) +@@ -266,7 +279,6 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, + int res; + int i; + struct tty_driver *tty; +- char name[20]; + struct ipoctal_channel *channel; + struct ipack_region *region; + void __iomem *addr; +@@ -357,8 +369,11 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, + /* Fill struct tty_driver with ipoctal data */ + tty->owner = THIS_MODULE; + tty->driver_name = KBUILD_MODNAME; +- sprintf(name, KBUILD_MODNAME ".%d.%d.", bus_nr, slot); +- tty->name = name; ++ tty->name = kasprintf(GFP_KERNEL, KBUILD_MODNAME ".%d.%d.", bus_nr, slot); ++ if (!tty->name) { ++ res = -ENOMEM; ++ goto err_put_driver; ++ } + tty->major = 0; + + tty->minor_start = 0; +@@ -374,8 +389,7 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, + res = tty_register_driver(tty); + if (res) { + dev_err(&ipoctal->dev->dev, "Can't register tty driver.\n"); +- put_tty_driver(tty); +- return res; ++ goto err_free_name; + } + + /* Save struct tty_driver for use it when uninstalling the device */ +@@ -386,7 +400,9 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, + + channel = &ipoctal->channel[i]; + tty_port_init(&channel->tty_port); +- tty_port_alloc_xmit_buf(&channel->tty_port); ++ res = tty_port_alloc_xmit_buf(&channel->tty_port); ++ if (res) ++ continue; + channel->tty_port.ops = &ipoctal_tty_port_ops; + + ipoctal_reset_stats(&channel->stats); +@@ -394,13 +410,15 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, + spin_lock_init(&channel->lock); + channel->pointer_read = 0; + channel->pointer_write = 0; +- tty_dev = tty_port_register_device(&channel->tty_port, tty, i, NULL); ++ tty_dev = tty_port_register_device_attr(&channel->tty_port, tty, ++ i, NULL, channel, NULL); + if (IS_ERR(tty_dev)) { + dev_err(&ipoctal->dev->dev, "Failed to register tty device.\n"); ++ tty_port_free_xmit_buf(&channel->tty_port); + tty_port_destroy(&channel->tty_port); + continue; + } +- dev_set_drvdata(tty_dev, channel); ++ channel->tty_registered = true; + } + + /* +@@ -412,6 +430,13 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, + ipoctal_irq_handler, ipoctal); + + return 0; ++ ++err_free_name: ++ kfree(tty->name); ++err_put_driver: ++ put_tty_driver(tty); ++ ++ return res; + } + + static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel, +@@ -652,6 +677,7 @@ static void ipoctal_cleanup(struct tty_struct *tty) + + static const struct tty_operations ipoctal_fops = { + .ioctl = NULL, ++ .install = ipoctal_install, + .open = ipoctal_open, + .close = ipoctal_close, + .write = ipoctal_write_tty, +@@ -694,12 +720,17 @@ static void __ipoctal_remove(struct ipoctal *ipoctal) + + for (i = 0; i < NR_CHANNELS; i++) { + struct ipoctal_channel *channel = &ipoctal->channel[i]; ++ ++ if (!channel->tty_registered) ++ continue; ++ + tty_unregister_device(ipoctal->tty_drv, i); + tty_port_free_xmit_buf(&channel->tty_port); + tty_port_destroy(&channel->tty_port); + } + + tty_unregister_driver(ipoctal->tty_drv); ++ kfree(ipoctal->tty_drv->name); + put_tty_driver(ipoctal->tty_drv); + kfree(ipoctal); + } +diff --git a/drivers/media/rc/ir_toy.c b/drivers/media/rc/ir_toy.c +index 3e729a17b..48d52baec 100644 +--- a/drivers/media/rc/ir_toy.c ++++ b/drivers/media/rc/ir_toy.c +@@ -24,6 +24,7 @@ static const u8 COMMAND_VERSION[] = { 'v' }; + // End transmit and repeat reset command so we exit sump mode + static const u8 COMMAND_RESET[] = { 0xff, 0xff, 0, 0, 0, 0, 0 }; + static const u8 COMMAND_SMODE_ENTER[] = { 's' }; ++static const u8 COMMAND_SMODE_EXIT[] = { 0 }; + static const u8 COMMAND_TXSTART[] = { 0x26, 0x24, 0x25, 0x03 }; + + #define REPLY_XMITCOUNT 't' +@@ -309,12 +310,30 @@ static int irtoy_tx(struct rc_dev *rc, uint *txbuf, uint count) + buf[i] = cpu_to_be16(v); + } + +- buf[count] = cpu_to_be16(0xffff); ++ buf[count] = 0xffff; + + irtoy->tx_buf = buf; + irtoy->tx_len = size; + irtoy->emitted = 0; + ++ // There is an issue where if the unit is receiving IR while the ++ // first TXSTART command is sent, the device might end up hanging ++ // with its led on. It does not respond to any command when this ++ // happens. To work around this, re-enter sample mode. ++ err = irtoy_command(irtoy, COMMAND_SMODE_EXIT, ++ sizeof(COMMAND_SMODE_EXIT), STATE_RESET); ++ if (err) { ++ dev_err(irtoy->dev, "exit sample mode: %d\n", err); ++ return err; ++ } ++ ++ err = irtoy_command(irtoy, COMMAND_SMODE_ENTER, ++ sizeof(COMMAND_SMODE_ENTER), STATE_COMMAND); ++ if (err) { ++ dev_err(irtoy->dev, "enter sample mode: %d\n", err); ++ return err; ++ } ++ + err = irtoy_command(irtoy, COMMAND_TXSTART, sizeof(COMMAND_TXSTART), + STATE_TX); + kfree(buf); +diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c +index 184cbc933..18388ea5e 100644 +--- a/drivers/net/dsa/mv88e6xxx/chip.c ++++ b/drivers/net/dsa/mv88e6xxx/chip.c +@@ -2613,8 +2613,8 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) + if (err) + return err; + +- /* Port Control 2: don't force a good FCS, set the maximum frame size to +- * 10240 bytes, disable 802.1q tags checking, don't discard tagged or ++ /* Port Control 2: don't force a good FCS, set the MTU size to ++ * 10222 bytes, disable 802.1q tags checking, don't discard tagged or + * untagged frames on this port, do a destination address lookup on all + * received packets as usual, disable ARP mirroring and don't send a + * copy of all transmitted/received frames on this port to the CPU. +@@ -2633,7 +2633,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) + return err; + + if (chip->info->ops->port_set_jumbo_size) { +- err = chip->info->ops->port_set_jumbo_size(chip, port, 10240); ++ err = chip->info->ops->port_set_jumbo_size(chip, port, 10218); + if (err) + return err; + } +@@ -2718,10 +2718,10 @@ static int mv88e6xxx_get_max_mtu(struct dsa_switch *ds, int port) + struct mv88e6xxx_chip *chip = ds->priv; + + if (chip->info->ops->port_set_jumbo_size) +- return 10240; ++ return 10240 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; + else if (chip->info->ops->set_max_frame_size) +- return 1632; +- return 1522; ++ return 1632 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; ++ return 1522 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; + } + + static int mv88e6xxx_change_mtu(struct dsa_switch *ds, int port, int new_mtu) +@@ -2729,6 +2729,9 @@ static int mv88e6xxx_change_mtu(struct dsa_switch *ds, int port, int new_mtu) + struct mv88e6xxx_chip *chip = ds->priv; + int ret = 0; + ++ if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) ++ new_mtu += EDSA_HLEN; ++ + mv88e6xxx_reg_lock(chip); + if (chip->info->ops->port_set_jumbo_size) + ret = chip->info->ops->port_set_jumbo_size(chip, port, new_mtu); +@@ -3455,7 +3458,6 @@ static const struct mv88e6xxx_ops mv88e6161_ops = { + .port_set_frame_mode = mv88e6351_port_set_frame_mode, + .port_set_egress_floods = mv88e6352_port_set_egress_floods, + .port_set_ether_type = mv88e6351_port_set_ether_type, +- .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, + .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, + .port_pause_limit = mv88e6097_port_pause_limit, + .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, +@@ -3480,6 +3482,7 @@ static const struct mv88e6xxx_ops mv88e6161_ops = { + .avb_ops = &mv88e6165_avb_ops, + .ptp_ops = &mv88e6165_ptp_ops, + .phylink_validate = mv88e6185_phylink_validate, ++ .set_max_frame_size = mv88e6185_g1_set_max_frame_size, + }; + + static const struct mv88e6xxx_ops mv88e6165_ops = { +diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h +index 81c244fc0..51a7ff444 100644 +--- a/drivers/net/dsa/mv88e6xxx/chip.h ++++ b/drivers/net/dsa/mv88e6xxx/chip.h +@@ -18,6 +18,7 @@ + #include + #include + ++#define EDSA_HLEN 8 + #define MV88E6XXX_N_FID 4096 + + /* PVT limits for 4-bit port and 5-bit switch */ +diff --git a/drivers/net/dsa/mv88e6xxx/global1.c b/drivers/net/dsa/mv88e6xxx/global1.c +index 33d443a37..9936ae69e 100644 +--- a/drivers/net/dsa/mv88e6xxx/global1.c ++++ b/drivers/net/dsa/mv88e6xxx/global1.c +@@ -232,6 +232,8 @@ int mv88e6185_g1_set_max_frame_size(struct mv88e6xxx_chip *chip, int mtu) + u16 val; + int err; + ++ mtu += ETH_HLEN + ETH_FCS_LEN; ++ + err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &val); + if (err) + return err; +diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c +index 8128dc607..dfd9e8292 100644 +--- a/drivers/net/dsa/mv88e6xxx/port.c ++++ b/drivers/net/dsa/mv88e6xxx/port.c +@@ -1082,6 +1082,8 @@ int mv88e6165_port_set_jumbo_size(struct mv88e6xxx_chip *chip, int port, + u16 reg; + int err; + ++ size += VLAN_ETH_HLEN + ETH_FCS_LEN; ++ + err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_CTL2, ®); + if (err) + return err; +diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c +index 68133563a..716b396bf 100644 +--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c ++++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c +@@ -504,8 +504,7 @@ static void enetc_mac_config(struct enetc_hw *hw, phy_interface_t phy_mode) + + if (phy_interface_mode_is_rgmii(phy_mode)) { + val = enetc_port_rd(hw, ENETC_PM0_IF_MODE); +- val &= ~ENETC_PM0_IFM_EN_AUTO; +- val &= ENETC_PM0_IFM_IFMODE_MASK; ++ val &= ~(ENETC_PM0_IFM_EN_AUTO | ENETC_PM0_IFM_IFMODE_MASK); + val |= ENETC_PM0_IFM_IFMODE_GMII | ENETC_PM0_IFM_RG; + enetc_port_wr(hw, ENETC_PM0_IF_MODE, val); + } +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +index 936b9cfe1..4777db262 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +@@ -444,6 +444,11 @@ static int hns3_nic_net_open(struct net_device *netdev) + if (hns3_nic_resetting(netdev)) + return -EBUSY; + ++ if (!test_bit(HNS3_NIC_STATE_DOWN, &priv->state)) { ++ netdev_warn(netdev, "net open repeatedly!\n"); ++ return 0; ++ } ++ + netif_carrier_off(netdev); + + ret = hns3_nic_set_real_num_queue(netdev); +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +index c0aa3be0c..cd0d7a546 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +@@ -300,33 +300,8 @@ static int hns3_lp_run_test(struct net_device *ndev, enum hnae3_loop mode) + return ret_val; + } + +-/** +- * hns3_nic_self_test - self test +- * @ndev: net device +- * @eth_test: test cmd +- * @data: test result +- */ +-static void hns3_self_test(struct net_device *ndev, +- struct ethtool_test *eth_test, u64 *data) ++static void hns3_set_selftest_param(struct hnae3_handle *h, int (*st_param)[2]) + { +- struct hns3_nic_priv *priv = netdev_priv(ndev); +- struct hnae3_handle *h = priv->ae_handle; +- int st_param[HNS3_SELF_TEST_TYPE_NUM][2]; +- bool if_running = netif_running(ndev); +- int test_index = 0; +- u32 i; +- +- if (hns3_nic_resetting(ndev)) { +- netdev_err(ndev, "dev resetting!"); +- return; +- } +- +- /* Only do offline selftest, or pass by default */ +- if (eth_test->flags != ETH_TEST_FL_OFFLINE) +- return; +- +- netif_dbg(h, drv, ndev, "self test start"); +- + st_param[HNAE3_LOOP_APP][0] = HNAE3_LOOP_APP; + st_param[HNAE3_LOOP_APP][1] = + h->flags & HNAE3_SUPPORT_APP_LOOPBACK; +@@ -343,13 +318,26 @@ static void hns3_self_test(struct net_device *ndev, + st_param[HNAE3_LOOP_PHY][0] = HNAE3_LOOP_PHY; + st_param[HNAE3_LOOP_PHY][1] = + h->flags & HNAE3_SUPPORT_PHY_LOOPBACK; ++} ++ ++static void hns3_selftest_prepare(struct net_device *ndev, ++ bool if_running, int (*st_param)[2]) ++{ ++ struct hns3_nic_priv *priv = netdev_priv(ndev); ++ struct hnae3_handle *h = priv->ae_handle; ++ ++ if (netif_msg_ifdown(h)) ++ netdev_info(ndev, "self test start\n"); ++ ++ hns3_set_selftest_param(h, st_param); + + if (if_running) + ndev->netdev_ops->ndo_stop(ndev); + + #if IS_ENABLED(CONFIG_VLAN_8021Q) + /* Disable the vlan filter for selftest does not support it */ +- if (h->ae_algo->ops->enable_vlan_filter) ++ if (h->ae_algo->ops->enable_vlan_filter && ++ ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) + h->ae_algo->ops->enable_vlan_filter(h, false); + #endif + +@@ -361,6 +349,36 @@ static void hns3_self_test(struct net_device *ndev, + h->ae_algo->ops->halt_autoneg(h, true); + + set_bit(HNS3_NIC_STATE_TESTING, &priv->state); ++} ++ ++static void hns3_selftest_restore(struct net_device *ndev, bool if_running) ++{ ++ struct hns3_nic_priv *priv = netdev_priv(ndev); ++ struct hnae3_handle *h = priv->ae_handle; ++ ++ clear_bit(HNS3_NIC_STATE_TESTING, &priv->state); ++ ++ if (h->ae_algo->ops->halt_autoneg) ++ h->ae_algo->ops->halt_autoneg(h, false); ++ ++#if IS_ENABLED(CONFIG_VLAN_8021Q) ++ if (h->ae_algo->ops->enable_vlan_filter && ++ ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) ++ h->ae_algo->ops->enable_vlan_filter(h, true); ++#endif ++ ++ if (if_running) ++ ndev->netdev_ops->ndo_open(ndev); ++ ++ if (netif_msg_ifdown(h)) ++ netdev_info(ndev, "self test end\n"); ++} ++ ++static void hns3_do_selftest(struct net_device *ndev, int (*st_param)[2], ++ struct ethtool_test *eth_test, u64 *data) ++{ ++ int test_index = 0; ++ u32 i; + + for (i = 0; i < HNS3_SELF_TEST_TYPE_NUM; i++) { + enum hnae3_loop loop_type = (enum hnae3_loop)st_param[i][0]; +@@ -379,21 +397,32 @@ static void hns3_self_test(struct net_device *ndev, + + test_index++; + } ++} + +- clear_bit(HNS3_NIC_STATE_TESTING, &priv->state); +- +- if (h->ae_algo->ops->halt_autoneg) +- h->ae_algo->ops->halt_autoneg(h, false); ++/** ++ * hns3_nic_self_test - self test ++ * @ndev: net device ++ * @eth_test: test cmd ++ * @data: test result ++ */ ++static void hns3_self_test(struct net_device *ndev, ++ struct ethtool_test *eth_test, u64 *data) ++{ ++ int st_param[HNS3_SELF_TEST_TYPE_NUM][2]; ++ bool if_running = netif_running(ndev); + +-#if IS_ENABLED(CONFIG_VLAN_8021Q) +- if (h->ae_algo->ops->enable_vlan_filter) +- h->ae_algo->ops->enable_vlan_filter(h, true); +-#endif ++ if (hns3_nic_resetting(ndev)) { ++ netdev_err(ndev, "dev resetting!"); ++ return; ++ } + +- if (if_running) +- ndev->netdev_ops->ndo_open(ndev); ++ /* Only do offline selftest, or pass by default */ ++ if (eth_test->flags != ETH_TEST_FL_OFFLINE) ++ return; + +- netif_dbg(h, drv, ndev, "self test end\n"); ++ hns3_selftest_prepare(ndev, if_running, st_param); ++ hns3_do_selftest(ndev, st_param, eth_test, data); ++ hns3_selftest_restore(ndev, if_running); + } + + static int hns3_get_sset_count(struct net_device *netdev, int stringset) +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +index a93c7eb4e..28a90ead4 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +@@ -248,6 +248,10 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets) + } + + hclge_tm_schd_info_update(hdev, num_tc); ++ if (num_tc > 1) ++ hdev->flag |= HCLGE_FLAG_DCB_ENABLE; ++ else ++ hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE; + + ret = hclge_ieee_ets_to_tm_info(hdev, ets); + if (ret) +@@ -313,8 +317,7 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc) + u8 i, j, pfc_map, *prio_tc; + int ret; + +- if (!(hdev->dcbx_cap & DCB_CAP_DCBX_VER_IEEE) || +- hdev->flag & HCLGE_FLAG_MQPRIO_ENABLE) ++ if (!(hdev->dcbx_cap & DCB_CAP_DCBX_VER_IEEE)) + return -EINVAL; + + if (pfc->pfc_en == hdev->tm_info.pfc_en) +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +index 24357e907..0e869f449 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +@@ -7581,15 +7581,8 @@ int hclge_add_uc_addr_common(struct hclge_vport *vport, + } + + /* check if we just hit the duplicate */ +- if (!ret) { +- dev_warn(&hdev->pdev->dev, "VF %u mac(%pM) exists\n", +- vport->vport_id, addr); +- return 0; +- } +- +- dev_err(&hdev->pdev->dev, +- "PF failed to add unicast entry(%pM) in the MAC table\n", +- addr); ++ if (!ret) ++ return -EEXIST; + + return ret; + } +@@ -7743,7 +7736,13 @@ static void hclge_sync_vport_mac_list(struct hclge_vport *vport, + } else { + set_bit(HCLGE_VPORT_STATE_MAC_TBL_CHANGE, + &vport->state); +- break; ++ ++ /* If one unicast mac address is existing in hardware, ++ * we need to try whether other unicast mac addresses ++ * are new addresses that can be added. ++ */ ++ if (ret != -EEXIST) ++ break; + } + } + } +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +index e8495f58a..69d081515 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +@@ -646,14 +646,6 @@ static void hclge_tm_tc_info_init(struct hclge_dev *hdev) + for (i = 0; i < HNAE3_MAX_USER_PRIO; i++) + hdev->tm_info.prio_tc[i] = + (i >= hdev->tm_info.num_tc) ? 0 : i; +- +- /* DCB is enabled if we have more than 1 TC or pfc_en is +- * non-zero. +- */ +- if (hdev->tm_info.num_tc > 1 || hdev->tm_info.pfc_en) +- hdev->flag |= HCLGE_FLAG_DCB_ENABLE; +- else +- hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE; + } + + static void hclge_tm_pg_info_init(struct hclge_dev *hdev) +@@ -682,12 +674,12 @@ static void hclge_tm_pg_info_init(struct hclge_dev *hdev) + } + } + +-static void hclge_pfc_info_init(struct hclge_dev *hdev) ++static void hclge_update_fc_mode_by_dcb_flag(struct hclge_dev *hdev) + { +- if (!(hdev->flag & HCLGE_FLAG_DCB_ENABLE)) { ++ if (hdev->tm_info.num_tc == 1 && !hdev->tm_info.pfc_en) { + if (hdev->fc_mode_last_time == HCLGE_FC_PFC) + dev_warn(&hdev->pdev->dev, +- "DCB is disable, but last mode is FC_PFC\n"); ++ "Only 1 tc used, but last mode is FC_PFC\n"); + + hdev->tm_info.fc_mode = hdev->fc_mode_last_time; + } else if (hdev->tm_info.fc_mode != HCLGE_FC_PFC) { +@@ -700,6 +692,27 @@ static void hclge_pfc_info_init(struct hclge_dev *hdev) + } + } + ++static void hclge_update_fc_mode(struct hclge_dev *hdev) ++{ ++ if (!hdev->tm_info.pfc_en) { ++ hdev->tm_info.fc_mode = hdev->fc_mode_last_time; ++ return; ++ } ++ ++ if (hdev->tm_info.fc_mode != HCLGE_FC_PFC) { ++ hdev->fc_mode_last_time = hdev->tm_info.fc_mode; ++ hdev->tm_info.fc_mode = HCLGE_FC_PFC; ++ } ++} ++ ++void hclge_tm_pfc_info_update(struct hclge_dev *hdev) ++{ ++ if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3) ++ hclge_update_fc_mode(hdev); ++ else ++ hclge_update_fc_mode_by_dcb_flag(hdev); ++} ++ + static void hclge_tm_schd_info_init(struct hclge_dev *hdev) + { + hclge_tm_pg_info_init(hdev); +@@ -708,7 +721,7 @@ static void hclge_tm_schd_info_init(struct hclge_dev *hdev) + + hclge_tm_vport_info_update(hdev); + +- hclge_pfc_info_init(hdev); ++ hclge_tm_pfc_info_update(hdev); + } + + static int hclge_tm_pg_to_pri_map(struct hclge_dev *hdev) +@@ -1444,19 +1457,6 @@ void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc) + hclge_tm_schd_info_init(hdev); + } + +-void hclge_tm_pfc_info_update(struct hclge_dev *hdev) +-{ +- /* DCB is enabled if we have more than 1 TC or pfc_en is +- * non-zero. +- */ +- if (hdev->tm_info.num_tc > 1 || hdev->tm_info.pfc_en) +- hdev->flag |= HCLGE_FLAG_DCB_ENABLE; +- else +- hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE; +- +- hclge_pfc_info_init(hdev); +-} +- + int hclge_tm_init_hw(struct hclge_dev *hdev, bool init) + { + int ret; +@@ -1502,7 +1502,7 @@ int hclge_tm_vport_map_update(struct hclge_dev *hdev) + if (ret) + return ret; + +- if (!(hdev->flag & HCLGE_FLAG_DCB_ENABLE)) ++ if (hdev->tm_info.num_tc == 1 && !hdev->tm_info.pfc_en) + return 0; + + return hclge_tm_bp_setup(hdev); +diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c +index 609e47b82..ee86ea12f 100644 +--- a/drivers/net/ethernet/intel/e100.c ++++ b/drivers/net/ethernet/intel/e100.c +@@ -2431,11 +2431,15 @@ static void e100_get_drvinfo(struct net_device *netdev, + sizeof(info->bus_info)); + } + +-#define E100_PHY_REGS 0x1C ++#define E100_PHY_REGS 0x1D + static int e100_get_regs_len(struct net_device *netdev) + { + struct nic *nic = netdev_priv(netdev); +- return 1 + E100_PHY_REGS + sizeof(nic->mem->dump_buf); ++ ++ /* We know the number of registers, and the size of the dump buffer. ++ * Calculate the total size in bytes. ++ */ ++ return (1 + E100_PHY_REGS) * sizeof(u32) + sizeof(nic->mem->dump_buf); + } + + static void e100_get_regs(struct net_device *netdev, +@@ -2449,14 +2453,18 @@ static void e100_get_regs(struct net_device *netdev, + buff[0] = ioread8(&nic->csr->scb.cmd_hi) << 24 | + ioread8(&nic->csr->scb.cmd_lo) << 16 | + ioread16(&nic->csr->scb.status); +- for (i = E100_PHY_REGS; i >= 0; i--) +- buff[1 + E100_PHY_REGS - i] = +- mdio_read(netdev, nic->mii.phy_id, i); ++ for (i = 0; i < E100_PHY_REGS; i++) ++ /* Note that we read the registers in reverse order. This ++ * ordering is the ABI apparently used by ethtool and other ++ * applications. ++ */ ++ buff[1 + i] = mdio_read(netdev, nic->mii.phy_id, ++ E100_PHY_REGS - 1 - i); + memset(nic->mem->dump_buf, 0, sizeof(nic->mem->dump_buf)); + e100_exec_cb(nic, NULL, e100_dump); + msleep(10); +- memcpy(&buff[2 + E100_PHY_REGS], nic->mem->dump_buf, +- sizeof(nic->mem->dump_buf)); ++ memcpy(&buff[1 + E100_PHY_REGS], nic->mem->dump_buf, ++ sizeof(nic->mem->dump_buf)); + } + + static void e100_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) +diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +index a280aa34c..55983904b 100644 +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +@@ -3216,7 +3216,7 @@ static unsigned int ixgbe_max_channels(struct ixgbe_adapter *adapter) + max_combined = ixgbe_max_rss_indices(adapter); + } + +- return max_combined; ++ return min_t(int, max_combined, num_online_cpus()); + } + + static void ixgbe_get_channels(struct net_device *dev, +diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +index 37439b76f..ffe322136 100644 +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +@@ -10123,6 +10123,7 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog) + struct ixgbe_adapter *adapter = netdev_priv(dev); + struct bpf_prog *old_prog; + bool need_reset; ++ int num_queues; + + if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) + return -EINVAL; +@@ -10172,11 +10173,14 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog) + /* Kick start the NAPI context if there is an AF_XDP socket open + * on that queue id. This so that receiving will start. + */ +- if (need_reset && prog) +- for (i = 0; i < adapter->num_rx_queues; i++) ++ if (need_reset && prog) { ++ num_queues = min_t(int, adapter->num_rx_queues, ++ adapter->num_xdp_queues); ++ for (i = 0; i < num_queues; i++) + if (adapter->xdp_ring[i]->xsk_pool) + (void)ixgbe_xsk_wakeup(adapter->netdev, i, + XDP_WAKEUP_RX); ++ } + + return 0; + } +diff --git a/drivers/net/ethernet/micrel/Makefile b/drivers/net/ethernet/micrel/Makefile +index 5cc00d22c..6ecc4eb30 100644 +--- a/drivers/net/ethernet/micrel/Makefile ++++ b/drivers/net/ethernet/micrel/Makefile +@@ -4,8 +4,6 @@ + # + + obj-$(CONFIG_KS8842) += ks8842.o +-obj-$(CONFIG_KS8851) += ks8851.o +-ks8851-objs = ks8851_common.o ks8851_spi.o +-obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o +-ks8851_mll-objs = ks8851_common.o ks8851_par.o ++obj-$(CONFIG_KS8851) += ks8851_common.o ks8851_spi.o ++obj-$(CONFIG_KS8851_MLL) += ks8851_common.o ks8851_par.o + obj-$(CONFIG_KSZ884X_PCI) += ksz884x.o +diff --git a/drivers/net/ethernet/micrel/ks8851_common.c b/drivers/net/ethernet/micrel/ks8851_common.c +index d65872172..f74eae8ee 100644 +--- a/drivers/net/ethernet/micrel/ks8851_common.c ++++ b/drivers/net/ethernet/micrel/ks8851_common.c +@@ -1031,6 +1031,7 @@ int ks8851_suspend(struct device *dev) + + return 0; + } ++EXPORT_SYMBOL_GPL(ks8851_suspend); + + int ks8851_resume(struct device *dev) + { +@@ -1044,6 +1045,7 @@ int ks8851_resume(struct device *dev) + + return 0; + } ++EXPORT_SYMBOL_GPL(ks8851_resume); + #endif + + int ks8851_probe_common(struct net_device *netdev, struct device *dev, +@@ -1175,6 +1177,7 @@ int ks8851_probe_common(struct net_device *netdev, struct device *dev, + err_reg_io: + return ret; + } ++EXPORT_SYMBOL_GPL(ks8851_probe_common); + + int ks8851_remove_common(struct device *dev) + { +@@ -1191,3 +1194,8 @@ int ks8851_remove_common(struct device *dev) + + return 0; + } ++EXPORT_SYMBOL_GPL(ks8851_remove_common); ++ ++MODULE_DESCRIPTION("KS8851 Network driver"); ++MODULE_AUTHOR("Ben Dooks "); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c +index 15812001b..115044e21 100644 +--- a/drivers/net/phy/bcm7xxx.c ++++ b/drivers/net/phy/bcm7xxx.c +@@ -27,7 +27,12 @@ + #define MII_BCM7XXX_SHD_2_ADDR_CTRL 0xe + #define MII_BCM7XXX_SHD_2_CTRL_STAT 0xf + #define MII_BCM7XXX_SHD_2_BIAS_TRIM 0x1a ++#define MII_BCM7XXX_SHD_3_PCS_CTRL 0x0 ++#define MII_BCM7XXX_SHD_3_PCS_STATUS 0x1 ++#define MII_BCM7XXX_SHD_3_EEE_CAP 0x2 + #define MII_BCM7XXX_SHD_3_AN_EEE_ADV 0x3 ++#define MII_BCM7XXX_SHD_3_EEE_LP 0x4 ++#define MII_BCM7XXX_SHD_3_EEE_WK_ERR 0x5 + #define MII_BCM7XXX_SHD_3_PCS_CTRL_2 0x6 + #define MII_BCM7XXX_PCS_CTRL_2_DEF 0x4400 + #define MII_BCM7XXX_SHD_3_AN_STAT 0xb +@@ -216,25 +221,37 @@ static int bcm7xxx_28nm_resume(struct phy_device *phydev) + return genphy_config_aneg(phydev); + } + +-static int phy_set_clr_bits(struct phy_device *dev, int location, +- int set_mask, int clr_mask) ++static int __phy_set_clr_bits(struct phy_device *dev, int location, ++ int set_mask, int clr_mask) + { + int v, ret; + +- v = phy_read(dev, location); ++ v = __phy_read(dev, location); + if (v < 0) + return v; + + v &= ~clr_mask; + v |= set_mask; + +- ret = phy_write(dev, location, v); ++ ret = __phy_write(dev, location, v); + if (ret < 0) + return ret; + + return v; + } + ++static int phy_set_clr_bits(struct phy_device *dev, int location, ++ int set_mask, int clr_mask) ++{ ++ int ret; ++ ++ mutex_lock(&dev->mdio.bus->mdio_lock); ++ ret = __phy_set_clr_bits(dev, location, set_mask, clr_mask); ++ mutex_unlock(&dev->mdio.bus->mdio_lock); ++ ++ return ret; ++} ++ + static int bcm7xxx_28nm_ephy_01_afe_config_init(struct phy_device *phydev) + { + int ret; +@@ -398,6 +415,93 @@ static int bcm7xxx_28nm_ephy_config_init(struct phy_device *phydev) + return bcm7xxx_28nm_ephy_apd_enable(phydev); + } + ++#define MII_BCM7XXX_REG_INVALID 0xff ++ ++static u8 bcm7xxx_28nm_ephy_regnum_to_shd(u16 regnum) ++{ ++ switch (regnum) { ++ case MDIO_CTRL1: ++ return MII_BCM7XXX_SHD_3_PCS_CTRL; ++ case MDIO_STAT1: ++ return MII_BCM7XXX_SHD_3_PCS_STATUS; ++ case MDIO_PCS_EEE_ABLE: ++ return MII_BCM7XXX_SHD_3_EEE_CAP; ++ case MDIO_AN_EEE_ADV: ++ return MII_BCM7XXX_SHD_3_AN_EEE_ADV; ++ case MDIO_AN_EEE_LPABLE: ++ return MII_BCM7XXX_SHD_3_EEE_LP; ++ case MDIO_PCS_EEE_WK_ERR: ++ return MII_BCM7XXX_SHD_3_EEE_WK_ERR; ++ default: ++ return MII_BCM7XXX_REG_INVALID; ++ } ++} ++ ++static bool bcm7xxx_28nm_ephy_dev_valid(int devnum) ++{ ++ return devnum == MDIO_MMD_AN || devnum == MDIO_MMD_PCS; ++} ++ ++static int bcm7xxx_28nm_ephy_read_mmd(struct phy_device *phydev, ++ int devnum, u16 regnum) ++{ ++ u8 shd = bcm7xxx_28nm_ephy_regnum_to_shd(regnum); ++ int ret; ++ ++ if (!bcm7xxx_28nm_ephy_dev_valid(devnum) || ++ shd == MII_BCM7XXX_REG_INVALID) ++ return -EOPNOTSUPP; ++ ++ /* set shadow mode 2 */ ++ ret = __phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, ++ MII_BCM7XXX_SHD_MODE_2, 0); ++ if (ret < 0) ++ return ret; ++ ++ /* Access the desired shadow register address */ ++ ret = __phy_write(phydev, MII_BCM7XXX_SHD_2_ADDR_CTRL, shd); ++ if (ret < 0) ++ goto reset_shadow_mode; ++ ++ ret = __phy_read(phydev, MII_BCM7XXX_SHD_2_CTRL_STAT); ++ ++reset_shadow_mode: ++ /* reset shadow mode 2 */ ++ __phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, 0, ++ MII_BCM7XXX_SHD_MODE_2); ++ return ret; ++} ++ ++static int bcm7xxx_28nm_ephy_write_mmd(struct phy_device *phydev, ++ int devnum, u16 regnum, u16 val) ++{ ++ u8 shd = bcm7xxx_28nm_ephy_regnum_to_shd(regnum); ++ int ret; ++ ++ if (!bcm7xxx_28nm_ephy_dev_valid(devnum) || ++ shd == MII_BCM7XXX_REG_INVALID) ++ return -EOPNOTSUPP; ++ ++ /* set shadow mode 2 */ ++ ret = __phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, ++ MII_BCM7XXX_SHD_MODE_2, 0); ++ if (ret < 0) ++ return ret; ++ ++ /* Access the desired shadow register address */ ++ ret = __phy_write(phydev, MII_BCM7XXX_SHD_2_ADDR_CTRL, shd); ++ if (ret < 0) ++ goto reset_shadow_mode; ++ ++ /* Write the desired value in the shadow register */ ++ __phy_write(phydev, MII_BCM7XXX_SHD_2_CTRL_STAT, val); ++ ++reset_shadow_mode: ++ /* reset shadow mode 2 */ ++ return __phy_set_clr_bits(phydev, MII_BCM7XXX_TEST, 0, ++ MII_BCM7XXX_SHD_MODE_2); ++} ++ + static int bcm7xxx_28nm_ephy_resume(struct phy_device *phydev) + { + int ret; +@@ -595,6 +699,8 @@ static void bcm7xxx_28nm_remove(struct phy_device *phydev) + .get_stats = bcm7xxx_28nm_get_phy_stats, \ + .probe = bcm7xxx_28nm_probe, \ + .remove = bcm7xxx_28nm_remove, \ ++ .read_mmd = bcm7xxx_28nm_ephy_read_mmd, \ ++ .write_mmd = bcm7xxx_28nm_ephy_write_mmd, \ + } + + #define BCM7XXX_40NM_EPHY(_oui, _name) \ +diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c +index df8d4c1e5..db484215a 100644 +--- a/drivers/net/usb/hso.c ++++ b/drivers/net/usb/hso.c +@@ -2354,7 +2354,7 @@ static int remove_net_device(struct hso_device *hso_dev) + } + + /* Frees our network device */ +-static void hso_free_net_device(struct hso_device *hso_dev, bool bailout) ++static void hso_free_net_device(struct hso_device *hso_dev) + { + int i; + struct hso_net *hso_net = dev2net(hso_dev); +@@ -2377,7 +2377,7 @@ static void hso_free_net_device(struct hso_device *hso_dev, bool bailout) + kfree(hso_net->mux_bulk_tx_buf); + hso_net->mux_bulk_tx_buf = NULL; + +- if (hso_net->net && !bailout) ++ if (hso_net->net) + free_netdev(hso_net->net); + + kfree(hso_dev); +@@ -3137,7 +3137,7 @@ static void hso_free_interface(struct usb_interface *interface) + rfkill_unregister(rfk); + rfkill_destroy(rfk); + } +- hso_free_net_device(network_table[i], false); ++ hso_free_net_device(network_table[i]); + } + } + } +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index ea0d5f04d..465e11dcd 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -1178,7 +1178,10 @@ static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf) + + static void smsc95xx_handle_link_change(struct net_device *net) + { ++ struct usbnet *dev = netdev_priv(net); ++ + phy_print_status(net->phydev); ++ usbnet_defer_kevent(dev, EVENT_LINK_CHANGE); + } + + static int smsc95xx_start_phy(struct usbnet *dev) +diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c +index 79ee470fe..e265f4c5c 100644 +--- a/drivers/net/wireless/mac80211_hwsim.c ++++ b/drivers/net/wireless/mac80211_hwsim.c +@@ -1799,8 +1799,8 @@ mac80211_hwsim_beacon(struct hrtimer *timer) + bcn_int -= data->bcn_delta; + data->bcn_delta = 0; + } +- hrtimer_forward(&data->beacon_timer, hrtimer_get_expires(timer), +- ns_to_ktime(bcn_int * NSEC_PER_USEC)); ++ hrtimer_forward_now(&data->beacon_timer, ++ ns_to_ktime(bcn_int * NSEC_PER_USEC)); + return HRTIMER_RESTART; + } + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index bbc3efef5..99b515248 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -831,6 +831,7 @@ EXPORT_SYMBOL_GPL(nvme_cleanup_cmd); + blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req, + struct nvme_command *cmd) + { ++ struct nvme_ctrl *ctrl = nvme_req(req)->ctrl; + blk_status_t ret = BLK_STS_OK; + + nvme_clear_nvme_request(req); +@@ -877,7 +878,8 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req, + return BLK_STS_IOERR; + } + +- nvme_req(req)->genctr++; ++ if (!(ctrl->quirks & NVME_QUIRK_SKIP_CID_GEN)) ++ nvme_req(req)->genctr++; + cmd->common.command_id = nvme_cid(req); + trace_nvme_setup_cmd(req, cmd); + return ret; +diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h +index 8c735c55c..5dd1dd802 100644 +--- a/drivers/nvme/host/nvme.h ++++ b/drivers/nvme/host/nvme.h +@@ -144,6 +144,12 @@ enum nvme_quirks { + * NVMe 1.3 compliance. + */ + NVME_QUIRK_NO_NS_DESC_LIST = (1 << 15), ++ ++ /* ++ * The controller requires the command_id value be be limited, so skip ++ * encoding the generation sequence number. ++ */ ++ NVME_QUIRK_SKIP_CID_GEN = (1 << 17), + }; + + /* +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c +index 09767a805..d79abb88a 100644 +--- a/drivers/nvme/host/pci.c ++++ b/drivers/nvme/host/pci.c +@@ -3259,7 +3259,8 @@ static const struct pci_device_id nvme_id_table[] = { + { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2005), + .driver_data = NVME_QUIRK_SINGLE_VECTOR | + NVME_QUIRK_128_BYTES_SQES | +- NVME_QUIRK_SHARED_TAGS }, ++ NVME_QUIRK_SHARED_TAGS | ++ NVME_QUIRK_SKIP_CID_GEN }, + + { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, + { 0, } +diff --git a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c +index 390b07bf9..ccbded335 100644 +--- a/drivers/scsi/csiostor/csio_init.c ++++ b/drivers/scsi/csiostor/csio_init.c +@@ -1254,3 +1254,4 @@ MODULE_DEVICE_TABLE(pci, csio_pci_tbl); + MODULE_VERSION(CSIO_DRV_VERSION); + MODULE_FIRMWARE(FW_FNAME_T5); + MODULE_FIRMWARE(FW_FNAME_T6); ++MODULE_SOFTDEP("pre: cxgb4"); +diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h +index 4f0486fe3..e1fd91a58 100644 +--- a/drivers/scsi/qla2xxx/qla_def.h ++++ b/drivers/scsi/qla2xxx/qla_def.h +@@ -3913,7 +3913,6 @@ struct qla_hw_data { + uint32_t scm_supported_f:1; + /* Enabled in Driver */ + uint32_t scm_enabled:1; +- uint32_t max_req_queue_warned:1; + uint32_t plogi_template_valid:1; + } flags; + +diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c +index a24b82de4..5e040b6de 100644 +--- a/drivers/scsi/qla2xxx/qla_isr.c ++++ b/drivers/scsi/qla2xxx/qla_isr.c +@@ -4158,6 +4158,8 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp) + ql_dbg(ql_dbg_init, vha, 0x0125, + "INTa mode: Enabled.\n"); + ha->flags.mr_intr_valid = 1; ++ /* Set max_qpair to 0, as MSI-X and MSI in not enabled */ ++ ha->max_qpairs = 0; + } + + clear_risc_ints: +diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c +index f6c76a063..5acee3c79 100644 +--- a/drivers/scsi/qla2xxx/qla_nvme.c ++++ b/drivers/scsi/qla2xxx/qla_nvme.c +@@ -109,19 +109,24 @@ static int qla_nvme_alloc_queue(struct nvme_fc_local_port *lport, + return -EINVAL; + } + +- if (ha->queue_pair_map[qidx]) { +- *handle = ha->queue_pair_map[qidx]; +- ql_log(ql_log_info, vha, 0x2121, +- "Returning existing qpair of %p for idx=%x\n", +- *handle, qidx); +- return 0; +- } ++ /* Use base qpair if max_qpairs is 0 */ ++ if (!ha->max_qpairs) { ++ qpair = ha->base_qpair; ++ } else { ++ if (ha->queue_pair_map[qidx]) { ++ *handle = ha->queue_pair_map[qidx]; ++ ql_log(ql_log_info, vha, 0x2121, ++ "Returning existing qpair of %p for idx=%x\n", ++ *handle, qidx); ++ return 0; ++ } + +- qpair = qla2xxx_create_qpair(vha, 5, vha->vp_idx, true); +- if (qpair == NULL) { +- ql_log(ql_log_warn, vha, 0x2122, +- "Failed to allocate qpair\n"); +- return -EINVAL; ++ qpair = qla2xxx_create_qpair(vha, 5, vha->vp_idx, true); ++ if (!qpair) { ++ ql_log(ql_log_warn, vha, 0x2122, ++ "Failed to allocate qpair\n"); ++ return -EINVAL; ++ } + } + *handle = qpair; + +@@ -715,18 +720,9 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha) + + WARN_ON(vha->nvme_local_port); + +- if (ha->max_req_queues < 3) { +- if (!ha->flags.max_req_queue_warned) +- ql_log(ql_log_info, vha, 0x2120, +- "%s: Disabling FC-NVME due to lack of free queue pairs (%d).\n", +- __func__, ha->max_req_queues); +- ha->flags.max_req_queue_warned = 1; +- return ret; +- } +- + qla_nvme_fc_transport.max_hw_queues = + min((uint8_t)(qla_nvme_fc_transport.max_hw_queues), +- (uint8_t)(ha->max_req_queues - 2)); ++ (uint8_t)(ha->max_qpairs ? ha->max_qpairs : 1)); + + pinfo.node_name = wwn_to_u64(vha->node_name); + pinfo.port_name = wwn_to_u64(vha->port_name); +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c +index d2fdd9f90..5c2a617de 100644 +--- a/drivers/scsi/ufs/ufshcd.c ++++ b/drivers/scsi/ufs/ufshcd.c +@@ -324,8 +324,7 @@ static void ufshcd_add_query_upiu_trace(struct ufs_hba *hba, unsigned int tag, + static void ufshcd_add_tm_upiu_trace(struct ufs_hba *hba, unsigned int tag, + const char *str) + { +- int off = (int)tag - hba->nutrs; +- struct utp_task_req_desc *descp = &hba->utmrdl_base_addr[off]; ++ struct utp_task_req_desc *descp = &hba->utmrdl_base_addr[tag]; + + trace_android_vh_ufs_send_tm_command(hba, tag, str); + trace_ufshcd_upiu(dev_name(hba->dev), str, &descp->req_header, +diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c +index cea40ef09..a7ee1171e 100644 +--- a/drivers/tty/vt/vt.c ++++ b/drivers/tty/vt/vt.c +@@ -1220,8 +1220,25 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, + new_row_size = new_cols << 1; + new_screen_size = new_row_size * new_rows; + +- if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) +- return 0; ++ if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) { ++ /* ++ * This function is being called here to cover the case ++ * where the userspace calls the FBIOPUT_VSCREENINFO twice, ++ * passing the same fb_var_screeninfo containing the fields ++ * yres/xres equal to a number non-multiple of vc_font.height ++ * and yres_virtual/xres_virtual equal to number lesser than the ++ * vc_font.height and yres/xres. ++ * In the second call, the struct fb_var_screeninfo isn't ++ * being modified by the underlying driver because of the ++ * if above, and this causes the fbcon_display->vrows to become ++ * negative and it eventually leads to out-of-bound ++ * access by the imageblit function. ++ * To give the correct values to the struct and to not have ++ * to deal with possible errors from the code below, we call ++ * the resize_screen here as well. ++ */ ++ return resize_screen(vc, new_cols, new_rows, user); ++ } + + if (new_screen_size > KMALLOC_MAX_SIZE || !new_screen_size) + return -EINVAL; +diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c +index 9d38f864c..e11162294 100644 +--- a/drivers/usb/cdns3/gadget.c ++++ b/drivers/usb/cdns3/gadget.c +@@ -1101,6 +1101,19 @@ static int cdns3_ep_run_stream_transfer(struct cdns3_endpoint *priv_ep, + return 0; + } + ++static void cdns3_rearm_drdy_if_needed(struct cdns3_endpoint *priv_ep) ++{ ++ struct cdns3_device *priv_dev = priv_ep->cdns3_dev; ++ ++ if (priv_dev->dev_ver < DEV_VER_V3) ++ return; ++ ++ if (readl(&priv_dev->regs->ep_sts) & EP_STS_TRBERR) { ++ writel(EP_STS_TRBERR, &priv_dev->regs->ep_sts); ++ writel(EP_CMD_DRDY, &priv_dev->regs->ep_cmd); ++ } ++} ++ + /** + * cdns3_ep_run_transfer - start transfer on no-default endpoint hardware + * @priv_ep: endpoint object +@@ -1352,6 +1365,7 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep, + /*clearing TRBERR and EP_STS_DESCMIS before seting DRDY*/ + writel(EP_STS_TRBERR | EP_STS_DESCMIS, &priv_dev->regs->ep_sts); + writel(EP_CMD_DRDY, &priv_dev->regs->ep_cmd); ++ cdns3_rearm_drdy_if_needed(priv_ep); + trace_cdns3_doorbell_epx(priv_ep->name, + readl(&priv_dev->regs->ep_traddr)); + } +diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c +index fa50e8936..04c4aa7a1 100644 +--- a/fs/binfmt_elf.c ++++ b/fs/binfmt_elf.c +@@ -627,7 +627,7 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex, + + vaddr = eppnt->p_vaddr; + if (interp_elf_ex->e_type == ET_EXEC || load_addr_set) +- elf_type |= MAP_FIXED_NOREPLACE; ++ elf_type |= MAP_FIXED; + else if (no_base && interp_elf_ex->e_type == ET_DYN) + load_addr = -vaddr; + +diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c +index 720d65f22..848e0aaa8 100644 +--- a/fs/debugfs/inode.c ++++ b/fs/debugfs/inode.c +@@ -524,7 +524,7 @@ void debugfs_create_file_size(const char *name, umode_t mode, + { + struct dentry *de = debugfs_create_file(name, mode, parent, data, fops); + +- if (de) ++ if (!IS_ERR(de)) + d_inode(de)->i_size = file_size; + } + EXPORT_SYMBOL_GPL(debugfs_create_file_size); +diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c +index dafde07c5..19a2c6749 100644 +--- a/fs/ext4/dir.c ++++ b/fs/ext4/dir.c +@@ -556,7 +556,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx) + struct dir_private_info *info = file->private_data; + struct inode *inode = file_inode(file); + struct fname *fname; +- int ret; ++ int ret = 0; + + if (!info) { + info = ext4_htree_create_dir_info(file, ctx->pos); +@@ -604,7 +604,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx) + info->curr_minor_hash, + &info->next_hash); + if (ret < 0) +- return ret; ++ goto finished; + if (ret == 0) { + ctx->pos = ext4_get_htree_eof(file); + break; +@@ -635,7 +635,7 @@ static int ext4_dx_readdir(struct file *file, struct dir_context *ctx) + } + finished: + info->last_pos = ctx->pos; +- return 0; ++ return ret < 0 ? ret : 0; + } + + static int ext4_release_dir(struct inode *inode, struct file *filp) +diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c +index e00a35530..aa4d74f9d 100644 +--- a/fs/ext4/extents.c ++++ b/fs/ext4/extents.c +@@ -5907,7 +5907,7 @@ void ext4_ext_replay_shrink_inode(struct inode *inode, ext4_lblk_t end) + } + + /* Check if *cur is a hole and if it is, skip it */ +-static void skip_hole(struct inode *inode, ext4_lblk_t *cur) ++static int skip_hole(struct inode *inode, ext4_lblk_t *cur) + { + int ret; + struct ext4_map_blocks map; +@@ -5916,9 +5916,12 @@ static void skip_hole(struct inode *inode, ext4_lblk_t *cur) + map.m_len = ((inode->i_size) >> inode->i_sb->s_blocksize_bits) - *cur; + + ret = ext4_map_blocks(NULL, inode, &map, 0); ++ if (ret < 0) ++ return ret; + if (ret != 0) +- return; ++ return 0; + *cur = *cur + map.m_len; ++ return 0; + } + + /* Count number of blocks used by this inode and update i_blocks */ +@@ -5967,7 +5970,9 @@ int ext4_ext_replay_set_iblocks(struct inode *inode) + * iblocks by total number of differences found. + */ + cur = 0; +- skip_hole(inode, &cur); ++ ret = skip_hole(inode, &cur); ++ if (ret < 0) ++ goto out; + path = ext4_find_extent(inode, cur, NULL, 0); + if (IS_ERR(path)) + goto out; +@@ -5986,8 +5991,12 @@ int ext4_ext_replay_set_iblocks(struct inode *inode) + } + cur = max(cur + 1, le32_to_cpu(ex->ee_block) + + ext4_ext_get_actual_len(ex)); +- skip_hole(inode, &cur); +- ++ ret = skip_hole(inode, &cur); ++ if (ret < 0) { ++ ext4_ext_drop_refs(path); ++ kfree(path); ++ break; ++ } + path2 = ext4_find_extent(inode, cur, NULL, 0); + if (IS_ERR(path2)) { + ext4_ext_drop_refs(path); +diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c +index 53647fa03..08ca690f9 100644 +--- a/fs/ext4/fast_commit.c ++++ b/fs/ext4/fast_commit.c +@@ -832,6 +832,12 @@ static int ext4_fc_write_inode_data(struct inode *inode, u32 *crc) + sizeof(lrange), (u8 *)&lrange, crc)) + return -ENOSPC; + } else { ++ unsigned int max = (map.m_flags & EXT4_MAP_UNWRITTEN) ? ++ EXT_UNWRITTEN_MAX_LEN : EXT_INIT_MAX_LEN; ++ ++ /* Limit the number of blocks in one extent */ ++ map.m_len = min(max, map.m_len); ++ + fc_ext.fc_ino = cpu_to_le32(inode->i_ino); + ex = (struct ext4_extent *)&fc_ext.fc_ex; + ex->ee_block = cpu_to_le32(map.m_lblk); +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index a5f5a00e9..bc53d6da2 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -1654,6 +1654,7 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk) + struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); + int ret; + bool allocated = false; ++ bool reserved = false; + + /* + * If the cluster containing lblk is shared with a delayed, +@@ -1670,6 +1671,7 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk) + ret = ext4_da_reserve_space(inode); + if (ret != 0) /* ENOSPC */ + goto errout; ++ reserved = true; + } else { /* bigalloc */ + if (!ext4_es_scan_clu(inode, &ext4_es_is_delonly, lblk)) { + if (!ext4_es_scan_clu(inode, +@@ -1682,6 +1684,7 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk) + ret = ext4_da_reserve_space(inode); + if (ret != 0) /* ENOSPC */ + goto errout; ++ reserved = true; + } else { + allocated = true; + } +@@ -1692,6 +1695,8 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk) + } + + ret = ext4_es_insert_delayed_block(inode, lblk, allocated); ++ if (ret && reserved) ++ ext4_da_release_space(inode, 1); + + errout: + return ret; +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index f486648c6..461994fd4 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -1356,6 +1356,12 @@ static void ext4_destroy_inode(struct inode *inode) + true); + dump_stack(); + } ++ ++ if (EXT4_I(inode)->i_reserved_data_blocks) ++ ext4_msg(inode->i_sb, KERN_ERR, ++ "Inode %lu (%p): i_reserved_data_blocks (%u) not cleared!", ++ inode->i_ino, EXT4_I(inode), ++ EXT4_I(inode)->i_reserved_data_blocks); + } + + static void init_once(void *foo) +@@ -3194,17 +3200,17 @@ static loff_t ext4_max_size(int blkbits, int has_huge_files) + */ + static loff_t ext4_max_bitmap_size(int bits, int has_huge_files) + { +- loff_t res = EXT4_NDIR_BLOCKS; ++ unsigned long long upper_limit, res = EXT4_NDIR_BLOCKS; + int meta_blocks; +- loff_t upper_limit; +- /* This is calculated to be the largest file size for a dense, block ++ ++ /* ++ * This is calculated to be the largest file size for a dense, block + * mapped file such that the file's total number of 512-byte sectors, + * including data and all indirect blocks, does not exceed (2^48 - 1). + * + * __u32 i_blocks_lo and _u16 i_blocks_high represent the total + * number of 512-byte sectors of the file. + */ +- + if (!has_huge_files) { + /* + * !has_huge_files or implies that the inode i_block field +@@ -3247,7 +3253,7 @@ static loff_t ext4_max_bitmap_size(int bits, int has_huge_files) + if (res > MAX_LFS_FILESIZE) + res = MAX_LFS_FILESIZE; + +- return res; ++ return (loff_t)res; + } + + static ext4_fsblk_t descriptor_loc(struct super_block *sb, +diff --git a/fs/verity/enable.c b/fs/verity/enable.c +index f7e997a01..bed2b10df 100644 +--- a/fs/verity/enable.c ++++ b/fs/verity/enable.c +@@ -177,7 +177,7 @@ static int build_merkle_tree(struct file *filp, + * (level 0) and ascending to the root node (level 'num_levels - 1'). + * Then at the end (level 'num_levels'), calculate the root hash. + */ +- blocks = (inode->i_size + params->block_size - 1) >> ++ blocks = ((u64)inode->i_size + params->block_size - 1) >> + params->log_blocksize; + for (level = 0; level <= params->num_levels; level++) { + err = build_merkle_tree_level(filp, level, blocks, params, +diff --git a/fs/verity/open.c b/fs/verity/open.c +index 60ff8af72..92df87f5f 100644 +--- a/fs/verity/open.c ++++ b/fs/verity/open.c +@@ -89,7 +89,7 @@ int fsverity_init_merkle_tree_params(struct merkle_tree_params *params, + */ + + /* Compute number of levels and the number of blocks in each level */ +- blocks = (inode->i_size + params->block_size - 1) >> log_blocksize; ++ blocks = ((u64)inode->i_size + params->block_size - 1) >> log_blocksize; + pr_debug("Data is %lld bytes (%llu blocks)\n", inode->i_size, blocks); + while (blocks > 1) { + if (params->num_levels >= FS_VERITY_MAX_LEVELS) { +diff --git a/include/linux/bpf.h b/include/linux/bpf.h +index 3329adbda..3025c1dad 100644 +--- a/include/linux/bpf.h ++++ b/include/linux/bpf.h +@@ -534,6 +534,8 @@ struct btf_func_model { + * programs only. Should not be used with normal calls and indirect calls. + */ + #define BPF_TRAMP_F_SKIP_FRAME BIT(2) ++/* Return the return value of fentry prog. Only used by bpf_struct_ops. */ ++#define BPF_TRAMP_F_RET_FENTRY_RET BIT(4) + + /* Each call __bpf_prog_enter + call bpf_func + call __bpf_prog_exit is ~50 + * bytes on x86. Pick a number to fit into BPF_IMAGE_SIZE / 2 +diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h +index 2ec062aaa..4d431d7b4 100644 +--- a/include/net/ip_fib.h ++++ b/include/net/ip_fib.h +@@ -553,5 +553,5 @@ int ip_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh, + int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nh, + u8 rt_family, unsigned char *flags, bool skip_oif); + int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nh, +- int nh_weight, u8 rt_family); ++ int nh_weight, u8 rt_family, u32 nh_tclassid); + #endif /* _NET_FIB_H */ +diff --git a/include/net/nexthop.h b/include/net/nexthop.h +index 4c8c9fe9a..fd87d727a 100644 +--- a/include/net/nexthop.h ++++ b/include/net/nexthop.h +@@ -211,7 +211,7 @@ int nexthop_mpath_fill_node(struct sk_buff *skb, struct nexthop *nh, + struct fib_nh_common *nhc = &nhi->fib_nhc; + int weight = nhg->nh_entries[i].weight; + +- if (fib_add_nexthop(skb, nhc, weight, rt_family) < 0) ++ if (fib_add_nexthop(skb, nhc, weight, rt_family, 0) < 0) + return -EMSGSIZE; + } + +diff --git a/include/net/sock.h b/include/net/sock.h +index 076eaef81..2032afc8a 100644 +--- a/include/net/sock.h ++++ b/include/net/sock.h +@@ -481,8 +481,10 @@ struct sock { + u32 sk_ack_backlog; + u32 sk_max_ack_backlog; + kuid_t sk_uid; ++ spinlock_t sk_peer_lock; + struct pid *sk_peer_pid; + const struct cred *sk_peer_cred; ++ + long sk_rcvtimeo; + ktime_t sk_stamp; + #if BITS_PER_LONG==32 +diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c +index 9d3278e10..d97de3551 100644 +--- a/kernel/bpf/bpf_struct_ops.c ++++ b/kernel/bpf/bpf_struct_ops.c +@@ -368,6 +368,7 @@ static int bpf_struct_ops_map_update_elem(struct bpf_map *map, void *key, + const struct btf_type *mtype, *ptype; + struct bpf_prog *prog; + u32 moff; ++ u32 flags; + + moff = btf_member_bit_offset(t, member) / 8; + ptype = btf_type_resolve_ptr(btf_vmlinux, member->type, NULL); +@@ -431,10 +432,12 @@ static int bpf_struct_ops_map_update_elem(struct bpf_map *map, void *key, + + tprogs[BPF_TRAMP_FENTRY].progs[0] = prog; + tprogs[BPF_TRAMP_FENTRY].nr_progs = 1; ++ flags = st_ops->func_models[i].ret_size > 0 ? ++ BPF_TRAMP_F_RET_FENTRY_RET : 0; + err = arch_prepare_bpf_trampoline(NULL, image, + st_map->image + PAGE_SIZE, +- &st_ops->func_models[i], 0, +- tprogs, NULL); ++ &st_ops->func_models[i], ++ flags, tprogs, NULL); + if (err < 0) + goto reset_unlock; + +diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c +index cee0c7bd3..ce9326707 100644 +--- a/kernel/bpf/core.c ++++ b/kernel/bpf/core.c +@@ -833,7 +833,7 @@ int bpf_jit_charge_modmem(u32 pages) + { + if (atomic_long_add_return(pages, &bpf_jit_current) > + (bpf_jit_limit >> PAGE_SHIFT)) { +- if (!capable(CAP_SYS_ADMIN)) { ++ if (!bpf_capable()) { + atomic_long_sub(pages, &bpf_jit_current); + return -EPERM; + } +diff --git a/kernel/entry/kvm.c b/kernel/entry/kvm.c +index b6678a5e3..2a3139dab 100644 +--- a/kernel/entry/kvm.c ++++ b/kernel/entry/kvm.c +@@ -16,8 +16,10 @@ static int xfer_to_guest_mode_work(struct kvm_vcpu *vcpu, unsigned long ti_work) + if (ti_work & _TIF_NEED_RESCHED) + schedule(); + +- if (ti_work & _TIF_NOTIFY_RESUME) ++ if (ti_work & _TIF_NOTIFY_RESUME) { + tracehook_notify_resume(NULL); ++ rseq_handle_notify_resume(NULL, NULL); ++ } + + ret = arch_xfer_to_guest_mode_handle_work(vcpu, ti_work); + if (ret) +diff --git a/kernel/rseq.c b/kernel/rseq.c +index a4f86a9d6..0077713bf 100644 +--- a/kernel/rseq.c ++++ b/kernel/rseq.c +@@ -268,9 +268,16 @@ void __rseq_handle_notify_resume(struct ksignal *ksig, struct pt_regs *regs) + return; + if (unlikely(!access_ok(t->rseq, sizeof(*t->rseq)))) + goto error; +- ret = rseq_ip_fixup(regs); +- if (unlikely(ret < 0)) +- goto error; ++ /* ++ * regs is NULL if and only if the caller is in a syscall path. Skip ++ * fixup and leave rseq_cs as is so that rseq_sycall() will detect and ++ * kill a misbehaving userspace on debug kernels. ++ */ ++ if (regs) { ++ ret = rseq_ip_fixup(regs); ++ if (unlikely(ret < 0)) ++ goto error; ++ } + if (unlikely(rseq_update_cpu_id(t))) + goto error; + return; +diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c +index 0f7bc658e..b365895c2 100644 +--- a/kernel/sched/cpufreq_schedutil.c ++++ b/kernel/sched/cpufreq_schedutil.c +@@ -618,9 +618,17 @@ static struct attribute *sugov_attrs[] = { + }; + ATTRIBUTE_GROUPS(sugov); + ++static void sugov_tunables_free(struct kobject *kobj) ++{ ++ struct gov_attr_set *attr_set = container_of(kobj, struct gov_attr_set, kobj); ++ ++ kfree(to_sugov_tunables(attr_set)); ++} ++ + static struct kobj_type sugov_tunables_ktype = { + .default_groups = sugov_groups, + .sysfs_ops = &governor_sysfs_ops, ++ .release = &sugov_tunables_free, + }; + + /********************** cpufreq governor interface *********************/ +@@ -720,12 +728,10 @@ static struct sugov_tunables *sugov_tunables_alloc(struct sugov_policy *sg_polic + return tunables; + } + +-static void sugov_tunables_free(struct sugov_tunables *tunables) ++static void sugov_clear_global_tunables(void) + { + if (!have_governor_per_policy()) + global_tunables = NULL; +- +- kfree(tunables); + } + + static int sugov_init(struct cpufreq_policy *policy) +@@ -788,7 +794,7 @@ static int sugov_init(struct cpufreq_policy *policy) + fail: + kobject_put(&tunables->attr_set.kobj); + policy->governor_data = NULL; +- sugov_tunables_free(tunables); ++ sugov_clear_global_tunables(); + + stop_kthread: + sugov_kthread_stop(sg_policy); +@@ -815,7 +821,7 @@ static void sugov_exit(struct cpufreq_policy *policy) + count = gov_attr_set_put(&tunables->attr_set, &sg_policy->tunables_hook); + policy->governor_data = NULL; + if (!count) +- sugov_tunables_free(tunables); ++ sugov_clear_global_tunables(); + + mutex_unlock(&global_tunables_lock); + +diff --git a/mm/util.c b/mm/util.c +index 3d05a88e0..6963f0194 100644 +--- a/mm/util.c ++++ b/mm/util.c +@@ -586,6 +586,10 @@ void *kvmalloc_node(size_t size, gfp_t flags, int node) + if (ret || size <= PAGE_SIZE) + return ret; + ++ /* Don't even allow crazy sizes */ ++ if (WARN_ON_ONCE(size > INT_MAX)) ++ return NULL; ++ + return __vmalloc_node(size, 1, flags, node, + __builtin_return_address(0)); + } +diff --git a/net/core/sock.c b/net/core/sock.c +index a51ea59ed..4f9409db1 100644 +--- a/net/core/sock.c ++++ b/net/core/sock.c +@@ -1257,6 +1257,16 @@ int sock_setsockopt(struct socket *sock, int level, int optname, + } + EXPORT_SYMBOL(sock_setsockopt); + ++static const struct cred *sk_get_peer_cred(struct sock *sk) ++{ ++ const struct cred *cred; ++ ++ spin_lock(&sk->sk_peer_lock); ++ cred = get_cred(sk->sk_peer_cred); ++ spin_unlock(&sk->sk_peer_lock); ++ ++ return cred; ++} + + static void cred_to_ucred(struct pid *pid, const struct cred *cred, + struct ucred *ucred) +@@ -1430,7 +1440,11 @@ int sock_getsockopt(struct socket *sock, int level, int optname, + struct ucred peercred; + if (len > sizeof(peercred)) + len = sizeof(peercred); ++ ++ spin_lock(&sk->sk_peer_lock); + cred_to_ucred(sk->sk_peer_pid, sk->sk_peer_cred, &peercred); ++ spin_unlock(&sk->sk_peer_lock); ++ + if (copy_to_user(optval, &peercred, len)) + return -EFAULT; + goto lenout; +@@ -1438,20 +1452,23 @@ int sock_getsockopt(struct socket *sock, int level, int optname, + + case SO_PEERGROUPS: + { ++ const struct cred *cred; + int ret, n; + +- if (!sk->sk_peer_cred) ++ cred = sk_get_peer_cred(sk); ++ if (!cred) + return -ENODATA; + +- n = sk->sk_peer_cred->group_info->ngroups; ++ n = cred->group_info->ngroups; + if (len < n * sizeof(gid_t)) { + len = n * sizeof(gid_t); ++ put_cred(cred); + return put_user(len, optlen) ? -EFAULT : -ERANGE; + } + len = n * sizeof(gid_t); + +- ret = groups_to_user((gid_t __user *)optval, +- sk->sk_peer_cred->group_info); ++ ret = groups_to_user((gid_t __user *)optval, cred->group_info); ++ put_cred(cred); + if (ret) + return ret; + goto lenout; +@@ -1794,9 +1811,10 @@ static void __sk_destruct(struct rcu_head *head) + sk->sk_frag.page = NULL; + } + +- if (sk->sk_peer_cred) +- put_cred(sk->sk_peer_cred); ++ /* We do not need to acquire sk->sk_peer_lock, we are the last user. */ ++ put_cred(sk->sk_peer_cred); + put_pid(sk->sk_peer_pid); ++ + if (likely(sk->sk_net_refcnt)) + put_net(sock_net(sk)); + sk_prot_free(sk->sk_prot_creator, sk); +@@ -3016,6 +3034,8 @@ void sock_init_data(struct socket *sock, struct sock *sk) + + sk->sk_peer_pid = NULL; + sk->sk_peer_cred = NULL; ++ spin_lock_init(&sk->sk_peer_lock); ++ + sk->sk_write_pending = 0; + sk->sk_rcvlowat = 1; + sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; +diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c +index 1f75dc686..642503e89 100644 +--- a/net/ipv4/fib_semantics.c ++++ b/net/ipv4/fib_semantics.c +@@ -1663,7 +1663,7 @@ EXPORT_SYMBOL_GPL(fib_nexthop_info); + + #if IS_ENABLED(CONFIG_IP_ROUTE_MULTIPATH) || IS_ENABLED(CONFIG_IPV6) + int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc, +- int nh_weight, u8 rt_family) ++ int nh_weight, u8 rt_family, u32 nh_tclassid) + { + const struct net_device *dev = nhc->nhc_dev; + struct rtnexthop *rtnh; +@@ -1681,6 +1681,9 @@ int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc, + + rtnh->rtnh_flags = flags; + ++ if (nh_tclassid && nla_put_u32(skb, RTA_FLOW, nh_tclassid)) ++ goto nla_put_failure; ++ + /* length of rtnetlink header + attributes */ + rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *)rtnh; + +@@ -1708,14 +1711,13 @@ static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi) + } + + for_nexthops(fi) { +- if (fib_add_nexthop(skb, &nh->nh_common, nh->fib_nh_weight, +- AF_INET) < 0) +- goto nla_put_failure; ++ u32 nh_tclassid = 0; + #ifdef CONFIG_IP_ROUTE_CLASSID +- if (nh->nh_tclassid && +- nla_put_u32(skb, RTA_FLOW, nh->nh_tclassid)) +- goto nla_put_failure; ++ nh_tclassid = nh->nh_tclassid; + #endif ++ if (fib_add_nexthop(skb, &nh->nh_common, nh->fib_nh_weight, ++ AF_INET, nh_tclassid) < 0) ++ goto nla_put_failure; + } endfor_nexthops(fi); + + mp_end: +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c +index b395cd26f..2359bb347 100644 +--- a/net/ipv4/udp.c ++++ b/net/ipv4/udp.c +@@ -1036,7 +1036,7 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) + __be16 dport; + u8 tos; + int err, is_udplite = IS_UDPLITE(sk); +- int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; ++ int corkreq = READ_ONCE(up->corkflag) || msg->msg_flags&MSG_MORE; + int (*getfrag)(void *, char *, int, int, int, struct sk_buff *); + struct sk_buff *skb; + struct ip_options_data opt_copy; +@@ -1345,7 +1345,7 @@ int udp_sendpage(struct sock *sk, struct page *page, int offset, + } + + up->len += size; +- if (!(up->corkflag || (flags&MSG_MORE))) ++ if (!(READ_ONCE(up->corkflag) || (flags&MSG_MORE))) + ret = udp_push_pending_frames(sk); + if (!ret) + ret = size; +@@ -2612,9 +2612,9 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, + switch (optname) { + case UDP_CORK: + if (val != 0) { +- up->corkflag = 1; ++ WRITE_ONCE(up->corkflag, 1); + } else { +- up->corkflag = 0; ++ WRITE_ONCE(up->corkflag, 0); + lock_sock(sk); + push_pending_frames(sk); + release_sock(sk); +@@ -2737,7 +2737,7 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, + + switch (optname) { + case UDP_CORK: +- val = up->corkflag; ++ val = READ_ONCE(up->corkflag); + break; + + case UDP_ENCAP: +diff --git a/net/ipv6/route.c b/net/ipv6/route.c +index 159002e31..92835e634 100644 +--- a/net/ipv6/route.c ++++ b/net/ipv6/route.c +@@ -5543,14 +5543,15 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb, + goto nla_put_failure; + + if (fib_add_nexthop(skb, &rt->fib6_nh->nh_common, +- rt->fib6_nh->fib_nh_weight, AF_INET6) < 0) ++ rt->fib6_nh->fib_nh_weight, AF_INET6, ++ 0) < 0) + goto nla_put_failure; + + list_for_each_entry_safe(sibling, next_sibling, + &rt->fib6_siblings, fib6_siblings) { + if (fib_add_nexthop(skb, &sibling->fib6_nh->nh_common, + sibling->fib6_nh->fib_nh_weight, +- AF_INET6) < 0) ++ AF_INET6, 0) < 0) + goto nla_put_failure; + } + +diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c +index a448b6cd4..1943ae510 100644 +--- a/net/ipv6/udp.c ++++ b/net/ipv6/udp.c +@@ -1288,7 +1288,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) + int addr_len = msg->msg_namelen; + bool connected = false; + int ulen = len; +- int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; ++ int corkreq = READ_ONCE(up->corkflag) || msg->msg_flags&MSG_MORE; + int err; + int is_udplite = IS_UDPLITE(sk); + int (*getfrag)(void *, char *, int, int, int, struct sk_buff *); +diff --git a/net/mac80211/mesh_ps.c b/net/mac80211/mesh_ps.c +index 204830a55..3fbd0b9ff 100644 +--- a/net/mac80211/mesh_ps.c ++++ b/net/mac80211/mesh_ps.c +@@ -2,6 +2,7 @@ + /* + * Copyright 2012-2013, Marco Porsch + * Copyright 2012-2013, cozybit Inc. ++ * Copyright (C) 2021 Intel Corporation + */ + + #include "mesh.h" +@@ -588,7 +589,7 @@ void ieee80211_mps_frame_release(struct sta_info *sta, + + /* only transmit to PS STA with announced, non-zero awake window */ + if (test_sta_flag(sta, WLAN_STA_PS_STA) && +- (!elems->awake_window || !le16_to_cpu(*elems->awake_window))) ++ (!elems->awake_window || !get_unaligned_le16(elems->awake_window))) + return; + + if (!test_sta_flag(sta, WLAN_STA_MPSP_OWNER)) +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index 673ad3cf2..bbbcc678c 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -2177,7 +2177,11 @@ bool ieee80211_parse_tx_radiotap(struct sk_buff *skb, + } + + vht_mcs = iterator.this_arg[4] >> 4; ++ if (vht_mcs > 11) ++ vht_mcs = 0; + vht_nss = iterator.this_arg[4] & 0xF; ++ if (!vht_nss || vht_nss > 8) ++ vht_nss = 1; + break; + + /* +@@ -3365,6 +3369,14 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, + if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head)) + goto out; + ++ /* If n == 2, the "while (*frag_tail)" loop above didn't execute ++ * and frag_tail should be &skb_shinfo(head)->frag_list. ++ * However, ieee80211_amsdu_prepare_head() can reallocate it. ++ * Reload frag_tail to have it pointing to the correct place. ++ */ ++ if (n == 2) ++ frag_tail = &skb_shinfo(head)->frag_list; ++ + /* + * Pad out the previous subframe to a multiple of 4 by adding the + * padding to the next one, that's being added. Note that head->len +diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c +index bca47fad5..4eed23e27 100644 +--- a/net/mac80211/wpa.c ++++ b/net/mac80211/wpa.c +@@ -520,6 +520,9 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx, + return RX_DROP_UNUSABLE; + } + ++ /* reload hdr - skb might have been reallocated */ ++ hdr = (void *)rx->skb->data; ++ + data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN - mic_len; + if (!rx->sta || data_len < 0) + return RX_DROP_UNUSABLE; +@@ -749,6 +752,9 @@ ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx) + return RX_DROP_UNUSABLE; + } + ++ /* reload hdr - skb might have been reallocated */ ++ hdr = (void *)rx->skb->data; ++ + data_len = skb->len - hdrlen - IEEE80211_GCMP_HDR_LEN - mic_len; + if (!rx->sta || data_len < 0) + return RX_DROP_UNUSABLE; +diff --git a/net/mptcp/mptcp_diag.c b/net/mptcp/mptcp_diag.c +index 5f390a97f..f1af3f448 100644 +--- a/net/mptcp/mptcp_diag.c ++++ b/net/mptcp/mptcp_diag.c +@@ -36,7 +36,7 @@ static int mptcp_diag_dump_one(struct netlink_callback *cb, + struct sock *sk; + + net = sock_net(in_skb->sk); +- msk = mptcp_token_get_sock(req->id.idiag_cookie[0]); ++ msk = mptcp_token_get_sock(net, req->id.idiag_cookie[0]); + if (!msk) + goto out_nosk; + +diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h +index 13ab89dc1..3e5af8397 100644 +--- a/net/mptcp/protocol.h ++++ b/net/mptcp/protocol.h +@@ -424,7 +424,7 @@ int mptcp_token_new_connect(struct sock *sk); + void mptcp_token_accept(struct mptcp_subflow_request_sock *r, + struct mptcp_sock *msk); + bool mptcp_token_exists(u32 token); +-struct mptcp_sock *mptcp_token_get_sock(u32 token); ++struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token); + struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot, + long *s_num); + void mptcp_token_destroy(struct mptcp_sock *msk); +diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c +index bba5696fe..2e9238490 100644 +--- a/net/mptcp/subflow.c ++++ b/net/mptcp/subflow.c +@@ -69,7 +69,7 @@ static struct mptcp_sock *subflow_token_join_request(struct request_sock *req, + struct mptcp_sock *msk; + int local_id; + +- msk = mptcp_token_get_sock(subflow_req->token); ++ msk = mptcp_token_get_sock(sock_net(req_to_sk(req)), subflow_req->token); + if (!msk) { + SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINNOTOKEN); + return NULL; +diff --git a/net/mptcp/syncookies.c b/net/mptcp/syncookies.c +index 37127781a..7f2252634 100644 +--- a/net/mptcp/syncookies.c ++++ b/net/mptcp/syncookies.c +@@ -108,18 +108,12 @@ bool mptcp_token_join_cookie_init_state(struct mptcp_subflow_request_sock *subfl + + e->valid = 0; + +- msk = mptcp_token_get_sock(e->token); ++ msk = mptcp_token_get_sock(net, e->token); + if (!msk) { + spin_unlock_bh(&join_entry_locks[i]); + return false; + } + +- /* If this fails, the token got re-used in the mean time by another +- * mptcp socket in a different netns, i.e. entry is outdated. +- */ +- if (!net_eq(sock_net((struct sock *)msk), net)) +- goto err_put; +- + subflow_req->remote_nonce = e->remote_nonce; + subflow_req->local_nonce = e->local_nonce; + subflow_req->backup = e->backup; +@@ -128,11 +122,6 @@ bool mptcp_token_join_cookie_init_state(struct mptcp_subflow_request_sock *subfl + subflow_req->msk = msk; + spin_unlock_bh(&join_entry_locks[i]); + return true; +- +-err_put: +- spin_unlock_bh(&join_entry_locks[i]); +- sock_put((struct sock *)msk); +- return false; + } + + void __init mptcp_join_cookie_init(void) +diff --git a/net/mptcp/token.c b/net/mptcp/token.c +index 0691a4883..f0d656bf2 100644 +--- a/net/mptcp/token.c ++++ b/net/mptcp/token.c +@@ -232,6 +232,7 @@ bool mptcp_token_exists(u32 token) + + /** + * mptcp_token_get_sock - retrieve mptcp connection sock using its token ++ * @net: restrict to this namespace + * @token: token of the mptcp connection to retrieve + * + * This function returns the mptcp connection structure with the given token. +@@ -239,7 +240,7 @@ bool mptcp_token_exists(u32 token) + * + * returns NULL if no connection with the given token value exists. + */ +-struct mptcp_sock *mptcp_token_get_sock(u32 token) ++struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token) + { + struct hlist_nulls_node *pos; + struct token_bucket *bucket; +@@ -252,11 +253,15 @@ struct mptcp_sock *mptcp_token_get_sock(u32 token) + again: + sk_nulls_for_each_rcu(sk, pos, &bucket->msk_chain) { + msk = mptcp_sk(sk); +- if (READ_ONCE(msk->token) != token) ++ if (READ_ONCE(msk->token) != token || ++ !net_eq(sock_net(sk), net)) + continue; ++ + if (!refcount_inc_not_zero(&sk->sk_refcnt)) + goto not_found; +- if (READ_ONCE(msk->token) != token) { ++ ++ if (READ_ONCE(msk->token) != token || ++ !net_eq(sock_net(sk), net)) { + sock_put(sk); + goto again; + } +diff --git a/net/mptcp/token_test.c b/net/mptcp/token_test.c +index e1bd6f0a0..5d984bec1 100644 +--- a/net/mptcp/token_test.c ++++ b/net/mptcp/token_test.c +@@ -11,6 +11,7 @@ static struct mptcp_subflow_request_sock *build_req_sock(struct kunit *test) + GFP_USER); + KUNIT_EXPECT_NOT_ERR_OR_NULL(test, req); + mptcp_token_init_request((struct request_sock *)req); ++ sock_net_set((struct sock *)req, &init_net); + return req; + } + +@@ -22,7 +23,7 @@ static void mptcp_token_test_req_basic(struct kunit *test) + KUNIT_ASSERT_EQ(test, 0, + mptcp_token_new_request((struct request_sock *)req)); + KUNIT_EXPECT_NE(test, 0, (int)req->token); +- KUNIT_EXPECT_PTR_EQ(test, null_msk, mptcp_token_get_sock(req->token)); ++ KUNIT_EXPECT_PTR_EQ(test, null_msk, mptcp_token_get_sock(&init_net, req->token)); + + /* cleanup */ + mptcp_token_destroy_request((struct request_sock *)req); +@@ -55,6 +56,7 @@ static struct mptcp_sock *build_msk(struct kunit *test) + msk = kunit_kzalloc(test, sizeof(struct mptcp_sock), GFP_USER); + KUNIT_EXPECT_NOT_ERR_OR_NULL(test, msk); + refcount_set(&((struct sock *)msk)->sk_refcnt, 1); ++ sock_net_set((struct sock *)msk, &init_net); + return msk; + } + +@@ -74,11 +76,11 @@ static void mptcp_token_test_msk_basic(struct kunit *test) + mptcp_token_new_connect((struct sock *)icsk)); + KUNIT_EXPECT_NE(test, 0, (int)ctx->token); + KUNIT_EXPECT_EQ(test, ctx->token, msk->token); +- KUNIT_EXPECT_PTR_EQ(test, msk, mptcp_token_get_sock(ctx->token)); ++ KUNIT_EXPECT_PTR_EQ(test, msk, mptcp_token_get_sock(&init_net, ctx->token)); + KUNIT_EXPECT_EQ(test, 2, (int)refcount_read(&sk->sk_refcnt)); + + mptcp_token_destroy(msk); +- KUNIT_EXPECT_PTR_EQ(test, null_msk, mptcp_token_get_sock(ctx->token)); ++ KUNIT_EXPECT_PTR_EQ(test, null_msk, mptcp_token_get_sock(&init_net, ctx->token)); + } + + static void mptcp_token_test_accept(struct kunit *test) +@@ -90,11 +92,11 @@ static void mptcp_token_test_accept(struct kunit *test) + mptcp_token_new_request((struct request_sock *)req)); + msk->token = req->token; + mptcp_token_accept(req, msk); +- KUNIT_EXPECT_PTR_EQ(test, msk, mptcp_token_get_sock(msk->token)); ++ KUNIT_EXPECT_PTR_EQ(test, msk, mptcp_token_get_sock(&init_net, msk->token)); + + /* this is now a no-op */ + mptcp_token_destroy_request((struct request_sock *)req); +- KUNIT_EXPECT_PTR_EQ(test, msk, mptcp_token_get_sock(msk->token)); ++ KUNIT_EXPECT_PTR_EQ(test, msk, mptcp_token_get_sock(&init_net, msk->token)); + + /* cleanup */ + mptcp_token_destroy(msk); +@@ -116,7 +118,7 @@ static void mptcp_token_test_destroyed(struct kunit *test) + + /* simulate race on removal */ + refcount_set(&sk->sk_refcnt, 0); +- KUNIT_EXPECT_PTR_EQ(test, null_msk, mptcp_token_get_sock(msk->token)); ++ KUNIT_EXPECT_PTR_EQ(test, null_msk, mptcp_token_get_sock(&init_net, msk->token)); + + /* cleanup */ + mptcp_token_destroy(msk); +diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h +index 7cd1d31fb..b0670388d 100644 +--- a/net/netfilter/ipset/ip_set_hash_gen.h ++++ b/net/netfilter/ipset/ip_set_hash_gen.h +@@ -132,11 +132,11 @@ htable_size(u8 hbits) + { + size_t hsize; + +- /* We must fit both into u32 in jhash and size_t */ ++ /* We must fit both into u32 in jhash and INT_MAX in kvmalloc_node() */ + if (hbits > 31) + return 0; + hsize = jhash_size(hbits); +- if ((((size_t)-1) - sizeof(struct htable)) / sizeof(struct hbucket *) ++ if ((INT_MAX - sizeof(struct htable)) / sizeof(struct hbucket *) + < hsize) + return 0; + +diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c +index c100c6b11..2c467c422 100644 +--- a/net/netfilter/ipvs/ip_vs_conn.c ++++ b/net/netfilter/ipvs/ip_vs_conn.c +@@ -1468,6 +1468,10 @@ int __init ip_vs_conn_init(void) + int idx; + + /* Compute size and mask */ ++ if (ip_vs_conn_tab_bits < 8 || ip_vs_conn_tab_bits > 20) { ++ pr_info("conn_tab_bits not in [8, 20]. Using default value\n"); ++ ip_vs_conn_tab_bits = CONFIG_IP_VS_TAB_BITS; ++ } + ip_vs_conn_tab_size = 1 << ip_vs_conn_tab_bits; + ip_vs_conn_tab_mask = ip_vs_conn_tab_size - 1; + +diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c +index deaf24904..c8a2e09a9 100644 +--- a/net/netfilter/nf_conntrack_core.c ++++ b/net/netfilter/nf_conntrack_core.c +@@ -76,6 +76,9 @@ static __read_mostly struct kmem_cache *nf_conntrack_cachep; + static DEFINE_SPINLOCK(nf_conntrack_locks_all_lock); + static __read_mostly bool nf_conntrack_locks_all; + ++/* serialize hash resizes and nf_ct_iterate_cleanup */ ++static DEFINE_MUTEX(nf_conntrack_mutex); ++ + #define GC_SCAN_INTERVAL (120u * HZ) + #define GC_SCAN_MAX_DURATION msecs_to_jiffies(10) + +@@ -2177,28 +2180,31 @@ get_next_corpse(int (*iter)(struct nf_conn *i, void *data), + spinlock_t *lockp; + + for (; *bucket < nf_conntrack_htable_size; (*bucket)++) { ++ struct hlist_nulls_head *hslot = &nf_conntrack_hash[*bucket]; ++ ++ if (hlist_nulls_empty(hslot)) ++ continue; ++ + lockp = &nf_conntrack_locks[*bucket % CONNTRACK_LOCKS]; + local_bh_disable(); + nf_conntrack_lock(lockp); +- if (*bucket < nf_conntrack_htable_size) { +- hlist_nulls_for_each_entry(h, n, &nf_conntrack_hash[*bucket], hnnode) { +- if (NF_CT_DIRECTION(h) != IP_CT_DIR_REPLY) +- continue; +- /* All nf_conn objects are added to hash table twice, one +- * for original direction tuple, once for the reply tuple. +- * +- * Exception: In the IPS_NAT_CLASH case, only the reply +- * tuple is added (the original tuple already existed for +- * a different object). +- * +- * We only need to call the iterator once for each +- * conntrack, so we just use the 'reply' direction +- * tuple while iterating. +- */ +- ct = nf_ct_tuplehash_to_ctrack(h); +- if (iter(ct, data)) +- goto found; +- } ++ hlist_nulls_for_each_entry(h, n, hslot, hnnode) { ++ if (NF_CT_DIRECTION(h) != IP_CT_DIR_REPLY) ++ continue; ++ /* All nf_conn objects are added to hash table twice, one ++ * for original direction tuple, once for the reply tuple. ++ * ++ * Exception: In the IPS_NAT_CLASH case, only the reply ++ * tuple is added (the original tuple already existed for ++ * a different object). ++ * ++ * We only need to call the iterator once for each ++ * conntrack, so we just use the 'reply' direction ++ * tuple while iterating. ++ */ ++ ct = nf_ct_tuplehash_to_ctrack(h); ++ if (iter(ct, data)) ++ goto found; + } + spin_unlock(lockp); + local_bh_enable(); +@@ -2216,26 +2222,20 @@ get_next_corpse(int (*iter)(struct nf_conn *i, void *data), + static void nf_ct_iterate_cleanup(int (*iter)(struct nf_conn *i, void *data), + void *data, u32 portid, int report) + { +- unsigned int bucket = 0, sequence; ++ unsigned int bucket = 0; + struct nf_conn *ct; + + might_sleep(); + +- for (;;) { +- sequence = read_seqcount_begin(&nf_conntrack_generation); +- +- while ((ct = get_next_corpse(iter, data, &bucket)) != NULL) { +- /* Time to push up daises... */ ++ mutex_lock(&nf_conntrack_mutex); ++ while ((ct = get_next_corpse(iter, data, &bucket)) != NULL) { ++ /* Time to push up daises... */ + +- nf_ct_delete(ct, portid, report); +- nf_ct_put(ct); +- cond_resched(); +- } +- +- if (!read_seqcount_retry(&nf_conntrack_generation, sequence)) +- break; +- bucket = 0; ++ nf_ct_delete(ct, portid, report); ++ nf_ct_put(ct); ++ cond_resched(); + } ++ mutex_unlock(&nf_conntrack_mutex); + } + + struct iter_data { +@@ -2465,8 +2465,10 @@ int nf_conntrack_hash_resize(unsigned int hashsize) + if (!hash) + return -ENOMEM; + ++ mutex_lock(&nf_conntrack_mutex); + old_size = nf_conntrack_htable_size; + if (old_size == hashsize) { ++ mutex_unlock(&nf_conntrack_mutex); + kvfree(hash); + return 0; + } +@@ -2502,6 +2504,8 @@ int nf_conntrack_hash_resize(unsigned int hashsize) + nf_conntrack_all_unlock(); + local_bh_enable(); + ++ mutex_unlock(&nf_conntrack_mutex); ++ + synchronize_net(); + kvfree(old_hash); + return 0; +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c +index c605a3e71..b781ba97c 100644 +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -4265,7 +4265,7 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk, + if (ops->privsize != NULL) + size = ops->privsize(nla, &desc); + alloc_size = sizeof(*set) + size + udlen; +- if (alloc_size < size) ++ if (alloc_size < size || alloc_size > INT_MAX) + return -ENOMEM; + set = kvzalloc(alloc_size, GFP_KERNEL); + if (!set) +diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c +index a5212a3f8..8ff6945b9 100644 +--- a/net/sched/cls_flower.c ++++ b/net/sched/cls_flower.c +@@ -2169,18 +2169,24 @@ static void fl_walk(struct tcf_proto *tp, struct tcf_walker *arg, + + arg->count = arg->skip; + ++ rcu_read_lock(); + idr_for_each_entry_continue_ul(&head->handle_idr, f, tmp, id) { + /* don't return filters that are being deleted */ + if (!refcount_inc_not_zero(&f->refcnt)) + continue; ++ rcu_read_unlock(); ++ + if (arg->fn(tp, f, arg) < 0) { + __fl_put(f); + arg->stop = 1; ++ rcu_read_lock(); + break; + } + __fl_put(f); + arg->count++; ++ rcu_read_lock(); + } ++ rcu_read_unlock(); + arg->cookie = id; + } + +diff --git a/net/sctp/input.c b/net/sctp/input.c +index 49c49a4d2..34494a0b2 100644 +--- a/net/sctp/input.c ++++ b/net/sctp/input.c +@@ -677,7 +677,7 @@ static int sctp_rcv_ootb(struct sk_buff *skb) + ch = skb_header_pointer(skb, offset, sizeof(*ch), &_ch); + + /* Break out if chunk length is less then minimal. */ +- if (ntohs(ch->length) < sizeof(_ch)) ++ if (!ch || ntohs(ch->length) < sizeof(_ch)) + break; + + ch_end = offset + SCTP_PAD4(ntohs(ch->length)); +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c +index d5c0ae34b..b7edca89e 100644 +--- a/net/unix/af_unix.c ++++ b/net/unix/af_unix.c +@@ -593,20 +593,42 @@ static void unix_release_sock(struct sock *sk, int embrion) + + static void init_peercred(struct sock *sk) + { +- put_pid(sk->sk_peer_pid); +- if (sk->sk_peer_cred) +- put_cred(sk->sk_peer_cred); ++ const struct cred *old_cred; ++ struct pid *old_pid; ++ ++ spin_lock(&sk->sk_peer_lock); ++ old_pid = sk->sk_peer_pid; ++ old_cred = sk->sk_peer_cred; + sk->sk_peer_pid = get_pid(task_tgid(current)); + sk->sk_peer_cred = get_current_cred(); ++ spin_unlock(&sk->sk_peer_lock); ++ ++ put_pid(old_pid); ++ put_cred(old_cred); + } + + static void copy_peercred(struct sock *sk, struct sock *peersk) + { +- put_pid(sk->sk_peer_pid); +- if (sk->sk_peer_cred) +- put_cred(sk->sk_peer_cred); ++ const struct cred *old_cred; ++ struct pid *old_pid; ++ ++ if (sk < peersk) { ++ spin_lock(&sk->sk_peer_lock); ++ spin_lock_nested(&peersk->sk_peer_lock, SINGLE_DEPTH_NESTING); ++ } else { ++ spin_lock(&peersk->sk_peer_lock); ++ spin_lock_nested(&sk->sk_peer_lock, SINGLE_DEPTH_NESTING); ++ } ++ old_pid = sk->sk_peer_pid; ++ old_cred = sk->sk_peer_cred; + sk->sk_peer_pid = get_pid(peersk->sk_peer_pid); + sk->sk_peer_cred = get_cred(peersk->sk_peer_cred); ++ ++ spin_unlock(&sk->sk_peer_lock); ++ spin_unlock(&peersk->sk_peer_lock); ++ ++ put_pid(old_pid); ++ put_cred(old_cred); + } + + static int unix_listen(struct socket *sock, int backlog) +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index f47f63998..9f37adb2b 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6375,6 +6375,20 @@ static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, + hda_fixup_thinkpad_acpi(codec, fix, action); + } + ++/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */ ++static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, ++ const struct hda_fixup *fix, ++ int action) ++{ ++ struct alc_spec *spec = codec->spec; ++ ++ switch (action) { ++ case HDA_FIXUP_ACT_PRE_PROBE: ++ spec->gen.suppress_auto_mute = 1; ++ break; ++ } ++} ++ + /* for alc295_fixup_hp_top_speakers */ + #include "hp_x360_helper.c" + +@@ -6591,6 +6605,10 @@ enum { + ALC623_FIXUP_LENOVO_THINKSTATION_P340, + ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, + ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST, ++ ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS, ++ ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, ++ ALC287_FIXUP_YOGA7_14ITL_SPEAKERS, ++ ALC287_FIXUP_13S_GEN2_SPEAKERS + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -8175,6 +8193,113 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF, + }, ++ [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = { ++ .type = HDA_FIXUP_VERBS, ++ //.v.verbs = legion_15imhg05_coefs, ++ .v.verbs = (const struct hda_verb[]) { ++ // set left speaker Legion 7i. ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x41 }, ++ ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x1a }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, ++ ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, ++ ++ // set right speaker Legion 7i. ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x42 }, ++ ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x2a }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, ++ ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, ++ {} ++ }, ++ .chained = true, ++ .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, ++ }, ++ [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc287_fixup_legion_15imhg05_speakers, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_HEADSET_MODE, ++ }, ++ [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = { ++ .type = HDA_FIXUP_VERBS, ++ .v.verbs = (const struct hda_verb[]) { ++ // set left speaker Yoga 7i. ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x41 }, ++ ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x1a }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, ++ ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, ++ ++ // set right speaker Yoga 7i. ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x46 }, ++ ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x2a }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, ++ ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, ++ {} ++ }, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_HEADSET_MODE, ++ }, ++ [ALC287_FIXUP_13S_GEN2_SPEAKERS] = { ++ .type = HDA_FIXUP_VERBS, ++ .v.verbs = (const struct hda_verb[]) { ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x41 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x42 }, ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, ++ {} ++ }, ++ .chained = true, ++ .chain_id = ALC269_FIXUP_HEADSET_MODE, ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -8567,6 +8692,10 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME), + SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF), + SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP), ++ SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS), ++ SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), ++ SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), ++ SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS), + SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI), + SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), + SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI), +diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c +index 148c095df..f4b380d6a 100644 +--- a/sound/soc/soc-dapm.c ++++ b/sound/soc/soc-dapm.c +@@ -2528,9 +2528,20 @@ static struct snd_soc_dapm_widget *dapm_find_widget( + { + struct snd_soc_dapm_widget *w; + struct snd_soc_dapm_widget *fallback = NULL; ++ char prefixed_pin[80]; ++ const char *pin_name; ++ const char *prefix = soc_dapm_prefix(dapm); ++ ++ if (prefix) { ++ snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s", ++ prefix, pin); ++ pin_name = prefixed_pin; ++ } else { ++ pin_name = pin; ++ } + + for_each_card_widgets(dapm->card, w) { +- if (!strcmp(w->name, pin)) { ++ if (!strcmp(w->name, pin_name)) { + if (w->dapm == dapm) + return w; + else +diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile +index b5322d600..1d9155533 100644 +--- a/tools/testing/selftests/bpf/Makefile ++++ b/tools/testing/selftests/bpf/Makefile +@@ -326,7 +326,8 @@ $(TRUNNER_BPF_OBJS): $(TRUNNER_OUTPUT)/%.o: \ + $(TRUNNER_BPF_PROGS_DIR)/%.c \ + $(TRUNNER_BPF_PROGS_DIR)/*.h \ + $$(INCLUDE_DIR)/vmlinux.h \ +- $(wildcard $(BPFDIR)/bpf_*.h) | $(TRUNNER_OUTPUT) ++ $(wildcard $(BPFDIR)/bpf_*.h) \ ++ | $(TRUNNER_OUTPUT) $$(BPFOBJ) + $$(call $(TRUNNER_BPF_BUILD_RULE),$$<,$$@, \ + $(TRUNNER_BPF_CFLAGS), \ + $(TRUNNER_BPF_LDFLAGS)) +diff --git a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh +index 59ea56945..b497bb85b 100755 +--- a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh ++++ b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh +@@ -112,6 +112,14 @@ setup() + ip netns add "${NS2}" + ip netns add "${NS3}" + ++ # rp_filter gets confused by what these tests are doing, so disable it ++ ip netns exec ${NS1} sysctl -wq net.ipv4.conf.all.rp_filter=0 ++ ip netns exec ${NS2} sysctl -wq net.ipv4.conf.all.rp_filter=0 ++ ip netns exec ${NS3} sysctl -wq net.ipv4.conf.all.rp_filter=0 ++ ip netns exec ${NS1} sysctl -wq net.ipv4.conf.default.rp_filter=0 ++ ip netns exec ${NS2} sysctl -wq net.ipv4.conf.default.rp_filter=0 ++ ip netns exec ${NS3} sysctl -wq net.ipv4.conf.default.rp_filter=0 ++ + ip link add veth1 type veth peer name veth2 + ip link add veth3 type veth peer name veth4 + ip link add veth5 type veth peer name veth6 +@@ -236,11 +244,6 @@ setup() + ip -netns ${NS1} -6 route add ${IPv6_GRE}/128 dev veth5 via ${IPv6_6} ${VRF} + ip -netns ${NS2} -6 route add ${IPv6_GRE}/128 dev veth7 via ${IPv6_8} ${VRF} + +- # rp_filter gets confused by what these tests are doing, so disable it +- ip netns exec ${NS1} sysctl -wq net.ipv4.conf.all.rp_filter=0 +- ip netns exec ${NS2} sysctl -wq net.ipv4.conf.all.rp_filter=0 +- ip netns exec ${NS3} sysctl -wq net.ipv4.conf.all.rp_filter=0 +- + TMPFILE=$(mktemp /tmp/test_lwt_ip_encap.XXXXXX) + + sleep 1 # reduce flakiness diff --git a/patch/kernel/rockchip-rk3588-legacy/patch-5.10.71-72.patch b/patch/kernel/rockchip-rk3588-legacy/patch-5.10.71-72.patch new file mode 100644 index 0000000000..87020825e9 --- /dev/null +++ b/patch/kernel/rockchip-rk3588-legacy/patch-5.10.71-72.patch @@ -0,0 +1,1097 @@ +diff --git a/Makefile b/Makefile +index 00935cfee..e0955ff9a 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 10 +-SUBLEVEL = 71 ++SUBLEVEL = 72 + EXTRAVERSION = + NAME = Dare mighty things + +diff --git a/arch/sparc/lib/iomap.c b/arch/sparc/lib/iomap.c +index c9da9f139..f3a8cd491 100644 +--- a/arch/sparc/lib/iomap.c ++++ b/arch/sparc/lib/iomap.c +@@ -19,8 +19,10 @@ void ioport_unmap(void __iomem *addr) + EXPORT_SYMBOL(ioport_map); + EXPORT_SYMBOL(ioport_unmap); + ++#ifdef CONFIG_PCI + void pci_iounmap(struct pci_dev *dev, void __iomem * addr) + { + /* nothing to do */ + } + EXPORT_SYMBOL(pci_iounmap); ++#endif +diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c +index e6db1a1f2..1f5d96ba4 100644 +--- a/arch/x86/events/core.c ++++ b/arch/x86/events/core.c +@@ -2284,6 +2284,7 @@ static int x86_pmu_event_init(struct perf_event *event) + if (err) { + if (event->destroy) + event->destroy(event); ++ event->destroy = NULL; + } + + if (READ_ONCE(x86_pmu.attr_rdpmc) && +diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c +index 1c23aee37..5e1d7396a 100644 +--- a/arch/x86/kvm/svm/svm.c ++++ b/arch/x86/kvm/svm/svm.c +@@ -1497,6 +1497,8 @@ static void svm_clear_vintr(struct vcpu_svm *svm) + (svm->nested.ctl.int_ctl & V_TPR_MASK)); + svm->vmcb->control.int_ctl |= svm->nested.ctl.int_ctl & + V_IRQ_INJECTION_BITS_MASK; ++ ++ svm->vmcb->control.int_vector = svm->nested.ctl.int_vector; + } + + vmcb_mark_dirty(svm->vmcb, VMCB_INTR); +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c +index d65da3b58..b885063dc 100644 +--- a/arch/x86/kvm/x86.c ++++ b/arch/x86/kvm/x86.c +@@ -1250,6 +1250,13 @@ static const u32 msrs_to_save_all[] = { + MSR_ARCH_PERFMON_EVENTSEL0 + 12, MSR_ARCH_PERFMON_EVENTSEL0 + 13, + MSR_ARCH_PERFMON_EVENTSEL0 + 14, MSR_ARCH_PERFMON_EVENTSEL0 + 15, + MSR_ARCH_PERFMON_EVENTSEL0 + 16, MSR_ARCH_PERFMON_EVENTSEL0 + 17, ++ ++ MSR_K7_EVNTSEL0, MSR_K7_EVNTSEL1, MSR_K7_EVNTSEL2, MSR_K7_EVNTSEL3, ++ MSR_K7_PERFCTR0, MSR_K7_PERFCTR1, MSR_K7_PERFCTR2, MSR_K7_PERFCTR3, ++ MSR_F15H_PERF_CTL0, MSR_F15H_PERF_CTL1, MSR_F15H_PERF_CTL2, ++ MSR_F15H_PERF_CTL3, MSR_F15H_PERF_CTL4, MSR_F15H_PERF_CTL5, ++ MSR_F15H_PERF_CTR0, MSR_F15H_PERF_CTR1, MSR_F15H_PERF_CTR2, ++ MSR_F15H_PERF_CTR3, MSR_F15H_PERF_CTR4, MSR_F15H_PERF_CTR5, + }; + + static u32 msrs_to_save[ARRAY_SIZE(msrs_to_save_all)]; +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c +index 0e6e73b80..8916163d5 100644 +--- a/drivers/ata/libata-core.c ++++ b/drivers/ata/libata-core.c +@@ -2199,6 +2199,25 @@ static void ata_dev_config_ncq_prio(struct ata_device *dev) + + } + ++static bool ata_dev_check_adapter(struct ata_device *dev, ++ unsigned short vendor_id) ++{ ++ struct pci_dev *pcidev = NULL; ++ struct device *parent_dev = NULL; ++ ++ for (parent_dev = dev->tdev.parent; parent_dev != NULL; ++ parent_dev = parent_dev->parent) { ++ if (dev_is_pci(parent_dev)) { ++ pcidev = to_pci_dev(parent_dev); ++ if (pcidev->vendor == vendor_id) ++ return true; ++ break; ++ } ++ } ++ ++ return false; ++} ++ + static int ata_dev_config_ncq(struct ata_device *dev, + char *desc, size_t desc_sz) + { +@@ -2217,6 +2236,13 @@ static int ata_dev_config_ncq(struct ata_device *dev, + snprintf(desc, desc_sz, "NCQ (not used)"); + return 0; + } ++ ++ if (dev->horkage & ATA_HORKAGE_NO_NCQ_ON_ATI && ++ ata_dev_check_adapter(dev, PCI_VENDOR_ID_ATI)) { ++ snprintf(desc, desc_sz, "NCQ (not used)"); ++ return 0; ++ } ++ + if (ap->flags & ATA_FLAG_NCQ) { + hdepth = min(ap->scsi_host->can_queue, ATA_MAX_QUEUE); + dev->flags |= ATA_DFLAG_NCQ; +@@ -3951,9 +3977,11 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { + { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, + { "Samsung SSD 860*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | +- ATA_HORKAGE_ZERO_AFTER_TRIM, }, ++ ATA_HORKAGE_ZERO_AFTER_TRIM | ++ ATA_HORKAGE_NO_NCQ_ON_ATI, }, + { "Samsung SSD 870*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | +- ATA_HORKAGE_ZERO_AFTER_TRIM, }, ++ ATA_HORKAGE_ZERO_AFTER_TRIM | ++ ATA_HORKAGE_NO_NCQ_ON_ATI, }, + { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | + ATA_HORKAGE_ZERO_AFTER_TRIM, }, + +@@ -6108,6 +6136,8 @@ static int __init ata_parse_force_one(char **cur, + { "ncq", .horkage_off = ATA_HORKAGE_NONCQ }, + { "noncqtrim", .horkage_on = ATA_HORKAGE_NO_NCQ_TRIM }, + { "ncqtrim", .horkage_off = ATA_HORKAGE_NO_NCQ_TRIM }, ++ { "noncqati", .horkage_on = ATA_HORKAGE_NO_NCQ_ON_ATI }, ++ { "ncqati", .horkage_off = ATA_HORKAGE_NO_NCQ_ON_ATI }, + { "dump_id", .horkage_on = ATA_HORKAGE_DUMP_ID }, + { "pio0", .xfer_mask = 1 << (ATA_SHIFT_PIO + 0) }, + { "pio1", .xfer_mask = 1 << (ATA_SHIFT_PIO + 1) }, +diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c +index 9f3e6e234..c5a247291 100644 +--- a/drivers/irqchip/irq-gic.c ++++ b/drivers/irqchip/irq-gic.c +@@ -107,6 +107,8 @@ static DEFINE_RAW_SPINLOCK(cpu_map_lock); + + #endif + ++static DEFINE_STATIC_KEY_FALSE(needs_rmw_access); ++ + /* + * The GIC mapping of CPU interfaces does not necessarily match + * the logical CPU numbering. Let's use a mapping as returned +@@ -820,6 +822,25 @@ void gic_set_irq_priority(struct irq_data *d, u8 pri) + #endif + + #ifdef CONFIG_SMP ++static void rmw_writeb(u8 bval, void __iomem *addr) ++{ ++ static DEFINE_RAW_SPINLOCK(rmw_lock); ++ unsigned long offset = (unsigned long)addr & 3UL; ++ unsigned long shift = offset * 8; ++ unsigned long flags; ++ u32 val; ++ ++ raw_spin_lock_irqsave(&rmw_lock, flags); ++ ++ addr -= offset; ++ val = readl_relaxed(addr); ++ val &= ~GENMASK(shift + 7, shift); ++ val |= bval << shift; ++ writel_relaxed(val, addr); ++ ++ raw_spin_unlock_irqrestore(&rmw_lock, flags); ++} ++ + static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, + bool force) + { +@@ -834,7 +855,10 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, + if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids) + return -EINVAL; + +- writeb_relaxed(gic_cpu_map[cpu], reg); ++ if (static_branch_unlikely(&needs_rmw_access)) ++ rmw_writeb(gic_cpu_map[cpu], reg); ++ else ++ writeb_relaxed(gic_cpu_map[cpu], reg); + irq_data_update_effective_affinity(d, cpumask_of(cpu)); + + return IRQ_SET_MASK_OK_DONE; +@@ -1437,6 +1461,30 @@ static bool gic_check_eoimode(struct device_node *node, void __iomem **base) + return true; + } + ++static bool gic_enable_rmw_access(void *data) ++{ ++ /* ++ * The EMEV2 class of machines has a broken interconnect, and ++ * locks up on accesses that are less than 32bit. So far, only ++ * the affinity setting requires it. ++ */ ++ if (of_machine_is_compatible("renesas,emev2")) { ++ static_branch_enable(&needs_rmw_access); ++ return true; ++ } ++ ++ return false; ++} ++ ++static const struct gic_quirk gic_quirks[] = { ++ { ++ .desc = "broken byte access", ++ .compatible = "arm,pl390", ++ .init = gic_enable_rmw_access, ++ }, ++ { }, ++}; ++ + static int gic_of_setup(struct gic_chip_data *gic, struct device_node *node) + { + if (!gic || !node) +@@ -1453,6 +1501,8 @@ static int gic_of_setup(struct gic_chip_data *gic, struct device_node *node) + if (of_property_read_u32(node, "cpu-offset", &gic->percpu_offset)) + gic->percpu_offset = 0; + ++ gic_enable_of_quirks(node, gic_quirks, gic); ++ + return 0; + + error: +diff --git a/drivers/misc/habanalabs/gaudi/gaudi_security.c b/drivers/misc/habanalabs/gaudi/gaudi_security.c +index 2d7add0e5..9343a81d3 100644 +--- a/drivers/misc/habanalabs/gaudi/gaudi_security.c ++++ b/drivers/misc/habanalabs/gaudi/gaudi_security.c +@@ -8,16 +8,21 @@ + #include "gaudiP.h" + #include "../include/gaudi/asic_reg/gaudi_regs.h" + +-#define GAUDI_NUMBER_OF_RR_REGS 24 +-#define GAUDI_NUMBER_OF_LBW_RANGES 12 ++#define GAUDI_NUMBER_OF_LBW_RR_REGS 28 ++#define GAUDI_NUMBER_OF_HBW_RR_REGS 24 ++#define GAUDI_NUMBER_OF_LBW_RANGES 10 + +-static u64 gaudi_rr_lbw_hit_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_lbw_hit_aw_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { ++ mmDMA_IF_W_S_SOB_HIT_WPROT, + mmDMA_IF_W_S_DMA0_HIT_WPROT, + mmDMA_IF_W_S_DMA1_HIT_WPROT, ++ mmDMA_IF_E_S_SOB_HIT_WPROT, + mmDMA_IF_E_S_DMA0_HIT_WPROT, + mmDMA_IF_E_S_DMA1_HIT_WPROT, ++ mmDMA_IF_W_N_SOB_HIT_WPROT, + mmDMA_IF_W_N_DMA0_HIT_WPROT, + mmDMA_IF_W_N_DMA1_HIT_WPROT, ++ mmDMA_IF_E_N_SOB_HIT_WPROT, + mmDMA_IF_E_N_DMA0_HIT_WPROT, + mmDMA_IF_E_N_DMA1_HIT_WPROT, + mmSIF_RTR_0_LBW_RANGE_PROT_HIT_AW, +@@ -38,13 +43,17 @@ static u64 gaudi_rr_lbw_hit_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_7_LBW_RANGE_PROT_HIT_AW, + }; + +-static u64 gaudi_rr_lbw_hit_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_lbw_hit_ar_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { ++ mmDMA_IF_W_S_SOB_HIT_RPROT, + mmDMA_IF_W_S_DMA0_HIT_RPROT, + mmDMA_IF_W_S_DMA1_HIT_RPROT, ++ mmDMA_IF_E_S_SOB_HIT_RPROT, + mmDMA_IF_E_S_DMA0_HIT_RPROT, + mmDMA_IF_E_S_DMA1_HIT_RPROT, ++ mmDMA_IF_W_N_SOB_HIT_RPROT, + mmDMA_IF_W_N_DMA0_HIT_RPROT, + mmDMA_IF_W_N_DMA1_HIT_RPROT, ++ mmDMA_IF_E_N_SOB_HIT_RPROT, + mmDMA_IF_E_N_DMA0_HIT_RPROT, + mmDMA_IF_E_N_DMA1_HIT_RPROT, + mmSIF_RTR_0_LBW_RANGE_PROT_HIT_AR, +@@ -65,13 +74,17 @@ static u64 gaudi_rr_lbw_hit_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_7_LBW_RANGE_PROT_HIT_AR, + }; + +-static u64 gaudi_rr_lbw_min_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_lbw_min_aw_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { ++ mmDMA_IF_W_S_SOB_MIN_WPROT_0, + mmDMA_IF_W_S_DMA0_MIN_WPROT_0, + mmDMA_IF_W_S_DMA1_MIN_WPROT_0, ++ mmDMA_IF_E_S_SOB_MIN_WPROT_0, + mmDMA_IF_E_S_DMA0_MIN_WPROT_0, + mmDMA_IF_E_S_DMA1_MIN_WPROT_0, ++ mmDMA_IF_W_N_SOB_MIN_WPROT_0, + mmDMA_IF_W_N_DMA0_MIN_WPROT_0, + mmDMA_IF_W_N_DMA1_MIN_WPROT_0, ++ mmDMA_IF_E_N_SOB_MIN_WPROT_0, + mmDMA_IF_E_N_DMA0_MIN_WPROT_0, + mmDMA_IF_E_N_DMA1_MIN_WPROT_0, + mmSIF_RTR_0_LBW_RANGE_PROT_MIN_AW_0, +@@ -92,13 +105,17 @@ static u64 gaudi_rr_lbw_min_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_7_LBW_RANGE_PROT_MIN_AW_0, + }; + +-static u64 gaudi_rr_lbw_max_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_lbw_max_aw_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { ++ mmDMA_IF_W_S_SOB_MAX_WPROT_0, + mmDMA_IF_W_S_DMA0_MAX_WPROT_0, + mmDMA_IF_W_S_DMA1_MAX_WPROT_0, ++ mmDMA_IF_E_S_SOB_MAX_WPROT_0, + mmDMA_IF_E_S_DMA0_MAX_WPROT_0, + mmDMA_IF_E_S_DMA1_MAX_WPROT_0, ++ mmDMA_IF_W_N_SOB_MAX_WPROT_0, + mmDMA_IF_W_N_DMA0_MAX_WPROT_0, + mmDMA_IF_W_N_DMA1_MAX_WPROT_0, ++ mmDMA_IF_E_N_SOB_MAX_WPROT_0, + mmDMA_IF_E_N_DMA0_MAX_WPROT_0, + mmDMA_IF_E_N_DMA1_MAX_WPROT_0, + mmSIF_RTR_0_LBW_RANGE_PROT_MAX_AW_0, +@@ -119,13 +136,17 @@ static u64 gaudi_rr_lbw_max_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_7_LBW_RANGE_PROT_MAX_AW_0, + }; + +-static u64 gaudi_rr_lbw_min_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_lbw_min_ar_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { ++ mmDMA_IF_W_S_SOB_MIN_RPROT_0, + mmDMA_IF_W_S_DMA0_MIN_RPROT_0, + mmDMA_IF_W_S_DMA1_MIN_RPROT_0, ++ mmDMA_IF_E_S_SOB_MIN_RPROT_0, + mmDMA_IF_E_S_DMA0_MIN_RPROT_0, + mmDMA_IF_E_S_DMA1_MIN_RPROT_0, ++ mmDMA_IF_W_N_SOB_MIN_RPROT_0, + mmDMA_IF_W_N_DMA0_MIN_RPROT_0, + mmDMA_IF_W_N_DMA1_MIN_RPROT_0, ++ mmDMA_IF_E_N_SOB_MIN_RPROT_0, + mmDMA_IF_E_N_DMA0_MIN_RPROT_0, + mmDMA_IF_E_N_DMA1_MIN_RPROT_0, + mmSIF_RTR_0_LBW_RANGE_PROT_MIN_AR_0, +@@ -146,13 +167,17 @@ static u64 gaudi_rr_lbw_min_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_7_LBW_RANGE_PROT_MIN_AR_0, + }; + +-static u64 gaudi_rr_lbw_max_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_lbw_max_ar_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { ++ mmDMA_IF_W_S_SOB_MAX_RPROT_0, + mmDMA_IF_W_S_DMA0_MAX_RPROT_0, + mmDMA_IF_W_S_DMA1_MAX_RPROT_0, ++ mmDMA_IF_E_S_SOB_MAX_RPROT_0, + mmDMA_IF_E_S_DMA0_MAX_RPROT_0, + mmDMA_IF_E_S_DMA1_MAX_RPROT_0, ++ mmDMA_IF_W_N_SOB_MAX_RPROT_0, + mmDMA_IF_W_N_DMA0_MAX_RPROT_0, + mmDMA_IF_W_N_DMA1_MAX_RPROT_0, ++ mmDMA_IF_E_N_SOB_MAX_RPROT_0, + mmDMA_IF_E_N_DMA0_MAX_RPROT_0, + mmDMA_IF_E_N_DMA1_MAX_RPROT_0, + mmSIF_RTR_0_LBW_RANGE_PROT_MAX_AR_0, +@@ -173,7 +198,7 @@ static u64 gaudi_rr_lbw_max_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_7_LBW_RANGE_PROT_MAX_AR_0, + }; + +-static u64 gaudi_rr_hbw_hit_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_hbw_hit_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { + mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_HIT_AW, + mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_HIT_AW, + mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_HIT_AW, +@@ -200,7 +225,7 @@ static u64 gaudi_rr_hbw_hit_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_CTRL_7_RANGE_SEC_HIT_AW + }; + +-static u64 gaudi_rr_hbw_hit_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_hbw_hit_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { + mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_HIT_AR, + mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_HIT_AR, + mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_HIT_AR, +@@ -227,7 +252,7 @@ static u64 gaudi_rr_hbw_hit_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_CTRL_7_RANGE_SEC_HIT_AR + }; + +-static u64 gaudi_rr_hbw_base_low_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_hbw_base_low_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { + mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_BASE_LOW_AW_0, + mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_BASE_LOW_AW_0, + mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_BASE_LOW_AW_0, +@@ -254,7 +279,7 @@ static u64 gaudi_rr_hbw_base_low_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_CTRL_7_RANGE_SEC_BASE_LOW_AW_0 + }; + +-static u64 gaudi_rr_hbw_base_high_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_hbw_base_high_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { + mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_BASE_HIGH_AW_0, + mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_BASE_HIGH_AW_0, + mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_BASE_HIGH_AW_0, +@@ -281,7 +306,7 @@ static u64 gaudi_rr_hbw_base_high_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_CTRL_7_RANGE_SEC_BASE_HIGH_AW_0 + }; + +-static u64 gaudi_rr_hbw_mask_low_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_hbw_mask_low_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { + mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_MASK_LOW_AW_0, + mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_MASK_LOW_AW_0, + mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_MASK_LOW_AW_0, +@@ -308,7 +333,7 @@ static u64 gaudi_rr_hbw_mask_low_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_CTRL_7_RANGE_SEC_MASK_LOW_AW_0 + }; + +-static u64 gaudi_rr_hbw_mask_high_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_hbw_mask_high_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { + mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_MASK_HIGH_AW_0, + mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_MASK_HIGH_AW_0, + mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_MASK_HIGH_AW_0, +@@ -335,7 +360,7 @@ static u64 gaudi_rr_hbw_mask_high_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_CTRL_7_RANGE_SEC_MASK_HIGH_AW_0 + }; + +-static u64 gaudi_rr_hbw_base_low_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_hbw_base_low_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { + mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_BASE_LOW_AR_0, + mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_BASE_LOW_AR_0, + mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_BASE_LOW_AR_0, +@@ -362,7 +387,7 @@ static u64 gaudi_rr_hbw_base_low_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_CTRL_7_RANGE_SEC_BASE_LOW_AR_0 + }; + +-static u64 gaudi_rr_hbw_base_high_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_hbw_base_high_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { + mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_BASE_HIGH_AR_0, + mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_BASE_HIGH_AR_0, + mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_BASE_HIGH_AR_0, +@@ -389,7 +414,7 @@ static u64 gaudi_rr_hbw_base_high_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_CTRL_7_RANGE_SEC_BASE_HIGH_AR_0 + }; + +-static u64 gaudi_rr_hbw_mask_low_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_hbw_mask_low_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { + mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_MASK_LOW_AR_0, + mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_MASK_LOW_AR_0, + mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_MASK_LOW_AR_0, +@@ -416,7 +441,7 @@ static u64 gaudi_rr_hbw_mask_low_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { + mmNIF_RTR_CTRL_7_RANGE_SEC_MASK_LOW_AR_0 + }; + +-static u64 gaudi_rr_hbw_mask_high_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { ++static u64 gaudi_rr_hbw_mask_high_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { + mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_MASK_HIGH_AR_0, + mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_MASK_HIGH_AR_0, + mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_MASK_HIGH_AR_0, +@@ -8870,50 +8895,44 @@ static void gaudi_init_range_registers_lbw(struct hl_device *hdev) + u32 lbw_rng_end[GAUDI_NUMBER_OF_LBW_RANGES]; + int i, j; + +- lbw_rng_start[0] = (0xFBFE0000 & 0x3FFFFFF) - 1; +- lbw_rng_end[0] = (0xFBFFF000 & 0x3FFFFFF) + 1; ++ lbw_rng_start[0] = (0xFC0E8000 & 0x3FFFFFF) - 1; /* 0x000E7FFF */ ++ lbw_rng_end[0] = (0xFC11FFFF & 0x3FFFFFF) + 1; /* 0x00120000 */ + +- lbw_rng_start[1] = (0xFC0E8000 & 0x3FFFFFF) - 1; +- lbw_rng_end[1] = (0xFC120000 & 0x3FFFFFF) + 1; ++ lbw_rng_start[1] = (0xFC1E8000 & 0x3FFFFFF) - 1; /* 0x001E7FFF */ ++ lbw_rng_end[1] = (0xFC48FFFF & 0x3FFFFFF) + 1; /* 0x00490000 */ + +- lbw_rng_start[2] = (0xFC1E8000 & 0x3FFFFFF) - 1; +- lbw_rng_end[2] = (0xFC48FFFF & 0x3FFFFFF) + 1; ++ lbw_rng_start[2] = (0xFC600000 & 0x3FFFFFF) - 1; /* 0x005FFFFF */ ++ lbw_rng_end[2] = (0xFCC48FFF & 0x3FFFFFF) + 1; /* 0x00C49000 */ + +- lbw_rng_start[3] = (0xFC600000 & 0x3FFFFFF) - 1; +- lbw_rng_end[3] = (0xFCC48FFF & 0x3FFFFFF) + 1; ++ lbw_rng_start[3] = (0xFCC4A000 & 0x3FFFFFF) - 1; /* 0x00C49FFF */ ++ lbw_rng_end[3] = (0xFCCDFFFF & 0x3FFFFFF) + 1; /* 0x00CE0000 */ + +- lbw_rng_start[4] = (0xFCC4A000 & 0x3FFFFFF) - 1; +- lbw_rng_end[4] = (0xFCCDFFFF & 0x3FFFFFF) + 1; ++ lbw_rng_start[4] = (0xFCCE4000 & 0x3FFFFFF) - 1; /* 0x00CE3FFF */ ++ lbw_rng_end[4] = (0xFCD1FFFF & 0x3FFFFFF) + 1; /* 0x00D20000 */ + +- lbw_rng_start[5] = (0xFCCE4000 & 0x3FFFFFF) - 1; +- lbw_rng_end[5] = (0xFCD1FFFF & 0x3FFFFFF) + 1; ++ lbw_rng_start[5] = (0xFCD24000 & 0x3FFFFFF) - 1; /* 0x00D23FFF */ ++ lbw_rng_end[5] = (0xFCD5FFFF & 0x3FFFFFF) + 1; /* 0x00D60000 */ + +- lbw_rng_start[6] = (0xFCD24000 & 0x3FFFFFF) - 1; +- lbw_rng_end[6] = (0xFCD5FFFF & 0x3FFFFFF) + 1; ++ lbw_rng_start[6] = (0xFCD64000 & 0x3FFFFFF) - 1; /* 0x00D63FFF */ ++ lbw_rng_end[6] = (0xFCD9FFFF & 0x3FFFFFF) + 1; /* 0x00DA0000 */ + +- lbw_rng_start[7] = (0xFCD64000 & 0x3FFFFFF) - 1; +- lbw_rng_end[7] = (0xFCD9FFFF & 0x3FFFFFF) + 1; ++ lbw_rng_start[7] = (0xFCDA4000 & 0x3FFFFFF) - 1; /* 0x00DA3FFF */ ++ lbw_rng_end[7] = (0xFCDDFFFF & 0x3FFFFFF) + 1; /* 0x00DE0000 */ + +- lbw_rng_start[8] = (0xFCDA4000 & 0x3FFFFFF) - 1; +- lbw_rng_end[8] = (0xFCDDFFFF & 0x3FFFFFF) + 1; ++ lbw_rng_start[8] = (0xFCDE4000 & 0x3FFFFFF) - 1; /* 0x00DE3FFF */ ++ lbw_rng_end[8] = (0xFCE05FFF & 0x3FFFFFF) + 1; /* 0x00E06000 */ + +- lbw_rng_start[9] = (0xFCDE4000 & 0x3FFFFFF) - 1; +- lbw_rng_end[9] = (0xFCE05FFF & 0x3FFFFFF) + 1; ++ lbw_rng_start[9] = (0xFCFC9000 & 0x3FFFFFF) - 1; /* 0x00FC8FFF */ ++ lbw_rng_end[9] = (0xFFFFFFFE & 0x3FFFFFF) + 1; /* 0x03FFFFFF */ + +- lbw_rng_start[10] = (0xFEC43000 & 0x3FFFFFF) - 1; +- lbw_rng_end[10] = (0xFEC43FFF & 0x3FFFFFF) + 1; +- +- lbw_rng_start[11] = (0xFE484000 & 0x3FFFFFF) - 1; +- lbw_rng_end[11] = (0xFE484FFF & 0x3FFFFFF) + 1; +- +- for (i = 0 ; i < GAUDI_NUMBER_OF_RR_REGS ; i++) { ++ for (i = 0 ; i < GAUDI_NUMBER_OF_LBW_RR_REGS ; i++) { + WREG32(gaudi_rr_lbw_hit_aw_regs[i], + (1 << GAUDI_NUMBER_OF_LBW_RANGES) - 1); + WREG32(gaudi_rr_lbw_hit_ar_regs[i], + (1 << GAUDI_NUMBER_OF_LBW_RANGES) - 1); + } + +- for (i = 0 ; i < GAUDI_NUMBER_OF_RR_REGS ; i++) ++ for (i = 0 ; i < GAUDI_NUMBER_OF_LBW_RR_REGS ; i++) + for (j = 0 ; j < GAUDI_NUMBER_OF_LBW_RANGES ; j++) { + WREG32(gaudi_rr_lbw_min_aw_regs[i] + (j << 2), + lbw_rng_start[j]); +@@ -8960,12 +8979,12 @@ static void gaudi_init_range_registers_hbw(struct hl_device *hdev) + * 6th range is the host + */ + +- for (i = 0 ; i < GAUDI_NUMBER_OF_RR_REGS ; i++) { ++ for (i = 0 ; i < GAUDI_NUMBER_OF_HBW_RR_REGS ; i++) { + WREG32(gaudi_rr_hbw_hit_aw_regs[i], 0x1F); + WREG32(gaudi_rr_hbw_hit_ar_regs[i], 0x1D); + } + +- for (i = 0 ; i < GAUDI_NUMBER_OF_RR_REGS ; i++) { ++ for (i = 0 ; i < GAUDI_NUMBER_OF_HBW_RR_REGS ; i++) { + WREG32(gaudi_rr_hbw_base_low_aw_regs[i], dram_addr_lo); + WREG32(gaudi_rr_hbw_base_low_ar_regs[i], dram_addr_lo); + +diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c +index 0837319a5..797c41f55 100644 +--- a/drivers/net/phy/mdio_device.c ++++ b/drivers/net/phy/mdio_device.c +@@ -179,6 +179,16 @@ static int mdio_remove(struct device *dev) + return 0; + } + ++static void mdio_shutdown(struct device *dev) ++{ ++ struct mdio_device *mdiodev = to_mdio_device(dev); ++ struct device_driver *drv = mdiodev->dev.driver; ++ struct mdio_driver *mdiodrv = to_mdio_driver(drv); ++ ++ if (mdiodrv->shutdown) ++ mdiodrv->shutdown(mdiodev); ++} ++ + /** + * mdio_driver_register - register an mdio_driver with the MDIO layer + * @drv: new mdio_driver to register +@@ -193,6 +203,7 @@ int mdio_driver_register(struct mdio_driver *drv) + mdiodrv->driver.bus = &mdio_bus_type; + mdiodrv->driver.probe = mdio_probe; + mdiodrv->driver.remove = mdio_remove; ++ mdiodrv->driver.shutdown = mdio_shutdown; + + retval = driver_register(&mdiodrv->driver); + if (retval) { +diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c +index 986b56970..b0cbc7fea 100644 +--- a/drivers/net/xen-netback/netback.c ++++ b/drivers/net/xen-netback/netback.c +@@ -499,7 +499,7 @@ static int xenvif_tx_check_gop(struct xenvif_queue *queue, + * the header's copy failed, and they are + * sharing a slot, send an error + */ +- if (i == 0 && sharedslot) ++ if (i == 0 && !first_shinfo && sharedslot) + xenvif_idx_release(queue, pending_idx, + XEN_NETIF_RSP_ERROR); + else +diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c +index a0bcec33b..906cab35a 100644 +--- a/drivers/nvme/host/fc.c ++++ b/drivers/nvme/host/fc.c +@@ -2486,6 +2486,7 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) + */ + if (ctrl->ctrl.queue_count > 1) { + nvme_stop_queues(&ctrl->ctrl); ++ nvme_sync_io_queues(&ctrl->ctrl); + blk_mq_tagset_busy_iter(&ctrl->tag_set, + nvme_fc_terminate_exchange, &ctrl->ctrl); + blk_mq_tagset_wait_completed_request(&ctrl->tag_set); +@@ -2509,6 +2510,7 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) + * clean up the admin queue. Same thing as above. + */ + blk_mq_quiesce_queue(ctrl->ctrl.admin_q); ++ blk_sync_queue(ctrl->ctrl.admin_q); + blk_mq_tagset_busy_iter(&ctrl->admin_tag_set, + nvme_fc_terminate_exchange, &ctrl->ctrl); + blk_mq_tagset_wait_completed_request(&ctrl->admin_tag_set); +@@ -2952,14 +2954,6 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl) + if (ctrl->ctrl.queue_count == 1) + return 0; + +- ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); +- if (ret) +- goto out_free_io_queues; +- +- ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); +- if (ret) +- goto out_delete_hw_queues; +- + if (prior_ioq_cnt != nr_io_queues) { + dev_info(ctrl->ctrl.device, + "reconnect: revising io queue count from %d to %d\n", +@@ -2969,6 +2963,14 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl) + nvme_unfreeze(&ctrl->ctrl); + } + ++ ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); ++ if (ret) ++ goto out_free_io_queues; ++ ++ ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); ++ if (ret) ++ goto out_delete_hw_queues; ++ + return 0; + + out_delete_hw_queues: +diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c +index 992609151..59b7e90cd 100644 +--- a/drivers/platform/x86/touchscreen_dmi.c ++++ b/drivers/platform/x86/touchscreen_dmi.c +@@ -100,10 +100,10 @@ static const struct ts_dmi_data chuwi_hi10_air_data = { + }; + + static const struct property_entry chuwi_hi10_plus_props[] = { +- PROPERTY_ENTRY_U32("touchscreen-min-x", 0), +- PROPERTY_ENTRY_U32("touchscreen-min-y", 5), +- PROPERTY_ENTRY_U32("touchscreen-size-x", 1914), +- PROPERTY_ENTRY_U32("touchscreen-size-y", 1283), ++ PROPERTY_ENTRY_U32("touchscreen-min-x", 12), ++ PROPERTY_ENTRY_U32("touchscreen-min-y", 10), ++ PROPERTY_ENTRY_U32("touchscreen-size-x", 1908), ++ PROPERTY_ENTRY_U32("touchscreen-size-y", 1270), + PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-chuwi-hi10plus.fw"), + PROPERTY_ENTRY_U32("silead,max-fingers", 10), + PROPERTY_ENTRY_BOOL("silead,home-button"), +@@ -111,6 +111,15 @@ static const struct property_entry chuwi_hi10_plus_props[] = { + }; + + static const struct ts_dmi_data chuwi_hi10_plus_data = { ++ .embedded_fw = { ++ .name = "silead/gsl1680-chuwi-hi10plus.fw", ++ .prefix = { 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 }, ++ .length = 34056, ++ .sha256 = { 0xfd, 0x0a, 0x08, 0x08, 0x3c, 0xa6, 0x34, 0x4e, ++ 0x2c, 0x49, 0x9c, 0xcd, 0x7d, 0x44, 0x9d, 0x38, ++ 0x10, 0x68, 0xb5, 0xbd, 0xb7, 0x2a, 0x63, 0xb5, ++ 0x67, 0x0b, 0x96, 0xbd, 0x89, 0x67, 0x85, 0x09 }, ++ }, + .acpi_name = "MSSL0017:00", + .properties = chuwi_hi10_plus_props, + }; +@@ -141,6 +150,33 @@ static const struct ts_dmi_data chuwi_hi10_pro_data = { + .properties = chuwi_hi10_pro_props, + }; + ++static const struct property_entry chuwi_hibook_props[] = { ++ PROPERTY_ENTRY_U32("touchscreen-min-x", 30), ++ PROPERTY_ENTRY_U32("touchscreen-min-y", 4), ++ PROPERTY_ENTRY_U32("touchscreen-size-x", 1892), ++ PROPERTY_ENTRY_U32("touchscreen-size-y", 1276), ++ PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"), ++ PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), ++ PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-chuwi-hibook.fw"), ++ PROPERTY_ENTRY_U32("silead,max-fingers", 10), ++ PROPERTY_ENTRY_BOOL("silead,home-button"), ++ { } ++}; ++ ++static const struct ts_dmi_data chuwi_hibook_data = { ++ .embedded_fw = { ++ .name = "silead/gsl1680-chuwi-hibook.fw", ++ .prefix = { 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 }, ++ .length = 40392, ++ .sha256 = { 0xf7, 0xc0, 0xe8, 0x5a, 0x6c, 0xf2, 0xeb, 0x8d, ++ 0x12, 0xc4, 0x45, 0xbf, 0x55, 0x13, 0x4c, 0x1a, ++ 0x13, 0x04, 0x31, 0x08, 0x65, 0x73, 0xf7, 0xa8, ++ 0x1b, 0x7d, 0x59, 0xc9, 0xe6, 0x97, 0xf7, 0x38 }, ++ }, ++ .acpi_name = "MSSL0017:00", ++ .properties = chuwi_hibook_props, ++}; ++ + static const struct property_entry chuwi_vi8_props[] = { + PROPERTY_ENTRY_U32("touchscreen-min-x", 4), + PROPERTY_ENTRY_U32("touchscreen-min-y", 6), +@@ -936,6 +972,16 @@ const struct dmi_system_id touchscreen_dmi_table[] = { + DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), + }, + }, ++ { ++ /* Chuwi HiBook (CWI514) */ ++ .driver_data = (void *)&chuwi_hibook_data, ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"), ++ DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), ++ /* Above matches are too generic, add bios-date match */ ++ DMI_MATCH(DMI_BIOS_DATE, "05/07/2016"), ++ }, ++ }, + { + /* Chuwi Vi8 (CWI506) */ + .driver_data = (void *)&chuwi_vi8_data, +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c +index ade8a6c79..00a355f56 100644 +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -3443,15 +3443,16 @@ static int sd_probe(struct device *dev) + } + + device_initialize(&sdkp->dev); +- sdkp->dev.parent = dev; ++ sdkp->dev.parent = get_device(dev); + sdkp->dev.class = &sd_disk_class; + dev_set_name(&sdkp->dev, "%s", dev_name(dev)); + + error = device_add(&sdkp->dev); +- if (error) +- goto out_free_index; ++ if (error) { ++ put_device(&sdkp->dev); ++ goto out; ++ } + +- get_device(dev); + dev_set_drvdata(dev, sdkp); + device_init_wakeup(dev, true); + +diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c +index c2afba2a5..43e682297 100644 +--- a/drivers/scsi/ses.c ++++ b/drivers/scsi/ses.c +@@ -87,9 +87,16 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, + 0 + }; + unsigned char recv_page_code; ++ unsigned int retries = SES_RETRIES; ++ struct scsi_sense_hdr sshdr; ++ ++ do { ++ ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, ++ &sshdr, SES_TIMEOUT, 1, NULL); ++ } while (ret > 0 && --retries && scsi_sense_valid(&sshdr) && ++ (sshdr.sense_key == NOT_READY || ++ (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); + +- ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, +- NULL, SES_TIMEOUT, SES_RETRIES, NULL); + if (unlikely(ret)) + return ret; + +@@ -121,9 +128,16 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, + bufflen & 0xff, + 0 + }; ++ struct scsi_sense_hdr sshdr; ++ unsigned int retries = SES_RETRIES; ++ ++ do { ++ result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen, ++ &sshdr, SES_TIMEOUT, 1, NULL); ++ } while (result > 0 && --retries && scsi_sense_valid(&sshdr) && ++ (sshdr.sense_key == NOT_READY || ++ (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); + +- result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen, +- NULL, SES_TIMEOUT, SES_RETRIES, NULL); + if (result) + sdev_printk(KERN_ERR, sdev, "SEND DIAGNOSTIC result: %8x\n", + result); +diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c +index 3c4c0516e..cb4f4b522 100644 +--- a/drivers/thermal/qcom/tsens.c ++++ b/drivers/thermal/qcom/tsens.c +@@ -415,7 +415,7 @@ static irqreturn_t tsens_critical_irq_thread(int irq, void *data) + const struct tsens_sensor *s = &priv->sensor[i]; + u32 hw_id = s->hw_id; + +- if (IS_ERR(s->tzd)) ++ if (!s->tzd) + continue; + if (!tsens_threshold_violated(priv, hw_id, &d)) + continue; +@@ -465,7 +465,7 @@ static irqreturn_t tsens_irq_thread(int irq, void *data) + const struct tsens_sensor *s = &priv->sensor[i]; + u32 hw_id = s->hw_id; + +- if (IS_ERR(s->tzd)) ++ if (!s->tzd) + continue; + if (!tsens_threshold_violated(priv, hw_id, &d)) + continue; +diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c +index 4a40ad45a..893344274 100644 +--- a/drivers/usb/dwc2/hcd.c ++++ b/drivers/usb/dwc2/hcd.c +@@ -5096,6 +5096,10 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg) + hcd->has_tt = 1; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) { ++ retval = -EINVAL; ++ goto error1; ++ } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); + +diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c +index 48a2ea6d7..2de1d8247 100644 +--- a/fs/btrfs/file-item.c ++++ b/fs/btrfs/file-item.c +@@ -568,7 +568,18 @@ blk_status_t btrfs_csum_one_bio(struct btrfs_inode *inode, struct bio *bio, + + if (!ordered) { + ordered = btrfs_lookup_ordered_extent(inode, offset); +- BUG_ON(!ordered); /* Logic error */ ++ /* ++ * The bio range is not covered by any ordered extent, ++ * must be a code logic error. ++ */ ++ if (unlikely(!ordered)) { ++ WARN(1, KERN_WARNING ++ "no ordered extent for root %llu ino %llu offset %llu\n", ++ inode->root->root_key.objectid, ++ btrfs_ino(inode), offset); ++ kvfree(sums); ++ return BLK_STS_IOERR; ++ } + } + + nr_sectors = BTRFS_BYTES_TO_BLKS(fs_info, +diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c +index d8b8764f5..593e0c6d6 100644 +--- a/fs/btrfs/volumes.c ++++ b/fs/btrfs/volumes.c +@@ -1147,6 +1147,19 @@ static void btrfs_close_one_device(struct btrfs_device *device) + atomic_set(&device->dev_stats_ccnt, 0); + extent_io_tree_release(&device->alloc_state); + ++ /* ++ * Reset the flush error record. We might have a transient flush error ++ * in this mount, and if so we aborted the current transaction and set ++ * the fs to an error state, guaranteeing no super blocks can be further ++ * committed. However that error might be transient and if we unmount the ++ * filesystem and mount it again, we should allow the mount to succeed ++ * (btrfs_check_rw_degradable() should not fail) - if after mounting the ++ * filesystem again we still get flush errors, then we will again abort ++ * any transaction and set the error state, guaranteeing no commits of ++ * unsafe super blocks. ++ */ ++ device->last_flush_error = 0; ++ + /* Verify the device is back in a pristine state */ + ASSERT(!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state)); + ASSERT(!test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state)); +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c +index ca5102773..88554b640 100644 +--- a/fs/cifs/smb2pdu.c ++++ b/fs/cifs/smb2pdu.c +@@ -2339,7 +2339,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len) + buf->sd.OffsetDacl = cpu_to_le32(ptr - (__u8 *)&buf->sd); + /* Ship the ACL for now. we will copy it into buf later. */ + aclptr = ptr; +- ptr += sizeof(struct cifs_acl); ++ ptr += sizeof(struct smb3_acl); + + /* create one ACE to hold the mode embedded in reserved special SID */ + acelen = setup_special_mode_ACE((struct cifs_ace *)ptr, (__u64)mode); +@@ -2364,7 +2364,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len) + acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */ + acl.AclSize = cpu_to_le16(acl_size); + acl.AceCount = cpu_to_le16(ace_count); +- memcpy(aclptr, &acl, sizeof(struct cifs_acl)); ++ memcpy(aclptr, &acl, sizeof(struct smb3_acl)); + + buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd); + *len = roundup(ptr - (__u8 *)buf, 8); +diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c +index 1f3f4326b..c17ccc19b 100644 +--- a/fs/ext2/balloc.c ++++ b/fs/ext2/balloc.c +@@ -48,10 +48,9 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb, + struct ext2_sb_info *sbi = EXT2_SB(sb); + + if (block_group >= sbi->s_groups_count) { +- ext2_error (sb, "ext2_get_group_desc", +- "block_group >= groups_count - " +- "block_group = %d, groups_count = %lu", +- block_group, sbi->s_groups_count); ++ WARN(1, "block_group >= groups_count - " ++ "block_group = %d, groups_count = %lu", ++ block_group, sbi->s_groups_count); + + return NULL; + } +@@ -59,10 +58,9 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb, + group_desc = block_group >> EXT2_DESC_PER_BLOCK_BITS(sb); + offset = block_group & (EXT2_DESC_PER_BLOCK(sb) - 1); + if (!sbi->s_group_desc[group_desc]) { +- ext2_error (sb, "ext2_get_group_desc", +- "Group descriptor not loaded - " +- "block_group = %d, group_desc = %lu, desc = %lu", +- block_group, group_desc, offset); ++ WARN(1, "Group descriptor not loaded - " ++ "block_group = %d, group_desc = %lu, desc = %lu", ++ block_group, group_desc, offset); + return NULL; + } + +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c +index 0313390fa..1cdf7e0a5 100644 +--- a/fs/nfsd/nfs4state.c ++++ b/fs/nfsd/nfs4state.c +@@ -3512,7 +3512,7 @@ static struct nfsd4_conn *__nfsd4_find_conn(struct svc_xprt *xpt, struct nfsd4_s + } + + static __be32 nfsd4_match_existing_connection(struct svc_rqst *rqst, +- struct nfsd4_session *session, u32 req) ++ struct nfsd4_session *session, u32 req, struct nfsd4_conn **conn) + { + struct nfs4_client *clp = session->se_client; + struct svc_xprt *xpt = rqst->rq_xprt; +@@ -3535,6 +3535,8 @@ static __be32 nfsd4_match_existing_connection(struct svc_rqst *rqst, + else + status = nfserr_inval; + spin_unlock(&clp->cl_lock); ++ if (status == nfs_ok && conn) ++ *conn = c; + return status; + } + +@@ -3559,8 +3561,16 @@ __be32 nfsd4_bind_conn_to_session(struct svc_rqst *rqstp, + status = nfserr_wrong_cred; + if (!nfsd4_mach_creds_match(session->se_client, rqstp)) + goto out; +- status = nfsd4_match_existing_connection(rqstp, session, bcts->dir); +- if (status == nfs_ok || status == nfserr_inval) ++ status = nfsd4_match_existing_connection(rqstp, session, ++ bcts->dir, &conn); ++ if (status == nfs_ok) { ++ if (bcts->dir == NFS4_CDFC4_FORE_OR_BOTH || ++ bcts->dir == NFS4_CDFC4_BACK) ++ conn->cn_flags |= NFS4_CDFC4_BACK; ++ nfsd4_probe_callback(session->se_client); ++ goto out; ++ } ++ if (status == nfserr_inval) + goto out; + status = nfsd4_map_bcts_dir(&bcts->dir); + if (status) +diff --git a/include/linux/libata.h b/include/linux/libata.h +index 5f550eb27..57dffa0d5 100644 +--- a/include/linux/libata.h ++++ b/include/linux/libata.h +@@ -422,6 +422,7 @@ enum { + ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ + ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 */ + ATA_HORKAGE_MAX_TRIM_128M = (1 << 26), /* Limit max trim size to 128M */ ++ ATA_HORKAGE_NO_NCQ_ON_ATI = (1 << 27), /* Disable NCQ on ATI chipset */ + + /* DMA mask for user DMA control: User visible values; DO NOT + renumber */ +diff --git a/include/linux/mdio.h b/include/linux/mdio.h +index dbd69b3d1..de5fb4b33 100644 +--- a/include/linux/mdio.h ++++ b/include/linux/mdio.h +@@ -72,6 +72,9 @@ struct mdio_driver { + + /* Clears up any memory if needed */ + void (*remove)(struct mdio_device *mdiodev); ++ ++ /* Quiesces the device on system shutdown, turns off interrupts etc */ ++ void (*shutdown)(struct mdio_device *mdiodev); + }; + #define to_mdio_driver(d) \ + container_of(to_mdio_common_driver(d), struct mdio_driver, mdiodrv) +diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c +index fcc840088..7daedee3e 100644 +--- a/tools/testing/selftests/kvm/steal_time.c ++++ b/tools/testing/selftests/kvm/steal_time.c +@@ -120,12 +120,12 @@ struct st_time { + uint64_t st_time; + }; + +-static int64_t smccc(uint32_t func, uint32_t arg) ++static int64_t smccc(uint32_t func, uint64_t arg) + { + unsigned long ret; + + asm volatile( +- "mov x0, %1\n" ++ "mov w0, %w1\n" + "mov x1, %2\n" + "hvc #0\n" + "mov %0, x0\n" +diff --git a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c +index e6480fd5c..8039e1eff 100644 +--- a/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c ++++ b/tools/testing/selftests/kvm/x86_64/mmio_warning_test.c +@@ -82,7 +82,8 @@ int get_warnings_count(void) + FILE *f; + + f = popen("dmesg | grep \"WARNING:\" | wc -l", "r"); +- fscanf(f, "%d", &warnings); ++ if (fscanf(f, "%d", &warnings) < 1) ++ warnings = 0; + fclose(f); + + return warnings; +diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk +index 0af84ad48..b7217b525 100644 +--- a/tools/testing/selftests/lib.mk ++++ b/tools/testing/selftests/lib.mk +@@ -48,6 +48,7 @@ ARCH ?= $(SUBARCH) + # When local build is done, headers are installed in the default + # INSTALL_HDR_PATH usr/include. + .PHONY: khdr ++.NOTPARALLEL: + khdr: + ifndef KSFT_KHDR_INSTALL_DONE + ifeq (1,$(DEFAULT_INSTALL_HDR_PATH)) +diff --git a/tools/usb/testusb.c b/tools/usb/testusb.c +index ee8208b2f..69c3ead25 100644 +--- a/tools/usb/testusb.c ++++ b/tools/usb/testusb.c +@@ -265,12 +265,6 @@ static int find_testdev(const char *name, const struct stat *sb, int flag) + } + + entry->ifnum = ifnum; +- +- /* FIXME update USBDEVFS_CONNECTINFO so it tells about high speed etc */ +- +- fprintf(stderr, "%s speed\t%s\t%u\n", +- speed(entry->speed), entry->name, entry->ifnum); +- + entry->next = testdevs; + testdevs = entry; + return 0; +@@ -299,6 +293,14 @@ static void *handle_testdev (void *arg) + return 0; + } + ++ status = ioctl(fd, USBDEVFS_GET_SPEED, NULL); ++ if (status < 0) ++ fprintf(stderr, "USBDEVFS_GET_SPEED failed %d\n", status); ++ else ++ dev->speed = status; ++ fprintf(stderr, "%s speed\t%s\t%u\n", ++ speed(dev->speed), dev->name, dev->ifnum); ++ + restart: + for (i = 0; i < TEST_CASES; i++) { + if (dev->test != -1 && dev->test != i) +diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c +index 0517c744b..f62f10c98 100644 +--- a/tools/vm/page-types.c ++++ b/tools/vm/page-types.c +@@ -1331,7 +1331,7 @@ int main(int argc, char *argv[]) + if (opt_list && opt_list_mapcnt) + kpagecount_fd = checked_open(PROC_KPAGECOUNT, O_RDONLY); + +- if (opt_mark_idle && opt_file) ++ if (opt_mark_idle) + page_idle_fd = checked_open(SYS_KERNEL_MM_PAGE_IDLE, O_RDWR); + + if (opt_list && opt_pid) +diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c +index 0e4310c41..57c0c3b18 100644 +--- a/virt/kvm/kvm_main.c ++++ b/virt/kvm/kvm_main.c +@@ -2756,15 +2756,19 @@ static void grow_halt_poll_ns(struct kvm_vcpu *vcpu) + + static void shrink_halt_poll_ns(struct kvm_vcpu *vcpu) + { +- unsigned int old, val, shrink; ++ unsigned int old, val, shrink, grow_start; + + old = val = vcpu->halt_poll_ns; + shrink = READ_ONCE(halt_poll_ns_shrink); ++ grow_start = READ_ONCE(halt_poll_ns_grow_start); + if (shrink == 0) + val = 0; + else + val /= shrink; + ++ if (val < grow_start) ++ val = 0; ++ + vcpu->halt_poll_ns = val; + trace_kvm_halt_poll_ns_shrink(vcpu->vcpu_id, val, old); + }