Skip to contentSkip to conversation

drm/amdgpu: Add comments to gmc structure

PATCH In review Zeng, Oak 3 participants 4 messages Nov 6, 2019 – Nov 7, 2019 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Zeng, Oak

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Add comments to gmc structure

Explain fields like aper_base, agp_start etc. The definition of those fields are confusing as they are from different view (CPU or GPU). Add comments for easier understand.

Change-Id I02c2a27cd0dbc205498eb86aafa722f2e0c25fe6
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +25 -0
index 555d8e5..8003201 100644
@@ -127,18 +127,43 @@ struct amdgpu_xgmi {
 };
 
 struct amdgpu_gmc {
+	/* FB's physical address in MMIO space (for CPU to
+	 * map FB). This is different compared to the apg/
+	 * gart/vram_start/end field as the later is from
+	 * GPU's view and aper_base is from CPU's view.
+	 */
 	resource_size_t		aper_size;
 	resource_size_t		aper_base;
 	/* for some chips with <= 32MB we need to lie
 	 * about vram size near mc fb location */
 	u64			mc_vram_size;
 	u64			visible_vram_size;
+	/* APG aperture start and end in MC address space
+	 * Driver find a hole in the MC address space
+	 * to place AGP by setting MC_VM_AGP_BOT/TOP registers
+	 * Under VMID0, logical address == MC address
+	 * AGP aperture is used to simulate FB in ZFB case
+	 */
 	u64			agp_size;
 	u64			agp_start;
 	u64			agp_end;
+	/* GART aperture start and end in MC address space
+	 * Driver find a hole in the MC address space
+	 * to place GART by setting VM_CONTEXT0_PAGE_TABLE_START/END_ADDR
+	 * registers
+	 * Under VMID0, logical address inside GART aperture will
+	 * be translated through gpuvm gart page table to access
+	 * paged system memory
+	 */
 	u64			gart_size;
 	u64			gart_start;
 	u64			gart_end;
+	/* Frame buffer aperture of this GPU device. Different from
+	 * fb_start (see below), this only covers the local GPU device.
+	 * Driver get fb_start from MC_VM_FB_LOCATION_BASE (set by vbios)
+	 * and calculate vram_start of this local device by adding an
+	 * offset inside the XGMI hive.
+	 */
 	u64			vram_start;
 	u64			vram_end;
 	/* FB region , it's same as local vram region in single GPU, in XGMI
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1573060895-13033-1-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 7 lines · Oak

Explain fields like aper_base, agp_start etc. The definition of those fields are confusing as they are from different view (CPU or GPU). Add comments for easier understand.

Change-Id I02c2a27cd0dbc205498eb86aafa722f2e0c25fe6

A few comments below, otherwise looks good to me.

Quoted 9 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +0 -0
index 555d8e5..8003201 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h struct amdgpu_xgmi { · line 131

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +2 -0
@@ -127,18 +127,43 @@ struct amdgpu_xgmi {
 };
 
 struct amdgpu_gmc {
+       /* FB's physical address in MMIO space (for CPU to
+        * map FB). This is different compared to the apg/

apg -> agp

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h struct amdgpu_xgmi { · line 141

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +4 -0
+        * gart/vram_start/end field as the later is from
+        * GPU's view and aper_base is from CPU's view.
+        */
        resource_size_t         aper_size;
        resource_size_t         aper_base;
        /* for some chips with <= 32MB we need to lie
         * about vram size near mc fb location */
        u64                     mc_vram_size;
        u64                     visible_vram_size;
+       /* APG aperture start and end in MC address space

APG -> AGP

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h struct amdgpu_xgmi { · line 146

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +5 -0
+        * Driver find a hole in the MC address space
+        * to place AGP by setting MC_VM_AGP_BOT/TOP registers
+        * Under VMID0, logical address == MC address
+        * AGP aperture is used to simulate FB in ZFB case
+        */

You may want to add a comment that the AGP aperture just maps to physical bus or IOVA addresses on the platform. It's also used for page tables in system memory.

Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +14 -1
        u64                     agp_size;
        u64                     agp_start;
        u64                     agp_end;
+       /* GART aperture start and end in MC address space
+        * Driver find a hole in the MC address space
+        * to place GART by setting VM_CONTEXT0_PAGE_TABLE_START/END_ADDR
+        * registers
+        * Under VMID0, logical address inside GART aperture will
+        * be translated through gpuvm gart page table to access
+        * paged system memory
+        */
        u64                     gart_size;
        u64                     gart_start;
        u64                     gart_end;
+       /* Frame buffer aperture of this GPU device. Different from
+        * fb_start (see below), this only covers the local GPU device.
+        * Driver get fb_start from MC_VM_FB_LOCATION_BASE (set by vbios)
+        * and calculate vram_start of this local device by adding an
+        * offset inside the XGMI hive.
+        */
        u64                     vram_start;
        u64                     vram_end;
        /* FB region , it's same as local vram region in single GPU, in XGMI
--

2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_NAyRJF-26XV-QnVEQ4pD9NobmBvcGcnJTUqcO0OOe62Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#4 lore raw

Thanks Alex.

Quoted 1 line

AGP is also used for page tables in system memory.

I am not aware of this usage. I thought page table are all in frame buffer today. Was this a use case in old asics?

Oak

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, November 6, 2019 12:37 PM
To: Zeng, Oak <[email protected]>
Cc: [email protected]; Kuehling, Felix <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Add comments to gmc structure

Quoted 7 lines · Oak

Explain fields like aper_base, agp_start etc. The definition of those fields are confusing as they are from different view (CPU or GPU). Add comments for easier understand.

Change-Id I02c2a27cd0dbc205498eb86aafa722f2e0c25fe6

A few comments below, otherwise looks good to me.

Quoted 11 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 25 
+++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +0 -0
index 555d8e5..8003201 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h struct amdgpu_xgmi { }; · line 130

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +2 -0
@@ -127,18 +127,43 @@ struct amdgpu_xgmi {  };
 
 struct amdgpu_gmc {
+       /* FB's physical address in MMIO space (for CPU to
+        * map FB). This is different compared to the apg/

apg -> agp

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h struct amdgpu_xgmi { · line 141

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +4 -0
+        * gart/vram_start/end field as the later is from
+        * GPU's view and aper_base is from CPU's view.
+        */
        resource_size_t         aper_size;
        resource_size_t         aper_base;
        /* for some chips with <= 32MB we need to lie
         * about vram size near mc fb location */
        u64                     mc_vram_size;
        u64                     visible_vram_size;
+       /* APG aperture start and end in MC address space

APG -> AGP

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h struct amdgpu_xgmi { · line 146

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +5 -0
+        * Driver find a hole in the MC address space
+        * to place AGP by setting MC_VM_AGP_BOT/TOP registers
+        * Under VMID0, logical address == MC address
+        * AGP aperture is used to simulate FB in ZFB case
+        */

You may want to add a comment that the AGP aperture just maps to physical bus or IOVA addresses on the platform. It's also used for page tables in system memory.

Quoted 27 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +14 -0
        u64                     agp_size;
        u64                     agp_start;
        u64                     agp_end;
+       /* GART aperture start and end in MC address space
+        * Driver find a hole in the MC address space
+        * to place GART by setting VM_CONTEXT0_PAGE_TABLE_START/END_ADDR
+        * registers
+        * Under VMID0, logical address inside GART aperture will
+        * be translated through gpuvm gart page table to access
+        * paged system memory
+        */
        u64                     gart_size;
        u64                     gart_start;
        u64                     gart_end;
+       /* Frame buffer aperture of this GPU device. Different from
+        * fb_start (see below), this only covers the local GPU device.
+        * Driver get fb_start from MC_VM_FB_LOCATION_BASE (set by vbios)
+        * and calculate vram_start of this local device by adding an
+        * offset inside the XGMI hive.
+        */
        u64                     vram_start;
        u64                     vram_end;
        /* FB region , it's same as local vram region in single GPU, 

in XGMI
--
2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BL0PR12MB25806AAB4587D5E2AD0FCCBA80790-b4cIHhjg/p/[email protected]

#6 lore raw

Am 06.11.19 um 21:05 schrieb Zeng, Oak:

Quoted 4 lines

Thanks Alex.

Quoted 1 line

AGP is also used for page tables in system memory.

I am not aware of this usage. I thought page table are all in frame buffer today. Was this a use case in old asics?

No, that is pretty new and only works for Renoir. But we have disabled it currently because of bad interactions with IOMMU.

Christian.

Quoted 46 lines

Oak

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, November 6, 2019 12:37 PM
To: Zeng, Oak <[email protected]>
Cc: [email protected]; Kuehling, Felix <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Add comments to gmc structure

Quoted 6 lines · Oak

Explain fields like aper_base, agp_start etc. The definition of those fields are confusing as they are from different view (CPU or GPU). Add comments for easier understand.

Change-Id I02c2a27cd0dbc205498eb86aafa722f2e0c25fe6

A few comments below, otherwise looks good to me.

Quoted 11 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 25
+++++++++++++++++++++++++
  1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +0 -0
index 555d8e5..8003201 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h struct amdgpu_xgmi { }; · line 130

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +2 -0
@@ -127,18 +127,43 @@ struct amdgpu_xgmi {  };
 
  struct amdgpu_gmc {
+       /* FB's physical address in MMIO space (for CPU to
+        * map FB). This is different compared to the apg/

apg -> agp

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h struct amdgpu_xgmi { · line 141

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +4 -0
+        * gart/vram_start/end field as the later is from
+        * GPU's view and aper_base is from CPU's view.
+        */
         resource_size_t         aper_size;
         resource_size_t         aper_base;
         /* for some chips with <= 32MB we need to lie
          * about vram size near mc fb location */
         u64                     mc_vram_size;
         u64                     visible_vram_size;
+       /* APG aperture start and end in MC address space
Quoted 40 lines

APG -> AGP

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h struct amdgpu_xgmi { · line 146

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +5 -0
+        * Driver find a hole in the MC address space
+        * to place AGP by setting MC_VM_AGP_BOT/TOP registers
+        * Under VMID0, logical address == MC address
+        * AGP aperture is used to simulate FB in ZFB case
+        */

You may want to add a comment that the AGP aperture just maps to physical bus or IOVA addresses on the platform. It's also used for page tables in system memory.

Quoted 31 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +14 -0
         u64                     agp_size;
         u64                     agp_start;
         u64                     agp_end;
+       /* GART aperture start and end in MC address space
+        * Driver find a hole in the MC address space
+        * to place GART by setting VM_CONTEXT0_PAGE_TABLE_START/END_ADDR
+        * registers
+        * Under VMID0, logical address inside GART aperture will
+        * be translated through gpuvm gart page table to access
+        * paged system memory
+        */
         u64                     gart_size;
         u64                     gart_start;
         u64                     gart_end;
+       /* Frame buffer aperture of this GPU device. Different from
+        * fb_start (see below), this only covers the local GPU device.
+        * Driver get fb_start from MC_VM_FB_LOCATION_BASE (set by vbios)
+        * and calculate vram_start of this local device by adding an
+        * offset inside the XGMI hive.
+        */
         u64                     vram_start;
         u64                     vram_end;
         /* FB region , it's same as local vram region in single GPU,

in XGMI
--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx