drivers/gpu/drm/v3d/v3d_mmu.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/v3d/v3d_mmu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/v3d/v3d_mmu.c- Extension
.c- Size
- 4459 bytes
- Lines
- 164
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/drm_print.hv3d_drv.hv3d_regs.h
Detected Declarations
function outfunction v3d_mmu_flush_all_lockedfunction v3d_mmu_flush_allfunction v3d_mmu_set_page_tablefunction v3d_mmu_insert_ptesfunction for_each_sgtable_dma_sgfunction v3d_mmu_is_alignedfunction v3d_mmu_remove_ptes
Annotated Snippet
while (len > 0) {
u32 page_prot = V3D_PTE_WRITEABLE | V3D_PTE_VALID;
u32 page_address = page_prot | pfn;
unsigned int i, page_size;
BUG_ON(pfn + V3D_PAGE_FACTOR >= BIT(24));
if (len >= SZ_1M &&
v3d_mmu_is_aligned(page, page_address, SZ_1M)) {
page_size = SZ_1M;
page_address |= V3D_PTE_SUPERPAGE;
} else if (len >= SZ_64K &&
v3d_mmu_is_aligned(page, page_address, SZ_64K)) {
page_size = SZ_64K;
page_address |= V3D_PTE_BIGPAGE;
} else {
page_size = SZ_4K;
}
for (i = 0; i < page_size >> V3D_MMU_PAGE_SHIFT; i++) {
v3d->pt[page++] = page_address + i;
pfn++;
}
len -= page_size;
}
}
WARN_ON_ONCE(page - bo->node.start !=
shmem_obj->base.size >> V3D_MMU_PAGE_SHIFT);
if (v3d_mmu_flush_all(v3d))
drm_err(&v3d->drm, "MMU flush timeout\n");
}
void v3d_mmu_remove_ptes(struct v3d_bo *bo)
{
struct v3d_dev *v3d = to_v3d_dev(bo->base.base.dev);
u32 npages = bo->base.base.size >> V3D_MMU_PAGE_SHIFT;
u32 page;
for (page = bo->node.start; page < bo->node.start + npages; page++)
v3d->pt[page] = 0;
if (v3d_mmu_flush_all(v3d))
drm_err(&v3d->drm, "MMU flush timeout\n");
}
Annotation
- Immediate include surface: `drm/drm_print.h`, `v3d_drv.h`, `v3d_regs.h`.
- Detected declarations: `function out`, `function v3d_mmu_flush_all_locked`, `function v3d_mmu_flush_all`, `function v3d_mmu_set_page_table`, `function v3d_mmu_insert_ptes`, `function for_each_sgtable_dma_sg`, `function v3d_mmu_is_aligned`, `function v3d_mmu_remove_ptes`.
- 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.