[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xentrace: Trace mmio/io read/write value



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1225719384 0
# Node ID 43a079fd50fdab01cd2be443bfef011b3b0495ae
# Parent  4ec25db9326a7e7f64a8471cbfd7b5852484757c
xentrace: Trace mmio/io read/write value

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/emulate.c |   30 ++++++++++++++++++++++++++++++
 xen/include/public/trace.h |    2 ++
 2 files changed, 32 insertions(+)

diff -r 4ec25db9326a -r 43a079fd50fd xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c        Mon Nov 03 10:32:54 2008 +0000
+++ b/xen/arch/x86/hvm/emulate.c        Mon Nov 03 13:36:24 2008 +0000
@@ -14,10 +14,38 @@
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <xen/paging.h>
+#include <xen/trace.h>
 #include <asm/event.h>
 #include <asm/hvm/emulate.h>
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/support.h>
+
+#define HVMTRACE_IO_ASSIST_WRITE 0x200
+static void hvmtrace_io_assist(int is_mmio, ioreq_t *p)
+{
+    unsigned int size, event;
+    unsigned char buffer[12];
+
+    if ( likely(!tb_init_done) )
+        return;
+
+    event = is_mmio ? TRC_HVM_MMIO_ASSIST : TRC_HVM_IO_ASSIST;
+    if ( !p->dir )
+        event |= HVMTRACE_IO_ASSIST_WRITE;
+
+    *(uint64_t *)buffer = p->addr;
+    size = (p->addr != (u32)p->addr) ? 8 : 4;
+    if ( size == 8 )
+        event |= TRC_64_FLAG;
+
+    if ( !p->data_is_ptr )
+    {
+        *(uint32_t *)&buffer[size] = p->data;
+        size += 4;
+    }
+
+    trace_var(event, 0/*!cycles*/, size, buffer);
+}
 
 static int hvmemul_do_io(
     int is_mmio, paddr_t addr, unsigned long *reps, int size,
@@ -110,6 +138,8 @@ static int hvmemul_do_io(
     p->df = df;
     p->data = value;
     p->io_count++;
+
+    hvmtrace_io_assist(is_mmio, p);
 
     if ( is_mmio )
     {
diff -r 4ec25db9326a -r 43a079fd50fd xen/include/public/trace.h
--- a/xen/include/public/trace.h        Mon Nov 03 10:32:54 2008 +0000
+++ b/xen/include/public/trace.h        Mon Nov 03 13:36:24 2008 +0000
@@ -142,7 +142,9 @@
 #define TRC_HVM_INVLPG64        (TRC_HVM_HANDLER + TRC_64_FLAG + 0x14)
 #define TRC_HVM_MCE             (TRC_HVM_HANDLER + 0x15)
 #define TRC_HVM_IO_ASSIST       (TRC_HVM_HANDLER + 0x16)
+#define TRC_HVM_IO_ASSIST64     (TRC_HVM_HANDLER + TRC_64_FLAG + 0x16)
 #define TRC_HVM_MMIO_ASSIST     (TRC_HVM_HANDLER + 0x17)
+#define TRC_HVM_MMIO_ASSIST64   (TRC_HVM_HANDLER + TRC_64_FLAG + 0x17)
 #define TRC_HVM_CLTS            (TRC_HVM_HANDLER + 0x18)
 #define TRC_HVM_LMSW            (TRC_HVM_HANDLER + 0x19)
 #define TRC_HVM_LMSW64          (TRC_HVM_HANDLER + TRC_64_FLAG + 0x19)

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.