Skip to content

Commit 404b27d

Browse files
mikeympe
authored andcommitted
powerpc: Add ppc_breakpoint_available()
Add ppc_breakpoint_available() to determine if a breakpoint is available currently via the DAWR or DABR. Signed-off-by: Michael Neuling <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 681c617 commit 404b27d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

arch/powerpc/include/asm/debug.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
4747

4848
void set_breakpoint(struct arch_hw_breakpoint *brk);
4949
void __set_breakpoint(struct arch_hw_breakpoint *brk);
50+
bool ppc_breakpoint_available(void);
5051
#ifdef CONFIG_PPC_ADV_DEBUG_REGS
5152
extern void do_send_trap(struct pt_regs *regs, unsigned long address,
5253
unsigned long error_code, int brkpt);

arch/powerpc/kernel/process.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,18 @@ void set_breakpoint(struct arch_hw_breakpoint *brk)
827827
preempt_enable();
828828
}
829829

830+
/* Check if we have DAWR or DABR hardware */
831+
bool ppc_breakpoint_available(void)
832+
{
833+
if (cpu_has_feature(CPU_FTR_DAWR))
834+
return true; /* POWER8 DAWR */
835+
if (cpu_has_feature(CPU_FTR_ARCH_207S))
836+
return false; /* POWER9 with DAWR disabled */
837+
/* DABR: Everything but POWER8 and POWER9 */
838+
return true;
839+
}
840+
EXPORT_SYMBOL_GPL(ppc_breakpoint_available);
841+
830842
#ifdef CONFIG_PPC64
831843
DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array);
832844
#endif

0 commit comments

Comments
 (0)