Skip to contentSkip to conversation

drm/amdgpu: Limit the maximum size of contiguous VRAM that can be encapsulated by an instance of DRM memory node

PATCH In review Ramesh Errabolu 2 participants 2 messages Jan 28, 2021 – Jan 29, 2021

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

PATCH 1/1 drm/amdgpu: Limit the maximum size of contiguous VRAM that can be encapsulated by an instance of DRM memory node

[Why]
Enable 1:1 mapping between VRAM of a DRM node and a scatterlist node

[How]
Ensure construction of DRM node to not exceed specified limit

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +3 -0
index 20747d8b1135..21d18efca277 100644
@@ -476,6 +476,9 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
 	for (i = 0; pages_left >= pages_per_node; ++i) {
 		unsigned long pages = rounddown_pow_of_two(pages_left);
 
+		/* Limit maximum size to 2GB due to SG table limitations */
+		pages = min(pages, (2UL << (30 - PAGE_SHIFT)));
+
 		r = drm_mm_insert_node_in_range(mm, &nodes[i], pages,
 						pages_per_node, 0,
 						place->fpfn, lpfn,
Signature · 6 lines
2.29.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/1
#1 lore raw

Am 28.01.21 um 18:43 schrieb Ramesh Errabolu:

Quoted 7 lines

[Why]
Enable 1:1 mapping between VRAM of a DRM node and a scatterlist node

[How]
Ensure construction of DRM node to not exceed specified limit

Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +0 -0
index 20747d8b1135..21d18efca277 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man, · line 484

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +3 -0
@@ -476,6 +476,9 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
  	for (i = 0; pages_left >= pages_per_node; ++i) {
  		unsigned long pages = rounddown_pow_of_two(pages_left);
 
+		/* Limit maximum size to 2GB due to SG table limitations */
+		pages = min(pages, (2UL << (30 - PAGE_SHIFT)));
+
  		r = drm_mm_insert_node_in_range(mm, &nodes[i], pages,
  						pages_per_node, 0,
  						place->fpfn, lpfn,

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