diff options
Diffstat (limited to 'target/linux/generic/hack-5.4')
35 files changed, 345 insertions, 669 deletions
diff --git a/target/linux/generic/hack-5.4/204-module_strip.patch b/target/linux/generic/hack-5.4/204-module_strip.patch index 41bb021e71..d37dfd4f98 100644 --- a/target/linux/generic/hack-5.4/204-module_strip.patch +++ b/target/linux/generic/hack-5.4/204-module_strip.patch @@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/include/linux/module.h +++ b/include/linux/module.h -@@ -160,6 +160,7 @@ extern void cleanup_module(void); +@@ -157,6 +157,7 @@ extern void cleanup_module(void); /* Generic info of form tag = "info" */ #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) @@ -22,7 +22,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /* For userspace: you can also call me... */ #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) -@@ -203,12 +204,12 @@ extern void cleanup_module(void); +@@ -216,12 +217,12 @@ extern void cleanup_module(void); * Author(s), use "Name <email>" or just "Name", for multiple * authors use multiple MODULE_AUTHOR() statements/lines. */ @@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /* Creates an alias so file2alias.c can find device table. */ #define MODULE_DEVICE_TABLE(type, name) \ extern typeof(name) __mod_##type##__##name##_device_table \ -@@ -235,7 +236,9 @@ extern typeof(name) __mod_##type##__##na +@@ -248,7 +249,9 @@ extern typeof(name) __mod_##type##__##na */ #if defined(MODULE) || !defined(CONFIG_SYSFS) @@ -48,19 +48,19 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> +#define MODULE_VERSION(_version) __MODULE_INFO_DISABLED(version) #else #define MODULE_VERSION(_version) \ - static struct module_version_attribute ___modver_attr = { \ -@@ -257,7 +260,7 @@ extern typeof(name) __mod_##type##__##na + MODULE_INFO(version, _version); \ +@@ -271,7 +274,7 @@ extern typeof(name) __mod_##type##__##na /* Optional firmware file (or files) needed by the module * format is simply firmware file name. Multiple firmware * files require multiple MODULE_FIRMWARE() specifiers */ -#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware) +#define MODULE_FIRMWARE(_firmware) MODULE_INFO_STRIP(firmware, _firmware) - struct notifier_block; + #define MODULE_IMPORT_NS(ns) MODULE_INFO(import_ns, #ns) --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h -@@ -17,6 +17,16 @@ +@@ -20,10 +20,24 @@ /* Chosen so that structs with an unsigned long line up. */ #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) @@ -74,20 +74,18 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> +#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO(tag, name, info) +#endif + - #ifdef MODULE ++#ifdef MODULE #define __MODULE_INFO(tag, name, info) \ static const char __UNIQUE_ID(name)[] \ -@@ -24,8 +34,7 @@ static const char __UNIQUE_ID(name)[] - = __stringify(tag) "=" info - #else /* !MODULE */ - /* This struct is here for syntactic coherency, it is not used */ --#define __MODULE_INFO(tag, name, info) \ -- struct __UNIQUE_ID(name) {} + __used __attribute__((section(".modinfo"), unused, aligned(1))) \ + = __MODULE_INFO_PREFIX __stringify(tag) "=" info ++#else +#define __MODULE_INFO(tag, name, info) __MODULE_INFO_DISABLED(name) - #endif ++#endif + #define __MODULE_PARM_TYPE(name, _type) \ __MODULE_INFO(parmtype, name##type, #name ":" _type) -@@ -33,7 +42,7 @@ static const char __UNIQUE_ID(name)[] +@@ -31,7 +45,7 @@ static const char __UNIQUE_ID(name)[] /* One for each parameter, describing how to use it. Some files do multiple of these per line, so can't just use MODULE_INFO. */ #define MODULE_PARM_DESC(_parm, desc) \ @@ -98,7 +96,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/init/Kconfig +++ b/init/Kconfig -@@ -1997,6 +1997,13 @@ config TRIM_UNUSED_KSYMS +@@ -2233,6 +2233,13 @@ config TRIM_UNUSED_KSYMS If unsure, or if you need to build out-of-tree modules, say N. @@ -114,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> config MODULES_TREE_LOOKUP --- a/kernel/module.c +++ b/kernel/module.c -@@ -3029,9 +3029,11 @@ static int setup_load_info(struct load_i +@@ -3107,9 +3107,11 @@ static int setup_load_info(struct load_i static int check_modinfo(struct module *mod, struct load_info *info, int flags) { @@ -127,7 +125,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> if (flags & MODULE_INIT_IGNORE_VERMAGIC) modmagic = NULL; -@@ -3052,6 +3054,7 @@ static int check_modinfo(struct module * +@@ -3130,6 +3132,7 @@ static int check_modinfo(struct module * mod->name); add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK); } @@ -137,7 +135,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c -@@ -1983,7 +1983,9 @@ static void read_symbols(const char *mod +@@ -2051,7 +2051,9 @@ static void read_symbols(const char *mod symname = remove_dot(info.strtab + sym->st_name); handle_modversions(mod, &info, sym, symname); @@ -145,9 +143,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> handle_moddevtable(mod, &info, sym, symname); +#endif } - if (!is_vmlinux(modname) || vmlinux_section_warnings) - check_sec_ref(mod, modname, &info); -@@ -2146,8 +2148,10 @@ static void add_header(struct buffer *b, + + /* Apply symbol namespaces from __kstrtabns_<symbol> entries. */ +@@ -2265,8 +2267,10 @@ static void add_header(struct buffer *b, buf_printf(b, "\n"); buf_printf(b, "BUILD_SALT;\n"); buf_printf(b, "\n"); @@ -157,8 +155,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> +#endif buf_printf(b, "\n"); buf_printf(b, "__visible struct module __this_module\n"); - buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); -@@ -2164,8 +2168,10 @@ static void add_header(struct buffer *b, + buf_printf(b, "__section(.gnu.linkonce.this_module) = {\n"); +@@ -2283,8 +2287,10 @@ static void add_header(struct buffer *b, static void add_intree_flag(struct buffer *b, int is_intree) { @@ -169,7 +167,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> } /* Cannot check for assembler */ -@@ -2178,8 +2184,10 @@ static void add_retpoline(struct buffer +@@ -2297,8 +2303,10 @@ static void add_retpoline(struct buffer static void add_staging_flag(struct buffer *b, const char *name) { @@ -180,7 +178,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> } /** -@@ -2278,11 +2286,13 @@ static void add_depends(struct buffer *b +@@ -2382,11 +2390,13 @@ static void add_depends(struct buffer *b static void add_srcversion(struct buffer *b, struct module *mod) { @@ -194,10 +192,10 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> } static void write_if_changed(struct buffer *b, const char *fname) -@@ -2519,7 +2529,9 @@ int main(int argc, char **argv) +@@ -2656,7 +2666,9 @@ int main(int argc, char **argv) add_staging_flag(&buf, mod->name); err |= add_versions(&buf, mod); - add_depends(&buf, mod, modules); + add_depends(&buf, mod); +#ifndef CONFIG_MODULE_STRIPPED add_moddevtable(&buf, mod); +#endif diff --git a/target/linux/generic/hack-5.4/207-disable-modorder.patch b/target/linux/generic/hack-5.4/207-disable-modorder.patch deleted file mode 100644 index f47da3f24e..0000000000 --- a/target/linux/generic/hack-5.4/207-disable-modorder.patch +++ /dev/null @@ -1,44 +0,0 @@ -From c9ef4ab0f54356ee9f91d9676ea0ec123840ddc7 Mon Sep 17 00:00:00 2001 -From: Felix Fietkau <nbd@nbd.name> -Date: Fri, 7 Jul 2017 16:57:33 +0200 -Subject: kernel: do not build modules.order - -It is not needed for anything on the system and skipping this saves some -build time, especially in cases where there is nothing to do. - -lede-commit: afc1675833a7bf5df094f59f7250369520646d04 -Signed-off-by: Felix Fietkau <nbd@nbd.name> ---- - Makefile | 2 -- - scripts/Makefile.build | 2 +- - 2 files changed, 1 insertion(+), 3 deletions(-) - ---- a/Makefile -+++ b/Makefile -@@ -1232,7 +1232,6 @@ all: modules - - PHONY += modules - modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin -- $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order - @$(kecho) ' Building modules, stage 2.'; - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost - -@@ -1261,7 +1260,6 @@ _modinst_: - rm -f $(MODLIB)/build ; \ - ln -s $(CURDIR) $(MODLIB)/build ; \ - fi -- @cp -f $(objtree)/modules.order $(MODLIB)/ - @cp -f $(objtree)/modules.builtin $(MODLIB)/ - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst - ---- a/scripts/Makefile.build -+++ b/scripts/Makefile.build -@@ -78,7 +78,7 @@ modorder-target := $(obj)/modules.order - # We keep a list of all modules in $(MODVERDIR) - - __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ -- $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \ -+ $(if $(KBUILD_MODULES),$(obj-m)) \ - $(subdir-ym) $(always) - @: - diff --git a/target/linux/generic/hack-5.4/214-spidev_h_portability.patch b/target/linux/generic/hack-5.4/214-spidev_h_portability.patch index 093f600c85..415e9a423c 100644 --- a/target/linux/generic/hack-5.4/214-spidev_h_portability.patch +++ b/target/linux/generic/hack-5.4/214-spidev_h_portability.patch @@ -13,7 +13,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/include/uapi/linux/spi/spidev.h +++ b/include/uapi/linux/spi/spidev.h -@@ -113,7 +113,7 @@ struct spi_ioc_transfer { +@@ -117,7 +117,7 @@ struct spi_ioc_transfer { /* not all platforms use <asm-generic/ioctl.h> or _IOC_TYPECHECK() ... */ #define SPI_MSGSIZE(N) \ diff --git a/target/linux/generic/hack-5.4/220-gc_sections.patch b/target/linux/generic/hack-5.4/220-gc_sections.patch index 77422e821b..fbac74c111 100644 --- a/target/linux/generic/hack-5.4/220-gc_sections.patch +++ b/target/linux/generic/hack-5.4/220-gc_sections.patch @@ -19,45 +19,19 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> include/asm-generic/vmlinux.lds.h | 63 ++++++++++++++++++++------------------- 7 files changed, 55 insertions(+), 51 deletions(-) ---- a/Makefile -+++ b/Makefile -@@ -294,6 +294,11 @@ else - scripts/Kbuild.include: ; - include scripts/Kbuild.include - -+ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION -+KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections -+LDFLAGS_vmlinux += --gc-sections -+endif -+ - # Read KERNELRELEASE from include/config/kernel.release (if it exists) - KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) - KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) -@@ -782,11 +787,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH - KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) - endif - --ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION --KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections --LDFLAGS_vmlinux += --gc-sections --endif -- - # arch Makefile may override CC so keep this after arch Makefile is included - NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) - --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -98,6 +98,7 @@ config ARM +@@ -111,6 +111,7 @@ config ARM select HAVE_UID16 select HAVE_VIRT_CPU_ACCOUNTING_GEN select IRQ_FORCED_THREADING + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION select MODULES_USE_ELF_REL select NEED_DMA_MAP_STATE - select NO_BOOTMEM + select OF_EARLY_FLATTREE if OF --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile -@@ -106,6 +106,7 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y) +@@ -107,6 +107,7 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y) ORIG_CFLAGS := $(KBUILD_CFLAGS) KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) endif @@ -160,33 +134,3 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> } \ . = __stubs_start + SIZEOF(.stubs); \ __stubs_end = .; \ ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -43,6 +43,7 @@ config MIPS - select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT - select HAVE_CBPF_JIT if (!64BIT && !CPU_MICROMIPS) - select HAVE_EBPF_JIT if (64BIT && !CPU_MICROMIPS) -+ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION - select HAVE_CONTEXT_TRACKING - select HAVE_COPY_THREAD_TLS - select HAVE_C_RECORDMCOUNT ---- a/arch/mips/kernel/vmlinux.lds.S -+++ b/arch/mips/kernel/vmlinux.lds.S -@@ -72,7 +72,7 @@ SECTIONS - /* Exception table for data bus errors */ - __dbe_table : { - __start___dbe_table = .; -- *(__dbe_table) -+ KEEP(*(__dbe_table)) - __stop___dbe_table = .; - } - -@@ -123,7 +123,7 @@ SECTIONS - . = ALIGN(4); - .mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) { - __mips_machines_start = .; -- *(.mips.machines.init) -+ KEEP(*(.mips.machines.init)) - __mips_machines_end = .; - } - diff --git a/target/linux/generic/hack-5.4/221-module_exports.patch b/target/linux/generic/hack-5.4/221-module_exports.patch index cd5ae5830c..a0b7903ecf 100644 --- a/target/linux/generic/hack-5.4/221-module_exports.patch +++ b/target/linux/generic/hack-5.4/221-module_exports.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /* Align . to a 8 byte boundary equals to maximum function alignment. */ #define ALIGN_FUNCTION() . = ALIGN(8) -@@ -372,14 +382,14 @@ +@@ -405,14 +415,14 @@ /* Kernel symbol table: Normal symbols */ \ __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ __start___ksymtab = .; \ @@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> __stop___ksymtab_gpl = .; \ } \ \ -@@ -441,7 +451,7 @@ +@@ -474,7 +484,7 @@ \ /* Kernel symbol table: strings */ \ __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ @@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> } \ \ /* __*init sections */ \ -@@ -841,6 +851,8 @@ +@@ -865,6 +875,8 @@ EXIT_TEXT \ EXIT_DATA \ EXIT_CALL \ @@ -64,12 +64,12 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> + SYMTAB_DISCARD_GPL \ *(.discard) \ *(.discard.*) \ - } + *(.modinfo) \ --- a/include/linux/export.h +++ b/include/linux/export.h -@@ -74,12 +74,19 @@ struct kernel_symbol { - }; - #endif +@@ -98,18 +98,26 @@ struct kernel_symbol { + + #else +#ifdef MODULE +#define __EXPORT_SUFFIX(sym) @@ -77,20 +77,28 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> +#define __EXPORT_SUFFIX(sym) "+" #sym +#endif + - /* For every exported symbol, place a struct in the __ksymtab section */ - #define ___EXPORT_SYMBOL(sym, sec) \ + #define ___export_symbol_common(sym, sec) \ extern typeof(sym) sym; \ - __CRC_SYMBOL(sym, sec) \ + __CRC_SYMBOL(sym, sec); \ static const char __kstrtab_##sym[] \ - __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ + __attribute__((section("__ksymtab_strings" \ + __EXPORT_SUFFIX(sym)), used, aligned(1))) \ - = #sym; \ - __KSYMTAB_ENTRY(sym, sec) + = #sym \ + + /* For every exported symbol, place a struct in the __ksymtab section */ + #define ___EXPORT_SYMBOL_NS(sym, sec, ns) \ + ___export_symbol_common(sym, sec); \ + static const char __kstrtabns_##sym[] \ +- __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ ++ __attribute__((section("__ksymtab_strings" \ ++ __EXPORT_SUFFIX(sym)), used, aligned(1))) \ + = #ns; \ + __KSYMTAB_ENTRY_NS(sym, sec) --- a/scripts/Makefile.build +++ b/scripts/Makefile.build -@@ -408,7 +408,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $( +@@ -362,7 +362,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $( # Linker scripts preprocessor (.lds.S -> .lds) # --------------------------------------------------------------------------- quiet_cmd_cpp_lds_S = LDS $@ diff --git a/target/linux/generic/hack-5.4/230-openwrt_lzma_options.patch b/target/linux/generic/hack-5.4/230-openwrt_lzma_options.patch index 1e945cd4c1..c63d9d276c 100644 --- a/target/linux/generic/hack-5.4/230-openwrt_lzma_options.patch +++ b/target/linux/generic/hack-5.4/230-openwrt_lzma_options.patch @@ -23,15 +23,15 @@ Signed-off-by: Imre Kaloz <kaloz@openwrt.org> { {0x02, 0x21}, "lz4", unlz4 }, --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib -@@ -325,7 +325,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) +@@ -342,7 +342,7 @@ quiet_cmd_bzip2 = BZIP2 $@ + # --------------------------------------------------------------------------- quiet_cmd_lzma = LZMA $@ - cmd_lzma = (cat $(filter-out FORCE,$^) | \ -- lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ -+ lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ - (rm -f $@ ; false) +- cmd_lzma = { cat $(real-prereqs) | lzma -9; $(size_append); } > $@ ++ cmd_lzma = { cat $(real-prereqs) | lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so; $(size_append); } > $@ quiet_cmd_lzo = LZO $@ + cmd_lzo = { cat $(real-prereqs) | lzop -9; $(size_append); } > $@ --- a/usr/gen_initramfs_list.sh +++ b/usr/gen_initramfs_list.sh @@ -229,7 +229,7 @@ cpio_list= diff --git a/target/linux/generic/hack-5.4/250-netfilter_depends.patch b/target/linux/generic/hack-5.4/250-netfilter_depends.patch index cb744bd8ab..512e58efcf 100644 --- a/target/linux/generic/hack-5.4/250-netfilter_depends.patch +++ b/target/linux/generic/hack-5.4/250-netfilter_depends.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig -@@ -241,7 +241,6 @@ config NF_CONNTRACK_FTP +@@ -240,7 +240,6 @@ config NF_CONNTRACK_FTP config NF_CONNTRACK_H323 tristate "H.323 protocol support" @@ -17,7 +17,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> depends on NETFILTER_ADVANCED help H.323 is a VoIP signalling protocol from ITU-T. As one of the most -@@ -1077,7 +1076,6 @@ config NETFILTER_XT_TARGET_SECMARK +@@ -1100,7 +1099,6 @@ config NETFILTER_XT_TARGET_SECMARK config NETFILTER_XT_TARGET_TCPMSS tristate '"TCPMSS" target support' diff --git a/target/linux/generic/hack-5.4/251-sound_kconfig.patch b/target/linux/generic/hack-5.4/251-sound_kconfig.patch index 2cfc2fab3a..bcc6e5476b 100644 --- a/target/linux/generic/hack-5.4/251-sound_kconfig.patch +++ b/target/linux/generic/hack-5.4/251-sound_kconfig.patch @@ -43,8 +43,8 @@ Signed-off-by: John Crispin <john@phrozen.org> select CRYPTO_BLKCIPHER2 select CRYPTO_ALGAPI -@@ -64,7 +64,7 @@ config CRYPTO_BLKCIPHER2 - select CRYPTO_WORKQUEUE +@@ -63,7 +63,7 @@ config CRYPTO_BLKCIPHER2 + select CRYPTO_RNG2 config CRYPTO_HASH - tristate @@ -52,7 +52,7 @@ Signed-off-by: John Crispin <john@phrozen.org> select CRYPTO_HASH2 select CRYPTO_ALGAPI -@@ -73,7 +73,7 @@ config CRYPTO_HASH2 +@@ -72,7 +72,7 @@ config CRYPTO_HASH2 select CRYPTO_ALGAPI2 config CRYPTO_RNG @@ -73,7 +73,7 @@ Signed-off-by: John Crispin <john@phrozen.org> bool --- a/drivers/ssb/Kconfig +++ b/drivers/ssb/Kconfig -@@ -28,6 +28,7 @@ config SSB_SPROM +@@ -29,6 +29,7 @@ config SSB_SPROM config SSB_BLOCKIO bool depends on SSB @@ -81,7 +81,7 @@ Signed-off-by: John Crispin <john@phrozen.org> config SSB_PCIHOST_POSSIBLE bool -@@ -48,7 +49,7 @@ config SSB_PCIHOST +@@ -49,7 +50,7 @@ config SSB_PCIHOST config SSB_B43_PCI_BRIDGE bool depends on SSB_PCIHOST @@ -92,7 +92,7 @@ Signed-off-by: John Crispin <john@phrozen.org> bool --- a/lib/Kconfig +++ b/lib/Kconfig -@@ -377,16 +377,16 @@ config BCH_CONST_T +@@ -402,16 +402,16 @@ config BCH_CONST_T # Textsearch support is select'ed if needed # config TEXTSEARCH @@ -115,7 +115,7 @@ Signed-off-by: John Crispin <john@phrozen.org> bool --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig -@@ -10,7 +10,7 @@ config NETFILTER_INGRESS +@@ -11,7 +11,7 @@ config NETFILTER_INGRESS infrastructure. config NETFILTER_NETLINK @@ -126,14 +126,15 @@ Signed-off-by: John Crispin <john@phrozen.org> bool --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig -@@ -1,5 +1,5 @@ +@@ -1,6 +1,6 @@ + # SPDX-License-Identifier: GPL-2.0-only config WIRELESS_EXT - bool + bool "Wireless extensions" config WEXT_CORE def_bool y -@@ -11,10 +11,10 @@ config WEXT_PROC +@@ -12,10 +12,10 @@ config WEXT_PROC depends on WEXT_CORE config WEXT_SPY @@ -146,7 +147,7 @@ Signed-off-by: John Crispin <john@phrozen.org> config CFG80211 tristate "cfg80211 - wireless configuration API" -@@ -202,7 +202,7 @@ config CFG80211_WEXT_EXPORT +@@ -203,7 +203,7 @@ config CFG80211_WEXT_EXPORT endif # CFG80211 config LIB80211 @@ -155,29 +156,29 @@ Signed-off-by: John Crispin <john@phrozen.org> default n help This options enables a library of common routines used -@@ -211,13 +211,16 @@ config LIB80211 +@@ -212,16 +212,16 @@ config LIB80211 Drivers should select this themselves if needed. config LIB80211_CRYPT_WEP - tristate + tristate "LIB80211_CRYPT_WEP" -+ select LIB80211 + select CRYPTO_LIB_ARC4 config LIB80211_CRYPT_CCMP - tristate + tristate "LIB80211_CRYPT_CCMP" -+ select LIB80211 + select CRYPTO_AES + select CRYPTO_CCM config LIB80211_CRYPT_TKIP - tristate + tristate "LIB80211_CRYPT_TKIP" -+ select LIB80211 + select CRYPTO_LIB_ARC4 config LIB80211_DEBUG - bool "lib80211 debugging messages" --- a/sound/core/Kconfig +++ b/sound/core/Kconfig -@@ -16,7 +16,7 @@ config SND_DMAENGINE_PCM +@@ -17,7 +17,7 @@ config SND_DMAENGINE_PCM tristate config SND_HWDEP @@ -186,7 +187,7 @@ Signed-off-by: John Crispin <john@phrozen.org> config SND_SEQ_DEVICE tristate -@@ -26,7 +26,7 @@ config SND_RAWMIDI +@@ -27,7 +27,7 @@ config SND_RAWMIDI select SND_SEQ_DEVICE if SND_SEQUENCER != n config SND_COMPRESS_OFFLOAD diff --git a/target/linux/generic/hack-5.4/259-regmap_dynamic.patch b/target/linux/generic/hack-5.4/259-regmap_dynamic.patch index ec4636dbee..9950f156d3 100644 --- a/target/linux/generic/hack-5.4/259-regmap_dynamic.patch +++ b/target/linux/generic/hack-5.4/259-regmap_dynamic.patch @@ -18,14 +18,14 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> # subsystems should select the appropriate symbols. config REGMAP -- default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ) +- default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SCCB || REGMAP_I3C) select IRQ_DOMAIN if REGMAP_IRQ - bool + tristate config REGCACHE_COMPRESSED select LZO_COMPRESS -@@ -18,6 +17,7 @@ config REGMAP_AC97 +@@ -18,38 +17,49 @@ config REGMAP_AC97 config REGMAP_I2C tristate @@ -33,7 +33,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> depends on I2C config REGMAP_SLIMBUS -@@ -26,20 +26,26 @@ config REGMAP_SLIMBUS + tristate ++ select REGMAP + depends on SLIMBUS config REGMAP_SPI tristate @@ -42,13 +44,13 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> depends on SPI config REGMAP_SPMI -+ select REGMAP tristate ++ select REGMAP depends on SPMI config REGMAP_W1 -+ select REGMAP tristate ++ select REGMAP depends on W1 config REGMAP_MMIO @@ -56,10 +58,23 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> + select REGMAP config REGMAP_IRQ -+ select REGMAP bool ++ select REGMAP config REGMAP_SOUNDWIRE + tristate ++ select REGMAP + depends on SOUNDWIRE + + config REGMAP_SCCB + tristate ++ select REGMAP + depends on I2C + + config REGMAP_I3C + tristate ++ select REGMAP + depends on I3C --- a/drivers/base/regmap/Makefile +++ b/drivers/base/regmap/Makefile @@ -2,10 +2,14 @@ @@ -83,7 +98,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> obj-$(CONFIG_REGMAP_SLIMBUS) += regmap-slimbus.o --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c -@@ -13,6 +13,7 @@ +@@ -9,6 +9,7 @@ #include <linux/device.h> #include <linux/slab.h> #include <linux/export.h> @@ -91,7 +106,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> #include <linux/mutex.h> #include <linux/err.h> #include <linux/of.h> -@@ -3039,3 +3040,5 @@ static int __init regmap_initcall(void) +@@ -3124,3 +3125,5 @@ static int __init regmap_initcall(void) return 0; } postcore_initcall(regmap_initcall); @@ -99,7 +114,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> +MODULE_LICENSE("GPL"); --- a/include/linux/regmap.h +++ b/include/linux/regmap.h -@@ -187,7 +187,7 @@ struct reg_sequence { +@@ -185,7 +185,7 @@ struct reg_sequence { pollret ?: ((cond) ? 0 : -ETIMEDOUT); \ }) diff --git a/target/linux/generic/hack-5.4/260-crypto_test_dependencies.patch b/target/linux/generic/hack-5.4/260-crypto_test_dependencies.patch index f11f45437f..c9caa2733a 100644 --- a/target/linux/generic/hack-5.4/260-crypto_test_dependencies.patch +++ b/target/linux/generic/hack-5.4/260-crypto_test_dependencies.patch @@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/crypto/Kconfig +++ b/crypto/Kconfig -@@ -144,13 +144,13 @@ config CRYPTO_MANAGER +@@ -120,13 +120,13 @@ config CRYPTO_MANAGER cbc(aes). config CRYPTO_MANAGER2 @@ -35,17 +35,27 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> config CRYPTO_USER tristate "Userspace cryptographic algorithm configuration" -@@ -163,7 +163,6 @@ config CRYPTO_USER +@@ -136,8 +136,6 @@ config CRYPTO_USER + Userspace configuration for cryptographic instantiations such as + cbc(aes). + +-if CRYPTO_MANAGER2 +- config CRYPTO_MANAGER_DISABLE_TESTS bool "Disable run-time self tests" default y -- depends on CRYPTO_MANAGER2 - help +@@ -145,6 +143,8 @@ config CRYPTO_MANAGER_DISABLE_TESTS Disable run-time self tests that normally take place at algorithm registration. + ++if CRYPTO_MANAGER2 ++ + config CRYPTO_MANAGER_EXTRA_TESTS + bool "Enable extra run-time crypto self tests" + depends on DEBUG_KERNEL && !CRYPTO_MANAGER_DISABLE_TESTS --- a/crypto/algboss.c +++ b/crypto/algboss.c -@@ -247,8 +247,12 @@ static int cryptomgr_schedule_test(struc +@@ -242,8 +242,12 @@ static int cryptomgr_schedule_test(struc type = alg->cra_flags; /* Do not test internal algorithms. */ diff --git a/target/linux/generic/hack-5.4/260-lib-arc4-unhide.patch b/target/linux/generic/hack-5.4/260-lib-arc4-unhide.patch new file mode 100644 index 0000000000..b518ee2c37 --- /dev/null +++ b/target/linux/generic/hack-5.4/260-lib-arc4-unhide.patch @@ -0,0 +1,15 @@ +This makes it possible to select CONFIG_CRYPTO_LIB_ARC4 directly. We +need this to be able to compile this into the kernel and make use of it +from backports. + +--- a/crypto/Kconfig ++++ b/crypto/Kconfig +@@ -1151,7 +1151,7 @@ config CRYPTO_ANUBIS + <http://www.larc.usp.br/~pbarreto/AnubisPage.html> + + config CRYPTO_LIB_ARC4 +- tristate ++ tristate "ARC4 cipher library" + + config CRYPTO_ARC4 + tristate "ARC4 cipher algorithm" diff --git a/target/linux/generic/hack-5.4/280-rfkill-stubs.patch b/target/linux/generic/hack-5.4/280-rfkill-stubs.patch index 7bb7d26b90..2e48aea1cf 100644 --- a/target/linux/generic/hack-5.4/280-rfkill-stubs.patch +++ b/target/linux/generic/hack-5.4/280-rfkill-stubs.patch @@ -37,7 +37,7 @@ Signed-off-by: John Crispin <john@phrozen.org> ifneq ($(CONFIG_DCB),) --- a/net/rfkill/Kconfig +++ b/net/rfkill/Kconfig -@@ -1,7 +1,11 @@ +@@ -2,7 +2,11 @@ # # RF switch subsystem configuration # @@ -50,7 +50,7 @@ Signed-off-by: John Crispin <john@phrozen.org> tristate "RF switch subsystem support" help Say Y here if you want to have control over RF switches -@@ -13,19 +17,19 @@ menuconfig RFKILL +@@ -14,19 +18,19 @@ menuconfig RFKILL # LED trigger support config RFKILL_LEDS bool @@ -75,7 +75,7 @@ Signed-off-by: John Crispin <john@phrozen.org> help --- a/net/rfkill/Makefile +++ b/net/rfkill/Makefile -@@ -4,5 +4,5 @@ +@@ -5,5 +5,5 @@ rfkill-y += core.o rfkill-$(CONFIG_RFKILL_INPUT) += input.o diff --git a/target/linux/generic/hack-5.4/290-nvmem-make-CONFIG_NVMEM-tristate-again.patch b/target/linux/generic/hack-5.4/290-nvmem-make-CONFIG_NVMEM-tristate-again.patch index ad45dc9168..4b4d6438dc 100644 --- a/target/linux/generic/hack-5.4/290-nvmem-make-CONFIG_NVMEM-tristate-again.patch +++ b/target/linux/generic/hack-5.4/290-nvmem-make-CONFIG_NVMEM-tristate-again.patch @@ -14,7 +14,8 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig -@@ -1,5 +1,5 @@ +@@ -1,6 +1,6 @@ + # SPDX-License-Identifier: GPL-2.0-only menuconfig NVMEM - bool "NVMEM Support" + tristate "NVMEM Support" @@ -23,7 +24,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig -@@ -71,6 +71,7 @@ config OF_IRQ +@@ -72,6 +72,7 @@ config OF_IRQ config OF_NET depends on NETDEVICES diff --git a/target/linux/generic/hack-5.4/300-MIPS-r4k_cache-use-more-efficient-cache-blast.patch b/target/linux/generic/hack-5.4/300-MIPS-r4k_cache-use-more-efficient-cache-blast.patch index c07ccf9474..aed08a5ec9 100644 --- a/target/linux/generic/hack-5.4/300-MIPS-r4k_cache-use-more-efficient-cache-blast.patch +++ b/target/linux/generic/hack-5.4/300-MIPS-r4k_cache-use-more-efficient-cache-blast.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- --- a/arch/mips/include/asm/r4kcache.h +++ b/arch/mips/include/asm/r4kcache.h -@@ -683,16 +683,48 @@ static inline void prot##extra##blast_## +@@ -617,14 +617,46 @@ static inline void prot##extra##blast_## unsigned long end) \ { \ unsigned long lsize = cpu_##desc##_line_size(); \ @@ -26,8 +26,6 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> + unsigned long aend = (end + lsize - 1) & ~(lsize - 1); \ + int lines = (aend - addr) / lsize; \ \ - __##pfx##flush_prologue \ - \ - while (1) { \ + while (lines >= 8) { \ + prot##cache_op(hitop, addr); \ @@ -62,5 +60,5 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> - break; \ - addr += lsize; \ } \ - \ - __##pfx##flush_epilogue \ + } + diff --git a/target/linux/generic/hack-5.4/301-mips_image_cmdline_hack.patch b/target/linux/generic/hack-5.4/301-mips_image_cmdline_hack.patch index da7d1fdbe0..a6daf1bdbf 100644 --- a/target/linux/generic/hack-5.4/301-mips_image_cmdline_hack.patch +++ b/target/linux/generic/hack-5.4/301-mips_image_cmdline_hack.patch @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1144,6 +1144,10 @@ config SYNC_R4K +@@ -1156,6 +1156,10 @@ config SYNC_R4K config MIPS_MACHINE def_bool n @@ -25,7 +25,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> +++ b/arch/mips/kernel/head.S @@ -79,6 +79,12 @@ FEXPORT(__kernel_entry) j kernel_entry - #endif + #endif /* CONFIG_BOOT_RAW */ +#ifdef CONFIG_IMAGE_CMDLINE_HACK + .ascii "CMDLINE:" diff --git a/target/linux/generic/hack-5.4/321-powerpc_crtsavres_prereq.patch b/target/linux/generic/hack-5.4/321-powerpc_crtsavres_prereq.patch index 26c385f011..8591705eae 100644 --- a/target/linux/generic/hack-5.4/321-powerpc_crtsavres_prereq.patch +++ b/target/linux/generic/hack-5.4/321-powerpc_crtsavres_prereq.patch @@ -16,7 +16,7 @@ Signed-off-by: Alexandros C. Couloumbis <alex@ozo.com> --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile -@@ -60,20 +60,6 @@ machine-$(CONFIG_PPC64) += 64 +@@ -61,20 +61,6 @@ machine-$(CONFIG_PPC64) += 64 machine-$(CONFIG_CPU_LITTLE_ENDIAN) += le UTS_MACHINE := $(subst $(space),,$(machine-y)) @@ -24,7 +24,7 @@ Signed-off-by: Alexandros C. Couloumbis <alex@ozo.com> -ifdef CONFIG_PPC32 -KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o -else --KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/powerpc/kernel/module.lds +-KBUILD_LDS_MODULE += $(srctree)/arch/powerpc/kernel/module.lds -ifeq ($(call ld-ifversion, -ge, 225000000, y),y) -# Have the linker provide sfpr if possible. -# There is a corresponding test in arch/powerpc/lib/Makefile diff --git a/target/linux/generic/hack-5.4/550-loop-Report-EOPNOTSUPP-properly.patch b/target/linux/generic/hack-5.4/550-loop-Report-EOPNOTSUPP-properly.patch index 023de0078d..479513bf54 100644 --- a/target/linux/generic/hack-5.4/550-loop-Report-EOPNOTSUPP-properly.patch +++ b/target/linux/generic/hack-5.4/550-loop-Report-EOPNOTSUPP-properly.patch @@ -18,7 +18,7 @@ Reviewed-by: Bart Van Assche <bvanassche@acm.org> --- a/drivers/block/loop.c +++ b/drivers/block/loop.c -@@ -460,7 +460,7 @@ static void lo_complete_rq(struct reques +@@ -461,7 +461,7 @@ static void lo_complete_rq(struct reques if (!cmd->use_aio || cmd->ret < 0 || cmd->ret == blk_rq_bytes(rq) || req_op(rq) != REQ_OP_READ) { if (cmd->ret < 0) @@ -27,7 +27,7 @@ Reviewed-by: Bart Van Assche <bvanassche@acm.org> goto end_io; } -@@ -1904,7 +1904,10 @@ static void loop_handle_cmd(struct loop_ +@@ -1950,7 +1950,10 @@ static void loop_handle_cmd(struct loop_ failed: /* complete non-aio request */ if (!cmd->use_aio || ret) { diff --git a/target/linux/generic/hack-5.4/551-loop-Better-discard-support-for-block-devices.patch b/target/linux/generic/hack-5.4/551-loop-Better-discard-support-for-block-devices.patch index ac393e5f13..38091290aa 100644 --- a/target/linux/generic/hack-5.4/551-loop-Better-discard-support-for-block-devices.patch +++ b/target/linux/generic/hack-5.4/551-loop-Better-discard-support-for-block-devices.patch @@ -28,7 +28,7 @@ Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> --- a/drivers/block/loop.c +++ b/drivers/block/loop.c -@@ -426,11 +426,12 @@ static int lo_fallocate(struct loop_devi +@@ -427,11 +427,12 @@ static int lo_fallocate(struct loop_devi * information. */ struct file *file = lo->lo_backing_file; @@ -42,7 +42,7 @@ Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> ret = -EOPNOTSUPP; goto out; } -@@ -863,6 +864,21 @@ static void loop_config_discard(struct l +@@ -862,6 +863,21 @@ static void loop_config_discard(struct l struct file *file = lo->lo_backing_file; struct inode *inode = file->f_mapping->host; struct request_queue *q = lo->lo_queue; @@ -64,7 +64,7 @@ Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> /* * We use punch hole to reclaim the free space used by the -@@ -870,22 +886,24 @@ static void loop_config_discard(struct l +@@ -869,22 +885,24 @@ static void loop_config_discard(struct l * encryption is enabled, because it may give an attacker * useful information. */ diff --git a/target/linux/generic/hack-5.4/640-bridge-only-accept-EAP-locally.patch b/target/linux/generic/hack-5.4/640-bridge-only-accept-EAP-locally.patch index f77a1965ca..a713aa3cff 100644 --- a/target/linux/generic/hack-5.4/640-bridge-only-accept-EAP-locally.patch +++ b/target/linux/generic/hack-5.4/640-bridge-only-accept-EAP-locally.patch @@ -12,7 +12,7 @@ Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com> --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c -@@ -108,10 +108,14 @@ int br_handle_frame_finish(struct net *n +@@ -103,10 +103,14 @@ int br_handle_frame_finish(struct net *n } } @@ -30,7 +30,7 @@ Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com> if (IS_ENABLED(CONFIG_INET) && --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h -@@ -337,6 +337,8 @@ struct net_bridge { +@@ -345,6 +345,8 @@ struct net_bridge { u16 group_fwd_mask; u16 group_fwd_mask_required; @@ -41,7 +41,7 @@ Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com> bridge_id bridge_id; --- a/net/bridge/br_sysfs_br.c +++ b/net/bridge/br_sysfs_br.c -@@ -170,6 +170,30 @@ static ssize_t group_fwd_mask_store(stru +@@ -166,6 +166,30 @@ static ssize_t group_fwd_mask_store(stru } static DEVICE_ATTR_RW(group_fwd_mask); @@ -72,7 +72,7 @@ Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com> static ssize_t priority_show(struct device *d, struct device_attribute *attr, char *buf) { -@@ -810,6 +834,7 @@ static struct attribute *bridge_attrs[] +@@ -851,6 +875,7 @@ static struct attribute *bridge_attrs[] &dev_attr_ageing_time.attr, &dev_attr_stp_state.attr, &dev_attr_group_fwd_mask.attr, diff --git a/target/linux/generic/hack-5.4/645-netfilter-connmark-introduce-set-dscpmark.patch b/target/linux/generic/hack-5.4/645-netfilter-connmark-introduce-set-dscpmark.patch index a4f246d112..f5ca1bef6e 100644 --- a/target/linux/generic/hack-5.4/645-netfilter-connmark-introduce-set-dscpmark.patch +++ b/target/linux/generic/hack-5.4/645-netfilter-connmark-introduce-set-dscpmark.patch @@ -109,7 +109,7 @@ Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> __u8 invert; --- a/net/netfilter/xt_connmark.c +++ b/net/netfilter/xt_connmark.c -@@ -36,12 +36,13 @@ MODULE_ALIAS("ipt_connmark"); +@@ -24,12 +24,13 @@ MODULE_ALIAS("ipt_connmark"); MODULE_ALIAS("ip6t_connmark"); static unsigned int @@ -124,7 +124,7 @@ Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> ct = nf_ct_get(skb, &ctinfo); if (ct == NULL) -@@ -49,12 +50,24 @@ connmark_tg_shift(struct sk_buff *skb, c +@@ -37,12 +38,24 @@ connmark_tg_shift(struct sk_buff *skb, c switch (info->mode) { case XT_CONNMARK_SET: @@ -154,7 +154,7 @@ Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> if (ct->mark != newmark) { ct->mark = newmark; nf_conntrack_event_cache(IPCT_MARK, ct); -@@ -93,20 +106,36 @@ static unsigned int +@@ -81,20 +94,36 @@ static unsigned int connmark_tg(struct sk_buff *skb, const struct xt_action_param *par) { const struct xt_connmark_tginfo1 *info = par->targinfo; @@ -193,7 +193,7 @@ Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> return connmark_tg_shift(skb, info); } -@@ -177,6 +206,16 @@ static struct xt_target connmark_tg_reg[ +@@ -165,6 +194,16 @@ static struct xt_target connmark_tg_reg[ .targetsize = sizeof(struct xt_connmark_tginfo2), .destroy = connmark_tg_destroy, .me = THIS_MODULE, diff --git a/target/linux/generic/hack-5.4/647-netfilter-flow-acct.patch b/target/linux/generic/hack-5.4/647-netfilter-flow-acct.patch index fd8a871113..920514f11f 100644 --- a/target/linux/generic/hack-5.4/647-netfilter-flow-acct.patch +++ b/target/linux/generic/hack-5.4/647-netfilter-flow-acct.patch @@ -1,6 +1,6 @@ --- a/include/net/netfilter/nf_flow_table.h +++ b/include/net/netfilter/nf_flow_table.h -@@ -163,6 +163,8 @@ struct nf_flow_table_hw { +@@ -158,6 +158,8 @@ struct nf_flow_table_hw { int nf_flow_table_hw_register(const struct nf_flow_table_hw *offload); void nf_flow_table_hw_unregister(const struct nf_flow_table_hw *offload); @@ -11,15 +11,15 @@ #define MODULE_ALIAS_NF_FLOWTABLE(family) \ --- a/net/netfilter/nf_flow_table_core.c +++ b/net/netfilter/nf_flow_table_core.c -@@ -11,6 +11,7 @@ - #include <net/netfilter/nf_conntrack.h> +@@ -13,6 +13,7 @@ #include <net/netfilter/nf_conntrack_core.h> + #include <net/netfilter/nf_conntrack_l4proto.h> #include <net/netfilter/nf_conntrack_tuple.h> +#include <net/netfilter/nf_conntrack_acct.h> struct flow_offload_entry { struct flow_offload flow; -@@ -149,6 +150,22 @@ void flow_offload_free(struct flow_offlo +@@ -164,6 +165,22 @@ void flow_offload_free(struct flow_offlo } EXPORT_SYMBOL_GPL(flow_offload_free); @@ -44,7 +44,7 @@ const struct flow_offload_tuple *tuple = data; --- a/net/netfilter/nf_flow_table_ip.c +++ b/net/netfilter/nf_flow_table_ip.c -@@ -11,6 +11,7 @@ +@@ -12,6 +12,7 @@ #include <net/ip6_route.h> #include <net/neighbour.h> #include <net/netfilter/nf_flow_table.h> @@ -52,7 +52,7 @@ /* For layer 4 checksum field offset. */ #include <linux/tcp.h> #include <linux/udp.h> -@@ -267,6 +268,7 @@ nf_flow_offload_ip_hook(void *priv, stru +@@ -295,6 +296,7 @@ nf_flow_offload_ip_hook(void *priv, stru skb->dev = outdev; nexthop = rt_nexthop(rt, flow->tuplehash[!dir].tuple.src_v4.s_addr); skb_dst_set_noref(skb, &rt->dst); @@ -60,7 +60,7 @@ neigh_xmit(NEIGH_ARP_TABLE, outdev, &nexthop, skb); return NF_STOLEN; -@@ -487,6 +489,7 @@ nf_flow_offload_ipv6_hook(void *priv, st +@@ -524,6 +526,7 @@ nf_flow_offload_ipv6_hook(void *priv, st skb->dev = outdev; nexthop = rt6_nexthop(rt, &flow->tuplehash[!dir].tuple.src_v6); skb_dst_set_noref(skb, &rt->dst); diff --git a/target/linux/generic/hack-5.4/650-netfilter-add-xt_OFFLOAD-target.patch b/target/linux/generic/hack-5.4/650-netfilter-add-xt_OFFLOAD-target.patch index 55247bc2a3..3a9d64dd4a 100644 --- a/target/linux/generic/hack-5.4/650-netfilter-add-xt_OFFLOAD-target.patch +++ b/target/linux/generic/hack-5.4/650-netfilter-add-xt_OFFLOAD-target.patch @@ -8,7 +8,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig -@@ -63,8 +63,6 @@ config NF_TABLES_ARP +@@ -56,8 +56,6 @@ config NF_TABLES_ARP help This option enables the ARP support for nf_tables. @@ -17,7 +17,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> config NF_FLOW_TABLE_IPV4 tristate "Netfilter flow table IPv4 module" depends on NF_FLOW_TABLE -@@ -73,6 +71,8 @@ config NF_FLOW_TABLE_IPV4 +@@ -66,6 +64,8 @@ config NF_FLOW_TABLE_IPV4 To compile it as a module, choose M here. @@ -28,7 +28,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> depends on !NF_CONNTRACK || NF_CONNTRACK --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig -@@ -80,7 +80,6 @@ config NFT_FIB_IPV6 +@@ -45,7 +45,6 @@ config NFT_FIB_IPV6 multicast or blackhole. endif # NF_TABLES_IPV6 @@ -36,7 +36,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> config NF_FLOW_TABLE_IPV6 tristate "Netfilter flow table IPv6 module" -@@ -90,6 +89,8 @@ config NF_FLOW_TABLE_IPV6 +@@ -55,6 +54,8 @@ config NF_FLOW_TABLE_IPV6 To compile it as a module, choose M here. @@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> depends on !NF_CONNTRACK || NF_CONNTRACK --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig -@@ -693,8 +693,6 @@ config NFT_FIB_NETDEV +@@ -702,8 +702,6 @@ config NFT_FIB_NETDEV endif # NF_TABLES_NETDEV @@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> config NF_FLOW_TABLE_INET tristate "Netfilter flow table mixed IPv4/IPv6 module" depends on NF_FLOW_TABLE -@@ -703,11 +701,12 @@ config NF_FLOW_TABLE_INET +@@ -712,11 +710,12 @@ config NF_FLOW_TABLE_INET To compile it as a module, choose M here. @@ -70,7 +70,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> help This option adds the flow table core infrastructure. -@@ -996,6 +995,15 @@ config NETFILTER_XT_TARGET_NOTRACK +@@ -1005,6 +1004,15 @@ config NETFILTER_XT_TARGET_NOTRACK depends on NETFILTER_ADVANCED select NETFILTER_XT_TARGET_CT @@ -98,7 +98,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o --- /dev/null +++ b/net/netfilter/xt_FLOWOFFLOAD.c -@@ -0,0 +1,422 @@ +@@ -0,0 +1,427 @@ +/* + * Copyright (C) 2018 Felix Fietkau <nbd@nbd.name> + * @@ -143,6 +143,10 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> + return NF_ACCEPT; +} + ++int nf_flow_table_iterate(struct nf_flowtable *flow_table, ++ void (*iter)(struct flow_offload *flow, void *data), ++ void *data); ++ +static int +xt_flowoffload_create_hook(struct net_device *dev) +{ @@ -240,11 +244,12 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> + struct flow_offload_tuple *tuple = &flow->tuplehash[0].tuple; + struct xt_flowoffload_hook *hook; + bool *found = data; ++ struct rtable *rt = (struct rtable *)tuple->dst_cache; + + spin_lock_bh(&hooks_lock); + hlist_for_each_entry(hook, &hooks, list) { + if (hook->ops.dev->ifindex != tuple->iifidx && -+ hook->ops.dev->ifindex != tuple->oifidx) ++ hook->ops.dev->ifindex != rt->dst.dev->ifindex) + continue; + + hook->used = true; @@ -483,7 +488,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> + kfree(hook); + } + -+ nf_flow_table_cleanup(dev_net(dev), dev); ++ nf_flow_table_cleanup(dev); + + return NOTIFY_DONE; +} @@ -523,7 +528,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> +module_exit(xt_flowoffload_tg_exit); --- a/net/netfilter/nf_flow_table_core.c +++ b/net/netfilter/nf_flow_table_core.c -@@ -6,7 +6,6 @@ +@@ -7,7 +7,6 @@ #include <linux/netdevice.h> #include <net/ip.h> #include <net/ip6_route.h> @@ -531,6 +536,24 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> #include <net/netfilter/nf_flow_table.h> #include <net/netfilter/nf_conntrack.h> #include <net/netfilter/nf_conntrack_core.h> +@@ -338,8 +337,7 @@ flow_offload_lookup(struct nf_flowtable + } + EXPORT_SYMBOL_GPL(flow_offload_lookup); + +-static int +-nf_flow_table_iterate(struct nf_flowtable *flow_table, ++int nf_flow_table_iterate(struct nf_flowtable *flow_table, + void (*iter)(struct flow_offload *flow, void *data), + void *data) + { +@@ -372,6 +370,7 @@ nf_flow_table_iterate(struct nf_flowtabl + + return err; + } ++EXPORT_SYMBOL_GPL(nf_flow_table_iterate); + + static void nf_flow_offload_gc_step(struct flow_offload *flow, void *data) + { --- /dev/null +++ b/include/uapi/linux/netfilter/xt_FLOWOFFLOAD.h @@ -0,0 +1,17 @@ @@ -551,3 +574,16 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> +}; + +#endif /* _XT_FLOWOFFLOAD_H */ +--- a/include/net/netfilter/nf_flow_table.h ++++ b/include/net/netfilter/nf_flow_table.h +@@ -128,6 +128,10 @@ static inline void flow_offload_dead(str + flow->flags |= FLOW_OFFLOAD_DYING; + } + ++int nf_flow_table_iterate(struct nf_flowtable *flow_table, ++ void (*iter)(struct flow_offload *flow, void *data), ++ void *data); ++ + int nf_flow_snat_port(const struct flow_offload *flow, + struct sk_buff *skb, unsigned int thoff, + u8 protocol, enum flow_offload_tuple_dir dir); diff --git a/target/linux/generic/hack-5.4/651-wireless_mesh_header.patch b/target/linux/generic/hack-5.4/651-wireless_mesh_header.patch index 965b431d01..b134e6c6c0 100644 --- a/target/linux/generic/hack-5.4/651-wireless_mesh_header.patch +++ b/target/linux/generic/hack-5.4/651-wireless_mesh_header.patch @@ -11,7 +11,7 @@ Signed-off-by: Imre Kaloz <kaloz@openwrt.org> --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -140,8 +140,8 @@ static inline bool dev_xmit_complete(int +@@ -136,8 +136,8 @@ static inline bool dev_xmit_complete(int #if defined(CONFIG_HYPERV_NET) # define LL_MAX_HEADER 128 diff --git a/target/linux/generic/hack-5.4/660-fq_codel_defaults.patch b/target/linux/generic/hack-5.4/660-fq_codel_defaults.patch index 42698c6451..968ce12599 100644 --- a/target/linux/generic/hack-5.4/660-fq_codel_defaults.patch +++ b/target/linux/generic/hack-5.4/660-fq_codel_defaults.patch @@ -13,7 +13,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c -@@ -474,7 +474,11 @@ static int fq_codel_init(struct Qdisc *s +@@ -462,7 +462,11 @@ static int fq_codel_init(struct Qdisc *s sch->limit = 10*1024; q->flows_cnt = 1024; diff --git a/target/linux/generic/hack-5.4/661-use_fq_codel_by_default.patch b/target/linux/generic/hack-5.4/661-use_fq_codel_by_default.patch index 2778377de7..e8d456dde8 100644 --- a/target/linux/generic/hack-5.4/661-use_fq_codel_by_default.patch +++ b/target/linux/generic/hack-5.4/661-use_fq_codel_by_default.patch @@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h -@@ -487,12 +487,13 @@ extern struct Qdisc_ops noop_qdisc_ops; +@@ -569,12 +569,13 @@ extern struct Qdisc_ops noop_qdisc_ops; extern struct Qdisc_ops pfifo_fast_ops; extern struct Qdisc_ops mq_qdisc_ops; extern struct Qdisc_ops noqueue_qdisc_ops; @@ -31,7 +31,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> struct Qdisc_class_common { --- a/net/sched/Kconfig +++ b/net/sched/Kconfig -@@ -3,8 +3,9 @@ +@@ -4,8 +4,9 @@ # menuconfig NET_SCHED @@ -44,7 +44,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> device, it has to decide which ones to send first, which ones to --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c -@@ -2162,7 +2162,7 @@ static int __init pktsched_init(void) +@@ -2271,7 +2271,7 @@ static int __init pktsched_init(void) return err; } @@ -55,7 +55,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> register_qdisc(&pfifo_head_drop_qdisc_ops); --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c -@@ -714,7 +714,7 @@ static const struct Qdisc_class_ops fq_c +@@ -702,7 +702,7 @@ static const struct Qdisc_class_ops fq_c .walk = fq_codel_walk, }; @@ -64,7 +64,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> .cl_ops = &fq_codel_class_ops, .id = "fq_codel", .priv_size = sizeof(struct fq_codel_sched_data), -@@ -729,6 +729,7 @@ static struct Qdisc_ops fq_codel_qdisc_o +@@ -717,6 +717,7 @@ static struct Qdisc_ops fq_codel_qdisc_o .dump_stats = fq_codel_dump_stats, .owner = THIS_MODULE, }; @@ -74,7 +74,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> { --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c -@@ -35,7 +35,7 @@ +@@ -32,7 +32,7 @@ #include <net/xfrm.h> /* Qdisc to use by default */ @@ -83,7 +83,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> EXPORT_SYMBOL(default_qdisc_ops); /* Main transmission queue. */ -@@ -1025,7 +1025,7 @@ static void attach_one_default_qdisc(str +@@ -1034,12 +1034,12 @@ static void attach_one_default_qdisc(str void *_unused) { struct Qdisc *qdisc; @@ -92,3 +92,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> if (dev->priv_flags & IFF_NO_QUEUE) ops = &noqueue_qdisc_ops; + else if(dev->type == ARPHRD_CAN) +- ops = &pfifo_fast_ops; ++ ops = &fq_codel_qdisc_ops; + + qdisc = qdisc_create_dflt(dev_queue, ops, TC_H_ROOT, NULL); + if (!qdisc) { diff --git a/target/linux/generic/hack-5.4/662-remove_pfifo_fast.patch b/target/linux/generic/hack-5.4/662-remove_pfifo_fast.patch index e49507a590..149a923dcb 100644 --- a/target/linux/generic/hack-5.4/662-remove_pfifo_fast.patch +++ b/target/linux/generic/hack-5.4/662-remove_pfifo_fast.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c -@@ -612,207 +612,6 @@ struct Qdisc_ops noqueue_qdisc_ops __rea +@@ -594,211 +594,6 @@ struct Qdisc_ops noqueue_qdisc_ops __rea .owner = THIS_MODULE, }; @@ -49,14 +49,14 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> - - err = skb_array_produce(q, skb); - -- if (unlikely(err)) -- return qdisc_drop_cpu(skb, qdisc, to_free); +- if (unlikely(err)) { +- if (qdisc_is_percpu_stats(qdisc)) +- return qdisc_drop_cpu(skb, qdisc, to_free); +- else +- return qdisc_drop(skb, qdisc, to_free); +- } - -- qdisc_qstats_atomic_qlen_inc(qdisc); -- /* Note: skb can not be used after skb_array_produce(), -- * so we better not use qdisc_qstats_cpu_backlog_inc() -- */ -- this_cpu_add(qdisc->cpu_qstats->backlog, pkt_len); +- qdisc_update_stats_at_enqueue(qdisc, pkt_len); - return NET_XMIT_SUCCESS; -} - @@ -75,9 +75,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> - skb = __skb_array_consume(q); - } - if (likely(skb)) { -- qdisc_qstats_cpu_backlog_dec(qdisc, skb); -- qdisc_bstats_cpu_update(qdisc, skb); -- qdisc_qstats_atomic_qlen_dec(qdisc); +- qdisc_update_stats_at_dequeue(qdisc, skb); +- } else { +- WRITE_ONCE(qdisc->empty, true); - } - - return skb; @@ -117,10 +117,14 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> - kfree_skb(skb); - } - -- for_each_possible_cpu(i) { -- struct gnet_stats_queue *q = per_cpu_ptr(qdisc->cpu_qstats, i); +- if (qdisc_is_percpu_stats(qdisc)) { +- for_each_possible_cpu(i) { +- struct gnet_stats_queue *q; - -- q->backlog = 0; +- q = per_cpu_ptr(qdisc->cpu_qstats, i); +- q->backlog = 0; +- q->qlen = 0; +- } - } -} - @@ -215,6 +219,6 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> -}; -EXPORT_SYMBOL(pfifo_fast_ops); - - static struct lock_class_key qdisc_tx_busylock; - static struct lock_class_key qdisc_running_key; - + struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, + const struct Qdisc_ops *ops, + struct netlink_ext_ack *extack) diff --git a/target/linux/generic/hack-5.4/700-swconfig_switch_drivers.patch b/target/linux/generic/hack-5.4/700-swconfig_switch_drivers.patch index ebfcfe81c7..b1b7ce7d04 100644 --- a/target/linux/generic/hack-5.4/700-swconfig_switch_drivers.patch +++ b/target/linux/generic/hack-5.4/700-swconfig_switch_drivers.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -209,6 +209,89 @@ config LED_TRIGGER_PHY +@@ -249,6 +249,89 @@ config LED_TRIGGER_PHY for any speed known to the PHY. @@ -123,9 +123,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> +obj-$(CONFIG_RTL8367_PHY) += rtl8367.o +obj-$(CONFIG_RTL8367B_PHY) += rtl8367b.o + + obj-$(CONFIG_MDIO_ASPEED) += mdio-aspeed.o obj-$(CONFIG_MDIO_BCM_IPROC) += mdio-bcm-iproc.o obj-$(CONFIG_MDIO_BCM_UNIMAC) += mdio-bcm-unimac.o - obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o --- a/include/linux/platform_data/b53.h +++ b/include/linux/platform_data/b53.h @@ -29,6 +29,9 @@ struct b53_platform_data { diff --git a/target/linux/generic/hack-5.4/702-phy_add_aneg_done_function.patch b/target/linux/generic/hack-5.4/702-phy_add_aneg_done_function.patch index a0e6484be8..0f4dab3460 100644 --- a/target/linux/generic/hack-5.4/702-phy_add_aneg_done_function.patch +++ b/target/linux/generic/hack-5.4/702-phy_add_aneg_done_function.patch @@ -1,6 +1,6 @@ --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -555,6 +555,12 @@ struct phy_driver { +@@ -522,6 +522,12 @@ struct phy_driver { /* Determines the negotiated speed and duplex */ int (*read_status)(struct phy_device *phydev); @@ -15,9 +15,9 @@ --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c -@@ -1577,6 +1577,9 @@ int genphy_update_link(struct phy_device - { - int status; +@@ -1822,6 +1822,9 @@ int genphy_update_link(struct phy_device + if (bmcr & BMCR_ANRESTART) + goto done; + if (phydev->drv && phydev->drv->update_link) + return phydev->drv->update_link(phydev); diff --git a/target/linux/generic/hack-5.4/721-phy_packets.patch b/target/linux/generic/hack-5.4/721-phy_packets.patch index 1ad7d46764..89f113a1c8 100644 --- a/target/linux/generic/hack-5.4/721-phy_packets.patch +++ b/target/linux/generic/hack-5.4/721-phy_packets.patch @@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h -@@ -1514,6 +1514,7 @@ enum netdev_priv_flags { +@@ -1544,6 +1544,7 @@ enum netdev_priv_flags { IFF_FAILOVER_SLAVE = 1<<28, IFF_L3MDEV_RX_HANDLER = 1<<29, IFF_LIVE_RENAME_OK = 1<<30, @@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> }; #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN -@@ -1546,6 +1547,7 @@ enum netdev_priv_flags { +@@ -1576,6 +1577,7 @@ enum netdev_priv_flags { #define IFF_FAILOVER_SLAVE IFF_FAILOVER_SLAVE #define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER #define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK @@ -31,7 +31,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /** * struct net_device - The DEVICE structure. -@@ -1846,6 +1848,11 @@ struct net_device { +@@ -1877,6 +1879,11 @@ struct net_device { const struct tlsdev_ops *tlsdev_ops; #endif @@ -43,7 +43,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> const struct header_ops *header_ops; unsigned int flags; -@@ -1928,6 +1935,10 @@ struct net_device { +@@ -1959,6 +1966,10 @@ struct net_device { struct mpls_dev __rcu *mpls_ptr; #endif @@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> */ --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2547,6 +2547,10 @@ static inline int pskb_trim(struct sk_bu +@@ -2665,6 +2665,10 @@ static inline int pskb_trim(struct sk_bu return (len < skb->len) ? __pskb_trim(skb, len) : 0; } @@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /** * pskb_trim_unique - remove end from a paged unique (not cloned) buffer * @skb: buffer to alter -@@ -2678,16 +2682,6 @@ static inline struct sk_buff *dev_alloc_ +@@ -2796,16 +2800,6 @@ static inline struct sk_buff *dev_alloc_ } @@ -86,7 +86,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> { --- a/net/Kconfig +++ b/net/Kconfig -@@ -25,6 +25,12 @@ menuconfig NET +@@ -26,6 +26,12 @@ menuconfig NET if NET @@ -101,8 +101,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> help --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -3253,10 +3253,20 @@ static int xmit_one(struct sk_buff *skb, - if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all)) +@@ -3194,10 +3194,20 @@ static int xmit_one(struct sk_buff *skb, + if (dev_nit_active(dev)) dev_queue_xmit_nit(skb, dev); - len = skb->len; @@ -128,15 +128,15 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> } --- a/net/core/skbuff.c +++ b/net/core/skbuff.c -@@ -63,6 +63,7 @@ - #include <linux/errqueue.h> +@@ -60,6 +60,7 @@ #include <linux/prefetch.h> #include <linux/if_vlan.h> + #include <linux/mpls.h> +#include <linux/if.h> #include <net/protocol.h> #include <net/dst.h> -@@ -503,6 +504,22 @@ skb_fail: +@@ -540,6 +541,22 @@ skb_fail: } EXPORT_SYMBOL(__napi_alloc_skb); @@ -161,7 +161,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> { --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c -@@ -172,6 +172,12 @@ __be16 eth_type_trans(struct sk_buff *sk +@@ -171,6 +171,12 @@ __be16 eth_type_trans(struct sk_buff *sk const struct ethhdr *eth; skb->dev = dev; diff --git a/target/linux/generic/hack-5.4/773-bgmac-add-srab-switch.patch b/target/linux/generic/hack-5.4/773-bgmac-add-srab-switch.patch index 3b4781657e..89e0df4606 100644 --- a/target/linux/generic/hack-5.4/773-bgmac-add-srab-switch.patch +++ b/target/linux/generic/hack-5.4/773-bgmac-add-srab-switch.patch @@ -32,7 +32,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> #include <linux/bcm47xx_nvram.h> #include <linux/phy.h> #include <linux/phy_fixed.h> -@@ -1409,6 +1410,17 @@ static const struct ethtool_ops bgmac_et +@@ -1407,6 +1408,17 @@ static const struct ethtool_ops bgmac_et .set_link_ksettings = phy_ethtool_set_link_ksettings, }; @@ -50,7 +50,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> /************************************************** * MII **************************************************/ -@@ -1540,6 +1552,14 @@ int bgmac_enet_probe(struct bgmac *bgmac +@@ -1538,6 +1550,14 @@ int bgmac_enet_probe(struct bgmac *bgmac net_dev->hw_features = net_dev->features; net_dev->vlan_features = net_dev->features; @@ -65,7 +65,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> err = register_netdev(bgmac->net_dev); if (err) { dev_err(bgmac->dev, "Cannot register net device\n"); -@@ -1562,6 +1582,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe); +@@ -1560,6 +1580,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe); void bgmac_enet_remove(struct bgmac *bgmac) { diff --git a/target/linux/generic/hack-5.4/901-debloat_sock_diag.patch b/target/linux/generic/hack-5.4/901-debloat_sock_diag.patch index 639f76d309..aec1d58fa7 100644 --- a/target/linux/generic/hack-5.4/901-debloat_sock_diag.patch +++ b/target/linux/generic/hack-5.4/901-debloat_sock_diag.patch @@ -16,7 +16,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/net/Kconfig +++ b/net/Kconfig -@@ -98,6 +98,9 @@ source "net/netlabel/Kconfig" +@@ -100,6 +100,9 @@ source "net/netlabel/Kconfig" endif # if INET @@ -34,7 +34,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> neighbour.o rtnetlink.o utils.o link_watch.o filter.o \ - sock_diag.o dev_ioctl.o tso.o sock_reuseport.o \ + dev_ioctl.o tso.o sock_reuseport.o \ - fib_notifier.o xdp.o + fib_notifier.o xdp.o flow_offload.o +obj-$(CONFIG_SOCK_DIAG) += sock_diag.o obj-y += net-sysfs.o @@ -42,7 +42,15 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> obj-$(CONFIG_PROC_FS) += net-procfs.o --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -490,6 +490,18 @@ discard_and_relse: +@@ -140,6 +140,7 @@ + + static DEFINE_MUTEX(proto_list_mutex); + static LIST_HEAD(proto_list); ++static atomic64_t cookie_gen; + + static void sock_inuse_add(struct net *net, int val); + +@@ -539,6 +540,18 @@ discard_and_relse: } EXPORT_SYMBOL(__sk_receive_skb); @@ -53,7 +61,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> + + if (res) + return res; -+ res = atomic64_inc_return(&sock_net(sk)->cookie_gen); ++ res = atomic64_inc_return(&cookie_gen); + atomic64_cmpxchg(&sk->sk_cookie, 0, res); + } +} @@ -61,7 +69,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie) { struct dst_entry *dst = __sk_dst_get(sk); -@@ -1603,9 +1615,11 @@ static void __sk_free(struct sock *sk) +@@ -1746,9 +1759,11 @@ static void __sk_free(struct sock *sk) if (likely(sk->sk_net_refcnt)) sock_inuse_add(sock_net(sk), -1); @@ -75,10 +83,12 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/net/core/sock_diag.c +++ b/net/core/sock_diag.c -@@ -20,18 +20,6 @@ static int (*inet_rcv_compat)(struct sk_ +@@ -19,19 +19,6 @@ static const struct sock_diag_handler *s + static int (*inet_rcv_compat)(struct sk_buff *skb, struct nlmsghdr *nlh); static DEFINE_MUTEX(sock_diag_table_mutex); static struct workqueue_struct *broadcast_wq; - +-static atomic64_t cookie_gen; +- -u64 sock_gen_cookie(struct sock *sk) -{ - while (1) { @@ -86,17 +96,16 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> - - if (res) - return res; -- res = atomic64_inc_return(&sock_net(sk)->cookie_gen); +- res = atomic64_inc_return(&cookie_gen); - atomic64_cmpxchg(&sk->sk_cookie, 0, res); - } -} -- + int sock_diag_check_cookie(struct sock *sk, const __u32 *cookie) { - u64 res; --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig -@@ -425,6 +425,7 @@ config INET_XFRM_MODE_BEET +@@ -399,6 +399,7 @@ config INET_TUNNEL config INET_DIAG tristate "INET: socket monitoring interface" @@ -106,7 +115,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> Support for INET (TCP, DCCP, etc) socket monitoring interface used by --- a/net/netlink/Kconfig +++ b/net/netlink/Kconfig -@@ -4,6 +4,7 @@ +@@ -5,6 +5,7 @@ config NETLINK_DIAG tristate "NETLINK: socket monitoring interface" @@ -116,7 +125,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> Support for NETLINK socket monitoring interface used by the ss tool. --- a/net/packet/Kconfig +++ b/net/packet/Kconfig -@@ -18,6 +18,7 @@ config PACKET +@@ -19,6 +19,7 @@ config PACKET config PACKET_DIAG tristate "Packet: sockets monitoring interface" depends on PACKET @@ -126,7 +135,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> Support for PF_PACKET sockets monitoring interface used by the ss tool. --- a/net/unix/Kconfig +++ b/net/unix/Kconfig -@@ -22,6 +22,7 @@ config UNIX +@@ -28,6 +28,7 @@ config UNIX_SCM config UNIX_DIAG tristate "UNIX: socket monitoring interface" depends on UNIX diff --git a/target/linux/generic/hack-5.4/902-debloat_proc.patch b/target/linux/generic/hack-5.4/902-debloat_proc.patch index 1442cee8bb..880aea0a85 100644 --- a/target/linux/generic/hack-5.4/902-debloat_proc.patch +++ b/target/linux/generic/hack-5.4/902-debloat_proc.patch @@ -29,7 +29,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/fs/locks.c +++ b/fs/locks.c -@@ -2786,6 +2786,8 @@ static const struct seq_operations locks +@@ -2961,6 +2961,8 @@ static const struct seq_operations locks static int __init proc_locks_init(void) { @@ -40,18 +40,21 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> return 0; --- a/fs/proc/Kconfig +++ b/fs/proc/Kconfig -@@ -97,3 +97,8 @@ config PROC_CHILDREN - +@@ -100,6 +100,11 @@ config PROC_CHILDREN Say Y if you are running any user-space software which takes benefit from this interface. For example, rkt is such a piece of software. -+ + +config PROC_STRIPPED + default n + depends on EXPERT + bool "Strip non-essential /proc functionality to reduce code size" ++ + config PROC_PID_ARCH_STATUS + def_bool n + depends on PROC_FS --- a/fs/proc/consoles.c +++ b/fs/proc/consoles.c -@@ -93,6 +93,9 @@ static const struct seq_operations conso +@@ -92,6 +92,9 @@ static const struct seq_operations conso static int __init proc_consoles_init(void) { @@ -97,7 +100,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> proc_mkdir("tty/ldisc", NULL); /* Preserved: it's userspace visible */ --- a/include/net/snmp.h +++ b/include/net/snmp.h -@@ -123,6 +123,21 @@ struct linux_xfrm_mib { +@@ -118,6 +118,21 @@ struct linux_xfrm_mib { #define DECLARE_SNMP_STAT(type, name) \ extern __typeof__(type) __percpu *name @@ -119,7 +122,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> #define __SNMP_INC_STATS(mib, field) \ __this_cpu_inc(mib->mibs[field]) -@@ -153,8 +168,9 @@ struct linux_xfrm_mib { +@@ -148,8 +163,9 @@ struct linux_xfrm_mib { __this_cpu_add(ptr[basefield##OCTETS], addend); \ } while (0) @@ -132,7 +135,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> do { \ --- a/ipc/msg.c +++ b/ipc/msg.c -@@ -1292,6 +1292,9 @@ void __init msg_init(void) +@@ -1317,6 +1317,9 @@ void __init msg_init(void) { msg_init_ns(&init_ipc_ns); @@ -189,7 +192,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> } --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c -@@ -333,6 +333,9 @@ void register_irq_proc(unsigned int irq, +@@ -319,6 +319,9 @@ void register_irq_proc(unsigned int irq, void __maybe_unused *irqp = (void *)(unsigned long) irq; char name [MAX_NAMELEN]; @@ -199,7 +202,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip)) return; -@@ -386,6 +389,9 @@ void unregister_irq_proc(unsigned int ir +@@ -372,6 +375,9 @@ void unregister_irq_proc(unsigned int ir { char name [MAX_NAMELEN]; @@ -209,7 +212,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> if (!root_irq_dir || !desc->dir) return; #ifdef CONFIG_SMP -@@ -424,6 +430,9 @@ void init_irq_proc(void) +@@ -410,6 +416,9 @@ void init_irq_proc(void) unsigned int irq; struct irq_desc *desc; @@ -221,7 +224,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> if (!root_irq_dir) --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c -@@ -375,6 +375,8 @@ static int __init init_timer_list_procfs +@@ -370,6 +370,8 @@ static int __init init_timer_list_procfs { struct proc_dir_entry *pe; @@ -232,7 +235,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> if (!pe) --- a/mm/vmalloc.c +++ b/mm/vmalloc.c -@@ -2749,6 +2749,8 @@ static const struct seq_operations vmall +@@ -3549,6 +3549,8 @@ static const struct seq_operations vmall static int __init proc_vmalloc_init(void) { @@ -243,7 +246,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> &vmalloc_op, --- a/mm/vmstat.c +++ b/mm/vmstat.c -@@ -1972,10 +1972,12 @@ void __init init_mm_internals(void) +@@ -1988,10 +1988,12 @@ void __init init_mm_internals(void) start_shepherd_timer(); #endif #ifdef CONFIG_PROC_FS @@ -261,7 +264,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/net/8021q/vlanproc.c +++ b/net/8021q/vlanproc.c -@@ -96,6 +96,9 @@ void vlan_proc_cleanup(struct net *net) +@@ -93,6 +93,9 @@ void vlan_proc_cleanup(struct net *net) { struct vlan_net *vn = net_generic(net, vlan_net_id); @@ -271,7 +274,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> if (vn->proc_vlan_conf) remove_proc_entry(name_conf, vn->proc_vlan_dir); -@@ -115,6 +118,9 @@ int __net_init vlan_proc_init(struct net +@@ -112,6 +115,9 @@ int __net_init vlan_proc_init(struct net { struct vlan_net *vn = net_generic(net, vlan_net_id); @@ -327,7 +330,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/net/core/sock.c +++ b/net/core/sock.c -@@ -3486,6 +3486,8 @@ static __net_initdata struct pernet_oper +@@ -3603,6 +3603,8 @@ static __net_initdata struct pernet_oper static int __init proto_init(void) { @@ -338,7 +341,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c -@@ -2717,11 +2717,13 @@ static const struct seq_operations fib_r +@@ -2844,11 +2844,13 @@ static const struct seq_operations fib_r int __net_init fib_proc_init(struct net *net) { @@ -354,7 +357,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> fib_triestat_seq_show, NULL)) goto out2; -@@ -2732,17 +2734,21 @@ int __net_init fib_proc_init(struct net +@@ -2859,17 +2861,21 @@ int __net_init fib_proc_init(struct net return 0; out3: @@ -382,7 +385,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c -@@ -524,5 +524,8 @@ static __net_initdata struct pernet_oper +@@ -522,5 +522,8 @@ static __net_initdata struct pernet_oper int __init ip_misc_proc_init(void) { @@ -393,7 +396,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> } --- a/net/ipv4/route.c +++ b/net/ipv4/route.c -@@ -411,6 +411,9 @@ static struct pernet_operations ip_rt_pr +@@ -408,6 +408,9 @@ static struct pernet_operations ip_rt_pr static int __init ip_rt_proc_init(void) { diff --git a/target/linux/generic/hack-5.4/904-debloat_dma_buf.patch b/target/linux/generic/hack-5.4/904-debloat_dma_buf.patch index 3cbafc701e..a9a250fe40 100644 --- a/target/linux/generic/hack-5.4/904-debloat_dma_buf.patch +++ b/target/linux/generic/hack-5.4/904-debloat_dma_buf.patch @@ -13,48 +13,48 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig -@@ -172,7 +172,7 @@ config SOC_BUS +@@ -179,7 +179,7 @@ config SOC_BUS source "drivers/base/regmap/Kconfig" config DMA_SHARED_BUFFER - bool + tristate default n - select ANON_INODES select IRQ_WORK + help --- a/drivers/dma-buf/Makefile +++ b/drivers/dma-buf/Makefile -@@ -1,3 +1,7 @@ --obj-y := dma-buf.o dma-fence.o dma-fence-array.o reservation.o seqno-fence.o +@@ -1,9 +1,13 @@ + # SPDX-License-Identifier: GPL-2.0-only +-obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \ +- dma-resv.o seqno-fence.o -obj-$(CONFIG_SYNC_FILE) += sync_file.o -obj-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o +-obj-$(CONFIG_UDMABUF) += udmabuf.o +obj-$(CONFIG_DMA_SHARED_BUFFER) := dma-shared-buffer.o + -+dma-buf-objs-y := dma-buf.o dma-fence.o dma-fence-array.o reservation.o seqno-fence.o -+dma-buf-objs-$(CONFIG_SYNC_FILE) += sync_file.o ++dma-buf-objs-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \ ++ dma-resv.o seqno-fence.o ++dma-buf-objs-$(CONFIG_SYNC_FILE) += sync_file.o +dma-buf-objs-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o ++dma-buf-objs-$(CONFIG_UDMABUF) += udmabuf.o + +dma-shared-buffer-objs := $(dma-buf-objs-y) + + dmabuf_selftests-y := \ + selftest.o \ --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c -@@ -34,6 +34,7 @@ - #include <linux/poll.h> - #include <linux/reservation.h> - #include <linux/mm.h> -+#include <linux/module.h> - - #include <uapi/linux/dma-buf.h> - -@@ -1159,4 +1160,5 @@ static void __exit dma_buf_deinit(void) - { +@@ -1297,4 +1297,5 @@ static void __exit dma_buf_deinit(void) dma_buf_uninit_debugfs(); + kern_unmount(dma_buf_mnt); } -__exitcall(dma_buf_deinit); +module_exit(dma_buf_deinit); +MODULE_LICENSE("GPL"); --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -2129,6 +2129,7 @@ int wake_up_state(struct task_struct *p, +@@ -2673,6 +2673,7 @@ int wake_up_state(struct task_struct *p, { return try_to_wake_up(p, state, 0); } @@ -62,3 +62,13 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /* * Perform scheduler related setup for a newly forked process p. +--- a/fs/d_path.c ++++ b/fs/d_path.c +@@ -307,6 +307,7 @@ char *dynamic_dname(struct dentry *dentr + buffer += buflen - sz; + return memcpy(buffer, temp, sz); + } ++EXPORT_SYMBOL_GPL(dynamic_dname); + + char *simple_dname(struct dentry *dentry, char *buffer, int buflen) + { diff --git a/target/linux/generic/hack-5.4/911-kobject_add_broadcast_uevent.patch b/target/linux/generic/hack-5.4/911-kobject_add_broadcast_uevent.patch index 06b94117c1..52453e5ce3 100644 --- a/target/linux/generic/hack-5.4/911-kobject_add_broadcast_uevent.patch +++ b/target/linux/generic/hack-5.4/911-kobject_add_broadcast_uevent.patch @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> #ifdef CONFIG_UEVENT_HELPER /* path to the userspace helper executed on an event */ extern char uevent_helper[]; -@@ -244,4 +246,7 @@ int kobject_synth_uevent(struct kobject +@@ -245,4 +247,7 @@ int kobject_synth_uevent(struct kobject __printf(2, 3) int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...); @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> #endif /* _KOBJECT_H_ */ --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c -@@ -688,6 +688,43 @@ int add_uevent_var(struct kobj_uevent_en +@@ -690,6 +690,43 @@ int add_uevent_var(struct kobj_uevent_en EXPORT_SYMBOL_GPL(add_uevent_var); #if defined(CONFIG_NET) diff --git a/target/linux/generic/hack-5.4/930-crashlog.patch b/target/linux/generic/hack-5.4/930-crashlog.patch deleted file mode 100644 index bb16f22915..0000000000 --- a/target/linux/generic/hack-5.4/930-crashlog.patch +++ /dev/null @@ -1,338 +0,0 @@ -From 6b1ab74a9917012d0c559edc4ed299d9228ac89f Mon Sep 17 00:00:00 2001 -From: Felix Fietkau <nbd@nbd.name> -Date: Sat, 8 Jul 2017 08:26:47 +0200 -Subject: kernel: add the new 'crashlog' feature - -this tries to store kernel oops/panic logs in a fixed location in RAM to -recover them available to user space using debugfs - -Signed-off-by: Felix Fietkau <nbd@nbd.name> ---- - include/linux/crashlog.h | 17 ++++ - init/Kconfig | 4 + - kernel/Makefile | 1 + - kernel/crashlog.c | 213 +++++++++++++++++++++++++++++++++++++++++++++++ - kernel/module.c | 3 + - mm/bootmem.c | 2 + - mm/memblock.c | 5 ++ - 7 files changed, 245 insertions(+) - create mode 100644 include/linux/crashlog.h - create mode 100644 kernel/crashlog.c - ---- /dev/null -+++ b/include/linux/crashlog.h -@@ -0,0 +1,17 @@ -+#ifndef __CRASHLOG_H -+#define __CRASHLOG_H -+ -+#ifdef CONFIG_CRASHLOG -+void crashlog_init_bootmem(struct bootmem_data *bdata); -+void crashlog_init_memblock(phys_addr_t addr, phys_addr_t size); -+#else -+static inline void crashlog_init_bootmem(struct bootmem_data *bdata) -+{ -+} -+ -+static inline void crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) -+{ -+} -+#endif -+ -+#endif ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1049,6 +1049,10 @@ config RELAY - - If unsure, say N. - -+config CRASHLOG -+ bool "Crash logging" -+ depends on (!NO_BOOTMEM || HAVE_MEMBLOCK) -+ - config BLK_DEV_INITRD - bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" - help ---- a/kernel/Makefile -+++ b/kernel/Makefile -@@ -114,6 +114,7 @@ obj-$(CONFIG_TORTURE_TEST) += torture.o - obj-$(CONFIG_HAS_IOMEM) += iomem.o - obj-$(CONFIG_ZONE_DEVICE) += memremap.o - obj-$(CONFIG_RSEQ) += rseq.o -+obj-$(CONFIG_CRASHLOG) += crashlog.o - - $(obj)/configs.o: $(obj)/config_data.h - ---- /dev/null -+++ b/kernel/crashlog.c -@@ -0,0 +1,213 @@ -+/* -+ * Crash information logger -+ * Copyright (C) 2010 Felix Fietkau <nbd@nbd.name> -+ * -+ * Based on ramoops.c -+ * Copyright (C) 2010 Marco Stornelli <marco.stornelli@gmail.com> -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -+ * 02110-1301 USA -+ * -+ */ -+ -+#include <linux/module.h> -+#include <linux/bootmem.h> -+#include <linux/memblock.h> -+#include <linux/debugfs.h> -+#include <linux/crashlog.h> -+#include <linux/kmsg_dump.h> -+#include <linux/module.h> -+#include <linux/pfn.h> -+#include <linux/vmalloc.h> -+#include <asm/io.h> -+ -+#define CRASHLOG_PAGES 4 -+#define CRASHLOG_SIZE (CRASHLOG_PAGES * PAGE_SIZE) -+#define CRASHLOG_MAGIC 0xa1eedead -+ -+/* -+ * Start the log at 1M before the end of RAM, as some boot loaders like -+ * to use the end of the RAM for stack usage and other things -+ * If this fails, fall back to using the last part. -+ */ -+#define CRASHLOG_OFFSET (1024 * 1024) -+ -+struct crashlog_data { -+ u32 magic; -+ u32 len; -+ u8 data[]; -+}; -+ -+static struct debugfs_blob_wrapper crashlog_blob; -+static unsigned long crashlog_addr = 0; -+static struct crashlog_data *crashlog_buf; -+static struct kmsg_dumper dump; -+static bool first = true; -+ -+extern struct list_head *crashlog_modules; -+ -+static bool crashlog_set_addr(phys_addr_t addr, phys_addr_t size) -+{ -+ /* Limit to lower 64 MB to avoid highmem */ -+ phys_addr_t limit = 64 * 1024 * 1024; -+ -+ if (crashlog_addr) -+ return false; -+ -+ if (addr > limit) -+ return false; -+ -+ if (addr + size > limit) -+ size = limit - addr; -+ -+ crashlog_addr = addr; -+ -+ if (addr + size > CRASHLOG_OFFSET) -+ crashlog_addr += size - CRASHLOG_OFFSET; -+ -+ return true; -+} -+ -+#ifndef CONFIG_NO_BOOTMEM -+void __init crashlog_init_bootmem(bootmem_data_t *bdata) -+{ -+ phys_addr_t start, end; -+ -+ start = PFN_PHYS(bdata->node_low_pfn); -+ end = PFN_PHYS(bdata->node_min_pfn); -+ if (!crashlog_set_addr(start, end - start)) -+ return; -+ -+ if (reserve_bootmem(crashlog_addr, CRASHLOG_SIZE, BOOTMEM_EXCLUSIVE) < 0) { -+ printk("Crashlog failed to allocate RAM at address 0x%lx\n", -+ crashlog_addr); -+ crashlog_addr = 0; -+ } -+} -+#endif -+ -+#ifdef CONFIG_HAVE_MEMBLOCK -+void __init_memblock crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) -+{ -+ if (!crashlog_set_addr(addr, size)) -+ return; -+ -+ if (memblock_reserve(crashlog_addr, CRASHLOG_SIZE)) { -+ printk("Crashlog failed to allocate RAM at address 0x%lx\n", -+ crashlog_addr); -+ crashlog_addr = 0; -+ } -+} -+#endif -+ -+static void __init crashlog_copy(void) -+{ -+ if (crashlog_buf->magic != CRASHLOG_MAGIC) -+ return; -+ -+ if (!crashlog_buf->len || crashlog_buf->len > -+ CRASHLOG_SIZE - sizeof(*crashlog_buf)) -+ return; -+ -+ crashlog_blob.size = crashlog_buf->len; -+ crashlog_blob.data = kmemdup(crashlog_buf->data, -+ crashlog_buf->len, GFP_KERNEL); -+ -+ debugfs_create_blob("crashlog", 0700, NULL, &crashlog_blob); -+} -+ -+static int get_maxlen(void) -+{ -+ return CRASHLOG_SIZE - sizeof(*crashlog_buf) - crashlog_buf->len; -+} -+ -+static void crashlog_printf(const char *fmt, ...) -+{ -+ va_list args; -+ int len = get_maxlen(); -+ -+ if (!len) -+ return; -+ -+ va_start(args, fmt); -+ crashlog_buf->len += vscnprintf( -+ &crashlog_buf->data[crashlog_buf->len], -+ len, fmt, args); -+ va_end(args); -+} -+ -+static void crashlog_do_dump(struct kmsg_dumper *dumper, -+ enum kmsg_dump_reason reason) -+{ -+ struct timeval tv; -+ struct module *m; -+ char *buf; -+ size_t len; -+ -+ if (!first) -+ crashlog_printf("\n===================================\n"); -+ -+ do_gettimeofday(&tv); -+ crashlog_printf("Time: %lu.%lu\n", -+ (long)tv.tv_sec, (long)tv.tv_usec); -+ -+ if (first) { -+ crashlog_printf("Modules:"); -+ list_for_each_entry(m, crashlog_modules, list) { -+ crashlog_printf("\t%s@%p+%x", m->name, -+ m->core_layout.base, m->core_layout.size, -+ m->init_layout.base, m->init_layout.size); -+ } -+ crashlog_printf("\n"); -+ first = false; -+ } -+ -+ buf = (char *)&crashlog_buf->data[crashlog_buf->len]; -+ -+ kmsg_dump_get_buffer(dumper, true, buf, get_maxlen(), &len); -+ -+ crashlog_buf->len += len; -+} -+ -+ -+int __init crashlog_init_fs(void) -+{ -+ struct page *pages[CRASHLOG_PAGES]; -+ pgprot_t prot; -+ int i; -+ -+ if (!crashlog_addr) { -+ printk("No memory allocated for crashlog\n"); -+ return -ENOMEM; -+ } -+ -+ printk("Crashlog allocated RAM at address 0x%lx\n", (unsigned long) crashlog_addr); -+ for (i = 0; i < CRASHLOG_PAGES; i++) -+ pages[i] = pfn_to_page((crashlog_addr >> PAGE_SHIFT) + i); -+ -+ prot = pgprot_writecombine(PAGE_KERNEL); -+ crashlog_buf = vmap(pages, CRASHLOG_PAGES, VM_MAP, prot); -+ -+ crashlog_copy(); -+ -+ crashlog_buf->magic = CRASHLOG_MAGIC; -+ crashlog_buf->len = 0; -+ -+ dump.max_reason = KMSG_DUMP_OOPS; -+ dump.dump = crashlog_do_dump; -+ kmsg_dump_register(&dump); -+ -+ return 0; -+} -+module_init(crashlog_init_fs); ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -251,6 +251,9 @@ static void mod_update_bounds(struct mod - #ifdef CONFIG_KGDB_KDB - struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */ - #endif /* CONFIG_KGDB_KDB */ -+#ifdef CONFIG_CRASHLOG -+struct list_head *crashlog_modules = &modules; -+#endif - - static void module_assert_mutex(void) - { ---- a/mm/bootmem.c -+++ b/mm/bootmem.c -@@ -15,6 +15,7 @@ - #include <linux/export.h> - #include <linux/kmemleak.h> - #include <linux/range.h> -+#include <linux/crashlog.h> - #include <linux/bug.h> - #include <linux/io.h> - #include <linux/bootmem.h> -@@ -215,6 +216,7 @@ static unsigned long __init free_all_boo - if (!bdata->node_bootmem_map) - return 0; - -+ crashlog_init_bootmem(bdata); - map = bdata->node_bootmem_map; - start = bdata->node_min_pfn; - end = bdata->node_low_pfn; ---- a/mm/memblock.c -+++ b/mm/memblock.c -@@ -21,6 +21,7 @@ - #include <linux/seq_file.h> - #include <linux/memblock.h> - #include <linux/bootmem.h> -+#include <linux/crashlog.h> - - #include <asm/sections.h> - #include <linux/io.h> -@@ -547,6 +548,8 @@ static void __init_memblock memblock_ins - memblock_set_region_node(rgn, nid); - type->cnt++; - type->total_size += size; -+ if (type == &memblock.memory) -+ crashlog_init_memblock(base, size); - } - - /** -@@ -586,6 +589,8 @@ int __init_memblock memblock_add_range(s - type->regions[0].flags = flags; - memblock_set_region_node(&type->regions[0], nid); - type->total_size = size; -+ if (type == &memblock.memory) -+ crashlog_init_memblock(base, size); - return 0; - } - repeat: |