drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_sriov_vf_ccs.c- Extension
.c- Size
- 17692 bytes
- Lines
- 496
- 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
instructions/xe_mi_commands.hinstructions/xe_gpu_commands.hxe_bb.hxe_bo.hxe_device.hxe_exec_queue.hxe_exec_queue_types.hxe_gt_sriov_vf.hxe_guc.hxe_guc_submit.hxe_lrc.hxe_mem_pool.hxe_migrate.hxe_pm.hxe_sriov_printk.hxe_sriov_vf.hxe_sriov_vf_ccs.hxe_sriov_vf_ccs_types.h
Detected Declarations
function surfacefunction alloc_bb_poolfunction ccs_rw_update_ringfunction xe_sriov_vf_ccs_rebasefunction for_each_ccs_rw_ctxfunction register_save_restore_contextfunction xe_sriov_vf_ccs_register_contextfunction for_each_ccs_rw_ctxfunction vf_migration_ccs_bb_neededfunction vf_migration_ccs_bb_support_checkfunction xe_sriov_vf_ccs_finifunction xe_sriov_vf_ccs_initfunction for_each_ccs_rw_ctxfunction xe_sriov_vf_ccs_rw_update_bb_addrfunction xe_migrate_ccs_rw_copyfunction for_each_ccs_rw_ctxfunction xe_sriov_vf_ccs_detach_bofunction for_each_ccs_rw_ctxfunction xe_sriov_vf_ccs_print
Annotated Snippet
if (IS_ERR(q)) {
err = PTR_ERR(q);
goto err_ret;
}
ctx->mig_q = q;
err = alloc_bb_pool(tile, ctx);
if (err)
goto err_free_queue;
ccs_rw_update_ring(ctx);
err = register_save_restore_context(ctx);
if (err)
goto err_free_queue;
err = devm_add_action_or_reset(xe->drm.dev,
xe_sriov_vf_ccs_fini,
ctx);
if (err)
goto err_ret;
}
xe->sriov.vf.ccs.initialized = 1;
return 0;
err_free_queue:
xe_exec_queue_put(q);
err_ret:
return err;
}
#define XE_SRIOV_VF_CCS_RW_BB_ADDR_OFFSET (2 * sizeof(u32))
void xe_sriov_vf_ccs_rw_update_bb_addr(struct xe_sriov_vf_ccs_ctx *ctx)
{
u64 addr = xe_mem_pool_gpu_addr(ctx->mem.ccs_bb_pool);
struct xe_lrc *lrc = xe_exec_queue_lrc(ctx->mig_q);
struct xe_device *xe = gt_to_xe(ctx->mig_q->gt);
xe_device_wmb(xe);
xe_map_wr(xe, &lrc->bo->vmap, XE_SRIOV_VF_CCS_RW_BB_ADDR_OFFSET, u32, addr);
xe_device_wmb(xe);
}
/**
* xe_sriov_vf_ccs_attach_bo - Insert CCS read write commands in the BO.
* @bo: the &buffer object to which batch buffer commands will be added.
*
* This function shall be called only by VF. It inserts the PTEs and copy
* command instructions in the BO by calling xe_migrate_ccs_rw_copy()
* function.
*
* Returns: 0 if successful, negative error code on failure.
*/
int xe_sriov_vf_ccs_attach_bo(struct xe_bo *bo)
{
struct xe_device *xe = xe_bo_device(bo);
enum xe_sriov_vf_ccs_rw_ctxs ctx_id;
struct xe_sriov_vf_ccs_ctx *ctx;
struct xe_mem_pool_node *bb;
struct xe_tile *tile;
int err = 0;
xe_assert(xe, IS_VF_CCS_READY(xe));
tile = xe_device_get_root_tile(xe);
for_each_ccs_rw_ctx(ctx_id) {
bb = bo->bb_ccs[ctx_id];
/* bb should be NULL here. Assert if not NULL */
xe_assert(xe, !bb);
ctx = &xe->sriov.vf.ccs.contexts[ctx_id];
err = xe_migrate_ccs_rw_copy(tile, ctx->mig_q, bo, ctx_id);
}
return err;
}
/**
* xe_sriov_vf_ccs_detach_bo - Remove CCS read write commands from the BO.
* @bo: the &buffer object from which batch buffer commands will be removed.
*
* This function shall be called only by VF. It removes the PTEs and copy
* command instructions from the BO. Make sure to update the BB with MI_NOOP
* before freeing.
*
* Returns: 0 if successful.
*/
Annotation
- Immediate include surface: `instructions/xe_mi_commands.h`, `instructions/xe_gpu_commands.h`, `xe_bb.h`, `xe_bo.h`, `xe_device.h`, `xe_exec_queue.h`, `xe_exec_queue_types.h`, `xe_gt_sriov_vf.h`.
- Detected declarations: `function surface`, `function alloc_bb_pool`, `function ccs_rw_update_ring`, `function xe_sriov_vf_ccs_rebase`, `function for_each_ccs_rw_ctx`, `function register_save_restore_context`, `function xe_sriov_vf_ccs_register_context`, `function for_each_ccs_rw_ctx`, `function vf_migration_ccs_bb_needed`, `function vf_migration_ccs_bb_support_check`.
- 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.