+/* SPDX-License-Identifier: GPL-2.0 */
#if !defined(LTTNG_TRACE_KVM_MAIN_H) || defined(TRACE_HEADER_MULTI_READ)
#define LTTNG_TRACE_KVM_MAIN_H
-#include "../../../probes/lttng-tracepoint-event.h"
-#include <linux/version.h>
+#include <probes/lttng-tracepoint-event.h>
+#include <lttng-kernel-version.h>
#undef TRACE_SYSTEM
#define TRACE_SYSTEM kvm
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(2,6,38))
LTTNG_TRACEPOINT_EVENT(kvm_userspace_exit,
TP_PROTO(__u32 reason, int errno),
)
#endif
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
+#if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,6,0))
#if defined(__KVM_HAVE_IOAPIC)
#undef __KVM_HAVE_IRQ_LINE
#define __KVM_HAVE_IRQ_LINE
{ KVM_TRACE_MMIO_READ, "read" }, \
{ KVM_TRACE_MMIO_WRITE, "write" }
+
+#if (LTTNG_SLE_KERNEL_RANGE(4,4,121,92,92,0, 4,4,122,0,0,0) \
+ || LTTNG_SLE_KERNEL_RANGE(4,4,131,94,0,0, 4,5,0,0,0,0))
+
+LTTNG_TRACEPOINT_EVENT(kvm_mmio,
+ TP_PROTO(int type, int len, u64 gpa, u64 val),
+ TP_ARGS(type, len, gpa, val),
+
+ TP_FIELDS(
+ ctf_integer(u32, type, type)
+ ctf_integer(u32, len, len)
+ ctf_integer(u64, gpa, gpa)
+ ctf_integer(u64, val, val)
+ )
+)
+
+#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,15,0) \
+ || LTTNG_KERNEL_RANGE(4,14,14, 4,15,0) \
+ || LTTNG_DEBIAN_KERNEL_RANGE(4,14,13,0,1,0, 4,15,0,0,0,0) \
+ || LTTNG_KERNEL_RANGE(4,9,77, 4,10,0) \
+ || LTTNG_KERNEL_RANGE(4,4,112, 4,5,0) \
+ || LTTNG_KERNEL_RANGE(4,1,50, 4,2,0) \
+ || LTTNG_KERNEL_RANGE(3,16,52, 3,17,0) \
+ || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,144, 3,14,0,0) \
+ || LTTNG_KERNEL_RANGE(3,2,97, 3,3,0) \
+ || LTTNG_UBUNTU_KERNEL_RANGE(4,13,16,38, 4,14,0,0) \
+ || LTTNG_DEBIAN_KERNEL_RANGE(4,9,65,0,3,0, 4,10,0,0,0,0) \
+ || LTTNG_FEDORA_KERNEL_RANGE(4,14,13,300, 4,15,0,0))
+
+LTTNG_TRACEPOINT_EVENT(kvm_mmio,
+ TP_PROTO(int type, int len, u64 gpa, void *val),
+ TP_ARGS(type, len, gpa, val),
+
+ TP_FIELDS(
+ ctf_integer(u32, type, type)
+ ctf_integer(u32, len, len)
+ ctf_integer(u64, gpa, gpa)
+ ctf_sequence_hex(unsigned char, val, val, u32, len)
+ )
+)
+
+#else
+
LTTNG_TRACEPOINT_EVENT(kvm_mmio,
TP_PROTO(int type, int len, u64 gpa, u64 val),
TP_ARGS(type, len, gpa, val),
)
)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+#endif
+
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(2,6,34))
#define kvm_fpu_load_symbol \
{0, "unload"}, \
)
)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,18,0) \
+ || LTTNG_RHEL_KERNEL_RANGE(3,10,0,327,0,0, 3,11,0,0,0,0))
LTTNG_TRACEPOINT_EVENT(kvm_age_page,
TP_PROTO(ulong gfn, int level, struct kvm_memory_slot *slot, int ref),
TP_ARGS(gfn, level, slot, ref),
- TP_STRUCT__entry(
- __field( u64, hva )
- __field( u64, gfn )
- __field( u8, level )
- __field( u8, referenced )
- ),
-
TP_FIELDS(
ctf_integer(u64, hva,
((gfn - slot->base_gfn) << PAGE_SHIFT) + slot->userspace_addr)
#endif
#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(2,6,38))
#ifdef CONFIG_KVM_ASYNC_PF
LTTNG_TRACEPOINT_EVENT_CLASS(kvm_async_get_page_class,
TP_ARGS(token, gva)
)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,13,0) \
+ || LTTNG_RHEL_KERNEL_RANGE(3,10,0,229,0,0, 3,11,0,0,0,0))
LTTNG_TRACEPOINT_EVENT(
kvm_async_pf_completed,
)
)
-#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)) */
+#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,13,0)) */
LTTNG_TRACEPOINT_EVENT(
kvm_async_pf_completed,
)
)
-#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)) */
+#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,13,0)) */
#endif
#endif /* LTTNG_TRACE_KVM_MAIN_H */
/* This part must be outside protection */
-#include "../../../probes/define_trace.h"
+#include <probes/define_trace.h>