diff options
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/irq.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 1b415027ec0e..9270a399c9d6 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -286,6 +286,52 @@ void notrace restore_interrupts(void) | |||
286 | __hard_irq_enable(); | 286 | __hard_irq_enable(); |
287 | } | 287 | } |
288 | 288 | ||
289 | /* | ||
290 | * This is a helper to use when about to go into idle low-power | ||
291 | * when the latter has the side effect of re-enabling interrupts | ||
292 | * (such as calling H_CEDE under pHyp). | ||
293 | * | ||
294 | * You call this function with interrupts soft-disabled (this is | ||
295 | * already the case when ppc_md.power_save is called). The function | ||
296 | * will return whether to enter power save or just return. | ||
297 | * | ||
298 | * In the former case, it will have notified lockdep of interrupts | ||
299 | * being re-enabled and generally sanitized the lazy irq state, | ||
300 | * and in the latter case it will leave with interrupts hard | ||
301 | * disabled and marked as such, so the local_irq_enable() call | ||
302 | * in cpu_idle() will properly re-enable everything. | ||
303 | */ | ||
304 | bool prep_irq_for_idle(void) | ||
305 | { | ||
306 | /* | ||
307 | * First we need to hard disable to ensure no interrupt | ||
308 | * occurs before we effectively enter the low power state | ||
309 | */ | ||
310 | hard_irq_disable(); | ||
311 | |||
312 | /* | ||
313 | * If anything happened while we were soft-disabled, | ||
314 | * we return now and do not enter the low power state. | ||
315 | */ | ||
316 | if (lazy_irq_pending()) | ||
317 | return false; | ||
318 | |||
319 | /* Tell lockdep we are about to re-enable */ | ||
320 | trace_hardirqs_on(); | ||
321 | |||
322 | /* | ||
323 | * Mark interrupts as soft-enabled and clear the | ||
324 | * PACA_IRQ_HARD_DIS from the pending mask since we | ||
325 | * are about to hard enable as well as a side effect | ||
326 | * of entering the low power state. | ||
327 | */ | ||
328 | local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS; | ||
329 | local_paca->soft_enabled = 1; | ||
330 | |||
331 | /* Tell the caller to enter the low power state */ | ||
332 | return true; | ||
333 | } | ||
334 | |||
289 | #endif /* CONFIG_PPC64 */ | 335 | #endif /* CONFIG_PPC64 */ |
290 | 336 | ||
291 | int arch_show_interrupts(struct seq_file *p, int prec) | 337 | int arch_show_interrupts(struct seq_file *p, int prec) |