WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [xenppc-unstable] [XEN][POWERPC] Clean up debug/traceback/trapp

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [xenppc-unstable] [XEN][POWERPC] Clean up debug/traceback/trapping logic
From: Xen patchbot-xenppc-unstable <patchbot-xenppc-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 22 Sep 2006 15:10:45 +0000
Delivery-date: Fri, 22 Sep 2006 08:14:06 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 04ed07cd741a27041e52c810e5e0ca66b80ef157
# Parent  e5b1f6154f3121ad3b4172de17f9618f1acc3e90
[XEN][POWERPC] Clean up debug/traceback/trapping logic

This patch tries to sort out all the debugging mechanisms we have
available to us.

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 xen/include/asm-powerpc/misc.h             |   33 ---------------------
 xen/arch/powerpc/backtrace.c               |   22 ++++++++++----
 xen/arch/powerpc/exceptions.c              |   34 +++++++++------------
 xen/arch/powerpc/mm.c                      |    1 
 xen/arch/powerpc/powerpc64/ppc970.c        |    1 
 xen/arch/powerpc/powerpc64/scom.h          |   39 +++++++++++++++++++++++++
 xen/arch/powerpc/powerpc64/traps.c         |    4 --
 xen/arch/powerpc/setup.c                   |    2 -
 xen/arch/powerpc/smp.c                     |    2 -
 xen/arch/powerpc/time.c                    |    2 -
 xen/arch/powerpc/usercopy.c                |    1 
 xen/include/asm-powerpc/debugger.h         |   45 ++++++++++++++++++++---------
 xen/include/asm-powerpc/flushtlb.h         |    1 
 xen/include/asm-powerpc/mm.h               |    1 
 xen/include/asm-powerpc/page.h             |    1 
 xen/include/asm-powerpc/powerpc64/config.h |    7 ----
 xen/include/asm-powerpc/processor.h        |   10 ------
 17 files changed, 108 insertions(+), 98 deletions(-)

diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/backtrace.c
--- a/xen/arch/powerpc/backtrace.c      Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/backtrace.c      Fri Sep 22 11:10:28 2006 -0400
@@ -14,6 +14,7 @@
 #include <xen/console.h>
 #include <xen/sched.h>
 #include <xen/symbols.h>
+#include <asm/debugger.h>
 
 static char namebuf[KSYM_NAME_LEN+1];
 
@@ -192,6 +193,19 @@ void show_backtrace(ulong sp, ulong lr, 
     console_end_sync();
 }
 
+void show_backtrace_regs(struct cpu_user_regs *regs)
+{
+    console_start_sync();
+    
+    show_registers(regs);
+    printk("dar 0x%016lx, dsisr 0x%08x\n", mfdar(), mfdsisr());
+    printk("hid4 0x%016lx\n", regs->hid4);
+    printk("---[ backtrace ]---\n");
+    show_backtrace(regs->gprs[1], regs->lr, regs->pc);
+
+    console_end_sync();
+}
+
 void __warn(char *file, int line)
 {
     ulong sp;
@@ -202,9 +216,7 @@ void __warn(char *file, int line)
 
     sp = (ulong)__builtin_frame_address(0);
     lr = (ulong)__builtin_return_address(0);
-
     backtrace(sp, lr, lr);
-    console_end_sync();
-}
-
-    
+
+    console_end_sync();
+}
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/exceptions.c
--- a/xen/arch/powerpc/exceptions.c     Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/exceptions.c     Fri Sep 22 11:10:28 2006 -0400
@@ -25,8 +25,10 @@
 #include <xen/serial.h>
 #include <xen/gdbstub.h>
 #include <xen/console.h>
+#include <xen/shutdown.h>
 #include <asm/time.h>
 #include <asm/processor.h>
+#include <asm/debugger.h>
 
 #undef DEBUG
 
@@ -56,25 +58,19 @@ void do_dec(struct cpu_user_regs *regs)
 
 void program_exception(struct cpu_user_regs *regs, unsigned long cookie)
 {
+    if (cookie == 0x200) {
+        if (cpu_machinecheck(regs))
+            return;
+
+        printk("%s: machine check\n", __func__);
+    } else {
 #ifdef CRASH_DEBUG
-    __trap_to_gdb(regs, cookie);
-#else /* CRASH_DEBUG */
-    int recover = 0;
+        if (__trap_to_gdb(regs, cookie) == 0)
+            return;
+#endif /* CRASH_DEBUG */
 
-    console_start_sync();
-
-    show_registers(regs);
-    printk("dar 0x%016lx, dsisr 0x%08x\n", mfdar(), mfdsisr());
-    printk("hid4 0x%016lx\n", regs->hid4);
-    printk("---[ backtrace ]---\n");
-    show_backtrace(regs->gprs[1], regs->lr, regs->pc);
-
-    if (cookie == 0x200)
-        recover = cpu_machinecheck(regs);
-
-    if (!recover)
-        panic("%s: 0x%lx\n", __func__, cookie);
-
-    console_end_sync();
-#endif /* CRASH_DEBUG */
+        printk("%s: type: 0x%lx\n", __func__, cookie);
+        show_backtrace_regs(regs);
+    }
+    machine_halt();
 }
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c     Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/mm.c     Fri Sep 22 11:10:28 2006 -0400
@@ -25,7 +25,6 @@
 #include <xen/kernel.h>
 #include <xen/sched.h>
 #include <xen/perfc.h>
-#include <asm/misc.h>
 #include <asm/init.h>
 #include <asm/page.h>
 
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c       Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/ppc970.c       Fri Sep 22 11:10:28 2006 -0400
@@ -30,6 +30,7 @@
 #include <asm/powerpc64/procarea.h>
 #include <asm/powerpc64/processor.h>
 #include <asm/powerpc64/ppc970-hid.h>
+#include "scom.h"
 
 #undef DEBUG
 #undef SERIALIZE
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/powerpc64/traps.c
--- a/xen/arch/powerpc/powerpc64/traps.c        Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/traps.c        Fri Sep 22 11:10:28 2006 -0400
@@ -48,7 +48,3 @@ void show_registers(struct cpu_user_regs
     console_end_sync();
 }
 
-void show_execution_state(struct cpu_user_regs *regs)
-{
-    show_registers(regs);
-}
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/setup.c  Fri Sep 22 11:10:28 2006 -0400
@@ -416,7 +416,7 @@ void __init __start_xen_ppc(
 
     } else {
         /* booted by someone else that hopefully has a trap handler */
-        trap();
+        __builtin_trap();
     }
 
     __start_xen(mbi);
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/smp.c
--- a/xen/arch/powerpc/smp.c    Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/smp.c    Fri Sep 22 11:10:28 2006 -0400
@@ -18,10 +18,10 @@
  * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
  */
 
-#include <asm/misc.h>
 #include <xen/cpumask.h>
 #include <xen/smp.h>
 #include <asm/flushtlb.h>
+#include <asm/debugger.h>
 
 int smp_num_siblings = 1;
 int smp_num_cpus = 1;
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/time.c
--- a/xen/arch/powerpc/time.c   Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/time.c   Fri Sep 22 11:10:28 2006 -0400
@@ -25,7 +25,7 @@
 #include <xen/sched.h>
 #include <asm/processor.h>
 #include <asm/current.h>
-#include <asm/misc.h>
+#include <asm/debugger.h>
 
 #define Dprintk(x...) printk(x)
 
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/usercopy.c
--- a/xen/arch/powerpc/usercopy.c       Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/usercopy.c       Fri Sep 22 11:10:28 2006 -0400
@@ -22,6 +22,7 @@
 #include <xen/lib.h>
 #include <asm/current.h>
 #include <asm/page.h>
+#include <asm/debugger.h>
 
 /* XXX need to return error, not panic, if domain passed a bad pointer */
 unsigned long paddr_to_maddr(unsigned long paddr)
diff -r e5b1f6154f31 -r 04ed07cd741a xen/include/asm-powerpc/debugger.h
--- a/xen/include/asm-powerpc/debugger.h        Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/include/asm-powerpc/debugger.h        Fri Sep 22 11:10:28 2006 -0400
@@ -21,6 +21,38 @@
 #ifndef _ASM_DEBUGGER_H_
 #define _ASM_DEBUGGER_H_
 
+extern void show_backtrace_regs(struct cpu_user_regs *);
+extern void show_backtrace(ulong sp, ulong lr, ulong pc);
+
+static inline void dump_execution_state(void)
+{
+    ulong sp;
+    ulong lr;
+
+    sp = (ulong)__builtin_frame_address(0);
+    lr = (ulong)__builtin_return_address(0);
+
+    show_backtrace(sp, lr, lr);
+}
+
+static inline void debugger_trap_immediate(void)
+{
+    dump_execution_state();
+    __builtin_trap();
+}
+
+static inline void show_execution_state(struct cpu_user_regs *regs)
+{
+    show_registers(regs);
+}
+
+extern void __warn(char *file, int line);
+#define WARN() __warn(__FILE__, __LINE__)
+#define WARN_ON(_p) do { if (_p) WARN(); } while ( 0 )
+#define unimplemented() WARN()
+
+#define FORCE_CRASH() debugger_trap_immediate()
+
 #ifdef CRASH_DEBUG
 
 #include <xen/gdbstub.h>
@@ -32,8 +64,6 @@ static inline int debugger_trap_fatal(
     return vector;
 }
 
-#define debugger_trap_immediate() __asm__ __volatile__ ("trap");
-
 #else /* CRASH_DEBUG */
 
 static inline int debugger_trap_fatal(
@@ -43,17 +73,6 @@ static inline int debugger_trap_fatal(
     return vector;
 }
 
-static inline void debugger_trap_immediate(void)
-{
-    ulong sp;
-    ulong lr;
-
-    sp = (ulong)__builtin_frame_address(0);
-    lr = (ulong)__builtin_return_address(0);
-
-    show_backtrace(sp, lr, lr);
-}
-
 #endif /* CRASH_DEBUG */
 
 #endif
diff -r e5b1f6154f31 -r 04ed07cd741a xen/include/asm-powerpc/flushtlb.h
--- a/xen/include/asm-powerpc/flushtlb.h        Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/include/asm-powerpc/flushtlb.h        Fri Sep 22 11:10:28 2006 -0400
@@ -24,7 +24,6 @@
 #include <xen/config.h>
 #include <xen/percpu.h>
 #include <xen/types.h>
-#include <asm/misc.h>
 
 /* The current time as shown by the virtual TLB clock. */
 extern u32 tlbflush_clock;
diff -r e5b1f6154f31 -r 04ed07cd741a xen/include/asm-powerpc/mm.h
--- a/xen/include/asm-powerpc/mm.h      Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/include/asm-powerpc/mm.h      Fri Sep 22 11:10:28 2006 -0400
@@ -25,7 +25,6 @@
 #include <xen/list.h>
 #include <xen/types.h>
 #include <xen/mm.h>
-#include <asm/misc.h>
 #include <asm/system.h>
 #include <asm/flushtlb.h>
 #include <asm/page.h>
diff -r e5b1f6154f31 -r 04ed07cd741a xen/include/asm-powerpc/page.h
--- a/xen/include/asm-powerpc/page.h    Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/include/asm-powerpc/page.h    Fri Sep 22 11:10:28 2006 -0400
@@ -28,7 +28,6 @@
 #ifndef __ASSEMBLY__
 
 #include <xen/config.h>
-#include <asm/misc.h>
 #include <asm/cache.h>
 
 #define PFN_DOWN(x)   ((x) >> PAGE_SHIFT)
diff -r e5b1f6154f31 -r 04ed07cd741a xen/include/asm-powerpc/powerpc64/config.h
--- a/xen/include/asm-powerpc/powerpc64/config.h        Fri Sep 22 11:08:12 
2006 -0400
+++ b/xen/include/asm-powerpc/powerpc64/config.h        Fri Sep 22 11:10:28 
2006 -0400
@@ -35,11 +35,4 @@
 #define NUM_FPRS 32
 #define HAS_FLOAT 1
 #define HAS_VMX 1
-
-#ifndef __ASSEMBLY__
-
-#define FORCE_CRASH() __asm__ __volatile__ ( "trap" )
-
-#endif /* __ASSEMBLY__ */
-
 #endif
diff -r e5b1f6154f31 -r 04ed07cd741a xen/include/asm-powerpc/processor.h
--- a/xen/include/asm-powerpc/processor.h       Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/include/asm-powerpc/processor.h       Fri Sep 22 11:10:28 2006 -0400
@@ -38,10 +38,7 @@ struct vcpu;
 struct vcpu;
 struct cpu_user_regs;
 extern int cpu_machinecheck(struct cpu_user_regs *);
-extern void cpu_scom_init(void);
 extern void show_registers(struct cpu_user_regs *);
-extern void show_execution_state(struct cpu_user_regs *);
-extern void show_backtrace(ulong sp, ulong lr, ulong pc);
 extern unsigned int cpu_extent_order(void);
 extern unsigned int cpu_default_rma_order_pages(void);
 extern int cpu_rma_valid(unsigned int log);
@@ -54,13 +51,6 @@ extern void flush_segments(void);
 extern void flush_segments(void);
 extern void dump_segments(int valid);
 
-/* XXX this could also land us in GDB */
-#define dump_execution_state() BUG()
-
-extern void __warn(char *file, int line);
-#define WARN() __warn(__FILE__, __LINE__)
-#define WARN_ON(_p) do { if (_p) WARN(); } while ( 0 )
-
 #define ARCH_HAS_PREFETCH
 static inline void prefetch(const void *x) {;}
 
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/powerpc64/scom.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/powerpc/powerpc64/scom.h Fri Sep 22 11:10:28 2006 -0400
@@ -0,0 +1,39 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (C) IBM Corp. 2006
+ *
+ * Authors: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
+ */
+
+#ifndef _ARCH_POWERPC_POWERPC64_SCOM_H_
+#define _ARCH_POWERPC_POWERPC64_SCOM_H_
+
+extern void cpu_scom_init(void);
+int cpu_scom_read(unsigned int addr, unsigned long *d);
+int cpu_scom_write(unsigned int addr, unsigned long d);
+void cpu_scom_AMCR(void);
+
+/* SCOMC addresses are 16bit but we are given 24 bits in the
+ * books. The low oerder 8 bits are some kinda parity thin and should
+ * be ignored */
+#define SCOM_AMC_REG       0x022601
+#define SCOM_AMC_AND_MASK  0x022700
+#define SCOM_AMC_OR_MASK   0x022800
+#define SCOM_CMCE          0x030901
+#define SCOM_PMCR          0x400801
+#define SCOM_PTSR          0x408001
+
+#endif
diff -r e5b1f6154f31 -r 04ed07cd741a xen/include/asm-powerpc/misc.h
--- a/xen/include/asm-powerpc/misc.h    Fri Sep 22 11:08:12 2006 -0400
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- * Copyright (C) IBM Corp. 2005
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- */
-
-#ifndef _ASM_MISC_H_
-#define _ASM_MISC_H_
-
-static inline void unimplemented(void)
-{
-}
-
-static inline void trap(void)
-{
-    asm volatile("trap");
-}
-
-#endif

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [xenppc-unstable] [XEN][POWERPC] Clean up debug/traceback/trapping logic, Xen patchbot-xenppc-unstable <=