Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: fixup hard_irq_disable semantics

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>

authored by

Benjamin Herrenschmidt and committed by
Linus Torvalds
e1fa2e13 2acdb169

+12 -11
+1 -1
arch/powerpc/kernel/irq.c
··· 173 173 lv1_get_version_info(&tmp); 174 174 } 175 175 176 - hard_irq_enable(); 176 + __hard_irq_enable(); 177 177 } 178 178 #endif /* CONFIG_PPC64 */ 179 179
-4
arch/powerpc/kernel/swsusp.c
··· 36 36 #ifdef CONFIG_PPC32 37 37 set_context(current->active_mm->context.id, current->active_mm->pgd); 38 38 #endif 39 - 40 - #ifdef CONFIG_PPC64 41 - hard_irq_enable(); 42 - #endif 43 39 }
+2 -4
arch/powerpc/platforms/cell/pervasive.c
··· 43 43 unsigned long ctrl, thread_switch_control; 44 44 45 45 /* 46 - * We need to hard disable interrupts, but we also need to mark them 47 - * hard disabled in the PACA so that the local_irq_enable() done by 48 - * our caller upon return propertly hard enables. 46 + * We need to hard disable interrupts, the local_irq_enable() done by 47 + * our caller upon return will hard re-enable. 49 48 */ 50 49 hard_irq_disable(); 51 - get_paca()->hard_enabled = 0; 52 50 53 51 ctrl = mfspr(SPRN_CTRLF); 54 52
+9 -2
include/asm-powerpc/hw_irq.h
··· 48 48 49 49 #define irqs_disabled() (local_get_flags() == 0) 50 50 51 - #define hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1) 52 - #define hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1) 51 + #define __hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1) 52 + #define __hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1) 53 + 54 + #define hard_irq_disable() \ 55 + do { \ 56 + __hard_irq_disable(); \ 57 + get_paca()->soft_enabled = 0; \ 58 + get_paca()->hard_enabled = 0; \ 59 + } while(0) 53 60 54 61 #else 55 62