xref: /openbmc/linux/drivers/misc/ocxl/trace.h (revision cdd38c5f1ce4398ec58fec95904b75824daab7b5)
17ed42113SNishad Kamdar /* SPDX-License-Identifier: GPL-2.0+ */
292add22eSFrederic Barrat // Copyright 2017 IBM Corp.
392add22eSFrederic Barrat #undef TRACE_SYSTEM
492add22eSFrederic Barrat #define TRACE_SYSTEM ocxl
592add22eSFrederic Barrat 
692add22eSFrederic Barrat #if !defined(_TRACE_OCXL_H) || defined(TRACE_HEADER_MULTI_READ)
792add22eSFrederic Barrat #define _TRACE_OCXL_H
892add22eSFrederic Barrat 
992add22eSFrederic Barrat #include <linux/tracepoint.h>
1092add22eSFrederic Barrat 
11*98f5559aSChristophe Lombard 
12*98f5559aSChristophe Lombard TRACE_EVENT(ocxl_mmu_notifier_range,
13*98f5559aSChristophe Lombard 	TP_PROTO(unsigned long start, unsigned long end, unsigned long pidr),
14*98f5559aSChristophe Lombard 	TP_ARGS(start, end, pidr),
15*98f5559aSChristophe Lombard 
16*98f5559aSChristophe Lombard 	TP_STRUCT__entry(
17*98f5559aSChristophe Lombard 		__field(unsigned long, start)
18*98f5559aSChristophe Lombard 		__field(unsigned long, end)
19*98f5559aSChristophe Lombard 		__field(unsigned long, pidr)
20*98f5559aSChristophe Lombard 	),
21*98f5559aSChristophe Lombard 
22*98f5559aSChristophe Lombard 	TP_fast_assign(
23*98f5559aSChristophe Lombard 		__entry->start = start;
24*98f5559aSChristophe Lombard 		__entry->end = end;
25*98f5559aSChristophe Lombard 		__entry->pidr = pidr;
26*98f5559aSChristophe Lombard 	),
27*98f5559aSChristophe Lombard 
28*98f5559aSChristophe Lombard 	TP_printk("start=0x%lx end=0x%lx pidr=0x%lx",
29*98f5559aSChristophe Lombard 		__entry->start,
30*98f5559aSChristophe Lombard 		__entry->end,
31*98f5559aSChristophe Lombard 		__entry->pidr
32*98f5559aSChristophe Lombard 	)
33*98f5559aSChristophe Lombard );
34*98f5559aSChristophe Lombard 
35*98f5559aSChristophe Lombard TRACE_EVENT(ocxl_init_mmu_notifier,
36*98f5559aSChristophe Lombard 	TP_PROTO(int pasid, unsigned long pidr),
37*98f5559aSChristophe Lombard 	TP_ARGS(pasid, pidr),
38*98f5559aSChristophe Lombard 
39*98f5559aSChristophe Lombard 	TP_STRUCT__entry(
40*98f5559aSChristophe Lombard 		__field(int, pasid)
41*98f5559aSChristophe Lombard 		__field(unsigned long, pidr)
42*98f5559aSChristophe Lombard 	),
43*98f5559aSChristophe Lombard 
44*98f5559aSChristophe Lombard 	TP_fast_assign(
45*98f5559aSChristophe Lombard 		__entry->pasid = pasid;
46*98f5559aSChristophe Lombard 		__entry->pidr = pidr;
47*98f5559aSChristophe Lombard 	),
48*98f5559aSChristophe Lombard 
49*98f5559aSChristophe Lombard 	TP_printk("pasid=%d, pidr=0x%lx",
50*98f5559aSChristophe Lombard 		__entry->pasid,
51*98f5559aSChristophe Lombard 		__entry->pidr
52*98f5559aSChristophe Lombard 	)
53*98f5559aSChristophe Lombard );
54*98f5559aSChristophe Lombard 
55*98f5559aSChristophe Lombard TRACE_EVENT(ocxl_release_mmu_notifier,
56*98f5559aSChristophe Lombard 	TP_PROTO(int pasid, unsigned long pidr),
57*98f5559aSChristophe Lombard 	TP_ARGS(pasid, pidr),
58*98f5559aSChristophe Lombard 
59*98f5559aSChristophe Lombard 	TP_STRUCT__entry(
60*98f5559aSChristophe Lombard 		__field(int, pasid)
61*98f5559aSChristophe Lombard 		__field(unsigned long, pidr)
62*98f5559aSChristophe Lombard 	),
63*98f5559aSChristophe Lombard 
64*98f5559aSChristophe Lombard 	TP_fast_assign(
65*98f5559aSChristophe Lombard 		__entry->pasid = pasid;
66*98f5559aSChristophe Lombard 		__entry->pidr = pidr;
67*98f5559aSChristophe Lombard 	),
68*98f5559aSChristophe Lombard 
69*98f5559aSChristophe Lombard 	TP_printk("pasid=%d, pidr=0x%lx",
70*98f5559aSChristophe Lombard 		__entry->pasid,
71*98f5559aSChristophe Lombard 		__entry->pidr
72*98f5559aSChristophe Lombard 	)
73*98f5559aSChristophe Lombard );
74*98f5559aSChristophe Lombard 
7592add22eSFrederic Barrat DECLARE_EVENT_CLASS(ocxl_context,
7692add22eSFrederic Barrat 	TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr),
7792add22eSFrederic Barrat 	TP_ARGS(pid, spa, pasid, pidr, tidr),
7892add22eSFrederic Barrat 
7992add22eSFrederic Barrat 	TP_STRUCT__entry(
8092add22eSFrederic Barrat 		__field(pid_t, pid)
8192add22eSFrederic Barrat 		__field(void*, spa)
8292add22eSFrederic Barrat 		__field(int, pasid)
8392add22eSFrederic Barrat 		__field(u32, pidr)
8492add22eSFrederic Barrat 		__field(u32, tidr)
8592add22eSFrederic Barrat 	),
8692add22eSFrederic Barrat 
8792add22eSFrederic Barrat 	TP_fast_assign(
8892add22eSFrederic Barrat 		__entry->pid = pid;
8992add22eSFrederic Barrat 		__entry->spa = spa;
9092add22eSFrederic Barrat 		__entry->pasid = pasid;
9192add22eSFrederic Barrat 		__entry->pidr = pidr;
9292add22eSFrederic Barrat 		__entry->tidr = tidr;
9392add22eSFrederic Barrat 	),
9492add22eSFrederic Barrat 
9592add22eSFrederic Barrat 	TP_printk("linux pid=%d spa=0x%p pasid=0x%x pidr=0x%x tidr=0x%x",
9692add22eSFrederic Barrat 		__entry->pid,
9792add22eSFrederic Barrat 		__entry->spa,
9892add22eSFrederic Barrat 		__entry->pasid,
9992add22eSFrederic Barrat 		__entry->pidr,
10092add22eSFrederic Barrat 		__entry->tidr
10192add22eSFrederic Barrat 	)
10292add22eSFrederic Barrat );
10392add22eSFrederic Barrat 
10492add22eSFrederic Barrat DEFINE_EVENT(ocxl_context, ocxl_context_add,
10592add22eSFrederic Barrat 	TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr),
10692add22eSFrederic Barrat 	TP_ARGS(pid, spa, pasid, pidr, tidr)
10792add22eSFrederic Barrat );
10892add22eSFrederic Barrat 
10992add22eSFrederic Barrat DEFINE_EVENT(ocxl_context, ocxl_context_remove,
11092add22eSFrederic Barrat 	TP_PROTO(pid_t pid, void *spa, int pasid, u32 pidr, u32 tidr),
11192add22eSFrederic Barrat 	TP_ARGS(pid, spa, pasid, pidr, tidr)
11292add22eSFrederic Barrat );
11392add22eSFrederic Barrat 
11492add22eSFrederic Barrat TRACE_EVENT(ocxl_terminate_pasid,
11592add22eSFrederic Barrat 	TP_PROTO(int pasid, int rc),
11692add22eSFrederic Barrat 	TP_ARGS(pasid, rc),
11792add22eSFrederic Barrat 
11892add22eSFrederic Barrat 	TP_STRUCT__entry(
11992add22eSFrederic Barrat 		__field(int, pasid)
12092add22eSFrederic Barrat 		__field(int, rc)
12192add22eSFrederic Barrat 	),
12292add22eSFrederic Barrat 
12392add22eSFrederic Barrat 	TP_fast_assign(
12492add22eSFrederic Barrat 		__entry->pasid = pasid;
12592add22eSFrederic Barrat 		__entry->rc = rc;
12692add22eSFrederic Barrat 	),
12792add22eSFrederic Barrat 
12892add22eSFrederic Barrat 	TP_printk("pasid=0x%x rc=%d",
12992add22eSFrederic Barrat 		__entry->pasid,
13092add22eSFrederic Barrat 		__entry->rc
13192add22eSFrederic Barrat 	)
13292add22eSFrederic Barrat );
13392add22eSFrederic Barrat 
13492add22eSFrederic Barrat DECLARE_EVENT_CLASS(ocxl_fault_handler,
13592add22eSFrederic Barrat 	TP_PROTO(void *spa, u64 pe, u64 dsisr, u64 dar, u64 tfc),
13692add22eSFrederic Barrat 	TP_ARGS(spa, pe, dsisr, dar, tfc),
13792add22eSFrederic Barrat 
13892add22eSFrederic Barrat 	TP_STRUCT__entry(
13992add22eSFrederic Barrat 		__field(void *, spa)
14092add22eSFrederic Barrat 		__field(u64, pe)
14192add22eSFrederic Barrat 		__field(u64, dsisr)
14292add22eSFrederic Barrat 		__field(u64, dar)
14392add22eSFrederic Barrat 		__field(u64, tfc)
14492add22eSFrederic Barrat 	),
14592add22eSFrederic Barrat 
14692add22eSFrederic Barrat 	TP_fast_assign(
14792add22eSFrederic Barrat 		__entry->spa = spa;
14892add22eSFrederic Barrat 		__entry->pe = pe;
14992add22eSFrederic Barrat 		__entry->dsisr = dsisr;
15092add22eSFrederic Barrat 		__entry->dar = dar;
15192add22eSFrederic Barrat 		__entry->tfc = tfc;
15292add22eSFrederic Barrat 	),
15392add22eSFrederic Barrat 
15492add22eSFrederic Barrat 	TP_printk("spa=%p pe=0x%llx dsisr=0x%llx dar=0x%llx tfc=0x%llx",
15592add22eSFrederic Barrat 		__entry->spa,
15692add22eSFrederic Barrat 		__entry->pe,
15792add22eSFrederic Barrat 		__entry->dsisr,
15892add22eSFrederic Barrat 		__entry->dar,
15992add22eSFrederic Barrat 		__entry->tfc
16092add22eSFrederic Barrat 	)
16192add22eSFrederic Barrat );
16292add22eSFrederic Barrat 
16392add22eSFrederic Barrat DEFINE_EVENT(ocxl_fault_handler, ocxl_fault,
16492add22eSFrederic Barrat 	TP_PROTO(void *spa, u64 pe, u64 dsisr, u64 dar, u64 tfc),
16592add22eSFrederic Barrat 	TP_ARGS(spa, pe, dsisr, dar, tfc)
16692add22eSFrederic Barrat );
16792add22eSFrederic Barrat 
16892add22eSFrederic Barrat DEFINE_EVENT(ocxl_fault_handler, ocxl_fault_ack,
16992add22eSFrederic Barrat 	TP_PROTO(void *spa, u64 pe, u64 dsisr, u64 dar, u64 tfc),
17092add22eSFrederic Barrat 	TP_ARGS(spa, pe, dsisr, dar, tfc)
17192add22eSFrederic Barrat );
17292add22eSFrederic Barrat 
17392add22eSFrederic Barrat TRACE_EVENT(ocxl_afu_irq_alloc,
1742ec3b7edSAlastair D'Silva 	TP_PROTO(int pasid, int irq_id, unsigned int virq, int hw_irq),
1752ec3b7edSAlastair D'Silva 	TP_ARGS(pasid, irq_id, virq, hw_irq),
17692add22eSFrederic Barrat 
17792add22eSFrederic Barrat 	TP_STRUCT__entry(
17892add22eSFrederic Barrat 		__field(int, pasid)
17992add22eSFrederic Barrat 		__field(int, irq_id)
18092add22eSFrederic Barrat 		__field(unsigned int, virq)
18192add22eSFrederic Barrat 		__field(int, hw_irq)
18292add22eSFrederic Barrat 	),
18392add22eSFrederic Barrat 
18492add22eSFrederic Barrat 	TP_fast_assign(
18592add22eSFrederic Barrat 		__entry->pasid = pasid;
18692add22eSFrederic Barrat 		__entry->irq_id = irq_id;
18792add22eSFrederic Barrat 		__entry->virq = virq;
18892add22eSFrederic Barrat 		__entry->hw_irq = hw_irq;
18992add22eSFrederic Barrat 	),
19092add22eSFrederic Barrat 
1912ec3b7edSAlastair D'Silva 	TP_printk("pasid=0x%x irq_id=%d virq=%u hw_irq=%d",
19292add22eSFrederic Barrat 		__entry->pasid,
19392add22eSFrederic Barrat 		__entry->irq_id,
19492add22eSFrederic Barrat 		__entry->virq,
1952ec3b7edSAlastair D'Silva 		__entry->hw_irq
19692add22eSFrederic Barrat 	)
19792add22eSFrederic Barrat );
19892add22eSFrederic Barrat 
19992add22eSFrederic Barrat TRACE_EVENT(ocxl_afu_irq_free,
20092add22eSFrederic Barrat 	TP_PROTO(int pasid, int irq_id),
20192add22eSFrederic Barrat 	TP_ARGS(pasid, irq_id),
20292add22eSFrederic Barrat 
20392add22eSFrederic Barrat 	TP_STRUCT__entry(
20492add22eSFrederic Barrat 		__field(int, pasid)
20592add22eSFrederic Barrat 		__field(int, irq_id)
20692add22eSFrederic Barrat 	),
20792add22eSFrederic Barrat 
20892add22eSFrederic Barrat 	TP_fast_assign(
20992add22eSFrederic Barrat 		__entry->pasid = pasid;
21092add22eSFrederic Barrat 		__entry->irq_id = irq_id;
21192add22eSFrederic Barrat 	),
21292add22eSFrederic Barrat 
21392add22eSFrederic Barrat 	TP_printk("pasid=0x%x irq_id=%d",
21492add22eSFrederic Barrat 		__entry->pasid,
21592add22eSFrederic Barrat 		__entry->irq_id
21692add22eSFrederic Barrat 	)
21792add22eSFrederic Barrat );
21892add22eSFrederic Barrat 
21992add22eSFrederic Barrat TRACE_EVENT(ocxl_afu_irq_receive,
22092add22eSFrederic Barrat 	TP_PROTO(int virq),
22192add22eSFrederic Barrat 	TP_ARGS(virq),
22292add22eSFrederic Barrat 
22392add22eSFrederic Barrat 	TP_STRUCT__entry(
22492add22eSFrederic Barrat 		__field(int, virq)
22592add22eSFrederic Barrat 	),
22692add22eSFrederic Barrat 
22792add22eSFrederic Barrat 	TP_fast_assign(
22892add22eSFrederic Barrat 		__entry->virq = virq;
22992add22eSFrederic Barrat 	),
23092add22eSFrederic Barrat 
23192add22eSFrederic Barrat 	TP_printk("virq=%d",
23292add22eSFrederic Barrat 		__entry->virq
23392add22eSFrederic Barrat 	)
23492add22eSFrederic Barrat );
23592add22eSFrederic Barrat 
23692add22eSFrederic Barrat #endif /* _TRACE_OCXL_H */
23792add22eSFrederic Barrat 
23892add22eSFrederic Barrat /* This part must be outside protection */
23992add22eSFrederic Barrat #undef TRACE_INCLUDE_PATH
24092add22eSFrederic Barrat #define TRACE_INCLUDE_PATH .
24192add22eSFrederic Barrat #define TRACE_INCLUDE_FILE trace
24292add22eSFrederic Barrat #include <trace/define_trace.h>
243