@@ -98,14 +98,14 @@ void xe_gt_sanitize(struct xe_gt *gt)
98
98
99
99
static void xe_gt_enable_host_l2_vram (struct xe_gt * gt )
100
100
{
101
- unsigned int fw_ref ;
102
101
u32 reg ;
102
+ int err ;
103
103
104
104
if (!XE_WA (gt , 16023588340 ))
105
105
return ;
106
106
107
- fw_ref = xe_force_wake_get (gt_to_fw (gt ), XE_FW_GT );
108
- if (! fw_ref )
107
+ err = xe_force_wake_get (gt_to_fw (gt ), XE_FW_GT );
108
+ if (WARN_ON ( err ) )
109
109
return ;
110
110
111
111
if (!xe_gt_is_media_type (gt )) {
@@ -115,29 +115,29 @@ static void xe_gt_enable_host_l2_vram(struct xe_gt *gt)
115
115
}
116
116
117
117
xe_gt_mcr_multicast_write (gt , XEHPC_L3CLOS_MASK (3 ), 0xF );
118
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
118
+ xe_force_wake_put (gt_to_fw (gt ), XE_FW_GT );
119
119
}
120
120
121
121
static void xe_gt_disable_host_l2_vram (struct xe_gt * gt )
122
122
{
123
- unsigned int fw_ref ;
124
123
u32 reg ;
124
+ int err ;
125
125
126
126
if (!XE_WA (gt , 16023588340 ))
127
127
return ;
128
128
129
129
if (xe_gt_is_media_type (gt ))
130
130
return ;
131
131
132
- fw_ref = xe_force_wake_get (gt_to_fw (gt ), XE_FW_GT );
133
- if (! fw_ref )
132
+ err = xe_force_wake_get (gt_to_fw (gt ), XE_FW_GT );
133
+ if (WARN_ON ( err ) )
134
134
return ;
135
135
136
136
reg = xe_gt_mcr_unicast_read_any (gt , XE2_GAMREQSTRM_CTRL );
137
137
reg &= ~CG_DIS_CNTLBUS ;
138
138
xe_gt_mcr_multicast_write (gt , XE2_GAMREQSTRM_CTRL , reg );
139
139
140
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
140
+ xe_force_wake_put (gt_to_fw (gt ), XE_FW_GT );
141
141
}
142
142
143
143
/**
@@ -407,14 +407,11 @@ static void dump_pat_on_error(struct xe_gt *gt)
407
407
408
408
static int gt_fw_domain_init (struct xe_gt * gt )
409
409
{
410
- unsigned int fw_ref ;
411
410
int err , i ;
412
411
413
- fw_ref = xe_force_wake_get (gt_to_fw (gt ), XE_FW_GT );
414
- if (!fw_ref ) {
415
- err = - ETIMEDOUT ;
412
+ err = xe_force_wake_get (gt_to_fw (gt ), XE_FW_GT );
413
+ if (err )
416
414
goto err_hw_fence_irq ;
417
- }
418
415
419
416
if (!xe_gt_is_media_type (gt )) {
420
417
err = xe_ggtt_init (gt_to_tile (gt )-> mem .ggtt );
@@ -449,12 +446,14 @@ static int gt_fw_domain_init(struct xe_gt *gt)
449
446
*/
450
447
gt -> info .gmdid = xe_mmio_read32 (gt , GMD_ID );
451
448
452
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
449
+ err = xe_force_wake_put (gt_to_fw (gt ), XE_FW_GT );
450
+ XE_WARN_ON (err );
451
+
453
452
return 0 ;
454
453
455
454
err_force_wake :
456
455
dump_pat_on_error (gt );
457
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
456
+ xe_force_wake_put (gt_to_fw (gt ), XE_FW_GT );
458
457
err_hw_fence_irq :
459
458
for (i = 0 ; i < XE_ENGINE_CLASS_MAX ; ++ i )
460
459
xe_hw_fence_irq_finish (& gt -> fence_irq [i ]);
@@ -464,14 +463,11 @@ static int gt_fw_domain_init(struct xe_gt *gt)
464
463
465
464
static int all_fw_domain_init (struct xe_gt * gt )
466
465
{
467
- unsigned int fw_ref ;
468
466
int err , i ;
469
467
470
- fw_ref = xe_force_wake_get (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
471
- if (!xe_force_wake_ref_has_domain (fw_ref , XE_FORCEWAKE_ALL )) {
472
- err = - ETIMEDOUT ;
473
- goto err_force_wake ;
474
- }
468
+ err = xe_force_wake_get (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
469
+ if (err )
470
+ goto err_hw_fence_irq ;
475
471
476
472
xe_gt_mcr_set_implicit_defaults (gt );
477
473
xe_wa_process_gt (gt );
@@ -537,12 +533,14 @@ static int all_fw_domain_init(struct xe_gt *gt)
537
533
if (IS_SRIOV_PF (gt_to_xe (gt )))
538
534
xe_gt_sriov_pf_init_hw (gt );
539
535
540
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
536
+ err = xe_force_wake_put (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
537
+ XE_WARN_ON (err );
541
538
542
539
return 0 ;
543
540
544
541
err_force_wake :
545
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
542
+ xe_force_wake_put (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
543
+ err_hw_fence_irq :
546
544
for (i = 0 ; i < XE_ENGINE_CLASS_MAX ; ++ i )
547
545
xe_hw_fence_irq_finish (& gt -> fence_irq [i ]);
548
546
@@ -555,12 +553,11 @@ static int all_fw_domain_init(struct xe_gt *gt)
555
553
*/
556
554
int xe_gt_init_hwconfig (struct xe_gt * gt )
557
555
{
558
- unsigned int fw_ref ;
559
556
int err ;
560
557
561
- fw_ref = xe_force_wake_get (gt_to_fw (gt ), XE_FW_GT );
562
- if (! fw_ref )
563
- return - ETIMEDOUT ;
558
+ err = xe_force_wake_get (gt_to_fw (gt ), XE_FW_GT );
559
+ if (err )
560
+ goto out ;
564
561
565
562
xe_gt_mcr_init_early (gt );
566
563
xe_pat_init (gt );
@@ -578,7 +575,8 @@ int xe_gt_init_hwconfig(struct xe_gt *gt)
578
575
xe_gt_enable_host_l2_vram (gt );
579
576
580
577
out_fw :
581
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
578
+ xe_force_wake_put (gt_to_fw (gt ), XE_FW_GT );
579
+ out :
582
580
return err ;
583
581
}
584
582
@@ -746,7 +744,6 @@ static int do_gt_restart(struct xe_gt *gt)
746
744
747
745
static int gt_reset (struct xe_gt * gt )
748
746
{
749
- unsigned int fw_ref ;
750
747
int err ;
751
748
752
749
if (xe_device_wedged (gt_to_xe (gt )))
@@ -767,11 +764,9 @@ static int gt_reset(struct xe_gt *gt)
767
764
768
765
xe_gt_sanitize (gt );
769
766
770
- fw_ref = xe_force_wake_get (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
771
- if (!xe_force_wake_ref_has_domain (fw_ref , XE_FORCEWAKE_ALL )) {
772
- err = - ETIMEDOUT ;
773
- goto err_out ;
774
- }
767
+ err = xe_force_wake_get (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
768
+ if (err )
769
+ goto err_msg ;
775
770
776
771
if (IS_SRIOV_PF (gt_to_xe (gt )))
777
772
xe_gt_sriov_pf_stop_prepare (gt );
@@ -792,15 +787,17 @@ static int gt_reset(struct xe_gt *gt)
792
787
if (err )
793
788
goto err_out ;
794
789
795
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
790
+ err = xe_force_wake_put (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
791
+ XE_WARN_ON (err );
796
792
xe_pm_runtime_put (gt_to_xe (gt ));
797
793
798
794
xe_gt_info (gt , "reset done\n" );
799
795
800
796
return 0 ;
801
797
802
798
err_out :
803
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
799
+ XE_WARN_ON (xe_force_wake_put (gt_to_fw (gt ), XE_FORCEWAKE_ALL ));
800
+ err_msg :
804
801
XE_WARN_ON (xe_uc_start (& gt -> uc ));
805
802
err_fail :
806
803
xe_gt_err (gt , "reset failed (%pe)\n" , ERR_PTR (err ));
@@ -832,25 +829,22 @@ void xe_gt_reset_async(struct xe_gt *gt)
832
829
833
830
void xe_gt_suspend_prepare (struct xe_gt * gt )
834
831
{
835
- unsigned int fw_ref ;
836
-
837
- fw_ref = xe_force_wake_get (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
832
+ XE_WARN_ON (xe_force_wake_get (gt_to_fw (gt ), XE_FORCEWAKE_ALL ));
838
833
839
834
xe_uc_suspend_prepare (& gt -> uc );
840
835
841
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
836
+ XE_WARN_ON ( xe_force_wake_put (gt_to_fw (gt ), XE_FORCEWAKE_ALL ) );
842
837
}
843
838
844
839
int xe_gt_suspend (struct xe_gt * gt )
845
840
{
846
- unsigned int fw_ref ;
847
841
int err ;
848
842
849
843
xe_gt_dbg (gt , "suspending\n" );
850
844
xe_gt_sanitize (gt );
851
845
852
- fw_ref = xe_force_wake_get (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
853
- if (! xe_force_wake_ref_has_domain ( fw_ref , XE_FORCEWAKE_ALL ) )
846
+ err = xe_force_wake_get (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
847
+ if (err )
854
848
goto err_msg ;
855
849
856
850
err = xe_uc_suspend (& gt -> uc );
@@ -861,27 +855,24 @@ int xe_gt_suspend(struct xe_gt *gt)
861
855
862
856
xe_gt_disable_host_l2_vram (gt );
863
857
864
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
858
+ XE_WARN_ON ( xe_force_wake_put (gt_to_fw (gt ), XE_FORCEWAKE_ALL ) );
865
859
xe_gt_dbg (gt , "suspended\n" );
866
860
867
861
return 0 ;
868
862
869
- err_msg :
870
- err = - ETIMEDOUT ;
871
863
err_force_wake :
872
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
864
+ XE_WARN_ON (xe_force_wake_put (gt_to_fw (gt ), XE_FORCEWAKE_ALL ));
865
+ err_msg :
873
866
xe_gt_err (gt , "suspend failed (%pe)\n" , ERR_PTR (err ));
874
867
875
868
return err ;
876
869
}
877
870
878
871
void xe_gt_shutdown (struct xe_gt * gt )
879
872
{
880
- unsigned int fw_ref ;
881
-
882
- fw_ref = xe_force_wake_get (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
873
+ xe_force_wake_get (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
883
874
do_gt_reset (gt );
884
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
875
+ xe_force_wake_put (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
885
876
}
886
877
887
878
/**
@@ -906,12 +897,11 @@ int xe_gt_sanitize_freq(struct xe_gt *gt)
906
897
907
898
int xe_gt_resume (struct xe_gt * gt )
908
899
{
909
- unsigned int fw_ref ;
910
900
int err ;
911
901
912
902
xe_gt_dbg (gt , "resuming\n" );
913
- fw_ref = xe_force_wake_get (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
914
- if (! xe_force_wake_ref_has_domain ( fw_ref , XE_FORCEWAKE_ALL ) )
903
+ err = xe_force_wake_get (gt_to_fw (gt ), XE_FORCEWAKE_ALL );
904
+ if (err )
915
905
goto err_msg ;
916
906
917
907
err = do_gt_restart (gt );
@@ -920,15 +910,14 @@ int xe_gt_resume(struct xe_gt *gt)
920
910
921
911
xe_gt_idle_enable_pg (gt );
922
912
923
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
913
+ XE_WARN_ON ( xe_force_wake_put (gt_to_fw (gt ), XE_FORCEWAKE_ALL ) );
924
914
xe_gt_dbg (gt , "resumed\n" );
925
915
926
916
return 0 ;
927
917
928
- err_msg :
929
- err = - ETIMEDOUT ;
930
918
err_force_wake :
931
- xe_force_wake_put (gt_to_fw (gt ), fw_ref );
919
+ XE_WARN_ON (xe_force_wake_put (gt_to_fw (gt ), XE_FORCEWAKE_ALL ));
920
+ err_msg :
932
921
xe_gt_err (gt , "resume failed (%pe)\n" , ERR_PTR (err ));
933
922
934
923
return err ;
0 commit comments