aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>2014-01-28 06:20:17 -0500
committerCatalin Marinas <catalin.marinas@arm.com>2014-02-26 06:16:25 -0500
commitc7db4ff5d2b459a579d348532a92fd5885520ce6 (patch)
tree9fefbee341d75961e42aecf97267e450c3b46e6e
parentcfbf8d4857c26a8a307fb7cd258074c9dcd8c691 (diff)
arm64: Add macros to manage processor debug state
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>
-rw-r--r--arch/arm64/include/asm/debug-monitors.h17
-rw-r--r--arch/arm64/include/asm/irqflags.h23
-rw-r--r--arch/arm64/kernel/debug-monitors.c1
3 files changed, 24 insertions, 17 deletions
diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
index 62314791570c..ee9f28e245aa 100644
--- a/arch/arm64/include/asm/debug-monitors.h
+++ b/arch/arm64/include/asm/debug-monitors.h
@@ -43,23 +43,6 @@ enum debug_el {
43#ifndef __ASSEMBLY__ 43#ifndef __ASSEMBLY__
44struct task_struct; 44struct task_struct;
45 45
46#define local_dbg_save(flags) \
47 do { \
48 typecheck(unsigned long, flags); \
49 asm volatile( \
50 "mrs %0, daif // local_dbg_save\n" \
51 "msr daifset, #8" \
52 : "=r" (flags) : : "memory"); \
53 } while (0)
54
55#define local_dbg_restore(flags) \
56 do { \
57 typecheck(unsigned long, flags); \
58 asm volatile( \
59 "msr daif, %0 // local_dbg_restore\n" \
60 : : "r" (flags) : "memory"); \
61 } while (0)
62
63#define DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */ 46#define DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */
64 47
65#define DBG_HOOK_HANDLED 0 48#define DBG_HOOK_HANDLED 0
diff --git a/arch/arm64/include/asm/irqflags.h b/arch/arm64/include/asm/irqflags.h
index b2fcfbc51ecc..11cc941bd107 100644
--- a/arch/arm64/include/asm/irqflags.h
+++ b/arch/arm64/include/asm/irqflags.h
@@ -90,5 +90,28 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
90 return flags & PSR_I_BIT; 90 return flags & PSR_I_BIT;
91} 91}
92 92
93/*
94 * save and restore debug state
95 */
96#define local_dbg_save(flags) \
97 do { \
98 typecheck(unsigned long, flags); \
99 asm volatile( \
100 "mrs %0, daif // local_dbg_save\n" \
101 "msr daifset, #8" \
102 : "=r" (flags) : : "memory"); \
103 } while (0)
104
105#define local_dbg_restore(flags) \
106 do { \
107 typecheck(unsigned long, flags); \
108 asm volatile( \
109 "msr daif, %0 // local_dbg_restore\n" \
110 : : "r" (flags) : "memory"); \
111 } while (0)
112
113#define local_dbg_enable() asm("msr daifclr, #8" : : : "memory")
114#define local_dbg_disable() asm("msr daifset, #8" : : : "memory")
115
93#endif 116#endif
94#endif 117#endif
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index 636ba8b6240b..1a8127da625b 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -138,6 +138,7 @@ static void clear_os_lock(void *unused)
138{ 138{
139 asm volatile("msr oslar_el1, %0" : : "r" (0)); 139 asm volatile("msr oslar_el1, %0" : : "r" (0));
140 isb(); 140 isb();
141 local_dbg_enable();
141} 142}
142 143
143static int os_lock_notify(struct notifier_block *self, 144static int os_lock_notify(struct notifier_block *self,