]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: Add helper to set gart size
authorLijo Lazar <lijo.lazar@amd.com>
Thu, 30 Apr 2026 05:31:47 +0000 (11:01 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 5 May 2026 13:56:51 +0000 (09:56 -0400)
Add a helper to make any adjustments to gart size based on other
parameters or conditions.

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h

index f1d9e12ebfc7a294b9746557dbd91ad723ec8244..276f9f49d6d15babfe3cd6057d5bbfc53c1c33a2 100644 (file)
@@ -280,6 +280,15 @@ void amdgpu_gmc_sysvm_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc
                        mc->gart_size >> 20, mc->gart_start, mc->gart_end);
 }
 
+void amdgpu_gmc_set_gart_size(struct amdgpu_device *adev, u64 default_size)
+{
+       if (amdgpu_gart_size == -1)
+               adev->gmc.gart_size =
+                       default_size + adev->pm.smu_prv_buffer_size;
+       else
+               adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
+}
+
 /**
  * amdgpu_gmc_gart_location - try to find GART location
  *
index c6d7a9e54eb3714ac4370be511a6f47b116c5381..676e3aaa1f27dfa56e3162d48e2c78f02d262dc0 100644 (file)
@@ -486,4 +486,6 @@ void amdgpu_gmc_init_sw_mem_ranges(struct amdgpu_device *adev,
                                   struct amdgpu_mem_partition_info *mem_ranges);
 int amdgpu_gmc_get_vram_info(struct amdgpu_device *adev,
                int *vram_width, int *vram_type, int *vram_vendor);
+
+void amdgpu_gmc_set_gart_size(struct amdgpu_device *adev, u64 default_size);
 #endif