drivers/gpu/drm/xe/xe_gsc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_gsc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_gsc.c- Extension
.c- Size
- 17359 bytes
- Lines
- 630
- 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
xe_gsc.hlinux/delay.hdrm/drm_managed.hdrm/drm_print.hgenerated/xe_wa_oob.habi/gsc_mkhi_commands_abi.hxe_bb.hxe_bo.hxe_device.hxe_exec_queue.hxe_force_wake.hxe_gsc_proxy.hxe_gsc_submit.hxe_gt.hxe_gt_mcr.hxe_gt_printk.hxe_guc_pc.hxe_huc.hxe_map.hxe_mmio.hxe_pm.hxe_sched_job.hxe_uc_fw.hxe_wa.hinstructions/xe_gsc_commands.hregs/xe_gsc_regs.hregs/xe_gt_regs.hregs/xe_irq_regs.h
Detected Declarations
function gsc_to_gtfunction memcpy_fwfunction emit_gsc_uploadfunction emit_version_query_msgfunction query_compatibility_versionfunction gsc_fw_is_loadedfunction gsc_fw_waitfunction gsc_uploadfunction gsc_upload_and_initfunction gsc_er_completefunction gsc_workfunction xe_gsc_hwe_irq_handlerfunction xe_gsc_initfunction free_resourcesfunction xe_gsc_init_post_hwconfigfunction xe_gsc_load_startfunction xe_gsc_wait_for_worker_completionfunction xe_gsc_stop_preparefunction xe_gsc_wa_14015076503function xe_gsc_print_info
Annotated Snippet
// SPDX-License-Identifier: MIT
/*
* Copyright © 2023 Intel Corporation
*/
#include "xe_gsc.h"
#include <linux/delay.h>
#include <drm/drm_managed.h>
#include <drm/drm_print.h>
#include <generated/xe_wa_oob.h>
#include "abi/gsc_mkhi_commands_abi.h"
#include "xe_bb.h"
#include "xe_bo.h"
#include "xe_device.h"
#include "xe_exec_queue.h"
#include "xe_force_wake.h"
#include "xe_gsc_proxy.h"
#include "xe_gsc_submit.h"
#include "xe_gt.h"
#include "xe_gt_mcr.h"
#include "xe_gt_printk.h"
#include "xe_guc_pc.h"
#include "xe_huc.h"
#include "xe_map.h"
#include "xe_mmio.h"
#include "xe_pm.h"
#include "xe_sched_job.h"
#include "xe_uc_fw.h"
#include "xe_wa.h"
#include "instructions/xe_gsc_commands.h"
#include "regs/xe_gsc_regs.h"
#include "regs/xe_gt_regs.h"
#include "regs/xe_irq_regs.h"
static struct xe_gt *
gsc_to_gt(struct xe_gsc *gsc)
{
return container_of(gsc, struct xe_gt, uc.gsc);
}
static int memcpy_fw(struct xe_gsc *gsc)
{
struct xe_gt *gt = gsc_to_gt(gsc);
struct xe_device *xe = gt_to_xe(gt);
u32 fw_size = gsc->fw.size;
void *storage;
/*
* FIXME: xe_migrate_copy does not work with stolen mem yet, so we use
* a memcpy for now.
*/
storage = kmalloc(fw_size, GFP_KERNEL);
if (!storage)
return -ENOMEM;
xe_map_memcpy_from(xe, storage, &gsc->fw.bo->vmap, 0, fw_size);
xe_map_memcpy_to(xe, &gsc->private->vmap, 0, storage, fw_size);
xe_map_memset(xe, &gsc->private->vmap, fw_size, 0,
xe_bo_size(gsc->private) - fw_size);
kfree(storage);
return 0;
}
static int emit_gsc_upload(struct xe_gsc *gsc)
{
struct xe_gt *gt = gsc_to_gt(gsc);
u64 offset = xe_bo_ggtt_addr(gsc->private);
struct xe_bb *bb;
struct xe_sched_job *job;
struct dma_fence *fence;
long timeout;
bb = xe_bb_new(gt, 4, false);
if (IS_ERR(bb))
return PTR_ERR(bb);
bb->cs[bb->len++] = GSC_FW_LOAD;
bb->cs[bb->len++] = lower_32_bits(offset);
bb->cs[bb->len++] = upper_32_bits(offset);
bb->cs[bb->len++] = (xe_bo_size(gsc->private) / SZ_4K) |
GSC_FW_LOAD_LIMIT_VALID;
job = xe_bb_create_job(gsc->q, bb);
if (IS_ERR(job)) {
Annotation
- Immediate include surface: `xe_gsc.h`, `linux/delay.h`, `drm/drm_managed.h`, `drm/drm_print.h`, `generated/xe_wa_oob.h`, `abi/gsc_mkhi_commands_abi.h`, `xe_bb.h`, `xe_bo.h`.
- Detected declarations: `function gsc_to_gt`, `function memcpy_fw`, `function emit_gsc_upload`, `function emit_version_query_msg`, `function query_compatibility_version`, `function gsc_fw_is_loaded`, `function gsc_fw_wait`, `function gsc_upload`, `function gsc_upload_and_init`, `function gsc_er_complete`.
- 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.