Skip to contentSkip to conversation

drm/amdgpu: setup the shared and private apertures on gfx9

PATCH In review Alex Deucher 3 participants 4 messages Dec 8, 2017 – Dec 29, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: setup the shared and private apertures on gfx9

Same as previous asics. This was not yet set for gfx9.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 17 ++++++++++++-----
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c |  8 ++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +12 -5
index 3fd13b77e71e..7564f87b084e 100644
@@ -1529,11 +1529,18 @@ static void gfx_v9_0_gpu_init(struct amdgpu_device *adev)
 	for (i = 0; i < 16; i++) {
 		soc15_grbm_select(adev, 0, 0, 0, i);
 		/* CP and shaders */
-		tmp = 0;
-		tmp = REG_SET_FIELD(tmp, SH_MEM_CONFIG, ALIGNMENT_MODE,
-				    SH_MEM_ALIGNMENT_MODE_UNALIGNED);
-		WREG32_SOC15(GC, 0, mmSH_MEM_CONFIG, tmp);
-		WREG32_SOC15(GC, 0, mmSH_MEM_BASES, 0);
+		if (i == 0) {
+			tmp = REG_SET_FIELD(0, SH_MEM_CONFIG, ALIGNMENT_MODE,
+					    SH_MEM_ALIGNMENT_MODE_UNALIGNED);
+			WREG32_SOC15(GC, 0, mmSH_MEM_CONFIG, tmp);
+			WREG32_SOC15(GC, 0, mmSH_MEM_BASES, 0);
+		} else {
+			tmp = REG_SET_FIELD(0, SH_MEM_CONFIG, ALIGNMENT_MODE,
+					    SH_MEM_ALIGNMENT_MODE_UNALIGNED);
+			WREG32_SOC15(GC, 0, mmSH_MEM_CONFIG, tmp);
+			tmp = adev->mc.shared_aperture_start >> 48;
+			WREG32_SOC15(GC, 0, mmSH_MEM_BASES, tmp);
+		}
 	}
 	soc15_grbm_select(adev, 0, 0, 0, 0);
 
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -0
index 695e0eada1cd..dbfb746a390c 100644
@@ -497,6 +497,14 @@ static int gmc_v9_0_early_init(void *handle)
 	gmc_v9_0_set_gart_funcs(adev);
 	gmc_v9_0_set_irq_funcs(adev);
 
+	adev->mc.shared_aperture_start = 0x2000000000000000ULL;
+	adev->mc.shared_aperture_end =
+		adev->mc.shared_aperture_start + (4ULL << 30) - 1;
+	adev->mc.private_aperture_start =
+		adev->mc.shared_aperture_end + 1;
+	adev->mc.private_aperture_end =
+		adev->mc.private_aperture_start + (4ULL << 30) - 1;
+
 	return 0;
 }
 
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#2 lore raw
In reply to a message not in the archive
Quoted 1 line · Alex Deucher

Same as previous asics. This was not yet set for gfx9.

Ping?

Quoted 55 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 17 ++++++++++++-----
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c |  8 ++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +12 -5
index 3fd13b77e71e..7564f87b084e 100644
@@ -1529,11 +1529,18 @@ static void gfx_v9_0_gpu_init(struct amdgpu_device *adev)
        for (i = 0; i < 16; i++) {
                soc15_grbm_select(adev, 0, 0, 0, i);
                /* CP and shaders */
-               tmp = 0;
-               tmp = REG_SET_FIELD(tmp, SH_MEM_CONFIG, ALIGNMENT_MODE,
-                                   SH_MEM_ALIGNMENT_MODE_UNALIGNED);
-               WREG32_SOC15(GC, 0, mmSH_MEM_CONFIG, tmp);
-               WREG32_SOC15(GC, 0, mmSH_MEM_BASES, 0);
+               if (i == 0) {
+                       tmp = REG_SET_FIELD(0, SH_MEM_CONFIG, ALIGNMENT_MODE,
+                                           SH_MEM_ALIGNMENT_MODE_UNALIGNED);
+                       WREG32_SOC15(GC, 0, mmSH_MEM_CONFIG, tmp);
+                       WREG32_SOC15(GC, 0, mmSH_MEM_BASES, 0);
+               } else {
+                       tmp = REG_SET_FIELD(0, SH_MEM_CONFIG, ALIGNMENT_MODE,
+                                           SH_MEM_ALIGNMENT_MODE_UNALIGNED);
+                       WREG32_SOC15(GC, 0, mmSH_MEM_CONFIG, tmp);
+                       tmp = adev->mc.shared_aperture_start >> 48;
+                       WREG32_SOC15(GC, 0, mmSH_MEM_BASES, tmp);
+               }
        }
        soc15_grbm_select(adev, 0, 0, 0, 0);
 
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -1
index 695e0eada1cd..dbfb746a390c 100644
@@ -497,6 +497,14 @@ static int gmc_v9_0_early_init(void *handle)
        gmc_v9_0_set_gart_funcs(adev);
        gmc_v9_0_set_irq_funcs(adev);
 
+       adev->mc.shared_aperture_start = 0x2000000000000000ULL;
+       adev->mc.shared_aperture_end =
+               adev->mc.shared_aperture_start + (4ULL << 30) - 1;
+       adev->mc.private_aperture_start =
+               adev->mc.shared_aperture_end + 1;
+       adev->mc.private_aperture_end =
+               adev->mc.private_aperture_start + (4ULL << 30) - 1;
+
        return 0;
 }
 
--
Quoted 2 lines

2.13.6

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

#4 lore raw
In reply to a message not in the archive

Am 14.12.2017 um 16:25 schrieb Alex Deucher:

Quoted 3 lines · Alex Deucher
Quoted 1 line

Same as previous asics. This was not yet set for gfx9.

Ping?

Quoted 54 lines
Quoted 54 lines
---
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 17 ++++++++++++-----
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c |  8 ++++++++
  2 files changed, 20 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +12 -5
index 3fd13b77e71e..7564f87b084e 100644
@@ -1529,11 +1529,18 @@ static void gfx_v9_0_gpu_init(struct amdgpu_device *adev)
         for (i = 0; i < 16; i++) {
                 soc15_grbm_select(adev, 0, 0, 0, i);
                 /* CP and shaders */
-               tmp = 0;
-               tmp = REG_SET_FIELD(tmp, SH_MEM_CONFIG, ALIGNMENT_MODE,
-                                   SH_MEM_ALIGNMENT_MODE_UNALIGNED);
-               WREG32_SOC15(GC, 0, mmSH_MEM_CONFIG, tmp);
-               WREG32_SOC15(GC, 0, mmSH_MEM_BASES, 0);
+               if (i == 0) {
+                       tmp = REG_SET_FIELD(0, SH_MEM_CONFIG, ALIGNMENT_MODE,
+                                           SH_MEM_ALIGNMENT_MODE_UNALIGNED);
+                       WREG32_SOC15(GC, 0, mmSH_MEM_CONFIG, tmp);
+                       WREG32_SOC15(GC, 0, mmSH_MEM_BASES, 0);
+               } else {
+                       tmp = REG_SET_FIELD(0, SH_MEM_CONFIG, ALIGNMENT_MODE,
+                                           SH_MEM_ALIGNMENT_MODE_UNALIGNED);
+                       WREG32_SOC15(GC, 0, mmSH_MEM_CONFIG, tmp);
+                       tmp = adev->mc.shared_aperture_start >> 48;
+                       WREG32_SOC15(GC, 0, mmSH_MEM_BASES, tmp);
+               }
         }
         soc15_grbm_select(adev, 0, 0, 0, 0);
 
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -0
index 695e0eada1cd..dbfb746a390c 100644
@@ -497,6 +497,14 @@ static int gmc_v9_0_early_init(void *handle)
         gmc_v9_0_set_gart_funcs(adev);
         gmc_v9_0_set_irq_funcs(adev);
 
+       adev->mc.shared_aperture_start = 0x2000000000000000ULL;
+       adev->mc.shared_aperture_end =
+               adev->mc.shared_aperture_start + (4ULL << 30) - 1;
+       adev->mc.private_aperture_start =
+               adev->mc.shared_aperture_end + 1;
+       adev->mc.private_aperture_end =
+               adev->mc.private_aperture_start + (4ULL << 30) - 1;
+
         return 0;
  }
 
Quoted 7 lines
Quoted 3 lines

--
2.13.6

_______________________________________________
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

#5 lore raw
In reply to a message not in the archive
Quoted 13 lines · Alex Deucher

Same as previous asics. This was not yet set for gfx9.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 17 ++++++++++++-----
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c |  8 ++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 3fd13b77e71e..7564f87b084e 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_gpu_init(struct amdgpu_device *adev) · line 1529

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
@@ -1529,11 +1529,18 @@ static void gfx_v9_0_gpu_init(struct amdgpu_device *adev)
 	for (i = 0; i < 16; i++) {

On GFXv8 this loop uses adev->vm_manager.id_mgr[0].num_ids instead of hard-coded 16. No need for you to initialize the VMIDs used by KFD.

Regards,
  Felix

Quoted 31 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +12 -5
 		soc15_grbm_select(adev, 0, 0, 0, i);
 		/* CP and shaders */
-		tmp = 0;
-		tmp = REG_SET_FIELD(tmp, SH_MEM_CONFIG, ALIGNMENT_MODE,
-				    SH_MEM_ALIGNMENT_MODE_UNALIGNED);
-		WREG32_SOC15(GC, 0, mmSH_MEM_CONFIG, tmp);
-		WREG32_SOC15(GC, 0, mmSH_MEM_BASES, 0);
+		if (i == 0) {
+			tmp = REG_SET_FIELD(0, SH_MEM_CONFIG, ALIGNMENT_MODE,
+					    SH_MEM_ALIGNMENT_MODE_UNALIGNED);
+			WREG32_SOC15(GC, 0, mmSH_MEM_CONFIG, tmp);
+			WREG32_SOC15(GC, 0, mmSH_MEM_BASES, 0);
+		} else {
+			tmp = REG_SET_FIELD(0, SH_MEM_CONFIG, ALIGNMENT_MODE,
+					    SH_MEM_ALIGNMENT_MODE_UNALIGNED);
+			WREG32_SOC15(GC, 0, mmSH_MEM_CONFIG, tmp);
+			tmp = adev->mc.shared_aperture_start >> 48;
+			WREG32_SOC15(GC, 0, mmSH_MEM_BASES, tmp);
+		}
 	}
 	soc15_grbm_select(adev, 0, 0, 0, 0);
 
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -0
index 695e0eada1cd..dbfb746a390c 100644
@@ -497,6 +497,14 @@ static int gmc_v9_0_early_init(void *handle)
 	gmc_v9_0_set_gart_funcs(adev);
 	gmc_v9_0_set_irq_funcs(adev);
 
+	adev->mc.shared_aperture_start = 0x2000000000000000ULL;

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_early_init(void *handle) · line 510

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +7 -0
+	adev->mc.shared_aperture_end =
+		adev->mc.shared_aperture_start + (4ULL << 30) - 1;
+	adev->mc.private_aperture_start =
+		adev->mc.shared_aperture_end + 1;
+	adev->mc.private_aperture_end =
+		adev->mc.private_aperture_start + (4ULL << 30) - 1;
+
 	return 0;
 }
 

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