* [PATCH 1/6] arm64: Add macros to manage processor debug state
2014-01-22 14:42 [PATCH v7 0/6] arm64: KGDB Support vijay.kilari at gmail.com
@ 2014-01-22 14:42 ` vijay.kilari at gmail.com
2014-01-22 17:31 ` Will Deacon
0 siblings, 1 reply; 7+ messages in thread
From: vijay.kilari at gmail.com @ 2014-01-22 14:42 UTC (permalink / raw)
To: linux-arm-kernel
From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
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>
---
arch/arm64/include/asm/debug-monitors.h | 18 ++----------------
arch/arm64/include/asm/irqflags.h | 22 ++++++++++++++++++++++
arch/arm64/kernel/debug-monitors.c | 3 ++-
3 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
index 6231479..bc48880 100644
--- a/arch/arm64/include/asm/debug-monitors.h
+++ b/arch/arm64/include/asm/debug-monitors.h
@@ -43,22 +43,8 @@ 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 local_dbg_enable() asm("msr daifclr, #8" : : : "memory")
+#define local_dbg_disable() asm("msr daifset, #8" : : : "memory")
#define DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */
diff --git a/arch/arm64/include/asm/irqflags.h b/arch/arm64/include/asm/irqflags.h
index b2fcfbc..f163b11 100644
--- a/arch/arm64/include/asm/irqflags.h
+++ b/arch/arm64/include/asm/irqflags.h
@@ -90,5 +90,27 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
return flags & PSR_I_BIT;
}
+/*
+ * save and restore debug state
+ */
+static inline unsigned long local_dbg_save(void)
+{
+ unsigned long flags;
+ asm volatile(
+ "mrs %0, daif // local_dbg_save"
+ "msr daifset, #8"
+ : "=r" (flags) : : "memory");
+ return flags;
+}
+
+static inline void local_dbg_restore(unsigned long flags)
+{
+ asm volatile(
+ "msr daif, %0 // local_dbg_restore"
+ :
+ : "r" (flags)
+ : "memory");
+}
+
#endif
#endif
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index 23586bd..774ad04 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -51,7 +51,7 @@ u8 debug_monitors_arch(void)
static void mdscr_write(u32 mdscr)
{
unsigned long flags;
- local_dbg_save(flags);
+ flags = local_dbg_save();
asm volatile("msr mdscr_el1, %0" :: "r" (mdscr));
local_dbg_restore(flags);
}
@@ -138,6 +138,7 @@ static void clear_os_lock(void *unused)
{
asm volatile("msr oslar_el1, %0" : : "r" (0));
isb();
+ local_dbg_enable();
}
static int os_lock_notify(struct notifier_block *self,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 1/6] arm64: Add macros to manage processor debug state
2014-01-22 14:42 ` [PATCH 1/6] arm64: Add macros to manage processor debug state vijay.kilari at gmail.com
@ 2014-01-22 17:31 ` Will Deacon
2014-01-23 4:46 ` Vijay Kilari
0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2014-01-22 17:31 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
On Wed, Jan 22, 2014 at 02:42:48PM +0000, vijay.kilari at gmail.com wrote:
> From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
>
> 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>
> ---
> arch/arm64/include/asm/debug-monitors.h | 18 ++----------------
> arch/arm64/include/asm/irqflags.h | 22 ++++++++++++++++++++++
> arch/arm64/kernel/debug-monitors.c | 3 ++-
> 3 files changed, 26 insertions(+), 17 deletions(-)
>
> diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
> index 6231479..bc48880 100644
> --- a/arch/arm64/include/asm/debug-monitors.h
> +++ b/arch/arm64/include/asm/debug-monitors.h
> @@ -43,22 +43,8 @@ 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 local_dbg_enable() asm("msr daifclr, #8" : : : "memory")
> +#define local_dbg_disable() asm("msr daifset, #8" : : : "memory")
Any reason not to move these to irqflags.h too?
> #define DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */
>
> diff --git a/arch/arm64/include/asm/irqflags.h b/arch/arm64/include/asm/irqflags.h
> index b2fcfbc..f163b11 100644
> --- a/arch/arm64/include/asm/irqflags.h
> +++ b/arch/arm64/include/asm/irqflags.h
> @@ -90,5 +90,27 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
> return flags & PSR_I_BIT;
> }
>
> +/*
> + * save and restore debug state
> + */
> +static inline unsigned long local_dbg_save(void)
> +{
> + unsigned long flags;
> + asm volatile(
> + "mrs %0, daif // local_dbg_save"
> + "msr daifset, #8"
> + : "=r" (flags) : : "memory");
> + return flags;
> +}
> +
> +static inline void local_dbg_restore(unsigned long flags)
> +{
> + asm volatile(
> + "msr daif, %0 // local_dbg_restore"
> + :
> + : "r" (flags)
> + : "memory");
> +}
> +
> #endif
> #endif
> diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
> index 23586bd..774ad04 100644
> --- a/arch/arm64/kernel/debug-monitors.c
> +++ b/arch/arm64/kernel/debug-monitors.c
> @@ -51,7 +51,7 @@ u8 debug_monitors_arch(void)
> static void mdscr_write(u32 mdscr)
> {
> unsigned long flags;
> - local_dbg_save(flags);
> + flags = local_dbg_save();
Why are you changing the API? This is now pointlessly different to irqs.
Will
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/6] arm64: Add macros to manage processor debug state
2014-01-22 17:31 ` Will Deacon
@ 2014-01-23 4:46 ` Vijay Kilari
2014-01-23 9:57 ` Will Deacon
0 siblings, 1 reply; 7+ messages in thread
From: Vijay Kilari @ 2014-01-23 4:46 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jan 22, 2014 at 11:01 PM, Will Deacon <will.deacon@arm.com> wrote:
> Hello,
>
> On Wed, Jan 22, 2014 at 02:42:48PM +0000, vijay.kilari at gmail.com wrote:
>> From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
>>
>> 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>
>> ---
>> arch/arm64/include/asm/debug-monitors.h | 18 ++----------------
>> arch/arm64/include/asm/irqflags.h | 22 ++++++++++++++++++++++
>> arch/arm64/kernel/debug-monitors.c | 3 ++-
>> 3 files changed, 26 insertions(+), 17 deletions(-)
>>
>> diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
>> index 6231479..bc48880 100644
>> --- a/arch/arm64/include/asm/debug-monitors.h
>> +++ b/arch/arm64/include/asm/debug-monitors.h
>> @@ -43,22 +43,8 @@ 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 local_dbg_enable() asm("msr daifclr, #8" : : : "memory")
>> +#define local_dbg_disable() asm("msr daifset, #8" : : : "memory")
>
> Any reason not to move these to irqflags.h too?
Can me moved to irqflags.h file
>
>> #define DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */
>>
>> diff --git a/arch/arm64/include/asm/irqflags.h b/arch/arm64/include/asm/irqflags.h
>> index b2fcfbc..f163b11 100644
>> --- a/arch/arm64/include/asm/irqflags.h
>> +++ b/arch/arm64/include/asm/irqflags.h
>> @@ -90,5 +90,27 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
>> return flags & PSR_I_BIT;
>> }
>>
>> +/*
>> + * save and restore debug state
>> + */
>> +static inline unsigned long local_dbg_save(void)
>> +{
>> + unsigned long flags;
>> + asm volatile(
>> + "mrs %0, daif // local_dbg_save"
>> + "msr daifset, #8"
>> + : "=r" (flags) : : "memory");
>> + return flags;
>> +}
>> +
>> +static inline void local_dbg_restore(unsigned long flags)
>> +{
>> + asm volatile(
>> + "msr daif, %0 // local_dbg_restore"
>> + :
>> + : "r" (flags)
>> + : "memory");
>> +}
>> +
>> #endif
>> #endif
>> diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
>> index 23586bd..774ad04 100644
>> --- a/arch/arm64/kernel/debug-monitors.c
>> +++ b/arch/arm64/kernel/debug-monitors.c
>> @@ -51,7 +51,7 @@ u8 debug_monitors_arch(void)
>> static void mdscr_write(u32 mdscr)
>> {
>> unsigned long flags;
>> - local_dbg_save(flags);
>> + flags = local_dbg_save();
>
> Why are you changing the API? This is now pointlessly different to irqs.
To be in line with arch_local_irq_save & arch_local_save_flags in irqflags.h,
I moved this macros into functions and accordingly changed the caller.
I could not find any code using this local_dbg_{save, restore} except
from debug-monitors.c file
If required, I can think of renaming local_dbg_{save,restore} as
local_dbg_{save,restore}_flags
>
> Will
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/6] arm64: Add macros to manage processor debug state
2014-01-23 4:46 ` Vijay Kilari
@ 2014-01-23 9:57 ` Will Deacon
0 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2014-01-23 9:57 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jan 23, 2014 at 04:46:36AM +0000, Vijay Kilari wrote:
> On Wed, Jan 22, 2014 at 11:01 PM, Will Deacon <will.deacon@arm.com> wrote:
> >> diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
> >> index 23586bd..774ad04 100644
> >> --- a/arch/arm64/kernel/debug-monitors.c
> >> +++ b/arch/arm64/kernel/debug-monitors.c
> >> @@ -51,7 +51,7 @@ u8 debug_monitors_arch(void)
> >> static void mdscr_write(u32 mdscr)
> >> {
> >> unsigned long flags;
> >> - local_dbg_save(flags);
> >> + flags = local_dbg_save();
> >
> > Why are you changing the API? This is now pointlessly different to irqs.
>
> To be in line with arch_local_irq_save & arch_local_save_flags in irqflags.h,
> I moved this macros into functions and accordingly changed the caller.
> I could not find any code using this local_dbg_{save, restore} except
> from debug-monitors.c file
>
> If required, I can think of renaming local_dbg_{save,restore} as
> local_dbg_{save,restore}_flags
No, I'd rather local_dbg_{save, restore} were aligned with local_irq_{save,
restore} (as defined in include/linux/irqflags.h).
Will
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/6] arm64: Add macros to manage processor debug state
@ 2014-01-23 15:29 vijay.kilari at gmail.com
2014-01-24 16:39 ` Will Deacon
0 siblings, 1 reply; 7+ messages in thread
From: vijay.kilari at gmail.com @ 2014-01-23 15:29 UTC (permalink / raw)
To: linux-arm-kernel
From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
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>
---
arch/arm64/include/asm/debug-monitors.h | 17 -----------
arch/arm64/include/asm/irqflags.h | 48 +++++++++++++++++++++++++++++++
arch/arm64/kernel/debug-monitors.c | 1 +
3 files changed, 49 insertions(+), 17 deletions(-)
diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
index 6231479..ee9f28e 100644
--- a/arch/arm64/include/asm/debug-monitors.h
+++ b/arch/arm64/include/asm/debug-monitors.h
@@ -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
diff --git a/arch/arm64/include/asm/irqflags.h b/arch/arm64/include/asm/irqflags.h
index b2fcfbc..f9b013e 100644
--- a/arch/arm64/include/asm/irqflags.h
+++ b/arch/arm64/include/asm/irqflags.h
@@ -90,5 +90,53 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
return flags & PSR_I_BIT;
}
+/*
+ * save and restore debug state
+ */
+static inline unsigned long arch_local_dbg_save(void)
+{
+ unsigned long flags;
+ asm volatile(
+ "mrs %0, daif // arch_local_dbg_save"
+ "msr daifset, #8"
+ : "=r" (flags) : : "memory");
+ return flags;
+}
+
+static inline void arch_local_dbg_restore(unsigned long flags)
+{
+ asm volatile(
+ "msr daif, %0 // arch_local_dbg_restore"
+ :
+ : "r" (flags)
+ : "memory");
+}
+
+#define raw_local_dbg_save(flags) \
+ do { \
+ typecheck(unsigned long, flags); \
+ flags = arch_local_dbg_save(); \
+ } while (0)
+
+#define raw_local_dbg_restore(flags) \
+ do { \
+ typecheck(unsigned long, flags); \
+ arch_local_dbg_restore(flags); \
+ } while (0)
+
+#define local_dbg_save(flags) \
+ do { \
+ raw_local_dbg_save(flags); \
+ } while (0)
+
+#define local_dbg_restore(flags) \
+ do { \
+ typecheck(unsigned long, flags); \
+ raw_local_dbg_restore(flags); \
+ } while (0)
+
+#define local_dbg_enable() asm("msr daifclr, #8" : : : "memory")
+#define local_dbg_disable() asm("msr daifset, #8" : : : "memory")
+
#endif
#endif
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index 23586bd..a86e5b1 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)
{
asm volatile("msr oslar_el1, %0" : : "r" (0));
isb();
+ local_dbg_enable();
}
static int os_lock_notify(struct notifier_block *self,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 1/6] arm64: Add macros to manage processor debug state
2014-01-23 15:29 [PATCH 1/6] arm64: Add macros to manage processor debug state vijay.kilari at gmail.com
@ 2014-01-24 16:39 ` Will Deacon
2014-01-28 11:33 ` Vijay Kilari
0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2014-01-24 16:39 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
On Thu, Jan 23, 2014 at 03:29:07PM +0000, vijay.kilari at gmail.com wrote:
> From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
>
> 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>
> ---
> arch/arm64/include/asm/debug-monitors.h | 17 -----------
> arch/arm64/include/asm/irqflags.h | 48 +++++++++++++++++++++++++++++++
> arch/arm64/kernel/debug-monitors.c | 1 +
> 3 files changed, 49 insertions(+), 17 deletions(-)
>
> diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
> index 6231479..ee9f28e 100644
> --- a/arch/arm64/include/asm/debug-monitors.h
> +++ b/arch/arm64/include/asm/debug-monitors.h
> @@ -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
> diff --git a/arch/arm64/include/asm/irqflags.h b/arch/arm64/include/asm/irqflags.h
> index b2fcfbc..f9b013e 100644
> --- a/arch/arm64/include/asm/irqflags.h
> +++ b/arch/arm64/include/asm/irqflags.h
> @@ -90,5 +90,53 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
> return flags & PSR_I_BIT;
> }
>
> +/*
> + * save and restore debug state
> + */
> +static inline unsigned long arch_local_dbg_save(void)
> +{
> + unsigned long flags;
> + asm volatile(
> + "mrs %0, daif // arch_local_dbg_save"
> + "msr daifset, #8"
> + : "=r" (flags) : : "memory");
> + return flags;
> +}
> +
> +static inline void arch_local_dbg_restore(unsigned long flags)
> +{
> + asm volatile(
> + "msr daif, %0 // arch_local_dbg_restore"
> + :
> + : "r" (flags)
> + : "memory");
> +}
> +
> +#define raw_local_dbg_save(flags) \
> + do { \
> + typecheck(unsigned long, flags); \
> + flags = arch_local_dbg_save(); \
> + } while (0)
> +
> +#define raw_local_dbg_restore(flags) \
> + do { \
> + typecheck(unsigned long, flags); \
> + arch_local_dbg_restore(flags); \
> + } while (0)
> +
> +#define local_dbg_save(flags) \
> + do { \
> + raw_local_dbg_save(flags); \
> + } while (0)
> +
> +#define local_dbg_restore(flags) \
> + do { \
> + typecheck(unsigned long, flags); \
> + raw_local_dbg_restore(flags); \
> + } while (0)
Hehe, I think you took me a bit too literally when I said to follow what we
do for irqs. This code is arm64-specific, so you don't need to construct it
in the same way. All you need to do is *move* the existing code from
debug-monitors.h to irqflags.h. That's it!
> +#define local_dbg_enable() asm("msr daifclr, #8" : : : "memory")
> +#define local_dbg_disable() asm("msr daifset, #8" : : : "memory")
I'm also fine with adding these two.
Will
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/6] arm64: Add macros to manage processor debug state
2014-01-24 16:39 ` Will Deacon
@ 2014-01-28 11:33 ` Vijay Kilari
0 siblings, 0 replies; 7+ messages in thread
From: Vijay Kilari @ 2014-01-28 11:33 UTC (permalink / raw)
To: linux-arm-kernel
Hi Wiil,
On Fri, Jan 24, 2014 at 10:09 PM, Will Deacon <will.deacon@arm.com> wrote:
> Hello,
>
> On Thu, Jan 23, 2014 at 03:29:07PM +0000, vijay.kilari at gmail.com wrote:
>> From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
>>
>> 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>
>> ---
>> arch/arm64/include/asm/debug-monitors.h | 17 -----------
>> arch/arm64/include/asm/irqflags.h | 48 +++++++++++++++++++++++++++++++
>> arch/arm64/kernel/debug-monitors.c | 1 +
>> 3 files changed, 49 insertions(+), 17 deletions(-)
>>
>> diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
>> index 6231479..ee9f28e 100644
>> --- a/arch/arm64/include/asm/debug-monitors.h
>> +++ b/arch/arm64/include/asm/debug-monitors.h
>> @@ -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
>> diff --git a/arch/arm64/include/asm/irqflags.h b/arch/arm64/include/asm/irqflags.h
>> index b2fcfbc..f9b013e 100644
>> --- a/arch/arm64/include/asm/irqflags.h
>> +++ b/arch/arm64/include/asm/irqflags.h
>> @@ -90,5 +90,53 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
>> return flags & PSR_I_BIT;
>> }
>>
>> +/*
>> + * save and restore debug state
>> + */
>> +static inline unsigned long arch_local_dbg_save(void)
>> +{
>> + unsigned long flags;
>> + asm volatile(
>> + "mrs %0, daif // arch_local_dbg_save"
>> + "msr daifset, #8"
>> + : "=r" (flags) : : "memory");
>> + return flags;
>> +}
>> +
>> +static inline void arch_local_dbg_restore(unsigned long flags)
>> +{
>> + asm volatile(
>> + "msr daif, %0 // arch_local_dbg_restore"
>> + :
>> + : "r" (flags)
>> + : "memory");
>> +}
>> +
>> +#define raw_local_dbg_save(flags) \
>> + do { \
>> + typecheck(unsigned long, flags); \
>> + flags = arch_local_dbg_save(); \
>> + } while (0)
>> +
>> +#define raw_local_dbg_restore(flags) \
>> + do { \
>> + typecheck(unsigned long, flags); \
>> + arch_local_dbg_restore(flags); \
>> + } while (0)
>> +
>> +#define local_dbg_save(flags) \
>> + do { \
>> + raw_local_dbg_save(flags); \
>> + } while (0)
>> +
>> +#define local_dbg_restore(flags) \
>> + do { \
>> + typecheck(unsigned long, flags); \
>> + raw_local_dbg_restore(flags); \
>> + } while (0)
>
> Hehe, I think you took me a bit too literally when I said to follow what we
> do for irqs. This code is arm64-specific, so you don't need to construct it
> in the same way. All you need to do is *move* the existing code from
> debug-monitors.h to irqflags.h. That's it!
>
I have reposted the patch (v9) please review.
>> +#define local_dbg_enable() asm("msr daifclr, #8" : : : "memory")
>> +#define local_dbg_disable() asm("msr daifset, #8" : : : "memory")
>
> I'm also fine with adding these two.
>
> Will
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-01-28 11:33 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23 15:29 [PATCH 1/6] arm64: Add macros to manage processor debug state vijay.kilari at gmail.com
2014-01-24 16:39 ` Will Deacon
2014-01-28 11:33 ` Vijay Kilari
-- strict thread matches above, loose matches on Subject: below --
2014-01-22 14:42 [PATCH v7 0/6] arm64: KGDB Support vijay.kilari at gmail.com
2014-01-22 14:42 ` [PATCH 1/6] arm64: Add macros to manage processor debug state vijay.kilari at gmail.com
2014-01-22 17:31 ` Will Deacon
2014-01-23 4:46 ` Vijay Kilari
2014-01-23 9:57 ` Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).