diff options
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | 29 | ||||
-rw-r--r-- | include/uapi/linux/nvgpu.h | 13 |
2 files changed, 41 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c index 9ee06bf3..a7f61c8c 100644 --- a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | |||
@@ -1298,6 +1298,30 @@ static int nvgpu_gpu_get_temperature(struct gk20a *g, | |||
1298 | } | 1298 | } |
1299 | #endif | 1299 | #endif |
1300 | 1300 | ||
1301 | static int nvgpu_gpu_set_therm_alert_limit(struct gk20a *g, | ||
1302 | struct nvgpu_gpu_set_therm_alert_limit_args *args) | ||
1303 | { | ||
1304 | int err; | ||
1305 | |||
1306 | gk20a_dbg_fn(""); | ||
1307 | |||
1308 | if (args->reserved[0] || args->reserved[1] || args->reserved[2]) | ||
1309 | return -EINVAL; | ||
1310 | |||
1311 | if (!g->ops.therm.configure_therm_alert) | ||
1312 | return -EINVAL; | ||
1313 | |||
1314 | err = gk20a_busy(g->dev); | ||
1315 | if (err) | ||
1316 | return err; | ||
1317 | |||
1318 | err = g->ops.therm.configure_therm_alert(g, args->temp_f24_8); | ||
1319 | |||
1320 | gk20a_idle(g->dev); | ||
1321 | |||
1322 | return err; | ||
1323 | } | ||
1324 | |||
1301 | long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 1325 | long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
1302 | { | 1326 | { |
1303 | struct gk20a_ctrl_priv *priv = filp->private_data; | 1327 | struct gk20a_ctrl_priv *priv = filp->private_data; |
@@ -1606,6 +1630,11 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg | |||
1606 | break; | 1630 | break; |
1607 | #endif | 1631 | #endif |
1608 | 1632 | ||
1633 | case NVGPU_GPU_IOCTL_SET_THERM_ALERT_LIMIT: | ||
1634 | err = nvgpu_gpu_set_therm_alert_limit(g, | ||
1635 | (struct nvgpu_gpu_set_therm_alert_limit_args *)buf); | ||
1636 | break; | ||
1637 | |||
1609 | default: | 1638 | default: |
1610 | dev_dbg(dev_from_gk20a(g), "unrecognized gpu ioctl cmd: 0x%x", cmd); | 1639 | dev_dbg(dev_from_gk20a(g), "unrecognized gpu ioctl cmd: 0x%x", cmd); |
1611 | err = -ENOTTY; | 1640 | err = -ENOTTY; |
diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index 25c0472c..1fb633c8 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h | |||
@@ -777,6 +777,14 @@ struct nvgpu_gpu_get_temperature_args { | |||
777 | __s32 temp_f24_8; | 777 | __s32 temp_f24_8; |
778 | }; | 778 | }; |
779 | 779 | ||
780 | struct nvgpu_gpu_set_therm_alert_limit_args { | ||
781 | __u32 reserved[3]; | ||
782 | /* Temperature in signed fixed point format SFXP24.8 | ||
783 | * Celsius = temp_f24_8 / 256. | ||
784 | */ | ||
785 | __s32 temp_f24_8; | ||
786 | }; | ||
787 | |||
780 | #define NVGPU_GPU_IOCTL_ZCULL_GET_CTX_SIZE \ | 788 | #define NVGPU_GPU_IOCTL_ZCULL_GET_CTX_SIZE \ |
781 | _IOR(NVGPU_GPU_IOCTL_MAGIC, 1, struct nvgpu_gpu_zcull_get_ctx_size_args) | 789 | _IOR(NVGPU_GPU_IOCTL_MAGIC, 1, struct nvgpu_gpu_zcull_get_ctx_size_args) |
782 | #define NVGPU_GPU_IOCTL_ZCULL_GET_INFO \ | 790 | #define NVGPU_GPU_IOCTL_ZCULL_GET_INFO \ |
@@ -858,8 +866,11 @@ struct nvgpu_gpu_get_temperature_args { | |||
858 | _IOWR(NVGPU_GPU_IOCTL_MAGIC, 37, struct nvgpu_gpu_get_temperature_args) | 866 | _IOWR(NVGPU_GPU_IOCTL_MAGIC, 37, struct nvgpu_gpu_get_temperature_args) |
859 | #define NVGPU_GPU_IOCTL_GET_FBP_L2_MASKS \ | 867 | #define NVGPU_GPU_IOCTL_GET_FBP_L2_MASKS \ |
860 | _IOWR(NVGPU_GPU_IOCTL_MAGIC, 38, struct nvgpu_gpu_get_fbp_l2_masks_args) | 868 | _IOWR(NVGPU_GPU_IOCTL_MAGIC, 38, struct nvgpu_gpu_get_fbp_l2_masks_args) |
869 | #define NVGPU_GPU_IOCTL_SET_THERM_ALERT_LIMIT \ | ||
870 | _IOWR(NVGPU_GPU_IOCTL_MAGIC, 39, \ | ||
871 | struct nvgpu_gpu_set_therm_alert_limit_args) | ||
861 | #define NVGPU_GPU_IOCTL_LAST \ | 872 | #define NVGPU_GPU_IOCTL_LAST \ |
862 | _IOC_NR(NVGPU_GPU_IOCTL_GET_FBP_L2_MASKS) | 873 | _IOC_NR(NVGPU_GPU_IOCTL_SET_THERM_ALERT_LIMIT) |
863 | #define NVGPU_GPU_IOCTL_MAX_ARG_SIZE \ | 874 | #define NVGPU_GPU_IOCTL_MAX_ARG_SIZE \ |
864 | sizeof(struct nvgpu_gpu_get_cpu_time_correlation_info_args) | 875 | sizeof(struct nvgpu_gpu_get_cpu_time_correlation_info_args) |
865 | 876 | ||