Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 // Copyright (C) 2017 Arm Ltd.
0003 #ifndef __ASM_SDEI_H
0004 #define __ASM_SDEI_H
0005 
0006 /* Values for sdei_exit_mode */
0007 #define SDEI_EXIT_HVC  0
0008 #define SDEI_EXIT_SMC  1
0009 
0010 #define SDEI_STACK_SIZE     IRQ_STACK_SIZE
0011 
0012 #ifndef __ASSEMBLY__
0013 
0014 #include <linux/linkage.h>
0015 #include <linux/preempt.h>
0016 #include <linux/types.h>
0017 
0018 #include <asm/virt.h>
0019 
0020 extern unsigned long sdei_exit_mode;
0021 
0022 /* Software Delegated Exception entry point from firmware*/
0023 asmlinkage void __sdei_asm_handler(unsigned long event_num, unsigned long arg,
0024                    unsigned long pc, unsigned long pstate);
0025 
0026 /* and its CONFIG_UNMAP_KERNEL_AT_EL0 trampoline */
0027 asmlinkage void __sdei_asm_entry_trampoline(unsigned long event_num,
0028                            unsigned long arg,
0029                            unsigned long pc,
0030                            unsigned long pstate);
0031 
0032 /*
0033  * The above entry point does the minimum to call C code. This function does
0034  * anything else, before calling the driver.
0035  */
0036 struct sdei_registered_event;
0037 asmlinkage unsigned long __sdei_handler(struct pt_regs *regs,
0038                     struct sdei_registered_event *arg);
0039 
0040 unsigned long do_sdei_event(struct pt_regs *regs,
0041                 struct sdei_registered_event *arg);
0042 
0043 unsigned long sdei_arch_get_entry_point(int conduit);
0044 #define sdei_arch_get_entry_point(x)    sdei_arch_get_entry_point(x)
0045 
0046 struct stack_info;
0047 
0048 bool _on_sdei_stack(unsigned long sp, unsigned long size,
0049             struct stack_info *info);
0050 static inline bool on_sdei_stack(unsigned long sp, unsigned long size,
0051                 struct stack_info *info)
0052 {
0053     if (!IS_ENABLED(CONFIG_VMAP_STACK))
0054         return false;
0055     if (!IS_ENABLED(CONFIG_ARM_SDE_INTERFACE))
0056         return false;
0057     if (in_nmi())
0058         return _on_sdei_stack(sp, size, info);
0059 
0060     return false;
0061 }
0062 
0063 #endif /* __ASSEMBLY__ */
0064 #endif  /* __ASM_SDEI_H */