.. | .. |
---|
25 | 25 | #define PACA_IRQ_DBELL 0x02 |
---|
26 | 26 | #define PACA_IRQ_EE 0x04 |
---|
27 | 27 | #define PACA_IRQ_DEC 0x08 /* Or FIT */ |
---|
28 | | -#define PACA_IRQ_EE_EDGE 0x10 /* BookE only */ |
---|
29 | | -#define PACA_IRQ_HMI 0x20 |
---|
30 | | -#define PACA_IRQ_PMI 0x40 |
---|
| 28 | +#define PACA_IRQ_HMI 0x10 |
---|
| 29 | +#define PACA_IRQ_PMI 0x20 |
---|
31 | 30 | |
---|
32 | 31 | /* |
---|
33 | 32 | * Some soft-masked interrupts must be hard masked until they are replayed |
---|
.. | .. |
---|
39 | 38 | #define PACA_IRQ_MUST_HARD_MASK (PACA_IRQ_EE) |
---|
40 | 39 | #endif |
---|
41 | 40 | |
---|
| 41 | +#endif /* CONFIG_PPC64 */ |
---|
| 42 | + |
---|
42 | 43 | /* |
---|
43 | 44 | * flags for paca->irq_soft_mask |
---|
44 | 45 | */ |
---|
.. | .. |
---|
47 | 48 | #define IRQS_PMI_DISABLED 2 |
---|
48 | 49 | #define IRQS_ALL_DISABLED (IRQS_DISABLED | IRQS_PMI_DISABLED) |
---|
49 | 50 | |
---|
50 | | -#endif /* CONFIG_PPC64 */ |
---|
51 | | - |
---|
52 | 51 | #ifndef __ASSEMBLY__ |
---|
53 | 52 | |
---|
54 | 53 | extern void replay_system_reset(void); |
---|
55 | | -extern void __replay_interrupt(unsigned int vector); |
---|
| 54 | +extern void replay_soft_interrupts(void); |
---|
56 | 55 | |
---|
57 | 56 | extern void timer_interrupt(struct pt_regs *); |
---|
58 | 57 | extern void timer_broadcast_interrupt(void); |
---|
.. | .. |
---|
176 | 175 | return arch_irqs_disabled_flags(arch_local_save_flags()); |
---|
177 | 176 | } |
---|
178 | 177 | |
---|
| 178 | +static inline void set_pmi_irq_pending(void) |
---|
| 179 | +{ |
---|
| 180 | + /* |
---|
| 181 | + * Invoked from PMU callback functions to set PMI bit in the paca. |
---|
| 182 | + * This has to be called with irq's disabled (via hard_irq_disable()). |
---|
| 183 | + */ |
---|
| 184 | + if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) |
---|
| 185 | + WARN_ON_ONCE(mfmsr() & MSR_EE); |
---|
| 186 | + |
---|
| 187 | + get_paca()->irq_happened |= PACA_IRQ_PMI; |
---|
| 188 | +} |
---|
| 189 | + |
---|
| 190 | +static inline void clear_pmi_irq_pending(void) |
---|
| 191 | +{ |
---|
| 192 | + /* |
---|
| 193 | + * Invoked from PMU callback functions to clear the pending PMI bit |
---|
| 194 | + * in the paca. |
---|
| 195 | + */ |
---|
| 196 | + if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) |
---|
| 197 | + WARN_ON_ONCE(mfmsr() & MSR_EE); |
---|
| 198 | + |
---|
| 199 | + get_paca()->irq_happened &= ~PACA_IRQ_PMI; |
---|
| 200 | +} |
---|
| 201 | + |
---|
| 202 | +static inline bool pmi_irq_pending(void) |
---|
| 203 | +{ |
---|
| 204 | + /* |
---|
| 205 | + * Invoked from PMU callback functions to check if there is a pending |
---|
| 206 | + * PMI bit in the paca. |
---|
| 207 | + */ |
---|
| 208 | + if (get_paca()->irq_happened & PACA_IRQ_PMI) |
---|
| 209 | + return true; |
---|
| 210 | + |
---|
| 211 | + return false; |
---|
| 212 | +} |
---|
| 213 | + |
---|
179 | 214 | #ifdef CONFIG_PPC_BOOK3S |
---|
180 | 215 | /* |
---|
181 | 216 | * To support disabling and enabling of irq with PMI, set of |
---|
.. | .. |
---|
200 | 235 | #define powerpc_local_irq_pmu_save(flags) \ |
---|
201 | 236 | do { \ |
---|
202 | 237 | raw_local_irq_pmu_save(flags); \ |
---|
203 | | - trace_hardirqs_off(); \ |
---|
| 238 | + if (!raw_irqs_disabled_flags(flags)) \ |
---|
| 239 | + trace_hardirqs_off(); \ |
---|
204 | 240 | } while(0) |
---|
205 | 241 | #define powerpc_local_irq_pmu_restore(flags) \ |
---|
206 | 242 | do { \ |
---|
207 | | - if (raw_irqs_disabled_flags(flags)) { \ |
---|
208 | | - raw_local_irq_pmu_restore(flags); \ |
---|
209 | | - trace_hardirqs_off(); \ |
---|
210 | | - } else { \ |
---|
| 243 | + if (!raw_irqs_disabled_flags(flags)) \ |
---|
211 | 244 | trace_hardirqs_on(); \ |
---|
212 | | - raw_local_irq_pmu_restore(flags); \ |
---|
213 | | - } \ |
---|
| 245 | + raw_local_irq_pmu_restore(flags); \ |
---|
214 | 246 | } while(0) |
---|
215 | 247 | #else |
---|
216 | 248 | #define powerpc_local_irq_pmu_save(flags) \ |
---|
.. | .. |
---|
226 | 258 | #endif /* CONFIG_PPC_BOOK3S */ |
---|
227 | 259 | |
---|
228 | 260 | #ifdef CONFIG_PPC_BOOK3E |
---|
229 | | -#define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory") |
---|
230 | | -#define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory") |
---|
| 261 | +#define __hard_irq_enable() wrtee(MSR_EE) |
---|
| 262 | +#define __hard_irq_disable() wrtee(0) |
---|
| 263 | +#define __hard_EE_RI_disable() wrtee(0) |
---|
| 264 | +#define __hard_RI_enable() do { } while (0) |
---|
231 | 265 | #else |
---|
232 | 266 | #define __hard_irq_enable() __mtmsrd(MSR_EE|MSR_RI, 1) |
---|
233 | 267 | #define __hard_irq_disable() __mtmsrd(MSR_RI, 1) |
---|
| 268 | +#define __hard_EE_RI_disable() __mtmsrd(0, 1) |
---|
| 269 | +#define __hard_RI_enable() __mtmsrd(MSR_RI, 1) |
---|
234 | 270 | #endif |
---|
235 | 271 | |
---|
236 | 272 | #define hard_irq_disable() do { \ |
---|
.. | .. |
---|
246 | 282 | } \ |
---|
247 | 283 | } while(0) |
---|
248 | 284 | |
---|
| 285 | +static inline bool __lazy_irq_pending(u8 irq_happened) |
---|
| 286 | +{ |
---|
| 287 | + return !!(irq_happened & ~PACA_IRQ_HARD_DIS); |
---|
| 288 | +} |
---|
| 289 | + |
---|
| 290 | +/* |
---|
| 291 | + * Check if a lazy IRQ is pending. Should be called with IRQs hard disabled. |
---|
| 292 | + */ |
---|
249 | 293 | static inline bool lazy_irq_pending(void) |
---|
250 | 294 | { |
---|
251 | | - return !!(get_paca()->irq_happened & ~PACA_IRQ_HARD_DIS); |
---|
| 295 | + return __lazy_irq_pending(get_paca()->irq_happened); |
---|
| 296 | +} |
---|
| 297 | + |
---|
| 298 | +/* |
---|
| 299 | + * Check if a lazy IRQ is pending, with no debugging checks. |
---|
| 300 | + * Should be called with IRQs hard disabled. |
---|
| 301 | + * For use in RI disabled code or other constrained situations. |
---|
| 302 | + */ |
---|
| 303 | +static inline bool lazy_irq_pending_nocheck(void) |
---|
| 304 | +{ |
---|
| 305 | + return __lazy_irq_pending(local_paca->irq_happened); |
---|
252 | 306 | } |
---|
253 | 307 | |
---|
254 | 308 | /* |
---|
.. | .. |
---|
278 | 332 | |
---|
279 | 333 | extern void force_external_irq_replay(void); |
---|
280 | 334 | |
---|
| 335 | +static inline void irq_soft_mask_regs_set_state(struct pt_regs *regs, unsigned long val) |
---|
| 336 | +{ |
---|
| 337 | + regs->softe = val; |
---|
| 338 | +} |
---|
281 | 339 | #else /* CONFIG_PPC64 */ |
---|
282 | | - |
---|
283 | | -#define SET_MSR_EE(x) mtmsr(x) |
---|
284 | 340 | |
---|
285 | 341 | static inline unsigned long arch_local_save_flags(void) |
---|
286 | 342 | { |
---|
.. | .. |
---|
289 | 345 | |
---|
290 | 346 | static inline void arch_local_irq_restore(unsigned long flags) |
---|
291 | 347 | { |
---|
292 | | -#if defined(CONFIG_BOOKE) |
---|
293 | | - asm volatile("wrtee %0" : : "r" (flags) : "memory"); |
---|
294 | | -#else |
---|
295 | | - mtmsr(flags); |
---|
296 | | -#endif |
---|
| 348 | + if (IS_ENABLED(CONFIG_BOOKE)) |
---|
| 349 | + wrtee(flags); |
---|
| 350 | + else |
---|
| 351 | + mtmsr(flags); |
---|
297 | 352 | } |
---|
298 | 353 | |
---|
299 | 354 | static inline unsigned long arch_local_irq_save(void) |
---|
300 | 355 | { |
---|
301 | 356 | unsigned long flags = arch_local_save_flags(); |
---|
302 | | -#ifdef CONFIG_BOOKE |
---|
303 | | - asm volatile("wrteei 0" : : : "memory"); |
---|
304 | | -#elif defined(CONFIG_PPC_8xx) |
---|
305 | | - wrtspr(SPRN_EID); |
---|
306 | | -#else |
---|
307 | | - SET_MSR_EE(flags & ~MSR_EE); |
---|
308 | | -#endif |
---|
| 357 | + |
---|
| 358 | + if (IS_ENABLED(CONFIG_BOOKE)) |
---|
| 359 | + wrtee(0); |
---|
| 360 | + else if (IS_ENABLED(CONFIG_PPC_8xx)) |
---|
| 361 | + wrtspr(SPRN_EID); |
---|
| 362 | + else |
---|
| 363 | + mtmsr(flags & ~MSR_EE); |
---|
| 364 | + |
---|
309 | 365 | return flags; |
---|
310 | 366 | } |
---|
311 | 367 | |
---|
312 | 368 | static inline void arch_local_irq_disable(void) |
---|
313 | 369 | { |
---|
314 | | -#ifdef CONFIG_BOOKE |
---|
315 | | - asm volatile("wrteei 0" : : : "memory"); |
---|
316 | | -#elif defined(CONFIG_PPC_8xx) |
---|
317 | | - wrtspr(SPRN_EID); |
---|
318 | | -#else |
---|
319 | | - arch_local_irq_save(); |
---|
320 | | -#endif |
---|
| 370 | + if (IS_ENABLED(CONFIG_BOOKE)) |
---|
| 371 | + wrtee(0); |
---|
| 372 | + else if (IS_ENABLED(CONFIG_PPC_8xx)) |
---|
| 373 | + wrtspr(SPRN_EID); |
---|
| 374 | + else |
---|
| 375 | + mtmsr(mfmsr() & ~MSR_EE); |
---|
321 | 376 | } |
---|
322 | 377 | |
---|
323 | 378 | static inline void arch_local_irq_enable(void) |
---|
324 | 379 | { |
---|
325 | | -#ifdef CONFIG_BOOKE |
---|
326 | | - asm volatile("wrteei 1" : : : "memory"); |
---|
327 | | -#elif defined(CONFIG_PPC_8xx) |
---|
328 | | - wrtspr(SPRN_EIE); |
---|
329 | | -#else |
---|
330 | | - unsigned long msr = mfmsr(); |
---|
331 | | - SET_MSR_EE(msr | MSR_EE); |
---|
332 | | -#endif |
---|
| 380 | + if (IS_ENABLED(CONFIG_BOOKE)) |
---|
| 381 | + wrtee(MSR_EE); |
---|
| 382 | + else if (IS_ENABLED(CONFIG_PPC_8xx)) |
---|
| 383 | + wrtspr(SPRN_EIE); |
---|
| 384 | + else |
---|
| 385 | + mtmsr(mfmsr() | MSR_EE); |
---|
333 | 386 | } |
---|
334 | 387 | |
---|
335 | 388 | static inline bool arch_irqs_disabled_flags(unsigned long flags) |
---|
.. | .. |
---|
351 | 404 | |
---|
352 | 405 | static inline void may_hard_irq_enable(void) { } |
---|
353 | 406 | |
---|
| 407 | +static inline void clear_pmi_irq_pending(void) { } |
---|
| 408 | +static inline void set_pmi_irq_pending(void) { } |
---|
| 409 | +static inline bool pmi_irq_pending(void) { return false; } |
---|
| 410 | + |
---|
| 411 | +static inline void irq_soft_mask_regs_set_state(struct pt_regs *regs, unsigned long val) |
---|
| 412 | +{ |
---|
| 413 | +} |
---|
354 | 414 | #endif /* CONFIG_PPC64 */ |
---|
355 | 415 | |
---|
356 | 416 | #define ARCH_IRQ_INIT_FLAGS IRQ_NOREQUEST |
---|
357 | | - |
---|
358 | | -/* |
---|
359 | | - * interrupt-retrigger: should we handle this via lost interrupts and IPIs |
---|
360 | | - * or should we not care like we do now ? --BenH. |
---|
361 | | - */ |
---|
362 | | -struct irq_chip; |
---|
363 | 417 | |
---|
364 | 418 | #endif /* __ASSEMBLY__ */ |
---|
365 | 419 | #endif /* __KERNEL__ */ |
---|