13d0407baSopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
23d0407baSopenharmony_ci#undef TRACE_SYSTEM
33d0407baSopenharmony_ci#define TRACE_SYSTEM binder
43d0407baSopenharmony_ci#undef TRACE_INCLUDE_PATH
53d0407baSopenharmony_ci#define TRACE_INCLUDE_PATH trace/hooks
63d0407baSopenharmony_ci#if !defined(_TRACE_HOOK_BINDER_H) || defined(TRACE_HEADER_MULTI_READ)
73d0407baSopenharmony_ci#define _TRACE_HOOK_BINDER_H
83d0407baSopenharmony_ci#include <linux/tracepoint.h>
93d0407baSopenharmony_ci#include <trace/hooks/vendor_hooks.h>
103d0407baSopenharmony_ci/*
113d0407baSopenharmony_ci * Following tracepoints are not exported in tracefs and provide a
123d0407baSopenharmony_ci * mechanism for vendor modules to hook and extend functionality
133d0407baSopenharmony_ci */
143d0407baSopenharmony_cistruct binder_transaction;
153d0407baSopenharmony_cistruct task_struct;
163d0407baSopenharmony_cistruct binder_alloc;
173d0407baSopenharmony_cistruct binder_proc;
183d0407baSopenharmony_cistruct binder_thread;
193d0407baSopenharmony_cistruct binder_transaction_data;
203d0407baSopenharmony_cistruct seq_file;
213d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_transaction_init,
223d0407baSopenharmony_ci	TP_PROTO(struct binder_transaction *t),
233d0407baSopenharmony_ci	TP_ARGS(t));
243d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_priority_skip,
253d0407baSopenharmony_ci	TP_PROTO(struct task_struct *task, bool *skip),
263d0407baSopenharmony_ci	TP_ARGS(task, skip));
273d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_set_priority,
283d0407baSopenharmony_ci	TP_PROTO(struct binder_transaction *t, struct task_struct *task),
293d0407baSopenharmony_ci	TP_ARGS(t, task));
303d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_restore_priority,
313d0407baSopenharmony_ci	TP_PROTO(struct binder_transaction *t, struct task_struct *task),
323d0407baSopenharmony_ci	TP_ARGS(t, task));
333d0407baSopenharmony_cistruct binder_proc;
343d0407baSopenharmony_cistruct binder_thread;
353d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_wakeup_ilocked,
363d0407baSopenharmony_ci	TP_PROTO(struct task_struct *task, bool sync, struct binder_proc *proc),
373d0407baSopenharmony_ci	TP_ARGS(task, sync, proc));
383d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_wait_for_work,
393d0407baSopenharmony_ci	TP_PROTO(bool do_proc_work, struct binder_thread *tsk, struct binder_proc *proc),
403d0407baSopenharmony_ci	TP_ARGS(do_proc_work, tsk, proc));
413d0407baSopenharmony_ciDECLARE_HOOK(android_vh_sync_txn_recvd,
423d0407baSopenharmony_ci	TP_PROTO(struct task_struct *tsk, struct task_struct *from),
433d0407baSopenharmony_ci	TP_ARGS(tsk, from));
443d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_alloc_new_buf_locked,
453d0407baSopenharmony_ci	TP_PROTO(size_t size, struct binder_alloc *alloc, int is_async),
463d0407baSopenharmony_ci	TP_ARGS(size, alloc, is_async));
473d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_reply,
483d0407baSopenharmony_ci	TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc,
493d0407baSopenharmony_ci		struct binder_thread *thread, struct binder_transaction_data *tr),
503d0407baSopenharmony_ci	TP_ARGS(target_proc, proc, thread, tr));
513d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_trans,
523d0407baSopenharmony_ci	TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc,
533d0407baSopenharmony_ci		struct binder_thread *thread, struct binder_transaction_data *tr),
543d0407baSopenharmony_ci	TP_ARGS(target_proc, proc, thread, tr));
553d0407baSopenharmony_ciDECLARE_RESTRICTED_HOOK(android_rvh_binder_transaction,
563d0407baSopenharmony_ci	TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc,
573d0407baSopenharmony_ci		struct binder_thread *thread, struct binder_transaction_data *tr),
583d0407baSopenharmony_ci	TP_ARGS(target_proc, proc, thread, tr), 1);
593d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_preset,
603d0407baSopenharmony_ci	TP_PROTO(struct hlist_head *hhead, struct mutex *lock),
613d0407baSopenharmony_ci	TP_ARGS(hhead, lock));
623d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_proc_transaction,
633d0407baSopenharmony_ci	TP_PROTO(struct task_struct *caller_task, struct task_struct *binder_proc_task,
643d0407baSopenharmony_ci		struct task_struct *binder_th_task, int node_debug_id,
653d0407baSopenharmony_ci		unsigned int code, bool pending_async),
663d0407baSopenharmony_ci	TP_ARGS(caller_task, binder_proc_task, binder_th_task, node_debug_id, code, pending_async));
673d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_proc_transaction_end,
683d0407baSopenharmony_ci	TP_PROTO(struct task_struct *caller_task, struct task_struct *binder_proc_task,
693d0407baSopenharmony_ci		struct task_struct *binder_th_task, unsigned int code,
703d0407baSopenharmony_ci		bool pending_async, bool sync),
713d0407baSopenharmony_ci	TP_ARGS(caller_task, binder_proc_task, binder_th_task, code, pending_async, sync));
723d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_new_ref,
733d0407baSopenharmony_ci	TP_PROTO(struct task_struct *proc, uint32_t ref_desc, int node_debug_id),
743d0407baSopenharmony_ci	TP_ARGS(proc, ref_desc, node_debug_id));
753d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_del_ref,
763d0407baSopenharmony_ci	TP_PROTO(struct task_struct *proc, uint32_t ref_desc),
773d0407baSopenharmony_ci	TP_ARGS(proc, ref_desc));
783d0407baSopenharmony_ciDECLARE_HOOK(android_vh_binder_print_transaction_info,
793d0407baSopenharmony_ci	TP_PROTO(struct seq_file *m, struct binder_proc *proc,
803d0407baSopenharmony_ci		 const char *prefix, struct binder_transaction *t),
813d0407baSopenharmony_ci	TP_ARGS(m, proc, prefix, t));
823d0407baSopenharmony_ci
833d0407baSopenharmony_ci/* macro versions of hooks are no longer required */
843d0407baSopenharmony_ci
853d0407baSopenharmony_ci#endif /* _TRACE_HOOK_BINDER_H */
863d0407baSopenharmony_ci/* This part must be outside protection */
873d0407baSopenharmony_ci#include <trace/define_trace.h>
88