Skip to content

Commit

Permalink
microblaze: Add TRACE_IRQFLAGS_SUPPORT
Browse files Browse the repository at this point in the history
There are just two major changes
Renamed local_irq functions to raw_local_irq in irq.c.
Added TRACE_IRQFLAGS_SUPPORT to Kconfig.debug.

Look at Documentation/irqflags-tracing.txt

Signed-off-by: Michal Simek <monstr@monstr.eu>
  • Loading branch information
Michal Simek committed Dec 14, 2009
1 parent fb5a32d commit a3cd613
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 63 deletions.
3 changes: 3 additions & 0 deletions arch/microblaze/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

menu "Kernel hacking"

config TRACE_IRQFLAGS_SUPPORT
def_bool y

source "lib/Kconfig.debug"

config EARLY_PRINTK
Expand Down
112 changes: 50 additions & 62 deletions arch/microblaze/include/asm/irqflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,114 +10,102 @@
#define _ASM_MICROBLAZE_IRQFLAGS_H

#include <linux/irqflags.h>
#include <asm/registers.h>

# if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR

# define local_irq_save(flags) \
# define raw_local_irq_save(flags) \
do { \
asm volatile ("# local_irq_save \n\t" \
"msrclr %0, %1 \n\t" \
"nop \n\t" \
asm volatile (" msrclr %0, %1; \
nop;" \
: "=r"(flags) \
: "i"(MSR_IE) \
: "memory"); \
} while (0)

# define local_irq_disable() \
do { \
asm volatile ("# local_irq_disable \n\t" \
"msrclr r0, %0 \n\t" \
"nop \n\t" \
: \
: "i"(MSR_IE) \
: "memory"); \
# define raw_local_irq_disable() \
do { \
asm volatile (" msrclr r0, %0; \
nop;" \
: \
: "i"(MSR_IE) \
: "memory"); \
} while (0)

# define local_irq_enable() \
do { \
asm volatile ("# local_irq_enable \n\t" \
"msrset r0, %0 \n\t" \
"nop \n\t" \
: \
: "i"(MSR_IE) \
: "memory"); \
# define raw_local_irq_enable() \
do { \
asm volatile (" msrset r0, %0; \
nop;" \
: \
: "i"(MSR_IE) \
: "memory"); \
} while (0)

# else /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR == 0 */

# define local_irq_save(flags) \
# define raw_local_irq_save(flags) \
do { \
register unsigned tmp; \
asm volatile ("# local_irq_save \n\t" \
"mfs %0, rmsr \n\t" \
"nop \n\t" \
"andi %1, %0, %2 \n\t" \
"mts rmsr, %1 \n\t" \
"nop \n\t" \
asm volatile (" mfs %0, rmsr; \
nop; \
andi %1, %0, %2; \
mts rmsr, %1; \
nop;" \
: "=r"(flags), "=r" (tmp) \
: "i"(~MSR_IE) \
: "memory"); \
} while (0)

# define local_irq_disable() \
# define raw_local_irq_disable() \
do { \
register unsigned tmp; \
asm volatile ("# local_irq_disable \n\t" \
"mfs %0, rmsr \n\t" \
"nop \n\t" \
"andi %0, %0, %1 \n\t" \
"mts rmsr, %0 \n\t" \
"nop \n\t" \
asm volatile (" mfs %0, rmsr; \
nop; \
andi %0, %0, %1; \
mts rmsr, %0; \
nop;" \
: "=r"(tmp) \
: "i"(~MSR_IE) \
: "memory"); \
} while (0)

# define local_irq_enable() \
# define raw_local_irq_enable() \
do { \
register unsigned tmp; \
asm volatile ("# local_irq_enable \n\t" \
"mfs %0, rmsr \n\t" \
"nop \n\t" \
"ori %0, %0, %1 \n\t" \
"mts rmsr, %0 \n\t" \
"nop \n\t" \
asm volatile (" mfs %0, rmsr; \
nop; \
ori %0, %0, %1; \
mts rmsr, %0; \
nop;" \
: "=r"(tmp) \
: "i"(MSR_IE) \
: "memory"); \
} while (0)

# endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */

#define local_save_flags(flags) \
#define raw_local_irq_restore(flags) \
do { \
asm volatile ("# local_save_flags \n\t" \
"mfs %0, rmsr \n\t" \
"nop \n\t" \
: "=r"(flags) \
asm volatile (" mts rmsr, %0; \
nop;" \
: \
: "r"(flags) \
: "memory"); \
} while (0)

#define local_irq_restore(flags) \
do { \
asm volatile ("# local_irq_restore \n\t"\
"mts rmsr, %0 \n\t" \
"nop \n\t" \
: \
: "r"(flags) \
: "memory"); \
} while (0)

static inline int irqs_disabled(void)
static inline unsigned long get_msr(void)
{
unsigned long flags;

local_save_flags(flags);
return ((flags & MSR_IE) == 0);
asm volatile (" mfs %0, rmsr; \
nop;" \
: "=r"(flags) \
: \
: "memory"); \
return flags;
}

#define raw_irqs_disabled irqs_disabled
#define raw_irqs_disabled_flags(flags) ((flags) == 0)
#define raw_local_save_flags(flags) ((flags) = get_msr())
#define raw_irqs_disabled() ((get_msr() & MSR_IE) == 0)
#define raw_irqs_disabled_flags(flags) ((flags & MSR_IE) == 0)

#endif /* _ASM_MICROBLAZE_IRQFLAGS_H */
2 changes: 1 addition & 1 deletion arch/microblaze/kernel/cpu/pvr.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

int cpu_has_pvr(void)
{
unsigned flags;
unsigned long flags;
unsigned pvr0;

local_save_flags(flags);
Expand Down

0 comments on commit a3cd613

Please sign in to comment.