Home | History | Annotate | Line # | Download | only in public
      1  1.1  cherry /******************************************************************************
      2  1.1  cherry  * include/public/trace.h
      3  1.1  cherry  *
      4  1.1  cherry  * Permission is hereby granted, free of charge, to any person obtaining a copy
      5  1.1  cherry  * of this software and associated documentation files (the "Software"), to
      6  1.1  cherry  * deal in the Software without restriction, including without limitation the
      7  1.1  cherry  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
      8  1.1  cherry  * sell copies of the Software, and to permit persons to whom the Software is
      9  1.1  cherry  * furnished to do so, subject to the following conditions:
     10  1.1  cherry  *
     11  1.1  cherry  * The above copyright notice and this permission notice shall be included in
     12  1.1  cherry  * all copies or substantial portions of the Software.
     13  1.1  cherry  *
     14  1.1  cherry  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     15  1.1  cherry  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     16  1.1  cherry  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     17  1.1  cherry  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     18  1.1  cherry  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     19  1.1  cherry  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     20  1.1  cherry  * DEALINGS IN THE SOFTWARE.
     21  1.1  cherry  *
     22  1.1  cherry  * Mark Williamson, (C) 2004 Intel Research Cambridge
     23  1.1  cherry  * Copyright (C) 2005 Bin Ren
     24  1.1  cherry  */
     25  1.1  cherry 
     26  1.1  cherry #ifndef __XEN_PUBLIC_TRACE_H__
     27  1.1  cherry #define __XEN_PUBLIC_TRACE_H__
     28  1.1  cherry 
     29  1.1  cherry #define TRACE_EXTRA_MAX    7
     30  1.1  cherry #define TRACE_EXTRA_SHIFT 28
     31  1.1  cherry 
     32  1.1  cherry /* Trace classes */
     33  1.1  cherry #define TRC_CLS_SHIFT 16
     34  1.1  cherry #define TRC_GEN      0x0001f000    /* General trace            */
     35  1.1  cherry #define TRC_SCHED    0x0002f000    /* Xen Scheduler trace      */
     36  1.1  cherry #define TRC_DOM0OP   0x0004f000    /* Xen DOM0 operation trace */
     37  1.1  cherry #define TRC_HVM      0x0008f000    /* Xen HVM trace            */
     38  1.1  cherry #define TRC_MEM      0x0010f000    /* Xen memory trace         */
     39  1.1  cherry #define TRC_PV       0x0020f000    /* Xen PV traces            */
     40  1.1  cherry #define TRC_SHADOW   0x0040f000    /* Xen shadow tracing       */
     41  1.1  cherry #define TRC_HW       0x0080f000    /* Xen hardware-related traces */
     42  1.1  cherry #define TRC_GUEST    0x0800f000    /* Guest-generated traces   */
     43  1.1  cherry #define TRC_ALL      0x0ffff000
     44  1.1  cherry #define TRC_HD_TO_EVENT(x) ((x)&0x0fffffff)
     45  1.1  cherry #define TRC_HD_CYCLE_FLAG (1UL<<31)
     46  1.1  cherry #define TRC_HD_INCLUDES_CYCLE_COUNT(x) ( !!( (x) & TRC_HD_CYCLE_FLAG ) )
     47  1.1  cherry #define TRC_HD_EXTRA(x)    (((x)>>TRACE_EXTRA_SHIFT)&TRACE_EXTRA_MAX)
     48  1.1  cherry 
     49  1.1  cherry /* Trace subclasses */
     50  1.1  cherry #define TRC_SUBCLS_SHIFT 12
     51  1.1  cherry 
     52  1.1  cherry /* trace subclasses for SVM */
     53  1.1  cherry #define TRC_HVM_ENTRYEXIT   0x00081000   /* VMENTRY and #VMEXIT       */
     54  1.1  cherry #define TRC_HVM_HANDLER     0x00082000   /* various HVM handlers      */
     55  1.1  cherry #define TRC_HVM_EMUL        0x00084000   /* emulated devices */
     56  1.1  cherry 
     57  1.1  cherry #define TRC_SCHED_MIN       0x00021000   /* Just runstate changes */
     58  1.1  cherry #define TRC_SCHED_CLASS     0x00022000   /* Scheduler-specific    */
     59  1.1  cherry #define TRC_SCHED_VERBOSE   0x00028000   /* More inclusive scheduling */
     60  1.1  cherry 
     61  1.1  cherry /*
     62  1.1  cherry  * The highest 3 bits of the last 12 bits of TRC_SCHED_CLASS above are
     63  1.1  cherry  * reserved for encoding what scheduler produced the information. The
     64  1.1  cherry  * actual event is encoded in the last 9 bits.
     65  1.1  cherry  *
     66  1.1  cherry  * This means we have 8 scheduling IDs available (which means at most 8
     67  1.1  cherry  * schedulers generating events) and, in each scheduler, up to 512
     68  1.1  cherry  * different events.
     69  1.1  cherry  */
     70  1.1  cherry #define TRC_SCHED_ID_BITS 3
     71  1.1  cherry #define TRC_SCHED_ID_SHIFT (TRC_SUBCLS_SHIFT - TRC_SCHED_ID_BITS)
     72  1.1  cherry #define TRC_SCHED_ID_MASK (((1UL<<TRC_SCHED_ID_BITS) - 1) << TRC_SCHED_ID_SHIFT)
     73  1.1  cherry #define TRC_SCHED_EVT_MASK (~(TRC_SCHED_ID_MASK))
     74  1.1  cherry 
     75  1.1  cherry /* Per-scheduler IDs, to identify scheduler specific events */
     76  1.1  cherry #define TRC_SCHED_CSCHED   0
     77  1.1  cherry #define TRC_SCHED_CSCHED2  1
     78  1.1  cherry /* #define XEN_SCHEDULER_SEDF 2 (Removed) */
     79  1.1  cherry #define TRC_SCHED_ARINC653 3
     80  1.1  cherry #define TRC_SCHED_RTDS     4
     81  1.1  cherry #define TRC_SCHED_SNULL    5
     82  1.1  cherry 
     83  1.1  cherry /* Per-scheduler tracing */
     84  1.1  cherry #define TRC_SCHED_CLASS_EVT(_c, _e) \
     85  1.1  cherry   ( ( TRC_SCHED_CLASS | \
     86  1.1  cherry       ((TRC_SCHED_##_c << TRC_SCHED_ID_SHIFT) & TRC_SCHED_ID_MASK) ) + \
     87  1.1  cherry     (_e & TRC_SCHED_EVT_MASK) )
     88  1.1  cherry 
     89  1.1  cherry /* Trace classes for DOM0 operations */
     90  1.1  cherry #define TRC_DOM0_DOMOPS     0x00041000   /* Domains manipulations */
     91  1.1  cherry 
     92  1.1  cherry /* Trace classes for Hardware */
     93  1.1  cherry #define TRC_HW_PM           0x00801000   /* Power management traces */
     94  1.1  cherry #define TRC_HW_IRQ          0x00802000   /* Traces relating to the handling of IRQs */
     95  1.1  cherry 
     96  1.1  cherry /* Trace events per class */
     97  1.1  cherry #define TRC_LOST_RECORDS        (TRC_GEN + 1)
     98  1.1  cherry #define TRC_TRACE_WRAP_BUFFER  (TRC_GEN + 2)
     99  1.1  cherry #define TRC_TRACE_CPU_CHANGE    (TRC_GEN + 3)
    100  1.1  cherry 
    101  1.1  cherry #define TRC_SCHED_RUNSTATE_CHANGE   (TRC_SCHED_MIN + 1)
    102  1.1  cherry #define TRC_SCHED_CONTINUE_RUNNING  (TRC_SCHED_MIN + 2)
    103  1.1  cherry #define TRC_SCHED_DOM_ADD        (TRC_SCHED_VERBOSE +  1)
    104  1.1  cherry #define TRC_SCHED_DOM_REM        (TRC_SCHED_VERBOSE +  2)
    105  1.1  cherry #define TRC_SCHED_SLEEP          (TRC_SCHED_VERBOSE +  3)
    106  1.1  cherry #define TRC_SCHED_WAKE           (TRC_SCHED_VERBOSE +  4)
    107  1.1  cherry #define TRC_SCHED_YIELD          (TRC_SCHED_VERBOSE +  5)
    108  1.1  cherry #define TRC_SCHED_BLOCK          (TRC_SCHED_VERBOSE +  6)
    109  1.1  cherry #define TRC_SCHED_SHUTDOWN       (TRC_SCHED_VERBOSE +  7)
    110  1.1  cherry #define TRC_SCHED_CTL            (TRC_SCHED_VERBOSE +  8)
    111  1.1  cherry #define TRC_SCHED_ADJDOM         (TRC_SCHED_VERBOSE +  9)
    112  1.1  cherry #define TRC_SCHED_SWITCH         (TRC_SCHED_VERBOSE + 10)
    113  1.1  cherry #define TRC_SCHED_S_TIMER_FN     (TRC_SCHED_VERBOSE + 11)
    114  1.1  cherry #define TRC_SCHED_T_TIMER_FN     (TRC_SCHED_VERBOSE + 12)
    115  1.1  cherry #define TRC_SCHED_DOM_TIMER_FN   (TRC_SCHED_VERBOSE + 13)
    116  1.1  cherry #define TRC_SCHED_SWITCH_INFPREV (TRC_SCHED_VERBOSE + 14)
    117  1.1  cherry #define TRC_SCHED_SWITCH_INFNEXT (TRC_SCHED_VERBOSE + 15)
    118  1.1  cherry #define TRC_SCHED_SHUTDOWN_CODE  (TRC_SCHED_VERBOSE + 16)
    119  1.1  cherry #define TRC_SCHED_SWITCH_INFCONT (TRC_SCHED_VERBOSE + 17)
    120  1.1  cherry 
    121  1.1  cherry #define TRC_DOM0_DOM_ADD         (TRC_DOM0_DOMOPS + 1)
    122  1.1  cherry #define TRC_DOM0_DOM_REM         (TRC_DOM0_DOMOPS + 2)
    123  1.1  cherry 
    124  1.1  cherry #define TRC_MEM_PAGE_GRANT_MAP      (TRC_MEM + 1)
    125  1.1  cherry #define TRC_MEM_PAGE_GRANT_UNMAP    (TRC_MEM + 2)
    126  1.1  cherry #define TRC_MEM_PAGE_GRANT_TRANSFER (TRC_MEM + 3)
    127  1.1  cherry #define TRC_MEM_SET_P2M_ENTRY       (TRC_MEM + 4)
    128  1.1  cherry #define TRC_MEM_DECREASE_RESERVATION (TRC_MEM + 5)
    129  1.1  cherry #define TRC_MEM_POD_POPULATE        (TRC_MEM + 16)
    130  1.1  cherry #define TRC_MEM_POD_ZERO_RECLAIM    (TRC_MEM + 17)
    131  1.1  cherry #define TRC_MEM_POD_SUPERPAGE_SPLINTER (TRC_MEM + 18)
    132  1.1  cherry 
    133  1.1  cherry #define TRC_PV_ENTRY   0x00201000 /* Hypervisor entry points for PV guests. */
    134  1.1  cherry #define TRC_PV_SUBCALL 0x00202000 /* Sub-call in a multicall hypercall */
    135  1.1  cherry 
    136  1.1  cherry #define TRC_PV_HYPERCALL             (TRC_PV_ENTRY +  1)
    137  1.1  cherry #define TRC_PV_TRAP                  (TRC_PV_ENTRY +  3)
    138  1.1  cherry #define TRC_PV_PAGE_FAULT            (TRC_PV_ENTRY +  4)
    139  1.1  cherry #define TRC_PV_FORCED_INVALID_OP     (TRC_PV_ENTRY +  5)
    140  1.1  cherry #define TRC_PV_EMULATE_PRIVOP        (TRC_PV_ENTRY +  6)
    141  1.1  cherry #define TRC_PV_EMULATE_4GB           (TRC_PV_ENTRY +  7)
    142  1.1  cherry #define TRC_PV_MATH_STATE_RESTORE    (TRC_PV_ENTRY +  8)
    143  1.1  cherry #define TRC_PV_PAGING_FIXUP          (TRC_PV_ENTRY +  9)
    144  1.1  cherry #define TRC_PV_GDT_LDT_MAPPING_FAULT (TRC_PV_ENTRY + 10)
    145  1.1  cherry #define TRC_PV_PTWR_EMULATION        (TRC_PV_ENTRY + 11)
    146  1.1  cherry #define TRC_PV_PTWR_EMULATION_PAE    (TRC_PV_ENTRY + 12)
    147  1.1  cherry #define TRC_PV_HYPERCALL_V2          (TRC_PV_ENTRY + 13)
    148  1.1  cherry #define TRC_PV_HYPERCALL_SUBCALL     (TRC_PV_SUBCALL + 14)
    149  1.1  cherry 
    150  1.1  cherry /*
    151  1.1  cherry  * TRC_PV_HYPERCALL_V2 format
    152  1.1  cherry  *
    153  1.1  cherry  * Only some of the hypercall argument are recorded. Bit fields A0 to
    154  1.1  cherry  * A5 in the first extra word are set if the argument is present and
    155  1.1  cherry  * the arguments themselves are packed sequentially in the following
    156  1.1  cherry  * words.
    157  1.1  cherry  *
    158  1.1  cherry  * The TRC_64_FLAG bit is not set for these events (even if there are
    159  1.1  cherry  * 64-bit arguments in the record).
    160  1.1  cherry  *
    161  1.1  cherry  * Word
    162  1.1  cherry  * 0    bit 31 30|29 28|27 26|25 24|23 22|21 20|19 ... 0
    163  1.1  cherry  *          A5   |A4   |A3   |A2   |A1   |A0   |Hypercall op
    164  1.1  cherry  * 1    First 32 bit (or low word of first 64 bit) arg in record
    165  1.1  cherry  * 2    Second 32 bit (or high word of first 64 bit) arg in record
    166  1.1  cherry  * ...
    167  1.1  cherry  *
    168  1.1  cherry  * A0-A5 bitfield values:
    169  1.1  cherry  *
    170  1.1  cherry  *   00b  Argument not present
    171  1.1  cherry  *   01b  32-bit argument present
    172  1.1  cherry  *   10b  64-bit argument present
    173  1.1  cherry  *   11b  Reserved
    174  1.1  cherry  */
    175  1.1  cherry #define TRC_PV_HYPERCALL_V2_ARG_32(i) (0x1 << (20 + 2*(i)))
    176  1.1  cherry #define TRC_PV_HYPERCALL_V2_ARG_64(i) (0x2 << (20 + 2*(i)))
    177  1.1  cherry #define TRC_PV_HYPERCALL_V2_ARG_MASK  (0xfff00000)
    178  1.1  cherry 
    179  1.1  cherry #define TRC_SHADOW_NOT_SHADOW                 (TRC_SHADOW +  1)
    180  1.1  cherry #define TRC_SHADOW_FAST_PROPAGATE             (TRC_SHADOW +  2)
    181  1.1  cherry #define TRC_SHADOW_FAST_MMIO                  (TRC_SHADOW +  3)
    182  1.1  cherry #define TRC_SHADOW_FALSE_FAST_PATH            (TRC_SHADOW +  4)
    183  1.1  cherry #define TRC_SHADOW_MMIO                       (TRC_SHADOW +  5)
    184  1.1  cherry #define TRC_SHADOW_FIXUP                      (TRC_SHADOW +  6)
    185  1.1  cherry #define TRC_SHADOW_DOMF_DYING                 (TRC_SHADOW +  7)
    186  1.1  cherry #define TRC_SHADOW_EMULATE                    (TRC_SHADOW +  8)
    187  1.1  cherry #define TRC_SHADOW_EMULATE_UNSHADOW_USER      (TRC_SHADOW +  9)
    188  1.1  cherry #define TRC_SHADOW_EMULATE_UNSHADOW_EVTINJ    (TRC_SHADOW + 10)
    189  1.1  cherry #define TRC_SHADOW_EMULATE_UNSHADOW_UNHANDLED (TRC_SHADOW + 11)
    190  1.1  cherry #define TRC_SHADOW_WRMAP_BF                   (TRC_SHADOW + 12)
    191  1.1  cherry #define TRC_SHADOW_PREALLOC_UNPIN             (TRC_SHADOW + 13)
    192  1.1  cherry #define TRC_SHADOW_RESYNC_FULL                (TRC_SHADOW + 14)
    193  1.1  cherry #define TRC_SHADOW_RESYNC_ONLY                (TRC_SHADOW + 15)
    194  1.1  cherry 
    195  1.1  cherry /* trace events per subclass */
    196  1.1  cherry #define TRC_HVM_NESTEDFLAG      (0x400)
    197  1.1  cherry #define TRC_HVM_VMENTRY         (TRC_HVM_ENTRYEXIT + 0x01)
    198  1.1  cherry #define TRC_HVM_VMEXIT          (TRC_HVM_ENTRYEXIT + 0x02)
    199  1.1  cherry #define TRC_HVM_VMEXIT64        (TRC_HVM_ENTRYEXIT + TRC_64_FLAG + 0x02)
    200  1.1  cherry #define TRC_HVM_PF_XEN          (TRC_HVM_HANDLER + 0x01)
    201  1.1  cherry #define TRC_HVM_PF_XEN64        (TRC_HVM_HANDLER + TRC_64_FLAG + 0x01)
    202  1.1  cherry #define TRC_HVM_PF_INJECT       (TRC_HVM_HANDLER + 0x02)
    203  1.1  cherry #define TRC_HVM_PF_INJECT64     (TRC_HVM_HANDLER + TRC_64_FLAG + 0x02)
    204  1.1  cherry #define TRC_HVM_INJ_EXC         (TRC_HVM_HANDLER + 0x03)
    205  1.1  cherry #define TRC_HVM_INJ_VIRQ        (TRC_HVM_HANDLER + 0x04)
    206  1.1  cherry #define TRC_HVM_REINJ_VIRQ      (TRC_HVM_HANDLER + 0x05)
    207  1.1  cherry #define TRC_HVM_IO_READ         (TRC_HVM_HANDLER + 0x06)
    208  1.1  cherry #define TRC_HVM_IO_WRITE        (TRC_HVM_HANDLER + 0x07)
    209  1.1  cherry #define TRC_HVM_CR_READ         (TRC_HVM_HANDLER + 0x08)
    210  1.1  cherry #define TRC_HVM_CR_READ64       (TRC_HVM_HANDLER + TRC_64_FLAG + 0x08)
    211  1.1  cherry #define TRC_HVM_CR_WRITE        (TRC_HVM_HANDLER + 0x09)
    212  1.1  cherry #define TRC_HVM_CR_WRITE64      (TRC_HVM_HANDLER + TRC_64_FLAG + 0x09)
    213  1.1  cherry #define TRC_HVM_DR_READ         (TRC_HVM_HANDLER + 0x0A)
    214  1.1  cherry #define TRC_HVM_DR_WRITE        (TRC_HVM_HANDLER + 0x0B)
    215  1.1  cherry #define TRC_HVM_MSR_READ        (TRC_HVM_HANDLER + 0x0C)
    216  1.1  cherry #define TRC_HVM_MSR_WRITE       (TRC_HVM_HANDLER + 0x0D)
    217  1.1  cherry #define TRC_HVM_CPUID           (TRC_HVM_HANDLER + 0x0E)
    218  1.1  cherry #define TRC_HVM_INTR            (TRC_HVM_HANDLER + 0x0F)
    219  1.1  cherry #define TRC_HVM_NMI             (TRC_HVM_HANDLER + 0x10)
    220  1.1  cherry #define TRC_HVM_SMI             (TRC_HVM_HANDLER + 0x11)
    221  1.1  cherry #define TRC_HVM_VMMCALL         (TRC_HVM_HANDLER + 0x12)
    222  1.1  cherry #define TRC_HVM_HLT             (TRC_HVM_HANDLER + 0x13)
    223  1.1  cherry #define TRC_HVM_INVLPG          (TRC_HVM_HANDLER + 0x14)
    224  1.1  cherry #define TRC_HVM_INVLPG64        (TRC_HVM_HANDLER + TRC_64_FLAG + 0x14)
    225  1.1  cherry #define TRC_HVM_MCE             (TRC_HVM_HANDLER + 0x15)
    226  1.1  cherry #define TRC_HVM_IOPORT_READ     (TRC_HVM_HANDLER + 0x16)
    227  1.1  cherry #define TRC_HVM_IOMEM_READ      (TRC_HVM_HANDLER + 0x17)
    228  1.1  cherry #define TRC_HVM_CLTS            (TRC_HVM_HANDLER + 0x18)
    229  1.1  cherry #define TRC_HVM_LMSW            (TRC_HVM_HANDLER + 0x19)
    230  1.1  cherry #define TRC_HVM_LMSW64          (TRC_HVM_HANDLER + TRC_64_FLAG + 0x19)
    231  1.1  cherry #define TRC_HVM_RDTSC           (TRC_HVM_HANDLER + 0x1a)
    232  1.1  cherry #define TRC_HVM_INTR_WINDOW     (TRC_HVM_HANDLER + 0x20)
    233  1.1  cherry #define TRC_HVM_NPF             (TRC_HVM_HANDLER + 0x21)
    234  1.1  cherry #define TRC_HVM_REALMODE_EMULATE (TRC_HVM_HANDLER + 0x22)
    235  1.1  cherry #define TRC_HVM_TRAP             (TRC_HVM_HANDLER + 0x23)
    236  1.1  cherry #define TRC_HVM_TRAP_DEBUG       (TRC_HVM_HANDLER + 0x24)
    237  1.1  cherry #define TRC_HVM_VLAPIC           (TRC_HVM_HANDLER + 0x25)
    238  1.1  cherry #define TRC_HVM_XCR_READ64      (TRC_HVM_HANDLER + TRC_64_FLAG + 0x26)
    239  1.1  cherry #define TRC_HVM_XCR_WRITE64     (TRC_HVM_HANDLER + TRC_64_FLAG + 0x27)
    240  1.1  cherry 
    241  1.1  cherry #define TRC_HVM_IOPORT_WRITE    (TRC_HVM_HANDLER + 0x216)
    242  1.1  cherry #define TRC_HVM_IOMEM_WRITE     (TRC_HVM_HANDLER + 0x217)
    243  1.1  cherry 
    244  1.1  cherry /* Trace events for emulated devices */
    245  1.1  cherry #define TRC_HVM_EMUL_HPET_START_TIMER  (TRC_HVM_EMUL + 0x1)
    246  1.1  cherry #define TRC_HVM_EMUL_PIT_START_TIMER   (TRC_HVM_EMUL + 0x2)
    247  1.1  cherry #define TRC_HVM_EMUL_RTC_START_TIMER   (TRC_HVM_EMUL + 0x3)
    248  1.1  cherry #define TRC_HVM_EMUL_LAPIC_START_TIMER (TRC_HVM_EMUL + 0x4)
    249  1.1  cherry #define TRC_HVM_EMUL_HPET_STOP_TIMER   (TRC_HVM_EMUL + 0x5)
    250  1.1  cherry #define TRC_HVM_EMUL_PIT_STOP_TIMER    (TRC_HVM_EMUL + 0x6)
    251  1.1  cherry #define TRC_HVM_EMUL_RTC_STOP_TIMER    (TRC_HVM_EMUL + 0x7)
    252  1.1  cherry #define TRC_HVM_EMUL_LAPIC_STOP_TIMER  (TRC_HVM_EMUL + 0x8)
    253  1.1  cherry #define TRC_HVM_EMUL_PIT_TIMER_CB      (TRC_HVM_EMUL + 0x9)
    254  1.1  cherry #define TRC_HVM_EMUL_LAPIC_TIMER_CB    (TRC_HVM_EMUL + 0xA)
    255  1.1  cherry #define TRC_HVM_EMUL_PIC_INT_OUTPUT    (TRC_HVM_EMUL + 0xB)
    256  1.1  cherry #define TRC_HVM_EMUL_PIC_KICK          (TRC_HVM_EMUL + 0xC)
    257  1.1  cherry #define TRC_HVM_EMUL_PIC_INTACK        (TRC_HVM_EMUL + 0xD)
    258  1.1  cherry #define TRC_HVM_EMUL_PIC_POSEDGE       (TRC_HVM_EMUL + 0xE)
    259  1.1  cherry #define TRC_HVM_EMUL_PIC_NEGEDGE       (TRC_HVM_EMUL + 0xF)
    260  1.1  cherry #define TRC_HVM_EMUL_PIC_PEND_IRQ_CALL (TRC_HVM_EMUL + 0x10)
    261  1.1  cherry #define TRC_HVM_EMUL_LAPIC_PIC_INTR    (TRC_HVM_EMUL + 0x11)
    262  1.1  cherry 
    263  1.1  cherry /* trace events for per class */
    264  1.1  cherry #define TRC_PM_FREQ_CHANGE      (TRC_HW_PM + 0x01)
    265  1.1  cherry #define TRC_PM_IDLE_ENTRY       (TRC_HW_PM + 0x02)
    266  1.1  cherry #define TRC_PM_IDLE_EXIT        (TRC_HW_PM + 0x03)
    267  1.1  cherry 
    268  1.1  cherry /* Trace events for IRQs */
    269  1.1  cherry #define TRC_HW_IRQ_MOVE_CLEANUP_DELAY (TRC_HW_IRQ + 0x1)
    270  1.1  cherry #define TRC_HW_IRQ_MOVE_CLEANUP       (TRC_HW_IRQ + 0x2)
    271  1.1  cherry #define TRC_HW_IRQ_BIND_VECTOR        (TRC_HW_IRQ + 0x3)
    272  1.1  cherry #define TRC_HW_IRQ_CLEAR_VECTOR       (TRC_HW_IRQ + 0x4)
    273  1.1  cherry #define TRC_HW_IRQ_MOVE_FINISH        (TRC_HW_IRQ + 0x5)
    274  1.1  cherry #define TRC_HW_IRQ_ASSIGN_VECTOR      (TRC_HW_IRQ + 0x6)
    275  1.1  cherry #define TRC_HW_IRQ_UNMAPPED_VECTOR    (TRC_HW_IRQ + 0x7)
    276  1.1  cherry #define TRC_HW_IRQ_HANDLED            (TRC_HW_IRQ + 0x8)
    277  1.1  cherry 
    278  1.1  cherry /*
    279  1.1  cherry  * Event Flags
    280  1.1  cherry  *
    281  1.1  cherry  * Some events (e.g, TRC_PV_TRAP and TRC_HVM_IOMEM_READ) have multiple
    282  1.1  cherry  * record formats.  These event flags distinguish between the
    283  1.1  cherry  * different formats.
    284  1.1  cherry  */
    285  1.1  cherry #define TRC_64_FLAG 0x100 /* Addresses are 64 bits (instead of 32 bits) */
    286  1.1  cherry 
    287  1.1  cherry /* This structure represents a single trace buffer record. */
    288  1.1  cherry struct t_rec {
    289  1.1  cherry     uint32_t event:28;
    290  1.1  cherry     uint32_t extra_u32:3;         /* # entries in trailing extra_u32[] array */
    291  1.1  cherry     uint32_t cycles_included:1;   /* u.cycles or u.no_cycles? */
    292  1.1  cherry     union {
    293  1.1  cherry         struct {
    294  1.1  cherry             uint32_t cycles_lo, cycles_hi; /* cycle counter timestamp */
    295  1.1  cherry             uint32_t extra_u32[7];         /* event data items */
    296  1.1  cherry         } cycles;
    297  1.1  cherry         struct {
    298  1.1  cherry             uint32_t extra_u32[7];         /* event data items */
    299  1.1  cherry         } nocycles;
    300  1.1  cherry     } u;
    301  1.1  cherry };
    302  1.1  cherry 
    303  1.1  cherry /*
    304  1.1  cherry  * This structure contains the metadata for a single trace buffer.  The head
    305  1.1  cherry  * field, indexes into an array of struct t_rec's.
    306  1.1  cherry  */
    307  1.1  cherry struct t_buf {
    308  1.1  cherry     /* Assume the data buffer size is X.  X is generally not a power of 2.
    309  1.1  cherry      * CONS and PROD are incremented modulo (2*X):
    310  1.1  cherry      *     0 <= cons < 2*X
    311  1.1  cherry      *     0 <= prod < 2*X
    312  1.1  cherry      * This is done because addition modulo X breaks at 2^32 when X is not a
    313  1.1  cherry      * power of 2:
    314  1.1  cherry      *     (((2^32 - 1) % X) + 1) % X != (2^32) % X
    315  1.1  cherry      */
    316  1.1  cherry     uint32_t cons;   /* Offset of next item to be consumed by control tools. */
    317  1.1  cherry     uint32_t prod;   /* Offset of next item to be produced by Xen.           */
    318  1.1  cherry     /*  Records follow immediately after the meta-data header.    */
    319  1.1  cherry };
    320  1.1  cherry 
    321  1.1  cherry /* Structure used to pass MFNs to the trace buffers back to trace consumers.
    322  1.1  cherry  * Offset is an offset into the mapped structure where the mfn list will be held.
    323  1.1  cherry  * MFNs will be at ((unsigned long *)(t_info))+(t_info->cpu_offset[cpu]).
    324  1.1  cherry  */
    325  1.1  cherry struct t_info {
    326  1.1  cherry     uint16_t tbuf_size; /* Size in pages of each trace buffer */
    327  1.1  cherry     uint16_t mfn_offset[];  /* Offset within t_info structure of the page list per cpu */
    328  1.1  cherry     /* MFN lists immediately after the header */
    329  1.1  cherry };
    330  1.1  cherry 
    331  1.1  cherry #endif /* __XEN_PUBLIC_TRACE_H__ */
    332  1.1  cherry 
    333  1.1  cherry /*
    334  1.1  cherry  * Local variables:
    335  1.1  cherry  * mode: C
    336  1.1  cherry  * c-file-style: "BSD"
    337  1.1  cherry  * c-basic-offset: 4
    338  1.1  cherry  * tab-width: 4
    339  1.1  cherry  * indent-tabs-mode: nil
    340  1.1  cherry  * End:
    341  1.1  cherry  */
    342