drivers/gpu/drm/i915/gt/uc/intel_uc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/uc/intel_uc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/uc/intel_uc.c- Extension
.c- Size
- 19067 bytes
- Lines
- 769
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/string_helpers.hgt/intel_gt.hgt/intel_gt_print.hgt/intel_reset.hintel_gsc_fw.hintel_gsc_uc.hintel_guc.hintel_guc_ads.hintel_guc_print.hintel_guc_submission.hgt/intel_rps.hintel_uc.hi915_drv.hi915_hwmon.h
Detected Declarations
function uc_expand_default_optionsfunction __intel_uc_reset_hwfunction __confirm_optionsfunction intel_uc_init_earlyfunction intel_uc_init_latefunction intel_uc_driver_late_releasefunction intel_uc_init_mmiofunction __uc_capture_load_err_logfunction __uc_free_load_err_logfunction intel_uc_driver_removefunction guc_clear_mmio_msgfunction guc_get_mmio_msgfunction guc_handle_mmio_msgfunction guc_enable_communicationfunction guc_disable_communicationfunction __uc_fetch_firmwaresfunction __uc_cleanup_firmwaresfunction __uc_initfunction __uc_finifunction __uc_sanitizefunction uc_init_wopcmfunction uc_is_wopcm_lockedfunction __uc_check_hwfunction print_fw_verfunction __uc_init_hwfunction __uc_fini_hwfunction intel_uc_reset_preparefunction intel_uc_resetfunction intel_uc_reset_finishfunction intel_uc_cancel_requestsfunction intel_uc_runtime_suspendfunction intel_uc_suspendfunction with_intel_runtime_pmfunction __uc_resume_mappingsfunction __uc_resumefunction intel_uc_resumefunction intel_uc_runtime_resume
Annotated Snippet
if (intel_uc_wants_huc(uc)) {
gt_dbg(gt, "Failed to fetch GuC fw (%pe) disabling HuC\n", ERR_PTR(err));
intel_uc_fw_change_status(&uc->huc.fw,
INTEL_UC_FIRMWARE_ERROR);
}
if (intel_uc_wants_gsc_uc(uc)) {
gt_dbg(gt, "Failed to fetch GuC fw (%pe) disabling GSC\n", ERR_PTR(err));
intel_uc_fw_change_status(&uc->gsc.fw,
INTEL_UC_FIRMWARE_ERROR);
}
return;
}
if (intel_uc_wants_huc(uc))
intel_uc_fw_fetch(&uc->huc.fw);
if (intel_uc_wants_gsc_uc(uc))
intel_uc_fw_fetch(&uc->gsc.fw);
}
static void __uc_cleanup_firmwares(struct intel_uc *uc)
{
intel_uc_fw_cleanup_fetch(&uc->gsc.fw);
intel_uc_fw_cleanup_fetch(&uc->huc.fw);
intel_uc_fw_cleanup_fetch(&uc->guc.fw);
}
static int __uc_init(struct intel_uc *uc)
{
struct intel_guc *guc = &uc->guc;
struct intel_huc *huc = &uc->huc;
int ret;
GEM_BUG_ON(!intel_uc_wants_guc(uc));
if (!intel_uc_uses_guc(uc))
return 0;
ret = intel_guc_init(guc);
if (ret)
return ret;
if (intel_uc_uses_huc(uc))
intel_huc_init(huc);
if (intel_uc_uses_gsc_uc(uc))
intel_gsc_uc_init(&uc->gsc);
return 0;
}
ALLOW_ERROR_INJECTION(__uc_init, ERRNO);
static void __uc_fini(struct intel_uc *uc)
{
intel_gsc_uc_fini(&uc->gsc);
intel_huc_fini(&uc->huc);
intel_guc_fini(&uc->guc);
}
static int __uc_sanitize(struct intel_uc *uc)
{
struct intel_guc *guc = &uc->guc;
struct intel_huc *huc = &uc->huc;
GEM_BUG_ON(!intel_uc_supports_guc(uc));
intel_huc_sanitize(huc);
intel_guc_sanitize(guc);
return __intel_uc_reset_hw(uc);
}
/* Initialize and verify the uC regs related to uC positioning in WOPCM */
static int uc_init_wopcm(struct intel_uc *uc)
{
struct intel_gt *gt = uc_to_gt(uc);
struct intel_uncore *uncore = gt->uncore;
u32 base = intel_wopcm_guc_base(>->wopcm);
u32 size = intel_wopcm_guc_size(>->wopcm);
u32 huc_agent = intel_uc_uses_huc(uc) ? HUC_LOADING_AGENT_GUC : 0;
u32 mask;
int err;
if (unlikely(!base || !size)) {
gt_probe_error(gt, "Unsuccessful WOPCM partitioning\n");
return -E2BIG;
}
Annotation
- Immediate include surface: `linux/string_helpers.h`, `gt/intel_gt.h`, `gt/intel_gt_print.h`, `gt/intel_reset.h`, `intel_gsc_fw.h`, `intel_gsc_uc.h`, `intel_guc.h`, `intel_guc_ads.h`.
- Detected declarations: `function uc_expand_default_options`, `function __intel_uc_reset_hw`, `function __confirm_options`, `function intel_uc_init_early`, `function intel_uc_init_late`, `function intel_uc_driver_late_release`, `function intel_uc_init_mmio`, `function __uc_capture_load_err_log`, `function __uc_free_load_err_log`, `function intel_uc_driver_remove`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.