1 /* SPDX-License-Identifier: GPL-2.0 */ 2 // Copyright (C) 2017 Arm Ltd. 3 #ifndef __ASM_VMAP_STACK_H 4 #define __ASM_VMAP_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/memory.h> 12 #include <asm/thread_info.h> 13 14 /* 15 * To ensure that VMAP'd stack overflow detection works correctly, all VMAP'd 16 * stacks need to have the same alignment. 17 */ 18 static inline unsigned long *arch_alloc_vmap_stack(size_t stack_size, int node) 19 { 20 BUILD_BUG_ON(!IS_ENABLED(CONFIG_VMAP_STACK)); 21 22 return __vmalloc_node(stack_size, THREAD_ALIGN, THREADINFO_GFP, node, 23 __builtin_return_address(0)); 24 } 25 26 #endif /* __ASM_VMAP_STACK_H */ 27