drivers/gpu/drm/xe/xe_guc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_guc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_guc.c- Extension
.c- Size
- 47675 bytes
- Lines
- 1852
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
xe_guc.hlinux/iopoll.hdrm/drm_managed.hgenerated/xe_wa_oob.habi/guc_actions_abi.habi/guc_errors_abi.hregs/xe_gt_regs.hregs/xe_gtt_defs.hregs/xe_guc_regs.hregs/xe_irq_regs.hxe_bo.hxe_configfs.hxe_device.hxe_force_wake.hxe_gt.hxe_gt_printk.hxe_gt_sriov_vf.hxe_gt_throttle.hxe_gt_sriov_pf_migration.hxe_guc_ads.hxe_guc_buf.hxe_guc_capture.hxe_guc_ct.hxe_guc_db_mgr.hxe_guc_engine_activity.hxe_guc_hwconfig.hxe_guc_klv_helpers.hxe_guc_log.hxe_guc_pc.hxe_guc_rc.hxe_guc_relay.hxe_guc_submit.h
Detected Declarations
function guc_bo_ggtt_addrfunction guc_ctl_debug_flagsfunction guc_ctl_feature_flagsfunction guc_ctl_log_params_flagsfunction guc_ctl_ads_flagsfunction needs_wa_dual_queuefunction guc_ctl_wa_flagsfunction guc_ctl_devidfunction guc_print_paramsfunction guc_init_paramsfunction guc_init_params_post_hwconfigfunction guc_write_paramsfunction guc_action_register_g2g_bufferfunction guc_action_deregister_g2g_bufferfunction g2g_slotfunction guc_g2g_registerfunction guc_g2g_deregisterfunction guc_g2g_sizefunction xe_guc_g2g_wantedfunction guc_g2g_allocfunction guc_g2g_finifunction guc_g2g_startfunction for_each_gtfunction __guc_opt_in_features_enablefunction supports_dynamic_icsfunction xe_guc_opt_in_features_enablefunction guc_fini_hwfunction vf_guc_fini_hwfunction xe_guc_comm_init_earlyfunction xe_guc_realloc_post_hwconfigfunction vf_guc_init_noallocfunction xe_guc_init_noallocfunction xe_guc_initfunction XE_GT_WAfunction vf_guc_init_post_hwconfigfunction guc_additional_cache_sizefunction xe_guc_init_post_hwconfigfunction xe_guc_post_load_initfunction guc_prevent_fw_dma_failure_on_resetfunction xe_guc_resetfunction guc_prepare_xferfunction guc_xfer_rsafunction print_load_status_errfunction statesfunction guc_wait_ucodefunction __xe_guc_uploadfunction vf_guc_min_load_for_hwconfigfunction xe_guc_min_load_for_hwconfig
Annotated Snippet
if (err) {
while (--t >= 0)
guc_g2g_deregister(guc, far_tile, far_dev, t);
goto err_deregister;
}
}
}
return 0;
err_deregister:
for_each_gt(far_gt, xe, j) {
u32 tile, dev;
if (far_gt->info.id == gt->info.id)
continue;
if (j >= i)
break;
tile = gt_to_tile(far_gt)->id;
dev = G2G_DEV(far_gt);
for (t = 0; t < XE_G2G_TYPE_LIMIT; t++)
guc_g2g_deregister(guc, tile, dev, t);
}
return err;
}
static int __guc_opt_in_features_enable(struct xe_guc *guc, u64 addr, u32 num_dwords)
{
u32 action[] = {
XE_GUC_ACTION_OPT_IN_FEATURE_KLV,
lower_32_bits(addr),
upper_32_bits(addr),
num_dwords
};
return xe_guc_ct_send_block(&guc->ct, action, ARRAY_SIZE(action));
}
static bool supports_dynamic_ics(struct xe_guc *guc)
{
struct xe_device *xe = guc_to_xe(guc);
struct xe_gt *gt = guc_to_gt(guc);
/* Dynamic ICS is available for PVC and Xe2 and newer platforms. */
if (xe->info.platform != XE_PVC && GRAPHICS_VER(xe) < 20)
return false;
/*
* The feature is currently not compatible with multi-lrc, so the GuC
* does not support it at all on the media engines (which are the main
* users of mlrc). On the primary GT side, to avoid it being used in
* conjunction with mlrc, we only enable it if we are in single CCS
* mode.
*/
if (xe_gt_is_media_type(gt) || gt->ccs_mode > 1)
return false;
/*
* Dynamic ICS requires GuC v70.40.1, which maps to compatibility
* version v1.18.4.
*/
return GUC_SUBMIT_VER(guc) >= MAKE_GUC_VER(1, 18, 4);
}
#define OPT_IN_MAX_DWORDS 16
int xe_guc_opt_in_features_enable(struct xe_guc *guc)
{
struct xe_device *xe = guc_to_xe(guc);
CLASS(xe_guc_buf, buf)(&guc->buf, OPT_IN_MAX_DWORDS);
u32 count = 0;
u32 *klvs;
int ret;
if (!xe_guc_buf_is_valid(buf))
return -ENOBUFS;
klvs = xe_guc_buf_cpu_ptr(buf);
/*
* The extra CAT error type opt-in was added in GuC v70.17.0, which maps
* to compatibility version v1.7.0.
* Note that the GuC allows enabling this KLV even on platforms that do
* not support the extra type; in such case the returned type variable
* will be set to a known invalid value which we can check against.
*/
if (GUC_SUBMIT_VER(guc) >= MAKE_GUC_VER(1, 7, 0))
Annotation
- Immediate include surface: `xe_guc.h`, `linux/iopoll.h`, `drm/drm_managed.h`, `generated/xe_wa_oob.h`, `abi/guc_actions_abi.h`, `abi/guc_errors_abi.h`, `regs/xe_gt_regs.h`, `regs/xe_gtt_defs.h`.
- Detected declarations: `function guc_bo_ggtt_addr`, `function guc_ctl_debug_flags`, `function guc_ctl_feature_flags`, `function guc_ctl_log_params_flags`, `function guc_ctl_ads_flags`, `function needs_wa_dual_queue`, `function guc_ctl_wa_flags`, `function guc_ctl_devid`, `function guc_print_params`, `function guc_init_params`.
- 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.