Skip to contentSkip to conversation

drm/amdgpu: fix 64bit division

PATCH In review Christian König 2 participants 2 messages Apr 5, 2017 1 message not in the archive

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

PATCH 1/1 drm/amdgpu: fix 64bit division

From: Christian König <[email protected]>

Added with "handle CPU access for split VRAM buffers".

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -2
index 10b793a..c91f13b 100644
@@ -551,9 +551,9 @@ static unsigned long amdgpu_ttm_io_mem_pfn(struct ttm_buffer_object *bo,
 {
 	struct drm_mm_node *mm = bo->mem.mm_node;
 	uint64_t size = mm->size;
+	unsigned long offset = page_offset;
 
-	mm += page_offset / size;
-	page_offset %= size;
+	page_offset = do_div(offset, size);
 	return (bo->mem.bus.base >> PAGE_SHIFT) + mm->start + page_offset;
 }
 
Signature · 6 lines
2.5.0

_______________________________________________
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): 1491385157-16175-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 5 lines · Christian König

From: Christian König <[email protected]>

Added with "handle CPU access for split VRAM buffers".

Quoted 23 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -3
index 10b793a..c91f13b 100644
@@ -551,9 +551,9 @@ static unsigned long amdgpu_ttm_io_mem_pfn(struct ttm_buffer_object *bo,
 {
        struct drm_mm_node *mm = bo->mem.mm_node;
        uint64_t size = mm->size;
+       unsigned long offset = page_offset;
 
-       mm += page_offset / size;
-       page_offset %= size;
+       page_offset = do_div(offset, size);
        return (bo->mem.bus.base >> PAGE_SHIFT) + mm->start + page_offset;
 }
 
--

2.5.0

Quoted 4 lines

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

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