1 /* SPDX-License-Identifier: GPL-2.0 */
5 #ifndef _ASM_IRQFLAGS_H
6 #define _ASM_IRQFLAGS_H
10 * Get definitions for arch_local_save_flags(x), etc.
12 #include <asm/hw_irq.h>
15 #ifdef CONFIG_TRACE_IRQFLAGS
16 #ifdef CONFIG_IRQSOFF_TRACER
18 * Since the ftrace irqsoff latency trace checks CALLER_ADDR1,
19 * which is the stack frame here, we need to force a stack frame
20 * in case we came from user space.
22 #define TRACE_WITH_FRAME_BUFFER(func) \
24 stdu r1, -STACK_FRAME_OVERHEAD(r1); \
26 stdu r1, -STACK_FRAME_OVERHEAD(r1); \
31 #define TRACE_WITH_FRAME_BUFFER(func) \
36 * These are calls to C code, so the caller must be prepared for volatiles to
39 #define TRACE_ENABLE_INTS TRACE_WITH_FRAME_BUFFER(trace_hardirqs_on)
40 #define TRACE_DISABLE_INTS TRACE_WITH_FRAME_BUFFER(trace_hardirqs_off)
43 * This is used by assembly code to soft-disable interrupts first and
44 * reconcile irq state.
46 * NB: This may call C code, so the caller must be prepared for volatiles to
49 #define RECONCILE_IRQ_STATE(__rA, __rB) \
50 lbz __rA,PACAIRQSOFTMASK(r13); \
51 lbz __rB,PACAIRQHAPPENED(r13); \
52 andi. __rA,__rA,IRQS_DISABLED; \
53 li __rA,IRQS_DISABLED; \
54 ori __rB,__rB,PACA_IRQ_HARD_DIS; \
55 stb __rB,PACAIRQHAPPENED(r13); \
57 stb __rA,PACAIRQSOFTMASK(r13); \
62 #define TRACE_ENABLE_INTS
63 #define TRACE_DISABLE_INTS
65 #define RECONCILE_IRQ_STATE(__rA, __rB) \
66 lbz __rA,PACAIRQHAPPENED(r13); \
67 li __rB,IRQS_DISABLED; \
68 ori __rA,__rA,PACA_IRQ_HARD_DIS; \
69 stb __rB,PACAIRQSOFTMASK(r13); \
70 stb __rA,PACAIRQHAPPENED(r13)