Skip to contentSkip to conversation

drm/amdgpu: use correct rounding macro for 64-bit

PATCH In review Dave Airlie 3 participants 5 messages Jun 10, 2021

Subsystems (2)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: use correct rounding macro for 64-bit

From: Dave Airlie <[email protected]>

This fixes 32-bit arm build due to lack of 64-bit divides.

Fixes cb1c81467af3 ("drm/ttm: flip the switch for driver allocated resources v2")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +1 -1
index 9a6df02477ce..436ec246a7da 100644
@@ -407,7 +407,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
 #endif
 		pages_per_node = max_t(uint32_t, pages_per_node,
 				       tbo->page_alignment);
-		num_nodes = DIV_ROUND_UP(PFN_UP(mem_bytes), pages_per_node);
+		num_nodes = DIV_ROUND_UP_ULL(PFN_UP(mem_bytes), pages_per_node);
 	}
 
 	node = kvmalloc(struct_size(node, mm_nodes, num_nodes),
Signature · 1 line
2.25.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Dave Airlie

From: Dave Airlie <[email protected]>

This fixes 32-bit arm build due to lack of 64-bit divides.

Fixes cb1c81467af3 ("drm/ttm: flip the switch for driver allocated resources v2")
Quoted 20 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +1 -2
index 9a6df02477ce..436ec246a7da 100644
@@ -407,7 +407,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
 #endif
                pages_per_node = max_t(uint32_t, pages_per_node,
                                       tbo->page_alignment);
-               num_nodes = DIV_ROUND_UP(PFN_UP(mem_bytes), pages_per_node);
+               num_nodes = DIV_ROUND_UP_ULL(PFN_UP(mem_bytes), pages_per_node);
        }
 
        node = kvmalloc(struct_size(node, mm_nodes, num_nodes),
--

2.25.4

#3 lore raw
Quoted 7 lines · Dave Airlie
Quoted 5 lines · Alex Deucher
Quoted 3 lines · Dave Airlie

From: Dave Airlie <[email protected]>

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

This fixes 32-bit arm build due to lack of 64-bit divides.

Fixes cb1c81467af3 ("drm/ttm: flip the switch for driver allocated resources v2")

I'm going to apply this directly to next.

Thanks!

Alex

Quoted 2 lines

Dave.

maintainer Reviewed-by on v1 1/1
#4 lore raw
In reply to Dave Airlie

Am 10.06.21 um 05:03 schrieb Dave Airlie:

Quoted 6 lines

From: Dave Airlie <[email protected]>

This fixes 32-bit arm build due to lack of 64-bit divides.

Fixes cb1c81467af3 ("drm/ttm: flip the switch for driver allocated resources v2")

I was already wondering why we suddenly have a 64bit division here, but couldn't see it of hand.

Should I push that to drm-misc-next?

Thanks,
Christian.

Quoted 17 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +1 -1
index 9a6df02477ce..436ec246a7da 100644
@@ -407,7 +407,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
  #endif
  		pages_per_node = max_t(uint32_t, pages_per_node,
  				       tbo->page_alignment);
-		num_nodes = DIV_ROUND_UP(PFN_UP(mem_bytes), pages_per_node);
+		num_nodes = DIV_ROUND_UP_ULL(PFN_UP(mem_bytes), pages_per_node);
  	}
 
  	node = kvmalloc(struct_size(node, mm_nodes, num_nodes),