cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

trace_hv.h (14666B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#if !defined(_TRACE_KVM_HV_H) || defined(TRACE_HEADER_MULTI_READ)
      3#define _TRACE_KVM_HV_H
      4
      5#include <linux/tracepoint.h>
      6#include "trace_book3s.h"
      7#include <asm/hvcall.h>
      8#include <asm/kvm_asm.h>
      9
     10#undef TRACE_SYSTEM
     11#define TRACE_SYSTEM kvm_hv
     12
     13#define kvm_trace_symbol_hcall \
     14	{H_REMOVE,			"H_REMOVE"}, \
     15	{H_ENTER,			"H_ENTER"}, \
     16	{H_READ,			"H_READ"}, \
     17	{H_CLEAR_MOD,			"H_CLEAR_MOD"}, \
     18	{H_CLEAR_REF,			"H_CLEAR_REF"}, \
     19	{H_PROTECT,			"H_PROTECT"}, \
     20	{H_GET_TCE,			"H_GET_TCE"}, \
     21	{H_PUT_TCE,			"H_PUT_TCE"}, \
     22	{H_SET_SPRG0,			"H_SET_SPRG0"}, \
     23	{H_SET_DABR,			"H_SET_DABR"}, \
     24	{H_PAGE_INIT,			"H_PAGE_INIT"}, \
     25	{H_SET_ASR,			"H_SET_ASR"}, \
     26	{H_ASR_ON,			"H_ASR_ON"}, \
     27	{H_ASR_OFF,			"H_ASR_OFF"}, \
     28	{H_LOGICAL_CI_LOAD,		"H_LOGICAL_CI_LOAD"}, \
     29	{H_LOGICAL_CI_STORE,		"H_LOGICAL_CI_STORE"}, \
     30	{H_LOGICAL_CACHE_LOAD,		"H_LOGICAL_CACHE_LOAD"}, \
     31	{H_LOGICAL_CACHE_STORE,		"H_LOGICAL_CACHE_STORE"}, \
     32	{H_LOGICAL_ICBI,		"H_LOGICAL_ICBI"}, \
     33	{H_LOGICAL_DCBF,		"H_LOGICAL_DCBF"}, \
     34	{H_GET_TERM_CHAR,		"H_GET_TERM_CHAR"}, \
     35	{H_PUT_TERM_CHAR,		"H_PUT_TERM_CHAR"}, \
     36	{H_REAL_TO_LOGICAL,		"H_REAL_TO_LOGICAL"}, \
     37	{H_HYPERVISOR_DATA,		"H_HYPERVISOR_DATA"}, \
     38	{H_EOI,				"H_EOI"}, \
     39	{H_CPPR,			"H_CPPR"}, \
     40	{H_IPI,				"H_IPI"}, \
     41	{H_IPOLL,			"H_IPOLL"}, \
     42	{H_XIRR,			"H_XIRR"}, \
     43	{H_PERFMON,			"H_PERFMON"}, \
     44	{H_MIGRATE_DMA,			"H_MIGRATE_DMA"}, \
     45	{H_REGISTER_VPA,		"H_REGISTER_VPA"}, \
     46	{H_CEDE,			"H_CEDE"}, \
     47	{H_CONFER,			"H_CONFER"}, \
     48	{H_PROD,			"H_PROD"}, \
     49	{H_GET_PPP,			"H_GET_PPP"}, \
     50	{H_SET_PPP,			"H_SET_PPP"}, \
     51	{H_PURR,			"H_PURR"}, \
     52	{H_PIC,				"H_PIC"}, \
     53	{H_REG_CRQ,			"H_REG_CRQ"}, \
     54	{H_FREE_CRQ,			"H_FREE_CRQ"}, \
     55	{H_VIO_SIGNAL,			"H_VIO_SIGNAL"}, \
     56	{H_SEND_CRQ,			"H_SEND_CRQ"}, \
     57	{H_COPY_RDMA,			"H_COPY_RDMA"}, \
     58	{H_REGISTER_LOGICAL_LAN,	"H_REGISTER_LOGICAL_LAN"}, \
     59	{H_FREE_LOGICAL_LAN,		"H_FREE_LOGICAL_LAN"}, \
     60	{H_ADD_LOGICAL_LAN_BUFFER,	"H_ADD_LOGICAL_LAN_BUFFER"}, \
     61	{H_SEND_LOGICAL_LAN,		"H_SEND_LOGICAL_LAN"}, \
     62	{H_BULK_REMOVE,			"H_BULK_REMOVE"}, \
     63	{H_MULTICAST_CTRL,		"H_MULTICAST_CTRL"}, \
     64	{H_SET_XDABR,			"H_SET_XDABR"}, \
     65	{H_STUFF_TCE,			"H_STUFF_TCE"}, \
     66	{H_PUT_TCE_INDIRECT,		"H_PUT_TCE_INDIRECT"}, \
     67	{H_CHANGE_LOGICAL_LAN_MAC,	"H_CHANGE_LOGICAL_LAN_MAC"}, \
     68	{H_VTERM_PARTNER_INFO,		"H_VTERM_PARTNER_INFO"}, \
     69	{H_REGISTER_VTERM,		"H_REGISTER_VTERM"}, \
     70	{H_FREE_VTERM,			"H_FREE_VTERM"}, \
     71	{H_RESET_EVENTS,		"H_RESET_EVENTS"}, \
     72	{H_ALLOC_RESOURCE,		"H_ALLOC_RESOURCE"}, \
     73	{H_FREE_RESOURCE,		"H_FREE_RESOURCE"}, \
     74	{H_MODIFY_QP,			"H_MODIFY_QP"}, \
     75	{H_QUERY_QP,			"H_QUERY_QP"}, \
     76	{H_REREGISTER_PMR,		"H_REREGISTER_PMR"}, \
     77	{H_REGISTER_SMR,		"H_REGISTER_SMR"}, \
     78	{H_QUERY_MR,			"H_QUERY_MR"}, \
     79	{H_QUERY_MW,			"H_QUERY_MW"}, \
     80	{H_QUERY_HCA,			"H_QUERY_HCA"}, \
     81	{H_QUERY_PORT,			"H_QUERY_PORT"}, \
     82	{H_MODIFY_PORT,			"H_MODIFY_PORT"}, \
     83	{H_DEFINE_AQP1,			"H_DEFINE_AQP1"}, \
     84	{H_GET_TRACE_BUFFER,		"H_GET_TRACE_BUFFER"}, \
     85	{H_DEFINE_AQP0,			"H_DEFINE_AQP0"}, \
     86	{H_RESIZE_MR,			"H_RESIZE_MR"}, \
     87	{H_ATTACH_MCQP,			"H_ATTACH_MCQP"}, \
     88	{H_DETACH_MCQP,			"H_DETACH_MCQP"}, \
     89	{H_CREATE_RPT,			"H_CREATE_RPT"}, \
     90	{H_REMOVE_RPT,			"H_REMOVE_RPT"}, \
     91	{H_REGISTER_RPAGES,		"H_REGISTER_RPAGES"}, \
     92	{H_DISABLE_AND_GET,		"H_DISABLE_AND_GET"}, \
     93	{H_ERROR_DATA,			"H_ERROR_DATA"}, \
     94	{H_GET_HCA_INFO,		"H_GET_HCA_INFO"}, \
     95	{H_GET_PERF_COUNT,		"H_GET_PERF_COUNT"}, \
     96	{H_MANAGE_TRACE,		"H_MANAGE_TRACE"}, \
     97	{H_FREE_LOGICAL_LAN_BUFFER,	"H_FREE_LOGICAL_LAN_BUFFER"}, \
     98	{H_QUERY_INT_STATE,		"H_QUERY_INT_STATE"}, \
     99	{H_POLL_PENDING,		"H_POLL_PENDING"}, \
    100	{H_ILLAN_ATTRIBUTES,		"H_ILLAN_ATTRIBUTES"}, \
    101	{H_MODIFY_HEA_QP,		"H_MODIFY_HEA_QP"}, \
    102	{H_QUERY_HEA_QP,		"H_QUERY_HEA_QP"}, \
    103	{H_QUERY_HEA,			"H_QUERY_HEA"}, \
    104	{H_QUERY_HEA_PORT,		"H_QUERY_HEA_PORT"}, \
    105	{H_MODIFY_HEA_PORT,		"H_MODIFY_HEA_PORT"}, \
    106	{H_REG_BCMC,			"H_REG_BCMC"}, \
    107	{H_DEREG_BCMC,			"H_DEREG_BCMC"}, \
    108	{H_REGISTER_HEA_RPAGES,		"H_REGISTER_HEA_RPAGES"}, \
    109	{H_DISABLE_AND_GET_HEA,		"H_DISABLE_AND_GET_HEA"}, \
    110	{H_GET_HEA_INFO,		"H_GET_HEA_INFO"}, \
    111	{H_ALLOC_HEA_RESOURCE,		"H_ALLOC_HEA_RESOURCE"}, \
    112	{H_ADD_CONN,			"H_ADD_CONN"}, \
    113	{H_DEL_CONN,			"H_DEL_CONN"}, \
    114	{H_JOIN,			"H_JOIN"}, \
    115	{H_VASI_STATE,			"H_VASI_STATE"}, \
    116	{H_ENABLE_CRQ,			"H_ENABLE_CRQ"}, \
    117	{H_GET_EM_PARMS,		"H_GET_EM_PARMS"}, \
    118	{H_GET_ENERGY_SCALE_INFO,	"H_GET_ENERGY_SCALE_INFO"}, \
    119	{H_SET_MPP,			"H_SET_MPP"}, \
    120	{H_GET_MPP,			"H_GET_MPP"}, \
    121	{H_HOME_NODE_ASSOCIATIVITY,	"H_HOME_NODE_ASSOCIATIVITY"}, \
    122	{H_BEST_ENERGY,			"H_BEST_ENERGY"}, \
    123	{H_XIRR_X,			"H_XIRR_X"}, \
    124	{H_RANDOM,			"H_RANDOM"}, \
    125	{H_COP,				"H_COP"}, \
    126	{H_GET_MPP_X,			"H_GET_MPP_X"}, \
    127	{H_SET_MODE,			"H_SET_MODE"}, \
    128	{H_RTAS,			"H_RTAS"}
    129
    130#define kvm_trace_symbol_kvmret \
    131	{RESUME_GUEST,			"RESUME_GUEST"}, \
    132	{RESUME_GUEST_NV,		"RESUME_GUEST_NV"}, \
    133	{RESUME_HOST,			"RESUME_HOST"}, \
    134	{RESUME_HOST_NV,		"RESUME_HOST_NV"}
    135
    136#define kvm_trace_symbol_hcall_rc \
    137	{H_SUCCESS,			"H_SUCCESS"}, \
    138	{H_BUSY,			"H_BUSY"}, \
    139	{H_CLOSED,			"H_CLOSED"}, \
    140	{H_NOT_AVAILABLE,		"H_NOT_AVAILABLE"}, \
    141	{H_CONSTRAINED,			"H_CONSTRAINED"}, \
    142	{H_PARTIAL,			"H_PARTIAL"}, \
    143	{H_IN_PROGRESS,			"H_IN_PROGRESS"}, \
    144	{H_PAGE_REGISTERED,		"H_PAGE_REGISTERED"}, \
    145	{H_PARTIAL_STORE,		"H_PARTIAL_STORE"}, \
    146	{H_PENDING,			"H_PENDING"}, \
    147	{H_CONTINUE,			"H_CONTINUE"}, \
    148	{H_LONG_BUSY_START_RANGE,	"H_LONG_BUSY_START_RANGE"}, \
    149	{H_LONG_BUSY_ORDER_1_MSEC,	"H_LONG_BUSY_ORDER_1_MSEC"}, \
    150	{H_LONG_BUSY_ORDER_10_MSEC,	"H_LONG_BUSY_ORDER_10_MSEC"}, \
    151	{H_LONG_BUSY_ORDER_100_MSEC,	"H_LONG_BUSY_ORDER_100_MSEC"}, \
    152	{H_LONG_BUSY_ORDER_1_SEC,	"H_LONG_BUSY_ORDER_1_SEC"}, \
    153	{H_LONG_BUSY_ORDER_10_SEC,	"H_LONG_BUSY_ORDER_10_SEC"}, \
    154	{H_LONG_BUSY_ORDER_100_SEC,	"H_LONG_BUSY_ORDER_100_SEC"}, \
    155	{H_LONG_BUSY_END_RANGE,		"H_LONG_BUSY_END_RANGE"}, \
    156	{H_TOO_HARD,			"H_TOO_HARD"}, \
    157	{H_HARDWARE,			"H_HARDWARE"}, \
    158	{H_FUNCTION,			"H_FUNCTION"}, \
    159	{H_PRIVILEGE,			"H_PRIVILEGE"}, \
    160	{H_PARAMETER,			"H_PARAMETER"}, \
    161	{H_BAD_MODE,			"H_BAD_MODE"}, \
    162	{H_PTEG_FULL,			"H_PTEG_FULL"}, \
    163	{H_NOT_FOUND,			"H_NOT_FOUND"}, \
    164	{H_RESERVED_DABR,		"H_RESERVED_DABR"}, \
    165	{H_NO_MEM,			"H_NO_MEM"}, \
    166	{H_AUTHORITY,			"H_AUTHORITY"}, \
    167	{H_PERMISSION,			"H_PERMISSION"}, \
    168	{H_DROPPED,			"H_DROPPED"}, \
    169	{H_SOURCE_PARM,			"H_SOURCE_PARM"}, \
    170	{H_DEST_PARM,			"H_DEST_PARM"}, \
    171	{H_REMOTE_PARM,			"H_REMOTE_PARM"}, \
    172	{H_RESOURCE,			"H_RESOURCE"}, \
    173	{H_ADAPTER_PARM,		"H_ADAPTER_PARM"}, \
    174	{H_RH_PARM,			"H_RH_PARM"}, \
    175	{H_RCQ_PARM,			"H_RCQ_PARM"}, \
    176	{H_SCQ_PARM,			"H_SCQ_PARM"}, \
    177	{H_EQ_PARM,			"H_EQ_PARM"}, \
    178	{H_RT_PARM,			"H_RT_PARM"}, \
    179	{H_ST_PARM,			"H_ST_PARM"}, \
    180	{H_SIGT_PARM,			"H_SIGT_PARM"}, \
    181	{H_TOKEN_PARM,			"H_TOKEN_PARM"}, \
    182	{H_MLENGTH_PARM,		"H_MLENGTH_PARM"}, \
    183	{H_MEM_PARM,			"H_MEM_PARM"}, \
    184	{H_MEM_ACCESS_PARM,		"H_MEM_ACCESS_PARM"}, \
    185	{H_ATTR_PARM,			"H_ATTR_PARM"}, \
    186	{H_PORT_PARM,			"H_PORT_PARM"}, \
    187	{H_MCG_PARM,			"H_MCG_PARM"}, \
    188	{H_VL_PARM,			"H_VL_PARM"}, \
    189	{H_TSIZE_PARM,			"H_TSIZE_PARM"}, \
    190	{H_TRACE_PARM,			"H_TRACE_PARM"}, \
    191	{H_MASK_PARM,			"H_MASK_PARM"}, \
    192	{H_MCG_FULL,			"H_MCG_FULL"}, \
    193	{H_ALIAS_EXIST,			"H_ALIAS_EXIST"}, \
    194	{H_P_COUNTER,			"H_P_COUNTER"}, \
    195	{H_TABLE_FULL,			"H_TABLE_FULL"}, \
    196	{H_ALT_TABLE,			"H_ALT_TABLE"}, \
    197	{H_MR_CONDITION,		"H_MR_CONDITION"}, \
    198	{H_NOT_ENOUGH_RESOURCES,	"H_NOT_ENOUGH_RESOURCES"}, \
    199	{H_R_STATE,			"H_R_STATE"}, \
    200	{H_RESCINDED,			"H_RESCINDED"}, \
    201	{H_P2,				"H_P2"}, \
    202	{H_P3,				"H_P3"}, \
    203	{H_P4,				"H_P4"}, \
    204	{H_P5,				"H_P5"}, \
    205	{H_P6,				"H_P6"}, \
    206	{H_P7,				"H_P7"}, \
    207	{H_P8,				"H_P8"}, \
    208	{H_P9,				"H_P9"}, \
    209	{H_TOO_BIG,			"H_TOO_BIG"}, \
    210	{H_OVERLAP,			"H_OVERLAP"}, \
    211	{H_INTERRUPT,			"H_INTERRUPT"}, \
    212	{H_BAD_DATA,			"H_BAD_DATA"}, \
    213	{H_NOT_ACTIVE,			"H_NOT_ACTIVE"}, \
    214	{H_SG_LIST,			"H_SG_LIST"}, \
    215	{H_OP_MODE,			"H_OP_MODE"}, \
    216	{H_COP_HW,			"H_COP_HW"}, \
    217	{H_UNSUPPORTED_FLAG_START,	"H_UNSUPPORTED_FLAG_START"}, \
    218	{H_UNSUPPORTED_FLAG_END,	"H_UNSUPPORTED_FLAG_END"}, \
    219	{H_MULTI_THREADS_ACTIVE,	"H_MULTI_THREADS_ACTIVE"}, \
    220	{H_OUTSTANDING_COP_OPS,		"H_OUTSTANDING_COP_OPS"}
    221
    222TRACE_EVENT(kvm_guest_enter,
    223	TP_PROTO(struct kvm_vcpu *vcpu),
    224	TP_ARGS(vcpu),
    225
    226	TP_STRUCT__entry(
    227		__field(int,		vcpu_id)
    228		__field(unsigned long,	pc)
    229		__field(unsigned long,  pending_exceptions)
    230		__field(u8,		ceded)
    231	),
    232
    233	TP_fast_assign(
    234		__entry->vcpu_id	= vcpu->vcpu_id;
    235		__entry->pc		= kvmppc_get_pc(vcpu);
    236		__entry->ceded		= vcpu->arch.ceded;
    237		__entry->pending_exceptions  = vcpu->arch.pending_exceptions;
    238	),
    239
    240	TP_printk("VCPU %d: pc=0x%lx pexcp=0x%lx ceded=%d",
    241			__entry->vcpu_id,
    242			__entry->pc,
    243			__entry->pending_exceptions, __entry->ceded)
    244);
    245
    246TRACE_EVENT(kvm_guest_exit,
    247	TP_PROTO(struct kvm_vcpu *vcpu),
    248	TP_ARGS(vcpu),
    249
    250	TP_STRUCT__entry(
    251		__field(int,		vcpu_id)
    252		__field(int,		trap)
    253		__field(unsigned long,	pc)
    254		__field(unsigned long,	msr)
    255		__field(u8,		ceded)
    256	),
    257
    258	TP_fast_assign(
    259		__entry->vcpu_id = vcpu->vcpu_id;
    260		__entry->trap	 = vcpu->arch.trap;
    261		__entry->ceded	 = vcpu->arch.ceded;
    262		__entry->pc	 = kvmppc_get_pc(vcpu);
    263		__entry->msr	 = vcpu->arch.shregs.msr;
    264	),
    265
    266	TP_printk("VCPU %d: trap=%s pc=0x%lx msr=0x%lx, ceded=%d",
    267		__entry->vcpu_id,
    268		__print_symbolic(__entry->trap, kvm_trace_symbol_exit),
    269		__entry->pc, __entry->msr, __entry->ceded
    270	)
    271);
    272
    273TRACE_EVENT(kvm_page_fault_enter,
    274	TP_PROTO(struct kvm_vcpu *vcpu, unsigned long *hptep,
    275		 struct kvm_memory_slot *memslot, unsigned long ea,
    276		 unsigned long dsisr),
    277
    278	TP_ARGS(vcpu, hptep, memslot, ea, dsisr),
    279
    280	TP_STRUCT__entry(
    281		__field(int,		vcpu_id)
    282		__field(unsigned long,	hpte_v)
    283		__field(unsigned long,	hpte_r)
    284		__field(unsigned long,	gpte_r)
    285		__field(unsigned long,	ea)
    286		__field(u64,		base_gfn)
    287		__field(u32,		slot_flags)
    288		__field(u32,		dsisr)
    289	),
    290
    291	TP_fast_assign(
    292		__entry->vcpu_id  = vcpu->vcpu_id;
    293		__entry->hpte_v	  = hptep[0];
    294		__entry->hpte_r	  = hptep[1];
    295		__entry->gpte_r	  = hptep[2];
    296		__entry->ea	  = ea;
    297		__entry->dsisr	  = dsisr;
    298		__entry->base_gfn = memslot ? memslot->base_gfn : -1UL;
    299		__entry->slot_flags = memslot ? memslot->flags : 0;
    300	),
    301
    302	TP_printk("VCPU %d: hpte=0x%lx:0x%lx guest=0x%lx ea=0x%lx,%x slot=0x%llx,0x%x",
    303		   __entry->vcpu_id,
    304		   __entry->hpte_v, __entry->hpte_r, __entry->gpte_r,
    305		   __entry->ea, __entry->dsisr,
    306		   __entry->base_gfn, __entry->slot_flags)
    307);
    308
    309TRACE_EVENT(kvm_page_fault_exit,
    310	TP_PROTO(struct kvm_vcpu *vcpu, unsigned long *hptep, long ret),
    311
    312	TP_ARGS(vcpu, hptep, ret),
    313
    314	TP_STRUCT__entry(
    315		__field(int,		vcpu_id)
    316		__field(unsigned long,	hpte_v)
    317		__field(unsigned long,	hpte_r)
    318		__field(long,		ret)
    319	),
    320
    321	TP_fast_assign(
    322		__entry->vcpu_id  = vcpu->vcpu_id;
    323		__entry->hpte_v	= hptep[0];
    324		__entry->hpte_r	= hptep[1];
    325		__entry->ret = ret;
    326	),
    327
    328	TP_printk("VCPU %d: hpte=0x%lx:0x%lx ret=0x%lx",
    329		   __entry->vcpu_id,
    330		   __entry->hpte_v, __entry->hpte_r, __entry->ret)
    331);
    332
    333TRACE_EVENT(kvm_hcall_enter,
    334	TP_PROTO(struct kvm_vcpu *vcpu),
    335
    336	TP_ARGS(vcpu),
    337
    338	TP_STRUCT__entry(
    339		__field(int,		vcpu_id)
    340		__field(unsigned long,	req)
    341		__field(unsigned long,	gpr4)
    342		__field(unsigned long,	gpr5)
    343		__field(unsigned long,	gpr6)
    344		__field(unsigned long,	gpr7)
    345	),
    346
    347	TP_fast_assign(
    348		__entry->vcpu_id  = vcpu->vcpu_id;
    349		__entry->req   = kvmppc_get_gpr(vcpu, 3);
    350		__entry->gpr4  = kvmppc_get_gpr(vcpu, 4);
    351		__entry->gpr5  = kvmppc_get_gpr(vcpu, 5);
    352		__entry->gpr6  = kvmppc_get_gpr(vcpu, 6);
    353		__entry->gpr7  = kvmppc_get_gpr(vcpu, 7);
    354	),
    355
    356	TP_printk("VCPU %d: hcall=%s GPR4-7=0x%lx,0x%lx,0x%lx,0x%lx",
    357		   __entry->vcpu_id,
    358		   __print_symbolic(__entry->req, kvm_trace_symbol_hcall),
    359		   __entry->gpr4, __entry->gpr5, __entry->gpr6, __entry->gpr7)
    360);
    361
    362TRACE_EVENT(kvm_hcall_exit,
    363	TP_PROTO(struct kvm_vcpu *vcpu, int ret),
    364
    365	TP_ARGS(vcpu, ret),
    366
    367	TP_STRUCT__entry(
    368		__field(int,		vcpu_id)
    369		__field(unsigned long,	ret)
    370		__field(unsigned long,	hcall_rc)
    371	),
    372
    373	TP_fast_assign(
    374		__entry->vcpu_id  = vcpu->vcpu_id;
    375		__entry->ret	  = ret;
    376		__entry->hcall_rc = kvmppc_get_gpr(vcpu, 3);
    377	),
    378
    379	TP_printk("VCPU %d: ret=%s hcall_rc=%s",
    380		   __entry->vcpu_id,
    381		   __print_symbolic(__entry->ret, kvm_trace_symbol_kvmret),
    382		   __print_symbolic(__entry->ret & RESUME_FLAG_HOST ?
    383					H_TOO_HARD : __entry->hcall_rc,
    384					kvm_trace_symbol_hcall_rc))
    385);
    386
    387TRACE_EVENT(kvmppc_run_core,
    388	TP_PROTO(struct kvmppc_vcore *vc, int where),
    389
    390	TP_ARGS(vc, where),
    391
    392	TP_STRUCT__entry(
    393		__field(int,	n_runnable)
    394		__field(int,	runner_vcpu)
    395		__field(int,	where)
    396		__field(pid_t,	tgid)
    397	),
    398
    399	TP_fast_assign(
    400		__entry->runner_vcpu	= vc->runner->vcpu_id;
    401		__entry->n_runnable	= vc->n_runnable;
    402		__entry->where		= where;
    403		__entry->tgid		= current->tgid;
    404	),
    405
    406	TP_printk("%s runner_vcpu==%d runnable=%d tgid=%d",
    407		    __entry->where ? "Exit" : "Enter",
    408		    __entry->runner_vcpu, __entry->n_runnable, __entry->tgid)
    409);
    410
    411TRACE_EVENT(kvmppc_vcore_blocked,
    412	TP_PROTO(struct kvm_vcpu *vcpu, int where),
    413
    414	TP_ARGS(vcpu, where),
    415
    416	TP_STRUCT__entry(
    417		__field(int,	n_runnable)
    418		__field(int,	runner_vcpu)
    419		__field(int,	where)
    420		__field(pid_t,	tgid)
    421	),
    422
    423	TP_fast_assign(
    424		__entry->runner_vcpu = vcpu->vcpu_id;
    425		__entry->n_runnable  = vcpu->arch.vcore->n_runnable;
    426		__entry->where       = where;
    427		__entry->tgid	     = current->tgid;
    428	),
    429
    430	TP_printk("%s runner_vcpu=%d runnable=%d tgid=%d",
    431		   __entry->where ? "Exit" : "Enter",
    432		   __entry->runner_vcpu, __entry->n_runnable, __entry->tgid)
    433);
    434
    435TRACE_EVENT(kvmppc_vcore_wakeup,
    436	TP_PROTO(int do_sleep, __u64 ns),
    437
    438	TP_ARGS(do_sleep, ns),
    439
    440	TP_STRUCT__entry(
    441		__field(__u64,  ns)
    442		__field(int,    waited)
    443		__field(pid_t,  tgid)
    444	),
    445
    446	TP_fast_assign(
    447		__entry->ns     = ns;
    448		__entry->waited = do_sleep;
    449		__entry->tgid   = current->tgid;
    450	),
    451
    452	TP_printk("%s time %llu ns, tgid=%d",
    453		__entry->waited ? "wait" : "poll",
    454		__entry->ns, __entry->tgid)
    455);
    456
    457TRACE_EVENT(kvmppc_run_vcpu_enter,
    458	TP_PROTO(struct kvm_vcpu *vcpu),
    459
    460	TP_ARGS(vcpu),
    461
    462	TP_STRUCT__entry(
    463		__field(int,		vcpu_id)
    464		__field(pid_t,		tgid)
    465	),
    466
    467	TP_fast_assign(
    468		__entry->vcpu_id  = vcpu->vcpu_id;
    469		__entry->tgid	  = current->tgid;
    470	),
    471
    472	TP_printk("VCPU %d: tgid=%d", __entry->vcpu_id, __entry->tgid)
    473);
    474
    475TRACE_EVENT(kvmppc_run_vcpu_exit,
    476	TP_PROTO(struct kvm_vcpu *vcpu),
    477
    478	TP_ARGS(vcpu),
    479
    480	TP_STRUCT__entry(
    481		__field(int,		vcpu_id)
    482		__field(int,		exit)
    483		__field(int,		ret)
    484	),
    485
    486	TP_fast_assign(
    487		__entry->vcpu_id  = vcpu->vcpu_id;
    488		__entry->exit     = vcpu->run->exit_reason;
    489		__entry->ret      = vcpu->arch.ret;
    490	),
    491
    492	TP_printk("VCPU %d: exit=%d, ret=%d",
    493			__entry->vcpu_id, __entry->exit, __entry->ret)
    494);
    495
    496#endif /* _TRACE_KVM_HV_H */
    497
    498/* This part must be outside protection */
    499
    500#undef TRACE_INCLUDE_PATH
    501#undef TRACE_INCLUDE_FILE
    502
    503#define TRACE_INCLUDE_PATH .
    504#define TRACE_INCLUDE_FILE trace_hv
    505
    506#include <trace/define_trace.h>