[PATCH] drm/amdgpu: fix 64bit division

Alex Deucher alexdeucher at gmail.com
Wed Apr 5 12:50:05 UTC 2017


On Wed, Apr 5, 2017 at 5:39 AM, Christian König <deathsimple at vodafone.de> wrote:
> From: Christian König <christian.koenig at amd.com>
>
> Added with "handle CPU access for split VRAM buffers".
>
> Signed-off-by: Christian König <christian.koenig at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 10b793a..c91f13b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -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
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list