--- /dev/null
+From 9364a7e40d54e6858479f0a96e1a04aa1204be16 Mon Sep 17 00:00:00 2001
+From: Wei Yang <richard.weiyang@gmail.com>
+Date: Mon, 24 Jun 2024 01:54:32 +0000
+Subject: memblock tests: fix implicit declaration of function 'numa_valid_node'
+
+From: Wei Yang <richard.weiyang@gmail.com>
+
+commit 9364a7e40d54e6858479f0a96e1a04aa1204be16 upstream.
+
+commit 8043832e2a12 ("memblock: use numa_valid_node() helper to check
+for invalid node ID") introduce a new helper numa_valid_node(), which is
+not defined in memblock tests.
+
+Let's add it in the corresponding header file.
+
+Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
+CC: Mike Rapoport (IBM) <rppt@kernel.org>
+Link: https://lore.kernel.org/r/20240624015432.31134-1-richard.weiyang@gmail.com
+Signed-off-by: Mike Rapoport <rppt@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/include/linux/numa.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/tools/include/linux/numa.h
++++ b/tools/include/linux/numa.h
+@@ -13,4 +13,9 @@
+
+ #define NUMA_NO_NODE (-1)
+
++static inline bool numa_valid_node(int nid)
++{
++ return nid >= 0 && nid < MAX_NUMNODES;
++}
++
+ #endif /* _LINUX_NUMA_H */
--- /dev/null
+From 6ca445d8af0ed5950ebf899415fd6bfcd7d9d7a3 Mon Sep 17 00:00:00 2001
+From: Alexandre Ghiti <alexghiti@rivosinc.com>
+Date: Thu, 23 May 2024 13:51:34 +0200
+Subject: riscv: Fix early ftrace nop patching
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Alexandre Ghiti <alexghiti@rivosinc.com>
+
+commit 6ca445d8af0ed5950ebf899415fd6bfcd7d9d7a3 upstream.
+
+Commit c97bf629963e ("riscv: Fix text patching when IPI are used")
+converted ftrace_make_nop() to use patch_insn_write() which does not
+emit any icache flush relying entirely on __ftrace_modify_code() to do
+that.
+
+But we missed that ftrace_make_nop() was called very early directly when
+converting mcount calls into nops (actually on riscv it converts 2B nops
+emitted by the compiler into 4B nops).
+
+This caused crashes on multiple HW as reported by Conor and Björn since
+the booting core could have half-patched instructions in its icache
+which would trigger an illegal instruction trap: fix this by emitting a
+local flush icache when early patching nops.
+
+Fixes: c97bf629963e ("riscv: Fix text patching when IPI are used")
+Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
+Reported-by: Conor Dooley <conor.dooley@microchip.com>
+Tested-by: Conor Dooley <conor.dooley@microchip.com>
+Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
+Tested-by: Björn Töpel <bjorn@rivosinc.com>
+Link: https://lore.kernel.org/r/20240523115134.70380-1-alexghiti@rivosinc.com
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/riscv/include/asm/cacheflush.h | 6 ++++++
+ arch/riscv/kernel/ftrace.c | 3 +++
+ 2 files changed, 9 insertions(+)
+
+--- a/arch/riscv/include/asm/cacheflush.h
++++ b/arch/riscv/include/asm/cacheflush.h
+@@ -13,6 +13,12 @@ static inline void local_flush_icache_al
+ asm volatile ("fence.i" ::: "memory");
+ }
+
++static inline void local_flush_icache_range(unsigned long start,
++ unsigned long end)
++{
++ local_flush_icache_all();
++}
++
+ #define PG_dcache_clean PG_arch_1
+
+ static inline void flush_dcache_folio(struct folio *folio)
+--- a/arch/riscv/kernel/ftrace.c
++++ b/arch/riscv/kernel/ftrace.c
+@@ -120,6 +120,9 @@ int ftrace_init_nop(struct module *mod,
+ out = ftrace_make_nop(mod, rec, MCOUNT_ADDR);
+ mutex_unlock(&text_mutex);
+
++ if (!mod)
++ local_flush_icache_range(rec->ip, rec->ip + MCOUNT_INSN_SIZE);
++
+ return out;
+ }
+
bluetooth-mgmt-fix-add-device-to-responding-before-c.patch
bluetooth-btnxpuart-fix-driver-sending-truncated-dat.patch
tcp-annotate-data-race-around-sk-sk_mark-in-tcp_v4_s.patch
+riscv-fix-early-ftrace-nop-patching.patch
+memblock-tests-fix-implicit-declaration-of-function-numa_valid_node.patch
+x86-mm-numa-use-numa_no_node-when-calling-memblock_set_node.patch
netfilter-nf_tables-imbalance-in-flowtable-binding.patch
netfilter-conntrack-clamp-maximum-hashtable-size-to-.patch
sched-sch_cake-add-bounds-checks-to-host-bulk-flow-f.patch
--- /dev/null
+From 3ac36aa7307363b7247ccb6f6a804e11496b2b36 Mon Sep 17 00:00:00 2001
+From: Jan Beulich <jbeulich@suse.com>
+Date: Wed, 29 May 2024 09:42:05 +0200
+Subject: x86/mm/numa: Use NUMA_NO_NODE when calling memblock_set_node()
+
+From: Jan Beulich <jbeulich@suse.com>
+
+commit 3ac36aa7307363b7247ccb6f6a804e11496b2b36 upstream.
+
+memblock_set_node() warns about using MAX_NUMNODES, see
+
+ e0eec24e2e19 ("memblock: make memblock_set_node() also warn about use of MAX_NUMNODES")
+
+for details.
+
+Reported-by: Narasimhan V <Narasimhan.V@amd.com>
+Signed-off-by: Jan Beulich <jbeulich@suse.com>
+Cc: stable@vger.kernel.org
+[bp: commit message]
+Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
+Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
+Tested-by: Paul E. McKenney <paulmck@kernel.org>
+Link: https://lore.kernel.org/r/20240603141005.23261-1-bp@kernel.org
+Link: https://lore.kernel.org/r/abadb736-a239-49e4-ab42-ace7acdd4278@suse.com
+Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/mm/numa.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/mm/numa.c
++++ b/arch/x86/mm/numa.c
+@@ -492,7 +492,7 @@ static void __init numa_clear_kernel_nod
+ for_each_reserved_mem_region(mb_region) {
+ int nid = memblock_get_region_node(mb_region);
+
+- if (nid != MAX_NUMNODES)
++ if (nid != NUMA_NO_NODE)
+ node_set(nid, reserved_nodemask);
+ }
+
+@@ -613,9 +613,9 @@ static int __init numa_init(int (*init_f
+ nodes_clear(node_online_map);
+ memset(&numa_meminfo, 0, sizeof(numa_meminfo));
+ WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.memory,
+- MAX_NUMNODES));
++ NUMA_NO_NODE));
+ WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.reserved,
+- MAX_NUMNODES));
++ NUMA_NO_NODE));
+ /* In case that parsing SRAT failed. */
+ WARN_ON(memblock_clear_hotplug(0, ULLONG_MAX));
+ numa_reset_distance();