All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] xen/apic: refactor error_interrupt
@ 2015-05-04  2:03 Tiejun Chen
  2015-05-04  8:07 ` Jan Beulich
  2015-05-04  8:25 ` Andrew Cooper
  0 siblings, 2 replies; 8+ messages in thread
From: Tiejun Chen @ 2015-05-04  2:03 UTC (permalink / raw)
  To: keir, jbeulich, andrew.cooper3; +Cc: xen-devel

Just make this readable while debug.

Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
 xen/arch/x86/apic.c | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 3217bdf..0b21ed1 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -1319,28 +1319,37 @@ out: ;
  * This interrupt should never happen with our APIC/SMP architecture
  */
 
+static const char *apic_fault_reasons[] =
+{
+    "Send CS error",
+    "Receive CS error",
+    "Send accept error",
+    "Receive accept error",
+    "Reserved",
+    "Send illegal vector",
+    "Received illegal vector",
+    "Illegal register address",
+};
+
+static const char *apic_get_fault_reason(u8 fault_reason)
+{
+    return apic_fault_reasons[fault_reason];
+}
+
 void error_interrupt(struct cpu_user_regs *regs)
 {
     unsigned long v, v1;
+    const char *reason;
 
     /* First tickle the hardware, only then report what went on. -- REW */
     v = apic_read(APIC_ESR);
     apic_write(APIC_ESR, 0);
     v1 = apic_read(APIC_ESR);
     ack_APIC_irq();
+    reason = apic_get_fault_reason(ffs(v1) - 1);
 
-    /* Here is what the APIC error bits mean:
-       0: Send CS error
-       1: Receive CS error
-       2: Send accept error
-       3: Receive accept error
-       4: Reserved
-       5: Send illegal vector
-       6: Received illegal vector
-       7: Illegal register address
-    */
-    printk (KERN_DEBUG "APIC error on CPU%d: %02lx(%02lx)\n",
-            smp_processor_id(), v , v1);
+    printk (KERN_DEBUG "APIC error on CPU%d: %02lx(%02lx):%s.\n",
+            smp_processor_id(), v , v1, reason);
 }
 
 /*
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-05-05  6:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-04  2:03 [RFC][PATCH] xen/apic: refactor error_interrupt Tiejun Chen
2015-05-04  8:07 ` Jan Beulich
2015-05-04 11:14   ` Chen, Tiejun
2015-05-04  8:25 ` Andrew Cooper
2015-05-05  4:46   ` Chen, Tiejun
2015-05-05  6:02     ` Andrew Cooper
2015-05-05  6:28       ` Chen, Tiejun
2015-05-05  6:49         ` Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.