drivers/gpu/drm/i915/gt/intel_ggtt.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/intel_ggtt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/intel_ggtt.c- Extension
.c- Size
- 44506 bytes
- Lines
- 1683
- 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
asm/set_memory.hasm/smp.hlinux/types.hlinux/stop_machine.hdrm/drm_managed.hdrm/drm_print.hdrm/intel/i915_drm.hdrm/intel/intel-gtt.hdrm/intel/pci_config.hgem/i915_gem_lmem.hintel_context.hintel_ggtt_gmch.hintel_gpu_commands.hintel_gt.hintel_gt_regs.hintel_ring.hi915_drv.hi915_pci.hi915_reg.hi915_request.hi915_scatterlist.hi915_utils.hi915_vgpu.hintel_gtt.hgen8_ppgtt.hintel_engine_pm.h
Detected Declarations
struct insert_pagestruct insert_entriesfunction i915_ggtt_color_adjustfunction ggtt_init_hwfunction i915_ggtt_init_hwfunction i915_ggtt_suspend_vmfunction list_for_each_entry_safefunction i915_ggtt_suspendfunction gen6_ggtt_invalidatefunction needs_wc_ggtt_mappingfunction gen8_ggtt_invalidatefunction guc_ggtt_ct_invalidatefunction guc_ggtt_invalidatefunction list_for_each_entryfunction mtl_ggtt_pte_encodefunction gen8_ggtt_pte_encodefunction gen8_ggtt_pte_decodefunction should_update_ggtt_with_bindfunction gen8_ggtt_bind_put_cefunction gen8_ggtt_bind_ptesfunction gen8_set_ptefunction gen8_get_ptefunction gen8_ggtt_insert_pagefunction gen8_ggtt_read_entryfunction gen8_ggtt_insert_page_bindfunction gen8_ggtt_insert_entriesfunction __gen8_ggtt_insert_entries_bindfunction gen8_ggtt_insert_entries_bindfunction gen8_ggtt_clear_rangefunction gen8_ggtt_scratch_range_bindfunction gen6_ggtt_insert_pagefunction gen6_ggtt_read_entryfunction BARfunction nop_clear_rangefunction bxt_vtd_ggtt_insert_page__cbfunction bxt_vtd_ggtt_insert_page__BKLfunction bxt_vtd_ggtt_insert_entries__cbfunction bxt_vtd_ggtt_insert_entries__BKLfunction gen6_ggtt_clear_rangefunction intel_ggtt_bind_vmafunction intel_ggtt_unbind_vmafunction intel_ggtt_read_entryfunction uc_fw_ggtt_offsetfunction ggtt_release_guc_topfunction cleanup_init_ggttfunction init_ggttfunction aliasing_gtt_bind_vmafunction aliasing_gtt_unbind_vma
Annotated Snippet
struct insert_page {
struct i915_address_space *vm;
dma_addr_t addr;
u64 offset;
unsigned int pat_index;
};
static int bxt_vtd_ggtt_insert_page__cb(void *_arg)
{
struct insert_page *arg = _arg;
gen8_ggtt_insert_page(arg->vm, arg->addr, arg->offset,
arg->pat_index, 0);
bxt_vtd_ggtt_wa(arg->vm);
return 0;
}
static void bxt_vtd_ggtt_insert_page__BKL(struct i915_address_space *vm,
dma_addr_t addr,
u64 offset,
unsigned int pat_index,
u32 unused)
{
struct insert_page arg = { vm, addr, offset, pat_index };
stop_machine(bxt_vtd_ggtt_insert_page__cb, &arg, NULL);
}
struct insert_entries {
struct i915_address_space *vm;
struct i915_vma_resource *vma_res;
unsigned int pat_index;
u32 flags;
};
static int bxt_vtd_ggtt_insert_entries__cb(void *_arg)
{
struct insert_entries *arg = _arg;
gen8_ggtt_insert_entries(arg->vm, arg->vma_res,
arg->pat_index, arg->flags);
bxt_vtd_ggtt_wa(arg->vm);
return 0;
}
static void bxt_vtd_ggtt_insert_entries__BKL(struct i915_address_space *vm,
struct i915_vma_resource *vma_res,
unsigned int pat_index,
u32 flags)
{
struct insert_entries arg = { vm, vma_res, pat_index, flags };
stop_machine(bxt_vtd_ggtt_insert_entries__cb, &arg, NULL);
}
static void gen6_ggtt_clear_range(struct i915_address_space *vm,
u64 start, u64 length)
{
struct i915_ggtt *ggtt = i915_vm_to_ggtt(vm);
unsigned int first_entry = start / I915_GTT_PAGE_SIZE;
unsigned int num_entries = length / I915_GTT_PAGE_SIZE;
gen6_pte_t scratch_pte, __iomem *gtt_base =
(gen6_pte_t __iomem *)ggtt->gsm + first_entry;
const int max_entries = ggtt_total_entries(ggtt) - first_entry;
int i;
if (WARN(num_entries > max_entries,
"First entry = %d; Num entries = %d (max=%d)\n",
first_entry, num_entries, max_entries))
num_entries = max_entries;
scratch_pte = vm->scratch[0]->encode;
for (i = 0; i < num_entries; i++)
iowrite32(scratch_pte, >t_base[i]);
}
void intel_ggtt_bind_vma(struct i915_address_space *vm,
struct i915_vm_pt_stash *stash,
struct i915_vma_resource *vma_res,
unsigned int pat_index,
u32 flags)
{
u32 pte_flags;
if (vma_res->bound_flags & (~flags & I915_VMA_BIND_MASK))
return;
vma_res->bound_flags |= flags;
Annotation
- Immediate include surface: `asm/set_memory.h`, `asm/smp.h`, `linux/types.h`, `linux/stop_machine.h`, `drm/drm_managed.h`, `drm/drm_print.h`, `drm/intel/i915_drm.h`, `drm/intel/intel-gtt.h`.
- Detected declarations: `struct insert_page`, `struct insert_entries`, `function i915_ggtt_color_adjust`, `function ggtt_init_hw`, `function i915_ggtt_init_hw`, `function i915_ggtt_suspend_vm`, `function list_for_each_entry_safe`, `function i915_ggtt_suspend`, `function gen6_ggtt_invalidate`, `function needs_wc_ggtt_mapping`.
- 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.