sdei.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // SPDX-License-Identifier: GPL-2.0
  2. // Copyright (C) 2017 Arm Ltd.
  3. #ifndef __ASM_SDEI_H
  4. #define __ASM_SDEI_H
  5. /* Values for sdei_exit_mode */
  6. #define SDEI_EXIT_HVC 0
  7. #define SDEI_EXIT_SMC 1
  8. #define SDEI_STACK_SIZE IRQ_STACK_SIZE
  9. #ifndef __ASSEMBLY__
  10. #include <linux/linkage.h>
  11. #include <linux/preempt.h>
  12. #include <linux/types.h>
  13. #include <asm/virt.h>
  14. extern unsigned long sdei_exit_mode;
  15. /* Software Delegated Exception entry point from firmware*/
  16. asmlinkage void __sdei_asm_handler(unsigned long event_num, unsigned long arg,
  17. unsigned long pc, unsigned long pstate);
  18. /* and its CONFIG_UNMAP_KERNEL_AT_EL0 trampoline */
  19. asmlinkage void __sdei_asm_entry_trampoline(unsigned long event_num,
  20. unsigned long arg,
  21. unsigned long pc,
  22. unsigned long pstate);
  23. /*
  24. * The above entry point does the minimum to call C code. This function does
  25. * anything else, before calling the driver.
  26. */
  27. struct sdei_registered_event;
  28. asmlinkage unsigned long __sdei_handler(struct pt_regs *regs,
  29. struct sdei_registered_event *arg);
  30. unsigned long sdei_arch_get_entry_point(int conduit);
  31. #define sdei_arch_get_entry_point(x) sdei_arch_get_entry_point(x)
  32. struct stack_info;
  33. bool _on_sdei_stack(unsigned long sp, struct stack_info *info);
  34. static inline bool on_sdei_stack(unsigned long sp,
  35. struct stack_info *info)
  36. {
  37. if (!IS_ENABLED(CONFIG_VMAP_STACK))
  38. return false;
  39. if (!IS_ENABLED(CONFIG_ARM_SDE_INTERFACE))
  40. return false;
  41. if (in_nmi())
  42. return _on_sdei_stack(sp, info);
  43. return false;
  44. }
  45. #endif /* __ASSEMBLY__ */
  46. #endif /* __ASM_SDEI_H */