ia64/xen-unstable

changeset 18757:43a079fd50fd

xentrace: Trace mmio/io read/write value

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Nov 03 13:36:24 2008 +0000 (2008-11-03)
parents 4ec25db9326a
children e75cb35c798b 6bd021d987d7
files xen/arch/x86/hvm/emulate.c xen/include/public/trace.h
line diff
     1.1 --- a/xen/arch/x86/hvm/emulate.c	Mon Nov 03 10:32:54 2008 +0000
     1.2 +++ b/xen/arch/x86/hvm/emulate.c	Mon Nov 03 13:36:24 2008 +0000
     1.3 @@ -14,11 +14,39 @@
     1.4  #include <xen/lib.h>
     1.5  #include <xen/sched.h>
     1.6  #include <xen/paging.h>
     1.7 +#include <xen/trace.h>
     1.8  #include <asm/event.h>
     1.9  #include <asm/hvm/emulate.h>
    1.10  #include <asm/hvm/hvm.h>
    1.11  #include <asm/hvm/support.h>
    1.12  
    1.13 +#define HVMTRACE_IO_ASSIST_WRITE 0x200
    1.14 +static void hvmtrace_io_assist(int is_mmio, ioreq_t *p)
    1.15 +{
    1.16 +    unsigned int size, event;
    1.17 +    unsigned char buffer[12];
    1.18 +
    1.19 +    if ( likely(!tb_init_done) )
    1.20 +        return;
    1.21 +
    1.22 +    event = is_mmio ? TRC_HVM_MMIO_ASSIST : TRC_HVM_IO_ASSIST;
    1.23 +    if ( !p->dir )
    1.24 +        event |= HVMTRACE_IO_ASSIST_WRITE;
    1.25 +
    1.26 +    *(uint64_t *)buffer = p->addr;
    1.27 +    size = (p->addr != (u32)p->addr) ? 8 : 4;
    1.28 +    if ( size == 8 )
    1.29 +        event |= TRC_64_FLAG;
    1.30 +
    1.31 +    if ( !p->data_is_ptr )
    1.32 +    {
    1.33 +        *(uint32_t *)&buffer[size] = p->data;
    1.34 +        size += 4;
    1.35 +    }
    1.36 +
    1.37 +    trace_var(event, 0/*!cycles*/, size, buffer);
    1.38 +}
    1.39 +
    1.40  static int hvmemul_do_io(
    1.41      int is_mmio, paddr_t addr, unsigned long *reps, int size,
    1.42      paddr_t ram_gpa, int dir, int df, void *p_data)
    1.43 @@ -111,6 +139,8 @@ static int hvmemul_do_io(
    1.44      p->data = value;
    1.45      p->io_count++;
    1.46  
    1.47 +    hvmtrace_io_assist(is_mmio, p);
    1.48 +
    1.49      if ( is_mmio )
    1.50      {
    1.51          rc = hvm_mmio_intercept(p);
     2.1 --- a/xen/include/public/trace.h	Mon Nov 03 10:32:54 2008 +0000
     2.2 +++ b/xen/include/public/trace.h	Mon Nov 03 13:36:24 2008 +0000
     2.3 @@ -142,7 +142,9 @@
     2.4  #define TRC_HVM_INVLPG64        (TRC_HVM_HANDLER + TRC_64_FLAG + 0x14)
     2.5  #define TRC_HVM_MCE             (TRC_HVM_HANDLER + 0x15)
     2.6  #define TRC_HVM_IO_ASSIST       (TRC_HVM_HANDLER + 0x16)
     2.7 +#define TRC_HVM_IO_ASSIST64     (TRC_HVM_HANDLER + TRC_64_FLAG + 0x16)
     2.8  #define TRC_HVM_MMIO_ASSIST     (TRC_HVM_HANDLER + 0x17)
     2.9 +#define TRC_HVM_MMIO_ASSIST64   (TRC_HVM_HANDLER + TRC_64_FLAG + 0x17)
    2.10  #define TRC_HVM_CLTS            (TRC_HVM_HANDLER + 0x18)
    2.11  #define TRC_HVM_LMSW            (TRC_HVM_HANDLER + 0x19)
    2.12  #define TRC_HVM_LMSW64          (TRC_HVM_HANDLER + TRC_64_FLAG + 0x19)