drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgh100.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgh100.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgh100.c- Extension
.c- Size
- 8101 bytes
- Lines
- 307
- 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
vmm.hsubdev/fb.hnvhw/drf.hnvhw/ref/gh100/dev_mmu.h
Detected Declarations
function Copyrightfunction gh100_vmm_pgt_sglfunction gh100_vmm_pgt_dmafunction gh100_vmm_pgt_memfunction gh100_vmm_pgt_sparsefunction gh100_vmm_lpt_invalidfunction gh100_vmm_pd0_ptefunction gh100_vmm_pd0_memfunction gh100_vmm_pdefunction gh100_vmm_pd0_pdefunction gh100_vmm_pd0_sparsefunction gh100_vmm_pd0_unmapfunction gh100_vmm_pd1_pdefunction gh100_vmm_validfunction gh100_vmm_new
Annotated Snippet
while (ptes--) {
const u64 data = *map->dma++ | map->type;
VMM_WO064(pt, vmm, ptei++ * NV_MMU_VER3_PTE__SIZE, data);
}
nvkm_done(pt->memory);
return;
}
VMM_MAP_ITER_DMA(vmm, pt, ptei, ptes, map, gh100_vmm_pgt_pte);
}
static void
gh100_vmm_pgt_mem(struct nvkm_vmm *vmm, struct nvkm_mmu_pt *pt, u32 ptei, u32 ptes,
struct nvkm_vmm_map *map)
{
VMM_MAP_ITER_MEM(vmm, pt, ptei, ptes, map, gh100_vmm_pgt_pte);
}
static void
gh100_vmm_pgt_sparse(struct nvkm_vmm *vmm,
struct nvkm_mmu_pt *pt, u32 ptei, u32 ptes)
{
const u64 data = NVDEF(NV_MMU, VER3_PTE, PCF, SPARSE);
VMM_FO064(pt, vmm, ptei * NV_MMU_VER3_PTE__SIZE, data, ptes);
}
static const struct nvkm_vmm_desc_func
gh100_vmm_desc_spt = {
.unmap = gf100_vmm_pgt_unmap,
.sparse = gh100_vmm_pgt_sparse,
.mem = gh100_vmm_pgt_mem,
.dma = gh100_vmm_pgt_dma,
.sgl = gh100_vmm_pgt_sgl,
};
static void
gh100_vmm_lpt_invalid(struct nvkm_vmm *vmm,
struct nvkm_mmu_pt *pt, u32 ptei, u32 ptes)
{
const u64 data = NVDEF(NV_MMU, VER3_PTE, PCF, NO_VALID_4KB_PAGE);
VMM_FO064(pt, vmm, ptei * NV_MMU_VER3_PTE__SIZE, data, ptes);
}
static const struct nvkm_vmm_desc_func
gh100_vmm_desc_lpt = {
.invalid = gh100_vmm_lpt_invalid,
.unmap = gf100_vmm_pgt_unmap,
.sparse = gh100_vmm_pgt_sparse,
.mem = gh100_vmm_pgt_mem,
};
static inline void
gh100_vmm_pd0_pte(struct nvkm_vmm *vmm, struct nvkm_mmu_pt *pt,
u32 ptei, u32 ptes, struct nvkm_vmm_map *map, u64 addr)
{
u64 data = addr | map->type;
while (ptes--) {
VMM_WO128(pt, vmm, ptei++ * NV_MMU_VER3_DUAL_PDE__SIZE, data, 0ULL);
data += map->next;
}
}
static void
gh100_vmm_pd0_mem(struct nvkm_vmm *vmm, struct nvkm_mmu_pt *pt,
u32 ptei, u32 ptes, struct nvkm_vmm_map *map)
{
VMM_MAP_ITER_MEM(vmm, pt, ptei, ptes, map, gh100_vmm_pd0_pte);
}
static inline bool
gh100_vmm_pde(struct nvkm_mmu_pt *pt, u64 *data)
{
switch (nvkm_memory_target(pt->memory)) {
case NVKM_MEM_TARGET_VRAM:
*data |= NVDEF(NV_MMU, VER3_PDE, APERTURE, VIDEO_MEMORY);
*data |= NVDEF(NV_MMU, VER3_PDE, PCF, VALID_CACHED_ATS_NOT_ALLOWED);
break;
case NVKM_MEM_TARGET_HOST:
*data |= NVDEF(NV_MMU, VER3_PDE, APERTURE, SYSTEM_COHERENT_MEMORY);
*data |= NVDEF(NV_MMU, VER3_PDE, PCF, VALID_UNCACHED_ATS_ALLOWED);
break;
case NVKM_MEM_TARGET_NCOH:
*data |= NVDEF(NV_MMU, VER3_PDE, APERTURE, SYSTEM_NON_COHERENT_MEMORY);
*data |= NVDEF(NV_MMU, VER3_PDE, PCF, VALID_CACHED_ATS_ALLOWED);
break;
default:
Annotation
- Immediate include surface: `vmm.h`, `subdev/fb.h`, `nvhw/drf.h`, `nvhw/ref/gh100/dev_mmu.h`.
- Detected declarations: `function Copyright`, `function gh100_vmm_pgt_sgl`, `function gh100_vmm_pgt_dma`, `function gh100_vmm_pgt_mem`, `function gh100_vmm_pgt_sparse`, `function gh100_vmm_lpt_invalid`, `function gh100_vmm_pd0_pte`, `function gh100_vmm_pd0_mem`, `function gh100_vmm_pde`, `function gh100_vmm_pd0_pde`.
- 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.