qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: agraf@suse.de
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH 05/13] pseries: Add tracepoints to the XICS interrupt controller
Date: Tue,  4 Dec 2012 13:42:09 +1100	[thread overview]
Message-ID: <1354588937-27122-6-git-send-email-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <1354588937-27122-1-git-send-email-david@gibson.dropbear.id.au>

This patch adds tracing / debugging calls to the XICS interrupt controller
implementation used on the pseries machine.

Signed-off-by: Ben Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/xics.c    |   23 ++++++++++++++++++++---
 trace-events |   13 +++++++++++++
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/hw/xics.c b/hw/xics.c
index b8887cd..33f99c7 100644
--- a/hw/xics.c
+++ b/hw/xics.c
@@ -26,6 +26,7 @@
  */
 
 #include "hw.h"
+#include "trace.h"
 #include "hw/spapr.h"
 #include "hw/xics.h"
 
@@ -66,6 +67,8 @@ static void icp_check_ipi(struct icp_state *icp, int server)
         return;
     }
 
+    trace_xics_icp_check_ipi(server, ss->mfrr);
+
     if (XISR(ss)) {
         ics_reject(icp->ics, XISR(ss));
     }
@@ -120,11 +123,13 @@ static void icp_set_mfrr(struct icp_state *icp, int server, uint8_t mfrr)
 
 static uint32_t icp_accept(struct icp_server_state *ss)
 {
-    uint32_t xirr;
+    uint32_t xirr = ss->xirr;
 
     qemu_irq_lower(ss->output);
-    xirr = ss->xirr;
     ss->xirr = ss->pending_priority << 24;
+
+    trace_xics_icp_accept(xirr, ss->xirr);
+
     return xirr;
 }
 
@@ -134,6 +139,7 @@ static void icp_eoi(struct icp_state *icp, int server, uint32_t xirr)
 
     /* Send EOI -> ICS */
     ss->xirr = (ss->xirr & ~CPPR_MASK) | (xirr & CPPR_MASK);
+    trace_xics_icp_eoi(server, xirr, ss->xirr);
     ics_eoi(icp->ics, xirr & XISR_MASK);
     if (!XISR(ss)) {
         icp_resend(icp, server);
@@ -144,6 +150,8 @@ static void icp_irq(struct icp_state *icp, int server, int nr, uint8_t priority)
 {
     struct icp_server_state *ss = icp->ss + server;
 
+    trace_xics_icp_irq(server, nr, priority);
+
     if ((priority >= CPPR(ss))
         || (XISR(ss) && (ss->pending_priority <= priority))) {
         ics_reject(icp->ics, nr);
@@ -153,6 +161,7 @@ static void icp_irq(struct icp_state *icp, int server, int nr, uint8_t priority)
         }
         ss->xirr = (ss->xirr & ~XISR_MASK) | (nr & XISR_MASK);
         ss->pending_priority = priority;
+        trace_xics_icp_raise(ss->xirr, ss->pending_priority);
         qemu_irq_raise(ss->output);
     }
 }
@@ -217,10 +226,12 @@ static void set_irq_msi(struct ics_state *ics, int srcno, int val)
 {
     struct ics_irq_state *irq = ics->irqs + srcno;
 
+    trace_xics_set_irq_msi(srcno, srcno + ics->offset);
+
     if (val) {
         if (irq->priority == 0xff) {
             irq->status |= XICS_STATUS_MASKED_PENDING;
-            /* masked pending */ ;
+            trace_xics_masked_pending();
         } else  {
             icp_irq(ics->icp, irq->server, srcno + ics->offset, irq->priority);
         }
@@ -231,6 +242,7 @@ static void set_irq_lsi(struct ics_state *ics, int srcno, int val)
 {
     struct ics_irq_state *irq = ics->irqs + srcno;
 
+    trace_xics_set_irq_lsi(srcno, srcno + ics->offset);
     if (val) {
         irq->status |= XICS_STATUS_ASSERTED;
     } else {
@@ -279,6 +291,8 @@ static void ics_write_xive(struct ics_state *ics, int nr, int server,
     irq->priority = priority;
     irq->saved_priority = saved_priority;
 
+    trace_xics_ics_write_xive(nr, srcno, server, priority);
+
     if (irq->lsi) {
         write_xive_lsi(ics, srcno);
     } else {
@@ -290,6 +304,7 @@ static void ics_reject(struct ics_state *ics, int nr)
 {
     struct ics_irq_state *irq = ics->irqs + nr - ics->offset;
 
+    trace_xics_ics_reject(nr, nr - ics->offset);
     irq->status |= XICS_STATUS_REJECTED; /* Irrelevant but harmless for LSI */
     irq->status &= ~XICS_STATUS_SENT; /* Irrelevant but harmless for MSI */
 }
@@ -315,6 +330,8 @@ static void ics_eoi(struct ics_state *ics, int nr)
     int srcno = nr - ics->offset;
     struct ics_irq_state *irq = ics->irqs + srcno;
 
+    trace_xics_ics_eoi(nr);
+
     if (irq->lsi) {
         irq->status &= ~XICS_STATUS_SENT;
     }
diff --git a/trace-events b/trace-events
index 6c6cbf1..e280fba 100644
--- a/trace-events
+++ b/trace-events
@@ -1022,3 +1022,16 @@ spapr_pci_rtas_ibm_change_msi(unsigned func, unsigned req) "func %u, requested %
 spapr_pci_rtas_ibm_query_interrupt_source_number(unsigned ioa, unsigned intr) "queries for #%u, IRQ%u"
 spapr_pci_msi_write(uint64_t addr, uint64_t data, uint32_t dt_irq) "@%"PRIx64"<=%"PRIx64" IRQ %u"
 spapr_pci_lsi_set(const char *busname, int pin, uint32_t irq) "%s PIN%d IRQ %u"
+
+# hw/xics.c
+xics_icp_check_ipi(int server, uint8_t mfrr) "CPU %d can take IPI mfrr=%#x"
+xics_icp_accept(uint32_t old_xirr, uint32_t new_xirr) "icp_accept: XIRR %#"PRIx32"->%#"PRIx32
+xics_icp_eoi(int server, uint32_t xirr, uint32_t new_xirr) "icp_eoi: server %d given XIRR %#"PRIx32" new XIRR %#"PRIx32
+xics_icp_irq(int server, int nr, uint8_t priority) "cpu %d trying to deliver irq %#"PRIx32" priority %#x"
+xics_icp_raise(uint32_t xirr, uint8_t pending_priority) "raising IRQ new XIRR=%#x new pending priority=%#x"
+xics_set_irq_msi(int srcno, int nr) "set_irq_msi: srcno %d [irq %#x]"
+xics_masked_pending(void) "set_irq_msi: masked pending"
+xics_set_irq_lsi(int srcno, int nr) "set_irq_lsi: srcno %d [irq %#x]"
+xics_ics_write_xive(int nr, int srcno, int server, uint8_t priority) "ics_write_xive: irq %#x [src %d] server %#x prio %#x"
+xics_ics_reject(int nr, int srcno) "reject irq %#x [src %d]"
+xics_ics_eoi(int nr) "ics_eoi: irq %#x"
\ No newline at end of file
-- 
1.7.10.4

  parent reply	other threads:[~2012-12-04  2:41 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-04  2:42 [Qemu-devel] [0/13] Pending pseries/ppc patches as at 1.3 release David Gibson
2012-12-04  2:42 ` [Qemu-devel] [PATCH 01/13] pseries: Fix incorrect initialization of interrupt controller David Gibson
2012-12-04  2:42 ` [Qemu-devel] [PATCH 02/13] pseries: Use #define for XICS base irq number David Gibson
2012-12-04  2:42 ` [Qemu-devel] [PATCH 03/13] pseries: Return the token when we register an RTAS call David Gibson
2012-12-04  2:42 ` [Qemu-devel] [PATCH 04/13] pseries: Allow RTAS tokens without a qemu handler David Gibson
2012-12-04  2:42 ` David Gibson [this message]
2012-12-04  2:42 ` [Qemu-devel] [PATCH 06/13] pseries: Split xics irq configuration from state information David Gibson
2012-12-04  2:42 ` [Qemu-devel] [PATCH 07/13] pseries: Implement PAPR NVRAM David Gibson
2012-12-04  2:42 ` [Qemu-devel] [PATCH 08/13] pseries: Update SLOF for NVRAM support David Gibson
2012-12-04 13:20   ` Erlon Cruz
2012-12-04 22:54     ` [Qemu-devel] [Qemu-ppc] " David Gibson
2012-12-04 23:27       ` Erlon Cruz
2012-12-05  0:13         ` David Gibson
2012-12-05  2:27     ` [Qemu-devel] " Alexander Graf
2012-12-05 14:09       ` Erlon Cruz
2012-12-05 14:35         ` Alexander Graf
2012-12-05 14:37           ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2012-12-05 14:39             ` Alexander Graf
2012-12-06 19:41               ` Erlon Cruz
2012-12-06 19:41             ` Erlon Cruz
2012-12-06 19:41           ` [Qemu-devel] " Erlon Cruz
2012-12-07  8:10         ` [Qemu-devel] [Qemu-ppc] " Nikunj A Dadhania
2012-12-07 11:48           ` Erlon Cruz
2012-12-07 11:55             ` Alexander Graf
2012-12-04  2:42 ` [Qemu-devel] [PATCH 09/13] pseries: Don't allow TCE (iommu) tables to be registered with duplicate LIOBNs David Gibson
2012-12-04  2:42 ` [Qemu-devel] [PATCH 10/13] target-ppc: Don't use hwaddr to represent hardware state David Gibson
2012-12-13 12:51   ` Alexander Graf
2012-12-04  2:42 ` [Qemu-devel] [PATCH 11/13] pseries: Fixes and enhancements to L1 cache properties David Gibson
2012-12-13 12:50   ` Alexander Graf
2012-12-17  2:32     ` [Qemu-devel] [Qemu-ppc] " David Gibson
2012-12-17 10:10       ` Alexander Graf
2012-12-17 23:00         ` David Gibson
2012-12-17 23:49           ` Alexander Graf
2012-12-19  4:34             ` David Gibson
2012-12-19 22:40               ` Alexander Graf
2012-12-20  3:38                 ` David Gibson
2012-12-20  9:32                   ` Alexander Graf
2012-12-04  2:42 ` [Qemu-devel] [PATCH 12/13] pseries: Increase default NVRAM size David Gibson
2012-12-13 12:51   ` Alexander Graf
2012-12-04  2:42 ` [Qemu-devel] [PATCH 13/13] target-ppc: Give a meaningful error if too many threads are specified David Gibson
2012-12-04  3:11   ` David Gibson
2012-12-13 12:57     ` Alexander Graf
2012-12-13 13:17       ` David Gibson
2012-12-13 13:19         ` Alexander Graf
2012-12-13 14:17           ` Peter Maydell
2012-12-13 14:18             ` Peter Maydell
2012-12-17  2:13               ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354588937-27122-6-git-send-email-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).