18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright © 2011-2016 Intel Corporation
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next
128c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
138c2ecf20Sopenharmony_ci * Software.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
168c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
178c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
188c2ecf20Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
198c2ecf20Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
208c2ecf20Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
218c2ecf20Sopenharmony_ci * IN THE SOFTWARE.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * Authors:
248c2ecf20Sopenharmony_ci *    Jike Song <jike.song@intel.com>
258c2ecf20Sopenharmony_ci *
268c2ecf20Sopenharmony_ci * Contributors:
278c2ecf20Sopenharmony_ci *    Zhi Wang <zhi.a.wang@intel.com>
288c2ecf20Sopenharmony_ci *
298c2ecf20Sopenharmony_ci */
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#if !defined(_GVT_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
328c2ecf20Sopenharmony_ci#define _GVT_TRACE_H_
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#include <linux/types.h>
358c2ecf20Sopenharmony_ci#include <linux/stringify.h>
368c2ecf20Sopenharmony_ci#include <linux/tracepoint.h>
378c2ecf20Sopenharmony_ci#include <asm/tsc.h>
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#undef TRACE_SYSTEM
408c2ecf20Sopenharmony_ci#define TRACE_SYSTEM gvt
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciTRACE_EVENT(spt_alloc,
438c2ecf20Sopenharmony_ci	TP_PROTO(int id, void *spt, int type, unsigned long mfn,
448c2ecf20Sopenharmony_ci		unsigned long gpt_gfn),
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci	TP_ARGS(id, spt, type, mfn, gpt_gfn),
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
498c2ecf20Sopenharmony_ci		__field(int, id)
508c2ecf20Sopenharmony_ci		__field(void *, spt)
518c2ecf20Sopenharmony_ci		__field(int, type)
528c2ecf20Sopenharmony_ci		__field(unsigned long, mfn)
538c2ecf20Sopenharmony_ci		__field(unsigned long, gpt_gfn)
548c2ecf20Sopenharmony_ci		),
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci	TP_fast_assign(
578c2ecf20Sopenharmony_ci		__entry->id = id;
588c2ecf20Sopenharmony_ci		__entry->spt = spt;
598c2ecf20Sopenharmony_ci		__entry->type = type;
608c2ecf20Sopenharmony_ci		__entry->mfn = mfn;
618c2ecf20Sopenharmony_ci		__entry->gpt_gfn = gpt_gfn;
628c2ecf20Sopenharmony_ci	),
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci	TP_printk("VM%d [alloc] spt %p type %d mfn 0x%lx gfn 0x%lx\n",
658c2ecf20Sopenharmony_ci		__entry->id,
668c2ecf20Sopenharmony_ci		__entry->spt,
678c2ecf20Sopenharmony_ci		__entry->type,
688c2ecf20Sopenharmony_ci		__entry->mfn,
698c2ecf20Sopenharmony_ci		__entry->gpt_gfn)
708c2ecf20Sopenharmony_ci);
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ciTRACE_EVENT(spt_free,
738c2ecf20Sopenharmony_ci	TP_PROTO(int id, void *spt, int type),
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci	TP_ARGS(id, spt, type),
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
788c2ecf20Sopenharmony_ci		__field(int, id)
798c2ecf20Sopenharmony_ci		__field(void *, spt)
808c2ecf20Sopenharmony_ci		__field(int, type)
818c2ecf20Sopenharmony_ci		),
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci	TP_fast_assign(
848c2ecf20Sopenharmony_ci		__entry->id = id;
858c2ecf20Sopenharmony_ci		__entry->spt = spt;
868c2ecf20Sopenharmony_ci		__entry->type = type;
878c2ecf20Sopenharmony_ci	),
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci	TP_printk("VM%u [free] spt %p type %d\n",
908c2ecf20Sopenharmony_ci		__entry->id,
918c2ecf20Sopenharmony_ci		__entry->spt,
928c2ecf20Sopenharmony_ci		__entry->type)
938c2ecf20Sopenharmony_ci);
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci#define MAX_BUF_LEN 256
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ciTRACE_EVENT(gma_index,
988c2ecf20Sopenharmony_ci	TP_PROTO(const char *prefix, unsigned long gma,
998c2ecf20Sopenharmony_ci		unsigned long index),
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci	TP_ARGS(prefix, gma, index),
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
1048c2ecf20Sopenharmony_ci		__array(char, buf, MAX_BUF_LEN)
1058c2ecf20Sopenharmony_ci	),
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci	TP_fast_assign(
1088c2ecf20Sopenharmony_ci		snprintf(__entry->buf, MAX_BUF_LEN,
1098c2ecf20Sopenharmony_ci			"%s gma 0x%lx index 0x%lx\n", prefix, gma, index);
1108c2ecf20Sopenharmony_ci	),
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci	TP_printk("%s", __entry->buf)
1138c2ecf20Sopenharmony_ci);
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ciTRACE_EVENT(gma_translate,
1168c2ecf20Sopenharmony_ci	TP_PROTO(int id, char *type, int ring_id, int root_entry_type,
1178c2ecf20Sopenharmony_ci		unsigned long gma, unsigned long gpa),
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci	TP_ARGS(id, type, ring_id, root_entry_type, gma, gpa),
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
1228c2ecf20Sopenharmony_ci		__array(char, buf, MAX_BUF_LEN)
1238c2ecf20Sopenharmony_ci	),
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci	TP_fast_assign(
1268c2ecf20Sopenharmony_ci		snprintf(__entry->buf, MAX_BUF_LEN,
1278c2ecf20Sopenharmony_ci			"VM%d %s ring %d root_entry_type %d gma 0x%lx -> gpa 0x%lx\n",
1288c2ecf20Sopenharmony_ci			id, type, ring_id, root_entry_type, gma, gpa);
1298c2ecf20Sopenharmony_ci	),
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci	TP_printk("%s", __entry->buf)
1328c2ecf20Sopenharmony_ci);
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ciTRACE_EVENT(spt_refcount,
1358c2ecf20Sopenharmony_ci	TP_PROTO(int id, char *action, void *spt, int before, int after),
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci	TP_ARGS(id, action, spt, before, after),
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
1408c2ecf20Sopenharmony_ci		__array(char, buf, MAX_BUF_LEN)
1418c2ecf20Sopenharmony_ci	),
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci	TP_fast_assign(
1448c2ecf20Sopenharmony_ci		snprintf(__entry->buf, MAX_BUF_LEN,
1458c2ecf20Sopenharmony_ci			"VM%d [%s] spt %p before %d -> after %d\n",
1468c2ecf20Sopenharmony_ci				id, action, spt, before, after);
1478c2ecf20Sopenharmony_ci	),
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci	TP_printk("%s", __entry->buf)
1508c2ecf20Sopenharmony_ci);
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ciTRACE_EVENT(spt_change,
1538c2ecf20Sopenharmony_ci	TP_PROTO(int id, char *action, void *spt, unsigned long gfn,
1548c2ecf20Sopenharmony_ci		int type),
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci	TP_ARGS(id, action, spt, gfn, type),
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
1598c2ecf20Sopenharmony_ci		__array(char, buf, MAX_BUF_LEN)
1608c2ecf20Sopenharmony_ci	),
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci	TP_fast_assign(
1638c2ecf20Sopenharmony_ci		snprintf(__entry->buf, MAX_BUF_LEN,
1648c2ecf20Sopenharmony_ci			"VM%d [%s] spt %p gfn 0x%lx type %d\n",
1658c2ecf20Sopenharmony_ci				id, action, spt, gfn, type);
1668c2ecf20Sopenharmony_ci	),
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci	TP_printk("%s", __entry->buf)
1698c2ecf20Sopenharmony_ci);
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ciTRACE_EVENT(spt_guest_change,
1728c2ecf20Sopenharmony_ci	TP_PROTO(int id, const char *tag, void *spt, int type, u64 v,
1738c2ecf20Sopenharmony_ci		unsigned long index),
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci	TP_ARGS(id, tag, spt, type, v, index),
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
1788c2ecf20Sopenharmony_ci		__array(char, buf, MAX_BUF_LEN)
1798c2ecf20Sopenharmony_ci	),
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci	TP_fast_assign(
1828c2ecf20Sopenharmony_ci		snprintf(__entry->buf, MAX_BUF_LEN,
1838c2ecf20Sopenharmony_ci		"VM%d [%s] spt %p type %d entry 0x%llx index 0x%lx\n",
1848c2ecf20Sopenharmony_ci			id, tag, spt, type, v, index);
1858c2ecf20Sopenharmony_ci	),
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci	TP_printk("%s", __entry->buf)
1888c2ecf20Sopenharmony_ci);
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ciTRACE_EVENT(oos_change,
1918c2ecf20Sopenharmony_ci	TP_PROTO(int id, const char *tag, int page_id, void *gpt, int type),
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci	TP_ARGS(id, tag, page_id, gpt, type),
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
1968c2ecf20Sopenharmony_ci		__array(char, buf, MAX_BUF_LEN)
1978c2ecf20Sopenharmony_ci	),
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci	TP_fast_assign(
2008c2ecf20Sopenharmony_ci		snprintf(__entry->buf, MAX_BUF_LEN,
2018c2ecf20Sopenharmony_ci		"VM%d [oos %s] page id %d gpt %p type %d\n",
2028c2ecf20Sopenharmony_ci			id, tag, page_id, gpt, type);
2038c2ecf20Sopenharmony_ci	),
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci	TP_printk("%s", __entry->buf)
2068c2ecf20Sopenharmony_ci);
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ciTRACE_EVENT(oos_sync,
2098c2ecf20Sopenharmony_ci	TP_PROTO(int id, int page_id, void *gpt, int type, u64 v,
2108c2ecf20Sopenharmony_ci		unsigned long index),
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci	TP_ARGS(id, page_id, gpt, type, v, index),
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
2158c2ecf20Sopenharmony_ci		__array(char, buf, MAX_BUF_LEN)
2168c2ecf20Sopenharmony_ci	),
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci	TP_fast_assign(
2198c2ecf20Sopenharmony_ci	snprintf(__entry->buf, MAX_BUF_LEN,
2208c2ecf20Sopenharmony_ci	"VM%d [oos sync] page id %d gpt %p type %d entry 0x%llx index 0x%lx\n",
2218c2ecf20Sopenharmony_ci				id, page_id, gpt, type, v, index);
2228c2ecf20Sopenharmony_ci	),
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci	TP_printk("%s", __entry->buf)
2258c2ecf20Sopenharmony_ci);
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci#define GVT_CMD_STR_LEN 40
2288c2ecf20Sopenharmony_ciTRACE_EVENT(gvt_command,
2298c2ecf20Sopenharmony_ci	TP_PROTO(u8 vgpu_id, u8 ring_id, u32 ip_gma, u32 *cmd_va,
2308c2ecf20Sopenharmony_ci		u32 cmd_len,  u32 buf_type, u32 buf_addr_type,
2318c2ecf20Sopenharmony_ci		void *workload, const char *cmd_name),
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci	TP_ARGS(vgpu_id, ring_id, ip_gma, cmd_va, cmd_len, buf_type,
2348c2ecf20Sopenharmony_ci		buf_addr_type, workload, cmd_name),
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
2378c2ecf20Sopenharmony_ci		__field(u8, vgpu_id)
2388c2ecf20Sopenharmony_ci		__field(u8, ring_id)
2398c2ecf20Sopenharmony_ci		__field(u32, ip_gma)
2408c2ecf20Sopenharmony_ci		__field(u32, buf_type)
2418c2ecf20Sopenharmony_ci		__field(u32, buf_addr_type)
2428c2ecf20Sopenharmony_ci		__field(u32, cmd_len)
2438c2ecf20Sopenharmony_ci		__field(void*, workload)
2448c2ecf20Sopenharmony_ci		__dynamic_array(u32, raw_cmd, cmd_len)
2458c2ecf20Sopenharmony_ci		__array(char, cmd_name, GVT_CMD_STR_LEN)
2468c2ecf20Sopenharmony_ci	),
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci	TP_fast_assign(
2498c2ecf20Sopenharmony_ci		__entry->vgpu_id = vgpu_id;
2508c2ecf20Sopenharmony_ci		__entry->ring_id = ring_id;
2518c2ecf20Sopenharmony_ci		__entry->ip_gma = ip_gma;
2528c2ecf20Sopenharmony_ci		__entry->buf_type = buf_type;
2538c2ecf20Sopenharmony_ci		__entry->buf_addr_type = buf_addr_type;
2548c2ecf20Sopenharmony_ci		__entry->cmd_len = cmd_len;
2558c2ecf20Sopenharmony_ci		__entry->workload = workload;
2568c2ecf20Sopenharmony_ci		snprintf(__entry->cmd_name, GVT_CMD_STR_LEN, "%s", cmd_name);
2578c2ecf20Sopenharmony_ci		memcpy(__get_dynamic_array(raw_cmd), cmd_va, cmd_len * sizeof(*cmd_va));
2588c2ecf20Sopenharmony_ci	),
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ci	TP_printk("vgpu%d ring %d: address_type %u, buf_type %u, ip_gma %08x,cmd (name=%s,len=%u,raw cmd=%s), workload=%p\n",
2628c2ecf20Sopenharmony_ci		__entry->vgpu_id,
2638c2ecf20Sopenharmony_ci		__entry->ring_id,
2648c2ecf20Sopenharmony_ci		__entry->buf_addr_type,
2658c2ecf20Sopenharmony_ci		__entry->buf_type,
2668c2ecf20Sopenharmony_ci		__entry->ip_gma,
2678c2ecf20Sopenharmony_ci		__entry->cmd_name,
2688c2ecf20Sopenharmony_ci		__entry->cmd_len,
2698c2ecf20Sopenharmony_ci		__print_array(__get_dynamic_array(raw_cmd),
2708c2ecf20Sopenharmony_ci			__entry->cmd_len, 4),
2718c2ecf20Sopenharmony_ci		__entry->workload)
2728c2ecf20Sopenharmony_ci);
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci#define GVT_TEMP_STR_LEN 10
2758c2ecf20Sopenharmony_ciTRACE_EVENT(write_ir,
2768c2ecf20Sopenharmony_ci	TP_PROTO(int id, char *reg_name, unsigned int reg, unsigned int new_val,
2778c2ecf20Sopenharmony_ci		 unsigned int old_val, bool changed),
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci	TP_ARGS(id, reg_name, reg, new_val, old_val, changed),
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
2828c2ecf20Sopenharmony_ci		__field(int, id)
2838c2ecf20Sopenharmony_ci		__array(char, buf, GVT_TEMP_STR_LEN)
2848c2ecf20Sopenharmony_ci		__field(unsigned int, reg)
2858c2ecf20Sopenharmony_ci		__field(unsigned int, new_val)
2868c2ecf20Sopenharmony_ci		__field(unsigned int, old_val)
2878c2ecf20Sopenharmony_ci		__field(bool, changed)
2888c2ecf20Sopenharmony_ci	),
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci	TP_fast_assign(
2918c2ecf20Sopenharmony_ci		__entry->id = id;
2928c2ecf20Sopenharmony_ci		snprintf(__entry->buf, GVT_TEMP_STR_LEN, "%s", reg_name);
2938c2ecf20Sopenharmony_ci		__entry->reg = reg;
2948c2ecf20Sopenharmony_ci		__entry->new_val = new_val;
2958c2ecf20Sopenharmony_ci		__entry->old_val = old_val;
2968c2ecf20Sopenharmony_ci		__entry->changed = changed;
2978c2ecf20Sopenharmony_ci	),
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci	TP_printk("VM%u write [%s] %x, new %08x, old %08x, changed %08x\n",
3008c2ecf20Sopenharmony_ci		  __entry->id, __entry->buf, __entry->reg, __entry->new_val,
3018c2ecf20Sopenharmony_ci		  __entry->old_val, __entry->changed)
3028c2ecf20Sopenharmony_ci);
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ciTRACE_EVENT(propagate_event,
3058c2ecf20Sopenharmony_ci	TP_PROTO(int id, const char *irq_name, int bit),
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci	TP_ARGS(id, irq_name, bit),
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
3108c2ecf20Sopenharmony_ci		__field(int, id)
3118c2ecf20Sopenharmony_ci		__array(char, buf, GVT_TEMP_STR_LEN)
3128c2ecf20Sopenharmony_ci		__field(int, bit)
3138c2ecf20Sopenharmony_ci	),
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci	TP_fast_assign(
3168c2ecf20Sopenharmony_ci		__entry->id = id;
3178c2ecf20Sopenharmony_ci		snprintf(__entry->buf, GVT_TEMP_STR_LEN, "%s", irq_name);
3188c2ecf20Sopenharmony_ci		__entry->bit = bit;
3198c2ecf20Sopenharmony_ci	),
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci	TP_printk("Set bit (%d) for (%s) for vgpu (%d)\n",
3228c2ecf20Sopenharmony_ci		  __entry->bit, __entry->buf, __entry->id)
3238c2ecf20Sopenharmony_ci);
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ciTRACE_EVENT(inject_msi,
3268c2ecf20Sopenharmony_ci	TP_PROTO(int id, unsigned int address, unsigned int data),
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci	TP_ARGS(id, address, data),
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
3318c2ecf20Sopenharmony_ci		__field(int, id)
3328c2ecf20Sopenharmony_ci		__field(unsigned int, address)
3338c2ecf20Sopenharmony_ci		__field(unsigned int, data)
3348c2ecf20Sopenharmony_ci	),
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci	TP_fast_assign(
3378c2ecf20Sopenharmony_ci		__entry->id = id;
3388c2ecf20Sopenharmony_ci		__entry->address = address;
3398c2ecf20Sopenharmony_ci		__entry->data = data;
3408c2ecf20Sopenharmony_ci	),
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci	TP_printk("vgpu%d:inject msi address %x data %x\n",
3438c2ecf20Sopenharmony_ci		  __entry->id, __entry->address, __entry->data)
3448c2ecf20Sopenharmony_ci);
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ciTRACE_EVENT(render_mmio,
3478c2ecf20Sopenharmony_ci	TP_PROTO(int old_id, int new_id, char *action, unsigned int reg,
3488c2ecf20Sopenharmony_ci		 unsigned int old_val, unsigned int new_val),
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci	TP_ARGS(old_id, new_id, action, reg, old_val, new_val),
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
3538c2ecf20Sopenharmony_ci		__field(int, old_id)
3548c2ecf20Sopenharmony_ci		__field(int, new_id)
3558c2ecf20Sopenharmony_ci		__array(char, buf, GVT_TEMP_STR_LEN)
3568c2ecf20Sopenharmony_ci		__field(unsigned int, reg)
3578c2ecf20Sopenharmony_ci		__field(unsigned int, old_val)
3588c2ecf20Sopenharmony_ci		__field(unsigned int, new_val)
3598c2ecf20Sopenharmony_ci	),
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ci	TP_fast_assign(
3628c2ecf20Sopenharmony_ci		__entry->old_id = old_id;
3638c2ecf20Sopenharmony_ci		__entry->new_id = new_id;
3648c2ecf20Sopenharmony_ci		snprintf(__entry->buf, GVT_TEMP_STR_LEN, "%s", action);
3658c2ecf20Sopenharmony_ci		__entry->reg = reg;
3668c2ecf20Sopenharmony_ci		__entry->old_val = old_val;
3678c2ecf20Sopenharmony_ci		__entry->new_val = new_val;
3688c2ecf20Sopenharmony_ci	),
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci	TP_printk("VM%u -> VM%u %s reg %x, old %08x new %08x\n",
3718c2ecf20Sopenharmony_ci		  __entry->old_id, __entry->new_id,
3728c2ecf20Sopenharmony_ci		  __entry->buf, __entry->reg,
3738c2ecf20Sopenharmony_ci		  __entry->old_val, __entry->new_val)
3748c2ecf20Sopenharmony_ci);
3758c2ecf20Sopenharmony_ci
3768c2ecf20Sopenharmony_ci#endif /* _GVT_TRACE_H_ */
3778c2ecf20Sopenharmony_ci
3788c2ecf20Sopenharmony_ci/* This part must be out of protection */
3798c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_PATH
3808c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_PATH .
3818c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_FILE
3828c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_FILE trace
3838c2ecf20Sopenharmony_ci#include <trace/define_trace.h>
384