1919 */
2020
2121#include <linux/kthread.h>
22+ #include <linux/moduleparam.h>
2223
2324#include "v3d_drv.h"
2425#include "v3d_regs.h"
2526#include "v3d_trace.h"
2627
28+ static uint timeout = 500 ;
29+ module_param (timeout , uint , 0444 );
30+ MODULE_PARM_DESC (timeout ,
31+ "Timeout for a job in ms (0 means infinity and default is 500 ms)" );
32+
2733static struct v3d_job *
2834to_v3d_job (struct drm_sched_job * sched_job )
2935{
@@ -405,13 +411,13 @@ v3d_sched_init(struct v3d_dev *v3d)
405411{
406412 int hw_jobs_limit = 1 ;
407413 int job_hang_limit = 0 ;
408- int hang_limit_ms = 500 ;
414+ long timeout_jiffies = timeout ?
415+ msecs_to_jiffies (timeout ) : MAX_SCHEDULE_TIMEOUT ;
409416 int ret ;
410417
411418 ret = drm_sched_init (& v3d -> queue [V3D_BIN ].sched ,
412419 & v3d_bin_sched_ops ,
413- hw_jobs_limit , job_hang_limit ,
414- msecs_to_jiffies (hang_limit_ms ),
420+ hw_jobs_limit , job_hang_limit , timeout_jiffies ,
415421 "v3d_bin" );
416422 if (ret ) {
417423 dev_err (v3d -> dev , "Failed to create bin scheduler: %d." , ret );
@@ -420,8 +426,7 @@ v3d_sched_init(struct v3d_dev *v3d)
420426
421427 ret = drm_sched_init (& v3d -> queue [V3D_RENDER ].sched ,
422428 & v3d_render_sched_ops ,
423- hw_jobs_limit , job_hang_limit ,
424- msecs_to_jiffies (hang_limit_ms ),
429+ hw_jobs_limit , job_hang_limit , timeout_jiffies ,
425430 "v3d_render" );
426431 if (ret ) {
427432 dev_err (v3d -> dev , "Failed to create render scheduler: %d." ,
@@ -432,8 +437,7 @@ v3d_sched_init(struct v3d_dev *v3d)
432437
433438 ret = drm_sched_init (& v3d -> queue [V3D_TFU ].sched ,
434439 & v3d_tfu_sched_ops ,
435- hw_jobs_limit , job_hang_limit ,
436- msecs_to_jiffies (hang_limit_ms ),
440+ hw_jobs_limit , job_hang_limit , timeout_jiffies ,
437441 "v3d_tfu" );
438442 if (ret ) {
439443 dev_err (v3d -> dev , "Failed to create TFU scheduler: %d." ,
@@ -445,8 +449,7 @@ v3d_sched_init(struct v3d_dev *v3d)
445449 if (v3d_has_csd (v3d )) {
446450 ret = drm_sched_init (& v3d -> queue [V3D_CSD ].sched ,
447451 & v3d_csd_sched_ops ,
448- hw_jobs_limit , job_hang_limit ,
449- msecs_to_jiffies (hang_limit_ms ),
452+ hw_jobs_limit , job_hang_limit , timeout_jiffies ,
450453 "v3d_csd" );
451454 if (ret ) {
452455 dev_err (v3d -> dev , "Failed to create CSD scheduler: %d." ,
@@ -457,8 +460,7 @@ v3d_sched_init(struct v3d_dev *v3d)
457460
458461 ret = drm_sched_init (& v3d -> queue [V3D_CACHE_CLEAN ].sched ,
459462 & v3d_cache_clean_sched_ops ,
460- hw_jobs_limit , job_hang_limit ,
461- msecs_to_jiffies (hang_limit_ms ),
463+ hw_jobs_limit , job_hang_limit , timeout_jiffies ,
462464 "v3d_cache_clean" );
463465 if (ret ) {
464466 dev_err (v3d -> dev , "Failed to create CACHE_CLEAN scheduler: %d." ,
0 commit comments