drivers/gpu/drm/i915/gt/intel_gt.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/intel_gt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/intel_gt.c- Extension
.c- Size
- 26405 bytes
- Lines
- 1067
- 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
drm/drm_managed.hdrm/intel/intel-gtt.hdrm/intel/intel_gmd_interrupt_regs.hdrm/intel/pci_config.hgem/i915_gem_internal.hgem/i915_gem_lmem.hi915_drv.hi915_perf_oa_regs.hi915_reg.hintel_context.hintel_engine_pm.hintel_engine_regs.hintel_ggtt_gmch.hintel_gt.hintel_gt_buffer_pool.hintel_gt_clock_utils.hintel_gt_debugfs.hintel_gt_mcr.hintel_gt_pm.hintel_gt_print.hintel_gt_regs.hintel_gt_requests.hintel_migrate.hintel_mocs.hintel_rc6.hintel_renderstate.hintel_rps.hintel_sa_media.hintel_gt_sysfs.hintel_tlb.hintel_uncore.hshmem_utils.h
Detected Declarations
function intel_gt_common_init_earlyfunction intel_root_gt_init_earlyfunction intel_gt_probe_lmemfunction intel_gt_assign_ggttfunction intel_gt_init_mmiofunction init_unused_ringfunction init_unused_ringsfunction intel_gt_init_hwfunction gen6_clear_engine_error_registerfunction intel_gt_perf_limit_reasons_regfunction intel_gt_clear_error_registersfunction gen6_check_faultsfunction for_each_enginefunction gen8_report_faultfunction xehp_check_faultsfunction gen8_check_faultsfunction intel_gt_check_and_clear_faultsfunction intel_gt_flush_ggtt_writesfunction with_intel_runtime_pm_if_in_usefunction intel_gt_chipset_flushfunction intel_gt_driver_registerfunction intel_gt_init_scratchfunction intel_gt_fini_scratchfunction __engines_record_defaultsfunction hwfunction __engines_verify_workaroundsfunction for_each_enginefunction __intel_gt_disablefunction intel_gt_wait_for_idlefunction intel_gt_initfunction intel_gt_driver_removefunction intel_gt_driver_unregisterfunction intel_gt_driver_releasefunction intel_gt_driver_late_release_allfunction for_each_gtfunction intel_gt_tile_setupfunction intel_gt_probe_allfunction intel_gt_tiles_initfunction for_each_gtfunction intel_gt_info_printfunction intel_gt_coherent_map_typefunction intel_gt_needs_wa_16018031267function intel_gt_needs_wa_22016122933function __intel_gt_bind_context_set_readyfunction intel_gt_bind_context_set_readyfunction intel_gt_bind_context_set_unreadyfunction intel_gt_is_bind_context_ready
Annotated Snippet
if (fault & RING_FAULT_VALID) {
gt_dbg(gt, "Unexpected fault\n"
"\tAddr: 0x%08x\n"
"\tAddress space: %s\n"
"\tSource ID: %d\n"
"\tType: %d\n",
fault & RING_FAULT_VADDR_MASK,
fault & RING_FAULT_GTTSEL_MASK ?
"GGTT" : "PPGTT",
REG_FIELD_GET(RING_FAULT_SRCID_MASK, fault),
REG_FIELD_GET(RING_FAULT_FAULT_TYPE_MASK, fault));
}
}
}
static void gen8_report_fault(struct intel_gt *gt, u32 fault,
u32 fault_data0, u32 fault_data1)
{
u64 fault_addr;
fault_addr = ((u64)(fault_data1 & FAULT_VA_HIGH_BITS) << 44) |
((u64)fault_data0 << 12);
gt_dbg(gt, "Unexpected fault\n"
"\tAddr: 0x%08x_%08x\n"
"\tAddress space: %s\n"
"\tEngine ID: %d\n"
"\tSource ID: %d\n"
"\tType: %d\n",
upper_32_bits(fault_addr), lower_32_bits(fault_addr),
fault_data1 & FAULT_GTT_SEL ? "GGTT" : "PPGTT",
REG_FIELD_GET(RING_FAULT_ENGINE_ID_MASK, fault),
REG_FIELD_GET(RING_FAULT_SRCID_MASK, fault),
REG_FIELD_GET(RING_FAULT_FAULT_TYPE_MASK, fault));
}
static void xehp_check_faults(struct intel_gt *gt)
{
u32 fault;
/*
* Although the fault register now lives in an MCR register range,
* the GAM registers are special and we only truly need to read
* the "primary" GAM instance rather than handling each instance
* individually. intel_gt_mcr_read_any() will automatically steer
* toward the primary instance.
*/
fault = intel_gt_mcr_read_any(gt, XEHP_RING_FAULT_REG);
if (fault & RING_FAULT_VALID)
gen8_report_fault(gt, fault,
intel_gt_mcr_read_any(gt, XEHP_FAULT_TLB_DATA0),
intel_gt_mcr_read_any(gt, XEHP_FAULT_TLB_DATA1));
}
static void gen8_check_faults(struct intel_gt *gt)
{
struct intel_uncore *uncore = gt->uncore;
i915_reg_t fault_reg, fault_data0_reg, fault_data1_reg;
u32 fault;
if (GRAPHICS_VER(gt->i915) >= 12) {
fault_reg = GEN12_RING_FAULT_REG;
fault_data0_reg = GEN12_FAULT_TLB_DATA0;
fault_data1_reg = GEN12_FAULT_TLB_DATA1;
} else {
fault_reg = GEN8_RING_FAULT_REG;
fault_data0_reg = GEN8_FAULT_TLB_DATA0;
fault_data1_reg = GEN8_FAULT_TLB_DATA1;
}
fault = intel_uncore_read(uncore, fault_reg);
if (fault & RING_FAULT_VALID)
gen8_report_fault(gt, fault,
intel_uncore_read(uncore, fault_data0_reg),
intel_uncore_read(uncore, fault_data1_reg));
}
void intel_gt_check_and_clear_faults(struct intel_gt *gt)
{
struct drm_i915_private *i915 = gt->i915;
/* From GEN8 onwards we only have one 'All Engine Fault Register' */
if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 55))
xehp_check_faults(gt);
else if (GRAPHICS_VER(i915) >= 8)
gen8_check_faults(gt);
else if (GRAPHICS_VER(i915) >= 6)
gen6_check_faults(gt);
else
return;
Annotation
- Immediate include surface: `drm/drm_managed.h`, `drm/intel/intel-gtt.h`, `drm/intel/intel_gmd_interrupt_regs.h`, `drm/intel/pci_config.h`, `gem/i915_gem_internal.h`, `gem/i915_gem_lmem.h`, `i915_drv.h`, `i915_perf_oa_regs.h`.
- Detected declarations: `function intel_gt_common_init_early`, `function intel_root_gt_init_early`, `function intel_gt_probe_lmem`, `function intel_gt_assign_ggtt`, `function intel_gt_init_mmio`, `function init_unused_ring`, `function init_unused_rings`, `function intel_gt_init_hw`, `function gen6_clear_engine_error_register`, `function intel_gt_perf_limit_reasons_reg`.
- 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.