From: Sasha Levin Date: Wed, 13 Mar 2024 15:32:11 +0000 (-0400) Subject: Drop riscv-add-caller_addrx-support.patch X-Git-Tag: v6.8.1~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3f0396518fb89dcd18e541dbe86eb46e1fd207e3;p=thirdparty%2Fkernel%2Fstable-queue.git Drop riscv-add-caller_addrx-support.patch Signed-off-by: Sasha Levin --- diff --git a/queue-5.10/riscv-add-caller_addrx-support.patch b/queue-5.10/riscv-add-caller_addrx-support.patch deleted file mode 100644 index 4c69b0ef412..00000000000 --- a/queue-5.10/riscv-add-caller_addrx-support.patch +++ /dev/null @@ -1,132 +0,0 @@ -From f5465f1470025599c350ab48c5f7ed3406d05f94 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 2 Feb 2024 01:51:02 +0000 -Subject: riscv: add CALLER_ADDRx support - -From: Zong Li - -[ Upstream commit 680341382da56bd192ebfa4e58eaf4fec2e5bca7 ] - -CALLER_ADDRx returns caller's address at specified level, they are used -for several tracers. These macros eventually use -__builtin_return_address(n) to get the caller's address if arch doesn't -define their own implementation. - -In RISC-V, __builtin_return_address(n) only works when n == 0, we need -to walk the stack frame to get the caller's address at specified level. - -data.level started from 'level + 3' due to the call flow of getting -caller's address in RISC-V implementation. If we don't have additional -three iteration, the level is corresponding to follows: - -callsite -> return_address -> arch_stack_walk -> walk_stackframe -| | | | -level 3 level 2 level 1 level 0 - -Fixes: 10626c32e382 ("riscv/ftrace: Add basic support") -Cc: stable@vger.kernel.org -Reviewed-by: Alexandre Ghiti -Signed-off-by: Zong Li -Link: https://lore.kernel.org/r/20240202015102.26251-1-zong.li@sifive.com -Signed-off-by: Palmer Dabbelt -Signed-off-by: Sasha Levin ---- - arch/riscv/include/asm/ftrace.h | 5 ++++ - arch/riscv/kernel/Makefile | 2 ++ - arch/riscv/kernel/return_address.c | 48 ++++++++++++++++++++++++++++++ - 3 files changed, 55 insertions(+) - create mode 100644 arch/riscv/kernel/return_address.c - -diff --git a/arch/riscv/include/asm/ftrace.h b/arch/riscv/include/asm/ftrace.h -index bc745900c1631..135517e440105 100644 ---- a/arch/riscv/include/asm/ftrace.h -+++ b/arch/riscv/include/asm/ftrace.h -@@ -25,6 +25,11 @@ - - #define ARCH_SUPPORTS_FTRACE_OPS 1 - #ifndef __ASSEMBLY__ -+ -+extern void *return_address(unsigned int level); -+ -+#define ftrace_return_address(n) return_address(n) -+ - void MCOUNT_NAME(void); - static inline unsigned long ftrace_call_adjust(unsigned long addr) - { -diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile -index bc49d5f2302b6..335465792d933 100644 ---- a/arch/riscv/kernel/Makefile -+++ b/arch/riscv/kernel/Makefile -@@ -7,6 +7,7 @@ ifdef CONFIG_FTRACE - CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE) - CFLAGS_REMOVE_patch.o = $(CC_FLAGS_FTRACE) - CFLAGS_REMOVE_sbi.o = $(CC_FLAGS_FTRACE) -+CFLAGS_REMOVE_return_address.o = $(CC_FLAGS_FTRACE) - endif - - extra-y += head.o -@@ -20,6 +21,7 @@ obj-y += irq.o - obj-y += process.o - obj-y += ptrace.o - obj-y += reset.o -+obj-y += return_address.o - obj-y += setup.o - obj-y += signal.o - obj-y += syscall_table.o -diff --git a/arch/riscv/kernel/return_address.c b/arch/riscv/kernel/return_address.c -new file mode 100644 -index 0000000000000..c8115ec8fb304 ---- /dev/null -+++ b/arch/riscv/kernel/return_address.c -@@ -0,0 +1,48 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+/* -+ * This code come from arch/arm64/kernel/return_address.c -+ * -+ * Copyright (C) 2023 SiFive. -+ */ -+ -+#include -+#include -+#include -+ -+struct return_address_data { -+ unsigned int level; -+ void *addr; -+}; -+ -+static bool save_return_addr(void *d, unsigned long pc) -+{ -+ struct return_address_data *data = d; -+ -+ if (!data->level) { -+ data->addr = (void *)pc; -+ return false; -+ } -+ -+ --data->level; -+ -+ return true; -+} -+NOKPROBE_SYMBOL(save_return_addr); -+ -+noinline void *return_address(unsigned int level) -+{ -+ struct return_address_data data; -+ -+ data.level = level + 3; -+ data.addr = NULL; -+ -+ arch_stack_walk(save_return_addr, &data, current, NULL); -+ -+ if (!data.level) -+ return data.addr; -+ else -+ return NULL; -+ -+} -+EXPORT_SYMBOL_GPL(return_address); -+NOKPROBE_SYMBOL(return_address); --- -2.43.0 - diff --git a/queue-5.10/series b/queue-5.10/series index 3b125e409ec..b0baee683db 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -1,6 +1,5 @@ mmc-mmci-stm32-use-a-buffer-for-unaligned-dma-reques.patch mmc-mmci-stm32-fix-dma-api-overlapping-mappings-warn.patch -riscv-add-caller_addrx-support.patch lan78xx-fix-white-space-and-style-issues.patch lan78xx-add-missing-return-code-checks.patch lan78xx-fix-partial-packet-errors-on-suspend-resume.patch diff --git a/queue-5.15/riscv-add-caller_addrx-support.patch b/queue-5.15/riscv-add-caller_addrx-support.patch deleted file mode 100644 index 5b755d46ddd..00000000000 --- a/queue-5.15/riscv-add-caller_addrx-support.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 7044500c8a37958922db736c6378f71180dc4f7f Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 2 Feb 2024 01:51:02 +0000 -Subject: riscv: add CALLER_ADDRx support - -From: Zong Li - -[ Upstream commit 680341382da56bd192ebfa4e58eaf4fec2e5bca7 ] - -CALLER_ADDRx returns caller's address at specified level, they are used -for several tracers. These macros eventually use -__builtin_return_address(n) to get the caller's address if arch doesn't -define their own implementation. - -In RISC-V, __builtin_return_address(n) only works when n == 0, we need -to walk the stack frame to get the caller's address at specified level. - -data.level started from 'level + 3' due to the call flow of getting -caller's address in RISC-V implementation. If we don't have additional -three iteration, the level is corresponding to follows: - -callsite -> return_address -> arch_stack_walk -> walk_stackframe -| | | | -level 3 level 2 level 1 level 0 - -Fixes: 10626c32e382 ("riscv/ftrace: Add basic support") -Cc: stable@vger.kernel.org -Reviewed-by: Alexandre Ghiti -Signed-off-by: Zong Li -Link: https://lore.kernel.org/r/20240202015102.26251-1-zong.li@sifive.com -Signed-off-by: Palmer Dabbelt -Signed-off-by: Sasha Levin ---- - arch/riscv/include/asm/ftrace.h | 5 ++++ - arch/riscv/kernel/Makefile | 2 ++ - arch/riscv/kernel/return_address.c | 48 ++++++++++++++++++++++++++++++ - 3 files changed, 55 insertions(+) - create mode 100644 arch/riscv/kernel/return_address.c - -diff --git a/arch/riscv/include/asm/ftrace.h b/arch/riscv/include/asm/ftrace.h -index d47d87c2d7e3d..dcf1bc9de5841 100644 ---- a/arch/riscv/include/asm/ftrace.h -+++ b/arch/riscv/include/asm/ftrace.h -@@ -25,6 +25,11 @@ - - #define ARCH_SUPPORTS_FTRACE_OPS 1 - #ifndef __ASSEMBLY__ -+ -+extern void *return_address(unsigned int level); -+ -+#define ftrace_return_address(n) return_address(n) -+ - void MCOUNT_NAME(void); - static inline unsigned long ftrace_call_adjust(unsigned long addr) - { -diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile -index 16308ef1e5787..354e22b434204 100644 ---- a/arch/riscv/kernel/Makefile -+++ b/arch/riscv/kernel/Makefile -@@ -7,6 +7,7 @@ ifdef CONFIG_FTRACE - CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE) - CFLAGS_REMOVE_patch.o = $(CC_FLAGS_FTRACE) - CFLAGS_REMOVE_sbi.o = $(CC_FLAGS_FTRACE) -+CFLAGS_REMOVE_return_address.o = $(CC_FLAGS_FTRACE) - endif - CFLAGS_syscall_table.o += $(call cc-option,-Wno-override-init,) - -@@ -25,6 +26,7 @@ obj-y += irq.o - obj-y += process.o - obj-y += ptrace.o - obj-y += reset.o -+obj-y += return_address.o - obj-y += setup.o - obj-y += signal.o - obj-y += syscall_table.o -diff --git a/arch/riscv/kernel/return_address.c b/arch/riscv/kernel/return_address.c -new file mode 100644 -index 0000000000000..c8115ec8fb304 ---- /dev/null -+++ b/arch/riscv/kernel/return_address.c -@@ -0,0 +1,48 @@ -+// SPDX-License-Identifier: GPL-2.0-only -+/* -+ * This code come from arch/arm64/kernel/return_address.c -+ * -+ * Copyright (C) 2023 SiFive. -+ */ -+ -+#include -+#include -+#include -+ -+struct return_address_data { -+ unsigned int level; -+ void *addr; -+}; -+ -+static bool save_return_addr(void *d, unsigned long pc) -+{ -+ struct return_address_data *data = d; -+ -+ if (!data->level) { -+ data->addr = (void *)pc; -+ return false; -+ } -+ -+ --data->level; -+ -+ return true; -+} -+NOKPROBE_SYMBOL(save_return_addr); -+ -+noinline void *return_address(unsigned int level) -+{ -+ struct return_address_data data; -+ -+ data.level = level + 3; -+ data.addr = NULL; -+ -+ arch_stack_walk(save_return_addr, &data, current, NULL); -+ -+ if (!data.level) -+ return data.addr; -+ else -+ return NULL; -+ -+} -+EXPORT_SYMBOL_GPL(return_address); -+NOKPROBE_SYMBOL(return_address); --- -2.43.0 - diff --git a/queue-5.15/series b/queue-5.15/series index 34e1d23395e..3c246de83ce 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -1,6 +1,5 @@ mmc-mmci-stm32-use-a-buffer-for-unaligned-dma-reques.patch mmc-mmci-stm32-fix-dma-api-overlapping-mappings-warn.patch -riscv-add-caller_addrx-support.patch net-lan78xx-fix-runtime-pm-count-underflow-on-link-s.patch ixgbe-dis-en-able-irqs-in-ixgbe_txrx_ring_-dis-en-ab.patch i40e-disable-napi-right-after-disabling-irqs-when-ha.patch