From dfb061cbdbc0a87391e475b5d86303cb028eb549 Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Fri, 21 Oct 2016 16:43:47 -0700 Subject: gpu: nvgpu: get voltage, current, power and temperature Add ioctls to retrieve voltage, current, power and temperature. Add flags in GPU characteristics to indicate if feature is supported. Jira DNVGPU-166 Change-Id: Idd5a767326c9d43630e8289ca7d2c27bb96a9f14 Signed-off-by: David Nieto Reviewed-on: http://git-master/r/1241862 Tested-by: Thomas Fleury GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: Vijayakumar Subbu Reviewed-on: http://git-master/r/1267153 --- include/uapi/linux/nvgpu.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'include/uapi') diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index 13492e0d..f45be911 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h @@ -721,6 +721,31 @@ struct nvgpu_gpu_get_fbp_l2_masks_args { __u64 mask_buf_addr; }; +#define NVGPU_GPU_VOLTAGE_CORE 1 +#define NVGPU_GPU_VOLTAGE_SRAM 2 +#define NVGPU_GPU_VOLTAGE_BUS 3 /* input to regulator */ + +struct nvgpu_gpu_get_voltage_args { + __u64 reserved; + __u32 which; /* in: NVGPU_GPU_VOLTAGE_* */ + __u32 voltage; /* uV */ +}; + +struct nvgpu_gpu_get_current_args { + __u32 reserved[3]; + __u32 currnt; /* mA */ +}; + +struct nvgpu_gpu_get_power_args { + __u32 reserved[3]; + __u32 power; /* mW */ +}; + +struct nvgpu_gpu_get_temperature_args { + __u32 reserved[3]; + __u32 temperature; /* mC */ +}; + #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 \ @@ -792,6 +817,14 @@ struct nvgpu_gpu_get_fbp_l2_masks_args { #define NVGPU_GPU_IOCTL_GET_MEMORY_STATE \ _IOWR(NVGPU_GPU_IOCTL_MAGIC, 33, \ struct nvgpu_gpu_get_memory_state_args) +#define NVGPU_GPU_IOCTL_GET_VOLTAGE \ + _IOWR(NVGPU_GPU_IOCTL_MAGIC, 33, struct nvgpu_gpu_get_voltage_args) +#define NVGPU_GPU_IOCTL_GET_CURRENT \ + _IOWR(NVGPU_GPU_IOCTL_MAGIC, 34, struct nvgpu_gpu_get_current_args) +#define NVGPU_GPU_IOCTL_GET_POWER \ + _IOWR(NVGPU_GPU_IOCTL_MAGIC, 35, struct nvgpu_gpu_get_power_args) +#define NVGPU_GPU_IOCTL_GET_TEMPERATURE \ + _IOWR(NVGPU_GPU_IOCTL_MAGIC, 36, struct nvgpu_gpu_get_temperature_args) #define NVGPU_GPU_IOCTL_GET_FBP_L2_MASKS \ _IOWR(NVGPU_GPU_IOCTL_MAGIC, 38, struct nvgpu_gpu_get_fbp_l2_masks_args) #define NVGPU_GPU_IOCTL_LAST \ -- cgit v1.2.2