AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu: add GART, GPUVM, and GTT to glossary
@ 2022-12-01 21:41 Alex Deucher
  2022-12-01 21:41 ` [PATCH 2/2] drm/amdgpu: expand on GPUVM documentation Alex Deucher
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alex Deucher @ 2022-12-01 21:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, Peter Maucher, luben.tuikov

Add definitions to clarify GPU virtual memory.

v2: clarify the terms a bit more

Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
Suggested-by: Peter Maucher <bellosilicio@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 Documentation/gpu/amdgpu/amdgpu-glossary.rst | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/Documentation/gpu/amdgpu/amdgpu-glossary.rst b/Documentation/gpu/amdgpu/amdgpu-glossary.rst
index 326896e9800d..00a47ebb0b0f 100644
--- a/Documentation/gpu/amdgpu/amdgpu-glossary.rst
+++ b/Documentation/gpu/amdgpu/amdgpu-glossary.rst
@@ -30,12 +30,35 @@ we have a dedicated glossary for Display Core at
     EOP
       End Of Pipe/Pipeline
 
+    GART
+      Graphics Address Remapping Table.  This is the name we use for the GPUVM
+      page table used by the GPU kernel driver.  It remaps system resources
+      (memory or MMIO space) into the GPU's address space so the GPU can access
+      them.  The name GART harkens back to the days of AGP when the platform
+      provided an MMU that the GPU could use to get a contiguous view of
+      scattered pages for DMA.  The MMU has since moved on to the GPU, but the
+      name stuck.
+
     GC
       Graphics and Compute
 
     GMC
       Graphic Memory Controller
 
+    GPUVM
+      GPU Virtual Memory.  This is the GPU's MMU.  The GPU supports multiple
+      virtual address spaces that can be in flight at any given time.  These
+      allow the GPU to remap VRAM and system resources into GPU virtual address
+      spaces for use by the GPU kernel driver and applications using the GPU.
+      These provide memory protection for different applications using the GPU.
+
+    GTT
+      Graphics Translation Tables.  This is a memory pool managed through TTM
+      which provides access to system resources (memory or MMIO space) for
+      use by the GPU. These addresses can be mapped into the "GART" GPUVM page
+      table for use by the kernel driver or into per process GPUVM page tables
+      for application usage.
+
     IH
       Interrupt Handler
 
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drm/amdgpu: expand on GPUVM documentation
  2022-12-01 21:41 [PATCH 1/2] drm/amdgpu: add GART, GPUVM, and GTT to glossary Alex Deucher
@ 2022-12-01 21:41 ` Alex Deucher
  2022-12-01 23:04   ` Luben Tuikov
  2022-12-02 12:00 ` [PATCH 1/2] drm/amdgpu: add GART, GPUVM, and GTT to glossary Christian König
  2022-12-02 16:43 ` Bhardwaj, Rajneesh
  2 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2022-12-01 21:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, luben.tuikov

Expand the GPUVM documentation to better describe the
hardware functionality and use cases it serves.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 41 +++++++++++++++++++-------
 1 file changed, 31 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 003aa9e47085..cb57a7bf5e2c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -45,22 +45,43 @@
 /**
  * DOC: GPUVM
  *
- * GPUVM is similar to the legacy gart on older asics, however
- * rather than there being a single global gart table
- * for the entire GPU, there are multiple VM page tables active
- * at any given time.  The VM page tables can contain a mix
- * vram pages and system memory pages and system memory pages
+ * GPUVM is the MMU functionality provided on the GPU.
+ * GPUVM is similar to the legacy GART on older asics, however
+ * rather than there being a single global GART table
+ * for the entire GPU, there can be multiple GPUVM page tables active
+ * at any given time.  The GPUVM page tables can contain a mix
+ * VRAM pages and system pages (both memory and MMIO) and system pages
  * can be mapped as snooped (cached system pages) or unsnooped
  * (uncached system pages).
- * Each VM has an ID associated with it and there is a page table
- * associated with each VMID.  When executing a command buffer,
- * the kernel tells the ring what VMID to use for that command
+ *
+ * Each active GPUVM has an ID associated with it and there is a page table
+ * linked with each VMID.  When executing a command buffer,
+ * the kernel tells the engine what VMID to use for that command
  * buffer.  VMIDs are allocated dynamically as commands are submitted.
  * The userspace drivers maintain their own address space and the kernel
  * sets up their pages tables accordingly when they submit their
  * command buffers and a VMID is assigned.
- * Cayman/Trinity support up to 8 active VMs at any given time;
- * SI supports 16.
+ * The hardware supports up to 16 active GPUVMs at any given time.
+ *
+ * Each GPUVM is represented by a 1-2 or 1-5 level page table, depending
+ * on the ASIC family.  GPUVM supports RWX attibutes on each page as well
+ * as other features such as encryption and caching attributes.
+ *
+ * VMID 0 is special.  It is the GPUVM used for the kernel driver.  In
+ * addition to an aperture managed by a page table, VMID 0 also has
+ * several other apertures.  There is an aperture for direct access to VRAM
+ * and there is a legacy AGP aperture which just forwards accesses directly
+ * to the matching system physical addresses (or IOVAs when an IOMMU is
+ * present).  These apertures provide direct access to these memories without
+ * incurring the overhead of a page table.  VMID 0 is used by the kernel
+ * driver for tasks like memory management.
+ *
+ * GPU clients (i.e., engines on the GPU) use GPUVM VMIDs to access memory.
+ * For user applications, each application can have their own unqiue GPUVM
+ * address space.  The application manages the address space and the kernel
+ * driver manages the GPUVM page tables for each process.  If an GPU client
+ * accesses an invalid page, it will generate a GPU page fault, similar to
+ * accessing an invalid page on a CPU.
  */
 
 #define START(node) ((node)->start)
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] drm/amdgpu: expand on GPUVM documentation
  2022-12-01 21:41 ` [PATCH 2/2] drm/amdgpu: expand on GPUVM documentation Alex Deucher
@ 2022-12-01 23:04   ` Luben Tuikov
  0 siblings, 0 replies; 5+ messages in thread
From: Luben Tuikov @ 2022-12-01 23:04 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx

Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>

Regards,
Luben

On 2022-12-01 16:41, Alex Deucher wrote:
> Expand the GPUVM documentation to better describe the
> hardware functionality and use cases it serves.
> 
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 41 +++++++++++++++++++-------
>  1 file changed, 31 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 003aa9e47085..cb57a7bf5e2c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -45,22 +45,43 @@
>  /**
>   * DOC: GPUVM
>   *
> - * GPUVM is similar to the legacy gart on older asics, however
> - * rather than there being a single global gart table
> - * for the entire GPU, there are multiple VM page tables active
> - * at any given time.  The VM page tables can contain a mix
> - * vram pages and system memory pages and system memory pages
> + * GPUVM is the MMU functionality provided on the GPU.
> + * GPUVM is similar to the legacy GART on older asics, however
> + * rather than there being a single global GART table
> + * for the entire GPU, there can be multiple GPUVM page tables active
> + * at any given time.  The GPUVM page tables can contain a mix
> + * VRAM pages and system pages (both memory and MMIO) and system pages
>   * can be mapped as snooped (cached system pages) or unsnooped
>   * (uncached system pages).
> - * Each VM has an ID associated with it and there is a page table
> - * associated with each VMID.  When executing a command buffer,
> - * the kernel tells the ring what VMID to use for that command
> + *
> + * Each active GPUVM has an ID associated with it and there is a page table
> + * linked with each VMID.  When executing a command buffer,
> + * the kernel tells the engine what VMID to use for that command
>   * buffer.  VMIDs are allocated dynamically as commands are submitted.
>   * The userspace drivers maintain their own address space and the kernel
>   * sets up their pages tables accordingly when they submit their
>   * command buffers and a VMID is assigned.
> - * Cayman/Trinity support up to 8 active VMs at any given time;
> - * SI supports 16.
> + * The hardware supports up to 16 active GPUVMs at any given time.
> + *
> + * Each GPUVM is represented by a 1-2 or 1-5 level page table, depending
> + * on the ASIC family.  GPUVM supports RWX attibutes on each page as well
> + * as other features such as encryption and caching attributes.
> + *
> + * VMID 0 is special.  It is the GPUVM used for the kernel driver.  In
> + * addition to an aperture managed by a page table, VMID 0 also has
> + * several other apertures.  There is an aperture for direct access to VRAM
> + * and there is a legacy AGP aperture which just forwards accesses directly
> + * to the matching system physical addresses (or IOVAs when an IOMMU is
> + * present).  These apertures provide direct access to these memories without
> + * incurring the overhead of a page table.  VMID 0 is used by the kernel
> + * driver for tasks like memory management.
> + *
> + * GPU clients (i.e., engines on the GPU) use GPUVM VMIDs to access memory.
> + * For user applications, each application can have their own unqiue GPUVM
> + * address space.  The application manages the address space and the kernel
> + * driver manages the GPUVM page tables for each process.  If an GPU client
> + * accesses an invalid page, it will generate a GPU page fault, similar to
> + * accessing an invalid page on a CPU.
>   */
>  
>  #define START(node) ((node)->start)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu: add GART, GPUVM, and GTT to glossary
  2022-12-01 21:41 [PATCH 1/2] drm/amdgpu: add GART, GPUVM, and GTT to glossary Alex Deucher
  2022-12-01 21:41 ` [PATCH 2/2] drm/amdgpu: expand on GPUVM documentation Alex Deucher
@ 2022-12-02 12:00 ` Christian König
  2022-12-02 16:43 ` Bhardwaj, Rajneesh
  2 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2022-12-02 12:00 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx; +Cc: luben.tuikov, Peter Maucher

Am 01.12.22 um 22:41 schrieb Alex Deucher:
> Add definitions to clarify GPU virtual memory.
>
> v2: clarify the terms a bit more
>
> Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
> Suggested-by: Peter Maucher <bellosilicio@gmail.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com> for the series.

> ---
>   Documentation/gpu/amdgpu/amdgpu-glossary.rst | 23 ++++++++++++++++++++
>   1 file changed, 23 insertions(+)
>
> diff --git a/Documentation/gpu/amdgpu/amdgpu-glossary.rst b/Documentation/gpu/amdgpu/amdgpu-glossary.rst
> index 326896e9800d..00a47ebb0b0f 100644
> --- a/Documentation/gpu/amdgpu/amdgpu-glossary.rst
> +++ b/Documentation/gpu/amdgpu/amdgpu-glossary.rst
> @@ -30,12 +30,35 @@ we have a dedicated glossary for Display Core at
>       EOP
>         End Of Pipe/Pipeline
>   
> +    GART
> +      Graphics Address Remapping Table.  This is the name we use for the GPUVM
> +      page table used by the GPU kernel driver.  It remaps system resources
> +      (memory or MMIO space) into the GPU's address space so the GPU can access
> +      them.  The name GART harkens back to the days of AGP when the platform
> +      provided an MMU that the GPU could use to get a contiguous view of
> +      scattered pages for DMA.  The MMU has since moved on to the GPU, but the
> +      name stuck.
> +
>       GC
>         Graphics and Compute
>   
>       GMC
>         Graphic Memory Controller
>   
> +    GPUVM
> +      GPU Virtual Memory.  This is the GPU's MMU.  The GPU supports multiple
> +      virtual address spaces that can be in flight at any given time.  These
> +      allow the GPU to remap VRAM and system resources into GPU virtual address
> +      spaces for use by the GPU kernel driver and applications using the GPU.
> +      These provide memory protection for different applications using the GPU.
> +
> +    GTT
> +      Graphics Translation Tables.  This is a memory pool managed through TTM
> +      which provides access to system resources (memory or MMIO space) for
> +      use by the GPU. These addresses can be mapped into the "GART" GPUVM page
> +      table for use by the kernel driver or into per process GPUVM page tables
> +      for application usage.
> +
>       IH
>         Interrupt Handler
>   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] drm/amdgpu: add GART, GPUVM, and GTT to glossary
  2022-12-01 21:41 [PATCH 1/2] drm/amdgpu: add GART, GPUVM, and GTT to glossary Alex Deucher
  2022-12-01 21:41 ` [PATCH 2/2] drm/amdgpu: expand on GPUVM documentation Alex Deucher
  2022-12-02 12:00 ` [PATCH 1/2] drm/amdgpu: add GART, GPUVM, and GTT to glossary Christian König
@ 2022-12-02 16:43 ` Bhardwaj, Rajneesh
  2 siblings, 0 replies; 5+ messages in thread
From: Bhardwaj, Rajneesh @ 2022-12-02 16:43 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx; +Cc: luben.tuikov, Peter Maucher

Both patches are:

Reviewed-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>

On 12/1/2022 4:41 PM, Alex Deucher wrote:
> Add definitions to clarify GPU virtual memory.
>
> v2: clarify the terms a bit more
>
> Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
> Suggested-by: Peter Maucher <bellosilicio@gmail.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>   Documentation/gpu/amdgpu/amdgpu-glossary.rst | 23 ++++++++++++++++++++
>   1 file changed, 23 insertions(+)
>
> diff --git a/Documentation/gpu/amdgpu/amdgpu-glossary.rst b/Documentation/gpu/amdgpu/amdgpu-glossary.rst
> index 326896e9800d..00a47ebb0b0f 100644
> --- a/Documentation/gpu/amdgpu/amdgpu-glossary.rst
> +++ b/Documentation/gpu/amdgpu/amdgpu-glossary.rst
> @@ -30,12 +30,35 @@ we have a dedicated glossary for Display Core at
>       EOP
>         End Of Pipe/Pipeline
>   
> +    GART
> +      Graphics Address Remapping Table.  This is the name we use for the GPUVM
> +      page table used by the GPU kernel driver.  It remaps system resources
> +      (memory or MMIO space) into the GPU's address space so the GPU can access
> +      them.  The name GART harkens back to the days of AGP when the platform
> +      provided an MMU that the GPU could use to get a contiguous view of
> +      scattered pages for DMA.  The MMU has since moved on to the GPU, but the
> +      name stuck.
> +
>       GC
>         Graphics and Compute
>   
>       GMC
>         Graphic Memory Controller
>   
> +    GPUVM
> +      GPU Virtual Memory.  This is the GPU's MMU.  The GPU supports multiple
> +      virtual address spaces that can be in flight at any given time.  These
> +      allow the GPU to remap VRAM and system resources into GPU virtual address
> +      spaces for use by the GPU kernel driver and applications using the GPU.
> +      These provide memory protection for different applications using the GPU.
> +
> +    GTT
> +      Graphics Translation Tables.  This is a memory pool managed through TTM
> +      which provides access to system resources (memory or MMIO space) for
> +      use by the GPU. These addresses can be mapped into the "GART" GPUVM page
> +      table for use by the kernel driver or into per process GPUVM page tables
> +      for application usage.
> +
>       IH
>         Interrupt Handler
>   

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-02 16:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-01 21:41 [PATCH 1/2] drm/amdgpu: add GART, GPUVM, and GTT to glossary Alex Deucher
2022-12-01 21:41 ` [PATCH 2/2] drm/amdgpu: expand on GPUVM documentation Alex Deucher
2022-12-01 23:04   ` Luben Tuikov
2022-12-02 12:00 ` [PATCH 1/2] drm/amdgpu: add GART, GPUVM, and GTT to glossary Christian König
2022-12-02 16:43 ` Bhardwaj, Rajneesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox