irq_stack.h 843 B

123456789101112131415161718192021222324252627282930313233
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_RISCV_IRQ_STACK_H
  3. #define _ASM_RISCV_IRQ_STACK_H
  4. #include <linux/bug.h>
  5. #include <linux/gfp.h>
  6. #include <linux/kconfig.h>
  7. #include <linux/vmalloc.h>
  8. #include <linux/pgtable.h>
  9. #include <asm/thread_info.h>
  10. DECLARE_PER_CPU(ulong *, irq_stack_ptr);
  11. asmlinkage void call_on_irq_stack(struct pt_regs *regs,
  12. void (*func)(struct pt_regs *));
  13. #ifdef CONFIG_VMAP_STACK
  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. void *p;
  21. p = __vmalloc_node(stack_size, THREAD_ALIGN, THREADINFO_GFP, node,
  22. __builtin_return_address(0));
  23. return kasan_reset_tag(p);
  24. }
  25. #endif /* CONFIG_VMAP_STACK */
  26. #endif /* _ASM_RISCV_IRQ_STACK_H */