@@ -144,7 +144,7 @@ int xe_guc_ct_init(struct xe_guc_ct *ct)
144144 struct xe_bo * bo ;
145145 int err ;
146146
147- xe_assert ( xe , !(guc_ct_size () % PAGE_SIZE ));
147+ xe_gt_assert ( gt , !(guc_ct_size () % PAGE_SIZE ));
148148
149149 spin_lock_init (& ct -> fast_lock );
150150 xa_init (& ct -> fence_lookup );
@@ -171,7 +171,7 @@ int xe_guc_ct_init(struct xe_guc_ct *ct)
171171 if (err )
172172 return err ;
173173
174- xe_assert ( xe , ct -> state == XE_GUC_CT_STATE_NOT_INITIALIZED );
174+ xe_gt_assert ( gt , ct -> state == XE_GUC_CT_STATE_NOT_INITIALIZED );
175175 ct -> state = XE_GUC_CT_STATE_DISABLED ;
176176 return 0 ;
177177}
@@ -321,7 +321,7 @@ int xe_guc_ct_enable(struct xe_guc_ct *ct)
321321 struct xe_gt * gt = ct_to_gt (ct );
322322 int err ;
323323
324- xe_assert ( xe , !xe_guc_ct_enabled (ct ));
324+ xe_gt_assert ( gt , !xe_guc_ct_enabled (ct ));
325325
326326 guc_ct_ctb_h2g_init (xe , & ct -> ctbs .h2g , & ct -> bo -> vmap );
327327 guc_ct_ctb_g2h_init (xe , & ct -> ctbs .g2h , & ct -> bo -> vmap );
@@ -428,7 +428,7 @@ static void h2g_reserve_space(struct xe_guc_ct *ct, u32 cmd_len)
428428
429429static void __g2h_reserve_space (struct xe_guc_ct * ct , u32 g2h_len , u32 num_g2h )
430430{
431- xe_assert ( ct_to_xe (ct ), g2h_len <= ct -> ctbs .g2h .info .space );
431+ xe_gt_assert ( ct_to_gt (ct ), g2h_len <= ct -> ctbs .g2h .info .space );
432432
433433 if (g2h_len ) {
434434 lockdep_assert_held (& ct -> fast_lock );
@@ -441,8 +441,8 @@ static void __g2h_reserve_space(struct xe_guc_ct *ct, u32 g2h_len, u32 num_g2h)
441441static void __g2h_release_space (struct xe_guc_ct * ct , u32 g2h_len )
442442{
443443 lockdep_assert_held (& ct -> fast_lock );
444- xe_assert ( ct_to_xe (ct ), ct -> ctbs .g2h .info .space + g2h_len <=
445- ct -> ctbs .g2h .info .size - ct -> ctbs .g2h .info .resv_space );
444+ xe_gt_assert ( ct_to_gt (ct ), ct -> ctbs .g2h .info .space + g2h_len <=
445+ ct -> ctbs .g2h .info .size - ct -> ctbs .g2h .info .resv_space );
446446
447447 ct -> ctbs .g2h .info .space += g2h_len ;
448448 -- ct -> g2h_outstanding ;
@@ -461,6 +461,7 @@ static int h2g_write(struct xe_guc_ct *ct, const u32 *action, u32 len,
461461 u32 ct_fence_value , bool want_response )
462462{
463463 struct xe_device * xe = ct_to_xe (ct );
464+ struct xe_gt * gt = ct_to_gt (ct );
464465 struct guc_ctb * h2g = & ct -> ctbs .h2g ;
465466 u32 cmd [H2G_CT_HEADERS ];
466467 u32 tail = h2g -> info .tail ;
@@ -471,8 +472,8 @@ static int h2g_write(struct xe_guc_ct *ct, const u32 *action, u32 len,
471472 full_len = len + GUC_CTB_HDR_LEN ;
472473
473474 lockdep_assert_held (& ct -> lock );
474- xe_assert ( xe , full_len <= GUC_CTB_MSG_MAX_LEN );
475- xe_assert ( xe , tail <= h2g -> info .size );
475+ xe_gt_assert ( gt , full_len <= GUC_CTB_MSG_MAX_LEN );
476+ xe_gt_assert ( gt , tail <= h2g -> info .size );
476477
477478 /* Command will wrap, zero fill (NOPs), return and check credits again */
478479 if (tail + full_len > h2g -> info .size ) {
@@ -521,7 +522,7 @@ static int h2g_write(struct xe_guc_ct *ct, const u32 *action, u32 len,
521522 /* Update descriptor */
522523 desc_write (xe , h2g , tail , h2g -> info .tail );
523524
524- trace_xe_guc_ctb_h2g (ct_to_gt ( ct ) -> info .id , * (action - 1 ), full_len ,
525+ trace_xe_guc_ctb_h2g (gt -> info .id , * (action - 1 ), full_len ,
525526 desc_read (xe , h2g , head ), h2g -> info .tail );
526527
527528 return 0 ;
@@ -550,15 +551,15 @@ static int __guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action,
550551 u32 len , u32 g2h_len , u32 num_g2h ,
551552 struct g2h_fence * g2h_fence )
552553{
553- struct xe_device * xe = ct_to_xe (ct );
554+ struct xe_gt * gt __maybe_unused = ct_to_gt (ct );
554555 u16 seqno ;
555556 int ret ;
556557
557- xe_assert ( xe , ct -> state != XE_GUC_CT_STATE_NOT_INITIALIZED );
558- xe_assert ( xe , !g2h_len || !g2h_fence );
559- xe_assert ( xe , !num_g2h || !g2h_fence );
560- xe_assert ( xe , !g2h_len || num_g2h );
561- xe_assert ( xe , g2h_len || !num_g2h );
558+ xe_gt_assert ( gt , ct -> state != XE_GUC_CT_STATE_NOT_INITIALIZED );
559+ xe_gt_assert ( gt , !g2h_len || !g2h_fence );
560+ xe_gt_assert ( gt , !num_g2h || !g2h_fence );
561+ xe_gt_assert ( gt , !g2h_len || num_g2h );
562+ xe_gt_assert ( gt , g2h_len || !num_g2h );
562563 lockdep_assert_held (& ct -> lock );
563564
564565 if (unlikely (ct -> ctbs .h2g .info .broken )) {
@@ -576,7 +577,7 @@ static int __guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action,
576577 goto out ;
577578 }
578579
579- xe_assert ( xe , xe_guc_ct_enabled (ct ));
580+ xe_gt_assert ( gt , xe_guc_ct_enabled (ct ));
580581
581582 if (g2h_fence ) {
582583 g2h_len = GUC_CTB_HXG_MSG_MAX_LEN ;
@@ -639,7 +640,7 @@ static int guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action, u32 len,
639640 unsigned int sleep_period_ms = 1 ;
640641 int ret ;
641642
642- xe_assert ( ct_to_xe ( ct ) , !g2h_len || !g2h_fence );
643+ xe_gt_assert ( gt , !g2h_len || !g2h_fence );
643644 lockdep_assert_held (& ct -> lock );
644645 xe_device_assert_mem_access (ct_to_xe (ct ));
645646
@@ -709,7 +710,7 @@ static int guc_ct_send(struct xe_guc_ct *ct, const u32 *action, u32 len,
709710{
710711 int ret ;
711712
712- xe_assert ( ct_to_xe (ct ), !g2h_len || !g2h_fence );
713+ xe_gt_assert ( ct_to_gt (ct ), !g2h_len || !g2h_fence );
713714
714715 mutex_lock (& ct -> lock );
715716 ret = guc_ct_send_locked (ct , action , len , g2h_len , num_g2h , g2h_fence );
@@ -901,7 +902,6 @@ static int parse_g2h_event(struct xe_guc_ct *ct, u32 *msg, u32 len)
901902static int parse_g2h_response (struct xe_guc_ct * ct , u32 * msg , u32 len )
902903{
903904 struct xe_gt * gt = ct_to_gt (ct );
904- struct xe_device * xe = gt_to_xe (gt );
905905 u32 * hxg = msg_to_hxg (msg );
906906 u32 hxg_len = msg_len_to_hxg_len (len );
907907 u32 fence = FIELD_GET (GUC_CTB_MSG_0_FENCE , msg [0 ]);
@@ -939,7 +939,7 @@ static int parse_g2h_response(struct xe_guc_ct *ct, u32 *msg, u32 len)
939939 return 0 ;
940940 }
941941
942- xe_assert ( xe , fence == g2h_fence -> seqno );
942+ xe_gt_assert ( gt , fence == g2h_fence -> seqno );
943943
944944 if (type == GUC_HXG_TYPE_RESPONSE_FAILURE ) {
945945 g2h_fence -> fail = true;
@@ -1087,7 +1087,7 @@ static int g2h_read(struct xe_guc_ct *ct, u32 *msg, bool fast_path)
10871087 u32 action ;
10881088 u32 * hxg ;
10891089
1090- xe_assert ( xe , ct -> state != XE_GUC_CT_STATE_NOT_INITIALIZED );
1090+ xe_gt_assert ( gt , ct -> state != XE_GUC_CT_STATE_NOT_INITIALIZED );
10911091 lockdep_assert_held (& ct -> fast_lock );
10921092
10931093 if (ct -> state == XE_GUC_CT_STATE_DISABLED )
@@ -1099,7 +1099,7 @@ static int g2h_read(struct xe_guc_ct *ct, u32 *msg, bool fast_path)
10991099 if (g2h -> info .broken )
11001100 return - EPIPE ;
11011101
1102- xe_assert ( xe , xe_guc_ct_enabled (ct ));
1102+ xe_gt_assert ( gt , xe_guc_ct_enabled (ct ));
11031103
11041104 /* Calculate DW available to read */
11051105 tail = desc_read (xe , g2h , tail );
0 commit comments