xref: /linux/arch/riscv/include/asm/irq_stack.h (revision b30d7a77c53ec04a6d94683d7680ec406b7f3ac8)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #ifndef _ASM_RISCV_IRQ_STACK_H
4 #define _ASM_RISCV_IRQ_STACK_H
5 
6 #include <linux/bug.h>
7 #include <linux/gfp.h>
8 #include <linux/kconfig.h>
9 #include <linux/vmalloc.h>
10 #include <linux/pgtable.h>
11 #include <asm/thread_info.h>
12 
13 DECLARE_PER_CPU(ulong *, irq_stack_ptr);
14 
15 #ifdef CONFIG_VMAP_STACK
16 /*
17  * To ensure that VMAP'd stack overflow detection works correctly, all VMAP'd
18  * stacks need to have the same alignment.
19  */
20 static inline unsigned long *arch_alloc_vmap_stack(size_t stack_size, int node)
21 {
22 	void *p;
23 
24 	p = __vmalloc_node(stack_size, THREAD_ALIGN, THREADINFO_GFP, node,
25 			__builtin_return_address(0));
26 	return kasan_reset_tag(p);
27 }
28 #endif /* CONFIG_VMAP_STACK */
29 
30 #endif /* _ASM_RISCV_IRQ_STACK_H */
31