Skip to contentSkip to conversation

drm/amdgpu: Adjust GMCv10/11/12 gart size

PATCH In review Lijo Lazar 3 participants 7 messages Apr 29

Subsystems (2)
lore
Share & tools
lore

Lijo Lazar

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Adjust GMCv10/11/12 gart size

Adjust gart size to account for space required for firmware private buffer allocation, if any.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 2 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 2 ++
 3 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -0
index e1ace7d44ffd..1c32e653a9ad 100644
@@ -723,6 +723,8 @@ static int gmc_v10_0_mc_init(struct amdgpu_device *adev)
 		adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
 	}
 
+	adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
 	gmc_v10_0_vram_gtt_location(adev, &adev->gmc);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +2 -0
index 94d6631ce0bc..2f6e338f2a35 100644
@@ -714,6 +714,8 @@ static int gmc_v11_0_mc_init(struct amdgpu_device *adev)
 	else
 		adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
 
+	adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
 	gmc_v11_0_vram_gtt_location(adev, &adev->gmc);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +2 -0
index 5bdd4b9b7893..e5096b9cdf50 100644
@@ -770,6 +770,8 @@ static int gmc_v12_0_mc_init(struct amdgpu_device *adev)
 	} else
 		adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
 
+	adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
 	gmc_v12_0_vram_gtt_location(adev, &adev->gmc);
 
 	return 0;
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw

AMD General

Thanks & Regards
Asad

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, April 29, 2026 6:08 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Kamal, Asad <[email protected]>; Li, Candice <[email protected]>
Subject: [PATCH] drm/amdgpu: Adjust GMCv10/11/12 gart size

Adjust gart size to account for space required for firmware private buffer allocation, if any.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 ++  drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 2 ++  drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 2 ++
 3 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -0
index e1ace7d44ffd..1c32e653a9ad 100644
@@ -723,6 +723,8 @@ static int gmc_v10_0_mc_init(struct amdgpu_device *adev)
                adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
        }
 
+       adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
        gmc_v10_0_vram_gtt_location(adev, &adev->gmc);
 
        return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +2 -0
index 94d6631ce0bc..2f6e338f2a35 100644
@@ -714,6 +714,8 @@ static int gmc_v11_0_mc_init(struct amdgpu_device *adev)
        else
                adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
 
+       adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
        gmc_v11_0_vram_gtt_location(adev, &adev->gmc);
 
        return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +2 -0
index 5bdd4b9b7893..e5096b9cdf50 100644
@@ -770,6 +770,8 @@ static int gmc_v12_0_mc_init(struct amdgpu_device *adev)
        } else
                adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
 
+       adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
        gmc_v12_0_vram_gtt_location(adev, &adev->gmc);
 
        return 0;

--
2.49.0

maintainer
#2 lore raw
In reply to Lijo Lazar
Quoted 15 lines · Lijo Lazar

Adjust gart size to account for space required for firmware private buffer allocation, if any.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 2 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 2 ++
 3 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
index e1ace7d44ffd..1c32e653a9ad 100644

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_mc_init(struct amdgpu_device *adev) · line 727

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -0
@@ -723,6 +723,8 @@ static int gmc_v10_0_mc_init(struct amdgpu_device *adev)
 		adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
 	}
 
+	adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+

That is pretty much exactly what we don't want.

The SMU prv buffer size should *NOT* override the amdgpu_gart_size parameter.

Instead we should disable the SMU feature when the GART size isn't sufficient.

Regards,
Christian.

Quoted 29 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
 	gmc_v10_0_vram_gtt_location(adev, &adev->gmc);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +2 -0
index 94d6631ce0bc..2f6e338f2a35 100644
@@ -714,6 +714,8 @@ static int gmc_v11_0_mc_init(struct amdgpu_device *adev)
 	else
 		adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
 
+	adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
 	gmc_v11_0_vram_gtt_location(adev, &adev->gmc);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +2 -0
index 5bdd4b9b7893..e5096b9cdf50 100644
@@ -770,6 +770,8 @@ static int gmc_v12_0_mc_init(struct amdgpu_device *adev)
 	} else
 		adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
 
+	adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
 	gmc_v12_0_vram_gtt_location(adev, &adev->gmc);
 
 	return 0;
#3 lore raw
Quoted 19 lines · Christian König
Quoted 18 lines · Lijo Lazar

Adjust gart size to account for space required for firmware private buffer allocation, if any.

---
  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 ++
  drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 2 ++
  drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 2 ++
  3 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
index e1ace7d44ffd..1c32e653a9ad 100644
@@ -723,6 +723,8 @@ static int gmc_v10_0_mc_init(struct amdgpu_device *adev)
  		adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
  	}
 
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_mc_init(struct amdgpu_device *adev) · line 727

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -0
+	adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+

That is pretty much exactly what we don't want.

The SMU prv buffer size should *NOT* override the amdgpu_gart_size parameter.

Instead we should disable the SMU feature when the GART size isn't sufficient.

This is not enabled by default. In normal cases, this size will be 0. This an extra allocation for additional logging from FW to system memory facilitated through a module parameter.

Thanks,
Lijo

Quoted 33 lines

Regards,
Christian.

Quoted 29 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
  	gmc_v10_0_vram_gtt_location(adev, &adev->gmc);
 
  	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +2 -0
index 94d6631ce0bc..2f6e338f2a35 100644
@@ -714,6 +714,8 @@ static int gmc_v11_0_mc_init(struct amdgpu_device *adev)
  	else
  		adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
 
+	adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
  	gmc_v11_0_vram_gtt_location(adev, &adev->gmc);
 
  	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +2 -0
index 5bdd4b9b7893..e5096b9cdf50 100644
@@ -770,6 +770,8 @@ static int gmc_v12_0_mc_init(struct amdgpu_device *adev)
  	} else
  		adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
 
+	adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
  	gmc_v12_0_vram_gtt_location(adev, &adev->gmc);
 
  	return 0;
maintainer
#4 lore raw
Quoted 26 lines · Lijo
Quoted 23 lines · Christian König
Quoted 15 lines · Lijo Lazar

Adjust gart size to account for space required for firmware private buffer allocation, if any.

---

  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 ++
  drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 2 ++
  drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 2 ++
  3 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
index e1ace7d44ffd..1c32e653a9ad 100644

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_mc_init(struct amdgpu_device *adev) · line 726

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -0
@@ -723,6 +723,8 @@ static int gmc_v10_0_mc_init(struct amdgpu_device *adev)
           adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
       }
   +    adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+

That is pretty much exactly what we don't want.

Quoted 6 lines
Quoted 4 lines

The SMU prv buffer size should *NOT* override the amdgpu_gart_size parameter.

Instead we should disable the SMU feature when the GART size isn't sufficient.

This is not enabled by default. In normal cases, this size will be 0. This an extra allocation for additional logging from FW to system memory facilitated through a module parameter.

Yeah I know. But we have cases were the GART size is explicitely specified for testing.

Overriding that because the SMU logging feature is enabled is a pretty big no-go.

When the user specifies contradicting module parameter we should fail to load the driver or at least disable the feature which causes problems.

Regards,
Christian.

Quoted 33 lines

Thanks,
Lijo

Quoted 28 lines

Regards,
Christian.

Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
       gmc_v10_0_vram_gtt_location(adev, &adev->gmc);
         return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +0 -0
index 94d6631ce0bc..2f6e338f2a35 100644
@@ -714,6 +714,8 @@ static int gmc_v11_0_mc_init(struct amdgpu_device *adev)

      else
          adev->gmc.gart_size = (u64)amdgpu_gart_size << 20; +    adev->gmc.gart_size += adev->pm.smu_prv_buffer_size; +
      gmc_v11_0_vram_gtt_location(adev, &adev->gmc); return 0;

drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +1 -0
index 5bdd4b9b7893..e5096b9cdf50 100644
@@ -770,6 +770,8 @@ static int gmc_v12_0_mc_init(struct amdgpu_device *adev)
       } else
           adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
   +    adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
       gmc_v12_0_vram_gtt_location(adev, &adev->gmc);
         return 0;
#5 lore raw
Quoted 32 lines · Christian König
Quoted 31 lines · Lijo
Quoted 27 lines · Christian König
Quoted 15 lines · Lijo Lazar

Adjust gart size to account for space required for firmware private buffer allocation, if any.

---
   drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 ++
   drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 2 ++
   drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 2 ++
   3 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
index e1ace7d44ffd..1c32e653a9ad 100644

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_mc_init(struct amdgpu_device *adev) · line 726

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -0
@@ -723,6 +723,8 @@ static int gmc_v10_0_mc_init(struct amdgpu_device *adev)
           adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
       }
   +    adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+

That is pretty much exactly what we don't want.

The SMU prv buffer size should *NOT* override the amdgpu_gart_size parameter.

Instead we should disable the SMU feature when the GART size isn't sufficient.

Quoted 8 lines
Quoted 1 line

This is not enabled by default. In normal cases, this size will be 0. This an extra allocation for additional logging from FW to system memory facilitated through a module parameter.

Yeah I know. But we have cases were the GART size is explicitely specified for testing.

Overriding that because the SMU logging feature is enabled is a pretty big no-go.

When the user specifies contradicting module parameter we should fail to load the driver or at least disable the feature which causes problems.

Do you mean to add allocation only when amdgpu_gart_size = -1? When gart size is specified, it will simply fail driver load if there is not enough space.

Thanks,
Lijo

Quoted 37 lines

Regards,
Christian.

Quoted 33 lines

Thanks,
Lijo

Quoted 28 lines

Regards,
Christian.

Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
       gmc_v10_0_vram_gtt_location(adev, &adev->gmc);
         return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +1 -0
index 94d6631ce0bc..2f6e338f2a35 100644
@@ -714,6 +714,8 @@ static int gmc_v11_0_mc_init(struct amdgpu_device *adev)
       else
           adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
   +    adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
       gmc_v11_0_vram_gtt_location(adev, &adev->gmc);
         return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +1 -0
index 5bdd4b9b7893..e5096b9cdf50 100644
@@ -770,6 +770,8 @@ static int gmc_v12_0_mc_init(struct amdgpu_device *adev)
       } else
           adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
   +    adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
       gmc_v12_0_vram_gtt_location(adev, &adev->gmc);
         return 0;
maintainer
#6 lore raw
Quoted 37 lines · Lijo
Quoted 34 lines · Christian König
Quoted 32 lines · Lijo
Quoted 23 lines · Christian König
Quoted 15 lines · Lijo Lazar

Adjust gart size to account for space required for firmware private buffer allocation, if any.

---

   drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 ++
   drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 2 ++
   drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 2 ++
   3 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
index e1ace7d44ffd..1c32e653a9ad 100644

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_mc_init(struct amdgpu_device *adev) · line 726

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -0
@@ -723,6 +723,8 @@ static int gmc_v10_0_mc_init(struct amdgpu_device *adev)
            adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
        }
    +    adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+

That is pretty much exactly what we don't want.

Quoted 4 lines

The SMU prv buffer size should *NOT* override the amdgpu_gart_size parameter.

Instead we should disable the SMU feature when the GART size isn't sufficient.

This is not enabled by default. In normal cases, this size will be 0. This an extra allocation for additional logging from FW to system memory facilitated through a module parameter.

Quoted 8 lines
Quoted 6 lines

Yeah I know. But we have cases were the GART size is explicitely specified for testing.

Overriding that because the SMU logging feature is enabled is a pretty big no-go.

When the user specifies contradicting module parameter we should fail to load the driver or at least disable the feature which causes problems.

Do you mean to add allocation only when amdgpu_gart_size  = -1? When gart size is specified, it will simply fail driver load if there is not enough space.

Exactly that yes.

My suggestion is to add a new function amdgpu_gmc_gart_size(adev, uint64_t default) which updates adev->gmc.gart_size and either uses amdgpu_gart_size or default + adev->pm.smu_prv_buffer_size.

Background is that the adev->pm.smu_prv_buffer_size is actually not HW specific, so duplicating that in every gmc_v*.c is potentially a bad idea.

Regards,
Christian.

Quoted 42 lines

Thanks,
Lijo

Quoted 37 lines

Regards,
Christian.

Quoted 33 lines

Thanks,
Lijo

Quoted 28 lines

Regards,
Christian.

Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
        gmc_v10_0_vram_gtt_location(adev, &adev->gmc);
          return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +0 -0
index 94d6631ce0bc..2f6e338f2a35 100644
@@ -714,6 +714,8 @@ static int gmc_v11_0_mc_init(struct amdgpu_device *adev)

       else
           adev->gmc.gart_size = (u64)amdgpu_gart_size << 20; +    adev->gmc.gart_size += adev->pm.smu_prv_buffer_size; +
       gmc_v11_0_vram_gtt_location(adev, &adev->gmc); return 0;

drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +1 -0
index 5bdd4b9b7893..e5096b9cdf50 100644
@@ -770,6 +770,8 @@ static int gmc_v12_0_mc_init(struct amdgpu_device *adev)
        } else
            adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
    +    adev->gmc.gart_size += adev->pm.smu_prv_buffer_size;
+
        gmc_v12_0_vram_gtt_location(adev, &adev->gmc);
          return 0;