1b8b572e1SStephen Rothwell /* 2b8b572e1SStephen Rothwell * IRQ flags handling 3b8b572e1SStephen Rothwell */ 4b8b572e1SStephen Rothwell #ifndef _ASM_IRQFLAGS_H 5b8b572e1SStephen Rothwell #define _ASM_IRQFLAGS_H 6b8b572e1SStephen Rothwell 7b8b572e1SStephen Rothwell #ifndef __ASSEMBLY__ 8b8b572e1SStephen Rothwell /* 9df9ee292SDavid Howells * Get definitions for arch_local_save_flags(x), etc. 10b8b572e1SStephen Rothwell */ 11b8b572e1SStephen Rothwell #include <asm/hw_irq.h> 12b8b572e1SStephen Rothwell 13b8b572e1SStephen Rothwell #else 14b8b572e1SStephen Rothwell #ifdef CONFIG_TRACE_IRQFLAGS 153cb5f1a3SSteven Rostedt #ifdef CONFIG_IRQSOFF_TRACER 163cb5f1a3SSteven Rostedt /* 173cb5f1a3SSteven Rostedt * Since the ftrace irqsoff latency trace checks CALLER_ADDR1, 183cb5f1a3SSteven Rostedt * which is the stack frame here, we need to force a stack frame 193cb5f1a3SSteven Rostedt * in case we came from user space. 203cb5f1a3SSteven Rostedt */ 213cb5f1a3SSteven Rostedt #define TRACE_WITH_FRAME_BUFFER(func) \ 223cb5f1a3SSteven Rostedt mflr r0; \ 233cb5f1a3SSteven Rostedt stdu r1, -32(r1); \ 243cb5f1a3SSteven Rostedt std r0, 16(r1); \ 253cb5f1a3SSteven Rostedt stdu r1, -32(r1); \ 263cb5f1a3SSteven Rostedt bl func; \ 273cb5f1a3SSteven Rostedt ld r1, 0(r1); \ 283cb5f1a3SSteven Rostedt ld r1, 0(r1); 293cb5f1a3SSteven Rostedt #else 303cb5f1a3SSteven Rostedt #define TRACE_WITH_FRAME_BUFFER(func) \ 313cb5f1a3SSteven Rostedt bl func; 323cb5f1a3SSteven Rostedt #endif 333cb5f1a3SSteven Rostedt 34b8b572e1SStephen Rothwell /* 35b8b572e1SStephen Rothwell * Most of the CPU's IRQ-state tracing is done from assembly code; we 36b8b572e1SStephen Rothwell * have to call a C function so call a wrapper that saves all the 37b8b572e1SStephen Rothwell * C-clobbered registers. 38b8b572e1SStephen Rothwell */ 393cb5f1a3SSteven Rostedt #define TRACE_ENABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_on) 403cb5f1a3SSteven Rostedt #define TRACE_DISABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_off) 413cb5f1a3SSteven Rostedt 42b8b572e1SStephen Rothwell #define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) \ 43b8b572e1SStephen Rothwell cmpdi en,0; \ 44b8b572e1SStephen Rothwell bne 95f; \ 45b8b572e1SStephen Rothwell stb en,PACASOFTIRQEN(r13); \ 463cb5f1a3SSteven Rostedt TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_off) \ 47b8b572e1SStephen Rothwell b skip; \ 483cb5f1a3SSteven Rostedt 95: TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_on) \ 49b8b572e1SStephen Rothwell li en,1; 50b8b572e1SStephen Rothwell #define TRACE_AND_RESTORE_IRQ(en) \ 51b8b572e1SStephen Rothwell TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f); \ 5222b8f9eeSBenjamin Herrenschmidt stb en,PACASOFTIRQEN(r13); \ 5322b8f9eeSBenjamin Herrenschmidt 96: 54b8b572e1SStephen Rothwell #else 55b8b572e1SStephen Rothwell #define TRACE_ENABLE_INTS 56b8b572e1SStephen Rothwell #define TRACE_DISABLE_INTS 57b8b572e1SStephen Rothwell #define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) 58b8b572e1SStephen Rothwell #define TRACE_AND_RESTORE_IRQ(en) \ 59b8b572e1SStephen Rothwell stb en,PACASOFTIRQEN(r13) 60b8b572e1SStephen Rothwell #endif 61b8b572e1SStephen Rothwell #endif 62b8b572e1SStephen Rothwell 63b8b572e1SStephen Rothwell #endif 64