drivers/gpu/drm/xe/xe_gt_sriov_vf.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_gt_sriov_vf.c- Extension
.c- Size
- 42480 bytes
- Lines
- 1579
- 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.
- 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/bitfield.hlinux/bsearch.hlinux/delay.hdrm/drm_managed.hdrm/drm_print.habi/guc_actions_sriov_abi.habi/guc_communication_mmio_abi.habi/guc_klvs_abi.habi/guc_relay_actions_abi.hregs/xe_gt_regs.hxe_assert.hxe_device.hxe_ggtt.hxe_gt_sriov_printk.hxe_gt_sriov_vf.hxe_gt_sriov_vf_types.hxe_guc.hxe_guc_ct.hxe_guc_hxg_helpers.hxe_guc_relay.hxe_guc_submit.hxe_irq.hxe_lrc.hxe_memirq.hxe_mmio.hxe_sriov.hxe_sriov_vf.hxe_sriov_vf_ccs.hxe_tile_sriov_vf.hxe_tlb_inval.hxe_uc_fw.hxe_wopcm.h
Detected Declarations
enum VF_MIGRATION_WAIT_POINTSfunction vf_post_migration_inject_waitfunction guc_action_vf_resetfunction vf_reset_guc_statefunction xe_gt_sriov_vf_resetfunction guc_action_match_versionfunction guc_action_match_version_anyfunction vf_minimum_guc_versionfunction vf_wanted_guc_versionfunction vf_handshake_with_gucfunction xe_gt_sriov_vf_bootstrapfunction xe_gt_sriov_vf_guc_versionsfunction guc_action_vf_resfix_startfunction vf_resfix_startfunction guc_action_vf_resfix_donefunction vf_resfix_donefunction guc_action_query_single_klvfunction guc_action_query_single_klv32function guc_action_query_single_klv64function has_gmdidfunction xe_gt_sriov_vf_gmdidfunction vf_get_ggtt_infofunction vf_get_lmem_infofunction vf_get_submission_cfgfunction vf_cache_gmdidfunction vf_query_sched_groupsfunction vf_cache_sched_groups_statusfunction xe_gt_sriov_vf_query_configfunction xe_gt_sriov_vf_sched_groups_enabledfunction xe_gt_sriov_vf_guc_idsfunction relay_action_handshakefunction vf_connect_pffunction vf_disconnect_pffunction vf_handshake_with_pffunction xe_gt_sriov_vf_connectfunction xe_gt_sriov_vf_default_lrcs_hwsp_rebasefunction vf_post_migration_mark_fixups_donefunction vf_start_migration_recoveryfunction xe_gt_sriov_vf_migrated_event_handlerfunction vf_is_negotiatedfunction vf_prepare_runtime_infofunction vf_query_runtime_infofunction vf_show_runtime_infofunction xe_gt_sriov_vf_query_runtimefunction vf_runtime_reg_cmpfunction xe_gt_sriov_vf_read32function xe_gt_sriov_vf_write32function xe_gt_sriov_vf_print_config
Annotated Snippet
if (MAKE_GUC_VER_STRUCT(*guc_version) != MAKE_GUC_VER_STRUCT(wanted)) {
xe_gt_sriov_err(gt, "New GuC interface version detected: %u.%u.%u.%u\n",
guc_version->branch, guc_version->major,
guc_version->minor, guc_version->patch);
xe_gt_sriov_info(gt, "Previously used version was: %u.%u.%u.%u\n",
wanted.branch, wanted.major,
wanted.minor, wanted.patch);
err = -EREMCHG;
goto fail;
} else {
/* version is unchanged, no need to re-verify it */
return 0;
}
}
/* illegal */
if (guc_version->major > wanted.major) {
err = -EPROTO;
goto unsupported;
}
/* there's no fallback on major version. */
if (guc_version->major != wanted.major) {
err = -ENOPKG;
goto unsupported;
}
/* check against minimum version supported by us */
vf_minimum_guc_version(gt, &wanted);
xe_gt_assert(gt, wanted.major != GUC_VERSION_MAJOR_ANY);
if (MAKE_GUC_VER_STRUCT(*guc_version) < MAKE_GUC_VER_STRUCT(wanted)) {
err = -ENOKEY;
goto unsupported;
}
xe_gt_sriov_dbg(gt, "using GuC interface version %u.%u.%u.%u\n",
guc_version->branch, guc_version->major,
guc_version->minor, guc_version->patch);
return 0;
unsupported:
xe_gt_sriov_err(gt, "Unsupported GuC version %u.%u.%u.%u (%pe)\n",
guc_version->branch, guc_version->major,
guc_version->minor, guc_version->patch,
ERR_PTR(err));
fail:
xe_gt_sriov_err(gt, "Unable to confirm GuC version %u.%u (%pe)\n",
wanted.major, wanted.minor, ERR_PTR(err));
/* try again with *any* just to query which version is supported */
if (!guc_action_match_version_any(guc, &wanted))
xe_gt_sriov_notice(gt, "GuC reports interface version %u.%u.%u.%u\n",
wanted.branch, wanted.major, wanted.minor, wanted.patch);
return err;
}
/**
* xe_gt_sriov_vf_bootstrap - Query and setup GuC ABI interface version.
* @gt: the &xe_gt
*
* This function is for VF use only.
* It requires functional `GuC MMIO based communication`_.
*
* Return: 0 on success or a negative error code on failure.
*/
int xe_gt_sriov_vf_bootstrap(struct xe_gt *gt)
{
int err;
if (!xe_device_uc_enabled(gt_to_xe(gt)))
return -ENODEV;
err = vf_reset_guc_state(gt);
if (unlikely(err))
return err;
err = vf_handshake_with_guc(gt);
if (unlikely(err))
return err;
return 0;
}
/**
* xe_gt_sriov_vf_guc_versions - Minimum required and found GuC ABI versions
* @gt: the &xe_gt
* @wanted: pointer to the xe_uc_fw_version to be filled with the wanted version
* @found: pointer to the xe_uc_fw_version to be filled with the found version
*
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bsearch.h`, `linux/delay.h`, `drm/drm_managed.h`, `drm/drm_print.h`, `abi/guc_actions_sriov_abi.h`, `abi/guc_communication_mmio_abi.h`, `abi/guc_klvs_abi.h`.
- Detected declarations: `enum VF_MIGRATION_WAIT_POINTS`, `function vf_post_migration_inject_wait`, `function guc_action_vf_reset`, `function vf_reset_guc_state`, `function xe_gt_sriov_vf_reset`, `function guc_action_match_version`, `function guc_action_match_version_any`, `function vf_minimum_guc_version`, `function vf_wanted_guc_version`, `function vf_handshake_with_guc`.
- 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.