Skip to contentSkip to conversation

drm/amdgpu: Limit the max mc address to AMDGPU_VA_HOLE_START

PATCH In review Emily Deng 2 participants 3 messages Sep 29, 2018 – Oct 4, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Limit the max mc address to AMDGPU_VA_HOLE_START

For the vram_start is 0 case, the gart range will be from 0x0000FFFF00000000 to 0x0000FFFF1FFFFFFF, which will cause the sdma engine hang.

So limit the mc address to AMDGPU_VA_HOLE_START.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +3 -2
index 9a5b252..7245260 100644
@@ -146,6 +146,7 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
 {
 	const uint64_t four_gb = 0x100000000ULL;
 	u64 size_af, size_bf;
+	u64 max_mc_address = min(adev->gmc.mc_mask, AMDGPU_VA_HOLE_START);
 
 	mc->gart_size += adev->pm.smu_prv_buffer_size;
 
@@ -153,7 +154,7 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
 	 * the GART base on a 4GB boundary as well.
 	 */
 	size_bf = mc->fb_start;
-	size_af = adev->gmc.mc_mask + 1 - ALIGN(mc->fb_end + 1, four_gb);
+	size_af = max_mc_address + 1 - ALIGN(mc->fb_end + 1, four_gb);
 
 	if (mc->gart_size > max(size_bf, size_af)) {
 		dev_warn(adev->dev, "limiting GART\n");
@@ -164,7 +165,7 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
 	    (size_af < mc->gart_size))
 		mc->gart_start = 0;
 	else
-		mc->gart_start = mc->mc_mask - mc->gart_size + 1;
+		mc->gart_start = max_mc_address - mc->gart_size + 1;
 
 	mc->gart_start &= ~(four_gb - 1);
 	mc->gart_end = mc->gart_start + mc->gart_size - 1;
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): 1538214518-14646-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 29.09.2018 um 11:48 schrieb Emily Deng:

Quoted 4 lines

For the vram_start is 0 case, the gart range will be from 0x0000FFFF00000000 to 0x0000FFFF1FFFFFFF, which will cause the sdma engine hang.

So limit the mc address to AMDGPU_VA_HOLE_START.

Well NAK, but that's what I've done initially as well :)

That stuff should now be handled by amdgpu_gmc_sign_extend(), but looks like that is missing somewhere.

I can take a look tomorrow, most likely just a one liner somewhere.

Christian.

Quoted 28 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +2 -1
index 9a5b252..7245260 100644
@@ -146,6 +146,7 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
  {
  	const uint64_t four_gb = 0x100000000ULL;
  	u64 size_af, size_bf;
+	u64 max_mc_address = min(adev->gmc.mc_mask, AMDGPU_VA_HOLE_START);
 
  	mc->gart_size += adev->pm.smu_prv_buffer_size;
 
@@ -153,7 +154,7 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
  	 * the GART base on a 4GB boundary as well.
  	 */
  	size_bf = mc->fb_start;
-	size_af = adev->gmc.mc_mask + 1 - ALIGN(mc->fb_end + 1, four_gb);
+	size_af = max_mc_address + 1 - ALIGN(mc->fb_end + 1, four_gb);
 
  	if (mc->gart_size > max(size_bf, size_af)) {
  		dev_warn(adev->dev, "limiting GART\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc) · line 171

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1 -1
@@ -164,7 +165,7 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
  	    (size_af < mc->gart_size))
  		mc->gart_start = 0;
  	else
-		mc->gart_start = mc->mc_mask - mc->gart_size + 1;
+		mc->gart_start = max_mc_address - mc->gart_size + 1;
 
  	mc->gart_start &= ~(four_gb - 1);
  	mc->gart_end = mc->gart_start + mc->gart_size - 1;

_______________________________________________
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): fad4565d-3ef8-dff8-1fe1-8db8aa2f8957-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw

Looks like not only the SDMA has a problem with this, but also the VCE firmware :(

Please add a comment to explain why we do this, with that done the patch is Reviewed-by: Christian König <[email protected]>.

Regards,
Christian.

Am 03.10.2018 um 16:39 schrieb Christian König:

Quoted 40 lines

Am 29.09.2018 um 11:48 schrieb Emily Deng:

Quoted 4 lines

For the vram_start is 0 case, the gart range will be from 0x0000FFFF00000000 to 0x0000FFFF1FFFFFFF, which will cause the sdma engine hang.

So limit the mc address to AMDGPU_VA_HOLE_START.

Well NAK, but that's what I've done initially as well :)

That stuff should now be handled by amdgpu_gmc_sign_extend(), but looks like that is missing somewhere.

I can take a look tomorrow, most likely just a one liner somewhere.

Christian.

Quoted 26 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 +++--

  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1 -0
index 9a5b252..7245260 100644
@@ -146,6 +146,7 @@ void amdgpu_gmc_gart_location(struct 
 amdgpu_device *adev, struct amdgpu_gmc *mc)
   {
       const uint64_t four_gb = 0x100000000ULL;
       u64 size_af, size_bf;
+    u64 max_mc_address = min(adev->gmc.mc_mask, AMDGPU_VA_HOLE_START);
         mc->gart_size += adev->pm.smu_prv_buffer_size;
   @@ -153,7 +154,7 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)

       * the GART base on a 4GB boundary as well.
       */
      size_bf = mc->fb_start;
-    size_af = adev->gmc.mc_mask + 1 - ALIGN(mc->fb_end + 1, four_gb); +    size_af = max_mc_address + 1 - ALIGN(mc->fb_end + 1, four_gb); if (mc->gart_size > max(size_bf, size_af)) { dev_warn(adev->dev, "limiting GART\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0 -0
@@ -164,7 +165,7 @@ void amdgpu_gmc_gart_location(struct 
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0 -0
 amdgpu_device *adev, struct amdgpu_gmc *mc)
           (size_af < mc->gart_size))
           mc->gart_start = 0;

      else
-        mc->gart_start = mc->mc_mask - mc->gart_size + 1; +        mc->gart_start = max_mc_address - mc->gart_size + 1; mc->gart_start &= ~(four_gb - 1); mc->gart_end = mc->gart_start + mc->gart_size - 1;

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