]> git.baikalelectronics.ru Git - kernel.git/commit
habanalabs: add new IOCTL for debug, tracing and profiling
authorOmer Shpigelman <oshpigelman@habana.ai>
Mon, 1 Apr 2019 19:31:22 +0000 (22:31 +0300)
committerOded Gabbay <oded.gabbay@gmail.com>
Mon, 1 Apr 2019 19:31:22 +0000 (22:31 +0300)
commit3054a03818fd4c860d550e254f2312e039d19ed1
treed50cb8fd6e69f64223d9d37a86b2c7d6d0e8608d
parent6e0fe2211abf51b55276d96bb4209c85386f8f05
habanalabs: add new IOCTL for debug, tracing and profiling

Habanalabs ASICs use the ARM coresight infrastructure to support debug,
tracing and profiling of neural networks topologies.

Because the coresight is configured using register writes and reads, and
some of the registers hold sensitive information (e.g. the address in
the device's DRAM where the trace data is written to), the user must go
through the kernel driver to configure this mechanism.

This patch implements the common code of the IOCTL and calls the
ASIC-specific function for the actual H/W configuration.

The IOCTL supports configuration of seven coresight components:
ETR, ETF, STM, FUNNEL, BMON, SPMU and TIMESTAMP

The user specifies which component he wishes to configure and provides a
pointer to a structure (located in its process space) that contains the
relevant configuration.

The common code copies the relevant data from the user-space to kernel
space and then calls the ASIC-specific function to do the H/W
configuration.

After the configuration is done, which is usually composed
of several IOCTL calls depending on what the user wanted to trace, the
user can start executing the topology. The trace data will be written to
the user's area in the device's DRAM.

After the tracing operation is complete, and user will call the IOCTL
again to disable the tracing operation. The user also need to read
values from registers for some of the components (e.g. the size of the
trace data in the device's DRAM). In that case, the user will provide a
pointer to an "output" structure in user-space, which the IOCTL code will
fill according the to selected component.

Signed-off-by: Omer Shpigelman <oshpigelman@habana.ai>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/misc/habanalabs/goya/Makefile
drivers/misc/habanalabs/goya/goya.c
drivers/misc/habanalabs/goya/goyaP.h
drivers/misc/habanalabs/goya/goya_coresight.c [new file with mode: 0644]
drivers/misc/habanalabs/habanalabs.h
drivers/misc/habanalabs/habanalabs_ioctl.c
include/uapi/misc/habanalabs.h