kgdb 2.6.27 merge
Subsystems (4)
Linus, please pull kgdb the kgdb git tree.
Summary:
- Add ARCH=arm kgdb support
- Add ARCH=powerpc kgdb support
- Add 2 more rs232 polled drivers for use with kgdboc
- Remove Kconfig option for a non-merged architecture
Details:
The ARCH=arm support was reviewed by rmk and changes were made during the 2.6.26 development cycle and it has been in the linux-next tree for some time. The original author has also acked this work now.
The powerpc kgdb code removes the left over pieces of the old ARCH=ppc kgdb stub.
The kgdb test suite is known to pass correctly arm and powerpc.
Jason.
The following changes since commit c010b2f76c3032e48097a6eef291d8593d5d79a6:
Linus Torvalds (1):
Merge git://git.kernel.org/.../davem/net-2.6
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb.git for_linus
Jason Wessel (5):
kgdb: remove unused HAVE_ARCH_KGDB_SHADOW_INFO config variable
kgdb: support for ARCH=arm
kgdb, powerpc: arch specific powerpc kgdb support
kgdb: kgdboc console poll hooks for cpm uart
kgdb: kgdboc console poll hooks for mpsc uart
arch/arm/Kconfig | 1 + arch/arm/kernel/Makefile | 1 + arch/arm/kernel/kgdb.c | 201 +++++++++++++++ arch/arm/kernel/setup.c | 2 + arch/arm/kernel/traps.c | 5 + arch/powerpc/Kconfig | 1 + arch/powerpc/Kconfig.debug | 50 +---- arch/powerpc/kernel/Makefile | 1 + arch/powerpc/kernel/kgdb.c | 410 +++++++++++++++++++++++++++++++ arch/powerpc/kernel/setup_32.c | 16 -- arch/powerpc/platforms/powermac/setup.c | 6 - drivers/serial/cpm_uart/cpm_uart_core.c | 95 +++++++- drivers/serial/mpsc.c | 148 +++++++++++- include/asm-arm/kgdb.h | 104 ++++++++ include/asm-arm/traps.h | 2 + include/asm-powerpc/kgdb.h | 92 ++++---- lib/Kconfig.kgdb | 3 - 17 files changed, 1025 insertions(+), 113 deletions(-) create mode 100644 arch/arm/kernel/kgdb.c create mode 100644 arch/powerpc/kernel/kgdb.c create mode 100644 include/asm-arm/kgdb.h
PATCH 1/5 kgdb: remove unused HAVE_ARCH_KGDB_SHADOW_INFO config variable
Remove HAVE_ARCH_KGDB_SHADOW_INFO because it does not exist anywhere in the kernel mainline sources
--- lib/Kconfig.kgdb | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
lib/Kconfig.kgdb +0 -3
@@ -1,7 +1,4 @@ -config HAVE_ARCH_KGDB_SHADOW_INFO - bool - config HAVE_ARCH_KGDB bool
Signature · 1 line
1.5.5.1
PATCH 2/5 kgdb: support for ARCH=arm
This patch adds the ARCH=arm specific a kgdb backend, originally written by Deepak Saxena <[email protected]> and George Davis <[email protected]>. Geoff Levand <[email protected]>, Nicolas Pitre, Manish Lachwani, and Jason Wessel have contributed various fixups here as well.
The KGDB patch makes one change to the core ARM architecture such that the traps are initialized early for use with the debugger or other subsystems.
[ [email protected]: small cleanups. ]
[ [email protected]: fixed early_trap_init ]
--- arch/arm/Kconfig | 1 + arch/arm/kernel/Makefile | 1 + arch/arm/kernel/kgdb.c | 201 ++++++++++++++++++++++++++++++++++++++++++++++ arch/arm/kernel/setup.c | 2 + arch/arm/kernel/traps.c | 5 + include/asm-arm/kgdb.h | 104 ++++++++++++++++++++++++ include/asm-arm/traps.h | 2 + 7 files changed, 316 insertions(+), 0 deletions(-) create mode 100644 arch/arm/kernel/kgdb.c create mode 100644 include/asm-arm/kgdb.h
arch/arm/Kconfig +1 -0
@@ -12,6 +12,7 @@ config ARM select RTC_LIB select SYS_SUPPORTS_APM_EMULATION select HAVE_OPROFILE + select HAVE_ARCH_KGDB select HAVE_KPROBES if (!XIP_KERNEL) select HAVE_KRETPROBES if (HAVE_KPROBES) select HAVE_FTRACE if (!XIP_KERNEL)
arch/arm/kernel/Makefile +1 -0
@@ -28,6 +28,7 @@ obj-$(CONFIG_KPROBES) += kprobes.o kprobes-decode.o obj-$(CONFIG_ATAGS_PROC) += atags.o obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o obj-$(CONFIG_ARM_THUMBEE) += thumbee.o +obj-$(CONFIG_KGDB) += kgdb.o obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312
arch/arm/kernel/kgdb.c new file +201 -0
201 lines not on this page · raw message
arch/arm/kernel/setup.c +2 -0
@@ -36,6 +36,7 @@#include <asm/mach/arch.h> #include <asm/mach/irq.h> #include <asm/mach/time.h> +#include <asm/traps.h> #include "compat.h" #include "atags.h"
@@ -853,6 +854,7 @@ void __init setup_arch(char **cmdline_p) conswitchp = &dummy_con;#endif #endif +early_trap_init (); }
arch/arm/kernel/traps.c +5 -0
@@ -708,6 +708,11 @@ EXPORT_SYMBOL(abort);void __init trap_init (void ) { +return ; +} + +void __init early_trap_init (void ) +{unsigned long vectors =CONFIG_VECTORS_BASE ;extern char __stubs_start[], __stubs_end[];extern char __vectors_start[], __vectors_end[];
include/asm-arm/kgdb.h new file +104 -0
104 lines not on this page · raw message
include/asm-arm/traps.h +2 -0
@@ -24,4 +24,6 @@ static inline int in_exception_text(unsigned long ptr) ptr < (unsigned long)&__exception_text_end; } +extern void __init early_trap_init (void ); +#endif
Signature · 1 line
1.5.5.1
PATCH 3/5 kgdb, powerpc: arch specific powerpc kgdb support
This patch removes the old kgdb reminants from ARCH=powerpc and implements the new style arch specific stub for the common kgdb core interface.
It is possible to have xmon and kgdb in the same kernel, but you cannot use both at the same time because there is only one set of debug hooks.
The arch specific kgdb implementation saves the previous state of the debug hooks and restores them if you unconfigure the kgdb I/O driver. Kgdb should have no impact on a kernel that has no kgdb I/O driver configured.
--- arch/powerpc/Kconfig | 1 + arch/powerpc/Kconfig.debug | 50 +---- arch/powerpc/kernel/Makefile | 1 + arch/powerpc/kernel/kgdb.c | 410 +++++++++++++++++++++++++++++++ arch/powerpc/kernel/setup_32.c | 16 -- arch/powerpc/platforms/powermac/setup.c | 6 - include/asm-powerpc/kgdb.h | 92 ++++---- 7 files changed, 468 insertions(+), 108 deletions(-) create mode 100644 arch/powerpc/kernel/kgdb.c
arch/powerpc/Kconfig +1 -0
@@ -112,6 +112,7 @@ config PPC select HAVE_FTRACE select HAVE_IDE select HAVE_KPROBES + select HAVE_ARCH_KGDB select HAVE_KRETPROBES select HAVE_LMB select HAVE_DMA_ATTRS if PPC64
arch/powerpc/Kconfig.debug +6 -44
70 lines not on this page · raw message
arch/powerpc/kernel/Makefile +1 -0
@@ -74,6 +74,7 @@ obj-y += time.o prom.o traps.o setup-common.o \ misc_$(CONFIG_WORD_SIZE).o obj-$(CONFIG_PPC32) += entry_32.o setup_32.o obj-$(CONFIG_PPC64) += dma_64.o iommu.o +obj-$(CONFIG_KGDB) += kgdb.o obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o obj-$(CONFIG_MODULES) += ppc_ksyms.o obj-$(CONFIG_BOOTX_TEXT) += btext.o
arch/powerpc/kernel/kgdb.c new file +410 -0
410 lines not on this page · raw message
arch/powerpc/kernel/setup_32.c +0 -16
@@ -43,10 +43,6 @@ #define DBG(fmt...) -#if definedCONFIG_KGDB -#include <asm/kgdb.h> -#endif -extern void bootx_init (unsigned long r4,unsigned long phys);int boot_cpuid;
@@ -302,18 +298,6 @@ void __init setup_arch(char **cmdline_p)xmon_setup (); -#if defined(CONFIG_KGDB ) -if (ppc_md.kgdb_map_scc) - ppc_md.kgdb_map_scc (); -set_debug_traps (); -if (strstr (cmd_line,"gdb" )) { -if (ppc_md.progress) - ppc_md.progress ("setup_arch: kgdb breakpoint" ,0x4000 ); -printk ("kgdb breakpoint activated\n" ); -breakpoint (); - } -#endif -/* * Set cache line size based on type of cpu as a default. * Systems with OF can look in the properties on the cpu node(s)
arch/powerpc/platforms/powermac/setup.c +0 -6
@@ -97,8 +97,6 @@ extern struct machdep_calls pmac_md;int sccdbg;#endif -extern void zs_kgdb_hook (int tty_num); -sys_ctrler_t sys_ctrler =SYS_CTRLER_UNKNOWN ;EXPORT_SYMBOL (sys_ctrler);
@@ -329,10 +327,6 @@ static void __init pmac_setup_arch(void)l2cr_init ();#endif /* CONFIG_PPC32 */ -#ifdef CONFIG_KGDB -zs_kgdb_hook (0 ); -#endif -find_via_cuda ();find_via_pmu ();smu_init ();
include/asm-powerpc/kgdb.h +50 -42
107 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH 4/5 kgdb: kgdboc console poll hooks for cpm uart
Add in console polling hooks for the cpm uart for use with kgdb and kgdboc.
--- drivers/serial/cpm_uart/cpm_uart_core.c | 95 ++++++++++++++++++++++++++++++- 1 files changed, 94 insertions(+), 1 deletions(-)
drivers/serial/cpm_uart/cpm_uart_core.c +94 -1
@@ -201,6 +201,10 @@ static void cpm_uart_int_tx(struct uart_port *port)cpm_uart_tx_pump (port); } +#ifdef CONFIG_CONSOLE_POLL +static int serial_polled; +#endif +/* * Receive characters */
@@ -222,6 +226,12 @@ static void cpm_uart_int_rx(struct uart_port *port)*/ bdp = pinfo->rx_cur;for (;;) { +#ifdef CONFIG_CONSOLE_POLL +if (unlikely (serial_polled)) { + serial_polled =0 ; +return ; + } +#endif /* get status */ status =in_be16 (&bdp->cbd_sc);/* If this one is empty, return happy */
@@ -253,7 +263,12 @@ static void cpm_uart_int_rx(struct uart_port *port) goto handle_error;if (uart_handle_sysrq_char (port, ch))continue ; - +#ifdef CONFIG_CONSOLE_POLL +if (unlikely (serial_polled)) { + serial_polled =0 ; +return ; + } +#endif error_return:tty_insert_flip_char (tty, ch, flg);
@@ -865,6 +880,80 @@ static void cpm_uart_config_port(struct uart_port *port, int flags)cpm_uart_request_port (port); } } + +#ifdef CONFIG_CONSOLE_POLL +/* Serial polling routines for writing and reading from the uart while +* in an interrupt or debug context. +*/ + +#define GDB_BUF_SIZE 512/* power of 2, please */ + +static char poll_buf[GDB_BUF_SIZE ]; +static char *pollp; +static int poll_chars; + +static int poll_wait_key (char *obuf,struct uart_cpm_port *pinfo) +{ +u_char c, *cp; +volatile cbd_t *bdp; +int i; + +/* Get the address of the host memory buffer. +*/ + bdp = pinfo->rx_cur; +while (bdp->cbd_sc &BD_SC_EMPTY ) + ; + +/* If the buffer address is in the CPM DPRAM, don't +* convert it. +*/ + cp =cpm2cpu_addr (bdp->cbd_bufaddr, pinfo); + +if (obuf) { + i = c = bdp->cbd_datlen; +while (i-- >0 ) + *obuf++ = *cp++; + }else + c = *cp; + bdp->cbd_sc &= ~(BD_SC_BR |BD_SC_FR |BD_SC_PR |BD_SC_OV |BD_SC_ID ); + bdp->cbd_sc |=BD_SC_EMPTY ; + +if (bdp->cbd_sc &BD_SC_WRAP ) + bdp = pinfo->rx_bd_base; +else + bdp++; + pinfo->rx_cur = (cbd_t *)bdp; + +return (int )c; +} + +static int cpm_get_poll_char (struct uart_port *port) +{ +struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; + +if (!serial_polled) { + serial_polled =1 ; + poll_chars =0 ; + } +if (poll_chars <=0 ) { + poll_chars =poll_wait_key (poll_buf, pinfo); + pollp = poll_buf; + } + poll_chars--; +return *pollp++; +} + +static void cpm_put_poll_char (struct uart_port *port, +unsigned char c) +{ +struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; +static char ch[2 ]; + + ch[0 ] = (char )c; +cpm_uart_early_write (pinfo->port.line, ch,1 ); +} +#endif /* CONFIG_CONSOLE_POLL */ +static struct uart_ops cpm_uart_pops = { .tx_empty = cpm_uart_tx_empty, .set_mctrl = cpm_uart_set_mctrl,
@@ -882,6 +971,10 @@ static struct uart_ops cpm_uart_pops = { .request_port = cpm_uart_request_port, .config_port = cpm_uart_config_port, .verify_port = cpm_uart_verify_port, +#ifdef CONFIG_CONSOLE_POLL + .poll_get_char = cpm_get_poll_char, + .poll_put_char = cpm_put_poll_char, +#endif };struct uart_cpm_port cpm_uart_ports[UART_NR ];
Signature · 1 line
1.5.5.1
PATCH 5/5 kgdb: kgdboc console poll hooks for mpsc uart
Add in console polling hooks for the mpsc uart for use with kgdb and kgdboc.
--- drivers/serial/mpsc.c | 148 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 147 insertions(+), 1 deletions(-)
drivers/serial/mpsc.c +147 -1
@@ -921,6 +921,10 @@ static int mpsc_make_ready(struct mpsc_port_info *pi)return 0 ; } +#ifdef CONFIG_CONSOLE_POLL +static int serial_polled; +#endif +/* ****************************************************************************** *
@@ -956,7 +960,12 @@ static int mpsc_rx_intr(struct mpsc_port_info *pi)while (!((cmdstat =be32_to_cpu (rxre->cmdstat)) &SDMA_DESC_CMDSTAT_O )) { bytes_in =be16_to_cpu (rxre->bytecnt); - +#ifdef CONFIG_CONSOLE_POLL +if (unlikely (serial_polled)) { + serial_polled =0 ; +return 0 ; + } +#endif /* Following use of tty struct directly is deprecated */ if (unlikely (tty_buffer_request_room (tty, bytes_in) < bytes_in)) {
@@ -1017,6 +1026,12 @@ static int mpsc_rx_intr(struct mpsc_port_info *pi)if (uart_handle_sysrq_char (&pi->port, *bp)) { bp++; bytes_in--; +#ifdef CONFIG_CONSOLE_POLL +if (unlikely (serial_polled)) { + serial_polled =0 ; +return 0 ; + } +#endif goto next_frame; }
@@ -1519,6 +1534,133 @@ static int mpsc_verify_port(struct uart_port *port, struct serial_struct *ser)return rc; } +#ifdef CONFIG_CONSOLE_POLL +/* Serial polling routines for writing and reading from the uart while +* in an interrupt or debug context. +*/ + +static char poll_buf[2048 ]; +static int poll_ptr; +static int poll_cnt; +static void mpsc_put_poll_char (struct uart_port *port, +unsigned char c); + +static int mpsc_get_poll_char (struct uart_port *port) +{ +struct mpsc_port_info *pi = (struct mpsc_port_info *)port; +struct mpsc_rx_desc *rxre; +u32 cmdstat, bytes_in, i; +u8 *bp; + +if (!serial_polled) + serial_polled =1 ; + +pr_debug ("mpsc_rx_intr[%d]: Handling Rx intr\n" , pi->port.line); + +if (poll_cnt) { + poll_cnt--; +return poll_buf[poll_ptr++]; + } + poll_ptr =0 ; + poll_cnt =0 ; + +while (poll_cnt ==0 ) { + rxre = (struct mpsc_rx_desc *)(pi->rxr + + (pi->rxr_posn*MPSC_RXRE_SIZE )); +dma_cache_sync (pi->port.dev, (void *)rxre, +MPSC_RXRE_SIZE ,DMA_FROM_DEVICE ); +#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE ) +if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */ +invalidate_dcache_range ((ulong )rxre, + (ulong )rxre +MPSC_RXRE_SIZE ); +#endif +/* +* Loop through Rx descriptors handling ones that have +* been completed. +*/ +while (poll_cnt ==0 && + !((cmdstat =be32_to_cpu (rxre->cmdstat)) & +SDMA_DESC_CMDSTAT_O )){ + bytes_in =be16_to_cpu (rxre->bytecnt); + bp = pi->rxb + (pi->rxr_posn *MPSC_RXBE_SIZE ); +dma_cache_sync (pi->port.dev, (void *) bp, +MPSC_RXBE_SIZE ,DMA_FROM_DEVICE ); +#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE ) +if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */ +invalidate_dcache_range ((ulong )bp, + (ulong )bp +MPSC_RXBE_SIZE ); +#endif +if ((unlikely (cmdstat & (SDMA_DESC_CMDSTAT_BR | +SDMA_DESC_CMDSTAT_FR |SDMA_DESC_CMDSTAT_OR ))) && + !(cmdstat & pi->port.ignore_status_mask)) { + poll_buf[poll_cnt] = *bp; + poll_cnt++; + }else { +for (i =0 ; i < bytes_in; i++) { + poll_buf[poll_cnt] = *bp++; + poll_cnt++; + } + pi->port.icount.rx += bytes_in; + } + rxre->bytecnt =cpu_to_be16 (0 ); +wmb (); + rxre->cmdstat =cpu_to_be32 (SDMA_DESC_CMDSTAT_O | +SDMA_DESC_CMDSTAT_EI | +SDMA_DESC_CMDSTAT_F | +SDMA_DESC_CMDSTAT_L ); +wmb (); +dma_cache_sync (pi->port.dev, (void *)rxre, +MPSC_RXRE_SIZE ,DMA_BIDIRECTIONAL ); +#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE ) +if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */ +flush_dcache_range ((ulong )rxre, + (ulong )rxre +MPSC_RXRE_SIZE ); +#endif + +/* Advance to next descriptor */ + pi->rxr_posn = (pi->rxr_posn +1 ) & + (MPSC_RXR_ENTRIES -1 ); + rxre = (struct mpsc_rx_desc *)(pi->rxr + + (pi->rxr_posn *MPSC_RXRE_SIZE )); +dma_cache_sync (pi->port.dev, (void *)rxre, +MPSC_RXRE_SIZE ,DMA_FROM_DEVICE ); +#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE ) +if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */ +invalidate_dcache_range ((ulong )rxre, + (ulong )rxre +MPSC_RXRE_SIZE ); +#endif + } + +/* Restart rx engine, if its stopped */ +if ((readl (pi->sdma_base +SDMA_SDCM ) &SDMA_SDCM_ERD ) ==0 ) +mpsc_start_rx (pi); + } +if (poll_cnt) { + poll_cnt--; +return poll_buf[poll_ptr++]; + } + +return 0 ; +} + + +static void mpsc_put_poll_char (struct uart_port *port, +unsigned char c) +{ +struct mpsc_port_info *pi = (struct mpsc_port_info *)port; +u32 data; + + data =readl (pi->mpsc_base +MPSC_MPCR ); +writeb (c, pi->mpsc_base +MPSC_CHR_1 ); +mb (); + data =readl (pi->mpsc_base +MPSC_CHR_2 ); + data |=MPSC_CHR_2_TTCS ; +writel (data, pi->mpsc_base +MPSC_CHR_2 ); +mb (); + +while (readl (pi->mpsc_base +MPSC_CHR_2 ) &MPSC_CHR_2_TTCS ); +} +#endif static struct uart_ops mpsc_pops = { .tx_empty = mpsc_tx_empty,
@@ -1537,6 +1679,10 @@ static struct uart_ops mpsc_pops = { .request_port = mpsc_request_port, .config_port = mpsc_config_port, .verify_port = mpsc_verify_port, +#ifdef CONFIG_CONSOLE_POLL + .poll_get_char = mpsc_get_poll_char, + .poll_put_char = mpsc_put_poll_char, +#endif };/*
Signature · 1 line
1.5.5.1