1*6670Stariq /****************************************************************************** 2*6670Stariq * include/public/trace.h 3*6670Stariq * 4*6670Stariq * Permission is hereby granted, free of charge, to any person obtaining a copy 5*6670Stariq * of this software and associated documentation files (the "Software"), to 6*6670Stariq * deal in the Software without restriction, including without limitation the 7*6670Stariq * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8*6670Stariq * sell copies of the Software, and to permit persons to whom the Software is 9*6670Stariq * furnished to do so, subject to the following conditions: 10*6670Stariq * 11*6670Stariq * The above copyright notice and this permission notice shall be included in 12*6670Stariq * all copies or substantial portions of the Software. 13*6670Stariq * 14*6670Stariq * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15*6670Stariq * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16*6670Stariq * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17*6670Stariq * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18*6670Stariq * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19*6670Stariq * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20*6670Stariq * DEALINGS IN THE SOFTWARE. 21*6670Stariq * 22*6670Stariq * Mark Williamson, (C) 2004 Intel Research Cambridge 23*6670Stariq * Copyright (C) 2005 Bin Ren 24*6670Stariq */ 25*6670Stariq 26*6670Stariq #ifndef __XEN_PUBLIC_TRACE_H__ 27*6670Stariq #define __XEN_PUBLIC_TRACE_H__ 28*6670Stariq 29*6670Stariq /* Trace classes */ 30*6670Stariq #define TRC_CLS_SHIFT 16 31*6670Stariq #define TRC_GEN 0x0001f000 /* General trace */ 32*6670Stariq #define TRC_SCHED 0x0002f000 /* Xen Scheduler trace */ 33*6670Stariq #define TRC_DOM0OP 0x0004f000 /* Xen DOM0 operation trace */ 34*6670Stariq #define TRC_HVM 0x0008f000 /* Xen HVM trace */ 35*6670Stariq #define TRC_MEM 0x0010f000 /* Xen memory trace */ 36*6670Stariq #define TRC_ALL 0xfffff000 37*6670Stariq 38*6670Stariq /* Trace subclasses */ 39*6670Stariq #define TRC_SUBCLS_SHIFT 12 40*6670Stariq 41*6670Stariq /* trace subclasses for SVM */ 42*6670Stariq #define TRC_HVM_ENTRYEXIT 0x00081000 /* VMENTRY and #VMEXIT */ 43*6670Stariq #define TRC_HVM_HANDLER 0x00082000 /* various HVM handlers */ 44*6670Stariq 45*6670Stariq /* Trace events per class */ 46*6670Stariq #define TRC_LOST_RECORDS (TRC_GEN + 1) 47*6670Stariq 48*6670Stariq #define TRC_SCHED_DOM_ADD (TRC_SCHED + 1) 49*6670Stariq #define TRC_SCHED_DOM_REM (TRC_SCHED + 2) 50*6670Stariq #define TRC_SCHED_SLEEP (TRC_SCHED + 3) 51*6670Stariq #define TRC_SCHED_WAKE (TRC_SCHED + 4) 52*6670Stariq #define TRC_SCHED_YIELD (TRC_SCHED + 5) 53*6670Stariq #define TRC_SCHED_BLOCK (TRC_SCHED + 6) 54*6670Stariq #define TRC_SCHED_SHUTDOWN (TRC_SCHED + 7) 55*6670Stariq #define TRC_SCHED_CTL (TRC_SCHED + 8) 56*6670Stariq #define TRC_SCHED_ADJDOM (TRC_SCHED + 9) 57*6670Stariq #define TRC_SCHED_SWITCH (TRC_SCHED + 10) 58*6670Stariq #define TRC_SCHED_S_TIMER_FN (TRC_SCHED + 11) 59*6670Stariq #define TRC_SCHED_T_TIMER_FN (TRC_SCHED + 12) 60*6670Stariq #define TRC_SCHED_DOM_TIMER_FN (TRC_SCHED + 13) 61*6670Stariq #define TRC_SCHED_SWITCH_INFPREV (TRC_SCHED + 14) 62*6670Stariq #define TRC_SCHED_SWITCH_INFNEXT (TRC_SCHED + 15) 63*6670Stariq 64*6670Stariq #define TRC_MEM_PAGE_GRANT_MAP (TRC_MEM + 1) 65*6670Stariq #define TRC_MEM_PAGE_GRANT_UNMAP (TRC_MEM + 2) 66*6670Stariq #define TRC_MEM_PAGE_GRANT_TRANSFER (TRC_MEM + 3) 67*6670Stariq 68*6670Stariq /* trace events per subclass */ 69*6670Stariq #define TRC_HVM_VMENTRY (TRC_HVM_ENTRYEXIT + 0x01) 70*6670Stariq #define TRC_HVM_VMEXIT (TRC_HVM_ENTRYEXIT + 0x02) 71*6670Stariq #define TRC_HVM_PF_XEN (TRC_HVM_HANDLER + 0x01) 72*6670Stariq #define TRC_HVM_PF_INJECT (TRC_HVM_HANDLER + 0x02) 73*6670Stariq #define TRC_HVM_INJ_EXC (TRC_HVM_HANDLER + 0x03) 74*6670Stariq #define TRC_HVM_INJ_VIRQ (TRC_HVM_HANDLER + 0x04) 75*6670Stariq #define TRC_HVM_REINJ_VIRQ (TRC_HVM_HANDLER + 0x05) 76*6670Stariq #define TRC_HVM_IO_READ (TRC_HVM_HANDLER + 0x06) 77*6670Stariq #define TRC_HVM_IO_WRITE (TRC_HVM_HANDLER + 0x07) 78*6670Stariq #define TRC_HVM_CR_READ (TRC_HVM_HANDLER + 0x08) 79*6670Stariq #define TRC_HVM_CR_WRITE (TRC_HVM_HANDLER + 0x09) 80*6670Stariq #define TRC_HVM_DR_READ (TRC_HVM_HANDLER + 0x0A) 81*6670Stariq #define TRC_HVM_DR_WRITE (TRC_HVM_HANDLER + 0x0B) 82*6670Stariq #define TRC_HVM_MSR_READ (TRC_HVM_HANDLER + 0x0C) 83*6670Stariq #define TRC_HVM_MSR_WRITE (TRC_HVM_HANDLER + 0x0D) 84*6670Stariq #define TRC_HVM_CPUID (TRC_HVM_HANDLER + 0x0E) 85*6670Stariq #define TRC_HVM_INTR (TRC_HVM_HANDLER + 0x0F) 86*6670Stariq #define TRC_HVM_NMI (TRC_HVM_HANDLER + 0x10) 87*6670Stariq #define TRC_HVM_SMI (TRC_HVM_HANDLER + 0x11) 88*6670Stariq #define TRC_HVM_VMMCALL (TRC_HVM_HANDLER + 0x12) 89*6670Stariq #define TRC_HVM_HLT (TRC_HVM_HANDLER + 0x13) 90*6670Stariq #define TRC_HVM_INVLPG (TRC_HVM_HANDLER + 0x14) 91*6670Stariq #define TRC_HVM_MCE (TRC_HVM_HANDLER + 0x15) 92*6670Stariq 93*6670Stariq /* This structure represents a single trace buffer record. */ 94*6670Stariq struct t_rec { 95*6670Stariq uint64_t cycles; /* cycle counter timestamp */ 96*6670Stariq uint32_t event; /* event ID */ 97*6670Stariq unsigned long data[5]; /* event data items */ 98*6670Stariq }; 99*6670Stariq 100*6670Stariq /* 101*6670Stariq * This structure contains the metadata for a single trace buffer. The head 102*6670Stariq * field, indexes into an array of struct t_rec's. 103*6670Stariq */ 104*6670Stariq struct t_buf { 105*6670Stariq uint32_t cons; /* Next item to be consumed by control tools. */ 106*6670Stariq uint32_t prod; /* Next item to be produced by Xen. */ 107*6670Stariq /* 'nr_recs' records follow immediately after the meta-data header. */ 108*6670Stariq }; 109*6670Stariq 110*6670Stariq #endif /* __XEN_PUBLIC_TRACE_H__ */ 111*6670Stariq 112*6670Stariq /* 113*6670Stariq * Local variables: 114*6670Stariq * mode: C 115*6670Stariq * c-set-style: "BSD" 116*6670Stariq * c-basic-offset: 4 117*6670Stariq * tab-width: 4 118*6670Stariq * indent-tabs-mode: nil 119*6670Stariq * End: 120*6670Stariq */ 121