From 5ecc45b5e7f16e00b2407d4259759228ccbdcf4b Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Fri, 21 Dec 2018 10:04:27 +0530 Subject: gpu: nvgpu: add cycle stats to debugger node Add NVGPU_DBG_GPU_IOCTL_CYCLE_STATS to debugger node, to install/uninstall a buffer for cycle stats. Add NVGPU_DBG_GPU_IOCTL_CYCLE_STATS_SNAPSHOT to debugger node, to attach/flush/detach a buffer for Mode-E streamout. Those ioctls will apply to the first channel in the debug session. Bug 2660206 Bug 200464613 Change-Id: I0b96d9a07c016690140292fa5886fda545697ee6 Signed-off-by: Thomas Fleury Reviewed-on: https://git-master.nvidia.com/r/2002060 (cherry picked from commit 90b0bf98ac01d7fa24c40f6a1f20bfe5fa481d36) Signed-off-by: Gagan Grover Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2092008 Reviewed-by: automaticguardword Reviewed-by: Phoenix Jung Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: Peter Daifuku Tested-by: mobile promotions --- include/uapi/linux/nvgpu.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include/uapi') diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index ad9dce1f..2c130d82 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h @@ -1416,6 +1416,31 @@ struct nvgpu_dbg_gpu_set_sm_exception_type_mask_args { _IOW(NVGPU_DBG_GPU_IOCTL_MAGIC, 23, \ struct nvgpu_dbg_gpu_set_sm_exception_type_mask_args) +struct nvgpu_dbg_gpu_cycle_stats_args { + __u32 dmabuf_fd; + __u32 reserved; +}; + +#define NVGPU_DBG_GPU_IOCTL_CYCLE_STATS \ + _IOWR(NVGPU_DBG_GPU_IOCTL_MAGIC, 24, struct nvgpu_dbg_gpu_cycle_stats_args) + +/* cycle stats snapshot buffer support for mode E */ +struct nvgpu_dbg_gpu_cycle_stats_snapshot_args { + __u32 cmd; /* in: command to handle */ + __u32 dmabuf_fd; /* in: dma buffer handler */ + __u32 extra; /* in/out: extra payload e.g.*/ + /* counter/start perfmon */ + __u32 reserved; +}; + +/* valid commands to control cycle stats shared buffer */ +#define NVGPU_DBG_GPU_IOCTL_CYCLE_STATS_SNAPSHOT_CMD_FLUSH 0 +#define NVGPU_DBG_GPU_IOCTL_CYCLE_STATS_SNAPSHOT_CMD_ATTACH 1 +#define NVGPU_DBG_GPU_IOCTL_CYCLE_STATS_SNAPSHOT_CMD_DETACH 2 + +#define NVGPU_DBG_GPU_IOCTL_CYCLE_STATS_SNAPSHOT \ + _IOWR(NVGPU_DBG_GPU_IOCTL_MAGIC, 25, struct nvgpu_dbg_gpu_cycle_stats_snapshot_args) + /* MMU Debug Mode */ #define NVGPU_DBG_GPU_CTX_MMU_DEBUG_MODE_DISABLED 0 #define NVGPU_DBG_GPU_CTX_MMU_DEBUG_MODE_ENABLED 1 -- cgit v1.2.2