powerpc: fixup hard_irq_disable semantics
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 11 May 2007 05:22:45 +0000 (22:22 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 11 May 2007 15:29:34 +0000 (08:29 -0700)
This patch renames the raw hard_irq_{enable,disable} into
__hard_irq_{enable,disable} and introduces a higher level hard_irq_disable()
function that can be used by any code to enforce that IRQs are fully disabled,
not only lazy disabled.

The difference with the __ versions is that it will update some per-processor
fields so that the kernel keeps track and properly re-enables them in the next
local_irq_disable();

This prepares powerpc for my next patch that introduces hard_irq_disable()
generically.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/powerpc/kernel/irq.c
arch/powerpc/kernel/swsusp.c
arch/powerpc/platforms/cell/pervasive.c
include/asm-powerpc/hw_irq.h

index 9ed4931af1641253cce9dfce6c52fd6deb91c230..068377a2a8dc021b008f7cb56d3d82b2e94994cb 100644 (file)
@@ -173,7 +173,7 @@ void local_irq_restore(unsigned long en)
                lv1_get_version_info(&tmp);
        }
 
-       hard_irq_enable();
+       __hard_irq_enable();
 }
 #endif /* CONFIG_PPC64 */
 
index 064a7ba4f02c0a43e87e6ee68f96ab2ebf63f426..77b7b34b5955f0d6453e829b75454f0df145da9c 100644 (file)
@@ -36,8 +36,4 @@ void restore_processor_state(void)
 #ifdef CONFIG_PPC32
        set_context(current->active_mm->context.id, current->active_mm->pgd);
 #endif
-
-#ifdef CONFIG_PPC64
-       hard_irq_enable();
-#endif
 }
index 8c20f0fb8651f23b204f455bbf75a23581bef746..812bf563ed6509aebeb51606fe8fa068c411bc5c 100644 (file)
@@ -43,12 +43,10 @@ static void cbe_power_save(void)
        unsigned long ctrl, thread_switch_control;
 
        /*
-        * We need to hard disable interrupts, but we also need to mark them
-        * hard disabled in the PACA so that the local_irq_enable() done by
-        * our caller upon return propertly hard enables.
+        * We need to hard disable interrupts, the local_irq_enable() done by
+        * our caller upon return will hard re-enable.
         */
        hard_irq_disable();
-       get_paca()->hard_enabled = 0;
 
        ctrl = mfspr(SPRN_CTRLF);
 
index 9e4dd98eb220ca65a409ffe475bc59a762f84f55..a7b60bf639e0896f5b1099ee29c664c20fa0d33a 100644 (file)
@@ -48,8 +48,15 @@ extern void iseries_handle_interrupts(void);
 
 #define irqs_disabled()                (local_get_flags() == 0)
 
-#define hard_irq_enable()      __mtmsrd(mfmsr() | MSR_EE, 1)
-#define hard_irq_disable()     __mtmsrd(mfmsr() & ~MSR_EE, 1)
+#define __hard_irq_enable()    __mtmsrd(mfmsr() | MSR_EE, 1)
+#define __hard_irq_disable()   __mtmsrd(mfmsr() & ~MSR_EE, 1)
+
+#define  hard_irq_disable()                    \
+       do {                                    \
+               __hard_irq_disable();           \
+               get_paca()->soft_enabled = 0;   \
+               get_paca()->hard_enabled = 0;   \
+       } while(0)
 
 #else