66#include <linux/string_helpers.h>
77
88#include "gt/intel_gt.h"
9+ #include "gt/intel_gt_print.h"
910#include "gt/intel_reset.h"
1011#include "intel_gsc_fw.h"
1112#include "intel_gsc_uc.h"
1213#include "intel_guc.h"
1314#include "intel_guc_ads.h"
15+ #include "intel_guc_print.h"
1416#include "intel_guc_submission.h"
1517#include "gt/intel_rps.h"
1618#include "intel_uc.h"
@@ -67,14 +69,14 @@ static int __intel_uc_reset_hw(struct intel_uc *uc)
6769
6870 ret = intel_reset_guc (gt );
6971 if (ret ) {
70- DRM_ERROR ( "Failed to reset GuC, ret = %d\n" , ret );
72+ gt_err ( gt , "Failed to reset GuC, ret = %d\n" , ret );
7173 return ret ;
7274 }
7375
7476 guc_status = intel_uncore_read (gt -> uncore , GUC_STATUS );
75- WARN ( !(guc_status & GS_MIA_IN_RESET ),
76- "GuC status: 0x%x, MIA core expected to be in reset\n" ,
77- guc_status );
77+ gt_WARN ( gt , !(guc_status & GS_MIA_IN_RESET ),
78+ "GuC status: 0x%x, MIA core expected to be in reset\n" ,
79+ guc_status );
7880
7981 return ret ;
8082}
@@ -252,15 +254,13 @@ static int guc_enable_communication(struct intel_guc *guc)
252254 intel_guc_ct_event_handler (& guc -> ct );
253255 spin_unlock_irq (gt -> irq_lock );
254256
255- drm_dbg ( & i915 -> drm , "GuC communication enabled\n" );
257+ guc_dbg ( guc , "communication enabled\n" );
256258
257259 return 0 ;
258260}
259261
260262static void guc_disable_communication (struct intel_guc * guc )
261263{
262- struct drm_i915_private * i915 = guc_to_gt (guc )-> i915 ;
263-
264264 /*
265265 * Events generated during or after CT disable are logged by guc in
266266 * via mmio. Make sure the register is clear before disabling CT since
@@ -280,11 +280,12 @@ static void guc_disable_communication(struct intel_guc *guc)
280280 */
281281 guc_get_mmio_msg (guc );
282282
283- drm_dbg ( & i915 -> drm , "GuC communication disabled\n" );
283+ guc_dbg ( guc , "communication disabled\n" );
284284}
285285
286286static void __uc_fetch_firmwares (struct intel_uc * uc )
287287{
288+ struct intel_gt * gt = uc_to_gt (uc );
288289 int err ;
289290
290291 GEM_BUG_ON (!intel_uc_wants_guc (uc ));
@@ -293,15 +294,13 @@ static void __uc_fetch_firmwares(struct intel_uc *uc)
293294 if (err ) {
294295 /* Make sure we transition out of transient "SELECTED" state */
295296 if (intel_uc_wants_huc (uc )) {
296- drm_dbg (& uc_to_gt (uc )-> i915 -> drm ,
297- "Failed to fetch GuC: %d disabling HuC\n" , err );
297+ gt_dbg (gt , "Failed to fetch GuC fw (%pe) disabling HuC\n" , ERR_PTR (err ));
298298 intel_uc_fw_change_status (& uc -> huc .fw ,
299299 INTEL_UC_FIRMWARE_ERROR );
300300 }
301301
302302 if (intel_uc_wants_gsc_uc (uc )) {
303- drm_dbg (& uc_to_gt (uc )-> i915 -> drm ,
304- "Failed to fetch GuC: %d disabling GSC\n" , err );
303+ gt_dbg (gt , "Failed to fetch GuC fw (%pe) disabling GSC\n" , ERR_PTR (err ));
305304 intel_uc_fw_change_status (& uc -> gsc .fw ,
306305 INTEL_UC_FIRMWARE_ERROR );
307306 }
@@ -382,7 +381,7 @@ static int uc_init_wopcm(struct intel_uc *uc)
382381 int err ;
383382
384383 if (unlikely (!base || !size )) {
385- i915_probe_error (gt -> i915 , "Unsuccessful WOPCM partitioning\n" );
384+ gt_probe_error (gt , "Unsuccessful WOPCM partitioning\n" );
386385 return - E2BIG ;
387386 }
388387
@@ -413,13 +412,13 @@ static int uc_init_wopcm(struct intel_uc *uc)
413412 return 0 ;
414413
415414err_out :
416- i915_probe_error (gt -> i915 , "Failed to init uC WOPCM registers!\n" );
417- i915_probe_error (gt -> i915 , "%s(%#x)=%#x\n" , "DMA_GUC_WOPCM_OFFSET" ,
418- i915_mmio_reg_offset (DMA_GUC_WOPCM_OFFSET ),
419- intel_uncore_read (uncore , DMA_GUC_WOPCM_OFFSET ));
420- i915_probe_error (gt -> i915 , "%s(%#x)=%#x\n" , "GUC_WOPCM_SIZE" ,
421- i915_mmio_reg_offset (GUC_WOPCM_SIZE ),
422- intel_uncore_read (uncore , GUC_WOPCM_SIZE ));
415+ gt_probe_error (gt , "Failed to init uC WOPCM registers!\n" );
416+ gt_probe_error (gt , "%s(%#x)=%#x\n" , "DMA_GUC_WOPCM_OFFSET" ,
417+ i915_mmio_reg_offset (DMA_GUC_WOPCM_OFFSET ),
418+ intel_uncore_read (uncore , DMA_GUC_WOPCM_OFFSET ));
419+ gt_probe_error (gt , "%s(%#x)=%#x\n" , "GUC_WOPCM_SIZE" ,
420+ i915_mmio_reg_offset (GUC_WOPCM_SIZE ),
421+ intel_uncore_read (uncore , GUC_WOPCM_SIZE ));
423422
424423 return err ;
425424}
@@ -449,31 +448,30 @@ static int __uc_check_hw(struct intel_uc *uc)
449448 return 0 ;
450449}
451450
452- static void print_fw_ver (struct intel_uc * uc , struct intel_uc_fw * fw )
451+ static void print_fw_ver (struct intel_gt * gt , struct intel_uc_fw * fw )
453452{
454- struct drm_i915_private * i915 = uc_to_gt (uc )-> i915 ;
455-
456- drm_info (& i915 -> drm , "%s firmware %s version %u.%u.%u\n" ,
457- intel_uc_fw_type_repr (fw -> type ), fw -> file_selected .path ,
458- fw -> file_selected .ver .major ,
459- fw -> file_selected .ver .minor ,
460- fw -> file_selected .ver .patch );
453+ gt_info (gt , "%s firmware %s version %u.%u.%u\n" ,
454+ intel_uc_fw_type_repr (fw -> type ), fw -> file_selected .path ,
455+ fw -> file_selected .ver .major ,
456+ fw -> file_selected .ver .minor ,
457+ fw -> file_selected .ver .patch );
461458}
462459
463460static int __uc_init_hw (struct intel_uc * uc )
464461{
465- struct drm_i915_private * i915 = uc_to_gt (uc )-> i915 ;
462+ struct intel_gt * gt = uc_to_gt (uc );
463+ struct drm_i915_private * i915 = gt -> i915 ;
466464 struct intel_guc * guc = & uc -> guc ;
467465 struct intel_huc * huc = & uc -> huc ;
468466 int ret , attempts ;
469467
470468 GEM_BUG_ON (!intel_uc_supports_guc (uc ));
471469 GEM_BUG_ON (!intel_uc_wants_guc (uc ));
472470
473- print_fw_ver (uc , & guc -> fw );
471+ print_fw_ver (gt , & guc -> fw );
474472
475473 if (intel_uc_uses_huc (uc ))
476- print_fw_ver (uc , & huc -> fw );
474+ print_fw_ver (gt , & huc -> fw );
477475
478476 if (!intel_uc_fw_is_loadable (& guc -> fw )) {
479477 ret = __uc_check_hw (uc ) ||
@@ -514,8 +512,8 @@ static int __uc_init_hw(struct intel_uc *uc)
514512 if (ret == 0 )
515513 break ;
516514
517- DRM_DEBUG_DRIVER ( "GuC fw load failed: %d; will reset and "
518- "retry %d more time(s)\n" , ret , attempts );
515+ gt_dbg ( gt , "GuC fw load failed (%pe) will reset and retry %d more time(s)\n" ,
516+ ERR_PTR ( ret ) , attempts );
519517 }
520518
521519 /* Did we succeded or run out of retries? */
@@ -551,10 +549,10 @@ static int __uc_init_hw(struct intel_uc *uc)
551549
552550 intel_gsc_uc_load_start (& uc -> gsc );
553551
554- drm_info ( & i915 -> drm , "GuC submission %s\n" ,
555- str_enabled_disabled (intel_uc_uses_guc_submission (uc )));
556- drm_info ( & i915 -> drm , "GuC SLPC %s\n" ,
557- str_enabled_disabled (intel_uc_uses_guc_slpc (uc )));
552+ gt_info ( gt , "GuC submission %s\n" ,
553+ str_enabled_disabled (intel_uc_uses_guc_submission (uc )));
554+ gt_info ( gt , "GuC SLPC %s\n" ,
555+ str_enabled_disabled (intel_uc_uses_guc_slpc (uc )));
558556
559557 return 0 ;
560558
@@ -572,12 +570,12 @@ static int __uc_init_hw(struct intel_uc *uc)
572570 __uc_sanitize (uc );
573571
574572 if (!ret ) {
575- drm_notice ( & i915 -> drm , "GuC is uninitialized\n" );
573+ gt_notice ( gt , "GuC is uninitialized\n" );
576574 /* We want to run without GuC submission */
577575 return 0 ;
578576 }
579577
580- i915_probe_error ( i915 , "GuC initialization failed %d \n" , ret );
578+ gt_probe_error ( gt , "GuC initialization failed %pe \n" , ERR_PTR ( ret ) );
581579
582580 /* We want to keep KMS alive */
583581 return - EIO ;
@@ -690,7 +688,7 @@ void intel_uc_suspend(struct intel_uc *uc)
690688 with_intel_runtime_pm (& uc_to_gt (uc )-> i915 -> runtime_pm , wakeref ) {
691689 err = intel_guc_suspend (guc );
692690 if (err )
693- DRM_DEBUG_DRIVER ( "Failed to suspend GuC, err=%d " , err );
691+ guc_dbg ( guc , "Failed to suspend, %pe " , ERR_PTR ( err ) );
694692 }
695693}
696694
@@ -718,7 +716,7 @@ static int __uc_resume(struct intel_uc *uc, bool enable_communication)
718716
719717 err = intel_guc_resume (guc );
720718 if (err ) {
721- DRM_DEBUG_DRIVER ( "Failed to resume GuC, err=%d " , err );
719+ guc_dbg ( guc , "Failed to resume, %pe " , ERR_PTR ( err ) );
722720 return err ;
723721 }
724722
0 commit comments