Skip to content

Commit d7ba979

Browse files
Dongdong Dengjwessel
authored andcommitted
debug_core,x86,blackfin: Clean up hw debug disable API
The kgdb_disable_hw_debug() was an architecture specific function for disabling all hardware breakpoints on a per cpu basis when entering the debug core. This patch will remove the weak function kdbg_disable_hw_debug() and change it into a call back which lives with the rest of hw breakpoint call backs in struct kgdb_arch. Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
1 parent 578bd4d commit d7ba979

File tree

4 files changed

+10
-25
lines changed

4 files changed

+10
-25
lines changed

arch/blackfin/kernel/kgdb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ static void bfin_correct_hw_break(void)
320320
}
321321
}
322322

323-
void kgdb_disable_hw_debug(struct pt_regs *regs)
323+
static void bfin_disable_hw_debug(struct pt_regs *regs)
324324
{
325325
/* Disable hardware debugging while we are in kgdb */
326326
bfin_write_WPIACTL(0);
@@ -406,6 +406,7 @@ struct kgdb_arch arch_kgdb_ops = {
406406
#endif
407407
.set_hw_breakpoint = bfin_set_hw_break,
408408
.remove_hw_breakpoint = bfin_remove_hw_break,
409+
.disable_hw_break = bfin_disable_hw_debug,
409410
.remove_all_hw_break = bfin_remove_all_hw_break,
410411
.correct_hw_break = bfin_correct_hw_break,
411412
};

arch/x86/kernel/kgdb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ kgdb_set_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype)
387387
* disable hardware debugging while it is processing gdb packets or
388388
* handling exception.
389389
*/
390-
void kgdb_disable_hw_debug(struct pt_regs *regs)
390+
static void kgdb_disable_hw_debug(struct pt_regs *regs)
391391
{
392392
int i;
393393
int cpu = raw_smp_processor_id();
@@ -724,6 +724,7 @@ struct kgdb_arch arch_kgdb_ops = {
724724
.flags = KGDB_HW_BREAKPOINT,
725725
.set_hw_breakpoint = kgdb_set_hw_break,
726726
.remove_hw_breakpoint = kgdb_remove_hw_break,
727+
.disable_hw_break = kgdb_disable_hw_debug,
727728
.remove_all_hw_break = kgdb_remove_all_hw_break,
728729
.correct_hw_break = kgdb_correct_hw_break,
729730
};

include/linux/kgdb.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@ struct pt_regs;
3535
*/
3636
extern int kgdb_skipexception(int exception, struct pt_regs *regs);
3737

38-
/**
39-
* kgdb_disable_hw_debug - (optional) Disable hardware debugging hook
40-
* @regs: Current &struct pt_regs.
41-
*
42-
* This function will be called if the particular architecture must
43-
* disable hardware debugging while it is processing gdb packets or
44-
* handling exception.
45-
*/
46-
extern void kgdb_disable_hw_debug(struct pt_regs *regs);
47-
4838
struct tasklet_struct;
4939
struct task_struct;
5040
struct uart_port;
@@ -243,6 +233,8 @@ extern void kgdb_arch_late(void);
243233
* breakpoint.
244234
* @remove_hw_breakpoint: Allow an architecture to specify how to remove a
245235
* hardware breakpoint.
236+
* @disable_hw_break: Allow an architecture to specify how to disable
237+
* hardware breakpoints for a single cpu.
246238
* @remove_all_hw_break: Allow an architecture to specify how to remove all
247239
* hardware breakpoints.
248240
* @correct_hw_break: Allow an architecture to specify how to correct the
@@ -256,6 +248,7 @@ struct kgdb_arch {
256248
int (*remove_breakpoint)(unsigned long, char *);
257249
int (*set_hw_breakpoint)(unsigned long, int, enum kgdb_bptype);
258250
int (*remove_hw_breakpoint)(unsigned long, int, enum kgdb_bptype);
251+
void (*disable_hw_break)(struct pt_regs *regs);
259252
void (*remove_all_hw_break)(void);
260253
void (*correct_hw_break)(void);
261254
};

kernel/debug/debug_core.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,18 +209,6 @@ int __weak kgdb_skipexception(int exception, struct pt_regs *regs)
209209
return 0;
210210
}
211211

212-
/**
213-
* kgdb_disable_hw_debug - Disable hardware debugging while we in kgdb.
214-
* @regs: Current &struct pt_regs.
215-
*
216-
* This function will be called if the particular architecture must
217-
* disable hardware debugging while it is processing gdb packets or
218-
* handling exception.
219-
*/
220-
void __weak kgdb_disable_hw_debug(struct pt_regs *regs)
221-
{
222-
}
223-
224212
/*
225213
* Some architectures need cache flushes when we set/clear a
226214
* breakpoint:
@@ -484,7 +472,9 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs,
484472
atomic_inc(&masters_in_kgdb);
485473
else
486474
atomic_inc(&slaves_in_kgdb);
487-
kgdb_disable_hw_debug(ks->linux_regs);
475+
476+
if (arch_kgdb_ops.disable_hw_break)
477+
arch_kgdb_ops.disable_hw_break(regs);
488478

489479
acquirelock:
490480
/*

0 commit comments

Comments
 (0)