microblaze: Add TRACE_IRQFLAGS_SUPPORT
authorMichal Simek <monstr@monstr.eu>
Fri, 30 Oct 2009 11:26:53 +0000 (12:26 +0100)
committerMichal Simek <monstr@monstr.eu>
Mon, 14 Dec 2009 07:40:09 +0000 (08:40 +0100)
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>
arch/microblaze/Kconfig.debug
arch/microblaze/include/asm/irqflags.h
arch/microblaze/kernel/cpu/pvr.c

index 242cd35..9dc708a 100644 (file)
@@ -3,6 +3,9 @@
 
 menu "Kernel hacking"
 
+config TRACE_IRQFLAGS_SUPPORT
+       def_bool y
+
 source "lib/Kconfig.debug"
 
 config EARLY_PRINTK
index dea6564..2c38c6d 100644 (file)
 #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");                    \
 
 # 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 */
index c9a4340..9bee938 100644 (file)
@@ -45,7 +45,7 @@
 
 int cpu_has_pvr(void)
 {
-       unsigned flags;
+       unsigned long flags;
        unsigned pvr0;
 
        local_save_flags(flags);