drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/uc/intel_guc_log.c- Extension
.c- Size
- 24974 bytes
- Lines
- 938
- 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/debugfs.hlinux/string_helpers.hdrm/drm_managed.hgt/intel_gt.hi915_drv.hi915_irq.hi915_memcpy.hintel_guc_capture.hintel_guc_log.hintel_guc_print.h
Detected Declarations
struct guc_log_sectionfunction _guc_log_init_sizesfunction guc_log_init_sizesfunction intel_guc_log_section_size_crashfunction intel_guc_log_section_size_debugfunction intel_guc_log_section_size_capturefunction intel_guc_log_sizefunction guc_action_flush_log_completefunction guc_action_flush_logfunction guc_action_control_logfunction subbuf_start_callbackfunction file_createfunction file_removefunction guc_move_to_next_buffunction intel_guc_check_log_buf_overflowfunction intel_guc_get_log_buffer_sizefunction intel_guc_get_log_buffer_offsetfunction _guc_log_copy_debuglogs_for_relayfunction copy_debug_logs_workfunction guc_log_relay_mapfunction guc_log_relay_unmapfunction intel_guc_log_init_earlyfunction guc_log_relay_createfunction guc_log_relay_destroyfunction guc_log_copy_debuglogs_for_relayfunction __get_default_log_levelfunction intel_guc_log_createfunction intel_guc_log_destroyfunction intel_guc_log_set_levelfunction intel_guc_log_relay_createdfunction intel_guc_log_relay_openfunction intel_guc_log_relay_startfunction intel_guc_log_relay_flushfunction guc_log_relay_stopfunction intel_guc_log_relay_closefunction intel_guc_log_handle_flush_eventfunction stringify_guc_log_typefunction intel_guc_log_infofunction intel_guc_log_dump
Annotated Snippet
struct guc_log_section {
u32 max;
u32 flag;
u32 default_val;
const char *name;
};
static void _guc_log_init_sizes(struct intel_guc_log *log)
{
struct intel_guc *guc = log_to_guc(log);
static const struct guc_log_section sections[GUC_LOG_SECTIONS_LIMIT] = {
{
GUC_LOG_CRASH_MASK >> GUC_LOG_CRASH_SHIFT,
GUC_LOG_LOG_ALLOC_UNITS,
GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE,
"crash dump"
},
{
GUC_LOG_DEBUG_MASK >> GUC_LOG_DEBUG_SHIFT,
GUC_LOG_LOG_ALLOC_UNITS,
GUC_LOG_DEFAULT_DEBUG_BUFFER_SIZE,
"debug",
},
{
GUC_LOG_CAPTURE_MASK >> GUC_LOG_CAPTURE_SHIFT,
GUC_LOG_CAPTURE_ALLOC_UNITS,
GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE,
"capture",
}
};
int i;
for (i = 0; i < GUC_LOG_SECTIONS_LIMIT; i++)
log->sizes[i].bytes = sections[i].default_val;
/* If debug size > 1MB then bump default crash size to keep the same units */
if (log->sizes[GUC_LOG_SECTIONS_DEBUG].bytes >= SZ_1M &&
GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE < SZ_1M)
log->sizes[GUC_LOG_SECTIONS_CRASH].bytes = SZ_1M;
/* Prepare the GuC API structure fields: */
for (i = 0; i < GUC_LOG_SECTIONS_LIMIT; i++) {
/* Convert to correct units */
if ((log->sizes[i].bytes % SZ_1M) == 0) {
log->sizes[i].units = SZ_1M;
log->sizes[i].flag = sections[i].flag;
} else {
log->sizes[i].units = SZ_4K;
log->sizes[i].flag = 0;
}
if (!IS_ALIGNED(log->sizes[i].bytes, log->sizes[i].units))
guc_err(guc, "Mis-aligned log %s size: 0x%X vs 0x%X!\n",
sections[i].name, log->sizes[i].bytes, log->sizes[i].units);
log->sizes[i].count = log->sizes[i].bytes / log->sizes[i].units;
if (!log->sizes[i].count) {
guc_err(guc, "Zero log %s size!\n", sections[i].name);
} else {
/* Size is +1 unit */
log->sizes[i].count--;
}
/* Clip to field size */
if (log->sizes[i].count > sections[i].max) {
guc_err(guc, "log %s size too large: %d vs %d!\n",
sections[i].name, log->sizes[i].count + 1, sections[i].max + 1);
log->sizes[i].count = sections[i].max;
}
}
if (log->sizes[GUC_LOG_SECTIONS_CRASH].units != log->sizes[GUC_LOG_SECTIONS_DEBUG].units) {
guc_err(guc, "Unit mismatch for crash and debug sections: %d vs %d!\n",
log->sizes[GUC_LOG_SECTIONS_CRASH].units,
log->sizes[GUC_LOG_SECTIONS_DEBUG].units);
log->sizes[GUC_LOG_SECTIONS_CRASH].units = log->sizes[GUC_LOG_SECTIONS_DEBUG].units;
log->sizes[GUC_LOG_SECTIONS_CRASH].count = 0;
}
log->sizes_initialised = true;
}
static void guc_log_init_sizes(struct intel_guc_log *log)
{
if (log->sizes_initialised)
return;
_guc_log_init_sizes(log);
}
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/string_helpers.h`, `drm/drm_managed.h`, `gt/intel_gt.h`, `i915_drv.h`, `i915_irq.h`, `i915_memcpy.h`, `intel_guc_capture.h`.
- Detected declarations: `struct guc_log_section`, `function _guc_log_init_sizes`, `function guc_log_init_sizes`, `function intel_guc_log_section_size_crash`, `function intel_guc_log_section_size_debug`, `function intel_guc_log_section_size_capture`, `function intel_guc_log_size`, `function guc_action_flush_log_complete`, `function guc_action_flush_log`, `function guc_action_control_log`.
- 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.