drivers/gpu/drm/xe/xe_late_bind_fw.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_late_bind_fw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_late_bind_fw.c- Extension
.c- Size
- 12785 bytes
- Lines
- 465
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/component.hlinux/delay.hlinux/firmware.hdrm/drm_managed.hdrm/intel/i915_component.hdrm/intel/intel_lb_mei_interface.hdrm/drm_print.hxe_device.hxe_late_bind_fw.hxe_pcode.hxe_pcode_api.hxe_pm.h
Detected Declarations
function late_bind_to_xefunction late_bind_fw_to_xefunction parse_cpd_headerfunction parse_lb_layoutfunction xe_late_bind_fw_num_fansfunction xe_late_bind_wait_for_worker_completionfunction xe_late_bind_workfunction xe_late_bind_fw_loadfunction __xe_late_bind_fw_initfunction xe_late_bind_fw_initfunction xe_late_bind_component_bindfunction xe_late_bind_component_unbindfunction xe_late_bind_removefunction xe_late_bind_init
Annotated Snippet
if (lbfw->payload && late_bind->wq) {
drm_dbg(&xe->drm, "Flush work: load %s firmware\n",
fw_id_to_name[lbfw->id]);
flush_work(&lbfw->work);
}
}
}
static void xe_late_bind_work(struct work_struct *work)
{
struct xe_late_bind_fw *lbfw = container_of(work, struct xe_late_bind_fw, work);
struct xe_late_bind *late_bind = container_of(lbfw, struct xe_late_bind,
late_bind_fw[lbfw->id]);
struct xe_device *xe = late_bind_to_xe(late_bind);
int retry = LB_FW_LOAD_RETRY_MAXCOUNT;
int ret;
int slept;
xe_device_assert_mem_access(xe);
/* we can queue this before the component is bound */
for (slept = 0; slept < LB_INIT_TIMEOUT_MS; slept += 100) {
if (late_bind->component.ops)
break;
msleep(100);
}
if (!late_bind->component.ops) {
drm_err(&xe->drm, "Late bind component not bound\n");
/* Do not re-attempt fw load */
drmm_kfree(&xe->drm, (void *)lbfw->payload);
lbfw->payload = NULL;
goto out;
}
drm_dbg(&xe->drm, "Load %s firmware\n", fw_id_to_name[lbfw->id]);
do {
ret = late_bind->component.ops->push_payload(late_bind->component.mei_dev,
lbfw->type,
lbfw->flags,
lbfw->payload,
lbfw->payload_size);
if (!ret)
break;
msleep(LB_FW_LOAD_RETRY_PAUSE_MS);
} while (--retry && ret == -EBUSY);
if (!ret) {
drm_dbg(&xe->drm, "Load %s firmware successful\n",
fw_id_to_name[lbfw->id]);
goto out;
}
if (ret > 0)
drm_err(&xe->drm, "Load %s firmware failed with err %d, %s\n",
fw_id_to_name[lbfw->id], ret, xe_late_bind_parse_status(ret));
else
drm_err(&xe->drm, "Load %s firmware failed with err %d",
fw_id_to_name[lbfw->id], ret);
/* Do not re-attempt fw load */
drmm_kfree(&xe->drm, (void *)lbfw->payload);
lbfw->payload = NULL;
out:
xe_pm_runtime_put(xe);
}
int xe_late_bind_fw_load(struct xe_late_bind *late_bind)
{
struct xe_device *xe = late_bind_to_xe(late_bind);
struct xe_late_bind_fw *lbfw;
int fw_id;
if (!late_bind->component_added)
return -ENODEV;
if (late_bind->disable)
return 0;
for (fw_id = 0; fw_id < XE_LB_FW_MAX_ID; fw_id++) {
lbfw = &late_bind->late_bind_fw[fw_id];
if (lbfw->payload) {
xe_pm_runtime_get_noresume(xe);
queue_work(late_bind->wq, &lbfw->work);
}
}
return 0;
}
Annotation
- Immediate include surface: `linux/component.h`, `linux/delay.h`, `linux/firmware.h`, `drm/drm_managed.h`, `drm/intel/i915_component.h`, `drm/intel/intel_lb_mei_interface.h`, `drm/drm_print.h`, `xe_device.h`.
- Detected declarations: `function late_bind_to_xe`, `function late_bind_fw_to_xe`, `function parse_cpd_header`, `function parse_lb_layout`, `function xe_late_bind_fw_num_fans`, `function xe_late_bind_wait_for_worker_completion`, `function xe_late_bind_work`, `function xe_late_bind_fw_load`, `function __xe_late_bind_fw_init`, `function xe_late_bind_fw_init`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source 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.