WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] xentrace:Trace mmio/io read/write value

To: George Dunlap <dunlapg@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] xentrace:Trace mmio/io read/write value
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Mon, 03 Nov 2008 13:37:13 +0000
Cc:
Delivery-date: Mon, 03 Nov 2008 05:37:36 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <de76405a0811030513x65ee794bv93962cfae650551b@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Ack9uUc6hgg6jqmsEd2ZhAAX8io7RQ==
Thread-topic: [Xen-devel] [PATCH] xentrace:Trace mmio/io read/write value
User-agent: Microsoft-Entourage/11.4.0.080122
Kind of ugly and also fails to build. I fixed these issues and applied as
c/s 18749.

 -- Keir

On 3/11/08 13:13, "George Dunlap" <dunlapg@xxxxxxxxx> wrote:

> xentrace: Trace mmio/io read/write value
> 
> Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
> 
> diff -r f12d9595d07c xen/arch/x86/hvm/emulate.c
> --- a/xen/arch/x86/hvm/emulate.c Fri Oct 31 14:02:39 2008 +0000
> +++ b/xen/arch/x86/hvm/emulate.c Mon Nov 03 13:11:16 2008 +0000
> @@ -14,10 +14,73 @@
>  #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 inline void hvmtrace_io_assist(int is_mmio, ioreq_t *p)
> +{
> +    unsigned event, size;
> +
> +    if(is_mmio)
> +        event = TRC_HVM_MMIO_ASSIST;
> +    else
> +        event = TRC_HVM_IO_ASSIST;
> +#ifdef __x86_64__
> +    if ( p->addr > ((u32)-1) )
> +    {
> +        struct {
> +            u64 addr;
> +            u32 data;
> +        } __attribute__((packed)) d;
> +
> +        d.addr = p->addr;
> +
> +        /* 64-bit address */
> +        event |= TRC_FLAG_64;
> +
> +        /* Change "read" bit into a "write" bit */
> +        if ( !p->dir )
> +            event |= HVMTRACE_IO_ASSIST_WRITE;
> +
> +        if ( !p->data_is_ptr )
> +        {
> +            d.data = p->data;
> +            size = sizeof(d);
> +        }
> +        else
> +            size=sizeof(d.addr);
> +
> +        trace_var(event, 0/*!cycles*/,size, (unsigned char *)&d);
> +    }
> +    else
> +#endif
> +    {
> +        struct {
> +            u32 addr, data;
> +        } d;
> +
> +        d.addr = p->addr;
> +
> +        /* Change "read" bit into a "write" bit */
> +        if ( !p->dir )
> +            event |= HVMTRACE_IO_ASSIST_WRITE;
> +
> +        if ( !p->data_is_ptr )
> +        {
> +            d.data = p->data;
> +            size = sizeof(d);
> +        }
> +        else
> +            size=sizeof(d.addr);
> +
> +        trace_var(event, 0/*!cycles*/,size, (unsigned char *)&d);
> +    }
> +}
> +
> 
>  static int hvmemul_do_io(
>      int is_mmio, paddr_t addr, unsigned long *reps, int size,
> @@ -110,6 +173,8 @@
>      p->df = df;
>      p->data = value;
>      p->io_count++;
> +
> +    hvmtrace_io_assist(is_mmio, p);
> 
>      if ( is_mmio )
>      {
> diff -r f12d9595d07c xen/include/public/trace.h
> --- a/xen/include/public/trace.h Fri Oct 31 14:02:39 2008 +0000
> +++ b/xen/include/public/trace.h Mon Nov 03 13:11:16 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-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



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

<Prev in Thread] Current Thread [Next in Thread>