1 /* SPDX-License-Identifier: GPL-2.0 */ 2 3 #include <linux/trace_events.h> 4 5 #include <asm/kvm_hyptrace.h> 6 #include <asm/kvm_hypevents_defs.h> 7 8 #ifndef HYP_EVENT_FILE 9 # undef __ARM64_KVM_HYPEVENTS_H_ 10 # define __HYP_EVENT_FILE <asm/kvm_hypevents.h> 11 #else 12 # define __HYP_EVENT_FILE __stringify(HYP_EVENT_FILE) 13 #endif 14 15 #define HYP_EVENT(__name, __proto, __struct, __assign, __printk) \ 16 HYP_EVENT_FORMAT(__name, __struct); \ 17 void hyp_event_trace_##__name(struct ht_iterator *iter) \ 18 { \ 19 struct trace_hyp_format_##__name __maybe_unused *__entry = \ 20 (struct trace_hyp_format_##__name *)iter->ent; \ 21 trace_seq_puts(&iter->seq, #__name); \ 22 trace_seq_putc(&iter->seq, ' '); \ 23 trace_seq_printf(&iter->seq, __printk); \ 24 trace_seq_putc(&iter->seq, '\n'); \ 25 } 26 #define HYP_EVENT_MULTI_READ 27 #include __HYP_EVENT_FILE 28 29 #undef he_field 30 #define he_field(_type, _item) \ 31 { \ 32 .type = #_type, .name = #_item, \ 33 .size = sizeof(_type), .align = __alignof__(_type), \ 34 .is_signed = is_signed_type(_type), \ 35 }, 36 #undef HYP_EVENT 37 #define HYP_EVENT(__name, __proto, __struct, __assign, __printk) \ 38 static struct trace_event_fields hyp_event_fields_##__name[] = { \ 39 __struct \ 40 {} \ 41 }; 42 #include __HYP_EVENT_FILE 43 44 #undef HYP_EVENT 45 #undef HE_PRINTK 46 #undef HE_PRINTK_UNKNOWN_FMT 47 #define __entry REC 48 #define HE_PRINTK(fmt, args...) "\"" fmt "\", " __stringify(args) 49 #define HE_PRINTK_UNKNOWN_FMT(fmt, args...) "Unknown" 50 #define HYP_EVENT(__name, __proto, __struct, __assign, __printk) \ 51 static char hyp_event_print_fmt_##__name[] = __printk; \ 52 static bool hyp_event_enabled_##__name; \ 53 struct hyp_event __section("_hyp_events") hyp_event_##__name = {\ 54 .name = #__name, \ 55 .enabled = &hyp_event_enabled_##__name, \ 56 .fields = hyp_event_fields_##__name, \ 57 .print_fmt = hyp_event_print_fmt_##__name, \ 58 .trace_func = hyp_event_trace_##__name, \ 59 } 60 #include __HYP_EVENT_FILE 61 62 #undef HYP_EVENT_MULTI_READ 63