@@ -318,6 +318,7 @@ static void xe_guc_ct_set_state(struct xe_guc_ct *ct,
318318int xe_guc_ct_enable (struct xe_guc_ct * ct )
319319{
320320 struct xe_device * xe = ct_to_xe (ct );
321+ struct xe_gt * gt = ct_to_gt (ct );
321322 int err ;
322323
323324 xe_assert (xe , !xe_guc_ct_enabled (ct ));
@@ -341,12 +342,12 @@ int xe_guc_ct_enable(struct xe_guc_ct *ct)
341342
342343 smp_mb ();
343344 wake_up_all (& ct -> wq );
344- drm_dbg ( & xe -> drm , "GuC CT communication channel enabled\n" );
345+ xe_gt_dbg ( gt , "GuC CT communication channel enabled\n" );
345346
346347 return 0 ;
347348
348349err_out :
349- drm_err ( & xe -> drm , "Failed to enable CT (%d )\n" , err );
350+ xe_gt_err ( gt , "Failed to enable GuC CT (%pe )\n" , ERR_PTR ( err ) );
350351
351352 return err ;
352353}
@@ -633,8 +634,8 @@ static int guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action, u32 len,
633634 u32 g2h_len , u32 num_g2h ,
634635 struct g2h_fence * g2h_fence )
635636{
636- struct drm_device * drm = & ct_to_xe (ct )-> drm ;
637- struct drm_printer p = drm_info_printer ( drm -> dev );
637+ struct xe_gt * gt = ct_to_gt (ct );
638+ struct drm_printer p = xe_gt_info_printer ( gt );
638639 unsigned int sleep_period_ms = 1 ;
639640 int ret ;
640641
@@ -696,7 +697,7 @@ static int guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action, u32 len,
696697 return ret ;
697698
698699broken :
699- drm_err ( drm , "No forward process on H2G, reset required" );
700+ xe_gt_err ( gt , "No forward process on H2G, reset required\n " );
700701 xe_guc_ct_print (ct , & p , true);
701702 ct -> ctbs .h2g .info .broken = true;
702703
@@ -776,7 +777,7 @@ static bool retry_failure(struct xe_guc_ct *ct, int ret)
776777static int guc_ct_send_recv (struct xe_guc_ct * ct , const u32 * action , u32 len ,
777778 u32 * response_buffer , bool no_fail )
778779{
779- struct xe_device * xe = ct_to_xe (ct );
780+ struct xe_gt * gt = ct_to_gt (ct );
780781 struct g2h_fence g2h_fence ;
781782 int ret = 0 ;
782783
@@ -818,20 +819,20 @@ static int guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
818819
819820 ret = wait_event_timeout (ct -> g2h_fence_wq , g2h_fence .done , HZ );
820821 if (!ret ) {
821- drm_err ( & xe -> drm , "Timed out wait for G2H, fence %u, action %04x" ,
822- g2h_fence .seqno , action [0 ]);
822+ xe_gt_err ( gt , "Timed out wait for G2H, fence %u, action %04x" ,
823+ g2h_fence .seqno , action [0 ]);
823824 xa_erase_irq (& ct -> fence_lookup , g2h_fence .seqno );
824825 return - ETIME ;
825826 }
826827
827828 if (g2h_fence .retry ) {
828- drm_warn ( & xe -> drm , "Send retry, action 0x%04x, reason %d " ,
829- action [0 ], g2h_fence .reason );
829+ xe_gt_warn ( gt , "H2G retry, action 0x%04x, reason %u " ,
830+ action [0 ], g2h_fence .reason );
830831 goto retry ;
831832 }
832833 if (g2h_fence .fail ) {
833- drm_err ( & xe -> drm , "Send failed, action 0x%04x, error %d, hint %d " ,
834- action [0 ], g2h_fence .error , g2h_fence .hint );
834+ xe_gt_err ( gt , "H2G send failed, action 0x%04x, error %d, hint %u " ,
835+ action [0 ], g2h_fence .error , g2h_fence .hint );
835836 ret = - EIO ;
836837 }
837838
@@ -966,7 +967,7 @@ static int parse_g2h_response(struct xe_guc_ct *ct, u32 *msg, u32 len)
966967
967968static int parse_g2h_msg (struct xe_guc_ct * ct , u32 * msg , u32 len )
968969{
969- struct xe_device * xe = ct_to_xe (ct );
970+ struct xe_gt * gt = ct_to_gt (ct );
970971 u32 * hxg = msg_to_hxg (msg );
971972 u32 origin , type ;
972973 int ret ;
@@ -975,9 +976,8 @@ static int parse_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)
975976
976977 origin = FIELD_GET (GUC_HXG_MSG_0_ORIGIN , hxg [0 ]);
977978 if (unlikely (origin != GUC_HXG_ORIGIN_GUC )) {
978- drm_err (& xe -> drm ,
979- "G2H channel broken on read, origin=%d, reset required\n" ,
980- origin );
979+ xe_gt_err (gt , "G2H channel broken on read, origin=%u, reset required\n" ,
980+ origin );
981981 ct -> ctbs .g2h .info .broken = true;
982982
983983 return - EPROTO ;
@@ -994,9 +994,8 @@ static int parse_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)
994994 ret = parse_g2h_response (ct , msg , len );
995995 break ;
996996 default :
997- drm_err (& xe -> drm ,
998- "G2H channel broken on read, type=%d, reset required\n" ,
999- type );
997+ xe_gt_err (gt , "G2H channel broken on read, type=%u, reset required\n" ,
998+ type );
1000999 ct -> ctbs .g2h .info .broken = true;
10011000
10021001 ret = - EOPNOTSUPP ;
@@ -1007,7 +1006,6 @@ static int parse_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)
10071006
10081007static int process_g2h_msg (struct xe_guc_ct * ct , u32 * msg , u32 len )
10091008{
1010- struct xe_device * xe = ct_to_xe (ct );
10111009 struct xe_guc * guc = ct_to_guc (ct );
10121010 struct xe_gt * gt = ct_to_gt (ct );
10131011 u32 hxg_len = msg_len_to_hxg_len (len );
@@ -1069,19 +1067,20 @@ static int process_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)
10691067 ret = xe_gt_sriov_pf_control_process_guc2pf (gt , hxg , hxg_len );
10701068 break ;
10711069 default :
1072- drm_err ( & xe -> drm , "unexpected action 0x%04x\n" , action );
1070+ xe_gt_err ( gt , "unexpected G2H action 0x%04x\n" , action );
10731071 }
10741072
10751073 if (ret )
1076- drm_err ( & xe -> drm , "action 0x%04x failed processing, ret=%d \n" ,
1077- action , ret );
1074+ xe_gt_err ( gt , "G2H action 0x%04x failed (%pe) \n" ,
1075+ action , ERR_PTR ( ret ) );
10781076
10791077 return 0 ;
10801078}
10811079
10821080static int g2h_read (struct xe_guc_ct * ct , u32 * msg , bool fast_path )
10831081{
10841082 struct xe_device * xe = ct_to_xe (ct );
1083+ struct xe_gt * gt = ct_to_gt (ct );
10851084 struct guc_ctb * g2h = & ct -> ctbs .g2h ;
10861085 u32 tail , head , len ;
10871086 s32 avail ;
@@ -1116,9 +1115,8 @@ static int g2h_read(struct xe_guc_ct *ct, u32 *msg, bool fast_path)
11161115 sizeof (u32 ));
11171116 len = FIELD_GET (GUC_CTB_MSG_0_NUM_DWORDS , msg [0 ]) + GUC_CTB_MSG_MIN_LEN ;
11181117 if (len > avail ) {
1119- drm_err (& xe -> drm ,
1120- "G2H channel broken on read, avail=%d, len=%d, reset required\n" ,
1121- avail , len );
1118+ xe_gt_err (gt , "G2H channel broken on read, avail=%d, len=%d, reset required\n" ,
1119+ avail , len );
11221120 g2h -> info .broken = true;
11231121
11241122 return - EPROTO ;
@@ -1171,7 +1169,7 @@ static int g2h_read(struct xe_guc_ct *ct, u32 *msg, bool fast_path)
11711169
11721170static void g2h_fast_path (struct xe_guc_ct * ct , u32 * msg , u32 len )
11731171{
1174- struct xe_device * xe = ct_to_xe (ct );
1172+ struct xe_gt * gt = ct_to_gt (ct );
11751173 struct xe_guc * guc = ct_to_guc (ct );
11761174 u32 hxg_len = msg_len_to_hxg_len (len );
11771175 u32 * hxg = msg_to_hxg (msg );
@@ -1190,12 +1188,12 @@ static void g2h_fast_path(struct xe_guc_ct *ct, u32 *msg, u32 len)
11901188 adj_len );
11911189 break ;
11921190 default :
1193- drm_warn ( & xe -> drm , "NOT_POSSIBLE" );
1191+ xe_gt_warn ( gt , "NOT_POSSIBLE" );
11941192 }
11951193
11961194 if (ret )
1197- drm_err ( & xe -> drm , "action 0x%04x failed processing, ret=%d \n" ,
1198- action , ret );
1195+ xe_gt_err ( gt , "G2H action 0x%04x failed (%pe) \n" ,
1196+ action , ERR_PTR ( ret ) );
11991197}
12001198
12011199/**
@@ -1256,6 +1254,7 @@ static int dequeue_one_g2h(struct xe_guc_ct *ct)
12561254static void g2h_worker_func (struct work_struct * w )
12571255{
12581256 struct xe_guc_ct * ct = container_of (w , struct xe_guc_ct , g2h_worker );
1257+ struct xe_gt * gt = ct_to_gt (ct );
12591258 bool ongoing ;
12601259 int ret ;
12611260
@@ -1292,8 +1291,7 @@ static void g2h_worker_func(struct work_struct *w)
12921291 mutex_unlock (& ct -> lock );
12931292
12941293 if (unlikely (ret == - EPROTO || ret == - EOPNOTSUPP )) {
1295- struct drm_device * drm = & ct_to_xe (ct )-> drm ;
1296- struct drm_printer p = drm_info_printer (drm -> dev );
1294+ struct drm_printer p = xe_gt_info_printer (gt );
12971295
12981296 xe_guc_ct_print (ct , & p , false);
12991297 kick_reset (ct );
0 commit comments