arm64: Add macros to manage processor debug state
authorVijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Tue, 28 Jan 2014 11:20:17 +0000 (11:20 +0000)
committerMark Brown <broonie@linaro.org>
Wed, 21 May 2014 15:01:06 +0000 (16:01 +0100)
Add macros to enable and disable to manage PSTATE.D
for debugging. The macros local_dbg_save and local_dbg_restore
are moved to irqflags.h file

KGDB boot tests fail because of PSTATE.D is masked.
unmask it for debugging support

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit c7db4ff5d2b459a579d348532a92fd5885520ce6)
Signed-off-by: Mark Brown <broonie@linaro.org>
arch/arm64/include/asm/debug-monitors.h
arch/arm64/include/asm/irqflags.h
arch/arm64/kernel/debug-monitors.c

index 1bc1c4f15c145f498b94135e1732c274fa54995d..9beb51e5a1a647296dc5dce7498f5fcc12e27afa 100644 (file)
@@ -43,23 +43,6 @@ enum debug_el {
 #ifndef __ASSEMBLY__
 struct task_struct;
 
-#define local_dbg_save(flags)                                                  \
-       do {                                                                    \
-               typecheck(unsigned long, flags);                                \
-               asm volatile(                                                   \
-               "mrs    %0, daif                        // local_dbg_save\n"    \
-               "msr    daifset, #8"                                            \
-               : "=r" (flags) : : "memory");                                   \
-       } while (0)
-
-#define local_dbg_restore(flags)                                               \
-       do {                                                                    \
-               typecheck(unsigned long, flags);                                \
-               asm volatile(                                                   \
-               "msr    daif, %0                        // local_dbg_restore\n" \
-               : : "r" (flags) : "memory");                                    \
-       } while (0)
-
 #define DBG_ARCH_ID_RESERVED   0       /* In case of ptrace ABI updates. */
 
 #define DBG_HOOK_HANDLED       0
index aa11943b850213c77a32f87c1ce22c8aac87bf83..0ed52c691868ee5aa6a67390d7f7afa1b52b5bb7 100644 (file)
@@ -87,5 +87,28 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
        return flags & PSR_I_BIT;
 }
 
+/*
+ * save and restore debug state
+ */
+#define local_dbg_save(flags)                                          \
+       do {                                                            \
+               typecheck(unsigned long, flags);                        \
+               asm volatile(                                           \
+               "mrs    %0, daif                // local_dbg_save\n"    \
+               "msr    daifset, #8"                                    \
+               : "=r" (flags) : : "memory");                           \
+       } while (0)
+
+#define local_dbg_restore(flags)                                       \
+       do {                                                            \
+               typecheck(unsigned long, flags);                        \
+               asm volatile(                                           \
+               "msr    daif, %0                // local_dbg_restore\n" \
+               : : "r" (flags) : "memory");                            \
+       } while (0)
+
+#define local_dbg_enable()     asm("msr        daifclr, #8" : : : "memory")
+#define local_dbg_disable()    asm("msr        daifset, #8" : : : "memory")
+
 #endif
 #endif
index 2867749b56be5773d677075ef2b20216fe9f2ba2..f092fdbf5479560b092906d8b546a9af7bf916ce 100644 (file)
@@ -139,6 +139,7 @@ static void clear_os_lock(void *unused)
 {
        asm volatile("msr oslar_el1, %0" : : "r" (0));
        isb();
+       local_dbg_enable();
 }
 
 static int __cpuinit os_lock_notify(struct notifier_block *self,