cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-xhci-add-tracepoint-for-endpoint-state-changes.patch

958e1b
From 808711fd7cfcd6daca455db6dbd9d0f1f17a8b96 Mon Sep 17 00:00:00 2001
958e1b
From: Gerd Hoffmann <kraxel@redhat.com>
958e1b
Date: Fri, 11 Jul 2014 14:20:39 +0200
958e1b
Subject: [PATCH 06/43] xhci: add tracepoint for endpoint state changes
958e1b
958e1b
Message-id: <1405088470-24115-7-git-send-email-kraxel@redhat.com>
958e1b
Patchwork-id: 59843
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH 06/37] xhci: add tracepoint for endpoint state changes
958e1b
Bugzilla: 980833
958e1b
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
958e1b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
958e1b
958e1b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
958e1b
(cherry picked from commit 1c82392a158471355aa6d1922df2d1545bb16b95)
958e1b
---
958e1b
 hw/usb/hcd-xhci.c | 19 +++++++++++++++++++
958e1b
 trace-events      |  1 +
958e1b
 2 files changed, 20 insertions(+)
958e1b
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
---
958e1b
 hw/usb/hcd-xhci.c | 19 +++++++++++++++++++
958e1b
 trace-events      |  1 +
958e1b
 2 files changed, 20 insertions(+)
958e1b
958e1b
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
958e1b
index 00623f9..e8fa26c 100644
958e1b
--- a/hw/usb/hcd-xhci.c
958e1b
+++ b/hw/usb/hcd-xhci.c
958e1b
@@ -589,6 +589,14 @@ static const char *TRBCCode_names[] = {
958e1b
     [CC_SPLIT_TRANSACTION_ERROR]       = "CC_SPLIT_TRANSACTION_ERROR",
958e1b
 };
958e1b
 
958e1b
+static const char *ep_state_names[] = {
958e1b
+    [EP_DISABLED] = "disabled",
958e1b
+    [EP_RUNNING]  = "running",
958e1b
+    [EP_HALTED]   = "halted",
958e1b
+    [EP_STOPPED]  = "stopped",
958e1b
+    [EP_ERROR]    = "error",
958e1b
+};
958e1b
+
958e1b
 static const char *lookup_name(uint32_t index, const char **list, uint32_t llen)
958e1b
 {
958e1b
     if (index >= llen || list[index] == NULL) {
958e1b
@@ -609,6 +617,12 @@ static const char *event_name(XHCIEvent *event)
958e1b
                        ARRAY_SIZE(TRBCCode_names));
958e1b
 }
958e1b
 
958e1b
+static const char *ep_state_name(uint32_t state)
958e1b
+{
958e1b
+    return lookup_name(state, ep_state_names,
958e1b
+                       ARRAY_SIZE(ep_state_names));
958e1b
+}
958e1b
+
958e1b
 static uint64_t xhci_mfindex_get(XHCIState *xhci)
958e1b
 {
958e1b
     int64_t now = qemu_get_clock_ns(vm_clock);
958e1b
@@ -1206,6 +1220,11 @@ static void xhci_set_ep_state(XHCIState *xhci, XHCIEPContext *epctx,
958e1b
     }
958e1b
 
958e1b
     xhci_dma_write_u32s(xhci, epctx->pctx, ctx, sizeof(ctx));
958e1b
+    if (epctx->state != state) {
958e1b
+        trace_usb_xhci_ep_state(epctx->slotid, epctx->epid,
958e1b
+                                ep_state_name(epctx->state),
958e1b
+                                ep_state_name(state));
958e1b
+    }
958e1b
     epctx->state = state;
958e1b
 }
958e1b
 
958e1b
diff --git a/trace-events b/trace-events
958e1b
index b9144b2..4058dd5 100644
958e1b
--- a/trace-events
958e1b
+++ b/trace-events
958e1b
@@ -378,6 +378,7 @@ usb_xhci_ep_set_dequeue(uint32_t slotid, uint32_t epid, uint32_t streamid, uint6
958e1b
 usb_xhci_ep_kick(uint32_t slotid, uint32_t epid, uint32_t streamid) "slotid %d, epid %d, streamid %d"
958e1b
 usb_xhci_ep_stop(uint32_t slotid, uint32_t epid) "slotid %d, epid %d"
958e1b
 usb_xhci_ep_reset(uint32_t slotid, uint32_t epid) "slotid %d, epid %d"
958e1b
+usb_xhci_ep_state(uint32_t slotid, uint32_t epid, const char *os, const char *ns) "slotid %d, epid %d, %s -> %s"
958e1b
 usb_xhci_xfer_start(void *xfer, uint32_t slotid, uint32_t epid, uint32_t streamid) "%p: slotid %d, epid %d, streamid %d"
958e1b
 usb_xhci_xfer_async(void *xfer) "%p"
958e1b
 usb_xhci_xfer_nak(void *xfer) "%p"
958e1b
-- 
958e1b
1.8.3.1
958e1b