1 // SPDX-License-Identifier: MIT 2 /* 3 * Copyright © 2016-2019 Intel Corporation 4 */ 5 6 #include <linux/types.h> 7 8 #include "gt/intel_gt.h" 9 #include "intel_guc_reg.h" 10 #include "intel_huc.h" 11 #include "intel_huc_print.h" 12 #include "i915_drv.h" 13 #include "i915_reg.h" 14 #include "pxp/intel_pxp_cmd_interface_43.h" 15 16 #include <linux/device/bus.h> 17 #include <linux/mei_aux.h> 18 19 /** 20 * DOC: HuC 21 * 22 * The HuC is a dedicated microcontroller for usage in media HEVC (High 23 * Efficiency Video Coding) operations. Userspace can directly use the firmware 24 * capabilities by adding HuC specific commands to batch buffers. 25 * 26 * The kernel driver is only responsible for loading the HuC firmware and 27 * triggering its security authentication. This is done differently depending 28 * on the platform: 29 * - older platforms (from Gen9 to most Gen12s): the load is performed via DMA 30 * and the authentication via GuC 31 * - DG2: load and authentication are both performed via GSC. 32 * - MTL and newer platforms: the load is performed via DMA (same as with 33 * not-DG2 older platforms), while the authentication is done in 2-steps, 34 * a first auth for clear-media workloads via GuC and a second one for all 35 * workloads via GSC. 36 * On platforms where the GuC does the authentication, to correctly do so the 37 * HuC binary must be loaded before the GuC one. 38 * Loading the HuC is optional; however, not using the HuC might negatively 39 * impact power usage and/or performance of media workloads, depending on the 40 * use-cases. 41 * HuC must be reloaded on events that cause the WOPCM to lose its contents 42 * (S3/S4, FLR); on older platforms the HuC must also be reloaded on GuC/GT 43 * reset, while on newer ones it will survive that. 44 * 45 * See https://github.com/intel/media-driver for the latest details on HuC 46 * functionality. 47 */ 48 49 /** 50 * DOC: HuC Memory Management 51 * 52 * Similarly to the GuC, the HuC can't do any memory allocations on its own, 53 * with the difference being that the allocations for HuC usage are handled by 54 * the userspace driver instead of the kernel one. The HuC accesses the memory 55 * via the PPGTT belonging to the context loaded on the VCS executing the 56 * HuC-specific commands. 57 */ 58 59 /* 60 * MEI-GSC load is an async process. The probing of the exposed aux device 61 * (see intel_gsc.c) usually happens a few seconds after i915 probe, depending 62 * on when the kernel schedules it. Unless something goes terribly wrong, we're 63 * guaranteed for this to happen during boot, so the big timeout is a safety net 64 * that we never expect to need. 65 * MEI-PXP + HuC load usually takes ~300ms, but if the GSC needs to be resumed 66 * and/or reset, this can take longer. Note that the kernel might schedule 67 * other work between the i915 init/resume and the MEI one, which can add to 68 * the delay. 69 */ 70 #define GSC_INIT_TIMEOUT_MS 10000 71 #define PXP_INIT_TIMEOUT_MS 5000 72 73 static int sw_fence_dummy_notify(struct i915_sw_fence *sf, 74 enum i915_sw_fence_notify state) 75 { 76 return NOTIFY_DONE; 77 } 78 79 static void __delayed_huc_load_complete(struct intel_huc *huc) 80 { 81 if (!i915_sw_fence_done(&huc->delayed_load.fence)) 82 i915_sw_fence_complete(&huc->delayed_load.fence); 83 } 84 85 static void delayed_huc_load_complete(struct intel_huc *huc) 86 { 87 hrtimer_cancel(&huc->delayed_load.timer); 88 __delayed_huc_load_complete(huc); 89 } 90 91 static void __gsc_init_error(struct intel_huc *huc) 92 { 93 huc->delayed_load.status = INTEL_HUC_DELAYED_LOAD_ERROR; 94 __delayed_huc_load_complete(huc); 95 } 96 97 static void gsc_init_error(struct intel_huc *huc) 98 { 99 hrtimer_cancel(&huc->delayed_load.timer); 100 __gsc_init_error(huc); 101 } 102 103 static void gsc_init_done(struct intel_huc *huc) 104 { 105 hrtimer_cancel(&huc->delayed_load.timer); 106 107 /* MEI-GSC init is done, now we wait for MEI-PXP to bind */ 108 huc->delayed_load.status = INTEL_HUC_WAITING_ON_PXP; 109 if (!i915_sw_fence_done(&huc->delayed_load.fence)) 110 hrtimer_start(&huc->delayed_load.timer, 111 ms_to_ktime(PXP_INIT_TIMEOUT_MS), 112 HRTIMER_MODE_REL); 113 } 114 115 static enum hrtimer_restart huc_delayed_load_timer_callback(struct hrtimer *hrtimer) 116 { 117 struct intel_huc *huc = container_of(hrtimer, struct intel_huc, delayed_load.timer); 118 119 if (!intel_huc_is_authenticated(huc, INTEL_HUC_AUTH_BY_GSC)) { 120 if (huc->delayed_load.status == INTEL_HUC_WAITING_ON_GSC) 121 huc_notice(huc, "timed out waiting for MEI GSC\n"); 122 else if (huc->delayed_load.status == INTEL_HUC_WAITING_ON_PXP) 123 huc_notice(huc, "timed out waiting for MEI PXP\n"); 124 else 125 MISSING_CASE(huc->delayed_load.status); 126 127 __gsc_init_error(huc); 128 } 129 130 return HRTIMER_NORESTART; 131 } 132 133 static void huc_delayed_load_start(struct intel_huc *huc) 134 { 135 ktime_t delay; 136 137 GEM_BUG_ON(intel_huc_is_authenticated(huc, INTEL_HUC_AUTH_BY_GSC)); 138 139 /* 140 * On resume we don't have to wait for MEI-GSC to be re-probed, but we 141 * do need to wait for MEI-PXP to reset & re-bind 142 */ 143 switch (huc->delayed_load.status) { 144 case INTEL_HUC_WAITING_ON_GSC: 145 delay = ms_to_ktime(GSC_INIT_TIMEOUT_MS); 146 break; 147 case INTEL_HUC_WAITING_ON_PXP: 148 delay = ms_to_ktime(PXP_INIT_TIMEOUT_MS); 149 break; 150 default: 151 gsc_init_error(huc); 152 return; 153 } 154 155 /* 156 * This fence is always complete unless we're waiting for the 157 * GSC device to come up to load the HuC. We arm the fence here 158 * and complete it when we confirm that the HuC is loaded from 159 * the PXP bind callback. 160 */ 161 GEM_BUG_ON(!i915_sw_fence_done(&huc->delayed_load.fence)); 162 i915_sw_fence_fini(&huc->delayed_load.fence); 163 i915_sw_fence_reinit(&huc->delayed_load.fence); 164 i915_sw_fence_await(&huc->delayed_load.fence); 165 i915_sw_fence_commit(&huc->delayed_load.fence); 166 167 hrtimer_start(&huc->delayed_load.timer, delay, HRTIMER_MODE_REL); 168 } 169 170 static int gsc_notifier(struct notifier_block *nb, unsigned long action, void *data) 171 { 172 struct device *dev = data; 173 struct intel_huc *huc = container_of(nb, struct intel_huc, delayed_load.nb); 174 struct intel_gsc_intf *intf = &huc_to_gt(huc)->gsc.intf[0]; 175 176 if (!intf->adev || &intf->adev->aux_dev.dev != dev) 177 return 0; 178 179 switch (action) { 180 case BUS_NOTIFY_BOUND_DRIVER: /* mei driver bound to aux device */ 181 gsc_init_done(huc); 182 break; 183 184 case BUS_NOTIFY_DRIVER_NOT_BOUND: /* mei driver fails to be bound */ 185 case BUS_NOTIFY_UNBIND_DRIVER: /* mei driver about to be unbound */ 186 huc_info(huc, "MEI driver not bound, disabling load\n"); 187 gsc_init_error(huc); 188 break; 189 } 190 191 return 0; 192 } 193 194 void intel_huc_register_gsc_notifier(struct intel_huc *huc, const struct bus_type *bus) 195 { 196 int ret; 197 198 if (!intel_huc_is_loaded_by_gsc(huc)) 199 return; 200 201 huc->delayed_load.nb.notifier_call = gsc_notifier; 202 ret = bus_register_notifier(bus, &huc->delayed_load.nb); 203 if (ret) { 204 huc_err(huc, "failed to register GSC notifier %pe\n", ERR_PTR(ret)); 205 huc->delayed_load.nb.notifier_call = NULL; 206 gsc_init_error(huc); 207 } 208 } 209 210 void intel_huc_unregister_gsc_notifier(struct intel_huc *huc, const struct bus_type *bus) 211 { 212 if (!huc->delayed_load.nb.notifier_call) 213 return; 214 215 delayed_huc_load_complete(huc); 216 217 bus_unregister_notifier(bus, &huc->delayed_load.nb); 218 huc->delayed_load.nb.notifier_call = NULL; 219 } 220 221 static void delayed_huc_load_init(struct intel_huc *huc) 222 { 223 /* 224 * Initialize fence to be complete as this is expected to be complete 225 * unless there is a delayed HuC load in progress. 226 */ 227 i915_sw_fence_init(&huc->delayed_load.fence, 228 sw_fence_dummy_notify); 229 i915_sw_fence_commit(&huc->delayed_load.fence); 230 231 hrtimer_init(&huc->delayed_load.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 232 huc->delayed_load.timer.function = huc_delayed_load_timer_callback; 233 } 234 235 static void delayed_huc_load_fini(struct intel_huc *huc) 236 { 237 /* 238 * the fence is initialized in init_early, so we need to clean it up 239 * even if HuC loading is off. 240 */ 241 delayed_huc_load_complete(huc); 242 i915_sw_fence_fini(&huc->delayed_load.fence); 243 } 244 245 int intel_huc_sanitize(struct intel_huc *huc) 246 { 247 delayed_huc_load_complete(huc); 248 intel_uc_fw_sanitize(&huc->fw); 249 return 0; 250 } 251 252 static bool vcs_supported(struct intel_gt *gt) 253 { 254 intel_engine_mask_t mask = gt->info.engine_mask; 255 256 /* 257 * We reach here from i915_driver_early_probe for the primary GT before 258 * its engine mask is set, so we use the device info engine mask for it; 259 * this means we're not taking VCS fusing into account, but if the 260 * primary GT supports VCS engines we expect at least one of them to 261 * remain unfused so we're fine. 262 * For other GTs we expect the GT-specific mask to be set before we 263 * call this function. 264 */ 265 GEM_BUG_ON(!gt_is_root(gt) && !gt->info.engine_mask); 266 267 if (gt_is_root(gt)) 268 mask = RUNTIME_INFO(gt->i915)->platform_engine_mask; 269 else 270 mask = gt->info.engine_mask; 271 272 return __ENGINE_INSTANCES_MASK(mask, VCS0, I915_MAX_VCS); 273 } 274 275 void intel_huc_init_early(struct intel_huc *huc) 276 { 277 struct drm_i915_private *i915 = huc_to_gt(huc)->i915; 278 struct intel_gt *gt = huc_to_gt(huc); 279 280 intel_uc_fw_init_early(&huc->fw, INTEL_UC_FW_TYPE_HUC, true); 281 282 /* 283 * we always init the fence as already completed, even if HuC is not 284 * supported. This way we don't have to distinguish between HuC not 285 * supported/disabled or already loaded, and can focus on if the load 286 * is currently in progress (fence not complete) or not, which is what 287 * we care about for stalling userspace submissions. 288 */ 289 delayed_huc_load_init(huc); 290 291 if (!vcs_supported(gt)) { 292 intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_NOT_SUPPORTED); 293 return; 294 } 295 296 if (GRAPHICS_VER(i915) >= 11) { 297 huc->status[INTEL_HUC_AUTH_BY_GUC].reg = GEN11_HUC_KERNEL_LOAD_INFO; 298 huc->status[INTEL_HUC_AUTH_BY_GUC].mask = HUC_LOAD_SUCCESSFUL; 299 huc->status[INTEL_HUC_AUTH_BY_GUC].value = HUC_LOAD_SUCCESSFUL; 300 } else { 301 huc->status[INTEL_HUC_AUTH_BY_GUC].reg = HUC_STATUS2; 302 huc->status[INTEL_HUC_AUTH_BY_GUC].mask = HUC_FW_VERIFIED; 303 huc->status[INTEL_HUC_AUTH_BY_GUC].value = HUC_FW_VERIFIED; 304 } 305 306 if (IS_DG2(i915)) { 307 huc->status[INTEL_HUC_AUTH_BY_GSC].reg = GEN11_HUC_KERNEL_LOAD_INFO; 308 huc->status[INTEL_HUC_AUTH_BY_GSC].mask = HUC_LOAD_SUCCESSFUL; 309 huc->status[INTEL_HUC_AUTH_BY_GSC].value = HUC_LOAD_SUCCESSFUL; 310 } else { 311 huc->status[INTEL_HUC_AUTH_BY_GSC].reg = HECI_FWSTS5(MTL_GSC_HECI1_BASE); 312 huc->status[INTEL_HUC_AUTH_BY_GSC].mask = HECI_FWSTS5_HUC_AUTH_DONE; 313 huc->status[INTEL_HUC_AUTH_BY_GSC].value = HECI_FWSTS5_HUC_AUTH_DONE; 314 } 315 } 316 317 #define HUC_LOAD_MODE_STRING(x) (x ? "GSC" : "legacy") 318 static int check_huc_loading_mode(struct intel_huc *huc) 319 { 320 struct intel_gt *gt = huc_to_gt(huc); 321 bool gsc_enabled = huc->fw.has_gsc_headers; 322 323 /* 324 * The fuse for HuC load via GSC is only valid on platforms that have 325 * GuC deprivilege. 326 */ 327 if (HAS_GUC_DEPRIVILEGE(gt->i915)) 328 huc->loaded_via_gsc = intel_uncore_read(gt->uncore, GUC_SHIM_CONTROL2) & 329 GSC_LOADS_HUC; 330 331 if (huc->loaded_via_gsc && !gsc_enabled) { 332 huc_err(huc, "HW requires a GSC-enabled blob, but we found a legacy one\n"); 333 return -ENOEXEC; 334 } 335 336 /* 337 * On newer platforms we have GSC-enabled binaries but we load the HuC 338 * via DMA. To do so we need to find the location of the legacy-style 339 * binary inside the GSC-enabled one, which we do at fetch time. Make 340 * sure that we were able to do so if the fuse says we need to load via 341 * DMA and the binary is GSC-enabled. 342 */ 343 if (!huc->loaded_via_gsc && gsc_enabled && !huc->fw.dma_start_offset) { 344 huc_err(huc, "HW in DMA mode, but we have an incompatible GSC-enabled blob\n"); 345 return -ENOEXEC; 346 } 347 348 /* 349 * If the HuC is loaded via GSC, we need to be able to access the GSC. 350 * On DG2 this is done via the mei components, while on newer platforms 351 * it is done via the GSCCS, 352 */ 353 if (huc->loaded_via_gsc) { 354 if (IS_DG2(gt->i915)) { 355 if (!IS_ENABLED(CONFIG_INTEL_MEI_PXP) || 356 !IS_ENABLED(CONFIG_INTEL_MEI_GSC)) { 357 huc_info(huc, "can't load due to missing mei modules\n"); 358 return -EIO; 359 } 360 } else { 361 if (!HAS_ENGINE(gt, GSC0)) { 362 huc_info(huc, "can't load due to missing GSCCS\n"); 363 return -EIO; 364 } 365 } 366 } 367 368 huc_dbg(huc, "loaded by GSC = %s\n", str_yes_no(huc->loaded_via_gsc)); 369 370 return 0; 371 } 372 373 int intel_huc_init(struct intel_huc *huc) 374 { 375 struct intel_gt *gt = huc_to_gt(huc); 376 int err; 377 378 err = check_huc_loading_mode(huc); 379 if (err) 380 goto out; 381 382 if (HAS_ENGINE(gt, GSC0)) { 383 struct i915_vma *vma; 384 385 vma = intel_guc_allocate_vma(>->uc.guc, PXP43_HUC_AUTH_INOUT_SIZE * 2); 386 if (IS_ERR(vma)) { 387 huc_info(huc, "Failed to allocate heci pkt\n"); 388 goto out; 389 } 390 391 huc->heci_pkt = vma; 392 } 393 394 err = intel_uc_fw_init(&huc->fw); 395 if (err) 396 goto out_pkt; 397 398 intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_LOADABLE); 399 400 return 0; 401 402 out_pkt: 403 if (huc->heci_pkt) 404 i915_vma_unpin_and_release(&huc->heci_pkt, 0); 405 out: 406 intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_INIT_FAIL); 407 huc_info(huc, "initialization failed %pe\n", ERR_PTR(err)); 408 return err; 409 } 410 411 void intel_huc_fini(struct intel_huc *huc) 412 { 413 /* 414 * the fence is initialized in init_early, so we need to clean it up 415 * even if HuC loading is off. 416 */ 417 delayed_huc_load_fini(huc); 418 419 if (huc->heci_pkt) 420 i915_vma_unpin_and_release(&huc->heci_pkt, 0); 421 422 if (intel_uc_fw_is_loadable(&huc->fw)) 423 intel_uc_fw_fini(&huc->fw); 424 } 425 426 void intel_huc_suspend(struct intel_huc *huc) 427 { 428 if (!intel_uc_fw_is_loadable(&huc->fw)) 429 return; 430 431 /* 432 * in the unlikely case that we're suspending before the GSC has 433 * completed its loading sequence, just stop waiting. We'll restart 434 * on resume. 435 */ 436 delayed_huc_load_complete(huc); 437 } 438 439 static const char *auth_mode_string(struct intel_huc *huc, 440 enum intel_huc_authentication_type type) 441 { 442 bool partial = huc->fw.has_gsc_headers && type == INTEL_HUC_AUTH_BY_GUC; 443 444 return partial ? "clear media" : "all workloads"; 445 } 446 447 int intel_huc_wait_for_auth_complete(struct intel_huc *huc, 448 enum intel_huc_authentication_type type) 449 { 450 struct intel_gt *gt = huc_to_gt(huc); 451 int ret; 452 453 ret = __intel_wait_for_register(gt->uncore, 454 huc->status[type].reg, 455 huc->status[type].mask, 456 huc->status[type].value, 457 2, 50, NULL); 458 459 /* mark the load process as complete even if the wait failed */ 460 delayed_huc_load_complete(huc); 461 462 if (ret) { 463 huc_err(huc, "firmware not verified for %s: %pe\n", 464 auth_mode_string(huc, type), ERR_PTR(ret)); 465 intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_LOAD_FAIL); 466 return ret; 467 } 468 469 intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_RUNNING); 470 huc_info(huc, "authenticated for %s\n", auth_mode_string(huc, type)); 471 return 0; 472 } 473 474 /** 475 * intel_huc_auth() - Authenticate HuC uCode 476 * @huc: intel_huc structure 477 * @type: authentication type (via GuC or via GSC) 478 * 479 * Called after HuC and GuC firmware loading during intel_uc_init_hw(). 480 * 481 * This function invokes the GuC action to authenticate the HuC firmware, 482 * passing the offset of the RSA signature to intel_guc_auth_huc(). It then 483 * waits for up to 50ms for firmware verification ACK. 484 */ 485 int intel_huc_auth(struct intel_huc *huc, enum intel_huc_authentication_type type) 486 { 487 struct intel_gt *gt = huc_to_gt(huc); 488 struct intel_guc *guc = >->uc.guc; 489 int ret; 490 491 if (!intel_uc_fw_is_loaded(&huc->fw)) 492 return -ENOEXEC; 493 494 /* GSC will do the auth with the load */ 495 if (intel_huc_is_loaded_by_gsc(huc)) 496 return -ENODEV; 497 498 if (intel_huc_is_authenticated(huc, type)) 499 return -EEXIST; 500 501 ret = i915_inject_probe_error(gt->i915, -ENXIO); 502 if (ret) 503 goto fail; 504 505 switch (type) { 506 case INTEL_HUC_AUTH_BY_GUC: 507 ret = intel_guc_auth_huc(guc, intel_guc_ggtt_offset(guc, huc->fw.rsa_data)); 508 break; 509 case INTEL_HUC_AUTH_BY_GSC: 510 ret = intel_huc_fw_auth_via_gsccs(huc); 511 break; 512 default: 513 MISSING_CASE(type); 514 ret = -EINVAL; 515 } 516 if (ret) 517 goto fail; 518 519 /* Check authentication status, it should be done by now */ 520 ret = intel_huc_wait_for_auth_complete(huc, type); 521 if (ret) 522 goto fail; 523 524 return 0; 525 526 fail: 527 huc_probe_error(huc, "%s authentication failed %pe\n", 528 auth_mode_string(huc, type), ERR_PTR(ret)); 529 return ret; 530 } 531 532 bool intel_huc_is_authenticated(struct intel_huc *huc, 533 enum intel_huc_authentication_type type) 534 { 535 struct intel_gt *gt = huc_to_gt(huc); 536 intel_wakeref_t wakeref; 537 u32 status = 0; 538 539 with_intel_runtime_pm(gt->uncore->rpm, wakeref) 540 status = intel_uncore_read(gt->uncore, huc->status[type].reg); 541 542 return (status & huc->status[type].mask) == huc->status[type].value; 543 } 544 545 static bool huc_is_fully_authenticated(struct intel_huc *huc) 546 { 547 struct intel_uc_fw *huc_fw = &huc->fw; 548 549 if (!huc_fw->has_gsc_headers) 550 return intel_huc_is_authenticated(huc, INTEL_HUC_AUTH_BY_GUC); 551 else if (intel_huc_is_loaded_by_gsc(huc) || HAS_ENGINE(huc_to_gt(huc), GSC0)) 552 return intel_huc_is_authenticated(huc, INTEL_HUC_AUTH_BY_GSC); 553 else 554 return false; 555 } 556 557 /** 558 * intel_huc_check_status() - check HuC status 559 * @huc: intel_huc structure 560 * 561 * This function reads status register to verify if HuC 562 * firmware was successfully loaded. 563 * 564 * The return values match what is expected for the I915_PARAM_HUC_STATUS 565 * getparam. 566 */ 567 int intel_huc_check_status(struct intel_huc *huc) 568 { 569 struct intel_uc_fw *huc_fw = &huc->fw; 570 571 switch (__intel_uc_fw_status(huc_fw)) { 572 case INTEL_UC_FIRMWARE_NOT_SUPPORTED: 573 return -ENODEV; 574 case INTEL_UC_FIRMWARE_DISABLED: 575 return -EOPNOTSUPP; 576 case INTEL_UC_FIRMWARE_MISSING: 577 return -ENOPKG; 578 case INTEL_UC_FIRMWARE_ERROR: 579 return -ENOEXEC; 580 case INTEL_UC_FIRMWARE_INIT_FAIL: 581 return -ENOMEM; 582 case INTEL_UC_FIRMWARE_LOAD_FAIL: 583 return -EIO; 584 default: 585 break; 586 } 587 588 /* 589 * GSC-enabled binaries loaded via DMA are first partially 590 * authenticated by GuC and then fully authenticated by GSC 591 */ 592 if (huc_is_fully_authenticated(huc)) 593 return 1; /* full auth */ 594 else if (huc_fw->has_gsc_headers && !intel_huc_is_loaded_by_gsc(huc) && 595 intel_huc_is_authenticated(huc, INTEL_HUC_AUTH_BY_GUC)) 596 return 2; /* clear media only */ 597 else 598 return 0; 599 } 600 601 static bool huc_has_delayed_load(struct intel_huc *huc) 602 { 603 return intel_huc_is_loaded_by_gsc(huc) && 604 (huc->delayed_load.status != INTEL_HUC_DELAYED_LOAD_ERROR); 605 } 606 607 void intel_huc_update_auth_status(struct intel_huc *huc) 608 { 609 if (!intel_uc_fw_is_loadable(&huc->fw)) 610 return; 611 612 if (!huc->fw.has_gsc_headers) 613 return; 614 615 if (huc_is_fully_authenticated(huc)) 616 intel_uc_fw_change_status(&huc->fw, 617 INTEL_UC_FIRMWARE_RUNNING); 618 else if (huc_has_delayed_load(huc)) 619 huc_delayed_load_start(huc); 620 } 621 622 /** 623 * intel_huc_load_status - dump information about HuC load status 624 * @huc: the HuC 625 * @p: the &drm_printer 626 * 627 * Pretty printer for HuC load status. 628 */ 629 void intel_huc_load_status(struct intel_huc *huc, struct drm_printer *p) 630 { 631 struct intel_gt *gt = huc_to_gt(huc); 632 intel_wakeref_t wakeref; 633 634 if (!intel_huc_is_supported(huc)) { 635 drm_printf(p, "HuC not supported\n"); 636 return; 637 } 638 639 if (!intel_huc_is_wanted(huc)) { 640 drm_printf(p, "HuC disabled\n"); 641 return; 642 } 643 644 intel_uc_fw_dump(&huc->fw, p); 645 646 with_intel_runtime_pm(gt->uncore->rpm, wakeref) 647 drm_printf(p, "HuC status: 0x%08x\n", 648 intel_uncore_read(gt->uncore, huc->status[INTEL_HUC_AUTH_BY_GUC].reg)); 649 } 650