Hooks for the kgdb core for registration of the drm layer to provide a
call backs so as to perform kernel mode switching, for use with kdb.
CC: Jesse Barnes <jbarnes at virtuousgeek.org>
Signed-off-by: Jason Wessel <jason.wessel at windriver.com>
---
drivers/serial/kgdboc.c | 15 +++++++++++++++
include/linux/kgdb.h | 6 ++++++
kernel/debug/debug_core.c | 23 +++++++++++++++++++++++
3 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/drivers/serial/kgdboc.c b/drivers/serial/kgdboc.c
index 217c9a2..34b0306 100644
--- a/drivers/serial/kgdboc.c
+++ b/drivers/serial/kgdboc.c
@@ -26,6 +26,7 @@ static struct kgdb_io kgdboc_io_ops;
/* -1 = init not run yet, 0 = unconfigured, 1 = configured. */
static int configured = -1;
static int kgdboc_use_kbd; /* 1 if we use a keyboard */
+static int kgdboc_use_kms; /* 1 if we use kernel mode switching */
static char config[MAX_CONFIG_LEN];
static struct kparam_string kps = {
@@ -85,6 +86,11 @@ static int configure_kgdboc(void)
kgdboc_io_ops.is_console = 0;
kgdboc_use_kbd = 0;
+ kgdboc_use_kms = 0;
+ if (strncmp(cptr, "kms,", 4) == 0) {
+ cptr += 4;
+ kgdboc_use_kms = 1;
+ }
#ifdef CONFIG_KDB_KEYBOARD
kgdb_tty_driver = NULL;
@@ -200,6 +206,11 @@ static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp)
static void kgdboc_pre_exp_handler(void)
{
+ if (kgdboc_use_kms && dbg_kms_console_core &&
+ dbg_kms_console_core->activate_console)
+ if (dbg_kms_console_core->activate_console())
+ printk(KERN_ERR "kgdboc: kernel mode switch error\n");
+
/* Increment the module count when the debugger is active */
if (!kgdb_connected)
try_module_get(THIS_MODULE);
@@ -210,6 +221,10 @@ static void kgdboc_post_exp_handler(void)
/* decrement the module count when the debugger detaches */
if (!kgdb_connected)
module_put(THIS_MODULE);
+ if (kgdboc_use_kms && dbg_kms_console_core &&
+ dbg_kms_console_core->restore_console)
+ if (dbg_kms_console_core->restore_console())
+ printk(KERN_ERR "kgdboc: graphics restore failed\n");
#ifdef CONFIG_KDB_KEYBOARD
/* If using the kdb keyboard driver release all the keys. */
if (kgdboc_use_kbd)
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 619019a..5ce1158 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -308,6 +308,12 @@ extern int kgdb_single_step;
extern atomic_t kgdb_active;
extern void kgdb_schedule_breakpoint(void);
+struct dbg_kms_console_ops {
+ int (*activate_console) (void);
+ int (*restore_console) (void);
+};
+extern struct dbg_kms_console_ops *dbg_kms_console_core;
+
#ifdef CONFIG_KGDB_SERIAL_CONSOLE
extern void __init early_kgdboc_init(void);
#endif /* CONFIG_KGDB_SERIAL_CONSOLE */
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
index b28a0a4..14d7c4e 100644
--- a/kernel/debug/debug_core.c
+++ b/kernel/debug/debug_core.c
@@ -782,6 +782,29 @@ static void kgdb_register_callbacks(void)
}
}
+struct dbg_kms_console_ops *dbg_kms_console_core;
+EXPORT_SYMBOL_GPL(dbg_kms_console_core);
+
+int dbg_kms_console_ops_register(struct dbg_kms_console_ops *ops)
+{
+ if (dbg_kms_console_core) {
+ printk(KERN_ERR "dbg_core: KMS ops already in use\n");
+ return -1;
+ }
+ dbg_kms_console_core = ops;
+ return 0;
+}
+EXPORT_SYMBOL_GPL(dbg_kms_console_ops_register);
+
+int dbg_kms_console_ops_unregister(struct dbg_kms_console_ops *ops)
+{
+ if (dbg_kms_console_core != ops)
+ printk(KERN_ERR "dbg_core: KMS ops do not match\n");
+ dbg_kms_console_core = NULL;
+ return 0;
+}
+EXPORT_SYMBOL_GPL(dbg_kms_console_ops_unregister);
+
static void kgdb_unregister_callbacks(void)
{
/*
--
1.6.4.rc1
- References:
- [PATCH 0/37] kgdb, kdb and atomic kernel modesetting series
- [PATCH 01/37] softlockup: add sched_clock_tick() to avoid kernel warning on kgdb resume
- [PATCH 02/37] x86, hw_breakpoint, kgdb: kgdb to use hw_breakpoint API
- [PATCH 03/37] Move kernel/kgdb.c to kernel/debug/debug_core.c
- [PATCH 04/37] Separate the gdbstub from the debug core
- [PATCH 05/37] kdb: core for kgdb back end
- [PATCH 06/37] kgdb: eliminate kgdb_wait(), all cpus enter the same way
- [PATCH 07/37] kgdb,sparc: Add in kgdb_arch_set_pc for sparc
- [PATCH 08/37] kgdb, sh: update superh kgdb exception handling
- [PATCH 09/37] kgdb, blackfin: Add in kgdb_arch_set_pc for blackfin
- [PATCH 10/37] kgdb: Make mem access function weak in kgdb.c and kgdb.h
- [PATCH 11/37] kgdb: Fix kernel-doc format error in kgdb.h
- [PATCH 12/37] kgdb: core changes to support kdb
- [PATCH 13/37] kgdb, 8250, pl011: Return immediately from console poll
- [PATCH 14/37] sh, sh-sci: Use NO_POLL_CHAR in the SCIF polled console code
- [PATCH 15/37] sparc, sunzilog: Add console polling support for sunzilog serial driver
- [PATCH 16/37] kgdb: gdb "monitor" -> kdb passthrough
- [PATCH 17/37] kgdboc, keyboard: Keyboard driver for kdb with kgdb
- [PATCH 18/37] kgdb: remove post_primary_code references
- [PATCH 19/37] x86,kgdb: Add low level debug hook
- [PATCH 20/37] arm, kgdb: Add hook to catch an oops with debugger
- [PATCH 21/37] powerpc, kgdb: Introduce low level trap catching
- [PATCH 22/37] mips, kgdb: kdb low level trap catch and stack trace
- [PATCH 23/37] kgdb: Add the ability to schedule a breakpoint via a tasklet
- [PATCH 24/37] kgdboc, kdb: Allow kdb to work on a non open console port
- [PATCH 25/37] printk, kdb: capture printk() when in kdb shell
- [PATCH 26/37] keyboard, input: Add hook to input to allow low level event clear
- [PATCH 27/37] debug_core, kdb: Allow the debug core to process a recursive debug entry
- [PATCH 28/37] kdb, panic, debug_core: Allow the debug core to receive a panic before smp_send_stop()
- [PATCH 29/37] MAINTAINERS: update kgdb, kdb, and debug_core info
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]