gpu: nvgpu: Add thermal alert limit IOCTL for UMD

Added the thermal alert lmit IOCTL for UMD

JIRA DNVGPU-130
Bug 200231080

Change-Id: I4a84157d90b12b576fa144567a3bdd5d39f5278e
Signed-off-by: Lakshmanan M <lm@nvidia.com>
Reviewed-on: http://git-master/r/1249483
(cherry picked from commit d3458008cc3dd98d3a51841b6ed8cea1aed9eb89)
Reviewed-on: http://git-master/r/1253457
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
This commit is contained in:
Lakshmanan M
2016-11-08 11:15:56 +05:30
committed by mobile promotions
parent eaeb5ff20f
commit 8a63a431c4
2 changed files with 41 additions and 1 deletions

View File

@@ -1298,6 +1298,30 @@ static int nvgpu_gpu_get_temperature(struct gk20a *g,
}
#endif
static int nvgpu_gpu_set_therm_alert_limit(struct gk20a *g,
struct nvgpu_gpu_set_therm_alert_limit_args *args)
{
int err;
gk20a_dbg_fn("");
if (args->reserved[0] || args->reserved[1] || args->reserved[2])
return -EINVAL;
if (!g->ops.therm.configure_therm_alert)
return -EINVAL;
err = gk20a_busy(g->dev);
if (err)
return err;
err = g->ops.therm.configure_therm_alert(g, args->temp_f24_8);
gk20a_idle(g->dev);
return err;
}
long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
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
break;
#endif
case NVGPU_GPU_IOCTL_SET_THERM_ALERT_LIMIT:
err = nvgpu_gpu_set_therm_alert_limit(g,
(struct nvgpu_gpu_set_therm_alert_limit_args *)buf);
break;
default:
dev_dbg(dev_from_gk20a(g), "unrecognized gpu ioctl cmd: 0x%x", cmd);
err = -ENOTTY;

View File

@@ -777,6 +777,14 @@ struct nvgpu_gpu_get_temperature_args {
__s32 temp_f24_8;
};
struct nvgpu_gpu_set_therm_alert_limit_args {
__u32 reserved[3];
/* Temperature in signed fixed point format SFXP24.8
* Celsius = temp_f24_8 / 256.
*/
__s32 temp_f24_8;
};
#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 \
@@ -858,8 +866,11 @@ struct nvgpu_gpu_get_temperature_args {
_IOWR(NVGPU_GPU_IOCTL_MAGIC, 37, 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_SET_THERM_ALERT_LIMIT \
_IOWR(NVGPU_GPU_IOCTL_MAGIC, 39, \
struct nvgpu_gpu_set_therm_alert_limit_args)
#define NVGPU_GPU_IOCTL_LAST \
_IOC_NR(NVGPU_GPU_IOCTL_GET_FBP_L2_MASKS)
_IOC_NR(NVGPU_GPU_IOCTL_SET_THERM_ALERT_LIMIT)
#define NVGPU_GPU_IOCTL_MAX_ARG_SIZE \
sizeof(struct nvgpu_gpu_get_cpu_time_correlation_info_args)