1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Tracepoints for RISC-V KVM 4 * 5 * Copyright 2024 Beijing ESWIN Computing Technology Co., Ltd. 6 * 7 */ 8 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ) 9 #define _TRACE_KVM_H 10 11 #include <linux/tracepoint.h> 12 13 #undef TRACE_SYSTEM 14 #define TRACE_SYSTEM kvm 15 16 TRACE_EVENT(kvm_entry, 17 TP_PROTO(struct kvm_vcpu *vcpu), 18 TP_ARGS(vcpu), 19 20 TP_STRUCT__entry( 21 __field(unsigned long, pc) 22 ), 23 24 TP_fast_assign( 25 __entry->pc = vcpu->arch.guest_context.sepc; 26 ), 27 28 TP_printk("PC: 0x016%lx", __entry->pc) 29 ); 30 31 TRACE_EVENT(kvm_exit, 32 TP_PROTO(struct kvm_cpu_trap *trap), 33 TP_ARGS(trap), 34 35 TP_STRUCT__entry( 36 __field(unsigned long, sepc) 37 __field(unsigned long, scause) 38 __field(unsigned long, stval) 39 __field(unsigned long, htval) 40 __field(unsigned long, htinst) 41 ), 42 43 TP_fast_assign( 44 __entry->sepc = trap->sepc; 45 __entry->scause = trap->scause; 46 __entry->stval = trap->stval; 47 __entry->htval = trap->htval; 48 __entry->htinst = trap->htinst; 49 ), 50 51 TP_printk("SEPC:0x%lx, SCAUSE:0x%lx, STVAL:0x%lx, HTVAL:0x%lx, HTINST:0x%lx", 52 __entry->sepc, 53 __entry->scause, 54 __entry->stval, 55 __entry->htval, 56 __entry->htinst) 57 ); 58 59 #endif /* _TRACE_RSICV_KVM_H */ 60 61 #undef TRACE_INCLUDE_PATH 62 #define TRACE_INCLUDE_PATH . 63 #undef TRACE_INCLUDE_FILE 64 #define TRACE_INCLUDE_FILE trace 65 66 /* This part must be outside protection */ 67 #include <trace/define_trace.h> 68