.. | .. |
---|
10 | 10 | #include <asm/ptrace.h> |
---|
11 | 11 | #include <asm/sysreg.h> |
---|
12 | 12 | |
---|
| 13 | +#define IRQMASK_I_BIT PSR_I_BIT |
---|
| 14 | +#define IRQMASK_I_POS 7 |
---|
| 15 | +#define IRQMASK_i_POS 31 |
---|
| 16 | + |
---|
13 | 17 | /* |
---|
14 | 18 | * Aarch64 has flags for masking: Debug, Asynchronous (serror), Interrupts and |
---|
15 | 19 | * FIQ exceptions, in the 'daif' register. We mask and unmask them in 'dai' |
---|
.. | .. |
---|
26 | 30 | /* |
---|
27 | 31 | * CPU interrupt mask handling. |
---|
28 | 32 | */ |
---|
29 | | -static inline void arch_local_irq_enable(void) |
---|
| 33 | +static inline void native_irq_enable(void) |
---|
30 | 34 | { |
---|
31 | 35 | if (system_has_prio_mask_debugging()) { |
---|
32 | 36 | u32 pmr = read_sysreg_s(SYS_ICC_PMR_EL1); |
---|
.. | .. |
---|
35 | 39 | } |
---|
36 | 40 | |
---|
37 | 41 | asm volatile(ALTERNATIVE( |
---|
38 | | - "msr daifclr, #2 // arch_local_irq_enable", |
---|
| 42 | + "msr daifclr, #2 // native_irq_enable", |
---|
39 | 43 | __msr_s(SYS_ICC_PMR_EL1, "%0"), |
---|
40 | 44 | ARM64_HAS_IRQ_PRIO_MASKING) |
---|
41 | 45 | : |
---|
.. | .. |
---|
45 | 49 | pmr_sync(); |
---|
46 | 50 | } |
---|
47 | 51 | |
---|
48 | | -static inline void arch_local_irq_disable(void) |
---|
| 52 | +static inline void native_irq_disable(void) |
---|
49 | 53 | { |
---|
50 | 54 | if (system_has_prio_mask_debugging()) { |
---|
51 | 55 | u32 pmr = read_sysreg_s(SYS_ICC_PMR_EL1); |
---|
.. | .. |
---|
54 | 58 | } |
---|
55 | 59 | |
---|
56 | 60 | asm volatile(ALTERNATIVE( |
---|
57 | | - "msr daifset, #2 // arch_local_irq_disable", |
---|
| 61 | + "msr daifset, #2 // native_irq_disable", |
---|
58 | 62 | __msr_s(SYS_ICC_PMR_EL1, "%0"), |
---|
59 | 63 | ARM64_HAS_IRQ_PRIO_MASKING) |
---|
60 | 64 | : |
---|
.. | .. |
---|
62 | 66 | : "memory"); |
---|
63 | 67 | } |
---|
64 | 68 | |
---|
| 69 | +static inline void native_irq_sync(void) |
---|
| 70 | +{ |
---|
| 71 | + native_irq_enable(); |
---|
| 72 | + isb(); |
---|
| 73 | + native_irq_disable(); |
---|
| 74 | +} |
---|
| 75 | + |
---|
65 | 76 | /* |
---|
66 | 77 | * Save the current interrupt enable state. |
---|
67 | 78 | */ |
---|
68 | | -static inline unsigned long arch_local_save_flags(void) |
---|
| 79 | +static inline unsigned long native_save_flags(void) |
---|
69 | 80 | { |
---|
70 | 81 | unsigned long flags; |
---|
71 | 82 | |
---|
.. | .. |
---|
80 | 91 | return flags; |
---|
81 | 92 | } |
---|
82 | 93 | |
---|
83 | | -static inline int arch_irqs_disabled_flags(unsigned long flags) |
---|
| 94 | +static inline int native_irqs_disabled_flags(unsigned long flags) |
---|
84 | 95 | { |
---|
85 | 96 | int res; |
---|
86 | 97 | |
---|
.. | .. |
---|
95 | 106 | return res; |
---|
96 | 107 | } |
---|
97 | 108 | |
---|
98 | | -static inline int arch_irqs_disabled(void) |
---|
99 | | -{ |
---|
100 | | - return arch_irqs_disabled_flags(arch_local_save_flags()); |
---|
101 | | -} |
---|
102 | | - |
---|
103 | | -static inline unsigned long arch_local_irq_save(void) |
---|
| 109 | +static inline unsigned long native_irq_save(void) |
---|
104 | 110 | { |
---|
105 | 111 | unsigned long flags; |
---|
106 | 112 | |
---|
107 | | - flags = arch_local_save_flags(); |
---|
| 113 | + flags = native_save_flags(); |
---|
108 | 114 | |
---|
109 | 115 | /* |
---|
110 | 116 | * There are too many states with IRQs disabled, just keep the current |
---|
111 | 117 | * state if interrupts are already disabled/masked. |
---|
112 | 118 | */ |
---|
113 | | - if (!arch_irqs_disabled_flags(flags)) |
---|
114 | | - arch_local_irq_disable(); |
---|
| 119 | + if (!native_irqs_disabled_flags(flags)) |
---|
| 120 | + native_irq_disable(); |
---|
115 | 121 | |
---|
116 | 122 | return flags; |
---|
117 | 123 | } |
---|
.. | .. |
---|
119 | 125 | /* |
---|
120 | 126 | * restore saved IRQ state |
---|
121 | 127 | */ |
---|
122 | | -static inline void arch_local_irq_restore(unsigned long flags) |
---|
| 128 | +static inline void native_irq_restore(unsigned long flags) |
---|
123 | 129 | { |
---|
124 | 130 | asm volatile(ALTERNATIVE( |
---|
125 | 131 | "msr daif, %0", |
---|
.. | .. |
---|
132 | 138 | pmr_sync(); |
---|
133 | 139 | } |
---|
134 | 140 | |
---|
| 141 | +static inline bool native_irqs_disabled(void) |
---|
| 142 | +{ |
---|
| 143 | + unsigned long flags = native_save_flags(); |
---|
| 144 | + return native_irqs_disabled_flags(flags); |
---|
| 145 | +} |
---|
| 146 | + |
---|
| 147 | +#include <asm/irq_pipeline.h> |
---|
| 148 | + |
---|
135 | 149 | #endif /* __ASM_IRQFLAGS_H */ |
---|