drivers/gpu/drm/i915/gt/uc/intel_huc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/uc/intel_huc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/uc/intel_huc.c- Extension
.c- Size
- 20658 bytes
- Lines
- 689
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hgt/intel_gt.hgt/intel_rps.hintel_guc_reg.hintel_huc.hintel_huc_print.hi915_drv.hi915_reg.hpxp/intel_pxp_cmd_interface_43.hlinux/device/bus.hlinux/mei_aux.h
Detected Declarations
function sw_fence_dummy_notifyfunction __delayed_huc_load_completefunction delayed_huc_load_completefunction __gsc_init_errorfunction gsc_init_errorfunction gsc_init_donefunction huc_delayed_load_timer_callbackfunction huc_delayed_load_startfunction gsc_notifierfunction intel_huc_register_gsc_notifierfunction intel_huc_unregister_gsc_notifierfunction delayed_huc_load_initfunction delayed_huc_load_finifunction intel_huc_sanitizefunction vcs_supportedfunction intel_huc_init_earlyfunction intel_huc_fini_latefunction check_huc_loading_modefunction intel_huc_initfunction intel_huc_finifunction intel_huc_wait_for_auth_completefunction intel_huc_authfunction intel_huc_is_authenticatedfunction huc_is_fully_authenticatedfunction intel_huc_check_statusfunction huc_has_delayed_loadfunction intel_huc_update_auth_statusfunction intel_huc_load_status
Annotated Snippet
void intel_huc_register_gsc_notifier(struct intel_huc *huc, const struct bus_type *bus)
{
int ret;
if (!intel_huc_is_loaded_by_gsc(huc))
return;
huc->delayed_load.nb.notifier_call = gsc_notifier;
ret = bus_register_notifier(bus, &huc->delayed_load.nb);
if (ret) {
huc_err(huc, "failed to register GSC notifier %pe\n", ERR_PTR(ret));
huc->delayed_load.nb.notifier_call = NULL;
gsc_init_error(huc);
}
}
void intel_huc_unregister_gsc_notifier(struct intel_huc *huc, const struct bus_type *bus)
{
if (!huc->delayed_load.nb.notifier_call)
return;
delayed_huc_load_complete(huc);
bus_unregister_notifier(bus, &huc->delayed_load.nb);
huc->delayed_load.nb.notifier_call = NULL;
}
static void delayed_huc_load_init(struct intel_huc *huc)
{
/*
* Initialize fence to be complete as this is expected to be complete
* unless there is a delayed HuC load in progress.
*/
i915_sw_fence_init(&huc->delayed_load.fence,
sw_fence_dummy_notify);
i915_sw_fence_commit(&huc->delayed_load.fence);
hrtimer_setup(&huc->delayed_load.timer, huc_delayed_load_timer_callback, CLOCK_MONOTONIC,
HRTIMER_MODE_REL);
}
static void delayed_huc_load_fini(struct intel_huc *huc)
{
/*
* the fence is initialized in init_early, so we need to clean it up
* even if HuC loading is off.
*/
delayed_huc_load_complete(huc);
i915_sw_fence_fini(&huc->delayed_load.fence);
}
int intel_huc_sanitize(struct intel_huc *huc)
{
delayed_huc_load_complete(huc);
intel_uc_fw_sanitize(&huc->fw);
return 0;
}
static bool vcs_supported(struct intel_gt *gt)
{
intel_engine_mask_t mask = gt->info.engine_mask;
/*
* We reach here from i915_driver_early_probe for the primary GT before
* its engine mask is set, so we use the device info engine mask for it;
* this means we're not taking VCS fusing into account, but if the
* primary GT supports VCS engines we expect at least one of them to
* remain unfused so we're fine.
* For other GTs we expect the GT-specific mask to be set before we
* call this function.
*/
GEM_BUG_ON(!gt_is_root(gt) && !gt->info.engine_mask);
if (gt_is_root(gt))
mask = INTEL_INFO(gt->i915)->platform_engine_mask;
else
mask = gt->info.engine_mask;
return __ENGINE_INSTANCES_MASK(mask, VCS0, I915_MAX_VCS);
}
void intel_huc_init_early(struct intel_huc *huc)
{
struct drm_i915_private *i915 = huc_to_gt(huc)->i915;
struct intel_gt *gt = huc_to_gt(huc);
intel_uc_fw_init_early(&huc->fw, INTEL_UC_FW_TYPE_HUC, true);
/*
* we always init the fence as already completed, even if HuC is not
Annotation
- Immediate include surface: `linux/types.h`, `gt/intel_gt.h`, `gt/intel_rps.h`, `intel_guc_reg.h`, `intel_huc.h`, `intel_huc_print.h`, `i915_drv.h`, `i915_reg.h`.
- Detected declarations: `function sw_fence_dummy_notify`, `function __delayed_huc_load_complete`, `function delayed_huc_load_complete`, `function __gsc_init_error`, `function gsc_init_error`, `function gsc_init_done`, `function huc_delayed_load_timer_callback`, `function huc_delayed_load_start`, `function gsc_notifier`, `function intel_huc_register_gsc_notifier`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: pattern implementation candidate.
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.