summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c
diff options
context:
space:
mode:
authorDavid Nieto <dmartineznie@nvidia.com>2017-03-13 21:45:37 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-03-24 00:05:35 -0400
commit2a502bdd5f3c93b87286456ca901ad43b0f14906 (patch)
treeaba5c18b07b393e0306588d9ba4707a6c272ae6b /drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c
parenta84f601fbaf6b40e14a321eda1e83d93e55cebba (diff)
gpu: nvgpu: pass gk20a struct to gk20a_busy
After driver remove, the device structure passed in gk20a_busy can be invalid. To solve this the prototype of the function is modified to pass the gk20a struct instead of the device pointer. bug 200277762 JIRA: EVLR-1023 Change-Id: I08eb74bd3578834d45115098ed9936ebbb436fdf Signed-off-by: David Nieto <dmartineznie@nvidia.com> Reviewed-on: http://git-master/r/1320194 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c
index 67971369..c87226c8 100644
--- a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c
@@ -74,10 +74,10 @@ int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp)
74 priv->g = g; 74 priv->g = g;
75 75
76 if (!g->gr.sw_ready) { 76 if (!g->gr.sw_ready) {
77 err = gk20a_busy(g->dev); 77 err = gk20a_busy(g);
78 if (err) 78 if (err)
79 goto free_ref; 79 goto free_ref;
80 gk20a_idle(g->dev); 80 gk20a_idle(g);
81 } 81 }
82 82
83#ifdef CONFIG_ARCH_TEGRA_18x_SOC 83#ifdef CONFIG_ARCH_TEGRA_18x_SOC
@@ -393,7 +393,7 @@ static int nvgpu_gpu_ioctl_set_mmu_debug_mode(
393 struct gk20a *g, 393 struct gk20a *g,
394 struct nvgpu_gpu_mmu_debug_mode_args *args) 394 struct nvgpu_gpu_mmu_debug_mode_args *args)
395{ 395{
396 if (gk20a_busy(g->dev)) { 396 if (gk20a_busy(g)) {
397 gk20a_err(dev_from_gk20a(g), "failed to power on gpu\n"); 397 gk20a_err(dev_from_gk20a(g), "failed to power on gpu\n");
398 return -EINVAL; 398 return -EINVAL;
399 } 399 }
@@ -402,7 +402,7 @@ static int nvgpu_gpu_ioctl_set_mmu_debug_mode(
402 g->ops.fb.set_debug_mode(g, args->state == 1); 402 g->ops.fb.set_debug_mode(g, args->state == 1);
403 nvgpu_mutex_release(&g->dbg_sessions_lock); 403 nvgpu_mutex_release(&g->dbg_sessions_lock);
404 404
405 gk20a_idle(g->dev); 405 gk20a_idle(g);
406 return 0; 406 return 0;
407} 407}
408 408
@@ -653,7 +653,7 @@ static inline int get_timestamps_zipper(struct gk20a *g,
653 u32 gpu_timestamp_hi_new = 0; 653 u32 gpu_timestamp_hi_new = 0;
654 u32 gpu_timestamp_hi_old = 0; 654 u32 gpu_timestamp_hi_old = 0;
655 655
656 if (gk20a_busy(g->dev)) { 656 if (gk20a_busy(g)) {
657 gk20a_err(dev_from_gk20a(g), "GPU not powered on\n"); 657 gk20a_err(dev_from_gk20a(g), "GPU not powered on\n");
658 err = -EINVAL; 658 err = -EINVAL;
659 goto end; 659 goto end;
@@ -681,7 +681,7 @@ static inline int get_timestamps_zipper(struct gk20a *g,
681 } 681 }
682 682
683end: 683end:
684 gk20a_idle(g->dev); 684 gk20a_idle(g);
685 return err; 685 return err;
686} 686}
687 687
@@ -721,7 +721,7 @@ static int nvgpu_gpu_get_gpu_time(
721 u64 time; 721 u64 time;
722 int err; 722 int err;
723 723
724 err = gk20a_busy(g->dev); 724 err = gk20a_busy(g);
725 if (err) 725 if (err)
726 return err; 726 return err;
727 727
@@ -729,7 +729,7 @@ static int nvgpu_gpu_get_gpu_time(
729 if (!err) 729 if (!err)
730 args->gpu_timestamp = time; 730 args->gpu_timestamp = time;
731 731
732 gk20a_idle(g->dev); 732 gk20a_idle(g);
733 return err; 733 return err;
734} 734}
735 735
@@ -1218,7 +1218,7 @@ static int nvgpu_gpu_get_voltage(struct gk20a *g,
1218 if (!(g->gpu_characteristics.flags & NVGPU_GPU_FLAGS_SUPPORT_GET_VOLTAGE)) 1218 if (!(g->gpu_characteristics.flags & NVGPU_GPU_FLAGS_SUPPORT_GET_VOLTAGE))
1219 return -EINVAL; 1219 return -EINVAL;
1220 1220
1221 err = gk20a_busy(g->dev); 1221 err = gk20a_busy(g);
1222 if (err) 1222 if (err)
1223 return err; 1223 return err;
1224 1224
@@ -1236,7 +1236,7 @@ static int nvgpu_gpu_get_voltage(struct gk20a *g,
1236 err = -EINVAL; 1236 err = -EINVAL;
1237 } 1237 }
1238 1238
1239 gk20a_idle(g->dev); 1239 gk20a_idle(g);
1240 1240
1241 return err; 1241 return err;
1242} 1242}
@@ -1254,13 +1254,13 @@ static int nvgpu_gpu_get_current(struct gk20a *g,
1254 if (!(g->gpu_characteristics.flags & NVGPU_GPU_FLAGS_SUPPORT_GET_CURRENT)) 1254 if (!(g->gpu_characteristics.flags & NVGPU_GPU_FLAGS_SUPPORT_GET_CURRENT))
1255 return -EINVAL; 1255 return -EINVAL;
1256 1256
1257 err = gk20a_busy(g->dev); 1257 err = gk20a_busy(g);
1258 if (err) 1258 if (err)
1259 return err; 1259 return err;
1260 1260
1261 err = pmgr_pwr_devices_get_current(g, &args->currnt); 1261 err = pmgr_pwr_devices_get_current(g, &args->currnt);
1262 1262
1263 gk20a_idle(g->dev); 1263 gk20a_idle(g);
1264 1264
1265 return err; 1265 return err;
1266} 1266}
@@ -1278,13 +1278,13 @@ static int nvgpu_gpu_get_power(struct gk20a *g,
1278 if (!(g->gpu_characteristics.flags & NVGPU_GPU_FLAGS_SUPPORT_GET_POWER)) 1278 if (!(g->gpu_characteristics.flags & NVGPU_GPU_FLAGS_SUPPORT_GET_POWER))
1279 return -EINVAL; 1279 return -EINVAL;
1280 1280
1281 err = gk20a_busy(g->dev); 1281 err = gk20a_busy(g);
1282 if (err) 1282 if (err)
1283 return err; 1283 return err;
1284 1284
1285 err = pmgr_pwr_devices_get_power(g, &args->power); 1285 err = pmgr_pwr_devices_get_power(g, &args->power);
1286 1286
1287 gk20a_idle(g->dev); 1287 gk20a_idle(g);
1288 1288
1289 return err; 1289 return err;
1290} 1290}
@@ -1303,13 +1303,13 @@ static int nvgpu_gpu_get_temperature(struct gk20a *g,
1303 if (!g->ops.therm.get_internal_sensor_curr_temp) 1303 if (!g->ops.therm.get_internal_sensor_curr_temp)
1304 return -EINVAL; 1304 return -EINVAL;
1305 1305
1306 err = gk20a_busy(g->dev); 1306 err = gk20a_busy(g);
1307 if (err) 1307 if (err)
1308 return err; 1308 return err;
1309 1309
1310 err = g->ops.therm.get_internal_sensor_curr_temp(g, &temp_f24_8); 1310 err = g->ops.therm.get_internal_sensor_curr_temp(g, &temp_f24_8);
1311 1311
1312 gk20a_idle(g->dev); 1312 gk20a_idle(g);
1313 1313
1314 args->temp_f24_8 = (s32)temp_f24_8; 1314 args->temp_f24_8 = (s32)temp_f24_8;
1315 1315
@@ -1330,13 +1330,13 @@ static int nvgpu_gpu_set_therm_alert_limit(struct gk20a *g,
1330 if (!g->ops.therm.configure_therm_alert) 1330 if (!g->ops.therm.configure_therm_alert)
1331 return -EINVAL; 1331 return -EINVAL;
1332 1332
1333 err = gk20a_busy(g->dev); 1333 err = gk20a_busy(g);
1334 if (err) 1334 if (err)
1335 return err; 1335 return err;
1336 1336
1337 err = g->ops.therm.configure_therm_alert(g, args->temp_f24_8); 1337 err = g->ops.therm.configure_therm_alert(g, args->temp_f24_8);
1338 1338
1339 gk20a_idle(g->dev); 1339 gk20a_idle(g);
1340 1340
1341 return err; 1341 return err;
1342} 1342}
@@ -1371,11 +1371,11 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
1371 } 1371 }
1372 1372
1373 if (!g->gr.sw_ready) { 1373 if (!g->gr.sw_ready) {
1374 err = gk20a_busy(g->dev); 1374 err = gk20a_busy(g);
1375 if (err) 1375 if (err)
1376 return err; 1376 return err;
1377 1377
1378 gk20a_idle(g->dev); 1378 gk20a_idle(g);
1379 } 1379 }
1380 1380
1381 switch (cmd) { 1381 switch (cmd) {
@@ -1439,11 +1439,11 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
1439 } 1439 }
1440 1440
1441 if (!err) { 1441 if (!err) {
1442 err = gk20a_busy(dev); 1442 err = gk20a_busy(g);
1443 if (!err) { 1443 if (!err) {
1444 err = g->ops.gr.zbc_set_table(g, &g->gr, 1444 err = g->ops.gr.zbc_set_table(g, &g->gr,
1445 zbc_val); 1445 zbc_val);
1446 gk20a_idle(dev); 1446 gk20a_idle(g);
1447 } 1447 }
1448 } 1448 }
1449 1449