powerpc/64: Add #defines for paca->soft_enabled flags

Two #defines IRQS_ENABLED and IRQS_DISABLED are added to be used when
updating paca->soft_enabled. Replace the hardcoded values used when
updating paca->soft_enabled with IRQ_(EN|DIS)ABLED #define. No logic
change.

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
Madhavan Srinivasan
2017-12-20 09:25:42 +05:30
committed by Michael Ellerman
parent a8a4b03ab9
commit c2e480ba82
15 changed files with 50 additions and 35 deletions

View File

@@ -28,6 +28,12 @@
#define PACA_IRQ_EE_EDGE 0x10 /* BookE only */
#define PACA_IRQ_HMI 0x20
/*
* flags for paca->soft_enabled
*/
#define IRQS_ENABLED 1
#define IRQS_DISABLED 0
#endif /* CONFIG_PPC64 */
#ifndef __ASSEMBLY__
@@ -60,9 +66,10 @@ static inline unsigned long arch_local_irq_disable(void)
unsigned long flags, zero;
asm volatile(
"li %1,0; lbz %0,%2(13); stb %1,%2(13)"
"li %1,%3; lbz %0,%2(13); stb %1,%2(13)"
: "=r" (flags), "=&r" (zero)
: "i" (offsetof(struct paca_struct, soft_enabled))
: "i" (offsetof(struct paca_struct, soft_enabled)),\
"i" (IRQS_DISABLED)
: "memory");
return flags;
@@ -72,7 +79,7 @@ extern void arch_local_irq_restore(unsigned long);
static inline void arch_local_irq_enable(void)
{
arch_local_irq_restore(1);
arch_local_irq_restore(IRQS_ENABLED);
}
static inline unsigned long arch_local_irq_save(void)
@@ -82,7 +89,7 @@ static inline unsigned long arch_local_irq_save(void)
static inline bool arch_irqs_disabled_flags(unsigned long flags)
{
return flags == 0;
return flags == IRQS_DISABLED;
}
static inline bool arch_irqs_disabled(void)
@@ -102,9 +109,9 @@ static inline bool arch_irqs_disabled(void)
u8 _was_enabled; \
__hard_irq_disable(); \
_was_enabled = local_paca->soft_enabled; \
local_paca->soft_enabled = 0; \
local_paca->soft_enabled = IRQS_DISABLED;\
local_paca->irq_happened |= PACA_IRQ_HARD_DIS; \
if (_was_enabled) \
if (_was_enabled == IRQS_ENABLED) \
trace_hardirqs_off(); \
} while(0)
@@ -127,7 +134,7 @@ static inline void may_hard_irq_enable(void)
static inline bool arch_irq_disabled_regs(struct pt_regs *regs)
{
return !regs->softe;
return (regs->softe == IRQS_DISABLED);
}
extern bool prep_irq_for_idle(void);