Skip to content

Commit 4670ac7

Browse files
committed
drm/amdgpu: expand on GPUVM documentation
Expand the GPUVM documentation to better describe the hardware functionality and use cases it serves. v2: Fixed a couple of spelling mistakes. Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Luben Tuikov <[email protected]> Reviewed-by: Luben Tuikov <[email protected]>
1 parent 57f0198 commit 4670ac7

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,43 @@
4545
/**
4646
* DOC: GPUVM
4747
*
48-
* GPUVM is similar to the legacy gart on older asics, however
49-
* rather than there being a single global gart table
50-
* for the entire GPU, there are multiple VM page tables active
51-
* at any given time. The VM page tables can contain a mix
52-
* vram pages and system memory pages and system memory pages
48+
* GPUVM is the MMU functionality provided on the GPU.
49+
* GPUVM is similar to the legacy GART on older asics, however
50+
* rather than there being a single global GART table
51+
* for the entire GPU, there can be multiple GPUVM page tables active
52+
* at any given time. The GPUVM page tables can contain a mix
53+
* VRAM pages and system pages (both memory and MMIO) and system pages
5354
* can be mapped as snooped (cached system pages) or unsnooped
5455
* (uncached system pages).
55-
* Each VM has an ID associated with it and there is a page table
56-
* associated with each VMID. When executing a command buffer,
57-
* the kernel tells the ring what VMID to use for that command
56+
*
57+
* Each active GPUVM has an ID associated with it and there is a page table
58+
* linked with each VMID. When executing a command buffer,
59+
* the kernel tells the engine what VMID to use for that command
5860
* buffer. VMIDs are allocated dynamically as commands are submitted.
5961
* The userspace drivers maintain their own address space and the kernel
6062
* sets up their pages tables accordingly when they submit their
6163
* command buffers and a VMID is assigned.
62-
* Cayman/Trinity support up to 8 active VMs at any given time;
63-
* SI supports 16.
64+
* The hardware supports up to 16 active GPUVMs at any given time.
65+
*
66+
* Each GPUVM is represented by a 1-2 or 1-5 level page table, depending
67+
* on the ASIC family. GPUVM supports RWX attributes on each page as well
68+
* as other features such as encryption and caching attributes.
69+
*
70+
* VMID 0 is special. It is the GPUVM used for the kernel driver. In
71+
* addition to an aperture managed by a page table, VMID 0 also has
72+
* several other apertures. There is an aperture for direct access to VRAM
73+
* and there is a legacy AGP aperture which just forwards accesses directly
74+
* to the matching system physical addresses (or IOVAs when an IOMMU is
75+
* present). These apertures provide direct access to these memories without
76+
* incurring the overhead of a page table. VMID 0 is used by the kernel
77+
* driver for tasks like memory management.
78+
*
79+
* GPU clients (i.e., engines on the GPU) use GPUVM VMIDs to access memory.
80+
* For user applications, each application can have their own unique GPUVM
81+
* address space. The application manages the address space and the kernel
82+
* driver manages the GPUVM page tables for each process. If an GPU client
83+
* accesses an invalid page, it will generate a GPU page fault, similar to
84+
* accessing an invalid page on a CPU.
6485
*/
6586

6687
#define START(node) ((node)->start)

0 commit comments

Comments
 (0)