From 032efd066ec4a8034204b6a34663ab2cac582fbe Mon Sep 17 00:00:00 2001 From: Arul Sekar Date: Fri, 11 Mar 2016 11:24:20 -0800 Subject: gpu: nvgpu: Provide cpu gpu time correlation via ioctl bug 1648908 Provides pairs of CPU and GPU timestamps that can be used for correlatiing the two timebases - IOCTL made available /dev/nvhost-ctrl-gpu Change-Id: I1458b9d33d794b1b02ec9fd29ed9426756b94bcd Signed-off-by: Arul Sekar Reviewed-on: http://git-master/r/1029732 Reviewed-by: Arun Gona Tested-by: Arun Gona Reviewed-on: http://git-master/r/1111715 GVS: Gerrit_Virtual_Submit Reviewed-by: Thomas Fleury Reviewed-by: Terje Bergstrom --- include/uapi/linux/nvgpu.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index 0787d4e4..68c1c4e0 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h @@ -351,6 +351,28 @@ struct nvgpu_gpu_get_buffer_info_args { }; }; +#define NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_MAX_COUNT 16 +#define NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TSC 1 +#define NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_JIFFIES 2 +#define NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TIMEOFDAY 3 + +struct nvgpu_gpu_get_cpu_time_correlation_sample { + /* gpu timestamp value */ + __u64 cpu_timestamp; + /* raw GPU counter (PTIMER) value */ + __u64 gpu_timestamp; +}; + +struct nvgpu_gpu_get_cpu_time_correlation_info_args { + /* timestamp pairs */ + struct nvgpu_gpu_get_cpu_time_correlation_sample samples[ + NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_MAX_COUNT]; + /* number of pairs to read */ + __u32 count; + /* cpu clock source id */ + __u32 source_id; +}; + #define NVGPU_GPU_IOCTL_ZCULL_GET_CTX_SIZE \ _IOR(NVGPU_GPU_IOCTL_MAGIC, 1, struct nvgpu_gpu_zcull_get_ctx_size_args) #define NVGPU_GPU_IOCTL_ZCULL_GET_INFO \ @@ -397,11 +419,13 @@ struct nvgpu_gpu_get_buffer_info_args { _IO(NVGPU_GPU_IOCTL_MAGIC, 22) #define NVGPU_GPU_IOCTL_CLEAR_SM_ERRORS \ _IO(NVGPU_GPU_IOCTL_MAGIC, 23) - +#define NVGPU_GPU_IOCTL_GET_CPU_TIME_CORRELATION_INFO \ + _IOWR(NVGPU_GPU_IOCTL_MAGIC, 24, \ + struct nvgpu_gpu_get_cpu_time_correlation_info_args) #define NVGPU_GPU_IOCTL_LAST \ - _IOC_NR(NVGPU_GPU_IOCTL_CLEAR_SM_ERRORS) + _IOC_NR(NVGPU_GPU_IOCTL_GET_CPU_TIME_CORRELATION_INFO) #define NVGPU_GPU_IOCTL_MAX_ARG_SIZE \ - sizeof(struct nvgpu_gpu_prepare_compressible_read_args) + sizeof(struct nvgpu_gpu_get_cpu_time_correlation_info_args) /* * /dev/nvhost-tsg-gpu device -- cgit v1.2.2