diff mbox series

[v2,2/2] dmaengine: fsl-edma: add trace event support

Message ID 20230919151430.2919042-3-Frank.Li@nxp.com (mailing list archive)
State Superseded
Headers show
Series dmaengine: fsl_edma: add trace and debugfs support | expand

Commit Message

Frank Li Sept. 19, 2023, 3:14 p.m. UTC
Implement trace event support to enhance logging functionality for
register access and the transfer control descriptor (TCD) context.
This will enable more comprehensive monitoring and analysis of system
activities

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/dma/Makefile          |   6 +-
 drivers/dma/fsl-edma-common.c |   2 +
 drivers/dma/fsl-edma-common.h |  29 +++++++-
 drivers/dma/fsl-edma-trace.c  |   4 +
 drivers/dma/fsl-edma-trace.h  | 134 ++++++++++++++++++++++++++++++++++
 5 files changed, 169 insertions(+), 6 deletions(-)
 create mode 100644 drivers/dma/fsl-edma-trace.c
 create mode 100644 drivers/dma/fsl-edma-trace.h

Comments

kernel test robot Sept. 19, 2023, 9:47 p.m. UTC | #1
Hi Frank,

kernel test robot noticed the following build warnings:

[auto build test WARNING on vkoul-dmaengine/next]
[also build test WARNING on linus/master v6.6-rc2 next-20230919]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Frank-Li/dmaengine-fsl-emda-add-debugfs-support/20230920-010257
base:   https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next
patch link:    https://lore.kernel.org/r/20230919151430.2919042-3-Frank.Li%40nxp.com
patch subject: [PATCH v2 2/2] dmaengine: fsl-edma: add trace event support
config: arc-randconfig-001-20230920 (https://download.01.org/0day-ci/archive/20230920/202309200524.QTINjSsC-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230920/202309200524.QTINjSsC-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309200524.QTINjSsC-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/trace/define_trace.h:102,
                    from drivers/dma/fsl-edma-trace.h:134,
                    from drivers/dma/fsl-edma-common.h:238,
                    from drivers/dma/fsl-edma-trace.c:4:
   drivers/dma/./fsl-edma-trace.h: In function 'trace_raw_output_edma_log_io':
>> drivers/dma/./fsl-edma-trace.h:28:19: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=]
      28 |         TP_printk("offset %08lx: value %08x",
         |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/trace/trace_events.h:203:34: note: in definition of macro 'DECLARE_EVENT_CLASS'
     203 |         trace_event_printf(iter, print);                                \
         |                                  ^~~~~
   drivers/dma/./fsl-edma-trace.h:28:9: note: in expansion of macro 'TP_printk'
      28 |         TP_printk("offset %08lx: value %08x",
         |         ^~~~~~~~~
   In file included from include/trace/trace_events.h:237:
   drivers/dma/./fsl-edma-trace.h:28:31: note: format string is defined here
      28 |         TP_printk("offset %08lx: value %08x",
         |                           ~~~~^
         |                               |
         |                               long unsigned int
         |                           %08x


vim +28 drivers/dma/./fsl-edma-trace.h

    14	
    15	DECLARE_EVENT_CLASS(edma_log_io,
    16		TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr, u32 value),
    17		TP_ARGS(edma, addr, value),
    18		TP_STRUCT__entry(
    19			__field(struct fsl_edma_engine *, edma)
    20			__field(void __iomem *, addr)
    21			__field(u32, value)
    22		),
    23		TP_fast_assign(
    24			__entry->edma = edma;
    25			__entry->addr = addr;
    26			__entry->value = value;
    27		),
  > 28		TP_printk("offset %08lx: value %08x",
    29			__entry->addr - __entry->edma->membase, __entry->value)
    30	);
    31
kernel test robot Sept. 20, 2023, 2:49 a.m. UTC | #2
Hi Frank,

kernel test robot noticed the following build warnings:

[auto build test WARNING on vkoul-dmaengine/next]
[also build test WARNING on linus/master v6.6-rc2 next-20230919]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Frank-Li/dmaengine-fsl-emda-add-debugfs-support/20230920-010257
base:   https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next
patch link:    https://lore.kernel.org/r/20230919151430.2919042-3-Frank.Li%40nxp.com
patch subject: [PATCH v2 2/2] dmaengine: fsl-edma: add trace event support
config: x86_64-randconfig-123-20230920 (https://download.01.org/0day-ci/archive/20230920/202309201032.LMx2JZTV-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230920/202309201032.LMx2JZTV-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309201032.LMx2JZTV-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   drivers/dma/fsl-edma-trace.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, drivers/dma/fsl-edma-trace.h, ...):
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] saddr @@     got restricted __le32 [usertype] saddr @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned int [usertype] saddr
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le32 [usertype] saddr
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] soff @@     got restricted __le16 [usertype] soff @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned short [usertype] soff
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le16 [usertype] soff
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] attr @@     got restricted __le16 [usertype] attr @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned short [usertype] attr
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le16 [usertype] attr
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] nbytes @@     got restricted __le32 [usertype] nbytes @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned int [usertype] nbytes
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le32 [usertype] nbytes
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] slast @@     got restricted __le32 [usertype] slast @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned int [usertype] slast
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le32 [usertype] slast
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] daddr @@     got restricted __le32 [usertype] daddr @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned int [usertype] daddr
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le32 [usertype] daddr
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] doff @@     got restricted __le16 [usertype] doff @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned short [usertype] doff
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le16 [usertype] doff
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] citer @@     got restricted __le16 [usertype] citer @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned short [usertype] citer
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le16 [usertype] citer
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] dlast_sga @@     got restricted __le32 [usertype] dlast_sga @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned int [usertype] dlast_sga
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le32 [usertype] dlast_sga
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] csr @@     got restricted __le16 [usertype] csr @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned short [usertype] csr
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le16 [usertype] csr
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] biter @@     got restricted __le16 [usertype] biter @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned short [usertype] biter
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le16 [usertype] biter
   drivers/dma/fsl-edma-trace.c: note: in included file (through include/trace/perf.h, include/trace/define_trace.h, drivers/dma/fsl-edma-trace.h, ...):
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] saddr @@     got restricted __le32 [usertype] saddr @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned int [usertype] saddr
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le32 [usertype] saddr
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] soff @@     got restricted __le16 [usertype] soff @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned short [usertype] soff
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le16 [usertype] soff
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] attr @@     got restricted __le16 [usertype] attr @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned short [usertype] attr
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le16 [usertype] attr
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] nbytes @@     got restricted __le32 [usertype] nbytes @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned int [usertype] nbytes
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le32 [usertype] nbytes
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] slast @@     got restricted __le32 [usertype] slast @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned int [usertype] slast
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le32 [usertype] slast
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] daddr @@     got restricted __le32 [usertype] daddr @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned int [usertype] daddr
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le32 [usertype] daddr
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] doff @@     got restricted __le16 [usertype] doff @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned short [usertype] doff
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le16 [usertype] doff
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] citer @@     got restricted __le16 [usertype] citer @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned short [usertype] citer
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le16 [usertype] citer
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] dlast_sga @@     got restricted __le32 [usertype] dlast_sga @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned int [usertype] dlast_sga
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le32 [usertype] dlast_sga
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] csr @@     got restricted __le16 [usertype] csr @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned short [usertype] csr
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le16 [usertype] csr
>> drivers/dma/./fsl-edma-trace.h:62:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] biter @@     got restricted __le16 [usertype] biter @@
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     expected unsigned short [usertype] biter
   drivers/dma/./fsl-edma-trace.h:62:1: sparse:     got restricted __le16 [usertype] biter

vim +62 drivers/dma/./fsl-edma-trace.h

    61	
  > 62	DECLARE_EVENT_CLASS(edma_log_tcd,
    63		TP_PROTO(struct fsl_edma_engine *edma, struct fsl_edma_hw_tcd *tcd),
    64		TP_ARGS(edma, tcd),
    65		TP_STRUCT__entry(
    66			__field(struct fsl_edma_engine *, edma)
    67			__field(u32, saddr)
    68			__field(u16, soff)
    69			__field(u16, attr)
    70			__field(u32, nbytes)
    71			__field(u32, slast)
    72			__field(u32, daddr)
    73			__field(u16, doff)
    74			__field(u16, citer)
    75			__field(u32, dlast_sga)
    76			__field(u16, csr)
    77			__field(u16, biter)
    78	
    79		),
    80		TP_fast_assign(
    81			__entry->edma = edma;
    82			__entry->saddr = tcd->saddr,
    83			__entry->soff = tcd->soff,
    84			__entry->attr = tcd->attr,
    85			__entry->nbytes = tcd->nbytes,
    86			__entry->slast = tcd->slast,
    87			__entry->daddr = tcd->daddr,
    88			__entry->doff = tcd->doff,
    89			__entry->citer = tcd->citer,
    90			__entry->dlast_sga = tcd->dlast_sga,
    91			__entry->csr = tcd->csr,
    92			__entry->biter = tcd->biter;
    93		),
    94		TP_printk("\n==== TCD =====\n"
    95			  "  saddr:  0x%08x\n"
    96			  "  soff:       0x%04x\n"
    97			  "  attr:       0x%04x\n"
    98			  "  nbytes: 0x%08x\n"
    99			  "  slast:  0x%08x\n"
   100			  "  daddr:  0x%08x\n"
   101			  "  doff:       0x%04x\n"
   102			  "  citer:      0x%04x\n"
   103			  "  dlast:  0x%08x\n"
   104			  "  csr:        0x%04x\n"
   105			  "  biter:      0x%04x\n",
   106			__entry->saddr,
   107			__entry->soff,
   108			__entry->attr,
   109			__entry->nbytes,
   110			__entry->slast,
   111			__entry->daddr,
   112			__entry->doff,
   113			__entry->citer,
   114			__entry->dlast_sga,
   115			__entry->csr,
   116			__entry->biter)
   117	);
   118
diff mbox series

Patch

diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
index a51c6397bcad0..40b2dd554e5dc 100644
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -32,10 +32,12 @@  obj-$(CONFIG_DW_DMAC_CORE) += dw/
 obj-$(CONFIG_DW_EDMA) += dw-edma/
 obj-$(CONFIG_EP93XX_DMA) += ep93xx_dma.o
 fsl-edma-debugfs-$(CONFIG_DEBUG_FS) := fsl-edma-debugfs.o
+CFLAGS_fsl-edma-trace.o := -I$(src)
+fsl-edma-trace-$(CONFIG_TRACING) := fsl-edma-trace.o
 obj-$(CONFIG_FSL_DMA) += fsldma.o
-fsl-edma-objs := fsl-edma-main.o fsl-edma-common.o $(fsl-edma-debugfs-y)
+fsl-edma-objs := fsl-edma-main.o fsl-edma-common.o $(fsl-edma-debugfs-y) ${fsl-edma-trace-y}
 obj-$(CONFIG_FSL_EDMA) += fsl-edma.o
-mcf-edma-objs := mcf-edma-main.o fsl-edma-common.o $(fsl-edma-debugfs-y)
+mcf-edma-objs := mcf-edma-main.o fsl-edma-common.o $(fsl-edma-debugfs-y) ${fsl-edma-trace-y}
 obj-$(CONFIG_MCF_EDMA) += mcf-edma.o
 obj-$(CONFIG_FSL_QDMA) += fsl-qdma.o
 obj-$(CONFIG_FSL_RAID) += fsl_raid.o
diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index a0f5741abcc47..0182e2695fdc0 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -521,6 +521,8 @@  void fsl_edma_fill_tcd(struct fsl_edma_chan *fsl_chan,
 		csr |= EDMA_TCD_CSR_START;
 
 	tcd->csr = cpu_to_le16(csr);
+
+	trace_edma_fill_tcd(fsl_chan->edma, tcd);
 }
 
 static struct fsl_edma_desc *fsl_edma_alloc_desc(struct fsl_edma_chan *fsl_chan,
diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h
index ecaba563d4897..a9e27110ac7d7 100644
--- a/drivers/dma/fsl-edma-common.h
+++ b/drivers/dma/fsl-edma-common.h
@@ -234,6 +234,9 @@  struct fsl_edma_engine {
 	edma_writel(chan->edma, val,				\
 		   (void __iomem *)&(container_of(chan->tcd, struct fsl_edma3_ch_reg, tcd)->__name))
 
+/* Need after struct defination */
+#include "fsl-edma-trace.h"
+
 /*
  * R/W functions for big- or little-endian registers:
  * The eDMA controller's endian is independent of the CPU core's endian.
@@ -242,18 +245,30 @@  struct fsl_edma_engine {
  */
 static inline u32 edma_readl(struct fsl_edma_engine *edma, void __iomem *addr)
 {
+	u32 val;
+
 	if (edma->big_endian)
-		return ioread32be(addr);
+		val = ioread32be(addr);
 	else
-		return ioread32(addr);
+		val = ioread32(addr);
+
+	trace_edma_readl(edma, addr, val);
+
+	return val;
 }
 
 static inline u16 edma_readw(struct fsl_edma_engine *edma, void __iomem *addr)
 {
+	u16 val;
+
 	if (edma->big_endian)
-		return ioread16be(addr);
+		val = ioread16be(addr);
 	else
-		return ioread16(addr);
+		val = ioread16(addr);
+
+	trace_edma_readw(edma, addr, val);
+
+	return val;
 }
 
 static inline void edma_writeb(struct fsl_edma_engine *edma,
@@ -264,6 +279,8 @@  static inline void edma_writeb(struct fsl_edma_engine *edma,
 		iowrite8(val, (void __iomem *)((unsigned long)addr ^ 0x3));
 	else
 		iowrite8(val, addr);
+
+	trace_edma_writeb(edma, addr, val);
 }
 
 static inline void edma_writew(struct fsl_edma_engine *edma,
@@ -274,6 +291,8 @@  static inline void edma_writew(struct fsl_edma_engine *edma,
 		iowrite16be(val, (void __iomem *)((unsigned long)addr ^ 0x2));
 	else
 		iowrite16(val, addr);
+
+	trace_edma_writew(edma, addr, val);
 }
 
 static inline void edma_writel(struct fsl_edma_engine *edma,
@@ -283,6 +302,8 @@  static inline void edma_writel(struct fsl_edma_engine *edma,
 		iowrite32be(val, addr);
 	else
 		iowrite32(val, addr);
+
+	trace_edma_writel(edma, addr, val);
 }
 
 static inline struct fsl_edma_chan *to_fsl_edma_chan(struct dma_chan *chan)
diff --git a/drivers/dma/fsl-edma-trace.c b/drivers/dma/fsl-edma-trace.c
new file mode 100644
index 0000000000000..28300ad80bb75
--- /dev/null
+++ b/drivers/dma/fsl-edma-trace.c
@@ -0,0 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
+
+#define CREATE_TRACE_POINTS
+#include "fsl-edma-common.h"
diff --git a/drivers/dma/fsl-edma-trace.h b/drivers/dma/fsl-edma-trace.h
new file mode 100644
index 0000000000000..e982651c682f1
--- /dev/null
+++ b/drivers/dma/fsl-edma-trace.h
@@ -0,0 +1,134 @@ 
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2023 NXP.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM fsl_edma
+
+#if !defined(__LINUX_FSL_EDMA_TRACE) || defined(TRACE_HEADER_MULTI_READ)
+#define __LINUX_FSL_EDMA_TRACE
+
+#include <linux/types.h>
+#include <linux/tracepoint.h>
+
+DECLARE_EVENT_CLASS(edma_log_io,
+	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr, u32 value),
+	TP_ARGS(edma, addr, value),
+	TP_STRUCT__entry(
+		__field(struct fsl_edma_engine *, edma)
+		__field(void __iomem *, addr)
+		__field(u32, value)
+	),
+	TP_fast_assign(
+		__entry->edma = edma;
+		__entry->addr = addr;
+		__entry->value = value;
+	),
+	TP_printk("offset %08lx: value %08x",
+		__entry->addr - __entry->edma->membase, __entry->value)
+);
+
+DEFINE_EVENT(edma_log_io, edma_readl,
+	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr, u32 value),
+	TP_ARGS(edma, addr, value)
+);
+
+DEFINE_EVENT(edma_log_io, edma_writel,
+	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr,  u32 value),
+	TP_ARGS(edma, addr, value)
+);
+
+DEFINE_EVENT(edma_log_io, edma_readw,
+	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr, u32 value),
+	TP_ARGS(edma, addr, value)
+);
+
+DEFINE_EVENT(edma_log_io, edma_writew,
+	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr,  u32 value),
+	TP_ARGS(edma, addr, value)
+);
+
+DEFINE_EVENT(edma_log_io, edma_readb,
+	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr, u32 value),
+	TP_ARGS(edma, addr, value)
+);
+
+DEFINE_EVENT(edma_log_io, edma_writeb,
+	TP_PROTO(struct fsl_edma_engine *edma, void __iomem *addr,  u32 value),
+	TP_ARGS(edma, addr, value)
+);
+
+DECLARE_EVENT_CLASS(edma_log_tcd,
+	TP_PROTO(struct fsl_edma_engine *edma, struct fsl_edma_hw_tcd *tcd),
+	TP_ARGS(edma, tcd),
+	TP_STRUCT__entry(
+		__field(struct fsl_edma_engine *, edma)
+		__field(u32, saddr)
+		__field(u16, soff)
+		__field(u16, attr)
+		__field(u32, nbytes)
+		__field(u32, slast)
+		__field(u32, daddr)
+		__field(u16, doff)
+		__field(u16, citer)
+		__field(u32, dlast_sga)
+		__field(u16, csr)
+		__field(u16, biter)
+
+	),
+	TP_fast_assign(
+		__entry->edma = edma;
+		__entry->saddr = tcd->saddr,
+		__entry->soff = tcd->soff,
+		__entry->attr = tcd->attr,
+		__entry->nbytes = tcd->nbytes,
+		__entry->slast = tcd->slast,
+		__entry->daddr = tcd->daddr,
+		__entry->doff = tcd->doff,
+		__entry->citer = tcd->citer,
+		__entry->dlast_sga = tcd->dlast_sga,
+		__entry->csr = tcd->csr,
+		__entry->biter = tcd->biter;
+	),
+	TP_printk("\n==== TCD =====\n"
+		  "  saddr:  0x%08x\n"
+		  "  soff:       0x%04x\n"
+		  "  attr:       0x%04x\n"
+		  "  nbytes: 0x%08x\n"
+		  "  slast:  0x%08x\n"
+		  "  daddr:  0x%08x\n"
+		  "  doff:       0x%04x\n"
+		  "  citer:      0x%04x\n"
+		  "  dlast:  0x%08x\n"
+		  "  csr:        0x%04x\n"
+		  "  biter:      0x%04x\n",
+		__entry->saddr,
+		__entry->soff,
+		__entry->attr,
+		__entry->nbytes,
+		__entry->slast,
+		__entry->daddr,
+		__entry->doff,
+		__entry->citer,
+		__entry->dlast_sga,
+		__entry->csr,
+		__entry->biter)
+);
+
+DEFINE_EVENT(edma_log_tcd, edma_fill_tcd,
+	TP_PROTO(struct fsl_edma_engine *edma, struct fsl_edma_hw_tcd *tcd),
+	TP_ARGS(edma, tcd)
+);
+
+#endif
+
+/* this part must be outside header guard */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE fsl-edma-trace
+
+#include <trace/define_trace.h>