drivers/gpu/drm/xe/xe_guc_log.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_guc_log.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_guc_log.c- Extension
.c- Size
- 19182 bytes
- Lines
- 681
- 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
xe_guc_log.hlinux/fault-inject.hlinux/utsname.hdrm/drm_managed.habi/guc_lfd_abi.hregs/xe_guc_regs.hxe_bo.hxe_devcoredump.hxe_force_wake.hxe_gt_printk.hxe_gt_types.hxe_map.hxe_mmio.hxe_module.h
Detected Declarations
struct guc_log_buffer_entry_liststruct guc_lic_savefunction log_to_gucfunction log_to_gtfunction log_to_xefunction xe_guc_log_snapshot_freefunction xe_guc_log_snapshot_printfunction lfd_output_binaryfunction xe_guc_log_add_lfd_headerfunction xe_guc_log_add_typed_payloadfunction lic_type_to_indexfunction lfd_type_to_indexfunction xe_guc_log_add_klvfunction xe_guc_log_add_os_idfunction xe_guc_log_loop_log_initfunction find_markerfunction xe_guc_log_load_licfunction xe_guc_log_output_lfd_initfunction xe_guc_log_print_chunksfunction xe_guc_log_add_log_eventfunction xe_guc_log_add_crash_dumpfunction xe_guc_log_snapshot_print_lfdfunction xe_guc_log_print_dmesgfunction xe_guc_log_printfunction xe_guc_log_print_lfdfunction xe_guc_log_initfunction xe_guc_check_log_buf_overflow
Annotated Snippet
struct guc_log_buffer_entry_list {
u32 offset;
u32 rd_ptr;
u32 wr_ptr;
u32 wrap_offset;
u32 buf_size;
};
struct guc_lic_save {
u32 version;
/*
* Array of init config KLV values.
* Range from GUC_LOG_LIC_TYPE_FIRST to GUC_LOG_LIC_TYPE_LAST
*/
u32 values[GUC_LIC_TYPE_LAST - GUC_LIC_TYPE_FIRST + 1];
struct guc_log_buffer_entry_list entry[GUC_LOG_BUFFER_INIT_CONFIG];
};
static struct guc_log_buffer_entry_markers {
u32 key[2];
} const entry_markers[GUC_LOG_BUFFER_INIT_CONFIG + 1] = {
{{
GUC_LFD_LOG_BUFFER_MARKER_1V2,
GUC_LFD_LOG_BUFFER_MARKER_2
}},
{{
GUC_LFD_LOG_BUFFER_MARKER_1V2,
GUC_LFD_CRASH_DUMP_BUFFER_MARKER_2
}},
{{
GUC_LFD_STATE_CAPTURE_BUFFER_MARKER_1V2,
GUC_LFD_STATE_CAPTURE_BUFFER_MARKER_2
}},
{{
GUC_LIC_MAGIC,
(FIELD_PREP_CONST(GUC_LIC_VERSION_MASK_MAJOR, GUC_LIC_VERSION_MAJOR) |
FIELD_PREP_CONST(GUC_LIC_VERSION_MASK_MINOR, GUC_LIC_VERSION_MINOR))
}}
};
static struct guc_log_lic_lfd_map {
u32 lic;
u32 lfd;
} const lic_lfd_type_map[] = {
{GUC_LIC_TYPE_GUC_SW_VERSION, GUC_LFD_TYPE_FW_VERSION},
{GUC_LIC_TYPE_GUC_DEVICE_ID, GUC_LFD_TYPE_GUC_DEVICE_ID},
{GUC_LIC_TYPE_TSC_FREQUENCY, GUC_LFD_TYPE_TSC_FREQUENCY},
{GUC_LIC_TYPE_GMD_ID, GUC_LFD_TYPE_GMD_ID},
{GUC_LIC_TYPE_BUILD_PLATFORM_ID, GUC_LFD_TYPE_BUILD_PLATFORM_ID}
};
static struct xe_guc *
log_to_guc(struct xe_guc_log *log)
{
return container_of(log, struct xe_guc, log);
}
static struct xe_gt *
log_to_gt(struct xe_guc_log *log)
{
return container_of(log, struct xe_gt, uc.guc.log);
}
static struct xe_device *
log_to_xe(struct xe_guc_log *log)
{
return gt_to_xe(log_to_gt(log));
}
static struct xe_guc_log_snapshot *xe_guc_log_snapshot_alloc(struct xe_guc_log *log, bool atomic)
{
struct xe_guc_log_snapshot *snapshot;
size_t remain;
int i;
snapshot = kzalloc_obj(*snapshot, atomic ? GFP_ATOMIC : GFP_KERNEL);
if (!snapshot)
return NULL;
/*
* NB: kmalloc has a hard limit well below the maximum GuC log buffer size.
* Also, can't use vmalloc as might be called from atomic context. So need
* to break the buffer up into smaller chunks that can be allocated.
*/
snapshot->size = xe_bo_size(log->bo);
snapshot->num_chunks = DIV_ROUND_UP(snapshot->size, GUC_LOG_CHUNK_SIZE);
snapshot->copy = kzalloc_objs(*snapshot->copy, snapshot->num_chunks,
atomic ? GFP_ATOMIC : GFP_KERNEL);
if (!snapshot->copy)
Annotation
- Immediate include surface: `xe_guc_log.h`, `linux/fault-inject.h`, `linux/utsname.h`, `drm/drm_managed.h`, `abi/guc_lfd_abi.h`, `regs/xe_guc_regs.h`, `xe_bo.h`, `xe_devcoredump.h`.
- Detected declarations: `struct guc_log_buffer_entry_list`, `struct guc_lic_save`, `function log_to_guc`, `function log_to_gt`, `function log_to_xe`, `function xe_guc_log_snapshot_free`, `function xe_guc_log_snapshot_print`, `function lfd_output_binary`, `function xe_guc_log_add_lfd_header`, `function xe_guc_log_add_typed_payload`.
- 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.