123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433 |
- /* SPDX-License-Identifier: GPL-2.0-only */
- /*
- * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
- */
- #if !defined(TRACE_FASTRPC_H) || defined(TRACE_HEADER_MULTI_READ)
- #define TRACE_FASTRPC_H
- #undef TRACE_SYSTEM
- #define TRACE_SYSTEM fastrpc
- /*
- * Path must be relative to location of 'define_trace.h' header in kernel
- * Define path if not defined in bazel file
- */
- #ifndef DSP_TRACE_INCLUDE_PATH
- #define DSP_TRACE_INCLUDE_PATH ../../../../sm8650-modules/qcom/opensource/dsp-kernel/dsp
- #endif
- #undef TRACE_INCLUDE_PATH
- #define TRACE_INCLUDE_PATH DSP_TRACE_INCLUDE_PATH
- /* Name of trace header file */
- #undef TRACE_INCLUDE_FILE
- #define TRACE_INCLUDE_FILE fastrpc_trace
- #include <linux/tracepoint.h>
- TRACE_EVENT(fastrpc_transport_send,
- TP_PROTO(int cid, uint64_t smq_ctx,
- uint64_t ctx, uint32_t handle,
- uint32_t sc, uint64_t addr, uint64_t size),
- TP_ARGS(cid, smq_ctx, ctx, handle, sc, addr, size),
- TP_STRUCT__entry(
- __field(int, cid)
- __field(u64, smq_ctx)
- __field(u64, ctx)
- __field(u32, handle)
- __field(u32, sc)
- __field(u64, addr)
- __field(u64, size)
- ),
- TP_fast_assign(
- __entry->cid = cid;
- __entry->smq_ctx = smq_ctx;
- __entry->ctx = ctx;
- __entry->handle = handle;
- __entry->sc = sc;
- __entry->addr = addr;
- __entry->size = size;
- ),
- TP_printk("to cid %d: smq_ctx 0x%llx, ctx 0x%llx, handle 0x%x, sc 0x%x, addr 0x%llx, size %llu",
- __entry->cid, __entry->smq_ctx, __entry->ctx, __entry->handle,
- __entry->sc, __entry->addr, __entry->size)
- );
- TRACE_EVENT(fastrpc_transport_response,
- TP_PROTO(int cid, uint64_t ctx, int retval,
- uint32_t rsp_flags, uint32_t early_wake_time),
- TP_ARGS(cid, ctx, retval, rsp_flags, early_wake_time),
- TP_STRUCT__entry(
- __field(int, cid)
- __field(u64, ctx)
- __field(int, retval)
- __field(u32, rsp_flags)
- __field(u32, early_wake_time)
- ),
- TP_fast_assign(
- __entry->cid = cid;
- __entry->ctx = ctx;
- __entry->retval = retval;
- __entry->rsp_flags = rsp_flags;
- __entry->early_wake_time = early_wake_time;
- ),
- TP_printk("from cid %d: ctx 0x%llx, retval 0x%x, rsp_flags %u, early_wake_time %u",
- __entry->cid, __entry->ctx, __entry->retval,
- __entry->rsp_flags, __entry->early_wake_time)
- );
- TRACE_EVENT(fastrpc_context_interrupt,
- TP_PROTO(int cid, uint64_t smq_ctx, uint64_t ctx,
- uint32_t handle, uint32_t sc),
- TP_ARGS(cid, smq_ctx, ctx, handle, sc),
- TP_STRUCT__entry(
- __field(int, cid)
- __field(u64, smq_ctx)
- __field(u64, ctx)
- __field(u32, handle)
- __field(u32, sc)
- ),
- TP_fast_assign(
- __entry->cid = cid;
- __entry->smq_ctx = smq_ctx;
- __entry->ctx = ctx;
- __entry->handle = handle;
- __entry->sc = sc;
- ),
- TP_printk("to cid %d: smq_ctx 0x%llx, ctx 0x%llx, handle 0x%x, sc 0x%x",
- __entry->cid, __entry->smq_ctx,
- __entry->ctx, __entry->handle, __entry->sc)
- );
- TRACE_EVENT(fastrpc_context_restore,
- TP_PROTO(int cid, uint64_t smq_ctx, uint64_t ctx,
- uint32_t handle, uint32_t sc),
- TP_ARGS(cid, smq_ctx, ctx, handle, sc),
- TP_STRUCT__entry(
- __field(int, cid)
- __field(u64, smq_ctx)
- __field(u64, ctx)
- __field(u32, handle)
- __field(u32, sc)
- ),
- TP_fast_assign(
- __entry->cid = cid;
- __entry->smq_ctx = smq_ctx;
- __entry->ctx = ctx;
- __entry->handle = handle;
- __entry->sc = sc;
- ),
- TP_printk("for cid %d: smq_ctx 0x%llx, ctx 0x%llx, handle 0x%x, sc 0x%x",
- __entry->cid, __entry->smq_ctx,
- __entry->ctx, __entry->handle, __entry->sc)
- );
- TRACE_EVENT(fastrpc_dma_map,
- TP_PROTO(int cid, int fd, uint64_t phys, size_t size,
- size_t len, unsigned int attr, int mflags),
- TP_ARGS(cid, fd, phys, size, len, attr, mflags),
- TP_STRUCT__entry(
- __field(int, cid)
- __field(int, fd)
- __field(u64, phys)
- __field(size_t, size)
- __field(size_t, len)
- __field(unsigned int, attr)
- __field(int, mflags)
- ),
- TP_fast_assign(
- __entry->cid = cid;
- __entry->fd = fd;
- __entry->phys = phys;
- __entry->size = size;
- __entry->len = len;
- __entry->attr = attr;
- __entry->mflags = mflags;
- ),
- TP_printk("cid %d, fd %d, phys 0x%llx, size %zu (len %zu), attr 0x%x, flags 0x%x",
- __entry->cid, __entry->fd, __entry->phys, __entry->size,
- __entry->len, __entry->attr, __entry->mflags)
- );
- TRACE_EVENT(fastrpc_dma_unmap,
- TP_PROTO(int cid, uint64_t phys, size_t size),
- TP_ARGS(cid, phys, size),
- TP_STRUCT__entry(
- __field(int, cid)
- __field(u64, phys)
- __field(size_t, size)
- ),
- TP_fast_assign(
- __entry->cid = cid;
- __entry->phys = phys;
- __entry->size = size;
- ),
- TP_printk("cid %d, phys 0x%llx, size %zu",
- __entry->cid, __entry->phys, __entry->size)
- );
- TRACE_EVENT(fastrpc_dma_alloc,
- TP_PROTO(int cid, uint64_t phys, size_t size,
- unsigned long attr, int mflags),
- TP_ARGS(cid, phys, size, attr, mflags),
- TP_STRUCT__entry(
- __field(int, cid)
- __field(u64, phys)
- __field(size_t, size)
- __field(unsigned long, attr)
- __field(int, mflags)
- ),
- TP_fast_assign(
- __entry->cid = cid;
- __entry->phys = phys;
- __entry->size = size;
- __entry->attr = attr;
- __entry->mflags = mflags;
- ),
- TP_printk("cid %d, phys 0x%llx, size %zu, attr 0x%lx, flags 0x%x",
- __entry->cid, __entry->phys, __entry->size,
- __entry->attr, __entry->mflags)
- );
- TRACE_EVENT(fastrpc_dma_free,
- TP_PROTO(int cid, uint64_t phys, size_t size),
- TP_ARGS(cid, phys, size),
- TP_STRUCT__entry(
- __field(int, cid)
- __field(u64, phys)
- __field(size_t, size)
- ),
- TP_fast_assign(
- __entry->cid = cid;
- __entry->phys = phys;
- __entry->size = size;
- ),
- TP_printk("cid %d, phys 0x%llx, size %zu",
- __entry->cid, __entry->phys, __entry->size)
- );
- TRACE_EVENT(fastrpc_context_complete,
- TP_PROTO(int cid, uint64_t smq_ctx, int retval,
- uint64_t ctx, uint32_t handle, uint32_t sc),
- TP_ARGS(cid, smq_ctx, retval, ctx, handle, sc),
- TP_STRUCT__entry(
- __field(int, cid)
- __field(u64, smq_ctx)
- __field(int, retval)
- __field(u64, ctx)
- __field(u32, handle)
- __field(u32, sc)
- ),
- TP_fast_assign(
- __entry->cid = cid;
- __entry->smq_ctx = smq_ctx;
- __entry->retval = retval;
- __entry->ctx = ctx;
- __entry->handle = handle;
- __entry->sc = sc;
- ),
- TP_printk("from cid %d: smq_ctx 0x%llx, retval 0x%x, ctx 0x%llx, handle 0x%x, sc 0x%x",
- __entry->cid, __entry->smq_ctx, __entry->retval,
- __entry->ctx, __entry->handle, __entry->sc)
- );
- TRACE_EVENT(fastrpc_context_alloc,
- TP_PROTO(uint64_t smq_ctx, uint64_t ctx,
- uint32_t handle, uint32_t sc),
- TP_ARGS(smq_ctx, ctx, handle, sc),
- TP_STRUCT__entry(
- __field(u64, smq_ctx)
- __field(u64, ctx)
- __field(u32, handle)
- __field(u32, sc)
- ),
- TP_fast_assign(
- __entry->smq_ctx = smq_ctx;
- __entry->ctx = ctx;
- __entry->handle = handle;
- __entry->sc = sc;
- ),
- TP_printk("for: smq_ctx 0x%llx, ctx 0x%llx, handle 0x%x, sc 0x%x",
- __entry->smq_ctx, __entry->ctx, __entry->handle, __entry->sc)
- );
- TRACE_EVENT(fastrpc_context_free,
- TP_PROTO(uint64_t smq_ctx, uint64_t ctx,
- uint32_t handle, uint32_t sc),
- TP_ARGS(smq_ctx, ctx, handle, sc),
- TP_STRUCT__entry(
- __field(u64, smq_ctx)
- __field(u64, ctx)
- __field(u32, handle)
- __field(u32, sc)
- ),
- TP_fast_assign(
- __entry->smq_ctx = smq_ctx;
- __entry->ctx = ctx;
- __entry->handle = handle;
- __entry->sc = sc;
- ),
- TP_printk("for: smq_ctx 0x%llx, ctx 0x%llx, handle 0x%x, sc 0x%x",
- __entry->smq_ctx, __entry->ctx, __entry->handle, __entry->sc)
- );
- TRACE_EVENT(fastrpc_perf_counters,
- TP_PROTO(uint32_t handle, uint32_t sc,
- uint64_t count, uint64_t flush, uint64_t map,
- uint64_t copy, uint64_t link, uint64_t getargs,
- uint64_t putargs, uint64_t invargs, uint64_t invoke,
- uint64_t tid),
- TP_ARGS(handle, sc, count, flush, map, copy, link, getargs,
- putargs, invargs, invoke, tid),
- TP_STRUCT__entry(
- __field(u32, handle)
- __field(u32, sc)
- __field(u64, count)
- __field(u64, flush)
- __field(u64, map)
- __field(u64, copy)
- __field(u64, link)
- __field(u64, getargs)
- __field(u64, putargs)
- __field(u64, invargs)
- __field(u64, invoke)
- __field(u64, tid)
- ),
- TP_fast_assign(
- __entry->handle = handle;
- __entry->sc = sc;
- __entry->count = count;
- __entry->flush = flush;
- __entry->map = map;
- __entry->copy = copy;
- __entry->link = link;
- __entry->getargs = getargs;
- __entry->putargs = putargs;
- __entry->invargs = invargs;
- __entry->invoke = invoke;
- __entry->tid = tid;
- ),
- TP_printk("for: handle 0x%x, sc 0x%x, count %lld, flush %lld ns, map %lld ns, copy %lld ns, link %lld ns, getargs %lld ns, putargs %lld ns, invargs %lld ns, invoke %lld ns, tid %lld",
- __entry->handle, __entry->sc, __entry->count,
- __entry->flush, __entry->map, __entry->copy, __entry->link,
- __entry->getargs, __entry->putargs, __entry->invargs,
- __entry->invoke, __entry->tid)
- );
- TRACE_EVENT(fastrpc_msg,
- TP_PROTO(const char *message),
- TP_ARGS(message),
- TP_STRUCT__entry(__string(buf, message)),
- TP_fast_assign(
- #if IS_ENABLED(CONFIG_MSM_ADSPRPC_TRUSTED)
- memcpy(__get_str(buf), (message), (sizeof(message) - 1));
- __get_str(buf)[sizeof(message) - 1] = '\0';
- #else
- if (message)
- __assign_str_len(buf, message, (sizeof(message) - 1));
- else
- memcpy(__get_str(buf), "(null)", sizeof("(null)"));
- #endif
- ),
- TP_printk(" %s", __get_str(buf))
- );
- TRACE_EVENT(fastrpc_dspsignal,
- TP_PROTO(const char *event, uint32_t signal_id,
- int state, uint32_t timeout),
- TP_ARGS(event, signal_id, state, timeout),
- TP_STRUCT__entry(
- __string(buf, event)
- __field(u32, signal_id)
- __field(int, state)
- __field(u32, timeout)
- ),
- TP_fast_assign(
- #if IS_ENABLED(CONFIG_MSM_ADSPRPC_TRUSTED)
- memcpy(__get_str(buf), (event), (sizeof(event) - 1));
- __get_str(buf)[sizeof(event) - 1] = '\0';
- #else
- if (event)
- __assign_str_len(buf, event, (sizeof(event) - 1));
- else
- memcpy(__get_str(buf), "(null)", sizeof("(null)"));
- #endif
- __entry->signal_id = signal_id;
- __entry->state = state;
- __entry->timeout = timeout;
- ),
- TP_printk("%s for sig id %u, state %d, timeout %u",
- __get_str(buf), __entry->signal_id, __entry->state, __entry->timeout)
- );
- #endif
- /* This part must be outside protection */
- #include <trace/define_trace.h>
|