Implement hardware breakpoint interfaces for PowerPC BookE processors
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): [email protected]
RFC PATCH 1/1 Implement hardware breakpoint interfaces for PowerPC BookE processors
Introduce support for generic hw-breakpoint interfaces for PowerPC BookIII E processors.
Signed-off-by K.Prasad <[email protected]>
--- arch/powerpc/Kconfig | 2 arch/powerpc/include/asm/cputable.h | 4 arch/powerpc/include/asm/hw_breakpoint_booke.h | 46 ++ arch/powerpc/kernel/Makefile | 4 arch/powerpc/kernel/hw_breakpoint_booke.c | 429 +++++++++++++++++++++++++ arch/powerpc/kernel/process.c | 3 arch/powerpc/kernel/ptrace.c | 51 ++ arch/powerpc/kernel/traps.c | 9 include/linux/perf_event.h | 4 kernel/trace/trace_ksym.c | 4 10 files changed, 554 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/hw_breakpoint_booke.h new file +46 -0
@@ -0,0 +1,46 @@ +#ifndef _I386_HW_BREAKPOINT_H +#define _I386_HW_BREAKPOINT_H + +#ifdef __KERNEL__ +#define __ARCH_HW_BREAKPOINT_H + +struct arch_hw_breakpoint { +unsigned int len; +unsigned long address; +unsigned long type; +}; + +#include <linux/kdebug.h> +#include <linux/percpu.h> +#include <linux/list.h> + +/* Breakpoint length beyond which we should use 'range' breakpoints */ +#define DAC_LEN 8 +#define HW_BREAKPOINT_ALIGN 0x3 + +static inline int hw_breakpoint_slots (int type) +{ +return HBP_NUM ; +} + +struct perf_event ; +struct perf_sample_data ; +struct pmu ; + +extern int arch_check_bp_in_kernelspace (struct perf_event *bp); +extern int arch_validate_hwbkpt_settings (struct perf_event *bp); +extern int hw_breakpoint_exceptions_notify (struct notifier_block *unused, +unsigned long val,void *data); +extern void hw_breakpoint_handler (struct pt_regs *regs, +unsigned long debug_status); +int arch_install_hw_breakpoint (struct perf_event *bp); +void arch_uninstall_hw_breakpoint (struct perf_event *bp); +void hw_breakpoint_pmu_read (struct perf_event *bp); +extern void ptrace_triggered (struct perf_event *bp,int nmi, +struct perf_sample_data *data,struct pt_regs *regs); + +extern struct pmu perf_ops_bp; + +#endif /* __KERNEL__ */ +#endif /* _I386_HW_BREAKPOINT_H */ +
arch/powerpc/kernel/hw_breakpoint_booke.c new file +429 -0
429 lines not on this page · raw message
arch/powerpc/kernel/traps.c +8 -1
@@ -57,6 +57,9 @@#ifdef CONFIG_FSL_BOOKE #include <asm/dbell.h> #endif +#ifdef CONFIG_BOOKE +#include <asm/hw_breakpoint_booke.h> +#endif #if defined(CONFIG_DEBUGGER ) || defined(CONFIG_KEXEC )int (*__debugger)(struct pt_regs *regs)__read_mostly ;
@@ -1193,7 +1196,11 @@ void __kprobes DebugException(struct pt_ _exception(SIGTRAP, regs, TRAP_TRACE, regs->nip); } else -handle_debug (regs, debug_status); +#ifdef CONFIG_HAVE_HW_BREAKPOINT +hw_breakpoint_handler (regs, debug_status); +return ; +#endif /* CONFIG_HAVE_HW_BREAKPOINT */ +handle_debug (regs, debug_status); }#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
arch/powerpc/Kconfig +1 -1
@@ -141,7 +141,7 @@ config PPC select GENERIC_ATOMIC64 if PPC32 select HAVE_PERF_EVENTS select HAVE_REGS_AND_STACK_ACCESS_API - select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64 + select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (PPC_BOOK3S_64 || BOOKE)) config EARLY_PRINTK bool
arch/powerpc/kernel/Makefile +4 -0
@@ -34,7 +34,11 @@ obj-y += vdso32/ obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \ signal_64.o ptrace32.o \ paca.o nvram_64.o firmware.o +ifeq ($(CONFIG_BOOKE),y) +obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint_booke.o +else obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o +endif obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o obj64-$(CONFIG_RELOCATABLE) += reloc_64.o obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o
arch/powerpc/kernel/ptrace.c +51 -0
63 lines not on this page · raw message
arch/powerpc/include/asm/cputable.h +4 -0
@@ -517,7 +517,11 @@ static inline int cpu_has_feature(unsign }#ifdef CONFIG_HAVE_HW_BREAKPOINT +#ifdef CONFIG_BOOKE +#define HBP_NUM 2 +#else #define HBP_NUM 1 +#endif /* CONFIG_BOOKE */ #endif /* CONFIG_HAVE_HW_BREAKPOINT */ #endif /* !__ASSEMBLY__ */
include/linux/perf_event.h +4 -0
@@ -470,7 +470,11 @@ struct perf_guest_info_callbacks { };#ifdef CONFIG_HAVE_HW_BREAKPOINT +#ifdef CONFIG_BOOKE +#include <asm/hw_breakpoint_booke.h> +#else #include <asm/hw_breakpoint.h> +#endif /* CONFIG_BOOKE */ #endif #include <linux/list.h>
arch/powerpc/kernel/process.c +3 -0
@@ -329,6 +329,7 @@ static void prime_debug_regs(struct thremtspr (SPRN_IAC3 , thread->iac3);mtspr (SPRN_IAC4 , thread->iac4);#endif +#ifndef CONFIG_HAVE_HW_BREAKPOINT mtspr (SPRN_DAC1 , thread->dac1);mtspr (SPRN_DAC2 , thread->dac2);#if CONFIG_PPC_ADV_DEBUG_DVCS >0
@@ -340,7 +341,9 @@ static void prime_debug_regs(struct thre#ifdef CONFIG_BOOKE mtspr (SPRN_DBCR2 , thread->dbcr2);#endif +#endif /* CONFIG_HAVE_HW_BREAKPOINT */ } +/* * Unless neither the old or new thread are making use of the * debug registers, set the debug registers from the values
kernel/trace/trace_ksym.c +4 -0
@@ -30,7 +30,11 @@#include "trace.h" #include <linux/hw_breakpoint.h> +#ifdef CONFIG_BOOKE +#include <asm/hw_breakpoint_booke.h> +#else /* CONFIG_BOOKE */ #include <asm/hw_breakpoint.h> +#endif /* CONFIG_BOOKE */ #include <asm/atomic.h>