kgdb smp support
PATCH 1/1 kgdb smp support
This patch adds some essential part for kgdb support on a SMP machine.
Much of the patch is contributed by Kip Walker.
I have tested it well on UP machines just to make sure UP does not break.
Comments? Objections?
Jun
arch/mips/kernel/smp.c renamed from arch/mips/kernel/smp.c.orig +3 -3
@@ -133,7 +133,7 @@core_send_ipi (cpu,SMP_RESCHEDULE_YOURSELF ); } -static spinlock_t call_lock =SPIN_LOCK_UNLOCKED ; +spinlock_t smp_call_lock =SPIN_LOCK_UNLOCKED ;struct call_data_struct *call_data;
@@ -165,7 +165,7 @@if (wait)atomic_set (&data.finished,0 ); -spin_lock (&call_lock); +spin_lock (&smp_call_lock); call_data = &data;/* Send a message to all other CPUs and wait for them to respond */
@@ -181,7 +181,7 @@if (wait)while (atomic_read (&data.finished) != cpus)barrier (); -spin_unlock (&call_lock); +spin_unlock (&smp_call_lock);return 0 ; }
arch/mips/kernel/gdb-stub.c renamed from arch/mips/kernel/gdb-stub.c.orig +129 -33
258 lines not on this page · raw message
arch/mips/sibyte/sb1250/irq.c renamed from arch/mips/sibyte/sb1250/irq.c.orig +16 -8
@@ -1,5 +1,5 @@/* -* Copyright (C) 2000, 2001 Broadcom Corporation +* Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License
@@ -23,6 +23,7 @@#include <linux/spinlock.h> #include <linux/mm.h> #include <linux/slab.h> +#include <linux/kernel_stat.h> #include <asm/errno.h> #include <asm/signal.h>
@@ -61,12 +62,14 @@#ifdef CONFIG_KGDB extern void breakpoint (void );extern void set_debug_traps (void ); +static int kgdb_irq;/* kgdb is on when configured. Pass "nokgdb" kernel arg to turn it off */ static int kgdb_flag =1 ;static int __init nokgdb (char *str) { kgdb_flag =0 ; +return 1 ; }__setup ("nokgdb" , nokgdb);#endif
@@ -377,15 +380,19 @@#ifdef CONFIG_KGDB if (kgdb_flag) { + kgdb_irq =K_INT_UART_1 ; +/* Setup uart 1 settings, mapper */ out64 (M_DUART_IMR_BRK ,KSEG1 +A_DUART +R_DUART_IMR_B ); +sb1250_steal_irq (kgdb_irq);out64 (IMR_IP6_VAL , -KSEG1 +A_IMR_REGISTER (0 ,R_IMR_INTERRUPT_MAP_BASE ) + (K_INT_UART_1 <<3 )); +KSEG1 +A_IMR_REGISTER (0 ,R_IMR_INTERRUPT_MAP_BASE ) + (kgdb_irq<<3 )); tmp =in64 (KSEG1 +A_IMR_REGISTER (0 ,R_IMR_INTERRUPT_MASK )); - tmp &= ~(1 <<K_INT_UART_1 ); + tmp &= ~(1LL <<kgdb_irq);out64 (tmp,KSEG1 +A_IMR_REGISTER (0 ,R_IMR_INTERRUPT_MASK )); +prom_printf ("Waiting for GDB on UART port 1\n" );set_debug_traps ();breakpoint (); }
@@ -396,10 +403,10 @@#include <linux/delay.h> -extern void set_async_breakpoint (unsigned int epc); +extern void set_async_breakpoint (unsigned long *epc); -#define duart_out (reg, val) out64(val, KSEG1 + A_DUART_CHANREG(1,reg)) -#define duart_in (reg) in64(KSEG1 + A_DUART_CHANREG(1,reg)) +#define duart_out (reg, val) csr_out32(val, KSEG1 + A_DUART_CHANREG(1,reg)) +#define duart_in (reg) csr_in32(KSEG1 + A_DUART_CHANREG(1,reg))void sb1250_kgdb_interrupt (struct pt_regs *regs) {
@@ -408,10 +415,11 @@* host to stop the break, since we would see another * interrupt on the end-of-break too) */ + kstat.irqs[smp_processor_id ()][K_INT_UART_1 ]++;mdelay (500 );duart_out (R_DUART_CMD ,V_DUART_MISC_CMD_RESET_BREAK_INT |M_DUART_RX_EN |M_DUART_TX_EN ); -if (!user_mode (regs)) - set_async_breakpoint(regs->cp0_epc); + set_async_breakpoint(®s->cp0_epc); } +#endif /* CONFIG_KGDB */
arch/mips/sibyte/swarm/dbg_io.c renamed from arch/mips/sibyte/swarm/dbg_io.c.orig +2 -2
@@ -37,8 +37,8 @@/* -------------------- END OF CONFIG --------------------- */ -#define duart_out (reg, val) out64(val, KSEG1 + A_DUART_CHANREG(1,reg)) -#define duart_in (reg) in64(KSEG1 + A_DUART_CHANREG(1,reg)) +#define duart_out (reg, val) csr_out32(val, KSEG1 + A_DUART_CHANREG(1,reg)) +#define duart_in (reg) csr_in32(KSEG1 + A_DUART_CHANREG(1,reg))extern void set_async_breakpoint (unsigned int epc);
arch/mips/Makefile renamed from arch/mips/Makefile.orig +1 -1
@@ -19,7 +19,7 @@ ifdef CONFIG_CPU_LITTLE_ENDIAN tool-prefix = mipsel-linux- else -tool-prefix = mips-linux- +tool-prefix = /opt/mvl-installs/mvl3.0.0/hardhat/devkit/mips/fp_be/bin/mips_fp_be- endif ifdef CONFIG_CROSSCOMPILE