summaryrefslogtreecommitdiff
path: root/arch/riscv/include/asm/irq_stack.h
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@rivosinc.com>2023-06-22 20:38:39 +0300
committerPalmer Dabbelt <palmer@rivosinc.com>2023-06-23 20:06:21 +0300
commitb5e13f3ace78a8159dbad92bb005090a431e36d7 (patch)
treeecf5360b87b4aef89194904804670c12b5e5f56b /arch/riscv/include/asm/irq_stack.h
parent42b89447b65863904eaf802ee05b55a238eac538 (diff)
parenta7555f6b62e7f5b3a3b783cc6d4c4dafcb8527c8 (diff)
downloadlinux-b5e13f3ace78a8159dbad92bb005090a431e36d7.tar.xz
Merge patch series "riscv: Add independent irq/softirq stacks support"
guoren@kernel.org <guoren@kernel.org> says: From: Guo Ren <guoren@linux.alibaba.com> This patch series adds independent irq/softirq stacks to decrease the press of the thread stack. Also, add a thread STACK_SIZE config for users to adjust the proper size during compile time. * b4-shazam-merge: riscv: stack: Add config of thread stack size riscv: stack: Support HAVE_SOFTIRQ_ON_OWN_STACK riscv: stack: Support HAVE_IRQ_EXIT_ON_IRQ_STACK Link: https://lore.kernel.org/r/20230614013018.2168426-1-guoren@kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'arch/riscv/include/asm/irq_stack.h')
-rw-r--r--arch/riscv/include/asm/irq_stack.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/riscv/include/asm/irq_stack.h b/arch/riscv/include/asm/irq_stack.h
new file mode 100644
index 000000000000..e4042d297580
--- /dev/null
+++ b/arch/riscv/include/asm/irq_stack.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _ASM_RISCV_IRQ_STACK_H
+#define _ASM_RISCV_IRQ_STACK_H
+
+#include <linux/bug.h>
+#include <linux/gfp.h>
+#include <linux/kconfig.h>
+#include <linux/vmalloc.h>
+#include <linux/pgtable.h>
+#include <asm/thread_info.h>
+
+DECLARE_PER_CPU(ulong *, irq_stack_ptr);
+
+#ifdef CONFIG_VMAP_STACK
+/*
+ * To ensure that VMAP'd stack overflow detection works correctly, all VMAP'd
+ * stacks need to have the same alignment.
+ */
+static inline unsigned long *arch_alloc_vmap_stack(size_t stack_size, int node)
+{
+ void *p;
+
+ p = __vmalloc_node(stack_size, THREAD_ALIGN, THREADINFO_GFP, node,
+ __builtin_return_address(0));
+ return kasan_reset_tag(p);
+}
+#endif /* CONFIG_VMAP_STACK */
+
+#endif /* _ASM_RISCV_IRQ_STACK_H */