@@ -1067,50 +1067,6 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m)
10671067}
10681068#endif
10691069
1070- void etnaviv_gpu_recover_hang (struct etnaviv_gem_submit * submit )
1071- {
1072- struct etnaviv_gpu * gpu = submit -> gpu ;
1073- char * comm = NULL , * cmd = NULL ;
1074- struct task_struct * task ;
1075- unsigned int i ;
1076-
1077- dev_err (gpu -> dev , "recover hung GPU!\n" );
1078-
1079- task = get_pid_task (submit -> pid , PIDTYPE_PID );
1080- if (task ) {
1081- comm = kstrdup (task -> comm , GFP_KERNEL );
1082- cmd = kstrdup_quotable_cmdline (task , GFP_KERNEL );
1083- put_task_struct (task );
1084- }
1085-
1086- if (comm && cmd )
1087- dev_err (gpu -> dev , "offending task: %s (%s)\n" , comm , cmd );
1088-
1089- kfree (cmd );
1090- kfree (comm );
1091-
1092- if (pm_runtime_get_sync (gpu -> dev ) < 0 )
1093- goto pm_put ;
1094-
1095- mutex_lock (& gpu -> lock );
1096-
1097- etnaviv_hw_reset (gpu );
1098-
1099- /* complete all events, the GPU won't do it after the reset */
1100- spin_lock (& gpu -> event_spinlock );
1101- for_each_set_bit (i , gpu -> event_bitmap , ETNA_NR_EVENTS )
1102- complete (& gpu -> event_free );
1103- bitmap_zero (gpu -> event_bitmap , ETNA_NR_EVENTS );
1104- spin_unlock (& gpu -> event_spinlock );
1105-
1106- etnaviv_gpu_hw_init (gpu );
1107-
1108- mutex_unlock (& gpu -> lock );
1109- pm_runtime_mark_last_busy (gpu -> dev );
1110- pm_put :
1111- pm_runtime_put_autosuspend (gpu -> dev );
1112- }
1113-
11141070/* fence object management */
11151071struct etnaviv_fence {
11161072 struct etnaviv_gpu * gpu ;
@@ -1462,6 +1418,50 @@ static void sync_point_worker(struct work_struct *work)
14621418 etnaviv_gpu_start_fe (gpu , addr + 2 , 2 );
14631419}
14641420
1421+ void etnaviv_gpu_recover_hang (struct etnaviv_gem_submit * submit )
1422+ {
1423+ struct etnaviv_gpu * gpu = submit -> gpu ;
1424+ char * comm = NULL , * cmd = NULL ;
1425+ struct task_struct * task ;
1426+ unsigned int i ;
1427+
1428+ dev_err (gpu -> dev , "recover hung GPU!\n" );
1429+
1430+ task = get_pid_task (submit -> pid , PIDTYPE_PID );
1431+ if (task ) {
1432+ comm = kstrdup (task -> comm , GFP_KERNEL );
1433+ cmd = kstrdup_quotable_cmdline (task , GFP_KERNEL );
1434+ put_task_struct (task );
1435+ }
1436+
1437+ if (comm && cmd )
1438+ dev_err (gpu -> dev , "offending task: %s (%s)\n" , comm , cmd );
1439+
1440+ kfree (cmd );
1441+ kfree (comm );
1442+
1443+ if (pm_runtime_get_sync (gpu -> dev ) < 0 )
1444+ goto pm_put ;
1445+
1446+ mutex_lock (& gpu -> lock );
1447+
1448+ etnaviv_hw_reset (gpu );
1449+
1450+ /* complete all events, the GPU won't do it after the reset */
1451+ spin_lock (& gpu -> event_spinlock );
1452+ for_each_set_bit (i , gpu -> event_bitmap , ETNA_NR_EVENTS )
1453+ complete (& gpu -> event_free );
1454+ bitmap_zero (gpu -> event_bitmap , ETNA_NR_EVENTS );
1455+ spin_unlock (& gpu -> event_spinlock );
1456+
1457+ etnaviv_gpu_hw_init (gpu );
1458+
1459+ mutex_unlock (& gpu -> lock );
1460+ pm_runtime_mark_last_busy (gpu -> dev );
1461+ pm_put :
1462+ pm_runtime_put_autosuspend (gpu -> dev );
1463+ }
1464+
14651465static void dump_mmu_fault (struct etnaviv_gpu * gpu )
14661466{
14671467 static const char * fault_reasons [] = {
0 commit comments